@ai-gui/plugin-highlight 0.1.0 → 0.2.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.cjs +2 -26
- package/dist/index.js +2 -4
- package/package.json +15 -5
package/dist/index.cjs
CHANGED
|
@@ -1,28 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
//#region rolldown:runtime
|
|
3
|
-
var __create = Object.create;
|
|
4
|
-
var __defProp = Object.defineProperty;
|
|
5
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
8
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
-
var __copyProps = (to, from, except, desc) => {
|
|
10
|
-
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
11
|
-
key = keys[i];
|
|
12
|
-
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
13
|
-
get: ((k) => from[k]).bind(null, key),
|
|
14
|
-
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
15
|
-
});
|
|
16
|
-
}
|
|
17
|
-
return to;
|
|
18
|
-
};
|
|
19
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
20
|
-
value: mod,
|
|
21
|
-
enumerable: true
|
|
22
|
-
}) : target, mod));
|
|
23
|
-
|
|
24
|
-
//#endregion
|
|
25
|
-
const shiki = __toESM(require("shiki"));
|
|
26
2
|
|
|
27
3
|
//#region src/index.ts
|
|
28
4
|
/** Escape a raw string for safe embedding inside `<pre><code>`. */
|
|
@@ -52,10 +28,10 @@ function highlight(opts = {}) {
|
|
|
52
28
|
];
|
|
53
29
|
const theme = opts.theme ?? themes[0];
|
|
54
30
|
let highlighterPromise = null;
|
|
55
|
-
const getHighlighter = () => highlighterPromise ??= (
|
|
31
|
+
const getHighlighter = () => highlighterPromise ??= import("shiki").then(({ createHighlighter }) => createHighlighter({
|
|
56
32
|
themes,
|
|
57
33
|
langs
|
|
58
|
-
});
|
|
34
|
+
}));
|
|
59
35
|
const render = async (node) => {
|
|
60
36
|
const code = node.content ?? "";
|
|
61
37
|
const requested = node.attrs?.lang;
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { createHighlighter } from "shiki";
|
|
2
|
-
|
|
3
1
|
//#region src/index.ts
|
|
4
2
|
/** Escape a raw string for safe embedding inside `<pre><code>`. */
|
|
5
3
|
function escapeHtml(s) {
|
|
@@ -28,10 +26,10 @@ function highlight(opts = {}) {
|
|
|
28
26
|
];
|
|
29
27
|
const theme = opts.theme ?? themes[0];
|
|
30
28
|
let highlighterPromise = null;
|
|
31
|
-
const getHighlighter = () => highlighterPromise ??= createHighlighter({
|
|
29
|
+
const getHighlighter = () => highlighterPromise ??= import("shiki").then(({ createHighlighter }) => createHighlighter({
|
|
32
30
|
themes,
|
|
33
31
|
langs
|
|
34
|
-
});
|
|
32
|
+
}));
|
|
35
33
|
const render = async (node) => {
|
|
36
34
|
const code = node.content ?? "";
|
|
37
35
|
const requested = node.attrs?.lang;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ai-gui/plugin-highlight",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Shiki code-highlighting plugin for AIGUI.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"llm",
|
|
@@ -23,14 +23,23 @@
|
|
|
23
23
|
"homepage": "https://github.com/liliang-cn/aigui#readme",
|
|
24
24
|
"bugs": "https://github.com/liliang-cn/aigui/issues",
|
|
25
25
|
"type": "module",
|
|
26
|
+
"sideEffects": false,
|
|
27
|
+
"engines": {
|
|
28
|
+
"node": ">=18"
|
|
29
|
+
},
|
|
26
30
|
"main": "./dist/index.cjs",
|
|
27
31
|
"module": "./dist/index.js",
|
|
28
32
|
"types": "./dist/index.d.ts",
|
|
29
33
|
"exports": {
|
|
30
34
|
".": {
|
|
31
|
-
"
|
|
32
|
-
|
|
33
|
-
|
|
35
|
+
"import": {
|
|
36
|
+
"types": "./dist/index.d.ts",
|
|
37
|
+
"default": "./dist/index.js"
|
|
38
|
+
},
|
|
39
|
+
"require": {
|
|
40
|
+
"types": "./dist/index.d.cts",
|
|
41
|
+
"default": "./dist/index.cjs"
|
|
42
|
+
}
|
|
34
43
|
}
|
|
35
44
|
},
|
|
36
45
|
"files": [
|
|
@@ -43,10 +52,11 @@
|
|
|
43
52
|
},
|
|
44
53
|
"dependencies": {
|
|
45
54
|
"shiki": "^1.22.0",
|
|
46
|
-
"@ai-gui/core": "0.
|
|
55
|
+
"@ai-gui/core": "0.2.0"
|
|
47
56
|
},
|
|
48
57
|
"scripts": {
|
|
49
58
|
"build": "tsdown",
|
|
59
|
+
"test": "pnpm --dir ../.. exec vitest run --project plugin-highlight",
|
|
50
60
|
"typecheck": "tsc --noEmit"
|
|
51
61
|
}
|
|
52
62
|
}
|