@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.js
CHANGED
|
@@ -2877,7 +2877,7 @@ async function build(inlineConfig = {}) {
|
|
|
2877
2877
|
const startTime = performance.now();
|
|
2878
2878
|
logger.info(
|
|
2879
2879
|
pc4.cyan(`
|
|
2880
|
-
nasti v${"2.0.
|
|
2880
|
+
nasti v${"2.0.2"} `) + pc4.green(`building for ${config.mode}...`)
|
|
2881
2881
|
);
|
|
2882
2882
|
debug4?.(`root: ${config.root}`);
|
|
2883
2883
|
const buildableNames = Object.keys(config.environments).filter(
|
|
@@ -3406,15 +3406,15 @@ async function doBundlePackage(entryFile, root) {
|
|
|
3406
3406
|
const externalBaseDir = path11.dirname(entryFile);
|
|
3407
3407
|
code = code.replace(
|
|
3408
3408
|
/^(import\b[^;'"]*?\bfrom\s+)(['"])([^'"./][^'"]*)(\2)/gm,
|
|
3409
|
-
(_, prefix, q, spec) => `${prefix}${q}${externalSpecToModuleUrl(spec, externalBaseDir)}${q}`
|
|
3409
|
+
(_, prefix, q, spec) => `${prefix}${q}${externalSpecToModuleUrl(spec, externalBaseDir, root)}${q}`
|
|
3410
3410
|
).replace(
|
|
3411
3411
|
/^(export\b[^;'"]*?\bfrom\s+)(['"])([^'"./][^'"]*)(\2)/gm,
|
|
3412
|
-
(_, prefix, q, spec) => `${prefix}${q}${externalSpecToModuleUrl(spec, externalBaseDir)}${q}`
|
|
3412
|
+
(_, prefix, q, spec) => `${prefix}${q}${externalSpecToModuleUrl(spec, externalBaseDir, root)}${q}`
|
|
3413
3413
|
).replace(
|
|
3414
3414
|
/^(import\s+)(['"])([^'"./][^'"]*)(\2)/gm,
|
|
3415
|
-
(_, prefix, q, spec) => `${prefix}${q}${externalSpecToModuleUrl(spec, externalBaseDir)}${q}`
|
|
3415
|
+
(_, prefix, q, spec) => `${prefix}${q}${externalSpecToModuleUrl(spec, externalBaseDir, root)}${q}`
|
|
3416
3416
|
);
|
|
3417
|
-
code = rewriteExternalRequires(code, externalBaseDir);
|
|
3417
|
+
code = rewriteExternalRequires(code, externalBaseDir, root);
|
|
3418
3418
|
if (code.includes("__commonJSMin")) {
|
|
3419
3419
|
code = await injectCjsNamedExports(code, entryFile);
|
|
3420
3420
|
}
|
|
@@ -3519,7 +3519,7 @@ function pickMainEntryByExtension(pkgDir, preferredExt) {
|
|
|
3519
3519
|
}
|
|
3520
3520
|
return null;
|
|
3521
3521
|
}
|
|
3522
|
-
function rewriteExternalRequires(code, baseDir) {
|
|
3522
|
+
function rewriteExternalRequires(code, baseDir, root) {
|
|
3523
3523
|
const pkgs = /* @__PURE__ */ new Set();
|
|
3524
3524
|
const re = /__require\(["']([^"']+)["']\)/g;
|
|
3525
3525
|
let m;
|
|
@@ -3531,7 +3531,7 @@ function rewriteExternalRequires(code, baseDir) {
|
|
|
3531
3531
|
const imports = [];
|
|
3532
3532
|
for (const pkg of pkgs) {
|
|
3533
3533
|
const safe = pkg.replace(/[^a-zA-Z0-9_$]/g, "_");
|
|
3534
|
-
imports.push(`import * as __ns_${safe} from "${externalSpecToModuleUrl(pkg, baseDir)}";`);
|
|
3534
|
+
imports.push(`import * as __ns_${safe} from "${externalSpecToModuleUrl(pkg, baseDir, root)}";`);
|
|
3535
3535
|
imports.push(`var __req_${safe} = "default" in __ns_${safe} ? __ns_${safe}["default"] : __ns_${safe};`);
|
|
3536
3536
|
result = result.replaceAll(`__require("${pkg}")`, `__req_${safe}`);
|
|
3537
3537
|
result = result.replaceAll(`__require('${pkg}')`, `__req_${safe}`);
|
|
@@ -3628,9 +3628,12 @@ function isUnderRoot(abs, root) {
|
|
|
3628
3628
|
const rel = path11.relative(root, abs);
|
|
3629
3629
|
return !!rel && !rel.startsWith("..") && !path11.isAbsolute(rel);
|
|
3630
3630
|
}
|
|
3631
|
-
function externalSpecToModuleUrl(spec, baseDir) {
|
|
3631
|
+
function externalSpecToModuleUrl(spec, baseDir, root) {
|
|
3632
3632
|
const resolved = resolveNodeModule(baseDir, spec);
|
|
3633
|
-
|
|
3633
|
+
if (!resolved) return `/@modules/${spec}`;
|
|
3634
|
+
const rootResolved = resolveNodeModule(root, spec);
|
|
3635
|
+
if (rootResolved && rootResolved === resolved) return `/@modules/${spec}`;
|
|
3636
|
+
return `/@modules/${spec}?id=${encodeURIComponent(resolved)}`;
|
|
3634
3637
|
}
|
|
3635
3638
|
function resolveNodeModule(baseDir, moduleName) {
|
|
3636
3639
|
const resolved = resolveNodeModuleEntry(baseDir, moduleName);
|
|
@@ -4755,7 +4758,7 @@ async function createServer(inlineConfig = {}) {
|
|
|
4755
4758
|
const readyIn = Math.ceil(performance.now() - startTime);
|
|
4756
4759
|
logger.info(
|
|
4757
4760
|
`
|
|
4758
|
-
${pc9.cyan(pc9.bold("NASTI"))} ${pc9.cyan(`v${"2.0.
|
|
4761
|
+
${pc9.cyan(pc9.bold("NASTI"))} ${pc9.cyan(`v${"2.0.2"}`)} ${pc9.dim("ready in")} ${pc9.bold(readyIn)} ${pc9.dim("ms")}
|
|
4759
4762
|
`
|
|
4760
4763
|
);
|
|
4761
4764
|
printServerUrls(
|
|
@@ -4883,7 +4886,7 @@ async function buildElectron(inlineConfig = {}) {
|
|
|
4883
4886
|
const config = await resolveConfig({ ...inlineConfig, target: "electron" }, "build");
|
|
4884
4887
|
const startTime = performance.now();
|
|
4885
4888
|
assertElectronVersion(config);
|
|
4886
|
-
console.log(pc5.cyan("\n\u26A1 nasti build (electron)") + pc5.dim(` v${"2.0.
|
|
4889
|
+
console.log(pc5.cyan("\n\u26A1 nasti build (electron)") + pc5.dim(` v${"2.0.2"}`));
|
|
4887
4890
|
console.log(pc5.dim(` root: ${config.root}`));
|
|
4888
4891
|
console.log(pc5.dim(` mode: ${config.mode}`));
|
|
4889
4892
|
console.log(pc5.dim(` target: electron (\u2265 ${config.electron.minVersion})`));
|
|
@@ -5034,7 +5037,7 @@ async function startElectronDev(inlineConfig = {}) {
|
|
|
5034
5037
|
const { noSpawn, ...rest } = inlineConfig;
|
|
5035
5038
|
const config = await resolveConfig({ ...rest, target: "electron" }, "serve");
|
|
5036
5039
|
warnElectronVersion(config);
|
|
5037
|
-
console.log(pc10.cyan("\n\u26A1 nasti electron dev") + pc10.dim(` v${"2.0.
|
|
5040
|
+
console.log(pc10.cyan("\n\u26A1 nasti electron dev") + pc10.dim(` v${"2.0.2"}`));
|
|
5038
5041
|
const { createServer: createServer2 } = await Promise.resolve().then(() => (init_server(), server_exports));
|
|
5039
5042
|
const server = await createServer2({ ...rest, target: "electron" });
|
|
5040
5043
|
await server.listen();
|