@roots/bud-build 5.0.0 → 5.3.1

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.
Files changed (64) hide show
  1. package/lib/cjs/Build/config.js +250 -252
  2. package/lib/cjs/Build/index.js +120 -77
  3. package/lib/cjs/Build/items.js +17 -21
  4. package/lib/cjs/Build/loaders.js +5 -4
  5. package/lib/cjs/Build/rules.js +132 -94
  6. package/lib/cjs/Item/index.js +16 -9
  7. package/lib/cjs/Item/item.dependencies.js +0 -1
  8. package/lib/cjs/Item/item.interface.js +0 -1
  9. package/lib/cjs/Loader/index.js +27 -4
  10. package/lib/cjs/Rule/index.js +178 -81
  11. package/lib/cjs/index.js +22 -5
  12. package/lib/cjs/shared/Base.js +0 -1
  13. package/lib/tsconfig.tsbuildinfo +1 -1
  14. package/package.json +11 -32
  15. package/types/Build/config.d.ts.map +1 -1
  16. package/types/Build/index.d.ts +19 -4
  17. package/types/Build/index.d.ts.map +1 -1
  18. package/types/Build/items.d.ts +3 -3
  19. package/types/Build/items.d.ts.map +1 -1
  20. package/types/Build/loaders.d.ts.map +1 -1
  21. package/types/Build/rules.d.ts +38 -21
  22. package/types/Build/rules.d.ts.map +1 -1
  23. package/types/Item/index.d.ts +1 -1
  24. package/types/Item/index.d.ts.map +1 -1
  25. package/types/Rule/index.d.ts +122 -24
  26. package/types/Rule/index.d.ts.map +1 -1
  27. package/types/shared/Base.d.ts.map +1 -1
  28. package/lib/cjs/Build/config.js.map +0 -1
  29. package/lib/cjs/Build/index.js.map +0 -1
  30. package/lib/cjs/Build/items.js.map +0 -1
  31. package/lib/cjs/Build/loaders.js.map +0 -1
  32. package/lib/cjs/Build/rules.js.map +0 -1
  33. package/lib/cjs/Item/index.js.map +0 -1
  34. package/lib/cjs/Item/item.dependencies.js.map +0 -1
  35. package/lib/cjs/Item/item.interface.js.map +0 -1
  36. package/lib/cjs/Loader/index.js.map +0 -1
  37. package/lib/cjs/Rule/index.js.map +0 -1
  38. package/lib/cjs/index.js.map +0 -1
  39. package/lib/cjs/shared/Base.js.map +0 -1
  40. package/lib/esm/Build/config.js +0 -263
  41. package/lib/esm/Build/config.js.map +0 -1
  42. package/lib/esm/Build/index.js +0 -133
  43. package/lib/esm/Build/index.js.map +0 -1
  44. package/lib/esm/Build/items.js +0 -119
  45. package/lib/esm/Build/items.js.map +0 -1
  46. package/lib/esm/Build/loaders.js +0 -55
  47. package/lib/esm/Build/loaders.js.map +0 -1
  48. package/lib/esm/Build/rules.js +0 -129
  49. package/lib/esm/Build/rules.js.map +0 -1
  50. package/lib/esm/Item/index.js +0 -80
  51. package/lib/esm/Item/index.js.map +0 -1
  52. package/lib/esm/Item/item.dependencies.js +0 -4
  53. package/lib/esm/Item/item.dependencies.js.map +0 -1
  54. package/lib/esm/Item/item.interface.js +0 -2
  55. package/lib/esm/Item/item.interface.js.map +0 -1
  56. package/lib/esm/Loader/index.js +0 -49
  57. package/lib/esm/Loader/index.js.map +0 -1
  58. package/lib/esm/Rule/index.js +0 -155
  59. package/lib/esm/Rule/index.js.map +0 -1
  60. package/lib/esm/index.js +0 -26
  61. package/lib/esm/index.js.map +0 -1
  62. package/lib/esm/shared/Base.js +0 -8
  63. package/lib/esm/shared/Base.js.map +0 -1
  64. package/lib/tsconfig-esm.tsbuildinfo +0 -1
