@parcel/packager-js 2.0.0 → 2.0.1
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.
|
@@ -555,7 +555,7 @@ ${code}
|
|
|
555
555
|
if (imported === '*') {
|
|
556
556
|
replacement = renamed;
|
|
557
557
|
} else if (imported === 'default') {
|
|
558
|
-
replacement =
|
|
558
|
+
replacement = `($parcel$interopDefault(${renamed}))`;
|
|
559
559
|
this.usedHelpers.add('$parcel$interopDefault');
|
|
560
560
|
} else {
|
|
561
561
|
replacement = this.getPropertyAccess(renamed, imported);
|
package/lib/dev-prelude.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
// anything defined in a previous bundle is accessed via the
|
|
7
7
|
// orig method which is the require for previous bundles
|
|
8
8
|
|
|
9
|
-
(function(modules, entry, mainEntry, parcelRequireName, globalName) {
|
|
9
|
+
(function (modules, entry, mainEntry, parcelRequireName, globalName) {
|
|
10
10
|
/* eslint-disable no-undef */
|
|
11
11
|
var globalObject =
|
|
12
12
|
typeof globalThis !== 'undefined'
|
|
@@ -99,9 +99,9 @@
|
|
|
99
99
|
newRequire.modules = modules;
|
|
100
100
|
newRequire.cache = cache;
|
|
101
101
|
newRequire.parent = previousRequire;
|
|
102
|
-
newRequire.register = function(id, exports) {
|
|
102
|
+
newRequire.register = function (id, exports) {
|
|
103
103
|
modules[id] = [
|
|
104
|
-
function(require, module) {
|
|
104
|
+
function (require, module) {
|
|
105
105
|
module.exports = exports;
|
|
106
106
|
},
|
|
107
107
|
{},
|
|
@@ -109,7 +109,7 @@
|
|
|
109
109
|
};
|
|
110
110
|
|
|
111
111
|
Object.defineProperty(newRequire, 'root', {
|
|
112
|
-
get: function() {
|
|
112
|
+
get: function () {
|
|
113
113
|
return globalObject[parcelRequireName];
|
|
114
114
|
},
|
|
115
115
|
});
|
|
@@ -131,7 +131,7 @@
|
|
|
131
131
|
|
|
132
132
|
// RequireJS
|
|
133
133
|
} else if (typeof define === 'function' && define.amd) {
|
|
134
|
-
define(function() {
|
|
134
|
+
define(function () {
|
|
135
135
|
return mainExports;
|
|
136
136
|
});
|
|
137
137
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@parcel/packager-js",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -17,16 +17,16 @@
|
|
|
17
17
|
"source": "src/index.js",
|
|
18
18
|
"engines": {
|
|
19
19
|
"node": ">= 12.0.0",
|
|
20
|
-
"parcel": "^2.0.
|
|
20
|
+
"parcel": "^2.0.1"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@parcel/diagnostic": "^2.0.
|
|
24
|
-
"@parcel/hash": "^2.0.
|
|
25
|
-
"@parcel/plugin": "^2.0.
|
|
23
|
+
"@parcel/diagnostic": "^2.0.1",
|
|
24
|
+
"@parcel/hash": "^2.0.1",
|
|
25
|
+
"@parcel/plugin": "^2.0.1",
|
|
26
26
|
"@parcel/source-map": "^2.0.0",
|
|
27
|
-
"@parcel/utils": "^2.0.
|
|
27
|
+
"@parcel/utils": "^2.0.1",
|
|
28
28
|
"globals": "^13.2.0",
|
|
29
29
|
"nullthrows": "^1.1.1"
|
|
30
30
|
},
|
|
31
|
-
"gitHead": "
|
|
31
|
+
"gitHead": "28b47e6bdca7de2a06b7cc39a4a0b1df89f3fe15"
|
|
32
32
|
}
|
package/src/DevPackager.js
CHANGED
|
@@ -99,9 +99,8 @@ export class DevPackager {
|
|
|
99
99
|
for (let dep of dependencies) {
|
|
100
100
|
let resolved = this.bundleGraph.getResolvedAsset(dep, this.bundle);
|
|
101
101
|
if (resolved) {
|
|
102
|
-
deps[getSpecifier(dep)] =
|
|
103
|
-
resolved
|
|
104
|
-
);
|
|
102
|
+
deps[getSpecifier(dep)] =
|
|
103
|
+
this.bundleGraph.getAssetPublicId(resolved);
|
|
105
104
|
}
|
|
106
105
|
}
|
|
107
106
|
|
|
@@ -28,7 +28,8 @@ const NON_ID_CONTINUE_RE = /[^$_\u200C\u200D\p{ID_Continue}]/gu;
|
|
|
28
28
|
|
|
29
29
|
// General regex used to replace imports with the resolved code, references with resolutions,
|
|
30
30
|
// and count the number of newlines in the file for source maps.
|
|
31
|
-
const REPLACEMENT_RE =
|
|
31
|
+
const REPLACEMENT_RE =
|
|
32
|
+
/\n|import\s+"([0-9a-f]{16}:.+?)";|(?:\$[0-9a-f]{16}\$exports)|(?:\$[0-9a-f]{16}\$(?:import|importAsync|require)\$[0-9a-f]+(?:\$[0-9a-f]+)?)/g;
|
|
32
33
|
|
|
33
34
|
const BUILTINS = Object.keys(globals.builtin);
|
|
34
35
|
const GLOBALS_BY_CONTEXT = {
|
|
@@ -580,7 +581,7 @@ ${code}
|
|
|
580
581
|
if (imported === '*') {
|
|
581
582
|
replacement = renamed;
|
|
582
583
|
} else if (imported === 'default') {
|
|
583
|
-
replacement =
|
|
584
|
+
replacement = `($parcel$interopDefault(${renamed}))`;
|
|
584
585
|
this.usedHelpers.add('$parcel$interopDefault');
|
|
585
586
|
} else {
|
|
586
587
|
replacement = this.getPropertyAccess(renamed, imported);
|
|
@@ -1043,10 +1044,8 @@ ${code}
|
|
|
1043
1044
|
}
|
|
1044
1045
|
|
|
1045
1046
|
// The output format may have specific things to add at the start of the bundle (e.g. imports).
|
|
1046
|
-
let [
|
|
1047
|
-
|
|
1048
|
-
outputFormatLines,
|
|
1049
|
-
] = this.outputFormat.buildBundlePrelude();
|
|
1047
|
+
let [outputFormatPrelude, outputFormatLines] =
|
|
1048
|
+
this.outputFormat.buildBundlePrelude();
|
|
1050
1049
|
res += outputFormatPrelude;
|
|
1051
1050
|
lines += outputFormatLines;
|
|
1052
1051
|
|
package/src/dev-prelude.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
// anything defined in a previous bundle is accessed via the
|
|
7
7
|
// orig method which is the require for previous bundles
|
|
8
8
|
|
|
9
|
-
(function(modules, entry, mainEntry, parcelRequireName, globalName) {
|
|
9
|
+
(function (modules, entry, mainEntry, parcelRequireName, globalName) {
|
|
10
10
|
/* eslint-disable no-undef */
|
|
11
11
|
var globalObject =
|
|
12
12
|
typeof globalThis !== 'undefined'
|
|
@@ -99,9 +99,9 @@
|
|
|
99
99
|
newRequire.modules = modules;
|
|
100
100
|
newRequire.cache = cache;
|
|
101
101
|
newRequire.parent = previousRequire;
|
|
102
|
-
newRequire.register = function(id, exports) {
|
|
102
|
+
newRequire.register = function (id, exports) {
|
|
103
103
|
modules[id] = [
|
|
104
|
-
function(require, module) {
|
|
104
|
+
function (require, module) {
|
|
105
105
|
module.exports = exports;
|
|
106
106
|
},
|
|
107
107
|
{},
|
|
@@ -109,7 +109,7 @@
|
|
|
109
109
|
};
|
|
110
110
|
|
|
111
111
|
Object.defineProperty(newRequire, 'root', {
|
|
112
|
-
get: function() {
|
|
112
|
+
get: function () {
|
|
113
113
|
return globalObject[parcelRequireName];
|
|
114
114
|
},
|
|
115
115
|
});
|
|
@@ -131,7 +131,7 @@
|
|
|
131
131
|
|
|
132
132
|
// RequireJS
|
|
133
133
|
} else if (typeof define === 'function' && define.amd) {
|
|
134
|
-
define(function() {
|
|
134
|
+
define(function () {
|
|
135
135
|
return mainExports;
|
|
136
136
|
});
|
|
137
137
|
|