@incajs/cli 0.0.8 → 0.0.9

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.
@@ -1,5 +1,5 @@
1
1
  import { t as e } from "./jsonc-BdzClvC8.js";
2
- import { c as t, d as n, f as r, l as i, s as a, u as o } from "./defaults-DNvHueCI.js";
2
+ import { c as t, d as n, f as r, l as i, s as a, u as o } from "./defaults-Bl2pge8b.js";
3
3
  import { n as s, t as c } from "./_format-BKs7bsc4.js";
4
4
  import { promises as l, statSync as u } from "node:fs";
5
5
  import "node:fs/promises";
@@ -10,7 +10,7 @@ function f(e, t) {
10
10
  return s(e, n, t), n;
11
11
  }
12
12
  //#endregion
13
- //#region ../../node_modules/.pnpm/pkg-types@2.3.2/node_modules/pkg-types/dist/index.mjs
13
+ //#region ../../node_modules/.pnpm/pkg-types@2.3.3/node_modules/pkg-types/dist/index.mjs
14
14
  var p = {
15
15
  startingFrom: ".",
16
16
  rootPattern: /^node_modules$/,
@@ -1,5 +1,5 @@
1
1
  import { createHash as e } from "node:crypto";
2
- //#region ../../node_modules/.pnpm/c12@4.0.0-rc.1_magicast@0.5.4/node_modules/c12/dist/_chunks/libs/ohash.mjs
2
+ //#region ../../node_modules/.pnpm/c12@4.0.0-rc.2_magicast@0.5.4/node_modules/c12/dist/_chunks/libs/ohash.mjs
3
3
  var t = Object.defineProperty, n = (e, n) => {
4
4
  let r = {};
5
5
  for (var i in e) t(r, i, {
package/dist/cli.js CHANGED
@@ -1,4 +1,4 @@
1
- import { i as e, n as t, o as n, r, t as i } from "./chunks/defaults-DNvHueCI.js";
1
+ import { i as e, n as t, o as n, r, t as i } from "./chunks/defaults-Bl2pge8b.js";
2
2
  import a from "node:path";
3
3
  import { existsSync as o, lstatSync as s, realpathSync as c, statSync as l } from "node:fs";
4
4
  import { chmod as u, cp as d, link as f, mkdir as p, readFile as m, readdir as h, rm as g, writeFile as _ } from "node:fs/promises";
@@ -462,11 +462,14 @@ var je = (e) => {
462
462
  async start() {
463
463
  let e = this.#e.hostBin ?? U();
464
464
  W(e);
465
- let t = ee(e, ["--dev", this.#e.entryFile], { stdio: [
466
- "pipe",
467
- "pipe",
468
- "pipe"
469
- ] });
465
+ let t = ee(e, ["--dev", this.#e.entryFile], {
466
+ stdio: [
467
+ "pipe",
468
+ "pipe",
469
+ "pipe"
470
+ ],
471
+ env: this.#e.env
472
+ });
470
473
  this.#t = t;
471
474
  let n = this.#e.onStderr ?? je;
472
475
  t.stderr.setEncoding("utf8"), t.stderr.on("data", (e) => n(e)), t.stdin.on("error", (e) => {
@@ -836,7 +839,14 @@ async function at(e, t) {
836
839
  }
837
840
  await Promise.all(r.filter((e) => e.isFile()).map((t) => a.relative(e, a.join(t.parentPath, t.name))).filter((e) => !n.has(e)).map((t) => g(a.join(e, t), { force: !0 })));
838
841
  }
839
- async function ot(e) {
842
+ function ot(e) {
843
+ let { NO_COLOR: t, FORCE_COLOR: n } = process.env;
844
+ if (!(!e.isTTY || t || n)) return {
845
+ ...process.env,
846
+ FORCE_COLOR: "1"
847
+ };
848
+ }
849
+ async function st(e) {
840
850
  let t = e.cwd ?? process.cwd(), n = await P(t), r = await Je(t);
841
851
  try {
842
852
  let r = e.hostBin ?? U();
@@ -857,6 +867,7 @@ async function ot(e) {
857
867
  let n = new Ne({
858
868
  entryFile: e,
859
869
  hostBin: f,
870
+ env: ot(c),
860
871
  onStderr: (e) => c.write(e),
861
872
  onReady: () => {
862
873
  m = !0, q(s, "ready", Q), h && (h = !1, S());
@@ -935,42 +946,42 @@ async function ot(e) {
935
946
  }
936
947
  //#endregion
937
948
  //#region src/package.mts
938
- function st() {
949
+ function ct() {
939
950
  if (process.platform === "darwin") return "macos";
940
951
  if (process.platform === "linux") return "linux";
941
952
  throw new O("ERR_INCA_PLATFORM_UNSUPPORTED", `inca package doesn't support ${process.platform} yet`);
942
953
  }
943
- async function ct(e, t) {
954
+ async function lt(e, t) {
944
955
  await Promise.all(e.files.map(async (n) => {
945
956
  let r = a.join(t, n);
946
957
  await p(a.dirname(r), { recursive: !0 }), await d(a.join(e.outDir, n), r);
947
958
  }));
948
959
  }
949
- function lt(e, t) {
960
+ function ut(e, t) {
950
961
  let n = e.files.map((e) => e.split("/")[0] ?? e).find((e) => e.toLowerCase() === t.toLowerCase());
951
962
  if (n !== void 0) throw new O("ERR_INCA_PRODUCT_NAME_INVALID", `the packaged app's directory "${t}" collides with "${n}" in the build output. Set a different "productName" in inca.config.ts`);
952
963
  }
953
- async function ut({ metadata: e, output: t, hostBin: n }) {
964
+ async function dt({ metadata: e, output: t, hostBin: n }) {
954
965
  let { appPath: r, resourcesDir: i } = await $e({
955
966
  appPath: a.join(t.outDir, `${e.productName}.app`),
956
967
  metadata: e,
957
968
  hostBin: n
958
969
  });
959
- return await ct(t, i), r;
970
+ return await lt(t, i), r;
960
971
  }
961
- async function dt({ metadata: t, output: n, hostBin: r }) {
972
+ async function ft({ metadata: t, output: n, hostBin: r }) {
962
973
  let i = e(t.productName);
963
- lt(n, i);
974
+ ut(n, i);
964
975
  let o = a.join(n.outDir, i);
965
976
  await g(o, {
966
977
  recursive: !0,
967
978
  force: !0
968
979
  }), await p(o, { recursive: !0 });
969
980
  let s = a.join(o, i);
970
- return await d(r, s), await u(s, 493), await ct(n, o), o;
981
+ return await d(r, s), await u(s, 493), await lt(n, o), o;
971
982
  }
972
- async function ft(e = {}) {
973
- let t = e.cwd ?? process.cwd(), n = e.stdout ?? process.stdout, r = e.target ?? st(), i = await ce(t);
983
+ async function pt(e = {}) {
984
+ let t = e.cwd ?? process.cwd(), n = e.stdout ?? process.stdout, r = e.target ?? ct(), i = await ce(t);
974
985
  i.usedPackageJsonKey && q(n, "the \"inca\" key in package.json is deprecated — move these settings to inca.config.ts"), i.identifierIsDefault && q(n, `no "identifier" set in inca.config.ts — using generated identifier ${i.identifier}`);
975
986
  let a = await We({
976
987
  cwd: t,
@@ -987,15 +998,15 @@ async function ft(e = {}) {
987
998
  output: a,
988
999
  hostBin: o
989
1000
  };
990
- return { appPath: r === "macos" ? await ut(s) : await dt(s) };
1001
+ return { appPath: r === "macos" ? await dt(s) : await ft(s) };
991
1002
  }
992
1003
  //#endregion
993
1004
  //#region src/cli.mts
994
- var pt = "Usage: inca <dev|build|package>";
1005
+ var mt = "Usage: inca <dev|build|package>";
995
1006
  function $(e) {
996
1007
  return a.relative(process.cwd(), e);
997
1008
  }
998
- async function mt(e = process.argv) {
1009
+ async function ht(e = process.argv) {
999
1010
  let t = e[2];
1000
1011
  if (t === "build") {
1001
1012
  try {
@@ -1008,7 +1019,7 @@ async function mt(e = process.argv) {
1008
1019
  }
1009
1020
  if (t === "package") {
1010
1021
  try {
1011
- let { appPath: e } = await ft();
1022
+ let { appPath: e } = await pt();
1012
1023
  q(process.stdout, `packaged ${$(e)}`);
1013
1024
  } catch (e) {
1014
1025
  X(process.stderr, "package failed", Y(e)), process.exitCode = 1;
@@ -1016,7 +1027,7 @@ async function mt(e = process.argv) {
1016
1027
  return;
1017
1028
  }
1018
1029
  if (t !== "dev") {
1019
- process.stderr.write(`${pt}\n`), process.exitCode = 1;
1030
+ process.stderr.write(`${mt}\n`), process.exitCode = 1;
1020
1031
  return;
1021
1032
  }
1022
1033
  let n = new AbortController(), r = () => {
@@ -1030,7 +1041,7 @@ async function mt(e = process.argv) {
1030
1041
  ].includes(process.env.INCA_EXPERIMENTAL_HMR ?? "");
1031
1042
  i && q(process.stdout, "experimental HMR active", { timestamp: !0 });
1032
1043
  try {
1033
- await ot({
1044
+ await st({
1034
1045
  signal: n.signal,
1035
1046
  experimentalHmr: i
1036
1047
  });
@@ -1039,4 +1050,4 @@ async function mt(e = process.argv) {
1039
1050
  }
1040
1051
  }
1041
1052
  //#endregion
1042
- export { mt as run };
1053
+ export { ht as run };
package/dist/config.js CHANGED
@@ -1,4 +1,4 @@
1
- import { a as e, t } from "./chunks/defaults-DNvHueCI.js";
1
+ import { a as e, t } from "./chunks/defaults-Bl2pge8b.js";
2
2
  //#region src/config/index.mts
3
3
  var n = e();
4
4
  //#endregion
@@ -4,6 +4,8 @@ export interface HostClientOptions {
4
4
  entryFile: string;
5
5
  /** Overrides which `inca-host` binary gets spawned, in place of automatic resolution. */
6
6
  hostBin?: string;
7
+ /** The environment the host starts with. Defaults to this process's own. */
8
+ env?: NodeJS.ProcessEnv;
7
9
  /**
8
10
  * Every diagnostic line the transport itself produces: the host's real
9
11
  * stderr, a stray stdout line, and a `ready` protocol mismatch. Defaults