@valbuild/tanstack-build 0.135.0 → 0.136.3

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.
Files changed (30) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/constants/dist/valbuild-tanstack-build-constants.cjs.d.ts +2 -0
  3. package/constants/dist/valbuild-tanstack-build-constants.cjs.dev.js +15 -0
  4. package/constants/dist/valbuild-tanstack-build-constants.cjs.js +7 -0
  5. package/constants/dist/valbuild-tanstack-build-constants.cjs.prod.js +15 -0
  6. package/constants/dist/valbuild-tanstack-build-constants.esm.js +2 -0
  7. package/constants/package.json +4 -0
  8. package/dist/artifactKeys-3a40f3a0.esm.js +50 -0
  9. package/dist/artifactKeys-700b9044.cjs.prod.js +53 -0
  10. package/dist/artifactKeys-ad3e41fc.cjs.dev.js +53 -0
  11. package/dist/declarations/src/artifactKeys.d.ts +46 -0
  12. package/dist/declarations/src/artifacts.d.ts +72 -0
  13. package/dist/declarations/src/constants/index.d.ts +19 -0
  14. package/dist/declarations/src/index.d.ts +1 -0
  15. package/dist/declarations/src/node/routes.d.ts +5 -7
  16. package/dist/declarations/src/projectPaths.d.ts +10 -0
  17. package/dist/declarations/src/wire.d.ts +40 -22
  18. package/dist/projectPaths-5e4defea.esm.js +30 -0
  19. package/dist/projectPaths-9cbecebf.cjs.prod.js +35 -0
  20. package/dist/projectPaths-f222255a.cjs.dev.js +35 -0
  21. package/dist/{slicedToArray-7afed0af.cjs.prod.js → slicedToArray-12869836.cjs.dev.js} +1 -0
  22. package/dist/{slicedToArray-80b0ffd7.cjs.dev.js → slicedToArray-149a2518.cjs.prod.js} +1 -0
  23. package/dist/{slicedToArray-44c37acc.esm.js → slicedToArray-d71360f4.esm.js} +1 -1
  24. package/dist/valbuild-tanstack-build.cjs.dev.js +183 -58
  25. package/dist/valbuild-tanstack-build.cjs.prod.js +183 -58
  26. package/dist/valbuild-tanstack-build.esm.js +173 -50
  27. package/node/dist/valbuild-tanstack-build-node.cjs.dev.js +6 -9
  28. package/node/dist/valbuild-tanstack-build-node.cjs.prod.js +6 -9
  29. package/node/dist/valbuild-tanstack-build-node.esm.js +5 -8
  30. package/package.json +10 -3
@@ -1,25 +1,11 @@
1
- import { _ as _createForOfIteratorHelper, a as _asyncToGenerator, b as _regenerator, c as _toConsumableArray, d as _slicedToArray, e as _objectSpread2 } from './slicedToArray-44c37acc.esm.js';
1
+ import { _ as _createForOfIteratorHelper, a as _asyncToGenerator, b as _regenerator, c as _toConsumableArray, d as _slicedToArray, e as _objectSpread2, f as _defineProperty } from './slicedToArray-d71360f4.esm.js';
2
2
  import { build } from '@rolldown/browser';
3
+ import { E as ENTRY, T as TREE } from './projectPaths-5e4defea.esm.js';
4
+ export { E as ENTRY, R as ROUTES_DIR, T as TREE } from './projectPaths-5e4defea.esm.js';
3
5
  import { parseAstAsync } from '@rolldown/browser/parseAst';
4
6
  import { compile } from 'tailwindcss';
5
-
6
- /**
7
- * Paths the platform's contract fixes, in one place.
8
- *
9
- * These are not conventions this package chose -- `src/app.tsx` is the module
10
- * the builder resolves as its entry, and `src/routeTree.gen.ts` is what
11
- * TanStack's generator is configured to write. They are here so that a change
12
- * on either side is one edit rather than a search for string literals.
13
- */
14
-
15
- /** The module the builder uses as the project's entry. */
16
- var ENTRY = "src/app.tsx";
17
-
18
- /** Where TanStack's generator writes the route tree. */
19
- var TREE = "src/routeTree.gen.ts";
20
-
21
- /** Where a file-based project keeps its route files. */
22
- var ROUTES_DIR = "src/routes";
7
+ import { A as ARTIFACT_KEYS, a as ARTIFACT_PREFIXES } from './artifactKeys-3a40f3a0.esm.js';
8
+ export { A as ARTIFACT_KEYS, a as ARTIFACT_PREFIXES } from './artifactKeys-3a40f3a0.esm.js';
23
9
 
24
10
  // A minimal posix path resolver. The builder runs in the browser, so node:path
25
11
  // is unavailable, and pulling a polyfill in for two functions is not worth it.
@@ -2845,6 +2831,105 @@ function publishPayload(build, extra) {
2845
2831
  }, extra);
2846
2832
  }
2847
2833
 
