@jcoreio/toolchain-esnext 5.5.4 → 5.5.6
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": "@jcoreio/toolchain-esnext",
|
|
3
|
-
"version": "5.5.
|
|
3
|
+
"version": "5.5.6",
|
|
4
4
|
"description": "ESNext JS build toolchain",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"globals": "^16.0.0",
|
|
33
33
|
"resolve": "^1.22.2",
|
|
34
34
|
"resolve-bin": "^1.0.0",
|
|
35
|
-
"@jcoreio/toolchain": "5.5.
|
|
35
|
+
"@jcoreio/toolchain": "5.5.6"
|
|
36
36
|
},
|
|
37
37
|
"toolchainManaged": {
|
|
38
38
|
"dependencies": {
|
package/plugins/babelPresets.cjs
CHANGED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import path from 'path'
|
|
2
|
+
import { fileURLToPath } from 'url'
|
|
3
|
+
import { resolve, load as wrappedLoad } from 'babel-register-esm'
|
|
4
|
+
|
|
5
|
+
export { resolve }
|
|
6
|
+
|
|
7
|
+
export async function load(url, context, nextLoad) {
|
|
8
|
+
// some versions of node support --experimental-default-type, but it was removed in Node 23.
|
|
9
|
+
// Since we allow the project to omit `type` in `package.json` and transpile the same source
|
|
10
|
+
// code to CJS and ESM, we need to set the module type based upon the mode the toolchain is
|
|
11
|
+
// running in here for Node >=23.
|
|
12
|
+
if (context.format == null) {
|
|
13
|
+
const extension = path.extname(fileURLToPath(url))
|
|
14
|
+
if (
|
|
15
|
+
extension === '.js' ||
|
|
16
|
+
extension === '.jsx' ||
|
|
17
|
+
extension === '.ts' ||
|
|
18
|
+
extension === '.tsx'
|
|
19
|
+
) {
|
|
20
|
+
return await wrappedLoad(
|
|
21
|
+
url,
|
|
22
|
+
{
|
|
23
|
+
...context,
|
|
24
|
+
format: process.env.JCOREIO_TOOLCHAIN_ESM ? 'module' : 'commonjs',
|
|
25
|
+
},
|
|
26
|
+
nextLoad
|
|
27
|
+
)
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
return await wrappedLoad(url, context, nextLoad)
|
|
31
|
+
}
|
package/util/esmLoader.cjs
CHANGED