@modern-js/utils 1.7.4 → 1.7.7

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,388 @@
1
+ import { Tapable } from 'tapable';
2
+ import * as webpack from 'webpack';
3
+ import * as https from 'https';
4
+
5
+ export = Config;
6
+
7
+ declare namespace __Config {
8
+ class Chained<Parent> {
9
+ end(): Parent;
10
+ }
11
+
12
+ class TypedChainedMap<Parent, Value> extends Chained<Parent> {
13
+ clear(): this;
14
+ delete(key: string): this;
15
+ has(key: string): boolean;
16
+ get(key: string): Value;
17
+ getOrCompute(key: string, compute: () => Value): Value;
18
+ set(key: string, value: Value): this;
19
+ merge(obj: { [key: string]: Value }): this;
20
+ entries(): { [key: string]: Value };
21
+ values(): Value[];
22
+ when(
23
+ condition: boolean,
24
+ trueBrancher: (obj: this) => void,
25
+ falseBrancher?: (obj: this) => void,
26
+ ): this;
27
+ }
28
+
29
+ class ChainedMap<Parent> extends TypedChainedMap<Parent, any> {}
30
+
31
+ class TypedChainedSet<Parent, Value> extends Chained<Parent> {
32
+ add(value: Value): this;
33
+ prepend(value: Value): this;
34
+ clear(): this;
35
+ delete(key: string): this;
36
+ has(key: string): boolean;
37
+ merge(arr: Value[]): this;
38
+ values(): Value[];
39
+ when(
40
+ condition: boolean,
41
+ trueBrancher: (obj: this) => void,
42
+ falseBrancher?: (obj: this) => void,
43
+ ): this;
44
+ }
45
+
46
+ class ChainedSet<Parent> extends TypedChainedSet<Parent, any> {}
47
+ }
48
+
49
+ declare class Config extends __Config.ChainedMap<void> {
50
+ devServer: Config.DevServer;
51
+ entryPoints: Config.TypedChainedMap<Config, Config.EntryPoint>;
52
+ module: Config.Module;
53
+ node: Config.ChainedMap<this>;
54
+ output: Config.Output;
55
+ optimization: Config.Optimization;
56
+ performance: Config.Performance;
57
+ plugins: Config.Plugins<this, webpack.Plugin>;
58
+ resolve: Config.Resolve;
59
+ resolveLoader: Config.ResolveLoader;
60
+
61
+ amd(value: { [moduleName: string]: boolean }): this;
62
+ bail(value: boolean): this;
63
+ cache(value: boolean | any): this;
64
+ devtool(value: Config.DevTool): this;
65
+ context(value: string): this;
66
+ externals(value: webpack.ExternalsElement | webpack.ExternalsElement[]): this;
67
+ loader(value: any): this;
68
+ name(value: string): this;
69
+ mode(value: 'none' | 'development' | 'production'): this;
70
+ parallelism(value: number): this;
71
+ profile(value: boolean): this;
72
+ recordsPath(value: string): this;
73
+ recordsInputPath(value: string): this;
74
+ recordsOutputPath(value: string): this;
75
+ stats(value: webpack.Options.Stats): this;
76
+ target(value: string): this;
77
+ watch(value: boolean): this;
78
+ watchOptions(value: webpack.Options.WatchOptions): this;
79
+
80
+ entry(name: string): Config.EntryPoint;
81
+ plugin(name: string): Config.Plugin<this, webpack.Plugin>;
82
+
83
+ toConfig(): webpack.Configuration;
84
+ }
85
+
86
+ declare namespace Config {
87
+ class Chained<Parent> extends __Config.Chained<Parent> {}
88
+ class TypedChainedMap<Parent, Value> extends __Config.TypedChainedMap<
89
+ Parent,
90
+ Value
91
+ > {}
92
+ class ChainedMap<Parent> extends __Config.TypedChainedMap<Parent, any> {}
93
+ class TypedChainedSet<Parent, Value> extends __Config.TypedChainedSet<
94
+ Parent,
95
+ Value
96
+ > {}
97
+ class ChainedSet<Parent> extends __Config.TypedChainedSet<Parent, any> {}
98
+
99
+ class Plugins<
100
+ Parent,
101
+ PluginType extends Tapable.Plugin = webpack.Plugin
102
+ > extends TypedChainedMap<Parent, Plugin<Parent, PluginType>> {}
103
+
104
+ class Plugin<Parent, PluginType extends Tapable.Plugin = webpack.Plugin>
105
+ extends ChainedMap<Parent>
106
+ implements Orderable {
107
+ init<P extends PluginType | PluginClass<PluginType>>(
108
+ value: (
109
+ plugin: P,
110
+ args: P extends PluginClass ? ConstructorParameters<P> : any[],
111
+ ) => PluginType,
112
+ ): this;
113
+ use<P extends string | PluginType | PluginClass<PluginType>>(
114
+ plugin: P,
115
+ args?: P extends PluginClass ? ConstructorParameters<P> : any[],
116
+ ): this;
117
+ tap<P extends PluginClass<PluginType>>(
118
+ f: (args: ConstructorParameters<P>) => ConstructorParameters<P>,
119
+ ): this;
120
+
121
+ // Orderable
122
+ before(name: string): this;
123
+ after(name: string): this;
124
+ }
125
+
126
+ class Module extends ChainedMap<Config> {
127
+ rules: TypedChainedMap<this, Rule>;
128
+ rule(name: string): Rule;
129
+ noParse(
130
+ noParse: RegExp | RegExp[] | ((contentPath: string) => boolean),
131
+ ): this;
132
+ strictExportPresence(value: boolean): this;
133
+ }
134
+
135
+ class Output extends ChainedMap<Config> {
136
+ auxiliaryComment(value: string | { [comment: string]: string }): this;
137
+ chunkFilename(value: string): this;
138
+ chunkLoadTimeout(value: number): this;
139
+ crossOriginLoading(value: boolean | string): this;
140
+ filename(value: string): this;
141
+ library(value: string): this;
142
+ libraryExport(value: string | string[]): this;
143
+ libraryTarget(value: string): this;
144
+ devtoolFallbackModuleFilenameTemplate(value: any): this;
145
+ devtoolLineToLine(value: any): this;
146
+ devtoolModuleFilenameTemplate(value: any): this;
147
+ devtoolNamespace(value: string): this;
148
+ globalObject(value: string): this;
149
+ hashFunction(value: string): this;
150
+ hashDigest(value: string): this;
151
+ hashDigestLength(value: number): this;
152
+ hashSalt(value: any): this;
153
+ hotUpdateChunkFilename(value: string): this;
154
+ hotUpdateFunction(value: any): this;
155
+ hotUpdateMainFilename(value: string): this;
156
+ jsonpFunction(value: string): this;
157
+ path(value: string): this;
158
+ pathinfo(value: boolean): this;
159
+ publicPath(value: string): this;
160
+ sourceMapFilename(value: string): this;
161
+ sourcePrefix(value: string): this;
162
+ strictModuleExceptionHandling(value: boolean): this;
163
+ umdNamedDefine(value: boolean): this;
164
+ futureEmitAssets(value: boolean): this;
165
+ }
166
+
167
+ class DevServer extends ChainedMap<Config> {
168
+ allowedHosts: TypedChainedSet<this, string>;
169
+
170
+ after(
171
+ value: (app: any, server: any, compiler: webpack.Compiler) => void,
172
+ ): this;
173
+ before(
174
+ value: (app: any, server: any, compiler: webpack.Compiler) => void,
175
+ ): this;
176
+ bonjour(value: boolean): this;
177
+ clientLogLevel(value: 'none' | 'error' | 'warning' | 'info'): this;
178
+ color(value: boolean): this;
179
+ compress(value: boolean): this;
180
+ contentBase(value: boolean | string | string[]): this;
181
+ disableHostCheck(value: boolean): this;
182
+ filename(value: string): this;
183
+ headers(value: { [header: string]: string }): this;
184
+ historyApiFallback(value: boolean | any): this;
185
+ host(value: string): this;
186
+ hot(value: boolean): this;
187
+ hotOnly(value: boolean): this;
188
+ http2(value: boolean): this;
189
+ https(value: boolean | https.ServerOptions): this;
190
+ index(value: string): this;
191
+ info(value: boolean): this;
192
+ inline(value: boolean): this;
193
+ lazy(value: boolean): this;
194
+ mimeTypes(value: Object): this;
195
+ noInfo(value: boolean): this;
196
+ open(value: boolean): this;
197
+ openPage(value: string | string[]): this;
198
+ overlay(value: boolean | { warnings?: boolean; errors?: boolean }): this;
199
+ pfx(value: string): this;
200
+ pfxPassphrase(value: string): this;
201
+ port(value: number): this;
202
+ progress(value: boolean): this;
203
+ proxy(value: any): this;
204
+ public(value: string): this;
205
+ publicPath(publicPath: string): this;
206
+ quiet(value: boolean): this;
207
+ setup(value: (expressApp: any) => void): this;
208
+ socket(value: string): this;
209
+ sockHost(value: string): this;
210
+ sockPath(value: string): this;
211
+ sockPort(value: number): this;
212
+ staticOptions(value: any): this;
213
+ stats(value: webpack.Options.Stats): this;
214
+ stdin(value: boolean): this;
215
+ useLocalIp(value: boolean): this;
216
+ watchContentBase(value: boolean): this;
217
+ watchOptions(value: any): this;
218
+ writeToDisk(value: boolean): this;
219
+ }
220
+
221
+ class Performance extends ChainedMap<Config> {
222
+ hints(value: boolean | 'error' | 'warning'): this;
223
+ maxEntrypointSize(value: number): this;
224
+ maxAssetSize(value: number): this;
225
+ assetFilter(value: (assetFilename: string) => boolean): this;
226
+ }
227
+
228
+ class EntryPoint extends TypedChainedSet<Config, string> {}
229
+
230
+ class Resolve<T = Config> extends ChainedMap<T> {
231
+ alias: TypedChainedMap<this, string>;
232
+ aliasFields: TypedChainedSet<this, string>;
233
+ descriptionFiles: TypedChainedSet<this, string>;
234
+ extensions: TypedChainedSet<this, string>;
235
+ mainFields: TypedChainedSet<this, string>;
236
+ mainFiles: TypedChainedSet<this, string>;
237
+ modules: TypedChainedSet<this, string>;
238
+ plugins: TypedChainedMap<this, Plugin<this, webpack.ResolvePlugin>>;
239
+
240
+ enforceExtension(value: boolean): this;
241
+ enforceModuleExtension(value: boolean): this;
242
+ unsafeCache(value: boolean | RegExp | RegExp[]): this;
243
+ symlinks(value: boolean): this;
244
+ cachePredicate(
245
+ value: (data: { path: string; request: string }) => boolean,
246
+ ): this;
247
+ cacheWithContext(value: boolean): this;
248
+
249
+ plugin(name: string): Plugin<this, webpack.ResolvePlugin>;
250
+ }
251
+
252
+ class ResolveLoader extends Resolve {
253
+ moduleExtensions: ChainedSet<this>;
254
+ packageMains: ChainedSet<this>;
255
+ }
256
+
257
+ class Rule<T = Module> extends ChainedMap<T> implements Orderable {
258
+ rules: TypedChainedMap<this, Rule<Rule>>;
259
+ oneOfs: TypedChainedMap<this, Rule<Rule>>;
260
+ uses: TypedChainedMap<this, Use>;
261
+ include: TypedChainedSet<this, webpack.Condition>;
262
+ exclude: TypedChainedSet<this, webpack.Condition>;
263
+ resolve: Resolve<Rule<T>>;
264
+
265
+ parser(value: { [optName: string]: any }): this;
266
+ test(value: webpack.Condition | webpack.Condition[]): this;
267
+ type(
268
+ value:
269
+ | 'javascript/auto'
270
+ | 'javascript/dynamic'
271
+ | 'javascript/esm'
272
+ | 'json'
273
+ | 'webassembly/experimental',
274
+ ): this;
275
+ enforce(value: 'pre' | 'post'): this;
276
+
277
+ use(name: string): Use<this>;
278
+ rule(name: string): Rule<Rule>;
279
+ oneOf(name: string): Rule<Rule>;
280
+ pre(): this;
281
+ post(): this;
282
+ before(name: string): this;
283
+ after(name: string): this;
284
+ resourceQuery(value: webpack.Condition | webpack.Condition[]): this;
285
+ }
286
+
287
+ class Optimization extends ChainedMap<Config> {
288
+ concatenateModules(value: boolean): this;
289
+ flagIncludedChunks(value: boolean): this;
290
+ mergeDuplicateChunks(value: boolean): this;
291
+ minimize(value: boolean): this;
292
+ minimizer(name: string): Config.Plugin<this, webpack.Plugin>;
293
+ namedChunks(value: boolean): this;
294
+ namedModules(value: boolean): this;
295
+ nodeEnv(value: boolean | string): this;
296
+ noEmitOnErrors(value: boolean): this;
297
+ occurrenceOrder(value: boolean): this;
298
+ portableRecords(value: boolean): this;
299
+ providedExports(value: boolean): this;
300
+ removeAvailableModules(value: boolean): this;
301
+ removeEmptyChunks(value: boolean): this;
302
+ runtimeChunk(value: boolean | 'single' | 'multiple' | RuntimeChunk): this;
303
+ sideEffects(value: boolean): this;
304
+ splitChunks(value: SplitChunksOptions): this;
305
+ usedExports(value: boolean): this;
306
+ }
307
+
308
+ interface RuntimeChunk {
309
+ name: string | RuntimeChunkFunction;
310
+ }
311
+
312
+ type RuntimeChunkFunction = (entryPoint: EntryPoint) => string;
313
+
314
+ interface SplitChunksOptions {
315
+ [name: string]: any;
316
+ }
317
+
318
+ interface LoaderOptions {
319
+ [name: string]: any;
320
+ }
321
+
322
+ class Use<Parent = Rule> extends ChainedMap<Parent> implements Orderable {
323
+ loader(value: string): this;
324
+ options(value: LoaderOptions): this;
325
+
326
+ tap(f: (options: LoaderOptions) => LoaderOptions): this;
327
+
328
+ // Orderable
329
+ before(name: string): this;
330
+ after(name: string): this;
331
+ }
332
+
333
+ type DevTool =
334
+ | 'eval'
335
+ | 'inline-source-map'
336
+ | 'cheap-eval-source-map'
337
+ | 'cheap-source-map'
338
+ | 'cheap-module-eval-source-map'
339
+ | 'cheap-module-source-map'
340
+ | 'eval-source-map'
341
+ | 'source-map'
342
+ | 'nosources-source-map'
343
+ | 'hidden-source-map'
344
+ | 'nosources-source-map'
345
+ | '@eval'
346
+ | '@inline-source-map'
347
+ | '@cheap-eval-source-map'
348
+ | '@cheap-source-map'
349
+ | '@cheap-module-eval-source-map'
350
+ | '@cheap-module-source-map'
351
+ | '@eval-source-map'
352
+ | '@source-map'
353
+ | '@nosources-source-map'
354
+ | '@hidden-source-map'
355
+ | '@nosources-source-map'
356
+ | '#eval'
357
+ | '#inline-source-map'
358
+ | '#cheap-eval-source-map'
359
+ | '#cheap-source-map'
360
+ | '#cheap-module-eval-source-map'
361
+ | '#cheap-module-source-map'
362
+ | '#eval-source-map'
363
+ | '#source-map'
364
+ | '#nosources-source-map'
365
+ | '#hidden-source-map'
366
+ | '#nosources-source-map'
367
+ | '#@eval'
368
+ | '#@inline-source-map'
369
+ | '#@cheap-eval-source-map'
370
+ | '#@cheap-source-map'
371
+ | '#@cheap-module-eval-source-map'
372
+ | '#@cheap-module-source-map'
373
+ | '#@eval-source-map'
374
+ | '#@source-map'
375
+ | '#@nosources-source-map'
376
+ | '#@hidden-source-map'
377
+ | '#@nosources-source-map'
378
+ | boolean;
379
+
380
+ interface PluginClass<PluginType extends Tapable.Plugin = webpack.Plugin> {
381
+ new (...opts: any[]): PluginType;
382
+ }
383
+
384
+ interface Orderable {
385
+ before(name: string): this;
386
+ after(name: string): this;
387
+ }
388
+ }
@@ -1,6 +1,2 @@
1
- export declare const applyOptionsChain: <T, U>(defaults: T, options?: T | (T | ((config: T, utils?: U | undefined) => void | T))[] | ((config: T, utils?: U | undefined) => void | T) | undefined, utils?: U | undefined, mergeFn?: {
2
- <T_1, U_1>(target: T_1, source: U_1): T_1 & U_1;
3
- <T_2, U_2, V>(target: T_2, source1: U_2, source2: V): T_2 & U_2 & V;
4
- <T_3, U_3, V_1, W>(target: T_3, source1: U_3, source2: V_1, source3: W): T_3 & U_3 & V_1 & W;
5
- (target: object, ...sources: any[]): any;
6
- }) => T;
1
+ export declare function applyOptionsChain<T, U>(defaults: T, options?: T | ((config: T, utils?: U) => T | void) | Array<T | ((config: T, utils?: U) => T | void)>, utils?: U, mergeFn?: typeof Object.assign): T;
2
+ export declare function applyOptionsChain<T, U>(defaults: T, options: T | ((config: T, utils: U) => T | void) | Array<T | ((config: T, utils: U) => T | void)>, utils: U, mergeFn?: typeof Object.assign): T;
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.applyOptionsChain = void 0;
4
4
  // eslint-disable-next-line import/no-useless-path-segments
