@meethive/vite 0.0.3 → 0.0.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.
package/dist/index.mjs CHANGED
@@ -1,26 +1,1250 @@
1
- import virtual from "@rollup/plugin-virtual";
2
- import path, { posix, resolve, basename, join, extname, parse, relative, dirname, isAbsolute } from "path";
3
- import { walk } from "estree-walker";
4
- import MagicString from "magic-string";
5
- import path$1 from "node:path";
6
- import { readFileSync, statSync, readdirSync, existsSync, rmSync } from "fs";
7
- import "crypto";
8
- import "./dynamic-remote.mjs";
9
- import { buildSync } from "esbuild";
10
- const EXPOSES_MAP = /* @__PURE__ */ new Map();
11
- const EXPOSES_KEY_MAP = /* @__PURE__ */ new Map();
12
- const SHARED = "shared";
13
- const DYNAMIC_LOADING_CSS = "dynamicLoadingCss";
14
- const DYNAMIC_LOADING_CSS_PREFIX = "__v__css__";
15
- const DEFAULT_ENTRY_FILENAME = "remoteEntry.js";
16
- const builderInfo = {
1
+ // node_modules/.pnpm/@rollup+plugin-virtual@3.0.2_rollup@4.48.1/node_modules/@rollup/plugin-virtual/dist/es/index.js
2
+ import * as path from "path";
3
+ var PREFIX = `\0virtual:`;
4
+ function virtual(modules) {
5
+ const resolvedIds = /* @__PURE__ */ new Map();
6
+ Object.keys(modules).forEach((id) => {
7
+ resolvedIds.set(path.resolve(id), modules[id]);
8
+ });
9
+ return {
10
+ name: "virtual",
11
+ resolveId(id, importer) {
12
+ if (id in modules)
13
+ return PREFIX + id;
14
+ if (importer) {
15
+ const importerNoPrefix = importer.startsWith(PREFIX) ? importer.slice(PREFIX.length) : importer;
16
+ const resolved = path.resolve(path.dirname(importerNoPrefix), id);
17
+ if (resolvedIds.has(resolved))
18
+ return PREFIX + resolved;
19
+ }
20
+ return null;
21
+ },
22
+ load(id) {
23
+ if (id.startsWith(PREFIX)) {
24
+ const idNoPrefix = id.slice(PREFIX.length);
25
+ return idNoPrefix in modules ? modules[idNoPrefix] : resolvedIds.get(idNoPrefix);
26
+ }
27
+ return null;
28
+ }
29
+ };
30
+ }
31
+
32
+ // src/federation/src/index.ts
33
+ import { dirname as dirname3, isAbsolute, relative as relative2, resolve as resolve4 } from "path";
34
+
35
+ // node_modules/.pnpm/estree-walker@3.0.2/node_modules/estree-walker/src/walker.js
36
+ var WalkerBase = class {
37
+ constructor() {
38
+ this.should_skip = false;
39
+ this.should_remove = false;
40
+ this.replacement = null;
41
+ this.context = {
42
+ skip: () => this.should_skip = true,
43
+ remove: () => this.should_remove = true,
44
+ replace: (node) => this.replacement = node
45
+ };
46
+ }
47
+ /**
48
+ *
49
+ * @param {any} parent
50
+ * @param {string} prop
51
+ * @param {number} index
52
+ * @param {BaseNode} node
53
+ */
54
+ replace(parent, prop, index, node) {
55
+ if (parent) {
56
+ if (index !== null) {
57
+ parent[prop][index] = node;
58
+ } else {
59
+ parent[prop] = node;
60
+ }
61
+ }
62
+ }
63
+ /**
64
+ *
65
+ * @param {any} parent
66
+ * @param {string} prop
67
+ * @param {number} index
68
+ */
69
+ remove(parent, prop, index) {
70
+ if (parent) {
71
+ if (index !== null) {
72
+ parent[prop].splice(index, 1);
73
+ } else {
74
+ delete parent[prop];
75
+ }
76
+ }
77
+ }
78
+ };
79
+
80
+ // node_modules/.pnpm/estree-walker@3.0.2/node_modules/estree-walker/src/sync.js
81
+ var SyncWalker = class extends WalkerBase {
82
+ /**
83
+ *
84
+ * @param {SyncHandler} enter
85
+ * @param {SyncHandler} leave
86
+ */
87
+ constructor(enter, leave) {
88
+ super();
89
+ this.enter = enter;
90
+ this.leave = leave;
91
+ }
92
+ /**
93
+ *
94
+ * @param {BaseNode} node
95
+ * @param {BaseNode} parent
96
+ * @param {string} [prop]
97
+ * @param {number} [index]
98
+ * @returns {BaseNode}
99
+ */
100
+ visit(node, parent, prop, index) {
101
+ if (node) {
102
+ if (this.enter) {
103
+ const _should_skip = this.should_skip;
104
+ const _should_remove = this.should_remove;
105
+ const _replacement = this.replacement;
106
+ this.should_skip = false;
107
+ this.should_remove = false;
108
+ this.replacement = null;
109
+ this.enter.call(this.context, node, parent, prop, index);
110
+ if (this.replacement) {
111
+ node = this.replacement;
112
+ this.replace(parent, prop, index, node);
113
+ }
114
+ if (this.should_remove) {
115
+ this.remove(parent, prop, index);
116
+ }
117
+ const skipped = this.should_skip;
118
+ const removed = this.should_remove;
119
+ this.should_skip = _should_skip;
120
+ this.should_remove = _should_remove;
121
+ this.replacement = _replacement;
122
+ if (skipped) return node;
123
+ if (removed) return null;
124
+ }
125
+ for (const key in node) {
126
+ const value = node[key];
127
+ if (typeof value !== "object") {
128
+ continue;
129
+ } else if (Array.isArray(value)) {
130
+ for (let i = 0; i < value.length; i += 1) {
131
+ if (value[i] !== null && typeof value[i].type === "string") {
132
+ if (!this.visit(value[i], node, key, i)) {
133
+ i--;
134
+ }
135
+ }
136
+ }
137
+ } else if (value !== null && typeof value.type === "string") {
138
+ this.visit(value, node, key, null);
139
+ }
140
+ }
141
+ if (this.leave) {
142
+ const _replacement = this.replacement;
143
+ const _should_remove = this.should_remove;
144
+ this.replacement = null;
145
+ this.should_remove = false;
146
+ this.leave.call(this.context, node, parent, prop, index);
147
+ if (this.replacement) {
148
+ node = this.replacement;
149
+ this.replace(parent, prop, index, node);
150
+ }
151
+ if (this.should_remove) {
152
+ this.remove(parent, prop, index);
153
+ }
154
+ const removed = this.should_remove;
155
+ this.replacement = _replacement;
156
+ this.should_remove = _should_remove;
157
+ if (removed) return null;
158
+ }
159
+ }
160
+ return node;
161
+ }
162
+ };
163
+
164
+ // node_modules/.pnpm/estree-walker@3.0.2/node_modules/estree-walker/src/index.js
165
+ function walk(ast, { enter, leave }) {
166
+ const instance = new SyncWalker(enter, leave);
167
+ return instance.visit(ast, null);
168
+ }
169
+
170
+ // node_modules/.pnpm/@jridgewell+sourcemap-codec@1.5.5/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.mjs
171
+ var comma = ",".charCodeAt(0);
172
+ var semicolon = ";".charCodeAt(0);
173
+ var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
174
+ var intToChar = new Uint8Array(64);
175
+ var charToInt = new Uint8Array(128);
176
+ for (let i = 0; i < chars.length; i++) {
177
+ const c = chars.charCodeAt(i);
178
+ intToChar[i] = c;
179
+ charToInt[c] = i;
180
+ }
181
+ function encodeInteger(builder, num, relative3) {
182
+ let delta = num - relative3;
183
+ delta = delta < 0 ? -delta << 1 | 1 : delta << 1;
184
+ do {
185
+ let clamped = delta & 31;
186
+ delta >>>= 5;
187
+ if (delta > 0) clamped |= 32;
188
+ builder.write(intToChar[clamped]);
189
+ } while (delta > 0);
190
+ return num;
191
+ }
192
+ var bufLength = 1024 * 16;
193
+ var td = typeof TextDecoder !== "undefined" ? /* @__PURE__ */ new TextDecoder() : typeof Buffer !== "undefined" ? {
194
+ decode(buf) {
195
+ const out = Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength);
196
+ return out.toString();
197
+ }
198
+ } : {
199
+ decode(buf) {
200
+ let out = "";
201
+ for (let i = 0; i < buf.length; i++) {
202
+ out += String.fromCharCode(buf[i]);
203
+ }
204
+ return out;
205
+ }
206
+ };
207
+ var StringWriter = class {
208
+ constructor() {
209
+ this.pos = 0;
210
+ this.out = "";
211
+ this.buffer = new Uint8Array(bufLength);
212
+ }
213
+ write(v) {
214
+ const { buffer } = this;
215
+ buffer[this.pos++] = v;
216
+ if (this.pos === bufLength) {
217
+ this.out += td.decode(buffer);
218
+ this.pos = 0;
219
+ }
220
+ }
221
+ flush() {
222
+ const { buffer, out, pos } = this;
223
+ return pos > 0 ? out + td.decode(buffer.subarray(0, pos)) : out;
224
+ }
225
+ };
226
+ function encode(decoded) {
227
+ const writer = new StringWriter();
228
+ let sourcesIndex = 0;
229
+ let sourceLine = 0;
230
+ let sourceColumn = 0;
231
+ let namesIndex = 0;
232
+ for (let i = 0; i < decoded.length; i++) {
233
+ const line = decoded[i];
234
+ if (i > 0) writer.write(semicolon);
235
+ if (line.length === 0) continue;
236
+ let genColumn = 0;
237
+ for (let j = 0; j < line.length; j++) {
238
+ const segment = line[j];
239
+ if (j > 0) writer.write(comma);
240
+ genColumn = encodeInteger(writer, segment[0], genColumn);
241
+ if (segment.length === 1) continue;
242
+ sourcesIndex = encodeInteger(writer, segment[1], sourcesIndex);
243
+ sourceLine = encodeInteger(writer, segment[2], sourceLine);
244
+ sourceColumn = encodeInteger(writer, segment[3], sourceColumn);
245
+ if (segment.length === 4) continue;
246
+ namesIndex = encodeInteger(writer, segment[4], namesIndex);
247
+ }
248
+ }
249
+ return writer.flush();
250
+ }
251
+
252
+ // node_modules/.pnpm/magic-string@0.30.17/node_modules/magic-string/dist/magic-string.es.mjs
253
+ var BitSet = class _BitSet {
254
+ constructor(arg) {
255
+ this.bits = arg instanceof _BitSet ? arg.bits.slice() : [];
256
+ }
257
+ add(n2) {
258
+ this.bits[n2 >> 5] |= 1 << (n2 & 31);
259
+ }
260
+ has(n2) {
261
+ return !!(this.bits[n2 >> 5] & 1 << (n2 & 31));
262
+ }
263
+ };
264
+ var Chunk = class _Chunk {
265
+ constructor(start, end, content) {
266
+ this.start = start;
267
+ this.end = end;
268
+ this.original = content;
269
+ this.intro = "";
270
+ this.outro = "";
271
+ this.content = content;
272
+ this.storeName = false;
273
+ this.edited = false;
274
+ {
275
+ this.previous = null;
276
+ this.next = null;
277
+ }
278
+ }
279
+ appendLeft(content) {
280
+ this.outro += content;
281
+ }
282
+ appendRight(content) {
283
+ this.intro = this.intro + content;
284
+ }
285
+ clone() {
286
+ const chunk = new _Chunk(this.start, this.end, this.original);
287
+ chunk.intro = this.intro;
288
+ chunk.outro = this.outro;
289
+ chunk.content = this.content;
290
+ chunk.storeName = this.storeName;
291
+ chunk.edited = this.edited;
292
+ return chunk;
293
+ }
294
+ contains(index) {
295
+ return this.start < index && index < this.end;
296
+ }
297
+ eachNext(fn) {
298
+ let chunk = this;
299
+ while (chunk) {
300
+ fn(chunk);
301
+ chunk = chunk.next;
302
+ }
303
+ }
304
+ eachPrevious(fn) {
305
+ let chunk = this;
306
+ while (chunk) {
307
+ fn(chunk);
308
+ chunk = chunk.previous;
309
+ }
310
+ }
311
+ edit(content, storeName, contentOnly) {
312
+ this.content = content;
313
+ if (!contentOnly) {
314
+ this.intro = "";
315
+ this.outro = "";
316
+ }
317
+ this.storeName = storeName;
318
+ this.edited = true;
319
+ return this;
320
+ }
321
+ prependLeft(content) {
322
+ this.outro = content + this.outro;
323
+ }
324
+ prependRight(content) {
325
+ this.intro = content + this.intro;
326
+ }
327
+ reset() {
328
+ this.intro = "";
329
+ this.outro = "";
330
+ if (this.edited) {
331
+ this.content = this.original;
332
+ this.storeName = false;
333
+ this.edited = false;
334
+ }
335
+ }
336
+ split(index) {
337
+ const sliceIndex = index - this.start;
338
+ const originalBefore = this.original.slice(0, sliceIndex);
339
+ const originalAfter = this.original.slice(sliceIndex);
340
+ this.original = originalBefore;
341
+ const newChunk = new _Chunk(index, this.end, originalAfter);
342
+ newChunk.outro = this.outro;
343
+ this.outro = "";
344
+ this.end = index;
345
+ if (this.edited) {
346
+ newChunk.edit("", false);
347
+ this.content = "";
348
+ } else {
349
+ this.content = originalBefore;
350
+ }
351
+ newChunk.next = this.next;
352
+ if (newChunk.next) newChunk.next.previous = newChunk;
353
+ newChunk.previous = this;
354
+ this.next = newChunk;
355
+ return newChunk;
356
+ }
357
+ toString() {
358
+ return this.intro + this.content + this.outro;
359
+ }
360
+ trimEnd(rx) {
361
+ this.outro = this.outro.replace(rx, "");
362
+ if (this.outro.length) return true;
363
+ const trimmed = this.content.replace(rx, "");
364
+ if (trimmed.length) {
365
+ if (trimmed !== this.content) {
366
+ this.split(this.start + trimmed.length).edit("", void 0, true);
367
+ if (this.edited) {
368
+ this.edit(trimmed, this.storeName, true);
369
+ }
370
+ }
371
+ return true;
372
+ } else {
373
+ this.edit("", void 0, true);
374
+ this.intro = this.intro.replace(rx, "");
375
+ if (this.intro.length) return true;
376
+ }
377
+ }
378
+ trimStart(rx) {
379
+ this.intro = this.intro.replace(rx, "");
380
+ if (this.intro.length) return true;
381
+ const trimmed = this.content.replace(rx, "");
382
+ if (trimmed.length) {
383
+ if (trimmed !== this.content) {
384
+ const newChunk = this.split(this.end - trimmed.length);
385
+ if (this.edited) {
386
+ newChunk.edit(trimmed, this.storeName, true);
387
+ }
388
+ this.edit("", void 0, true);
389
+ }
390
+ return true;
391
+ } else {
392
+ this.edit("", void 0, true);
393
+ this.outro = this.outro.replace(rx, "");
394
+ if (this.outro.length) return true;
395
+ }
396
+ }
397
+ };
398
+ function getBtoa() {
399
+ if (typeof globalThis !== "undefined" && typeof globalThis.btoa === "function") {
400
+ return (str) => globalThis.btoa(unescape(encodeURIComponent(str)));
401
+ } else if (typeof Buffer === "function") {
402
+ return (str) => Buffer.from(str, "utf-8").toString("base64");
403
+ } else {
404
+ return () => {
405
+ throw new Error("Unsupported environment: `window.btoa` or `Buffer` should be supported.");
406
+ };
407
+ }
408
+ }
409
+ var btoa = /* @__PURE__ */ getBtoa();
410
+ var SourceMap = class {
411
+ constructor(properties) {
412
+ this.version = 3;
413
+ this.file = properties.file;
414
+ this.sources = properties.sources;
415
+ this.sourcesContent = properties.sourcesContent;
416
+ this.names = properties.names;
417
+ this.mappings = encode(properties.mappings);
418
+ if (typeof properties.x_google_ignoreList !== "undefined") {
419
+ this.x_google_ignoreList = properties.x_google_ignoreList;
420
+ }
421
+ if (typeof properties.debugId !== "undefined") {
422
+ this.debugId = properties.debugId;
423
+ }
424
+ }
425
+ toString() {
426
+ return JSON.stringify(this);
427
+ }
428
+ toUrl() {
429
+ return "data:application/json;charset=utf-8;base64," + btoa(this.toString());
430
+ }
431
+ };
432
+ function guessIndent(code) {
433
+ const lines = code.split("\n");
434
+ const tabbed = lines.filter((line) => /^\t+/.test(line));
435
+ const spaced = lines.filter((line) => /^ {2,}/.test(line));
436
+ if (tabbed.length === 0 && spaced.length === 0) {
437
+ return null;
438
+ }
439
+ if (tabbed.length >= spaced.length) {
440
+ return " ";
441
+ }
442
+ const min = spaced.reduce((previous, current) => {
443
+ const numSpaces = /^ +/.exec(current)[0].length;
444
+ return Math.min(numSpaces, previous);
445
+ }, Infinity);
446
+ return new Array(min + 1).join(" ");
447
+ }
448
+ function getRelativePath(from, to) {
449
+ const fromParts = from.split(/[/\\]/);
450
+ const toParts = to.split(/[/\\]/);
451
+ fromParts.pop();
452
+ while (fromParts[0] === toParts[0]) {
453
+ fromParts.shift();
454
+ toParts.shift();
455
+ }
456
+ if (fromParts.length) {
457
+ let i = fromParts.length;
458
+ while (i--) fromParts[i] = "..";
459
+ }
460
+ return fromParts.concat(toParts).join("/");
461
+ }
462
+ var toString = Object.prototype.toString;
463
+ function isObject(thing) {
464
+ return toString.call(thing) === "[object Object]";
465
+ }
466
+ function getLocator(source) {
467
+ const originalLines = source.split("\n");
468
+ const lineOffsets = [];
469
+ for (let i = 0, pos = 0; i < originalLines.length; i++) {
470
+ lineOffsets.push(pos);
471
+ pos += originalLines[i].length + 1;
472
+ }
473
+ return function locate(index) {
474
+ let i = 0;
475
+ let j = lineOffsets.length;
476
+ while (i < j) {
477
+ const m = i + j >> 1;
478
+ if (index < lineOffsets[m]) {
479
+ j = m;
480
+ } else {
481
+ i = m + 1;
482
+ }
483
+ }
484
+ const line = i - 1;
485
+ const column = index - lineOffsets[line];
486
+ return { line, column };
487
+ };
488
+ }
489
+ var wordRegex = /\w/;
490
+ var Mappings = class {
491
+ constructor(hires) {
492
+ this.hires = hires;
493
+ this.generatedCodeLine = 0;
494
+ this.generatedCodeColumn = 0;
495
+ this.raw = [];
496
+ this.rawSegments = this.raw[this.generatedCodeLine] = [];
497
+ this.pending = null;
498
+ }
499
+ addEdit(sourceIndex, content, loc, nameIndex) {
500
+ if (content.length) {
501
+ const contentLengthMinusOne = content.length - 1;
502
+ let contentLineEnd = content.indexOf("\n", 0);
503
+ let previousContentLineEnd = -1;
504
+ while (contentLineEnd >= 0 && contentLengthMinusOne > contentLineEnd) {
505
+ const segment2 = [this.generatedCodeColumn, sourceIndex, loc.line, loc.column];
506
+ if (nameIndex >= 0) {
507
+ segment2.push(nameIndex);
508
+ }
509
+ this.rawSegments.push(segment2);
510
+ this.generatedCodeLine += 1;
511
+ this.raw[this.generatedCodeLine] = this.rawSegments = [];
512
+ this.generatedCodeColumn = 0;
513
+ previousContentLineEnd = contentLineEnd;
514
+ contentLineEnd = content.indexOf("\n", contentLineEnd + 1);
515
+ }
516
+ const segment = [this.generatedCodeColumn, sourceIndex, loc.line, loc.column];
517
+ if (nameIndex >= 0) {
518
+ segment.push(nameIndex);
519
+ }
520
+ this.rawSegments.push(segment);
521
+ this.advance(content.slice(previousContentLineEnd + 1));
522
+ } else if (this.pending) {
523
+ this.rawSegments.push(this.pending);
524
+ this.advance(content);
525
+ }
526
+ this.pending = null;
527
+ }
528
+ addUneditedChunk(sourceIndex, chunk, original, loc, sourcemapLocations) {
529
+ let originalCharIndex = chunk.start;
530
+ let first = true;
531
+ let charInHiresBoundary = false;
532
+ while (originalCharIndex < chunk.end) {
533
+ if (original[originalCharIndex] === "\n") {
534
+ loc.line += 1;
535
+ loc.column = 0;
536
+ this.generatedCodeLine += 1;
537
+ this.raw[this.generatedCodeLine] = this.rawSegments = [];
538
+ this.generatedCodeColumn = 0;
539
+ first = true;
540
+ charInHiresBoundary = false;
541
+ } else {
542
+ if (this.hires || first || sourcemapLocations.has(originalCharIndex)) {
543
+ const segment = [this.generatedCodeColumn, sourceIndex, loc.line, loc.column];
544
+ if (this.hires === "boundary") {
545
+ if (wordRegex.test(original[originalCharIndex])) {
546
+ if (!charInHiresBoundary) {
547
+ this.rawSegments.push(segment);
548
+ charInHiresBoundary = true;
549
+ }
550
+ } else {
551
+ this.rawSegments.push(segment);
552
+ charInHiresBoundary = false;
553
+ }
554
+ } else {
555
+ this.rawSegments.push(segment);
556
+ }
557
+ }
558
+ loc.column += 1;
559
+ this.generatedCodeColumn += 1;
560
+ first = false;
561
+ }
562
+ originalCharIndex += 1;
563
+ }
564
+ this.pending = null;
565
+ }
566
+ advance(str) {
567
+ if (!str) return;
568
+ const lines = str.split("\n");
569
+ if (lines.length > 1) {
570
+ for (let i = 0; i < lines.length - 1; i++) {
571
+ this.generatedCodeLine++;
572
+ this.raw[this.generatedCodeLine] = this.rawSegments = [];
573
+ }
574
+ this.generatedCodeColumn = 0;
575
+ }
576
+ this.generatedCodeColumn += lines[lines.length - 1].length;
577
+ }
578
+ };
579
+ var n = "\n";
580
+ var warned = {
581
+ insertLeft: false,
582
+ insertRight: false,
583
+ storeName: false
584
+ };
585
+ var MagicString = class _MagicString {
586
+ constructor(string, options = {}) {
587
+ const chunk = new Chunk(0, string.length, string);
588
+ Object.defineProperties(this, {
589
+ original: { writable: true, value: string },
590
+ outro: { writable: true, value: "" },
591
+ intro: { writable: true, value: "" },
592
+ firstChunk: { writable: true, value: chunk },
593
+ lastChunk: { writable: true, value: chunk },
594
+ lastSearchedChunk: { writable: true, value: chunk },
595
+ byStart: { writable: true, value: {} },
596
+ byEnd: { writable: true, value: {} },
597
+ filename: { writable: true, value: options.filename },
598
+ indentExclusionRanges: { writable: true, value: options.indentExclusionRanges },
599
+ sourcemapLocations: { writable: true, value: new BitSet() },
600
+ storedNames: { writable: true, value: {} },
601
+ indentStr: { writable: true, value: void 0 },
602
+ ignoreList: { writable: true, value: options.ignoreList },
603
+ offset: { writable: true, value: options.offset || 0 }
604
+ });
605
+ this.byStart[0] = chunk;
606
+ this.byEnd[string.length] = chunk;
607
+ }
608
+ addSourcemapLocation(char) {
609
+ this.sourcemapLocations.add(char);
610
+ }
611
+ append(content) {
612
+ if (typeof content !== "string") throw new TypeError("outro content must be a string");
613
+ this.outro += content;
614
+ return this;
615
+ }
616
+ appendLeft(index, content) {
617
+ index = index + this.offset;
618
+ if (typeof content !== "string") throw new TypeError("inserted content must be a string");
619
+ this._split(index);
620
+ const chunk = this.byEnd[index];
621
+ if (chunk) {
622
+ chunk.appendLeft(content);
623
+ } else {
624
+ this.intro += content;
625
+ }
626
+ return this;
627
+ }
628
+ appendRight(index, content) {
629
+ index = index + this.offset;
630
+ if (typeof content !== "string") throw new TypeError("inserted content must be a string");
631
+ this._split(index);
632
+ const chunk = this.byStart[index];
633
+ if (chunk) {
634
+ chunk.appendRight(content);
635
+ } else {
636
+ this.outro += content;
637
+ }
638
+ return this;
639
+ }
640
+ clone() {
641
+ const cloned = new _MagicString(this.original, { filename: this.filename, offset: this.offset });
642
+ let originalChunk = this.firstChunk;
643
+ let clonedChunk = cloned.firstChunk = cloned.lastSearchedChunk = originalChunk.clone();
644
+ while (originalChunk) {
645
+ cloned.byStart[clonedChunk.start] = clonedChunk;
646
+ cloned.byEnd[clonedChunk.end] = clonedChunk;
647
+ const nextOriginalChunk = originalChunk.next;
648
+ const nextClonedChunk = nextOriginalChunk && nextOriginalChunk.clone();
649
+ if (nextClonedChunk) {
650
+ clonedChunk.next = nextClonedChunk;
651
+ nextClonedChunk.previous = clonedChunk;
652
+ clonedChunk = nextClonedChunk;
653
+ }
654
+ originalChunk = nextOriginalChunk;
655
+ }
656
+ cloned.lastChunk = clonedChunk;
657
+ if (this.indentExclusionRanges) {
658
+ cloned.indentExclusionRanges = this.indentExclusionRanges.slice();
659
+ }
660
+ cloned.sourcemapLocations = new BitSet(this.sourcemapLocations);
661
+ cloned.intro = this.intro;
662
+ cloned.outro = this.outro;
663
+ return cloned;
664
+ }
665
+ generateDecodedMap(options) {
666
+ options = options || {};
667
+ const sourceIndex = 0;
668
+ const names = Object.keys(this.storedNames);
669
+ const mappings = new Mappings(options.hires);
670
+ const locate = getLocator(this.original);
671
+ if (this.intro) {
672
+ mappings.advance(this.intro);
673
+ }
674
+ this.firstChunk.eachNext((chunk) => {
675
+ const loc = locate(chunk.start);
676
+ if (chunk.intro.length) mappings.advance(chunk.intro);
677
+ if (chunk.edited) {
678
+ mappings.addEdit(
679
+ sourceIndex,
680
+ chunk.content,
681
+ loc,
682
+ chunk.storeName ? names.indexOf(chunk.original) : -1
683
+ );
684
+ } else {
685
+ mappings.addUneditedChunk(sourceIndex, chunk, this.original, loc, this.sourcemapLocations);
686
+ }
687
+ if (chunk.outro.length) mappings.advance(chunk.outro);
688
+ });
689
+ return {
690
+ file: options.file ? options.file.split(/[/\\]/).pop() : void 0,
691
+ sources: [
692
+ options.source ? getRelativePath(options.file || "", options.source) : options.file || ""
693
+ ],
694
+ sourcesContent: options.includeContent ? [this.original] : void 0,
695
+ names,
696
+ mappings: mappings.raw,
697
+ x_google_ignoreList: this.ignoreList ? [sourceIndex] : void 0
698
+ };
699
+ }
700
+ generateMap(options) {
701
+ return new SourceMap(this.generateDecodedMap(options));
702
+ }
703
+ _ensureindentStr() {
704
+ if (this.indentStr === void 0) {
705
+ this.indentStr = guessIndent(this.original);
706
+ }
707
+ }
708
+ _getRawIndentString() {
709
+ this._ensureindentStr();
710
+ return this.indentStr;
711
+ }
712
+ getIndentString() {
713
+ this._ensureindentStr();
714
+ return this.indentStr === null ? " " : this.indentStr;
715
+ }
716
+ indent(indentStr, options) {
717
+ const pattern = /^[^\r\n]/gm;
718
+ if (isObject(indentStr)) {
719
+ options = indentStr;
720
+ indentStr = void 0;
721
+ }
722
+ if (indentStr === void 0) {
723
+ this._ensureindentStr();
724
+ indentStr = this.indentStr || " ";
725
+ }
726
+ if (indentStr === "") return this;
727
+ options = options || {};
728
+ const isExcluded = {};
729
+ if (options.exclude) {
730
+ const exclusions = typeof options.exclude[0] === "number" ? [options.exclude] : options.exclude;
731
+ exclusions.forEach((exclusion) => {
732
+ for (let i = exclusion[0]; i < exclusion[1]; i += 1) {
733
+ isExcluded[i] = true;
734
+ }
735
+ });
736
+ }
737
+ let shouldIndentNextCharacter = options.indentStart !== false;
738
+ const replacer = (match) => {
739
+ if (shouldIndentNextCharacter) return `${indentStr}${match}`;
740
+ shouldIndentNextCharacter = true;
741
+ return match;
742
+ };
743
+ this.intro = this.intro.replace(pattern, replacer);
744
+ let charIndex = 0;
745
+ let chunk = this.firstChunk;
746
+ while (chunk) {
747
+ const end = chunk.end;
748
+ if (chunk.edited) {
749
+ if (!isExcluded[charIndex]) {
750
+ chunk.content = chunk.content.replace(pattern, replacer);
751
+ if (chunk.content.length) {
752
+ shouldIndentNextCharacter = chunk.content[chunk.content.length - 1] === "\n";
753
+ }
754
+ }
755
+ } else {
756
+ charIndex = chunk.start;
757
+ while (charIndex < end) {
758
+ if (!isExcluded[charIndex]) {
759
+ const char = this.original[charIndex];
760
+ if (char === "\n") {
761
+ shouldIndentNextCharacter = true;
762
+ } else if (char !== "\r" && shouldIndentNextCharacter) {
763
+ shouldIndentNextCharacter = false;
764
+ if (charIndex === chunk.start) {
765
+ chunk.prependRight(indentStr);
766
+ } else {
767
+ this._splitChunk(chunk, charIndex);
768
+ chunk = chunk.next;
769
+ chunk.prependRight(indentStr);
770
+ }
771
+ }
772
+ }
773
+ charIndex += 1;
774
+ }
775
+ }
776
+ charIndex = chunk.end;
777
+ chunk = chunk.next;
778
+ }
779
+ this.outro = this.outro.replace(pattern, replacer);
780
+ return this;
781
+ }
782
+ insert() {
783
+ throw new Error(
784
+ "magicString.insert(...) is deprecated. Use prependRight(...) or appendLeft(...)"
785
+ );
786
+ }
787
+ insertLeft(index, content) {
788
+ if (!warned.insertLeft) {
789
+ console.warn(
790
+ "magicString.insertLeft(...) is deprecated. Use magicString.appendLeft(...) instead"
791
+ );
792
+ warned.insertLeft = true;
793
+ }
794
+ return this.appendLeft(index, content);
795
+ }
796
+ insertRight(index, content) {
797
+ if (!warned.insertRight) {
798
+ console.warn(
799
+ "magicString.insertRight(...) is deprecated. Use magicString.prependRight(...) instead"
800
+ );
801
+ warned.insertRight = true;
802
+ }
803
+ return this.prependRight(index, content);
804
+ }
805
+ move(start, end, index) {
806
+ start = start + this.offset;
807
+ end = end + this.offset;
808
+ index = index + this.offset;
809
+ if (index >= start && index <= end) throw new Error("Cannot move a selection inside itself");
810
+ this._split(start);
811
+ this._split(end);
812
+ this._split(index);
813
+ const first = this.byStart[start];
814
+ const last = this.byEnd[end];
815
+ const oldLeft = first.previous;
816
+ const oldRight = last.next;
817
+ const newRight = this.byStart[index];
818
+ if (!newRight && last === this.lastChunk) return this;
819
+ const newLeft = newRight ? newRight.previous : this.lastChunk;
820
+ if (oldLeft) oldLeft.next = oldRight;
821
+ if (oldRight) oldRight.previous = oldLeft;
822
+ if (newLeft) newLeft.next = first;
823
+ if (newRight) newRight.previous = last;
824
+ if (!first.previous) this.firstChunk = last.next;
825
+ if (!last.next) {
826
+ this.lastChunk = first.previous;
827
+ this.lastChunk.next = null;
828
+ }
829
+ first.previous = newLeft;
830
+ last.next = newRight || null;
831
+ if (!newLeft) this.firstChunk = first;
832
+ if (!newRight) this.lastChunk = last;
833
+ return this;
834
+ }
835
+ overwrite(start, end, content, options) {
836
+ options = options || {};
837
+ return this.update(start, end, content, { ...options, overwrite: !options.contentOnly });
838
+ }
839
+ update(start, end, content, options) {
840
+ start = start + this.offset;
841
+ end = end + this.offset;
842
+ if (typeof content !== "string") throw new TypeError("replacement content must be a string");
843
+ if (this.original.length !== 0) {
844
+ while (start < 0) start += this.original.length;
845
+ while (end < 0) end += this.original.length;
846
+ }
847
+ if (end > this.original.length) throw new Error("end is out of bounds");
848
+ if (start === end)
849
+ throw new Error(
850
+ "Cannot overwrite a zero-length range \u2013 use appendLeft or prependRight instead"
851
+ );
852
+ this._split(start);
853
+ this._split(end);
854
+ if (options === true) {
855
+ if (!warned.storeName) {
856
+ console.warn(
857
+ "The final argument to magicString.overwrite(...) should be an options object. See https://github.com/rich-harris/magic-string"
858
+ );
859
+ warned.storeName = true;
860
+ }
861
+ options = { storeName: true };
862
+ }
863
+ const storeName = options !== void 0 ? options.storeName : false;
864
+ const overwrite = options !== void 0 ? options.overwrite : false;
865
+ if (storeName) {
866
+ const original = this.original.slice(start, end);
867
+ Object.defineProperty(this.storedNames, original, {
868
+ writable: true,
869
+ value: true,
870
+ enumerable: true
871
+ });
872
+ }
873
+ const first = this.byStart[start];
874
+ const last = this.byEnd[end];
875
+ if (first) {
876
+ let chunk = first;
877
+ while (chunk !== last) {
878
+ if (chunk.next !== this.byStart[chunk.end]) {
879
+ throw new Error("Cannot overwrite across a split point");
880
+ }
881
+ chunk = chunk.next;
882
+ chunk.edit("", false);
883
+ }
884
+ first.edit(content, storeName, !overwrite);
885
+ } else {
886
+ const newChunk = new Chunk(start, end, "").edit(content, storeName);
887
+ last.next = newChunk;
888
+ newChunk.previous = last;
889
+ }
890
+ return this;
891
+ }
892
+ prepend(content) {
893
+ if (typeof content !== "string") throw new TypeError("outro content must be a string");
894
+ this.intro = content + this.intro;
895
+ return this;
896
+ }
897
+ prependLeft(index, content) {
898
+ index = index + this.offset;
899
+ if (typeof content !== "string") throw new TypeError("inserted content must be a string");
900
+ this._split(index);
901
+ const chunk = this.byEnd[index];
902
+ if (chunk) {
903
+ chunk.prependLeft(content);
904
+ } else {
905
+ this.intro = content + this.intro;
906
+ }
907
+ return this;
908
+ }
909
+ prependRight(index, content) {
910
+ index = index + this.offset;
911
+ if (typeof content !== "string") throw new TypeError("inserted content must be a string");
912
+ this._split(index);
913
+ const chunk = this.byStart[index];
914
+ if (chunk) {
915
+ chunk.prependRight(content);
916
+ } else {
917
+ this.outro = content + this.outro;
918
+ }
919
+ return this;
920
+ }
921
+ remove(start, end) {
922
+ start = start + this.offset;
923
+ end = end + this.offset;
924
+ if (this.original.length !== 0) {
925
+ while (start < 0) start += this.original.length;
926
+ while (end < 0) end += this.original.length;
927
+ }
928
+ if (start === end) return this;
929
+ if (start < 0 || end > this.original.length) throw new Error("Character is out of bounds");
930
+ if (start > end) throw new Error("end must be greater than start");
931
+ this._split(start);
932
+ this._split(end);
933
+ let chunk = this.byStart[start];
934
+ while (chunk) {
935
+ chunk.intro = "";
936
+ chunk.outro = "";
937
+ chunk.edit("");
938
+ chunk = end > chunk.end ? this.byStart[chunk.end] : null;
939
+ }
940
+ return this;
941
+ }
942
+ reset(start, end) {
943
+ start = start + this.offset;
944
+ end = end + this.offset;
945
+ if (this.original.length !== 0) {
946
+ while (start < 0) start += this.original.length;
947
+ while (end < 0) end += this.original.length;
948
+ }
949
+ if (start === end) return this;
950
+ if (start < 0 || end > this.original.length) throw new Error("Character is out of bounds");
951
+ if (start > end) throw new Error("end must be greater than start");
952
+ this._split(start);
953
+ this._split(end);
954
+ let chunk = this.byStart[start];
955
+ while (chunk) {
956
+ chunk.reset();
957
+ chunk = end > chunk.end ? this.byStart[chunk.end] : null;
958
+ }
959
+ return this;
960
+ }
961
+ lastChar() {
962
+ if (this.outro.length) return this.outro[this.outro.length - 1];
963
+ let chunk = this.lastChunk;
964
+ do {
965
+ if (chunk.outro.length) return chunk.outro[chunk.outro.length - 1];
966
+ if (chunk.content.length) return chunk.content[chunk.content.length - 1];
967
+ if (chunk.intro.length) return chunk.intro[chunk.intro.length - 1];
968
+ } while (chunk = chunk.previous);
969
+ if (this.intro.length) return this.intro[this.intro.length - 1];
970
+ return "";
971
+ }
972
+ lastLine() {
973
+ let lineIndex = this.outro.lastIndexOf(n);
974
+ if (lineIndex !== -1) return this.outro.substr(lineIndex + 1);
975
+ let lineStr = this.outro;
976
+ let chunk = this.lastChunk;
977
+ do {
978
+ if (chunk.outro.length > 0) {
979
+ lineIndex = chunk.outro.lastIndexOf(n);
980
+ if (lineIndex !== -1) return chunk.outro.substr(lineIndex + 1) + lineStr;
981
+ lineStr = chunk.outro + lineStr;
982
+ }
983
+ if (chunk.content.length > 0) {
984
+ lineIndex = chunk.content.lastIndexOf(n);
985
+ if (lineIndex !== -1) return chunk.content.substr(lineIndex + 1) + lineStr;
986
+ lineStr = chunk.content + lineStr;
987
+ }
988
+ if (chunk.intro.length > 0) {
989
+ lineIndex = chunk.intro.lastIndexOf(n);
990
+ if (lineIndex !== -1) return chunk.intro.substr(lineIndex + 1) + lineStr;
991
+ lineStr = chunk.intro + lineStr;
992
+ }
993
+ } while (chunk = chunk.previous);
994
+ lineIndex = this.intro.lastIndexOf(n);
995
+ if (lineIndex !== -1) return this.intro.substr(lineIndex + 1) + lineStr;
996
+ return this.intro + lineStr;
997
+ }
998
+ slice(start = 0, end = this.original.length - this.offset) {
999
+ start = start + this.offset;
1000
+ end = end + this.offset;
1001
+ if (this.original.length !== 0) {
1002
+ while (start < 0) start += this.original.length;
1003
+ while (end < 0) end += this.original.length;
1004
+ }
1005
+ let result = "";
1006
+ let chunk = this.firstChunk;
1007
+ while (chunk && (chunk.start > start || chunk.end <= start)) {
1008
+ if (chunk.start < end && chunk.end >= end) {
1009
+ return result;
1010
+ }
1011
+ chunk = chunk.next;
1012
+ }
1013
+ if (chunk && chunk.edited && chunk.start !== start)
1014
+ throw new Error(`Cannot use replaced character ${start} as slice start anchor.`);
1015
+ const startChunk = chunk;
1016
+ while (chunk) {
1017
+ if (chunk.intro && (startChunk !== chunk || chunk.start === start)) {
1018
+ result += chunk.intro;
1019
+ }
1020
+ const containsEnd = chunk.start < end && chunk.end >= end;
1021
+ if (containsEnd && chunk.edited && chunk.end !== end)
1022
+ throw new Error(`Cannot use replaced character ${end} as slice end anchor.`);
1023
+ const sliceStart = startChunk === chunk ? start - chunk.start : 0;
1024
+ const sliceEnd = containsEnd ? chunk.content.length + end - chunk.end : chunk.content.length;
1025
+ result += chunk.content.slice(sliceStart, sliceEnd);
1026
+ if (chunk.outro && (!containsEnd || chunk.end === end)) {
1027
+ result += chunk.outro;
1028
+ }
1029
+ if (containsEnd) {
1030
+ break;
1031
+ }
1032
+ chunk = chunk.next;
1033
+ }
1034
+ return result;
1035
+ }
1036
+ // TODO deprecate this? not really very useful
1037
+ snip(start, end) {
1038
+ const clone = this.clone();
1039
+ clone.remove(0, start);
1040
+ clone.remove(end, clone.original.length);
1041
+ return clone;
1042
+ }
1043
+ _split(index) {
1044
+ if (this.byStart[index] || this.byEnd[index]) return;
1045
+ let chunk = this.lastSearchedChunk;
1046
+ const searchForward = index > chunk.end;
1047
+ while (chunk) {
1048
+ if (chunk.contains(index)) return this._splitChunk(chunk, index);
1049
+ chunk = searchForward ? this.byStart[chunk.end] : this.byEnd[chunk.start];
1050
+ }
1051
+ }
1052
+ _splitChunk(chunk, index) {
1053
+ if (chunk.edited && chunk.content.length) {
1054
+ const loc = getLocator(this.original)(index);
1055
+ throw new Error(
1056
+ `Cannot split a chunk that has already been edited (${loc.line}:${loc.column} \u2013 "${chunk.original}")`
1057
+ );
1058
+ }
1059
+ const newChunk = chunk.split(index);
1060
+ this.byEnd[index] = chunk;
1061
+ this.byStart[index] = newChunk;
1062
+ this.byEnd[newChunk.end] = newChunk;
1063
+ if (chunk === this.lastChunk) this.lastChunk = newChunk;
1064
+ this.lastSearchedChunk = chunk;
1065
+ return true;
1066
+ }
1067
+ toString() {
1068
+ let str = this.intro;
1069
+ let chunk = this.firstChunk;
1070
+ while (chunk) {
1071
+ str += chunk.toString();
1072
+ chunk = chunk.next;
1073
+ }
1074
+ return str + this.outro;
1075
+ }
1076
+ isEmpty() {
1077
+ let chunk = this.firstChunk;
1078
+ do {
1079
+ if (chunk.intro.length && chunk.intro.trim() || chunk.content.length && chunk.content.trim() || chunk.outro.length && chunk.outro.trim())
1080
+ return false;
1081
+ } while (chunk = chunk.next);
1082
+ return true;
1083
+ }
1084
+ length() {
1085
+ let chunk = this.firstChunk;
1086
+ let length = 0;
1087
+ do {
1088
+ length += chunk.intro.length + chunk.content.length + chunk.outro.length;
1089
+ } while (chunk = chunk.next);
1090
+ return length;
1091
+ }
1092
+ trimLines() {
1093
+ return this.trim("[\\r\\n]");
1094
+ }
1095
+ trim(charType) {
1096
+ return this.trimStart(charType).trimEnd(charType);
1097
+ }
1098
+ trimEndAborted(charType) {
1099
+ const rx = new RegExp((charType || "\\s") + "+$");
1100
+ this.outro = this.outro.replace(rx, "");
1101
+ if (this.outro.length) return true;
1102
+ let chunk = this.lastChunk;
1103
+ do {
1104
+ const end = chunk.end;
1105
+ const aborted = chunk.trimEnd(rx);
1106
+ if (chunk.end !== end) {
1107
+ if (this.lastChunk === chunk) {
1108
+ this.lastChunk = chunk.next;
1109
+ }
1110
+ this.byEnd[chunk.end] = chunk;
1111
+ this.byStart[chunk.next.start] = chunk.next;
1112
+ this.byEnd[chunk.next.end] = chunk.next;
1113
+ }
1114
+ if (aborted) return true;
1115
+ chunk = chunk.previous;
1116
+ } while (chunk);
1117
+ return false;
1118
+ }
1119
+ trimEnd(charType) {
1120
+ this.trimEndAborted(charType);
1121
+ return this;
1122
+ }
1123
+ trimStartAborted(charType) {
1124
+ const rx = new RegExp("^" + (charType || "\\s") + "+");
1125
+ this.intro = this.intro.replace(rx, "");
1126
+ if (this.intro.length) return true;
1127
+ let chunk = this.firstChunk;
1128
+ do {
1129
+ const end = chunk.end;
1130
+ const aborted = chunk.trimStart(rx);
1131
+ if (chunk.end !== end) {
1132
+ if (chunk === this.lastChunk) this.lastChunk = chunk.next;
1133
+ this.byEnd[chunk.end] = chunk;
1134
+ this.byStart[chunk.next.start] = chunk.next;
1135
+ this.byEnd[chunk.next.end] = chunk.next;
1136
+ }
1137
+ if (aborted) return true;
1138
+ chunk = chunk.next;
1139
+ } while (chunk);
1140
+ return false;
1141
+ }
1142
+ trimStart(charType) {
1143
+ this.trimStartAborted(charType);
1144
+ return this;
1145
+ }
1146
+ hasChanged() {
1147
+ return this.original !== this.toString();
1148
+ }
1149
+ _replaceRegexp(searchValue, replacement) {
1150
+ function getReplacement(match, str) {
1151
+ if (typeof replacement === "string") {
1152
+ return replacement.replace(/\$(\$|&|\d+)/g, (_, i) => {
1153
+ if (i === "$") return "$";
1154
+ if (i === "&") return match[0];
1155
+ const num = +i;
1156
+ if (num < match.length) return match[+i];
1157
+ return `$${i}`;
1158
+ });
1159
+ } else {
1160
+ return replacement(...match, match.index, str, match.groups);
1161
+ }
1162
+ }
1163
+ function matchAll(re, str) {
1164
+ let match;
1165
+ const matches2 = [];
1166
+ while (match = re.exec(str)) {
1167
+ matches2.push(match);
1168
+ }
1169
+ return matches2;
1170
+ }
1171
+ if (searchValue.global) {
1172
+ const matches2 = matchAll(searchValue, this.original);
1173
+ matches2.forEach((match) => {
1174
+ if (match.index != null) {
1175
+ const replacement2 = getReplacement(match, this.original);
1176
+ if (replacement2 !== match[0]) {
1177
+ this.overwrite(match.index, match.index + match[0].length, replacement2);
1178
+ }
1179
+ }
1180
+ });
1181
+ } else {
1182
+ const match = this.original.match(searchValue);
1183
+ if (match && match.index != null) {
1184
+ const replacement2 = getReplacement(match, this.original);
1185
+ if (replacement2 !== match[0]) {
1186
+ this.overwrite(match.index, match.index + match[0].length, replacement2);
1187
+ }
1188
+ }
1189
+ }
1190
+ return this;
1191
+ }
1192
+ _replaceString(string, replacement) {
1193
+ const { original } = this;
1194
+ const index = original.indexOf(string);
1195
+ if (index !== -1) {
1196
+ this.overwrite(index, index + string.length, replacement);
1197
+ }
1198
+ return this;
1199
+ }
1200
+ replace(searchValue, replacement) {
1201
+ if (typeof searchValue === "string") {
1202
+ return this._replaceString(searchValue, replacement);
1203
+ }
1204
+ return this._replaceRegexp(searchValue, replacement);
1205
+ }
1206
+ _replaceAllString(string, replacement) {
1207
+ const { original } = this;
1208
+ const stringLength = string.length;
1209
+ for (let index = original.indexOf(string); index !== -1; index = original.indexOf(string, index + stringLength)) {
1210
+ const previous = original.slice(index, index + stringLength);
1211
+ if (previous !== replacement) this.overwrite(index, index + stringLength, replacement);
1212
+ }
1213
+ return this;
1214
+ }
1215
+ replaceAll(searchValue, replacement) {
1216
+ if (typeof searchValue === "string") {
1217
+ return this._replaceAllString(searchValue, replacement);
1218
+ }
1219
+ if (!searchValue.global) {
1220
+ throw new TypeError(
1221
+ "MagicString.prototype.replaceAll called with a non-global RegExp argument"
1222
+ );
1223
+ }
1224
+ return this._replaceRegexp(searchValue, replacement);
1225
+ }
1226
+ };
1227
+
1228
+ // src/federation/src/prod/remote-production.ts
1229
+ import path3 from "path";
1230
+
1231
+ // src/federation/src/public.ts
1232
+ var EXPOSES_MAP = /* @__PURE__ */ new Map();
1233
+ var EXPOSES_KEY_MAP = /* @__PURE__ */ new Map();
1234
+ var SHARED = "shared";
1235
+ var DYNAMIC_LOADING_CSS = "dynamicLoadingCss";
1236
+ var DYNAMIC_LOADING_CSS_PREFIX = "__v__css__";
1237
+ var DEFAULT_ENTRY_FILENAME = "remoteEntry.js";
1238
+ var EXTERNALS = [];
1239
+ var builderInfo = {
17
1240
  builder: "rollup",
1241
+ version: "",
18
1242
  assetsDir: "",
19
1243
  isHost: false,
20
1244
  isRemote: false,
21
1245
  isShared: false
22
1246
  };
