@gravity-ui/app-builder 0.23.1-beta.0 → 0.24.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/commands/build/build-service/client.js +1 -1
- package/dist/commands/dev/client.js +4 -0
- package/dist/common/models/index.d.ts +1 -0
- package/dist/common/webpack/compile.d.ts +1 -1
- package/dist/common/webpack/compile.js +15 -3
- package/dist/common/webpack/config.d.ts +2 -0
- package/dist/common/webpack/config.js +12 -9
- package/package.json +1 -1
|
@@ -3,5 +3,5 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.buildClient = buildClient;
|
|
4
4
|
const compile_1 = require("../../../common/webpack/compile");
|
|
5
5
|
function buildClient(config) {
|
|
6
|
-
return (0, compile_1.clientCompile)(config.client);
|
|
6
|
+
return (0, compile_1.clientCompile)(config.client, config.configPath);
|
|
7
7
|
}
|
|
@@ -60,6 +60,7 @@ async function buildDevServer(config) {
|
|
|
60
60
|
await (0, config_1.webpackConfigFactory)({
|
|
61
61
|
webpackMode: "development" /* WebpackMode.Dev */,
|
|
62
62
|
config: normalizedConfig,
|
|
63
|
+
configPath: config.configPath,
|
|
63
64
|
logger,
|
|
64
65
|
}),
|
|
65
66
|
];
|
|
@@ -68,6 +69,7 @@ async function buildDevServer(config) {
|
|
|
68
69
|
webpackConfigs.push(await (0, config_1.webpackConfigFactory)({
|
|
69
70
|
webpackMode: "development" /* WebpackMode.Dev */,
|
|
70
71
|
config: normalizedConfig,
|
|
72
|
+
configPath: config.configPath,
|
|
71
73
|
logger: ssrLogger,
|
|
72
74
|
isSsr,
|
|
73
75
|
}));
|
|
@@ -78,6 +80,7 @@ async function buildDevServer(config) {
|
|
|
78
80
|
await (0, config_1.rspackConfigFactory)({
|
|
79
81
|
webpackMode: "development" /* WebpackMode.Dev */,
|
|
80
82
|
config: normalizedConfig,
|
|
83
|
+
configPath: config.configPath,
|
|
81
84
|
logger,
|
|
82
85
|
}),
|
|
83
86
|
];
|
|
@@ -86,6 +89,7 @@ async function buildDevServer(config) {
|
|
|
86
89
|
rspackConfigs.push(await (0, config_1.rspackConfigFactory)({
|
|
87
90
|
webpackMode: "development" /* WebpackMode.Dev */,
|
|
88
91
|
config: normalizedConfig,
|
|
92
|
+
configPath: config.configPath,
|
|
89
93
|
logger: ssrLogger,
|
|
90
94
|
isSsr,
|
|
91
95
|
}));
|
|
@@ -271,6 +271,7 @@ export interface ServiceConfig {
|
|
|
271
271
|
server?: ServerConfig;
|
|
272
272
|
lib?: never;
|
|
273
273
|
verbose?: boolean;
|
|
274
|
+
configPath?: string;
|
|
274
275
|
}
|
|
275
276
|
export type NormalizedClientConfig = Omit<ClientConfig, 'publicPathPrefix' | 'publicPath' | 'assetsManifestFile' | 'hiddenSourceMap' | 'svgr' | 'lazyCompilation' | 'devServer' | 'disableForkTsChecker' | 'disableReactRefresh'> & {
|
|
276
277
|
bundler: Bundler;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { NormalizedClientConfig } from '../models';
|
|
2
|
-
export declare function clientCompile(config: NormalizedClientConfig): Promise<void>;
|
|
2
|
+
export declare function clientCompile(config: NormalizedClientConfig, configPath?: string): Promise<void>;
|
|
@@ -9,30 +9,42 @@ const core_1 = require("@rspack/core");
|
|
|
9
9
|
const logger_1 = require("../logger");
|
|
10
10
|
const config_1 = require("./config");
|
|
11
11
|
const utils_1 = require("./utils");
|
|
12
|
-
async function clientCompile(config) {
|
|
12
|
+
async function clientCompile(config, configPath) {
|
|
13
13
|
const logger = new logger_1.Logger('client', config.verbose);
|
|
14
14
|
const webpackConfigs = [];
|
|
15
15
|
const rspackConfigs = [];
|
|
16
16
|
const isSsr = Boolean(config.ssr);
|
|
17
17
|
if (config.bundler === 'rspack') {
|
|
18
|
-
rspackConfigs.push(await (0, config_1.rspackConfigFactory)({
|
|
18
|
+
rspackConfigs.push(await (0, config_1.rspackConfigFactory)({
|
|
19
|
+
webpackMode: "production" /* WebpackMode.Prod */,
|
|
20
|
+
config,
|
|
21
|
+
configPath,
|
|
22
|
+
logger,
|
|
23
|
+
}));
|
|
19
24
|
if (isSsr) {
|
|
20
25
|
const ssrLogger = new logger_1.Logger('client(SSR)', config.verbose);
|
|
21
26
|
rspackConfigs.push(await (0, config_1.rspackConfigFactory)({
|
|
22
27
|
webpackMode: "production" /* WebpackMode.Prod */,
|
|
23
28
|
config,
|
|
29
|
+
configPath,
|
|
24
30
|
logger: ssrLogger,
|
|
25
31
|
isSsr,
|
|
26
32
|
}));
|
|
27
33
|
}
|
|
28
34
|
}
|
|
29
35
|
else {
|
|
30
|
-
webpackConfigs.push(await (0, config_1.webpackConfigFactory)({
|
|
36
|
+
webpackConfigs.push(await (0, config_1.webpackConfigFactory)({
|
|
37
|
+
webpackMode: "production" /* WebpackMode.Prod */,
|
|
38
|
+
config,
|
|
39
|
+
configPath,
|
|
40
|
+
logger,
|
|
41
|
+
}));
|
|
31
42
|
if (isSsr) {
|
|
32
43
|
const ssrLogger = new logger_1.Logger('client(SSR)', config.verbose);
|
|
33
44
|
webpackConfigs.push(await (0, config_1.webpackConfigFactory)({
|
|
34
45
|
webpackMode: "production" /* WebpackMode.Prod */,
|
|
35
46
|
config,
|
|
47
|
+
configPath,
|
|
36
48
|
logger: ssrLogger,
|
|
37
49
|
isSsr,
|
|
38
50
|
}));
|
|
@@ -13,6 +13,7 @@ export interface HelperOptions {
|
|
|
13
13
|
entry?: string | string[] | Record<string, string | string[]>;
|
|
14
14
|
entriesDirectory: string;
|
|
15
15
|
isSsr: boolean;
|
|
16
|
+
configPath?: string;
|
|
16
17
|
}
|
|
17
18
|
export declare const enum WebpackMode {
|
|
18
19
|
Prod = "production",
|
|
@@ -23,6 +24,7 @@ type ClientFactoryOptions = {
|
|
|
23
24
|
config: NormalizedClientConfig;
|
|
24
25
|
logger?: Logger;
|
|
25
26
|
isSsr?: boolean;
|
|
27
|
+
configPath?: string;
|
|
26
28
|
};
|
|
27
29
|
export declare function webpackConfigFactory(options: ClientFactoryOptions): Promise<webpack.Configuration>;
|
|
28
30
|
export declare function rspackConfigFactory(options: ClientFactoryOptions): Promise<Rspack.Configuration>;
|
|
@@ -60,7 +60,7 @@ const node_externals_1 = require("./node-externals");
|
|
|
60
60
|
const statoscope_1 = require("./statoscope");
|
|
61
61
|
const imagesSizeLimit = 2048;
|
|
62
62
|
const fontSizeLimit = 8192;
|
|
63
|
-
function getHelperOptions({ webpackMode, config, logger, isSsr = false, }) {
|
|
63
|
+
function getHelperOptions({ webpackMode, config, logger, isSsr = false, configPath, }) {
|
|
64
64
|
const isEnvDevelopment = webpackMode === "development" /* WebpackMode.Dev */;
|
|
65
65
|
const isEnvProduction = webpackMode === "production" /* WebpackMode.Prod */;
|
|
66
66
|
return {
|
|
@@ -74,6 +74,7 @@ function getHelperOptions({ webpackMode, config, logger, isSsr = false, }) {
|
|
|
74
74
|
entry: config.entry,
|
|
75
75
|
entriesDirectory: isSsr ? paths_1.default.appSsrEntry : paths_1.default.appEntry,
|
|
76
76
|
isSsr,
|
|
77
|
+
configPath,
|
|
77
78
|
};
|
|
78
79
|
}
|
|
79
80
|
function configureExternals({ config, isSsr }) {
|
|
@@ -221,13 +222,10 @@ function configureWatchOptions({ config }) {
|
|
|
221
222
|
delete watchOptions.watchPackages;
|
|
222
223
|
return watchOptions;
|
|
223
224
|
}
|
|
224
|
-
function getCacheBuildDependencies({ config }) {
|
|
225
|
+
function getCacheBuildDependencies({ config, configPath }) {
|
|
225
226
|
const buildDependencies = {};
|
|
226
227
|
const dependenciesGroups = {
|
|
227
|
-
appBuilderConfig: [
|
|
228
|
-
path.join(paths_1.default.app, 'app-builder.config.ts'),
|
|
229
|
-
path.join(paths_1.default.app, 'app-builder.config.js'),
|
|
230
|
-
],
|
|
228
|
+
appBuilderConfig: configPath ? [configPath] : [],
|
|
231
229
|
packageJson: [path.join(paths_1.default.app, 'package.json')],
|
|
232
230
|
tsconfig: [
|
|
233
231
|
path.join(paths_1.default.app, 'tsconfig.json'),
|
|
@@ -317,17 +315,22 @@ function configureRspackExperiments(options) {
|
|
|
317
315
|
},
|
|
318
316
|
};
|
|
319
317
|
}
|
|
318
|
+
const filesystemCacheOptions = typeof config.cache === 'object' && config.cache.type === 'filesystem'
|
|
319
|
+
? config.cache
|
|
320
|
+
: undefined;
|
|
321
|
+
const version = [filesystemCacheOptions?.name, filesystemCacheOptions?.version]
|
|
322
|
+
.filter(Boolean)
|
|
323
|
+
.join('-');
|
|
320
324
|
return {
|
|
321
325
|
cache: {
|
|
326
|
+
version: version || undefined,
|
|
322
327
|
type: 'persistent',
|
|
323
328
|
snapshot: {
|
|
324
329
|
managedPaths: config.watchOptions?.watchPackages ? [] : undefined,
|
|
325
330
|
},
|
|
326
331
|
storage: {
|
|
327
332
|
type: 'filesystem',
|
|
328
|
-
directory:
|
|
329
|
-
? config.cache.cacheDirectory
|
|
330
|
-
: undefined,
|
|
333
|
+
directory: filesystemCacheOptions?.cacheDirectory,
|
|
331
334
|
},
|
|
332
335
|
buildDependencies: Object.values(getCacheBuildDependencies(options)).flat(),
|
|
333
336
|
},
|
package/package.json
CHANGED