@orion-js/core 4.3.3 → 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/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  // src/index.ts
4
- import chalk15 from "chalk";
4
+ import chalk14 from "chalk";
5
5
  import { Command } from "commander";
6
6
 
7
7
  // src/helpers/execute.ts
@@ -34,7 +34,7 @@ async function create_default({ name, kit }) {
34
34
  }
35
35
 
36
36
  // src/dev/index.ts
37
- import chalk5 from "chalk";
37
+ import chalk4 from "chalk";
38
38
 
39
39
  // src/dev/runner/index.ts
40
40
  import chalk2 from "chalk";
@@ -46,10 +46,10 @@ import fs2 from "fs";
46
46
  import fs from "fs";
47
47
  import path from "path";
48
48
  var ensureDirectory = (filePath) => {
49
- const dirname2 = path.dirname(filePath);
50
- if (fs.existsSync(dirname2)) return true;
51
- ensureDirectory(dirname2);
52
- fs.mkdirSync(dirname2);
49
+ const dirname3 = path.dirname(filePath);
50
+ if (fs.existsSync(dirname3)) return true;
51
+ ensureDirectory(dirname3);
52
+ fs.mkdirSync(dirname3);
53
53
  };
54
54
  var ensureDirectory_default = ensureDirectory;
55
55
 
