@zenithbuild/core 0.7.3 → 0.7.5

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/CORE_CONTRACT.md CHANGED
@@ -1,13 +1,11 @@
1
- # CORE_CONTRACT.md — Deterministic Utility Substrate
1
+ # CORE_CONTRACT.md — Public Package Boundary and Deterministic Utility Layer
2
2
 
3
- Canonical public docs: `../zenith-docs/documentation/contracts/core-contract.md`
3
+ Canonical public docs: `../../docs/documentation/contracts/core-contract.md`
4
4
 
5
5
  > **This document is a legal boundary.**
6
- > Core is a shared utility layer. It contains no business logic,
7
- > no routing, no DOM, no framework behavior. Pure helper substrate only.
8
- >
9
- > **Standalone test:** If `zenith-core` were published alone on npm,
10
- > it must make sense as a generic deterministic utility library.
6
+ > `@zenithbuild/core` is the public dependency boundary for Zenith apps.
7
+ > It owns deterministic shared utilities and the public config/type surface.
8
+ > It does not own compiler semantics, router runtime behavior, or adapter packaging logic.
11
9
 
12
10
  ## Status: FROZEN (V0)
13
11
 
@@ -15,19 +13,20 @@ Canonical public docs: `../zenith-docs/documentation/contracts/core-contract.md`
15
13
 
16
14
  ## 1. Core Identity
17
15
 
18
- Core provides deterministic **transforms**, **formatting**, and **schema validation**.
16
+ Core provides:
19
17
 
20
- **Core provides:**
21
- - Deterministic transforms: `hash`, `normalizePath`, `sortRoutes`, `parseConfig`, `parseSemver`
22
- - Deterministic formatting: `formatError`
23
- - Deterministic schema validation: `validateConfigSchema`, `validateRouteParams`
18
+ - the public `zenith` CLI entrypoint
19
+ - deterministic config loading and validation
20
+ - exported config/build-manifest/adapter types
21
+ - path ordering, hashing, error, version, and schema helpers
22
+ - the generated core-module source bridge used by the framework runtime boundary
24
23
 
25
- **Core does NOT:**
26
- - Scan repositories
27
- - Enforce cross-layer behavior
28
- - Know about router semantics
29
- - Know about bundler internals
30
- - Police other layers' architecture
24
+ Core does not:
25
+
26
+ - classify routes or execute navigation
27
+ - hydrate DOM or run runtime bindings
28
+ - bundle assets or package adapters
29
+ - reinterpret compiler output downstream
31
30
 
32
31
  ---
33
32
 
@@ -35,14 +34,17 @@ Core provides deterministic **transforms**, **formatting**, and **schema validat
35
34
 
36
35
  | Module | Purpose |
37
36
  |---|---|
38
- | `config.js` | Load + validate config schema |
39
- | `path.js` | Normalize paths + `[param]` `:param` |
40
- | `order.js` | Static-first stable sort |
41
- | `hash.js` | SHA-256 content hashing |
42
- | `errors.js` | Error factory + prefixing |
43
- | `version.js` | SemVer parsing + major compatibility |
44
- | `guards.js` | Small pure validation helpers |
45
- | `index.js` | Re-exports |
37
+ | `config.ts` | Load + validate config schema |
38
+ | `config-types.ts` | Public config, manifest, and adapter types |
39
+ | `path.ts` | Normalize paths + `[param]` → `:param` |
40
+ | `order.ts` | Static-first stable sort |
41
+ | `hash.ts` | SHA-256 content hashing |
42
+ | `errors.ts` | Error factory + prefixing |
43
+ | `version.ts` | SemVer parsing + major compatibility |
44
+ | `guards.ts` | Small pure validation helpers |
45
+ | `schema.ts` / `ir/` | Shared IR/schema exports |
46
+ | `core-template.ts` | Deterministic generated core module bridge |
47
+ | `index.ts` | Re-exports |
46
48
 
47
49
  ---
48
50
 
@@ -55,25 +57,51 @@ Core provides deterministic **transforms**, **formatting**, and **schema validat
55
57
  | Paths | Normalized separators (`/`), consistent param format |
56
58
  | Config | Missing keys → explicit defaults, unknown keys → throw |
57
59
  | Errors | Consistent format: `[Zenith:MODULE] message` |
60
+ | Config loading | Exactly one of `zenith.config.ts` or `zenith.config.js` is loaded |
58
61
 
59
62
  ---
60
63
 
61
- ## 4. Explicit Prohibitions
64
+ ## 4. Public Config Surface
65
+
66
+ Top-level Zenith config keys currently validated by core:
67
+
68
+ ```ts
69
+ export default defineConfig({
70
+ router: false,
71
+ embeddedMarkupExpressions: false,
72
+ typescriptDefault: true,
73
+ outDir: 'dist',
74
+ pagesDir: 'pages',
75
+ basePath: '/',
76
+ target: 'static',
77
+ adapter: null,
78
+ strictDomLints: false,
79
+ images: {}
80
+ });
81
+ ```
82
+
83
+ Rules:
84
+
85
+ - `target` and `adapter` are mutually exclusive
86
+ - unknown top-level keys throw
87
+ - `basePath` is normalized and must stay path-only
88
+ - `images` is a structured config object validated by core
62
89
 
63
- Core source **must never**:
90
+ ## 5. Explicit Prohibitions
64
91
 
