@void/md 0.10.12 → 0.20.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/LICENSE +21 -0
- package/dist/{compile-BzB3YW8l.mjs → compile-DiIM3f5f.mjs} +4 -2
- package/dist/index.d.mts +1 -1
- package/dist/{plugin-C5hmq9E_.d.mts → plugin-DcZ5SZxg.d.mts} +2 -2
- package/dist/plugin.d.mts +1 -1
- package/dist/plugin.mjs +8 -6
- package/dist/runtime/index.d.mts +4 -5
- package/package.json +15 -19
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026-present, Cloudflare, Inc.
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -279,8 +279,10 @@ async function createCompiler(options) {
|
|
|
279
279
|
const token = tokens[tokenIndex];
|
|
280
280
|
const code = token.content;
|
|
281
281
|
let lang = token.info ? token.info.split(/\s+/g)[0] : "text";
|
|
282
|
-
if (!isSpecialLang(lang) && !highlighter.getLoadedLanguages().includes(lang))
|
|
283
|
-
|
|
282
|
+
if (!isSpecialLang(lang) && !highlighter.getLoadedLanguages().includes(lang)) {
|
|
283
|
+
if (lang in bundledLanguages) await highlighter.loadLanguage(lang);
|
|
284
|
+
else lang = "text";
|
|
285
|
+
}
|
|
284
286
|
const rawInfo = token.meta?.rawInfo ?? token.info;
|
|
285
287
|
return highlighter.codeToHtml(code, {
|
|
286
288
|
lang,
|
package/dist/index.d.mts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { FrontmatterContext, setFrontmatter, useFrontmatter } from "./runtime/index.mjs";
|
|
2
|
-
import { n as MdPage } from "./plugin-
|
|
2
|
+
import { n as MdPage } from "./plugin-DcZ5SZxg.mjs";
|
|
3
3
|
export { FrontmatterContext, type MdPage, setFrontmatter, useFrontmatter };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Plugin } from "vite";
|
|
2
|
-
|
|
3
2
|
//#region src/compile.d.ts
|
|
4
3
|
type Heading = Readonly<{
|
|
5
4
|
depth: number;
|
|
@@ -26,7 +25,8 @@ type CompileOptions = Readonly<{
|
|
|
26
25
|
type IslandImport = {
|
|
27
26
|
name: string;
|
|
28
27
|
specifier: string;
|
|
29
|
-
strategy: string;
|
|
28
|
+
strategy: string;
|
|
29
|
+
/** Root-relative island ID (set during transform when file context is available). */
|
|
30
30
|
islandId?: string;
|
|
31
31
|
};
|
|
32
32
|
type ScriptExtraction = Readonly<{
|
package/dist/plugin.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as ScriptExtraction, i as IslandImport, n as MdPage, o as CompileOptions, r as voidMarkdown, s as CompileResult, t as MarkdownOptions } from "./plugin-
|
|
1
|
+
import { a as ScriptExtraction, i as IslandImport, n as MdPage, o as CompileOptions, r as voidMarkdown, s as CompileResult, t as MarkdownOptions } from "./plugin-DcZ5SZxg.mjs";
|
|
2
2
|
export { type CompileOptions, type CompileResult, type IslandImport, MarkdownOptions, MdPage, type ScriptExtraction, voidMarkdown };
|
package/dist/plugin.mjs
CHANGED
|
@@ -480,7 +480,8 @@ function hasMdFilesWithScript(dir) {
|
|
|
480
480
|
withFileTypes: true,
|
|
481
481
|
recursive: true
|
|
482
482
|
})) if (entry.isFile() && entry.name.endsWith(".md")) {
|
|
483
|
-
const
|
|
483
|
+
const fullPath = join(entry.parentPath, entry.name);
|
|
484
|
+
const content = readFileSync(fullPath, "utf-8");
|
|
484
485
|
if (/^<script\b/m.test(content)) return true;
|
|
485
486
|
}
|
|
486
487
|
} catch {}
|
|
@@ -541,7 +542,8 @@ function voidMarkdown(options) {
|
|
|
541
542
|
},
|
|
542
543
|
config(config, env) {
|
|
543
544
|
if (env.command === "serve") return;
|
|
544
|
-
const
|
|
545
|
+
const configRoot = config.root || process.cwd();
|
|
546
|
+
const pagesDir = resolvePagesDir(configRoot);
|
|
545
547
|
if (!existsSync(pagesDir)) return;
|
|
546
548
|
if (hasMdFilesWithScript(pagesDir) && hasIslandFiles(pagesDir)) return { environments: { client: { build: { rollupOptions: { input: { "md-client": MD_CLIENT_ENTRY_ID } } } } } };
|
|
547
549
|
},
|
|
@@ -576,7 +578,7 @@ function voidMarkdown(options) {
|
|
|
576
578
|
const scriptMod = server.moduleGraph.getModuleById("\0virtual:void-md-script:" + compId);
|
|
577
579
|
if (scriptMod) server.moduleGraph.invalidateModule(scriptMod);
|
|
578
580
|
}
|
|
579
|
-
const clientMod = server.moduleGraph.getModuleById("\
|
|
581
|
+
const clientMod = server.moduleGraph.getModuleById("\0" + MD_CLIENT_ENTRY_ID);
|
|
580
582
|
if (clientMod) server.moduleGraph.invalidateModule(clientMod);
|
|
581
583
|
};
|
|
582
584
|
server.watcher.on("change", handleMdChange);
|
|
@@ -586,7 +588,7 @@ function voidMarkdown(options) {
|
|
|
586
588
|
resolveId: {
|
|
587
589
|
filter: { id: /^(@void\/md(\/pages)?|\/@void-md-(svelte|solid)\/|virtual:void-md-(script:|client))/ },
|
|
588
590
|
handler(source) {
|
|
589
|
-
if (source === MD_CLIENT_ENTRY_ID) return "\
|
|
591
|
+
if (source === MD_CLIENT_ENTRY_ID) return "\0" + MD_CLIENT_ENTRY_ID;
|
|
590
592
|
if (source.startsWith("virtual:void-md-script:")) return "\0" + source;
|
|
591
593
|
if (source === "@void/md") return "\0void-md-runtime";
|
|
592
594
|
if (source === "@void/md/pages") return "\0void-md-pages";
|
|
@@ -596,7 +598,7 @@ function voidMarkdown(options) {
|
|
|
596
598
|
load: {
|
|
597
599
|
filter: { id: /^(\0void-md|\/@void-md-(svelte|solid)\/|\0virtual:void-md-(script:|client))/ },
|
|
598
600
|
handler(id) {
|
|
599
|
-
if (id === "\
|
|
601
|
+
if (id === "\0" + MD_CLIENT_ENTRY_ID) return generateMdClientEntry(clientScripts);
|
|
600
602
|
if (id.startsWith("\0virtual:void-md-script:")) {
|
|
601
603
|
const componentId = id.slice(24);
|
|
602
604
|
const code = clientScripts.get(componentId);
|
|
@@ -652,7 +654,7 @@ export function useFrontmatter() { return useContext(FrontmatterContext) ?? {};
|
|
|
652
654
|
const absPath = resolve(dirname(_id), imp.specifier);
|
|
653
655
|
imp.islandId = normalizePath(relative(root, absPath)).replace(/\.[^.]+$/, "");
|
|
654
656
|
}
|
|
655
|
-
const { compile } = await import("./compile-
|
|
657
|
+
const { compile } = await import("./compile-DiIM3f5f.mjs");
|
|
656
658
|
const result = await compile(body, { shiki: options?.shiki });
|
|
657
659
|
if (adapter === "vue") {
|
|
658
660
|
if (islandImports.length > 0) return {
|
package/dist/runtime/index.d.mts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
//#region src/runtime/index.d.ts
|
|
2
|
-
declare function useFrontmatter(): Record<string, unknown>;
|
|
3
|
-
declare const FrontmatterContext: Record<string, unknown> | null;
|
|
4
|
-
declare function setFrontmatter(_frontmatter: Record<string, unknown>): void;
|
|
5
|
-
//#endregion
|
|
6
|
-
export { FrontmatterContext, setFrontmatter, useFrontmatter };
|
|
2
|
+
export declare function useFrontmatter(): Record<string, unknown>;
|
|
3
|
+
export declare const FrontmatterContext: Record<string, unknown> | null;
|
|
4
|
+
export declare function setFrontmatter(_frontmatter: Record<string, unknown>): void;
|
|
5
|
+
//#endregion
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@void/md",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.20.0",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/voidzero-dev/void.git",
|
|
@@ -20,10 +20,6 @@
|
|
|
20
20
|
"types": "./dist/plugin.d.mts",
|
|
21
21
|
"import": "./dist/plugin.mjs"
|
|
22
22
|
},
|
|
23
|
-
"./runtime": {
|
|
24
|
-
"types": "./dist/runtime/index.d.mts",
|
|
25
|
-
"import": "./dist/runtime/index.mjs"
|
|
26
|
-
},
|
|
27
23
|
"./pages": {
|
|
28
24
|
"types": "./pages.d.ts"
|
|
29
25
|
},
|
|
@@ -34,33 +30,33 @@
|
|
|
34
30
|
"access": "public"
|
|
35
31
|
},
|
|
36
32
|
"dependencies": {
|
|
37
|
-
"@shikijs/engine-javascript": "^4.3
|
|
38
|
-
"@shikijs/transformers": "^4.3
|
|
33
|
+
"@shikijs/engine-javascript": "^4.4.3",
|
|
34
|
+
"@shikijs/transformers": "^4.4.3",
|
|
39
35
|
"gray-matter": "^4.0.3",
|
|
40
|
-
"markdown-exit": "1.
|
|
41
|
-
"markdown-it-anchor": "^
|
|
42
|
-
"markdown-it-attrs": "^
|
|
36
|
+
"markdown-exit": "1.3.0",
|
|
37
|
+
"markdown-it-anchor": "^10.0.0",
|
|
38
|
+
"markdown-it-attrs": "^5.0.1",
|
|
43
39
|
"markdown-it-container": "^4.0.0",
|
|
44
|
-
"markdown-it-emoji": "^3.
|
|
40
|
+
"markdown-it-emoji": "^3.1.0",
|
|
45
41
|
"markdown-it-footnote": "^4.0.0",
|
|
46
42
|
"pathslash": "^0.1.0",
|
|
47
|
-
"shiki": "^4.3
|
|
43
|
+
"shiki": "^4.4.3",
|
|
48
44
|
"tinyglobby": "^0.2.17"
|
|
49
45
|
},
|
|
50
46
|
"devDependencies": {
|
|
51
|
-
"@types/node": "^26.1
|
|
52
|
-
"vite": "npm:@voidzero-dev/vite-plus-core@0.
|
|
53
|
-
"vite-plus": "
|
|
54
|
-
"
|
|
55
|
-
"
|
|
47
|
+
"@types/node": "^26.5.1",
|
|
48
|
+
"vite": "npm:@voidzero-dev/vite-plus-core@0.3.1",
|
|
49
|
+
"vite-plus": "0.3.1",
|
|
50
|
+
"void": "0.20.0",
|
|
51
|
+
"vue": "^3.5.42"
|
|
56
52
|
},
|
|
57
53
|
"peerDependencies": {
|
|
58
54
|
"vite": "^8.0.0",
|
|
59
|
-
"void": "0.
|
|
55
|
+
"void": "0.20.0"
|
|
60
56
|
},
|
|
61
57
|
"scripts": {
|
|
62
58
|
"build": "vp pack",
|
|
63
59
|
"dev": "vp pack --watch",
|
|
64
|
-
"typecheck": "
|
|
60
|
+
"typecheck": "tsc --noEmit --rootDir ../.."
|
|
65
61
|
}
|
|
66
62
|
}
|