5
5
  const index_1 = require("./index");
6
- const applyOptionsChain = (defaults, options, utils, mergeFn = Object.assign) => {
6
+ function applyOptionsChain(defaults, options, utils, mergeFn = Object.assign) {
7
7
  if (!options) {
8
8
  return defaults;
9
9
  }
@@ -20,11 +20,11 @@ const applyOptionsChain = (defaults, options, utils, mergeFn = Object.assign) =>
20
20
  }
21
21
  }
22
22
  else if (Array.isArray(options)) {
23
- return options.reduce((memo, cur) => (0, exports.applyOptionsChain)(memo, cur, utils, mergeFn), defaults);
23
+ return options.reduce((memo, cur) => applyOptionsChain(memo, cur, utils, mergeFn), defaults);
24
24
  }
25
25
  else {
26
26
  throw new Error(`applyOptionsChain error:\ndefault options is: ${JSON.stringify(defaults)}`);
27
27
  }
28
28
  return defaults;
29
- };
29
+ }
30
30
  exports.applyOptionsChain = applyOptionsChain;
@@ -0,0 +1,116 @@
1
+ export declare const CHAIN_ID: {
2
+ /** Predefined rules */
3
+ readonly RULE: {
4
+ /** Rule for .mjs */
5
+ readonly MJS: "mjs";
6
+ /** Rule for predefined loaders */
7
+ readonly LOADERS: "loaders";
8
+ };
9
+ /** Predefined rule groups */
10
+ readonly ONE_OF: {
11
+ readonly JS: "js";
12
+ readonly TS: "ts";
13
+ readonly CSS: "css";
14
+ readonly LESS: "less";
15
+ readonly SASS: "sass";
16
+ readonly YAML: "yml";
17
+ readonly TOML: "toml";
18
+ readonly FALLBACK: "fallback";
19
+ readonly MARKDOWN: "markdown";
20
+ readonly BFF_CLIENT: "bff-client";
21
+ readonly CSS_MODULES: "css-modules";
22
+ readonly LESS_MODULES: "less-modules";
23
+ readonly SASS_MODULES: "sass-modules";
24
+ readonly SVG: "svg";
25
+ readonly SVG_URL: "svg-url";
26
+ readonly SVG_INLINE: "svg-inline";
27
+ readonly ASSETS: "assets";
28
+ readonly ASSETS_URL: "assets-url";
29
+ readonly ASSETS_INLINE: "assets-inline";
30
+ };
31
+ /** Predefined loaders */
32
+ readonly USE: {
33
+ /** ts-loader */
34
+ readonly TS: "ts";
35
+ /** css-loader */
36
+ readonly CSS: "css";
37
+ /** url-loader */
38
+ readonly URL: "url";
39
+ /** file-loader */
40
+ readonly FILE: "file";
41
+ /** @svgr/webpack */
42
+ readonly SVGR: "svgr";
43
+ /** yaml-loader */
44
+ readonly YAML: "yaml";
45
+ /** toml-loader */
46
+ readonly TOML: "toml";
47
+ /** html-loader */
48
+ readonly HTML: "html";
49
+ /** babel-loader */
50
+ readonly BABEL: "babel";
51
+ /** style-loader */
52
+ readonly STYLE: "style-loader";
53
+ /** postcss-loader */
54
+ readonly POSTCSS: "postcss";
55
+ /** markdown-loader */
56
+ readonly MARKDOWN: "markdown";
57
+ /** css-modules-typescript-loader */
58
+ readonly CSS_MODULES_TS: "css-modules-typescript";
59
+ /** mini-css-extract-plugin.loader */
60
+ readonly MINI_CSS_EXTRACT: "mini-css-extract";
61
+ };
62
+ /** Predefined plugins */
63
+ readonly PLUGIN: {
64
+ /** HotModuleReplacementPlugin */
65
+ readonly HMR: "hmr";
66
+ /** CopyWebpackPlugin */
67
+ readonly COPY: "copy";
68
+ /** HtmlWebpackPlugin */
69
+ readonly HTML: "html";
70
+ /** DefinePlugin */
71
+ readonly DEFINE: "define";
72
+ /** IgnorePlugin */
73
+ readonly IGNORE: "ignore";
74
+ /** BannerPlugin */
75
+ readonly BANNER: "banner";
76
+ /** Webpackbar */
77
+ readonly PROGRESS: "progress";
78
+ /** AppIconPlugin */
79
+ readonly APP_ICON: "app-icon";
80
+ /** LoadableWebpackPlugin */
81
+ readonly LOADABLE: "loadable";
82
+ /** WebpackManifestPlugin */
83
+ readonly MANIFEST: "webpack-manifest";
84
+ /** ForkTsCheckerWebpackPlugin */
85
+ readonly TS_CHECKER: "ts-checker";
86
+ /** InlineChunkHtmlPlugin */
87
+ readonly INLINE_HTML: "inline-html";
88
+ /** WebpackBundleAnalyzer */
89
+ readonly BUNDLE_ANALYZER: "bundle-analyze";
90
+ /** BottomTemplatePlugin */
91
+ readonly BOTTOM_TEMPLATE: "bottom-template";
92
+ /** MiniCssExtractPlugin */
93
+ readonly MINI_CSS_EXTRACT: "mini-css-extract";
94
+ /** ReactFastRefreshPlugin */
95
+ readonly REACT_FAST_REFRESH: "react-fast-refresh";
96
+ /** ProvidePlugin for node polyfill */
97
+ readonly NODE_POLYFILL_PROVIDE: "node-polyfill-provide";
98
+ };
99
+ /** Predefined minimizers */
100
+ readonly MINIMIZER: {
101
+ /** TerserWebpackPlugin */
102
+ readonly JS: "js";
103
+ /** CssMinimizerWebpackPlugin */
104
+ readonly CSS: "css";
105
+ /** ESBuildPlugin */
106
+ readonly ESBUILD: "js-css";
107
+ };
108
+ /** Predefined resolve plugins */
109
+ readonly RESOLVE_PLUGIN: {
110
+ /** ModuleScopePlugin */
111
+ readonly MODULE_SCOPE: "module-scope";
112
+ /** TsConfigPathsPlugin */
113
+ readonly TS_CONFIG_PATHS: "ts-config-paths";
114
+ };
115
+ };
116
+ export declare type ChainIdentifier = typeof CHAIN_ID;
@@ -0,0 +1,118 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CHAIN_ID = void 0;
4
+ exports.CHAIN_ID = {
5
+ /** Predefined rules */
6
+ RULE: {
7
+ /** Rule for .mjs */
8
+ MJS: 'mjs',
9
+ /** Rule for predefined loaders */
10
+ LOADERS: 'loaders',
11
+ },
12
+ /** Predefined rule groups */
13
+ ONE_OF: {
14
+ JS: 'js',
15
+ TS: 'ts',
16
+ CSS: 'css',
17
+ LESS: 'less',
18
+ SASS: 'sass',
19
+ YAML: 'yml',
20
+ TOML: 'toml',
21
+ FALLBACK: 'fallback',
22
+ MARKDOWN: 'markdown',
23
+ BFF_CLIENT: 'bff-client',
24
+ CSS_MODULES: 'css-modules',
25
+ LESS_MODULES: 'less-modules',
26
+ SASS_MODULES: 'sass-modules',
27
+ SVG: 'svg',
28
+ SVG_URL: 'svg-url',
29
+ SVG_INLINE: 'svg-inline',
30
+ ASSETS: 'assets',
31
+ ASSETS_URL: 'assets-url',
32
+ ASSETS_INLINE: 'assets-inline',
33
+ },
34
+ /** Predefined loaders */
35
+ USE: {
36
+ /** ts-loader */
37
+ TS: 'ts',
38
+ /** css-loader */
39
+ CSS: 'css',
40
+ /** url-loader */
41
+ URL: 'url',
42
+ /** file-loader */
43
+ FILE: 'file',
44
+ /** @svgr/webpack */
45
+ SVGR: 'svgr',
46
+ /** yaml-loader */
47
+ YAML: 'yaml',
48
+ /** toml-loader */
49
+ TOML: 'toml',
50
+ /** html-loader */
51
+ HTML: 'html',
52
+ /** babel-loader */
53
+ BABEL: 'babel',
54
+ /** style-loader */
55
+ STYLE: 'style-loader',
56
+ /** postcss-loader */
57
+ POSTCSS: 'postcss',
58
+ /** markdown-loader */
59
+ MARKDOWN: 'markdown',
60
+ /** css-modules-typescript-loader */
61
+ CSS_MODULES_TS: 'css-modules-typescript',
62
+ /** mini-css-extract-plugin.loader */
63
+ MINI_CSS_EXTRACT: 'mini-css-extract',
64
+ },
65
+ /** Predefined plugins */
66
+ PLUGIN: {
67
+ /** HotModuleReplacementPlugin */
68
+ HMR: 'hmr',
69
+ /** CopyWebpackPlugin */
70
+ COPY: 'copy',
71
+ /** HtmlWebpackPlugin */
72
+ HTML: 'html',
73
+ /** DefinePlugin */
74
+ DEFINE: 'define',
75
+ /** IgnorePlugin */
76
+ IGNORE: 'ignore',
77
+ /** BannerPlugin */
78
+ BANNER: 'banner',
79
+ /** Webpackbar */
80
+ PROGRESS: 'progress',
81
+ /** AppIconPlugin */
82
+ APP_ICON: 'app-icon',
83
+ /** LoadableWebpackPlugin */
84
+ LOADABLE: 'loadable',
85
+ /** WebpackManifestPlugin */
86
+ MANIFEST: 'webpack-manifest',
87
+ /** ForkTsCheckerWebpackPlugin */
88
+ TS_CHECKER: 'ts-checker',
89
+ /** InlineChunkHtmlPlugin */
90
+ INLINE_HTML: 'inline-html',
91
+ /** WebpackBundleAnalyzer */
92
+ BUNDLE_ANALYZER: 'bundle-analyze',
93
+ /** BottomTemplatePlugin */
94
+ BOTTOM_TEMPLATE: 'bottom-template',
95
+ /** MiniCssExtractPlugin */
96
+ MINI_CSS_EXTRACT: 'mini-css-extract',
97
+ /** ReactFastRefreshPlugin */
98
+ REACT_FAST_REFRESH: 'react-fast-refresh',
99
+ /** ProvidePlugin for node polyfill */
100
+ NODE_POLYFILL_PROVIDE: 'node-polyfill-provide',
101
+ },
102
+ /** Predefined minimizers */
103
+ MINIMIZER: {
104
+ /** TerserWebpackPlugin */
105
+ JS: 'js',
106
+ /** CssMinimizerWebpackPlugin */
107
+ CSS: 'css',
108
+ /** ESBuildPlugin */
109
+ ESBUILD: 'js-css',
110
+ },
111
+ /** Predefined resolve plugins */
112
+ RESOLVE_PLUGIN: {
113
+ /** ModuleScopePlugin */
114
+ MODULE_SCOPE: 'module-scope',
115
+ /** TsConfigPathsPlugin */
116
+ TS_CONFIG_PATHS: 'ts-config-paths',
117
+ },
118
+ };
@@ -26,7 +26,8 @@ export { default as dotenvExpand } from '../compiled/dotenv-expand';
26
26
  export { default as browserslist } from '../compiled/browserslist';
