td-octopus 0.2.3 → 0.2.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "td-octopus",
3
- "version": "0.2.3",
3
+ "version": "0.2.5",
4
4
  "description": "I18N tool",
5
5
  "author": "Anthony Li",
6
6
  "bin": {
@@ -10,6 +10,7 @@
10
10
  "dependencies": {
11
11
  "@babel/core": "^7.28.6",
12
12
  "@babel/parser": "^7.28.6",
13
+ "@babel/plugin-proposal-class-properties": "^7.18.6",
13
14
  "@babel/traverse": "^7.28.6",
14
15
  "@babel/types": "^7.28.6",
15
16
  "axios": "^1.6.5",
@@ -34,7 +35,8 @@
34
35
  "update-notifier": "^4.1.0",
35
36
  "vue-template-compiler": "^2.6.14",
36
37
  "xlsx": "0.16.9",
37
- "yargs": "^15.3.1"
38
+ "yargs": "^15.3.1",
39
+ "@babel/plugin-proposal-decorators": "^7.29.0"
38
40
  },
39
41
  "keywords": [
40
42
  "I18N",
package/src/pop/index.js CHANGED
@@ -3,7 +3,7 @@
3
3
  * @Author: 郑泳健
4
4
  * @Date: 2024-12-12 15:00:24
5
5
  * @LastEditors: 郑泳健
6
- * @LastEditTime: 2025-11-19 15:38:18
6
+ * @LastEditTime: 2026-02-12 10:40:03
7
7
  */
8
8
  const path = require('path');
9
9
  const fs = require('fs');
@@ -45,7 +45,7 @@ function readJsFiles(folderPath) {
45
45
  } else if (path.extname(fullPath) === '.js') {
46
46
  // 如果是 .js 文件,读取文件内容
47
47
  let content = fs.readFileSync(fullPath, 'utf-8');
48
- const ast = parse(content, { sourceType: 'module', plugins: ['jsx', 'typescript'] });
48
+ const ast = parse(content, { sourceType: 'module', plugins: ['decorators-legacy', 'jsx', 'typescript'] });
49
49
  const output = generate(ast, { comments: false });
50
50
  content = output.code;
51
51
  jsContent += `\n/* File: ${fullPath} */\n${content}\n`;
@@ -73,7 +73,7 @@ function main() {
73
73
 
74
74
  if (!fs.existsSync(path.resolve(__dirname, '../octopus/zh-CN.js'))) {
75
75
  spinner.succeed(`查询完毕,共计丢失${lostKey.length}个,请在lostI18N.js中查看`);
76
- spinner.warn('请先执行otp storage');
76
+ spinner.warn('请先执行otp stash');
77
77
  return;
78
78
  }
79
79
  spinner.start(`查询完毕,共计丢失${lostKey.length}个,开始同步开始`);
@@ -105,7 +105,7 @@ function main() {
105
105
  autoImportJSFiles(path.resolve(process.cwd(), '.octopus/zh-CN'), cnJSON);
106
106
  autoImportJSFiles(path.resolve(process.cwd(), '.octopus/en-US'), enJSON);
107
107
  fs.rmSync(path.resolve(__dirname, '../octopus'), { recursive: true, force: true });
108
- spinner.succeed('同步完成,如果需要重新check,请先执行otp storage');
108
+ spinner.succeed('同步完成,如果需要重新check,请先执行otp stash');
109
109
  })();
110
110
  }
111
111
 
@@ -103,7 +103,7 @@ const transformToChinese = (code, globalList) => {
103
103
 
104
104
  const ast = parser.parse(code, {
105
105
  sourceType: 'module',
106
- plugins: ['jsx', 'typescript']
106
+ plugins: ['decorators-legacy', 'jsx', 'typescript']
107
107
  });
108
108
 
109
109
  const langVariableNames = new Set();
@@ -142,7 +142,7 @@ const transformToChinese = (code, globalList) => {
142
142
  const cnKey = extractCnKey(cnProp.value, path.scope);
143
143
 
144
144
  if (cnKey !== null && enStr !== null) {
145
- localList[cnKey] = enStr;
145
+ localList[cnKey.replace('I18N.', '')] = enStr;
146
146
  }
147
147
  }
148
148
  },