@abdess76/i18nkit 1.0.3 → 1.0.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/CHANGELOG.md +18 -0
- package/LICENSE +21 -21
- package/README.md +174 -15
- package/bin/commands/backup.js +226 -0
- package/bin/commands/extract.js +2 -2
- package/bin/core/applier-utils.js +8 -9
- package/bin/core/applier.js +90 -14
- package/bin/core/args.js +17 -0
- package/bin/core/backup/cleanup.js +176 -0
- package/bin/core/backup/constants.js +114 -0
- package/bin/core/backup/file-ops.js +188 -0
- package/bin/core/backup/gitignore.js +173 -0
- package/bin/core/backup/index.js +189 -0
- package/bin/core/backup/manifest.js +185 -0
- package/bin/core/backup/restore.js +216 -0
- package/bin/core/backup/session.js +258 -0
- package/bin/core/backup.js +91 -41
- package/bin/core/command-interface.js +1 -0
- package/bin/core/file-walker.js +26 -12
- package/bin/core/fs-adapter.js +10 -0
- package/bin/core/help-generator.js +1 -1
- package/bin/core/index.js +0 -4
- package/bin/core/json-utils.js +10 -6
- package/bin/core/key-generator.js +12 -12
- package/bin/core/orphan-finder.js +12 -15
- package/bin/core/paths.js +4 -4
- package/bin/core/plugin-resolver-utils.js +1 -1
- package/bin/core/translator.js +17 -8
- package/bin/plugins/adapter-transloco.js +3 -2
- package/bin/plugins/parser-primeng.js +1 -1
- package/bin/plugins/provider-deepl.js +22 -8
- package/package.json +1 -1
- package/bin/core/types.js +0 -297
package/bin/core/types.js
DELETED
|
@@ -1,297 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* @fileoverview Shared type definitions for the i18nkit library.
|
|
5
|
-
* All types are JSDoc-only for editor intellisense and documentation generation.
|
|
6
|
-
* @module types
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* @typedef {Object} DetectedTech
|
|
11
|
-
* @property {string} id
|
|
12
|
-
* @property {string} label
|
|
13
|
-
* @property {string} type - 'framework', 'library', or 'i18n'
|
|
14
|
-
* @property {string} version
|
|
15
|
-
*/
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* @typedef {Object} DetectionResult
|
|
19
|
-
* @property {DetectedTech} framework
|
|
20
|
-
* @property {Array<DetectedTech>} libraries
|
|
21
|
-
* @property {DetectedTech} i18n
|
|
22
|
-
* @property {Array<string>} plugins
|
|
23
|
-
* @property {Array<DetectedTech>} details
|
|
24
|
-
*/
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* @typedef {Object} LangFile
|
|
28
|
-
* @property {string} name
|
|
29
|
-
* @property {string} path
|
|
30
|
-
*/
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* @typedef {Object} IcuMismatch
|
|
34
|
-
* @property {string} key
|
|
35
|
-
* @property {Array<string>} hasIcu
|
|
36
|
-
* @property {Array<string>} missingIcu
|
|
37
|
-
*/
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
* @typedef {Object} IdenticalValue
|
|
41
|
-
* @property {string} key
|
|
42
|
-
* @property {string} value
|
|
43
|
-
*/
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
* @typedef {Object} IcuMessage
|
|
47
|
-
* @property {string} key
|
|
48
|
-
* @property {Array<string>} langs
|
|
49
|
-
*/
|
|
50
|
-
|
|
51
|
-
/**
|
|
52
|
-
* @typedef {Object} SyncResult
|
|
53
|
-
* @property {Set<string>} allKeys
|
|
54
|
-
* @property {Array<LangFile>} langFiles
|
|
55
|
-
* @property {Object<string, Array<string>>} missingByLang
|
|
56
|
-
* @property {Array<IdenticalValue>} identicalValues
|
|
57
|
-
* @property {Array<IcuMessage>} icuMessages
|
|
58
|
-
* @property {Array<IcuMismatch>} icuMismatches
|
|
59
|
-
*/
|
|
60
|
-
|
|
61
|
-
/**
|
|
62
|
-
* @typedef {Object} SyncCheckResult
|
|
63
|
-
* @property {boolean} success
|
|
64
|
-
* @property {number} exitCode
|
|
65
|
-
* @property {SyncResult} result
|
|
66
|
-
*/
|
|
67
|
-
|
|
68
|
-
/**
|
|
69
|
-
* @typedef {Object} DynamicPattern
|
|
70
|
-
* @property {string} file
|
|
71
|
-
* @property {string} pattern
|
|
72
|
-
*/
|
|
73
|
-
|
|
74
|
-
/**
|
|
75
|
-
* @typedef {Object} OrphanResult
|
|
76
|
-
* @property {boolean} success
|
|
77
|
-
* @property {number} exitCode
|
|
78
|
-
* @property {Array<string>} orphanKeys
|
|
79
|
-
* @property {Array<string>} usedKeys
|
|
80
|
-
* @property {Array<string>} allKeys
|
|
81
|
-
* @property {Array<DynamicPattern>} dynamicPatterns
|
|
82
|
-
*/
|
|
83
|
-
|
|
84
|
-
/**
|
|
85
|
-
* @typedef {Object} TranslateResult
|
|
86
|
-
* @property {boolean} success
|
|
87
|
-
* @property {number} translated
|
|
88
|
-
* @property {number} failed
|
|
89
|
-
*/
|
|
90
|
-
|
|
91
|
-
/**
|
|
92
|
-
* @typedef {Object} ModifiedFile
|
|
93
|
-
* @property {string} file
|
|
94
|
-
* @property {number} count
|
|
95
|
-
*/
|
|
96
|
-
|
|
97
|
-
/**
|
|
98
|
-
* @typedef {Object} ApplyResult
|
|
99
|
-
* @property {boolean} success
|
|
100
|
-
* @property {boolean} aborted
|
|
101
|
-
* @property {number} totalFiles
|
|
102
|
-
* @property {number} totalReplacements
|
|
103
|
-
* @property {Array<ModifiedFile>} modifiedFiles
|
|
104
|
-
*/
|
|
105
|
-
|
|
106
|
-
/**
|
|
107
|
-
* @typedef {Object} Finding
|
|
108
|
-
* @property {string} file
|
|
109
|
-
* @property {number} line
|
|
110
|
-
* @property {string} original
|
|
111
|
-
* @property {string} key
|
|
112
|
-
* @property {string} scope
|
|
113
|
-
*/
|
|
114
|
-
|
|
115
|
-
/**
|
|
116
|
-
* @typedef {Object} ExitCodes
|
|
117
|
-
* @property {number} success
|
|
118
|
-
* @property {number} untranslated
|
|
119
|
-
*/
|
|
120
|
-
|
|
121
|
-
/**
|
|
122
|
-
* @typedef {Object} TranslateOptions
|
|
123
|
-
* @property {string} i18nDir
|
|
124
|
-
* @property {Object} provider
|
|
125
|
-
* @property {boolean} useDeepL
|
|
126
|
-
* @property {string} email
|
|
127
|
-
* @property {boolean} verbose
|
|
128
|
-
* @property {boolean} dryRun
|
|
129
|
-
* @property {Function} log
|
|
130
|
-
*/
|
|
131
|
-
|
|
132
|
-
/**
|
|
133
|
-
* @typedef {Object} SyncOptions
|
|
134
|
-
* @property {string} i18nDir
|
|
135
|
-
* @property {string} format - 'nested' or 'flat'
|
|
136
|
-
* @property {Function} log
|
|
137
|
-
* @property {boolean} strict
|
|
138
|
-
* @property {ExitCodes} exitCodes
|
|
139
|
-
*/
|
|
140
|
-
|
|
141
|
-
/**
|
|
142
|
-
* @typedef {Object} OrphanOptions
|
|
143
|
-
* @property {string} i18nDir
|
|
144
|
-
* @property {string} srcDir
|
|
145
|
-
* @property {string} format - 'nested' or 'flat'
|
|
146
|
-
* @property {Array<string>} excludedFolders
|
|
147
|
-
* @property {boolean} verbose
|
|
148
|
-
* @property {boolean} strict
|
|
149
|
-
* @property {Function} log
|
|
150
|
-
* @property {ExitCodes} exitCodes
|
|
151
|
-
*/
|
|
152
|
-
|
|
153
|
-
/**
|
|
154
|
-
* @typedef {Object} ApplyOptions
|
|
155
|
-
* @property {string} srcDir
|
|
156
|
-
* @property {string} backupDir
|
|
157
|
-
* @property {Object} adapter
|
|
158
|
-
* @property {boolean} backup
|
|
159
|
-
* @property {boolean} dryRun
|
|
160
|
-
* @property {boolean} verbose
|
|
161
|
-
* @property {boolean} interactive
|
|
162
|
-
* @property {Function} log
|
|
163
|
-
*/
|
|
164
|
-
|
|
165
|
-
/**
|
|
166
|
-
* @typedef {Object} WatchOptions
|
|
167
|
-
* @property {string} srcDir
|
|
168
|
-
* @property {Array<string>} excludedFolders
|
|
169
|
-
* @property {Function} onFileChange
|
|
170
|
-
* @property {Function} onStart
|
|
171
|
-
* @property {Function} log
|
|
172
|
-
*/
|
|
173
|
-
|
|
174
|
-
/**
|
|
175
|
-
* @typedef {Object} FileContent
|
|
176
|
-
* @property {string} template
|
|
177
|
-
* @property {string} typescript
|
|
178
|
-
* @property {string} type - 'component' or 'html'
|
|
179
|
-
*/
|
|
180
|
-
|
|
181
|
-
/**
|
|
182
|
-
* @typedef {Object} ExtractedKey
|
|
183
|
-
* @property {string} key
|
|
184
|
-
* @property {string} original
|
|
185
|
-
* @property {string} scope
|
|
186
|
-
* @property {string} file
|
|
187
|
-
* @property {number} line
|
|
188
|
-
*/
|
|
189
|
-
|
|
190
|
-
/**
|
|
191
|
-
* @typedef {Object} ExtractResult
|
|
192
|
-
* @property {Array<ExtractedKey>} findings
|
|
193
|
-
* @property {Object<string, string>} keys
|
|
194
|
-
* @property {number} filesScanned
|
|
195
|
-
* @property {number} keysExtracted
|
|
196
|
-
*/
|
|
197
|
-
|
|
198
|
-
/**
|
|
199
|
-
* @typedef {Object} FsAdapter
|
|
200
|
-
* @property {Object} fs
|
|
201
|
-
* @property {Object} fsp
|
|
202
|
-
*/
|
|
203
|
-
|
|
204
|
-
/**
|
|
205
|
-
* @typedef {Object} PluginMeta
|
|
206
|
-
* @property {string} description
|
|
207
|
-
* @property {string} category
|
|
208
|
-
*/
|
|
209
|
-
|
|
210
|
-
/**
|
|
211
|
-
* @typedef {Object} PluginOption
|
|
212
|
-
* @property {string} flag
|
|
213
|
-
* @property {string} description
|
|
214
|
-
* @property {boolean} required
|
|
215
|
-
*/
|
|
216
|
-
|
|
217
|
-
/**
|
|
218
|
-
* @typedef {Object} PluginEnv
|
|
219
|
-
* @property {string} name
|
|
220
|
-
* @property {string} description
|
|
221
|
-
*/
|
|
222
|
-
|
|
223
|
-
/**
|
|
224
|
-
* @typedef {Object} Plugin
|
|
225
|
-
* @property {string} name
|
|
226
|
-
* @property {string} type - 'parser', 'adapter', or 'provider'
|
|
227
|
-
* @property {PluginMeta} meta
|
|
228
|
-
* @property {string} source - 'builtin', 'local', or 'npm'
|
|
229
|
-
* @property {number} priority
|
|
230
|
-
* @property {Array<string>} extensions
|
|
231
|
-
* @property {Array<PluginOption>} options
|
|
232
|
-
* @property {Array<PluginEnv>} env
|
|
233
|
-
* @property {Array<string>} examples
|
|
234
|
-
* @property {Function} detect
|
|
235
|
-
* @property {Function} extract
|
|
236
|
-
* @property {Function} transform
|
|
237
|
-
* @property {Function} translate
|
|
238
|
-
* @property {Function} translateBatch
|
|
239
|
-
*/
|
|
240
|
-
|
|
241
|
-
/**
|
|
242
|
-
* @typedef {Object} PluginError
|
|
243
|
-
* @property {string} source
|
|
244
|
-
* @property {string} plugin
|
|
245
|
-
* @property {string} error
|
|
246
|
-
* @property {Array<string>} errors
|
|
247
|
-
*/
|
|
248
|
-
|
|
249
|
-
/**
|
|
250
|
-
* @typedef {Object} PluginRegistry
|
|
251
|
-
* @property {Array<Plugin>} parsers
|
|
252
|
-
* @property {Array<Plugin>} adapters
|
|
253
|
-
* @property {Array<Plugin>} providers
|
|
254
|
-
* @property {Array<Plugin>} all
|
|
255
|
-
* @property {Map<string, Plugin>} byName
|
|
256
|
-
* @property {Array<PluginError>} errors
|
|
257
|
-
*/
|
|
258
|
-
|
|
259
|
-
/**
|
|
260
|
-
* @typedef {Object} PluginValidation
|
|
261
|
-
* @property {boolean} valid
|
|
262
|
-
* @property {Array<string>} errors
|
|
263
|
-
*/
|
|
264
|
-
|
|
265
|
-
/**
|
|
266
|
-
* @typedef {Object} DetectionContext
|
|
267
|
-
* @property {DetectedTech} framework
|
|
268
|
-
* @property {Array<DetectedTech>} libraries
|
|
269
|
-
* @property {DetectedTech} i18n
|
|
270
|
-
* @property {Object} packageJson
|
|
271
|
-
*/
|
|
272
|
-
|
|
273
|
-
/**
|
|
274
|
-
* @typedef {Object} CommandOption
|
|
275
|
-
* @property {string} flag
|
|
276
|
-
* @property {string} description
|
|
277
|
-
* @property {boolean} required
|
|
278
|
-
*/
|
|
279
|
-
|
|
280
|
-
/**
|
|
281
|
-
* @typedef {Object} CommandMeta
|
|
282
|
-
* @property {string} description
|
|
283
|
-
* @property {string} category
|
|
284
|
-
*/
|
|
285
|
-
|
|
286
|
-
/**
|
|
287
|
-
* @typedef {Object} Command
|
|
288
|
-
* @property {string} name
|
|
289
|
-
* @property {string} description
|
|
290
|
-
* @property {string} category
|
|
291
|
-
* @property {Array<string>} aliases
|
|
292
|
-
* @property {Array<CommandOption>} options
|
|
293
|
-
* @property {CommandMeta} meta
|
|
294
|
-
* @property {Function} run
|
|
295
|
-
*/
|
|
296
|
-
|
|
297
|
-
module.exports = {};
|