@roots/bud-build 6.6.6 → 6.6.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/config/infrastructureLogging.d.ts.map +1 -1
- package/lib/config/infrastructureLogging.js +1 -1
- package/lib/config/infrastructureLogging.js.map +1 -1
- package/lib/handlers/loaders/loaders.d.ts.map +1 -1
- package/lib/handlers/loaders/loaders.js +2 -2
- package/lib/handlers/loaders/loaders.js.map +1 -1
- package/lib/handlers/rules/json.d.ts.map +1 -1
- package/lib/handlers/rules/json.js +2 -2
- package/lib/handlers/rules/json.js.map +1 -1
- package/lib/handlers/rules/svg.inline.d.ts +2 -0
- package/lib/handlers/rules/svg.inline.d.ts.map +1 -1
- package/lib/handlers/rules/svg.inline.js +3 -0
- package/lib/handlers/rules/svg.inline.js.map +1 -1
- package/lib/handlers/rules/toml.js +1 -1
- package/lib/handlers/rules/toml.js.map +1 -1
- package/package.json +7 -13
- package/src/config/infrastructureLogging.ts +1 -4
- package/src/handlers/loaders/loaders.ts +2 -2
- package/src/handlers/rules/json.ts +2 -2
- package/src/handlers/rules/svg.inline.test.ts +30 -0
- package/src/handlers/rules/svg.inline.ts +5 -0
- package/src/handlers/rules/toml.ts +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"infrastructureLogging.d.ts","sourceRoot":"","sources":["../../src/config/infrastructureLogging.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,OAAO,EAAC,MAAM,YAAY,CAAA;AAEvC,eAAO,MAAM,qBAAqB,EAAE,OAAO,CACzC,uBAAuB,
|
|
1
|
+
{"version":3,"file":"infrastructureLogging.d.ts","sourceRoot":"","sources":["../../src/config/infrastructureLogging.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,OAAO,EAAC,MAAM,YAAY,CAAA;AAEvC,eAAO,MAAM,qBAAqB,EAAE,OAAO,CACzC,uBAAuB,CAcrB,CAAA"}
|
|
@@ -9,6 +9,6 @@ export const infrastructureLogging = async (bud) => bud.hooks.filter(`build.infr
|
|
|
9
9
|
time: bud.context.logger.time,
|
|
10
10
|
timeEnd: bud.context.logger.timeEnd,
|
|
11
11
|
}),
|
|
12
|
-
level: bud.hooks.filter(`build.infrastructureLogging.level`,
|
|
12
|
+
level: bud.hooks.filter(`build.infrastructureLogging.level`, `log`),
|
|
13
13
|
});
|
|
14
14
|
//# sourceMappingURL=infrastructureLogging.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"infrastructureLogging.js","sourceRoot":"","sources":["../../src/config/infrastructureLogging.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,qBAAqB,GAE9B,KAAK,EAAC,GAAG,EAAC,EAAE,CACd,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,6BAA6B,EAAE;IAC9C,OAAO,EAAE,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,qCAAqC,EAAE;QAC/D,GAAG,OAAO;QACV,GAAG,EAAE,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG;QAC3B,IAAI,EAAE,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI;QAC7B,IAAI,EAAE,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI;QAC7B,KAAK,EAAE,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK;QAC/B,KAAK,EAAE,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK;QAC/B,IAAI,EAAE,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI;QAC7B,OAAO,EAAE,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC,OAAO;KACpC,CAAC;IACF,KAAK,EAAE,GAAG,CAAC,KAAK,CAAC,MAAM,
|
|
1
|
+
{"version":3,"file":"infrastructureLogging.js","sourceRoot":"","sources":["../../src/config/infrastructureLogging.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,qBAAqB,GAE9B,KAAK,EAAC,GAAG,EAAC,EAAE,CACd,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,6BAA6B,EAAE;IAC9C,OAAO,EAAE,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,qCAAqC,EAAE;QAC/D,GAAG,OAAO;QACV,GAAG,EAAE,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG;QAC3B,IAAI,EAAE,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI;QAC7B,IAAI,EAAE,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI;QAC7B,KAAK,EAAE,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK;QAC/B,KAAK,EAAE,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK;QAC/B,IAAI,EAAE,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI;QAC7B,OAAO,EAAE,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC,OAAO;KACpC,CAAC;IACF,KAAK,EAAE,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,mCAAmC,EAAE,KAAK,CAAC;CACpE,CAAC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loaders.d.ts","sourceRoot":"","sources":["../../../src/handlers/loaders/loaders.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,qCAAqC,CAAA;AAG/D,OAAO,KAAK,EAAC,OAAO,EAAC,MAAM,aAAa,CAAA;AAExC,eAAO,MAAM,GAAG,EAAE,OAAO,CAAC,MAAM,CACN,CAAA;AAE1B,eAAO,MAAM,GAAG,EAAE,OAAO,CAAC,MAAM,CACN,CAAA;AAE1B,eAAO,MAAM,IAAI,EAAE,OAAO,CAAC,MAAM,CACN,CAAA;AAE3B,eAAO,MAAM,IAAI,EAAE,OAAO,CAAC,MAAM,CACN,CAAA;AAE3B,eAAO,MAAM,MAAM,EAAE,OAAO,CAAC,MAAM,CACN,CAAA;AAE7B,eAAO,MAAM,OAAO,EAAE,OAAO,CAAC,MAAM,
|
|
1
|
+
{"version":3,"file":"loaders.d.ts","sourceRoot":"","sources":["../../../src/handlers/loaders/loaders.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,qCAAqC,CAAA;AAG/D,OAAO,KAAK,EAAC,OAAO,EAAC,MAAM,aAAa,CAAA;AAExC,eAAO,MAAM,GAAG,EAAE,OAAO,CAAC,MAAM,CACN,CAAA;AAE1B,eAAO,MAAM,GAAG,EAAE,OAAO,CAAC,MAAM,CACN,CAAA;AAE1B,eAAO,MAAM,IAAI,EAAE,OAAO,CAAC,MAAM,CACN,CAAA;AAE3B,eAAO,MAAM,IAAI,EAAE,OAAO,CAAC,MAAM,CACN,CAAA;AAE3B,eAAO,MAAM,MAAM,EAAE,OAAO,CAAC,MAAM,CACN,CAAA;AAE7B,eAAO,MAAM,OAAO,EAAE,OAAO,CAAC,MAAM,CACR,CAAA;AAE5B,eAAO,MAAM,KAAK,EAAE,OAAO,CAAC,MAAM,CACN,CAAA;AAE5B,eAAO,MAAM,GAAG,EAAE,OAAO,CAAC,MAAM,CACN,CAAA;AAE1B,eAAO,MAAM,GAAG,EAAE,OAAO,CAAC,MAAM,CACN,CAAA"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as MiniCss from '@roots/bud-support/mini-css-extract-plugin';
|
|
2
2
|
export const css = ({ makeLoader }) => makeLoader(`css-loader`);
|
|
3
3
|
export const csv = ({ makeLoader }) => makeLoader(`csv-loader`);
|
|
4
4
|
export const file = ({ makeLoader }) => makeLoader(`file-loader`);
|
|
5
5
|
export const html = ({ makeLoader }) => makeLoader(`html-loader`);
|
|
6
6
|
export const remark = ({ makeLoader }) => makeLoader(`remark-loader`);
|
|
7
|
-
export const minicss = ({ makeLoader }) => makeLoader(
|
|
7
|
+
export const minicss = ({ makeLoader }) => makeLoader(MiniCss.loader);
|
|
8
8
|
export const style = ({ makeLoader }) => makeLoader(`style-loader`);
|
|
9
9
|
export const xml = ({ makeLoader }) => makeLoader(`xml-loader`);
|
|
10
10
|
export const yml = ({ makeLoader }) => makeLoader(`yml-loader`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loaders.js","sourceRoot":"","sources":["../../../src/handlers/loaders/loaders.ts"],"names":[],"mappings":"AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"loaders.js","sourceRoot":"","sources":["../../../src/handlers/loaders/loaders.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,OAAO,MAAM,4CAA4C,CAAA;AAIrE,MAAM,CAAC,MAAM,GAAG,GAAoB,CAAC,EAAC,UAAU,EAAC,EAAE,EAAE,CACnD,UAAU,CAAC,YAAY,CAAC,CAAA;AAE1B,MAAM,CAAC,MAAM,GAAG,GAAoB,CAAC,EAAC,UAAU,EAAC,EAAE,EAAE,CACnD,UAAU,CAAC,YAAY,CAAC,CAAA;AAE1B,MAAM,CAAC,MAAM,IAAI,GAAoB,CAAC,EAAC,UAAU,EAAC,EAAE,EAAE,CACpD,UAAU,CAAC,aAAa,CAAC,CAAA;AAE3B,MAAM,CAAC,MAAM,IAAI,GAAoB,CAAC,EAAC,UAAU,EAAC,EAAE,EAAE,CACpD,UAAU,CAAC,aAAa,CAAC,CAAA;AAE3B,MAAM,CAAC,MAAM,MAAM,GAAoB,CAAC,EAAC,UAAU,EAAC,EAAE,EAAE,CACtD,UAAU,CAAC,eAAe,CAAC,CAAA;AAE7B,MAAM,CAAC,MAAM,OAAO,GAAoB,CAAC,EAAC,UAAU,EAAC,EAAE,EAAE,CACvD,UAAU,CAAC,OAAO,CAAC,MAAM,CAAC,CAAA;AAE5B,MAAM,CAAC,MAAM,KAAK,GAAoB,CAAC,EAAC,UAAU,EAAC,EAAE,EAAE,CACrD,UAAU,CAAC,cAAc,CAAC,CAAA;AAE5B,MAAM,CAAC,MAAM,GAAG,GAAoB,CAAC,EAAC,UAAU,EAAC,EAAE,EAAE,CACnD,UAAU,CAAC,YAAY,CAAC,CAAA;AAE1B,MAAM,CAAC,MAAM,GAAG,GAAoB,CAAC,EAAC,UAAU,EAAC,EAAE,EAAE,CACnD,UAAU,CAAC,YAAY,CAAC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"json.d.ts","sourceRoot":"","sources":["../../../src/handlers/rules/json.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAC,OAAO,EAAC,MAAM,aAAa,CAAA;AAExC,eAAO,MAAM,IAAI,EAAE,
|
|
1
|
+
{"version":3,"file":"json.d.ts","sourceRoot":"","sources":["../../../src/handlers/rules/json.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAC,OAAO,EAAC,MAAM,aAAa,CAAA;AAExC,eAAO,MAAM,IAAI,EAAE,OAKiB,CAAA"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import
|
|
1
|
+
import json5 from '@roots/bud-support/json5';
|
|
2
2
|
export const json = ({ filter, makeRule, path }) => makeRule()
|
|
3
3
|
.setType(`json`)
|
|
4
4
|
.setInclude([() => path()])
|
|
5
5
|
.setTest(filter(`pattern.json`))
|
|
6
|
-
.setParser({ parse:
|
|
6
|
+
.setParser({ parse: json5.parse });
|
|
7
7
|
//# sourceMappingURL=json.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"json.js","sourceRoot":"","sources":["../../../src/handlers/rules/json.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"json.js","sourceRoot":"","sources":["../../../src/handlers/rules/json.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,0BAA0B,CAAA;AAI5C,MAAM,CAAC,MAAM,IAAI,GAAY,CAAC,EAAC,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAC,EAAE,EAAE,CACxD,QAAQ,EAAE;KACP,OAAO,CAAC,MAAM,CAAC;KACf,UAAU,CAAC,CAAC,GAAG,EAAE,CAAC,IAAI,EAAE,CAAC,CAAC;KAC1B,OAAO,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC;KAC/B,SAAS,CAAC,EAAC,KAAK,EAAE,KAAK,CAAC,KAAK,EAAC,CAAC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"svg.inline.d.ts","sourceRoot":"","sources":["../../../src/handlers/rules/svg.inline.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"svg.inline.d.ts","sourceRoot":"","sources":["../../../src/handlers/rules/svg.inline.ts"],"names":[],"mappings":";AAEA,OAAO,KAAK,EAAC,OAAO,EAAC,MAAM,aAAa,CAAA;AAExC,eAAO,MAAM,SAAS,EAAE,OAMI,CAAA;AAE5B,eAAO,MAAM,OAAO,SAAU,MAAM,WAA6B,CAAA"}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
+
import dataUri from 'mini-svg-data-uri';
|
|
1
2
|
export const inlineSvg = ({ filter, makeRule, path }) => makeRule()
|
|
2
3
|
.setTest(filter(`pattern.svg`))
|
|
3
4
|
.setInclude([() => path(`@src`)])
|
|
4
5
|
.setResourceQuery(/inline/)
|
|
6
|
+
.setGenerator({ dataUrl })
|
|
5
7
|
.setType(`asset/inline`);
|
|
8
|
+
export const dataUrl = (data) => dataUri(data.toString());
|
|
6
9
|
//# sourceMappingURL=svg.inline.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"svg.inline.js","sourceRoot":"","sources":["../../../src/handlers/rules/svg.inline.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"svg.inline.js","sourceRoot":"","sources":["../../../src/handlers/rules/svg.inline.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,mBAAmB,CAAA;AAIvC,MAAM,CAAC,MAAM,SAAS,GAAY,CAAC,EAAC,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAC,EAAE,EAAE,CAC7D,QAAQ,EAAE;KACP,OAAO,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC;KAC9B,UAAU,CAAC,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC;KAChC,gBAAgB,CAAC,QAAQ,CAAC;KAC1B,YAAY,CAAC,EAAC,OAAO,EAAC,CAAC;KACvB,OAAO,CAAC,cAAc,CAAC,CAAA;AAE5B,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,IAAY,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toml.js","sourceRoot":"","sources":["../../../src/handlers/rules/toml.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"toml.js","sourceRoot":"","sources":["../../../src/handlers/rules/toml.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,MAAM,yBAAyB,CAAA;AAIhD,MAAM,CAAC,MAAM,IAAI,GAAY,CAAC,EAAC,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAC,EAAE,EAAE,CACxD,QAAQ,EAAE;KACP,OAAO,CAAC,MAAM,CAAC;KACf,UAAU,CAAC,CAAC,GAAG,EAAE,CAAC,IAAI,EAAE,CAAC,CAAC;KAC1B,OAAO,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC;KACrC,SAAS,CAAC,EAAC,KAAK,EAAE,UAAU,CAAC,KAAK,EAAC,CAAC,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@roots/bud-build",
|
|
3
3
|
"description": "bud.js core module",
|
|
4
|
-
"version": "6.6.
|
|
4
|
+
"version": "6.6.7",
|
|
5
5
|
"homepage": "https://roots.io/bud",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -72,30 +72,24 @@
|
|
|
72
72
|
}
|
|
73
73
|
},
|
|
74
74
|
"devDependencies": {
|
|
75
|
-
"@roots/bud-api": "6.6.
|
|
76
|
-
"@roots/bud-hooks": "6.6.
|
|
75
|
+
"@roots/bud-api": "6.6.7",
|
|
76
|
+
"@roots/bud-hooks": "6.6.7",
|
|
77
77
|
"@skypack/package-check": "0.2.2",
|
|
78
|
-
"@types/
|
|
79
|
-
"@types/mini-css-extract-plugin": "2.5.1",
|
|
80
|
-
"@types/node": "16.18.6",
|
|
81
|
-
"webpack": "5.75.0"
|
|
78
|
+
"@types/node": "16.18.6"
|
|
82
79
|
},
|
|
83
80
|
"dependencies": {
|
|
84
|
-
"@roots/bud-framework": "6.6.
|
|
85
|
-
"@roots/bud-support": "6.6.
|
|
81
|
+
"@roots/bud-framework": "6.6.7",
|
|
82
|
+
"@roots/bud-support": "6.6.7",
|
|
86
83
|
"css-loader": "^6.7.2",
|
|
87
84
|
"csv-loader": "^3.0.5",
|
|
88
85
|
"file-loader": "^6.2.0",
|
|
89
|
-
"fs-extra": "10.1.0",
|
|
90
86
|
"helpful-decorators": "2.1.0",
|
|
91
87
|
"html-loader": "^4.2.0",
|
|
92
|
-
"
|
|
93
|
-
"mini-css-extract-plugin": "2.7.1",
|
|
88
|
+
"mini-svg-data-uri": "1.4.4",
|
|
94
89
|
"remark": "14.0.2",
|
|
95
90
|
"remark-html": "15.0.1",
|
|
96
91
|
"remark-loader": "5.0.0",
|
|
97
92
|
"style-loader": "3.3.1",
|
|
98
|
-
"toml": "3.0.0",
|
|
99
93
|
"xml-loader": "1.2.1",
|
|
100
94
|
"yml-loader": "2.1.0"
|
|
101
95
|
},
|
|
@@ -14,8 +14,5 @@ export const infrastructureLogging: Factory<
|
|
|
14
14
|
time: bud.context.logger.time,
|
|
15
15
|
timeEnd: bud.context.logger.timeEnd,
|
|
16
16
|
}),
|
|
17
|
-
level: bud.hooks.filter(
|
|
18
|
-
`build.infrastructureLogging.level`,
|
|
19
|
-
bud.context.args.verbose ? `log` : `info`,
|
|
20
|
-
),
|
|
17
|
+
level: bud.hooks.filter(`build.infrastructureLogging.level`, `log`),
|
|
21
18
|
})
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type {Loader} from '@roots/bud-framework/services/build'
|
|
2
|
-
import
|
|
2
|
+
import * as MiniCss from '@roots/bud-support/mini-css-extract-plugin'
|
|
3
3
|
|
|
4
4
|
import type {Factory} from '../index.js'
|
|
5
5
|
|
|
@@ -19,7 +19,7 @@ export const remark: Factory<Loader> = ({makeLoader}) =>
|
|
|
19
19
|
makeLoader(`remark-loader`)
|
|
20
20
|
|
|
21
21
|
export const minicss: Factory<Loader> = ({makeLoader}) =>
|
|
22
|
-
makeLoader(
|
|
22
|
+
makeLoader(MiniCss.loader)
|
|
23
23
|
|
|
24
24
|
export const style: Factory<Loader> = ({makeLoader}) =>
|
|
25
25
|
makeLoader(`style-loader`)
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import json5 from '@roots/bud-support/json5'
|
|
2
2
|
|
|
3
3
|
import type {Factory} from '../index.js'
|
|
4
4
|
|
|
@@ -7,4 +7,4 @@ export const json: Factory = ({filter, makeRule, path}) =>
|
|
|
7
7
|
.setType(`json`)
|
|
8
8
|
.setInclude([() => path()])
|
|
9
9
|
.setTest(filter(`pattern.json`))
|
|
10
|
-
.setParser({parse:
|
|
10
|
+
.setParser({parse: json5.parse})
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import {describe, expect, it} from 'vitest'
|
|
2
|
+
|
|
3
|
+
import {inlineSvg, dataUrl} from './svg.inline.js'
|
|
4
|
+
|
|
5
|
+
describe(`svg-inline`, () => {
|
|
6
|
+
it(`should return a rule`, async () => {
|
|
7
|
+
const bud = await import(`@repo/test-kit/bud`).then(
|
|
8
|
+
async ({factory}) => await factory(),
|
|
9
|
+
)
|
|
10
|
+
const result = inlineSvg({
|
|
11
|
+
filter: bud.hooks.filter,
|
|
12
|
+
makeItem: bud.build.makeItem,
|
|
13
|
+
makeLoader: bud.build.makeLoader,
|
|
14
|
+
makeRule: bud.build.makeRule,
|
|
15
|
+
isProduction: bud.isProduction,
|
|
16
|
+
path: bud.path,
|
|
17
|
+
})
|
|
18
|
+
|
|
19
|
+
const webpackOutput = result.toWebpack()
|
|
20
|
+
expect(webpackOutput.test).toEqual(bud.hooks.filter(`pattern.svg`))
|
|
21
|
+
expect(webpackOutput.include).toEqual([bud.path(`@src`)])
|
|
22
|
+
expect(webpackOutput.resourceQuery).toEqual(/inline/)
|
|
23
|
+
expect(webpackOutput.type).toEqual(`asset/inline`)
|
|
24
|
+
expect(webpackOutput.generator).toEqual(
|
|
25
|
+
expect.objectContaining({
|
|
26
|
+
dataUrl,
|
|
27
|
+
}),
|
|
28
|
+
)
|
|
29
|
+
})
|
|
30
|
+
})
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import dataUri from 'mini-svg-data-uri'
|
|
2
|
+
|
|
1
3
|
import type {Factory} from '../index.js'
|
|
2
4
|
|
|
3
5
|
export const inlineSvg: Factory = ({filter, makeRule, path}) =>
|
|
@@ -5,4 +7,7 @@ export const inlineSvg: Factory = ({filter, makeRule, path}) =>
|
|
|
5
7
|
.setTest(filter(`pattern.svg`))
|
|
6
8
|
.setInclude([() => path(`@src`)])
|
|
7
9
|
.setResourceQuery(/inline/)
|
|
10
|
+
.setGenerator({dataUrl})
|
|
8
11
|
.setType(`asset/inline`)
|
|
12
|
+
|
|
13
|
+
export const dataUrl = (data: Buffer) => dataUri(data.toString())
|