@bleedingdev/modern-js-plugin-ssg 3.9.0-ultramodern.2 → 3.9.0-ultramodern.20
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/cjs/libs/make.js +1 -1
- package/dist/cjs/libs/util.js +2 -3
- package/dist/esm/libs/make.mjs +1 -1
- package/dist/esm/libs/util.mjs +2 -3
- package/dist/esm-node/libs/make.mjs +1 -1
- package/dist/esm-node/libs/util.mjs +2 -3
- package/dist/types-esm/index.d.mts +3 -0
- package/dist/types-esm/libs/make.d.mts +5 -0
- package/dist/types-esm/libs/output.d.mts +2 -0
- package/dist/types-esm/libs/replace.d.mts +4 -0
- package/dist/types-esm/libs/util.d.mts +27 -0
- package/dist/types-esm/server/consts.d.mts +1 -0
- package/dist/types-esm/server/index.d.mts +4 -0
- package/dist/types-esm/server/prerender.d.mts +10 -0
- package/dist/types-esm/types.d.mts +23 -0
- package/package.json +18 -12
- package/rslib.config.mts +16 -2
package/dist/cjs/libs/make.js
CHANGED
|
@@ -62,7 +62,7 @@ function makeRoute(baseRoute, route, headers = {}) {
|
|
|
62
62
|
headers,
|
|
63
63
|
output: external_path_default().join(entryPath, `..${'/' === route ? '' : route}`)
|
|
64
64
|
};
|
|
65
|
-
return {
|
|
65
|
+
else return {
|
|
66
66
|
...baseRoute,
|
|
67
67
|
urlPath: external_normalize_path_default()(`${urlPath}${route.url}`) || '/',
|
|
68
68
|
headers: {
|
package/dist/cjs/libs/util.js
CHANGED
|
@@ -136,7 +136,7 @@ const standardOptions = (ssgOptions, entrypoints, routes, server, ssgByEntries)=
|
|
|
136
136
|
opt[entry.entryName] = ssgOptions;
|
|
137
137
|
return opt;
|
|
138
138
|
}, {});
|
|
139
|
-
if ('object' == typeof ssgOptions) {
|
|
139
|
+
else if ('object' == typeof ssgOptions) {
|
|
140
140
|
const isSingle = (0, utils_namespaceObject.isSingleEntry)(entrypoints);
|
|
141
141
|
if (isSingle) return {
|
|
142
142
|
main: ssgOptions
|
|
@@ -145,8 +145,7 @@ const standardOptions = (ssgOptions, entrypoints, routes, server, ssgByEntries)=
|
|
|
145
145
|
opt[entry.entryName] = ssgOptions;
|
|
146
146
|
return opt;
|
|
147
147
|
}, {});
|
|
148
|
-
}
|
|
149
|
-
if ('function' == typeof ssgOptions) {
|
|
148
|
+
} else if ('function' == typeof ssgOptions) {
|
|
150
149
|
const intermediateOptions = {};
|
|
151
150
|
for (const entrypoint of entrypoints){
|
|
152
151
|
const { entryName } = entrypoint;
|
package/dist/esm/libs/make.mjs
CHANGED
package/dist/esm/libs/util.mjs
CHANGED
|
@@ -83,7 +83,7 @@ const standardOptions = (ssgOptions, entrypoints, routes, server, ssgByEntries)=
|
|
|
83
83
|
opt[entry.entryName] = ssgOptions;
|
|
84
84
|
return opt;
|
|
85
85
|
}, {});
|
|
86
|
-
if ('object' == typeof ssgOptions) {
|
|
86
|
+
else if ('object' == typeof ssgOptions) {
|
|
87
87
|
const isSingle = isSingleEntry(entrypoints);
|
|
88
88
|
if (isSingle) return {
|
|
89
89
|
main: ssgOptions
|
|
@@ -92,8 +92,7 @@ const standardOptions = (ssgOptions, entrypoints, routes, server, ssgByEntries)=
|
|
|
92
92
|
opt[entry.entryName] = ssgOptions;
|
|
93
93
|
return opt;
|
|
94
94
|
}, {});
|
|
95
|
-
}
|
|
96
|
-
if ('function' == typeof ssgOptions) {
|
|
95
|
+
} else if ('function' == typeof ssgOptions) {
|
|
97
96
|
const intermediateOptions = {};
|
|
98
97
|
for (const entrypoint of entrypoints){
|
|
99
98
|
const { entryName } = entrypoint;
|
|
@@ -85,7 +85,7 @@ const standardOptions = (ssgOptions, entrypoints, routes, server, ssgByEntries)=
|
|
|
85
85
|
opt[entry.entryName] = ssgOptions;
|
|
86
86
|
return opt;
|
|
87
87
|
}, {});
|
|
88
|
-
if ('object' == typeof ssgOptions) {
|
|
88
|
+
else if ('object' == typeof ssgOptions) {
|
|
89
89
|
const isSingle = isSingleEntry(entrypoints);
|
|
90
90
|
if (isSingle) return {
|
|
91
91
|
main: ssgOptions
|
|
@@ -94,8 +94,7 @@ const standardOptions = (ssgOptions, entrypoints, routes, server, ssgByEntries)=
|
|
|
94
94
|
opt[entry.entryName] = ssgOptions;
|
|
95
95
|
return opt;
|
|
96
96
|
}, {});
|
|
97
|
-
}
|
|
98
|
-
if ('function' == typeof ssgOptions) {
|
|
97
|
+
} else if ('function' == typeof ssgOptions) {
|
|
99
98
|
const intermediateOptions = {};
|
|
100
99
|
for (const entrypoint of entrypoints){
|
|
101
100
|
const { entryName } = entrypoint;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { ServerRoute as ModernRoute } from '@modern-js/types';
|
|
2
|
+
import type { compile } from '../server/prerender.mjs';
|
|
3
|
+
import type { SSGRouteOptions, SsgRoute } from '../types.mjs';
|
|
4
|
+
export declare function makeRender(ssgRoutes: SsgRoute[], render: ReturnType<typeof compile>, port: number): Promise<string>[];
|
|
5
|
+
export declare function makeRoute(baseRoute: ModernRoute, route: string | SSGRouteOptions, headers?: Record<string, any>): SsgRoute;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { ServerRoute as ModernRoute } from '@modern-js/types';
|
|
2
|
+
import type { SsgRoute } from '../types.mjs';
|
|
3
|
+
export declare function exist(route: ModernRoute, pageRoutes: ModernRoute[]): number;
|
|
4
|
+
export declare function replaceRoute(ssgRoutes: SsgRoute[], pageRoutes: ModernRoute[]): ModernRoute[];
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { ServerUserConfig } from '@modern-js/app-tools';
|
|
2
|
+
import type { ServerRoute as ModernRoute } from '@modern-js/types';
|
|
3
|
+
import type { AgreedRoute, EntryPoint, SSGConfig, SSGMultiEntryOptions, SsgRoute } from '../types.mjs';
|
|
4
|
+
export declare function formatOutput(filename: string): string;
|
|
5
|
+
export declare function formatPath(str: string): string;
|
|
6
|
+
export declare function isDynamicUrl(url: string): boolean;
|
|
7
|
+
export declare function getUrlPrefix(route: SsgRoute, baseUrl: string | string[]): string;
|
|
8
|
+
export declare function getOutput(route: SsgRoute, base: string, agreed?: boolean): string;
|
|
9
|
+
export declare const readJSONSpec: (dir: string) => ModernRoute[];
|
|
10
|
+
export declare const writeJSONSpec: (dir: string, routes: ModernRoute[]) => void;
|
|
11
|
+
export declare const replaceWithAlias: (base: string, filePath: string, alias: string) => string;
|
|
12
|
+
export declare const standardOptions: (ssgOptions: SSGConfig, entrypoints: EntryPoint[], routes: ModernRoute[], server: ServerUserConfig, ssgByEntries?: SSGMultiEntryOptions) => false | SSGMultiEntryOptions;
|
|
13
|
+
export declare const openRouteSSR: (routes: ModernRoute[], entries?: string[]) => {
|
|
14
|
+
entryName?: string;
|
|
15
|
+
urlPath: string;
|
|
16
|
+
entryPath: string;
|
|
17
|
+
isSPA?: boolean;
|
|
18
|
+
isRSC?: boolean;
|
|
19
|
+
isStream?: boolean;
|
|
20
|
+
isApi?: boolean;
|
|
21
|
+
worker?: string;
|
|
22
|
+
responseHeaders?: Record<string, unknown>;
|
|
23
|
+
isSSR: boolean;
|
|
24
|
+
bundle: string;
|
|
25
|
+
}[];
|
|
26
|
+
export declare const flattenRoutes: (routes: AgreedRoute[]) => AgreedRoute[];
|
|
27
|
+
export declare function chunkArray<T>(arr: T[], size: number): T[][];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const CLOSE_SIGN = "modern_close_server";
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { AppNormalizedConfig, AppToolsContext } from '@modern-js/app-tools';
|
|
2
|
+
import type { ServerRoute as ModernRoute } from '@modern-js/types';
|
|
3
|
+
import type { SsgRoute } from '../types.mjs';
|
|
4
|
+
export declare const createServer: (appContext: AppToolsContext, ssgRoutes: SsgRoute[], pageRoutes: ModernRoute[], apiRoutes: ModernRoute[], options: AppNormalizedConfig) => Promise<string[]>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { NodeRequest, NodeResponse } from '@modern-js/types';
|
|
2
|
+
export type Options = {
|
|
3
|
+
url: string;
|
|
4
|
+
headers: {
|
|
5
|
+
host: string;
|
|
6
|
+
[key: string]: string;
|
|
7
|
+
};
|
|
8
|
+
[propName: string]: any;
|
|
9
|
+
};
|
|
10
|
+
export declare const compile: (requestHandler: (req: NodeRequest, res: NodeResponse) => void) => (options: Options, extend?: {}) => Promise<string>;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { ServerRoute as ModernRoute, SSGConfig, SSGMultiEntryOptions, SSGRouteOptions, SSGSingleEntryOptions } from '@modern-js/types';
|
|
2
|
+
export type { SSGConfig, SSGMultiEntryOptions, SSGRouteOptions, SSGSingleEntryOptions, };
|
|
3
|
+
export type AgreedRoute = {
|
|
4
|
+
path?: string;
|
|
5
|
+
component?: string;
|
|
6
|
+
_component?: string;
|
|
7
|
+
children?: AgreedRoute[];
|
|
8
|
+
exact?: boolean;
|
|
9
|
+
};
|
|
10
|
+
export type EntryPoint = {
|
|
11
|
+
entryName: string;
|
|
12
|
+
entry: string;
|
|
13
|
+
};
|
|
14
|
+
export type AgreedRouteMap = {
|
|
15
|
+
[propNames: string]: AgreedRoute[];
|
|
16
|
+
};
|
|
17
|
+
export type SsgRoute = ModernRoute & {
|
|
18
|
+
output: string;
|
|
19
|
+
headers?: Record<string, string>;
|
|
20
|
+
};
|
|
21
|
+
export type ExtendOutputConfig = {
|
|
22
|
+
ssg: SSGConfig;
|
|
23
|
+
};
|
package/package.json
CHANGED
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"modern",
|
|
18
18
|
"modern.js"
|
|
19
19
|
],
|
|
20
|
-
"version": "3.9.0-ultramodern.
|
|
20
|
+
"version": "3.9.0-ultramodern.20",
|
|
21
21
|
"types": "./dist/types/index.d.ts",
|
|
22
22
|
"main": "./dist/cjs/index.js",
|
|
23
23
|
"typesVersions": {
|
|
@@ -29,7 +29,10 @@
|
|
|
29
29
|
},
|
|
30
30
|
"exports": {
|
|
31
31
|
".": {
|
|
32
|
-
"types":
|
|
32
|
+
"types": {
|
|
33
|
+
"import": "./dist/types-esm/index.d.mts",
|
|
34
|
+
"default": "./dist/types/index.d.ts"
|
|
35
|
+
},
|
|
33
36
|
"node": {
|
|
34
37
|
"import": "./dist/esm-node/index.mjs",
|
|
35
38
|
"require": "./dist/cjs/index.js"
|
|
@@ -37,7 +40,10 @@
|
|
|
37
40
|
"default": "./dist/cjs/index.js"
|
|
38
41
|
},
|
|
39
42
|
"./cli": {
|
|
40
|
-
"types":
|
|
43
|
+
"types": {
|
|
44
|
+
"import": "./dist/types-esm/index.d.mts",
|
|
45
|
+
"default": "./dist/types/index.d.ts"
|
|
46
|
+
},
|
|
41
47
|
"node": {
|
|
42
48
|
"import": "./dist/esm-node/index.mjs",
|
|
43
49
|
"require": "./dist/cjs/index.js"
|
|
@@ -46,21 +52,21 @@
|
|
|
46
52
|
}
|
|
47
53
|
},
|
|
48
54
|
"dependencies": {
|
|
49
|
-
"@modern-js/prod-server": "npm:@bleedingdev/modern-js-prod-server@3.9.0-ultramodern.
|
|
50
|
-
"@modern-js/utils": "npm:@bleedingdev/modern-js-utils@3.9.0-ultramodern.
|
|
55
|
+
"@modern-js/prod-server": "npm:@bleedingdev/modern-js-prod-server@3.9.0-ultramodern.20",
|
|
56
|
+
"@modern-js/utils": "npm:@bleedingdev/modern-js-utils@3.9.0-ultramodern.20",
|
|
51
57
|
"@swc/helpers": "^0.5.23",
|
|
52
58
|
"node-mocks-http": "^1.18.1",
|
|
53
59
|
"normalize-path": "3.0.0"
|
|
54
60
|
},
|
|
55
61
|
"devDependencies": {
|
|
56
|
-
"@modern-js/app-tools": "npm:@bleedingdev/modern-js-app-tools@3.9.0-ultramodern.
|
|
57
|
-
"@modern-js/types": "npm:@bleedingdev/modern-js-types@3.9.0-ultramodern.
|
|
58
|
-
"@rslib/core": "1.0.
|
|
62
|
+
"@modern-js/app-tools": "npm:@bleedingdev/modern-js-app-tools@3.9.0-ultramodern.20",
|
|
63
|
+
"@modern-js/types": "npm:@bleedingdev/modern-js-types@3.9.0-ultramodern.20",
|
|
64
|
+
"@rslib/core": "1.0.2",
|
|
59
65
|
"@scripts/rstest-config": "2.66.0",
|
|
60
|
-
"@types/node": "^26.
|
|
66
|
+
"@types/node": "^26.6.2",
|
|
61
67
|
"@typescript/native-preview": "7.0.0-dev.20260707.2",
|
|
62
|
-
"react": "^19.
|
|
63
|
-
"react-dom": "^19.
|
|
68
|
+
"react": "^19.3.0",
|
|
69
|
+
"react-dom": "^19.3.0",
|
|
64
70
|
"typescript": "^7.0.2"
|
|
65
71
|
},
|
|
66
72
|
"sideEffects": false,
|
|
@@ -70,6 +76,6 @@
|
|
|
70
76
|
"scripts": {
|
|
71
77
|
"build": "rslib build",
|
|
72
78
|
"dev": "rslib build --watch",
|
|
73
|
-
"test": "rstest
|
|
79
|
+
"test": "rstest"
|
|
74
80
|
}
|
|
75
81
|
}
|
package/rslib.config.mts
CHANGED
|
@@ -1,4 +1,18 @@
|
|
|
1
|
-
import { rslibConfig } from '@modern-js/rslib';
|
|
1
|
+
import { rslibConfig, ts7DtsConfig } from '@modern-js/rslib';
|
|
2
2
|
import { defineConfig } from '@rslib/core';
|
|
3
3
|
|
|
4
|
-
export default defineConfig(
|
|
4
|
+
export default defineConfig({
|
|
5
|
+
...rslibConfig,
|
|
6
|
+
lib: rslibConfig.lib?.map(lib =>
|
|
7
|
+
lib.id === 'esm-node'
|
|
8
|
+
? {
|
|
9
|
+
...lib,
|
|
10
|
+
dts: {
|
|
11
|
+
...ts7DtsConfig,
|
|
12
|
+
autoExtension: true,
|
|
13
|
+
distPath: './dist/types-esm',
|
|
14
|
+
},
|
|
15
|
+
}
|
|
16
|
+
: lib,
|
|
17
|
+
),
|
|
18
|
+
});
|