@valbuild/tanstack-build 0.145.1 → 0.148.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.
@@ -9,6 +9,7 @@ var node_module = require('node:module');
9
9
  var promises = require('node:fs/promises');
10
10
  var node_path = require('node:path');
11
11
  var parseAst = require('rolldown/parseAst');
12
+ var esModuleLexer = require('es-module-lexer');
12
13
  var node_url = require('node:url');
13
14
  var projectPaths = require('../../dist/projectPaths-f222255a.cjs.dev.js');
14
15
 
@@ -525,10 +526,10 @@ function owningPackage(_x, _x2) {
525
526
  * it is the package that caused the incident this exists for.
526
527
  */
527
528
  function _owningPackage() {
528
- _owningPackage = regeneratorValues._asyncToGenerator(/*#__PURE__*/regeneratorValues._regenerator().m(function _callee2(id, cache) {
529
- var visited, dir, found, cached, manifest, parent, _i3, _visited, each;
530
- return regeneratorValues._regenerator().w(function (_context2) {
531
- while (1) switch (_context2.n) {
529
+ _owningPackage = regeneratorValues._asyncToGenerator(/*#__PURE__*/regeneratorValues._regenerator().m(function _callee4(id, cache) {
530
+ var visited, dir, found, cached, manifest, parent, _i4, _visited, each;
531
+ return regeneratorValues._regenerator().w(function (_context4) {
532
+ while (1) switch (_context4.n) {
532
533
  case 0:
533
534
  visited = [];
534
535
  dir = node_path.dirname(id);
@@ -536,50 +537,50 @@ function _owningPackage() {
536
537
  case 1:
537
538
  cached = cache.get(dir);
538
539
  if (!(cached !== undefined)) {
539
- _context2.n = 2;
540
+ _context4.n = 2;
540
541
  break;
541
542
  }
542
543
  found = cached;
543
- return _context2.a(3, 7);
544
+ return _context4.a(3, 7);
544
545
  case 2:
545
546
  visited.push(dir);
546
- _context2.n = 3;
547
+ _context4.n = 3;
547
548
  return promises.readFile(node_path.join(dir, "package.json"), "utf8").then(function (text) {
548
549
  return JSON.parse(text);
549
550
  })["catch"](function () {
550
551
  return null;
551
552
  });
552
553
  case 3:
553
- manifest = _context2.v;
554
+ manifest = _context4.v;
554
555
  if (!(regeneratorValues._typeof(manifest) === "object" && manifest !== null && "name" in manifest && "version" in manifest && typeof manifest.name === "string" && typeof manifest.version === "string")) {
555
- _context2.n = 4;
556
+ _context4.n = 4;
556
557
  break;
557
558
  }
558
559
  found = {
559
560
  name: manifest.name,
560
561
  version: manifest.version
561
562
  };
562
- return _context2.a(3, 7);
563
+ return _context4.a(3, 7);
563
564
  case 4:
564
565
  parent = node_path.dirname(dir);
565
566
  if (!(parent === dir)) {
566
- _context2.n = 5;
567
+ _context4.n = 5;
567
568
  break;
568
569
  }
569
- return _context2.a(3, 7);
570
+ return _context4.a(3, 7);
570
571
  case 5:
571
572
  dir = parent;
572
573
  case 6:
573
- _context2.n = 1;
574
+ _context4.n = 1;
574
575
  break;
575
576
  case 7:
576
- for (_i3 = 0, _visited = visited; _i3 < _visited.length; _i3++) {
577
- each = _visited[_i3];
577
+ for (_i4 = 0, _visited = visited; _i4 < _visited.length; _i4++) {
578
+ each = _visited[_i4];
578
579
  cache.set(each, found);
579
580
  }
580
- return _context2.a(2, found);
581
+ return _context4.a(2, found);
581
582
  }
582
- }, _callee2);
583
+ }, _callee4);
583
584
  }));
584
585
  return _owningPackage.apply(this, arguments);
585
586
  }
@@ -597,63 +598,63 @@ function pinSkewOf(_x3, _x4, _x5) {
597
598
  * here: it is a URL this package mints, not a path the platform owns.
598
599
  */
599
600
  function _pinSkewOf() {
600
- _pinSkewOf = regeneratorValues._asyncToGenerator(/*#__PURE__*/regeneratorValues._regenerator().m(function _callee3(moduleIds, pins, cache) {
601
- var found, _iterator9, _step9, _found$get, id, owner, pinned, versions, _t;
602
- return regeneratorValues._regenerator().w(function (_context3) {
603
- while (1) switch (_context3.p = _context3.n) {
601
+ _pinSkewOf = regeneratorValues._asyncToGenerator(/*#__PURE__*/regeneratorValues._regenerator().m(function _callee5(moduleIds, pins, cache) {
602
+ var found, _iterator1, _step1, _found$get, id, owner, pinned, versions, _t;
603
+ return regeneratorValues._regenerator().w(function (_context5) {
604
+ while (1) switch (_context5.p = _context5.n) {
604
605
  case 0:
605
606
  found = new Map();
606
- _iterator9 = regeneratorValues._createForOfIteratorHelper(moduleIds);
607
- _context3.p = 1;
608
- _iterator9.s();
607
+ _iterator1 = regeneratorValues._createForOfIteratorHelper(moduleIds);
608
+ _context5.p = 1;
609
+ _iterator1.s();
609
610
  case 2:
610
- if ((_step9 = _iterator9.n()).done) {
611
- _context3.n = 8;
611
+ if ((_step1 = _iterator1.n()).done) {
612
+ _context5.n = 8;
612
613
  break;
613
614
  }
614
- id = _step9.value;
615
+ id = _step1.value;
615
616
  if (node_path.isAbsolute(id)) {
616
- _context3.n = 3;
617
+ _context5.n = 3;
617
618
  break;
618
619
  }
619
- return _context3.a(3, 7);
620
+ return _context5.a(3, 7);
620
621
  case 3:
621
- _context3.n = 4;
622
+ _context5.n = 4;
622
623
  return owningPackage(id, cache);
623
624
  case 4:
624
- owner = _context3.v;
625
+ owner = _context5.v;
625
626
  if (owner) {
626
- _context3.n = 5;
627
+ _context5.n = 5;
627
628
  break;
628
629
  }
629
- return _context3.a(3, 7);
630
+ return _context5.a(3, 7);
630
631
  case 5:
631
632
  pinned = pins[owner.name];
632
633
  if (!(pinned === undefined || owner.version === pinned)) {
633
- _context3.n = 6;
634
+ _context5.n = 6;
634
635
  break;
635
636
  }
636
- return _context3.a(3, 7);
637
+ return _context5.a(3, 7);
637
638
  case 6:
638
639
  versions = (_found$get = found.get(owner.name)) !== null && _found$get !== void 0 ? _found$get : new Set();
639
640
  versions.add(owner.version);
640
641
  found.set(owner.name, versions);
641
642
  case 7:
642
- _context3.n = 2;
643
+ _context5.n = 2;
643
644
  break;
644
645
  case 8:
645
- _context3.n = 10;
646
+ _context5.n = 10;
646
647
  break;
647
648
  case 9:
648
- _context3.p = 9;
649
- _t = _context3.v;
650
- _iterator9.e(_t);
649
+ _context5.p = 9;
650
+ _t = _context5.v;
651
+ _iterator1.e(_t);
651
652
  case 10:
652
- _context3.p = 10;
653
- _iterator9.f();
654
- return _context3.f(10);
653
+ _context5.p = 10;
654
+ _iterator1.f();
655
+ return _context5.f(10);
655
656
  case 11:
656
- return _context3.a(2, regeneratorValues._toConsumableArray(found.entries()).sort(function (_ref4, _ref5) {
657
+ return _context5.a(2, regeneratorValues._toConsumableArray(found.entries()).sort(function (_ref4, _ref5) {
657
658
  var _ref6 = regeneratorValues._slicedToArray(_ref4, 1),
658
659
  a = _ref6[0];
659
660
  var _ref7 = regeneratorValues._slicedToArray(_ref5, 1),
@@ -672,7 +673,7 @@ function _pinSkewOf() {
672
673
  });
673
674
  }));
674
675
  }
675
- }, _callee3, null, [[1, 9, 10, 11]]);
676
+ }, _callee5, null, [[1, 9, 10, 11]]);
676
677
  }));
677
678
  return _pinSkewOf.apply(this, arguments);
678
679
  }
@@ -730,34 +731,35 @@ var firstLine = function firstLine(message) {
730
731
  };
731
732
 
732
733
  /**
733
- * A throwaway build, used only to find out whether a set of entries compiles.
734
- *
735
- * Worker target only: it is the stricter of the two (neutral platform, workerd
736
- * conditions), so anything that survives it is very unlikely to fail the
737
- * browser build for a reason worth attributing separately.
734
+ * Builds the given entries for each target, audits what came out, and digests
735
+ * it.
736
+ *
737
+ * Each target can take two passes. The first finds the entries that cannot be
738
+ * bundled for it (see `stubUnbundlable`); when there are any, the second
739
+ * builds the rest, and those are reported -- in `unusable` when they cannot be
740
+ * layered at all, in `serverOnly` when only the browser cannot have them --
741
+ * rather than failing the build. Either way each target ends with exactly one
742
+ * build that is audited and shipped.
738
743
  */
739
744
  function buildTargets(_x6, _x7, _x8, _x9, _x0) {
740
745
  return _buildTargets.apply(this, arguments);
741
746
  }
742
747
  /**
743
- * Start's per-project `imports` subpaths, stubbed for the project layer.
744
- *
745
- * `@tanstack/start-server-core` dynamically imports the app's router and server
746
- * entry through these, and Start's Vite plugin fills them in per project. It is
747
- * not in the base layer -- the shell needs its own copy, with those resolved
748
- * for real -- so a project dependency that merely *reaches* start-server-core
749
- * has nothing to resolve them to and cannot be built at all.
750
- *
751
- * Stubbed here rather than left unresolved, because the dependency almost
752
- * certainly wants a request helper or the storage context, not a second Start
753
- * handler. If one really does create a handler, this throws with a message
754
- * saying so instead of failing the layer build with a bare specifier.
748
+ * The entries of a stubbed build that load a stub, and why.
749
+ *
750
+ * An entry loads what its own chunk holds and what that chunk statically
751
+ * imports, transitively; a stub found there runs, and throws, when the entry is
752
+ * imported. A builtin stub reached only through `import()` does not count: that
753
+ * import rejects into whatever the package does about it, exactly as an
754
+ * unresolvable `import()` would. A native one does, either way, because an
755
+ * unstubbed build cannot load the binary at all -- which is what dropped the
756
+ * dependency before there were stubs.
755
757
  */
756
758
  function _buildTargets() {
757
- _buildTargets = regeneratorValues._asyncToGenerator(/*#__PURE__*/regeneratorValues._regenerator().m(function _callee4(names, input, outRoot, quiet, platform) {
758
- var out, digest, packages, _iterator0, _step0, target, forTarget, dir, shims, result, pins, skew, _iterator1, _step1, file, code, _t2, _t3, _t4;
759
- return regeneratorValues._regenerator().w(function (_context4) {
760
- while (1) switch (_context4.p = _context4.n) {
759
+ _buildTargets = regeneratorValues._asyncToGenerator(/*#__PURE__*/regeneratorValues._regenerator().m(function _callee6(names, input, outRoot, quiet, platform) {
760
+ var out, digest, packages, serverOnly, unusable, _iterator10, _step10, target, forTarget, dir, stubs, _loop3, _ret, _t4;
761
+ return regeneratorValues._regenerator().w(function (_context7) {
762
+ while (1) switch (_context7.p = _context7.n) {
761
763
  case 0:
762
764
  out = {
763
765
  worker: {},
@@ -766,222 +768,363 @@ function _buildTargets() {
766
768
  digest = node_crypto.createHash("sha256");
767
769
  /** Directory -> the package it belongs to, for the pin check. */
768
770
  packages = new Map();
769
- _iterator0 = regeneratorValues._createForOfIteratorHelper(targetsFor(platform));
770
- _context4.p = 1;
771
- _iterator0.s();
771
+ /** Entry -> why it cannot be built for a browser. */
772
+ serverOnly = {};
773
+ /** Entry -> why it cannot be built at all. */
774
+ unusable = {};
775
+ _iterator10 = regeneratorValues._createForOfIteratorHelper(targetsFor(platform));
776
+ _context7.p = 1;
777
+ _iterator10.s();
772
778
  case 2:
773
- if ((_step0 = _iterator0.n()).done) {
774
- _context4.n = 19;
775
- break;
776
- }
777
- target = _step0.value;
778
- forTarget = Array.isArray(names) ? names : names[target.name]; // Nothing for this side: a dependency can be server-only, and building an
779
- // empty bundle is both pointless and an error.
780
- if (!(forTarget.length === 0)) {
781
- _context4.n = 3;
779
+ if ((_step10 = _iterator10.n()).done) {
780
+ _context7.n = 8;
782
781
  break;
783
782
  }
784
- return _context4.a(3, 18);
785
- case 3:
783
+ target = _step10.value;
784
+ forTarget = (Array.isArray(names) ? names : names[target.name]).filter(
785
+ // The worker goes first: what it cannot bundle, neither side has.
786
+ function (name) {
787
+ return !(name in unusable);
788
+ });
786
789
  dir = node_path.join(outRoot, target.name);
787
- /*
788
- * Cleared first, because this function EMITS WHATEVER IT FINDS HERE.
789
- *
790
- * `buildVendorLayer` calls it twice against the same directory: once with
791
- * every dependency, and again with the survivors when that fails and the
792
- * per-dependency probe has worked out which to drop. rolldown writes
793
- * before the import audit runs, so a first pass that fails IN THE AUDIT
794
- * has already left chunks on disk -- including the chunk for the
795
- * dependency about to be dropped.
796
- *
797
- * Left in place, the `readdir` below picks that chunk up again, so the
798
- * retry re-audits the very thing it exists to exclude and fails the same
799
- * way; and where the first pass failed for some other reason, the dropped
800
- * dependency's code is shipped and folded into `rev`. rolldown has no
801
- * `emptyOutDir`, so nothing else clears it.
790
+ /**
791
+ * The builtins the first pass stubbed, each with the module that asked for
792
+ * it. Null on the second pass, which stubs nothing.
802
793
  */
803
- _context4.n = 4;
804
- return promises.rm(dir, {
805
- recursive: true,
806
- force: true
794
+ stubs = new Map();
795
+ _loop3 = /*#__PURE__*/regeneratorValues._regenerator().m(function _loop3() {
796
+ var shims, result, found, stubbed, _i5, _Object$entries3, _Object$entries3$_i, name, _Object$entries3$_i$, _native, reason, pins, skew, _iterator11, _step11, file, code, _t2, _t3;
797
+ return regeneratorValues._regenerator().w(function (_context6) {
798
+ while (1) switch (_context6.p = _context6.n) {
799
+ case 0:
800
+ if (!(forTarget.length === 0)) {
801
+ _context6.n = 2;
802
+ break;
803
+ }
804
+ _context6.n = 1;
805
+ return promises.rm(dir, {
806
+ recursive: true,
807
+ force: true
808
+ });
809
+ case 1:
810
+ return _context6.a(2, 0);
811
+ case 2:
812
+ _context6.n = 3;
813
+ return promises.rm(dir, {
814
+ recursive: true,
815
+ force: true
816
+ });
817
+ case 3:
818
+ _context6.n = 4;
819
+ return nodeShims(target.name === "worker");
820
+ case 4:
821
+ shims = _context6.v;
822
+ _context6.n = 5;
823
+ return rolldown.build({
824
+ input: Object.fromEntries(forTarget.map(function (name) {
825
+ return [name, input[name]];
826
+ })),
827
+ platform: target.platform,
828
+ plugins: [externaliseBase(target.baseFrom, platform), pinPlatformTanstack(platform), stubStartEntries(), stubServerEntries(target.name === "browser")].concat(regeneratorValues._toConsumableArray(stubs ? [stubUnbundlable(target.name === "browser", stubs)] : []), [
829
+ // Worker only: a browser has no Node builtins to bridge to, and a
830
+ // package reaching for one there is a real error rather than a missing
831
+ // runtime.
832
+ shims]),
833
+ transform: {
834
+ define: regeneratorValues._objectSpread2({
835
+ "process.env.NODE_ENV": JSON.stringify("production")
836
+ }, target.name === "worker" ? {
837
+ __filename: JSON.stringify("/worker.js"),
838
+ __dirname: JSON.stringify("/"),
839
+ "import.meta.url": JSON.stringify("file:///worker.js"),
840
+ /*
841
+ * There is no disk in here, and Val is the one dependency that
842
+ * assumes there is.
843
+ *
844
+ * It picks its storage mode by inference -- a content service
845
+ * when it finds an api key, the local filesystem otherwise --
846
+ * and the third mode, where the HOST hands over the source,
847
+ * cannot be inferred at all: it is chosen by passing
848
+ * `sourceFiles`, which only the app's own server file can do.
849
+ * `wireUp` writes that file, so a project the platform wired is
850
+ * already in the right mode.
851
+ *
852
+ * A project that brings its OWN server file is not, and the
853
+ * failure was `patch-error /bundle/.val/patches.lock: EPERM` --
854
+ * the isolate's read-only filesystem, named two layers below
855
+ * the decision that led there.
856
+ *
857
+ * So this says where the code is running and lets Val decide
858
+ * what that implies, rather than naming a Val mode. Which mode
859
+ * an isolate with no disk needs is Val's to know; that it IS an
860
+ * isolate with no disk is the only part the platform can
861
+ * actually vouch for, and the part that stays true if the modes
862
+ * are ever renamed or split. Harmless to every other
863
+ * dependency, and to a Val too old to look.
864
+ */
865
+ "process.env.VAL_ENV": JSON.stringify("app")
866
+ } : {})
867
+ },
868
+ resolve: regeneratorValues._objectSpread2({
869
+ conditionNames: target.conditions
870
+ }, "mainFields" in target ? {
871
+ mainFields: target.mainFields
872
+ } : {}),
873
+ output: {
874
+ dir: dir,
875
+ format: "esm",
876
+ entryFileNames: "[name].js",
877
+ chunkFileNames: "_p-[hash].js",
878
+ minify: true
879
+ },
880
+ onLog: function onLog(level, log, handler) {
881
+ // Quiet during the attribution probes: they are *expected* to fail, and
882
+ // the failures are reported afterwards with the specifier attached.
883
+ if (quiet) return;
884
+ // `__ns.default ?? __ns` warns for every package with no default
885
+ // export, which is the case the fallback exists for -- see stubSource.
886
+ if (log.code === "IMPORT_IS_UNDEFINED") return;
887
+ /*
888
+ * "use client" in a package being bundled for the worker.
889
+ *
890
+ * Every React package that ships the directive warns, once per module,
891
+ * and TanStack's router alone accounts for a dozen. They are expected
892
+ * and they are not actionable: this build has no client boundary to
893
+ * preserve, the shell owns that split, and nothing here reads the
894
+ * directive.
895
+ *
896
+ * Silenced because the noise did real harm. A successful publish ended
897
+ * with twenty of these and the reader took it for a failed one -- the
898
+ * line that says `published <project> @ <hash>` was the last of about
899
+ * two hundred, and everything above it looked like an error.
900
+ */
901
+ if (log.code === "MODULE_LEVEL_DIRECTIVE") return;
902
+ /*
903
+ * NOT silenced: UNRESOLVED_IMPORT. rolldown downgrades it to a warning
904
+ * and externalises the specifier, which is how an unresolvable bare
905
+ * import reaches the isolate and refuses to start. The audit below is
906
+ * what turns it into an error, and the warning is worth seeing.
907
+ */
908
+ handler(level, log);
909
+ }
910
+ });
911
+ case 5:
912
+ result = _context6.v;
913
+ if (!stubs) {
914
+ _context6.n = 6;
915
+ break;
916
+ }
917
+ found = stubbedEntries(result.output, stubs);
918
+ stubbed = result.output.some(function (item) {
919
+ return item.type === "chunk" && item.moduleIds.some(function (id) {
920
+ return id.startsWith(BROWSER_BUILTIN) || isNativeBinary(id);
921
+ });
922
+ });
923
+ stubs = null;
924
+ for (_i5 = 0, _Object$entries3 = Object.entries(found); _i5 < _Object$entries3.length; _i5++) {
925
+ _Object$entries3$_i = regeneratorValues._slicedToArray(_Object$entries3[_i5], 2), name = _Object$entries3$_i[0], _Object$entries3$_i$ = _Object$entries3$_i[1], _native = _Object$entries3$_i$["native"], reason = _Object$entries3$_i$.reason;
926
+ if (_native && target.name === "worker") unusable[name] = reason;else serverOnly[name] = reason;
927
+ }
928
+ // Nothing reached a stub, so this pass is the build: no second one.
929
+ // When something did -- even only a builtin behind an `import()`,
930
+ // which leaves every entry usable -- the output carries stubs and is
931
+ // built again without them, so what ships is what an unstubbed build
932
+ // makes.
933
+ if (!stubbed) {
934
+ _context6.n = 6;
935
+ break;
936
+ }
937
+ forTarget = forTarget.filter(function (name) {
938
+ return !(name in found);
939
+ });
940
+ return _context6.a(2, 1);
941
+ case 6:
942
+ // Before the import audit, which would otherwise report the same skew as
943
+ // a missing export -- true, and one step removed from the cause.
944
+ pins = platform.base.pins;
945
+ if (!pins) {
946
+ _context6.n = 8;
947
+ break;
948
+ }
949
+ _context6.n = 7;
950
+ return pinSkewOf(result.output.flatMap(function (item) {
951
+ return item.type === "chunk" ? item.moduleIds : [];
952
+ }), pins, packages);
953
+ case 7:
954
+ skew = _context6.v;
955
+ if (!skew.length) {
956
+ _context6.n = 8;
957
+ break;
958
+ }
959
+ throw new PinSkewError(skew, platform.base.rev);
960
+ case 8:
961
+ _t2 = regeneratorValues._createForOfIteratorHelper;
962
+ _context6.n = 9;
963
+ return promises.readdir(dir);
964
+ case 9:
965
+ _iterator11 = _t2(_context6.v.sort());
966
+ _context6.p = 10;
967
+ _iterator11.s();
968
+ case 11:
969
+ if ((_step11 = _iterator11.n()).done) {
970
+ _context6.n = 15;
971
+ break;
972
+ }
973
+ file = _step11.value;
974
+ _context6.n = 12;
975
+ return promises.readFile(node_path.join(dir, file), "utf8");
976
+ case 12:
977
+ code = _context6.v;
978
+ _context6.n = 13;
979
+ return auditImports(target, file, code, platform);
980
+ case 13:
981
+ // Worker entries are module-map keys and carry the directory; browser
982
+ // entries are served under `/_pvendor/<rev>/` and do not.
983
+ out[target.name][target.name === "worker" ? "pvendor/".concat(file) : file] = code;
984
+ digest.update("".concat(target.name, "/").concat(file));
985
+ digest.update(code);
986
+ case 14:
987
+ _context6.n = 11;
988
+ break;
989
+ case 15:
990
+ _context6.n = 17;
991
+ break;
992
+ case 16:
993
+ _context6.p = 16;
994
+ _t3 = _context6.v;
995
+ _iterator11.e(_t3);
996
+ case 17:
997
+ _context6.p = 17;
998
+ _iterator11.f();
999
+ return _context6.f(17);
1000
+ case 18:
1001
+ return _context6.a(2, 0);
1002
+ }
1003
+ }, _loop3, null, [[10, 16, 17, 18]]);
807
1004
  });
1005
+ case 3:
1006
+ return _context7.d(regeneratorValues._regeneratorValues(_loop3()), 4);
808
1007
  case 4:
809
- _context4.n = 5;
810
- return nodeShims(target.name === "worker");
811
- case 5:
812
- shims = _context4.v;
813
- _context4.n = 6;
814
- return rolldown.build({
815
- input: Object.fromEntries(forTarget.map(function (name) {
816
- return [name, input[name]];
817
- })),
818
- platform: target.platform,
819
- plugins: [externaliseBase(target.baseFrom, platform), pinPlatformTanstack(platform), stubStartEntries(), stubServerEntries(target.name === "browser"),
820
- // Worker only: a browser has no Node builtins to bridge to, and a
821
- // package reaching for one there is a real error rather than a missing
822
- // runtime.
823
- shims],
824
- transform: {
825
- define: regeneratorValues._objectSpread2({
826
- "process.env.NODE_ENV": JSON.stringify("production")
827
- }, target.name === "worker" ? {
828
- __filename: JSON.stringify("/worker.js"),
829
- __dirname: JSON.stringify("/"),
830
- "import.meta.url": JSON.stringify("file:///worker.js"),
831
- /*
832
- * There is no disk in here, and Val is the one dependency that
833
- * assumes there is.
834
- *
835
- * It picks its storage mode by inference -- a content service
836
- * when it finds an api key, the local filesystem otherwise --
837
- * and the third mode, where the HOST hands over the source,
838
- * cannot be inferred at all: it is chosen by passing
839
- * `sourceFiles`, which only the app's own server file can do.
840
- * `wireUp` writes that file, so a project the platform wired is
841
- * already in the right mode.
842
- *
843
- * A project that brings its OWN server file is not, and the
844
- * failure was `patch-error /bundle/.val/patches.lock: EPERM` --
845
- * the isolate's read-only filesystem, named two layers below
846
- * the decision that led there.
847
- *
848
- * So this says where the code is running and lets Val decide
849
- * what that implies, rather than naming a Val mode. Which mode
850
- * an isolate with no disk needs is Val's to know; that it IS an
851
- * isolate with no disk is the only part the platform can
852
- * actually vouch for, and the part that stays true if the modes
853
- * are ever renamed or split. Harmless to every other
854
- * dependency, and to a Val too old to look.
855
- */
856
- "process.env.VAL_ENV": JSON.stringify("app")
857
- } : {})
858
- },
859
- resolve: regeneratorValues._objectSpread2({
860
- conditionNames: target.conditions
861
- }, "mainFields" in target ? {
862
- mainFields: target.mainFields
863
- } : {}),
864
- output: {
865
- dir: dir,
866
- format: "esm",
867
- entryFileNames: "[name].js",
868
- chunkFileNames: "_p-[hash].js",
869
- minify: true
870
- },
871
- onLog: function onLog(level, log, handler) {
872
- // Quiet during the attribution probes: they are *expected* to fail, and
873
- // the failures are reported afterwards with the specifier attached.
874
- if (quiet) return;
875
- // `__ns.default ?? __ns` warns for every package with no default
876
- // export, which is the case the fallback exists for -- see stubSource.
877
- if (log.code === "IMPORT_IS_UNDEFINED") return;
878
- /*
879
- * "use client" in a package being bundled for the worker.
880
- *
881
- * Every React package that ships the directive warns, once per module,
882
- * and TanStack's router alone accounts for a dozen. They are expected
883
- * and they are not actionable: this build has no client boundary to
884
- * preserve, the shell owns that split, and nothing here reads the
885
- * directive.
886
- *
887
- * Silenced because the noise did real harm. A successful publish ended
888
- * with twenty of these and the reader took it for a failed one -- the
889
- * line that says `published <project> @ <hash>` was the last of about
890
- * two hundred, and everything above it looked like an error.
891
- */
892
- if (log.code === "MODULE_LEVEL_DIRECTIVE") return;
893
- /*
894
- * NOT silenced: UNRESOLVED_IMPORT. rolldown downgrades it to a warning
895
- * and externalises the specifier, which is how an unresolvable bare
896
- * import reaches the isolate and refuses to start. The audit below is
897
- * what turns it into an error, and the warning is worth seeing.
898
- */
899
- handler(level, log);
900
- }
901
- });
902
- case 6:
903
- result = _context4.v;
904
- // Before the import audit, which would otherwise report the same skew as
905
- // a missing export -- true, and one step removed from the cause.
906
- pins = platform.base.pins;
907
- if (!pins) {
908
- _context4.n = 8;
1008
+ _ret = _context7.v;
1009
+ if (!(_ret === 0)) {
1010
+ _context7.n = 5;
909
1011
  break;
910
1012
  }
911
- _context4.n = 7;
912
- return pinSkewOf(result.output.flatMap(function (item) {
913
- return item.type === "chunk" ? item.moduleIds : [];
914
- }), pins, packages);
915
- case 7:
916
- skew = _context4.v;
917
- if (!skew.length) {
918
- _context4.n = 8;
919
- break;
920
- }
921
- throw new PinSkewError(skew, platform.base.rev);
922
- case 8:
923
- _t2 = regeneratorValues._createForOfIteratorHelper;
924
- _context4.n = 9;
925
- return promises.readdir(dir);
926
- case 9:
927
- _iterator1 = _t2(_context4.v.sort());
928
- _context4.p = 10;
929
- _iterator1.s();
930
- case 11:
931
- if ((_step1 = _iterator1.n()).done) {
932
- _context4.n = 15;
1013
+ return _context7.a(3, 7);
1014
+ case 5:
1015
+ if (!(_ret === 1)) {
1016
+ _context7.n = 6;
933
1017
  break;
934
1018
  }
935
- file = _step1.value;
936
- _context4.n = 12;
937
- return promises.readFile(node_path.join(dir, file), "utf8");
938
- case 12:
939
- code = _context4.v;
940
- _context4.n = 13;
941
- return auditImports(target, file, code, platform);
942
- case 13:
943
- // Worker entries are module-map keys and carry the directory; browser
944
- // entries are served under `/_pvendor/<rev>/` and do not.
945
- out[target.name][target.name === "worker" ? "pvendor/".concat(file) : file] = code;
946
- digest.update("".concat(target.name, "/").concat(file));
947
- digest.update(code);
948
- case 14:
949
- _context4.n = 11;
950
- break;
951
- case 15:
952
- _context4.n = 17;
1019
+ return _context7.a(3, 6);
1020
+ case 6:
1021
+ _context7.n = 3;
953
1022
  break;
954
- case 16:
955
- _context4.p = 16;
956
- _t3 = _context4.v;
957
- _iterator1.e(_t3);
958
- case 17:
959
- _context4.p = 17;
960
- _iterator1.f();
961
- return _context4.f(17);
962
- case 18:
963
- _context4.n = 2;
1023
+ case 7:
1024
+ _context7.n = 2;
964
1025
  break;
965
- case 19:
966
- _context4.n = 21;
1026
+ case 8:
1027
+ _context7.n = 10;
967
1028
  break;
968
- case 20:
969
- _context4.p = 20;
970
- _t4 = _context4.v;
971
- _iterator0.e(_t4);
972
- case 21:
973
- _context4.p = 21;
974
- _iterator0.f();
975
- return _context4.f(21);
976
- case 22:
977
- return _context4.a(2, regeneratorValues._objectSpread2(regeneratorValues._objectSpread2({}, out), {}, {
1029
+ case 9:
1030
+ _context7.p = 9;
1031
+ _t4 = _context7.v;
1032
+ _iterator10.e(_t4);
1033
+ case 10:
1034
+ _context7.p = 10;
1035
+ _iterator10.f();
1036
+ return _context7.f(10);
1037
+ case 11:
1038
+ return _context7.a(2, regeneratorValues._objectSpread2(regeneratorValues._objectSpread2({}, out), {}, {
1039
+ serverOnly: serverOnly,
1040
+ unusable: unusable,
978
1041
  rev: digest.digest("hex").slice(0, 16)
979
1042
  }));
980
1043
  }
981
- }, _callee4, null, [[10, 16, 17, 18], [1, 20, 21, 22]]);
1044
+ }, _callee6, null, [[1, 9, 10, 11]]);
982
1045
  }));
983
1046
  return _buildTargets.apply(this, arguments);
984
1047
  }
1048
+ function stubbedEntries(output, builtins) {
1049
+ var chunks = new Map();
1050
+ var _iterator2 = regeneratorValues._createForOfIteratorHelper(output),
1051
+ _step2;
1052
+ try {
1053
+ for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
1054
+ var item = _step2.value;
1055
+ if (item.type === "chunk") chunks.set(item.fileName, item);
1056
+ }
1057
+ } catch (err) {
1058
+ _iterator2.e(err);
1059
+ } finally {
1060
+ _iterator2.f();
1061
+ }
1062
+ var reach = function reach(entry, dynamic) {
1063
+ var seen = new Set([entry.fileName]);
1064
+ var queue = [entry];
1065
+ var ids = [];
1066
+ for (var chunk = queue.shift(); chunk; chunk = queue.shift()) {
1067
+ ids.push.apply(ids, regeneratorValues._toConsumableArray(chunk.moduleIds));
1068
+ for (var _i = 0, _arr = [].concat(regeneratorValues._toConsumableArray(chunk.imports), regeneratorValues._toConsumableArray(dynamic ? chunk.dynamicImports : [])); _i < _arr.length; _i++) {
1069
+ var file = _arr[_i];
1070
+ var next = chunks.get(file);
1071
+ if (next && !seen.has(file)) {
1072
+ seen.add(file);
1073
+ queue.push(next);
1074
+ }
1075
+ }
1076
+ }
1077
+ return ids;
1078
+ };
1079
+ var found = {};
1080
+ var _iterator3 = regeneratorValues._createForOfIteratorHelper(chunks.values()),
1081
+ _step3;
1082
+ try {
1083
+ for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
1084
+ var entry = _step3.value;
1085
+ if (!entry.isEntry) continue;
1086
+ var binary = reach(entry, true).filter(isNativeBinary).sort()[0];
1087
+ if (binary !== undefined) {
1088
+ found[entry.name] = {
1089
+ "native": true,
1090
+ reason: "loads the native binary ".concat(packagePathOf(binary), ", which cannot be bundled")
1091
+ };
1092
+ continue;
1093
+ }
1094
+ var builtin = reach(entry, false).filter(function (id) {
1095
+ return id.startsWith(BROWSER_BUILTIN);
1096
+ }).map(function (id) {
1097
+ return id.slice(BROWSER_BUILTIN.length);
1098
+ }).sort()[0];
1099
+ if (builtin === undefined) continue;
1100
+ var importer = builtins.get(builtin);
1101
+ found[entry.name] = {
1102
+ "native": false,
1103
+ reason: "reaches Node's '".concat(builtin, "'") + (importer ? " (imported by ".concat(importer, ")") : "") + ", which a browser does not have"
1104
+ };
1105
+ }
1106
+ } catch (err) {
1107
+ _iterator3.e(err);
1108
+ } finally {
1109
+ _iterator3.f();
1110
+ }
1111
+ return found;
1112
+ }
1113
+
1114
+ /**
1115
+ * Start's per-project `imports` subpaths, stubbed for the project layer.
1116
+ *
1117
+ * `@tanstack/start-server-core` dynamically imports the app's router and server
1118
+ * entry through these, and Start's Vite plugin fills them in per project. It is
1119
+ * not in the base layer -- the shell needs its own copy, with those resolved
1120
+ * for real -- so a project dependency that merely *reaches* start-server-core
1121
+ * has nothing to resolve them to and cannot be built at all.
1122
+ *
1123
+ * Stubbed here rather than left unresolved, because the dependency almost
1124
+ * certainly wants a request helper or the storage context, not a second Start
1125
+ * handler. If one really does create a handler, this throws with a message
1126
+ * saying so instead of failing the layer build with a bare specifier.
1127
+ */
985
1128
  var START_ENTRY_STUB = "\nexport function getRouter() {\n throw new Error(\n 'A project dependency tried to create a TanStack Start handler. The platform ' +\n 'shell is the handler here, so a dependency cannot create a second one.',\n )\n}\nexport default { getRouter }\n";
986
1129
  var PER_PROJECT_ENTRIES = ["#tanstack-router-entry", "#tanstack-start-entry"];
987
1130
 
@@ -1026,6 +1169,139 @@ function stubServerEntries(browser) {
1026
1169
  }
1027
1170
  };
1028
1171
  }
1172
+
1173
+ /**
1174
+ * What a first pass stubs, so that it builds: a module that throws, in place
1175
+ * of an import that cannot be bundled.
1176
+ *
1177
+ * - **Node builtins, on the browser side.** A server-only dependency is the
1178
+ * usual case, not the odd one: `@valbuild/tanstack/server` and
1179
+ * `@valbuild/mcp` reach `path` through Val's server, and `sharp` reaches
1180
+ * `node:util`.
1181
+ * - **Native binaries (`.node`), on both.** `@tailwindcss/vite` is in every
1182
+ * template's `dependencies` and loads one; nothing can bundle it.
1183
+ *
1184
+ * Left alone, any one of these failed the layer's single build, and since a
1185
+ * failed build does not say which entry pulled the file in, every dependency
1186
+ * was then built on its own for both targets to find out: twenty-six builds
1187
+ * where two would do, re-bundling Val's server once per entry that shares it,
1188
+ * at 3.2 GB.
1189
+ *
1190
+ * Stubbed, the build succeeds, and its output says which entries load a stub
1191
+ * (`stubbedEntries`): those are server-only, or for a binary, not layered at
1192
+ * all, each named with the reason. Then the target is built again without
1193
+ * them, unstubbed, so what ships is what an unstubbed build of the rest makes.
1194
+ *
1195
+ * A bare name is only a builtin when nothing resolves it. `events`, `buffer`
1196
+ * and `util` are also npm packages that exist to be bundled for a browser, and
1197
+ * a project that has one installed gets that package, as it always did. The
1198
+ * `node:` scheme is never a package.
1199
+ */
1200
+ var BROWSER_BUILTIN = "\0platform:browser-builtin:";
1201
+ var isNativeBinary = function isNativeBinary(id) {
1202
+ return id.endsWith(".node");
1203
+ };
1204
+ function stubUnbundlable(browser, reached) {
1205
+ return {
1206
+ name: "platform:unbundlable",
1207
+ resolveId: function resolveId(source, importer) {
1208
+ var _this2 = this;
1209
+ return regeneratorValues._asyncToGenerator(/*#__PURE__*/regeneratorValues._regenerator().m(function _callee() {
1210
+ var installed, by, before;
1211
+ return regeneratorValues._regenerator().w(function (_context) {
1212
+ while (1) switch (_context.n) {
1213
+ case 0:
1214
+ if (browser) {
1215
+ _context.n = 1;
1216
+ break;
1217
+ }
1218
+ return _context.a(2, null);
1219
+ case 1:
1220
+ if (source.startsWith("node:")) {
1221
+ _context.n = 4;
1222
+ break;
1223
+ }
1224
+ if (isRuntimeBuiltin(source)) {
1225
+ _context.n = 2;
1226
+ break;
1227
+ }
1228
+ return _context.a(2, null);
1229
+ case 2:
1230
+ _context.n = 3;
1231
+ return _this2.resolve(source, importer, {
1232
+ skipSelf: true
1233
+ });
1234
+ case 3:
1235
+ installed = _context.v;
1236
+ if (!(installed && !installed.external)) {
1237
+ _context.n = 4;
1238
+ break;
1239
+ }
1240
+ return _context.a(2, null);
1241
+ case 4:
1242
+ by = importer ? packagePathOf(importer) : "";
1243
+ before = reached.get(source); // The smallest, so the reason reads the same however resolution was
1244
+ // scheduled.
1245
+ if (before === undefined || by && by < before) reached.set(source, by);
1246
+ return _context.a(2, BROWSER_BUILTIN + source);
1247
+ }
1248
+ }, _callee);
1249
+ }))();
1250
+ },
1251
+ /*
1252
+ * Throws when evaluated, and exports every name the real builtin has.
1253
+ * The names are what keep this pass a build: `import { randomUUID } from
1254
+ * 'node:crypto'` against a stub with no exports is a MISSING_EXPORT, which
1255
+ * fails the build and sent the layer down the per-dependency path anyway.
1256
+ * The throw comes LAST: rolldown drops what follows a top-level throw as
1257
+ * unreachable, exports included, and the names are missing again.
1258
+ */
1259
+ load: function load(id) {
1260
+ return regeneratorValues._asyncToGenerator(/*#__PURE__*/regeneratorValues._regenerator().m(function _callee2() {
1261
+ var builtin, real, names;
1262
+ return regeneratorValues._regenerator().w(function (_context2) {
1263
+ while (1) switch (_context2.n) {
1264
+ case 0:
1265
+ if (!isNativeBinary(id)) {
1266
+ _context2.n = 1;
1267
+ break;
1268
+ }
1269
+ return _context2.a(2, {
1270
+ code: "throw new Error(".concat(JSON.stringify("".concat(packagePathOf(id), " is a native binary, which cannot be bundled.")), ");"),
1271
+ moduleType: "js"
1272
+ });
1273
+ case 1:
1274
+ if (id.startsWith(BROWSER_BUILTIN)) {
1275
+ _context2.n = 2;
1276
+ break;
1277
+ }
1278
+ return _context2.a(2, null);
1279
+ case 2:
1280
+ builtin = id.slice(BROWSER_BUILTIN.length);
1281
+ _context2.n = 3;
1282
+ return (function (t) { return Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require(t)); }); })("node:".concat(builtin.replace(/^node:/, "")))["catch"](function () {
1283
+ return {};
1284
+ });
1285
+ case 3:
1286
+ real = _context2.v;
1287
+ names = Object.keys(real).filter(function (key) {
1288
+ return key !== "default" && /^[A-Za-z_$][A-Za-z0-9_$]*$/.test(key);
1289
+ });
1290
+ return _context2.a(2, ["const none = undefined;", "export { ".concat(["none as default"].concat(regeneratorValues._toConsumableArray(names.map(function (name) {
1291
+ return "none as ".concat(name);
1292
+ }))).join(", "), " };"), "throw new Error(".concat(JSON.stringify("Node's '".concat(builtin, "' is not available in a browser.")), ");")].join("\n"));
1293
+ }
1294
+ }, _callee2);
1295
+ }))();
1296
+ }
1297
+ };
1298
+ }
1299
+
1300
+ /** `…/node_modules/.pnpm/x/node_modules/@scope/pkg/dist/a.js` -> `@scope/pkg/dist/a.js`. */
1301
+ var packagePathOf = function packagePathOf(id) {
1302
+ var at = id.lastIndexOf("node_modules/");
1303
+ return at === -1 ? id : id.slice(at + "node_modules/".length);
1304
+ };
1029
1305
  function stubStartEntries() {
1030
1306
  var prefix = "\0platform:start-entry:";
1031
1307
  return {
@@ -1179,66 +1455,132 @@ var nameOf = function nameOf(node) {
1179
1455
  node.value : null;
1180
1456
  };
1181
1457
  var parseModule = /*#__PURE__*/function () {
1182
- var _ref3 = regeneratorValues._asyncToGenerator(/*#__PURE__*/regeneratorValues._regenerator().m(function _callee(code, file) {
1183
- return regeneratorValues._regenerator().w(function (_context) {
1184
- while (1) switch (_context.n) {
1458
+ var _ref3 = regeneratorValues._asyncToGenerator(/*#__PURE__*/regeneratorValues._regenerator().m(function _callee3(code, file) {
1459
+ return regeneratorValues._regenerator().w(function (_context3) {
1460
+ while (1) switch (_context3.n) {
1185
1461
  case 0:
1186
- _context.n = 1;
1462
+ _context3.n = 1;
1187
1463
  return parseAst.parseAstAsync(code, {
1188
1464
  lang: "js"
1189
1465
  }, file);
1190
1466
  case 1:
1191
- return _context.a(2, _context.v);
1467
+ return _context3.a(2, _context3.v);
1192
1468
  }
1193
- }, _callee);
1469
+ }, _callee3);
1194
1470
  }));
1195
1471
  return function parseModule(_x1, _x10) {
1196
1472
  return _ref3.apply(this, arguments);
1197
1473
  };
1198
1474
  }();
1199
1475
 
1476
+ /**
1477
+ * The text of every import and re-export statement in a chunk, and nothing
1478
+ * else, as one small module.
1479
+ *
1480
+ * A lexer finds them and the parser below reads only them. Parsing the whole
1481
+ * chunk was the most expensive thing left in a layer build: Val's server chunk
1482
+ * is 20 MB, and its syntax tree cost about 650 MB and 4 s to learn the dozen
1483
+ * statements at its top. The lexer knows strings, comments, template literals
1484
+ * and regular expressions, so a `from "mod"` inside a string is not a
1485
+ * statement -- which is the reason this is not a regular expression (see
1486
+ * above).
1487
+ *
1488
+ * Null when the lexer cannot read the chunk, and the caller parses all of it,
1489
+ * as it did before.
1490
+ */
1491
+ function importStatementsOf(_x11) {
1492
+ return _importStatementsOf.apply(this, arguments);
1493
+ }
1200
1494
  /** Every import and re-export a chunk emits, with the names it takes. */
1201
- function auditableImports(_x11, _x12) {
1495
+ function _importStatementsOf() {
1496
+ _importStatementsOf = regeneratorValues._asyncToGenerator(/*#__PURE__*/regeneratorValues._regenerator().m(function _callee7(code) {
1497
+ var _lexModule, _lexModule2, imports;
1498
+ return regeneratorValues._regenerator().w(function (_context8) {
1499
+ while (1) switch (_context8.p = _context8.n) {
1500
+ case 0:
1501
+ _context8.n = 1;
1502
+ return esModuleLexer.init;
1503
+ case 1:
1504
+ _context8.p = 1;
1505
+ _lexModule = esModuleLexer.parse(code), _lexModule2 = regeneratorValues._slicedToArray(_lexModule, 1), imports = _lexModule2[0];
1506
+ return _context8.a(2, imports.filter(function (entry) {
1507
+ return entry.t === esModuleLexer.ImportType.Static;
1508
+ }).map(function (entry) {
1509
+ return code.slice(entry.ss, entry.se);
1510
+ }).join(";\n"));
1511
+ case 2:
1512
+ _context8.p = 2;
1513
+ _context8.v;
1514
+ return _context8.a(2, null);
1515
+ }
1516
+ }, _callee7, null, [[1, 2]]);
1517
+ }));
1518
+ return _importStatementsOf.apply(this, arguments);
1519
+ }
1520
+ function auditableImports(_x12, _x13) {
1202
1521
  return _auditableImports.apply(this, arguments);
1203
1522
  }
1204
1523
  function _auditableImports() {
1205
- _auditableImports = regeneratorValues._asyncToGenerator(/*#__PURE__*/regeneratorValues._regenerator().m(function _callee5(code, file) {
1206
- var ast, imports, _iterator10, _step10, _statement$source, _statement$specifiers, statement, source, names, _iterator11, _step11, specifier, name, _name, _t5;
1207
- return regeneratorValues._regenerator().w(function (_context5) {
1208
- while (1) switch (_context5.p = _context5.n) {
1524
+ _auditableImports = regeneratorValues._asyncToGenerator(/*#__PURE__*/regeneratorValues._regenerator().m(function _callee8(code, file) {
1525
+ var _yield$importStatemen;
1526
+ var ast, imports, _iterator12, _step12, _statement$source, _statement$specifiers, statement, source, names, _iterator13, _step13, specifier, name, _name, _t6, _t7, _t8, _t9, _t0;
1527
+ return regeneratorValues._regenerator().w(function (_context9) {
1528
+ while (1) switch (_context9.p = _context9.n) {
1209
1529
  case 0:
1210
- _context5.n = 1;
1211
- return parseModule(code, file);
1530
+ _t6 = parseModule;
1531
+ _context9.n = 1;
1532
+ return importStatementsOf(code);
1212
1533
  case 1:
1213
- ast = _context5.v;
1214
- imports = [];
1215
- _iterator10 = regeneratorValues._createForOfIteratorHelper(ast.body);
1216
- _context5.p = 2;
1217
- _iterator10.s();
1534
+ _t8 = _yield$importStatemen = _context9.v;
1535
+ _t7 = _t8 !== null;
1536
+ if (!_t7) {
1537
+ _context9.n = 2;
1538
+ break;
1539
+ }
1540
+ _t7 = _yield$importStatemen !== void 0;
1541
+ case 2:
1542
+ if (!_t7) {
1543
+ _context9.n = 3;
1544
+ break;
1545
+ }
1546
+ _t9 = _yield$importStatemen;
1547
+ _context9.n = 4;
1548
+ break;
1218
1549
  case 3:
1219
- if ((_step10 = _iterator10.n()).done) {
1220
- _context5.n = 7;
1550
+ _t9 = code;
1551
+ case 4:
1552
+ _context9.n = 5;
1553
+ return _t6(_t9, file);
1554
+ case 5:
1555
+ ast = _context9.v;
1556
+ imports = [];
1557
+ _iterator12 = regeneratorValues._createForOfIteratorHelper(ast.body);
1558
+ _context9.p = 6;
1559
+ _iterator12.s();
1560
+ case 7:
1561
+ if ((_step12 = _iterator12.n()).done) {
1562
+ _context9.n = 11;
1221
1563
  break;
1222
1564
  }
1223
- statement = _step10.value;
1565
+ statement = _step12.value;
1224
1566
  if (!(statement.type !== "ImportDeclaration" && statement.type !== "ExportNamedDeclaration" && statement.type !== "ExportAllDeclaration")) {
1225
- _context5.n = 4;
1567
+ _context9.n = 8;
1226
1568
  break;
1227
1569
  }
1228
- return _context5.a(3, 6);
1229
- case 4:
1570
+ return _context9.a(3, 10);
1571
+ case 8:
1230
1572
  source = (_statement$source = statement.source) === null || _statement$source === void 0 ? void 0 : _statement$source.value;
1231
1573
  if (!(typeof source !== "string")) {
1232
- _context5.n = 5;
1574
+ _context9.n = 9;
1233
1575
  break;
1234
1576
  }
1235
- return _context5.a(3, 6);
1236
- case 5:
1577
+ return _context9.a(3, 10);
1578
+ case 9:
1237
1579
  names = [];
1238
- _iterator11 = regeneratorValues._createForOfIteratorHelper((_statement$specifiers = statement.specifiers) !== null && _statement$specifiers !== void 0 ? _statement$specifiers : []);
1580
+ _iterator13 = regeneratorValues._createForOfIteratorHelper((_statement$specifiers = statement.specifiers) !== null && _statement$specifiers !== void 0 ? _statement$specifiers : []);
1239
1581
  try {
1240
- for (_iterator11.s(); !(_step11 = _iterator11.n()).done;) {
1241
- specifier = _step11.value;
1582
+ for (_iterator13.s(); !(_step13 = _iterator13.n()).done;) {
1583
+ specifier = _step13.value;
1242
1584
  if (specifier.type === "ImportDefaultSpecifier") names.push("default");else if (specifier.type === "ImportSpecifier") {
1243
1585
  name = nameOf(specifier.imported);
1244
1586
  if (name) names.push(name);
@@ -1251,36 +1593,36 @@ function _auditableImports() {
1251
1593
  // whatever is there.
1252
1594
  }
1253
1595
  } catch (err) {
1254
- _iterator11.e(err);
1596
+ _iterator13.e(err);
1255
1597
  } finally {
1256
- _iterator11.f();
1598
+ _iterator13.f();
1257
1599
  }
1258
1600
  imports.push({
1259
1601
  source: source,
1260
1602
  names: names
1261
1603
  });
1262
- case 6:
1263
- _context5.n = 3;
1604
+ case 10:
1605
+ _context9.n = 7;
1264
1606
  break;
1265
- case 7:
1266
- _context5.n = 9;
1607
+ case 11:
1608
+ _context9.n = 13;
1267
1609
  break;
1268
- case 8:
1269
- _context5.p = 8;
1270
- _t5 = _context5.v;
1271
- _iterator10.e(_t5);
1272
- case 9:
1273
- _context5.p = 9;
1274
- _iterator10.f();
1275
- return _context5.f(9);
1276
- case 10:
1277
- return _context5.a(2, imports);
1610
+ case 12:
1611
+ _context9.p = 12;
1612
+ _t0 = _context9.v;
1613
+ _iterator12.e(_t0);
1614
+ case 13:
1615
+ _context9.p = 13;
1616
+ _iterator12.f();
1617
+ return _context9.f(13);
1618
+ case 14:
1619
+ return _context9.a(2, imports);
1278
1620
  }
1279
- }, _callee5, null, [[2, 8, 9, 10]]);
1621
+ }, _callee8, null, [[6, 12, 13, 14]]);
1280
1622
  }));
1281
1623
  return _auditableImports.apply(this, arguments);
1282
1624
  }
1283
- function auditableSpecifiers(_x13, _x14) {
1625
+ function auditableSpecifiers(_x14, _x15) {
1284
1626
  return _auditableSpecifiers.apply(this, arguments);
1285
1627
  }
1286
1628
 
@@ -1300,138 +1642,138 @@ function auditableSpecifiers(_x13, _x14) {
1300
1642
  * platform's.
1301
1643
  */
1302
1644
  function _auditableSpecifiers() {
1303
- _auditableSpecifiers = regeneratorValues._asyncToGenerator(/*#__PURE__*/regeneratorValues._regenerator().m(function _callee6(code, file) {
1304
- return regeneratorValues._regenerator().w(function (_context6) {
1305
- while (1) switch (_context6.n) {
1645
+ _auditableSpecifiers = regeneratorValues._asyncToGenerator(/*#__PURE__*/regeneratorValues._regenerator().m(function _callee9(code, file) {
1646
+ return regeneratorValues._regenerator().w(function (_context0) {
1647
+ while (1) switch (_context0.n) {
1306
1648
  case 0:
1307
- _context6.n = 1;
1649
+ _context0.n = 1;
1308
1650
  return auditableImports(code, file);
1309
1651
  case 1:
1310
- return _context6.a(2, _context6.v.map(function (entry) {
1652
+ return _context0.a(2, _context0.v.map(function (entry) {
1311
1653
  return entry.source;
1312
1654
  }));
1313
1655
  }
1314
- }, _callee6);
1656
+ }, _callee9);
1315
1657
  }));
1316
1658
  return _auditableSpecifiers.apply(this, arguments);
1317
1659
  }
1318
- function baseChunkExports(_x15, _x16, _x17) {
1660
+ function baseChunkExports(_x16, _x17, _x18) {
1319
1661
  return _baseChunkExports.apply(this, arguments);
1320
1662
  }
1321
1663
  function _baseChunkExports() {
1322
- _baseChunkExports = regeneratorValues._asyncToGenerator(/*#__PURE__*/regeneratorValues._regenerator().m(function _callee7(target, specifier, platform) {
1323
- var dist, _platform$base$export, chunk, chunks, listed, file, code, ast, exported, _iterator12, _step12, _declaration$id, _statement$specifiers2, _declaration$declarat, statement, _iterator13, _step13, specifierNode, name, declaration, _iterator14, _step14, _declarator$id, declarator, _t7;
1324
- return regeneratorValues._regenerator().w(function (_context7) {
1325
- while (1) switch (_context7.p = _context7.n) {
1664
+ _baseChunkExports = regeneratorValues._asyncToGenerator(/*#__PURE__*/regeneratorValues._regenerator().m(function _callee0(target, specifier, platform) {
1665
+ var dist, _platform$base$export, chunk, chunks, listed, file, code, ast, exported, _iterator14, _step14, _declaration$id, _statement$specifiers2, _declaration$declarat, statement, _iterator15, _step15, specifierNode, name, declaration, _iterator16, _step16, _declarator$id, declarator, _t10;
1666
+ return regeneratorValues._regenerator().w(function (_context1) {
1667
+ while (1) switch (_context1.p = _context1.n) {
1326
1668
  case 0:
1327
1669
  dist = platform.baseLayerDir;
1328
1670
  if (dist) {
1329
- _context7.n = 1;
1671
+ _context1.n = 1;
1330
1672
  break;
1331
1673
  }
1332
1674
  chunk = specifier.slice(target.baseFrom.length).replace(/\.js$/, "");
1333
1675
  chunks = (_platform$base$export = platform.base.exports) === null || _platform$base$export === void 0 ? void 0 : _platform$base$export[target.name]; // Own keys only: a chunk named like an Object.prototype member must not
1334
1676
  // read back a function.
1335
1677
  listed = chunks && Object.hasOwn(chunks, chunk) ? chunks[chunk] : undefined;
1336
- return _context7.a(2, listed ? new Set(listed) : null);
1678
+ return _context1.a(2, listed ? new Set(listed) : null);
1337
1679
  case 1:
1338
1680
  file = node_path.join(dist, target.name, "vendor", specifier.slice(target.baseFrom.length));
1339
- _context7.p = 2;
1340
- _context7.n = 3;
1681
+ _context1.p = 2;
1682
+ _context1.n = 3;
1341
1683
  return promises.readFile(file, "utf8");
1342
1684
  case 3:
1343
- code = _context7.v;
1344
- _context7.n = 5;
1685
+ code = _context1.v;
1686
+ _context1.n = 5;
1345
1687
  break;
1346
1688
  case 4:
1347
- _context7.p = 4;
1348
- _context7.v;
1349
- return _context7.a(2, null);
1689
+ _context1.p = 4;
1690
+ _context1.v;
1691
+ return _context1.a(2, null);
1350
1692
  case 5:
1351
- _context7.n = 6;
1693
+ _context1.n = 6;
1352
1694
  return parseModule(code, file);
1353
1695
  case 6:
1354
- ast = _context7.v;
1696
+ ast = _context1.v;
1355
1697
  exported = new Set();
1356
- _iterator12 = regeneratorValues._createForOfIteratorHelper(ast.body);
1357
- _context7.p = 7;
1358
- _iterator12.s();
1698
+ _iterator14 = regeneratorValues._createForOfIteratorHelper(ast.body);
1699
+ _context1.p = 7;
1700
+ _iterator14.s();
1359
1701
  case 8:
1360
- if ((_step12 = _iterator12.n()).done) {
1361
- _context7.n = 13;
1702
+ if ((_step14 = _iterator14.n()).done) {
1703
+ _context1.n = 13;
1362
1704
  break;
1363
1705
  }
1364
- statement = _step12.value;
1706
+ statement = _step14.value;
1365
1707
  if (!(statement.type === "ExportAllDeclaration")) {
1366
- _context7.n = 9;
1708
+ _context1.n = 9;
1367
1709
  break;
1368
1710
  }
1369
- return _context7.a(2, null);
1711
+ return _context1.a(2, null);
1370
1712
  case 9:
1371
1713
  if (!(statement.type === "ExportDefaultDeclaration")) {
1372
- _context7.n = 10;
1714
+ _context1.n = 10;
1373
1715
  break;
1374
1716
  }
1375
1717
  exported.add("default");
1376
- return _context7.a(3, 12);
1718
+ return _context1.a(3, 12);
1377
1719
  case 10:
1378
1720
  if (!(statement.type !== "ExportNamedDeclaration")) {
1379
- _context7.n = 11;
1721
+ _context1.n = 11;
1380
1722
  break;
1381
1723
  }
1382
- return _context7.a(3, 12);
1724
+ return _context1.a(3, 12);
1383
1725
  case 11:
1384
- _iterator13 = regeneratorValues._createForOfIteratorHelper((_statement$specifiers2 = statement.specifiers) !== null && _statement$specifiers2 !== void 0 ? _statement$specifiers2 : []);
1726
+ _iterator15 = regeneratorValues._createForOfIteratorHelper((_statement$specifiers2 = statement.specifiers) !== null && _statement$specifiers2 !== void 0 ? _statement$specifiers2 : []);
1385
1727
  try {
1386
- for (_iterator13.s(); !(_step13 = _iterator13.n()).done;) {
1387
- specifierNode = _step13.value;
1728
+ for (_iterator15.s(); !(_step15 = _iterator15.n()).done;) {
1729
+ specifierNode = _step15.value;
1388
1730
  name = nameOf(specifierNode.exported);
1389
1731
  if (name) exported.add(name);
1390
1732
  }
1391
1733
  // `export const x = ...` / `export function x() {}`, which a hand-written
1392
1734
  // chunk can carry even though a bundled one usually does not.
1393
1735
  } catch (err) {
1394
- _iterator13.e(err);
1736
+ _iterator15.e(err);
1395
1737
  } finally {
1396
- _iterator13.f();
1738
+ _iterator15.f();
1397
1739
  }
1398
1740
  declaration = statement.declaration;
1399
1741
  if (declaration !== null && declaration !== void 0 && (_declaration$id = declaration.id) !== null && _declaration$id !== void 0 && _declaration$id.name) exported.add(declaration.id.name);
1400
- _iterator14 = regeneratorValues._createForOfIteratorHelper((_declaration$declarat = declaration === null || declaration === void 0 ? void 0 : declaration.declarations) !== null && _declaration$declarat !== void 0 ? _declaration$declarat : []);
1742
+ _iterator16 = regeneratorValues._createForOfIteratorHelper((_declaration$declarat = declaration === null || declaration === void 0 ? void 0 : declaration.declarations) !== null && _declaration$declarat !== void 0 ? _declaration$declarat : []);
1401
1743
  try {
1402
- for (_iterator14.s(); !(_step14 = _iterator14.n()).done;) {
1403
- declarator = _step14.value;
1744
+ for (_iterator16.s(); !(_step16 = _iterator16.n()).done;) {
1745
+ declarator = _step16.value;
1404
1746
  if (((_declarator$id = declarator.id) === null || _declarator$id === void 0 ? void 0 : _declarator$id.type) === "Identifier" && declarator.id.name) {
1405
1747
  exported.add(declarator.id.name);
1406
1748
  }
1407
1749
  }
1408
1750
  } catch (err) {
1409
- _iterator14.e(err);
1751
+ _iterator16.e(err);
1410
1752
  } finally {
1411
- _iterator14.f();
1753
+ _iterator16.f();
1412
1754
  }
1413
1755
  case 12:
1414
- _context7.n = 8;
1756
+ _context1.n = 8;
1415
1757
  break;
1416
1758
  case 13:
1417
- _context7.n = 15;
1759
+ _context1.n = 15;
1418
1760
  break;
1419
1761
  case 14:
1420
- _context7.p = 14;
1421
- _t7 = _context7.v;
1422
- _iterator12.e(_t7);
1762
+ _context1.p = 14;
1763
+ _t10 = _context1.v;
1764
+ _iterator14.e(_t10);
1423
1765
  case 15:
1424
- _context7.p = 15;
1425
- _iterator12.f();
1426
- return _context7.f(15);
1766
+ _context1.p = 15;
1767
+ _iterator14.f();
1768
+ return _context1.f(15);
1427
1769
  case 16:
1428
- return _context7.a(2, exported);
1770
+ return _context1.a(2, exported);
1429
1771
  }
1430
- }, _callee7, null, [[7, 14, 15, 16], [2, 4]]);
1772
+ }, _callee0, null, [[7, 14, 15, 16], [2, 4]]);
1431
1773
  }));
1432
1774
  return _baseChunkExports.apply(this, arguments);
1433
1775
  }
1434
- function auditImports(_x18, _x19, _x20, _x21) {
1776
+ function auditImports(_x19, _x20, _x21, _x22) {
1435
1777
  return _auditImports.apply(this, arguments);
1436
1778
  }
1437
1779
  /**
@@ -1461,62 +1803,62 @@ function auditImports(_x18, _x19, _x20, _x21) {
1461
1803
  * endpoint answers 500 forever.
1462
1804
  */
1463
1805
  function _auditImports() {
1464
- _auditImports = regeneratorValues._asyncToGenerator(/*#__PURE__*/regeneratorValues._regenerator().m(function _callee8(target, file, code, platform) {
1465
- var _iterator15, _step15, _step15$value, specifier, names, intoBase, intoSelf, builtin, _t8, _t9;
1466
- return regeneratorValues._regenerator().w(function (_context8) {
1467
- while (1) switch (_context8.p = _context8.n) {
1806
+ _auditImports = regeneratorValues._asyncToGenerator(/*#__PURE__*/regeneratorValues._regenerator().m(function _callee1(target, file, code, platform) {
1807
+ var _iterator17, _step17, _step17$value, specifier, names, intoBase, intoSelf, builtin, _t11, _t12;
1808
+ return regeneratorValues._regenerator().w(function (_context10) {
1809
+ while (1) switch (_context10.p = _context10.n) {
1468
1810
  case 0:
1469
- _t8 = regeneratorValues._createForOfIteratorHelper;
1470
- _context8.n = 1;
1811
+ _t11 = regeneratorValues._createForOfIteratorHelper;
1812
+ _context10.n = 1;
1471
1813
  return auditableImports(code, file);
1472
1814
  case 1:
1473
- _iterator15 = _t8(_context8.v);
1474
- _context8.p = 2;
1475
- _iterator15.s();
1815
+ _iterator17 = _t11(_context10.v);
1816
+ _context10.p = 2;
1817
+ _iterator17.s();
1476
1818
  case 3:
1477
- if ((_step15 = _iterator15.n()).done) {
1478
- _context8.n = 6;
1819
+ if ((_step17 = _iterator17.n()).done) {
1820
+ _context10.n = 6;
1479
1821
  break;
1480
1822
  }
1481
- _step15$value = _step15.value, specifier = _step15$value.source, names = _step15$value.names;
1823
+ _step17$value = _step17.value, specifier = _step17$value.source, names = _step17$value.names;
1482
1824
  intoBase = specifier.startsWith(target.baseFrom);
1483
1825
  intoSelf = specifier.startsWith("./") || specifier.startsWith("../pvendor/"); // Only the worker target: a browser has no Node builtins, and a chunk that
1484
1826
  // reached for one there is a genuine error rather than a runtime import.
1485
1827
  builtin = target.name === "worker" && isRuntimeBuiltin(specifier);
1486
1828
  if (!(!intoBase && !intoSelf && !builtin)) {
1487
- _context8.n = 4;
1829
+ _context10.n = 4;
1488
1830
  break;
1489
1831
  }
1490
1832
  throw new Error("".concat(target.name, "/").concat(file, " imports '").concat(specifier, "', which is neither a base-layer chunk, ") + "a sibling, nor a Node builtin the runtime provides. It would be an unresolvable " + "bare specifier in the isolate.");
1491
1833
  case 4:
1492
1834
  if (!(intoBase && names.length)) {
1493
- _context8.n = 5;
1835
+ _context10.n = 5;
1494
1836
  break;
1495
1837
  }
1496
- _context8.n = 5;
1838
+ _context10.n = 5;
1497
1839
  return auditBaseExports(target, file, specifier, names, platform);
1498
1840
  case 5:
1499
- _context8.n = 3;
1841
+ _context10.n = 3;
1500
1842
  break;
1501
1843
  case 6:
1502
- _context8.n = 8;
1844
+ _context10.n = 8;
1503
1845
  break;
1504
1846
  case 7:
1505
- _context8.p = 7;
1506
- _t9 = _context8.v;
1507
- _iterator15.e(_t9);
1847
+ _context10.p = 7;
1848
+ _t12 = _context10.v;
1849
+ _iterator17.e(_t12);
1508
1850
  case 8:
1509
- _context8.p = 8;
1510
- _iterator15.f();
1511
- return _context8.f(8);
1851
+ _context10.p = 8;
1852
+ _iterator17.f();
1853
+ return _context10.f(8);
1512
1854
  case 9:
1513
- return _context8.a(2);
1855
+ return _context10.a(2);
1514
1856
  }
1515
- }, _callee8, null, [[2, 7, 8, 9]]);
1857
+ }, _callee1, null, [[2, 7, 8, 9]]);
1516
1858
  }));
1517
1859
  return _auditImports.apply(this, arguments);
1518
1860
  }
1519
- function auditBaseExports(_x22, _x23, _x24, _x25, _x26) {
1861
+ function auditBaseExports(_x23, _x24, _x25, _x26, _x27) {
1520
1862
  return _auditBaseExports.apply(this, arguments);
1521
1863
  }
1522
1864
  /**
@@ -1528,48 +1870,48 @@ function auditBaseExports(_x22, _x23, _x24, _x25, _x26) {
1528
1870
  * pull a package in.
1529
1871
  */
1530
1872
  function _auditBaseExports() {
1531
- _auditBaseExports = regeneratorValues._asyncToGenerator(/*#__PURE__*/regeneratorValues._regenerator().m(function _callee9(target, file, specifier, names, platform) {
1873
+ _auditBaseExports = regeneratorValues._asyncToGenerator(/*#__PURE__*/regeneratorValues._regenerator().m(function _callee10(target, file, specifier, names, platform) {
1532
1874
  var exported, missing;
1533
- return regeneratorValues._regenerator().w(function (_context9) {
1534
- while (1) switch (_context9.n) {
1875
+ return regeneratorValues._regenerator().w(function (_context11) {
1876
+ while (1) switch (_context11.n) {
1535
1877
  case 0:
1536
- _context9.n = 1;
1878
+ _context11.n = 1;
1537
1879
  return baseChunkExports(target, specifier, platform);
1538
1880
  case 1:
1539
- exported = _context9.v;
1881
+ exported = _context11.v;
1540
1882
  if (exported) {
1541
- _context9.n = 2;
1883
+ _context11.n = 2;
1542
1884
  break;
1543
1885
  }
1544
- return _context9.a(2);
1886
+ return _context11.a(2);
1545
1887
  case 2:
1546
1888
  missing = names.filter(function (name) {
1547
1889
  return !exported.has(name);
1548
1890
  });
1549
1891
  if (!(missing.length === 0)) {
1550
- _context9.n = 3;
1892
+ _context11.n = 3;
1551
1893
  break;
1552
1894
  }
1553
- return _context9.a(2);
1895
+ return _context11.a(2);
1554
1896
  case 3:
1555
1897
  throw new Error("".concat(target.name, "/").concat(file, " imports ").concat(missing.map(function (name) {
1556
1898
  return "'".concat(name, "'");
1557
1899
  }).join(", "), " from ") + "'".concat(specifier, "', which the base layer does not export. The base layer is built from the ") + "platform's pinned versions (packages/vendor/package.json, and PINS.md for why they are " + "exact), so this is a project resolving a version of that package which disagrees with " + "the platform's. It would link in the isolate only until something imported it, and then " + "throw \"does not provide an export named '".concat(missing[0], "'\"."));
1558
1900
  case 4:
1559
- return _context9.a(2);
1901
+ return _context11.a(2);
1560
1902
  }
1561
- }, _callee9);
1903
+ }, _callee10);
1562
1904
  }));
1563
1905
  return _auditBaseExports.apply(this, arguments);
1564
1906
  }
1565
1907
  function cssImportSpecifiersOf(css) {
1566
1908
  var found = [];
1567
1909
  var code = css.replace(/\/\*[\s\S]*?\*\//g, "");
1568
- var _iterator2 = regeneratorValues._createForOfIteratorHelper(code.matchAll(/@import\s+(?:url\(\s*)?(["'])([^"']+)\1/g)),
1569
- _step2;
1910
+ var _iterator4 = regeneratorValues._createForOfIteratorHelper(code.matchAll(/@import\s+(?:url\(\s*)?(["'])([^"']+)\1/g)),
1911
+ _step4;
1570
1912
  try {
1571
- for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
1572
- var match = _step2.value;
1913
+ for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
1914
+ var match = _step4.value;
1573
1915
  var specifier = match[2];
1574
1916
  if (/^[./]/.test(specifier)) continue;
1575
1917
  if (/^tailwindcss(\/|$)/.test(specifier)) continue;
@@ -1577,9 +1919,9 @@ function cssImportSpecifiersOf(css) {
1577
1919
  found.push(specifier);
1578
1920
  }
1579
1921
  } catch (err) {
1580
- _iterator2.e(err);
1922
+ _iterator4.e(err);
1581
1923
  } finally {
1582
- _iterator2.f();
1924
+ _iterator4.f();
1583
1925
  }
1584
1926
  return found;
1585
1927
  }
@@ -1590,37 +1932,37 @@ function cssImportSpecifiersOf(css) {
1590
1932
  */
1591
1933
  function cssSpecifiersOf(files) {
1592
1934
  var found = new Set();
1593
- for (var _i = 0, _Object$entries = Object.entries(files); _i < _Object$entries.length; _i++) {
1594
- var _Object$entries$_i = regeneratorValues._slicedToArray(_Object$entries[_i], 2),
1935
+ for (var _i2 = 0, _Object$entries = Object.entries(files); _i2 < _Object$entries.length; _i2++) {
1936
+ var _Object$entries$_i = regeneratorValues._slicedToArray(_Object$entries[_i2], 2),
1595
1937
  path = _Object$entries$_i[0],
1596
1938
  code = _Object$entries$_i[1];
1597
1939
  if (/\.css$/.test(path)) {
1598
- var _iterator3 = regeneratorValues._createForOfIteratorHelper(cssImportSpecifiersOf(code)),
1599
- _step3;
1940
+ var _iterator5 = regeneratorValues._createForOfIteratorHelper(cssImportSpecifiersOf(code)),
1941
+ _step5;
1600
1942
  try {
1601
- for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
1602
- var specifier = _step3.value;
1943
+ for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
1944
+ var specifier = _step5.value;
1603
1945
  found.add(specifier);
1604
1946
  }
1605
1947
  } catch (err) {
1606
- _iterator3.e(err);
1948
+ _iterator5.e(err);
1607
1949
  } finally {
1608
- _iterator3.f();
1950
+ _iterator5.f();
1609
1951
  }
1610
1952
  continue;
1611
1953
  }
1612
1954
  if (!/\.(tsx?|jsx?|mjs|cjs)$/.test(path)) continue;
1613
- var _iterator4 = regeneratorValues._createForOfIteratorHelper(code.matchAll(/(?:from|import)\s*["']([^"'.][^"']*\.css)["']/g)),
1614
- _step4;
1955
+ var _iterator6 = regeneratorValues._createForOfIteratorHelper(code.matchAll(/(?:from|import)\s*["']([^"'.][^"']*\.css)["']/g)),
1956
+ _step6;
1615
1957
  try {
1616
- for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
1617
- var match = _step4.value;
1958
+ for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
1959
+ var match = _step6.value;
1618
1960
  found.add(match[1]);
1619
1961
  }
1620
1962
  } catch (err) {
1621
- _iterator4.e(err);
1963
+ _iterator6.e(err);
1622
1964
  } finally {
1623
- _iterator4.f();
1965
+ _iterator6.f();
1624
1966
  }
1625
1967
  }
1626
1968
  return regeneratorValues._toConsumableArray(found);
@@ -1640,24 +1982,24 @@ function importedSpecifiers(files) {
1640
1982
  // positive costs one unused chunk; the builder's own resolver is what
1641
1983
  // actually decides, and it reports anything this missed.
1642
1984
  var IMPORT = /(?:from|import)\s*["']([^"'.][^"']*)["']|import\s*\(\s*["']([^"'.][^"']*)["']/g;
1643
- for (var _i2 = 0, _Object$entries2 = Object.entries(files); _i2 < _Object$entries2.length; _i2++) {
1644
- var _Object$entries2$_i = regeneratorValues._slicedToArray(_Object$entries2[_i2], 2),
1985
+ for (var _i3 = 0, _Object$entries2 = Object.entries(files); _i3 < _Object$entries2.length; _i3++) {
1986
+ var _Object$entries2$_i = regeneratorValues._slicedToArray(_Object$entries2[_i3], 2),
1645
1987
  path = _Object$entries2$_i[0],
1646
1988
  code = _Object$entries2$_i[1];
1647
1989
  if (!/\.(tsx?|jsx?|mjs|cjs)$/.test(path)) continue;
1648
- var _iterator5 = regeneratorValues._createForOfIteratorHelper(code.matchAll(IMPORT)),
1649
- _step5;
1990
+ var _iterator7 = regeneratorValues._createForOfIteratorHelper(code.matchAll(IMPORT)),
1991
+ _step7;
1650
1992
  try {
1651
- for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
1993
+ for (_iterator7.s(); !(_step7 = _iterator7.n()).done;) {
1652
1994
  var _match$;
1653
- var match = _step5.value;
1995
+ var match = _step7.value;
1654
1996
  var specifier = (_match$ = match[1]) !== null && _match$ !== void 0 ? _match$ : match[2];
1655
1997
  if (specifier && !specifier.startsWith("#")) found.add(specifier);
1656
1998
  }
1657
1999
  } catch (err) {
1658
- _iterator5.e(err);
2000
+ _iterator7.e(err);
1659
2001
  } finally {
1660
- _iterator5.f();
2002
+ _iterator7.f();
1661
2003
  }
1662
2004
  }
1663
2005
  return found;
@@ -1689,11 +2031,11 @@ function layerDepsOf(manifest) {
1689
2031
  // collectDependencyCss; building them as code entries fails, because a
1690
2032
  // package like that may have no JS entry point at all.
1691
2033
  var cssOnly = new Set();
1692
- var _iterator6 = regeneratorValues._createForOfIteratorHelper(importedSpecifiers(files)),
1693
- _step6;
2034
+ var _iterator8 = regeneratorValues._createForOfIteratorHelper(importedSpecifiers(files)),
2035
+ _step8;
1694
2036
  try {
1695
- for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
1696
- var specifier = _step6.value;
2037
+ for (_iterator8.s(); !(_step8 = _iterator8.n()).done;) {
2038
+ var specifier = _step8.value;
1697
2039
  var pkg = packageOf(specifier);
1698
2040
  if (!declared.has(pkg) || BASE_PROVIDED.has(pkg)) continue;
1699
2041
  if (specifier.endsWith(".css")) {
@@ -1706,48 +2048,48 @@ function layerDepsOf(manifest) {
1706
2048
  // and its files, with no JS entry to build. Left in, it is built as code,
1707
2049
  // fails, and is reported as skipped on every publish.
1708
2050
  } catch (err) {
1709
- _iterator6.e(err);
2051
+ _iterator8.e(err);
1710
2052
  } finally {
1711
- _iterator6.f();
2053
+ _iterator8.f();
1712
2054
  }
1713
- var _iterator7 = regeneratorValues._createForOfIteratorHelper(cssSpecifiersOf(files)),
1714
- _step7;
2055
+ var _iterator9 = regeneratorValues._createForOfIteratorHelper(cssSpecifiersOf(files)),
2056
+ _step9;
1715
2057
  try {
1716
2058
  var _loop = function _loop() {
1717
- var specifier = _step7.value;
2059
+ var specifier = _step9.value;
1718
2060
  var pkg = packageOf(specifier);
1719
2061
  if (declared.has(pkg) && !regeneratorValues._toConsumableArray(specifiers).some(function (s) {
1720
2062
  return packageOf(s) === pkg;
1721
2063
  })) cssOnly.add(pkg);
1722
2064
  };
1723
- for (_iterator7.s(); !(_step7 = _iterator7.n()).done;) {
2065
+ for (_iterator9.s(); !(_step9 = _iterator9.n()).done;) {
1724
2066
  _loop();
1725
2067
  }
1726
2068
 
1727
2069
  // A declared dependency nothing imports still gets an entry, so that a
1728
2070
  // project can add one and import it from the studio without a CI round-trip.
1729
2071
  } catch (err) {
1730
- _iterator7.e(err);
2072
+ _iterator9.e(err);
1731
2073
  } finally {
1732
- _iterator7.f();
2074
+ _iterator9.f();
1733
2075
  }
1734
- var _iterator8 = regeneratorValues._createForOfIteratorHelper(declared),
1735
- _step8;
2076
+ var _iterator0 = regeneratorValues._createForOfIteratorHelper(declared),
2077
+ _step0;
1736
2078
  try {
1737
2079
  var _loop2 = function _loop2() {
1738
- var name = _step8.value;
2080
+ var name = _step0.value;
1739
2081
  if (cssOnly.has(name)) return 1; // continue
1740
2082
  if (!regeneratorValues._toConsumableArray(specifiers).some(function (specifier) {
1741
2083
  return packageOf(specifier) === name;
1742
2084
  })) specifiers.add(name);
1743
2085
  };
1744
- for (_iterator8.s(); !(_step8 = _iterator8.n()).done;) {
2086
+ for (_iterator0.s(); !(_step0 = _iterator0.n()).done;) {
1745
2087
  if (_loop2()) continue;
1746
2088
  }
1747
2089
  } catch (err) {
1748
- _iterator8.e(err);
2090
+ _iterator0.e(err);
1749
2091
  } finally {
1750
- _iterator8.f();
2092
+ _iterator0.f();
1751
2093
  }
1752
2094
  return regeneratorValues._toConsumableArray(specifiers).sort();
1753
2095
  }
@@ -1778,13 +2120,13 @@ var STUB_DIR = ".platform-vendor-stubs";
1778
2120
  * into the project's stylesheet by the builder's CSS pass. Resolution is the
1779
2121
  * project's own, so the version matches whatever its lockfile pinned.
1780
2122
  */
1781
- function collectDependencyCss(_x27, _x28, _x29) {
2123
+ function collectDependencyCss(_x28, _x29, _x30) {
1782
2124
  return _collectDependencyCss.apply(this, arguments);
1783
2125
  }
1784
2126
 
1785
2127
  /** `url(...)` with a relative target, quoted or not. */
1786
2128
  function _collectDependencyCss() {
1787
- _collectDependencyCss = regeneratorValues._asyncToGenerator(/*#__PURE__*/regeneratorValues._regenerator().m(function _callee0(dir, specifiers,
2129
+ _collectDependencyCss = regeneratorValues._asyncToGenerator(/*#__PURE__*/regeneratorValues._regenerator().m(function _callee11(dir, specifiers,
1788
2130
  /**
1789
2131
  * Where the files a stylesheet points at with `url(...)` go, base64, keyed
1790
2132
  * by the content-addressed name the rewritten `url()` now uses. Pass it to
@@ -1794,65 +2136,65 @@ function _collectDependencyCss() {
1794
2136
  * in one -- every font package's -- points at nothing once it is served.
1795
2137
  */
1796
2138
  assets) {
1797
- var require, css, _iterator16, _step16, specifier, file, _t1;
1798
- return regeneratorValues._regenerator().w(function (_context0) {
1799
- while (1) switch (_context0.p = _context0.n) {
2139
+ var require, css, _iterator18, _step18, specifier, file, _t14;
2140
+ return regeneratorValues._regenerator().w(function (_context12) {
2141
+ while (1) switch (_context12.p = _context12.n) {
1800
2142
  case 0:
1801
2143
  if (!(specifiers.length === 0)) {
1802
- _context0.n = 1;
2144
+ _context12.n = 1;
1803
2145
  break;
1804
2146
  }
1805
- return _context0.a(2, {});
2147
+ return _context12.a(2, {});
1806
2148
  case 1:
1807
2149
  require = node_module.createRequire(node_path.join(node_path.resolve(dir), "package.json"));
1808
2150
  css = {};
1809
- _iterator16 = regeneratorValues._createForOfIteratorHelper(specifiers);
1810
- _context0.p = 2;
1811
- _iterator16.s();
2151
+ _iterator18 = regeneratorValues._createForOfIteratorHelper(specifiers);
2152
+ _context12.p = 2;
2153
+ _iterator18.s();
1812
2154
  case 3:
1813
- if ((_step16 = _iterator16.n()).done) {
1814
- _context0.n = 10;
2155
+ if ((_step18 = _iterator18.n()).done) {
2156
+ _context12.n = 10;
1815
2157
  break;
1816
2158
  }
1817
- specifier = _step16.value;
2159
+ specifier = _step18.value;
1818
2160
  file = void 0;
1819
- _context0.p = 4;
2161
+ _context12.p = 4;
1820
2162
  file = require.resolve(specifier);
1821
- _context0.n = 6;
2163
+ _context12.n = 6;
1822
2164
  break;
1823
2165
  case 5:
1824
- _context0.p = 5;
1825
- _context0.v;
1826
- return _context0.a(3, 9);
2166
+ _context12.p = 5;
2167
+ _context12.v;
2168
+ return _context12.a(3, 9);
1827
2169
  case 6:
1828
2170
  if (file.endsWith(".css")) {
1829
- _context0.n = 7;
2171
+ _context12.n = 7;
1830
2172
  break;
1831
2173
  }
1832
- return _context0.a(3, 9);
2174
+ return _context12.a(3, 9);
1833
2175
  case 7:
1834
- _context0.n = 8;
2176
+ _context12.n = 8;
1835
2177
  return readDependencyStylesheet(file, assets, new Set());
1836
2178
  case 8:
1837
- css[specifier] = _context0.v;
2179
+ css[specifier] = _context12.v;
1838
2180
  case 9:
1839
- _context0.n = 3;
2181
+ _context12.n = 3;
1840
2182
  break;
1841
2183
  case 10:
1842
- _context0.n = 12;
2184
+ _context12.n = 12;
1843
2185
  break;
1844
2186
  case 11:
1845
- _context0.p = 11;
1846
- _t1 = _context0.v;
1847
- _iterator16.e(_t1);
2187
+ _context12.p = 11;
2188
+ _t14 = _context12.v;
2189
+ _iterator18.e(_t14);
1848
2190
  case 12:
1849
- _context0.p = 12;
1850
- _iterator16.f();
1851
- return _context0.f(12);
2191
+ _context12.p = 12;
2192
+ _iterator18.f();
2193
+ return _context12.f(12);
1852
2194
  case 13:
1853
- return _context0.a(2, css);
2195
+ return _context12.a(2, css);
1854
2196
  }
1855
- }, _callee0, null, [[4, 5], [2, 11, 12, 13]]);
2197
+ }, _callee11, null, [[4, 5], [2, 11, 12, 13]]);
1856
2198
  }));
1857
2199
  return _collectDependencyCss.apply(this, arguments);
1858
2200
  }
@@ -1867,150 +2209,150 @@ var RELATIVE_URL = /url\(\s*(["']?)(?![a-z]+:|\/|#)([^"')]+)\1\s*\)/gi;
1867
2209
  * Names follow `resolveAsset`'s: the first 16 hex of the base64's SHA-256, and
1868
2210
  * the file's own extension.
1869
2211
  */
1870
- function readDependencyStylesheet(_x30, _x31, _x32) {
2212
+ function readDependencyStylesheet(_x31, _x32, _x33) {
1871
2213
  return _readDependencyStylesheet.apply(this, arguments);
1872
2214
  }
1873
2215
  function _readDependencyStylesheet() {
1874
- _readDependencyStylesheet = regeneratorValues._asyncToGenerator(/*#__PURE__*/regeneratorValues._regenerator().m(function _callee1(file, assets, seen) {
1875
- var base, css, imports, _iterator17, _step17, match, target, inlined, rewrites, _iterator18, _step18, _match, reference, path, base64, hash, name, _t10, _t11, _t13;
1876
- return regeneratorValues._regenerator().w(function (_context1) {
1877
- while (1) switch (_context1.p = _context1.n) {
2216
+ _readDependencyStylesheet = regeneratorValues._asyncToGenerator(/*#__PURE__*/regeneratorValues._regenerator().m(function _callee12(file, assets, seen) {
2217
+ var base, css, imports, _iterator19, _step19, match, target, inlined, rewrites, _iterator20, _step20, _match, reference, path, base64, hash, name, _t15, _t16, _t18;
2218
+ return regeneratorValues._regenerator().w(function (_context13) {
2219
+ while (1) switch (_context13.p = _context13.n) {
1878
2220
  case 0:
1879
2221
  seen.add(file);
1880
2222
  base = node_path.dirname(file);
1881
- _context1.n = 1;
2223
+ _context13.n = 1;
1882
2224
  return promises.readFile(file, "utf8");
1883
2225
  case 1:
1884
- css = _context1.v;
2226
+ css = _context13.v;
1885
2227
  imports = regeneratorValues._toConsumableArray(css.matchAll(/@import\s+(?:url\(\s*)?(["'])(\.{1,2}\/[^"']+)\1[^;]*;/g));
1886
- _iterator17 = regeneratorValues._createForOfIteratorHelper(imports);
1887
- _context1.p = 2;
1888
- _iterator17.s();
2228
+ _iterator19 = regeneratorValues._createForOfIteratorHelper(imports);
2229
+ _context13.p = 2;
2230
+ _iterator19.s();
1889
2231
  case 3:
1890
- if ((_step17 = _iterator17.n()).done) {
1891
- _context1.n = 8;
2232
+ if ((_step19 = _iterator19.n()).done) {
2233
+ _context13.n = 8;
1892
2234
  break;
1893
2235
  }
1894
- match = _step17.value;
2236
+ match = _step19.value;
1895
2237
  target = node_path.join(base, match[2]);
1896
2238
  if (!seen.has(target)) {
1897
- _context1.n = 4;
2239
+ _context13.n = 4;
1898
2240
  break;
1899
2241
  }
1900
- _t10 = "";
1901
- _context1.n = 6;
2242
+ _t15 = "";
2243
+ _context13.n = 6;
1902
2244
  break;
1903
2245
  case 4:
1904
- _context1.n = 5;
2246
+ _context13.n = 5;
1905
2247
  return readDependencyStylesheet(target, assets, seen)["catch"](function () {
1906
2248
  return null;
1907
2249
  });
1908
2250
  case 5:
1909
- _t10 = _context1.v;
2251
+ _t15 = _context13.v;
1910
2252
  case 6:
1911
- inlined = _t10;
2253
+ inlined = _t15;
1912
2254
  // A missing file stays an import, so the builder names it.
1913
2255
  if (inlined !== null) css = css.replace(match[0], inlined);
1914
2256
  case 7:
1915
- _context1.n = 3;
2257
+ _context13.n = 3;
1916
2258
  break;
1917
2259
  case 8:
1918
- _context1.n = 10;
2260
+ _context13.n = 10;
1919
2261
  break;
1920
2262
  case 9:
1921
- _context1.p = 9;
1922
- _t11 = _context1.v;
1923
- _iterator17.e(_t11);
2263
+ _context13.p = 9;
2264
+ _t16 = _context13.v;
2265
+ _iterator19.e(_t16);
1924
2266
  case 10:
1925
- _context1.p = 10;
1926
- _iterator17.f();
1927
- return _context1.f(10);
2267
+ _context13.p = 10;
2268
+ _iterator19.f();
2269
+ return _context13.f(10);
1928
2270
  case 11:
1929
2271
  if (assets) {
1930
- _context1.n = 12;
2272
+ _context13.n = 12;
1931
2273
  break;
1932
2274
  }
1933
- return _context1.a(2, css);
2275
+ return _context13.a(2, css);
1934
2276
  case 12:
1935
2277
  rewrites = new Map();
1936
- _iterator18 = regeneratorValues._createForOfIteratorHelper(css.matchAll(RELATIVE_URL));
1937
- _context1.p = 13;
1938
- _iterator18.s();
2278
+ _iterator20 = regeneratorValues._createForOfIteratorHelper(css.matchAll(RELATIVE_URL));
2279
+ _context13.p = 13;
2280
+ _iterator20.s();
1939
2281
  case 14:
1940
- if ((_step18 = _iterator18.n()).done) {
1941
- _context1.n = 21;
2282
+ if ((_step20 = _iterator20.n()).done) {
2283
+ _context13.n = 21;
1942
2284
  break;
1943
2285
  }
1944
- _match = _step18.value;
2286
+ _match = _step20.value;
1945
2287
  reference = _match[2].trim();
1946
2288
  if (!rewrites.has(reference)) {
1947
- _context1.n = 15;
2289
+ _context13.n = 15;
1948
2290
  break;
1949
2291
  }
1950
- return _context1.a(3, 20);
2292
+ return _context13.a(3, 20);
1951
2293
  case 15:
1952
2294
  path = node_path.join(base, reference.split(/[?#]/)[0]);
1953
2295
  base64 = void 0;
1954
- _context1.p = 16;
1955
- _context1.n = 17;
2296
+ _context13.p = 16;
2297
+ _context13.n = 17;
1956
2298
  return promises.readFile(path);
1957
2299
  case 17:
1958
- base64 = _context1.v.toString("base64");
1959
- _context1.n = 19;
2300
+ base64 = _context13.v.toString("base64");
2301
+ _context13.n = 19;
1960
2302
  break;
1961
2303
  case 18:
1962
- _context1.p = 18;
1963
- _context1.v;
1964
- return _context1.a(3, 20);
2304
+ _context13.p = 18;
2305
+ _context13.v;
2306
+ return _context13.a(3, 20);
1965
2307
  case 19:
1966
2308
  hash = node_crypto.createHash("sha256").update(base64).digest("hex").slice(0, 16);
1967
2309
  name = "".concat(hash).concat(node_path.extname(path).toLowerCase());
1968
2310
  assets[name] = base64;
1969
2311
  rewrites.set(reference, "".concat(regeneratorValues.ASSET_BASE).concat(name));
1970
2312
  case 20:
1971
- _context1.n = 14;
2313
+ _context13.n = 14;
1972
2314
  break;
1973
2315
  case 21:
1974
- _context1.n = 23;
2316
+ _context13.n = 23;
1975
2317
  break;
1976
2318
  case 22:
1977
- _context1.p = 22;
1978
- _t13 = _context1.v;
1979
- _iterator18.e(_t13);
2319
+ _context13.p = 22;
2320
+ _t18 = _context13.v;
2321
+ _iterator20.e(_t18);
1980
2322
  case 23:
1981
- _context1.p = 23;
1982
- _iterator18.f();
1983
- return _context1.f(23);
2323
+ _context13.p = 23;
2324
+ _iterator20.f();
2325
+ return _context13.f(23);
1984
2326
  case 24:
1985
- return _context1.a(2, css.replace(RELATIVE_URL, function (whole, _quote, reference) {
2327
+ return _context13.a(2, css.replace(RELATIVE_URL, function (whole, _quote, reference) {
1986
2328
  var url = rewrites.get(reference.trim());
1987
2329
  return url ? "url(".concat(url, ")") : whole;
1988
2330
  }));
1989
2331
  }
1990
- }, _callee1, null, [[16, 18], [13, 22, 23, 24], [2, 9, 10, 11]]);
2332
+ }, _callee12, null, [[16, 18], [13, 22, 23, 24], [2, 9, 10, 11]]);
1991
2333
  }));
1992
2334
  return _readDependencyStylesheet.apply(this, arguments);
1993
2335
  }
1994
- function buildVendorLayer(_x33, _x34, _x35, _x36) {
2336
+ function buildVendorLayer(_x34, _x35, _x36, _x37) {
1995
2337
  return _buildVendorLayer.apply(this, arguments);
1996
2338
  }
1997
2339
  function _buildVendorLayer() {
1998
- _buildVendorLayer = regeneratorValues._asyncToGenerator(/*#__PURE__*/regeneratorValues._regenerator().m(function _callee10(dir, deps, css, platform) {
1999
- var modules, _iterator19, _step19, _loop3, stubs, input, _i4, _Object$entries3, _Object$entries3$_i, specifier, name, file, skipped, workerOnly, workerOnlyReasons, specifierOf, usable, built, _i5, _Object$values, _name2, worked, reasons, _iterator20, _step20, target, _message, _reasons$, _i6, _Object$entries4, _Object$entries4$_i, _specifier, _name3, _t14, _t15, _t16;
2000
- return regeneratorValues._regenerator().w(function (_context11) {
2001
- while (1) switch (_context11.p = _context11.n) {
2340
+ _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;
2342
+ return regeneratorValues._regenerator().w(function (_context15) {
2343
+ while (1) switch (_context15.p = _context15.n) {
2002
2344
  case 0:
2003
2345
  if (!(deps.length === 0 && Object.keys(css).length === 0)) {
2004
- _context11.n = 1;
2346
+ _context15.n = 1;
2005
2347
  break;
2006
2348
  }
2007
- return _context11.a(2, null);
2349
+ return _context15.a(2, null);
2008
2350
  case 1:
2009
2351
  if (!(deps.length === 0)) {
2010
- _context11.n = 2;
2352
+ _context15.n = 2;
2011
2353
  break;
2012
2354
  }
2013
- return _context11.a(2, {
2355
+ return _context15.a(2, {
2014
2356
  rev: cssRev(css),
2015
2357
  modules: {},
2016
2358
  worker: {},
@@ -2022,14 +2364,14 @@ function _buildVendorLayer() {
2022
2364
  });
2023
2365
  case 2:
2024
2366
  modules = {};
2025
- _iterator19 = regeneratorValues._createForOfIteratorHelper(deps);
2026
- _context11.p = 3;
2027
- _loop3 = /*#__PURE__*/regeneratorValues._regenerator().m(function _loop3() {
2367
+ _iterator21 = regeneratorValues._createForOfIteratorHelper(deps);
2368
+ _context15.p = 3;
2369
+ _loop4 = /*#__PURE__*/regeneratorValues._regenerator().m(function _loop4() {
2028
2370
  var specifier, name, clash;
2029
- return regeneratorValues._regenerator().w(function (_context10) {
2030
- while (1) switch (_context10.n) {
2371
+ return regeneratorValues._regenerator().w(function (_context14) {
2372
+ while (1) switch (_context14.n) {
2031
2373
  case 0:
2032
- specifier = _step19.value;
2374
+ specifier = _step21.value;
2033
2375
  name = chunkNameFor(specifier);
2034
2376
  clash = Object.entries(modules).find(function (_ref10) {
2035
2377
  var _ref11 = regeneratorValues._slicedToArray(_ref10, 2),
@@ -2037,38 +2379,38 @@ function _buildVendorLayer() {
2037
2379
  return existing === name;
2038
2380
  });
2039
2381
  if (!clash) {
2040
- _context10.n = 1;
2382
+ _context14.n = 1;
2041
2383
  break;
2042
2384
  }
2043
2385
  throw new Error("'".concat(specifier, "' and '").concat(clash[0], "' both map to the chunk name '").concat(name, "'. ") + "Rename is not an option, so this needs chunkNameFor to disambiguate.");
2044
2386
  case 1:
2045
2387
  modules[specifier] = name;
2046
2388
  case 2:
2047
- return _context10.a(2);
2389
+ return _context14.a(2);
2048
2390
  }
2049
- }, _loop3);
2391
+ }, _loop4);
2050
2392
  });
2051
- _iterator19.s();
2393
+ _iterator21.s();
2052
2394
  case 4:
2053
- if ((_step19 = _iterator19.n()).done) {
2054
- _context11.n = 6;
2395
+ if ((_step21 = _iterator21.n()).done) {
2396
+ _context15.n = 6;
2055
2397
  break;
2056
2398
  }
2057
- return _context11.d(regeneratorValues._regeneratorValues(_loop3()), 5);
2399
+ return _context15.d(regeneratorValues._regeneratorValues(_loop4()), 5);
2058
2400
  case 5:
2059
- _context11.n = 4;
2401
+ _context15.n = 4;
2060
2402
  break;
2061
2403
  case 6:
2062
- _context11.n = 8;
2404
+ _context15.n = 8;
2063
2405
  break;
2064
2406
  case 7:
2065
- _context11.p = 7;
2066
- _t14 = _context11.v;
2067
- _iterator19.e(_t14);
2407
+ _context15.p = 7;
2408
+ _t19 = _context15.v;
2409
+ _iterator21.e(_t19);
2068
2410
  case 8:
2069
- _context11.p = 8;
2070
- _iterator19.f();
2071
- return _context11.f(8);
2411
+ _context15.p = 8;
2412
+ _iterator21.f();
2413
+ return _context15.f(8);
2072
2414
  case 9:
2073
2415
  // `resolve` rather than `join`, and the CLI's own default argument is why.
2074
2416
  //
@@ -2085,40 +2427,42 @@ function _buildVendorLayer() {
2085
2427
  // path: the suites all build in a mkdtemp. The one caller that does not is
2086
2428
  // the one a person uses.
2087
2429
  stubs = node_path.join(node_path.resolve(dir), STUB_DIR);
2088
- _context11.n = 10;
2430
+ _context15.n = 10;
2089
2431
  return promises.rm(stubs, {
2090
2432
  recursive: true,
2091
2433
  force: true
2092
2434
  });
2093
2435
  case 10:
2094
- _context11.n = 11;
2436
+ _context15.n = 11;
2095
2437
  return promises.mkdir(stubs, {
2096
2438
  recursive: true
2097
2439
  });
2098
2440
  case 11:
2099
- _context11.p = 11;
2441
+ _context15.p = 11;
2100
2442
  input = {};
2101
- _i4 = 0, _Object$entries3 = Object.entries(modules);
2443
+ _i6 = 0, _Object$entries4 = Object.entries(modules);
2102
2444
  case 12:
2103
- if (!(_i4 < _Object$entries3.length)) {
2104
- _context11.n = 15;
2445
+ if (!(_i6 < _Object$entries4.length)) {
2446
+ _context15.n = 15;
2105
2447
  break;
2106
2448
  }
2107
- _Object$entries3$_i = regeneratorValues._slicedToArray(_Object$entries3[_i4], 2), specifier = _Object$entries3$_i[0], name = _Object$entries3$_i[1];
2449
+ _Object$entries4$_i = regeneratorValues._slicedToArray(_Object$entries4[_i6], 2), specifier = _Object$entries4$_i[0], name = _Object$entries4$_i[1];
2108
2450
  file = node_path.join(stubs, "".concat(name, ".js"));
2109
- _context11.n = 13;
2451
+ _context15.n = 13;
2110
2452
  return promises.writeFile(file, stubSource(specifier));
2111
2453
  case 13:
2112
2454
  input[name] = file;
2113
2455
  case 14:
2114
- _i4++;
2115
- _context11.n = 12;
2456
+ _i6++;
2457
+ _context15.n = 12;
2116
2458
  break;
2117
2459
  case 15:
2118
- // Fast path: one build with every entry, so shared code is shared. When it
2119
- // fails, rolldown reports against a file deep inside a package rather than
2120
- // against the entry that pulled it in, so the only way to learn *which*
2121
- // dependency is at fault is to try them one at a time.
2460
+ // Fast path: one build with every entry, so shared code is shared, and the
2461
+ // usual answer: a server-only dependency, or one that loads a native
2462
+ // binary, does not fail it (see `stubUnbundlable`). When something else does, rolldown reports
2463
+ // against a file deep inside a package rather than against the entry that
2464
+ // pulled it in, so the only way to learn *which* dependency is at fault is
2465
+ // to try them one at a time.
2122
2466
  skipped = [];
2123
2467
  /** Built for the worker but not the browser: server-only dependencies. */
2124
2468
  workerOnly = [];
@@ -2132,79 +2476,79 @@ function _buildVendorLayer() {
2132
2476
  })[0];
2133
2477
  };
2134
2478
  usable = Object.values(modules);
2135
- _context11.n = 16;
2479
+ _context15.n = 16;
2136
2480
  return buildTargets(usable, input, node_path.join(stubs, "out"), false, platform)["catch"](function (error) {
2137
2481
  if (error instanceof PinSkewError) throw error;
2138
2482
  return null;
2139
2483
  });
2140
2484
  case 16:
2141
- built = _context11.v;
2485
+ built = _context15.v;
2142
2486
  if (built) {
2143
- _context11.n = 33;
2487
+ _context15.n = 33;
2144
2488
  break;
2145
2489
  }
2146
2490
  usable = [];
2147
- _i5 = 0, _Object$values = Object.values(modules);
2491
+ _i7 = 0, _Object$values = Object.values(modules);
2148
2492
  case 17:
2149
- if (!(_i5 < _Object$values.length)) {
2150
- _context11.n = 30;
2493
+ if (!(_i7 < _Object$values.length)) {
2494
+ _context15.n = 30;
2151
2495
  break;
2152
2496
  }
2153
- _name2 = _Object$values[_i5];
2497
+ _name2 = _Object$values[_i7];
2154
2498
  // Probed per target, because the two sides are not the same question.
2155
- // `@valbuild/tanstack/server` cannot build for a browser -- it reaches
2156
- // TanStack's SSR path, which lands on `node:stream/web` -- and it has no
2157
- // business being in a browser bundle either. Failing it outright would
2158
- // mean a server-only dependency can never be layered at all, so a
2159
- // package that builds for the worker and not the browser is kept as
2499
+ // A package that builds for the worker and not the browser is kept as
2160
2500
  // server-only, and importing it from client code is rejected later by
2161
- // the builder, naming it.
2501
+ // the builder, naming it. Reaching a Node builtin is not a failure here
2502
+ // any more than in the first build: `buildTargets` reports it.
2162
2503
  worked = {};
2163
2504
  reasons = [];
2164
- _iterator20 = regeneratorValues._createForOfIteratorHelper(targetsFor(platform));
2165
- _context11.p = 18;
2166
- _iterator20.s();
2505
+ _iterator22 = regeneratorValues._createForOfIteratorHelper(targetsFor(platform));
2506
+ _context15.p = 18;
2507
+ _iterator22.s();
2167
2508
  case 19:
2168
- if ((_step20 = _iterator20.n()).done) {
2169
- _context11.n = 25;
2509
+ if ((_step22 = _iterator22.n()).done) {
2510
+ _context15.n = 25;
2170
2511
  break;
2171
2512
  }
2172
- target = _step20.value;
2173
- _context11.p = 20;
2174
- _context11.n = 21;
2513
+ target = _step22.value;
2514
+ _context15.p = 20;
2515
+ _context15.n = 21;
2175
2516
  return buildTargets({
2176
2517
  worker: target.name === "worker" ? [_name2] : [],
2177
2518
  browser: target.name === "browser" ? [_name2] : []
2178
2519
  }, input, node_path.join(stubs, "probe", target.name, _name2), true, platform);
2179
2520
  case 21:
2180
- worked[target.name] = true;
2181
- _context11.n = 24;
2521
+ probe = _context15.v;
2522
+ unbundlable = (_probe$unusable$_name = probe.unusable[_name2]) !== null && _probe$unusable$_name !== void 0 ? _probe$unusable$_name : probe.serverOnly[_name2];
2523
+ worked[target.name] = unbundlable === undefined;
2524
+ if (unbundlable !== undefined) reasons.push(unbundlable);
2525
+ _context15.n = 24;
2182
2526
  break;
2183
2527
  case 22:
2184
- _context11.p = 22;
2185
- _t15 = _context11.v;
2186
- if (!(_t15 instanceof PinSkewError)) {
2187
- _context11.n = 23;
2528
+ _context15.p = 22;
2529
+ _t20 = _context15.v;
2530
+ if (!(_t20 instanceof PinSkewError)) {
2531
+ _context15.n = 23;
2188
2532
  break;
2189
2533
  }
2190
- throw _t15;
2534
+ throw _t20;
2191
2535
  case 23:
2192
2536
  worked[target.name] = false;
2193
- reasons.push(firstLine(String((_message = _t15 === null || _t15 === void 0 ? void 0 : _t15.message) !== null && _message !== void 0 ? _message : _t15)));
2537
+ reasons.push(firstLine(String((_message = _t20 === null || _t20 === void 0 ? void 0 : _t20.message) !== null && _message !== void 0 ? _message : _t20)));
2194
2538
  case 24:
2195
- _context11.n = 19;
2539
+ _context15.n = 19;
2196
2540
  break;
2197
2541
  case 25:
2198
- _context11.n = 27;
2542
+ _context15.n = 27;
2199
2543
  break;
2200
2544
  case 26:
2201
- _context11.p = 26;
2202
- _t16 = _context11.v;
2203
- _iterator20.e(_t16);
2545
+ _context15.p = 26;
2546
+ _t21 = _context15.v;
2547
+ _iterator22.e(_t21);
2204
2548
  case 27:
2205
- _context11.p = 27;
2206
- _iterator20.f();
2207
- return _context11.f(27);
2549
+ _context15.p = 27;
2550
+ _iterator22.f();
2551
+ return _context15.f(27);
2208
2552
  case 28:
2209
2553
  if (worked.worker && worked.browser) usable.push(_name2);else if (worked.worker) {
2210
2554
  usable.push(_name2);
@@ -2223,21 +2567,21 @@ function _buildVendorLayer() {
2223
2567
  });
2224
2568
  }
2225
2569
  case 29:
2226
- _i5++;
2227
- _context11.n = 17;
2570
+ _i7++;
2571
+ _context15.n = 17;
2228
2572
  break;
2229
2573
  case 30:
2230
- for (_i6 = 0, _Object$entries4 = Object.entries(modules); _i6 < _Object$entries4.length; _i6++) {
2231
- _Object$entries4$_i = regeneratorValues._slicedToArray(_Object$entries4[_i6], 2), _specifier = _Object$entries4$_i[0], _name3 = _Object$entries4$_i[1];
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];
2232
2576
  if (!usable.includes(_name3)) delete modules[_specifier];
2233
2577
  }
2234
2578
  // Everything failed: a layer with no entries is the same as no layer, and
2235
2579
  // the skip list is what the caller reports.
2236
2580
  if (!(usable.length === 0)) {
2237
- _context11.n = 31;
2581
+ _context15.n = 31;
2238
2582
  break;
2239
2583
  }
2240
- return _context11.a(2, {
2584
+ return _context15.a(2, {
2241
2585
  rev: "none",
2242
2586
  modules: {},
2243
2587
  worker: {},
@@ -2248,7 +2592,7 @@ function _buildVendorLayer() {
2248
2592
  workerOnlyReasons: workerOnlyReasons
2249
2593
  });
2250
2594
  case 31:
2251
- _context11.n = 32;
2595
+ _context15.n = 32;
2252
2596
  return buildTargets({
2253
2597
  worker: usable,
2254
2598
  browser: usable.filter(function (name) {
@@ -2256,9 +2600,54 @@ function _buildVendorLayer() {
2256
2600
  })
2257
2601
  }, input, node_path.join(stubs, "out"), false, platform);
2258
2602
  case 32:
2259
- built = _context11.v;
2603
+ built = _context15.v;
2260
2604
  case 33:
2261
- return _context11.a(2, {
2605
+ _i9 = 0, _Object$entries6 = Object.entries(modules);
2606
+ case 34:
2607
+ if (!(_i9 < _Object$entries6.length)) {
2608
+ _context15.n = 37;
2609
+ break;
2610
+ }
2611
+ _Object$entries6$_i = regeneratorValues._slicedToArray(_Object$entries6[_i9], 2), _specifier2 = _Object$entries6$_i[0], _name4 = _Object$entries6$_i[1];
2612
+ reason = built.unusable[_name4];
2613
+ if (!(reason === undefined)) {
2614
+ _context15.n = 35;
2615
+ break;
2616
+ }
2617
+ return _context15.a(3, 36);
2618
+ case 35:
2619
+ skipped.push({
2620
+ specifier: _specifier2,
2621
+ reason: reason
2622
+ });
2623
+ delete modules[_specifier2];
2624
+ case 36:
2625
+ _i9++;
2626
+ _context15.n = 34;
2627
+ 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;
2633
+ break;
2634
+ }
2635
+ _Object$entries7$_i = regeneratorValues._slicedToArray(_Object$entries7[_i0], 2), _specifier3 = _Object$entries7$_i[0], _name5 = _Object$entries7$_i[1];
2636
+ _reason = built.serverOnly[_name5];
2637
+ if (!(_reason === undefined || workerOnly.includes(_specifier3))) {
2638
+ _context15.n = 39;
2639
+ break;
2640
+ }
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;
2648
+ break;
2649
+ case 41:
2650
+ return _context15.a(2, {
2262
2651
  rev: "".concat(built.rev).concat(cssRev(css) ? "-".concat(cssRev(css)) : ""),
2263
2652
  modules: modules,
2264
2653
  worker: built.worker,
@@ -2268,19 +2657,19 @@ function _buildVendorLayer() {
2268
2657
  workerOnly: workerOnly,
2269
2658
  workerOnlyReasons: workerOnlyReasons
2270
2659
  });
2271
- case 34:
2272
- _context11.p = 34;
2273
- _context11.n = 35;
2660
+ case 42:
2661
+ _context15.p = 42;
2662
+ _context15.n = 43;
2274
2663
  return promises.rm(stubs, {
2275
2664
  recursive: true,
2276
2665
  force: true
2277
2666
  });
2278
- case 35:
2279
- return _context11.f(34);
2280
- case 36:
2281
- return _context11.a(2);
2667
+ case 43:
2668
+ return _context15.f(42);
2669
+ case 44:
2670
+ return _context15.a(2);
2282
2671
  }
2283
- }, _callee10, null, [[20, 22], [18, 26, 27, 28], [11,, 34, 36], [3, 7, 8, 9]]);
2672
+ }, _callee13, null, [[20, 22], [18, 26, 27, 28], [11,, 42, 44], [3, 7, 8, 9]]);
2284
2673
  }));
2285
2674
  return _buildVendorLayer.apply(this, arguments);
2286
2675
  }