@jsenv/core 23.6.2 → 23.7.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/{license → LICENSE} +21 -21
- package/dist/jsenv_browser_system.js +35 -35
- package/dist/jsenv_browser_system.js.map +14 -14
- package/dist/jsenv_compile_proxy.js +47 -128
- package/dist/jsenv_compile_proxy.js.map +25 -62
- package/dist/jsenv_exploring_index.js.map +5 -5
- package/dist/jsenv_exploring_redirector.js +47 -54
- package/dist/jsenv_exploring_redirector.js.map +17 -19
- package/dist/jsenv_toolbar.js +47 -128
- package/dist/jsenv_toolbar.js.map +12 -47
- package/dist/jsenv_toolbar_injector.js.map +5 -5
- package/helpers/babel/.eslintrc.cjs +24 -24
- package/helpers/babel/AsyncGenerator/AsyncGenerator.js +81 -81
- package/helpers/babel/AwaitValue/AwaitValue.js +3 -3
- package/helpers/babel/applyDecoratorDescriptor/applyDecoratorDescriptor.js +33 -33
- package/helpers/babel/arrayLikeToArray/arrayLikeToArray.js +7 -7
- package/helpers/babel/arrayWithHoles/arrayWithHoles.js +4 -4
- package/helpers/babel/arrayWithoutHoles/arrayWithoutHoles.js +6 -6
- package/helpers/babel/assertThisInitialized/assertThisInitialized.js +7 -7
- package/helpers/babel/asyncGeneratorDelegate/asyncGeneratorDelegate.js +40 -40
- package/helpers/babel/asyncIterator/asyncIterator.js +12 -12
- package/helpers/babel/asyncToGenerator/asyncToGenerator.js +34 -34
- package/helpers/babel/awaitAsyncGenerator/awaitAsyncGenerator.js +5 -5
- package/helpers/babel/classApplyDescriptorDestructureSet/classApplyDescriptorDestructureSet.js +20 -20
- package/helpers/babel/classApplyDescriptorGet/classApplyDescriptorGet.js +6 -6
- package/helpers/babel/classApplyDescriptorSet/classApplyDescriptorSet.js +13 -13
- package/helpers/babel/classCallCheck/classCallCheck.js +5 -5
- package/helpers/babel/classCheckPrivateStaticAccess/classCheckPrivateStaticAccess.js +5 -5
- package/helpers/babel/classCheckPrivateStaticFieldDescriptor/classCheckPrivateStaticFieldDescriptor.js +6 -6
- package/helpers/babel/classExtractFieldDescriptor/classExtractFieldDescriptor.js +7 -7
- package/helpers/babel/classNameTDZError/classNameTDZError.js +4 -4
- package/helpers/babel/classPrivateFieldDestructureSet/classPrivateFieldDestructureSet.js +7 -7
- package/helpers/babel/classPrivateFieldGet/classPrivateFieldGet.js +7 -7
- package/helpers/babel/classPrivateFieldLooseBase/classPrivateFieldLooseBase.js +6 -6
- package/helpers/babel/classPrivateFieldLooseKey/classPrivateFieldLooseKey.js +5 -5
- package/helpers/babel/classPrivateFieldSet/classPrivateFieldSet.js +8 -8
- package/helpers/babel/classPrivateMethodGet/classPrivateMethodGet.js +6 -6
- package/helpers/babel/classPrivateMethodSet/classPrivateMethodSet.js +3 -3
- package/helpers/babel/classStaticPrivateFieldSpecGet/classStaticPrivateFieldSpecGet.js +9 -9
- package/helpers/babel/classStaticPrivateFieldSpecSet/classStaticPrivateFieldSpecSet.js +15 -15
- package/helpers/babel/classStaticPrivateMethodGet/classStaticPrivateMethodGet.js +6 -6
- package/helpers/babel/classStaticPrivateMethodSet/classStaticPrivateMethodSet.js +3 -3
- package/helpers/babel/construct/construct.js +16 -16
- package/helpers/babel/createClass/createClass.js +15 -15
- package/helpers/babel/createForOfIteratorHelper/createForOfIteratorHelper.js +60 -60
- package/helpers/babel/createForOfIteratorHelperLoose/createForOfIteratorHelperLoose.js +23 -23
- package/helpers/babel/createRawReactElement/createRawReactElement.js +50 -50
- package/helpers/babel/createSuper/createSuper.js +22 -22
- package/helpers/babel/decorate/decorate.js +403 -403
- package/helpers/babel/defaults/defaults.js +11 -11
- package/helpers/babel/defineEnumerableProperties/defineEnumerableProperties.js +23 -23
- package/helpers/babel/defineProperty/defineProperty.js +18 -18
- package/helpers/babel/extends/extends.js +14 -14
- package/helpers/babel/get/get.js +13 -13
- package/helpers/babel/getPrototypeOf/getPrototypeOf.js +4 -4
- package/helpers/babel/inherits/inherits.js +15 -15
- package/helpers/babel/inheritsLoose/inheritsLoose.js +7 -7
- package/helpers/babel/initializerDefineProperty/initializerDefineProperty.js +10 -10
- package/helpers/babel/initializerWarningHelper/initializerWarningHelper.js +6 -6
- package/helpers/babel/instanceof/instanceof.js +6 -6
- package/helpers/babel/interopRequireDefault/interopRequireDefault.js +3 -3
- package/helpers/babel/interopRequireWildcard/interopRequireWildcard.js +37 -37
- package/helpers/babel/isNativeFunction/isNativeFunction.js +4 -4
- package/helpers/babel/isNativeReflectConstruct/isNativeReflectConstruct.js +21 -21
- package/helpers/babel/iterableToArray/iterableToArray.js +7 -7
- package/helpers/babel/iterableToArrayLimit/iterableToArrayLimit.js +36 -36
- package/helpers/babel/iterableToArrayLimitLoose/iterableToArrayLimitLoose.js +10 -10
- package/helpers/babel/jsx/jsx.js +45 -45
- package/helpers/babel/maybeArrayLike/maybeArrayLike.js +10 -10
- package/helpers/babel/newArrowCheck/newArrowCheck.js +5 -5
- package/helpers/babel/nonIterableRest/nonIterableRest.js +5 -5
- package/helpers/babel/nonIterableSpread/nonIterableSpread.js +5 -5
- package/helpers/babel/objectDestructuringEmpty/objectDestructuringEmpty.js +3 -3
- package/helpers/babel/objectSpread/objectSpread.js +23 -23
- package/helpers/babel/objectSpread2/objectSpread2.js +33 -33
- package/helpers/babel/objectWithoutProperties/objectWithoutProperties.js +19 -19
- package/helpers/babel/objectWithoutPropertiesLoose/objectWithoutPropertiesLoose.js +13 -13
- package/helpers/babel/possibleConstructorReturn/possibleConstructorReturn.js +10 -10
- package/helpers/babel/readOnlyError/readOnlyError.js +4 -4
- package/helpers/babel/readme.md +9 -9
- package/helpers/babel/set/set.js +44 -44
- package/helpers/babel/setPrototypeOf/setPrototypeOf.js +6 -6
- package/helpers/babel/skipFirstGeneratorNext/skipFirstGeneratorNext.js +8 -8
- package/helpers/babel/slicedToArray/slicedToArray.js +10 -10
- package/helpers/babel/slicedToArrayLoose/slicedToArrayLoose.js +13 -13
- package/helpers/babel/superPropBase/superPropBase.js +10 -10
- package/helpers/babel/taggedTemplateLiteral/taggedTemplateLiteral.js +10 -10
- package/helpers/babel/taggedTemplateLiteralLoose/taggedTemplateLiteralLoose.js +7 -7
- package/helpers/babel/tdz/tdz.js +4 -4
- package/helpers/babel/temporalRef/temporalRef.js +6 -6
- package/helpers/babel/temporalUndefined/temporalUndefined.js +3 -3
- package/helpers/babel/toArray/toArray.js +10 -10
- package/helpers/babel/toConsumableArray/toConsumableArray.js +10 -10
- package/helpers/babel/toPrimitive/toPrimitive.js +10 -10
- package/helpers/babel/toPropertyKey/toPropertyKey.js +6 -6
- package/helpers/babel/typeof/typeof.js +14 -14
- package/helpers/babel/unsupportedIterableToArray/unsupportedIterableToArray.js +12 -12
- package/helpers/babel/wrapAsyncGenerator/wrapAsyncGenerator.js +8 -8
- package/helpers/babel/wrapNativeSuper/wrapNativeSuper.js +30 -30
- package/helpers/babel/wrapRegExp/wrapRegExp.js +63 -63
- package/helpers/babel/writeOnlyError/writeOnlyError.js +4 -4
- package/helpers/regenerator-runtime/regenerator-runtime.js +748 -748
- package/package.json +4 -2
- package/src/buildProject.js +300 -300
- package/src/execute.js +184 -184
- package/src/internal/browser-launcher/jsenv-browser-system.js +199 -199
- package/src/internal/compiling/createCompiledFileService.js +290 -290
- package/src/internal/compiling/startCompileServer.js +1052 -1131
- package/src/internal/executing/coverage/babel_plugin_instrument.js +90 -90
- package/src/internal/executing/coverage/reportToCoverage.js +187 -187
- package/src/internal/executing/executePlan.js +183 -183
- package/src/internal/executing/launchAndExecute.js +458 -450
- package/src/internal/runtime/createBrowserRuntime/scanBrowserRuntimeFeatures.js +246 -250
- package/src/internal/runtime/createNodeRuntime/scanNodeRuntimeFeatures.js +112 -115
- package/src/internal/runtime/s.js +727 -727
- package/src/internal/toolbar/jsenv-logo.svg +144 -144
- package/src/internal/url_conversion.js +317 -317
- package/src/launchNode.js +210 -210
- package/src/startExploring.js +309 -309
|
@@ -1,115 +1,112 @@
|
|
|
1
|
-
import { detectNode } from "../detectNode/detectNode.js"
|
|
2
|
-
import { resolveGroup } from "../resolveGroup.js"
|
|
3
|
-
import { computeCompileIdFromGroupId } from "../computeCompileIdFromGroupId.js"
|
|
4
|
-
import { nodeSupportsDynamicImport } from "../node-feature-detect/nodeSupportsDynamicImport.js"
|
|
5
|
-
import { nodeSupportsTopLevelAwait } from "../node-feature-detect/nodeSupportsTopLevelAwait.js"
|
|
6
|
-
import { fetchSource } from "./fetchSource.js"
|
|
7
|
-
|
|
8
|
-
export const scanNodeRuntimeFeatures = async ({
|
|
9
|
-
compileServerOrigin,
|
|
10
|
-
outDirectoryRelativeUrl,
|
|
11
|
-
}) => {
|
|
12
|
-
const outDirectoryServerUrl = `${compileServerOrigin}/${outDirectoryRelativeUrl}`
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
const
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
groupInfo
|
|
94
|
-
|
|
95
|
-
) => {
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
return requiredPluginNames
|
|
115
|
-
}
|
|
1
|
+
import { detectNode } from "../detectNode/detectNode.js"
|
|
2
|
+
import { resolveGroup } from "../resolveGroup.js"
|
|
3
|
+
import { computeCompileIdFromGroupId } from "../computeCompileIdFromGroupId.js"
|
|
4
|
+
import { nodeSupportsDynamicImport } from "../node-feature-detect/nodeSupportsDynamicImport.js"
|
|
5
|
+
import { nodeSupportsTopLevelAwait } from "../node-feature-detect/nodeSupportsTopLevelAwait.js"
|
|
6
|
+
import { fetchSource } from "./fetchSource.js"
|
|
7
|
+
|
|
8
|
+
export const scanNodeRuntimeFeatures = async ({
|
|
9
|
+
compileServerOrigin,
|
|
10
|
+
outDirectoryRelativeUrl,
|
|
11
|
+
}) => {
|
|
12
|
+
const outDirectoryServerUrl = `${compileServerOrigin}/${outDirectoryRelativeUrl}`
|
|
13
|
+
const {
|
|
14
|
+
importDefaultExtension,
|
|
15
|
+
customCompilerPatterns,
|
|
16
|
+
compileServerGroupMap,
|
|
17
|
+
} = await importJson(
|
|
18
|
+
new URL("__compile_server_meta__.json", outDirectoryServerUrl),
|
|
19
|
+
)
|
|
20
|
+
|
|
21
|
+
const node = detectNode()
|
|
22
|
+
const compileId = computeCompileIdFromGroupId({
|
|
23
|
+
groupId: resolveGroup(node, compileServerGroupMap),
|
|
24
|
+
groupMap: compileServerGroupMap,
|
|
25
|
+
})
|
|
26
|
+
const groupInfo = compileServerGroupMap[compileId]
|
|
27
|
+
|
|
28
|
+
const featuresReport = {
|
|
29
|
+
dynamicImport: undefined,
|
|
30
|
+
topLevelAwait: undefined,
|
|
31
|
+
}
|
|
32
|
+
await detectSupportedFeatures({
|
|
33
|
+
featuresReport,
|
|
34
|
+
failFastOnFeatureDetection: true,
|
|
35
|
+
})
|
|
36
|
+
const pluginRequiredNameArray = pluginRequiredNamesFromGroupInfo(groupInfo, {
|
|
37
|
+
featuresReport,
|
|
38
|
+
// https://nodejs.org/docs/latest-v15.x/api/cli.html#cli_node_v8_coverage_dir
|
|
39
|
+
// instrumentation CAN be handed by process.env.NODE_V8_COVERAGE
|
|
40
|
+
// "transform-instrument" becomes non mandatory
|
|
41
|
+
coverageHandledFromOutside: process.env.NODE_V8_COVERAGE,
|
|
42
|
+
})
|
|
43
|
+
|
|
44
|
+
const canAvoidCompilation =
|
|
45
|
+
// node native resolution will not auto add extension
|
|
46
|
+
!importDefaultExtension &&
|
|
47
|
+
customCompilerPatterns.length === 0 &&
|
|
48
|
+
pluginRequiredNameArray.length === 0 &&
|
|
49
|
+
featuresReport.dynamicImport &&
|
|
50
|
+
featuresReport.topLevelAwait
|
|
51
|
+
|
|
52
|
+
return {
|
|
53
|
+
canAvoidCompilation,
|
|
54
|
+
featuresReport,
|
|
55
|
+
pluginRequiredNameArray,
|
|
56
|
+
compileId,
|
|
57
|
+
importDefaultExtension,
|
|
58
|
+
node,
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
const detectSupportedFeatures = async ({
|
|
63
|
+
featuresReport,
|
|
64
|
+
failFastOnFeatureDetection,
|
|
65
|
+
}) => {
|
|
66
|
+
const dynamicImport = await nodeSupportsDynamicImport()
|
|
67
|
+
featuresReport.dynamicImport = dynamicImport
|
|
68
|
+
if (failFastOnFeatureDetection && !dynamicImport) {
|
|
69
|
+
return
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
const topLevelAwait = await nodeSupportsTopLevelAwait()
|
|
73
|
+
featuresReport.topLevelAwait = topLevelAwait
|
|
74
|
+
if (failFastOnFeatureDetection && !topLevelAwait) {
|
|
75
|
+
return
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
const importJson = async (url) => {
|
|
80
|
+
const response = await fetchSource(url)
|
|
81
|
+
const status = response.status
|
|
82
|
+
if (status !== 200) {
|
|
83
|
+
throw new Error(`unexpected response status for ${url}, got ${status}`)
|
|
84
|
+
}
|
|
85
|
+
const object = await response.json()
|
|
86
|
+
return object
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
const pluginRequiredNamesFromGroupInfo = (
|
|
90
|
+
groupInfo,
|
|
91
|
+
{ coverageHandledFromOutside },
|
|
92
|
+
) => {
|
|
93
|
+
const { pluginRequiredNameArray } = groupInfo
|
|
94
|
+
const requiredPluginNames = pluginRequiredNameArray.slice()
|
|
95
|
+
const markPluginAsSupported = (name) => {
|
|
96
|
+
const index = requiredPluginNames.indexOf(name)
|
|
97
|
+
if (index > -1) {
|
|
98
|
+
requiredPluginNames.splice(index, 1)
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
if (coverageHandledFromOutside) {
|
|
103
|
+
markPluginAsSupported("transform-instrument")
|
|
104
|
+
}
|
|
105
|
+
// We assume import assertions and constructable stylesheet won't be used
|
|
106
|
+
// in code executed in Node.js
|
|
107
|
+
// so event they are conceptually required, they are ignored
|
|
108
|
+
markPluginAsSupported("transform-import-assertions")
|
|
109
|
+
markPluginAsSupported("new-stylesheet-as-jsenv-import")
|
|
110
|
+
|
|
111
|
+
return requiredPluginNames
|
|
112
|
+
}
|