@valbuild/tanstack-build 0.0.0 → 0.0.1-alpha.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.
package/README.md CHANGED
@@ -1,6 +1,83 @@
1
1
  # @valbuild/tanstack-build
2
2
 
3
3
  Builds a TanStack Start app from a Val project's files — in the browser for the
4
- Studio, and in Node for `val publish`.
4
+ Studio, and in Node for a publisher with a checkout.
5
5
 
6
- Placeholder release. Not usable yet.
6
+ ```ts
7
+ import {
8
+ buildUserApp,
9
+ fetchBuildTarget,
10
+ wireUp,
11
+ } from "@valbuild/tanstack-build";
12
+ ```
13
+
14
+ ## What is in here
15
+
16
+ Three things that used to be three packages in `valbuild/home`, and are one
17
+ package because they are one decision — what a published build IS.
18
+
19
+ - **The build.** `buildUserApp(input)` takes a project's files and a
20
+ `BuildTarget` and produces the server, client and (optionally) RSC bundles,
21
+ the CSS, the assets and the chunk map. It runs on `@rolldown/browser`, so it
22
+ runs in a tab.
23
+ - **The wiring.** `wireUp(files, options)` turns an imported checkout into
24
+ something a host with no filesystem can serve: it writes the project's
25
+ `src/val/val.server.ts` against `@valbuild/tanstack/server`. That file is the
26
+ reason this package lives in this repository — see below.
27
+ - **The contract.** `BuildTarget`, `UserApp`, `PublishManifest`: the types the
28
+ platform and the build agree on. Types only, so a user's app never needs a
29
+ runtime import from the platform.
30
+
31
+ ## The two entrypoints
32
+
33
+ | Entrypoint | Runs where | Holds |
34
+ | ------------------------------- | ---------------------------- | ---------------------------------------------------------------- |
35
+ | `@valbuild/tanstack-build` | anywhere — tab, Worker, Node | the build, the wiring, the contract, the git tree hash |
36
+ | `@valbuild/tanstack-build/node` | Node only | the dependency layer, the route tree, `@plugin`, route splitting |
37
+
38
+ The split is not organisational. `@valbuild/ui` imports the root so the Studio
39
+ can build a project in the tab, and the `/node` half reaches `node:` builtins,
40
+ `rolldown` and `@tanstack/router-generator` — a browser bundle that pulls any of
41
+ them fails in the consuming app's build, with a message about a polyfill, a long
42
+ way from here. `src/noNodeFromBrowser.test.ts` walks the root's import graph and
43
+ fails if anything under `src/node/` becomes reachable from it.
44
+
45
+ The `/node` half's heavy dependencies are **optional peers**. A project that only
46
+ builds in the browser installs neither; a publisher that builds a dependency
47
+ layer already has `rolldown`, and one that wants `autoCodeSplitting` already has
48
+ `@tanstack/router-plugin`, because both are things the project asks for.
49
+
50
+ ## Why it lives in this repository
51
+
52
+ `wireUp` writes code against `initValServer`'s signature. It used to do that
53
+ from another repository on another release train, so a change to that signature
54
+ could not break it until somebody published — which is to say the break was
55
+ found by a user. It is now beside the function it calls.
56
+
57
+ The build could move because it had already stopped importing the platform's
58
+ vendor package: it takes a `BuildTarget` as a parameter instead, so the facts
59
+ about which specifiers are externalised and where their chunks live **arrive**
60
+ rather than being compiled in. The same change is what lets the Studio carry a
61
+ builder at all.
62
+
63
+ ## The platform is a parameter, never an import
64
+
65
+ Two calls take facts about the host rather than reaching for them:
66
+
67
+ - `buildUserApp({ target, … })` takes a `BuildTarget`, fetched with
68
+ `fetchBuildTarget({ loader, project, token })`.
69
+ - `buildVendorLayer(dir, deps, css, platform)` takes a `VendorPlatform`: the
70
+ same `BuildTarget.base`, plus the two things that cannot cross a wire — where
71
+ the platform's own copy of a package is, and where its built base-layer chunks
72
+ are. A host with neither passes `() => null` and `null`, and says so by doing
73
+ it.
74
+
75
+ ## Regenerating the Tailwind sources
76
+
77
+ `src/tailwindSources.gen.ts` is Tailwind's own stylesheets, inlined, because the
78
+ build has no filesystem in either place it runs. Regenerate it when
79
+ `tailwindcss` is bumped and at no other time:
80
+
81
+ ```bash
82
+ pnpm --filter @valbuild/tanstack-build build:tailwind
83
+ ```
@@ -0,0 +1,2 @@
1
+ export * from "../src/index.js";
2
+ //# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidmFsYnVpbGQtdGFuc3RhY2stYnVpbGQuY2pzLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zcmMvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEifQ==
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ // this file might look strange and you might be wondering what it's for
3
+ // it's lets you import your source files by importing this entrypoint
4
+ // as you would import it if it was built with preconstruct build
5
+ // this file is slightly different to some others though
6
+ // it has a require hook which compiles your code with Babel
7
+ // this means that you don't have to set up @babel/register or anything like that
8
+ // but you can still require this module and it'll be compiled
9
+
10
+ // this bit of code imports the require hook and registers it
11
+ let unregister = require("../../../node_modules/.pnpm/@preconstruct+hook@0.4.0/node_modules/@preconstruct/hook").___internalHook(typeof __dirname === 'undefined' ? undefined : __dirname, "../../..", "..");
12
+
13
+ // this re-exports the source file
14
+ module.exports = require("../src/index.ts");
15
+
16
+ unregister();
@@ -0,0 +1,2 @@
1
+ export * from "../../src/node/index.js";
2
+ //# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidmFsYnVpbGQtdGFuc3RhY2stYnVpbGQtbm9kZS5janMuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9ub2RlL2luZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBIn0=
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ // this file might look strange and you might be wondering what it's for
3
+ // it's lets you import your source files by importing this entrypoint
4
+ // as you would import it if it was built with preconstruct build
5
+ // this file is slightly different to some others though
6
+ // it has a require hook which compiles your code with Babel
7
+ // this means that you don't have to set up @babel/register or anything like that
8
+ // but you can still require this module and it'll be compiled
9
+
10
+ // this bit of code imports the require hook and registers it
11
+ let unregister = require("../../../../node_modules/.pnpm/@preconstruct+hook@0.4.0/node_modules/@preconstruct/hook").___internalHook(typeof __dirname === 'undefined' ? undefined : __dirname, "../../../..", "../..");
12
+
13
+ // this re-exports the source file
14
+ module.exports = require("../../src/node/index.ts");
15
+
16
+ unregister();
@@ -0,0 +1,4 @@
1
+ {
2
+ "main": "dist/valbuild-tanstack-build-node.cjs.js",
3
+ "module": "dist/valbuild-tanstack-build-node.esm.js"
4
+ }
package/package.json CHANGED
@@ -1,6 +1,5 @@
1
1
  {
2
2
  "name": "@valbuild/tanstack-build",
3
- "version": "0.0.0",
4
3
  "private": false,
5
4
  "description": "Val - builds a TanStack Start app in the browser or in Node",
6
5
  "repository": {
@@ -8,24 +7,82 @@
8
7
  "url": "git+https://github.com/valbuild/val.git"
9
8
  },
10
9
  "license": "MIT",
10
+ "version": "0.0.1-alpha.0",
11
11
  "sideEffects": false,
12
12
  "main": "dist/valbuild-tanstack-build.cjs.js",
13
13
  "module": "dist/valbuild-tanstack-build.esm.js",
14
14
  "types": "dist/valbuild-tanstack-build.cjs.d.ts",
15
+ "exports": {
16
+ ".": {
17
+ "module": "./dist/valbuild-tanstack-build.esm.js",
18
+ "default": "./dist/valbuild-tanstack-build.cjs.js"
19
+ },
20
+ "./node": {
21
+ "module": "./node/dist/valbuild-tanstack-build-node.esm.js",
22
+ "default": "./node/dist/valbuild-tanstack-build-node.cjs.js"
23
+ },
24
+ "./package.json": "./package.json"
25
+ },
15
26
  "preconstruct": {
16
27
  "entrypoints": [
17
- "./index.ts"
28
+ "./index.ts",
29
+ "./node/index.ts"
18
30
  ],
19
31
  "exports": true
20
32
  },
21
- "files": [
22
- "CHANGELOG.md",
23
- "dist"
24
- ],
33
+ "dependencies": {
34
+ "@rolldown/browser": "^1.2.5",
35
+ "tailwindcss": "^4.3.3"
36
+ },
37
+ "peerDependencies": {
38
+ "@tanstack/router-generator": ">=1.167.0",
39
+ "@tanstack/router-plugin": ">=1.168.0",
40
+ "react": ">=19.0.0",
41
+ "rolldown": ">=1.2.5"
42
+ },
43
+ "peerDependenciesMeta": {
44
+ "@tanstack/router-generator": {
45
+ "optional": true
46
+ },
47
+ "@tanstack/router-plugin": {
48
+ "optional": true
49
+ },
50
+ "react": {
51
+ "optional": true
52
+ },
53
+ "rolldown": {
54
+ "optional": true
55
+ }
56
+ },
25
57
  "devDependencies": {
58
+ "@tanstack/router-generator": "1.167.32",
59
+ "@tanstack/router-plugin": "1.168.34",
60
+ "@types/jest": "^30.0.0",
61
+ "@types/node": "^26.4.0",
62
+ "@types/react": "^19.2.18",
63
+ "rolldown": "^1.2.5",
64
+ "tsx": "^4.23.12",
26
65
  "typescript": "^6.0.3"
27
66
  },
67
+ "engines": {
68
+ "node": "^20.19.0 || >=22"
69
+ },
70
+ "keywords": [
71
+ "CMS",
72
+ "tanstack",
73
+ "tanstack-start",
74
+ "val",
75
+ "valbuild"
76
+ ],
77
+ "files": [
78
+ "CHANGELOG.md",
79
+ "dist",
80
+ "node/dist",
81
+ "node/package.json"
82
+ ],
28
83
  "scripts": {
29
- "typecheck": "tsc --noEmit"
84
+ "typecheck": "tsc --noEmit",
85
+ "test": "jest",
86
+ "build:tailwind": "tsx scripts/tailwindSources.ts"
30
87
  }
31
88
  }