@valbuild/tanstack-build 0.135.0 → 0.136.1

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 +17 -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
package/CHANGELOG.md CHANGED
@@ -1,5 +1,22 @@
1
1
  # @valbuild/tanstack-build
2
2
 
3
+ ## 0.136.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [#716](https://github.com/valbuild/val/pull/716) [`4450be5`](https://github.com/valbuild/val/commit/4450be570ec3a66d7d98ba273c333ca2d2f163d9) Thanks [@freekh](https://github.com/freekh)! - `rebakeGit` rewires a project record to a different commit, and the Studio's publish proxy can now reach `/project-source`.
8
+
9
+ Both are groundwork for a publish that happens in the browser. `rebakeGit` replaces the one line in the generated `val.server.ts` that carries the commit, rather than regenerating the file: a publisher running inside the deployment does not know the project id or the platform's address, and reconstructing the file from what it could guess would throw away wiring it cannot see.
10
+
11
+ - [#716](https://github.com/valbuild/val/pull/716) [`d2f385a`](https://github.com/valbuild/val/commit/d2f385a04978992a5036379235e447ba7775faef) Thanks [@freekh](https://github.com/freekh)! - The Studio works again when served from the published package, and a managed project's publish now puts the saved edit on the site.
12
+
13
+ - **The Studio did not start in 0.136.0.** Its main bundle imports sibling chunks by relative path, and the Studio is served at `/api/val/static/<version>/app`, so those imports resolved to paths the handler did not know and came back as the HTML fallback — which a browser refuses as a module script. Preview was gone with it. The handler now serves those chunks, and the package build follows every import the bundle makes before it lets a release through.
14
+ - **The in-browser builder could not load.** The Studio's bundle carried rolldown's Node WASI binding, which throws `process is not defined` in a tab. It now uses the browser binding, and the build refuses a bundle that contains the Node one.
15
+ - **A managed publish builds what was just saved.** `/save` returns the source files the commit wrote, the Studio builds with them laid over the project's stored source, and publishes that source back with the build — so the next edit starts from this one rather than undoing it. The save's commit is also passed through to the build, which previously ran as though no commit had been made.
16
+ - **The bundler's WebAssembly is served from `content.val.build/v1/static`** (`DEFAULT_STATIC_HOST`), still addressed by its SHA-256. `globalThis.__VAL_ROLLDOWN_WASM_URL__` still overrides it.
17
+ - The `val.server.ts` that `@valbuild/tanstack-build` generates no longer hands a save's files to the platform (`platform.internal/__api/source`). A managed project's Studio builds in its own tab, and the platform has closed that door. `isWired` recognises files wired either way.
18
+ - `@valbuild/tanstack-build/constants` exports the contract paths and the artifact key namespace from an entrypoint that imports nothing else, for callers that must not load the bundler. The namespace gains a `source` key.
19
+
3
20
  ## 0.135.0
4
21
 
5
22
  ### Minor Changes
@@ -0,0 +1,2 @@
1
+ export * from "../../dist/declarations/src/constants/index.js";
2
+ //# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidmFsYnVpbGQtdGFuc3RhY2stYnVpbGQtY29uc3RhbnRzLmNqcy5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vZGlzdC9kZWNsYXJhdGlvbnMvc3JjL2NvbnN0YW50cy9pbmRleC5kLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBIn0=
@@ -0,0 +1,15 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var projectPaths = require('../../dist/projectPaths-f222255a.cjs.dev.js');
6
+ var artifactKeys = require('../../dist/artifactKeys-ad3e41fc.cjs.dev.js');
7
+
8
+
9
+
10
+ exports.ENTRY = projectPaths.ENTRY;
11
+ exports.ENTRY_SHIM = projectPaths.ENTRY_SHIM;
12
+ exports.ROUTES_DIR = projectPaths.ROUTES_DIR;
13
+ exports.TREE = projectPaths.TREE;
14
+ exports.ARTIFACT_KEYS = artifactKeys.ARTIFACT_KEYS;
15
+ exports.ARTIFACT_PREFIXES = artifactKeys.ARTIFACT_PREFIXES;
@@ -0,0 +1,7 @@
1
+ 'use strict';
2
+
3
+ if (process.env.NODE_ENV === "production") {
4
+ module.exports = require("./valbuild-tanstack-build-constants.cjs.prod.js");
5
+ } else {
6
+ module.exports = require("./valbuild-tanstack-build-constants.cjs.dev.js");
7
+ }
@@ -0,0 +1,15 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var projectPaths = require('../../dist/projectPaths-9cbecebf.cjs.prod.js');
6
+ var artifactKeys = require('../../dist/artifactKeys-700b9044.cjs.prod.js');
7
+
8
+
9
+
10
+ exports.ENTRY = projectPaths.ENTRY;
11
+ exports.ENTRY_SHIM = projectPaths.ENTRY_SHIM;
12
+ exports.ROUTES_DIR = projectPaths.ROUTES_DIR;
13
+ exports.TREE = projectPaths.TREE;
14
+ exports.ARTIFACT_KEYS = artifactKeys.ARTIFACT_KEYS;
15
+ exports.ARTIFACT_PREFIXES = artifactKeys.ARTIFACT_PREFIXES;
@@ -0,0 +1,2 @@
1
+ export { E as ENTRY, a as ENTRY_SHIM, R as ROUTES_DIR, T as TREE } from '../../dist/projectPaths-5e4defea.esm.js';
2
+ export { A as ARTIFACT_KEYS, a as ARTIFACT_PREFIXES } from '../../dist/artifactKeys-3a40f3a0.esm.js';
@@ -0,0 +1,4 @@
1
+ {
2
+ "main": "dist/valbuild-tanstack-build-constants.cjs.js",
3
+ "module": "dist/valbuild-tanstack-build-constants.esm.js"
4
+ }
@@ -0,0 +1,50 @@
1
+ /**
2
+ * The publish API's artifact key namespace: `server`, `chunk/client/<name>`,
3
+ * `public/<path>` and the rest. See `artifacts.ts` for why it is declared once
4
+ * and here.
5
+ *
6
+ * A module of its own, importing nothing, so it can be reached through
7
+ * `@valbuild/tanstack-build/constants` by a caller that must not load the
8
+ * builder -- content's `loaderPayload.ts` takes artifacts apart by these
9
+ * prefixes in a Node server that has no use for rolldown.
10
+ */
11
+
12
+ /** The single-file keys, in the order a reader most wants to see them. */
13
+ var ARTIFACT_KEYS = {
14
+ server: "server",
15
+ client: "client",
16
+ css: "css",
17
+ rsc: "rsc",
18
+ /**
19
+ * The dependency layer: gzipped JSON, and NOT produced by a browser build.
20
+ *
21
+ * Named here because it is part of the namespace a reader is trying to
22
+ * understand, not because {@link publishArtifacts} ever emits it -- building
23
+ * a layer is a rolldown pass over `node_modules`, which a tab does not have.
24
+ * A publisher without one sends `layerRev` instead; see `DeclareBody`.
25
+ */
26
+ layer: "layer",
27
+ /**
28
+ * The project's own files, as JSON, exactly as this build was made from
29
+ * them -- what the loader stores as the project's source.
30
+ *
31
+ * It has to travel WITH the build: it is what the next publisher starts
32
+ * from, and a managed project's Studio edits one `.val.ts` and rebuilds, so
33
+ * a build published without it leaves the stored source one edit behind --
34
+ * and the edit after that is built on top of the stale copy and silently
35
+ * undoes this one. The generated route tree is never in it; see
36
+ * `projectSource` on `BuildInput`.
37
+ */
38
+ source: "source"
39
+ };
40
+
41
+ /** The prefixes, and which {@link BuildOutput} record fills each. */
42
+ var ARTIFACT_PREFIXES = {
43
+ serverChunks: "chunk/server/",
44
+ clientChunks: "chunk/client/",
45
+ rscChunks: "chunk/rsc/",
46
+ assetFiles: "asset/",
47
+ publicFiles: "public/"
48
+ };
49
+
50
+ export { ARTIFACT_KEYS as A, ARTIFACT_PREFIXES as a };
@@ -0,0 +1,53 @@
1
+ 'use strict';
2
+
3
+ /**
4
+ * The publish API's artifact key namespace: `server`, `chunk/client/<name>`,
5
+ * `public/<path>` and the rest. See `artifacts.ts` for why it is declared once
6
+ * and here.
7
+ *
8
+ * A module of its own, importing nothing, so it can be reached through
9
+ * `@valbuild/tanstack-build/constants` by a caller that must not load the
10
+ * builder -- content's `loaderPayload.ts` takes artifacts apart by these
11
+ * prefixes in a Node server that has no use for rolldown.
12
+ */
13
+
14
+ /** The single-file keys, in the order a reader most wants to see them. */
15
+ var ARTIFACT_KEYS = {
16
+ server: "server",
17
+ client: "client",
18
+ css: "css",
19
+ rsc: "rsc",
20
+ /**
21
+ * The dependency layer: gzipped JSON, and NOT produced by a browser build.
22
+ *
23
+ * Named here because it is part of the namespace a reader is trying to
24
+ * understand, not because {@link publishArtifacts} ever emits it -- building
25
+ * a layer is a rolldown pass over `node_modules`, which a tab does not have.
26
+ * A publisher without one sends `layerRev` instead; see `DeclareBody`.
27
+ */
28
+ layer: "layer",
29
+ /**
30
+ * The project's own files, as JSON, exactly as this build was made from
31
+ * them -- what the loader stores as the project's source.
32
+ *
33
+ * It has to travel WITH the build: it is what the next publisher starts
34
+ * from, and a managed project's Studio edits one `.val.ts` and rebuilds, so
35
+ * a build published without it leaves the stored source one edit behind --
36
+ * and the edit after that is built on top of the stale copy and silently
37
+ * undoes this one. The generated route tree is never in it; see
38
+ * `projectSource` on `BuildInput`.
39
+ */
40
+ source: "source"
41
+ };
42
+
43
+ /** The prefixes, and which {@link BuildOutput} record fills each. */
44
+ var ARTIFACT_PREFIXES = {
45
+ serverChunks: "chunk/server/",
46
+ clientChunks: "chunk/client/",
47
+ rscChunks: "chunk/rsc/",
48
+ assetFiles: "asset/",
49
+ publicFiles: "public/"
50
+ };
51
+
52
+ exports.ARTIFACT_KEYS = ARTIFACT_KEYS;
53
+ exports.ARTIFACT_PREFIXES = ARTIFACT_PREFIXES;
@@ -0,0 +1,53 @@
1
+ 'use strict';
2
+
3
+ /**
4
+ * The publish API's artifact key namespace: `server`, `chunk/client/<name>`,
5
+ * `public/<path>` and the rest. See `artifacts.ts` for why it is declared once
6
+ * and here.
7
+ *
8
+ * A module of its own, importing nothing, so it can be reached through
9
+ * `@valbuild/tanstack-build/constants` by a caller that must not load the
10
+ * builder -- content's `loaderPayload.ts` takes artifacts apart by these
11
+ * prefixes in a Node server that has no use for rolldown.
12
+ */
13
+
14
+ /** The single-file keys, in the order a reader most wants to see them. */
15
+ var ARTIFACT_KEYS = {
16
+ server: "server",
17
+ client: "client",
18
+ css: "css",
19
+ rsc: "rsc",
20
+ /**
21
+ * The dependency layer: gzipped JSON, and NOT produced by a browser build.
22
+ *
23
+ * Named here because it is part of the namespace a reader is trying to
24
+ * understand, not because {@link publishArtifacts} ever emits it -- building
25
+ * a layer is a rolldown pass over `node_modules`, which a tab does not have.
26
+ * A publisher without one sends `layerRev` instead; see `DeclareBody`.
27
+ */
28
+ layer: "layer",
29
+ /**
30
+ * The project's own files, as JSON, exactly as this build was made from
31
+ * them -- what the loader stores as the project's source.
32
+ *
33
+ * It has to travel WITH the build: it is what the next publisher starts
34
+ * from, and a managed project's Studio edits one `.val.ts` and rebuilds, so
35
+ * a build published without it leaves the stored source one edit behind --
36
+ * and the edit after that is built on top of the stale copy and silently
37
+ * undoes this one. The generated route tree is never in it; see
38
+ * `projectSource` on `BuildInput`.
39
+ */
40
+ source: "source"
41
+ };
42
+
43
+ /** The prefixes, and which {@link BuildOutput} record fills each. */
44
+ var ARTIFACT_PREFIXES = {
45
+ serverChunks: "chunk/server/",
46
+ clientChunks: "chunk/client/",
47
+ rscChunks: "chunk/rsc/",
48
+ assetFiles: "asset/",
49
+ publicFiles: "public/"
50
+ };
51
+
52
+ exports.ARTIFACT_KEYS = ARTIFACT_KEYS;
53
+ exports.ARTIFACT_PREFIXES = ARTIFACT_PREFIXES;
@@ -0,0 +1,46 @@
1
+ /**
2
+ * The publish API's artifact key namespace: `server`, `chunk/client/<name>`,
3
+ * `public/<path>` and the rest. See `artifacts.ts` for why it is declared once
4
+ * and here.
5
+ *
6
+ * A module of its own, importing nothing, so it can be reached through
7
+ * `@valbuild/tanstack-build/constants` by a caller that must not load the
8
+ * builder -- content's `loaderPayload.ts` takes artifacts apart by these
9
+ * prefixes in a Node server that has no use for rolldown.
10
+ */
11
+ /** The single-file keys, in the order a reader most wants to see them. */
12
+ export declare const ARTIFACT_KEYS: {
13
+ readonly server: "server";
14
+ readonly client: "client";
15
+ readonly css: "css";
16
+ readonly rsc: "rsc";
17
+ /**
18
+ * The dependency layer: gzipped JSON, and NOT produced by a browser build.
19
+ *
20
+ * Named here because it is part of the namespace a reader is trying to
21
+ * understand, not because {@link publishArtifacts} ever emits it -- building
22
+ * a layer is a rolldown pass over `node_modules`, which a tab does not have.
23
+ * A publisher without one sends `layerRev` instead; see `DeclareBody`.
24
+ */
25
+ readonly layer: "layer";
26
+ /**
27
+ * The project's own files, as JSON, exactly as this build was made from
28
+ * them -- what the loader stores as the project's source.
29
+ *
30
+ * It has to travel WITH the build: it is what the next publisher starts
31
+ * from, and a managed project's Studio edits one `.val.ts` and rebuilds, so
32
+ * a build published without it leaves the stored source one edit behind --
33
+ * and the edit after that is built on top of the stale copy and silently
34
+ * undoes this one. The generated route tree is never in it; see
35
+ * `projectSource` on `BuildInput`.
36
+ */
37
+ readonly source: "source";
38
+ };
39
+ /** The prefixes, and which {@link BuildOutput} record fills each. */
40
+ export declare const ARTIFACT_PREFIXES: {
41
+ readonly serverChunks: "chunk/server/";
42
+ readonly clientChunks: "chunk/client/";
43
+ readonly rscChunks: "chunk/rsc/";
44
+ readonly assetFiles: "asset/";
45
+ readonly publicFiles: "public/";
46
+ };
@@ -0,0 +1,72 @@
1
+ /**
2
+ * A build, as the flat set of artifacts a publisher declares.
3
+ *
4
+ * ## Why this is here and not in three places
5
+ *
6
+ * The publish API addresses every artifact by a STRING KEY -- `server`,
7
+ * `chunk/client/<name>`, `public/<path>` -- because a key that is just a string
8
+ * is what lets one mechanism declare, upload and confirm all of them by hash.
9
+ * That namespace was restated three times: content's `loaderPayload.ts` matched
10
+ * the prefixes to take them apart, `val publish` reproduced them as a directory
11
+ * layout to read, and whatever built the project had to lay that directory out.
12
+ * Three copies of a mapping whose failure mode is silent -- a chunk filed under
13
+ * the wrong target does not fail at publish, it fails at isolate startup with a
14
+ * missing export naming neither package nor version.
15
+ *
16
+ * So the namespace is declared once, HERE, beside the {@link BuildOutput} it
17
+ * describes. Val owns it because Val produces it.
18
+ *
19
+ * ## What is deliberately NOT here
20
+ *
21
+ * The loader's payload shape -- `serverCode`, `clientChunks`, `publicFiles` --
22
+ * stays content's own, and `loaderPayload.ts` says why: it is a platform
23
+ * internal, and a publisher that had to learn it would be coupled to the
24
+ * platform, which is exactly what a project token publishing from somebody's CI
25
+ * must not be. The KEYS are the public contract; the payload assembled from
26
+ * them is not. This exports the first and says nothing about the second.
27
+ *
28
+ * ## Everything is text
29
+ *
30
+ * Including assets and public files, which {@link BuildOutput} carries base64
31
+ * encoded. That is the existing wire contract rather than a choice made here:
32
+ * the loader stores what it is given and `decodeBase64`s it on the way out, so
33
+ * the artifact's bytes ARE the base64 text. Sending the raw bytes instead would
34
+ * be smaller and would corrupt every image in the isolate.
35
+ */
36
+ import type { BuildOutput } from "./build.js";
37
+ import { ARTIFACT_KEYS, ARTIFACT_PREFIXES } from "./artifactKeys.js";
38
+ export { ARTIFACT_KEYS, ARTIFACT_PREFIXES };
39
+ /** One artifact, ready to declare and to upload. */
40
+ export type PublishArtifact = {
41
+ key: string;
42
+ /** The exact bytes, as text. See the note on encoding above. */
43
+ body: string;
44
+ sha256: string;
45
+ /**
46
+ * The byte length, which is NOT `body.length`.
47
+ *
48
+ * Content compares this against what object storage received. A string's
49
+ * length counts UTF-16 code units, so any non-ASCII character -- one accented
50
+ * word in a page's markup is enough -- makes it disagree with the number of
51
+ * bytes actually sent, and the publish is refused for a size mismatch that
52
+ * names no file.
53
+ */
54
+ bytes: number;
55
+ };
56
+ /**
57
+ * Every artifact a build publishes, by key.
58
+ *
59
+ * Async because the hashes are, and the hashes are because `crypto.subtle` is
60
+ * the one digest available both in a tab and in Node -- see `hash.ts`.
61
+ *
62
+ * An empty stylesheet is omitted rather than uploaded as an empty artifact: a
63
+ * project with no CSS has no `css` key, which is what `loaderPayload.ts` reads
64
+ * `text("css") !== undefined` to decide.
65
+ */
66
+ export declare function publishArtifacts(build: BuildOutput, options?: {
67
+ /**
68
+ * The project's own files, published as the `source` artifact. See
69
+ * `ARTIFACT_KEYS.source`. Omitted, the stored source is left as it was.
70
+ */
71
+ projectSource?: Record<string, string>;
72
+ }): Promise<PublishArtifact[]>;
@@ -0,0 +1,19 @@
1
+ /**
2
+ * The contract's constants, and nothing else: `@valbuild/tanstack-build/constants`.
3
+ *
4
+ * The same values the root exports, from an entrypoint that imports nothing
5
+ * else. It exists for callers that must not take the builder with them, because
6
+ * the root pulls in `@rolldown/browser`, whose loader fetches 10.9 MB of wasm at
7
+ * module evaluation:
8
+ *
9
+ * - the platform's browser route generator, which bundles its own code -- from
10
+ * the root it went from 4.1 MB to 5.4 MB, and would have fetched the bundler
11
+ * to write a route tree;
12
+ * - content's `loaderPayload.ts`, a Node server that takes a publish's
13
+ * artifacts apart by these keys.
14
+ *
15
+ * An entrypoint rather than literals in those places because these ARE the
16
+ * contract with the builder, and a copy is what drifts.
17
+ */
18
+ export { ENTRY, ENTRY_SHIM, ROUTES_DIR, TREE } from "../projectPaths.js";
19
+ export { ARTIFACT_KEYS, ARTIFACT_PREFIXES } from "../artifactKeys.js";
@@ -29,5 +29,6 @@ export { aliasMap, type AliasMap } from "./tsconfigPaths.js";
29
29
  export { resolveInFiles } from "./paths.js";
30
30
  export { scanCandidates, usesTailwind } from "./tailwind.js";
31
31
  export * from "./contract.js";
32
+ export * from "./artifacts.js";
32
33
  export * from "./gitTree.js";
33
34
  export * from "./wire.js";
@@ -1,14 +1,12 @@
1
1
  /** A project is file-based if it has a routes directory. */
2
2
  export declare function isFileBased(dir: string): Promise<boolean>;
3
3
  /**
4
- * The one line the platform needs from a file-based project.
5
- *
6
- * `src/app.tsx` is the entry the builder looks for, and for a routes-as-data
7
- * project the user writes it. A file-based project has no such file -- its
8
- * entry *is* the generated tree -- so this bridges the two contracts. A real
9
- * integration would emit it rather than ask for it, which is what this is.
4
+ * The one line the platform needs from a file-based project. Declared beside
5
+ * the other contract paths, so the browser's route generator adds exactly the
6
+ * same one; re-exported here because this is where it has always been read.
10
7
  */
11
- export declare const ENTRY_SHIM = "export { routeTree } from './routeTree.gen'\n";
8
+ import { ENTRY_SHIM } from "../projectPaths.js";
9
+ export { ENTRY_SHIM };
12
10
  /**
13
11
  * Generates `routeTree.gen.ts` and returns the file map with it (and the entry
14
12
  * shim) added.
@@ -12,3 +12,13 @@ export declare const ENTRY = "src/app.tsx";
12
12
  export declare const TREE = "src/routeTree.gen.ts";
13
13
  /** Where a file-based project keeps its route files. */
14
14
  export declare const ROUTES_DIR = "src/routes";
15
+ /**
16
+ * The one line the builder needs from a file-based project, as `src/app.tsx`.
17
+ *
18
+ * `src/app.tsx` is the entry the builder looks for, and a routes-as-data
19
+ * project writes it. A file-based project has no such file -- its entry IS
20
+ * the generated tree -- so every route generator adds this, and it is the
21
+ * same line wherever that runs (the `/node` entrypoint's `withRouteTree`, and
22
+ * the platform's browser generator, which reaches it through `/constants`).
23
+ */
24
+ export declare const ENTRY_SHIM = "export { routeTree } from './routeTree.gen'\n";
@@ -9,7 +9,13 @@ export interface WireResult {
9
9
  warnings: Array<string>;
10
10
  }
11
11
  export interface WireOptions {
12
- /** The project id the app puts its pending source under, as a fallback. */
12
+ /**
13
+ * The project id this record is wired for.
14
+ *
15
+ * No longer written into the generated file: it named the project a save's
16
+ * files were handed over under, and that hand-over is gone. Kept so a caller
17
+ * that identifies the project does not have to change with it.
18
+ */
13
19
  project: string;
14
20
  /**
15
21
  * The platform's control plane.
@@ -40,10 +46,11 @@ export interface WireOptions {
40
46
  * Where a Val project keeps the module this replaces.
41
47
  *
42
48
  * Exported because a caller has to be able to rewrite JUST this file. The
43
- * commit is baked into it (see `BUILT_FROM` in the template), and the files a publish
44
- * hands over are the `.val.ts` ones it patched -- this is never among them, so a tab
45
- * that merged a save and rebuilt would compile the NEW content against the OLD
46
- * commit and read the wrong version of it back.
49
+ * commit is baked into it (see `BUILT_FROM` in the template), and the files a save
50
+ * writes are the `.val.ts` ones it patched -- this is never among them, so a tab
51
+ * that laid a save over the project and rebuilt would compile the NEW content
52
+ * against the OLD commit and read the wrong version of it back. `rebakeGit` is
53
+ * what the Studio calls.
47
54
  */
48
55
  export declare const VAL_SERVER_PATH = "src/val/val.server.ts";
49
56
  /**
@@ -56,34 +63,45 @@ export declare const VAL_SERVER_PATH = "src/val/val.server.ts";
56
63
  * would be a bug that only shows up on the second publish.
57
64
  */
58
65
  export declare function wiredValServer(options: WireOptions): string;
66
+ export declare function bakedGit(files: Record<string, string>): {
67
+ commit: string;
68
+ branch: string;
69
+ } | undefined;
59
70
  /**
60
- * The commit a wired record was last built at, read back out of the file.
71
+ * The same record, wired at a different commit.
72
+ *
73
+ * The inverse of {@link bakedGit}, and the whole of what a rebuild has to
74
+ * change: `BUILT_FROM` is the only place the commit appears, and every other
75
+ * use in the generated file reads it.
76
+ *
77
+ * REWRITES one line rather than regenerating the file, and that is the point.
78
+ * `wiredValServer` needs the project id and the platform's address, which the
79
+ * publisher that has them is the tab; a Studio publishing from inside the
80
+ * deployment has neither, and reconstructing the file from what it could guess
81
+ * would throw away wiring it cannot see. Replacing the literal cannot.
61
82
  *
62
- * The inverse of `BUILT_FROM` in the template, and it lives here so that one place
63
- * knows the format -- a reader elsewhere would go stale the first time the
64
- * template's shape changed, and silently, since a failed parse and a build
65
- * with no commit look identical.
83
+ * Returns the record unchanged when there is nothing to rewrite -- no
84
+ * `val.server.ts`, or one this does not recognise. Unchanged rather than
85
+ * thrown, because the caller's next step is a build, and a build of a record
86
+ * with no wired server is a project that was never wired: a real thing, which
87
+ * fails with its own message rather than this one.
66
88
  *
67
- * There is nowhere else this could come from. A record adopted from the live
68
- * build IS the published source, and the commit it was published at is a
69
- * literal inside its own `val.server.ts`.
89
+ * Non-destructive, like {@link wireUp}: the caller's record is what gets
90
+ * published back as source.
70
91
  */
71
- export declare function bakedGit(files: Record<string, string>): {
92
+ export declare function rebakeGit(files: Record<string, string>, git: {
72
93
  commit: string;
73
94
  branch: string;
74
- } | undefined;
95
+ } | null): Record<string, string>;
75
96
  /** Is this a Val project at all? */
76
97
  export declare function isValProject(files: Record<string, string>): boolean;
77
98
  /**
78
99
  * Has this record already been wired up?
79
100
  *
80
- * The control host is the marker. It used to be `platform:project-source`,
81
- * which the generated file imported while Val was in memory mode and no longer
82
- * does -- the project's source stopped being shipped into the isolate when the
83
- * content service became what answers for it. The pending-source POST is the
84
- * thing that cannot be anything but this platform's: no repository posts to a
85
- * host that resolves
86
- * nowhere, and every wired file has to, because an isolate cannot build.
101
+ * {@link WIRED_MARKER} is the marker, or -- for a file generated before it
102
+ * existed -- the sentinel host that file posted its saves to. It used to be
103
+ * `platform:project-source` before that, which the generated file imported
104
+ * while Val was in memory mode.
87
105
  */
88
106
  export declare function isWired(files: Record<string, string>): boolean;
89
107
  /**
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Paths the platform's contract fixes, in one place.
3
+ *
4
+ * These are not conventions this package chose -- `src/app.tsx` is the module
5
+ * the builder resolves as its entry, and `src/routeTree.gen.ts` is what
6
+ * TanStack's generator is configured to write. They are here so that a change
7
+ * on either side is one edit rather than a search for string literals.
8
+ */
9
+
10
+ /** The module the builder uses as the project's entry. */
11
+ var ENTRY = "src/app.tsx";
12
+
13
+ /** Where TanStack's generator writes the route tree. */
14
+ var TREE = "src/routeTree.gen.ts";
15
+
16
+ /** Where a file-based project keeps its route files. */
17
+ var ROUTES_DIR = "src/routes";
18
+
19
+ /**
20
+ * The one line the builder needs from a file-based project, as `src/app.tsx`.
21
+ *
22
+ * `src/app.tsx` is the entry the builder looks for, and a routes-as-data
23
+ * project writes it. A file-based project has no such file -- its entry IS
24
+ * the generated tree -- so every route generator adds this, and it is the
25
+ * same line wherever that runs (the `/node` entrypoint's `withRouteTree`, and
26
+ * the platform's browser generator, which reaches it through `/constants`).
27
+ */
28
+ var ENTRY_SHIM = "export { routeTree } from './routeTree.gen'\n";
29
+
30
+ export { ENTRY as E, ROUTES_DIR as R, TREE as T, ENTRY_SHIM as a };
@@ -0,0 +1,35 @@
1
+ 'use strict';
2
+
3
+ /**
4
+ * Paths the platform's contract fixes, in one place.
5
+ *
6
+ * These are not conventions this package chose -- `src/app.tsx` is the module
7
+ * the builder resolves as its entry, and `src/routeTree.gen.ts` is what
8
+ * TanStack's generator is configured to write. They are here so that a change
9
+ * on either side is one edit rather than a search for string literals.
10
+ */
11
+
12
+ /** The module the builder uses as the project's entry. */
13
+ var ENTRY = "src/app.tsx";
14
+
15
+ /** Where TanStack's generator writes the route tree. */
16
+ var TREE = "src/routeTree.gen.ts";
17
+
18
+ /** Where a file-based project keeps its route files. */
19
+ var ROUTES_DIR = "src/routes";
20
+
21
+ /**
22
+ * The one line the builder needs from a file-based project, as `src/app.tsx`.
23
+ *
24
+ * `src/app.tsx` is the entry the builder looks for, and a routes-as-data
25
+ * project writes it. A file-based project has no such file -- its entry IS
26
+ * the generated tree -- so every route generator adds this, and it is the
27
+ * same line wherever that runs (the `/node` entrypoint's `withRouteTree`, and
28
+ * the platform's browser generator, which reaches it through `/constants`).
29
+ */
30
+ var ENTRY_SHIM = "export { routeTree } from './routeTree.gen'\n";
31
+
32
+ exports.ENTRY = ENTRY;
33
+ exports.ENTRY_SHIM = ENTRY_SHIM;
34
+ exports.ROUTES_DIR = ROUTES_DIR;
35
+ exports.TREE = TREE;
@@ -0,0 +1,35 @@
1
+ 'use strict';
2
+
3
+ /**
4
+ * Paths the platform's contract fixes, in one place.
5
+ *
6
+ * These are not conventions this package chose -- `src/app.tsx` is the module
7
+ * the builder resolves as its entry, and `src/routeTree.gen.ts` is what
8
+ * TanStack's generator is configured to write. They are here so that a change
9
+ * on either side is one edit rather than a search for string literals.
10
+ */
11
+
12
+ /** The module the builder uses as the project's entry. */
13
+ var ENTRY = "src/app.tsx";
14
+
15
+ /** Where TanStack's generator writes the route tree. */
16
+ var TREE = "src/routeTree.gen.ts";
17
+
18
+ /** Where a file-based project keeps its route files. */
19
+ var ROUTES_DIR = "src/routes";
20
+
21
+ /**
22
+ * The one line the builder needs from a file-based project, as `src/app.tsx`.
23
+ *
24
+ * `src/app.tsx` is the entry the builder looks for, and a routes-as-data
25
+ * project writes it. A file-based project has no such file -- its entry IS
26
+ * the generated tree -- so every route generator adds this, and it is the
27
+ * same line wherever that runs (the `/node` entrypoint's `withRouteTree`, and
28
+ * the platform's browser generator, which reaches it through `/constants`).
29
+ */
30
+ var ENTRY_SHIM = "export { routeTree } from './routeTree.gen'\n";
31
+
32
+ exports.ENTRY = ENTRY;
33
+ exports.ENTRY_SHIM = ENTRY_SHIM;
34
+ exports.ROUTES_DIR = ROUTES_DIR;
35
+ exports.TREE = TREE;
@@ -304,6 +304,7 @@ function _slicedToArray(r, e) {
304
304
 
305
305
  exports._asyncToGenerator = _asyncToGenerator;
306
306
  exports._createForOfIteratorHelper = _createForOfIteratorHelper;
307
+ exports._defineProperty = _defineProperty;
307
308
  exports._objectSpread2 = _objectSpread2;
308
309
  exports._regenerator = _regenerator;
309
310
  exports._slicedToArray = _slicedToArray;
@@ -304,6 +304,7 @@ function _slicedToArray(r, e) {
304
304
 
305
305
  exports._asyncToGenerator = _asyncToGenerator;
306
306
  exports._createForOfIteratorHelper = _createForOfIteratorHelper;
307
+ exports._defineProperty = _defineProperty;
307
308
  exports._objectSpread2 = _objectSpread2;
308
309
  exports._regenerator = _regenerator;
309
310
  exports._slicedToArray = _slicedToArray;
@@ -300,4 +300,4 @@ function _slicedToArray(r, e) {
300
300
  return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest();
301
301
  }
302
302
 
303
- export { _createForOfIteratorHelper as _, _asyncToGenerator as a, _regenerator as b, _toConsumableArray as c, _slicedToArray as d, _objectSpread2 as e };
303
+ export { _createForOfIteratorHelper as _, _asyncToGenerator as a, _regenerator as b, _toConsumableArray as c, _slicedToArray as d, _objectSpread2 as e, _defineProperty as f };