@parcel/packager-js 2.0.0-nightly.1355 → 2.0.0-nightly.1357
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/lib/ScopeHoistingPackager.js +6 -2
- package/lib/helpers.js +39 -21
- package/package.json +8 -7
- package/src/ScopeHoistingPackager.js +6 -2
- package/src/helpers.js +46 -23
|
@@ -882,9 +882,13 @@ ${code}
|
|
|
882
882
|
this.usedHelpers.add('$parcel$global');
|
|
883
883
|
}
|
|
884
884
|
for (let helper of this.usedHelpers) {
|
|
885
|
-
|
|
885
|
+
let currentHelper = _helpers.helpers[helper];
|
|
886
|
+
if (typeof currentHelper === 'function') {
|
|
887
|
+
currentHelper = _helpers.helpers[helper](this.bundle.env);
|
|
888
|
+
}
|
|
889
|
+
res += currentHelper;
|
|
886
890
|
if (enableSourceMaps) {
|
|
887
|
-
lines += (0, _utils().countLines)(
|
|
891
|
+
lines += (0, _utils().countLines)(currentHelper) - 1;
|
|
888
892
|
}
|
|
889
893
|
}
|
|
890
894
|
if (this.needsPrelude) {
|
package/lib/helpers.js
CHANGED
|
@@ -4,7 +4,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.prelude = exports.helpers = void 0;
|
|
7
|
-
const prelude = parcelRequireName => `
|
|
7
|
+
const prelude = parcelRequireName => `
|
|
8
|
+
var $parcel$modules = {};
|
|
8
9
|
var $parcel$inits = {};
|
|
9
10
|
|
|
10
11
|
var parcelRequire = $parcel$global[${JSON.stringify(parcelRequireName)}];
|
|
@@ -34,12 +35,13 @@ if (parcelRequire == null) {
|
|
|
34
35
|
}
|
|
35
36
|
`;
|
|
36
37
|
exports.prelude = prelude;
|
|
37
|
-
const
|
|
38
|
-
|
|
38
|
+
const $parcel$export = `
|
|
39
|
+
function $parcel$export(e, n, v, s) {
|
|
39
40
|
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
40
41
|
}
|
|
41
|
-
|
|
42
|
-
|
|
42
|
+
`;
|
|
43
|
+
const $parcel$exportWildcard = `
|
|
44
|
+
function $parcel$exportWildcard(dest, source) {
|
|
43
45
|
Object.keys(source).forEach(function(key) {
|
|
44
46
|
if (key === 'default' || key === '__esModule' || dest.hasOwnProperty(key)) {
|
|
45
47
|
return;
|
|
@@ -55,25 +57,41 @@ const helpers = {
|
|
|
55
57
|
|
|
56
58
|
return dest;
|
|
57
59
|
}
|
|
58
|
-
|
|
59
|
-
|
|
60
|
+
`;
|
|
61
|
+
const $parcel$interopDefault = `
|
|
62
|
+
function $parcel$interopDefault(a) {
|
|
60
63
|
return a && a.__esModule ? a.default : a;
|
|
61
64
|
}
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
65
|
+
`;
|
|
66
|
+
const $parcel$global = env => {
|
|
67
|
+
if (env.supports('global-this')) {
|
|
68
|
+
return `
|
|
69
|
+
var $parcel$global = globalThis;
|
|
70
|
+
`;
|
|
71
|
+
}
|
|
72
|
+
return `
|
|
73
|
+
var $parcel$global =
|
|
74
|
+
typeof globalThis !== 'undefined'
|
|
75
|
+
? globalThis
|
|
76
|
+
: typeof self !== 'undefined'
|
|
77
|
+
? self
|
|
78
|
+
: typeof window !== 'undefined'
|
|
79
|
+
? window
|
|
80
|
+
: typeof global !== 'undefined'
|
|
81
|
+
? global
|
|
82
|
+
: {};
|
|
83
|
+
`;
|
|
84
|
+
};
|
|
85
|
+
const $parcel$defineInteropFlag = `
|
|
86
|
+
function $parcel$defineInteropFlag(a) {
|
|
75
87
|
Object.defineProperty(a, '__esModule', {value: true, configurable: true});
|
|
76
88
|
}
|
|
77
|
-
|
|
89
|
+
`;
|
|
90
|
+
const helpers = {
|
|
91
|
+
$parcel$export,
|
|
92
|
+
$parcel$exportWildcard,
|
|
93
|
+
$parcel$interopDefault,
|
|
94
|
+
$parcel$global,
|
|
95
|
+
$parcel$defineInteropFlag
|
|
78
96
|
};
|
|
79
97
|
exports.helpers = helpers;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@parcel/packager-js",
|
|
3
|
-
"version": "2.0.0-nightly.
|
|
3
|
+
"version": "2.0.0-nightly.1357+feae29eba",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -17,16 +17,17 @@
|
|
|
17
17
|
"source": "src/index.js",
|
|
18
18
|
"engines": {
|
|
19
19
|
"node": ">= 12.0.0",
|
|
20
|
-
"parcel": "2.0.0-nightly.
|
|
20
|
+
"parcel": "2.0.0-nightly.1355+feae29eba"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@parcel/diagnostic": "2.0.0-nightly.
|
|
24
|
-
"@parcel/hash": "2.9.4-nightly.
|
|
25
|
-
"@parcel/plugin": "2.0.0-nightly.
|
|
23
|
+
"@parcel/diagnostic": "2.0.0-nightly.1357+feae29eba",
|
|
24
|
+
"@parcel/hash": "2.9.4-nightly.2980+feae29eba",
|
|
25
|
+
"@parcel/plugin": "2.0.0-nightly.1357+feae29eba",
|
|
26
26
|
"@parcel/source-map": "^2.1.1",
|
|
27
|
-
"@parcel/
|
|
27
|
+
"@parcel/types": "2.0.0-nightly.1357+feae29eba",
|
|
28
|
+
"@parcel/utils": "2.0.0-nightly.1357+feae29eba",
|
|
28
29
|
"globals": "^13.2.0",
|
|
29
30
|
"nullthrows": "^1.1.1"
|
|
30
31
|
},
|
|
31
|
-
"gitHead": "
|
|
32
|
+
"gitHead": "feae29ebaebcc79f624c87c386de8137970835b0"
|
|
32
33
|
}
|
|
@@ -1170,9 +1170,13 @@ ${code}
|
|
|
1170
1170
|
}
|
|
1171
1171
|
|
|
1172
1172
|
for (let helper of this.usedHelpers) {
|
|
1173
|
-
|
|
1173
|
+
let currentHelper = helpers[helper];
|
|
1174
|
+
if (typeof currentHelper === 'function') {
|
|
1175
|
+
currentHelper = helpers[helper](this.bundle.env);
|
|
1176
|
+
}
|
|
1177
|
+
res += currentHelper;
|
|
1174
1178
|
if (enableSourceMaps) {
|
|
1175
|
-
lines += countLines(
|
|
1179
|
+
lines += countLines(currentHelper) - 1;
|
|
1176
1180
|
}
|
|
1177
1181
|
}
|
|
1178
1182
|
|
package/src/helpers.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
// @flow strict-local
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
): string => `
|
|
2
|
+
import type {Environment} from '@parcel/types';
|
|
3
|
+
|
|
4
|
+
export const prelude = (parcelRequireName: string): string => `
|
|
5
|
+
var $parcel$modules = {};
|
|
5
6
|
var $parcel$inits = {};
|
|
6
7
|
|
|
7
8
|
var parcelRequire = $parcel$global[${JSON.stringify(parcelRequireName)}];
|
|
@@ -31,12 +32,14 @@ if (parcelRequire == null) {
|
|
|
31
32
|
}
|
|
32
33
|
`;
|
|
33
34
|
|
|
34
|
-
|
|
35
|
-
|
|
35
|
+
const $parcel$export = `
|
|
36
|
+
function $parcel$export(e, n, v, s) {
|
|
36
37
|
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
37
38
|
}
|
|
38
|
-
|
|
39
|
-
|
|
39
|
+
`;
|
|
40
|
+
|
|
41
|
+
const $parcel$exportWildcard = `
|
|
42
|
+
function $parcel$exportWildcard(dest, source) {
|
|
40
43
|
Object.keys(source).forEach(function(key) {
|
|
41
44
|
if (key === 'default' || key === '__esModule' || dest.hasOwnProperty(key)) {
|
|
42
45
|
return;
|
|
@@ -52,24 +55,44 @@ export const helpers = {
|
|
|
52
55
|
|
|
53
56
|
return dest;
|
|
54
57
|
}
|
|
55
|
-
|
|
56
|
-
|
|
58
|
+
`;
|
|
59
|
+
|
|
60
|
+
const $parcel$interopDefault = `
|
|
61
|
+
function $parcel$interopDefault(a) {
|
|
57
62
|
return a && a.__esModule ? a.default : a;
|
|
58
63
|
}
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
64
|
+
`;
|
|
65
|
+
|
|
66
|
+
const $parcel$global = (env: Environment): string => {
|
|
67
|
+
if (env.supports('global-this')) {
|
|
68
|
+
return `
|
|
69
|
+
var $parcel$global = globalThis;
|
|
70
|
+
`;
|
|
71
|
+
}
|
|
72
|
+
return `
|
|
73
|
+
var $parcel$global =
|
|
74
|
+
typeof globalThis !== 'undefined'
|
|
75
|
+
? globalThis
|
|
76
|
+
: typeof self !== 'undefined'
|
|
77
|
+
? self
|
|
78
|
+
: typeof window !== 'undefined'
|
|
79
|
+
? window
|
|
80
|
+
: typeof global !== 'undefined'
|
|
81
|
+
? global
|
|
82
|
+
: {};
|
|
83
|
+
`;
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
const $parcel$defineInteropFlag = `
|
|
87
|
+
function $parcel$defineInteropFlag(a) {
|
|
72
88
|
Object.defineProperty(a, '__esModule', {value: true, configurable: true});
|
|
73
89
|
}
|
|
74
|
-
|
|
90
|
+
`;
|
|
91
|
+
|
|
92
|
+
export const helpers = {
|
|
93
|
+
$parcel$export,
|
|
94
|
+
$parcel$exportWildcard,
|
|
95
|
+
$parcel$interopDefault,
|
|
96
|
+
$parcel$global,
|
|
97
|
+
$parcel$defineInteropFlag,
|
|
75
98
|
};
|