@jsenv/core 27.0.0-alpha.2 → 27.0.0-alpha.5
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 +5 -4
- package/src/omega/core_plugins/babel/{babel_helper → helpers}/babel_plugin_babel_helpers_as_jsenv_imports.js +1 -2
- package/src/omega/core_plugins/babel/helpers/babel_plugin_structure.js +68 -76
- package/src/omega/core_plugins/babel/jsenv_plugin_babel.js +1 -1
- package/src/omega/core_plugins/import_meta_scenarios/jsenv_plugin_import_meta_scenarios.js +15 -5
- package/src/omega/core_plugins/babel/babel_helper/babel_helper_directory.js +0 -29
- package/src/omega/core_plugins/babel/babel_helper/client/.eslintrc.cjs +0 -24
- package/src/omega/core_plugins/babel/babel_helper/client/AsyncGenerator/AsyncGenerator.js +0 -81
- package/src/omega/core_plugins/babel/babel_helper/client/AwaitValue/AwaitValue.js +0 -3
- package/src/omega/core_plugins/babel/babel_helper/client/applyDecoratorDescriptor/applyDecoratorDescriptor.js +0 -33
- package/src/omega/core_plugins/babel/babel_helper/client/arrayLikeToArray/arrayLikeToArray.js +0 -7
- package/src/omega/core_plugins/babel/babel_helper/client/arrayWithHoles/arrayWithHoles.js +0 -4
- package/src/omega/core_plugins/babel/babel_helper/client/arrayWithoutHoles/arrayWithoutHoles.js +0 -6
- package/src/omega/core_plugins/babel/babel_helper/client/assertThisInitialized/assertThisInitialized.js +0 -7
- package/src/omega/core_plugins/babel/babel_helper/client/asyncGeneratorDelegate/asyncGeneratorDelegate.js +0 -40
- package/src/omega/core_plugins/babel/babel_helper/client/asyncIterator/asyncIterator.js +0 -65
- package/src/omega/core_plugins/babel/babel_helper/client/asyncToGenerator/asyncToGenerator.js +0 -34
- package/src/omega/core_plugins/babel/babel_helper/client/awaitAsyncGenerator/awaitAsyncGenerator.js +0 -5
- package/src/omega/core_plugins/babel/babel_helper/client/classApplyDescriptorDestructureSet/classApplyDescriptorDestructureSet.js +0 -20
- package/src/omega/core_plugins/babel/babel_helper/client/classApplyDescriptorGet/classApplyDescriptorGet.js +0 -6
- package/src/omega/core_plugins/babel/babel_helper/client/classApplyDescriptorSet/classApplyDescriptorSet.js +0 -13
- package/src/omega/core_plugins/babel/babel_helper/client/classCallCheck/classCallCheck.js +0 -5
- package/src/omega/core_plugins/babel/babel_helper/client/classCheckPrivateStaticAccess/classCheckPrivateStaticAccess.js +0 -5
- package/src/omega/core_plugins/babel/babel_helper/client/classCheckPrivateStaticFieldDescriptor/classCheckPrivateStaticFieldDescriptor.js +0 -6
- package/src/omega/core_plugins/babel/babel_helper/client/classExtractFieldDescriptor/classExtractFieldDescriptor.js +0 -7
- package/src/omega/core_plugins/babel/babel_helper/client/classNameTDZError/classNameTDZError.js +0 -4
- package/src/omega/core_plugins/babel/babel_helper/client/classPrivateFieldDestructureSet/classPrivateFieldDestructureSet.js +0 -7
- package/src/omega/core_plugins/babel/babel_helper/client/classPrivateFieldGet/classPrivateFieldGet.js +0 -7
- package/src/omega/core_plugins/babel/babel_helper/client/classPrivateFieldLooseBase/classPrivateFieldLooseBase.js +0 -6
- package/src/omega/core_plugins/babel/babel_helper/client/classPrivateFieldLooseKey/classPrivateFieldLooseKey.js +0 -5
- package/src/omega/core_plugins/babel/babel_helper/client/classPrivateFieldSet/classPrivateFieldSet.js +0 -8
- package/src/omega/core_plugins/babel/babel_helper/client/classPrivateMethodGet/classPrivateMethodGet.js +0 -6
- package/src/omega/core_plugins/babel/babel_helper/client/classPrivateMethodSet/classPrivateMethodSet.js +0 -3
- package/src/omega/core_plugins/babel/babel_helper/client/classStaticPrivateFieldSpecGet/classStaticPrivateFieldSpecGet.js +0 -9
- package/src/omega/core_plugins/babel/babel_helper/client/classStaticPrivateFieldSpecSet/classStaticPrivateFieldSpecSet.js +0 -15
- package/src/omega/core_plugins/babel/babel_helper/client/classStaticPrivateMethodGet/classStaticPrivateMethodGet.js +0 -6
- package/src/omega/core_plugins/babel/babel_helper/client/classStaticPrivateMethodSet/classStaticPrivateMethodSet.js +0 -3
- package/src/omega/core_plugins/babel/babel_helper/client/construct/construct.js +0 -16
- package/src/omega/core_plugins/babel/babel_helper/client/createClass/createClass.js +0 -15
- package/src/omega/core_plugins/babel/babel_helper/client/createForOfIteratorHelper/createForOfIteratorHelper.js +0 -60
- package/src/omega/core_plugins/babel/babel_helper/client/createForOfIteratorHelperLoose/createForOfIteratorHelperLoose.js +0 -23
- package/src/omega/core_plugins/babel/babel_helper/client/createRawReactElement/createRawReactElement.js +0 -50
- package/src/omega/core_plugins/babel/babel_helper/client/createSuper/createSuper.js +0 -22
- package/src/omega/core_plugins/babel/babel_helper/client/decorate/decorate.js +0 -403
- package/src/omega/core_plugins/babel/babel_helper/client/defaults/defaults.js +0 -11
- package/src/omega/core_plugins/babel/babel_helper/client/defineEnumerableProperties/defineEnumerableProperties.js +0 -23
- package/src/omega/core_plugins/babel/babel_helper/client/defineProperty/defineProperty.js +0 -18
- package/src/omega/core_plugins/babel/babel_helper/client/extends/extends.js +0 -14
- package/src/omega/core_plugins/babel/babel_helper/client/get/get.js +0 -19
- package/src/omega/core_plugins/babel/babel_helper/client/getPrototypeOf/getPrototypeOf.js +0 -4
- package/src/omega/core_plugins/babel/babel_helper/client/inherits/inherits.js +0 -19
- package/src/omega/core_plugins/babel/babel_helper/client/inheritsLoose/inheritsLoose.js +0 -7
- package/src/omega/core_plugins/babel/babel_helper/client/initializerDefineProperty/initializerDefineProperty.js +0 -10
- package/src/omega/core_plugins/babel/babel_helper/client/initializerWarningHelper/initializerWarningHelper.js +0 -6
- package/src/omega/core_plugins/babel/babel_helper/client/instanceof/instanceof.js +0 -6
- package/src/omega/core_plugins/babel/babel_helper/client/interopRequireDefault/interopRequireDefault.js +0 -3
- package/src/omega/core_plugins/babel/babel_helper/client/interopRequireWildcard/interopRequireWildcard.js +0 -37
- package/src/omega/core_plugins/babel/babel_helper/client/isNativeFunction/isNativeFunction.js +0 -4
- package/src/omega/core_plugins/babel/babel_helper/client/isNativeReflectConstruct/isNativeReflectConstruct.js +0 -21
- package/src/omega/core_plugins/babel/babel_helper/client/iterableToArray/iterableToArray.js +0 -7
- package/src/omega/core_plugins/babel/babel_helper/client/iterableToArrayLimit/iterableToArrayLimit.js +0 -36
- package/src/omega/core_plugins/babel/babel_helper/client/iterableToArrayLimitLoose/iterableToArrayLimitLoose.js +0 -10
- package/src/omega/core_plugins/babel/babel_helper/client/jsx/jsx.js +0 -50
- package/src/omega/core_plugins/babel/babel_helper/client/maybeArrayLike/maybeArrayLike.js +0 -10
- package/src/omega/core_plugins/babel/babel_helper/client/newArrowCheck/newArrowCheck.js +0 -5
- package/src/omega/core_plugins/babel/babel_helper/client/nonIterableRest/nonIterableRest.js +0 -5
- package/src/omega/core_plugins/babel/babel_helper/client/nonIterableSpread/nonIterableSpread.js +0 -5
- package/src/omega/core_plugins/babel/babel_helper/client/objectDestructuringEmpty/objectDestructuringEmpty.js +0 -3
- package/src/omega/core_plugins/babel/babel_helper/client/objectSpread/objectSpread.js +0 -23
- package/src/omega/core_plugins/babel/babel_helper/client/objectSpread2/objectSpread2.js +0 -41
- package/src/omega/core_plugins/babel/babel_helper/client/objectWithoutProperties/objectWithoutProperties.js +0 -19
- package/src/omega/core_plugins/babel/babel_helper/client/objectWithoutPropertiesLoose/objectWithoutPropertiesLoose.js +0 -13
- package/src/omega/core_plugins/babel/babel_helper/client/possibleConstructorReturn/possibleConstructorReturn.js +0 -10
- package/src/omega/core_plugins/babel/babel_helper/client/readOnlyError/readOnlyError.js +0 -4
- package/src/omega/core_plugins/babel/babel_helper/client/readme.md +0 -8
- package/src/omega/core_plugins/babel/babel_helper/client/set/set.js +0 -44
- package/src/omega/core_plugins/babel/babel_helper/client/setPrototypeOf/setPrototypeOf.js +0 -6
- package/src/omega/core_plugins/babel/babel_helper/client/skipFirstGeneratorNext/skipFirstGeneratorNext.js +0 -8
- package/src/omega/core_plugins/babel/babel_helper/client/slicedToArray/slicedToArray.js +0 -10
- package/src/omega/core_plugins/babel/babel_helper/client/slicedToArrayLoose/slicedToArrayLoose.js +0 -13
- package/src/omega/core_plugins/babel/babel_helper/client/superPropBase/superPropBase.js +0 -10
- package/src/omega/core_plugins/babel/babel_helper/client/taggedTemplateLiteral/taggedTemplateLiteral.js +0 -10
- package/src/omega/core_plugins/babel/babel_helper/client/taggedTemplateLiteralLoose/taggedTemplateLiteralLoose.js +0 -7
- package/src/omega/core_plugins/babel/babel_helper/client/tdz/tdz.js +0 -4
- package/src/omega/core_plugins/babel/babel_helper/client/temporalRef/temporalRef.js +0 -6
- package/src/omega/core_plugins/babel/babel_helper/client/temporalUndefined/temporalUndefined.js +0 -3
- package/src/omega/core_plugins/babel/babel_helper/client/toArray/toArray.js +0 -10
- package/src/omega/core_plugins/babel/babel_helper/client/toConsumableArray/toConsumableArray.js +0 -10
- package/src/omega/core_plugins/babel/babel_helper/client/toPrimitive/toPrimitive.js +0 -10
- package/src/omega/core_plugins/babel/babel_helper/client/toPropertyKey/toPropertyKey.js +0 -6
- package/src/omega/core_plugins/babel/babel_helper/client/typeof/typeof.js +0 -14
- package/src/omega/core_plugins/babel/babel_helper/client/unsupportedIterableToArray/unsupportedIterableToArray.js +0 -12
- package/src/omega/core_plugins/babel/babel_helper/client/wrapAsyncGenerator/wrapAsyncGenerator.js +0 -8
- package/src/omega/core_plugins/babel/babel_helper/client/wrapNativeSuper/wrapNativeSuper.js +0 -30
- package/src/omega/core_plugins/babel/babel_helper/client/wrapRegExp/wrapRegExp.js +0 -63
- package/src/omega/core_plugins/babel/babel_helper/client/writeOnlyError/writeOnlyError.js +0 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jsenv/core",
|
|
3
|
-
"version": "27.0.0-alpha.
|
|
3
|
+
"version": "27.0.0-alpha.5",
|
|
4
4
|
"description": "Tool to develop, test and build js projects",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -11,7 +11,8 @@
|
|
|
11
11
|
"node": ">=16.13.0"
|
|
12
12
|
},
|
|
13
13
|
"publishConfig": {
|
|
14
|
-
"access": "public"
|
|
14
|
+
"access": "public",
|
|
15
|
+
"registry": "https://registry.npmjs.org"
|
|
15
16
|
},
|
|
16
17
|
"type": "module",
|
|
17
18
|
"imports": {},
|
|
@@ -53,7 +54,7 @@
|
|
|
53
54
|
"@c88/v8-coverage": "0.1.1",
|
|
54
55
|
"@financial-times/polyfill-useragent-normaliser": "2.0.1",
|
|
55
56
|
"@jsenv/abort": "4.1.2",
|
|
56
|
-
"@jsenv/babel-plugins": "1.0.
|
|
57
|
+
"@jsenv/babel-plugins": "1.0.2",
|
|
57
58
|
"@jsenv/filesystem": "3.1.0",
|
|
58
59
|
"@jsenv/importmap": "1.2.0",
|
|
59
60
|
"@jsenv/integrity": "0.0.1",
|
|
@@ -106,4 +107,4 @@
|
|
|
106
107
|
"redux": "4.1.2",
|
|
107
108
|
"rollup": "2.70.1"
|
|
108
109
|
}
|
|
109
|
-
}
|
|
110
|
+
}
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { pathToFileURL } from "node:url"
|
|
2
2
|
|
|
3
3
|
import { injectImport } from "@jsenv/utils/js_ast/babel_utils.js"
|
|
4
|
-
|
|
5
4
|
import {
|
|
6
5
|
getBabelHelperFileUrl,
|
|
7
6
|
babelHelperNameFromUrl,
|
|
8
|
-
} from "
|
|
7
|
+
} from "@jsenv/babel-plugins/main.js"
|
|
9
8
|
|
|
10
9
|
// named import approach found here:
|
|
11
10
|
// https://github.com/rollup/rollup-plugin-babel/blob/18e4232a450f320f44c651aa8c495f21c74d59ac/src/helperPlugin.js#L1
|
|
@@ -1,10 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
import { getBabelHelperFileUrl } from "../babel_helper/babel_helper_directory.js"
|
|
1
|
+
import { getBabelHelperFileUrl, requireBabelPlugin } from "@jsenv/babel-plugins"
|
|
4
2
|
import { babelPluginCompatMap } from "./babel_plugins_compatibility.js"
|
|
5
3
|
|
|
6
|
-
const require = createRequire(import.meta.url)
|
|
7
|
-
|
|
8
4
|
export const getBaseBabelPluginStructure = ({
|
|
9
5
|
url,
|
|
10
6
|
isSupportedOnRuntime,
|
|
@@ -22,29 +18,27 @@ export const getBaseBabelPluginStructure = ({
|
|
|
22
18
|
|
|
23
19
|
const babelPluginStructure = {}
|
|
24
20
|
if (isBabelPluginNeeded("proposal-numeric-separator")) {
|
|
25
|
-
babelPluginStructure[
|
|
26
|
-
"proposal-numeric-separator"
|
|
27
|
-
|
|
21
|
+
babelPluginStructure["proposal-numeric-separator"] = requireBabelPlugin(
|
|
22
|
+
"@babel/plugin-proposal-numeric-separator",
|
|
23
|
+
)
|
|
28
24
|
}
|
|
29
25
|
if (isBabelPluginNeeded("proposal-json-strings")) {
|
|
30
|
-
babelPluginStructure[
|
|
31
|
-
"proposal-json-strings"
|
|
32
|
-
|
|
26
|
+
babelPluginStructure["proposal-json-strings"] = requireBabelPlugin(
|
|
27
|
+
"@babel/plugin-proposal-json-strings",
|
|
28
|
+
)
|
|
33
29
|
}
|
|
34
30
|
if (isBabelPluginNeeded("proposal-object-rest-spread")) {
|
|
35
|
-
babelPluginStructure[
|
|
36
|
-
"proposal-object-rest-spread"
|
|
37
|
-
|
|
31
|
+
babelPluginStructure["proposal-object-rest-spread"] = requireBabelPlugin(
|
|
32
|
+
"@babel/plugin-proposal-object-rest-spread",
|
|
33
|
+
)
|
|
38
34
|
}
|
|
39
35
|
if (isBabelPluginNeeded("proposal-optional-catch-binding")) {
|
|
40
|
-
babelPluginStructure[
|
|
41
|
-
"proposal-optional-catch-binding"
|
|
42
|
-
] = require("@babel/plugin-proposal-optional-catch-binding")
|
|
36
|
+
babelPluginStructure["proposal-optional-catch-binding"] =
|
|
37
|
+
requireBabelPlugin("@babel/plugin-proposal-optional-catch-binding")
|
|
43
38
|
}
|
|
44
39
|
if (isBabelPluginNeeded("proposal-unicode-property-regex")) {
|
|
45
|
-
babelPluginStructure[
|
|
46
|
-
"proposal-unicode-property-regex"
|
|
47
|
-
] = require("@babel/plugin-proposal-unicode-property-regex")
|
|
40
|
+
babelPluginStructure["proposal-unicode-property-regex"] =
|
|
41
|
+
requireBabelPlugin("@babel/plugin-proposal-unicode-property-regex")
|
|
48
42
|
}
|
|
49
43
|
if (
|
|
50
44
|
isJsModule &&
|
|
@@ -52,94 +46,92 @@ export const getBaseBabelPluginStructure = ({
|
|
|
52
46
|
!isSupportedOnRuntime("top_level_await")
|
|
53
47
|
) {
|
|
54
48
|
babelPluginStructure["transform-async-to-promises"] = [
|
|
55
|
-
|
|
49
|
+
requireBabelPlugin("babel-plugin-transform-async-to-promises"),
|
|
56
50
|
{
|
|
57
51
|
topLevelAwait,
|
|
58
52
|
},
|
|
59
53
|
]
|
|
60
54
|
} else if (isBabelPluginNeeded("transform-async-to-promises")) {
|
|
61
|
-
babelPluginStructure[
|
|
62
|
-
"transform-async-to-promises"
|
|
63
|
-
|
|
55
|
+
babelPluginStructure["transform-async-to-promises"] = requireBabelPlugin(
|
|
56
|
+
"babel-plugin-transform-async-to-promises",
|
|
57
|
+
)
|
|
64
58
|
}
|
|
65
59
|
if (isBabelPluginNeeded("transform-arrow-functions")) {
|
|
66
|
-
babelPluginStructure[
|
|
67
|
-
"transform-arrow-functions"
|
|
68
|
-
|
|
60
|
+
babelPluginStructure["transform-arrow-functions"] = requireBabelPlugin(
|
|
61
|
+
"@babel/plugin-transform-arrow-functions",
|
|
62
|
+
)
|
|
69
63
|
}
|
|
70
64
|
if (isBabelPluginNeeded("transform-block-scoped-functions")) {
|
|
71
|
-
babelPluginStructure[
|
|
72
|
-
"transform-block-scoped-functions"
|
|
73
|
-
] = require("@babel/plugin-transform-block-scoped-functions")
|
|
65
|
+
babelPluginStructure["transform-block-scoped-functions"] =
|
|
66
|
+
requireBabelPlugin("@babel/plugin-transform-block-scoped-functions")
|
|
74
67
|
}
|
|
75
68
|
if (isBabelPluginNeeded("transform-block-scoping")) {
|
|
76
|
-
babelPluginStructure[
|
|
77
|
-
"transform-block-scoping"
|
|
78
|
-
|
|
69
|
+
babelPluginStructure["transform-block-scoping"] = requireBabelPlugin(
|
|
70
|
+
"@babel/plugin-transform-block-scoping",
|
|
71
|
+
)
|
|
79
72
|
}
|
|
80
73
|
if (isBabelPluginNeeded("transform-classes")) {
|
|
81
|
-
babelPluginStructure[
|
|
82
|
-
"transform-classes"
|
|
83
|
-
|
|
74
|
+
babelPluginStructure["transform-classes"] = requireBabelPlugin(
|
|
75
|
+
"@babel/plugin-transform-classes",
|
|
76
|
+
)
|
|
84
77
|
}
|
|
85
78
|
if (isBabelPluginNeeded("transform-computed-properties")) {
|
|
86
|
-
babelPluginStructure[
|
|
87
|
-
"transform-computed-properties"
|
|
88
|
-
|
|
79
|
+
babelPluginStructure["transform-computed-properties"] = requireBabelPlugin(
|
|
80
|
+
"@babel/plugin-transform-computed-properties",
|
|
81
|
+
)
|
|
89
82
|
}
|
|
90
83
|
if (isBabelPluginNeeded("transform-destructuring")) {
|
|
91
|
-
babelPluginStructure[
|
|
92
|
-
"transform-destructuring"
|
|
93
|
-
|
|
84
|
+
babelPluginStructure["transform-destructuring"] = requireBabelPlugin(
|
|
85
|
+
"@babel/plugin-transform-destructuring",
|
|
86
|
+
)
|
|
94
87
|
}
|
|
95
88
|
if (isBabelPluginNeeded("transform-dotall-regex")) {
|
|
96
|
-
babelPluginStructure[
|
|
97
|
-
"transform-dotall-regex"
|
|
98
|
-
|
|
89
|
+
babelPluginStructure["transform-dotall-regex"] = requireBabelPlugin(
|
|
90
|
+
"@babel/plugin-transform-dotall-regex",
|
|
91
|
+
)
|
|
99
92
|
}
|
|
100
93
|
if (isBabelPluginNeeded("transform-duplicate-keys")) {
|
|
101
|
-
babelPluginStructure[
|
|
102
|
-
"transform-duplicate-keys"
|
|
103
|
-
|
|
94
|
+
babelPluginStructure["transform-duplicate-keys"] = requireBabelPlugin(
|
|
95
|
+
"@babel/plugin-transform-duplicate-keys",
|
|
96
|
+
)
|
|
104
97
|
}
|
|
105
98
|
if (isBabelPluginNeeded("transform-exponentiation-operator")) {
|
|
106
|
-
babelPluginStructure[
|
|
107
|
-
"transform-exponentiation-operator"
|
|
108
|
-
] = require("@babel/plugin-transform-exponentiation-operator")
|
|
99
|
+
babelPluginStructure["transform-exponentiation-operator"] =
|
|
100
|
+
requireBabelPlugin("@babel/plugin-transform-exponentiation-operator")
|
|
109
101
|
}
|
|
110
102
|
if (isBabelPluginNeeded("transform-for-of")) {
|
|
111
|
-
babelPluginStructure[
|
|
112
|
-
"transform-for-of"
|
|
113
|
-
|
|
103
|
+
babelPluginStructure["transform-for-of"] = requireBabelPlugin(
|
|
104
|
+
"@babel/plugin-transform-for-of",
|
|
105
|
+
)
|
|
114
106
|
}
|
|
115
107
|
if (isBabelPluginNeeded("transform-function-name")) {
|
|
116
|
-
babelPluginStructure[
|
|
117
|
-
"transform-function-name"
|
|
118
|
-
|
|
108
|
+
babelPluginStructure["transform-function-name"] = requireBabelPlugin(
|
|
109
|
+
"@babel/plugin-transform-function-name",
|
|
110
|
+
)
|
|
119
111
|
}
|
|
120
112
|
if (isBabelPluginNeeded("transform-literals")) {
|
|
121
|
-
babelPluginStructure[
|
|
122
|
-
"transform-literals"
|
|
123
|
-
|
|
113
|
+
babelPluginStructure["transform-literals"] = requireBabelPlugin(
|
|
114
|
+
"@babel/plugin-transform-literals",
|
|
115
|
+
)
|
|
124
116
|
}
|
|
125
117
|
if (isBabelPluginNeeded("transform-new-target")) {
|
|
126
|
-
babelPluginStructure[
|
|
127
|
-
"transform-new-target"
|
|
128
|
-
|
|
118
|
+
babelPluginStructure["transform-new-target"] = requireBabelPlugin(
|
|
119
|
+
"@babel/plugin-transform-new-target",
|
|
120
|
+
)
|
|
129
121
|
}
|
|
130
122
|
if (isBabelPluginNeeded("transform-object-super")) {
|
|
131
|
-
babelPluginStructure[
|
|
132
|
-
"transform-object-super"
|
|
133
|
-
|
|
123
|
+
babelPluginStructure["transform-object-super"] = requireBabelPlugin(
|
|
124
|
+
"@babel/plugin-transform-object-super",
|
|
125
|
+
)
|
|
134
126
|
}
|
|
135
127
|
if (isBabelPluginNeeded("transform-parameters")) {
|
|
136
|
-
babelPluginStructure[
|
|
137
|
-
"transform-parameters"
|
|
138
|
-
|
|
128
|
+
babelPluginStructure["transform-parameters"] = requireBabelPlugin(
|
|
129
|
+
"@babel/plugin-transform-parameters",
|
|
130
|
+
)
|
|
139
131
|
}
|
|
140
132
|
if (isBabelPluginNeeded("transform-regenerator")) {
|
|
141
133
|
babelPluginStructure["transform-regenerator"] = [
|
|
142
|
-
|
|
134
|
+
requireBabelPlugin("@babel/plugin-transform-regenerator"),
|
|
143
135
|
{
|
|
144
136
|
asyncGenerators: true,
|
|
145
137
|
generators: true,
|
|
@@ -149,22 +141,22 @@ export const getBaseBabelPluginStructure = ({
|
|
|
149
141
|
}
|
|
150
142
|
if (isBabelPluginNeeded("transform-shorthand-properties")) {
|
|
151
143
|
babelPluginStructure["transform-shorthand-properties"] = [
|
|
152
|
-
|
|
144
|
+
requireBabelPlugin("@babel/plugin-transform-shorthand-properties"),
|
|
153
145
|
]
|
|
154
146
|
}
|
|
155
147
|
if (isBabelPluginNeeded("transform-spread")) {
|
|
156
148
|
babelPluginStructure["transform-spread"] = [
|
|
157
|
-
|
|
149
|
+
requireBabelPlugin("@babel/plugin-transform-spread"),
|
|
158
150
|
]
|
|
159
151
|
}
|
|
160
152
|
if (isBabelPluginNeeded("transform-sticky-regex")) {
|
|
161
153
|
babelPluginStructure["transform-sticky-regex"] = [
|
|
162
|
-
|
|
154
|
+
requireBabelPlugin("@babel/plugin-transform-sticky-regex"),
|
|
163
155
|
]
|
|
164
156
|
}
|
|
165
157
|
if (isBabelPluginNeeded("transform-template-literals")) {
|
|
166
158
|
babelPluginStructure["transform-template-literals"] = [
|
|
167
|
-
|
|
159
|
+
requireBabelPlugin("@babel/plugin-transform-template-literals"),
|
|
168
160
|
]
|
|
169
161
|
}
|
|
170
162
|
if (
|
|
@@ -175,12 +167,12 @@ export const getBaseBabelPluginStructure = ({
|
|
|
175
167
|
url !== getBabelHelperFileUrl("typeof")
|
|
176
168
|
) {
|
|
177
169
|
babelPluginStructure["transform-typeof-symbol"] = [
|
|
178
|
-
|
|
170
|
+
requireBabelPlugin("@babel/plugin-transform-typeof-symbol"),
|
|
179
171
|
]
|
|
180
172
|
}
|
|
181
173
|
if (isBabelPluginNeeded("transform-unicode-regex")) {
|
|
182
174
|
babelPluginStructure["transform-unicode-regex"] = [
|
|
183
|
-
|
|
175
|
+
requireBabelPlugin("@babel/plugin-transform-unicode-regex"),
|
|
184
176
|
]
|
|
185
177
|
}
|
|
186
178
|
return babelPluginStructure
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { applyBabelPlugins } from "@jsenv/utils/js_ast/apply_babel_plugins.js"
|
|
2
2
|
|
|
3
3
|
import { getBaseBabelPluginStructure } from "./helpers/babel_plugin_structure.js"
|
|
4
|
+
import { babelPluginBabelHelpersAsJsenvImports } from "./helpers/babel_plugin_babel_helpers_as_jsenv_imports.js"
|
|
4
5
|
import { babelPluginNewStylesheetAsJsenvImport } from "./new_stylesheet/babel_plugin_new_stylesheet_as_jsenv_import.js"
|
|
5
6
|
import { babelPluginGlobalThisAsJsenvImport } from "./global_this/babel_plugin_global_this_as_jsenv_import.js"
|
|
6
7
|
import { babelPluginRegeneratorRuntimeAsJsenvImport } from "./regenerator_runtime/babel_plugin_regenerator_runtime_as_jsenv_import.js"
|
|
7
|
-
import { babelPluginBabelHelpersAsJsenvImports } from "./babel_helper/babel_plugin_babel_helpers_as_jsenv_imports.js"
|
|
8
8
|
|
|
9
9
|
export const jsenvPluginBabel = ({
|
|
10
10
|
getCustomBabelPlugins,
|
|
@@ -32,21 +32,31 @@ export const jsenvPluginImportMetaScenarios = () => {
|
|
|
32
32
|
}
|
|
33
33
|
if (scenario === "dev") {
|
|
34
34
|
dev.forEach((path) => {
|
|
35
|
-
replace(path, true)
|
|
35
|
+
replace(path, "true")
|
|
36
36
|
})
|
|
37
37
|
} else if (scenario === "test") {
|
|
38
|
+
// test is also considered a dev environment
|
|
39
|
+
// just like the dev server can be used to debug test files
|
|
40
|
+
// without this people would have to write
|
|
41
|
+
// if (import.meta.dev || import.meta.test) or if (!import.meta.build)
|
|
42
|
+
dev.forEach((path) => {
|
|
43
|
+
replace(path, "true")
|
|
44
|
+
})
|
|
38
45
|
test.forEach((path) => {
|
|
39
|
-
replace(path, true)
|
|
46
|
+
replace(path, "true")
|
|
40
47
|
})
|
|
41
48
|
} else if (scenario === "build") {
|
|
49
|
+
// replacing by undefined might not be required
|
|
50
|
+
// as I suppose rollup would consider them as undefined
|
|
51
|
+
// but let's make it explicit to ensure code is properly tree-shaked
|
|
42
52
|
dev.forEach((path) => {
|
|
43
|
-
replace(path, undefined)
|
|
53
|
+
replace(path, "undefined")
|
|
44
54
|
})
|
|
45
55
|
test.forEach((path) => {
|
|
46
|
-
replace(path, undefined)
|
|
56
|
+
replace(path, "undefined")
|
|
47
57
|
})
|
|
48
58
|
build.forEach((path) => {
|
|
49
|
-
replace(path, true)
|
|
59
|
+
replace(path, "true")
|
|
50
60
|
})
|
|
51
61
|
}
|
|
52
62
|
const magicSource = createMagicSource(content)
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
// https://github.com/babel/babel/blob/99f4f6c3b03c7f3f67cf1b9f1a21b80cfd5b0224/packages/babel-core/src/tools/build-external-helpers.js
|
|
2
|
-
// the list of possible helpers:
|
|
3
|
-
// https://github.com/babel/babel/blob/99f4f6c3b03c7f3f67cf1b9f1a21b80cfd5b0224/packages/babel-helpers/src/helpers.js#L13
|
|
4
|
-
|
|
5
|
-
const babelHelperClientDirectoryUrl = new URL("./client/", import.meta.url).href
|
|
6
|
-
|
|
7
|
-
// we cannot use "@jsenv/core/src/*" because babel helper might be injected
|
|
8
|
-
// into node_modules not depending on "@jsenv/core"
|
|
9
|
-
export const getBabelHelperFileUrl = (babelHelperName) => {
|
|
10
|
-
const babelHelperFileUrl = new URL(
|
|
11
|
-
`./${babelHelperName}/${babelHelperName}.js`,
|
|
12
|
-
babelHelperClientDirectoryUrl,
|
|
13
|
-
).href
|
|
14
|
-
return babelHelperFileUrl
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export const babelHelperNameFromUrl = (url) => {
|
|
18
|
-
if (!url.startsWith(babelHelperClientDirectoryUrl)) {
|
|
19
|
-
return null
|
|
20
|
-
}
|
|
21
|
-
const afterBabelHelperDirectory = url.slice(
|
|
22
|
-
babelHelperClientDirectoryUrl.length,
|
|
23
|
-
)
|
|
24
|
-
const babelHelperName = afterBabelHelperDirectory.slice(
|
|
25
|
-
0,
|
|
26
|
-
afterBabelHelperDirectory.indexOf("/"),
|
|
27
|
-
)
|
|
28
|
-
return babelHelperName
|
|
29
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
const eslintConfig = require("../../.eslintrc.cjs")
|
|
2
|
-
|
|
3
|
-
// babel helpers are copy pasted from the babel repository
|
|
4
|
-
Object.assign(eslintConfig.rules, {
|
|
5
|
-
"eqeqeq": ["off"],
|
|
6
|
-
"no-eq-null": ["off"],
|
|
7
|
-
"no-undef-init": ["off"],
|
|
8
|
-
"dot-notation": ["off"],
|
|
9
|
-
"consistent-return": ["off"],
|
|
10
|
-
"one-var": ["off"],
|
|
11
|
-
"object-shorthand": ["off"],
|
|
12
|
-
"no-return-assign": ["off"],
|
|
13
|
-
"prefer-template": ["off"],
|
|
14
|
-
"prefer-rest-params": ["off"],
|
|
15
|
-
"no-void": ["off"],
|
|
16
|
-
"no-implicit-coercion": ["off"],
|
|
17
|
-
"prefer-spread": ["off"],
|
|
18
|
-
"no-loop-func": ["off"],
|
|
19
|
-
"no-negated-condition": ["off"],
|
|
20
|
-
"no-func-assign": ["off"],
|
|
21
|
-
"no-else-return": ["off"],
|
|
22
|
-
})
|
|
23
|
-
|
|
24
|
-
module.exports = eslintConfig
|
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
import AwaitValue from "../AwaitValue/AwaitValue.js"
|
|
2
|
-
|
|
3
|
-
export default function AsyncGenerator(gen) {
|
|
4
|
-
var front, back
|
|
5
|
-
function send(key, arg) {
|
|
6
|
-
return new Promise(function (resolve, reject) {
|
|
7
|
-
var request = {
|
|
8
|
-
key: key,
|
|
9
|
-
arg: arg,
|
|
10
|
-
resolve: resolve,
|
|
11
|
-
reject: reject,
|
|
12
|
-
next: null,
|
|
13
|
-
}
|
|
14
|
-
if (back) {
|
|
15
|
-
back = back.next = request
|
|
16
|
-
} else {
|
|
17
|
-
front = back = request
|
|
18
|
-
resume(key, arg)
|
|
19
|
-
}
|
|
20
|
-
})
|
|
21
|
-
}
|
|
22
|
-
function resume(key, arg) {
|
|
23
|
-
try {
|
|
24
|
-
var result = gen[key](arg)
|
|
25
|
-
var value = result.value
|
|
26
|
-
var wrappedAwait = value instanceof AwaitValue
|
|
27
|
-
Promise.resolve(wrappedAwait ? value.wrapped : value).then(
|
|
28
|
-
function (arg) {
|
|
29
|
-
if (wrappedAwait) {
|
|
30
|
-
resume(key === "return" ? "return" : "next", arg)
|
|
31
|
-
return
|
|
32
|
-
}
|
|
33
|
-
settle(result.done ? "return" : "normal", arg)
|
|
34
|
-
},
|
|
35
|
-
function (err) {
|
|
36
|
-
resume("throw", err)
|
|
37
|
-
},
|
|
38
|
-
)
|
|
39
|
-
} catch (err) {
|
|
40
|
-
settle("throw", err)
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
function settle(type, value) {
|
|
44
|
-
switch (type) {
|
|
45
|
-
case "return":
|
|
46
|
-
front.resolve({ value: value, done: true })
|
|
47
|
-
break
|
|
48
|
-
case "throw":
|
|
49
|
-
front.reject(value)
|
|
50
|
-
break
|
|
51
|
-
default:
|
|
52
|
-
front.resolve({ value: value, done: false })
|
|
53
|
-
break
|
|
54
|
-
}
|
|
55
|
-
front = front.next
|
|
56
|
-
if (front) {
|
|
57
|
-
resume(front.key, front.arg)
|
|
58
|
-
} else {
|
|
59
|
-
back = null
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
this._invoke = send
|
|
63
|
-
// Hide "return" method if generator return is not supported
|
|
64
|
-
if (typeof gen.return !== "function") {
|
|
65
|
-
this.return = undefined
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
AsyncGenerator.prototype[
|
|
69
|
-
(typeof Symbol === "function" && Symbol.asyncIterator) || "@@asyncIterator"
|
|
70
|
-
] = function () {
|
|
71
|
-
return this
|
|
72
|
-
}
|
|
73
|
-
AsyncGenerator.prototype.next = function (arg) {
|
|
74
|
-
return this._invoke("next", arg)
|
|
75
|
-
}
|
|
76
|
-
AsyncGenerator.prototype.throw = function (arg) {
|
|
77
|
-
return this._invoke("throw", arg)
|
|
78
|
-
}
|
|
79
|
-
AsyncGenerator.prototype.return = function (arg) {
|
|
80
|
-
return this._invoke("return", arg)
|
|
81
|
-
}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
/* eslint-disable no-void */
|
|
2
|
-
export default function _applyDecoratedDescriptor(
|
|
3
|
-
target,
|
|
4
|
-
property,
|
|
5
|
-
decorators,
|
|
6
|
-
descriptor,
|
|
7
|
-
context,
|
|
8
|
-
) {
|
|
9
|
-
var desc = {}
|
|
10
|
-
Object.keys(descriptor).forEach(function (key) {
|
|
11
|
-
desc[key] = descriptor[key]
|
|
12
|
-
})
|
|
13
|
-
desc.enumerable = Boolean(desc.enumerable)
|
|
14
|
-
desc.configurable = Boolean(desc.configurable)
|
|
15
|
-
if ("value" in desc || desc.initializer) {
|
|
16
|
-
desc.writable = true
|
|
17
|
-
}
|
|
18
|
-
desc = decorators
|
|
19
|
-
.slice()
|
|
20
|
-
.reverse()
|
|
21
|
-
.reduce(function (desc, decorator) {
|
|
22
|
-
return decorator(target, property, desc) || desc
|
|
23
|
-
}, desc)
|
|
24
|
-
if (context && desc.initializer !== void 0) {
|
|
25
|
-
desc.value = desc.initializer ? desc.initializer.call(context) : void 0
|
|
26
|
-
desc.initializer = undefined
|
|
27
|
-
}
|
|
28
|
-
if (desc.initializer === void 0) {
|
|
29
|
-
Object.defineProperty(target, property, desc)
|
|
30
|
-
desc = null
|
|
31
|
-
}
|
|
32
|
-
return desc
|
|
33
|
-
}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
export default function _asyncGeneratorDelegate(inner, awaitWrap) {
|
|
2
|
-
var iter = {},
|
|
3
|
-
waiting = false
|
|
4
|
-
function pump(key, value) {
|
|
5
|
-
waiting = true
|
|
6
|
-
value = new Promise(function (resolve) {
|
|
7
|
-
resolve(inner[key](value))
|
|
8
|
-
})
|
|
9
|
-
return { done: false, value: awaitWrap(value) }
|
|
10
|
-
}
|
|
11
|
-
iter[(typeof Symbol !== "undefined" && Symbol.iterator) || "@@iterator"] = function () {
|
|
12
|
-
return this
|
|
13
|
-
}
|
|
14
|
-
iter.next = function (value) {
|
|
15
|
-
if (waiting) {
|
|
16
|
-
waiting = false
|
|
17
|
-
return value
|
|
18
|
-
}
|
|
19
|
-
return pump("next", value)
|
|
20
|
-
}
|
|
21
|
-
if (typeof inner.throw === "function") {
|
|
22
|
-
iter.throw = function (value) {
|
|
23
|
-
if (waiting) {
|
|
24
|
-
waiting = false
|
|
25
|
-
throw value
|
|
26
|
-
}
|
|
27
|
-
return pump("throw", value)
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
if (typeof inner.return === "function") {
|
|
31
|
-
iter.return = function (value) {
|
|
32
|
-
if (waiting) {
|
|
33
|
-
waiting = false
|
|
34
|
-
return value
|
|
35
|
-
}
|
|
36
|
-
return pump("return", value)
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
return iter
|
|
40
|
-
}
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
export default function _asyncIterator(iterable) {
|
|
2
|
-
var method,
|
|
3
|
-
async,
|
|
4
|
-
sync,
|
|
5
|
-
retry = 2;
|
|
6
|
-
|
|
7
|
-
if (typeof Symbol !== "undefined") {
|
|
8
|
-
async = Symbol.asyncIterator;
|
|
9
|
-
sync = Symbol.iterator;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
while (retry--) {
|
|
13
|
-
if (async && (method = iterable[async]) != null) {
|
|
14
|
-
return method.call(iterable);
|
|
15
|
-
}
|
|
16
|
-
if (sync && (method = iterable[sync]) != null) {
|
|
17
|
-
return new AsyncFromSyncIterator(method.call(iterable));
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
async = "@@asyncIterator";
|
|
21
|
-
sync = "@@iterator";
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
throw new TypeError("Object is not async iterable");
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
function AsyncFromSyncIterator(s) {
|
|
28
|
-
AsyncFromSyncIterator = function (s) {
|
|
29
|
-
this.s = s;
|
|
30
|
-
this.n = s.next;
|
|
31
|
-
};
|
|
32
|
-
AsyncFromSyncIterator.prototype = {
|
|
33
|
-
/* SyncIterator */ s: null,
|
|
34
|
-
/* SyncIterator.[[Next]] */ n: null,
|
|
35
|
-
next: function () {
|
|
36
|
-
return AsyncFromSyncIteratorContinuation(this.n.apply(this.s, arguments));
|
|
37
|
-
},
|
|
38
|
-
return: function (value) {
|
|
39
|
-
var ret = this.s.return;
|
|
40
|
-
if (ret === undefined) {
|
|
41
|
-
return Promise.resolve({ value: value, done: true });
|
|
42
|
-
}
|
|
43
|
-
return AsyncFromSyncIteratorContinuation(ret.apply(this.s, arguments));
|
|
44
|
-
},
|
|
45
|
-
throw: function (value) {
|
|
46
|
-
var thr = this.s.return;
|
|
47
|
-
if (thr === undefined) return Promise.reject(value);
|
|
48
|
-
return AsyncFromSyncIteratorContinuation(thr.apply(this.s, arguments));
|
|
49
|
-
},
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
function AsyncFromSyncIteratorContinuation(r) {
|
|
53
|
-
// This step is _before_ calling AsyncFromSyncIteratorContinuation in the spec.
|
|
54
|
-
if (Object(r) !== r) {
|
|
55
|
-
return Promise.reject(new TypeError(r + " is not an object."));
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
var done = r.done;
|
|
59
|
-
return Promise.resolve(r.value).then(function (value) {
|
|
60
|
-
return { value: value, done: done };
|
|
61
|
-
});
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
return new AsyncFromSyncIterator(s);
|
|
65
|
-
}
|