@esmx/core 3.0.0-rc.13 → 3.0.0-rc.16

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/cli/cli.mjs CHANGED
@@ -1,6 +1,8 @@
1
1
  import module from "node:module";
2
2
  import path from "node:path";
3
3
  import { fileURLToPath } from "node:url";
4
+ import { styleText } from "node:util";
5
+ import pkg from "../../package.json" with { type: "json" };
4
6
  import { COMMAND, Esmx } from "../esmx.mjs";
5
7
  async function getSrcOptions() {
6
8
  return import(path.resolve(process.cwd(), "./src/entry.node.ts")).then(
@@ -8,6 +10,8 @@ async function getSrcOptions() {
8
10
  );
9
11
  }
10
12
  export async function cli(command) {
13
+ console.log(`\u{1F525} ${styleText("yellow", "Esmx")} v${pkg.version}
14
+ `);
11
15
  if (command !== COMMAND.dev) {
12
16
  process.env.NODE_ENV = "production";
13
17
  }
@@ -1,3 +1,8 @@
1
1
  #!/usr/bin/env node --no-warnings --experimental-vm-modules --experimental-import-meta-resolve --experimental-strip-types
2
+ import { enableCompileCache } from "node:module";
3
+ try {
4
+ enableCompileCache();
5
+ } catch {
6
+ }
2
7
  import { cli } from "./cli.mjs";
3
8
  cli(process.argv.slice(2)[0] || "");
package/dist/esmx.mjs CHANGED
@@ -359,10 +359,13 @@ export class Esmx {
359
359
  */
360
360
  async build() {
361
361
  const startTime = Date.now();
362
- console.log("[esmx]: build start");
363
362
  const successful = await this.readied.app.build?.();
364
363
  const endTime = Date.now();
365
- console.log(`[esmx]: build end, cost: ${endTime - startTime}ms`);
364
+ const duration = endTime - startTime;
365
+ const status = successful ? "\x1B[32m\u2713\x1B[0m".padEnd(3) : "\x1B[31m\u2717\x1B[0m".padEnd(3);
366
+ console.log(
367
+ `${status.padEnd(2)} Build ${successful ? "completed" : "failed"} in ${duration}ms`
368
+ );
366
369
  return successful ?? true;
367
370
  }
368
371
  /**
package/package.json CHANGED
@@ -48,7 +48,7 @@
48
48
  "esmx": "./dist/cli/index.mjs"
49
49
  },
50
50
  "engines": {
51
- "node": ">=22.6"
51
+ "node": ">=22.11.0"
52
52
  },
53
53
  "scripts": {
54
54
  "lint:js": "biome check --write --no-errors-on-unmatched",
@@ -59,7 +59,7 @@
59
59
  "build": "unbuild"
60
60
  },
61
61
  "dependencies": {
62
- "@esmx/import": "3.0.0-rc.13",
62
+ "@esmx/import": "3.0.0-rc.16",
63
63
  "@types/serialize-javascript": "^5.0.4",
64
64
  "es-module-lexer": "^1.6.0",
65
65
  "find": "^0.3.0",
@@ -69,7 +69,7 @@
69
69
  },
70
70
  "devDependencies": {
71
71
  "@biomejs/biome": "1.9.4",
72
- "@esmx/lint": "3.0.0-rc.13",
72
+ "@esmx/lint": "3.0.0-rc.16",
73
73
  "@gez/lint": "3.0.0-rc.9",
74
74
  "@types/find": "^0.2.4",
75
75
  "@types/node": "22.13.10",
@@ -81,7 +81,7 @@
81
81
  "unbuild": "2.0.0",
82
82
  "vitest": "3.0.8"
83
83
  },
84
- "version": "3.0.0-rc.13",
84
+ "version": "3.0.0-rc.16",
85
85
  "type": "module",
86
86
  "private": false,
87
87
  "exports": {
@@ -104,5 +104,5 @@
104
104
  "template",
105
105
  "public"
106
106
  ],
107
- "gitHead": "801082f89364db5e1137431e3cc1121f689fa7ca"
107
+ "gitHead": "4d3c88e6751289b4045bffd496859afeb52a5901"
108
108
  }
package/src/cli/cli.ts CHANGED
@@ -1,6 +1,9 @@
1
1
  import module from 'node:module';
2
2
  import path from 'node:path';
3
3
  import { fileURLToPath } from 'node:url';
4
+ import { styleText } from 'node:util';
5
+ import pkg from '../../package.json' with { type: 'json' };
6
+
4
7
  import { COMMAND, Esmx, type EsmxOptions } from '../esmx';
5
8
 
6
9
  async function getSrcOptions(): Promise<EsmxOptions> {
@@ -10,6 +13,8 @@ async function getSrcOptions(): Promise<EsmxOptions> {
10
13
  }
11
14
 
12
15
  export async function cli(command: string) {
16
+ console.log(`🔥 ${styleText('yellow', 'Esmx')} v${pkg.version}
17
+ `);
13
18
  if (command !== COMMAND.dev) {
14
19
  process.env.NODE_ENV = 'production';
15
20
  }
package/src/cli/index.ts CHANGED
@@ -1,5 +1,11 @@
1
1
  #!/usr/bin/env node --no-warnings --experimental-vm-modules --experimental-import-meta-resolve --experimental-strip-types
2
+ import { enableCompileCache } from 'node:module';
2
3
 
4
+ try {
5
+ enableCompileCache();
6
+ } catch {
7
+ // ignore errors
8
+ }
3
9
  import { cli } from './cli';
4
10
 
5
11
  cli(process.argv.slice(2)[0] || '');
package/src/esmx.ts CHANGED
@@ -507,12 +507,17 @@ export class Esmx {
507
507
  */
508
508
  public async build(): Promise<boolean> {
509
509
  const startTime = Date.now();
510
- console.log('[esmx]: build start');
511
510
 
512
511
  const successful = await this.readied.app.build?.();
513
512
 
514
513
  const endTime = Date.now();
515
- console.log(`[esmx]: build end, cost: ${endTime - startTime}ms`);
514
+ const duration = endTime - startTime;
515
+ const status = successful
516
+ ? '\x1b[32m✓\x1b[0m'.padEnd(3)
517
+ : '\x1b[31m✗\x1b[0m'.padEnd(3);
518
+ console.log(
519
+ `${status.padEnd(2)} Build ${successful ? 'completed' : 'failed'} in ${duration}ms`
520
+ );
516
521
 
517
522
  return successful ?? true;
518
523
  }
@@ -65,7 +65,6 @@ export function createMiddleware(esmx: Esmx): Middleware {
65
65
  const base = `/${item.name}/`;
66
66
  const baseUrl = new URL(`file:`);
67
67
  const root = path.resolve(item.root, 'client');
68
- // const reFinal = /\.final\.[a-zA-Z0-9]+$/;
69
68
  return (req, res, next) => {
70
69
  const url = req.url ?? '/';
71
70
  const { pathname } = new URL(req.url ?? '/', baseUrl);