@mdream/vite 0.13.3 → 0.14.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/dist/index.mjs +5 -9
- package/package.json +4 -4
package/dist/index.mjs
CHANGED
|
@@ -17,7 +17,7 @@ function viteHtmlToMarkdownPlugin(userOptions = {}) {
|
|
|
17
17
|
...DEFAULT_OPTIONS,
|
|
18
18
|
...userOptions
|
|
19
19
|
};
|
|
20
|
-
const markdownCache = new Map();
|
|
20
|
+
const markdownCache = /* @__PURE__ */ new Map();
|
|
21
21
|
function log(message) {
|
|
22
22
|
if (options.verbose) console.log(`[vite-html-to-markdown] ${message}`);
|
|
23
23
|
}
|
|
@@ -103,17 +103,14 @@ function viteHtmlToMarkdownPlugin(userOptions = {}) {
|
|
|
103
103
|
function matchesPattern(fileName, patterns) {
|
|
104
104
|
return patterns.some((pattern) => {
|
|
105
105
|
const regexPattern = pattern.replace(/\./g, "\\.").replace(/\*\*/g, ".*").replace(/\*/g, "[^/]*").replace(/\?/g, ".");
|
|
106
|
-
|
|
107
|
-
return regex.test(fileName);
|
|
106
|
+
return (/* @__PURE__ */ new RegExp(`^${regexPattern}$`)).test(fileName);
|
|
108
107
|
});
|
|
109
108
|
}
|
|
110
109
|
function shouldServeMarkdown(acceptHeader, secFetchDest) {
|
|
111
110
|
if (secFetchDest === "document") return false;
|
|
112
111
|
const accept = acceptHeader || "";
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
const hasWildcard = accept.includes("*/*");
|
|
116
|
-
return hasWildcard || accept.includes("text/markdown");
|
|
112
|
+
if (accept.includes("text/html")) return false;
|
|
113
|
+
return accept.includes("*/*") || accept.includes("text/markdown");
|
|
117
114
|
}
|
|
118
115
|
function createMarkdownMiddleware(getServer, getOutDir, cacheControl) {
|
|
119
116
|
return async (req, res, next) => {
|
|
@@ -136,8 +133,7 @@ function viteHtmlToMarkdownPlugin(userOptions = {}) {
|
|
|
136
133
|
res.end(result.content);
|
|
137
134
|
log(`Served ${url} from ${result.source} (cached: ${result.cached})`);
|
|
138
135
|
} catch (error) {
|
|
139
|
-
|
|
140
|
-
log(`Error serving ${url}: ${message}`);
|
|
136
|
+
log(`Error serving ${url}: ${error instanceof Error ? error.message : String(error)}`);
|
|
141
137
|
res.statusCode = 404;
|
|
142
138
|
res.end(`HTML content not found for ${url}`);
|
|
143
139
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mdream/vite",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.14.0",
|
|
5
5
|
"description": "Vite plugin for HTML to Markdown conversion with on-demand generation",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "Harlan Wilton",
|
|
@@ -43,11 +43,11 @@
|
|
|
43
43
|
"vite": "^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0"
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
|
-
"mdream": "0.
|
|
46
|
+
"mdream": "0.14.0"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
|
-
"@types/node": "^24.
|
|
50
|
-
"vite": "^7.
|
|
49
|
+
"@types/node": "^24.10.1",
|
|
50
|
+
"vite": "^7.2.6"
|
|
51
51
|
},
|
|
52
52
|
"scripts": {
|
|
53
53
|
"build": "obuild",
|