@esmx/core 3.0.0-rc.59 → 3.0.0-rc.62
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/app.d.ts +27 -27
- package/dist/core.d.ts +274 -272
- package/dist/core.mjs +237 -235
- package/dist/index.d.ts +3 -3
- package/dist/index.mjs +0 -6
- package/dist/manifest-json.d.ts +8 -21
- package/dist/module-config.d.ts +39 -144
- package/dist/module-config.mjs +145 -57
- package/dist/module-config.test.mjs +620 -509
- package/dist/pack-config.d.ts +94 -94
- 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 +9 -5
- package/dist/utils/import-map.mjs +36 -23
- package/dist/utils/import-map.test.mjs +1139 -103
- 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 +323 -320
- package/src/index.ts +14 -9
- package/src/manifest-json.ts +8 -22
- package/src/module-config.test.ts +636 -637
- package/src/module-config.ts +242 -257
- package/src/pack-config.ts +94 -94
- package/src/render-context.ts +465 -465
- package/src/utils/cache.ts +15 -15
- package/src/utils/import-map.test.ts +1207 -110
- package/src/utils/import-map.ts +63 -29
- package/src/utils/middleware.ts +19 -19
- package/src/utils/static-import-lexer.ts +18 -18
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>;
|