@parcel/packager-js 2.0.0-nightly.1054 → 2.0.0-nightly.1069
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.
|
@@ -714,10 +714,12 @@ ${code}
|
|
|
714
714
|
|
|
715
715
|
let isWrapped = !this.bundle.hasAsset(resolvedAsset) || this.wrappedAssets.has(resolvedAsset.id) && resolvedAsset !== parentAsset;
|
|
716
716
|
let staticExports = resolvedAsset.meta.staticExports !== false;
|
|
717
|
-
let publicId = this.bundleGraph.getAssetPublicId(resolvedAsset); // If the
|
|
717
|
+
let publicId = this.bundleGraph.getAssetPublicId(resolvedAsset); // If the resolved asset is wrapped, but imported at the top-level by this asset,
|
|
718
718
|
// then we hoist parcelRequire calls to the top of this asset so side effects run immediately.
|
|
719
719
|
|
|
720
|
-
if (isWrapped && dep && !(dep !== null && dep !== void 0 && dep.meta.shouldWrap) && symbol !== false
|
|
720
|
+
if (isWrapped && dep && !(dep !== null && dep !== void 0 && dep.meta.shouldWrap) && symbol !== false && ( // Only do this if the asset is part of a different bundle (so it was definitely
|
|
721
|
+
// parcelRequire.register'ed there), or if it is indeed registered in this bundle.
|
|
722
|
+
!this.bundle.hasAsset(resolvedAsset) || !this.shouldSkipAsset(resolvedAsset))) {
|
|
721
723
|
let hoisted = this.hoistedRequires.get(dep.id);
|
|
722
724
|
|
|
723
725
|
if (!hoisted) {
|
|
@@ -746,7 +748,12 @@ ${code}
|
|
|
746
748
|
|
|
747
749
|
if (imported === '*' || exportSymbol === '*' || isDefaultInterop) {
|
|
748
750
|
// Resolve to the namespace object if requested or this is a CJS default interop reqiure.
|
|
749
|
-
|
|
751
|
+
if (parentAsset === resolvedAsset && this.wrappedAssets.has(resolvedAsset.id)) {
|
|
752
|
+
// Directly use module.exports for wrapped assets importing themselves.
|
|
753
|
+
return 'module.exports';
|
|
754
|
+
} else {
|
|
755
|
+
return obj;
|
|
756
|
+
}
|
|
750
757
|
} else if ((!staticExports || isWrapped || !symbol) && resolvedAsset !== parentAsset) {
|
|
751
758
|
// If the resolved asset is wrapped or has non-static exports,
|
|
752
759
|
// we need to use a member access off the namespace object rather
|
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.1069+5cfb846d7",
|
|
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.0-nightly.
|
|
20
|
+
"parcel": "2.0.0-nightly.1067+5cfb846d7"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@parcel/diagnostic": "2.0.0-nightly.
|
|
24
|
-
"@parcel/hash": "2.
|
|
25
|
-
"@parcel/plugin": "2.0.0-nightly.
|
|
23
|
+
"@parcel/diagnostic": "2.0.0-nightly.1069+5cfb846d7",
|
|
24
|
+
"@parcel/hash": "2.5.1-nightly.2692+5cfb846d7",
|
|
25
|
+
"@parcel/plugin": "2.0.0-nightly.1069+5cfb846d7",
|
|
26
26
|
"@parcel/source-map": "^2.0.0",
|
|
27
|
-
"@parcel/utils": "2.0.0-nightly.
|
|
27
|
+
"@parcel/utils": "2.0.0-nightly.1069+5cfb846d7",
|
|
28
28
|
"globals": "^13.2.0",
|
|
29
29
|
"nullthrows": "^1.1.1"
|
|
30
30
|
},
|
|
31
|
-
"gitHead": "
|
|
31
|
+
"gitHead": "5cfb846d742eb86b1232e531be6e0e513551d838"
|
|
32
32
|
}
|
|
@@ -760,9 +760,18 @@ ${code}
|
|
|
760
760
|
let staticExports = resolvedAsset.meta.staticExports !== false;
|
|
761
761
|
let publicId = this.bundleGraph.getAssetPublicId(resolvedAsset);
|
|
762
762
|
|
|
763
|
-
// If the
|
|
763
|
+
// If the resolved asset is wrapped, but imported at the top-level by this asset,
|
|
764
764
|
// then we hoist parcelRequire calls to the top of this asset so side effects run immediately.
|
|
765
|
-
if (
|
|
765
|
+
if (
|
|
766
|
+
isWrapped &&
|
|
767
|
+
dep &&
|
|
768
|
+
!dep?.meta.shouldWrap &&
|
|
769
|
+
symbol !== false &&
|
|
770
|
+
// Only do this if the asset is part of a different bundle (so it was definitely
|
|
771
|
+
// parcelRequire.register'ed there), or if it is indeed registered in this bundle.
|
|
772
|
+
(!this.bundle.hasAsset(resolvedAsset) ||
|
|
773
|
+
!this.shouldSkipAsset(resolvedAsset))
|
|
774
|
+
) {
|
|
766
775
|
let hoisted = this.hoistedRequires.get(dep.id);
|
|
767
776
|
if (!hoisted) {
|
|
768
777
|
hoisted = new Map();
|
|
@@ -806,7 +815,15 @@ ${code}
|
|
|
806
815
|
|
|
807
816
|
if (imported === '*' || exportSymbol === '*' || isDefaultInterop) {
|
|
808
817
|
// Resolve to the namespace object if requested or this is a CJS default interop reqiure.
|
|
809
|
-
|
|
818
|
+
if (
|
|
819
|
+
parentAsset === resolvedAsset &&
|
|
820
|
+
this.wrappedAssets.has(resolvedAsset.id)
|
|
821
|
+
) {
|
|
822
|
+
// Directly use module.exports for wrapped assets importing themselves.
|
|
823
|
+
return 'module.exports';
|
|
824
|
+
} else {
|
|
825
|
+
return obj;
|
|
826
|
+
}
|
|
810
827
|
} else if (
|
|
811
828
|
(!staticExports || isWrapped || !symbol) &&
|
|
812
829
|
resolvedAsset !== parentAsset
|