@jsenv/core 29.7.1 → 29.8.1

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.
Files changed (47) hide show
  1. package/README.md +9 -12
  2. package/dist/babel_helpers/checkInRHS/checkInRHS.js +6 -0
  3. package/dist/babel_helpers/createClass/createClass.js +2 -1
  4. package/dist/babel_helpers/defineProperty/defineProperty.js +2 -0
  5. package/dist/babel_helpers/regeneratorRuntime/regeneratorRuntime.js +38 -21
  6. package/dist/js/s.js +2 -2
  7. package/dist/js/s.js.map +3 -3
  8. package/dist/js/ws.js +29 -8
  9. package/dist/main.js +431 -178
  10. package/package.json +6 -6
  11. package/src/build/build.js +12 -9
  12. package/src/dev/file_service.js +4 -7
  13. package/src/dev/start_dev_server.js +0 -1
  14. package/src/kitchen/compat/{features_compats.js → features_compatibility.js} +4 -1
  15. package/src/kitchen/compat/runtime_compat.js +3 -3
  16. package/src/kitchen/kitchen.js +18 -9
  17. package/src/kitchen/url_graph/url_info_transformations.js +1 -0
  18. package/src/kitchen/url_specifier_encoding.js +2 -2
  19. package/src/plugins/bundling/js_module/bundle_js_modules.js +5 -3
  20. package/src/plugins/commonjs_globals/jsenv_plugin_commonjs_globals.js +1 -1
  21. package/src/plugins/import_meta_hot/jsenv_plugin_import_meta_hot.js +3 -3
  22. package/src/plugins/import_meta_scenarios/jsenv_plugin_import_meta_scenarios.js +1 -1
  23. package/src/plugins/importmap/jsenv_plugin_importmap.js +2 -2
  24. package/src/plugins/plugin_controller.js +70 -71
  25. package/src/plugins/ribbon/jsenv_plugin_ribbon.js +1 -1
  26. package/src/plugins/supervisor/jsenv_plugin_supervisor.js +1 -1
  27. package/src/plugins/toolbar/jsenv_plugin_toolbar.js +1 -1
  28. package/src/plugins/transpilation/as_js_classic/client/s.js +1 -1
  29. package/src/plugins/transpilation/as_js_classic/convert_js_module_to_js_classic.js +2 -0
  30. package/src/plugins/transpilation/as_js_classic/helpers/babel_plugin_transform_import_meta_resolve.js +26 -0
  31. package/src/plugins/transpilation/as_js_classic/jsenv_plugin_as_js_classic_conversion.js +5 -11
  32. package/src/plugins/transpilation/as_js_classic/jsenv_plugin_as_js_classic_html.js +2 -2
  33. package/src/plugins/transpilation/as_js_classic/jsenv_plugin_as_js_classic_library.js +3 -3
  34. package/src/plugins/transpilation/as_js_classic/jsenv_plugin_as_js_classic_workers.js +1 -1
  35. package/src/plugins/transpilation/as_js_module/convert_js_classic_to_js_module.js +45 -0
  36. package/src/plugins/transpilation/as_js_module/jsenv_plugin_as_js_module.js +78 -0
  37. package/src/plugins/transpilation/babel/jsenv_plugin_babel.js +2 -2
  38. package/src/plugins/transpilation/import_assertions/jsenv_plugin_import_assertions.js +11 -11
  39. package/src/plugins/transpilation/jsenv_plugin_import_meta_resolve.js +52 -0
  40. package/src/plugins/transpilation/jsenv_plugin_top_level_await.js +16 -13
  41. package/src/plugins/transpilation/jsenv_plugin_transpilation.js +5 -0
  42. package/src/plugins/url_analysis/html/html_urls.js +1 -1
  43. package/src/plugins/url_analysis/js/js_urls.js +1 -0
  44. package/src/plugins/url_analysis/jsenv_plugin_reference_expected_types.js +4 -2
  45. package/src/plugins/url_analysis/jsenv_plugin_url_analysis.js +1 -1
  46. package/src/plugins/url_resolution/jsenv_plugin_url_resolution.js +3 -3
  47. package/src/plugins/url_resolution/node_esm_resolver.js +2 -2
