@arkstack/console-slim 0.8.0 → 0.9.1

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,7 @@
1
1
  import path, { isAbsolute, join } from "node:path";
2
2
  import { CliApp } from "resora";
3
3
  import { existsSync } from "node:fs";
4
+
4
5
  //#region dist/config.js
5
6
  const defaultConfig = (app) => {
6
7
  return {
@@ -16,6 +17,7 @@ const defaultConfig = (app) => {
16
17
  }
17
18
  };
18
19
  };
20
+
19
21
  //#endregion
20
22
  //#region dist/app.js
21
23
  const resolveStubsDir = (config, options, core) => {
@@ -86,7 +88,6 @@ var ArkstackConsoleApp = class extends CliApp {
86
88
  };
87
89
  };
88
90
  };
89
- //#endregion
90
- export { resolveStubsDir as n, ArkstackConsoleApp as t };
91
91
 
92
- //# sourceMappingURL=app-CCSjImjr.js.map
92
+ //#endregion
93
+ export { resolveStubsDir as n, ArkstackConsoleApp as t };
package/dist/app.d.ts CHANGED
@@ -23,5 +23,4 @@ declare class ArkstackConsoleApp<TCore extends Core> extends CliApp {
23
23
  mergeConfig: () => void;
24
24
  }
25
25
  //#endregion
26
- export { ArkstackConsoleApp, ConsoleAppOptions, resolveStubsDir };
27
- //# sourceMappingURL=app.d.ts.map
26
+ export { ArkstackConsoleApp, ConsoleAppOptions, resolveStubsDir };
package/dist/app.js CHANGED
@@ -1,2 +1,3 @@
1
- import { n as resolveStubsDir, t as ArkstackConsoleApp } from "./app-CCSjImjr.js";
2
- export { ArkstackConsoleApp, resolveStubsDir };
1
+ import { n as resolveStubsDir, t as ArkstackConsoleApp } from "./app-DtecNuLP.js";
2
+
3
+ export { ArkstackConsoleApp, resolveStubsDir };
package/dist/index.d.ts CHANGED
@@ -4,5 +4,4 @@ interface RunConsoleOptions {
4
4
  }
5
5
  declare const runConsoleKernel: (options?: RunConsoleOptions) => Promise<void>;
6
6
  //#endregion
7
- export { RunConsoleOptions, runConsoleKernel };
8
- //# sourceMappingURL=index.d.ts.map
7
+ export { RunConsoleOptions, runConsoleKernel };
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { t as ArkstackConsoleApp } from "./app-CCSjImjr.js";
2
+ import { t as ArkstackConsoleApp } from "./app-DtecNuLP.js";
3
3
  import { config, env, importFile, loadPrototypes, outputDir } from "@arkstack/common";
4
4
  import { fileURLToPath, pathToFileURL } from "node:url";
5
5
  import path, { join } from "node:path";
@@ -10,6 +10,7 @@ import { spawn } from "node:child_process";
10
10
  import { resolve } from "path";
11
11
  import { writeFile } from "fs/promises";
12
12
  import chalk from "chalk";
13
+
13
14
  //#region dist/commands/BuildCommand.js
14
15
  var BuildCommand = class extends Command {
15
16
  signature = "build";
@@ -34,6 +35,7 @@ var BuildCommand = class extends Command {
34
35
  });
35
36
  }
36
37
  };
38
+
37
39
  //#endregion
38
40
  //#region dist/commands/DevCommand.js
39
41
  var DevCommand = class extends Command {
@@ -63,6 +65,7 @@ var DevCommand = class extends Command {
63
65
  });
64
66
  }
65
67
  };
68
+
66
69
  //#endregion
67
70
  //#region dist/commands/MakeCommand.js
68
71
  var MakeCommand = class extends Command {
@@ -98,6 +101,7 @@ var MakeCommand = class extends Command {
98
101
  ].join("\n");
99
102
  }
100
103
  };
104
+
101
105
  //#endregion
102
106
  //#region dist/commands/MakeController.js
