@parcel/packager-react-static 2.13.4-canary.3412 → 2.13.4-canary.3414
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.
- package/lib/ReactStaticPackager.js +16 -8
- package/package.json +8 -8
- package/src/ReactStaticPackager.js +22 -9
|
@@ -172,7 +172,8 @@ var _default = exports.default = new (_plugin().Packager)({
|
|
|
172
172
|
let bootstrapModules = [];
|
|
173
173
|
let entry;
|
|
174
174
|
for (let b of bundleGraph.getReferencedBundles(bundle, {
|
|
175
|
-
includeInline: false
|
|
175
|
+
includeInline: false,
|
|
176
|
+
includeIsolated: false
|
|
176
177
|
})) {
|
|
177
178
|
if (b.type === 'css') {
|
|
178
179
|
resources.push(React.createElement('link', {
|
|
@@ -251,7 +252,7 @@ async function loadBundleUncached(bundle, bundleGraph, getInlineBundleContents)
|
|
|
251
252
|
let packagedBundle = await (0, _nullthrows().default)(packagingBundles.get(entryBundle));
|
|
252
253
|
let contents = await (0, _utils().blobToString)(packagedBundle.contents);
|
|
253
254
|
contents = `module.exports = ${contents}`;
|
|
254
|
-
return [[entryBundle.id, [(0, _nullthrows().default)(entryBundle.getMainEntry()), contents]]];
|
|
255
|
+
return [[entryBundle.id, [entryBundle, (0, _nullthrows().default)(entryBundle.getMainEntry()), contents]]];
|
|
255
256
|
});
|
|
256
257
|
} else if (entryBundle) {
|
|
257
258
|
queue.add(async () => {
|
|
@@ -263,20 +264,28 @@ async function loadBundleUncached(bundle, bundleGraph, getInlineBundleContents)
|
|
|
263
264
|
}
|
|
264
265
|
} else if (node.type === 'asset') {
|
|
265
266
|
let asset = node.value;
|
|
266
|
-
queue.add(async () => [[asset.id, [asset, await asset.getCode()]]]);
|
|
267
|
+
queue.add(async () => [[asset.id, [bundle, asset, await asset.getCode()]]]);
|
|
267
268
|
}
|
|
268
269
|
});
|
|
270
|
+
for (let b of bundleGraph.getReferencedBundles(bundle)) {
|
|
271
|
+
queue.add(async () => {
|
|
272
|
+
let {
|
|
273
|
+
assets: subAssets
|
|
274
|
+
} = await loadBundle(b, bundleGraph, getInlineBundleContents);
|
|
275
|
+
return Array.from(subAssets);
|
|
276
|
+
});
|
|
277
|
+
}
|
|
269
278
|
let assets = new Map((await queue.run()).flatMap(v => v));
|
|
270
279
|
let assetsByFilePath = new Map();
|
|
271
280
|
let assetsByPublicId = new Map();
|
|
272
|
-
for (let [asset] of assets.values()) {
|
|
281
|
+
for (let [, asset] of assets.values()) {
|
|
273
282
|
assetsByFilePath.set(getCacheKey(asset), asset.id);
|
|
274
283
|
assetsByPublicId.set(bundleGraph.getAssetPublicId(asset), asset.id);
|
|
275
284
|
}
|
|
276
285
|
|
|
277
286
|
// Load an asset into the module system by id.
|
|
278
287
|
let loadAsset = id => {
|
|
279
|
-
let [asset, code] = (0, _nullthrows().default)(assets.get(id));
|
|
288
|
+
let [bundle, asset, code] = (0, _nullthrows().default)(assets.get(id));
|
|
280
289
|
let cacheKey = getCacheKey(asset);
|
|
281
290
|
let cachedModule = moduleCache.get(cacheKey);
|
|
282
291
|
if (cachedModule) {
|
|
@@ -351,9 +360,9 @@ async function loadBundleUncached(bundle, bundleGraph, getInlineBundleContents)
|
|
|
351
360
|
let {
|
|
352
361
|
assets: subAssets
|
|
353
362
|
} = await loadBundle(bundle, bundleGraph, getInlineBundleContents);
|
|
354
|
-
for (let [id, [asset, code]] of subAssets) {
|
|
363
|
+
for (let [id, [bundle, asset, code]] of subAssets) {
|
|
355
364
|
if (!assets.has(id)) {
|
|
356
|
-
assets.set(id, [asset, code]);
|
|
365
|
+
assets.set(id, [bundle, asset, code]);
|
|
357
366
|
assetsByFilePath.set(getCacheKey(asset), asset.id);
|
|
358
367
|
assetsByPublicId.set(bundleGraph.getAssetPublicId(asset), asset.id);
|
|
359
368
|
}
|
|
@@ -416,7 +425,6 @@ async function loadBundleUncached(bundle, bundleGraph, getInlineBundleContents)
|
|
|
416
425
|
};
|
|
417
426
|
}
|
|
418
427
|
function runModule(code, filename, id, require, parcelRequire) {
|
|
419
|
-
// code = code.replace(/import\((['"].*?['"])\)/g, (_, m) => `parcelRequire.load(${m[0] + m.slice(3)})`);
|
|
420
428
|
let moduleFunction = _vm().default.compileFunction(code, ['exports', 'require', 'module', '__dirname', '__filename', 'parcelRequire'], {
|
|
421
429
|
filename
|
|
422
430
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@parcel/packager-react-static",
|
|
3
|
-
"version": "2.13.4-canary.
|
|
3
|
+
"version": "2.13.4-canary.3414+ee9c3e4c3",
|
|
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.
|
|
20
|
+
"parcel": "^2.0.0-canary.1789+ee9c3e4c3"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@parcel/node-resolver-core": "3.4.4-canary.
|
|
24
|
-
"@parcel/plugin": "2.0.0-canary.
|
|
25
|
-
"@parcel/rust": "2.13.4-canary.
|
|
26
|
-
"@parcel/types": "2.0.0-canary.
|
|
27
|
-
"@parcel/utils": "2.0.0-canary.
|
|
23
|
+
"@parcel/node-resolver-core": "3.4.4-canary.3414+ee9c3e4c3",
|
|
24
|
+
"@parcel/plugin": "2.0.0-canary.1791+ee9c3e4c3",
|
|
25
|
+
"@parcel/rust": "2.13.4-canary.3414+ee9c3e4c3",
|
|
26
|
+
"@parcel/types": "2.0.0-canary.1791+ee9c3e4c3",
|
|
27
|
+
"@parcel/utils": "2.0.0-canary.1791+ee9c3e4c3",
|
|
28
28
|
"nullthrows": "^1.1.1",
|
|
29
29
|
"rsc-html-stream": "^0.0.4"
|
|
30
30
|
},
|
|
31
|
-
"gitHead": "
|
|
31
|
+
"gitHead": "ee9c3e4c3f4054e66bded33dd92c521e19da6af3"
|
|
32
32
|
}
|
|
@@ -138,6 +138,7 @@ export default (new Packager({
|
|
|
138
138
|
let entry;
|
|
139
139
|
for (let b of bundleGraph.getReferencedBundles(bundle, {
|
|
140
140
|
includeInline: false,
|
|
141
|
+
includeIsolated: false,
|
|
141
142
|
})) {
|
|
142
143
|
if (b.type === 'css') {
|
|
143
144
|
resources.push(
|
|
@@ -238,7 +239,7 @@ async function loadBundleUncached(
|
|
|
238
239
|
) => Async<{|contents: Blob|}>,
|
|
239
240
|
) {
|
|
240
241
|
// Load all asset contents.
|
|
241
|
-
let queue = new PromiseQueue<Array<[string, [Asset, string]]>>({
|
|
242
|
+
let queue = new PromiseQueue<Array<[string, [NamedBundle, Asset, string]]>>({
|
|
242
243
|
maxConcurrent: 32,
|
|
243
244
|
});
|
|
244
245
|
bundle.traverse(node => {
|
|
@@ -262,7 +263,7 @@ async function loadBundleUncached(
|
|
|
262
263
|
return [
|
|
263
264
|
[
|
|
264
265
|
entryBundle.id,
|
|
265
|
-
[nullthrows(entryBundle.getMainEntry()), contents],
|
|
266
|
+
[entryBundle, nullthrows(entryBundle.getMainEntry()), contents],
|
|
266
267
|
],
|
|
267
268
|
];
|
|
268
269
|
});
|
|
@@ -278,23 +279,36 @@ async function loadBundleUncached(
|
|
|
278
279
|
}
|
|
279
280
|
} else if (node.type === 'asset') {
|
|
280
281
|
let asset = node.value;
|
|
281
|
-
queue.add(async () => [
|
|
282
|
+
queue.add(async () => [
|
|
283
|
+
[asset.id, [bundle, asset, await asset.getCode()]],
|
|
284
|
+
]);
|
|
282
285
|
}
|
|
283
286
|
});
|
|
284
287
|
|
|
285
|
-
let
|
|
288
|
+
for (let b of bundleGraph.getReferencedBundles(bundle)) {
|
|
289
|
+
queue.add(async () => {
|
|
290
|
+
let {assets: subAssets} = await loadBundle(
|
|
291
|
+
b,
|
|
292
|
+
bundleGraph,
|
|
293
|
+
getInlineBundleContents,
|
|
294
|
+
);
|
|
295
|
+
return Array.from(subAssets);
|
|
296
|
+
});
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
let assets = new Map<string, [NamedBundle, Asset, string]>(
|
|
286
300
|
(await queue.run()).flatMap(v => v),
|
|
287
301
|
);
|
|
288
302
|
let assetsByFilePath = new Map<string, string>();
|
|
289
303
|
let assetsByPublicId = new Map<string, string>();
|
|
290
|
-
for (let [asset] of assets.values()) {
|
|
304
|
+
for (let [, asset] of assets.values()) {
|
|
291
305
|
assetsByFilePath.set(getCacheKey(asset), asset.id);
|
|
292
306
|
assetsByPublicId.set(bundleGraph.getAssetPublicId(asset), asset.id);
|
|
293
307
|
}
|
|
294
308
|
|
|
295
309
|
// Load an asset into the module system by id.
|
|
296
310
|
let loadAsset = (id: string) => {
|
|
297
|
-
let [asset, code] = nullthrows(assets.get(id));
|
|
311
|
+
let [bundle, asset, code] = nullthrows(assets.get(id));
|
|
298
312
|
let cacheKey = getCacheKey(asset);
|
|
299
313
|
let cachedModule = moduleCache.get(cacheKey);
|
|
300
314
|
if (cachedModule) {
|
|
@@ -376,9 +390,9 @@ async function loadBundleUncached(
|
|
|
376
390
|
bundleGraph,
|
|
377
391
|
getInlineBundleContents,
|
|
378
392
|
);
|
|
379
|
-
for (let [id, [asset, code]] of subAssets) {
|
|
393
|
+
for (let [id, [bundle, asset, code]] of subAssets) {
|
|
380
394
|
if (!assets.has(id)) {
|
|
381
|
-
assets.set(id, [asset, code]);
|
|
395
|
+
assets.set(id, [bundle, asset, code]);
|
|
382
396
|
assetsByFilePath.set(getCacheKey(asset), asset.id);
|
|
383
397
|
assetsByPublicId.set(bundleGraph.getAssetPublicId(asset), asset.id);
|
|
384
398
|
}
|
|
@@ -456,7 +470,6 @@ function runModule(
|
|
|
456
470
|
require: (id: string) => any,
|
|
457
471
|
parcelRequire: (id: string) => any,
|
|
458
472
|
) {
|
|
459
|
-
// code = code.replace(/import\((['"].*?['"])\)/g, (_, m) => `parcelRequire.load(${m[0] + m.slice(3)})`);
|
|
460
473
|
let moduleFunction = vm.compileFunction(
|
|
461
474
|
code,
|
|
462
475
|
[
|