@arkstack/console 0.12.34 → 0.12.36

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,6 +1,6 @@
1
+ import { readdirSync, writeFileSync } from "node:fs";
1
2
  import path from "node:path";
2
3
  import { Arkstack } from "@arkstack/contract";
3
- import { readdirSync, writeFileSync } from "node:fs";
4
4
  import { Node, Project } from "ts-morph";
5
5
 
6
6
  //#region src/prepare/TSConfig.ts
@@ -1,7 +1,7 @@
1
+ import { existsSync } from "node:fs";
1
2
  import path, { isAbsolute, join } from "node:path";
2
3
  import { Arkstack } from "@arkstack/contract";
3
4
  import { CliApp } from "resora";
4
- import { existsSync } from "node:fs";
5
5
 
6
6
  //#region dist/config.js
7
7
  const defaultConfig = (app) => {
package/dist/app.js CHANGED
@@ -1,3 +1,3 @@
1
- import { n as resolveStubsDir, t as ArkstackConsoleApp } from "./app-DGy8It6S.js";
1
+ import { n as resolveStubsDir, t as ArkstackConsoleApp } from "./app-DnaQWE9q.js";
2
2
 
3
3
  export { ArkstackConsoleApp, resolveStubsDir };
package/dist/index.js CHANGED
@@ -1,12 +1,12 @@
1
1
  #!/usr/bin/env node
2
- import { t as ArkstackConsoleApp } from "./app-DGy8It6S.js";
3
- import { n as BaseTCConfig, r as TSConfig, t as BuildInterfaces } from "./BuildInterfaces-BoL-g5kU.js";
4
- import { abort, abortIf, assertFound, config, env, importFile, initializeGlobalContext, loadPrototypes, outputDir } from "@arkstack/common";
2
+ import { t as ArkstackConsoleApp } from "./app-DnaQWE9q.js";
3
+ import { n as BaseTCConfig, r as TSConfig, t as BuildInterfaces } from "./BuildInterfaces-CsZ3Uerb.js";
4
+ import { abort, abortIf, assertFound, config, env, importFile, initializeGlobalContext, loadPrototypes, outputDir, rebuildOutput } from "@arkstack/common";
5
+ import { existsSync, realpathSync } from "node:fs";
5
6
  import { fileURLToPath, pathToFileURL } from "node:url";
6
7
  import path, { join } from "node:path";
7
8
  import { Arkstack } from "@arkstack/contract";
8
9
  import { MakeResource } from "resora";
9
- import { realpathSync } from "node:fs";
10
10
  import { Command, Kernel } from "@h3ravel/musket";
11
11
  import { spawn } from "node:child_process";
12
12
  import { resolve } from "path";
@@ -260,14 +260,37 @@ var logo_default = String.raw`
260
260
 
261
261
  //#endregion
262
262
  //#region dist/index.js
263
- /**
264
- * Loads the core application instance by importing the bootstrap file.
263
+ /**
264
+ * A missing-module error from importing a stale/incomplete build artifact.
265
265
  *
266
+ * @param error
266
267
  * @returns
267
268
  */
269
+ const isMissingModuleError = (error) => {
270
+ const code = error?.code;
271
+ return code === "MODULE_NOT_FOUND" || code === "ERR_MODULE_NOT_FOUND";
272
+ };
273
+ /**
274
+ * Loads the core application instance by importing the built bootstrap file.
275
+ *
276
+ * The kernel boots this for every command — including `build` — before the build
277
+ * can run, so a stale or incomplete build artifact (source changed since the last
278
+ * build: a module moved, renamed, or added) would otherwise wedge startup with
279
+ * `Cannot find module '<outDir>/...'` and the build could never self-heal. When
280
+ * that happens and source is present, regenerate the output once and retry.
281
+ *
282
+ * @returns
283
+ */
268
284
  const loadCoreApp = async () => {
269
285
  const dist = path.relative(Arkstack.rootDir(), outputDir());
270
- return (await importFile(join(Arkstack.rootDir(), `${dist}/core/bootstrap.js`))).app;
286
+ const bootstrapPath = join(Arkstack.rootDir(), `${dist}/core/bootstrap.js`);
287
+ try {
288
+ return (await importFile(bootstrapPath)).app;
289
+ } catch (error) {
290
+ if (!isMissingModuleError(error) || !existsSync(join(Arkstack.rootDir(), "src"))) throw error;
291
+ await rebuildOutput();
292
+ return (await importFile(bootstrapPath)).app;
293
+ }
271
294
  };
272
295
  /**
273
296
  * Runs the console kernel, initializing the application and registering commands.
package/dist/prepare.js CHANGED
@@ -1,8 +1,8 @@
1
1
  #!/usr/bin/env node
2
- import { t as BuildInterfaces } from "./BuildInterfaces-BoL-g5kU.js";
2
+ import { t as BuildInterfaces } from "./BuildInterfaces-CsZ3Uerb.js";
3
+ import { existsSync, mkdirSync } from "node:fs";
3
4
  import path from "node:path";
4
5
  import { Arkstack } from "@arkstack/contract";
5
- import { existsSync, mkdirSync } from "node:fs";
6
6
  import { spawn } from "node:child_process";
7
7
  import chalk from "chalk";
8
8
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arkstack/console",
3
- "version": "0.12.34",
3
+ "version": "0.12.36",
4
4
  "type": "module",
5
5
  "description": "Console module for Arkstack, providing the command-line runtime and console integration layer.",
6
6
  "homepage": "https://arkstack.toneflix.net/guide/cli",
@@ -51,8 +51,8 @@
51
51
  "chalk": "^5.6.2",
52
52
  "resora": "^1.3.25",
53
53
  "ts-morph": "^28.0.0",
54
- "@arkstack/common": "^0.12.34",
55
- "@arkstack/contract": "^0.12.34"
54
+ "@arkstack/common": "^0.12.36",
55
+ "@arkstack/contract": "^0.12.36"
56
56
  },
57
57
  "scripts": {
58
58
  "build": "tsdown",