@gravity-ui/app-builder 0.26.2-beta.0 → 0.27.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.
|
@@ -95,21 +95,9 @@ async function buildDevServer(config) {
|
|
|
95
95
|
}));
|
|
96
96
|
}
|
|
97
97
|
}
|
|
98
|
-
// Rspack multicompiler dont work with lazy compilation.
|
|
99
|
-
// Pass a single config to avoid multicompiler when SSR disabled.
|
|
100
|
-
const compiler = bundler === 'rspack'
|
|
101
|
-
? (0, core_1.rspack)(isSsr ? rspackConfigs : rspackConfigs[0])
|
|
102
|
-
: (0, webpack_1.default)(webpackConfigs);
|
|
103
98
|
const staticFolder = path.resolve(paths_1.default.appDist, 'public');
|
|
104
99
|
const options = {
|
|
105
100
|
static: staticFolder,
|
|
106
|
-
setupMiddlewares(middlewares) {
|
|
107
|
-
if (config.client.lazyCompilation && bundler === 'rspack') {
|
|
108
|
-
const lazyCompilationMiddleware = core_1.rspack.experiments.lazyCompilationMiddleware(compiler, rspackConfigs[0]?.experiments?.lazyCompilation);
|
|
109
|
-
return [lazyCompilationMiddleware, ...middlewares];
|
|
110
|
-
}
|
|
111
|
-
return middlewares;
|
|
112
|
-
},
|
|
113
101
|
devMiddleware: {
|
|
114
102
|
publicPath,
|
|
115
103
|
stats: 'errors-warnings',
|
|
@@ -184,9 +172,14 @@ async function buildDevServer(config) {
|
|
|
184
172
|
options.proxy = proxy;
|
|
185
173
|
let server;
|
|
186
174
|
if (bundler === 'rspack') {
|
|
175
|
+
// Rspack multicompiler dont work with lazy compilation.
|
|
176
|
+
// Pass a single config to avoid multicompiler when SSR disabled.
|
|
177
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
178
|
+
const compiler = (0, core_1.rspack)(isSsr ? rspackConfigs : rspackConfigs[0]);
|
|
187
179
|
server = new dev_server_1.RspackDevServer(options, compiler);
|
|
188
180
|
}
|
|
189
181
|
else {
|
|
182
|
+
const compiler = (0, webpack_1.default)(webpackConfigs);
|
|
190
183
|
server = new webpack_dev_server_1.default(options, compiler);
|
|
191
184
|
}
|
|
192
185
|
try {
|
|
@@ -181,6 +181,7 @@ const svgoPreset = {
|
|
|
181
181
|
function buildLibrary(config) {
|
|
182
182
|
const internalGlobs = config.lib?.internalDirs?.map((dir) => `!${dir}/**/*`) ?? [];
|
|
183
183
|
rimraf_1.rimraf.sync(paths_1.default.libBuild);
|
|
184
|
+
const tsConfigFilePath = path.resolve(paths_1.default.app, 'tsconfig.publish.json');
|
|
184
185
|
// sources compilation
|
|
185
186
|
const sourceStream = (0, fast_glob_1.globStream)(['**/*.{js,jsx,ts,tsx}', '!**/*.d.ts', ...internalGlobs], {
|
|
186
187
|
cwd: paths_1.default.src,
|
|
@@ -216,6 +217,12 @@ function buildLibrary(config) {
|
|
|
216
217
|
camel2DashComponentName: false,
|
|
217
218
|
},
|
|
218
219
|
],
|
|
220
|
+
[
|
|
221
|
+
require.resolve('babel-plugin-tsconfig-paths-module-resolver'),
|
|
222
|
+
{
|
|
223
|
+
tsconfig: tsConfigFilePath,
|
|
224
|
+
},
|
|
225
|
+
],
|
|
219
226
|
require.resolve('./babel-plugin-replace-paths'),
|
|
220
227
|
],
|
|
221
228
|
sourceMaps: true,
|
|
@@ -237,10 +244,9 @@ function buildLibrary(config) {
|
|
|
237
244
|
});
|
|
238
245
|
});
|
|
239
246
|
// type definitions compilation and type checking
|
|
240
|
-
const projectFilePath = path.resolve(paths_1.default.app, 'tsconfig.publish.json');
|
|
241
247
|
const tscExec = path.resolve(paths_1.default.appNodeModules, 'typescript/bin/tsc');
|
|
242
248
|
// eslint-disable-next-line security/detect-child-process
|
|
243
|
-
childProcess.exec(`${tscExec} -p ${
|
|
249
|
+
childProcess.exec(`${tscExec} -p ${tsConfigFilePath} --declaration --emitDeclarationOnly --outDir build/esm`, (error, stdout, stderr) => {
|
|
244
250
|
logger_1.default.message(stdout);
|
|
245
251
|
logger_1.default.error(stderr);
|
|
246
252
|
if (!error && !stderr) {
|
|
@@ -288,14 +288,26 @@ function configureRspackExperiments(options) {
|
|
|
288
288
|
return undefined;
|
|
289
289
|
}
|
|
290
290
|
let lazyCompilation;
|
|
291
|
+
let port;
|
|
291
292
|
if (config.lazyCompilation) {
|
|
293
|
+
if (typeof config.lazyCompilation === 'object') {
|
|
294
|
+
port = config.lazyCompilation.port;
|
|
295
|
+
}
|
|
292
296
|
lazyCompilation = {
|
|
293
297
|
// Lazy compilation works without problems only with lazy imports
|
|
294
298
|
// See https://github.com/web-infra-dev/rspack/issues/8503
|
|
295
299
|
entries: false,
|
|
296
300
|
imports: true,
|
|
297
|
-
|
|
298
|
-
|
|
301
|
+
backend: {
|
|
302
|
+
client: require.resolve('./lazy-client.js'),
|
|
303
|
+
...(port
|
|
304
|
+
? {
|
|
305
|
+
listen: {
|
|
306
|
+
port,
|
|
307
|
+
},
|
|
308
|
+
}
|
|
309
|
+
: {}),
|
|
310
|
+
},
|
|
299
311
|
test(module) {
|
|
300
312
|
// make sure that lazy-client.js won't be lazy compiled)
|
|
301
313
|
return !module.nameForCondition()?.endsWith('lazy-client.js');
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gravity-ui/app-builder",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.27.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",
|
|
@@ -70,15 +70,15 @@
|
|
|
70
70
|
"@babel/runtime": "^7.26.0",
|
|
71
71
|
"@okikio/sharedworker": "^1.0.7",
|
|
72
72
|
"@pmmmwh/react-refresh-webpack-plugin": "^0.5.15",
|
|
73
|
-
"@rsdoctor/rspack-plugin": "^
|
|
74
|
-
"@rsdoctor/webpack-plugin": "^
|
|
75
|
-
"@rspack/core": "1.
|
|
76
|
-
"@rspack/dev-server": "^1.
|
|
77
|
-
"@rspack/plugin-react-refresh": "^1.
|
|
78
|
-
"@statoscope/webpack-plugin": "^5.29.0",
|
|
73
|
+
"@rsdoctor/rspack-plugin": "^0.4.13",
|
|
74
|
+
"@rsdoctor/webpack-plugin": "^0.4.13",
|
|
75
|
+
"@rspack/core": "1.2.8",
|
|
76
|
+
"@rspack/dev-server": "^1.0.10",
|
|
77
|
+
"@rspack/plugin-react-refresh": "^1.0.1",
|
|
79
78
|
"@statoscope/stats": "^5.28.1",
|
|
80
79
|
"@statoscope/stats-extension-compressed": "^5.28.1",
|
|
81
80
|
"@statoscope/webpack-model": "^5.29.0",
|
|
81
|
+
"@statoscope/webpack-plugin": "^5.29.0",
|
|
82
82
|
"@svgr/core": "^8.1.0",
|
|
83
83
|
"@svgr/plugin-jsx": "^8.1.0",
|
|
84
84
|
"@svgr/webpack": "^8.1.0",
|
|
@@ -88,6 +88,7 @@
|
|
|
88
88
|
"babel-plugin-import": "^1.13.8",
|
|
89
89
|
"babel-plugin-inline-react-svg": "^2.0.2",
|
|
90
90
|
"babel-plugin-transform-react-remove-prop-types": "^0.4.24",
|
|
91
|
+
"babel-plugin-tsconfig-paths-module-resolver": "^1.0.4",
|
|
91
92
|
"browserslist": "^4.24.0",
|
|
92
93
|
"chalk": "^4.1.2",
|
|
93
94
|
"circular-dependency-plugin": "^5.2.2",
|