@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 CHANGED
@@ -1,5 +1,17 @@
1
1
  # @valbuild/tanstack-build
2
2
 
3
+ ## 0.149.2
4
+
5
+ ### Patch Changes
6
+
7
+ - [#917](https://github.com/valbuild/val/pull/917) [`48ca810`](https://github.com/valbuild/val/commit/48ca810a985af2a0af845c779d39c3da7f7fb0fc) Thanks [@freekh](https://github.com/freekh)! - `val publish` now declares `@valbuild/ui` at the version your project actually runs. A project that does not declare `@valbuild/ui` gets it added when it is wired for the platform, because the Studio's bundle lives there. It used to be added at `@valbuild/core`'s version, which can be an older release than the `@valbuild/ui` your `@valbuild/tanstack` uses. The two are no longer always released together, and the mismatch could install a second, older Studio. It now takes the version installed beside `@valbuild/tanstack`, and if no installed copy can be found it says so in a warning. A project that declares `@valbuild/ui` itself is left unchanged.
8
+
9
+ ## 0.148.5
10
+
11
+ ### Patch Changes
12
+
13
+ - [#899](https://github.com/valbuild/val/pull/899) [`acc5fee`](https://github.com/valbuild/val/commit/acc5feef498edbb9a7d3e8715bfb516d26079669) Thanks [@freekh](https://github.com/freekh)! - A project's dependency layer no longer builds Val's server entry points for the browser. `@valbuild/tanstack/server` and `@valbuild/tanstack/demo` go in the worker half only, so the browser half stops carrying code nothing in the browser imports. `@valbuild/tanstack/demo` is about 15 MB: on the Val demo the browser half went from 20.2 to 4.8 million characters, and the whole layer from 40.8 to 25.4. Importing either from client code is still reported by name, as for any server-only dependency.
14
+
3
15
  ## 0.148.3
4
16
 
5
17
  ### Patch Changes
@@ -129,6 +129,22 @@ export interface VendorLayer {
129
129
  /** Browser chunks, served under `/_pvendor/<rev>/`. */
130
130
  browser: Record<string, string>;
131
131
  }
132
+ /**
133
+ * Val's own entry points that are server-only by contract, built for the
134
+ * worker and never for the browser.
135
+ *
136
+ * Without this a dependency goes in the browser half whenever it CAN be built
137
+ * for a browser, whether or not anything there imports it. `@valbuild/tanstack/demo`
138
+ * can: it is the demo's server half, and its 15.5 MB is the built Studio it
139
+ * serves, as strings. A project importing it from its API route got that
140
+ * twice, once in each half, and the browser copy was never loaded -- a third
141
+ * of the demo's layer, built, uploaded and stored for nothing.
142
+ *
143
+ * Only entries whose purpose is the server, named by the package that
144
+ * defines them. A client import of one is still caught, by name: the layer
145
+ * lists it in `workerOnly`, and the app build rejects it (`build.ts`).
146
+ */
147
+ export declare const SERVER_ONLY_ENTRIES: ReadonlyArray<string>;
132
148
  /**
133
149
  * Every import a project chunk emits has to resolve inside the isolate: into
134
150
  * the base layer, at a sibling chunk, or at a Node builtin the runtime
@@ -41,6 +41,20 @@ export interface WireOptions {
41
41
  commit: string;
42
42
  branch: string;
43
43
  };
44
+ /**
45
+ * The version of `@valbuild/ui` the checkout has installed: the Studio its
46
+ * `@valbuild/tanstack` runs. What `@valbuild/ui` is declared at when the
47
+ * project does not declare it, so the layer ships the Studio the project
48
+ * already runs.
49
+ *
50
+ * Only a caller with the installed packages can say -- this sees source
51
+ * files, never `node_modules` or a lockfile. Without it, `@valbuild/core`'s
52
+ * version stands in, which always names a published `@valbuild/ui` (ui
53
+ * depends on core, so a core release is a ui release) but can name an older
54
+ * one: the packages are versioned together only when they are released
55
+ * together.
56
+ */
57
+ studioVersion?: string;
44
58
  }
45
59
  /**
46
60
  * Where a Val project keeps the module this replaces.
@@ -1101,7 +1101,7 @@ var packageJson = {
1101
1101
  url: "git+https://github.com/valbuild/val.git"
1102
1102
  },
1103
1103
  license: "MIT",
1104
- version: "0.148.3",
1104
+ version: "0.149.2",
1105
1105
  sideEffects: false,
1106
1106
  main: "dist/valbuild-tanstack-build.cjs.js",
1107
1107
  module: "dist/valbuild-tanstack-build.esm.js",
@@ -1557,6 +1557,13 @@ function wireUp(files, options) {
1557
1557
  * a TRANSITIVE dependency, and the vendor layer is built from what a project
1558
1558
  * DECLARES intersected with what it imports. Undeclared, the Studio loads its
1559
1559
  * shell and then 404s on its own bundle.
1560
+ *
1561
+ * At the version the project already runs (`studioVersion`), not at
1562
+ * `@valbuild/core`'s: the two stopped moving together, and a site declaring
1563
+ * an older ui than its `@valbuild/tanstack` installs a second, older Studio
1564
+ * the next time anything installs from this `package.json`. A rewrite also
1565
+ * means the site's `package.json` is no longer its template's, so the
1566
+ * templates declare it themselves and this leaves them alone.
1560
1567
  */
1561
1568
  var manifestRaw = files["package.json"];
1562
1569
  if (manifestRaw) {
@@ -1564,14 +1571,19 @@ function wireUp(files, options) {
1564
1571
  var _manifest$dependencie;
1565
1572
  var manifest = JSON.parse(manifestRaw);
1566
1573
  var deps = (_manifest$dependencie = manifest.dependencies) !== null && _manifest$dependencie !== void 0 ? _manifest$dependencie : {};
1567
- if (deps["@valbuild/core"] && !deps["@valbuild/ui"]) {
1568
- deps["@valbuild/ui"] = deps["@valbuild/core"];
1574
+ var core = deps["@valbuild/core"];
1575
+ if (core && !deps["@valbuild/ui"]) {
1576
+ var _options$studioVersio;
1577
+ deps["@valbuild/ui"] = (_options$studioVersio = options.studioVersion) !== null && _options$studioVersio !== void 0 ? _options$studioVersio : core;
1569
1578
  manifest.dependencies = deps;
1570
1579
  out["package.json"] = "".concat(JSON.stringify(manifest, null, 2), "\n");
1571
1580
  changes.push({
1572
1581
  what: "@valbuild/ui declared as a dependency",
1573
1582
  why: "it carries the Studio bundle and was only a transitive dependency; the vendor " + "layer is built from what the project declares"
1574
1583
  });
1584
+ if (!options.studioVersion) {
1585
+ warnings.push("@valbuild/ui was declared at @valbuild/core's version (".concat(core, "), because the ") + "installed one could not be read. Declare @valbuild/ui in package.json at the " + "version your @valbuild/tanstack depends on to be sure it is the Studio you run.");
1586
+ }
1575
1587
  }
1576
1588
  } catch (_unused3) {
1577
1589
  warnings.push("package.json could not be parsed, so @valbuild/ui was not declared.");
@@ -1101,7 +1101,7 @@ var packageJson = {
1101
1101
  url: "git+https://github.com/valbuild/val.git"
1102
1102
  },
1103
1103
  license: "MIT",
1104
- version: "0.148.3",
1104
+ version: "0.149.2",
1105
1105
  sideEffects: false,
1106
1106
  main: "dist/valbuild-tanstack-build.cjs.js",
1107
1107
  module: "dist/valbuild-tanstack-build.esm.js",
@@ -1557,6 +1557,13 @@ function wireUp(files, options) {
1557
1557
  * a TRANSITIVE dependency, and the vendor layer is built from what a project
1558
1558
  * DECLARES intersected with what it imports. Undeclared, the Studio loads its
1559
1559
  * shell and then 404s on its own bundle.
1560
+ *
1561
+ * At the version the project already runs (`studioVersion`), not at
1562
+ * `@valbuild/core`'s: the two stopped moving together, and a site declaring
1563
+ * an older ui than its `@valbuild/tanstack` installs a second, older Studio
1564
+ * the next time anything installs from this `package.json`. A rewrite also
1565
+ * means the site's `package.json` is no longer its template's, so the
1566
+ * templates declare it themselves and this leaves them alone.
1560
1567
  */
1561
1568
  var manifestRaw = files["package.json"];
1562
1569
  if (manifestRaw) {
@@ -1564,14 +1571,19 @@ function wireUp(files, options) {
1564
1571
  var _manifest$dependencie;
1565
1572
  var manifest = JSON.parse(manifestRaw);
1566
1573
  var deps = (_manifest$dependencie = manifest.dependencies) !== null && _manifest$dependencie !== void 0 ? _manifest$dependencie : {};
1567
- if (deps["@valbuild/core"] && !deps["@valbuild/ui"]) {
1568
- deps["@valbuild/ui"] = deps["@valbuild/core"];
1574
+ var core = deps["@valbuild/core"];
1575
+ if (core && !deps["@valbuild/ui"]) {
1576
+ var _options$studioVersio;
1577
+ deps["@valbuild/ui"] = (_options$studioVersio = options.studioVersion) !== null && _options$studioVersio !== void 0 ? _options$studioVersio : core;
1569
1578
  manifest.dependencies = deps;
1570
1579
  out["package.json"] = "".concat(JSON.stringify(manifest, null, 2), "\n");
1571
1580
  changes.push({
1572
1581
  what: "@valbuild/ui declared as a dependency",
1573
1582
  why: "it carries the Studio bundle and was only a transitive dependency; the vendor " + "layer is built from what the project declares"
1574
1583
  });
1584
+ if (!options.studioVersion) {
1585
+ warnings.push("@valbuild/ui was declared at @valbuild/core's version (".concat(core, "), because the ") + "installed one could not be read. Declare @valbuild/ui in package.json at the " + "version your @valbuild/tanstack depends on to be sure it is the Studio you run.");
1586
+ }
1575
1587
  }
1576
1588
  } catch (_unused3) {
1577
1589
  warnings.push("package.json could not be parsed, so @valbuild/ui was not declared.");
@@ -1100,7 +1100,7 @@ var packageJson = {
1100
1100
  url: "git+https://github.com/valbuild/val.git"
1101
1101
  },
1102
1102
  license: "MIT",
1103
- version: "0.148.3",
1103
+ version: "0.149.2",
1104
1104
  sideEffects: false,
1105
1105
  main: "dist/valbuild-tanstack-build.cjs.js",
1106
1106
  module: "dist/valbuild-tanstack-build.esm.js",
@@ -1556,6 +1556,13 @@ function wireUp(files, options) {
1556
1556
  * a TRANSITIVE dependency, and the vendor layer is built from what a project
1557
1557
  * DECLARES intersected with what it imports. Undeclared, the Studio loads its
1558
1558
  * shell and then 404s on its own bundle.
1559
+ *
1560
+ * At the version the project already runs (`studioVersion`), not at
1561
+ * `@valbuild/core`'s: the two stopped moving together, and a site declaring
1562
+ * an older ui than its `@valbuild/tanstack` installs a second, older Studio
1563
+ * the next time anything installs from this `package.json`. A rewrite also
1564
+ * means the site's `package.json` is no longer its template's, so the
1565
+ * templates declare it themselves and this leaves them alone.
1559
1566
  */
1560
1567
  var manifestRaw = files["package.json"];
1561
1568
  if (manifestRaw) {
@@ -1563,14 +1570,19 @@ function wireUp(files, options) {
1563
1570
  var _manifest$dependencie;
1564
1571
  var manifest = JSON.parse(manifestRaw);
1565
1572
  var deps = (_manifest$dependencie = manifest.dependencies) !== null && _manifest$dependencie !== void 0 ? _manifest$dependencie : {};
1566
- if (deps["@valbuild/core"] && !deps["@valbuild/ui"]) {
1567
- deps["@valbuild/ui"] = deps["@valbuild/core"];
1573
+ var core = deps["@valbuild/core"];
1574
+ if (core && !deps["@valbuild/ui"]) {
1575
+ var _options$studioVersio;
1576
+ deps["@valbuild/ui"] = (_options$studioVersio = options.studioVersion) !== null && _options$studioVersio !== void 0 ? _options$studioVersio : core;
1568
1577
  manifest.dependencies = deps;
1569
1578
  out["package.json"] = "".concat(JSON.stringify(manifest, null, 2), "\n");
1570
1579
  changes.push({
1571
1580
  what: "@valbuild/ui declared as a dependency",
1572
1581
  why: "it carries the Studio bundle and was only a transitive dependency; the vendor " + "layer is built from what the project declares"
1573
1582
  });
1583
+ if (!options.studioVersion) {
1584
+ warnings.push("@valbuild/ui was declared at @valbuild/core's version (".concat(core, "), because the ") + "installed one could not be read. Declare @valbuild/ui in package.json at the " + "version your @valbuild/tanstack depends on to be sure it is the Studio you run.");
1585
+ }
1574
1586
  }
1575
1587
  } catch (_unused3) {
1576
1588
  warnings.push("package.json could not be parsed, so @valbuild/ui was not declared.");
@@ -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, _i7, _Object$values, _name2, worked, reasons, _iterator22, _step22, target, _probe$unusable$_name, probe, unbundlable, _message, _reasons$, _i8, _Object$entries5, _Object$entries5$_i, _specifier, _name3, _i9, _Object$entries6, _Object$entries6$_i, _specifier2, _name4, reason, _i0, _Object$entries7, _Object$entries7$_i, _specifier3, _name5, _reason, _t19, _t20, _t21;
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
- usable = Object.values(modules);
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
- return buildTargets(usable, input, node_path.join(stubs, "out"), false, platform)["catch"](function (error) {
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 16:
2539
+ case 20:
2485
2540
  built = _context15.v;
2486
2541
  if (built) {
2487
- _context15.n = 33;
2542
+ _context15.n = 40;
2488
2543
  break;
2489
2544
  }
2490
2545
  usable = [];
2491
- _i7 = 0, _Object$values = Object.values(modules);
2492
- case 17:
2493
- if (!(_i7 < _Object$values.length)) {
2494
- _context15.n = 30;
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[_i7];
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 = 18;
2562
+ _context15.p = 22;
2507
2563
  _iterator22.s();
2508
- case 19:
2564
+ case 23:
2509
2565
  if ((_step22 = _iterator22.n()).done) {
2510
- _context15.n = 25;
2566
+ _context15.n = 29;
2511
2567
  break;
2512
2568
  }
2513
2569
  target = _step22.value;
2514
- _context15.p = 20;
2515
- _context15.n = 21;
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 21:
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 = 24;
2588
+ _context15.n = 28;
2526
2589
  break;
2527
- case 22:
2528
- _context15.p = 22;
2590
+ case 26:
2591
+ _context15.p = 26;
2529
2592
  _t20 = _context15.v;
2530
2593
  if (!(_t20 instanceof PinSkewError)) {
2531
- _context15.n = 23;
2594
+ _context15.n = 27;
2532
2595
  break;
2533
2596
  }
2534
2597
  throw _t20;
2535
- case 23:
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 24:
2539
- _context15.n = 19;
2601
+ case 28:
2602
+ _context15.n = 23;
2540
2603
  break;
2541
- case 25:
2542
- _context15.n = 27;
2604
+ case 29:
2605
+ _context15.n = 31;
2543
2606
  break;
2544
- case 26:
2545
- _context15.p = 26;
2607
+ case 30:
2608
+ _context15.p = 30;
2546
2609
  _t21 = _context15.v;
2547
2610
  _iterator22.e(_t21);
2548
- case 27:
2549
- _context15.p = 27;
2611
+ case 31:
2612
+ _context15.p = 31;
2550
2613
  _iterator22.f();
2551
- return _context15.f(27);
2552
- case 28:
2553
- if (worked.worker && worked.browser) usable.push(_name2);else if (worked.worker) {
2554
- usable.push(_name2);
2555
- workerOnly.push(specifierOf(_name2));
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
- case 29:
2570
- _i7++;
2571
- _context15.n = 17;
2620
+ usable.push(_name2);
2621
+ _context15.n = 36;
2572
2622
  break;
2573
- case 30:
2574
- for (_i8 = 0, _Object$entries5 = Object.entries(modules); _i8 < _Object$entries5.length; _i8++) {
2575
- _Object$entries5$_i = regeneratorValues._slicedToArray(_Object$entries5[_i8], 2), _specifier = _Object$entries5$_i[0], _name3 = _Object$entries5$_i[1];
2576
- if (!usable.includes(_name3)) delete modules[_specifier];
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 = 31;
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 31:
2595
- _context15.n = 32;
2677
+ case 38:
2678
+ _context15.n = 39;
2596
2679
  return buildTargets({
2597
2680
  worker: usable,
2598
- browser: usable.filter(function (name) {
2599
- return !workerOnly.includes(specifierOf(name));
2600
- })
2681
+ browser: forBrowser(usable)
2601
2682
  }, input, node_path.join(stubs, "out"), false, platform);
2602
- case 32:
2683
+ case 39:
2603
2684
  built = _context15.v;
2604
- case 33:
2605
- _i9 = 0, _Object$entries6 = Object.entries(modules);
2606
- case 34:
2607
- if (!(_i9 < _Object$entries6.length)) {
2608
- _context15.n = 37;
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[_i9], 2), _specifier2 = _Object$entries6$_i[0], _name4 = _Object$entries6$_i[1];
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 = 35;
2695
+ _context15.n = 42;
2615
2696
  break;
2616
2697
  }
2617
- return _context15.a(3, 36);
2618
- case 35:
2698
+ return _context15.a(3, 43);
2699
+ case 42:
2619
2700
  skipped.push({
2620
- specifier: _specifier2,
2701
+ specifier: _specifier4,
2621
2702
  reason: reason
2622
2703
  });
2623
- delete modules[_specifier2];
2624
- case 36:
2625
- _i9++;
2626
- _context15.n = 34;
2704
+ delete modules[_specifier4];
2705
+ case 43:
2706
+ _i1++;
2707
+ _context15.n = 41;
2627
2708
  break;
2628
- case 37:
2629
- _i0 = 0, _Object$entries7 = Object.entries(modules);
2630
- case 38:
2631
- if (!(_i0 < _Object$entries7.length)) {
2632
- _context15.n = 41;
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[_i0], 2), _specifier3 = _Object$entries7$_i[0], _name5 = _Object$entries7$_i[1];
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(_specifier3))) {
2638
- _context15.n = 39;
2718
+ if (!(_reason === undefined || workerOnly.includes(_specifier5))) {
2719
+ _context15.n = 46;
2639
2720
  break;
2640
2721
  }
2641
- return _context15.a(3, 40);
2642
- case 39:
2643
- workerOnly.push(_specifier3);
2644
- workerOnlyReasons[_specifier3] = _reason;
2645
- case 40:
2646
- _i0++;
2647
- _context15.n = 38;
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 41:
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 42:
2661
- _context15.p = 42;
2662
- _context15.n = 43;
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 43:
2668
- return _context15.f(42);
2669
- case 44:
2753
+ case 50:
2754
+ return _context15.f(49);
2755
+ case 51:
2670
2756
  return _context15.a(2);
2671
2757
  }
2672
- }, _callee13, null, [[20, 22], [18, 26, 27, 28], [11,, 42, 44], [3, 7, 8, 9]]);
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
  }