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