@incajs/cli 0.0.14 → 0.0.15

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.
@@ -9,6 +9,8 @@ export interface BuildOptions {
9
9
  entry: string;
10
10
  /** Where the build's output is written. */
11
11
  outDir: string;
12
+ /** Writes `bundle.js.map` beside the bundle. Defaults to `false`. */
13
+ sourcemap?: boolean;
12
14
  /**
13
15
  * Values the built app carries for `inca-host` to read — its name, id
14
16
  * and window. Any JSON-serializable object.
@@ -5,4 +5,4 @@ import { BuildOptions, BuildOutput } from '../types.mts';
5
5
  * rejects on failure rather than reporting it through a callback. Never
6
6
  * starts or talks to `inca-host` — that's `dev.mts`'s job.
7
7
  */
8
- export declare function build(core: AdapterCore, runtimeModuleName: string, { entry, outDir, runtimeConfig, stdout, stderr, quiet, }: BuildOptions): Promise<BuildOutput>;
8
+ export declare function build(core: AdapterCore, runtimeModuleName: string, { entry, outDir, sourcemap, runtimeConfig, stdout, stderr, quiet, }: BuildOptions): Promise<BuildOutput>;
@@ -12,6 +12,8 @@ export interface ResolveConfigOptions {
12
12
  outDir: string;
13
13
  /** `"development"` keeps `@vue/runtime-core`'s own warnings; `"production"` strips them. */
14
14
  mode: "development" | "production";
15
+ /** Writes the map in a production build too. Development always writes it. */
16
+ sourcemap?: boolean;
15
17
  /** Whether Vite should keep rebuilding on file changes. */
16
18
  watch: boolean;
17
19
  /** Called with what each successful (re)build wrote. */
@@ -35,4 +37,4 @@ export interface ResolveConfigOptions {
35
37
  * the entry, named by `chunkFileNames`/`assetFileNames` below, rather than
36
38
  * failing the build.
37
39
  */
38
- export declare function resolveViteConfig({ core, runtimeModuleName, entry, outDir, mode, watch, onOutput, stdout, stderr, quiet, runtimeConfig, }: ResolveConfigOptions): InlineConfig;
40
+ export declare function resolveViteConfig({ core, runtimeModuleName, entry, outDir, mode, sourcemap, watch, onOutput, stdout, stderr, quiet, runtimeConfig, }: ResolveConfigOptions): InlineConfig;
package/dist/build.d.mts CHANGED
@@ -12,6 +12,8 @@ export interface BuildAppOptions {
12
12
  bundler?: Bundler;
13
13
  /** An already-resolved config — lets `packageApp` avoid loading it twice. */
14
14
  config?: ResolvedBuildConfig;
15
+ /** Writes `bundle.js.map` beside the bundle. Overrides the config's `sourcemap` when set. */
16
+ sourcemap?: boolean;
15
17
  /** What the build carries for `inca-host` to read. Resolved from the app's config when absent. */
16
18
  runtimeConfig?: RuntimeConfig;
17
19
  /** Where the bundler's own output goes. Defaults to `process.stdout`. */
@@ -1,6 +1,7 @@
1
1
  //#region src/config/defaults.mts
2
2
  var e = {
3
3
  outDir: "dist",
4
+ sourcemap: !1,
4
5
  version: "0.0.0"
5
6
  };
6
7
  function t(e) {
package/dist/cli.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { t as e } from "./chunks/rolldown-runtime-Dy4uBu1J.js";
2
2
  import { c as t, i as n, n as r, o as i, r as a, s as o, t as s } from "./chunks/dist-C64iuQVW.js";
3
- import { i as c, n as l, r as u, t as d } from "./chunks/defaults-TOBTBbDy.js";
3
+ import { i as c, n as l, r as u, t as d } from "./chunks/defaults-Ct95BSBl.js";
4
4
  import f, { existsSync as p, lstatSync as m, readFileSync as h, realpathSync as g, statSync as _, watch as v } from "node:fs";
5
5
  import y, { resolve as b } from "node:path";
6
6
  import { chmod as x, cp as S, link as C, mkdir as w, readFile as T, readdir as ee, rm as E, writeFile as D } from "node:fs/promises";
@@ -578,7 +578,8 @@ async function nt(e) {
578
578
  let { config: t } = await G(e), n = t.entry ? y.resolve(e, t.entry) : void 0;
579
579
  return {
580
580
  entry: n,
581
- outDir: et(e, t.outDir, n)
581
+ outDir: et(e, t.outDir, n),
582
+ sourcemap: t.sourcemap ?? d.sourcemap
582
583
  };
583
584
  }
584
585
  async function rt(e) {
@@ -603,6 +604,7 @@ async function rt(e) {
603
604
  window: i.window,
604
605
  entry: m,
605
606
  outDir: h,
607
+ sourcemap: i.sourcemap ?? d.sourcemap,
606
608
  usedPackageJsonKey: a
607
609
  };
608
610
  }
@@ -719,14 +721,15 @@ function gt(e, t = ht) {
719
721
  //#endregion
720
722
  //#region src/adapter/vite/config.mts
721
723
  var _t = "bundle.js";
722
- function vt({ core: e, runtimeModuleName: t, entry: n, outDir: r, mode: i, watch: a, onOutput: o, stdout: s, stderr: c, quiet: l, runtimeConfig: u }) {
724
+ function vt({ core: e, runtimeModuleName: t, entry: n, outDir: r, mode: i, sourcemap: a = !1, watch: o, onOutput: s, stdout: c, stderr: l, quiet: u, runtimeConfig: d }) {
725
+ let f = i === "development" || a;
723
726
  return {
724
727
  configFile: !1,
725
728
  root: y.dirname(n),
726
729
  mode: i,
727
730
  clearScreen: !1,
728
- logLevel: l ? "silent" : "info",
729
- customLogger: pt(s, c),
731
+ logLevel: u ? "silent" : "info",
732
+ customLogger: pt(c, l),
730
733
  define: { "process.env.NODE_ENV": JSON.stringify(i) },
731
734
  plugins: [
732
735
  se({ template: { compilerOptions: {
@@ -734,8 +737,8 @@ function vt({ core: e, runtimeModuleName: t, entry: n, outDir: r, mode: i, watch
734
737
  hoistStatic: !1
735
738
  } } }),
736
739
  gt(e),
737
- ut(u),
738
- st(e, o)
740
+ ut(d),
741
+ st(e, s)
739
742
  ],
740
743
  build: {
741
744
  lib: {
@@ -746,34 +749,37 @@ function vt({ core: e, runtimeModuleName: t, entry: n, outDir: r, mode: i, watch
746
749
  outDir: r,
747
750
  emptyOutDir: i === "production",
748
751
  minify: i === "production",
749
- watch: a ? { buildDelay: 30 } : void 0,
752
+ sourcemap: f,
753
+ watch: o ? { buildDelay: 30 } : void 0,
750
754
  rolldownOptions: { output: {
751
755
  chunkFileNames: "chunks/[name]-[hash].js",
752
- assetFileNames: "assets/[name]-[hash][extname]"
756
+ assetFileNames: "assets/[name]-[hash][extname]",
757
+ sourcemapExcludeSources: f
753
758
  } }
754
759
  }
755
760
  };
756
761
  }
757
762
  //#endregion
758
763
  //#region src/adapter/vite/build.mts
759
- async function yt(e, t, { entry: n, outDir: r, runtimeConfig: i, stdout: a = process.stdout, stderr: o = process.stderr, quiet: s = !1 }) {
760
- let c;
764
+ async function yt(e, t, { entry: n, outDir: r, sourcemap: i, runtimeConfig: a, stdout: o = process.stdout, stderr: s = process.stderr, quiet: c = !1 }) {
765
+ let l;
761
766
  if (await A(vt({
762
767
  core: e,
763
768
  runtimeModuleName: t,
764
769
  entry: n,
765
770
  outDir: r,
766
- runtimeConfig: i,
771
+ runtimeConfig: a,
767
772
  mode: "production",
773
+ sourcemap: i,
768
774
  watch: !1,
769
- stdout: a,
770
- stderr: o,
771
- quiet: s,
775
+ stdout: o,
776
+ stderr: s,
777
+ quiet: c,
772
778
  onOutput: (e) => {
773
- c = ot(r, e);
779
+ l = ot(r, e);
774
780
  }
775
- })), !c) throw new e.IncaError("ERR_INCA_BUILD_NO_OUTPUT", "build produced no output");
776
- return c;
781
+ })), !l) throw new e.IncaError("ERR_INCA_BUILD_NO_OUTPUT", "build produced no output");
782
+ return l;
777
783
  }
778
784
  //#endregion
779
785
  //#region src/adapter/vite/hmr.mts
@@ -1218,6 +1224,7 @@ async function Qt(e = {}) {
1218
1224
  return i.build({
1219
1225
  entry: a,
1220
1226
  outDir: r,
1227
+ sourcemap: e.sourcemap ?? n.sourcemap,
1221
1228
  runtimeConfig: o,
1222
1229
  stdout: e.stdout,
1223
1230
  stderr: e.stderr
@@ -1588,6 +1595,7 @@ async function En(e = {}) {
1588
1595
  cwd: t,
1589
1596
  entry: e.entry,
1590
1597
  config: i,
1598
+ sourcemap: e.sourcemap,
1591
1599
  runtimeConfig: it(i),
1592
1600
  bundler: e.bundler,
1593
1601
  stdout: n,
@@ -1603,11 +1611,16 @@ async function En(e = {}) {
1603
1611
  }
1604
1612
  //#endregion
1605
1613
  //#region src/cli.mts
1606
- var Dn = "Usage: inca <dev|build|package>";
1614
+ var Dn = "Usage: inca <dev|build|package> [--sourcemap|--no-sourcemap]";
1607
1615
  function On(e) {
1608
1616
  return y.relative(process.cwd(), e);
1609
1617
  }
1610
- function kn() {
1618
+ function kn(e) {
1619
+ let t;
1620
+ for (let n of e) n === "--sourcemap" ? t = !0 : n === "--no-sourcemap" && (t = !1);
1621
+ return t;
1622
+ }
1623
+ function An() {
1611
1624
  for (let e of [
1612
1625
  0,
1613
1626
  1,
@@ -1616,12 +1629,12 @@ function kn() {
1616
1629
  f.closeSync(e);
1617
1630
  } catch {}
1618
1631
  }
1619
- async function An(e = process.argv) {
1632
+ async function jn(e = process.argv) {
1620
1633
  let t = e[2];
1621
1634
  if (t === "build") {
1622
1635
  try {
1623
- let e = await Qt();
1624
- Y(process.stdout, `built ${On(e.entryFile)}`);
1636
+ let t = await Qt({ sourcemap: kn(e) });
1637
+ Y(process.stdout, `built ${On(t.entryFile)}`);
1625
1638
  } catch (e) {
1626
1639
  Z(process.stderr, "build failed", X(e)), process.exitCode = 1;
1627
1640
  }
@@ -1629,8 +1642,8 @@ async function An(e = process.argv) {
1629
1642
  }
1630
1643
  if (t === "package") {
1631
1644
  try {
1632
- let { appPath: e } = await En();
1633
- Y(process.stdout, `packaged ${On(e)}`);
1645
+ let { appPath: t } = await En({ sourcemap: kn(e) });
1646
+ Y(process.stdout, `packaged ${On(t)}`);
1634
1647
  } catch (e) {
1635
1648
  Z(process.stderr, "package failed", X(e)), process.exitCode = 1;
1636
1649
  }
@@ -1654,10 +1667,10 @@ async function An(e = process.argv) {
1654
1667
  await bn({
1655
1668
  signal: n.signal,
1656
1669
  experimentalHmr: i
1657
- }), n.signal.aborted && kn();
1670
+ }), n.signal.aborted && An();
1658
1671
  } catch (e) {
1659
1672
  Z(process.stderr, "dev failed", X(e), { timestamp: !0 }), process.exitCode = 1;
1660
1673
  }
1661
1674
  }
1662
1675
  //#endregion
1663
- export { An as run };
1676
+ export { jn as run };
@@ -14,7 +14,7 @@ import { IncaConfig } from './types.mts';
14
14
  * });
15
15
  * ```
16
16
  */
17
- export declare const defaultConfig: Required<Pick<IncaConfig, "outDir" | "version">>;
17
+ export declare const defaultConfig: Required<Pick<IncaConfig, "outDir" | "sourcemap" | "version">>;
18
18
  /**
19
19
  * Strips an npm scope off a package name.
20
20
  *
@@ -5,6 +5,8 @@ export interface ResolvedBuildConfig {
5
5
  entry?: string;
6
6
  /** Absolute path. */
7
7
  outDir: string;
8
+ /** Whether `build`/`package` write `bundle.js.map`. */
9
+ sourcemap: boolean;
8
10
  }
9
11
  /** An app's full config, as `inca package` needs it. */
10
12
  export interface ResolvedAppConfig extends ResolvedBuildConfig {
@@ -33,6 +33,12 @@ export interface IncaConfig {
33
33
  * @default "dist"
34
34
  */
35
35
  outDir?: string;
36
+ /**
37
+ * Whether `inca build` and `inca package` write `bundle.js.map` beside
38
+ * the bundle. `inca dev` always writes it.
39
+ * @default false
40
+ */
41
+ sourcemap?: boolean;
36
42
  /** The window the app opens in. */
37
43
  window?: WindowConfig;
38
44
  }
package/dist/config.js CHANGED
@@ -1,4 +1,4 @@
1
- import { t as e } from "./chunks/defaults-TOBTBbDy.js";
1
+ import { t as e } from "./chunks/defaults-Ct95BSBl.js";
2
2
  //#region src/config/index.mts
3
3
  var t = (e) => e;
4
4
  //#endregion
@@ -19,6 +19,8 @@ export interface PackageAppOptions {
19
19
  * per-platform `@incajs/host-*` package — see {@link resolveHostBin}).
20
20
  */
21
21
  hostBin?: string;
22
+ /** Writes `bundle.js.map` beside the bundle. Overrides the config's `sourcemap` when set. */
23
+ sourcemap?: boolean;
22
24
  /**
23
25
  * The platform to package for. Defaults to whichever one the current
24
26
  * process is running on.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@incajs/cli",
3
- "version": "0.0.14",
4
- "description": "Dev server, bundler, and packager for Incarnative.js apps.",
3
+ "version": "0.0.15",
4
+ "description": "Commands to develop, bundle, and package Incarnative.js apps.",
5
5
  "keywords": [
6
6
  "bundler",
7
7
  "cli",
@@ -70,10 +70,10 @@
70
70
  }
71
71
  },
72
72
  "optionalDependencies": {
73
- "@incajs/host-darwin-arm64": "0.0.14",
74
- "@incajs/host-darwin-x64": "0.0.14",
75
- "@incajs/host-linux-arm64": "0.0.14",
76
- "@incajs/host-linux-x64": "0.0.14"
73
+ "@incajs/host-darwin-arm64": "0.0.15",
74
+ "@incajs/host-darwin-x64": "0.0.15",
75
+ "@incajs/host-linux-arm64": "0.0.15",
76
+ "@incajs/host-linux-x64": "0.0.15"
77
77
  },
78
78
  "engines": {
79
79
  "node": ">=22.18"