@roots/bud-build 0.0.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/LICENSE.md +19 -0
- package/README.md +120 -0
- package/docs/exports.md +13 -0
- package/docs/rules.md +32 -0
- package/lib/config/bail.d.ts +3 -0
- package/lib/config/bail.d.ts.map +1 -0
- package/lib/config/bail.js +2 -0
- package/lib/config/bail.js.map +1 -0
- package/lib/config/cache.d.ts +3 -0
- package/lib/config/cache.d.ts.map +1 -0
- package/lib/config/cache.js +2 -0
- package/lib/config/cache.js.map +1 -0
- package/lib/config/context.d.ts +3 -0
- package/lib/config/context.d.ts.map +1 -0
- package/lib/config/context.js +2 -0
- package/lib/config/context.js.map +1 -0
- 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 +3 -0
- package/lib/config/devtool.d.ts.map +1 -0
- package/lib/config/devtool.js +2 -0
- package/lib/config/devtool.js.map +1 -0
- 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 +3 -0
- package/lib/config/experiments.d.ts.map +1 -0
- package/lib/config/experiments.js +2 -0
- package/lib/config/experiments.js.map +1 -0
- 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 +3 -0
- package/lib/config/infrastructureLogging.d.ts.map +1 -0
- package/lib/config/infrastructureLogging.js +14 -0
- package/lib/config/infrastructureLogging.js.map +1 -0
- 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 +3 -0
- package/lib/config/module.d.ts.map +1 -0
- package/lib/config/module.js +23 -0
- package/lib/config/module.js.map +1 -0
- 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 +3 -0
- package/lib/config/optimization.d.ts.map +1 -0
- package/lib/config/optimization.js +11 -0
- package/lib/config/optimization.js.map +1 -0
- 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 +3 -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 +3 -0
- package/lib/config/resolve.d.ts.map +1 -0
- package/lib/config/resolve.js +30 -0
- package/lib/config/resolve.js.map +1 -0
- 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 +47 -0
- package/lib/handlers/items/items.d.ts.map +1 -0
- package/lib/handlers/items/items.js +69 -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 +14 -0
- package/lib/handlers/register.d.ts.map +1 -0
- package/lib/handlers/register.js +26 -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 +3 -0
- package/lib/handlers/rules/csv.d.ts.map +1 -0
- package/lib/handlers/rules/csv.js +5 -0
- package/lib/handlers/rules/csv.js.map +1 -0
- 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 +5 -0
- package/lib/handlers/rules/svg.inline.d.ts.map +1 -0
- package/lib/handlers/rules/svg.inline.js +9 -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 +3 -0
- package/lib/handlers/rules/toml.d.ts.map +1 -0
- package/lib/handlers/rules/toml.js +7 -0
- package/lib/handlers/rules/toml.js.map +1 -0
- 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 +3 -0
- package/lib/handlers/rules/xml.d.ts.map +1 -0
- package/lib/handlers/rules/xml.js +5 -0
- package/lib/handlers/rules/xml.js.map +1 -0
- 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 +12 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +14 -0
- package/lib/index.js.map +1 -0
- package/lib/item/index.d.ts +84 -0
- package/lib/item/index.d.ts.map +1 -0
- package/lib/item/index.js +165 -0
- package/lib/item/index.js.map +1 -0
- package/lib/loader/index.d.ts +26 -0
- package/lib/loader/index.d.ts.map +1 -0
- package/lib/loader/index.js +28 -0
- package/lib/loader/index.js.map +1 -0
- package/lib/rule/index.d.ts +118 -0
- package/lib/rule/index.d.ts.map +1 -0
- package/lib/rule/index.js +261 -0
- package/lib/rule/index.js.map +1 -0
- package/lib/service.d.ts +84 -0
- package/lib/service.d.ts.map +1 -0
- package/lib/service.js +212 -0
- package/lib/service.js.map +1 -0
- package/lib/shared/base.d.ts +20 -0
- package/lib/shared/base.d.ts.map +1 -0
- package/lib/shared/base.js +43 -0
- package/lib/shared/base.js.map +1 -0
- package/lib/types.d.ts +52 -0
- package/lib/types.d.ts.map +1 -0
- package/lib/types.js +4 -0
- package/lib/types.js.map +1 -0
- package/package.json +97 -0
- 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 +18 -0
- package/src/config/loader.ts +4 -0
- package/src/config/mode.ts +4 -0
- package/src/config/module.ts +45 -0
- package/src/config/name.ts +4 -0
- package/src/config/node.ts +4 -0
- package/src/config/optimization.ts +20 -0
- package/src/config/output/assetModuleFilename.ts +9 -0
- package/src/config/output/chunkFilename.ts +18 -0
- package/src/config/output/filename.ts +14 -0
- package/src/config/output/index.ts +28 -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 +45 -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 +93 -0
- package/src/handlers/loaders/loaders.ts +31 -0
- package/src/handlers/register.ts +47 -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 +28 -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.test.ts +30 -0
- package/src/handlers/rules/svg.inline.ts +13 -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 +27 -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 +179 -0
- package/src/loader/index.ts +38 -0
- package/src/rule/index.test.ts +88 -0
- package/src/rule/index.ts +257 -0
- package/src/service.ts +204 -0
- package/src/shared/base.ts +37 -0
- package/src/types.ts +57 -0
package/lib/service.d.ts
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
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 type { Configuration } from '@roots/bud-support/webpack';
|
|
5
|
+
import { register } from './handlers/register.js';
|
|
6
|
+
import { Item } from './item/index.js';
|
|
7
|
+
import { Loader } from './loader/index.js';
|
|
8
|
+
import { Options as RuleOptions, Rule } from './rule/index.js';
|
|
9
|
+
/**
|
|
10
|
+
* Webpack configuration builder class
|
|
11
|
+
*/
|
|
12
|
+
export declare class Build extends Service implements Base.Service {
|
|
13
|
+
/**
|
|
14
|
+
* Built config object
|
|
15
|
+
*/
|
|
16
|
+
config: Partial<Configuration>;
|
|
17
|
+
/**
|
|
18
|
+
* Registered loaders
|
|
19
|
+
*
|
|
20
|
+
* @public
|
|
21
|
+
*/
|
|
22
|
+
loaders: Loaders;
|
|
23
|
+
/**
|
|
24
|
+
* Registered rules
|
|
25
|
+
*
|
|
26
|
+
* @public
|
|
27
|
+
*/
|
|
28
|
+
rules: Rules;
|
|
29
|
+
/**
|
|
30
|
+
* Registered items
|
|
31
|
+
*
|
|
32
|
+
* @public
|
|
33
|
+
*/
|
|
34
|
+
items: Items;
|
|
35
|
+
/**
|
|
36
|
+
* Service register event
|
|
37
|
+
*
|
|
38
|
+
* @remarks
|
|
39
|
+
* `loaders`, `items`, and `rules` are instantiated dumbly
|
|
40
|
+
* because it is painful to think about how to map the typings..
|
|
41
|
+
*/
|
|
42
|
+
register?: typeof register;
|
|
43
|
+
/**
|
|
44
|
+
* Make webpack configuration
|
|
45
|
+
*/
|
|
46
|
+
make(): Promise<Configuration>;
|
|
47
|
+
/**
|
|
48
|
+
* Get rule
|
|
49
|
+
*/
|
|
50
|
+
getRule<K extends `${keyof Rules & string}`>(ident: K): Rules[K];
|
|
51
|
+
/**
|
|
52
|
+
* Set Rule
|
|
53
|
+
*/
|
|
54
|
+
setRule<K extends `${keyof Rules & string}`>(name: K, input?: RuleOptions | Rule): this;
|
|
55
|
+
/**
|
|
56
|
+
* Make Rule
|
|
57
|
+
*/
|
|
58
|
+
makeRule(options?: RuleOptions): Rule;
|
|
59
|
+
/**
|
|
60
|
+
* Get loader
|
|
61
|
+
*/
|
|
62
|
+
getLoader(name: string): Loader;
|
|
63
|
+
/**
|
|
64
|
+
* Set loader
|
|
65
|
+
*/
|
|
66
|
+
setLoader<K extends `${keyof Loaders & string}`>(name: K, definition?: any): this;
|
|
67
|
+
/**
|
|
68
|
+
* Make loader
|
|
69
|
+
*/
|
|
70
|
+
makeLoader(src?: string): Loader;
|
|
71
|
+
/**
|
|
72
|
+
* Get item
|
|
73
|
+
*/
|
|
74
|
+
getItem(name: `${keyof Items & string}`): Item;
|
|
75
|
+
/**
|
|
76
|
+
* Set item
|
|
77
|
+
*/
|
|
78
|
+
setItem<K extends `${keyof Items & string}`>(ident: K, options?: Items[K]['options'] | ((item: Items[K]) => Items[K])): this;
|
|
79
|
+
/**
|
|
80
|
+
* Make item
|
|
81
|
+
*/
|
|
82
|
+
makeItem(options?: Partial<Item['options']>): Item;
|
|
83
|
+
}
|
|
84
|
+
//# sourceMappingURL=service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../src/service.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,KAAK,EAAE,OAAO,EAAE,KAAK,EAAC,MAAM,sBAAsB,CAAA;AAC/D,OAAO,EAAC,OAAO,EAAC,MAAM,8BAA8B,CAAA;AACpD,OAAO,KAAK,KAAK,IAAI,MAAM,qCAAqC,CAAA;AAIhE,OAAO,KAAK,EAAC,aAAa,EAAC,MAAM,4BAA4B,CAAA;AAG7D,OAAO,EAAC,QAAQ,EAAC,MAAM,wBAAwB,CAAA;AAC/C,OAAO,EAAC,IAAI,EAAC,MAAM,iBAAiB,CAAA;AACpC,OAAO,EAAC,MAAM,EAAC,MAAM,mBAAmB,CAAA;AACxC,OAAO,EAAC,OAAO,IAAI,WAAW,EAAE,IAAI,EAAC,MAAM,iBAAiB,CAAA;AAE5D;;GAEG;AACH,qBAAa,KAAM,SAAQ,OAAQ,YAAW,IAAI,CAAC,OAAO;IACxD;;OAEG;IACI,MAAM,EAAE,OAAO,CAAC,aAAa,CAAC,CAAK;IAE1C;;;;OAIG;IACI,OAAO,EAAE,OAAO,CAAgB;IAEvC;;;;OAIG;IACI,KAAK,EAAE,KAAK,CAAc;IAEjC;;;;OAIG;IACI,KAAK,EAAE,KAAK,CA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js
ADDED
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
var _a, _b, _c, _d;
|
|
2
|
+
import { __decorate, __metadata } from "tslib";
|
|
3
|
+
import { Service } from '@roots/bud-framework/service';
|
|
4
|
+
import { bind } from '@roots/bud-support/decorators';
|
|
5
|
+
import isFunction from '@roots/bud-support/lodash/isFunction';
|
|
6
|
+
import isUndefined from '@roots/bud-support/lodash/isUndefined';
|
|
7
|
+
import { register } from './handlers/register.js';
|
|
8
|
+
import { Item } from './item/index.js';
|
|
9
|
+
import { Loader } from './loader/index.js';
|
|
10
|
+
import { Rule } from './rule/index.js';
|
|
11
|
+
/**
|
|
12
|
+
* Webpack configuration builder class
|
|
13
|
+
*/
|
|
14
|
+
export class Build extends Service {
|
|
15
|
+
constructor() {
|
|
16
|
+
super(...arguments);
|
|
17
|
+
/**
|
|
18
|
+
* Built config object
|
|
19
|
+
*/
|
|
20
|
+
this.config = {};
|
|
21
|
+
/**
|
|
22
|
+
* Registered loaders
|
|
23
|
+
*
|
|
24
|
+
* @public
|
|
25
|
+
*/
|
|
26
|
+
this.loaders = {};
|
|
27
|
+
/**
|
|
28
|
+
* Registered rules
|
|
29
|
+
*
|
|
30
|
+
* @public
|
|
31
|
+
*/
|
|
32
|
+
this.rules = {};
|
|
33
|
+
/**
|
|
34
|
+
* Registered items
|
|
35
|
+
*
|
|
36
|
+
* @public
|
|
37
|
+
*/
|
|
38
|
+
this.items = {};
|
|
39
|
+
/**
|
|
40
|
+
* Service register event
|
|
41
|
+
*
|
|
42
|
+
* @remarks
|
|
43
|
+
* `loaders`, `items`, and `rules` are instantiated dumbly
|
|
44
|
+
* because it is painful to think about how to map the typings..
|
|
45
|
+
*/
|
|
46
|
+
this.register = register.bind(this);
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Make webpack configuration
|
|
50
|
+
*/
|
|
51
|
+
async make() {
|
|
52
|
+
this.logger.log(`bud.build.make called`);
|
|
53
|
+
await this.app.hooks.fire(`build.before`, this.app);
|
|
54
|
+
await import(`./config/index.js`).then(async (records) => await Promise.all(Object.entries(records).map(async ([prop, factory]) => {
|
|
55
|
+
try {
|
|
56
|
+
const value = await factory(this.app);
|
|
57
|
+
if (isUndefined(value))
|
|
58
|
+
return;
|
|
59
|
+
this.config[prop] = value;
|
|
60
|
+
this.logger.success(`built`, prop);
|
|
61
|
+
}
|
|
62
|
+
catch (error) {
|
|
63
|
+
throw error;
|
|
64
|
+
}
|
|
65
|
+
})));
|
|
66
|
+
this.logger.success(`configuration successfully built`);
|
|
67
|
+
await this.app.hooks.fire(`build.after`, this.app);
|
|
68
|
+
return this.config;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Get rule
|
|
72
|
+
*/
|
|
73
|
+
getRule(ident) {
|
|
74
|
+
return this.rules[ident];
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Set Rule
|
|
78
|
+
*/
|
|
79
|
+
setRule(name, input) {
|
|
80
|
+
this.rules[name] =
|
|
81
|
+
input instanceof Rule
|
|
82
|
+
? input
|
|
83
|
+
: isFunction(input)
|
|
84
|
+
? input(this.makeRule())
|
|
85
|
+
: this.makeRule(input);
|
|
86
|
+
this.logger.success(`set rule:`, name);
|
|
87
|
+
this.logger.info(`\n`, this.rules[name]);
|
|
88
|
+
return this;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Make Rule
|
|
92
|
+
*/
|
|
93
|
+
makeRule(options) {
|
|
94
|
+
return new Rule(() => this.app, options);
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Get loader
|
|
98
|
+
*/
|
|
99
|
+
getLoader(name) {
|
|
100
|
+
if (!this.loaders[name])
|
|
101
|
+
this.logger.error(`loader ${name} was requested but is not registered`);
|
|
102
|
+
return this.loaders[name];
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Set loader
|
|
106
|
+
*/
|
|
107
|
+
setLoader(name, definition) {
|
|
108
|
+
const loader = isUndefined(definition)
|
|
109
|
+
? this.makeLoader(name)
|
|
110
|
+
: definition instanceof Loader
|
|
111
|
+
? definition
|
|
112
|
+
: this.makeLoader(definition);
|
|
113
|
+
this.loaders[name] = loader;
|
|
114
|
+
this.logger.info(`set loader`, loader);
|
|
115
|
+
return this;
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Make loader
|
|
119
|
+
*/
|
|
120
|
+
makeLoader(src) {
|
|
121
|
+
return new Loader(() => this.app, src);
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Get item
|
|
125
|
+
*/
|
|
126
|
+
getItem(name) {
|
|
127
|
+
if (!this.items[name])
|
|
128
|
+
this.logger.error(`loader ${name} was requested but is not registered`);
|
|
129
|
+
return this.items[name];
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Set item
|
|
133
|
+
*/
|
|
134
|
+
setItem(ident, options) {
|
|
135
|
+
const maybeOptionsCallback = isUndefined(options)
|
|
136
|
+
? { ident, loader: ident }
|
|
137
|
+
: options;
|
|
138
|
+
const item = isFunction(maybeOptionsCallback)
|
|
139
|
+
? maybeOptionsCallback(this.makeItem())
|
|
140
|
+
: this.makeItem(maybeOptionsCallback);
|
|
141
|
+
this.items[ident] = item;
|
|
142
|
+
this.logger.info(`set item`, item);
|
|
143
|
+
return this;
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* Make item
|
|
147
|
+
*/
|
|
148
|
+
makeItem(options) {
|
|
149
|
+
return new Item(() => this.app, options);
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
__decorate([
|
|
153
|
+
bind,
|
|
154
|
+
__metadata("design:type", Function),
|
|
155
|
+
__metadata("design:paramtypes", []),
|
|
156
|
+
__metadata("design:returntype", Promise)
|
|
157
|
+
], Build.prototype, "make", null);
|
|
158
|
+
__decorate([
|
|
159
|
+
bind,
|
|
160
|
+
__metadata("design:type", Function),
|
|
161
|
+
__metadata("design:paramtypes", [typeof (_a = typeof K !== "undefined" && K) === "function" ? _a : Object]),
|
|
162
|
+
__metadata("design:returntype", Object)
|
|
163
|
+
], Build.prototype, "getRule", null);
|
|
164
|
+
__decorate([
|
|
165
|
+
bind,
|
|
166
|
+
__metadata("design:type", Function),
|
|
167
|
+
__metadata("design:paramtypes", [typeof (_b = typeof K !== "undefined" && K) === "function" ? _b : Object, Object]),
|
|
168
|
+
__metadata("design:returntype", Object)
|
|
169
|
+
], Build.prototype, "setRule", null);
|
|
170
|
+
__decorate([
|
|
171
|
+
bind,
|
|
172
|
+
__metadata("design:type", Function),
|
|
173
|
+
__metadata("design:paramtypes", [Object]),
|
|
174
|
+
__metadata("design:returntype", Rule)
|
|
175
|
+
], Build.prototype, "makeRule", null);
|
|
176
|
+
__decorate([
|
|
177
|
+
bind,
|
|
178
|
+
__metadata("design:type", Function),
|
|
179
|
+
__metadata("design:paramtypes", [String]),
|
|
180
|
+
__metadata("design:returntype", Loader)
|
|
181
|
+
], Build.prototype, "getLoader", null);
|
|
182
|
+
__decorate([
|
|
183
|
+
bind,
|
|
184
|
+
__metadata("design:type", Function),
|
|
185
|
+
__metadata("design:paramtypes", [typeof (_c = typeof K !== "undefined" && K) === "function" ? _c : Object, Object]),
|
|
186
|
+
__metadata("design:returntype", Object)
|
|
187
|
+
], Build.prototype, "setLoader", null);
|
|
188
|
+
__decorate([
|
|
189
|
+
bind,
|
|
190
|
+
__metadata("design:type", Function),
|
|
191
|
+
__metadata("design:paramtypes", [String]),
|
|
192
|
+
__metadata("design:returntype", Loader)
|
|
193
|
+
], Build.prototype, "makeLoader", null);
|
|
194
|
+
__decorate([
|
|
195
|
+
bind,
|
|
196
|
+
__metadata("design:type", Function),
|
|
197
|
+
__metadata("design:paramtypes", [String]),
|
|
198
|
+
__metadata("design:returntype", Item)
|
|
199
|
+
], Build.prototype, "getItem", null);
|
|
200
|
+
__decorate([
|
|
201
|
+
bind,
|
|
202
|
+
__metadata("design:type", Function),
|
|
203
|
+
__metadata("design:paramtypes", [typeof (_d = typeof K !== "undefined" && K) === "function" ? _d : Object, Object]),
|
|
204
|
+
__metadata("design:returntype", Object)
|
|
205
|
+
], Build.prototype, "setItem", null);
|
|
206
|
+
__decorate([
|
|
207
|
+
bind,
|
|
208
|
+
__metadata("design:type", Function),
|
|
209
|
+
__metadata("design:paramtypes", [Object]),
|
|
210
|
+
__metadata("design:returntype", Item)
|
|
211
|
+
], Build.prototype, "makeItem", null);
|
|
212
|
+
//# sourceMappingURL=service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"service.js","sourceRoot":"","sources":["../src/service.ts"],"names":[],"mappings":";;AACA,OAAO,EAAC,OAAO,EAAC,MAAM,8BAA8B,CAAA;AAEpD,OAAO,EAAC,IAAI,EAAC,MAAM,+BAA+B,CAAA;AAClD,OAAO,UAAU,MAAM,sCAAsC,CAAA;AAC7D,OAAO,WAAW,MAAM,uCAAuC,CAAA;AAI/D,OAAO,EAAC,QAAQ,EAAC,MAAM,wBAAwB,CAAA;AAC/C,OAAO,EAAC,IAAI,EAAC,MAAM,iBAAiB,CAAA;AACpC,OAAO,EAAC,MAAM,EAAC,MAAM,mBAAmB,CAAA;AACxC,OAAO,EAAyB,IAAI,EAAC,MAAM,iBAAiB,CAAA;AAE5D;;GAEG;AACH,MAAM,OAAO,KAAM,SAAQ,OAAO;IAAlC;;QACE;;WAEG;QACI,WAAM,GAA2B,EAAE,CAAA;QAE1C;;;;WAIG;QACI,YAAO,GAAY,EAAa,CAAA;QAEvC;;;;WAIG;QACI,UAAK,GAAU,EAAW,CAAA;QAEjC;;;;WAIG;QACI,UAAK,GAAU,EAAW,CAAA;QAEjC;;;;;;WAMG;QACa,aAAQ,GAAI,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;IAwJjD,CAAC;IAtJC;;OAEG;IAEU,AAAN,KAAK,CAAC,IAAI;QACf,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,uBAAuB,CAAC,CAAA;QACxC,MAAM,IAAI,CAAC,GA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MAAM;uCAEtC;AAKD;IAAC,IAAI;;;oCAC4C,IAAI;oCAOpD;AAKD;IAAC,IAAI;;yDAEI,CAAC,oBAAD,CAAC;;oCAeT;AAKD;IAAC,IAAI;;;oCACgD,IAAI;qCAExD"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { Bud } from '@roots/bud-framework';
|
|
2
|
+
import type { Base as BuildBase } from '@roots/bud-framework/services/build';
|
|
3
|
+
export default class Base implements BuildBase {
|
|
4
|
+
_app: () => Bud;
|
|
5
|
+
/**
|
|
6
|
+
* Application getter
|
|
7
|
+
*
|
|
8
|
+
* @readonly @public
|
|
9
|
+
*/
|
|
10
|
+
get app(): Bud;
|
|
11
|
+
/**
|
|
12
|
+
* Constructor
|
|
13
|
+
*
|
|
14
|
+
* @public
|
|
15
|
+
*/
|
|
16
|
+
constructor(_app: () => Bud);
|
|
17
|
+
wrap<T = any>(input: T | ((app: Bud) => T)): (app: Bud) => T;
|
|
18
|
+
unwrap<T = any>(maybeFunction: T | ((app: Bud, ...options: Array<any>) => T), ...options: Array<any>): T;
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=base.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../src/shared/base.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,GAAG,EAAC,MAAM,sBAAsB,CAAA;AAC7C,OAAO,KAAK,EAAC,IAAI,IAAI,SAAS,EAAC,MAAM,qCAAqC,CAAA;AAI1E,MAAM,CAAC,OAAO,OAAO,IAAK,YAAW,SAAS;IAelB,IAAI,EAAE,MAAM,GAAG;IAdzC;;;;OAIG;IACH,IAAW,GAAG,IAAI,GAAG,CAEpB;IAED;;;;OAIG;gBACuB,IAAI,EAAE,MAAM,GAAG;IAGlC,IAAI,CAAC,CAAC,GAAG,GAAG,EAAE,KAAK,EAAE,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,GAAG,KAAK,CAAC,CAAC,GAAG,CAAC,GAAG,EAAE,GAAG,KAAK,CAAC;IAK5D,MAAM,CAAC,CAAC,GAAG,GAAG,EACnB,aAAa,EAAE,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,OAAO,EAAE,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,EAC5D,GAAG,OAAO,EAAE,KAAK,CAAC,GAAG,CAAC,GACrB,CAAC;CAKL"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
var _a, _b, _c;
|
|
2
|
+
import { __decorate, __metadata } from "tslib";
|
|
3
|
+
import { bind } from '@roots/bud-support/decorators';
|
|
4
|
+
import isFunction from '@roots/bud-support/lodash/isFunction';
|
|
5
|
+
export default class Base {
|
|
6
|
+
/**
|
|
7
|
+
* Application getter
|
|
8
|
+
*
|
|
9
|
+
* @readonly @public
|
|
10
|
+
*/
|
|
11
|
+
get app() {
|
|
12
|
+
return this._app();
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Constructor
|
|
16
|
+
*
|
|
17
|
+
* @public
|
|
18
|
+
*/
|
|
19
|
+
constructor(_app) {
|
|
20
|
+
this._app = _app;
|
|
21
|
+
}
|
|
22
|
+
wrap(input) {
|
|
23
|
+
return isFunction(input) ? input : () => input;
|
|
24
|
+
}
|
|
25
|
+
unwrap(maybeFunction, ...options) {
|
|
26
|
+
return isFunction(maybeFunction)
|
|
27
|
+
? maybeFunction(this.app, ...options)
|
|
28
|
+
: maybeFunction;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
__decorate([
|
|
32
|
+
bind,
|
|
33
|
+
__metadata("design:type", Function),
|
|
34
|
+
__metadata("design:paramtypes", [Object]),
|
|
35
|
+
__metadata("design:returntype", Function)
|
|
36
|
+
], Base.prototype, "wrap", null);
|
|
37
|
+
__decorate([
|
|
38
|
+
bind,
|
|
39
|
+
__metadata("design:type", Function),
|
|
40
|
+
__metadata("design:paramtypes", [Object, Object]),
|
|
41
|
+
__metadata("design:returntype", typeof (_c = typeof T !== "undefined" && T) === "function" ? _c : Object)
|
|
42
|
+
], Base.prototype, "unwrap", null);
|
|
43
|
+
//# sourceMappingURL=base.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base.js","sourceRoot":"","sources":["../../src/shared/base.ts"],"names":[],"mappings":";;AAEA,OAAO,EAAC,IAAI,EAAC,MAAM,+BAA+B,CAAA;AAClD,OAAO,UAAU,MAAM,sCAAsC,CAAA;AAE7D,MAAM,CAAC,OAAO,OAAO,IAAI;IACvB;;;;OAIG;IACH,IAAW,GAAG;QACZ,OAAO,IAAI,CAAC,IAAI,EAAE,CAAA;IACpB,CAAC;IAED;;;;OAIG;IACH,YAA0B,IAAe;QAAf,SAAI,GAAJ,IAAI,CAAW;IAAG,CAAC;IAGtC,IAAI,CAAU,KAA4B;QAC/C,OAAO,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,KAAK,CAAA;IAChD,CAAC;IAGM,MAAM,CACX,aAA4D,EAC5D,GAAG,OAAmB;QAEtB,OAAO,UAAU,CAAC,aAAa,CAAC;YAC9B,CAAC,CAAC,aAAa,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,OAAO,CAAC;YACrC,CAAC,CAAC,aAAa,CAAA;IACnB,CAAC;CACF;AAdC;IAAC,IAAI;;;;gCAGJ;AAED;IAAC,IAAI;;;wDAIF,CAAC,oBAAD,CAAC;kCAIH"}
|
package/lib/types.d.ts
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import type { Item } from './item/index.js';
|
|
2
|
+
import type { Loader } from './loader/index.js';
|
|
3
|
+
import type { Rule } from './rule/index.js';
|
|
4
|
+
declare module '@roots/bud-framework' {
|
|
5
|
+
interface Loaders {
|
|
6
|
+
css: Loader;
|
|
7
|
+
csv: Loader;
|
|
8
|
+
file: Loader;
|
|
9
|
+
html: Loader;
|
|
10
|
+
md: Loader;
|
|
11
|
+
minicss: Loader;
|
|
12
|
+
raw: Loader;
|
|
13
|
+
style: Loader;
|
|
14
|
+
url: Loader;
|
|
15
|
+
xml: Loader;
|
|
16
|
+
yml: Loader;
|
|
17
|
+
}
|
|
18
|
+
interface Items {
|
|
19
|
+
precss: Item;
|
|
20
|
+
minicss: Item;
|
|
21
|
+
style: Item;
|
|
22
|
+
css: Item;
|
|
23
|
+
cssModule: Item;
|
|
24
|
+
csv: Item;
|
|
25
|
+
file: Item;
|
|
26
|
+
image: Item;
|
|
27
|
+
font: Item;
|
|
28
|
+
html: Item;
|
|
29
|
+
md: Item;
|
|
30
|
+
raw: Item;
|
|
31
|
+
xml: Item;
|
|
32
|
+
yml: Item;
|
|
33
|
+
}
|
|
34
|
+
interface Rules {
|
|
35
|
+
js: Rule;
|
|
36
|
+
css: Rule;
|
|
37
|
+
cssModule: Rule;
|
|
38
|
+
html: Rule;
|
|
39
|
+
svg: Rule;
|
|
40
|
+
image: Rule;
|
|
41
|
+
font: Rule;
|
|
42
|
+
xml: Rule;
|
|
43
|
+
json: Rule;
|
|
44
|
+
csv: Rule;
|
|
45
|
+
yml: Rule;
|
|
46
|
+
toml: Rule;
|
|
47
|
+
inlineSvg: Rule;
|
|
48
|
+
inlineFont: Rule;
|
|
49
|
+
inlineImage: Rule;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAC,IAAI,EAAC,MAAM,iBAAiB,CAAA;AACzC,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,mBAAmB,CAAA;AAC7C,OAAO,KAAK,EAAC,IAAI,EAAC,MAAM,iBAAiB,CAAA;AAEzC,OAAO,QAAQ,sBAAsB,CAAC;IACpC,UAAU,OAAO;QACf,GAAG,EAAE,MA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ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,8CAA8C;AAC9C,0CAA0C"}
|
package/package.json
ADDED
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@roots/bud-build",
|
|
3
|
+
"description": "bud.js core module",
|
|
4
|
+
"version": "0.0.0",
|
|
5
|
+
"homepage": "https://roots.io/bud",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "https://github.com/roots/bud.git",
|
|
9
|
+
"directory": "sources/@roots/bud-build"
|
|
10
|
+
},
|
|
11
|
+
"contributors": [
|
|
12
|
+
{
|
|
13
|
+
"name": "Kelly Mears",
|
|
14
|
+
"email": "developers@tinypixel.dev",
|
|
15
|
+
"url": "https://github.com/kellymears"
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
"name": "Ben Word",
|
|
19
|
+
"email": "ben@benword.com",
|
|
20
|
+
"url": "https://github.com/retlehs"
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
"name": "QWp6t",
|
|
24
|
+
"url": "https://github.com/QWp6t"
|
|
25
|
+
}
|
|
26
|
+
],
|
|
27
|
+
"license": "MIT",
|
|
28
|
+
"bugs": {
|
|
29
|
+
"url": "https://github.com/roots/bud/issues"
|
|
30
|
+
},
|
|
31
|
+
"funding": {
|
|
32
|
+
"type": "github sponsors",
|
|
33
|
+
"url": "https://github.com/sponsors/roots"
|
|
34
|
+
},
|
|
35
|
+
"keywords": [
|
|
36
|
+
"bud",
|
|
37
|
+
"bud-framework"
|
|
38
|
+
],
|
|
39
|
+
"engines": {
|
|
40
|
+
"node": ">=16"
|
|
41
|
+
},
|
|
42
|
+
"files": [
|
|
43
|
+
"docs",
|
|
44
|
+
"lib",
|
|
45
|
+
"src"
|
|
46
|
+
],
|
|
47
|
+
"type": "module",
|
|
48
|
+
"exports": {
|
|
49
|
+
".": {
|
|
50
|
+
"types": "./lib/index.d.ts",
|
|
51
|
+
"import": "./lib/index.js"
|
|
52
|
+
},
|
|
53
|
+
"./item": {
|
|
54
|
+
"types": "./lib/item/index.d.ts",
|
|
55
|
+
"import": "./lib/item/index.js"
|
|
56
|
+
},
|
|
57
|
+
"./items": {
|
|
58
|
+
"types": "./lib/handlers/items/items.d.ts",
|
|
59
|
+
"import": "./lib/handlers/items/items.js"
|
|
60
|
+
},
|
|
61
|
+
"./loader": {
|
|
62
|
+
"types": "./lib/loader/index.d.ts",
|
|
63
|
+
"import": "./lib/loader/index.js"
|
|
64
|
+
},
|
|
65
|
+
"./loaders": {
|
|
66
|
+
"types": "./lib/handlers/loaders/loaders.d.ts",
|
|
67
|
+
"import": "./lib/handlers/loaders/loaders.js"
|
|
68
|
+
},
|
|
69
|
+
"./rule": {
|
|
70
|
+
"types": "./lib/rule/index.d.ts",
|
|
71
|
+
"import": "./lib/rule/index.js"
|
|
72
|
+
},
|
|
73
|
+
"./rules": {
|
|
74
|
+
"types": "./lib/handlers/rules/index.d.ts",
|
|
75
|
+
"import": "./lib/handlers/rules/index.js"
|
|
76
|
+
},
|
|
77
|
+
"./types": {
|
|
78
|
+
"types": "./lib/types.d.ts",
|
|
79
|
+
"import": "./lib/types.js"
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
"module": "./lib/index.js",
|
|
83
|
+
"types": "./lib/index.d.ts",
|
|
84
|
+
"devDependencies": {
|
|
85
|
+
"@roots/bud-api": "0.0.0",
|
|
86
|
+
"@roots/bud-hooks": "0.0.0",
|
|
87
|
+
"@skypack/package-check": "0.2.2",
|
|
88
|
+
"@types/node": "18.11.18"
|
|
89
|
+
},
|
|
90
|
+
"dependencies": {
|
|
91
|
+
"@roots/bud-framework": "0.0.0",
|
|
92
|
+
"@roots/bud-support": "0.0.0"
|
|
93
|
+
},
|
|
94
|
+
"volta": {
|
|
95
|
+
"extends": "../../../package.json"
|
|
96
|
+
}
|
|
97
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import isUndefined from '@roots/bud-support/lodash/isUndefined'
|
|
2
|
+
|
|
3
|
+
import type {Factory} from './index.js'
|
|
4
|
+
|
|
5
|
+
export const dependencies: Factory<`dependencies`> = async ({
|
|
6
|
+
hooks,
|
|
7
|
+
root,
|
|
8
|
+
}) =>
|
|
9
|
+
hooks
|
|
10
|
+
.filter(`build.dependencies`, [])
|
|
11
|
+
.filter(label => !isUndefined(root.children[label]))
|