@parcel/packager-js 2.0.0-dev.1632 → 2.0.0-dev.1680

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.
@@ -112,7 +112,7 @@ class DevPackager {
112
112
  mapBuffer
113
113
  } = results[i];
114
114
  let output = code || '';
115
- wrapped += JSON.stringify(this.bundleGraph.getAssetPublicId(asset)) + ':[function(require,module,exports) {\n' + output + '\n},';
115
+ wrapped += JSON.stringify(this.bundleGraph.getAssetPublicId(asset)) + ':[function(require,module,exports,__globalThis) {\n' + output + '\n},';
116
116
  wrapped += JSON.stringify(deps);
117
117
  wrapped += ']';
118
118
  if (this.bundle.env.isNode() && asset.meta.has_node_replacements === true) {
@@ -26,7 +26,7 @@ function _nullthrows() {
26
26
  return data;
27
27
  }
28
28
  function _assert() {
29
- const data = _interopRequireDefault(require("assert"));
29
+ const data = _interopRequireWildcard(require("assert"));
30
30
  _assert = function () {
31
31
  return data;
32
32
  };
@@ -700,7 +700,11 @@ ${code}
700
700
  }
701
701
  isWrapped(resolved, parentAsset) {
702
702
  if (resolved.meta.isConstantModule) {
703
- (0, _assert().default)(this.bundle.hasAsset(resolved), 'Constant module not found in bundle');
703
+ if (!this.bundle.hasAsset(resolved)) {
704
+ throw new (_assert().AssertionError)({
705
+ message: `Constant module ${_path().default.relative(this.options.projectRoot, resolved.filePath)} referenced from ${_path().default.relative(this.options.projectRoot, parentAsset.filePath)} not found in bundle ${this.bundle.name}`
706
+ });
707
+ }
704
708
  return false;
705
709
  }
706
710
  return !this.bundle.hasAsset(resolved) && !this.externalAssets.has(resolved) || this.wrappedAssets.has(resolved.id) && resolved !== parentAsset;
@@ -73,7 +73,7 @@
73
73
  localRequire,
74
74
  module,
75
75
  module.exports,
76
- this
76
+ globalObject
77
77
  );
78
78
  }
79
79
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@parcel/packager-js",
3
- "version": "2.0.0-dev.1632+339350eb3",
3
+ "version": "2.0.0-dev.1680+3edb0d741",
4
4
  "license": "MIT",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -17,17 +17,17 @@
17
17
  "source": "src/index.js",
18
18
  "engines": {
19
19
  "node": ">= 16.0.0",
20
- "parcel": "^2.0.0-dev.1630+339350eb3"
20
+ "parcel": "^2.0.0-dev.1678+3edb0d741"
21
21
  },
22
22
  "dependencies": {
23
- "@parcel/diagnostic": "2.0.0-dev.1632+339350eb3",
24
- "@parcel/plugin": "2.0.0-dev.1632+339350eb3",
25
- "@parcel/rust": "2.12.1-dev.3260+339350eb3",
23
+ "@parcel/diagnostic": "2.0.0-dev.1680+3edb0d741",
24
+ "@parcel/plugin": "2.0.0-dev.1680+3edb0d741",
25
+ "@parcel/rust": "2.12.1-dev.3303+3edb0d741",
26
26
  "@parcel/source-map": "^2.1.1",
27
- "@parcel/types": "2.0.0-dev.1632+339350eb3",
28
- "@parcel/utils": "2.0.0-dev.1632+339350eb3",
27
+ "@parcel/types": "2.0.0-dev.1680+3edb0d741",
28
+ "@parcel/utils": "2.0.0-dev.1680+3edb0d741",
29
29
  "globals": "^13.2.0",
30
30
  "nullthrows": "^1.1.1"
31
31
  },
32
- "gitHead": "339350eb31fd33849cb1efe5fd7ad2cb096319f0"
32
+ "gitHead": "3edb0d7419831e49cfa7ea8c52b4f7127a16ae52"
33
33
  }
@@ -116,7 +116,7 @@ export class DevPackager {
116
116
  let output = code || '';
117
117
  wrapped +=
118
118
  JSON.stringify(this.bundleGraph.getAssetPublicId(asset)) +
119
- ':[function(require,module,exports) {\n' +
119
+ ':[function(require,module,exports,__globalThis) {\n' +
120
120
  output +
121
121
  '\n},';
122
122
  wrapped += JSON.stringify(deps);
@@ -17,7 +17,7 @@ import {
17
17
  } from '@parcel/utils';
18
18
  import SourceMap from '@parcel/source-map';
19
19
  import nullthrows from 'nullthrows';
20
- import invariant from 'assert';
20
+ import invariant, {AssertionError} from 'assert';
21
21
  import ThrowableDiagnostic, {
22
22
  convertSourceLocationToHighlight,
23
23
  } from '@parcel/diagnostic';
@@ -922,10 +922,17 @@ ${code}
922
922
 
923
923
  isWrapped(resolved: Asset, parentAsset: Asset): boolean {
924
924
  if (resolved.meta.isConstantModule) {
925
- invariant(
926
- this.bundle.hasAsset(resolved),
927
- 'Constant module not found in bundle',
928
- );
925
+ if (!this.bundle.hasAsset(resolved)) {
926
+ throw new AssertionError({
927
+ message: `Constant module ${path.relative(
928
+ this.options.projectRoot,
929
+ resolved.filePath,
930
+ )} referenced from ${path.relative(
931
+ this.options.projectRoot,
932
+ parentAsset.filePath,
933
+ )} not found in bundle ${this.bundle.name}`,
934
+ });
935
+ }
929
936
  return false;
930
937
  }
931
938
  return (
@@ -73,7 +73,7 @@
73
73
  localRequire,
74
74
  module,
75
75
  module.exports,
76
- this
76
+ globalObject
77
77
  );
78
78
  }
79
79