2834
+ /** One artifact, ready to declare and to upload. */
2835
+
2836
+ /**
2837
+ * Every artifact a build publishes, by key.
2838
+ *
2839
+ * Async because the hashes are, and the hashes are because `crypto.subtle` is
2840
+ * the one digest available both in a tab and in Node -- see `hash.ts`.
2841
+ *
2842
+ * An empty stylesheet is omitted rather than uploaded as an empty artifact: a
2843
+ * project with no CSS has no `css` key, which is what `loaderPayload.ts` reads
2844
+ * `text("css") !== undefined` to decide.
2845
+ */
2846
+ function publishArtifacts(_x) {
2847
+ return _publishArtifacts.apply(this, arguments);
2848
+ }
2849
+ function _publishArtifacts() {
2850
+ _publishArtifacts = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(build) {
2851
+ var options,
2852
+ encoder,
2853
+ out,
2854
+ single,
2855
+ group,
2856
+ _args2 = arguments;
2857
+ return _regenerator().w(function (_context2) {
2858
+ while (1) switch (_context2.n) {
2859
+ case 0:
2860
+ options = _args2.length > 1 && _args2[1] !== undefined ? _args2[1] : {};
2861
+ encoder = new TextEncoder();
2862
+ out = [];
2863
+ single = function single(key, body) {
2864
+ if (body === undefined || body === "") return;
2865
+ out.push({
2866
+ key: key,
2867
+ body: body
2868
+ });
2869
+ };
2870
+ single(ARTIFACT_KEYS.server, build.serverCode);
2871
+ single(ARTIFACT_KEYS.client, build.clientCode);
2872
+ single(ARTIFACT_KEYS.css, build.cssCode);
2873
+ single(ARTIFACT_KEYS.rsc, build.rscCode);
2874
+ if (options.projectSource !== undefined) {
2875
+ single(ARTIFACT_KEYS.source, JSON.stringify(options.projectSource));
2876
+ }
2877
+ group = function group(prefix, record) {
2878
+ for (var _i = 0, _Object$entries = Object.entries(record !== null && record !== void 0 ? record : {}); _i < _Object$entries.length; _i++) {
2879
+ var _Object$entries$_i = _slicedToArray(_Object$entries[_i], 2),
2880
+ name = _Object$entries$_i[0],
2881
+ body = _Object$entries$_i[1];
2882
+ /*
2883
+ * The name is appended and nothing else touches it. An asset is addressed
2884
+ * by the path the built code imports it at, so normalising it here --
2885
+ * stripping, lowercasing, re-joining -- produces a bundle whose imports
2886
+ * resolve to nothing, at runtime, in the isolate. `loaderPayload.ts` says
2887
+ * the same thing on the way back.
2888
+ */
2889
+ out.push({
2890
+ key: "".concat(prefix).concat(name),
2891
+ body: body
2892
+ });
2893
+ }
2894
+ };
2895
+ group(ARTIFACT_PREFIXES.serverChunks, build.serverChunks);
2896
+ group(ARTIFACT_PREFIXES.clientChunks, build.clientChunks);
2897
+ group(ARTIFACT_PREFIXES.rscChunks, build.rscChunks);
2898
+ group(ARTIFACT_PREFIXES.assetFiles, build.assetFiles);
2899
+ group(ARTIFACT_PREFIXES.publicFiles, build.publicFiles);
2900
+ return _context2.a(2, Promise.all(out.map(/*#__PURE__*/function () {
2901
+ var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(_ref) {
2902
+ var key, body, _t, _t2, _t3, _t4;
2903
+ return _regenerator().w(function (_context) {
2904
+ while (1) switch (_context.n) {
2905
+ case 0:
2906
+ key = _ref.key, body = _ref.body;
2907
+ _t = key;
2908
+ _t2 = body;
2909
+ _context.n = 1;
2910
+ return sha256Hex(body);
2911
+ case 1:
2912
+ _t3 = _context.v;
2913
+ _t4 = encoder.encode(body).length;
2914
+ return _context.a(2, {
2915
+ key: _t,
2916
+ body: _t2,
2917
+ sha256: _t3,
2918
+ bytes: _t4
2919
+ });
2920
+ }
2921
+ }, _callee);
2922
+ }));
2923
+ return function (_x2) {
2924
+ return _ref2.apply(this, arguments);
2925
+ };
2926
+ }())));
2927
+ }
2928
+ }, _callee2);
2929
+ }));
2930
+ return _publishArtifacts.apply(this, arguments);
2931
+ }
2932
+
2848
2933
  /*
2849
2934
  * The git tree hash of a file record, computed the way git computes it.
2850
2935
  *
@@ -3168,24 +3253,34 @@ function _typeof(o) {
3168
3253
  * Where a Val project keeps the module this replaces.
3169
3254
  *
3170
3255
  * Exported because a caller has to be able to rewrite JUST this file. The
3171
- * commit is baked into it (see `BUILT_FROM` in the template), and the files a publish
3172
- * hands over are the `.val.ts` ones it patched -- this is never among them, so a tab
3173
- * that merged a save and rebuilt would compile the NEW content against the OLD
3174
- * commit and read the wrong version of it back.
3256
+ * commit is baked into it (see `BUILT_FROM` in the template), and the files a save
3257
+ * writes are the `.val.ts` ones it patched -- this is never among them, so a tab
3258
+ * that laid a save over the project and rebuilt would compile the NEW content
3259
+ * against the OLD commit and read the wrong version of it back. `rebakeGit` is
3260
+ * what the Studio calls.
3175
3261
  */
3176
3262
  var VAL_SERVER_PATH = "src/val/val.server.ts";
3177
3263
  var VAL_SERVER = VAL_SERVER_PATH;
3178
3264
  var PROJECT_SOURCE_TYPES = "src/val/project-source.d.ts";
3179
3265
 
3180
3266
  /**
3181
- * The sentinel host a wired app reaches its platform at.
3267
+ * The first line of every `val.server.ts` this file generates, and how
3268
+ * {@link isWired} recognises one.
3182
3269
  *
3183
- * Spelled out here rather than imported from the loader: this package is built
3184
- * into a browser bundle and the loader's into a Worker. One name in two
3185
- * spellings is the risk, which is why this is a constant used by both the
3186
- * template it goes into and the check that reads it back out.
3270
+ * A comment rather than anything the file DOES, because a wired file no longer
3271
+ * does anything no other Val host does: it used to post the files a save
3272
+ * committed to `platform.internal`, for a builder tab to pick up, and that
3273
+ * sentinel host was the marker. A managed project's Studio builds in its own
3274
+ * tab now, the loader refuses that door, and the post went with it.
3275
+ */
3276
+ var WIRED_MARKER = "// Wired for the Val platform by @valbuild/tanstack-build. Regenerated on publish.";
3277
+
3278
+ /**
3279
+ * The sentinel host a file wired BEFORE {@link WIRED_MARKER} existed posted to.
3280
+ * Still recognised by {@link isWired}, so a project published by an older
3281
+ * publisher is not wired twice.
3187
3282
  */
3188
- var CONTROL_HOST = "platform.internal";
3283
+ var LEGACY_CONTROL_HOST = "platform.internal";
3189
3284
 
3190
3285
  /**
3191
3286
  * The editing backend, as this platform needs it.
@@ -3199,14 +3294,8 @@ var CONTROL_HOST = "platform.internal";
3199
3294
  * buffered every draft image through the isolate. Two behaviours nobody chose,
3200
3295
  * out of one word.
3201
3296
  *
3202
- * Two things differ, and each is load bearing:
3297
+ * One thing differs, and it is load bearing:
3203
3298
  *
3204
- * - **`publishOverride`** is the seam, and the only place this platform is
3205
- * unlike any other host. A publish here commits -- the default, handed over as
3206
- * `commitToGit` -- AND puts the files it committed where the platform can
3207
- * reach them, because there is no bundler in the isolate: the studio tab picks
3208
- * them up, builds, and the result
3209
- * is served immediately instead of a host noticing the commit and redeploying.
3210
3299
  * - **no formatter.** A repository passes prettier here so a patch written to
3211
3300
  * disk comes out formatted like the rest of the code. Prettier's bundle
3212
3301
  * TDZ-crashes in a Worker isolate ("Cannot access 'y' before
@@ -3219,9 +3308,8 @@ var CONTROL_HOST = "platform.internal";
3219
3308
  * running needs.
3220
3309
  */
