@roots/bud-build 6.6.4 → 6.6.6
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/README.md +28 -19
- package/docs/exports.md +13 -0
- package/docs/rules.md +32 -0
- package/lib/config/bail.d.ts +2 -2
- package/lib/config/bail.d.ts.map +1 -1
- package/lib/config/bail.js +1 -1
- package/lib/config/bail.js.map +1 -1
- package/lib/config/cache.d.ts +2 -2
- package/lib/config/cache.d.ts.map +1 -1
- package/lib/config/cache.js +1 -1
- package/lib/config/cache.js.map +1 -1
- package/lib/config/context.d.ts +2 -2
- package/lib/config/context.d.ts.map +1 -1
- package/lib/config/context.js +1 -1
- package/lib/config/context.js.map +1 -1
- package/lib/config/dependencies.d.ts +3 -0
- package/lib/config/dependencies.d.ts.map +1 -0
- package/lib/config/dependencies.js +5 -0
- package/lib/config/dependencies.js.map +1 -0
- package/lib/config/devtool.d.ts +2 -2
- package/lib/config/devtool.d.ts.map +1 -1
- package/lib/config/devtool.js +1 -1
- package/lib/config/devtool.js.map +1 -1
- package/lib/config/entry.d.ts +3 -0
- package/lib/config/entry.d.ts.map +1 -0
- package/lib/config/entry.js +2 -0
- package/lib/config/entry.js.map +1 -0
- package/lib/config/experiments.d.ts +2 -2
- package/lib/config/experiments.d.ts.map +1 -1
- package/lib/config/experiments.js +1 -1
- package/lib/config/experiments.js.map +1 -1
- package/lib/config/externals.d.ts +3 -0
- package/lib/config/externals.d.ts.map +1 -0
- package/lib/config/externals.js +2 -0
- package/lib/config/externals.js.map +1 -0
- package/lib/config/externalsType.d.ts +3 -0
- package/lib/config/externalsType.d.ts.map +1 -0
- package/lib/config/externalsType.js +2 -0
- package/lib/config/externalsType.js.map +1 -0
- package/lib/config/index.d.ts +35 -0
- package/lib/config/index.d.ts.map +1 -0
- package/lib/config/index.js +27 -0
- package/lib/config/index.js.map +1 -0
- package/lib/config/infrastructureLogging.d.ts +2 -2
- package/lib/config/infrastructureLogging.d.ts.map +1 -1
- package/lib/config/infrastructureLogging.js +12 -3
- package/lib/config/infrastructureLogging.js.map +1 -1
- package/lib/config/loader.d.ts +3 -0
- package/lib/config/loader.d.ts.map +1 -0
- package/lib/config/loader.js +2 -0
- package/lib/config/loader.js.map +1 -0
- package/lib/config/mode.d.ts +3 -0
- package/lib/config/mode.d.ts.map +1 -0
- package/lib/config/mode.js +2 -0
- package/lib/config/mode.js.map +1 -0
- package/lib/config/module.d.ts +2 -6
- package/lib/config/module.d.ts.map +1 -1
- package/lib/config/module.js +20 -18
- package/lib/config/module.js.map +1 -1
- package/lib/config/name.d.ts +3 -0
- package/lib/config/name.d.ts.map +1 -0
- package/lib/config/name.js +2 -0
- package/lib/config/name.js.map +1 -0
- package/lib/config/node.d.ts +3 -0
- package/lib/config/node.d.ts.map +1 -0
- package/lib/config/node.js +2 -0
- package/lib/config/node.js.map +1 -0
- package/lib/config/optimization.d.ts +2 -2
- package/lib/config/optimization.d.ts.map +1 -1
- package/lib/config/optimization.js +8 -7
- package/lib/config/optimization.js.map +1 -1
- package/lib/config/output/assetModuleFilename.d.ts +8 -0
- package/lib/config/output/assetModuleFilename.d.ts.map +1 -0
- package/lib/config/output/assetModuleFilename.js +2 -0
- package/lib/config/output/assetModuleFilename.js.map +1 -0
- package/lib/config/output/chunkFilename.d.ts +8 -0
- package/lib/config/output/chunkFilename.d.ts.map +1 -0
- package/lib/config/output/chunkFilename.js +4 -0
- package/lib/config/output/chunkFilename.js.map +1 -0
- package/lib/config/output/filename.d.ts +8 -0
- package/lib/config/output/filename.d.ts.map +1 -0
- package/lib/config/output/filename.js +4 -0
- package/lib/config/output/filename.js.map +1 -0
- package/lib/config/output/index.d.ts +3 -0
- package/lib/config/output/index.d.ts.map +1 -0
- package/lib/config/output/index.js +18 -0
- package/lib/config/output/index.js.map +1 -0
- package/lib/config/parallelism.d.ts +3 -0
- package/lib/config/parallelism.d.ts.map +1 -0
- package/lib/config/parallelism.js +3 -0
- package/lib/config/parallelism.js.map +1 -0
- package/lib/config/performance.d.ts +3 -0
- package/lib/config/performance.d.ts.map +1 -0
- package/lib/config/performance.js +2 -0
- package/lib/config/performance.js.map +1 -0
- package/lib/config/plugins.d.ts +3 -0
- package/lib/config/plugins.d.ts.map +1 -0
- package/lib/config/plugins.js +2 -0
- package/lib/config/plugins.js.map +1 -0
- package/lib/config/profile.d.ts +3 -0
- package/lib/config/profile.d.ts.map +1 -0
- package/lib/config/profile.js +2 -0
- package/lib/config/profile.js.map +1 -0
- package/lib/config/recordsPath.d.ts +3 -0
- package/lib/config/recordsPath.d.ts.map +1 -0
- package/lib/config/recordsPath.js +2 -0
- package/lib/config/recordsPath.js.map +1 -0
- package/lib/config/resolve.d.ts +2 -3
- package/lib/config/resolve.d.ts.map +1 -1
- package/lib/config/resolve.js +16 -9
- package/lib/config/resolve.js.map +1 -1
- package/lib/config/stats.d.ts +3 -0
- package/lib/config/stats.d.ts.map +1 -0
- package/lib/config/stats.js +17 -0
- package/lib/config/stats.js.map +1 -0
- package/lib/config/target.d.ts +3 -0
- package/lib/config/target.d.ts.map +1 -0
- package/lib/config/target.js +4 -0
- package/lib/config/target.js.map +1 -0
- package/lib/handlers/index.d.ts +19 -0
- package/lib/handlers/index.d.ts.map +1 -0
- package/lib/handlers/index.js +6 -0
- package/lib/handlers/index.js.map +1 -0
- package/lib/handlers/items/items.d.ts +69 -0
- package/lib/handlers/items/items.d.ts.map +1 -0
- package/lib/handlers/items/items.js +93 -0
- package/lib/handlers/items/items.js.map +1 -0
- package/lib/handlers/loaders/loaders.d.ts +12 -0
- package/lib/handlers/loaders/loaders.d.ts.map +1 -0
- package/lib/handlers/loaders/loaders.js +11 -0
- package/lib/handlers/loaders/loaders.js.map +1 -0
- package/lib/handlers/register.d.ts +18 -0
- package/lib/handlers/register.d.ts.map +1 -0
- package/lib/handlers/register.js +28 -0
- package/lib/handlers/register.js.map +1 -0
- package/lib/handlers/rules/css.d.ts +3 -0
- package/lib/handlers/rules/css.d.ts.map +1 -0
- package/lib/handlers/rules/css.js +5 -0
- package/lib/handlers/rules/css.js.map +1 -0
- package/lib/handlers/rules/css.module.d.ts +3 -0
- package/lib/handlers/rules/css.module.d.ts.map +1 -0
- package/lib/handlers/rules/css.module.js +5 -0
- package/lib/handlers/rules/css.module.js.map +1 -0
- package/lib/handlers/rules/csv.d.ts +2 -8
- package/lib/handlers/rules/csv.d.ts.map +1 -1
- package/lib/handlers/rules/csv.js +3 -9
- package/lib/handlers/rules/csv.js.map +1 -1
- package/lib/handlers/rules/font.d.ts +3 -0
- package/lib/handlers/rules/font.d.ts.map +1 -0
- package/lib/handlers/rules/font.inline.d.ts +3 -0
- package/lib/handlers/rules/font.inline.d.ts.map +1 -0
- package/lib/handlers/rules/font.inline.js +6 -0
- package/lib/handlers/rules/font.inline.js.map +1 -0
- package/lib/handlers/rules/font.js +5 -0
- package/lib/handlers/rules/font.js.map +1 -0
- package/lib/handlers/rules/html.d.ts +3 -0
- package/lib/handlers/rules/html.d.ts.map +1 -0
- package/lib/handlers/rules/html.js +5 -0
- package/lib/handlers/rules/html.js.map +1 -0
- package/lib/handlers/rules/image.d.ts +3 -0
- package/lib/handlers/rules/image.d.ts.map +1 -0
- package/lib/handlers/rules/image.inline.d.ts +3 -0
- package/lib/handlers/rules/image.inline.d.ts.map +1 -0
- package/lib/handlers/rules/image.inline.js +6 -0
- package/lib/handlers/rules/image.inline.js.map +1 -0
- package/lib/handlers/rules/image.js +5 -0
- package/lib/handlers/rules/image.js.map +1 -0
- package/lib/handlers/rules/index.d.ts +19 -0
- package/lib/handlers/rules/index.d.ts.map +1 -0
- package/lib/handlers/rules/index.js +35 -0
- package/lib/handlers/rules/index.js.map +1 -0
- package/lib/handlers/rules/js.d.ts +3 -0
- package/lib/handlers/rules/js.d.ts.map +1 -0
- package/lib/handlers/rules/js.js +5 -0
- package/lib/handlers/rules/js.js.map +1 -0
- package/lib/handlers/rules/json.d.ts +3 -0
- package/lib/handlers/rules/json.d.ts.map +1 -0
- package/lib/handlers/rules/json.js +7 -0
- package/lib/handlers/rules/json.js.map +1 -0
- package/lib/handlers/rules/svg.d.ts +3 -0
- package/lib/handlers/rules/svg.d.ts.map +1 -0
- package/lib/handlers/rules/svg.inline.d.ts +3 -0
- package/lib/handlers/rules/svg.inline.d.ts.map +1 -0
- package/lib/handlers/rules/svg.inline.js +6 -0
- package/lib/handlers/rules/svg.inline.js.map +1 -0
- package/lib/handlers/rules/svg.js +5 -0
- package/lib/handlers/rules/svg.js.map +1 -0
- package/lib/handlers/rules/toml.d.ts +2 -8
- package/lib/handlers/rules/toml.d.ts.map +1 -1
- package/lib/handlers/rules/toml.js +3 -9
- package/lib/handlers/rules/toml.js.map +1 -1
- package/lib/handlers/rules/webp.d.ts +3 -0
- package/lib/handlers/rules/webp.d.ts.map +1 -0
- package/lib/handlers/rules/webp.js +5 -0
- package/lib/handlers/rules/webp.js.map +1 -0
- package/lib/handlers/rules/xml.d.ts +2 -8
- package/lib/handlers/rules/xml.d.ts.map +1 -1
- package/lib/handlers/rules/xml.js +3 -9
- package/lib/handlers/rules/xml.js.map +1 -1
- package/lib/handlers/rules/yml.d.ts +3 -0
- package/lib/handlers/rules/yml.d.ts.map +1 -0
- package/lib/handlers/rules/yml.js +5 -0
- package/lib/handlers/rules/yml.js.map +1 -0
- package/lib/helpers/isMjs.d.ts +3 -0
- package/lib/helpers/isMjs.d.ts.map +1 -0
- package/lib/helpers/isMjs.js +2 -0
- package/lib/helpers/isMjs.js.map +1 -0
- package/lib/helpers/scriptExtension.d.ts +3 -0
- package/lib/helpers/scriptExtension.d.ts.map +1 -0
- package/lib/helpers/scriptExtension.js +5 -0
- package/lib/helpers/scriptExtension.js.map +1 -0
- package/lib/index.d.ts +1 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +1 -1
- package/lib/index.js.map +1 -1
- package/lib/item/index.d.ts +3 -3
- package/lib/item/index.d.ts.map +1 -1
- package/lib/item/index.js +6 -3
- package/lib/item/index.js.map +1 -1
- package/lib/loader/index.d.ts +2 -1
- package/lib/loader/index.d.ts.map +1 -1
- package/lib/loader/index.js +2 -1
- package/lib/loader/index.js.map +1 -1
- package/lib/rule/index.d.ts +30 -21
- package/lib/rule/index.d.ts.map +1 -1
- package/lib/rule/index.js +64 -37
- package/lib/rule/index.js.map +1 -1
- package/lib/service.d.ts +9 -12
- package/lib/service.d.ts.map +1 -1
- package/lib/service.js +28 -59
- package/lib/service.js.map +1 -1
- package/lib/shared/base.d.ts +1 -1
- package/lib/shared/base.d.ts.map +1 -1
- package/lib/shared/base.js +12 -10
- package/lib/shared/base.js.map +1 -1
- package/lib/types.d.ts +8 -2
- package/lib/types.d.ts.map +1 -1
- package/package.json +39 -40
- package/src/config/bail.ts +4 -0
- package/src/config/cache.ts +4 -0
- package/src/config/context.ts +3 -0
- package/src/config/dependencies.ts +11 -0
- package/src/config/devtool.ts +4 -0
- package/src/config/entry.ts +4 -0
- package/src/config/experiments.ts +4 -0
- package/src/config/externals.ts +4 -0
- package/src/config/externalsType.ts +3 -0
- package/src/config/index.test.ts +129 -0
- package/src/config/index.ts +67 -0
- package/src/config/infrastructureLogging.ts +21 -0
- package/src/config/loader.ts +4 -0
- package/src/config/mode.ts +4 -0
- package/src/config/module.ts +43 -0
- package/src/config/name.ts +4 -0
- package/src/config/node.ts +4 -0
- package/src/config/optimization.ts +19 -0
- package/src/config/output/assetModuleFilename.ts +9 -0
- package/src/config/output/chunkFilename.ts +18 -0
- package/src/config/output/filename.ts +19 -0
- package/src/config/output/index.ts +27 -0
- package/src/config/parallelism.ts +6 -0
- package/src/config/performance.ts +4 -0
- package/src/config/plugins.ts +4 -0
- package/src/config/profile.ts +4 -0
- package/src/config/recordsPath.ts +7 -0
- package/src/config/resolve.ts +33 -0
- package/src/config/stats.ts +22 -0
- package/src/config/target.ts +9 -0
- package/src/handlers/index.ts +22 -0
- package/src/handlers/items/items.ts +117 -0
- package/src/handlers/loaders/loaders.ts +31 -0
- package/src/handlers/register.ts +51 -0
- package/src/handlers/rules/css.module.ts +7 -0
- package/src/handlers/rules/css.ts +7 -0
- package/src/handlers/rules/csv.test.ts +25 -0
- package/src/handlers/rules/csv.ts +7 -0
- package/src/handlers/rules/font.inline.ts +8 -0
- package/src/handlers/rules/font.ts +7 -0
- package/src/handlers/rules/html.ts +7 -0
- package/src/handlers/rules/image.inline.ts +8 -0
- package/src/handlers/rules/image.ts +7 -0
- package/src/handlers/rules/index.ts +35 -0
- package/src/handlers/rules/js.ts +7 -0
- package/src/handlers/rules/json.ts +10 -0
- package/src/handlers/rules/svg.inline.ts +8 -0
- package/src/handlers/rules/svg.ts +7 -0
- package/src/handlers/rules/toml.test.ts +22 -0
- package/src/handlers/rules/toml.ts +10 -0
- package/src/handlers/rules/webp.ts +7 -0
- package/src/handlers/rules/xml.test.ts +24 -0
- package/src/handlers/rules/xml.ts +7 -0
- package/src/handlers/rules/yml.ts +7 -0
- package/src/helpers/isMjs.ts +4 -0
- package/src/helpers/scriptExtension.ts +11 -0
- package/src/index.ts +17 -0
- package/src/item/index.ts +181 -0
- package/src/loader/index.ts +40 -0
- package/src/rule/index.test.ts +88 -0
- package/src/rule/index.ts +311 -0
- package/src/service.ts +245 -0
- package/src/shared/base.ts +37 -0
- package/src/types.ts +57 -0
- package/lib/config/builder.d.ts +0 -31
- package/lib/config/builder.d.ts.map +0 -1
- package/lib/config/builder.js +0 -32
- package/lib/config/builder.js.map +0 -1
- package/lib/config/output.d.ts +0 -4
- package/lib/config/output.d.ts.map +0 -1
- package/lib/config/output.js +0 -13
- package/lib/config/output.js.map +0 -1
- package/lib/handlers/items.d.ts +0 -69
- package/lib/handlers/items.d.ts.map +0 -1
- package/lib/handlers/items.js +0 -99
- package/lib/handlers/items.js.map +0 -1
- package/lib/handlers/loaders.d.ts +0 -57
- package/lib/handlers/loaders.d.ts.map +0 -1
- package/lib/handlers/loaders.js +0 -82
- package/lib/handlers/loaders.js.map +0 -1
- package/lib/handlers/rules/rules.d.ts +0 -63
- package/lib/handlers/rules/rules.d.ts.map +0 -1
- package/lib/handlers/rules/rules.js +0 -124
- package/lib/handlers/rules/rules.js.map +0 -1
package/src/service.ts
ADDED
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
import type {Items, Loaders, Rules} from '@roots/bud-framework'
|
|
2
|
+
import {Service} from '@roots/bud-framework/service'
|
|
3
|
+
import type * as Base from '@roots/bud-framework/services/build'
|
|
4
|
+
import {bind} from '@roots/bud-support/decorators'
|
|
5
|
+
import {isFunction, isUndefined} from '@roots/bud-support/lodash-es'
|
|
6
|
+
import type {Configuration} from '@roots/bud-support/webpack'
|
|
7
|
+
|
|
8
|
+
import type {Records} from './config/index.js'
|
|
9
|
+
import {register} from './handlers/register.js'
|
|
10
|
+
import {Item} from './item/index.js'
|
|
11
|
+
import {Loader} from './loader/index.js'
|
|
12
|
+
import {Options as RuleOptions, Rule} from './rule/index.js'
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Webpack configuration builder class
|
|
16
|
+
*
|
|
17
|
+
* @public
|
|
18
|
+
*/
|
|
19
|
+
export class Build extends Service implements Base.Service {
|
|
20
|
+
/**
|
|
21
|
+
* @public
|
|
22
|
+
*/
|
|
23
|
+
public config: Partial<Configuration> = {}
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Registered loaders
|
|
27
|
+
*
|
|
28
|
+
* @public
|
|
29
|
+
*/
|
|
30
|
+
// @ts-ignore
|
|
31
|
+
public loaders: Loaders = {}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Registered rules
|
|
35
|
+
*
|
|
36
|
+
* @public
|
|
37
|
+
*/
|
|
38
|
+
// @ts-ignore
|
|
39
|
+
public rules: Rules = {}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Registered items
|
|
43
|
+
*
|
|
44
|
+
* @public
|
|
45
|
+
*/
|
|
46
|
+
// @ts-ignore
|
|
47
|
+
public items: Items = {}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Service register event
|
|
51
|
+
*
|
|
52
|
+
* @remarks
|
|
53
|
+
* `loaders`, `items`, and `rules` are instantiated dumbly
|
|
54
|
+
* because it is painful to think about how to map the typings..
|
|
55
|
+
*
|
|
56
|
+
* @public
|
|
57
|
+
* @decorator `@bind`
|
|
58
|
+
*/
|
|
59
|
+
public override register? = register.bind(this)
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Make webpack configuration
|
|
63
|
+
*
|
|
64
|
+
* @public
|
|
65
|
+
* @decorator `@bind`
|
|
66
|
+
*/
|
|
67
|
+
@bind
|
|
68
|
+
public async make(): Promise<Configuration> {
|
|
69
|
+
this.app.log(`bud.build.make called`)
|
|
70
|
+
|
|
71
|
+
try {
|
|
72
|
+
await this.app.hooks.fire(`build.before`)
|
|
73
|
+
} catch (error) {
|
|
74
|
+
throw error
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
await import(`./config/index.js`).then(
|
|
78
|
+
async (records: Records) =>
|
|
79
|
+
await Promise.all(
|
|
80
|
+
Object.entries(records).map(async ([prop, factory]) => {
|
|
81
|
+
try {
|
|
82
|
+
const value = await factory(this.app)
|
|
83
|
+
if (isUndefined(value)) return
|
|
84
|
+
|
|
85
|
+
this.config[prop] = value
|
|
86
|
+
this.logger.success(`built`, prop)
|
|
87
|
+
} catch (error) {
|
|
88
|
+
throw error
|
|
89
|
+
}
|
|
90
|
+
}),
|
|
91
|
+
),
|
|
92
|
+
)
|
|
93
|
+
|
|
94
|
+
this.logger.success(`configuration successfully built`)
|
|
95
|
+
|
|
96
|
+
await this.app.hooks.fire(`build.after`)
|
|
97
|
+
return this.config
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Set Rule
|
|
102
|
+
*
|
|
103
|
+
* @param name - Rule key
|
|
104
|
+
* @param options - Rule constructor properties
|
|
105
|
+
* @returns the Rule
|
|
106
|
+
*
|
|
107
|
+
* @public
|
|
108
|
+
* @decorator `@bind`
|
|
109
|
+
*/
|
|
110
|
+
@bind
|
|
111
|
+
public setRule<K extends `${keyof Rules & string}`>(
|
|
112
|
+
name: K,
|
|
113
|
+
input?: RuleOptions | Rule,
|
|
114
|
+
): this {
|
|
115
|
+
this.rules[name] =
|
|
116
|
+
input instanceof Rule
|
|
117
|
+
? input
|
|
118
|
+
: isFunction(input)
|
|
119
|
+
? input(this.makeRule())
|
|
120
|
+
: this.makeRule(input as any)
|
|
121
|
+
|
|
122
|
+
this.logger.success(`set rule:`, name)
|
|
123
|
+
this.logger.info(`\n`, this.rules[name])
|
|
124
|
+
|
|
125
|
+
return this
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* Make Rule
|
|
130
|
+
*
|
|
131
|
+
* @param options - rule constructor properties
|
|
132
|
+
* @returns the rule
|
|
133
|
+
*
|
|
134
|
+
* @public
|
|
135
|
+
* @decorator `@bind`
|
|
136
|
+
*/
|
|
137
|
+
@bind
|
|
138
|
+
public makeRule(options?: RuleOptions): Rule {
|
|
139
|
+
return new Rule(() => this.app, options)
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
@bind
|
|
143
|
+
public getLoader(name: string): Loader {
|
|
144
|
+
if (!this.loaders[name])
|
|
145
|
+
this.logger.error(
|
|
146
|
+
`loader ${name} was requested but is not registered`,
|
|
147
|
+
)
|
|
148
|
+
|
|
149
|
+
return this.loaders[name]
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* Set Loader
|
|
154
|
+
*
|
|
155
|
+
* @param name - Loader key
|
|
156
|
+
* @param definition - Loader constructor properties
|
|
157
|
+
* @returns the Loader
|
|
158
|
+
*
|
|
159
|
+
* @public
|
|
160
|
+
* @decorator `@bind`
|
|
161
|
+
*/
|
|
162
|
+
@bind
|
|
163
|
+
public setLoader<K extends `${keyof Loaders & string}`>(
|
|
164
|
+
name: K,
|
|
165
|
+
definition?: any,
|
|
166
|
+
): this {
|
|
167
|
+
const loader = isUndefined(definition)
|
|
168
|
+
? this.makeLoader(name)
|
|
169
|
+
: definition instanceof Loader
|
|
170
|
+
? definition
|
|
171
|
+
: this.makeLoader(definition)
|
|
172
|
+
|
|
173
|
+
this.loaders[name] = loader
|
|
174
|
+
this.logger.info(`set loader`, loader)
|
|
175
|
+
|
|
176
|
+
return this
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
/**
|
|
180
|
+
* Make Loader
|
|
181
|
+
*
|
|
182
|
+
* @param options - rule constructor properties
|
|
183
|
+
* @returns the rule
|
|
184
|
+
*
|
|
185
|
+
* @public
|
|
186
|
+
* @decorator `@bind`
|
|
187
|
+
*/
|
|
188
|
+
@bind
|
|
189
|
+
public makeLoader(src?: string): Loader {
|
|
190
|
+
return new Loader(() => this.app, src)
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
@bind
|
|
194
|
+
public getItem(name: `${keyof Items & string}`): Item {
|
|
195
|
+
if (!this.items[name])
|
|
196
|
+
this.logger.error(
|
|
197
|
+
`loader ${name} was requested but is not registered`,
|
|
198
|
+
)
|
|
199
|
+
|
|
200
|
+
return this.items[name]
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
/**
|
|
204
|
+
* Set Item
|
|
205
|
+
*
|
|
206
|
+
* @param name - Item key
|
|
207
|
+
* @param options - Item constructor properties
|
|
208
|
+
* @returns the Item
|
|
209
|
+
*
|
|
210
|
+
* @public
|
|
211
|
+
* @decorator `@bind`
|
|
212
|
+
*/
|
|
213
|
+
@bind
|
|
214
|
+
public setItem<K extends `${keyof Items & string}`>(
|
|
215
|
+
name: K,
|
|
216
|
+
options?: Items[K]['options'] | ((item: Items[K]) => Items[K]),
|
|
217
|
+
): this {
|
|
218
|
+
const maybeOptionsCallback = isUndefined(options)
|
|
219
|
+
? {ident: name, loader: name}
|
|
220
|
+
: options
|
|
221
|
+
|
|
222
|
+
const item = isFunction(maybeOptionsCallback)
|
|
223
|
+
? maybeOptionsCallback(this.makeItem())
|
|
224
|
+
: this.makeItem(maybeOptionsCallback)
|
|
225
|
+
|
|
226
|
+
this.items[name] = item
|
|
227
|
+
this.logger.info(`set item`, item)
|
|
228
|
+
|
|
229
|
+
return this
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
/**
|
|
233
|
+
* Make Item
|
|
234
|
+
*
|
|
235
|
+
* @param options - rule constructor properties
|
|
236
|
+
* @returns the rule
|
|
237
|
+
*
|
|
238
|
+
* @public
|
|
239
|
+
* @decorator `@bind`
|
|
240
|
+
*/
|
|
241
|
+
@bind
|
|
242
|
+
public makeItem(options?: Partial<Item['options']>): Item {
|
|
243
|
+
return new Item(() => this.app, options)
|
|
244
|
+
}
|
|
245
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type {Bud} from '@roots/bud-framework'
|
|
2
|
+
import type {Base as BuildBase} from '@roots/bud-framework/services/build'
|
|
3
|
+
import {bind} from '@roots/bud-support/decorators'
|
|
4
|
+
import {isFunction} from '@roots/bud-support/lodash-es'
|
|
5
|
+
|
|
6
|
+
export default class Base implements BuildBase {
|
|
7
|
+
/**
|
|
8
|
+
* Application getter
|
|
9
|
+
*
|
|
10
|
+
* @readonly @public
|
|
11
|
+
*/
|
|
12
|
+
public get app(): Bud {
|
|
13
|
+
return this._app()
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Constructor
|
|
18
|
+
*
|
|
19
|
+
* @public
|
|
20
|
+
*/
|
|
21
|
+
public constructor(public _app: () => Bud) {}
|
|
22
|
+
|
|
23
|
+
@bind
|
|
24
|
+
public wrap<T = any>(input: T | ((app: Bud) => T)): (app: Bud) => T {
|
|
25
|
+
return isFunction(input) ? input : () => input
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
@bind
|
|
29
|
+
public unwrap<T = any>(
|
|
30
|
+
maybeFunction: T | ((app: Bud, ...options: Array<any>) => T),
|
|
31
|
+
...options: Array<any>
|
|
32
|
+
): T {
|
|
33
|
+
return isFunction(maybeFunction)
|
|
34
|
+
? maybeFunction(this.app, ...options)
|
|
35
|
+
: maybeFunction
|
|
36
|
+
}
|
|
37
|
+
}
|
package/src/types.ts
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/// <reference path="../../bud-framework/lib/index.d.ts" />
|
|
2
|
+
/// <reference path="../../bud-hooks/lib/index.d.ts" />
|
|
3
|
+
|
|
4
|
+
import type {Item} from './item/index.js'
|
|
5
|
+
import type {Loader} from './loader/index.js'
|
|
6
|
+
import type {Rule} from './rule/index.js'
|
|
7
|
+
|
|
8
|
+
declare module '@roots/bud-framework' {
|
|
9
|
+
interface Loaders {
|
|
10
|
+
css: Loader
|
|
11
|
+
csv: Loader
|
|
12
|
+
file: Loader
|
|
13
|
+
html: Loader
|
|
14
|
+
md: Loader
|
|
15
|
+
minicss: Loader
|
|
16
|
+
raw: Loader
|
|
17
|
+
style: Loader
|
|
18
|
+
url: Loader
|
|
19
|
+
xml: Loader
|
|
20
|
+
yml: Loader
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
interface Items {
|
|
24
|
+
precss: Item
|
|
25
|
+
minicss: Item
|
|
26
|
+
style: Item
|
|
27
|
+
css: Item
|
|
28
|
+
cssModule: Item
|
|
29
|
+
csv: Item
|
|
30
|
+
file: Item
|
|
31
|
+
image: Item
|
|
32
|
+
font: Item
|
|
33
|
+
html: Item
|
|
34
|
+
md: Item
|
|
35
|
+
raw: Item
|
|
36
|
+
xml: Item
|
|
37
|
+
yml: Item
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
interface Rules {
|
|
41
|
+
js: Rule
|
|
42
|
+
css: Rule
|
|
43
|
+
cssModule: Rule
|
|
44
|
+
html: Rule
|
|
45
|
+
svg: Rule
|
|
46
|
+
image: Rule
|
|
47
|
+
font: Rule
|
|
48
|
+
xml: Rule
|
|
49
|
+
json: Rule
|
|
50
|
+
csv: Rule
|
|
51
|
+
yml: Rule
|
|
52
|
+
toml: Rule
|
|
53
|
+
inlineSvg: Rule
|
|
54
|
+
inlineFont: Rule
|
|
55
|
+
inlineImage: Rule
|
|
56
|
+
}
|
|
57
|
+
}
|
package/lib/config/builder.d.ts
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import type { Bud } from '@roots/bud-framework';
|
|
2
|
-
import type { Configuration } from '@roots/bud-support/webpack';
|
|
3
|
-
export { bail } from './bail.js';
|
|
4
|
-
export { cache } from './cache.js';
|
|
5
|
-
export { context } from './context.js';
|
|
6
|
-
export { devtool } from './devtool.js';
|
|
7
|
-
export { experiments } from './experiments.js';
|
|
8
|
-
export { infrastructureLogging } from './infrastructureLogging.js';
|
|
9
|
-
export { module } from './module.js';
|
|
10
|
-
export { optimization } from './optimization.js';
|
|
11
|
-
export { output } from './output.js';
|
|
12
|
-
export { resolve } from './resolve.js';
|
|
13
|
-
export interface ValueFactory<T extends keyof B, B = Configuration> {
|
|
14
|
-
(app: Bud): Promise<B[T]>;
|
|
15
|
-
}
|
|
16
|
-
export declare const dependencies: ValueFactory<`dependencies`>;
|
|
17
|
-
export declare const entry: ValueFactory<`entry`>;
|
|
18
|
-
export declare const externals: ValueFactory<`externals`>;
|
|
19
|
-
export declare const externalsType: ValueFactory<`externalsType`>;
|
|
20
|
-
export declare const loader: ValueFactory<`loader`>;
|
|
21
|
-
export declare const mode: ValueFactory<`mode`>;
|
|
22
|
-
export declare const name: ValueFactory<`name`>;
|
|
23
|
-
export declare const node: ValueFactory<`node`>;
|
|
24
|
-
export declare const parallelism: ValueFactory<`parallelism`>;
|
|
25
|
-
export declare const performance: ValueFactory<`performance`>;
|
|
26
|
-
export declare const plugins: ValueFactory<`plugins`>;
|
|
27
|
-
export declare const profile: ValueFactory<`profile`>;
|
|
28
|
-
export declare const recordsPath: ValueFactory<`recordsPath`>;
|
|
29
|
-
export declare const stats: ValueFactory<`stats`>;
|
|
30
|
-
export declare const target: ValueFactory<`target`>;
|
|
31
|
-
//# sourceMappingURL=builder.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"builder.d.ts","sourceRoot":"","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;AAE3C,eAAO,MAAM,IAAI,EAAE,YAAY,CAAC,MAAM,CACC,CAAA;AAEvC,eAAO,MAAM,WAAW,EAAE,YAAY,CAAC,aAAa,CAIjD,CAAA;AAEH,eAAO,MAAM,WAAW,EAAE,YAAY,CAAC,aAAa,CACG,CAAA;AAEvD,eAAO,MAAM,OAAO,EAAE,YAAY,CAAC,SAAS,CACf,CAAA;AAE7B,eAAO,MAAM,OAAO,EAAE,YAAY,CAAC,SAAS,CACT,CAAA;AAEnC,eAAO,MAAM,WAAW,EAAE,YAAY,CAAC,aAAa,CAIjD,CAAA;AAEH,eAAO,MAAM,KAAK,EAAE,YAAY,CAAC,OAAO,CACkB,CAAA;AAE1D,eAAO,MAAM,MAAM,EAAE,YAAY,CAAC,QAAQ,CAMvC,CAAA"}
|
package/lib/config/builder.js
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { isUndefined } from '@roots/bud-support/lodash-es';
|
|
2
|
-
import { cpus } from 'os';
|
|
3
|
-
export { bail } from './bail.js';
|
|
4
|
-
export { cache } from './cache.js';
|
|
5
|
-
export { context } from './context.js';
|
|
6
|
-
export { devtool } from './devtool.js';
|
|
7
|
-
export { experiments } from './experiments.js';
|
|
8
|
-
export { infrastructureLogging } from './infrastructureLogging.js';
|
|
9
|
-
export { module } from './module.js';
|
|
10
|
-
export { optimization } from './optimization.js';
|
|
11
|
-
export { output } from './output.js';
|
|
12
|
-
export { resolve } from './resolve.js';
|
|
13
|
-
export const dependencies = async (app) => app.hooks
|
|
14
|
-
.filter(`build.dependencies`)
|
|
15
|
-
.filter(label => !isUndefined(app.root.children[label]));
|
|
16
|
-
export const entry = async (app) => app.hooks.filter(`build.entry`);
|
|
17
|
-
export const externals = async (app) => app.hooks.filter(`build.externals`);
|
|
18
|
-
export const externalsType = async (app) => app.hooks.filter(`build.externalsType`, `var`);
|
|
19
|
-
export const loader = async (app) => app.hooks.filter(`build.loader`);
|
|
20
|
-
export const mode = async (app) => app.hooks.filter(`build.mode`, app.mode);
|
|
21
|
-
export const name = async (app) => app.hooks.filter(`build.name`, app.label);
|
|
22
|
-
export const node = async (app) => app.hooks.filter(`build.node`, false);
|
|
23
|
-
export const parallelism = async (app) => app.hooks.filter(`build.parallelism`, 10 * Math.max(cpus().length - 1, 1));
|
|
24
|
-
export const performance = async (app) => app.hooks.filter(`build.performance`, { hints: false });
|
|
25
|
-
export const plugins = async (app) => await app.extensions.make();
|
|
26
|
-
export const profile = async (app) => app.hooks.filter(`build.profile`);
|
|
27
|
-
export const recordsPath = async (app) => app.hooks.filter(`build.recordsPath`, app.path(`@storage`, app.label, `modules.json`));
|
|
28
|
-
export const stats = async (app) => app.hooks.filter(`build.stats`, { preset: `errors-only` });
|
|
29
|
-
export const target = async (app) => app.hooks.filter(`build.target`, app.context.manifest?.browserslist
|
|
30
|
-
? `browserslist:${app.root.path(`package.json`)}`
|
|
31
|
-
: `web`);
|
|
32
|
-
//# sourceMappingURL=builder.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"builder.js","sourceRoot":"","sources":["../../src/config/builder.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,WAAW,EAAC,MAAM,8BAA8B,CAAA;AAExD,OAAO,EAAC,IAAI,EAAC,MAAM,IAAI,CAAA;AAEvB,OAAO,EAAC,IAAI,EAAC,MAAM,WAAW,CAAA;AAC9B,OAAO,EAAC,KAAK,EAAC,MAAM,YAAY,CAAA;AAChC,OAAO,EAAC,OAAO,EAAC,MAAM,cAAc,CAAA;AACpC,OAAO,EAAC,OAAO,EAAC,MAAM,cAAc,CAAA;AACpC,OAAO,EAAC,WAAW,EAAC,MAAM,kBAAkB,CAAA;AAC5C,OAAO,EAAC,qBAAqB,EAAC,MAAM,4BAA4B,CAAA;AAChE,OAAO,EAAC,MAAM,EAAC,MAAM,aAAa,CAAA;AAClC,OAAO,EAAC,YAAY,EAAC,MAAM,mBAAmB,CAAA;AAC9C,OAAO,EAAC,MAAM,EAAC,MAAM,aAAa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Y;IAChC,CAAC,CAAC,gBAAgB,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,cAAc,CAAC,EAAE;IACjD,CAAC,CAAC,KAAK,CACV,CAAA"}
|
package/lib/config/output.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"output.d.ts","sourceRoot":"","sources":["../../src/config/output.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,GAAG,EAAC,MAAM,sBAAsB,CAAA;AAC7C,OAAO,KAAK,EAAC,aAAa,EAAC,MAAM,4BAA4B,CAAA;AAE7D,eAAO,MAAM,MAAM,QAAe,GAAG,KAAG,QAAQ,aAAa,CAAC,QAAQ,CAAC,CAcnE,CAAA"}
|
package/lib/config/output.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
export const output = async (app) => app.hooks.filter(`build.output`, {
|
|
2
|
-
assetModuleFilename: app.hooks.filter(`build.output.assetModuleFilename`),
|
|
3
|
-
chunkFilename: app.hooks.filter(`build.output.chunkFilename`),
|
|
4
|
-
clean: app.hooks.filter(`build.output.clean`),
|
|
5
|
-
environment: app.hooks.filter(`build.output.environment`),
|
|
6
|
-
filename: app.hooks.filter(`build.output.filename`),
|
|
7
|
-
module: app.hooks.filter(`build.output.module`),
|
|
8
|
-
path: app.hooks.filter(`build.output.path`),
|
|
9
|
-
pathinfo: app.hooks.filter(`build.output.pathinfo`),
|
|
10
|
-
publicPath: app.hooks.filter(`build.output.publicPath`),
|
|
11
|
-
uniqueName: app.hooks.filter(`build.output.uniqueName`),
|
|
12
|
-
});
|
|
13
|
-
//# sourceMappingURL=output.js.map
|
package/lib/config/output.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"output.js","sourceRoot":"","sources":["../../src/config/output.ts"],"names":[],"mappings":"AAGA,MAAM,CAAC,MAAM,MAAM,GAAG,KAAK,EAAE,GAAQ,EAAoC,EAAE,CACzE,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,cAAc,EAAE;IAC/B,mBAAmB,EAAE,GAAG,CAAC,KAAK,CAAC,MAAM,CACnC,kCAAkC,CACnC;IACD,aAAa,EAAE,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,4BAA4B,CAAC;IAC7D,KAAK,EAAE,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,oBAAoB,CAAC;IAC7C,WAAW,EAAE,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,0BAA0B,CAAC;IACzD,QAAQ,EAAE,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,uBAAuB,CAAC;IACnD,MAAM,EAAE,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,qBAAqB,CAAC;IAC/C,IAAI,EAAE,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,mBAAmB,CAAC;IAC3C,QAAQ,EAAE,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,uBAAuB,CAAC;IACnD,UAAU,EAAE,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,yBAAyB,CAAC;IACvD,UAAU,EAAE,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,yBAAyB,CAAC;CACxD,CAAC,CAAA"}
|
package/lib/handlers/items.d.ts
DELETED
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
import type { Bud } from '@roots/bud-framework';
|
|
2
|
-
import type { Item } from '@roots/bud-framework/services/build';
|
|
3
|
-
/**
|
|
4
|
-
* CSS loader
|
|
5
|
-
*
|
|
6
|
-
* @public
|
|
7
|
-
*/
|
|
8
|
-
export declare const css: (app: Bud) => Item;
|
|
9
|
-
/**
|
|
10
|
-
* CSS module loader
|
|
11
|
-
*
|
|
12
|
-
* @public
|
|
13
|
-
*/
|
|
14
|
-
export declare const cssModule: (app: Bud) => Item;
|
|
15
|
-
/**
|
|
16
|
-
* CSV loader
|
|
17
|
-
*
|
|
18
|
-
* @public
|
|
19
|
-
*/
|
|
20
|
-
export declare const csv: (app: Bud) => Item;
|
|
21
|
-
/**
|
|
22
|
-
* HTML loader
|
|
23
|
-
*
|
|
24
|
-
* @public
|
|
25
|
-
*/
|
|
26
|
-
export declare const html: (app: Bud) => Item;
|
|
27
|
-
/**
|
|
28
|
-
* Style loader
|
|
29
|
-
*
|
|
30
|
-
* @public
|
|
31
|
-
*/
|
|
32
|
-
export declare const style: (app: Bud) => Item;
|
|
33
|
-
/**
|
|
34
|
-
* Markdown loader
|
|
35
|
-
*
|
|
36
|
-
* @public
|
|
37
|
-
*/
|
|
38
|
-
export declare const md: (app: Bud) => Item;
|
|
39
|
-
/**
|
|
40
|
-
* MiniCss loader
|
|
41
|
-
*
|
|
42
|
-
* @public
|
|
43
|
-
*/
|
|
44
|
-
export declare const minicss: (app: Bud) => Item;
|
|
45
|
-
/**
|
|
46
|
-
* Raw loader
|
|
47
|
-
*
|
|
48
|
-
* @public
|
|
49
|
-
*/
|
|
50
|
-
export declare const raw: ({ build }: Bud) => Item;
|
|
51
|
-
/**
|
|
52
|
-
* File loader
|
|
53
|
-
*
|
|
54
|
-
* @public
|
|
55
|
-
*/
|
|
56
|
-
export declare const file: (app: Bud) => Item;
|
|
57
|
-
/**
|
|
58
|
-
* Xml loader
|
|
59
|
-
*
|
|
60
|
-
* @public
|
|
61
|
-
*/
|
|
62
|
-
export declare const xml: (app: Bud) => Item;
|
|
63
|
-
/**
|
|
64
|
-
* Yml loader
|
|
65
|
-
*
|
|
66
|
-
* @public
|
|
67
|
-
*/
|
|
68
|
-
export declare const yml: (app: Bud) => Item;
|
|
69
|
-
//# sourceMappingURL=items.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"items.d.ts","sourceRoot":"","sources":["../../src/handlers/items.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,GAAG,EAAC,MAAM,sBAAsB,CAAA;AAC7C,OAAO,KAAK,EAAC,IAAI,EAAC,MAAM,qCAAqC,CAAA;AAE7D;;;;GAIG;AACH,eAAO,MAAM,GAAG,QAAS,GAAG,KAAG,IASxB,CAAA;AAEP;;;;GAIG;AACH,eAAO,MAAM,SAAS,QAAS,GAAG,KAAG,IAW9B,CAAA;AAEP;;;;GAIG;AACH,eAAO,MAAM,GAAG,QAAS,GAAG,KAAG,IACQ,CAAA;AAEvC;;;;GAIG;AACH,eAAO,MAAM,IAAI,QAAS,GAAG,KAAG,IACyB,CAAA;AAEzD;;;;GAIG;AACH,eAAO,MAAM,KAAK,QAAS,GAAG,KAAG,IAC0B,CAAA;AAE3D;;;;GAIG;AACH,eAAO,MAAM,EAAE,QAAS,GAAG,KAAG,IACuB,CAAA;AAErD;;;;GAIG;AACH,eAAO,MAAM,OAAO,QAAS,GAAG,KAAG,IAO5B,CAAA;AAEP;;;;GAIG;AACH,eAAO,MAAM,GAAG,cAAa,GAAG,KAAG,IACgB,CAAA;AAEnD;;;;GAIG;AACH,eAAO,MAAM,IAAI,QAAS,GAAG,KAAG,IASX,CAAA;AAErB;;;;GAIG;AACH,eAAO,MAAM,GAAG,QAAS,GAAG,KAAG,IACwB,CAAA;AAEvD;;;;GAIG;AACH,eAAO,MAAM,GAAG,QAAS,GAAG,KAAG,IACwB,CAAA"}
|
package/lib/handlers/items.js
DELETED
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* CSS loader
|
|
3
|
-
*
|
|
4
|
-
* @public
|
|
5
|
-
*/
|
|
6
|
-
export const css = (app) => app.build
|
|
7
|
-
.makeItem()
|
|
8
|
-
.setIdent(`css`)
|
|
9
|
-
.setLoader(`css`)
|
|
10
|
-
.setOptions(() => ({
|
|
11
|
-
importLoaders: app.build.rules.css.getUse().length - 2,
|
|
12
|
-
modules: false,
|
|
13
|
-
sourceMap: app.hooks.filter(`build.devtool`) ? true : false,
|
|
14
|
-
}));
|
|
15
|
-
/**
|
|
16
|
-
* CSS module loader
|
|
17
|
-
*
|
|
18
|
-
* @public
|
|
19
|
-
*/
|
|
20
|
-
export const cssModule = (app) => app.build
|
|
21
|
-
.makeItem()
|
|
22
|
-
.setIdent(`cssModule`)
|
|
23
|
-
.setLoader(`css`)
|
|
24
|
-
.setOptions(({ build, hooks }) => ({
|
|
25
|
-
esModule: true,
|
|
26
|
-
importLoaders: build.rules.cssModule.getUse().length - 2,
|
|
27
|
-
localIdentName: `[name]__[local]___[hash:base64:5]`,
|
|
28
|
-
modules: true,
|
|
29
|
-
sourceMap: hooks.filter(`build.devtool`) ? true : false,
|
|
30
|
-
}));
|
|
31
|
-
/**
|
|
32
|
-
* CSV loader
|
|
33
|
-
*
|
|
34
|
-
* @public
|
|
35
|
-
*/
|
|
36
|
-
export const csv = (app) => app.build.makeItem().setLoader(`csv`);
|
|
37
|
-
/**
|
|
38
|
-
* HTML loader
|
|
39
|
-
*
|
|
40
|
-
* @public
|
|
41
|
-
*/
|
|
42
|
-
export const html = (app) => app.build.makeItem().setLoader(`html`).setIdent(`html`);
|
|
43
|
-
/**
|
|
44
|
-
* Style loader
|
|
45
|
-
*
|
|
46
|
-
* @public
|
|
47
|
-
*/
|
|
48
|
-
export const style = (app) => app.build.makeItem().setLoader(`style`).setIdent(`style`);
|
|
49
|
-
/**
|
|
50
|
-
* Markdown loader
|
|
51
|
-
*
|
|
52
|
-
* @public
|
|
53
|
-
*/
|
|
54
|
-
export const md = (app) => app.build.makeItem().setIdent(`md`).setLoader(`md`);
|
|
55
|
-
/**
|
|
56
|
-
* MiniCss loader
|
|
57
|
-
*
|
|
58
|
-
* @public
|
|
59
|
-
*/
|
|
60
|
-
export const minicss = (app) => app.build
|
|
61
|
-
.makeItem()
|
|
62
|
-
.setLoader(`minicss`)
|
|
63
|
-
.setIdent(`minicss`)
|
|
64
|
-
.setOptions(app => ({
|
|
65
|
-
publicPath: app.hooks.filter(`build.output.publicPath`),
|
|
66
|
-
}));
|
|
67
|
-
/**
|
|
68
|
-
* Raw loader
|
|
69
|
-
*
|
|
70
|
-
* @public
|
|
71
|
-
*/
|
|
72
|
-
export const raw = ({ build }) => build.makeItem().setLoader(`raw`).setIdent(`raw`);
|
|
73
|
-
/**
|
|
74
|
-
* File loader
|
|
75
|
-
*
|
|
76
|
-
* @public
|
|
77
|
-
*/
|
|
78
|
-
export const file = (app) => app.build
|
|
79
|
-
.makeItem()
|
|
80
|
-
.setLoader(`file`)
|
|
81
|
-
.setOptions(app => ({
|
|
82
|
-
name: app.hooks.filter(`feature.hash`)
|
|
83
|
-
? app.hooks.filter(`value.hashFormat`).concat(`.[ext]`)
|
|
84
|
-
: app.hooks.filter(`value.fileFormat`).concat(`.[ext]`),
|
|
85
|
-
}))
|
|
86
|
-
.setIdent(`file`);
|
|
87
|
-
/**
|
|
88
|
-
* Xml loader
|
|
89
|
-
*
|
|
90
|
-
* @public
|
|
91
|
-
*/
|
|
92
|
-
export const xml = (app) => app.build.makeItem().setLoader(`xml`).setIdent(`xml`);
|
|
93
|
-
/**
|
|
94
|
-
* Yml loader
|
|
95
|
-
*
|
|
96
|
-
* @public
|
|
97
|
-
*/
|
|
98
|
-
export const yml = (app) => app.build.makeItem().setLoader(`yml`).setIdent(`yml`);
|
|
99
|
-
//# sourceMappingURL=items.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"items.js","sourceRoot":"","sources":["../../src/handlers/items.ts"],"names":[],"mappings":"AAGA;;;;GAIG;AACH,MAAM,CAAC,MAAM,GAAG,GAAG,CAAC,GAAQ,EAAQ,EAAE,CACpC,GAAG,CAAC,KAAK;KACN,QAAQ,EAAE;KACV,QAAQ,CAAC,KAAK,CAAC;KACf,SAAS,CAAC,KAAK,CAAC;KAChB,UAAU,CAAC,GAAG,EAAE,CAAC,CAAC;IACjB,aAAa,EAAE,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,MAAM,EAAE,CAAC,MAAM,GAAG,CAAC;IACtD,OAAO,EAAE,KAAK;IACd,SAAS,EAAE,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KA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,KAAK,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAA;AAEvD;;;;GAIG;AACH,MAAM,CAAC,MAAM,GAAG,GAAG,CAAC,GAAQ,EAAQ,EAAE,CACpC,GAAG,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAA"}
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import type { Bud } from '@roots/bud-framework';
|
|
2
|
-
import type { Loader } from '@roots/bud-framework/services/build';
|
|
3
|
-
/**
|
|
4
|
-
* css loader
|
|
5
|
-
*
|
|
6
|
-
* @public
|
|
7
|
-
*/
|
|
8
|
-
export declare const css: (app: Bud) => Loader;
|
|
9
|
-
/**
|
|
10
|
-
* csv loader
|
|
11
|
-
*
|
|
12
|
-
* @public
|
|
13
|
-
*/
|
|
14
|
-
export declare const csv: (app: Bud) => Loader;
|
|
15
|
-
/**
|
|
16
|
-
* file loader
|
|
17
|
-
*
|
|
18
|
-
* @public
|
|
19
|
-
*/
|
|
20
|
-
export declare const file: (app: Bud) => Loader;
|
|
21
|
-
/**
|
|
22
|
-
* html-loader
|
|
23
|
-
*
|
|
24
|
-
* @public
|
|
25
|
-
*/
|
|
26
|
-
export declare const html: (app: Bud) => Loader;
|
|
27
|
-
/**
|
|
28
|
-
* remark-loader
|
|
29
|
-
*
|
|
30
|
-
* @public
|
|
31
|
-
*/
|
|
32
|
-
export declare const remark: (app: Bud) => Loader;
|
|
33
|
-
/**
|
|
34
|
-
* `mini-css-extract-plugin.loader`
|
|
35
|
-
*
|
|
36
|
-
* @public
|
|
37
|
-
*/
|
|
38
|
-
export declare const minicss: (app: Bud) => Loader;
|
|
39
|
-
/**
|
|
40
|
-
* style-loader
|
|
41
|
-
*
|
|
42
|
-
* @public
|
|
43
|
-
*/
|
|
44
|
-
export declare const style: (app: Bud) => Loader;
|
|
45
|
-
/**
|
|
46
|
-
* xml-loader
|
|
47
|
-
*
|
|
48
|
-
* @public
|
|
49
|
-
*/
|
|
50
|
-
export declare const xml: (app: Bud) => Loader;
|
|
51
|
-
/**
|
|
52
|
-
* yml-loader
|
|
53
|
-
*
|
|
54
|
-
* @public
|
|
55
|
-
*/
|
|
56
|
-
export declare const yml: (app: Bud) => Loader;
|
|
57
|
-
//# sourceMappingURL=loaders.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"loaders.d.ts","sourceRoot":"","sources":["../../src/handlers/loaders.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,GAAG,EAAC,MAAM,sBAAsB,CAAA;AAC7C,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,qCAAqC,CAAA;AAG/D;;;;GAIG;AACH,eAAO,MAAM,GAAG,QAAS,GAAG,KAAG,MAG9B,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,GAAG,QAAS,GAAG,KAAG,MAG9B,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,IAAI,QAAS,GAAG,KAAG,MAG/B,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,IAAI,QAAS,GAAG,KAAG,MAG/B,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,MAAM,QAAS,GAAG,KAAG,MAGjC,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,OAAO,QAAS,GAAG,KAAG,MAElC,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,KAAK,QAAS,GAAG,KAAG,MAGhC,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,GAAG,QAAS,GAAG,KAAG,MAG9B,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,GAAG,QAAS,GAAG,KAAG,MAG9B,CAAA"}
|