@valbuild/tanstack-build 0.148.3 → 0.149.2
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/CHANGELOG.md +12 -0
- package/dist/declarations/src/node/vendorLayer.d.ts +16 -0
- package/dist/declarations/src/wire.d.ts +14 -0
- package/dist/valbuild-tanstack-build.cjs.dev.js +15 -3
- package/dist/valbuild-tanstack-build.cjs.prod.js +15 -3
- package/dist/valbuild-tanstack-build.esm.js +15 -3
- package/node/dist/valbuild-tanstack-build-node.cjs.dev.js +183 -97
- package/node/dist/valbuild-tanstack-build-node.cjs.prod.js +183 -97
- package/node/dist/valbuild-tanstack-build-node.esm.js +183 -97
- package/package.json +1 -1
|
@@ -1133,6 +1133,24 @@ var PER_PROJECT_ENTRIES = ["#tanstack-router-entry", "#tanstack-start-entry"];
|
|
|
1133
1133
|
* fails loudly at load rather than silently shipping a server bundle.
|
|
1134
1134
|
*/
|
|
1135
1135
|
var SERVER_ENTRIES = ["@tanstack/react-start/server", "@tanstack/react-start-server", "@tanstack/start-server-core"];
|
|
1136
|
+
|
|
1137
|
+
/**
|
|
1138
|
+
* Val's own entry points that are server-only by contract, built for the
|
|
1139
|
+
* worker and never for the browser.
|
|
1140
|
+
*
|
|
1141
|
+
* Without this a dependency goes in the browser half whenever it CAN be built
|
|
1142
|
+
* for a browser, whether or not anything there imports it. `@valbuild/tanstack/demo`
|
|
1143
|
+
* can: it is the demo's server half, and its 15.5 MB is the built Studio it
|
|
1144
|
+
* serves, as strings. A project importing it from its API route got that
|
|
1145
|
+
* twice, once in each half, and the browser copy was never loaded -- a third
|
|
1146
|
+
* of the demo's layer, built, uploaded and stored for nothing.
|
|
1147
|
+
*
|
|
1148
|
+
* Only entries whose purpose is the server, named by the package that
|
|
1149
|
+
* defines them. A client import of one is still caught, by name: the layer
|
|
1150
|
+
* lists it in `workerOnly`, and the app build rejects it (`build.ts`).
|
|
1151
|
+
*/
|
|
1152
|
+
var SERVER_ONLY_ENTRIES = ["@valbuild/tanstack/server", "@valbuild/tanstack/demo"];
|
|
1153
|
+
var SERVER_ONLY_REASON = "a server entry point: built for the worker only, by design";
|
|
1136
1154
|
var SERVER_ENTRY_STUB = "\nthrow new Error(\n 'TanStack Start\\'s server entry is not available in the browser. A project ' +\n 'dependency reached it from client code; on this platform the shell owns ' +\n 'the server side. If this came from a server-only branch guarded by ' +\n 'try/catch, this is the failure it expects.',\n)\n";
|
|
1137
1155
|
function stubServerEntries(browser) {
|
|
1138
1156
|
var prefix = "\0platform:server-entry:";
|
|
@@ -2316,7 +2334,7 @@ function buildVendorLayer(_x34, _x35, _x36, _x37) {
|
|
|
2316
2334
|
}
|
|
2317
2335
|
function _buildVendorLayer() {
|
|
2318
2336
|
_buildVendorLayer = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee13(dir, deps, css, platform) {
|
|
2319
|
-
var modules, _iterator21, _step21, _loop4, stubs, input, _i6, _Object$entries4, _Object$entries4$_i, specifier, name, file, skipped, workerOnly, workerOnlyReasons, specifierOf, usable, built,
|
|
2337
|
+
var modules, _iterator21, _step21, _loop4, stubs, input, _i6, _Object$entries4, _Object$entries4$_i, specifier, name, file, skipped, workerOnly, workerOnlyReasons, specifierOf, _i7, _Object$keys, _specifier, forBrowser, forgetUncarried, usable, built, _i9, _Object$values, _name2, worked, reasons, serverOnlyByContract, _iterator22, _step22, target, _probe$unusable$_name, probe, unbundlable, _message, _reasons$, _i0, _Object$entries5, _Object$entries5$_i, _specifier3, _name3, _i1, _Object$entries6, _Object$entries6$_i, _specifier4, _name4, reason, _i10, _Object$entries7, _Object$entries7$_i, _specifier5, _name5, _reason, _t19, _t20, _t21;
|
|
2320
2338
|
return _regenerator().w(function (_context15) {
|
|
2321
2339
|
while (1) switch (_context15.p = _context15.n) {
|
|
2322
2340
|
case 0:
|
|
@@ -2453,26 +2471,63 @@ function _buildVendorLayer() {
|
|
|
2453
2471
|
return name === chunk;
|
|
2454
2472
|
})[0];
|
|
2455
2473
|
};
|
|
2456
|
-
|
|
2474
|
+
_i7 = 0, _Object$keys = Object.keys(modules);
|
|
2475
|
+
case 16:
|
|
2476
|
+
if (!(_i7 < _Object$keys.length)) {
|
|
2477
|
+
_context15.n = 19;
|
|
2478
|
+
break;
|
|
2479
|
+
}
|
|
2480
|
+
_specifier = _Object$keys[_i7];
|
|
2481
|
+
if (SERVER_ONLY_ENTRIES.includes(_specifier)) {
|
|
2482
|
+
_context15.n = 17;
|
|
2483
|
+
break;
|
|
2484
|
+
}
|
|
2485
|
+
return _context15.a(3, 18);
|
|
2486
|
+
case 17:
|
|
2487
|
+
workerOnly.push(_specifier);
|
|
2488
|
+
workerOnlyReasons[_specifier] = SERVER_ONLY_REASON;
|
|
2489
|
+
case 18:
|
|
2490
|
+
_i7++;
|
|
2457
2491
|
_context15.n = 16;
|
|
2458
|
-
|
|
2492
|
+
break;
|
|
2493
|
+
case 19:
|
|
2494
|
+
forBrowser = function forBrowser(names) {
|
|
2495
|
+
return names.filter(function (name) {
|
|
2496
|
+
return !workerOnly.includes(specifierOf(name));
|
|
2497
|
+
});
|
|
2498
|
+
}; // Those are listed before the first build, so one that then could not be
|
|
2499
|
+
// built at all is in `skipped`, and is no longer reported as server-only.
|
|
2500
|
+
forgetUncarried = function forgetUncarried() {
|
|
2501
|
+
for (var _i8 = 0, _arr2 = [].concat(workerOnly); _i8 < _arr2.length; _i8++) {
|
|
2502
|
+
var _specifier2 = _arr2[_i8];
|
|
2503
|
+
if (_specifier2 in modules) continue;
|
|
2504
|
+
workerOnly.splice(workerOnly.indexOf(_specifier2), 1);
|
|
2505
|
+
delete workerOnlyReasons[_specifier2];
|
|
2506
|
+
}
|
|
2507
|
+
};
|
|
2508
|
+
usable = Object.values(modules);
|
|
2509
|
+
_context15.n = 20;
|
|
2510
|
+
return buildTargets({
|
|
2511
|
+
worker: usable,
|
|
2512
|
+
browser: forBrowser(usable)
|
|
2513
|
+
}, input, join(stubs, "out"), false, platform)["catch"](function (error) {
|
|
2459
2514
|
if (error instanceof PinSkewError) throw error;
|
|
2460
2515
|
return null;
|
|
2461
2516
|
});
|
|
2462
|
-
case
|
|
2517
|
+
case 20:
|
|
2463
2518
|
built = _context15.v;
|
|
2464
2519
|
if (built) {
|
|
2465
|
-
_context15.n =
|
|
2520
|
+
_context15.n = 40;
|
|
2466
2521
|
break;
|
|
2467
2522
|
}
|
|
2468
2523
|
usable = [];
|
|
2469
|
-
|
|
2470
|
-
case
|
|
2471
|
-
if (!(
|
|
2472
|
-
_context15.n =
|
|
2524
|
+
_i9 = 0, _Object$values = Object.values(modules);
|
|
2525
|
+
case 21:
|
|
2526
|
+
if (!(_i9 < _Object$values.length)) {
|
|
2527
|
+
_context15.n = 37;
|
|
2473
2528
|
break;
|
|
2474
2529
|
}
|
|
2475
|
-
_name2 = _Object$values[
|
|
2530
|
+
_name2 = _Object$values[_i9];
|
|
2476
2531
|
// Probed per target, because the two sides are not the same question.
|
|
2477
2532
|
// A package that builds for the worker and not the browser is kept as
|
|
2478
2533
|
// server-only, and importing it from client code is rejected later by
|
|
@@ -2480,85 +2535,113 @@ function _buildVendorLayer() {
|
|
|
2480
2535
|
// any more than in the first build: `buildTargets` reports it.
|
|
2481
2536
|
worked = {};
|
|
2482
2537
|
reasons = [];
|
|
2538
|
+
serverOnlyByContract = SERVER_ONLY_ENTRIES.includes(specifierOf(_name2));
|
|
2483
2539
|
_iterator22 = _createForOfIteratorHelper(targetsFor(platform));
|
|
2484
|
-
_context15.p =
|
|
2540
|
+
_context15.p = 22;
|
|
2485
2541
|
_iterator22.s();
|
|
2486
|
-
case
|
|
2542
|
+
case 23:
|
|
2487
2543
|
if ((_step22 = _iterator22.n()).done) {
|
|
2488
|
-
_context15.n =
|
|
2544
|
+
_context15.n = 29;
|
|
2489
2545
|
break;
|
|
2490
2546
|
}
|
|
2491
2547
|
target = _step22.value;
|
|
2492
|
-
|
|
2493
|
-
|
|
2548
|
+
if (!(target.name === "browser" && serverOnlyByContract)) {
|
|
2549
|
+
_context15.n = 24;
|
|
2550
|
+
break;
|
|
2551
|
+
}
|
|
2552
|
+
worked.browser = false;
|
|
2553
|
+
return _context15.a(3, 28);
|
|
2554
|
+
case 24:
|
|
2555
|
+
_context15.p = 24;
|
|
2556
|
+
_context15.n = 25;
|
|
2494
2557
|
return buildTargets({
|
|
2495
2558
|
worker: target.name === "worker" ? [_name2] : [],
|
|
2496
2559
|
browser: target.name === "browser" ? [_name2] : []
|
|
2497
2560
|
}, input, join(stubs, "probe", target.name, _name2), true, platform);
|
|
2498
|
-
case
|
|
2561
|
+
case 25:
|
|
2499
2562
|
probe = _context15.v;
|
|
2500
2563
|
unbundlable = (_probe$unusable$_name = probe.unusable[_name2]) !== null && _probe$unusable$_name !== void 0 ? _probe$unusable$_name : probe.serverOnly[_name2];
|
|
2501
2564
|
worked[target.name] = unbundlable === undefined;
|
|
2502
2565
|
if (unbundlable !== undefined) reasons.push(unbundlable);
|
|
2503
|
-
_context15.n =
|
|
2566
|
+
_context15.n = 28;
|
|
2504
2567
|
break;
|
|
2505
|
-
case
|
|
2506
|
-
_context15.p =
|
|
2568
|
+
case 26:
|
|
2569
|
+
_context15.p = 26;
|
|
2507
2570
|
_t20 = _context15.v;
|
|
2508
2571
|
if (!(_t20 instanceof PinSkewError)) {
|
|
2509
|
-
_context15.n =
|
|
2572
|
+
_context15.n = 27;
|
|
2510
2573
|
break;
|
|
2511
2574
|
}
|
|
2512
2575
|
throw _t20;
|
|
2513
|
-
case
|
|
2576
|
+
case 27:
|
|
2514
2577
|
worked[target.name] = false;
|
|
2515
2578
|
reasons.push(firstLine(String((_message = _t20 === null || _t20 === void 0 ? void 0 : _t20.message) !== null && _message !== void 0 ? _message : _t20)));
|
|
2516
|
-
case
|
|
2517
|
-
_context15.n =
|
|
2579
|
+
case 28:
|
|
2580
|
+
_context15.n = 23;
|
|
2518
2581
|
break;
|
|
2519
|
-
case
|
|
2520
|
-
_context15.n =
|
|
2582
|
+
case 29:
|
|
2583
|
+
_context15.n = 31;
|
|
2521
2584
|
break;
|
|
2522
|
-
case
|
|
2523
|
-
_context15.p =
|
|
2585
|
+
case 30:
|
|
2586
|
+
_context15.p = 30;
|
|
2524
2587
|
_t21 = _context15.v;
|
|
2525
2588
|
_iterator22.e(_t21);
|
|
2526
|
-
case
|
|
2527
|
-
_context15.p =
|
|
2589
|
+
case 31:
|
|
2590
|
+
_context15.p = 31;
|
|
2528
2591
|
_iterator22.f();
|
|
2529
|
-
return _context15.f(
|
|
2530
|
-
case
|
|
2531
|
-
if (worked.worker && worked.browser)
|
|
2532
|
-
|
|
2533
|
-
|
|
2534
|
-
// Kept, because throwing it away is what made this class of failure
|
|
2535
|
-
// undebuggable. `workerOnly` says a dependency is server-only and
|
|
2536
|
-
// PLATFORM404 says importing it from a component is an error, and
|
|
2537
|
-
// between them they never said WHY it could not be built for a
|
|
2538
|
-
// browser -- which is the only thing that tells you whether to change
|
|
2539
|
-
// the import or fix the package.
|
|
2540
|
-
if (reasons[0]) workerOnlyReasons[specifierOf(_name2)] = reasons[0];
|
|
2541
|
-
} else {
|
|
2542
|
-
skipped.push({
|
|
2543
|
-
specifier: specifierOf(_name2),
|
|
2544
|
-
reason: (_reasons$ = reasons[0]) !== null && _reasons$ !== void 0 ? _reasons$ : "build failed"
|
|
2545
|
-
});
|
|
2592
|
+
return _context15.f(31);
|
|
2593
|
+
case 32:
|
|
2594
|
+
if (!(worked.worker && worked.browser)) {
|
|
2595
|
+
_context15.n = 33;
|
|
2596
|
+
break;
|
|
2546
2597
|
}
|
|
2547
|
-
|
|
2548
|
-
|
|
2549
|
-
_context15.n = 17;
|
|
2598
|
+
usable.push(_name2);
|
|
2599
|
+
_context15.n = 36;
|
|
2550
2600
|
break;
|
|
2551
|
-
case
|
|
2552
|
-
|
|
2553
|
-
|
|
2554
|
-
|
|
2601
|
+
case 33:
|
|
2602
|
+
if (!worked.worker) {
|
|
2603
|
+
_context15.n = 35;
|
|
2604
|
+
break;
|
|
2605
|
+
}
|
|
2606
|
+
usable.push(_name2);
|
|
2607
|
+
if (!serverOnlyByContract) {
|
|
2608
|
+
_context15.n = 34;
|
|
2609
|
+
break;
|
|
2610
|
+
}
|
|
2611
|
+
return _context15.a(3, 36);
|
|
2612
|
+
case 34:
|
|
2613
|
+
// listed before the first build
|
|
2614
|
+
workerOnly.push(specifierOf(_name2));
|
|
2615
|
+
// Kept, because throwing it away is what made this class of failure
|
|
2616
|
+
// undebuggable. `workerOnly` says a dependency is server-only and
|
|
2617
|
+
// PLATFORM404 says importing it from a component is an error, and
|
|
2618
|
+
// between them they never said WHY it could not be built for a
|
|
2619
|
+
// browser -- which is the only thing that tells you whether to change
|
|
2620
|
+
// the import or fix the package.
|
|
2621
|
+
if (reasons[0]) workerOnlyReasons[specifierOf(_name2)] = reasons[0];
|
|
2622
|
+
_context15.n = 36;
|
|
2623
|
+
break;
|
|
2624
|
+
case 35:
|
|
2625
|
+
skipped.push({
|
|
2626
|
+
specifier: specifierOf(_name2),
|
|
2627
|
+
reason: (_reasons$ = reasons[0]) !== null && _reasons$ !== void 0 ? _reasons$ : "build failed"
|
|
2628
|
+
});
|
|
2629
|
+
case 36:
|
|
2630
|
+
_i9++;
|
|
2631
|
+
_context15.n = 21;
|
|
2632
|
+
break;
|
|
2633
|
+
case 37:
|
|
2634
|
+
for (_i0 = 0, _Object$entries5 = Object.entries(modules); _i0 < _Object$entries5.length; _i0++) {
|
|
2635
|
+
_Object$entries5$_i = _slicedToArray(_Object$entries5[_i0], 2), _specifier3 = _Object$entries5$_i[0], _name3 = _Object$entries5$_i[1];
|
|
2636
|
+
if (!usable.includes(_name3)) delete modules[_specifier3];
|
|
2555
2637
|
}
|
|
2556
2638
|
// Everything failed: a layer with no entries is the same as no layer, and
|
|
2557
2639
|
// the skip list is what the caller reports.
|
|
2558
2640
|
if (!(usable.length === 0)) {
|
|
2559
|
-
_context15.n =
|
|
2641
|
+
_context15.n = 38;
|
|
2560
2642
|
break;
|
|
2561
2643
|
}
|
|
2644
|
+
forgetUncarried();
|
|
2562
2645
|
return _context15.a(2, {
|
|
2563
2646
|
rev: "none",
|
|
2564
2647
|
modules: {},
|
|
@@ -2569,62 +2652,65 @@ function _buildVendorLayer() {
|
|
|
2569
2652
|
workerOnly: workerOnly,
|
|
2570
2653
|
workerOnlyReasons: workerOnlyReasons
|
|
2571
2654
|
});
|
|
2572
|
-
case
|
|
2573
|
-
_context15.n =
|
|
2655
|
+
case 38:
|
|
2656
|
+
_context15.n = 39;
|
|
2574
2657
|
return buildTargets({
|
|
2575
2658
|
worker: usable,
|
|
2576
|
-
browser: usable
|
|
2577
|
-
return !workerOnly.includes(specifierOf(name));
|
|
2578
|
-
})
|
|
2659
|
+
browser: forBrowser(usable)
|
|
2579
2660
|
}, input, join(stubs, "out"), false, platform);
|
|
2580
|
-
case
|
|
2661
|
+
case 39:
|
|
2581
2662
|
built = _context15.v;
|
|
2582
|
-
case
|
|
2583
|
-
|
|
2584
|
-
case
|
|
2585
|
-
if (!(
|
|
2586
|
-
_context15.n =
|
|
2663
|
+
case 40:
|
|
2664
|
+
_i1 = 0, _Object$entries6 = Object.entries(modules);
|
|
2665
|
+
case 41:
|
|
2666
|
+
if (!(_i1 < _Object$entries6.length)) {
|
|
2667
|
+
_context15.n = 44;
|
|
2587
2668
|
break;
|
|
2588
2669
|
}
|
|
2589
|
-
_Object$entries6$_i = _slicedToArray(_Object$entries6[
|
|
2670
|
+
_Object$entries6$_i = _slicedToArray(_Object$entries6[_i1], 2), _specifier4 = _Object$entries6$_i[0], _name4 = _Object$entries6$_i[1];
|
|
2590
2671
|
reason = built.unusable[_name4];
|
|
2591
2672
|
if (!(reason === undefined)) {
|
|
2592
|
-
_context15.n =
|
|
2673
|
+
_context15.n = 42;
|
|
2593
2674
|
break;
|
|
2594
2675
|
}
|
|
2595
|
-
return _context15.a(3,
|
|
2596
|
-
case
|
|
2676
|
+
return _context15.a(3, 43);
|
|
2677
|
+
case 42:
|
|
2597
2678
|
skipped.push({
|
|
2598
|
-
specifier:
|
|
2679
|
+
specifier: _specifier4,
|
|
2599
2680
|
reason: reason
|
|
2600
2681
|
});
|
|
2601
|
-
delete modules[
|
|
2602
|
-
case
|
|
2603
|
-
|
|
2604
|
-
_context15.n =
|
|
2682
|
+
delete modules[_specifier4];
|
|
2683
|
+
case 43:
|
|
2684
|
+
_i1++;
|
|
2685
|
+
_context15.n = 41;
|
|
2605
2686
|
break;
|
|
2606
|
-
case
|
|
2607
|
-
|
|
2608
|
-
case
|
|
2609
|
-
if (!(
|
|
2610
|
-
_context15.n =
|
|
2687
|
+
case 44:
|
|
2688
|
+
_i10 = 0, _Object$entries7 = Object.entries(modules);
|
|
2689
|
+
case 45:
|
|
2690
|
+
if (!(_i10 < _Object$entries7.length)) {
|
|
2691
|
+
_context15.n = 48;
|
|
2611
2692
|
break;
|
|
2612
2693
|
}
|
|
2613
|
-
_Object$entries7$_i = _slicedToArray(_Object$entries7[
|
|
2694
|
+
_Object$entries7$_i = _slicedToArray(_Object$entries7[_i10], 2), _specifier5 = _Object$entries7$_i[0], _name5 = _Object$entries7$_i[1];
|
|
2614
2695
|
_reason = built.serverOnly[_name5];
|
|
2615
|
-
if (!(_reason === undefined || workerOnly.includes(
|
|
2616
|
-
_context15.n =
|
|
2696
|
+
if (!(_reason === undefined || workerOnly.includes(_specifier5))) {
|
|
2697
|
+
_context15.n = 46;
|
|
2617
2698
|
break;
|
|
2618
2699
|
}
|
|
2619
|
-
return _context15.a(3,
|
|
2620
|
-
case
|
|
2621
|
-
workerOnly.push(
|
|
2622
|
-
workerOnlyReasons[
|
|
2623
|
-
case
|
|
2624
|
-
|
|
2625
|
-
_context15.n =
|
|
2700
|
+
return _context15.a(3, 47);
|
|
2701
|
+
case 46:
|
|
2702
|
+
workerOnly.push(_specifier5);
|
|
2703
|
+
workerOnlyReasons[_specifier5] = _reason;
|
|
2704
|
+
case 47:
|
|
2705
|
+
_i10++;
|
|
2706
|
+
_context15.n = 45;
|
|
2626
2707
|
break;
|
|
2627
|
-
case
|
|
2708
|
+
case 48:
|
|
2709
|
+
forgetUncarried();
|
|
2710
|
+
|
|
2711
|
+
// The revision covers the stylesheets too: changing one is a different
|
|
2712
|
+
// dependency set, and the build hash folds in the revision rather than the
|
|
2713
|
+
// contents.
|
|
2628
2714
|
return _context15.a(2, {
|
|
2629
2715
|
rev: "".concat(built.rev).concat(cssRev(css) ? "-".concat(cssRev(css)) : ""),
|
|
2630
2716
|
modules: modules,
|
|
@@ -2635,19 +2721,19 @@ function _buildVendorLayer() {
|
|
|
2635
2721
|
workerOnly: workerOnly,
|
|
2636
2722
|
workerOnlyReasons: workerOnlyReasons
|
|
2637
2723
|
});
|
|
2638
|
-
case
|
|
2639
|
-
_context15.p =
|
|
2640
|
-
_context15.n =
|
|
2724
|
+
case 49:
|
|
2725
|
+
_context15.p = 49;
|
|
2726
|
+
_context15.n = 50;
|
|
2641
2727
|
return rm(stubs, {
|
|
2642
2728
|
recursive: true,
|
|
2643
2729
|
force: true
|
|
2644
2730
|
});
|
|
2645
|
-
case
|
|
2646
|
-
return _context15.f(
|
|
2647
|
-
case
|
|
2731
|
+
case 50:
|
|
2732
|
+
return _context15.f(49);
|
|
2733
|
+
case 51:
|
|
2648
2734
|
return _context15.a(2);
|
|
2649
2735
|
}
|
|
2650
|
-
}, _callee13, null, [[
|
|
2736
|
+
}, _callee13, null, [[24, 26], [22, 30, 31, 32], [11,, 49, 51], [3, 7, 8, 9]]);
|
|
2651
2737
|
}));
|
|
2652
2738
|
return _buildVendorLayer.apply(this, arguments);
|
|
2653
2739
|
}
|
package/package.json
CHANGED