@modern-js/app-tools 2.27.0 → 2.28.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/CHANGELOG.md +44 -0
- package/dist/cjs/analyze/generateCode.js +2 -2
- package/dist/cjs/analyze/getFileSystemEntry.js +2 -1
- package/dist/cjs/analyze/getServerRoutes.js +5 -4
- package/dist/cjs/analyze/index.js +209 -211
- package/dist/cjs/analyze/nestedRoutes.js +2 -2
- package/dist/cjs/analyze/templates.js +4 -4
- package/dist/cjs/analyze/utils.js +2 -1
- package/dist/cjs/builder/builder-rspack/adapterCopy.js +41 -43
- package/dist/cjs/builder/builder-webpack/adapterModern.js +23 -25
- package/dist/cjs/builder/generator/createBuilderProviderConfig.js +2 -1
- package/dist/cjs/builder/shared/builderPlugins/adapterSSR.js +11 -9
- package/dist/cjs/commands/build.js +2 -1
- package/dist/cjs/commands/dev.js +3 -2
- package/dist/cjs/commands/inspect.js +2 -1
- package/dist/cjs/commands/serve.js +2 -2
- package/dist/cjs/index.js +7 -2
- package/dist/cjs/initialize/index.js +70 -72
- package/dist/esm/analyze/generateCode.js +2 -2
- package/dist/esm/analyze/getFileSystemEntry.js +2 -1
- package/dist/esm/analyze/getServerRoutes.js +5 -4
- package/dist/esm/analyze/nestedRoutes.js +2 -2
- package/dist/esm/analyze/templates.js +4 -4
- package/dist/esm/analyze/utils.js +2 -1
- package/dist/esm/builder/builder-rspack/adapterCopy.js +1 -1
- package/dist/esm/builder/generator/createBuilderProviderConfig.js +2 -1
- package/dist/esm/builder/shared/builderPlugins/adapterSSR.js +12 -10
- package/dist/esm/commands/build.js +2 -2
- package/dist/esm/commands/dev.js +5 -3
- package/dist/esm/commands/inspect.js +2 -2
- package/dist/esm/commands/serve.js +2 -2
- package/dist/esm/index.js +7 -5
- package/dist/esm-node/analyze/generateCode.js +2 -2
- package/dist/esm-node/analyze/getFileSystemEntry.js +2 -1
- package/dist/esm-node/analyze/getServerRoutes.js +5 -4
- package/dist/esm-node/analyze/index.js +209 -211
- package/dist/esm-node/analyze/nestedRoutes.js +2 -2
- package/dist/esm-node/analyze/templates.js +4 -4
- package/dist/esm-node/analyze/utils.js +2 -1
- package/dist/esm-node/builder/builder-rspack/adapterCopy.js +41 -43
- package/dist/esm-node/builder/builder-webpack/adapterModern.js +23 -25
- package/dist/esm-node/builder/generator/createBuilderProviderConfig.js +2 -1
- package/dist/esm-node/builder/shared/builderPlugins/adapterSSR.js +11 -9
- package/dist/esm-node/commands/build.js +2 -1
- package/dist/esm-node/commands/dev.js +3 -2
- package/dist/esm-node/commands/inspect.js +2 -1
- package/dist/esm-node/commands/serve.js +2 -2
- package/dist/esm-node/index.js +6 -4
- package/dist/esm-node/initialize/index.js +70 -72
- package/dist/types/analyze/getClientRoutes/getRoutes.d.ts +2 -2
- package/dist/types/analyze/nestedRoutes.d.ts +2 -2
- package/dist/types/analyze/templates.d.ts +3 -3
- package/dist/types/commands/dev.d.ts +4 -1
- package/dist/types/index.d.ts +1 -0
- package/dist/types/types/hooks.d.ts +2 -2
- package/package.json +24 -24
|
@@ -47,12 +47,13 @@ export const builderPluginAdapterSSR = (options) => ({
|
|
|
47
47
|
}
|
|
48
48
|
});
|
|
49
49
|
const isStreamingSSR = (userConfig) => {
|
|
50
|
+
var _server;
|
|
50
51
|
const isStreaming = (ssr) => ssr && typeof ssr === "object" && ssr.mode === "stream";
|
|
51
52
|
const { server } = userConfig;
|
|
52
53
|
if (isStreaming(server.ssr)) {
|
|
53
54
|
return true;
|
|
54
55
|
}
|
|
55
|
-
if ((server === null ||
|
|
56
|
+
if (((_server = server) === null || _server === void 0 ? void 0 : _server.ssrByEntries) && typeof server.ssrByEntries === "object") {
|
|
56
57
|
for (const name of Object.keys(server.ssrByEntries)) {
|
|
57
58
|
if (isStreaming(server.ssrByEntries[name])) {
|
|
58
59
|
return true;
|
|
@@ -69,33 +70,33 @@ function applyAsyncChunkHtmlPlugin({ chain, modernConfig, CHAIN_ID, HtmlBundlerP
|
|
|
69
70
|
}
|
|
70
71
|
}
|
|
71
72
|
function applyRouterPlugin(chain, options) {
|
|
72
|
-
var _normalizedConfig_runtime, _normalizedConfig_deploy_worker;
|
|
73
|
+
var _normalizedConfig_runtime, _normalizedConfig, _routerConfig, _normalizedConfig_deploy_worker;
|
|
73
74
|
const { appContext, normalizedConfig } = options;
|
|
74
75
|
const { entrypoints } = appContext;
|
|
75
76
|
const existNestedRoutes = entrypoints.some((entrypoint) => entrypoint.nestedRoutesEntry);
|
|
76
|
-
const routerConfig = normalizedConfig === null ||
|
|
77
|
-
const routerManifest = Boolean(routerConfig === null ||
|
|
77
|
+
const routerConfig = (_normalizedConfig = normalizedConfig) === null || _normalizedConfig === void 0 ? void 0 : (_normalizedConfig_runtime = _normalizedConfig.runtime) === null || _normalizedConfig_runtime === void 0 ? void 0 : _normalizedConfig_runtime.router;
|
|
78
|
+
const routerManifest = Boolean((_routerConfig = routerConfig) === null || _routerConfig === void 0 ? void 0 : _routerConfig.manifest);
|
|
78
79
|
const workerSSR = Boolean((_normalizedConfig_deploy_worker = normalizedConfig.deploy.worker) === null || _normalizedConfig_deploy_worker === void 0 ? void 0 : _normalizedConfig_deploy_worker.ssr);
|
|
79
80
|
if (existNestedRoutes || routerManifest || workerSSR) {
|
|
80
81
|
chain.plugin("route-plugin").use(RouterPlugin);
|
|
81
82
|
}
|
|
82
83
|
}
|
|
83
84
|
function applyFilterEntriesBySSRConfig({ isProd, chain, appNormalizedConfig }) {
|
|
84
|
-
var
|
|
85
|
+
var _outputConfig, _this, _outputConfig1, _outputConfig2, _outputConfig3;
|
|
85
86
|
const { server: serverConfig, output: outputConfig } = appNormalizedConfig;
|
|
86
87
|
const entries = chain.entryPoints.entries();
|
|
87
|
-
if (isProd && ((outputConfig === null ||
|
|
88
|
+
if (isProd && (((_outputConfig = outputConfig) === null || _outputConfig === void 0 ? void 0 : _outputConfig.ssg) === true || typeof ((_this = (_outputConfig1 = outputConfig) === null || _outputConfig1 === void 0 ? void 0 : _outputConfig1.ssg) === null || _this === void 0 ? void 0 : _this[0]) === "function")) {
|
|
88
89
|
return;
|
|
89
90
|
}
|
|
90
91
|
if (typeof entries === "undefined") {
|
|
91
92
|
throw new Error("No entry found, one of src/routes/layout.tsx, src/App.tsx, src/index.tsx is required");
|
|
92
93
|
}
|
|
93
94
|
const entryNames = Object.keys(entries);
|
|
94
|
-
if (isProd && entryNames.length === 1 && (outputConfig === null ||
|
|
95
|
+
if (isProd && entryNames.length === 1 && ((_outputConfig2 = outputConfig) === null || _outputConfig2 === void 0 ? void 0 : _outputConfig2.ssg)) {
|
|
95
96
|
return;
|
|
96
97
|
}
|
|
97
98
|
const ssgEntries = [];
|
|
98
|
-
if (isProd && (outputConfig === null ||
|
|
99
|
+
if (isProd && ((_outputConfig3 = outputConfig) === null || _outputConfig3 === void 0 ? void 0 : _outputConfig3.ssg)) {
|
|
99
100
|
const { ssg } = outputConfig;
|
|
100
101
|
entryNames.forEach((name) => {
|
|
101
102
|
if (ssg[name]) {
|
|
@@ -105,7 +106,8 @@ function applyFilterEntriesBySSRConfig({ isProd, chain, appNormalizedConfig }) {
|
|
|
105
106
|
}
|
|
106
107
|
const { ssr, ssrByEntries } = serverConfig || {};
|
|
107
108
|
entryNames.forEach((name) => {
|
|
108
|
-
|
|
109
|
+
var _ssrByEntries, _ssrByEntries1;
|
|
110
|
+
if (!ssgEntries.includes(name) && (ssr && ((_ssrByEntries = ssrByEntries) === null || _ssrByEntries === void 0 ? void 0 : _ssrByEntries[name]) === false || !ssr && !((_ssrByEntries1 = ssrByEntries) === null || _ssrByEntries1 === void 0 ? void 0 : _ssrByEntries1[name]))) {
|
|
109
111
|
chain.entryPoints.delete(name);
|
|
110
112
|
}
|
|
111
113
|
});
|
|
@@ -3,7 +3,8 @@ import { logger } from "@modern-js/utils";
|
|
|
3
3
|
import { generateRoutes } from "../utils/routes";
|
|
4
4
|
import { buildServerConfig } from "../utils/config";
|
|
5
5
|
export const build = async (api, options) => {
|
|
6
|
-
|
|
6
|
+
var _options;
|
|
7
|
+
if ((_options = options) === null || _options === void 0 ? void 0 : _options.analyze) {
|
|
7
8
|
process.env.BUNDLE_ANALYZE = "true";
|
|
8
9
|
}
|
|
9
10
|
let resolvedConfig = api.useResolvedConfigContext();
|
|
@@ -5,7 +5,7 @@ import { setServer, createServer, injectDataLoaderPlugin } from "../utils/create
|
|
|
5
5
|
import { generateRoutes } from "../utils/routes";
|
|
6
6
|
import { buildServerConfig } from "../utils/config";
|
|
7
7
|
import { getServerInternalPlugins } from "../utils/getServerInternalPlugins";
|
|
8
|
-
export const dev = async (api, options) => {
|
|
8
|
+
export const dev = async (api, options, devServerOptions = {}) => {
|
|
9
9
|
var _normalizedConfig_tools;
|
|
10
10
|
if (options.analyze) {
|
|
11
11
|
process.env.BUNDLE_ANALYZE = "true";
|
|
@@ -48,7 +48,8 @@ export const dev = async (api, options) => {
|
|
|
48
48
|
pwd: appDirectory,
|
|
49
49
|
config: normalizedConfig,
|
|
50
50
|
serverConfigFile,
|
|
51
|
-
internalPlugins: injectDataLoaderPlugin(serverInternalPlugins)
|
|
51
|
+
internalPlugins: injectDataLoaderPlugin(serverInternalPlugins),
|
|
52
|
+
...devServerOptions
|
|
52
53
|
};
|
|
53
54
|
if (apiOnly) {
|
|
54
55
|
var _normalizedConfig_dev;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { join } from "path";
|
|
2
2
|
export const inspect = async (api, options) => {
|
|
3
|
+
var _appContext;
|
|
3
4
|
const appContext = api.useAppContext();
|
|
4
5
|
if (!appContext.builder) {
|
|
5
6
|
throw new Error("Expect the Builder to have been initialized, But the appContext.builder received `undefined`");
|
|
@@ -7,7 +8,7 @@ export const inspect = async (api, options) => {
|
|
|
7
8
|
return appContext.builder.inspectConfig({
|
|
8
9
|
env: options.env,
|
|
9
10
|
verbose: options.verbose,
|
|
10
|
-
outputPath: join(appContext === null ||
|
|
11
|
+
outputPath: join((_appContext = appContext) === null || _appContext === void 0 ? void 0 : _appContext.builder.context.distPath, options.output),
|
|
11
12
|
writeToDisk: true
|
|
12
13
|
});
|
|
13
14
|
};
|
|
@@ -4,13 +4,13 @@ import { printInstructions } from "../utils/printInstructions";
|
|
|
4
4
|
import { injectDataLoaderPlugin } from "../utils/createServer";
|
|
5
5
|
import { getServerInternalPlugins } from "../utils/getServerInternalPlugins";
|
|
6
6
|
export const start = async (api) => {
|
|
7
|
-
var _userConfig_source, _userConfig_output_distPath;
|
|
7
|
+
var _userConfig_source, _userConfig, _userConfig_output_distPath;
|
|
8
8
|
const appContext = api.useAppContext();
|
|
9
9
|
const userConfig = api.useResolvedConfigContext();
|
|
10
10
|
const hookRunners = api.useHookRunners();
|
|
11
11
|
const { appDirectory, port, serverConfigFile, metaName } = appContext;
|
|
12
12
|
logger.log(chalk.cyan(`Starting the modern server...`));
|
|
13
|
-
const apiOnly = await isApiOnly(appContext.appDirectory, userConfig === null ||
|
|
13
|
+
const apiOnly = await isApiOnly(appContext.appDirectory, (_userConfig = userConfig) === null || _userConfig === void 0 ? void 0 : (_userConfig_source = _userConfig.source) === null || _userConfig_source === void 0 ? void 0 : _userConfig_source.entriesDir, appContext.apiDirectory);
|
|
14
14
|
const serverInternalPlugins = await getServerInternalPlugins(api);
|
|
15
15
|
const app = await server({
|
|
16
16
|
pwd: appDirectory,
|
package/dist/esm-node/index.js
CHANGED
|
@@ -10,14 +10,15 @@ import { i18n, localeKeys } from "./locale";
|
|
|
10
10
|
import { restart } from "./utils/restart";
|
|
11
11
|
import { generateWatchFiles } from "./utils/generateWatchFiles";
|
|
12
12
|
export { mergeConfig } from "@modern-js/core";
|
|
13
|
+
export { dev } from "./commands";
|
|
13
14
|
export * from "./defineConfig";
|
|
14
15
|
export * from "./types";
|
|
15
16
|
export const devCommand = async (program, api) => {
|
|
16
17
|
const runner = api.useHookRunners();
|
|
17
18
|
const devToolMetas = await runner.registerDev();
|
|
18
19
|
const devProgram = program.command("dev").alias("start").usage("[options]").description(i18n.t(localeKeys.command.dev.describe)).option("-c --config <config>", i18n.t(localeKeys.command.shared.config)).option("-e --entry [entry...]", i18n.t(localeKeys.command.dev.entry)).option("--analyze", i18n.t(localeKeys.command.shared.analyze)).option("--api-only", i18n.t(localeKeys.command.dev.apiOnly)).option("--web-only", i18n.t(localeKeys.command.dev.webOnly)).action(async (options) => {
|
|
19
|
-
const { dev } = await import("./commands/dev");
|
|
20
|
-
await
|
|
20
|
+
const { dev: dev2 } = await import("./commands/dev");
|
|
21
|
+
await dev2(api, options);
|
|
21
22
|
});
|
|
22
23
|
for (const meta of devToolMetas) {
|
|
23
24
|
if (!meta.subCommands) {
|
|
@@ -59,6 +60,7 @@ export const buildCommand = async (program, api) => {
|
|
|
59
60
|
export const appTools = (options = {
|
|
60
61
|
bundler: "webpack"
|
|
61
62
|
}) => {
|
|
63
|
+
var _options, _options1;
|
|
62
64
|
return {
|
|
63
65
|
name: "@modern-js/app-tools",
|
|
64
66
|
post: [
|
|
@@ -74,10 +76,10 @@ export const appTools = (options = {
|
|
|
74
76
|
registerHook: hooks,
|
|
75
77
|
usePlugins: [
|
|
76
78
|
initializePlugin({
|
|
77
|
-
bundler: (options === null ||
|
|
79
|
+
bundler: ((_options = options) === null || _options === void 0 ? void 0 : _options.bundler) === "experimental-rspack" ? "rspack" : "webpack"
|
|
78
80
|
}),
|
|
79
81
|
analyzePlugin({
|
|
80
|
-
bundler: (options === null ||
|
|
82
|
+
bundler: ((_options1 = options) === null || _options1 === void 0 ? void 0 : _options1.bundler) === "experimental-rspack" ? "rspack" : "webpack"
|
|
81
83
|
}),
|
|
82
84
|
lintPlugin()
|
|
83
85
|
],
|
|
@@ -1,81 +1,79 @@
|
|
|
1
1
|
import { ensureAbsolutePath, getPort, isDev, isDevCommand } from "@modern-js/utils";
|
|
2
2
|
import { legacySchema, schema } from "../schema";
|
|
3
3
|
import { checkIsLegacyConfig, createDefaultConfig, createLegacyDefaultConfig, transformNormalizedConfig } from "../config";
|
|
4
|
-
export default ({ bundler }) => {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
const
|
|
17
|
-
|
|
4
|
+
export default ({ bundler }) => ({
|
|
5
|
+
name: "@modern-js/plugin-initialize",
|
|
6
|
+
post: [
|
|
7
|
+
"@modern-js/plugin-ssr",
|
|
8
|
+
"@modern-js/plugin-document",
|
|
9
|
+
"@modern-js/plugin-state",
|
|
10
|
+
"@modern-js/plugin-router",
|
|
11
|
+
"@modern-js/plugin-router-v5",
|
|
12
|
+
"@modern-js/plugin-polyfill"
|
|
13
|
+
],
|
|
14
|
+
setup(api) {
|
|
15
|
+
const config = () => {
|
|
16
|
+
const appContext = api.useAppContext();
|
|
17
|
+
const userConfig = api.useConfigContext();
|
|
18
|
+
api.setAppContext({
|
|
19
|
+
...appContext,
|
|
20
|
+
bundlerType: bundler
|
|
21
|
+
});
|
|
22
|
+
return checkIsLegacyConfig(userConfig) ? createLegacyDefaultConfig(appContext) : createDefaultConfig(appContext, bundler);
|
|
23
|
+
};
|
|
24
|
+
const validateSchema = () => {
|
|
25
|
+
const userConfig = api.useConfigContext();
|
|
26
|
+
const schemas = checkIsLegacyConfig(userConfig) ? legacySchema : schema;
|
|
27
|
+
return schemas.generate();
|
|
28
|
+
};
|
|
29
|
+
return {
|
|
30
|
+
config,
|
|
31
|
+
validateSchema,
|
|
32
|
+
async resolvedConfig({ resolved }) {
|
|
33
|
+
var _resolved_output_distPath;
|
|
34
|
+
let appContext = api.useAppContext();
|
|
18
35
|
const userConfig = api.useConfigContext();
|
|
19
|
-
|
|
36
|
+
const port = await getServerPort(resolved);
|
|
37
|
+
appContext = {
|
|
20
38
|
...appContext,
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
resolved.autoLoadPlugins = (_normalizedConfig_autoLoadPlugins = normalizedConfig.autoLoadPlugins) !== null && _normalizedConfig_autoLoadPlugins !== void 0 ? _normalizedConfig_autoLoadPlugins : false;
|
|
52
|
-
stabilizeConfig(resolved, normalizedConfig, [
|
|
53
|
-
"source",
|
|
54
|
-
"bff",
|
|
55
|
-
"dev",
|
|
56
|
-
"html",
|
|
57
|
-
"output",
|
|
58
|
-
"tools",
|
|
59
|
-
"testing",
|
|
60
|
-
"plugins",
|
|
61
|
-
"builderPlugins",
|
|
62
|
-
"runtime",
|
|
63
|
-
"runtimeByEntries",
|
|
64
|
-
"deploy",
|
|
65
|
-
"performance"
|
|
66
|
-
]);
|
|
67
|
-
if (bundler === "webpack") {
|
|
68
|
-
resolved.security = normalizedConfig.security || {};
|
|
69
|
-
resolved.experiments = normalizedConfig.experiments;
|
|
70
|
-
}
|
|
71
|
-
return {
|
|
72
|
-
resolved
|
|
73
|
-
};
|
|
39
|
+
port,
|
|
40
|
+
distDirectory: ensureAbsolutePath(appContext.distDirectory, ((_resolved_output_distPath = resolved.output.distPath) === null || _resolved_output_distPath === void 0 ? void 0 : _resolved_output_distPath.root) || "dist")
|
|
41
|
+
};
|
|
42
|
+
api.setAppContext(appContext);
|
|
43
|
+
const normalizedConfig = checkIsLegacyConfig(resolved) ? transformNormalizedConfig(resolved) : resolved;
|
|
44
|
+
resolved._raw = userConfig;
|
|
45
|
+
resolved.server = {
|
|
46
|
+
...normalizedConfig.server || {},
|
|
47
|
+
port
|
|
48
|
+
};
|
|
49
|
+
var _normalizedConfig_autoLoadPlugins;
|
|
50
|
+
resolved.autoLoadPlugins = (_normalizedConfig_autoLoadPlugins = normalizedConfig.autoLoadPlugins) !== null && _normalizedConfig_autoLoadPlugins !== void 0 ? _normalizedConfig_autoLoadPlugins : false;
|
|
51
|
+
stabilizeConfig(resolved, normalizedConfig, [
|
|
52
|
+
"source",
|
|
53
|
+
"bff",
|
|
54
|
+
"dev",
|
|
55
|
+
"html",
|
|
56
|
+
"output",
|
|
57
|
+
"tools",
|
|
58
|
+
"testing",
|
|
59
|
+
"plugins",
|
|
60
|
+
"builderPlugins",
|
|
61
|
+
"runtime",
|
|
62
|
+
"runtimeByEntries",
|
|
63
|
+
"deploy",
|
|
64
|
+
"performance"
|
|
65
|
+
]);
|
|
66
|
+
if (bundler === "webpack") {
|
|
67
|
+
resolved.security = normalizedConfig.security || {};
|
|
68
|
+
resolved.experiments = normalizedConfig.experiments;
|
|
74
69
|
}
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
}
|
|
70
|
+
return {
|
|
71
|
+
resolved
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
});
|
|
79
77
|
function stabilizeConfig(resolve, config, keys) {
|
|
80
78
|
keys.forEach((key) => {
|
|
81
79
|
resolve[key] = config[key] || {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Entrypoint,
|
|
1
|
+
import type { Entrypoint, NestedRouteForCli, PageRoute } from '@modern-js/types';
|
|
2
2
|
export declare const getClientRoutes: ({
|
|
3
3
|
entrypoint,
|
|
4
4
|
srcDirectory,
|
|
@@ -11,4 +11,4 @@ export declare const getClientRoutes: ({
|
|
|
11
11
|
srcAlias: string;
|
|
12
12
|
internalDirectory: string;
|
|
13
13
|
internalDirAlias: string;
|
|
14
|
-
}) => (
|
|
14
|
+
}) => (NestedRouteForCli | PageRoute)[];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { NestedRouteForCli } from '@modern-js/types';
|
|
2
2
|
export declare const getRouteId: (componentPath: string, routesDir: string, entryName: string, isMainEntry: boolean) => string;
|
|
3
3
|
export declare const walk: (dirname: string, rootDir: string, alias: {
|
|
4
4
|
name: string;
|
|
5
5
|
basename: string;
|
|
6
|
-
}, entryName: string, isMainEntry: boolean) => Promise<
|
|
6
|
+
}, entryName: string, isMainEntry: boolean) => Promise<NestedRouteForCli | null>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Entrypoint,
|
|
1
|
+
import type { Entrypoint, NestedRouteForCli, PageRoute, RouteLegacy, SSRMode } from '@modern-js/types';
|
|
2
2
|
import type { AppNormalizedConfig, IAppContext, RuntimePlugin } from '../types';
|
|
3
3
|
export declare const index: ({
|
|
4
4
|
mountId,
|
|
@@ -28,7 +28,7 @@ export declare const html: (partials: {
|
|
|
28
28
|
export declare const routesForServer: ({
|
|
29
29
|
routes
|
|
30
30
|
}: {
|
|
31
|
-
routes: (
|
|
31
|
+
routes: (NestedRouteForCli | PageRoute)[];
|
|
32
32
|
}) => string;
|
|
33
33
|
export declare const fileSystemRoutes: ({
|
|
34
34
|
routes,
|
|
@@ -38,7 +38,7 @@ export declare const fileSystemRoutes: ({
|
|
|
38
38
|
internalDirectory,
|
|
39
39
|
splitRouteChunks
|
|
40
40
|
}: {
|
|
41
|
-
routes: RouteLegacy[] | (
|
|
41
|
+
routes: RouteLegacy[] | (NestedRouteForCli | PageRoute)[];
|
|
42
42
|
ssrMode?: SSRMode | undefined;
|
|
43
43
|
nestedRoutesEntry?: string | undefined;
|
|
44
44
|
entryName: string;
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import { PluginAPI } from '@modern-js/core';
|
|
2
2
|
import { DevOptions } from '../utils/types';
|
|
3
3
|
import type { AppTools } from '../types';
|
|
4
|
-
export
|
|
4
|
+
export interface ExtraServerOptions {
|
|
5
|
+
useSSRWorker?: boolean;
|
|
6
|
+
}
|
|
7
|
+
export declare const dev: (api: PluginAPI<AppTools<'shared'>>, options: DevOptions, devServerOptions?: ExtraServerOptions) => Promise<void>;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { Command } from '@modern-js/utils';
|
|
|
2
2
|
import { CliPlugin, PluginAPI } from '@modern-js/core';
|
|
3
3
|
import { AppTools } from './types';
|
|
4
4
|
export { mergeConfig } from '@modern-js/core';
|
|
5
|
+
export { dev } from './commands';
|
|
5
6
|
export * from './defineConfig';
|
|
6
7
|
export * from './types';
|
|
7
8
|
export type { RuntimeUserConfig } from './types/config';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { webpack } from '@modern-js/builder-webpack-provider';
|
|
2
2
|
import type { AsyncWaterfall, AsyncWorkflow, ParallelWorkflow } from '@modern-js/plugin';
|
|
3
|
-
import type { Entrypoint, HtmlPartials,
|
|
3
|
+
import type { Entrypoint, HtmlPartials, NestedRouteForCli, PageRoute, RouteLegacy, ServerRoute } from '@modern-js/types';
|
|
4
4
|
import type { RegisterBuildPlatformResult, DevToolData } from '@modern-js/core';
|
|
5
5
|
import type { Stats, MultiStats } from '@modern-js/builder-shared';
|
|
6
6
|
import type { Rspack } from '@modern-js/builder-rspack-provider';
|
|
@@ -43,7 +43,7 @@ export type AppToolsHooks<B extends Bundler = 'webpack'> = {
|
|
|
43
43
|
}>;
|
|
44
44
|
modifyFileSystemRoutes: AsyncWaterfall<{
|
|
45
45
|
entrypoint: Entrypoint;
|
|
46
|
-
routes: RouteLegacy[] | (
|
|
46
|
+
routes: RouteLegacy[] | (NestedRouteForCli | PageRoute)[];
|
|
47
47
|
}>;
|
|
48
48
|
modifyServerRoutes: AsyncWaterfall<{
|
|
49
49
|
routes: ServerRoute[];
|
package/package.json
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"modern",
|
|
16
16
|
"modern.js"
|
|
17
17
|
],
|
|
18
|
-
"version": "2.
|
|
18
|
+
"version": "2.28.0",
|
|
19
19
|
"jsnext:source": "./src/index.ts",
|
|
20
20
|
"types": "./dist/types/index.d.ts",
|
|
21
21
|
"main": "./dist/cjs/index.js",
|
|
@@ -73,24 +73,24 @@
|
|
|
73
73
|
"esbuild": "0.17.19",
|
|
74
74
|
"rspack-plugin-virtual-module": "0.1.0",
|
|
75
75
|
"@swc/helpers": "0.5.1",
|
|
76
|
-
"@modern-js/builder": "2.
|
|
77
|
-
"@modern-js/builder-plugin-esbuild": "2.
|
|
78
|
-
"@modern-js/builder-plugin-node-polyfill": "2.
|
|
79
|
-
"@modern-js/builder-shared": "2.
|
|
80
|
-
"@modern-js/builder-webpack-provider": "2.
|
|
81
|
-
"@modern-js/core": "2.
|
|
82
|
-
"@modern-js/new-action": "2.
|
|
83
|
-
"@modern-js/node-bundle-require": "2.
|
|
84
|
-
"@modern-js/plugin": "2.
|
|
85
|
-
"@modern-js/plugin-data-loader": "2.
|
|
86
|
-
"@modern-js/plugin-i18n": "2.
|
|
87
|
-
"@modern-js/plugin-lint": "2.
|
|
88
|
-
"@modern-js/prod-server": "2.
|
|
89
|
-
"@modern-js/server": "2.
|
|
90
|
-
"@modern-js/types": "2.
|
|
91
|
-
"@modern-js/upgrade": "2.
|
|
92
|
-
"@modern-js/utils": "2.
|
|
93
|
-
"@modern-js/server-core": "2.
|
|
76
|
+
"@modern-js/builder": "2.28.0",
|
|
77
|
+
"@modern-js/builder-plugin-esbuild": "2.28.0",
|
|
78
|
+
"@modern-js/builder-plugin-node-polyfill": "2.28.0",
|
|
79
|
+
"@modern-js/builder-shared": "2.28.0",
|
|
80
|
+
"@modern-js/builder-webpack-provider": "2.28.0",
|
|
81
|
+
"@modern-js/core": "2.28.0",
|
|
82
|
+
"@modern-js/new-action": "2.28.0",
|
|
83
|
+
"@modern-js/node-bundle-require": "2.28.0",
|
|
84
|
+
"@modern-js/plugin": "2.28.0",
|
|
85
|
+
"@modern-js/plugin-data-loader": "2.28.0",
|
|
86
|
+
"@modern-js/plugin-i18n": "2.28.0",
|
|
87
|
+
"@modern-js/plugin-lint": "2.28.0",
|
|
88
|
+
"@modern-js/prod-server": "2.28.0",
|
|
89
|
+
"@modern-js/server": "2.28.0",
|
|
90
|
+
"@modern-js/types": "2.28.0",
|
|
91
|
+
"@modern-js/upgrade": "2.28.0",
|
|
92
|
+
"@modern-js/utils": "2.28.0",
|
|
93
|
+
"@modern-js/server-core": "2.28.0"
|
|
94
94
|
},
|
|
95
95
|
"devDependencies": {
|
|
96
96
|
"@types/babel__traverse": "^7.14.2",
|
|
@@ -99,13 +99,13 @@
|
|
|
99
99
|
"jest": "^29",
|
|
100
100
|
"typescript": "^5",
|
|
101
101
|
"webpack": "^5.88.1",
|
|
102
|
-
"@modern-js/builder-plugin-swc": "2.
|
|
103
|
-
"@modern-js/builder-rspack-provider": "2.
|
|
104
|
-
"@scripts/build": "2.
|
|
105
|
-
"@scripts/jest-config": "2.
|
|
102
|
+
"@modern-js/builder-plugin-swc": "2.28.0",
|
|
103
|
+
"@modern-js/builder-rspack-provider": "2.28.0",
|
|
104
|
+
"@scripts/build": "2.28.0",
|
|
105
|
+
"@scripts/jest-config": "2.28.0"
|
|
106
106
|
},
|
|
107
107
|
"peerDependencies": {
|
|
108
|
-
"@modern-js/builder-rspack-provider": "^2.
|
|
108
|
+
"@modern-js/builder-rspack-provider": "^2.28.0"
|
|
109
109
|
},
|
|
110
110
|
"peerDependenciesMeta": {
|
|
111
111
|
"@modern-js/builder-rspack-provider": {
|