@esmx/core 3.0.0-rc.60 → 3.0.0-rc.63
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/README.md +4 -4
- package/README.zh-CN.md +4 -4
- package/dist/app.d.ts +27 -27
- package/dist/core.d.ts +274 -272
- package/dist/core.mjs +235 -232
- package/dist/pack-config.d.ts +92 -92
- package/dist/render-context.d.ts +465 -465
- package/dist/render-context.mjs +338 -338
- package/dist/utils/cache.d.ts +15 -15
- package/dist/utils/import-map.d.ts +31 -1
- package/dist/utils/import-map.mjs +18 -0
- package/dist/utils/import-map.test.mjs +577 -1
- package/dist/utils/middleware.d.ts +19 -19
- package/dist/utils/static-import-lexer.d.ts +12 -12
- package/dist/utils/static-import-lexer.mjs +1 -1
- package/package.json +3 -3
- package/src/app.ts +34 -34
- package/src/core.ts +320 -317
- package/src/pack-config.ts +92 -92
- package/src/render-context.ts +465 -465
- package/src/utils/cache.ts +15 -15
- package/src/utils/import-map.test.ts +713 -1
- package/src/utils/import-map.ts +53 -1
- package/src/utils/middleware.ts +19 -19
- package/src/utils/static-import-lexer.ts +18 -18
package/README.md
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<div align="center">
|
|
2
|
-
<img src="https://
|
|
2
|
+
<img src="https://esmx.dev/logo.svg?t=2025" width="120" alt="Esmx Logo" />
|
|
3
3
|
<h1>@esmx/core</h1>
|
|
4
4
|
|
|
5
5
|
<div>
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
<a href="https://github.com/esmnext/esmx/actions/workflows/build.yml">
|
|
10
10
|
<img src="https://github.com/esmnext/esmx/actions/workflows/build.yml/badge.svg" alt="Build" />
|
|
11
11
|
</a>
|
|
12
|
-
<a href="https://
|
|
12
|
+
<a href="https://esmx.dev/coverage/">
|
|
13
13
|
<img src="https://img.shields.io/badge/coverage-live%20report-brightgreen" alt="Coverage Report" />
|
|
14
14
|
</a>
|
|
15
15
|
<a href="https://nodejs.org/">
|
|
@@ -47,11 +47,11 @@ npm install @esmx/core
|
|
|
47
47
|
npm install @esmx/core
|
|
48
48
|
```
|
|
49
49
|
|
|
50
|
-
For detailed usage examples and configuration options, please visit the [official documentation](https://
|
|
50
|
+
For detailed usage examples and configuration options, please visit the [official documentation](https://esmx.dev).
|
|
51
51
|
|
|
52
52
|
## 📚 Documentation
|
|
53
53
|
|
|
54
|
-
Visit the [official documentation](https://
|
|
54
|
+
Visit the [official documentation](https://esmx.dev) for detailed usage guides and API reference.
|
|
55
55
|
|
|
56
56
|
## 📄 License
|
|
57
57
|
|
package/README.zh-CN.md
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<div align="center">
|
|
2
|
-
<img src="https://
|
|
2
|
+
<img src="https://esmx.dev/logo.svg?t=2025" width="120" alt="Esmx Logo" />
|
|
3
3
|
<h1>@esmx/core</h1>
|
|
4
4
|
|
|
5
5
|
<div>
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
<a href="https://github.com/esmnext/esmx/actions/workflows/build.yml">
|
|
10
10
|
<img src="https://github.com/esmnext/esmx/actions/workflows/build.yml/badge.svg" alt="Build" />
|
|
11
11
|
</a>
|
|
12
|
-
<a href="https://
|
|
12
|
+
<a href="https://esmx.dev/coverage/">
|
|
13
13
|
<img src="https://img.shields.io/badge/coverage-live%20report-brightgreen" alt="Coverage Report" />
|
|
14
14
|
</a>
|
|
15
15
|
<a href="https://nodejs.org/">
|
|
@@ -47,11 +47,11 @@ npm install @esmx/core
|
|
|
47
47
|
npm install @esmx/core
|
|
48
48
|
```
|
|
49
49
|
|
|
50
|
-
详细的使用示例和配置选项,请访问[官方文档](https://
|
|
50
|
+
详细的使用示例和配置选项,请访问[官方文档](https://esmx.dev)。
|
|
51
51
|
|
|
52
52
|
## 📚 文档
|
|
53
53
|
|
|
54
|
-
访问[官方文档](https://
|
|
54
|
+
访问[官方文档](https://esmx.dev)获取详细的使用指南和 API 参考。
|
|
55
55
|
|
|
56
56
|
## 📄 许可证
|
|
57
57
|
|
package/dist/app.d.ts
CHANGED
|
@@ -2,21 +2,21 @@ import type { COMMAND, Esmx } from './core';
|
|
|
2
2
|
import { RenderContext, type RenderContextOptions } from './render-context';
|
|
3
3
|
import { type Middleware } from './utils/middleware';
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
5
|
+
* Application instance interface.
|
|
6
6
|
*
|
|
7
|
-
* App
|
|
8
|
-
*
|
|
7
|
+
* App is the application abstraction of the Esmx framework, providing a unified interface
|
|
8
|
+
* to manage application lifecycle, static assets, and server-side rendering.
|
|
9
9
|
*
|
|
10
10
|
* @example
|
|
11
11
|
* ```ts
|
|
12
12
|
* // entry.node.ts
|
|
13
13
|
* export default {
|
|
14
|
-
* //
|
|
14
|
+
* // Development environment configuration
|
|
15
15
|
* async devApp(esmx) {
|
|
16
16
|
* return import('@esmx/rspack').then((m) =>
|
|
17
17
|
* m.createRspackHtmlApp(esmx, {
|
|
18
18
|
* config(rc) {
|
|
19
|
-
* //
|
|
19
|
+
* // Custom Rspack configuration
|
|
20
20
|
* }
|
|
21
21
|
* })
|
|
22
22
|
* );
|
|
@@ -26,17 +26,17 @@ import { type Middleware } from './utils/middleware';
|
|
|
26
26
|
*/
|
|
27
27
|
export interface App {
|
|
28
28
|
/**
|
|
29
|
-
*
|
|
29
|
+
* Static asset processing middleware.
|
|
30
30
|
*
|
|
31
|
-
*
|
|
32
|
-
* -
|
|
33
|
-
* -
|
|
34
|
-
* -
|
|
31
|
+
* Development environment:
|
|
32
|
+
* - Handles static asset requests from source code
|
|
33
|
+
* - Supports real-time compilation and hot reloading
|
|
34
|
+
* - Uses no-cache strategy
|
|
35
35
|
*
|
|
36
|
-
*
|
|
37
|
-
* -
|
|
38
|
-
* -
|
|
39
|
-
* -
|
|
36
|
+
* Production environment:
|
|
37
|
+
* - Handles built static assets
|
|
38
|
+
* - Supports long-term caching for immutable files (.final.xxx)
|
|
39
|
+
* - Optimized asset loading strategy
|
|
40
40
|
*
|
|
41
41
|
* @example
|
|
42
42
|
* ```ts
|
|
@@ -45,14 +45,14 @@ export interface App {
|
|
|
45
45
|
*/
|
|
46
46
|
middleware: Middleware;
|
|
47
47
|
/**
|
|
48
|
-
*
|
|
48
|
+
* Server-side rendering function.
|
|
49
49
|
*
|
|
50
|
-
*
|
|
51
|
-
* -
|
|
52
|
-
* -
|
|
50
|
+
* Provides different implementations based on the runtime environment:
|
|
51
|
+
* - Production environment (start): Loads the built server entry file (entry.server) to execute rendering
|
|
52
|
+
* - Development environment (dev): Loads the server entry file from source code to execute rendering
|
|
53
53
|
*
|
|
54
|
-
* @param options -
|
|
55
|
-
* @returns
|
|
54
|
+
* @param options - Rendering options
|
|
55
|
+
* @returns Returns the rendering context containing the rendering result
|
|
56
56
|
*
|
|
57
57
|
* @example
|
|
58
58
|
* ```ts
|
|
@@ -64,21 +64,21 @@ export interface App {
|
|
|
64
64
|
*/
|
|
65
65
|
render: (options?: RenderContextOptions) => Promise<RenderContext>;
|
|
66
66
|
/**
|
|
67
|
-
*
|
|
68
|
-
*
|
|
67
|
+
* Production environment build function.
|
|
68
|
+
* Used for asset packaging and optimization.
|
|
69
69
|
*
|
|
70
|
-
* @returns
|
|
70
|
+
* @returns Returns true for successful build, false for failed build
|
|
71
71
|
*/
|
|
72
72
|
build?: () => Promise<boolean>;
|
|
73
73
|
/**
|
|
74
|
-
*
|
|
75
|
-
*
|
|
74
|
+
* Resource cleanup function.
|
|
75
|
+
* Used for shutting down servers, disconnecting connections, etc.
|
|
76
76
|
*
|
|
77
|
-
* @returns
|
|
77
|
+
* @returns Returns true for successful cleanup, false for failed cleanup
|
|
78
78
|
*/
|
|
79
79
|
destroy?: () => Promise<boolean>;
|
|
80
80
|
}
|
|
81
81
|
/**
|
|
82
|
-
*
|
|
82
|
+
* Create an application instance for production environment, not available in development environment.
|
|
83
83
|
*/
|
|
84
84
|
export declare function createApp(esmx: Esmx, command: COMMAND): Promise<App>;
|