@nasti-toolchain/nasti 1.5.1 → 1.6.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/index.cjs CHANGED
@@ -814,7 +814,7 @@ __export(build_exports, {
814
814
  async function build(inlineConfig = {}) {
815
815
  const config = await resolveConfig(inlineConfig, "build");
816
816
  const startTime = performance.now();
817
- console.log(import_picocolors.default.cyan("\n\u{1F528} nasti build") + import_picocolors.default.dim(` v${"1.5.1"}`));
817
+ console.log(import_picocolors.default.cyan("\n\u{1F528} nasti build") + import_picocolors.default.dim(` v${"1.6.0"}`));
818
818
  console.log(import_picocolors.default.dim(` root: ${config.root}`));
819
819
  console.log(import_picocolors.default.dim(` mode: ${config.mode}`));
820
820
  const outDir = import_node_path7.default.resolve(config.root, config.build.outDir);
@@ -1132,9 +1132,17 @@ function getReactRefreshRuntimeEsm() {
1132
1132
  if (__refreshRuntimeCache) return __refreshRuntimeCache;
1133
1133
  let cjsPath;
1134
1134
  try {
1135
- cjsPath = __require.resolve("react-refresh/cjs/react-refresh-runtime.development.js");
1136
- } catch {
1135
+ const pkgPath = __require.resolve("react-refresh/package.json");
1136
+ cjsPath = import_node_path9.default.join(import_node_path9.default.dirname(pkgPath), "cjs", "react-refresh-runtime.development.js");
1137
+ } catch (err) {
1137
1138
  cjsPath = import_node_path9.default.resolve(__dirname_esm, "../../node_modules/react-refresh/cjs/react-refresh-runtime.development.js");
1139
+ if (!import_node_fs8.default.existsSync(cjsPath)) {
1140
+ const origMsg = err instanceof Error ? err.message : String(err);
1141
+ throw new Error(
1142
+ `[nasti] Missing dependency "react-refresh". Install it with: npm install react-refresh
1143
+ Original resolve error: ${origMsg}`
1144
+ );
1145
+ }
1138
1146
  }
1139
1147
  const cjsSource = import_node_fs8.default.readFileSync(cjsPath, "utf-8");
1140
1148
  __refreshRuntimeCache = `// Wrapped react-refresh runtime -> ESM
@@ -1778,12 +1786,19 @@ async function createServer(inlineConfig = {}) {
1778
1786
  app.use((0, import_sirv.default)(config.root, { dev: true, etag: true }));
1779
1787
  const httpServer = import_node_http.default.createServer(app);
1780
1788
  const ws = createWebSocketServer(httpServer);
1789
+ const ignoredSegments = /* @__PURE__ */ new Set(["node_modules", ".git", ".nasti"]);
1790
+ const outDirAbs = import_node_path11.default.resolve(config.root, config.build.outDir);
1781
1791
  const watcher = (0, import_chokidar.watch)(config.root, {
1782
- ignored: [
1783
- "**/node_modules/**",
1784
- "**/.git/**",
1785
- `**/${config.build.outDir}/**`
1786
- ],
1792
+ ignored: (filePath) => {
1793
+ if (filePath === config.root) return false;
1794
+ if (filePath === outDirAbs || filePath.startsWith(outDirAbs + import_node_path11.default.sep)) return true;
1795
+ const rel = import_node_path11.default.relative(config.root, filePath);
1796
+ if (!rel || rel.startsWith("..") || import_node_path11.default.isAbsolute(rel)) return false;
1797
+ for (const seg of rel.split(import_node_path11.default.sep)) {
1798
+ if (ignoredSegments.has(seg)) return true;
1799
+ }
1800
+ return false;
1801
+ },
1787
1802
  ignoreInitial: true
1788
1803
  });
1789
1804
  let server;
@@ -1811,7 +1826,7 @@ async function createServer(inlineConfig = {}) {
1811
1826
  const localUrl = `http://localhost:${actualPort}`;
1812
1827
  const networkUrl = host === "0.0.0.0" ? `http://${getNetworkAddress()}:${actualPort}` : null;
1813
1828
  console.log();
1814
- console.log(import_picocolors3.default.cyan(" nasti dev server") + import_picocolors3.default.dim(` v${"1.5.1"}`));
1829
+ console.log(import_picocolors3.default.cyan(" nasti dev server") + import_picocolors3.default.dim(` v${"1.6.0"}`));
1815
1830
  console.log();
1816
1831
  console.log(` ${import_picocolors3.default.green(">")} Local: ${import_picocolors3.default.cyan(localUrl)}`);
1817
1832
  if (networkUrl) {
@@ -1955,7 +1970,7 @@ async function buildElectron(inlineConfig = {}) {
1955
1970
  const config = await resolveConfig({ ...inlineConfig, target: "electron" }, "build");
1956
1971
  const startTime = performance.now();
1957
1972
  assertElectronVersion(config);
1958
- console.log(import_picocolors2.default.cyan("\n\u26A1 nasti build (electron)") + import_picocolors2.default.dim(` v${"1.5.1"}`));
1973
+ console.log(import_picocolors2.default.cyan("\n\u26A1 nasti build (electron)") + import_picocolors2.default.dim(` v${"1.6.0"}`));
1959
1974
  console.log(import_picocolors2.default.dim(` root: ${config.root}`));
1960
1975
  console.log(import_picocolors2.default.dim(` mode: ${config.mode}`));
1961
1976
  console.log(import_picocolors2.default.dim(` target: electron (\u2265 ${config.electron.minVersion})`));
@@ -2046,7 +2061,7 @@ async function bundleNode(config, entry, opts) {
2046
2061
  format: opts.format === "cjs" ? "cjs" : "esm",
2047
2062
  sourcemap: !!config.build.sourcemap,
2048
2063
  minify: !!config.build.minify,
2049
- inlineDynamicImports: true
2064
+ codeSplitting: false
2050
2065
  });
2051
2066
  await bundle.close();
2052
2067
  console.log(import_picocolors2.default.dim(` \u2713 ${opts.label} \u2192 ${import_node_path8.default.relative(config.root, opts.outFile)}`));
@@ -2102,7 +2117,7 @@ async function startElectronDev(inlineConfig = {}) {
2102
2117
  const { noSpawn, ...rest } = inlineConfig;
2103
2118
  const config = await resolveConfig({ ...rest, target: "electron" }, "serve");
2104
2119
  warnElectronVersion(config);
2105
- console.log(import_picocolors4.default.cyan("\n\u26A1 nasti electron dev") + import_picocolors4.default.dim(` v${"1.5.1"}`));
2120
+ console.log(import_picocolors4.default.cyan("\n\u26A1 nasti electron dev") + import_picocolors4.default.dim(` v${"1.6.0"}`));
2106
2121
  const { createServer: createServer2 } = await Promise.resolve().then(() => (init_server(), server_exports));
2107
2122
  const server = await createServer2({ ...rest, target: "electron" });
2108
2123
  await server.listen();
@@ -2245,7 +2260,9 @@ async function compileNode(config, entry, opts) {
2245
2260
  format: opts.format === "cjs" ? "cjs" : "esm",
2246
2261
  sourcemap: false,
2247
2262
  minify: false,
2248
- inlineDynamicImports: true
2263
+ // rolldown 已弃用 inlineDynamicImports,改用 codeSplitting:false 表达
2264
+ // 同样语义(单 chunk、内联 dynamic import)
2265
+ codeSplitting: false
2249
2266
  });
2250
2267
  await bundle.close();
2251
2268
  }
@@ -2351,7 +2368,7 @@ function monacoEditorPlugin(options = {}) {
2351
2368
  format: "iife",
2352
2369
  sourcemap: false,
2353
2370
  minify: true,
2354
- inlineDynamicImports: true
2371
+ codeSplitting: false
2355
2372
  });
2356
2373
  await bundle.close();
2357
2374
  return cacheFile;