@geekron/strapi 0.2.10 → 0.2.12

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.
@@ -1,2 +1,2 @@
1
- export * as translations from "./translations";
1
+ export { translations } from "./translations";
2
2
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../i18n/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,YAAY,MAAM,gBAAgB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../i18n/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC"}
@@ -29,24 +29,19 @@ var __export = (target, all) => {
29
29
  // i18n/index.ts
30
30
  var exports_i18n = {};
31
31
  __export(exports_i18n, {
32
- translations: () => exports_translations
32
+ translations: () => translations
33
33
  });
34
34
  module.exports = __toCommonJS(exports_i18n);
35
35
 
36
36
  // i18n/translations/index.ts
37
- var exports_translations = {};
38
- __export(exports_translations, {
39
- translations: () => translations,
40
- default: () => translations_default
41
- });
42
37
  var addPrefix = (translations, prefix) => {
43
38
  return Object.keys(translations).reduce((acc, key) => {
44
39
  acc[`${prefix}.${key}`] = translations[key];
45
40
  return acc;
46
41
  }, {});
47
42
  };
48
- var isNestedFile = (modulePath, baseDepth = 3) => {
49
- return modulePath.split("/").length > baseDepth;
43
+ var isInPrefixDir = (modulePath) => {
44
+ return modulePath.includes("/prefix/") || modulePath.includes("\\prefix\\");
50
45
  };
51
46
  var extractFileName = (modulePath) => {
52
47
  const match = modulePath.match(/\/([^/]+)\.json$/);
@@ -63,7 +58,7 @@ var processLocaleModules = (modules, locale, basePath = ".") => {
63
58
  return acc;
64
59
  }
65
60
  const translation = modules[modulePath];
66
- if (isNestedFile(modulePath)) {
61
+ if (isInPrefixDir(modulePath)) {
67
62
  return {
68
63
  ...acc,
69
64
  ...addPrefix(translation, fileName)
@@ -120,4 +115,3 @@ var translations = (config) => {
120
115
  return result;
121
116
  }, {});
122
117
  };
123
- var translations_default = translations();
@@ -1,28 +1,12 @@
1
- var __defProp = Object.defineProperty;
2
- var __export = (target, all) => {
3
- for (var name in all)
4
- __defProp(target, name, {
5
- get: all[name],
6
- enumerable: true,
7
- configurable: true,
8
- set: (newValue) => all[name] = () => newValue
9
- });
10
- };
11
-
12
1
  // i18n/translations/index.ts
13
- var exports_translations = {};
14
- __export(exports_translations, {
15
- translations: () => translations,
16
- default: () => translations_default
17
- });
18
2
  var addPrefix = (translations, prefix) => {
19
3
  return Object.keys(translations).reduce((acc, key) => {
20
4
  acc[`${prefix}.${key}`] = translations[key];
21
5
  return acc;
22
6
  }, {});
23
7
  };
24
- var isNestedFile = (modulePath, baseDepth = 3) => {
25
- return modulePath.split("/").length > baseDepth;
8
+ var isInPrefixDir = (modulePath) => {
9
+ return modulePath.includes("/prefix/") || modulePath.includes("\\prefix\\");
26
10
  };
27
11
  var extractFileName = (modulePath) => {
28
12
  const match = modulePath.match(/\/([^/]+)\.json$/);
@@ -39,7 +23,7 @@ var processLocaleModules = (modules, locale, basePath = ".") => {
39
23
  return acc;
40
24
  }
41
25
  const translation = modules[modulePath];
42
- if (isNestedFile(modulePath)) {
26
+ if (isInPrefixDir(modulePath)) {
43
27
  return {
44
28
  ...acc,
45
29
  ...addPrefix(translation, fileName)
@@ -96,7 +80,6 @@ var translations = (config) => {
96
80
  return result;
97
81
  }, {});
98
82
  };
99
- var translations_default = translations();
100
83
  export {
101
- exports_translations as translations
84
+ translations
102
85
  };
@@ -51,6 +51,5 @@ interface TranslationsConfig {
51
51
  * ```
52
52
  */
53
53
  export declare const translations: (config?: TranslationsConfig) => Record<string, Record<string, any>>;
54
- declare const _default: Record<string, Record<string, any>>;
55
- export default _default;
54
+ export {};
56
55
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../i18n/translations/index.ts"],"names":[],"mappings":"AAiJA;;GAEG;AACH,UAAU,kBAAkB;IAC3B,mCAAmC;IACnC,UAAU,CAAC,EAAE,KAAK,CAAC;QAClB,wCAAwC;QACxC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;QAC7B,wBAAwB;QACxB,QAAQ,CAAC,EAAE,MAAM,CAAC;KAClB,CAAC,CAAC;IACH,4BAA4B;IAC5B,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;CACnB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,eAAO,MAAM,YAAY,GAAI,SAAS,kBAAkB,KAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CA+B5F,CAAC;;AAGF,wBAA8B"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../i18n/translations/index.ts"],"names":[],"mappings":"AAiJA;;GAEG;AACH,UAAU,kBAAkB;IAC3B,mCAAmC;IACnC,UAAU,CAAC,EAAE,KAAK,CAAC;QAClB,wCAAwC;QACxC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;QAC7B,wBAAwB;QACxB,QAAQ,CAAC,EAAE,MAAM,CAAC;KAClB,CAAC,CAAC;IACH,4BAA4B;IAC5B,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;CACnB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,eAAO,MAAM,YAAY,GAAI,SAAS,kBAAkB,KAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CA+B5F,CAAC"}
@@ -12,13 +12,13 @@ const addPrefix = (translations: Record<string, any>, prefix: string): Record<st
12
12
  };
13
13
 
14
14
  /**
15
- * 判断文件是否在子目录中
15
+ * 判断文件是否在 prefix 目录中(需要添加前缀)
16
16
  * @param modulePath - 模块路径
17
- * @param baseDepth - 基础路径深度(默认为 3,即 ./locale/*.json)
18
- * @returns 是否为子目录文件
17
+ * @returns 是否在 prefix 目录中
19
18
  */
20
- const isNestedFile = (modulePath: string, baseDepth = 3): boolean => {
21
- return modulePath.split('/').length > baseDepth;
19
+ const isInPrefixDir = (modulePath: string): boolean => {
20
+ // 检查路径中是否包含 /prefix/ 子串
21
+ return modulePath.includes('/prefix/') || modulePath.includes('\\prefix\\');
22
22
  };
23
23
 
24
24
  /**
@@ -58,8 +58,8 @@ const processLocaleModules = (
58
58
 
59
59
  const translation = modules[modulePath] as Record<string, any>;
60
60
 
61
- // 判断是否为子目录文件,子目录文件添加文件名作为前缀
62
- if (isNestedFile(modulePath)) {
61
+ // 判断是否在 prefix 目录中,prefix 目录中的文件添加文件名作为前缀
62
+ if (isInPrefixDir(modulePath)) {
63
63
  return {
64
64
  ...acc,
65
65
  ...addPrefix(translation, fileName)
@@ -227,7 +227,4 @@ export const translations = (config?: TranslationsConfig): Record<string, Record
227
227
  }, {} as Record<string, any>);
228
228
  return result;
229
229
  }, {} as Record<string, Record<string, any>>);
230
- };
231
-
232
- // 默认导出:加载默认翻译目录
233
- export default translations();
230
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@geekron/strapi",
3
- "version": "0.2.10",
3
+ "version": "0.2.12",
4
4
  "description": "极客领航网站管理插件",
5
5
  "type": "commonjs",
6
6
  "author": "Geekron",