@parcel/packager-react-static 2.15.5-canary.3483 → 2.16.0
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 +66 -2
- package/package.json +8 -8
- package/src/ReactStaticPackager.js +67 -1
|
@@ -353,9 +353,29 @@ async function loadBundleUncached(bundle, bundleGraph, getInlineBundleContents)
|
|
|
353
353
|
skipped: true
|
|
354
354
|
});
|
|
355
355
|
} else {
|
|
356
|
-
|
|
356
|
+
let resolution = {
|
|
357
357
|
id: resolved.id
|
|
358
|
-
}
|
|
358
|
+
};
|
|
359
|
+
|
|
360
|
+
// Dependencies may be re-targeted to follow re-exports.
|
|
361
|
+
for (let [name, sym] of dep.symbols) {
|
|
362
|
+
var _sym$meta;
|
|
363
|
+
let rewritten = (_sym$meta = sym.meta) === null || _sym$meta === void 0 ? void 0 : _sym$meta.rewritten;
|
|
364
|
+
if (typeof rewritten === 'string') {
|
|
365
|
+
if (Array.isArray(resolution)) {
|
|
366
|
+
resolution.push([rewritten, resolved.id, name]);
|
|
367
|
+
} else {
|
|
368
|
+
resolution = [[rewritten, resolved.id, name]];
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
let specifier = getSpecifier(dep);
|
|
373
|
+
let cur = deps.get(specifier);
|
|
374
|
+
if (Array.isArray(cur) && Array.isArray(resolution)) {
|
|
375
|
+
cur.push(...resolution);
|
|
376
|
+
} else {
|
|
377
|
+
deps.set(specifier, resolution);
|
|
378
|
+
}
|
|
359
379
|
}
|
|
360
380
|
} else {
|
|
361
381
|
deps.set(getSpecifier(dep), {
|
|
@@ -369,6 +389,50 @@ async function loadBundleUncached(bundle, bundleGraph, getInlineBundleContents)
|
|
|
369
389
|
if (resolution !== null && resolution !== void 0 && resolution.skipped) {
|
|
370
390
|
return {};
|
|
371
391
|
}
|
|
392
|
+
|
|
393
|
+
// Synthesize a module to follow re-exports.
|
|
394
|
+
if (Array.isArray(resolution)) {
|
|
395
|
+
var m = {
|
|
396
|
+
__esModule: true
|
|
397
|
+
};
|
|
398
|
+
resolution.forEach(function (v) {
|
|
399
|
+
var key = v[0];
|
|
400
|
+
var id = v[1];
|
|
401
|
+
var exp = v[2];
|
|
402
|
+
var x = loadAsset(id);
|
|
403
|
+
if (key === '*') {
|
|
404
|
+
Object.keys(x).forEach(function (key) {
|
|
405
|
+
if (key === 'default' || key === '__esModule' ||
|
|
406
|
+
// $FlowFixMe
|
|
407
|
+
Object.prototype.hasOwnProperty.call(m, key)) {
|
|
408
|
+
return;
|
|
409
|
+
}
|
|
410
|
+
Object.defineProperty(m, key, {
|
|
411
|
+
enumerable: true,
|
|
412
|
+
get: function () {
|
|
413
|
+
return x[key];
|
|
414
|
+
}
|
|
415
|
+
});
|
|
416
|
+
});
|
|
417
|
+
} else if (exp === '*') {
|
|
418
|
+
Object.defineProperty(m, key, {
|
|
419
|
+
enumerable: true,
|
|
420
|
+
value: x
|
|
421
|
+
});
|
|
422
|
+
} else {
|
|
423
|
+
Object.defineProperty(m, key, {
|
|
424
|
+
enumerable: true,
|
|
425
|
+
get: function () {
|
|
426
|
+
if (exp === 'default') {
|
|
427
|
+
return x.__esModule ? x.default : x;
|
|
428
|
+
}
|
|
429
|
+
return x[exp];
|
|
430
|
+
}
|
|
431
|
+
});
|
|
432
|
+
}
|
|
433
|
+
});
|
|
434
|
+
return m;
|
|
435
|
+
}
|
|
372
436
|
if (resolution !== null && resolution !== void 0 && resolution.id) {
|
|
373
437
|
return loadAsset(resolution.id);
|
|
374
438
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@parcel/packager-react-static",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.16.0",
|
|
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.
|
|
20
|
+
"parcel": "^2.16.0"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@parcel/node-resolver-core": "3.
|
|
24
|
-
"@parcel/plugin": "2.
|
|
25
|
-
"@parcel/rust": "2.
|
|
26
|
-
"@parcel/types": "2.
|
|
27
|
-
"@parcel/utils": "2.
|
|
23
|
+
"@parcel/node-resolver-core": "3.7.0",
|
|
24
|
+
"@parcel/plugin": "2.16.0",
|
|
25
|
+
"@parcel/rust": "2.16.0",
|
|
26
|
+
"@parcel/types": "2.16.0",
|
|
27
|
+
"@parcel/utils": "2.16.0",
|
|
28
28
|
"nullthrows": "^1.1.1",
|
|
29
29
|
"rsc-html-stream": "^0.0.6"
|
|
30
30
|
},
|
|
31
|
-
"gitHead": "
|
|
31
|
+
"gitHead": "85181f71eee08f36b16d3ae81d12f32d076953f0"
|
|
32
32
|
}
|
|
@@ -375,7 +375,27 @@ async function loadBundleUncached(
|
|
|
375
375
|
if (resolved.type !== 'js') {
|
|
376
376
|
deps.set(getSpecifier(dep), {skipped: true});
|
|
377
377
|
} else {
|
|
378
|
-
|
|
378
|
+
let resolution = {id: resolved.id};
|
|
379
|
+
|
|
380
|
+
// Dependencies may be re-targeted to follow re-exports.
|
|
381
|
+
for (let [name, sym] of dep.symbols) {
|
|
382
|
+
let rewritten = sym.meta?.rewritten;
|
|
383
|
+
if (typeof rewritten === 'string') {
|
|
384
|
+
if (Array.isArray(resolution)) {
|
|
385
|
+
resolution.push([rewritten, resolved.id, name]);
|
|
386
|
+
} else {
|
|
387
|
+
resolution = [[rewritten, resolved.id, name]];
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
let specifier = getSpecifier(dep);
|
|
393
|
+
let cur = deps.get(specifier);
|
|
394
|
+
if (Array.isArray(cur) && Array.isArray(resolution)) {
|
|
395
|
+
cur.push(...resolution);
|
|
396
|
+
} else {
|
|
397
|
+
deps.set(specifier, resolution);
|
|
398
|
+
}
|
|
379
399
|
}
|
|
380
400
|
} else {
|
|
381
401
|
deps.set(getSpecifier(dep), {specifier: dep.specifier});
|
|
@@ -389,6 +409,52 @@ async function loadBundleUncached(
|
|
|
389
409
|
return {};
|
|
390
410
|
}
|
|
391
411
|
|
|
412
|
+
// Synthesize a module to follow re-exports.
|
|
413
|
+
if (Array.isArray(resolution)) {
|
|
414
|
+
var m = {__esModule: true};
|
|
415
|
+
resolution.forEach(function (v) {
|
|
416
|
+
var key = v[0];
|
|
417
|
+
var id = v[1];
|
|
418
|
+
var exp = v[2];
|
|
419
|
+
var x = loadAsset(id);
|
|
420
|
+
if (key === '*') {
|
|
421
|
+
Object.keys(x).forEach(function (key) {
|
|
422
|
+
if (
|
|
423
|
+
key === 'default' ||
|
|
424
|
+
key === '__esModule' ||
|
|
425
|
+
// $FlowFixMe
|
|
426
|
+
Object.prototype.hasOwnProperty.call(m, key)
|
|
427
|
+
) {
|
|
428
|
+
return;
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
Object.defineProperty(m, key, {
|
|
432
|
+
enumerable: true,
|
|
433
|
+
get: function () {
|
|
434
|
+
return x[key];
|
|
435
|
+
},
|
|
436
|
+
});
|
|
437
|
+
});
|
|
438
|
+
} else if (exp === '*') {
|
|
439
|
+
Object.defineProperty(m, key, {
|
|
440
|
+
enumerable: true,
|
|
441
|
+
value: x,
|
|
442
|
+
});
|
|
443
|
+
} else {
|
|
444
|
+
Object.defineProperty(m, key, {
|
|
445
|
+
enumerable: true,
|
|
446
|
+
get: function () {
|
|
447
|
+
if (exp === 'default') {
|
|
448
|
+
return x.__esModule ? x.default : x;
|
|
449
|
+
}
|
|
450
|
+
return x[exp];
|
|
451
|
+
},
|
|
452
|
+
});
|
|
453
|
+
}
|
|
454
|
+
});
|
|
455
|
+
return m;
|
|
456
|
+
}
|
|
457
|
+
|
|
392
458
|
if (resolution?.id) {
|
|
393
459
|
return loadAsset(resolution.id);
|
|
394
460
|
}
|