@nasti-toolchain/nasti 2.0.1 → 2.0.2
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 +17 -14
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +17 -14
- package/dist/cli.js.map +1 -1
- package/dist/index.cjs +15 -12
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +15 -12
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -2871,7 +2871,7 @@ async function build(inlineConfig = {}) {
|
|
|
2871
2871
|
const startTime = performance.now();
|
|
2872
2872
|
logger.info(
|
|
2873
2873
|
import_picocolors4.default.cyan(`
|
|
2874
|
-
nasti v${"2.0.
|
|
2874
|
+
nasti v${"2.0.2"} `) + import_picocolors4.default.green(`building for ${config.mode}...`)
|
|
2875
2875
|
);
|
|
2876
2876
|
debug4?.(`root: ${config.root}`);
|
|
2877
2877
|
const buildableNames = Object.keys(config.environments).filter(
|
|
@@ -3401,15 +3401,15 @@ async function doBundlePackage(entryFile, root) {
|
|
|
3401
3401
|
const externalBaseDir = import_node_path11.default.dirname(entryFile);
|
|
3402
3402
|
code = code.replace(
|
|
3403
3403
|
/^(import\b[^;'"]*?\bfrom\s+)(['"])([^'"./][^'"]*)(\2)/gm,
|
|
3404
|
-
(_, prefix, q, spec) => `${prefix}${q}${externalSpecToModuleUrl(spec, externalBaseDir)}${q}`
|
|
3404
|
+
(_, prefix, q, spec) => `${prefix}${q}${externalSpecToModuleUrl(spec, externalBaseDir, root)}${q}`
|
|
3405
3405
|
).replace(
|
|
3406
3406
|
/^(export\b[^;'"]*?\bfrom\s+)(['"])([^'"./][^'"]*)(\2)/gm,
|
|
3407
|
-
(_, prefix, q, spec) => `${prefix}${q}${externalSpecToModuleUrl(spec, externalBaseDir)}${q}`
|
|
3407
|
+
(_, prefix, q, spec) => `${prefix}${q}${externalSpecToModuleUrl(spec, externalBaseDir, root)}${q}`
|
|
3408
3408
|
).replace(
|
|
3409
3409
|
/^(import\s+)(['"])([^'"./][^'"]*)(\2)/gm,
|
|
3410
|
-
(_, prefix, q, spec) => `${prefix}${q}${externalSpecToModuleUrl(spec, externalBaseDir)}${q}`
|
|
3410
|
+
(_, prefix, q, spec) => `${prefix}${q}${externalSpecToModuleUrl(spec, externalBaseDir, root)}${q}`
|
|
3411
3411
|
);
|
|
3412
|
-
code = rewriteExternalRequires(code, externalBaseDir);
|
|
3412
|
+
code = rewriteExternalRequires(code, externalBaseDir, root);
|
|
3413
3413
|
if (code.includes("__commonJSMin")) {
|
|
3414
3414
|
code = await injectCjsNamedExports(code, entryFile);
|
|
3415
3415
|
}
|
|
@@ -3514,7 +3514,7 @@ function pickMainEntryByExtension(pkgDir, preferredExt) {
|
|
|
3514
3514
|
}
|
|
3515
3515
|
return null;
|
|
3516
3516
|
}
|
|
3517
|
-
function rewriteExternalRequires(code, baseDir) {
|
|
3517
|
+
function rewriteExternalRequires(code, baseDir, root) {
|
|
3518
3518
|
const pkgs = /* @__PURE__ */ new Set();
|
|
3519
3519
|
const re = /__require\(["']([^"']+)["']\)/g;
|
|
3520
3520
|
let m;
|
|
@@ -3526,7 +3526,7 @@ function rewriteExternalRequires(code, baseDir) {
|
|
|
3526
3526
|
const imports = [];
|
|
3527
3527
|
for (const pkg of pkgs) {
|
|
3528
3528
|
const safe = pkg.replace(/[^a-zA-Z0-9_$]/g, "_");
|
|
3529
|
-
imports.push(`import * as __ns_${safe} from "${externalSpecToModuleUrl(pkg, baseDir)}";`);
|
|
3529
|
+
imports.push(`import * as __ns_${safe} from "${externalSpecToModuleUrl(pkg, baseDir, root)}";`);
|
|
3530
3530
|
imports.push(`var __req_${safe} = "default" in __ns_${safe} ? __ns_${safe}["default"] : __ns_${safe};`);
|
|
3531
3531
|
result = result.replaceAll(`__require("${pkg}")`, `__req_${safe}`);
|
|
3532
3532
|
result = result.replaceAll(`__require('${pkg}')`, `__req_${safe}`);
|
|
@@ -3623,9 +3623,12 @@ function isUnderRoot(abs, root) {
|
|
|
3623
3623
|
const rel = import_node_path11.default.relative(root, abs);
|
|
3624
3624
|
return !!rel && !rel.startsWith("..") && !import_node_path11.default.isAbsolute(rel);
|
|
3625
3625
|
}
|
|
3626
|
-
function externalSpecToModuleUrl(spec, baseDir) {
|
|
3626
|
+
function externalSpecToModuleUrl(spec, baseDir, root) {
|
|
3627
3627
|
const resolved = resolveNodeModule(baseDir, spec);
|
|
3628
|
-
|
|
3628
|
+
if (!resolved) return `/@modules/${spec}`;
|
|
3629
|
+
const rootResolved = resolveNodeModule(root, spec);
|
|
3630
|
+
if (rootResolved && rootResolved === resolved) return `/@modules/${spec}`;
|
|
3631
|
+
return `/@modules/${spec}?id=${encodeURIComponent(resolved)}`;
|
|
3629
3632
|
}
|
|
3630
3633
|
function resolveNodeModule(baseDir, moduleName) {
|
|
3631
3634
|
const resolved = resolveNodeModuleEntry(baseDir, moduleName);
|
|
@@ -4750,7 +4753,7 @@ async function createServer(inlineConfig = {}) {
|
|
|
4750
4753
|
const readyIn = Math.ceil(performance.now() - startTime);
|
|
4751
4754
|
logger.info(
|
|
4752
4755
|
`
|
|
4753
|
-
${import_picocolors9.default.cyan(import_picocolors9.default.bold("NASTI"))} ${import_picocolors9.default.cyan(`v${"2.0.
|
|
4756
|
+
${import_picocolors9.default.cyan(import_picocolors9.default.bold("NASTI"))} ${import_picocolors9.default.cyan(`v${"2.0.2"}`)} ${import_picocolors9.default.dim("ready in")} ${import_picocolors9.default.bold(readyIn)} ${import_picocolors9.default.dim("ms")}
|
|
4754
4757
|
`
|
|
4755
4758
|
);
|
|
4756
4759
|
printServerUrls(
|
|
@@ -4909,7 +4912,7 @@ async function buildElectron(inlineConfig = {}) {
|
|
|
4909
4912
|
const config = await resolveConfig({ ...inlineConfig, target: "electron" }, "build");
|
|
4910
4913
|
const startTime = performance.now();
|
|
4911
4914
|
assertElectronVersion(config);
|
|
4912
|
-
console.log(import_picocolors5.default.cyan("\n\u26A1 nasti build (electron)") + import_picocolors5.default.dim(` v${"2.0.
|
|
4915
|
+
console.log(import_picocolors5.default.cyan("\n\u26A1 nasti build (electron)") + import_picocolors5.default.dim(` v${"2.0.2"}`));
|
|
4913
4916
|
console.log(import_picocolors5.default.dim(` root: ${config.root}`));
|
|
4914
4917
|
console.log(import_picocolors5.default.dim(` mode: ${config.mode}`));
|
|
4915
4918
|
console.log(import_picocolors5.default.dim(` target: electron (\u2265 ${config.electron.minVersion})`));
|
|
@@ -5060,7 +5063,7 @@ async function startElectronDev(inlineConfig = {}) {
|
|
|
5060
5063
|
const { noSpawn, ...rest } = inlineConfig;
|
|
5061
5064
|
const config = await resolveConfig({ ...rest, target: "electron" }, "serve");
|
|
5062
5065
|
warnElectronVersion(config);
|
|
5063
|
-
console.log(import_picocolors10.default.cyan("\n\u26A1 nasti electron dev") + import_picocolors10.default.dim(` v${"2.0.
|
|
5066
|
+
console.log(import_picocolors10.default.cyan("\n\u26A1 nasti electron dev") + import_picocolors10.default.dim(` v${"2.0.2"}`));
|
|
5064
5067
|
const { createServer: createServer2 } = await Promise.resolve().then(() => (init_server(), server_exports));
|
|
5065
5068
|
const server = await createServer2({ ...rest, target: "electron" });
|
|
5066
5069
|
await server.listen();
|