@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/cli.cjs +31 -14
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +31 -14
- package/dist/cli.js.map +1 -1
- package/dist/index.cjs +31 -14
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +31 -14
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -744,9 +744,17 @@ function getReactRefreshRuntimeEsm() {
|
|
|
744
744
|
if (__refreshRuntimeCache) return __refreshRuntimeCache;
|
|
745
745
|
let cjsPath;
|
|
746
746
|
try {
|
|
747
|
-
|
|
748
|
-
|
|
747
|
+
const pkgPath = __require.resolve("react-refresh/package.json");
|
|
748
|
+
cjsPath = path4.join(path4.dirname(pkgPath), "cjs", "react-refresh-runtime.development.js");
|
|
749
|
+
} catch (err) {
|
|
749
750
|
cjsPath = path4.resolve(__dirname_esm, "../../node_modules/react-refresh/cjs/react-refresh-runtime.development.js");
|
|
751
|
+
if (!fs4.existsSync(cjsPath)) {
|
|
752
|
+
const origMsg = err instanceof Error ? err.message : String(err);
|
|
753
|
+
throw new Error(
|
|
754
|
+
`[nasti] Missing dependency "react-refresh". Install it with: npm install react-refresh
|
|
755
|
+
Original resolve error: ${origMsg}`
|
|
756
|
+
);
|
|
757
|
+
}
|
|
750
758
|
}
|
|
751
759
|
const cjsSource = fs4.readFileSync(cjsPath, "utf-8");
|
|
752
760
|
__refreshRuntimeCache = `// Wrapped react-refresh runtime -> ESM
|
|
@@ -1596,12 +1604,19 @@ async function createServer(inlineConfig = {}) {
|
|
|
1596
1604
|
app.use(sirv(config.root, { dev: true, etag: true }));
|
|
1597
1605
|
const httpServer = http.createServer(app);
|
|
1598
1606
|
const ws = createWebSocketServer(httpServer);
|
|
1607
|
+
const ignoredSegments = /* @__PURE__ */ new Set(["node_modules", ".git", ".nasti"]);
|
|
1608
|
+
const outDirAbs = path9.resolve(config.root, config.build.outDir);
|
|
1599
1609
|
const watcher = watch(config.root, {
|
|
1600
|
-
ignored:
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1610
|
+
ignored: (filePath) => {
|
|
1611
|
+
if (filePath === config.root) return false;
|
|
1612
|
+
if (filePath === outDirAbs || filePath.startsWith(outDirAbs + path9.sep)) return true;
|
|
1613
|
+
const rel = path9.relative(config.root, filePath);
|
|
1614
|
+
if (!rel || rel.startsWith("..") || path9.isAbsolute(rel)) return false;
|
|
1615
|
+
for (const seg of rel.split(path9.sep)) {
|
|
1616
|
+
if (ignoredSegments.has(seg)) return true;
|
|
1617
|
+
}
|
|
1618
|
+
return false;
|
|
1619
|
+
},
|
|
1605
1620
|
ignoreInitial: true
|
|
1606
1621
|
});
|
|
1607
1622
|
let server;
|
|
@@ -1629,7 +1644,7 @@ async function createServer(inlineConfig = {}) {
|
|
|
1629
1644
|
const localUrl = `http://localhost:${actualPort}`;
|
|
1630
1645
|
const networkUrl = host === "0.0.0.0" ? `http://${getNetworkAddress()}:${actualPort}` : null;
|
|
1631
1646
|
console.log();
|
|
1632
|
-
console.log(pc.cyan(" nasti dev server") + pc.dim(` v${"1.
|
|
1647
|
+
console.log(pc.cyan(" nasti dev server") + pc.dim(` v${"1.6.0"}`));
|
|
1633
1648
|
console.log();
|
|
1634
1649
|
console.log(` ${pc.green(">")} Local: ${pc.cyan(localUrl)}`);
|
|
1635
1650
|
if (networkUrl) {
|
|
@@ -1752,7 +1767,7 @@ import pc2 from "picocolors";
|
|
|
1752
1767
|
async function build(inlineConfig = {}) {
|
|
1753
1768
|
const config = await resolveConfig(inlineConfig, "build");
|
|
1754
1769
|
const startTime = performance.now();
|
|
1755
|
-
console.log(pc2.cyan("\n\u{1F528} nasti build") + pc2.dim(` v${"1.
|
|
1770
|
+
console.log(pc2.cyan("\n\u{1F528} nasti build") + pc2.dim(` v${"1.6.0"}`));
|
|
1756
1771
|
console.log(pc2.dim(` root: ${config.root}`));
|
|
1757
1772
|
console.log(pc2.dim(` mode: ${config.mode}`));
|
|
1758
1773
|
const outDir = path10.resolve(config.root, config.build.outDir);
|
|
@@ -1912,7 +1927,7 @@ async function buildElectron(inlineConfig = {}) {
|
|
|
1912
1927
|
const config = await resolveConfig({ ...inlineConfig, target: "electron" }, "build");
|
|
1913
1928
|
const startTime = performance.now();
|
|
1914
1929
|
assertElectronVersion(config);
|
|
1915
|
-
console.log(pc3.cyan("\n\u26A1 nasti build (electron)") + pc3.dim(` v${"1.
|
|
1930
|
+
console.log(pc3.cyan("\n\u26A1 nasti build (electron)") + pc3.dim(` v${"1.6.0"}`));
|
|
1916
1931
|
console.log(pc3.dim(` root: ${config.root}`));
|
|
1917
1932
|
console.log(pc3.dim(` mode: ${config.mode}`));
|
|
1918
1933
|
console.log(pc3.dim(` target: electron (\u2265 ${config.electron.minVersion})`));
|
|
@@ -2003,7 +2018,7 @@ async function bundleNode(config, entry, opts) {
|
|
|
2003
2018
|
format: opts.format === "cjs" ? "cjs" : "esm",
|
|
2004
2019
|
sourcemap: !!config.build.sourcemap,
|
|
2005
2020
|
minify: !!config.build.minify,
|
|
2006
|
-
|
|
2021
|
+
codeSplitting: false
|
|
2007
2022
|
});
|
|
2008
2023
|
await bundle.close();
|
|
2009
2024
|
console.log(pc3.dim(` \u2713 ${opts.label} \u2192 ${path11.relative(config.root, opts.outFile)}`));
|
|
@@ -2066,7 +2081,7 @@ async function startElectronDev(inlineConfig = {}) {
|
|
|
2066
2081
|
const { noSpawn, ...rest } = inlineConfig;
|
|
2067
2082
|
const config = await resolveConfig({ ...rest, target: "electron" }, "serve");
|
|
2068
2083
|
warnElectronVersion(config);
|
|
2069
|
-
console.log(pc4.cyan("\n\u26A1 nasti electron dev") + pc4.dim(` v${"1.
|
|
2084
|
+
console.log(pc4.cyan("\n\u26A1 nasti electron dev") + pc4.dim(` v${"1.6.0"}`));
|
|
2070
2085
|
const { createServer: createServer2 } = await Promise.resolve().then(() => (init_server(), server_exports));
|
|
2071
2086
|
const server = await createServer2({ ...rest, target: "electron" });
|
|
2072
2087
|
await server.listen();
|
|
@@ -2209,7 +2224,9 @@ async function compileNode(config, entry, opts) {
|
|
|
2209
2224
|
format: opts.format === "cjs" ? "cjs" : "esm",
|
|
2210
2225
|
sourcemap: false,
|
|
2211
2226
|
minify: false,
|
|
2212
|
-
inlineDynamicImports:
|
|
2227
|
+
// rolldown 已弃用 inlineDynamicImports,改用 codeSplitting:false 表达
|
|
2228
|
+
// 同样语义(单 chunk、内联 dynamic import)
|
|
2229
|
+
codeSplitting: false
|
|
2213
2230
|
});
|
|
2214
2231
|
await bundle.close();
|
|
2215
2232
|
}
|
|
@@ -2391,6 +2408,6 @@ cli.command("preview [root]", "Preview production build").option("--port <port>"
|
|
|
2391
2408
|
}
|
|
2392
2409
|
});
|
|
2393
2410
|
cli.help();
|
|
2394
|
-
cli.version("1.
|
|
2411
|
+
cli.version("1.6.0");
|
|
2395
2412
|
cli.parse();
|
|
2396
2413
|
//# sourceMappingURL=cli.js.map
|