@jsenv/core 27.0.0-alpha.23 → 27.0.0-alpha.24

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/core",
3
- "version": "27.0.0-alpha.23",
3
+ "version": "27.0.0-alpha.24",
4
4
  "description": "Tool to develop, test and build js projects",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -23,7 +23,6 @@ import { composeTwoSourcemaps } from "@jsenv/utils/sourcemap/sourcemap_compositi
23
23
  import { babelPluginTransformImportMetaUrl } from "./helpers/babel_plugin_transform_import_meta_url.js"
24
24
  import { jsenvPluginScriptTypeModuleAsClassic } from "./jsenv_plugin_script_type_module_as_classic.js"
25
25
  import { jsenvPluginWorkersTypeModuleAsClassic } from "./jsenv_plugin_workers_type_module_as_classic.js"
26
- import { jsenvPluginTopLevelAwait } from "./jsenv_plugin_top_level_await.js"
27
26
 
28
27
  const require = createRequire(import.meta.url)
29
28
 
@@ -40,7 +39,6 @@ export const jsenvPluginAsJsClassic = ({ systemJsInjection }) => {
40
39
  jsenvPluginWorkersTypeModuleAsClassic({
41
40
  generateJsClassicFilename,
42
41
  }),
43
- jsenvPluginTopLevelAwait(),
44
42
  ]
45
43
  }
46
44
 
@@ -31,9 +31,12 @@ export const getBaseBabelPluginStructure = ({ url, isSupported }) => {
31
31
  requireBabelPlugin("@babel/plugin-proposal-unicode-property-regex")
32
32
  }
33
33
  if (isBabelPluginNeeded("transform-async-to-promises")) {
34
- babelPluginStructure["transform-async-to-promises"] = requireBabelPlugin(
35
- "babel-plugin-transform-async-to-promises",
36
- )
34
+ babelPluginStructure["transform-async-to-promises"] = [
35
+ requireBabelPlugin("babel-plugin-transform-async-to-promises"),
36
+ {
37
+ topLevelAwait: "ignore", // will be handled by "jsenv:top_level_await" plugin
38
+ },
39
+ ]
37
40
  }
38
41
  if (isBabelPluginNeeded("transform-arrow-functions")) {
39
42
  babelPluginStructure["transform-arrow-functions"] = requireBabelPlugin(
@@ -11,6 +11,7 @@ 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
13
  import { jsenvPluginBabel } from "./babel/jsenv_plugin_babel.js"
14
+ import { jsenvPluginTopLevelAwait } from "./jsenv_plugin_top_level_await.js"
14
15
 
15
16
  export const jsenvPluginTranspilation = ({
16
17
  importAssertions = true,
@@ -35,6 +36,9 @@ export const jsenvPluginTranspilation = ({
35
36
  ...(jsModuleAsJsClassic
36
37
  ? [jsenvPluginAsJsClassic({ systemJsInjection })]
37
38
  : []),
39
+ // topLevelAwait must come after js_module_as_js_classic because it's related to the module format
40
+ // so we want to wait to know the module format before transforming things related to top level await
41
+ ...(topLevelAwait ? [jsenvPluginTopLevelAwait(topLevelAwait)] : []),
38
42
  ...(css ? [jsenvPluginCssParcel()] : []),
39
43
  ]
40
44
  }