@maizzle/framework 5.2.7 → 5.3.0

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.2.7",
3
+ "version": "5.3.0",
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",
@@ -97,7 +97,7 @@
97
97
  "ws": "^8.18.0"
98
98
  },
99
99
  "devDependencies": {
100
- "@biomejs/biome": "2.2.4",
100
+ "@biomejs/biome": "2.2.6",
101
101
  "@types/js-beautify": "^1.14.3",
102
102
  "@types/markdown-it": "^14.1.2",
103
103
  "@vitest/coverage-v8": "^3.0.4",
@@ -7,21 +7,38 @@ const plugin = (env => tree => {
7
7
  return node
8
8
  }
9
9
 
10
- const tagEnv = node.tag.split(':').pop()
10
+ // Handle <env:?> tags (render only if current env matches)
11
+ if (
12
+ typeof node.tag === 'string'
13
+ && node.tag.startsWith('env:')
14
+ ) {
15
+ const tagEnv = node.tag.slice(4) // Remove 'env:' prefix
11
16
 
12
- // Tag targets current env, remove it and return its content
13
- if (node.tag === `env:${env}`) {
14
- node.tag = false
17
+ if (tagEnv === '' || tagEnv !== env) {
18
+ // No env specified or tag doesn't target current env, remove everything
19
+ node.content = []
20
+ node.tag = false
21
+ } else {
22
+ // Tag targets current env, remove tag and keep content
23
+ node.tag = false
24
+ }
15
25
  }
16
26
 
17
- // Tag doesn't target current env, remove it completely
27
+ // Handle <not-env:?> tags (render only if current env does not match)
18
28
  if (
19
29
  typeof node.tag === 'string'
20
- && node.tag.startsWith('env:')
21
- && tagEnv !== env
30
+ && node.tag.startsWith('not-env:')
22
31
  ) {
23
- node.content = []
24
- node.tag = false
32
+ const tagEnv = node.tag.slice(8) // Remove 'not-env:' prefix
33
+
34
+ if (tagEnv === '' || tagEnv === env) {
35
+ // No env specified or tag targets current env, remove everything
36
+ node.content = []
37
+ node.tag = false
38
+ } else {
39
+ // Tag doesn't target current env, remove tag and keep content
40
+ node.tag = false
41
+ }
25
42
  }
26
43
 
27
44
  return node