@maizzle/framework 5.0.0-beta.23 → 5.0.0-beta.24

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.23",
3
+ "version": "5.0.0-beta.24",
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",
@@ -48,9 +48,9 @@
48
48
  "html-emails"
49
49
  ],
50
50
  "dependencies": {
51
- "@csstools/css-calc": "^1.2.4",
51
+ "@csstools/css-calc": "^2.0.1",
52
52
  "@maizzle/cli": "next",
53
- "cheerio": "1.0.0-rc.12",
53
+ "cheerio": "^1.0.0",
54
54
  "chokidar": "^3.6.0",
55
55
  "cli-table3": "^0.6.5",
56
56
  "color-shorthand-hex-to-six-digit": "^5.0.16",
@@ -62,13 +62,13 @@
62
62
  "html-crush": "^6.0.18",
63
63
  "is-url-superb": "^6.1.0",
64
64
  "istextorbinary": "^9.5.0",
65
- "juice": "^10.0.1",
65
+ "juice": "^11.0.0",
66
66
  "lodash-es": "^4.17.21",
67
67
  "morphdom": "^2.7.4",
68
- "ora": "^8.0.1",
68
+ "ora": "^8.1.0",
69
69
  "pathe": "^1.1.2",
70
70
  "postcss": "^8.4.39",
71
- "postcss-custom-properties": "^13.3.12",
71
+ "postcss-custom-properties": "^14.0.1",
72
72
  "postcss-import": "^16.1.0",
73
73
  "postcss-safe-parser": "^7.0.0",
74
74
  "posthtml": "^0.16.6",
@@ -90,7 +90,7 @@
90
90
  "pretty": "^2.0.0",
91
91
  "string-remove-widows": "^4.0.22",
92
92
  "string-strip-html": "^13.4.8",
93
- "tailwindcss": "^3.4.7",
93
+ "tailwindcss": "^3.4.10",
94
94
  "ws": "^8.17.0"
95
95
  },
96
96
  "devDependencies": {
@@ -102,6 +102,6 @@
102
102
  "vitest": "^2.0.1"
103
103
  },
104
104
  "engines": {
105
- "node": ">=18.0.0"
105
+ "node": ">=18.20"
106
106
  }
107
107
  }
@@ -70,7 +70,9 @@ export async function render(html = '', config = {}) {
70
70
  })) ?? content
71
71
  }
72
72
 
73
- // Compile PostHTML
73
+ /**
74
+ * Compile PostHTML
75
+ */
74
76
  const compiled = await compilePostHTML(content, templateConfig)
75
77
 
76
78
  /**
@@ -86,11 +88,10 @@ export async function render(html = '', config = {}) {
86
88
  compiled.html = await templateConfig.afterRender(({
87
89
  html: compiled.html,
88
90
  matter: matterData,
89
- config: templateConfig,
91
+ config: compiled.config,
90
92
  })) ?? compiled.html
91
93
  }
92
94
 
93
- // Run Transformers
94
95
  /**
95
96
  * Run Transformers
96
97
  *
@@ -101,10 +102,9 @@ export async function render(html = '', config = {}) {
101
102
  * @returns {string} - The transformed HTML
102
103
  */
103
104
  if (templateConfig.useTransformers !== false) {
104
- compiled.html = await useTransformers(compiled.html, templateConfig).then(({ html }) => html)
105
+ compiled.html = await useTransformers(compiled.html, compiled.config).then(({ html }) => html)
105
106
  }
106
107
 
107
- // Run `afterTransformers` event
108
108
  /**
109
109
  * Run `afterTransformers` event
110
110
  *
@@ -118,12 +118,12 @@ export async function render(html = '', config = {}) {
118
118
  compiled.html = await templateConfig.afterTransformers(({
119
119
  html: compiled.html,
120
120
  matter: matterData,
121
- config: templateConfig,
121
+ config: compiled.config,
122
122
  })) ?? compiled.html
123
123
  }
124
124
 
125
125
  return {
126
- config: templateConfig,
126
+ config: compiled.config,
127
127
  html: compiled.html,
128
128
  }
129
129
  }
@@ -41,7 +41,7 @@ export async function process(html = '', config = {}) {
41
41
  const componentsUserOptions = get(config, 'components', {})
42
42
 
43
43
  const expressionsOptions = merge(
44
- get(config, 'build.expressions', get(config, 'posthtml.expressions', {})),
44
+ get(config, 'expressions', get(config, 'posthtml.expressions', {})),
45
45
  get(componentsUserOptions, 'expressions', {}),
46
46
  )
47
47
 
@@ -94,7 +94,7 @@ export async function process(html = '', config = {}) {
94
94
  ])
95
95
  .process(html, posthtmlOptions)
96
96
  .then(result => ({
97
- config,
97
+ config: merge(config, { page: config }),
98
98
  html: result.html,
99
99
  }))
100
100
  .catch(error => {
@@ -128,7 +128,7 @@ export default async (config = {}) => {
128
128
  * Initialize WebSocket server
129
129
  * Used to send messages between the server and the browser
130
130
  */
131
- initWebSockets(wss, { scrollSync: shouldScroll, hmr: useHmr })
131
+ initWebSockets(wss, { shouldScroll, useHmr })
132
132
 
133
133
  // Register routes
134
134
  templatePaths = await getUpdatedRoutes(app, config)
@@ -2,11 +2,11 @@ import juice from 'juice'
2
2
  import postcss from 'postcss'
3
3
  import get from 'lodash-es/get.js'
