@parcel/packager-js 2.0.0-nightly.1360 → 2.0.0-nightly.1365

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.
@@ -170,7 +170,7 @@ class ScopeHoistingPackager {
170
170
  let [prelude, preludeLines] = this.buildBundlePrelude();
171
171
  res = prelude + res;
172
172
  lineCount += preludeLines;
173
- (_sourceMap = sourceMap) === null || _sourceMap === void 0 ? void 0 : _sourceMap.offsetLines(1, preludeLines);
173
+ (_sourceMap = sourceMap) === null || _sourceMap === void 0 || _sourceMap.offsetLines(1, preludeLines);
174
174
  let entries = this.bundle.getEntryAssets();
175
175
  let mainEntry = this.bundle.getMainEntry();
176
176
  if (this.isAsyncBundle) {
@@ -399,7 +399,7 @@ class ScopeHoistingPackager {
399
399
  let [depMap, replacements] = this.buildReplacements(asset, deps);
400
400
  let [prepend, prependLines, append] = this.buildAssetPrelude(asset, deps);
401
401
  if (prependLines > 0) {
402
- sourceMap === null || sourceMap === void 0 ? void 0 : sourceMap.offsetLines(1, prependLines);
402
+ sourceMap === null || sourceMap === void 0 || sourceMap.offsetLines(1, prependLines);
403
403
  code = prepend + code;
404
404
  }
405
405
  code += append;
@@ -495,7 +495,7 @@ class ScopeHoistingPackager {
495
495
  // wrapper. Dependencies must be inserted AFTER the asset is registered so that circular dependencies work.
496
496
  if (shouldWrap) {
497
497
  // Offset by one line for the parcelRequire.register wrapper.
498
- sourceMap === null || sourceMap === void 0 ? void 0 : sourceMap.offsetLines(1, 1);
498
+ sourceMap === null || sourceMap === void 0 || sourceMap.offsetLines(1, 1);
499
499
  lineCount++;
500
500
  code = `parcelRequire.register(${JSON.stringify(this.bundleGraph.getAssetPublicId(asset))}, function(module, exports) {
501
501
  ${code}
@@ -864,10 +864,10 @@ ${code}
864
864
  // required to simulate ESM live bindings. It's easier to do it this way rather than inserting
865
865
  // additional assignments after each mutation of the original binding.
866
866
  prepend += `\n${usedExports.map(exp => {
867
- var _asset$symbols$get2, _asset$symbols$get2$m;
867
+ var _asset$symbols$get2;
868
868
  let resolved = this.getSymbolResolution(asset, asset, exp);
869
869
  let get = this.buildFunctionExpression([], resolved);
870
- let isEsmExport = !!((_asset$symbols$get2 = asset.symbols.get(exp)) !== null && _asset$symbols$get2 !== void 0 && (_asset$symbols$get2$m = _asset$symbols$get2.meta) !== null && _asset$symbols$get2$m !== void 0 && _asset$symbols$get2$m.isEsm);
870
+ let isEsmExport = !!((_asset$symbols$get2 = asset.symbols.get(exp)) !== null && _asset$symbols$get2 !== void 0 && (_asset$symbols$get2 = _asset$symbols$get2.meta) !== null && _asset$symbols$get2 !== void 0 && _asset$symbols$get2.isEsm);
871
871
  let set = !isEsmExport && asset.meta.hasCJSExports ? ', ' + this.buildFunctionExpression(['v'], `${resolved} = v`) : '';
872
872
  return `$parcel$export($${assetId}$exports, ${JSON.stringify(exp)}, ${get}${set});`;
873
873
  }).join('\n')}\n`;
package/lib/index.js CHANGED
@@ -25,9 +25,9 @@ function _diagnostic() {
25
25
  };
26
26
  return data;
27
27
  }
28
- function _hash() {
29
- const data = require("@parcel/hash");
30
- _hash = function () {
28
+ function _rust() {
29
+ const data = require("@parcel/rust");
30
+ _rust = function () {
31
31
  return data;
32
32
  };
33
33
  return data;
@@ -76,10 +76,10 @@ var _default = new (_plugin().Packager)({
76
76
  prependKey: `/${(0, _diagnostic().encodeJSONKeyComponent)(packageKey)}`
77
77
  }, packageKey, `Invalid config for ${packageKey}`);
78
78
  }
79
- let name = (_pkg$contents$name = pkg === null || pkg === void 0 ? void 0 : (_pkg$contents = pkg.contents) === null || _pkg$contents === void 0 ? void 0 : _pkg$contents.name) !== null && _pkg$contents$name !== void 0 ? _pkg$contents$name : '';
79
+ let name = (_pkg$contents$name = pkg === null || pkg === void 0 || (_pkg$contents = pkg.contents) === null || _pkg$contents === void 0 ? void 0 : _pkg$contents.name) !== null && _pkg$contents$name !== void 0 ? _pkg$contents$name : '';
80
80
  return {
81
- parcelRequireName: 'parcelRequire' + (0, _hash().hashString)(name).slice(-4),
82
- unstable_asyncBundleRuntime: Boolean(pkg === null || pkg === void 0 ? void 0 : (_pkg$contents$package = pkg.contents[packageKey]) === null || _pkg$contents$package === void 0 ? void 0 : _pkg$contents$package.unstable_asyncBundleRuntime)
81
+ parcelRequireName: 'parcelRequire' + (0, _rust().hashString)(name).slice(-4),
82
+ unstable_asyncBundleRuntime: Boolean(pkg === null || pkg === void 0 || (_pkg$contents$package = pkg.contents[packageKey]) === null || _pkg$contents$package === void 0 ? void 0 : _pkg$contents$package.unstable_asyncBundleRuntime)
83
83
  };
84
84
  },
85
85
  async package({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@parcel/packager-js",
3
- "version": "2.0.0-nightly.1360+cd0edbcca",
3
+ "version": "2.0.0-nightly.1365+aaaf22d59",
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": ">= 12.0.0",
20
- "parcel": "2.0.0-nightly.1358+cd0edbcca"
20
+ "parcel": "2.0.0-nightly.1363+aaaf22d59"
21
21
  },
22
22
  "dependencies": {
23
- "@parcel/diagnostic": "2.0.0-nightly.1360+cd0edbcca",
24
- "@parcel/hash": "2.9.4-nightly.2983+cd0edbcca",
25
- "@parcel/plugin": "2.0.0-nightly.1360+cd0edbcca",
23
+ "@parcel/diagnostic": "2.0.0-nightly.1365+aaaf22d59",
24
+ "@parcel/plugin": "2.0.0-nightly.1365+aaaf22d59",
25
+ "@parcel/rust": "2.9.4-nightly.2988+aaaf22d59",
26
26
  "@parcel/source-map": "^2.1.1",
27
- "@parcel/types": "2.0.0-nightly.1360+cd0edbcca",
28
- "@parcel/utils": "2.0.0-nightly.1360+cd0edbcca",
27
+ "@parcel/types": "2.0.0-nightly.1365+aaaf22d59",
28
+ "@parcel/utils": "2.0.0-nightly.1365+aaaf22d59",
29
29
  "globals": "^13.2.0",
30
30
  "nullthrows": "^1.1.1"
31
31
  },
32
- "gitHead": "cd0edbccaafeacd2203a34e34570f45e2a10f028"
32
+ "gitHead": "aaaf22d590ffee11dccf2399704ad37c54a4e01f"
33
33
  }
package/src/index.js CHANGED
@@ -9,7 +9,7 @@ import {
9
9
  type SchemaEntity,
10
10
  } from '@parcel/utils';
11
11
  import {encodeJSONKeyComponent} from '@parcel/diagnostic';
12
- import {hashString} from '@parcel/hash';
12
+ import {hashString} from '@parcel/rust';
13
13
  import path from 'path';
14
14
  import nullthrows from 'nullthrows';
15
15
  import {DevPackager} from './DevPackager';