@roots/bud-build 6.14.3 → 6.15.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/lib/config/bail.d.ts +1 -1
- package/lib/config/cache.d.ts +1 -1
- package/lib/config/context.d.ts +1 -1
- package/lib/config/dependencies.d.ts +1 -1
- package/lib/config/devtool.d.ts +1 -1
- package/lib/config/entry.d.ts +1 -1
- package/lib/config/experiments.d.ts +1 -1
- package/lib/config/experiments.js +1 -0
- package/lib/config/externals.d.ts +1 -1
- package/lib/config/externalsType.d.ts +1 -1
- package/lib/config/index.d.ts +28 -29
- package/lib/config/index.js +27 -28
- package/lib/config/infrastructureLogging.d.ts +1 -1
- package/lib/config/infrastructureLogging.js +4 -4
- package/lib/config/loader.d.ts +1 -1
- package/lib/config/mode.d.ts +1 -1
- package/lib/config/module.d.ts +1 -1
- package/lib/config/name.d.ts +1 -1
- package/lib/config/node.d.ts +1 -1
- package/lib/config/optimization.d.ts +1 -1
- package/lib/config/optimization.js +1 -1
- package/lib/config/output/assetModuleFilename.js +1 -1
- package/lib/config/output/filename.js +1 -1
- package/lib/config/output/index.d.ts +1 -1
- package/lib/config/output/index.js +7 -2
- package/lib/config/parallelism.d.ts +1 -1
- package/lib/config/parallelism.js +8 -7
- package/lib/config/performance.d.ts +1 -1
- package/lib/config/plugins.d.ts +1 -1
- package/lib/config/plugins.js +4 -1
- package/lib/config/profile.d.ts +1 -1
- package/lib/config/recordsPath.d.ts +1 -1
- package/lib/config/resolve.d.ts +1 -1
- package/lib/config/resolve.js +1 -1
- package/lib/config/resolveLoader.d.ts +1 -1
- package/lib/config/resolveLoader.js +0 -3
- package/lib/config/snapshot.d.ts +1 -1
- package/lib/config/stats.d.ts +1 -1
- package/lib/config/stats.js +1 -19
- package/lib/config/target.d.ts +1 -1
- package/lib/helpers/isMjs.d.ts +2 -1
- package/lib/helpers/isMjs.js +2 -1
- package/lib/{shared/base.d.ts → helpers/registrable.d.ts} +2 -1
- package/lib/{shared/base.js → helpers/registrable.js} +7 -13
- package/lib/helpers/script-extension.d.ts +3 -0
- package/lib/helpers/script-extension.js +5 -0
- package/lib/index.d.ts +53 -7
- package/lib/index.js +5 -7
- package/lib/item/index.d.ts +4 -4
- package/lib/item/index.js +14 -38
- package/lib/{handlers/items/items.d.ts → items/index.d.ts} +1 -1
- package/lib/loader/index.d.ts +4 -4
- package/lib/loader/index.js +4 -4
- package/lib/{handlers/loaders/loaders.d.ts → loaders/index.d.ts} +1 -1
- package/lib/registry/index.d.ts +36 -0
- package/lib/{handlers/register.js → registry/index.js} +9 -5
- package/lib/rule/index.d.ts +3 -3
- package/lib/rule/index.js +22 -76
- package/lib/rules/css.d.ts +3 -0
- package/lib/{handlers/rules → rules}/css.js +2 -1
- package/lib/rules/css.module.d.ts +3 -0
- package/lib/{handlers/rules → rules}/css.module.js +2 -1
- package/lib/rules/csv.d.ts +3 -0
- package/lib/{handlers/rules → rules}/csv.js +2 -1
- package/lib/rules/font.d.ts +3 -0
- package/lib/rules/font.inline.d.ts +3 -0
- package/lib/{handlers/rules → rules}/font.inline.js +2 -1
- package/lib/{handlers/rules → rules}/font.js +2 -1
- package/lib/rules/html.d.ts +3 -0
- package/lib/{handlers/rules → rules}/html.js +2 -1
- package/lib/rules/image.d.ts +3 -0
- package/lib/rules/image.inline.d.ts +3 -0
- package/lib/{handlers/rules → rules}/image.inline.js +2 -1
- package/lib/rules/image.js +8 -0
- package/lib/rules/index.d.ts +15 -0
- package/lib/rules/index.js +15 -0
- package/lib/rules/js.d.ts +3 -0
- package/lib/{handlers/rules → rules}/js.js +2 -1
- package/lib/rules/json.d.ts +3 -0
- package/lib/{handlers/rules → rules}/json.js +2 -1
- package/lib/rules/svg.d.ts +3 -0
- package/lib/rules/svg.inline.d.ts +5 -0
- package/lib/{handlers/rules → rules}/svg.inline.js +3 -2
- package/lib/{handlers/rules → rules}/svg.js +2 -1
- package/lib/rules/toml.d.ts +3 -0
- package/lib/{handlers/rules → rules}/toml.js +2 -1
- package/lib/rules/webp.d.ts +3 -0
- package/lib/{handlers/rules → rules}/webp.js +2 -1
- package/lib/rules/yml.d.ts +3 -0
- package/lib/{handlers/rules → rules}/yml.js +2 -1
- package/lib/{service.d.ts → service/index.d.ts} +27 -24
- package/lib/{service.js → service/index.js} +45 -70
- package/package.json +121 -37
- package/src/config/bail.ts +1 -1
- package/src/config/cache.ts +1 -1
- package/src/config/context.ts +1 -1
- package/src/config/dependencies.ts +2 -2
- package/src/config/devtool.ts +1 -1
- package/src/config/entry.ts +1 -1
- package/src/config/experiments.ts +2 -1
- package/src/config/externals.ts +1 -1
- package/src/config/externalsType.ts +1 -1
- package/src/config/index.ts +28 -58
- package/src/config/infrastructureLogging.ts +6 -6
- package/src/config/loader.ts +1 -1
- package/src/config/mode.ts +1 -1
- package/src/config/module.ts +1 -2
- package/src/config/name.ts +1 -1
- package/src/config/node.ts +1 -1
- package/src/config/optimization.ts +2 -2
- package/src/config/output/assetModuleFilename.ts +1 -1
- package/src/config/output/filename.ts +1 -1
- package/src/config/output/index.ts +8 -6
- package/src/config/parallelism.ts +11 -8
- package/src/config/performance.ts +1 -1
- package/src/config/plugins.ts +5 -3
- package/src/config/profile.ts +1 -1
- package/src/config/recordsPath.ts +1 -1
- package/src/config/resolve.ts +3 -3
- package/src/config/resolveLoader.ts +1 -4
- package/src/config/snapshot.ts +1 -1
- package/src/config/stats.ts +2 -23
- package/src/config/target.ts +1 -1
- package/src/helpers/isMjs.ts +3 -1
- package/src/{shared/base.ts → helpers/registrable.ts} +3 -1
- package/src/helpers/{scriptExtension.ts → script-extension.ts} +4 -2
- package/src/index.ts +56 -7
- package/src/item/index.ts +5 -6
- package/src/{handlers/items/items.ts → items/index.ts} +1 -2
- package/src/loader/index.ts +6 -5
- package/src/{handlers/loaders/loaders.ts → loaders/index.ts} +1 -2
- package/src/{handlers/register.ts → registry/index.ts} +36 -13
- package/src/rule/index.ts +3 -4
- package/src/rules/css.module.ts +9 -0
- package/src/rules/css.ts +9 -0
- package/src/rules/csv.ts +9 -0
- package/src/rules/font.inline.ts +10 -0
- package/src/rules/font.ts +9 -0
- package/src/rules/html.ts +9 -0
- package/src/rules/image.inline.ts +10 -0
- package/src/rules/image.ts +12 -0
- package/src/rules/index.ts +15 -0
- package/src/{handlers/rules → rules}/js.ts +4 -2
- package/src/{handlers/rules → rules}/json.ts +5 -3
- package/src/{handlers/rules → rules}/svg.inline.ts +6 -4
- package/src/rules/svg.ts +9 -0
- package/src/{handlers/rules → rules}/toml.ts +5 -3
- package/src/rules/webp.ts +9 -0
- package/src/rules/yml.ts +9 -0
- package/src/{service.ts → service/index.ts} +43 -36
- package/lib/handlers/index.d.ts +0 -19
- package/lib/handlers/index.js +0 -5
- package/lib/handlers/register.d.ts +0 -13
- package/lib/handlers/rules/css.d.ts +0 -2
- package/lib/handlers/rules/css.module.d.ts +0 -2
- package/lib/handlers/rules/csv.d.ts +0 -2
- package/lib/handlers/rules/font.d.ts +0 -2
- package/lib/handlers/rules/font.inline.d.ts +0 -2
- package/lib/handlers/rules/html.d.ts +0 -2
- package/lib/handlers/rules/image.d.ts +0 -2
- package/lib/handlers/rules/image.inline.d.ts +0 -2
- package/lib/handlers/rules/image.js +0 -4
- package/lib/handlers/rules/index.d.ts +0 -17
- package/lib/handlers/rules/index.js +0 -32
- package/lib/handlers/rules/js.d.ts +0 -2
- package/lib/handlers/rules/json.d.ts +0 -2
- package/lib/handlers/rules/svg.d.ts +0 -2
- package/lib/handlers/rules/svg.inline.d.ts +0 -4
- package/lib/handlers/rules/toml.d.ts +0 -2
- package/lib/handlers/rules/webp.d.ts +0 -2
- package/lib/handlers/rules/yml.d.ts +0 -2
- package/lib/helpers/scriptExtension.d.ts +0 -2
- package/lib/helpers/scriptExtension.js +0 -4
- package/lib/types.d.ts +0 -52
- package/lib/types.js +0 -1
- package/src/config/index.test.ts +0 -125
- package/src/handlers/index.ts +0 -24
- package/src/handlers/rules/css.module.ts +0 -7
- package/src/handlers/rules/css.ts +0 -7
- package/src/handlers/rules/csv.test.ts +0 -31
- package/src/handlers/rules/csv.ts +0 -7
- package/src/handlers/rules/font.inline.ts +0 -8
- package/src/handlers/rules/font.ts +0 -7
- package/src/handlers/rules/html.ts +0 -7
- package/src/handlers/rules/image.inline.ts +0 -8
- package/src/handlers/rules/image.ts +0 -7
- package/src/handlers/rules/index.ts +0 -33
- package/src/handlers/rules/svg.inline.test.ts +0 -31
- package/src/handlers/rules/svg.ts +0 -7
- package/src/handlers/rules/toml.test.ts +0 -23
- package/src/handlers/rules/webp.ts +0 -7
- package/src/handlers/rules/yml.ts +0 -7
- package/src/rule/index.test.ts +0 -88
- package/src/types.ts +0 -57
- /package/lib/{handlers/items/items.js → items/index.js} +0 -0
- /package/lib/{handlers/loaders/loaders.js → loaders/index.js} +0 -0
package/lib/config/bail.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { Factory } from '
|
|
1
|
+
import type { Factory } from '@roots/bud-build/config';
|
|
2
2
|
export declare const bail: Factory<'bail'>;
|
package/lib/config/cache.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { Factory } from '
|
|
1
|
+
import type { Factory } from '@roots/bud-build/config';
|
|
2
2
|
export declare const cache: Factory<`cache`>;
|
package/lib/config/context.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { Factory } from '
|
|
1
|
+
import type { Factory } from '@roots/bud-build/config';
|
|
2
2
|
export declare const context: Factory<`context`>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { Factory } from '
|
|
1
|
+
import type { Factory } from '@roots/bud-build/config';
|
|
2
2
|
export declare const dependencies: Factory<`dependencies`>;
|
package/lib/config/devtool.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { Factory } from '
|
|
1
|
+
import type { Factory } from '@roots/bud-build/config';
|
|
2
2
|
export declare const devtool: Factory<`devtool`>;
|
package/lib/config/entry.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { Factory } from '
|
|
1
|
+
import type { Factory } from '@roots/bud-build/config';
|
|
2
2
|
export declare const entry: Factory<`entry`>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { Factory } from '
|
|
1
|
+
import type { Factory } from '@roots/bud-build/config';
|
|
2
2
|
export declare const experiments: Factory<`experiments`>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { Factory } from '
|
|
1
|
+
import type { Factory } from '@roots/bud-build/config';
|
|
2
2
|
export declare const externals: Factory<`externals`>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { Factory } from '
|
|
1
|
+
import type { Factory } from '@roots/bud-build/config';
|
|
2
2
|
export declare const externalsType: Factory<`externalsType`>;
|
package/lib/config/index.d.ts
CHANGED
|
@@ -1,35 +1,34 @@
|
|
|
1
1
|
import type { Bud } from '@roots/bud-framework';
|
|
2
2
|
import type { Configuration } from '@roots/bud-framework/config';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
export { bail, cache, context, dependencies, devtool, entry, experiments, externals, externalsType, infrastructureLogging, loader, mode, module, name, node, optimization, output, parallelism, performance, plugins, profile, recordsPath, resolve, resolveLoader, snapshot, stats, target, };
|
|
3
|
+
export { bail } from './bail.js';
|
|
4
|
+
export { cache } from './cache.js';
|
|
5
|
+
export { context } from './context.js';
|
|
6
|
+
export { dependencies } from './dependencies.js';
|
|
7
|
+
export { devtool } from './devtool.js';
|
|
8
|
+
export { entry } from './entry.js';
|
|
9
|
+
export { experiments } from './experiments.js';
|
|
10
|
+
export { externals } from './externals.js';
|
|
11
|
+
export { externalsType } from './externalsType.js';
|
|
12
|
+
export { infrastructureLogging } from './infrastructureLogging.js';
|
|
13
|
+
export { loader } from './loader.js';
|
|
14
|
+
export { mode } from './mode.js';
|
|
15
|
+
export { module } from './module.js';
|
|
16
|
+
export { name } from './name.js';
|
|
17
|
+
export { node } from './node.js';
|
|
18
|
+
export { optimization } from './optimization.js';
|
|
19
|
+
export { output } from './output/index.js';
|
|
20
|
+
export { parallelism } from './parallelism.js';
|
|
21
|
+
export { performance } from './performance.js';
|
|
22
|
+
export { plugins } from './plugins.js';
|
|
23
|
+
export { profile } from './profile.js';
|
|
24
|
+
export { recordsPath } from './recordsPath.js';
|
|
25
|
+
export { resolve } from './resolve.js';
|
|
26
|
+
export { resolveLoader } from './resolveLoader.js';
|
|
27
|
+
export { snapshot } from './snapshot.js';
|
|
28
|
+
export { stats } from './stats.js';
|
|
29
|
+
export { target } from './target.js';
|
|
31
30
|
export interface Factory<Key extends keyof Config, Config = Configuration> {
|
|
32
|
-
(app: Bud): Promise<Config[Key]>;
|
|
31
|
+
(app: Bud): Promise<Config[Key] | undefined>;
|
|
33
32
|
}
|
|
34
33
|
export type Records<Config = Configuration> = {
|
|
35
34
|
[Key in keyof Config as `${Key & string}`]: Factory<Key, Config>;
|
package/lib/config/index.js
CHANGED
|
@@ -1,28 +1,27 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
export { bail, cache, context, dependencies, devtool, entry, experiments, externals, externalsType, infrastructureLogging, loader, mode, module, name, node, optimization, output, parallelism, performance, plugins, profile, recordsPath, resolve, resolveLoader, snapshot, stats, target, };
|
|
1
|
+
export { bail } from './bail.js';
|
|
2
|
+
export { cache } from './cache.js';
|
|
3
|
+
export { context } from './context.js';
|
|
4
|
+
export { dependencies } from './dependencies.js';
|
|
5
|
+
export { devtool } from './devtool.js';
|
|
6
|
+
export { entry } from './entry.js';
|
|
7
|
+
export { experiments } from './experiments.js';
|
|
8
|
+
export { externals } from './externals.js';
|
|
9
|
+
export { externalsType } from './externalsType.js';
|
|
10
|
+
export { infrastructureLogging } from './infrastructureLogging.js';
|
|
11
|
+
export { loader } from './loader.js';
|
|
12
|
+
export { mode } from './mode.js';
|
|
13
|
+
export { module } from './module.js';
|
|
14
|
+
export { name } from './name.js';
|
|
15
|
+
export { node } from './node.js';
|
|
16
|
+
export { optimization } from './optimization.js';
|
|
17
|
+
export { output } from './output/index.js';
|
|
18
|
+
export { parallelism } from './parallelism.js';
|
|
19
|
+
export { performance } from './performance.js';
|
|
20
|
+
export { plugins } from './plugins.js';
|
|
21
|
+
export { profile } from './profile.js';
|
|
22
|
+
export { recordsPath } from './recordsPath.js';
|
|
23
|
+
export { resolve } from './resolve.js';
|
|
24
|
+
export { resolveLoader } from './resolveLoader.js';
|
|
25
|
+
export { snapshot } from './snapshot.js';
|
|
26
|
+
export { stats } from './stats.js';
|
|
27
|
+
export { target } from './target.js';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { Factory } from '
|
|
1
|
+
import type { Factory } from '@roots/bud-build/config';
|
|
2
2
|
export declare const infrastructureLogging: Factory<`infrastructureLogging`>;
|
|
@@ -3,16 +3,16 @@ export const infrastructureLogging = async (bud) => bud.hooks.filter(`build.infr
|
|
|
3
3
|
console: bud.hooks.filter(`build.infrastructureLogging.console`, {
|
|
4
4
|
...console,
|
|
5
5
|
error: (...args) => {
|
|
6
|
-
logger.scope(`webpack`).error(...args);
|
|
6
|
+
logger.scope(bud.label, `webpack`).error(...args);
|
|
7
7
|
},
|
|
8
8
|
info: (...args) => {
|
|
9
|
-
logger.scope(`webpack`).info(...args);
|
|
9
|
+
logger.scope(bud.label, `webpack`).info(...args);
|
|
10
10
|
},
|
|
11
11
|
log: (...args) => {
|
|
12
|
-
logger.scope(`webpack`).log(...args);
|
|
12
|
+
logger.scope(bud.label, `webpack`).log(...args);
|
|
13
13
|
},
|
|
14
14
|
warn: (...args) => {
|
|
15
|
-
logger.scope(`webpack`).info(...args);
|
|
15
|
+
logger.scope(bud.label, `webpack`).info(...args);
|
|
16
16
|
},
|
|
17
17
|
}),
|
|
18
18
|
level: bud.hooks.filter(`build.infrastructureLogging.level`, `log`),
|
package/lib/config/loader.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { Factory } from '
|
|
1
|
+
import type { Factory } from '@roots/bud-build/config';
|
|
2
2
|
export declare const loader: Factory<`loader`>;
|
package/lib/config/mode.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { Factory } from '
|
|
1
|
+
import type { Factory } from '@roots/bud-build/config';
|
|
2
2
|
export declare const mode: Factory<`mode`>;
|
package/lib/config/module.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { Factory } from '
|
|
1
|
+
import type { Factory } from '@roots/bud-build/config';
|
|
2
2
|
export declare const module: Factory<`module`>;
|
package/lib/config/name.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { Factory } from '
|
|
1
|
+
import type { Factory } from '@roots/bud-build/config';
|
|
2
2
|
export declare const name: Factory<`name`>;
|
package/lib/config/node.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { Factory } from '
|
|
1
|
+
import type { Factory } from '@roots/bud-build/config';
|
|
2
2
|
export declare const node: Factory<`node`>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { Factory } from '
|
|
1
|
+
import type { Factory } from '@roots/bud-build/config';
|
|
2
2
|
export declare const optimization: Factory<`optimization`>;
|
|
@@ -12,7 +12,7 @@ export const optimization = async ({ hooks: { filter }, isDevelopment, isProduct
|
|
|
12
12
|
* @see {@link https://webpack.js.org/configuration/optimization/#optimizationremoveavailablemodules}
|
|
13
13
|
*/
|
|
14
14
|
removeAvailableModules: filter(`build.optimization.removeAvailableModules`, false),
|
|
15
|
-
removeEmptyChunks: filter(`build.optimization.removeEmptyChunks`,
|
|
15
|
+
removeEmptyChunks: filter(`build.optimization.removeEmptyChunks`, false),
|
|
16
16
|
runtimeChunk: filter(`build.optimization.runtimeChunk`, `single`),
|
|
17
17
|
sideEffects: filter(`build.optimization.sideEffects`, isProduction),
|
|
18
18
|
splitChunks: filter(`build.optimization.splitChunks`, false),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export const assetModuleFilename = ({ filter, relPath }) => filter(`build.output.assetModuleFilename`, relPath(`@file`));
|
|
1
|
+
export const assetModuleFilename = ({ filter, relPath }) => filter(`build.output.assetModuleFilename`, relPath(`@file[query]`));
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import
|
|
1
|
+
import scriptExtension from '@roots/bud-build/helpers/script-extension';
|
|
2
2
|
export const filename = ({ filter, relPath }) => filter(`build.output.filename`, relPath(`js`, `@name${scriptExtension(filter, `.mjs`, `.js`)}`));
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { Factory } from '
|
|
1
|
+
import type { Factory } from '@roots/bud-build/config';
|
|
2
2
|
export declare const output: Factory<`output`>;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { isMjs } from '../../helpers/isMjs.js';
|
|
2
1
|
import { assetModuleFilename } from './assetModuleFilename.js';
|
|
3
2
|
import { filename } from './filename.js';
|
|
4
3
|
export const output = async ({ hooks: { filter }, isProduction, path, relPath, }) => filter(`build.output`, {
|
|
@@ -15,8 +14,14 @@ export const output = async ({ hooks: { filter }, isProduction, path, relPath, }
|
|
|
15
14
|
iife: filter(`build.output.iife`, undefined),
|
|
16
15
|
module: filter(`build.output.module`, false),
|
|
17
16
|
path: filter(`build.output.path`, path(`@dist`)),
|
|
17
|
+
/**
|
|
18
|
+
* Path info is not necessary unless the user
|
|
19
|
+
* really knows what's going on.
|
|
20
|
+
*
|
|
21
|
+
* @see {@link https://medium.com/@kenneth_chau/speeding-up-webpack-typescript-incremental-builds-by-7x-3912ba4c1d15}
|
|
22
|
+
*/
|
|
18
23
|
pathinfo: filter(`build.output.pathinfo`, false),
|
|
19
24
|
publicPath: filter(`build.output.publicPath`, `auto`),
|
|
20
|
-
scriptType: filter(`build.output.scriptType`,
|
|
25
|
+
scriptType: filter(`build.output.scriptType`, undefined),
|
|
21
26
|
uniqueName: filter(`build.output.uniqueName`, `@roots/bud`),
|
|
22
27
|
});
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { Factory } from '
|
|
1
|
+
import type { Factory } from '@roots/bud-build/config';
|
|
2
2
|
export declare const parallelism: Factory<`parallelism`>;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { cpus } from 'node:os';
|
|
2
|
-
export const parallelism = async ({ hooks, root, }) => {
|
|
3
|
-
const
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
2
|
+
export const parallelism = async ({ build, hooks, root, }) => {
|
|
3
|
+
const concurrency = 100;
|
|
4
|
+
const cores = Math.max(cpus().length, 1);
|
|
5
|
+
const available = cores * concurrency;
|
|
6
|
+
const compilations = Math.max(Object.keys(root.children ?? []).length, 1);
|
|
7
|
+
const parallelism = Math.max(Math.floor(available / compilations), 1);
|
|
8
|
+
build.logger.info(`parallelism set to`, parallelism);
|
|
9
|
+
return hooks.filter(`build.parallelism`, parallelism);
|
|
9
10
|
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { Factory } from '
|
|
1
|
+
import type { Factory } from '@roots/bud-build/config';
|
|
2
2
|
export declare const performance: Factory<`performance`>;
|
package/lib/config/plugins.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { Factory } from '
|
|
1
|
+
import type { Factory } from '@roots/bud-build/config';
|
|
2
2
|
export declare const plugins: Factory<`plugins`>;
|
package/lib/config/plugins.js
CHANGED
package/lib/config/profile.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { Factory } from '
|
|
1
|
+
import type { Factory } from '@roots/bud-build/config';
|
|
2
2
|
export declare const profile: Factory<`profile`>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { Factory } from '
|
|
1
|
+
import type { Factory } from '@roots/bud-build/config';
|
|
2
2
|
export declare const recordsPath: Factory<`recordsPath`>;
|
package/lib/config/resolve.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { Factory } from '
|
|
1
|
+
import type { Factory } from '@roots/bud-build/config';
|
|
2
2
|
export declare const resolve: Factory<`resolve`>;
|
package/lib/config/resolve.js
CHANGED
|
@@ -9,7 +9,7 @@ export const resolve = async (bud) => {
|
|
|
9
9
|
[`.js`]: [`.ts`, `.tsx`, `.js`],
|
|
10
10
|
[`.mjs`]: [`.mts`, `.mtx`, `.mjs`],
|
|
11
11
|
}),
|
|
12
|
-
extensions: Array.from(bud.hooks.filter(`build.resolve.extensions`, new Set([`.js`, `.mjs`, `.
|
|
12
|
+
extensions: Array.from(bud.hooks.filter(`build.resolve.extensions`, new Set([`.js`, `.mjs`, `.css`]))),
|
|
13
13
|
modules: await bud.hooks.filterAsync(`build.resolve.modules`, [
|
|
14
14
|
bud.hooks.filter(`location.@src`),
|
|
15
15
|
bud.hooks.filter(`location.@modules`),
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { Factory } from '
|
|
1
|
+
import type { Factory } from '@roots/bud-build/config';
|
|
2
2
|
export declare const resolveLoader: Factory<`resolveLoader`>;
|
|
@@ -3,9 +3,6 @@ export const resolveLoader = async ({ hooks, module, }) => hooks.filter(`build.r
|
|
|
3
3
|
'css-loader': await module.resolve(`@roots/bud-support/css-loader`),
|
|
4
4
|
'file-loader': await module.resolve(`@roots/bud-support/file-loader`),
|
|
5
5
|
'html-loader': await module.resolve(`@roots/bud-support/html-loader`),
|
|
6
|
-
json5: await module.resolve(`@roots/bud-support/json5`),
|
|
7
|
-
'mini-svg-data-uri': await module.resolve(`mini-svg-data-uri`),
|
|
8
6
|
'style-loader': await module.resolve(`@roots/bud-support/style-loader`),
|
|
9
|
-
toml: await module.resolve(`@roots/bud-support/toml`),
|
|
10
7
|
}),
|
|
11
8
|
});
|
package/lib/config/snapshot.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { Factory } from '
|
|
1
|
+
import type { Factory } from '@roots/bud-build/config';
|
|
2
2
|
export declare const snapshot: Factory<`snapshot`>;
|
package/lib/config/stats.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { Factory } from '
|
|
1
|
+
import type { Factory } from '@roots/bud-build/config';
|
|
2
2
|
export declare const stats: Factory<`stats`>;
|
package/lib/config/stats.js
CHANGED
|
@@ -1,19 +1 @@
|
|
|
1
|
-
export const stats = async (app) => app.hooks.filter(`build.stats`,
|
|
2
|
-
? {
|
|
3
|
-
all: false,
|
|
4
|
-
assets: true,
|
|
5
|
-
assetsSort: `size`,
|
|
6
|
-
builtAt: false,
|
|
7
|
-
children: false,
|
|
8
|
-
chunks: false,
|
|
9
|
-
entrypoints: true,
|
|
10
|
-
errors: true,
|
|
11
|
-
errorsCount: true,
|
|
12
|
-
hash: true,
|
|
13
|
-
modules: true,
|
|
14
|
-
outputPath: true,
|
|
15
|
-
timings: true,
|
|
16
|
-
warnings: true,
|
|
17
|
-
warningsCount: true,
|
|
18
|
-
}
|
|
19
|
-
: { preset: `none` });
|
|
1
|
+
export const stats = async (app) => app.hooks.filter(`build.stats`, { preset: `none` });
|
package/lib/config/target.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { Factory } from '
|
|
1
|
+
import type { Factory } from '@roots/bud-build/config';
|
|
2
2
|
export declare const target: Factory<`target`>;
|
package/lib/helpers/isMjs.d.ts
CHANGED
package/lib/helpers/isMjs.js
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
const isMjs = (filter) => filter(`build.experiments`)?.outputModule === true;
|
|
2
|
+
export { isMjs as default };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Bud } from '@roots/bud-framework';
|
|
2
2
|
import type { Base as BuildBase } from '@roots/bud-framework/services/build';
|
|
3
|
-
|
|
3
|
+
declare class Registrable implements BuildBase {
|
|
4
4
|
_app: () => Bud;
|
|
5
5
|
/**
|
|
6
6
|
* Constructor
|
|
@@ -15,3 +15,4 @@ export default class Base implements BuildBase {
|
|
|
15
15
|
unwrap<T = any>(maybeFunction: ((app: Bud, ...options: Array<any>) => T) | T, ...options: Array<any>): T;
|
|
16
16
|
wrap<T = any>(input: ((app: Bud) => T) | T): (app: Bud) => T;
|
|
17
17
|
}
|
|
18
|
+
export { Registrable as default };
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
import { __decorate, __metadata } from "tslib";
|
|
1
|
+
import { __decorate } from "tslib";
|
|
3
2
|
import { bind } from '@roots/bud-support/decorators/bind';
|
|
4
3
|
import isFunction from '@roots/bud-support/lodash/isFunction';
|
|
5
|
-
|
|
4
|
+
class Registrable {
|
|
6
5
|
_app;
|
|
7
6
|
/**
|
|
8
7
|
* Constructor
|
|
@@ -28,14 +27,9 @@ export default class Base {
|
|
|
28
27
|
}
|
|
29
28
|
}
|
|
30
29
|
__decorate([
|
|
31
|
-
bind
|
|
32
|
-
|
|
33
|
-
__metadata("design:paramtypes", [Object, Object]),
|
|
34
|
-
__metadata("design:returntype", typeof (_b = typeof T !== "undefined" && T) === "function" ? _b : Object)
|
|
35
|
-
], Base.prototype, "unwrap", null);
|
|
30
|
+
bind
|
|
31
|
+
], Registrable.prototype, "unwrap", null);
|
|
36
32
|
__decorate([
|
|
37
|
-
bind
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
__metadata("design:returntype", Function)
|
|
41
|
-
], Base.prototype, "wrap", null);
|
|
33
|
+
bind
|
|
34
|
+
], Registrable.prototype, "wrap", null);
|
|
35
|
+
export { Registrable as default };
|
package/lib/index.d.ts
CHANGED
|
@@ -4,10 +4,56 @@
|
|
|
4
4
|
* @see https://bud.js.org
|
|
5
5
|
* @see https://github.com/roots/bud
|
|
6
6
|
*/
|
|
7
|
-
import { Item } from '
|
|
8
|
-
import { Loader } from '
|
|
9
|
-
import { Rule } from '
|
|
10
|
-
import { Build } from '
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
7
|
+
import { default as Item } from '@roots/bud-build/item';
|
|
8
|
+
import { default as Loader } from '@roots/bud-build/loader';
|
|
9
|
+
import { default as Rule } from '@roots/bud-build/rule';
|
|
10
|
+
import { default as Build } from '@roots/bud-build/service';
|
|
11
|
+
declare module '@roots/bud-framework' {
|
|
12
|
+
interface Services {
|
|
13
|
+
build: Build;
|
|
14
|
+
}
|
|
15
|
+
interface Loaders {
|
|
16
|
+
css: Loader;
|
|
17
|
+
csv: Loader;
|
|
18
|
+
file: Loader;
|
|
19
|
+
html: Loader;
|
|
20
|
+
md: Loader;
|
|
21
|
+
minicss: Loader;
|
|
22
|
+
raw: Loader;
|
|
23
|
+
style: Loader;
|
|
24
|
+
url: Loader;
|
|
25
|
+
yml: Loader;
|
|
26
|
+
}
|
|
27
|
+
interface Items {
|
|
28
|
+
css: Item;
|
|
29
|
+
cssModule: Item;
|
|
30
|
+
csv: Item;
|
|
31
|
+
file: Item;
|
|
32
|
+
font: Item;
|
|
33
|
+
html: Item;
|
|
34
|
+
image: Item;
|
|
35
|
+
md: Item;
|
|
36
|
+
minicss: Item;
|
|
37
|
+
precss: Item;
|
|
38
|
+
raw: Item;
|
|
39
|
+
style: Item;
|
|
40
|
+
yml: Item;
|
|
41
|
+
}
|
|
42
|
+
interface Rules {
|
|
43
|
+
css: Rule;
|
|
44
|
+
cssModule: Rule;
|
|
45
|
+
csv: Rule;
|
|
46
|
+
font: Rule;
|
|
47
|
+
html: Rule;
|
|
48
|
+
image: Rule;
|
|
49
|
+
inlineFont: Rule;
|
|
50
|
+
inlineImage: Rule;
|
|
51
|
+
inlineSvg: Rule;
|
|
52
|
+
js: Rule;
|
|
53
|
+
json: Rule;
|
|
54
|
+
svg: Rule;
|
|
55
|
+
toml: Rule;
|
|
56
|
+
yml: Rule;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
export { Build as default, Item, Loader, Rule };
|
package/lib/index.js
CHANGED
|
@@ -6,10 +6,8 @@
|
|
|
6
6
|
* @see https://bud.js.org
|
|
7
7
|
* @see https://github.com/roots/bud
|
|
8
8
|
*/
|
|
9
|
-
import { Item } from '
|
|
10
|
-
import { Loader } from '
|
|
11
|
-
import { Rule } from '
|
|
12
|
-
import { Build } from '
|
|
13
|
-
|
|
14
|
-
export default Build;
|
|
15
|
-
export { Item, Loader, Rule };
|
|
9
|
+
import { default as Item } from '@roots/bud-build/item';
|
|
10
|
+
import { default as Loader } from '@roots/bud-build/loader';
|
|
11
|
+
import { default as Rule } from '@roots/bud-build/rule';
|
|
12
|
+
import { default as Build } from '@roots/bud-build/service';
|
|
13
|
+
export { Build as default, Item, Loader, Rule };
|
package/lib/item/index.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import type { Bud, Loaders } from '@roots/bud-framework';
|
|
2
2
|
import type * as Build from '@roots/bud-framework/services/build';
|
|
3
|
-
import
|
|
4
|
-
import
|
|
3
|
+
import Registrable from '@roots/bud-build/helpers/registrable';
|
|
4
|
+
import Loader from '@roots/bud-build/loader';
|
|
5
5
|
export type ConstructorOptions = Build.Item.ConstructorOptions;
|
|
6
6
|
/**
|
|
7
7
|
* Item class
|
|
8
8
|
*/
|
|
9
|
-
declare class Item extends
|
|
9
|
+
declare class Item extends Registrable implements Build.Item {
|
|
10
10
|
_app: () => Bud;
|
|
11
11
|
/**
|
|
12
12
|
* Identifier
|
|
@@ -55,4 +55,4 @@ declare class Item extends Base implements Build.Item {
|
|
|
55
55
|
*/
|
|
56
56
|
toWebpack(): Build.Item.Output;
|
|
57
57
|
}
|
|
58
|
-
export { Item };
|
|
58
|
+
export { Item as default };
|