scratch-l10n 5.0.231 → 5.0.232
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/.editorconfig +9 -0
- package/.github/PULL_REQUEST_TEMPLATE.md +53 -46
- package/.github/workflows/ci-cd.yml +5 -5
- package/.github/workflows/commitlint.yml +1 -1
- package/.github/workflows/daily-help-update.yml +4 -4
- package/.github/workflows/daily-tx-pull.yml +4 -4
- package/.github/workflows/signature-assistant.yml +3 -3
- package/.prettierignore +11 -0
- package/CHANGELOG.md +7 -0
- package/README.md +12 -12
- package/commitlint.config.js +3 -3
- package/dist/l10n.js +224 -232
- package/dist/l10n.js.map +1 -1
- package/dist/localeData.js +223 -232
- package/dist/localeData.js.map +1 -1
- package/dist/supportedLocales.js +123 -130
- package/dist/supportedLocales.js.map +1 -1
- package/eslint.config.mjs +13 -0
- package/lib/batch.js +10 -12
- package/lib/progress-logger.mjs +33 -33
- package/lib/transifex.js +145 -144
- package/lib/validate.mjs +32 -31
- package/package.json +7 -8
- package/prettier.config.mjs +3 -0
- package/release.config.js +13 -13
- package/renovate.json5 +3 -5
- package/scripts/build-data.mjs +33 -49
- package/scripts/build-i18n-src.js +29 -28
- package/scripts/freshdesk-api.js +129 -144
- package/scripts/help-utils.js +129 -139
- package/scripts/tx-pull-editor.mjs +54 -51
- package/scripts/tx-pull-help-articles.js +14 -14
- package/scripts/tx-pull-help-names.js +14 -14
- package/scripts/tx-pull-locale-articles.js +19 -19
- package/scripts/tx-pull-www.mjs +79 -76
- package/scripts/tx-push-help.mjs +87 -96
- package/scripts/tx-push-src.js +65 -65
- package/scripts/validate-extension-inputs.mjs +65 -68
- package/scripts/validate-translations.mjs +33 -29
- package/scripts/validate-www.mjs +45 -43
- package/src/index.mjs +4 -3
- package/src/locale-data.mjs +148 -150
- package/src/supported-locales.mjs +124 -131
package/dist/supportedLocales.js
CHANGED
@@ -102,146 +102,139 @@ __webpack_require__.r(__webpack_exports__);
|
|
102
102
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isRtl", function() { return isRtl; });
|
103
103
|
/**
|
104
104
|
* Currently supported locales for the Scratch Project
|
105
|
-
* @type {
|
105
|
+
* @type {object} Key Value pairs of locale code: Language name written in the language
|
106
106
|
*/
|
107
107
|
|
108
108
|
const locales = {
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
}
|
109
|
+
ab: { name: 'Аҧсшәа' },
|
110
|
+
af: { name: 'Afrikaans' },
|
111
|
+
ar: { name: 'العربية' },
|
112
|
+
am: { name: 'አማርኛ' },
|
113
|
+
an: { name: 'Aragonés' },
|
114
|
+
ast: { name: 'Asturianu' },
|
115
|
+
az: { name: 'Azeri' },
|
116
|
+
id: { name: 'Bahasa Indonesia' },
|
117
|
+
bn: { name: 'বাংলা' },
|
118
|
+
be: { name: 'Беларуская' },
|
119
|
+
bg: { name: 'Български' },
|
120
|
+
ca: { name: 'Català' },
|
121
|
+
cs: { name: 'Česky' },
|
122
|
+
cy: { name: 'Cymraeg' },
|
123
|
+
da: { name: 'Dansk' },
|
124
|
+
de: { name: 'Deutsch' },
|
125
|
+
et: { name: 'Eesti' },
|
126
|
+
el: { name: 'Ελληνικά' },
|
127
|
+
en: { name: 'English' },
|
128
|
+
es: { name: 'Español (España)' },
|
129
|
+
'es-419': { name: 'Español Latinoamericano' },
|
130
|
+
eo: { name: 'Esperanto' },
|
131
|
+
eu: { name: 'Euskara' },
|
132
|
+
fa: { name: 'فارسی' },
|
133
|
+
fil: { name: 'Filipino' },
|
134
|
+
fr: { name: 'Français' },
|
135
|
+
fy: { name: 'Frysk' },
|
136
|
+
ga: { name: 'Gaeilge' },
|
137
|
+
gd: { name: 'Gàidhlig' },
|
138
|
+
gl: { name: 'Galego' },
|
139
|
+
ko: { name: '한국어' },
|
140
|
+
ha: { name: 'Hausa' },
|
141
|
+
hy: { name: 'Հայերեն' },
|
142
|
+
he: { name: 'עִבְרִית' },
|
143
|
+
hi: { name: 'हिंदी' },
|
144
|
+
hr: { name: 'Hrvatski' },
|
145
|
+
xh: { name: 'isiXhosa' },
|
146
|
+
zu: { name: 'isiZulu' },
|
147
|
+
is: { name: 'Íslenska' },
|
148
|
+
it: { name: 'Italiano' },
|
149
|
+
ka: { name: 'ქართული ენა' },
|
150
|
+
kk: { name: 'қазақша' },
|
151
|
+
qu: { name: 'Kichwa' },
|
152
|
+
sw: { name: 'Kiswahili' },
|
153
|
+
ht: { name: 'Kreyòl ayisyen' },
|
154
|
+
ku: { name: 'Kurdî' },
|
155
|
+
ckb: { name: 'کوردیی ناوەندی' },
|
156
|
+
lv: { name: 'Latviešu' },
|
157
|
+
lt: { name: 'Lietuvių' },
|
158
|
+
hu: { name: 'Magyar' },
|
159
|
+
mi: { name: 'Māori' },
|
160
|
+
mn: { name: 'Монгол хэл' },
|
161
|
+
nl: { name: 'Nederlands' },
|
162
|
+
ja: { name: '日本語' },
|
163
|
+
'ja-Hira': { name: 'にほんご' },
|
164
|
+
nb: { name: 'Norsk Bokmål' },
|
165
|
+
nn: { name: 'Norsk Nynorsk' },
|
166
|
+
oc: { name: 'Occitan' },
|
167
|
+
or: { name: 'ଓଡ଼ିଆ' },
|
168
|
+
uz: { name: 'Oʻzbekcha' },
|
169
|
+
th: { name: 'ไทย' },
|
170
|
+
km: { name: 'ភាសាខ្មែរ' },
|
171
|
+
pl: { name: 'Polski' },
|
172
|
+
pt: { name: 'Português' },
|
173
|
+
'pt-br': { name: 'Português Brasileiro' },
|
174
|
+
rap: { name: 'Rapa Nui' },
|
175
|
+
ro: { name: 'Română' },
|
176
|
+
ru: { name: 'Русский' },
|
177
|
+
nso: { name: 'Sepedi' },
|
178
|
+
tn: { name: 'Setswana' },
|
179
|
+
sk: { name: 'Slovenčina' },
|
180
|
+
sl: { name: 'Slovenščina' },
|
181
|
+
sr: { name: 'Српски' },
|
182
|
+
fi: { name: 'Suomi' },
|
183
|
+
sv: { name: 'Svenska' },
|
184
|
+
vi: { name: 'Tiếng Việt' },
|
185
|
+
tr: { name: 'Türkçe' },
|
186
|
+
uk: { name: 'Українська' },
|
187
|
+
'zh-cn': { name: '简体中文' },
|
188
|
+
'zh-tw': { name: '繁體中文' },
|
189
|
+
}
|
190
190
|
|
191
191
|
const customLocales = {
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
}
|
192
|
+
ab: {
|
193
|
+
locale: 'ab',
|
194
|
+
parentLocale: 'ru',
|
195
|
+
},
|
196
|
+
// Aragonese is not in the locale data, using es for Spain
|
197
|
+
an: {
|
198
|
+
locale: 'an',
|
199
|
+
parentLocale: 'es',
|
200
|
+
},
|
201
|
+
// haitian creole is not in locale-langData
|
202
|
+
ht: {
|
203
|
+
locale: 'ht',
|
204
|
+
parentLocale: 'fr',
|
205
|
+
},
|
206
|
+
oc: {
|
207
|
+
locale: 'oc',
|
208
|
+
parentLocale: 'fr',
|
209
|
+
},
|
210
|
+
rap: {
|
211
|
+
locale: 'rap',
|
212
|
+
parentLocale: 'es',
|
213
|
+
},
|
214
|
+
// TODO: replace zh-cn, zh-tw with zh-Hans and zh-Hant then customLocales is unnecessary
|
215
|
+
'zh-cn': {
|
216
|
+
locale: 'zh-cn',
|
217
|
+
parentLocale: 'zh',
|
218
|
+
},
|
219
|
+
'zh-tw': {
|
220
|
+
locale: 'zh-tw',
|
221
|
+
parentLocale: 'zh',
|
222
|
+
},
|
223
|
+
}
|
224
224
|
|
225
225
|
const localeMap = {
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
}
|
226
|
+
'aa-dj': 'aa_DJ',
|
227
|
+
'es-419': 'es_419',
|
228
|
+
// ja-Hira: no map - it's 'ja-Hira' on transifex
|
229
|
+
'pt-br': 'pt_BR',
|
230
|
+
'zh-cn': 'zh_CN',
|
231
|
+
'zh-tw': 'zh_TW',
|
232
|
+
}
|
233
233
|
|
234
234
|
// list of RTL locales supported, and a function to check whether a locale is RTL
|
235
|
-
const rtlLocales = [
|
236
|
-
'ar',
|
237
|
-
'ckb',
|
238
|
-
'fa',
|
239
|
-
'he'
|
240
|
-
];
|
235
|
+
const rtlLocales = ['ar', 'ckb', 'fa', 'he']
|
241
236
|
|
242
|
-
const isRtl = locale =>
|
243
|
-
return rtlLocales.indexOf(locale) !== -1;
|
244
|
-
};
|
237
|
+
const isRtl = locale => rtlLocales.indexOf(locale) !== -1
|
245
238
|
|
246
239
|
|
247
240
|
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"supportedLocales.js","sources":["webpack:///webpack/bootstrap","webpack:///./src/supported-locales.mjs"],"sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = \"./src/supported-locales.mjs\");\n","/**\n * Currently supported locales for the Scratch Project\n * @type {
|
1
|
+
{"version":3,"file":"supportedLocales.js","sources":["webpack:///webpack/bootstrap","webpack:///./src/supported-locales.mjs"],"sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = \"./src/supported-locales.mjs\");\n","/**\n * Currently supported locales for the Scratch Project\n * @type {object} Key Value pairs of locale code: Language name written in the language\n */\n\nconst locales = {\n ab: { name: 'Аҧсшәа' },\n af: { name: 'Afrikaans' },\n ar: { name: 'العربية' },\n am: { name: 'አማርኛ' },\n an: { name: 'Aragonés' },\n ast: { name: 'Asturianu' },\n az: { name: 'Azeri' },\n id: { name: 'Bahasa Indonesia' },\n bn: { name: 'বাংলা' },\n be: { name: 'Беларуская' },\n bg: { name: 'Български' },\n ca: { name: 'Català' },\n cs: { name: 'Česky' },\n cy: { name: 'Cymraeg' },\n da: { name: 'Dansk' },\n de: { name: 'Deutsch' },\n et: { name: 'Eesti' },\n el: { name: 'Ελληνικά' },\n en: { name: 'English' },\n es: { name: 'Español (España)' },\n 'es-419': { name: 'Español Latinoamericano' },\n eo: { name: 'Esperanto' },\n eu: { name: 'Euskara' },\n fa: { name: 'فارسی' },\n fil: { name: 'Filipino' },\n fr: { name: 'Français' },\n fy: { name: 'Frysk' },\n ga: { name: 'Gaeilge' },\n gd: { name: 'Gàidhlig' },\n gl: { name: 'Galego' },\n ko: { name: '한국어' },\n ha: { name: 'Hausa' },\n hy: { name: 'Հայերեն' },\n he: { name: 'עִבְרִית' },\n hi: { name: 'हिंदी' },\n hr: { name: 'Hrvatski' },\n xh: { name: 'isiXhosa' },\n zu: { name: 'isiZulu' },\n is: { name: 'Íslenska' },\n it: { name: 'Italiano' },\n ka: { name: 'ქართული ენა' },\n kk: { name: 'қазақша' },\n qu: { name: 'Kichwa' },\n sw: { name: 'Kiswahili' },\n ht: { name: 'Kreyòl ayisyen' },\n ku: { name: 'Kurdî' },\n ckb: { name: 'کوردیی ناوەندی' },\n lv: { name: 'Latviešu' },\n lt: { name: 'Lietuvių' },\n hu: { name: 'Magyar' },\n mi: { name: 'Māori' },\n mn: { name: 'Монгол хэл' },\n nl: { name: 'Nederlands' },\n ja: { name: '日本語' },\n 'ja-Hira': { name: 'にほんご' },\n nb: { name: 'Norsk Bokmål' },\n nn: { name: 'Norsk Nynorsk' },\n oc: { name: 'Occitan' },\n or: { name: 'ଓଡ଼ିଆ' },\n uz: { name: 'Oʻzbekcha' },\n th: { name: 'ไทย' },\n km: { name: 'ភាសាខ្មែរ' },\n pl: { name: 'Polski' },\n pt: { name: 'Português' },\n 'pt-br': { name: 'Português Brasileiro' },\n rap: { name: 'Rapa Nui' },\n ro: { name: 'Română' },\n ru: { name: 'Русский' },\n nso: { name: 'Sepedi' },\n tn: { name: 'Setswana' },\n sk: { name: 'Slovenčina' },\n sl: { name: 'Slovenščina' },\n sr: { name: 'Српски' },\n fi: { name: 'Suomi' },\n sv: { name: 'Svenska' },\n vi: { name: 'Tiếng Việt' },\n tr: { name: 'Türkçe' },\n uk: { name: 'Українська' },\n 'zh-cn': { name: '简体中文' },\n 'zh-tw': { name: '繁體中文' },\n}\n\nconst customLocales = {\n ab: {\n locale: 'ab',\n parentLocale: 'ru',\n },\n // Aragonese is not in the locale data, using es for Spain\n an: {\n locale: 'an',\n parentLocale: 'es',\n },\n // haitian creole is not in locale-langData\n ht: {\n locale: 'ht',\n parentLocale: 'fr',\n },\n oc: {\n locale: 'oc',\n parentLocale: 'fr',\n },\n rap: {\n locale: 'rap',\n parentLocale: 'es',\n },\n // TODO: replace zh-cn, zh-tw with zh-Hans and zh-Hant then customLocales is unnecessary\n 'zh-cn': {\n locale: 'zh-cn',\n parentLocale: 'zh',\n },\n 'zh-tw': {\n locale: 'zh-tw',\n parentLocale: 'zh',\n },\n}\n\nconst localeMap = {\n 'aa-dj': 'aa_DJ',\n 'es-419': 'es_419',\n // ja-Hira: no map - it's 'ja-Hira' on transifex\n 'pt-br': 'pt_BR',\n 'zh-cn': 'zh_CN',\n 'zh-tw': 'zh_TW',\n}\n\n// list of RTL locales supported, and a function to check whether a locale is RTL\nconst rtlLocales = ['ar', 'ckb', 'fa', 'he']\n\nconst isRtl = locale => rtlLocales.indexOf(locale) !== -1\n\nexport { locales as default, customLocales, localeMap, isRtl }\n"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;AClFA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;A","sourceRoot":""}
|
@@ -0,0 +1,13 @@
|
|
1
|
+
import { eslintConfigScratch } from 'eslint-config-scratch'
|
2
|
+
import { globalIgnores } from 'eslint/config'
|
3
|
+
import globals from 'globals'
|
4
|
+
|
5
|
+
export default eslintConfigScratch.config(
|
6
|
+
eslintConfigScratch.recommended,
|
7
|
+
{
|
8
|
+
languageOptions: {
|
9
|
+
globals: globals.node,
|
10
|
+
},
|
11
|
+
},
|
12
|
+
globalIgnores(['locales/**/*', 'dist/**/*', 'src/locale-data/**/*']),
|
13
|
+
)
|
package/lib/batch.js
CHANGED
@@ -1,17 +1,15 @@
|
|
1
1
|
/**
|
2
2
|
* Maps each value of an array into an async function, and returns an array of the results
|
3
|
-
* @param {
|
3
|
+
* @param {Array} arr - array of values
|
4
4
|
* @param {number} batchSize - number of calls to `func` to do at one time
|
5
|
-
* @param {
|
6
|
-
* @
|
5
|
+
* @param {Function} func - async function to apply to all items in `arr`. Function should take one argument.
|
6
|
+
* @returns {Promise<Array>} - results of `func` applied to each item in `arr`
|
7
7
|
*/
|
8
8
|
exports.batchMap = async (arr, batchSize, func) => {
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
return results;
|
17
|
-
};
|
9
|
+
const results = []
|
10
|
+
for (let i = 0; i < arr.length; i += batchSize) {
|
11
|
+
const result = await Promise.all(arr.slice(i, i + batchSize).map(func))
|
12
|
+
results.push(...result)
|
13
|
+
}
|
14
|
+
return results
|
15
|
+
}
|
package/lib/progress-logger.mjs
CHANGED
@@ -2,41 +2,41 @@
|
|
2
2
|
* Helper class to log progress.
|
3
3
|
*/
|
4
4
|
export class ProgressLogger {
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
5
|
+
/**
|
6
|
+
* @param {number} [total] Optional: expected total number of items to process.
|
7
|
+
*/
|
8
|
+
constructor(total) {
|
9
|
+
this.total = total
|
10
|
+
this.completed = 0
|
11
|
+
}
|
12
12
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
}
|
13
|
+
/**
|
14
|
+
* Set the expected total number of items to process.
|
15
|
+
* @param {number} total Total number of items to process.
|
16
|
+
*/
|
17
|
+
setTotal(total) {
|
18
|
+
if (this.total !== total) {
|
19
|
+
this.total = total
|
20
|
+
delete this.percent
|
22
21
|
}
|
22
|
+
}
|
23
23
|
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
}
|
24
|
+
/**
|
25
|
+
* Increment the number of items processed and log progress.
|
26
|
+
* If a total is set, progress is logged as a percentage and only when the percentage changes.
|
27
|
+
* If no total is set, progress is logged as a count.
|
28
|
+
* @param {number} [count] Number of items processed.
|
29
|
+
*/
|
30
|
+
increment(count = 1) {
|
31
|
+
this.completed += count
|
32
|
+
if (this.total) {
|
33
|
+
const percent = Math.floor((100 * this.completed) / this.total)
|
34
|
+
if (percent !== this.percent) {
|
35
|
+
this.percent = percent
|
36
|
+
console.info(`Progress: ${this.percent}% (${this.completed}/${this.total})`)
|
37
|
+
}
|
38
|
+
} else {
|
39
|
+
console.info(`Progress: ${this.completed} of unknown total`)
|
41
40
|
}
|
41
|
+
}
|
42
42
|
}
|