@nasti-toolchain/nasti 1.3.8 → 1.3.10

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.js CHANGED
@@ -790,7 +790,8 @@ function rewriteExternalRequires(code) {
790
790
  const imports = [];
791
791
  for (const pkg of pkgs) {
792
792
  const safe = pkg.replace(/[^a-zA-Z0-9_$]/g, "_");
793
- imports.push(`import __req_${safe} from "/@modules/${pkg}";`);
793
+ imports.push(`import * as __ns_${safe} from "/@modules/${pkg}";`);
794
+ imports.push(`var __req_${safe} = "default" in __ns_${safe} ? __ns_${safe}["default"] : __ns_${safe};`);
794
795
  result = result.replaceAll(`__require("${pkg}")`, `__req_${safe}`);
795
796
  result = result.replaceAll(`__require('${pkg}')`, `__req_${safe}`);
796
797
  }
@@ -877,10 +878,19 @@ function resolveNodeModule(root, moduleName) {
877
878
  if (resolved) return resolved;
878
879
  }
879
880
  if (subpath) {
880
- const direct = path4.join(pkgDir, subpath);
881
- if (fs4.existsSync(direct) && fs4.statSync(direct).isFile()) return direct;
882
- for (const ext of RESOLVE_EXTENSIONS) {
883
- if (fs4.existsSync(direct + ext)) return direct + ext;
881
+ const subDirs = [""];
882
+ for (const field of ["module", "main"]) {
883
+ if (typeof pkg[field] === "string") {
884
+ const dir2 = path4.dirname(pkg[field]);
885
+ if (dir2 && dir2 !== "." && !subDirs.includes(dir2)) subDirs.push(dir2);
886
+ }
887
+ }
888
+ for (const dir2 of subDirs) {
889
+ const direct = path4.join(pkgDir, dir2, subpath);
890
+ if (fs4.existsSync(direct) && fs4.statSync(direct).isFile()) return direct;
891
+ for (const ext of RESOLVE_EXTENSIONS) {
892
+ if (fs4.existsSync(direct + ext)) return direct + ext;
893
+ }
884
894
  }
885
895
  return null;
886
896
  }
@@ -1416,7 +1426,7 @@ async function createServer(inlineConfig = {}) {
1416
1426
  const localUrl = `http://localhost:${actualPort}`;
1417
1427
  const networkUrl = host === "0.0.0.0" ? `http://${getNetworkAddress()}:${actualPort}` : null;
1418
1428
  console.log();
1419
- console.log(pc.cyan(" nasti dev server") + pc.dim(` v${"1.3.8"}`));
1429
+ console.log(pc.cyan(" nasti dev server") + pc.dim(` v${"1.3.10"}`));
1420
1430
  console.log();
1421
1431
  console.log(` ${pc.green(">")} Local: ${pc.cyan(localUrl)}`);
1422
1432
  if (networkUrl) {
@@ -1490,7 +1500,7 @@ import pc2 from "picocolors";
1490
1500
  async function build(inlineConfig = {}) {
1491
1501
  const config = await resolveConfig(inlineConfig, "build");
1492
1502
  const startTime = performance.now();
1493
- console.log(pc2.cyan("\n\u{1F528} nasti build") + pc2.dim(` v${"1.3.8"}`));
1503
+ console.log(pc2.cyan("\n\u{1F528} nasti build") + pc2.dim(` v${"1.3.10"}`));
1494
1504
  console.log(pc2.dim(` root: ${config.root}`));
1495
1505
  console.log(pc2.dim(` mode: ${config.mode}`));
1496
1506
  const outDir = path10.resolve(config.root, config.build.outDir);
@@ -1710,6 +1720,6 @@ cli.command("preview [root]", "Preview production build").option("--port <port>"
1710
1720
  }
1711
1721
  });
1712
1722
  cli.help();
1713
- cli.version("1.3.8");
1723
+ cli.version("1.3.10");
1714
1724
  cli.parse();
1715
1725
  //# sourceMappingURL=cli.js.map