gulp-mu-gulp-api 0.3.2 → 0.3.4

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.
Files changed (3) hide show
  1. package/README.md +24 -4
  2. package/package.json +6 -1
  3. package/src/index.mjs +13 -16
package/README.md CHANGED
@@ -1,8 +1,20 @@
1
1
  # gulp-mu-gulp-api
2
2
 
3
- Public task API of the **µGulp™** orchestrator — progress reporting and interactive dashboard inputs from within gulp tasks.
3
+ <p align="center">
4
+ <a href="https://github.com/mamekudz/microGulp">
5
+ <img src="https://raw.githubusercontent.com/mamekudz/microGulp/main/media/logo_readme.png" alt="µGulp logo" width="180">
6
+ </a>
7
+ </p>
4
8
 
5
- Part of the [µGulp™ project on GitHub](https://github.com/mamekudz/microGulp) (subdirectory [`gulp-mu-gulp-api/`](https://github.com/mamekudz/microGulp/tree/main/gulp-mu-gulp-api)).
9
+ <p align="center">
10
+ <a href="https://github.com/mamekudz/microGulp">
11
+ <img src="https://raw.githubusercontent.com/mamekudz/microGulp/main/media/microgulp-ready.png" alt="µGulp ready" width="150">
12
+ </a>
13
+ </p>
14
+
15
+ Public task API of the **µGulp™** orchestrator — progress reporting, i18x console output and interactive dashboard inputs from within gulp tasks.
16
+
17
+ [![npm version](https://img.shields.io/npm/v/gulp-mu-gulp-api.svg)](https://www.npmjs.com/package/gulp-mu-gulp-api) · [µGulp™ on GitHub](https://github.com/mamekudz/microGulp) · [source tree](https://github.com/mamekudz/microGulp/tree/main/gulp-mu-gulp-api)
6
18
 
7
19
  [English](#english) · [Deutsch](#deutsch)
8
20
 
@@ -20,6 +32,10 @@ The module is deliberately **dependency-free** and knows nothing about µGulp™
20
32
  npm install gulp-mu-gulp-api
21
33
  ```
22
34
 
35
+ ### 0.3.3
36
+
37
+ - **Changed** npm README: centered µGulp logo and µGulp ready badge (absolute raw URLs from the µGulp repo).
38
+
23
39
  ### 0.3.2
24
40
 
25
41
  - **Added** `FormatValue()` — renders `<name format="…"/>` placeholders from `<format …>` XML definitions in the consumer project's `i18x/gulp/<lid>.json`.
@@ -171,9 +187,9 @@ MIT — © 2026 Meinolf Amekudzi
171
187
 
172
188
  # Deutsch
173
189
 
174
- **gulp-mu-gulp-api** ist die öffentliche Task-API des **µGulp™**-Orchestrators. Gulp-Tasks (und beliebige npm-Pakete innerhalb des Task-Streams) erhalten damit Zugriff auf die erweiterten µGulp™-Dashboard-Funktionen: Fortschrittsanzeige, Texteingaben mit Validierung, Farb- und Schriftart-Auswahl, Einzel- und Mehrfachauswahl, Slider und komplette Formulare.
190
+ **gulp-mu-gulp-api** ist die öffentliche Task-API des **µGulp™**-Orchestrators. Gulp-Tasks (und beliebige npm-Pakete innerhalb des Task-Streams) erhalten damit Zugriff auf die erweiterten µGulp™-Dashboard-Funktionen: Fortschrittsanzeige, i18x-Konsolenausgabe, Texteingaben mit Validierung, Farb- und Schriftart-Auswahl, Einzel- und Mehrfachauswahl, Slider und komplette Formulare.
175
191
 
176
- Teil des [µGulp™-Projekts auf GitHub](https://github.com/mamekudz/microGulp) (Unterverzeichnis [`gulp-mu-gulp-api/`](https://github.com/mamekudz/microGulp/tree/main/gulp-mu-gulp-api)).
192
+ [![npm version](https://img.shields.io/npm/v/gulp-mu-gulp-api.svg)](https://www.npmjs.com/package/gulp-mu-gulp-api) · [µGulp™ auf GitHub](https://github.com/mamekudz/microGulp)
177
193
 
178
194
  Das Modul ist bewusst **abhängigkeitsfrei** und kennt keine µGulp™-Interna: Läuft der Task unter µGulp™, spricht es direkt über den IPC-Kanal des Worker-Prozesses mit der Engine. Läuft das Gulpfile klassisch über die gulp-CLI, degradieren alle Funktionen sauber — Fortschritt landet auf dem Terminal, Eingaben werden per readline abgefragt (TTY) oder mit den deklarierten Default-Werten beantwortet (CI/non-TTY). Tasks bleiben ohne µGulp™ voll lauffähig.
179
195
 
@@ -183,6 +199,10 @@ Das Modul ist bewusst **abhängigkeitsfrei** und kennt keine µGulp™-Interna:
183
199
  npm install gulp-mu-gulp-api
184
200
  ```
185
201
 
202
+ ### 0.3.3
203
+
204
+ - **Geändert** npm-README: zentriertes µGulp-Logo und µGulp-ready-Badge (absolute raw-URLs aus dem µGulp-Repo).
205
+
186
206
  ### 0.3.2
187
207
 
188
208
  - **Neu** `FormatValue()` — rendert `<name format="…"/>`-Platzhalter aus `<format …>`-XML-Definitionen in `i18x/gulp/<lid>.json` des Verbraucherprojekts.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gulp-mu-gulp-api",
3
- "version": "0.3.2",
3
+ "version": "0.3.4",
4
4
  "description": "Public task API for the µGulp orchestrator: progress reporting, 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",
@@ -43,6 +43,11 @@
43
43
  "publishConfig": {
44
44
  "access": "public"
45
45
  },
46
+ "microgulp": {
47
+ "ready": true,
48
+ "certifiedSince": "0.3.2",
49
+ "role": "official-task-api"
50
+ },
46
51
  "engines": {
47
52
  "node": ">=18"
48
53
  }
package/src/index.mjs CHANGED
@@ -43,7 +43,10 @@ const pendingUiRequests = new Map();
43
43
  * attached dashboard (progress and inputs are rendered in the webview)
44
44
  */
45
45
  export function IsMicroGulp() {
46
- return typeof process.send === 'function' && process.env.MICROGULP === '1';
46
+ // The worker pool sets MICROGULP=1 for every forked task process. Relying
47
+ // only on process.send was too strict — some hosts still stream stdout
48
+ // correctly while structured IPC must be attempted separately.
49
+ return process.env.MICROGULP === '1';
47
50
  }
48
51
 
49
52
  /** Brand-aligned alias for {@link IsMicroGulp}. */
@@ -108,9 +111,12 @@ export function CreateProgress(_label) {
108
111
  };
109
112
  }
110
113
 
111
- // -------------------------------------------------
112
- // structured log output (table / tree)
113
- // -------------------------------------------------
114
+ function _SendStructuredLog(_format, _payload) {
115
+ if (!IsMicroGulp()) return false;
116
+ if (typeof process.send !== 'function') return false;
117
+ process.send({ type: 'structured-log', format: _format, payload: _payload });
118
+ return true;
119
+ }
114
120
 
115
121
  /**
116
122
  * Sends a table to the dashboard log pane. The payload is JSON:
@@ -121,10 +127,7 @@ export function CreateProgress(_label) {
121
127
  */
122
128
  export function LogTable(_spec) {
123
129
  let payload = _NormalizeTableSpec(_spec);
124
- if (IsMicroGulp()) {
125
- process.send({ type: 'structured-log', format: 'table', payload });
126
- return;
127
- }
130
+ if (_SendStructuredLog('table', payload)) return;
128
131
  console.log(_AsciiTable(payload));
129
132
  }
130
133
 
@@ -137,10 +140,7 @@ export function LogTable(_spec) {
137
140
  */
138
141
  export function LogTree(_spec) {
139
142
  let payload = _NormalizeTreeSpec(_spec);
140
- if (IsMicroGulp()) {
141
- process.send({ type: 'structured-log', format: 'tree', payload });
142
- return;
143
- }
143
+ if (_SendStructuredLog('tree', payload)) return;
144
144
  for (let line of _AsciiTreeLines(payload)) console.log(line);
145
145
  }
146
146
 
@@ -153,10 +153,7 @@ export function LogTree(_spec) {
153
153
  */
154
154
  export function LogGallery(_spec) {
155
155
  let payload = _NormalizeGallerySpec(_spec);
156
- if (IsMicroGulp()) {
157
- process.send({ type: 'structured-log', format: 'gallery', payload });
158
- return;
159
- }
156
+ if (_SendStructuredLog('gallery', payload)) return;
160
157
  console.log(_AsciiGallery(payload));
161
158
  }
162
159