@parcel/packager-react-static 2.13.4-canary.3395 → 2.13.4-canary.3398

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.
@@ -341,7 +341,7 @@ async function loadBundleUncached(bundle, bundleGraph, getInlineBundleContents)
341
341
  publicUrl: bundle.target.publicUrl
342
342
  };
343
343
  parcelRequire.load = async filePath => {
344
- let bundle = bundleGraph.getBundles().find(b => b.name === filePath);
344
+ let bundle = bundleGraph.getBundles().find(b => b.publicId === filePath || b.name === filePath);
345
345
  if (bundle) {
346
346
  let {
347
347
  assets: subAssets
@@ -357,6 +357,17 @@ async function loadBundleUncached(bundle, bundleGraph, getInlineBundleContents)
357
357
  throw new Error('Bundle not found');
358
358
  }
359
359
  };
360
+ parcelRequire.resolve = url => {
361
+ let bundle = bundleGraph.getBundles().find(b => b.publicId === url || b.name === url);
362
+ if (bundle) {
363
+ return (0, _utils().urlJoin)(bundle.target.publicUrl, bundle.name);
364
+ } else {
365
+ throw new Error('Bundle not found');
366
+ }
367
+ };
368
+
369
+ // No-op. We can access the bundle graph directly.
370
+ parcelRequire.extendImportMap = () => {};
360
371
 
361
372
  // Resolve and load a module by specifier.
362
373
  let loadModule = (id, from, env = 'react-client') => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@parcel/packager-react-static",
3
- "version": "2.13.4-canary.3395+f86f5f27c",
3
+ "version": "2.13.4-canary.3398+735a635f7",
4
4
  "license": "MIT",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -17,16 +17,16 @@
17
17
  "source": "src/ReactStaticPackager.js",
18
18
  "engines": {
19
19
  "node": ">= 16.0.0",
20
- "parcel": "^2.0.0-canary.1770+f86f5f27c"
20
+ "parcel": "^2.0.0-canary.1773+735a635f7"
21
21
  },
22
22
  "dependencies": {
23
- "@parcel/node-resolver-core": "3.4.4-canary.3395+f86f5f27c",
24
- "@parcel/plugin": "2.0.0-canary.1772+f86f5f27c",
25
- "@parcel/rust": "2.13.4-canary.3395+f86f5f27c",
26
- "@parcel/types": "2.0.0-canary.1772+f86f5f27c",
27
- "@parcel/utils": "2.0.0-canary.1772+f86f5f27c",
23
+ "@parcel/node-resolver-core": "3.4.4-canary.3398+735a635f7",
24
+ "@parcel/plugin": "2.0.0-canary.1775+735a635f7",
25
+ "@parcel/rust": "2.13.4-canary.3398+735a635f7",
26
+ "@parcel/types": "2.0.0-canary.1775+735a635f7",
27
+ "@parcel/utils": "2.0.0-canary.1775+735a635f7",
28
28
  "nullthrows": "^1.1.1",
29
29
  "rsc-html-stream": "^0.0.4"
30
30
  },
31
- "gitHead": "f86f5f27c3a6553e70bd35652f19e6ab8d8e4e4a"
31
+ "gitHead": "735a635f7eed538c449f37517b26247e0b19c1a4"
32
32
  }
@@ -364,7 +364,9 @@ async function loadBundleUncached(
364
364
  };
365
365
 
366
366
  parcelRequire.load = async (filePath: string) => {
367
- let bundle = bundleGraph.getBundles().find(b => b.name === filePath);
367
+ let bundle = bundleGraph
368
+ .getBundles()
369
+ .find(b => b.publicId === filePath || b.name === filePath);
368
370
  if (bundle) {
369
371
  let {assets: subAssets} = await loadBundle(
370
372
  bundle,
@@ -383,6 +385,20 @@ async function loadBundleUncached(
383
385
  }
384
386
  };
385
387
 
388
+ parcelRequire.resolve = (url: string) => {
389
+ let bundle = bundleGraph
390
+ .getBundles()
391
+ .find(b => b.publicId === url || b.name === url);
392
+ if (bundle) {
393
+ return urlJoin(bundle.target.publicUrl, bundle.name);
394
+ } else {
395
+ throw new Error('Bundle not found');
396
+ }
397
+ };
398
+
399
+ // No-op. We can access the bundle graph directly.
400
+ parcelRequire.extendImportMap = () => {};
401
+
386
402
  // Resolve and load a module by specifier.
387
403
  let loadModule = (id: string, from: string, env = 'react-client') => {
388
404
  let resolver = env === 'react-server' ? serverResolver : clientResolver;