@gravity-ui/app-builder 0.29.3-beta.0 → 0.30.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/README.md +138 -0
- package/dist/cli.js +17 -22
- package/dist/commands/build/build-lib.js +5 -8
- package/dist/commands/build/build-service/client.js +3 -6
- package/dist/commands/build/build-service/index.js +4 -7
- package/dist/commands/build/build-service/server.js +11 -17
- package/dist/commands/build/index.js +3 -6
- package/dist/commands/dev/client.js +34 -63
- package/dist/commands/dev/index.js +26 -47
- package/dist/commands/dev/server.js +13 -42
- package/dist/common/babel/index.js +1 -4
- package/dist/common/babel/ui-preset.d.ts +1 -1
- package/dist/common/babel/ui-preset.js +0 -1
- package/dist/common/child-process/controllable-script.js +5 -32
- package/dist/common/child-process/utils.js +4 -30
- package/dist/common/command.js +1 -2
- package/dist/common/config.js +36 -45
- package/dist/common/env.js +3 -5
- package/dist/common/library/babel-plugin-replace-paths.js +2 -4
- package/dist/common/library/index.js +66 -95
- package/dist/common/logger/colors.js +2 -8
- package/dist/common/logger/index.js +17 -24
- package/dist/common/logger/log-config.js +3 -6
- package/dist/common/logger/pretty-time.js +2 -6
- package/dist/common/models/index.d.ts +66 -1
- package/dist/common/models/index.js +3 -8
- package/dist/common/paths.js +3 -28
- package/dist/common/s3-upload/compress.js +8 -12
- package/dist/common/s3-upload/create-plugin.js +9 -7
- package/dist/common/s3-upload/index.js +3 -9
- package/dist/common/s3-upload/s3-client.js +11 -37
- package/dist/common/s3-upload/upload.js +9 -38
- package/dist/common/s3-upload/webpack-plugin.js +5 -9
- package/dist/common/swc/compile.js +9 -12
- package/dist/common/swc/index.js +2 -7
- package/dist/common/swc/utils.js +6 -13
- package/dist/common/swc/watch.js +6 -9
- package/dist/common/typescript/compile.js +11 -14
- package/dist/common/typescript/diagnostic.js +11 -37
- package/dist/common/typescript/transformers.js +3 -29
- package/dist/common/typescript/utils.js +8 -18
- package/dist/common/typescript/watch.js +10 -13
- package/dist/common/utils.d.ts +3 -1
- package/dist/common/utils.js +16 -22
- package/dist/common/webpack/compile.js +16 -22
- package/dist/common/webpack/config.d.ts +0 -2
- package/dist/common/webpack/config.js +187 -137
- package/dist/common/webpack/node-externals.js +5 -34
- package/dist/common/webpack/progress-plugin.js +3 -6
- package/dist/common/webpack/public-path.d.ts +0 -1
- package/dist/common/webpack/public-path.js +1 -1
- package/dist/common/webpack/rspack.js +1 -5
- package/dist/common/webpack/runtime-versioning-plugin.d.ts +5 -0
- package/dist/common/webpack/runtime-versioning-plugin.js +20 -0
- package/dist/common/webpack/storybook.js +21 -53
- package/dist/common/webpack/utils.js +9 -36
- package/dist/common/webpack/worker/public-path.worker.d.ts +0 -1
- package/dist/common/webpack/worker/public-path.worker.js +2 -1
- package/dist/common/webpack/worker/worker-loader.js +4 -34
- package/dist/create-cli.d.ts +2 -2
- package/dist/create-cli.js +19 -48
- package/dist/index.d.ts +1 -1
- package/dist/index.js +5 -27
- package/package.json +9 -6
|
@@ -1,39 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
-
};
|
|
28
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.nodeExternals = nodeExternals;
|
|
30
|
-
const fs = __importStar(require("node:fs"));
|
|
31
|
-
const path = __importStar(require("node:path"));
|
|
32
|
-
const paths_1 = __importDefault(require("../paths"));
|
|
1
|
+
import * as fs from 'node:fs';
|
|
2
|
+
import * as path from 'node:path';
|
|
3
|
+
import paths from '../paths';
|
|
33
4
|
const webpackInternal = /^webpack\/container\/reference\//;
|
|
34
|
-
function nodeExternals({ noExternal = [], module }) {
|
|
5
|
+
export function nodeExternals({ noExternal = [], module }) {
|
|
35
6
|
const noExternals = Array().concat(webpackInternal).concat(noExternal);
|
|
36
|
-
const nodeModules = readPackagesNames(
|
|
7
|
+
const nodeModules = readPackagesNames(paths.appNodeModules);
|
|
37
8
|
return async (data) => {
|
|
38
9
|
const { request, dependencyType } = data;
|
|
39
10
|
if (!request) {
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.createProgressPlugin = createProgressPlugin;
|
|
4
|
-
const pretty_time_1 = require("../logger/pretty-time");
|
|
5
|
-
function createProgressPlugin(BaseClass) {
|
|
1
|
+
import { elapsedTime } from '../logger/pretty-time';
|
|
2
|
+
export function createProgressPlugin(BaseClass) {
|
|
6
3
|
return class ProgressPlugin extends BaseClass {
|
|
7
4
|
logger;
|
|
8
5
|
state = {};
|
|
@@ -30,7 +27,7 @@ function createProgressPlugin(BaseClass) {
|
|
|
30
27
|
this.logger.verbose(`Invalidate file: ${fileName} at ${changeTime}`);
|
|
31
28
|
});
|
|
32
29
|
hook(compiler, 'done', (stats) => {
|
|
33
|
-
const time = this.state.start ? ' in ' +
|
|
30
|
+
const time = this.state.start ? ' in ' + elapsedTime(this.state.start) : '';
|
|
34
31
|
const hasErrors = stats.hasErrors();
|
|
35
32
|
if (hasErrors) {
|
|
36
33
|
this.logger.error('Compiled with some errors' + time);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.generateAssetsManifest = void 0;
|
|
4
|
-
const generateAssetsManifest = (seed, files, entries) => {
|
|
1
|
+
export const generateAssetsManifest = (seed, files, entries) => {
|
|
5
2
|
const manifestFiles = files.reduce((manifest, file) => {
|
|
6
3
|
manifest[file.name] = file.path;
|
|
7
4
|
return manifest;
|
|
@@ -22,4 +19,3 @@ const generateAssetsManifest = (seed, files, entries) => {
|
|
|
22
19
|
entrypoints,
|
|
23
20
|
};
|
|
24
21
|
};
|
|
25
|
-
exports.generateAssetsManifest = generateAssetsManifest;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/* global window */
|
|
2
|
+
const RuntimeVersioningPlugin = () => {
|
|
3
|
+
return {
|
|
4
|
+
name: 'runtime-versioning-plugin',
|
|
5
|
+
beforeRequest: (args) => {
|
|
6
|
+
if (typeof window.__REMOTE_VERSIONS__ !== 'object') {
|
|
7
|
+
return args;
|
|
8
|
+
}
|
|
9
|
+
args.options.remotes.forEach((remote) => {
|
|
10
|
+
const remoteVersion = window.__REMOTE_VERSIONS__[remote.name];
|
|
11
|
+
if (remoteVersion) {
|
|
12
|
+
// eslint-disable-next-line no-param-reassign
|
|
13
|
+
remote.entry = remote.entry.replace('[version]', remoteVersion);
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
return args;
|
|
17
|
+
},
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
export default RuntimeVersioningPlugin;
|
|
@@ -1,47 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
-
};
|
|
28
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.configureServiceWebpackConfig = configureServiceWebpackConfig;
|
|
30
|
-
exports.configureWebpackConfigForStorybook = configureWebpackConfigForStorybook;
|
|
31
|
-
const path = __importStar(require("node:path"));
|
|
32
|
-
const react_refresh_webpack_plugin_1 = __importDefault(require("@pmmmwh/react-refresh-webpack-plugin"));
|
|
33
|
-
const mini_css_extract_plugin_1 = __importDefault(require("mini-css-extract-plugin"));
|
|
34
|
-
const css_minimizer_webpack_plugin_1 = __importDefault(require("css-minimizer-webpack-plugin"));
|
|
35
|
-
const config_1 = require("./config");
|
|
36
|
-
const config_2 = require("../config");
|
|
37
|
-
const models_1 = require("../models");
|
|
38
|
-
const paths_1 = __importDefault(require("../paths"));
|
|
39
|
-
async function configureServiceWebpackConfig(mode, storybookConfig) {
|
|
40
|
-
const serviceConfig = await (0, config_2.getProjectConfig)(mode === "production" /* WebpackMode.Prod */ ? 'build' : 'dev', {
|
|
1
|
+
import * as path from 'node:path';
|
|
2
|
+
import ReactRefreshWebpackPlugin from '@pmmmwh/react-refresh-webpack-plugin';
|
|
3
|
+
import MiniCSSExtractPlugin from 'mini-css-extract-plugin';
|
|
4
|
+
import OptimizeCSSAssetsPlugin from 'css-minimizer-webpack-plugin';
|
|
5
|
+
import { configureModuleRules, configureOptimization, configureResolve } from './config';
|
|
6
|
+
import { getProjectConfig, normalizeConfig } from '../config';
|
|
7
|
+
import { isLibraryConfig } from '../models';
|
|
8
|
+
import paths from '../paths';
|
|
9
|
+
export async function configureServiceWebpackConfig(mode, storybookConfig) {
|
|
10
|
+
const serviceConfig = await getProjectConfig(mode === "production" /* WebpackMode.Prod */ ? 'build' : 'dev', {
|
|
41
11
|
storybook: true,
|
|
42
12
|
});
|
|
43
13
|
let options = {};
|
|
44
|
-
if (
|
|
14
|
+
if (isLibraryConfig(serviceConfig)) {
|
|
45
15
|
options = {
|
|
46
16
|
includes: ['src'],
|
|
47
17
|
newJsxTransform: serviceConfig.lib?.newJsxTransform,
|
|
@@ -96,10 +66,10 @@ async function configureServiceWebpackConfig(mode, storybookConfig) {
|
|
|
96
66
|
},
|
|
97
67
|
};
|
|
98
68
|
}
|
|
99
|
-
async function configureWebpackConfigForStorybook(mode, userConfig = {}, storybookModuleRules = []) {
|
|
69
|
+
export async function configureWebpackConfigForStorybook(mode, userConfig = {}, storybookModuleRules = []) {
|
|
100
70
|
const isEnvDevelopment = mode === "development" /* WebpackMode.Dev */;
|
|
101
71
|
const isEnvProduction = mode === "production" /* WebpackMode.Prod */;
|
|
102
|
-
const config = await
|
|
72
|
+
const config = await normalizeConfig({
|
|
103
73
|
client: {
|
|
104
74
|
...userConfig,
|
|
105
75
|
// TODO support rspack for storybook
|
|
@@ -112,20 +82,18 @@ async function configureWebpackConfigForStorybook(mode, userConfig = {}, storybo
|
|
|
112
82
|
isEnvProduction,
|
|
113
83
|
config: config.client,
|
|
114
84
|
configType: mode,
|
|
115
|
-
buildDirectory: config.client.outputPath ||
|
|
116
|
-
|
|
117
|
-
entry: config.client.entry,
|
|
118
|
-
entriesDirectory: paths_1.default.appEntry,
|
|
85
|
+
buildDirectory: config.client.outputPath || paths.appBuild,
|
|
86
|
+
entriesDirectory: paths.appEntry,
|
|
119
87
|
isSsr: false,
|
|
120
88
|
};
|
|
121
89
|
return {
|
|
122
90
|
module: {
|
|
123
|
-
rules: await
|
|
91
|
+
rules: await configureModuleRules(helperOptions, storybookModuleRules.filter((rule) => rule !== '...')),
|
|
124
92
|
},
|
|
125
|
-
resolve:
|
|
93
|
+
resolve: configureResolve(helperOptions),
|
|
126
94
|
plugins: configurePlugins(helperOptions),
|
|
127
95
|
optimization: {
|
|
128
|
-
minimizer:
|
|
96
|
+
minimizer: configureOptimization(helperOptions).minimizer,
|
|
129
97
|
},
|
|
130
98
|
};
|
|
131
99
|
}
|
|
@@ -147,15 +115,15 @@ function configurePlugins({ isEnvDevelopment, isEnvProduction, config }) {
|
|
|
147
115
|
}));
|
|
148
116
|
}
|
|
149
117
|
if (isEnvDevelopment && config.reactRefresh !== false) {
|
|
150
|
-
plugins.push(new
|
|
118
|
+
plugins.push(new ReactRefreshWebpackPlugin(config.reactRefresh({})));
|
|
151
119
|
}
|
|
152
120
|
if (isEnvProduction) {
|
|
153
|
-
plugins.push(new
|
|
121
|
+
plugins.push(new MiniCSSExtractPlugin({
|
|
154
122
|
filename: 'css/[name].[contenthash:8].css',
|
|
155
123
|
chunkFilename: 'css/[name].[contenthash:8].chunk.css',
|
|
156
124
|
ignoreOrder: true,
|
|
157
125
|
}));
|
|
158
|
-
plugins.push(new
|
|
126
|
+
plugins.push(new OptimizeCSSAssetsPlugin({
|
|
159
127
|
minimizerOptions: {
|
|
160
128
|
preset: [
|
|
161
129
|
'default',
|
|
@@ -1,35 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.compilerHandlerFactory = compilerHandlerFactory;
|
|
27
|
-
exports.resolveTsConfigPathsToAlias = resolveTsConfigPathsToAlias;
|
|
28
|
-
const path = __importStar(require("node:path"));
|
|
29
|
-
const ts = __importStar(require("typescript"));
|
|
30
|
-
const pretty_time_1 = require("../logger/pretty-time");
|
|
31
|
-
const utils_1 = require("../typescript/utils");
|
|
32
|
-
function compilerHandlerFactory(logger, onCompilationEnd) {
|
|
1
|
+
import * as path from 'node:path';
|
|
2
|
+
import * as ts from 'typescript';
|
|
3
|
+
import { prettyTime } from '../logger/pretty-time';
|
|
4
|
+
import { getTsProjectConfig } from '../typescript/utils';
|
|
5
|
+
export function compilerHandlerFactory(logger, onCompilationEnd) {
|
|
33
6
|
return async (err, stats) => {
|
|
34
7
|
if (err) {
|
|
35
8
|
logger.panic(err.message, err);
|
|
@@ -55,12 +28,12 @@ function compilerHandlerFactory(logger, onCompilationEnd) {
|
|
|
55
28
|
if (clientStats) {
|
|
56
29
|
const { startTime = 0, endTime = 0 } = clientStats;
|
|
57
30
|
const time = endTime - startTime;
|
|
58
|
-
logger.success(`Client was successfully compiled in ${
|
|
31
|
+
logger.success(`Client was successfully compiled in ${prettyTime(BigInt(time) * BigInt(1_000_000))}`);
|
|
59
32
|
}
|
|
60
33
|
if (ssrStats) {
|
|
61
34
|
const { startTime = 0, endTime = 0 } = ssrStats;
|
|
62
35
|
const time = endTime - startTime;
|
|
63
|
-
logger.success(`SSR: Client was successfully compiled in ${
|
|
36
|
+
logger.success(`SSR: Client was successfully compiled in ${prettyTime(BigInt(time) * BigInt(1_000_000))}`);
|
|
64
37
|
}
|
|
65
38
|
if (!clientStats && !ssrStats) {
|
|
66
39
|
logger.success(`Client was successfully compiled`);
|
|
@@ -68,10 +41,10 @@ function compilerHandlerFactory(logger, onCompilationEnd) {
|
|
|
68
41
|
};
|
|
69
42
|
}
|
|
70
43
|
const endStarRe = /\/?\*$/;
|
|
71
|
-
function resolveTsConfigPathsToAlias(projectPath, filename = 'tsconfig.json') {
|
|
44
|
+
export function resolveTsConfigPathsToAlias(projectPath, filename = 'tsconfig.json') {
|
|
72
45
|
let parsed;
|
|
73
46
|
try {
|
|
74
|
-
parsed =
|
|
47
|
+
parsed = getTsProjectConfig(ts, projectPath, filename);
|
|
75
48
|
}
|
|
76
49
|
catch {
|
|
77
50
|
return {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,37 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
-
};
|
|
28
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.pitch = void 0;
|
|
30
|
-
const path = __importStar(require("node:path"));
|
|
31
|
-
const paths_1 = __importDefault(require("../../paths"));
|
|
1
|
+
import * as path from 'node:path';
|
|
2
|
+
import paths from '../../paths';
|
|
32
3
|
const pluginId = 'APP_BUILDER_WORKER_LOADER';
|
|
33
4
|
const publicPath = path.resolve(__dirname, 'public-path.worker.js');
|
|
34
|
-
const pitch = function (request) {
|
|
5
|
+
export const pitch = function (request) {
|
|
35
6
|
this.cacheable(false);
|
|
36
7
|
if (!this._compiler || !this._compilation) {
|
|
37
8
|
throw new Error('Something went wrong');
|
|
@@ -51,7 +22,7 @@ const pitch = function (request) {
|
|
|
51
22
|
chunkFilename,
|
|
52
23
|
publicPath: compilerOptions.output.publicPath,
|
|
53
24
|
globalObject: 'self',
|
|
54
|
-
devtoolNamespace: path.resolve('/', path.relative(
|
|
25
|
+
devtoolNamespace: path.resolve('/', path.relative(paths.app, this.resource)),
|
|
55
26
|
};
|
|
56
27
|
const workerCompiler = this._compilation.createChildCompiler(`worker ${request}`, workerOptions);
|
|
57
28
|
const { EntryPlugin, node: { NodeTargetPlugin }, web: { FetchCompileWasmPlugin, FetchCompileAsyncWasmPlugin }, webworker: { WebWorkerTemplatePlugin }, } = webpack;
|
|
@@ -145,7 +116,6 @@ const pitch = function (request) {
|
|
|
145
116
|
});
|
|
146
117
|
});
|
|
147
118
|
};
|
|
148
|
-
exports.pitch = pitch;
|
|
149
119
|
function configureSourceMap(compiler) {
|
|
150
120
|
const devtool = compiler.options.devtool;
|
|
151
121
|
if (devtool) {
|
package/dist/create-cli.d.ts
CHANGED
|
@@ -3,9 +3,9 @@ export declare function createCli(argv: string[]): {
|
|
|
3
3
|
[x: string]: unknown;
|
|
4
4
|
verbose: boolean | undefined;
|
|
5
5
|
cdn: string | undefined;
|
|
6
|
-
c: unknown;
|
|
7
6
|
env: string[] | undefined;
|
|
8
7
|
target: "client" | "server" | undefined;
|
|
8
|
+
c: unknown;
|
|
9
9
|
inspect: number | undefined;
|
|
10
10
|
inspectBrk: number | undefined;
|
|
11
11
|
"inspect-brk": number | undefined;
|
|
@@ -31,9 +31,9 @@ export declare function createCli(argv: string[]): {
|
|
|
31
31
|
[x: string]: unknown;
|
|
32
32
|
verbose: boolean | undefined;
|
|
33
33
|
cdn: string | undefined;
|
|
34
|
-
c: unknown;
|
|
35
34
|
env: string[] | undefined;
|
|
36
35
|
target: "client" | "server" | undefined;
|
|
36
|
+
c: unknown;
|
|
37
37
|
inspect: number | undefined;
|
|
38
38
|
inspectBrk: number | undefined;
|
|
39
39
|
"inspect-brk": number | undefined;
|
package/dist/create-cli.js
CHANGED
|
@@ -1,40 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
-
};
|
|
28
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.createCli = createCli;
|
|
30
|
-
const yargs_1 = __importDefault(require("yargs"));
|
|
31
|
-
const helpers_1 = require("yargs/helpers");
|
|
32
|
-
const path = __importStar(require("node:path"));
|
|
33
|
-
const logger_1 = __importDefault(require("./common/logger"));
|
|
34
|
-
const config_1 = require("./common/config");
|
|
35
|
-
const models_1 = require("./common/models");
|
|
36
|
-
function createCli(argv) {
|
|
37
|
-
const cli = (0, yargs_1.default)().parserConfiguration({
|
|
1
|
+
import yargs from 'yargs';
|
|
2
|
+
import { hideBin } from 'yargs/helpers';
|
|
3
|
+
import * as path from 'node:path';
|
|
4
|
+
import logger from './common/logger';
|
|
5
|
+
import { getProjectConfig } from './common/config';
|
|
6
|
+
import { isLibraryConfig } from './common/models';
|
|
7
|
+
export function createCli(argv) {
|
|
8
|
+
const cli = yargs().parserConfiguration({
|
|
38
9
|
'boolean-negation': false,
|
|
39
10
|
});
|
|
40
11
|
cli.scriptName('app-builder')
|
|
@@ -144,7 +115,7 @@ function createCli(argv) {
|
|
|
144
115
|
describe: 'Display final webpack configurations for debugging purposes',
|
|
145
116
|
}),
|
|
146
117
|
handler: handlerP(getCommandHandler('dev', (args, cmd) => {
|
|
147
|
-
if (
|
|
118
|
+
if (isLibraryConfig(args)) {
|
|
148
119
|
throw new Error('dev command can be used only for services, but got the library config');
|
|
149
120
|
}
|
|
150
121
|
process.env.NODE_ENV = process.env.NODE_ENV || 'development';
|
|
@@ -204,7 +175,7 @@ function createCli(argv) {
|
|
|
204
175
|
.strict()
|
|
205
176
|
.demandCommand(1, `Pass --help to see all available commands and options.`)
|
|
206
177
|
.recommendCommands()
|
|
207
|
-
.parse(
|
|
178
|
+
.parse(hideBin(argv));
|
|
208
179
|
}
|
|
209
180
|
function getVersionInfo() {
|
|
210
181
|
const { version } = require('../package.json');
|
|
@@ -212,16 +183,16 @@ function getVersionInfo() {
|
|
|
212
183
|
}
|
|
213
184
|
function handlerP(fn) {
|
|
214
185
|
return (args) => {
|
|
215
|
-
Promise.resolve(fn(args)).then(() => process.exit(0), (err) =>
|
|
186
|
+
Promise.resolve(fn(args)).then(() => process.exit(0), (err) => logger.panic(err));
|
|
216
187
|
};
|
|
217
188
|
}
|
|
218
189
|
function getCommandHandler(command, handler) {
|
|
219
190
|
return async (argv) => {
|
|
220
|
-
const config = await
|
|
221
|
-
|
|
222
|
-
const args = { ...config, logger
|
|
191
|
+
const config = await getProjectConfig(command, argv);
|
|
192
|
+
logger.setVerbose(Boolean(config.verbose));
|
|
193
|
+
const args = { ...config, logger };
|
|
223
194
|
const localCmd = resolveLocalCommand(command);
|
|
224
|
-
|
|
195
|
+
logger.verbose(`running command: ${command}`);
|
|
225
196
|
return handler ? handler(args, localCmd) : localCmd(args);
|
|
226
197
|
};
|
|
227
198
|
}
|
|
@@ -229,8 +200,8 @@ function resolveLocalCommand(command) {
|
|
|
229
200
|
try {
|
|
230
201
|
const cmdPath = path.resolve(__dirname, `commands/${command}`);
|
|
231
202
|
if (!cmdPath)
|
|
232
|
-
return
|
|
233
|
-
|
|
203
|
+
return logger.panic(`There was a problem loading the ${command} command.`);
|
|
204
|
+
logger.verbose(`loading command from: ${cmdPath}`);
|
|
234
205
|
// eslint-disable-next-line security/detect-non-literal-require
|
|
235
206
|
let cmd = require(cmdPath);
|
|
236
207
|
if (cmd.__esModule) {
|
|
@@ -239,9 +210,9 @@ function resolveLocalCommand(command) {
|
|
|
239
210
|
if (typeof cmd === 'function') {
|
|
240
211
|
return cmd;
|
|
241
212
|
}
|
|
242
|
-
return
|
|
213
|
+
return logger.panic(`Handler for command "${command}" is not a function.`);
|
|
243
214
|
}
|
|
244
215
|
catch (err) {
|
|
245
|
-
return
|
|
216
|
+
return logger.panic(`There was a problem loading the "${command}" command.`, err);
|
|
246
217
|
}
|
|
247
218
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -3,4 +3,4 @@ export * from './common/s3-upload';
|
|
|
3
3
|
export { createTransformPathsToLocalModules } from './common/typescript/transformers';
|
|
4
4
|
export { defineConfig } from './common/models';
|
|
5
5
|
export { babelPreset } from './common/babel';
|
|
6
|
-
export type { ProjectConfig, ServiceConfig, LibraryConfig, ProjectFileConfig } from './common/models';
|
|
6
|
+
export type { ProjectConfig, ServiceConfig, LibraryConfig, ModuleFederationConfig, ProjectFileConfig, } from './common/models';
|
package/dist/index.js
CHANGED
|
@@ -1,27 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.babelPreset = exports.defineConfig = exports.createTransformPathsToLocalModules = exports.configureServiceWebpackConfig = exports.configureWebpackConfigForStorybook = void 0;
|
|
18
|
-
var storybook_1 = require("./common/webpack/storybook");
|
|
19
|
-
Object.defineProperty(exports, "configureWebpackConfigForStorybook", { enumerable: true, get: function () { return storybook_1.configureWebpackConfigForStorybook; } });
|
|
20
|
-
Object.defineProperty(exports, "configureServiceWebpackConfig", { enumerable: true, get: function () { return storybook_1.configureServiceWebpackConfig; } });
|
|
21
|
-
__exportStar(require("./common/s3-upload"), exports);
|
|
22
|
-
var transformers_1 = require("./common/typescript/transformers");
|
|
23
|
-
Object.defineProperty(exports, "createTransformPathsToLocalModules", { enumerable: true, get: function () { return transformers_1.createTransformPathsToLocalModules; } });
|
|
24
|
-
var models_1 = require("./common/models");
|
|
25
|
-
Object.defineProperty(exports, "defineConfig", { enumerable: true, get: function () { return models_1.defineConfig; } });
|
|
26
|
-
var babel_1 = require("./common/babel");
|
|
27
|
-
Object.defineProperty(exports, "babelPreset", { enumerable: true, get: function () { return babel_1.babelPreset; } });
|
|
1
|
+
export { configureWebpackConfigForStorybook, configureServiceWebpackConfig, } from './common/webpack/storybook';
|
|
2
|
+
export * from './common/s3-upload';
|
|
3
|
+
export { createTransformPathsToLocalModules } from './common/typescript/transformers';
|
|
4
|
+
export { defineConfig } from './common/models';
|
|
5
|
+
export { babelPreset } from './common/babel';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gravity-ui/app-builder",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.30.0",
|
|
4
4
|
"description": "Develop and build your React client-server projects, powered by typescript and webpack",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "commonjs",
|
|
@@ -68,13 +68,15 @@
|
|
|
68
68
|
"@babel/preset-react": "^7.26.0",
|
|
69
69
|
"@babel/preset-typescript": "^7.26.0",
|
|
70
70
|
"@babel/runtime": "^7.26.0",
|
|
71
|
+
"@module-federation/enhanced": "^0.18.0",
|
|
72
|
+
"@module-federation/sdk": "^0.18.0",
|
|
71
73
|
"@okikio/sharedworker": "^1.0.7",
|
|
72
74
|
"@pmmmwh/react-refresh-webpack-plugin": "^0.5.15",
|
|
73
|
-
"@rsdoctor/rspack-plugin": "^1.
|
|
74
|
-
"@rsdoctor/webpack-plugin": "^1.
|
|
75
|
-
"@rspack/core": "1.
|
|
76
|
-
"@rspack/dev-server": "^1.1.
|
|
77
|
-
"@rspack/plugin-react-refresh": "^1.4.
|
|
75
|
+
"@rsdoctor/rspack-plugin": "^1.0.2",
|
|
76
|
+
"@rsdoctor/webpack-plugin": "^1.0.2",
|
|
77
|
+
"@rspack/core": "1.3.9",
|
|
78
|
+
"@rspack/dev-server": "^1.1.1",
|
|
79
|
+
"@rspack/plugin-react-refresh": "^1.4.1",
|
|
78
80
|
"@statoscope/stats": "^5.28.1",
|
|
79
81
|
"@statoscope/stats-extension-compressed": "^5.28.1",
|
|
80
82
|
"@statoscope/webpack-model": "^5.29.0",
|
|
@@ -117,6 +119,7 @@
|
|
|
117
119
|
"pino-pretty": "^11.2.0",
|
|
118
120
|
"postcss": "^8.4.47",
|
|
119
121
|
"postcss-loader": "^8.1.1",
|
|
122
|
+
"postcss-prefix-selector": "^2.1.1",
|
|
120
123
|
"postcss-preset-env": "^9.1.3",
|
|
121
124
|
"react": "^18.3.1",
|
|
122
125
|
"react-dom": "^18.3.1",
|