@modern-js/plugin-ssg 2.69.5 → 3.0.0-alpha.0
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/index.js +130 -156
- package/dist/cjs/libs/make.js +69 -62
- package/dist/cjs/libs/output.js +50 -44
- package/dist/cjs/libs/replace.js +68 -64
- package/dist/cjs/libs/util.js +200 -182
- package/dist/cjs/server/consts.js +33 -25
- package/dist/cjs/server/index.js +137 -92
- package/dist/cjs/server/prerender.js +72 -68
- package/dist/cjs/types.js +17 -15
- package/dist/esm/index.mjs +89 -0
- package/dist/esm/libs/make.mjs +31 -0
- package/dist/esm/libs/output.mjs +11 -0
- package/dist/esm/libs/replace.mjs +28 -0
- package/dist/esm/libs/util.mjs +147 -0
- package/dist/esm/server/consts.mjs +2 -0
- package/dist/esm/server/index.mjs +97 -0
- package/dist/esm/server/prerender.mjs +30 -0
- package/dist/esm-node/index.mjs +89 -0
- package/dist/esm-node/libs/make.mjs +31 -0
- package/dist/esm-node/libs/output.mjs +11 -0
- package/dist/esm-node/libs/replace.mjs +28 -0
- package/dist/esm-node/libs/util.mjs +147 -0
- package/dist/esm-node/server/consts.mjs +2 -0
- package/dist/esm-node/server/index.mjs +97 -0
- package/dist/esm-node/server/prerender.mjs +30 -0
- package/dist/types/libs/util.d.ts +1 -1
- package/dist/types/server/index.d.ts +2 -2
- package/package.json +27 -29
- package/rslib.config.mts +4 -0
- package/rstest.config.ts +7 -0
- package/dist/cjs/server/process.js +0 -108
- package/dist/esm/index.js +0 -163
- package/dist/esm/libs/make.js +0 -36
- package/dist/esm/libs/output.js +0 -15
- package/dist/esm/libs/replace.js +0 -41
- package/dist/esm/libs/util.js +0 -210
- package/dist/esm/server/consts.js +0 -4
- package/dist/esm/server/index.js +0 -66
- package/dist/esm/server/prerender.js +0 -46
- package/dist/esm/server/process.js +0 -263
- package/dist/esm-node/index.js +0 -128
- package/dist/esm-node/libs/make.js +0 -37
- package/dist/esm-node/libs/output.js +0 -15
- package/dist/esm-node/libs/replace.js +0 -36
- package/dist/esm-node/libs/util.js +0 -161
- package/dist/esm-node/server/consts.js +0 -4
- package/dist/esm-node/server/index.js +0 -62
- package/dist/esm-node/server/prerender.js +0 -37
- package/dist/esm-node/server/process.js +0 -85
- package/dist/types/server/process.d.ts +0 -1
- /package/dist/esm/{types.js → types.mjs} +0 -0
- /package/dist/esm-node/{types.js → types.mjs} +0 -0
package/dist/cjs/libs/replace.js
CHANGED
|
@@ -1,71 +1,75 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
)
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.n = (module)=>{
|
|
5
|
+
var getter = module && module.__esModule ? ()=>module['default'] : ()=>module;
|
|
6
|
+
__webpack_require__.d(getter, {
|
|
7
|
+
a: getter
|
|
8
|
+
});
|
|
9
|
+
return getter;
|
|
10
|
+
};
|
|
11
|
+
})();
|
|
12
|
+
(()=>{
|
|
13
|
+
__webpack_require__.d = (exports1, definition)=>{
|
|
14
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
15
|
+
enumerable: true,
|
|
16
|
+
get: definition[key]
|
|
17
|
+
});
|
|
18
|
+
};
|
|
19
|
+
})();
|
|
20
|
+
(()=>{
|
|
21
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
22
|
+
})();
|
|
23
|
+
(()=>{
|
|
24
|
+
__webpack_require__.r = (exports1)=>{
|
|
25
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
26
|
+
value: 'Module'
|
|
27
|
+
});
|
|
28
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
29
|
+
value: true
|
|
30
|
+
});
|
|
31
|
+
};
|
|
32
|
+
})();
|
|
33
|
+
var __webpack_exports__ = {};
|
|
34
|
+
__webpack_require__.r(__webpack_exports__);
|
|
35
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
36
|
+
replaceRoute: ()=>replaceRoute,
|
|
37
|
+
exist: ()=>exist
|
|
33
38
|
});
|
|
34
|
-
|
|
35
|
-
var
|
|
39
|
+
const external_normalize_path_namespaceObject = require("normalize-path");
|
|
40
|
+
var external_normalize_path_default = /*#__PURE__*/ __webpack_require__.n(external_normalize_path_namespaceObject);
|
|
36
41
|
function exist(route, pageRoutes) {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
}
|
|
43
|
-
return false;
|
|
44
|
-
});
|
|
42
|
+
return pageRoutes.slice().findIndex((pageRoute)=>{
|
|
43
|
+
const urlEqual = external_normalize_path_default()(pageRoute.urlPath) === external_normalize_path_default()(route.urlPath);
|
|
44
|
+
const entryEqual = pageRoute.entryName === route.entryName;
|
|
45
|
+
if (urlEqual && entryEqual) return true;
|
|
46
|
+
return false;
|
|
47
|
+
});
|
|
45
48
|
}
|
|
46
49
|
function replaceRoute(ssgRoutes, pageRoutes) {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
});
|
|
64
|
-
pageRoutes.push(...freshRoutes);
|
|
65
|
-
return pageRoutes;
|
|
50
|
+
const cleanSsgRoutes = ssgRoutes.map((ssgRoute)=>{
|
|
51
|
+
const { output, headers, ...cleanSsgRoute } = ssgRoute;
|
|
52
|
+
return Object.assign(cleanSsgRoute, output ? {
|
|
53
|
+
entryPath: output
|
|
54
|
+
} : {});
|
|
55
|
+
});
|
|
56
|
+
const freshRoutes = [];
|
|
57
|
+
cleanSsgRoutes.forEach((ssgRoute)=>{
|
|
58
|
+
const index = exist(ssgRoute, pageRoutes);
|
|
59
|
+
if (index < 0) freshRoutes.push({
|
|
60
|
+
...ssgRoute
|
|
61
|
+
});
|
|
62
|
+
else pageRoutes[index].entryPath = ssgRoute.entryPath;
|
|
63
|
+
});
|
|
64
|
+
pageRoutes.push(...freshRoutes);
|
|
65
|
+
return pageRoutes;
|
|
66
66
|
}
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
67
|
+
exports.exist = __webpack_exports__.exist;
|
|
68
|
+
exports.replaceRoute = __webpack_exports__.replaceRoute;
|
|
69
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
70
|
+
"exist",
|
|
71
|
+
"replaceRoute"
|
|
72
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
73
|
+
Object.defineProperty(exports, '__esModule', {
|
|
74
|
+
value: true
|
|
71
75
|
});
|
package/dist/cjs/libs/util.js
CHANGED
|
@@ -1,206 +1,224 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
)
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.n = (module)=>{
|
|
5
|
+
var getter = module && module.__esModule ? ()=>module['default'] : ()=>module;
|
|
6
|
+
__webpack_require__.d(getter, {
|
|
7
|
+
a: getter
|
|
8
|
+
});
|
|
9
|
+
return getter;
|
|
10
|
+
};
|
|
11
|
+
})();
|
|
12
|
+
(()=>{
|
|
13
|
+
__webpack_require__.d = (exports1, definition)=>{
|
|
14
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
15
|
+
enumerable: true,
|
|
16
|
+
get: definition[key]
|
|
17
|
+
});
|
|
18
|
+
};
|
|
19
|
+
})();
|
|
20
|
+
(()=>{
|
|
21
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
22
|
+
})();
|
|
23
|
+
(()=>{
|
|
24
|
+
__webpack_require__.r = (exports1)=>{
|
|
25
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
26
|
+
value: 'Module'
|
|
27
|
+
});
|
|
28
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
29
|
+
value: true
|
|
30
|
+
});
|
|
31
|
+
};
|
|
32
|
+
})();
|
|
33
|
+
var __webpack_exports__ = {};
|
|
34
|
+
__webpack_require__.r(__webpack_exports__);
|
|
35
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
36
|
+
chunkArray: ()=>chunkArray,
|
|
37
|
+
readJSONSpec: ()=>readJSONSpec,
|
|
38
|
+
replaceWithAlias: ()=>replaceWithAlias,
|
|
39
|
+
writeJSONSpec: ()=>writeJSONSpec,
|
|
40
|
+
openRouteSSR: ()=>openRouteSSR,
|
|
41
|
+
getOutput: ()=>getOutput,
|
|
42
|
+
standardOptions: ()=>standardOptions,
|
|
43
|
+
isDynamicUrl: ()=>isDynamicUrl,
|
|
44
|
+
formatOutput: ()=>formatOutput,
|
|
45
|
+
getUrlPrefix: ()=>getUrlPrefix,
|
|
46
|
+
flattenRoutes: ()=>flattenRoutes,
|
|
47
|
+
formatPath: ()=>formatPath
|
|
43
48
|
});
|
|
44
|
-
|
|
45
|
-
var
|
|
46
|
-
|
|
49
|
+
const external_path_namespaceObject = require("path");
|
|
50
|
+
var external_path_default = /*#__PURE__*/ __webpack_require__.n(external_path_namespaceObject);
|
|
51
|
+
const utils_namespaceObject = require("@modern-js/utils");
|
|
47
52
|
function formatOutput(filename) {
|
|
48
|
-
|
|
49
|
-
|
|
53
|
+
const outputPath = external_path_default().extname(filename) ? filename : `${filename}/index.html`;
|
|
54
|
+
return outputPath;
|
|
50
55
|
}
|
|
51
56
|
function formatPath(str) {
|
|
52
|
-
|
|
53
|
-
|
|
57
|
+
let addr = str;
|
|
58
|
+
if (!addr || 'string' != typeof addr) return addr;
|
|
59
|
+
if (addr.startsWith('.')) addr = addr.slice(1);
|
|
60
|
+
if (!addr.startsWith('/')) addr = `/${addr}`;
|
|
61
|
+
if (addr.endsWith('/') && '/' !== addr) addr = addr.slice(0, addr.length - 1);
|
|
54
62
|
return addr;
|
|
55
|
-
}
|
|
56
|
-
if (addr.startsWith(".")) {
|
|
57
|
-
addr = addr.slice(1);
|
|
58
|
-
}
|
|
59
|
-
if (!addr.startsWith("/")) {
|
|
60
|
-
addr = `/${addr}`;
|
|
61
|
-
}
|
|
62
|
-
if (addr.endsWith("/") && addr !== "/") {
|
|
63
|
-
addr = addr.slice(0, addr.length - 1);
|
|
64
|
-
}
|
|
65
|
-
return addr;
|
|
66
63
|
}
|
|
67
64
|
function isDynamicUrl(url) {
|
|
68
|
-
|
|
65
|
+
return url.includes(':') || url.endsWith('*');
|
|
69
66
|
}
|
|
70
67
|
function getUrlPrefix(route, baseUrl) {
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
base = base === "/" ? "" : base;
|
|
85
|
-
const entryName = route.entryName === "main" ? "" : route.entryName;
|
|
86
|
-
const prefix = `${base}/${entryName}`;
|
|
87
|
-
return prefix.endsWith("/") ? prefix.slice(0, -1) : prefix;
|
|
68
|
+
let base = '';
|
|
69
|
+
if (Array.isArray(baseUrl)) {
|
|
70
|
+
const filters = baseUrl.filter((url)=>route.urlPath.includes(url));
|
|
71
|
+
if (filters.length > 1) {
|
|
72
|
+
const matched = filters.sort((a, b)=>a.length - b.length)[0];
|
|
73
|
+
if (!matched) throw new Error('');
|
|
74
|
+
base = matched;
|
|
75
|
+
}
|
|
76
|
+
} else base = baseUrl;
|
|
77
|
+
base = '/' === base ? '' : base;
|
|
78
|
+
const entryName = 'main' === route.entryName ? '' : route.entryName;
|
|
79
|
+
const prefix = `${base}/${entryName}`;
|
|
80
|
+
return prefix.endsWith('/') ? prefix.slice(0, -1) : prefix;
|
|
88
81
|
}
|
|
89
82
|
function getOutput(route, base, agreed) {
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
}
|
|
98
|
-
throw new Error(`routing must provide output when calling createPage(), check ${route.urlPath}`);
|
|
83
|
+
const { output } = route;
|
|
84
|
+
if (output) return output;
|
|
85
|
+
if (agreed) {
|
|
86
|
+
const urlWithoutBase = route.urlPath.replace(base, '');
|
|
87
|
+
return urlWithoutBase.startsWith('/') ? urlWithoutBase.slice(1) : urlWithoutBase;
|
|
88
|
+
}
|
|
89
|
+
throw new Error(`routing must provide output when calling createPage(), check ${route.urlPath}`);
|
|
99
90
|
}
|
|
100
|
-
const readJSONSpec = (dir)
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
91
|
+
const readJSONSpec = (dir)=>{
|
|
92
|
+
const routeJSONPath = external_path_default().join(dir, utils_namespaceObject.ROUTE_SPEC_FILE);
|
|
93
|
+
const routeJSON = require(routeJSONPath);
|
|
94
|
+
const { routes } = routeJSON;
|
|
95
|
+
return routes;
|
|
105
96
|
};
|
|
106
|
-
const writeJSONSpec = (dir, routes)
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
97
|
+
const writeJSONSpec = (dir, routes)=>{
|
|
98
|
+
const routeJSONPath = external_path_default().join(dir, utils_namespaceObject.ROUTE_SPEC_FILE);
|
|
99
|
+
utils_namespaceObject.fs.writeJSONSync(routeJSONPath, {
|
|
100
|
+
routes
|
|
101
|
+
}, {
|
|
102
|
+
spaces: 2
|
|
103
|
+
});
|
|
113
104
|
};
|
|
114
|
-
const replaceWithAlias = (base, filePath, alias)
|
|
115
|
-
const standardOptions = (ssgOptions, entrypoints, routes, server)
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
105
|
+
const replaceWithAlias = (base, filePath, alias)=>external_path_default().posix.join(alias, external_path_default().posix.relative(base, filePath));
|
|
106
|
+
const standardOptions = (ssgOptions, entrypoints, routes, server, ssgByEntries)=>{
|
|
107
|
+
if (ssgByEntries && Object.keys(ssgByEntries).length > 0) {
|
|
108
|
+
const result = {};
|
|
109
|
+
Object.keys(ssgByEntries).forEach((key)=>{
|
|
110
|
+
const val = ssgByEntries[key];
|
|
111
|
+
if ('function' != typeof val) result[key] = val;
|
|
112
|
+
});
|
|
113
|
+
for (const entry of entrypoints){
|
|
114
|
+
const { entryName } = entry;
|
|
115
|
+
const configured = ssgByEntries[entryName];
|
|
116
|
+
if ('function' == typeof configured) {
|
|
117
|
+
const routesForEntry = routes.filter((r)=>r.entryName === entryName);
|
|
118
|
+
if (Array.isArray(server?.baseUrl)) for (const url of server.baseUrl)routesForEntry.filter((r)=>'string' == typeof r.urlPath && r.urlPath.startsWith(url)).forEach((r)=>{
|
|
119
|
+
result[r.urlPath] = configured(entryName, {
|
|
120
|
+
baseUrl: url
|
|
121
|
+
});
|
|
122
|
+
});
|
|
123
|
+
else result[entryName] = configured(entryName, {
|
|
124
|
+
baseUrl: server?.baseUrl
|
|
125
|
+
});
|
|
126
|
+
} else if (void 0 !== configured) result[entryName] = configured;
|
|
127
|
+
}
|
|
128
|
+
return result;
|
|
129
|
+
}
|
|
130
|
+
if (false === ssgOptions) return false;
|
|
131
|
+
if (true === ssgOptions) return entrypoints.reduce((opt, entry)=>{
|
|
132
|
+
opt[entry.entryName] = ssgOptions;
|
|
133
|
+
return opt;
|
|
123
134
|
}, {});
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
135
|
+
if ('object' == typeof ssgOptions) {
|
|
136
|
+
const isSingle = (0, utils_namespaceObject.isSingleEntry)(entrypoints);
|
|
137
|
+
if (isSingle) return {
|
|
138
|
+
main: ssgOptions
|
|
139
|
+
};
|
|
140
|
+
return entrypoints.reduce((opt, entry)=>{
|
|
141
|
+
opt[entry.entryName] = ssgOptions;
|
|
142
|
+
return opt;
|
|
143
|
+
}, {});
|
|
132
144
|
}
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
145
|
+
if ('function' == typeof ssgOptions) {
|
|
146
|
+
const intermediateOptions = {};
|
|
147
|
+
for (const entrypoint of entrypoints){
|
|
148
|
+
const { entryName } = entrypoint;
|
|
149
|
+
const routesForEntry = routes.filter((r)=>r.entryName === entryName);
|
|
150
|
+
if (Array.isArray(server?.baseUrl)) for (const url of server.baseUrl)routesForEntry.filter((r)=>'string' == typeof r.urlPath && r.urlPath.startsWith(url)).forEach((r)=>{
|
|
151
|
+
intermediateOptions[r.urlPath] = ssgOptions(entryName, {
|
|
152
|
+
baseUrl: url
|
|
153
|
+
});
|
|
154
|
+
});
|
|
155
|
+
else intermediateOptions[entryName] = ssgOptions(entryName, {
|
|
156
|
+
baseUrl: server?.baseUrl
|
|
157
|
+
});
|
|
144
158
|
}
|
|
145
|
-
|
|
146
|
-
intermediateOptions[entryName] = ssgOptions(entryName, {
|
|
147
|
-
baseUrl: server === null || server === void 0 ? void 0 : server.baseUrl
|
|
148
|
-
});
|
|
149
|
-
}
|
|
159
|
+
return intermediateOptions;
|
|
150
160
|
}
|
|
151
|
-
return
|
|
152
|
-
}
|
|
153
|
-
return false;
|
|
161
|
+
return false;
|
|
154
162
|
};
|
|
155
|
-
const openRouteSSR = (routes, entries = [])
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
}));
|
|
160
|
-
const flattenRoutes = (routes)
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
routes.forEach(traverseRoute);
|
|
183
|
-
return newRoutes;
|
|
163
|
+
const openRouteSSR = (routes, entries = [])=>routes.map((ssgRoute)=>({
|
|
164
|
+
...ssgRoute,
|
|
165
|
+
isSSR: entries.includes(ssgRoute.entryName),
|
|
166
|
+
bundle: `${utils_namespaceObject.SERVER_BUNDLE_DIRECTORY}/${ssgRoute.entryName}.js`
|
|
167
|
+
}));
|
|
168
|
+
const flattenRoutes = (routes)=>{
|
|
169
|
+
const parents = [];
|
|
170
|
+
const newRoutes = [];
|
|
171
|
+
const traverseRoute = (route)=>{
|
|
172
|
+
const parent = parents[parents.length - 1];
|
|
173
|
+
let path = parent ? `${parent.path}/${route.path || ''}`.replace(/\/+/g, '/') : route.path || '';
|
|
174
|
+
path = path.replace(/\/$/, '');
|
|
175
|
+
if (route._component && ('/' !== path || '/' === path && !parent)) newRoutes.push({
|
|
176
|
+
...route,
|
|
177
|
+
path
|
|
178
|
+
});
|
|
179
|
+
if (route.children) {
|
|
180
|
+
parents.push({
|
|
181
|
+
...route,
|
|
182
|
+
path
|
|
183
|
+
});
|
|
184
|
+
route.children.forEach(traverseRoute);
|
|
185
|
+
parents.pop();
|
|
186
|
+
}
|
|
187
|
+
};
|
|
188
|
+
routes.forEach(traverseRoute);
|
|
189
|
+
return newRoutes;
|
|
184
190
|
};
|
|
185
191
|
function chunkArray(arr, size) {
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
result
|
|
189
|
-
}
|
|
190
|
-
return result;
|
|
192
|
+
const result = [];
|
|
193
|
+
for(let i = 0; i < arr.length; i += size)result.push(arr.slice(i, i + size));
|
|
194
|
+
return result;
|
|
191
195
|
}
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
196
|
+
exports.chunkArray = __webpack_exports__.chunkArray;
|
|
197
|
+
exports.flattenRoutes = __webpack_exports__.flattenRoutes;
|
|
198
|
+
exports.formatOutput = __webpack_exports__.formatOutput;
|
|
199
|
+
exports.formatPath = __webpack_exports__.formatPath;
|
|
200
|
+
exports.getOutput = __webpack_exports__.getOutput;
|
|
201
|
+
exports.getUrlPrefix = __webpack_exports__.getUrlPrefix;
|
|
202
|
+
exports.isDynamicUrl = __webpack_exports__.isDynamicUrl;
|
|
203
|
+
exports.openRouteSSR = __webpack_exports__.openRouteSSR;
|
|
204
|
+
exports.readJSONSpec = __webpack_exports__.readJSONSpec;
|
|
205
|
+
exports.replaceWithAlias = __webpack_exports__.replaceWithAlias;
|
|
206
|
+
exports.standardOptions = __webpack_exports__.standardOptions;
|
|
207
|
+
exports.writeJSONSpec = __webpack_exports__.writeJSONSpec;
|
|
208
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
209
|
+
"chunkArray",
|
|
210
|
+
"flattenRoutes",
|
|
211
|
+
"formatOutput",
|
|
212
|
+
"formatPath",
|
|
213
|
+
"getOutput",
|
|
214
|
+
"getUrlPrefix",
|
|
215
|
+
"isDynamicUrl",
|
|
216
|
+
"openRouteSSR",
|
|
217
|
+
"readJSONSpec",
|
|
218
|
+
"replaceWithAlias",
|
|
219
|
+
"standardOptions",
|
|
220
|
+
"writeJSONSpec"
|
|
221
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
222
|
+
Object.defineProperty(exports, '__esModule', {
|
|
223
|
+
value: true
|
|
206
224
|
});
|
|
@@ -1,28 +1,36 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.d = (exports1, definition)=>{
|
|
5
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: definition[key]
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
})();
|
|
11
|
+
(()=>{
|
|
12
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
13
|
+
})();
|
|
14
|
+
(()=>{
|
|
15
|
+
__webpack_require__.r = (exports1)=>{
|
|
16
|
+
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
17
|
+
value: 'Module'
|
|
18
|
+
});
|
|
19
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
20
|
+
value: true
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
})();
|
|
24
|
+
var __webpack_exports__ = {};
|
|
25
|
+
__webpack_require__.r(__webpack_exports__);
|
|
26
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
27
|
+
CLOSE_SIGN: ()=>CLOSE_SIGN
|
|
22
28
|
});
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
29
|
+
const CLOSE_SIGN = 'modern_close_server';
|
|
30
|
+
exports.CLOSE_SIGN = __webpack_exports__.CLOSE_SIGN;
|
|
31
|
+
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
32
|
+
"CLOSE_SIGN"
|
|
33
|
+
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
34
|
+
Object.defineProperty(exports, '__esModule', {
|
|
35
|
+
value: true
|
|
28
36
|
});
|