@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/cli.js
CHANGED
|
@@ -1497,15 +1497,15 @@ async function doBundlePackage(entryFile, root) {
|
|
|
1497
1497
|
const externalBaseDir = path4.dirname(entryFile);
|
|
1498
1498
|
code = code.replace(
|
|
1499
1499
|
/^(import\b[^;'"]*?\bfrom\s+)(['"])([^'"./][^'"]*)(\2)/gm,
|
|
1500
|
-
(_, prefix, q, spec) => `${prefix}${q}${externalSpecToModuleUrl(spec, externalBaseDir)}${q}`
|
|
1500
|
+
(_, prefix, q, spec) => `${prefix}${q}${externalSpecToModuleUrl(spec, externalBaseDir, root)}${q}`
|
|
1501
1501
|
).replace(
|
|
1502
1502
|
/^(export\b[^;'"]*?\bfrom\s+)(['"])([^'"./][^'"]*)(\2)/gm,
|
|
1503
|
-
(_, prefix, q, spec) => `${prefix}${q}${externalSpecToModuleUrl(spec, externalBaseDir)}${q}`
|
|
1503
|
+
(_, prefix, q, spec) => `${prefix}${q}${externalSpecToModuleUrl(spec, externalBaseDir, root)}${q}`
|
|
1504
1504
|
).replace(
|
|
1505
1505
|
/^(import\s+)(['"])([^'"./][^'"]*)(\2)/gm,
|
|
1506
|
-
(_, prefix, q, spec) => `${prefix}${q}${externalSpecToModuleUrl(spec, externalBaseDir)}${q}`
|
|
1506
|
+
(_, prefix, q, spec) => `${prefix}${q}${externalSpecToModuleUrl(spec, externalBaseDir, root)}${q}`
|
|
1507
1507
|
);
|
|
1508
|
-
code = rewriteExternalRequires(code, externalBaseDir);
|
|
1508
|
+
code = rewriteExternalRequires(code, externalBaseDir, root);
|
|
1509
1509
|
if (code.includes("__commonJSMin")) {
|
|
1510
1510
|
code = await injectCjsNamedExports(code, entryFile);
|
|
1511
1511
|
}
|
|
@@ -1610,7 +1610,7 @@ function pickMainEntryByExtension(pkgDir, preferredExt) {
|
|
|
1610
1610
|
}
|
|
1611
1611
|
return null;
|
|
1612
1612
|
}
|
|
1613
|
-
function rewriteExternalRequires(code, baseDir) {
|
|
1613
|
+
function rewriteExternalRequires(code, baseDir, root) {
|
|
1614
1614
|
const pkgs = /* @__PURE__ */ new Set();
|
|
1615
1615
|
const re = /__require\(["']([^"']+)["']\)/g;
|
|
1616
1616
|
let m;
|
|
@@ -1622,7 +1622,7 @@ function rewriteExternalRequires(code, baseDir) {
|
|
|
1622
1622
|
const imports = [];
|
|
1623
1623
|
for (const pkg of pkgs) {
|
|
1624
1624
|
const safe = pkg.replace(/[^a-zA-Z0-9_$]/g, "_");
|
|
1625
|
-
imports.push(`import * as __ns_${safe} from "${externalSpecToModuleUrl(pkg, baseDir)}";`);
|
|
1625
|
+
imports.push(`import * as __ns_${safe} from "${externalSpecToModuleUrl(pkg, baseDir, root)}";`);
|
|
1626
1626
|
imports.push(`var __req_${safe} = "default" in __ns_${safe} ? __ns_${safe}["default"] : __ns_${safe};`);
|
|
1627
1627
|
result = result.replaceAll(`__require("${pkg}")`, `__req_${safe}`);
|
|
1628
1628
|
result = result.replaceAll(`__require('${pkg}')`, `__req_${safe}`);
|
|
@@ -1719,9 +1719,12 @@ function isUnderRoot(abs, root) {
|
|
|
1719
1719
|
const rel = path4.relative(root, abs);
|
|
1720
1720
|
return !!rel && !rel.startsWith("..") && !path4.isAbsolute(rel);
|
|
1721
1721
|
}
|
|
1722
|
-
function externalSpecToModuleUrl(spec, baseDir) {
|
|
1722
|
+
function externalSpecToModuleUrl(spec, baseDir, root) {
|
|
1723
1723
|
const resolved = resolveNodeModule(baseDir, spec);
|
|
1724
|
-
|
|
1724
|
+
if (!resolved) return `/@modules/${spec}`;
|
|
1725
|
+
const rootResolved = resolveNodeModule(root, spec);
|
|
1726
|
+
if (rootResolved && rootResolved === resolved) return `/@modules/${spec}`;
|
|
1727
|
+
return `/@modules/${spec}?id=${encodeURIComponent(resolved)}`;
|
|
1725
1728
|
}
|
|
1726
1729
|
function resolveNodeModule(baseDir, moduleName) {
|
|
1727
1730
|
const resolved = resolveNodeModuleEntry(baseDir, moduleName);
|
|
@@ -4037,7 +4040,7 @@ async function build(inlineConfig = {}) {
|
|
|
4037
4040
|
const startTime = performance.now();
|
|
4038
4041
|
logger.info(
|
|
4039
4042
|
pc6.cyan(`
|
|
4040
|
-
nasti v${"2.0.
|
|
4043
|
+
nasti v${"2.0.2"} `) + pc6.green(`building for ${config.mode}...`)
|
|
4041
4044
|
);
|
|
4042
4045
|
debug5?.(`root: ${config.root}`);
|
|
4043
4046
|
const buildableNames = Object.keys(config.environments).filter(
|
|
@@ -4758,7 +4761,7 @@ async function createServer(inlineConfig = {}) {
|
|
|
4758
4761
|
const readyIn = Math.ceil(performance.now() - startTime);
|
|
4759
4762
|
logger.info(
|
|
4760
4763
|
`
|
|
4761
|
-
${pc8.cyan(pc8.bold("NASTI"))} ${pc8.cyan(`v${"2.0.
|
|
4764
|
+
${pc8.cyan(pc8.bold("NASTI"))} ${pc8.cyan(`v${"2.0.2"}`)} ${pc8.dim("ready in")} ${pc8.bold(readyIn)} ${pc8.dim("ms")}
|
|
4762
4765
|
`
|
|
4763
4766
|
);
|
|
4764
4767
|
printServerUrls(
|
|
@@ -4888,7 +4891,7 @@ async function buildElectron(inlineConfig = {}) {
|
|
|
4888
4891
|
const config = await resolveConfig({ ...inlineConfig, target: "electron" }, "build");
|
|
4889
4892
|
const startTime = performance.now();
|
|
4890
4893
|
assertElectronVersion(config);
|
|
4891
|
-
console.log(pc9.cyan("\n\u26A1 nasti build (electron)") + pc9.dim(` v${"2.0.
|
|
4894
|
+
console.log(pc9.cyan("\n\u26A1 nasti build (electron)") + pc9.dim(` v${"2.0.2"}`));
|
|
4892
4895
|
console.log(pc9.dim(` root: ${config.root}`));
|
|
4893
4896
|
console.log(pc9.dim(` mode: ${config.mode}`));
|
|
4894
4897
|
console.log(pc9.dim(` target: electron (\u2265 ${config.electron.minVersion})`));
|
|
@@ -5046,7 +5049,7 @@ async function startElectronDev(inlineConfig = {}) {
|
|
|
5046
5049
|
const { noSpawn, ...rest } = inlineConfig;
|
|
5047
5050
|
const config = await resolveConfig({ ...rest, target: "electron" }, "serve");
|
|
5048
5051
|
warnElectronVersion(config);
|
|
5049
|
-
console.log(pc10.cyan("\n\u26A1 nasti electron dev") + pc10.dim(` v${"2.0.
|
|
5052
|
+
console.log(pc10.cyan("\n\u26A1 nasti electron dev") + pc10.dim(` v${"2.0.2"}`));
|
|
5050
5053
|
const { createServer: createServer2 } = await Promise.resolve().then(() => (init_server(), server_exports));
|
|
5051
5054
|
const server = await createServer2({ ...rest, target: "electron" });
|
|
5052
5055
|
await server.listen();
|
|
@@ -5391,7 +5394,7 @@ cli.command("preview [root]", "Preview production build").option("--port <port>"
|
|
|
5391
5394
|
const host = options.host === true ? "0.0.0.0" : options.host ?? "localhost";
|
|
5392
5395
|
http2.createServer(app).listen(port, host, () => {
|
|
5393
5396
|
logger.info(`
|
|
5394
|
-
${pc11.cyan(pc11.bold("NASTI"))} ${pc11.cyan(`v${"2.0.
|
|
5397
|
+
${pc11.cyan(pc11.bold("NASTI"))} ${pc11.cyan(`v${"2.0.2"}`)} ${pc11.dim("preview")}
|
|
5395
5398
|
`);
|
|
5396
5399
|
printServerUrls2(
|
|
5397
5400
|
{
|
|
@@ -5408,6 +5411,6 @@ cli.command("preview [root]", "Preview production build").option("--port <port>"
|
|
|
5408
5411
|
}
|
|
5409
5412
|
});
|
|
5410
5413
|
cli.help();
|
|
5411
|
-
cli.version("2.0.
|
|
5414
|
+
cli.version("2.0.2");
|
|
5412
5415
|
cli.parse();
|
|
5413
5416
|
//# sourceMappingURL=cli.js.map
|