@maizzle/framework 5.0.0-beta.17 → 5.0.0-beta.18

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@maizzle/framework",
3
- "version": "5.0.0-beta.17",
3
+ "version": "5.0.0-beta.18",
4
4
  "description": "Maizzle is a framework that helps you quickly build HTML emails with Tailwind CSS.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -60,8 +60,6 @@ export async function render(html = '', config = {}) {
60
60
  * @param {string} options.html - The HTML to be transformed
61
61
  * @param {Object} options.matter - The front matter data
62
62
  * @param {Object} options.config - The current template config
63
- * @param {function} options.posthtml - The PostHTML compiler
64
- * @param {Object} options.transform - The transformers object
65
63
  * @returns {string} - The transformed HTML, or the original one if nothing was returned
66
64
  */
67
65
  if (typeof templateConfig.beforeRender === 'function') {
@@ -69,7 +67,6 @@ export async function render(html = '', config = {}) {
69
67
  html: content,
70
68
  matter: matterData,
71
69
  config: templateConfig,
72
- posthtml: compilePostHTML,
73
70
  })) ?? content
74
71
  }
75
72
 
@@ -83,8 +80,6 @@ export async function render(html = '', config = {}) {
83
80
  * @param {string} options.html - The HTML to be transformed
84
81
  * @param {Object} options.matter - The front matter data
85
82
  * @param {Object} options.config - The current template config
86
- * @param {function} options.posthtml - The PostHTML compiler
87
- * @param {Object} options.transform - The transformers object
88
83
  * @returns {string} - The transformed HTML, or the original one if nothing was returned
89
84
  */
90
85
  if (typeof templateConfig.afterRender === 'function') {
@@ -92,7 +87,6 @@ export async function render(html = '', config = {}) {
92
87
  html: compiled.html,
93
88
  matter: matterData,
94
89
  config: templateConfig,
95
- posthtml: compilePostHTML,
96
90
  })) ?? compiled.html
97
91
  }
98
92
 
@@ -118,8 +112,6 @@ export async function render(html = '', config = {}) {
118
112
  * @param {string} options.html - The HTML to be transformed
119
113
  * @param {Object} options.matter - The front matter data
120
114
  * @param {Object} options.config - The current template config
121
- * @param {function} options.posthtml - The PostHTML compiler
122
- * @param {Object} options.transform - The transformers object
123
115
  * @returns {string} - The transformed HTML, or the original one if nothing was returned
124
116
  */
125
117
  if (typeof templateConfig.afterTransformers === 'function') {
@@ -127,7 +119,6 @@ export async function render(html = '', config = {}) {
127
119
  html: compiled.html,
128
120
  matter: matterData,
129
121
  config: templateConfig,
130
- posthtml: compilePostHTML,
131
122
  })) ?? compiled.html
132
123
  }
133
124
 
@@ -178,21 +178,6 @@ export async function run(html = '', config = {}) {
178
178
  posthtmlPlugins.push(
179
179
  baseUrl(get(config, 'baseURL', get(config, 'baseUrl', {})))
180
180
  )
181
- } else {
182
- /**
183
- * Set baseURL to `build.static.destination` if it's not already set.
184
- */
185
- const destination = get(config, 'build.static.destination', '')
186
- if (destination && !config._dev) {
187
- posthtmlPlugins.push(
188
- baseUrl({
189
- url: destination,
190
- allTags: true,
191
- styleTag: true,
192
- inlineCss: true,
193
- })
194
- )
195
- }
196
181
  }
197
182
 
198
183
  /**
@@ -15,9 +15,11 @@ const posthtmlPlugin = (replacements = {}) => tree => {
15
15
  render(tree).replace(patterns, matched => {
16
16
  for (const [regex, replacement] of regexes) {
17
17
  if (regex.test(matched)) {
18
- return replacement
18
+ return matched.replace(regex, replacement)
19
19
  }
20
20
  }
21
+
22
+ return matched
21
23
  }),
22
24
  defaultPostHTMLConfig
23
25
  )
package/types/events.d.ts CHANGED
@@ -1,7 +1,5 @@
1
1
  import type Config from "./config";
2
2
 
3
- type PostHTMLType = (html: string, config: Config) => { html: string; config: Config };
4
-
5
3
  export default interface Events {
6
4
  /**
7
5
  * Runs after the Environment config has been computed, but before Templates are processed.
@@ -57,13 +55,6 @@ export default interface Events {
57
55
  * This is the Environment config merged with the Template's Front Matter.
58
56
  */
59
57
  config: Config;
60
- /**
61
- * A function to process an HTML string with PostHTML.
62
- *
63
- * @param {string} html The HTML string to process.
64
- * @param {Config} config The Maizzle config object.
65
- */
66
- posthtml: PostHTMLType;
67
58
  }) => string | Promise<string>;
68
59
 
69
60
  /**
@@ -98,13 +89,6 @@ export default interface Events {
98
89
  * This is the Environment config merged with the Template's Front Matter.
99
90
  */
100
91
  config: Config;
101
- /**
102
- * A function to process an HTML string with PostHTML.
103
- *
104
- * @param {string} html The HTML string to process.
105
- * @param {Config} config The Maizzle config object.
106
- */
107
- posthtml: PostHTMLType;
108
92
  }) => string | Promise<string>;
109
93
 
110
94
  /**
@@ -139,13 +123,6 @@ export default interface Events {
139
123
  * This is the Environment config merged with the Template's Front Matter.
140
124
  */
141
125
  config: Config;
142
- /**
143
- * A function to process an HTML string with PostHTML.
144
- *
145
- * @param {string} html The HTML string to process.
146
- * @param {Config} config The Maizzle config object.
147
- */
148
- posthtml: PostHTMLType;
149
126
  }) => string | Promise<string>;
150
127
 
151
128
  /**