3221
3310
  var valServerSource = function valServerSource(_ref) {
3222
- var project = _ref.project,
3223
- git = _ref.git;
3224
- return "import {\n initValContent,\n initValServer,\n} from \"@valbuild/tanstack/server\";\nimport { config } from \"../../val.config\";\nimport valModules from \"../../val.modules\";\n\n/**\n * A secret, as the platform hands it over at RUNTIME.\n *\n * Preferred over `process.env`, which the builder inlines as a literal into\n * this bundle: that puts the value in storage inside the code, copies it into\n * every isolate that loads it, and makes rotating it a republish.\n *\n * Falls back to the build-time value, so an app published before secrets\n * existed keeps working.\n */\nfunction secret(name: string): string | undefined {\n return (globalThis.__PLATFORM_SECRETS ?? {})[name] ?? process.env[name];\n}\n\n/**\n * Hand the files a publish committed back to the platform, to be built.\n *\n * There is no bundler in the isolate, so the commit a publish just made cannot\n * become a running site on its own. This writes what the commit contained, with\n * the commit's own sha, to the platform's pending source, and the studio tab\n * picks that up and builds. The sha is not a receipt: it is what the next build\n * is wired AT, so handing over the wrong one produces a build that reads a\n * different version of its content than it was compiled from.\n *\n * Named for `putPendingSource` in the loader's storage, which is what the\n * other side of this request calls -- along with `getPendingSource` and\n * `clearPendingSource`, which the studio tab uses to pick it up and let it go.\n * One mechanism, one noun, however many processes it crosses.\n */\nasync function putPendingSource(\n patchedSourceFiles: Record<string, string | null>,\n commitSha?: string,\n /**\n * What the commit was built ON, and what it points AT.\n *\n * Both optional, and absent is meaningful rather than lazy: a Val too old to\n * report them sends neither, and the platform has to be able to tell that\n * apart from a commit that genuinely has no parent. It falls back to treating\n * the hand-over as unchained -- correct but conservative -- rather than\n * assuming it is a root commit and concluding the history starts here.\n */\n parentSha?: string,\n treeSha?: string,\n) {\n try {\n /*\n * A name the PLATFORM serves, not a URL on the internet.\n *\n * This used to post to the loader's public address, which works in dev --\n * a different port on loopback -- and cannot work deployed: a Worker may\n * not fetch the hostname it is itself served on, so Cloudflare resolved\n * the subrequest away and answered 404. A save then failed with Val's\n * `HTTPError` and the real cause only in the isolate's log.\n *\n * The platform intercepts this host and answers it from inside, so the\n * door is one it holds rather than one this file knows the address of.\n * `.internal` resolves nowhere, so if interception ever stopped, this\n * fails closed instead of reaching a stranger.\n */\n const res = await fetch(\"https://".concat(CONTROL_HOST, "/__api/source\", {\n method: \"POST\",\n headers: { \"content-type\": \"application/json\" },\n body: JSON.stringify({\n /*\n * The project this isolate is actually SERVING, not the one it was\n * generated for.\n *\n * The platform sets __PLATFORM_PROJECT_ID per request from the id the loader\n * resolved off the hostname. The literal is only a fallback, for a build\n * served by a platform too old to set it -- and it is a bad one: publish\n * the same bundle to two projects and every edit made on either lands\n * under whichever name was baked in here.\n */\n project: projectId(),\n files: patchedSourceFiles,\n commitSha,\n /*\n * Spread, so a Val that did not report them leaves the keys out of the\n * body entirely. `parentSha: undefined` would serialise to nothing\n * anyway, but the platform reads this body with a schema, and an\n * explicitly-absent key is what lets it distinguish \"this build's Val\n * cannot tell me\" from \"there is no parent\".\n */\n ...(parentSha !== undefined ? { parentSha } : {}),\n ...(treeSha !== undefined ? { treeSha } : {}),\n }),\n });\n if (!res.ok) {\n throw new Error(`source endpoint returned ${res.status}`);\n }\n } catch (error) {\n throw new Error(`PENDING_SOURCE_FAILED: ${String(error)}`);\n }\n}\n\n/** The project this isolate is serving. See the note in `putPendingSource`. */\nfunction projectId() {\n return globalThis.__PLATFORM_PROJECT_ID ?? ").concat(JSON.stringify(project), ";\n}\n\n/**\n * The commit this build was made from, and the branch it commits to.\n *\n * Baked in rather than handed over at runtime, unlike a secret, because it is\n * not configuration -- it is a property OF THIS BUILD. Every read of a\n * `.val.ts` in http mode fetches that path from the content service at this\n * sha, so a build served with somebody else's commit renders and edits a\n * version of its files it was not compiled from. A secret can be rotated under\n * a running build; this cannot, and publishing again is how it changes.\n *\n * WHAT THIS IS NOT. It is not every read: a committed render reads the source\n * bundled into this build and asks the content service nothing. It is the\n * PUBLISH path -- turning pending patches into new `.val.ts` text means\n * fetching the current text to patch, and that is the read that happens at\n * this sha. The docblock used to say \"every read\", which sent readers looking\n * for a content call on the serving path that is not there.\n *\n * `null` when the source came from no commit -- a record assembled in a tab,\n * a fixture, or ANY build this platform makes, which is the common case rather\n * than the exception. Such a build has no repository to mirror commits into,\n * and does not need one: the content service is the store of record for\n * content and mints its own commit shas. Val is in http mode on credentials\n * alone.\n */\nconst BUILT_FROM = ").concat(git ? JSON.stringify(git) : "null", ";\n\n/**\n * What puts Val in http mode: its content service owns the content.\n *\n * The same three things any deployed Val app is configured with. Note what is\n * NOT here: no `sourceFiles`, so patches are relayed to the content service\n * instead of being kept by this platform, and the browser uploads an image\n * straight there on a presigned URL instead of streaming it through here.\n *\n * `undefined` when a credential or the commit is missing, and deliberately not\n * a throw at module scope: that would take the isolate down with it, page\n * renders included. Val is left to refuse the request and name what it wanted\n * -- `VAL_ENV=app` is set on this build precisely so that a missing credential\n * is an error instead of a fall-through to `fs` mode, looking for a working\n * tree that is not in here.\n */\nconst apiKey = secret(\"VAL_API_KEY\");\nconst valSecret = secret(\"VAL_SECRET\");\n/*\n * Which content service, for a project that is not pointed at the real one.\n *\n * A secret rather than a baked literal, because unlike the commit this IS\n * configuration: the same build should be servable against a stand-in and\n * against production. It is what makes the editing path testable at all --\n * Val's own `e2e/mock-content-host` implements this wire protocol with no git\n * repository behind it -- and without it a build could only ever talk to\n * content.val.build.\n *\n * It does NOT redirect everything, and the gap is in Val rather than here:\n * `getSettings`, which remote FILES use, reads `process.env.VAL_CONTENT_URL`\n * at module scope inside @valbuild/server. This platform bundles its\n * dependencies separately from the app, so nothing it sets reaches that read --\n * the same reason `apiKey` has to be passed in rather than found. So patches,\n * commits and source reads go where this says, and remote file uploads still\n * address the real host.\n */\nconst valContentUrl = secret(\"VAL_CONTENT_URL\");\n/*\n * WHICH project's content this is, at the content service.\n *\n * Val's own name for the project (`org/name`), which is not the platform's\n * project id and cannot be derived from it. A repository that is deployed\n * anywhere else puts it in `val.config.ts`; one imported here need not have,\n * so it is configuration the platform can supply -- and it goes through\n * `secret` rather than `--env` for a second reason: a build-time literal\n * would have to be baked into the shared dependency layer, where\n * @valbuild/server reads `process.env.VAL_PROJECT`, and that layer is reused\n * by every project with the same dependencies.\n *\n * What the app configured wins over nothing at all, so a repository that does\n * name its project keeps working with no secret set.\n */\nconst valProject = secret(\"VAL_PROJECT\");\nconst valConfig = {\n ...config,\n ...(valProject !== undefined ? { project: valProject } : {}),\n};\n/*\n * CREDENTIALS ALONE. A commit is not part of what puts Val in http mode.\n *\n * It used to be: `GIT !== null` was in this condition, and a build with no\n * commit fell through to `undefined` -- which meant every site this platform\n * seeded was silently unable to edit, because a shared build cannot know a\n * commit. The binding that worked around it (`VAL_GIT_COMMIT` /\n * `VAL_GIT_BRANCH` out of the project's secrets) is gone with it: it named a\n * commit in the TEMPLATE's repository, which was true only for as long as\n * seeding and repository creation shared a template, and it was one more thing\n * in KV that could go stale.\n *\n * The commit is optional NOW, and it is still sent where there is one -- see\n * the note at the spread below. What is gone is the binding that supplied one\n * from KV, so there is one source per environment and no precedence rule\n * between a baked value and a bound one.\n */\nconst http =\n apiKey !== undefined && valSecret !== undefined\n ? {\n apiKey,\n valSecret,\n /*\n * BOTH SPELLINGS OF THE COMMIT, because the APP decides which one is\n * read and this file cannot know which app it is being written into.\n *\n * `ValHttpMode` has been renamed in both directions. Up to 0.132 it\n * took `gitCommit`/`gitBranch`; 0.133.0 replaced that pair with a\n * nested `git`; the version this package ships beside flattens it\n * back again. The generated file is compiled against whatever\n * `@valbuild/tanstack` the PROJECT installed -- the starter pins\n * 0.133.0 -- and a platform writing this file has no say in that. So\n * this is not one rename behind or ahead: it is on both sides of one at\n * once, and will be until every app it publishes has moved.\n *\n * Sending only the wrong one is SILENT, which is why this is belt and\n * braces rather than a version check. An unknown key on the options\n * object is ignored, so the commit is simply dropped and a build wired\n * FROM A COMMIT runs as though it had none -- which means a publish\n * produces no mirrored `.val.ts`, so a save commits and hands over\n * nothing, and the site keeps serving its old content with the patches\n * already consumed. Nothing reports it. valbuild/home's loop is the one\n * thing that sees it, and it was bisected there: 25/25 with the key the\n * installed version reads, 21/23 without, failing at exactly \"the save\n * left the file it rewrote pending\".\n *\n * Whichever version is installed reads its own key and ignores the\n * other two. Drop this to one spelling when every app this platform\n * publishes is past the rename -- not before, and not on the say-so of\n * a compiler in the Val repository, which is looking at a different\n * version of `@valbuild/tanstack` than the app is.\n */\n ...(BUILT_FROM !== null\n ? {\n git: BUILT_FROM,\n gitCommit: BUILT_FROM.commit,\n gitBranch: BUILT_FROM.branch,\n }\n : {}),\n ...(valContentUrl !== undefined ? { valContentUrl } : {}),\n }\n : undefined;\n\nconst { valApiHandler, draftMode } = initValServer(\n valModules,\n valConfig,\n {\n ...(http ? { http } : {}),\n /*\n * The one thing this platform does differently from any other Val host.\n *\n * A publish in http mode is a git commit, and that stays: `commitToGit` is\n * the default, handed over rather than skipped, and calling it is what makes\n * the content service mark the patches published and the repository carry\n * the change. What is ADDED is the build -- the tab picks the pending\n * source up, compiles it, and the result is served immediately, rather than\n * a host noticing the commit and redeploying minutes later.\n *\n * ORDER: commit, then hand over. The commit is the source of truth, and\n * writing the pending source first would mean a build whose content the\n * content service does not have yet, so every read in it would resolve the\n * previous commit -- the site showing pre-save content with the edits\n * already consumed.\n *\n * A hand-over that fails after a commit that succeeded is NOT reported as a\n * failed publish, which is deliberate: the commit happened, and saying it\n * did not is the more misleading of the two. What is lost is the immediate\n * rebuild, so the site serves its previous build until the next publish --\n * recoverable, and the tab can reload the repository at the new commit to\n * do it.\n */\n publishOverride: async ({ patchedSourceFiles, commitToGit }) => {\n const committed = await commitToGit();\n if (committed.error) {\n return committed;\n }\n try {\n await putPendingSource(\n patchedSourceFiles,\n committed.commit,\n /*\n * Added by @valbuild/server after 0.132.0. An older one has neither\n * field and the platform is told nothing rather than told wrongly --\n * see the note on the parameters.\n */\n committed.parent,\n committed.tree,\n );\n } catch (error) {\n console.error(\n \"Val: the commit landed, but the platform could not be given the \" +\n \"files to build. The site serves its previous build until it is \" +\n \"published again.\",\n error,\n );\n }\n return committed;\n },\n },\n);\n\nconst {\n fetchValStega: fetchVal,\n fetchValKeyStega: fetchValKey,\n fetchValRouteStega: fetchValRoute,\n fetchValRouteUrl,\n} = initValContent(valConfig, valModules, {\n draftMode,\n /*\n * The SAME object the API got.\n *\n * These readers resolve content through a Val server of their own rather than\n * by calling the API over HTTP, so the mode question is put to them\n * separately -- configuring only `initValServer` left them inferring `fs`\n * mode, looking for a working tree that is not in here. `gitCommit` is the\n * field that would be silently wrong rather than loudly missing: two\n * different shas means the API edits one version of a file while the page\n * renders another.\n */\n ...(http ? { http } : {}),\n});\n\n/**\n * A build that is MEANT to edit and cannot, refusing instead of pretending to.\n *\n * `BUILT_FROM` being non-null says this build came from a commit, so it was\n * made to edit against a content service. If the credentials for that service are not\n * here, the configuration is broken -- and the failure that was reaching people\n * was not an error at all. Val picks its storage mode by inference, so an\n * isolate with no api key lands in a mode that ACCEPTS the write and keeps it\n * in the isolate. Cloudflare starts an isolate per concurrent request, so the\n * save answers 200 and the next request, served by a different isolate, has\n * never heard of it. The edit is simply gone, and nothing anywhere said so.\n *\n * That is the worst available outcome: a person is told their work is saved\n * when it is not. Refusing is strictly better, and naming the missing secret\n * turns an evening of reading logs into one line in a response body.\n *\n * WHY HERE rather than relying on `VAL_ENV=app`: that is a build-time\n * substitution into the shared dependency layer, so whether a build fails\n * loudly depends on which layer it happens to be pinned to. This file is\n * written on every build, by the platform, and cannot be missing from one.\n *\n * Only the editing API. Page renders do not come through here, and a site whose\n * content cannot be edited should still serve the content it has.\n */\nconst editingApiHandler =\n http === undefined\n ? async () => {\n const missing = [\n apiKey === undefined ? \"VAL_API_KEY\" : null,\n valSecret === undefined ? \"VAL_SECRET\" : null,\n /*\n * A build from no commit is listed the same way, because from the\n * outside the two are one state. It is not a secret somebody can set\n * -- a commit is a property OF THE BUILD, and the only cure is\n * publishing this project's own repository over whatever is serving\n * it. Named anyway, because \"it was built from no commit\" is the\n * sentence that ends the search.\n */\n BUILT_FROM === null ? \"a commit (this build was made from none)\" : null,\n ].filter(Boolean);\n return Response.json(\n {\n error:\n \"This site cannot be edited. Its content lives in a content service, and \" +\n missing.join(\", \") +\n \" \" +\n (missing.length > 1 ? \"are\" : \"is\") +\n \" missing, so there is nothing to edit against. Editing is refused rather \" +\n \"than kept in this isolate's memory, where it would be lost without being \" +\n \"reported.\" +\n (BUILT_FROM === null\n ? \" A build made from no commit is usually one SEEDED from a template: \" +\n \"publish this project's own repository to replace it.\"\n : \" This build was made from commit \" + BUILT_FROM.commit.slice(0, 8) + \".\"),\n missing,\n },\n { status: 503 },\n );\n }\n : valApiHandler;\n\nexport {\n editingApiHandler as valApiHandler,\n draftMode,\n fetchVal,\n fetchValKey,\n fetchValRoute,\n fetchValRouteUrl,\n};\n");
3311
+ var git = _ref.git;
3312
+ return "".concat(WIRED_MARKER, "\nimport {\n initValContent,\n initValServer,\n} from \"@valbuild/tanstack/server\";\nimport { config } from \"../../val.config\";\nimport valModules from \"../../val.modules\";\n/*\n * This build's own source, which a publish patches. A project with no\n * repository has no other copy of its `.val.ts` text: content keeps its\n * content as data. Ignored by a @valbuild/tanstack that predates it.\n */\nimport { FILES } from \"platform:project-source\";\n\n/**\n * A secret, as the platform hands it over at RUNTIME.\n *\n * Preferred over `process.env`, which the builder inlines as a literal into\n * this bundle: that puts the value in storage inside the code, copies it into\n * every isolate that loads it, and makes rotating it a republish.\n *\n * Falls back to the build-time value, so an app published before secrets\n * existed keeps working.\n */\nfunction secret(name: string): string | undefined {\n return (globalThis.__PLATFORM_SECRETS ?? {})[name] ?? process.env[name];\n}\n\n/**\n * The commit this build was made from, and the branch it commits to.\n *\n * Baked in rather than handed over at runtime, unlike a secret, because it is\n * not configuration -- it is a property OF THIS BUILD. Every read of a\n * `.val.ts` in http mode fetches that path from the content service at this\n * sha, so a build served with somebody else's commit renders and edits a\n * version of its files it was not compiled from. A secret can be rotated under\n * a running build; this cannot, and publishing again is how it changes.\n *\n * WHAT THIS IS NOT. It is not every read: a committed render reads the source\n * bundled into this build and asks the content service nothing. It is the\n * PUBLISH path -- turning pending patches into new `.val.ts` text means\n * fetching the current text to patch, and that is the read that happens at\n * this sha. The docblock used to say \"every read\", which sent readers looking\n * for a content call on the serving path that is not there.\n *\n * `null` when the source came from no commit -- a record assembled in a tab,\n * a fixture, or ANY build this platform makes, which is the common case rather\n * than the exception. Such a build has no repository to mirror commits into,\n * and does not need one: the content service is the store of record for\n * content and mints its own commit shas. Val is in http mode on credentials\n * alone.\n */\nconst BUILT_FROM = ").concat(git ? JSON.stringify(git) : "null", ";\n\n/**\n * What puts Val in http mode: its content service owns the content.\n *\n * The same three things any deployed Val app is configured with. Note what is\n * NOT here: no `sourceFiles`, so patches are relayed to the content service\n * instead of being kept by this platform, and the browser uploads an image\n * straight there on a presigned URL instead of streaming it through here.\n *\n * `undefined` when a credential or the commit is missing, and deliberately not\n * a throw at module scope: that would take the isolate down with it, page\n * renders included. Val is left to refuse the request and name what it wanted\n * -- `VAL_ENV=app` is set on this build precisely so that a missing credential\n * is an error instead of a fall-through to `fs` mode, looking for a working\n * tree that is not in here.\n */\nconst apiKey = secret(\"VAL_API_KEY\");\nconst valSecret = secret(\"VAL_SECRET\");\n/*\n * Which content service, for a project that is not pointed at the real one.\n *\n * A secret rather than a baked literal, because unlike the commit this IS\n * configuration: the same build should be servable against a stand-in and\n * against production. It is what makes the editing path testable at all --\n * Val's own `e2e/mock-content-host` implements this wire protocol with no git\n * repository behind it -- and without it a build could only ever talk to\n * content.val.build.\n *\n * It does NOT redirect everything, and the gap is in Val rather than here:\n * `getSettings`, which remote FILES use, reads `process.env.VAL_CONTENT_URL`\n * at module scope inside @valbuild/server. This platform bundles its\n * dependencies separately from the app, so nothing it sets reaches that read --\n * the same reason `apiKey` has to be passed in rather than found. So patches,\n * commits and source reads go where this says, and remote file uploads still\n * address the real host.\n */\nconst valContentUrl = secret(\"VAL_CONTENT_URL\");\n/*\n * WHICH project's content this is, at the content service.\n *\n * Val's own name for the project (`org/name`), which is not the platform's\n * project id and cannot be derived from it. A repository that is deployed\n * anywhere else puts it in `val.config.ts`; one imported here need not have,\n * so it is configuration the platform can supply -- and it goes through\n * `secret` rather than `--env` for a second reason: a build-time literal\n * would have to be baked into the shared dependency layer, where\n * @valbuild/server reads `process.env.VAL_PROJECT`, and that layer is reused\n * by every project with the same dependencies.\n *\n * What the app configured wins over nothing at all, so a repository that does\n * name its project keeps working with no secret set.\n */\nconst valProject = secret(\"VAL_PROJECT\");\nconst valConfig = {\n ...config,\n ...(valProject !== undefined ? { project: valProject } : {}),\n};\n/*\n * CREDENTIALS ALONE. A commit is not part of what puts Val in http mode.\n *\n * It used to be: `GIT !== null` was in this condition, and a build with no\n * commit fell through to `undefined` -- which meant every site this platform\n * seeded was silently unable to edit, because a shared build cannot know a\n * commit. The binding that worked around it (`VAL_GIT_COMMIT` /\n * `VAL_GIT_BRANCH` out of the project's secrets) is gone with it: it named a\n * commit in the TEMPLATE's repository, which was true only for as long as\n * seeding and repository creation shared a template, and it was one more thing\n * in KV that could go stale.\n *\n * The commit is optional NOW, and it is still sent where there is one -- see\n * the note at the spread below. What is gone is the binding that supplied one\n * from KV, so there is one source per environment and no precedence rule\n * between a baked value and a bound one.\n */\nconst http =\n apiKey !== undefined && valSecret !== undefined\n ? {\n apiKey,\n valSecret,\n /*\n * BOTH SPELLINGS OF THE COMMIT, because the APP decides which one is\n * read and this file cannot know which app it is being written into.\n *\n * `ValHttpMode` has been renamed in both directions. Up to 0.132 it\n * took `gitCommit`/`gitBranch`; 0.133.0 replaced that pair with a\n * nested `git`; the version this package ships beside flattens it\n * back again. The generated file is compiled against whatever\n * `@valbuild/tanstack` the PROJECT installed -- the starter pins\n * 0.133.0 -- and a platform writing this file has no say in that. So\n * this is not one rename behind or ahead: it is on both sides of one at\n * once, and will be until every app it publishes has moved.\n *\n * Sending only the wrong one is SILENT, which is why this is belt and\n * braces rather than a version check. An unknown key on the options\n * object is ignored, so the commit is simply dropped and a build wired\n * FROM A COMMIT runs as though it had none -- which means a publish\n * produces no mirrored `.val.ts`, so a save commits and hands over\n * nothing, and the site keeps serving its old content with the patches\n * already consumed. Nothing reports it. valbuild/home's loop is the one\n * thing that sees it, and it was bisected there: 25/25 with the key the\n * installed version reads, 21/23 without, failing at exactly \"the save\n * left the file it rewrote pending\".\n *\n * Whichever version is installed reads its own key and ignores the\n * other two. Drop this to one spelling when every app this platform\n * publishes is past the rename -- not before, and not on the say-so of\n * a compiler in the Val repository, which is looking at a different\n * version of `@valbuild/tanstack` than the app is.\n */\n ...(BUILT_FROM !== null\n ? {\n git: BUILT_FROM,\n gitCommit: BUILT_FROM.commit,\n gitBranch: BUILT_FROM.branch,\n }\n : {}),\n ...(valContentUrl !== undefined ? { valContentUrl } : {}),\n projectSource: FILES,\n }\n : undefined;\n\nconst { valApiHandler, draftMode } = initValServer(\n valModules,\n valConfig,\n {\n ...(http ? { http } : {}),\n },\n);\n\nconst {\n fetchValStega: fetchVal,\n fetchValKeyStega: fetchValKey,\n fetchValRouteStega: fetchValRoute,\n fetchValRouteUrl,\n} = initValContent(valConfig, valModules, {\n draftMode,\n /*\n * The SAME object the API got.\n *\n * These readers resolve content through a Val server of their own rather than\n * by calling the API over HTTP, so the mode question is put to them\n * separately -- configuring only `initValServer` left them inferring `fs`\n * mode, looking for a working tree that is not in here. `gitCommit` is the\n * field that would be silently wrong rather than loudly missing: two\n * different shas means the API edits one version of a file while the page\n * renders another.\n */\n ...(http ? { http } : {}),\n});\n\n/**\n * A build that is MEANT to edit and cannot, refusing instead of pretending to.\n *\n * `BUILT_FROM` being non-null says this build came from a commit, so it was\n * made to edit against a content service. If the credentials for that service are not\n * here, the configuration is broken -- and the failure that was reaching people\n * was not an error at all. Val picks its storage mode by inference, so an\n * isolate with no api key lands in a mode that ACCEPTS the write and keeps it\n * in the isolate. Cloudflare starts an isolate per concurrent request, so the\n * save answers 200 and the next request, served by a different isolate, has\n * never heard of it. The edit is simply gone, and nothing anywhere said so.\n *\n * That is the worst available outcome: a person is told their work is saved\n * when it is not. Refusing is strictly better, and naming the missing secret\n * turns an evening of reading logs into one line in a response body.\n *\n * WHY HERE rather than relying on `VAL_ENV=app`: that is a build-time\n * substitution into the shared dependency layer, so whether a build fails\n * loudly depends on which layer it happens to be pinned to. This file is\n * written on every build, by the platform, and cannot be missing from one.\n *\n * Only the editing API. Page renders do not come through here, and a site whose\n * content cannot be edited should still serve the content it has.\n */\nconst editingApiHandler =\n http === undefined\n ? async () => {\n const missing = [\n apiKey === undefined ? \"VAL_API_KEY\" : null,\n valSecret === undefined ? \"VAL_SECRET\" : null,\n /*\n * A build from no commit is listed the same way, because from the\n * outside the two are one state. It is not a secret somebody can set\n * -- a commit is a property OF THE BUILD, and the only cure is\n * publishing this project's own repository over whatever is serving\n * it. Named anyway, because \"it was built from no commit\" is the\n * sentence that ends the search.\n */\n BUILT_FROM === null ? \"a commit (this build was made from none)\" : null,\n ].filter(Boolean);\n return Response.json(\n {\n error:\n \"This site cannot be edited. Its content lives in a content service, and \" +\n missing.join(\", \") +\n \" \" +\n (missing.length > 1 ? \"are\" : \"is\") +\n \" missing, so there is nothing to edit against. Editing is refused rather \" +\n \"than kept in this isolate's memory, where it would be lost without being \" +\n \"reported.\" +\n (BUILT_FROM === null\n ? \" A build made from no commit is usually one SEEDED from a template: \" +\n \"publish this project's own repository to replace it.\"\n : \" This build was made from commit \" + BUILT_FROM.commit.slice(0, 8) + \".\"),\n missing,\n },\n { status: 503 },\n );\n }\n : valApiHandler;\n\nexport {\n editingApiHandler as valApiHandler,\n draftMode,\n fetchVal,\n fetchValKey,\n fetchValRoute,\n fetchValRouteUrl,\n};\n");
3225
3313
  };
