@gravity-ui/app-builder 0.23.0 → 0.23.1-beta.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.
@@ -89,6 +89,16 @@ function configureExternals({ config, isSsr }) {
89
89
  }
90
90
  return externals;
91
91
  }
92
+ function configureWebpackCache(options) {
93
+ const { config } = options;
94
+ if (typeof config.cache === 'object' && config.cache.type === 'filesystem') {
95
+ return {
96
+ ...config.cache,
97
+ buildDependencies: getCacheBuildDependencies(options),
98
+ };
99
+ }
100
+ return config.cache;
101
+ }
92
102
  async function webpackConfigFactory(options) {
93
103
  const { config } = options;
94
104
  const helperOptions = getHelperOptions(options);
@@ -121,7 +131,7 @@ async function webpackConfigFactory(options) {
121
131
  snapshot: {
122
132
  managedPaths: config.watchOptions?.watchPackages ? [] : undefined,
123
133
  },
124
- cache: config.cache,
134
+ cache: configureWebpackCache(helperOptions),
125
135
  };
126
136
  webpackConfig = await config.webpack(webpackConfig, {
127
137
  configType: isEnvProduction ? 'production' : 'development',
@@ -211,6 +221,34 @@ function configureWatchOptions({ config }) {
211
221
  delete watchOptions.watchPackages;
212
222
  return watchOptions;
213
223
  }
224
+ function getCacheBuildDependencies({ config }) {
225
+ const buildDependencies = {};
226
+ 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
+ ],
231
+ packageJson: [path.join(paths_1.default.app, 'package.json')],
232
+ tsconfig: [
233
+ path.join(paths_1.default.app, 'tsconfig.json'),
234
+ path.join(paths_1.default.appClient, 'tsconfig.json'),
235
+ ],
236
+ };
237
+ for (const [group, filePaths] of Object.entries(dependenciesGroups)) {
238
+ for (const filePath of filePaths) {
239
+ if (fs.existsSync(filePath)) {
240
+ buildDependencies[group] = [...(buildDependencies[group] || []), filePath];
241
+ }
242
+ }
243
+ }
244
+ const userBuildDependencies = typeof config.cache === 'object' && config.cache.type === 'filesystem'
245
+ ? config.cache.buildDependencies
246
+ : {};
247
+ return {
248
+ ...buildDependencies,
249
+ ...userBuildDependencies,
250
+ };
251
+ }
214
252
  function configureExperiments({ config, isEnvProduction, isSsr, }) {
215
253
  if (isSsr) {
216
254
  return config.ssr?.moduleType === 'esm' ? { outputModule: true } : undefined;
@@ -244,7 +282,8 @@ function configureExperiments({ config, isEnvProduction, isSsr, }) {
244
282
  lazyCompilation,
245
283
  };
246
284
  }
247
- function configureRspackExperiments({ config, isEnvProduction, isSsr, }) {
285
+ function configureRspackExperiments(options) {
286
+ const { config, isSsr, isEnvProduction } = options;
248
287
  if (isSsr) {
249
288
  return config.ssr?.moduleType === 'esm' ? { outputModule: true } : undefined;
250
289
  }
@@ -290,6 +329,7 @@ function configureRspackExperiments({ config, isEnvProduction, isSsr, }) {
290
329
  ? config.cache.cacheDirectory
291
330
  : undefined,
292
331
  },
332
+ buildDependencies: Object.values(getCacheBuildDependencies(options)).flat(),
293
333
  },
294
334
  lazyCompilation,
295
335
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gravity-ui/app-builder",
3
- "version": "0.23.0",
3
+ "version": "0.23.1-beta.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",