@nasti-toolchain/nasti 1.6.3 → 1.6.4

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/index.cjs CHANGED
@@ -376,6 +376,59 @@ var init_resolve = __esm({
376
376
  }
377
377
  });
378
378
 
379
+ // src/plugins/tailwind.ts
380
+ function hasTailwindDirectives(css) {
381
+ const withoutBlockComments = css.replace(/\/\*[\s\S]*?\*\//g, "");
382
+ const withoutLineComments = withoutBlockComments.replace(/\/\/.*$/gm, "");
383
+ return TAILWIND_DIRECTIVE_RE.test(withoutLineComments);
384
+ }
385
+ async function loadTailwind(projectRoot) {
386
+ if (cached && cachedRoot === projectRoot) return cached;
387
+ const req = (0, import_node_module2.createRequire)(import_node_path3.default.join(projectRoot, "package.json"));
388
+ let nodePath;
389
+ let oxidePath;
390
+ try {
391
+ nodePath = req.resolve("@tailwindcss/node");
392
+ oxidePath = req.resolve("@tailwindcss/oxide");
393
+ } catch {
394
+ throw new Error(
395
+ "[nasti] CSS contains Tailwind v4 directives but `@tailwindcss/node` and/or `@tailwindcss/oxide` are not installed in this project. Install them with: npm i -D tailwindcss @tailwindcss/node @tailwindcss/oxide"
396
+ );
397
+ }
398
+ const node = await import((0, import_node_url2.pathToFileURL)(nodePath).href);
399
+ const oxide = await import((0, import_node_url2.pathToFileURL)(oxidePath).href);
400
+ cached = { node, oxide };
401
+ cachedRoot = projectRoot;
402
+ return cached;
403
+ }
404
+ async function compileTailwind(css, fromFile, projectRoot) {
405
+ const { node, oxide } = await loadTailwind(projectRoot);
406
+ const dependencies = [];
407
+ const compiler = await node.compile(css, {
408
+ base: import_node_path3.default.dirname(fromFile),
409
+ from: fromFile,
410
+ onDependency: (p) => dependencies.push(p)
411
+ });
412
+ const scanner = new oxide.Scanner({ sources: compiler.sources });
413
+ const candidates = scanner.scan();
414
+ return {
415
+ css: compiler.build(candidates),
416
+ dependencies: [...dependencies, ...scanner.files]
417
+ };
418
+ }
419
+ var import_node_path3, import_node_module2, import_node_url2, TAILWIND_DIRECTIVE_RE, cached, cachedRoot;
420
+ var init_tailwind = __esm({
421
+ "src/plugins/tailwind.ts"() {
422
+ "use strict";
423
+ import_node_path3 = __toESM(require("path"), 1);
424
+ import_node_module2 = require("module");
425
+ import_node_url2 = require("url");
426
+ TAILWIND_DIRECTIVE_RE = /@(?:import\s+["']tailwindcss(?:\b|\/)|tailwind\b|theme\b|apply\b|plugin\b|source\b|utility\b|variant\b|custom-variant\b|reference\b)/;
427
+ cached = null;
428
+ cachedRoot = null;
429
+ }
430
+ });
431
+
379
432
  // src/plugins/css.ts
380
433
  function cssPlugin(config) {
381
434
  return {
@@ -384,9 +437,14 @@ function cssPlugin(config) {
384
437
  if (source.endsWith(".css")) return null;
385
438
  return null;
386
439
  },
387
- transform(code, id) {
440
+ async transform(code, id) {
388
441
  if (!id.endsWith(".css")) return null;
389
- const rewritten = rewriteCssUrls(code, id, config.root);
442
+ let cssSource = code;
443
+ if (hasTailwindDirectives(code)) {
444
+ const compiled = await compileTailwind(code, id, config.root);
445
+ cssSource = compiled.css;
446
+ }
447
+ const rewritten = rewriteCssUrls(cssSource, id, config.root);
390
448
  if (config.command === "serve") {
391
449
  const escaped = JSON.stringify(rewritten);
392
450
  return {
@@ -421,16 +479,17 @@ function rewriteCssUrls(css, from, root) {
421
479
  if (url.startsWith("/") || url.startsWith("data:") || url.startsWith("http")) {
422
480
  return match;
423
481
  }
424
- const resolved = import_node_path3.default.resolve(import_node_path3.default.dirname(from), url);
425
- const relative = "/" + import_node_path3.default.relative(root, resolved);
482
+ const resolved = import_node_path4.default.resolve(import_node_path4.default.dirname(from), url);
483
+ const relative = "/" + import_node_path4.default.relative(root, resolved);
426
484
  return `url(${relative})`;
427
485
  });
428
486
  }
429
- var import_node_path3;
487
+ var import_node_path4;
430
488
  var init_css = __esm({
431
489
  "src/plugins/css.ts"() {
432
490
  "use strict";
433
- import_node_path3 = __toESM(require("path"), 1);
491
+ import_node_path4 = __toESM(require("path"), 1);
492
+ init_tailwind();
434
493
  }
435
494
  });
436
495
 
@@ -445,7 +504,7 @@ function assetsPlugin(config) {
445
504
  return null;
446
505
  },
447
506
  load(id) {
448
- const ext = import_node_path4.default.extname(id.replace(/\?.*$/, ""));
507
+ const ext = import_node_path5.default.extname(id.replace(/\?.*$/, ""));
449
508
  if (id.endsWith("?raw")) {
450
509
  const file = id.slice(0, -4);
451
510
  if (import_node_fs3.default.existsSync(file)) {
@@ -457,12 +516,12 @@ function assetsPlugin(config) {
457
516
  const file = id.replace(/\?.*$/, "");
458
517
  if (!import_node_fs3.default.existsSync(file)) return null;
459
518
  if (config.command === "serve") {
460
- const url = "/" + import_node_path4.default.relative(config.root, file);
519
+ const url = "/" + import_node_path5.default.relative(config.root, file);
461
520
  return `export default ${JSON.stringify(url)}`;
462
521
  }
463
522
  const content = import_node_fs3.default.readFileSync(file);
464
523
  const hash = import_node_crypto.default.createHash("sha256").update(content).digest("hex").slice(0, 8);
465
- const basename = import_node_path4.default.basename(file, ext);
524
+ const basename = import_node_path5.default.basename(file, ext);
466
525
  const hashedName = `${config.build.assetsDir}/${basename}.${hash}${ext}`;
467
526
  return `export default ${JSON.stringify(config.base + hashedName)}`;
468
527
  }
@@ -470,11 +529,11 @@ function assetsPlugin(config) {
470
529
  }
471
530
  };
472
531
  }
473
- var import_node_path4, import_node_fs3, import_node_crypto, ASSET_EXTENSIONS;
532
+ var import_node_path5, import_node_fs3, import_node_crypto, ASSET_EXTENSIONS;
474
533
  var init_assets = __esm({
475
534
  "src/plugins/assets.ts"() {
476
535
  "use strict";
477
- import_node_path4 = __toESM(require("path"), 1);
536
+ import_node_path5 = __toESM(require("path"), 1);
478
537
  import_node_fs3 = __toESM(require("fs"), 1);
479
538
  import_node_crypto = __toESM(require("crypto"), 1);
480
539
  ASSET_EXTENSIONS = /* @__PURE__ */ new Set([
@@ -567,15 +626,15 @@ function serializeTag(tag) {
567
626
  return ` <${tag.tag}${attrs}>${children}</${tag.tag}>`;
568
627
  }
569
628
  async function readHtmlFile(root) {
570
- const htmlPath = import_node_path5.default.resolve(root, "index.html");
629
+ const htmlPath = import_node_path6.default.resolve(root, "index.html");
571
630
  if (!import_node_fs4.default.existsSync(htmlPath)) return null;
572
631
  return import_node_fs4.default.readFileSync(htmlPath, "utf-8");
573
632
  }
574
- var import_node_path5, import_node_fs4, REACT_REFRESH_HTML_PREAMBLE;
633
+ var import_node_path6, import_node_fs4, REACT_REFRESH_HTML_PREAMBLE;
575
634
  var init_html = __esm({
576
635
  "src/plugins/html.ts"() {
577
636
  "use strict";
578
- import_node_path5 = __toESM(require("path"), 1);
637
+ import_node_path6 = __toESM(require("path"), 1);
579
638
  import_node_fs4 = __toESM(require("fs"), 1);
580
639
  REACT_REFRESH_HTML_PREAMBLE = `
581
640
  import RefreshRuntime from "/@react-refresh";
@@ -634,7 +693,7 @@ function loadEnv(mode, root, prefixes) {
634
693
  ];
635
694
  const raw = {};
636
695
  for (const file of envFiles) {
637
- const filePath = import_node_path6.default.resolve(root, file);
696
+ const filePath = import_node_path7.default.resolve(root, file);
638
697
  if (!import_node_fs5.default.existsSync(filePath)) continue;
639
698
  const content = import_node_fs5.default.readFileSync(filePath, "utf-8");
640
699
  for (const line of content.split("\n")) {
@@ -677,11 +736,11 @@ function replaceEnvInCode(code, define) {
677
736
  }
678
737
  return result;
679
738
  }
680
- var import_node_path6, import_node_fs5;
739
+ var import_node_path7, import_node_fs5;
681
740
  var init_env = __esm({
682
741
  "src/core/env.ts"() {
683
742
  "use strict";
684
- import_node_path6 = __toESM(require("path"), 1);
743
+ import_node_path7 = __toESM(require("path"), 1);
685
744
  import_node_fs5 = __toESM(require("fs"), 1);
686
745
  }
687
746
  });
@@ -814,10 +873,10 @@ __export(build_exports, {
814
873
  async function build(inlineConfig = {}) {
815
874
  const config = await resolveConfig(inlineConfig, "build");
816
875
  const startTime = performance.now();
817
- console.log(import_picocolors.default.cyan("\n\u{1F528} nasti build") + import_picocolors.default.dim(` v${"1.6.3"}`));
876
+ console.log(import_picocolors.default.cyan("\n\u{1F528} nasti build") + import_picocolors.default.dim(` v${"1.6.4"}`));
818
877
  console.log(import_picocolors.default.dim(` root: ${config.root}`));
819
878
  console.log(import_picocolors.default.dim(` mode: ${config.mode}`));
820
- const outDir = import_node_path7.default.resolve(config.root, config.build.outDir);
879
+ const outDir = import_node_path8.default.resolve(config.root, config.build.outDir);
821
880
  if (config.build.emptyOutDir && import_node_fs6.default.existsSync(outDir)) {
822
881
  import_node_fs6.default.rmSync(outDir, { recursive: true, force: true });
823
882
  }
@@ -829,14 +888,14 @@ async function build(inlineConfig = {}) {
829
888
  for (const match of scriptMatches) {
830
889
  const src = match[1];
831
890
  if (src && !src.startsWith("http")) {
832
- entryPoints.push(import_node_path7.default.resolve(config.root, src.replace(/^\//, "")));
891
+ entryPoints.push(import_node_path8.default.resolve(config.root, src.replace(/^\//, "")));
833
892
  }
834
893
  }
835
894
  }
836
895
  if (entryPoints.length === 0) {
837
896
  const fallbackEntries = ["src/main.ts", "src/main.tsx", "src/main.js", "src/index.ts", "src/index.tsx", "src/index.js"];
838
897
  for (const entry of fallbackEntries) {
839
- const fullPath = import_node_path7.default.resolve(config.root, entry);
898
+ const fullPath = import_node_path8.default.resolve(config.root, entry);
840
899
  if (import_node_fs6.default.existsSync(fullPath)) {
841
900
  entryPoints.push(fullPath);
842
901
  break;
@@ -901,8 +960,8 @@ async function build(inlineConfig = {}) {
901
960
  await bundle.close();
902
961
  await pluginContainer.buildEnd();
903
962
  for (const ef of pluginContainer.getEmittedFiles()) {
904
- const dest = import_node_path7.default.resolve(outDir, ef.fileName);
905
- import_node_fs6.default.mkdirSync(import_node_path7.default.dirname(dest), { recursive: true });
963
+ const dest = import_node_path8.default.resolve(outDir, ef.fileName);
964
+ import_node_fs6.default.mkdirSync(import_node_path8.default.dirname(dest), { recursive: true });
906
965
  import_node_fs6.default.writeFileSync(dest, ef.source);
907
966
  }
908
967
  if (html) {
@@ -920,14 +979,14 @@ async function build(inlineConfig = {}) {
920
979
  }
921
980
  for (const chunk of output) {
922
981
  if (chunk.type === "chunk" && chunk.isEntry && chunk.facadeModuleId) {
923
- const originalEntry = import_node_path7.default.relative(config.root, chunk.facadeModuleId);
982
+ const originalEntry = import_node_path8.default.relative(config.root, chunk.facadeModuleId);
924
983
  processedHtml = processedHtml.replace(
925
984
  new RegExp(`(src=["'])/?(${escapeRegExp(originalEntry)})(["'])`, "g"),
926
985
  `$1${config.base}${chunk.fileName}$3`
927
986
  );
928
987
  }
929
988
  }
930
- import_node_fs6.default.writeFileSync(import_node_path7.default.resolve(outDir, "index.html"), processedHtml);
989
+ import_node_fs6.default.writeFileSync(import_node_path8.default.resolve(outDir, "index.html"), processedHtml);
931
990
  }
932
991
  const elapsed = ((performance.now() - startTime) / 1e3).toFixed(2);
933
992
  const totalSize = output.reduce((sum, chunk) => {
@@ -949,11 +1008,11 @@ function formatSize(bytes) {
949
1008
  function escapeRegExp(string) {
950
1009
  return string.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
951
1010
  }
952
- var import_node_path7, import_node_fs6, import_rolldown, import_picocolors;
1011
+ var import_node_path8, import_node_fs6, import_rolldown, import_picocolors;
953
1012
  var init_build = __esm({
954
1013
  "src/build/index.ts"() {
955
1014
  "use strict";
956
- import_node_path7 = __toESM(require("path"), 1);
1015
+ import_node_path8 = __toESM(require("path"), 1);
957
1016
  import_node_fs6 = __toESM(require("fs"), 1);
958
1017
  import_rolldown = require("rolldown");
959
1018
  init_config();
@@ -1150,9 +1209,9 @@ function getReactRefreshRuntimeEsm() {
1150
1209
  let cjsPath;
1151
1210
  try {
1152
1211
  const pkgPath = __require.resolve("react-refresh/package.json");
1153
- cjsPath = import_node_path9.default.join(import_node_path9.default.dirname(pkgPath), "cjs", "react-refresh-runtime.development.js");
1212
+ cjsPath = import_node_path10.default.join(import_node_path10.default.dirname(pkgPath), "cjs", "react-refresh-runtime.development.js");
1154
1213
  } catch (err) {
1155
- cjsPath = import_node_path9.default.resolve(__dirname_esm, "../../node_modules/react-refresh/cjs/react-refresh-runtime.development.js");
1214
+ cjsPath = import_node_path10.default.resolve(__dirname_esm, "../../node_modules/react-refresh/cjs/react-refresh-runtime.development.js");
1156
1215
  if (!import_node_fs8.default.existsSync(cjsPath)) {
1157
1216
  const origMsg = err instanceof Error ? err.message : String(err);
1158
1217
  throw new Error(
@@ -1292,9 +1351,9 @@ function transformMiddleware(ctx) {
1292
1351
  async function transformRequest(url, ctx) {
1293
1352
  const { config, pluginContainer, moduleGraph } = ctx;
1294
1353
  const cleanReqUrl = url.split("?")[0];
1295
- const cached = moduleGraph.getModuleByUrl(url);
1296
- if (cached?.transformResult) {
1297
- return cached.transformResult;
1354
+ const cached2 = moduleGraph.getModuleByUrl(url);
1355
+ if (cached2?.transformResult) {
1356
+ return cached2.transformResult;
1298
1357
  }
1299
1358
  if (cleanReqUrl === "/@react-refresh") {
1300
1359
  return { code: getReactRefreshRuntimeEsm() };
@@ -1373,7 +1432,7 @@ async function loadVirtualModule(spec, ctx) {
1373
1432
  loadEnv(config.mode, config.root, config.envPrefix),
1374
1433
  config.mode
1375
1434
  ));
1376
- const anchor = import_node_path9.default.join(config.root, "__nasti_virtual__.ts");
1435
+ const anchor = import_node_path10.default.join(config.root, "__nasti_virtual__.ts");
1377
1436
  code = rewriteImports(code, config, anchor);
1378
1437
  return { id: resolvedId, result: { code } };
1379
1438
  }
@@ -1416,13 +1475,13 @@ async function doBundlePackage(entryFile) {
1416
1475
  return code;
1417
1476
  }
1418
1477
  async function tryGenerateSubpathShim(entryFile) {
1419
- const NM = `${import_node_path9.default.sep}node_modules${import_node_path9.default.sep}`;
1478
+ const NM = `${import_node_path10.default.sep}node_modules${import_node_path10.default.sep}`;
1420
1479
  if (!entryFile.includes(NM)) return null;
1421
1480
  let pkgDir = null;
1422
1481
  let pkgName = null;
1423
- let dir = import_node_path9.default.dirname(entryFile);
1482
+ let dir = import_node_path10.default.dirname(entryFile);
1424
1483
  while (true) {
1425
- const pkgJsonPath = import_node_path9.default.join(dir, "package.json");
1484
+ const pkgJsonPath = import_node_path10.default.join(dir, "package.json");
1426
1485
  if (import_node_fs8.default.existsSync(pkgJsonPath)) {
1427
1486
  try {
1428
1487
  const pkg = JSON.parse(import_node_fs8.default.readFileSync(pkgJsonPath, "utf-8"));
@@ -1434,21 +1493,21 @@ async function tryGenerateSubpathShim(entryFile) {
1434
1493
  } catch {
1435
1494
  }
1436
1495
  }
1437
- const parent = import_node_path9.default.dirname(dir);
1496
+ const parent = import_node_path10.default.dirname(dir);
1438
1497
  if (parent === dir) return null;
1439
1498
  dir = parent;
1440
1499
  if (!dir.includes(NM)) return null;
1441
1500
  }
1442
1501
  if (!pkgDir || !pkgName) return null;
1443
- const entryExt = import_node_path9.default.extname(entryFile);
1502
+ const entryExt = import_node_path10.default.extname(entryFile);
1444
1503
  const mainEntry = pickMainEntryByExtension(pkgDir, entryExt);
1445
1504
  if (!mainEntry) return null;
1446
- if (import_node_path9.default.resolve(mainEntry) === import_node_path9.default.resolve(entryFile)) return null;
1505
+ if (import_node_path10.default.resolve(mainEntry) === import_node_path10.default.resolve(entryFile)) return null;
1447
1506
  let mainNs;
1448
1507
  let subNs;
1449
1508
  try {
1450
- mainNs = await import((0, import_node_url2.pathToFileURL)(mainEntry).href);
1451
- subNs = await import((0, import_node_url2.pathToFileURL)(entryFile).href);
1509
+ mainNs = await import((0, import_node_url3.pathToFileURL)(mainEntry).href);
1510
+ subNs = await import((0, import_node_url3.pathToFileURL)(entryFile).href);
1452
1511
  } catch {
1453
1512
  return null;
1454
1513
  }
@@ -1479,7 +1538,7 @@ async function tryGenerateSubpathShim(entryFile) {
1479
1538
  return lines.join("\n") + "\n";
1480
1539
  }
1481
1540
  function pickMainEntryByExtension(pkgDir, preferredExt) {
1482
- const pkgJsonPath = import_node_path9.default.join(pkgDir, "package.json");
1541
+ const pkgJsonPath = import_node_path10.default.join(pkgDir, "package.json");
1483
1542
  let pkg;
1484
1543
  try {
1485
1544
  pkg = JSON.parse(import_node_fs8.default.readFileSync(pkgJsonPath, "utf-8"));
@@ -1501,13 +1560,13 @@ function pickMainEntryByExtension(pkgDir, preferredExt) {
1501
1560
  if (typeof pkg.module === "string") candidates.push(pkg.module);
1502
1561
  if (typeof pkg.main === "string") candidates.push(pkg.main);
1503
1562
  for (const cand of candidates) {
1504
- if (import_node_path9.default.extname(cand) === preferredExt) {
1505
- const full = import_node_path9.default.resolve(pkgDir, cand);
1563
+ if (import_node_path10.default.extname(cand) === preferredExt) {
1564
+ const full = import_node_path10.default.resolve(pkgDir, cand);
1506
1565
  if (import_node_fs8.default.existsSync(full)) return full;
1507
1566
  }
1508
1567
  }
1509
1568
  for (const cand of candidates) {
1510
- const full = import_node_path9.default.resolve(pkgDir, cand);
1569
+ const full = import_node_path10.default.resolve(pkgDir, cand);
1511
1570
  if (import_node_fs8.default.existsSync(full)) return full;
1512
1571
  }
1513
1572
  return null;
@@ -1533,19 +1592,20 @@ function rewriteExternalRequires(code) {
1533
1592
  }
1534
1593
  async function injectCjsNamedExports(code, entryFile) {
1535
1594
  try {
1536
- const { createRequire: createRequire5 } = await import("module");
1537
- const req = createRequire5(entryFile);
1595
+ const { createRequire: createRequire6 } = await import("module");
1596
+ const req = createRequire6(entryFile);
1538
1597
  const cjsExports = req(entryFile);
1539
1598
  if (!cjsExports || typeof cjsExports !== "object" && typeof cjsExports !== "function" || Array.isArray(cjsExports)) return code;
1540
1599
  const namedKeys = Object.keys(cjsExports).filter(
1541
1600
  (k) => k !== "__esModule" && k !== "default" && VALID_IDENT.test(k)
1542
1601
  );
1543
- if (namedKeys.length === 0) return code;
1602
+ const hasEsmInterop = cjsExports.__esModule === true && "default" in cjsExports;
1603
+ if (!hasEsmInterop && namedKeys.length === 0) return code;
1544
1604
  return code.replace(
1545
1605
  /^export default (\w+\(\));?\s*$/m,
1546
1606
  (_, call) => [
1547
1607
  `const __cjsMod = ${call};`,
1548
- `export default __cjsMod;`,
1608
+ hasEsmInterop ? `export default __cjsMod.default;` : `export default __cjsMod;`,
1549
1609
  ...namedKeys.map((k) => `export const ${k} = __cjsMod[${JSON.stringify(k)}];`)
1550
1610
  ].join("\n")
1551
1611
  );
@@ -1555,11 +1615,11 @@ async function injectCjsNamedExports(code, entryFile) {
1555
1615
  }
1556
1616
  function rewriteImports(code, config, filePath) {
1557
1617
  const root = config.root;
1558
- const fileDir = import_node_path9.default.dirname(filePath);
1618
+ const fileDir = import_node_path10.default.dirname(filePath);
1559
1619
  const aliasEntries = Object.entries(config.resolve.alias).sort(
1560
1620
  ([a], [b]) => b.length - a.length
1561
1621
  );
1562
- const toRootUrl = (abs) => "/" + import_node_path9.default.relative(root, abs).replace(/\\/g, "/");
1622
+ const toRootUrl = (abs) => "/" + import_node_path10.default.relative(root, abs).replace(/\\/g, "/");
1563
1623
  const transformSpec = (spec) => {
1564
1624
  const suffixMatch = spec.match(/[?#].*$/);
1565
1625
  const suffix = suffixMatch ? suffixMatch[0] : "";
@@ -1568,18 +1628,18 @@ function rewriteImports(code, config, filePath) {
1568
1628
  if (baseSpec === key || baseSpec.startsWith(key + "/")) {
1569
1629
  const aliasBase = resolveAliasTarget(value, root);
1570
1630
  const sub = baseSpec.slice(key.length).replace(/^\//, "");
1571
- const target = sub ? import_node_path9.default.join(aliasBase, sub) : aliasBase;
1631
+ const target = sub ? import_node_path10.default.join(aliasBase, sub) : aliasBase;
1572
1632
  const resolved = tryResolveDiskPath(target);
1573
1633
  return resolved && isUnderRoot(resolved, root) ? toRootUrl(resolved) + suffix : spec;
1574
1634
  }
1575
1635
  }
1576
1636
  if (baseSpec.startsWith("./") || baseSpec.startsWith("../")) {
1577
- const target = import_node_path9.default.resolve(fileDir, baseSpec);
1637
+ const target = import_node_path10.default.resolve(fileDir, baseSpec);
1578
1638
  const resolved = tryResolveDiskPath(target);
1579
1639
  return resolved && isUnderRoot(resolved, root) ? toRootUrl(resolved) + suffix : spec;
1580
1640
  }
1581
1641
  if (baseSpec.startsWith("/") && !baseSpec.startsWith("/@")) {
1582
- const target = import_node_path9.default.join(root, baseSpec.replace(/^\//, ""));
1642
+ const target = import_node_path10.default.join(root, baseSpec.replace(/^\//, ""));
1583
1643
  const resolved = tryResolveDiskPath(target);
1584
1644
  return resolved && isUnderRoot(resolved, root) ? toRootUrl(resolved) + suffix : spec;
1585
1645
  }
@@ -1598,9 +1658,9 @@ function rewriteImports(code, config, filePath) {
1598
1658
  );
1599
1659
  }
1600
1660
  function resolveAliasTarget(value, root) {
1601
- if (import_node_path9.default.isAbsolute(value) && import_node_fs8.default.existsSync(value)) return value;
1602
- if (value.startsWith("/")) return import_node_path9.default.join(root, value.slice(1));
1603
- return import_node_path9.default.resolve(root, value);
1661
+ if (import_node_path10.default.isAbsolute(value) && import_node_fs8.default.existsSync(value)) return value;
1662
+ if (value.startsWith("/")) return import_node_path10.default.join(root, value.slice(1));
1663
+ return import_node_path10.default.resolve(root, value);
1604
1664
  }
1605
1665
  function tryResolveDiskPath(target) {
1606
1666
  if (import_node_fs8.default.existsSync(target) && import_node_fs8.default.statSync(target).isFile()) return target;
@@ -1610,15 +1670,15 @@ function tryResolveDiskPath(target) {
1610
1670
  }
1611
1671
  if (import_node_fs8.default.existsSync(target) && import_node_fs8.default.statSync(target).isDirectory()) {
1612
1672
  for (const ext of RESOLVE_EXTENSIONS) {
1613
- const idx = import_node_path9.default.join(target, "index" + ext);
1673
+ const idx = import_node_path10.default.join(target, "index" + ext);
1614
1674
  if (import_node_fs8.default.existsSync(idx) && import_node_fs8.default.statSync(idx).isFile()) return idx;
1615
1675
  }
1616
1676
  }
1617
1677
  return null;
1618
1678
  }
1619
1679
  function isUnderRoot(abs, root) {
1620
- const rel = import_node_path9.default.relative(root, abs);
1621
- return !!rel && !rel.startsWith("..") && !import_node_path9.default.isAbsolute(rel);
1680
+ const rel = import_node_path10.default.relative(root, abs);
1681
+ return !!rel && !rel.startsWith("..") && !import_node_path10.default.isAbsolute(rel);
1622
1682
  }
1623
1683
  function resolveNodeModule(root, moduleName) {
1624
1684
  let pkgName;
@@ -1635,17 +1695,17 @@ function resolveNodeModule(root, moduleName) {
1635
1695
  let pkgDir = null;
1636
1696
  let dir = root;
1637
1697
  for (; ; ) {
1638
- const candidate = import_node_path9.default.join(dir, "node_modules", pkgName);
1698
+ const candidate = import_node_path10.default.join(dir, "node_modules", pkgName);
1639
1699
  if (import_node_fs8.default.existsSync(candidate)) {
1640
1700
  pkgDir = candidate;
1641
1701
  break;
1642
1702
  }
1643
- const parent = import_node_path9.default.dirname(dir);
1703
+ const parent = import_node_path10.default.dirname(dir);
1644
1704
  if (parent === dir) break;
1645
1705
  dir = parent;
1646
1706
  }
1647
1707
  if (!pkgDir) return null;
1648
- const pkgJsonPath = import_node_path9.default.join(pkgDir, "package.json");
1708
+ const pkgJsonPath = import_node_path10.default.join(pkgDir, "package.json");
1649
1709
  if (!import_node_fs8.default.existsSync(pkgJsonPath)) return null;
1650
1710
  let pkg;
1651
1711
  try {
@@ -1662,12 +1722,12 @@ function resolveNodeModule(root, moduleName) {
1662
1722
  const subDirs = [""];
1663
1723
  for (const field of ["module", "main"]) {
1664
1724
  if (typeof pkg[field] === "string") {
1665
- const dir2 = import_node_path9.default.dirname(pkg[field]);
1725
+ const dir2 = import_node_path10.default.dirname(pkg[field]);
1666
1726
  if (dir2 && dir2 !== "." && !subDirs.includes(dir2)) subDirs.push(dir2);
1667
1727
  }
1668
1728
  }
1669
1729
  for (const dir2 of subDirs) {
1670
- const direct = import_node_path9.default.join(pkgDir, dir2, subpath);
1730
+ const direct = import_node_path10.default.join(pkgDir, dir2, subpath);
1671
1731
  if (import_node_fs8.default.existsSync(direct) && import_node_fs8.default.statSync(direct).isFile()) return direct;
1672
1732
  for (const ext of RESOLVE_EXTENSIONS) {
1673
1733
  if (import_node_fs8.default.existsSync(direct + ext)) return direct + ext;
@@ -1677,24 +1737,24 @@ function resolveNodeModule(root, moduleName) {
1677
1737
  }
1678
1738
  for (const field of ["module", "jsnext:main", "jsnext", "main"]) {
1679
1739
  if (typeof pkg[field] === "string") {
1680
- const entry = import_node_path9.default.join(pkgDir, pkg[field]);
1740
+ const entry = import_node_path10.default.join(pkgDir, pkg[field]);
1681
1741
  if (import_node_fs8.default.existsSync(entry)) return entry;
1682
1742
  }
1683
1743
  }
1684
- const indexFallback = import_node_path9.default.join(pkgDir, "index.js");
1744
+ const indexFallback = import_node_path10.default.join(pkgDir, "index.js");
1685
1745
  if (import_node_fs8.default.existsSync(indexFallback)) return indexFallback;
1686
1746
  return null;
1687
1747
  }
1688
1748
  function resolvePackageExports(exports2, key, pkgDir) {
1689
1749
  if (typeof exports2 === "string") {
1690
- return key === "." ? import_node_path9.default.join(pkgDir, exports2) : null;
1750
+ return key === "." ? import_node_path10.default.join(pkgDir, exports2) : null;
1691
1751
  }
1692
1752
  const entry = exports2[key];
1693
1753
  if (entry === void 0) return null;
1694
1754
  return resolveExportValue(entry, pkgDir);
1695
1755
  }
1696
1756
  function resolveExportValue(value, pkgDir) {
1697
- if (typeof value === "string") return import_node_path9.default.join(pkgDir, value);
1757
+ if (typeof value === "string") return import_node_path10.default.join(pkgDir, value);
1698
1758
  if (Array.isArray(value)) {
1699
1759
  for (const item of value) {
1700
1760
  const r = resolveExportValue(item, pkgDir);
@@ -1718,7 +1778,7 @@ function resolveUrlToFile(url, root) {
1718
1778
  const moduleName = cleanUrl.slice("/@modules/".length);
1719
1779
  return resolveNodeModule(root, moduleName);
1720
1780
  }
1721
- const filePath = import_node_path9.default.resolve(root, cleanUrl.replace(/^\//, ""));
1781
+ const filePath = import_node_path10.default.resolve(root, cleanUrl.replace(/^\//, ""));
1722
1782
  if (import_node_fs8.default.existsSync(filePath) && import_node_fs8.default.statSync(filePath).isFile()) {
1723
1783
  return filePath;
1724
1784
  }
@@ -1727,7 +1787,7 @@ function resolveUrlToFile(url, root) {
1727
1787
  if (import_node_fs8.default.existsSync(withExt)) return withExt;
1728
1788
  }
1729
1789
  for (const ext of RESOLVE_EXTENSIONS) {
1730
- const indexFile = import_node_path9.default.join(filePath, "index" + ext);
1790
+ const indexFile = import_node_path10.default.join(filePath, "index" + ext);
1731
1791
  if (import_node_fs8.default.existsSync(indexFile)) return indexFile;
1732
1792
  }
1733
1793
  return null;
@@ -1736,7 +1796,7 @@ function isModuleRequest(url) {
1736
1796
  const cleanUrl = url.split("?")[0];
1737
1797
  if (/\.(ts|tsx|jsx|js|mjs|vue|css|json)$/.test(cleanUrl)) return true;
1738
1798
  if (cleanUrl.startsWith("/@modules/")) return true;
1739
- if (!import_node_path9.default.extname(cleanUrl)) return true;
1799
+ if (!import_node_path10.default.extname(cleanUrl)) return true;
1740
1800
  return false;
1741
1801
  }
1742
1802
  function getHmrClientCode() {
@@ -1867,20 +1927,20 @@ export function createHotContext(ownerPath) {
1867
1927
  }
1868
1928
  `;
1869
1929
  }
1870
- var import_node_path9, import_node_fs8, import_node_module3, import_node_url2, import_meta, __dirname_esm, __require, __refreshRuntimeCache, REACT_REFRESH_GLOBAL_PREAMBLE, esmBundleCache, VALID_IDENT, RESOLVE_EXTENSIONS, ESM_CONDITIONS;
1930
+ var import_node_path10, import_node_fs8, import_node_module4, import_node_url3, import_meta, __dirname_esm, __require, __refreshRuntimeCache, REACT_REFRESH_GLOBAL_PREAMBLE, esmBundleCache, VALID_IDENT, RESOLVE_EXTENSIONS, ESM_CONDITIONS;
1871
1931
  var init_middleware = __esm({
1872
1932
  "src/server/middleware.ts"() {
1873
1933
  "use strict";
1874
- import_node_path9 = __toESM(require("path"), 1);
1934
+ import_node_path10 = __toESM(require("path"), 1);
1875
1935
  import_node_fs8 = __toESM(require("fs"), 1);
1876
- import_node_module3 = require("module");
1877
- import_node_url2 = require("url");
1936
+ import_node_module4 = require("module");
1937
+ import_node_url3 = require("url");
1878
1938
  init_transformer();
1879
1939
  init_html();
1880
1940
  init_env();
1881
1941
  import_meta = {};
1882
- __dirname_esm = import_node_path9.default.dirname((0, import_node_url2.fileURLToPath)(import_meta.url));
1883
- __require = (0, import_node_module3.createRequire)(import_meta.url);
1942
+ __dirname_esm = import_node_path10.default.dirname((0, import_node_url3.fileURLToPath)(import_meta.url));
1943
+ __require = (0, import_node_module4.createRequire)(import_meta.url);
1884
1944
  __refreshRuntimeCache = null;
1885
1945
  REACT_REFRESH_GLOBAL_PREAMBLE = `
1886
1946
  import RefreshRuntime from "/@react-refresh";
@@ -1899,7 +1959,7 @@ window.__vite_plugin_react_preamble_installed__ = true;
1899
1959
  // src/server/hmr.ts
1900
1960
  async function handleFileChange(file, server) {
1901
1961
  const { moduleGraph, ws, config } = server;
1902
- const relativePath = "/" + import_node_path10.default.relative(config.root, file);
1962
+ const relativePath = "/" + import_node_path11.default.relative(config.root, file);
1903
1963
  const mods = moduleGraph.getModulesByFile(file);
1904
1964
  if (!mods || mods.size === 0) {
1905
1965
  return;
@@ -1944,11 +2004,11 @@ async function handleFileChange(file, server) {
1944
2004
  ws.send({ type: "update", updates });
1945
2005
  }
1946
2006
  }
1947
- var import_node_path10, import_node_fs9;
2007
+ var import_node_path11, import_node_fs9;
1948
2008
  var init_hmr = __esm({
1949
2009
  "src/server/hmr.ts"() {
1950
2010
  "use strict";
1951
- import_node_path10 = __toESM(require("path"), 1);
2011
+ import_node_path11 = __toESM(require("path"), 1);
1952
2012
  import_node_fs9 = __toESM(require("fs"), 1);
1953
2013
  }
1954
2014
  });
@@ -1976,20 +2036,20 @@ async function createServer(inlineConfig = {}) {
1976
2036
  pluginContainer,
1977
2037
  moduleGraph
1978
2038
  }));
1979
- const publicDir = import_node_path11.default.resolve(config.root, "public");
2039
+ const publicDir = import_node_path12.default.resolve(config.root, "public");
1980
2040
  app.use((0, import_sirv.default)(publicDir, { dev: true, etag: true }));
1981
2041
  app.use((0, import_sirv.default)(config.root, { dev: true, etag: true }));
1982
2042
  const httpServer = import_node_http.default.createServer(app);
1983
2043
  const ws = createWebSocketServer(httpServer);
1984
2044
  const ignoredSegments = /* @__PURE__ */ new Set(["node_modules", ".git", ".nasti"]);
1985
- const outDirAbs = import_node_path11.default.resolve(config.root, config.build.outDir);
2045
+ const outDirAbs = import_node_path12.default.resolve(config.root, config.build.outDir);
1986
2046
  const watcher = (0, import_chokidar.watch)(config.root, {
1987
2047
  ignored: (filePath) => {
1988
2048
  if (filePath === config.root) return false;
1989
- if (filePath === outDirAbs || filePath.startsWith(outDirAbs + import_node_path11.default.sep)) return true;
1990
- const rel = import_node_path11.default.relative(config.root, filePath);
1991
- if (!rel || rel.startsWith("..") || import_node_path11.default.isAbsolute(rel)) return false;
1992
- for (const seg of rel.split(import_node_path11.default.sep)) {
2049
+ if (filePath === outDirAbs || filePath.startsWith(outDirAbs + import_node_path12.default.sep)) return true;
2050
+ const rel = import_node_path12.default.relative(config.root, filePath);
2051
+ if (!rel || rel.startsWith("..") || import_node_path12.default.isAbsolute(rel)) return false;
2052
+ for (const seg of rel.split(import_node_path12.default.sep)) {
1993
2053
  if (ignoredSegments.has(seg)) return true;
1994
2054
  }
1995
2055
  return false;
@@ -2021,7 +2081,7 @@ async function createServer(inlineConfig = {}) {
2021
2081
  const localUrl = `http://localhost:${actualPort}`;
2022
2082
  const networkUrl = host === "0.0.0.0" ? `http://${getNetworkAddress()}:${actualPort}` : null;
2023
2083
  console.log();
2024
- console.log(import_picocolors3.default.cyan(" nasti dev server") + import_picocolors3.default.dim(` v${"1.6.3"}`));
2084
+ console.log(import_picocolors3.default.cyan(" nasti dev server") + import_picocolors3.default.dim(` v${"1.6.4"}`));
2025
2085
  console.log();
2026
2086
  console.log(` ${import_picocolors3.default.green(">")} Local: ${import_picocolors3.default.cyan(localUrl)}`);
2027
2087
  if (networkUrl) {
@@ -2077,12 +2137,12 @@ function getNetworkAddress() {
2077
2137
  }
2078
2138
  return "localhost";
2079
2139
  }
2080
- var import_node_http, import_node_path11, import_node_os, import_connect, import_sirv, import_chokidar, import_picocolors3;
2140
+ var import_node_http, import_node_path12, import_node_os, import_connect, import_sirv, import_chokidar, import_picocolors3;
2081
2141
  var init_server = __esm({
2082
2142
  "src/server/index.ts"() {
2083
2143
  "use strict";
2084
2144
  import_node_http = __toESM(require("http"), 1);
2085
- import_node_path11 = __toESM(require("path"), 1);
2145
+ import_node_path12 = __toESM(require("path"), 1);
2086
2146
  import_node_os = __toESM(require("os"), 1);
2087
2147
  import_connect = __toESM(require("connect"), 1);
2088
2148
  import_sirv = __toESM(require("sirv"), 1);
@@ -2118,7 +2178,7 @@ init_config();
2118
2178
  init_build();
2119
2179
 
2120
2180
  // src/build/electron.ts
2121
- var import_node_path8 = __toESM(require("path"), 1);
2181
+ var import_node_path9 = __toESM(require("path"), 1);
2122
2182
  var import_node_fs7 = __toESM(require("fs"), 1);
2123
2183
  var import_rolldown2 = require("rolldown");
2124
2184
  var import_picocolors2 = __toESM(require("picocolors"), 1);
@@ -2126,10 +2186,10 @@ init_config();
2126
2186
  init_resolve();
2127
2187
 
2128
2188
  // src/plugins/electron.ts
2129
- var import_node_module2 = require("module");
2189
+ var import_node_module3 = require("module");
2130
2190
  var NODE_BUILTINS = /* @__PURE__ */ new Set([
2131
- ...import_node_module2.builtinModules,
2132
- ...import_node_module2.builtinModules.map((m) => `node:${m}`)
2191
+ ...import_node_module3.builtinModules,
2192
+ ...import_node_module3.builtinModules.map((m) => `node:${m}`)
2133
2193
  ]);
2134
2194
  var ELECTRON_MODULES = /* @__PURE__ */ new Set([
2135
2195
  "electron",
@@ -2165,16 +2225,16 @@ async function buildElectron(inlineConfig = {}) {
2165
2225
  const config = await resolveConfig({ ...inlineConfig, target: "electron" }, "build");
2166
2226
  const startTime = performance.now();
2167
2227
  assertElectronVersion(config);
2168
- console.log(import_picocolors2.default.cyan("\n\u26A1 nasti build (electron)") + import_picocolors2.default.dim(` v${"1.6.3"}`));
2228
+ console.log(import_picocolors2.default.cyan("\n\u26A1 nasti build (electron)") + import_picocolors2.default.dim(` v${"1.6.4"}`));
2169
2229
  console.log(import_picocolors2.default.dim(` root: ${config.root}`));
2170
2230
  console.log(import_picocolors2.default.dim(` mode: ${config.mode}`));
2171
2231
  console.log(import_picocolors2.default.dim(` target: electron (\u2265 ${config.electron.minVersion})`));
2172
- const outDir = import_node_path8.default.resolve(config.root, config.build.outDir);
2232
+ const outDir = import_node_path9.default.resolve(config.root, config.build.outDir);
2173
2233
  if (config.build.emptyOutDir && import_node_fs7.default.existsSync(outDir)) {
2174
2234
  import_node_fs7.default.rmSync(outDir, { recursive: true, force: true });
2175
2235
  }
2176
2236
  import_node_fs7.default.mkdirSync(outDir, { recursive: true });
2177
- const rendererOutDir = import_node_path8.default.join(outDir, "renderer");
2237
+ const rendererOutDir = import_node_path9.default.join(outDir, "renderer");
2178
2238
  const { build: build2 } = await Promise.resolve().then(() => (init_build(), build_exports));
2179
2239
  await build2({
2180
2240
  ...inlineConfig,
@@ -2185,7 +2245,7 @@ async function buildElectron(inlineConfig = {}) {
2185
2245
  emptyOutDir: false
2186
2246
  }
2187
2247
  });
2188
- const mainEntry = import_node_path8.default.resolve(config.root, config.electron.main);
2248
+ const mainEntry = import_node_path9.default.resolve(config.root, config.electron.main);
2189
2249
  if (!import_node_fs7.default.existsSync(mainEntry)) {
2190
2250
  throw new Error(
2191
2251
  `Electron main entry not found: ${config.electron.main}
@@ -2204,7 +2264,7 @@ async function buildElectron(inlineConfig = {}) {
2204
2264
  console.warn(import_picocolors2.default.yellow(` \u26A0 preload entry not found, skipped: ${entry}`));
2205
2265
  continue;
2206
2266
  }
2207
- const base = import_node_path8.default.basename(entry).replace(/\.[^.]+$/, "");
2267
+ const base = import_node_path9.default.basename(entry).replace(/\.[^.]+$/, "");
2208
2268
  const out = outFileName(outDir, base, config.electron.preloadFormat);
2209
2269
  await bundleNode(config, entry, {
2210
2270
  outFile: out,
@@ -2216,10 +2276,10 @@ async function buildElectron(inlineConfig = {}) {
2216
2276
  const elapsed = ((performance.now() - startTime) / 1e3).toFixed(2);
2217
2277
  console.log(import_picocolors2.default.green(`
2218
2278
  \u2713 Electron build complete in ${elapsed}s`));
2219
- console.log(import_picocolors2.default.dim(` renderer: ${import_node_path8.default.relative(config.root, rendererOutDir)}/`));
2220
- console.log(import_picocolors2.default.dim(` main: ${import_node_path8.default.relative(config.root, mainFile)}`));
2279
+ console.log(import_picocolors2.default.dim(` renderer: ${import_node_path9.default.relative(config.root, rendererOutDir)}/`));
2280
+ console.log(import_picocolors2.default.dim(` main: ${import_node_path9.default.relative(config.root, mainFile)}`));
2221
2281
  for (const pf of preloadFiles) {
2222
- console.log(import_picocolors2.default.dim(` preload: ${import_node_path8.default.relative(config.root, pf)}`));
2282
+ console.log(import_picocolors2.default.dim(` preload: ${import_node_path9.default.relative(config.root, pf)}`));
2223
2283
  }
2224
2284
  console.log();
2225
2285
  return { rendererOutDir, mainFile, preloadFiles };
@@ -2250,7 +2310,7 @@ async function bundleNode(config, entry, opts) {
2250
2310
  plugins: [oxcTransformPlugin, electronPlugin(config), resolvePlugin(config)],
2251
2311
  ...config.build.rolldownOptions
2252
2312
  });
2253
- import_node_fs7.default.mkdirSync(import_node_path8.default.dirname(opts.outFile), { recursive: true });
2313
+ import_node_fs7.default.mkdirSync(import_node_path9.default.dirname(opts.outFile), { recursive: true });
2254
2314
  await bundle.write({
2255
2315
  file: opts.outFile,
2256
2316
  format: opts.format === "cjs" ? "cjs" : "esm",
@@ -2259,16 +2319,16 @@ async function bundleNode(config, entry, opts) {
2259
2319
  codeSplitting: false
2260
2320
  });
2261
2321
  await bundle.close();
2262
- console.log(import_picocolors2.default.dim(` \u2713 ${opts.label} \u2192 ${import_node_path8.default.relative(config.root, opts.outFile)}`));
2322
+ console.log(import_picocolors2.default.dim(` \u2713 ${opts.label} \u2192 ${import_node_path9.default.relative(config.root, opts.outFile)}`));
2263
2323
  return opts.outFile;
2264
2324
  }
2265
2325
  function outFileName(outDir, base, format) {
2266
2326
  const ext = format === "cjs" ? ".cjs" : ".mjs";
2267
- return import_node_path8.default.join(outDir, base + ext);
2327
+ return import_node_path9.default.join(outDir, base + ext);
2268
2328
  }
2269
2329
  function normalizePreload(preload, root) {
2270
2330
  const list = Array.isArray(preload) ? preload : preload ? [preload] : [];
2271
- return list.map((p) => import_node_path8.default.resolve(root, p));
2331
+ return list.map((p) => import_node_path9.default.resolve(root, p));
2272
2332
  }
2273
2333
  function assertElectronVersion(config) {
2274
2334
  const min = config.electron.minVersion;
@@ -2283,7 +2343,7 @@ function assertElectronVersion(config) {
2283
2343
  }
2284
2344
  function detectInstalledElectron(root) {
2285
2345
  try {
2286
- const pkgPath = import_node_path8.default.resolve(root, "node_modules/electron/package.json");
2346
+ const pkgPath = import_node_path9.default.resolve(root, "node_modules/electron/package.json");
2287
2347
  if (!import_node_fs7.default.existsSync(pkgPath)) return null;
2288
2348
  const pkg = JSON.parse(import_node_fs7.default.readFileSync(pkgPath, "utf-8"));
2289
2349
  const major = parseInt(String(pkg.version).split(".")[0], 10);
@@ -2297,9 +2357,9 @@ function detectInstalledElectron(root) {
2297
2357
  init_server();
2298
2358
 
2299
2359
  // src/server/electron-dev.ts
2300
- var import_node_path12 = __toESM(require("path"), 1);
2360
+ var import_node_path13 = __toESM(require("path"), 1);
2301
2361
  var import_node_fs10 = __toESM(require("fs"), 1);
2302
- var import_node_module4 = require("module");
2362
+ var import_node_module5 = require("module");
2303
2363
  var import_node_child_process = require("child_process");
2304
2364
  var import_chokidar2 = __toESM(require("chokidar"), 1);
2305
2365
  var import_picocolors4 = __toESM(require("picocolors"), 1);
@@ -2312,17 +2372,17 @@ async function startElectronDev(inlineConfig = {}) {
2312
2372
  const { noSpawn, ...rest } = inlineConfig;
2313
2373
  const config = await resolveConfig({ ...rest, target: "electron" }, "serve");
2314
2374
  warnElectronVersion(config);
2315
- console.log(import_picocolors4.default.cyan("\n\u26A1 nasti electron dev") + import_picocolors4.default.dim(` v${"1.6.3"}`));
2375
+ console.log(import_picocolors4.default.cyan("\n\u26A1 nasti electron dev") + import_picocolors4.default.dim(` v${"1.6.4"}`));
2316
2376
  const { createServer: createServer2 } = await Promise.resolve().then(() => (init_server(), server_exports));
2317
2377
  const server = await createServer2({ ...rest, target: "electron" });
2318
2378
  await server.listen();
2319
2379
  const devUrl = `http://localhost:${server.config.server.port}/`;
2320
2380
  console.log(import_picocolors4.default.dim(` renderer: ${devUrl}`));
2321
- const stageDir = import_node_path12.default.resolve(config.root, ".nasti");
2381
+ const stageDir = import_node_path13.default.resolve(config.root, ".nasti");
2322
2382
  import_node_fs10.default.mkdirSync(stageDir, { recursive: true });
2323
- const mainEntry = import_node_path12.default.resolve(config.root, config.electron.main);
2383
+ const mainEntry = import_node_path13.default.resolve(config.root, config.electron.main);
2324
2384
  const preloadEntries = normalizePreload(config.electron.preload, config.root);
2325
- const builtMainFile = import_node_path12.default.join(stageDir, "main" + extFor(config.electron.mainFormat));
2385
+ const builtMainFile = import_node_path13.default.join(stageDir, "main" + extFor(config.electron.mainFormat));
2326
2386
  const builtPreloadFiles = [];
2327
2387
  const compileAll = async () => {
2328
2388
  await compileNode(config, mainEntry, {
@@ -2333,8 +2393,8 @@ async function startElectronDev(inlineConfig = {}) {
2333
2393
  builtPreloadFiles.length = 0;
2334
2394
  for (const entry of preloadEntries) {
2335
2395
  if (!import_node_fs10.default.existsSync(entry)) continue;
2336
- const base = import_node_path12.default.basename(entry).replace(/\.[^.]+$/, "");
2337
- const out = import_node_path12.default.join(stageDir, base + extFor(config.electron.preloadFormat));
2396
+ const base = import_node_path13.default.basename(entry).replace(/\.[^.]+$/, "");
2397
+ const out = import_node_path13.default.join(stageDir, base + extFor(config.electron.preloadFormat));
2338
2398
  await compileNode(config, entry, {
2339
2399
  outFile: out,
2340
2400
  format: config.electron.preloadFormat,
@@ -2449,7 +2509,7 @@ async function compileNode(config, entry, opts) {
2449
2509
  platform: "node",
2450
2510
  plugins: [oxcTransformPlugin, electronPlugin(config), resolvePlugin(config)]
2451
2511
  });
2452
- import_node_fs10.default.mkdirSync(import_node_path12.default.dirname(opts.outFile), { recursive: true });
2512
+ import_node_fs10.default.mkdirSync(import_node_path13.default.dirname(opts.outFile), { recursive: true });
2453
2513
  await bundle.write({
2454
2514
  file: opts.outFile,
2455
2515
  format: opts.format === "cjs" ? "cjs" : "esm",
@@ -2466,7 +2526,7 @@ function resolveElectronBinary(config) {
2466
2526
  return config.electron.electronPath;
2467
2527
  }
2468
2528
  try {
2469
- const require2 = (0, import_node_module4.createRequire)(import_node_path12.default.resolve(config.root, "package.json"));
2529
+ const require2 = (0, import_node_module5.createRequire)(import_node_path13.default.resolve(config.root, "package.json"));
2470
2530
  const pathFile = require2.resolve("electron");
2471
2531
  const electronModule = require2(pathFile);
2472
2532
  if (typeof electronModule === "string" && import_node_fs10.default.existsSync(electronModule)) {
@@ -2496,10 +2556,10 @@ function warnElectronVersion(config) {
2496
2556
  }
2497
2557
 
2498
2558
  // src/plugins/monaco-editor.ts
2499
- var import_node_path13 = __toESM(require("path"), 1);
2559
+ var import_node_path14 = __toESM(require("path"), 1);
2500
2560
  var import_node_fs11 = __toESM(require("fs"), 1);
2501
2561
  var import_node_crypto2 = __toESM(require("crypto"), 1);
2502
- var import_node_module5 = require("module");
2562
+ var import_node_module6 = require("module");
2503
2563
  var DEFAULT_WORKERS = {
2504
2564
  editorWorkerService: "monaco-editor/esm/vs/editor/editor.worker",
2505
2565
  css: "monaco-editor/esm/vs/language/css/css.worker",
@@ -2518,7 +2578,7 @@ function normalizePublicPath(p) {
2518
2578
  }
2519
2579
  function readMonacoVersion(root) {
2520
2580
  try {
2521
- const require2 = (0, import_node_module5.createRequire)(import_node_path13.default.resolve(root, "package.json"));
2581
+ const require2 = (0, import_node_module6.createRequire)(import_node_path14.default.resolve(root, "package.json"));
2522
2582
  const pkgJsonPath = require2.resolve("monaco-editor/package.json", { paths: [root] });
2523
2583
  const pkg = JSON.parse(import_node_fs11.default.readFileSync(pkgJsonPath, "utf-8"));
2524
2584
  return typeof pkg.version === "string" ? pkg.version : "unknown";
@@ -2540,13 +2600,13 @@ function monacoEditorPlugin(options = {}) {
2540
2600
  let cacheDir = "";
2541
2601
  const building = /* @__PURE__ */ new Map();
2542
2602
  async function buildWorker(worker) {
2543
- const cacheFile = import_node_path13.default.join(cacheDir, `${worker.label}.worker.js`);
2603
+ const cacheFile = import_node_path14.default.join(cacheDir, `${worker.label}.worker.js`);
2544
2604
  if (import_node_fs11.default.existsSync(cacheFile)) return cacheFile;
2545
2605
  const existing = building.get(worker.label);
2546
2606
  if (existing) return existing;
2547
2607
  const task = (async () => {
2548
2608
  const { rolldown: rolldown4 } = await import("rolldown");
2549
- const require2 = (0, import_node_module5.createRequire)(import_node_path13.default.resolve(resolvedConfig.root, "package.json"));
2609
+ const require2 = (0, import_node_module6.createRequire)(import_node_path14.default.resolve(resolvedConfig.root, "package.json"));
2550
2610
  let entry;
2551
2611
  try {
2552
2612
  entry = require2.resolve(worker.entry, { paths: [resolvedConfig.root] });
@@ -2613,12 +2673,12 @@ function monacoEditorPlugin(options = {}) {
2613
2673
  resolvedConfig = config;
2614
2674
  const version = readMonacoVersion(config.root);
2615
2675
  const key = import_node_crypto2.default.createHash("sha1").update(version + "|" + publicPath).digest("hex").slice(0, 8);
2616
- cacheDir = import_node_path13.default.resolve(config.root, "node_modules/.nasti/monaco", key);
2676
+ cacheDir = import_node_path14.default.resolve(config.root, "node_modules/.nasti/monaco", key);
2617
2677
  },
2618
2678
  async configureServer(server) {
2619
2679
  const shouldBuild = !isCDN(publicPath) || forceBuildCDN;
2620
2680
  const watcher = server.watcher;
2621
- const monacoDir = import_node_path13.default.resolve(resolvedConfig.root, "node_modules/monaco-editor");
2681
+ const monacoDir = import_node_path14.default.resolve(resolvedConfig.root, "node_modules/monaco-editor");
2622
2682
  try {
2623
2683
  watcher?.unwatch?.(monacoDir);
2624
2684
  } catch {
@@ -2683,7 +2743,7 @@ self.monaco = monaco;`,
2683
2743
  resolvedConfig.root,
2684
2744
  resolvedConfig.build.outDir,
2685
2745
  resolvedConfig.base
2686
- ) : isCDN(publicPath) ? import_node_path13.default.resolve(resolvedConfig.root, resolvedConfig.build.outDir, "monaco") : import_node_path13.default.resolve(
2746
+ ) : isCDN(publicPath) ? import_node_path14.default.resolve(resolvedConfig.root, resolvedConfig.build.outDir, "monaco") : import_node_path14.default.resolve(
2687
2747
  resolvedConfig.root,
2688
2748
  resolvedConfig.build.outDir,
2689
2749
  publicPath.replace(/^\//, "")
@@ -2692,7 +2752,7 @@ self.monaco = monaco;`,
2692
2752
  for (const worker of workers) {
2693
2753
  try {
2694
2754
  const cacheFile = await buildWorker(worker);
2695
- import_node_fs11.default.copyFileSync(cacheFile, import_node_path13.default.join(outDir, `${worker.label}.worker.js`));
2755
+ import_node_fs11.default.copyFileSync(cacheFile, import_node_path14.default.join(outDir, `${worker.label}.worker.js`));
2696
2756
  } catch (e) {
2697
2757
  throw new Error(
2698
2758
  `[nasti:monaco-editor] worker build failed for "${worker.label}": ${e.message}