@heybox/hb-sdk 0.9.1-alpha.8 → 0.9.1

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.
Files changed (43) hide show
  1. package/CHANGELOG.md +123 -17
  2. package/README.md +18 -17
  3. package/dist/cli-chunks/_commonjs-dynamic-modules-DUamuDzp.cjs +7 -0
  4. package/dist/cli-chunks/browser-RAy8e8cV.cjs +635 -0
  5. package/dist/cli-chunks/{build-CQkpLf81.cjs → build-DCp9C9V4.cjs} +10 -14
  6. package/dist/cli-chunks/{context-CqJDNtEi.cjs → context-Bg6C5ow7.cjs} +10 -5
  7. package/dist/cli-chunks/{create-BRuR2M7y.cjs → create-D5bX2Xvw.cjs} +7 -12
  8. package/dist/cli-chunks/{dev-KJAFHEg_.cjs → dev-CFjwhG3q.cjs} +195 -82
  9. package/dist/cli-chunks/{doctor-DhiUViwk.cjs → doctor-CMz_Kf7-.cjs} +9 -13
  10. package/dist/cli-chunks/{index-9trmrUtW.cjs → index-B_KKGIBN.cjs} +13591 -10542
  11. package/dist/cli-chunks/{index-rxAV5dza.cjs → index-YnVa6S_p.cjs} +9 -10
  12. package/dist/cli-chunks/{index.esm-Cv9FlhXy.cjs → index.esm-CgZPnqEA.cjs} +43 -43
  13. package/dist/cli-chunks/{login-5DEcU9eL.cjs → login-Df_v6jNs.cjs} +13 -12
  14. package/dist/cli-chunks/{project-vite-CXWFwbEz.cjs → project-vite-By8cnIwP.cjs} +1 -1
  15. package/dist/cli-chunks/{remote-laUZaGpI.cjs → remote-ClIJz-e2.cjs} +42 -71
  16. package/dist/cli-chunks/{runtime-gate-DmJhPcNQ.cjs → runtime-gate-DKiyNwX2.cjs} +9 -13
  17. package/dist/cli-chunks/{runtime-permission-env-Gy2dH17F.cjs → runtime-permission-env-BNQ2fx4w.cjs} +82 -2794
  18. package/dist/cli-chunks/{skill--mZIZkyn.cjs → skill-Bk-EBSbJ.cjs} +10 -14
  19. package/dist/cli-chunks/{version-BMp9qmtC.cjs → version-CG_VNZGM.cjs} +1 -1
  20. package/dist/cli.cjs +11 -16
  21. package/dist/devtools/browser-dev-host/assets/browser-dev-host-C1g2tadT.js +102 -0
  22. package/dist/devtools/browser-dev-host/assets/{desktop-app-launch-BU-vzcs0.js → desktop-app-launch-sH2a_jbj.js} +1 -1
  23. package/dist/devtools/browser-dev-host/assets/{index-BRxbUJVN.css → index-7Cq8iNcD.css} +1 -1
  24. package/dist/devtools/browser-dev-host/assets/{index-BZBZfB4t.js → index-Bpxbe1lP.js} +4 -4
  25. package/dist/devtools/browser-dev-host/index.html +3 -3
  26. package/dist/index.cjs.js +16 -8
  27. package/dist/index.esm.js +16 -8
  28. package/dist/miniapp-publish.cjs.js +27 -0
  29. package/dist/miniapp-publish.esm.js +27 -0
  30. package/dist/protocol.cjs.js +1 -1
  31. package/dist/protocol.esm.js +1 -1
  32. package/dist/vite.cjs.js +36 -1
  33. package/dist/vite.esm.js +36 -1
  34. package/docs/runtime-host-migration.md +4 -2
  35. package/package.json +6 -5
  36. package/skill/SKILL.md +10 -0
  37. package/skill/skill.json +5 -5
  38. package/types/index.d.ts +124 -94
  39. package/types/miniapp-publish/index.d.ts +3 -0
  40. package/types/protocol.d.ts +47 -39
  41. package/types/vite/index.d.ts +1 -0
  42. package/dist/cli-chunks/browser-YVckob3g.cjs +0 -15
  43. package/dist/devtools/browser-dev-host/assets/browser-dev-host-COdk-39n.js +0 -102
@@ -1,8 +1,9 @@
1
1
  'use strict';
2
2
 
3
+ var index = require('./index-B_KKGIBN.cjs');
3
4
  var fs = require('node:fs');
4
5
  var path = require('node:path');
5
- var version$1 = require('./version-BMp9qmtC.cjs');
6
+ var version$1 = require('./version-CG_VNZGM.cjs');
6
7
  require('node:crypto');
7
8
  var node_async_hooks = require('node:async_hooks');
8
9
 
