@jsenv/plugin-commonjs 2.4.1 → 2.5.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,6 +1,6 @@
1
1
  {
2
2
  "name": "@jsenv/plugin-commonjs",
3
- "version": "2.4.1",
3
+ "version": "2.5.0",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",
@@ -24,18 +24,18 @@
24
24
  "test": "node --conditions=development ./scripts/test.mjs"
25
25
  },
26
26
  "dependencies": {
27
- "@jsenv/filesystem": "4.2.4",
27
+ "@jsenv/filesystem": "4.2.5",
28
28
  "@jsenv/log": "3.4.0",
29
29
  "@jsenv/url-meta": "8.1.0",
30
- "@jsenv/urls": "2.1.0",
31
- "@rollup/plugin-commonjs": "25.0.2",
30
+ "@jsenv/urls": "2.2.0",
31
+ "@rollup/plugin-commonjs": "25.0.3",
32
32
  "@rollup/plugin-json": "6.0.0",
33
33
  "@rollup/plugin-node-resolve": "15.1.0",
34
34
  "@rollup/plugin-replace": "5.0.2",
35
35
  "cjs-module-lexer": "1.2.3",
36
36
  "is-valid-identifier": "2.0.2",
37
37
  "resolve": "1.22.2",
38
- "rollup": "3.26.2",
38
+ "rollup": "3.27.0",
39
39
  "rollup-plugin-node-globals": "1.4.0",
40
40
  "rollup-plugin-polyfill-node": "0.12.0",
41
41
  "vm2": "3.9.19"
@@ -23,7 +23,7 @@ export const jsenvPluginCommonJs = ({
23
23
  const basename = isBareSpecifier(reference.specifier)
24
24
  ? reference.specifier
25
25
  : urlToBasename(reference.url);
26
- reference.filename = `${basename}${onwerUrlExtension}`;
26
+ reference.filenameHint = `${basename}${onwerUrlExtension}`;
27
27
  }
28
28
  }
29
29
  };
@@ -53,6 +53,15 @@ export const jsenvPluginCommonJs = ({
53
53
  markAsJsModuleProxy(reference);
54
54
  return null;
55
55
  }
56
+ // when search param is injected, it will be removed later
57
+ // by "getWithoutSearchParam". We don't want to redirect again
58
+ // (would create infinite recursion)
59
+ if (
60
+ reference.prev &&
61
+ reference.prev.searchParams.has(`cjs_as_js_module`)
62
+ ) {
63
+ return null;
64
+ }
56
65
  const { commonjs } = URL_META.applyAssociations({
57
66
  url: reference.url,
58
67
  associations,
@@ -75,7 +84,7 @@ export const jsenvPluginCommonJs = ({
75
84
  if (!commonJsUrlInfo) {
76
85
  return null;
77
86
  }
78
- await commonJsUrlInfo.fetchContent();
87
+ await commonJsUrlInfo.cook();
79
88
  const nodeRuntimeEnabled = Object.keys(
80
89
  urlInfo.context.runtimeCompat,
81
90
  ).includes("node");