@modern-js/app-tools 3.9.0 → 3.9.2
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/builder/generator/createCopyPattern.js +2 -1
- package/dist/cjs/builder/shared/builderPlugins/adapterHtml.js +2 -1
- package/dist/cjs/compat/hooks.js +1 -1
- package/dist/cjs/index.js +29 -35
- package/dist/cjs/plugins/analyze/getFileSystemEntry.js +1 -1
- package/dist/cjs/plugins/analyze/getServerRoutes.js +1 -1
- package/dist/cjs/plugins/analyze/utils.js +2 -2
- package/dist/esm/builder/generator/createCopyPattern.mjs +2 -1
- package/dist/esm/builder/shared/builderPlugins/adapterHtml.mjs +2 -1
- package/dist/esm/compat/hooks.mjs +1 -1
- package/dist/esm/index.mjs +0 -2
- package/dist/esm/plugins/analyze/getFileSystemEntry.mjs +1 -1
- package/dist/esm/plugins/analyze/getServerRoutes.mjs +1 -1
- package/dist/esm/plugins/analyze/utils.mjs +2 -2
- package/dist/esm-node/builder/generator/createCopyPattern.mjs +2 -1
- package/dist/esm-node/builder/shared/builderPlugins/adapterHtml.mjs +2 -1
- package/dist/esm-node/compat/hooks.mjs +1 -1
- package/dist/esm-node/index.mjs +0 -2
- package/dist/esm-node/plugins/analyze/getFileSystemEntry.mjs +1 -1
- package/dist/esm-node/plugins/analyze/getServerRoutes.mjs +1 -1
- package/dist/esm-node/plugins/analyze/utils.mjs +2 -2
- package/dist/types/builder/builder-rspack/index.d.ts +1 -1
- package/dist/types/builder/generator/adapterCopy.d.ts +1 -1
- package/dist/types/builder/generator/createBuilderProviderConfig.d.ts +2 -2
- package/dist/types/builder/generator/createCopyPattern.d.ts +2 -2
- package/dist/types/builder/generator/getBuilderEnvironments.d.ts +2 -2
- package/dist/types/builder/generator/index.d.ts +1 -1
- package/dist/types/builder/index.d.ts +1 -1
- package/dist/types/builder/shared/builderPlugins/adapterBasic.d.ts +1 -1
- package/dist/types/builder/shared/builderPlugins/adapterHtml.d.ts +1 -1
- package/dist/types/builder/shared/builderPlugins/adapterSSR.d.ts +1 -1
- package/dist/types/builder/shared/builderPlugins/builderHooks.d.ts +1 -1
- package/dist/types/builder/shared/builderPlugins/index.d.ts +4 -4
- package/dist/types/builder/shared/bundlerPlugins/index.d.ts +3 -3
- package/dist/types/builder/shared/createCopyInfo.d.ts +2 -2
- package/dist/types/builder/shared/index.d.ts +3 -3
- package/dist/types/builder/shared/types.d.ts +2 -2
- package/dist/types/commands/build.d.ts +2 -2
- package/dist/types/commands/deploy.d.ts +2 -2
- package/dist/types/commands/dev.d.ts +2 -2
- package/dist/types/commands/index.d.ts +1 -1
- package/dist/types/commands/info.d.ts +2 -2
- package/dist/types/commands/inspect.d.ts +2 -2
- package/dist/types/commands/serve.d.ts +1 -1
- package/dist/types/compat/hooks.d.ts +1 -1
- package/dist/types/compat/index.d.ts +1 -1
- package/dist/types/config/default.d.ts +2 -2
- package/dist/types/config/index.d.ts +2 -2
- package/dist/types/config/initialize/index.d.ts +2 -2
- package/dist/types/config/initialize/inits.d.ts +2 -2
- package/dist/types/defineConfig.d.ts +2 -2
- package/dist/types/index.d.ts +13 -13
- package/dist/types/plugins/analyze/getBundleEntry.d.ts +2 -2
- package/dist/types/plugins/analyze/getFileSystemEntry.d.ts +2 -2
- package/dist/types/plugins/analyze/getHtmlTemplate.d.ts +2 -2
- package/dist/types/plugins/analyze/getServerRoutes.d.ts +2 -2
- package/dist/types/plugins/analyze/index.d.ts +1 -1
- package/dist/types/plugins/deploy/index.d.ts +1 -1
- package/dist/types/plugins/deploy/platforms/gh-pages.d.ts +1 -1
- package/dist/types/plugins/deploy/platforms/netlify.d.ts +1 -1
- package/dist/types/plugins/deploy/platforms/node.d.ts +1 -1
- package/dist/types/plugins/deploy/platforms/platform.d.ts +3 -3
- package/dist/types/plugins/deploy/platforms/vercel.d.ts +1 -1
- package/dist/types/plugins/deploy/types.d.ts +1 -1
- package/dist/types/plugins/deploy/utils/generator.d.ts +2 -2
- package/dist/types/plugins/initialize/index.d.ts +1 -1
- package/dist/types/plugins/serverBuild.d.ts +1 -1
- package/dist/types/rsbuild.d.ts +1 -1
- package/dist/types/run/index.d.ts +1 -1
- package/dist/types/types/config/html.d.ts +1 -1
- package/dist/types/types/config/index.d.ts +13 -13
- package/dist/types/types/config/output.d.ts +1 -1
- package/dist/types/types/config/performance.d.ts +1 -1
- package/dist/types/types/config/tools.d.ts +1 -1
- package/dist/types/types/index.d.ts +3 -3
- package/dist/types/types/plugin.d.ts +3 -3
- package/dist/types/utils/config.d.ts +1 -1
- package/dist/types/utils/env.d.ts +1 -1
- package/dist/types/utils/generateWatchFiles.d.ts +1 -1
- package/dist/types/utils/loadPlugins.d.ts +1 -1
- package/dist/types/utils/printInstructions.d.ts +2 -2
- package/dist/types/utils/restart.d.ts +1 -1
- package/dist/types/utils/routes.d.ts +1 -1
- package/package.json +13 -13
- package/dist/cjs/plugins/serverRuntime.js +0 -53
- package/dist/esm/plugins/serverRuntime.mjs +0 -15
- package/dist/esm-node/plugins/serverRuntime.mjs +0 -16
- package/dist/types/plugins/serverRuntime.d.ts +0 -3
|
@@ -47,7 +47,8 @@ function createPublicPattern(appContext, config, chain) {
|
|
|
47
47
|
noErrorOnMissing: true,
|
|
48
48
|
transform: (content, absoluteFrom)=>{
|
|
49
49
|
if (!/\.html?$/.test(absoluteFrom)) return content;
|
|
50
|
-
|
|
50
|
+
const publicPath = chain.output.get('publicPath');
|
|
51
|
+
return content.toString('utf8').replace(/<%=\s*assetPrefix\s*%>/g, (0, utils_namespaceObject.removeTailSlash)('string' == typeof publicPath ? publicPath : ''));
|
|
51
52
|
}
|
|
52
53
|
};
|
|
53
54
|
}
|
|
@@ -58,7 +58,8 @@ const builderPluginAdapterHtml = (options)=>({
|
|
|
58
58
|
async function injectAssetPrefix({ chain }) {
|
|
59
59
|
const entries = chain.entryPoints.entries() || {};
|
|
60
60
|
const entryNames = Object.keys(entries);
|
|
61
|
-
const
|
|
61
|
+
const publicPath = chain.output.get('publicPath');
|
|
62
|
+
const assetPrefix = (0, utils_namespaceObject.removeTailSlash)('string' == typeof publicPath ? publicPath : '');
|
|
62
63
|
const code = `window.__assetPrefix__ = '${assetPrefix}';`;
|
|
63
64
|
entryNames.forEach((entryName)=>{
|
|
64
65
|
entries[entryName].prepend(createVirtualModule(code));
|
package/dist/cjs/compat/hooks.js
CHANGED
|
@@ -92,7 +92,7 @@ function handleSetupResult(setupResult, api) {
|
|
|
92
92
|
if (newAPI && api[newAPI]) api[newAPI](async (...params)=>{
|
|
93
93
|
const { isMultiple, params: transformParams } = (0, external_utils_js_namespaceObject.transformHookParams)(key, params);
|
|
94
94
|
if (isMultiple) return (0, external_utils_js_namespaceObject.transformHookResult)(key, await fn(...transformParams));
|
|
95
|
-
return (0, external_utils_js_namespaceObject.transformHookResult)(key, await fn(transformParams));
|
|
95
|
+
else return (0, external_utils_js_namespaceObject.transformHookResult)(key, await fn(transformParams));
|
|
96
96
|
});
|
|
97
97
|
}
|
|
98
98
|
});
|
package/dist/cjs/index.js
CHANGED
|
@@ -39,9 +39,6 @@ var __webpack_modules__ = {
|
|
|
39
39
|
"./plugins/serverBuild" (module) {
|
|
40
40
|
module.exports = require("./plugins/serverBuild.js");
|
|
41
41
|
},
|
|
42
|
-
"./plugins/serverRuntime" (module) {
|
|
43
|
-
module.exports = require("./plugins/serverRuntime.js");
|
|
44
|
-
},
|
|
45
42
|
"./rsbuild" (module) {
|
|
46
43
|
module.exports = require("./rsbuild.js");
|
|
47
44
|
},
|
|
@@ -144,14 +141,12 @@ var __webpack_exports__ = {};
|
|
|
144
141
|
var _plugins_initialize__rspack_import_11_default = /*#__PURE__*/ __webpack_require__.n(_plugins_initialize__rspack_import_11);
|
|
145
142
|
var _plugins_serverBuild__rspack_import_12 = __webpack_require__("./plugins/serverBuild");
|
|
146
143
|
var _plugins_serverBuild__rspack_import_12_default = /*#__PURE__*/ __webpack_require__.n(_plugins_serverBuild__rspack_import_12);
|
|
147
|
-
var
|
|
148
|
-
var
|
|
149
|
-
var
|
|
150
|
-
var
|
|
151
|
-
var _utils_restart__rspack_import_16 = __webpack_require__("./utils/restart");
|
|
152
|
-
var _defineConfig__rspack_import_17 = __webpack_require__("./defineConfig");
|
|
144
|
+
var _utils_generateWatchFiles__rspack_import_13 = __webpack_require__("./utils/generateWatchFiles");
|
|
145
|
+
var _utils_initAppContext__rspack_import_14 = __webpack_require__("./utils/initAppContext");
|
|
146
|
+
var _utils_restart__rspack_import_15 = __webpack_require__("./utils/restart");
|
|
147
|
+
var _defineConfig__rspack_import_16 = __webpack_require__("./defineConfig");
|
|
153
148
|
var __rspack_reexport = {};
|
|
154
|
-
for(const __rspack_import_key in
|
|
149
|
+
for(const __rspack_import_key in _defineConfig__rspack_import_16)if ([
|
|
155
150
|
"dev",
|
|
156
151
|
"resolveModernRsbuildConfig",
|
|
157
152
|
"mergeConfig",
|
|
@@ -164,17 +159,17 @@ var __webpack_exports__ = {};
|
|
|
164
159
|
"defineConfig",
|
|
165
160
|
"build",
|
|
166
161
|
"closeServer"
|
|
167
|
-
].indexOf(__rspack_import_key) < 0) __rspack_reexport[__rspack_import_key] = ()=>
|
|
162
|
+
].indexOf(__rspack_import_key) < 0) __rspack_reexport[__rspack_import_key] = ()=>_defineConfig__rspack_import_16[__rspack_import_key];
|
|
168
163
|
__webpack_require__.d(__webpack_exports__, __rspack_reexport);
|
|
169
|
-
var
|
|
170
|
-
var
|
|
171
|
-
var
|
|
172
|
-
var
|
|
173
|
-
var
|
|
174
|
-
var
|
|
175
|
-
var
|
|
164
|
+
var _commands_build__rspack_import_17 = __webpack_require__("./commands/build");
|
|
165
|
+
var _commands_deploy__rspack_import_18 = __webpack_require__("./commands/deploy");
|
|
166
|
+
var _commands_dev__rspack_import_19 = __webpack_require__("./commands/dev");
|
|
167
|
+
var _commands_serve__rspack_import_20 = __webpack_require__("./commands/serve");
|
|
168
|
+
var _utils_createServer__rspack_import_21 = __webpack_require__("./utils/createServer");
|
|
169
|
+
var _rsbuild__rspack_import_22 = __webpack_require__("./rsbuild");
|
|
170
|
+
var _types__rspack_import_23 = __webpack_require__("./types?6efa");
|
|
176
171
|
var __rspack_reexport = {};
|
|
177
|
-
for(const __rspack_import_key in
|
|
172
|
+
for(const __rspack_import_key in _types__rspack_import_23)if ([
|
|
178
173
|
"dev",
|
|
179
174
|
"resolveModernRsbuildConfig",
|
|
180
175
|
"mergeConfig",
|
|
@@ -187,13 +182,12 @@ var __webpack_exports__ = {};
|
|
|
187
182
|
"defineConfig",
|
|
188
183
|
"build",
|
|
189
184
|
"closeServer"
|
|
190
|
-
].indexOf(__rspack_import_key) < 0) __rspack_reexport[__rspack_import_key] = ()=>
|
|
185
|
+
].indexOf(__rspack_import_key) < 0) __rspack_reexport[__rspack_import_key] = ()=>_types__rspack_import_23[__rspack_import_key];
|
|
191
186
|
__webpack_require__.d(__webpack_exports__, __rspack_reexport);
|
|
192
|
-
var
|
|
187
|
+
var _modern_js_plugin_cli__rspack_import_24 = __webpack_require__("@modern-js/plugin/cli");
|
|
193
188
|
const appTools = ()=>({
|
|
194
189
|
name: '@modern-js/app-tools',
|
|
195
190
|
usePlugins: [
|
|
196
|
-
_plugins_serverRuntime__rspack_import_13_default()(),
|
|
197
191
|
(0, _compat__rspack_import_6.compatPlugin)(),
|
|
198
192
|
_plugins_initialize__rspack_import_11_default()(),
|
|
199
193
|
_plugins_analyze__rspack_import_9_default()(),
|
|
@@ -226,7 +220,7 @@ var __webpack_exports__ = {};
|
|
|
226
220
|
_locale__rspack_import_8.i18n.changeLanguage({
|
|
227
221
|
locale
|
|
228
222
|
});
|
|
229
|
-
api.updateAppContext((0,
|
|
223
|
+
api.updateAppContext((0, _utils_initAppContext__rspack_import_14.initAppContext)({
|
|
230
224
|
metaName: context.metaName,
|
|
231
225
|
appDirectory: context.appDirectory,
|
|
232
226
|
runtimeConfigFile: _constants__rspack_import_7.DEFAULT_RUNTIME_CONFIG_FILE,
|
|
@@ -272,7 +266,7 @@ var __webpack_exports__ = {};
|
|
|
272
266
|
api.addWatchFiles(async ()=>{
|
|
273
267
|
const appContext = api.getAppContext();
|
|
274
268
|
const config = api.getNormalizedConfig();
|
|
275
|
-
const files = await (0,
|
|
269
|
+
const files = await (0, _utils_generateWatchFiles__rspack_import_13.generateWatchFiles)(appContext, config.source.configDir);
|
|
276
270
|
const watchFiles = (0, _modern_js_builder__rspack_import_1.castArray)(config.dev.watchFiles);
|
|
277
271
|
watchFiles.forEach(({ type, paths })=>{
|
|
278
272
|
if ('reload-server' === type) files.push(...Array.isArray(paths) ? paths : [
|
|
@@ -289,7 +283,7 @@ var __webpack_exports__ = {};
|
|
|
289
283
|
if (!isPrivate && ('change' === eventType || 'unlink' === eventType) && !isApiProject) {
|
|
290
284
|
const { closeServer } = await import("./utils/createServer.js");
|
|
291
285
|
await closeServer();
|
|
292
|
-
await (0,
|
|
286
|
+
await (0, _utils_restart__rspack_import_15.restart)(api.getHooks(), filename);
|
|
293
287
|
}
|
|
294
288
|
});
|
|
295
289
|
api.onBeforeRestart(()=>{
|
|
@@ -301,16 +295,16 @@ var __webpack_exports__ = {};
|
|
|
301
295
|
});
|
|
302
296
|
const __rspack_default_export = appTools;
|
|
303
297
|
__webpack_require__.d(__webpack_exports__, {
|
|
304
|
-
build: ()=>
|
|
305
|
-
closeServer: ()=>
|
|
306
|
-
defineConfig: ()=>
|
|
307
|
-
deploy: ()=>
|
|
308
|
-
dev: ()=>
|
|
309
|
-
generateWatchFiles: ()=>
|
|
310
|
-
initAppContext: ()=>
|
|
311
|
-
mergeConfig: ()=>
|
|
312
|
-
resolveModernRsbuildConfig: ()=>
|
|
313
|
-
serve: ()=>
|
|
298
|
+
build: ()=>_commands_build__rspack_import_17.build,
|
|
299
|
+
closeServer: ()=>_utils_createServer__rspack_import_21.closeServer,
|
|
300
|
+
defineConfig: ()=>_defineConfig__rspack_import_16.defineConfig,
|
|
301
|
+
deploy: ()=>_commands_deploy__rspack_import_18.deploy,
|
|
302
|
+
dev: ()=>_commands_dev__rspack_import_19.dev,
|
|
303
|
+
generateWatchFiles: ()=>_utils_generateWatchFiles__rspack_import_13.generateWatchFiles,
|
|
304
|
+
initAppContext: ()=>_utils_initAppContext__rspack_import_14.initAppContext,
|
|
305
|
+
mergeConfig: ()=>_modern_js_plugin_cli__rspack_import_24.mergeConfig,
|
|
306
|
+
resolveModernRsbuildConfig: ()=>_rsbuild__rspack_import_22.resolveModernRsbuildConfig,
|
|
307
|
+
serve: ()=>_commands_serve__rspack_import_20.serve
|
|
314
308
|
}, {
|
|
315
309
|
appTools: appTools,
|
|
316
310
|
default: __rspack_default_export
|
|
@@ -106,7 +106,7 @@ const getFileSystemEntry = async (hooks, appContext, config)=>{
|
|
|
106
106
|
}));
|
|
107
107
|
return scanDir(hooks, dirs);
|
|
108
108
|
} else throw Error("source.entriesDir accept a directory.");
|
|
109
|
-
throw Error(`src dir ${entriesDir} not found.`);
|
|
109
|
+
else throw Error(`src dir ${entriesDir} not found.`);
|
|
110
110
|
};
|
|
111
111
|
exports.getFileSystemEntry = __webpack_exports__.getFileSystemEntry;
|
|
112
112
|
exports.hasEntry = __webpack_exports__.hasEntry;
|
|
@@ -58,14 +58,14 @@ const walkDirectory = (dir)=>external_fs_default().readdirSync(dir).reduce((prev
|
|
|
58
58
|
...previous,
|
|
59
59
|
...walkDirectory(filePath)
|
|
60
60
|
];
|
|
61
|
-
return [
|
|
61
|
+
else return [
|
|
62
62
|
...previous,
|
|
63
63
|
filePath
|
|
64
64
|
];
|
|
65
65
|
}, []);
|
|
66
66
|
const replaceWithAlias = (base, filePath, alias)=>{
|
|
67
67
|
if (filePath.includes(base)) return (0, utils_namespaceObject.normalizeToPosixPath)(external_path_default().join(alias, external_path_default().relative(base, filePath)));
|
|
68
|
-
return filePath;
|
|
68
|
+
else return filePath;
|
|
69
69
|
};
|
|
70
70
|
const parseModule = async ({ source, filename })=>{
|
|
71
71
|
let content = source;
|
|
@@ -14,7 +14,8 @@ function createPublicPattern(appContext, config, chain) {
|
|
|
14
14
|
noErrorOnMissing: true,
|
|
15
15
|
transform: (content, absoluteFrom)=>{
|
|
16
16
|
if (!/\.html?$/.test(absoluteFrom)) return content;
|
|
17
|
-
|
|
17
|
+
const publicPath = chain.output.get('publicPath');
|
|
18
|
+
return content.toString('utf8').replace(/<%=\s*assetPrefix\s*%>/g, removeTailSlash('string' == typeof publicPath ? publicPath : ''));
|
|
18
19
|
}
|
|
19
20
|
};
|
|
20
21
|
}
|
|
@@ -26,7 +26,8 @@ const builderPluginAdapterHtml = (options)=>({
|
|
|
26
26
|
async function injectAssetPrefix({ chain }) {
|
|
27
27
|
const entries = chain.entryPoints.entries() || {};
|
|
28
28
|
const entryNames = Object.keys(entries);
|
|
29
|
-
const
|
|
29
|
+
const publicPath = chain.output.get('publicPath');
|
|
30
|
+
const assetPrefix = removeTailSlash('string' == typeof publicPath ? publicPath : '');
|
|
30
31
|
const code = `window.__assetPrefix__ = '${assetPrefix}';`;
|
|
31
32
|
entryNames.forEach((entryName)=>{
|
|
32
33
|
entries[entryName].prepend(createVirtualModule(code));
|
|
@@ -59,7 +59,7 @@ function handleSetupResult(setupResult, api) {
|
|
|
59
59
|
if (newAPI && api[newAPI]) api[newAPI](async (...params)=>{
|
|
60
60
|
const { isMultiple, params: transformParams } = transformHookParams(key, params);
|
|
61
61
|
if (isMultiple) return transformHookResult(key, await fn(...transformParams));
|
|
62
|
-
return transformHookResult(key, await fn(transformParams));
|
|
62
|
+
else return transformHookResult(key, await fn(transformParams));
|
|
63
63
|
});
|
|
64
64
|
}
|
|
65
65
|
});
|
package/dist/esm/index.mjs
CHANGED
|
@@ -11,7 +11,6 @@ import analyze from "./plugins/analyze/index.mjs";
|
|
|
11
11
|
import deploy from "./plugins/deploy/index.mjs";
|
|
12
12
|
import initialize from "./plugins/initialize/index.mjs";
|
|
13
13
|
import serverBuild from "./plugins/serverBuild.mjs";
|
|
14
|
-
import serverRuntime from "./plugins/serverRuntime.mjs";
|
|
15
14
|
import { generateWatchFiles } from "./utils/generateWatchFiles.mjs";
|
|
16
15
|
import { initAppContext } from "./utils/initAppContext.mjs";
|
|
17
16
|
import { restart } from "./utils/restart.mjs";
|
|
@@ -20,7 +19,6 @@ export * from "./types/index.mjs";
|
|
|
20
19
|
const appTools = ()=>({
|
|
21
20
|
name: '@modern-js/app-tools',
|
|
22
21
|
usePlugins: [
|
|
23
|
-
serverRuntime(),
|
|
24
22
|
compatPlugin(),
|
|
25
23
|
initialize(),
|
|
26
24
|
analyze(),
|
|
@@ -61,6 +61,6 @@ const getFileSystemEntry = async (hooks, appContext, config)=>{
|
|
|
61
61
|
}));
|
|
62
62
|
return scanDir(hooks, dirs);
|
|
63
63
|
} else throw Error("source.entriesDir accept a directory.");
|
|
64
|
-
throw Error(`src dir ${entriesDir} not found.`);
|
|
64
|
+
else throw Error(`src dir ${entriesDir} not found.`);
|
|
65
65
|
};
|
|
66
66
|
export { getFileSystemEntry, hasEntry, hasServerEntry };
|
|
@@ -9,14 +9,14 @@ const walkDirectory = (dir)=>fs.readdirSync(dir).reduce((previous, filename)=>{
|
|
|
9
9
|
...previous,
|
|
10
10
|
...walkDirectory(filePath)
|
|
11
11
|
];
|
|
12
|
-
return [
|
|
12
|
+
else return [
|
|
13
13
|
...previous,
|
|
14
14
|
filePath
|
|
15
15
|
];
|
|
16
16
|
}, []);
|
|
17
17
|
const replaceWithAlias = (base, filePath, alias)=>{
|
|
18
18
|
if (filePath.includes(base)) return normalizeToPosixPath(path.join(alias, path.relative(base, filePath)));
|
|
19
|
-
return filePath;
|
|
19
|
+
else return filePath;
|
|
20
20
|
};
|
|
21
21
|
const parseModule = async ({ source, filename })=>{
|
|
22
22
|
let content = source;
|
|
@@ -15,7 +15,8 @@ function createPublicPattern(appContext, config, chain) {
|
|
|
15
15
|
noErrorOnMissing: true,
|
|
16
16
|
transform: (content, absoluteFrom)=>{
|
|
17
17
|
if (!/\.html?$/.test(absoluteFrom)) return content;
|
|
18
|
-
|
|
18
|
+
const publicPath = chain.output.get('publicPath');
|
|
19
|
+
return content.toString('utf8').replace(/<%=\s*assetPrefix\s*%>/g, removeTailSlash('string' == typeof publicPath ? publicPath : ''));
|
|
19
20
|
}
|
|
20
21
|
};
|
|
21
22
|
}
|
|
@@ -27,7 +27,8 @@ const builderPluginAdapterHtml = (options)=>({
|
|
|
27
27
|
async function injectAssetPrefix({ chain }) {
|
|
28
28
|
const entries = chain.entryPoints.entries() || {};
|
|
29
29
|
const entryNames = Object.keys(entries);
|
|
30
|
-
const
|
|
30
|
+
const publicPath = chain.output.get('publicPath');
|
|
31
|
+
const assetPrefix = removeTailSlash('string' == typeof publicPath ? publicPath : '');
|
|
31
32
|
const code = `window.__assetPrefix__ = '${assetPrefix}';`;
|
|
32
33
|
entryNames.forEach((entryName)=>{
|
|
33
34
|
entries[entryName].prepend(createVirtualModule(code));
|
|
@@ -60,7 +60,7 @@ function handleSetupResult(setupResult, api) {
|
|
|
60
60
|
if (newAPI && api[newAPI]) api[newAPI](async (...params)=>{
|
|
61
61
|
const { isMultiple, params: transformParams } = transformHookParams(key, params);
|
|
62
62
|
if (isMultiple) return transformHookResult(key, await fn(...transformParams));
|
|
63
|
-
return transformHookResult(key, await fn(transformParams));
|
|
63
|
+
else return transformHookResult(key, await fn(transformParams));
|
|
64
64
|
});
|
|
65
65
|
}
|
|
66
66
|
});
|
package/dist/esm-node/index.mjs
CHANGED
|
@@ -13,7 +13,6 @@ import analyze from "./plugins/analyze/index.mjs";
|
|
|
13
13
|
import deploy from "./plugins/deploy/index.mjs";
|
|
14
14
|
import initialize from "./plugins/initialize/index.mjs";
|
|
15
15
|
import serverBuild from "./plugins/serverBuild.mjs";
|
|
16
|
-
import serverRuntime from "./plugins/serverRuntime.mjs";
|
|
17
16
|
import { generateWatchFiles } from "./utils/generateWatchFiles.mjs";
|
|
18
17
|
import { initAppContext } from "./utils/initAppContext.mjs";
|
|
19
18
|
import { restart } from "./utils/restart.mjs";
|
|
@@ -22,7 +21,6 @@ export * from "./types/index.mjs";
|
|
|
22
21
|
const appTools = ()=>({
|
|
23
22
|
name: '@modern-js/app-tools',
|
|
24
23
|
usePlugins: [
|
|
25
|
-
serverRuntime(),
|
|
26
24
|
compatPlugin(),
|
|
27
25
|
initialize(),
|
|
28
26
|
analyze(),
|
|
@@ -62,6 +62,6 @@ const getFileSystemEntry = async (hooks, appContext, config)=>{
|
|
|
62
62
|
}));
|
|
63
63
|
return scanDir(hooks, dirs);
|
|
64
64
|
} else throw Error("source.entriesDir accept a directory.");
|
|
65
|
-
throw Error(`src dir ${entriesDir} not found.`);
|
|
65
|
+
else throw Error(`src dir ${entriesDir} not found.`);
|
|
66
66
|
};
|
|
67
67
|
export { getFileSystemEntry, hasEntry, hasServerEntry };
|
|
@@ -10,14 +10,14 @@ const walkDirectory = (dir)=>fs.readdirSync(dir).reduce((previous, filename)=>{
|
|
|
10
10
|
...previous,
|
|
11
11
|
...walkDirectory(filePath)
|
|
12
12
|
];
|
|
13
|
-
return [
|
|
13
|
+
else return [
|
|
14
14
|
...previous,
|
|
15
15
|
filePath
|
|
16
16
|
];
|
|
17
17
|
}, []);
|
|
18
18
|
const replaceWithAlias = (base, filePath, alias)=>{
|
|
19
19
|
if (filePath.includes(base)) return normalizeToPosixPath(path.join(alias, path.relative(base, filePath)));
|
|
20
|
-
return filePath;
|
|
20
|
+
else return filePath;
|
|
21
21
|
};
|
|
22
22
|
const parseModule = async ({ source, filename })=>{
|
|
23
23
|
let content = source;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { BuilderOptions } from '../shared';
|
|
1
|
+
import type { BuilderOptions } from '../shared/index.js';
|
|
2
2
|
export declare function createRspackBuilderForModern(options: BuilderOptions): Promise<import("@rsbuild/core").RsbuildInstance>;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type { AppNormalizedConfig } from '../../types';
|
|
2
|
-
import type { AppToolsContext } from '../../types/plugin';
|
|
1
|
+
import type { AppNormalizedConfig } from '../../types/index.js';
|
|
2
|
+
import type { AppToolsContext } from '../../types/plugin.js';
|
|
3
3
|
export declare function createBuilderProviderConfig(resolveConfig: AppNormalizedConfig, appContext: AppToolsContext): Omit<AppNormalizedConfig, 'plugins'>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Rspack, RspackChain } from '@rsbuild/core';
|
|
2
|
-
import type { AppNormalizedConfig } from '../../types';
|
|
3
|
-
import type { AppToolsContext } from '../../types/plugin';
|
|
2
|
+
import type { AppNormalizedConfig } from '../../types/index.js';
|
|
3
|
+
import type { AppToolsContext } from '../../types/plugin.js';
|
|
4
4
|
export declare function createPublicPattern(appContext: AppToolsContext, config: AppNormalizedConfig, chain: RspackChain): {
|
|
5
5
|
info: (file: {
|
|
6
6
|
sourceFilename: string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { AppNormalizedConfig } from '../../types';
|
|
2
|
-
import type { AppToolsContext } from '../../types/plugin';
|
|
1
|
+
import type { AppNormalizedConfig } from '../../types/index.js';
|
|
2
|
+
import type { AppToolsContext } from '../../types/plugin.js';
|
|
3
3
|
export declare function getBuilderEnvironments(normalizedConfig: AppNormalizedConfig, appContext: AppToolsContext, tempBuilderConfig: Omit<AppNormalizedConfig, 'plugins'>): {
|
|
4
4
|
environments: Record<string, import("@rsbuild/core").EnvironmentConfig>;
|
|
5
5
|
builderConfig: Omit<AppNormalizedConfig, "plugins">;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export declare function createBuilderGenerator(): Promise<typeof import("./builder-rspack/index.js").createRspackBuilderForModern>;
|
|
2
2
|
export { parseRspackConfig } from '@modern-js/builder';
|
|
3
|
-
export { builderPluginAdapterBasic, builderPluginAdapterHooks, } from './shared/builderPlugins';
|
|
3
|
+
export { builderPluginAdapterBasic, builderPluginAdapterHooks, } from './shared/builderPlugins/index.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export * from './adapterBasic';
|
|
2
|
-
export * from './adapterHtml';
|
|
3
|
-
export * from './adapterSSR';
|
|
4
|
-
export * from './builderHooks';
|
|
1
|
+
export * from './adapterBasic.js';
|
|
2
|
+
export * from './adapterHtml.js';
|
|
3
|
+
export * from './adapterSSR.js';
|
|
4
|
+
export * from './builderHooks.js';
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export * from './HtmlAsyncChunkPlugin';
|
|
2
|
-
export * from './HtmlBottomTemplate';
|
|
3
|
-
export * from './RouterPlugin';
|
|
1
|
+
export * from './HtmlAsyncChunkPlugin.js';
|
|
2
|
+
export * from './HtmlBottomTemplate.js';
|
|
3
|
+
export * from './RouterPlugin.js';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { AppNormalizedConfig } from '../../types';
|
|
2
|
-
import type { AppToolsContext } from '../../types/plugin';
|
|
1
|
+
import type { AppNormalizedConfig } from '../../types/index.js';
|
|
2
|
+
import type { AppToolsContext } from '../../types/plugin.js';
|
|
3
3
|
export declare function createCopyInfo(appContext: AppToolsContext, config: AppNormalizedConfig): {
|
|
4
4
|
configDir: string;
|
|
5
5
|
uploadDir: string;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export * from './types';
|
|
2
|
-
export * from './builderPlugins';
|
|
3
|
-
export * from './createCopyInfo';
|
|
1
|
+
export * from './types.js';
|
|
2
|
+
export * from './builderPlugins/index.js';
|
|
3
|
+
export * from './createCopyInfo.js';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { EagerRouteComponentFilesByEntry } from '@modern-js/utils';
|
|
2
|
-
import type { AppNormalizedConfig } from '../../types';
|
|
3
|
-
import type { AppToolsContext } from '../../types/plugin';
|
|
2
|
+
import type { AppNormalizedConfig } from '../../types/index.js';
|
|
3
|
+
import type { AppToolsContext } from '../../types/plugin.js';
|
|
4
4
|
export type BuilderOptions = {
|
|
5
5
|
normalizedConfig: AppNormalizedConfig;
|
|
6
6
|
appContext: AppToolsContext;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { CLIPluginAPI } from '@modern-js/plugin';
|
|
2
|
-
import type { AppTools } from '../types';
|
|
3
|
-
import type { BuildOptions } from '../utils/types';
|
|
2
|
+
import type { AppTools } from '../types/index.js';
|
|
3
|
+
import type { BuildOptions } from '../utils/types.js';
|
|
4
4
|
export declare const build: (api: CLIPluginAPI<AppTools>, options?: BuildOptions) => Promise<void>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { CLIPluginAPI } from '@modern-js/plugin';
|
|
2
|
-
import type { AppTools } from '../types';
|
|
3
|
-
import type { DeployOptions } from '../utils/types';
|
|
2
|
+
import type { AppTools } from '../types/index.js';
|
|
3
|
+
import type { DeployOptions } from '../utils/types.js';
|
|
4
4
|
export declare const deploy: (api: CLIPluginAPI<AppTools>, options?: DeployOptions) => Promise<void>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { CLIPluginAPI } from '@modern-js/plugin';
|
|
2
2
|
import { type ApplyPlugins } from '@modern-js/server';
|
|
3
|
-
import type { AppTools } from '../types';
|
|
4
|
-
import type { DevOptions } from '../utils/types';
|
|
3
|
+
import type { AppTools } from '../types/index.js';
|
|
4
|
+
import type { DevOptions } from '../utils/types.js';
|
|
5
5
|
interface ExtraServerOptions {
|
|
6
6
|
applyPlugins?: ApplyPlugins;
|
|
7
7
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { CLIPluginAPI } from '@modern-js/plugin';
|
|
2
2
|
import type { Command } from '@modern-js/utils';
|
|
3
|
-
import type { AppTools } from '../types';
|
|
3
|
+
import type { AppTools } from '../types/index.js';
|
|
4
4
|
export declare const devCommand: (program: Command, api: CLIPluginAPI<AppTools>) => Promise<void>;
|
|
5
5
|
export declare const buildCommand: (program: Command, api: CLIPluginAPI<AppTools>) => Promise<void>;
|
|
6
6
|
export declare const serverCommand: (program: Command, api: CLIPluginAPI<AppTools>) => void;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { CLIPluginAPI } from '@modern-js/plugin';
|
|
2
|
-
import type { AppTools } from '../types';
|
|
3
|
-
import type { InfoOptions } from '../utils/types';
|
|
2
|
+
import type { AppTools } from '../types/index.js';
|
|
3
|
+
import type { InfoOptions } from '../utils/types.js';
|
|
4
4
|
export interface EntryInfo {
|
|
5
5
|
entryName: string;
|
|
6
6
|
isMainEntry: boolean;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { CLIPluginAPI } from '@modern-js/plugin';
|
|
2
|
-
import type { AppTools } from '../types';
|
|
3
|
-
import type { InspectOptions } from '../utils/types';
|
|
2
|
+
import type { AppTools } from '../types/index.js';
|
|
3
|
+
import type { InspectOptions } from '../utils/types.js';
|
|
4
4
|
export declare const inspect: (api: CLIPluginAPI<AppTools>, options: InspectOptions) => Promise<import("@rsbuild/core").InspectConfigResult>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { CLIPluginAPI } from '@modern-js/plugin';
|
|
2
2
|
import { createProdServer } from '@modern-js/prod-server';
|
|
3
|
-
import type { AppTools } from '../types';
|
|
3
|
+
import type { AppTools } from '../types/index.js';
|
|
4
4
|
type ExtraServerOptions = {
|
|
5
5
|
launcher?: typeof createProdServer;
|
|
6
6
|
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { AppTools, CliPlugin } from '../types';
|
|
1
|
+
import type { AppTools, CliPlugin } from '../types/index.js';
|
|
2
2
|
export declare const compatPlugin: () => CliPlugin<AppTools>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { AppUserConfig } from '../types';
|
|
2
|
-
import type { AppToolsContext } from '../types/plugin';
|
|
1
|
+
import type { AppUserConfig } from '../types/index.js';
|
|
2
|
+
import type { AppToolsContext } from '../types/plugin.js';
|
|
3
3
|
export declare function createDefaultConfig(appContext: AppToolsContext): AppUserConfig;
|
|
4
4
|
/**
|
|
5
5
|
* Default-enable lazy compilation for pure CSR and stream SSR. Stream SSR keeps
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from './initialize';
|
|
2
|
-
export * from './default';
|
|
1
|
+
export * from './initialize/index.js';
|
|
2
|
+
export * from './default.js';
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type { AppNormalizedConfig } from '../../types';
|
|
2
|
-
import type { AppToolsContext } from '../../types/plugin';
|
|
1
|
+
import type { AppNormalizedConfig } from '../../types/index.js';
|
|
2
|
+
import type { AppToolsContext } from '../../types/plugin.js';
|
|
3
3
|
export declare function initialNormalizedConfig(config: AppNormalizedConfig, appContext: AppToolsContext): AppNormalizedConfig;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AppNormalizedConfig } from '../../types';
|
|
2
|
-
import type { AppToolsContext } from '../../types/plugin';
|
|
1
|
+
import type { AppNormalizedConfig } from '../../types/index.js';
|
|
2
|
+
import type { AppToolsContext } from '../../types/plugin.js';
|
|
3
3
|
export declare function initHtmlConfig(config: AppNormalizedConfig, appContext: AppToolsContext): AppNormalizedConfig['html'];
|
|
4
4
|
export declare function initSourceConfig(config: AppNormalizedConfig, appContext: AppToolsContext): void;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AppUserConfig } from './types';
|
|
1
|
+
import type { AppUserConfig } from './types/index.js';
|
|
2
2
|
export type ConfigParams = {
|
|
3
3
|
env: string;
|
|
4
4
|
command: string;
|
|
@@ -8,4 +8,4 @@ export type UserConfigExport<Config> = Config | ((env: ConfigParams) => Config |
|
|
|
8
8
|
* This function helps you to autocomplete configuration types.
|
|
9
9
|
* It accepts a direct config object, or a function that returns a config.
|
|
10
10
|
*/
|
|
11
|
-
export declare const defineConfig: (config: UserConfigExport<AppUserConfig>) => UserConfigExport<import("./types").AppToolsUserConfig>;
|
|
11
|
+
export declare const defineConfig: (config: UserConfigExport<AppUserConfig>) => UserConfigExport<import("./types/index.js").AppToolsUserConfig>;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import type { AppTools, CliPlugin } from './types';
|
|
2
|
-
import { initAppContext } from './utils/initAppContext';
|
|
3
|
-
export * from './defineConfig';
|
|
1
|
+
import type { AppTools, CliPlugin } from './types/index.js';
|
|
2
|
+
import { initAppContext } from './utils/initAppContext.js';
|
|
3
|
+
export * from './defineConfig.js';
|
|
4
4
|
export declare const appTools: () => CliPlugin<AppTools>;
|
|
5
|
-
export { defineConfig } from './defineConfig';
|
|
6
|
-
export { build } from './commands/build';
|
|
7
|
-
export { deploy } from './commands/deploy';
|
|
8
|
-
export { dev } from './commands/dev';
|
|
9
|
-
export { serve } from './commands/serve';
|
|
10
|
-
export { closeServer } from './utils/createServer';
|
|
11
|
-
export type { BuildOptions, DeployOptions, DevOptions } from './utils/types';
|
|
12
|
-
export { generateWatchFiles } from './utils/generateWatchFiles';
|
|
13
|
-
export { resolveModernRsbuildConfig, type ResolveModernRsbuildConfigOptions, } from './rsbuild';
|
|
14
|
-
export * from './types';
|
|
5
|
+
export { defineConfig } from './defineConfig.js';
|
|
6
|
+
export { build } from './commands/build.js';
|
|
7
|
+
export { deploy } from './commands/deploy.js';
|
|
8
|
+
export { dev } from './commands/dev.js';
|
|
9
|
+
export { serve } from './commands/serve.js';
|
|
10
|
+
export { closeServer } from './utils/createServer.js';
|
|
11
|
+
export type { BuildOptions, DeployOptions, DevOptions } from './utils/types.js';
|
|
12
|
+
export { generateWatchFiles } from './utils/generateWatchFiles.js';
|
|
13
|
+
export { resolveModernRsbuildConfig, type ResolveModernRsbuildConfigOptions, } from './rsbuild.js';
|
|
14
|
+
export * from './types/index.js';
|
|
15
15
|
export { initAppContext };
|
|
16
16
|
export default appTools;
|
|
17
17
|
export { mergeConfig } from '@modern-js/plugin/cli';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { Entrypoint } from '@modern-js/types';
|
|
2
|
-
import type { AppNormalizedConfig } from '../../types';
|
|
3
|
-
import type { AppToolsContext, AppToolsHooks } from '../../types/plugin';
|
|
2
|
+
import type { AppNormalizedConfig } from '../../types/index.js';
|
|
3
|
+
import type { AppToolsContext, AppToolsHooks } from '../../types/plugin.js';
|
|
4
4
|
export declare const getBundleEntry: (hooks: AppToolsHooks, appContext: AppToolsContext, config: AppNormalizedConfig) => Promise<Entrypoint[]>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Entrypoint } from '@modern-js/types';
|
|
2
|
-
import type { AppNormalizedConfig } from '../../types';
|
|
3
|
-
import type { AppToolsContext, AppToolsHooks } from '../../types/plugin';
|
|
2
|
+
import type { AppNormalizedConfig } from '../../types/index.js';
|
|
3
|
+
import type { AppToolsContext, AppToolsHooks } from '../../types/plugin.js';
|
|
4
4
|
export type { Entrypoint };
|
|
5
5
|
export declare const hasEntry: (dir: string) => string | false;
|
|
6
6
|
export declare const hasServerEntry: (dir: string) => string | false;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Entrypoint, HtmlPartials, HtmlTemplates } from '@modern-js/types';
|
|
2
|
-
import type { AppNormalizedConfig } from '../../types';
|
|
3
|
-
import type { AppToolsContext, AppToolsHooks } from '../../types/plugin';
|
|
2
|
+
import type { AppNormalizedConfig } from '../../types/index.js';
|
|
3
|
+
import type { AppToolsContext, AppToolsHooks } from '../../types/plugin.js';
|
|
4
4
|
export declare const getModifyHtmlPartials: (partials: Record<keyof HtmlPartials, string[]>) => {
|
|
5
5
|
top: {
|
|
6
6
|
append: (...script: string[]) => void;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Entrypoint, ServerRoute } from '@modern-js/types';
|
|
2
|
-
import type { AppNormalizedConfig } from '../../types';
|
|
3
|
-
import type { AppToolsContext } from '../../types/plugin';
|
|
2
|
+
import type { AppNormalizedConfig } from '../../types/index.js';
|
|
3
|
+
import type { AppToolsContext } from '../../types/plugin.js';
|
|
4
4
|
export declare const getServerRoutes: (entrypoints: Entrypoint[], { appContext, config, }: {
|
|
5
5
|
appContext: AppToolsContext;
|
|
6
6
|
config: AppNormalizedConfig;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { CreatePreset } from './platform';
|
|
1
|
+
import type { CreatePreset } from './platform.js';
|
|
2
2
|
export declare const createGhPagesPreset: CreatePreset;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { CreatePreset } from './platform';
|
|
1
|
+
import type { CreatePreset } from './platform.js';
|
|
2
2
|
export declare const createNetlifyPreset: CreatePreset;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { CreatePreset } from './platform';
|
|
1
|
+
import type { CreatePreset } from './platform.js';
|
|
2
2
|
export declare const createNodePreset: CreatePreset;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { AppToolsNormalizedConfig } from '../../../types';
|
|
2
|
-
import type { AppToolsContext } from '../../../types/plugin';
|
|
3
|
-
import type { PluginAPI } from '../types';
|
|
1
|
+
import type { AppToolsNormalizedConfig } from '../../../types/index.js';
|
|
2
|
+
import type { AppToolsContext } from '../../../types/plugin.js';
|
|
3
|
+
import type { PluginAPI } from '../types.js';
|
|
4
4
|
interface CreatePresetParams {
|
|
5
5
|
appContext: AppToolsContext;
|
|
6
6
|
modernConfig: AppToolsNormalizedConfig;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { CreatePreset } from './platform';
|
|
1
|
+
import type { CreatePreset } from './platform.js';
|
|
2
2
|
export declare const createVercelPreset: CreatePreset;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ProdServerOptions } from '@modern-js/prod-server';
|
|
2
|
-
import type { AppToolsNormalizedConfig } from '../../../types';
|
|
3
|
-
import type { AppToolsContext } from '../../../types/plugin';
|
|
2
|
+
import type { AppToolsNormalizedConfig } from '../../../types/index.js';
|
|
3
|
+
import type { AppToolsContext } from '../../../types/plugin.js';
|
|
4
4
|
export declare const serverAppContextTemplate: (appContext: AppToolsContext) => {
|
|
5
5
|
sharedDirectory: string;
|
|
6
6
|
apiDirectory: string;
|
package/dist/types/rsbuild.d.ts
CHANGED
|
@@ -2,19 +2,19 @@ import type { RsbuildPlugins } from '@modern-js/builder';
|
|
|
2
2
|
import type { CLIPlugin, CLIPluginExtends } from '@modern-js/plugin';
|
|
3
3
|
import type { BffUserConfig, ServerUserConfig } from '@modern-js/server-core';
|
|
4
4
|
import type { RsbuildConfig } from '@rsbuild/core';
|
|
5
|
-
import type { AppToolsExtendAPI, AppToolsExtendContext, AppToolsExtendHooks } from '../plugin';
|
|
6
|
-
import type { DeployUserConfig } from './deploy';
|
|
7
|
-
import type { DevUserConfig } from './dev';
|
|
8
|
-
import type { ExperimentsUserConfig } from './experiments';
|
|
9
|
-
import type { HtmlUserConfig } from './html';
|
|
10
|
-
import type { OutputUserConfig } from './output';
|
|
11
|
-
import type { PerformanceUserConfig } from './performance';
|
|
12
|
-
import type { ResolveUserConfig } from './resolve';
|
|
13
|
-
import type { SecurityUserConfig } from './security';
|
|
14
|
-
import type { SourceUserConfig } from './source';
|
|
15
|
-
import type { TestingUserConfig } from './testing';
|
|
16
|
-
import type { ToolsUserConfig } from './tools';
|
|
17
|
-
export * from './output';
|
|
5
|
+
import type { AppToolsExtendAPI, AppToolsExtendContext, AppToolsExtendHooks } from '../plugin.js';
|
|
6
|
+
import type { DeployUserConfig } from './deploy.js';
|
|
7
|
+
import type { DevUserConfig } from './dev.js';
|
|
8
|
+
import type { ExperimentsUserConfig } from './experiments.js';
|
|
9
|
+
import type { HtmlUserConfig } from './html.js';
|
|
10
|
+
import type { OutputUserConfig } from './output.js';
|
|
11
|
+
import type { PerformanceUserConfig } from './performance.js';
|
|
12
|
+
import type { ResolveUserConfig } from './resolve.js';
|
|
13
|
+
import type { SecurityUserConfig } from './security.js';
|
|
14
|
+
import type { SourceUserConfig } from './source.js';
|
|
15
|
+
import type { TestingUserConfig } from './testing.js';
|
|
16
|
+
import type { ToolsUserConfig } from './tools.js';
|
|
17
|
+
export * from './output.js';
|
|
18
18
|
export interface AppToolsUserConfig {
|
|
19
19
|
resolve?: ResolveUserConfig;
|
|
20
20
|
server?: ServerUserConfig;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { BuilderConfig } from '@modern-js/builder';
|
|
2
2
|
import type { SSGConfig, SSGMultiEntryOptions } from '@modern-js/types';
|
|
3
|
-
import type { UnwrapBuilderConfig } from '../utils';
|
|
3
|
+
import type { UnwrapBuilderConfig } from '../utils.js';
|
|
4
4
|
export interface OutputUserConfig extends UnwrapBuilderConfig<BuilderConfig, 'output'> {
|
|
5
5
|
/**
|
|
6
6
|
* Enable SSG for self-controlled routing or conventional routing.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { BuilderConfig } from '@modern-js/builder';
|
|
2
2
|
import type { JestConfig } from '@modern-js/types';
|
|
3
|
-
import type { UnwrapBuilderConfig } from '../utils';
|
|
3
|
+
import type { UnwrapBuilderConfig } from '../utils.js';
|
|
4
4
|
type BuilderToolsConfig = UnwrapBuilderConfig<BuilderConfig, 'tools'>;
|
|
5
5
|
export interface ToolsUserConfig extends Omit<BuilderToolsConfig, 'swc'> {
|
|
6
6
|
/**
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { CLIPluginAPI, CLIPluginExtends, RuntimePluginConfig, ServerPluginConfig } from '@modern-js/plugin';
|
|
2
|
-
import type { AppTools, AppToolsNormalizedConfig, AppToolsUserConfig } from './config';
|
|
2
|
+
import type { AppTools, AppToolsNormalizedConfig, AppToolsUserConfig } from './config/index.js';
|
|
3
3
|
export type { CLIPluginExtends, RuntimePluginConfig, ServerPluginConfig };
|
|
4
|
-
export * from './config';
|
|
4
|
+
export * from './config/index.js';
|
|
5
5
|
export type { Rspack } from '@modern-js/builder';
|
|
6
6
|
export type { ServerUserConfig, ServerNormalizedConfig, BffUserConfig, BffNormalizedConfig, SSR, SSRByEntries, Resource, Params, RequestHandlerConfig, LoaderContext, OnError, OnTiming, RequestHandlerOptions, RequestHandler, } from '@modern-js/server-core';
|
|
7
7
|
export type AppUserConfig = AppToolsUserConfig;
|
|
8
8
|
export type AppNormalizedConfig = AppToolsNormalizedConfig;
|
|
9
9
|
export type AppToolsAPI = CLIPluginAPI<AppTools>;
|
|
10
|
-
export type { AppToolsExtendAPI, AppToolsExtendContext, AppToolsExtendHooks, AppToolsContext, AppToolsHooks as AppToolsFeatureHooks, } from './plugin';
|
|
10
|
+
export type { AppToolsExtendAPI, AppToolsExtendContext, AppToolsExtendHooks, AppToolsContext, AppToolsHooks as AppToolsFeatureHooks, } from './plugin.js';
|
|
@@ -3,9 +3,9 @@ import type { Hooks } from '@modern-js/plugin/cli';
|
|
|
3
3
|
import type { Entrypoint, HtmlPartials, HtmlTemplates, NestedRouteForCli, PageRoute, RouteLegacy, ServerPlugin, ServerRoute } from '@modern-js/types';
|
|
4
4
|
import type { EagerRouteComponentFilesByEntry } from '@modern-js/utils';
|
|
5
5
|
import type { EnvironmentConfig } from '@rsbuild/core';
|
|
6
|
-
import type { AppTools } from '.';
|
|
7
|
-
import type { getHookRunners } from '../compat/hooks';
|
|
8
|
-
import type { AppToolsNormalizedConfig, AppToolsUserConfig } from './config';
|
|
6
|
+
import type { AppTools } from './index.js';
|
|
7
|
+
import type { getHookRunners } from '../compat/hooks.js';
|
|
8
|
+
import type { AppToolsNormalizedConfig, AppToolsUserConfig } from './config/index.js';
|
|
9
9
|
export type AfterPrepareFn = () => Promise<void> | void;
|
|
10
10
|
export type CheckEntryPointFn = TransformFunction<{
|
|
11
11
|
path: string;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { AppNormalizedConfig } from '../types';
|
|
1
|
+
import type { AppNormalizedConfig } from '../types/index.js';
|
|
2
2
|
export declare const emitResolvedConfig: (appDirectory: string, resolvedConfig: AppNormalizedConfig) => Promise<void>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { AppToolsContext } from '../types/plugin';
|
|
1
|
+
import type { AppToolsContext } from '../types/plugin.js';
|
|
2
2
|
export declare function getAutoInjectEnv(appContext: AppToolsContext): Record<string, string>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { AppToolsContext } from '../types/plugin';
|
|
1
|
+
import type { AppToolsContext } from '../types/plugin.js';
|
|
2
2
|
export declare function generateWatchFiles(appContext: AppToolsContext, configDir?: string): Promise<string[]>;
|
|
@@ -3,7 +3,7 @@ import type { Plugin } from '@modern-js/plugin';
|
|
|
3
3
|
import type { ServerPlugin as ServerPluginInstance } from '@modern-js/server-core';
|
|
4
4
|
import type { ServerPlugin } from '@modern-js/types';
|
|
5
5
|
import type { InternalPlugins } from '@modern-js/types';
|
|
6
|
-
import type { AppTools } from '../types';
|
|
6
|
+
import type { AppTools } from '../types/index.js';
|
|
7
7
|
export declare function getServerPlugins(api: CLIPluginAPI<AppTools>, metaName?: string): Promise<ServerPlugin[]>;
|
|
8
8
|
export declare function loadServerPlugins(api: CLIPluginAPI<AppTools>, appDirectory: string, metaName: string): Promise<ServerPluginInstance[]>;
|
|
9
9
|
/**
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type { AppNormalizedConfig } from '../types';
|
|
2
|
-
import type { AppToolsContext, AppToolsHooks } from '../types/plugin';
|
|
1
|
+
import type { AppNormalizedConfig } from '../types/index.js';
|
|
2
|
+
import type { AppToolsContext, AppToolsHooks } from '../types/plugin.js';
|
|
3
3
|
export declare const printInstructions: (hooks: AppToolsHooks, appContext: AppToolsContext, config: AppNormalizedConfig) => Promise<void>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { AppToolsHooks } from '../types/plugin';
|
|
1
|
+
import type { AppToolsHooks } from '../types/plugin.js';
|
|
2
2
|
export declare function restart(hooks: AppToolsHooks, filename: string): Promise<void>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AppToolsContext } from '../types/plugin';
|
|
1
|
+
import type { AppToolsContext } from '../types/plugin.js';
|
|
2
2
|
export declare const generateRoutes: (appContext: AppToolsContext) => Promise<void>;
|
|
3
3
|
export declare const getPathWithoutExt: (filename: string) => string;
|
|
4
4
|
export declare const isMainEntry: (entryName: string, mainEntryName?: string) => boolean;
|
package/package.json
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"modern",
|
|
16
16
|
"modern.js"
|
|
17
17
|
],
|
|
18
|
-
"version": "3.9.
|
|
18
|
+
"version": "3.9.2",
|
|
19
19
|
"types": "./dist/types/index.d.ts",
|
|
20
20
|
"main": "./dist/cjs/index.js",
|
|
21
21
|
"exports": {
|
|
@@ -116,7 +116,7 @@
|
|
|
116
116
|
"@babel/parser": "^7.29.7",
|
|
117
117
|
"@babel/traverse": "^7.29.7",
|
|
118
118
|
"@babel/types": "^7.29.7",
|
|
119
|
-
"@rsbuild/core": "2.2.
|
|
119
|
+
"@rsbuild/core": "2.2.7",
|
|
120
120
|
"@swc/core": "1.15.41",
|
|
121
121
|
"@swc/helpers": "^0.5.17",
|
|
122
122
|
"es-module-lexer": "^1.7.0",
|
|
@@ -126,19 +126,19 @@
|
|
|
126
126
|
"ndepe": "^0.1.13",
|
|
127
127
|
"pkg-types": "^1.3.1",
|
|
128
128
|
"std-env": "^3.10.0",
|
|
129
|
-
"@modern-js/builder": "3.9.
|
|
130
|
-
"@modern-js/i18n-utils": "3.9.
|
|
131
|
-
"@modern-js/plugin
|
|
132
|
-
"@modern-js/plugin": "3.9.
|
|
133
|
-
"@modern-js/prod-server": "3.9.
|
|
134
|
-
"@modern-js/server": "3.9.
|
|
135
|
-
"@modern-js/server-core": "3.9.
|
|
136
|
-
"@modern-js/server-utils": "3.9.
|
|
137
|
-
"@modern-js/types": "3.9.
|
|
138
|
-
"@modern-js/utils": "3.9.
|
|
129
|
+
"@modern-js/builder": "3.9.2",
|
|
130
|
+
"@modern-js/i18n-utils": "3.9.2",
|
|
131
|
+
"@modern-js/plugin": "3.9.2",
|
|
132
|
+
"@modern-js/plugin-data-loader": "3.9.2",
|
|
133
|
+
"@modern-js/prod-server": "3.9.2",
|
|
134
|
+
"@modern-js/server": "3.9.2",
|
|
135
|
+
"@modern-js/server-core": "3.9.2",
|
|
136
|
+
"@modern-js/server-utils": "3.9.2",
|
|
137
|
+
"@modern-js/types": "3.9.2",
|
|
138
|
+
"@modern-js/utils": "3.9.2"
|
|
139
139
|
},
|
|
140
140
|
"devDependencies": {
|
|
141
|
-
"@rslib/core": "0.
|
|
141
|
+
"@rslib/core": "1.0.0",
|
|
142
142
|
"@types/babel__traverse": "7.28.0",
|
|
143
143
|
"@types/node": "^20",
|
|
144
144
|
"ts-node": "^10.9.2",
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __webpack_require__ = {};
|
|
3
|
-
(()=>{
|
|
4
|
-
__webpack_require__.d = (exports1, getters, values)=>{
|
|
5
|
-
var define = (defs, kind)=>{
|
|
6
|
-
for(var key in defs)if (__webpack_require__.o(defs, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
[kind]: defs[key]
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
define(getters, "get");
|
|
12
|
-
define(values, "value");
|
|
13
|
-
};
|
|
14
|
-
})();
|
|
15
|
-
(()=>{
|
|
16
|
-
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
17
|
-
})();
|
|
18
|
-
(()=>{
|
|
19
|
-
__webpack_require__.r = (exports1)=>{
|
|
20
|
-
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
21
|
-
value: 'Module'
|
|
22
|
-
});
|
|
23
|
-
Object.defineProperty(exports1, '__esModule', {
|
|
24
|
-
value: true
|
|
25
|
-
});
|
|
26
|
-
};
|
|
27
|
-
})();
|
|
28
|
-
var __webpack_exports__ = {};
|
|
29
|
-
__webpack_require__.r(__webpack_exports__);
|
|
30
|
-
const __rspack_default_export = ()=>({
|
|
31
|
-
name: '@modern-js/plugin-server-runtime',
|
|
32
|
-
setup (api) {
|
|
33
|
-
api.config(()=>({
|
|
34
|
-
output: {
|
|
35
|
-
externals: [
|
|
36
|
-
{
|
|
37
|
-
'@modern-js/server-runtime': '@modern-js/server-runtime'
|
|
38
|
-
}
|
|
39
|
-
]
|
|
40
|
-
}
|
|
41
|
-
}));
|
|
42
|
-
}
|
|
43
|
-
});
|
|
44
|
-
__webpack_require__.d(__webpack_exports__, {}, {
|
|
45
|
-
default: __rspack_default_export
|
|
46
|
-
});
|
|
47
|
-
exports["default"] = __webpack_exports__["default"];
|
|
48
|
-
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
49
|
-
"default"
|
|
50
|
-
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
51
|
-
Object.defineProperty(exports, '__esModule', {
|
|
52
|
-
value: true
|
|
53
|
-
});
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
const serverRuntime = ()=>({
|
|
2
|
-
name: '@modern-js/plugin-server-runtime',
|
|
3
|
-
setup (api) {
|
|
4
|
-
api.config(()=>({
|
|
5
|
-
output: {
|
|
6
|
-
externals: [
|
|
7
|
-
{
|
|
8
|
-
'@modern-js/server-runtime': '@modern-js/server-runtime'
|
|
9
|
-
}
|
|
10
|
-
]
|
|
11
|
-
}
|
|
12
|
-
}));
|
|
13
|
-
}
|
|
14
|
-
});
|
|
15
|
-
export default serverRuntime;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import "node:module";
|
|
2
|
-
const serverRuntime = ()=>({
|
|
3
|
-
name: '@modern-js/plugin-server-runtime',
|
|
4
|
-
setup (api) {
|
|
5
|
-
api.config(()=>({
|
|
6
|
-
output: {
|
|
7
|
-
externals: [
|
|
8
|
-
{
|
|
9
|
-
'@modern-js/server-runtime': '@modern-js/server-runtime'
|
|
10
|
-
}
|
|
11
|
-
]
|
|
12
|
-
}
|
|
13
|
-
}));
|
|
14
|
-
}
|
|
15
|
-
});
|
|
16
|
-
export default serverRuntime;
|