web-extend-plugin-vue2 0.2.0 → 0.2.2

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,4 +1,3 @@
1
- import { coerce, satisfies } from 'semver';
2
1
  import Vue from 'vue';
3
2
 
4
3
  /**
@@ -121,45 +120,12 @@ function readInjectedEnvDev() {
121
120
  return !!(o && o.DEV === true)
122
121
  }
123
122
 
124
- /**
125
- * 与 `plugin-web-starter`(WebPluginsResponse)返回的 `hostPluginApiVersion` 保持一致,用于契约校验。
126
- * @type {string}
127
- */
128
- const HOST_PLUGIN_API_VERSION = '1.0.0';
129
-
130
- /**
131
- * 宿主侧插件引导:拉取清单、dev 映射、加载入口脚本、调用 activator。
132
- * 路径与白名单等默认值见 `defaultWebExtendPluginRuntime`,可通过 `resolveRuntimeOptions` / 环境变量覆盖。
133
- *
134
- * **Webpack 宿主**:用 `DefinePlugin` 注入 `process.env.VITE_*` 或 **`PLUGIN_*`**(等价键),或 `resolveRuntimeOptions` 显式传参。
135
- * **Vite 宿主**:入口调用 `setWebExtendPluginEnv(import.meta.env)`,或 `installWebExtendPluginVue2(..., { env: import.meta.env })`。
136
- *
137
- * @module PluginRuntime
138
- */
139
-
140
- const DEF = defaultWebExtendPluginRuntime;
141
-
142
123
  /**
143
- * @typedef {object} WebExtendPluginRuntimeOptions
144
- * @property {string} [manifestBase] 清单服务 URL 前缀
145
- * @property {string} [manifestListPath] 清单接口路径(以 `/` 开头),拼在 manifestBase 后
146
- * @property {RequestCredentials} [manifestFetchCredentials] 清单 fetch 的 credentials
147
- * @property {boolean} [isDev] 开发模式
148
- * @property {string} [webPluginDevOrigin] 插件 dev origin
149
- * @property {string} [webPluginDevIds] 逗号分隔 id,隐式 dev 映射
150
- * @property {string} [webPluginDevMapJson] 显式 dev 映射 JSON
151
- * @property {string} [webPluginDevEntryPath] 隐式 dev 入口路径(相对插件 dev origin)
152
- * @property {string} [devPingPath] dev 存活探测路径
153
- * @property {string} [devReloadSsePath] dev 热更新 SSE 路径
154
- * @property {number} [devPingTimeoutMs] 探测超时
155
- * @property {string[]} [defaultImplicitDevPluginIds] 无 `webPluginDevIds`/env 时用于隐式 dev 的 id;包内默认 `[]`
156
- * @property {string[]} [allowedScriptHosts] 允许加载脚本的主机名
157
- * @property {string[]} [bridgeAllowedPathPrefixes] bridge.request 白名单前缀
158
- * @property {boolean} [bootstrapSummary] bootstrap 结束是否打印摘要
124
+ * 从注入环境与 `process.env` 解析 VITE_/PLUGIN_ 键。
125
+ * @module runtime/env-resolve
159
126
  */
160
127
 
161
128
  /**
162
- * 从 Webpack `DefinePlugin` 等注入的 `process.env` 读取。
163
129
  * @param {string} key
164
130
  * @returns {string|undefined}
165
131
  */
@@ -176,9 +142,7 @@ function readProcessEnv(key) {
176
142
  }
177
143
 
178
144
  /**
179
- * `VITE_*` 的并列命名:同值可读 `PLUGIN_*`(`VITE_WEB_PLUGIN_X` → `PLUGIN_WEB_PLUGIN_X`)。
180
- * Vite 需在 `defineConfig({ envPrefix: ['VITE_', 'PLUGIN_'] })` 中暴露 `PLUGIN_`;Webpack 用 DefinePlugin 注入即可。
181
- * @param {string} viteStyleKey 以 `VITE_` 开头的键名
145
+ * @param {string} viteStyleKey
182
146
  * @returns {string|null}
183
147
  */
