gulp-mu-gulp-api 0.4.0 → 0.4.1
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/README.md +10 -0
- package/package.json +1 -1
- package/src/i18x-engine.mjs +4 -1
- package/src/i18x.mjs +2 -0
- package/src/index.mjs +4 -2
package/README.md
CHANGED
|
@@ -37,6 +37,11 @@ The module is deliberately **dependency-free** and knows nothing about µGulp™
|
|
|
37
37
|
npm install gulp-mu-gulp-api
|
|
38
38
|
```
|
|
39
39
|
|
|
40
|
+
### 0.4.1
|
|
41
|
+
|
|
42
|
+
- **Fixed** a placeholder with an unknown named format rendered as an empty string instead of its value — gulp lifecycle lines lost their duration (`Finished 'task' after`). The raw value is kept when the format is missing.
|
|
43
|
+
- **Fixed** `SetLid()` kept the dictionary of the previous language cached, so a language switch inside a running worker could still translate with stale texts.
|
|
44
|
+
|
|
40
45
|
### 0.4.0
|
|
41
46
|
|
|
42
47
|
- **Added** `GetParameters()` / `GetParameter(id, fallback)` — values for the inputs a task declared with `µParameters`. µGulp asks for them once before the task body runs and passes them in as `MICROGULP_PARAMS` (JSON) plus one flat `MICROGULP_PARAM_<ID>` per parameter.
|
|
@@ -347,6 +352,11 @@ Das Modul ist bewusst **abhängigkeitsfrei** und kennt keine µGulp™-Interna:
|
|
|
347
352
|
npm install gulp-mu-gulp-api
|
|
348
353
|
```
|
|
349
354
|
|
|
355
|
+
### 0.4.1
|
|
356
|
+
|
|
357
|
+
- **Behoben** Ein Platzhalter mit unbekanntem benanntem Format wurde als leerer Text gerendert statt mit seinem Wert — den Gulp-Lifecycle-Zeilen fehlte dadurch die Dauer (`Finished 'task' after`). Fehlt das Format, bleibt der Rohwert erhalten.
|
|
358
|
+
- **Behoben** `SetLid()` behielt das Wörterbuch der vorherigen Sprache im Cache; ein Sprachwechsel im laufenden Worker konnte weiter mit veralteten Texten übersetzen.
|
|
359
|
+
|
|
350
360
|
### 0.4.0
|
|
351
361
|
|
|
352
362
|
- **Neu** `GetParameters()` / `GetParameter(id, fallback)` — Werte für die Eingaben, die ein Task per `µParameters` deklariert hat. µGulp fragt sie einmal vor dem Task-Rumpf ab und übergibt sie als `MICROGULP_PARAMS` (JSON) plus je Parameter ein flaches `MICROGULP_PARAM_<ID>`.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gulp-mu-gulp-api",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.1",
|
|
4
4
|
"description": "Public task API for the µGulp orchestrator: progress reporting, declared task parameters, sound signals, speech output, localized console output (i18x) and interactive UI inputs (text, password, number, textarea, color, font, select, radio, multi-select checkbox, range slider, date/time, file) from within gulp tasks — with graceful CLI fallbacks when running without µGulp.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/index.mjs",
|
package/src/i18x-engine.mjs
CHANGED
|
@@ -627,7 +627,10 @@ export function Trans(_text, _placeholders, _ctx) {
|
|
|
627
627
|
let subContext = localFormats ? { ...ctx, formats: { ...(ctx.formats ?? {}), ...localFormats } } : ctx;
|
|
628
628
|
value = FormatValue(Number(value) || 0, attrValue, subContext);
|
|
629
629
|
} else {
|
|
630
|
-
|
|
630
|
+
// Missing named format must not swallow the placeholder (e.g.
|
|
631
|
+
// gulp lifecycle "after <duration format="progressDuration"/>"
|
|
632
|
+
// would otherwise render as "Finished 'task' after ").
|
|
633
|
+
value = value === undefined || value === null ? '' : String(value);
|
|
631
634
|
}
|
|
632
635
|
} else if (attrKey === 'enumeration') {
|
|
633
636
|
let options = attrValue.split('|');
|
package/src/i18x.mjs
CHANGED
|
@@ -195,8 +195,10 @@ export function GetLid() {
|
|
|
195
195
|
*/
|
|
196
196
|
export function SetLid(_lid) {
|
|
197
197
|
activeLid = _lid ? _BestAvailableLid(_lid, _AvailableLids()) : null;
|
|
198
|
+
dictionaryCache.clear();
|
|
198
199
|
formatDefinitionCache.clear();
|
|
199
200
|
formatRegistryCache.clear();
|
|
201
|
+
availableLids = null;
|
|
200
202
|
}
|
|
201
203
|
|
|
202
204
|
/** Loads and caches `<dir>/<lid>.json`; a missing/broken file yields source text. */
|
package/src/index.mjs
CHANGED
|
@@ -386,9 +386,11 @@ export function Speak(_text, _options) {
|
|
|
386
386
|
* { value, label?, checked?, disabled? }.
|
|
387
387
|
*
|
|
388
388
|
* Validation rules: { required?, minLength?, pattern?, minSelected? } —
|
|
389
|
-
* checks run
|
|
389
|
+
* checks run in the webview; required / minSelected also keep the submit
|
|
390
|
+
* button disabled until the form is valid. Multi-select `required` means
|
|
391
|
+
* at least one option.
|
|
390
392
|
*
|
|
391
|
-
* @param {object} _form { title
|
|
393
|
+
* @param {object} _form { title?, submitLabel?, fields: [...] }
|
|
392
394
|
* @returns {Promise<object>} map fieldId -> value
|
|
393
395
|
*/
|
|
394
396
|
export async function RequestForm(_form) {
|