@maizzle/framework 5.0.0-beta.37 → 5.0.0-beta.38
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/package.json
CHANGED
package/src/commands/build.js
CHANGED
|
@@ -210,7 +210,26 @@ export default async (config = {}) => {
|
|
|
210
210
|
|
|
211
211
|
const html = await readFile(templatePath, 'utf8')
|
|
212
212
|
|
|
213
|
-
|
|
213
|
+
/**
|
|
214
|
+
* Render the markup.
|
|
215
|
+
*
|
|
216
|
+
* Merging a custom `components` object to make sure that file extensions from both
|
|
217
|
+
* `build.content` * and * `components.fileExtension` are used when scanning for
|
|
218
|
+
* component files.
|
|
219
|
+
*/
|
|
220
|
+
const userComponentFileExtensions = get(config, 'components.fileExtension', ['html'])
|
|
221
|
+
|
|
222
|
+
const rendered = await render(html, merge(
|
|
223
|
+
{
|
|
224
|
+
components: {
|
|
225
|
+
fileExtension: [
|
|
226
|
+
...outputExtensions,
|
|
227
|
+
...(new Set([].concat(userComponentFileExtensions))),
|
|
228
|
+
],
|
|
229
|
+
}
|
|
230
|
+
},
|
|
231
|
+
config
|
|
232
|
+
))
|
|
214
233
|
|
|
215
234
|
/**
|
|
216
235
|
* Generate plaintext
|
package/src/posthtml/index.js
CHANGED
|
@@ -82,6 +82,24 @@ export async function process(html = '', config = {}) {
|
|
|
82
82
|
)
|
|
83
83
|
)
|
|
84
84
|
|
|
85
|
+
const componentsConfig = merge(
|
|
86
|
+
{
|
|
87
|
+
expressions: merge(
|
|
88
|
+
{ locals },
|
|
89
|
+
expressionsOptions,
|
|
90
|
+
)
|
|
91
|
+
},
|
|
92
|
+
componentsUserOptions,
|
|
93
|
+
defaultComponentsConfig
|
|
94
|
+
)
|
|
95
|
+
|
|
96
|
+
// Ensure `fileExtension` is array and has no duplicates
|
|
97
|
+
componentsConfig.fileExtension = [...new Set(
|
|
98
|
+
Array.isArray(componentsConfig.fileExtension)
|
|
99
|
+
? componentsConfig.fileExtension
|
|
100
|
+
: [componentsConfig.fileExtension]
|
|
101
|
+
)]
|
|
102
|
+
|
|
85
103
|
return posthtml([
|
|
86
104
|
...get(config, 'posthtml.plugins.before', []),
|
|
87
105
|
envTags(config.env),
|
|
@@ -89,18 +107,7 @@ export async function process(html = '', config = {}) {
|
|
|
89
107
|
expandLinkTag,
|
|
90
108
|
postcssPlugin,
|
|
91
109
|
fetchPlugin,
|
|
92
|
-
components(
|
|
93
|
-
merge(
|
|
94
|
-
{
|
|
95
|
-
expressions: merge(
|
|
96
|
-
{ locals },
|
|
97
|
-
expressionsOptions,
|
|
98
|
-
)
|
|
99
|
-
},
|
|
100
|
-
componentsUserOptions,
|
|
101
|
-
defaultComponentsConfig
|
|
102
|
-
)
|
|
103
|
-
),
|
|
110
|
+
components(componentsConfig),
|
|
104
111
|
expandLinkTag,
|
|
105
112
|
postcssPlugin,
|
|
106
113
|
envTags(config.env),
|
|
@@ -162,9 +162,10 @@ export async function run(html = '', config = {}) {
|
|
|
162
162
|
*
|
|
163
163
|
* Add a base URL to relative paths.
|
|
164
164
|
*/
|
|
165
|
-
|
|
165
|
+
const baseConfig = get(config, 'baseURL', get(config, 'baseUrl'))
|
|
166
|
+
if (baseConfig) {
|
|
166
167
|
posthtmlPlugins.push(
|
|
167
|
-
baseUrl(
|
|
168
|
+
baseUrl(baseConfig)
|
|
168
169
|
)
|
|
169
170
|
}
|
|
170
171
|
|
package/types/config.d.ts
CHANGED
|
@@ -53,12 +53,17 @@ export default interface Config {
|
|
|
53
53
|
* ```
|
|
54
54
|
* export default {
|
|
55
55
|
* attributes: {
|
|
56
|
-
* remove: [
|
|
56
|
+
* remove: [
|
|
57
|
+
* {
|
|
58
|
+
* name: 'width',
|
|
59
|
+
* value: '100', // or RegExp: /\d/
|
|
60
|
+
* },
|
|
61
|
+
* ], // or as array: ['width', 'height']
|
|
57
62
|
* }
|
|
58
63
|
* }
|
|
59
64
|
* ```
|
|
60
65
|
*/
|
|
61
|
-
remove?:
|
|
66
|
+
remove?: Array<string | { name: string; value: string | RegExp }>;
|
|
62
67
|
}
|
|
63
68
|
|
|
64
69
|
/**
|