@jsenv/plugin-transpilation 1.3.2 → 1.3.4
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 +10 -10
- package/src/babel/babel_helper_directory/README.md +1 -1
- package/src/babel/babel_helper_directory/babel_helpers/applyDecs2305/applyDecs2305.js +39 -10
- package/src/babel/babel_helper_directory/babel_helpers/dispose/dispose.js +45 -0
- package/src/babel/babel_helper_directory/babel_helpers/importDeferProxy/importDeferProxy.js +31 -0
- package/src/babel/babel_helper_directory/babel_helpers/nullishReceiverError/nullishReceiverError.js +3 -0
- package/src/babel/babel_helper_directory/babel_helpers/regeneratorRuntime/regeneratorRuntime.js +2 -6
- package/src/babel/babel_helper_directory/babel_helpers/using/using.js +23 -0
- package/src/js_module_fallback/jsenv_plugin_js_module_fallback_on_workers.js +4 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jsenv/plugin-transpilation",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.4",
|
|
4
4
|
"description": "TODO",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -31,20 +31,20 @@
|
|
|
31
31
|
"@babel/plugin-syntax-optional-catch-binding": "7.8.3",
|
|
32
32
|
"@babel/plugin-transform-arrow-functions": "7.22.5",
|
|
33
33
|
"@babel/plugin-transform-block-scoped-functions": "7.22.5",
|
|
34
|
-
"@babel/plugin-transform-block-scoping": "7.
|
|
35
|
-
"@babel/plugin-transform-classes": "7.22.
|
|
34
|
+
"@babel/plugin-transform-block-scoping": "7.23.0",
|
|
35
|
+
"@babel/plugin-transform-classes": "7.22.15",
|
|
36
36
|
"@babel/plugin-transform-computed-properties": "7.22.5",
|
|
37
|
-
"@babel/plugin-transform-destructuring": "7.
|
|
37
|
+
"@babel/plugin-transform-destructuring": "7.23.0",
|
|
38
38
|
"@babel/plugin-transform-dotall-regex": "7.22.5",
|
|
39
39
|
"@babel/plugin-transform-duplicate-keys": "7.22.5",
|
|
40
40
|
"@babel/plugin-transform-exponentiation-operator": "7.22.5",
|
|
41
|
-
"@babel/plugin-transform-for-of": "7.22.
|
|
41
|
+
"@babel/plugin-transform-for-of": "7.22.15",
|
|
42
42
|
"@babel/plugin-transform-function-name": "7.22.5",
|
|
43
43
|
"@babel/plugin-transform-literals": "7.22.5",
|
|
44
44
|
"@babel/plugin-transform-new-target": "7.22.5",
|
|
45
45
|
"@babel/plugin-transform-object-super": "7.22.5",
|
|
46
|
-
"@babel/plugin-transform-parameters": "7.22.
|
|
47
|
-
"@babel/plugin-transform-regenerator": "7.22.
|
|
46
|
+
"@babel/plugin-transform-parameters": "7.22.15",
|
|
47
|
+
"@babel/plugin-transform-regenerator": "7.22.10",
|
|
48
48
|
"@babel/plugin-transform-shorthand-properties": "7.22.5",
|
|
49
49
|
"@babel/plugin-transform-spread": "7.22.5",
|
|
50
50
|
"@babel/plugin-transform-sticky-regex": "7.22.5",
|
|
@@ -53,9 +53,9 @@
|
|
|
53
53
|
"@babel/plugin-transform-unicode-regex": "7.22.5",
|
|
54
54
|
"babel-plugin-transform-async-to-promises": "0.8.18",
|
|
55
55
|
"construct-style-sheets-polyfill": "3.1.0",
|
|
56
|
-
"@jsenv/ast": "5.1.
|
|
56
|
+
"@jsenv/ast": "5.1.4",
|
|
57
57
|
"@jsenv/runtime-compat": "1.2.0",
|
|
58
|
-
"@jsenv/js-module-fallback": "1.3.
|
|
59
|
-
"lightningcss": "1.
|
|
58
|
+
"@jsenv/js-module-fallback": "1.3.5",
|
|
59
|
+
"lightningcss": "1.22.0"
|
|
60
60
|
}
|
|
61
61
|
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Babel helpers are copied in there to properly appear in sourcemap.
|
|
4
4
|
|
|
5
|
-
- Last sync date:
|
|
5
|
+
- Last sync date: 29 September 2023
|
|
6
6
|
|
|
7
7
|
- Helpers file: https://github.com/babel/babel/blob/main/packages/babel-helpers/src/helpers.ts
|
|
8
8
|
- Individual helpers: https://github.com/babel/babel/tree/main/packages/babel-helpers/src/helpers
|
|
@@ -45,7 +45,8 @@ function memberDec(
|
|
|
45
45
|
isStatic,
|
|
46
46
|
isPrivate,
|
|
47
47
|
value,
|
|
48
|
-
hasPrivateBrand
|
|
48
|
+
hasPrivateBrand,
|
|
49
|
+
metadata
|
|
49
50
|
) {
|
|
50
51
|
var kindStr;
|
|
51
52
|
|
|
@@ -71,6 +72,7 @@ function memberDec(
|
|
|
71
72
|
name: isPrivate ? "#" + name : name,
|
|
72
73
|
static: isStatic,
|
|
73
74
|
private: isPrivate,
|
|
75
|
+
metadata: metadata,
|
|
74
76
|
};
|
|
75
77
|
|
|
76
78
|
var decoratorFinishedRef = { v: false };
|
|
@@ -211,7 +213,8 @@ function applyMemberDec(
|
|
|
211
213
|
isStatic,
|
|
212
214
|
isPrivate,
|
|
213
215
|
initializers,
|
|
214
|
-
hasPrivateBrand
|
|
216
|
+
hasPrivateBrand,
|
|
217
|
+
metadata
|
|
215
218
|
) {
|
|
216
219
|
var decs = decInfo[0];
|
|
217
220
|
|
|
@@ -276,7 +279,8 @@ function applyMemberDec(
|
|
|
276
279
|
isStatic,
|
|
277
280
|
isPrivate,
|
|
278
281
|
value,
|
|
279
|
-
hasPrivateBrand
|
|
282
|
+
hasPrivateBrand,
|
|
283
|
+
metadata
|
|
280
284
|
);
|
|
281
285
|
|
|
282
286
|
if (newValue !== void 0) {
|
|
@@ -369,7 +373,7 @@ function applyMemberDec(
|
|
|
369
373
|
}
|
|
370
374
|
}
|
|
371
375
|
|
|
372
|
-
function applyMemberDecs(Class, decInfos, instanceBrand) {
|
|
376
|
+
function applyMemberDecs(Class, decInfos, instanceBrand, metadata) {
|
|
373
377
|
var ret = [];
|
|
374
378
|
var protoInitializers;
|
|
375
379
|
var staticInitializers;
|
|
@@ -451,7 +455,8 @@ function applyMemberDecs(Class, decInfos, instanceBrand) {
|
|
|
451
455
|
isStatic,
|
|
452
456
|
isPrivate,
|
|
453
457
|
initializers,
|
|
454
|
-
hasPrivateBrand
|
|
458
|
+
hasPrivateBrand,
|
|
459
|
+
metadata
|
|
455
460
|
);
|
|
456
461
|
}
|
|
457
462
|
|
|
@@ -471,7 +476,7 @@ function pushInitializers(ret, initializers) {
|
|
|
471
476
|
}
|
|
472
477
|
}
|
|
473
478
|
|
|
474
|
-
function applyClassDecs(targetClass, classDecs, decoratorsHaveThis) {
|
|
479
|
+
function applyClassDecs(targetClass, classDecs, decoratorsHaveThis, metadata) {
|
|
475
480
|
if (classDecs.length) {
|
|
476
481
|
var initializers = [];
|
|
477
482
|
var newClass = targetClass;
|
|
@@ -493,6 +498,7 @@ function applyClassDecs(targetClass, classDecs, decoratorsHaveThis) {
|
|
|
493
498
|
initializers,
|
|
494
499
|
decoratorFinishedRef
|
|
495
500
|
),
|
|
501
|
+
metadata,
|
|
496
502
|
}
|
|
497
503
|
);
|
|
498
504
|
} finally {
|
|
@@ -506,7 +512,7 @@ function applyClassDecs(targetClass, classDecs, decoratorsHaveThis) {
|
|
|
506
512
|
}
|
|
507
513
|
|
|
508
514
|
return [
|
|
509
|
-
newClass,
|
|
515
|
+
defineMetadata(newClass, metadata),
|
|
510
516
|
function () {
|
|
511
517
|
for (var i = 0; i < initializers.length; i++) {
|
|
512
518
|
initializers[i].call(newClass);
|
|
@@ -518,6 +524,14 @@ function applyClassDecs(targetClass, classDecs, decoratorsHaveThis) {
|
|
|
518
524
|
// so we don't have to return an empty array here.
|
|
519
525
|
}
|
|
520
526
|
|
|
527
|
+
function defineMetadata(Class, metadata) {
|
|
528
|
+
return Object.defineProperty(
|
|
529
|
+
Class,
|
|
530
|
+
Symbol.metadata || Symbol.for("Symbol.metadata"),
|
|
531
|
+
{ configurable: true, enumerable: true, value: metadata }
|
|
532
|
+
);
|
|
533
|
+
}
|
|
534
|
+
|
|
521
535
|
/**
|
|
522
536
|
Basic usage:
|
|
523
537
|
|
|
@@ -669,13 +683,28 @@ export default function applyDecs2305(
|
|
|
669
683
|
memberDecs,
|
|
670
684
|
classDecs,
|
|
671
685
|
classDecsHaveThis,
|
|
672
|
-
instanceBrand
|
|
686
|
+
instanceBrand,
|
|
687
|
+
parentClass
|
|
673
688
|
) {
|
|
689
|
+
if (arguments.length >= 6) {
|
|
690
|
+
var parentMetadata =
|
|
691
|
+
parentClass[Symbol.metadata || Symbol.for("Symbol.metadata")];
|
|
692
|
+
}
|
|
693
|
+
var metadata = Object.create(
|
|
694
|
+
parentMetadata === void 0 ? null : parentMetadata
|
|
695
|
+
);
|
|
696
|
+
var e = applyMemberDecs(targetClass, memberDecs, instanceBrand, metadata);
|
|
697
|
+
if (!classDecs.length) defineMetadata(targetClass, metadata);
|
|
674
698
|
return {
|
|
675
|
-
e:
|
|
699
|
+
e: e,
|
|
676
700
|
// Lazily apply class decorations so that member init locals can be properly bound.
|
|
677
701
|
get c() {
|
|
678
|
-
return applyClassDecs(
|
|
702
|
+
return applyClassDecs(
|
|
703
|
+
targetClass,
|
|
704
|
+
classDecs,
|
|
705
|
+
classDecsHaveThis,
|
|
706
|
+
metadata
|
|
707
|
+
);
|
|
679
708
|
},
|
|
680
709
|
};
|
|
681
710
|
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/* @minVersion 7.22.0 */
|
|
2
|
+
function dispose_SuppressedError(suppressed, error) {
|
|
3
|
+
if (typeof SuppressedError !== "undefined") {
|
|
4
|
+
// eslint-disable-next-line no-undef
|
|
5
|
+
dispose_SuppressedError = SuppressedError;
|
|
6
|
+
} else {
|
|
7
|
+
dispose_SuppressedError = function SuppressedError(suppressed, error) {
|
|
8
|
+
this.suppressed = suppressed;
|
|
9
|
+
this.error = error;
|
|
10
|
+
this.stack = new Error().stack;
|
|
11
|
+
};
|
|
12
|
+
dispose_SuppressedError.prototype = Object.create(Error.prototype, {
|
|
13
|
+
constructor: {
|
|
14
|
+
value: dispose_SuppressedError,
|
|
15
|
+
writable: true,
|
|
16
|
+
configurable: true,
|
|
17
|
+
},
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
return new dispose_SuppressedError(suppressed, error);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export default function _dispose(stack, error, hasError) {
|
|
24
|
+
function next() {
|
|
25
|
+
while (stack.length > 0) {
|
|
26
|
+
try {
|
|
27
|
+
var r = stack.pop();
|
|
28
|
+
var p = r.d.call(r.v);
|
|
29
|
+
if (r.a) return Promise.resolve(p).then(next, err);
|
|
30
|
+
} catch (e) {
|
|
31
|
+
return err(e);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
if (hasError) throw error;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
function err(e) {
|
|
38
|
+
error = hasError ? new dispose_SuppressedError(e, error) : e;
|
|
39
|
+
hasError = true;
|
|
40
|
+
|
|
41
|
+
return next();
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
return next();
|
|
45
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/* @minVersion 7.23.0 */
|
|
2
|
+
export default function _importDeferProxy(init) {
|
|
3
|
+
var ns = null;
|
|
4
|
+
var constValue = function (v) {
|
|
5
|
+
return function () {
|
|
6
|
+
return v;
|
|
7
|
+
};
|
|
8
|
+
};
|
|
9
|
+
var proxy = function (run) {
|
|
10
|
+
return function (arg1, arg2, arg3) {
|
|
11
|
+
if (ns === null) ns = init();
|
|
12
|
+
return run(ns, arg2, arg3);
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
return new Proxy(
|
|
16
|
+
{},
|
|
17
|
+
{
|
|
18
|
+
defineProperty: constValue(false),
|
|
19
|
+
deleteProperty: constValue(false),
|
|
20
|
+
get: proxy(Reflect.get),
|
|
21
|
+
getOwnPropertyDescriptor: proxy(Reflect.getOwnPropertyDescriptor),
|
|
22
|
+
getPrototypeOf: constValue(null),
|
|
23
|
+
isExtensible: constValue(false),
|
|
24
|
+
has: proxy(Reflect.has),
|
|
25
|
+
ownKeys: proxy(Reflect.ownKeys),
|
|
26
|
+
preventExtensions: constValue(true),
|
|
27
|
+
set: constValue(false),
|
|
28
|
+
setPrototypeOf: constValue(false),
|
|
29
|
+
}
|
|
30
|
+
);
|
|
31
|
+
}
|
package/src/babel/babel_helper_directory/babel_helpers/regeneratorRuntime/regeneratorRuntime.js
CHANGED
|
@@ -483,7 +483,7 @@ export default function _regeneratorRuntime() {
|
|
|
483
483
|
};
|
|
484
484
|
};
|
|
485
485
|
function values(iterable) {
|
|
486
|
-
if (iterable) {
|
|
486
|
+
if (iterable || iterable === "") {
|
|
487
487
|
var iteratorMethod = iterable[iteratorSymbol];
|
|
488
488
|
if (iteratorMethod) {
|
|
489
489
|
return iteratorMethod.call(iterable);
|
|
@@ -508,11 +508,7 @@ export default function _regeneratorRuntime() {
|
|
|
508
508
|
return (next.next = next);
|
|
509
509
|
}
|
|
510
510
|
}
|
|
511
|
-
|
|
512
|
-
// Return an iterator with no values.
|
|
513
|
-
return {
|
|
514
|
-
next: doneResult,
|
|
515
|
-
};
|
|
511
|
+
throw new TypeError(typeof iterable + " is not iterable");
|
|
516
512
|
}
|
|
517
513
|
exports.values = values;
|
|
518
514
|
function doneResult() {
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/* @minVersion 7.22.0 */
|
|
2
|
+
|
|
3
|
+
export default function _using(stack, value, isAwait) {
|
|
4
|
+
if (value === null || value === void 0) return value;
|
|
5
|
+
if (typeof value !== "object") {
|
|
6
|
+
throw new TypeError(
|
|
7
|
+
"using declarations can only be used with objects, null, or undefined."
|
|
8
|
+
);
|
|
9
|
+
}
|
|
10
|
+
// core-js-pure uses Symbol.for for polyfilling well-known symbols
|
|
11
|
+
if (isAwait) {
|
|
12
|
+
var dispose =
|
|
13
|
+
value[Symbol.asyncDispose || Symbol.for("Symbol.asyncDispose")];
|
|
14
|
+
}
|
|
15
|
+
if (dispose === null || dispose === void 0) {
|
|
16
|
+
dispose = value[Symbol.dispose || Symbol.for("Symbol.dispose")];
|
|
17
|
+
}
|
|
18
|
+
if (typeof dispose !== "function") {
|
|
19
|
+
throw new TypeError(`Property [Symbol.dispose] is not a function.`);
|
|
20
|
+
}
|
|
21
|
+
stack.push({ v: value, d: dispose, a: isAwait });
|
|
22
|
+
return value;
|
|
23
|
+
}
|
|
@@ -31,9 +31,13 @@ export const jsenvPluginJsModuleFallbackOnWorkers = () => {
|
|
|
31
31
|
name: `jsenv:js_module_fallback_on_${subtype}`,
|
|
32
32
|
appliesDuring: "*",
|
|
33
33
|
init: (context) => {
|
|
34
|
+
if (Object.keys(context.runtimeCompat).toString() === "node") {
|
|
35
|
+
return false;
|
|
36
|
+
}
|
|
34
37
|
if (context.isSupportedOnCurrentClients(`${subtype}_type_module`)) {
|
|
35
38
|
return false;
|
|
36
39
|
}
|
|
40
|
+
|
|
37
41
|
return true;
|
|
38
42
|
},
|
|
39
43
|
redirectReference: {
|