@@ -6,37 +6,37 @@ Subject: fix: lazyload fs in esm loaders to apply asar patches
6
6
Changes { foo } from fs to just "fs.foo" so that our patching of fs is applied to esm loaders
7
7
8
8
diff --git a/lib/internal/modules/esm/load.js b/lib/internal/modules/esm/load.js
9
- index ac24cf305bd5995ad13b37ee36f9e1fe3589c5d7..22248b753c14960122f1d6b9bfe6b89fdb8d2010 100644
9
+ index 605e812d515fc467001e4ab88fc15b4af3fd4aa2..463e76cb1abc0c2fdddba4db2ca2e00f7c591e12 100644
10
10
--- a/lib/internal/modules/esm/load.js
11
11
+++ b/lib/internal/modules/esm/load.js
12
- @@ -10 ,7 +10 ,7 @@ const { kEmptyObject } = require('internal/util');
12
+ @@ -8 ,7 +8 ,7 @@ const { kEmptyObject } = require('internal/util');
13
13
const { defaultGetFormat } = require('internal/modules/esm/get_format');
14
14
const { validateAttributes, emitImportAssertionWarning } = require('internal/modules/esm/assert');
15
15
const { getOptionValue } = require('internal/options');
16
16
- const { readFileSync } = require('fs');
17
17
+ const fs = require('fs');
18
18
19
- // Do not eagerly grab .manifest, it may be in TDZ
20
- const policy = getOptionValue('--experimental-policy') ?
21
- @@ -42 ,8 +42 ,7 @@ async function getSource(url, context) {
22
- let responseURL = href;
19
+ const defaultType =
20
+ getOptionValue('--experimental-default-type');
21
+ @@ -40 ,8 +40 ,7 @@ async function getSource(url, context) {
22
+ const responseURL = href;
23
23
let source;
24
24
if (protocol === 'file:') {
25
25
- const { readFile: readFileAsync } = require('internal/fs/promises').exports;
26
26
- source = await readFileAsync(url);
27
27
+ source = await fs.promises.readFile(url);
28
28
} else if (protocol === 'data:') {
29
- const match = RegExpPrototypeExec(DATA_URL_PATTERN, url.pathname );
30
- if (!match ) {
31
- @@ -82 ,7 +81 ,7 @@ function getSourceSync(url, context) {
29
+ const result = dataURLProcessor( url);
30
+ if (result === 'failure' ) {
31
+ @@ -65 ,7 +64 ,7 @@ function getSourceSync(url, context) {
32
32
const responseURL = href;
33
33
let source;
34
34
if (protocol === 'file:') {
35
35
- source = readFileSync(url);
36
36
+ source = fs.readFileSync(url);
37
37
} else if (protocol === 'data:') {
38
- const match = RegExpPrototypeExec(DATA_URL_PATTERN, url.pathname );
39
- if (!match ) {
38
+ const result = dataURLProcessor( url);
39
+ if (result === 'failure' ) {
40
40
diff --git a/lib/internal/modules/esm/resolve.js b/lib/internal/modules/esm/resolve.js
41
41
index 52cdb7d5e14a18ed7b1b65e429729cf47dce3f98..69f73f829706deddc4f328b78af9d58434af647d 100644
42
42
--- a/lib/internal/modules/esm/resolve.js
0 commit comments