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