184
148
  function viteKeyToPluginAlternate(viteStyleKey) {
@@ -189,17 +153,19 @@ function viteKeyToPluginAlternate(viteStyleKey) {
189
153
  }
190
154
 
191
155
  /**
192
- * 先读注入环境(`setWebExtendPluginEnv` / `__WEP_ENV__`)中的 `VITE_*` 与并列 `PLUGIN_*`,再读 `process.env`,最后 `fallback`。
193
- * @param {string} key 仍以 `VITE_*` 为逻辑名(与文档一致)
156
+ * @param {string} key
194
157
  * @param {string} [fallback='']
195
158
  */
196
159
  function resolveBundledEnv(key, fallback = '') {
197
160
  const alt = viteKeyToPluginAlternate(key);
161
+ const inj = readInjectedEnvKey(key);
198
162
  const fromInjected =
199
- readInjectedEnvKey(key) ?? (alt ? readInjectedEnvKey(alt) : undefined);
163
+ inj === undefined || inj === null ? (alt ? readInjectedEnvKey(alt) : undefined) : inj;
164
+ const proc = readProcessEnv(key);
200
165
  const fromProcess =
201
- readProcessEnv(key) ?? (alt ? readProcessEnv(alt) : undefined);
202
- return fromInjected ?? fromProcess ?? fallback
166
+ proc === undefined || proc === null ? (alt ? readProcessEnv(alt) : undefined) : proc;
167
+ const first = fromInjected === undefined || fromInjected === null ? fromProcess : fromInjected;
168
+ return first === undefined || first === null ? fallback : first
203
169
  }
204
170
 
205
171
  /**
@@ -219,6 +185,11 @@ function resolveBundledIsDev() {
219
185
  return false
220
186
  }
221
187
 
188
+ /**
189
+ * 路径与脚本主机名校验工具。
190
+ * @module runtime/path-host-utils
191
+ */
192
+
222
193
  /**
223
194
  * @param {string} p
224
195
  */
@@ -231,7 +202,60 @@ function ensureLeadingPath(p) {
231
202
  }
232
203
 
233
204
  /**
234
- * 解析 `include` | `omit` | `same-origin`,非法时回退默认值。
205
+ * @param {string} hostname
206
+ */
207
+ function normalizeHost(hostname) {
208
+ if (!hostname) {
209
+ return ''
210
+ }
211
+ const h = hostname.toLowerCase();
212
+ if (h.startsWith('[') && h.endsWith(']')) {
213
+ return h.slice(1, -1)
214
+ }
215
+ return h
216
+ }
217
+
218
+ /**
219
+ * @param {string[]} hostnames
220
+ * @returns {Set<string>}
221
+ */
222
+ function buildAllowedScriptHostsSet(hostnames) {
223
+ const s = new Set();
224
+ for (const h of hostnames) {
225
+ const n = normalizeHost(h);
226
+ if (n) {
227
+ s.add(n);
228
+ }
229
+ }
230
+ return s
231
+ }
232
+
233
+ /**
234
+ * @param {string} url
235
+ * @param {Set<string>} hostSet
236
+ */
237
+ function isScriptHostAllowed(url, hostSet) {
238
+ if (typeof window === 'undefined') {
239
+ return false
240
+ }
241
+ try {
242
+ const u = new URL(url, window.location.origin);
243
+ const h = normalizeHost(u.hostname);
244
+ return hostSet.has(h)
245
+ } catch {
246
+ return false
247
+ }
248
+ }
249
+
250
+ /**
251
+ * 合并用户、环境与默认配置得到运行时选项。
252
+ * @module runtime/resolve-runtime-options
253
+ */
254
+
255
+
256
+ const DEF = defaultWebExtendPluginRuntime;
257
+
258
+ /**
235
259
  * @param {string|undefined} userVal
236
260
  * @param {string} envKey
237
261
  * @param {RequestCredentials} fallback
@@ -272,7 +296,7 @@ function resolvePositiveInt(userVal, envKey, fallback) {
272
296
  * @param {WebExtendPluginRuntimeOptions} [user]
273
297
  * @returns {object}
274
298
  */
275
- function resolveRuntimeOptions(user = {}) {
299
+ function resolveRuntimeOptions$1(user = {}) {
276
300
  const manifestBaseRaw =
277
301
  user.manifestBase !== undefined && user.manifestBase !== ''
278
302
  ? String(user.manifestBase)
@@ -284,19 +308,18 @@ function resolveRuntimeOptions(user = {}) {
284
308
  : resolveBundledEnv('VITE_WEB_PLUGIN_MANIFEST_PATH', DEF.manifestListPath)
285
309
  );
286
310
 
287
- const defaultImplicitDevPluginIds =
288
- Array.isArray(user.defaultImplicitDevPluginIds)
289
- ? user.defaultImplicitDevPluginIds.map(String).filter(Boolean)
290
- : (() => {
291
- const e = resolveBundledEnv('VITE_WEB_PLUGIN_IMPLICIT_DEV_IDS', '');
292
- if (e) {
293
- return e
294
- .split(',')
295
- .map((s) => s.trim())
296
- .filter(Boolean)
297
- }
298
- return [...DEF.defaultImplicitDevPluginIds]
299
- })();
311
+ const defaultImplicitDevPluginIds = Array.isArray(user.defaultImplicitDevPluginIds)
312
+ ? user.defaultImplicitDevPluginIds.map(String).filter(Boolean)
313
+ : (() => {
314
+ const e = resolveBundledEnv('VITE_WEB_PLUGIN_IMPLICIT_DEV_IDS', '');
315
+ if (e) {
316
+ return e
317
+ .split(',')
318
+ .map((s) => s.trim())
319
+ .filter(Boolean)
320
+ }
321
+ return [...DEF.defaultImplicitDevPluginIds]
322
+ })();
300
323
 
301
324
  const allowedScriptHosts =
302
325
  Array.isArray(user.allowedScriptHosts) && user.allowedScriptHosts.length > 0
@@ -362,78 +385,2793 @@ function resolveRuntimeOptions(user = {}) {
362
385
  defaultImplicitDevPluginIds,
363
386
  allowedScriptHosts,
364
387
  bridgeAllowedPathPrefixes,
365
- bootstrapSummary: user.bootstrapSummary
388
+ bootstrapSummary: user.bootstrapSummary,
389
+ ...(typeof user.fetchManifest === 'function' ? { fetchManifest: user.fetchManifest } : {})
366
390
  }
367
391
  }
368
392
 
369
393
  /**
370
- * @param {ReturnType<typeof resolveRuntimeOptions>} opts
394
+ * 默认清单 HTTP 拉取(未配置 `fetchManifest` 时)。
395
+ * @module runtime/default-fetch-manifest
371
396
  */
372
- function shouldShowBootstrapSummary(opts) {
373
- if (opts.bootstrapSummary === true) {
374
- return true
375
- }
376
- if (opts.bootstrapSummary === false) {
377
- return false
378
- }
379
- const env = resolveBundledEnv('VITE_PLUGINS_BOOTSTRAP_SUMMARY', '');
380
- if (env === '0' || env === 'false') {
381
- return false
382
- }
383
- if (env === '1' || env === 'true') {
384
- return true
397
+
398
+ /**
399
+ * @typedef {object} FetchWebPluginManifestContext
400
+ * @property {string} manifestUrl
401
+ * @property {RequestCredentials} credentials
402
+ */
403
+
404
+ /**
405
+ * @typedef {object} FetchWebPluginManifestResult
406
+ * @property {boolean} ok
407
+ * @property {number} [status]
408
+ * @property {{ hostPluginApiVersion?: string, plugins?: object[] }|null} [data]
409
+ * @property {unknown} [error]
410
+ */
411
+
412
+ /**
413
+ * @callback FetchWebPluginManifestFn
414
+ * @param {FetchWebPluginManifestContext} ctx
415
+ * @returns {Promise<FetchWebPluginManifestResult>}
416
+ */
417
+
418
+ /**
419
+ * 默认清单请求(未配置 `fetchManifest` 时)。
420
+ * @param {FetchWebPluginManifestContext} ctx
421
+ * @returns {Promise<FetchWebPluginManifestResult>}
422
+ */
423
+ async function defaultFetchWebPluginManifest$1(ctx) {
424
+ const { manifestUrl, credentials } = ctx;
425
+ try {
426
+ const res = await fetch(manifestUrl, { credentials });
427
+ if (!res.ok) {
428
+ return { ok: false, status: res.status, data: null }
429
+ }
430
+ const data = await res.json();
431
+ return { ok: true, data }
432
+ } catch (e) {
433
+ return { ok: false, error: e, data: null }
385
434
  }
386
- return resolveBundledIsDev()
387
435
  }
388
436
 
389
- /**
390
- * @param {string} hostname
391
- */
392
- function normalizeHost(hostname) {
393
- if (!hostname) {
394
- return ''
395
- }
396
- const h = hostname.toLowerCase();
397
- if (h.startsWith('[') && h.endsWith(']')) {
398
- return h.slice(1, -1)
399
- }
400
- return h
437
+ function getDefaultExportFromCjs (x) {
438
+ return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
439
+ }
440
+
441
+ var re = {exports: {}};
442
+
443
+ var constants;
444
+ var hasRequiredConstants;
445
+
446
+ function requireConstants () {
447
+ if (hasRequiredConstants) return constants;
448
+ hasRequiredConstants = 1;
449
+
450
+ // Note: this is the semver.org version of the spec that it implements
451
+ // Not necessarily the package version of this code.
452
+ const SEMVER_SPEC_VERSION = '2.0.0';
453
+
454
+ const MAX_LENGTH = 256;
455
+ const MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER ||
456
+ /* istanbul ignore next */ 9007199254740991;
457
+
458
+ // Max safe segment length for coercion.
459
+ const MAX_SAFE_COMPONENT_LENGTH = 16;
460
+
461
+ // Max safe length for a build identifier. The max length minus 6 characters for
462
+ // the shortest version with a build 0.0.0+BUILD.
463
+ const MAX_SAFE_BUILD_LENGTH = MAX_LENGTH - 6;
464
+
465
+ const RELEASE_TYPES = [
466
+ 'major',
467
+ 'premajor',
468
+ 'minor',
469
+ 'preminor',
470
+ 'patch',
471
+ 'prepatch',
472
+ 'prerelease',
473
+ ];
474
+
475
+ constants = {
476
+ MAX_LENGTH,
477
+ MAX_SAFE_COMPONENT_LENGTH,
478
+ MAX_SAFE_BUILD_LENGTH,
479
+ MAX_SAFE_INTEGER,
480
+ RELEASE_TYPES,
481
+ SEMVER_SPEC_VERSION,
482
+ FLAG_INCLUDE_PRERELEASE: 0b001,
483
+ FLAG_LOOSE: 0b010,
484
+ };
485
+ return constants;
486
+ }
487
+
488
+ var debug_1;
489
+ var hasRequiredDebug;
490
+
491
+ function requireDebug () {
492
+ if (hasRequiredDebug) return debug_1;
493
+ hasRequiredDebug = 1;
494
+
495
+ const debug = (
496
+ typeof process === 'object' &&
497
+ process.env &&
498
+ process.env.NODE_DEBUG &&
499
+ /\bsemver\b/i.test(process.env.NODE_DEBUG)
500
+ ) ? (...args) => console.error('SEMVER', ...args)
501
+ : () => {};
502
+
503
+ debug_1 = debug;
504
+ return debug_1;
505
+ }
506
+
507
+ var hasRequiredRe;
508
+
509
+ function requireRe () {
510
+ if (hasRequiredRe) return re.exports;
511
+ hasRequiredRe = 1;
512
+ (function (module, exports$1) {
513
+
514
+ const {
515
+ MAX_SAFE_COMPONENT_LENGTH,
516
+ MAX_SAFE_BUILD_LENGTH,
517
+ MAX_LENGTH,
518
+ } = requireConstants();
519
+ const debug = requireDebug();
520
+ exports$1 = module.exports = {};
521
+
522
+ // The actual regexps go on exports.re
523
+ const re = exports$1.re = [];
524
+ const safeRe = exports$1.safeRe = [];
525
+ const src = exports$1.src = [];
526
+ const safeSrc = exports$1.safeSrc = [];
527
+ const t = exports$1.t = {};
528
+ let R = 0;
529
+
530
+ const LETTERDASHNUMBER = '[a-zA-Z0-9-]';
531
+
532
+ // Replace some greedy regex tokens to prevent regex dos issues. These regex are
533
+ // used internally via the safeRe object since all inputs in this library get
534
+ // normalized first to trim and collapse all extra whitespace. The original
535
+ // regexes are exported for userland consumption and lower level usage. A
536
+ // future breaking change could export the safer regex only with a note that
537
+ // all input should have extra whitespace removed.
538
+ const safeRegexReplacements = [
539
+ ['\\s', 1],
540
+ ['\\d', MAX_LENGTH],
541
+ [LETTERDASHNUMBER, MAX_SAFE_BUILD_LENGTH],
542
+ ];
543
+
544
+ const makeSafeRegex = (value) => {
545
+ for (const [token, max] of safeRegexReplacements) {
546
+ value = value
547
+ .split(`${token}*`).join(`${token}{0,${max}}`)
548
+ .split(`${token}+`).join(`${token}{1,${max}}`);
549
+ }
550
+ return value
551
+ };
552
+
553
+ const createToken = (name, value, isGlobal) => {
554
+ const safe = makeSafeRegex(value);
555
+ const index = R++;
556
+ debug(name, index, value);
557
+ t[name] = index;
558
+ src[index] = value;
559
+ safeSrc[index] = safe;
560
+ re[index] = new RegExp(value, isGlobal ? 'g' : undefined);
561
+ safeRe[index] = new RegExp(safe, isGlobal ? 'g' : undefined);
562
+ };
563
+
564
+ // The following Regular Expressions can be used for tokenizing,
565
+ // validating, and parsing SemVer version strings.
566
+
567
+ // ## Numeric Identifier
568
+ // A single `0`, or a non-zero digit followed by zero or more digits.
569
+
570
+ createToken('NUMERICIDENTIFIER', '0|[1-9]\\d*');
571
+ createToken('NUMERICIDENTIFIERLOOSE', '\\d+');
572
+
573
+ // ## Non-numeric Identifier
574
+ // Zero or more digits, followed by a letter or hyphen, and then zero or
575
+ // more letters, digits, or hyphens.
576
+
577
+ createToken('NONNUMERICIDENTIFIER', `\\d*[a-zA-Z-]${LETTERDASHNUMBER}*`);
578
+
579
+ // ## Main Version
580
+ // Three dot-separated numeric identifiers.
581
+
582
+ createToken('MAINVERSION', `(${src[t.NUMERICIDENTIFIER]})\\.` +
583
+ `(${src[t.NUMERICIDENTIFIER]})\\.` +
584
+ `(${src[t.NUMERICIDENTIFIER]})`);
585
+
586
+ createToken('MAINVERSIONLOOSE', `(${src[t.NUMERICIDENTIFIERLOOSE]})\\.` +
587
+ `(${src[t.NUMERICIDENTIFIERLOOSE]})\\.` +
588
+ `(${src[t.NUMERICIDENTIFIERLOOSE]})`);
589
+
590
+ // ## Pre-release Version Identifier
591
+ // A numeric identifier, or a non-numeric identifier.
592
+ // Non-numeric identifiers include numeric identifiers but can be longer.
593
+ // Therefore non-numeric identifiers must go first.
594
+
595
+ createToken('PRERELEASEIDENTIFIER', `(?:${src[t.NONNUMERICIDENTIFIER]
596
+ }|${src[t.NUMERICIDENTIFIER]})`);
597
+
598
+ createToken('PRERELEASEIDENTIFIERLOOSE', `(?:${src[t.NONNUMERICIDENTIFIER]
599
+ }|${src[t.NUMERICIDENTIFIERLOOSE]})`);
600
+
601
+ // ## Pre-release Version
602
+ // Hyphen, followed by one or more dot-separated pre-release version
603
+ // identifiers.
604
+
605
+ createToken('PRERELEASE', `(?:-(${src[t.PRERELEASEIDENTIFIER]
606
+ }(?:\\.${src[t.PRERELEASEIDENTIFIER]})*))`);
607
+
608
+ createToken('PRERELEASELOOSE', `(?:-?(${src[t.PRERELEASEIDENTIFIERLOOSE]
609
+ }(?:\\.${src[t.PRERELEASEIDENTIFIERLOOSE]})*))`);
610
+
611
+ // ## Build Metadata Identifier
612
+ // Any combination of digits, letters, or hyphens.
613
+
614
+ createToken('BUILDIDENTIFIER', `${LETTERDASHNUMBER}+`);
615
+
616
+ // ## Build Metadata
617
+ // Plus sign, followed by one or more period-separated build metadata
618
+ // identifiers.
619
+
620
+ createToken('BUILD', `(?:\\+(${src[t.BUILDIDENTIFIER]
621
+ }(?:\\.${src[t.BUILDIDENTIFIER]})*))`);
622
+
623
+ // ## Full Version String
624
+ // A main version, followed optionally by a pre-release version and
625
+ // build metadata.
626
+
627
+ // Note that the only major, minor, patch, and pre-release sections of
628
+ // the version string are capturing groups. The build metadata is not a
629
+ // capturing group, because it should not ever be used in version
630
+ // comparison.
631
+
632
+ createToken('FULLPLAIN', `v?${src[t.MAINVERSION]
633
+ }${src[t.PRERELEASE]}?${
634
+ src[t.BUILD]}?`);
635
+
636
+ createToken('FULL', `^${src[t.FULLPLAIN]}$`);
637
+
638
+ // like full, but allows v1.2.3 and =1.2.3, which people do sometimes.
639
+ // also, 1.0.0alpha1 (prerelease without the hyphen) which is pretty
640
+ // common in the npm registry.
641
+ createToken('LOOSEPLAIN', `[v=\\s]*${src[t.MAINVERSIONLOOSE]
642
+ }${src[t.PRERELEASELOOSE]}?${
643
+ src[t.BUILD]}?`);
644
+
645
+ createToken('LOOSE', `^${src[t.LOOSEPLAIN]}$`);
646
+
647
+ createToken('GTLT', '((?:<|>)?=?)');
648
+
649
+ // Something like "2.*" or "1.2.x".
650
+ // Note that "x.x" is a valid xRange identifer, meaning "any version"
651
+ // Only the first item is strictly required.
652
+ createToken('XRANGEIDENTIFIERLOOSE', `${src[t.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);
653
+ createToken('XRANGEIDENTIFIER', `${src[t.NUMERICIDENTIFIER]}|x|X|\\*`);
654
+
655
+ createToken('XRANGEPLAIN', `[v=\\s]*(${src[t.XRANGEIDENTIFIER]})` +
656
+ `(?:\\.(${src[t.XRANGEIDENTIFIER]})` +
657
+ `(?:\\.(${src[t.XRANGEIDENTIFIER]})` +
658
+ `(?:${src[t.PRERELEASE]})?${
659
+ src[t.BUILD]}?` +
660
+ `)?)?`);
661
+
662
+ createToken('XRANGEPLAINLOOSE', `[v=\\s]*(${src[t.XRANGEIDENTIFIERLOOSE]})` +
663
+ `(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})` +
664
+ `(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})` +
665
+ `(?:${src[t.PRERELEASELOOSE]})?${
666
+ src[t.BUILD]}?` +
667
+ `)?)?`);
668
+
669
+ createToken('XRANGE', `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAIN]}$`);
670
+ createToken('XRANGELOOSE', `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAINLOOSE]}$`);
671
+
672
+ // Coercion.
673
+ // Extract anything that could conceivably be a part of a valid semver
674
+ createToken('COERCEPLAIN', `${'(^|[^\\d])' +
675
+ '(\\d{1,'}${MAX_SAFE_COMPONENT_LENGTH}})` +
676
+ `(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?` +
677
+ `(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?`);
678
+ createToken('COERCE', `${src[t.COERCEPLAIN]}(?:$|[^\\d])`);
679
+ createToken('COERCEFULL', src[t.COERCEPLAIN] +
680
+ `(?:${src[t.PRERELEASE]})?` +
681
+ `(?:${src[t.BUILD]})?` +
682
+ `(?:$|[^\\d])`);
683
+ createToken('COERCERTL', src[t.COERCE], true);
684
+ createToken('COERCERTLFULL', src[t.COERCEFULL], true);
685
+
686
+ // Tilde ranges.
687
+ // Meaning is "reasonably at or greater than"
688
+ createToken('LONETILDE', '(?:~>?)');
689
+
690
+ createToken('TILDETRIM', `(\\s*)${src[t.LONETILDE]}\\s+`, true);
691
+ exports$1.tildeTrimReplace = '$1~';
692
+
693
+ createToken('TILDE', `^${src[t.LONETILDE]}${src[t.XRANGEPLAIN]}$`);
694
+ createToken('TILDELOOSE', `^${src[t.LONETILDE]}${src[t.XRANGEPLAINLOOSE]}$`);
695
+
696
+ // Caret ranges.
697
+ // Meaning is "at least and backwards compatible with"
698
+ createToken('LONECARET', '(?:\\^)');
699
+
700
+ createToken('CARETTRIM', `(\\s*)${src[t.LONECARET]}\\s+`, true);
701
+ exports$1.caretTrimReplace = '$1^';
702
+
703
+ createToken('CARET', `^${src[t.LONECARET]}${src[t.XRANGEPLAIN]}$`);
704
+ createToken('CARETLOOSE', `^${src[t.LONECARET]}${src[t.XRANGEPLAINLOOSE]}$`);
705
+
706
+ // A simple gt/lt/eq thing, or just "" to indicate "any version"
707
+ createToken('COMPARATORLOOSE', `^${src[t.GTLT]}\\s*(${src[t.LOOSEPLAIN]})$|^$`);
708
+ createToken('COMPARATOR', `^${src[t.GTLT]}\\s*(${src[t.FULLPLAIN]})$|^$`);
709
+
710
+ // An expression to strip any whitespace between the gtlt and the thing
711
+ // it modifies, so that `> 1.2.3` ==> `>1.2.3`
712
+ createToken('COMPARATORTRIM', `(\\s*)${src[t.GTLT]
713
+ }\\s*(${src[t.LOOSEPLAIN]}|${src[t.XRANGEPLAIN]})`, true);
714
+ exports$1.comparatorTrimReplace = '$1$2$3';
715
+
716
+ // Something like `1.2.3 - 1.2.4`
717
+ // Note that these all use the loose form, because they'll be
718
+ // checked against either the strict or loose comparator form
719
+ // later.
720
+ createToken('HYPHENRANGE', `^\\s*(${src[t.XRANGEPLAIN]})` +
721
+ `\\s+-\\s+` +
722
+ `(${src[t.XRANGEPLAIN]})` +
723
+ `\\s*$`);
724
+
725
+ createToken('HYPHENRANGELOOSE', `^\\s*(${src[t.XRANGEPLAINLOOSE]})` +
726
+ `\\s+-\\s+` +
727
+ `(${src[t.XRANGEPLAINLOOSE]})` +
728
+ `\\s*$`);
729
+
730
+ // Star ranges basically just allow anything at all.
731
+ createToken('STAR', '(<|>)?=?\\s*\\*');
732
+ // >=0.0.0 is like a star
733
+ createToken('GTE0', '^\\s*>=\\s*0\\.0\\.0\\s*$');
734
+ createToken('GTE0PRE', '^\\s*>=\\s*0\\.0\\.0-0\\s*$');
735
+ } (re, re.exports));
736
+ return re.exports;
737
+ }
738
+
739
+ var parseOptions_1;
740
+ var hasRequiredParseOptions;
741
+
742
+ function requireParseOptions () {
743
+ if (hasRequiredParseOptions) return parseOptions_1;
744
+ hasRequiredParseOptions = 1;
745
+
746
+ // parse out just the options we care about
747
+ const looseOption = Object.freeze({ loose: true });
748
+ const emptyOpts = Object.freeze({ });
749
+ const parseOptions = options => {
750
+ if (!options) {
751
+ return emptyOpts
752
+ }
753
+
754
+ if (typeof options !== 'object') {
755
+ return looseOption
756
+ }
757
+
758
+ return options
759
+ };
760
+ parseOptions_1 = parseOptions;
761
+ return parseOptions_1;
762
+ }
763
+
764
+ var identifiers;
765
+ var hasRequiredIdentifiers;
766
+
767
+ function requireIdentifiers () {
768
+ if (hasRequiredIdentifiers) return identifiers;
769
+ hasRequiredIdentifiers = 1;
770
+
771
+ const numeric = /^[0-9]+$/;
772
+ const compareIdentifiers = (a, b) => {
773
+ if (typeof a === 'number' && typeof b === 'number') {
774
+ return a === b ? 0 : a < b ? -1 : 1
775
+ }
776
+
777
+ const anum = numeric.test(a);
778
+ const bnum = numeric.test(b);
779
+
780
+ if (anum && bnum) {
781
+ a = +a;
782
+ b = +b;
783
+ }
784
+
785
+ return a === b ? 0
786
+ : (anum && !bnum) ? -1
787
+ : (bnum && !anum) ? 1
788
+ : a < b ? -1
789
+ : 1
790
+ };
791
+
792
+ const rcompareIdentifiers = (a, b) => compareIdentifiers(b, a);
793
+
794
+ identifiers = {
795
+ compareIdentifiers,
796
+ rcompareIdentifiers,
797
+ };
798
+ return identifiers;
799
+ }
800
+
801
+ var semver$2;
802
+ var hasRequiredSemver$1;
803
+
804
+ function requireSemver$1 () {
805
+ if (hasRequiredSemver$1) return semver$2;
806
+ hasRequiredSemver$1 = 1;
807
+
808
+ const debug = requireDebug();
809
+ const { MAX_LENGTH, MAX_SAFE_INTEGER } = requireConstants();
810
+ const { safeRe: re, t } = requireRe();
811
+
812
+ const parseOptions = requireParseOptions();
813
+ const { compareIdentifiers } = requireIdentifiers();
814
+ class SemVer {
815
+ constructor (version, options) {
816
+ options = parseOptions(options);
817
+
818
+ if (version instanceof SemVer) {
819
+ if (version.loose === !!options.loose &&
820
+ version.includePrerelease === !!options.includePrerelease) {
821
+ return version
822
+ } else {
823
+ version = version.version;
824
+ }
825
+ } else if (typeof version !== 'string') {
826
+ throw new TypeError(`Invalid version. Must be a string. Got type "${typeof version}".`)
827
+ }
828
+
829
+ if (version.length > MAX_LENGTH) {
830
+ throw new TypeError(
831
+ `version is longer than ${MAX_LENGTH} characters`
832
+ )
833
+ }
834
+
835
+ debug('SemVer', version, options);
836
+ this.options = options;
837
+ this.loose = !!options.loose;
838
+ // this isn't actually relevant for versions, but keep it so that we
839
+ // don't run into trouble passing this.options around.
840
+ this.includePrerelease = !!options.includePrerelease;
841
+
842
+ const m = version.trim().match(options.loose ? re[t.LOOSE] : re[t.FULL]);
843
+
844
+ if (!m) {
845
+ throw new TypeError(`Invalid Version: ${version}`)
846
+ }
847
+
848
+ this.raw = version;
849
+
850
+ // these are actually numbers
851
+ this.major = +m[1];
852
+ this.minor = +m[2];
853
+ this.patch = +m[3];
854
+
855
+ if (this.major > MAX_SAFE_INTEGER || this.major < 0) {
856
+ throw new TypeError('Invalid major version')
857
+ }
858
+
859
+ if (this.minor > MAX_SAFE_INTEGER || this.minor < 0) {
860
+ throw new TypeError('Invalid minor version')
861
+ }
862
+
863
+ if (this.patch > MAX_SAFE_INTEGER || this.patch < 0) {
864
+ throw new TypeError('Invalid patch version')
865
+ }
866
+
867
+ // numberify any prerelease numeric ids
868
+ if (!m[4]) {
869
+ this.prerelease = [];
870
+ } else {
871
+ this.prerelease = m[4].split('.').map((id) => {
872
+ if (/^[0-9]+$/.test(id)) {
873
+ const num = +id;
874
+ if (num >= 0 && num < MAX_SAFE_INTEGER) {
875
+ return num
876
+ }
877
+ }
878
+ return id
879
+ });
880
+ }
881
+
882
+ this.build = m[5] ? m[5].split('.') : [];
883
+ this.format();
884
+ }
885
+
886
+ format () {
887
+ this.version = `${this.major}.${this.minor}.${this.patch}`;
888
+ if (this.prerelease.length) {
889
+ this.version += `-${this.prerelease.join('.')}`;
890
+ }
891
+ return this.version
892
+ }
893
+
894
+ toString () {
895
+ return this.version
896
+ }
897
+
898
+ compare (other) {
899
+ debug('SemVer.compare', this.version, this.options, other);
900
+ if (!(other instanceof SemVer)) {
901
+ if (typeof other === 'string' && other === this.version) {
902
+ return 0
903
+ }
904
+ other = new SemVer(other, this.options);
905
+ }
906
+
907
+ if (other.version === this.version) {
908
+ return 0
909
+ }
910
+
911
+ return this.compareMain(other) || this.comparePre(other)
912
+ }
913
+
914
+ compareMain (other) {
915
+ if (!(other instanceof SemVer)) {
916
+ other = new SemVer(other, this.options);
917
+ }
918
+
919
+ if (this.major < other.major) {
920
+ return -1
921
+ }
922
+ if (this.major > other.major) {
923
+ return 1
924
+ }
925
+ if (this.minor < other.minor) {
926
+ return -1
927
+ }
928
+ if (this.minor > other.minor) {
929
+ return 1
930
+ }
931
+ if (this.patch < other.patch) {
932
+ return -1
933
+ }
934
+ if (this.patch > other.patch) {
935
+ return 1
936
+ }
937
+ return 0
938
+ }
939
+
940
+ comparePre (other) {
941
+ if (!(other instanceof SemVer)) {
942
+ other = new SemVer(other, this.options);
943
+ }
944
+
945
+ // NOT having a prerelease is > having one
946
+ if (this.prerelease.length && !other.prerelease.length) {
947
+ return -1
948
+ } else if (!this.prerelease.length && other.prerelease.length) {
949
+ return 1
950
+ } else if (!this.prerelease.length && !other.prerelease.length) {
951
+ return 0
952
+ }
953
+
954
+ let i = 0;
955
+ do {
956
+ const a = this.prerelease[i];
957
+ const b = other.prerelease[i];
958
+ debug('prerelease compare', i, a, b);
959
+ if (a === undefined && b === undefined) {
960
+ return 0
961
+ } else if (b === undefined) {
962
+ return 1
963
+ } else if (a === undefined) {
964
+ return -1
965
+ } else if (a === b) {
966
+ continue
967
+ } else {
968
+ return compareIdentifiers(a, b)
969
+ }
970
+ } while (++i)
971
+ }
972
+
973
+ compareBuild (other) {
974
+ if (!(other instanceof SemVer)) {
975
+ other = new SemVer(other, this.options);
976
+ }
977
+
978
+ let i = 0;
979
+ do {
980
+ const a = this.build[i];
981
+ const b = other.build[i];
982
+ debug('build compare', i, a, b);
983
+ if (a === undefined && b === undefined) {
984
+ return 0
985
+ } else if (b === undefined) {
986
+ return 1
987
+ } else if (a === undefined) {
988
+ return -1
989
+ } else if (a === b) {
990
+ continue
991
+ } else {
992
+ return compareIdentifiers(a, b)
993
+ }
994
+ } while (++i)
995
+ }
996
+
997
+ // preminor will bump the version up to the next minor release, and immediately
998
+ // down to pre-release. premajor and prepatch work the same way.
999
+ inc (release, identifier, identifierBase) {
1000
+ if (release.startsWith('pre')) {
1001
+ if (!identifier && identifierBase === false) {
1002
+ throw new Error('invalid increment argument: identifier is empty')
1003
+ }
1004
+ // Avoid an invalid semver results
1005
+ if (identifier) {
1006
+ const match = `-${identifier}`.match(this.options.loose ? re[t.PRERELEASELOOSE] : re[t.PRERELEASE]);
1007
+ if (!match || match[1] !== identifier) {
1008
+ throw new Error(`invalid identifier: ${identifier}`)
1009
+ }
1010
+ }
1011
+ }
1012
+
1013
+ switch (release) {
1014
+ case 'premajor':
1015
+ this.prerelease.length = 0;
1016
+ this.patch = 0;
1017
+ this.minor = 0;
1018
+ this.major++;
1019
+ this.inc('pre', identifier, identifierBase);
1020
+ break
1021
+ case 'preminor':
1022
+ this.prerelease.length = 0;
1023
+ this.patch = 0;
1024
+ this.minor++;
1025
+ this.inc('pre', identifier, identifierBase);
1026
+ break
1027
+ case 'prepatch':
1028
+ // If this is already a prerelease, it will bump to the next version
1029
+ // drop any prereleases that might already exist, since they are not
1030
+ // relevant at this point.
1031
+ this.prerelease.length = 0;
1032
+ this.inc('patch', identifier, identifierBase);
1033
+ this.inc('pre', identifier, identifierBase);
1034
+ break
1035
+ // If the input is a non-prerelease version, this acts the same as
1036
+ // prepatch.
1037
+ case 'prerelease':
1038
+ if (this.prerelease.length === 0) {
1039
+ this.inc('patch', identifier, identifierBase);
1040
+ }
1041
+ this.inc('pre', identifier, identifierBase);
1042
+ break
1043
+ case 'release':
1044
+ if (this.prerelease.length === 0) {
1045
+ throw new Error(`version ${this.raw} is not a prerelease`)
1046
+ }
1047
+ this.prerelease.length = 0;
1048
+ break
1049
+
1050
+ case 'major':
1051
+ // If this is a pre-major version, bump up to the same major version.
1052
+ // Otherwise increment major.
1053
+ // 1.0.0-5 bumps to 1.0.0
1054
+ // 1.1.0 bumps to 2.0.0
1055
+ if (
1056
+ this.minor !== 0 ||
1057
+ this.patch !== 0 ||
1058
+ this.prerelease.length === 0
1059
+ ) {
1060
+ this.major++;
1061
+ }
1062
+ this.minor = 0;
1063
+ this.patch = 0;
1064
+ this.prerelease = [];
1065
+ break
1066
+ case 'minor':
1067
+ // If this is a pre-minor version, bump up to the same minor version.
1068
+ // Otherwise increment minor.
1069
+ // 1.2.0-5 bumps to 1.2.0
1070
+ // 1.2.1 bumps to 1.3.0
1071
+ if (this.patch !== 0 || this.prerelease.length === 0) {
1072
+ this.minor++;
1073
+ }
1074
+ this.patch = 0;
1075
+ this.prerelease = [];
1076
+ break
1077
+ case 'patch':
1078
+ // If this is not a pre-release version, it will increment the patch.
1079
+ // If it is a pre-release it will bump up to the same patch version.
1080
+ // 1.2.0-5 patches to 1.2.0
1081
+ // 1.2.0 patches to 1.2.1
1082
+ if (this.prerelease.length === 0) {
1083
+ this.patch++;
1084
+ }
1085
+ this.prerelease = [];
1086
+ break
1087
+ // This probably shouldn't be used publicly.
1088
+ // 1.0.0 'pre' would become 1.0.0-0 which is the wrong direction.
1089
+ case 'pre': {
1090
+ const base = Number(identifierBase) ? 1 : 0;
1091
+
1092
+ if (this.prerelease.length === 0) {
1093
+ this.prerelease = [base];
1094
+ } else {
1095
+ let i = this.prerelease.length;
1096
+ while (--i >= 0) {
1097
+ if (typeof this.prerelease[i] === 'number') {
1098
+ this.prerelease[i]++;
1099
+ i = -2;
1100
+ }
1101
+ }
1102
+ if (i === -1) {
1103
+ // didn't increment anything
1104
+ if (identifier === this.prerelease.join('.') && identifierBase === false) {
1105
+ throw new Error('invalid increment argument: identifier already exists')
1106
+ }
1107
+ this.prerelease.push(base);
1108
+ }
1109
+ }
1110
+ if (identifier) {
1111
+ // 1.2.0-beta.1 bumps to 1.2.0-beta.2,
1112
+ // 1.2.0-beta.fooblz or 1.2.0-beta bumps to 1.2.0-beta.0
1113
+ let prerelease = [identifier, base];
1114
+ if (identifierBase === false) {
1115
+ prerelease = [identifier];
1116
+ }
1117
+ if (compareIdentifiers(this.prerelease[0], identifier) === 0) {
1118
+ if (isNaN(this.prerelease[1])) {
1119
+ this.prerelease = prerelease;
1120
+ }
1121
+ } else {
1122
+ this.prerelease = prerelease;
1123
+ }
1124
+ }
1125
+ break
1126
+ }
1127
+ default:
1128
+ throw new Error(`invalid increment argument: ${release}`)
1129
+ }
1130
+ this.raw = this.format();
1131
+ if (this.build.length) {
1132
+ this.raw += `+${this.build.join('.')}`;
1133
+ }
1134
+ return this
1135
+ }
1136
+ }
1137
+
1138
+ semver$2 = SemVer;
1139
+ return semver$2;
1140
+ }
1141
+
1142
+ var parse_1;
1143
+ var hasRequiredParse;
1144
+
1145
+ function requireParse () {
1146
+ if (hasRequiredParse) return parse_1;
1147
+ hasRequiredParse = 1;
1148
+
1149
+ const SemVer = requireSemver$1();
1150
+ const parse = (version, options, throwErrors = false) => {
1151
+ if (version instanceof SemVer) {
1152
+ return version
1153
+ }
1154
+ try {
1155
+ return new SemVer(version, options)
1156
+ } catch (er) {
1157
+ if (!throwErrors) {
1158
+ return null
1159
+ }
1160
+ throw er
1161
+ }
1162
+ };
1163
+
1164
+ parse_1 = parse;
1165
+ return parse_1;
1166
+ }
1167
+
1168
+ var valid_1;
1169
+ var hasRequiredValid$1;
1170
+
1171
+ function requireValid$1 () {
1172
+ if (hasRequiredValid$1) return valid_1;
1173
+ hasRequiredValid$1 = 1;
1174
+
1175
+ const parse = requireParse();
1176
+ const valid = (version, options) => {
1177
+ const v = parse(version, options);
1178
+ return v ? v.version : null
1179
+ };
1180
+ valid_1 = valid;
1181
+ return valid_1;
1182
+ }
1183
+
1184
+ var clean_1;
1185
+ var hasRequiredClean;
1186
+
1187
+ function requireClean () {
1188
+ if (hasRequiredClean) return clean_1;
1189
+ hasRequiredClean = 1;
1190
+
1191
+ const parse = requireParse();
1192
+ const clean = (version, options) => {
1193
+ const s = parse(version.trim().replace(/^[=v]+/, ''), options);
1194
+ return s ? s.version : null
1195
+ };
1196
+ clean_1 = clean;
1197
+ return clean_1;
1198
+ }
1199
+
1200
+ var inc_1;
1201
+ var hasRequiredInc;
1202
+
1203
+ function requireInc () {
1204
+ if (hasRequiredInc) return inc_1;
1205
+ hasRequiredInc = 1;
1206
+
1207
+ const SemVer = requireSemver$1();
1208
+
1209
+ const inc = (version, release, options, identifier, identifierBase) => {
1210
+ if (typeof (options) === 'string') {
1211
+ identifierBase = identifier;
1212
+ identifier = options;
1213
+ options = undefined;
1214
+ }
1215
+
1216
+ try {
1217
+ return new SemVer(
1218
+ version instanceof SemVer ? version.version : version,
1219
+ options
1220
+ ).inc(release, identifier, identifierBase).version
1221
+ } catch (er) {
1222
+ return null
1223
+ }
1224
+ };
1225
+ inc_1 = inc;
1226
+ return inc_1;
1227
+ }
1228
+
1229
+ var diff_1;
1230
+ var hasRequiredDiff;
1231
+
1232
+ function requireDiff () {
1233
+ if (hasRequiredDiff) return diff_1;
1234
+ hasRequiredDiff = 1;
1235
+
1236
+ const parse = requireParse();
1237
+
1238
+ const diff = (version1, version2) => {
1239
+ const v1 = parse(version1, null, true);
1240
+ const v2 = parse(version2, null, true);
1241
+ const comparison = v1.compare(v2);
1242
+
1243
+ if (comparison === 0) {
1244
+ return null
1245
+ }
1246
+
1247
+ const v1Higher = comparison > 0;
1248
+ const highVersion = v1Higher ? v1 : v2;
1249
+ const lowVersion = v1Higher ? v2 : v1;
1250
+ const highHasPre = !!highVersion.prerelease.length;
1251
+ const lowHasPre = !!lowVersion.prerelease.length;
1252
+
1253
+ if (lowHasPre && !highHasPre) {
1254
+ // Going from prerelease -> no prerelease requires some special casing
1255
+
1256
+ // If the low version has only a major, then it will always be a major
1257
+ // Some examples:
1258
+ // 1.0.0-1 -> 1.0.0
1259
+ // 1.0.0-1 -> 1.1.1
1260
+ // 1.0.0-1 -> 2.0.0
1261
+ if (!lowVersion.patch && !lowVersion.minor) {
1262
+ return 'major'
1263
+ }
1264
+
1265
+ // If the main part has no difference
1266
+ if (lowVersion.compareMain(highVersion) === 0) {
1267
+ if (lowVersion.minor && !lowVersion.patch) {
1268
+ return 'minor'
1269
+ }
1270
+ return 'patch'
1271
+ }
1272
+ }
1273
+
1274
+ // add the `pre` prefix if we are going to a prerelease version
1275
+ const prefix = highHasPre ? 'pre' : '';
1276
+
1277
+ if (v1.major !== v2.major) {
1278
+ return prefix + 'major'
1279
+ }
1280
+
1281
+ if (v1.minor !== v2.minor) {
1282
+ return prefix + 'minor'
1283
+ }
1284
+
1285
+ if (v1.patch !== v2.patch) {
1286
+ return prefix + 'patch'
1287
+ }
1288
+
1289
+ // high and low are prereleases
1290
+ return 'prerelease'
1291
+ };
1292
+
1293
+ diff_1 = diff;
1294
+ return diff_1;
1295
+ }
1296
+
1297
+ var major_1;
1298
+ var hasRequiredMajor;
1299
+
1300
+ function requireMajor () {
1301
+ if (hasRequiredMajor) return major_1;
1302
+ hasRequiredMajor = 1;
1303
+
1304
+ const SemVer = requireSemver$1();
1305
+ const major = (a, loose) => new SemVer(a, loose).major;
1306
+ major_1 = major;
1307
+ return major_1;
1308
+ }
1309
+
1310
+ var minor_1;
1311
+ var hasRequiredMinor;
1312
+
1313
+ function requireMinor () {
1314
+ if (hasRequiredMinor) return minor_1;
1315
+ hasRequiredMinor = 1;
1316
+
1317
+ const SemVer = requireSemver$1();
1318
+ const minor = (a, loose) => new SemVer(a, loose).minor;
1319
+ minor_1 = minor;
1320
+ return minor_1;
1321
+ }
1322
+
1323
+ var patch_1;
1324
+ var hasRequiredPatch;
1325
+
1326
+ function requirePatch () {
1327
+ if (hasRequiredPatch) return patch_1;
1328
+ hasRequiredPatch = 1;
1329
+
1330
+ const SemVer = requireSemver$1();
1331
+ const patch = (a, loose) => new SemVer(a, loose).patch;
1332
+ patch_1 = patch;
1333
+ return patch_1;
1334
+ }
1335
+
1336
+ var prerelease_1;
1337
+ var hasRequiredPrerelease;
1338
+
1339
+ function requirePrerelease () {
1340
+ if (hasRequiredPrerelease) return prerelease_1;
1341
+ hasRequiredPrerelease = 1;
1342
+
1343
+ const parse = requireParse();
1344
+ const prerelease = (version, options) => {
1345
+ const parsed = parse(version, options);
1346
+ return (parsed && parsed.prerelease.length) ? parsed.prerelease : null
1347
+ };
1348
+ prerelease_1 = prerelease;
1349
+ return prerelease_1;
1350
+ }
1351
+
1352
+ var compare_1;
1353
+ var hasRequiredCompare;
1354
+
1355
+ function requireCompare () {
1356
+ if (hasRequiredCompare) return compare_1;
1357
+ hasRequiredCompare = 1;
1358
+
1359
+ const SemVer = requireSemver$1();
1360
+ const compare = (a, b, loose) =>
1361
+ new SemVer(a, loose).compare(new SemVer(b, loose));
1362
+
1363
+ compare_1 = compare;
1364
+ return compare_1;
1365
+ }
1366
+
1367
+ var rcompare_1;
1368
+ var hasRequiredRcompare;
1369
+
1370
+ function requireRcompare () {
1371
+ if (hasRequiredRcompare) return rcompare_1;
1372
+ hasRequiredRcompare = 1;
1373
+
1374
+ const compare = requireCompare();
1375
+ const rcompare = (a, b, loose) => compare(b, a, loose);
1376
+ rcompare_1 = rcompare;
1377
+ return rcompare_1;
1378
+ }
1379
+
1380
+ var compareLoose_1;
1381
+ var hasRequiredCompareLoose;
1382
+
1383
+ function requireCompareLoose () {
1384
+ if (hasRequiredCompareLoose) return compareLoose_1;
1385
+ hasRequiredCompareLoose = 1;
1386
+
1387
+ const compare = requireCompare();
1388
+ const compareLoose = (a, b) => compare(a, b, true);
1389
+ compareLoose_1 = compareLoose;
1390
+ return compareLoose_1;
1391
+ }
1392
+
1393
+ var compareBuild_1;
1394
+ var hasRequiredCompareBuild;
1395
+
1396
+ function requireCompareBuild () {
1397
+ if (hasRequiredCompareBuild) return compareBuild_1;
1398
+ hasRequiredCompareBuild = 1;
1399
+
1400
+ const SemVer = requireSemver$1();
1401
+ const compareBuild = (a, b, loose) => {
1402
+ const versionA = new SemVer(a, loose);
1403
+ const versionB = new SemVer(b, loose);
1404
+ return versionA.compare(versionB) || versionA.compareBuild(versionB)
1405
+ };
1406
+ compareBuild_1 = compareBuild;
1407
+ return compareBuild_1;
1408
+ }
1409
+
1410
+ var sort_1;
1411
+ var hasRequiredSort;
1412
+
1413
+ function requireSort () {
1414
+ if (hasRequiredSort) return sort_1;
1415
+ hasRequiredSort = 1;
1416
+
1417
+ const compareBuild = requireCompareBuild();
1418
+ const sort = (list, loose) => list.sort((a, b) => compareBuild(a, b, loose));
1419
+ sort_1 = sort;
1420
+ return sort_1;
1421
+ }
1422
+
1423
+ var rsort_1;
1424
+ var hasRequiredRsort;
1425
+
1426
+ function requireRsort () {
1427
+ if (hasRequiredRsort) return rsort_1;
1428
+ hasRequiredRsort = 1;
1429
+
1430
+ const compareBuild = requireCompareBuild();
1431
+ const rsort = (list, loose) => list.sort((a, b) => compareBuild(b, a, loose));
1432
+ rsort_1 = rsort;
1433
+ return rsort_1;
1434
+ }
1435
+
1436
+ var gt_1;
1437
+ var hasRequiredGt;
1438
+
1439
+ function requireGt () {
1440
+ if (hasRequiredGt) return gt_1;
1441
+ hasRequiredGt = 1;
1442
+
1443
+ const compare = requireCompare();
1444
+ const gt = (a, b, loose) => compare(a, b, loose) > 0;
1445
+ gt_1 = gt;
1446
+ return gt_1;
1447
+ }
1448
+
1449
+ var lt_1;
1450
+ var hasRequiredLt;
1451
+
1452
+ function requireLt () {
1453
+ if (hasRequiredLt) return lt_1;
1454
+ hasRequiredLt = 1;
1455
+
1456
+ const compare = requireCompare();
1457
+ const lt = (a, b, loose) => compare(a, b, loose) < 0;
1458
+ lt_1 = lt;
1459
+ return lt_1;
1460
+ }
1461
+
1462
+ var eq_1;
1463
+ var hasRequiredEq;
1464
+
1465
+ function requireEq () {
1466
+ if (hasRequiredEq) return eq_1;
1467
+ hasRequiredEq = 1;
1468
+
1469
+ const compare = requireCompare();
1470
+ const eq = (a, b, loose) => compare(a, b, loose) === 0;
1471
+ eq_1 = eq;
1472
+ return eq_1;
1473
+ }
1474
+
1475
+ var neq_1;
1476
+ var hasRequiredNeq;
1477
+
1478
+ function requireNeq () {
1479
+ if (hasRequiredNeq) return neq_1;
1480
+ hasRequiredNeq = 1;
1481
+
1482
+ const compare = requireCompare();
1483
+ const neq = (a, b, loose) => compare(a, b, loose) !== 0;
1484
+ neq_1 = neq;
1485
+ return neq_1;
1486
+ }
1487
+
1488
+ var gte_1;
1489
+ var hasRequiredGte;
1490
+
1491
+ function requireGte () {
1492
+ if (hasRequiredGte) return gte_1;
1493
+ hasRequiredGte = 1;
1494
+
1495
+ const compare = requireCompare();
1496
+ const gte = (a, b, loose) => compare(a, b, loose) >= 0;
1497
+ gte_1 = gte;
1498
+ return gte_1;
1499
+ }
1500
+
1501
+ var lte_1;
1502
+ var hasRequiredLte;
1503
+
1504
+ function requireLte () {
1505
+ if (hasRequiredLte) return lte_1;
1506
+ hasRequiredLte = 1;
1507
+
1508
+ const compare = requireCompare();
1509
+ const lte = (a, b, loose) => compare(a, b, loose) <= 0;
1510
+ lte_1 = lte;
1511
+ return lte_1;
1512
+ }
1513
+
1514
+ var cmp_1;
1515
+ var hasRequiredCmp;
1516
+
1517
+ function requireCmp () {
1518
+ if (hasRequiredCmp) return cmp_1;
1519
+ hasRequiredCmp = 1;
1520
+
1521
+ const eq = requireEq();
1522
+ const neq = requireNeq();
1523
+ const gt = requireGt();
1524
+ const gte = requireGte();
1525
+ const lt = requireLt();
1526
+ const lte = requireLte();
1527
+
1528
+ const cmp = (a, op, b, loose) => {
1529
+ switch (op) {
1530
+ case '===':
1531
+ if (typeof a === 'object') {
1532
+ a = a.version;
1533
+ }
1534
+ if (typeof b === 'object') {
1535
+ b = b.version;
1536
+ }
1537
+ return a === b
1538
+
1539
+ case '!==':
1540
+ if (typeof a === 'object') {
1541
+ a = a.version;
1542
+ }
1543
+ if (typeof b === 'object') {
1544
+ b = b.version;
1545
+ }
1546
+ return a !== b
1547
+
1548
+ case '':
1549
+ case '=':
1550
+ case '==':
1551
+ return eq(a, b, loose)
1552
+
1553
+ case '!=':
1554
+ return neq(a, b, loose)
1555
+
1556
+ case '>':
1557
+ return gt(a, b, loose)
1558
+
1559
+ case '>=':
1560
+ return gte(a, b, loose)
1561
+
1562
+ case '<':
1563
+ return lt(a, b, loose)
1564
+
1565
+ case '<=':
1566
+ return lte(a, b, loose)
1567
+
1568
+ default:
1569
+ throw new TypeError(`Invalid operator: ${op}`)
1570
+ }
1571
+ };
1572
+ cmp_1 = cmp;
1573
+ return cmp_1;
1574
+ }
1575
+
1576
+ var coerce_1;
1577
+ var hasRequiredCoerce;
1578
+
1579
+ function requireCoerce () {
1580
+ if (hasRequiredCoerce) return coerce_1;
1581
+ hasRequiredCoerce = 1;
1582
+
1583
+ const SemVer = requireSemver$1();
1584
+ const parse = requireParse();
1585
+ const { safeRe: re, t } = requireRe();
1586
+
1587
+ const coerce = (version, options) => {
1588
+ if (version instanceof SemVer) {
1589
+ return version
1590
+ }
1591
+
1592
+ if (typeof version === 'number') {
1593
+ version = String(version);
1594
+ }
1595
+
1596
+ if (typeof version !== 'string') {
1597
+ return null
1598
+ }
1599
+
1600
+ options = options || {};
1601
+
1602
+ let match = null;
1603
+ if (!options.rtl) {
1604
+ match = version.match(options.includePrerelease ? re[t.COERCEFULL] : re[t.COERCE]);
1605
+ } else {
1606
+ // Find the right-most coercible string that does not share
1607
+ // a terminus with a more left-ward coercible string.
1608
+ // Eg, '1.2.3.4' wants to coerce '2.3.4', not '3.4' or '4'
1609
+ // With includePrerelease option set, '1.2.3.4-rc' wants to coerce '2.3.4-rc', not '2.3.4'
1610
+ //
1611
+ // Walk through the string checking with a /g regexp
1612
+ // Manually set the index so as to pick up overlapping matches.
1613
+ // Stop when we get a match that ends at the string end, since no
1614
+ // coercible string can be more right-ward without the same terminus.
1615
+ const coerceRtlRegex = options.includePrerelease ? re[t.COERCERTLFULL] : re[t.COERCERTL];
1616
+ let next;
1617
+ while ((next = coerceRtlRegex.exec(version)) &&
1618
+ (!match || match.index + match[0].length !== version.length)
1619
+ ) {
1620
+ if (!match ||
1621
+ next.index + next[0].length !== match.index + match[0].length) {
1622
+ match = next;
1623
+ }
1624
+ coerceRtlRegex.lastIndex = next.index + next[1].length + next[2].length;
1625
+ }
1626
+ // leave it in a clean state
1627
+ coerceRtlRegex.lastIndex = -1;
1628
+ }
1629
+
1630
+ if (match === null) {
1631
+ return null
1632
+ }
1633
+
1634
+ const major = match[2];
1635
+ const minor = match[3] || '0';
1636
+ const patch = match[4] || '0';
1637
+ const prerelease = options.includePrerelease && match[5] ? `-${match[5]}` : '';
1638
+ const build = options.includePrerelease && match[6] ? `+${match[6]}` : '';
1639
+
1640
+ return parse(`${major}.${minor}.${patch}${prerelease}${build}`, options)
1641
+ };
1642
+ coerce_1 = coerce;
1643
+ return coerce_1;
1644
+ }
1645
+
1646
+ var lrucache;
1647
+ var hasRequiredLrucache;
1648
+
1649
+ function requireLrucache () {
1650
+ if (hasRequiredLrucache) return lrucache;
1651
+ hasRequiredLrucache = 1;
1652
+
1653
+ class LRUCache {
1654
+ constructor () {
1655
+ this.max = 1000;
1656
+ this.map = new Map();
1657
+ }
1658
+
1659
+ get (key) {
1660
+ const value = this.map.get(key);
1661
+ if (value === undefined) {
1662
+ return undefined
1663
+ } else {
1664
+ // Remove the key from the map and add it to the end
1665
+ this.map.delete(key);
1666
+ this.map.set(key, value);
1667
+ return value
1668
+ }
1669
+ }
1670
+
1671
+ delete (key) {
1672
+ return this.map.delete(key)
1673
+ }
1674
+
1675
+ set (key, value) {
1676
+ const deleted = this.delete(key);
1677
+
1678
+ if (!deleted && value !== undefined) {
1679
+ // If cache is full, delete the least recently used item
1680
+ if (this.map.size >= this.max) {
1681
+ const firstKey = this.map.keys().next().value;
1682
+ this.delete(firstKey);
1683
+ }
1684
+
1685
+ this.map.set(key, value);
1686
+ }
1687
+
1688
+ return this
1689
+ }
1690
+ }
1691
+
1692
+ lrucache = LRUCache;
1693
+ return lrucache;
1694
+ }
1695
+
1696
+ var range;
1697
+ var hasRequiredRange;
1698
+
1699
+ function requireRange () {
1700
+ if (hasRequiredRange) return range;
1701
+ hasRequiredRange = 1;
1702
+
1703
+ const SPACE_CHARACTERS = /\s+/g;
1704
+
1705
+ // hoisted class for cyclic dependency
1706
+ class Range {
1707
+ constructor (range, options) {
1708
+ options = parseOptions(options);
1709
+
1710
+ if (range instanceof Range) {
1711
+ if (
1712
+ range.loose === !!options.loose &&
1713
+ range.includePrerelease === !!options.includePrerelease
1714
+ ) {
1715
+ return range
1716
+ } else {
1717
+ return new Range(range.raw, options)
1718
+ }
1719
+ }
1720
+
1721
+ if (range instanceof Comparator) {
1722
+ // just put it in the set and return
1723
+ this.raw = range.value;
1724
+ this.set = [[range]];
1725
+ this.formatted = undefined;
1726
+ return this
1727
+ }
1728
+
1729
+ this.options = options;
1730
+ this.loose = !!options.loose;
1731
+ this.includePrerelease = !!options.includePrerelease;
1732
+
1733
+ // First reduce all whitespace as much as possible so we do not have to rely
1734
+ // on potentially slow regexes like \s*. This is then stored and used for
1735
+ // future error messages as well.
1736
+ this.raw = range.trim().replace(SPACE_CHARACTERS, ' ');
1737
+
1738
+ // First, split on ||
1739
+ this.set = this.raw
1740
+ .split('||')
1741
+ // map the range to a 2d array of comparators
1742
+ .map(r => this.parseRange(r.trim()))
1743
+ // throw out any comparator lists that are empty
1744
+ // this generally means that it was not a valid range, which is allowed
1745
+ // in loose mode, but will still throw if the WHOLE range is invalid.
1746
+ .filter(c => c.length);
1747
+
1748
+ if (!this.set.length) {
1749
+ throw new TypeError(`Invalid SemVer Range: ${this.raw}`)
1750
+ }
1751
+
1752
+ // if we have any that are not the null set, throw out null sets.
1753
+ if (this.set.length > 1) {
1754
+ // keep the first one, in case they're all null sets
1755
+ const first = this.set[0];
1756
+ this.set = this.set.filter(c => !isNullSet(c[0]));
1757
+ if (this.set.length === 0) {
1758
+ this.set = [first];
1759
+ } else if (this.set.length > 1) {
1760
+ // if we have any that are *, then the range is just *
1761
+ for (const c of this.set) {
1762
+ if (c.length === 1 && isAny(c[0])) {
1763
+ this.set = [c];
1764
+ break
1765
+ }
1766
+ }
1767
+ }
1768
+ }
1769
+
1770
+ this.formatted = undefined;
1771
+ }
1772
+
1773
+ get range () {
1774
+ if (this.formatted === undefined) {
1775
+ this.formatted = '';
1776
+ for (let i = 0; i < this.set.length; i++) {
1777
+ if (i > 0) {
1778
+ this.formatted += '||';
1779
+ }
1780
+ const comps = this.set[i];
1781
+ for (let k = 0; k < comps.length; k++) {
1782
+ if (k > 0) {
1783
+ this.formatted += ' ';
1784
+ }
1785
+ this.formatted += comps[k].toString().trim();
1786
+ }
1787
+ }
1788
+ }
1789
+ return this.formatted
1790
+ }
1791
+
1792
+ format () {
1793
+ return this.range
1794
+ }
1795
+
1796
+ toString () {
1797
+ return this.range
1798
+ }
1799
+
1800
+ parseRange (range) {
1801
+ // memoize range parsing for performance.
1802
+ // this is a very hot path, and fully deterministic.
1803
+ const memoOpts =
1804
+ (this.options.includePrerelease && FLAG_INCLUDE_PRERELEASE) |
1805
+ (this.options.loose && FLAG_LOOSE);
1806
+ const memoKey = memoOpts + ':' + range;
1807
+ const cached = cache.get(memoKey);
1808
+ if (cached) {
1809
+ return cached
1810
+ }
1811
+
1812
+ const loose = this.options.loose;
1813
+ // `1.2.3 - 1.2.4` => `>=1.2.3 <=1.2.4`
1814
+ const hr = loose ? re[t.HYPHENRANGELOOSE] : re[t.HYPHENRANGE];
1815
+ range = range.replace(hr, hyphenReplace(this.options.includePrerelease));
1816
+ debug('hyphen replace', range);
1817
+
1818
+ // `> 1.2.3 < 1.2.5` => `>1.2.3 <1.2.5`
1819
+ range = range.replace(re[t.COMPARATORTRIM], comparatorTrimReplace);
1820
+ debug('comparator trim', range);
1821
+
1822
+ // `~ 1.2.3` => `~1.2.3`
1823
+ range = range.replace(re[t.TILDETRIM], tildeTrimReplace);
1824
+ debug('tilde trim', range);
1825
+
1826
+ // `^ 1.2.3` => `^1.2.3`
1827
+ range = range.replace(re[t.CARETTRIM], caretTrimReplace);
1828
+ debug('caret trim', range);
1829
+
1830
+ // At this point, the range is completely trimmed and
1831
+ // ready to be split into comparators.
1832
+
1833
+ let rangeList = range
1834
+ .split(' ')
1835
+ .map(comp => parseComparator(comp, this.options))
1836
+ .join(' ')
1837
+ .split(/\s+/)
1838
+ // >=0.0.0 is equivalent to *
1839
+ .map(comp => replaceGTE0(comp, this.options));
1840
+
1841
+ if (loose) {
1842
+ // in loose mode, throw out any that are not valid comparators
1843
+ rangeList = rangeList.filter(comp => {
1844
+ debug('loose invalid filter', comp, this.options);
1845
+ return !!comp.match(re[t.COMPARATORLOOSE])
1846
+ });
1847
+ }
1848
+ debug('range list', rangeList);
1849
+
1850
+ // if any comparators are the null set, then replace with JUST null set
1851
+ // if more than one comparator, remove any * comparators
1852
+ // also, don't include the same comparator more than once
1853
+ const rangeMap = new Map();
1854
+ const comparators = rangeList.map(comp => new Comparator(comp, this.options));
1855
+ for (const comp of comparators) {
1856
+ if (isNullSet(comp)) {
1857
+ return [comp]
1858
+ }
1859
+ rangeMap.set(comp.value, comp);
1860
+ }
1861
+ if (rangeMap.size > 1 && rangeMap.has('')) {
1862
+ rangeMap.delete('');
1863
+ }
1864
+
1865
+ const result = [...rangeMap.values()];
1866
+ cache.set(memoKey, result);
1867
+ return result
1868
+ }
1869
+
1870
+ intersects (range, options) {
1871
+ if (!(range instanceof Range)) {
1872
+ throw new TypeError('a Range is required')
1873
+ }
1874
+
1875
+ return this.set.some((thisComparators) => {
1876
+ return (
1877
+ isSatisfiable(thisComparators, options) &&
1878
+ range.set.some((rangeComparators) => {
1879
+ return (
1880
+ isSatisfiable(rangeComparators, options) &&
1881
+ thisComparators.every((thisComparator) => {
1882
+ return rangeComparators.every((rangeComparator) => {
1883
+ return thisComparator.intersects(rangeComparator, options)
1884
+ })
1885
+ })
1886
+ )
1887
+ })
1888
+ )
1889
+ })
1890
+ }
1891
+
1892
+ // if ANY of the sets match ALL of its comparators, then pass
1893
+ test (version) {
1894
+ if (!version) {
1895
+ return false
1896
+ }
1897
+
1898
+ if (typeof version === 'string') {
1899
+ try {
1900
+ version = new SemVer(version, this.options);
1901
+ } catch (er) {
1902
+ return false
1903
+ }
1904
+ }
1905
+
1906
+ for (let i = 0; i < this.set.length; i++) {
1907
+ if (testSet(this.set[i], version, this.options)) {
1908
+ return true
1909
+ }
1910
+ }
1911
+ return false
1912
+ }
1913
+ }
1914
+
1915
+ range = Range;
1916
+
1917
+ const LRU = requireLrucache();
1918
+ const cache = new LRU();
1919
+
1920
+ const parseOptions = requireParseOptions();
1921
+ const Comparator = requireComparator();
1922
+ const debug = requireDebug();
1923
+ const SemVer = requireSemver$1();
1924
+ const {
1925
+ safeRe: re,
1926
+ t,
1927
+ comparatorTrimReplace,
1928
+ tildeTrimReplace,
1929
+ caretTrimReplace,
1930
+ } = requireRe();
1931
+ const { FLAG_INCLUDE_PRERELEASE, FLAG_LOOSE } = requireConstants();
1932
+
1933
+ const isNullSet = c => c.value === '<0.0.0-0';
1934
+ const isAny = c => c.value === '';
1935
+
1936
+ // take a set of comparators and determine whether there
1937
+ // exists a version which can satisfy it
1938
+ const isSatisfiable = (comparators, options) => {
1939
+ let result = true;
1940
+ const remainingComparators = comparators.slice();
1941
+ let testComparator = remainingComparators.pop();
1942
+
1943
+ while (result && remainingComparators.length) {
1944
+ result = remainingComparators.every((otherComparator) => {
1945
+ return testComparator.intersects(otherComparator, options)
1946
+ });
1947
+
1948
+ testComparator = remainingComparators.pop();
1949
+ }
1950
+
1951
+ return result
1952
+ };
1953
+
1954
+ // comprised of xranges, tildes, stars, and gtlt's at this point.
1955
+ // already replaced the hyphen ranges
1956
+ // turn into a set of JUST comparators.
1957
+ const parseComparator = (comp, options) => {
1958
+ comp = comp.replace(re[t.BUILD], '');
1959
+ debug('comp', comp, options);
1960
+ comp = replaceCarets(comp, options);
1961
+ debug('caret', comp);
1962
+ comp = replaceTildes(comp, options);
1963
+ debug('tildes', comp);
1964
+ comp = replaceXRanges(comp, options);
1965
+ debug('xrange', comp);
1966
+ comp = replaceStars(comp, options);
1967
+ debug('stars', comp);
1968
+ return comp
1969
+ };
1970
+
1971
+ const isX = id => !id || id.toLowerCase() === 'x' || id === '*';
1972
+
1973
+ // ~, ~> --> * (any, kinda silly)
1974
+ // ~2, ~2.x, ~2.x.x, ~>2, ~>2.x ~>2.x.x --> >=2.0.0 <3.0.0-0
1975
+ // ~2.0, ~2.0.x, ~>2.0, ~>2.0.x --> >=2.0.0 <2.1.0-0
1976
+ // ~1.2, ~1.2.x, ~>1.2, ~>1.2.x --> >=1.2.0 <1.3.0-0
1977
+ // ~1.2.3, ~>1.2.3 --> >=1.2.3 <1.3.0-0
1978
+ // ~1.2.0, ~>1.2.0 --> >=1.2.0 <1.3.0-0
1979
+ // ~0.0.1 --> >=0.0.1 <0.1.0-0
1980
+ const replaceTildes = (comp, options) => {
1981
+ return comp
1982
+ .trim()
1983
+ .split(/\s+/)
1984
+ .map((c) => replaceTilde(c, options))
1985
+ .join(' ')
1986
+ };
1987
+
1988
+ const replaceTilde = (comp, options) => {
1989
+ const r = options.loose ? re[t.TILDELOOSE] : re[t.TILDE];
1990
+ return comp.replace(r, (_, M, m, p, pr) => {
1991
+ debug('tilde', comp, _, M, m, p, pr);
1992
+ let ret;
1993
+
1994
+ if (isX(M)) {
1995
+ ret = '';
1996
+ } else if (isX(m)) {
1997
+ ret = `>=${M}.0.0 <${+M + 1}.0.0-0`;
1998
+ } else if (isX(p)) {
1999
+ // ~1.2 == >=1.2.0 <1.3.0-0
2000
+ ret = `>=${M}.${m}.0 <${M}.${+m + 1}.0-0`;
2001
+ } else if (pr) {
2002
+ debug('replaceTilde pr', pr);
2003
+ ret = `>=${M}.${m}.${p}-${pr
2004
+ } <${M}.${+m + 1}.0-0`;
2005
+ } else {
2006
+ // ~1.2.3 == >=1.2.3 <1.3.0-0
2007
+ ret = `>=${M}.${m}.${p
2008
+ } <${M}.${+m + 1}.0-0`;
2009
+ }
2010
+
2011
+ debug('tilde return', ret);
2012
+ return ret
2013
+ })
2014
+ };
2015
+
2016
+ // ^ --> * (any, kinda silly)
2017
+ // ^2, ^2.x, ^2.x.x --> >=2.0.0 <3.0.0-0
2018
+ // ^2.0, ^2.0.x --> >=2.0.0 <3.0.0-0
2019
+ // ^1.2, ^1.2.x --> >=1.2.0 <2.0.0-0
2020
+ // ^1.2.3 --> >=1.2.3 <2.0.0-0
2021
+ // ^1.2.0 --> >=1.2.0 <2.0.0-0
2022
+ // ^0.0.1 --> >=0.0.1 <0.0.2-0
2023
+ // ^0.1.0 --> >=0.1.0 <0.2.0-0
2024
+ const replaceCarets = (comp, options) => {
2025
+ return comp
2026
+ .trim()
2027
+ .split(/\s+/)
2028
+ .map((c) => replaceCaret(c, options))
2029
+ .join(' ')
2030
+ };
2031
+
2032
+ const replaceCaret = (comp, options) => {
2033
+ debug('caret', comp, options);
2034
+ const r = options.loose ? re[t.CARETLOOSE] : re[t.CARET];
2035
+ const z = options.includePrerelease ? '-0' : '';
2036
+ return comp.replace(r, (_, M, m, p, pr) => {
2037
+ debug('caret', comp, _, M, m, p, pr);
2038
+ let ret;
2039
+
2040
+ if (isX(M)) {
2041
+ ret = '';
2042
+ } else if (isX(m)) {
2043
+ ret = `>=${M}.0.0${z} <${+M + 1}.0.0-0`;
2044
+ } else if (isX(p)) {
2045
+ if (M === '0') {
2046
+ ret = `>=${M}.${m}.0${z} <${M}.${+m + 1}.0-0`;
2047
+ } else {
2048
+ ret = `>=${M}.${m}.0${z} <${+M + 1}.0.0-0`;
2049
+ }
2050
+ } else if (pr) {
2051
+ debug('replaceCaret pr', pr);
2052
+ if (M === '0') {
2053
+ if (m === '0') {
2054
+ ret = `>=${M}.${m}.${p}-${pr
2055
+ } <${M}.${m}.${+p + 1}-0`;
2056
+ } else {
2057
+ ret = `>=${M}.${m}.${p}-${pr
2058
+ } <${M}.${+m + 1}.0-0`;
2059
+ }
2060
+ } else {
2061
+ ret = `>=${M}.${m}.${p}-${pr
2062
+ } <${+M + 1}.0.0-0`;
2063
+ }
2064
+ } else {
2065
+ debug('no pr');
2066
+ if (M === '0') {
2067
+ if (m === '0') {
2068
+ ret = `>=${M}.${m}.${p
2069
+ }${z} <${M}.${m}.${+p + 1}-0`;
2070
+ } else {
2071
+ ret = `>=${M}.${m}.${p
2072
+ }${z} <${M}.${+m + 1}.0-0`;
2073
+ }
2074
+ } else {
2075
+ ret = `>=${M}.${m}.${p
2076
+ } <${+M + 1}.0.0-0`;
2077
+ }
2078
+ }
2079
+
2080
+ debug('caret return', ret);
2081
+ return ret
2082
+ })
2083
+ };
2084
+
2085
+ const replaceXRanges = (comp, options) => {
2086
+ debug('replaceXRanges', comp, options);
2087
+ return comp
2088
+ .split(/\s+/)
2089
+ .map((c) => replaceXRange(c, options))
2090
+ .join(' ')
2091
+ };
2092
+
2093
+ const replaceXRange = (comp, options) => {
2094
+ comp = comp.trim();
2095
+ const r = options.loose ? re[t.XRANGELOOSE] : re[t.XRANGE];
2096
+ return comp.replace(r, (ret, gtlt, M, m, p, pr) => {
2097
+ debug('xRange', comp, ret, gtlt, M, m, p, pr);
2098
+ const xM = isX(M);
2099
+ const xm = xM || isX(m);
2100
+ const xp = xm || isX(p);
2101
+ const anyX = xp;
2102
+
2103
+ if (gtlt === '=' && anyX) {
2104
+ gtlt = '';
2105
+ }
2106
+
2107
+ // if we're including prereleases in the match, then we need
2108
+ // to fix this to -0, the lowest possible prerelease value
2109
+ pr = options.includePrerelease ? '-0' : '';
2110
+
2111
+ if (xM) {
2112
+ if (gtlt === '>' || gtlt === '<') {
2113
+ // nothing is allowed
2114
+ ret = '<0.0.0-0';
2115
+ } else {
2116
+ // nothing is forbidden
2117
+ ret = '*';
2118
+ }
2119
+ } else if (gtlt && anyX) {
2120
+ // we know patch is an x, because we have any x at all.
2121
+ // replace X with 0
2122
+ if (xm) {
2123
+ m = 0;
2124
+ }
2125
+ p = 0;
2126
+
2127
+ if (gtlt === '>') {
2128
+ // >1 => >=2.0.0
2129
+ // >1.2 => >=1.3.0
2130
+ gtlt = '>=';
2131
+ if (xm) {
2132
+ M = +M + 1;
2133
+ m = 0;
2134
+ p = 0;
2135
+ } else {
2136
+ m = +m + 1;
2137
+ p = 0;
2138
+ }
2139
+ } else if (gtlt === '<=') {
2140
+ // <=0.7.x is actually <0.8.0, since any 0.7.x should
2141
+ // pass. Similarly, <=7.x is actually <8.0.0, etc.
2142
+ gtlt = '<';
2143
+ if (xm) {
2144
+ M = +M + 1;
2145
+ } else {
2146
+ m = +m + 1;
2147
+ }
2148
+ }
2149
+
2150
+ if (gtlt === '<') {
2151
+ pr = '-0';
2152
+ }
2153
+
2154
+ ret = `${gtlt + M}.${m}.${p}${pr}`;
2155
+ } else if (xm) {
2156
+ ret = `>=${M}.0.0${pr} <${+M + 1}.0.0-0`;
2157
+ } else if (xp) {
2158
+ ret = `>=${M}.${m}.0${pr
2159
+ } <${M}.${+m + 1}.0-0`;
2160
+ }
2161
+
2162
+ debug('xRange return', ret);
2163
+
2164
+ return ret
2165
+ })
2166
+ };
2167
+
2168
+ // Because * is AND-ed with everything else in the comparator,
2169
+ // and '' means "any version", just remove the *s entirely.
2170
+ const replaceStars = (comp, options) => {
2171
+ debug('replaceStars', comp, options);
2172
+ // Looseness is ignored here. star is always as loose as it gets!
2173
+ return comp
2174
+ .trim()
2175
+ .replace(re[t.STAR], '')
2176
+ };
2177
+
2178
+ const replaceGTE0 = (comp, options) => {
2179
+ debug('replaceGTE0', comp, options);
2180
+ return comp
2181
+ .trim()
2182
+ .replace(re[options.includePrerelease ? t.GTE0PRE : t.GTE0], '')
2183
+ };
2184
+
2185
+ // This function is passed to string.replace(re[t.HYPHENRANGE])
2186
+ // M, m, patch, prerelease, build
2187
+ // 1.2 - 3.4.5 => >=1.2.0 <=3.4.5
2188
+ // 1.2.3 - 3.4 => >=1.2.0 <3.5.0-0 Any 3.4.x will do
2189
+ // 1.2 - 3.4 => >=1.2.0 <3.5.0-0
2190
+ // TODO build?
2191
+ const hyphenReplace = incPr => ($0,
2192
+ from, fM, fm, fp, fpr, fb,
2193
+ to, tM, tm, tp, tpr) => {
2194
+ if (isX(fM)) {
2195
+ from = '';
2196
+ } else if (isX(fm)) {
2197
+ from = `>=${fM}.0.0${incPr ? '-0' : ''}`;
2198
+ } else if (isX(fp)) {
2199
+ from = `>=${fM}.${fm}.0${incPr ? '-0' : ''}`;
2200
+ } else if (fpr) {
2201
+ from = `>=${from}`;
2202
+ } else {
2203
+ from = `>=${from}${incPr ? '-0' : ''}`;
2204
+ }
2205
+
2206
+ if (isX(tM)) {
2207
+ to = '';
2208
+ } else if (isX(tm)) {
2209
+ to = `<${+tM + 1}.0.0-0`;
2210
+ } else if (isX(tp)) {
2211
+ to = `<${tM}.${+tm + 1}.0-0`;
2212
+ } else if (tpr) {
2213
+ to = `<=${tM}.${tm}.${tp}-${tpr}`;
2214
+ } else if (incPr) {
2215
+ to = `<${tM}.${tm}.${+tp + 1}-0`;
2216
+ } else {
2217
+ to = `<=${to}`;
2218
+ }
2219
+
2220
+ return `${from} ${to}`.trim()
2221
+ };
2222
+
2223
+ const testSet = (set, version, options) => {
2224
+ for (let i = 0; i < set.length; i++) {
2225
+ if (!set[i].test(version)) {
2226
+ return false
2227
+ }
2228
+ }
2229
+
2230
+ if (version.prerelease.length && !options.includePrerelease) {
2231
+ // Find the set of versions that are allowed to have prereleases
2232
+ // For example, ^1.2.3-pr.1 desugars to >=1.2.3-pr.1 <2.0.0
2233
+ // That should allow `1.2.3-pr.2` to pass.
2234
+ // However, `1.2.4-alpha.notready` should NOT be allowed,
2235
+ // even though it's within the range set by the comparators.
2236
+ for (let i = 0; i < set.length; i++) {
2237
+ debug(set[i].semver);
2238
+ if (set[i].semver === Comparator.ANY) {
2239
+ continue
2240
+ }
2241
+
2242
+ if (set[i].semver.prerelease.length > 0) {
2243
+ const allowed = set[i].semver;
2244
+ if (allowed.major === version.major &&
2245
+ allowed.minor === version.minor &&
2246
+ allowed.patch === version.patch) {
2247
+ return true
2248
+ }
2249
+ }
2250
+ }
2251
+
2252
+ // Version has a -pre, but it's not one of the ones we like.
2253
+ return false
2254
+ }
2255
+
2256
+ return true
2257
+ };
2258
+ return range;
2259
+ }
2260
+
2261
+ var comparator;
2262
+ var hasRequiredComparator;
2263
+
2264
+ function requireComparator () {
2265
+ if (hasRequiredComparator) return comparator;
2266
+ hasRequiredComparator = 1;
2267
+
2268
+ const ANY = Symbol('SemVer ANY');
2269
+ // hoisted class for cyclic dependency
2270
+ class Comparator {
2271
+ static get ANY () {
2272
+ return ANY
2273
+ }
2274
+
2275
+ constructor (comp, options) {
2276
+ options = parseOptions(options);
2277
+
2278
+ if (comp instanceof Comparator) {
2279
+ if (comp.loose === !!options.loose) {
2280
+ return comp
2281
+ } else {
2282
+ comp = comp.value;
2283
+ }
2284
+ }
2285
+
2286
+ comp = comp.trim().split(/\s+/).join(' ');
2287
+ debug('comparator', comp, options);
2288
+ this.options = options;
2289
+ this.loose = !!options.loose;
2290
+ this.parse(comp);
2291
+
2292
+ if (this.semver === ANY) {
2293
+ this.value = '';
2294
+ } else {
2295
+ this.value = this.operator + this.semver.version;
2296
+ }
2297
+
2298
+ debug('comp', this);
2299
+ }
2300
+
2301
+ parse (comp) {
2302
+ const r = this.options.loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR];
2303
+ const m = comp.match(r);
2304
+
2305
+ if (!m) {
2306
+ throw new TypeError(`Invalid comparator: ${comp}`)
2307
+ }
2308
+
2309
+ this.operator = m[1] !== undefined ? m[1] : '';
2310
+ if (this.operator === '=') {
2311
+ this.operator = '';
2312
+ }
2313
+
2314
+ // if it literally is just '>' or '' then allow anything.
2315
+ if (!m[2]) {
2316
+ this.semver = ANY;
2317
+ } else {
2318
+ this.semver = new SemVer(m[2], this.options.loose);
2319
+ }
2320
+ }
2321
+
2322
+ toString () {
2323
+ return this.value
2324
+ }
2325
+
2326
+ test (version) {
2327
+ debug('Comparator.test', version, this.options.loose);
2328
+
2329
+ if (this.semver === ANY || version === ANY) {
2330
+ return true
2331
+ }
2332
+
2333
+ if (typeof version === 'string') {
2334
+ try {
2335
+ version = new SemVer(version, this.options);
2336
+ } catch (er) {
2337
+ return false
2338
+ }
2339
+ }
2340
+
2341
+ return cmp(version, this.operator, this.semver, this.options)
2342
+ }
2343
+
2344
+ intersects (comp, options) {
2345
+ if (!(comp instanceof Comparator)) {
2346
+ throw new TypeError('a Comparator is required')
2347
+ }
2348
+
2349
+ if (this.operator === '') {
2350
+ if (this.value === '') {
2351
+ return true
2352
+ }
2353
+ return new Range(comp.value, options).test(this.value)
2354
+ } else if (comp.operator === '') {
2355
+ if (comp.value === '') {
2356
+ return true
2357
+ }
2358
+ return new Range(this.value, options).test(comp.semver)
2359
+ }
2360
+
2361
+ options = parseOptions(options);
2362
+
2363
+ // Special cases where nothing can possibly be lower
2364
+ if (options.includePrerelease &&
2365
+ (this.value === '<0.0.0-0' || comp.value === '<0.0.0-0')) {
2366
+ return false
2367
+ }
2368
+ if (!options.includePrerelease &&
2369
+ (this.value.startsWith('<0.0.0') || comp.value.startsWith('<0.0.0'))) {
2370
+ return false
2371
+ }
2372
+
2373
+ // Same direction increasing (> or >=)
2374
+ if (this.operator.startsWith('>') && comp.operator.startsWith('>')) {
2375
+ return true
2376
+ }
2377
+ // Same direction decreasing (< or <=)
2378
+ if (this.operator.startsWith('<') && comp.operator.startsWith('<')) {
2379
+ return true
2380
+ }
2381
+ // same SemVer and both sides are inclusive (<= or >=)
2382
+ if (
2383
+ (this.semver.version === comp.semver.version) &&
2384
+ this.operator.includes('=') && comp.operator.includes('=')) {
2385
+ return true
2386
+ }
2387
+ // opposite directions less than
2388
+ if (cmp(this.semver, '<', comp.semver, options) &&
2389
+ this.operator.startsWith('>') && comp.operator.startsWith('<')) {
2390
+ return true
2391
+ }
2392
+ // opposite directions greater than
2393
+ if (cmp(this.semver, '>', comp.semver, options) &&
2394
+ this.operator.startsWith('<') && comp.operator.startsWith('>')) {
2395
+ return true
2396
+ }
2397
+ return false
2398
+ }
2399
+ }
2400
+
2401
+ comparator = Comparator;
2402
+
2403
+ const parseOptions = requireParseOptions();
2404
+ const { safeRe: re, t } = requireRe();
2405
+ const cmp = requireCmp();
2406
+ const debug = requireDebug();
2407
+ const SemVer = requireSemver$1();
2408
+ const Range = requireRange();
2409
+ return comparator;
2410
+ }
2411
+
2412
+ var satisfies_1;
2413
+ var hasRequiredSatisfies;
2414
+
2415
+ function requireSatisfies () {
2416
+ if (hasRequiredSatisfies) return satisfies_1;
2417
+ hasRequiredSatisfies = 1;
2418
+
2419
+ const Range = requireRange();
2420
+ const satisfies = (version, range, options) => {
2421
+ try {
2422
+ range = new Range(range, options);
2423
+ } catch (er) {
2424
+ return false
2425
+ }
2426
+ return range.test(version)
2427
+ };
2428
+ satisfies_1 = satisfies;
2429
+ return satisfies_1;
2430
+ }
2431
+
2432
+ var toComparators_1;
2433
+ var hasRequiredToComparators;
2434
+
2435
+ function requireToComparators () {
2436
+ if (hasRequiredToComparators) return toComparators_1;
2437
+ hasRequiredToComparators = 1;
2438
+
2439
+ const Range = requireRange();
2440
+
2441
+ // Mostly just for testing and legacy API reasons
2442
+ const toComparators = (range, options) =>
2443
+ new Range(range, options).set
2444
+ .map(comp => comp.map(c => c.value).join(' ').trim().split(' '));
2445
+
2446
+ toComparators_1 = toComparators;
2447
+ return toComparators_1;
2448
+ }
2449
+
2450
+ var maxSatisfying_1;
2451
+ var hasRequiredMaxSatisfying;
2452
+
2453
+ function requireMaxSatisfying () {
2454
+ if (hasRequiredMaxSatisfying) return maxSatisfying_1;
2455
+ hasRequiredMaxSatisfying = 1;
2456
+
2457
+ const SemVer = requireSemver$1();
2458
+ const Range = requireRange();
2459
+
2460
+ const maxSatisfying = (versions, range, options) => {
2461
+ let max = null;
2462
+ let maxSV = null;
2463
+ let rangeObj = null;
2464
+ try {
2465
+ rangeObj = new Range(range, options);
2466
+ } catch (er) {
2467
+ return null
2468
+ }
2469
+ versions.forEach((v) => {
2470
+ if (rangeObj.test(v)) {
2471
+ // satisfies(v, range, options)
2472
+ if (!max || maxSV.compare(v) === -1) {
2473
+ // compare(max, v, true)
2474
+ max = v;
2475
+ maxSV = new SemVer(max, options);
2476
+ }
2477
+ }
2478
+ });
2479
+ return max
2480
+ };
2481
+ maxSatisfying_1 = maxSatisfying;
2482
+ return maxSatisfying_1;
2483
+ }
2484
+
2485
+ var minSatisfying_1;
2486
+ var hasRequiredMinSatisfying;
2487
+
2488
+ function requireMinSatisfying () {
2489
+ if (hasRequiredMinSatisfying) return minSatisfying_1;
2490
+ hasRequiredMinSatisfying = 1;
2491
+
2492
+ const SemVer = requireSemver$1();
2493
+ const Range = requireRange();
2494
+ const minSatisfying = (versions, range, options) => {
2495
+ let min = null;
2496
+ let minSV = null;
2497
+ let rangeObj = null;
2498
+ try {
2499
+ rangeObj = new Range(range, options);
2500
+ } catch (er) {
2501
+ return null
2502
+ }
2503
+ versions.forEach((v) => {
2504
+ if (rangeObj.test(v)) {
2505
+ // satisfies(v, range, options)
2506
+ if (!min || minSV.compare(v) === 1) {
2507
+ // compare(min, v, true)
2508
+ min = v;
2509
+ minSV = new SemVer(min, options);
2510
+ }
2511
+ }
2512
+ });
2513
+ return min
2514
+ };
2515
+ minSatisfying_1 = minSatisfying;
2516
+ return minSatisfying_1;
2517
+ }
2518
+
2519
+ var minVersion_1;
2520
+ var hasRequiredMinVersion;
2521
+
2522
+ function requireMinVersion () {
2523
+ if (hasRequiredMinVersion) return minVersion_1;
2524
+ hasRequiredMinVersion = 1;
2525
+
2526
+ const SemVer = requireSemver$1();
2527
+ const Range = requireRange();
2528
+ const gt = requireGt();
2529
+
2530
+ const minVersion = (range, loose) => {
2531
+ range = new Range(range, loose);
2532
+
2533
+ let minver = new SemVer('0.0.0');
2534
+ if (range.test(minver)) {
2535
+ return minver
2536
+ }
2537
+
2538
+ minver = new SemVer('0.0.0-0');
2539
+ if (range.test(minver)) {
2540
+ return minver
2541
+ }
2542
+
2543
+ minver = null;
2544
+ for (let i = 0; i < range.set.length; ++i) {
2545
+ const comparators = range.set[i];
2546
+
2547
+ let setMin = null;
2548
+ comparators.forEach((comparator) => {
2549
+ // Clone to avoid manipulating the comparator's semver object.
2550
+ const compver = new SemVer(comparator.semver.version);
2551
+ switch (comparator.operator) {
2552
+ case '>':
2553
+ if (compver.prerelease.length === 0) {
2554
+ compver.patch++;
2555
+ } else {
2556
+ compver.prerelease.push(0);
2557
+ }
2558
+ compver.raw = compver.format();
2559
+ /* fallthrough */
2560
+ case '':
2561
+ case '>=':
2562
+ if (!setMin || gt(compver, setMin)) {
2563
+ setMin = compver;
2564
+ }
2565
+ break
2566
+ case '<':
2567
+ case '<=':
2568
+ /* Ignore maximum versions */
2569
+ break
2570
+ /* istanbul ignore next */
2571
+ default:
2572
+ throw new Error(`Unexpected operation: ${comparator.operator}`)
2573
+ }
2574
+ });
2575
+ if (setMin && (!minver || gt(minver, setMin))) {
2576
+ minver = setMin;
2577
+ }
2578
+ }
2579
+
2580
+ if (minver && range.test(minver)) {
2581
+ return minver
2582
+ }
2583
+
2584
+ return null
2585
+ };
2586
+ minVersion_1 = minVersion;
2587
+ return minVersion_1;
2588
+ }
2589
+
2590
+ var valid;
2591
+ var hasRequiredValid;
2592
+
2593
+ function requireValid () {
2594
+ if (hasRequiredValid) return valid;
2595
+ hasRequiredValid = 1;
2596
+
2597
+ const Range = requireRange();
2598
+ const validRange = (range, options) => {
2599
+ try {
2600
+ // Return '*' instead of '' so that truthiness works.
2601
+ // This will throw if it's invalid anyway
2602
+ return new Range(range, options).range || '*'
2603
+ } catch (er) {
2604
+ return null
2605
+ }
2606
+ };
2607
+ valid = validRange;
2608
+ return valid;
2609
+ }
2610
+
2611
+ var outside_1;
2612
+ var hasRequiredOutside;
2613
+
2614
+ function requireOutside () {
2615
+ if (hasRequiredOutside) return outside_1;
2616
+ hasRequiredOutside = 1;
2617
+
2618
+ const SemVer = requireSemver$1();
2619
+ const Comparator = requireComparator();
2620
+ const { ANY } = Comparator;
2621
+ const Range = requireRange();
2622
+ const satisfies = requireSatisfies();
2623
+ const gt = requireGt();
2624
+ const lt = requireLt();
2625
+ const lte = requireLte();
2626
+ const gte = requireGte();
2627
+
2628
+ const outside = (version, range, hilo, options) => {
2629
+ version = new SemVer(version, options);
2630
+ range = new Range(range, options);
2631
+
2632
+ let gtfn, ltefn, ltfn, comp, ecomp;
2633
+ switch (hilo) {
2634
+ case '>':
2635
+ gtfn = gt;
2636
+ ltefn = lte;
2637
+ ltfn = lt;
2638
+ comp = '>';
2639
+ ecomp = '>=';
2640
+ break
2641
+ case '<':
2642
+ gtfn = lt;
2643
+ ltefn = gte;
2644
+ ltfn = gt;
2645
+ comp = '<';
2646
+ ecomp = '<=';
2647
+ break
2648
+ default:
2649
+ throw new TypeError('Must provide a hilo val of "<" or ">"')
2650
+ }
2651
+
2652
+ // If it satisfies the range it is not outside
2653
+ if (satisfies(version, range, options)) {
2654
+ return false
2655
+ }
2656
+
2657
+ // From now on, variable terms are as if we're in "gtr" mode.
2658
+ // but note that everything is flipped for the "ltr" function.
2659
+
2660
+ for (let i = 0; i < range.set.length; ++i) {
2661
+ const comparators = range.set[i];
2662
+
2663
+ let high = null;
2664
+ let low = null;
2665
+
2666
+ comparators.forEach((comparator) => {
2667
+ if (comparator.semver === ANY) {
2668
+ comparator = new Comparator('>=0.0.0');
2669
+ }
2670
+ high = high || comparator;
2671
+ low = low || comparator;
2672
+ if (gtfn(comparator.semver, high.semver, options)) {
2673
+ high = comparator;
2674
+ } else if (ltfn(comparator.semver, low.semver, options)) {
2675
+ low = comparator;
2676
+ }
2677
+ });
2678
+
2679
+ // If the edge version comparator has a operator then our version
2680
+ // isn't outside it
2681
+ if (high.operator === comp || high.operator === ecomp) {
2682
+ return false
2683
+ }
2684
+
2685
+ // If the lowest version comparator has an operator and our version
2686
+ // is less than it then it isn't higher than the range
2687
+ if ((!low.operator || low.operator === comp) &&
2688
+ ltefn(version, low.semver)) {
2689
+ return false
2690
+ } else if (low.operator === ecomp && ltfn(version, low.semver)) {
2691
+ return false
2692
+ }
2693
+ }
2694
+ return true
2695
+ };
2696
+
2697
+ outside_1 = outside;
2698
+ return outside_1;
2699
+ }
2700
+
2701
+ var gtr_1;
2702
+ var hasRequiredGtr;
2703
+
2704
+ function requireGtr () {
2705
+ if (hasRequiredGtr) return gtr_1;
2706
+ hasRequiredGtr = 1;
2707
+
2708
+ // Determine if version is greater than all the versions possible in the range.
2709
+ const outside = requireOutside();
2710
+ const gtr = (version, range, options) => outside(version, range, '>', options);
2711
+ gtr_1 = gtr;
2712
+ return gtr_1;
2713
+ }
2714
+
2715
+ var ltr_1;
2716
+ var hasRequiredLtr;
2717
+
2718
+ function requireLtr () {
2719
+ if (hasRequiredLtr) return ltr_1;
2720
+ hasRequiredLtr = 1;
2721
+
2722
+ const outside = requireOutside();
2723
+ // Determine if version is less than all the versions possible in the range
2724
+ const ltr = (version, range, options) => outside(version, range, '<', options);
2725
+ ltr_1 = ltr;
2726
+ return ltr_1;
2727
+ }
2728
+
2729
+ var intersects_1;
2730
+ var hasRequiredIntersects;
2731
+
2732
+ function requireIntersects () {
2733
+ if (hasRequiredIntersects) return intersects_1;
2734
+ hasRequiredIntersects = 1;
2735
+
2736
+ const Range = requireRange();
2737
+ const intersects = (r1, r2, options) => {
2738
+ r1 = new Range(r1, options);
2739
+ r2 = new Range(r2, options);
2740
+ return r1.intersects(r2, options)
2741
+ };
2742
+ intersects_1 = intersects;
2743
+ return intersects_1;
2744
+ }
2745
+
2746
+ var simplify;
2747
+ var hasRequiredSimplify;
2748
+
2749
+ function requireSimplify () {
2750
+ if (hasRequiredSimplify) return simplify;
2751
+ hasRequiredSimplify = 1;
2752
+
2753
+ // given a set of versions and a range, create a "simplified" range
2754
+ // that includes the same versions that the original range does
2755
+ // If the original range is shorter than the simplified one, return that.
2756
+ const satisfies = requireSatisfies();
2757
+ const compare = requireCompare();
2758
+ simplify = (versions, range, options) => {
2759
+ const set = [];
2760
+ let first = null;
2761
+ let prev = null;
2762
+ const v = versions.sort((a, b) => compare(a, b, options));
2763
+ for (const version of v) {
2764
+ const included = satisfies(version, range, options);
2765
+ if (included) {
2766
+ prev = version;
2767
+ if (!first) {
2768
+ first = version;
2769
+ }
2770
+ } else {
2771
+ if (prev) {
2772
+ set.push([first, prev]);
2773
+ }
2774
+ prev = null;
2775
+ first = null;
2776
+ }
2777
+ }
2778
+ if (first) {
2779
+ set.push([first, null]);
2780
+ }
2781
+
2782
+ const ranges = [];
2783
+ for (const [min, max] of set) {
2784
+ if (min === max) {
2785
+ ranges.push(min);
2786
+ } else if (!max && min === v[0]) {
2787
+ ranges.push('*');
2788
+ } else if (!max) {
2789
+ ranges.push(`>=${min}`);
2790
+ } else if (min === v[0]) {
2791
+ ranges.push(`<=${max}`);
2792
+ } else {
2793
+ ranges.push(`${min} - ${max}`);
2794
+ }
2795
+ }
2796
+ const simplified = ranges.join(' || ');
2797
+ const original = typeof range.raw === 'string' ? range.raw : String(range);
2798
+ return simplified.length < original.length ? simplified : range
2799
+ };
2800
+ return simplify;
2801
+ }
2802
+
2803
+ var subset_1;
2804
+ var hasRequiredSubset;
2805
+
2806
+ function requireSubset () {
2807
+ if (hasRequiredSubset) return subset_1;
2808
+ hasRequiredSubset = 1;
2809
+
2810
+ const Range = requireRange();
2811
+ const Comparator = requireComparator();
2812
+ const { ANY } = Comparator;
2813
+ const satisfies = requireSatisfies();
2814
+ const compare = requireCompare();
2815
+
2816
+ // Complex range `r1 || r2 || ...` is a subset of `R1 || R2 || ...` iff:
2817
+ // - Every simple range `r1, r2, ...` is a null set, OR
2818
+ // - Every simple range `r1, r2, ...` which is not a null set is a subset of
2819
+ // some `R1, R2, ...`
2820
+ //
2821
+ // Simple range `c1 c2 ...` is a subset of simple range `C1 C2 ...` iff:
2822
+ // - If c is only the ANY comparator
2823
+ // - If C is only the ANY comparator, return true
2824
+ // - Else if in prerelease mode, return false
2825
+ // - else replace c with `[>=0.0.0]`
2826
+ // - If C is only the ANY comparator
2827
+ // - if in prerelease mode, return true
2828
+ // - else replace C with `[>=0.0.0]`
2829
+ // - Let EQ be the set of = comparators in c
2830
+ // - If EQ is more than one, return true (null set)
2831
+ // - Let GT be the highest > or >= comparator in c
2832
+ // - Let LT be the lowest < or <= comparator in c
2833
+ // - If GT and LT, and GT.semver > LT.semver, return true (null set)
2834
+ // - If any C is a = range, and GT or LT are set, return false
2835
+ // - If EQ
2836
+ // - If GT, and EQ does not satisfy GT, return true (null set)
2837
+ // - If LT, and EQ does not satisfy LT, return true (null set)
2838
+ // - If EQ satisfies every C, return true
2839
+ // - Else return false
2840
+ // - If GT
2841
+ // - If GT.semver is lower than any > or >= comp in C, return false
2842
+ // - If GT is >=, and GT.semver does not satisfy every C, return false
2843
+ // - If GT.semver has a prerelease, and not in prerelease mode
2844
+ // - If no C has a prerelease and the GT.semver tuple, return false
2845
+ // - If LT
2846
+ // - If LT.semver is greater than any < or <= comp in C, return false
2847
+ // - If LT is <=, and LT.semver does not satisfy every C, return false
2848
+ // - If LT.semver has a prerelease, and not in prerelease mode
2849
+ // - If no C has a prerelease and the LT.semver tuple, return false
2850
+ // - Else return true
2851
+
2852
+ const subset = (sub, dom, options = {}) => {
2853
+ if (sub === dom) {
2854
+ return true
2855
+ }
2856
+
2857
+ sub = new Range(sub, options);
2858
+ dom = new Range(dom, options);
2859
+ let sawNonNull = false;
2860
+
2861
+ OUTER: for (const simpleSub of sub.set) {
2862
+ for (const simpleDom of dom.set) {
2863
+ const isSub = simpleSubset(simpleSub, simpleDom, options);
2864
+ sawNonNull = sawNonNull || isSub !== null;
2865
+ if (isSub) {
2866
+ continue OUTER
2867
+ }
2868
+ }
2869
+ // the null set is a subset of everything, but null simple ranges in
2870
+ // a complex range should be ignored. so if we saw a non-null range,
2871
+ // then we know this isn't a subset, but if EVERY simple range was null,
2872
+ // then it is a subset.
2873
+ if (sawNonNull) {
2874
+ return false
2875
+ }
2876
+ }
2877
+ return true
2878
+ };
2879
+
2880
+ const minimumVersionWithPreRelease = [new Comparator('>=0.0.0-0')];
2881
+ const minimumVersion = [new Comparator('>=0.0.0')];
2882
+
2883
+ const simpleSubset = (sub, dom, options) => {
2884
+ if (sub === dom) {
2885
+ return true
2886
+ }
2887
+
2888
+ if (sub.length === 1 && sub[0].semver === ANY) {
2889
+ if (dom.length === 1 && dom[0].semver === ANY) {
2890
+ return true
2891
+ } else if (options.includePrerelease) {
2892
+ sub = minimumVersionWithPreRelease;
2893
+ } else {
2894
+ sub = minimumVersion;
2895
+ }
2896
+ }
2897
+
2898
+ if (dom.length === 1 && dom[0].semver === ANY) {
2899
+ if (options.includePrerelease) {
2900
+ return true
2901
+ } else {
2902
+ dom = minimumVersion;
2903
+ }
2904
+ }
2905
+
2906
+ const eqSet = new Set();
2907
+ let gt, lt;
2908
+ for (const c of sub) {
2909
+ if (c.operator === '>' || c.operator === '>=') {
2910
+ gt = higherGT(gt, c, options);
2911
+ } else if (c.operator === '<' || c.operator === '<=') {
2912
+ lt = lowerLT(lt, c, options);
2913
+ } else {
2914
+ eqSet.add(c.semver);
2915
+ }
2916
+ }
2917
+
2918
+ if (eqSet.size > 1) {
2919
+ return null
2920
+ }
2921
+
2922
+ let gtltComp;
2923
+ if (gt && lt) {
2924
+ gtltComp = compare(gt.semver, lt.semver, options);
2925
+ if (gtltComp > 0) {
2926
+ return null
2927
+ } else if (gtltComp === 0 && (gt.operator !== '>=' || lt.operator !== '<=')) {
2928
+ return null
2929
+ }
2930
+ }
2931
+
2932
+ // will iterate one or zero times
2933
+ for (const eq of eqSet) {
2934
+ if (gt && !satisfies(eq, String(gt), options)) {
2935
+ return null
2936
+ }
2937
+
2938
+ if (lt && !satisfies(eq, String(lt), options)) {
2939
+ return null
2940
+ }
2941
+
2942
+ for (const c of dom) {
2943
+ if (!satisfies(eq, String(c), options)) {
2944
+ return false
2945
+ }
2946
+ }
2947
+
2948
+ return true
2949
+ }
2950
+
2951
+ let higher, lower;
2952
+ let hasDomLT, hasDomGT;
2953
+ // if the subset has a prerelease, we need a comparator in the superset
2954
+ // with the same tuple and a prerelease, or it's not a subset
2955
+ let needDomLTPre = lt &&
2956
+ !options.includePrerelease &&
2957
+ lt.semver.prerelease.length ? lt.semver : false;
2958
+ let needDomGTPre = gt &&
2959
+ !options.includePrerelease &&
2960
+ gt.semver.prerelease.length ? gt.semver : false;
2961
+ // exception: <1.2.3-0 is the same as <1.2.3
2962
+ if (needDomLTPre && needDomLTPre.prerelease.length === 1 &&
2963
+ lt.operator === '<' && needDomLTPre.prerelease[0] === 0) {
2964
+ needDomLTPre = false;
2965
+ }
2966
+
2967
+ for (const c of dom) {
2968
+ hasDomGT = hasDomGT || c.operator === '>' || c.operator === '>=';
2969
+ hasDomLT = hasDomLT || c.operator === '<' || c.operator === '<=';
2970
+ if (gt) {
2971
+ if (needDomGTPre) {
2972
+ if (c.semver.prerelease && c.semver.prerelease.length &&
2973
+ c.semver.major === needDomGTPre.major &&
2974
+ c.semver.minor === needDomGTPre.minor &&
2975
+ c.semver.patch === needDomGTPre.patch) {
2976
+ needDomGTPre = false;
2977
+ }
2978
+ }
2979
+ if (c.operator === '>' || c.operator === '>=') {
2980
+ higher = higherGT(gt, c, options);
2981
+ if (higher === c && higher !== gt) {
2982
+ return false
2983
+ }
2984
+ } else if (gt.operator === '>=' && !satisfies(gt.semver, String(c), options)) {
2985
+ return false
2986
+ }
2987
+ }
2988
+ if (lt) {
2989
+ if (needDomLTPre) {
2990
+ if (c.semver.prerelease && c.semver.prerelease.length &&
2991
+ c.semver.major === needDomLTPre.major &&
2992
+ c.semver.minor === needDomLTPre.minor &&
2993
+ c.semver.patch === needDomLTPre.patch) {
2994
+ needDomLTPre = false;
2995
+ }
2996
+ }
2997
+ if (c.operator === '<' || c.operator === '<=') {
2998
+ lower = lowerLT(lt, c, options);
2999
+ if (lower === c && lower !== lt) {
3000
+ return false
3001
+ }
3002
+ } else if (lt.operator === '<=' && !satisfies(lt.semver, String(c), options)) {
3003
+ return false
3004
+ }
3005
+ }
3006
+ if (!c.operator && (lt || gt) && gtltComp !== 0) {
3007
+ return false
3008
+ }
3009
+ }
3010
+
3011
+ // if there was a < or >, and nothing in the dom, then must be false
3012
+ // UNLESS it was limited by another range in the other direction.
3013
+ // Eg, >1.0.0 <1.0.1 is still a subset of <2.0.0
3014
+ if (gt && hasDomLT && !lt && gtltComp !== 0) {
3015
+ return false
3016
+ }
3017
+
3018
+ if (lt && hasDomGT && !gt && gtltComp !== 0) {
3019
+ return false
3020
+ }
3021
+
3022
+ // we needed a prerelease range in a specific tuple, but didn't get one
3023
+ // then this isn't a subset. eg >=1.2.3-pre is not a subset of >=1.0.0,
3024
+ // because it includes prereleases in the 1.2.3 tuple
3025
+ if (needDomGTPre || needDomLTPre) {
3026
+ return false
3027
+ }
3028
+
3029
+ return true
3030
+ };
3031
+
3032
+ // >=1.2.3 is lower than >1.2.3
3033
+ const higherGT = (a, b, options) => {
3034
+ if (!a) {
3035
+ return b
3036
+ }
3037
+ const comp = compare(a.semver, b.semver, options);
3038
+ return comp > 0 ? a
3039
+ : comp < 0 ? b
3040
+ : b.operator === '>' && a.operator === '>=' ? b
3041
+ : a
3042
+ };
3043
+
3044
+ // <=1.2.3 is higher than <1.2.3
3045
+ const lowerLT = (a, b, options) => {
3046
+ if (!a) {
3047
+ return b
3048
+ }
3049
+ const comp = compare(a.semver, b.semver, options);
3050
+ return comp < 0 ? a
3051
+ : comp > 0 ? b
3052
+ : b.operator === '<' && a.operator === '<=' ? b
3053
+ : a
3054
+ };
3055
+
3056
+ subset_1 = subset;
3057
+ return subset_1;
401
3058
  }
402
3059
 
403
- /**
404
- * @param {string[]} hostnames
405
- * @returns {Set<string>}
406
- */
407
- function buildAllowedScriptHostsSet(hostnames) {
408
- const s = new Set();
409
- for (const h of hostnames) {
410
- const n = normalizeHost(h);
411
- if (n) {
412
- s.add(n);
413
- }
414
- }
415
- return s
3060
+ var semver$1;
3061
+ var hasRequiredSemver;
3062
+
3063
+ function requireSemver () {
3064
+ if (hasRequiredSemver) return semver$1;
3065
+ hasRequiredSemver = 1;
3066
+
3067
+ // just pre-load all the stuff that index.js lazily exports
3068
+ const internalRe = requireRe();
3069
+ const constants = requireConstants();
3070
+ const SemVer = requireSemver$1();
3071
+ const identifiers = requireIdentifiers();
3072
+ const parse = requireParse();
3073
+ const valid = requireValid$1();
3074
+ const clean = requireClean();
3075
+ const inc = requireInc();
3076
+ const diff = requireDiff();
3077
+ const major = requireMajor();
3078
+ const minor = requireMinor();
3079
+ const patch = requirePatch();
3080
+ const prerelease = requirePrerelease();
3081
+ const compare = requireCompare();
3082
+ const rcompare = requireRcompare();
3083
+ const compareLoose = requireCompareLoose();
3084
+ const compareBuild = requireCompareBuild();
3085
+ const sort = requireSort();
3086
+ const rsort = requireRsort();
3087
+ const gt = requireGt();
3088
+ const lt = requireLt();
3089
+ const eq = requireEq();
3090
+ const neq = requireNeq();
3091
+ const gte = requireGte();
3092
+ const lte = requireLte();
3093
+ const cmp = requireCmp();
3094
+ const coerce = requireCoerce();
3095
+ const Comparator = requireComparator();
3096
+ const Range = requireRange();
3097
+ const satisfies = requireSatisfies();
3098
+ const toComparators = requireToComparators();
3099
+ const maxSatisfying = requireMaxSatisfying();
3100
+ const minSatisfying = requireMinSatisfying();
3101
+ const minVersion = requireMinVersion();
3102
+ const validRange = requireValid();
3103
+ const outside = requireOutside();
3104
+ const gtr = requireGtr();
3105
+ const ltr = requireLtr();
3106
+ const intersects = requireIntersects();
3107
+ const simplifyRange = requireSimplify();
3108
+ const subset = requireSubset();
3109
+ semver$1 = {
3110
+ parse,
3111
+ valid,
3112
+ clean,
3113
+ inc,
3114
+ diff,
3115
+ major,
3116
+ minor,
3117
+ patch,
3118
+ prerelease,
3119
+ compare,
3120
+ rcompare,
3121
+ compareLoose,
3122
+ compareBuild,
3123
+ sort,
3124
+ rsort,
3125
+ gt,
3126
+ lt,
3127
+ eq,
3128
+ neq,
3129
+ gte,
3130
+ lte,
3131
+ cmp,
3132
+ coerce,
3133
+ Comparator,
3134
+ Range,
3135
+ satisfies,
3136
+ toComparators,
3137
+ maxSatisfying,
3138
+ minSatisfying,
3139
+ minVersion,
3140
+ validRange,
3141
+ outside,
3142
+ gtr,
3143
+ ltr,
3144
+ intersects,
3145
+ simplifyRange,
3146
+ subset,
3147
+ SemVer,
3148
+ re: internalRe.re,
3149
+ src: internalRe.src,
3150
+ tokens: internalRe.t,
3151
+ SEMVER_SPEC_VERSION: constants.SEMVER_SPEC_VERSION,
3152
+ RELEASE_TYPES: constants.RELEASE_TYPES,
3153
+ compareIdentifiers: identifiers.compareIdentifiers,
3154
+ rcompareIdentifiers: identifiers.rcompareIdentifiers,
3155
+ };
3156
+ return semver$1;
416
3157
  }
417
3158
 
3159
+ var semverExports = requireSemver();
3160
+ var semver = /*@__PURE__*/getDefaultExportFromCjs(semverExports);
3161
+
3162
+ /**
3163
+ * 与 `plugin-web-starter`(WebPluginsResponse)返回的 `hostPluginApiVersion` 保持一致,用于契约校验。
3164
+ * @type {string}
3165
+ */
3166
+ const HOST_PLUGIN_API_VERSION = '1.0.0';
3167
+
418
3168
  /**
419
- * @param {string} url
420
- * @param {Set<string>} hostSet
3169
+ * 开发模式插件 URL 映射(显式 JSON + 隐式 dev 探测)。
3170
+ * @module runtime/dev-map
421
3171
  */
422
- function isScriptHostAllowed(url, hostSet) {
423
- if (typeof window === 'undefined') {
424
- return false
425
- }
426
- try {
427
- const u = new URL(url, window.location.origin);
428
- const h = normalizeHost(u.hostname);
429
- return hostSet.has(h)
430
- } catch {
431
- return false
432
- }
433
- }
434
3172
 
435
3173
  /**
436
- * @param {ReturnType<typeof resolveRuntimeOptions>} opts
3174
+ * @param {{ isDev: boolean, webPluginDevMapJson?: string|null }} opts
437
3175
  */
438
3176
  function parseWebPluginDevMapExplicit(opts) {
439
3177
  if (!opts.isDev) {
@@ -453,7 +3191,24 @@ function parseWebPluginDevMapExplicit(opts) {
453
3191
  }
454
3192
 
455
3193
  /**
456
- * @param {ReturnType<typeof resolveRuntimeOptions>} opts
3194
+ * @param {Record<string, string>} implicit
3195
+ * @param {Record<string, string>|null} explicit
3196
+ */
3197
+ function mergeDevMaps(implicit, explicit) {
3198
+ const i = implicit && typeof implicit === 'object' ? implicit : {};
3199
+ const e = explicit && typeof explicit === 'object' ? explicit : {};
3200
+ return { ...i, ...e }
3201
+ }
3202
+
3203
+ /**
3204
+ * @param {object} opts
3205
+ * @param {boolean} opts.isDev
3206
+ * @param {string|undefined|null} opts.webPluginDevOrigin
3207
+ * @param {string|undefined|null} opts.webPluginDevIds
3208
+ * @param {string[]} opts.defaultImplicitDevPluginIds
3209
+ * @param {string} opts.devPingPath
3210
+ * @param {number} opts.devPingTimeoutMs
3211
+ * @param {string} opts.webPluginDevEntryPath
457
3212
  * @param {Set<string>} hostSet
458
3213
  */
459
3214
  async function buildImplicitWebPluginDevMap(opts, hostSet) {
@@ -525,14 +3280,9 @@ async function buildImplicitWebPluginDevMap(opts, hostSet) {
525
3280
  }
526
3281
 
527
3282
  /**
528
- * @param {Record<string, string>} implicit
529
- * @param {Record<string, string>|null} explicit
3283
+ * 开发模式下插件热更新 SSE(按 dev 映射中的 origin 连接)。
3284
+ * @module runtime/dev-reload-sse
530
3285
  */
531
- function mergeDevMaps(implicit, explicit) {
532
- const i = implicit && typeof implicit === 'object' ? implicit : {};
533
- const e = explicit && typeof explicit === 'object' ? explicit : {};
534
- return { ...i, ...e }
535
- }
536
3286
 
537
3287
  /** @type {Map<string, EventSource>} */
538
3288
  const pluginDevEventSources = new Map();
@@ -629,8 +3379,17 @@ function startPluginDevSseForMap(devMap, isDev, hostSet, ssePath) {
629
3379
  }
630
3380
  }
631
3381
 
3382
+ /**
3383
+ * 动态加载脚本(去重与并发合并)。
3384
+ * @module runtime/load-script
3385
+ */
3386
+
632
3387
  const loadScriptMemo = new Map();
633
3388
 
3389
+ /**
3390
+ * @param {string} src
3391
+ * @returns {Promise<void>}
3392
+ */
634
3393
  function loadScript(src) {
635
3394
  if (typeof document === 'undefined') {
636
3395
  return Promise.reject(new Error('loadScript: no document'))
@@ -674,6 +3433,31 @@ function loadScript(src) {
674
3433
  return p
675
3434
  }
676
3435
 
3436
+ /**
3437
+ * 拉取清单、合并 dev 映射、加载入口并执行 activator。
3438
+ * @module runtime/bootstrap-plugins
3439
+ */
3440
+
3441
+ /**
3442
+ * @param {import('./resolve-runtime-options.js').WebExtendPluginRuntimeOptions|object} opts
3443
+ */
3444
+ function shouldShowBootstrapSummary(opts) {
3445
+ if (opts.bootstrapSummary === true) {
3446
+ return true
3447
+ }
3448
+ if (opts.bootstrapSummary === false) {
3449
+ return false
3450
+ }
3451
+ const env = resolveBundledEnv('VITE_PLUGINS_BOOTSTRAP_SUMMARY', '');
3452
+ if (env === '0' || env === 'false') {
3453
+ return false
3454
+ }
3455
+ if (env === '1' || env === 'true') {
3456
+ return true
3457
+ }
3458
+ return resolveBundledIsDev()
3459
+ }
3460
+
677
3461
  /**
678
3462
  * @param {{ id: string }} p
679
3463
  * @param {string} [entryUrl]
@@ -712,29 +3496,30 @@ async function loadPluginEntry(p, entryUrl, devMap, hostSet) {
712
3496
  /**
713
3497
  * @param {import('vue-router').default} router
714
3498
  * @param {(pluginId: string, router: import('vue-router').default, hostKit?: { bridgeAllowedPathPrefixes: string[] }) => object} createHostApiFactory
715
- * 始终传入三个参数;单参工厂 `(id) => createHostApi(id, router)` 仍可用,后两个实参被忽略。
716
- * @param {WebExtendPluginRuntimeOptions} [runtimeOptions]
3499
+ * @param {import('./resolve-runtime-options.js').WebExtendPluginRuntimeOptions} [runtimeOptions]
717
3500
  */
718
- async function bootstrapPlugins(router, createHostApiFactory, runtimeOptions) {
3501
+ async function bootstrapPlugins$1(router, createHostApiFactory, runtimeOptions) {
719
3502
  if (typeof window === 'undefined') {
720
3503
  console.warn('[plugins] bootstrapPlugins skipped: requires browser (window)');
721
3504
  return
722
3505
  }
723
- const opts = resolveRuntimeOptions(runtimeOptions || {});
3506
+ const opts = resolveRuntimeOptions$1(runtimeOptions || {});
724
3507
  const base = String(opts.manifestBase).replace(/\/$/, '');
725
3508
  const manifestUrl = `${base}${opts.manifestListPath}`;
726
3509
  const hostSet = buildAllowedScriptHostsSet(opts.allowedScriptHosts);
727
3510
  const explicit = parseWebPluginDevMapExplicit(opts);
728
3511
 
3512
+ const manifestCtx = {
3513
+ manifestUrl,
3514
+ credentials: opts.manifestFetchCredentials
3515
+ };
729
3516
  const [manifestResult, implicit] = await Promise.all([
730
3517
  (async () => {
731
3518
  try {
732
- const res = await fetch(manifestUrl, { credentials: opts.manifestFetchCredentials });
733
- if (!res.ok) {
734
- return { ok: false, status: res.status, data: null }
3519
+ if (typeof opts.fetchManifest === 'function') {
3520
+ return await opts.fetchManifest(manifestCtx)
735
3521
  }
736
- const data = await res.json();
737
- return { ok: true, data }
3522
+ return await defaultFetchWebPluginManifest$1(manifestCtx)
738
3523
  } catch (e) {
739
3524
  return { ok: false, error: e, data: null }
740
3525
  }
@@ -769,10 +3554,10 @@ async function bootstrapPlugins(router, createHostApiFactory, runtimeOptions) {
769
3554
 
770
3555
  const apiVer = data.hostPluginApiVersion;
771
3556
  if (apiVer) {
772
- const coerced = coerce(apiVer);
3557
+ const coerced = semver.coerce(apiVer);
773
3558
  const maj = coerced ? coerced.major : 0;
774
3559
  const range = `^${maj}.0.0`;
775
- if (!satisfies(HOST_PLUGIN_API_VERSION, range, { includePrerelease: true })) {
3560
+ if (!semver.satisfies(HOST_PLUGIN_API_VERSION, range, { includePrerelease: true })) {
776
3561
  console.warn(
777
3562
  '[plugins] host API version mismatch: host implements',
778
3563
  HOST_PLUGIN_API_VERSION,
@@ -804,7 +3589,7 @@ async function bootstrapPlugins(router, createHostApiFactory, runtimeOptions) {
804
3589
 
805
3590
  for (const p of plugins) {
806
3591
  const range = p.engines && p.engines.host;
807
- if (range && !satisfies(HOST_PLUGIN_API_VERSION, range, { includePrerelease: true })) {
3592
+ if (range && !semver.satisfies(HOST_PLUGIN_API_VERSION, range, { includePrerelease: true })) {
808
3593
  console.warn('[plugins] skip (engines.host)', p.id, range);
809
3594
  summary.skipEngines++;
810
3595
  continue
@@ -838,6 +3623,240 @@ async function bootstrapPlugins(router, createHostApiFactory, runtimeOptions) {
838
3623
  }
839
3624
  }
840
3625
 
3626
+ /**
3627
+ * 宿主侧插件引导:拉取清单、dev 映射、加载入口脚本、调用 activator。
3628
+ * 实现已拆至 `src/runtime/` 下各模块;本文件保留模块说明与对外类型约定,并 re-export 稳定 API。
3629
+ *
3630
+ * **Webpack 宿主**:用 `DefinePlugin` 注入 `process.env.VITE_*` 或 **`PLUGIN_*`**(等价键),或 `resolveRuntimeOptions` 显式传参。
3631
+ * **Vite 宿主**:入口调用 `setWebExtendPluginEnv(import.meta.env)`,或 `installWebExtendPluginVue2(..., { env: import.meta.env })`。
3632
+ *
3633
+ * @module PluginRuntime
3634
+ */
3635
+
3636
+ var pluginRuntime = /*#__PURE__*/Object.freeze({
3637
+ __proto__: null,
3638
+ bootstrapPlugins: bootstrapPlugins$1,
3639
+ defaultFetchWebPluginManifest: defaultFetchWebPluginManifest$1,
3640
+ resolveRuntimeOptions: resolveRuntimeOptions$1
3641
+ });
3642
+
3643
+ /**
3644
+ * 清单拉取函数的组合工具:缓存、埋点等以**中间件**形式扩展,不侵入 `bootstrapPlugins` 核心逻辑,
3645
+ * 符合第三方依赖「可组合、可替换」约定。契约与 `PluginRuntime` 中 `fetchManifest` 一致。
3646
+ *
3647
+ * @module runtime/manifest-fetch-composer
3648
+ */
3649
+
3650
+ /**
3651
+ * @typedef {object} FetchWebPluginManifestContext
3652
+ * @property {string} manifestUrl
3653
+ * @property {RequestCredentials} credentials
3654
+ */
3655
+
3656
+ /**
3657
+ * @typedef {object} FetchWebPluginManifestResult
3658
+ * @property {boolean} ok
3659
+ * @property {number} [status]
3660
+ * @property {{ hostPluginApiVersion?: string, plugins?: object[] }|null} [data]
3661
+ * @property {unknown} [error]
3662
+ */
3663
+
3664
+ /**
3665
+ * @callback FetchWebPluginManifestFn
3666
+ * @param {FetchWebPluginManifestContext} ctx
3667
+ * @returns {Promise<FetchWebPluginManifestResult>}
3668
+ */
3669
+
3670
+ /**
3671
+ * 将内层 `fetchManifest` 包装为带缓存的版本。等价于
3672
+ * `composeManifestFetch(inner, manifestFetchCacheMiddleware(options))`。
3673
+ *
3674
+ * @param {FetchWebPluginManifestFn} inner 内层实现(如预设生成的 `fetchManifest` 或 `defaultFetchWebPluginManifest`)
3675
+ * @param {ManifestFetchCacheOptions} [options]
3676
+ * @returns {FetchWebPluginManifestFn}
3677
+ */
3678
+ function wrapManifestFetchWithCache$1(inner, options = {}) {
3679
+ return composeManifestFetch$1(inner, manifestFetchCacheMiddleware$1(options))
3680
+ }
3681
+
3682
+ /**
3683
+ * @typedef {object} ManifestFetchCacheOptions
3684
+ * @property {number} [ttlMs] 缓存时长(毫秒)。`<= 0` 或未传时**不缓存**(直接透传 `inner`)。
3685
+ * @property {'memory'|'session'|'local'} [storage='memory'] `session`/`local` 依赖 `JSON.stringify`,仅适合可序列化的 `data`。
3686
+ * @property {string} [storageKeyPrefix='wep.manifestFetch.v1'] Web Storage 键前缀(仅 storage 非 memory 时生效)。
3687
+ * @property {(ctx: FetchWebPluginManifestContext) => string} [cacheKey] 默认 `manifestUrl + '\0' + credentials`。
3688
+ * @property {(result: FetchWebPluginManifestResult) => boolean} [shouldCache] 默认:`ok === true` 且 `data` 非空。
3689
+ * @property {number} [maxEntries=50] 仅 `memory`:超过条数时淘汰最久未读条目。
3690
+ * @property {() => number} [now] 测试注入时间戳。
3691
+ */
3692
+
3693
+ /**
3694
+ * 清单拉取**中间件工厂**:`next` 为内层 `fetchManifest`。
3695
+ *
3696
+ * @param {ManifestFetchCacheOptions} options
3697
+ * @returns {(next: FetchWebPluginManifestFn) => FetchWebPluginManifestFn}
3698
+ */
3699
+ function manifestFetchCacheMiddleware$1(options = {}) {
3700
+ const ttlMs = typeof options.ttlMs === 'number' && Number.isFinite(options.ttlMs) ? options.ttlMs : 0;
3701
+ if (ttlMs <= 0) {
3702
+ return (next) => next
3703
+ }
3704
+
3705
+ const storage = options.storage || 'memory';
3706
+ const prefix = options.storageKeyPrefix || 'wep.manifestFetch.v1';
3707
+ const maxEntries = typeof options.maxEntries === 'number' && options.maxEntries > 0 ? options.maxEntries : 50;
3708
+ const getNow = typeof options.now === 'function' ? options.now : () => Date.now();
3709
+ const cacheKeyFn =
3710
+ typeof options.cacheKey === 'function'
3711
+ ? options.cacheKey
3712
+ : (ctx) => `${String(ctx.manifestUrl)}\0${String(ctx.credentials)}`;
3713
+
3714
+ const shouldCache =
3715
+ typeof options.shouldCache === 'function'
3716
+ ? options.shouldCache
3717
+ : (r) => !!(r && r.ok === true && r.data != null);
3718
+
3719
+ /** @type {Map<string, { expiresAt: number, result: FetchWebPluginManifestResult, lastRead: number }>} */
3720
+ const memory = new Map();
3721
+
3722
+ function cloneResult(r) {
3723
+ try {
3724
+ if (typeof structuredClone === 'function') {
3725
+ return structuredClone(r)
3726
+ }
3727
+ } catch (_) {}
3728
+ try {
3729
+ return JSON.parse(JSON.stringify(r))
3730
+ } catch (_) {
3731
+ return { ...r, data: r.data }
3732
+ }
3733
+ }
3734
+
3735
+ function touchMemory(key) {
3736
+ const e = memory.get(key);
3737
+ if (e) {
3738
+ e.lastRead = getNow();
3739
+ }
3740
+ }
3741
+
3742
+ function pruneMemory() {
3743
+ if (memory.size <= maxEntries) {
3744
+ return
3745
+ }
3746
+ const entries = [...memory.entries()].sort((a, b) => a[1].lastRead - b[1].lastRead);
3747
+ const drop = memory.size - maxEntries;
3748
+ for (let i = 0; i < drop; i++) {
3749
+ memory.delete(entries[i][0]);
3750
+ }
3751
+ }
3752
+
3753
+ function readWebStorage(store, key) {
3754
+ try {
3755
+ const raw = store.getItem(key);
3756
+ if (!raw) {
3757
+ return null
3758
+ }
3759
+ const o = JSON.parse(raw);
3760
+ if (!o || typeof o !== 'object') {
3761
+ return null
3762
+ }
3763
+ const exp = o.expiresAt;
3764
+ const res = o.result;
3765
+ if (typeof exp !== 'number' || getNow() > exp) {
3766
+ store.removeItem(key);
3767
+ return null
3768
+ }
3769
+ return /** @type {FetchWebPluginManifestResult} */ (res)
3770
+ } catch (_) {
3771
+ return null
3772
+ }
3773
+ }
3774
+
3775
+ function writeWebStorage(store, key, result, expiresAt) {
3776
+ try {
3777
+ store.setItem(key, JSON.stringify({ expiresAt, result }));
3778
+ } catch (_) {
3779
+ /* Quota / 不可序列化 */
3780
+ }
3781
+ }
3782
+
3783
+ return (next) => {
3784
+ return async (ctx) => {
3785
+ const key = cacheKeyFn(ctx);
3786
+ const now = getNow();
3787
+
3788
+ if (storage === 'memory') {
3789
+ const hit = memory.get(key);
3790
+ if (hit && hit.expiresAt > now) {
3791
+ touchMemory(key);
3792
+ return cloneResult(hit.result)
3793
+ }
3794
+ } else if (storage === 'session' && typeof sessionStorage !== 'undefined') {
3795
+ const sk = `${prefix}:${key}`;
3796
+ const hit = readWebStorage(sessionStorage, sk);
3797
+ if (hit) {
3798
+ return cloneResult(hit)
3799
+ }
3800
+ } else if (storage === 'local' && typeof localStorage !== 'undefined') {
3801
+ const sk = `${prefix}:${key}`;
3802
+ const hit = readWebStorage(localStorage, sk);
3803
+ if (hit) {
3804
+ return cloneResult(hit)
3805
+ }
3806
+ }
3807
+
3808
+ const result = await next(ctx);
3809
+
3810
+ if (!shouldCache(result)) {
3811
+ return result
3812
+ }
3813
+
3814
+ const expiresAt = now + ttlMs;
3815
+ const frozen = cloneResult(result);
3816
+
3817
+ if (storage === 'memory') {
3818
+ memory.set(key, { expiresAt, result: frozen, lastRead: now });
3819
+ pruneMemory();
3820
+ } else if (storage === 'session' && typeof sessionStorage !== 'undefined') {
3821
+ writeWebStorage(sessionStorage, `${prefix}:${key}`, frozen, expiresAt);
3822
+ } else if (storage === 'local' && typeof localStorage !== 'undefined') {
3823
+ writeWebStorage(localStorage, `${prefix}:${key}`, frozen, expiresAt);
3824
+ }
3825
+
3826
+ return result
3827
+ }
3828
+ }
3829
+ }
3830
+
3831
+ /**
3832
+ * 自右向左组合中间件(与 Koa/Redux 习惯一致:`compose(f,g,h)(inner)` = f(g(h(inner))))。
3833
+ *
3834
+ * @param {FetchWebPluginManifestFn} inner 最内层拉取实现
3835
+ * @param {...function(FetchWebPluginManifestFn): FetchWebPluginManifestFn} middlewares 每个元素签名 `(next) => async (ctx) => result`
3836
+ * @returns {FetchWebPluginManifestFn}
3837
+ */
3838
+ function composeManifestFetch$1(inner, ...middlewares) {
3839
+ if (typeof inner !== 'function') {
3840
+ throw new Error('[web-extend-plugin-vue2] composeManifestFetch 需要 inner 为函数')
3841
+ }
3842
+ let f = inner;
3843
+ for (let i = middlewares.length - 1; i >= 0; i--) {
3844
+ const mw = middlewares[i];
3845
+ if (typeof mw !== 'function') {
3846
+ throw new Error('[web-extend-plugin-vue2] composeManifestFetch 中间件须为函数')
3847
+ }
3848
+ f = mw(f);
3849
+ }
3850
+ return f
3851
+ }
3852
+
3853
+ var manifestComposer = /*#__PURE__*/Object.freeze({
3854
+ __proto__: null,
3855
+ composeManifestFetch: composeManifestFetch$1,
3856
+ manifestFetchCacheMiddleware: manifestFetchCacheMiddleware$1,
3857
+ wrapManifestFetchWithCache: wrapManifestFetchWithCache$1
3858
+ });
3859
+
841
3860
  /**
842
3861
  * 插件通过宿主访问后端的受控通道:仅允许配置的前缀路径,默认 `/api/`;强制默认 `same-origin` 携带 Cookie。
843
3862
  * 前缀列表由 `createRequestBridge({ allowedPathPrefixes })` 传入,与 `defaultWebExtendPluginRuntime.bridgeAllowedPathPrefixes` 对齐。
@@ -845,17 +3864,6 @@ async function bootstrapPlugins(router, createHostApiFactory, runtimeOptions) {
845
3864
  * @module bridge
846
3865
  */
847
3866
 
848
- /**
849
- * @param {string} p
850
- */
851
- function ensureLeadingSlash(p) {
852
- const t = String(p || '').trim();
853
- if (!t) {
854
- return '/'
855
- }
856
- return t.startsWith('/') ? t : `/${t}`
857
- }
858
-
859
3867
  /**
860
3868
  * @param {{ allowedPathPrefixes?: string[] }} [config]
861
3869
  */
@@ -864,7 +3872,7 @@ function createRequestBridge(config = {}) {
864
3872
  Array.isArray(config.allowedPathPrefixes) && config.allowedPathPrefixes.length > 0
865
3873
  ? config.allowedPathPrefixes
866
3874
  : defaultWebExtendPluginRuntime.bridgeAllowedPathPrefixes;
867
- const allowedPathPrefixes = raw.map((p) => ensureLeadingSlash(p));
3875
+ const allowedPathPrefixes = raw.map((p) => ensureLeadingPath(p));
868
3876
 
869
3877
  return {
870
3878
  /**
@@ -1070,7 +4078,9 @@ function createHostApi(pluginId, router, hostKitOptions = {}) {
1070
4078
  for (const item of items) {
1071
4079
  registries.menus.push({ ...item, pluginId });
1072
4080
  }
1073
- registries.menus.sort((a, b) => (a.order ?? 0) - (b.order ?? 0));
4081
+ registries.menus.sort(
4082
+ (a, b) => (a.order != null ? a.order : 0) - (b.order != null ? b.order : 0)
4083
+ );
1074
4084
  },
1075
4085
 
1076
4086
  /**
@@ -1090,7 +4100,7 @@ function createHostApi(pluginId, router, hostKitOptions = {}) {
1090
4100
  list.push({
1091
4101
  pluginId,
1092
4102
  component: c.component,
1093
- priority: c.priority ?? 0,
4103
+ priority: c.priority != null ? c.priority : 0,
1094
4104
  key: `${pluginId}-${pointId}-${++slotItemKeySeq}`
1095
4105
  });
1096
4106
  }
@@ -1283,9 +4293,215 @@ function installWebExtendPluginVue2(Vue, router, options) {
1283
4293
  if (Vue && ExtensionPoint) {
1284
4294
  Vue.component('ExtensionPoint', ExtensionPoint);
1285
4295
  }
1286
- const runtime = resolveRuntimeOptions(runtimeUser);
1287
- return bootstrapPlugins(router, (id, r, kit) => createHostApi(id, r, kit), runtime)
4296
+ const runtime = resolveRuntimeOptions$1(runtimeUser);
4297
+ return bootstrapPlugins$1(router, (id, r, kit) => createHostApi(id, r, kit), runtime)
4298
+ }
4299
+
4300
+ /**
4301
+ * 预设:Vue CLI + 统一 axios(如若依 `utils/request`)。
4302
+ * 对外以 {@link presetVueCliAxios} 聚合;亦保留具名函数便于 tree-shaking。
4303
+ *
4304
+ * @module presets/vue-cli-axios
4305
+ */
4306
+
4307
+ /**
4308
+ * @typedef {object} VueCliAxiosInstallPresetDeps
4309
+ * @property {(config: { url: string, method?: string, [key: string]: unknown }) => Promise<unknown>} request 宿主 axios 封装(已含 baseURL、Token 等)
4310
+ */
4311
+
4312
+ /**
4313
+ * 将 `manifestBase + manifestListPath` 转为相对 `VUE_APP_BASE_API` 的路径(供 axios baseURL 拼接)。
4314
+ * @param {string} manifestUrl
4315
+ * @param {string} [apiBase]
4316
+ */
4317
+ function manifestPathForVueCliApiBase(manifestUrl, apiBase) {
4318
+ const base = String(
4319
+ apiBase !== undefined
4320
+ ? apiBase
4321
+ : (typeof process !== 'undefined' && process.env && process.env.VUE_APP_BASE_API) || ''
4322
+ ).replace(/\/$/, '');
4323
+ if (typeof window === 'undefined') {
4324
+ return '/api/frontend-plugins'
4325
+ }
4326
+ const u = new URL(manifestUrl, window.location.origin);
4327
+ let path = u.pathname + u.search;
4328
+ if (base && path.startsWith(base)) {
4329
+ path = path.slice(base.length) || '/';
4330
+ }
4331
+ return path
4332
+ }
4333
+
4334
+ /**
4335
+ * 兼容裸清单 JSON 与常见 `{ code, data: { plugins } }` 包装。
4336
+ * @param {unknown} body
4337
+ * @returns {object|null}
4338
+ */
4339
+ function unwrapTableStyleManifestBody(body) {
4340
+ if (!body || typeof body !== 'object') {
4341
+ return null
4342
+ }
4343
+ const o = /** @type {Record<string, unknown>} */ (body);
4344
+ if (Array.isArray(o.plugins)) {
4345
+ return o
4346
+ }
4347
+ const d = o.data;
4348
+ if (d && typeof d === 'object') {
4349
+ const inner = /** @type {Record<string, unknown>} */ (d);
4350
+ if (Array.isArray(inner.plugins)) {
4351
+ return inner
4352
+ }
4353
+ if ('plugins' in inner) {
4354
+ return inner
4355
+ }
4356
+ }
4357
+ return d !== undefined && d !== null && typeof d === 'object' ? /** @type {object} */ (d) : o
4358
+ }
4359
+
4360
+ function bridgePrefixesFromVueCliEnv() {
4361
+ const base = (
4362
+ typeof process !== 'undefined' && process.env && process.env.VUE_APP_BASE_API
4363
+ ? String(process.env.VUE_APP_BASE_API)
4364
+ : ''
4365
+ ).replace(/\/$/, '');
4366
+ const raw = [base ? `${base}/` : '', '/api/', '/dev-api/'].filter(Boolean);
4367
+ return [...new Set(raw)]
4368
+ }
4369
+
4370
+ /**
4371
+ * 生成可直接传给 `installWebExtendPluginVue2` 的 options(含 fetchManifest、manifestBase、bridge 前缀)。
4372
+ * @param {VueCliAxiosInstallPresetDeps} deps
4373
+ * @param {Record<string, unknown>} [extra] 合并覆盖,如 `manifestListPath`、`env` 等
4374
+ * @returns {Record<string, unknown>}
4375
+ */
4376
+ function createVueCliAxiosInstallOptions(deps, extra = {}) {
4377
+ const { request } = deps;
4378
+ if (typeof request !== 'function') {
4379
+ throw new Error('[web-extend-plugin-vue2] createVueCliAxiosInstallOptions({ request }) 需要宿主 request 函数')
4380
+ }
4381
+ const envBase = (
4382
+ typeof process !== 'undefined' && process.env && process.env.VUE_APP_BASE_API
4383
+ ? String(process.env.VUE_APP_BASE_API)
4384
+ : ''
4385
+ ).replace(/\/$/, '');
4386
+ const userBase =
4387
+ extra.manifestBase !== undefined && String(extra.manifestBase).trim() !== ''
4388
+ ? String(extra.manifestBase).replace(/\/$/, '')
4389
+ : '';
4390
+ const stripBase = userBase || envBase;
4391
+
4392
+ const fetchManifest = async (ctx) => {
4393
+ try {
4394
+ const url = manifestPathForVueCliApiBase(ctx.manifestUrl, stripBase);
4395
+ const body = await request({
4396
+ url,
4397
+ method: 'get'
4398
+ });
4399
+ const data = unwrapTableStyleManifestBody(body);
4400
+ if (!data || typeof data !== 'object') {
4401
+ return {
4402
+ ok: false,
4403
+ error: new Error('[web-plugin] 清单响应格式无效'),
4404
+ data: null
4405
+ }
4406
+ }
4407
+ return { ok: true, data }
4408
+ } catch (e) {
4409
+ return { ok: false, error: e, data: null }
4410
+ }
4411
+ };
4412
+
4413
+ const opts = {
4414
+ manifestBase: stripBase || undefined,
4415
+ bridgeAllowedPathPrefixes: bridgePrefixesFromVueCliEnv(),
4416
+ fetchManifest,
4417
+ ...extra
4418
+ };
4419
+
4420
+ const listPath =
4421
+ typeof process !== 'undefined' && process.env && process.env.VUE_APP_WEB_PLUGIN_MANIFEST_PATH;
4422
+ if (listPath && opts.manifestListPath === undefined && extra.manifestListPath === undefined) {
4423
+ opts.manifestListPath = String(listPath);
4424
+ }
4425
+
4426
+ return opts
1288
4427
  }
1289
4428
 
1290
- export { ExtensionPoint, HOST_PLUGIN_API_VERSION, bootstrapPlugins, createHostApi, createRequestBridge, defaultWebExtendPluginRuntime, disposeWebPlugin, installWebExtendPluginVue2, registries, resolveRuntimeOptions, setWebExtendPluginEnv };
4429
+ /**
4430
+ * Vue CLI + axios 预设的**对外聚合入口**(与具名导出函数等价,便于按需查阅与扩展多预设)。
4431
+ * @type {Readonly<{ id: string, description: string, createInstallOptions: typeof createVueCliAxiosInstallOptions, manifestPathForApiBase: typeof manifestPathForVueCliApiBase, unwrapManifestBody: typeof unwrapTableStyleManifestBody }>}
4432
+ */
4433
+ const presetVueCliAxios = Object.freeze({
4434
+ id: 'vue-cli-axios',
4435
+ description: 'Vue CLI + 统一 axios 实例(如若依 utils/request),清单走宿主 request',
4436
+ createInstallOptions: createVueCliAxiosInstallOptions,
4437
+ manifestPathForApiBase: manifestPathForVueCliApiBase,
4438
+ unwrapManifestBody: unwrapTableStyleManifestBody
4439
+ });
4440
+
4441
+ /**
4442
+ * 稳定对外 API:具名导出 + {@link WebExtendPluginVue2} 聚合对象。
4443
+ * 语义化版本内保持本文件导出的符号与聚合结构兼容。
4444
+ *
4445
+ * `PluginRuntime` 与 `manifest-fetch-composer` 通过 namespace 绑定到 `WebExtendPluginVue2.runtime`,避免具名导出与聚合对象重复列举。
4446
+ *
4447
+ * @module public
4448
+ */
4449
+
4450
+
4451
+ const {
4452
+ bootstrapPlugins,
4453
+ defaultFetchWebPluginManifest,
4454
+ resolveRuntimeOptions
4455
+ } = pluginRuntime;
4456
+
4457
+ const {
4458
+ composeManifestFetch,
4459
+ manifestFetchCacheMiddleware,
4460
+ wrapManifestFetchWithCache
4461
+ } = manifestComposer;
4462
+
4463
+ /**
4464
+ * 根命名空间:宿主可通过 `WebExtendPluginVue2.presets.vueCliAxios` 等路径发现能力,避免仅依赖散落的具名导出。
4465
+ * @type {Readonly<{
4466
+ * install: typeof installWebExtendPluginVue2,
4467
+ * runtime: Readonly<{ bootstrapPlugins: typeof pluginRuntime.bootstrapPlugins, resolveRuntimeOptions: typeof pluginRuntime.resolveRuntimeOptions, defaultFetchWebPluginManifest: typeof pluginRuntime.defaultFetchWebPluginManifest, composeManifestFetch: typeof manifestComposer.composeManifestFetch, manifestFetchCacheMiddleware: typeof manifestComposer.manifestFetchCacheMiddleware, wrapManifestFetchWithCache: typeof manifestComposer.wrapManifestFetchWithCache }>,
4468
+ * host: Readonly<{ createHostApi: typeof createHostApi, disposeWebPlugin: typeof disposeWebPlugin, createRequestBridge: typeof createRequestBridge, registries: typeof registries }>,
4469
+ * config: Readonly<{ defaultWebExtendPluginRuntime: typeof defaultWebExtendPluginRuntime, setWebExtendPluginEnv: typeof setWebExtendPluginEnv }>,
4470
+ * constants: Readonly<{ HOST_PLUGIN_API_VERSION: typeof HOST_PLUGIN_API_VERSION }>,
4471
+ * components: Readonly<{ ExtensionPoint: typeof ExtensionPoint }>,
4472
+ * presets: Readonly<{ vueCliAxios: typeof presetVueCliAxios }>
4473
+ * }>}
4474
+ */
4475
+ const WebExtendPluginVue2 = Object.freeze({
4476
+ install: installWebExtendPluginVue2,
4477
+ runtime: Object.freeze({
4478
+ bootstrapPlugins: bootstrapPlugins$1,
4479
+ resolveRuntimeOptions: resolveRuntimeOptions$1,
4480
+ defaultFetchWebPluginManifest: defaultFetchWebPluginManifest$1,
4481
+ composeManifestFetch: composeManifestFetch$1,
4482
+ manifestFetchCacheMiddleware: manifestFetchCacheMiddleware$1,
4483
+ wrapManifestFetchWithCache: wrapManifestFetchWithCache$1
4484
+ }),
4485
+ host: Object.freeze({
4486
+ createHostApi,
4487
+ disposeWebPlugin,
4488
+ createRequestBridge,
4489
+ registries
4490
+ }),
4491
+ config: Object.freeze({
4492
+ defaultWebExtendPluginRuntime,
4493
+ setWebExtendPluginEnv
4494
+ }),
4495
+ constants: Object.freeze({
4496
+ HOST_PLUGIN_API_VERSION
4497
+ }),
4498
+ components: Object.freeze({
4499
+ ExtensionPoint
4500
+ }),
4501
+ presets: Object.freeze({
4502
+ vueCliAxios: presetVueCliAxios
4503
+ })
4504
+ });
4505
+
4506
+ export { ExtensionPoint, HOST_PLUGIN_API_VERSION, WebExtendPluginVue2, bootstrapPlugins, composeManifestFetch, createHostApi, createRequestBridge, createVueCliAxiosInstallOptions, defaultFetchWebPluginManifest, defaultWebExtendPluginRuntime, disposeWebPlugin, installWebExtendPluginVue2, manifestFetchCacheMiddleware, manifestPathForVueCliApiBase, presetVueCliAxios, registries, resolveRuntimeOptions, setWebExtendPluginEnv, unwrapTableStyleManifestBody, wrapManifestFetchWithCache };
1291
4507
  //# sourceMappingURL=index.mjs.map