@@ -296,7 +297,7 @@ function isManagedMiniProgramRuntimePermissionKey(key) {
296
297
  * `requirement`:`kind: 'none'` 不读取权限;`kind: 'all'` 要求列出的每个 canonical entry 都存在
297
298
  * 且 `status === 'enabled'`。之后仍需通过 Host capability、可信手势、用户授权、参数和业务
298
299
  * policy。当前 Runtime 对 `valid: false` 按空权限表 fail closed,受保护 method 会得到
299
- * `PERMISSION_NOT_DECLARED`,而不是沿用输入中的部分 enabled entry。
300
+ * `PERMISSION_NOT_IN_SNAPSHOT`,而不是沿用输入中的部分 enabled entry。
300
301
  *
301
302
  * @example
302
303
  * ```ts
@@ -446,7 +447,7 @@ function createMiniProgramLocalDevGrant(options) {
446
447
  return { schema_version: 1, revision: options.revision, entries };
447
448
  }
448
449
  /**
449
- * 线上基线先与本地声明求交,再补齐临时权限,返回与输入脱离的普通 Runtime 快照。
450
+ * 声明型权限由本地声明生成;审批型权限先与平台基线求交,再补齐临时授权。
450
451
  * 调用方只可在当前 Dev Session 已验证且用户接受后传入 grant;本函数不证明其可信来源。
451
452
  * 非法 grant 整体降权到基线,已批准配置不会被临时配置覆盖。
452
453
  */
@@ -458,6 +459,9 @@ function composeLocalDevRuntimePermissions(options) {
458
459
  if (options.declaredPermissions[key]?.enabled !== true) {
459
460
  delete permissions[key];
460
461
  }
462
+ else if (MINI_PROGRAM_PERMISSION_CATALOG.some(definition => definition.key === key && definition.access === 'declaration')) {
463
+ permissions[key] = { key, status: 'enabled', config: {} };
464
+ }
461
465
  else if (key === 'network' && permissions.network) {
462
466
  permissions.network.config.useOfficialDomain = permissions.network.status === 'enabled'
463
467
  && permissions.network.config.useOfficialDomain === true
@@ -6903,6 +6907,47 @@ function validateWorkspaceCardReceiptV2(raw, controller) {
6903
6907
  fail('v2 asset path 非法');
6904
6908
  }
6905
6909
 
6910
+ /** 固定序列化顺序,供 CLI 与 Host 对同一份开发描述计算摘要。 */
6911
+ function serializeMiniProgramDevelopmentSnapshot(snapshot) {
6912
+ if (snapshot.schema_version !== 1 ||
6913
+ !/^[a-f0-9]{32}$/.test(snapshot.session_id) ||
6914
+ !Number.isSafeInteger(snapshot.revision) ||
6915
+ snapshot.revision < 1 ||
6916
+ !/^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?(?:\+[0-9A-Za-z.-]+)?$/.test(snapshot.sdk_version) ||
6917
+ !snapshot.declared_permissions ||
6918
+ typeof snapshot.declared_permissions !== 'object' ||
6919
+ Array.isArray(snapshot.declared_permissions) ||
6920
+ !Array.isArray(snapshot.platforms) ||
6921
+ snapshot.platforms.some((platform) => !['android', 'ios', 'ohos', 'windows', 'macos', 'linux'].includes(platform)) ||
6922
+ new Set(snapshot.platforms).size !== snapshot.platforms.length)
6923
+ throw new Error('开发快照无效');
6924
+ const declared_permissions = {};
6925
+ for (const key of MINI_PROGRAM_PERMISSION_KEYS) {
6926
+ const declaration = snapshot.declared_permissions[key];
6927
+ if (!declaration)
6928
+ continue;
6929
+ if (typeof declaration.enabled !== 'boolean')
6930
+ throw new Error('开发权限声明无效');
6931
+ declared_permissions[key] =
6932
+ key === 'network'
6933
+ ? { enabled: declaration.enabled, useOfficialDomain: declaration.useOfficialDomain === true }
6934
+ : { enabled: declaration.enabled };
6935
+ }
6936
+ if (Object.keys(snapshot.declared_permissions).some((key) => !MINI_PROGRAM_PERMISSION_KEYS.includes(key)))
6937
+ throw new Error('开发权限声明无效');
6938
+ if (snapshot.companion_manifest_sha256 !== undefined && !/^[a-f0-9]{64}$/.test(snapshot.companion_manifest_sha256))
6939
+ throw new Error('开发产物摘要无效');
6940
+ return JSON.stringify({
6941
+ schema_version: 1,
6942
+ session_id: snapshot.session_id,
6943
+ revision: snapshot.revision,
6944
+ sdk_version: snapshot.sdk_version,
6945
+ declared_permissions,
6946
+ platforms: [...snapshot.platforms].sort(),
6947
+ ...(snapshot.companion_manifest_sha256 ? { companion_manifest_sha256: snapshot.companion_manifest_sha256 } : {}),
6948
+ });
6949
+ }
6950
+
6906
6951
  /**
6907
6952
  * 校验项目配置或产物中的小程序类别。
6908
6953
  *
@@ -6919,2791 +6964,6 @@ function parseMiniappCategory(value, sourceLabel = 'package.json#heybox.category
6919
6964
  throw new Error(`${sourceLabel} 必须是 tool、game 或 other`);
6920
6965
  }
6921
6966
 
6922
- var re = {exports: {}};
6923
-
6924
- var constants;
6925
- var hasRequiredConstants;
6926
-
6927
- function requireConstants () {
6928
- if (hasRequiredConstants) return constants;
6929
- hasRequiredConstants = 1;
6930
-
6931
- // Note: this is the semver.org version of the spec that it implements
6932
- // Not necessarily the package version of this code.
6933
- const SEMVER_SPEC_VERSION = '2.0.0';
6934
-
6935
- const MAX_LENGTH = 256;
6936
- const MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER ||
6937
- /* istanbul ignore next */ 9007199254740991;
6938
-
6939
- // Max safe segment length for coercion.
6940
- const MAX_SAFE_COMPONENT_LENGTH = 16;
6941
-
6942
- // Max safe length for a build identifier. The max length minus 6 characters for
6943
- // the shortest version with a build 0.0.0+BUILD.
6944
- const MAX_SAFE_BUILD_LENGTH = MAX_LENGTH - 6;
6945
-
6946
- const RELEASE_TYPES = [
6947
- 'major',
6948
- 'premajor',
6949
- 'minor',
6950
- 'preminor',
6951
- 'patch',
6952
- 'prepatch',
6953
- 'prerelease',
6954
- ];
6955
-
6956
- constants = {
6957
- MAX_LENGTH,
6958
- MAX_SAFE_COMPONENT_LENGTH,
6959
- MAX_SAFE_BUILD_LENGTH,
6960
- MAX_SAFE_INTEGER,
6961
- RELEASE_TYPES,
6962
- SEMVER_SPEC_VERSION,
6963
- FLAG_INCLUDE_PRERELEASE: 0b001,
6964
- FLAG_LOOSE: 0b010,
6965
- };
6966
- return constants;
6967
- }
6968
-
6969
- var debug_1;
6970
- var hasRequiredDebug;
6971
-
6972
- function requireDebug () {
6973
- if (hasRequiredDebug) return debug_1;
6974
- hasRequiredDebug = 1;
6975
-
6976
- const debug = (
6977
- typeof process === 'object' &&
6978
- process.env &&
6979
- process.env.NODE_DEBUG &&
6980
- /\bsemver\b/i.test(process.env.NODE_DEBUG)
6981
- ) ? (...args) => console.error('SEMVER', ...args)
6982
- : () => {};
6983
-
6984
- debug_1 = debug;
6985
- return debug_1;
6986
- }
6987
-
6988
- var hasRequiredRe;
6989
-
6990
- function requireRe () {
6991
- if (hasRequiredRe) return re.exports;
6992
- hasRequiredRe = 1;
6993
- (function (module, exports) {
6994
-
6995
- const {
6996
- MAX_SAFE_COMPONENT_LENGTH,
6997
- MAX_SAFE_BUILD_LENGTH,
6998
- MAX_LENGTH,
6999
- } = requireConstants();
7000
- const debug = requireDebug();
7001
- exports = module.exports = {};
7002
-
7003
- // The actual regexps go on exports.re
7004
- const re = exports.re = [];
7005
- const safeRe = exports.safeRe = [];
7006
- const src = exports.src = [];
7007
- const safeSrc = exports.safeSrc = [];
7008
- const t = exports.t = {};
7009
- let R = 0;
7010
-
7011
- const LETTERDASHNUMBER = '[a-zA-Z0-9-]';
7012
-
7013
- // Replace some greedy regex tokens to prevent regex dos issues. These regex are
7014
- // used internally via the safeRe object since all inputs in this library get
7015
- // normalized first to trim and collapse all extra whitespace. The original
7016
- // regexes are exported for userland consumption and lower level usage. A
7017
- // future breaking change could export the safer regex only with a note that
7018
- // all input should have extra whitespace removed.
7019
- const safeRegexReplacements = [
7020
- ['\\s', 1],
7021
- ['\\d', MAX_LENGTH],
7022
- [LETTERDASHNUMBER, MAX_SAFE_BUILD_LENGTH],
7023
- ];
7024
-
7025
- const makeSafeRegex = (value) => {
7026
- for (const [token, max] of safeRegexReplacements) {
7027
- value = value
7028
- .split(`${token}*`).join(`${token}{0,${max}}`)
7029
- .split(`${token}+`).join(`${token}{1,${max}}`);
7030
- }
7031
- return value
7032
- };
7033
-
7034
- const createToken = (name, value, isGlobal) => {
7035
- const safe = makeSafeRegex(value);
7036
- const index = R++;
7037
- debug(name, index, value);
7038
- t[name] = index;
7039
- src[index] = value;
7040
- safeSrc[index] = safe;
7041
- re[index] = new RegExp(value, isGlobal ? 'g' : undefined);
7042
- safeRe[index] = new RegExp(safe, isGlobal ? 'g' : undefined);
7043
- };
7044
-
7045
- // The following Regular Expressions can be used for tokenizing,
7046
- // validating, and parsing SemVer version strings.
7047
-
7048
- // ## Numeric Identifier
7049
- // A single `0`, or a non-zero digit followed by zero or more digits.
7050
-
7051
- createToken('NUMERICIDENTIFIER', '0|[1-9]\\d*');
7052
- createToken('NUMERICIDENTIFIERLOOSE', '\\d+');
7053
-
7054
- // ## Non-numeric Identifier
7055
- // Zero or more digits, followed by a letter or hyphen, and then zero or
7056
- // more letters, digits, or hyphens.
7057
-
7058
- createToken('NONNUMERICIDENTIFIER', `\\d*[a-zA-Z-]${LETTERDASHNUMBER}*`);
7059
-
7060
- // ## Main Version
7061
- // Three dot-separated numeric identifiers.
7062
-
7063
- createToken('MAINVERSION', `(${src[t.NUMERICIDENTIFIER]})\\.` +
7064
- `(${src[t.NUMERICIDENTIFIER]})\\.` +
7065
- `(${src[t.NUMERICIDENTIFIER]})`);
7066
-
7067
- createToken('MAINVERSIONLOOSE', `(${src[t.NUMERICIDENTIFIERLOOSE]})\\.` +
7068
- `(${src[t.NUMERICIDENTIFIERLOOSE]})\\.` +
7069
- `(${src[t.NUMERICIDENTIFIERLOOSE]})`);
7070
-
7071
- // ## Pre-release Version Identifier
7072
- // A numeric identifier, or a non-numeric identifier.
7073
- // Non-numeric identifiers include numeric identifiers but can be longer.
7074
- // Therefore non-numeric identifiers must go first.
7075
-
7076
- createToken('PRERELEASEIDENTIFIER', `(?:${src[t.NONNUMERICIDENTIFIER]
7077
- }|${src[t.NUMERICIDENTIFIER]})`);
7078
-
7079
- createToken('PRERELEASEIDENTIFIERLOOSE', `(?:${src[t.NONNUMERICIDENTIFIER]
7080
- }|${src[t.NUMERICIDENTIFIERLOOSE]})`);
7081
-
7082
- // ## Pre-release Version
7083
- // Hyphen, followed by one or more dot-separated pre-release version
7084
- // identifiers.
7085
-
7086
- createToken('PRERELEASE', `(?:-(${src[t.PRERELEASEIDENTIFIER]
7087
- }(?:\\.${src[t.PRERELEASEIDENTIFIER]})*))`);
7088
-
7089
- createToken('PRERELEASELOOSE', `(?:-?(${src[t.PRERELEASEIDENTIFIERLOOSE]
7090
- }(?:\\.${src[t.PRERELEASEIDENTIFIERLOOSE]})*))`);
7091
-
7092
- // ## Build Metadata Identifier
7093
- // Any combination of digits, letters, or hyphens.
7094
-
7095
- createToken('BUILDIDENTIFIER', `${LETTERDASHNUMBER}+`);
7096
-
7097
- // ## Build Metadata
7098
- // Plus sign, followed by one or more period-separated build metadata
7099
- // identifiers.
7100
-
7101
- createToken('BUILD', `(?:\\+(${src[t.BUILDIDENTIFIER]
7102
- }(?:\\.${src[t.BUILDIDENTIFIER]})*))`);
7103
-
7104
- // ## Full Version String
7105
- // A main version, followed optionally by a pre-release version and
7106
- // build metadata.
7107
-
7108
- // Note that the only major, minor, patch, and pre-release sections of
7109
- // the version string are capturing groups. The build metadata is not a
7110
- // capturing group, because it should not ever be used in version
7111
- // comparison.
7112
-
7113
- createToken('FULLPLAIN', `v?${src[t.MAINVERSION]
7114
- }${src[t.PRERELEASE]}?${
7115
- src[t.BUILD]}?`);
7116
-
7117
- createToken('FULL', `^${src[t.FULLPLAIN]}$`);
7118
-
7119
- // like full, but allows v1.2.3 and =1.2.3, which people do sometimes.
7120
- // also, 1.0.0alpha1 (prerelease without the hyphen) which is pretty
7121
- // common in the npm registry.
7122
- createToken('LOOSEPLAIN', `[v=\\s]*${src[t.MAINVERSIONLOOSE]
7123
- }${src[t.PRERELEASELOOSE]}?${
7124
- src[t.BUILD]}?`);
7125
-
7126
- createToken('LOOSE', `^${src[t.LOOSEPLAIN]}$`);
7127
-
7128
- createToken('GTLT', '((?:<|>)?=?)');
7129
-
7130
- // Something like "2.*" or "1.2.x".
7131
- // Note that "x.x" is a valid xRange identifier, meaning "any version"
7132
- // Only the first item is strictly required.
7133
- createToken('XRANGEIDENTIFIERLOOSE', `${src[t.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);
7134
- createToken('XRANGEIDENTIFIER', `${src[t.NUMERICIDENTIFIER]}|x|X|\\*`);
7135
-
7136
- createToken('XRANGEPLAIN', `[v=\\s]*(${src[t.XRANGEIDENTIFIER]})` +
7137
- `(?:\\.(${src[t.XRANGEIDENTIFIER]})` +
7138
- `(?:\\.(${src[t.XRANGEIDENTIFIER]})` +
7139
- `(?:${src[t.PRERELEASE]})?${
7140
- src[t.BUILD]}?` +
7141
- `)?)?`);
7142
-
7143
- createToken('XRANGEPLAINLOOSE', `[v=\\s]*(${src[t.XRANGEIDENTIFIERLOOSE]})` +
7144
- `(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})` +
7145
- `(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})` +
7146
- `(?:${src[t.PRERELEASELOOSE]})?${
7147
- src[t.BUILD]}?` +
7148
- `)?)?`);
7149
-
7150
- createToken('XRANGE', `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAIN]}$`);
7151
- createToken('XRANGELOOSE', `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAINLOOSE]}$`);
7152
-
7153
- // Coercion.
7154
- // Extract anything that could conceivably be a part of a valid semver
7155
- createToken('COERCEPLAIN', `${'(^|[^\\d])' +
7156
- '(\\d{1,'}${MAX_SAFE_COMPONENT_LENGTH}})` +
7157
- `(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?` +
7158
- `(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?`);
7159
- createToken('COERCE', `${src[t.COERCEPLAIN]}(?:$|[^\\d])`);
7160
- createToken('COERCEFULL', src[t.COERCEPLAIN] +
7161
- `(?:${src[t.PRERELEASE]})?` +
7162
- `(?:${src[t.BUILD]})?` +
7163
- `(?:$|[^\\d])`);
7164
- createToken('COERCERTL', src[t.COERCE], true);
7165
- createToken('COERCERTLFULL', src[t.COERCEFULL], true);
7166
-
7167
- // Tilde ranges.
7168
- // Meaning is "reasonably at or greater than"
7169
- createToken('LONETILDE', '(?:~>?)');
7170
-
7171
- createToken('TILDETRIM', `(\\s*)${src[t.LONETILDE]}\\s+`, true);
7172
- exports.tildeTrimReplace = '$1~';
7173
-
7174
- createToken('TILDE', `^${src[t.LONETILDE]}${src[t.XRANGEPLAIN]}$`);
7175
- createToken('TILDELOOSE', `^${src[t.LONETILDE]}${src[t.XRANGEPLAINLOOSE]}$`);
7176
-
7177
- // Caret ranges.
7178
- // Meaning is "at least and backwards compatible with"
7179
- createToken('LONECARET', '(?:\\^)');
7180
-
7181
- createToken('CARETTRIM', `(\\s*)${src[t.LONECARET]}\\s+`, true);
7182
- exports.caretTrimReplace = '$1^';
7183
-
7184
- createToken('CARET', `^${src[t.LONECARET]}${src[t.XRANGEPLAIN]}$`);
7185
- createToken('CARETLOOSE', `^${src[t.LONECARET]}${src[t.XRANGEPLAINLOOSE]}$`);
7186
-
7187
- // A simple gt/lt/eq thing, or just "" to indicate "any version"
7188
- createToken('COMPARATORLOOSE', `^${src[t.GTLT]}\\s*(${src[t.LOOSEPLAIN]})$|^$`);
7189
- createToken('COMPARATOR', `^${src[t.GTLT]}\\s*(${src[t.FULLPLAIN]})$|^$`);
7190
-
7191
- // An expression to strip any whitespace between the gtlt and the thing
7192
- // it modifies, so that `> 1.2.3` ==> `>1.2.3`
7193
- createToken('COMPARATORTRIM', `(\\s*)${src[t.GTLT]
7194
- }\\s*(${src[t.LOOSEPLAIN]}|${src[t.XRANGEPLAIN]})`, true);
7195
- exports.comparatorTrimReplace = '$1$2$3';
7196
-
7197
- // Something like `1.2.3 - 1.2.4`
7198
- // Note that these all use the loose form, because they'll be
7199
- // checked against either the strict or loose comparator form
7200
- // later.
7201
- createToken('HYPHENRANGE', `^\\s*(${src[t.XRANGEPLAIN]})` +
7202
- `\\s+-\\s+` +
7203
- `(${src[t.XRANGEPLAIN]})` +
7204
- `\\s*$`);
7205
-
7206
- createToken('HYPHENRANGELOOSE', `^\\s*(${src[t.XRANGEPLAINLOOSE]})` +
7207
- `\\s+-\\s+` +
7208
- `(${src[t.XRANGEPLAINLOOSE]})` +
7209
- `\\s*$`);
7210
-
7211
- // Star ranges basically just allow anything at all.
7212
- createToken('STAR', '(<|>)?=?\\s*\\*');
7213
- // >=0.0.0 is like a star
7214
- createToken('GTE0', '^\\s*>=\\s*0\\.0\\.0\\s*$');
7215
- createToken('GTE0PRE', '^\\s*>=\\s*0\\.0\\.0-0\\s*$');
7216
- } (re, re.exports));
7217
- return re.exports;
7218
- }
7219
-
7220
- var parseOptions_1;
7221
- var hasRequiredParseOptions;
7222
-
7223
- function requireParseOptions () {
7224
- if (hasRequiredParseOptions) return parseOptions_1;
7225
- hasRequiredParseOptions = 1;
7226
-
7227
- // parse out just the options we care about
7228
- const looseOption = Object.freeze({ loose: true });
7229
- const emptyOpts = Object.freeze({ });
7230
- const parseOptions = options => {
7231
- if (!options) {
7232
- return emptyOpts
7233
- }
7234
-
7235
- if (typeof options !== 'object') {
7236
- return looseOption
7237
- }
7238
-
7239
- return options
7240
- };
7241
- parseOptions_1 = parseOptions;
7242
- return parseOptions_1;
7243
- }
7244
-
7245
- var identifiers;
7246
- var hasRequiredIdentifiers;
7247
-
7248
- function requireIdentifiers () {
7249
- if (hasRequiredIdentifiers) return identifiers;
7250
- hasRequiredIdentifiers = 1;
7251
-
7252
- const numeric = /^[0-9]+$/;
7253
- const compareIdentifiers = (a, b) => {
7254
- if (typeof a === 'number' && typeof b === 'number') {
7255
- return a === b ? 0 : a < b ? -1 : 1
7256
- }
7257
-
7258
- const anum = numeric.test(a);
7259
- const bnum = numeric.test(b);
7260
-
7261
- if (anum && bnum) {
7262
- a = +a;
7263
- b = +b;
7264
- }
7265
-
7266
- return a === b ? 0
7267
- : (anum && !bnum) ? -1
7268
- : (bnum && !anum) ? 1
7269
- : a < b ? -1
7270
- : 1
7271
- };
7272
-
7273
- const rcompareIdentifiers = (a, b) => compareIdentifiers(b, a);
7274
-
7275
- identifiers = {
7276
- compareIdentifiers,
7277
- rcompareIdentifiers,
7278
- };
7279
- return identifiers;
7280
- }
7281
-
7282
- var semver$1;
7283
- var hasRequiredSemver$1;
7284
-
7285
- function requireSemver$1 () {
7286
- if (hasRequiredSemver$1) return semver$1;
7287
- hasRequiredSemver$1 = 1;
7288
-
7289
- const debug = requireDebug();
7290
- const { MAX_LENGTH, MAX_SAFE_INTEGER } = requireConstants();
7291
- const { safeRe: re, t } = requireRe();
7292
-
7293
- const parseOptions = requireParseOptions();
7294
- const { compareIdentifiers } = requireIdentifiers();
7295
- class SemVer {
7296
- constructor (version, options) {
7297
- options = parseOptions(options);
7298
-
7299
- if (version instanceof SemVer) {
7300
- if (version.loose === !!options.loose &&
7301
- version.includePrerelease === !!options.includePrerelease) {
7302
- return version
7303
- } else {
7304
- version = version.version;
7305
- }
7306
- } else if (typeof version !== 'string') {
7307
- throw new TypeError(`Invalid version. Must be a string. Got type "${typeof version}".`)
7308
- }
7309
-
7310
- if (version.length > MAX_LENGTH) {
7311
- throw new TypeError(
7312
- `version is longer than ${MAX_LENGTH} characters`
7313
- )
7314
- }
7315
-
7316
- debug('SemVer', version, options);
7317
- this.options = options;
7318
- this.loose = !!options.loose;
7319
- // this isn't actually relevant for versions, but keep it so that we
7320
- // don't run into trouble passing this.options around.
7321
- this.includePrerelease = !!options.includePrerelease;
7322
-
7323
- const m = version.trim().match(options.loose ? re[t.LOOSE] : re[t.FULL]);
7324
-
7325
- if (!m) {
7326
- throw new TypeError(`Invalid Version: ${version}`)
7327
- }
7328
-
7329
- this.raw = version;
7330
-
7331
- // these are actually numbers
7332
- this.major = +m[1];
7333
- this.minor = +m[2];
7334
- this.patch = +m[3];
7335
-
7336
- if (this.major > MAX_SAFE_INTEGER || this.major < 0) {
7337
- throw new TypeError('Invalid major version')
7338
- }
7339
-
7340
- if (this.minor > MAX_SAFE_INTEGER || this.minor < 0) {
7341
- throw new TypeError('Invalid minor version')
7342
- }
7343
-
7344
- if (this.patch > MAX_SAFE_INTEGER || this.patch < 0) {
7345
- throw new TypeError('Invalid patch version')
7346
- }
7347
-
7348
- // numberify any prerelease numeric ids
7349
- if (!m[4]) {
7350
- this.prerelease = [];
7351
- } else {
7352
- this.prerelease = m[4].split('.').map((id) => {
7353
- if (/^[0-9]+$/.test(id)) {
7354
- const num = +id;
7355
- if (num >= 0 && num < MAX_SAFE_INTEGER) {
7356
- return num
7357
- }
7358
- }
7359
- return id
7360
- });
7361
- }
7362
-
7363
- this.build = m[5] ? m[5].split('.') : [];
7364
- this.format();
7365
- }
7366
-
7367
- format () {
7368
- this.version = `${this.major}.${this.minor}.${this.patch}`;
7369
- if (this.prerelease.length) {
7370
- this.version += `-${this.prerelease.join('.')}`;
7371
- }
7372
- return this.version
7373
- }
7374
-
7375
- toString () {
7376
- return this.version
7377
- }
7378
-
7379
- compare (other) {
7380
- debug('SemVer.compare', this.version, this.options, other);
7381
- if (!(other instanceof SemVer)) {
7382
- if (typeof other === 'string' && other === this.version) {
7383
- return 0
7384
- }
7385
- other = new SemVer(other, this.options);
7386
- }
7387
-
7388
- if (other.version === this.version) {
7389
- return 0
7390
- }
7391
-
7392
- return this.compareMain(other) || this.comparePre(other)
7393
- }
7394
-
7395
- compareMain (other) {
7396
- if (!(other instanceof SemVer)) {
7397
- other = new SemVer(other, this.options);
7398
- }
7399
-
7400
- if (this.major < other.major) {
7401
- return -1
7402
- }
7403
- if (this.major > other.major) {
7404
- return 1
7405
- }
7406
- if (this.minor < other.minor) {
7407
- return -1
7408
- }
7409
- if (this.minor > other.minor) {
7410
- return 1
7411
- }
7412
- if (this.patch < other.patch) {
7413
- return -1
7414
- }
7415
- if (this.patch > other.patch) {
7416
- return 1
7417
- }
7418
- return 0
7419
- }
7420
-
7421
- comparePre (other) {
7422
- if (!(other instanceof SemVer)) {
7423
- other = new SemVer(other, this.options);
7424
- }
7425
-
7426
- // NOT having a prerelease is > having one
7427
- if (this.prerelease.length && !other.prerelease.length) {
7428
- return -1
7429
- } else if (!this.prerelease.length && other.prerelease.length) {
7430
- return 1
7431
- } else if (!this.prerelease.length && !other.prerelease.length) {
7432
- return 0
7433
- }
7434
-
7435
- let i = 0;
7436
- do {
7437
- const a = this.prerelease[i];
7438
- const b = other.prerelease[i];
7439
- debug('prerelease compare', i, a, b);
7440
- if (a === undefined && b === undefined) {
7441
- return 0
7442
- } else if (b === undefined) {
7443
- return 1
7444
- } else if (a === undefined) {
7445
- return -1
7446
- } else if (a === b) {
7447
- continue
7448
- } else {
7449
- return compareIdentifiers(a, b)
7450
- }
7451
- } while (++i)
7452
- }
7453
-
7454
- compareBuild (other) {
7455
- if (!(other instanceof SemVer)) {
7456
- other = new SemVer(other, this.options);
7457
- }
7458
-
7459
- let i = 0;
7460
- do {
7461
- const a = this.build[i];
7462
- const b = other.build[i];
7463
- debug('build compare', i, a, b);
7464
- if (a === undefined && b === undefined) {
7465
- return 0
7466
- } else if (b === undefined) {
7467
- return 1
7468
- } else if (a === undefined) {
7469
- return -1
7470
- } else if (a === b) {
7471
- continue
7472
- } else {
7473
- return compareIdentifiers(a, b)
7474
- }
7475
- } while (++i)
7476
- }
7477
-
7478
- // preminor will bump the version up to the next minor release, and immediately
7479
- // down to pre-release. premajor and prepatch work the same way.
7480
- inc (release, identifier, identifierBase) {
7481
- if (release.startsWith('pre')) {
7482
- if (!identifier && identifierBase === false) {
7483
- throw new Error('invalid increment argument: identifier is empty')
7484
- }
7485
- // Avoid an invalid semver results
7486
- if (identifier) {
7487
- const match = `-${identifier}`.match(this.options.loose ? re[t.PRERELEASELOOSE] : re[t.PRERELEASE]);
7488
- if (!match || match[1] !== identifier) {
7489
- throw new Error(`invalid identifier: ${identifier}`)
7490
- }
7491
- }
7492
- }
7493
-
7494
- switch (release) {
7495
- case 'premajor':
7496
- this.prerelease.length = 0;
7497
- this.patch = 0;
7498
- this.minor = 0;
7499
- this.major++;
7500
- this.inc('pre', identifier, identifierBase);
7501
- break
7502
- case 'preminor':
7503
- this.prerelease.length = 0;
7504
- this.patch = 0;
7505
- this.minor++;
7506
- this.inc('pre', identifier, identifierBase);
7507
- break
7508
- case 'prepatch':
7509
- // If this is already a prerelease, it will bump to the next version
7510
- // drop any prereleases that might already exist, since they are not
7511
- // relevant at this point.
7512
- this.prerelease.length = 0;
7513
- this.inc('patch', identifier, identifierBase);
7514
- this.inc('pre', identifier, identifierBase);
7515
- break
7516
- // If the input is a non-prerelease version, this acts the same as
7517
- // prepatch.
7518
- case 'prerelease':
7519
- if (this.prerelease.length === 0) {
7520
- this.inc('patch', identifier, identifierBase);
7521
- }
7522
- this.inc('pre', identifier, identifierBase);
7523
- break
7524
- case 'release':
7525
- if (this.prerelease.length === 0) {
7526
- throw new Error(`version ${this.raw} is not a prerelease`)
7527
- }
7528
- this.prerelease.length = 0;
7529
- break
7530
-
7531
- case 'major':
7532
- // If this is a pre-major version, bump up to the same major version.
7533
- // Otherwise increment major.
7534
- // 1.0.0-5 bumps to 1.0.0
7535
- // 1.1.0 bumps to 2.0.0
7536
- if (
7537
- this.minor !== 0 ||
7538
- this.patch !== 0 ||
7539
- this.prerelease.length === 0
7540
- ) {
7541
- this.major++;
7542
- }
7543
- this.minor = 0;
7544
- this.patch = 0;
7545
- this.prerelease = [];
7546
- break
7547
- case 'minor':
7548
- // If this is a pre-minor version, bump up to the same minor version.
7549
- // Otherwise increment minor.
7550
- // 1.2.0-5 bumps to 1.2.0
7551
- // 1.2.1 bumps to 1.3.0
7552
- if (this.patch !== 0 || this.prerelease.length === 0) {
7553
- this.minor++;
7554
- }
7555
- this.patch = 0;
7556
- this.prerelease = [];
7557
- break
7558
- case 'patch':
7559
- // If this is not a pre-release version, it will increment the patch.
7560
- // If it is a pre-release it will bump up to the same patch version.
7561
- // 1.2.0-5 patches to 1.2.0
7562
- // 1.2.0 patches to 1.2.1
7563
- if (this.prerelease.length === 0) {
7564
- this.patch++;
7565
- }
7566
- this.prerelease = [];
7567
- break
7568
- // This probably shouldn't be used publicly.
7569
- // 1.0.0 'pre' would become 1.0.0-0 which is the wrong direction.
7570
- case 'pre': {
7571
- const base = Number(identifierBase) ? 1 : 0;
7572
-
7573
- if (this.prerelease.length === 0) {
7574
- this.prerelease = [base];
7575
- } else {
7576
- let i = this.prerelease.length;
7577
- while (--i >= 0) {
7578
- if (typeof this.prerelease[i] === 'number') {
7579
- this.prerelease[i]++;
7580
- i = -2;
7581
- }
7582
- }
7583
- if (i === -1) {
7584
- // didn't increment anything
7585
- if (identifier === this.prerelease.join('.') && identifierBase === false) {
7586
- throw new Error('invalid increment argument: identifier already exists')
7587
- }
7588
- this.prerelease.push(base);
7589
- }
7590
- }
7591
- if (identifier) {
7592
- // 1.2.0-beta.1 bumps to 1.2.0-beta.2,
7593
- // 1.2.0-beta.fooblz or 1.2.0-beta bumps to 1.2.0-beta.0
7594
- let prerelease = [identifier, base];
7595
- if (identifierBase === false) {
7596
- prerelease = [identifier];
7597
- }
7598
- if (compareIdentifiers(this.prerelease[0], identifier) === 0) {
7599
- if (isNaN(this.prerelease[1])) {
7600
- this.prerelease = prerelease;
7601
- }
7602
- } else {
7603
- this.prerelease = prerelease;
7604
- }
7605
- }
7606
- break
7607
- }
7608
- default:
7609
- throw new Error(`invalid increment argument: ${release}`)
7610
- }
7611
- this.raw = this.format();
7612
- if (this.build.length) {
7613
- this.raw += `+${this.build.join('.')}`;
7614
- }
7615
- return this
7616
- }
7617
- }
7618
-
7619
- semver$1 = SemVer;
7620
- return semver$1;
7621
- }
7622
-
7623
- var parse_1;
7624
- var hasRequiredParse;
7625
-
7626
- function requireParse () {
7627
- if (hasRequiredParse) return parse_1;
7628
- hasRequiredParse = 1;
7629
-
7630
- const SemVer = requireSemver$1();
7631
- const parse = (version, options, throwErrors = false) => {
7632
- if (version instanceof SemVer) {
7633
- return version
7634
- }
7635
- try {
7636
- return new SemVer(version, options)
7637
- } catch (er) {
7638
- if (!throwErrors) {
7639
- return null
7640
- }
7641
- throw er
7642
- }
7643
- };
7644
-
7645
- parse_1 = parse;
7646
- return parse_1;
7647
- }
7648
-
7649
- var valid_1;
7650
- var hasRequiredValid$1;
7651
-
7652
- function requireValid$1 () {
7653
- if (hasRequiredValid$1) return valid_1;
7654
- hasRequiredValid$1 = 1;
7655
-
7656
- const parse = requireParse();
7657
- const valid = (version, options) => {
7658
- const v = parse(version, options);
7659
- return v ? v.version : null
7660
- };
7661
- valid_1 = valid;
7662
- return valid_1;
7663
- }
7664
-
7665
- var clean_1;
7666
- var hasRequiredClean;
7667
-
7668
- function requireClean () {
7669
- if (hasRequiredClean) return clean_1;
7670
- hasRequiredClean = 1;
7671
-
7672
- const parse = requireParse();
7673
- const clean = (version, options) => {
7674
- const s = parse(version.trim().replace(/^[=v]+/, ''), options);
7675
- return s ? s.version : null
7676
- };
7677
- clean_1 = clean;
7678
- return clean_1;
7679
- }
7680
-
7681
- var inc_1;
7682
- var hasRequiredInc;
7683
-
7684
- function requireInc () {
7685
- if (hasRequiredInc) return inc_1;
7686
- hasRequiredInc = 1;
7687
-
7688
- const SemVer = requireSemver$1();
7689
-
7690
- const inc = (version, release, options, identifier, identifierBase) => {
7691
- if (typeof (options) === 'string') {
7692
- identifierBase = identifier;
7693
- identifier = options;
7694
- options = undefined;
7695
- }
7696
-
7697
- try {
7698
- return new SemVer(
7699
- version instanceof SemVer ? version.version : version,
7700
- options
7701
- ).inc(release, identifier, identifierBase).version
7702
- } catch (er) {
7703
- return null
7704
- }
7705
- };
7706
- inc_1 = inc;
7707
- return inc_1;
7708
- }
7709
-
7710
- var diff_1;
7711
- var hasRequiredDiff;
7712
-
7713
- function requireDiff () {
7714
- if (hasRequiredDiff) return diff_1;
7715
- hasRequiredDiff = 1;
7716
-
7717
- const parse = requireParse();
7718
-
7719
- const diff = (version1, version2) => {
7720
- const v1 = parse(version1, null, true);
7721
- const v2 = parse(version2, null, true);
7722
- const comparison = v1.compare(v2);
7723
-
7724
- if (comparison === 0) {
7725
- return null
7726
- }
7727
-
7728
- const v1Higher = comparison > 0;
7729
- const highVersion = v1Higher ? v1 : v2;
7730
- const lowVersion = v1Higher ? v2 : v1;
7731
- const highHasPre = !!highVersion.prerelease.length;
7732
- const lowHasPre = !!lowVersion.prerelease.length;
7733
-
7734
- if (lowHasPre && !highHasPre) {
7735
- // Going from prerelease -> no prerelease requires some special casing
7736
-
7737
- // If the low version has only a major, then it will always be a major
7738
- // Some examples:
7739
- // 1.0.0-1 -> 1.0.0
7740
- // 1.0.0-1 -> 1.1.1
7741
- // 1.0.0-1 -> 2.0.0
7742
- if (!lowVersion.patch && !lowVersion.minor) {
7743
- return 'major'
7744
- }
7745
-
7746
- // If the main part has no difference
7747
- if (lowVersion.compareMain(highVersion) === 0) {
7748
- if (lowVersion.minor && !lowVersion.patch) {
7749
- return 'minor'
7750
- }
7751
- return 'patch'
7752
- }
7753
- }
7754
-
7755
- // add the `pre` prefix if we are going to a prerelease version
7756
- const prefix = highHasPre ? 'pre' : '';
7757
-
7758
- if (v1.major !== v2.major) {
7759
- return prefix + 'major'
7760
- }
7761
-
7762
- if (v1.minor !== v2.minor) {
7763
- return prefix + 'minor'
7764
- }
7765
-
7766
- if (v1.patch !== v2.patch) {
7767
- return prefix + 'patch'
7768
- }
7769
-
7770
- // high and low are prereleases
7771
- return 'prerelease'
7772
- };
7773
-
7774
- diff_1 = diff;
7775
- return diff_1;
7776
- }
7777
-
7778
- var major_1;
7779
- var hasRequiredMajor;
7780
-
7781
- function requireMajor () {
7782
- if (hasRequiredMajor) return major_1;
7783
- hasRequiredMajor = 1;
7784
-
7785
- const SemVer = requireSemver$1();
7786
- const major = (a, loose) => new SemVer(a, loose).major;
7787
- major_1 = major;
7788
- return major_1;
7789
- }
7790
-
7791
- var minor_1;
7792
- var hasRequiredMinor;
7793
-
7794
- function requireMinor () {
7795
- if (hasRequiredMinor) return minor_1;
7796
- hasRequiredMinor = 1;
7797
-
7798
- const SemVer = requireSemver$1();
7799
- const minor = (a, loose) => new SemVer(a, loose).minor;
7800
- minor_1 = minor;
7801
- return minor_1;
7802
- }
7803
-
7804
- var patch_1;
7805
- var hasRequiredPatch;
7806
-
7807
- function requirePatch () {
7808
- if (hasRequiredPatch) return patch_1;
7809
- hasRequiredPatch = 1;
7810
-
7811
- const SemVer = requireSemver$1();
7812
- const patch = (a, loose) => new SemVer(a, loose).patch;
7813
- patch_1 = patch;
7814
- return patch_1;
7815
- }
7816
-
7817
- var prerelease_1;
7818
- var hasRequiredPrerelease;
7819
-
7820
- function requirePrerelease () {
7821
- if (hasRequiredPrerelease) return prerelease_1;
7822
- hasRequiredPrerelease = 1;
7823
-
7824
- const parse = requireParse();
7825
- const prerelease = (version, options) => {
7826
- const parsed = parse(version, options);
7827
- return (parsed && parsed.prerelease.length) ? parsed.prerelease : null
7828
- };
7829
- prerelease_1 = prerelease;
7830
- return prerelease_1;
7831
- }
7832
-
7833
- var compare_1;
7834
- var hasRequiredCompare;
7835
-
7836
- function requireCompare () {
7837
- if (hasRequiredCompare) return compare_1;
7838
- hasRequiredCompare = 1;
7839
-
7840
- const SemVer = requireSemver$1();
7841
- const compare = (a, b, loose) =>
7842
- new SemVer(a, loose).compare(new SemVer(b, loose));
7843
-
7844
- compare_1 = compare;
7845
- return compare_1;
7846
- }
7847
-
7848
- var rcompare_1;
7849
- var hasRequiredRcompare;
7850
-
7851
- function requireRcompare () {
7852
- if (hasRequiredRcompare) return rcompare_1;
7853
- hasRequiredRcompare = 1;
7854
-
7855
- const compare = requireCompare();
7856
- const rcompare = (a, b, loose) => compare(b, a, loose);
7857
- rcompare_1 = rcompare;
7858
- return rcompare_1;
7859
- }
7860
-
7861
- var compareLoose_1;
7862
- var hasRequiredCompareLoose;
7863
-
7864
- function requireCompareLoose () {
7865
- if (hasRequiredCompareLoose) return compareLoose_1;
7866
- hasRequiredCompareLoose = 1;
7867
-
7868
- const compare = requireCompare();
7869
- const compareLoose = (a, b) => compare(a, b, true);
7870
- compareLoose_1 = compareLoose;
7871
- return compareLoose_1;
7872
- }
7873
-
7874
- var compareBuild_1;
7875
- var hasRequiredCompareBuild;
7876
-
7877
- function requireCompareBuild () {
7878
- if (hasRequiredCompareBuild) return compareBuild_1;
7879
- hasRequiredCompareBuild = 1;
7880
-
7881
- const SemVer = requireSemver$1();
7882
- const compareBuild = (a, b, loose) => {
7883
- const versionA = new SemVer(a, loose);
7884
- const versionB = new SemVer(b, loose);
7885
- return versionA.compare(versionB) || versionA.compareBuild(versionB)
7886
- };
7887
- compareBuild_1 = compareBuild;
7888
- return compareBuild_1;
7889
- }
7890
-
7891
- var sort_1;
7892
- var hasRequiredSort;
7893
-
7894
- function requireSort () {
7895
- if (hasRequiredSort) return sort_1;
7896
- hasRequiredSort = 1;
7897
-
7898
- const compareBuild = requireCompareBuild();
7899
- const sort = (list, loose) => list.sort((a, b) => compareBuild(a, b, loose));
7900
- sort_1 = sort;
7901
- return sort_1;
7902
- }
7903
-
7904
- var rsort_1;
7905
- var hasRequiredRsort;
7906
-
7907
- function requireRsort () {
7908
- if (hasRequiredRsort) return rsort_1;
7909
- hasRequiredRsort = 1;
7910
-
7911
- const compareBuild = requireCompareBuild();
7912
- const rsort = (list, loose) => list.sort((a, b) => compareBuild(b, a, loose));
7913
- rsort_1 = rsort;
7914
- return rsort_1;
7915
- }
7916
-
7917
- var gt_1;
7918
- var hasRequiredGt;
7919
-
7920
- function requireGt () {
7921
- if (hasRequiredGt) return gt_1;
7922
- hasRequiredGt = 1;
7923
-
7924
- const compare = requireCompare();
7925
- const gt = (a, b, loose) => compare(a, b, loose) > 0;
7926
- gt_1 = gt;
7927
- return gt_1;
7928
- }
7929
-
7930
- var lt_1;
7931
- var hasRequiredLt;
7932
-
7933
- function requireLt () {
7934
- if (hasRequiredLt) return lt_1;
7935
- hasRequiredLt = 1;
7936
-
7937
- const compare = requireCompare();
7938
- const lt = (a, b, loose) => compare(a, b, loose) < 0;
7939
- lt_1 = lt;
7940
- return lt_1;
7941
- }
7942
-
7943
- var eq_1;
7944
- var hasRequiredEq;
7945
-
7946
- function requireEq () {
7947
- if (hasRequiredEq) return eq_1;
7948
- hasRequiredEq = 1;
7949
-
7950
- const compare = requireCompare();
7951
- const eq = (a, b, loose) => compare(a, b, loose) === 0;
7952
- eq_1 = eq;
7953
- return eq_1;
7954
- }
7955
-
7956
- var neq_1;
7957
- var hasRequiredNeq;
7958
-
7959
- function requireNeq () {
7960
- if (hasRequiredNeq) return neq_1;
7961
- hasRequiredNeq = 1;
7962
-
7963
- const compare = requireCompare();
7964
- const neq = (a, b, loose) => compare(a, b, loose) !== 0;
7965
- neq_1 = neq;
7966
- return neq_1;
7967
- }
7968
-
7969
- var gte_1;
7970
- var hasRequiredGte;
7971
-
7972
- function requireGte () {
7973
- if (hasRequiredGte) return gte_1;
7974
- hasRequiredGte = 1;
7975
-
7976
- const compare = requireCompare();
7977
- const gte = (a, b, loose) => compare(a, b, loose) >= 0;
7978
- gte_1 = gte;
7979
- return gte_1;
7980
- }
7981
-
7982
- var lte_1;
7983
- var hasRequiredLte;
7984
-
7985
- function requireLte () {
7986
- if (hasRequiredLte) return lte_1;
7987
- hasRequiredLte = 1;
7988
-
7989
- const compare = requireCompare();
7990
- const lte = (a, b, loose) => compare(a, b, loose) <= 0;
7991
- lte_1 = lte;
7992
- return lte_1;
7993
- }
7994
-
7995
- var cmp_1;
7996
- var hasRequiredCmp;
7997
-
7998
- function requireCmp () {
7999
- if (hasRequiredCmp) return cmp_1;
8000
- hasRequiredCmp = 1;
8001
-
8002
- const eq = requireEq();
8003
- const neq = requireNeq();
8004
- const gt = requireGt();
8005
- const gte = requireGte();
8006
- const lt = requireLt();
8007
- const lte = requireLte();
8008
-
8009
- const cmp = (a, op, b, loose) => {
8010
- switch (op) {
8011
- case '===':
8012
- if (typeof a === 'object') {
8013
- a = a.version;
8014
- }
8015
- if (typeof b === 'object') {
8016
- b = b.version;
8017
- }
8018
- return a === b
8019
-
8020
- case '!==':
8021
- if (typeof a === 'object') {
8022
- a = a.version;
8023
- }
8024
- if (typeof b === 'object') {
8025
- b = b.version;
8026
- }
8027
- return a !== b
8028
-
8029
- case '':
8030
- case '=':
8031
- case '==':
8032
- return eq(a, b, loose)
8033
-
8034
- case '!=':
8035
- return neq(a, b, loose)
8036
-
8037
- case '>':
8038
- return gt(a, b, loose)
8039
-
8040
- case '>=':
8041
- return gte(a, b, loose)
8042
-
8043
- case '<':
8044
- return lt(a, b, loose)
8045
-
8046
- case '<=':
8047
- return lte(a, b, loose)
8048
-
8049
- default:
8050
- throw new TypeError(`Invalid operator: ${op}`)
8051
- }
8052
- };
8053
- cmp_1 = cmp;
8054
- return cmp_1;
8055
- }
8056
-
8057
- var coerce_1;
8058
- var hasRequiredCoerce;
8059
-
8060
- function requireCoerce () {
8061
- if (hasRequiredCoerce) return coerce_1;
8062
- hasRequiredCoerce = 1;
8063
-
8064
- const SemVer = requireSemver$1();
8065
- const parse = requireParse();
8066
- const { safeRe: re, t } = requireRe();
8067
-
8068
- const coerce = (version, options) => {
8069
- if (version instanceof SemVer) {
8070
- return version
8071
- }
8072
-
8073
- if (typeof version === 'number') {
8074
- version = String(version);
8075
- }
8076
-
8077
- if (typeof version !== 'string') {
8078
- return null
8079
- }
8080
-
8081
- options = options || {};
8082
-
8083
- let match = null;
8084
- if (!options.rtl) {
8085
- match = version.match(options.includePrerelease ? re[t.COERCEFULL] : re[t.COERCE]);
8086
- } else {
8087
- // Find the right-most coercible string that does not share
8088
- // a terminus with a more left-ward coercible string.
8089
- // Eg, '1.2.3.4' wants to coerce '2.3.4', not '3.4' or '4'
8090
- // With includePrerelease option set, '1.2.3.4-rc' wants to coerce '2.3.4-rc', not '2.3.4'
8091
- //
8092
- // Walk through the string checking with a /g regexp
8093
- // Manually set the index so as to pick up overlapping matches.
8094
- // Stop when we get a match that ends at the string end, since no
8095
- // coercible string can be more right-ward without the same terminus.
8096
- const coerceRtlRegex = options.includePrerelease ? re[t.COERCERTLFULL] : re[t.COERCERTL];
8097
- let next;
8098
- while ((next = coerceRtlRegex.exec(version)) &&
8099
- (!match || match.index + match[0].length !== version.length)
8100
- ) {
8101
- if (!match ||
8102
- next.index + next[0].length !== match.index + match[0].length) {
8103
- match = next;
8104
- }
8105
- coerceRtlRegex.lastIndex = next.index + next[1].length + next[2].length;
8106
- }
8107
- // leave it in a clean state
8108
- coerceRtlRegex.lastIndex = -1;
8109
- }
8110
-
8111
- if (match === null) {
8112
- return null
8113
- }
8114
-
8115
- const major = match[2];
8116
- const minor = match[3] || '0';
8117
- const patch = match[4] || '0';
8118
- const prerelease = options.includePrerelease && match[5] ? `-${match[5]}` : '';
8119
- const build = options.includePrerelease && match[6] ? `+${match[6]}` : '';
8120
-
8121
- return parse(`${major}.${minor}.${patch}${prerelease}${build}`, options)
8122
- };
8123
- coerce_1 = coerce;
8124
- return coerce_1;
8125
- }
8126
-
8127
- var truncate_1;
8128
- var hasRequiredTruncate;
8129
-
8130
- function requireTruncate () {
8131
- if (hasRequiredTruncate) return truncate_1;
8132
- hasRequiredTruncate = 1;
8133
-
8134
- const parse = requireParse();
8135
- const constants = requireConstants();
8136
- const SemVer = requireSemver$1();
8137
-
8138
- const truncate = (version, truncation, options) => {
8139
- if (!constants.RELEASE_TYPES.includes(truncation)) {
8140
- return null
8141
- }
8142
-
8143
- const clonedVersion = cloneInputVersion(version, options);
8144
- return clonedVersion && doTruncation(clonedVersion, truncation)
8145
- };
8146
-
8147
- const cloneInputVersion = (version, options) => {
8148
- const versionStringToParse = (
8149
- version instanceof SemVer ? version.version : version
8150
- );
8151
-
8152
- return parse(versionStringToParse, options)
8153
- };
8154
-
8155
- const doTruncation = (version, truncation) => {
8156
- if (isPrerelease(truncation)) {
8157
- return version.version
8158
- }
8159
-
8160
- version.prerelease = [];
8161
-
8162
- switch (truncation) {
8163
- case 'major':
8164
- version.minor = 0;
8165
- version.patch = 0;
8166
- break
8167
- case 'minor':
8168
- version.patch = 0;
8169
- break
8170
- }
8171
-
8172
- return version.format()
8173
- };
8174
-
8175
- const isPrerelease = (type) => {
8176
- return type.startsWith('pre')
8177
- };
8178
-
8179
- truncate_1 = truncate;
8180
- return truncate_1;
8181
- }
8182
-
8183
- var lrucache;
8184
- var hasRequiredLrucache;
8185
-
8186
- function requireLrucache () {
8187
- if (hasRequiredLrucache) return lrucache;
8188
- hasRequiredLrucache = 1;
8189
-
8190
- class LRUCache {
8191
- constructor () {
8192
- this.max = 1000;
8193
- this.map = new Map();
8194
- }
8195
-
8196
- get (key) {
8197
- const value = this.map.get(key);
8198
- if (value === undefined) {
8199
- return undefined
8200
- } else {
8201
- // Remove the key from the map and add it to the end
8202
- this.map.delete(key);
8203
- this.map.set(key, value);
8204
- return value
8205
- }
8206
- }
8207
-
8208
- delete (key) {
8209
- return this.map.delete(key)
8210
- }
8211
-
8212
- set (key, value) {
8213
- const deleted = this.delete(key);
8214
-
8215
- if (!deleted && value !== undefined) {
8216
- // If cache is full, delete the least recently used item
8217
- if (this.map.size >= this.max) {
8218
- const firstKey = this.map.keys().next().value;
8219
- this.delete(firstKey);
8220
- }
8221
-
8222
- this.map.set(key, value);
8223
- }
8224
-
8225
- return this
8226
- }
8227
- }
8228
-
8229
- lrucache = LRUCache;
8230
- return lrucache;
8231
- }
8232
-
8233
- var range;
8234
- var hasRequiredRange;
8235
-
8236
- function requireRange () {
8237
- if (hasRequiredRange) return range;
8238
- hasRequiredRange = 1;
8239
-
8240
- const SPACE_CHARACTERS = /\s+/g;
8241
-
8242
- // hoisted class for cyclic dependency
8243
- class Range {
8244
- constructor (range, options) {
8245
- options = parseOptions(options);
8246
-
8247
- if (range instanceof Range) {
8248
- if (
8249
- range.loose === !!options.loose &&
8250
- range.includePrerelease === !!options.includePrerelease
8251
- ) {
8252
- return range
8253
- } else {
8254
- return new Range(range.raw, options)
8255
- }
8256
- }
8257
-
8258
- if (range instanceof Comparator) {
8259
- // just put it in the set and return
8260
- this.raw = range.value;
8261
- this.set = [[range]];
8262
- this.formatted = undefined;
8263
- return this
8264
- }
8265
-
8266
- this.options = options;
8267
- this.loose = !!options.loose;
8268
- this.includePrerelease = !!options.includePrerelease;
8269
-
8270
- // First reduce all whitespace as much as possible so we do not have to rely
8271
- // on potentially slow regexes like \s*. This is then stored and used for
8272
- // future error messages as well.
8273
- this.raw = range.trim().replace(SPACE_CHARACTERS, ' ');
8274
-
8275
- // First, split on ||
8276
- this.set = this.raw
8277
- .split('||')
8278
- // map the range to a 2d array of comparators
8279
- .map(r => this.parseRange(r.trim()))
8280
- // throw out any comparator lists that are empty
8281
- // this generally means that it was not a valid range, which is allowed
8282
- // in loose mode, but will still throw if the WHOLE range is invalid.
8283
- .filter(c => c.length);
8284
-
8285
- if (!this.set.length) {
8286
- throw new TypeError(`Invalid SemVer Range: ${this.raw}`)
8287
- }
8288
-
8289
- // if we have any that are not the null set, throw out null sets.
8290
- if (this.set.length > 1) {
8291
- // keep the first one, in case they're all null sets
8292
- const first = this.set[0];
8293
- this.set = this.set.filter(c => !isNullSet(c[0]));
8294
- if (this.set.length === 0) {
8295
- this.set = [first];
8296
- } else if (this.set.length > 1) {
8297
- // if we have any that are *, then the range is just *
8298
- for (const c of this.set) {
8299
- if (c.length === 1 && isAny(c[0])) {
8300
- this.set = [c];
8301
- break
8302
- }
8303
- }
8304
- }
8305
- }
8306
-
8307
- this.formatted = undefined;
8308
- }
8309
-
8310
- get range () {
8311
- if (this.formatted === undefined) {
8312
- this.formatted = '';
8313
- for (let i = 0; i < this.set.length; i++) {
8314
- if (i > 0) {
8315
- this.formatted += '||';
8316
- }
8317
- const comps = this.set[i];
8318
- for (let k = 0; k < comps.length; k++) {
8319
- if (k > 0) {
8320
- this.formatted += ' ';
8321
- }
8322
- this.formatted += comps[k].toString().trim();
8323
- }
8324
- }
8325
- }
8326
- return this.formatted
8327
- }
8328
-
8329
- format () {
8330
- return this.range
8331
- }
8332
-
8333
- toString () {
8334
- return this.range
8335
- }
8336
-
8337
- parseRange (range) {
8338
- // strip build metadata so it can't bleed into the version
8339
- range = range.replace(BUILDSTRIPRE, '');
8340
-
8341
- // memoize range parsing for performance.
8342
- // this is a very hot path, and fully deterministic.
8343
- const memoOpts =
8344
- (this.options.includePrerelease && FLAG_INCLUDE_PRERELEASE) |
8345
- (this.options.loose && FLAG_LOOSE);
8346
- const memoKey = memoOpts + ':' + range;
8347
- const cached = cache.get(memoKey);
8348
- if (cached) {
8349
- return cached
8350
- }
8351
-
8352
- const loose = this.options.loose;
8353
- // `1.2.3 - 1.2.4` => `>=1.2.3 <=1.2.4`
8354
- const hr = loose ? re[t.HYPHENRANGELOOSE] : re[t.HYPHENRANGE];
8355
- range = range.replace(hr, hyphenReplace(this.options.includePrerelease));
8356
- debug('hyphen replace', range);
8357
-
8358
- // `> 1.2.3 < 1.2.5` => `>1.2.3 <1.2.5`
8359
- range = range.replace(re[t.COMPARATORTRIM], comparatorTrimReplace);
8360
- debug('comparator trim', range);
8361
-
8362
- // `~ 1.2.3` => `~1.2.3`
8363
- range = range.replace(re[t.TILDETRIM], tildeTrimReplace);
8364
- debug('tilde trim', range);
8365
-
8366
- // `^ 1.2.3` => `^1.2.3`
8367
- range = range.replace(re[t.CARETTRIM], caretTrimReplace);
8368
- debug('caret trim', range);
8369
-
8370
- // At this point, the range is completely trimmed and
8371
- // ready to be split into comparators.
8372
-
8373
- let rangeList = range
8374
- .split(' ')
8375
- .map(comp => parseComparator(comp, this.options))
8376
- .join(' ')
8377
- .split(/\s+/)
8378
- // >=0.0.0 is equivalent to *
8379
- .map(comp => replaceGTE0(comp, this.options));
8380
-
8381
- if (loose) {
8382
- // in loose mode, throw out any that are not valid comparators
8383
- rangeList = rangeList.filter(comp => {
8384
- debug('loose invalid filter', comp, this.options);
8385
- return !!comp.match(re[t.COMPARATORLOOSE])
8386
- });
8387
- }
8388
- debug('range list', rangeList);
8389
-
8390
- // if any comparators are the null set, then replace with JUST null set
8391
- // if more than one comparator, remove any * comparators
8392
- // also, don't include the same comparator more than once
8393
- const rangeMap = new Map();
8394
- const comparators = rangeList.map(comp => new Comparator(comp, this.options));
8395
- for (const comp of comparators) {
8396
- if (isNullSet(comp)) {
8397
- return [comp]
8398
- }
8399
- rangeMap.set(comp.value, comp);
8400
- }
8401
- if (rangeMap.size > 1 && rangeMap.has('')) {
8402
- rangeMap.delete('');
8403
- }
8404
-
8405
- const result = [...rangeMap.values()];
8406
- cache.set(memoKey, result);
8407
- return result
8408
- }
8409
-
8410
- intersects (range, options) {
8411
- if (!(range instanceof Range)) {
8412
- throw new TypeError('a Range is required')
8413
- }
8414
-
8415
- return this.set.some((thisComparators) => {
8416
- return (
8417
- isSatisfiable(thisComparators, options) &&
8418
- range.set.some((rangeComparators) => {
8419
- return (
8420
- isSatisfiable(rangeComparators, options) &&
8421
- thisComparators.every((thisComparator) => {
8422
- return rangeComparators.every((rangeComparator) => {
8423
- return thisComparator.intersects(rangeComparator, options)
8424
- })
8425
- })
8426
- )
8427
- })
8428
- )
8429
- })
8430
- }
8431
-
8432
- // if ANY of the sets match ALL of its comparators, then pass
8433
- test (version) {
8434
- if (!version) {
8435
- return false
8436
- }
8437
-
8438
- if (typeof version === 'string') {
8439
- try {
8440
- version = new SemVer(version, this.options);
8441
- } catch (er) {
8442
- return false
8443
- }
8444
- }
8445
-
8446
- for (let i = 0; i < this.set.length; i++) {
8447
- if (testSet(this.set[i], version, this.options)) {
8448
- return true
8449
- }
8450
- }
8451
- return false
8452
- }
8453
- }
8454
-
8455
- range = Range;
8456
-
8457
- const LRU = requireLrucache();
8458
- const cache = new LRU();
8459
-
8460
- const parseOptions = requireParseOptions();
8461
- const Comparator = requireComparator();
8462
- const debug = requireDebug();
8463
- const SemVer = requireSemver$1();
8464
- const {
8465
- safeRe: re,
8466
- src,
8467
- t,
8468
- comparatorTrimReplace,
8469
- tildeTrimReplace,
8470
- caretTrimReplace,
8471
- } = requireRe();
8472
- const { FLAG_INCLUDE_PRERELEASE, FLAG_LOOSE } = requireConstants();
8473
-
8474
- // unbounded global build-metadata stripper used by parseRange
8475
- const BUILDSTRIPRE = new RegExp(src[t.BUILD], 'g');
8476
-
8477
- const isNullSet = c => c.value === '<0.0.0-0';
8478
- const isAny = c => c.value === '';
8479
-
8480
- // take a set of comparators and determine whether there
8481
- // exists a version which can satisfy it
8482
- const isSatisfiable = (comparators, options) => {
8483
- let result = true;
8484
- const remainingComparators = comparators.slice();
8485
- let testComparator = remainingComparators.pop();
8486
-
8487
- while (result && remainingComparators.length) {
8488
- result = remainingComparators.every((otherComparator) => {
8489
- return testComparator.intersects(otherComparator, options)
8490
- });
8491
-
8492
- testComparator = remainingComparators.pop();
8493
- }
8494
-
8495
- return result
8496
- };
8497
-
8498
- // comprised of xranges, tildes, stars, and gtlt's at this point.
8499
- // already replaced the hyphen ranges
8500
- // turn into a set of JUST comparators.
8501
- const parseComparator = (comp, options) => {
8502
- comp = comp.replace(re[t.BUILD], '');
8503
- debug('comp', comp, options);
8504
- comp = replaceCarets(comp, options);
8505
- debug('caret', comp);
8506
- comp = replaceTildes(comp, options);
8507
- debug('tildes', comp);
8508
- comp = replaceXRanges(comp, options);
8509
- debug('xrange', comp);
8510
- comp = replaceStars(comp, options);
8511
- debug('stars', comp);
8512
- return comp
8513
- };
8514
-
8515
- const isX = id => !id || id.toLowerCase() === 'x' || id === '*';
8516
-
8517
- // ~, ~> --> * (any, kinda silly)
8518
- // ~2, ~2.x, ~2.x.x, ~>2, ~>2.x ~>2.x.x --> >=2.0.0 <3.0.0-0
8519
- // ~2.0, ~2.0.x, ~>2.0, ~>2.0.x --> >=2.0.0 <2.1.0-0
8520
- // ~1.2, ~1.2.x, ~>1.2, ~>1.2.x --> >=1.2.0 <1.3.0-0
8521
- // ~1.2.3, ~>1.2.3 --> >=1.2.3 <1.3.0-0
8522
- // ~1.2.0, ~>1.2.0 --> >=1.2.0 <1.3.0-0
8523
- // ~0.0.1 --> >=0.0.1 <0.1.0-0
8524
- const replaceTildes = (comp, options) => {
8525
- return comp
8526
- .trim()
8527
- .split(/\s+/)
8528
- .map((c) => replaceTilde(c, options))
8529
- .join(' ')
8530
- };
8531
-
8532
- const replaceTilde = (comp, options) => {
8533
- const r = options.loose ? re[t.TILDELOOSE] : re[t.TILDE];
8534
- return comp.replace(r, (_, M, m, p, pr) => {
8535
- debug('tilde', comp, _, M, m, p, pr);
8536
- let ret;
8537
-
8538
- if (isX(M)) {
8539
- ret = '';
8540
- } else if (isX(m)) {
8541
- ret = `>=${M}.0.0 <${+M + 1}.0.0-0`;
8542
- } else if (isX(p)) {
8543
- // ~1.2 == >=1.2.0 <1.3.0-0
8544
- ret = `>=${M}.${m}.0 <${M}.${+m + 1}.0-0`;
8545
- } else if (pr) {
8546
- debug('replaceTilde pr', pr);
8547
- ret = `>=${M}.${m}.${p}-${pr
8548
- } <${M}.${+m + 1}.0-0`;
8549
- } else {
8550
- // ~1.2.3 == >=1.2.3 <1.3.0-0
8551
- ret = `>=${M}.${m}.${p
8552
- } <${M}.${+m + 1}.0-0`;
8553
- }
8554
-
8555
- debug('tilde return', ret);
8556
- return ret
8557
- })
8558
- };
8559
-
8560
- // ^ --> * (any, kinda silly)
8561
- // ^2, ^2.x, ^2.x.x --> >=2.0.0 <3.0.0-0
8562
- // ^2.0, ^2.0.x --> >=2.0.0 <3.0.0-0
8563
- // ^1.2, ^1.2.x --> >=1.2.0 <2.0.0-0
8564
- // ^1.2.3 --> >=1.2.3 <2.0.0-0
8565
- // ^1.2.0 --> >=1.2.0 <2.0.0-0
8566
- // ^0.0.1 --> >=0.0.1 <0.0.2-0
8567
- // ^0.1.0 --> >=0.1.0 <0.2.0-0
8568
- const replaceCarets = (comp, options) => {
8569
- return comp
8570
- .trim()
8571
- .split(/\s+/)
8572
- .map((c) => replaceCaret(c, options))
8573
- .join(' ')
8574
- };
8575
-
8576
- const replaceCaret = (comp, options) => {
8577
- debug('caret', comp, options);
8578
- const r = options.loose ? re[t.CARETLOOSE] : re[t.CARET];
8579
- const z = options.includePrerelease ? '-0' : '';
8580
- return comp.replace(r, (_, M, m, p, pr) => {
8581
- debug('caret', comp, _, M, m, p, pr);
8582
- let ret;
8583
-
8584
- if (isX(M)) {
8585
- ret = '';
8586
- } else if (isX(m)) {
8587
- ret = `>=${M}.0.0${z} <${+M + 1}.0.0-0`;
8588
- } else if (isX(p)) {
8589
- if (M === '0') {
8590
- ret = `>=${M}.${m}.0${z} <${M}.${+m + 1}.0-0`;
8591
- } else {
8592
- ret = `>=${M}.${m}.0${z} <${+M + 1}.0.0-0`;
8593
- }
8594
- } else if (pr) {
8595
- debug('replaceCaret pr', pr);
8596
- if (M === '0') {
8597
- if (m === '0') {
8598
- ret = `>=${M}.${m}.${p}-${pr
8599
- } <${M}.${m}.${+p + 1}-0`;
8600
- } else {
8601
- ret = `>=${M}.${m}.${p}-${pr
8602
- } <${M}.${+m + 1}.0-0`;
8603
- }
8604
- } else {
8605
- ret = `>=${M}.${m}.${p}-${pr
8606
- } <${+M + 1}.0.0-0`;
8607
- }
8608
- } else {
8609
- debug('no pr');
8610
- if (M === '0') {
8611
- if (m === '0') {
8612
- ret = `>=${M}.${m}.${p
8613
- }${z} <${M}.${m}.${+p + 1}-0`;
8614
- } else {
8615
- ret = `>=${M}.${m}.${p
8616
- }${z} <${M}.${+m + 1}.0-0`;
8617
- }
8618
- } else {
8619
- ret = `>=${M}.${m}.${p
8620
- } <${+M + 1}.0.0-0`;
8621
- }
8622
- }
8623
-
8624
- debug('caret return', ret);
8625
- return ret
8626
- })
8627
- };
8628
-
8629
- const replaceXRanges = (comp, options) => {
8630
- debug('replaceXRanges', comp, options);
8631
- return comp
8632
- .split(/\s+/)
8633
- .map((c) => replaceXRange(c, options))
8634
- .join(' ')
8635
- };
8636
-
8637
- const replaceXRange = (comp, options) => {
8638
- comp = comp.trim();
8639
- const r = options.loose ? re[t.XRANGELOOSE] : re[t.XRANGE];
8640
- return comp.replace(r, (ret, gtlt, M, m, p, pr) => {
8641
- debug('xRange', comp, ret, gtlt, M, m, p, pr);
8642
- const xM = isX(M);
8643
- const xm = xM || isX(m);
8644
- const xp = xm || isX(p);
8645
- const anyX = xp;
8646
-
8647
- if (gtlt === '=' && anyX) {
8648
- gtlt = '';
8649
- }
8650
-
8651
- // if we're including prereleases in the match, then we need
8652
- // to fix this to -0, the lowest possible prerelease value
8653
- pr = options.includePrerelease ? '-0' : '';
8654
-
8655
- if (xM) {
8656
- if (gtlt === '>' || gtlt === '<') {
8657
- // nothing is allowed
8658
- ret = '<0.0.0-0';
8659
- } else {
8660
- // nothing is forbidden
8661
- ret = '*';
8662
- }
8663
- } else if (gtlt && anyX) {
8664
- // we know patch is an x, because we have any x at all.
8665
- // replace X with 0
8666
- if (xm) {
8667
- m = 0;
8668
- }
8669
- p = 0;
8670
-
8671
- if (gtlt === '>') {
8672
- // >1 => >=2.0.0
8673
- // >1.2 => >=1.3.0
8674
- gtlt = '>=';
8675
- if (xm) {
8676
- M = +M + 1;
8677
- m = 0;
8678
- p = 0;
8679
- } else {
8680
- m = +m + 1;
8681
- p = 0;
8682
- }
8683
- } else if (gtlt === '<=') {
8684
- // <=0.7.x is actually <0.8.0, since any 0.7.x should
8685
- // pass. Similarly, <=7.x is actually <8.0.0, etc.
8686
- gtlt = '<';
8687
- if (xm) {
8688
- M = +M + 1;
8689
- } else {
8690
- m = +m + 1;
8691
- }
8692
- }
8693
-
8694
- if (gtlt === '<') {
8695
- pr = '-0';
8696
- }
8697
-
8698
- ret = `${gtlt + M}.${m}.${p}${pr}`;
8699
- } else if (xm) {
8700
- ret = `>=${M}.0.0${pr} <${+M + 1}.0.0-0`;
8701
- } else if (xp) {
8702
- ret = `>=${M}.${m}.0${pr
8703
- } <${M}.${+m + 1}.0-0`;
8704
- }
8705
-
8706
- debug('xRange return', ret);
8707
-
8708
- return ret
8709
- })
8710
- };
8711
-
8712
- // Because * is AND-ed with everything else in the comparator,
8713
- // and '' means "any version", just remove the *s entirely.
8714
- const replaceStars = (comp, options) => {
8715
- debug('replaceStars', comp, options);
8716
- // Looseness is ignored here. star is always as loose as it gets!
8717
- return comp
8718
- .trim()
8719
- .replace(re[t.STAR], '')
8720
- };
8721
-
8722
- const replaceGTE0 = (comp, options) => {
8723
- debug('replaceGTE0', comp, options);
8724
- return comp
8725
- .trim()
8726
- .replace(re[options.includePrerelease ? t.GTE0PRE : t.GTE0], '')
8727
- };
8728
-
8729
- // This function is passed to string.replace(re[t.HYPHENRANGE])
8730
- // M, m, patch, prerelease, build
8731
- // 1.2 - 3.4.5 => >=1.2.0 <=3.4.5
8732
- // 1.2.3 - 3.4 => >=1.2.0 <3.5.0-0 Any 3.4.x will do
8733
- // 1.2 - 3.4 => >=1.2.0 <3.5.0-0
8734
- // TODO build?
8735
- const hyphenReplace = incPr => ($0,
8736
- from, fM, fm, fp, fpr, fb,
8737
- to, tM, tm, tp, tpr) => {
8738
- if (isX(fM)) {
8739
- from = '';
8740
- } else if (isX(fm)) {
8741
- from = `>=${fM}.0.0${incPr ? '-0' : ''}`;
8742
- } else if (isX(fp)) {
8743
- from = `>=${fM}.${fm}.0${incPr ? '-0' : ''}`;
8744
- } else if (fpr) {
8745
- from = `>=${from}`;
8746
- } else {
8747
- from = `>=${from}${incPr ? '-0' : ''}`;
8748
- }
8749
-
8750
- if (isX(tM)) {
8751
- to = '';
8752
- } else if (isX(tm)) {
8753
- to = `<${+tM + 1}.0.0-0`;
8754
- } else if (isX(tp)) {
8755
- to = `<${tM}.${+tm + 1}.0-0`;
8756
- } else if (tpr) {
8757
- to = `<=${tM}.${tm}.${tp}-${tpr}`;
8758
- } else if (incPr) {
8759
- to = `<${tM}.${tm}.${+tp + 1}-0`;
8760
- } else {
8761
- to = `<=${to}`;
8762
- }
8763
-
8764
- return `${from} ${to}`.trim()
8765
- };
8766
-
8767
- const testSet = (set, version, options) => {
8768
- for (let i = 0; i < set.length; i++) {
8769
- if (!set[i].test(version)) {
8770
- return false
8771
- }
8772
- }
8773
-
8774
- if (version.prerelease.length && !options.includePrerelease) {
8775
- // Find the set of versions that are allowed to have prereleases
8776
- // For example, ^1.2.3-pr.1 desugars to >=1.2.3-pr.1 <2.0.0
8777
- // That should allow `1.2.3-pr.2` to pass.
8778
- // However, `1.2.4-alpha.notready` should NOT be allowed,
8779
- // even though it's within the range set by the comparators.
8780
- for (let i = 0; i < set.length; i++) {
8781
- debug(set[i].semver);
8782
- if (set[i].semver === Comparator.ANY) {
8783
- continue
8784
- }
8785
-
8786
- if (set[i].semver.prerelease.length > 0) {
8787
- const allowed = set[i].semver;
8788
- if (allowed.major === version.major &&
8789
- allowed.minor === version.minor &&
8790
- allowed.patch === version.patch) {
8791
- return true
8792
- }
8793
- }
8794
- }
8795
-
8796
- // Version has a -pre, but it's not one of the ones we like.
8797
- return false
8798
- }
8799
-
8800
- return true
8801
- };
8802
- return range;
8803
- }
8804
-
8805
- var comparator;
8806
- var hasRequiredComparator;
8807
-
8808
- function requireComparator () {
8809
- if (hasRequiredComparator) return comparator;
8810
- hasRequiredComparator = 1;
8811
-
8812
- const ANY = Symbol('SemVer ANY');
8813
- // hoisted class for cyclic dependency
8814
- class Comparator {
8815
- static get ANY () {
8816
- return ANY
8817
- }
8818
-
8819
- constructor (comp, options) {
8820
- options = parseOptions(options);
8821
-
8822
- if (comp instanceof Comparator) {
8823
- if (comp.loose === !!options.loose) {
8824
- return comp
8825
- } else {
8826
- comp = comp.value;
8827
- }
8828
- }
8829
-
8830
- comp = comp.trim().split(/\s+/).join(' ');
8831
- debug('comparator', comp, options);
8832
- this.options = options;
8833
- this.loose = !!options.loose;
8834
- this.parse(comp);
8835
-
8836
- if (this.semver === ANY) {
8837
- this.value = '';
8838
- } else {
8839
- this.value = this.operator + this.semver.version;
8840
- }
8841
-
8842
- debug('comp', this);
8843
- }
8844
-
8845
- parse (comp) {
8846
- const r = this.options.loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR];
8847
- const m = comp.match(r);
8848
-
8849
- if (!m) {
8850
- throw new TypeError(`Invalid comparator: ${comp}`)
8851
- }
8852
-
8853
- this.operator = m[1] !== undefined ? m[1] : '';
8854
- if (this.operator === '=') {
8855
- this.operator = '';
8856
- }
8857
-
8858
- // if it literally is just '>' or '' then allow anything.
8859
- if (!m[2]) {
8860
- this.semver = ANY;
8861
- } else {
8862
- this.semver = new SemVer(m[2], this.options.loose);
8863
- }
8864
- }
8865
-
8866
- toString () {
8867
- return this.value
8868
- }
8869
-
8870
- test (version) {
8871
- debug('Comparator.test', version, this.options.loose);
8872
-
8873
- if (this.semver === ANY || version === ANY) {
8874
- return true
8875
- }
8876
-
8877
- if (typeof version === 'string') {
8878
- try {
8879
- version = new SemVer(version, this.options);
8880
- } catch (er) {
8881
- return false
8882
- }
8883
- }
8884
-
8885
- return cmp(version, this.operator, this.semver, this.options)
8886
- }
8887
-
8888
- intersects (comp, options) {
8889
- if (!(comp instanceof Comparator)) {
8890
- throw new TypeError('a Comparator is required')
8891
- }
8892
-
8893
- if (this.operator === '') {
8894
- if (this.value === '') {
8895
- return true
8896
- }
8897
- return new Range(comp.value, options).test(this.value)
8898
- } else if (comp.operator === '') {
8899
- if (comp.value === '') {
8900
- return true
8901
- }
8902
- return new Range(this.value, options).test(comp.semver)
8903
- }
8904
-
8905
- options = parseOptions(options);
8906
-
8907
- // Special cases where nothing can possibly be lower
8908
- if (options.includePrerelease &&
8909
- (this.value === '<0.0.0-0' || comp.value === '<0.0.0-0')) {
8910
- return false
8911
- }
8912
- if (!options.includePrerelease &&
8913
- (this.value.startsWith('<0.0.0') || comp.value.startsWith('<0.0.0'))) {
8914
- return false
8915
- }
8916
-
8917
- // Same direction increasing (> or >=)
8918
- if (this.operator.startsWith('>') && comp.operator.startsWith('>')) {
8919
- return true
8920
- }
8921
- // Same direction decreasing (< or <=)
8922
- if (this.operator.startsWith('<') && comp.operator.startsWith('<')) {
8923
- return true
8924
- }
8925
- // same SemVer and both sides are inclusive (<= or >=)
8926
- if (
8927
- (this.semver.version === comp.semver.version) &&
8928
- this.operator.includes('=') && comp.operator.includes('=')) {
8929
- return true
8930
- }
8931
- // opposite directions less than
8932
- if (cmp(this.semver, '<', comp.semver, options) &&
8933
- this.operator.startsWith('>') && comp.operator.startsWith('<')) {
8934
- return true
8935
- }
8936
- // opposite directions greater than
8937
- if (cmp(this.semver, '>', comp.semver, options) &&
8938
- this.operator.startsWith('<') && comp.operator.startsWith('>')) {
8939
- return true
8940
- }
8941
- return false
8942
- }
8943
- }
8944
-
8945
- comparator = Comparator;
8946
-
8947
- const parseOptions = requireParseOptions();
8948
- const { safeRe: re, t } = requireRe();
8949
- const cmp = requireCmp();
8950
- const debug = requireDebug();
8951
- const SemVer = requireSemver$1();
8952
- const Range = requireRange();
8953
- return comparator;
8954
- }
8955
-
8956
- var satisfies_1;
8957
- var hasRequiredSatisfies;
8958
-
8959
- function requireSatisfies () {
8960
- if (hasRequiredSatisfies) return satisfies_1;
8961
- hasRequiredSatisfies = 1;
8962
-
8963
- const Range = requireRange();
8964
- const satisfies = (version, range, options) => {
8965
- try {
8966
- range = new Range(range, options);
8967
- } catch (er) {
8968
- return false
8969
- }
8970
- return range.test(version)
8971
- };
8972
- satisfies_1 = satisfies;
8973
- return satisfies_1;
8974
- }
8975
-
8976
- var toComparators_1;
8977
- var hasRequiredToComparators;
8978
-
8979
- function requireToComparators () {
8980
- if (hasRequiredToComparators) return toComparators_1;
8981
- hasRequiredToComparators = 1;
8982
-
8983
- const Range = requireRange();
8984
-
8985
- // Mostly just for testing and legacy API reasons
8986
- const toComparators = (range, options) =>
8987
- new Range(range, options).set
8988
- .map(comp => comp.map(c => c.value).join(' ').trim().split(' '));
8989
-
8990
- toComparators_1 = toComparators;
8991
- return toComparators_1;
8992
- }
8993
-
8994
- var maxSatisfying_1;
8995
- var hasRequiredMaxSatisfying;
8996
-
8997
- function requireMaxSatisfying () {
8998
- if (hasRequiredMaxSatisfying) return maxSatisfying_1;
8999
- hasRequiredMaxSatisfying = 1;
9000
-
9001
- const SemVer = requireSemver$1();
9002
- const Range = requireRange();
9003
-
9004
- const maxSatisfying = (versions, range, options) => {
9005
- let max = null;
9006
- let maxSV = null;
9007
- let rangeObj = null;
9008
- try {
9009
- rangeObj = new Range(range, options);
9010
- } catch (er) {
9011
- return null
9012
- }
9013
- versions.forEach((v) => {
9014
- if (rangeObj.test(v)) {
9015
- // satisfies(v, range, options)
9016
- if (!max || maxSV.compare(v) === -1) {
9017
- // compare(max, v, true)
9018
- max = v;
9019
- maxSV = new SemVer(max, options);
9020
- }
9021
- }
9022
- });
9023
- return max
9024
- };
9025
- maxSatisfying_1 = maxSatisfying;
9026
- return maxSatisfying_1;
9027
- }
9028
-
9029
- var minSatisfying_1;
9030
- var hasRequiredMinSatisfying;
9031
-
9032
- function requireMinSatisfying () {
9033
- if (hasRequiredMinSatisfying) return minSatisfying_1;
9034
- hasRequiredMinSatisfying = 1;
9035
-
9036
- const SemVer = requireSemver$1();
9037
- const Range = requireRange();
9038
- const minSatisfying = (versions, range, options) => {
9039
- let min = null;
9040
- let minSV = null;
9041
- let rangeObj = null;
9042
- try {
9043
- rangeObj = new Range(range, options);
9044
- } catch (er) {
9045
- return null
9046
- }
9047
- versions.forEach((v) => {
9048
- if (rangeObj.test(v)) {
9049
- // satisfies(v, range, options)
9050
- if (!min || minSV.compare(v) === 1) {
9051
- // compare(min, v, true)
9052
- min = v;
9053
- minSV = new SemVer(min, options);
9054
- }
9055
- }
9056
- });
9057
- return min
9058
- };
9059
- minSatisfying_1 = minSatisfying;
9060
- return minSatisfying_1;
9061
- }
9062
-
9063
- var minVersion_1;
9064
- var hasRequiredMinVersion;
9065
-
9066
- function requireMinVersion () {
9067
- if (hasRequiredMinVersion) return minVersion_1;
9068
- hasRequiredMinVersion = 1;
9069
-
9070
- const SemVer = requireSemver$1();
9071
- const Range = requireRange();
9072
- const gt = requireGt();
9073
-
9074
- const minVersion = (range, loose) => {
9075
- range = new Range(range, loose);
9076
-
9077
- let minver = new SemVer('0.0.0');
9078
- if (range.test(minver)) {
9079
- return minver
9080
- }
9081
-
9082
- minver = new SemVer('0.0.0-0');
9083
- if (range.test(minver)) {
9084
- return minver
9085
- }
9086
-
9087
- minver = null;
9088
- for (let i = 0; i < range.set.length; ++i) {
9089
- const comparators = range.set[i];
9090
-
9091
- let setMin = null;
9092
- comparators.forEach((comparator) => {
9093
- // Clone to avoid manipulating the comparator's semver object.
9094
- const compver = new SemVer(comparator.semver.version);
9095
- switch (comparator.operator) {
9096
- case '>':
9097
- if (compver.prerelease.length === 0) {
9098
- compver.patch++;
9099
- } else {
9100
- compver.prerelease.push(0);
9101
- }
9102
- compver.raw = compver.format();
9103
- /* fallthrough */
9104
- case '':
9105
- case '>=':
9106
- if (!setMin || gt(compver, setMin)) {
9107
- setMin = compver;
9108
- }
9109
- break
9110
- case '<':
9111
- case '<=':
9112
- /* Ignore maximum versions */
9113
- break
9114
- /* istanbul ignore next */
9115
- default:
9116
- throw new Error(`Unexpected operation: ${comparator.operator}`)
9117
- }
9118
- });
9119
- if (setMin && (!minver || gt(minver, setMin))) {
9120
- minver = setMin;
9121
- }
9122
- }
9123
-
9124
- if (minver && range.test(minver)) {
9125
- return minver
9126
- }
9127
-
9128
- return null
9129
- };
9130
- minVersion_1 = minVersion;
9131
- return minVersion_1;
9132
- }
9133
-
9134
- var valid;
9135
- var hasRequiredValid;
9136
-
9137
- function requireValid () {
9138
- if (hasRequiredValid) return valid;
9139
- hasRequiredValid = 1;
9140
-
9141
- const Range = requireRange();
9142
- const validRange = (range, options) => {
9143
- try {
9144
- // Return '*' instead of '' so that truthiness works.
9145
- // This will throw if it's invalid anyway
9146
- return new Range(range, options).range || '*'
9147
- } catch (er) {
9148
- return null
9149
- }
9150
- };
9151
- valid = validRange;
9152
- return valid;
9153
- }
9154
-
9155
- var outside_1;
9156
- var hasRequiredOutside;
9157
-
9158
- function requireOutside () {
9159
- if (hasRequiredOutside) return outside_1;
9160
- hasRequiredOutside = 1;
9161
-
9162
- const SemVer = requireSemver$1();
9163
- const Comparator = requireComparator();
9164
- const { ANY } = Comparator;
9165
- const Range = requireRange();
9166
- const satisfies = requireSatisfies();
9167
- const gt = requireGt();
9168
- const lt = requireLt();
9169
- const lte = requireLte();
9170
- const gte = requireGte();
9171
-
9172
- const outside = (version, range, hilo, options) => {
9173
- version = new SemVer(version, options);
9174
- range = new Range(range, options);
9175
-
9176
- let gtfn, ltefn, ltfn, comp, ecomp;
9177
- switch (hilo) {
9178
- case '>':
9179
- gtfn = gt;
9180
- ltefn = lte;
9181
- ltfn = lt;
9182
- comp = '>';
9183
- ecomp = '>=';
9184
- break
9185
- case '<':
9186
- gtfn = lt;
9187
- ltefn = gte;
9188
- ltfn = gt;
9189
- comp = '<';
9190
- ecomp = '<=';
9191
- break
9192
- default:
9193
- throw new TypeError('Must provide a hilo val of "<" or ">"')
9194
- }
9195
-
9196
- // If it satisfies the range it is not outside
9197
- if (satisfies(version, range, options)) {
9198
- return false
9199
- }
9200
-
9201
- // From now on, variable terms are as if we're in "gtr" mode.
9202
- // but note that everything is flipped for the "ltr" function.
9203
-
9204
- for (let i = 0; i < range.set.length; ++i) {
9205
- const comparators = range.set[i];
9206
-
9207
- let high = null;
9208
- let low = null;
9209
-
9210
- comparators.forEach((comparator) => {
9211
- if (comparator.semver === ANY) {
9212
- comparator = new Comparator('>=0.0.0');
9213
- }
9214
- high = high || comparator;
9215
- low = low || comparator;
9216
- if (gtfn(comparator.semver, high.semver, options)) {
9217
- high = comparator;
9218
- } else if (ltfn(comparator.semver, low.semver, options)) {
9219
- low = comparator;
9220
- }
9221
- });
9222
-
9223
- // If the edge version comparator has a operator then our version
9224
- // isn't outside it
9225
- if (high.operator === comp || high.operator === ecomp) {
9226
- return false
9227
- }
9228
-
9229
- // If the lowest version comparator has an operator and our version
9230
- // is less than it then it isn't higher than the range
9231
- if ((!low.operator || low.operator === comp) &&
9232
- ltefn(version, low.semver)) {
9233
- return false
9234
- } else if (low.operator === ecomp && ltfn(version, low.semver)) {
9235
- return false
9236
- }
9237
- }
9238
- return true
9239
- };
9240
-
9241
- outside_1 = outside;
9242
- return outside_1;
9243
- }
9244
-
9245
- var gtr_1;
9246
- var hasRequiredGtr;
9247
-
9248
- function requireGtr () {
9249
- if (hasRequiredGtr) return gtr_1;
9250
- hasRequiredGtr = 1;
9251
-
9252
- // Determine if version is greater than all the versions possible in the range.
9253
- const outside = requireOutside();
9254
- const gtr = (version, range, options) => outside(version, range, '>', options);
9255
- gtr_1 = gtr;
9256
- return gtr_1;
9257
- }
9258
-
9259
- var ltr_1;
9260
- var hasRequiredLtr;
9261
-
9262
- function requireLtr () {
9263
- if (hasRequiredLtr) return ltr_1;
9264
- hasRequiredLtr = 1;
9265
-
9266
- const outside = requireOutside();
9267
- // Determine if version is less than all the versions possible in the range
9268
- const ltr = (version, range, options) => outside(version, range, '<', options);
9269
- ltr_1 = ltr;
9270
- return ltr_1;
9271
- }
9272
-
9273
- var intersects_1;
9274
- var hasRequiredIntersects;
9275
-
9276
- function requireIntersects () {
9277
- if (hasRequiredIntersects) return intersects_1;
9278
- hasRequiredIntersects = 1;
9279
-
9280
- const Range = requireRange();
9281
- const intersects = (r1, r2, options) => {
9282
- r1 = new Range(r1, options);
9283
- r2 = new Range(r2, options);
9284
- return r1.intersects(r2, options)
9285
- };
9286
- intersects_1 = intersects;
9287
- return intersects_1;
9288
- }
9289
-
9290
- var simplify;
9291
- var hasRequiredSimplify;
9292
-
9293
- function requireSimplify () {
9294
- if (hasRequiredSimplify) return simplify;
9295
- hasRequiredSimplify = 1;
9296
-
9297
- // given a set of versions and a range, create a "simplified" range
9298
- // that includes the same versions that the original range does
9299
- // If the original range is shorter than the simplified one, return that.
9300
- const satisfies = requireSatisfies();
9301
- const compare = requireCompare();
9302
- simplify = (versions, range, options) => {
9303
- const set = [];
9304
- let first = null;
9305
- let prev = null;
9306
- const v = versions.sort((a, b) => compare(a, b, options));
9307
- for (const version of v) {
9308
- const included = satisfies(version, range, options);
9309
- if (included) {
9310
- prev = version;
9311
- if (!first) {
9312
- first = version;
9313
- }
9314
- } else {
9315
- if (prev) {
9316
- set.push([first, prev]);
9317
- }
9318
- prev = null;
9319
- first = null;
9320
- }
9321
- }
9322
- if (first) {
9323
- set.push([first, null]);
9324
- }
9325
-
9326
- const ranges = [];
9327
- for (const [min, max] of set) {
9328
- if (min === max) {
9329
- ranges.push(min);
9330
- } else if (!max && min === v[0]) {
9331
- ranges.push('*');
9332
- } else if (!max) {
9333
- ranges.push(`>=${min}`);
9334
- } else if (min === v[0]) {
9335
- ranges.push(`<=${max}`);
9336
- } else {
9337
- ranges.push(`${min} - ${max}`);
9338
- }
9339
- }
9340
- const simplified = ranges.join(' || ');
9341
- const original = typeof range.raw === 'string' ? range.raw : String(range);
9342
- return simplified.length < original.length ? simplified : range
9343
- };
9344
- return simplify;
9345
- }
9346
-
9347
- var subset_1;
9348
- var hasRequiredSubset;
9349
-
9350
- function requireSubset () {
9351
- if (hasRequiredSubset) return subset_1;
9352
- hasRequiredSubset = 1;
9353
-
9354
- const Range = requireRange();
9355
- const Comparator = requireComparator();
9356
- const { ANY } = Comparator;
9357
- const satisfies = requireSatisfies();
9358
- const compare = requireCompare();
9359
-
9360
- // Complex range `r1 || r2 || ...` is a subset of `R1 || R2 || ...` iff:
9361
- // - Every simple range `r1, r2, ...` is a null set, OR
9362
- // - Every simple range `r1, r2, ...` which is not a null set is a subset of
9363
- // some `R1, R2, ...`
9364
- //
9365
- // Simple range `c1 c2 ...` is a subset of simple range `C1 C2 ...` iff:
9366
- // - If c is only the ANY comparator
9367
- // - If C is only the ANY comparator, return true
9368
- // - Else if in prerelease mode, return false
9369
- // - else replace c with `[>=0.0.0]`
9370
- // - If C is only the ANY comparator
9371
- // - if in prerelease mode, return true
9372
- // - else replace C with `[>=0.0.0]`
9373
- // - Let EQ be the set of = comparators in c
9374
- // - If EQ is more than one, return true (null set)
9375
- // - Let GT be the highest > or >= comparator in c
9376
- // - Let LT be the lowest < or <= comparator in c
9377
- // - If GT and LT, and GT.semver > LT.semver, return true (null set)
9378
- // - If any C is a = range, and GT or LT are set, return false
9379
- // - If EQ
9380
- // - If GT, and EQ does not satisfy GT, return true (null set)
9381
- // - If LT, and EQ does not satisfy LT, return true (null set)
9382
- // - If EQ satisfies every C, return true
9383
- // - Else return false
9384
- // - If GT
9385
- // - If GT.semver is lower than any > or >= comp in C, return false
9386
- // - If GT is >=, and GT.semver does not satisfy every C, return false
9387
- // - If GT.semver has a prerelease, and not in prerelease mode
9388
- // - If no C has a prerelease and the GT.semver tuple, return false
9389
- // - If LT
9390
- // - If LT.semver is greater than any < or <= comp in C, return false
9391
- // - If LT is <=, and LT.semver does not satisfy every C, return false
9392
- // - If LT.semver has a prerelease, and not in prerelease mode
9393
- // - If no C has a prerelease and the LT.semver tuple, return false
9394
- // - Else return true
9395
-
9396
- const subset = (sub, dom, options = {}) => {
9397
- if (sub === dom) {
9398
- return true
9399
- }
9400
-
9401
- sub = new Range(sub, options);
9402
- dom = new Range(dom, options);
9403
- let sawNonNull = false;
9404
-
9405
- OUTER: for (const simpleSub of sub.set) {
9406
- for (const simpleDom of dom.set) {
9407
- const isSub = simpleSubset(simpleSub, simpleDom, options);
9408
- sawNonNull = sawNonNull || isSub !== null;
9409
- if (isSub) {
9410
- continue OUTER
9411
- }
9412
- }
9413
- // the null set is a subset of everything, but null simple ranges in
9414
- // a complex range should be ignored. so if we saw a non-null range,
9415
- // then we know this isn't a subset, but if EVERY simple range was null,
9416
- // then it is a subset.
9417
- if (sawNonNull) {
9418
- return false
9419
- }
9420
- }
9421
- return true
9422
- };
9423
-
9424
- const minimumVersionWithPreRelease = [new Comparator('>=0.0.0-0')];
9425
- const minimumVersion = [new Comparator('>=0.0.0')];
9426
-
9427
- const simpleSubset = (sub, dom, options) => {
9428
- if (sub === dom) {
9429
- return true
9430
- }
9431
-
9432
- if (sub.length === 1 && sub[0].semver === ANY) {
9433
- if (dom.length === 1 && dom[0].semver === ANY) {
9434
- return true
9435
- } else if (options.includePrerelease) {
9436
- sub = minimumVersionWithPreRelease;
9437
- } else {
9438
- sub = minimumVersion;
9439
- }
9440
- }
9441
-
9442
- if (dom.length === 1 && dom[0].semver === ANY) {
9443
- if (options.includePrerelease) {
9444
- return true
9445
- } else {
9446
- dom = minimumVersion;
9447
- }
9448
- }
9449
-
9450
- const eqSet = new Set();
9451
- let gt, lt;
9452
- for (const c of sub) {
9453
- if (c.operator === '>' || c.operator === '>=') {
9454
- gt = higherGT(gt, c, options);
9455
- } else if (c.operator === '<' || c.operator === '<=') {
9456
- lt = lowerLT(lt, c, options);
9457
- } else {
9458
- eqSet.add(c.semver);
9459
- }
9460
- }
9461
-
9462
- if (eqSet.size > 1) {
9463
- return null
9464
- }
9465
-
9466
- let gtltComp;
9467
- if (gt && lt) {
9468
- gtltComp = compare(gt.semver, lt.semver, options);
9469
- if (gtltComp > 0) {
9470
- return null
9471
- } else if (gtltComp === 0 && (gt.operator !== '>=' || lt.operator !== '<=')) {
9472
- return null
9473
- }
9474
- }
9475
-
9476
- // will iterate one or zero times
9477
- for (const eq of eqSet) {
9478
- if (gt && !satisfies(eq, String(gt), options)) {
9479
- return null
9480
- }
9481
-
9482
- if (lt && !satisfies(eq, String(lt), options)) {
9483
- return null
9484
- }
9485
-
9486
- for (const c of dom) {
9487
- if (!satisfies(eq, String(c), options)) {
9488
- return false
9489
- }
9490
- }
9491
-
9492
- return true
9493
- }
9494
-
9495
- let higher, lower;
9496
- let hasDomLT, hasDomGT;
9497
- // if the subset has a prerelease, we need a comparator in the superset
9498
- // with the same tuple and a prerelease, or it's not a subset
9499
- let needDomLTPre = lt &&
9500
- !options.includePrerelease &&
9501
- lt.semver.prerelease.length ? lt.semver : false;
9502
- let needDomGTPre = gt &&
9503
- !options.includePrerelease &&
9504
- gt.semver.prerelease.length ? gt.semver : false;
9505
- // exception: <1.2.3-0 is the same as <1.2.3
9506
- if (needDomLTPre && needDomLTPre.prerelease.length === 1 &&
9507
- lt.operator === '<' && needDomLTPre.prerelease[0] === 0) {
9508
- needDomLTPre = false;
9509
- }
9510
-
9511
- for (const c of dom) {
9512
- hasDomGT = hasDomGT || c.operator === '>' || c.operator === '>=';
9513
- hasDomLT = hasDomLT || c.operator === '<' || c.operator === '<=';
9514
- if (gt) {
9515
- if (needDomGTPre) {
9516
- if (c.semver.prerelease && c.semver.prerelease.length &&
9517
- c.semver.major === needDomGTPre.major &&
9518
- c.semver.minor === needDomGTPre.minor &&
9519
- c.semver.patch === needDomGTPre.patch) {
9520
- needDomGTPre = false;
9521
- }
9522
- }
9523
- if (c.operator === '>' || c.operator === '>=') {
9524
- higher = higherGT(gt, c, options);
9525
- if (higher === c && higher !== gt) {
9526
- return false
9527
- }
9528
- } else if (gt.operator === '>=' && !c.test(gt.semver)) {
9529
- return false
9530
- }
9531
- }
9532
- if (lt) {
9533
- if (needDomLTPre) {
9534
- if (c.semver.prerelease && c.semver.prerelease.length &&
9535
- c.semver.major === needDomLTPre.major &&
9536
- c.semver.minor === needDomLTPre.minor &&
9537
- c.semver.patch === needDomLTPre.patch) {
9538
- needDomLTPre = false;
9539
- }
9540
- }
9541
- if (c.operator === '<' || c.operator === '<=') {
9542
- lower = lowerLT(lt, c, options);
9543
- if (lower === c && lower !== lt) {
9544
- return false
9545
- }
9546
- } else if (lt.operator === '<=' && !c.test(lt.semver)) {
9547
- return false
9548
- }
9549
- }
9550
- if (!c.operator && (lt || gt) && gtltComp !== 0) {
9551
- return false
9552
- }
9553
- }
9554
-
9555
- // if there was a < or >, and nothing in the dom, then must be false
9556
- // UNLESS it was limited by another range in the other direction.
9557
- // Eg, >1.0.0 <1.0.1 is still a subset of <2.0.0
9558
- if (gt && hasDomLT && !lt && gtltComp !== 0) {
9559
- return false
9560
- }
9561
-
9562
- if (lt && hasDomGT && !gt && gtltComp !== 0) {
9563
- return false
9564
- }
9565
-
9566
- // we needed a prerelease range in a specific tuple, but didn't get one
9567
- // then this isn't a subset. eg >=1.2.3-pre is not a subset of >=1.0.0,
9568
- // because it includes prereleases in the 1.2.3 tuple
9569
- if (needDomGTPre || needDomLTPre) {
9570
- return false
9571
- }
9572
-
9573
- return true
9574
- };
9575
-
9576
- // >=1.2.3 is lower than >1.2.3
9577
- const higherGT = (a, b, options) => {
9578
- if (!a) {
9579
- return b
9580
- }
9581
- const comp = compare(a.semver, b.semver, options);
9582
- return comp > 0 ? a
9583
- : comp < 0 ? b
9584
- : b.operator === '>' && a.operator === '>=' ? b
9585
- : a
9586
- };
9587
-
9588
- // <=1.2.3 is higher than <1.2.3
9589
- const lowerLT = (a, b, options) => {
9590
- if (!a) {
9591
- return b
9592
- }
9593
- const comp = compare(a.semver, b.semver, options);
9594
- return comp < 0 ? a
9595
- : comp > 0 ? b
9596
- : b.operator === '<' && a.operator === '<=' ? b
9597
- : a
9598
- };
9599
-
9600
- subset_1 = subset;
9601
- return subset_1;
9602
- }
9603
-
9604
- var semver;
9605
- var hasRequiredSemver;
9606
-
9607
- function requireSemver () {
9608
- if (hasRequiredSemver) return semver;
9609
- hasRequiredSemver = 1;
9610
-
9611
- // just pre-load all the stuff that index.js lazily exports
9612
- const internalRe = requireRe();
9613
- const constants = requireConstants();
9614
- const SemVer = requireSemver$1();
9615
- const identifiers = requireIdentifiers();
9616
- const parse = requireParse();
9617
- const valid = requireValid$1();
9618
- const clean = requireClean();
9619
- const inc = requireInc();
9620
- const diff = requireDiff();
9621
- const major = requireMajor();
9622
- const minor = requireMinor();
9623
- const patch = requirePatch();
9624
- const prerelease = requirePrerelease();
9625
- const compare = requireCompare();
9626
- const rcompare = requireRcompare();
9627
- const compareLoose = requireCompareLoose();
9628
- const compareBuild = requireCompareBuild();
9629
- const sort = requireSort();
9630
- const rsort = requireRsort();
9631
- const gt = requireGt();
9632
- const lt = requireLt();
9633
- const eq = requireEq();
9634
- const neq = requireNeq();
9635
- const gte = requireGte();
9636
- const lte = requireLte();
9637
- const cmp = requireCmp();
9638
- const coerce = requireCoerce();
9639
- const truncate = requireTruncate();
9640
- const Comparator = requireComparator();
9641
- const Range = requireRange();
9642
- const satisfies = requireSatisfies();
9643
- const toComparators = requireToComparators();
9644
- const maxSatisfying = requireMaxSatisfying();
9645
- const minSatisfying = requireMinSatisfying();
9646
- const minVersion = requireMinVersion();
9647
- const validRange = requireValid();
9648
- const outside = requireOutside();
9649
- const gtr = requireGtr();
9650
- const ltr = requireLtr();
9651
- const intersects = requireIntersects();
9652
- const simplifyRange = requireSimplify();
9653
- const subset = requireSubset();
9654
- semver = {
9655
- parse,
9656
- valid,
9657
- clean,
9658
- inc,
9659
- diff,
9660
- major,
9661
- minor,
9662
- patch,
9663
- prerelease,
9664
- compare,
9665
- rcompare,
9666
- compareLoose,
9667
- compareBuild,
9668
- sort,
9669
- rsort,
9670
- gt,
9671
- lt,
9672
- eq,
9673
- neq,
9674
- gte,
9675
- lte,
9676
- cmp,
9677
- coerce,
9678
- truncate,
9679
- Comparator,
9680
- Range,
9681
- satisfies,
9682
- toComparators,
9683
- maxSatisfying,
9684
- minSatisfying,
9685
- minVersion,
9686
- validRange,
9687
- outside,
9688
- gtr,
9689
- ltr,
9690
- intersects,
9691
- simplifyRange,
9692
- subset,
9693
- SemVer,
9694
- re: internalRe.re,
9695
- src: internalRe.src,
9696
- tokens: internalRe.t,
9697
- SEMVER_SPEC_VERSION: constants.SEMVER_SPEC_VERSION,
9698
- RELEASE_TYPES: constants.RELEASE_TYPES,
9699
- compareIdentifiers: identifiers.compareIdentifiers,
9700
- rcompareIdentifiers: identifiers.rcompareIdentifiers,
9701
- };
9702
- return semver;
9703
- }
9704
-
9705
- var semverExports = requireSemver();
9706
-
9707
6967
  const BASIC_INFO_MAX_BYTES = 10 * 1024 * 1024;
