@nextwebwg/html-next-converter 1.0.0-alpha.10

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,42 @@
1
+ # `@nextwebwg/html-next-converter`
2
+
3
+ Converts a Declarative Components application or library graph into Vue 3.5 single-file components.
4
+ Once converted, HTML Next is gone: each `.vue` file imports Vue, the components it nests, its own
5
+ controller (copied beside it), and only the generated helpers its features need. A component using
6
+ `$html` imports `vue/html.ts`; that helper requires `parse5` as an application dependency for
7
+ deterministic SSR. It parses inert fragments and applies one pinned safe-default allowlist in every
8
+ browser and on the server. It deliberately does not call native `setHTML()`, even where available:
9
+ Firefox currently parses malformed table content differently from Chromium, WebKit, and `parse5`,
10
+ which would make hydration browser-dependent. Props, state, computed values, bindings, structural
11
+ directives, slots, and methods map to Vue's own facilities; declared events remain native
12
+ `CustomEvent`s on the lowered root (Vue emits are reserved for `v-model` updates), and styles become
13
+ `<style scoped>`.
14
+
15
+ Components declaring props import `vue/props.ts`. It applies HTML Next's typed-value rules before
16
+ rendering, including required-prop diagnostics and numeric/boolean attribute conversion; prop-free
17
+ components do not include it.
18
+
19
+ ```sh
20
+ html-next-convert vue components/button.html components/card.html --mode library --out-dir generated
21
+ ```
22
+
23
+ When a `<data src>` URL is relative to its component file, pass `--public-root-url /app/`
24
+ if the conversion root is served at `/app/`. The converter uses that URL to preserve
25
+ definition-relative requests in the browser. Root-relative and absolute request URLs need no
26
+ mapping; a missing mapping for a component-relative URL is a conversion error. The equivalent
27
+ JavaScript option is `publicRootURL`.
28
+
29
+ Application conversion emits an `application.ts` entry for the selected graph roots. Library
30
+ conversion emits an `index.ts` entry whose named exports are independently consumable. Both modes
31
+ emit `html-next.conversion.json`, which records the input entries, output entry, every artifact, and
32
+ the target version.
33
+
34
+ Publish the `.vue` files together with the `.js` and `.d.ts` your Vue build produces from them
35
+ (for example `vite build` with `@vitejs/plugin-vue`, and `vue-tsc --declaration --emitDeclarationOnly`).
36
+
37
+ Invalid definitions retain HTML Next's source-located `HT` diagnostics. A valid construct that Vue
38
+ conversion cannot map produces source-located `HTC001` with the underlying code. Colliding generated
39
+ paths produce `HTC002` before any output is written, and an unsupported target version produces
40
+ `HTC003` before the graph is loaded.
41
+
42
+ React is in development. Svelte is not supported.
package/dist/cli.d.ts ADDED
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ export {};
3
+ //# sourceMappingURL=cli.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":""}
package/dist/cli.js ADDED
@@ -0,0 +1,31 @@
1
+ #!/usr/bin/env node
2
+ import { fileURLToPath } from "node:url";
3
+ import { convertComponents } from "./index.js";
4
+ function usage() {
5
+ return "Usage: html-next-convert vue <component.html...> --mode <application|library> --out-dir <directory> [--public-root-url <url>]";
6
+ }
7
+ async function main(argv) {
8
+ const target = argv[0];
9
+ const modeIndex = argv.indexOf("--mode");
10
+ const mode = argv[modeIndex + 1];
11
+ const outIndex = argv.indexOf("--out-dir");
12
+ const outDirectory = argv[outIndex + 1];
13
+ const publicRootIndex = argv.indexOf("--public-root-url");
14
+ const publicRootURL = publicRootIndex < 0 ? undefined : argv[publicRootIndex + 1];
15
+ if (target === undefined || !["vue"].includes(target) ||
16
+ mode === undefined || !["application", "library"].includes(mode) ||
17
+ modeIndex < 2 || outIndex !== modeIndex + 2 || outDirectory === undefined ||
18
+ (publicRootIndex < 0 ? outIndex !== argv.length - 2 : publicRootIndex !== outIndex + 2 || publicRootIndex !== argv.length - 2 || publicRootURL === undefined))
19
+ throw new Error(usage());
20
+ await convertComponents({ mode, entries: argv.slice(1, modeIndex), target, outDirectory, ...(publicRootURL === undefined ? {} : { publicRootURL }) });
21
+ }
22
+ if (process.argv[1] === fileURLToPath(import.meta.url)) {
23
+ try {
24
+ await main(process.argv.slice(2));
25
+ }
26
+ catch (error) {
27
+ console.error(error instanceof Error ? error.message : String(error));
28
+ process.exitCode = 1;
29
+ }
30
+ }
31
+ //# sourceMappingURL=cli.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,OAAO,EAAE,iBAAiB,EAA8C,MAAM,YAAY,CAAC;AAE3F,SAAS,KAAK;IACZ,OAAO,+HAA+H,CAAC;AACzI,CAAC;AAED,KAAK,UAAU,IAAI,CAAC,IAAuB;IACzC,MAAM,MAAM,GAAG,IAAI,CAAC,CAAC,CAAgC,CAAC;IACtD,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;IACzC,MAAM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AAC,CAAC,CAAC,KAAK,aAAa,CAAC,OAAO,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;IACvD,IAAI,CAAC;QACH,MAAM,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;IACpC,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;QACtE,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;IACvB,CAAC;AACH,CAAC"}
@@ -0,0 +1,78 @@
1
+ export type FrameworkTarget = "vue";
2
+ export type ConversionGraph = "application" | "library";
3
+ interface BaseConvertOptions {
4
+ readonly entries: readonly string[];
5
+ readonly target: FrameworkTarget;
6
+ readonly targetVersion?: string;
7
+ readonly outDirectory: string;
8
+ readonly root?: string;
9
+ /** Browser URL of `root`, required when a data source is relative to its component file. */
10
+ readonly publicRootURL?: string;
11
+ }
12
+ export interface ApplicationConvertOptions extends BaseConvertOptions {
13
+ readonly mode: "application";
14
+ }
15
+ export interface LibraryConvertOptions extends BaseConvertOptions {
16
+ readonly mode: "library";
17
+ }
18
+ export type ConvertOptions = ApplicationConvertOptions | LibraryConvertOptions;
19
+ export interface ConversionEntry {
20
+ readonly source: string;
21
+ readonly tag: string;
22
+ readonly artifact: string;
23
+ }
24
+ export interface ConversionOutput {
25
+ readonly path: string;
26
+ readonly kind: "component" | "controller" | "helper" | "entry" | "inventory";
27
+ readonly source?: string;
28
+ }
29
+ export interface ConversionManifest {
30
+ readonly mode: "framework-conversion";
31
+ readonly target: FrameworkTarget;
32
+ readonly targetVersion: string;
33
+ readonly graph: ConversionGraph;
34
+ readonly entries: readonly ConversionEntry[];
35
+ readonly output: {
36
+ readonly entry: string;
37
+ readonly inventory: "html-next.conversion.json";
38
+ readonly artifacts: readonly ConversionOutput[];
39
+ };
40
+ readonly components: readonly {
41
+ readonly name: string;
42
+ readonly tag: string;
43
+ readonly source: string;
44
+ readonly artifact: string;
45
+ /** The copied controller module the component imports, if it has one. */
46
+ readonly controller?: string;
47
+ }[];
48
+ }
49
+ export declare class FrameworkOutputCollisionError extends Error {
50
+ readonly target: FrameworkTarget;
51
+ readonly artifact: string;
52
+ readonly sources: readonly [string, string];
53
+ readonly code = "HTC002";
54
+ constructor(target: FrameworkTarget, artifact: string, sources: readonly [string, string]);
55
+ }
56
+ export declare class FrameworkDuplicateEntryError extends Error {
57
+ readonly source: string;
58
+ readonly code = "HTC002";
59
+ constructor(source: string);
60
+ }
61
+ export declare class FrameworkTargetVersionError extends Error {
62
+ readonly target: FrameworkTarget;
63
+ readonly requested: string;
64
+ readonly supported: string;
65
+ readonly code = "HTC003";
66
+ constructor(target: FrameworkTarget, requested: string, supported: string);
67
+ }
68
+ export declare class FrameworkConversionError extends Error {
69
+ readonly target: FrameworkTarget;
70
+ readonly source: string;
71
+ readonly tag: string;
72
+ readonly reason?: string | undefined;
73
+ readonly code = "HTC001";
74
+ constructor(target: FrameworkTarget, source: string, tag: string, reason?: string | undefined);
75
+ }
76
+ export declare function convertComponents(options: ConvertOptions): Promise<ConversionManifest>;
77
+ export {};
78
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAsBA,MAAM,MAAM,eAAe,GAAG,KAAK,CAAC;AACpC,MAAM,MAAM,eAAe,GAAG,aAAa,GAAG,SAAS,CAAC;AAMxD,UAAU,kBAAkB;IAC1B,QAAQ,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,CAAC;IACpC,QAAQ,CAAC,MAAM,EAAE,eAAe,CAAC;IACjC,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,CAAC;IAChC,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,C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ACW,MAAM,EAAE,eAAe,EACvB,MAAM,EAAE,MAAM,EACd,GAAG,EAAE,MAAM,EACX,MAAM,CAAC,EAAE,MAAM,YAAA,EAMzB;CACF;AAsFD,wBAAsB,iBAAiB,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAwI5F"}
package/dist/index.js ADDED
@@ -0,0 +1,263 @@
1
+ import { mkdir, writeFile } from "node:fs/promises";
2
+ import { dirname, relative, resolve, sep } from "node:path";
3
+ import { fileURLToPath, pathToFileURL } from "node:url";
4
+ import { addControllerGraph, generateVueComponent, HtmlDiagnosticError, importsVueHost, importsVueHtml, importsVueControl, importsVueProps, loadNodeComponents, vueHostArtifact, vueHtmlArtifact, vueControlArtifact, vuePropsArtifact, } from "@nextwebwg/html-next";
5
+ const targetVersions = {
6
+ vue: "3.5",
7
+ };
8
+ export class FrameworkOutputCollisionError extends Error {
9
+ target;
10
+ artifact;
11
+ sources;
12
+ code = "HTC002";
13
+ constructor(target, artifact, sources) {
14
+ super(`${sources[1]}: HTC002: ${target} output \`${artifact}\` collides with output from ${sources[0]}. Rename one component so each generated artifact has a distinct path.`);
15
+ this.target = target;
16
+ this.artifact = artifact;
17
+ this.sources = sources;
18
+ this.name = "FrameworkOutputCollisionError";
19
+ }
20
+ }
21
+ export class FrameworkDuplicateEntryError extends Error {
22
+ source;
23
+ code = "HTC002";
24
+ constructor(source) {
25
+ super(`${source}: HTC002: component entry is listed more than once.`);
26
+ this.source = source;
27
+ this.name = "FrameworkDuplicateEntryError";
28
+ }
29
+ }
30
+ export class FrameworkTargetVersionError extends Error {
31
+ target;
32
+ requested;
33
+ supported;
34
+ code = "HTC003";
35
+ constructor(target, requested, supported) {
36
+ super(`HTC003: ${target} ${requested} is not supported; this converter targets ${target} ${supported}.`);
37
+ this.target = target;
38
+ this.requested = requested;
39
+ this.supported = supported;
40
+ this.name = "FrameworkTargetVersionError";
41
+ }
42
+ }
43
+ export class FrameworkConversionError extends Error {
44
+ target;
45
+ source;
46
+ tag;
47
+ reason;
48
+ code = "HTC001";
49
+ constructor(target, source, tag, reason) {
50
+ super(`${source}: HTC001: ${target} conversion of <${tag}> failed${reason === undefined ? "" : `: ${reason}`}`);
51
+ this.target = target;
52
+ this.source = source;
53
+ this.tag = tag;
54
+ this.reason = reason;
55
+ this.name = "FrameworkConversionError";
56
+ }
57
+ }
58
+ async function emit(root, artifact) {
59
+ const output = resolve(root, artifact.path);
60
+ if (output !== root && !output.startsWith(`${root}${sep}`)) {
61
+ throw new Error(`Generated artifact escaped the output directory: ${artifact.path}.`);
62
+ }
63
+ await mkdir(dirname(output), { recursive: true });
64
+ await writeFile(output, artifact.content, "utf8");
65
+ }
66
+ function frameworkEntry(mode, target, entries) {
67
+ const exports = [...entries].sort((left, right) => left.artifact.localeCompare(right.artifact)).map((entry) => {
68
+ const artifact = entry.artifact.slice(entry.artifact.lastIndexOf("/") + 1);
69
+ const name = artifact.replace(/\.vue$/, "");
70
+ return `export { default as ${name} } from ${JSON.stringify(`./${artifact}`)};`;
71
+ });
72
+ return {
73
+ path: `${target}/${mode === "application" ? "application.ts" : "index.ts"}`,
74
+ content: `${exports.join("\n")}\n`,
75
+ };
76
+ }
77
+ function componentRelativeDataSource(source) {
78
+ return !source.startsWith("/") && !/^[A-Za-z][A-Za-z0-9+.-]*:/.test(source);
79
+ }
80
+ function browserDefinitionURL(definition, source, publicRootURL, target, tag) {
81
+ const relativeData = definition.declarations?.some((declaration) => declaration.kind === "data" && declaration.source !== undefined && componentRelativeDataSource(declaration.source)) ?? false;
82
+ if (relativeData && publicRootURL === undefined) {
83
+ throw new FrameworkConversionError(target, source, tag, "component-relative <data src> requires publicRootURL, the browser URL corresponding to the conversion root");
84
+ }
85
+ if (publicRootURL === undefined)
86
+ return "";
87
+ if (!publicRootURL.endsWith("/") || !/^(?:\/|https?:\/\/)/.test(publicRootURL) || /[?#]/.test(publicRootURL) || source.startsWith("../")) {
88
+ throw new FrameworkConversionError(target, source, tag, "publicRootURL must be an HTTP(S) or root-relative directory URL, and the component must be inside the conversion root");
89
+ }
90
+ return `${publicRootURL}${source.split("/").map(encodeURIComponent).join("/")}`;
91
+ }
92
+ /** Only graphs with an invocation cycle or a path past 32 nested components need HR008 checks. */
93
+ function needsNestedDepthGuard(graph) {
94
+ const edges = new Map();
95
+ for (const node of graph.nodes.values()) {
96
+ const children = new Set();
97
+ const visit = (template) => {
98
+ if (template.kind === "slot") {
99
+ for (const child of template.fallback ?? [])
100
+ visit(child);
101
+ }
102
+ else if (template.kind === "element") {
103
+ if (graph.tags.has(template.name))
104
+ children.add(template.name);
105
+ for (const child of template.children)
106
+ visit(child);
107
+ }
108
+ };
109
+ visit(node.definition.template);
110
+ edges.set(node.definition.contract.tag, children);
111
+ }
112
+ const active = new Set();
113
+ const height = new Map();
114
+ const visit = (tag) => {
115
+ if (active.has(tag))
116
+ return Infinity;
117
+ const known = height.get(tag);
118
+ if (known !== undefined)
119
+ return known;
120
+ active.add(tag);
121
+ let result = 1;
122
+ for (const child of edges.get(tag) ?? [])
123
+ result = Math.max(result, 1 + visit(child));
124
+ active.delete(tag);
125
+ height.set(tag, result);
126
+ return result;
127
+ };
128
+ // An initial root plus 32 nested lowering passes permits 33 component nodes.
129
+ return [...edges.keys()].some((tag) => visit(tag) > 33);
130
+ }
131
+ export async function convertComponents(options) {
132
+ if (options.entries.length === 0)
133
+ throw new Error("Framework conversion requires at least one component entry.");
134
+ const targetVersion = targetVersions[options.target];
135
+ if (options.targetVersion !== undefined && options.targetVersion !== targetVersion) {
136
+ throw new FrameworkTargetVersionError(options.target, options.targetVersion, targetVersion);
137
+ }
138
+ const projectRoot = resolve(options.root ?? process.cwd());
139
+ const outputRoot = resolve(options.outDirectory);
140
+ const entries = options.entries.map((entry) => pathToFileURL(resolve(projectRoot, entry)).href);
141
+ const seenEntries = new Set();
142
+ for (const entry of entries) {
143
+ if (seenEntries.has(entry)) {
144
+ throw new FrameworkDuplicateEntryError(relative(projectRoot, fileURLToPath(entry)).split(sep).join("/"));
145
+ }
146
+ seenEntries.add(entry);
147
+ }
148
+ const graph = await loadNodeComponents(entries, { baseURL: pathToFileURL(`${projectRoot}${sep}`).href });
149
+ const slotsByTag = new Map([...graph.nodes.values()].map((node) => [node.definition.contract.tag, node.definition.slots ?? []]));
150
+ const guardNestedDepth = needsNestedDepthGuard(graph);
151
+ const manifestComponents = [];
152
+ const planned = [];
153
+ const claimed = new Map();
154
+ const claim = (artifact, kind, source) => {
155
+ const previous = claimed.get(artifact.path);
156
+ if (previous !== undefined && previous !== source) {
157
+ throw new FrameworkOutputCollisionError(options.target, artifact.path, [previous, source ?? "<generated>"]);
158
+ }
159
+ claimed.set(artifact.path, source ?? "<generated>");
160
+ planned.push({ artifact, kind, ...(source === undefined ? {} : { source }) });
161
+ };
162
+ for (const node of [...graph.nodes.values()].sort((left, right) => left.url.localeCompare(right.url))) {
163
+ const source = relative(projectRoot, fileURLToPath(node.url)).split(sep).join("/");
164
+ const tag = node.definition.contract.tag;
165
+ // The controller and its relative imports are copied beside the component, which imports them.
166
+ const controllerFiles = new Map();
167
+ let controller;
168
+ if (node.controller !== undefined) {
169
+ try {
170
+ controller = await addControllerGraph(node.controller.url, node.trustRoot, `${options.target}/controllers/${tag}`, controllerFiles);
171
+ }
172
+ catch (error) {
173
+ throw new FrameworkConversionError(options.target, source, tag, error instanceof Error ? error.message : String(error));
174
+ }
175
+ }
176
+ const definition = Object.freeze({
177
+ ...node.definition,
178
+ source: Object.freeze({ file: browserDefinitionURL(node.definition, source, options.publicRootURL, options.target, tag) }),
179
+ ...(controller === undefined ? {} : { controller: `./${controller.slice(`${options.target}/`.length)}` }),
180
+ });
181
+ let content;
182
+ try {
183
+ content = generateVueComponent(definition, {
184
+ slotsByTag,
185
+ guardNestedDepth,
186
+ ...(node.definition.controller === undefined ? {} : { controllerSpecifier: node.definition.controller }),
187
+ });
188
+ }
189
+ catch (error) {
190
+ if (error instanceof HtmlDiagnosticError) {
191
+ if (error.diagnostic.code.startsWith("HY")) {
192
+ throw new HtmlDiagnosticError({ ...error.diagnostic, source: error.diagnostic.source ?? node.url });
193
+ }
194
+ throw new FrameworkConversionError(options.target, source, tag, error.message);
195
+ }
196
+ throw error;
197
+ }
198
+ if (/@nextwebwg\//.test(content))
199
+ throw new FrameworkConversionError(options.target, source, tag);
200
+ const component = { path: `${options.target}/${node.definition.contract.name}.vue`, content };
201
+ claim(component, "component", source);
202
+ for (const file of controllerFiles.values())
203
+ claim(file, "controller", source);
204
+ manifestComponents.push(Object.freeze({
205
+ name: node.definition.contract.name,
206
+ tag,
207
+ source,
208
+ artifact: component.path,
209
+ ...(controller === undefined ? {} : { controller }),
210
+ }));
211
+ }
212
+ if (planned.some(({ artifact }) => importsVueHost(artifact.content))) {
213
+ claim(vueHostArtifact(), "helper");
214
+ }
215
+ if (planned.some(({ artifact }) => importsVueHtml(artifact.content))) {
216
+ claim(vueHtmlArtifact(), "helper");
217
+ }
218
+ if (planned.some(({ artifact }) => importsVueControl(artifact.content))) {
219
+ claim(vueControlArtifact(), "helper");
220
+ }
221
+ if (planned.some(({ artifact }) => importsVueProps(artifact.content))) {
222
+ claim(vuePropsArtifact(), "helper");
223
+ }
224
+ const conversionEntries = entries.map((url) => {
225
+ const node = graph.nodes.get(url);
226
+ if (node === undefined)
227
+ throw new Error(`Framework conversion did not resolve entry ${url}.`);
228
+ const component = manifestComponents.find(({ source }) => source === relative(projectRoot, fileURLToPath(node.url)).split(sep).join("/"));
229
+ return {
230
+ source: component.source,
231
+ tag: component.tag,
232
+ artifact: component.artifact,
233
+ };
234
+ });
235
+ const entry = frameworkEntry(options.mode, options.target, conversionEntries);
236
+ claim(entry, "entry");
237
+ const inventory = "html-next.conversion.json";
238
+ const outputArtifacts = planned.map(({ artifact, kind, source }) => ({
239
+ path: artifact.path,
240
+ kind,
241
+ ...(source === undefined ? {} : { source }),
242
+ }));
243
+ outputArtifacts.push({ path: inventory, kind: "inventory" });
244
+ const manifest = Object.freeze({
245
+ mode: "framework-conversion",
246
+ target: options.target,
247
+ targetVersion,
248
+ graph: options.mode,
249
+ entries: Object.freeze(conversionEntries),
250
+ output: Object.freeze({
251
+ entry: entry.path,
252
+ inventory,
253
+ artifacts: Object.freeze(outputArtifacts),
254
+ }),
255
+ components: Object.freeze(manifestComponents),
256
+ });
257
+ for (const { artifact } of planned)
258
+ await emit(outputRoot, artifact);
259
+ await mkdir(outputRoot, { recursive: true });
260
+ await writeFile(resolve(outputRoot, inventory), `${JSON.stringify(manifest, null, 2)}\n`, "utf8");
261
+ return manifest;
262
+ }
263
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAExD,OAAO,EACL,kBAAkB,EAClB,oBAAoB,EACpB,mBAAmB,EACnB,cAAc,EACd,cAAc,EACd,iBAAiB,EACjB,eAAe,EACf,kBAAkB,EAClB,eAAe,EACf,eAAe,EACf,kBAAkB,EAClB,gBAAgB,GAIjB,MAAM,sBAAsB,CAAC;AAK9B,MAAM,cAAc,GAA8C;IAChE,GAAG,EAAE,KAAK;CACX,CAAC;AAuDF,MAAM,OAAO,6BAA8B,SAAQ,KAAK;IAI3C,MAAM;IACN,QAAQ;IACR,OAAO;IALT,IAAI,GAAG,QAAQ,CAAC;IAEzB,YACW,MAAuB,EACvB,QAAgB,EAChB,OAAkC;QAE3C,KAAK,CACH,GAAG,OAAO,CAAC,CAAC,CAAC,aAAa,MAAM,aAAa,QAAQ,gCAAgC,OAAO,CAAC,CAAC,CAAC,wEAAwE,CACxK,CAAC;sBANO,MAAM;wBACN,QAAQ;uBACR,OAAO;QAKhB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AAC,CAAC;IAC7C,MAAM,SAAS,CACb,OAAO,CAAC,UAAU,EAAE,SAAS,CAAC,EAC9B,GAAG,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,EACxC,MAAM,CACP,CAAC;IACF,OAAO,QAAQ,CAAC;AAClB,CAAC"}
package/package.json ADDED
@@ -0,0 +1,52 @@
1
+ {
2
+ "name": "@nextwebwg/html-next-converter",
3
+ "version": "1.0.0-alpha.10",
4
+ "description": "Vue conversion for Declarative HTML Components.",
5
+ "license": "MIT",
6
+ "type": "module",
7
+ "sideEffects": false,
8
+ "bin": {
9
+ "html-next-convert": "./dist/cli.js"
10
+ },
11
+ "exports": {
12
+ ".": {
13
+ "types": "./dist/index.d.ts",
14
+ "import": "./dist/index.js"
15
+ }
16
+ },
17
+ "files": [
18
+ "dist"
19
+ ],
20
+ "engines": {
21
+ "node": ">=22.13 <23 || >=24 <25"
22
+ },
23
+ "dependencies": {
24
+ "@nextwebwg/html-next": "1.0.0-alpha.10"
25
+ },
26
+ "devDependencies": {
27
+ "@types/node": "25.9.5",
28
+ "@vue/compiler-sfc": "3.5.42",
29
+ "esbuild": "0.28.2",
30
+ "parse5": "8.0.1",
31
+ "playwright": "1.63.0",
32
+ "typescript": "7.0.2",
33
+ "vitest": "5.0.0",
34
+ "vue": "3.5.42"
35
+ },
36
+ "publishConfig": {
37
+ "access": "public",
38
+ "tag": "latest",
39
+ "registry": "https://registry.npmjs.org/"
40
+ },
41
+ "repository": {
42
+ "type": "git",
43
+ "url": "git+https://github.com/nextwebwg/html-next.git",
44
+ "directory": "packages/html-next-converter"
45
+ },
46
+ "scripts": {
47
+ "build": "pnpm clean && tsc -p tsconfig.build.json",
48
+ "clean": "node --input-type=module --eval \"import { rmSync } from 'node:fs'; rmSync('dist', { recursive: true, force: true });\"",
49
+ "test": "vitest run --config vitest.config.ts",
50
+ "typecheck": "tsc -p tsconfig.json"
51
+ }
52
+ }