@@ -13,16 +13,13 @@ export const jsenvPluginAsJsClassicConversion = ({
13
13
  }) => {
14
14
  const isReferencingJsModule = (reference) => {
15
15
  if (
16
- reference.type === "js_import_export" ||
16
+ reference.type === "js_import" ||
17
17
  reference.subtype === "system_register_arg" ||
18
18
  reference.subtype === "system_import_arg"
19
19
  ) {
20
20
  return true
21
21
  }
22
- if (
23
- reference.type === "js_url_specifier" &&
24
- reference.expectedType === "js_module"
25
- ) {
22
+ if (reference.type === "js_url" && reference.expectedType === "js_module") {
26
23
  return true
27
24
  }
28
25
  return false
@@ -90,17 +87,14 @@ export const jsenvPluginAsJsClassicConversion = ({
90
87
  await context.fetchUrlContent(jsModuleUrlInfo, {
91
88
  reference: jsModuleReference,
92
89
  })
93
- if (context.scenarios.dev) {
90
+ if (context.dev) {
94
91
  context.referenceUtils.found({
95
- type: "js_import_export",
92
+ type: "js_import",
96
93
  subtype: jsModuleReference.subtype,
97
94
  specifier: jsModuleReference.url,
98
95
  expectedType: "js_module",
99
96
  })
100
- } else if (
101
- context.scenarios.build &&
102
- jsModuleUrlInfo.dependents.size === 0
103
- ) {
97
+ } else if (context.build && jsModuleUrlInfo.dependents.size === 0) {
104
98
  context.urlGraph.deleteUrlInfo(jsModuleUrlInfo.url)
105
99
  }
106
100
  const { content, sourcemap } = await convertJsModuleToJsClassic({
@@ -68,7 +68,7 @@ export const jsenvPluginAsJsClassicHtml = ({
68
68
  }
69
69
  return null
70
70
  },
71
- js_url_specifier: (reference) => {
71
+ js_url: (reference) => {
72
72
  if (
73
73
  shouldTransformScriptTypeModule &&
74
74
  reference.expectedType === "js_module"
@@ -166,7 +166,7 @@ export const jsenvPluginAsJsClassicHtml = ({
166
166
  break
167
167
  }
168
168
  } catch (e) {
169
- if (context.scenarios.dev) {
169
+ if (context.dev) {
170
170
  needsSystemJs = true
171
171
  // ignore cooking error, the browser will trigger it again on fetch
172
172
  // + disable cache for this html file because when browser will reload
@@ -57,15 +57,15 @@ export const jsenvPluginAsJsClassicLibrary = ({
57
57
  },
58
58
  })
59
59
  const jsModuleBundledUrlInfo = bundleUrlInfos[jsModuleUrlInfo.url]
60
- if (context.scenarios.dev) {
60
+ if (context.dev) {
61
61
  jsModuleBundledUrlInfo.sourceUrls.forEach((sourceUrl) => {
62
62
  context.referenceUtils.inject({
63
- type: "js_url_specifier",
63
+ type: "js_url",
64
64
  specifier: sourceUrl,
65
65
  isImplicit: true,
66
66
  })
67
67
  })
68
- } else if (context.scenarios.build) {
68
+ } else if (context.build) {
69
69
  jsModuleBundledUrlInfo.sourceUrls.forEach((sourceUrl) => {
70
70
  const sourceUrlInfo = context.urlGraph.getUrlInfo(sourceUrl)
71
71
  if (sourceUrlInfo && sourceUrlInfo.dependents.size === 0) {
@@ -29,7 +29,7 @@ export const jsenvPluginAsJsClassicWorkers = () => {
29
29
  name: "jsenv:as_js_classic_workers",
30
30
  appliesDuring: "*",
31
31
  redirectUrl: {
32
- js_url_specifier: (reference, context) => {
32
+ js_url: (reference, context) => {
33
33
  if (reference.expectedType !== "js_module") {
34
34
  return null
35
35
  }
@@ -0,0 +1,45 @@
1
+ import { applyBabelPlugins } from "@jsenv/ast"
2
+ import { composeTwoSourcemaps } from "@jsenv/sourcemap"
3
+
4
+ import { isWebWorkerUrlInfo } from "@jsenv/core/src/kitchen/web_workers.js"
5
+
6
+ export const convertJsClassicToJsModule = async ({
7
+ urlInfo,
8
+ jsClassicUrlInfo,
9
+ }) => {
10
+ const { code, map } = await applyBabelPlugins({
11
+ babelPlugins: [
12
+ [
13
+ babelPluginReplaceTopLevelThis,
14
+ {
15
+ isWebWorker: isWebWorkerUrlInfo(urlInfo),
16
+ },
17
+ ],
18
+ ],
19
+ urlInfo: jsClassicUrlInfo,
20
+ })
21
+ const sourcemap = await composeTwoSourcemaps(jsClassicUrlInfo.sourcemap, map)
22
+ return {
23
+ content: code,
24
+ sourcemap,
25
+ }
26
+ }
27
+
28
+ const babelPluginReplaceTopLevelThis = () => {
29
+ return {
30
+ name: "replace-top-level-this",
31
+ visitor: {
32
+ Program: (programPath, state) => {
33
+ const { isWebWorker } = state.opts
34
+ programPath.traverse({
35
+ ThisExpression: (path) => {
36
+ const closestFunction = path.getFunctionParent()
37
+ if (!closestFunction) {
38
+ path.replaceWithSourceString(isWebWorker ? "self" : "window")
39
+ }
40
+ },
41
+ })
42
+ },
43
+ },
44
+ }
45
+ }
@@ -0,0 +1,78 @@
1
+ /*
2
+ * Js modules might not be able to import js meant to be loaded by <script>
3
+ * Among other things this happens for a top level this:
4
+ * - With <script> this is window
5
+ * - With an import this is undefined
6
+ * Example of this: https://github.com/video-dev/hls.js/issues/2911
7
+ *
8
+ * This plugin fix this issue by rewriting top level this into window
9
+ * and can be used like this for instance import("hls?as_js_module")
10
+ */
11
+
12
+ import { urlToFilename } from "@jsenv/urls"
13
+
14
+ import { convertJsClassicToJsModule } from "./convert_js_classic_to_js_module.js"
15
+
16
+ export const jsenvPluginAsJsModule = () => {
17
+ return {
18
+ name: "jsenv:as_js_module",
19
+ appliesDuring: "*",
20
+ redirectUrl: (reference) => {
21
+ if (reference.searchParams.has("as_js_module")) {
22
+ reference.expectedType = "js_module"
23
+ const filename = urlToFilename(reference.url)
24
+ const [basename] = splitFileExtension(filename)
25
+ reference.filename = `${basename}.mjs`
26
+ }
27
+ },
28
+ fetchUrlContent: async (urlInfo, context) => {
29
+ const [jsClassicReference, jsClassicUrlInfo] =
30
+ context.getWithoutSearchParam({
31
+ urlInfo,
32
+ context,
33
+ searchParam: "as_js_module",
34
+ // override the expectedType to "js_classic"
35
+ // because when there is ?as_js_module it means the underlying resource
36
+ // is js_classic
37
+ expectedType: "js_classic",
38
+ })
39
+ if (!jsClassicReference) {
40
+ return null
41
+ }
42
+ await context.fetchUrlContent(jsClassicUrlInfo, {
43
+ reference: jsClassicReference,
44
+ })
45
+ if (context.dev) {
46
+ context.referenceUtils.found({
47
+ type: "js_import",
48
+ subtype: jsClassicReference.subtype,
49
+ specifier: jsClassicReference.url,
50
+ expectedType: "js_classic",
51
+ })
52
+ } else if (context.build && jsClassicUrlInfo.dependents.size === 0) {
53
+ context.urlGraph.deleteUrlInfo(jsClassicUrlInfo.url)
54
+ }
55
+ const { content, sourcemap } = await convertJsClassicToJsModule({
56
+ urlInfo,
57
+ jsClassicUrlInfo,
58
+ })
59
+ return {
60
+ content,
61
+ contentType: "text/javascript",
62
+ type: "js_module",
63
+ originalUrl: jsClassicUrlInfo.originalUrl,
64
+ originalContent: jsClassicUrlInfo.originalContent,
65
+ sourcemap,
66
+ data: jsClassicUrlInfo.data,
67
+ }
68
+ },
69
+ }
70
+ }
71
+
72
+ const splitFileExtension = (filename) => {
73
+ const dotLastIndex = filename.lastIndexOf(".")
74
+ if (dotLastIndex === -1) {
75
+ return [filename, ""]
76
+ }
77
+ return [filename.slice(0, dotLastIndex), filename.slice(dotLastIndex)]
78
+ }
@@ -20,7 +20,7 @@ export const jsenvPluginBabel = ({
20
20
  RUNTIME_COMPAT.isSupported(context.clientRuntimeCompat, feature)
21
21
  const getImportSpecifier = (clientFileUrl) => {
22
22
  const [reference] = context.referenceUtils.inject({
23
- type: "js_import_export",
23
+ type: "js_import",
24
24
  expectedType: "js_module",
25
25
  specifier: clientFileUrl,
26
26
  })
@@ -33,7 +33,7 @@ export const jsenvPluginBabel = ({
33
33
  isJsModule,
34
34
  getImportSpecifier,
35
35
  })
36
- if (context.scenarios.dev) {
36
+ if (context.dev) {
37
37
  const requestHeaders = context.request.headers
38
38
  if (requestHeaders["x-coverage-instanbul"]) {
39
39
  const coverageConfig = JSON.parse(
@@ -57,14 +57,14 @@ export const jsenvPluginImportAssertions = ({
57
57
  // We would have to tell rollup to ignore import with assertion
58
58
  // - means rollup can bundle more js file together
59
59
  // - means url versioning can work for css inlined in js
60
- if (context.scenarios.build) {
60
+ if (context.build) {
61
61
  transpilations.json = true
62
62
  transpilations.css = true
63
63
  transpilations.text = true
64
64
  }
65
65
  },
66
66
  redirectUrl: {
67
- js_import_export: (reference, context) => {
67
+ js_import: (reference, context) => {
68
68
  if (!reference.assert) {
69
69
  return null
70
70
  }
@@ -110,14 +110,14 @@ const jsenvPluginAsModules = () => {
110
110
  await context.fetchUrlContent(jsonUrlInfo, {
111
111
  reference: jsonReference,
112
112
  })
113
- if (context.scenarios.dev) {
113
+ if (context.dev) {
114
114
  context.referenceUtils.found({
115
- type: "js_import_export",
115
+ type: "js_import",
116
116
  subtype: jsonReference.subtype,
117
117
  specifier: jsonReference.url,
118
118
  expectedType: "js_module",
119
119
  })
120
- } else if (context.scenarios.build && jsonUrlInfo.dependents.size === 0) {
120
+ } else if (context.build && jsonUrlInfo.dependents.size === 0) {
121
121
  context.urlGraph.deleteUrlInfo(jsonUrlInfo.url)
122
122
  }
123
123
  const jsonText = JSON.stringify(jsonUrlInfo.content.trim())
@@ -151,14 +151,14 @@ const jsenvPluginAsModules = () => {
151
151
  await context.fetchUrlContent(cssUrlInfo, {
152
152
  reference: cssReference,
153
153
  })
154
- if (context.scenarios.dev) {
154
+ if (context.dev) {
155
155
  context.referenceUtils.found({
156
- type: "js_import_export",
156
+ type: "js_import",
157
157
  subtype: cssReference.subtype,
158
158
  specifier: cssReference.url,
159
159
  expectedType: "js_module",
160
160
  })
161
- } else if (context.scenarios.build && cssUrlInfo.dependents.size === 0) {
161
+ } else if (context.build && cssUrlInfo.dependents.size === 0) {
162
162
  context.urlGraph.deleteUrlInfo(cssUrlInfo.url)
163
163
  }
164
164
  const cssText = JS_QUOTES.escapeSpecialChars(cssUrlInfo.content, {
@@ -201,14 +201,14 @@ const jsenvPluginAsModules = () => {
201
201
  await context.fetchUrlContent(textUrlInfo, {
202
202
  reference: textReference,
203
203
  })
204
- if (context.scenarios.dev) {
204
+ if (context.dev) {
205
205
  context.referenceUtils.found({
206
- type: "js_import_export",
206
+ type: "js_import",
207
207
  subtype: textReference.subtype,
208
208
  specifier: textReference.url,
209
209
  expectedType: "js_module",
210
210
  })
211
- } else if (context.scenarios.build && textUrlInfo.dependents.size === 0) {
211
+ } else if (context.build && textUrlInfo.dependents.size === 0) {
212
212
  context.urlGraph.deleteUrlInfo(textUrlInfo.url)
213
213
  }
214
214
  const textPlain = JS_QUOTES.escapeSpecialChars(urlInfo.content, {
@@ -0,0 +1,52 @@
1
+ import { createMagicSource } from "@jsenv/sourcemap"
2
+
3
+ export const jsenvPluginImportMetaResolve = () => {
4
+ return {
5
+ name: "jsenv:import_meta_resolve",
6
+ appliesDuring: "*",
7
+ init: (context) => {
8
+ if (context.isSupportedOnCurrentClients("import_meta_resolve")) {
9
+ return false
10
+ }
11
+ const willTransformJsModules =
12
+ !context.isSupportedOnCurrentClients("script_type_module") ||
13
+ !context.isSupportedOnCurrentClients("import_dynamic") ||
14
+ !context.isSupportedOnCurrentClients("import_meta")
15
+ // keep it untouched, systemjs will handle it
16
+ if (willTransformJsModules) {
17
+ return false
18
+ }
19
+ return true
20
+ },
21
+ transformUrlContent: {
22
+ js_module: async (urlInfo, context) => {
23
+ const magicSource = createMagicSource(urlInfo.content)
24
+ context.referenceUtils._references.forEach((ref) => {
25
+ if (ref.subtype === "import_meta_resolve") {
26
+ const originalSpecifierLength = Buffer.byteLength(ref.specifier)
27
+ const specifierLength = Buffer.byteLength(
28
+ ref.generatedSpecifier.slice(1, -1), // remove `"` around
29
+ )
30
+ const specifierLengthDiff =
31
+ specifierLength - originalSpecifierLength
32
+ const end = ref.node.end + specifierLengthDiff
33
+ magicSource.replace({
34
+ start: ref.node.start,
35
+ end,
36
+ replacement: `new URL(${ref.generatedSpecifier}, import.meta.url).href`,
37
+ })
38
+ const currentLengthBeforeSpecifier = "import.meta.resolve(".length
39
+ const newLengthBeforeSpecifier = "new URL(".length
40
+ const lengthDiff =
41
+ currentLengthBeforeSpecifier - newLengthBeforeSpecifier
42
+ ref.specifierColumn -= lengthDiff
43
+ ref.specifierStart -= lengthDiff
44
+ ref.specifierEnd =
45
+ ref.specifierStart + Buffer.byteLength(ref.generatedSpecifier)
46
+ }
47
+ })
48
+ return magicSource.toContentAndSourcemap()
49
+ },
50
+ },
51
+ }
52
+ }
@@ -6,19 +6,22 @@ export const jsenvPluginTopLevelAwait = () => {
6
6
  return {
7
7
  name: "jsenv:top_level_await",
8
8
  appliesDuring: "*",
9
+ init: (context) => {
10
+ if (context.isSupportedOnCurrentClients("top_level_await")) {
11
+ return false
12
+ }
13
+ // keep it untouched, systemjs will handle it
14
+ const willTransformJsModules =
15
+ !context.isSupportedOnCurrentClients("script_type_module") ||
16
+ !context.isSupportedOnCurrentClients("import_dynamic") ||
17
+ !context.isSupportedOnCurrentClients("import_meta")
18
+ if (willTransformJsModules) {
19
+ return false
20
+ }
21
+ return true
22
+ },
9
23
  transformUrlContent: {
10
- js_module: async (urlInfo, context) => {
11
- if (context.isSupportedOnCurrentClients("top_level_await")) {
12
- return null
13
- }
14
- const willTransformJsModules =
15
- !context.isSupportedOnCurrentClients("script_type_module") ||
16
- !context.isSupportedOnCurrentClients("import_dynamic") ||
17
- !context.isSupportedOnCurrentClients("import_meta")
18
- // keep it untouched, systemjs will handle it
19
- if (willTransformJsModules) {
20
- return null
21
- }
24
+ js_module: async (urlInfo) => {
22
25
  const usesTLA = await usesTopLevelAwait(urlInfo)
23
26
  if (!usesTLA) {
24
27
  return null
@@ -36,7 +39,7 @@ export const jsenvPluginTopLevelAwait = () => {
36
39
  // externalHelpers: true,
37
40
  // externalHelpersPath: JSON.parse(
38
41
  // context.referenceUtils.inject({
39
- // type: "js_import_export",
42
+ // type: "js_import",
40
43
  // expectedType: "js_module",
41
44
  // specifier:
42
45
  // "babel-plugin-transform-async-to-promises/helpers.mjs",
@@ -10,8 +10,10 @@
10
10
  import { jsenvPluginCssParcel } from "./css_parcel/jsenv_plugin_css_parcel.js"
11
11
  import { jsenvPluginImportAssertions } from "./import_assertions/jsenv_plugin_import_assertions.js"
12
12
  import { jsenvPluginAsJsClassic } from "./as_js_classic/jsenv_plugin_as_js_classic.js"
13
+ import { jsenvPluginAsJsModule } from "./as_js_module/jsenv_plugin_as_js_module.js"
13
14
  import { jsenvPluginBabel } from "./babel/jsenv_plugin_babel.js"
14
15
  import { jsenvPluginTopLevelAwait } from "./jsenv_plugin_top_level_await.js"
16
+ import { jsenvPluginImportMetaResolve } from "./jsenv_plugin_import_meta_resolve.js"
15
17
 
16
18
  export const jsenvPluginTranspilation = ({
17
19
  importAssertions = true,
@@ -23,6 +25,7 @@ export const jsenvPluginTranspilation = ({
23
25
  jsClassicFallback = true,
24
26
  systemJsInjection = true,
25
27
  topLevelAwait = true,
28
+ importMetaResolve = true,
26
29
  babelHelpersAsImport = true,
27
30
  getCustomBabelPlugins,
28
31
  }) => {
@@ -30,6 +33,7 @@ export const jsenvPluginTranspilation = ({
30
33
  importAssertions = {}
31
34
  }
32
35
  return [
36
+ ...(importMetaResolve ? [jsenvPluginImportMetaResolve()] : []),
33
37
  ...(importAssertions
34
38
  ? [jsenvPluginImportAssertions(importAssertions)]
35
39
  : []),
@@ -44,6 +48,7 @@ export const jsenvPluginTranspilation = ({
44
48
  jsClassicFallback,
45
49
  systemJsInjection,
46
50
  }),
51
+ jsenvPluginAsJsModule(),
47
52
  // topLevelAwait must come after jsenvPluginAsJsClassic because it's related to the module format
48
53
  // so we want to wait to know the module format before transforming things related to top level await
49
54
  ...(topLevelAwait ? [jsenvPluginTopLevelAwait(topLevelAwait)] : []),
@@ -14,7 +14,7 @@ export const parseAndTransformHtmlUrls = async (urlInfo, context) => {
14
14
  const url = urlInfo.originalUrl
15
15
  const content = urlInfo.content
16
16
  const htmlAst = parseHtmlString(content, {
17
- storeOriginalPositions: context.scenarios.dev,
17
+ storeOriginalPositions: context.dev,
18
18
  })
19
19
  const mentions = visitHtmlUrls({
20
20
  url,
@@ -20,6 +20,7 @@ export const parseAndTransformJsUrls = async (urlInfo, context) => {
20
20
  urlInfo.data.usesImport = true
21
21
  }
22
22
  const [reference] = context.referenceUtils.found({
23
+ node: jsMention.node,
23
24
  type: jsMention.type,
24
25
  subtype: jsMention.subtype,
25
26
  expectedType: jsMention.expectedType,
@@ -16,11 +16,13 @@ export const jsenvPluginReferenceExpectedTypes = () => {
16
16
  searchParams.has("as_js_classic_library")
17
17
  ) {
18
18
  reference.expectedType = "js_classic"
19
+ } else if (searchParams.has("as_js_module")) {
20
+ reference.expectedType = "js_module"
19
21
  } else if (searchParams.has("js_module")) {
20
22
  searchParams.delete("js_module")
21
23
  reference.expectedType = "js_module"
22
24
  } else if (
23
- reference.type === "js_url_specifier" &&
25
+ reference.type === "js_url" &&
24
26
  reference.expectedType === undefined &&
25
27
  CONTENT_TYPE.fromUrlExtension(reference.url) === "text/javascript"
26
28
  ) {
@@ -49,7 +51,7 @@ export const jsenvPluginReferenceExpectedTypes = () => {
49
51
  appliesDuring: "*",
50
52
  redirectUrl: {
51
53
  script_src: redirectJsUrls,
52
- js_url_specifier: redirectJsUrls,
54
+ js_url: redirectJsUrls,
53
55
  },
54
56
  }
55
57
  }
@@ -39,7 +39,7 @@ export const jsenvPluginUrlAnalysis = ({
39
39
  // so that urls must be kept intact
40
40
  // However for js import specifiers they have a different meaning and we want
41
41
  // to resolve them (https://nodejs.org/api/packages.html#imports for instance)
42
- reference.type !== "js_import_export"
42
+ reference.type !== "js_import"
43
43
  ) {
44
44
  reference.shouldHandle = false
45
45
  return
@@ -7,7 +7,6 @@
7
7
  * and the rest uses the web standard url resolution (new URL):
8
8
  * - "http_request"
9
9
  * - "entry_point"
10
- * - "js_import_export"
11
10
  * - "link_href"
12
11
  * - "script_src"
13
12
  * - "a_href"
@@ -20,9 +19,10 @@
20
19
  * - "use_href"
21
20
  * - "css_@import"
22
21
  * - "css_url"
23
- * - "sourcemap_comment"
24
- * - "js_url_specifier"
22
+ * - "js_import"
23
+ * - "js_url"
25
24
  * - "js_inline_content"
25
+ * - "sourcemap_comment"
26
26
  * - "webmanifest_icon_src"
27
27
  * - "package_json"
28
28
  */
@@ -38,7 +38,7 @@ export const createNodeEsmResolver = ({ runtimeCompat, packageConditions }) => {
38
38
  parentUrl,
39
39
  specifier: reference.specifier,
40
40
  })
41
- if (context.scenarios.dev) {
41
+ if (context.dev) {
42
42
  const dependsOnPackageJson =
43
43
  type !== "relative_specifier" &&
44
44
  type !== "absolute_specifier" &&
@@ -57,7 +57,7 @@ export const createNodeEsmResolver = ({ runtimeCompat, packageConditions }) => {
57
57
  })
58
58
  }
59
59
  }
60
- if (context.scenarios.dev) {
60
+ if (context.dev) {
61
61
  // without this check a file inside a project without package.json
62
62
  // could be considered as a node module if there is a ancestor package.json
63
63
  // but we want to version only node modules