@open-slide/core 2.0.0-beta.0 → 2.0.0-beta.1
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/build-Bzy-qlGc.js +19 -0
- package/dist/cli/bin.js +201 -21
- package/dist/{dev-BChELmc-.js → dev-MXa5Tod4.js} +36 -10
- package/dist/preview-DEpQcKz3.js +24 -0
- package/dist/vite/index.js +1 -1
- package/package.json +1 -1
- package/dist/build-CfAxF6Dm.js +0 -14
- package/dist/preview-CcCQa268.js +0 -14
- package/dist/{config-C_VI2EpT.js → config-nbSvY7z_.js} +2 -2
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { r as printHeader, t as createCliLogger } from "./cli/bin.js";
|
|
2
|
+
import { t as createViteConfig } from "./config-nbSvY7z_.js";
|
|
3
|
+
import path from "node:path";
|
|
4
|
+
import { build as build$1, mergeConfig } from "vite";
|
|
5
|
+
//#region src/cli/build.ts
|
|
6
|
+
async function build(opts = {}) {
|
|
7
|
+
printHeader("building for production");
|
|
8
|
+
const base = await createViteConfig({
|
|
9
|
+
userCwd: process.cwd(),
|
|
10
|
+
mode: "build"
|
|
11
|
+
});
|
|
12
|
+
const config = mergeConfig(base, {
|
|
13
|
+
customLogger: createCliLogger(),
|
|
14
|
+
build: { ...opts.outDir !== void 0 ? { outDir: path.resolve(process.cwd(), opts.outDir) } : {} }
|
|
15
|
+
});
|
|
16
|
+
await build$1(config);
|
|
17
|
+
}
|
|
18
|
+
//#endregion
|
|
19
|
+
export { build };
|
package/dist/cli/bin.js
CHANGED
|
@@ -1,12 +1,66 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import chalk from "chalk";
|
|
3
|
-
import { cp, lstat, mkdir, readFile, readdir, readlink, rm, symlink } from "node:fs/promises";
|
|
4
2
|
import path from "node:path";
|
|
5
3
|
import * as readline from "node:readline/promises";
|
|
6
4
|
import { fileURLToPath } from "node:url";
|
|
5
|
+
import chalk from "chalk";
|
|
7
6
|
import { Command, Option } from "commander";
|
|
7
|
+
import { existsSync, readFileSync, realpathSync } from "node:fs";
|
|
8
8
|
import { createHash } from "node:crypto";
|
|
9
|
-
import {
|
|
9
|
+
import { cp, lstat, mkdir, readFile, readdir, readlink, rm, symlink } from "node:fs/promises";
|
|
10
|
+
import * as readline$1 from "node:readline";
|
|
11
|
+
import { stripVTControlCharacters } from "node:util";
|
|
12
|
+
//#region src/cli/preflight.ts
|
|
13
|
+
const MIGRATION_URL = "https://open-slide.dev/docs/migrate-to-v2";
|
|
14
|
+
const VITE_CONSUMERS = ["@vitejs/plugin-react", "@tailwindcss/vite"];
|
|
15
|
+
function locatePackage(name, fromDir) {
|
|
16
|
+
let dir = fromDir;
|
|
17
|
+
while (true) {
|
|
18
|
+
const candidate = path.join(dir, "node_modules", name);
|
|
19
|
+
const pkgPath = path.join(candidate, "package.json");
|
|
20
|
+
if (existsSync(pkgPath)) {
|
|
21
|
+
let version = "unknown";
|
|
22
|
+
try {
|
|
23
|
+
version = JSON.parse(readFileSync(pkgPath, "utf8")).version ?? version;
|
|
24
|
+
} catch {}
|
|
25
|
+
return {
|
|
26
|
+
dir: realpathSync(candidate),
|
|
27
|
+
version
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
const parent = path.dirname(dir);
|
|
31
|
+
if (parent === dir) return null;
|
|
32
|
+
dir = parent;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
function findViteMismatch(coreDir) {
|
|
36
|
+
const coreVite = locatePackage("vite", coreDir);
|
|
37
|
+
if (!coreVite) return null;
|
|
38
|
+
for (const consumer of VITE_CONSUMERS) {
|
|
39
|
+
const consumerPkg = locatePackage(consumer, coreDir);
|
|
40
|
+
if (!consumerPkg) continue;
|
|
41
|
+
const consumerVite = locatePackage("vite", consumerPkg.dir);
|
|
42
|
+
if (!consumerVite || consumerVite.version === coreVite.version) continue;
|
|
43
|
+
return {
|
|
44
|
+
consumer,
|
|
45
|
+
coreVite,
|
|
46
|
+
consumerVite
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
return null;
|
|
50
|
+
}
|
|
51
|
+
function formatViteMismatch(mismatch, cwd = process.cwd()) {
|
|
52
|
+
const rel = (dir) => path.relative(cwd, dir) || dir;
|
|
53
|
+
return [
|
|
54
|
+
`${mismatch.consumer} resolves vite@${mismatch.consumerVite.version} (${rel(mismatch.consumerVite.dir)}), but @open-slide/core ships vite@${mismatch.coreVite.version} (${rel(mismatch.coreVite.dir)}).`,
|
|
55
|
+
"A `vite` entry in your package.json (v1 workspaces had one) shadows the copy core depends on. Remove it and reinstall.",
|
|
56
|
+
`Migration guide: ${MIGRATION_URL}`
|
|
57
|
+
].join("\n");
|
|
58
|
+
}
|
|
59
|
+
function assertViteResolvesToCore() {
|
|
60
|
+
const mismatch = findViteMismatch(realpathSync(path.dirname(fileURLToPath(import.meta.url))));
|
|
61
|
+
if (mismatch) throw new Error(formatViteMismatch(mismatch));
|
|
62
|
+
}
|
|
63
|
+
//#endregion
|
|
10
64
|
//#region src/cli/sync.ts
|
|
11
65
|
async function detectSkillsDrift(skillsDir) {
|
|
12
66
|
if (!existsSync(skillsDir)) return [];
|
|
@@ -136,13 +190,133 @@ function printSummary(results, dryRun) {
|
|
|
136
190
|
process.stdout.write(chalk.dim(`\n${counts.added} added, ${counts.updated} updated, ${counts.unchanged} unchanged.\n`));
|
|
137
191
|
}
|
|
138
192
|
//#endregion
|
|
139
|
-
//#region src/cli/
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
193
|
+
//#region src/cli/ui.ts
|
|
194
|
+
const UNICODE = process.platform !== "win32" || Boolean(process.env.WT_SESSION) || process.env.TERM_PROGRAM === "vscode";
|
|
195
|
+
const glyph = {
|
|
196
|
+
bar: UNICODE ? "┃" : "|",
|
|
197
|
+
warn: UNICODE ? "▲" : "!",
|
|
198
|
+
cross: UNICODE ? "✖" : "x"
|
|
199
|
+
};
|
|
200
|
+
function readVersion() {
|
|
201
|
+
let dir = path.dirname(fileURLToPath(import.meta.url));
|
|
202
|
+
while (dir !== path.dirname(dir)) {
|
|
203
|
+
const pkgPath = path.join(dir, "package.json");
|
|
204
|
+
if (existsSync(pkgPath)) {
|
|
205
|
+
const pkg = JSON.parse(readFileSync(pkgPath, "utf8"));
|
|
206
|
+
if (pkg.name === "@open-slide/core" && pkg.version) return pkg.version;
|
|
207
|
+
}
|
|
208
|
+
dir = path.dirname(dir);
|
|
209
|
+
}
|
|
210
|
+
return "0.0.0";
|
|
211
|
+
}
|
|
212
|
+
function brand() {
|
|
213
|
+
return chalk.inverse.bold(" open-slide ");
|
|
214
|
+
}
|
|
215
|
+
function printHeader(status) {
|
|
216
|
+
const parts = [brand(), chalk.dim(`v${readVersion()}`)];
|
|
217
|
+
if (status) parts.push(chalk.dim(status));
|
|
218
|
+
process.stdout.write(`\n ${parts.join(" ")}\n\n`);
|
|
145
219
|
}
|
|
220
|
+
function startupDuration() {
|
|
221
|
+
return `ready in ${Math.round(process.uptime() * 1e3)} ms`;
|
|
222
|
+
}
|
|
223
|
+
function printUrls(urls, host) {
|
|
224
|
+
if (!urls) return;
|
|
225
|
+
const rows = [];
|
|
226
|
+
for (const url of urls.local) rows.push(urlRow("Local", chalk.cyan(url)));
|
|
227
|
+
urls.network.forEach((url, index) => {
|
|
228
|
+
const iface = urls.networkInterfaceNames?.[index];
|
|
229
|
+
rows.push(urlRow("Network", chalk.cyan(url) + (iface ? ` ${chalk.dim(iface)}` : "")));
|
|
230
|
+
});
|
|
231
|
+
if (urls.network.length === 0 && host === void 0) rows.push(urlRow("Network", chalk.dim("use --host to expose")));
|
|
232
|
+
process.stdout.write(`${rows.join("\n")}\n`);
|
|
233
|
+
}
|
|
234
|
+
function urlRow(label, value) {
|
|
235
|
+
return ` ${chalk.dim(glyph.bar)} ${chalk.bold(label.padEnd(8))} ${value}`;
|
|
236
|
+
}
|
|
237
|
+
function shortcutsEnabled() {
|
|
238
|
+
return Boolean(process.stdin.isTTY) && !process.env.CI;
|
|
239
|
+
}
|
|
240
|
+
function printShortcutsHint() {
|
|
241
|
+
process.stdout.write(`\n ${chalk.dim("press")} ${chalk.bold("h + enter")} ${chalk.dim("for shortcuts")}\n`);
|
|
242
|
+
}
|
|
243
|
+
function formatError(message) {
|
|
244
|
+
return `\n ${chalk.red(glyph.cross)} ${message}\n`;
|
|
245
|
+
}
|
|
246
|
+
const DROPPED = [/^vite v\d+\.\d+\.\d+ building /];
|
|
247
|
+
const REWRITES = [
|
|
248
|
+
[/hmr update /, "updated "],
|
|
249
|
+
[/hmr invalidate /, "invalidated "],
|
|
250
|
+
[/trigger page reload /, "full reload "],
|
|
251
|
+
[/page reload/, "full reload"],
|
|
252
|
+
[/server restarted\./, "server restarted"],
|
|
253
|
+
[/optimized dependencies changed\. reloading/, "dependencies changed, reloading"],
|
|
254
|
+
[/Re-optimizing dependencies because vite config has changed/, "config changed, re-bundling"],
|
|
255
|
+
[/Re-optimizing dependencies because lockfile has changed/, "lockfile changed, re-bundling"],
|
|
256
|
+
[/Forced re-optimization of dependencies/, "re-bundling dependencies"],
|
|
257
|
+
[/\[plugin builtin:vite-[a-z-]+\] ?\n?/, ""],
|
|
258
|
+
[/\[vite\] ?/g, ""]
|
|
259
|
+
];
|
|
260
|
+
function rewriteViteMessage(msg) {
|
|
261
|
+
const plain = stripVTControlCharacters(msg);
|
|
262
|
+
if (DROPPED.some((re) => re.test(plain))) return null;
|
|
263
|
+
let out = msg;
|
|
264
|
+
for (const [re, replacement] of REWRITES) out = out.replace(re, replacement);
|
|
265
|
+
return out;
|
|
266
|
+
}
|
|
267
|
+
function timestamp() {
|
|
268
|
+
return (/* @__PURE__ */ new Date()).toLocaleTimeString([], { hourCycle: "h23" });
|
|
269
|
+
}
|
|
270
|
+
function formatLine(type, text, opts) {
|
|
271
|
+
if (!opts?.timestamp) return text;
|
|
272
|
+
const mark = type === "warn" ? `${chalk.yellow(glyph.warn)} ` : type === "error" ? `${chalk.red(glyph.cross)} ` : "";
|
|
273
|
+
return ` ${chalk.dim(timestamp())} ${mark}${text}`;
|
|
274
|
+
}
|
|
275
|
+
function clearTerminal() {
|
|
276
|
+
if (!process.stdout.isTTY || process.env.CI) return;
|
|
277
|
+
const blank = "\n".repeat(Math.max(process.stdout.rows - 2, 0));
|
|
278
|
+
console.log(blank);
|
|
279
|
+
readline$1.cursorTo(process.stdout, 0, 0);
|
|
280
|
+
readline$1.clearScreenDown(process.stdout);
|
|
281
|
+
}
|
|
282
|
+
function createCliLogger() {
|
|
283
|
+
const loggedErrors = /* @__PURE__ */ new WeakSet();
|
|
284
|
+
const warnedOnce = /* @__PURE__ */ new Set();
|
|
285
|
+
const write = (type, msg, opts) => {
|
|
286
|
+
const text = rewriteViteMessage(msg);
|
|
287
|
+
if (text === null) return;
|
|
288
|
+
console[type === "info" ? "log" : type](formatLine(type, text, opts));
|
|
289
|
+
};
|
|
290
|
+
const logger = {
|
|
291
|
+
hasWarned: false,
|
|
292
|
+
info(msg, opts) {
|
|
293
|
+
write("info", msg, opts);
|
|
294
|
+
},
|
|
295
|
+
warn(msg, opts) {
|
|
296
|
+
logger.hasWarned = true;
|
|
297
|
+
write("warn", msg, opts);
|
|
298
|
+
},
|
|
299
|
+
warnOnce(msg, opts) {
|
|
300
|
+
if (warnedOnce.has(msg)) return;
|
|
301
|
+
warnedOnce.add(msg);
|
|
302
|
+
logger.warn(msg, opts);
|
|
303
|
+
},
|
|
304
|
+
error(msg, opts) {
|
|
305
|
+
logger.hasWarned = true;
|
|
306
|
+
if (opts?.error) loggedErrors.add(opts.error);
|
|
307
|
+
write("error", msg, opts);
|
|
308
|
+
},
|
|
309
|
+
clearScreen() {
|
|
310
|
+
clearTerminal();
|
|
311
|
+
},
|
|
312
|
+
hasErrorLogged(error) {
|
|
313
|
+
return loggedErrors.has(error);
|
|
314
|
+
}
|
|
315
|
+
};
|
|
316
|
+
return logger;
|
|
317
|
+
}
|
|
318
|
+
//#endregion
|
|
319
|
+
//#region src/cli/run.ts
|
|
146
320
|
function parsePort(value) {
|
|
147
321
|
const n = Number(value);
|
|
148
322
|
if (!Number.isInteger(n) || n < 0 || n > 65535) throw new Error(`Invalid port: ${value}`);
|
|
@@ -159,8 +333,10 @@ async function runSkillsDriftCheck(skillsDir) {
|
|
|
159
333
|
const stale = drift.filter((d) => d.status !== "unchanged");
|
|
160
334
|
if (stale.length === 0) return;
|
|
161
335
|
const names = stale.map((d) => d.name).join(", ");
|
|
162
|
-
|
|
163
|
-
|
|
336
|
+
const interactive = Boolean(process.stdin.isTTY && process.stdout.isTTY);
|
|
337
|
+
const notice = `${chalk.yellow(glyph.warn)} Built-in skills are out of date: ${chalk.bold(names)}`;
|
|
338
|
+
if (!interactive) {
|
|
339
|
+
process.stderr.write(`\n ${notice}\n ${chalk.dim("Run `open-slide sync:skills` to update.")}\n`);
|
|
164
340
|
return;
|
|
165
341
|
}
|
|
166
342
|
const rl = readline.createInterface({
|
|
@@ -168,9 +344,11 @@ async function runSkillsDriftCheck(skillsDir) {
|
|
|
168
344
|
output: process.stdout
|
|
169
345
|
});
|
|
170
346
|
try {
|
|
171
|
-
const answer = (await rl.question(
|
|
172
|
-
if (answer === "" || answer === "y" || answer === "yes")
|
|
173
|
-
|
|
347
|
+
const answer = (await rl.question(`\n ${notice}\n Sync now? ${chalk.dim("(Y/n)")} `)).trim().toLowerCase();
|
|
348
|
+
if (answer === "" || answer === "y" || answer === "yes") {
|
|
349
|
+
process.stdout.write("\n");
|
|
350
|
+
await syncSkills(skillsDir);
|
|
351
|
+
} else process.stdout.write(chalk.dim(" Skipped. Run `open-slide sync:skills` later to update.\n"));
|
|
174
352
|
} finally {
|
|
175
353
|
rl.close();
|
|
176
354
|
}
|
|
@@ -180,20 +358,22 @@ function resolveBuiltinSkillsDir() {
|
|
|
180
358
|
return path.resolve(here, "..", "..", "skills");
|
|
181
359
|
}
|
|
182
360
|
async function run(argv) {
|
|
183
|
-
const version = await readVersion();
|
|
184
361
|
const program = new Command();
|
|
185
|
-
program.name("open-slide").description("Author slides —
|
|
362
|
+
program.name("open-slide").description("Author slides in React — open-slide runs the rest.").version(readVersion(), "-v, --version", "print version").helpOption("-h, --help", "show help").showHelpAfterError(chalk.dim("(run `open-slide --help` for usage)"));
|
|
186
363
|
program.command("dev").description("Start the dev server").addOption(new Option("-p, --port <port>", "port to listen on").argParser(parsePort)).addOption(new Option("--host [host]", "expose on the network (optional host)")).option("--open", "open the browser on start").option("--no-skills-check", "skip the built-in skills drift check").action(async (flags) => {
|
|
187
364
|
if (flags.skillsCheck !== false) await runSkillsDriftCheck(resolveBuiltinSkillsDir());
|
|
188
|
-
|
|
365
|
+
assertViteResolvesToCore();
|
|
366
|
+
const { dev } = await import("../dev-MXa5Tod4.js");
|
|
189
367
|
await dev(flags);
|
|
190
368
|
});
|
|
191
369
|
program.command("build").description("Build a static site").option("--out-dir <dir>", "output directory (defaults to `dist`)").action(async (flags) => {
|
|
192
|
-
|
|
370
|
+
assertViteResolvesToCore();
|
|
371
|
+
const { build } = await import("../build-Bzy-qlGc.js");
|
|
193
372
|
await build(flags);
|
|
194
373
|
});
|
|
195
374
|
program.command("preview").description("Preview the production build").addOption(new Option("-p, --port <port>", "port to listen on").argParser(parsePort)).addOption(new Option("--host [host]", "expose on the network (optional host)")).option("--open", "open the browser on start").action(async (flags) => {
|
|
196
|
-
|
|
375
|
+
assertViteResolvesToCore();
|
|
376
|
+
const { preview } = await import("../preview-DEpQcKz3.js");
|
|
197
377
|
await preview(flags);
|
|
198
378
|
});
|
|
199
379
|
program.command("sync:skills").description("Sync built-in skills from @open-slide/core into this workspace").option("--dry-run", "show what would change without writing").action(async (flags) => {
|
|
@@ -205,8 +385,8 @@ async function run(argv) {
|
|
|
205
385
|
//#region src/cli/bin.ts
|
|
206
386
|
run(process.argv.slice(2)).catch((err) => {
|
|
207
387
|
const message = err instanceof Error ? err.message : String(err);
|
|
208
|
-
process.stderr.write(
|
|
388
|
+
process.stderr.write(formatError(message));
|
|
209
389
|
process.exit(1);
|
|
210
390
|
});
|
|
211
391
|
//#endregion
|
|
212
|
-
export {};
|
|
392
|
+
export { printUrls as a, printShortcutsHint as i, formatError as n, shortcutsEnabled as o, printHeader as r, startupDuration as s, createCliLogger as t };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { n as
|
|
2
|
-
import
|
|
1
|
+
import { a as printUrls, i as printShortcutsHint, n as formatError, o as shortcutsEnabled, r as printHeader, s as startupDuration, t as createCliLogger } from "./cli/bin.js";
|
|
2
|
+
import { n as DEV_SUPERVISED_ENV, t as createViteConfig } from "./config-nbSvY7z_.js";
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
import { existsSync } from "node:fs";
|
|
5
5
|
import { fork } from "node:child_process";
|
|
@@ -14,21 +14,47 @@ async function dev(opts = {}) {
|
|
|
14
14
|
}
|
|
15
15
|
async function startServer(opts) {
|
|
16
16
|
const base = await createViteConfig({ userCwd: process.cwd() });
|
|
17
|
-
const config = mergeConfig(base, {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
17
|
+
const config = mergeConfig(base, {
|
|
18
|
+
customLogger: createCliLogger(),
|
|
19
|
+
server: {
|
|
20
|
+
...opts.port !== void 0 ? { port: opts.port } : {},
|
|
21
|
+
...opts.host !== void 0 ? { host: opts.host } : {},
|
|
22
|
+
...opts.open !== void 0 ? { open: opts.open } : {}
|
|
23
|
+
}
|
|
24
|
+
});
|
|
22
25
|
const server = await createServer(config);
|
|
23
26
|
await server.listen();
|
|
24
|
-
|
|
25
|
-
server.
|
|
27
|
+
printHeader(startupDuration());
|
|
28
|
+
printUrls(server.resolvedUrls, opts.host);
|
|
29
|
+
if (shortcutsEnabled()) {
|
|
30
|
+
printShortcutsHint();
|
|
31
|
+
server.bindCLIShortcuts({ customShortcuts: devShortcuts(opts) });
|
|
32
|
+
}
|
|
26
33
|
const address = server.httpServer?.address();
|
|
27
34
|
if (process.send && address && typeof address === "object") process.send({
|
|
28
35
|
type: "open-slide:listening",
|
|
29
36
|
port: address.port
|
|
30
37
|
});
|
|
31
38
|
}
|
|
39
|
+
function devShortcuts(opts) {
|
|
40
|
+
const showUrls = (server) => {
|
|
41
|
+
console.log("");
|
|
42
|
+
printUrls(server.resolvedUrls, opts.host);
|
|
43
|
+
};
|
|
44
|
+
return [{
|
|
45
|
+
key: "r",
|
|
46
|
+
description: "restart the server",
|
|
47
|
+
async action(server) {
|
|
48
|
+
const before = JSON.stringify(server.resolvedUrls);
|
|
49
|
+
await server.restart();
|
|
50
|
+
if (JSON.stringify(server.resolvedUrls) !== before) showUrls(server);
|
|
51
|
+
}
|
|
52
|
+
}, {
|
|
53
|
+
key: "u",
|
|
54
|
+
description: "show server url",
|
|
55
|
+
action: showUrls
|
|
56
|
+
}];
|
|
57
|
+
}
|
|
32
58
|
function supervise(opts) {
|
|
33
59
|
const userCwd = process.cwd();
|
|
34
60
|
let port = opts.port;
|
|
@@ -49,7 +75,7 @@ function supervise(opts) {
|
|
|
49
75
|
}
|
|
50
76
|
});
|
|
51
77
|
child.on("error", (err) => {
|
|
52
|
-
process.stderr.write(
|
|
78
|
+
process.stderr.write(formatError(err.message));
|
|
53
79
|
process.exit(1);
|
|
54
80
|
});
|
|
55
81
|
child.on("message", (message) => {
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { a as printUrls, i as printShortcutsHint, o as shortcutsEnabled, r as printHeader, s as startupDuration, t as createCliLogger } from "./cli/bin.js";
|
|
2
|
+
import { t as createViteConfig } from "./config-nbSvY7z_.js";
|
|
3
|
+
import { mergeConfig, preview as preview$1 } from "vite";
|
|
4
|
+
//#region src/cli/preview.ts
|
|
5
|
+
async function preview(opts = {}) {
|
|
6
|
+
const base = await createViteConfig({ userCwd: process.cwd() });
|
|
7
|
+
const config = mergeConfig(base, {
|
|
8
|
+
customLogger: createCliLogger(),
|
|
9
|
+
preview: {
|
|
10
|
+
...opts.port !== void 0 ? { port: opts.port } : {},
|
|
11
|
+
...opts.host !== void 0 ? { host: opts.host } : {},
|
|
12
|
+
...opts.open !== void 0 ? { open: opts.open } : {}
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
const server = await preview$1(config);
|
|
16
|
+
printHeader(`preview · ${startupDuration()}`);
|
|
17
|
+
printUrls(server.resolvedUrls, opts.host);
|
|
18
|
+
if (shortcutsEnabled()) {
|
|
19
|
+
printShortcutsHint();
|
|
20
|
+
server.bindCLIShortcuts();
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
//#endregion
|
|
24
|
+
export { preview };
|
package/dist/vite/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as createViteConfig } from "../config-
|
|
1
|
+
import { t as createViteConfig } from "../config-nbSvY7z_.js";
|
|
2
2
|
export { createViteConfig };
|
package/package.json
CHANGED
package/dist/build-CfAxF6Dm.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { t as createViteConfig } from "./config-C_VI2EpT.js";
|
|
2
|
-
import path from "node:path";
|
|
3
|
-
import { build as build$1, mergeConfig } from "vite";
|
|
4
|
-
//#region src/cli/build.ts
|
|
5
|
-
async function build(opts = {}) {
|
|
6
|
-
const base = await createViteConfig({
|
|
7
|
-
userCwd: process.cwd(),
|
|
8
|
-
mode: "build"
|
|
9
|
-
});
|
|
10
|
-
const config = mergeConfig(base, { build: { ...opts.outDir !== void 0 ? { outDir: path.resolve(process.cwd(), opts.outDir) } : {} } });
|
|
11
|
-
await build$1(config);
|
|
12
|
-
}
|
|
13
|
-
//#endregion
|
|
14
|
-
export { build };
|
package/dist/preview-CcCQa268.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { t as createViteConfig } from "./config-C_VI2EpT.js";
|
|
2
|
-
import { mergeConfig, preview as preview$1 } from "vite";
|
|
3
|
-
//#region src/cli/preview.ts
|
|
4
|
-
async function preview(opts = {}) {
|
|
5
|
-
const base = await createViteConfig({ userCwd: process.cwd() });
|
|
6
|
-
const config = mergeConfig(base, { preview: {
|
|
7
|
-
...opts.port !== void 0 ? { port: opts.port } : {},
|
|
8
|
-
...opts.host !== void 0 ? { host: opts.host } : {},
|
|
9
|
-
...opts.open !== void 0 ? { open: opts.open } : {}
|
|
10
|
-
} });
|
|
11
|
-
(await preview$1(config)).printUrls();
|
|
12
|
-
}
|
|
13
|
-
//#endregion
|
|
14
|
-
export { preview };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { n as defaultDesign } from "./design-Cpqx7SJs.js";
|
|
2
2
|
import { createRequire } from "node:module";
|
|
3
|
-
import fs from "node:fs/promises";
|
|
4
3
|
import path from "node:path";
|
|
5
4
|
import { fileURLToPath } from "node:url";
|
|
6
|
-
import { randomUUID } from "node:crypto";
|
|
7
5
|
import { existsSync, readFileSync } from "node:fs";
|
|
6
|
+
import { randomUUID } from "node:crypto";
|
|
7
|
+
import fs from "node:fs/promises";
|
|
8
8
|
import tailwindcss from "@tailwindcss/vite";
|
|
9
9
|
import react from "@vitejs/plugin-react";
|
|
10
10
|
import * as t from "@babel/types";
|