@matter/tools 0.11.9 → 0.12.0-alpha.0-20241211-6d80d8b5c
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/cjs/building/project.js +1 -1
- package/dist/cjs/building/project.js.map +1 -1
- package/dist/cjs/index.d.ts +1 -0
- package/dist/cjs/index.d.ts.map +1 -1
- package/dist/cjs/index.js +1 -0
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/running/cli.d.ts.map +1 -1
- package/dist/cjs/running/cli.js +25 -30
- package/dist/cjs/running/cli.js.map +1 -1
- package/dist/cjs/running/ensure-compiled.d.ts +11 -0
- package/dist/cjs/running/ensure-compiled.d.ts.map +1 -0
- package/dist/cjs/running/ensure-compiled.js +69 -0
- package/dist/cjs/running/ensure-compiled.js.map +6 -0
- package/dist/cjs/util/bootstrap.mjs +10 -8
- package/dist/cjs/util/progress.d.ts +2 -1
- package/dist/cjs/util/progress.d.ts.map +1 -1
- package/dist/cjs/util/progress.js +14 -2
- package/dist/cjs/util/progress.js.map +1 -1
- package/dist/esm/building/project.js +2 -2
- package/dist/esm/building/project.js.map +1 -1
- package/dist/esm/index.d.ts +1 -0
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +2 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/running/cli.d.ts.map +1 -1
- package/dist/esm/running/cli.js +27 -32
- package/dist/esm/running/cli.js.map +1 -1
- package/dist/esm/running/ensure-compiled.d.ts +11 -0
- package/dist/esm/running/ensure-compiled.d.ts.map +1 -0
- package/dist/esm/running/ensure-compiled.js +49 -0
- package/dist/esm/running/ensure-compiled.js.map +6 -0
- package/dist/esm/util/bootstrap.mjs +10 -8
- package/dist/esm/util/progress.d.ts +2 -1
- package/dist/esm/util/progress.d.ts.map +1 -1
- package/dist/esm/util/progress.js +15 -3
- package/dist/esm/util/progress.js.map +1 -1
- package/package.json +6 -1
- package/src/building/project.ts +1 -1
- package/src/index.ts +1 -0
- package/src/running/cli.ts +36 -36
- package/src/running/ensure-compiled.ts +57 -0
- package/src/util/bootstrap.mjs +10 -8
- package/src/util/progress.ts +20 -3
package/src/util/bootstrap.mjs
CHANGED
|
@@ -25,13 +25,15 @@ function fatal(why, error) {
|
|
|
25
25
|
async function findFile(name) {
|
|
26
26
|
let dir = dirname(fileURLToPath(import.meta.url));
|
|
27
27
|
while (true) {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
28
|
+
if (!dir.endsWith("/dist/esm")) {
|
|
29
|
+
const path = resolve(dir, name);
|
|
30
|
+
try {
|
|
31
|
+
await stat(path);
|
|
32
|
+
return path;
|
|
33
|
+
} catch (e) {
|
|
34
|
+
if (e.code !== "ENOENT") {
|
|
35
|
+
fatal("there was an unexpected error searching the filesystem", e);
|
|
36
|
+
}
|
|
35
37
|
}
|
|
36
38
|
}
|
|
37
39
|
|
|
@@ -88,7 +90,7 @@ async function bootstrap() {
|
|
|
88
90
|
if (code === 0) {
|
|
89
91
|
resolve();
|
|
90
92
|
} else {
|
|
91
|
-
fatal(`esbuild
|
|
93
|
+
fatal(`esbuild exited with code ${code}`);
|
|
92
94
|
}
|
|
93
95
|
});
|
|
94
96
|
});
|
package/src/util/progress.ts
CHANGED
|
@@ -81,6 +81,7 @@ export class Progress {
|
|
|
81
81
|
#refreshInterval?: ReturnType<typeof setInterval>;
|
|
82
82
|
#spinnerPosition = 0;
|
|
83
83
|
#spinnerWindow?: number;
|
|
84
|
+
#subtasks = Array<string>();
|
|
84
85
|
|
|
85
86
|
constructor() {}
|
|
86
87
|
|
|
@@ -129,7 +130,11 @@ export class Progress {
|
|
|
129
130
|
return;
|
|
130
131
|
}
|
|
131
132
|
|
|
132
|
-
|
|
133
|
+
const subtask = this.#subtasks.length
|
|
134
|
+
? colors.dim(` (${colors.dim(this.#subtasks[this.#subtasks.length - 1])})`)
|
|
135
|
+
: "";
|
|
136
|
+
|
|
137
|
+
writeStatus(` ${colors.yellow(this.#spinner)} ${this.#ongoingText}${subtask}`, true);
|
|
133
138
|
}
|
|
134
139
|
|
|
135
140
|
success(text: string) {
|
|
@@ -169,6 +174,16 @@ export class Progress {
|
|
|
169
174
|
}
|
|
170
175
|
}
|
|
171
176
|
|
|
177
|
+
async subtask(text: string, fn: () => Promise<void>) {
|
|
178
|
+
this.#subtasks.push(text);
|
|
179
|
+
|
|
180
|
+
try {
|
|
181
|
+
await fn();
|
|
182
|
+
} finally {
|
|
183
|
+
this.#subtasks.pop();
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
|
|
172
187
|
#updateSpinner() {
|
|
173
188
|
if (!stdout.isTTY) {
|
|
174
189
|
return false;
|
|
@@ -186,15 +201,17 @@ export class Progress {
|
|
|
186
201
|
return true;
|
|
187
202
|
}
|
|
188
203
|
|
|
189
|
-
async run(what: string, fn: () =>
|
|
204
|
+
async run<T>(what: string, fn: () => T | Promise<T>) {
|
|
190
205
|
this.update(what);
|
|
206
|
+
let result: T;
|
|
191
207
|
try {
|
|
192
|
-
await fn();
|
|
208
|
+
result = await fn();
|
|
193
209
|
} catch (e) {
|
|
194
210
|
this.failure(what);
|
|
195
211
|
throw e;
|
|
196
212
|
}
|
|
197
213
|
this.success(what);
|
|
214
|
+
return result;
|
|
198
215
|
}
|
|
199
216
|
|
|
200
217
|
get #duration() {
|