@maizzle/framework 4.8.7 → 4.8.8
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 +6 -8
- package/src/commands/serve.js +1 -1
- package/src/generators/config.js +1 -1
- package/src/generators/output/to-disk.js +1 -1
- package/src/generators/plaintext.js +1 -1
- package/src/generators/tailwindcss.js +3 -3
- package/src/index.js +2 -2
- package/src/transformers/baseUrl.js +4 -4
- package/src/transformers/filters/defaultFilters.js +2 -1
- package/src/transformers/inlineCss.js +2 -2
- package/src/transformers/preventWidows.js +3 -1
- package/src/transformers/removeAttributes.js +2 -2
- package/src/transformers/removeInlineBackgroundColor.js +2 -1
- package/src/transformers/removeInlineSizes.js +2 -0
- package/src/transformers/removeInlinedSelectors.js +2 -2
- package/src/transformers/replaceStrings.js +2 -2
- package/src/transformers/sixHex.js +2 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@maizzle/framework",
|
|
3
|
-
"version": "4.8.
|
|
3
|
+
"version": "4.8.8",
|
|
4
4
|
"description": "Maizzle is a framework that helps you quickly build HTML emails with Tailwind CSS.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "src/index.js",
|
|
@@ -31,10 +31,9 @@
|
|
|
31
31
|
"access": "public"
|
|
32
32
|
},
|
|
33
33
|
"scripts": {
|
|
34
|
-
"
|
|
35
|
-
"pretest": "
|
|
36
|
-
"
|
|
37
|
-
"release": "np"
|
|
34
|
+
"lint": "biome lint ./src ./test",
|
|
35
|
+
"pretest": "npm run lint",
|
|
36
|
+
"test": "c8 ava"
|
|
38
37
|
},
|
|
39
38
|
"files": [
|
|
40
39
|
"src",
|
|
@@ -79,13 +78,12 @@
|
|
|
79
78
|
"tailwindcss": "^3.2.7"
|
|
80
79
|
},
|
|
81
80
|
"devDependencies": {
|
|
81
|
+
"@biomejs/biome": "^1.8.3",
|
|
82
82
|
"@types/browser-sync": "^2.29.0",
|
|
83
83
|
"@types/js-beautify": "^1.14.0",
|
|
84
84
|
"@types/markdown-it": "^14.0.0",
|
|
85
85
|
"ava": "^5.2.0",
|
|
86
|
-
"c8": "^10.0.0"
|
|
87
|
-
"np": "*",
|
|
88
|
-
"xo": "0.39.1"
|
|
86
|
+
"c8": "^10.0.0"
|
|
89
87
|
},
|
|
90
88
|
"engines": {
|
|
91
89
|
"node": ">=14.0.0"
|
package/src/commands/serve.js
CHANGED
package/src/generators/config.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const path = require('path')
|
|
2
1
|
const fs = require('fs-extra')
|
|
2
|
+
const path = require('node:path')
|
|
3
3
|
const postcss = require('postcss')
|
|
4
4
|
const tailwindcss = require('tailwindcss')
|
|
5
5
|
const postcssImport = require('postcss-import')
|
|
@@ -96,7 +96,7 @@ module.exports = {
|
|
|
96
96
|
const fileTypes = Array.isArray(configFileTypes) ? configFileTypes : configFileTypes.split('|')
|
|
97
97
|
const fileTypesPattern = fileTypes.length > 1 ? `{${fileTypes.join(',')}}` : fileTypes[0]
|
|
98
98
|
|
|
99
|
-
|
|
99
|
+
for (const template of templateObjects) {
|
|
100
100
|
const source = get(template, 'source')
|
|
101
101
|
|
|
102
102
|
if (typeof source === 'function') {
|
|
@@ -118,7 +118,7 @@ module.exports = {
|
|
|
118
118
|
else {
|
|
119
119
|
tailwindConfig.content.files.push(`${source}/**/*.${fileTypesPattern}`)
|
|
120
120
|
}
|
|
121
|
-
}
|
|
121
|
+
}
|
|
122
122
|
}
|
|
123
123
|
|
|
124
124
|
// Filter out any duplicate content paths
|
package/src/index.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
const serve = require('./commands/serve')
|
|
2
2
|
const toFile = require('./commands/build')
|
|
3
|
+
const render = require('./functions/render')
|
|
3
4
|
const transformers = require('./transformers')
|
|
4
|
-
const toString = require('./functions/render')
|
|
5
5
|
const PostCSS = require('./generators/postcss')
|
|
6
6
|
const toPlaintext = require('./functions/plaintext')
|
|
7
7
|
const TailwindCSS = require('./generators/tailwindcss')
|
|
8
8
|
|
|
9
9
|
module.exports = {
|
|
10
10
|
serve,
|
|
11
|
+
render,
|
|
11
12
|
build: toFile,
|
|
12
13
|
...transformers,
|
|
13
|
-
render: toString,
|
|
14
14
|
postcss: PostCSS,
|
|
15
15
|
plaintext: toPlaintext,
|
|
16
16
|
tailwindcss: TailwindCSS
|
|
@@ -42,7 +42,7 @@ const rewriteVMLs = (html, url) => {
|
|
|
42
42
|
const vImageMatches = html.match(/<v:image[^>]+src="?([^"\s]+)"/g)
|
|
43
43
|
|
|
44
44
|
if (vImageMatches) {
|
|
45
|
-
|
|
45
|
+
for (const match of vImageMatches) {
|
|
46
46
|
const vImage = match.match(/<v:image[^>]+src="?([^"\s]+)"/)
|
|
47
47
|
const vImageSrc = vImage[1]
|
|
48
48
|
|
|
@@ -51,14 +51,14 @@ const rewriteVMLs = (html, url) => {
|
|
|
51
51
|
const vImageReplace = vImage[0].replace(vImageSrc, vImageSrcUrl)
|
|
52
52
|
html = html.replace(vImage[0], vImageReplace)
|
|
53
53
|
}
|
|
54
|
-
}
|
|
54
|
+
}
|
|
55
55
|
}
|
|
56
56
|
|
|
57
57
|
// Handle <v:fill>
|
|
58
58
|
const vFillMatches = html.match(/<v:fill[^>]+src="?([^"\s]+)"/g)
|
|
59
59
|
|
|
60
60
|
if (vFillMatches) {
|
|
61
|
-
|
|
61
|
+
for (const match of vFillMatches) {
|
|
62
62
|
const vFill = match.match(/<v:fill[^>]+src="?([^"\s]+)"/)
|
|
63
63
|
const vFillSrc = vFill[1]
|
|
64
64
|
|
|
@@ -67,7 +67,7 @@ const rewriteVMLs = (html, url) => {
|
|
|
67
67
|
const vFillReplace = vFill[0].replace(vFillSrc, vFillSrcUrl)
|
|
68
68
|
html = html.replace(vFill[0], vFillReplace)
|
|
69
69
|
}
|
|
70
|
-
}
|
|
70
|
+
}
|
|
71
71
|
}
|
|
72
72
|
|
|
73
73
|
return html
|
|
@@ -13,13 +13,14 @@ const unescapeMap = {
|
|
|
13
13
|
'"': '"',
|
|
14
14
|
''': '\''
|
|
15
15
|
}
|
|
16
|
-
|
|
16
|
+
// biome-ignore lint: not shadowing
|
|
17
17
|
const unescape = string => string.replace(/&(amp|lt|gt|#34|#39);/g, m => unescapeMap[m])
|
|
18
18
|
|
|
19
19
|
const append = (content, attribute) => content + attribute
|
|
20
20
|
const capitalize = content => content.charAt(0).toUpperCase() + content.slice(1)
|
|
21
21
|
const ceil = content => Math.ceil(Number.parseFloat(content))
|
|
22
22
|
const divide = (content, attribute) => Number.parseFloat(content) / Number.parseFloat(attribute)
|
|
23
|
+
// biome-ignore lint: not shadowing
|
|
23
24
|
const escape = content => content.replace(/["&'<>]/g, m => escapeMap[m])
|
|
24
25
|
const escapeOnce = content => escape(unescape(content))
|
|
25
26
|
const floor = content => Math.floor(Number.parseFloat(content))
|
|
@@ -26,9 +26,9 @@ module.exports = async (html, config = {}, direct = false) => {
|
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
if (isObject(options.codeBlocks) && !isEmpty(options.codeBlocks)) {
|
|
29
|
-
Object.entries(options.codeBlocks)
|
|
29
|
+
for (const [k, v] of Object.entries(options.codeBlocks)) {
|
|
30
30
|
juice.codeBlocks[k] = v
|
|
31
|
-
}
|
|
31
|
+
}
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
html = css ?
|
|
@@ -59,7 +59,9 @@ const removeWidowsPlugin = options => tree => {
|
|
|
59
59
|
]
|
|
60
60
|
|
|
61
61
|
if (Array.isArray(removeWidowsOptions.ignore)) {
|
|
62
|
-
|
|
62
|
+
for (const pair of removeWidowsOptions.ignore) {
|
|
63
|
+
mappings.push(pair)
|
|
64
|
+
}
|
|
63
65
|
}
|
|
64
66
|
|
|
65
67
|
if (typeof removeWidowsOptions.ignore !== 'string') {
|
|
@@ -36,7 +36,7 @@ const removeAttributes = (attributes = {}, posthtmlOptions = {}) => tree => {
|
|
|
36
36
|
})
|
|
37
37
|
|
|
38
38
|
if (node.attrs) {
|
|
39
|
-
|
|
39
|
+
for (const attr of normalizedAttrs) {
|
|
40
40
|
const targetAttrValue = get(node.attrs, attr.name)
|
|
41
41
|
|
|
42
42
|
if (
|
|
@@ -46,7 +46,7 @@ const removeAttributes = (attributes = {}, posthtmlOptions = {}) => tree => {
|
|
|
46
46
|
) {
|
|
47
47
|
node.attrs[attr.name] = false
|
|
48
48
|
}
|
|
49
|
-
}
|
|
49
|
+
}
|
|
50
50
|
}
|
|
51
51
|
|
|
52
52
|
return node
|
|
@@ -41,9 +41,10 @@ const removeInlineBGColor = (options = {}) => tree => {
|
|
|
41
41
|
}
|
|
42
42
|
})
|
|
43
43
|
|
|
44
|
-
if (attrs.style
|
|
44
|
+
if (attrs.style?.['background-color']) {
|
|
45
45
|
node.attrs.bgcolor = attrs.style['background-color']
|
|
46
46
|
|
|
47
|
+
// biome-ignore lint: assigning value will output the attribute
|
|
47
48
|
delete attrs.style['background-color']
|
|
48
49
|
|
|
49
50
|
node.attrs.style = toStyleString(attrs.style)
|
|
@@ -18,6 +18,7 @@ module.exports = async (html, config = {}, direct = false) => {
|
|
|
18
18
|
|
|
19
19
|
const removeInlineSizes = (mappings = {}) => tree => {
|
|
20
20
|
const process = node => {
|
|
21
|
+
// biome-ignore lint: yes
|
|
21
22
|
Object.entries(mappings).forEach(([attribute, tags]) => {
|
|
22
23
|
tags = Object.values(tags).map(tag => tag.toLowerCase())
|
|
23
24
|
|
|
@@ -27,6 +28,7 @@ const removeInlineSizes = (mappings = {}) => tree => {
|
|
|
27
28
|
|
|
28
29
|
const attrs = parseAttrs(node.attrs)
|
|
29
30
|
|
|
31
|
+
// biome-ignore lint: yes
|
|
30
32
|
tags.forEach(() => {
|
|
31
33
|
if (get(node, 'attrs.style')) {
|
|
32
34
|
delete attrs.style[attribute]
|
|
@@ -74,11 +74,11 @@ const plugin = (options = {}) => tree => {
|
|
|
74
74
|
n.attrs = parsedAttrs.compose()
|
|
75
75
|
|
|
76
76
|
// Fix issue with .compose() automatically quoting attributes with no values
|
|
77
|
-
Object.entries(n.attrs)
|
|
77
|
+
for (const [name, value] of Object.entries(n.attrs)) {
|
|
78
78
|
if (value === '' && get(options.posthtml, 'recognizeNoValueAttribute') === true) {
|
|
79
79
|
n.attrs[name] = true
|
|
80
80
|
}
|
|
81
|
-
}
|
|
81
|
+
}
|
|
82
82
|
|
|
83
83
|
return n
|
|
84
84
|
})
|
|
@@ -4,10 +4,10 @@ module.exports = async (html, config = {}, direct = false) => {
|
|
|
4
4
|
const replacements = direct ? config : get(config, 'replaceStrings', {})
|
|
5
5
|
|
|
6
6
|
if (!isEmpty(replacements)) {
|
|
7
|
-
|
|
7
|
+
for (const [k, v] of Object.entries(replacements)) {
|
|
8
8
|
const regex = new RegExp(k, 'gi')
|
|
9
9
|
html = html.replace(regex, v)
|
|
10
|
-
}
|
|
10
|
+
}
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
return html
|
|
@@ -18,11 +18,11 @@ const sixHex = () => tree => {
|
|
|
18
18
|
|
|
19
19
|
const process = node => {
|
|
20
20
|
if (node.attrs) {
|
|
21
|
-
Object.entries(node.attrs)
|
|
21
|
+
for (const [name, value] of Object.entries(node.attrs)) {
|
|
22
22
|
if (targets.has(name) && node.attrs[name]) {
|
|
23
23
|
node.attrs[name] = conv(value)
|
|
24
24
|
}
|
|
25
|
-
}
|
|
25
|
+
}
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
return node
|