3226
3314
 
3227
3315
  /**
@@ -3258,6 +3346,14 @@ function wiredValServer(options) {
3258
3346
  * build IS the published source, and the commit it was published at is a
3259
3347
  * literal inside its own `val.server.ts`.
3260
3348
  */
3349
+ /**
3350
+ * The one line that carries the commit.
3351
+ *
3352
+ * Shared by the reader below and the rewriter under it, so the two cannot
3353
+ * disagree about the format -- which they would silently, since a failed parse
3354
+ * and a build made from no commit are the same answer.
3355
+ */
3356
+ var BUILT_FROM_LINE = /^const BUILT_FROM = (.+);$/m;
3261
3357
  function bakedGit(files) {
3262
3358
  var source = files[VAL_SERVER];
3263
3359
  if (source === undefined) return undefined;
@@ -3271,7 +3367,7 @@ function bakedGit(files) {
3271
3367
  * platform build bakes nothing and binds nothing, and this returns
3272
3368
  * `undefined` for one -- which is the truth about it.
3273
3369
  */
3274
- var match = /^const BUILT_FROM = (.+);$/m.exec(source);
3370
+ var match = BUILT_FROM_LINE.exec(source);
3275
3371
  if (!(match !== null && match !== void 0 && match[1]) || match[1] === "null") return undefined;
3276
3372
  try {
3277
3373
  var parsed = JSON.parse(match[1]);
@@ -3290,6 +3386,35 @@ function bakedGit(files) {
3290
3386
  }
3291
3387
  }
3292
3388
 
3389
+ /**
3390
+ * The same record, wired at a different commit.
3391
+ *
3392
+ * The inverse of {@link bakedGit}, and the whole of what a rebuild has to
3393
+ * change: `BUILT_FROM` is the only place the commit appears, and every other
3394
+ * use in the generated file reads it.
3395
+ *
3396
+ * REWRITES one line rather than regenerating the file, and that is the point.
3397
+ * `wiredValServer` needs the project id and the platform's address, which the
3398
+ * publisher that has them is the tab; a Studio publishing from inside the
3399
+ * deployment has neither, and reconstructing the file from what it could guess
3400
+ * would throw away wiring it cannot see. Replacing the literal cannot.
3401
+ *
3402
+ * Returns the record unchanged when there is nothing to rewrite -- no
3403
+ * `val.server.ts`, or one this does not recognise. Unchanged rather than
3404
+ * thrown, because the caller's next step is a build, and a build of a record
3405
+ * with no wired server is a project that was never wired: a real thing, which
3406
+ * fails with its own message rather than this one.
3407
+ *
3408
+ * Non-destructive, like {@link wireUp}: the caller's record is what gets
3409
+ * published back as source.
3410
+ */
3411
+ function rebakeGit(files, git) {
3412
+ var source = files[VAL_SERVER];
3413
+ if (source === undefined) return files;
3414
+ if (!BUILT_FROM_LINE.test(source)) return files;
3415
+ return _objectSpread2(_objectSpread2({}, files), {}, _defineProperty({}, VAL_SERVER, source.replace(BUILT_FROM_LINE, "const BUILT_FROM = ".concat(git === null ? "null" : JSON.stringify(git), ";"))));
3416
+ }
3417
+
3293
3418
  /** Is this a Val project at all? */
3294
3419
  function isValProject(files) {
3295
3420
  return "val.config.ts" in files && "val.modules.ts" in files;
@@ -3298,17 +3423,15 @@ function isValProject(files) {
3298
3423
  /**
3299
3424
  * Has this record already been wired up?
3300
3425
  *
3301
- * The control host is the marker. It used to be `platform:project-source`,
3302
- * which the generated file imported while Val was in memory mode and no longer
3303
- * does -- the project's source stopped being shipped into the isolate when the
3304
- * content service became what answers for it. The pending-source POST is the
3305
- * thing that cannot be anything but this platform's: no repository posts to a
3306
- * host that resolves
3307
- * nowhere, and every wired file has to, because an isolate cannot build.
3426
+ * {@link WIRED_MARKER} is the marker, or -- for a file generated before it
3427
+ * existed -- the sentinel host that file posted its saves to. It used to be
3428
+ * `platform:project-source` before that, which the generated file imported
3429
+ * while Val was in memory mode.
3308
3430
  */
3309
3431
  function isWired(files) {
3310
- var _files$VAL_SERVER$inc, _files$VAL_SERVER;
3311
- return (_files$VAL_SERVER$inc = (_files$VAL_SERVER = files[VAL_SERVER]) === null || _files$VAL_SERVER === void 0 ? void 0 : _files$VAL_SERVER.includes(CONTROL_HOST)) !== null && _files$VAL_SERVER$inc !== void 0 ? _files$VAL_SERVER$inc : false;
3432
+ var source = files[VAL_SERVER];
3433
+ if (source === undefined) return false;
3434
+ return source.startsWith(WIRED_MARKER) || source.includes(LEGACY_CONTROL_HOST);
3312
3435
  }
3313
3436
 
3314
3437
  /**
@@ -3399,4 +3522,4 @@ function wireUp(files, options) {
3399
3522
  };
3400
3523
  }
3401
3524
 
3402
- export { ENTRY, ENTRY_CHUNK, INLINE_LIMIT, PROJECT_SOURCE, PUBLIC_PREFIX, ROUTES_DIR, TREE, VAL_SERVER_PATH, aliasMap, bakedGit, base64Bytes, blobSha, buildUserApp, fetchBuildTarget, fetchBuildTargetRev, isAsset, isValProject, isWired, publishPayload, resolveInFiles, scanCandidates, treeSha, treeShaOfText, usesTailwind, wireUp, wiredValServer };
3525
+ export { ENTRY_CHUNK, INLINE_LIMIT, PROJECT_SOURCE, PUBLIC_PREFIX, VAL_SERVER_PATH, aliasMap, bakedGit, base64Bytes, blobSha, buildUserApp, fetchBuildTarget, fetchBuildTargetRev, isAsset, isValProject, isWired, publishArtifacts, publishPayload, rebakeGit, resolveInFiles, scanCandidates, treeSha, treeShaOfText, usesTailwind, wireUp, wiredValServer };
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var slicedToArray = require('../../dist/slicedToArray-80b0ffd7.cjs.dev.js');
5
+ var slicedToArray = require('../../dist/slicedToArray-12869836.cjs.dev.js');
6
6
  var rolldown = require('rolldown');
7
7
  var node_crypto = require('node:crypto');
8
8
  var node_module = require('node:module');
@@ -10,6 +10,7 @@ var promises = require('node:fs/promises');
10
10
  var node_path = require('node:path');
11
11
  var parseAst = require('rolldown/parseAst');
12
12
  var node_url = require('node:url');
13
+ var projectPaths = require('../../dist/projectPaths-f222255a.cjs.dev.js');
13
14
 
14
15
  function _interopNamespace(e) {
15
16
  if (e && e.__esModule) return e;
@@ -2008,12 +2009,9 @@ function isFileBased(_x2) {
2008
2009
  }
2009
2010
 
2010
2011
  /**
2011
- * The one line the platform needs from a file-based project.
2012
- *
2013
- * `src/app.tsx` is the entry the builder looks for, and for a routes-as-data
2014
- * project the user writes it. A file-based project has no such file -- its
2015
- * entry *is* the generated tree -- so this bridges the two contracts. A real
2016
- * integration would emit it rather than ask for it, which is what this is.
2012
+ * The one line the platform needs from a file-based project. Declared beside
2013
+ * the other contract paths, so the browser's route generator adds exactly the
2014
+ * same one; re-exported here because this is where it has always been read.
2017
2015
  */
2018
2016
  function _isFileBased() {
2019
2017
  _isFileBased = slicedToArray._asyncToGenerator(/*#__PURE__*/slicedToArray._regenerator().m(function _callee2(dir) {
@@ -2030,7 +2028,6 @@ function _isFileBased() {
2030
2028
  }));
2031
2029
  return _isFileBased.apply(this, arguments);
2032
2030
  }
2033
- var ENTRY_SHIM = "export { routeTree } from './routeTree.gen'\n";
2034
2031
 
2035
2032
  /**
2036
2033
  * Generates `routeTree.gen.ts` and returns the file map with it (and the entry
@@ -2176,7 +2173,7 @@ function _generateRouteTree() {
2176
2173
  return _context3.a(2, slicedToArray._objectSpread2(slicedToArray._objectSpread2({}, files), {}, {
2177
2174
  "src/routeTree.gen.ts": tree,
2178
2175
  // Only when the project has not written its own.
2179
- "src/app.tsx": (_files$srcAppTsx = files["src/app.tsx"]) !== null && _files$srcAppTsx !== void 0 ? _files$srcAppTsx : ENTRY_SHIM
2176
+ "src/app.tsx": (_files$srcAppTsx = files["src/app.tsx"]) !== null && _files$srcAppTsx !== void 0 ? _files$srcAppTsx : projectPaths.ENTRY_SHIM
2180
2177
  }));
2181
2178
  }
2182
2179
  }, _callee3, null, [[5,, 8, 13]]);
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var slicedToArray = require('../../dist/slicedToArray-7afed0af.cjs.prod.js');
5
+ var slicedToArray = require('../../dist/slicedToArray-149a2518.cjs.prod.js');
6
6
  var rolldown = require('rolldown');
7
7
  var node_crypto = require('node:crypto');
8
8
  var node_module = require('node:module');
@@ -10,6 +10,7 @@ var promises = require('node:fs/promises');
10
10
  var node_path = require('node:path');
11
11
  var parseAst = require('rolldown/parseAst');
12
12
  var node_url = require('node:url');
13
+ var projectPaths = require('../../dist/projectPaths-9cbecebf.cjs.prod.js');
13
14
 
14
15
  function _interopNamespace(e) {
15
16
  if (e && e.__esModule) return e;
@@ -2008,12 +2009,9 @@ function isFileBased(_x2) {
2008
2009
  }
2009
2010
 
2010
2011
  /**
2011
- * The one line the platform needs from a file-based project.
2012
- *
2013
- * `src/app.tsx` is the entry the builder looks for, and for a routes-as-data
2014
- * project the user writes it. A file-based project has no such file -- its
2015
- * entry *is* the generated tree -- so this bridges the two contracts. A real
2016
- * integration would emit it rather than ask for it, which is what this is.
2012
+ * The one line the platform needs from a file-based project. Declared beside
2013
+ * the other contract paths, so the browser's route generator adds exactly the
2014
+ * same one; re-exported here because this is where it has always been read.
2017
2015
  */
2018
2016
  function _isFileBased() {
2019
2017
  _isFileBased = slicedToArray._asyncToGenerator(/*#__PURE__*/slicedToArray._regenerator().m(function _callee2(dir) {
@@ -2030,7 +2028,6 @@ function _isFileBased() {
2030
2028
  }));
2031
2029
  return _isFileBased.apply(this, arguments);
2032
2030
  }
2033
- var ENTRY_SHIM = "export { routeTree } from './routeTree.gen'\n";
2034
2031
 
2035
2032
  /**
2036
2033
  * Generates `routeTree.gen.ts` and returns the file map with it (and the entry
@@ -2176,7 +2173,7 @@ function _generateRouteTree() {
2176
2173
  return _context3.a(2, slicedToArray._objectSpread2(slicedToArray._objectSpread2({}, files), {}, {
2177
2174
  "src/routeTree.gen.ts": tree,
2178
2175
  // Only when the project has not written its own.
2179
- "src/app.tsx": (_files$srcAppTsx = files["src/app.tsx"]) !== null && _files$srcAppTsx !== void 0 ? _files$srcAppTsx : ENTRY_SHIM
2176
+ "src/app.tsx": (_files$srcAppTsx = files["src/app.tsx"]) !== null && _files$srcAppTsx !== void 0 ? _files$srcAppTsx : projectPaths.ENTRY_SHIM
2180
2177
  }));
2181
2178
  }
2182
2179
  }, _callee3, null, [[5,, 8, 13]]);
@@ -1,4 +1,4 @@
1
- import { a as _asyncToGenerator, b as _regenerator, c as _toConsumableArray, e as _objectSpread2, _ as _createForOfIteratorHelper, d as _slicedToArray } from '../../dist/slicedToArray-44c37acc.esm.js';
1
+ import { a as _asyncToGenerator, b as _regenerator, c as _toConsumableArray, e as _objectSpread2, _ as _createForOfIteratorHelper, d as _slicedToArray } from '../../dist/slicedToArray-d71360f4.esm.js';
2
2
  import { build } from 'rolldown';
3
3
  import { createHash } from 'node:crypto';
4
4
  import { createRequire } from 'node:module';
@@ -6,6 +6,7 @@ import { readFile, rm, writeFile, mkdir, readdir, stat } from 'node:fs/promises'
6
6
  import { join, resolve, dirname } from 'node:path';
7
7
  import { parseAstAsync } from 'rolldown/parseAst';
8
8
  import { pathToFileURL } from 'node:url';
9
+ import { a as ENTRY_SHIM } from '../../dist/projectPaths-5e4defea.esm.js';
9
10
 
10
11
  function _regeneratorValues(e) {
11
12
  if (null != e) {
@@ -1986,12 +1987,9 @@ function isFileBased(_x2) {
1986
1987
  }
1987
1988
 
1988
1989
  /**
1989
- * The one line the platform needs from a file-based project.
1990
- *
1991
- * `src/app.tsx` is the entry the builder looks for, and for a routes-as-data
1992
- * project the user writes it. A file-based project has no such file -- its
1993
- * entry *is* the generated tree -- so this bridges the two contracts. A real
1994
- * integration would emit it rather than ask for it, which is what this is.
1990
+ * The one line the platform needs from a file-based project. Declared beside
1991
+ * the other contract paths, so the browser's route generator adds exactly the
1992
+ * same one; re-exported here because this is where it has always been read.
1995
1993
  */
1996
1994
  function _isFileBased() {
1997
1995
  _isFileBased = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(dir) {
@@ -2008,7 +2006,6 @@ function _isFileBased() {
2008
2006
  }));
2009
2007
  return _isFileBased.apply(this, arguments);
2010
2008
  }
2011
- var ENTRY_SHIM = "export { routeTree } from './routeTree.gen'\n";
2012
2009
 
2013
2010
  /**
2014
2011
  * Generates `routeTree.gen.ts` and returns the file map with it (and the entry
package/package.json CHANGED
@@ -7,7 +7,7 @@
7
7
  "url": "git+https://github.com/valbuild/val.git"
8
8
  },
9
9
  "license": "MIT",
10
- "version": "0.135.0",
10
+ "version": "0.136.3",
11
11
  "sideEffects": false,
12
12
  "main": "dist/valbuild-tanstack-build.cjs.js",
13
13
  "module": "dist/valbuild-tanstack-build.esm.js",
@@ -21,12 +21,17 @@
21
21
  "module": "./node/dist/valbuild-tanstack-build-node.esm.js",
22
22
  "default": "./node/dist/valbuild-tanstack-build-node.cjs.js"
23
23
  },
24
+ "./constants": {
25
+ "module": "./constants/dist/valbuild-tanstack-build-constants.esm.js",
26
+ "default": "./constants/dist/valbuild-tanstack-build-constants.cjs.js"
27
+ },
24
28
  "./package.json": "./package.json"
25
29
  },
26
30
  "preconstruct": {
27
31
  "entrypoints": [
28
32
  "./index.ts",
29
- "./node/index.ts"
33
+ "./node/index.ts",
34
+ "./constants/index.ts"
30
35
  ],
31
36
  "exports": true
32
37
  },
@@ -78,7 +83,9 @@
78
83
  "CHANGELOG.md",
79
84
  "dist",
80
85
  "node/dist",
81
- "node/package.json"
86
+ "node/package.json",
87
+ "constants/dist",
88
+ "constants/package.json"
82
89
  ],
83
90
  "scripts": {
84
91
  "build:tailwind": "tsx scripts/tailwindSources.ts",