@@ -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 = "tsx";
70
- const args2 = ["watch", "--clear-screen=false", ...command.args, "./app/index.ts"];
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, "./app/index.ts"];
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
- appProcess = startProcess(options, command);
103
- appProcess.on("exit", (code, signal) => {
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", `${appProcess.pid}`);
114
+ writeFile_default(".orion/process", `${startedProcess.pid}`);
110
115
  };
111
116
  const stop = () => {
112
117
  if (appProcess) {
@@ -132,9 +137,6 @@ function getRunner(options, command) {
132
137
  };
133
138
  }
134
139
 
135
- // src/dev/watchAndCompile/index.ts
136
- import ts4 from "typescript";
137
-
138
140
  // src/dev/watchAndCompile/cleanDirectory.ts
139
141
  import fs3 from "fs";
140
142
  import path2 from "path";
@@ -159,11 +161,120 @@ async function cleanDirectory(directory) {
159
161
  }
160
162
  }
161
163
 
162
- // src/dev/watchAndCompile/getHost.ts
163
- import ts3 from "typescript";
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
273
+ import { spawn as spawn2 } from "child_process";
164
274
 
165
275
  // src/dev/watchAndCompile/getConfigPath.ts
166
- import ts from "typescript";
276
+ import { existsSync } from "fs";
277
+ import { dirname, join as join2 } from "path";
167
278
 
168
279
  // src/dev/watchAndCompile/ensureConfigComplies.ts
169
280
  import { parse, stringify } from "comment-json";
@@ -181,11 +292,15 @@ function ensureConfigComplies(configPath) {
181
292
  try {
182
293
  const configJSON = readFile(configPath);
183
294
  const config = parse(configJSON);
295
+ const { baseUrl: _baseUrl, ...compilerOptions } = config.compilerOptions ?? {};
184
296
  const newConfig = {
185
297
  ...config,
186
298
  compilerOptions: {
187
- ...config.compilerOptions,
188
- baseUrl: "./",
299
+ ...compilerOptions,
300
+ paths: {
301
+ "*": ["./*"],
302
+ ...compilerOptions.paths
303
+ },
189
304
  noEmit: true
190
305
  }
191
306
  };
@@ -202,9 +317,19 @@ function ensureConfigComplies(configPath) {
202
317
  }
203
318
 
204
319
  // src/dev/watchAndCompile/getConfigPath.ts
320
+ function findConfigFile(startDirectory, fileName) {
321
+ let directory = startDirectory;
322
+ while (true) {
323
+ const candidate = join2(directory, fileName);
324
+ if (existsSync(candidate)) return candidate;
325
+ const parent = dirname(directory);
326
+ if (parent === directory) return void 0;
327
+ directory = parent;
328
+ }
329
+ }
205
330
  function getConfigPath() {
206
331
  const appBasePath = process.cwd();
207
- const configPath = ts.findConfigFile(appBasePath, ts.sys.fileExists, "tsconfig.server.json") || ts.findConfigFile(appBasePath, ts.sys.fileExists, "tsconfig.json");
332
+ const configPath = findConfigFile(appBasePath, "tsconfig.server.json") || findConfigFile(appBasePath, "tsconfig.json");
208
333
  if (!configPath) {
209
334
  throw new Error("Could not find a valid 'tsconfig.json'.");
210
335
  }
@@ -212,106 +337,106 @@ function getConfigPath() {
212
337
  return configPath;
213
338
  }
214
339
 
215
- // src/dev/watchAndCompile/reports.ts
216
- import ts2 from "typescript";
217
- var format = {
218
- getCanonicalFileName: (fileName) => fileName,
219
- getCurrentDirectory: () => process.cwd(),
220
- getNewLine: () => ts2.sys.newLine
221
- };
222
- function reportDiagnostic(diagnostic) {
223
- console.log(ts2.formatDiagnosticsWithColorAndContext([diagnostic], format));
224
- }
225
-
226
- // src/dev/watchAndCompile/getHost.ts
227
- import chalk3 from "chalk";
228
- function getHost(runner) {
229
- let isStopped = true;
230
- const reportWatchStatusChanged = (diagnostic) => {
231
- if (diagnostic.category !== 3) return;
232
- if (diagnostic.code === 6031 || diagnostic.code === 6032) {
233
- return;
234
- }
235
- if (diagnostic.code === 6193) {
236
- runner.stop();
237
- isStopped = true;
340
+ // src/dev/watchAndCompile/watchAndTypecheck.ts
341
+ function watchAndTypecheck(runner) {
342
+ const configPath = getConfigPath();
343
+ let checkInProgress = false;
344
+ let checkRequested = false;
345
+ const runCheck = () => {
346
+ if (checkInProgress) {
347
+ checkRequested = true;
238
348
  return;
239
349
  }
240
- if (diagnostic.code === 6194) {
241
- if (/^Found .+ errors?/.test(diagnostic.messageText.toString())) {
242
- if (!diagnostic.messageText.toString().includes("Found 0 errors.")) {
243
- runner.stop();
244
- isStopped = true;
245
- return;
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;
247
373
  }
248
- if (isStopped) {
249
- isStopped = false;
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`);
250
382
  runner.start();
383
+ return;
251
384
  }
252
- return;
253
- }
254
- console.log(chalk3.bold(`=> ${diagnostic.messageText} [${diagnostic.code}]`));
385
+ if (output.trim()) console.error(output.trimEnd());
386
+ console.error(`=> TypeScript found errors in ${duration}ms`);
387
+ runner.stop();
388
+ });
255
389
  };
256
- const configPath = getConfigPath();
257
- const createProgram = ts3.createEmitAndSemanticDiagnosticsBuilderProgram;
258
- const host = ts3.createWatchCompilerHost(
259
- configPath,
260
- {},
261
- ts3.sys,
262
- createProgram,
263
- reportDiagnostic,
264
- reportWatchStatusChanged
265
- );
266
- return host;
390
+ return runCheck;
267
391
  }
268
392
 
269
393
  // src/dev/watchAndCompile/writeEnvFile.ts
270
394
  import { writeDtsFileFromConfigFile } from "@orion-js/env";
271
- import chalk4 from "chalk";
272
- import chokidar from "chokidar";
395
+ import chalk3 from "chalk";
396
+ import chokidar2 from "chokidar";
273
397
  var envFilePath = process.env.ORION_ENV_FILE_PATH;
274
398
  var dtsFilePath = "./app/env.d.ts";
275
399
  var watchEnvFile = async (runner) => {
276
400
  if (!envFilePath) return;
277
401
  writeDtsFileFromConfigFile(envFilePath, dtsFilePath);
278
- chokidar.watch(envFilePath, { ignoreInitial: true }).on("change", async () => {
279
- console.log(chalk4.bold("=> Environment file changed. Restarting..."));
402
+ chokidar2.watch(envFilePath, { ignoreInitial: true }).on("change", async () => {
403
+ console.log(chalk3.bold("=> Environment file changed. Restarting..."));
280
404
  writeDtsFileFromConfigFile(envFilePath, dtsFilePath);
281
405
  runner.restart();
282
406
  });
283
407
  };
284
408
 
285
409
  // src/dev/watchAndCompile/index.ts
286
- async function watchAndCompile(runner) {
410
+ async function watchAndCompile(runner, options) {
287
411
  await cleanDirectory();
288
- const host = getHost(runner);
289
- ts4.createWatchProgram(host);
412
+ const requestTypecheck = options.typecheck ? watchAndTypecheck(runner) : void 0;
413
+ await watchAndBundle(runner, options, requestTypecheck);
414
+ requestTypecheck == null ? void 0 : requestTypecheck();
290
415
  watchEnvFile(runner);
291
416
  }
292
417
 
293
418
  // src/dev/index.ts
294
419
  async function dev_default(options, command) {
295
- console.log(chalk5.bold(`
296
- Orionjs App ${chalk5.green(chalk5.bold("V4"))} Dev mode
420
+ console.log(chalk4.bold(`
421
+ Orionjs App ${chalk4.green(chalk4.bold("V4"))} Dev mode
297
422
  `));
298
423
  const runner = getRunner(options, command);
299
- watchAndCompile(runner);
424
+ await watchAndCompile(runner, options);
300
425
  }
301
426
 
302
427
  // src/prod/index.ts
303
- import chalk9 from "chalk";
428
+ import chalk8 from "chalk";
304
429
 
305
430
  // src/build/index.ts
306
- import chalk8 from "chalk";
431
+ import chalk7 from "chalk";
307
432
 
308
433
  // src/build/build.ts
309
- import chalk6 from "chalk";
310
- import * as esbuild from "esbuild";
434
+ import chalk5 from "chalk";
435
+ import * as esbuild2 from "esbuild";
311
436
  async function build2(options) {
312
437
  const { output } = options;
313
438
  console.log(`Building with esbuild to ${output}`);
314
- await esbuild.build({
439
+ await esbuild2.build({
315
440
  entryPoints: ["./app/index.ts"],
316
441
  tsconfig: "./tsconfig.json",
317
442
  format: "esm",
@@ -324,11 +449,11 @@ async function build2(options) {
324
449
  minify: true,
325
450
  packages: "external"
326
451
  });
327
- console.log(chalk6.green.bold("Build successful"));
452
+ console.log(chalk5.green.bold("Build successful"));
328
453
  }
329
454
 
330
455
  // src/build/checkTs.ts
331
- import chalk7 from "chalk";
456
+ import chalk6 from "chalk";
332
457
  import { exec as exec2 } from "child_process";
333
458
  import { promisify } from "util";
334
459
  var execPromise = promisify(exec2);
@@ -343,9 +468,9 @@ async function checkTs() {
343
468
  gid: process.getgid(),
344
469
  uid: process.getuid()
345
470
  });
346
- console.log(chalk7.green.bold("TypeScript check passed"));
471
+ console.log(chalk6.green.bold("TypeScript check passed"));
347
472
  } catch (error) {
348
- console.log(chalk7.red.bold("TypeScript compilation failed"));
473
+ console.log(chalk6.red.bold("TypeScript compilation failed"));
349
474
  console.log(error.stderr || error.stdout || error.message);
350
475
  process.exit(1);
351
476
  }
@@ -353,23 +478,23 @@ async function checkTs() {
353
478
 
354
479
  // src/build/index.ts
355
480
  async function build_default(options) {
356
- console.log(chalk8.bold(`Building Orionjs App ${chalk8.green(chalk8.bold("V4"))}...`));
481
+ console.log(chalk7.bold(`Building Orionjs App ${chalk7.green(chalk7.bold("V4"))}...`));
357
482
  if (!options.output) {
358
483
  options.output = "./build";
359
484
  }
360
485
  await cleanDirectory(options.output);
361
486
  await checkTs();
362
487
  await build2(options);
363
- console.log(chalk8.bold("Build completed"));
488
+ console.log(chalk7.bold("Build completed"));
364
489
  }
365
490
 
366
491
  // src/prod/runProd.ts
367
- import { spawn as spawn2 } from "child_process";
492
+ import { spawn as spawn3 } from "child_process";
368
493
  function runProd(options, command) {
369
494
  if (options.node) {
370
495
  const indexPath = `${options.path}/index.js`;
371
496
  const args2 = ["--import=tsx", ...command.args, indexPath];
372
- spawn2("node", args2, {
497
+ spawn3("node", args2, {
373
498
  env: {
374
499
  NODE_ENV: "production",
375
500
  ...process.env
@@ -383,7 +508,7 @@ function runProd(options, command) {
383
508
  return;
384
509
  }
385
510
  const args = [...command.args, "./app/index.ts"];
386
- spawn2("bun", args, {
511
+ spawn3("bun", args, {
387
512
  env: {
388
513
  NODE_ENV: "production",
389
514
  ...process.env
@@ -398,8 +523,8 @@ function runProd(options, command) {
398
523
 
399
524
  // src/prod/index.ts
400
525
  async function prod_default(options, command) {
401
- console.log(chalk9.bold(`
402
- Orionjs App ${chalk9.green(chalk9.bold("V4"))} Prod mode
526
+ console.log(chalk8.bold(`
527
+ Orionjs App ${chalk8.green(chalk8.bold("V4"))} Prod mode
403
528
  `));
404
529
  if (options.node) {
405
530
  if (!options.path) {
@@ -411,28 +536,28 @@ Orionjs App ${chalk9.green(chalk9.bold("V4"))} Prod mode
411
536
  }
412
537
 
413
538
  // src/handleErrors.ts
414
- import chalk10 from "chalk";
539
+ import chalk9 from "chalk";
415
540
  process.on("unhandledRejection", (error) => {
416
541
  if (error.codeFrame) {
417
- console.error(chalk10.red(error.message));
542
+ console.error(chalk9.red(error.message));
418
543
  console.log(error.codeFrame);
419
544
  } else {
420
- console.error(chalk10.red(error.message), chalk10.red("Unhandled promise rejection"));
545
+ console.error(chalk9.red(error.message), chalk9.red("Unhandled promise rejection"));
421
546
  }
422
547
  }).on("uncaughtException", (error) => {
423
- console.error(chalk10.red(error.message));
548
+ console.error(chalk9.red(error.message));
424
549
  process.exit(1);
425
550
  });
426
551
 
427
552
  // src/version.ts
428
- import { readFileSync } from "fs";
429
- import { dirname, resolve } from "path";
553
+ import { readFileSync as readFileSync2 } from "fs";
554
+ import { dirname as dirname2, resolve } from "path";
430
555
  import { fileURLToPath } from "url";
431
556
  function getVersion() {
432
557
  try {
433
- const dir = dirname(fileURLToPath(import.meta.url));
558
+ const dir = dirname2(fileURLToPath(import.meta.url));
434
559
  const pkgPath = resolve(dir, "..", "package.json");
435
- const pkg = JSON.parse(readFileSync(pkgPath, "utf-8"));
560
+ const pkg = JSON.parse(readFileSync2(pkgPath, "utf-8"));
436
561
  return pkg.version;
437
562
  } catch {
438
563
  return "unknown";
@@ -444,10 +569,10 @@ var version_default = getVersion();
444
569
  import "dotenv/config";
445
570
 
446
571
  // src/check/index.ts
447
- import chalk12 from "chalk";
572
+ import chalk11 from "chalk";
448
573
 
449
574
  // src/check/checkTs.ts
450
- import chalk11 from "chalk";
575
+ import chalk10 from "chalk";
451
576
  import { execSync } from "child_process";
452
577
  function checkTs2() {
453
578
  try {
@@ -461,22 +586,22 @@ function checkTs2() {
461
586
  stdio: "inherit"
462
587
  });
463
588
  } catch {
464
- console.log(chalk11.red.bold("TypeScript compilation failed"));
589
+ console.log(chalk10.red.bold("TypeScript compilation failed"));
465
590
  process.exit(1);
466
591
  }
467
592
  }
468
593
 
469
594
  // src/check/index.ts
470
595
  async function check_default() {
471
- console.log(chalk12.bold(`Orionjs App ${chalk12.green(chalk12.bold("V4"))}
596
+ console.log(chalk11.bold(`Orionjs App ${chalk11.green(chalk11.bold("V4"))}
472
597
  `));
473
598
  console.log("Checking typescript...");
474
599
  checkTs2();
475
- console.log(chalk12.bold.green("Check passed\n"));
600
+ console.log(chalk11.bold.green("Check passed\n"));
476
601
  }
477
602
 
478
603
  // src/info.ts
479
- import chalk13 from "chalk";
604
+ import chalk12 from "chalk";
480
605
  import { execSync as execSync2 } from "child_process";
481
606
  function detectRuntime() {
482
607
  const runtimes = [];
@@ -489,21 +614,21 @@ function detectRuntime() {
489
614
  return runtimes.join(", ");
490
615
  }
491
616
  function info() {
492
- console.log(`Orion CLI v${version_default} \u2014 Available runtimes: ${chalk13.bold(detectRuntime())}`);
493
- console.log(`Default runtime: ${chalk13.bold("Bun")} (use --node flag to switch to Node.js)`);
617
+ console.log(`Orion CLI v${version_default} \u2014 Available runtimes: ${chalk12.bold(detectRuntime())}`);
618
+ console.log(`Default runtime: ${chalk12.bold("Bun")} (use --node flag to switch to Node.js)`);
494
619
  }
495
620
 
496
621
  // src/repl/index.ts
497
- import { readFileSync as readFileSync2 } from "fs";
622
+ import { readFileSync as readFileSync3 } from "fs";
498
623
  import { resolve as resolve2 } from "path";
499
- import chalk14 from "chalk";
624
+ import chalk13 from "chalk";
500
625
  function resolvePort(options) {
501
626
  if (options.port) {
502
627
  return Number(options.port);
503
628
  }
504
629
  try {
505
630
  const portFile = resolve2(process.cwd(), ".orion/port");
506
- const port = readFileSync2(portFile, "utf-8").trim();
631
+ const port = readFileSync3(portFile, "utf-8").trim();
507
632
  return Number(port);
508
633
  } catch {
509
634
  }
@@ -516,7 +641,7 @@ async function repl(options) {
516
641
  var _a;
517
642
  const expression = options.expression;
518
643
  if (!expression) {
519
- console.error(chalk14.red('Error: expression is required. Use -e "<expression>"'));
644
+ console.error(chalk13.red('Error: expression is required. Use -e "<expression>"'));
520
645
  process.exit(1);
521
646
  }
522
647
  const port = resolvePort(options);
@@ -528,9 +653,9 @@ async function repl(options) {
528
653
  });
529
654
  const data = await response.json();
530
655
  if (!data.success) {
531
- console.error(chalk14.red(`Error: ${data.error}`));
656
+ console.error(chalk13.red(`Error: ${data.error}`));
532
657
  if (data.stack) {
533
- console.error(chalk14.dim(data.stack));
658
+ console.error(chalk13.dim(data.stack));
534
659
  }
535
660
  process.exit(1);
536
661
  }
@@ -540,14 +665,15 @@ async function repl(options) {
540
665
  );
541
666
  }
542
667
  } catch (error) {
543
- if (error.code === "ECONNREFUSED" || ((_a = error.cause) == null ? void 0 : _a.code) === "ECONNREFUSED") {
668
+ const nodeError = error;
669
+ if (nodeError.code === "ECONNREFUSED" || ((_a = nodeError.cause) == null ? void 0 : _a.code) === "ECONNREFUSED") {
544
670
  console.error(
545
- chalk14.red(
671
+ chalk13.red(
546
672
  `Could not connect to dev server on port ${port}. Make sure "orion dev --repl" is running.`
547
673
  )
548
674
  );
549
675
  } else {
550
- console.error(chalk14.red(`Error: ${error.message}`));
676
+ console.error(chalk13.red(`Error: ${nodeError.message}`));
551
677
  }
552
678
  process.exit(1);
553
679
  }
@@ -559,10 +685,10 @@ var run = (action) => async (...args) => {
559
685
  try {
560
686
  await action(...args);
561
687
  } catch (e) {
562
- console.error(chalk15.red(`Error: ${e.message}`));
688
+ console.error(chalk14.red(`Error: ${e.message}`));
563
689
  }
564
690
  };
565
- 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));
566
692
  program.command("check").description("Runs a typescript check").action(run(check_default));
567
693
  program.command("build").description("Build the Orionjs app for production").option("--output [path]", "Path of the output file").action(run(build_default));
568
694
  program.command("prod").allowUnknownOption().option("--node", "Use Node.js runtime instead of Bun").option(