@forsakringskassan/docs-generator 2.19.1 → 2.21.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.
@@ -0,0 +1,1863 @@
1
+ 'use strict';
2
+
3
+ var require$$0 = require('@vue/compiler-sfc');
4
+ require('./vendor-CLvDQIrx.js');
5
+
6
+ var __create = Object.create;
7
+ var __defProp = Object.defineProperty;
8
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
9
+ var __getOwnPropNames = Object.getOwnPropertyNames;
10
+ var __getProtoOf = Object.getPrototypeOf;
11
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
12
+ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
13
+ get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
14
+ }) : x)(function(x) {
15
+ if (typeof require !== "undefined") return require.apply(this, arguments);
16
+ throw Error('Dynamic require of "' + x + '" is not supported');
17
+ });
18
+ var __commonJS = (cb, mod) => function __require2() {
19
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
20
+ };
21
+ var __copyProps = (to, from, except, desc) => {
22
+ if (from && typeof from === "object" || typeof from === "function") {
23
+ for (let key of __getOwnPropNames(from))
24
+ if (!__hasOwnProp.call(to, key) && key !== except)
25
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
26
+ }
27
+ return to;
28
+ };
29
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
30
+ // If the importer is in node compatibility mode or this is not an ESM
31
+ // file that has been converted to a CommonJS file using a Babel-
32
+ // compatible transform (i.e. "__esModule" has not been set), then set
33
+ // "default" to the CommonJS "module.exports" for node compatibility.
34
+ !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
35
+ mod
36
+ ));
37
+ var require_utils = __commonJS({
38
+ "../../node_modules/esbuild-plugin-vue3/dist/utils.js"(exports) {
39
+ var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) {
40
+ if (k2 === void 0) k2 = k;
41
+ var desc = Object.getOwnPropertyDescriptor(m, k);
42
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
43
+ desc = { enumerable: true, get: function() {
44
+ return m[k];
45
+ } };
46
+ }
47
+ Object.defineProperty(o, k2, desc);
48
+ } : function(o, m, k, k2) {
49
+ if (k2 === void 0) k2 = k;
50
+ o[k2] = m[k];
51
+ });
52
+ var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? function(o, v) {
53
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
54
+ } : function(o, v) {
55
+ o["default"] = v;
56
+ });
57
+ var __importStar = exports && exports.__importStar || function(mod) {
58
+ if (mod && mod.__esModule) return mod;
59
+ var result = {};
60
+ if (mod != null) {
61
+ for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
62
+ }
63
+ __setModuleDefault(result, mod);
64
+ return result;
65
+ };
66
+ var __awaiter = exports && exports.__awaiter || function(thisArg, _arguments, P, generator) {
67
+ function adopt(value) {
68
+ return value instanceof P ? value : new P(function(resolve) {
69
+ resolve(value);
70
+ });
71
+ }
72
+ return new (P || (P = Promise))(function(resolve, reject) {
73
+ function fulfilled(value) {
74
+ try {
75
+ step(generator.next(value));
76
+ } catch (e) {
77
+ reject(e);
78
+ }
79
+ }
80
+ function rejected(value) {
81
+ try {
82
+ step(generator["throw"](value));
83
+ } catch (e) {
84
+ reject(e);
85
+ }
86
+ }
87
+ function step(result) {
88
+ result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
89
+ }
90
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
91
+ });
92
+ };
93
+ var __generator = exports && exports.__generator || function(thisArg, body) {
94
+ var _ = { label: 0, sent: function() {
95
+ if (t[0] & 1) throw t[1];
96
+ return t[1];
97
+ }, trys: [], ops: [] }, f, y, t, g;
98
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
99
+ return this;
100
+ }), g;
101
+ function verb(n) {
102
+ return function(v) {
103
+ return step([n, v]);
104
+ };
105
+ }
106
+ function step(op) {
107
+ if (f) throw new TypeError("Generator is already executing.");
108
+ while (_) try {
109
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
110
+ if (y = 0, t) op = [op[0] & 2, t.value];
111
+ switch (op[0]) {
112
+ case 0:
113
+ case 1:
114
+ t = op;
115
+ break;
116
+ case 4:
117
+ _.label++;
118
+ return { value: op[1], done: false };
119
+ case 5:
120
+ _.label++;
121
+ y = op[1];
122
+ op = [0];
123
+ continue;
124
+ case 7:
125
+ op = _.ops.pop();
126
+ _.trys.pop();
127
+ continue;
128
+ default:
129
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
130
+ _ = 0;
131
+ continue;
132
+ }
133
+ if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
134
+ _.label = op[1];
135
+ break;
136
+ }
137
+ if (op[0] === 6 && _.label < t[1]) {
138
+ _.label = t[1];
139
+ t = op;
140
+ break;
141
+ }
142
+ if (t && _.label < t[2]) {
143
+ _.label = t[2];
144
+ _.ops.push(op);
145
+ break;
146
+ }
147
+ if (t[2]) _.ops.pop();
148
+ _.trys.pop();
149
+ continue;
150
+ }
151
+ op = body.call(thisArg, _);
152
+ } catch (e) {
153
+ op = [6, e];
154
+ y = 0;
155
+ } finally {
156
+ f = t = 0;
157
+ }
158
+ if (op[0] & 5) throw op[1];
159
+ return { value: op[0] ? op[1] : void 0, done: true };
160
+ }
161
+ };
162
+ Object.defineProperty(exports, "__esModule", { value: true });
163
+ exports.AsyncCache = exports.tryAsync = exports.getFullPath = exports.fileExists = exports.getUrlParams = void 0;
164
+ var fs = __importStar(__require("fs"));
165
+ var path = __importStar(__require("path"));
166
+ function getUrlParams(search) {
167
+ var hashes = search.slice(search.indexOf("?") + 1).split("&");
168
+ return hashes.reduce(function(params, hash) {
169
+ var _a;
170
+ var _b = hash.split("="), key = _b[0], val = _b[1];
171
+ return Object.assign(params, (_a = {}, _a[key] = decodeURIComponent(val), _a));
172
+ }, {});
173
+ }
174
+ exports.getUrlParams = getUrlParams;
175
+ function fileExists(path2) {
176
+ return __awaiter(this, void 0, void 0, function() {
177
+ var stat;
178
+ return __generator(this, function(_a) {
179
+ switch (_a.label) {
180
+ case 0:
181
+ _a.trys.push([0, 2, , 3]);
182
+ return [4, fs.promises.stat(path2)];
183
+ case 1:
184
+ stat = _a.sent();
185
+ return [2, stat.isFile()];
186
+ case 2:
187
+ _a.sent();
188
+ return [2, false];
189
+ case 3:
190
+ return [
191
+ 2
192
+ /*return*/
193
+ ];
194
+ }
195
+ });
196
+ });
197
+ }
198
+ exports.fileExists = fileExists;
199
+ function getFullPath(args) {
200
+ return path.isAbsolute(args.path) ? args.path : path.join(args.resolveDir, args.path);
201
+ }
202
+ exports.getFullPath = getFullPath;
203
+ function tryAsync(fn, module2, requiredFor) {
204
+ return __awaiter(this, void 0, void 0, function() {
205
+ return __generator(this, function(_a) {
206
+ switch (_a.label) {
207
+ case 0:
208
+ _a.trys.push([0, 2, , 3]);
209
+ return [4, fn()];
210
+ case 1:
211
+ return [2, _a.sent()];
212
+ case 2:
213
+ _a.sent();
214
+ throw new Error('Package "'.concat(module2, '" is required for ').concat(requiredFor, '. Please run "npm i -D ').concat(module2, '" and try again.'));
215
+ case 3:
216
+ return [
217
+ 2
218
+ /*return*/
219
+ ];
220
+ }
221
+ });
222
+ });
223
+ }
224
+ exports.tryAsync = tryAsync;
225
+ var AsyncCache = (
226
+ /** @class */
227
+ function() {
228
+ function AsyncCache2(enabled) {
229
+ if (enabled === void 0) {
230
+ enabled = true;
231
+ }
232
+ this.enabled = enabled;
233
+ this.store = /* @__PURE__ */ new Map();
234
+ }
235
+ AsyncCache2.prototype.get = function(key, fn) {
236
+ var _this = this;
237
+ if (!this.enabled) {
238
+ return fn();
239
+ }
240
+ var val = this.store.get(key);
241
+ if (!val) {
242
+ return fn().then(function(o) {
243
+ return _this.store.set(key, o), o;
244
+ });
245
+ }
246
+ return val;
247
+ };
248
+ return AsyncCache2;
249
+ }()
250
+ );
251
+ exports.AsyncCache = AsyncCache;
252
+ }
253
+ });
254
+ var require_paths = __commonJS({
255
+ "../../node_modules/esbuild-plugin-vue3/dist/paths.js"(exports) {
256
+ var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) {
257
+ if (k2 === void 0) k2 = k;
258
+ var desc = Object.getOwnPropertyDescriptor(m, k);
259
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
260
+ desc = { enumerable: true, get: function() {
261
+ return m[k];
262
+ } };
263
+ }
264
+ Object.defineProperty(o, k2, desc);
265
+ } : function(o, m, k, k2) {
266
+ if (k2 === void 0) k2 = k;
267
+ o[k2] = m[k];
268
+ });
269
+ var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? function(o, v) {
270
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
271
+ } : function(o, v) {
272
+ o["default"] = v;
273
+ });
274
+ var __importStar = exports && exports.__importStar || function(mod) {
275
+ if (mod && mod.__esModule) return mod;
276
+ var result = {};
277
+ if (mod != null) {
278
+ for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
279
+ }
280
+ __setModuleDefault(result, mod);
281
+ return result;
282
+ };
283
+ var __awaiter = exports && exports.__awaiter || function(thisArg, _arguments, P, generator) {
284
+ function adopt(value) {
285
+ return value instanceof P ? value : new P(function(resolve) {
286
+ resolve(value);
287
+ });
288
+ }
289
+ return new (P || (P = Promise))(function(resolve, reject) {
290
+ function fulfilled(value) {
291
+ try {
292
+ step(generator.next(value));
293
+ } catch (e) {
294
+ reject(e);
295
+ }
296
+ }
297
+ function rejected(value) {
298
+ try {
299
+ step(generator["throw"](value));
300
+ } catch (e) {
301
+ reject(e);
302
+ }
303
+ }
304
+ function step(result) {
305
+ result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
306
+ }
307
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
308
+ });
309
+ };
310
+ var __generator = exports && exports.__generator || function(thisArg, body) {
311
+ var _ = { label: 0, sent: function() {
312
+ if (t[0] & 1) throw t[1];
313
+ return t[1];
314
+ }, trys: [], ops: [] }, f, y, t, g;
315
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
316
+ return this;
317
+ }), g;
318
+ function verb(n) {
319
+ return function(v) {
320
+ return step([n, v]);
321
+ };
322
+ }
323
+ function step(op) {
324
+ if (f) throw new TypeError("Generator is already executing.");
325
+ while (_) try {
326
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
327
+ if (y = 0, t) op = [op[0] & 2, t.value];
328
+ switch (op[0]) {
329
+ case 0:
330
+ case 1:
331
+ t = op;
332
+ break;
333
+ case 4:
334
+ _.label++;
335
+ return { value: op[1], done: false };
336
+ case 5:
337
+ _.label++;
338
+ y = op[1];
339
+ op = [0];
340
+ continue;
341
+ case 7:
342
+ op = _.ops.pop();
343
+ _.trys.pop();
344
+ continue;
345
+ default:
346
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
347
+ _ = 0;
348
+ continue;
349
+ }
350
+ if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
351
+ _.label = op[1];
352
+ break;
353
+ }
354
+ if (op[0] === 6 && _.label < t[1]) {
355
+ _.label = t[1];
356
+ t = op;
357
+ break;
358
+ }
359
+ if (t && _.label < t[2]) {
360
+ _.label = t[2];
361
+ _.ops.push(op);
362
+ break;
363
+ }
364
+ if (t[2]) _.ops.pop();
365
+ _.trys.pop();
366
+ continue;
367
+ }
368
+ op = body.call(thisArg, _);
369
+ } catch (e) {
370
+ op = [6, e];
371
+ y = 0;
372
+ } finally {
373
+ f = t = 0;
374
+ }
375
+ if (op[0] & 5) throw op[1];
376
+ return { value: op[0] ? op[1] : void 0, done: true };
377
+ }
378
+ };
379
+ Object.defineProperty(exports, "__esModule", { value: true });
380
+ exports.replaceRules = exports.loadRules = void 0;
381
+ var utils_1 = require_utils();
382
+ var fs = __importStar(__require("fs"));
383
+ var typescript_1 = __require("typescript");
384
+ var rules = [];
385
+ function loadRules(opts, tsconfigPath) {
386
+ return __awaiter(this, void 0, void 0, function() {
387
+ var path, from, to;
388
+ return __generator(this, function(_a) {
389
+ switch (_a.label) {
390
+ case 0:
391
+ if (opts.pathAliases === false) {
392
+ return [2, false];
393
+ }
394
+ if (!opts.pathAliases) return [3, 1];
395
+ for (path in opts.pathAliases) {
396
+ from = "^" + replaceWildcard(path, "(.*)") + "$";
397
+ to = replaceWildcard(opts.pathAliases[path], "$1");
398
+ rules.push({
399
+ regex: new RegExp(from),
400
+ replacement: to
401
+ });
402
+ }
403
+ return [3, 3];
404
+ case 1:
405
+ return [4, loadFromTsconfig(tsconfigPath)];
406
+ case 2:
407
+ _a.sent();
408
+ _a.label = 3;
409
+ case 3:
410
+ return [2, rules.length > 0];
411
+ }
412
+ });
413
+ });
414
+ }
415
+ exports.loadRules = loadRules;
416
+ function loadFromTsconfig(path) {
417
+ var _a;
418
+ return __awaiter(this, void 0, void 0, function() {
419
+ var _b, tsconfig, error, _c, _d, path_1, dests, from, to;
420
+ return __generator(this, function(_e) {
421
+ switch (_e.label) {
422
+ case 0:
423
+ return [4, (0, utils_1.fileExists)(path)];
424
+ case 1:
425
+ if (!_e.sent()) {
426
+ return [
427
+ 2
428
+ /*return*/
429
+ ];
430
+ }
431
+ _c = typescript_1.parseConfigFileTextToJson;
432
+ _d = [path];
433
+ return [4, fs.promises.readFile(path)];
434
+ case 2:
435
+ _b = _c.apply(void 0, _d.concat([_e.sent().toString()])), tsconfig = _b.config, error = _b.error;
436
+ if (error) {
437
+ throw new Error("Failed to parse tsconfig.json: ".concat(JSON.stringify(error)));
438
+ }
439
+ if (!((_a = tsconfig === null || tsconfig === void 0 ? void 0 : tsconfig.compilerOptions) === null || _a === void 0 ? void 0 : _a.paths)) {
440
+ return [
441
+ 2
442
+ /*return*/
443
+ ];
444
+ }
445
+ for (path_1 in tsconfig.compilerOptions.paths) {
446
+ dests = tsconfig.compilerOptions.paths[path_1];
447
+ if (dests.length == 0) {
448
+ continue;
449
+ }
450
+ from = "^" + replaceWildcard(path_1, "(.*)") + "$";
451
+ to = replaceWildcard(dests[0], "$1");
452
+ rules.push({
453
+ regex: new RegExp(from),
454
+ replacement: to
455
+ });
456
+ }
457
+ return [
458
+ 2
459
+ /*return*/
460
+ ];
461
+ }
462
+ });
463
+ });
464
+ }
465
+ function replaceWildcard(str, repl) {
466
+ return str.replace(/\*/g, repl);
467
+ }
468
+ function replaceRules(path) {
469
+ for (var _i = 0, rules_1 = rules; _i < rules_1.length; _i++) {
470
+ var rule = rules_1[_i];
471
+ path = path.replace(rule.regex, rule.replacement);
472
+ }
473
+ return path;
474
+ }
475
+ exports.replaceRules = replaceRules;
476
+ }
477
+ });
478
+ var require_html = __commonJS({
479
+ "../../node_modules/esbuild-plugin-vue3/dist/html.js"(exports) {
480
+ var __assign = exports && exports.__assign || function() {
481
+ __assign = Object.assign || function(t) {
482
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
483
+ s = arguments[i];
484
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
485
+ t[p] = s[p];
486
+ }
487
+ return t;
488
+ };
489
+ return __assign.apply(this, arguments);
490
+ };
491
+ var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) {
492
+ if (k2 === void 0) k2 = k;
493
+ var desc = Object.getOwnPropertyDescriptor(m, k);
494
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
495
+ desc = { enumerable: true, get: function() {
496
+ return m[k];
497
+ } };
498
+ }
499
+ Object.defineProperty(o, k2, desc);
500
+ } : function(o, m, k, k2) {
501
+ if (k2 === void 0) k2 = k;
502
+ o[k2] = m[k];
503
+ });
504
+ var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? function(o, v) {
505
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
506
+ } : function(o, v) {
507
+ o["default"] = v;
508
+ });
509
+ var __importStar = exports && exports.__importStar || function(mod) {
510
+ if (mod && mod.__esModule) return mod;
511
+ var result = {};
512
+ if (mod != null) {
513
+ for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
514
+ }
515
+ __setModuleDefault(result, mod);
516
+ return result;
517
+ };
518
+ var __awaiter = exports && exports.__awaiter || function(thisArg, _arguments, P, generator) {
519
+ function adopt(value) {
520
+ return value instanceof P ? value : new P(function(resolve) {
521
+ resolve(value);
522
+ });
523
+ }
524
+ return new (P || (P = Promise))(function(resolve, reject) {
525
+ function fulfilled(value) {
526
+ try {
527
+ step(generator.next(value));
528
+ } catch (e) {
529
+ reject(e);
530
+ }
531
+ }
532
+ function rejected(value) {
533
+ try {
534
+ step(generator["throw"](value));
535
+ } catch (e) {
536
+ reject(e);
537
+ }
538
+ }
539
+ function step(result) {
540
+ result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
541
+ }
542
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
543
+ });
544
+ };
545
+ var __generator = exports && exports.__generator || function(thisArg, body) {
546
+ var _ = { label: 0, sent: function() {
547
+ if (t[0] & 1) throw t[1];
548
+ return t[1];
549
+ }, trys: [], ops: [] }, f, y, t, g;
550
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
551
+ return this;
552
+ }), g;
553
+ function verb(n) {
554
+ return function(v) {
555
+ return step([n, v]);
556
+ };
557
+ }
558
+ function step(op) {
559
+ if (f) throw new TypeError("Generator is already executing.");
560
+ while (_) try {
561
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
562
+ if (y = 0, t) op = [op[0] & 2, t.value];
563
+ switch (op[0]) {
564
+ case 0:
565
+ case 1:
566
+ t = op;
567
+ break;
568
+ case 4:
569
+ _.label++;
570
+ return { value: op[1], done: false };
571
+ case 5:
572
+ _.label++;
573
+ y = op[1];
574
+ op = [0];
575
+ continue;
576
+ case 7:
577
+ op = _.ops.pop();
578
+ _.trys.pop();
579
+ continue;
580
+ default:
581
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
582
+ _ = 0;
583
+ continue;
584
+ }
585
+ if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
586
+ _.label = op[1];
587
+ break;
588
+ }
589
+ if (op[0] === 6 && _.label < t[1]) {
590
+ _.label = t[1];
591
+ t = op;
592
+ break;
593
+ }
594
+ if (t && _.label < t[2]) {
595
+ _.label = t[2];
596
+ _.ops.push(op);
597
+ break;
598
+ }
599
+ if (t[2]) _.ops.pop();
600
+ _.trys.pop();
601
+ continue;
602
+ }
603
+ op = body.call(thisArg, _);
604
+ } catch (e) {
605
+ op = [6, e];
606
+ y = 0;
607
+ } finally {
608
+ f = t = 0;
609
+ }
610
+ if (op[0] & 5) throw op[1];
611
+ return { value: op[0] ? op[1] : void 0, done: true };
612
+ }
613
+ };
614
+ Object.defineProperty(exports, "__esModule", { value: true });
615
+ exports.generateIndexHTML = void 0;
616
+ var fs = __importStar(__require("fs"));
617
+ var path = __importStar(__require("path"));
618
+ var utils_1 = require_utils();
619
+ function generateIndexHTML(result, opts, min, inlineStyles) {
620
+ return __awaiter(this, void 0, void 0, function() {
621
+ var cheerio, $, _a, _b, _i, _c, item, link, name_1, ext, script, link, _d, inlineStyles_1, style, el, html, minify;
622
+ return __generator(this, function(_e) {
623
+ switch (_e.label) {
624
+ case 0:
625
+ if (!result.metafile) {
626
+ throw new Error('The "metafile" option must be set to true in the build options');
627
+ }
628
+ if (!opts.outFile) {
629
+ throw new Error("No outFile was specified and it could not be inferred from the build options");
630
+ }
631
+ return [4, (0, utils_1.tryAsync)(function() {
632
+ return Promise.resolve().then(function() {
633
+ return __importStar(__require("cheerio"));
634
+ });
635
+ }, "cheerio", "HTML generation")];
636
+ case 1:
637
+ cheerio = _e.sent();
638
+ _b = (_a = cheerio).load;
639
+ return [4, fs.promises.readFile(opts.sourceFile)];
640
+ case 2:
641
+ $ = _b.apply(_a, [_e.sent()]);
642
+ if (opts.preload) {
643
+ for (_i = 0, _c = opts.preload; _i < _c.length; _i++) {
644
+ item = _c[_i];
645
+ link = $("<link>");
646
+ link.attr("rel", item.prefetch ? "prefetch" : "preload");
647
+ link.attr("href", item.href);
648
+ link.attr("as", item.as);
649
+ $("head").append(link);
650
+ }
651
+ }
652
+ for (name_1 in result.metafile.outputs) {
653
+ if (opts.trimPath) {
654
+ name_1 = name_1.replace(opts.trimPath, "");
655
+ }
656
+ if (opts.pathPrefix && !name_1.startsWith(opts.pathPrefix)) {
657
+ name_1 = opts.pathPrefix + name_1;
658
+ }
659
+ name_1 = path.normalize(name_1).replace(/\\/g, "/");
660
+ ext = path.extname(name_1);
661
+ if (ext === ".js") {
662
+ script = $("<script>");
663
+ script.attr("src", name_1);
664
+ $("body").append(script);
665
+ } else if (ext === ".css") {
666
+ link = $("<link rel='stylesheet'>");
667
+ link.attr("href", name_1);
668
+ $("head").append(link);
669
+ }
670
+ }
671
+ if (inlineStyles) {
672
+ for (_d = 0, inlineStyles_1 = inlineStyles; _d < inlineStyles_1.length; _d++) {
673
+ style = inlineStyles_1[_d];
674
+ el = $("<style>");
675
+ el.text(style);
676
+ $("head").append(el);
677
+ }
678
+ }
679
+ html = $.html();
680
+ if (!min) return [3, 4];
681
+ return [4, (0, utils_1.tryAsync)(function() {
682
+ return Promise.resolve().then(function() {
683
+ return __importStar(__require("html-minifier"));
684
+ });
685
+ }, "html-minifier", "HTML minification")];
686
+ case 3:
687
+ minify = _e.sent().minify;
688
+ html = minify(html, __assign({ collapseWhitespace: true, minifyCSS: true, removeComments: true }, opts.minifyOptions));
689
+ _e.label = 4;
690
+ case 4:
691
+ return [4, fs.promises.writeFile(opts.outFile, html)];
692
+ case 5:
693
+ _e.sent();
694
+ return [
695
+ 2
696
+ /*return*/
697
+ ];
698
+ }
699
+ });
700
+ });
701
+ }
702
+ exports.generateIndexHTML = generateIndexHTML;
703
+ }
704
+ });
705
+ var require_random = __commonJS({
706
+ "../../node_modules/esbuild-plugin-vue3/dist/random.js"(exports) {
707
+ Object.defineProperty(exports, "__esModule", { value: true });
708
+ var crypto_1 = __require("crypto");
709
+ var randomBytesClassic = crypto_1.randomBytes;
710
+ function default_1(seed) {
711
+ if (seed === void 0) {
712
+ seed = randomBytesClassic(32);
713
+ }
714
+ randomBytes.seed = seed;
715
+ randomBytes.currentSeed = seed;
716
+ return randomBytes;
717
+ function randomBytes(n) {
718
+ var result = Buffer.allocUnsafe(n);
719
+ var used = 0;
720
+ while (used < result.length) {
721
+ randomBytes.currentSeed = seed = next(seed);
722
+ seed.copy(result, used);
723
+ used += seed.length;
724
+ }
725
+ return result;
726
+ }
727
+ }
728
+ exports.default = default_1;
729
+ function next(seed) {
730
+ return (0, crypto_1.createHash)("sha256").update(seed).digest();
731
+ }
732
+ }
733
+ });
734
+ var require_dist = __commonJS({
735
+ "../../node_modules/esbuild-plugin-vue3/dist/index.js"(exports, module) {
736
+ var __assign = exports && exports.__assign || function() {
737
+ __assign = Object.assign || function(t) {
738
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
739
+ s = arguments[i];
740
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
741
+ t[p] = s[p];
742
+ }
743
+ return t;
744
+ };
745
+ return __assign.apply(this, arguments);
746
+ };
747
+ var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) {
748
+ if (k2 === void 0) k2 = k;
749
+ var desc = Object.getOwnPropertyDescriptor(m, k);
750
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
751
+ desc = { enumerable: true, get: function() {
752
+ return m[k];
753
+ } };
754
+ }
755
+ Object.defineProperty(o, k2, desc);
756
+ } : function(o, m, k, k2) {
757
+ if (k2 === void 0) k2 = k;
758
+ o[k2] = m[k];
759
+ });
760
+ var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? function(o, v) {
761
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
762
+ } : function(o, v) {
763
+ o["default"] = v;
764
+ });
765
+ var __importStar = exports && exports.__importStar || function(mod) {
766
+ if (mod && mod.__esModule) return mod;
767
+ var result = {};
768
+ if (mod != null) {
769
+ for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
770
+ }
771
+ __setModuleDefault(result, mod);
772
+ return result;
773
+ };
774
+ var __awaiter = exports && exports.__awaiter || function(thisArg, _arguments, P, generator) {
775
+ function adopt(value) {
776
+ return value instanceof P ? value : new P(function(resolve) {
777
+ resolve(value);
778
+ });
779
+ }
780
+ return new (P || (P = Promise))(function(resolve, reject) {
781
+ function fulfilled(value) {
782
+ try {
783
+ step(generator.next(value));
784
+ } catch (e) {
785
+ reject(e);
786
+ }
787
+ }
788
+ function rejected(value) {
789
+ try {
790
+ step(generator["throw"](value));
791
+ } catch (e) {
792
+ reject(e);
793
+ }
794
+ }
795
+ function step(result) {
796
+ result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
797
+ }
798
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
799
+ });
800
+ };
801
+ var __generator = exports && exports.__generator || function(thisArg, body) {
802
+ var _ = { label: 0, sent: function() {
803
+ if (t[0] & 1) throw t[1];
804
+ return t[1];
805
+ }, trys: [], ops: [] }, f, y, t, g;
806
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
807
+ return this;
808
+ }), g;
809
+ function verb(n) {
810
+ return function(v) {
811
+ return step([n, v]);
812
+ };
813
+ }
814
+ function step(op) {
815
+ if (f) throw new TypeError("Generator is already executing.");
816
+ while (_) try {
817
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
818
+ if (y = 0, t) op = [op[0] & 2, t.value];
819
+ switch (op[0]) {
820
+ case 0:
821
+ case 1:
822
+ t = op;
823
+ break;
824
+ case 4:
825
+ _.label++;
826
+ return { value: op[1], done: false };
827
+ case 5:
828
+ _.label++;
829
+ y = op[1];
830
+ op = [0];
831
+ continue;
832
+ case 7:
833
+ op = _.ops.pop();
834
+ _.trys.pop();
835
+ continue;
836
+ default:
837
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
838
+ _ = 0;
839
+ continue;
840
+ }
841
+ if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
842
+ _.label = op[1];
843
+ break;
844
+ }
845
+ if (op[0] === 6 && _.label < t[1]) {
846
+ _.label = t[1];
847
+ t = op;
848
+ break;
849
+ }
850
+ if (t && _.label < t[2]) {
851
+ _.label = t[2];
852
+ _.ops.push(op);
853
+ break;
854
+ }
855
+ if (t[2]) _.ops.pop();
856
+ _.trys.pop();
857
+ continue;
858
+ }
859
+ op = body.call(thisArg, _);
860
+ } catch (e) {
861
+ op = [6, e];
862
+ y = 0;
863
+ } finally {
864
+ f = t = 0;
865
+ }
866
+ if (op[0] & 5) throw op[1];
867
+ return { value: op[0] ? op[1] : void 0, done: true };
868
+ }
869
+ };
870
+ var __rest = exports && exports.__rest || function(s, e) {
871
+ var t = {};
872
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
873
+ t[p] = s[p];
874
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
875
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
876
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
877
+ t[p[i]] = s[p[i]];
878
+ }
879
+ return t;
880
+ };
881
+ var __importDefault = exports && exports.__importDefault || function(mod) {
882
+ return mod && mod.__esModule ? mod : { "default": mod };
883
+ };
884
+ var path = __importStar(__require("path"));
885
+ var fs = __importStar(__require("fs"));
886
+ var crypto = __importStar(__require("crypto"));
887
+ var typescript_1 = __importDefault(__require("typescript"));
888
+ var sfc = __importStar(__require("@vue/compiler-sfc"));
889
+ var core = __importStar(__require("@vue/compiler-core"));
890
+ var paths_1 = require_paths();
891
+ var utils_1 = require_utils();
892
+ var html_1 = require_html();
893
+ var random_1 = __importDefault(require_random());
894
+ var vuePlugin = function(opts) {
895
+ if (opts === void 0) {
896
+ opts = {};
897
+ }
898
+ return {
899
+ name: "vue",
900
+ setup: function(_a) {
901
+ var _b;
902
+ var buildOpts = _a.initialOptions, build = __rest(_a, ["initialOptions"]);
903
+ return __awaiter(this, void 0, void 0, function() {
904
+ var generatedCSS, mustReplace, random, cache, transforms, _loop_1, name_1;
905
+ var _this = this;
906
+ return __generator(this, function(_c) {
907
+ switch (_c.label) {
908
+ case 0:
909
+ buildOpts.define = __assign(__assign({}, buildOpts.define), { "__VUE_OPTIONS_API__": opts.disableOptionsApi ? "false" : "true", "__VUE_PROD_DEVTOOLS__": opts.enableDevTools ? "true" : "false", "__VUE_PROD_HYDRATION_MISMATCH_DETAILS__": opts.enableHydrationMismatchDetails ? "true" : "false" });
910
+ if (opts.generateHTML && !buildOpts.metafile) {
911
+ buildOpts.metafile = true;
912
+ }
913
+ if (opts.disableResolving) {
914
+ opts.pathAliases = false;
915
+ build.onStart(function() {
916
+ return { warnings: [{ text: "The disableResolving option is deprecated, use pathAliases instead" }] };
917
+ });
918
+ }
919
+ generatedCSS = [];
920
+ return [4, (0, paths_1.loadRules)(opts, (_b = buildOpts.tsconfig) !== null && _b !== void 0 ? _b : "tsconfig.json")];
921
+ case 1:
922
+ mustReplace = _c.sent();
923
+ random = (0, random_1.default)(typeof opts.scopeId === "object" && typeof opts.scopeId.random === "string" ? opts.scopeId.random : void 0);
924
+ cache = new utils_1.AsyncCache(!opts.disableCache);
925
+ transforms = {};
926
+ if (opts.directiveTransforms) {
927
+ _loop_1 = function(name_12) {
928
+ if (Object.prototype.hasOwnProperty.call(opts.directiveTransforms, name_12)) {
929
+ var propName_1 = opts.directiveTransforms[name_12];
930
+ var transformation_1 = function(dir, name) {
931
+ var _a2;
932
+ return {
933
+ key: core.createSimpleExpression(JSON.stringify(name), false),
934
+ value: (_a2 = dir.exp) !== null && _a2 !== void 0 ? _a2 : core.createSimpleExpression("void 0", false),
935
+ loc: dir.loc,
936
+ type: 16
937
+ };
938
+ };
939
+ if (typeof propName_1 === "function") {
940
+ transforms[name_12] = function() {
941
+ var args = [];
942
+ for (var _i = 0; _i < arguments.length; _i++) {
943
+ args[_i] = arguments[_i];
944
+ }
945
+ var ret = propName_1(args[0], args[1], args[2]);
946
+ return {
947
+ props: ret === void 0 ? [] : [transformation_1(args[0], ret)]
948
+ };
949
+ };
950
+ } else {
951
+ transforms[name_12] = function(dir) {
952
+ return {
953
+ props: propName_1 === false ? [] : [transformation_1(dir, propName_1)]
954
+ };
955
+ };
956
+ }
957
+ }
958
+ };
959
+ for (name_1 in opts.directiveTransforms) {
960
+ _loop_1(name_1);
961
+ }
962
+ }
963
+ if (mustReplace) {
964
+ build.onResolve({ filter: /.*/ }, function(args) {
965
+ return __awaiter(_this, void 0, void 0, function() {
966
+ var aliased, fullPath, possible, _i, possible_1, postfix;
967
+ return __generator(this, function(_a2) {
968
+ switch (_a2.label) {
969
+ case 0:
970
+ aliased = (0, paths_1.replaceRules)(args.path);
971
+ fullPath = path.isAbsolute(aliased) ? aliased : path.join(process.cwd(), aliased);
972
+ return [4, (0, utils_1.fileExists)(fullPath)];
973
+ case 1:
974
+ if (!!_a2.sent()) return [3, 6];
975
+ possible = [
976
+ ".ts",
977
+ "/index.ts",
978
+ ".js",
979
+ "/index.js"
980
+ ];
981
+ _i = 0, possible_1 = possible;
982
+ _a2.label = 2;
983
+ case 2:
984
+ if (!(_i < possible_1.length)) return [3, 5];
985
+ postfix = possible_1[_i];
986
+ return [4, (0, utils_1.fileExists)(fullPath + postfix)];
987
+ case 3:
988
+ if (_a2.sent()) {
989
+ return [2, {
990
+ path: path.normalize(fullPath + postfix),
991
+ namespace: "file"
992
+ }];
993
+ }
994
+ _a2.label = 4;
995
+ case 4:
996
+ _i++;
997
+ return [3, 2];
998
+ case 5:
999
+ return [3, 7];
1000
+ case 6:
1001
+ return [2, {
1002
+ path: path.normalize(fullPath),
1003
+ namespace: "file"
1004
+ }];
1005
+ case 7:
1006
+ return [
1007
+ 2
1008
+ /*return*/
1009
+ ];
1010
+ }
1011
+ });
1012
+ });
1013
+ });
1014
+ }
1015
+ build.onResolve({ filter: /\.vue/ }, function(args) {
1016
+ return __awaiter(_this, void 0, void 0, function() {
1017
+ var params;
1018
+ return __generator(this, function(_a2) {
1019
+ params = (0, utils_1.getUrlParams)(args.path);
1020
+ return [2, {
1021
+ path: (0, utils_1.getFullPath)(args),
1022
+ namespace: params.type === "script" ? "sfc-script" : params.type === "template" ? "sfc-template" : params.type === "style" ? "sfc-style" : "file",
1023
+ pluginData: __assign(__assign({}, args.pluginData), { index: params.index })
1024
+ }];
1025
+ });
1026
+ });
1027
+ });
1028
+ build.onLoad({ filter: /\.vue$/ }, function(args) {
1029
+ return cache.get([args.path, args.namespace], function() {
1030
+ return __awaiter(_this, void 0, void 0, function() {
1031
+ var encPath, source, filename, id, descriptor, script, dataId, code, src, style, renderFuncName;
1032
+ return __generator(this, function(_a2) {
1033
+ switch (_a2.label) {
1034
+ case 0:
1035
+ encPath = args.path.replace(/\\/g, "\\\\");
1036
+ return [4, fs.promises.readFile(args.path, "utf8")];
1037
+ case 1:
1038
+ source = _a2.sent();
1039
+ filename = path.relative(process.cwd(), args.path);
1040
+ id = !opts.scopeId || opts.scopeId === "hash" ? crypto.createHash("md5").update(filename).digest().toString("hex").substring(0, 8) : random(4).toString("hex");
1041
+ descriptor = sfc.parse(source, {
1042
+ filename
1043
+ }).descriptor;
1044
+ script = descriptor.script || descriptor.scriptSetup ? sfc.compileScript(descriptor, { id, fs: typescript_1.default.sys }) : void 0;
1045
+ dataId = "data-v-" + id;
1046
+ code = "";
1047
+ if (descriptor.script || descriptor.scriptSetup) {
1048
+ src = descriptor.script && !descriptor.scriptSetup && descriptor.script.src || encPath;
1049
+ code += 'import script from "'.concat(src, '?type=script";');
1050
+ } else {
1051
+ code += "const script = {};";
1052
+ }
1053
+ for (style in descriptor.styles) {
1054
+ code += 'import "'.concat(encPath, "?type=style&index=").concat(style, '";');
1055
+ }
1056
+ renderFuncName = opts.renderSSR ? "ssrRender" : "render";
1057
+ code += "import { ".concat(renderFuncName, ' } from "').concat(encPath, '?type=template"; script.').concat(renderFuncName, " = ").concat(renderFuncName, ";");
1058
+ code += "script.__file = ".concat(JSON.stringify(filename), ";");
1059
+ if (descriptor.styles.some(function(o) {
1060
+ return o.scoped;
1061
+ })) {
1062
+ code += "script.__scopeId = ".concat(JSON.stringify(dataId), ";");
1063
+ }
1064
+ if (opts.renderSSR) {
1065
+ code += "script.__ssrInlineRender = true;";
1066
+ }
1067
+ code += "export default script;";
1068
+ return [2, {
1069
+ contents: code,
1070
+ resolveDir: path.dirname(args.path),
1071
+ pluginData: { descriptor, id: dataId, script },
1072
+ watchFiles: [args.path]
1073
+ }];
1074
+ }
1075
+ });
1076
+ });
1077
+ });
1078
+ });
1079
+ build.onLoad({ filter: /.*/, namespace: "sfc-script" }, function(args) {
1080
+ return cache.get([args.path, args.namespace], function() {
1081
+ return __awaiter(_this, void 0, void 0, function() {
1082
+ var script, code, sourceMap;
1083
+ return __generator(this, function(_a2) {
1084
+ script = args.pluginData.script;
1085
+ if (script) {
1086
+ code = script.content;
1087
+ if (buildOpts.sourcemap && script.map) {
1088
+ sourceMap = Buffer.from(JSON.stringify(script.map)).toString("base64");
1089
+ code += "\n\n//@ sourceMappingURL=data:application/json;charset=utf-8;base64," + sourceMap;
1090
+ }
1091
+ return [2, {
1092
+ contents: code,
1093
+ loader: script.lang === "ts" ? "ts" : "js",
1094
+ resolveDir: path.dirname(args.path)
1095
+ }];
1096
+ }
1097
+ return [
1098
+ 2
1099
+ /*return*/
1100
+ ];
1101
+ });
1102
+ });
1103
+ });
1104
+ });
1105
+ build.onLoad({ filter: /.*/, namespace: "sfc-template" }, function(args) {
1106
+ return cache.get([args.path, args.namespace], function() {
1107
+ return __awaiter(_this, void 0, void 0, function() {
1108
+ var _a2, descriptor, id, script, source, pug, result;
1109
+ return __generator(this, function(_b2) {
1110
+ switch (_b2.label) {
1111
+ case 0:
1112
+ _a2 = args.pluginData, descriptor = _a2.descriptor, id = _a2.id, script = _a2.script;
1113
+ if (!descriptor.template) {
1114
+ throw new Error("Missing template");
1115
+ }
1116
+ source = descriptor.template.content;
1117
+ if (!(descriptor.template.lang === "pug")) return [3, 2];
1118
+ return [4, (0, utils_1.tryAsync)(function() {
1119
+ return Promise.resolve().then(function() {
1120
+ return __importStar(__require("pug"));
1121
+ });
1122
+ }, "pug", "Pug template rendering")];
1123
+ case 1:
1124
+ pug = _b2.sent();
1125
+ source = pug.render(descriptor.template.content);
1126
+ source = source.replace(/(\B#.*?|\bv-.*?)="\1"/g, "$1");
1127
+ _b2.label = 2;
1128
+ case 2:
1129
+ result = sfc.compileTemplate({
1130
+ id,
1131
+ source,
1132
+ filename: args.path,
1133
+ scoped: descriptor.styles.some(function(o) {
1134
+ return o.scoped;
1135
+ }),
1136
+ slotted: descriptor.slotted,
1137
+ ssr: opts.renderSSR,
1138
+ ssrCssVars: [],
1139
+ isProd: process.env.NODE_ENV === "production" || buildOpts.minify,
1140
+ compilerOptions: __assign({ inSSR: opts.renderSSR, directiveTransforms: transforms, bindingMetadata: script === null || script === void 0 ? void 0 : script.bindings }, opts.compilerOptions)
1141
+ });
1142
+ if (result.errors.length > 0) {
1143
+ return [2, {
1144
+ errors: result.errors.map(function(o) {
1145
+ return typeof o === "string" ? { text: o } : {
1146
+ text: o.message,
1147
+ location: o.loc && {
1148
+ column: o.loc.start.column,
1149
+ file: descriptor.filename,
1150
+ line: o.loc.start.line + descriptor.template.loc.start.line + 1,
1151
+ lineText: o.loc.source
1152
+ }
1153
+ };
1154
+ })
1155
+ }];
1156
+ }
1157
+ return [2, {
1158
+ contents: result.code,
1159
+ warnings: result.tips.map(function(o) {
1160
+ return { text: o };
1161
+ }),
1162
+ loader: "ts",
1163
+ resolveDir: path.dirname(args.path)
1164
+ }];
1165
+ }
1166
+ });
1167
+ });
1168
+ });
1169
+ });
1170
+ build.onLoad({ filter: /.*/, namespace: "sfc-style" }, function(args) {
1171
+ return cache.get([args.path, args.namespace], function() {
1172
+ return __awaiter(_this, void 0, void 0, function() {
1173
+ var _a2, descriptor, index, id, style, includedFiles, result, errors, cssText, contents;
1174
+ var _b2, _c2;
1175
+ return __generator(this, function(_d) {
1176
+ switch (_d.label) {
1177
+ case 0:
1178
+ _a2 = args.pluginData, descriptor = _a2.descriptor, index = _a2.index, id = _a2.id;
1179
+ style = descriptor.styles[index];
1180
+ includedFiles = [];
1181
+ return [4, sfc.compileStyleAsync({
1182
+ filename: args.path,
1183
+ id,
1184
+ source: style.content,
1185
+ postcssOptions: (_b2 = opts.postcss) === null || _b2 === void 0 ? void 0 : _b2.options,
1186
+ postcssPlugins: (_c2 = opts.postcss) === null || _c2 === void 0 ? void 0 : _c2.plugins,
1187
+ preprocessLang: style.lang,
1188
+ preprocessOptions: Object.assign({
1189
+ includePaths: [
1190
+ path.dirname(args.path)
1191
+ ],
1192
+ importer: [
1193
+ function(url) {
1194
+ var projectRoot = process.env.npm_config_local_prefix || process.cwd();
1195
+ var modulePath = path.join(projectRoot, "node_modules", url);
1196
+ if (fs.existsSync(modulePath)) {
1197
+ return { file: modulePath };
1198
+ }
1199
+ return null;
1200
+ },
1201
+ function(url) {
1202
+ return { file: (0, paths_1.replaceRules)(url) };
1203
+ }
1204
+ ]
1205
+ }, opts.preprocessorOptions),
1206
+ scoped: style.scoped
1207
+ })];
1208
+ case 1:
1209
+ result = _d.sent();
1210
+ if (result.errors.length > 0) {
1211
+ errors = result.errors;
1212
+ return [2, {
1213
+ errors: errors.map(function(o) {
1214
+ return {
1215
+ text: o.message,
1216
+ location: {
1217
+ column: o.column,
1218
+ line: o.file === args.path ? style.loc.start.line + o.line - 1 : o.line,
1219
+ file: o.file.replace(/\?.*?$/, ""),
1220
+ namespace: "file"
1221
+ }
1222
+ };
1223
+ })
1224
+ }];
1225
+ }
1226
+ if (opts.cssInline) {
1227
+ if (opts.generateHTML) {
1228
+ generatedCSS.push(result.code);
1229
+ return [2, {
1230
+ contents: "",
1231
+ loader: "js"
1232
+ }];
1233
+ }
1234
+ cssText = result.code;
1235
+ contents = '\n {\n const el = document.createElement("style");\n el.textContent = '.concat(JSON.stringify(cssText), ";\n document.head.append(el);\n }");
1236
+ return [2, {
1237
+ contents,
1238
+ loader: "js",
1239
+ resolveDir: path.dirname(args.path),
1240
+ watchFiles: includedFiles
1241
+ }];
1242
+ }
1243
+ return [2, {
1244
+ contents: result.code,
1245
+ loader: "css",
1246
+ resolveDir: path.dirname(args.path),
1247
+ watchFiles: includedFiles
1248
+ }];
1249
+ }
1250
+ });
1251
+ });
1252
+ });
1253
+ });
1254
+ build.onEnd(function(result) {
1255
+ return __awaiter(_this, void 0, void 0, function() {
1256
+ var outDir;
1257
+ var _a2, _b2, _c2, _d;
1258
+ var _e, _f, _g;
1259
+ return __generator(this, function(_h) {
1260
+ switch (_h.label) {
1261
+ case 0:
1262
+ if (!((opts === null || opts === void 0 ? void 0 : opts.generateHTML) && result.errors.length == 0)) return [3, 2];
1263
+ if (typeof opts.generateHTML === "string") {
1264
+ opts.generateHTML = {
1265
+ sourceFile: opts.generateHTML
1266
+ };
1267
+ }
1268
+ outDir = buildOpts.outdir ? buildOpts.outdir : buildOpts.outfile ? path.dirname(buildOpts.outfile) : void 0;
1269
+ (_a2 = (_e = opts.generateHTML).trimPath) !== null && _a2 !== void 0 ? _a2 : _e.trimPath = outDir;
1270
+ (_b2 = (_f = opts.generateHTML).pathPrefix) !== null && _b2 !== void 0 ? _b2 : _f.pathPrefix = "/";
1271
+ (_c2 = (_g = opts.generateHTML).outFile) !== null && _c2 !== void 0 ? _c2 : _g.outFile = outDir && path.join(outDir, "index.html");
1272
+ return [4, (0, html_1.generateIndexHTML)(result, opts.generateHTML, (_d = buildOpts.minify) !== null && _d !== void 0 ? _d : false, opts.cssInline ? generatedCSS : void 0)];
1273
+ case 1:
1274
+ _h.sent();
1275
+ _h.label = 2;
1276
+ case 2:
1277
+ return [
1278
+ 2
1279
+ /*return*/
1280
+ ];
1281
+ }
1282
+ });
1283
+ });
1284
+ });
1285
+ return [
1286
+ 2
1287
+ /*return*/
1288
+ ];
1289
+ }
1290
+ });
1291
+ });
1292
+ }
1293
+ };
1294
+ };
1295
+ module.exports = vuePlugin;
1296
+ }
1297
+ });
1298
+ var require_vendors = __commonJS({
1299
+ "../../node_modules/is-ci/node_modules/ci-info/vendors.json"(exports, module) {
1300
+ module.exports = [
1301
+ {
1302
+ name: "Agola CI",
1303
+ constant: "AGOLA",
1304
+ env: "AGOLA_GIT_REF",
1305
+ pr: "AGOLA_PULL_REQUEST_ID"
1306
+ },
1307
+ {
1308
+ name: "Appcircle",
1309
+ constant: "APPCIRCLE",
1310
+ env: "AC_APPCIRCLE",
1311
+ pr: {
1312
+ env: "AC_GIT_PR",
1313
+ ne: "false"
1314
+ }
1315
+ },
1316
+ {
1317
+ name: "AppVeyor",
1318
+ constant: "APPVEYOR",
1319
+ env: "APPVEYOR",
1320
+ pr: "APPVEYOR_PULL_REQUEST_NUMBER"
1321
+ },
1322
+ {
1323
+ name: "AWS CodeBuild",
1324
+ constant: "CODEBUILD",
1325
+ env: "CODEBUILD_BUILD_ARN",
1326
+ pr: {
1327
+ env: "CODEBUILD_WEBHOOK_EVENT",
1328
+ any: [
1329
+ "PULL_REQUEST_CREATED",
1330
+ "PULL_REQUEST_UPDATED",
1331
+ "PULL_REQUEST_REOPENED"
1332
+ ]
1333
+ }
1334
+ },
1335
+ {
1336
+ name: "Azure Pipelines",
1337
+ constant: "AZURE_PIPELINES",
1338
+ env: "TF_BUILD",
1339
+ pr: {
1340
+ BUILD_REASON: "PullRequest"
1341
+ }
1342
+ },
1343
+ {
1344
+ name: "Bamboo",
1345
+ constant: "BAMBOO",
1346
+ env: "bamboo_planKey"
1347
+ },
1348
+ {
1349
+ name: "Bitbucket Pipelines",
1350
+ constant: "BITBUCKET",
1351
+ env: "BITBUCKET_COMMIT",
1352
+ pr: "BITBUCKET_PR_ID"
1353
+ },
1354
+ {
1355
+ name: "Bitrise",
1356
+ constant: "BITRISE",
1357
+ env: "BITRISE_IO",
1358
+ pr: "BITRISE_PULL_REQUEST"
1359
+ },
1360
+ {
1361
+ name: "Buddy",
1362
+ constant: "BUDDY",
1363
+ env: "BUDDY_WORKSPACE_ID",
1364
+ pr: "BUDDY_EXECUTION_PULL_REQUEST_ID"
1365
+ },
1366
+ {
1367
+ name: "Buildkite",
1368
+ constant: "BUILDKITE",
1369
+ env: "BUILDKITE",
1370
+ pr: {
1371
+ env: "BUILDKITE_PULL_REQUEST",
1372
+ ne: "false"
1373
+ }
1374
+ },
1375
+ {
1376
+ name: "CircleCI",
1377
+ constant: "CIRCLE",
1378
+ env: "CIRCLECI",
1379
+ pr: "CIRCLE_PULL_REQUEST"
1380
+ },
1381
+ {
1382
+ name: "Cirrus CI",
1383
+ constant: "CIRRUS",
1384
+ env: "CIRRUS_CI",
1385
+ pr: "CIRRUS_PR"
1386
+ },
1387
+ {
1388
+ name: "Codefresh",
1389
+ constant: "CODEFRESH",
1390
+ env: "CF_BUILD_ID",
1391
+ pr: {
1392
+ any: [
1393
+ "CF_PULL_REQUEST_NUMBER",
1394
+ "CF_PULL_REQUEST_ID"
1395
+ ]
1396
+ }
1397
+ },
1398
+ {
1399
+ name: "Codemagic",
1400
+ constant: "CODEMAGIC",
1401
+ env: "CM_BUILD_ID",
1402
+ pr: "CM_PULL_REQUEST"
1403
+ },
1404
+ {
1405
+ name: "Codeship",
1406
+ constant: "CODESHIP",
1407
+ env: {
1408
+ CI_NAME: "codeship"
1409
+ }
1410
+ },
1411
+ {
1412
+ name: "Drone",
1413
+ constant: "DRONE",
1414
+ env: "DRONE",
1415
+ pr: {
1416
+ DRONE_BUILD_EVENT: "pull_request"
1417
+ }
1418
+ },
1419
+ {
1420
+ name: "dsari",
1421
+ constant: "DSARI",
1422
+ env: "DSARI"
1423
+ },
1424
+ {
1425
+ name: "Earthly",
1426
+ constant: "EARTHLY",
1427
+ env: "EARTHLY_CI"
1428
+ },
1429
+ {
1430
+ name: "Expo Application Services",
1431
+ constant: "EAS",
1432
+ env: "EAS_BUILD"
1433
+ },
1434
+ {
1435
+ name: "Gerrit",
1436
+ constant: "GERRIT",
1437
+ env: "GERRIT_PROJECT"
1438
+ },
1439
+ {
1440
+ name: "Gitea Actions",
1441
+ constant: "GITEA_ACTIONS",
1442
+ env: "GITEA_ACTIONS"
1443
+ },
1444
+ {
1445
+ name: "GitHub Actions",
1446
+ constant: "GITHUB_ACTIONS",
1447
+ env: "GITHUB_ACTIONS",
1448
+ pr: {
1449
+ GITHUB_EVENT_NAME: "pull_request"
1450
+ }
1451
+ },
1452
+ {
1453
+ name: "GitLab CI",
1454
+ constant: "GITLAB",
1455
+ env: "GITLAB_CI",
1456
+ pr: "CI_MERGE_REQUEST_ID"
1457
+ },
1458
+ {
1459
+ name: "GoCD",
1460
+ constant: "GOCD",
1461
+ env: "GO_PIPELINE_LABEL"
1462
+ },
1463
+ {
1464
+ name: "Google Cloud Build",
1465
+ constant: "GOOGLE_CLOUD_BUILD",
1466
+ env: "BUILDER_OUTPUT"
1467
+ },
1468
+ {
1469
+ name: "Harness CI",
1470
+ constant: "HARNESS",
1471
+ env: "HARNESS_BUILD_ID"
1472
+ },
1473
+ {
1474
+ name: "Heroku",
1475
+ constant: "HEROKU",
1476
+ env: {
1477
+ env: "NODE",
1478
+ includes: "/app/.heroku/node/bin/node"
1479
+ }
1480
+ },
1481
+ {
1482
+ name: "Hudson",
1483
+ constant: "HUDSON",
1484
+ env: "HUDSON_URL"
1485
+ },
1486
+ {
1487
+ name: "Jenkins",
1488
+ constant: "JENKINS",
1489
+ env: [
1490
+ "JENKINS_URL",
1491
+ "BUILD_ID"
1492
+ ],
1493
+ pr: {
1494
+ any: [
1495
+ "ghprbPullId",
1496
+ "CHANGE_ID"
1497
+ ]
1498
+ }
1499
+ },
1500
+ {
1501
+ name: "LayerCI",
1502
+ constant: "LAYERCI",
1503
+ env: "LAYERCI",
1504
+ pr: "LAYERCI_PULL_REQUEST"
1505
+ },
1506
+ {
1507
+ name: "Magnum CI",
1508
+ constant: "MAGNUM",
1509
+ env: "MAGNUM"
1510
+ },
1511
+ {
1512
+ name: "Netlify CI",
1513
+ constant: "NETLIFY",
1514
+ env: "NETLIFY",
1515
+ pr: {
1516
+ env: "PULL_REQUEST",
1517
+ ne: "false"
1518
+ }
1519
+ },
1520
+ {
1521
+ name: "Nevercode",
1522
+ constant: "NEVERCODE",
1523
+ env: "NEVERCODE",
1524
+ pr: {
1525
+ env: "NEVERCODE_PULL_REQUEST",
1526
+ ne: "false"
1527
+ }
1528
+ },
1529
+ {
1530
+ name: "Prow",
1531
+ constant: "PROW",
1532
+ env: "PROW_JOB_ID"
1533
+ },
1534
+ {
1535
+ name: "ReleaseHub",
1536
+ constant: "RELEASEHUB",
1537
+ env: "RELEASE_BUILD_ID"
1538
+ },
1539
+ {
1540
+ name: "Render",
1541
+ constant: "RENDER",
1542
+ env: "RENDER",
1543
+ pr: {
1544
+ IS_PULL_REQUEST: "true"
1545
+ }
1546
+ },
1547
+ {
1548
+ name: "Sail CI",
1549
+ constant: "SAIL",
1550
+ env: "SAILCI",
1551
+ pr: "SAIL_PULL_REQUEST_NUMBER"
1552
+ },
1553
+ {
1554
+ name: "Screwdriver",
1555
+ constant: "SCREWDRIVER",
1556
+ env: "SCREWDRIVER",
1557
+ pr: {
1558
+ env: "SD_PULL_REQUEST",
1559
+ ne: "false"
1560
+ }
1561
+ },
1562
+ {
1563
+ name: "Semaphore",
1564
+ constant: "SEMAPHORE",
1565
+ env: "SEMAPHORE",
1566
+ pr: "PULL_REQUEST_NUMBER"
1567
+ },
1568
+ {
1569
+ name: "Sourcehut",
1570
+ constant: "SOURCEHUT",
1571
+ env: {
1572
+ CI_NAME: "sourcehut"
1573
+ }
1574
+ },
1575
+ {
1576
+ name: "Strider CD",
1577
+ constant: "STRIDER",
1578
+ env: "STRIDER"
1579
+ },
1580
+ {
1581
+ name: "TaskCluster",
1582
+ constant: "TASKCLUSTER",
1583
+ env: [
1584
+ "TASK_ID",
1585
+ "RUN_ID"
1586
+ ]
1587
+ },
1588
+ {
1589
+ name: "TeamCity",
1590
+ constant: "TEAMCITY",
1591
+ env: "TEAMCITY_VERSION"
1592
+ },
1593
+ {
1594
+ name: "Travis CI",
1595
+ constant: "TRAVIS",
1596
+ env: "TRAVIS",
1597
+ pr: {
1598
+ env: "TRAVIS_PULL_REQUEST",
1599
+ ne: "false"
1600
+ }
1601
+ },
1602
+ {
1603
+ name: "Vela",
1604
+ constant: "VELA",
1605
+ env: "VELA",
1606
+ pr: {
1607
+ VELA_PULL_REQUEST: "1"
1608
+ }
1609
+ },
1610
+ {
1611
+ name: "Vercel",
1612
+ constant: "VERCEL",
1613
+ env: {
1614
+ any: [
1615
+ "NOW_BUILDER",
1616
+ "VERCEL"
1617
+ ]
1618
+ },
1619
+ pr: "VERCEL_GIT_PULL_REQUEST_ID"
1620
+ },
1621
+ {
1622
+ name: "Visual Studio App Center",
1623
+ constant: "APPCENTER",
1624
+ env: "APPCENTER_BUILD_ID"
1625
+ },
1626
+ {
1627
+ name: "Woodpecker",
1628
+ constant: "WOODPECKER",
1629
+ env: {
1630
+ CI: "woodpecker"
1631
+ },
1632
+ pr: {
1633
+ CI_BUILD_EVENT: "pull_request"
1634
+ }
1635
+ },
1636
+ {
1637
+ name: "Xcode Cloud",
1638
+ constant: "XCODE_CLOUD",
1639
+ env: "CI_XCODE_PROJECT",
1640
+ pr: "CI_PULL_REQUEST_NUMBER"
1641
+ },
1642
+ {
1643
+ name: "Xcode Server",
1644
+ constant: "XCODE_SERVER",
1645
+ env: "XCS"
1646
+ }
1647
+ ];
1648
+ }
1649
+ });
1650
+ var require_ci_info = __commonJS({
1651
+ "../../node_modules/is-ci/node_modules/ci-info/index.js"(exports) {
1652
+ var vendors = require_vendors();
1653
+ var env = process.env;
1654
+ Object.defineProperty(exports, "_vendors", {
1655
+ value: vendors.map(function(v) {
1656
+ return v.constant;
1657
+ })
1658
+ });
1659
+ exports.name = null;
1660
+ exports.isPR = null;
1661
+ exports.id = null;
1662
+ vendors.forEach(function(vendor) {
1663
+ const envs = Array.isArray(vendor.env) ? vendor.env : [vendor.env];
1664
+ const isCI2 = envs.every(function(obj) {
1665
+ return checkEnv(obj);
1666
+ });
1667
+ exports[vendor.constant] = isCI2;
1668
+ if (!isCI2) {
1669
+ return;
1670
+ }
1671
+ exports.name = vendor.name;
1672
+ exports.isPR = checkPR(vendor);
1673
+ exports.id = vendor.constant;
1674
+ });
1675
+ exports.isCI = !!(env.CI !== "false" && // Bypass all checks if CI env is explicitly set to 'false'
1676
+ (env.BUILD_ID || // Jenkins, Cloudbees
1677
+ env.BUILD_NUMBER || // Jenkins, TeamCity
1678
+ env.CI || // Travis CI, CircleCI, Cirrus CI, Gitlab CI, Appveyor, CodeShip, dsari
1679
+ env.CI_APP_ID || // Appflow
1680
+ env.CI_BUILD_ID || // Appflow
1681
+ env.CI_BUILD_NUMBER || // Appflow
1682
+ env.CI_NAME || // Codeship and others
1683
+ env.CONTINUOUS_INTEGRATION || // Travis CI, Cirrus CI
1684
+ env.RUN_ID || // TaskCluster, dsari
1685
+ exports.name || false));
1686
+ function checkEnv(obj) {
1687
+ if (typeof obj === "string") return !!env[obj];
1688
+ if ("env" in obj) {
1689
+ return env[obj.env] && env[obj.env].includes(obj.includes);
1690
+ }
1691
+ if ("any" in obj) {
1692
+ return obj.any.some(function(k) {
1693
+ return !!env[k];
1694
+ });
1695
+ }
1696
+ return Object.keys(obj).every(function(k) {
1697
+ return env[k] === obj[k];
1698
+ });
1699
+ }
1700
+ function checkPR(vendor) {
1701
+ switch (typeof vendor.pr) {
1702
+ case "string":
1703
+ return !!env[vendor.pr];
1704
+ case "object":
1705
+ if ("env" in vendor.pr) {
1706
+ if ("any" in vendor.pr) {
1707
+ return vendor.pr.any.some(function(key) {
1708
+ return env[vendor.pr.env] === key;
1709
+ });
1710
+ } else {
1711
+ return vendor.pr.env in env && env[vendor.pr.env] !== vendor.pr.ne;
1712
+ }
1713
+ } else if ("any" in vendor.pr) {
1714
+ return vendor.pr.any.some(function(key) {
1715
+ return !!env[key];
1716
+ });
1717
+ } else {
1718
+ return checkEnv(vendor.pr);
1719
+ }
1720
+ default:
1721
+ return null;
1722
+ }
1723
+ }
1724
+ }
1725
+ });
1726
+ var require_is_ci = __commonJS({
1727
+ "../../node_modules/is-ci/index.js"(exports, module) {
1728
+ module.exports = require_ci_info().isCI;
1729
+ }
1730
+ });
1731
+ var import_esbuild_plugin_vue3 = __toESM(require_dist());
1732
+ var import_is_ci = __toESM(require_is_ci());
1733
+ var HTML_ESCAPE_REPLACE_RE = /[&<>"]/g;
1734
+ var HTML_REPLACEMENTS = {
1735
+ "&": "&amp;",
1736
+ "<": "&lt;",
1737
+ ">": "&gt;",
1738
+ '"': "&quot;"
1739
+ };
1740
+ function escapeHtml(str) {
1741
+ return str.replace(HTML_ESCAPE_REPLACE_RE, (ch) => HTML_REPLACEMENTS[ch]);
1742
+ }
1743
+ function generateCode(options) {
1744
+ const { slug, fingerprint, code, filename, setupPath } = options;
1745
+ const selector = `#${slug}`;
1746
+ const asset = `${slug}-${fingerprint}.js`;
1747
+ const { descriptor, errors } = require$$0.parse(code, { filename });
1748
+ const scopeId = `data-v-${fingerprint}`;
1749
+ if (errors.length > 0) {
1750
+ if (import_is_ci.default) {
1751
+ const first = errors[0].message;
1752
+ throw new Error(
1753
+ `Errors occurred when trying to parse "${filename}": ${first}`
1754
+ );
1755
+ }
1756
+ const lines = errors.map((it) => ` ${it.message}`);
1757
+ const escaped = lines.map(escapeHtml);
1758
+ return {
1759
+ markup: `<strong style="color: red">Vue compiler error</strong>:<br><pre>${escaped.join("\n")}</pre>`,
1760
+ sourcecode: `Vue compiler error:
1761
+ ${lines.join("\n")}`,
1762
+ output: false
1763
+ };
1764
+ }
1765
+ const hasScoped = descriptor.styles.some((e) => e.scoped);
1766
+ const styleContent = descriptor.styles.map((stylePart) => {
1767
+ const compiledStyle = require$$0.compileStyle({
1768
+ filename: descriptor.filename,
1769
+ source: stylePart.content,
1770
+ isProd: false,
1771
+ id: scopeId,
1772
+ scoped: stylePart.scoped,
1773
+ trim: true
1774
+ });
1775
+ return compiledStyle.code;
1776
+ }).join("\n");
1777
+ let sourcecode = `import { setup } from "${setupPath}";
1778
+ `;
1779
+ let bindings = void 0;
1780
+ if (descriptor.script || descriptor.scriptSetup) {
1781
+ const script = require$$0.compileScript(descriptor, {
1782
+ id: scopeId,
1783
+ isProd: false,
1784
+ sourceMap: false,
1785
+ inlineTemplate: false,
1786
+ genDefaultAs: "exampleComponent",
1787
+ templateOptions: {
1788
+ id: scopeId,
1789
+ filename,
1790
+ source: descriptor.template?.content,
1791
+ scoped: hasScoped,
1792
+ slotted: descriptor.slotted,
1793
+ compilerOptions: {
1794
+ comments: false,
1795
+ whitespace: "condense",
1796
+ scopeId: hasScoped ? scopeId : void 0,
1797
+ mode: "module"
1798
+ }
1799
+ }
1800
+ });
1801
+ bindings = script.bindings;
1802
+ sourcecode += script.content;
1803
+ sourcecode += "\n\n";
1804
+ } else {
1805
+ sourcecode += `const exampleComponent = {};
1806
+
1807
+ `;
1808
+ }
1809
+ if (descriptor.template) {
1810
+ const template = require$$0.compileTemplate({
1811
+ id: scopeId,
1812
+ filename,
1813
+ source: descriptor.template.content,
1814
+ scoped: hasScoped,
1815
+ slotted: descriptor.slotted,
1816
+ preprocessLang: descriptor.template.lang,
1817
+ compilerOptions: {
1818
+ bindingMetadata: bindings,
1819
+ comments: false,
1820
+ whitespace: "condense",
1821
+ scopeId: hasScoped ? scopeId : void 0,
1822
+ mode: "module"
1823
+ }
1824
+ });
1825
+ sourcecode += `${template.code}
1826
+
1827
+ `;
1828
+ sourcecode += `exampleComponent.render = render;
1829
+ `;
1830
+ }
1831
+ if (hasScoped) {
1832
+ sourcecode += `exampleComponent.__scopeId = "${scopeId}";
1833
+ `;
1834
+ }
1835
+ sourcecode += `
1836
+ setup({
1837
+ rootComponent: exampleComponent,
1838
+ selector: "${selector}"
1839
+ });
1840
+ `;
1841
+ const markup = (
1842
+ /* HTML */
1843
+ `
1844
+ <div id="${slug}"></div>
1845
+ <!-- [html-validate-disable-next element-permitted-content -- technical debt, should be inserted into <head>] -->
1846
+ <style>
1847
+ ${styleContent}
1848
+ </style>
1849
+ <!-- [html-validate-disable-next require-sri -- technical debt, should generate integrity but we don't know the hash of the compiled file yet] -->
1850
+ <script type="module" src="./${asset}"></script>
1851
+ `
1852
+ );
1853
+ return {
1854
+ markup,
1855
+ sourcecode,
1856
+ output: asset
1857
+ };
1858
+ }
1859
+ var export_vuePlugin = import_esbuild_plugin_vue3.default;
1860
+
1861
+ exports.export_vuePlugin = export_vuePlugin;
1862
+ exports.generateCode = generateCode;
1863
+ //# sourceMappingURL=vue3-BKfEgvlU.js.map