@arkstack/console-slim 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,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-Co9YdqkD.js";
1
+ import { n as resolveStubsDir, t as ArkstackConsoleApp } from "./app-6GsnmZ2-.js";
2
2
 
3
3
  export { ArkstackConsoleApp, resolveStubsDir };
package/dist/index.js CHANGED
@@ -1,11 +1,11 @@
1
1
  #!/usr/bin/env node
2
- import { t as ArkstackConsoleApp } from "./app-Co9YdqkD.js";
3
- import { config, env, importFile, loadPrototypes, outputDir } from "@arkstack/common";
2
+ import { t as ArkstackConsoleApp } from "./app-6GsnmZ2-.js";
3
+ import { config, env, importFile, loadPrototypes, outputDir, rebuildOutput } from "@arkstack/common";
4
+ import { existsSync, realpathSync } from "node:fs";
4
5
  import { fileURLToPath, pathToFileURL } from "node:url";
5
6
  import path, { join } from "node:path";
6
7
  import { Arkstack } from "@arkstack/contract";
7
8
  import { MakeResource } from "resora";
8
- import { realpathSync } from "node:fs";
9
9
  import { Command, Kernel } from "@h3ravel/musket";
10
10
  import { spawn } from "node:child_process";
11
11
  import { resolve } from "path";
@@ -196,14 +196,37 @@ var logo_default = String.raw`
196
196
 
197
197
  //#endregion
198
198
  //#region dist/index.js
199
- /**
200
- * Loads the core application instance by importing the bootstrap file.
199
+ /**
200
+ * A missing-module error from importing a stale/incomplete build artifact.
201
201
  *
202
+ * @param error
202
203
  * @returns
203
204
  */
205
+ const isMissingModuleError = (error) => {
206
+ const code = error?.code;
207
+ return code === "MODULE_NOT_FOUND" || code === "ERR_MODULE_NOT_FOUND";
208
+ };
209
+ /**
210
+ * Loads the core application instance by importing the built bootstrap file.
211
+ *
212
+ * The kernel boots this for every command — including `build` — before the build
213
+ * can run, so a stale or incomplete build artifact (source changed since the last
214
+ * build: a module moved, renamed, or added) would otherwise wedge startup with
215
+ * `Cannot find module '<outDir>/...'`. When that happens and source is present,
216
+ * regenerate the output once and retry.
217
+ *
218
+ * @returns
219
+ */
204
220
  const loadCoreApp = async () => {
205
221
  const dist = path.relative(Arkstack.rootDir(), outputDir());
206
- return (await importFile(join(Arkstack.rootDir(), `${dist}/core/bootstrap.js`))).app;
222
+ const bootstrapPath = join(Arkstack.rootDir(), `${dist}/core/bootstrap.js`);
223
+ try {
224
+ return (await importFile(bootstrapPath)).app;
225
+ } catch (error) {
226
+ if (!isMissingModuleError(error) || !existsSync(join(Arkstack.rootDir(), "src"))) throw error;
227
+ await rebuildOutput();
228
+ return (await importFile(bootstrapPath)).app;
229
+ }
207
230
  };
208
231
  /**
209
232
  * Runs the console kernel, initializing the application and registering commands.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arkstack/console-slim",
3
- "version": "0.12.34",
3
+ "version": "0.12.36",
4
4
  "type": "module",
5
5
  "description": "Slim console module for Arkstack, providing the command-line runtime and console integration layer.",
6
6
  "homepage": "https://arkstack.toneflix.net",
@@ -48,8 +48,8 @@
48
48
  "@h3ravel/musket": "^2.0.0",
49
49
  "chalk": "^5.6.2",
50
50
  "resora": "^1.3.25",
51
- "@arkstack/common": "^0.12.34",
52
- "@arkstack/contract": "^0.12.34"
51
+ "@arkstack/contract": "^0.12.36",
52
+ "@arkstack/common": "^0.12.36"
53
53
  },
54
54
  "scripts": {
55
55
  "build": "tsdown",