@jsenv/node-esm-resolution 1.2.16 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,25 +1,24 @@
1
1
  {
2
2
  "name": "@jsenv/node-esm-resolution",
3
- "version": "1.2.16",
3
+ "version": "1.3.0",
4
+ "type": "module",
4
5
  "repository": {
5
6
  "type": "git",
6
7
  "url": "https://github.com/jsenv/core",
7
8
  "directory": "packages/tooling/node-esm-resolution"
8
9
  },
9
10
  "license": "MIT",
10
- "sideEffects": false,
11
- "type": "module",
11
+ "main": "./main.js",
12
12
  "exports": {
13
13
  ".": {
14
14
  "import": "./main.js"
15
15
  },
16
16
  "./*": "./*"
17
17
  },
18
- "main": "./main.js",
19
18
  "files": [
20
19
  "/dist/",
21
- "/src/",
22
- "/main.js"
20
+ "/main.js",
21
+ "/src/"
23
22
  ],
24
23
  "dependencies": {
25
24
  "@jsenv/filesystem": "4.15.15"
@@ -31,5 +30,6 @@
31
30
  },
32
31
  "publishConfig": {
33
32
  "access": "public"
34
- }
33
+ },
34
+ "sideEffects": false
35
35
  }
@@ -1,30 +1,27 @@
1
1
  export const isSpecifierForNodeBuiltin = (specifier) => {
2
2
  return (
3
3
  specifier.startsWith("node:") ||
4
- NODE_BUILTIN_MODULE_SPECIFIERS.includes(specifier)
4
+ NODE_BUILTIN_MODULE_SPECIFIER_SET.has(specifier)
5
5
  );
6
6
  };
7
7
 
8
- const NODE_BUILTIN_MODULE_SPECIFIERS = [
8
+ const NODE_BUILTIN_MODULE_SPECIFIER_SET = new Set([
9
9
  "assert",
10
10
  "assert/strict",
11
11
  "async_hooks",
12
- "buffer_ieee754",
13
12
  "buffer",
14
13
  "child_process",
15
14
  "cluster",
16
15
  "console",
17
16
  "constants",
18
17
  "crypto",
19
- "_debugger",
20
18
  "diagnostics_channel",
21
19
  "dgram",
22
20
  "dns",
21
+ "dns/promises",
23
22
  "domain",
24
23
  "events",
25
- "freelist",
26
24
  "fs",
27
- "fsevents",
28
25
  "fs/promises",
29
26
  "_http_agent",
30
27
  "_http_client",
@@ -36,21 +33,21 @@ const NODE_BUILTIN_MODULE_SPECIFIERS = [
36
33
  "http2",
37
34
  "https",
38
35
  "inspector",
39
- "_linklist",
36
+ "inspector/promises",
40
37
  "module",
41
38
  "net",
42
- "node-inspect/lib/_inspect",
43
- "node-inspect/lib/internal/inspect_client",
44
- "node-inspect/lib/internal/inspect_repl",
45
39
  "os",
46
40
  "path",
41
+ "path/posix",
42
+ "path/win32",
47
43
  "perf_hooks",
48
44
  "process",
49
45
  "punycode",
50
46
  "querystring",
51
47
  "readline",
48
+ "readline/promises",
52
49
  "repl",
53
- "smalloc",
50
+ "sea",
54
51
  "sqlite",
55
52
  "_stream_duplex",
56
53
  "_stream_transform",
@@ -59,10 +56,15 @@ const NODE_BUILTIN_MODULE_SPECIFIERS = [
59
56
  "_stream_readable",
60
57
  "_stream_writable",
61
58
  "stream",
59
+ "stream/consumers",
62
60
  "stream/promises",
61
+ "stream/web",
63
62
  "string_decoder",
64
63
  "sys",
64
+ "test",
65
+ "test/reporters",
65
66
  "timers",
67
+ "timers/promises",
66
68
  "_tls_common",
67
69
  "_tls_legacy",
68
70
  "_tls_wrap",
@@ -71,17 +73,12 @@ const NODE_BUILTIN_MODULE_SPECIFIERS = [
71
73
  "tty",
72
74
  "url",
73
75
  "util",
74
- "v8/tools/arguments",
75
- "v8/tools/codemap",
76
- "v8/tools/consarray",
77
- "v8/tools/csvparser",
78
- "v8/tools/logreader",
79
- "v8/tools/profile_view",
80
- "v8/tools/splaytree",
76
+ "util/types",
81
77
  "v8",
82
78
  "vm",
79
+ "wasi",
83
80
  "worker_threads",
84
81
  "zlib",
85
82
  // global is special
86
83
  "global",
87
- ];
84
+ ]);
@@ -647,20 +647,22 @@ const applyLegacySubpathResolution = (packageSubpath, resolutionContext) => {
647
647
 
648
648
  const applyLegacyMainResolution = (packageSubpath, resolutionContext) => {
649
649
  const { conditions, packageDirectoryUrl, packageJson } = resolutionContext;
650
- for (const condition of conditions) {
651
- const conditionResolver = mainLegacyResolvers[condition];
652
- if (!conditionResolver) {
653
- continue;
654
- }
655
- const resolved = conditionResolver(resolutionContext);
656
- if (resolved) {
657
- return createResolutionResult({
658
- type: resolved.type,
659
- isMain: resolved.isMain,
660
- packageDirectoryUrl,
661
- packageJson,
662
- url: new URL(resolved.path, packageDirectoryUrl).href,
663
- });
650
+ if (packageJson) {
651
+ for (const condition of conditions) {
652
+ const conditionResolver = mainLegacyResolvers[condition];
653
+ if (!conditionResolver) {
654
+ continue;
655
+ }
656
+ const resolved = conditionResolver(resolutionContext);
657
+ if (resolved) {
658
+ return createResolutionResult({
659
+ type: resolved.type,
660
+ isMain: resolved.isMain,
661
+ packageDirectoryUrl,
662
+ packageJson,
663
+ url: new URL(resolved.path, packageDirectoryUrl).href,
664
+ });
665
+ }
664
666
  }
665
667
  }
666
668
  return createResolutionResult({