c063 1.4.5 → 1.4.6
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.d.ts +2 -2
- package/dist/index.js +2 -2
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.js +1 -0
- package/dist/utils/parser.d.ts +2 -1
- package/dist/utils/parser.js +1 -2
- package/package.json +1 -1
- package/src/index.ts +4 -4
- package/src/utils/index.tsx +3 -0
- package/src/utils/parser.tsx +1 -2
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
package/dist/utils/index.d.ts
CHANGED
|
@@ -29,3 +29,4 @@ declare const c063: Record<CodeTokenType, CodeTokenBuilder>;
|
|
|
29
29
|
export declare const whiteSpace: (count?: number) => CodeTokenProps<"span">;
|
|
30
30
|
export declare const extractTokenContent: <T extends React.ElementType>(token: CodeTokenProps<T>) => string;
|
|
31
31
|
export default c063;
|
|
32
|
+
export * from "./parser";
|
package/dist/utils/index.js
CHANGED
package/dist/utils/parser.d.ts
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import { ParsableLanguage } from "../types/index";
|
|
2
|
+
export declare const isParsableLanguage: (lang: string) => lang is ParsableLanguage;
|
package/dist/utils/parser.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { parsableLanguages } from "../libs";
|
|
2
|
-
const isParsableLanguage = (lang) => {
|
|
2
|
+
export const isParsableLanguage = (lang) => {
|
|
3
3
|
return parsableLanguages.includes(lang);
|
|
4
4
|
};
|
|
5
5
|
const regexMap = {
|
|
@@ -25,7 +25,6 @@ const regexMap = {
|
|
|
25
25
|
{ type: "default", regex: /^[:;,.?]/ },
|
|
26
26
|
],
|
|
27
27
|
};
|
|
28
|
-
const bracketLevels = { "(": 1, "{": 1, "[": 1, ")": -1, "}": -1, "]": -1 };
|
|
29
28
|
// 解析單行 CodeTokenProps
|
|
30
29
|
const _parseTokenLine = (line, lang) => {
|
|
31
30
|
if (!isParsableLanguage(lang))
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/package.json",
|
|
3
3
|
"name": "c063",
|
|
4
|
-
"version": "1.4.
|
|
4
|
+
"version": "1.4.6",
|
|
5
5
|
"description": "A React component for displaying code snippets with syntax highlighting.",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"types": "dist/index.d.ts",
|
package/src/index.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import c063 from "./utils";
|
|
2
|
+
|
|
1
3
|
export * from "./types";
|
|
2
4
|
export * from "./components";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
export default c063;
|
|
6
|
-
export { whiteSpace, extractTokenContent };
|
|
5
|
+
export * from "./utils";
|
|
6
|
+
export default c063
|
package/src/utils/index.tsx
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { CodeTokenBuilder, CodeTokenProps, CodeTokenType } from "../types";
|
|
3
|
+
|
|
4
|
+
|
|
3
5
|
/**
|
|
4
6
|
* 語法 token 的建構器集合,每個 key 對應一種語法類型(如 `keyword-blue`, `string`, `comment` 等),
|
|
5
7
|
* 透過 Proxy 生成對應的 `CodeTokenBuilder`。
|
|
@@ -63,3 +65,4 @@ export const extractTokenContent = <T extends React.ElementType>(
|
|
|
63
65
|
};
|
|
64
66
|
|
|
65
67
|
export default c063;
|
|
68
|
+
export * from "./parser"
|
package/src/utils/parser.tsx
CHANGED
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
ParsableLanguage,
|
|
6
6
|
} from "../types/index";
|
|
7
7
|
|
|
8
|
-
const isParsableLanguage = (lang: string): lang is ParsableLanguage => {
|
|
8
|
+
export const isParsableLanguage = (lang: string): lang is ParsableLanguage => {
|
|
9
9
|
return parsableLanguages.includes(lang as ParsableLanguage);
|
|
10
10
|
};
|
|
11
11
|
|
|
@@ -37,7 +37,6 @@ const regexMap: Record<
|
|
|
37
37
|
{ type: "default", regex: /^[:;,.?]/ },
|
|
38
38
|
],
|
|
39
39
|
};
|
|
40
|
-
const bracketLevels = { "(": 1, "{": 1, "[": 1, ")": -1, "}": -1, "]": -1 };
|
|
41
40
|
// 解析單行 CodeTokenProps
|
|
42
41
|
const _parseTokenLine = (
|
|
43
42
|
line: string,
|