@tschk/moonshine-compiler 0.4.0 → 0.4.4
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 +43 -0
- package/package.json +10 -6
- package/src/build.ts +535 -75
- package/src/compile-graph.ts +215 -0
- package/src/compile-output.ts +91 -0
- package/src/crepus-source.ts +116 -0
- package/src/discover.ts +29 -2
- package/src/inherit.ts +7 -4
- package/src/manifest.ts +156 -12
- package/src/path.ts +16 -0
- package/src/source.ts +8 -0
- package/test/analyze.test.ts +0 -146
- package/test/classify.test.ts +0 -99
- package/test/client-process-env.test.ts +0 -73
- package/test/discover.test.ts +0 -76
- package/test/fixtures/modes/api.ts +0 -3
- package/test/fixtures/modes/client.client.tsx +0 -3
- package/test/fixtures/modes/interactive.tsx +0 -3
- package/test/fixtures/modes/loader.ts +0 -5
- package/test/fixtures/modes/near-miss.tsx +0 -5
- package/test/fixtures/modes/renamed-source.tsx +0 -5
- package/test/fixtures/modes/request-utils.ts +0 -3
- package/test/fixtures/modes/request.ts +0 -1
- package/test/fixtures/modes/ssr-helpers.ts +0 -5
- package/test/fixtures/modes/static.tsx +0 -3
- package/test/fixtures/modes/unresolved.ts +0 -5
- package/test/fixtures/project/src/routes/+error.tsx +0 -3
- package/test/fixtures/project/src/routes/+layout.tsx +0 -3
- package/test/fixtures/project/src/routes/+middleware.ts +0 -3
- package/test/fixtures/project/src/routes/about.data.ts +0 -7
- package/test/fixtures/project/src/routes/about.tsx +0 -7
- package/test/fixtures/project/src/routes/api/health.ts +0 -3
- package/test/fixtures/project/src/routes/client.client.tsx +0 -8
- package/test/fixtures/project/src/routes/counter.tsx +0 -3
- package/test/fixtures/project/src/routes/docs/[...path].tsx +0 -3
- package/test/fixtures/project/src/routes/index.tsx +0 -3
- package/test/fixtures/routes/+error.tsx +0 -3
- package/test/fixtures/routes/+layout.tsx +0 -3
- package/test/fixtures/routes/+middleware.ts +0 -3
- package/test/fixtures/routes/about.tsx +0 -3
- package/test/fixtures/routes/account/[[tab]].tsx +0 -3
- package/test/fixtures/routes/api/health.server.ts +0 -7
- package/test/fixtures/routes/blog/[slug].data.ts +0 -7
- package/test/fixtures/routes/blog/[slug].tsx +0 -3
- package/test/fixtures/routes/docs/[...path].tsx +0 -3
- package/test/fixtures/routes/index.tsx +0 -3
- package/test/inherit.test.ts +0 -50
- package/test/manifest.test.ts +0 -96
- package/test/path.test.ts +0 -30
- package/test/server-bundle-support-modules.test.ts +0 -68
- package/tsconfig.json +0 -4
package/README.md
CHANGED
|
@@ -23,5 +23,48 @@ Features:
|
|
|
23
23
|
- `classifyRoute` picks `static`, `ssr`, `island`, `spa`, or `api`.
|
|
24
24
|
- `buildProject` runs `Bun.build` and writes `.moonshine/manifest.json`.
|
|
25
25
|
|
|
26
|
+
Route analysis currently uses the TypeScript parser at build time. Source parsing
|
|
27
|
+
and lowering are intended to move to Crepuscularity once its module-analysis and
|
|
28
|
+
native DOM emission contracts cover these fixtures. This parser is not shipped
|
|
29
|
+
in native application artifacts; it remains a compiler dependency until then.
|
|
30
|
+
|
|
31
|
+
The optional `@tschk/moonshine-compiler/source` entry provides `emitCrepusSource`,
|
|
32
|
+
`readCrepusGraph` and `publishCrepusGraph`. It invokes an external Crepus compiler,
|
|
33
|
+
validates its module and asset inventory, and publishes unchanged compiler bytes
|
|
34
|
+
before atomically switching the public entry. This entry loads no TypeScript or
|
|
35
|
+
route-analysis code. The CLI uses the same implementation; automatic source
|
|
36
|
+
compilation inside `buildProject` remains unfinished.
|
|
37
|
+
|
|
38
|
+
Named HTTP exports dispatch the matching request method; `HEAD` falls back to
|
|
39
|
+
`GET`, and `OPTIONS` requires its own export. Unsupported methods return 405 with
|
|
40
|
+
an accurate `Allow` header. Explicit `loader`/`action` exports retain precedence;
|
|
41
|
+
a generic `handler` receives other methods unless an explicit `methods` list
|
|
42
|
+
restricts it. Separate data-file exports override the route's matching exports.
|
|
43
|
+
|
|
44
|
+
Native SPA routes receive separate browser entries with shared runtime chunks.
|
|
45
|
+
Imported browser CSS is linked from the corresponding route's document using
|
|
46
|
+
Bun's build metadata. Server modules remain excluded from browser entries.
|
|
47
|
+
Native server/SSR CSS imports are bundled into public route stylesheets, including
|
|
48
|
+
layout and transitive imports. CSS from dynamic imports is included eagerly.
|
|
49
|
+
Server styles precede browser styles when both exist; repeated roots are deduplicated.
|
|
50
|
+
Bun handles nested layers, media conditions and asset URLs. Unlinked browser CSS
|
|
51
|
+
byproducts may remain in build output after a unified stylesheet is generated.
|
|
52
|
+
|
|
26
53
|
See [docs/ROUTING.md](../../docs/ROUTING.md) and
|
|
27
54
|
[docs/MANIFEST.md](../../docs/MANIFEST.md).
|
|
55
|
+
|
|
56
|
+
Native Bun builds use Bun server export conditions; native Node and Cloudflare builds use Node
|
|
57
|
+
conditions. Native routes in one build must share a runtime. The Node adapter
|
|
58
|
+
bundles its server entry for deployment without installed runtime packages.
|
|
59
|
+
|
|
60
|
+
`requestContext: true` bundles the server-only request runner with the routes, so
|
|
61
|
+
request helpers share one AsyncLocalStorage instance after bundling. It is opt-in,
|
|
62
|
+
supported on Bun/Node, and omitted from default and browser bundles. Edge targets
|
|
63
|
+
reject the option before removing the previous build.
|
|
64
|
+
|
|
65
|
+
Files in the project’s `public/` directory are copied into the build’s public
|
|
66
|
+
output and registered with SHA-256 integrity. They keep their names and root URLs
|
|
67
|
+
(with each URL segment encoded); `public/logo.svg` is served at `/logo.svg`.
|
|
68
|
+
Symlinks, overlapping source/output directories, and collisions with generated
|
|
69
|
+
files or manifest URLs fail the build. Output cleanup first checks that it cannot
|
|
70
|
+
remove project, route, or known module source files. Rebuilds remove stale assets.
|
package/package.json
CHANGED
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tschk/moonshine-compiler",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.4",
|
|
4
4
|
"license": "ISC",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./src/index.ts",
|
|
7
7
|
"types": "./src/index.ts",
|
|
8
8
|
"exports": {
|
|
9
|
-
".": "./src/index.ts"
|
|
9
|
+
".": "./src/index.ts",
|
|
10
|
+
"./source": "./src/source.ts"
|
|
10
11
|
},
|
|
12
|
+
"files": [
|
|
13
|
+
"src"
|
|
14
|
+
],
|
|
11
15
|
"scripts": {
|
|
12
16
|
"format": "bunx prettier --check .",
|
|
13
17
|
"lint": "bunx oxlint .",
|
|
@@ -15,11 +19,11 @@
|
|
|
15
19
|
"test": "bun test"
|
|
16
20
|
},
|
|
17
21
|
"dependencies": {
|
|
18
|
-
"@tschk/moonshine-framework": "^0.
|
|
19
|
-
"@tschk/moonshine-router": "^0.
|
|
22
|
+
"@tschk/moonshine-framework": "^0.4.4",
|
|
23
|
+
"@tschk/moonshine-router": "^0.4.4",
|
|
24
|
+
"typescript": "^5.8.2"
|
|
20
25
|
},
|
|
21
26
|
"devDependencies": {
|
|
22
|
-
"@types/bun": "1.3.14"
|
|
23
|
-
"typescript": "^5.8.2"
|
|
27
|
+
"@types/bun": "1.3.14"
|
|
24
28
|
}
|
|
25
29
|
}
|