@orion-js/core 4.4.0 → 4.4.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.
- package/dist/dev/devBuildPath.d.ts +1 -0
- package/dist/dev/runner/index.d.ts +1 -0
- package/dist/dev/watchAndCompile/index.d.ts +2 -2
- package/dist/dev/watchAndCompile/watchAndBundle.d.ts +25 -0
- package/dist/dev/watchAndCompile/watchAndTypecheck.d.ts +11 -0
- package/dist/index.cjs +194 -58
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +183 -47
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/dev/watchAndCompile/getHost.d.ts +0 -2
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const devBuildPath = "./.orion/build/index.js";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { Runner } from '../runner';
|
|
2
|
-
export default function watchAndCompile(runner: Runner): Promise<void>;
|
|
1
|
+
import { Runner, RunnerOptions } from '../runner';
|
|
2
|
+
export default function watchAndCompile(runner: Runner, options: RunnerOptions): Promise<void>;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import chokidar from 'chokidar';
|
|
2
|
+
import * as esbuild from 'esbuild';
|
|
3
|
+
import type { Runner, RunnerOptions } from '../runner';
|
|
4
|
+
/**
|
|
5
|
+
* Bundle application code once and rebuild it incrementally on edits.
|
|
6
|
+
*
|
|
7
|
+
* Running the bundle avoids making Node transform every TypeScript module on
|
|
8
|
+
* every restart. Dependencies remain external so their native Node behavior
|
|
9
|
+
* stays identical to a production build.
|
|
10
|
+
*/
|
|
11
|
+
export declare function watchAndBundle(runner: Runner, options: RunnerOptions, onFilesChanged?: () => void): Promise<{
|
|
12
|
+
context: esbuild.BuildContext<{
|
|
13
|
+
entryPoints: string[];
|
|
14
|
+
outfile: string;
|
|
15
|
+
tsconfig: string;
|
|
16
|
+
format: "esm";
|
|
17
|
+
platform: "node";
|
|
18
|
+
bundle: true;
|
|
19
|
+
target: string;
|
|
20
|
+
sourcemap: true;
|
|
21
|
+
packages: "external";
|
|
22
|
+
plugins: esbuild.Plugin[];
|
|
23
|
+
}>;
|
|
24
|
+
watcher: chokidar.FSWatcher;
|
|
25
|
+
}>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Runner } from '../runner';
|
|
2
|
+
/**
|
|
3
|
+
* Create a serialized, on-demand TypeScript checker.
|
|
4
|
+
*
|
|
5
|
+
* `tsc --watch` creates a second filesystem watcher for the entire project and
|
|
6
|
+
* can stall when the operating system is already watching many worktrees. A
|
|
7
|
+
* one-off check is both faster and sufficient because the bundle watcher calls
|
|
8
|
+
* this function after every source change. Changes received during an active
|
|
9
|
+
* check collapse into one fresh check, so stale diagnostics never stop the app.
|
|
10
|
+
*/
|
|
11
|
+
export declare function watchAndTypecheck(runner: Runner): () => void;
|
package/dist/index.cjs
CHANGED
|
@@ -85,15 +85,18 @@ async function writeFile_default(path3, content) {
|
|
|
85
85
|
var import_node_child_process2 = require("child_process");
|
|
86
86
|
var import_chalk = __toESM(require("chalk"), 1);
|
|
87
87
|
|
|
88
|
+
// src/dev/devBuildPath.ts
|
|
89
|
+
var devBuildPath = "./.orion/build/index.js";
|
|
90
|
+
|
|
88
91
|
// src/dev/runner/getArgs.ts
|
|
89
92
|
function getArgs(options, command) {
|
|
90
93
|
if (options.node) {
|
|
91
|
-
const startCommand2 = "
|
|
92
|
-
const args2 = ["
|
|
94
|
+
const startCommand2 = "node";
|
|
95
|
+
const args2 = ["--enable-source-maps", ...command.args, devBuildPath];
|
|
93
96
|
return { startCommand: startCommand2, args: args2 };
|
|
94
97
|
}
|
|
95
98
|
const startCommand = "bun";
|
|
96
|
-
const args = ["--watch", ...command.args,
|
|
99
|
+
const args = ["--watch", ...command.args, devBuildPath];
|
|
97
100
|
return { startCommand, args };
|
|
98
101
|
}
|
|
99
102
|
|
|
@@ -121,14 +124,16 @@ function getRunner(options, command) {
|
|
|
121
124
|
console.log(import_chalk2.default.bold("=> Cleaning directory...\n"));
|
|
122
125
|
}
|
|
123
126
|
const startApp = () => {
|
|
124
|
-
|
|
125
|
-
appProcess
|
|
127
|
+
const startedProcess = startProcess(options, command);
|
|
128
|
+
appProcess = startedProcess;
|
|
129
|
+
startedProcess.on("exit", (code, signal) => {
|
|
130
|
+
if (appProcess === startedProcess) appProcess = null;
|
|
126
131
|
if (!code || code === 143 || code === 0 || signal === "SIGTERM" || signal === "SIGINT") {
|
|
127
132
|
} else {
|
|
128
133
|
console.log(import_chalk2.default.bold(`=> Error running app. Exit code: ${code}`));
|
|
129
134
|
}
|
|
130
135
|
});
|
|
131
|
-
writeFile_default(".orion/process", `${
|
|
136
|
+
writeFile_default(".orion/process", `${startedProcess.pid}`);
|
|
132
137
|
};
|
|
133
138
|
const stop = () => {
|
|
134
139
|
if (appProcess) {
|
|
@@ -178,22 +183,129 @@ async function cleanDirectory(directory) {
|
|
|
178
183
|
}
|
|
179
184
|
}
|
|
180
185
|
|
|
181
|
-
// src/dev/watchAndCompile/
|
|
186
|
+
// src/dev/watchAndCompile/watchAndBundle.ts
|
|
187
|
+
var import_node_fs4 = require("fs");
|
|
188
|
+
var import_node_module = require("module");
|
|
189
|
+
var import_node_path3 = require("path");
|
|
190
|
+
var import_chokidar = __toESM(require("chokidar"), 1);
|
|
191
|
+
var esbuild = __toESM(require("esbuild"), 1);
|
|
192
|
+
function getPackageName(specifier) {
|
|
193
|
+
const segments = specifier.split("/");
|
|
194
|
+
return specifier.startsWith("@") ? segments.slice(0, 2).join("/") : segments[0];
|
|
195
|
+
}
|
|
196
|
+
function nodeExternalCompatibilityPlugin() {
|
|
197
|
+
const requireFromApp = (0, import_node_module.createRequire)((0, import_node_path3.join)(process.cwd(), "package.json"));
|
|
198
|
+
return {
|
|
199
|
+
name: "orion-node-external-compatibility",
|
|
200
|
+
setup(build3) {
|
|
201
|
+
build3.onResolve({ filter: /^[^./].*\.json$/ }, (args) => {
|
|
202
|
+
try {
|
|
203
|
+
return { path: requireFromApp.resolve(args.path) };
|
|
204
|
+
} catch {
|
|
205
|
+
return void 0;
|
|
206
|
+
}
|
|
207
|
+
});
|
|
208
|
+
build3.onResolve({ filter: /^[^./]/ }, (args) => {
|
|
209
|
+
const packageName = getPackageName(args.path);
|
|
210
|
+
if (args.path === packageName || (0, import_node_path3.extname)(args.path)) return void 0;
|
|
211
|
+
try {
|
|
212
|
+
const packageJsonPath = requireFromApp.resolve(`${packageName}/package.json`);
|
|
213
|
+
const packageJson = JSON.parse((0, import_node_fs4.readFileSync)(packageJsonPath, "utf8"));
|
|
214
|
+
if (packageJson.exports) return void 0;
|
|
215
|
+
const resolvedExtension = (0, import_node_path3.extname)(requireFromApp.resolve(args.path));
|
|
216
|
+
if (!resolvedExtension) return void 0;
|
|
217
|
+
return { path: `${args.path}${resolvedExtension}`, external: true };
|
|
218
|
+
} catch {
|
|
219
|
+
return void 0;
|
|
220
|
+
}
|
|
221
|
+
});
|
|
222
|
+
}
|
|
223
|
+
};
|
|
224
|
+
}
|
|
225
|
+
async function watchAndBundle(runner, options, onFilesChanged) {
|
|
226
|
+
let hasSuccessfulBuild = false;
|
|
227
|
+
let buildStartedAt = Date.now();
|
|
228
|
+
let rebuildInProgress = false;
|
|
229
|
+
let rebuildRequested = false;
|
|
230
|
+
let rebuildTimer;
|
|
231
|
+
const context2 = await esbuild.context({
|
|
232
|
+
entryPoints: ["./app/index.ts"],
|
|
233
|
+
outfile: devBuildPath,
|
|
234
|
+
tsconfig: "./tsconfig.json",
|
|
235
|
+
format: "esm",
|
|
236
|
+
platform: "node",
|
|
237
|
+
bundle: true,
|
|
238
|
+
target: "node22",
|
|
239
|
+
sourcemap: true,
|
|
240
|
+
packages: "external",
|
|
241
|
+
plugins: [
|
|
242
|
+
nodeExternalCompatibilityPlugin(),
|
|
243
|
+
{
|
|
244
|
+
name: "orion-dev-restart",
|
|
245
|
+
setup(build3) {
|
|
246
|
+
build3.onStart(() => {
|
|
247
|
+
buildStartedAt = Date.now();
|
|
248
|
+
});
|
|
249
|
+
build3.onEnd((result) => {
|
|
250
|
+
if (result.errors.length > 0) {
|
|
251
|
+
runner.stop();
|
|
252
|
+
return;
|
|
253
|
+
}
|
|
254
|
+
console.log(`=> Application bundled in ${Date.now() - buildStartedAt}ms`);
|
|
255
|
+
if (hasSuccessfulBuild && options.node) {
|
|
256
|
+
runner.restart();
|
|
257
|
+
} else if (!hasSuccessfulBuild) {
|
|
258
|
+
hasSuccessfulBuild = true;
|
|
259
|
+
runner.start();
|
|
260
|
+
} else {
|
|
261
|
+
runner.start();
|
|
262
|
+
}
|
|
263
|
+
});
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
]
|
|
267
|
+
});
|
|
268
|
+
const rebuild = async () => {
|
|
269
|
+
if (rebuildInProgress) {
|
|
270
|
+
rebuildRequested = true;
|
|
271
|
+
return;
|
|
272
|
+
}
|
|
273
|
+
rebuildInProgress = true;
|
|
274
|
+
do {
|
|
275
|
+
rebuildRequested = false;
|
|
276
|
+
try {
|
|
277
|
+
await context2.rebuild();
|
|
278
|
+
} catch {
|
|
279
|
+
}
|
|
280
|
+
} while (rebuildRequested);
|
|
281
|
+
rebuildInProgress = false;
|
|
282
|
+
};
|
|
283
|
+
await rebuild();
|
|
284
|
+
const watcher = import_chokidar.default.watch(["./app", "./tsconfig.json"], { ignoreInitial: true });
|
|
285
|
+
watcher.on("all", () => {
|
|
286
|
+
onFilesChanged == null ? void 0 : onFilesChanged();
|
|
287
|
+
clearTimeout(rebuildTimer);
|
|
288
|
+
rebuildTimer = setTimeout(rebuild, 20);
|
|
289
|
+
});
|
|
290
|
+
watcher.on("error", (error) => console.error(`Unable to watch application files: ${error.message}`));
|
|
291
|
+
return { context: context2, watcher };
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
// src/dev/watchAndCompile/watchAndTypecheck.ts
|
|
182
295
|
var import_node_child_process3 = require("child_process");
|
|
183
|
-
var import_node_readline = require("readline");
|
|
184
296
|
|
|
185
297
|
// src/dev/watchAndCompile/getConfigPath.ts
|
|
186
|
-
var
|
|
187
|
-
var
|
|
298
|
+
var import_node_fs6 = require("fs");
|
|
299
|
+
var import_node_path4 = require("path");
|
|
188
300
|
|
|
189
301
|
// src/dev/watchAndCompile/ensureConfigComplies.ts
|
|
190
302
|
var import_comment_json = require("comment-json");
|
|
191
303
|
|
|
192
304
|
// src/helpers/getFileContents.ts
|
|
193
|
-
var
|
|
305
|
+
var import_node_fs5 = __toESM(require("fs"), 1);
|
|
194
306
|
function readFile(filePath) {
|
|
195
|
-
if (!
|
|
196
|
-
return
|
|
307
|
+
if (!import_node_fs5.default.existsSync(filePath)) return null;
|
|
308
|
+
return import_node_fs5.default.readFileSync(filePath).toString();
|
|
197
309
|
}
|
|
198
310
|
|
|
199
311
|
// src/dev/watchAndCompile/ensureConfigComplies.ts
|
|
@@ -230,9 +342,9 @@ function ensureConfigComplies(configPath) {
|
|
|
230
342
|
function findConfigFile(startDirectory, fileName) {
|
|
231
343
|
let directory = startDirectory;
|
|
232
344
|
while (true) {
|
|
233
|
-
const candidate = (0,
|
|
234
|
-
if ((0,
|
|
235
|
-
const parent = (0,
|
|
345
|
+
const candidate = (0, import_node_path4.join)(directory, fileName);
|
|
346
|
+
if ((0, import_node_fs6.existsSync)(candidate)) return candidate;
|
|
347
|
+
const parent = (0, import_node_path4.dirname)(directory);
|
|
236
348
|
if (parent === directory) return void 0;
|
|
237
349
|
directory = parent;
|
|
238
350
|
}
|
|
@@ -247,47 +359,69 @@ function getConfigPath() {
|
|
|
247
359
|
return configPath;
|
|
248
360
|
}
|
|
249
361
|
|
|
250
|
-
// src/dev/watchAndCompile/
|
|
251
|
-
function
|
|
362
|
+
// src/dev/watchAndCompile/watchAndTypecheck.ts
|
|
363
|
+
function watchAndTypecheck(runner) {
|
|
252
364
|
const configPath = getConfigPath();
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
output.on("line", (line) => {
|
|
259
|
-
console.log(line);
|
|
260
|
-
if (line.includes("Starting compilation") || line.includes("File change detected")) {
|
|
261
|
-
runner.stop();
|
|
365
|
+
let checkInProgress = false;
|
|
366
|
+
let checkRequested = false;
|
|
367
|
+
const runCheck = () => {
|
|
368
|
+
if (checkInProgress) {
|
|
369
|
+
checkRequested = true;
|
|
262
370
|
return;
|
|
263
371
|
}
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
372
|
+
checkInProgress = true;
|
|
373
|
+
const startedAt = Date.now();
|
|
374
|
+
const checker = (0, import_node_child_process3.spawn)("tsc", ["--noEmit", "--project", configPath], {
|
|
375
|
+
env: process.env,
|
|
376
|
+
stdio: ["ignore", "pipe", "pipe"]
|
|
377
|
+
});
|
|
378
|
+
let output = "";
|
|
379
|
+
let spawnError;
|
|
380
|
+
checker.stdout.on("data", (chunk) => {
|
|
381
|
+
output += chunk.toString();
|
|
382
|
+
});
|
|
383
|
+
checker.stderr.on("data", (chunk) => {
|
|
384
|
+
output += chunk.toString();
|
|
385
|
+
});
|
|
386
|
+
checker.on("error", (error) => {
|
|
387
|
+
spawnError = error;
|
|
388
|
+
});
|
|
389
|
+
checker.on("close", (code) => {
|
|
390
|
+
checkInProgress = false;
|
|
391
|
+
if (checkRequested) {
|
|
392
|
+
checkRequested = false;
|
|
393
|
+
runCheck();
|
|
394
|
+
return;
|
|
395
|
+
}
|
|
396
|
+
if (spawnError) {
|
|
397
|
+
runner.stop();
|
|
398
|
+
console.error(`Unable to run TypeScript: ${spawnError.message}`);
|
|
399
|
+
return;
|
|
400
|
+
}
|
|
401
|
+
const duration = Date.now() - startedAt;
|
|
402
|
+
if (code === 0) {
|
|
403
|
+
console.log(`=> TypeScript checked in ${duration}ms`);
|
|
404
|
+
runner.start();
|
|
405
|
+
return;
|
|
406
|
+
}
|
|
407
|
+
if (output.trim()) console.error(output.trimEnd());
|
|
408
|
+
console.error(`=> TypeScript found errors in ${duration}ms`);
|
|
269
409
|
runner.stop();
|
|
270
|
-
}
|
|
271
|
-
}
|
|
272
|
-
|
|
273
|
-
errors.on("line", (line) => console.error(line));
|
|
274
|
-
watcher.on("error", (error) => {
|
|
275
|
-
runner.stop();
|
|
276
|
-
console.error(`Unable to start TypeScript: ${error.message}`);
|
|
277
|
-
});
|
|
278
|
-
return watcher;
|
|
410
|
+
});
|
|
411
|
+
};
|
|
412
|
+
return runCheck;
|
|
279
413
|
}
|
|
280
414
|
|
|
281
415
|
// src/dev/watchAndCompile/writeEnvFile.ts
|
|
282
416
|
var import_env = require("@orion-js/env");
|
|
283
417
|
var import_chalk3 = __toESM(require("chalk"), 1);
|
|
284
|
-
var
|
|
418
|
+
var import_chokidar2 = __toESM(require("chokidar"), 1);
|
|
285
419
|
var envFilePath = process.env.ORION_ENV_FILE_PATH;
|
|
286
420
|
var dtsFilePath = "./app/env.d.ts";
|
|
287
421
|
var watchEnvFile = async (runner) => {
|
|
288
422
|
if (!envFilePath) return;
|
|
289
423
|
(0, import_env.writeDtsFileFromConfigFile)(envFilePath, dtsFilePath);
|
|
290
|
-
|
|
424
|
+
import_chokidar2.default.watch(envFilePath, { ignoreInitial: true }).on("change", async () => {
|
|
291
425
|
console.log(import_chalk3.default.bold("=> Environment file changed. Restarting..."));
|
|
292
426
|
(0, import_env.writeDtsFileFromConfigFile)(envFilePath, dtsFilePath);
|
|
293
427
|
runner.restart();
|
|
@@ -295,9 +429,11 @@ var watchEnvFile = async (runner) => {
|
|
|
295
429
|
};
|
|
296
430
|
|
|
297
431
|
// src/dev/watchAndCompile/index.ts
|
|
298
|
-
async function watchAndCompile(runner) {
|
|
432
|
+
async function watchAndCompile(runner, options) {
|
|
299
433
|
await cleanDirectory();
|
|
300
|
-
|
|
434
|
+
const requestTypecheck = options.typecheck ? watchAndTypecheck(runner) : void 0;
|
|
435
|
+
await watchAndBundle(runner, options, requestTypecheck);
|
|
436
|
+
requestTypecheck == null ? void 0 : requestTypecheck();
|
|
301
437
|
watchEnvFile(runner);
|
|
302
438
|
}
|
|
303
439
|
|
|
@@ -307,7 +443,7 @@ async function dev_default(options, command) {
|
|
|
307
443
|
Orionjs App ${import_chalk4.default.green(import_chalk4.default.bold("V4"))} Dev mode
|
|
308
444
|
`));
|
|
309
445
|
const runner = getRunner(options, command);
|
|
310
|
-
watchAndCompile(runner);
|
|
446
|
+
await watchAndCompile(runner, options);
|
|
311
447
|
}
|
|
312
448
|
|
|
313
449
|
// src/prod/index.ts
|
|
@@ -318,11 +454,11 @@ var import_chalk7 = __toESM(require("chalk"), 1);
|
|
|
318
454
|
|
|
319
455
|
// src/build/build.ts
|
|
320
456
|
var import_chalk5 = __toESM(require("chalk"), 1);
|
|
321
|
-
var
|
|
457
|
+
var esbuild2 = __toESM(require("esbuild"), 1);
|
|
322
458
|
async function build2(options) {
|
|
323
459
|
const { output } = options;
|
|
324
460
|
console.log(`Building with esbuild to ${output}`);
|
|
325
|
-
await
|
|
461
|
+
await esbuild2.build({
|
|
326
462
|
entryPoints: ["./app/index.ts"],
|
|
327
463
|
tsconfig: "./tsconfig.json",
|
|
328
464
|
format: "esm",
|
|
@@ -436,15 +572,15 @@ process.on("unhandledRejection", (error) => {
|
|
|
436
572
|
});
|
|
437
573
|
|
|
438
574
|
// src/version.ts
|
|
439
|
-
var
|
|
440
|
-
var
|
|
575
|
+
var import_node_fs7 = require("fs");
|
|
576
|
+
var import_node_path5 = require("path");
|
|
441
577
|
var import_node_url = require("url");
|
|
442
578
|
var import_meta = {};
|
|
443
579
|
function getVersion() {
|
|
444
580
|
try {
|
|
445
|
-
const dir = (0,
|
|
446
|
-
const pkgPath = (0,
|
|
447
|
-
const pkg = JSON.parse((0,
|
|
581
|
+
const dir = (0, import_node_path5.dirname)((0, import_node_url.fileURLToPath)(import_meta.url));
|
|
582
|
+
const pkgPath = (0, import_node_path5.resolve)(dir, "..", "package.json");
|
|
583
|
+
const pkg = JSON.parse((0, import_node_fs7.readFileSync)(pkgPath, "utf-8"));
|
|
448
584
|
return pkg.version;
|
|
449
585
|
} catch {
|
|
450
586
|
return "unknown";
|
|
@@ -506,16 +642,16 @@ function info() {
|
|
|
506
642
|
}
|
|
507
643
|
|
|
508
644
|
// src/repl/index.ts
|
|
509
|
-
var
|
|
510
|
-
var
|
|
645
|
+
var import_node_fs8 = require("fs");
|
|
646
|
+
var import_node_path6 = require("path");
|
|
511
647
|
var import_chalk13 = __toESM(require("chalk"), 1);
|
|
512
648
|
function resolvePort(options) {
|
|
513
649
|
if (options.port) {
|
|
514
650
|
return Number(options.port);
|
|
515
651
|
}
|
|
516
652
|
try {
|
|
517
|
-
const portFile = (0,
|
|
518
|
-
const port = (0,
|
|
653
|
+
const portFile = (0, import_node_path6.resolve)(process.cwd(), ".orion/port");
|
|
654
|
+
const port = (0, import_node_fs8.readFileSync)(portFile, "utf-8").trim();
|
|
519
655
|
return Number(port);
|
|
520
656
|
} catch {
|
|
521
657
|
}
|
|
@@ -575,7 +711,7 @@ var run = (action) => async (...args) => {
|
|
|
575
711
|
console.error(import_chalk14.default.red(`Error: ${e.message}`));
|
|
576
712
|
}
|
|
577
713
|
};
|
|
578
|
-
program.command("dev").description("Run the Orionjs app in development mode").option("--node", "Use Node.js runtime instead of Bun").option("--repl", "Enable REPL endpoint for orion repl").allowUnknownOption().action(run(dev_default));
|
|
714
|
+
program.command("dev").description("Run the Orionjs app in development mode").option("--node", "Use Node.js runtime instead of Bun").option("--repl", "Enable REPL endpoint for orion repl").option("--no-typecheck", "Disable continuous TypeScript diagnostics").allowUnknownOption().action(run(dev_default));
|
|
579
715
|
program.command("check").description("Runs a typescript check").action(run(check_default));
|
|
580
716
|
program.command("build").description("Build the Orionjs app for production").option("--output [path]", "Path of the output file").action(run(build_default));
|
|
581
717
|
program.command("prod").allowUnknownOption().option("--node", "Use Node.js runtime instead of Bun").option(
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/helpers/execute.ts","../src/create/index.ts","../src/dev/index.ts","../src/dev/runner/index.ts","../src/helpers/writeFile.ts","../src/helpers/ensureDirectory.ts","../src/dev/runner/startProcess.ts","../src/dev/runner/getArgs.ts","../src/dev/watchAndCompile/cleanDirectory.ts","../src/dev/watchAndCompile/getHost.ts","../src/dev/watchAndCompile/getConfigPath.ts","../src/dev/watchAndCompile/ensureConfigComplies.ts","../src/helpers/getFileContents.ts","../src/dev/watchAndCompile/writeEnvFile.ts","../src/dev/watchAndCompile/index.ts","../src/prod/index.ts","../src/build/index.ts","../src/build/build.ts","../src/build/checkTs.ts","../src/prod/runProd.ts","../src/handleErrors.ts","../src/version.ts","../src/check/index.ts","../src/check/checkTs.ts","../src/info.ts","../src/repl/index.ts"],"sourcesContent":["#!/usr/bin/env node\nimport chalk from 'chalk'\nimport {Command} from 'commander'\nimport create from './create'\nimport dev from './dev'\nimport prod from './prod'\nimport './handleErrors'\nimport version from './version'\nimport 'dotenv/config'\nimport build from './build'\nimport check from './check'\nimport info from './info'\nimport repl from './repl'\n\nconst program = new Command()\n\nconst run =\n action =>\n async (...args) => {\n try {\n await action(...args)\n } catch (e) {\n console.error(chalk.red(`Error: ${e.message}`))\n }\n }\n\nprogram\n .command('dev')\n .description('Run the Orionjs app in development mode')\n .option('--node', 'Use Node.js runtime instead of Bun')\n .option('--repl', 'Enable REPL endpoint for orion repl')\n .allowUnknownOption()\n .action(run(dev))\n\nprogram.command('check').description('Runs a typescript check').action(run(check))\n\nprogram\n .command('build')\n .description('Build the Orionjs app for production')\n .option('--output [path]', 'Path of the output file')\n .action(run(build))\n\nprogram\n .command('prod')\n .allowUnknownOption()\n .option('--node', 'Use Node.js runtime instead of Bun')\n .option(\n '--path [path]',\n 'Path of the compiled Orionjs app. If not provided, the app will be compiled and then run',\n )\n .description('Run the Orionjs app in production mode')\n .action(run(prod))\n\nprogram\n .command('create')\n .description('Creates a new Orionjs project')\n .option('--name [name]', 'Name of the project')\n .option('--kit [kit]', 'Which starter kit to use')\n .action(run(create))\n\nprogram.command('info').description('Print runtime and version info').action(run(info))\n\nprogram\n .command('repl')\n .description('Evaluate an expression against a running Orionjs dev server')\n .requiredOption('-e, --expression <expression>', 'Expression to evaluate')\n .option('--port <port>', 'Port of the dev server (default: auto-detect from .orion/port)')\n .action(run(repl))\n\nprogram.version(version, '-v --version')\n\nprogram.parse(process.argv)\n\nif (!process.argv.slice(2).length) {\n program.outputHelp()\n}\n","import {exec} from 'node:child_process'\n\nexport default async function (command) {\n return new Promise((resolve, reject) => {\n exec(command, (error, stdout, stderr) => {\n if (error) {\n reject(error)\n } else {\n resolve({stdout, stderr})\n }\n })\n })\n}\n","import execute from '../helpers/execute'\n\nexport default async function ({name, kit}) {\n if (!name) {\n throw new Error('Please set the name of the app')\n }\n if (!kit) {\n throw new Error('Please select which kit to use')\n }\n const repo = `https://github.com/siturra/boilerplate-orionjs-${kit}`\n console.log('Downloading starter kit...')\n await execute(`git clone ${repo} ${name}`)\n await execute(`cd ${name} && rm -rf .git`)\n console.log('Your starter kit is ready')\n}\n","import chalk from 'chalk'\nimport {getRunner, RunnerOptions} from './runner'\nimport watchAndCompile from './watchAndCompile'\n\nexport default async function (options: RunnerOptions, command: any) {\n console.log(chalk.bold(`\\nOrionjs App ${chalk.green(chalk.bold('V4'))} Dev mode \\n`))\n\n const runner = getRunner(options, command)\n\n watchAndCompile(runner)\n}\n","import chalk from 'chalk'\nimport writeFile from '../../helpers/writeFile'\nimport {startProcess} from './startProcess'\n\nexport interface RunnerOptions {\n shell: boolean\n clean: boolean\n node: boolean\n repl: boolean\n}\n\nexport interface Runner {\n start: () => void\n restart: () => void\n stop: () => void\n}\n\nexport function getRunner(options: RunnerOptions, command: any): Runner {\n let appProcess = null\n\n if (options.clean) {\n console.log(chalk.bold('=> Cleaning directory...\\n'))\n }\n\n const startApp = () => {\n appProcess = startProcess(options, command)\n\n appProcess.on('exit', (code: number, signal: string) => {\n if (!code || code === 143 || code === 0 || signal === 'SIGTERM' || signal === 'SIGINT') {\n } else {\n console.log(chalk.bold(`=> Error running app. Exit code: ${code}`))\n }\n })\n\n writeFile('.orion/process', `${appProcess.pid}`)\n }\n\n const stop = () => {\n if (appProcess) {\n appProcess.kill()\n appProcess = null\n }\n }\n\n const restart = () => {\n console.log(chalk.bold('=> Restarting app...\\n'))\n stop()\n startApp()\n }\n\n const start = () => {\n // check if the app is already running\n if (appProcess) {\n // console.log(chalk.bold('=> App is already running. Restarting...\\n'))\n } else {\n startApp()\n }\n }\n\n return {\n restart,\n stop,\n start,\n }\n}\n","import fs from 'node:fs'\nimport ensureDirectory from '../helpers/ensureDirectory'\n\nexport default async function (path: string, content: string): Promise<void> {\n ensureDirectory(path)\n fs.writeFileSync(path, content)\n}\n","import fs from 'node:fs'\nimport path from 'node:path'\n\nconst ensureDirectory = filePath => {\n const dirname = path.dirname(filePath)\n if (fs.existsSync(dirname)) return true\n ensureDirectory(dirname)\n fs.mkdirSync(dirname)\n}\n\nexport default ensureDirectory\n","import {spawn} from 'node:child_process'\nimport chalk from 'chalk'\nimport {getArgs} from './getArgs'\nimport {RunnerOptions} from './index'\n\nexport function startProcess(options: RunnerOptions, command: any) {\n const {startCommand, args} = getArgs(options, command)\n\n console.log(chalk.bold(`=> Starting app with command: ${startCommand} ${args.join(' ')}...\\n`))\n return spawn(startCommand, args, {\n env: {\n ORION_DEV: 'local',\n ...process.env,\n ...(options.repl ? {ORION_REPL: 'true'} : {}),\n },\n cwd: process.cwd(),\n stdio: 'inherit',\n detached: false,\n })\n}\n","import {RunnerOptions} from './index'\n\nexport function getArgs(options: RunnerOptions, command: any) {\n if (options.node) {\n const startCommand = 'tsx'\n const args = ['watch', '--clear-screen=false', ...command.args, './app/index.ts']\n return {startCommand, args}\n }\n\n const startCommand = 'bun'\n const args = ['--watch', ...command.args, './app/index.ts']\n return {startCommand, args}\n}\n","import fs from 'node:fs'\nimport path from 'node:path'\n\n/**\n * Remove directory recursively\n * @param {string} dir_path\n * @see https://stackoverflow.com/a/42505874/3027390\n */\nfunction rimraf(dir_path: string) {\n if (fs.existsSync(dir_path)) {\n fs.readdirSync(dir_path).map(entry => {\n const entry_path = path.join(dir_path, entry)\n if (fs.lstatSync(entry_path).isDirectory()) {\n rimraf(entry_path)\n } else {\n fs.unlinkSync(entry_path)\n }\n })\n fs.rmdirSync(dir_path)\n }\n}\n\nexport default async function cleanDirectory(directory?: string) {\n try {\n const dirPath = directory ? directory : path.join(process.cwd(), '.orion', 'build')\n rimraf(dirPath)\n } catch (_) {\n // Ignore errors during cleanup\n }\n}\n","import {spawn} from 'node:child_process'\nimport {createInterface} from 'node:readline'\nimport type {Runner} from '../runner'\nimport {getConfigPath} from './getConfigPath'\n\nexport function getHost(runner: Runner) {\n const configPath = getConfigPath()\n const watcher = spawn('tsc', ['--watch', '--noEmit', '--project', configPath], {\n env: process.env,\n stdio: ['ignore', 'pipe', 'pipe'],\n })\n\n const output = createInterface({input: watcher.stdout})\n output.on('line', line => {\n console.log(line)\n\n if (line.includes('Starting compilation') || line.includes('File change detected')) {\n runner.stop()\n return\n }\n\n if (line.includes('Found 0 errors.')) {\n runner.start()\n return\n }\n\n if (/Found [1-9]\\d* errors?\\./.test(line)) {\n runner.stop()\n }\n })\n\n const errors = createInterface({input: watcher.stderr})\n errors.on('line', line => console.error(line))\n\n watcher.on('error', error => {\n runner.stop()\n console.error(`Unable to start TypeScript: ${error.message}`)\n })\n\n return watcher\n}\n","import {existsSync} from 'node:fs'\nimport {dirname, join} from 'node:path'\nimport {ensureConfigComplies} from './ensureConfigComplies'\n\nfunction findConfigFile(startDirectory: string, fileName: string): string | undefined {\n let directory = startDirectory\n\n while (true) {\n const candidate = join(directory, fileName)\n if (existsSync(candidate)) return candidate\n\n const parent = dirname(directory)\n if (parent === directory) return undefined\n directory = parent\n }\n}\n\nexport function getConfigPath() {\n const appBasePath = process.cwd()\n\n const configPath =\n findConfigFile(appBasePath, 'tsconfig.server.json') ||\n findConfigFile(appBasePath, 'tsconfig.json')\n\n if (!configPath) {\n throw new Error(\"Could not find a valid 'tsconfig.json'.\")\n }\n\n ensureConfigComplies(configPath)\n\n return configPath\n}\n","import {parse, stringify} from 'comment-json'\nimport getFileContents from '../../helpers/getFileContents'\nimport writeFile from '../../helpers/writeFile'\n\n// Define TypeScript config interface\ninterface TSConfig {\n compilerOptions?: {\n paths?: Record<string, string[]>\n rootDir?: string\n rootDirs?: string[]\n [key: string]: any\n }\n [key: string]: any\n}\n\nexport function ensureConfigComplies(configPath: string) {\n try {\n const configJSON = getFileContents(configPath)\n const config = parse(configJSON) as TSConfig\n const {baseUrl: _baseUrl, ...compilerOptions} = config.compilerOptions ?? {}\n\n const newConfig = {\n ...config,\n compilerOptions: {\n ...compilerOptions,\n paths: {\n '*': ['./*'],\n ...compilerOptions.paths,\n },\n noEmit: true,\n },\n }\n\n if (!config.compilerOptions?.rootDir && !config.compilerOptions?.rootDirs) {\n newConfig.compilerOptions.rootDir = './app'\n }\n\n // are the same, no write\n if (JSON.stringify(config) === JSON.stringify(newConfig)) {\n return\n }\n\n writeFile(configPath, stringify(newConfig, null, 2))\n } catch (error) {\n console.log(`Error reading tsconfig: ${error.message}`)\n }\n}\n","import fs from 'node:fs'\n\nexport default function readFile(filePath: string) {\n if (!fs.existsSync(filePath)) return null\n\n return fs.readFileSync(filePath).toString()\n}\n","import {writeDtsFileFromConfigFile} from '@orion-js/env'\nimport chalk from 'chalk'\nimport chokidar from 'chokidar'\nimport {Runner} from '../runner'\n\nconst envFilePath = process.env.ORION_ENV_FILE_PATH\nconst dtsFilePath = './app/env.d.ts'\n\nexport const watchEnvFile = async (runner: Runner) => {\n if (!envFilePath) return\n\n writeDtsFileFromConfigFile(envFilePath, dtsFilePath)\n\n chokidar.watch(envFilePath, {ignoreInitial: true}).on('change', async () => {\n console.log(chalk.bold('=> Environment file changed. Restarting...'))\n writeDtsFileFromConfigFile(envFilePath, dtsFilePath)\n runner.restart()\n })\n}\n","import {Runner} from '../runner'\nimport cleanDirectory from './cleanDirectory'\nimport {getHost} from './getHost'\nimport {watchEnvFile} from './writeEnvFile'\n\nexport default async function watchAndCompile(runner: Runner) {\n await cleanDirectory()\n getHost(runner)\n watchEnvFile(runner)\n}\n","import chalk from 'chalk'\nimport build from '../build'\nimport {runProd} from './runProd'\n\nexport interface ProdOptions {\n path?: string\n node?: boolean\n}\n\nexport default async function (options: ProdOptions, command: any) {\n console.log(chalk.bold(`\\nOrionjs App ${chalk.green(chalk.bold('V4'))} Prod mode\\n`))\n\n if (options.node) {\n if (!options.path) {\n await build({output: './build'})\n options.path = './build'\n }\n }\n\n runProd(options, command)\n}\n","import chalk from 'chalk'\nimport {build} from './build'\nimport cleanDirectory from '../dev/watchAndCompile/cleanDirectory'\nimport {checkTs} from './checkTs'\n\nexport default async function (options: {output?: string}) {\n console.log(chalk.bold(`Building Orionjs App ${chalk.green(chalk.bold('V4'))}...`))\n\n if (!options.output) {\n options.output = './build'\n }\n\n await cleanDirectory(options.output)\n\n await checkTs()\n await build(options)\n\n console.log(chalk.bold('Build completed'))\n}\n","import chalk from 'chalk'\nimport * as esbuild from 'esbuild'\n\nexport async function build(options: {output?: string}) {\n const {output} = options\n\n console.log(`Building with esbuild to ${output}`)\n\n await esbuild.build({\n entryPoints: ['./app/index.ts'],\n tsconfig: './tsconfig.json',\n format: 'esm',\n platform: 'node',\n outdir: output,\n bundle: true,\n target: 'node22',\n sourcemap: true,\n allowOverwrite: true,\n minify: true,\n packages: 'external',\n })\n\n console.log(chalk.green.bold('Build successful'))\n}\n","import chalk from 'chalk'\nimport {exec} from 'node:child_process'\nimport {promisify} from 'node:util'\n\nconst execPromise = promisify(exec)\n\nexport async function checkTs(): Promise<void> {\n try {\n console.log('Checking TypeScript...')\n await execPromise('tsc --noEmit', {\n cwd: process.cwd(),\n env: {\n ...process.env,\n },\n gid: process.getgid(),\n uid: process.getuid(),\n })\n console.log(chalk.green.bold('TypeScript check passed'))\n } catch (error) {\n console.log(chalk.red.bold('TypeScript compilation failed'))\n console.log(error.stderr || error.stdout || error.message)\n process.exit(1)\n }\n}\n","import {spawn} from 'node:child_process'\nimport {ProdOptions} from './index'\n\nexport function runProd(options: ProdOptions, command: any) {\n if (options.node) {\n const indexPath = `${options.path}/index.js`\n const args = ['--import=tsx', ...command.args, indexPath]\n spawn('node', args, {\n env: {\n NODE_ENV: 'production',\n ...process.env,\n },\n cwd: process.cwd(),\n stdio: 'inherit',\n gid: process.getgid(),\n uid: process.getuid(),\n detached: false,\n })\n return\n }\n\n const args = [...command.args, './app/index.ts']\n spawn('bun', args, {\n env: {\n NODE_ENV: 'production',\n ...process.env,\n },\n cwd: process.cwd(),\n stdio: 'inherit',\n gid: process.getgid(),\n uid: process.getuid(),\n detached: false,\n })\n}\n","import chalk from 'chalk'\n\ninterface ErrorWithCodeFrame extends Error {\n codeFrame?: string\n}\n\nprocess\n .on('unhandledRejection', (error: ErrorWithCodeFrame) => {\n if (error.codeFrame) {\n console.error(chalk.red(error.message))\n console.log(error.codeFrame)\n } else {\n console.error(chalk.red(error.message), chalk.red('Unhandled promise rejection'))\n }\n })\n .on('uncaughtException', (error: Error) => {\n console.error(chalk.red(error.message))\n process.exit(1)\n })\n","import {readFileSync} from 'node:fs'\nimport {dirname, resolve} from 'node:path'\nimport {fileURLToPath} from 'node:url'\n\nfunction getVersion(): string {\n try {\n const dir = dirname(fileURLToPath(import.meta.url))\n const pkgPath = resolve(dir, '..', 'package.json')\n const pkg = JSON.parse(readFileSync(pkgPath, 'utf-8'))\n return pkg.version\n } catch {\n return 'unknown'\n }\n}\n\nexport default getVersion()\n","import chalk from 'chalk'\nimport {checkTs} from './checkTs'\n\nexport default async function () {\n console.log(chalk.bold(`Orionjs App ${chalk.green(chalk.bold('V4'))}\\n`))\n console.log('Checking typescript...')\n\n checkTs()\n\n console.log(chalk.bold.green('Check passed\\n'))\n}\n","import chalk from 'chalk'\nimport {execSync} from 'node:child_process'\n\nexport function checkTs() {\n try {\n execSync('tsc --noEmit', {\n cwd: process.cwd(),\n env: {\n ...process.env,\n },\n gid: process.getgid(),\n uid: process.getuid(),\n stdio: 'inherit',\n })\n } catch {\n console.log(chalk.red.bold('TypeScript compilation failed'))\n process.exit(1)\n }\n}\n","import chalk from 'chalk'\nimport {execSync} from 'node:child_process'\nimport version from './version'\n\nfunction detectRuntime(): string {\n const runtimes: string[] = []\n\n try {\n const bunVersion = execSync('bun --version', {encoding: 'utf-8'}).trim()\n runtimes.push(`Bun ${bunVersion}`)\n } catch {}\n\n runtimes.push(`Node ${process.versions.node}`)\n\n return runtimes.join(', ')\n}\n\nexport default function info() {\n console.log(`Orion CLI v${version} — Available runtimes: ${chalk.bold(detectRuntime())}`)\n console.log(`Default runtime: ${chalk.bold('Bun')} (use --node flag to switch to Node.js)`)\n}\n","import {readFileSync} from 'node:fs'\nimport {resolve} from 'node:path'\nimport chalk from 'chalk'\n\nexport interface ReplOptions {\n expression?: string\n port?: string\n}\n\ninterface ReplResponse {\n success: boolean\n error?: string\n stack?: string\n result?: unknown\n}\n\nfunction resolvePort(options: ReplOptions): number {\n if (options.port) {\n return Number(options.port)\n }\n\n try {\n const portFile = resolve(process.cwd(), '.orion/port')\n const port = readFileSync(portFile, 'utf-8').trim()\n return Number(port)\n } catch {}\n\n if (process.env.PORT) {\n return Number(process.env.PORT)\n }\n\n return 3000\n}\n\nexport default async function repl(options: ReplOptions) {\n const expression = options.expression\n\n if (!expression) {\n console.error(chalk.red('Error: expression is required. Use -e \"<expression>\"'))\n process.exit(1)\n }\n\n const port = resolvePort(options)\n\n try {\n const response = await fetch(`http://localhost:${port}/__repl`, {\n method: 'POST',\n headers: {'Content-Type': 'application/json'},\n body: JSON.stringify({expression}),\n })\n\n const data = (await response.json()) as ReplResponse\n\n if (!data.success) {\n console.error(chalk.red(`Error: ${data.error}`))\n if (data.stack) {\n console.error(chalk.dim(data.stack))\n }\n process.exit(1)\n }\n\n if (data.result !== undefined) {\n console.log(\n typeof data.result === 'string' ? data.result : JSON.stringify(data.result, null, 2),\n )\n }\n } catch (error) {\n const nodeError = error as Error & {code?: string; cause?: {code?: string}}\n if (nodeError.code === 'ECONNREFUSED' || nodeError.cause?.code === 'ECONNREFUSED') {\n console.error(\n chalk.red(\n `Could not connect to dev server on port ${port}. Make sure \"orion dev --repl\" is running.`,\n ),\n )\n } else {\n console.error(chalk.red(`Error: ${nodeError.message}`))\n }\n process.exit(1)\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AACA,IAAAA,iBAAkB;AAClB,uBAAsB;;;ACFtB,gCAAmB;AAEnB,eAAO,gBAAwB,SAAS;AACtC,SAAO,IAAI,QAAQ,CAACC,UAAS,WAAW;AACtC,wCAAK,SAAS,CAAC,OAAO,QAAQ,WAAW;AACvC,UAAI,OAAO;AACT,eAAO,KAAK;AAAA,MACd,OAAO;AACL,QAAAA,SAAQ,EAAC,QAAQ,OAAM,CAAC;AAAA,MAC1B;AAAA,IACF,CAAC;AAAA,EACH,CAAC;AACH;;;ACVA,eAAO,eAAwB,EAAC,MAAM,IAAG,GAAG;AAC1C,MAAI,CAAC,MAAM;AACT,UAAM,IAAI,MAAM,gCAAgC;AAAA,EAClD;AACA,MAAI,CAAC,KAAK;AACR,UAAM,IAAI,MAAM,gCAAgC;AAAA,EAClD;AACA,QAAM,OAAO,kDAAkD,GAAG;AAClE,UAAQ,IAAI,4BAA4B;AACxC,QAAM,gBAAQ,aAAa,IAAI,IAAI,IAAI,EAAE;AACzC,QAAM,gBAAQ,MAAM,IAAI,iBAAiB;AACzC,UAAQ,IAAI,2BAA2B;AACzC;;;ACdA,IAAAC,gBAAkB;;;ACAlB,IAAAC,gBAAkB;;;ACAlB,IAAAC,kBAAe;;;ACAf,qBAAe;AACf,uBAAiB;AAEjB,IAAM,kBAAkB,cAAY;AAClC,QAAMC,WAAU,iBAAAC,QAAK,QAAQ,QAAQ;AACrC,MAAI,eAAAC,QAAG,WAAWF,QAAO,EAAG,QAAO;AACnC,kBAAgBA,QAAO;AACvB,iBAAAE,QAAG,UAAUF,QAAO;AACtB;AAEA,IAAO,0BAAQ;;;ADPf,eAAO,kBAAwBG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EACd,YAAY,6DAA6D,EACzE,eAAe,iCAAiC,wBAAwB,EACxE,OAAO,iBAAiB,gEAAgE,EACxF,OAAO,IAAI,IAAI,CAAC;AAEnB,QAAQ,QAAQ,iBAAS,cAAc;AAEvC,QAAQ,MAAM,QAAQ,IAAI;AAE1B,IAAI,CAAC,QAAQ,KAAK,MAAM,CAAC,EAAE,QAAQ;AACjC,UAAQ,WAAW;AACrB;","names":["import_chalk","resolve","import_chalk","import_chalk","import_node_fs","dirname","path","fs","path","fs","import_node_child_process","startCommand","args","chalk","chalk","import_node_fs","import_node_path","fs","path","import_node_child_process","import_node_fs","import_node_path","import_node_fs","fs","import_chalk","chokidar","chalk","chalk","import_chalk","import_chalk","import_chalk","build","chalk","import_chalk","import_node_child_process","chalk","chalk","build","import_node_child_process","args","chalk","import_chalk","chalk","import_node_fs","import_node_path","import_chalk","import_chalk","import_node_child_process","checkTs","chalk","chalk","checkTs","import_chalk","import_node_child_process","chalk","import_node_fs","import_node_path","import_chalk","chalk","chalk"]}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/helpers/execute.ts","../src/create/index.ts","../src/dev/index.ts","../src/dev/runner/index.ts","../src/helpers/writeFile.ts","../src/helpers/ensureDirectory.ts","../src/dev/runner/startProcess.ts","../src/dev/devBuildPath.ts","../src/dev/runner/getArgs.ts","../src/dev/watchAndCompile/cleanDirectory.ts","../src/dev/watchAndCompile/watchAndBundle.ts","../src/dev/watchAndCompile/watchAndTypecheck.ts","../src/dev/watchAndCompile/getConfigPath.ts","../src/dev/watchAndCompile/ensureConfigComplies.ts","../src/helpers/getFileContents.ts","../src/dev/watchAndCompile/writeEnvFile.ts","../src/dev/watchAndCompile/index.ts","../src/prod/index.ts","../src/build/index.ts","../src/build/build.ts","../src/build/checkTs.ts","../src/prod/runProd.ts","../src/handleErrors.ts","../src/version.ts","../src/check/index.ts","../src/check/checkTs.ts","../src/info.ts","../src/repl/index.ts"],"sourcesContent":["#!/usr/bin/env node\nimport chalk from 'chalk'\nimport {Command} from 'commander'\nimport create from './create'\nimport dev from './dev'\nimport prod from './prod'\nimport './handleErrors'\nimport version from './version'\nimport 'dotenv/config'\nimport build from './build'\nimport check from './check'\nimport info from './info'\nimport repl from './repl'\n\nconst program = new Command()\n\nconst run =\n action =>\n async (...args) => {\n try {\n await action(...args)\n } catch (e) {\n console.error(chalk.red(`Error: ${e.message}`))\n }\n }\n\nprogram\n .command('dev')\n .description('Run the Orionjs app in development mode')\n .option('--node', 'Use Node.js runtime instead of Bun')\n .option('--repl', 'Enable REPL endpoint for orion repl')\n .option('--no-typecheck', 'Disable continuous TypeScript diagnostics')\n .allowUnknownOption()\n .action(run(dev))\n\nprogram.command('check').description('Runs a typescript check').action(run(check))\n\nprogram\n .command('build')\n .description('Build the Orionjs app for production')\n .option('--output [path]', 'Path of the output file')\n .action(run(build))\n\nprogram\n .command('prod')\n .allowUnknownOption()\n .option('--node', 'Use Node.js runtime instead of Bun')\n .option(\n '--path [path]',\n 'Path of the compiled Orionjs app. If not provided, the app will be compiled and then run',\n )\n .description('Run the Orionjs app in production mode')\n .action(run(prod))\n\nprogram\n .command('create')\n .description('Creates a new Orionjs project')\n .option('--name [name]', 'Name of the project')\n .option('--kit [kit]', 'Which starter kit to use')\n .action(run(create))\n\nprogram.command('info').description('Print runtime and version info').action(run(info))\n\nprogram\n .command('repl')\n .description('Evaluate an expression against a running Orionjs dev server')\n .requiredOption('-e, --expression <expression>', 'Expression to evaluate')\n .option('--port <port>', 'Port of the dev server (default: auto-detect from .orion/port)')\n .action(run(repl))\n\nprogram.version(version, '-v --version')\n\nprogram.parse(process.argv)\n\nif (!process.argv.slice(2).length) {\n program.outputHelp()\n}\n","import {exec} from 'node:child_process'\n\nexport default async function (command) {\n return new Promise((resolve, reject) => {\n exec(command, (error, stdout, stderr) => {\n if (error) {\n reject(error)\n } else {\n resolve({stdout, stderr})\n }\n })\n })\n}\n","import execute from '../helpers/execute'\n\nexport default async function ({name, kit}) {\n if (!name) {\n throw new Error('Please set the name of the app')\n }\n if (!kit) {\n throw new Error('Please select which kit to use')\n }\n const repo = `https://github.com/siturra/boilerplate-orionjs-${kit}`\n console.log('Downloading starter kit...')\n await execute(`git clone ${repo} ${name}`)\n await execute(`cd ${name} && rm -rf .git`)\n console.log('Your starter kit is ready')\n}\n","import chalk from 'chalk'\nimport {getRunner, RunnerOptions} from './runner'\nimport watchAndCompile from './watchAndCompile'\n\nexport default async function (options: RunnerOptions, command: any) {\n console.log(chalk.bold(`\\nOrionjs App ${chalk.green(chalk.bold('V4'))} Dev mode \\n`))\n\n const runner = getRunner(options, command)\n\n await watchAndCompile(runner, options)\n}\n","import chalk from 'chalk'\nimport writeFile from '../../helpers/writeFile'\nimport {startProcess} from './startProcess'\n\nexport interface RunnerOptions {\n shell: boolean\n clean: boolean\n node: boolean\n repl: boolean\n typecheck: boolean\n}\n\nexport interface Runner {\n start: () => void\n restart: () => void\n stop: () => void\n}\n\nexport function getRunner(options: RunnerOptions, command: any): Runner {\n let appProcess = null\n\n if (options.clean) {\n console.log(chalk.bold('=> Cleaning directory...\\n'))\n }\n\n const startApp = () => {\n const startedProcess = startProcess(options, command)\n appProcess = startedProcess\n\n startedProcess.on('exit', (code: number, signal: string) => {\n // An exited child must not make `start()` believe the application is\n // still alive. Compare identities because an older child can emit its\n // exit event after a replacement process has already been assigned.\n if (appProcess === startedProcess) appProcess = null\n\n if (!code || code === 143 || code === 0 || signal === 'SIGTERM' || signal === 'SIGINT') {\n } else {\n console.log(chalk.bold(`=> Error running app. Exit code: ${code}`))\n }\n })\n\n writeFile('.orion/process', `${startedProcess.pid}`)\n }\n\n const stop = () => {\n if (appProcess) {\n appProcess.kill()\n appProcess = null\n }\n }\n\n const restart = () => {\n console.log(chalk.bold('=> Restarting app...\\n'))\n stop()\n startApp()\n }\n\n const start = () => {\n // check if the app is already running\n if (appProcess) {\n // console.log(chalk.bold('=> App is already running. Restarting...\\n'))\n } else {\n startApp()\n }\n }\n\n return {\n restart,\n stop,\n start,\n }\n}\n","import fs from 'node:fs'\nimport ensureDirectory from '../helpers/ensureDirectory'\n\nexport default async function (path: string, content: string): Promise<void> {\n ensureDirectory(path)\n fs.writeFileSync(path, content)\n}\n","import fs from 'node:fs'\nimport path from 'node:path'\n\nconst ensureDirectory = filePath => {\n const dirname = path.dirname(filePath)\n if (fs.existsSync(dirname)) return true\n ensureDirectory(dirname)\n fs.mkdirSync(dirname)\n}\n\nexport default ensureDirectory\n","import {spawn} from 'node:child_process'\nimport chalk from 'chalk'\nimport {getArgs} from './getArgs'\nimport {RunnerOptions} from './index'\n\nexport function startProcess(options: RunnerOptions, command: any) {\n const {startCommand, args} = getArgs(options, command)\n\n console.log(chalk.bold(`=> Starting app with command: ${startCommand} ${args.join(' ')}...\\n`))\n return spawn(startCommand, args, {\n env: {\n ORION_DEV: 'local',\n ...process.env,\n ...(options.repl ? {ORION_REPL: 'true'} : {}),\n },\n cwd: process.cwd(),\n stdio: 'inherit',\n detached: false,\n })\n}\n","export const devBuildPath = './.orion/build/index.js'\n","import {devBuildPath} from '../devBuildPath'\nimport {RunnerOptions} from './index'\n\nexport function getArgs(options: RunnerOptions, command: any) {\n if (options.node) {\n const startCommand = 'node'\n const args = ['--enable-source-maps', ...command.args, devBuildPath]\n return {startCommand, args}\n }\n\n const startCommand = 'bun'\n const args = ['--watch', ...command.args, devBuildPath]\n return {startCommand, args}\n}\n","import fs from 'node:fs'\nimport path from 'node:path'\n\n/**\n * Remove directory recursively\n * @param {string} dir_path\n * @see https://stackoverflow.com/a/42505874/3027390\n */\nfunction rimraf(dir_path: string) {\n if (fs.existsSync(dir_path)) {\n fs.readdirSync(dir_path).map(entry => {\n const entry_path = path.join(dir_path, entry)\n if (fs.lstatSync(entry_path).isDirectory()) {\n rimraf(entry_path)\n } else {\n fs.unlinkSync(entry_path)\n }\n })\n fs.rmdirSync(dir_path)\n }\n}\n\nexport default async function cleanDirectory(directory?: string) {\n try {\n const dirPath = directory ? directory : path.join(process.cwd(), '.orion', 'build')\n rimraf(dirPath)\n } catch (_) {\n // Ignore errors during cleanup\n }\n}\n","import {readFileSync} from 'node:fs'\nimport {createRequire} from 'node:module'\nimport {extname, join} from 'node:path'\nimport chokidar from 'chokidar'\nimport * as esbuild from 'esbuild'\nimport {devBuildPath} from '../devBuildPath'\nimport type {Runner, RunnerOptions} from '../runner'\n\nfunction getPackageName(specifier: string) {\n const segments = specifier.split('/')\n return specifier.startsWith('@') ? segments.slice(0, 2).join('/') : segments[0]\n}\n\n/**\n * Keep dependencies external while making source imports valid in plain Node\n * ESM. tsx accepts extensionless package subpaths and JSON imports, but Node\n * requires explicit extensions and JSON attributes.\n */\nfunction nodeExternalCompatibilityPlugin(): esbuild.Plugin {\n const requireFromApp = createRequire(join(process.cwd(), 'package.json'))\n\n return {\n name: 'orion-node-external-compatibility',\n setup(build) {\n build.onResolve({filter: /^[^./].*\\.json$/}, args => {\n try {\n return {path: requireFromApp.resolve(args.path)}\n } catch {\n return undefined\n }\n })\n\n build.onResolve({filter: /^[^./]/}, args => {\n const packageName = getPackageName(args.path)\n if (args.path === packageName || extname(args.path)) return undefined\n\n try {\n const packageJsonPath = requireFromApp.resolve(`${packageName}/package.json`)\n const packageJson = JSON.parse(readFileSync(packageJsonPath, 'utf8')) as {\n exports?: unknown\n }\n if (packageJson.exports) return undefined\n\n const resolvedExtension = extname(requireFromApp.resolve(args.path))\n if (!resolvedExtension) return undefined\n\n return {path: `${args.path}${resolvedExtension}`, external: true}\n } catch {\n return undefined\n }\n })\n },\n }\n}\n\n/**\n * Bundle application code once and rebuild it incrementally on edits.\n *\n * Running the bundle avoids making Node transform every TypeScript module on\n * every restart. Dependencies remain external so their native Node behavior\n * stays identical to a production build.\n */\nexport async function watchAndBundle(\n runner: Runner,\n options: RunnerOptions,\n onFilesChanged?: () => void,\n) {\n let hasSuccessfulBuild = false\n let buildStartedAt = Date.now()\n let rebuildInProgress = false\n let rebuildRequested = false\n let rebuildTimer: NodeJS.Timeout | undefined\n\n const context = await esbuild.context({\n entryPoints: ['./app/index.ts'],\n outfile: devBuildPath,\n tsconfig: './tsconfig.json',\n format: 'esm',\n platform: 'node',\n bundle: true,\n target: 'node22',\n sourcemap: true,\n packages: 'external',\n plugins: [\n nodeExternalCompatibilityPlugin(),\n {\n name: 'orion-dev-restart',\n setup(build) {\n build.onStart(() => {\n buildStartedAt = Date.now()\n })\n\n build.onEnd(result => {\n if (result.errors.length > 0) {\n // Serving the previous bundle hides the broken save from the\n // browser. Stop it so the normal dev error state is visible,\n // then let the next successful build recover automatically.\n runner.stop()\n return\n }\n\n console.log(`=> Application bundled in ${Date.now() - buildStartedAt}ms`)\n\n if (hasSuccessfulBuild && options.node) {\n runner.restart()\n } else if (!hasSuccessfulBuild) {\n hasSuccessfulBuild = true\n runner.start()\n } else {\n // Bun normally reloads itself after the bundle changes. It may\n // instead be stopped after a build/type error and need recovery.\n runner.start()\n }\n })\n },\n },\n ],\n })\n\n const rebuild = async () => {\n if (rebuildInProgress) {\n rebuildRequested = true\n return\n }\n\n rebuildInProgress = true\n do {\n rebuildRequested = false\n try {\n await context.rebuild()\n } catch {\n // esbuild already prints diagnostics. Keep watching so the next edit\n // can recover without restarting the Orion CLI.\n }\n } while (rebuildRequested)\n rebuildInProgress = false\n }\n\n await rebuild()\n\n const watcher = chokidar.watch(['./app', './tsconfig.json'], {ignoreInitial: true})\n watcher.on('all', () => {\n onFilesChanged?.()\n clearTimeout(rebuildTimer)\n rebuildTimer = setTimeout(rebuild, 20)\n })\n watcher.on('error', error => console.error(`Unable to watch application files: ${error.message}`))\n\n return {context, watcher}\n}\n","import {spawn} from 'node:child_process'\nimport type {Runner} from '../runner'\nimport {getConfigPath} from './getConfigPath'\n\n/**\n * Create a serialized, on-demand TypeScript checker.\n *\n * `tsc --watch` creates a second filesystem watcher for the entire project and\n * can stall when the operating system is already watching many worktrees. A\n * one-off check is both faster and sufficient because the bundle watcher calls\n * this function after every source change. Changes received during an active\n * check collapse into one fresh check, so stale diagnostics never stop the app.\n */\nexport function watchAndTypecheck(runner: Runner) {\n const configPath = getConfigPath()\n let checkInProgress = false\n let checkRequested = false\n\n const runCheck = () => {\n if (checkInProgress) {\n checkRequested = true\n return\n }\n\n checkInProgress = true\n const startedAt = Date.now()\n const checker = spawn('tsc', ['--noEmit', '--project', configPath], {\n env: process.env,\n stdio: ['ignore', 'pipe', 'pipe'],\n })\n let output = ''\n let spawnError: Error | undefined\n\n checker.stdout.on('data', chunk => {\n output += chunk.toString()\n })\n checker.stderr.on('data', chunk => {\n output += chunk.toString()\n })\n checker.on('error', error => {\n spawnError = error\n })\n\n checker.on('close', code => {\n checkInProgress = false\n\n // A newer save makes this result stale. Check the latest project state\n // before changing the running application's state or printing errors.\n if (checkRequested) {\n checkRequested = false\n runCheck()\n return\n }\n\n if (spawnError) {\n runner.stop()\n console.error(`Unable to run TypeScript: ${spawnError.message}`)\n return\n }\n\n const duration = Date.now() - startedAt\n if (code === 0) {\n console.log(`=> TypeScript checked in ${duration}ms`)\n runner.start()\n return\n }\n\n if (output.trim()) console.error(output.trimEnd())\n console.error(`=> TypeScript found errors in ${duration}ms`)\n runner.stop()\n })\n }\n\n return runCheck\n}\n","import {existsSync} from 'node:fs'\nimport {dirname, join} from 'node:path'\nimport {ensureConfigComplies} from './ensureConfigComplies'\n\nfunction findConfigFile(startDirectory: string, fileName: string): string | undefined {\n let directory = startDirectory\n\n while (true) {\n const candidate = join(directory, fileName)\n if (existsSync(candidate)) return candidate\n\n const parent = dirname(directory)\n if (parent === directory) return undefined\n directory = parent\n }\n}\n\nexport function getConfigPath() {\n const appBasePath = process.cwd()\n\n const configPath =\n findConfigFile(appBasePath, 'tsconfig.server.json') ||\n findConfigFile(appBasePath, 'tsconfig.json')\n\n if (!configPath) {\n throw new Error(\"Could not find a valid 'tsconfig.json'.\")\n }\n\n ensureConfigComplies(configPath)\n\n return configPath\n}\n","import {parse, stringify} from 'comment-json'\nimport getFileContents from '../../helpers/getFileContents'\nimport writeFile from '../../helpers/writeFile'\n\n// Define TypeScript config interface\ninterface TSConfig {\n compilerOptions?: {\n paths?: Record<string, string[]>\n rootDir?: string\n rootDirs?: string[]\n [key: string]: any\n }\n [key: string]: any\n}\n\nexport function ensureConfigComplies(configPath: string) {\n try {\n const configJSON = getFileContents(configPath)\n const config = parse(configJSON) as TSConfig\n const {baseUrl: _baseUrl, ...compilerOptions} = config.compilerOptions ?? {}\n\n const newConfig = {\n ...config,\n compilerOptions: {\n ...compilerOptions,\n paths: {\n '*': ['./*'],\n ...compilerOptions.paths,\n },\n noEmit: true,\n },\n }\n\n if (!config.compilerOptions?.rootDir && !config.compilerOptions?.rootDirs) {\n newConfig.compilerOptions.rootDir = './app'\n }\n\n // are the same, no write\n if (JSON.stringify(config) === JSON.stringify(newConfig)) {\n return\n }\n\n writeFile(configPath, stringify(newConfig, null, 2))\n } catch (error) {\n console.log(`Error reading tsconfig: ${error.message}`)\n }\n}\n","import fs from 'node:fs'\n\nexport default function readFile(filePath: string) {\n if (!fs.existsSync(filePath)) return null\n\n return fs.readFileSync(filePath).toString()\n}\n","import {writeDtsFileFromConfigFile} from '@orion-js/env'\nimport chalk from 'chalk'\nimport chokidar from 'chokidar'\nimport {Runner} from '../runner'\n\nconst envFilePath = process.env.ORION_ENV_FILE_PATH\nconst dtsFilePath = './app/env.d.ts'\n\nexport const watchEnvFile = async (runner: Runner) => {\n if (!envFilePath) return\n\n writeDtsFileFromConfigFile(envFilePath, dtsFilePath)\n\n chokidar.watch(envFilePath, {ignoreInitial: true}).on('change', async () => {\n console.log(chalk.bold('=> Environment file changed. Restarting...'))\n writeDtsFileFromConfigFile(envFilePath, dtsFilePath)\n runner.restart()\n })\n}\n","import {Runner, RunnerOptions} from '../runner'\nimport cleanDirectory from './cleanDirectory'\nimport {watchAndBundle} from './watchAndBundle'\nimport {watchAndTypecheck} from './watchAndTypecheck'\nimport {watchEnvFile} from './writeEnvFile'\n\nexport default async function watchAndCompile(runner: Runner, options: RunnerOptions) {\n await cleanDirectory()\n const requestTypecheck = options.typecheck ? watchAndTypecheck(runner) : undefined\n await watchAndBundle(runner, options, requestTypecheck)\n requestTypecheck?.()\n watchEnvFile(runner)\n}\n","import chalk from 'chalk'\nimport build from '../build'\nimport {runProd} from './runProd'\n\nexport interface ProdOptions {\n path?: string\n node?: boolean\n}\n\nexport default async function (options: ProdOptions, command: any) {\n console.log(chalk.bold(`\\nOrionjs App ${chalk.green(chalk.bold('V4'))} Prod mode\\n`))\n\n if (options.node) {\n if (!options.path) {\n await build({output: './build'})\n options.path = './build'\n }\n }\n\n runProd(options, command)\n}\n","import chalk from 'chalk'\nimport {build} from './build'\nimport cleanDirectory from '../dev/watchAndCompile/cleanDirectory'\nimport {checkTs} from './checkTs'\n\nexport default async function (options: {output?: string}) {\n console.log(chalk.bold(`Building Orionjs App ${chalk.green(chalk.bold('V4'))}...`))\n\n if (!options.output) {\n options.output = './build'\n }\n\n await cleanDirectory(options.output)\n\n await checkTs()\n await build(options)\n\n console.log(chalk.bold('Build completed'))\n}\n","import chalk from 'chalk'\nimport * as esbuild from 'esbuild'\n\nexport async function build(options: {output?: string}) {\n const {output} = options\n\n console.log(`Building with esbuild to ${output}`)\n\n await esbuild.build({\n entryPoints: ['./app/index.ts'],\n tsconfig: './tsconfig.json',\n format: 'esm',\n platform: 'node',\n outdir: output,\n bundle: true,\n target: 'node22',\n sourcemap: true,\n allowOverwrite: true,\n minify: true,\n packages: 'external',\n })\n\n console.log(chalk.green.bold('Build successful'))\n}\n","import chalk from 'chalk'\nimport {exec} from 'node:child_process'\nimport {promisify} from 'node:util'\n\nconst execPromise = promisify(exec)\n\nexport async function checkTs(): Promise<void> {\n try {\n console.log('Checking TypeScript...')\n await execPromise('tsc --noEmit', {\n cwd: process.cwd(),\n env: {\n ...process.env,\n },\n gid: process.getgid(),\n uid: process.getuid(),\n })\n console.log(chalk.green.bold('TypeScript check passed'))\n } catch (error) {\n console.log(chalk.red.bold('TypeScript compilation failed'))\n console.log(error.stderr || error.stdout || error.message)\n process.exit(1)\n }\n}\n","import {spawn} from 'node:child_process'\nimport {ProdOptions} from './index'\n\nexport function runProd(options: ProdOptions, command: any) {\n if (options.node) {\n const indexPath = `${options.path}/index.js`\n const args = ['--import=tsx', ...command.args, indexPath]\n spawn('node', args, {\n env: {\n NODE_ENV: 'production',\n ...process.env,\n },\n cwd: process.cwd(),\n stdio: 'inherit',\n gid: process.getgid(),\n uid: process.getuid(),\n detached: false,\n })\n return\n }\n\n const args = [...command.args, './app/index.ts']\n spawn('bun', args, {\n env: {\n NODE_ENV: 'production',\n ...process.env,\n },\n cwd: process.cwd(),\n stdio: 'inherit',\n gid: process.getgid(),\n uid: process.getuid(),\n detached: false,\n })\n}\n","import chalk from 'chalk'\n\ninterface ErrorWithCodeFrame extends Error {\n codeFrame?: string\n}\n\nprocess\n .on('unhandledRejection', (error: ErrorWithCodeFrame) => {\n if (error.codeFrame) {\n console.error(chalk.red(error.message))\n console.log(error.codeFrame)\n } else {\n console.error(chalk.red(error.message), chalk.red('Unhandled promise rejection'))\n }\n })\n .on('uncaughtException', (error: Error) => {\n console.error(chalk.red(error.message))\n process.exit(1)\n })\n","import {readFileSync} from 'node:fs'\nimport {dirname, resolve} from 'node:path'\nimport {fileURLToPath} from 'node:url'\n\nfunction getVersion(): string {\n try {\n const dir = dirname(fileURLToPath(import.meta.url))\n const pkgPath = resolve(dir, '..', 'package.json')\n const pkg = JSON.parse(readFileSync(pkgPath, 'utf-8'))\n return pkg.version\n } catch {\n return 'unknown'\n }\n}\n\nexport default getVersion()\n","import chalk from 'chalk'\nimport {checkTs} from './checkTs'\n\nexport default async function () {\n console.log(chalk.bold(`Orionjs App ${chalk.green(chalk.bold('V4'))}\\n`))\n console.log('Checking typescript...')\n\n checkTs()\n\n console.log(chalk.bold.green('Check passed\\n'))\n}\n","import chalk from 'chalk'\nimport {execSync} from 'node:child_process'\n\nexport function checkTs() {\n try {\n execSync('tsc --noEmit', {\n cwd: process.cwd(),\n env: {\n ...process.env,\n },\n gid: process.getgid(),\n uid: process.getuid(),\n stdio: 'inherit',\n })\n } catch {\n console.log(chalk.red.bold('TypeScript compilation failed'))\n process.exit(1)\n }\n}\n","import chalk from 'chalk'\nimport {execSync} from 'node:child_process'\nimport version from './version'\n\nfunction detectRuntime(): string {\n const runtimes: string[] = []\n\n try {\n const bunVersion = execSync('bun --version', {encoding: 'utf-8'}).trim()\n runtimes.push(`Bun ${bunVersion}`)\n } catch {}\n\n runtimes.push(`Node ${process.versions.node}`)\n\n return runtimes.join(', ')\n}\n\nexport default function info() {\n console.log(`Orion CLI v${version} — Available runtimes: ${chalk.bold(detectRuntime())}`)\n console.log(`Default runtime: ${chalk.bold('Bun')} (use --node flag to switch to Node.js)`)\n}\n","import {readFileSync} from 'node:fs'\nimport {resolve} from 'node:path'\nimport chalk from 'chalk'\n\nexport interface ReplOptions {\n expression?: string\n port?: string\n}\n\ninterface ReplResponse {\n success: boolean\n error?: string\n stack?: string\n result?: unknown\n}\n\nfunction resolvePort(options: ReplOptions): number {\n if (options.port) {\n return Number(options.port)\n }\n\n try {\n const portFile = resolve(process.cwd(), '.orion/port')\n const port = readFileSync(portFile, 'utf-8').trim()\n return Number(port)\n } catch {}\n\n if (process.env.PORT) {\n return Number(process.env.PORT)\n }\n\n return 3000\n}\n\nexport default async function repl(options: ReplOptions) {\n const expression = options.expression\n\n if (!expression) {\n console.error(chalk.red('Error: expression is required. Use -e \"<expression>\"'))\n process.exit(1)\n }\n\n const port = resolvePort(options)\n\n try {\n const response = await fetch(`http://localhost:${port}/__repl`, {\n method: 'POST',\n headers: {'Content-Type': 'application/json'},\n body: JSON.stringify({expression}),\n })\n\n const data = (await response.json()) as ReplResponse\n\n if (!data.success) {\n console.error(chalk.red(`Error: ${data.error}`))\n if (data.stack) {\n console.error(chalk.dim(data.stack))\n }\n process.exit(1)\n }\n\n if (data.result !== undefined) {\n console.log(\n typeof data.result === 'string' ? data.result : JSON.stringify(data.result, null, 2),\n )\n }\n } catch (error) {\n const nodeError = error as Error & {code?: string; cause?: {code?: string}}\n if (nodeError.code === 'ECONNREFUSED' || nodeError.cause?.code === 'ECONNREFUSED') {\n console.error(\n chalk.red(\n `Could not connect to dev server on port ${port}. Make sure \"orion dev --repl\" is running.`,\n ),\n )\n } else {\n console.error(chalk.red(`Error: ${nodeError.message}`))\n }\n process.exit(1)\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AACA,IAAAA,iBAAkB;AAClB,uBAAsB;;;ACFtB,gCAAmB;AAEnB,eAAO,gBAAwB,SAAS;AACtC,SAAO,IAAI,QAAQ,CAACC,UAAS,WAAW;AACtC,wCAAK,SAAS,CAAC,OAAO,QAAQ,WAAW;AACvC,UAAI,OAAO;AACT,eAAO,KAAK;AAAA,MACd,OAAO;AACL,QAAAA,SAAQ,EAAC,QAAQ,OAAM,CAAC;AAAA,MAC1B;AAAA,IACF,CAAC;AAAA,EACH,CAAC;AACH;;;ACVA,eAAO,eAAwB,EAAC,MAAM,IAAG,GAAG;AAC1C,MAAI,CAAC,MAAM;AACT,UAAM,IAAI,MAAM,gCAAgC;AAAA,EAClD;AACA,MAAI,CAAC,KAAK;AACR,UAAM,IAAI,MAAM,gCAAgC;AAAA,EAClD;AACA,QAAM,OAAO,kDAAkD,GAAG;AAClE,UAAQ,IAAI,4BAA4B;AACxC,QAAM,gBAAQ,aAAa,IAAI,IAAI,IAAI,EAAE;AACzC,QAAM,gBAAQ,MAAM,IAAI,iBAAiB;AACzC,UAAQ,IAAI,2BAA2B;AACzC;;;ACdA,IAAAC,gBAAkB;;;ACAlB,IAAAC,gBAAkB;;;ACAlB,IAAAC,kBAAe;;;ACAf,qBAAe;AACf,uBAAiB;AAEjB,IAAM,kBAAkB,cAAY;AAClC,QAAMC,WAAU,iBAAAC,QAAK,QAAQ,QAAQ;AACrC,MAAI,eAAAC,QAAG,WAAWF,QAAO,EAAG,QAAO;AACnC,kBAAgBA,QAAO;AACvB,iBAAAE,QAAG,UAAUF,QAAO;AACtB;AAEA,IAAO,0BAAQ;;;ADP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AAO,UAAU,oCAAoC,EACrD,OAAO,UAAU,qCAAqC,EACtD,OAAO,kBAAkB,2CAA2C,EACpE,mBAAmB,EACnB,OAAO,IAAI,WAAG,CAAC;AAElB,QAAQ,QAAQ,OAAO,EAAE,YAAY,yBAAyB,EAAE,OAAO,IAAI,aAAK,CAAC;AAEjF,QACG,QAAQ,OAAO,EACf,YAAY,sCAAsC,EAClD,OAAO,mBAAmB,yBAAyB,EACnD,OAAO,IAAI,aAAK,CAAC;AAEpB,QACG,QAAQ,MAAM,EACd,mBAAmB,EACnB,OAAO,UAAU,oCAAoC,EACrD;AAAA,EACC;AAAA,EACA;AACF,EACC,YAAY,wCAAwC,EACpD,OAAO,IAAI,YAAI,CAAC;AAEnB,QACG,QAAQ,QAAQ,EAChB,YAAY,+BAA+B,EAC3C,OAAO,iBAAiB,qBAAqB,EAC7C,OAAO,eAAe,0BAA0B,EAChD,OAAO,IAAI,cAAM,CAAC;AAErB,QAAQ,QAAQ,MAAM,EAAE,YAAY,gCAAgC,EAAE,OAAO,IAAI,IAAI,CAAC;AAEtF,QACG,QAAQ,MAAM,EACd,YAAY,6DAA6D,EACzE,eAAe,iCAAiC,wBAAwB,EACxE,OAAO,iBAAiB,gEAAgE,EACxF,OAAO,IAAI,IAAI,CAAC;AAEnB,QAAQ,QAAQ,iBAAS,cAAc;AAEvC,QAAQ,MAAM,QAAQ,IAAI;AAE1B,IAAI,CAAC,QAAQ,KAAK,MAAM,CAAC,EAAE,QAAQ;AACjC,UAAQ,WAAW;AACrB;","names":["import_chalk","resolve","import_chalk","import_chalk","import_node_fs","dirname","path","fs","path","fs","import_node_child_process","startCommand","args","chalk","chalk","import_node_fs","import_node_path","fs","path","import_node_fs","import_node_path","build","context","chokidar","import_node_child_process","import_node_fs","import_node_path","import_node_fs","fs","import_chalk","import_chokidar","chokidar","chalk","chalk","import_chalk","import_chalk","import_chalk","esbuild","build","chalk","import_chalk","import_node_child_process","chalk","chalk","build","import_node_child_process","args","chalk","import_chalk","chalk","import_node_fs","import_node_path","import_chalk","import_chalk","import_node_child_process","checkTs","chalk","chalk","checkTs","import_chalk","import_node_child_process","chalk","import_node_fs","import_node_path","import_chalk","chalk","chalk"]}
|
package/dist/index.js
CHANGED
|
@@ -63,15 +63,18 @@ async function writeFile_default(path3, content) {
|
|
|
63
63
|
import { spawn } from "child_process";
|
|
64
64
|
import chalk from "chalk";
|
|
65
65
|
|
|
66
|
+
// src/dev/devBuildPath.ts
|
|
67
|
+
var devBuildPath = "./.orion/build/index.js";
|
|
68
|
+
|
|
66
69
|
// src/dev/runner/getArgs.ts
|
|
67
70
|
function getArgs(options, command) {
|
|
68
71
|
if (options.node) {
|
|
69
|
-
const startCommand2 = "
|
|
70
|
-
const args2 = ["
|
|
72
|
+
const startCommand2 = "node";
|
|
73
|
+
const args2 = ["--enable-source-maps", ...command.args, devBuildPath];
|
|
71
74
|
return { startCommand: startCommand2, args: args2 };
|
|
72
75
|
}
|
|
73
76
|
const startCommand = "bun";
|
|
74
|
-
const args = ["--watch", ...command.args,
|
|
77
|
+
const args = ["--watch", ...command.args, devBuildPath];
|
|
75
78
|
return { startCommand, args };
|
|
76
79
|
}
|
|
77
80
|
|
|
@@ -99,14 +102,16 @@ function getRunner(options, command) {
|
|
|
99
102
|
console.log(chalk2.bold("=> Cleaning directory...\n"));
|
|
100
103
|
}
|
|
101
104
|
const startApp = () => {
|
|
102
|
-
|
|
103
|
-
appProcess
|
|
105
|
+
const startedProcess = startProcess(options, command);
|
|
106
|
+
appProcess = startedProcess;
|
|
107
|
+
startedProcess.on("exit", (code, signal) => {
|
|
108
|
+
if (appProcess === startedProcess) appProcess = null;
|
|
104
109
|
if (!code || code === 143 || code === 0 || signal === "SIGTERM" || signal === "SIGINT") {
|
|
105
110
|
} else {
|
|
106
111
|
console.log(chalk2.bold(`=> Error running app. Exit code: ${code}`));
|
|
107
112
|
}
|
|
108
113
|
});
|
|
109
|
-
writeFile_default(".orion/process", `${
|
|
114
|
+
writeFile_default(".orion/process", `${startedProcess.pid}`);
|
|
110
115
|
};
|
|
111
116
|
const stop = () => {
|
|
112
117
|
if (appProcess) {
|
|
@@ -156,13 +161,120 @@ async function cleanDirectory(directory) {
|
|
|
156
161
|
}
|
|
157
162
|
}
|
|
158
163
|
|
|
159
|
-
// src/dev/watchAndCompile/
|
|
164
|
+
// src/dev/watchAndCompile/watchAndBundle.ts
|
|
165
|
+
import { readFileSync } from "fs";
|
|
166
|
+
import { createRequire } from "module";
|
|
167
|
+
import { extname, join } from "path";
|
|
168
|
+
import chokidar from "chokidar";
|
|
169
|
+
import * as esbuild from "esbuild";
|
|
170
|
+
function getPackageName(specifier) {
|
|
171
|
+
const segments = specifier.split("/");
|
|
172
|
+
return specifier.startsWith("@") ? segments.slice(0, 2).join("/") : segments[0];
|
|
173
|
+
}
|
|
174
|
+
function nodeExternalCompatibilityPlugin() {
|
|
175
|
+
const requireFromApp = createRequire(join(process.cwd(), "package.json"));
|
|
176
|
+
return {
|
|
177
|
+
name: "orion-node-external-compatibility",
|
|
178
|
+
setup(build3) {
|
|
179
|
+
build3.onResolve({ filter: /^[^./].*\.json$/ }, (args) => {
|
|
180
|
+
try {
|
|
181
|
+
return { path: requireFromApp.resolve(args.path) };
|
|
182
|
+
} catch {
|
|
183
|
+
return void 0;
|
|
184
|
+
}
|
|
185
|
+
});
|
|
186
|
+
build3.onResolve({ filter: /^[^./]/ }, (args) => {
|
|
187
|
+
const packageName = getPackageName(args.path);
|
|
188
|
+
if (args.path === packageName || extname(args.path)) return void 0;
|
|
189
|
+
try {
|
|
190
|
+
const packageJsonPath = requireFromApp.resolve(`${packageName}/package.json`);
|
|
191
|
+
const packageJson = JSON.parse(readFileSync(packageJsonPath, "utf8"));
|
|
192
|
+
if (packageJson.exports) return void 0;
|
|
193
|
+
const resolvedExtension = extname(requireFromApp.resolve(args.path));
|
|
194
|
+
if (!resolvedExtension) return void 0;
|
|
195
|
+
return { path: `${args.path}${resolvedExtension}`, external: true };
|
|
196
|
+
} catch {
|
|
197
|
+
return void 0;
|
|
198
|
+
}
|
|
199
|
+
});
|
|
200
|
+
}
|
|
201
|
+
};
|
|
202
|
+
}
|
|
203
|
+
async function watchAndBundle(runner, options, onFilesChanged) {
|
|
204
|
+
let hasSuccessfulBuild = false;
|
|
205
|
+
let buildStartedAt = Date.now();
|
|
206
|
+
let rebuildInProgress = false;
|
|
207
|
+
let rebuildRequested = false;
|
|
208
|
+
let rebuildTimer;
|
|
209
|
+
const context2 = await esbuild.context({
|
|
210
|
+
entryPoints: ["./app/index.ts"],
|
|
211
|
+
outfile: devBuildPath,
|
|
212
|
+
tsconfig: "./tsconfig.json",
|
|
213
|
+
format: "esm",
|
|
214
|
+
platform: "node",
|
|
215
|
+
bundle: true,
|
|
216
|
+
target: "node22",
|
|
217
|
+
sourcemap: true,
|
|
218
|
+
packages: "external",
|
|
219
|
+
plugins: [
|
|
220
|
+
nodeExternalCompatibilityPlugin(),
|
|
221
|
+
{
|
|
222
|
+
name: "orion-dev-restart",
|
|
223
|
+
setup(build3) {
|
|
224
|
+
build3.onStart(() => {
|
|
225
|
+
buildStartedAt = Date.now();
|
|
226
|
+
});
|
|
227
|
+
build3.onEnd((result) => {
|
|
228
|
+
if (result.errors.length > 0) {
|
|
229
|
+
runner.stop();
|
|
230
|
+
return;
|
|
231
|
+
}
|
|
232
|
+
console.log(`=> Application bundled in ${Date.now() - buildStartedAt}ms`);
|
|
233
|
+
if (hasSuccessfulBuild && options.node) {
|
|
234
|
+
runner.restart();
|
|
235
|
+
} else if (!hasSuccessfulBuild) {
|
|
236
|
+
hasSuccessfulBuild = true;
|
|
237
|
+
runner.start();
|
|
238
|
+
} else {
|
|
239
|
+
runner.start();
|
|
240
|
+
}
|
|
241
|
+
});
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
]
|
|
245
|
+
});
|
|
246
|
+
const rebuild = async () => {
|
|
247
|
+
if (rebuildInProgress) {
|
|
248
|
+
rebuildRequested = true;
|
|
249
|
+
return;
|
|
250
|
+
}
|
|
251
|
+
rebuildInProgress = true;
|
|
252
|
+
do {
|
|
253
|
+
rebuildRequested = false;
|
|
254
|
+
try {
|
|
255
|
+
await context2.rebuild();
|
|
256
|
+
} catch {
|
|
257
|
+
}
|
|
258
|
+
} while (rebuildRequested);
|
|
259
|
+
rebuildInProgress = false;
|
|
260
|
+
};
|
|
261
|
+
await rebuild();
|
|
262
|
+
const watcher = chokidar.watch(["./app", "./tsconfig.json"], { ignoreInitial: true });
|
|
263
|
+
watcher.on("all", () => {
|
|
264
|
+
onFilesChanged == null ? void 0 : onFilesChanged();
|
|
265
|
+
clearTimeout(rebuildTimer);
|
|
266
|
+
rebuildTimer = setTimeout(rebuild, 20);
|
|
267
|
+
});
|
|
268
|
+
watcher.on("error", (error) => console.error(`Unable to watch application files: ${error.message}`));
|
|
269
|
+
return { context: context2, watcher };
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
// src/dev/watchAndCompile/watchAndTypecheck.ts
|
|
160
273
|
import { spawn as spawn2 } from "child_process";
|
|
161
|
-
import { createInterface } from "readline";
|
|
162
274
|
|
|
163
275
|
// src/dev/watchAndCompile/getConfigPath.ts
|
|
164
276
|
import { existsSync } from "fs";
|
|
165
|
-
import { dirname, join } from "path";
|
|
277
|
+
import { dirname, join as join2 } from "path";
|
|
166
278
|
|
|
167
279
|
// src/dev/watchAndCompile/ensureConfigComplies.ts
|
|
168
280
|
import { parse, stringify } from "comment-json";
|
|
@@ -208,7 +320,7 @@ function ensureConfigComplies(configPath) {
|
|
|
208
320
|
function findConfigFile(startDirectory, fileName) {
|
|
209
321
|
let directory = startDirectory;
|
|
210
322
|
while (true) {
|
|
211
|
-
const candidate =
|
|
323
|
+
const candidate = join2(directory, fileName);
|
|
212
324
|
if (existsSync(candidate)) return candidate;
|
|
213
325
|
const parent = dirname(directory);
|
|
214
326
|
if (parent === directory) return void 0;
|
|
@@ -225,47 +337,69 @@ function getConfigPath() {
|
|
|
225
337
|
return configPath;
|
|
226
338
|
}
|
|
227
339
|
|
|
228
|
-
// src/dev/watchAndCompile/
|
|
229
|
-
function
|
|
340
|
+
// src/dev/watchAndCompile/watchAndTypecheck.ts
|
|
341
|
+
function watchAndTypecheck(runner) {
|
|
230
342
|
const configPath = getConfigPath();
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
output.on("line", (line) => {
|
|
237
|
-
console.log(line);
|
|
238
|
-
if (line.includes("Starting compilation") || line.includes("File change detected")) {
|
|
239
|
-
runner.stop();
|
|
240
|
-
return;
|
|
241
|
-
}
|
|
242
|
-
if (line.includes("Found 0 errors.")) {
|
|
243
|
-
runner.start();
|
|
343
|
+
let checkInProgress = false;
|
|
344
|
+
let checkRequested = false;
|
|
345
|
+
const runCheck = () => {
|
|
346
|
+
if (checkInProgress) {
|
|
347
|
+
checkRequested = true;
|
|
244
348
|
return;
|
|
245
349
|
}
|
|
246
|
-
|
|
350
|
+
checkInProgress = true;
|
|
351
|
+
const startedAt = Date.now();
|
|
352
|
+
const checker = spawn2("tsc", ["--noEmit", "--project", configPath], {
|
|
353
|
+
env: process.env,
|
|
354
|
+
stdio: ["ignore", "pipe", "pipe"]
|
|
355
|
+
});
|
|
356
|
+
let output = "";
|
|
357
|
+
let spawnError;
|
|
358
|
+
checker.stdout.on("data", (chunk) => {
|
|
359
|
+
output += chunk.toString();
|
|
360
|
+
});
|
|
361
|
+
checker.stderr.on("data", (chunk) => {
|
|
362
|
+
output += chunk.toString();
|
|
363
|
+
});
|
|
364
|
+
checker.on("error", (error) => {
|
|
365
|
+
spawnError = error;
|
|
366
|
+
});
|
|
367
|
+
checker.on("close", (code) => {
|
|
368
|
+
checkInProgress = false;
|
|
369
|
+
if (checkRequested) {
|
|
370
|
+
checkRequested = false;
|
|
371
|
+
runCheck();
|
|
372
|
+
return;
|
|
373
|
+
}
|
|
374
|
+
if (spawnError) {
|
|
375
|
+
runner.stop();
|
|
376
|
+
console.error(`Unable to run TypeScript: ${spawnError.message}`);
|
|
377
|
+
return;
|
|
378
|
+
}
|
|
379
|
+
const duration = Date.now() - startedAt;
|
|
380
|
+
if (code === 0) {
|
|
381
|
+
console.log(`=> TypeScript checked in ${duration}ms`);
|
|
382
|
+
runner.start();
|
|
383
|
+
return;
|
|
384
|
+
}
|
|
385
|
+
if (output.trim()) console.error(output.trimEnd());
|
|
386
|
+
console.error(`=> TypeScript found errors in ${duration}ms`);
|
|
247
387
|
runner.stop();
|
|
248
|
-
}
|
|
249
|
-
}
|
|
250
|
-
|
|
251
|
-
errors.on("line", (line) => console.error(line));
|
|
252
|
-
watcher.on("error", (error) => {
|
|
253
|
-
runner.stop();
|
|
254
|
-
console.error(`Unable to start TypeScript: ${error.message}`);
|
|
255
|
-
});
|
|
256
|
-
return watcher;
|
|
388
|
+
});
|
|
389
|
+
};
|
|
390
|
+
return runCheck;
|
|
257
391
|
}
|
|
258
392
|
|
|
259
393
|
// src/dev/watchAndCompile/writeEnvFile.ts
|
|
260
394
|
import { writeDtsFileFromConfigFile } from "@orion-js/env";
|
|
261
395
|
import chalk3 from "chalk";
|
|
262
|
-
import
|
|
396
|
+
import chokidar2 from "chokidar";
|
|
263
397
|
var envFilePath = process.env.ORION_ENV_FILE_PATH;
|
|
264
398
|
var dtsFilePath = "./app/env.d.ts";
|
|
265
399
|
var watchEnvFile = async (runner) => {
|
|
266
400
|
if (!envFilePath) return;
|
|
267
401
|
writeDtsFileFromConfigFile(envFilePath, dtsFilePath);
|
|
268
|
-
|
|
402
|
+
chokidar2.watch(envFilePath, { ignoreInitial: true }).on("change", async () => {
|
|
269
403
|
console.log(chalk3.bold("=> Environment file changed. Restarting..."));
|
|
270
404
|
writeDtsFileFromConfigFile(envFilePath, dtsFilePath);
|
|
271
405
|
runner.restart();
|
|
@@ -273,9 +407,11 @@ var watchEnvFile = async (runner) => {
|
|
|
273
407
|
};
|
|
274
408
|
|
|
275
409
|
// src/dev/watchAndCompile/index.ts
|
|
276
|
-
async function watchAndCompile(runner) {
|
|
410
|
+
async function watchAndCompile(runner, options) {
|
|
277
411
|
await cleanDirectory();
|
|
278
|
-
|
|
412
|
+
const requestTypecheck = options.typecheck ? watchAndTypecheck(runner) : void 0;
|
|
413
|
+
await watchAndBundle(runner, options, requestTypecheck);
|
|
414
|
+
requestTypecheck == null ? void 0 : requestTypecheck();
|
|
279
415
|
watchEnvFile(runner);
|
|
280
416
|
}
|
|
281
417
|
|
|
@@ -285,7 +421,7 @@ async function dev_default(options, command) {
|
|
|
285
421
|
Orionjs App ${chalk4.green(chalk4.bold("V4"))} Dev mode
|
|
286
422
|
`));
|
|
287
423
|
const runner = getRunner(options, command);
|
|
288
|
-
watchAndCompile(runner);
|
|
424
|
+
await watchAndCompile(runner, options);
|
|
289
425
|
}
|
|
290
426
|
|
|
291
427
|
// src/prod/index.ts
|
|
@@ -296,11 +432,11 @@ import chalk7 from "chalk";
|
|
|
296
432
|
|
|
297
433
|
// src/build/build.ts
|
|
298
434
|
import chalk5 from "chalk";
|
|
299
|
-
import * as
|
|
435
|
+
import * as esbuild2 from "esbuild";
|
|
300
436
|
async function build2(options) {
|
|
301
437
|
const { output } = options;
|
|
302
438
|
console.log(`Building with esbuild to ${output}`);
|
|
303
|
-
await
|
|
439
|
+
await esbuild2.build({
|
|
304
440
|
entryPoints: ["./app/index.ts"],
|
|
305
441
|
tsconfig: "./tsconfig.json",
|
|
306
442
|
format: "esm",
|
|
@@ -414,14 +550,14 @@ process.on("unhandledRejection", (error) => {
|
|
|
414
550
|
});
|
|
415
551
|
|
|
416
552
|
// src/version.ts
|
|
417
|
-
import { readFileSync } from "fs";
|
|
553
|
+
import { readFileSync as readFileSync2 } from "fs";
|
|
418
554
|
import { dirname as dirname2, resolve } from "path";
|
|
419
555
|
import { fileURLToPath } from "url";
|
|
420
556
|
function getVersion() {
|
|
421
557
|
try {
|
|
422
558
|
const dir = dirname2(fileURLToPath(import.meta.url));
|
|
423
559
|
const pkgPath = resolve(dir, "..", "package.json");
|
|
424
|
-
const pkg = JSON.parse(
|
|
560
|
+
const pkg = JSON.parse(readFileSync2(pkgPath, "utf-8"));
|
|
425
561
|
return pkg.version;
|
|
426
562
|
} catch {
|
|
427
563
|
return "unknown";
|
|
@@ -483,7 +619,7 @@ function info() {
|
|
|
483
619
|
}
|
|
484
620
|
|
|
485
621
|
// src/repl/index.ts
|
|
486
|
-
import { readFileSync as
|
|
622
|
+
import { readFileSync as readFileSync3 } from "fs";
|
|
487
623
|
import { resolve as resolve2 } from "path";
|
|
488
624
|
import chalk13 from "chalk";
|
|
489
625
|
function resolvePort(options) {
|
|
@@ -492,7 +628,7 @@ function resolvePort(options) {
|
|
|
492
628
|
}
|
|
493
629
|
try {
|
|
494
630
|
const portFile = resolve2(process.cwd(), ".orion/port");
|
|
495
|
-
const port =
|
|
631
|
+
const port = readFileSync3(portFile, "utf-8").trim();
|
|
496
632
|
return Number(port);
|
|
497
633
|
} catch {
|
|
498
634
|
}
|
|
@@ -552,7 +688,7 @@ var run = (action) => async (...args) => {
|
|
|
552
688
|
console.error(chalk14.red(`Error: ${e.message}`));
|
|
553
689
|
}
|
|
554
690
|
};
|
|
555
|
-
program.command("dev").description("Run the Orionjs app in development mode").option("--node", "Use Node.js runtime instead of Bun").option("--repl", "Enable REPL endpoint for orion repl").allowUnknownOption().action(run(dev_default));
|
|
691
|
+
program.command("dev").description("Run the Orionjs app in development mode").option("--node", "Use Node.js runtime instead of Bun").option("--repl", "Enable REPL endpoint for orion repl").option("--no-typecheck", "Disable continuous TypeScript diagnostics").allowUnknownOption().action(run(dev_default));
|
|
556
692
|
program.command("check").description("Runs a typescript check").action(run(check_default));
|
|
557
693
|
program.command("build").description("Build the Orionjs app for production").option("--output [path]", "Path of the output file").action(run(build_default));
|
|
558
694
|
program.command("prod").allowUnknownOption().option("--node", "Use Node.js runtime instead of Bun").option(
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/helpers/execute.ts","../src/create/index.ts","../src/dev/index.ts","../src/dev/runner/index.ts","../src/helpers/writeFile.ts","../src/helpers/ensureDirectory.ts","../src/dev/runner/startProcess.ts","../src/dev/runner/getArgs.ts","../src/dev/watchAndCompile/cleanDirectory.ts","../src/dev/watchAndCompile/getHost.ts","../src/dev/watchAndCompile/getConfigPath.ts","../src/dev/watchAndCompile/ensureConfigComplies.ts","../src/helpers/getFileContents.ts","../src/dev/watchAndCompile/writeEnvFile.ts","../src/dev/watchAndCompile/index.ts","../src/prod/index.ts","../src/build/index.ts","../src/build/build.ts","../src/build/checkTs.ts","../src/prod/runProd.ts","../src/handleErrors.ts","../src/version.ts","../src/check/index.ts","../src/check/checkTs.ts","../src/info.ts","../src/repl/index.ts"],"sourcesContent":["#!/usr/bin/env node\nimport chalk from 'chalk'\nimport {Command} from 'commander'\nimport create from './create'\nimport dev from './dev'\nimport prod from './prod'\nimport './handleErrors'\nimport version from './version'\nimport 'dotenv/config'\nimport build from './build'\nimport check from './check'\nimport info from './info'\nimport repl from './repl'\n\nconst program = new Command()\n\nconst run =\n action =>\n async (...args) => {\n try {\n await action(...args)\n } catch (e) {\n console.error(chalk.red(`Error: ${e.message}`))\n }\n }\n\nprogram\n .command('dev')\n .description('Run the Orionjs app in development mode')\n .option('--node', 'Use Node.js runtime instead of Bun')\n .option('--repl', 'Enable REPL endpoint for orion repl')\n .allowUnknownOption()\n .action(run(dev))\n\nprogram.command('check').description('Runs a typescript check').action(run(check))\n\nprogram\n .command('build')\n .description('Build the Orionjs app for production')\n .option('--output [path]', 'Path of the output file')\n .action(run(build))\n\nprogram\n .command('prod')\n .allowUnknownOption()\n .option('--node', 'Use Node.js runtime instead of Bun')\n .option(\n '--path [path]',\n 'Path of the compiled Orionjs app. If not provided, the app will be compiled and then run',\n )\n .description('Run the Orionjs app in production mode')\n .action(run(prod))\n\nprogram\n .command('create')\n .description('Creates a new Orionjs project')\n .option('--name [name]', 'Name of the project')\n .option('--kit [kit]', 'Which starter kit to use')\n .action(run(create))\n\nprogram.command('info').description('Print runtime and version info').action(run(info))\n\nprogram\n .command('repl')\n .description('Evaluate an expression against a running Orionjs dev server')\n .requiredOption('-e, --expression <expression>', 'Expression to evaluate')\n .option('--port <port>', 'Port of the dev server (default: auto-detect from .orion/port)')\n .action(run(repl))\n\nprogram.version(version, '-v --version')\n\nprogram.parse(process.argv)\n\nif (!process.argv.slice(2).length) {\n program.outputHelp()\n}\n","import {exec} from 'node:child_process'\n\nexport default async function (command) {\n return new Promise((resolve, reject) => {\n exec(command, (error, stdout, stderr) => {\n if (error) {\n reject(error)\n } else {\n resolve({stdout, stderr})\n }\n })\n })\n}\n","import execute from '../helpers/execute'\n\nexport default async function ({name, kit}) {\n if (!name) {\n throw new Error('Please set the name of the app')\n }\n if (!kit) {\n throw new Error('Please select which kit to use')\n }\n const repo = `https://github.com/siturra/boilerplate-orionjs-${kit}`\n console.log('Downloading starter kit...')\n await execute(`git clone ${repo} ${name}`)\n await execute(`cd ${name} && rm -rf .git`)\n console.log('Your starter kit is ready')\n}\n","import chalk from 'chalk'\nimport {getRunner, RunnerOptions} from './runner'\nimport watchAndCompile from './watchAndCompile'\n\nexport default async function (options: RunnerOptions, command: any) {\n console.log(chalk.bold(`\\nOrionjs App ${chalk.green(chalk.bold('V4'))} Dev mode \\n`))\n\n const runner = getRunner(options, command)\n\n watchAndCompile(runner)\n}\n","import chalk from 'chalk'\nimport writeFile from '../../helpers/writeFile'\nimport {startProcess} from './startProcess'\n\nexport interface RunnerOptions {\n shell: boolean\n clean: boolean\n node: boolean\n repl: boolean\n}\n\nexport interface Runner {\n start: () => void\n restart: () => void\n stop: () => void\n}\n\nexport function getRunner(options: RunnerOptions, command: any): Runner {\n let appProcess = null\n\n if (options.clean) {\n console.log(chalk.bold('=> Cleaning directory...\\n'))\n }\n\n const startApp = () => {\n appProcess = startProcess(options, command)\n\n appProcess.on('exit', (code: number, signal: string) => {\n if (!code || code === 143 || code === 0 || signal === 'SIGTERM' || signal === 'SIGINT') {\n } else {\n console.log(chalk.bold(`=> Error running app. Exit code: ${code}`))\n }\n })\n\n writeFile('.orion/process', `${appProcess.pid}`)\n }\n\n const stop = () => {\n if (appProcess) {\n appProcess.kill()\n appProcess = null\n }\n }\n\n const restart = () => {\n console.log(chalk.bold('=> Restarting app...\\n'))\n stop()\n startApp()\n }\n\n const start = () => {\n // check if the app is already running\n if (appProcess) {\n // console.log(chalk.bold('=> App is already running. Restarting...\\n'))\n } else {\n startApp()\n }\n }\n\n return {\n restart,\n stop,\n start,\n }\n}\n","import fs from 'node:fs'\nimport ensureDirectory from '../helpers/ensureDirectory'\n\nexport default async function (path: string, content: string): Promise<void> {\n ensureDirectory(path)\n fs.writeFileSync(path, content)\n}\n","import fs from 'node:fs'\nimport path from 'node:path'\n\nconst ensureDirectory = filePath => {\n const dirname = path.dirname(filePath)\n if (fs.existsSync(dirname)) return true\n ensureDirectory(dirname)\n fs.mkdirSync(dirname)\n}\n\nexport default ensureDirectory\n","import {spawn} from 'node:child_process'\nimport chalk from 'chalk'\nimport {getArgs} from './getArgs'\nimport {RunnerOptions} from './index'\n\nexport function startProcess(options: RunnerOptions, command: any) {\n const {startCommand, args} = getArgs(options, command)\n\n console.log(chalk.bold(`=> Starting app with command: ${startCommand} ${args.join(' ')}...\\n`))\n return spawn(startCommand, args, {\n env: {\n ORION_DEV: 'local',\n ...process.env,\n ...(options.repl ? {ORION_REPL: 'true'} : {}),\n },\n cwd: process.cwd(),\n stdio: 'inherit',\n detached: false,\n })\n}\n","import {RunnerOptions} from './index'\n\nexport function getArgs(options: RunnerOptions, command: any) {\n if (options.node) {\n const startCommand = 'tsx'\n const args = ['watch', '--clear-screen=false', ...command.args, './app/index.ts']\n return {startCommand, args}\n }\n\n const startCommand = 'bun'\n const args = ['--watch', ...command.args, './app/index.ts']\n return {startCommand, args}\n}\n","import fs from 'node:fs'\nimport path from 'node:path'\n\n/**\n * Remove directory recursively\n * @param {string} dir_path\n * @see https://stackoverflow.com/a/42505874/3027390\n */\nfunction rimraf(dir_path: string) {\n if (fs.existsSync(dir_path)) {\n fs.readdirSync(dir_path).map(entry => {\n const entry_path = path.join(dir_path, entry)\n if (fs.lstatSync(entry_path).isDirectory()) {\n rimraf(entry_path)\n } else {\n fs.unlinkSync(entry_path)\n }\n })\n fs.rmdirSync(dir_path)\n }\n}\n\nexport default async function cleanDirectory(directory?: string) {\n try {\n const dirPath = directory ? directory : path.join(process.cwd(), '.orion', 'build')\n rimraf(dirPath)\n } catch (_) {\n // Ignore errors during cleanup\n }\n}\n","import {spawn} from 'node:child_process'\nimport {createInterface} from 'node:readline'\nimport type {Runner} from '../runner'\nimport {getConfigPath} from './getConfigPath'\n\nexport function getHost(runner: Runner) {\n const configPath = getConfigPath()\n const watcher = spawn('tsc', ['--watch', '--noEmit', '--project', configPath], {\n env: process.env,\n stdio: ['ignore', 'pipe', 'pipe'],\n })\n\n const output = createInterface({input: watcher.stdout})\n output.on('line', line => {\n console.log(line)\n\n if (line.includes('Starting compilation') || line.includes('File change detected')) {\n runner.stop()\n return\n }\n\n if (line.includes('Found 0 errors.')) {\n runner.start()\n return\n }\n\n if (/Found [1-9]\\d* errors?\\./.test(line)) {\n runner.stop()\n }\n })\n\n const errors = createInterface({input: watcher.stderr})\n errors.on('line', line => console.error(line))\n\n watcher.on('error', error => {\n runner.stop()\n console.error(`Unable to start TypeScript: ${error.message}`)\n })\n\n return watcher\n}\n","import {existsSync} from 'node:fs'\nimport {dirname, join} from 'node:path'\nimport {ensureConfigComplies} from './ensureConfigComplies'\n\nfunction findConfigFile(startDirectory: string, fileName: string): string | undefined {\n let directory = startDirectory\n\n while (true) {\n const candidate = join(directory, fileName)\n if (existsSync(candidate)) return candidate\n\n const parent = dirname(directory)\n if (parent === directory) return undefined\n directory = parent\n }\n}\n\nexport function getConfigPath() {\n const appBasePath = process.cwd()\n\n const configPath =\n findConfigFile(appBasePath, 'tsconfig.server.json') ||\n findConfigFile(appBasePath, 'tsconfig.json')\n\n if (!configPath) {\n throw new Error(\"Could not find a valid 'tsconfig.json'.\")\n }\n\n ensureConfigComplies(configPath)\n\n return configPath\n}\n","import {parse, stringify} from 'comment-json'\nimport getFileContents from '../../helpers/getFileContents'\nimport writeFile from '../../helpers/writeFile'\n\n// Define TypeScript config interface\ninterface TSConfig {\n compilerOptions?: {\n paths?: Record<string, string[]>\n rootDir?: string\n rootDirs?: string[]\n [key: string]: any\n }\n [key: string]: any\n}\n\nexport function ensureConfigComplies(configPath: string) {\n try {\n const configJSON = getFileContents(configPath)\n const config = parse(configJSON) as TSConfig\n const {baseUrl: _baseUrl, ...compilerOptions} = config.compilerOptions ?? {}\n\n const newConfig = {\n ...config,\n compilerOptions: {\n ...compilerOptions,\n paths: {\n '*': ['./*'],\n ...compilerOptions.paths,\n },\n noEmit: true,\n },\n }\n\n if (!config.compilerOptions?.rootDir && !config.compilerOptions?.rootDirs) {\n newConfig.compilerOptions.rootDir = './app'\n }\n\n // are the same, no write\n if (JSON.stringify(config) === JSON.stringify(newConfig)) {\n return\n }\n\n writeFile(configPath, stringify(newConfig, null, 2))\n } catch (error) {\n console.log(`Error reading tsconfig: ${error.message}`)\n }\n}\n","import fs from 'node:fs'\n\nexport default function readFile(filePath: string) {\n if (!fs.existsSync(filePath)) return null\n\n return fs.readFileSync(filePath).toString()\n}\n","import {writeDtsFileFromConfigFile} from '@orion-js/env'\nimport chalk from 'chalk'\nimport chokidar from 'chokidar'\nimport {Runner} from '../runner'\n\nconst envFilePath = process.env.ORION_ENV_FILE_PATH\nconst dtsFilePath = './app/env.d.ts'\n\nexport const watchEnvFile = async (runner: Runner) => {\n if (!envFilePath) return\n\n writeDtsFileFromConfigFile(envFilePath, dtsFilePath)\n\n chokidar.watch(envFilePath, {ignoreInitial: true}).on('change', async () => {\n console.log(chalk.bold('=> Environment file changed. Restarting...'))\n writeDtsFileFromConfigFile(envFilePath, dtsFilePath)\n runner.restart()\n })\n}\n","import {Runner} from '../runner'\nimport cleanDirectory from './cleanDirectory'\nimport {getHost} from './getHost'\nimport {watchEnvFile} from './writeEnvFile'\n\nexport default async function watchAndCompile(runner: Runner) {\n await cleanDirectory()\n getHost(runner)\n watchEnvFile(runner)\n}\n","import chalk from 'chalk'\nimport build from '../build'\nimport {runProd} from './runProd'\n\nexport interface ProdOptions {\n path?: string\n node?: boolean\n}\n\nexport default async function (options: ProdOptions, command: any) {\n console.log(chalk.bold(`\\nOrionjs App ${chalk.green(chalk.bold('V4'))} Prod mode\\n`))\n\n if (options.node) {\n if (!options.path) {\n await build({output: './build'})\n options.path = './build'\n }\n }\n\n runProd(options, command)\n}\n","import chalk from 'chalk'\nimport {build} from './build'\nimport cleanDirectory from '../dev/watchAndCompile/cleanDirectory'\nimport {checkTs} from './checkTs'\n\nexport default async function (options: {output?: string}) {\n console.log(chalk.bold(`Building Orionjs App ${chalk.green(chalk.bold('V4'))}...`))\n\n if (!options.output) {\n options.output = './build'\n }\n\n await cleanDirectory(options.output)\n\n await checkTs()\n await build(options)\n\n console.log(chalk.bold('Build completed'))\n}\n","import chalk from 'chalk'\nimport * as esbuild from 'esbuild'\n\nexport async function build(options: {output?: string}) {\n const {output} = options\n\n console.log(`Building with esbuild to ${output}`)\n\n await esbuild.build({\n entryPoints: ['./app/index.ts'],\n tsconfig: './tsconfig.json',\n format: 'esm',\n platform: 'node',\n outdir: output,\n bundle: true,\n target: 'node22',\n sourcemap: true,\n allowOverwrite: true,\n minify: true,\n packages: 'external',\n })\n\n console.log(chalk.green.bold('Build successful'))\n}\n","import chalk from 'chalk'\nimport {exec} from 'node:child_process'\nimport {promisify} from 'node:util'\n\nconst execPromise = promisify(exec)\n\nexport async function checkTs(): Promise<void> {\n try {\n console.log('Checking TypeScript...')\n await execPromise('tsc --noEmit', {\n cwd: process.cwd(),\n env: {\n ...process.env,\n },\n gid: process.getgid(),\n uid: process.getuid(),\n })\n console.log(chalk.green.bold('TypeScript check passed'))\n } catch (error) {\n console.log(chalk.red.bold('TypeScript compilation failed'))\n console.log(error.stderr || error.stdout || error.message)\n process.exit(1)\n }\n}\n","import {spawn} from 'node:child_process'\nimport {ProdOptions} from './index'\n\nexport function runProd(options: ProdOptions, command: any) {\n if (options.node) {\n const indexPath = `${options.path}/index.js`\n const args = ['--import=tsx', ...command.args, indexPath]\n spawn('node', args, {\n env: {\n NODE_ENV: 'production',\n ...process.env,\n },\n cwd: process.cwd(),\n stdio: 'inherit',\n gid: process.getgid(),\n uid: process.getuid(),\n detached: false,\n })\n return\n }\n\n const args = [...command.args, './app/index.ts']\n spawn('bun', args, {\n env: {\n NODE_ENV: 'production',\n ...process.env,\n },\n cwd: process.cwd(),\n stdio: 'inherit',\n gid: process.getgid(),\n uid: process.getuid(),\n detached: false,\n })\n}\n","import chalk from 'chalk'\n\ninterface ErrorWithCodeFrame extends Error {\n codeFrame?: string\n}\n\nprocess\n .on('unhandledRejection', (error: ErrorWithCodeFrame) => {\n if (error.codeFrame) {\n console.error(chalk.red(error.message))\n console.log(error.codeFrame)\n } else {\n console.error(chalk.red(error.message), chalk.red('Unhandled promise rejection'))\n }\n })\n .on('uncaughtException', (error: Error) => {\n console.error(chalk.red(error.message))\n process.exit(1)\n })\n","import {readFileSync} from 'node:fs'\nimport {dirname, resolve} from 'node:path'\nimport {fileURLToPath} from 'node:url'\n\nfunction getVersion(): string {\n try {\n const dir = dirname(fileURLToPath(import.meta.url))\n const pkgPath = resolve(dir, '..', 'package.json')\n const pkg = JSON.parse(readFileSync(pkgPath, 'utf-8'))\n return pkg.version\n } catch {\n return 'unknown'\n }\n}\n\nexport default getVersion()\n","import chalk from 'chalk'\nimport {checkTs} from './checkTs'\n\nexport default async function () {\n console.log(chalk.bold(`Orionjs App ${chalk.green(chalk.bold('V4'))}\\n`))\n console.log('Checking typescript...')\n\n checkTs()\n\n console.log(chalk.bold.green('Check passed\\n'))\n}\n","import chalk from 'chalk'\nimport {execSync} from 'node:child_process'\n\nexport function checkTs() {\n try {\n execSync('tsc --noEmit', {\n cwd: process.cwd(),\n env: {\n ...process.env,\n },\n gid: process.getgid(),\n uid: process.getuid(),\n stdio: 'inherit',\n })\n } catch {\n console.log(chalk.red.bold('TypeScript compilation failed'))\n process.exit(1)\n }\n}\n","import chalk from 'chalk'\nimport {execSync} from 'node:child_process'\nimport version from './version'\n\nfunction detectRuntime(): string {\n const runtimes: string[] = []\n\n try {\n const bunVersion = execSync('bun --version', {encoding: 'utf-8'}).trim()\n runtimes.push(`Bun ${bunVersion}`)\n } catch {}\n\n runtimes.push(`Node ${process.versions.node}`)\n\n return runtimes.join(', ')\n}\n\nexport default function info() {\n console.log(`Orion CLI v${version} — Available runtimes: ${chalk.bold(detectRuntime())}`)\n console.log(`Default runtime: ${chalk.bold('Bun')} (use --node flag to switch to Node.js)`)\n}\n","import {readFileSync} from 'node:fs'\nimport {resolve} from 'node:path'\nimport chalk from 'chalk'\n\nexport interface ReplOptions {\n expression?: string\n port?: string\n}\n\ninterface ReplResponse {\n success: boolean\n error?: string\n stack?: string\n result?: unknown\n}\n\nfunction resolvePort(options: ReplOptions): number {\n if (options.port) {\n return Number(options.port)\n }\n\n try {\n const portFile = resolve(process.cwd(), '.orion/port')\n const port = readFileSync(portFile, 'utf-8').trim()\n return Number(port)\n } catch {}\n\n if (process.env.PORT) {\n return Number(process.env.PORT)\n }\n\n return 3000\n}\n\nexport default async function repl(options: ReplOptions) {\n const expression = options.expression\n\n if (!expression) {\n console.error(chalk.red('Error: expression is required. Use -e \"<expression>\"'))\n process.exit(1)\n }\n\n const port = resolvePort(options)\n\n try {\n const response = await fetch(`http://localhost:${port}/__repl`, {\n method: 'POST',\n headers: {'Content-Type': 'application/json'},\n body: JSON.stringify({expression}),\n })\n\n const data = (await response.json()) as ReplResponse\n\n if (!data.success) {\n console.error(chalk.red(`Error: ${data.error}`))\n if (data.stack) {\n console.error(chalk.dim(data.stack))\n }\n process.exit(1)\n }\n\n if (data.result !== undefined) {\n console.log(\n typeof data.result === 'string' ? data.result : JSON.stringify(data.result, null, 2),\n )\n }\n } catch (error) {\n const nodeError = error as Error & {code?: string; cause?: {code?: string}}\n if (nodeError.code === 'ECONNREFUSED' || nodeError.cause?.code === 'ECONNREFUSED') {\n console.error(\n chalk.red(\n `Could not connect to dev server on port ${port}. Make sure \"orion dev --repl\" is running.`,\n ),\n )\n } else {\n console.error(chalk.red(`Error: ${nodeError.message}`))\n }\n process.exit(1)\n }\n}\n"],"mappings":";;;AACA,OAAOA,aAAW;AAClB,SAAQ,eAAc;;;ACFtB,SAAQ,YAAW;AAEnB,eAAO,gBAAwB,SAAS;AACtC,SAAO,IAAI,QAAQ,CAACC,UAAS,WAAW;AACtC,SAAK,SAAS,CAAC,OAAO,QAAQ,WAAW;AACvC,UAAI,OAAO;AACT,eAAO,KAAK;AAAA,MACd,OAAO;AACL,QAAAA,SAAQ,EAAC,QAAQ,OAAM,CAAC;AAAA,MAC1B;AAAA,IACF,CAAC;AAAA,EACH,CAAC;AACH;;;ACVA,eAAO,eAAwB,EAAC,MAAM,IAAG,GAAG;AAC1C,MAAI,CAAC,MAAM;AACT,UAAM,IAAI,MAAM,gCAAgC;AAAA,EAClD;AACA,MAAI,CAAC,KAAK;AACR,UAAM,IAAI,MAAM,gCAAgC;AAAA,EAClD;AACA,QAAM,OAAO,kDAAkD,GAAG;AAClE,UAAQ,IAAI,4BAA4B;AACxC,QAAM,gBAAQ,aAAa,IAAI,IAAI,IAAI,EAAE;AACzC,QAAM,gBAAQ,MAAM,IAAI,iBAAiB;AACzC,UAAQ,IAAI,2BAA2B;AACzC;;;ACdA,OAAOC,YAAW;;;ACAlB,OAAOC,YAAW;;;ACAlB,OAAOC,SAAQ;;;ACAf,OAAO,QAAQ;AACf,OAAO,UAAU;AAEjB,IAAM,kBAAkB,cAAY;AAClC,QAAMC,WAAU,KAAK,QAAQ,QAAQ;AACrC,MAAI,GAAG,WAAWA,QAAO,EAAG,QAAO;AACnC,kBAAgBA,QAAO;AACvB,KAAG,UAAUA,QAAO;AACtB;AAEA,IAAO,0BAAQ;;;ADPf,eAAO,kBAAwBC,OAAc,SAAgC;AAC3E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AQ,WAAW;AACrB;","names":["chalk","resolve","chalk","chalk","fs","dirname","path","fs","startCommand","args","chalk","fs","path","spawn","fs","spawn","chalk","chalk","chalk","chalk","chalk","build","chalk","exec","chalk","build","spawn","args","chalk","chalk","dirname","chalk","chalk","checkTs","chalk","checkTs","chalk","execSync","execSync","chalk","readFileSync","resolve","chalk","chalk"]}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/helpers/execute.ts","../src/create/index.ts","../src/dev/index.ts","../src/dev/runner/index.ts","../src/helpers/writeFile.ts","../src/helpers/ensureDirectory.ts","../src/dev/runner/startProcess.ts","../src/dev/devBuildPath.ts","../src/dev/runner/getArgs.ts","../src/dev/watchAndCompile/cleanDirectory.ts","../src/dev/watchAndCompile/watchAndBundle.ts","../src/dev/watchAndCompile/watchAndTypecheck.ts","../src/dev/watchAndCompile/getConfigPath.ts","../src/dev/watchAndCompile/ensureConfigComplies.ts","../src/helpers/getFileContents.ts","../src/dev/watchAndCompile/writeEnvFile.ts","../src/dev/watchAndCompile/index.ts","../src/prod/index.ts","../src/build/index.ts","../src/build/build.ts","../src/build/checkTs.ts","../src/prod/runProd.ts","../src/handleErrors.ts","../src/version.ts","../src/check/index.ts","../src/check/checkTs.ts","../src/info.ts","../src/repl/index.ts"],"sourcesContent":["#!/usr/bin/env node\nimport chalk from 'chalk'\nimport {Command} from 'commander'\nimport create from './create'\nimport dev from './dev'\nimport prod from './prod'\nimport './handleErrors'\nimport version from './version'\nimport 'dotenv/config'\nimport build from './build'\nimport check from './check'\nimport info from './info'\nimport repl from './repl'\n\nconst program = new Command()\n\nconst run =\n action =>\n async (...args) => {\n try {\n await action(...args)\n } catch (e) {\n console.error(chalk.red(`Error: ${e.message}`))\n }\n }\n\nprogram\n .command('dev')\n .description('Run the Orionjs app in development mode')\n .option('--node', 'Use Node.js runtime instead of Bun')\n .option('--repl', 'Enable REPL endpoint for orion repl')\n .option('--no-typecheck', 'Disable continuous TypeScript diagnostics')\n .allowUnknownOption()\n .action(run(dev))\n\nprogram.command('check').description('Runs a typescript check').action(run(check))\n\nprogram\n .command('build')\n .description('Build the Orionjs app for production')\n .option('--output [path]', 'Path of the output file')\n .action(run(build))\n\nprogram\n .command('prod')\n .allowUnknownOption()\n .option('--node', 'Use Node.js runtime instead of Bun')\n .option(\n '--path [path]',\n 'Path of the compiled Orionjs app. If not provided, the app will be compiled and then run',\n )\n .description('Run the Orionjs app in production mode')\n .action(run(prod))\n\nprogram\n .command('create')\n .description('Creates a new Orionjs project')\n .option('--name [name]', 'Name of the project')\n .option('--kit [kit]', 'Which starter kit to use')\n .action(run(create))\n\nprogram.command('info').description('Print runtime and version info').action(run(info))\n\nprogram\n .command('repl')\n .description('Evaluate an expression against a running Orionjs dev server')\n .requiredOption('-e, --expression <expression>', 'Expression to evaluate')\n .option('--port <port>', 'Port of the dev server (default: auto-detect from .orion/port)')\n .action(run(repl))\n\nprogram.version(version, '-v --version')\n\nprogram.parse(process.argv)\n\nif (!process.argv.slice(2).length) {\n program.outputHelp()\n}\n","import {exec} from 'node:child_process'\n\nexport default async function (command) {\n return new Promise((resolve, reject) => {\n exec(command, (error, stdout, stderr) => {\n if (error) {\n reject(error)\n } else {\n resolve({stdout, stderr})\n }\n })\n })\n}\n","import execute from '../helpers/execute'\n\nexport default async function ({name, kit}) {\n if (!name) {\n throw new Error('Please set the name of the app')\n }\n if (!kit) {\n throw new Error('Please select which kit to use')\n }\n const repo = `https://github.com/siturra/boilerplate-orionjs-${kit}`\n console.log('Downloading starter kit...')\n await execute(`git clone ${repo} ${name}`)\n await execute(`cd ${name} && rm -rf .git`)\n console.log('Your starter kit is ready')\n}\n","import chalk from 'chalk'\nimport {getRunner, RunnerOptions} from './runner'\nimport watchAndCompile from './watchAndCompile'\n\nexport default async function (options: RunnerOptions, command: any) {\n console.log(chalk.bold(`\\nOrionjs App ${chalk.green(chalk.bold('V4'))} Dev mode \\n`))\n\n const runner = getRunner(options, command)\n\n await watchAndCompile(runner, options)\n}\n","import chalk from 'chalk'\nimport writeFile from '../../helpers/writeFile'\nimport {startProcess} from './startProcess'\n\nexport interface RunnerOptions {\n shell: boolean\n clean: boolean\n node: boolean\n repl: boolean\n typecheck: boolean\n}\n\nexport interface Runner {\n start: () => void\n restart: () => void\n stop: () => void\n}\n\nexport function getRunner(options: RunnerOptions, command: any): Runner {\n let appProcess = null\n\n if (options.clean) {\n console.log(chalk.bold('=> Cleaning directory...\\n'))\n }\n\n const startApp = () => {\n const startedProcess = startProcess(options, command)\n appProcess = startedProcess\n\n startedProcess.on('exit', (code: number, signal: string) => {\n // An exited child must not make `start()` believe the application is\n // still alive. Compare identities because an older child can emit its\n // exit event after a replacement process has already been assigned.\n if (appProcess === startedProcess) appProcess = null\n\n if (!code || code === 143 || code === 0 || signal === 'SIGTERM' || signal === 'SIGINT') {\n } else {\n console.log(chalk.bold(`=> Error running app. Exit code: ${code}`))\n }\n })\n\n writeFile('.orion/process', `${startedProcess.pid}`)\n }\n\n const stop = () => {\n if (appProcess) {\n appProcess.kill()\n appProcess = null\n }\n }\n\n const restart = () => {\n console.log(chalk.bold('=> Restarting app...\\n'))\n stop()\n startApp()\n }\n\n const start = () => {\n // check if the app is already running\n if (appProcess) {\n // console.log(chalk.bold('=> App is already running. Restarting...\\n'))\n } else {\n startApp()\n }\n }\n\n return {\n restart,\n stop,\n start,\n }\n}\n","import fs from 'node:fs'\nimport ensureDirectory from '../helpers/ensureDirectory'\n\nexport default async function (path: string, content: string): Promise<void> {\n ensureDirectory(path)\n fs.writeFileSync(path, content)\n}\n","import fs from 'node:fs'\nimport path from 'node:path'\n\nconst ensureDirectory = filePath => {\n const dirname = path.dirname(filePath)\n if (fs.existsSync(dirname)) return true\n ensureDirectory(dirname)\n fs.mkdirSync(dirname)\n}\n\nexport default ensureDirectory\n","import {spawn} from 'node:child_process'\nimport chalk from 'chalk'\nimport {getArgs} from './getArgs'\nimport {RunnerOptions} from './index'\n\nexport function startProcess(options: RunnerOptions, command: any) {\n const {startCommand, args} = getArgs(options, command)\n\n console.log(chalk.bold(`=> Starting app with command: ${startCommand} ${args.join(' ')}...\\n`))\n return spawn(startCommand, args, {\n env: {\n ORION_DEV: 'local',\n ...process.env,\n ...(options.repl ? {ORION_REPL: 'true'} : {}),\n },\n cwd: process.cwd(),\n stdio: 'inherit',\n detached: false,\n })\n}\n","export const devBuildPath = './.orion/build/index.js'\n","import {devBuildPath} from '../devBuildPath'\nimport {RunnerOptions} from './index'\n\nexport function getArgs(options: RunnerOptions, command: any) {\n if (options.node) {\n const startCommand = 'node'\n const args = ['--enable-source-maps', ...command.args, devBuildPath]\n return {startCommand, args}\n }\n\n const startCommand = 'bun'\n const args = ['--watch', ...command.args, devBuildPath]\n return {startCommand, args}\n}\n","import fs from 'node:fs'\nimport path from 'node:path'\n\n/**\n * Remove directory recursively\n * @param {string} dir_path\n * @see https://stackoverflow.com/a/42505874/3027390\n */\nfunction rimraf(dir_path: string) {\n if (fs.existsSync(dir_path)) {\n fs.readdirSync(dir_path).map(entry => {\n const entry_path = path.join(dir_path, entry)\n if (fs.lstatSync(entry_path).isDirectory()) {\n rimraf(entry_path)\n } else {\n fs.unlinkSync(entry_path)\n }\n })\n fs.rmdirSync(dir_path)\n }\n}\n\nexport default async function cleanDirectory(directory?: string) {\n try {\n const dirPath = directory ? directory : path.join(process.cwd(), '.orion', 'build')\n rimraf(dirPath)\n } catch (_) {\n // Ignore errors during cleanup\n }\n}\n","import {readFileSync} from 'node:fs'\nimport {createRequire} from 'node:module'\nimport {extname, join} from 'node:path'\nimport chokidar from 'chokidar'\nimport * as esbuild from 'esbuild'\nimport {devBuildPath} from '../devBuildPath'\nimport type {Runner, RunnerOptions} from '../runner'\n\nfunction getPackageName(specifier: string) {\n const segments = specifier.split('/')\n return specifier.startsWith('@') ? segments.slice(0, 2).join('/') : segments[0]\n}\n\n/**\n * Keep dependencies external while making source imports valid in plain Node\n * ESM. tsx accepts extensionless package subpaths and JSON imports, but Node\n * requires explicit extensions and JSON attributes.\n */\nfunction nodeExternalCompatibilityPlugin(): esbuild.Plugin {\n const requireFromApp = createRequire(join(process.cwd(), 'package.json'))\n\n return {\n name: 'orion-node-external-compatibility',\n setup(build) {\n build.onResolve({filter: /^[^./].*\\.json$/}, args => {\n try {\n return {path: requireFromApp.resolve(args.path)}\n } catch {\n return undefined\n }\n })\n\n build.onResolve({filter: /^[^./]/}, args => {\n const packageName = getPackageName(args.path)\n if (args.path === packageName || extname(args.path)) return undefined\n\n try {\n const packageJsonPath = requireFromApp.resolve(`${packageName}/package.json`)\n const packageJson = JSON.parse(readFileSync(packageJsonPath, 'utf8')) as {\n exports?: unknown\n }\n if (packageJson.exports) return undefined\n\n const resolvedExtension = extname(requireFromApp.resolve(args.path))\n if (!resolvedExtension) return undefined\n\n return {path: `${args.path}${resolvedExtension}`, external: true}\n } catch {\n return undefined\n }\n })\n },\n }\n}\n\n/**\n * Bundle application code once and rebuild it incrementally on edits.\n *\n * Running the bundle avoids making Node transform every TypeScript module on\n * every restart. Dependencies remain external so their native Node behavior\n * stays identical to a production build.\n */\nexport async function watchAndBundle(\n runner: Runner,\n options: RunnerOptions,\n onFilesChanged?: () => void,\n) {\n let hasSuccessfulBuild = false\n let buildStartedAt = Date.now()\n let rebuildInProgress = false\n let rebuildRequested = false\n let rebuildTimer: NodeJS.Timeout | undefined\n\n const context = await esbuild.context({\n entryPoints: ['./app/index.ts'],\n outfile: devBuildPath,\n tsconfig: './tsconfig.json',\n format: 'esm',\n platform: 'node',\n bundle: true,\n target: 'node22',\n sourcemap: true,\n packages: 'external',\n plugins: [\n nodeExternalCompatibilityPlugin(),\n {\n name: 'orion-dev-restart',\n setup(build) {\n build.onStart(() => {\n buildStartedAt = Date.now()\n })\n\n build.onEnd(result => {\n if (result.errors.length > 0) {\n // Serving the previous bundle hides the broken save from the\n // browser. Stop it so the normal dev error state is visible,\n // then let the next successful build recover automatically.\n runner.stop()\n return\n }\n\n console.log(`=> Application bundled in ${Date.now() - buildStartedAt}ms`)\n\n if (hasSuccessfulBuild && options.node) {\n runner.restart()\n } else if (!hasSuccessfulBuild) {\n hasSuccessfulBuild = true\n runner.start()\n } else {\n // Bun normally reloads itself after the bundle changes. It may\n // instead be stopped after a build/type error and need recovery.\n runner.start()\n }\n })\n },\n },\n ],\n })\n\n const rebuild = async () => {\n if (rebuildInProgress) {\n rebuildRequested = true\n return\n }\n\n rebuildInProgress = true\n do {\n rebuildRequested = false\n try {\n await context.rebuild()\n } catch {\n // esbuild already prints diagnostics. Keep watching so the next edit\n // can recover without restarting the Orion CLI.\n }\n } while (rebuildRequested)\n rebuildInProgress = false\n }\n\n await rebuild()\n\n const watcher = chokidar.watch(['./app', './tsconfig.json'], {ignoreInitial: true})\n watcher.on('all', () => {\n onFilesChanged?.()\n clearTimeout(rebuildTimer)\n rebuildTimer = setTimeout(rebuild, 20)\n })\n watcher.on('error', error => console.error(`Unable to watch application files: ${error.message}`))\n\n return {context, watcher}\n}\n","import {spawn} from 'node:child_process'\nimport type {Runner} from '../runner'\nimport {getConfigPath} from './getConfigPath'\n\n/**\n * Create a serialized, on-demand TypeScript checker.\n *\n * `tsc --watch` creates a second filesystem watcher for the entire project and\n * can stall when the operating system is already watching many worktrees. A\n * one-off check is both faster and sufficient because the bundle watcher calls\n * this function after every source change. Changes received during an active\n * check collapse into one fresh check, so stale diagnostics never stop the app.\n */\nexport function watchAndTypecheck(runner: Runner) {\n const configPath = getConfigPath()\n let checkInProgress = false\n let checkRequested = false\n\n const runCheck = () => {\n if (checkInProgress) {\n checkRequested = true\n return\n }\n\n checkInProgress = true\n const startedAt = Date.now()\n const checker = spawn('tsc', ['--noEmit', '--project', configPath], {\n env: process.env,\n stdio: ['ignore', 'pipe', 'pipe'],\n })\n let output = ''\n let spawnError: Error | undefined\n\n checker.stdout.on('data', chunk => {\n output += chunk.toString()\n })\n checker.stderr.on('data', chunk => {\n output += chunk.toString()\n })\n checker.on('error', error => {\n spawnError = error\n })\n\n checker.on('close', code => {\n checkInProgress = false\n\n // A newer save makes this result stale. Check the latest project state\n // before changing the running application's state or printing errors.\n if (checkRequested) {\n checkRequested = false\n runCheck()\n return\n }\n\n if (spawnError) {\n runner.stop()\n console.error(`Unable to run TypeScript: ${spawnError.message}`)\n return\n }\n\n const duration = Date.now() - startedAt\n if (code === 0) {\n console.log(`=> TypeScript checked in ${duration}ms`)\n runner.start()\n return\n }\n\n if (output.trim()) console.error(output.trimEnd())\n console.error(`=> TypeScript found errors in ${duration}ms`)\n runner.stop()\n })\n }\n\n return runCheck\n}\n","import {existsSync} from 'node:fs'\nimport {dirname, join} from 'node:path'\nimport {ensureConfigComplies} from './ensureConfigComplies'\n\nfunction findConfigFile(startDirectory: string, fileName: string): string | undefined {\n let directory = startDirectory\n\n while (true) {\n const candidate = join(directory, fileName)\n if (existsSync(candidate)) return candidate\n\n const parent = dirname(directory)\n if (parent === directory) return undefined\n directory = parent\n }\n}\n\nexport function getConfigPath() {\n const appBasePath = process.cwd()\n\n const configPath =\n findConfigFile(appBasePath, 'tsconfig.server.json') ||\n findConfigFile(appBasePath, 'tsconfig.json')\n\n if (!configPath) {\n throw new Error(\"Could not find a valid 'tsconfig.json'.\")\n }\n\n ensureConfigComplies(configPath)\n\n return configPath\n}\n","import {parse, stringify} from 'comment-json'\nimport getFileContents from '../../helpers/getFileContents'\nimport writeFile from '../../helpers/writeFile'\n\n// Define TypeScript config interface\ninterface TSConfig {\n compilerOptions?: {\n paths?: Record<string, string[]>\n rootDir?: string\n rootDirs?: string[]\n [key: string]: any\n }\n [key: string]: any\n}\n\nexport function ensureConfigComplies(configPath: string) {\n try {\n const configJSON = getFileContents(configPath)\n const config = parse(configJSON) as TSConfig\n const {baseUrl: _baseUrl, ...compilerOptions} = config.compilerOptions ?? {}\n\n const newConfig = {\n ...config,\n compilerOptions: {\n ...compilerOptions,\n paths: {\n '*': ['./*'],\n ...compilerOptions.paths,\n },\n noEmit: true,\n },\n }\n\n if (!config.compilerOptions?.rootDir && !config.compilerOptions?.rootDirs) {\n newConfig.compilerOptions.rootDir = './app'\n }\n\n // are the same, no write\n if (JSON.stringify(config) === JSON.stringify(newConfig)) {\n return\n }\n\n writeFile(configPath, stringify(newConfig, null, 2))\n } catch (error) {\n console.log(`Error reading tsconfig: ${error.message}`)\n }\n}\n","import fs from 'node:fs'\n\nexport default function readFile(filePath: string) {\n if (!fs.existsSync(filePath)) return null\n\n return fs.readFileSync(filePath).toString()\n}\n","import {writeDtsFileFromConfigFile} from '@orion-js/env'\nimport chalk from 'chalk'\nimport chokidar from 'chokidar'\nimport {Runner} from '../runner'\n\nconst envFilePath = process.env.ORION_ENV_FILE_PATH\nconst dtsFilePath = './app/env.d.ts'\n\nexport const watchEnvFile = async (runner: Runner) => {\n if (!envFilePath) return\n\n writeDtsFileFromConfigFile(envFilePath, dtsFilePath)\n\n chokidar.watch(envFilePath, {ignoreInitial: true}).on('change', async () => {\n console.log(chalk.bold('=> Environment file changed. Restarting...'))\n writeDtsFileFromConfigFile(envFilePath, dtsFilePath)\n runner.restart()\n })\n}\n","import {Runner, RunnerOptions} from '../runner'\nimport cleanDirectory from './cleanDirectory'\nimport {watchAndBundle} from './watchAndBundle'\nimport {watchAndTypecheck} from './watchAndTypecheck'\nimport {watchEnvFile} from './writeEnvFile'\n\nexport default async function watchAndCompile(runner: Runner, options: RunnerOptions) {\n await cleanDirectory()\n const requestTypecheck = options.typecheck ? watchAndTypecheck(runner) : undefined\n await watchAndBundle(runner, options, requestTypecheck)\n requestTypecheck?.()\n watchEnvFile(runner)\n}\n","import chalk from 'chalk'\nimport build from '../build'\nimport {runProd} from './runProd'\n\nexport interface ProdOptions {\n path?: string\n node?: boolean\n}\n\nexport default async function (options: ProdOptions, command: any) {\n console.log(chalk.bold(`\\nOrionjs App ${chalk.green(chalk.bold('V4'))} Prod mode\\n`))\n\n if (options.node) {\n if (!options.path) {\n await build({output: './build'})\n options.path = './build'\n }\n }\n\n runProd(options, command)\n}\n","import chalk from 'chalk'\nimport {build} from './build'\nimport cleanDirectory from '../dev/watchAndCompile/cleanDirectory'\nimport {checkTs} from './checkTs'\n\nexport default async function (options: {output?: string}) {\n console.log(chalk.bold(`Building Orionjs App ${chalk.green(chalk.bold('V4'))}...`))\n\n if (!options.output) {\n options.output = './build'\n }\n\n await cleanDirectory(options.output)\n\n await checkTs()\n await build(options)\n\n console.log(chalk.bold('Build completed'))\n}\n","import chalk from 'chalk'\nimport * as esbuild from 'esbuild'\n\nexport async function build(options: {output?: string}) {\n const {output} = options\n\n console.log(`Building with esbuild to ${output}`)\n\n await esbuild.build({\n entryPoints: ['./app/index.ts'],\n tsconfig: './tsconfig.json',\n format: 'esm',\n platform: 'node',\n outdir: output,\n bundle: true,\n target: 'node22',\n sourcemap: true,\n allowOverwrite: true,\n minify: true,\n packages: 'external',\n })\n\n console.log(chalk.green.bold('Build successful'))\n}\n","import chalk from 'chalk'\nimport {exec} from 'node:child_process'\nimport {promisify} from 'node:util'\n\nconst execPromise = promisify(exec)\n\nexport async function checkTs(): Promise<void> {\n try {\n console.log('Checking TypeScript...')\n await execPromise('tsc --noEmit', {\n cwd: process.cwd(),\n env: {\n ...process.env,\n },\n gid: process.getgid(),\n uid: process.getuid(),\n })\n console.log(chalk.green.bold('TypeScript check passed'))\n } catch (error) {\n console.log(chalk.red.bold('TypeScript compilation failed'))\n console.log(error.stderr || error.stdout || error.message)\n process.exit(1)\n }\n}\n","import {spawn} from 'node:child_process'\nimport {ProdOptions} from './index'\n\nexport function runProd(options: ProdOptions, command: any) {\n if (options.node) {\n const indexPath = `${options.path}/index.js`\n const args = ['--import=tsx', ...command.args, indexPath]\n spawn('node', args, {\n env: {\n NODE_ENV: 'production',\n ...process.env,\n },\n cwd: process.cwd(),\n stdio: 'inherit',\n gid: process.getgid(),\n uid: process.getuid(),\n detached: false,\n })\n return\n }\n\n const args = [...command.args, './app/index.ts']\n spawn('bun', args, {\n env: {\n NODE_ENV: 'production',\n ...process.env,\n },\n cwd: process.cwd(),\n stdio: 'inherit',\n gid: process.getgid(),\n uid: process.getuid(),\n detached: false,\n })\n}\n","import chalk from 'chalk'\n\ninterface ErrorWithCodeFrame extends Error {\n codeFrame?: string\n}\n\nprocess\n .on('unhandledRejection', (error: ErrorWithCodeFrame) => {\n if (error.codeFrame) {\n console.error(chalk.red(error.message))\n console.log(error.codeFrame)\n } else {\n console.error(chalk.red(error.message), chalk.red('Unhandled promise rejection'))\n }\n })\n .on('uncaughtException', (error: Error) => {\n console.error(chalk.red(error.message))\n process.exit(1)\n })\n","import {readFileSync} from 'node:fs'\nimport {dirname, resolve} from 'node:path'\nimport {fileURLToPath} from 'node:url'\n\nfunction getVersion(): string {\n try {\n const dir = dirname(fileURLToPath(import.meta.url))\n const pkgPath = resolve(dir, '..', 'package.json')\n const pkg = JSON.parse(readFileSync(pkgPath, 'utf-8'))\n return pkg.version\n } catch {\n return 'unknown'\n }\n}\n\nexport default getVersion()\n","import chalk from 'chalk'\nimport {checkTs} from './checkTs'\n\nexport default async function () {\n console.log(chalk.bold(`Orionjs App ${chalk.green(chalk.bold('V4'))}\\n`))\n console.log('Checking typescript...')\n\n checkTs()\n\n console.log(chalk.bold.green('Check passed\\n'))\n}\n","import chalk from 'chalk'\nimport {execSync} from 'node:child_process'\n\nexport function checkTs() {\n try {\n execSync('tsc --noEmit', {\n cwd: process.cwd(),\n env: {\n ...process.env,\n },\n gid: process.getgid(),\n uid: process.getuid(),\n stdio: 'inherit',\n })\n } catch {\n console.log(chalk.red.bold('TypeScript compilation failed'))\n process.exit(1)\n }\n}\n","import chalk from 'chalk'\nimport {execSync} from 'node:child_process'\nimport version from './version'\n\nfunction detectRuntime(): string {\n const runtimes: string[] = []\n\n try {\n const bunVersion = execSync('bun --version', {encoding: 'utf-8'}).trim()\n runtimes.push(`Bun ${bunVersion}`)\n } catch {}\n\n runtimes.push(`Node ${process.versions.node}`)\n\n return runtimes.join(', ')\n}\n\nexport default function info() {\n console.log(`Orion CLI v${version} — Available runtimes: ${chalk.bold(detectRuntime())}`)\n console.log(`Default runtime: ${chalk.bold('Bun')} (use --node flag to switch to Node.js)`)\n}\n","import {readFileSync} from 'node:fs'\nimport {resolve} from 'node:path'\nimport chalk from 'chalk'\n\nexport interface ReplOptions {\n expression?: string\n port?: string\n}\n\ninterface ReplResponse {\n success: boolean\n error?: string\n stack?: string\n result?: unknown\n}\n\nfunction resolvePort(options: ReplOptions): number {\n if (options.port) {\n return Number(options.port)\n }\n\n try {\n const portFile = resolve(process.cwd(), '.orion/port')\n const port = readFileSync(portFile, 'utf-8').trim()\n return Number(port)\n } catch {}\n\n if (process.env.PORT) {\n return Number(process.env.PORT)\n }\n\n return 3000\n}\n\nexport default async function repl(options: ReplOptions) {\n const expression = options.expression\n\n if (!expression) {\n console.error(chalk.red('Error: expression is required. Use -e \"<expression>\"'))\n process.exit(1)\n }\n\n const port = resolvePort(options)\n\n try {\n const response = await fetch(`http://localhost:${port}/__repl`, {\n method: 'POST',\n headers: {'Content-Type': 'application/json'},\n body: JSON.stringify({expression}),\n })\n\n const data = (await response.json()) as ReplResponse\n\n if (!data.success) {\n console.error(chalk.red(`Error: ${data.error}`))\n if (data.stack) {\n console.error(chalk.dim(data.stack))\n }\n process.exit(1)\n }\n\n if (data.result !== undefined) {\n console.log(\n typeof data.result === 'string' ? data.result : JSON.stringify(data.result, null, 2),\n )\n }\n } catch (error) {\n const nodeError = error as Error & {code?: string; cause?: {code?: string}}\n if (nodeError.code === 'ECONNREFUSED' || nodeError.cause?.code === 'ECONNREFUSED') {\n console.error(\n chalk.red(\n `Could not connect to dev server on port ${port}. Make sure \"orion dev --repl\" is running.`,\n ),\n )\n } else {\n console.error(chalk.red(`Error: ${nodeError.message}`))\n }\n process.exit(1)\n }\n}\n"],"mappings":";;;AACA,OAAOA,aAAW;AAClB,SAAQ,eAAc;;;ACFtB,SAAQ,YAAW;AAEnB,eAAO,gBAAwB,SAAS;AACtC,SAAO,IAAI,QAAQ,CAACC,UAAS,WAAW;AACtC,SAAK,SAAS,CAAC,OAAO,QAAQ,WAAW;AACvC,UAAI,OAAO;AACT,eA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AEtF,QACG,QAAQ,MAAM,EACd,YAAY,6DAA6D,EACzE,eAAe,iCAAiC,wBAAwB,EACxE,OAAO,iBAAiB,gEAAgE,EACxF,OAAO,IAAI,IAAI,CAAC;AAEnB,QAAQ,QAAQ,iBAAS,cAAc;AAEvC,QAAQ,MAAM,QAAQ,IAAI;AAE1B,IAAI,CAAC,QAAQ,KAAK,MAAM,CAAC,EAAE,QAAQ;AACjC,UAAQ,WAAW;AACrB;","names":["chalk","resolve","chalk","chalk","fs","dirname","path","fs","startCommand","args","chalk","fs","path","build","context","spawn","join","fs","join","spawn","chalk","chokidar","chalk","chalk","chalk","chalk","esbuild","build","chalk","exec","chalk","build","spawn","args","chalk","chalk","readFileSync","dirname","chalk","chalk","checkTs","chalk","checkTs","chalk","execSync","execSync","chalk","readFileSync","resolve","chalk","chalk"]}
|
package/package.json
CHANGED