@gravity-ui/app-builder 0.5.0 → 0.5.2

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/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.5.2](https://github.com/gravity-ui/app-builder/compare/v0.5.1...v0.5.2) (2023-06-28)
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * add missing entries typings to lazy compilation feature ([#34](https://github.com/gravity-ui/app-builder/issues/34)) ([5c49611](https://github.com/gravity-ui/app-builder/commit/5c49611769f496f79ab1e810a366672908cfc29b))
9
+
10
+ ## [0.5.1](https://github.com/gravity-ui/app-builder/compare/v0.5.0...v0.5.1) (2023-06-26)
11
+
12
+
13
+ ### Features
14
+
15
+ * added the ability to disable entries for webpack lazy compilation ([#32](https://github.com/gravity-ui/app-builder/issues/32)) ([fed462a](https://github.com/gravity-ui/app-builder/commit/fed462a9803f4891ea0aff300133dec45c708fb9))
16
+
3
17
  ## [0.5.0](https://github.com/gravity-ui/app-builder/compare/v0.4.3...v0.5.0) (2023-06-17)
4
18
 
5
19
 
package/README.md CHANGED
@@ -201,6 +201,11 @@ With this `{rootDir}/src/ui/tsconfig.json`:
201
201
  - `watchPackages` (`boolean`) - watch all changes in `node_modules`.
202
202
  - `disableReactRefresh` (`boolean`) — disable `react-refresh` in dev mode.
203
203
  - `detectCircularDependencies` (`true | CircularDependenciesOptions`) - detect modules with circular dependencies, [more](https://github.com/aackerman/circular-dependency-plugin)
204
+ - `lazyCompilation` (`true | LazyCompilationConfig`) — enable experimental [lazy compilation](https://webpack.js.org/configuration/experiments/#experimentslazycompilation) feature
205
+ - `true` — enable feature
206
+ - `LazyCompilationConfig`
207
+ - `port` (`number`) — port where to listen to from the server
208
+ - `entries` (`boolean=true`) — if `false` - disables lazy compilation for `src/ui/entries` folder content
204
209
 
205
210
  ##### Production build
206
211
 
@@ -44,6 +44,14 @@ export interface LibraryConfig {
44
44
  };
45
45
  verbose?: boolean;
46
46
  }
47
+ interface LazyCompilationConfig {
48
+ port?: number;
49
+ /**
50
+ * @default true
51
+ * disable lazy compilation for entries
52
+ */
53
+ entries?: boolean;
54
+ }
47
55
  export interface ClientConfig {
48
56
  modules?: string[];
49
57
  /**
@@ -131,9 +139,7 @@ export interface ClientConfig {
131
139
  newJsxTransform?: boolean;
132
140
  disableForkTsChecker?: boolean;
133
141
  disableSourceMapGeneration?: boolean;
134
- lazyCompilation?: boolean | {
135
- port?: number;
136
- };
142
+ lazyCompilation?: boolean | LazyCompilationConfig;
137
143
  polyfill?: {
138
144
  process?: boolean;
139
145
  };
@@ -182,9 +188,7 @@ export type NormalizedClientConfig = Omit<ClientConfig, 'publicPathPrefix' | 'hi
182
188
  publicPathPrefix: string;
183
189
  hiddenSourceMap: boolean;
184
190
  svgr: NonNullable<ClientConfig['svgr']>;
185
- lazyCompilation?: {
186
- port: number;
187
- };
191
+ lazyCompilation?: LazyCompilationConfig;
188
192
  devServer: Omit<DevServerConfig, 'port' | 'type' | 'options'> & {
189
193
  port?: number;
190
194
  server: ServerConfiguration;
@@ -87,18 +87,7 @@ function webpackConfigFactory(webpackMode, config, { logger } = {}) {
87
87
  level: 'verbose',
88
88
  }
89
89
  : undefined,
90
- experiments: isEnvDevelopment
91
- ? {
92
- lazyCompilation: config.lazyCompilation
93
- ? {
94
- backend: {
95
- client: require.resolve('./lazy-client.js'),
96
- listen: config.lazyCompilation,
97
- },
98
- }
99
- : undefined,
100
- }
101
- : undefined,
90
+ experiments: configureExperiments(helperOptions),
102
91
  snapshot: {
103
92
  managedPaths: config.watchOptions?.watchPackages ? [] : undefined,
104
93
  },
@@ -170,6 +159,36 @@ function configureWatchOptions({ config }) {
170
159
  delete watchOptions.watchPackages;
171
160
  return watchOptions;
172
161
  }
162
+ function configureExperiments({ config, isEnvProduction, }) {
163
+ if (isEnvProduction) {
164
+ return undefined;
165
+ }
166
+ let lazyCompilation;
167
+ let port;
168
+ let entries;
169
+ if (config.lazyCompilation) {
170
+ if (typeof config.lazyCompilation === 'object') {
171
+ port = config.lazyCompilation.port;
172
+ entries = config.lazyCompilation.entries;
173
+ }
174
+ lazyCompilation = {
175
+ backend: {
176
+ client: require.resolve('./lazy-client.js'),
177
+ ...(port
178
+ ? {
179
+ listen: {
180
+ port,
181
+ },
182
+ }
183
+ : {}),
184
+ },
185
+ entries,
186
+ };
187
+ }
188
+ return {
189
+ lazyCompilation,
190
+ };
191
+ }
173
192
  function configureResolve({ isEnvProduction, config, tsLinkedPackages, }) {
174
193
  let alias = config.alias || {};
175
194
  alias = Object.entries(alias).reduce((result, [key, value]) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gravity-ui/app-builder",
3
- "version": "0.5.0",
3
+ "version": "0.5.2",
4
4
  "description": "Develop and build your React client-server projects, powered by typescript and webpack",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",