emsdk-env 0.10.0 → 0.11.0
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/build-BbwVl0T6.js +1379 -0
- package/dist/build-BbwVl0T6.js.map +1 -0
- package/dist/build-TpHGBYTu.cjs +1388 -0
- package/dist/build-TpHGBYTu.cjs.map +1 -0
- package/dist/build.d.ts +22 -0
- package/dist/build.d.ts.map +1 -0
- package/dist/commands.d.ts +14 -0
- package/dist/commands.d.ts.map +1 -0
- package/dist/emsdk.d.ts +22 -0
- package/dist/emsdk.d.ts.map +1 -0
- package/dist/env.d.ts +16 -0
- package/dist/env.d.ts.map +1 -0
- package/dist/fs-utils.d.ts +13 -0
- package/dist/fs-utils.d.ts.map +1 -0
- package/dist/generated/packageMetadata.d.ts +18 -0
- package/dist/generated/packageMetadata.d.ts.map +1 -0
- package/dist/index.cjs +11 -14
- package/dist/index.d.ts +17 -338
- package/dist/index.d.ts.map +1 -0
- package/dist/index.mjs +10 -15
- package/dist/logger.d.ts +13 -0
- package/dist/logger.d.ts.map +1 -0
- package/dist/{vite.d.ts → types.d.ts} +299 -268
- package/dist/types.d.ts.map +1 -0
- package/dist/vite/index.d.ts +24 -0
- package/dist/vite/index.d.ts.map +1 -0
- package/dist/vite/logger.d.ts +14 -0
- package/dist/vite/logger.d.ts.map +1 -0
- package/dist/vite/types.d.ts +17 -0
- package/dist/vite/types.d.ts.map +1 -0
- package/dist/vite.cjs +735 -712
- package/dist/vite.cjs.map +1 -1
- package/dist/vite.mjs +729 -712
- package/dist/vite.mjs.map +1 -1
- package/package.json +22 -21
- package/dist/build-BE9Z95iJ.js +0 -1668
- package/dist/build-BE9Z95iJ.js.map +0 -1
- package/dist/build-BGtsNe6D.cjs +0 -1689
- package/dist/build-BGtsNe6D.cjs.map +0 -1
- package/dist/index.cjs.map +0 -1
- package/dist/index.mjs.map +0 -1
package/dist/vite.mjs
CHANGED
|
@@ -1,724 +1,741 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
import { isAbsolute,
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
var
|
|
17
|
-
var
|
|
18
|
-
var
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
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
|
-
function
|
|
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
|
-
|
|
190
|
-
|
|
191
|
-
|
|
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
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
}
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
2
|
+
* name: emsdk-env
|
|
3
|
+
* version: 0.11.0
|
|
4
|
+
* description: Emscripten environment builder
|
|
5
|
+
* author: Kouji Matsui (@kekyo@mi.kekyo.net)
|
|
6
|
+
* license: MIT
|
|
7
|
+
* repository.url: https://github.com/kekyo/emsdk-env
|
|
8
|
+
* git.commit.hash: 0cf3fec6df406458fa2cf19fe561648e1ad4e369
|
|
9
|
+
*/
|
|
10
|
+
import { n as createConsoleLogger, t as buildWasm } from "./build-BbwVl0T6.js";
|
|
11
|
+
import { isAbsolute, relative, resolve } from "path";
|
|
12
|
+
//#region \0rolldown/runtime.js
|
|
13
|
+
var __create = Object.create;
|
|
14
|
+
var __defProp = Object.defineProperty;
|
|
15
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
16
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
17
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
18
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
19
|
+
var __commonJSMin = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
|
|
20
|
+
var __copyProps = (to, from, except, desc) => {
|
|
21
|
+
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
22
|
+
key = keys[i];
|
|
23
|
+
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
24
|
+
get: ((k) => from[k]).bind(null, key),
|
|
25
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
return to;
|
|
29
|
+
};
|
|
30
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
31
|
+
value: mod,
|
|
32
|
+
enumerable: true
|
|
33
|
+
}) : target, mod));
|
|
34
|
+
//#endregion
|
|
35
|
+
//#region node_modules/ms/index.js
|
|
36
|
+
var require_ms = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
37
|
+
/**
|
|
38
|
+
* Helpers.
|
|
39
|
+
*/
|
|
40
|
+
var s = 1e3;
|
|
41
|
+
var m = s * 60;
|
|
42
|
+
var h = m * 60;
|
|
43
|
+
var d = h * 24;
|
|
44
|
+
var w = d * 7;
|
|
45
|
+
var y = d * 365.25;
|
|
46
|
+
/**
|
|
47
|
+
* Parse or format the given `val`.
|
|
48
|
+
*
|
|
49
|
+
* Options:
|
|
50
|
+
*
|
|
51
|
+
* - `long` verbose formatting [false]
|
|
52
|
+
*
|
|
53
|
+
* @param {String|Number} val
|
|
54
|
+
* @param {Object} [options]
|
|
55
|
+
* @throws {Error} throw an error if val is not a non-empty string or a number
|
|
56
|
+
* @return {String|Number}
|
|
57
|
+
* @api public
|
|
58
|
+
*/
|
|
59
|
+
module.exports = function(val, options) {
|
|
60
|
+
options = options || {};
|
|
61
|
+
var type = typeof val;
|
|
62
|
+
if (type === "string" && val.length > 0) return parse(val);
|
|
63
|
+
else if (type === "number" && isFinite(val)) return options.long ? fmtLong(val) : fmtShort(val);
|
|
64
|
+
throw new Error("val is not a non-empty string or a valid number. val=" + JSON.stringify(val));
|
|
65
|
+
};
|
|
66
|
+
/**
|
|
67
|
+
* Parse the given `str` and return milliseconds.
|
|
68
|
+
*
|
|
69
|
+
* @param {String} str
|
|
70
|
+
* @return {Number}
|
|
71
|
+
* @api private
|
|
72
|
+
*/
|
|
73
|
+
function parse(str) {
|
|
74
|
+
str = String(str);
|
|
75
|
+
if (str.length > 100) return;
|
|
76
|
+
var match = /^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(str);
|
|
77
|
+
if (!match) return;
|
|
78
|
+
var n = parseFloat(match[1]);
|
|
79
|
+
switch ((match[2] || "ms").toLowerCase()) {
|
|
80
|
+
case "years":
|
|
81
|
+
case "year":
|
|
82
|
+
case "yrs":
|
|
83
|
+
case "yr":
|
|
84
|
+
case "y": return n * y;
|
|
85
|
+
case "weeks":
|
|
86
|
+
case "week":
|
|
87
|
+
case "w": return n * w;
|
|
88
|
+
case "days":
|
|
89
|
+
case "day":
|
|
90
|
+
case "d": return n * d;
|
|
91
|
+
case "hours":
|
|
92
|
+
case "hour":
|
|
93
|
+
case "hrs":
|
|
94
|
+
case "hr":
|
|
95
|
+
case "h": return n * h;
|
|
96
|
+
case "minutes":
|
|
97
|
+
case "minute":
|
|
98
|
+
case "mins":
|
|
99
|
+
case "min":
|
|
100
|
+
case "m": return n * m;
|
|
101
|
+
case "seconds":
|
|
102
|
+
case "second":
|
|
103
|
+
case "secs":
|
|
104
|
+
case "sec":
|
|
105
|
+
case "s": return n * s;
|
|
106
|
+
case "milliseconds":
|
|
107
|
+
case "millisecond":
|
|
108
|
+
case "msecs":
|
|
109
|
+
case "msec":
|
|
110
|
+
case "ms": return n;
|
|
111
|
+
default: return;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Short format for `ms`.
|
|
116
|
+
*
|
|
117
|
+
* @param {Number} ms
|
|
118
|
+
* @return {String}
|
|
119
|
+
* @api private
|
|
120
|
+
*/
|
|
121
|
+
function fmtShort(ms) {
|
|
122
|
+
var msAbs = Math.abs(ms);
|
|
123
|
+
if (msAbs >= d) return Math.round(ms / d) + "d";
|
|
124
|
+
if (msAbs >= h) return Math.round(ms / h) + "h";
|
|
125
|
+
if (msAbs >= m) return Math.round(ms / m) + "m";
|
|
126
|
+
if (msAbs >= s) return Math.round(ms / s) + "s";
|
|
127
|
+
return ms + "ms";
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Long format for `ms`.
|
|
131
|
+
*
|
|
132
|
+
* @param {Number} ms
|
|
133
|
+
* @return {String}
|
|
134
|
+
* @api private
|
|
135
|
+
*/
|
|
136
|
+
function fmtLong(ms) {
|
|
137
|
+
var msAbs = Math.abs(ms);
|
|
138
|
+
if (msAbs >= d) return plural(ms, msAbs, d, "day");
|
|
139
|
+
if (msAbs >= h) return plural(ms, msAbs, h, "hour");
|
|
140
|
+
if (msAbs >= m) return plural(ms, msAbs, m, "minute");
|
|
141
|
+
if (msAbs >= s) return plural(ms, msAbs, s, "second");
|
|
142
|
+
return ms + " ms";
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Pluralization helper.
|
|
146
|
+
*/
|
|
147
|
+
function plural(ms, msAbs, n, name) {
|
|
148
|
+
var isPlural = msAbs >= n * 1.5;
|
|
149
|
+
return Math.round(ms / n) + " " + name + (isPlural ? "s" : "");
|
|
150
|
+
}
|
|
151
|
+
}));
|
|
152
|
+
//#endregion
|
|
153
|
+
//#region node_modules/debug/src/common.js
|
|
154
|
+
var require_common = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
155
|
+
/**
|
|
156
|
+
* This is the common logic for both the Node.js and web browser
|
|
157
|
+
* implementations of `debug()`.
|
|
158
|
+
*/
|
|
159
|
+
function setup(env) {
|
|
160
|
+
createDebug.debug = createDebug;
|
|
161
|
+
createDebug.default = createDebug;
|
|
162
|
+
createDebug.coerce = coerce;
|
|
163
|
+
createDebug.disable = disable;
|
|
164
|
+
createDebug.enable = enable;
|
|
165
|
+
createDebug.enabled = enabled;
|
|
166
|
+
createDebug.humanize = require_ms();
|
|
167
|
+
createDebug.destroy = destroy;
|
|
168
|
+
Object.keys(env).forEach((key) => {
|
|
169
|
+
createDebug[key] = env[key];
|
|
170
|
+
});
|
|
171
|
+
/**
|
|
172
|
+
* The currently active debug mode names, and names to skip.
|
|
173
|
+
*/
|
|
174
|
+
createDebug.names = [];
|
|
175
|
+
createDebug.skips = [];
|
|
176
|
+
/**
|
|
177
|
+
* Map of special "%n" handling functions, for the debug "format" argument.
|
|
178
|
+
*
|
|
179
|
+
* Valid key names are a single, lower or upper-case letter, i.e. "n" and "N".
|
|
180
|
+
*/
|
|
181
|
+
createDebug.formatters = {};
|
|
182
|
+
/**
|
|
183
|
+
* Selects a color for a debug namespace
|
|
184
|
+
* @param {String} namespace The namespace string for the debug instance to be colored
|
|
185
|
+
* @return {Number|String} An ANSI color code for the given namespace
|
|
186
|
+
* @api private
|
|
187
|
+
*/
|
|
188
|
+
function selectColor(namespace) {
|
|
189
|
+
let hash = 0;
|
|
190
|
+
for (let i = 0; i < namespace.length; i++) {
|
|
191
|
+
hash = (hash << 5) - hash + namespace.charCodeAt(i);
|
|
192
|
+
hash |= 0;
|
|
193
|
+
}
|
|
194
|
+
return createDebug.colors[Math.abs(hash) % createDebug.colors.length];
|
|
195
|
+
}
|
|
196
|
+
createDebug.selectColor = selectColor;
|
|
197
|
+
/**
|
|
198
|
+
* Create a debugger with the given `namespace`.
|
|
199
|
+
*
|
|
200
|
+
* @param {String} namespace
|
|
201
|
+
* @return {Function}
|
|
202
|
+
* @api public
|
|
203
|
+
*/
|
|
204
|
+
function createDebug(namespace) {
|
|
205
|
+
let prevTime;
|
|
206
|
+
let enableOverride = null;
|
|
207
|
+
let namespacesCache;
|
|
208
|
+
let enabledCache;
|
|
209
|
+
function debug(...args) {
|
|
210
|
+
if (!debug.enabled) return;
|
|
211
|
+
const self = debug;
|
|
212
|
+
const curr = Number(/* @__PURE__ */ new Date());
|
|
213
|
+
self.diff = curr - (prevTime || curr);
|
|
214
|
+
self.prev = prevTime;
|
|
215
|
+
self.curr = curr;
|
|
216
|
+
prevTime = curr;
|
|
217
|
+
args[0] = createDebug.coerce(args[0]);
|
|
218
|
+
if (typeof args[0] !== "string") args.unshift("%O");
|
|
219
|
+
let index = 0;
|
|
220
|
+
args[0] = args[0].replace(/%([a-zA-Z%])/g, (match, format) => {
|
|
221
|
+
if (match === "%%") return "%";
|
|
222
|
+
index++;
|
|
223
|
+
const formatter = createDebug.formatters[format];
|
|
224
|
+
if (typeof formatter === "function") {
|
|
225
|
+
const val = args[index];
|
|
226
|
+
match = formatter.call(self, val);
|
|
227
|
+
args.splice(index, 1);
|
|
228
|
+
index--;
|
|
229
|
+
}
|
|
230
|
+
return match;
|
|
231
|
+
});
|
|
232
|
+
createDebug.formatArgs.call(self, args);
|
|
233
|
+
(self.log || createDebug.log).apply(self, args);
|
|
234
|
+
}
|
|
235
|
+
debug.namespace = namespace;
|
|
236
|
+
debug.useColors = createDebug.useColors();
|
|
237
|
+
debug.color = createDebug.selectColor(namespace);
|
|
238
|
+
debug.extend = extend;
|
|
239
|
+
debug.destroy = createDebug.destroy;
|
|
240
|
+
Object.defineProperty(debug, "enabled", {
|
|
241
|
+
enumerable: true,
|
|
242
|
+
configurable: false,
|
|
243
|
+
get: () => {
|
|
244
|
+
if (enableOverride !== null) return enableOverride;
|
|
245
|
+
if (namespacesCache !== createDebug.namespaces) {
|
|
246
|
+
namespacesCache = createDebug.namespaces;
|
|
247
|
+
enabledCache = createDebug.enabled(namespace);
|
|
248
|
+
}
|
|
249
|
+
return enabledCache;
|
|
250
|
+
},
|
|
251
|
+
set: (v) => {
|
|
252
|
+
enableOverride = v;
|
|
253
|
+
}
|
|
254
|
+
});
|
|
255
|
+
if (typeof createDebug.init === "function") createDebug.init(debug);
|
|
256
|
+
return debug;
|
|
257
|
+
}
|
|
258
|
+
function extend(namespace, delimiter) {
|
|
259
|
+
const newDebug = createDebug(this.namespace + (typeof delimiter === "undefined" ? ":" : delimiter) + namespace);
|
|
260
|
+
newDebug.log = this.log;
|
|
261
|
+
return newDebug;
|
|
262
|
+
}
|
|
263
|
+
/**
|
|
264
|
+
* Enables a debug mode by namespaces. This can include modes
|
|
265
|
+
* separated by a colon and wildcards.
|
|
266
|
+
*
|
|
267
|
+
* @param {String} namespaces
|
|
268
|
+
* @api public
|
|
269
|
+
*/
|
|
270
|
+
function enable(namespaces) {
|
|
271
|
+
createDebug.save(namespaces);
|
|
272
|
+
createDebug.namespaces = namespaces;
|
|
273
|
+
createDebug.names = [];
|
|
274
|
+
createDebug.skips = [];
|
|
275
|
+
const split = (typeof namespaces === "string" ? namespaces : "").trim().replace(/\s+/g, ",").split(",").filter(Boolean);
|
|
276
|
+
for (const ns of split) if (ns[0] === "-") createDebug.skips.push(ns.slice(1));
|
|
277
|
+
else createDebug.names.push(ns);
|
|
278
|
+
}
|
|
279
|
+
/**
|
|
280
|
+
* Checks if the given string matches a namespace template, honoring
|
|
281
|
+
* asterisks as wildcards.
|
|
282
|
+
*
|
|
283
|
+
* @param {String} search
|
|
284
|
+
* @param {String} template
|
|
285
|
+
* @return {Boolean}
|
|
286
|
+
*/
|
|
287
|
+
function matchesTemplate(search, template) {
|
|
288
|
+
let searchIndex = 0;
|
|
289
|
+
let templateIndex = 0;
|
|
290
|
+
let starIndex = -1;
|
|
291
|
+
let matchIndex = 0;
|
|
292
|
+
while (searchIndex < search.length) if (templateIndex < template.length && (template[templateIndex] === search[searchIndex] || template[templateIndex] === "*")) if (template[templateIndex] === "*") {
|
|
293
|
+
starIndex = templateIndex;
|
|
294
|
+
matchIndex = searchIndex;
|
|
295
|
+
templateIndex++;
|
|
296
|
+
} else {
|
|
297
|
+
searchIndex++;
|
|
298
|
+
templateIndex++;
|
|
299
|
+
}
|
|
300
|
+
else if (starIndex !== -1) {
|
|
301
|
+
templateIndex = starIndex + 1;
|
|
302
|
+
matchIndex++;
|
|
303
|
+
searchIndex = matchIndex;
|
|
304
|
+
} else return false;
|
|
305
|
+
while (templateIndex < template.length && template[templateIndex] === "*") templateIndex++;
|
|
306
|
+
return templateIndex === template.length;
|
|
307
|
+
}
|
|
308
|
+
/**
|
|
309
|
+
* Disable debug output.
|
|
310
|
+
*
|
|
311
|
+
* @return {String} namespaces
|
|
312
|
+
* @api public
|
|
313
|
+
*/
|
|
314
|
+
function disable() {
|
|
315
|
+
const namespaces = [...createDebug.names, ...createDebug.skips.map((namespace) => "-" + namespace)].join(",");
|
|
316
|
+
createDebug.enable("");
|
|
317
|
+
return namespaces;
|
|
318
|
+
}
|
|
319
|
+
/**
|
|
320
|
+
* Returns true if the given mode name is enabled, false otherwise.
|
|
321
|
+
*
|
|
322
|
+
* @param {String} name
|
|
323
|
+
* @return {Boolean}
|
|
324
|
+
* @api public
|
|
325
|
+
*/
|
|
326
|
+
function enabled(name) {
|
|
327
|
+
for (const skip of createDebug.skips) if (matchesTemplate(name, skip)) return false;
|
|
328
|
+
for (const ns of createDebug.names) if (matchesTemplate(name, ns)) return true;
|
|
329
|
+
return false;
|
|
330
|
+
}
|
|
331
|
+
/**
|
|
332
|
+
* Coerce `val`.
|
|
333
|
+
*
|
|
334
|
+
* @param {Mixed} val
|
|
335
|
+
* @return {Mixed}
|
|
336
|
+
* @api private
|
|
337
|
+
*/
|
|
338
|
+
function coerce(val) {
|
|
339
|
+
if (val instanceof Error) return val.stack || val.message;
|
|
340
|
+
return val;
|
|
341
|
+
}
|
|
342
|
+
/**
|
|
343
|
+
* XXX DO NOT USE. This is a temporary stub function.
|
|
344
|
+
* XXX It WILL be removed in the next major release.
|
|
345
|
+
*/
|
|
346
|
+
function destroy() {
|
|
347
|
+
console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");
|
|
348
|
+
}
|
|
349
|
+
createDebug.enable(createDebug.load());
|
|
350
|
+
return createDebug;
|
|
351
|
+
}
|
|
352
|
+
module.exports = setup;
|
|
353
|
+
}));
|
|
354
|
+
var createDebug = __resolveDefaultExport((/* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
355
|
+
/**
|
|
356
|
+
* This is the web browser implementation of `debug()`.
|
|
357
|
+
*/
|
|
358
|
+
exports.formatArgs = formatArgs;
|
|
359
|
+
exports.save = save;
|
|
360
|
+
exports.load = load;
|
|
361
|
+
exports.useColors = useColors;
|
|
362
|
+
exports.storage = localstorage();
|
|
363
|
+
exports.destroy = (() => {
|
|
364
|
+
let warned = false;
|
|
365
|
+
return () => {
|
|
366
|
+
if (!warned) {
|
|
367
|
+
warned = true;
|
|
368
|
+
console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");
|
|
369
|
+
}
|
|
370
|
+
};
|
|
371
|
+
})();
|
|
372
|
+
/**
|
|
373
|
+
* Colors.
|
|
374
|
+
*/
|
|
375
|
+
exports.colors = [
|
|
376
|
+
"#0000CC",
|
|
377
|
+
"#0000FF",
|
|
378
|
+
"#0033CC",
|
|
379
|
+
"#0033FF",
|
|
380
|
+
"#0066CC",
|
|
381
|
+
"#0066FF",
|
|
382
|
+
"#0099CC",
|
|
383
|
+
"#0099FF",
|
|
384
|
+
"#00CC00",
|
|
385
|
+
"#00CC33",
|
|
386
|
+
"#00CC66",
|
|
387
|
+
"#00CC99",
|
|
388
|
+
"#00CCCC",
|
|
389
|
+
"#00CCFF",
|
|
390
|
+
"#3300CC",
|
|
391
|
+
"#3300FF",
|
|
392
|
+
"#3333CC",
|
|
393
|
+
"#3333FF",
|
|
394
|
+
"#3366CC",
|
|
395
|
+
"#3366FF",
|
|
396
|
+
"#3399CC",
|
|
397
|
+
"#3399FF",
|
|
398
|
+
"#33CC00",
|
|
399
|
+
"#33CC33",
|
|
400
|
+
"#33CC66",
|
|
401
|
+
"#33CC99",
|
|
402
|
+
"#33CCCC",
|
|
403
|
+
"#33CCFF",
|
|
404
|
+
"#6600CC",
|
|
405
|
+
"#6600FF",
|
|
406
|
+
"#6633CC",
|
|
407
|
+
"#6633FF",
|
|
408
|
+
"#66CC00",
|
|
409
|
+
"#66CC33",
|
|
410
|
+
"#9900CC",
|
|
411
|
+
"#9900FF",
|
|
412
|
+
"#9933CC",
|
|
413
|
+
"#9933FF",
|
|
414
|
+
"#99CC00",
|
|
415
|
+
"#99CC33",
|
|
416
|
+
"#CC0000",
|
|
417
|
+
"#CC0033",
|
|
418
|
+
"#CC0066",
|
|
419
|
+
"#CC0099",
|
|
420
|
+
"#CC00CC",
|
|
421
|
+
"#CC00FF",
|
|
422
|
+
"#CC3300",
|
|
423
|
+
"#CC3333",
|
|
424
|
+
"#CC3366",
|
|
425
|
+
"#CC3399",
|
|
426
|
+
"#CC33CC",
|
|
427
|
+
"#CC33FF",
|
|
428
|
+
"#CC6600",
|
|
429
|
+
"#CC6633",
|
|
430
|
+
"#CC9900",
|
|
431
|
+
"#CC9933",
|
|
432
|
+
"#CCCC00",
|
|
433
|
+
"#CCCC33",
|
|
434
|
+
"#FF0000",
|
|
435
|
+
"#FF0033",
|
|
436
|
+
"#FF0066",
|
|
437
|
+
"#FF0099",
|
|
438
|
+
"#FF00CC",
|
|
439
|
+
"#FF00FF",
|
|
440
|
+
"#FF3300",
|
|
441
|
+
"#FF3333",
|
|
442
|
+
"#FF3366",
|
|
443
|
+
"#FF3399",
|
|
444
|
+
"#FF33CC",
|
|
445
|
+
"#FF33FF",
|
|
446
|
+
"#FF6600",
|
|
447
|
+
"#FF6633",
|
|
448
|
+
"#FF9900",
|
|
449
|
+
"#FF9933",
|
|
450
|
+
"#FFCC00",
|
|
451
|
+
"#FFCC33"
|
|
452
|
+
];
|
|
453
|
+
/**
|
|
454
|
+
* Currently only WebKit-based Web Inspectors, Firefox >= v31,
|
|
455
|
+
* and the Firebug extension (any Firefox version) are known
|
|
456
|
+
* to support "%c" CSS customizations.
|
|
457
|
+
*
|
|
458
|
+
* TODO: add a `localStorage` variable to explicitly enable/disable colors
|
|
459
|
+
*/
|
|
460
|
+
function useColors() {
|
|
461
|
+
if (typeof window !== "undefined" && window.process && (window.process.type === "renderer" || window.process.__nwjs)) return true;
|
|
462
|
+
if (typeof navigator !== "undefined" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) return false;
|
|
463
|
+
let m;
|
|
464
|
+
return typeof document !== "undefined" && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance || typeof window !== "undefined" && window.console && (window.console.firebug || window.console.exception && window.console.table) || typeof navigator !== "undefined" && navigator.userAgent && (m = navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)) && parseInt(m[1], 10) >= 31 || typeof navigator !== "undefined" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/);
|
|
465
|
+
}
|
|
466
|
+
/**
|
|
467
|
+
* Colorize log arguments if enabled.
|
|
468
|
+
*
|
|
469
|
+
* @api public
|
|
470
|
+
*/
|
|
471
|
+
function formatArgs(args) {
|
|
472
|
+
args[0] = (this.useColors ? "%c" : "") + this.namespace + (this.useColors ? " %c" : " ") + args[0] + (this.useColors ? "%c " : " ") + "+" + module.exports.humanize(this.diff);
|
|
473
|
+
if (!this.useColors) return;
|
|
474
|
+
const c = "color: " + this.color;
|
|
475
|
+
args.splice(1, 0, c, "color: inherit");
|
|
476
|
+
let index = 0;
|
|
477
|
+
let lastC = 0;
|
|
478
|
+
args[0].replace(/%[a-zA-Z%]/g, (match) => {
|
|
479
|
+
if (match === "%%") return;
|
|
480
|
+
index++;
|
|
481
|
+
if (match === "%c") lastC = index;
|
|
482
|
+
});
|
|
483
|
+
args.splice(lastC, 0, c);
|
|
484
|
+
}
|
|
485
|
+
/**
|
|
486
|
+
* Invokes `console.debug()` when available.
|
|
487
|
+
* No-op when `console.debug` is not a "function".
|
|
488
|
+
* If `console.debug` is not available, falls back
|
|
489
|
+
* to `console.log`.
|
|
490
|
+
*
|
|
491
|
+
* @api public
|
|
492
|
+
*/
|
|
493
|
+
exports.log = console.debug || console.log || (() => {});
|
|
494
|
+
/**
|
|
495
|
+
* Save `namespaces`.
|
|
496
|
+
*
|
|
497
|
+
* @param {String} namespaces
|
|
498
|
+
* @api private
|
|
499
|
+
*/
|
|
500
|
+
function save(namespaces) {
|
|
501
|
+
try {
|
|
502
|
+
if (namespaces) exports.storage.setItem("debug", namespaces);
|
|
503
|
+
else exports.storage.removeItem("debug");
|
|
504
|
+
} catch (error) {}
|
|
505
|
+
}
|
|
506
|
+
/**
|
|
507
|
+
* Load `namespaces`.
|
|
508
|
+
*
|
|
509
|
+
* @return {String} returns the previously persisted debug modes
|
|
510
|
+
* @api private
|
|
511
|
+
*/
|
|
512
|
+
function load() {
|
|
513
|
+
let r;
|
|
514
|
+
try {
|
|
515
|
+
r = exports.storage.getItem("debug") || exports.storage.getItem("DEBUG");
|
|
516
|
+
} catch (error) {}
|
|
517
|
+
if (!r && typeof process !== "undefined" && "env" in process) r = process.env.DEBUG;
|
|
518
|
+
return r;
|
|
519
|
+
}
|
|
520
|
+
/**
|
|
521
|
+
* Localstorage attempts to return the localstorage.
|
|
522
|
+
*
|
|
523
|
+
* This is necessary because safari throws
|
|
524
|
+
* when a user disables cookies/localstorage
|
|
525
|
+
* and you attempt to access it.
|
|
526
|
+
*
|
|
527
|
+
* @return {LocalStorage}
|
|
528
|
+
* @api private
|
|
529
|
+
*/
|
|
530
|
+
function localstorage() {
|
|
531
|
+
try {
|
|
532
|
+
return localStorage;
|
|
533
|
+
} catch (error) {}
|
|
534
|
+
}
|
|
535
|
+
module.exports = require_common()(exports);
|
|
536
|
+
var { formatters } = module.exports;
|
|
537
|
+
/**
|
|
538
|
+
* Map %j to `JSON.stringify()`, since no Web Inspectors do that by default.
|
|
539
|
+
*/
|
|
540
|
+
formatters.j = function(v) {
|
|
541
|
+
try {
|
|
542
|
+
return JSON.stringify(v);
|
|
543
|
+
} catch (error) {
|
|
544
|
+
return "[UnexpectedJSONParseError]: " + error.message;
|
|
545
|
+
}
|
|
546
|
+
};
|
|
547
|
+
})))(), 1)).default, false);
|
|
487
548
|
globalThis.__screwUpIsInCJS_93c24de65540 = false;
|
|
488
549
|
function __resolveDefaultExport(module, isESM) {
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
return hasDefault ? resolvedDefault != null ? resolvedDefault : module : module;
|
|
506
|
-
}
|
|
507
|
-
return hasDefault ? resolvedDefault != null ? resolvedDefault : module : module;
|
|
550
|
+
const __isInCJS = typeof globalThis !== "undefined" && globalThis.__screwUpIsInCJS_93c24de65540 === true;
|
|
551
|
+
const maybe = module;
|
|
552
|
+
const hasDefault = !!(maybe && typeof maybe === "object" && "default" in maybe);
|
|
553
|
+
const unwrapNamespaceDefault = (value) => {
|
|
554
|
+
if (!value || typeof value !== "object") return value;
|
|
555
|
+
const inner = value;
|
|
556
|
+
if ((inner.__esModule === true || typeof Symbol !== "undefined" && inner[Symbol.toStringTag] === "Module") && "default" in inner) return inner.default;
|
|
557
|
+
return value;
|
|
558
|
+
};
|
|
559
|
+
const resolvedDefault = hasDefault ? unwrapNamespaceDefault(maybe.default) : void 0;
|
|
560
|
+
if (__isInCJS) return hasDefault ? resolvedDefault !== null && resolvedDefault !== void 0 ? resolvedDefault : module : module;
|
|
561
|
+
if (isESM) {
|
|
562
|
+
if (hasDefault) return resolvedDefault;
|
|
563
|
+
throw new Error("Default export not found.");
|
|
564
|
+
}
|
|
565
|
+
return hasDefault ? resolvedDefault !== null && resolvedDefault !== void 0 ? resolvedDefault : module : module;
|
|
508
566
|
}
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
error: logLevel !== "silent" ? (msg) => viteLogger.error(`[${prefix}]: ${msg}`) : () => {
|
|
520
|
-
}
|
|
521
|
-
};
|
|
567
|
+
var createViteLoggerAdapter = (viteLogger, logLevel, prefix) => {
|
|
568
|
+
const debug = createDebug("vite:plugin:emsdk-vite");
|
|
569
|
+
return {
|
|
570
|
+
debug: (msg) => {
|
|
571
|
+
debug(msg);
|
|
572
|
+
},
|
|
573
|
+
info: logLevel !== "silent" ? (msg) => viteLogger.info(`[${prefix}]: ${msg}`) : () => {},
|
|
574
|
+
warn: logLevel === "warn" || logLevel === "info" || logLevel === "error" ? (msg) => viteLogger.warn(`[${prefix}]: ${msg}`) : () => {},
|
|
575
|
+
error: logLevel !== "silent" ? (msg) => viteLogger.error(`[${prefix}]: ${msg}`) : () => {}
|
|
576
|
+
};
|
|
522
577
|
};
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
578
|
+
//#endregion
|
|
579
|
+
//#region src/generated/packageMetadata.ts
|
|
580
|
+
var version = "0.11.0";
|
|
581
|
+
var git_commit_hash = "0cf3fec6df406458fa2cf19fe561648e1ad4e369";
|
|
582
|
+
//#endregion
|
|
583
|
+
//#region src/vite/index.ts
|
|
584
|
+
var DEFAULT_WASM_SRC_DIR = "wasm";
|
|
585
|
+
var DEFAULT_WASM_INCLUDE_DIR = "include";
|
|
586
|
+
var buildRuns = /* @__PURE__ */ new Map();
|
|
587
|
+
var resolvePath = (rootDir, value) => isAbsolute(value) ? value : resolve(rootDir, value);
|
|
588
|
+
var expandPlaceholders = (value, env, label) => value.replace(/\{([A-Z0-9_]+)\}/g, (_match, key) => {
|
|
589
|
+
const replacement = env[key];
|
|
590
|
+
if (replacement === void 0) throw new Error(`Unknown placeholder {${key}} in ${label}.`);
|
|
591
|
+
return replacement;
|
|
535
592
|
});
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
return expanded.map((value) => resolvePath(rootDir, value));
|
|
593
|
+
var expandArray = (values, env, label) => values.map((value) => expandPlaceholders(value, env, label));
|
|
594
|
+
var resolveIncludeDirs = (includeDirs, env, rootDir) => {
|
|
595
|
+
return expandArray(includeDirs, env, "includeDirs").map((value) => resolvePath(rootDir, value));
|
|
540
596
|
};
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
logger,
|
|
559
|
-
...emsdk !== void 0 ? { emsdk } : {},
|
|
560
|
-
...srcDir !== void 0 ? { srcDir } : {},
|
|
561
|
-
...includeDir !== void 0 ? { includeDir } : {},
|
|
562
|
-
...imports !== void 0 ? { imports } : {},
|
|
563
|
-
...outDir !== void 0 ? { outDir } : {},
|
|
564
|
-
...libDir !== void 0 ? { libDir } : {},
|
|
565
|
-
...generatedLoader !== void 0 ? { generatedLoader } : {},
|
|
566
|
-
...buildDir !== void 0 ? { buildDir } : {},
|
|
567
|
-
...cleanupBuildDir !== void 0 ? { cleanupBuildDir } : {},
|
|
568
|
-
...parallel !== void 0 ? { parallel } : {}
|
|
569
|
-
};
|
|
597
|
+
var createBuildOptions = (options, resolvedConfig, logger) => {
|
|
598
|
+
const { emsdk, srcDir, includeDir, imports, outDir, libDir, generatedLoader, buildDir, cleanupBuildDir, parallel, ...rule } = options;
|
|
599
|
+
return {
|
|
600
|
+
rule,
|
|
601
|
+
root: resolvedConfig.root,
|
|
602
|
+
logger,
|
|
603
|
+
...emsdk !== void 0 ? { emsdk } : {},
|
|
604
|
+
...srcDir !== void 0 ? { srcDir } : {},
|
|
605
|
+
...includeDir !== void 0 ? { includeDir } : {},
|
|
606
|
+
...imports !== void 0 ? { imports } : {},
|
|
607
|
+
...outDir !== void 0 ? { outDir } : {},
|
|
608
|
+
...libDir !== void 0 ? { libDir } : {},
|
|
609
|
+
...generatedLoader !== void 0 ? { generatedLoader } : {},
|
|
610
|
+
...buildDir !== void 0 ? { buildDir } : {},
|
|
611
|
+
...cleanupBuildDir !== void 0 ? { cleanupBuildDir } : {},
|
|
612
|
+
...parallel !== void 0 ? { parallel } : {}
|
|
613
|
+
};
|
|
570
614
|
};
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
}
|
|
576
|
-
return !rel.startsWith("..") && !isAbsolute(rel);
|
|
615
|
+
var isSubPath = (parentDir, targetPath) => {
|
|
616
|
+
const rel = relative(parentDir, targetPath);
|
|
617
|
+
if (rel === "") return true;
|
|
618
|
+
return !rel.startsWith("..") && !isAbsolute(rel);
|
|
577
619
|
};
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
resolvedIncludeDirs.push(dir);
|
|
616
|
-
}
|
|
617
|
-
};
|
|
618
|
-
const commonIncludeDirs = ((_c = options.common) == null ? void 0 : _c.includeDirs) === void 0 ? [rawIncludeDir] : options.common.includeDirs;
|
|
619
|
-
addIncludePatterns(commonIncludeDirs, void 0);
|
|
620
|
-
for (const [targetName, target] of Object.entries(options.targets)) {
|
|
621
|
-
addIncludePatterns(target.includeDirs, targetName);
|
|
622
|
-
}
|
|
623
|
-
return {
|
|
624
|
-
srcDir,
|
|
625
|
-
includeDirs: resolvedIncludeDirs,
|
|
626
|
-
patterns: [...patterns],
|
|
627
|
-
baseDirs: [...baseDirs]
|
|
628
|
-
};
|
|
620
|
+
var resolveWatchTargets = (options, resolvedConfig) => {
|
|
621
|
+
var _options$srcDir, _options$includeDir, _options$common;
|
|
622
|
+
const rootDir = resolvedConfig.root;
|
|
623
|
+
const baseEnv = { ROOT: rootDir };
|
|
624
|
+
const rawSrcDir = expandPlaceholders((_options$srcDir = options.srcDir) !== null && _options$srcDir !== void 0 ? _options$srcDir : DEFAULT_WASM_SRC_DIR, baseEnv, "srcDir");
|
|
625
|
+
const rawIncludeDir = expandPlaceholders((_options$includeDir = options.includeDir) !== null && _options$includeDir !== void 0 ? _options$includeDir : DEFAULT_WASM_INCLUDE_DIR, baseEnv, "includeDir");
|
|
626
|
+
const srcDir = resolvePath(rootDir, rawSrcDir);
|
|
627
|
+
const envWithDirs = {
|
|
628
|
+
ROOT: rootDir,
|
|
629
|
+
SRC_DIR: srcDir,
|
|
630
|
+
INCLUDE_DIR: resolvePath(rootDir, rawIncludeDir)
|
|
631
|
+
};
|
|
632
|
+
const patterns = /* @__PURE__ */ new Set();
|
|
633
|
+
const baseDirs = /* @__PURE__ */ new Set();
|
|
634
|
+
const resolvedIncludeDirs = [];
|
|
635
|
+
patterns.add(srcDir);
|
|
636
|
+
baseDirs.add(srcDir);
|
|
637
|
+
const addIncludePatterns = (targetIncludeDirs, targetName) => {
|
|
638
|
+
if (!targetIncludeDirs || targetIncludeDirs.length === 0) return;
|
|
639
|
+
const resolvedDirs = resolveIncludeDirs(targetIncludeDirs, targetName ? {
|
|
640
|
+
...envWithDirs,
|
|
641
|
+
TARGET_NAME: targetName
|
|
642
|
+
} : envWithDirs, rootDir);
|
|
643
|
+
for (const dir of resolvedDirs) {
|
|
644
|
+
patterns.add(dir);
|
|
645
|
+
baseDirs.add(dir);
|
|
646
|
+
resolvedIncludeDirs.push(dir);
|
|
647
|
+
}
|
|
648
|
+
};
|
|
649
|
+
addIncludePatterns(((_options$common = options.common) === null || _options$common === void 0 ? void 0 : _options$common.includeDirs) === void 0 ? [rawIncludeDir] : options.common.includeDirs, void 0);
|
|
650
|
+
for (const [targetName, target] of Object.entries(options.targets)) addIncludePatterns(target.includeDirs, targetName);
|
|
651
|
+
return {
|
|
652
|
+
srcDir,
|
|
653
|
+
includeDirs: resolvedIncludeDirs,
|
|
654
|
+
patterns: [...patterns],
|
|
655
|
+
baseDirs: [...baseDirs]
|
|
656
|
+
};
|
|
629
657
|
};
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
return;
|
|
662
|
-
}
|
|
663
|
-
await queueBuild(true);
|
|
664
|
-
};
|
|
665
|
-
server.watcher.on("add", onWatchEvent);
|
|
666
|
-
server.watcher.on("change", onWatchEvent);
|
|
667
|
-
server.watcher.on("unlink", onWatchEvent);
|
|
668
|
-
await queueBuild(false);
|
|
658
|
+
var setupDevServer = async (server, options, resolvedConfig, logger) => {
|
|
659
|
+
const buildOptions = createBuildOptions(options, resolvedConfig, logger);
|
|
660
|
+
const watchTargets = resolveWatchTargets(options, resolvedConfig);
|
|
661
|
+
logger.debug(`watch root: ${resolvedConfig.root}`);
|
|
662
|
+
logger.debug(`watch srcDir: ${watchTargets.srcDir}`);
|
|
663
|
+
logger.debug(`watch includeDirs: ${watchTargets.includeDirs.length > 0 ? watchTargets.includeDirs.join(", ") : "(none)"}`);
|
|
664
|
+
logger.debug(`watch patterns: ${watchTargets.patterns.join(", ")}`);
|
|
665
|
+
logger.debug(`watch baseDirs: ${watchTargets.baseDirs.join(", ")}`);
|
|
666
|
+
if (watchTargets.patterns.length > 0) server.watcher.add(watchTargets.patterns);
|
|
667
|
+
let buildQueue = Promise.resolve();
|
|
668
|
+
const queueBuild = async (shouldReload) => {
|
|
669
|
+
buildQueue = buildQueue.then(async () => {
|
|
670
|
+
try {
|
|
671
|
+
await buildWasm(buildOptions);
|
|
672
|
+
if (shouldReload) server.ws.send({ type: "full-reload" });
|
|
673
|
+
} catch (error) {
|
|
674
|
+
const message = error instanceof Error ? error.message : "Unknown wasm build error.";
|
|
675
|
+
logger.error(`Wasm build failed: ${message}`);
|
|
676
|
+
}
|
|
677
|
+
});
|
|
678
|
+
return buildQueue;
|
|
679
|
+
};
|
|
680
|
+
const onWatchEvent = async (eventPath) => {
|
|
681
|
+
const resolvedPath = isAbsolute(eventPath) ? eventPath : resolve(resolvedConfig.root, eventPath);
|
|
682
|
+
if (!watchTargets.baseDirs.some((dir) => isSubPath(dir, resolvedPath))) return;
|
|
683
|
+
await queueBuild(true);
|
|
684
|
+
};
|
|
685
|
+
server.watcher.on("add", onWatchEvent);
|
|
686
|
+
server.watcher.on("change", onWatchEvent);
|
|
687
|
+
server.watcher.on("unlink", onWatchEvent);
|
|
688
|
+
await queueBuild(false);
|
|
669
689
|
};
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
await setupDevServer(server, options, resolvedConfig, logger);
|
|
718
|
-
}
|
|
719
|
-
};
|
|
690
|
+
/**
|
|
691
|
+
* Vite plugin that builds C/C++ sources into WASM using the Emscripten SDK.
|
|
692
|
+
*
|
|
693
|
+
* In dev (`vite serve`), it watches source/include directories and rebuilds on
|
|
694
|
+
* changes. In build (`vite build`), it performs a one-shot build before bundling.
|
|
695
|
+
*
|
|
696
|
+
* @param options - Plugin options including build rules.
|
|
697
|
+
* @returns Vite plugin instance.
|
|
698
|
+
*/
|
|
699
|
+
var emsdkEnv = (options) => {
|
|
700
|
+
let resolvedConfig;
|
|
701
|
+
let logger = createConsoleLogger("emsdk-env");
|
|
702
|
+
return {
|
|
703
|
+
name: "emsdkEnv",
|
|
704
|
+
enforce: "pre",
|
|
705
|
+
configResolved: (config) => {
|
|
706
|
+
var _resolvedConfig$logLe;
|
|
707
|
+
resolvedConfig = config;
|
|
708
|
+
logger = createViteLoggerAdapter(resolvedConfig.logger, (_resolvedConfig$logLe = resolvedConfig.logLevel) !== null && _resolvedConfig$logLe !== void 0 ? _resolvedConfig$logLe : "info", "emsdk-env");
|
|
709
|
+
logger.info(`${version}-${git_commit_hash}: Started.`);
|
|
710
|
+
},
|
|
711
|
+
buildStart: async () => {
|
|
712
|
+
if (!resolvedConfig) throw new Error("Vite config was not resolved.");
|
|
713
|
+
if (resolvedConfig.command !== "build") return;
|
|
714
|
+
const buildOptions = createBuildOptions(options, resolvedConfig, logger);
|
|
715
|
+
const buildKey = resolvedConfig.root;
|
|
716
|
+
const existing = buildRuns.get(buildKey);
|
|
717
|
+
if (existing) {
|
|
718
|
+
await existing;
|
|
719
|
+
return;
|
|
720
|
+
}
|
|
721
|
+
const run = (async () => {
|
|
722
|
+
try {
|
|
723
|
+
await buildWasm(buildOptions);
|
|
724
|
+
} finally {
|
|
725
|
+
buildRuns.delete(buildKey);
|
|
726
|
+
}
|
|
727
|
+
})();
|
|
728
|
+
buildRuns.set(buildKey, run);
|
|
729
|
+
await run;
|
|
730
|
+
},
|
|
731
|
+
configureServer: async (server) => {
|
|
732
|
+
if (!resolvedConfig) throw new Error("Vite config was not resolved.");
|
|
733
|
+
if (resolvedConfig.command !== "serve") return;
|
|
734
|
+
await setupDevServer(server, options, resolvedConfig, logger);
|
|
735
|
+
}
|
|
736
|
+
};
|
|
720
737
|
};
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
//# sourceMappingURL=vite.mjs.map
|
|
738
|
+
//#endregion
|
|
739
|
+
export { emsdkEnv as default };
|
|
740
|
+
|
|
741
|
+
//# sourceMappingURL=vite.mjs.map
|