4
4
  import has from 'lodash-es/has.js'
5
+ import * as cheerio from 'cheerio/slim'
5
6
  import remove from 'lodash-es/remove.js'
6
7
  import { render } from 'posthtml-render'
7
8
  import { calc } from '@csstools/css-calc'
8
9
  import isEmpty from 'lodash-es/isEmpty.js'
9
- import * as cheerio from 'cheerio/lib/slim'
10
10
  import safeParser from 'postcss-safe-parser'
11
11
  import isObject from 'lodash-es/isObject.js'
12
12
  import { parser as parse } from 'posthtml-parser'
@@ -47,7 +47,12 @@ export async function inline(html = '', options = {}) {
47
47
  })
48
48
  }
49
49
 
50
- const $ = cheerio.load(html, { decodeEntities: false, _useHtmlParser2: true })
50
+ const $ = cheerio.load(html, {
51
+ xml: {
52
+ decodeEntities: false,
53
+ xmlMode: false,
54
+ }
55
+ })
51
56
 
52
57
  // Add a `data-embed` attribute to style tags that have the embed attribute
53
58
  $('style[embed]').each((i, el) => {
@@ -2,6 +2,7 @@ import pretty from 'pretty'
2
2
  import posthtml from 'posthtml'
3
3
  import { defu as merge } from 'defu'
4
4
  import { render } from 'posthtml-render'
5
+ import { parser as parse } from 'posthtml-parser'
5
6
  import posthtmlConfig from '../posthtml/defaultConfig.js'
6
7
 
7
8
  const posthtmlPlugin = (options = {}) => tree => {
@@ -14,7 +15,7 @@ const posthtmlPlugin = (options = {}) => tree => {
14
15
 
15
16
  const config = merge(options, defaultConfig)
16
17
 
17
- return pretty(render(tree), config)
18
+ return parse(pretty(render(tree), config), posthtmlConfig)
18
19
  }
19
20
 
20
21
  export default posthtmlPlugin
@@ -1,19 +1,19 @@
1
- const posthtmlPlugin = (() => tree => {
1
+ const posthtmlPlugin = () => tree => {
2
2
  const process = node => {
3
3
  // Return the original node if it doesn't have a tag
4
4
  if (!node.tag) {
5
5
  return node
6
6
  }
7
7
 
8
- // Preserve <template> tags marked as such
9
- if (node.tag === 'template' && node.attrs?.preserve) {
10
- node.attrs.preserve = false
8
+ if (node.tag === 'template') {
9
+ // Preserve <template> tags marked as such
10
+ if ('attrs' in node && 'preserve' in node.attrs) {
11
+ node.attrs.preserve = false
11
12
 
12
- return node
13
- }
13
+ return node
14
+ }
14
15
 
15
- // Replace <template> tags with their content
16
- if (node.tag === 'template') {
16
+ // Remove the <template> tag
17
17
  node.tag = false
18
18
  }
19
19
 
@@ -21,6 +21,6 @@ const posthtmlPlugin = (() => tree => {
21
21
  }
22
22
 
23
23
  return tree.walk(process)
24
- })
24
+ }
25
25
 
26
26
  export default posthtmlPlugin
package/types/build.d.ts CHANGED
@@ -1,5 +1,4 @@
1
1
  import type { SpinnerName } from 'cli-spinners';
2
- import type { PostHTMLExpressions } from 'posthtml-expressions';
3
2
 
4
3
  export default interface BuildConfig {
5
4
  /**
@@ -18,11 +17,6 @@ export default interface BuildConfig {
18
17
  */
19
18
  content?: string[];
20
19
 
21
- /**
22
- Configure [posthtml-expressions](https://github.com/posthtml/posthtml-expressions) options.
23
- */
24
- expressions?: PostHTMLExpressions;
25
-
26
20
  /**
27
21
  * Define the output path for compiled Templates, and what file extension they should use.
28
22
  *
package/types/config.d.ts CHANGED
@@ -13,9 +13,9 @@ import type { CoreBeautifyOptions } from 'js-beautify';
13
13
  import type { BaseURLConfig } from 'posthtml-base-url';
14
14
  import type URLParametersConfig from './urlParameters';
15
15
  import type { PostHTMLFetchConfig } from 'posthtml-fetch';
16
- import type { PostHTMLComponents } from 'posthtml-component';
17
-
18
16
  import type { Config as TailwindConfig } from 'tailwindcss';
17
+ import type { PostHTMLComponents } from 'posthtml-component';
18
+ import type { PostHTMLExpressions } from 'posthtml-expressions';
19
19
 
20
20
  export default interface Config {
21
21
  /**
@@ -170,6 +170,11 @@ export default interface Config {
170
170
  tailwind?: TailwindConfig;
171
171
  }
172
172
 
173
+ /**
174
+ Configure [posthtml-expressions](https://github.com/posthtml/posthtml-expressions) options.
175
+ */
176
+ expressions?: PostHTMLExpressions;
177
+
173
178
  /**
174
179
  * Configure the [`<fetch>`](https://maizzle.com/docs/tags#fetch) tag.
175
180
  */
@@ -370,11 +375,11 @@ export default interface Config {
370
375
  hmr?: boolean;
371
376
 
372
377
  /**
373
- * Enable synchronized scrolling across devices.
378
+ * Enable synchronized scrolling across browser tabs.
374
379
  *
375
380
  * @default false
376
381
  */
377
- syncScroll?: boolean;
382
+ scrollSync?: boolean;
378
383
 
379
384
  /**
380
385
  * Paths to watch for changes.