@wire-dsl/cli 0.1.6 → 0.2.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/dist/{chunk-MVVC2C2L.js → chunk-LCHD2B6S.js} +2 -1
- package/dist/cli.cjs +12 -11
- package/dist/cli.js +1 -1
- package/dist/index.cjs +12 -11
- package/dist/index.js +1 -1
- package/package.json +8 -7
|
@@ -5,7 +5,8 @@ import { program } from "commander";
|
|
|
5
5
|
import { readFile, mkdir, stat } from "fs/promises";
|
|
6
6
|
import path from "path";
|
|
7
7
|
import chokidar from "chokidar";
|
|
8
|
-
import { LayoutEngine, SVGRenderer, generateIR, parseWireDSL
|
|
8
|
+
import { LayoutEngine, SVGRenderer, generateIR, parseWireDSL } from "@wire-dsl/engine";
|
|
9
|
+
import { exportSVG, exportPNG, exportMultipagePDF } from "@wire-dsl/exporters";
|
|
9
10
|
var modules = {};
|
|
10
11
|
async function loadDependencies() {
|
|
11
12
|
if (!modules.chalk) {
|
package/dist/cli.cjs
CHANGED
|
@@ -30,7 +30,8 @@ var import_commander = require("commander");
|
|
|
30
30
|
var import_promises = require("fs/promises");
|
|
31
31
|
var import_path = __toESM(require("path"), 1);
|
|
32
32
|
var import_chokidar = __toESM(require("chokidar"), 1);
|
|
33
|
-
var
|
|
33
|
+
var import_engine = require("@wire-dsl/engine");
|
|
34
|
+
var import_exporters = require("@wire-dsl/exporters");
|
|
34
35
|
var modules = {};
|
|
35
36
|
async function loadDependencies() {
|
|
36
37
|
if (!modules.chalk) {
|
|
@@ -91,9 +92,9 @@ var renderCommand = async (input, options = {}) => {
|
|
|
91
92
|
const spinner = ora(`Rendering ${input}`).start();
|
|
92
93
|
try {
|
|
93
94
|
const source = await (0, import_promises.readFile)(resolvedInputPath, "utf8");
|
|
94
|
-
const ast = (0,
|
|
95
|
-
const ir = (0,
|
|
96
|
-
const layout = new
|
|
95
|
+
const ast = (0, import_engine.parseWireDSL)(source);
|
|
96
|
+
const ir = (0, import_engine.generateIR)(ast);
|
|
97
|
+
const layout = new import_engine.LayoutEngine(ir).calculate();
|
|
97
98
|
const baseViewport = ir.project.screens[0]?.viewport ?? { width: 1280, height: 720 };
|
|
98
99
|
let screensToRender = ir.project.screens;
|
|
99
100
|
if (options.screen) {
|
|
@@ -116,7 +117,7 @@ var renderCommand = async (input, options = {}) => {
|
|
|
116
117
|
const viewport = screen.viewport ?? baseViewport;
|
|
117
118
|
const width = options.width ?? viewport.width;
|
|
118
119
|
const height = options.height ?? viewport.height;
|
|
119
|
-
const renderer = new
|
|
120
|
+
const renderer = new import_engine.SVGRenderer(ir, layout, {
|
|
120
121
|
width,
|
|
121
122
|
height,
|
|
122
123
|
theme: options.theme ?? "light",
|
|
@@ -144,7 +145,7 @@ var renderCommand = async (input, options = {}) => {
|
|
|
144
145
|
} else if (!pdfPath.endsWith(".pdf")) {
|
|
145
146
|
pdfPath += ".pdf";
|
|
146
147
|
}
|
|
147
|
-
await (0,
|
|
148
|
+
await (0, import_exporters.exportMultipagePDF)(renderedScreens, pdfPath);
|
|
148
149
|
renderedFiles.push(pdfPath);
|
|
149
150
|
spinner.succeed(
|
|
150
151
|
`PDF written to ${chalk3.cyan(pdfPath)} (${renderedScreens.length} page${renderedScreens.length > 1 ? "s" : ""})`
|
|
@@ -161,7 +162,7 @@ var renderCommand = async (input, options = {}) => {
|
|
|
161
162
|
const sanitizedName = sanitizeScreenName(screen.name);
|
|
162
163
|
const fileName = `${basename}-${sanitizedName}.png`;
|
|
163
164
|
const filePath = import_path.default.join(outputDir, fileName);
|
|
164
|
-
await (0,
|
|
165
|
+
await (0, import_exporters.exportPNG)(screen.svg, filePath, screen.width, screen.height);
|
|
165
166
|
filePaths.push(filePath);
|
|
166
167
|
}
|
|
167
168
|
} else if (multiScreen || isDir) {
|
|
@@ -172,7 +173,7 @@ var renderCommand = async (input, options = {}) => {
|
|
|
172
173
|
const sanitizedName = sanitizeScreenName(screen.name);
|
|
173
174
|
const fileName = multiScreen ? `${basename}-${sanitizedName}.png` : import_path.default.basename(outputPath).endsWith(".png") ? import_path.default.basename(outputPath) : `${basename}.png`;
|
|
174
175
|
const filePath = import_path.default.join(outputDir, fileName);
|
|
175
|
-
await (0,
|
|
176
|
+
await (0, import_exporters.exportPNG)(screen.svg, filePath, screen.width, screen.height);
|
|
176
177
|
filePaths.push(filePath);
|
|
177
178
|
}
|
|
178
179
|
} else {
|
|
@@ -180,7 +181,7 @@ var renderCommand = async (input, options = {}) => {
|
|
|
180
181
|
await (0, import_promises.mkdir)(outputDir, { recursive: true }).catch(() => {
|
|
181
182
|
});
|
|
182
183
|
const screen = renderedScreens[0];
|
|
183
|
-
await (0,
|
|
184
|
+
await (0, import_exporters.exportPNG)(screen.svg, outputPath, screen.width, screen.height);
|
|
184
185
|
filePaths.push(outputPath);
|
|
185
186
|
}
|
|
186
187
|
const renderedFiles2 = filePaths;
|
|
@@ -203,13 +204,13 @@ var renderCommand = async (input, options = {}) => {
|
|
|
203
204
|
const sanitizedName = sanitizeScreenName(screen.name);
|
|
204
205
|
const fileName = `${basename}-${sanitizedName}.svg`;
|
|
205
206
|
const filePath = import_path.default.join(outputDir, fileName);
|
|
206
|
-
await (0,
|
|
207
|
+
await (0, import_exporters.exportSVG)(screen.svg, filePath);
|
|
207
208
|
renderedFiles.push(filePath);
|
|
208
209
|
}
|
|
209
210
|
spinner.succeed(`${renderedFiles.length} SVG files written:`);
|
|
210
211
|
renderedFiles.forEach((file) => console.log(` ${chalk3.cyan(file)}`));
|
|
211
212
|
} else {
|
|
212
|
-
await (0,
|
|
213
|
+
await (0, import_exporters.exportSVG)(renderedScreens[0].svg, outputPath);
|
|
213
214
|
spinner.succeed(`SVG written to ${chalk3.cyan(outputPath)}`);
|
|
214
215
|
}
|
|
215
216
|
}
|
package/dist/cli.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import "./chunk-
|
|
2
|
+
import "./chunk-LCHD2B6S.js";
|
package/dist/index.cjs
CHANGED
|
@@ -43,7 +43,8 @@ var import_commander = require("commander");
|
|
|
43
43
|
var import_promises = require("fs/promises");
|
|
44
44
|
var import_path = __toESM(require("path"), 1);
|
|
45
45
|
var import_chokidar = __toESM(require("chokidar"), 1);
|
|
46
|
-
var
|
|
46
|
+
var import_engine = require("@wire-dsl/engine");
|
|
47
|
+
var import_exporters = require("@wire-dsl/exporters");
|
|
47
48
|
var modules = {};
|
|
48
49
|
async function loadDependencies() {
|
|
49
50
|
if (!modules.chalk) {
|
|
@@ -104,9 +105,9 @@ var renderCommand = async (input, options = {}) => {
|
|
|
104
105
|
const spinner = ora(`Rendering ${input}`).start();
|
|
105
106
|
try {
|
|
106
107
|
const source = await (0, import_promises.readFile)(resolvedInputPath, "utf8");
|
|
107
|
-
const ast = (0,
|
|
108
|
-
const ir = (0,
|
|
109
|
-
const layout = new
|
|
108
|
+
const ast = (0, import_engine.parseWireDSL)(source);
|
|
109
|
+
const ir = (0, import_engine.generateIR)(ast);
|
|
110
|
+
const layout = new import_engine.LayoutEngine(ir).calculate();
|
|
110
111
|
const baseViewport = ir.project.screens[0]?.viewport ?? { width: 1280, height: 720 };
|
|
111
112
|
let screensToRender = ir.project.screens;
|
|
112
113
|
if (options.screen) {
|
|
@@ -129,7 +130,7 @@ var renderCommand = async (input, options = {}) => {
|
|
|
129
130
|
const viewport = screen.viewport ?? baseViewport;
|
|
130
131
|
const width = options.width ?? viewport.width;
|
|
131
132
|
const height = options.height ?? viewport.height;
|
|
132
|
-
const renderer = new
|
|
133
|
+
const renderer = new import_engine.SVGRenderer(ir, layout, {
|
|
133
134
|
width,
|
|
134
135
|
height,
|
|
135
136
|
theme: options.theme ?? "light",
|
|
@@ -157,7 +158,7 @@ var renderCommand = async (input, options = {}) => {
|
|
|
157
158
|
} else if (!pdfPath.endsWith(".pdf")) {
|
|
158
159
|
pdfPath += ".pdf";
|
|
159
160
|
}
|
|
160
|
-
await (0,
|
|
161
|
+
await (0, import_exporters.exportMultipagePDF)(renderedScreens, pdfPath);
|
|
161
162
|
renderedFiles.push(pdfPath);
|
|
162
163
|
spinner.succeed(
|
|
163
164
|
`PDF written to ${chalk3.cyan(pdfPath)} (${renderedScreens.length} page${renderedScreens.length > 1 ? "s" : ""})`
|
|
@@ -174,7 +175,7 @@ var renderCommand = async (input, options = {}) => {
|
|
|
174
175
|
const sanitizedName = sanitizeScreenName(screen.name);
|
|
175
176
|
const fileName = `${basename}-${sanitizedName}.png`;
|
|
176
177
|
const filePath = import_path.default.join(outputDir, fileName);
|
|
177
|
-
await (0,
|
|
178
|
+
await (0, import_exporters.exportPNG)(screen.svg, filePath, screen.width, screen.height);
|
|
178
179
|
filePaths.push(filePath);
|
|
179
180
|
}
|
|
180
181
|
} else if (multiScreen || isDir) {
|
|
@@ -185,7 +186,7 @@ var renderCommand = async (input, options = {}) => {
|
|
|
185
186
|
const sanitizedName = sanitizeScreenName(screen.name);
|
|
186
187
|
const fileName = multiScreen ? `${basename}-${sanitizedName}.png` : import_path.default.basename(outputPath).endsWith(".png") ? import_path.default.basename(outputPath) : `${basename}.png`;
|
|
187
188
|
const filePath = import_path.default.join(outputDir, fileName);
|
|
188
|
-
await (0,
|
|
189
|
+
await (0, import_exporters.exportPNG)(screen.svg, filePath, screen.width, screen.height);
|
|
189
190
|
filePaths.push(filePath);
|
|
190
191
|
}
|
|
191
192
|
} else {
|
|
@@ -193,7 +194,7 @@ var renderCommand = async (input, options = {}) => {
|
|
|
193
194
|
await (0, import_promises.mkdir)(outputDir, { recursive: true }).catch(() => {
|
|
194
195
|
});
|
|
195
196
|
const screen = renderedScreens[0];
|
|
196
|
-
await (0,
|
|
197
|
+
await (0, import_exporters.exportPNG)(screen.svg, outputPath, screen.width, screen.height);
|
|
197
198
|
filePaths.push(outputPath);
|
|
198
199
|
}
|
|
199
200
|
const renderedFiles2 = filePaths;
|
|
@@ -216,13 +217,13 @@ var renderCommand = async (input, options = {}) => {
|
|
|
216
217
|
const sanitizedName = sanitizeScreenName(screen.name);
|
|
217
218
|
const fileName = `${basename}-${sanitizedName}.svg`;
|
|
218
219
|
const filePath = import_path.default.join(outputDir, fileName);
|
|
219
|
-
await (0,
|
|
220
|
+
await (0, import_exporters.exportSVG)(screen.svg, filePath);
|
|
220
221
|
renderedFiles.push(filePath);
|
|
221
222
|
}
|
|
222
223
|
spinner.succeed(`${renderedFiles.length} SVG files written:`);
|
|
223
224
|
renderedFiles.forEach((file) => console.log(` ${chalk3.cyan(file)}`));
|
|
224
225
|
} else {
|
|
225
|
-
await (0,
|
|
226
|
+
await (0, import_exporters.exportSVG)(renderedScreens[0].svg, outputPath);
|
|
226
227
|
spinner.succeed(`SVG written to ${chalk3.cyan(outputPath)}`);
|
|
227
228
|
}
|
|
228
229
|
}
|
package/dist/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wire-dsl/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "WireDSL CLI - Command-line tool for wireframe generation and validation",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -33,18 +33,19 @@
|
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"chokidar": "5.0.0",
|
|
35
35
|
"chalk": "5.6.2",
|
|
36
|
-
"commander": "14.0.
|
|
36
|
+
"commander": "14.0.3",
|
|
37
37
|
"ora": "9.1.0",
|
|
38
|
-
"@wire-dsl/
|
|
38
|
+
"@wire-dsl/engine": "0.0.2",
|
|
39
|
+
"@wire-dsl/exporters": "0.0.2"
|
|
39
40
|
},
|
|
40
41
|
"devDependencies": {
|
|
41
|
-
"@types/node": "25.0
|
|
42
|
-
"@typescript-eslint/eslint-plugin": "8.
|
|
43
|
-
"@typescript-eslint/parser": "8.
|
|
42
|
+
"@types/node": "25.2.0",
|
|
43
|
+
"@typescript-eslint/eslint-plugin": "8.54.0",
|
|
44
|
+
"@typescript-eslint/parser": "8.54.0",
|
|
44
45
|
"eslint": "9.39.2",
|
|
45
46
|
"tsup": "8.5.1",
|
|
46
47
|
"typescript": "5.9.3",
|
|
47
|
-
"vitest": "4.0.
|
|
48
|
+
"vitest": "4.0.18"
|
|
48
49
|
},
|
|
49
50
|
"engines": {
|
|
50
51
|
"node": ">=20.0.0"
|