@bhsd/common 0.9.3 → 0.9.5

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
@@ -6,6 +6,8 @@ export interface MwConfig {
6
6
  functionSynonyms: [Record<string, string>, Record<string, string>];
7
7
  doubleUnderscore: [Record<string, unknown>, Record<string, unknown>];
8
8
  variableIDs?: string[];
9
+ functionHooks?: string[];
10
+ redirection?: string[];
9
11
  }
10
12
  export interface MagicWord {
11
13
  name: string;
package/dist/cm.js CHANGED
@@ -36,7 +36,15 @@ const getConfig = (magicWords, rule, flip) => {
36
36
  );
37
37
  };
38
38
  const getParserConfig = (minConfig, mwConfig) => {
39
- const { tags, doubleUnderscore, urlProtocols, functionSynonyms, variableIDs } = mwConfig, [insensitive, sensitive] = functionSynonyms, behaviorSwitch = doubleUnderscore.map(
39
+ const {
40
+ tags,
41
+ doubleUnderscore,
42
+ urlProtocols,
43
+ functionSynonyms,
44
+ variableIDs,
45
+ functionHooks,
46
+ redirection
47
+ } = mwConfig, [insensitive, sensitive] = functionSynonyms, behaviorSwitch = doubleUnderscore.map(
40
48
  (obj, i) => Object.entries(obj).map(([k, v]) => [
41
49
  k.slice(2, -2),
42
50
  i && typeof v === "string" ? v.toUpperCase() : v
@@ -58,7 +66,9 @@ const getParserConfig = (minConfig, mwConfig) => {
58
66
  ...behaviorSwitch.map(Object.fromEntries)
59
67
  ],
60
68
  protocol: urlProtocols.replace(/\|\\?\/\\?\/$|\\(?=[:/])/gu, ""),
61
- ...variableIDs && { variable: [.../* @__PURE__ */ new Set([...variableIDs, "="])] }
69
+ ...variableIDs && { variable: [.../* @__PURE__ */ new Set([...variableIDs, "="])] },
70
+ ...functionHooks && { functionHook: [.../* @__PURE__ */ new Set([...functionHooks.map((s) => s.toLowerCase()), "msgnw"])] },
71
+ ...redirection && { redirection: redirection.map((s) => s.toLowerCase()) }
62
72
  };
63
73
  };
64
74
  const getVariants = (variants) => variants?.map(({ code }) => code) ?? [];
package/dist/cm.mjs CHANGED
@@ -9,7 +9,15 @@ const getConfig = (magicWords, rule, flip) => {
9
9
  );
10
10
  };
11
11
  const getParserConfig = (minConfig, mwConfig) => {
12
- const { tags, doubleUnderscore, urlProtocols, functionSynonyms, variableIDs } = mwConfig, [insensitive, sensitive] = functionSynonyms, behaviorSwitch = doubleUnderscore.map(
12
+ const {
13
+ tags,
14
+ doubleUnderscore,
15
+ urlProtocols,
16
+ functionSynonyms,
17
+ variableIDs,
18
+ functionHooks,
19
+ redirection
20
+ } = mwConfig, [insensitive, sensitive] = functionSynonyms, behaviorSwitch = doubleUnderscore.map(
13
21
  (obj, i) => Object.entries(obj).map(([k, v]) => [
14
22
  k.slice(2, -2),
15
23
  i && typeof v === "string" ? v.toUpperCase() : v
@@ -31,7 +39,9 @@ const getParserConfig = (minConfig, mwConfig) => {
31
39
  ...behaviorSwitch.map(Object.fromEntries)
32
40
  ],
33
41
  protocol: urlProtocols.replace(/\|\\?\/\\?\/$|\\(?=[:/])/gu, ""),
34
- ...variableIDs && { variable: [.../* @__PURE__ */ new Set([...variableIDs, "="])] }
42
+ ...variableIDs && { variable: [.../* @__PURE__ */ new Set([...variableIDs, "="])] },
43
+ ...functionHooks && { functionHook: [.../* @__PURE__ */ new Set([...functionHooks.map((s) => s.toLowerCase()), "msgnw"])] },
44
+ ...redirection && { redirection: redirection.map((s) => s.toLowerCase()) }
35
45
  };
36
46
  };
37
47
  const getVariants = (variants) => variants?.map(({ code }) => code) ?? [];
package/dist/index.js CHANGED
@@ -78,7 +78,7 @@ const loadScript = (src, globalConst, amd) => {
78
78
  return loading.get(src);
79
79
  }
80
80
  const promise = new Promise((resolve) => {
81
- const path = `${CDN}/${src}`;
81
+ const path = /^https?:\/\//iu.test(src) ? src : `${CDN}/${src}`;
82
82
  let obj = globalThis;
83
83
  for (const prop of globalConst.split(".")) {
84
84
  obj = obj?.[prop];
package/dist/index.mjs CHANGED
@@ -41,7 +41,7 @@ const loadScript = (src, globalConst, amd) => {
41
41
  return loading.get(src);
42
42
  }
43
43
  const promise = new Promise((resolve) => {
44
- const path = `${CDN}/${src}`;
44
+ const path = /^https?:\/\//iu.test(src) ? src : `${CDN}/${src}`;
45
45
  let obj = globalThis;
46
46
  for (const prop of globalConst.split(".")) {
47
47
  obj = obj?.[prop];
package/dist/stylelint.js CHANGED
@@ -26,5 +26,6 @@ const styleLint = async (stylelint, code, additionalRules) => {
26
26
  const config = {
27
27
  rules: { ...import_stylelint_config_recommended.rules, ...additionalRules }
28
28
  };
29
+ delete config.rules["selector-type-no-unknown"];
29
30
  return (await stylelint.lint({ code, config })).results.flatMap(({ warnings }) => warnings).filter(({ text }) => !text.startsWith("Unknown rule "));
30
31
  };
@@ -3,6 +3,7 @@ const styleLint = async (stylelint, code, additionalRules) => {
3
3
  const config = {
4
4
  rules: { ...rules, ...additionalRules }
5
5
  };
6
+ delete config.rules["selector-type-no-unknown"];
6
7
  return (await stylelint.lint({ code, config })).results.flatMap(({ warnings }) => warnings).filter(({ text }) => !text.startsWith("Unknown rule "));
7
8
  };
8
9
  export {
package/eslintrc.dist.cjs CHANGED
@@ -7,16 +7,13 @@ module.exports = {
7
7
  es2024: true,
8
8
  },
9
9
  plugins: ['es-x'],
10
- extends: ['plugin:es-x/restrict-to-es2019'],
10
+ extends: ['plugin:es-x/restrict-to-es2020'],
11
11
  parserOptions: {
12
12
  ecmaVersion: 'latest',
13
13
  },
14
14
  rules: {
15
- 'es-x/no-global-this': 0,
16
- 'es-x/no-import-meta': 0,
17
- 'es-x/no-promise-all-settled': 0,
18
15
  'es-x/no-regexp-lookbehind-assertions': 2,
19
- 'es-x/no-string-prototype-matchall': 0,
16
+ 'es-x/no-regexp-unicode-property-escapes-2020': 2,
20
17
  },
21
18
  settings: {
22
19
  'es-x': {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bhsd/common",
3
- "version": "0.9.3",
3
+ "version": "0.9.5",
4
4
  "license": "MIT",
5
5
  "author": "Bhsd",
6
6
  "files": [
@@ -39,7 +39,7 @@
39
39
  "lint": "npm run lint:ts"
40
40
  },
41
41
  "dependencies": {
42
- "stylelint-config-recommended": "^15.0.0"
42
+ "stylelint-config-recommended": "^16.0.0"
43
43
  },
44
44
  "devDependencies": {
45
45
  "@stylistic/eslint-plugin": "^3.1.0",
@@ -61,8 +61,8 @@
61
61
  "eslint-plugin-unicorn": "^56.0.1",
62
62
  "http-server": "^14.1.1",
63
63
  "mocha": "^11.1.0",
64
- "stylelint": "^16.14.1",
64
+ "stylelint": "^16.19.1",
65
65
  "typescript": "^5.8.2",
66
- "wikiparser-node": "^1.19.0"
66
+ "wikiparser-node": "^1.20.2"
67
67
  }
68
68
  }
package/stylelintrc.cjs CHANGED
@@ -17,6 +17,7 @@ module.exports = {
17
17
  'declaration-block-single-line-max-declarations': 1,
18
18
  'number-max-precision': 2,
19
19
  'alpha-value-notation': 'number',
20
+ 'color-function-alias-notation': 'without-alpha',
20
21
  'color-function-notation': 'legacy',
21
22
  'color-hex-length': 'short',
22
23
  'font-weight-notation': 'named-where-possible',