65
- 1. Import from `@zenithbuild/compiler`, `@zenithbuild/bundler`, `@zenithbuild/runtime`, or `@zenithbuild/router`
66
- 2. Reference `window`, `document`, `navigator`, or any browser API
67
- 3. Use `eval()`, `new Function()`, or `document.write()`
68
- 4. Perform build orchestration of any kind
69
- 5. Access the filesystem **except when explicitly loading `zenith.config.js`**
70
- 6. Mutate global state
71
- 7. Contain preset/mode logic (`basic`, `router`, `fullstack` belong in `create-zenith`)
72
- 8. Initiate version checks against other packages (other layers call core's utility)
92
+ Core source must never:
93
+
94
+ 1. Reference `window`, `document`, `navigator`, or browser-only APIs.
95
+ 2. Use `eval()`, `new Function()`, or `document.write()`.
96
+ 3. Perform dev/build/preview orchestration.
97
+ 4. Infer route protection, router, or adapter behavior from app source.
98
+ 5. Read project files other than explicit config loading.
99
+ 6. Mutate process-wide framework state as hidden behavior.
100
+ 7. Invent hidden config defaults or silently accept unknown config keys.
73
101
 
74
102
  ---
75
103
 
76
- ## 5. Hash Contract
104
+ ## 6. Hash Contract
77
105
 
78
106
  - Algorithm: **SHA-256** via `node:crypto`
79
107
  - Output: **hex string**
@@ -84,29 +112,6 @@ Core source **must never**:
84
112
 
85
113
  ---
86
114
 
87
- ## 6. Config Schema (V0)
88
-
89
- ```js
90
- // zenith.config.js
91
- export default {
92
- router: false, // boolean — opt-in client router
93
- outDir: 'dist', // string — output directory
94
- pagesDir: 'pages' // string — pages directory
95
- }
96
- ```
97
-
98
- | Key | Type | Default | Validation |
99
- |---|---|---|---|
100
- | `router` | `boolean` | `false` | Must be boolean |
101
- | `outDir` | `string` | `'dist'` | Non-empty string |
102
- | `pagesDir` | `string` | `'pages'` | Non-empty string |
103
-
104
- Unknown keys → throw `[Zenith:Config] Unknown key: "foo"`.
105
-
106
- **No other keys for V0.** No `mode`, `target`, `presets`, `experimental`, `base`, `assetsDir`.
107
-
108
- ---
109
-
110
115
  ## 7. Version Compatibility API
111
116
 
112
117
  ```js
@@ -137,9 +142,6 @@ Guards do NOT:
137
142
 
138
143
  ---
139
144
 
140
- ## 9. Dependency Rules
145
+ ## 9. Boundary Rule
141
146
 
142
- - **Zero dependencies on other Zenith packages**
143
- - Zero runtime npm dependencies
144
- - Dev dependencies: Jest only
145
- - Pure ESM, Node.js built-ins only
147
+ If a capability changes route behavior, bundling, runtime DOM behavior, or adapter packaging, core may type or validate its config shape but it must not become the implementation owner.
package/README.md CHANGED
@@ -1,13 +1,18 @@
1
1
  # `@zenithbuild/core`
2
2
 
3
- This is the **sole public entrypoint** for the Zenith framework.
3
+ This is the public dependency boundary for Zenith applications.
4
4
 
5
5
  ## Canonical Docs
6
6
 
7
- - Core contract: `../zenith-docs/documentation/contracts/core-contract.md`
8
- - Zenith contract: `../zenith-docs/documentation/zenith-contract.md`
7
+ - Core contract: `../../docs/documentation/contracts/core-contract.md`
8
+ - Zenith contract: `../../docs/documentation/zenith-contract.md`
9
9
 
10
- Use this package directly in your projects to run Zenith utilities and access the official APIs.
10
+ Use `@zenithbuild/core` in app projects for:
11
+
12
+ - the `zenith` CLI entrypoint
13
+ - typed `defineConfig()` / `loadConfig()` helpers
14
+ - deterministic path/order/hash/error/version utilities
15
+ - exported schema and IR helper surfaces that are part of the public package boundary
11
16
 
12
17
  ## Installation
13
18
 
@@ -21,4 +26,4 @@ The `.bin` wrapper is exposed as `zenith`. Running `npx zenith dev` or `npx zeni
21
26
 
22
27
  ## Internal Dependencies
23
28
 
24
- For developers: DO NOT import any other `@zenithbuild/*` packages directly (e.g. `@zenithbuild/compiler`, `@zenithbuild/runtime`, `@zenithbuild/cli`). All needed features are either opaque implementation details or safely exposed through exports here. Direct access of inner implementation details is strictly forbidden.
29
+ For app code, do not import internal `@zenithbuild/*` implementation packages directly. If a surface is meant to be public, it must be exposed through `@zenithbuild/core` or the canonical docs.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zenithbuild/core",
3
- "version": "0.7.3",
3
+ "version": "0.7.5",
4
4
  "description": "Deterministic utility substrate for the Zenith framework",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -43,11 +43,11 @@
43
43
  "access": "public"
44
44
  },
45
45
  "dependencies": {
46
- "@zenithbuild/cli": "0.7.3",
47
- "@zenithbuild/compiler": "0.7.3",
48
- "@zenithbuild/runtime": "0.7.3",
49
- "@zenithbuild/router": "0.7.3",
50
- "@zenithbuild/bundler": "0.7.3"
46
+ "@zenithbuild/cli": "0.7.5",
47
+ "@zenithbuild/compiler": "0.7.5",
48
+ "@zenithbuild/runtime": "0.7.5",
49
+ "@zenithbuild/router": "0.7.5",
50
+ "@zenithbuild/bundler": "0.7.5"
51
51
  },
52
52
  "scripts": {
53
53
  "build": "rm -rf dist && tsc -p tsconfig.build.json",