27
27
  export { default as recursiveReaddir } from '../compiled/recursive-readdir';
28
28
  export { program, Command } from '../compiled/commander';
29
- export { Signale, type SignaleOptions } from '../compiled/signale';
29
+ export { Signale } from '../compiled/signale';
30
+ export type { SignaleOptions } from '../compiled/signale';
30
31
  export type { IOptions as GlobOptions } from '../compiled/glob';
31
32
  export type { GlobbyOptions } from '../compiled/globby';
32
33
  export type { FSWatcher, WatchOptions } from '../compiled/chokidar';
package/dist/index.d.ts CHANGED
@@ -31,3 +31,4 @@ export * from './emptyDir';
31
31
  export * from './getServerConfig';
32
32
  export * from './ssr';
33
33
  export * from './analyzeProject';
34
+ export * from './chainId';
package/dist/index.js CHANGED
@@ -43,3 +43,4 @@ __exportStar(require("./emptyDir"), exports);
43
43
  __exportStar(require("./getServerConfig"), exports);
44
44
  __exportStar(require("./ssr"), exports);
45
45
  __exportStar(require("./analyzeProject"), exports);
46
+ __exportStar(require("./chainId"), exports);
package/dist/monorepo.js CHANGED
@@ -30,7 +30,11 @@ exports.isPnpmWorkspaces = isPnpmWorkspaces;
30
30
  const isMonorepo = (root) => (0, exports.isLerna)(root) || (0, exports.isYarnWorkspaces)(root) || (0, exports.isPnpmWorkspaces)(root);
31
31
  exports.isMonorepo = isMonorepo;
32
32
  const isModernjsMonorepo = (root) => {
33
- const json = JSON.parse(fs_1.default.readFileSync(path_1.default.join(root, 'package.json'), 'utf8'));
33
+ const pkgJsonPath = path_1.default.join(root, 'package.json');
34
+ if (!fs_1.default.existsSync(pkgJsonPath)) {
35
+ return false;
36
+ }
37
+ const json = JSON.parse(fs_1.default.readFileSync(pkgJsonPath, 'utf8'));
34
38
  const deps = {
35
39
  ...(json.dependencies || {}),
36
40
  ...(json.devDependencies || {}),