@nasti-toolchain/nasti 2.0.2 → 2.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/cli.cjs +29 -19
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +29 -19
- package/dist/cli.js.map +1 -1
- package/dist/index.cjs +27 -17
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +27 -17
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -1867,7 +1867,7 @@ const hotModulesMap = new Map();
|
|
|
1867
1867
|
const disposeMap = new Map();
|
|
1868
1868
|
const pruneMap = new Map();
|
|
1869
1869
|
|
|
1870
|
-
socket.addEventListener('message', ({ data }) => {
|
|
1870
|
+
socket.addEventListener('message', async ({ data }) => {
|
|
1871
1871
|
const payload = JSON.parse(data);
|
|
1872
1872
|
switch (payload.type) {
|
|
1873
1873
|
case 'connected':
|
|
@@ -1875,14 +1875,21 @@ socket.addEventListener('message', ({ data }) => {
|
|
|
1875
1875
|
clearErrorOverlay();
|
|
1876
1876
|
break;
|
|
1877
1877
|
case 'update':
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
|
|
1878
|
+
try {
|
|
1879
|
+
await Promise.all(payload.updates.map((update) => {
|
|
1880
|
+
if (update.type === 'js-update') {
|
|
1881
|
+
return fetchUpdate(update);
|
|
1882
|
+
} else if (update.type === 'css-update') {
|
|
1883
|
+
return updateCss(update.path);
|
|
1884
|
+
}
|
|
1885
|
+
}));
|
|
1886
|
+
clearErrorOverlay();
|
|
1887
|
+
console.log('[nasti] HMR update complete, reloading page');
|
|
1888
|
+
location.reload();
|
|
1889
|
+
} catch (err) {
|
|
1890
|
+
console.error('[nasti] HMR update failed:', err);
|
|
1891
|
+
showErrorOverlay(err);
|
|
1892
|
+
}
|
|
1886
1893
|
break;
|
|
1887
1894
|
case 'full-reload':
|
|
1888
1895
|
console.log('[nasti] full reload');
|
|
@@ -1924,7 +1931,7 @@ async function fetchUpdate(update) {
|
|
|
1924
1931
|
function updateCss(path) {
|
|
1925
1932
|
const el = document.querySelector(\`style[data-nasti-css="\${path}"]\`);
|
|
1926
1933
|
if (el) {
|
|
1927
|
-
fetch(path + '?t=' + Date.now())
|
|
1934
|
+
return fetch(path + '?t=' + Date.now())
|
|
1928
1935
|
.then(r => r.text())
|
|
1929
1936
|
.then(css => { el.textContent = css; });
|
|
1930
1937
|
}
|
|
@@ -4040,7 +4047,7 @@ async function build(inlineConfig = {}) {
|
|
|
4040
4047
|
const startTime = performance.now();
|
|
4041
4048
|
logger.info(
|
|
4042
4049
|
pc6.cyan(`
|
|
4043
|
-
nasti v${"2.0
|
|
4050
|
+
nasti v${"2.2.0"} `) + pc6.green(`building for ${config.mode}...`)
|
|
4044
4051
|
);
|
|
4045
4052
|
debug5?.(`root: ${config.root}`);
|
|
4046
4053
|
const buildableNames = Object.keys(config.environments).filter(
|
|
@@ -4288,7 +4295,10 @@ async function createBundledDevServer(opts) {
|
|
|
4288
4295
|
continue;
|
|
4289
4296
|
}
|
|
4290
4297
|
const patchPath = `__nasti_patch/${update.filename}`;
|
|
4291
|
-
patches.set(
|
|
4298
|
+
patches.set(
|
|
4299
|
+
patchPath,
|
|
4300
|
+
update.code + "\n;globalThis.location?.reload();\n;export {}"
|
|
4301
|
+
);
|
|
4292
4302
|
if (update.sourcemap && update.sourcemapFilename) {
|
|
4293
4303
|
patches.set(`__nasti_patch/${update.sourcemapFilename}`, update.sourcemap);
|
|
4294
4304
|
}
|
|
@@ -4761,7 +4771,7 @@ async function createServer(inlineConfig = {}) {
|
|
|
4761
4771
|
const readyIn = Math.ceil(performance.now() - startTime);
|
|
4762
4772
|
logger.info(
|
|
4763
4773
|
`
|
|
4764
|
-
${pc8.cyan(pc8.bold("NASTI"))} ${pc8.cyan(`v${"2.0
|
|
4774
|
+
${pc8.cyan(pc8.bold("NASTI"))} ${pc8.cyan(`v${"2.2.0"}`)} ${pc8.dim("ready in")} ${pc8.bold(readyIn)} ${pc8.dim("ms")}
|
|
4765
4775
|
`
|
|
4766
4776
|
);
|
|
4767
4777
|
printServerUrls(
|
|
@@ -4891,7 +4901,7 @@ async function buildElectron(inlineConfig = {}) {
|
|
|
4891
4901
|
const config = await resolveConfig({ ...inlineConfig, target: "electron" }, "build");
|
|
4892
4902
|
const startTime = performance.now();
|
|
4893
4903
|
assertElectronVersion(config);
|
|
4894
|
-
console.log(pc9.cyan("\n\u26A1 nasti build (electron)") + pc9.dim(` v${"2.0
|
|
4904
|
+
console.log(pc9.cyan("\n\u26A1 nasti build (electron)") + pc9.dim(` v${"2.2.0"}`));
|
|
4895
4905
|
console.log(pc9.dim(` root: ${config.root}`));
|
|
4896
4906
|
console.log(pc9.dim(` mode: ${config.mode}`));
|
|
4897
4907
|
console.log(pc9.dim(` target: electron (\u2265 ${config.electron.minVersion})`));
|
|
@@ -5049,7 +5059,7 @@ async function startElectronDev(inlineConfig = {}) {
|
|
|
5049
5059
|
const { noSpawn, ...rest } = inlineConfig;
|
|
5050
5060
|
const config = await resolveConfig({ ...rest, target: "electron" }, "serve");
|
|
5051
5061
|
warnElectronVersion(config);
|
|
5052
|
-
console.log(pc10.cyan("\n\u26A1 nasti electron dev") + pc10.dim(` v${"2.0
|
|
5062
|
+
console.log(pc10.cyan("\n\u26A1 nasti electron dev") + pc10.dim(` v${"2.2.0"}`));
|
|
5053
5063
|
const { createServer: createServer2 } = await Promise.resolve().then(() => (init_server(), server_exports));
|
|
5054
5064
|
const server = await createServer2({ ...rest, target: "electron" });
|
|
5055
5065
|
await server.listen();
|
|
@@ -5173,7 +5183,7 @@ async function compileNode(config, entry, opts) {
|
|
|
5173
5183
|
transform(code, id) {
|
|
5174
5184
|
if (!shouldTransform(id)) return null;
|
|
5175
5185
|
const result = transformCode(id, code, {
|
|
5176
|
-
sourcemap:
|
|
5186
|
+
sourcemap: true,
|
|
5177
5187
|
jsxRuntime: "automatic",
|
|
5178
5188
|
jsxImportSource: config.framework === "vue" ? "vue" : "react"
|
|
5179
5189
|
});
|
|
@@ -5190,7 +5200,7 @@ async function compileNode(config, entry, opts) {
|
|
|
5190
5200
|
await bundle2.write({
|
|
5191
5201
|
file: opts.outFile,
|
|
5192
5202
|
format: opts.format === "cjs" ? "cjs" : "esm",
|
|
5193
|
-
sourcemap:
|
|
5203
|
+
sourcemap: true,
|
|
5194
5204
|
minify: false,
|
|
5195
5205
|
// rolldown 已弃用 inlineDynamicImports,改用 codeSplitting:false 表达
|
|
5196
5206
|
// 同样语义(单 chunk、内联 dynamic import)
|
|
@@ -5394,7 +5404,7 @@ cli.command("preview [root]", "Preview production build").option("--port <port>"
|
|
|
5394
5404
|
const host = options.host === true ? "0.0.0.0" : options.host ?? "localhost";
|
|
5395
5405
|
http2.createServer(app).listen(port, host, () => {
|
|
5396
5406
|
logger.info(`
|
|
5397
|
-
${pc11.cyan(pc11.bold("NASTI"))} ${pc11.cyan(`v${"2.0
|
|
5407
|
+
${pc11.cyan(pc11.bold("NASTI"))} ${pc11.cyan(`v${"2.2.0"}`)} ${pc11.dim("preview")}
|
|
5398
5408
|
`);
|
|
5399
5409
|
printServerUrls2(
|
|
5400
5410
|
{
|
|
@@ -5411,6 +5421,6 @@ cli.command("preview [root]", "Preview production build").option("--port <port>"
|
|
|
5411
5421
|
}
|
|
5412
5422
|
});
|
|
5413
5423
|
cli.help();
|
|
5414
|
-
cli.version("2.0
|
|
5424
|
+
cli.version("2.2.0");
|
|
5415
5425
|
cli.parse();
|
|
5416
5426
|
//# sourceMappingURL=cli.js.map
|