9708
6968
  const BASIC_INFO_MAX_PIXELS = 40_000_000;
9709
6969
  /**
@@ -9747,11 +7007,11 @@ function validateBasicInfoPath(raw) {
9747
7007
  */
9748
7008
  function parseMiniappBasicInfo(value, sdkVersion = '0.8.2') {
9749
7009
  sdkVersion = sdkVersion.trim();
9750
- if (!semverExports.valid(sdkVersion) || sdkVersion.startsWith('v') || sdkVersion.includes('+'))
7010
+ if (!index.semverExports.valid(sdkVersion) || sdkVersion.startsWith('v') || sdkVersion.includes('+'))
9751
7011
  throw new Error('manifest.sdkVersion 必须是合法 SemVer');
9752
7012
  const fields = ['name', 'icon', 'coverImages'];
9753
7013
  const present = fields.filter((key) => Object.prototype.hasOwnProperty.call(value, key));
9754
- if (!present.length && semverExports.lt(sdkVersion, '0.8.2'))
7014
+ if (!present.length && index.semverExports.lt(sdkVersion, '0.8.2'))
9755
7015
  return undefined;
9756
7016
  if (present.length !== fields.length)
9757
7017
  throw new Error('请配置 heybox.name、heybox.icon、heybox.coverImages,或运行 remote bind/dev/remote deploy 迁移已发布资料');
@@ -9845,6 +7105,31 @@ function parseMiniappBindAppIds(value, options = {}) {
9845
7105
  return Object.freeze(appIds);
9846
7106
  }
9847
7107
 
7108
+ /** 小程序简介最大长度(Unicode code point),与服务端截断口径一致。 */
7109
+ const MINIAPP_DESC_MAX_LENGTH = 200;
7110
+ /**
7111
+ * 校验并规范化 `package.json#heybox.desc` / `manifest.desc`。
7112
+ *
7113
+ * @param value - 原始声明;未声明时为 `undefined`。
7114
+ * @param sourceLabel - 错误消息中的字段来源,默认 `package.json#heybox.desc`。
7115
+ * @returns 去除首尾空白后的简介;未声明或为空串时返回 `undefined`。
7116
+ * @throws `Error` 非字符串、超过 200 个字符,或包含除换行外的控制字符时抛出。
7117
+ */
7118
+ function parseMiniappDesc(value, sourceLabel = 'package.json#heybox.desc') {
7119
+ if (value === undefined)
7120
+ return undefined;
7121
+ if (typeof value !== 'string')
7122
+ throw new Error(`${sourceLabel} 必须是字符串`);
7123
+ const desc = value.replace(/^\p{White_Space}+|\p{White_Space}+$/gu, '');
7124
+ if (!desc)
7125
+ return undefined;
7126
+ if (Array.from(desc).length > MINIAPP_DESC_MAX_LENGTH)
7127
+ throw new Error(`${sourceLabel} 不能超过 ${MINIAPP_DESC_MAX_LENGTH} 个字符`);
7128
+ if (/[\p{Cc}\p{Cf}\p{Zl}\p{Zp}]/u.test(desc.replace(/\n/g, '')))
7129
+ throw new Error(`${sourceLabel} 不能包含控制字符`);
7130
+ return desc;
7131
+ }
7132
+
9848
7133
  const MINIAPP_PERMISSION_KEYS = MINI_PROGRAM_PERMISSION_KEYS;
9849
7134
  function parseMiniappPermissions(value, options) {
9850
7135
  const sourceLabel = options.sourceLabel ?? 'package.json#heybox.permissions';
@@ -9894,7 +7179,7 @@ function parseMiniappPermissions(value, options) {
9894
7179
  return { declared: true, permissions: permissions };
9895
7180
  }
9896
7181
  function requiresExplicitPermissions(sdkVersion) {
9897
- const parsed = semverExports.parse(sdkVersion);
7182
+ const parsed = index.semverExports.parse(sdkVersion);
9898
7183
  if (!parsed)
9899
7184
  throw new Error(`sdkVersion 必须是合法 SemVer:${sdkVersion}`);
9900
7185
  return parsed.major > 0 || parsed.minor >= 9;
@@ -10083,6 +7368,7 @@ function validateMiniappManifestForDeploy(manifest) {
10083
7368
  throw new Error('manifest.category 缺失,请在 package.json#heybox.category 声明 tool、game 或 other 后重新构建');
10084
7369
  }
10085
7370
  const bindAppIds = parseMiniappBindAppIds(manifest.bindAppIds, { sourceLabel: 'manifest.bindAppIds' });
7371
+ const desc = parseMiniappDesc(manifest.desc, 'manifest.desc');
10086
7372
  return {
10087
7373
  version,
10088
7374
  sdkVersion,
@@ -10094,6 +7380,7 @@ function validateMiniappManifestForDeploy(manifest) {
10094
7380
  ...(window === undefined ? {} : { window }),
10095
7381
  ...(bindAppIds.length === 0 ? {} : { bindAppIds }),
10096
7382
  ...(category === undefined ? {} : { category }),
7383
+ ...(desc === undefined ? {} : { desc }),
10097
7384
  };
10098
7385
  }
10099
7386
  function validateGeneratedCompanions(value) {
@@ -10250,7 +7537,7 @@ function validateSdkVersion(version, sourceLabel = 'sdkVersion') {
10250
7537
  throw new Error(`${sourceLabel} 必须是合法 SemVer:${String(version)}`);
10251
7538
  }
10252
7539
  const normalized = version.trim();
10253
- const parsed = semverExports.parse(normalized);
7540
+ const parsed = index.semverExports.parse(normalized);
10254
7541
  if (!parsed || parsed.version !== normalized || parsed.build.length > 0) {
10255
7542
  throw new Error(`${sourceLabel} 必须是合法 SemVer:${normalized}`);
10256
7543
  }
@@ -10267,7 +7554,7 @@ function getMiniappManifestVersionError(version) {
10267
7554
  return `必须是合法 SemVer:${String(version)}`;
10268
7555
  }
10269
7556
  const normalized = version.trim();
10270
- const parsed = semverExports.parse(normalized);
7557
+ const parsed = index.semverExports.parse(normalized);
10271
7558
  if (!parsed) {
10272
7559
  return `必须是合法 SemVer:${normalized}`;
10273
7560
  }
@@ -19412,6 +16699,7 @@ exports.parseMiniProgramLocalDevGrant = parseMiniProgramLocalDevGrant;
19412
16699
  exports.parseMiniProgramRuntimePermissions = parseMiniProgramRuntimePermissions;
19413
16700
  exports.parseMiniappBasicInfo = parseMiniappBasicInfo;
19414
16701
  exports.parseMiniappManifestJson = parseMiniappManifestJson;
16702
+ exports.parseMiniappPermissions = parseMiniappPermissions;
19415
16703
  exports.prepareMiniappArtifactFiles = prepareMiniappArtifactFiles;
19416
16704
  exports.readMiniappBindAppIdsFromPackageJson = readMiniappBindAppIdsFromPackageJson;
19417
16705
  exports.readMiniappCategoryFromPackageJson = readMiniappCategoryFromPackageJson;
@@ -19420,9 +16708,9 @@ exports.readMiniappPlatformsFromPackageJson = readMiniappPlatformsFromPackageJso
19420
16708
  exports.readMiniappWindowFromPackageJson = readMiniappWindowFromPackageJson;
19421
16709
  exports.readMiniappWorkspaceCardsFromPackageJson = readMiniappWorkspaceCardsFromPackageJson;
19422
16710
  exports.relativePathContainsNodeModulesSegment = relativePathContainsNodeModulesSegment;
19423
- exports.requireSemver = requireSemver;
19424
16711
  exports.resolveMiniappSdkVersion = resolveMiniappSdkVersion;
19425
16712
  exports.resolveMiniappUploadSessionFiles = resolveMiniappUploadSessionFiles;
16713
+ exports.serializeMiniProgramDevelopmentSnapshot = serializeMiniProgramDevelopmentSnapshot;
19426
16714
  exports.shouldSkipMiniappPlatformCspFromEnv = shouldSkipMiniappPlatformCspFromEnv;
19427
16715
  exports.shouldUploadDistFile = shouldUploadDistFile;
19428
16716
  exports.validateBasicInfoPath = validateBasicInfoPath;