@@ -1,129 +0,0 @@
1
- import { json5 as json5Parser, toml as tomlParser, yaml as yamlParser, } from '@roots/bud-support';
2
- import { Rule } from '../Rule';
3
- /**
4
- * Returns {@link Rule} for `asset/resource`
5
- *
6
- * @public
7
- */
8
- export const image = () => new Rule({
9
- test: ({ store }) => store.get('patterns.image'),
10
- exclude: ({ store }) => store.get('patterns.modules'),
11
- type: 'asset/resource',
12
- generator: app => ({
13
- filename: `assets/${app.store.is('features.hash', true) && app.isProduction
14
- ? app.store.get('hashFormat')
15
- : app.store.get('fileFormat')}[ext]`,
16
- }),
17
- });
18
- /**
19
- * Returns {@link Rule} for `.woff`/`.otf` handling
20
- *
21
- * @public
22
- */
23
- export const font = () => new Rule({
24
- test: ({ store }) => store.get('patterns.font'),
25
- exclude: ({ store }) => store.get('patterns.modules'),
26
- use: ({ build }) => [build.items['resolve-url']],
27
- });
28
- /**
29
- * Returns {@link Rule} for `.svg` handling
30
- *
31
- * @public
32
- */
33
- export const svg = () => new Rule({
34
- test: ({ store }) => store.get('patterns.svg'),
35
- exclude: ({ store }) => store.get('patterns.modules'),
36
- type: 'asset/resource',
37
- generator: app => ({
38
- filename: `assets/${app.store.is('features.hash', true) && app.isProduction
39
- ? app.store.get('hashFormat')
40
- : app.store.get('fileFormat')}[ext]`,
41
- }),
42
- });
43
- /**
44
- * Returns {@link Rule} for `.html` handling
45
- *
46
- * @public
47
- */
48
- export const html = () => new Rule({
49
- test: ({ store }) => store.get('patterns.html'),
50
- use: ({ build }) => [build.items.html],
51
- });
52
- /**
53
- * Returns {@link Rule} for `.csv` handling
54
- *
55
- * @public
56
- */
57
- export const csv = () => new Rule({
58
- test: ({ store }) => store.get('patterns.csv'),
59
- use: ({ build }) => [build.items.csv],
60
- });
61
- /**
62
- * Returns {@link Rule} for `.xml` handling
63
- *
64
- * @public
65
- */
66
- export const xml = () => new Rule({
67
- test: ({ store }) => store.get('patterns.xml'),
68
- use: ({ build }) => [build.items.xml],
69
- });
70
- /**
71
- * Returns {@link Rule} for `.toml` handling
72
- *
73
- * @public
74
- */
75
- export const toml = () => new Rule({
76
- test: ({ store }) => store.get('patterns.toml'),
77
- type: () => 'json',
78
- parser: () => ({
79
- parse: tomlParser.parse,
80
- }),
81
- });
82
- /**
83
- * Returns {@link Rule} for `.yml` / `.yaml` handling
84
- *
85
- * @public
86
- */
87
- export const yml = () => new Rule({
88
- test: ({ store }) => store.get('patterns.yml'),
89
- type: 'json',
90
- parser: () => ({
91
- parse: yamlParser.parse,
92
- }),
93
- });
94
- /**
95
- * Returns {@link Rule} for `.jsonc` handling
96
- *
97
- * @public
98
- */
99
- export const json5 = () => new Rule({
100
- test: ({ store }) => store.get('patterns.json5'),
101
- type: 'json',
102
- parser: () => ({
103
- parse: json5Parser.parse,
104
- }),
105
- });
106
- /**
107
- * Returns {@link Rule} for `.css` handling
108
- *
109
- * @public
110
- */
111
- export const css = () => new Rule({
112
- test: ({ store }) => store.get('patterns.css'),
113
- exclude: ({ store }) => store.get('patterns.modules'),
114
- use: ({ isProduction, build }) => [
115
- isProduction ? build.items.minicss : build.items.style,
116
- build.items.css,
117
- ],
118
- });
119
- /**
120
- * Returns {@link Rule} for `.js` handling
121
- *
122
- * @public
123
- */
124
- export const js = () => new Rule({
125
- test: ({ store }) => store.get('patterns.js'),
126
- exclude: ({ store }) => store.get('patterns.modules'),
127
- use: () => [],
128
- });
129
- //# sourceMappingURL=rules.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"rules.js","sourceRoot":"","sources":["../../../src/Build/rules.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,IAAI,WAAW,EACpB,IAAI,IAAI,UAAU,EAClB,IAAI,IAAI,UAAU,GACnB,MAAM,oBAAoB,CAAA;AAE3B,OAAO,EAAC,IAAI,EAAC,MAAM,SAAS,CAAA;AAE5B;;;;GAIG;AACH,MAAM,CAAC,MAAM,KAAK,GAAG,GAAG,EAAE,CACxB,IAAI,IAAI,CAAC;IACP,IAAI,EAAE,CAAC,EAAC,KAAK,EAAC,EAAE,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,gBAAgB,CAAC;IAC9C,OAAO,EAAE,CAAC,EAAC,KAAK,EAAC,EAAE,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,kBAAkB,CAAC;IACnD,IAAI,EAAE,gBAAgB;IACtB,SAAS,EAAE,GAAG,CAAC,EAAE,CAAC,CAAC;QACjB,QAAQ,EAAE,UACR,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,eAAe,EAAE,IAAI,CAAC,IAAI,GAAG,CAAC,YAAY;YACrD,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,YAAY,C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AAK,CAAC,GAAG,CAAC,aAAa,CAAC;IAC3C,OAAO,EAAE,CAAC,EAAC,KAAK,EAAC,EAAE,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,kBAAkB,CAAC;IACnD,GAAG,EAAE,GAAG,EAAE,CAAC,EAAE;CACd,CAAC,CAAA"}
@@ -1,80 +0,0 @@
1
- import { __decorate } from "tslib";
2
- import { bind, isFunction } from './item.dependencies';
3
- import { Base, } from './item.interface';
4
- /**
5
- * Item class
6
- *
7
- * @public
8
- */
9
- export class Item extends Base.Abstract {
10
- /**
11
- * Class constructor
12
- *
13
- * @param options - {@link Base.Options}
14
- */
15
- constructor({ loader, options, }) {
16
- super();
17
- this.setLoader(loader);
18
- options && this.setOptions(options);
19
- }
20
- /**
21
- * {@inheritDoc @roots/Framework-Framework#Item.Abstract.getLoader}
22
- *
23
- * @public
24
- * @decorator `@bind`
25
- */
26
- getLoader(app) {
27
- return this.loader(app);
28
- }
29
- /**
30
- * @public
31
- * @decorator `@bind`
32
- */
33
- setLoader(loader) {
34
- this.loader = isFunction(loader) ? loader : () => loader;
35
- }
36
- /**
37
- * @public
38
- * @decorator `@bind`
39
- */
40
- setOptions(options) {
41
- this.options = isFunction(options) ? options : () => options;
42
- }
43
- /**
44
- * @public
45
- * @decorator `@bind`
46
- */
47
- mergeOptions(options, app) {
48
- options = Object.assign(Object.assign({}, this.options(app)), options);
49
- this.setOptions((app) => options);
50
- }
51
- /**
52
- * @public
53
- * @decorator `@bind`
54
- */
55
- make(app) {
56
- const output = {
57
- loader: this.loader(app).make(app),
58
- };
59
- if (this.options) {
60
- output.options = this.options(app);
61
- }
62
- return output;
63
- }
64
- }
65
- __decorate([
66
- bind
67
- ], Item.prototype, "getLoader", null);
68
- __decorate([
69
- bind
70
- ], Item.prototype, "setLoader", null);
71
- __decorate([
72
- bind
73
- ], Item.prototype, "setOptions", null);
74
- __decorate([
75
- bind
76
- ], Item.prototype, "mergeOptions", null);
77
- __decorate([
78
- bind
79
- ], Item.prototype, "make", null);
80
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/Item/index.ts"],"names":[],"mappings":";AAAA,OAAO,EAAC,IAAI,EAAE,UAAU,EAAC,MAAM,qBAAqB,CAAA;AACpD,OAAO,EACL,IAAI,GAKL,MAAM,kBAAkB,CAAA;AAEzB;;;;GAIG;AACH,MAAM,OAAO,IACX,SAAQ,IAAI,CAAC,QAAQ;IAiBrB;;;;OAIG;IACH,YAAmB,EACjB,MAAM,EACN,OAAO,GACiB;QACxB,KAAK,EAAE,CAAA;QAEP,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAA;QACtB,OAAO,IAAI,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,CAAA;IACrC,CAAC;IAED;;;;;OAKG;IAEI,SAAS,CAAC,GAAc;QAC7B,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAA;IACzB,CAAC;IAED;;;OAGG;IAEI,SAAS,CACd,MAA4C;QAE5C,IAAI,CAAC,MAAM,GAAG,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,MAAM,CAAA;IAC1D,CAAC;IAED;;;OAGG;IAEI,UAAU,CAAC,OAAyC;QACzD,IAAI,CAAC,OAAO,GAAG,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,OAAO,CAAA;IAC9D,CAAC;IAED;;;OAGG;IAEI,YAAY,CAAC,OAAqB,EAAE,GAAc;QACvD,OAAO,mCACF,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,GACjB,OAAO,CACX,CAAA;QAED,IAAI,CAAC,UAAU,CAAC,CAAC,GAAc,EAAE,EAAE,CAAC,OAAO,CAAC,CAAA;IAC9C,CAAC;IAED;;;OAGG;IAEI,IAAI,CAAC,GAAc;QACxB,MAAM,MAAM,GAAgB;YAC1B,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC;SACnC,CAAA;QAED,IAAI,IAAI,CAAC,OAAO,EAAE;YAChB,MAAM,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAA;SACnC;QAED,OAAO,MAAM,CAAA;IACf,CAAC;CACF;AAtDC;IADC,IAAI;qCAGJ;AAOD;IADC,IAAI;qCAKJ;AAOD;IADC,IAAI;sCAGJ;AAOD;IADC,IAAI;wCAQJ;AAOD;IADC,IAAI;gCAWJ"}
@@ -1,4 +0,0 @@
1
- import { bind, lodash } from '@roots/bud-support';
2
- export const { isFunction } = lodash;
3
- export { bind };
4
- //# sourceMappingURL=item.dependencies.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"item.dependencies.js","sourceRoot":"","sources":["../../../src/Item/item.dependencies.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,IAAI,EAAE,MAAM,EAAC,MAAM,oBAAoB,CAAA;AAE/C,MAAM,CAAC,MAAM,EAAC,UAAU,EAAC,GAAG,MAAM,CAAA;AAClC,OAAO,EAAC,IAAI,EAAC,CAAA"}
@@ -1,2 +0,0 @@
1
- export { Framework, Item as Base, Loader, } from '@roots/bud-framework';
2
- //# sourceMappingURL=item.interface.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"item.interface.js","sourceRoot":"","sources":["../../../src/Item/item.interface.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,SAAS,EACT,IAAI,IAAI,IAAI,EACZ,MAAM,GAEP,MAAM,sBAAsB,CAAA"}
@@ -1,49 +0,0 @@
1
- import { __decorate } from "tslib";
2
- import * as Framework from '@roots/bud-framework';
3
- import { bind, lodash } from '@roots/bud-support';
4
- const { isFunction } = lodash;
5
- /**
6
- * Framework Loader
7
- *
8
- * @public
9
- */
10
- export class Loader extends Framework.Loader.Abstract {
11
- /**
12
- * Class constructor
13
- *
14
- * @param src - Either a factory returning a string or a literal string
15
- *
16
- * @public
17
- */
18
- constructor(src) {
19
- super();
20
- this.src = this.normalizeInput(src);
21
- }
22
- /**
23
- * Factory producing the final loader path
24
- *
25
- * @param app - {@link @roots/bud-Bud#Bud}
26
- * @returns final loader path
27
- *
28
- * @public
29
- * @decorator `@bind`
30
- */
31
- make(app) {
32
- return this.src(app);
33
- }
34
- /**
35
- * Ensure that a userInput is assigned to the class as a {@link @roots/bud-Bud#Factory | Factory}
36
- *
37
- * @param input - input value
38
- * @returns normalized value from user input
39
- *
40
- * @public
41
- */
42
- normalizeInput(input) {
43
- return isFunction(input) ? input : () => input;
44
- }
45
- }
46
- __decorate([
47
- bind
48
- ], Loader.prototype, "make", null);
49
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/Loader/index.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,SAAS,MAAM,sBAAsB,CAAA;AAEjD,OAAO,EAAC,IAAI,EAAE,MAAM,EAAC,MAAM,oBAAoB,CAAA;AAC/C,MAAM,EAAC,UAAU,EAAC,GAAG,MAAM,CAAA;AAE3B;;;;GAIG;AACH,MAAM,OAAO,MACX,SAAQ,SAAS,CAAC,MAAM,CAAC,QAAQ;IAUjC;;;;;;OAMG;IACH,YAAmB,GAAmC;QACpD,KAAK,EAAE,CAAA;QAEP,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC,cAAc,CAAS,GAAG,CAAC,CAAA;IAC7C,CAAC;IAED;;;;;;;;OAQG;IAEI,IAAI,CAAC,GAAQ;QAClB,OAAO,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;IACtB,CAAC;IAED;;;;;;;OAOG;IACI,cAAc,CACnB,KAAgC;QAEhC,OAAO,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,KAAK,CAAA;IAChD,CAAC;CACF;AAjBC;IADC,IAAI;kCAGJ"}
@@ -1,155 +0,0 @@
1
- import { __decorate } from "tslib";
2
- import { Rule as Base, } from '@roots/bud-framework';
3
- import { bind, lodash } from '@roots/bud-support';
4
- const { isFunction } = lodash;
5
- /**
6
- * Framework Rule
7
- *
8
- * @public
9
- */
10
- export class Rule extends Base.Abstract {
11
- /**
12
- * Class constructor
13
- *
14
- * @public
15
- */
16
- constructor({ test, use = null, exclude = null, type = null, parser = null, generator = null, }) {
17
- super();
18
- this.test = isFunction(test) ? test : () => test;
19
- if (use) {
20
- this.use = isFunction(use) ? use : () => use;
21
- }
22
- if (exclude) {
23
- this.exclude = isFunction(exclude)
24
- ? exclude
25
- : () => exclude;
26
- }
27
- if (type) {
28
- this.type = isFunction(type) ? type : () => type;
29
- }
30
- if (parser) {
31
- this.parser = isFunction(parser) ? parser : () => parser;
32
- }
33
- if (generator) {
34
- this.generator = isFunction(generator)
35
- ? generator
36
- : () => generator;
37
- }
38
- }
39
- /**
40
- *
41
- * @param app - {@link @roots/bud-framework#Framework | Framework}
42
- * @returns
43
- *
44
- * @public
45
- * @decorator `@bind`
46
- */
47
- getTest(app) {
48
- return this.test ? this.test(app) : null;
49
- }
50
- setTest(test) {
51
- this.test = isFunction(test) ? test : () => test;
52
- }
53
- getParser(app) {
54
- return this.parser ? this.parser(app) : null;
55
- }
56
- setParser(parser) {
57
- this.parser = isFunction(parser) ? parser : () => parser;
58
- }
59
- getUse(app) {
60
- return this.use ? this.use(app) : null;
61
- }
62
- setUse(use) {
63
- this.use = isFunction(use) ? use : () => use;
64
- }
65
- getExclude(app) {
66
- return this.exclude ? this.exclude(app) : null;
67
- }
68
- setExclude(exclude) {
69
- this.exclude = isFunction(exclude) ? exclude : () => exclude;
70
- }
71
- getType(app) {
72
- return this.type ? this.type(app) : null;
73
- }
74
- setType(type) {
75
- this.type = isFunction(type) ? type : () => type;
76
- }
77
- getGenerator(app) {
78
- return this.generator ? this.generator(app) : null;
79
- }
80
- setGenerator(generator) {
81
- this.generator = isFunction(generator)
82
- ? generator
83
- : () => generator;
84
- }
85
- /**
86
- * Produce final Base output
87
- *
88
- * @param app - {@link @roots/bud-framework#Framework}
89
- * @returns finalized rule
90
- *
91
- * @public
92
- * @decorator `@bind`
93
- */
94
- make(app) {
95
- const output = {
96
- test: this.test(app),
97
- };
98
- if (this.use) {
99
- output.use = this.use(app).map(item => item.make(app));
100
- }
101
- if (this.exclude) {
102
- output.exclude = this.exclude(app);
103
- }
104
- if (this.type) {
105
- output.type = this.type(app);
106
- }
107
- if (this.parser) {
108
- output.parser = this.parser(app);
109
- }
110
- if (this.generator) {
111
- output.generator = this.generator(app);
112
- }
113
- return output;
114
- }
115
- }
116
- __decorate([
117
- bind
118
- ], Rule.prototype, "getTest", null);
119
- __decorate([
120
- bind
121
- ], Rule.prototype, "setTest", null);
122
- __decorate([
123
- bind
124
- ], Rule.prototype, "getParser", null);
125
- __decorate([
126
- bind
127
- ], Rule.prototype, "setParser", null);
128
- __decorate([
129
- bind
130
- ], Rule.prototype, "getUse", null);
131
- __decorate([
132
- bind
133
- ], Rule.prototype, "setUse", null);
134
- __decorate([
135
- bind
136
- ], Rule.prototype, "getExclude", null);
137
- __decorate([
138
- bind
139
- ], Rule.prototype, "setExclude", null);
140
- __decorate([
141
- bind
142
- ], Rule.prototype, "getType", null);
143
- __decorate([
144
- bind
145
- ], Rule.prototype, "setType", null);
146
- __decorate([
147
- bind
148
- ], Rule.prototype, "getGenerator", null);
149
- __decorate([
150
- bind
151
- ], Rule.prototype, "setGenerator", null);
152
- __decorate([
153
- bind
154
- ], Rule.prototype, "make", null);
155
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/Rule/index.ts"],"names":[],"mappings":";AAAA,OAAO,EAKL,IAAI,IAAI,IAAI,GACb,MAAM,sBAAsB,CAAA;AAC7B,OAAO,EAAC,IAAI,EAAE,MAAM,EAAC,MAAM,oBAAoB,CAAA;AAE/C,M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AAC,MAAM,EAAE;YACf,MAAM,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAA;SACjC;QAED,IAAI,IAAI,CAAC,SAAS,EAAE;YAClB,MAAM,CAAC,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAA;SACvC;QAED,OAAO,MAAM,CAAA;IACf,CAAC;CACF;AAxGC;IADC,IAAI;mCAGJ;AAGD;IADC,IAAI;mCAKJ;AAGD;IADC,IAAI;qCAGJ;AAGD;IADC,IAAI;qCAKJ;AAGD;IADC,IAAI;kCAGJ;AAGD;IADC,IAAI;kCAKJ;AAGD;IADC,IAAI;sCAGJ;AAGD;IADC,IAAI;sCAGJ;AAGD;IADC,IAAI;mCAGJ;AAGD;IADC,IAAI;mCAGJ;AAGD;IADC,IAAI;wCAGJ;AAGD;IADC,IAAI;wCAKJ;AAYD;IADC,IAAI;gCA2BJ"}
package/lib/esm/index.js DELETED
@@ -1,26 +0,0 @@
1
- // Copyright (c) Roots Foundation, LLC. All rights reserved.
2
- // Licensed under the MIT license.
3
- /**
4
- * Compiler configuration builder
5
- *
6
- * @see https://roots.io/bud
7
- * @see https://github.com/roots/bud
8
- *
9
- * @remarks
10
- * - 💁 Composable - Build exceptional applications with a modular, configurable build system
11
- *
12
- * - 💪 Modern - Modern framework written in TypeScript with an expressive API
13
- *
14
- * - 🌱 Easy - Low bundle size and fast build times
15
- *
16
- * @packageDocumentation
17
- */
18
- export { Build } from './Build';
19
- export { Loader } from './Loader';
20
- export { Item } from './Item';
21
- export { Rule } from './Rule';
22
- import * as items from './Build/items';
23
- import * as loaders from './Build/loaders';
24
- import * as rules from './Build/rules';
25
- export { items, loaders, rules };
26
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,4DAA4D;AAC5D,kCAAkC;AAElC;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAC,KAAK,EAAC,MAAM,SAAS,CAAA;AAC7B,OAAO,EAAC,MAAM,EAAC,MAAM,UAAU,CAAA;AAC/B,OAAO,EAAC,IAAI,EAAC,MAAM,QAAQ,CAAA;AAC3B,OAAO,EAAC,IAAI,EAAC,MAAM,QAAQ,CAAA;AAE3B,OAAO,KAAK,KAAK,MAAM,eAAe,CAAA;AACtC,OAAO,KAAK,OAAO,MAAM,iBAAiB,CAAA;AAC1C,OAAO,KAAK,KAAK,MAAM,eAAe,CAAA;AACtC,OAAO,EAAC,KAAK,EAAE,OAAO,EAAE,KAAK,EAAC,CAAA"}
@@ -1,8 +0,0 @@
1
- import { lodash } from '@roots/bud-support';
2
- const { isFunction } = lodash;
3
- export class Base {
4
- normalizeInput(input) {
5
- return isFunction(input) ? input : () => input;
6
- }
7
- }
8
- //# sourceMappingURL=Base.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Base.js","sourceRoot":"","sources":["../../../src/shared/Base.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,MAAM,EAAC,MAAM,oBAAoB,CAAA;AAEzC,MAAM,EAAC,UAAU,EAAC,GAAG,MAAM,CAAA;AAE3B,MAAM,OAAO,IAAI;IACR,cAAc,CACnB,KAAkC;QAElC,OAAO,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,KAAK,CAAA;IAChD,CAAC;CACF"}