@bhsd/common 0.9.0 → 0.9.2

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 CHANGED
@@ -1,4 +1,4 @@
1
- import type { Config } from 'wikiparser-node/base';
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: Config, mwConfig: MwConfig) => Config;
33
+ export declare const getParserConfig: (minConfig: ConfigData, mwConfig: MwConfig) => ConfigData;
34
34
  /**
35
35
  * 获取语言变体
36
36
  * @param variants 语言变体列表
package/dist/index.d.ts CHANGED
@@ -65,9 +65,10 @@ export declare const refreshStdout: (str: string) => void;
65
65
  * 缓存生成的正则表达式
66
66
  * @param f 生成正则表达式的函数
67
67
  */
68
- export declare const getRegex: (f: RegexGetter) => RegexGetter;
68
+ export declare function getRegex(f: RegexGetter): RegexGetter;
69
+ export declare function getRegex<T extends object>(f: RegexGetter<T>): RegexGetter<T>;
69
70
  /**
70
71
  * 缓存生成的正则表达式
71
72
  * @param f 生成正则表达式的函数
72
73
  */
73
- export declare const getObjRegex: <T extends object>(f: RegexGetter<T>) => RegexGetter<T>;
74
+ export declare const getObjRegex: typeof getRegex;
package/dist/index.js CHANGED
@@ -129,25 +129,17 @@ const sanitizeInlineStyle = (style) => style.replace(/[{}]/gu, (p) => p === "{"
129
129
  const refreshStdout = (str) => {
130
130
  process.stdout.write(`\x1B[K\x1B[?7l${str}\x1B[?7h\r`);
131
131
  };
132
- const getRegex = (f) => (s) => {
133
- const regexp = /* @__PURE__ */ new Map();
134
- if (regexp.has(s)) {
135
- const re2 = regexp.get(s);
136
- re2.lastIndex = 0;
137
- return re2;
138
- }
139
- const re = f(s);
140
- regexp.set(s, re);
141
- return re;
142
- };
143
- const getObjRegex = (f) => (s) => {
144
- const regexp = /* @__PURE__ */ new WeakMap();
145
- if (regexp.has(s)) {
146
- const re2 = regexp.get(s);
147
- re2.lastIndex = 0;
148
- return re2;
149
- }
150
- const re = f(s);
151
- regexp.set(s, re);
152
- return re;
153
- };
132
+ function getRegex(f) {
133
+ return (s) => {
134
+ const regexp = new (typeof s === "string" ? Map : WeakMap)();
135
+ if (regexp.has(s)) {
136
+ const re2 = regexp.get(s);
137
+ re2.lastIndex = 0;
138
+ return re2;
139
+ }
140
+ const re = f(s);
141
+ regexp.set(s, re);
142
+ return re;
143
+ };
144
+ }
145
+ const getObjRegex = getRegex;
package/dist/index.mjs CHANGED
@@ -92,28 +92,20 @@ const sanitizeInlineStyle = (style) => style.replace(/[{}]/gu, (p) => p === "{"
92
92
  const refreshStdout = (str) => {
93
93
  process.stdout.write(`\x1B[K\x1B[?7l${str}\x1B[?7h\r`);
94
94
  };
95
- const getRegex = (f) => (s) => {
96
- const regexp = /* @__PURE__ */ new Map();
97
- if (regexp.has(s)) {
98
- const re2 = regexp.get(s);
99
- re2.lastIndex = 0;
100
- return re2;
101
- }
102
- const re = f(s);
103
- regexp.set(s, re);
104
- return re;
105
- };
106
- const getObjRegex = (f) => (s) => {
107
- const regexp = /* @__PURE__ */ new WeakMap();
108
- if (regexp.has(s)) {
109
- const re2 = regexp.get(s);
110
- re2.lastIndex = 0;
111
- return re2;
112
- }
113
- const re = f(s);
114
- regexp.set(s, re);
115
- return re;
116
- };
95
+ function getRegex(f) {
96
+ return (s) => {
97
+ const regexp = new (typeof s === "string" ? Map : WeakMap)();
98
+ if (regexp.has(s)) {
99
+ const re2 = regexp.get(s);
100
+ re2.lastIndex = 0;
101
+ return re2;
102
+ }
103
+ const re = f(s);
104
+ regexp.set(s, re);
105
+ return re;
106
+ };
107
+ }
108
+ const getObjRegex = getRegex;
117
109
  export {
118
110
  CDN,
119
111
  compareVersion,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bhsd/common",
3
- "version": "0.9.0",
3
+ "version": "0.9.2",
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.23.0",
50
- "@typescript-eslint/parser": "^8.23.0",
51
- "esbuild": "^0.25.0",
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.7.3",
66
- "wikiparser-node": "^1.18.2"
65
+ "typescript": "^5.8.2",
66
+ "wikiparser-node": "^1.19.0"
67
67
  }
68
68
  }