103
107
  var MakeController = class extends Command {
@@ -115,6 +119,7 @@ var MakeController = class extends Command {
115
119
  this.success(`Controller: ${this.app.normalizePath(name)} created successfully!`);
116
120
  }
117
121
  };
122
+
118
123
  //#endregion
119
124
  //#region dist/commands/MakeFullResource.js
120
125
  var MakeFullResource = class extends Command {
@@ -141,9 +146,11 @@ var MakeFullResource = class extends Command {
141
146
  this.success(`Created full resource set: ${this.app.normalizePath(res1.name)}, ${this.app.normalizePath(res2.name)}, ${this.app.normalizePath(name3)} successfully!`);
142
147
  }
143
148
  };
149
+
144
150
  //#endregion
145
151
  //#region dist/commands/MakeResource.js
146
152
  var MakeResource$1 = class extends MakeResource {};
153
+
147
154
  //#endregion
148
155
  //#region dist/commands/RouteList.js
149
156
  var RouteList = class extends Command {
@@ -174,6 +181,7 @@ var RouteList = class extends Command {
174
181
  ].join("\n");
175
182
  }
176
183
  };
184
+
177
185
  //#endregion
178
186
  //#region dist/logo.js
179
187
  var logo_default = String.raw`
@@ -184,6 +192,7 @@ var logo_default = String.raw`
184
192
  | | | | | | (__\__ \ || (_| | (__| <
185
193
  \_| |_/_| \___|___/\__\__,_|\___|_|\_\
186
194
  `;
195
+
187
196
  //#endregion
188
197
  //#region dist/index.js
189
198
  /**
@@ -250,7 +259,6 @@ const isEntrypointExecution = () => {
250
259
  }
251
260
  };
252
261
  if (isEntrypointExecution()) await runConsoleKernel();
253
- //#endregion
254
- export { runConsoleKernel };
255
262
 
256
- //# sourceMappingURL=index.js.map
263
+ //#endregion
264
+ export { runConsoleKernel };
package/dist/prepare.js CHANGED
@@ -1,5 +1,6 @@
1
1
  import { spawn } from "node:child_process";
2
2
  import chalk from "chalk";
3
+
3
4
  //#region dist/prepare.js
4
5
  const NODE_ENV = process.env.NODE_ENV || "development";
5
6
  const child = spawn(process.platform === "win32" ? "pnpm.cmd" : "pnpm", [
@@ -24,7 +25,6 @@ child.on("exit", (code) => {
24
25
  }
25
26
  throw new Error(`tsdown exited with code ${code}`);
26
27
  });
27
- //#endregion
28
- export {};
29
28
 
30
- //# sourceMappingURL=prepare.js.map
29
+ //#endregion
30
+ export { };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arkstack/console-slim",
3
- "version": "0.8.0",
3
+ "version": "0.9.1",
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",
@@ -42,14 +42,14 @@
42
42
  }
43
43
  },
44
44
  "peerDependencies": {
45
- "clear-router": "^2.7.2"
45
+ "clear-router": "^2.7.7"
46
46
  },
47
47
  "dependencies": {
48
48
  "@h3ravel/musket": "^0.10.1",
49
49
  "chalk": "^5.6.2",
50
50
  "resora": "^1.3.6",
51
- "@arkstack/common": "^0.8.0",
52
- "@arkstack/contract": "^0.8.0"
51
+ "@arkstack/common": "^0.9.1",
52
+ "@arkstack/contract": "^0.9.1"
53
53
  },
54
54
  "scripts": {
55
55
  "build": "tsdown",
@@ -1 +0,0 @@
1
- {"version":3,"file":"app-CCSjImjr.js","names":[],"sources":["../src/config.ts","../src/app.ts"],"sourcesContent":["import { Core } from './types'\n\nexport const defaultConfig = (app: Core) => {\n const driver = app.getDriver().name ?? 'h3'\n\n return {\n resourcesDir: 'src/app/http/resources',\n localStubsDir: `node_modules/@arkstack/driver-${driver}/stubs`,\n stubs: {\n resource: 'resource.stub',\n collection: 'resource.collection.stub',\n controller: 'controller.stub',\n api: 'controller.api.stub',\n model: 'controller.model.stub',\n apiResource: 'controller.api.resource.stub',\n }\n }\n}","// oxlint-disable typescript/no-explicit-any\nimport path, { isAbsolute, join } from 'node:path'\n\nimport { CliApp } from 'resora'\nimport { defaultConfig } from './config'\nimport { existsSync } from 'node:fs'\n\ninterface Core {\n [k: string]: any\n getDriver: () => {\n [k: string]: any\n name: string\n }\n}\n\nexport interface ConsoleAppOptions {\n stubsDir?: string;\n}\n\nexport const resolveStubsDir = (\n config: { localStubsDir?: string } | undefined,\n options?: ConsoleAppOptions,\n core?: Core\n\n) => {\n const configuredDir = config?.localStubsDir\n\n if (configuredDir) {\n return isAbsolute(configuredDir)\n ? configuredDir\n : join(process.cwd(), configuredDir)\n }\n\n if (!options?.stubsDir) {\n const driver = core?.getDriver().name ?? 'h3'\n let stubsDir = path.resolve(process.cwd(), `node_modules/@arkstack/driver-${driver}/stubs`)\n if (!existsSync(stubsDir)) {\n stubsDir = path.resolve(process.cwd(), 'stubs')\n }\n\n return stubsDir\n }\n\n return options?.stubsDir\n}\n\nexport class ArkstackConsoleApp<TCore extends Core> extends CliApp {\n core: TCore\n private readonly options: ConsoleAppOptions\n\n constructor(\n core: TCore,\n options: ConsoleAppOptions,\n ) {\n super()\n this.core = core\n this.options = options\n this.mergeConfig()\n }\n\n makeController = (name: string, opts: any) => {\n this.mergeConfig()\n const normalized = (name.endsWith('Controller') ? name.replace(/controller/i, '') : name)\n\n let controllerName = normalized.endsWith('Controller') ? normalized : `${normalized}Controller`\n const controllersDir = path.resolve(process.cwd(), 'src', 'app/http/controllers')\n const fileName = `${controllerName}.${opts?.ext ?? 'ts'}`\n const outputPath = join(controllersDir, fileName)\n const stubsDir = resolveStubsDir(this.config as any, this.options, this.core)\n if (!stubsDir) {\n console.error('Error: stubsDir is not configured. Set stubsDir in resora.config.js.')\n process.exit(1)\n }\n\n const stubPath = join(\n stubsDir,\n opts.model\n ? (this.config.stubs as any).model\n : opts.api\n ? (this.config.stubs as any).api\n : (this.config.stubs as any).controller,\n )\n\n if (!existsSync(stubPath)) {\n console.error(`Error: Stub file ${stubPath} not found.`)\n process.exit(1)\n }\n\n controllerName = controllerName.split('/').pop() as string\n\n this.generateFile(\n stubPath,\n outputPath,\n {\n // If class name contains / or ., take only the last part for the class name\n ControllerName: controllerName,\n Model: opts.model?.pascalCase(),\n ModelName: opts.model?.camelCase(),\n Name: controllerName.replace(/controller/i, ''),\n },\n opts,\n )\n\n return outputPath\n }\n\n /**\n * Normalize a file path by removing the current working directory from it. \n * \n * @param p \n * @returns \n */\n normalizePath = (p: string) => {\n return p.replace(process.cwd(), '')\n }\n\n /**\n * Recursively merge defaultConfig with config from resora.config.js, giving \n * precedence to resora.\n */\n mergeConfig = () => {\n this.config = {\n ...defaultConfig(this.core),\n ...this.config,\n stubs: {\n ...defaultConfig(this.core).stubs,\n ...this.config?.stubs,\n },\n }\n }\n}\n"],"mappings":";;;;AAEA,MAAa,iBAAiB,QAAc;CAGxC,OAAO;EACH,cAAc;EACd,eAAe,iCAJJ,IAAI,WAAW,CAAC,QAAQ,KAIoB;EACvD,OAAO;GACH,UAAU;GACV,YAAY;GACZ,YAAY;GACZ,KAAK;GACL,OAAO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,iBAAiB,eAAe,MAAM,IAAI,CAAC,KAAK;EAEhD,KAAK,aACD,UACA,YACA;GAEI,gBAAgB;GAChB,OAAO,KAAK,OAAO,YAAY;GAC/B,WAAW,KAAK,OAAO,WAAW;GAClC,MAAM,eAAe,QAAQ,eAAe,GAAG;GAClD,EACD,KACH;EAED,OAAO;;;;;;;;CASX,iBAAiB,MAAc;EAC3B,OAAO,EAAE,QAAQ,QAAQ,KAAK,EAAE,GAAG;;;;;;CAOvC,oBAAoB;EAChB,KAAK,SAAS;GACV,GAAG,cAAc,KAAK,KAAK;GAC3B,GAAG,KAAK;GACR,OAAO;IACH,GAAG,cAAc,KAAK,KAAK,CAAC;IAC5B,GAAG,KAAK,QAAQ;IACnB;GACJ"}
package/dist/index.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","names":["MakeResource","MakeResourceBase","logo","MakeResource"],"sources":["../src/commands/BuildCommand.ts","../src/commands/DevCommand.ts","../src/commands/MakeCommand.ts","../src/commands/MakeController.ts","../src/commands/MakeFullResource.ts","../src/commands/MakeResource.ts","../src/commands/RouteList.ts","../src/logo.ts","../src/index.ts"],"sourcesContent":["import { Command } from '@h3ravel/musket'\nimport { spawn } from 'node:child_process'\n\nexport class BuildCommand extends Command {\n protected signature = 'build'\n\n protected description = 'Build the application for production'\n\n async handle () {\n await new Promise<void>((resolve, reject) => {\n const command = process.platform === 'win32' ? 'pnpm.cmd' : 'pnpm'\n const child = spawn(command, ['exec', 'tsdown'], {\n cwd: process.cwd(),\n stdio: 'inherit',\n env: Object.assign({}, process.env, {\n NODE_ENV: 'production',\n }),\n })\n\n child.on('error', (error) => {\n reject(error)\n })\n\n child.on('exit', (code) => {\n if (code === 0 || code === null) {\n resolve()\n \nreturn\n }\n\n reject(new Error(`tsdown exited with code ${code}`))\n })\n })\n }\n}\n","import { Command } from '@h3ravel/musket'\nimport { spawn } from 'node:child_process'\n\nexport class DevCommand extends Command {\n protected signature = 'dev'\n\n protected description = 'Run the development server'\n\n async handle () {\n await new Promise<void>((resolve, reject) => {\n const command = process.platform === 'win32' ? 'pnpm.cmd' : 'pnpm'\n const child = spawn(command, ['exec', 'tsdown', '--log-level', 'silent'], {\n cwd: process.cwd(),\n stdio: 'inherit',\n })\n\n child.on('error', (error) => {\n reject(error)\n })\n\n child.on('exit', (code) => {\n if (code === 0 || code === null) {\n resolve()\n \nreturn\n }\n\n reject(new Error(`tsdown exited with code ${code}`))\n })\n })\n }\n}\n","import { Command } from '@h3ravel/musket'\nimport { resolve } from 'path'\nimport { writeFile } from 'fs/promises'\n\nexport class MakeCommand extends Command {\n protected signature = `make:command \n {name : name of the command to create}\n `\n\n protected description = 'Creates a new console command class.'\n\n async handle () {\n const name = String(this.argument('name'))\n .replace(/\\s+/g, '')\n .replace(/\\.ts$/, '').trim()\n\n if (!name) return void this.error('Command name is required')\n\n const stubContent = this.stub(name)\n const filePath = resolve(process.cwd(), 'src', `app/console/commands/${name}.ts`)\n\n await writeFile(filePath, stubContent, { flag: 'wx' })\n this.success(`Command ${name} created successfully at ${filePath}`)\n }\n\n stub (name: string) {\n name = name.endsWith('Command') ? name : `${name}Command`\n name = name.split('/').pop()!.split('.').shift()!\n const signature = `app:${name.toLowerCase()}`\n const description = `Description for ${signature} command`\n\n const stub = [\n 'import { Command } from \\'@h3ravel/musket\\'',\n '',\n `export class ${name} extends Command {`,\n ` signature = '${signature}'`,\n '',\n ` description = '${description}'`,\n '',\n ' async handle () {',\n ' // Command logic goes here',\n ' }',\n '}',\n ]\n\n return stub.join('\\n')\n }\n}\n","import { ArkstackConsoleApp } from '../app'\nimport { Command } from '@h3ravel/musket'\n\n// oxlint-disable-next-line typescript/no-explicit-any\nexport class MakeController extends Command<ArkstackConsoleApp<any>> {\n protected signature = `make:controller\n {name : name of the controller to create}\n {--api : make an API controller}\n {--m|model? : name of model to attach to controller}\n {--force : force overwrite if controller already exists}\n `\n\n protected description = 'Create a new controller file'\n\n async handle () {\n this.app.command = this\n\n if (!this.argument('name')) return void this.error('Error: Controller name is required.')\n\n const name = this.app.makeController(this.argument('name'), this.options())\n\n this.success(`Controller: ${this.app.normalizePath(name)} created successfully!`)\n }\n}\n","import { ArkstackConsoleApp } from '../app'\nimport { Command } from '@h3ravel/musket'\n\n// oxlint-disable-next-line typescript/no-explicit-any\nexport class MakeFullResource extends Command<ArkstackConsoleApp<any>> {\n protected signature = `make:full-resource\n {prefix : prefix of the resources to create, \"Admin\" will create AdminResource, AdminCollection and AdminController}\n {--m|model? : name of model to attach to the generated controller}\n {--f|factory : Create and link a factory}\n {--s|seeder : Create a seeder file for the model (only if --model is specified)}\n {--x|migration : Create a migration file for the model (only if --model is specified)}\n {--force : force overwrite if resources already exist}\n `\n\n protected description =\n 'Create a full new set of API resources (Controller, Resource, Collection)'\n\n async handle () {\n this.app.command = this\n\n const res1 = this.app.makeResource(this.argument('prefix'), {\n force: this.option('force')\n })\n const res2 = this.app.makeResource(this.argument('prefix') + 'Collection', {\n collection: true,\n force: this.option('force'),\n })\n const name3 = this.app.makeController(\n this.argument('prefix'),\n Object.assign({}, this.options(), { api: true, force: this.option('force') }),\n )\n\n this.success(`Created full resource set: ${this.app.normalizePath(res1.name)}, ${this.app.normalizePath(res2.name)}, ${this.app.normalizePath(name3)} successfully!`)\n }\n}\n","import { MakeResource as MakeResourceBase } from 'resora'\n\nexport class MakeResource extends MakeResourceBase {\n}\n","import { ArkstackConsoleApp } from '../app'\nimport type { ArkstackRouterAwareCore } from '@arkstack/contract'\nimport { Command } from '@h3ravel/musket'\nimport type { Route } from 'clear-router'\nimport chalk from 'chalk'\n\ntype App = ArkstackConsoleApp<ArkstackRouterAwareCore<unknown, Route[]>>;\n\nexport class RouteList extends Command<App> {\n protected signature = `route:list\n {--p|path? : Path to filter routes by}\n `\n\n protected description = 'List all registered routes'\n\n async handle () {\n const routes = await this.app.core.getRouter().list(this.options(), this.app.core.getAppInstance())\n\n console.log(this.formatRoutes(routes.reverse()))\n this.newLine()\n this.info(`Total routes: ${routes.length}`)\n }\n\n private formatRoutes (routes: Route[]) {\n if (routes.length === 0) {\n return 'No routes registered.'\n }\n\n const rows = routes.map((route) => ({\n method: route.methods.join('|').toUpperCase(),\n path: route.path,\n handler: route.controllerName ? `${route.controllerName} → ${route.actionName}` : route.actionName ?? 'N/A',\n }))\n\n const methodWidth = Math.max('METHOD'.length, ...rows.map((row) => row.method.length))\n const pathWidth = Math.max('PATH'.length, ...rows.map((row) => row.path.length))\n const handlerWidth = Math.max('HANDLER'.length, ...rows.map((row) => row.handler.length))\n\n const header = `${'METHOD'.padEnd(methodWidth)} ${'PATH'.padEnd(pathWidth)} ${'HANDLER'.padEnd(handlerWidth)}`\n const divider = `${'-'.repeat(methodWidth)} ${'-'.repeat(pathWidth)} ${'-'.repeat(handlerWidth)}`\n const body = rows.map(\n (row) => `${chalk.green(row.method.padEnd(methodWidth))} ${chalk.blue(row.path.padEnd(pathWidth))} ${chalk.yellow(row.handler.padEnd(handlerWidth))}`\n )\n\n return [header, divider, ...body].join('\\n')\n }\n}\n","export default String.raw`\n ___ _ _ \n / _ \\ | | | | \n/ /_\\ \\_ __ ___ ___| |_ __ _ ___| | __\n| _ | '__/ __/ __| __/ _' |/ __| |/ /\n| | | | | | (__\\__ \\ || (_| | (__| < \n\\_| |_/_| \\___|___/\\__\\__,_|\\___|_|\\_\\ \n`","#!/usr/bin/env node\n\nimport { config, env, importFile, loadPrototypes, outputDir } from '@arkstack/common'\nimport { fileURLToPath, pathToFileURL } from 'node:url'\nimport path, { join } from 'node:path'\n\nimport { ArkstackConsoleApp } from './app'\nimport { BuildCommand } from './commands/BuildCommand'\nimport { DevCommand } from './commands/DevCommand'\nimport { Kernel } from '@h3ravel/musket'\nimport { MakeCommand } from './commands/MakeCommand'\nimport { MakeController } from './commands/MakeController'\nimport { MakeFullResource } from './commands/MakeFullResource'\nimport { MakeResource } from './commands/MakeResource'\nimport { RouteList } from './commands/RouteList'\nimport logo from './logo'\nimport { realpathSync } from 'node:fs'\n\nexport interface RunConsoleOptions {\n logo?: string;\n}\n\n/**\n * Loads the core application instance by importing the bootstrap file.\n * \n * @returns \n */\nconst loadCoreApp = async () => {\n const dist = path.relative(process.cwd(), outputDir())\n\n const bootstrapPath = join(process.cwd(), `${dist}/core/bootstrap.js`)\n\n\n const module = await importFile<{ app: any }>(bootstrapPath)\n\n return module.app\n}\n\n/**\n * Runs the console kernel, initializing the application and registering commands.\n * \n * @param options \n */\nexport const runConsoleKernel = async (options: RunConsoleOptions = {}) => {\n loadPrototypes()\n\n const app = await loadCoreApp()\n const dist = path.relative(process.cwd(), outputDir())\n const stubsDir = process.env.ARKSTACK_STUBS_DIR\n globalThis.app = () => app as never\n globalThis.env = env\n globalThis.config = config\n globalThis.arkctx = {\n runtime: 'CLI',\n }\n\n await Kernel.init(await new ArkstackConsoleApp(app, { stubsDir }).loadConfig(), {\n logo: options.logo ?? logo,\n name: 'Cmd',\n baseCommands: [\n RouteList,\n MakeResource,\n MakeController,\n MakeFullResource,\n DevCommand,\n BuildCommand,\n MakeCommand,\n ],\n discoveryPaths: [\n join(process.cwd(), 'src', 'app', 'console', 'commands/*.ts'),\n join(process.cwd(), 'src', 'app/console/commands/*.js'),\n join(process.cwd(), 'src', 'app/console/commands/*.mjs'),\n join(process.cwd(), dist, 'app/console/commands/*.js'),\n join(process.cwd(), dist, 'app/console/commands/*.mjs'),\n join(process.cwd(), 'node_modules', '@arkstack/*', 'dist', 'commands', '*.js'),\n ],\n exceptionHandler (exception) {\n throw exception\n },\n })\n}\n\n/**\n * Determines if the current module is being executed as the entry \n * point of the application.\n * \n * @returns \n */\nconst isEntrypointExecution = () => {\n const argvEntry = process.argv[1]\n\n if (!argvEntry) {\n return false\n }\n\n try {\n const currentModulePath = realpathSync(fileURLToPath(import.meta.url))\n const entryPath = realpathSync(argvEntry)\n\n return currentModulePath === entryPath\n } catch {\n return import.meta.url === pathToFileURL(argvEntry).href\n }\n}\n\nif (isEntrypointExecution()) {\n await runConsoleKernel()\n}\n"],"mappings":";;;;;;;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ACxD,KAAK,QAAQ,KAAK,EAAE,MAAM,4BAA4B;GACtD,KAAK,QAAQ,KAAK,EAAE,MAAM,6BAA6B;GACvD,KAAK,QAAQ,KAAK,EAAE,gBAAgB,eAAe,QAAQ,YAAY,OAAO;GACjF;EACD,iBAAkB,WAAW;GACzB,MAAM;;EAEb,CAAC;;;;;;;;AASN,MAAM,8BAA8B;CAChC,MAAM,YAAY,QAAQ,KAAK;CAE/B,IAAI,CAAC,WACD,OAAO;CAGX,IAAI;EAIA,OAH0B,aAAa,cAAc,OAAO,KAAK,IAAI,CAG7C,KAFN,aAAa,UAEO;SAClC;EACJ,OAAO,OAAO,KAAK,QAAQ,cAAc,UAAU,CAAC;;;AAI5D,IAAI,uBAAuB,EACvB,MAAM,kBAAkB"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"prepare.js","names":[],"sources":["../src/prepare.ts"],"sourcesContent":["import chalk from 'chalk'\nimport { spawn } from 'node:child_process'\n\nconst NODE_ENV = process.env.NODE_ENV || 'development'\nconst command = process.platform === 'win32' ? 'pnpm.cmd' : 'pnpm'\nconst child = spawn(command, ['exec', 'tsdown', '--log-level=silent'], {\n cwd: process.cwd(),\n stdio: 'inherit',\n env: Object.assign({}, process.env, {\n NODE_ENV,\n CLI_BUILD: 'true',\n }),\n})\n\nchild.on('error', (error) => {\n throw error\n})\n\nchild.on('exit', (code) => {\n if (code === 0 || code === null) {\n console.log(chalk.green(`Arkstak is ready for ${NODE_ENV === 'production' ? 'deployment' : NODE_ENV}!`))\n\n return\n }\n\n throw new Error(`tsdown exited with code ${code}`)\n\n})"],"mappings":";;;AAGA,MAAM,WAAW,QAAQ,IAAI,YAAY;AAEzC,MAAM,QAAQ,MADE,QAAQ,aAAa,UAAU,aAAa,QAC/B;CAAC;CAAQ;CAAU;CAAqB,EAAE;CACnE,KAAK,QAAQ,KAAK;CAClB,OAAO;CACP,KAAK,OAAO,OAAO,EAAE,EAAE,QAAQ,KAAK;EAChC;EACA,WAAW;EACd,CAAC;CACL,CAAC;AAEF,MAAM,GAAG,UAAU,UAAU;CACzB,MAAM;EACR;AAEF,MAAM,GAAG,SAAS,SAAS;CACvB,IAAI,SAAS,KAAK,SAAS,MAAM;EAC7B,QAAQ,IAAI,MAAM,MAAM,wBAAwB,aAAa,eAAe,eAAe,SAAS,GAAG,CAAC;EAExG;;CAGJ,MAAM,IAAI,MAAM,2BAA2B,OAAO"}