@bhsd/common 0.13.1 → 0.14.0

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.js CHANGED
@@ -37,6 +37,7 @@ __export(index_exports, {
37
37
  splitColors: () => splitColors
38
38
  });
39
39
  module.exports = __toCommonJS(index_exports);
40
+ var define_LANGS_default = ["zh-hans", "zh-hant"];
40
41
  const CDN = "https://testingcf.jsdelivr.net";
41
42
  const textarea = /* @__PURE__ */ (() => typeof document === "object" ? document.createElement("textarea") : void 0)();
42
43
  const decodeHTML = (str) => {
@@ -121,8 +122,12 @@ const setI18N = async (url, cur, languages, key, i18n = getObject(key) ?? {}) =>
121
122
  return i18n;
122
123
  }
123
124
  for (const language of langs) {
125
+ const l = language.toLowerCase();
126
+ if (!define_LANGS_default.includes(l)) {
127
+ continue;
128
+ }
124
129
  try {
125
- const res = await fetch(`${url}/${language.toLowerCase()}.json`);
130
+ const res = await fetch(`${url}/${l}.json`);
126
131
  Object.assign(i18n, await res.json(), { version: cur, lang: language });
127
132
  setObject(key, i18n);
128
133
  return i18n;
package/dist/index.mjs CHANGED
@@ -1,3 +1,4 @@
1
+ var define_LANGS_default = ["zh-hans", "zh-hant"];
1
2
  const CDN = "https://testingcf.jsdelivr.net";
2
3
  const textarea = /* @__PURE__ */ (() => typeof document === "object" ? document.createElement("textarea") : void 0)();
3
4
  const decodeHTML = (str) => {
@@ -82,8 +83,12 @@ const setI18N = async (url, cur, languages, key, i18n = getObject(key) ?? {}) =>
82
83
  return i18n;
83
84
  }
84
85
  for (const language of langs) {
86
+ const l = language.toLowerCase();
87
+ if (!define_LANGS_default.includes(l)) {
88
+ continue;
89
+ }
85
90
  try {
86
- const res = await fetch(`${url}/${language.toLowerCase()}.json`);
91
+ const res = await fetch(`${url}/${l}.json`);
87
92
  Object.assign(i18n, await res.json(), { version: cur, lang: language });
88
93
  setObject(key, i18n);
89
94
  return i18n;
package/dist/stylelint.js CHANGED
@@ -34,5 +34,6 @@ async function styleLint(stylelint, code, additionalConfig, fix) {
34
34
  if (fix) {
35
35
  return (await stylelint.lint({ code, config })).code;
36
36
  }
37
- return (await stylelint.lint({ code, config })).results.flatMap(({ warnings }) => warnings).filter(({ text }) => !text.startsWith("Unknown rule "));
37
+ const [result] = (await stylelint.lint({ code, config })).results;
38
+ return result.warnings.filter(({ text }) => !text.startsWith("Unknown rule "));
38
39
  }
@@ -11,7 +11,8 @@ async function styleLint(stylelint, code, additionalConfig, fix) {
11
11
  if (fix) {
12
12
  return (await stylelint.lint({ code, config })).code;
13
13
  }
14
- return (await stylelint.lint({ code, config })).results.flatMap(({ warnings }) => warnings).filter(({ text }) => !text.startsWith("Unknown rule "));
14
+ const [result] = (await stylelint.lint({ code, config })).results;
15
+ return result.warnings.filter(({ text }) => !text.startsWith("Unknown rule "));
15
16
  }
16
17
  export {
17
18
  styleLint
package/eslintrc.cjs CHANGED
@@ -21,7 +21,10 @@ module.exports = {
21
21
  parserOptions: {
22
22
  ecmaVersion: 'latest',
23
23
  },
24
- ignorePatterns: ['dist/'],
24
+ ignorePatterns: [
25
+ 'dist/',
26
+ 'build/',
27
+ ],
25
28
  rules: {
26
29
  'array-callback-return': 2,
27
30
  'no-cond-assign': [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bhsd/common",
3
- "version": "0.13.1",
3
+ "version": "0.14.0",
4
4
  "license": "MIT",
5
5
  "author": "Bhsd",
6
6
  "files": [
@@ -36,7 +36,7 @@
36
36
  "sideEffects": false,
37
37
  "scripts": {
38
38
  "prepublishOnly": "npm run build",
39
- "build": "tsc && esbuild src/* --charset=utf8 --target=es2024 --format=cjs --outdir=dist && esbuild test/* --charset=utf8 --target=es2024 --format=cjs --outdir=dist --bundle --platform=node --external:wikiparser-node && esbuild src/* --charset=utf8 --target=es2024 --format=esm --outdir=dist --out-extension:.js=.mjs && mv dist/*/*.d.ts dist/ && rm dist/global.*",
39
+ "build": "tsc && node build.js && esbuild test/* --charset=utf8 --target=es2024 --format=cjs --outdir=dist --bundle --platform=node --external:wikiparser-node && mv dist/*/*.d.ts dist/ && rm dist/global.*",
40
40
  "lint:ts": "tsc --noEmit && eslint --cache .",
41
41
  "lint": "npm run lint:ts"
42
42
  },
@@ -60,7 +60,7 @@
60
60
  "eslint-plugin-promise": "^7.2.1",
61
61
  "eslint-plugin-regexp": "^2.7.0",
62
62
  "eslint-plugin-unicorn": "^56.0.1",
63
- "stylelint": "^16.20.0",
63
+ "stylelint": "^16.21.0",
64
64
  "typescript": "^5.8.2",
65
65
  "wikiparser-node": "^1.21.2"
66
66
  }