ztxkutils 2.10.66-14 → 2.10.66-16
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 +1 -1
- package/dist/{request-ba8abf99.js → request-588c90ec.js} +92 -18
- package/dist/{request-0cc024b1.js → request-dc69f021.js} +68 -13
- package/dist/request.js +1 -1
- package/package.json +1 -1
- package/zti18n-cli/bin/index.js +3 -3
- package/zti18n-cli/index.js +23 -23
- package/zti18n-cli/src/command/collect.js +351 -342
- package/zti18n-cli/src/command/convert.js +17 -17
- package/zti18n-cli/src/command/convert2.js +35 -35
- package/zti18n-cli/src/command/initFileConf.js +133 -133
- package/zti18n-cli/src/command/publish.js +24 -24
- package/zti18n-cli/src/conf/BaseConf.js +21 -21
- package/zti18n-cli/src/conf/FileConf.js +116 -116
- package/zti18n-cli/src/index.js +75 -75
- package/zti18n-cli/src/translate/google.js +6 -6
- package/zti18n-cli/src/utils/isChinese.js +3 -3
- package/zti18n-cli/src/utils/log.js +8 -8
- package/zti18n-cli/src/utils/mergeOptions.js +45 -45
- package/zti18n-cli/src/utils/reactOptions.js +73 -73
- package/zti18n-cli/src/utils/vueOptions.js +69 -69
- package/zti18n-core/index.js +1 -1
- package/zti18n-core/src/index.js +5 -5
- package/zti18n-core/src/plugin/reactIntlToReactIntlUniversal.js +224 -224
- package/zti18n-core/src/plugin/reactIntlUniversalToDi18n.js +64 -64
- package/zti18n-core/src/transform/defaultPkMap.js +79 -79
- package/zti18n-core/src/transform/transformHtml.js +271 -271
- package/zti18n-core/src/transform/transformJs.js +488 -488
- package/zti18n-core/src/transform/transformPug.js +272 -272
- package/zti18n-core/src/transform/transformReactIntlToReactIntlUniversal.js +96 -96
- package/zti18n-core/src/transform/transformReactIntlUniveralToDi18n.js +90 -90
- package/zti18n-core/src/transform/transformToDi18n.js +22 -22
- package/zti18n-core/src/transform/transformTs.js +41 -41
- package/zti18n-core/src/transform/transformVue.js +126 -126
- package/zti18n-core/src/transform/transformZeroToDi18n.js +105 -105
- package/zti18n-core/src/translate/google.js +6 -6
- package/zti18n-core/src/utils/constants.js +3 -3
- package/zti18n-core/src/utils/getIgnoreLines.js +14 -14
- package/zti18n-core/src/utils/isChinese.js +3 -3
- package/zti18n-core/src/utils/log.js +8 -8
- package/dist/authority-e6bde99f.js +0 -423
- package/dist/reqUrl-3792afcd.js +0 -82
- package/dist/reqUrl-787dd9e5.js +0 -82
- package/dist/request-ef290b9a.js +0 -2838
- package/dist/tools-09a4d620.js +0 -2445
- package/dist/tools-0ca888cd.js +0 -2473
- package/dist/validate-6e735536.js +0 -79
- package/dist/zti18n-cli/bin/index.d.ts +0 -2
- package/dist/zti18n-cli/index.d.ts +0 -1
- package/dist/zti18n-cli/src/command/collect.d.ts +0 -2
- package/dist/zti18n-cli/src/command/convert.d.ts +0 -2
- package/dist/zti18n-cli/src/command/convert2.d.ts +0 -2
- package/dist/zti18n-cli/src/command/initFileConf.d.ts +0 -2
- package/dist/zti18n-cli/src/command/publish.d.ts +0 -2
- package/dist/zti18n-cli/src/conf/BaseConf.d.ts +0 -8
- package/dist/zti18n-cli/src/conf/FileConf.d.ts +0 -6
- package/dist/zti18n-cli/src/index.d.ts +0 -1
- package/dist/zti18n-cli/src/translate/google.d.ts +0 -2
- package/dist/zti18n-cli/src/utils/isChinese.d.ts +0 -2
- package/dist/zti18n-cli/src/utils/log.d.ts +0 -4
- package/dist/zti18n-cli/src/utils/mergeOptions.d.ts +0 -24
- package/dist/zti18n-cli/src/utils/reactOptions.d.ts +0 -21
- package/dist/zti18n-cli/src/utils/vueOptions.d.ts +0 -17
- package/dist/zti18n-core/index.d.ts +0 -2
- package/dist/zti18n-core/src/index.d.ts +0 -8
- package/dist/zti18n-core/src/plugin/reactIntlToReactIntlUniversal.d.ts +0 -19
- package/dist/zti18n-core/src/plugin/reactIntlUniversalToDi18n.d.ts +0 -9
- package/dist/zti18n-core/src/transform/defaultPkMap.d.ts +0 -75
- package/dist/zti18n-core/src/transform/transformHtml.d.ts +0 -5
- package/dist/zti18n-core/src/transform/transformJs.d.ts +0 -5
- package/dist/zti18n-core/src/transform/transformPug.d.ts +0 -5
- package/dist/zti18n-core/src/transform/transformReactIntlToReactIntlUniversal.d.ts +0 -2
- package/dist/zti18n-core/src/transform/transformReactIntlUniveralToDi18n.d.ts +0 -2
- package/dist/zti18n-core/src/transform/transformToDi18n.d.ts +0 -5
- package/dist/zti18n-core/src/transform/transformTs.d.ts +0 -5
- package/dist/zti18n-core/src/transform/transformVue.d.ts +0 -5
- package/dist/zti18n-core/src/transform/transformZeroToDi18n.d.ts +0 -2
- package/dist/zti18n-core/src/translate/google.d.ts +0 -2
- package/dist/zti18n-core/src/utils/constants.d.ts +0 -3
- package/dist/zti18n-core/src/utils/getIgnoreLines.d.ts +0 -2
- package/dist/zti18n-core/src/utils/isChinese.d.ts +0 -2
- package/dist/zti18n-core/src/utils/log.d.ts +0 -4
@@ -1,64 +1,64 @@
|
|
1
|
-
const t = require('@babel/types');
|
2
|
-
|
3
|
-
const replaceLineBreak = function (value) {
|
4
|
-
if (typeof value !== 'string') return value;
|
5
|
-
return value.replace(/\n/g, ' ');
|
6
|
-
};
|
7
|
-
|
8
|
-
/**
|
9
|
-
* 获取代码转换的插件
|
10
|
-
*/
|
11
|
-
function getPlugin(outObj, allConverted, intlAlias = 'intl') {
|
12
|
-
function makeReplace({ orignKey, value, variableObj }) {
|
13
|
-
outObj.translateWordsNum++;
|
14
|
-
|
15
|
-
const value2 = replaceLineBreak(value);
|
16
|
-
|
17
|
-
// 用于防止中文转码为 unicode
|
18
|
-
const v = Object.assign(t.StringLiteral(value2), {
|
19
|
-
extra: {
|
20
|
-
raw: `'${value2}'`,
|
21
|
-
rawValue: value2,
|
22
|
-
},
|
23
|
-
});
|
24
|
-
|
25
|
-
allConverted[orignKey] = value;
|
26
|
-
|
27
|
-
return t.CallExpression(
|
28
|
-
t.MemberExpression(t.Identifier(intlAlias), t.Identifier('t')),
|
29
|
-
variableObj ? [v, variableObj] : [v]
|
30
|
-
);
|
31
|
-
}
|
32
|
-
|
33
|
-
const plugin = function () {
|
34
|
-
return {
|
35
|
-
visitor: {
|
36
|
-
CallExpression(path) {
|
37
|
-
const { node } = path;
|
38
|
-
|
39
|
-
if (node.callee.type === 'MemberExpression') {
|
40
|
-
if (
|
41
|
-
path.node.callee.object.name === intlAlias &&
|
42
|
-
path.node.callee.property.name === 'get'
|
43
|
-
) {
|
44
|
-
const args = path.node.arguments;
|
45
|
-
|
46
|
-
const orignKey = args[0].value;
|
47
|
-
const variableObj = args[1] ? args[1] : null;
|
48
|
-
|
49
|
-
const value = path.parentPath.parent.arguments[0].value;
|
50
|
-
|
51
|
-
path.parentPath.parentPath.replaceWith(
|
52
|
-
makeReplace({ orignKey, value, variableObj })
|
53
|
-
);
|
54
|
-
}
|
55
|
-
}
|
56
|
-
},
|
57
|
-
},
|
58
|
-
};
|
59
|
-
};
|
60
|
-
|
61
|
-
return plugin;
|
62
|
-
}
|
63
|
-
|
64
|
-
module.exports = getPlugin;
|
1
|
+
const t = require('@babel/types');
|
2
|
+
|
3
|
+
const replaceLineBreak = function (value) {
|
4
|
+
if (typeof value !== 'string') return value;
|
5
|
+
return value.replace(/\n/g, ' ');
|
6
|
+
};
|
7
|
+
|
8
|
+
/**
|
9
|
+
* 获取代码转换的插件
|
10
|
+
*/
|
11
|
+
function getPlugin(outObj, allConverted, intlAlias = 'intl') {
|
12
|
+
function makeReplace({ orignKey, value, variableObj }) {
|
13
|
+
outObj.translateWordsNum++;
|
14
|
+
|
15
|
+
const value2 = replaceLineBreak(value);
|
16
|
+
|
17
|
+
// 用于防止中文转码为 unicode
|
18
|
+
const v = Object.assign(t.StringLiteral(value2), {
|
19
|
+
extra: {
|
20
|
+
raw: `'${value2}'`,
|
21
|
+
rawValue: value2,
|
22
|
+
},
|
23
|
+
});
|
24
|
+
|
25
|
+
allConverted[orignKey] = value;
|
26
|
+
|
27
|
+
return t.CallExpression(
|
28
|
+
t.MemberExpression(t.Identifier(intlAlias), t.Identifier('t')),
|
29
|
+
variableObj ? [v, variableObj] : [v]
|
30
|
+
);
|
31
|
+
}
|
32
|
+
|
33
|
+
const plugin = function () {
|
34
|
+
return {
|
35
|
+
visitor: {
|
36
|
+
CallExpression(path) {
|
37
|
+
const { node } = path;
|
38
|
+
|
39
|
+
if (node.callee.type === 'MemberExpression') {
|
40
|
+
if (
|
41
|
+
path.node.callee.object.name === intlAlias &&
|
42
|
+
path.node.callee.property.name === 'get'
|
43
|
+
) {
|
44
|
+
const args = path.node.arguments;
|
45
|
+
|
46
|
+
const orignKey = args[0].value;
|
47
|
+
const variableObj = args[1] ? args[1] : null;
|
48
|
+
|
49
|
+
const value = path.parentPath.parent.arguments[0].value;
|
50
|
+
|
51
|
+
path.parentPath.parentPath.replaceWith(
|
52
|
+
makeReplace({ orignKey, value, variableObj })
|
53
|
+
);
|
54
|
+
}
|
55
|
+
}
|
56
|
+
},
|
57
|
+
},
|
58
|
+
};
|
59
|
+
};
|
60
|
+
|
61
|
+
return plugin;
|
62
|
+
}
|
63
|
+
|
64
|
+
module.exports = getPlugin;
|
@@ -1,79 +1,79 @@
|
|
1
|
-
// 当使用 HTML 模板时,由于大小写不敏感,为了避免转换中丢失大小写,需要提供组件的 Pascal 到 kebab 形式映射
|
2
|
-
// 默认的如下(iview: https://github.com/iview/iview-loader/blob/master/src/tag-map.js)
|
3
|
-
module.exports = {
|
4
|
-
Switch: 'i-switch',
|
5
|
-
Circle: 'i-circle',
|
6
|
-
Affix: 'i-affix',
|
7
|
-
Alert: 'i-alert',
|
8
|
-
AnchorLink: 'i-anchor-link',
|
9
|
-
Anchor: 'i-anchor',
|
10
|
-
AutoComplete: 'i-auto-complete',
|
11
|
-
Avatar: 'i-avatar',
|
12
|
-
BackTop: 'i-back-top',
|
13
|
-
Badge: 'i-badge',
|
14
|
-
BreadcrumbItem: 'i-breadcrumb-item',
|
15
|
-
Breadcrumb: 'i-breadcrumb',
|
16
|
-
ButtonGroup: 'i-button-group',
|
17
|
-
Button: 'i-button',
|
18
|
-
Card: 'i-card',
|
19
|
-
CarouselItem: 'i-carousel-item',
|
20
|
-
Carousel: 'i-carousel',
|
21
|
-
Cascader: 'i-cascader',
|
22
|
-
CellGroup: 'i-cell-group',
|
23
|
-
Cell: 'i-cell',
|
24
|
-
CheckboxGroup: 'i-checkbox-group',
|
25
|
-
Checkbox: 'i-checkbox',
|
26
|
-
Col: 'i-col',
|
27
|
-
Collapse: 'i-collapse',
|
28
|
-
ColorPicker: 'i-color-picker',
|
29
|
-
Content: 'i-content',
|
30
|
-
DatePicker: 'i-date-picker',
|
31
|
-
Divider: 'i-divider',
|
32
|
-
Drawer: 'i-drawer',
|
33
|
-
DropdownItem: 'i-dropdown-item',
|
34
|
-
DropdownMenu: 'i-dropdown-menu',
|
35
|
-
Dropdown: 'i-dropdown',
|
36
|
-
Footer: 'i-footer',
|
37
|
-
FormItem: 'i-form-item',
|
38
|
-
Form: 'i-form',
|
39
|
-
Header: 'i-header',
|
40
|
-
Icon: 'i-icon',
|
41
|
-
InputNumber: 'i-input-number',
|
42
|
-
Input: 'i-input',
|
43
|
-
Layout: 'i-layout',
|
44
|
-
Menu: 'i-menu',
|
45
|
-
MenuGroup: 'i-menu-group',
|
46
|
-
MenuItem: 'i-menu-item',
|
47
|
-
Sider: 'i-sider',
|
48
|
-
Submenu: 'i-submenu',
|
49
|
-
Modal: 'i-modal',
|
50
|
-
OptionGroup: 'i-option-group',
|
51
|
-
Option: 'i-option',
|
52
|
-
Page: 'i-page',
|
53
|
-
Panel: 'i-panel',
|
54
|
-
Poptip: 'i-poptip',
|
55
|
-
Progress: 'i-progress',
|
56
|
-
RadioGroup: 'i-radio-group',
|
57
|
-
Radio: 'i-radio',
|
58
|
-
Rate: 'i-rate',
|
59
|
-
Row: 'i-row',
|
60
|
-
Scroll: 'i-scroll',
|
61
|
-
Select: 'i-select',
|
62
|
-
Slider: 'i-slider',
|
63
|
-
Spin: 'i-spin',
|
64
|
-
Split: 'i-split',
|
65
|
-
Step: 'i-step',
|
66
|
-
Steps: 'i-steps',
|
67
|
-
Table: 'i-table',
|
68
|
-
Tabs: 'i-tabs',
|
69
|
-
TabPane: 'i-tab-pane',
|
70
|
-
Tag: 'i-tag',
|
71
|
-
TimelineItem: 'i-timeline-item',
|
72
|
-
Timeline: 'i-timeline',
|
73
|
-
TimePicker: 'i-time-picker',
|
74
|
-
Time: 'i-time',
|
75
|
-
Tooltip: 'i-tooltip',
|
76
|
-
Transfer: 'i-transfer',
|
77
|
-
Tree: 'i-tree',
|
78
|
-
Upload: 'i-upload',
|
79
|
-
};
|
1
|
+
// 当使用 HTML 模板时,由于大小写不敏感,为了避免转换中丢失大小写,需要提供组件的 Pascal 到 kebab 形式映射
|
2
|
+
// 默认的如下(iview: https://github.com/iview/iview-loader/blob/master/src/tag-map.js)
|
3
|
+
module.exports = {
|
4
|
+
Switch: 'i-switch',
|
5
|
+
Circle: 'i-circle',
|
6
|
+
Affix: 'i-affix',
|
7
|
+
Alert: 'i-alert',
|
8
|
+
AnchorLink: 'i-anchor-link',
|
9
|
+
Anchor: 'i-anchor',
|
10
|
+
AutoComplete: 'i-auto-complete',
|
11
|
+
Avatar: 'i-avatar',
|
12
|
+
BackTop: 'i-back-top',
|
13
|
+
Badge: 'i-badge',
|
14
|
+
BreadcrumbItem: 'i-breadcrumb-item',
|
15
|
+
Breadcrumb: 'i-breadcrumb',
|
16
|
+
ButtonGroup: 'i-button-group',
|
17
|
+
Button: 'i-button',
|
18
|
+
Card: 'i-card',
|
19
|
+
CarouselItem: 'i-carousel-item',
|
20
|
+
Carousel: 'i-carousel',
|
21
|
+
Cascader: 'i-cascader',
|
22
|
+
CellGroup: 'i-cell-group',
|
23
|
+
Cell: 'i-cell',
|
24
|
+
CheckboxGroup: 'i-checkbox-group',
|
25
|
+
Checkbox: 'i-checkbox',
|
26
|
+
Col: 'i-col',
|
27
|
+
Collapse: 'i-collapse',
|
28
|
+
ColorPicker: 'i-color-picker',
|
29
|
+
Content: 'i-content',
|
30
|
+
DatePicker: 'i-date-picker',
|
31
|
+
Divider: 'i-divider',
|
32
|
+
Drawer: 'i-drawer',
|
33
|
+
DropdownItem: 'i-dropdown-item',
|
34
|
+
DropdownMenu: 'i-dropdown-menu',
|
35
|
+
Dropdown: 'i-dropdown',
|
36
|
+
Footer: 'i-footer',
|
37
|
+
FormItem: 'i-form-item',
|
38
|
+
Form: 'i-form',
|
39
|
+
Header: 'i-header',
|
40
|
+
Icon: 'i-icon',
|
41
|
+
InputNumber: 'i-input-number',
|
42
|
+
Input: 'i-input',
|
43
|
+
Layout: 'i-layout',
|
44
|
+
Menu: 'i-menu',
|
45
|
+
MenuGroup: 'i-menu-group',
|
46
|
+
MenuItem: 'i-menu-item',
|
47
|
+
Sider: 'i-sider',
|
48
|
+
Submenu: 'i-submenu',
|
49
|
+
Modal: 'i-modal',
|
50
|
+
OptionGroup: 'i-option-group',
|
51
|
+
Option: 'i-option',
|
52
|
+
Page: 'i-page',
|
53
|
+
Panel: 'i-panel',
|
54
|
+
Poptip: 'i-poptip',
|
55
|
+
Progress: 'i-progress',
|
56
|
+
RadioGroup: 'i-radio-group',
|
57
|
+
Radio: 'i-radio',
|
58
|
+
Rate: 'i-rate',
|
59
|
+
Row: 'i-row',
|
60
|
+
Scroll: 'i-scroll',
|
61
|
+
Select: 'i-select',
|
62
|
+
Slider: 'i-slider',
|
63
|
+
Spin: 'i-spin',
|
64
|
+
Split: 'i-split',
|
65
|
+
Step: 'i-step',
|
66
|
+
Steps: 'i-steps',
|
67
|
+
Table: 'i-table',
|
68
|
+
Tabs: 'i-tabs',
|
69
|
+
TabPane: 'i-tab-pane',
|
70
|
+
Tag: 'i-tag',
|
71
|
+
TimelineItem: 'i-timeline-item',
|
72
|
+
Timeline: 'i-timeline',
|
73
|
+
TimePicker: 'i-time-picker',
|
74
|
+
Time: 'i-time',
|
75
|
+
Tooltip: 'i-tooltip',
|
76
|
+
Transfer: 'i-transfer',
|
77
|
+
Tree: 'i-tree',
|
78
|
+
Upload: 'i-upload',
|
79
|
+
};
|