@ereo/cli 0.1.29 → 0.1.32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../../src/commands/build.ts"],"names":[],"mappings":"AAAA;;;;GAIG;
|
|
1
|
+
{"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../../src/commands/build.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAOH;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED;;GAEG;AACH,wBAAsB,KAAK,CAAC,OAAO,GAAE,mBAAwB,GAAG,OAAO,CAAC,IAAI,CAAC,CAwC5E"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deploy.d.ts","sourceRoot":"","sources":["../../src/commands/deploy.ts"],"names":[],"mappings":"AAAA;;;;GAIG;
|
|
1
|
+
{"version":3,"file":"deploy.d.ts","sourceRoot":"","sources":["../../src/commands/deploy.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAMH;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG,QAAQ,GAAG,YAAY,GAAG,KAAK,GAAG,SAAS,GAAG,QAAQ,CAAC;AAElF;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,sBAAsB;IACtB,MAAM,CAAC,EAAE,YAAY,CAAC;IACtB,6BAA6B;IAC7B,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,sBAAsB;IACtB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,sCAAsC;IACtC,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,4BAA4B;IAC5B,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC7B,yCAAyC;IACzC,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,OAAO,CAAC;IACjB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;GAEG;AACH,wBAAsB,MAAM,CAAC,OAAO,GAAE,aAAkB,GAAG,OAAO,CAAC,YAAY,CAAC,CAiD/E;AA0bD;;GAEG;AACH,wBAAgB,eAAe,IAAI,IAAI,CAuBtC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dev.d.ts","sourceRoot":"","sources":["../../src/commands/dev.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAqBH;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,+CAA+C;IAC/C,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;
|
|
1
|
+
{"version":3,"file":"dev.d.ts","sourceRoot":"","sources":["../../src/commands/dev.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAqBH;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,+CAA+C;IAC/C,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED;;GAEG;AACH,wBAAsB,GAAG,CAAC,OAAO,GAAE,UAAe,GAAG,OAAO,CAAC,IAAI,CAAC,CA8PjE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"start.d.ts","sourceRoot":"","sources":["../../src/commands/start.ts"],"names":[],"mappings":"AAAA;;;;GAIG;
|
|
1
|
+
{"version":3,"file":"start.d.ts","sourceRoot":"","sources":["../../src/commands/start.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAQH;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED;;GAEG;AACH,wBAAsB,KAAK,CAAC,OAAO,GAAE,YAAiB,GAAG,OAAO,CAAC,IAAI,CAAC,CA6ErE"}
|
package/dist/config.d.ts
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @ereo/cli - Config Resolution
|
|
3
|
+
*
|
|
4
|
+
* Shared config file resolution for all CLI commands.
|
|
5
|
+
* Supports ereo.config.{ts,js,mts,mjs} with proper fallback.
|
|
6
|
+
*/
|
|
7
|
+
import type { FrameworkConfig } from '@ereo/core';
|
|
8
|
+
/**
|
|
9
|
+
* Resolve and load the ereo config file from the project root.
|
|
10
|
+
*
|
|
11
|
+
* Tries ereo.config.{ts,js,mts,mjs} in order.
|
|
12
|
+
* Returns the loaded config and the resolved path (if found).
|
|
13
|
+
*/
|
|
14
|
+
export declare function loadConfig(root: string): Promise<{
|
|
15
|
+
config: FrameworkConfig;
|
|
16
|
+
configPath: string | null;
|
|
17
|
+
}>;
|
|
18
|
+
//# sourceMappingURL=config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAOlD;;;;;GAKG;AACH,wBAAsB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC;IACtD,MAAM,EAAE,eAAe,CAAC;IACxB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;CAC3B,CAAC,CAgBD"}
|
package/dist/index.js
CHANGED
|
@@ -11,6 +11,30 @@ var __export = (target, all) => {
|
|
|
11
11
|
});
|
|
12
12
|
};
|
|
13
13
|
var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
|
|
14
|
+
var __require = import.meta.require;
|
|
15
|
+
|
|
16
|
+
// src/config.ts
|
|
17
|
+
import { join } from "path";
|
|
18
|
+
async function loadConfig(root) {
|
|
19
|
+
for (const ext of CONFIG_EXTENSIONS) {
|
|
20
|
+
const configPath = join(root, `ereo.config${ext}`);
|
|
21
|
+
try {
|
|
22
|
+
if (await Bun.file(configPath).exists()) {
|
|
23
|
+
const configModule = await import(configPath);
|
|
24
|
+
const config = configModule.default || configModule;
|
|
25
|
+
return { config, configPath };
|
|
26
|
+
}
|
|
27
|
+
} catch (error) {
|
|
28
|
+
console.warn(`Could not load config (${configPath}):`, error);
|
|
29
|
+
return { config: {}, configPath: null };
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
return { config: {}, configPath: null };
|
|
33
|
+
}
|
|
34
|
+
var CONFIG_EXTENSIONS;
|
|
35
|
+
var init_config = __esm(() => {
|
|
36
|
+
CONFIG_EXTENSIONS = [".ts", ".js", ".mts", ".mjs"];
|
|
37
|
+
});
|
|
14
38
|
|
|
15
39
|
// ../trace/src/span.ts
|
|
16
40
|
function randomHex(len) {
|
|
@@ -309,8 +333,10 @@ class TracerImpl {
|
|
|
309
333
|
activeTrace.spans.set(spanData.id, spanData);
|
|
310
334
|
}
|
|
311
335
|
activeTrace.activeSpanCount--;
|
|
336
|
+
if (activeTrace.activeSpanCount < 0)
|
|
337
|
+
activeTrace.activeSpanCount = 0;
|
|
312
338
|
this.emit({ type: "span:end", span: spanData });
|
|
313
|
-
if (activeTrace.activeSpanCount
|
|
339
|
+
if (activeTrace.activeSpanCount === 0) {
|
|
314
340
|
this.finalizeTrace(activeTrace);
|
|
315
341
|
}
|
|
316
342
|
}
|
|
@@ -1409,23 +1435,13 @@ var exports_build = {};
|
|
|
1409
1435
|
__export(exports_build, {
|
|
1410
1436
|
build: () => build
|
|
1411
1437
|
});
|
|
1412
|
-
import { join as join2 } from "path";
|
|
1413
1438
|
import { build as bundlerBuild, printBuildReport } from "@ereo/bundler";
|
|
1414
1439
|
async function build(options = {}) {
|
|
1415
1440
|
const root = process.cwd();
|
|
1416
1441
|
console.log(`
|
|
1417
1442
|
\x1B[36m\u2B21\x1B[0m \x1B[1mEreo\x1B[0m Production Build
|
|
1418
1443
|
`);
|
|
1419
|
-
|
|
1420
|
-
const configPath = join2(root, "ereo.config.ts");
|
|
1421
|
-
try {
|
|
1422
|
-
if (await Bun.file(configPath).exists()) {
|
|
1423
|
-
const configModule = await import(configPath);
|
|
1424
|
-
config = configModule.default || configModule;
|
|
1425
|
-
}
|
|
1426
|
-
} catch (error) {
|
|
1427
|
-
console.warn("Could not load config:", error);
|
|
1428
|
-
}
|
|
1444
|
+
const { config } = await loadConfig(root);
|
|
1429
1445
|
const configTarget = config.build?.target || "bun";
|
|
1430
1446
|
const bundlerTarget = ["bun", "node", "browser"].includes(configTarget) ? configTarget : "bun";
|
|
1431
1447
|
const buildOptions = {
|
|
@@ -1456,10 +1472,13 @@ async function build(options = {}) {
|
|
|
1456
1472
|
process.exit(1);
|
|
1457
1473
|
}
|
|
1458
1474
|
}
|
|
1459
|
-
var init_build = () => {
|
|
1475
|
+
var init_build = __esm(() => {
|
|
1476
|
+
init_config();
|
|
1477
|
+
});
|
|
1460
1478
|
|
|
1461
1479
|
// src/commands/dev.ts
|
|
1462
|
-
|
|
1480
|
+
init_config();
|
|
1481
|
+
import { join as join2 } from "path";
|
|
1463
1482
|
import {
|
|
1464
1483
|
createApp,
|
|
1465
1484
|
setupEnv
|
|
@@ -1474,22 +1493,13 @@ import {
|
|
|
1474
1493
|
ERROR_OVERLAY_SCRIPT
|
|
1475
1494
|
} from "@ereo/bundler";
|
|
1476
1495
|
async function dev(options = {}) {
|
|
1477
|
-
const port = options.port || 3000;
|
|
1478
|
-
const hostname = options.host || "localhost";
|
|
1479
1496
|
const root = process.cwd();
|
|
1480
1497
|
console.log(`
|
|
1481
1498
|
\x1B[36m\u2B21\x1B[0m \x1B[1mEreo\x1B[0m Dev Server
|
|
1482
1499
|
`);
|
|
1483
|
-
|
|
1484
|
-
const
|
|
1485
|
-
|
|
1486
|
-
if (await Bun.file(configPath).exists()) {
|
|
1487
|
-
const configModule = await import(configPath);
|
|
1488
|
-
config = configModule.default || configModule;
|
|
1489
|
-
}
|
|
1490
|
-
} catch (error) {
|
|
1491
|
-
console.warn("Could not load config:", error);
|
|
1492
|
-
}
|
|
1500
|
+
const { config, configPath } = await loadConfig(root);
|
|
1501
|
+
const port = options.port || config.server?.port || 3000;
|
|
1502
|
+
const hostname = options.host || config.server?.hostname || "localhost";
|
|
1493
1503
|
if (config.env) {
|
|
1494
1504
|
console.log(" \x1B[2mLoading environment variables...\x1B[0m");
|
|
1495
1505
|
const envResult = await setupEnv(root, config.env, "development");
|
|
@@ -1506,10 +1516,10 @@ async function dev(options = {}) {
|
|
|
1506
1516
|
config: {
|
|
1507
1517
|
...config,
|
|
1508
1518
|
server: {
|
|
1519
|
+
...config.server,
|
|
1509
1520
|
port,
|
|
1510
1521
|
hostname,
|
|
1511
|
-
development: true
|
|
1512
|
-
...config.server
|
|
1522
|
+
development: true
|
|
1513
1523
|
}
|
|
1514
1524
|
}
|
|
1515
1525
|
});
|
|
@@ -1520,7 +1530,18 @@ async function dev(options = {}) {
|
|
|
1520
1530
|
await router.loadAllModules();
|
|
1521
1531
|
const hmr = createHMRServer();
|
|
1522
1532
|
const hmrWatcher = createHMRWatcher(hmr);
|
|
1523
|
-
hmrWatcher.watch(
|
|
1533
|
+
hmrWatcher.watch(join2(root, "app"));
|
|
1534
|
+
if (configPath) {
|
|
1535
|
+
const { watch } = await import("fs");
|
|
1536
|
+
let configDebounce = null;
|
|
1537
|
+
watch(configPath, () => {
|
|
1538
|
+
if (configDebounce)
|
|
1539
|
+
clearTimeout(configDebounce);
|
|
1540
|
+
configDebounce = setTimeout(() => {
|
|
1541
|
+
console.log("\x1B[33m\u27F3\x1B[0m Config changed \u2014 restart the dev server to apply changes.");
|
|
1542
|
+
}, 200);
|
|
1543
|
+
});
|
|
1544
|
+
}
|
|
1524
1545
|
router.on("reload", async () => {
|
|
1525
1546
|
console.log("\x1B[33m\u27F3\x1B[0m Routes reloaded");
|
|
1526
1547
|
await router.loadAllModules();
|
|
@@ -1672,6 +1693,7 @@ async function dev(options = {}) {
|
|
|
1672
1693
|
init_build();
|
|
1673
1694
|
|
|
1674
1695
|
// src/commands/start.ts
|
|
1696
|
+
init_config();
|
|
1675
1697
|
import { join as join3 } from "path";
|
|
1676
1698
|
import { createApp as createApp2 } from "@ereo/core";
|
|
1677
1699
|
import { initFileRouter as initFileRouter2 } from "@ereo/router";
|
|
@@ -1688,14 +1710,7 @@ async function start(options = {}) {
|
|
|
1688
1710
|
process.exit(1);
|
|
1689
1711
|
}
|
|
1690
1712
|
const manifest = await Bun.file(manifestPath).json();
|
|
1691
|
-
|
|
1692
|
-
const configPath = join3(root, "ereo.config.ts");
|
|
1693
|
-
try {
|
|
1694
|
-
if (await Bun.file(configPath).exists()) {
|
|
1695
|
-
const configModule = await import(configPath);
|
|
1696
|
-
config = configModule.default || configModule;
|
|
1697
|
-
}
|
|
1698
|
-
} catch {}
|
|
1713
|
+
const { config } = await loadConfig(root);
|
|
1699
1714
|
const port = options.port || config.server?.port || 3000;
|
|
1700
1715
|
const hostname = options.host || config.server?.hostname || "0.0.0.0";
|
|
1701
1716
|
const app = createApp2({
|
|
@@ -2780,6 +2795,7 @@ export async function action({ request, context }${typescript ? ": ActionArgs" :
|
|
|
2780
2795
|
}
|
|
2781
2796
|
|
|
2782
2797
|
// src/commands/deploy.ts
|
|
2798
|
+
init_config();
|
|
2783
2799
|
import { join as join5 } from "path";
|
|
2784
2800
|
async function deploy(options = {}) {
|
|
2785
2801
|
const root = process.cwd();
|
|
@@ -2789,16 +2805,7 @@ async function deploy(options = {}) {
|
|
|
2789
2805
|
`);
|
|
2790
2806
|
console.log(` Target: \x1B[33m${target}\x1B[0m
|
|
2791
2807
|
`);
|
|
2792
|
-
|
|
2793
|
-
const configPath = join5(root, "ereo.config.ts");
|
|
2794
|
-
try {
|
|
2795
|
-
if (await Bun.file(configPath).exists()) {
|
|
2796
|
-
const configModule = await import(configPath);
|
|
2797
|
-
config = configModule.default || configModule;
|
|
2798
|
-
}
|
|
2799
|
-
} catch (error) {
|
|
2800
|
-
console.warn("Could not load config:", error);
|
|
2801
|
-
}
|
|
2808
|
+
const { config } = await loadConfig(root);
|
|
2802
2809
|
if (options.build !== false) {
|
|
2803
2810
|
console.log(" \x1B[2mBuilding for production...\x1B[0m");
|
|
2804
2811
|
const { build: build2 } = await Promise.resolve().then(() => (init_build(), exports_build));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ereo/cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.32",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"author": "Ereo Team",
|
|
6
6
|
"homepage": "https://ereo.dev",
|
|
@@ -35,11 +35,11 @@
|
|
|
35
35
|
"typecheck": "tsc --noEmit"
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@ereo/core": "^0.1.
|
|
39
|
-
"@ereo/router": "^0.1.
|
|
40
|
-
"@ereo/server": "^0.1.
|
|
41
|
-
"@ereo/bundler": "^0.1.
|
|
42
|
-
"@ereo/trace": "^0.1.
|
|
38
|
+
"@ereo/core": "^0.1.32",
|
|
39
|
+
"@ereo/router": "^0.1.32",
|
|
40
|
+
"@ereo/server": "^0.1.32",
|
|
41
|
+
"@ereo/bundler": "^0.1.32",
|
|
42
|
+
"@ereo/trace": "^0.1.32"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
45
|
"@types/bun": "^1.1.0",
|