@jsenv/core 29.1.19 → 29.2.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/dist/babel_helpers/AsyncGenerator/AsyncGenerator.js +3 -16
- package/dist/babel_helpers/applyDecoratorDescriptor/applyDecoratorDescriptor.js +0 -5
- package/dist/babel_helpers/applyDecs/applyDecs.js +54 -241
- package/dist/babel_helpers/applyDecs2023/applyDecs2023.js +47 -195
- package/dist/babel_helpers/arrayLikeToArray/arrayLikeToArray.js +0 -2
- package/dist/babel_helpers/arrayWithoutHoles/arrayWithoutHoles.js +2 -1
- package/dist/babel_helpers/assertThisInitialized/assertThisInitialized.js +0 -1
- package/dist/babel_helpers/asyncGeneratorDelegate/asyncGeneratorDelegate.js +4 -14
- package/dist/babel_helpers/asyncIterator/asyncIterator.js +5 -20
- package/dist/babel_helpers/asyncToGenerator/asyncToGenerator.js +2 -8
- package/dist/babel_helpers/awaitAsyncGenerator/awaitAsyncGenerator.js +1 -3
- package/dist/babel_helpers/classApplyDescriptorDestructureSet/classApplyDescriptorDestructureSet.js +0 -4
- package/dist/babel_helpers/classApplyDescriptorGet/classApplyDescriptorGet.js +0 -1
- package/dist/babel_helpers/classApplyDescriptorSet/classApplyDescriptorSet.js +0 -1
- package/dist/babel_helpers/classExtractFieldDescriptor/classExtractFieldDescriptor.js +0 -1
- package/dist/babel_helpers/classPrivateFieldLooseBase/classPrivateFieldLooseBase.js +0 -1
- package/dist/babel_helpers/classPrivateMethodGet/classPrivateMethodGet.js +0 -1
- package/dist/babel_helpers/construct/construct.js +5 -5
- package/dist/babel_helpers/createClass/createClass.js +0 -1
- package/dist/babel_helpers/createForOfIteratorHelper/createForOfIteratorHelper.js +5 -9
- package/dist/babel_helpers/createForOfIteratorHelperLoose/createForOfIteratorHelperLoose.js +2 -3
- package/dist/babel_helpers/createRawReactElement/createRawReactElement.js +2 -8
- package/dist/babel_helpers/createSuper/createSuper.js +2 -4
- package/dist/babel_helpers/decorate/decorate.js +60 -311
- package/dist/babel_helpers/defaults/defaults.js +0 -3
- package/dist/babel_helpers/defineEnumerableProperties/defineEnumerableProperties.js +2 -5
- package/dist/babel_helpers/defineProperty/defineProperty.js +0 -1
- package/dist/babel_helpers/extends/extends.js +0 -3
- package/dist/babel_helpers/get/get.js +0 -3
- package/dist/babel_helpers/getPrototypeOf/getPrototypeOf.js +2 -1
- package/dist/babel_helpers/inherits/inherits.js +2 -3
- package/dist/babel_helpers/instanceof/instanceof.js +0 -1
- package/dist/babel_helpers/interopRequireWildcard/interopRequireWildcard.js +0 -10
- package/dist/babel_helpers/isNativeReflectConstruct/isNativeReflectConstruct.js +6 -6
- package/dist/babel_helpers/iterableToArrayLimit/iterableToArrayLimit.js +0 -5
- package/dist/babel_helpers/iterableToArrayLimitLoose/iterableToArrayLimitLoose.js +2 -5
- package/dist/babel_helpers/jsx/jsx.js +2 -8
- package/dist/babel_helpers/maybeArrayLike/maybeArrayLike.js +2 -3
- package/dist/babel_helpers/objectSpread/objectSpread.js +4 -6
- package/dist/babel_helpers/objectSpread2/objectSpread2.js +3 -8
- package/dist/babel_helpers/objectWithoutProperties/objectWithoutProperties.js +0 -3
- package/dist/babel_helpers/objectWithoutPropertiesLoose/objectWithoutPropertiesLoose.js +0 -2
- package/dist/babel_helpers/possibleConstructorReturn/possibleConstructorReturn.js +0 -1
- package/dist/babel_helpers/set/set.js +2 -12
- package/dist/babel_helpers/superPropBase/superPropBase.js +0 -1
- package/dist/babel_helpers/taggedTemplateLiteral/taggedTemplateLiteral.js +0 -1
- package/dist/babel_helpers/taggedTemplateLiteralLoose/taggedTemplateLiteralLoose.js +0 -1
- package/dist/babel_helpers/toPrimitive/toPrimitive.js +1 -5
- package/dist/babel_helpers/typeof/typeof.js +0 -2
- package/dist/babel_helpers/wrapNativeSuper/wrapNativeSuper.js +0 -7
- package/dist/babel_helpers/wrapRegExp/wrapRegExp.js +5 -19
- package/dist/controllable_child_process.mjs +17 -27
- package/dist/controllable_worker_thread.mjs +4 -16
- package/dist/js/autoreload.js +13 -56
- package/dist/js/execute_using_dynamic_import.js +40 -164
- package/dist/js/global_this.js +2 -10
- package/dist/js/import_meta_hot.js +3 -9
- package/dist/js/new_stylesheet.js +0 -59
- package/dist/js/regenerator_runtime.js +80 -156
- package/dist/js/s.js +25 -113
- package/dist/js/s.js.map +10 -10
- package/dist/js/script_type_module_supervisor.js +4 -13
- package/dist/js/server_events_client.js +10 -38
- package/dist/js/supervisor.js +25 -167
- package/dist/js/v8_coverage.js +29 -92
- package/dist/js/ws.js +226 -704
- package/dist/main.js +761 -4155
- package/package.json +2 -2
- package/src/plugins/import_meta_url/client/import_meta_url_browser.js +1 -2
- package/src/plugins/import_meta_url/client/import_meta_url_commonjs.mjs +1 -1
- package/src/plugins/plugins.js +1 -1
- package/src/plugins/transpilation/as_js_classic/helpers-string.js +1 -0
- package/src/plugins/transpilation/babel/global_this/client/global_this.js +0 -2
|
@@ -2,15 +2,12 @@ function assign(target) {
|
|
|
2
2
|
for (var i = 1; i < arguments.length; i++) {
|
|
3
3
|
// eslint-disable-next-line prefer-rest-params
|
|
4
4
|
var source = arguments[i];
|
|
5
|
-
|
|
6
5
|
for (var key in source) {
|
|
7
6
|
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
8
7
|
target[key] = source[key];
|
|
9
8
|
}
|
|
10
9
|
}
|
|
11
10
|
}
|
|
12
|
-
|
|
13
11
|
return target;
|
|
14
12
|
}
|
|
15
|
-
|
|
16
13
|
export default Object.assign ? Object.assign.bind() : assign;
|
|
@@ -7,15 +7,12 @@ export default function _get() {
|
|
|
7
7
|
var base = superPropBase(target, property);
|
|
8
8
|
if (!base) return;
|
|
9
9
|
var desc = Object.getOwnPropertyDescriptor(base, property);
|
|
10
|
-
|
|
11
10
|
if (desc.get) {
|
|
12
11
|
// STEP 3. If receiver is not present, then set receiver to target.
|
|
13
12
|
return desc.get.call(arguments.length < 3 ? target : receiver);
|
|
14
13
|
}
|
|
15
|
-
|
|
16
14
|
return desc.value;
|
|
17
15
|
};
|
|
18
16
|
}
|
|
19
|
-
|
|
20
17
|
return _get.apply(this, arguments);
|
|
21
18
|
}
|
|
@@ -2,11 +2,10 @@ import setPrototypeOf from "../setPrototypeOf/setPrototypeOf.js";
|
|
|
2
2
|
export default function _inherits(subClass, superClass) {
|
|
3
3
|
if (typeof superClass !== "function" && superClass !== null) {
|
|
4
4
|
throw new TypeError("Super expression must either be null or a function");
|
|
5
|
-
}
|
|
5
|
+
}
|
|
6
|
+
// We can't use defineProperty to set the prototype in a single step because it
|
|
6
7
|
// doesn't work in Chrome <= 36. https://github.com/babel/babel/issues/14056
|
|
7
8
|
// V8 bug: https://bugs.chromium.org/p/v8/issues/detail?id=3334
|
|
8
|
-
|
|
9
|
-
|
|
10
9
|
subClass.prototype = Object.create(superClass && superClass.prototype, {
|
|
11
10
|
constructor: {
|
|
12
11
|
value: subClass,
|
|
@@ -6,31 +6,24 @@ function _getRequireWildcardCache(nodeInterop) {
|
|
|
6
6
|
return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
|
|
7
7
|
})(nodeInterop);
|
|
8
8
|
}
|
|
9
|
-
|
|
10
9
|
export default function _interopRequireWildcard(obj, nodeInterop) {
|
|
11
10
|
if (!nodeInterop && obj && obj.__esModule) {
|
|
12
11
|
return obj;
|
|
13
12
|
}
|
|
14
|
-
|
|
15
13
|
if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
|
|
16
14
|
return {
|
|
17
15
|
default: obj
|
|
18
16
|
};
|
|
19
17
|
}
|
|
20
|
-
|
|
21
18
|
var cache = _getRequireWildcardCache(nodeInterop);
|
|
22
|
-
|
|
23
19
|
if (cache && cache.has(obj)) {
|
|
24
20
|
return cache.get(obj);
|
|
25
21
|
}
|
|
26
|
-
|
|
27
22
|
var newObj = {};
|
|
28
23
|
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
29
|
-
|
|
30
24
|
for (var key in obj) {
|
|
31
25
|
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
32
26
|
var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
|
|
33
|
-
|
|
34
27
|
if (desc && (desc.get || desc.set)) {
|
|
35
28
|
Object.defineProperty(newObj, key, desc);
|
|
36
29
|
} else {
|
|
@@ -38,12 +31,9 @@ export default function _interopRequireWildcard(obj, nodeInterop) {
|
|
|
38
31
|
}
|
|
39
32
|
}
|
|
40
33
|
}
|
|
41
|
-
|
|
42
34
|
newObj.default = obj;
|
|
43
|
-
|
|
44
35
|
if (cache) {
|
|
45
36
|
cache.set(obj, newObj);
|
|
46
37
|
}
|
|
47
|
-
|
|
48
38
|
return newObj;
|
|
49
39
|
}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
export default function isNativeReflectConstruct() {
|
|
2
|
-
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
|
|
3
|
-
|
|
4
|
-
if (Reflect.construct.sham) return false;
|
|
2
|
+
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
|
|
3
|
+
// core-js@3
|
|
4
|
+
if (Reflect.construct.sham) return false;
|
|
5
|
+
// Proxy can't be polyfilled. Every browser implemented
|
|
5
6
|
// proxies before or at the same time as Reflect.construct,
|
|
6
7
|
// so if they support Proxy they also support Reflect.construct.
|
|
7
|
-
|
|
8
|
-
|
|
8
|
+
if (typeof Proxy === "function") return true;
|
|
9
|
+
// Since Reflect.construct can't be properly polyfilled, some
|
|
9
10
|
// implementations (e.g. core-js@2) don't set the correct internal slots.
|
|
10
11
|
// Those polyfills don't allow us to subclass built-ins, so we need to
|
|
11
12
|
// use our fallback implementation.
|
|
12
|
-
|
|
13
13
|
try {
|
|
14
14
|
// If the internal slots aren't set, this throws an error similar to
|
|
15
15
|
// TypeError: this is not a Boolean object.
|
|
@@ -9,18 +9,14 @@ export default function _iterableToArrayLimit(arr, i) {
|
|
|
9
9
|
// _i = _iterator
|
|
10
10
|
// _s = _step
|
|
11
11
|
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
12
|
-
|
|
13
12
|
if (_i == null) return;
|
|
14
13
|
var _arr = [];
|
|
15
14
|
var _n = true;
|
|
16
15
|
var _d = false;
|
|
17
|
-
|
|
18
16
|
var _s, _e;
|
|
19
|
-
|
|
20
17
|
try {
|
|
21
18
|
for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) {
|
|
22
19
|
_arr.push(_s.value);
|
|
23
|
-
|
|
24
20
|
if (i && _arr.length === i) break;
|
|
25
21
|
}
|
|
26
22
|
} catch (err) {
|
|
@@ -33,6 +29,5 @@ export default function _iterableToArrayLimit(arr, i) {
|
|
|
33
29
|
if (_d) throw _e;
|
|
34
30
|
}
|
|
35
31
|
}
|
|
36
|
-
|
|
37
32
|
return _arr;
|
|
38
33
|
}
|
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
export default function (arr, i) {
|
|
2
2
|
if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return;
|
|
3
3
|
var _arr = [];
|
|
4
|
-
|
|
5
4
|
for (var _iterator = arr[Symbol.iterator](), _step; !(_step = _iterator.next()).done;) {
|
|
6
5
|
_arr.push(_step.value);
|
|
7
|
-
|
|
8
6
|
if (i && _arr.length === i) break;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
|
|
7
|
+
}
|
|
8
|
+
// eslint-disable-next-line consistent-return
|
|
12
9
|
return _arr;
|
|
13
10
|
}
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
var REACT_ELEMENT_TYPE;
|
|
2
2
|
export default function _createRawReactElement(type, props, key, children) {
|
|
3
3
|
if (!REACT_ELEMENT_TYPE) {
|
|
4
|
-
REACT_ELEMENT_TYPE = typeof Symbol === "function" &&
|
|
4
|
+
REACT_ELEMENT_TYPE = typeof Symbol === "function" &&
|
|
5
|
+
// "for" is a reserved keyword in ES3 so escaping it here for backward compatibility
|
|
5
6
|
Symbol["for"] && Symbol["for"]("react.element") || 0xeac7;
|
|
6
7
|
}
|
|
7
|
-
|
|
8
8
|
var defaultProps = type && type.defaultProps;
|
|
9
9
|
var childrenLength = arguments.length - 3;
|
|
10
|
-
|
|
11
10
|
if (!props && childrenLength !== 0) {
|
|
12
11
|
// If we're going to assign props.children, we create a new object now
|
|
13
12
|
// to avoid mutating defaultProps.
|
|
@@ -15,19 +14,15 @@ export default function _createRawReactElement(type, props, key, children) {
|
|
|
15
14
|
children: void 0
|
|
16
15
|
};
|
|
17
16
|
}
|
|
18
|
-
|
|
19
17
|
if (childrenLength === 1) {
|
|
20
18
|
props.children = children;
|
|
21
19
|
} else if (childrenLength > 1) {
|
|
22
20
|
var childArray = new Array(childrenLength);
|
|
23
|
-
|
|
24
21
|
for (var i = 0; i < childrenLength; i++) {
|
|
25
22
|
childArray[i] = arguments[i + 3];
|
|
26
23
|
}
|
|
27
|
-
|
|
28
24
|
props.children = childArray;
|
|
29
25
|
}
|
|
30
|
-
|
|
31
26
|
if (props && defaultProps) {
|
|
32
27
|
for (var propName in defaultProps) {
|
|
33
28
|
if (props[propName] === void 0) {
|
|
@@ -37,7 +32,6 @@ export default function _createRawReactElement(type, props, key, children) {
|
|
|
37
32
|
} else if (!props) {
|
|
38
33
|
props = defaultProps || {};
|
|
39
34
|
}
|
|
40
|
-
|
|
41
35
|
return {
|
|
42
36
|
$$typeof: REACT_ELEMENT_TYPE,
|
|
43
37
|
type: type,
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import arrayLikeToArray from "../arrayLikeToArray/arrayLikeToArray.js";
|
|
2
2
|
export default function _maybeArrayLike(next, arr, i) {
|
|
3
3
|
if (arr && !Array.isArray(arr) && typeof arr.length === "number") {
|
|
4
|
-
var len = arr.length;
|
|
5
|
-
|
|
4
|
+
var len = arr.length;
|
|
5
|
+
// eslint-disable-next-line no-void
|
|
6
6
|
return arrayLikeToArray(arr, i !== void 0 && i < len ? i : len);
|
|
7
7
|
}
|
|
8
|
-
|
|
9
8
|
return next(arr, i);
|
|
10
9
|
}
|
|
@@ -4,19 +4,17 @@ export default function (target) {
|
|
|
4
4
|
// eslint-disable-next-line
|
|
5
5
|
var source = arguments[i] != null ? Object(arguments[i]) : {};
|
|
6
6
|
var ownKeys = Object.keys(source);
|
|
7
|
-
|
|
8
7
|
if (typeof Object.getOwnPropertySymbols === "function") {
|
|
9
|
-
ownKeys.push.apply(ownKeys,
|
|
8
|
+
ownKeys.push.apply(ownKeys,
|
|
9
|
+
// eslint-disable-next-line no-loop-func
|
|
10
10
|
Object.getOwnPropertySymbols(source).filter(function (sym) {
|
|
11
11
|
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
12
12
|
}));
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
}
|
|
14
|
+
// eslint-disable-next-line no-loop-func
|
|
16
15
|
ownKeys.forEach(function (key) {
|
|
17
16
|
defineProperty(target, key, source[key]);
|
|
18
17
|
});
|
|
19
18
|
}
|
|
20
|
-
|
|
21
19
|
return target;
|
|
22
20
|
}
|
|
@@ -1,29 +1,25 @@
|
|
|
1
|
-
import defineProperty from "../defineProperty/defineProperty.js";
|
|
1
|
+
import defineProperty from "../defineProperty/defineProperty.js";
|
|
2
|
+
|
|
3
|
+
// This function is different to "Reflect.ownKeys". The enumerableOnly
|
|
2
4
|
// filters on symbol properties only. Returned string properties are always
|
|
3
5
|
// enumerable. It is good to use in objectSpread.
|
|
4
6
|
|
|
5
7
|
function ownKeys(object, enumerableOnly) {
|
|
6
8
|
var keys = Object.keys(object);
|
|
7
|
-
|
|
8
9
|
if (Object.getOwnPropertySymbols) {
|
|
9
10
|
var symbols = Object.getOwnPropertySymbols(object);
|
|
10
|
-
|
|
11
11
|
if (enumerableOnly) {
|
|
12
12
|
symbols = symbols.filter(function (sym) {
|
|
13
13
|
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
14
14
|
});
|
|
15
15
|
}
|
|
16
|
-
|
|
17
16
|
keys.push.apply(keys, symbols);
|
|
18
17
|
}
|
|
19
|
-
|
|
20
18
|
return keys;
|
|
21
19
|
}
|
|
22
|
-
|
|
23
20
|
export default function _objectSpread2(target) {
|
|
24
21
|
for (var i = 1; i < arguments.length; i++) {
|
|
25
22
|
var source = arguments[i] != null ? arguments[i] : {};
|
|
26
|
-
|
|
27
23
|
if (i % 2) {
|
|
28
24
|
ownKeys(Object(source), true).forEach(function (key) {
|
|
29
25
|
defineProperty(target, key, source[key]);
|
|
@@ -36,6 +32,5 @@ export default function _objectSpread2(target) {
|
|
|
36
32
|
});
|
|
37
33
|
}
|
|
38
34
|
}
|
|
39
|
-
|
|
40
35
|
return target;
|
|
41
36
|
}
|
|
@@ -4,10 +4,8 @@ export default ((source, excluded) => {
|
|
|
4
4
|
var target = objectWithoutPropertiesLoose(source, excluded);
|
|
5
5
|
var key;
|
|
6
6
|
var i;
|
|
7
|
-
|
|
8
7
|
if (Object.getOwnPropertySymbols) {
|
|
9
8
|
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
|
|
10
|
-
|
|
11
9
|
for (i = 0; i < sourceSymbolKeys.length; i++) {
|
|
12
10
|
key = sourceSymbolKeys[i];
|
|
13
11
|
if (excluded.indexOf(key) >= 0) continue;
|
|
@@ -15,6 +13,5 @@ export default ((source, excluded) => {
|
|
|
15
13
|
target[key] = source[key];
|
|
16
14
|
}
|
|
17
15
|
}
|
|
18
|
-
|
|
19
16
|
return target;
|
|
20
17
|
});
|
|
@@ -4,12 +4,10 @@ export default ((source, excluded) => {
|
|
|
4
4
|
var sourceKeys = Object.keys(source);
|
|
5
5
|
var key;
|
|
6
6
|
var i;
|
|
7
|
-
|
|
8
7
|
for (i = 0; i < sourceKeys.length; i++) {
|
|
9
8
|
key = sourceKeys[i];
|
|
10
9
|
if (excluded.indexOf(key) >= 0) continue;
|
|
11
10
|
target[key] = source[key];
|
|
12
11
|
}
|
|
13
|
-
|
|
14
12
|
return target;
|
|
15
13
|
});
|
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
import superPropBase from "../superPropBase/superPropBase.js";
|
|
2
2
|
import defineProperty from "../defineProperty/defineProperty.js";
|
|
3
|
-
|
|
4
3
|
function reflectSetPolyfill(target, property, value, receiver) {
|
|
5
4
|
var base = superPropBase(target, property);
|
|
6
5
|
var desc;
|
|
7
|
-
|
|
8
6
|
if (base) {
|
|
9
7
|
desc = Object.getOwnPropertyDescriptor(base, property);
|
|
10
|
-
|
|
11
8
|
if (desc.set) {
|
|
12
9
|
desc.set.call(receiver, value);
|
|
13
10
|
return true;
|
|
@@ -15,18 +12,15 @@ function reflectSetPolyfill(target, property, value, receiver) {
|
|
|
15
12
|
// Both getter and non-writable fall into this.
|
|
16
13
|
return false;
|
|
17
14
|
}
|
|
18
|
-
}
|
|
15
|
+
}
|
|
16
|
+
// Without a super that defines the property, spec boils down to
|
|
19
17
|
// "define on receiver" for some reason.
|
|
20
|
-
|
|
21
|
-
|
|
22
18
|
desc = Object.getOwnPropertyDescriptor(receiver, property);
|
|
23
|
-
|
|
24
19
|
if (desc) {
|
|
25
20
|
if (!desc.writable) {
|
|
26
21
|
// Setter, getter, and non-writable fall into this.
|
|
27
22
|
return false;
|
|
28
23
|
}
|
|
29
|
-
|
|
30
24
|
desc.value = value;
|
|
31
25
|
Object.defineProperty(receiver, property, desc);
|
|
32
26
|
} else {
|
|
@@ -34,18 +28,14 @@ function reflectSetPolyfill(target, property, value, receiver) {
|
|
|
34
28
|
// the instance.
|
|
35
29
|
defineProperty(receiver, property, value);
|
|
36
30
|
}
|
|
37
|
-
|
|
38
31
|
return true;
|
|
39
32
|
}
|
|
40
|
-
|
|
41
33
|
var reflectSet = typeof Reflect !== "undefined" && Reflect.set ? Reflect.set : reflectSetPolyfill;
|
|
42
34
|
export default ((target, property, value, receiver, isStrict) => {
|
|
43
35
|
// eslint-disable-next-line no-obj-calls
|
|
44
36
|
var s = reflectSet(target, property, value, receiver || target);
|
|
45
|
-
|
|
46
37
|
if (!s && isStrict) {
|
|
47
38
|
throw new Error("failed to set property");
|
|
48
39
|
}
|
|
49
|
-
|
|
50
40
|
return value;
|
|
51
41
|
});
|
|
@@ -1,14 +1,10 @@
|
|
|
1
|
-
export default function (input, hint
|
|
2
|
-
/* : "default" | "string" | "number" | void */
|
|
3
|
-
) {
|
|
1
|
+
export default function (input, hint /* : "default" | "string" | "number" | void */) {
|
|
4
2
|
if (typeof input !== "object" || input === null) return input;
|
|
5
3
|
var prim = input[Symbol.toPrimitive];
|
|
6
|
-
|
|
7
4
|
if (prim !== undefined) {
|
|
8
5
|
var res = prim.call(input, hint || "default");
|
|
9
6
|
if (typeof res !== "object") return res;
|
|
10
7
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
11
8
|
}
|
|
12
|
-
|
|
13
9
|
return (hint === "string" ? String : Number)(input);
|
|
14
10
|
}
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
const nativeTypeOf = obj => typeof obj;
|
|
2
|
-
|
|
3
2
|
const customTypeOf = obj => {
|
|
4
3
|
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
|
|
5
4
|
};
|
|
6
|
-
|
|
7
5
|
export default typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? nativeTypeOf : customTypeOf;
|
|
@@ -2,27 +2,20 @@ import getPrototypeOf from "../getPrototypeOf/getPrototypeOf.js";
|
|
|
2
2
|
import setPrototypeOf from "../setPrototypeOf/setPrototypeOf.js";
|
|
3
3
|
import isNativeFunction from "../isNativeFunction/isNativeFunction.js";
|
|
4
4
|
import construct from "../construct/construct.js";
|
|
5
|
-
|
|
6
5
|
var _cache = typeof Map === "function" ? new Map() : undefined;
|
|
7
|
-
|
|
8
6
|
export default function (Class) {
|
|
9
7
|
if (Class === null || !isNativeFunction(Class)) return Class;
|
|
10
|
-
|
|
11
8
|
if (typeof Class !== "function") {
|
|
12
9
|
throw new TypeError("Super expression must either be null or a function");
|
|
13
10
|
}
|
|
14
|
-
|
|
15
11
|
if (typeof _cache !== "undefined") {
|
|
16
12
|
if (_cache.has(Class)) return _cache.get(Class);
|
|
17
|
-
|
|
18
13
|
_cache.set(Class, Wrapper);
|
|
19
14
|
}
|
|
20
|
-
|
|
21
15
|
function Wrapper() {
|
|
22
16
|
// eslint-disable-next-line prefer-rest-params
|
|
23
17
|
return construct(Class, arguments, getPrototypeOf(this).constructor);
|
|
24
18
|
}
|
|
25
|
-
|
|
26
19
|
Wrapper.prototype = Object.create(Class.prototype, {
|
|
27
20
|
constructor: {
|
|
28
21
|
value: Wrapper,
|
|
@@ -4,64 +4,50 @@ export default function _wrapRegExp() {
|
|
|
4
4
|
_wrapRegExp = function (re, groups) {
|
|
5
5
|
return new BabelRegExp(re, undefined, groups);
|
|
6
6
|
};
|
|
7
|
-
|
|
8
7
|
var _super = RegExp.prototype;
|
|
9
|
-
|
|
10
8
|
var _groups = new WeakMap();
|
|
11
|
-
|
|
12
9
|
function BabelRegExp(re, flags, groups) {
|
|
13
|
-
var _this = new RegExp(re, flags);
|
|
14
|
-
|
|
15
|
-
|
|
10
|
+
var _this = new RegExp(re, flags);
|
|
11
|
+
// if the regex is recreated with 'g' flag
|
|
16
12
|
_groups.set(_this, groups || _groups.get(re));
|
|
17
|
-
|
|
18
13
|
return setPrototypeOf(_this, BabelRegExp.prototype);
|
|
19
14
|
}
|
|
20
|
-
|
|
21
15
|
inherits(BabelRegExp, RegExp);
|
|
22
|
-
|
|
23
16
|
BabelRegExp.prototype.exec = function (str) {
|
|
24
17
|
var result = _super.exec.call(this, str);
|
|
25
|
-
|
|
26
18
|
if (result) result.groups = buildGroups(result, this);
|
|
27
19
|
return result;
|
|
28
20
|
};
|
|
29
|
-
|
|
30
21
|
BabelRegExp.prototype[Symbol.replace] = function (str, substitution) {
|
|
31
22
|
if (typeof substitution === "string") {
|
|
32
23
|
var groups = _groups.get(this);
|
|
33
|
-
|
|
34
24
|
return _super[Symbol.replace].call(this, str, substitution.replace(/\$<([^>]+)>/g, function (_, name) {
|
|
35
25
|
return "$" + groups[name];
|
|
36
26
|
}));
|
|
37
27
|
} else if (typeof substitution === "function") {
|
|
38
28
|
var _this = this;
|
|
39
|
-
|
|
40
29
|
return _super[Symbol.replace].call(this, str, function () {
|
|
41
|
-
var args = arguments;
|
|
42
|
-
|
|
30
|
+
var args = arguments;
|
|
31
|
+
// Modern engines already pass result.groups returned by exec() as the last arg.
|
|
43
32
|
if (typeof args[args.length - 1] !== "object") {
|
|
44
33
|
args = [].slice.call(args);
|
|
45
34
|
args.push(buildGroups(args, _this));
|
|
46
35
|
}
|
|
47
|
-
|
|
48
36
|
return substitution.apply(this, args);
|
|
49
37
|
});
|
|
50
38
|
} else {
|
|
51
39
|
return _super[Symbol.replace].call(this, str, substitution);
|
|
52
40
|
}
|
|
53
41
|
};
|
|
54
|
-
|
|
55
42
|
function buildGroups(result, re) {
|
|
56
43
|
// NOTE: This function should return undefined if there are no groups,
|
|
57
44
|
// but in that case Babel doesn't add the wrapper anyway.
|
|
58
|
-
var g = _groups.get(re);
|
|
59
45
|
|
|
46
|
+
var g = _groups.get(re);
|
|
60
47
|
return Object.keys(g).reduce(function (groups, name) {
|
|
61
48
|
groups[name] = result[g[name]];
|
|
62
49
|
return groups;
|
|
63
50
|
}, Object.create(null));
|
|
64
51
|
}
|
|
65
|
-
|
|
66
52
|
return _wrapRegExp.apply(this, arguments);
|
|
67
53
|
}
|
|
@@ -15,12 +15,9 @@ const ACTIONS_AVAILABLE = {
|
|
|
15
15
|
fileURLToPath
|
|
16
16
|
} = await import("node:url");
|
|
17
17
|
const filePath = fileURLToPath(fileUrl);
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
18
|
+
const require = createRequire(fileUrl);
|
|
19
|
+
// eslint-disable-next-line import/no-dynamic-require
|
|
22
20
|
const namespace = require(filePath);
|
|
23
|
-
|
|
24
21
|
const namespaceResolved = {};
|
|
25
22
|
await Promise.all(Object.keys(namespace).map(async key => {
|
|
26
23
|
const value = await namespace[key];
|
|
@@ -33,13 +30,12 @@ const ACTION_REQUEST_EVENT_NAME = "action";
|
|
|
33
30
|
const ACTION_RESPONSE_EVENT_NAME = "action-result";
|
|
34
31
|
const ACTION_RESPONSE_STATUS_FAILED = "action-failed";
|
|
35
32
|
const ACTION_RESPONSE_STATUS_COMPLETED = "action-completed";
|
|
36
|
-
|
|
37
33
|
const sendActionFailed = error => {
|
|
38
34
|
if (error.hasOwnProperty("toString")) {
|
|
39
35
|
delete error.toString;
|
|
40
36
|
}
|
|
41
|
-
|
|
42
|
-
|
|
37
|
+
sendToParent(ACTION_RESPONSE_EVENT_NAME,
|
|
38
|
+
// process.send algorithm does not send non enumerable values
|
|
43
39
|
// so use @jsenv/uneval
|
|
44
40
|
uneval({
|
|
45
41
|
status: ACTION_RESPONSE_STATUS_FAILED,
|
|
@@ -48,9 +44,9 @@ const sendActionFailed = error => {
|
|
|
48
44
|
ignoreSymbols: true
|
|
49
45
|
}));
|
|
50
46
|
};
|
|
51
|
-
|
|
52
47
|
const sendActionCompleted = value => {
|
|
53
|
-
sendToParent(ACTION_RESPONSE_EVENT_NAME,
|
|
48
|
+
sendToParent(ACTION_RESPONSE_EVENT_NAME,
|
|
49
|
+
// here we use JSON.stringify because we should not
|
|
54
50
|
// have non enumerable value (unlike there is on Error objects)
|
|
55
51
|
// otherwise uneval is quite slow to turn a giant object
|
|
56
52
|
// into a string (and value can be giant when using coverage)
|
|
@@ -59,76 +55,70 @@ const sendActionCompleted = value => {
|
|
|
59
55
|
value
|
|
60
56
|
}));
|
|
61
57
|
};
|
|
62
|
-
|
|
63
58
|
const sendToParent = (type, data) => {
|
|
64
59
|
// https://nodejs.org/api/process.html#process_process_connected
|
|
65
60
|
// not connected anymore, cannot communicate with parent
|
|
66
61
|
if (!process.connected) {
|
|
67
62
|
return;
|
|
68
|
-
}
|
|
63
|
+
}
|
|
64
|
+
// this can keep process alive longer than expected
|
|
69
65
|
// when source is a long string.
|
|
70
66
|
// It means node process may stay alive longer than expected
|
|
71
67
|
// the time to send the data to the parent.
|
|
72
|
-
|
|
73
|
-
|
|
74
68
|
process.send({
|
|
75
69
|
jsenv: true,
|
|
76
70
|
type,
|
|
77
71
|
data
|
|
78
72
|
});
|
|
79
73
|
};
|
|
80
|
-
|
|
81
74
|
const onceParentMessage = (type, callback) => {
|
|
82
75
|
const listener = message => {
|
|
83
76
|
if (message && message.jsenv && message.type === type) {
|
|
84
77
|
removeListener(); // commenting this line keep this process alive
|
|
85
|
-
|
|
86
78
|
callback(message.data);
|
|
87
79
|
}
|
|
88
80
|
};
|
|
89
|
-
|
|
90
81
|
const removeListener = () => {
|
|
91
82
|
process.removeListener("message", listener);
|
|
92
83
|
};
|
|
93
|
-
|
|
94
84
|
process.on("message", listener);
|
|
95
85
|
return removeListener;
|
|
96
86
|
};
|
|
97
|
-
|
|
98
87
|
const removeActionRequestListener = onceParentMessage(ACTION_REQUEST_EVENT_NAME, async ({
|
|
99
88
|
actionType,
|
|
100
89
|
actionParams
|
|
101
90
|
}) => {
|
|
102
91
|
const action = ACTIONS_AVAILABLE[actionType];
|
|
103
|
-
|
|
104
92
|
if (!action) {
|
|
105
93
|
sendActionFailed(new Error(`unknown action ${actionType}`));
|
|
106
94
|
return;
|
|
107
95
|
}
|
|
108
|
-
|
|
109
96
|
let value;
|
|
110
97
|
let failed = false;
|
|
111
|
-
|
|
112
98
|
try {
|
|
113
99
|
value = await action(actionParams);
|
|
114
100
|
} catch (e) {
|
|
115
101
|
failed = true;
|
|
116
102
|
value = e;
|
|
117
|
-
}
|
|
103
|
+
}
|
|
118
104
|
|
|
105
|
+
// setTimeout(() => {}, 100)
|
|
119
106
|
|
|
120
107
|
if (failed) {
|
|
121
108
|
sendActionFailed(value);
|
|
122
109
|
} else {
|
|
123
110
|
sendActionCompleted(value);
|
|
124
|
-
}
|
|
125
|
-
|
|
111
|
+
}
|
|
126
112
|
|
|
113
|
+
// removeActionRequestListener()
|
|
127
114
|
if (actionParams.exitAfterAction) {
|
|
128
|
-
removeActionRequestListener();
|
|
115
|
+
removeActionRequestListener();
|
|
116
|
+
// for some reason this fixes v8 coverage directory sometimes empty on Ubuntu
|
|
129
117
|
// process.exit()
|
|
130
118
|
}
|
|
131
|
-
});
|
|
119
|
+
});
|
|
120
|
+
|
|
121
|
+
// remove listener to process.on('message')
|
|
132
122
|
// which is sufficient to let child process die
|
|
133
123
|
// assuming nothing else keeps it alive
|
|
134
124
|
// process.once("SIGTERM", removeActionRequestListener)
|