23
- const parsedOptions = {
1247
+ var parsedOptions = {
24
1248
  prodExpose: [],
25
1249
  prodRemote: [],
26
1250
  prodShared: [],
@@ -28,12 +1252,17 @@ const parsedOptions = {
28
1252
  devExpose: [],
29
1253
  devRemote: []
30
1254
  };
31
- const devRemotes = [];
32
- const prodRemotes = [];
33
- const viteConfigResolved = {
1255
+ var devRemotes = [];
1256
+ var prodRemotes = [];
1257
+ var viteConfigResolved = {
34
1258
  config: void 0
35
1259
  };
36
- const unaryTags = /* @__PURE__ */ new Set(["link", "meta", "base"]);
1260
+
1261
+ // src/federation/src/utils/index.ts
1262
+ import path2, { parse, posix } from "path";
1263
+
1264
+ // src/federation/src/utils/html.ts
1265
+ var unaryTags = /* @__PURE__ */ new Set(["link", "meta", "base"]);
37
1266
  function serializeTag({ tag, attrs, children }, indent = "") {
38
1267
  if (unaryTags.has(tag)) {
39
1268
  return `<${tag}${serializeAttrs(attrs)}>`;
@@ -67,7 +1296,7 @@ function serializeAttrs(attrs) {
67
1296
  function incrementIndent(indent = "") {
68
1297
  return `${indent}${indent[0] === " " ? " " : " "}`;
69
1298
  }
70
- const matchHtmlRegExp = /["'&<>]/;
1299
+ var matchHtmlRegExp = /["'&<>]/;
71
1300
  function escapeHtml(string) {
72
1301
  const str = "" + string;
73
1302
  const match = matchHtmlRegExp.exec(str);
@@ -106,12 +1335,12 @@ function escapeHtml(string) {
106
1335
  }
107
1336
  return lastIndex !== index ? html + str.substring(lastIndex, index) : html;
108
1337
  }
109
- const headInjectRE = /([ \t]*)<\/head>/i;
110
- const headPrependInjectRE = /([ \t]*)<head[^>]*>/i;
111
- const htmlPrependInjectRE = /([ \t]*)<html[^>]*>/i;
112
- const bodyPrependInjectRE = /([ \t]*)<body[^>]*>/i;
113
- const doctypePrependInjectRE = /<!doctype html>/i;
114
- const toPreloadTag = (href) => ({
1338
+ var headInjectRE = /([ \t]*)<\/head>/i;
1339
+ var headPrependInjectRE = /([ \t]*)<head[^>]*>/i;
1340
+ var htmlPrependInjectRE = /([ \t]*)<html[^>]*>/i;
1341
+ var bodyPrependInjectRE = /([ \t]*)<body[^>]*>/i;
1342
+ var doctypePrependInjectRE = /<!doctype html>/i;
1343
+ var toPreloadTag = (href) => ({
115
1344
  tag: "link",
116
1345
  attrs: {
117
1346
  rel: "modulepreload",
@@ -157,6 +1386,8 @@ ${serializeTags(tags)}`);
157
1386
  }
158
1387
  return serializeTags(tags) + html;
159
1388
  }
1389
+
1390
+ // src/federation/src/utils/index.ts
160
1391
  function parseSharedOptions(options) {
161
1392
  return parseOptions(
162
1393
  options.shared || {},
@@ -250,7 +1481,7 @@ function parseOptions(options, normalizeSimple, normalizeOptions) {
250
1481
  }
251
1482
  return list;
252
1483
  }
253
- const letterReg = new RegExp("[0-9a-zA-Z]+");
1484
+ var letterReg = new RegExp("[0-9a-zA-Z]+");
254
1485
  function removeNonRegLetter(str, reg = letterReg) {
255
1486
  let needUpperCase = false;
256
1487
  let ret = "";
@@ -290,10 +1521,12 @@ function getFileExtname(url) {
290
1521
  const fileNameAndParamArr = normalizePath(url).split("/");
291
1522
  const fileNameAndParam = fileNameAndParamArr[fileNameAndParamArr.length - 1];
292
1523
  const fileName = fileNameAndParam.split("?")[0];
293
- return path.extname(fileName);
1524
+ return path2.extname(fileName);
294
1525
  }
295
- const REMOTE_FROM_PARAMETER = "remoteFrom";
296
- const NAME_CHAR_REG = new RegExp("[0-9a-zA-Z@_-]+");
1526
+ var REMOTE_FROM_PARAMETER = "remoteFrom";
1527
+ var NAME_CHAR_REG = new RegExp("[0-9a-zA-Z@_-]+");
1528
+
1529
+ // src/federation/src/prod/remote-production.ts
297
1530
  function joinUrlSegments(a, b) {
298
1531
  if (!a || !b) {
299
1532
  return a || b || "";
@@ -308,7 +1541,7 @@ function joinUrlSegments(a, b) {
308
1541
  }
309
1542
  function toOutputFilePathWithoutRuntime(filename, type, hostId, hostType, config, toRelative) {
310
1543
  const { renderBuiltUrl } = config.experimental;
311
- let relative2 = config.base === "" || config.base === "./";
1544
+ let relative3 = config.base === "" || config.base === "./";
312
1545
  if (renderBuiltUrl) {
313
1546
  const result = renderBuiltUrl(filename, {
314
1547
  hostId,
@@ -323,13 +1556,13 @@ function toOutputFilePathWithoutRuntime(filename, type, hostId, hostType, config
323
1556
  );
324
1557
  }
325
1558
  if (typeof result.relative === "boolean") {
326
- relative2 = result.relative;
1559
+ relative3 = result.relative;
327
1560
  }
328
1561
  } else if (result) {
329
1562
  return result;
330
1563
  }
331
1564
  }
332
- if (relative2 && !config.build.ssr) {
1565
+ if (relative3 && !config.build.ssr) {
333
1566
  return toRelative(filename, hostId);
334
1567
  } else {
335
1568
  return joinUrlSegments(config.base, filename);
@@ -556,6 +1789,7 @@ function prodRemotePlugin(options) {
556
1789
  let manualRequired = null;
557
1790
  walk(ast, {
558
1791
  enter(node) {
1792
+ var _a, _b, _c, _d, _e;
559
1793
  if (node.type === "ImportDeclaration") {
560
1794
  const moduleName = node.source.value;
561
1795
  if (parsedOptions.prodShared.some(
@@ -563,12 +1797,13 @@ function prodRemotePlugin(options) {
563
1797
  )) {
564
1798
  const namedImportDeclaration = [];
565
1799
  let defaultImportDeclaration = null;
566
- if (!node.specifiers?.length) {
1800
+ if (!((_a = node.specifiers) == null ? void 0 : _a.length)) {
567
1801
  magicString.remove(node.start, node.end);
568
1802
  modify = true;
569
1803
  } else {
570
1804
  node.specifiers.forEach((specify) => {
571
- if (specify.imported?.name) {
1805
+ var _a2;
1806
+ if ((_a2 = specify.imported) == null ? void 0 : _a2.name) {
572
1807
  namedImportDeclaration.push(
573
1808
  `${specify.imported.name === specify.local.name ? specify.imported.name : `${specify.imported.name}:${specify.local.name}`}`
574
1809
  );
@@ -603,13 +1838,13 @@ const {${imports}} = ${defaultImportDeclaration};
603
1838
  }
604
1839
  }
605
1840
  }
606
- if (node.type === "ImportDeclaration" && node.source?.value === "virtual:__federation__") {
1841
+ if (node.type === "ImportDeclaration" && ((_b = node.source) == null ? void 0 : _b.value) === "virtual:__federation__") {
607
1842
  manualRequired = node;
608
1843
  }
609
- if ((node.type === "ImportExpression" || node.type === "ImportDeclaration" || node.type === "ExportNamedDeclaration") && node.source?.value?.indexOf("/") > -1) {
1844
+ if ((node.type === "ImportExpression" || node.type === "ImportDeclaration" || node.type === "ExportNamedDeclaration") && ((_d = (_c = node.source) == null ? void 0 : _c.value) == null ? void 0 : _d.indexOf("/")) > -1) {
610
1845
  const moduleId = node.source.value;
611
1846
  const remote = prodRemotes.find((r) => r.regexp.test(moduleId));
612
- const needWrap = remote?.config.from === "vite";
1847
+ const needWrap = (remote == null ? void 0 : remote.config.from) === "vite";
613
1848
  if (remote) {
614
1849
  requiresRuntime = true;
615
1850
  const modName = `.${moduleId.slice(remote.id.length)}`;
@@ -627,7 +1862,7 @@ const {${imports}} = ${defaultImportDeclaration};
627
1862
  break;
628
1863
  }
629
1864
  case "ImportDeclaration": {
630
- if (node.specifiers?.length) {
1865
+ if ((_e = node.specifiers) == null ? void 0 : _e.length) {
631
1866
  const afterImportName = `__federation_var_${moduleId.replace(
632
1867
  /[@/\\.-]/g,
633
1868
  ""
@@ -791,8 +2026,8 @@ const {${imports}} = ${defaultImportDeclaration};
791
2026
  Object.keys(entryChunk).forEach((fileName) => {
792
2027
  let html = entryChunk[fileName].source;
793
2028
  const htmlPath = entryChunk[fileName].fileName;
794
- const basePath = resolvedConfig.base === "./" || resolvedConfig.base === "" ? path$1.posix.join(
795
- path$1.posix.relative(entryChunk[fileName].fileName, "").slice(0, -2),
2029
+ const basePath = resolvedConfig.base === "./" || resolvedConfig.base === "" ? path3.posix.join(
2030
+ path3.posix.relative(entryChunk[fileName].fileName, "").slice(0, -2),
796
2031
  "./"
797
2032
  ) : resolvedConfig.base;
798
2033
  const toOutputFilePath = (filename) => toOutputFilePathWithoutRuntime(
@@ -824,8 +2059,16 @@ const {${imports}} = ${defaultImportDeclaration};
824
2059
  }
825
2060
  };
826
2061
  }
827
- const federation_fn_import = "import { satisfy } from '__federation_fn_satisfy'\r\n\r\nconst currentImports = {}\r\n\r\n// eslint-disable-next-line no-undef\r\nconst moduleMap = __rf_var__moduleMap\r\nconst moduleCache = Object.create(null)\r\nasync function importShared(name, shareScope = 'default') {\r\n return moduleCache[name]\r\n ? new Promise((r) => r(moduleCache[name]))\r\n : (await getSharedFromRuntime(name, shareScope)) || getSharedFromLocal(name)\r\n}\r\n// eslint-disable-next-line\r\nasync function __federation_import(name) {\r\n currentImports[name] ??= import(name)\r\n return currentImports[name]\r\n}\r\nasync function getSharedFromRuntime(name, shareScope) {\r\n let module = null\r\n if (globalThis?.__federation_shared__?.[shareScope]?.[name]) {\r\n const versionObj = globalThis.__federation_shared__[shareScope][name]\r\n const requiredVersion = moduleMap[name]?.requiredVersion\r\n const hasRequiredVersion = !!requiredVersion\r\n if (hasRequiredVersion) {\r\n const versionKey = Object.keys(versionObj).find((version) =>\r\n satisfy(version, requiredVersion)\r\n )\r\n if (versionKey) {\r\n const versionValue = versionObj[versionKey]\r\n module = await (await versionValue.get())()\r\n } else {\r\n console.log(\r\n `provider support ${name}(${versionKey}) is not satisfied requiredVersion(\\${moduleMap[name].requiredVersion})`\r\n )\r\n }\r\n } else {\r\n const versionKey = Object.keys(versionObj)[0]\r\n const versionValue = versionObj[versionKey]\r\n module = await (await versionValue.get())()\r\n }\r\n }\r\n if (module) {\r\n return flattenModule(module, name)\r\n }\r\n}\r\nasync function getSharedFromLocal(name) {\r\n if (moduleMap[name]?.import) {\r\n let module = await (await moduleMap[name].get())()\r\n return flattenModule(module, name)\r\n } else {\r\n console.error(\r\n `consumer config import=false,so cant use callback shared module`\r\n )\r\n }\r\n}\r\nfunction flattenModule(module, name) {\r\n // use a shared module which export default a function will getting error 'TypeError: xxx is not a function'\r\n if (typeof module.default === 'function') {\r\n Object.keys(module).forEach((key) => {\r\n if (key !== 'default') {\r\n module.default[key] = module[key]\r\n }\r\n })\r\n moduleCache[name] = module.default\r\n return module.default\r\n }\r\n if (module.default) module = Object.assign({}, module.default, module)\r\n moduleCache[name] = module\r\n return module\r\n}\r\nexport {\r\n importShared,\r\n getSharedFromRuntime as importSharedRuntime,\r\n getSharedFromLocal as importSharedLocal\r\n}\r\n";
828
- const sharedFilePathReg = /__federation_shared_(.+)-.{8}\.js$/;
2062
+
2063
+ // src/federation/src/prod/shared-production.ts
2064
+ import { basename, join, resolve as resolve2 } from "path";
2065
+ import { readdirSync, readFileSync, statSync } from "fs";
2066
+
2067
+ // raw:E:\meet-hive\meethive\packages\vite\src\federation\src\prod\federation_fn_import.js
2068
+ var federation_fn_import_default = "import { satisfy } from '__federation_fn_satisfy'\r\n\r\nconst currentImports = {}\r\n\r\n// eslint-disable-next-line no-undef\r\nconst moduleMap = __rf_var__moduleMap\r\nconst moduleCache = Object.create(null)\r\nasync function importShared(name, shareScope = 'default') {\r\n return moduleCache[name]\r\n ? new Promise((r) => r(moduleCache[name]))\r\n : (await getSharedFromRuntime(name, shareScope)) || getSharedFromLocal(name)\r\n}\r\n// eslint-disable-next-line\r\nasync function __federation_import(name) {\r\n currentImports[name] ??= import(name)\r\n return currentImports[name]\r\n}\r\nasync function getSharedFromRuntime(name, shareScope) {\r\n let module = null\r\n if (globalThis?.__federation_shared__?.[shareScope]?.[name]) {\r\n const versionObj = globalThis.__federation_shared__[shareScope][name]\r\n const requiredVersion = moduleMap[name]?.requiredVersion\r\n const hasRequiredVersion = !!requiredVersion\r\n if (hasRequiredVersion) {\r\n const versionKey = Object.keys(versionObj).find((version) =>\r\n satisfy(version, requiredVersion)\r\n )\r\n if (versionKey) {\r\n const versionValue = versionObj[versionKey]\r\n module = await (await versionValue.get())()\r\n } else {\r\n console.log(\r\n `provider support ${name}(${versionKey}) is not satisfied requiredVersion(\\${moduleMap[name].requiredVersion})`\r\n )\r\n }\r\n } else {\r\n const versionKey = Object.keys(versionObj)[0]\r\n const versionValue = versionObj[versionKey]\r\n module = await (await versionValue.get())()\r\n }\r\n }\r\n if (module) {\r\n return flattenModule(module, name)\r\n }\r\n}\r\nasync function getSharedFromLocal(name) {\r\n if (moduleMap[name]?.import) {\r\n let module = await (await moduleMap[name].get())()\r\n return flattenModule(module, name)\r\n } else {\r\n console.error(\r\n `consumer config import=false,so cant use callback shared module`\r\n )\r\n }\r\n}\r\nfunction flattenModule(module, name) {\r\n // use a shared module which export default a function will getting error 'TypeError: xxx is not a function'\r\n if (typeof module.default === 'function') {\r\n Object.keys(module).forEach((key) => {\r\n if (key !== 'default') {\r\n module.default[key] = module[key]\r\n }\r\n })\r\n moduleCache[name] = module.default\r\n return module.default\r\n }\r\n if (module.default) module = Object.assign({}, module.default, module)\r\n moduleCache[name] = module\r\n return module\r\n}\r\nexport {\r\n importShared,\r\n getSharedFromRuntime as importSharedRuntime,\r\n getSharedFromLocal as importSharedLocal\r\n}\r\n";
2069
+
2070
+ // src/federation/src/prod/shared-production.ts
2071
+ var sharedFilePathReg = /__federation_shared_(.+)-.{8}\.js$/;
829
2072
  function prodSharedPlugin(options) {
830
2073
  parsedOptions.prodShared = parseSharedOptions(options);
831
2074
  const shareName2Prop = /* @__PURE__ */ new Map();
@@ -851,7 +2094,7 @@ function prodSharedPlugin(options) {
851
2094
  }
852
2095
  if (conflictModules.size > 0) {
853
2096
  console.info(
854
- `[Federation] 检测到模块 [${Array.from(conflictModules).join(", ")}] 同时配置在 shared manualChunks 中,启用协商共存模式`
2097
+ `[Federation] \u68C0\u6D4B\u5230\u6A21\u5757 [${Array.from(conflictModules).join(", ")}] \u540C\u65F6\u914D\u7F6E\u5728 shared \u548C manualChunks \u4E2D\uFF0C\u542F\u7528\u534F\u5546\u5171\u5B58\u6A21\u5F0F`
855
2098
  );
856
2099
  adaptSharedToManualChunks(conflictModules);
857
2100
  }
@@ -864,7 +2107,7 @@ function prodSharedPlugin(options) {
864
2107
  config.manualChunkCompat = true;
865
2108
  config.chunkLoading = "defer";
866
2109
  console.info(
867
- `[Federation] 模块 "${moduleName}" 设置为兼容模式:manualChunks 负责分块,federation 负责运行时共享`
2110
+ `[Federation] \u6A21\u5757 "${moduleName}" \u8BBE\u7F6E\u4E3A\u517C\u5BB9\u6A21\u5F0F\uFF1AmanualChunks \u8D1F\u8D23\u5206\u5757\uFF0Cfederation \u8D1F\u8D23\u8FD0\u884C\u65F6\u5171\u4EAB`
868
2111
  );
869
2112
  }
870
2113
  });
@@ -872,13 +2115,14 @@ function prodSharedPlugin(options) {
872
2115
  return {
873
2116
  name: "originjs:shared-production",
874
2117
  virtualFile: {
875
- __federation_fn_import: federation_fn_import
2118
+ __federation_fn_import: federation_fn_import_default
876
2119
  },
877
2120
  options(inputOptions) {
2121
+ var _a;
878
2122
  isRemote = !!parsedOptions.prodExpose.length;
879
2123
  isHost = options.isHost;
880
2124
  if (shareName2Prop.size) {
881
- inputOptions.external = inputOptions.external?.filter((item) => {
2125
+ inputOptions.external = (_a = inputOptions.external) == null ? void 0 : _a.filter((item) => {
882
2126
  if (item instanceof RegExp)
883
2127
  return ![...shareName2Prop.keys()].some((key) => item.test(key));
884
2128
  return !shareName2Prop.has(removeNonRegLetter(item, NAME_CHAR_REG));
@@ -888,6 +2132,7 @@ function prodSharedPlugin(options) {
888
2132
  return inputOptions;
889
2133
  },
890
2134
  async buildStart() {
2135
+ var _a;
891
2136
  if (parsedOptions.prodShared.length && isRemote) {
892
2137
  this.emitFile({
893
2138
  name: "__federation_fn_import",
@@ -909,10 +2154,10 @@ function prodSharedPlugin(options) {
909
2154
  };
910
2155
  const monoRepos = [];
911
2156
  const dirPaths = [];
912
- const currentDir = resolve();
2157
+ const currentDir = resolve2();
913
2158
  for (const arr of parsedOptions.prodShared) {
914
2159
  if (isHost && !arr[1].version && !arr[1].manuallyPackagePathSetting) {
915
- const packageJsonPath = (await this.resolve(`${arr[1].packagePath}/package.json`))?.id;
2160
+ const packageJsonPath = (_a = await this.resolve(`${arr[1].packagePath}/package.json`)) == null ? void 0 : _a.id;
916
2161
  if (packageJsonPath) {
917
2162
  const packageJson = JSON.parse(
918
2163
  readFileSync(packageJsonPath, { encoding: "utf-8" })
@@ -946,11 +2191,11 @@ function prodSharedPlugin(options) {
946
2191
  for (const id of monoRepo.arr) {
947
2192
  try {
948
2193
  const idResolve = await this.resolve(id);
949
- if (idResolve?.id) {
2194
+ if (idResolve == null ? void 0 : idResolve.id) {
950
2195
  parsedOptions.prodShared.push([
951
2196
  `${monoRepo.root[0]}/${basename(id)}`,
952
2197
  {
953
- id: idResolve?.id,
2198
+ id: idResolve == null ? void 0 : idResolve.id,
954
2199
  import: monoRepo.root[1].import,
955
2200
  shareScope: monoRepo.root[1].shareScope,
956
2201
  root: monoRepo.root
@@ -972,7 +2217,10 @@ function prodSharedPlugin(options) {
972
2217
  outputOption.hoistTransitiveImports = false;
973
2218
  const manualChunkFunc = (id) => {
974
2219
  const find = parsedOptions.prodShared.find(
975
- (arr) => arr[1].dependencies?.has(id)
2220
+ (arr) => {
2221
+ var _a;
2222
+ return (_a = arr[1].dependencies) == null ? void 0 : _a.has(id);
2223
+ }
976
2224
  );
977
2225
  return find ? find[0] : void 0;
978
2226
  };
@@ -990,6 +2238,7 @@ function prodSharedPlugin(options) {
990
2238
  return outputOption;
991
2239
  },
992
2240
  generateBundle(options2, bundle) {
2241
+ var _a;
993
2242
  if (!isRemote) {
994
2243
  return;
995
2244
  }
@@ -999,7 +2248,7 @@ function prodSharedPlugin(options) {
999
2248
  if (chunk.type === "chunk") {
1000
2249
  if (!isHost) {
1001
2250
  const regRst = sharedFilePathReg.exec(chunk.fileName);
1002
- if (regRst && shareName2Prop.get(removeNonRegLetter(regRst[1], NAME_CHAR_REG))?.generate === false) {
2251
+ if (regRst && ((_a = shareName2Prop.get(removeNonRegLetter(regRst[1], NAME_CHAR_REG))) == null ? void 0 : _a.generate) === false) {
1003
2252
  needRemoveShared.add(key);
1004
2253
  }
1005
2254
  }
@@ -1013,10 +2262,14 @@ function prodSharedPlugin(options) {
1013
2262
  }
1014
2263
  };
1015
2264
  }
2265
+
2266
+ // src/federation/src/prod/expose-production.ts
2267
+ import { resolve as resolve3, parse as parse2, basename as basename2, extname, relative, dirname as dirname2 } from "path";
1016
2268
  function prodExposePlugin(options) {
1017
2269
  let moduleMap = "";
1018
2270
  const hasOptions = parsedOptions.prodExpose.some((expose) => {
1019
- return expose[0] === parseExposeOptions(options)[0]?.[0];
2271
+ var _a;
2272
+ return expose[0] === ((_a = parseExposeOptions(options)[0]) == null ? void 0 : _a[0]);
1020
2273
  });
1021
2274
  if (!hasOptions) {
1022
2275
  parsedOptions.prodExpose = Array.prototype.concat(
@@ -1025,8 +2278,9 @@ function prodExposePlugin(options) {
1025
2278
  );
1026
2279
  }
1027
2280
  for (const item of parseExposeOptions(options)) {
1028
- getModuleMarker(`\${${item[0]}}`, SHARED);
1029
- const exposeFilepath = normalizePath(resolve(item[1].import));
2281
+ const moduleName = getModuleMarker(`\${${item[0]}}`, SHARED);
2282
+ EXTERNALS.push(moduleName);
2283
+ const exposeFilepath = normalizePath(resolve3(item[1].import));
1030
2284
  EXPOSES_MAP.set(item[0], exposeFilepath);
1031
2285
  EXPOSES_KEY_MAP.set(
1032
2286
  item[0],
@@ -1076,11 +2330,11 @@ function prodExposePlugin(options) {
1076
2330
  if (isAbsoluteUrl(baseUrl)) {
1077
2331
  href = [cleanBaseUrl, cleanAssetsDir, cleanCssPath].filter(Boolean).join('/');
1078
2332
  } else {
1079
- // 当remoteEntry.js和CSS都在assets目录下时,使用相对路径
2333
+ // \u5F53remoteEntry.js\u548CCSS\u90FD\u5728assets\u76EE\u5F55\u4E0B\u65F6\uFF0C\u4F7F\u7528\u76F8\u5BF9\u8DEF\u5F84
1080
2334
  const remoteEntryInAssets = cleanCurUrl.endsWith('/assets/') || cleanCurUrl.endsWith('/assets');
1081
2335
 
1082
2336
  if (remoteEntryInAssets) {
1083
- // 都在assets目录下,直接使用CSS文件名
2337
+ // \u90FD\u5728assets\u76EE\u5F55\u4E0B\uFF0C\u76F4\u63A5\u4F7F\u7528CSS\u6587\u4EF6\u540D
1084
2338
  href = [cleanCurUrl, cleanCssPath].filter(Boolean).join('/');
1085
2339
  } else if (cleanCurUrl.includes(cleanBaseUrl)) {
1086
2340
  href = [cleanCurUrl, cleanAssetsDir, cleanCssPath].filter(Boolean).join('/');
@@ -1145,10 +2399,11 @@ function prodExposePlugin(options) {
1145
2399
  }
1146
2400
  },
1147
2401
  generateBundle(_options, bundle) {
2402
+ var _a, _b, _c;
1148
2403
  let remoteEntryChunk;
1149
2404
  for (const file in bundle) {
1150
2405
  const chunk = bundle[file];
1151
- if (chunk?.facadeModuleId === `\0virtual:__remoteEntryHelper__${options.filename}`) {
2406
+ if ((chunk == null ? void 0 : chunk.facadeModuleId) === `\0virtual:__remoteEntryHelper__${options.filename}`) {
1152
2407
  remoteEntryChunk = chunk;
1153
2408
  break;
1154
2409
  }
@@ -1156,13 +2411,13 @@ function prodExposePlugin(options) {
1156
2411
  if (remoteEntryChunk) {
1157
2412
  remoteEntryChunk.code = remoteEntryChunk.code.replace(
1158
2413
  "__VITE_BASE_PLACEHOLDER__",
1159
- `'${viteConfigResolved.config?.base || ""}'`
2414
+ `'${((_a = viteConfigResolved.config) == null ? void 0 : _a.base) || ""}'`
1160
2415
  ).replace(
1161
2416
  "__VITE_ASSETS_DIR_PLACEHOLDER__",
1162
2417
  `'${builderInfo.assetsDir || ""}'`
1163
2418
  );
1164
2419
  const filepathMap = /* @__PURE__ */ new Map();
1165
- const getFilename = (name) => parse(parse(name).name).name;
2420
+ const getFilename = (name) => parse2(parse2(name).name).name;
1166
2421
  const cssBundlesMap = Object.keys(bundle).filter((name) => extname(name) === ".css").reduce((res, name) => {
1167
2422
  const filename = getFilename(name);
1168
2423
  res.set(filename, bundle[name]);
@@ -1174,7 +2429,7 @@ function prodExposePlugin(options) {
1174
2429
  if (viteConfigResolved.config && !viteConfigResolved.config.build.cssCodeSplit) {
1175
2430
  if (cssBundlesMap.size) {
1176
2431
  return `[${[...cssBundlesMap.values()].map(
1177
- (cssBundle) => JSON.stringify(basename(cssBundle.fileName))
2432
+ (cssBundle) => JSON.stringify(basename2(cssBundle.fileName))
1178
2433
  ).join(",")}]`;
1179
2434
  } else {
1180
2435
  return "[]";
@@ -1209,7 +2464,7 @@ function prodExposePlugin(options) {
1209
2464
  }
1210
2465
  };
1211
2466
  [fileBundle.fileName, ...fileBundle.imports].forEach(addDepCss);
1212
- return `[${[...depCssFiles].map((d) => JSON.stringify(basename(d))).join(",")}]`;
2467
+ return `[${[...depCssFiles].map((d) => JSON.stringify(basename2(d))).join(",")}]`;
1213
2468
  }
1214
2469
  );
1215
2470
  for (const expose of parseExposeOptions(options)) {
@@ -1220,13 +2475,13 @@ function prodExposePlugin(options) {
1220
2475
  if (module) {
1221
2476
  const chunk = bundle[module];
1222
2477
  const fileRelativePath = relative(
1223
- dirname(remoteEntryChunk.fileName),
2478
+ dirname2(remoteEntryChunk.fileName),
1224
2479
  chunk.fileName
1225
2480
  );
1226
2481
  const slashPath = fileRelativePath.replace(/\\/g, "/");
1227
2482
  remoteEntryChunk.code = remoteEntryChunk.code.replace(
1228
2483
  `\${__federation_expose_${expose[0]}}`,
1229
- viteConfigResolved.config?.base?.replace(/\/+$/, "") ? [
2484
+ ((_c = (_b = viteConfigResolved.config) == null ? void 0 : _b.base) == null ? void 0 : _c.replace(/\/+$/, "")) ? [
1230
2485
  viteConfigResolved.config.base.replace(/\/+$/, ""),
1231
2486
  slashPath
1232
2487
  ].filter(Boolean).join("/") : `./${slashPath}`
@@ -1245,9 +2500,10 @@ function prodExposePlugin(options) {
1245
2500
  const magicString = new MagicString(remoteEntryChunk.code);
1246
2501
  walk(ast, {
1247
2502
  enter(node) {
1248
- if (node && node.type === "CallExpression" && typeof node.arguments[0]?.value === "string" && node.arguments[0]?.value.indexOf(
2503
+ var _a2, _b2;
2504
+ if (node && node.type === "CallExpression" && typeof ((_a2 = node.arguments[0]) == null ? void 0 : _a2.value) === "string" && ((_b2 = node.arguments[0]) == null ? void 0 : _b2.value.indexOf(
1249
2505
  `${DYNAMIC_LOADING_CSS_PREFIX}`
1250
- ) > -1) {
2506
+ )) > -1) {
1251
2507
  magicString.remove(node.start, node.end + 1);
1252
2508
  }
1253
2509
  }
@@ -1257,12 +2513,18 @@ function prodExposePlugin(options) {
1257
2513
  }
1258
2514
  };
1259
2515
  }
2516
+
2517
+ // src/federation/src/dev/shared-development.ts
1260
2518
  function devSharedPlugin(options) {
1261
2519
  parsedOptions.devShared = parseSharedOptions(options);
1262
2520
  return {
1263
2521
  name: "originjs:shared-development"
1264
2522
  };
1265
2523
  }
2524
+
2525
+ // src/federation/src/dev/remote-development.ts
2526
+ import { readFileSync as readFileSync2 } from "fs";
2527
+ import { posix as posix2 } from "path";
1266
2528
  function devRemotePlugin(options) {
1267
2529
  parsedOptions.devRemote = parseRemoteOptions(options);
1268
2530
  for (const item of parsedOptions.devRemote) {
@@ -1412,17 +2674,18 @@ export {__federation_method_ensure, __federation_method_getRemote , __federation
1412
2674
  viteDevServer = server;
1413
2675
  },
1414
2676
  async transform(code, id) {
2677
+ var _a;
1415
2678
  if (builderInfo.isHost && !builderInfo.isRemote) {
1416
2679
  for (const arr of parsedOptions.devShared) {
1417
2680
  if (!arr[1].version && !arr[1].manuallyPackagePathSetting) {
1418
- const packageJsonPath = (await this.resolve(`${arr[0]}/package.json`))?.id;
2681
+ const packageJsonPath = (_a = await this.resolve(`${arr[0]}/package.json`)) == null ? void 0 : _a.id;
1419
2682
  if (!packageJsonPath) {
1420
2683
  this.error(
1421
2684
  `No description file or no version in description file (usually package.json) of ${arr[0]}(${packageJsonPath}). Add version to description file, or manually specify version in shared config.`
1422
2685
  );
1423
2686
  } else {
1424
2687
  const json = JSON.parse(
1425
- readFileSync(packageJsonPath, { encoding: "utf-8" })
2688
+ readFileSync2(packageJsonPath, { encoding: "utf-8" })
1426
2689
  );
1427
2690
  arr[1].version = json.version;
1428
2691
  }
@@ -1455,13 +2718,14 @@ export {__federation_method_ensure, __federation_method_getRemote , __federation
1455
2718
  let manualRequired = null;
1456
2719
  walk(ast, {
1457
2720
  enter(node) {
1458
- if (node.type === "ImportDeclaration" && node.source?.value === "virtual:__federation__") {
2721
+ var _a2, _b, _c, _d;
2722
+ if (node.type === "ImportDeclaration" && ((_a2 = node.source) == null ? void 0 : _a2.value) === "virtual:__federation__") {
1459
2723
  manualRequired = node;
1460
2724
  }
1461
- if ((node.type === "ImportExpression" || node.type === "ImportDeclaration" || node.type === "ExportNamedDeclaration") && node.source?.value?.indexOf("/") > -1) {
2725
+ if ((node.type === "ImportExpression" || node.type === "ImportDeclaration" || node.type === "ExportNamedDeclaration") && ((_c = (_b = node.source) == null ? void 0 : _b.value) == null ? void 0 : _c.indexOf("/")) > -1) {
1462
2726
  const moduleId = node.source.value;
1463
2727
  const remote = devRemotes.find((r) => r.regexp.test(moduleId));
1464
- const needWrap = remote?.config.from === "vite";
2728
+ const needWrap = (remote == null ? void 0 : remote.config.from) === "vite";
1465
2729
  if (remote) {
1466
2730
  requiresRuntime = true;
1467
2731
  const modName = `.${moduleId.slice(remote.id.length)}`;
@@ -1479,7 +2743,7 @@ export {__federation_method_ensure, __federation_method_getRemote , __federation
1479
2743
  break;
1480
2744
  }
1481
2745
  case "ImportDeclaration": {
1482
- if (node.specifiers?.length) {
2746
+ if ((_d = node.specifiers) == null ? void 0 : _d.length) {
1483
2747
  const afterImportName = `__federation_var_${moduleId.replace(
1484
2748
  /[@/\\.-]/g,
1485
2749
  ""
@@ -1607,7 +2871,7 @@ export {__federation_method_ensure, __federation_method_getRemote , __federation
1607
2871
  if (!moduleInfo) continue;
1608
2872
  const moduleFilePath = normalizePath(moduleInfo.id);
1609
2873
  const idx = moduleFilePath.indexOf(cwdPath);
1610
- const relativePath = idx === 0 ? posix.join(base, moduleFilePath.slice(cwdPath.length)) : null;
2874
+ const relativePath = idx === 0 ? posix2.join(base, moduleFilePath.slice(cwdPath.length)) : null;
1611
2875
  const sharedName = item[0];
1612
2876
  const obj = item[1];
1613
2877
  let str = "";
@@ -1623,19 +2887,150 @@ export {__federation_method_ensure, __federation_method_getRemote , __federation
1623
2887
  return res;
1624
2888
  }
1625
2889
  }
2890
+
2891
+ // src/federation/src/dev/expose-development.ts
1626
2892
  function devExposePlugin(options) {
1627
2893
  parsedOptions.devExpose = parseExposeOptions(options);
1628
2894
  return {
1629
2895
  name: "originjs:expose-development"
1630
2896
  };
1631
2897
  }
1632
- const normalizeAssetsDir = (config) => {
1633
- const configured = config?.build?.assetsDir ?? "assets";
2898
+
2899
+ // src/federation/src/runtime/dynamic-remote.ts
2900
+ var DynamicRemoteManager = class {
2901
+ remoteCache = /* @__PURE__ */ new Map();
2902
+ loadingPromises = /* @__PURE__ */ new Map();
2903
+ /**
2904
+ * Add a remote dynamically at runtime
2905
+ * @param name Remote name
2906
+ * @param config Remote configuration
2907
+ */
2908
+ async addRemote(name, config) {
2909
+ try {
2910
+ const federationModule = await import("virtual:__federation__");
2911
+ const { __federation_method_add_origin_setRemote } = federationModule;
2912
+ await __federation_method_add_origin_setRemote(name, config.url, {
2913
+ format: config.format || "esm",
2914
+ from: config.from || "vite",
2915
+ shareScope: config.shareScope || "default",
2916
+ external: config.external,
2917
+ externalType: config.externalType || "url"
2918
+ });
2919
+ } catch (error) {
2920
+ throw new Error(`Failed to add dynamic remote '${name}': ${error.message}. Make sure to enable dynamic remotes in your plugin configuration with 'enableDynamicRemotes: true'.`);
2921
+ }
2922
+ }
2923
+ /**
2924
+ * Load a remote component dynamically
2925
+ * @param remoteName Remote name
2926
+ * @param componentName Component name to load from remote
2927
+ * @returns Promise of the loaded component
2928
+ */
2929
+ async loadRemoteComponent(remoteName, componentName) {
2930
+ const cacheKey = `${remoteName}/${componentName}`;
2931
+ if (this.remoteCache.has(cacheKey)) {
2932
+ return this.remoteCache.get(cacheKey);
2933
+ }
2934
+ if (this.loadingPromises.has(cacheKey)) {
2935
+ return this.loadingPromises.get(cacheKey);
2936
+ }
2937
+ const loadingPromise = this.doLoadRemoteComponent(remoteName, componentName);
2938
+ this.loadingPromises.set(cacheKey, loadingPromise);
2939
+ try {
2940
+ const component = await loadingPromise;
2941
+ this.remoteCache.set(cacheKey, component);
2942
+ return component;
2943
+ } finally {
2944
+ this.loadingPromises.delete(cacheKey);
2945
+ }
2946
+ }
2947
+ async doLoadRemoteComponent(remoteName, componentName) {
2948
+ try {
2949
+ const federationModule = await import("virtual:__federation__");
2950
+ const { __federation_method_getRemote } = federationModule;
2951
+ return __federation_method_getRemote(remoteName, componentName);
2952
+ } catch (error) {
2953
+ throw new Error(`Failed to load remote component '${remoteName}/${componentName}': ${error.message}. Make sure to enable dynamic remotes in your plugin configuration with 'enableDynamicRemotes: true'.`);
2954
+ }
2955
+ }
2956
+ /**
2957
+ * Preload a remote component
2958
+ * @param remoteName Remote name
2959
+ * @param componentName Component name
2960
+ */
2961
+ async preloadRemoteComponent(remoteName, componentName) {
2962
+ try {
2963
+ await this.loadRemoteComponent(remoteName, componentName);
2964
+ } catch (error) {
2965
+ console.warn(`Failed to preload remote component ${remoteName}/${componentName}:`, error);
2966
+ }
2967
+ }
2968
+ /**
2969
+ * Remove a remote component from cache
2970
+ * @param remoteName Remote name
2971
+ * @param componentName Component name
2972
+ */
2973
+ clearRemoteComponentCache(remoteName, componentName) {
2974
+ if (componentName) {
2975
+ const cacheKey = `${remoteName}/${componentName}`;
2976
+ this.remoteCache.delete(cacheKey);
2977
+ } else {
2978
+ for (const key of this.remoteCache.keys()) {
2979
+ if (key.startsWith(`${remoteName}/`)) {
2980
+ this.remoteCache.delete(key);
2981
+ }
2982
+ }
2983
+ }
2984
+ }
2985
+ /**
2986
+ * Get all cached remote components
2987
+ */
2988
+ getCachedRemotes() {
2989
+ return Array.from(this.remoteCache.keys());
2990
+ }
2991
+ /**
2992
+ * Check if a remote component is cached
2993
+ * @param remoteName Remote name
2994
+ * @param componentName Component name
2995
+ */
2996
+ isRemoteComponentCached(remoteName, componentName) {
2997
+ const cacheKey = `${remoteName}/${componentName}`;
2998
+ return this.remoteCache.has(cacheKey);
2999
+ }
3000
+ };
3001
+ var dynamicRemoteManager = new DynamicRemoteManager();
3002
+ function isVueAvailable() {
3003
+ try {
3004
+ return typeof ref !== "undefined" && typeof onMounted !== "undefined";
3005
+ } catch {
3006
+ return false;
3007
+ }
3008
+ }
3009
+ var ref;
3010
+ var onMounted;
3011
+ var readonly;
3012
+ if (isVueAvailable()) {
3013
+ try {
3014
+ import("vue").then((vue) => {
3015
+ ref = vue.ref;
3016
+ onMounted = vue.onMounted;
3017
+ readonly = vue.readonly;
3018
+ }).catch(() => {
3019
+ console.warn("Vue not available for dynamic import");
3020
+ });
3021
+ } catch {
3022
+ }
3023
+ }
3024
+
3025
+ // src/federation/src/index.ts
3026
+ var normalizeAssetsDir = (config) => {
3027
+ var _a, _b;
3028
+ const configured = ((_a = config == null ? void 0 : config.build) == null ? void 0 : _a.assetsDir) ?? "assets";
1634
3029
  if (!configured) return "";
1635
3030
  if (!isAbsolute(configured)) return configured;
1636
- const root = config?.root ? resolve(config.root) : process.cwd();
1637
- const resolvedOutDir = config?.build?.outDir ? isAbsolute(config.build.outDir) ? config.build.outDir : resolve(root, config.build.outDir) : resolve(root, "dist");
1638
- const normalized = relative(resolvedOutDir, configured).replace(/\\/g, "/");
3031
+ const root = (config == null ? void 0 : config.root) ? resolve4(config.root) : process.cwd();
3032
+ const resolvedOutDir = ((_b = config == null ? void 0 : config.build) == null ? void 0 : _b.outDir) ? isAbsolute(config.build.outDir) ? config.build.outDir : resolve4(root, config.build.outDir) : resolve4(root, "dist");
3033
+ const normalized = relative2(resolvedOutDir, configured).replace(/\\/g, "/");
1639
3034
  return normalized.startsWith("..") ? "" : normalized || "assets";
1640
3035
  };
1641
3036
  function federation(options) {
@@ -1678,6 +3073,7 @@ function federation(options) {
1678
3073
  enforce: "post",
1679
3074
  // apply:'build',
1680
3075
  options(_options) {
3076
+ var _a;
1681
3077
  if (!registerCount++) {
1682
3078
  registerPlugins(options.mode = options.mode ?? "production", "");
1683
3079
  }
@@ -1689,36 +3085,41 @@ function federation(options) {
1689
3085
  _options.external = [_options.external];
1690
3086
  }
1691
3087
  for (const pluginHook of pluginList) {
1692
- pluginHook.options?.call(this, _options);
3088
+ (_a = pluginHook.options) == null ? void 0 : _a.call(this, _options);
1693
3089
  }
1694
3090
  return _options;
1695
3091
  },
1696
3092
  config(config, env) {
3093
+ var _a;
1697
3094
  options.mode = options.mode ?? env.mode;
1698
3095
  registerPlugins(options.mode, env.command);
1699
3096
  registerCount++;
1700
3097
  for (const pluginHook of pluginList) {
1701
- pluginHook.config?.call(this, config, env);
3098
+ (_a = pluginHook.config) == null ? void 0 : _a.call(this, config, env);
1702
3099
  }
1703
3100
  builderInfo.builder = "vite";
1704
3101
  builderInfo.assetsDir = normalizeAssetsDir(config) ?? "assets";
1705
3102
  },
1706
3103
  configureServer(server) {
3104
+ var _a;
1707
3105
  for (const pluginHook of pluginList) {
1708
- pluginHook.configureServer?.call(this, server);
3106
+ (_a = pluginHook.configureServer) == null ? void 0 : _a.call(this, server);
1709
3107
  }
1710
3108
  },
1711
3109
  configResolved(config) {
3110
+ var _a;
1712
3111
  for (const pluginHook of pluginList) {
1713
- pluginHook.configResolved?.call(this, config);
3112
+ (_a = pluginHook.configResolved) == null ? void 0 : _a.call(this, config);
1714
3113
  }
1715
3114
  },
1716
3115
  buildStart(inputOptions) {
3116
+ var _a;
1717
3117
  for (const pluginHook of pluginList) {
1718
- pluginHook.buildStart?.call(this, inputOptions);
3118
+ (_a = pluginHook.buildStart) == null ? void 0 : _a.call(this, inputOptions);
1719
3119
  }
1720
3120
  },
1721
3121
  async resolveId(...args) {
3122
+ var _a;
1722
3123
  const v = virtualMod.resolveId.call(this, ...args);
1723
3124
  if (v) {
1724
3125
  return v;
@@ -1730,9 +3131,9 @@ function federation(options) {
1730
3131
  };
1731
3132
  }
1732
3133
  if (args[0] === "__federation_fn_satisfy") {
1733
- const federationId = (await this.resolve("@meethive/vite"))?.id;
3134
+ const federationId = (_a = await this.resolve("@meethive/vite")) == null ? void 0 : _a.id;
1734
3135
  if (federationId) {
1735
- return await this.resolve(`${dirname(federationId)}/satisfy.mjs`);
3136
+ return await this.resolve(`${dirname3(federationId)}/satisfy.mjs`);
1736
3137
  }
1737
3138
  return null;
1738
3139
  }
@@ -1752,8 +3153,9 @@ function federation(options) {
1752
3153
  return null;
1753
3154
  },
1754
3155
  transform(code, id) {
3156
+ var _a;
1755
3157
  for (const pluginHook of pluginList) {
1756
- const result = pluginHook.transform?.call(this, code, id);
3158
+ const result = (_a = pluginHook.transform) == null ? void 0 : _a.call(this, code, id);
1757
3159
  if (result) {
1758
3160
  return result;
1759
3161
  }
@@ -1761,19 +3163,22 @@ function federation(options) {
1761
3163
  return code;
1762
3164
  },
1763
3165
  moduleParsed(moduleInfo) {
3166
+ var _a;
1764
3167
  for (const pluginHook of pluginList) {
1765
- pluginHook.moduleParsed?.call(this, moduleInfo);
3168
+ (_a = pluginHook.moduleParsed) == null ? void 0 : _a.call(this, moduleInfo);
1766
3169
  }
1767
3170
  },
1768
3171
  outputOptions(outputOptions) {
3172
+ var _a;
1769
3173
  for (const pluginHook of pluginList) {
1770
- pluginHook.outputOptions?.call(this, outputOptions);
3174
+ (_a = pluginHook.outputOptions) == null ? void 0 : _a.call(this, outputOptions);
1771
3175
  }
1772
3176
  return outputOptions;
1773
3177
  },
1774
3178
  renderChunk(code, chunkInfo, _options) {
3179
+ var _a;
1775
3180
  for (const pluginHook of pluginList) {
1776
- const result = pluginHook.renderChunk?.call(
3181
+ const result = (_a = pluginHook.renderChunk) == null ? void 0 : _a.call(
1777
3182
  this,
1778
3183
  code,
1779
3184
  chunkInfo,
@@ -1786,13 +3191,20 @@ function federation(options) {
1786
3191
  return null;
1787
3192
  },
1788
3193
  generateBundle: function(_options, bundle, isWrite) {
3194
+ var _a;
1789
3195
  for (const pluginHook of pluginList) {
1790
- pluginHook.generateBundle?.call(this, _options, bundle, isWrite);
3196
+ (_a = pluginHook.generateBundle) == null ? void 0 : _a.call(this, _options, bundle, isWrite);
1791
3197
  }
1792
3198
  }
1793
3199
  };
1794
3200
  }
1795
- const languageWorkAttr = [
3201
+
3202
+ // src/monaco-editor/index.ts
3203
+ import { resolve as resolve5, join as join2 } from "path";
3204
+ import { buildSync as buildSync2 } from "esbuild";
3205
+
3206
+ // src/monaco-editor/languageWork.ts
3207
+ var languageWorkAttr = [
1796
3208
  {
1797
3209
  label: "editorWorkerService",
1798
3210
  entry: "monaco-editor/esm/vs/editor/editor.worker"
@@ -1814,15 +3226,20 @@ const languageWorkAttr = [
1814
3226
  entry: "monaco-editor/esm/vs/language/typescript/ts.worker"
1815
3227
  }
1816
3228
  ];
1817
- const languageWorksByLabel = {};
3229
+ var languageWorksByLabel = {};
1818
3230
  languageWorkAttr.forEach(
1819
3231
  (languageWork) => languageWorksByLabel[languageWork.label] = languageWork
1820
3232
  );
3233
+
3234
+ // src/monaco-editor/workerMiddleware.ts
3235
+ import { buildSync } from "esbuild";
3236
+ import { existsSync, readFileSync as readFileSync3, rmSync } from "fs";
3237
+ import { basename as basename3 } from "path";
1821
3238
  function getFilenameByEntry(entry) {
1822
- entry = basename(entry, "js");
3239
+ entry = basename3(entry, "js");
1823
3240
  return entry + ".bundle.js";
1824
3241
  }
1825
- const cacheDir = "node_modules/.monaco/";
3242
+ var cacheDir = "node_modules/.monaco/";
1826
3243
  function getWorkPath(works, options, config) {
1827
3244
  const workerPaths = {};
1828
3245
  for (const work of works) {
@@ -1861,18 +3278,20 @@ function workerMiddleware(middlewares, config, options) {
1861
3278
  outfile: cacheDir + getFilenameByEntry(work.entry)
1862
3279
  });
1863
3280
  }
1864
- const contentBuffer = readFileSync(cacheDir + getFilenameByEntry(work.entry));
3281
+ const contentBuffer = readFileSync3(cacheDir + getFilenameByEntry(work.entry));
1865
3282
  res.setHeader("Content-Type", "text/javascript");
1866
3283
  res.end(contentBuffer);
1867
3284
  }
1868
3285
  );
1869
3286
  }
1870
3287
  }
3288
+
3289
+ // src/monaco-editor/index.ts
1871
3290
  function resolveMonacoPath(filePath) {
1872
3291
  try {
1873
- return resolve(join(process.cwd(), "node_modules", filePath));
3292
+ return resolve5(join2(process.cwd(), "node_modules", filePath));
1874
3293
  } catch (err) {
1875
- return resolve(filePath);
3294
+ return resolve5(filePath);
1876
3295
  }
1877
3296
  }
1878
3297
  function getWorks(options) {
@@ -1882,8 +3301,9 @@ function getWorks(options) {
1882
3301
  works.push(...options.customWorkers);
1883
3302
  return works;
1884
3303
  }
1885
- const getFS = async () => {
1886
- if (typeof process !== "undefined" && process.versions?.node) {
3304
+ var getFS = async () => {
3305
+ var _a;
3306
+ if (typeof process !== "undefined" && ((_a = process.versions) == null ? void 0 : _a.node)) {
1887
3307
  const fs = await import("fs");
1888
3308
  return {
1889
3309
  existsSync: fs.existsSync,
@@ -1973,7 +3393,7 @@ function monacoEditorPlugin(options) {
1973
3393
  resolvedConfig.root,
1974
3394
  resolvedConfig.build.outDir,
1975
3395
  resolvedConfig.base
1976
- ) : join(
3396
+ ) : join2(
1977
3397
  resolvedConfig.root,
1978
3398
  resolvedConfig.build.outDir,
1979
3399
  resolvedConfig.base,
@@ -1986,14 +3406,14 @@ function monacoEditorPlugin(options) {
1986
3406
  }
1987
3407
  for (const work of works) {
1988
3408
  if (!fs.existsSync(cacheDir + getFilenameByEntry(work.entry))) {
1989
- buildSync({
3409
+ buildSync2({
1990
3410
  entryPoints: [resolveMonacoPath(work.entry)],
1991
3411
  bundle: true,
1992
3412
  outfile: cacheDir + getFilenameByEntry(work.entry)
1993
3413
  });
1994
3414
  }
1995
3415
  const contentBuffer = fs.readFileSync(cacheDir + getFilenameByEntry(work.entry));
1996
- const workDistPath = resolve(distPath, getFilenameByEntry(work.entry));
3416
+ const workDistPath = resolve5(distPath, getFilenameByEntry(work.entry));
1997
3417
  fs.writeFileSync(workDistPath, contentBuffer);
1998
3418
  }
1999
3419
  }
@@ -2005,6 +3425,9 @@ function isCDN(publicPath) {
2005
3425
  }
2006
3426
  return false;
2007
3427
  }
3428
+
3429
+ // src/sharp/index.ts
3430
+ import path4 from "path";
2008
3431
  function matches(filename, patterns) {
2009
3432
  if (!patterns || patterns.length === 0) return true;
2010
3433
  return patterns.some(
@@ -2036,7 +3459,7 @@ function sharpOptimize(options = {}) {
2036
3459
  async generateBundle(_opts, bundle) {
2037
3460
  for (const [fileName, asset] of Object.entries(bundle)) {
2038
3461
  if (asset.type !== "asset") continue;
2039
- const ext = path$1.extname(fileName).toLowerCase();
3462
+ const ext = path4.extname(fileName).toLowerCase();
2040
3463
  if (!imageExts.has(ext)) continue;
2041
3464
  if (exclude && matches(fileName, exclude)) continue;
2042
3465
  if (include && !matches(fileName, include)) continue;