@nextwebwg/htmlkit 1.0.0-alpha.28
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/LICENSE +21 -0
- package/README.md +249 -0
- package/dist/application.d.ts +4 -0
- package/dist/application.d.ts.map +1 -0
- package/dist/application.js +188 -0
- package/dist/application.js.map +1 -0
- package/dist/browser.d.ts +7 -0
- package/dist/browser.d.ts.map +1 -0
- package/dist/browser.js +76 -0
- package/dist/browser.js.map +1 -0
- package/dist/build.d.ts +3 -0
- package/dist/build.d.ts.map +1 -0
- package/dist/build.js +154 -0
- package/dist/build.js.map +1 -0
- package/dist/bundle-worker.d.ts +2 -0
- package/dist/bundle-worker.d.ts.map +1 -0
- package/dist/bundle-worker.js +24 -0
- package/dist/bundle-worker.js.map +1 -0
- package/dist/bundle.d.ts +9 -0
- package/dist/bundle.d.ts.map +1 -0
- package/dist/bundle.js +23 -0
- package/dist/bundle.js.map +1 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +58 -0
- package/dist/cli.js.map +1 -0
- package/dist/config.d.ts +13 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +30 -0
- package/dist/config.js.map +1 -0
- package/dist/document.d.ts +5 -0
- package/dist/document.d.ts.map +1 -0
- package/dist/document.js +18 -0
- package/dist/document.js.map +1 -0
- package/dist/head.d.ts +5 -0
- package/dist/head.d.ts.map +1 -0
- package/dist/head.js +88 -0
- package/dist/head.js.map +1 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +8 -0
- package/dist/index.js.map +1 -0
- package/dist/resource.d.ts +14 -0
- package/dist/resource.d.ts.map +1 -0
- package/dist/resource.js +65 -0
- package/dist/resource.js.map +1 -0
- package/dist/routes.d.ts +9 -0
- package/dist/routes.d.ts.map +1 -0
- package/dist/routes.js +175 -0
- package/dist/routes.js.map +1 -0
- package/dist/serve.d.ts +4 -0
- package/dist/serve.d.ts.map +1 -0
- package/dist/serve.js +204 -0
- package/dist/serve.js.map +1 -0
- package/dist/types.d.ts +112 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/package.json +53 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Next Web Working Group
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,249 @@
|
|
|
1
|
+
# HTMLKit
|
|
2
|
+
|
|
3
|
+
HTMLKit (`@nextwebwg/htmlkit`) builds applications with HTML Next components. It provides routes,
|
|
4
|
+
layouts, server loaders, browser delivery, and development tools. The first production adapter
|
|
5
|
+
generates static pages; [the server-rendering design](./docs/server-rendering.md) preserves a path
|
|
6
|
+
to request-time rendering.
|
|
7
|
+
|
|
8
|
+
Use Node 22.13+ or Node 24 and Corepack pnpm. Install `@nextwebwg/htmlkit`, then run:
|
|
9
|
+
|
|
10
|
+
```sh
|
|
11
|
+
corepack pnpm exec htmlkit dev
|
|
12
|
+
corepack pnpm exec htmlkit build
|
|
13
|
+
corepack pnpm exec htmlkit preview
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
Commands accept an optional application root and `--base /docs/`, `--origin https://example.com`,
|
|
17
|
+
`--out-dir dist`, `--port 3000`, and `--host 127.0.0.1`. Development and preview default to loopback.
|
|
18
|
+
Preview serves the built files without running loaders. Deploy `dist` to a static host at the chosen
|
|
19
|
+
base path; configure its missing-page response to use `404.html`.
|
|
20
|
+
|
|
21
|
+
## Routes and layouts
|
|
22
|
+
|
|
23
|
+
File routes follow familiar Nuxt directory and parameter names:
|
|
24
|
+
|
|
25
|
+
```text
|
|
26
|
+
app/
|
|
27
|
+
components/ reusable HTML Next components
|
|
28
|
+
layouts/
|
|
29
|
+
default.html automatic shared shell
|
|
30
|
+
default.server.ts optional shell loader
|
|
31
|
+
admin.html named alternative shell
|
|
32
|
+
pages/
|
|
33
|
+
index.html /
|
|
34
|
+
index.server.ts optional home loader
|
|
35
|
+
about.html /about/
|
|
36
|
+
items/
|
|
37
|
+
[slug].html /items/[slug]/
|
|
38
|
+
[slug].server.ts loader and static entries
|
|
39
|
+
public/ files copied to the deployment root
|
|
40
|
+
htmlkit.config.ts optional configuration
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
A page resource selects one entry component. A single definition is inferred; a file with helper
|
|
44
|
+
components must select its page using `<meta name="htmlkit:page" content="page-products">`.
|
|
45
|
+
Selection never depends on declaration order. The file-level selector is separate from component-owned
|
|
46
|
+
metadata: each page or layout declares its own title, description, links, and layout choice as direct
|
|
47
|
+
children of its `<template component>`. Helpers use ordinary HTML Next component semantics; their
|
|
48
|
+
metadata never contributes to the page head, even when the page renders them.
|
|
49
|
+
Layouts each declare one root component and project the page through `<slot name="page"></slot>`.
|
|
50
|
+
Component links and controllers use existing HTML Next syntax and resolution rules. Keep non-page
|
|
51
|
+
resources outside `app/pages`; filenames beginning with `_` or `.` are ignored by file routing.
|
|
52
|
+
|
|
53
|
+
Page component names must be unique across the application, including both file and registered
|
|
54
|
+
routes. Discovery reports both conflicting files and route patterns before executing any loaders
|
|
55
|
+
or controllers. Use `page-` by convention, for example `page-home`, `page-products`, and
|
|
56
|
+
`page-product-detail`; the prefix is recommended rather than required. One page definition may
|
|
57
|
+
serve several registered route aliases or many parameter values without needing another name.
|
|
58
|
+
Renaming a page requires route rediscovery; the development server does this on file changes.
|
|
59
|
+
|
|
60
|
+
Route URLs, component names, and bundle locations are separate identities. For example,
|
|
61
|
+
`app/pages/shop.html` may declare `component="page-products"`; its URL is `/shop/`, and its generated
|
|
62
|
+
browser module has an independent build-assigned location. `ApplicationRoute.pageName` exposes the
|
|
63
|
+
component name separately from `pattern` and the `component` source path. The deployment manifest's
|
|
64
|
+
`pages` records likewise separate `pathname`, `pageName`, and `browserModule`, so bundle grouping
|
|
65
|
+
does not define application routes or authored component names.
|
|
66
|
+
|
|
67
|
+
Each filename contributes a URL segment; `index.html` names its directory's URL. Whole segments
|
|
68
|
+
such as `[slug]` become parameters. Literal segments take priority over parameters. Routes have
|
|
69
|
+
trailing slashes; preview redirects directory URLs that omit them. Equivalent patterns and output
|
|
70
|
+
collisions are errors. Optional parameters, mixed parameter segments, groups, catch-all routes,
|
|
71
|
+
and client routing are outside this first delivery.
|
|
72
|
+
|
|
73
|
+
The default layout is `app/layouts/default.html` when present. Page metadata chooses a named
|
|
74
|
+
layout or disables it with `content="none"`. Layout selection is independent of the route URL;
|
|
75
|
+
choosing `admin` replaces the default shell. Nested shells can compose ordinary HTML Next
|
|
76
|
+
components explicitly. Adding a parent page never wraps descendant routes.
|
|
77
|
+
|
|
78
|
+
```html
|
|
79
|
+
<template component="page-products">
|
|
80
|
+
<meta name="htmlkit:layout" content="admin">
|
|
81
|
+
<meta name="description" content="Manage your products.">
|
|
82
|
+
<meta property="og:title" content="Product administration">
|
|
83
|
+
<title>Products · Admin</title>
|
|
84
|
+
|
|
85
|
+
<article><h1>Products</h1></article>
|
|
86
|
+
</template>
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
A layout uses normal component syntax:
|
|
90
|
+
|
|
91
|
+
```html
|
|
92
|
+
<template component="admin-shell">
|
|
93
|
+
<title>Administration</title>
|
|
94
|
+
<meta name="description" content="Administration tools.">
|
|
95
|
+
<main><header>Administration</header><slot name="page"></slot></main>
|
|
96
|
+
</template>
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
`htmlkit:*` metadata configures the build and is removed from the generated document. Ordinary
|
|
100
|
+
`title`, `meta`, and metadata `link` elements directly inside a selected carrier contribute to the
|
|
101
|
+
document head. They are siblings of `<defs>`, the rendered root, and `<style>`; no `<head>` wrapper
|
|
102
|
+
is needed. Keep only `htmlkit:page` and component dependency links at file scope. HTMLKit diagnoses
|
|
103
|
+
file-level head metadata instead of silently assigning it to a component. The regular HTML Next
|
|
104
|
+
resource loader accepts and ignores resource-level and direct carrier metadata;
|
|
105
|
+
it does not select layouts, update a host document, or evaluate their bindings. Resource-level
|
|
106
|
+
`style`, `script`, `base`, policy `meta` (`http-equiv`), and arbitrary body nodes are rejected.
|
|
107
|
+
Component styles inside a carrier and controller references retain their normal behavior.
|
|
108
|
+
|
|
109
|
+
Head values may bind to the selected component's declared props, populated by its loader, using
|
|
110
|
+
the existing HTML Next binding syntax:
|
|
111
|
+
|
|
112
|
+
```html
|
|
113
|
+
<template component="page-item">
|
|
114
|
+
<title $value="label"></title>
|
|
115
|
+
<meta name="description" from:content="description">
|
|
116
|
+
<link rel="canonical" from:href="canonicalURL">
|
|
117
|
+
<defs>
|
|
118
|
+
<prop name="label" type="string" required>Item label</prop>
|
|
119
|
+
<prop name="description" type="string" required>Description</prop>
|
|
120
|
+
<prop name="canonicalURL" type="string" required>Canonical URL</prop>
|
|
121
|
+
</defs>
|
|
122
|
+
<article><h1 $value="label"></h1></article>
|
|
123
|
+
</template>
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
Head bindings use the same parser, prop contracts, serialization, and renderer as body bindings.
|
|
127
|
+
They run during rendering against props; they do not start browser controllers, reads, or reactive
|
|
128
|
+
subscriptions. Layout metadata supplies defaults. A page replaces matching title, description,
|
|
129
|
+
meta name/property, canonical link, or alternate language/type/media defaults. The last singleton
|
|
130
|
+
in a layer wins. Stylesheets and alternate languages remain repeatable; social image arrays stay
|
|
131
|
+
ordered, and a page's image group replaces the layout's image group. A loader's `head` fields take
|
|
132
|
+
precedence over that layer's declarative title/description. Values are escaped when assembled.
|
|
133
|
+
Use public URLs (including `base` where needed) for head links; these links do not enter Vite's
|
|
134
|
+
component stylesheet pipeline.
|
|
135
|
+
|
|
136
|
+
Its `[slug].server.ts` can export:
|
|
137
|
+
|
|
138
|
+
```ts
|
|
139
|
+
import type { LoadContext, LoaderResult } from '@nextwebwg/htmlkit';
|
|
140
|
+
|
|
141
|
+
export const entries = () => [{ slug: 'one' }, { slug: 'two' }];
|
|
142
|
+
export function load({ params }: LoadContext): LoaderResult {
|
|
143
|
+
return {
|
|
144
|
+
props: {
|
|
145
|
+
label: `Item ${params.slug}`, description: `Details for ${params.slug}`,
|
|
146
|
+
canonicalURL: `https://example.com/items/${params.slug}/`,
|
|
147
|
+
},
|
|
148
|
+
head: { title: `Item ${params.slug}` },
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
Development can render any matching parameter value. Static production requires `entries()` to
|
|
154
|
+
list every intended parameterized page, including parameters from ancestor directories. It must
|
|
155
|
+
return a nonempty array with exactly the declared parameter keys. Values must be single URL
|
|
156
|
+
segments. Discovery and enumeration produce a complete build manifest; no link crawler decides
|
|
157
|
+
which pages exist.
|
|
158
|
+
|
|
159
|
+
## Loaders and browser behavior
|
|
160
|
+
|
|
161
|
+
`.server.ts` and `.server.js` modules run only in Node. Layout loaders run outermost first, then the
|
|
162
|
+
page loader. Each receives `phase: 'prerender'`, `url`, `params`, `base`, `parent`, `fetch`, and
|
|
163
|
+
`signal`. `parent` merges the preceding loaders' `data` objects; later keys take precedence.
|
|
164
|
+
Use `base` when constructing application links or public asset URLs. `url` uses the configured
|
|
165
|
+
canonical origin, not a preview reader's request. Query parameters and request data are unavailable
|
|
166
|
+
in this static adapter; accessing `context.request` throws a source diagnostic.
|
|
167
|
+
|
|
168
|
+
Each loader returns `props`, `state`, `data`, and/or `head` (`title`, `description`, `lang`). Props
|
|
169
|
+
and state belong to that loader's page or layout, are checked by HTML Next, and become **public
|
|
170
|
+
HTML**, including structured values. `data` stays in the loader chain unless a descendant puts it
|
|
171
|
+
into a public prop or state. Never place secrets in props or state. Inner head fields override outer
|
|
172
|
+
ones. Each render runs loaders again; application module globals are not isolated between renders.
|
|
173
|
+
|
|
174
|
+
Node uses HTML Next's renderer for the baseline. It executes neither browser controllers nor
|
|
175
|
+
declared browser reads. Per-page browser modules register parsed definitions and let HTML Next
|
|
176
|
+
adopt existing DOM, resume reads, and connect controllers. The platform adds no parser, scheduler,
|
|
177
|
+
hydration record, or lifecycle registry. Document navigation uses native links. The browser emits
|
|
178
|
+
`htmlkit:ready` on `document` after initial observation is installed.
|
|
179
|
+
|
|
180
|
+
Relative declared read sources are bundled as assets beside the browser delivery. Root-relative
|
|
181
|
+
read URLs are prefixed with the application base; absolute HTTP(S) sources retain their origin.
|
|
182
|
+
Reads remain pending in Node and start through HTML Next on browser connection.
|
|
183
|
+
|
|
184
|
+
Component CSS is emitted as an external stylesheet. Vite handles controller imports, their CSS
|
|
185
|
+
imports, and imported assets. Files under `public` retain their names; `_htmlkit` and `404.html`
|
|
186
|
+
are reserved. Public assets may not be symlinks. Builds stage output beside the deployment
|
|
187
|
+
directory and replace it after successful rendering and bundling. An existing nonempty output
|
|
188
|
+
directory must contain an HTMLKit manifest before HTMLKit will replace it.
|
|
189
|
+
|
|
190
|
+
Development uses the same renderer and loaders, with Vite serving browser modules. Changes trigger
|
|
191
|
+
a full document reload, including loader dependencies, component HTML, and added/removed routes.
|
|
192
|
+
Errors appear with source information in the preview response. Native form behavior and controller
|
|
193
|
+
cleanup remain HTML Next's responsibility.
|
|
194
|
+
|
|
195
|
+
## Explicit routes and library API
|
|
196
|
+
|
|
197
|
+
Use `htmlkit.config.ts` (or `.js`) for configuration. Explicit routes supplement file routes, or
|
|
198
|
+
set `fileRoutes: false` for a fully registered route table:
|
|
199
|
+
|
|
200
|
+
```ts
|
|
201
|
+
import { defineConfig } from '@nextwebwg/htmlkit';
|
|
202
|
+
|
|
203
|
+
export default defineConfig({
|
|
204
|
+
base: '/docs/',
|
|
205
|
+
layoutDefaults: { '/admin/': 'admin', '/account/': 'account' },
|
|
206
|
+
routes: [{
|
|
207
|
+
pattern: '/catalog/[id]/',
|
|
208
|
+
component: 'app/catalog/item.html',
|
|
209
|
+
server: 'app/catalog/item.server.ts',
|
|
210
|
+
layouts: [{ component: 'app/catalog/shell.html' }],
|
|
211
|
+
}],
|
|
212
|
+
});
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
Page layout metadata wins over the most specific `layoutDefaults` directory prefix, then the
|
|
216
|
+
application `layout` option (a name or `false`), then the automatic default layout. Registered
|
|
217
|
+
`layouts` can supply an explicit outer-to-inner chain when no named/default override is chosen.
|
|
218
|
+
|
|
219
|
+
Paths are relative to the application root. Explicit routes use the same parameter, loader,
|
|
220
|
+
composition, collision, and entry rules as file routes; they do not create another renderer.
|
|
221
|
+
No config file is read implicitly by the library API: pass options directly to `createApplication`,
|
|
222
|
+
`buildApplication`, `devApplication`, or `previewApplication`. Close returned applications and
|
|
223
|
+
servers when finished. `Application.render(pathname, signal?)` returns a baseline document, body,
|
|
224
|
+
styles, metadata, and the parsed component graph; browser delivery is added by dev/build.
|
|
225
|
+
|
|
226
|
+
## Proof applications
|
|
227
|
+
|
|
228
|
+
From this monorepo, after building packages:
|
|
229
|
+
|
|
230
|
+
```sh
|
|
231
|
+
corepack pnpm --filter @nextwebwg/htmlkit exec node dist/cli.js build examples/basic
|
|
232
|
+
corepack pnpm --filter @nextwebwg/htmlkit exec node dist/cli.js preview examples/basic
|
|
233
|
+
corepack pnpm --filter @nextwebwg/htmlkit build:docs-proof
|
|
234
|
+
corepack pnpm --filter @nextwebwg/htmlkit exec node dist/cli.js preview ../../.context/htmlkit-docs-proof
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
The basic application exercises routes, loaders, state, and controllers without documentation
|
|
238
|
+
features. The docs proof converts this repository's Markdown guides and generates a component
|
|
239
|
+
reference, code display, heading anchors, search navigation, a theme, and an interactive example.
|
|
240
|
+
Its Markdown dependency and theme live in the consumer, outside the platform runtime and published
|
|
241
|
+
package. Its input is trusted, checked-in author content; it does not sanitize arbitrary Markdown.
|
|
242
|
+
|
|
243
|
+
Larger documentation migrations must qualify their routes, examples, visuals, and browser behavior
|
|
244
|
+
against reviewed references before switching deployment. This initial proof exercises the platform;
|
|
245
|
+
it does not replace an existing documentation site's production output.
|
|
246
|
+
|
|
247
|
+
HTMLKit is MIT-licensed and shares the monorepo release version. It is configured for public npm
|
|
248
|
+
publication; creating its npm name once and configuring its trusted publisher are release setup,
|
|
249
|
+
not development build steps.
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { type ViteDevServer } from "vite";
|
|
2
|
+
import type { Application, ApplicationOptions } from "./types.js";
|
|
3
|
+
export declare function createApplication(options?: ApplicationOptions, moduleServer?: ViteDevServer): Promise<Application>;
|
|
4
|
+
//# sourceMappingURL=application.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"application.d.ts","sourceRoot":"","sources":["../src/application.ts"],"names":[],"mappings":"AAQA,OAAO,EAA0C,KAAK,aAAa,EAAE,MAAM,MAAM,CAAC;AAOlF,OAAO,KAAK,EAAE,WAAW,EAAE,kBAAkB,EAA2E,MAAM,YAAY,CAAC;AA2B3I,wBAAsB,iBAAiB,CAAC,OAAO,GAAE,kBAAuB,EAAE,YAAY,CAAC,EAAE,aAAa,GAAG,OAAO,CAAC,WAAW,CAAC,CAoI5H"}
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
import { dirname, join } from "node:path";
|
|
2
|
+
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
3
|
+
import { existsSync } from "node:fs";
|
|
4
|
+
import { readFile } from "node:fs/promises";
|
|
5
|
+
import { compileComponentStylesForBuild, parseComponentResource, serializePropTarget, serializeTypedValue } from "@nextwebwg/html-next";
|
|
6
|
+
import { loadNodeComponents } from "@nextwebwg/html-next/node-loader";
|
|
7
|
+
import { renderComponents } from "@nextwebwg/html-next/server";
|
|
8
|
+
import { createServer, isRunnableDevEnvironment } from "vite";
|
|
9
|
+
import { configure, HtmlKitError } from "./config.js";
|
|
10
|
+
import { documentHTML, escapeHTML } from "./document.js";
|
|
11
|
+
import { discoverRoutes, matchRoute, parameter, validSegment } from "./routes.js";
|
|
12
|
+
import { applicationResource, pageDefinition } from "./resource.js";
|
|
13
|
+
import { renderHead } from "./head.js";
|
|
14
|
+
function invocation(definition, result, id, child, nested) {
|
|
15
|
+
const props = result.props ?? {};
|
|
16
|
+
for (const name of Object.keys(props)) {
|
|
17
|
+
if (!Object.hasOwn(definition.contract.props, name))
|
|
18
|
+
throw new HtmlKitError(`Undeclared prop ${name}.`, definition.source.file);
|
|
19
|
+
}
|
|
20
|
+
let attributes = ` id="${id}"${nested ? ' slot="page"' : ""}`;
|
|
21
|
+
for (const [name, contract] of Object.entries(definition.contract.props)) {
|
|
22
|
+
serializePropTarget(contract, props[name]);
|
|
23
|
+
// The contract target describes lowering onto native DOM. Invocation attributes carry
|
|
24
|
+
// the public prop name; writing the target name here silently loses remapped props.
|
|
25
|
+
const provided = props[name] === undefined ? contract.default : props[name];
|
|
26
|
+
const value = provided == null ? null : serializeTypedValue(provided, contract.type);
|
|
27
|
+
const attribute = name.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
|
|
28
|
+
if (value !== null)
|
|
29
|
+
attributes += ` ${attribute}="${escapeHTML(value)}"`;
|
|
30
|
+
}
|
|
31
|
+
const tag = definition.contract.tag;
|
|
32
|
+
return `<${tag}${attributes}>${child}</${tag}>`;
|
|
33
|
+
}
|
|
34
|
+
function packageResource(path) {
|
|
35
|
+
let directory = dirname(path);
|
|
36
|
+
while (!existsSync(join(directory, "package.json")) && dirname(directory) !== directory)
|
|
37
|
+
directory = dirname(directory);
|
|
38
|
+
return { url: pathToFileURL(path).href, trustRoot: pathToFileURL(directory + "/").href };
|
|
39
|
+
}
|
|
40
|
+
export async function createApplication(options = {}, moduleServer) {
|
|
41
|
+
const config = configure(options);
|
|
42
|
+
const routes = await discoverRoutes(config.root, options);
|
|
43
|
+
const ownsServer = moduleServer === undefined;
|
|
44
|
+
const server = moduleServer ?? await createServer({ root: config.root, configFile: false, appType: "custom",
|
|
45
|
+
mode: "development", publicDir: false, server: { middlewareMode: true, watch: null, hmr: false },
|
|
46
|
+
optimizeDeps: { noDiscovery: true, include: [] }, logLevel: "silent" });
|
|
47
|
+
const environment = server.environments.ssr;
|
|
48
|
+
if (environment === undefined || !isRunnableDevEnvironment(environment)) {
|
|
49
|
+
if (ownsServer)
|
|
50
|
+
await server.close();
|
|
51
|
+
throw new HtmlKitError("Vite requires a runnable Node loader environment.");
|
|
52
|
+
}
|
|
53
|
+
const module = async (layer) => layer.server === undefined ? {} :
|
|
54
|
+
await environment.runner.import(layer.server);
|
|
55
|
+
return {
|
|
56
|
+
...config, routes,
|
|
57
|
+
async entries() {
|
|
58
|
+
const paths = new Set();
|
|
59
|
+
for (const route of routes) {
|
|
60
|
+
const loaded = await module(route);
|
|
61
|
+
if (route.params.length > 0 && typeof loaded.entries !== "function") {
|
|
62
|
+
throw new HtmlKitError(`Static entries() must enumerate parameters: ${route.params.join(", ")}.`, route.server ?? route.component);
|
|
63
|
+
}
|
|
64
|
+
const entries = loaded.entries === undefined ? [{}] : await loaded.entries();
|
|
65
|
+
if (!Array.isArray(entries) || entries.length === 0)
|
|
66
|
+
throw new HtmlKitError("entries() must return a nonempty array.", route.server);
|
|
67
|
+
for (const entry of entries) {
|
|
68
|
+
if (entry === null || typeof entry !== "object" || Object.keys(entry).sort().join(",") !== [...route.params].sort().join(",")) {
|
|
69
|
+
throw new HtmlKitError(`Each entry must provide exactly these parameters: ${route.params.join(", ")}.`, route.server);
|
|
70
|
+
}
|
|
71
|
+
const segments = route.segments.map(segment => {
|
|
72
|
+
const name = parameter(segment);
|
|
73
|
+
if (name === undefined)
|
|
74
|
+
return segment;
|
|
75
|
+
const value = entry[name];
|
|
76
|
+
if (!validSegment(value))
|
|
77
|
+
throw new HtmlKitError(`Parameter ${name} must be a safe nonempty URL segment.`, route.server);
|
|
78
|
+
return encodeURIComponent(value);
|
|
79
|
+
});
|
|
80
|
+
const path = config.base + (segments.length === 0 ? "" : segments.join("/") + "/");
|
|
81
|
+
if (paths.has(path))
|
|
82
|
+
throw new HtmlKitError(`Static route collision at ${path}.`, route.component);
|
|
83
|
+
const matched = matchRoute(routes, path, config.base);
|
|
84
|
+
if (matched?.route !== route)
|
|
85
|
+
throw new HtmlKitError(`Static route collision with ${matched?.route.pattern} at ${path}.`, route.component);
|
|
86
|
+
paths.add(path);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
return [...paths].sort();
|
|
90
|
+
},
|
|
91
|
+
async render(pathname, signal = new AbortController().signal) {
|
|
92
|
+
signal.throwIfAborted();
|
|
93
|
+
const url = new URL(pathname, config.origin);
|
|
94
|
+
if (url.origin !== config.origin || url.search || url.hash)
|
|
95
|
+
throw new HtmlKitError("Static rendering requires an application pathname without a query or fragment.");
|
|
96
|
+
const matched = matchRoute(routes, url.pathname, config.base);
|
|
97
|
+
if (matched === undefined) {
|
|
98
|
+
const head = { title: "Page not found" };
|
|
99
|
+
const body = '<main><h1>Page not found</h1></main>';
|
|
100
|
+
return { status: 404, pathname, html: documentHTML(body, head), css: "", head, body, components: [] };
|
|
101
|
+
}
|
|
102
|
+
const { route, params } = matched;
|
|
103
|
+
const layers = [...route.layouts, route];
|
|
104
|
+
// Vite owns module caching and dependency invalidation. Per-render results never enter
|
|
105
|
+
// a shared cache; HTML Next owns the DOM worker and declarative component semantics.
|
|
106
|
+
const packages = new Map();
|
|
107
|
+
const resources = new Map();
|
|
108
|
+
const layerURLs = new Set(layers.map(layer => pathToFileURL(layer.component).href));
|
|
109
|
+
const graph = await loadNodeComponents(layers.map(layer => pathToFileURL(layer.component).href), {
|
|
110
|
+
// The graph resolver is synchronous. Prepare its bare imports while asynchronously
|
|
111
|
+
// reading each carrier, using Vite's ESM resolution from the consuming application.
|
|
112
|
+
readComponent: async (url) => {
|
|
113
|
+
const source = await readFile(fileURLToPath(url), "utf8");
|
|
114
|
+
const parsed = layerURLs.has(url) ? applicationResource(source, url) : parseComponentResource(source, url);
|
|
115
|
+
if ("configuration" in parsed)
|
|
116
|
+
resources.set(url, parsed);
|
|
117
|
+
const imports = [...parsed.dependencies, ...parsed.definitions.flatMap(definition => definition.controller === undefined ? [] : [definition.controller])];
|
|
118
|
+
for (const specifier of imports) {
|
|
119
|
+
if (/^(?:[A-Za-z][A-Za-z\d+.-]*:|\/|\.\.?\/)/.test(specifier))
|
|
120
|
+
continue;
|
|
121
|
+
const resolved = await server.environments.client.pluginContainer.resolveId(specifier, fileURLToPath(url));
|
|
122
|
+
if (resolved === null || resolved.external)
|
|
123
|
+
throw new HtmlKitError(`Cannot resolve component import ${specifier}.`, url);
|
|
124
|
+
packages.set(`${url}\0${specifier}`, packageResource(resolved.id));
|
|
125
|
+
}
|
|
126
|
+
return { url, source };
|
|
127
|
+
},
|
|
128
|
+
resolvePackage: (specifier, parentURL) => {
|
|
129
|
+
const resolved = packages.get(`${parentURL}\0${specifier}`);
|
|
130
|
+
if (resolved === undefined)
|
|
131
|
+
throw new HtmlKitError(`Cannot resolve component import ${specifier}.`, parentURL);
|
|
132
|
+
return resolved;
|
|
133
|
+
},
|
|
134
|
+
});
|
|
135
|
+
const layerDefinitions = layers.map(layer => {
|
|
136
|
+
if (layer === route)
|
|
137
|
+
return pageDefinition(resources.get(pathToFileURL(layer.component).href), layer.component);
|
|
138
|
+
const roots = graph.roots.filter(id => graph.nodes.get(id).url === pathToFileURL(layer.component).href);
|
|
139
|
+
if (roots.length !== 1)
|
|
140
|
+
throw new HtmlKitError("A page or layout must declare exactly one root component.", layer.component);
|
|
141
|
+
return graph.nodes.get(roots[0]).definition;
|
|
142
|
+
});
|
|
143
|
+
if (layerDefinitions.at(-1).contract.tag !== route.pageName) {
|
|
144
|
+
throw new HtmlKitError("Page component name changed; rediscover routes before rendering.", route.component);
|
|
145
|
+
}
|
|
146
|
+
for (const definition of layerDefinitions.slice(0, -1)) {
|
|
147
|
+
if (!definition.slots?.some(slot => slot.name === "page"))
|
|
148
|
+
throw new HtmlKitError('Layout requires a slot named "page".', definition.source.file);
|
|
149
|
+
}
|
|
150
|
+
const results = [];
|
|
151
|
+
let parent = Object.freeze({});
|
|
152
|
+
let head = {};
|
|
153
|
+
for (const layer of layers) {
|
|
154
|
+
signal.throwIfAborted();
|
|
155
|
+
const loaded = await module(layer);
|
|
156
|
+
const context = { phase: "prerender", url: new URL(url), base: config.base, params, parent,
|
|
157
|
+
fetch: globalThis.fetch, signal,
|
|
158
|
+
get request() { throw new HtmlKitError("request is unavailable during static generation.", layer.server); } };
|
|
159
|
+
const result = loaded.load === undefined ? {} : await loaded.load(context);
|
|
160
|
+
if (result === null || typeof result !== "object" || Array.isArray(result))
|
|
161
|
+
throw new HtmlKitError("load() must return a LoaderResult object.", layer.server);
|
|
162
|
+
results.push(result);
|
|
163
|
+
parent = Object.freeze({ ...parent, ...result.data });
|
|
164
|
+
const index = results.length - 1;
|
|
165
|
+
head = await renderHead(resources.get(pathToFileURL(layer.component).href), layerDefinitions[index], result, head, url.href, (definition, values) => invocation(definition, values, "htmlkit-head", "", false));
|
|
166
|
+
}
|
|
167
|
+
const state = {};
|
|
168
|
+
let body = "";
|
|
169
|
+
for (let i = layers.length - 1; i >= 0; i--) {
|
|
170
|
+
const id = `htmlkit-layer-${i}`;
|
|
171
|
+
const result = results[i];
|
|
172
|
+
if (result.state !== undefined)
|
|
173
|
+
state[`#${id}`] = result.state;
|
|
174
|
+
body = invocation(layerDefinitions[i], result, id, body, i > 0);
|
|
175
|
+
}
|
|
176
|
+
const components = [...graph.nodes.values()].map(node => ({ definition: node.definition,
|
|
177
|
+
styles: compileComponentStylesForBuild(node.definition.css, node.definition),
|
|
178
|
+
...(node.controller === undefined ? {} : { controller: fileURLToPath(node.controller.url) }) }));
|
|
179
|
+
const rendered = await renderComponents(body, { definitions: components.map(value => value.definition), url: url.href, state });
|
|
180
|
+
signal.throwIfAborted();
|
|
181
|
+
return { status: 200, pathname: url.pathname, body: rendered.html, css: rendered.css, head,
|
|
182
|
+
html: documentHTML(rendered.html, head), components };
|
|
183
|
+
},
|
|
184
|
+
async close() { if (ownsServer)
|
|
185
|
+
await server.close(); },
|
|
186
|
+
};
|
|
187
|
+
}
|
|
188
|
+
//# sourceMappingURL=application.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"application.js","sourceRoot":"","sources":["../src/application.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACxD,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAE5C,OAAO,EAAE,8BAA8B,EAAE,sBAAsB,EAAE,mBAAmB,EAAE,mBAAmB,EAA4B,MAAM,sBAAsB,CAAC;AAClK,OAAO,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AACtE,OAAO,EAAE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IAAI,CAAC,UAAU,CAAC;gBAC5E,GAAG,CAAC,IAAI,CAAC,UAAU,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,UAAU,EAAE,aAAa,CAAC,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;YACnG,MAAM,QAAQ,GAAG,MAAM,gBAAgB,CAAC,IAAI,EAAE,EAAE,WAAW,EAAE,UAAU,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,UAAU,CAAC,EAAE,GAAG,EAAE,GAAG,CAAC,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;YAChI,MAAM,CAAC,cAAc,EAAE,CAAC;YACxB,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,QAAQ,EAAE,GAAG,CAAC,QAAQ,EAAE,IAAI,EAAE,QAAQ,CAAC,IAAI,EAAE,GAAG,EAAE,QAAQ,CAAC,GAAG,EAAE,IAAI;gBACxF,IAAI,EAAE,YAAY,CAAC,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC,EAAE,UAAU,EAAE,CAAC;QAC1D,CAAC;QACD,KAAK,CAAC,KAAK,KAAK,IAAI,UAAU;YAAE,MAAM,MAAM,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;KACxD,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type Plugin } from "vite";
|
|
2
|
+
import type { BrowserDefinition } from "./types.js";
|
|
3
|
+
export declare function stylesheetSources(components: readonly BrowserDefinition[]): ReadonlyMap<string, string>;
|
|
4
|
+
/** HTML Next owns adoption, observation, reads, controllers, and teardown. */
|
|
5
|
+
export declare function browserSource(components: readonly BrowserDefinition[], base: string): string;
|
|
6
|
+
export declare function browserPlugin(sources: ReadonlyMap<string, string>, inputs?: Set<string>): Plugin;
|
|
7
|
+
//# sourceMappingURL=browser.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"browser.d.ts","sourceRoot":"","sources":["../src/browser.ts"],"names":[],"mappings":"AAEA,OAAO,EAAiB,KAAK,MAAM,EAAE,MAAM,MAAM,CAAC;AAClD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAOpD,wBAAgB,iBAAiB,CAAC,UAAU,EAAE,SAAS,iBAAiB,EAAE,GAAG,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,CAQvG;AAED,8EAA8E;AAC9E,wBAAgB,aAAa,CAAC,UAAU,EAAE,SAAS,iBAAiB,EAAE,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAuC5F;AAED,wBAAgB,aAAa,CAAC,OAAO,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,GAAG,MAAM,CAShG"}
|
package/dist/browser.js
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { fileURLToPath } from "node:url";
|
|
2
|
+
import { existsSync } from "node:fs";
|
|
3
|
+
import { normalizePath } from "vite";
|
|
4
|
+
const packagedRuntime = fileURLToPath(import.meta.resolve("@nextwebwg/html-next/runtime"));
|
|
5
|
+
const sourceRuntime = packagedRuntime.replace(/[/\\]dist[/\\]runtime\.js$/, "/src/runtime.ts");
|
|
6
|
+
// Workspace source execution can test the same entry before packages have been built.
|
|
7
|
+
const runtime = import.meta.url.endsWith(".ts") && existsSync(sourceRuntime) ? sourceRuntime : packagedRuntime;
|
|
8
|
+
export function stylesheetSources(components) {
|
|
9
|
+
const sources = new Map();
|
|
10
|
+
for (const component of components) {
|
|
11
|
+
if (component.styles.css === "")
|
|
12
|
+
continue;
|
|
13
|
+
const id = normalizePath(fileURLToPath(component.definition.source.file)) + ".htmlkit.css";
|
|
14
|
+
sources.set(id, (sources.get(id) ?? "") + component.styles.css);
|
|
15
|
+
}
|
|
16
|
+
return sources;
|
|
17
|
+
}
|
|
18
|
+
/** HTML Next owns adoption, observation, reads, controllers, and teardown. */
|
|
19
|
+
export function browserSource(components, base) {
|
|
20
|
+
const controlled = components.filter(component => component.controller !== undefined);
|
|
21
|
+
const definitions = components.map(({ definition }) => ({ ...definition, css: definition.css ? "/* external stylesheet */" : "",
|
|
22
|
+
source: { file: `${definition.contract.tag}.html` } }));
|
|
23
|
+
const reads = [];
|
|
24
|
+
for (let i = 0; i < definitions.length; i++) {
|
|
25
|
+
const definition = definitions[i];
|
|
26
|
+
if (definition.declarations === undefined)
|
|
27
|
+
continue;
|
|
28
|
+
definition.declarations = definition.declarations.map((declaration, j) => {
|
|
29
|
+
if (declaration.kind !== "data" || declaration.source === undefined)
|
|
30
|
+
return declaration;
|
|
31
|
+
const source = declaration.source;
|
|
32
|
+
if (source.startsWith("/") && !source.startsWith("//")) {
|
|
33
|
+
return { ...declaration, source: source.startsWith(base) ? source : base + source.slice(1) };
|
|
34
|
+
}
|
|
35
|
+
if (/^(?:[A-Za-z][A-Za-z\d+.-]*:|\/\/)/.test(source))
|
|
36
|
+
return declaration;
|
|
37
|
+
const url = new URL(source, components[i].definition.source.file);
|
|
38
|
+
const asset = fileURLToPath(url);
|
|
39
|
+
reads.push({ definition: i, declaration: j, asset, suffix: url.search + url.hash });
|
|
40
|
+
return declaration;
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
return `import { registerComponentDefinitions, observeDocument, getComponentHost, setControllerModule } from ${JSON.stringify(runtime)};
|
|
44
|
+
${[...stylesheetSources(components).keys()].map(id => `import ${JSON.stringify(id)};`).join("\n")}
|
|
45
|
+
${reads.map((read, i) => `import read${i} from ${JSON.stringify(read.asset + "?url&no-inline")};`).join("\n")}
|
|
46
|
+
${controlled.map((component, index) => `import * as controller${index} from ${JSON.stringify(component.controller)};`).join("\n")}
|
|
47
|
+
const controllers = { ${controlled.map((component, index) => `${JSON.stringify(component.definition.contract.tag)}: controller${index}`).join(",")} };
|
|
48
|
+
const styleStates = ${JSON.stringify(Object.fromEntries(components.map(component => [component.definition.contract.tag, component.styles.stateNames])))};
|
|
49
|
+
const definitions = ${JSON.stringify(definitions)};
|
|
50
|
+
${reads.map((read, i) => `definitions[${read.definition}].declarations[${read.declaration}].source = read${i} + ${JSON.stringify(read.suffix)};`).join("\n")}
|
|
51
|
+
registerComponentDefinitions(definitions, document, (_css, definition) => ({ css: '', stateNames: styleStates[definition.contract.tag] ?? [] }));
|
|
52
|
+
export const stop = observeDocument(document, { onConnect(element, definition) {
|
|
53
|
+
const controller = controllers[definition.contract.tag];
|
|
54
|
+
if (!controller) return;
|
|
55
|
+
setControllerModule(element, Promise.resolve(controller));
|
|
56
|
+
if (typeof controller.default !== 'function') throw new Error('Controller for ' + definition.contract.tag + ' must export a default function');
|
|
57
|
+
return controller.default(getComponentHost(element));
|
|
58
|
+
} });
|
|
59
|
+
document.dispatchEvent(new Event('htmlkit:ready'));
|
|
60
|
+
`;
|
|
61
|
+
}
|
|
62
|
+
export function browserPlugin(sources, inputs) {
|
|
63
|
+
return {
|
|
64
|
+
name: "htmlkit-browser",
|
|
65
|
+
resolveId(id) { if (sources.has(id))
|
|
66
|
+
return id.endsWith(".css") ? id : `\0${id}`; },
|
|
67
|
+
load(id) { return sources.get(id.startsWith("\0") ? id.slice(1) : id); },
|
|
68
|
+
generateBundle() {
|
|
69
|
+
if (inputs !== undefined)
|
|
70
|
+
for (const id of this.getModuleIds())
|
|
71
|
+
if (!id.startsWith("\0"))
|
|
72
|
+
inputs.add(id);
|
|
73
|
+
},
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
//# sourceMappingURL=browser.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"browser.js","sourceRoot":"","sources":["../src/browser.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,aAAa,EAAe,MAAM,MAAM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