@modern-js/app-tools 2.63.0 → 2.63.1
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/commands/dev.js +1 -1
- package/dist/cjs/commands/serve.js +1 -1
- package/dist/cjs/new/compat/hooks.js +11 -4
- package/dist/cjs/new/compat/utils.js +10 -1
- package/dist/cjs/new/context.js +0 -1
- package/dist/cjs/plugins/analyze/getBundleEntry.js +2 -2
- package/dist/cjs/plugins/analyze/getFileSystemEntry.js +9 -9
- package/dist/cjs/plugins/analyze/getHtmlTemplate.js +51 -25
- package/dist/cjs/plugins/analyze/index.js +128 -130
- package/dist/cjs/plugins/deploy/index.js +12 -14
- package/dist/cjs/plugins/initialize/index.js +1 -1
- package/dist/cjs/utils/printInstructions.js +12 -3
- package/dist/cjs/utils/restart.js +2 -1
- package/dist/esm/commands/dev.js +2 -2
- package/dist/esm/commands/serve.js +2 -2
- package/dist/esm/new/compat/hooks.js +27 -17
- package/dist/esm/new/compat/utils.js +10 -1
- package/dist/esm/new/context.js +0 -1
- package/dist/esm/plugins/analyze/getBundleEntry.js +3 -3
- package/dist/esm/plugins/analyze/getFileSystemEntry.js +12 -12
- package/dist/esm/plugins/analyze/getHtmlTemplate.js +101 -28
- package/dist/esm/plugins/analyze/index.js +328 -331
- package/dist/esm/plugins/deploy/index.js +84 -88
- package/dist/esm/plugins/initialize/index.js +1 -1
- package/dist/esm/utils/printInstructions.js +29 -2
- package/dist/esm/utils/restart.js +2 -1
- package/dist/esm-node/commands/dev.js +2 -2
- package/dist/esm-node/commands/serve.js +2 -2
- package/dist/esm-node/new/compat/hooks.js +11 -4
- package/dist/esm-node/new/compat/utils.js +10 -1
- package/dist/esm-node/new/context.js +0 -1
- package/dist/esm-node/plugins/analyze/getBundleEntry.js +2 -2
- package/dist/esm-node/plugins/analyze/getFileSystemEntry.js +9 -9
- package/dist/esm-node/plugins/analyze/getHtmlTemplate.js +49 -24
- package/dist/esm-node/plugins/analyze/index.js +128 -130
- package/dist/esm-node/plugins/deploy/index.js +12 -14
- package/dist/esm-node/plugins/initialize/index.js +1 -1
- package/dist/esm-node/utils/printInstructions.js +10 -2
- package/dist/esm-node/utils/restart.js +2 -1
- package/dist/types/builder/generator/adapterCopy.d.ts +2 -1
- package/dist/types/builder/generator/createBuilderProviderConfig.d.ts +3 -2
- package/dist/types/builder/generator/createCopyPattern.d.ts +4 -3
- package/dist/types/builder/generator/getBuilderEnvironments.d.ts +2 -2
- package/dist/types/builder/index.d.ts +1 -1
- package/dist/types/builder/shared/createCopyInfo.d.ts +3 -2
- package/dist/types/builder/shared/types.d.ts +3 -2
- package/dist/types/config/initialize/index.d.ts +3 -2
- package/dist/types/config/initialize/inits.d.ts +4 -3
- package/dist/types/new/context.d.ts +0 -1
- package/dist/types/plugins/analyze/getBundleEntry.d.ts +3 -3
- package/dist/types/plugins/analyze/getFileSystemEntry.d.ts +3 -3
- package/dist/types/plugins/analyze/getHtmlTemplate.d.ts +26 -5
- package/dist/types/plugins/analyze/getServerRoutes.d.ts +2 -2
- package/dist/types/plugins/analyze/index.d.ts +2 -3
- package/dist/types/plugins/deploy/index.d.ts +2 -3
- package/dist/types/plugins/deploy/platforms/platform.d.ts +3 -3
- package/dist/types/plugins/deploy/utils.d.ts +2 -2
- package/dist/types/types/new.d.ts +38 -21
- package/dist/types/utils/printInstructions.d.ts +3 -1
- package/dist/types/utils/routes.d.ts +2 -1
- package/package.json +20 -20
@@ -16,147 +16,145 @@ var analyze_default = ({ bundler }) => ({
|
|
16
16
|
setup: (api) => {
|
17
17
|
let pagesDir = [];
|
18
18
|
let nestedRouteEntries = [];
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
fs.emptydirSync(appContext.internalDirectory);
|
28
|
-
}
|
29
|
-
} catch {
|
30
|
-
}
|
31
|
-
const apiOnly = await isApiOnly(appContext.appDirectory, (_resolvedConfig_source = resolvedConfig.source) === null || _resolvedConfig_source === void 0 ? void 0 : _resolvedConfig_source.entriesDir, appContext.apiDirectory);
|
32
|
-
await hookRunners.addRuntimeExports();
|
33
|
-
if (apiOnly) {
|
34
|
-
const { routes: routes2 } = await hookRunners.modifyServerRoutes({
|
35
|
-
routes: []
|
36
|
-
});
|
37
|
-
debug(`server routes: %o`, routes2);
|
38
|
-
appContext = {
|
39
|
-
...api.useAppContext(),
|
40
|
-
apiOnly,
|
41
|
-
serverRoutes: routes2
|
42
|
-
};
|
43
|
-
api.setAppContext(appContext);
|
44
|
-
return;
|
19
|
+
api.onPrepare(async () => {
|
20
|
+
var _resolvedConfig_source;
|
21
|
+
let appContext = api.getAppContext();
|
22
|
+
const resolvedConfig = api.getNormalizedConfig();
|
23
|
+
const hooks = api.getHooks();
|
24
|
+
try {
|
25
|
+
if (checkIsBuildCommands()) {
|
26
|
+
fs.emptydirSync(appContext.internalDirectory);
|
45
27
|
}
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
const {
|
52
|
-
|
28
|
+
} catch {
|
29
|
+
}
|
30
|
+
const apiOnly = await isApiOnly(appContext.appDirectory, (_resolvedConfig_source = resolvedConfig.source) === null || _resolvedConfig_source === void 0 ? void 0 : _resolvedConfig_source.entriesDir, appContext.apiDirectory);
|
31
|
+
await hooks.addRuntimeExports.call();
|
32
|
+
if (apiOnly) {
|
33
|
+
const { routes: routes2 } = await hooks.modifyServerRoutes.call({
|
34
|
+
routes: []
|
53
35
|
});
|
54
|
-
debug(`
|
55
|
-
|
56
|
-
|
57
|
-
|
36
|
+
debug(`server routes: %o`, routes2);
|
37
|
+
api.updateAppContext({
|
38
|
+
apiOnly,
|
39
|
+
serverRoutes: routes2
|
58
40
|
});
|
59
|
-
|
60
|
-
|
41
|
+
return;
|
42
|
+
}
|
43
|
+
const [{ getBundleEntry }, { getServerRoutes }, { getHtmlTemplate }] = await Promise.all([
|
44
|
+
import("./getBundleEntry.js"),
|
45
|
+
import("./getServerRoutes.js"),
|
46
|
+
import("./getHtmlTemplate.js")
|
47
|
+
]);
|
48
|
+
const { entrypoints } = await hooks.modifyEntrypoints.call({
|
49
|
+
entrypoints: await getBundleEntry(hooks, appContext, resolvedConfig)
|
50
|
+
});
|
51
|
+
debug(`entrypoints: %o`, entrypoints);
|
52
|
+
const initialRoutes = getServerRoutes(entrypoints, {
|
53
|
+
appContext,
|
54
|
+
config: resolvedConfig
|
55
|
+
});
|
56
|
+
const { routes } = await hooks.modifyServerRoutes.call({
|
57
|
+
routes: initialRoutes
|
58
|
+
});
|
59
|
+
debug(`server routes: %o`, routes);
|
60
|
+
appContext = {
|
61
|
+
...api.getAppContext(),
|
62
|
+
entrypoints,
|
63
|
+
serverRoutes: routes
|
64
|
+
};
|
65
|
+
api.updateAppContext(appContext);
|
66
|
+
nestedRouteEntries = entrypoints.map((point) => point.nestedRoutesEntry).filter(Boolean);
|
67
|
+
pagesDir = entrypoints.map((point) => point.entry).filter((entry) => entry && !path.extname(entry)).concat(nestedRouteEntries);
|
68
|
+
const { partialsByEntrypoint, htmlTemplates } = await getHtmlTemplate(entrypoints, hooks, {
|
69
|
+
appContext,
|
70
|
+
config: resolvedConfig
|
71
|
+
});
|
72
|
+
debug(`html templates: %o`, htmlTemplates);
|
73
|
+
api.updateAppContext({
|
74
|
+
partialsByEntrypoint
|
75
|
+
});
|
76
|
+
let checkedEntries = entrypoints.map((point) => point.entryName);
|
77
|
+
if (isDevCommand()) {
|
78
|
+
const { entry } = minimist(getArgv());
|
79
|
+
checkedEntries = await getSelectedEntries(typeof entry === "string" ? entry.split(",") : entry, entrypoints);
|
80
|
+
}
|
81
|
+
appContext = {
|
82
|
+
...api.getAppContext(),
|
83
|
+
entrypoints,
|
84
|
+
checkedEntries,
|
85
|
+
apiOnly,
|
86
|
+
serverRoutes: routes,
|
87
|
+
htmlTemplates
|
88
|
+
};
|
89
|
+
api.updateAppContext(appContext);
|
90
|
+
if (checkIsBuildCommands()) {
|
91
|
+
await hooks.generateEntryCode.call({
|
92
|
+
entrypoints
|
61
93
|
});
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
};
|
68
|
-
api.setAppContext(appContext);
|
69
|
-
nestedRouteEntries = entrypoints.map((point) => point.nestedRoutesEntry).filter(Boolean);
|
70
|
-
pagesDir = entrypoints.map((point) => point.entry).filter((entry) => entry && !path.extname(entry)).concat(nestedRouteEntries);
|
71
|
-
const htmlTemplates = await getHtmlTemplate(entrypoints, api, {
|
72
|
-
appContext,
|
73
|
-
config: resolvedConfig
|
94
|
+
const normalizedConfig = api.getNormalizedConfig();
|
95
|
+
const createBuilderForModern = await createBuilderGenerator(bundler);
|
96
|
+
const builder = await createBuilderForModern({
|
97
|
+
normalizedConfig,
|
98
|
+
appContext
|
74
99
|
});
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
apiOnly,
|
86
|
-
serverRoutes: routes,
|
87
|
-
htmlTemplates
|
88
|
-
};
|
89
|
-
api.setAppContext(appContext);
|
90
|
-
if (checkIsBuildCommands()) {
|
91
|
-
await hookRunners.generateEntryCode({
|
92
|
-
entrypoints
|
93
|
-
});
|
94
|
-
const normalizedConfig = api.useResolvedConfigContext();
|
95
|
-
const createBuilderForModern = await createBuilderGenerator(bundler);
|
96
|
-
const builder = await createBuilderForModern({
|
97
|
-
normalizedConfig,
|
98
|
-
appContext
|
99
|
-
});
|
100
|
-
builder.onBeforeBuild(async ({ bundlerConfigs, isFirstCompile }) => {
|
101
|
-
if (!isFirstCompile) {
|
102
|
-
return;
|
103
|
-
}
|
104
|
-
const hookRunners2 = api.useHookRunners();
|
105
|
-
await generateRoutes(appContext);
|
106
|
-
await hookRunners2.beforeBuild({
|
107
|
-
bundlerConfigs
|
108
|
-
});
|
100
|
+
builder.onBeforeBuild(async ({ bundlerConfigs, isFirstCompile, environments, isWatch }) => {
|
101
|
+
if (!isFirstCompile) {
|
102
|
+
return;
|
103
|
+
}
|
104
|
+
await generateRoutes(appContext);
|
105
|
+
await hooks.onBeforeBuild.call({
|
106
|
+
isFirstCompile,
|
107
|
+
isWatch,
|
108
|
+
environments,
|
109
|
+
bundlerConfigs
|
109
110
|
});
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
111
|
+
});
|
112
|
+
builder.onAfterBuild(async ({ stats, environments, isFirstCompile, isWatch }) => {
|
113
|
+
await hooks.onAfterBuild.call({
|
114
|
+
stats,
|
115
|
+
environments,
|
116
|
+
isFirstCompile,
|
117
|
+
isWatch
|
116
118
|
});
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
if (isFirstCompile) {
|
123
|
-
printInstructions(hookRunners2, appContext, normalizedConfig);
|
124
|
-
}
|
119
|
+
await emitResolvedConfig(appContext.appDirectory, normalizedConfig);
|
120
|
+
});
|
121
|
+
builder.onDevCompileDone(async ({ isFirstCompile }) => {
|
122
|
+
hooks.onAfterDev.call({
|
123
|
+
isFirstCompile
|
125
124
|
});
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
125
|
+
if (isFirstCompile) {
|
126
|
+
printInstructions(hooks, appContext, normalizedConfig);
|
127
|
+
}
|
128
|
+
});
|
129
|
+
builder.onBeforeCreateCompiler(async ({ bundlerConfigs, environments }) => {
|
130
|
+
await hooks.onBeforeCreateCompiler.call({
|
131
|
+
environments,
|
132
|
+
bundlerConfigs
|
131
133
|
});
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
134
|
+
});
|
135
|
+
builder.onAfterCreateCompiler(async ({ compiler, environments }) => {
|
136
|
+
await hooks.onAfterCreateCompiler.call({
|
137
|
+
environments,
|
138
|
+
compiler
|
137
139
|
});
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
api.setAppContext(appContext);
|
144
|
-
}
|
145
|
-
},
|
146
|
-
watchFiles() {
|
147
|
-
return {
|
148
|
-
files: pagesDir,
|
149
|
-
isPrivate: true
|
150
|
-
};
|
151
|
-
},
|
152
|
-
resolvedConfig({ resolved }) {
|
153
|
-
const appContext = api.useAppContext();
|
154
|
-
const config = initialNormalizedConfig(resolved, appContext, bundler);
|
155
|
-
return {
|
156
|
-
resolved: config
|
157
|
-
};
|
140
|
+
});
|
141
|
+
builder.addPlugins(resolvedConfig.builderPlugins);
|
142
|
+
api.updateAppContext({
|
143
|
+
builder
|
144
|
+
});
|
158
145
|
}
|
159
|
-
};
|
146
|
+
});
|
147
|
+
api.addWatchFiles(() => {
|
148
|
+
return {
|
149
|
+
files: pagesDir,
|
150
|
+
isPrivate: true
|
151
|
+
};
|
152
|
+
});
|
153
|
+
api.modifyResolvedConfig((resolved) => {
|
154
|
+
const appContext = api.getAppContext();
|
155
|
+
const config = initialNormalizedConfig(resolved, appContext, bundler);
|
156
|
+
return config;
|
157
|
+
});
|
160
158
|
}
|
161
159
|
});
|
162
160
|
export {
|
@@ -22,21 +22,19 @@ var deploy_default = () => ({
|
|
22
22
|
name: "@modern-js/plugin-deploy",
|
23
23
|
setup: (api) => {
|
24
24
|
const deployTarget = process.env.MODERNJS_DEPLOY || provider || "node";
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
return;
|
31
|
-
}
|
32
|
-
const modernConfig = api.useResolvedConfigContext();
|
33
|
-
const deployPreset = await getDeployPreset(appContext, modernConfig, deployTarget);
|
34
|
-
(deployPreset === null || deployPreset === void 0 ? void 0 : deployPreset.prepare) && await (deployPreset === null || deployPreset === void 0 ? void 0 : deployPreset.prepare());
|
35
|
-
(deployPreset === null || deployPreset === void 0 ? void 0 : deployPreset.writeOutput) && await (deployPreset === null || deployPreset === void 0 ? void 0 : deployPreset.writeOutput());
|
36
|
-
(deployPreset === null || deployPreset === void 0 ? void 0 : deployPreset.genEntry) && await (deployPreset === null || deployPreset === void 0 ? void 0 : deployPreset.genEntry());
|
37
|
-
(deployPreset === null || deployPreset === void 0 ? void 0 : deployPreset.end) && await (deployPreset === null || deployPreset === void 0 ? void 0 : deployPreset.end());
|
25
|
+
api.deploy(async () => {
|
26
|
+
const appContext = api.getAppContext();
|
27
|
+
const { metaName } = appContext;
|
28
|
+
if (metaName !== "modern-js" && !process.env.MODERNJS_DEPLOY) {
|
29
|
+
return;
|
38
30
|
}
|
39
|
-
|
31
|
+
const modernConfig = api.getNormalizedConfig();
|
32
|
+
const deployPreset = await getDeployPreset(appContext, modernConfig, deployTarget);
|
33
|
+
(deployPreset === null || deployPreset === void 0 ? void 0 : deployPreset.prepare) && await (deployPreset === null || deployPreset === void 0 ? void 0 : deployPreset.prepare());
|
34
|
+
(deployPreset === null || deployPreset === void 0 ? void 0 : deployPreset.writeOutput) && await (deployPreset === null || deployPreset === void 0 ? void 0 : deployPreset.writeOutput());
|
35
|
+
(deployPreset === null || deployPreset === void 0 ? void 0 : deployPreset.genEntry) && await (deployPreset === null || deployPreset === void 0 ? void 0 : deployPreset.genEntry());
|
36
|
+
(deployPreset === null || deployPreset === void 0 ? void 0 : deployPreset.end) && await (deployPreset === null || deployPreset === void 0 ? void 0 : deployPreset.end());
|
37
|
+
});
|
40
38
|
}
|
41
39
|
});
|
42
40
|
export {
|
@@ -27,7 +27,7 @@ var initialize_default = ({ bundler }) => ({
|
|
27
27
|
appContext = {
|
28
28
|
...appContext,
|
29
29
|
port,
|
30
|
-
distDirectory: ensureAbsolutePath(appContext.
|
30
|
+
distDirectory: ensureAbsolutePath(appContext.appDirectory, ((_resolved_output_distPath = resolved.output.distPath) === null || _resolved_output_distPath === void 0 ? void 0 : _resolved_output_distPath.root) || "dist")
|
31
31
|
};
|
32
32
|
api.updateAppContext(appContext);
|
33
33
|
const normalizedConfig = checkIsLegacyConfig(resolved) ? transformNormalizedConfig(resolved) : resolved;
|
@@ -1,5 +1,12 @@
|
|
1
1
|
import { logger, prettyInstructions } from "@modern-js/utils";
|
2
|
-
const printInstructions = async (
|
2
|
+
const printInstructions = async (hooks, appContext, config) => {
|
3
|
+
const message = prettyInstructions(appContext, config);
|
4
|
+
const { instructions } = await hooks.onBeforePrintInstructions.call({
|
5
|
+
instructions: message
|
6
|
+
});
|
7
|
+
logger.log(instructions);
|
8
|
+
};
|
9
|
+
const printInstructionsCompat = async (hookRunners, appContext, config) => {
|
3
10
|
const message = prettyInstructions(appContext, config);
|
4
11
|
const { instructions } = await hookRunners.beforePrintInstructions({
|
5
12
|
instructions: message
|
@@ -7,5 +14,6 @@ const printInstructions = async (hookRunners, appContext, config) => {
|
|
7
14
|
logger.log(instructions);
|
8
15
|
};
|
9
16
|
export {
|
10
|
-
printInstructions
|
17
|
+
printInstructions,
|
18
|
+
printInstructionsCompat
|
11
19
|
};
|
@@ -1,5 +1,6 @@
|
|
1
1
|
import { cli } from "@modern-js/plugin-v2/cli";
|
2
|
-
import { chalk, clearConsole, getFullArgv, logger
|
2
|
+
import { chalk, clearConsole, getFullArgv, logger } from "@modern-js/utils";
|
3
|
+
import { program } from "@modern-js/utils/commander";
|
3
4
|
async function restart(hooksRunner, filename) {
|
4
5
|
clearConsole();
|
5
6
|
logger.info(`Restart because ${chalk.yellow(filename)} is changed...
|
@@ -1,3 +1,4 @@
|
|
1
1
|
import type { RsbuildPlugin } from '@modern-js/uni-builder';
|
2
|
+
import type { Bundler } from '../../types';
|
2
3
|
import type { BuilderOptions } from '../shared';
|
3
|
-
export declare const builderPluginAdapterCopy: (options: BuilderOptions<
|
4
|
+
export declare const builderPluginAdapterCopy: <B extends Bundler>(options: BuilderOptions<B>) => RsbuildPlugin;
|
@@ -1,2 +1,3 @@
|
|
1
|
-
import type { AppNormalizedConfig, Bundler
|
2
|
-
|
1
|
+
import type { AppNormalizedConfig, Bundler } from '../../types';
|
2
|
+
import type { AppToolsContext } from '../../types/new';
|
3
|
+
export declare function createBuilderProviderConfig<B extends Bundler>(resolveConfig: AppNormalizedConfig<B>, appContext: AppToolsContext<B>): Omit<AppNormalizedConfig<B>, 'plugins'>;
|
@@ -1,7 +1,8 @@
|
|
1
1
|
/// <reference types="node" />
|
2
2
|
import type { Rspack, RspackChain } from '@rsbuild/core';
|
3
|
-
import type { AppNormalizedConfig, Bundler
|
4
|
-
|
3
|
+
import type { AppNormalizedConfig, Bundler } from '../../types';
|
4
|
+
import type { AppToolsContext } from '../../types/new';
|
5
|
+
export declare function createPublicPattern<B extends Bundler>(appContext: AppToolsContext<B>, config: AppNormalizedConfig, chain: RspackChain): {
|
5
6
|
info: (file: {
|
6
7
|
sourceFilename: string;
|
7
8
|
}) => {
|
@@ -13,4 +14,4 @@ export declare function createPublicPattern(appContext: IAppContext, config: App
|
|
13
14
|
noErrorOnMissing: boolean;
|
14
15
|
transform: (content: Buffer, absoluteFrom: string) => string | Buffer;
|
15
16
|
};
|
16
|
-
export declare function createUploadPattern<B extends Bundler>(appContext:
|
17
|
+
export declare function createUploadPattern<B extends Bundler>(appContext: AppToolsContext<B>, config: AppNormalizedConfig<B>): Rspack.CopyRspackPluginOptions['patterns']['0'];
|
@@ -1,6 +1,6 @@
|
|
1
|
-
import type { IAppContext } from '@modern-js/core';
|
2
1
|
import type { AppNormalizedConfig, Bundler } from '../../types';
|
3
|
-
|
2
|
+
import type { AppToolsContext } from '../../types/new';
|
3
|
+
export declare function getBuilderEnvironments<B extends Bundler>(normalizedConfig: AppNormalizedConfig<B>, appContext: AppToolsContext<B>, tempBuilderConfig: Omit<AppNormalizedConfig<B>, 'plugins'>): {
|
4
4
|
environments: {
|
5
5
|
[name: string]: import("@rsbuild/core").EnvironmentConfig;
|
6
6
|
};
|
@@ -1 +1 @@
|
|
1
|
-
export declare function createBuilderGenerator(bundler: 'webpack' | 'rspack'): Promise<typeof import("./builder-rspack/index.js").createRspackBuilderForModern>;
|
1
|
+
export declare function createBuilderGenerator(bundler: 'webpack' | 'rspack'): Promise<typeof import("./builder-rspack/index.js").createRspackBuilderForModern | typeof import("./builder-webpack/index.js").createWebpackBuilderForModern>;
|
@@ -1,5 +1,6 @@
|
|
1
|
-
import type { AppNormalizedConfig,
|
2
|
-
|
1
|
+
import type { AppNormalizedConfig, Bundler } from '../../types';
|
2
|
+
import type { AppToolsContext } from '../../types/new';
|
3
|
+
export declare function createCopyInfo<B extends Bundler>(appContext: AppToolsContext<B>, config: AppNormalizedConfig<B>): {
|
3
4
|
configDir: string;
|
4
5
|
uploadDir: string;
|
5
6
|
publicDir: string;
|
@@ -1,5 +1,6 @@
|
|
1
|
-
import type { AppNormalizedConfig, Bundler
|
1
|
+
import type { AppNormalizedConfig, Bundler } from '../../types';
|
2
|
+
import type { AppToolsContext } from '../../types/new';
|
2
3
|
export type BuilderOptions<B extends Bundler> = {
|
3
4
|
normalizedConfig: AppNormalizedConfig<B>;
|
4
|
-
appContext:
|
5
|
+
appContext: AppToolsContext<B>;
|
5
6
|
};
|
@@ -1,2 +1,3 @@
|
|
1
|
-
import type { AppNormalizedConfig
|
2
|
-
|
1
|
+
import type { AppNormalizedConfig } from '../../types';
|
2
|
+
import type { AppToolsContext } from '../../types/new';
|
3
|
+
export declare function initialNormalizedConfig(config: AppNormalizedConfig<'shared'>, appContext: AppToolsContext<'shared'>, bundler: 'webpack' | 'rspack'): AppNormalizedConfig<'shared'>;
|
@@ -1,4 +1,5 @@
|
|
1
|
-
import type { AppNormalizedConfig
|
2
|
-
|
3
|
-
export declare function
|
1
|
+
import type { AppNormalizedConfig } from '../../types';
|
2
|
+
import type { AppToolsContext } from '../../types/new';
|
3
|
+
export declare function initHtmlConfig(config: AppNormalizedConfig<'shared'>, appContext: AppToolsContext<'shared'>): AppNormalizedConfig<'shared'>['html'];
|
4
|
+
export declare function initSourceConfig(config: AppNormalizedConfig<'shared'>, appContext: AppToolsContext<'shared'>, bundler: 'webpack' | 'rspack'): void;
|
4
5
|
export declare function createBuilderModuleScope(config: AppNormalizedConfig<'webpack'>): (string | RegExp)[] | undefined;
|
@@ -20,7 +20,6 @@ export declare const initAppContext: ({ appDirectory, runtimeConfigFile, options
|
|
20
20
|
apiDirectory: string;
|
21
21
|
lambdaDirectory: string;
|
22
22
|
sharedDirectory: string;
|
23
|
-
distDirectory: string;
|
24
23
|
serverPlugins: never[];
|
25
24
|
internalDirectory: string;
|
26
25
|
htmlTemplates: {};
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import type { CliHooksRunner } from '@modern-js/core';
|
2
1
|
import type { Entrypoint } from '@modern-js/types';
|
3
|
-
import type { AppNormalizedConfig
|
4
|
-
|
2
|
+
import type { AppNormalizedConfig } from '../../types';
|
3
|
+
import type { AppToolsContext, AppToolsHooks } from '../../types/new';
|
4
|
+
export declare const getBundleEntry: (hooks: AppToolsHooks<'shared'>, appContext: AppToolsContext<'shared'>, config: AppNormalizedConfig<'shared'>) => Promise<Entrypoint[]>;
|
@@ -1,5 +1,5 @@
|
|
1
|
-
import type { CliHooksRunner } from '@modern-js/core';
|
2
1
|
import type { Entrypoint } from '@modern-js/types';
|
3
|
-
import type { AppNormalizedConfig
|
2
|
+
import type { AppNormalizedConfig } from '../../types';
|
3
|
+
import type { AppToolsContext, AppToolsHooks } from '../../types/new';
|
4
4
|
export type { Entrypoint };
|
5
|
-
export declare const getFileSystemEntry: (
|
5
|
+
export declare const getFileSystemEntry: (hooks: AppToolsHooks<'shared'>, appContext: AppToolsContext<'shared'>, config: AppNormalizedConfig<'shared'>) => Promise<Entrypoint[]>;
|
@@ -1,6 +1,27 @@
|
|
1
|
-
import type { Entrypoint, HtmlTemplates } from '@modern-js/types';
|
2
|
-
import type { AppNormalizedConfig
|
3
|
-
|
4
|
-
|
1
|
+
import type { Entrypoint, HtmlPartials, HtmlTemplates } from '@modern-js/types';
|
2
|
+
import type { AppNormalizedConfig } from '../../types';
|
3
|
+
import type { AppToolsContext, AppToolsHooks } from '../../types/new';
|
4
|
+
export declare const getModifyHtmlPartials: (partials: Record<keyof HtmlPartials, string[]>) => {
|
5
|
+
top: {
|
6
|
+
append: (...script: string[]) => void;
|
7
|
+
prepend: (...script: string[]) => void;
|
8
|
+
current: string[];
|
9
|
+
};
|
10
|
+
head: {
|
11
|
+
append: (...script: string[]) => void;
|
12
|
+
prepend: (...script: string[]) => void;
|
13
|
+
current: string[];
|
14
|
+
};
|
15
|
+
body: {
|
16
|
+
append: (...script: string[]) => void;
|
17
|
+
prepend: (...script: string[]) => void;
|
18
|
+
current: string[];
|
19
|
+
};
|
20
|
+
};
|
21
|
+
export declare const getHtmlTemplate: (entrypoints: Entrypoint[], hooks: AppToolsHooks<'shared'>, { appContext, config, }: {
|
22
|
+
appContext: AppToolsContext<'shared'>;
|
5
23
|
config: AppNormalizedConfig<'shared'>;
|
6
|
-
}) => Promise<
|
24
|
+
}) => Promise<{
|
25
|
+
partialsByEntrypoint: Record<string, HtmlPartials>;
|
26
|
+
htmlTemplates: HtmlTemplates;
|
27
|
+
}>;
|
@@ -1,7 +1,7 @@
|
|
1
|
-
import type { IAppContext } from '@modern-js/core';
|
2
1
|
import type { Entrypoint, ServerRoute } from '@modern-js/types';
|
3
2
|
import type { AppNormalizedConfig } from '../../types';
|
3
|
+
import type { AppToolsContext } from '../../types/new';
|
4
4
|
export declare const getServerRoutes: (entrypoints: Entrypoint[], { appContext, config, }: {
|
5
|
-
appContext:
|
5
|
+
appContext: AppToolsContext<'shared'>;
|
6
6
|
config: AppNormalizedConfig<'shared'>;
|
7
7
|
}) => ServerRoute[];
|
@@ -1,6 +1,5 @@
|
|
1
|
-
import type {
|
2
|
-
import type { AppTools } from '../../types';
|
1
|
+
import type { AppTools, CliPluginFuture } from '../../types';
|
3
2
|
declare const _default: ({ bundler, }: {
|
4
3
|
bundler: 'webpack' | 'rspack';
|
5
|
-
}) =>
|
4
|
+
}) => CliPluginFuture<AppTools<'shared'>>;
|
6
5
|
export default _default;
|
@@ -1,4 +1,3 @@
|
|
1
|
-
import type {
|
2
|
-
|
3
|
-
declare const _default: () => CliPlugin<AppTools>;
|
1
|
+
import type { AppTools, CliPluginFuture } from '../../types';
|
2
|
+
declare const _default: () => CliPluginFuture<AppTools<'shared'>>;
|
4
3
|
export default _default;
|
@@ -1,6 +1,6 @@
|
|
1
|
-
import type {
|
2
|
-
import type {
|
3
|
-
export type CreatePreset = (appContext:
|
1
|
+
import type { AppToolsNormalizedConfig } from '../../../types';
|
2
|
+
import type { AppToolsContext } from '../../../types/new';
|
3
|
+
export type CreatePreset = (appContext: AppToolsContext<'shared'>, config: AppToolsNormalizedConfig, needModernServer?: boolean) => DeployPreset;
|
4
4
|
type DeployPreset = {
|
5
5
|
prepare?: () => Promise<void>;
|
6
6
|
writeOutput?: () => Promise<void>;
|
@@ -1,11 +1,11 @@
|
|
1
|
-
import type {
|
1
|
+
import type { AppToolsContext } from '../../types/new';
|
2
2
|
export type ServerAppContext = {
|
3
3
|
sharedDirectory: string;
|
4
4
|
apiDirectory: string;
|
5
5
|
lambdaDirectory: string;
|
6
6
|
metaName: string;
|
7
7
|
};
|
8
|
-
export declare const serverAppContenxtTemplate: (appContext:
|
8
|
+
export declare const serverAppContenxtTemplate: (appContext: AppToolsContext<'shared'>) => {
|
9
9
|
sharedDirectory: string;
|
10
10
|
apiDirectory: string;
|
11
11
|
lambdaDirectory: string;
|