diff --git a/package-lock.json b/package-lock.json
index 242d25f8..86b639fa 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -13,7 +13,7 @@
"license": "MIT",
"dependencies": {
"@lucide/vue": "^1.16.0",
- "@maizzle/tailwindcss": "*",
+ "@maizzle/tailwindcss": "latest",
"@tailwindcss/postcss": "^4.3.0",
"@tailwindcss/vite": "^4.3.0",
"@unhead/vue": "^3.0.4",
@@ -33,11 +33,12 @@
"is-url-superb": "^6.1.0",
"jiti": "^2.6.1",
"juice": "^12.0.0",
- "maizzle": "*",
+ "maizzle": "latest",
"markdown-exit": "^1.1.0-beta.2",
"nodemailer": "^8.0.5",
"ora": "^9.3.0",
"oxfmt": "^0.53.0",
+ "pathe": "^2.0.3",
"postcss": "^8.5.6",
"postcss-calc": "^10.1.1",
"postcss-merge-longhand": "^8.0.0",
diff --git a/package.json b/package.json
index 8e2d9b94..dc25de3f 100644
--- a/package.json
+++ b/package.json
@@ -59,6 +59,7 @@
"nodemailer": "^8.0.5",
"ora": "^9.3.0",
"oxfmt": "^0.53.0",
+ "pathe": "^2.0.3",
"postcss": "^8.5.6",
"postcss-calc": "^10.1.1",
"postcss-merge-longhand": "^8.0.0",
diff --git a/src/config/index.ts b/src/config/index.ts
index dace481a..6d1e5575 100644
--- a/src/config/index.ts
+++ b/src/config/index.ts
@@ -1,5 +1,5 @@
import { existsSync } from 'node:fs'
-import { resolve } from 'node:path'
+import { resolve } from 'pathe'
import { createJiti } from 'jiti'
import { fileURLToPath } from 'node:url'
import { createDefu } from 'defu'
@@ -83,7 +83,7 @@ function normalizeConfig(
merged.content = merged.content.map(p => {
// Skip already-absolute or negated patterns
if (p.startsWith('/') || p.startsWith('!')) return p
- return resolve(root, p).replace(/\\/g, '/')
+ return resolve(root, p)
})
}
@@ -91,7 +91,7 @@ function normalizeConfig(
if (merged.static?.source) {
merged.static.source = merged.static.source.map(p => {
if (p.startsWith('/') || p.startsWith('!')) return p
- return resolve(root, p).replace(/\\/g, '/')
+ return resolve(root, p)
})
}
diff --git a/src/render/index.ts b/src/render/index.ts
index a33bfd40..9dc2e5b3 100644
--- a/src/render/index.ts
+++ b/src/render/index.ts
@@ -1,4 +1,4 @@
-import { resolve, extname } from 'node:path'
+import { resolve, extname } from 'pathe'
import { resolveConfigObject } from '../config/index.ts'
import { runTransformers } from '../transformers/index.ts'
import { createPlaintext } from '../plaintext.ts'
diff --git a/src/serve.ts b/src/serve.ts
index 64da05a7..ba31779f 100644
--- a/src/serve.ts
+++ b/src/serve.ts
@@ -582,7 +582,7 @@ async function serveStats(url: string, config: MaizzleConfig, renderer: Renderer
const { rawHtml } = await getRendered(absolutePath, config, renderer)
const html = stripForHtml(rawHtml)
- const sizeBytes = Buffer.byteLength(html, 'utf-8')
+ const sizeBytes = new TextEncoder().encode(html).length
// Count images:
tags and CSS background images
const imgTags = (html.match(/
]*>/gi) || []).length
diff --git a/src/transformers/tailwindComponent.ts b/src/transformers/tailwindComponent.ts
index 7a9a504a..ee713d26 100644
--- a/src/transformers/tailwindComponent.ts
+++ b/src/transformers/tailwindComponent.ts
@@ -1,4 +1,4 @@
-import { resolve } from 'node:path'
+import { resolve } from 'pathe'
import type { ChildNode, Element, Comment } from 'domhandler'
import { walk } from '../utils/ast/index.ts'
import { compileTailwindCss } from '../utils/compileTailwindCss.ts'
diff --git a/src/transformers/tailwindcss.ts b/src/transformers/tailwindcss.ts
index ae7967d6..2faa4b60 100644
--- a/src/transformers/tailwindcss.ts
+++ b/src/transformers/tailwindcss.ts
@@ -1,4 +1,4 @@
-import { resolve, dirname, relative } from 'node:path'
+import { resolve, dirname, relative } from 'pathe'
import type { ChildNode, Element } from 'domhandler'
import { walk } from '../utils/ast/index.ts'
import { decodeStyleEntities } from '../utils/decodeStyleEntities.ts'
diff --git a/src/utils/compileTailwindCss.ts b/src/utils/compileTailwindCss.ts
index 682bd2ba..8892f18d 100644
--- a/src/utils/compileTailwindCss.ts
+++ b/src/utils/compileTailwindCss.ts
@@ -29,12 +29,12 @@ export function createTailwindProcessor(config: MaizzleConfig) {
export function lowerCssSyntax(css: string): string {
const result = transform({
filename: 'email.css',
- code: Buffer.from(css),
+ code: new TextEncoder().encode(css),
minify: false,
targets: { ie: 4 << 5 },
})
- return result.code.toString()
+ return new TextDecoder().decode(result.code)
}
export async function optimizeTailwindCss(css: string, config: MaizzleConfig): Promise {
diff --git a/src/utils/componentSources.ts b/src/utils/componentSources.ts
index 8ed91bdb..fde3212d 100644
--- a/src/utils/componentSources.ts
+++ b/src/utils/componentSources.ts
@@ -1,4 +1,4 @@
-import { resolve, relative } from 'node:path'
+import { resolve, relative } from 'pathe'
import type { ComponentSource } from '../types/config.ts'
/**
@@ -72,7 +72,7 @@ export interface ComponentNameOptions {
export function componentNameFromPath(opts: ComponentNameOptions): string {
const { filePath, dirRoot, prefix, pathPrefix } = opts
- const rel = relative(dirRoot, filePath).replace(/\\/g, '/')
+ const rel = relative(dirRoot, filePath)
const noExt = rel.replace(/\.(vue|md)$/, '')
const segments = noExt.split('/').map(pascalCase)
const fileName = segments.pop() ?? ''
diff --git a/src/utils/watchPaths.ts b/src/utils/watchPaths.ts
index bdb968c3..83fc43a1 100644
--- a/src/utils/watchPaths.ts
+++ b/src/utils/watchPaths.ts
@@ -1,4 +1,4 @@
-import { matchesGlob, relative } from 'node:path'
+import { matchesGlob, relative } from 'pathe'
/**
* Build a predicate that tells whether an absolute file path emitted by
@@ -9,7 +9,7 @@ import { matchesGlob, relative } from 'node:path'
export function createWatchedFileMatcher(patterns: string[], cwd: string) {
const normalized = patterns.map(p => p.replace(/^\.\//, ''))
return (file: string) => {
- const rel = relative(cwd, file).replace(/\\/g, '/')
+ const rel = relative(cwd, file)
return normalized.some(p => matchesGlob(rel, p))
}
}