@bhsd/common 0.9.1 → 0.9.3
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/cm.d.ts +2 -2
- package/dist/index.js +3 -3
- package/dist/index.mjs +3 -3
- package/eslintrc.cjs +1 -0
- package/package.json +6 -6
package/dist/cm.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ConfigData } from 'wikiparser-node/dist/base';
|
|
2
2
|
export interface MwConfig {
|
|
3
3
|
readonly tags: Record<string, true>;
|
|
4
4
|
tagModes: Record<string, string>;
|
|
@@ -30,7 +30,7 @@ export declare const getConfig: (magicWords: MagicWord[], rule: MagicRule, flip?
|
|
|
30
30
|
* @param minConfig 基础Config
|
|
31
31
|
* @param mwConfig MwConfig
|
|
32
32
|
*/
|
|
33
|
-
export declare const getParserConfig: (minConfig:
|
|
33
|
+
export declare const getParserConfig: (minConfig: ConfigData, mwConfig: MwConfig) => ConfigData;
|
|
34
34
|
/**
|
|
35
35
|
* 获取语言变体
|
|
36
36
|
* @param variants 语言变体列表
|
package/dist/index.js
CHANGED
|
@@ -48,10 +48,10 @@ const normalizeTitle = (title) => {
|
|
|
48
48
|
};
|
|
49
49
|
const numToHex = (d) => Math.round(d * 255).toString(16).padStart(2, "0");
|
|
50
50
|
const regex = /* @__PURE__ */ (() => {
|
|
51
|
-
const hexColor = String.raw`#(?:[\da-f]{3,4}|(?:[\da-f]{2}){3,4})(?![\p{L}\
|
|
51
|
+
const hexColor = String.raw`#(?:[\da-f]{3,4}|(?:[\da-f]{2}){3,4})(?![\p{L}\p{N}_])`, rgbValue = String.raw`(?:\d*\.)?\d+%?`, hue = String.raw`(?:\d*\.)?\d+(?:deg|grad|rad|turn)?`, rgbColor = String.raw`rgba?\(\s*(?:${String.raw`${new Array(3).fill(rgbValue).join(String.raw`\s+`)}(?:\s*\/\s*${rgbValue})?`}|${String.raw`${new Array(3).fill(rgbValue).join(String.raw`\s*,\s*`)}(?:\s*,\s*${rgbValue})?`})\s*\)`, hslColor = String.raw`hsla?\(\s*(?:${String.raw`${hue}\s+${rgbValue}\s+${rgbValue}(?:\s*\/\s*${rgbValue})?`}|${String.raw`${hue}${String.raw`\s*,\s*(?:\d*\.)?\d+%`.repeat(2)}(?:\s*,\s*${rgbValue})?`})\s*\)`;
|
|
52
52
|
return {
|
|
53
|
-
full: new RegExp(String.raw`(^|[^\p{L}\
|
|
54
|
-
rgb: new RegExp(String.raw`(^|[^\p{L}\
|
|
53
|
+
full: new RegExp(String.raw`(^|[^\p{L}\p{N}_])(${hexColor}|${rgbColor}|${hslColor})`, "giu"),
|
|
54
|
+
rgb: new RegExp(String.raw`(^|[^\p{L}\p{N}_])(${hexColor}|${rgbColor})`, "giu")
|
|
55
55
|
};
|
|
56
56
|
})();
|
|
57
57
|
const splitColors = (str, hsl = true) => {
|
package/dist/index.mjs
CHANGED
|
@@ -11,10 +11,10 @@ const normalizeTitle = (title) => {
|
|
|
11
11
|
};
|
|
12
12
|
const numToHex = (d) => Math.round(d * 255).toString(16).padStart(2, "0");
|
|
13
13
|
const regex = /* @__PURE__ */ (() => {
|
|
14
|
-
const hexColor = String.raw`#(?:[\da-f]{3,4}|(?:[\da-f]{2}){3,4})(?![\p{L}\
|
|
14
|
+
const hexColor = String.raw`#(?:[\da-f]{3,4}|(?:[\da-f]{2}){3,4})(?![\p{L}\p{N}_])`, rgbValue = String.raw`(?:\d*\.)?\d+%?`, hue = String.raw`(?:\d*\.)?\d+(?:deg|grad|rad|turn)?`, rgbColor = String.raw`rgba?\(\s*(?:${String.raw`${new Array(3).fill(rgbValue).join(String.raw`\s+`)}(?:\s*\/\s*${rgbValue})?`}|${String.raw`${new Array(3).fill(rgbValue).join(String.raw`\s*,\s*`)}(?:\s*,\s*${rgbValue})?`})\s*\)`, hslColor = String.raw`hsla?\(\s*(?:${String.raw`${hue}\s+${rgbValue}\s+${rgbValue}(?:\s*\/\s*${rgbValue})?`}|${String.raw`${hue}${String.raw`\s*,\s*(?:\d*\.)?\d+%`.repeat(2)}(?:\s*,\s*${rgbValue})?`})\s*\)`;
|
|
15
15
|
return {
|
|
16
|
-
full: new RegExp(String.raw`(^|[^\p{L}\
|
|
17
|
-
rgb: new RegExp(String.raw`(^|[^\p{L}\
|
|
16
|
+
full: new RegExp(String.raw`(^|[^\p{L}\p{N}_])(${hexColor}|${rgbColor}|${hslColor})`, "giu"),
|
|
17
|
+
rgb: new RegExp(String.raw`(^|[^\p{L}\p{N}_])(${hexColor}|${rgbColor})`, "giu")
|
|
18
18
|
};
|
|
19
19
|
})();
|
|
20
20
|
const splitColors = (str, hsl = true) => {
|
package/eslintrc.cjs
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bhsd/common",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.3",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"author": "Bhsd",
|
|
6
6
|
"files": [
|
|
@@ -46,9 +46,9 @@
|
|
|
46
46
|
"@stylistic/stylelint-plugin": "^3.1.2",
|
|
47
47
|
"@types/mocha": "^10.0.10",
|
|
48
48
|
"@types/node": "^22.13.1",
|
|
49
|
-
"@typescript-eslint/eslint-plugin": "^8.
|
|
50
|
-
"@typescript-eslint/parser": "^8.
|
|
51
|
-
"esbuild": "^0.25.
|
|
49
|
+
"@typescript-eslint/eslint-plugin": "^8.29.0",
|
|
50
|
+
"@typescript-eslint/parser": "^8.29.0",
|
|
51
|
+
"esbuild": "^0.25.2",
|
|
52
52
|
"eslint": "^8.57.1",
|
|
53
53
|
"eslint-plugin-es-x": "^8.4.1",
|
|
54
54
|
"eslint-plugin-eslint-comments": "^3.2.0",
|
|
@@ -62,7 +62,7 @@
|
|
|
62
62
|
"http-server": "^14.1.1",
|
|
63
63
|
"mocha": "^11.1.0",
|
|
64
64
|
"stylelint": "^16.14.1",
|
|
65
|
-
"typescript": "^5.
|
|
66
|
-
"wikiparser-node": "^1.
|
|
65
|
+
"typescript": "^5.8.2",
|
|
66
|
+
"wikiparser-node": "^1.19.0"
|
|
67
67
|
}
|
|
68
68
|
}
|