@bhsd/common 0.8.0 → 0.8.1

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/bin/dev.cjs CHANGED
@@ -4,9 +4,11 @@
4
4
  const fs = require('fs'),
5
5
  {devDependencies, version} = require('@bhsd/common/package.json'),
6
6
  json = require(`${process.cwd()}/package.json`);
7
- const {dependencies} = json,
7
+ const {name: n, dependencies, optionalDependencies} = json,
8
+ others = {[n]: '', ...dependencies, ...optionalDependencies},
8
9
  dev = Object.fromEntries(
9
- [...Object.entries({...json.devDependencies, ...devDependencies})].sort(([a], [b]) => a.localeCompare(b)),
10
+ Object.entries({...json.devDependencies, ...devDependencies}).filter(([k]) => !(k in others))
11
+ .sort(([a], [b]) => a.localeCompare(b)),
10
12
  );
11
13
  (dependencies && '@bhsd/common' in dependencies ? dependencies : dev)['@bhsd/common'] = `^${version}`;
12
14
  json.devDependencies = dev;
package/dist/cm.d.ts CHANGED
@@ -17,6 +17,7 @@ declare interface Keywords {
17
17
  img: Record<string, string>;
18
18
  redirection: string[];
19
19
  }
20
+ export declare const otherParserFunctions: Set<string>;
20
21
  /**
21
22
  * 将魔术字信息转换为CodeMirror接受的设置
22
23
  * @param magicWords 完整魔术字列表
package/dist/cm.js CHANGED
@@ -21,9 +21,11 @@ __export(cm_exports, {
21
21
  getConfig: () => getConfig,
22
22
  getKeywords: () => getKeywords,
23
23
  getParserConfig: () => getParserConfig,
24
- getVariants: () => getVariants
24
+ getVariants: () => getVariants,
25
+ otherParserFunctions: () => otherParserFunctions
25
26
  });
26
27
  module.exports = __toCommonJS(cm_exports);
28
+ const otherParserFunctions = /* @__PURE__ */ new Set(["msg", "raw", "subst", "safesubst"]);
27
29
  const getConfig = (magicWords, rule, flip) => {
28
30
  const words = magicWords.filter(rule);
29
31
  return Object.fromEntries(
@@ -50,13 +52,13 @@ const getParserConfig = (minConfig, mwConfig) => {
50
52
  return {
51
53
  ...minConfig,
52
54
  ext: Object.keys(tags),
53
- parserFunction: [insensitive, { ...sensitive, "=": "=" }, [], []],
55
+ parserFunction: [{ ...insensitive }, { ...sensitive, "=": "=" }, [], []],
54
56
  doubleUnderscore: [
55
57
  ...behaviorSwitch.map((entries) => entries.map(([k]) => k)),
56
58
  ...behaviorSwitch.map(Object.fromEntries)
57
59
  ],
58
60
  protocol: urlProtocols.replace(/\|\\?\/\\?\/$|\\(?=[:/])/gu, ""),
59
- ...variableIDs && { variable: variableIDs }
61
+ ...variableIDs && { variable: [.../* @__PURE__ */ new Set([...variableIDs, "="])] }
60
62
  };
61
63
  };
62
64
  const getVariants = (variants) => variants?.map(({ code }) => code) ?? [];
package/dist/cm.mjs CHANGED
@@ -1,3 +1,4 @@
1
+ const otherParserFunctions = /* @__PURE__ */ new Set(["msg", "raw", "subst", "safesubst"]);
1
2
  const getConfig = (magicWords, rule, flip) => {
2
3
  const words = magicWords.filter(rule);
3
4
  return Object.fromEntries(
@@ -24,13 +25,13 @@ const getParserConfig = (minConfig, mwConfig) => {
24
25
  return {
25
26
  ...minConfig,
26
27
  ext: Object.keys(tags),
27
- parserFunction: [insensitive, { ...sensitive, "=": "=" }, [], []],
28
+ parserFunction: [{ ...insensitive }, { ...sensitive, "=": "=" }, [], []],
28
29
  doubleUnderscore: [
29
30
  ...behaviorSwitch.map((entries) => entries.map(([k]) => k)),
30
31
  ...behaviorSwitch.map(Object.fromEntries)
31
32
  ],
32
33
  protocol: urlProtocols.replace(/\|\\?\/\\?\/$|\\(?=[:/])/gu, ""),
33
- ...variableIDs && { variable: variableIDs }
34
+ ...variableIDs && { variable: [.../* @__PURE__ */ new Set([...variableIDs, "="])] }
34
35
  };
35
36
  };
36
37
  const getVariants = (variants) => variants?.map(({ code }) => code) ?? [];
@@ -47,5 +48,6 @@ export {
47
48
  getConfig,
48
49
  getKeywords,
49
50
  getParserConfig,
50
- getVariants
51
+ getVariants,
52
+ otherParserFunctions
51
53
  };
package/dist/index.js CHANGED
@@ -61,7 +61,7 @@ const splitColors = (str, hsl = true) => {
61
61
  pieces.push([str.slice(lastIndex, index), lastIndex, index, false]);
62
62
  }
63
63
  ({ lastIndex } = re);
64
- pieces.push([mt[2], index, lastIndex, str.charAt(index - 1) !== "&" || !/^#\d+$/u.test(mt[2])]);
64
+ pieces.push([mt[2], index, lastIndex, str[index - 1] !== "&" || !/^#\d+$/u.test(mt[2])]);
65
65
  mt = re.exec(str);
66
66
  }
67
67
  if (str.length > lastIndex) {
package/dist/index.mjs CHANGED
@@ -27,7 +27,7 @@ const splitColors = (str, hsl = true) => {
27
27
  pieces.push([str.slice(lastIndex, index), lastIndex, index, false]);
28
28
  }
29
29
  ({ lastIndex } = re);
30
- pieces.push([mt[2], index, lastIndex, str.charAt(index - 1) !== "&" || !/^#\d+$/u.test(mt[2])]);
30
+ pieces.push([mt[2], index, lastIndex, str[index - 1] !== "&" || !/^#\d+$/u.test(mt[2])]);
31
31
  mt = re.exec(str);
32
32
  }
33
33
  if (str.length > lastIndex) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bhsd/common",
3
- "version": "0.8.0",
3
+ "version": "0.8.1",
4
4
  "license": "MIT",
5
5
  "author": "Bhsd",
6
6
  "files": [
@@ -63,6 +63,6 @@
63
63
  "mocha": "^11.1.0",
64
64
  "stylelint": "^16.14.1",
65
65
  "typescript": "^5.7.3",
66
- "wikiparser-node": "^1.17.1"
66
+ "wikiparser-node": "^1.18.1"
67
67
  }
68
68
  }