@ox-content/unplugin 1.0.0-alpha.0 → 1.1.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/{esbuild.d.ts → esbuild.d.mts} +3 -4
- package/dist/esbuild.mjs +8 -0
- package/dist/{index.d.ts → index.d.mts} +15 -3
- package/dist/index.mjs +2 -0
- package/dist/{index2.d.ts → index2.d.mts} +1 -1
- package/dist/{rollup.d.ts → rollup.d.mts} +3 -4
- package/dist/rollup.mjs +8 -0
- package/dist/{rspack.d.ts → rspack.d.mts} +1 -2
- package/dist/rspack.mjs +8 -0
- package/dist/{src.js → src.mjs} +20 -7
- package/dist/{vite.d.ts → vite.d.mts} +3 -4
- package/dist/vite.mjs +8 -0
- package/dist/{webpack.d.ts → webpack.d.mts} +3 -4
- package/dist/webpack.mjs +8 -0
- package/package.json +46 -46
- package/dist/esbuild.js +0 -10
- package/dist/index.js +0 -3
- package/dist/rollup.js +0 -10
- package/dist/rspack.js +0 -10
- package/dist/vite.js +0 -10
- package/dist/webpack.js +0 -10
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { a as OxContentOptions, d as ResolvedOptions, f as TocEntry, p as TransformResult, t as unplugin } from "./index.
|
|
2
|
-
import * as
|
|
1
|
+
import { a as OxContentOptions, d as ResolvedOptions, f as TocEntry, p as TransformResult, t as unplugin } from "./index.mjs";
|
|
2
|
+
import * as unplugin$1 from "unplugin";
|
|
3
3
|
|
|
4
4
|
//#region src/esbuild.d.ts
|
|
5
|
-
|
|
6
|
-
declare const _default: (options?: OxContentOptions | undefined) => unplugin0.EsbuildPlugin;
|
|
5
|
+
declare const _default: (options?: OxContentOptions | undefined) => unplugin$1.EsbuildPlugin;
|
|
7
6
|
//#endregion
|
|
8
7
|
export { type OxContentOptions, type ResolvedOptions, type TocEntry, type TransformResult, _default as default, unplugin };
|
package/dist/esbuild.mjs
ADDED
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
import * as unplugin2 from "unplugin";
|
|
2
1
|
import MarkdownIt from "markdown-it";
|
|
3
2
|
|
|
4
3
|
//#region src/types.d.ts
|
|
5
|
-
|
|
6
4
|
/**
|
|
7
5
|
* Markdown-it plugin function type.
|
|
8
6
|
*/
|
|
@@ -27,6 +25,13 @@ type RehypePlugin = [unknown, unknown] | unknown;
|
|
|
27
25
|
* Transforms HTML after rendering.
|
|
28
26
|
*/
|
|
29
27
|
type OxContentPlugin = (html: string) => string | Promise<string>;
|
|
28
|
+
interface CodeAnnotationsOptions {
|
|
29
|
+
metaKey?: string;
|
|
30
|
+
}
|
|
31
|
+
interface ResolvedCodeAnnotationsOptions {
|
|
32
|
+
enabled: boolean;
|
|
33
|
+
metaKey: string;
|
|
34
|
+
}
|
|
30
35
|
/**
|
|
31
36
|
* API documentation generation configuration.
|
|
32
37
|
* Similar to cargo docs for Rust.
|
|
@@ -142,6 +147,12 @@ interface OxContentOptions {
|
|
|
142
147
|
* @default 'github-dark'
|
|
143
148
|
*/
|
|
144
149
|
highlightTheme?: string;
|
|
150
|
+
/**
|
|
151
|
+
* Opt-in line annotations for fenced code blocks.
|
|
152
|
+
* Example: `annotate="highlight:1,3-4;warning:6"`
|
|
153
|
+
* @default false
|
|
154
|
+
*/
|
|
155
|
+
codeAnnotations?: boolean | CodeAnnotationsOptions;
|
|
145
156
|
/**
|
|
146
157
|
* Enable mermaid diagram rendering.
|
|
147
158
|
* @default false
|
|
@@ -212,6 +223,7 @@ interface ResolvedOptions {
|
|
|
212
223
|
strikethrough: boolean;
|
|
213
224
|
highlight: boolean;
|
|
214
225
|
highlightTheme: string;
|
|
226
|
+
codeAnnotations: ResolvedCodeAnnotationsOptions;
|
|
215
227
|
mermaid: boolean;
|
|
216
228
|
frontmatter: boolean;
|
|
217
229
|
toc: boolean;
|
|
@@ -255,6 +267,6 @@ declare function transformMarkdown(source: string, filePath: string, options: Re
|
|
|
255
267
|
/**
|
|
256
268
|
* The unplugin instance.
|
|
257
269
|
*/
|
|
258
|
-
declare const unplugin:
|
|
270
|
+
declare const unplugin: unplugin.UnpluginInstance<OxContentOptions | undefined, boolean>;
|
|
259
271
|
//#endregion
|
|
260
272
|
export { OxContentOptions as a, RehypePlugin as c, ResolvedOptions as d, TocEntry as f, MarkdownItPlugin as i, RemarkPlugin as l, transformMarkdown as n, OxContentPlugin as o, TransformResult as p, DocsConfig as r, PluginConfig as s, unplugin as t, ResolvedDocsConfig as u };
|
package/dist/index.mjs
ADDED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as OxContentOptions, c as RehypePlugin, d as ResolvedOptions, f as TocEntry, i as MarkdownItPlugin, l as RemarkPlugin, n as transformMarkdown, o as OxContentPlugin, p as TransformResult, r as DocsConfig, s as PluginConfig, t as unplugin, u as ResolvedDocsConfig } from "./index.
|
|
1
|
+
import { a as OxContentOptions, c as RehypePlugin, d as ResolvedOptions, f as TocEntry, i as MarkdownItPlugin, l as RemarkPlugin, n as transformMarkdown, o as OxContentPlugin, p as TransformResult, r as DocsConfig, s as PluginConfig, t as unplugin, u as ResolvedDocsConfig } from "./index.mjs";
|
|
2
2
|
export { DocsConfig, MarkdownItPlugin, OxContentOptions, OxContentPlugin, PluginConfig, RehypePlugin, RemarkPlugin, ResolvedDocsConfig, ResolvedOptions, TocEntry, TransformResult, unplugin as default, unplugin, transformMarkdown };
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { a as OxContentOptions, d as ResolvedOptions, f as TocEntry, p as TransformResult, t as unplugin } from "./index.
|
|
2
|
-
import * as
|
|
1
|
+
import { a as OxContentOptions, d as ResolvedOptions, f as TocEntry, p as TransformResult, t as unplugin } from "./index.mjs";
|
|
2
|
+
import * as unplugin$1 from "unplugin";
|
|
3
3
|
|
|
4
4
|
//#region src/rollup.d.ts
|
|
5
|
-
|
|
6
|
-
declare const _default: (options?: OxContentOptions | undefined) => unplugin0.RollupPlugin<any> | unplugin0.RollupPlugin<any>[];
|
|
5
|
+
declare const _default: (options?: OxContentOptions | undefined) => unplugin$1.RollupPlugin<any> | unplugin$1.RollupPlugin<any>[];
|
|
7
6
|
//#endregion
|
|
8
7
|
export { type OxContentOptions, type ResolvedOptions, type TocEntry, type TransformResult, _default as default, unplugin };
|
package/dist/rollup.mjs
ADDED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { a as OxContentOptions, d as ResolvedOptions, f as TocEntry, p as TransformResult, t as unplugin } from "./index.
|
|
1
|
+
import { a as OxContentOptions, d as ResolvedOptions, f as TocEntry, p as TransformResult, t as unplugin } from "./index.mjs";
|
|
2
2
|
|
|
3
3
|
//#region src/rspack.d.ts
|
|
4
|
-
|
|
5
4
|
declare const _default: (options?: OxContentOptions | undefined) => RspackPluginInstance;
|
|
6
5
|
//#endregion
|
|
7
6
|
export { type OxContentOptions, type ResolvedOptions, type TocEntry, type TransformResult, _default as default, unplugin };
|
package/dist/rspack.mjs
ADDED
package/dist/{src.js → src.mjs}
RENAMED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { createUnplugin } from "unplugin";
|
|
2
2
|
import { createFilter } from "@rollup/pluginutils";
|
|
3
|
-
|
|
4
3
|
//#region src/transform.ts
|
|
5
4
|
/**
|
|
6
5
|
* Transforms Markdown content into a JavaScript module.
|
|
@@ -14,7 +13,7 @@ async function transformMarkdown(source, filePath, options) {
|
|
|
14
13
|
try {
|
|
15
14
|
napi = await import("@ox-content/napi");
|
|
16
15
|
} catch {
|
|
17
|
-
throw new Error("[ox-content] Failed to load @ox-content/napi. Please ensure the NAPI module is built. Run:
|
|
16
|
+
throw new Error("[ox-content] Failed to load @ox-content/napi. Please ensure the NAPI module is built. Run: nix develop -c vp run build:napi");
|
|
18
17
|
}
|
|
19
18
|
const result = napi.transform(source, {
|
|
20
19
|
gfm: options.gfm,
|
|
@@ -22,7 +21,9 @@ async function transformMarkdown(source, filePath, options) {
|
|
|
22
21
|
task_lists: options.taskLists,
|
|
23
22
|
tables: options.tables,
|
|
24
23
|
strikethrough: options.strikethrough,
|
|
25
|
-
toc_max_depth: options.tocMaxDepth
|
|
24
|
+
toc_max_depth: options.tocMaxDepth,
|
|
25
|
+
code_annotations: options.codeAnnotations.enabled,
|
|
26
|
+
code_annotation_meta_key: options.codeAnnotations.metaKey
|
|
26
27
|
});
|
|
27
28
|
if (result.errors.length > 0) console.warn("[ox-content] Transform warnings:", result.errors);
|
|
28
29
|
let frontmatter;
|
|
@@ -84,7 +85,6 @@ export default {
|
|
|
84
85
|
};
|
|
85
86
|
`;
|
|
86
87
|
}
|
|
87
|
-
|
|
88
88
|
//#endregion
|
|
89
89
|
//#region src/index.ts
|
|
90
90
|
/**
|
|
@@ -169,6 +169,7 @@ function resolveOptions(options) {
|
|
|
169
169
|
strikethrough: options.strikethrough ?? true,
|
|
170
170
|
highlight: options.highlight ?? false,
|
|
171
171
|
highlightTheme: options.highlightTheme ?? "github-dark",
|
|
172
|
+
codeAnnotations: resolveCodeAnnotationsOptions(options.codeAnnotations),
|
|
172
173
|
mermaid: options.mermaid ?? false,
|
|
173
174
|
frontmatter: options.frontmatter ?? true,
|
|
174
175
|
toc: options.toc ?? true,
|
|
@@ -185,6 +186,20 @@ function resolveOptions(options) {
|
|
|
185
186
|
docs: resolveDocsConfig(options.docs)
|
|
186
187
|
};
|
|
187
188
|
}
|
|
189
|
+
function resolveCodeAnnotationsOptions(options) {
|
|
190
|
+
if (!options) return {
|
|
191
|
+
enabled: false,
|
|
192
|
+
metaKey: "annotate"
|
|
193
|
+
};
|
|
194
|
+
if (options === true) return {
|
|
195
|
+
enabled: true,
|
|
196
|
+
metaKey: "annotate"
|
|
197
|
+
};
|
|
198
|
+
return {
|
|
199
|
+
enabled: true,
|
|
200
|
+
metaKey: options.metaKey ?? "annotate"
|
|
201
|
+
};
|
|
202
|
+
}
|
|
188
203
|
/**
|
|
189
204
|
* Check if the file should be processed.
|
|
190
205
|
*/
|
|
@@ -238,7 +253,5 @@ const unpluginFactory = (rawOptions = {}) => {
|
|
|
238
253
|
* The unplugin instance.
|
|
239
254
|
*/
|
|
240
255
|
const unplugin = /* @__PURE__ */ createUnplugin(unpluginFactory);
|
|
241
|
-
var src_default = unplugin;
|
|
242
|
-
|
|
243
256
|
//#endregion
|
|
244
|
-
export {
|
|
257
|
+
export { transformMarkdown as n, unplugin as t };
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { a as OxContentOptions, d as ResolvedOptions, f as TocEntry, p as TransformResult, t as unplugin } from "./index.
|
|
2
|
-
import * as
|
|
1
|
+
import { a as OxContentOptions, d as ResolvedOptions, f as TocEntry, p as TransformResult, t as unplugin } from "./index.mjs";
|
|
2
|
+
import * as unplugin$1 from "unplugin";
|
|
3
3
|
|
|
4
4
|
//#region src/vite.d.ts
|
|
5
|
-
|
|
6
|
-
declare const _default: (options?: OxContentOptions | undefined) => unplugin3.VitePlugin<any> | unplugin3.VitePlugin<any>[];
|
|
5
|
+
declare const _default: (options?: OxContentOptions | undefined) => unplugin$1.VitePlugin<any> | unplugin$1.VitePlugin<any>[];
|
|
7
6
|
//#endregion
|
|
8
7
|
export { type OxContentOptions, type ResolvedOptions, type TocEntry, type TransformResult, _default as default, unplugin };
|
package/dist/vite.mjs
ADDED
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { a as OxContentOptions, d as ResolvedOptions, f as TocEntry, p as TransformResult, t as unplugin } from "./index.
|
|
2
|
-
import * as
|
|
1
|
+
import { a as OxContentOptions, d as ResolvedOptions, f as TocEntry, p as TransformResult, t as unplugin } from "./index.mjs";
|
|
2
|
+
import * as unplugin$1 from "unplugin";
|
|
3
3
|
|
|
4
4
|
//#region src/webpack.d.ts
|
|
5
|
-
|
|
6
|
-
declare const _default: (options?: OxContentOptions | undefined) => unplugin5.WebpackPluginInstance;
|
|
5
|
+
declare const _default: (options?: OxContentOptions | undefined) => unplugin$1.WebpackPluginInstance;
|
|
7
6
|
//#endregion
|
|
8
7
|
export { type OxContentOptions, type ResolvedOptions, type TocEntry, type TransformResult, _default as default, unplugin };
|
package/dist/webpack.mjs
ADDED
package/package.json
CHANGED
|
@@ -1,39 +1,59 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ox-content/unplugin",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "Universal plugin for Ox Content - Markdown processing for webpack, rollup, esbuild, vite, and more",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"esbuild",
|
|
7
|
+
"markdown",
|
|
8
|
+
"ox-content",
|
|
9
|
+
"rollup",
|
|
10
|
+
"unplugin",
|
|
11
|
+
"vite",
|
|
12
|
+
"webpack"
|
|
13
|
+
],
|
|
14
|
+
"license": "MIT",
|
|
15
|
+
"author": "ubugeeei",
|
|
16
|
+
"repository": {
|
|
17
|
+
"type": "git",
|
|
18
|
+
"url": "https://github.com/ubugeeei/ox-content.git",
|
|
19
|
+
"directory": "npm/unplugin-ox-content"
|
|
20
|
+
},
|
|
21
|
+
"files": [
|
|
22
|
+
"dist"
|
|
23
|
+
],
|
|
5
24
|
"type": "module",
|
|
6
|
-
"main": "./dist/index.
|
|
7
|
-
"types": "./dist/
|
|
25
|
+
"main": "./dist/index.mjs",
|
|
26
|
+
"types": "./dist/index2.d.mts",
|
|
8
27
|
"exports": {
|
|
9
28
|
".": {
|
|
10
|
-
"import": "./dist/index.
|
|
11
|
-
"types": "./dist/
|
|
29
|
+
"import": "./dist/index.mjs",
|
|
30
|
+
"types": "./dist/index2.d.mts"
|
|
12
31
|
},
|
|
13
32
|
"./vite": {
|
|
14
|
-
"import": "./dist/vite.
|
|
15
|
-
"types": "./dist/vite.d.
|
|
33
|
+
"import": "./dist/vite.mjs",
|
|
34
|
+
"types": "./dist/vite.d.mts"
|
|
16
35
|
},
|
|
17
36
|
"./webpack": {
|
|
18
|
-
"import": "./dist/webpack.
|
|
19
|
-
"types": "./dist/webpack.d.
|
|
37
|
+
"import": "./dist/webpack.mjs",
|
|
38
|
+
"types": "./dist/webpack.d.mts"
|
|
20
39
|
},
|
|
21
40
|
"./rollup": {
|
|
22
|
-
"import": "./dist/rollup.
|
|
23
|
-
"types": "./dist/rollup.d.
|
|
41
|
+
"import": "./dist/rollup.mjs",
|
|
42
|
+
"types": "./dist/rollup.d.mts"
|
|
24
43
|
},
|
|
25
44
|
"./esbuild": {
|
|
26
|
-
"import": "./dist/esbuild.
|
|
27
|
-
"types": "./dist/esbuild.d.
|
|
45
|
+
"import": "./dist/esbuild.mjs",
|
|
46
|
+
"types": "./dist/esbuild.d.mts"
|
|
28
47
|
},
|
|
29
48
|
"./rspack": {
|
|
30
|
-
"import": "./dist/rspack.
|
|
31
|
-
"types": "./dist/rspack.d.
|
|
49
|
+
"import": "./dist/rspack.mjs",
|
|
50
|
+
"types": "./dist/rspack.d.mts"
|
|
32
51
|
}
|
|
33
52
|
},
|
|
34
|
-
"
|
|
35
|
-
"
|
|
36
|
-
|
|
53
|
+
"publishConfig": {
|
|
54
|
+
"access": "public",
|
|
55
|
+
"provenance": true
|
|
56
|
+
},
|
|
37
57
|
"dependencies": {
|
|
38
58
|
"@rollup/pluginutils": "^5.1.4",
|
|
39
59
|
"gray-matter": "^4.0.3",
|
|
@@ -44,42 +64,22 @@
|
|
|
44
64
|
"remark-rehype": "^11.1.1",
|
|
45
65
|
"unified": "^11.0.5",
|
|
46
66
|
"unplugin": "^2.1.2",
|
|
47
|
-
"@ox-content/napi": "1.
|
|
67
|
+
"@ox-content/napi": "1.1.0"
|
|
48
68
|
},
|
|
49
69
|
"devDependencies": {
|
|
50
70
|
"@types/markdown-it": "^14.1.2",
|
|
51
71
|
"@types/node": "^22.0.0",
|
|
52
|
-
"tsdown": "^0.12.0",
|
|
53
72
|
"@typescript/native-preview": "^7.0.0-dev.20250601",
|
|
54
|
-
"
|
|
55
|
-
"vite": "^8.0.0",
|
|
56
|
-
"webpack": "^5.97.1",
|
|
73
|
+
"esbuild": "^0.27.4",
|
|
57
74
|
"rollup": "^4.29.1",
|
|
58
|
-
"
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
"
|
|
62
|
-
"vite",
|
|
63
|
-
"webpack",
|
|
64
|
-
"rollup",
|
|
65
|
-
"esbuild",
|
|
66
|
-
"markdown",
|
|
67
|
-
"ox-content"
|
|
68
|
-
],
|
|
69
|
-
"license": "MIT",
|
|
70
|
-
"author": "ubugeeei",
|
|
71
|
-
"repository": {
|
|
72
|
-
"type": "git",
|
|
73
|
-
"url": "https://github.com/ubugeeei/ox-content.git",
|
|
74
|
-
"directory": "npm/unplugin-ox-content"
|
|
75
|
-
},
|
|
76
|
-
"publishConfig": {
|
|
77
|
-
"provenance": true,
|
|
78
|
-
"access": "public"
|
|
75
|
+
"typescript": "^5.7.0",
|
|
76
|
+
"vite": "npm:@voidzero-dev/vite-plus-core@0.1.11",
|
|
77
|
+
"vite-plus": "0.1.11",
|
|
78
|
+
"webpack": "^5.97.1"
|
|
79
79
|
},
|
|
80
80
|
"scripts": {
|
|
81
|
-
"build": "
|
|
82
|
-
"dev": "
|
|
81
|
+
"build": "vp pack",
|
|
82
|
+
"dev": "vp pack --watch",
|
|
83
83
|
"typecheck": "tsgo --noEmit"
|
|
84
84
|
}
|
|
85
85
|
}
|
package/dist/esbuild.js
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { t as src_default } from "./src.js";
|
|
2
|
-
|
|
3
|
-
//#region src/esbuild.ts
|
|
4
|
-
/**
|
|
5
|
-
* esbuild plugin export for @ox-content/unplugin
|
|
6
|
-
*/
|
|
7
|
-
var esbuild_default = src_default.esbuild;
|
|
8
|
-
|
|
9
|
-
//#endregion
|
|
10
|
-
export { esbuild_default as default, src_default as unplugin };
|
package/dist/index.js
DELETED
package/dist/rollup.js
DELETED
package/dist/rspack.js
DELETED
package/dist/vite.js
DELETED
package/dist/webpack.js
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { t as src_default } from "./src.js";
|
|
2
|
-
|
|
3
|
-
//#region src/webpack.ts
|
|
4
|
-
/**
|
|
5
|
-
* Webpack plugin export for @ox-content/unplugin
|
|
6
|
-
*/
|
|
7
|
-
var webpack_default = src_default.webpack;
|
|
8
|
-
|
|
9
|
-
//#endregion
|
|
10
|
-
export { webpack_default as default, src_default as unplugin };
|