@nextwebwg/html-next-unplugin 1.0.0-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/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,70 @@
1
+ # `@nextwebwg/html-next-unplugin`
2
+
3
+ Build integration for a closed Declarative Components application or library graph. The plugin
4
+ parses component sources during the build, emits native DOM factories, combines the graph's support
5
+ imports through the bundler, and writes `html-next.manifest.json` with the component and capability
6
+ inventory.
7
+
8
+ ```ts
9
+ // vite.config.ts
10
+ import { defineConfig } from "vite";
11
+ import htmlNext from "@nextwebwg/html-next-unplugin/vite";
12
+
13
+ export default defineConfig({
14
+ plugins: [htmlNext({
15
+ entries: ["src/components/app.html"],
16
+ mode: "application",
17
+ })],
18
+ });
19
+ ```
20
+
21
+ ```ts
22
+ import { createApp } from "virtual:html-next/components";
23
+
24
+ document.body.append(createApp());
25
+ ```
26
+
27
+ In application mode, the virtual module exports one `create<Name>` function for each configured
28
+ application entry. A linked `<link rel="component">` dependency used as an empty custom-element
29
+ invocation is compiled to a call to that dependency's native factory rather than an inert unknown
30
+ element. Transitive factories remain internal to the application graph.
31
+
32
+ Library mode gives each configured public entry a stable, independently consumable virtual module:
33
+
34
+ ```ts
35
+ // vite.config.ts
36
+ htmlNext({
37
+ entries: ["src/components/card.html", "src/components/button.html"],
38
+ mode: "library",
39
+ });
40
+ ```
41
+
42
+ ```js
43
+ export { createXCard } from "virtual:html-next/components/x-card";
44
+ ```
45
+
46
+ Generated factories import runtime helpers through one `virtual:html-next/support` module. Its
47
+ graph-wide capability union and concrete package imports are recorded in
48
+ `html-next.manifest.json`, together with the public entries and direct component edges. Component
49
+ source parsing stays in the build process and is absent from browser output.
50
+
51
+ An unlinked custom-element invocation is rejected as an undeclared dynamic boundary. Applications
52
+ that intentionally delegate a tag to a separately delivered custom element must say so explicitly:
53
+
54
+ ```ts
55
+ htmlNext({
56
+ entries: ["src/components/app.html"],
57
+ dynamicBoundaries: [
58
+ { tag: "x-external-chart", strategy: "external-custom-element" },
59
+ ],
60
+ });
61
+ ```
62
+
63
+ The external element remains a native `document.createElement()` boundary and is listed with its
64
+ users in the manifest. Capability chunks and the universal HTML Next runtime are not yet dynamic
65
+ boundary strategies.
66
+
67
+ The current compiled-invocation tranche accepts empty, statically positioned invocations in
68
+ components that do not need the general runtime renderer. Attributes, projected children, events,
69
+ refs, structural flow, invocation cycles, and general-runtime parents fail before emission with a
70
+ source-located `HN` diagnostic rather than producing a partially valid graph.
@@ -0,0 +1,47 @@
1
+ export declare const componentsModule = "virtual:html-next/components";
2
+ export declare const supportModule = "virtual:html-next/support";
3
+ export interface HtmlNextPluginOptions {
4
+ readonly entries: readonly string[];
5
+ readonly root?: string;
6
+ readonly manifestFile?: string | false;
7
+ readonly mode?: "application" | "library";
8
+ readonly dynamicBoundaries?: readonly HtmlNextDynamicBoundary[];
9
+ }
10
+ export interface HtmlNextDynamicBoundary {
11
+ readonly tag: string;
12
+ readonly strategy: "external-custom-element";
13
+ }
14
+ export interface HtmlNextBuildManifest {
15
+ readonly mode: "native-application-or-library-build";
16
+ readonly delivery: "application" | "library";
17
+ readonly entries: readonly string[];
18
+ readonly publicEntries: readonly {
19
+ readonly name: string;
20
+ readonly tag: string;
21
+ readonly source: string;
22
+ readonly module: string;
23
+ }[];
24
+ readonly components: readonly {
25
+ readonly name: string;
26
+ readonly tag: string;
27
+ readonly source: string;
28
+ readonly dependencies: readonly string[];
29
+ readonly capabilities: readonly string[];
30
+ }[];
31
+ readonly capabilities: readonly string[];
32
+ readonly supportImports: readonly string[];
33
+ readonly support: {
34
+ readonly module: typeof supportModule;
35
+ readonly imports: readonly string[];
36
+ readonly capabilities: readonly string[];
37
+ };
38
+ readonly dynamicBoundaries: readonly {
39
+ readonly tag: string;
40
+ readonly strategy: "external-custom-element";
41
+ readonly usedBy: readonly string[];
42
+ }[];
43
+ }
44
+ export declare function componentModule(tag: string): string;
45
+ export declare const htmlNext: import("unplugin").UnpluginInstance<HtmlNextPluginOptions, boolean>;
46
+ export default htmlNext;
47
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAcA,eAAO,MAAM,gBAAgB,iCAAiC,CAAC;AAC/D,eAAO,MAAM,aAAa,8BAA8B,CAAC;AAUzD,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,CAAC;IACpC,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC;IACvC,QAAQ,CAAC,IAAI,CAAC,EAAE,aAAa,GAAG,SAAS,CAAC;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AQ,CAAC,iBAAiB,EAAE,SAAS;QACnC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;QACrB,QAAQ,CAAC,QAAQ,EAAE,yBAAyB,CAAC;QAC7C,QAAQ,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC;KACpC,EAAE,CAAC;CACL;AAYD,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAEnD;AA8UD,eAAO,MAAM,QAAQ,qEA4DnB,CAAC;eAEY,QAAQ"}
package/dist/index.js ADDED
@@ -0,0 +1,375 @@
1
+ import { relative, resolve, sep } from "node:path";
2
+ import { fileURLToPath, pathToFileURL } from "node:url";
3
+ import { generateComponent, HtmlDiagnosticError, loadNodeComponents, } from "@nextwebwg/html-next";
4
+ import { createUnplugin } from "unplugin";
5
+ export const componentsModule = "virtual:html-next/components";
6
+ export const supportModule = "virtual:html-next/support";
7
+ const resolvedComponentsModule = "\0html-next:components";
8
+ const resolvedSupportModule = "\0html-next:support";
9
+ const publicComponentPrefix = `${componentsModule}/`;
10
+ const resolvedPublicComponentPrefix = "\0html-next:public-component:";
11
+ const componentPrefix = "html-next:component:";
12
+ const resolvedComponentPrefix = `\0${componentPrefix}`;
13
+ const stylePrefix = "html-next:style:";
14
+ const resolvedStylePrefix = `\0${stylePrefix}`;
15
+ export function componentModule(tag) {
16
+ return `${publicComponentPrefix}${encodeURIComponent(tag)}`;
17
+ }
18
+ function diagnostic(code, message, source) {
19
+ throw new HtmlDiagnosticError(source === undefined ? { code, message } : { code, message, source });
20
+ }
21
+ function escapePattern(value) {
22
+ return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
23
+ }
24
+ function visitComponentNodes(node, visit) {
25
+ if (node.kind === "text")
26
+ return;
27
+ if (node.kind === "slot") {
28
+ for (const child of node.fallback ?? [])
29
+ visitComponentNodes(child, visit);
30
+ return;
31
+ }
32
+ if (node.name.includes("-"))
33
+ visit(node);
34
+ for (const child of node.children)
35
+ visitComponentNodes(child, visit);
36
+ }
37
+ function componentId(url) {
38
+ return `${componentPrefix}${encodeURIComponent(url)}.js`;
39
+ }
40
+ function resolvedComponentId(url) {
41
+ return `\0${componentId(url)}`;
42
+ }
43
+ function publicComponentId(tag) {
44
+ return `${resolvedPublicComponentPrefix}${encodeURIComponent(tag)}`;
45
+ }
46
+ function collectInvocationEdges(nodes, tags, dynamicBoundaries) {
47
+ const edges = new Map();
48
+ const dynamicUses = new Map();
49
+ for (const node of nodes.values()) {
50
+ const invoked = new Map();
51
+ visitComponentNodes(node.definition.template, (invocation) => {
52
+ const tag = invocation.name;
53
+ const boundary = dynamicBoundaries.get(tag);
54
+ if (boundary !== undefined) {
55
+ const uses = dynamicUses.get(tag) ?? new Set();
56
+ uses.add(node.url);
57
+ dynamicUses.set(tag, uses);
58
+ return;
59
+ }
60
+ const target = tags.get(tag);
61
+ if (target === undefined || !node.dependencies.includes(target)) {
62
+ diagnostic("HN001", `Component invocation <${tag}> is not a declared static dependency or dynamic boundary.`, node.url);
63
+ }
64
+ if (invocation.attributes.length > 0 || invocation.children.length > 0 ||
65
+ invocation.flow !== undefined || invocation.ref !== undefined ||
66
+ (invocation.events?.length ?? 0) > 0) {
67
+ diagnostic("HN009", `Compiled invocation <${tag}> cannot yet carry attributes, projected children, events, refs, or structural flow.`, node.url);
68
+ }
69
+ const targetNode = nodes.get(target);
70
+ if (Object.values(targetNode.definition.contract.props).some((prop) => prop.required)) {
71
+ diagnostic("HN014", `Compiled invocation <${tag}> requires inputs, but invocation inputs are not implemented yet.`, node.url);
72
+ }
73
+ invoked.set(tag, target);
74
+ });
75
+ edges.set(node.url, invoked);
76
+ }
77
+ const visiting = new Set();
78
+ const visited = new Set();
79
+ const visit = (url) => {
80
+ if (visited.has(url))
81
+ return;
82
+ if (visiting.has(url))
83
+ diagnostic("HN002", "Compiled component invocations form a cycle.", url);
84
+ visiting.add(url);
85
+ for (const target of edges.get(url)?.values() ?? [])
86
+ visit(target);
87
+ visiting.delete(url);
88
+ visited.add(url);
89
+ };
90
+ for (const url of nodes.keys())
91
+ visit(url);
92
+ return { edges, dynamicUses };
93
+ }
94
+ function supportSource(imports) {
95
+ const lines = [];
96
+ if (imports.has("@nextwebwg/html-next/generated-runtime")) {
97
+ lines.push('export { manageGeneratedProps } from "@nextwebwg/html-next/generated-runtime";');
98
+ }
99
+ if (imports.has("@nextwebwg/html-next/runtime")) {
100
+ lines.push('export { manageComponentLifecycle } from "@nextwebwg/html-next/runtime";');
101
+ }
102
+ return lines.length === 0 ? "export {};\n" : `${lines.join("\n")}\n`;
103
+ }
104
+ function routeSupportImports(module, imports) {
105
+ let routed = module;
106
+ for (const source of [
107
+ "@nextwebwg/html-next/generated-runtime",
108
+ "@nextwebwg/html-next/runtime",
109
+ ]) {
110
+ if (!routed.includes(source))
111
+ continue;
112
+ imports.add(source);
113
+ routed = routed.replaceAll(source, supportModule);
114
+ }
115
+ return routed;
116
+ }
117
+ function routeComponentInvocations(module, node, invoked, nodes) {
118
+ if (invoked.size === 0)
119
+ return module;
120
+ if (module.includes("manageComponentLifecycle")) {
121
+ diagnostic("HN003", "A component using the general runtime cannot yet contain compiled component invocations.", node.url);
122
+ }
123
+ const imports = [];
124
+ let routed = module;
125
+ for (const [tag, url] of invoked) {
126
+ const target = nodes.get(url);
127
+ const factory = `create${target.definition.contract.name}`;
128
+ imports.push(`import { ${factory} } from ${JSON.stringify(componentId(url))};`);
129
+ const creation = `document.createElement(${JSON.stringify(tag)})`;
130
+ const variables = [];
131
+ routed = routed.split("\n").map((line) => {
132
+ const match = line.match(new RegExp(`^(\\s*)const ([A-Za-z_$][A-Za-z0-9_$]*) = ${escapePattern(creation)};$`));
133
+ if (match === null)
134
+ return line;
135
+ variables.push(match[2]);
136
+ return `${match[1]}const ${match[2]} = ${factory}();`;
137
+ }).join("\n");
138
+ if (variables.length === 0) {
139
+ diagnostic("HN013", `The native generator did not expose compiled invocation <${tag}>.`, node.url);
140
+ }
141
+ for (const variable of variables) {
142
+ // A delegated root carries every owner's token.
143
+ const tag = JSON.stringify(node.definition.contract.tag);
144
+ routed = routed.replace(`${variable}.setAttribute("data-component", ${tag});`, `${variable}.setAttribute("data-component", [${variable}.getAttribute("data-component"), ${tag}].filter(Boolean).join(" "));`);
145
+ }
146
+ }
147
+ return `${imports.join("\n")}\n${routed}`;
148
+ }
149
+ function visitTemplate(node, capabilities) {
150
+ if (node.kind === "slot") {
151
+ capabilities.add(node.name === undefined ? "default-slot" : "named-slots");
152
+ if (node.nameExpression !== undefined)
153
+ capabilities.add("dynamic-slots");
154
+ for (const child of node.fallback ?? [])
155
+ visitTemplate(child, capabilities);
156
+ return;
157
+ }
158
+ if (node.kind === "text")
159
+ return;
160
+ if (node.flow !== undefined)
161
+ capabilities.add(node.flow.kind === "each" ? "keyed-lists" : "structural-flow");
162
+ if (node.name.includes("-"))
163
+ capabilities.add("component-invocations");
164
+ if ((node.events?.length ?? 0) > 0)
165
+ capabilities.add("event-handlers");
166
+ if (node.ref !== undefined)
167
+ capabilities.add("refs");
168
+ for (const attribute of node.attributes) {
169
+ if (attribute.kind === "literal")
170
+ continue;
171
+ capabilities.add(attribute.kind === "directive" ? attribute.name : "bindings");
172
+ if (attribute.kind === "attribute" && attribute.twoWay === true)
173
+ capabilities.add("two-way-bindings");
174
+ }
175
+ for (const child of node.children)
176
+ visitTemplate(child, capabilities);
177
+ }
178
+ function componentCapabilities(definition) {
179
+ const capabilities = new Set(["native-markup"]);
180
+ if (Object.keys(definition.contract.props).length > 0)
181
+ capabilities.add("props");
182
+ if (definition.css !== "")
183
+ capabilities.add("scoped-styles");
184
+ if (definition.controller !== undefined)
185
+ capabilities.add("controllers");
186
+ for (const declaration of definition.declarations ?? [])
187
+ capabilities.add(declaration.kind);
188
+ visitTemplate(definition.template, capabilities);
189
+ return Object.freeze([...capabilities].sort());
190
+ }
191
+ function displayPath(root, url) {
192
+ const path = fileURLToPath(url);
193
+ return relative(root, path).split(sep).join("/");
194
+ }
195
+ async function compileGraph(options) {
196
+ if (options.entries.length === 0)
197
+ throw new Error("HTML Next requires at least one component entry.");
198
+ const root = resolve(options.root ?? process.cwd());
199
+ const delivery = options.mode ?? "application";
200
+ if (delivery !== "application" && delivery !== "library") {
201
+ diagnostic("HN012", `Unknown native build mode \`${String(delivery)}\`.`);
202
+ }
203
+ const entryURLs = options.entries.map((entry) => pathToFileURL(resolve(root, entry)).href);
204
+ if (new Set(entryURLs).size !== entryURLs.length) {
205
+ diagnostic("HN004", "A component entry may be configured only once.");
206
+ }
207
+ const graph = await loadNodeComponents(entryURLs, { baseURL: pathToFileURL(`${root}${sep}`).href });
208
+ const components = new Map();
209
+ const publicComponents = new Map();
210
+ const styles = new Map();
211
+ const manifestComponents = [];
212
+ const allCapabilities = new Set();
213
+ const supportImports = new Set();
214
+ const dynamicBoundaries = new Map();
215
+ const generatedNames = new Map();
216
+ for (const node of graph.nodes.values()) {
217
+ const name = node.definition.contract.name;
218
+ const prior = generatedNames.get(name);
219
+ if (prior !== undefined && prior !== node.url) {
220
+ diagnostic("HN010", `Generated factory name \`${name}\` collides with ${prior}.`, node.url);
221
+ }
222
+ generatedNames.set(name, node.url);
223
+ }
224
+ for (const boundary of options.dynamicBoundaries ?? []) {
225
+ if (!boundary.tag.includes("-")) {
226
+ diagnostic("HN005", `Dynamic boundary tag \`${boundary.tag}\` is not a custom-element name.`);
227
+ }
228
+ if (dynamicBoundaries.has(boundary.tag)) {
229
+ diagnostic("HN006", `Dynamic boundary <${boundary.tag}> is configured more than once.`);
230
+ }
231
+ if (graph.tags.has(boundary.tag)) {
232
+ diagnostic("HN007", `Dynamic boundary <${boundary.tag}> is also present in the static component graph.`);
233
+ }
234
+ dynamicBoundaries.set(boundary.tag, Object.freeze({ ...boundary }));
235
+ }
236
+ const invocations = collectInvocationEdges(graph.nodes, graph.tags, dynamicBoundaries);
237
+ for (const node of [...graph.nodes.values()].sort((left, right) => left.url.localeCompare(right.url))) {
238
+ const definition = node.controller === undefined
239
+ ? node.definition
240
+ : Object.freeze({ ...node.definition, controller: fileURLToPath(node.controller.url) });
241
+ const artifact = generateComponent(definition)
242
+ .find((candidate) => candidate.path === `vanilla/${definition.contract.name}.js`);
243
+ if (artifact === undefined)
244
+ throw new Error(`No native module was generated for ${definition.contract.tag}.`);
245
+ const encodedURL = encodeURIComponent(node.url);
246
+ const styleId = `${stylePrefix}${encodedURL}.css`;
247
+ let module = artifact.content.replace(`../styles/${definition.contract.tag}.css`, styleId);
248
+ module = routeComponentInvocations(module, node, invocations.edges.get(node.url) ?? new Map(), graph.nodes);
249
+ module = routeSupportImports(module, supportImports);
250
+ components.set(resolvedComponentId(node.url), module);
251
+ styles.set(`${resolvedStylePrefix}${encodedURL}.css`, definition.css);
252
+ const capabilities = componentCapabilities(definition);
253
+ for (const capability of capabilities)
254
+ allCapabilities.add(capability);
255
+ manifestComponents.push(Object.freeze({
256
+ name: definition.contract.name,
257
+ tag: definition.contract.tag,
258
+ source: displayPath(root, node.url),
259
+ dependencies: Object.freeze(node.dependencies.map((url) => displayPath(root, url))),
260
+ capabilities,
261
+ }));
262
+ }
263
+ const publicEntries = graph.roots.map((url) => {
264
+ const node = graph.nodes.get(url);
265
+ return Object.freeze({
266
+ name: node.definition.contract.name,
267
+ tag: node.definition.contract.tag,
268
+ source: displayPath(root, url),
269
+ module: delivery === "library" ? componentModule(node.definition.contract.tag) : componentsModule,
270
+ });
271
+ });
272
+ for (const entry of publicEntries) {
273
+ const url = graph.tags.get(entry.tag);
274
+ publicComponents.set(publicComponentId(entry.tag), `export { create${entry.name} } from ${JSON.stringify(componentId(url))};\n`);
275
+ }
276
+ const entry = publicEntries.map((item) => `export { create${item.name} } from ${JSON.stringify(delivery === "library" ? componentModule(item.tag) : componentId(graph.tags.get(item.tag)))};`).join("\n") + "\n";
277
+ const dynamicManifest = [...dynamicBoundaries.values()].sort((left, right) => left.tag.localeCompare(right.tag))
278
+ .map((boundary) => Object.freeze({
279
+ ...boundary,
280
+ usedBy: Object.freeze([...(invocations.dynamicUses.get(boundary.tag) ?? [])]
281
+ .map((url) => displayPath(root, url))
282
+ .sort()),
283
+ }));
284
+ const sortedSupportImports = Object.freeze([...supportImports].sort());
285
+ const sortedCapabilities = Object.freeze([...allCapabilities].sort());
286
+ return Object.freeze({
287
+ entry,
288
+ components,
289
+ publicComponents,
290
+ styles,
291
+ support: supportSource(supportImports),
292
+ sourceFiles: Object.freeze([...graph.nodes.keys()].map((url) => fileURLToPath(url))),
293
+ manifest: Object.freeze({
294
+ mode: "native-application-or-library-build",
295
+ delivery,
296
+ entries: Object.freeze(entryURLs.map((url) => displayPath(root, url))),
297
+ publicEntries: Object.freeze(publicEntries),
298
+ components: Object.freeze(manifestComponents),
299
+ capabilities: sortedCapabilities,
300
+ supportImports: sortedSupportImports,
301
+ support: Object.freeze({
302
+ module: supportModule,
303
+ imports: sortedSupportImports,
304
+ capabilities: sortedCapabilities,
305
+ }),
306
+ dynamicBoundaries: Object.freeze(dynamicManifest),
307
+ }),
308
+ });
309
+ }
310
+ export const htmlNext = createUnplugin((options) => {
311
+ let compiled;
312
+ const graph = () => compiled ??= compileGraph(options);
313
+ return {
314
+ name: "html-next",
315
+ enforce: "pre",
316
+ async buildStart() {
317
+ compiled = compileGraph(options);
318
+ const current = await compiled;
319
+ for (const file of current.sourceFiles)
320
+ this.addWatchFile(file);
321
+ },
322
+ resolveId(id) {
323
+ if (id === componentsModule)
324
+ return resolvedComponentsModule;
325
+ if (id === supportModule)
326
+ return resolvedSupportModule;
327
+ if (id.startsWith(publicComponentPrefix)) {
328
+ return publicComponentId(decodeURIComponent(id.slice(publicComponentPrefix.length)));
329
+ }
330
+ if (id.startsWith(componentPrefix))
331
+ return `\0${id}`;
332
+ if (id.startsWith(stylePrefix))
333
+ return `\0${id}`;
334
+ return null;
335
+ },
336
+ load(id) {
337
+ if (id !== resolvedComponentsModule &&
338
+ id !== resolvedSupportModule &&
339
+ !id.startsWith(resolvedPublicComponentPrefix) &&
340
+ !id.startsWith(resolvedComponentPrefix) &&
341
+ !id.startsWith(resolvedStylePrefix))
342
+ return null;
343
+ return graph().then((current) => {
344
+ if (id === resolvedComponentsModule)
345
+ return current.entry;
346
+ if (id === resolvedSupportModule)
347
+ return current.support;
348
+ if (id.startsWith(resolvedPublicComponentPrefix)) {
349
+ if (current.manifest.delivery !== "library") {
350
+ diagnostic("HN008", "Stable public component modules are available only in library mode.");
351
+ }
352
+ const publicComponent = current.publicComponents.get(id);
353
+ if (publicComponent === undefined) {
354
+ diagnostic("HN011", `No configured public library entry declares <${decodeURIComponent(id.slice(resolvedPublicComponentPrefix.length))}>.`);
355
+ }
356
+ return publicComponent;
357
+ }
358
+ return current.components.get(id) ?? current.styles.get(id) ?? null;
359
+ });
360
+ },
361
+ async generateBundle() {
362
+ const fileName = options.manifestFile === undefined ? "html-next.manifest.json" : options.manifestFile;
363
+ if (fileName === false)
364
+ return;
365
+ const current = await graph();
366
+ this.emitFile({
367
+ type: "asset",
368
+ fileName,
369
+ source: `${JSON.stringify(current.manifest, null, 2)}\n`,
370
+ });
371
+ },
372
+ };
373
+ });
374
+ export default htmlNext;
375
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAExD,OAAO,EACL,iBAAiB,EACjB,mBAAmB,EACnB,kBAAkB,GAKnB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAE1C,MAAM,CAAC,MAAM,gBAAgB,GAAG,8BAA8B,CAAC;AAC/D,MAAM,CAAC,MAAM,aAAa,GAAG,2BAA2B,CAAC;AACzD,MAAM,wBAAwB,GAAG,wBAAwB,CAAC;AAC1D,MAAM,qBAAqB,GAAG,qBAAqB,CAAC;AACpD,MAAM,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,CAAC"}
package/dist/vite.d.ts ADDED
@@ -0,0 +1,3 @@
1
+ export declare const htmlNextVite: (options: import("./index.js").HtmlNextPluginOptions) => import("unplugin").VitePlugin<any>[] | import("unplugin").VitePlugin<any>;
2
+ export default htmlNextVite;
3
+ //# sourceMappingURL=vite.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vite.d.ts","sourceRoot":"","sources":["../src/vite.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,YAAY,oIAAgB,CAAC;eAE3B,YAAY"}
package/dist/vite.js ADDED
@@ -0,0 +1,4 @@
1
+ import { htmlNext } from "./index.js";
2
+ export const htmlNextVite = htmlNext.vite;
3
+ export default htmlNextVite;
4
+ //# sourceMappingURL=vite.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vite.js","sourceRoot":"","sources":["../src/vite.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEtC,MAAM,CAAC,MAAM,YAAY,GAAG,QAAQ,CAAC,IAAI,CAAC;AAE1C,eAAe,YAAY,CAAC"}
package/package.json ADDED
@@ -0,0 +1,50 @@
1
+ {
2
+ "name": "@nextwebwg/html-next-unplugin",
3
+ "version": "1.0.0-alpha.0",
4
+ "description": "unplugin and Vite build pipeline for Declarative HTML Components.",
5
+ "license": "MIT",
6
+ "type": "module",
7
+ "sideEffects": false,
8
+ "exports": {
9
+ ".": {
10
+ "types": "./dist/index.d.ts",
11
+ "import": "./dist/index.js"
12
+ },
13
+ "./vite": {
14
+ "types": "./dist/vite.d.ts",
15
+ "import": "./dist/vite.js"
16
+ }
17
+ },
18
+ "files": [
19
+ "dist"
20
+ ],
21
+ "engines": {
22
+ "node": ">=22.13 <23 || >=24 <25"
23
+ },
24
+ "dependencies": {
25
+ "@nextwebwg/html-next": "1.0.0-alpha.4",
26
+ "unplugin": "3.3.0"
27
+ },
28
+ "devDependencies": {
29
+ "@types/node": "25.9.5",
30
+ "vite": "8.3.0",
31
+ "vitest": "5.0.0",
32
+ "typescript": "7.0.2"
33
+ },
34
+ "publishConfig": {
35
+ "access": "public",
36
+ "tag": "next",
37
+ "registry": "https://registry.npmjs.org/"
38
+ },
39
+ "repository": {
40
+ "type": "git",
41
+ "url": "git+https://github.com/nextwebwg/html-next.git",
42
+ "directory": "packages/html-next-unplugin"
43
+ },
44
+ "scripts": {
45
+ "build": "pnpm clean && tsc -p tsconfig.build.json",
46
+ "clean": "node --input-type=module --eval \"import { rmSync } from 'node:fs'; rmSync('dist', { recursive: true, force: true });\"",
47
+ "test": "vitest run --config vitest.config.ts",
48
+ "typecheck": "tsc -p tsconfig.json"
49
+ }
50
+ }