@comate/zulu 0.0.9 → 0.0.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/comate-engine/bin/comate.js +10 -0
- package/comate-engine/fallbackServer.js +1 -0
- package/comate-engine/node_modules/@comate/plugin-engine/dist/index.d.ts +188 -0
- package/comate-engine/node_modules/@comate/plugin-engine/dist/index.js +36 -0
- package/comate-engine/node_modules/@comate/plugin-engine/package.json +49 -0
- package/comate-engine/node_modules/@comate/plugin-host/bin.js +44 -0
- package/comate-engine/node_modules/@comate/plugin-host/dist/index.js +1 -0
- package/comate-engine/node_modules/@comate/plugin-host/dist/main.d.ts +14 -0
- package/comate-engine/node_modules/@comate/plugin-host/dist/main.js +9 -0
- package/comate-engine/node_modules/@comate/plugin-host/dist/user-Btg63hPI.js +36 -0
- package/comate-engine/node_modules/@comate/plugin-host/package.json +47 -0
- package/comate-engine/node_modules/@comate/plugin-shared-internals/dist/index.d.ts +2849 -0
- package/comate-engine/node_modules/@comate/plugin-shared-internals/dist/index.js +36 -0
- package/comate-engine/node_modules/@comate/plugin-shared-internals/package.json +72 -0
- package/comate-engine/node_modules/@comate/preview-proxy/bin/preview.js +13 -0
- package/comate-engine/node_modules/@comate/preview-proxy/dist/index.js +350 -0
- package/comate-engine/node_modules/@comate/preview-proxy/package.json +83 -0
- package/comate-engine/node_modules/@comate/preview-proxy/static/comate-preview-injector.css +1 -0
- package/comate-engine/node_modules/@comate/preview-proxy/static/comate-preview-injector.js +2 -0
- package/comate-engine/node_modules/@comate/preview-proxy/static/comate-preview-injector.js.LICENSE.txt +58 -0
- package/comate-engine/node_modules/compare-versions/LICENSE +21 -0
- package/comate-engine/node_modules/compare-versions/README.md +133 -0
- package/comate-engine/node_modules/compare-versions/lib/esm/compare.d.ts +19 -0
- package/comate-engine/node_modules/compare-versions/lib/esm/compare.js +44 -0
- package/comate-engine/node_modules/compare-versions/lib/esm/compare.js.map +1 -0
- package/comate-engine/node_modules/compare-versions/lib/esm/compareVersions.d.ts +8 -0
- package/comate-engine/node_modules/compare-versions/lib/esm/compareVersions.js +29 -0
- package/comate-engine/node_modules/compare-versions/lib/esm/compareVersions.js.map +1 -0
- package/comate-engine/node_modules/compare-versions/lib/esm/index.d.ts +5 -0
- package/comate-engine/node_modules/compare-versions/lib/esm/index.js +5 -0
- package/comate-engine/node_modules/compare-versions/lib/esm/index.js.map +1 -0
- package/comate-engine/node_modules/compare-versions/lib/esm/satisfies.d.ts +14 -0
- package/comate-engine/node_modules/compare-versions/lib/esm/satisfies.js +66 -0
- package/comate-engine/node_modules/compare-versions/lib/esm/satisfies.js.map +1 -0
- package/comate-engine/node_modules/compare-versions/lib/esm/utils.d.ts +7 -0
- package/comate-engine/node_modules/compare-versions/lib/esm/utils.js +37 -0
- package/comate-engine/node_modules/compare-versions/lib/esm/utils.js.map +1 -0
- package/comate-engine/node_modules/compare-versions/lib/esm/validate.d.ts +28 -0
- package/comate-engine/node_modules/compare-versions/lib/esm/validate.js +31 -0
- package/comate-engine/node_modules/compare-versions/lib/esm/validate.js.map +1 -0
- package/comate-engine/node_modules/compare-versions/lib/umd/index.js +216 -0
- package/comate-engine/node_modules/compare-versions/lib/umd/index.js.map +1 -0
- package/comate-engine/node_modules/compare-versions/package.json +45 -0
- package/comate-engine/node_modules/compare-versions/src/compare.ts +54 -0
- package/comate-engine/node_modules/compare-versions/src/compareVersions.ts +31 -0
- package/comate-engine/node_modules/compare-versions/src/index.ts +5 -0
- package/comate-engine/node_modules/compare-versions/src/satisfies.ts +69 -0
- package/comate-engine/node_modules/compare-versions/src/utils.ts +50 -0
- package/comate-engine/node_modules/compare-versions/src/validate.ts +36 -0
- package/comate-engine/node_modules/pkce-challenge/LICENSE +21 -0
- package/comate-engine/node_modules/pkce-challenge/README.md +55 -0
- package/comate-engine/node_modules/pkce-challenge/dist/index.browser.d.ts +19 -0
- package/comate-engine/node_modules/pkce-challenge/dist/index.browser.js +72 -0
- package/comate-engine/node_modules/pkce-challenge/dist/index.node.cjs +80 -0
- package/comate-engine/node_modules/pkce-challenge/dist/index.node.d.cts +19 -0
- package/comate-engine/node_modules/pkce-challenge/dist/index.node.d.ts +19 -0
- package/comate-engine/node_modules/pkce-challenge/dist/index.node.js +75 -0
- package/comate-engine/node_modules/pkce-challenge/package.json +58 -0
- package/comate-engine/node_modules/web-streams-polyfill/LICENSE +22 -0
- package/comate-engine/node_modules/web-streams-polyfill/README.md +119 -0
- package/comate-engine/node_modules/web-streams-polyfill/dist/polyfill.es5.js +8 -0
- package/comate-engine/node_modules/web-streams-polyfill/dist/polyfill.js +8 -0
- package/comate-engine/node_modules/web-streams-polyfill/dist/ponyfill.es5.js +8 -0
- package/comate-engine/node_modules/web-streams-polyfill/dist/ponyfill.es5.mjs +8 -0
- package/comate-engine/node_modules/web-streams-polyfill/dist/ponyfill.js +8 -0
- package/comate-engine/node_modules/web-streams-polyfill/dist/ponyfill.mjs +8 -0
- package/comate-engine/node_modules/web-streams-polyfill/package.json +98 -0
- package/comate-engine/node_modules/web-streams-polyfill/types/polyfill.d.ts +28 -0
- package/comate-engine/node_modules/web-streams-polyfill/types/ponyfill.d.ts +809 -0
- package/comate-engine/node_modules/web-streams-polyfill/types/tsdoc-metadata.json +11 -0
- package/comate-engine/package.json +91 -0
- package/comate-engine/plugins/aiscan/assets/icon.svg +12 -0
- package/comate-engine/plugins/aiscan/dist/index.js +53861 -0
- package/comate-engine/plugins/aiscan/package.json +67 -0
- package/comate-engine/plugins/appdev/assets/icon.png +0 -0
- package/comate-engine/plugins/appdev/dist/help.md +12 -0
- package/comate-engine/plugins/appdev/dist/index.d.ts +2 -0
- package/comate-engine/plugins/appdev/dist/index.js +194 -0
- package/comate-engine/plugins/appdev/dist/providers/err.d.ts +8 -0
- package/comate-engine/plugins/appdev/dist/providers/err.js +37 -0
- package/comate-engine/plugins/appdev/dist/providers/fallback.d.ts +5 -0
- package/comate-engine/plugins/appdev/dist/providers/fallback.js +28 -0
- package/comate-engine/plugins/appdev/dist/providers/help.d.ts +8 -0
- package/comate-engine/plugins/appdev/dist/providers/help.js +19 -0
- package/comate-engine/plugins/appdev/dist/providers/medusa.d.ts +8 -0
- package/comate-engine/plugins/appdev/dist/providers/medusa.js +39 -0
- package/comate-engine/plugins/appdev/dist/providers/qa.d.ts +8 -0
- package/comate-engine/plugins/appdev/dist/providers/qa.js +33 -0
- package/comate-engine/plugins/appdev/package.json +67 -0
- package/comate-engine/plugins/bfc/assets/bfc-icon.png +0 -0
- package/comate-engine/plugins/bfc/dist/config/config.d.ts +4 -0
- package/comate-engine/plugins/bfc/dist/config/config.js +4 -0
- package/comate-engine/plugins/bfc/dist/help.md +11 -0
- package/comate-engine/plugins/bfc/dist/index.d.ts +2 -0
- package/comate-engine/plugins/bfc/dist/index.js +452 -0
- package/comate-engine/plugins/bfc/dist/providers/bfcInstructMode.d.ts +8 -0
- package/comate-engine/plugins/bfc/dist/providers/bfcInstructMode.js +77 -0
- package/comate-engine/plugins/bfc/dist/providers/genAbnormalCode.d.ts +8 -0
- package/comate-engine/plugins/bfc/dist/providers/genAbnormalCode.js +71 -0
- package/comate-engine/plugins/bfc/dist/providers/genBfcCode.d.ts +8 -0
- package/comate-engine/plugins/bfc/dist/providers/genBfcCode.js +74 -0
- package/comate-engine/plugins/bfc/dist/providers/getBatchCases.d.ts +10 -0
- package/comate-engine/plugins/bfc/dist/providers/getBatchCases.js +71 -0
- package/comate-engine/plugins/bfc/dist/providers/help.d.ts +8 -0
- package/comate-engine/plugins/bfc/dist/providers/help.js +19 -0
- package/comate-engine/plugins/bfc/dist/service/generateService.d.ts +14 -0
- package/comate-engine/plugins/bfc/dist/service/generateService.js +27 -0
- package/comate-engine/plugins/bfc/package.json +85 -0
- package/comate-engine/plugins/bpm/assets/bpm.png +0 -0
- package/comate-engine/plugins/bpm/dist/index.js +313 -0
- package/comate-engine/plugins/bpm/package.json +65 -0
- package/comate-engine/plugins/casebuilder/assets/icon.svg +1 -0
- package/comate-engine/plugins/casebuilder/dist/help.md +33 -0
- package/comate-engine/plugins/casebuilder/dist/index.js +837 -0
- package/comate-engine/plugins/casebuilder/package.json +80 -0
- package/comate-engine/plugins/centrino/assets/icon.png +0 -0
- package/comate-engine/plugins/centrino/dist/help.md +30 -0
- package/comate-engine/plugins/centrino/dist/index.js +1046 -0
- package/comate-engine/plugins/centrino/package.json +68 -0
- package/comate-engine/plugins/cnap/assets/cnap.png +0 -0
- package/comate-engine/plugins/cnap/dist/help.md +11 -0
- package/comate-engine/plugins/cnap/dist/index.js +171 -0
- package/comate-engine/plugins/cnap/package.json +65 -0
- package/comate-engine/plugins/demo-feature/assets/icon.svg +1 -0
- package/comate-engine/plugins/demo-feature/dist/help.md +1 -0
- package/comate-engine/plugins/demo-feature/dist/index.d.ts +2 -0
- package/comate-engine/plugins/demo-feature/dist/index.js +36008 -0
- package/comate-engine/plugins/demo-feature/dist/providers/codeQuery.d.ts +12 -0
- package/comate-engine/plugins/demo-feature/dist/providers/codeQuery.js +23 -0
- package/comate-engine/plugins/demo-feature/dist/providers/codeSearch.d.ts +8 -0
- package/comate-engine/plugins/demo-feature/dist/providers/codeSearch.js +26 -0
- package/comate-engine/plugins/demo-feature/dist/providers/config.d.ts +13 -0
- package/comate-engine/plugins/demo-feature/dist/providers/config.js +25 -0
- package/comate-engine/plugins/demo-feature/dist/providers/context.d.ts +10 -0
- package/comate-engine/plugins/demo-feature/dist/providers/context.js +49 -0
- package/comate-engine/plugins/demo-feature/dist/providers/debugAgent.d.ts +8 -0
- package/comate-engine/plugins/demo-feature/dist/providers/debugAgent.js +65 -0
- package/comate-engine/plugins/demo-feature/dist/providers/explainCode.d.ts +9 -0
- package/comate-engine/plugins/demo-feature/dist/providers/explainCode.js +24 -0
- package/comate-engine/plugins/demo-feature/dist/providers/fallback.d.ts +5 -0
- package/comate-engine/plugins/demo-feature/dist/providers/fallback.js +23 -0
- package/comate-engine/plugins/demo-feature/dist/providers/file.d.ts +13 -0
- package/comate-engine/plugins/demo-feature/dist/providers/file.js +36 -0
- package/comate-engine/plugins/demo-feature/dist/providers/help.d.ts +8 -0
- package/comate-engine/plugins/demo-feature/dist/providers/help.js +19 -0
- package/comate-engine/plugins/demo-feature/dist/providers/information.d.ts +13 -0
- package/comate-engine/plugins/demo-feature/dist/providers/information.js +23 -0
- package/comate-engine/plugins/demo-feature/dist/providers/knowledge.d.ts +15 -0
- package/comate-engine/plugins/demo-feature/dist/providers/knowledge.js +71 -0
- package/comate-engine/plugins/demo-feature/dist/providers/log.d.ts +12 -0
- package/comate-engine/plugins/demo-feature/dist/providers/log.js +21 -0
- package/comate-engine/plugins/demo-feature/dist/providers/onlyCode.d.ts +8 -0
- package/comate-engine/plugins/demo-feature/dist/providers/onlyCode.js +23 -0
- package/comate-engine/plugins/demo-feature/dist/providers/pluginConfig.d.ts +8 -0
- package/comate-engine/plugins/demo-feature/dist/providers/pluginConfig.js +47 -0
- package/comate-engine/plugins/demo-feature/dist/providers/prompt.d.ts +7 -0
- package/comate-engine/plugins/demo-feature/dist/providers/prompt.js +7 -0
- package/comate-engine/plugins/demo-feature/dist/providers/ragProvider.d.ts +8 -0
- package/comate-engine/plugins/demo-feature/dist/providers/ragProvider.js +17 -0
- package/comate-engine/plugins/demo-feature/dist/providers/render.d.ts +8 -0
- package/comate-engine/plugins/demo-feature/dist/providers/render.js +75 -0
- package/comate-engine/plugins/demo-feature/dist/providers/renderJsx.d.ts +10 -0
- package/comate-engine/plugins/demo-feature/dist/providers/renderJsx.js +173 -0
- package/comate-engine/plugins/demo-feature/dist/providers/section.d.ts +8 -0
- package/comate-engine/plugins/demo-feature/dist/providers/section.js +136 -0
- package/comate-engine/plugins/demo-feature/dist/providers/selectedKnowledge.d.ts +12 -0
- package/comate-engine/plugins/demo-feature/dist/providers/selectedKnowledge.js +17 -0
- package/comate-engine/plugins/demo-feature/dist/providers/streaming.d.ts +8 -0
- package/comate-engine/plugins/demo-feature/dist/providers/streaming.js +29 -0
- package/comate-engine/plugins/demo-feature/dist/providers/userDetail.d.ts +8 -0
- package/comate-engine/plugins/demo-feature/dist/providers/userDetail.js +28 -0
- package/comate-engine/plugins/demo-feature/package.json +214 -0
- package/comate-engine/plugins/demo-timer/assets/icon.svg +2 -0
- package/comate-engine/plugins/demo-timer/dist/index.js +463 -0
- package/comate-engine/plugins/demo-timer/package.json +73 -0
- package/comate-engine/plugins/dev-tools/assets/icon.png +0 -0
- package/comate-engine/plugins/dev-tools/dist/help.md +18 -0
- package/comate-engine/plugins/dev-tools/dist/index.js +166160 -0
- package/comate-engine/plugins/dev-tools/package.json +95 -0
- package/comate-engine/plugins/devaux/assets/icon.svg +1 -0
- package/comate-engine/plugins/devaux/dist/help.md +41 -0
- package/comate-engine/plugins/devaux/dist/index.js +73829 -0
- package/comate-engine/plugins/devaux/dist/static/tree-sitter-cpp.wasm +0 -0
- package/comate-engine/plugins/devaux/dist/static/tree-sitter-go.wasm +0 -0
- package/comate-engine/plugins/devaux/dist/static/tree-sitter.wasm +0 -0
- package/comate-engine/plugins/devaux/dist/tree-sitter.wasm +0 -0
- package/comate-engine/plugins/devaux/package.json +83 -0
- package/comate-engine/plugins/f2c/assets/icon.svg +11 -0
- package/comate-engine/plugins/f2c/dist/help.md +13 -0
- package/comate-engine/plugins/f2c/dist/index.js +64551 -0
- package/comate-engine/plugins/f2c/package.json +56 -0
- package/comate-engine/plugins/fcnap/assets/icon.png +0 -0
- package/comate-engine/plugins/fcnap/dist/help.md +9 -0
- package/comate-engine/plugins/fcnap/dist/index.js +105 -0
- package/comate-engine/plugins/fcnap/package.json +50 -0
- package/comate-engine/plugins/front-end-skills/assets/icon.svg +1 -0
- package/comate-engine/plugins/front-end-skills/dist/help.md +17 -0
- package/comate-engine/plugins/front-end-skills/dist/index.js +8172 -0
- package/comate-engine/plugins/front-end-skills/package.json +79 -0
- package/comate-engine/plugins/gdp/assets/icon.png +0 -0
- package/comate-engine/plugins/gdp/dist/help.md +11 -0
- package/comate-engine/plugins/gdp/dist/index.js +53065 -0
- package/comate-engine/plugins/gdp/package.json +79 -0
- package/comate-engine/plugins/git/assets/git.svg +1 -0
- package/comate-engine/plugins/git/assets/icon.svg +1 -0
- package/comate-engine/plugins/git/dist/help.md +7 -0
- package/comate-engine/plugins/git/dist/index.js +32675 -0
- package/comate-engine/plugins/git/package.json +91 -0
- package/comate-engine/plugins/harmonyos/assets/harmonyos.png +0 -0
- package/comate-engine/plugins/harmonyos/dist/index.js +78 -0
- package/comate-engine/plugins/harmonyos/package.json +37 -0
- package/comate-engine/plugins/iapi/assets/icon.png +0 -0
- package/comate-engine/plugins/iapi/dist/help.md +13 -0
- package/comate-engine/plugins/iapi/dist/index.js +458 -0
- package/comate-engine/plugins/iapi/dist/static/lang/tree-sitter-go.wasm +0 -0
- package/comate-engine/plugins/iapi/dist/static/lang/tree-sitter-java.wasm +0 -0
- package/comate-engine/plugins/iapi/dist/static/tree-sitter-go.wasm +0 -0
- package/comate-engine/plugins/iapi/dist/static/tree-sitter-java.wasm +0 -0
- package/comate-engine/plugins/iapi/dist/tree-sitter.wasm +0 -0
- package/comate-engine/plugins/iapi/package.json +102 -0
- package/comate-engine/plugins/icafe/assets/icafe.svg +1 -0
- package/comate-engine/plugins/icafe/dist/help.md +5 -0
- package/comate-engine/plugins/icafe/dist/index.js +885 -0
- package/comate-engine/plugins/icafe/package.json +74 -0
- package/comate-engine/plugins/ievalue/assets/iEValue.svg +10 -0
- package/comate-engine/plugins/ievalue/dist/index.js +2920 -0
- package/comate-engine/plugins/ievalue/package.json +88 -0
- package/comate-engine/plugins/ipipe/assets/iPipePlugin.png +0 -0
- package/comate-engine/plugins/ipipe/dist/help.md +15 -0
- package/comate-engine/plugins/ipipe/dist/index.js +7264 -0
- package/comate-engine/plugins/ipipe/package.json +62 -0
- package/comate-engine/plugins/jarvis/assets/icon.svg +1 -0
- package/comate-engine/plugins/jarvis/dist/help.md +17 -0
- package/comate-engine/plugins/jarvis/dist/index.js +140416 -0
- package/comate-engine/plugins/jarvis/package.json +93 -0
- package/comate-engine/plugins/mapsearch/assets/mapsearchicon.png +0 -0
- package/comate-engine/plugins/mapsearch/dist/help.md +4 -0
- package/comate-engine/plugins/mapsearch/dist/index.js +145 -0
- package/comate-engine/plugins/mapsearch/package.json +53 -0
- package/comate-engine/plugins/paddle/assets/icon.png +0 -0
- package/comate-engine/plugins/paddle/assets/paconvert-3.0.1-py3-none-any.whl +0 -0
- package/comate-engine/plugins/paddle/dist/help.md +31 -0
- package/comate-engine/plugins/paddle/dist/index.js +1011 -0
- package/comate-engine/plugins/paddle/package.json +129 -0
- package/comate-engine/plugins/robot/assets/Robot.png +0 -0
- package/comate-engine/plugins/robot/dist/index.js +288 -0
- package/comate-engine/plugins/robot/package.json +67 -0
- package/comate-engine/plugins/security/assets/comate.png +0 -0
- package/comate-engine/plugins/security/dist/index.js +18393 -0
- package/comate-engine/plugins/security/package.json +82 -0
- package/comate-engine/plugins/smartapp/assets/icon.png +0 -0
- package/comate-engine/plugins/smartapp/dist/help.md +4 -0
- package/comate-engine/plugins/smartapp/dist/index.js +113 -0
- package/comate-engine/plugins/smartapp/package.json +54 -0
- package/comate-engine/plugins/springer/assets/icon.png +0 -0
- package/comate-engine/plugins/springer/dist/help.md +4 -0
- package/comate-engine/plugins/springer/dist/index.js +94525 -0
- package/comate-engine/plugins/springer/package.json +71 -0
- package/comate-engine/plugins/testmate/assets/icon.svg +1 -0
- package/comate-engine/plugins/testmate/dist/help.md +62 -0
- package/comate-engine/plugins/testmate/dist/index.js +21483 -0
- package/comate-engine/plugins/testmate/package.json +85 -0
- package/comate-engine/plugins/tor/assets/TorPlugin.png +0 -0
- package/comate-engine/plugins/tor/dist/help.md +22 -0
- package/comate-engine/plugins/tor/dist/index.js +807 -0
- package/comate-engine/plugins/tor/package.json +99 -0
- package/comate-engine/plugins/weiyun/assets/icon.png +0 -0
- package/comate-engine/plugins/weiyun/dist/help.md +11 -0
- package/comate-engine/plugins/weiyun/dist/index.js +100491 -0
- package/comate-engine/plugins/weiyun/package.json +55 -0
- package/comate-engine/plugins/wenku/assets/icon.svg +1 -0
- package/comate-engine/plugins/wenku/dist/index.js +249 -0
- package/comate-engine/plugins/wenku/package.json +55 -0
- package/comate-engine/plugins/workcard/assets/favicon.png +0 -0
- package/comate-engine/plugins/workcard/dist/help.md +30 -0
- package/comate-engine/plugins/workcard/dist/index.js +490 -0
- package/comate-engine/plugins/workcard/package.json +95 -0
- package/comate-engine/plugins/xiaomi-aiot/assets/icon.png +0 -0
- package/comate-engine/plugins/xiaomi-aiot/dist/help.md +6 -0
- package/comate-engine/plugins/xiaomi-aiot/dist/index.js +37466 -0
- package/comate-engine/plugins/xiaomi-aiot/package.json +63 -0
- package/comate-engine/server.d.ts +3 -0
- package/comate-engine/server.js +474 -0
- package/dist/bundle/index.js +29 -58174
- package/package.json +2 -1
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Lodash <https://lodash.com/>
|
|
4
|
+
* Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
|
|
5
|
+
* Released under MIT license <https://lodash.com/license>
|
|
6
|
+
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
|
|
7
|
+
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* @license React
|
|
12
|
+
* react-dom-client.production.js
|
|
13
|
+
*
|
|
14
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
15
|
+
*
|
|
16
|
+
* This source code is licensed under the MIT license found in the
|
|
17
|
+
* LICENSE file in the root directory of this source tree.
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* @license React
|
|
22
|
+
* react-dom.production.js
|
|
23
|
+
*
|
|
24
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
25
|
+
*
|
|
26
|
+
* This source code is licensed under the MIT license found in the
|
|
27
|
+
* LICENSE file in the root directory of this source tree.
|
|
28
|
+
*/
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* @license React
|
|
32
|
+
* react-jsx-runtime.production.js
|
|
33
|
+
*
|
|
34
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
35
|
+
*
|
|
36
|
+
* This source code is licensed under the MIT license found in the
|
|
37
|
+
* LICENSE file in the root directory of this source tree.
|
|
38
|
+
*/
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* @license React
|
|
42
|
+
* react.production.js
|
|
43
|
+
*
|
|
44
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
45
|
+
*
|
|
46
|
+
* This source code is licensed under the MIT license found in the
|
|
47
|
+
* LICENSE file in the root directory of this source tree.
|
|
48
|
+
*/
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* @license React
|
|
52
|
+
* scheduler.production.js
|
|
53
|
+
*
|
|
54
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
55
|
+
*
|
|
56
|
+
* This source code is licensed under the MIT license found in the
|
|
57
|
+
* LICENSE file in the root directory of this source tree.
|
|
58
|
+
*/
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2015-2021 Ole Michelsen
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
# compare-versions
|
|
2
|
+
|
|
3
|
+
[](https://github.com/omichelsen/compare-versions/actions/workflows/ci.yml)
|
|
4
|
+
[](https://coveralls.io/github/omichelsen/compare-versions?branch=main)
|
|
5
|
+
[](https://bundlephobia.com/package/compare-versions)
|
|
6
|
+
|
|
7
|
+
Compare [semver](https://semver.org/) version strings to find greater, equal or lesser. Runs in the browser as well as Node.js/React Native etc. Has no dependencies and is [tiny](https://bundlephobia.com/package/compare-versions).
|
|
8
|
+
|
|
9
|
+
Supports the full semver specification including versions with different number of digits like `1.0.0`, `1.0`, `1` and pre-releases like `1.0.0-alpha`. Additionally supports the following variations:
|
|
10
|
+
|
|
11
|
+
- Wildcards for minor and patch version like `1.0.x` or `1.0.*`.
|
|
12
|
+
- [Chromium version numbers](https://www.chromium.org/developers/version-numbers) with 4 parts, e.g. version `25.0.1364.126`.
|
|
13
|
+
- Any leading `v` is ignored, e.g. `v1.0` is interpreted as `1.0`.
|
|
14
|
+
- Leading zero is ignored, e.g. `1.01.1` is interpreted as `1.1.1`.
|
|
15
|
+
- [npm version ranges](https://docs.npmjs.com/cli/v6/using-npm/semver#ranges), e.g. `1.2.7 || >=1.2.9 <2.0.0`
|
|
16
|
+
|
|
17
|
+
## Install
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
$ npm install compare-versions
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
__Note__: Starting from v5 the main export is now _named_ like so: `import { compareVersions } from 'compare-versions'`.
|
|
24
|
+
|
|
25
|
+
__Note__: Starting from v4 this library includes a ESM version which will automatically be selected by your bundler (webpack, parcel etc). The CJS/UMD version is `lib/umd/index.js` and the new ESM version is `lib/esm/index.js`.
|
|
26
|
+
|
|
27
|
+
## Usage
|
|
28
|
+
|
|
29
|
+
Will return `1` if first version is greater, `0` if versions are equal, and `-1` if the second version is greater:
|
|
30
|
+
|
|
31
|
+
```js
|
|
32
|
+
import { compareVersions } from 'compare-versions';
|
|
33
|
+
|
|
34
|
+
compareVersions('11.1.1', '10.0.0'); // 1
|
|
35
|
+
compareVersions('10.0.0', '10.0.0'); // 0
|
|
36
|
+
compareVersions('10.0.0', '11.1.1'); // -1
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
Can also be used for sorting:
|
|
40
|
+
|
|
41
|
+
```js
|
|
42
|
+
const versions = [
|
|
43
|
+
'1.5.19',
|
|
44
|
+
'1.2.3',
|
|
45
|
+
'1.5.5'
|
|
46
|
+
]
|
|
47
|
+
const sorted = versions.sort(compareVersions);
|
|
48
|
+
/*
|
|
49
|
+
[
|
|
50
|
+
'1.2.3',
|
|
51
|
+
'1.5.5',
|
|
52
|
+
'1.5.19'
|
|
53
|
+
]
|
|
54
|
+
*/
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
### "Human Readable" Compare
|
|
58
|
+
|
|
59
|
+
The alternative `compare` function accepts an operator which will be more familiar to humans:
|
|
60
|
+
|
|
61
|
+
```js
|
|
62
|
+
import { compare } from 'compare-versions';
|
|
63
|
+
|
|
64
|
+
compare('10.1.8', '10.0.4', '>'); // true
|
|
65
|
+
compare('10.0.1', '10.0.1', '='); // true
|
|
66
|
+
compare('10.1.1', '10.2.2', '<'); // true
|
|
67
|
+
compare('10.1.1', '10.2.2', '<='); // true
|
|
68
|
+
compare('10.1.1', '10.2.2', '>='); // false
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
### Version ranges
|
|
72
|
+
|
|
73
|
+
The `satisfies` function accepts a range to compare, compatible with [npm package versioning](https://docs.npmjs.com/cli/v6/using-npm/semver):
|
|
74
|
+
|
|
75
|
+
```js
|
|
76
|
+
import { satisfies } from 'compare-versions';
|
|
77
|
+
|
|
78
|
+
satisfies('10.0.1', '~10.0.0'); // true
|
|
79
|
+
satisfies('10.1.0', '~10.0.0'); // false
|
|
80
|
+
satisfies('10.1.2', '^10.0.0'); // true
|
|
81
|
+
satisfies('11.0.0', '^10.0.0'); // false
|
|
82
|
+
satisfies('10.1.8', '>10.0.4'); // true
|
|
83
|
+
satisfies('10.0.1', '=10.0.1'); // true
|
|
84
|
+
satisfies('10.1.1', '<10.2.2'); // true
|
|
85
|
+
satisfies('10.1.1', '<=10.2.2'); // true
|
|
86
|
+
satisfies('10.1.1', '>=10.2.2'); // false
|
|
87
|
+
satisfies('1.4.6', '1.2.7 || >=1.2.9 <2.0.0'); // true
|
|
88
|
+
satisfies('1.2.8', '1.2.7 || >=1.2.9 <2.0.0'); // false
|
|
89
|
+
satisfies('1.5.1', '1.2.3 - 2.3.4'); // true
|
|
90
|
+
satisfies('2.3.5', '1.2.3 - 2.3.4'); // false
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
### Validate version numbers
|
|
94
|
+
|
|
95
|
+
Applies the same rules used comparing version numbers and returns a boolean:
|
|
96
|
+
|
|
97
|
+
```js
|
|
98
|
+
import { validate } from 'compare-versions';
|
|
99
|
+
|
|
100
|
+
validate('1.0.0-rc.1'); // true
|
|
101
|
+
validate('1.0-rc.1'); // false
|
|
102
|
+
validate('foo'); // false
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
### Validate version numbers (strict)
|
|
106
|
+
|
|
107
|
+
Validate version numbers strictly according to semver.org; 3 integers, no wildcards, no leading zero or "v" etc:
|
|
108
|
+
|
|
109
|
+
```js
|
|
110
|
+
import { validateStrict } from 'compare-versions';
|
|
111
|
+
|
|
112
|
+
validate('1.0.0'); // true
|
|
113
|
+
validate('1.0.0-rc.1'); // true
|
|
114
|
+
validate('1.0'); // false
|
|
115
|
+
validate('1.x'); // false
|
|
116
|
+
validate('v1.02'); // false
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
### Browser
|
|
120
|
+
|
|
121
|
+
If included directly in the browser, the functions above are available on the global window under the `compareVersions` object:
|
|
122
|
+
|
|
123
|
+
```html
|
|
124
|
+
<script src=https://unpkg.com/compare-versions/lib/umd/index.js></script>
|
|
125
|
+
<script>
|
|
126
|
+
const { compareVersions, compare, satisfies, validate } = window.compareVersions
|
|
127
|
+
console.log(compareVersions('11.0.0', '10.0.0'))
|
|
128
|
+
console.log(compare('11.0.0', '10.0.0', '>'))
|
|
129
|
+
console.log(satisfies('1.2.0', '^1.0.0'))
|
|
130
|
+
console.log(validate('11.0.0'))
|
|
131
|
+
console.log(validateStrict('11.0.0'))
|
|
132
|
+
</script>
|
|
133
|
+
```
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { CompareOperator } from './utils.js';
|
|
2
|
+
/**
|
|
3
|
+
* Compare [semver](https://semver.org/) version strings using the specified operator.
|
|
4
|
+
*
|
|
5
|
+
* @param v1 First version to compare
|
|
6
|
+
* @param v2 Second version to compare
|
|
7
|
+
* @param operator Allowed arithmetic operator to use
|
|
8
|
+
* @returns `true` if the comparison between the firstVersion and the secondVersion satisfies the operator, `false` otherwise.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```
|
|
12
|
+
* compare('10.1.8', '10.0.4', '>'); // return true
|
|
13
|
+
* compare('10.0.1', '10.0.1', '='); // return true
|
|
14
|
+
* compare('10.1.1', '10.2.2', '<'); // return true
|
|
15
|
+
* compare('10.1.1', '10.2.2', '<='); // return true
|
|
16
|
+
* compare('10.1.1', '10.2.2', '>='); // return false
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
19
|
+
export declare const compare: (v1: string, v2: string, operator: CompareOperator) => boolean;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { compareVersions } from './compareVersions.js';
|
|
2
|
+
/**
|
|
3
|
+
* Compare [semver](https://semver.org/) version strings using the specified operator.
|
|
4
|
+
*
|
|
5
|
+
* @param v1 First version to compare
|
|
6
|
+
* @param v2 Second version to compare
|
|
7
|
+
* @param operator Allowed arithmetic operator to use
|
|
8
|
+
* @returns `true` if the comparison between the firstVersion and the secondVersion satisfies the operator, `false` otherwise.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```
|
|
12
|
+
* compare('10.1.8', '10.0.4', '>'); // return true
|
|
13
|
+
* compare('10.0.1', '10.0.1', '='); // return true
|
|
14
|
+
* compare('10.1.1', '10.2.2', '<'); // return true
|
|
15
|
+
* compare('10.1.1', '10.2.2', '<='); // return true
|
|
16
|
+
* compare('10.1.1', '10.2.2', '>='); // return false
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
19
|
+
export const compare = (v1, v2, operator) => {
|
|
20
|
+
// validate input operator
|
|
21
|
+
assertValidOperator(operator);
|
|
22
|
+
// since result of compareVersions can only be -1 or 0 or 1
|
|
23
|
+
// a simple map can be used to replace switch
|
|
24
|
+
const res = compareVersions(v1, v2);
|
|
25
|
+
return operatorResMap[operator].includes(res);
|
|
26
|
+
};
|
|
27
|
+
const operatorResMap = {
|
|
28
|
+
'>': [1],
|
|
29
|
+
'>=': [0, 1],
|
|
30
|
+
'=': [0],
|
|
31
|
+
'<=': [-1, 0],
|
|
32
|
+
'<': [-1],
|
|
33
|
+
'!=': [-1, 1],
|
|
34
|
+
};
|
|
35
|
+
const allowedOperators = Object.keys(operatorResMap);
|
|
36
|
+
const assertValidOperator = (op) => {
|
|
37
|
+
if (typeof op !== 'string') {
|
|
38
|
+
throw new TypeError(`Invalid operator type, expected string but got ${typeof op}`);
|
|
39
|
+
}
|
|
40
|
+
if (allowedOperators.indexOf(op) === -1) {
|
|
41
|
+
throw new Error(`Invalid operator, expected one of ${allow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M,IAAI,KAAK,CACb,qCAAqC,gBAAgB,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAClE,CAAC;IACJ,CAAC;AACH,CAAC,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Compare [semver](https://semver.org/) version strings to find greater, equal or lesser.
|
|
3
|
+
* This library supports the full semver specification, including comparing versions with different number of digits like `1.0.0`, `1.0`, `1`, and pre-release versions like `1.0.0-alpha`.
|
|
4
|
+
* @param v1 - First version to compare
|
|
5
|
+
* @param v2 - Second version to compare
|
|
6
|
+
* @returns Numeric value compatible with the [Array.sort(fn) interface](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort#Parameters).
|
|
7
|
+
*/
|
|
8
|
+
export declare const compareVersions: (v1: string, v2: string) => 0 | 1 | -1;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { compareSegments, validateAndParse } from './utils.js';
|
|
2
|
+
/**
|
|
3
|
+
* Compare [semver](https://semver.org/) version strings to find greater, equal or lesser.
|
|
4
|
+
* This library supports the full semver specification, including comparing versions with different number of digits like `1.0.0`, `1.0`, `1`, and pre-release versions like `1.0.0-alpha`.
|
|
5
|
+
* @param v1 - First version to compare
|
|
6
|
+
* @param v2 - Second version to compare
|
|
7
|
+
* @returns Numeric value compatible with the [Array.sort(fn) interface](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort#Parameters).
|
|
8
|
+
*/
|
|
9
|
+
export const compareVersions = (v1, v2) => {
|
|
10
|
+
// validate input and split into segments
|
|
11
|
+
const n1 = validateAndParse(v1);
|
|
12
|
+
const n2 = validateAndParse(v2);
|
|
13
|
+
// pop off the patch
|
|
14
|
+
const p1 = n1.pop();
|
|
15
|
+
const p2 = n2.pop();
|
|
16
|
+
// validate numbers
|
|
17
|
+
const r = compareSegments(n1, n2);
|
|
18
|
+
if (r !== 0)
|
|
19
|
+
return r;
|
|
20
|
+
// validate pre-release
|
|
21
|
+
if (p1 && p2) {
|
|
22
|
+
return compareSegments(p1.split('.'), p2.split('.'));
|
|
23
|
+
}
|
|
24
|
+
else if (p1 || p2) {
|
|
25
|
+
return p1 ? -1 : 1;
|
|
26
|
+
}
|
|
27
|
+
return 0;
|
|
28
|
+
};
|
|
29
|
+
//# sourceMappingURL=compareVersions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compareVersions.js","sourceRoot":"","sources":["../../src/compareVersions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAE/D;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,EAAU,EAAE,EAAU,EAAE,EAAE;IACxD,yCAAyC;IACzC,MAAM,EAAE,GAAG,gBAAgB,CAAC,EAAE,CAAC,CAAC;IAChC,MAAM,EAAE,GAAG,gBAAgB,CAAC,EAAE,CAAC,CAAC;IAEhC,oBAAoB;IACpB,MAAM,EAAE,GAAG,EAAE,CAAC,GAAG,EAAE,CAAC;IACpB,MAAM,EAAE,GAAG,EAAE,CAAC,GAAG,EAAE,CAAC;IAEpB,mBAAmB;IACnB,MAAM,CAAC,GAAG,eAAe,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;IAClC,IAAI,CAAC,KAAK,CAAC;QAAE,OAAO,CAAC,CAAC;IAEtB,uBAAuB;IACvB,IAAI,EAAE,IAAI,EAAE,EAAE,CAAC;QACb,OAAO,eAAe,CAAC,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC;IACvD,CAAC;SAAM,IAAI,EAAE,IAAI,EAAE,EAAE,CAAC;QACpB,OAAO,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACrB,CAAC;IAED,OAAO,CAAC,CAAC;AACX,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE3C,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Match [npm semver](https://docs.npmjs.com/cli/v6/using-npm/semver) version range.
|
|
3
|
+
*
|
|
4
|
+
* @param version Version number to match
|
|
5
|
+
* @param range Range pattern for version
|
|
6
|
+
* @returns `true` if the version number is within the range, `false` otherwise.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```
|
|
10
|
+
* satisfies('1.1.0', '^1.0.0'); // return true
|
|
11
|
+
* satisfies('1.1.0', '~1.0.0'); // return false
|
|
12
|
+
* ```
|
|
13
|
+
*/
|
|
14
|
+
export declare const satisfies: (version: string, range: string) => boolean;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { compare } from './compare.js';
|
|
2
|
+
import { compareSegments, validateAndParse } from './utils.js';
|
|
3
|
+
/**
|
|
4
|
+
* Match [npm semver](https://docs.npmjs.com/cli/v6/using-npm/semver) version range.
|
|
5
|
+
*
|
|
6
|
+
* @param version Version number to match
|
|
7
|
+
* @param range Range pattern for version
|
|
8
|
+
* @returns `true` if the version number is within the range, `false` otherwise.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```
|
|
12
|
+
* satisfies('1.1.0', '^1.0.0'); // return true
|
|
13
|
+
* satisfies('1.1.0', '~1.0.0'); // return false
|
|
14
|
+
* ```
|
|
15
|
+
*/
|
|
16
|
+
export const satisfies = (version, range) => {
|
|
17
|
+
// clean input
|
|
18
|
+
range = range.replace(/([><=]+)\s+/g, '$1');
|
|
19
|
+
// handle multiple comparators
|
|
20
|
+
if (range.includes('||')) {
|
|
21
|
+
return range.split('||').some((r) => satisfies(version, r));
|
|
22
|
+
}
|
|
23
|
+
else if (range.includes(' - ')) {
|
|
24
|
+
const [a, b] = range.split(' - ', 2);
|
|
25
|
+
return satisfies(version, `>=${a} <=${b}`);
|
|
26
|
+
}
|
|
27
|
+
else if (range.includes(' ')) {
|
|
28
|
+
return range
|
|
29
|
+
.trim()
|
|
30
|
+
.replace(/\s{2,}/g, ' ')
|
|
31
|
+
.split(' ')
|
|
32
|
+
.every((r) => satisfies(version, r));
|
|
33
|
+
}
|
|
34
|
+
// if no range operator then "="
|
|
35
|
+
const m = range.match(/^([<>=~^]+)/);
|
|
36
|
+
const op = m ? m[1] : '=';
|
|
37
|
+
// if gt/lt/eq then operator compare
|
|
38
|
+
if (op !== '^' && op !== '~')
|
|
39
|
+
return compare(version, range, op);
|
|
40
|
+
// else range of either "~" or "^" is assumed
|
|
41
|
+
const [v1, v2, v3, , vp] = validateAndParse(version);
|
|
42
|
+
const [r1, r2, r3, , rp] = validateAndParse(range);
|
|
43
|
+
const v = [v1, v2, v3];
|
|
44
|
+
const r = [r1, r2 !== null && r2 !== void 0 ? r2 : 'x', r3 !== null && r3 !== void 0 ? r3 : 'x'];
|
|
45
|
+
// validate pre-release
|
|
46
|
+
if (rp) {
|
|
47
|
+
if (!vp)
|
|
48
|
+
return false;
|
|
49
|
+
if (compareSegments(v, r) !== 0)
|
|
50
|
+
return false;
|
|
51
|
+
if (compareSegments(vp.split('.'), rp.split('.')) === -1)
|
|
52
|
+
return false;
|
|
53
|
+
}
|
|
54
|
+
// first non-zero number
|
|
55
|
+
const nonZero = r.findIndex((v) => v !== '0') + 1;
|
|
56
|
+
// pointer to where segments can be >=
|
|
57
|
+
const i = op === '~' ? 2 : nonZero > 1 ? nonZero : 1;
|
|
58
|
+
// before pointer must be equal
|
|
59
|
+
if (compareSegments(v.slice(0, i), r.slice(0, i)) !== 0)
|
|
60
|
+
return false;
|
|
61
|
+
// after pointer must be >=
|
|
62
|
+
if (compareSegments(v.slice(i), r.slice(i)) === -1)
|
|
63
|
+
return false;
|
|
64
|
+
return true;
|
|
65
|
+
};
|
|
66
|
+
//# sourceMappingURL=satisfies.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"satisfies.js","sourceRoot":"","sources":["../../src/satisfies.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAmB,eAAe,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAEhF;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,OAAe,EAAE,KAAa,EAAW,EAAE;IACnE,cAAc;IACd,KAAK,GAAG,KAAK,CAAC,OAAO,CAAC,cAAc,EAAE,IAAI,CAAC,CAAC;IAE5C,8BAA8B;IAC9B,IAAI,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC;QACzB,OAAO,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,SAAS,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,CAAC;IAC9D,CAAC;SAAM,IAAI,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;QACjC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,KAAK,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;QACrC,OAAO,SAAS,CAAC,OAAO,EAAE,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;IAC7C,CAAC;SAAM,IAAI,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;QAC/B,OAAO,KAAK;aACT,IAAI,EAAE;aACN,OAAO,CAAC,SAAS,EAAE,GAAG,CAAC;aACvB,KAAK,CAAC,GAAG,CAAC;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IAED,wBAAwB;IACxB,MAAM,OAAO,GAAG,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,GAAG,CAAC,GAAG,CAAC,CAAC;IAElD,sCAAsC;IACtC,MAAM,CAAC,GAAG,EAAE,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;IAErD,+BAA+B;IAC/B,IAAI,eAAe,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC;QAAE,OAAO,KAAK,CAAC;IAEtE,2BAA2B;IAC3B,IAAI,eAAe,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;QAAE,OAAO,KAAK,CAAC;IAEjE,OAAO,IAAI,CAAC;AACd,CAAC,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Allowed arithmetic operators
|
|
3
|
+
*/
|
|
4
|
+
export type CompareOperator = '>' | '>=' | '=' | '<' | '<=' | '!=';
|
|
5
|
+
export declare const semver: RegExp;
|
|
6
|
+
export declare const validateAndParse: (version: string) => RegExpMatchArray;
|
|
7
|
+
export declare const compareSegments: (a: string | string[] | RegExpMatchArray, b: string | string[] | RegExpMatchArray) => 0 | 1 | -1;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
export const semver = /^[v^~<>=]*?(\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+))?(?:-([\da-z\-]+(?:\.[\da-z\-]+)*))?(?:\+[\da-z\-]+(?:\.[\da-z\-]+)*)?)?)?$/i;
|
|
2
|
+
export const validateAndParse = (version) => {
|
|
3
|
+
if (typeof version !== 'string') {
|
|
4
|
+
throw new TypeError('Invalid argument expected string');
|
|
5
|
+
}
|
|
6
|
+
const match = version.match(semver);
|
|
7
|
+
if (!match) {
|
|
8
|
+
throw new Error(`Invalid argument not valid semver ('${version}' received)`);
|
|
9
|
+
}
|
|
10
|
+
match.shift();
|
|
11
|
+
return match;
|
|
12
|
+
};
|
|
13
|
+
const isWildcard = (s) => s === '*' || s === 'x' || s === 'X';
|
|
14
|
+
const tryParse = (v) => {
|
|
15
|
+
const n = parseInt(v, 10);
|
|
16
|
+
return isNaN(n) ? v : n;
|
|
17
|
+
};
|
|
18
|
+
const forceType = (a, b) => typeof a !== typeof b ? [String(a), String(b)] : [a, b];
|
|
19
|
+
const compareStrings = (a, b) => {
|
|
20
|
+
if (isWildcard(a) || isWildcard(b))
|
|
21
|
+
return 0;
|
|
22
|
+
const [ap, bp] = forceType(tryParse(a), tryParse(b));
|
|
23
|
+
if (ap > bp)
|
|
24
|
+
return 1;
|
|
25
|
+
if (ap < bp)
|
|
26
|
+
return -1;
|
|
27
|
+
return 0;
|
|
28
|
+
};
|
|
29
|
+
export const compareSegments = (a, b) => {
|
|
30
|
+
for (let i = 0; i < Math.max(a.length, b.length); i++) {
|
|
31
|
+
const r = compareStrings(a[i] || '0', b[i] || '0');
|
|
32
|
+
if (r !== 0)
|
|
33
|
+
return r;
|
|
34
|
+
}
|
|
35
|
+
return 0;
|
|
36
|
+
};
|
|
37
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/utils.ts"],"names":[],"mappings":"AAKA,MAAM,CAAC,MAAM,MAAM,GACjB,4IAA4I,CAAC;AAE/I,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,OAAe,EAAE,EAAE;IAClD,IAAI,OAAO,OAAO,KAAK,QAAQ,EAAE,CAAC;QAChC,MAAM,IAAI,SAAS,CAAC,kCAAkC,CAA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QAAE,OAAO,CAAC,CAAC,CAAC;IACvB,OAAO,CAAC,CAAC;AACX,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,eAAe,GAAG,CAC7B,CAAuC,EACvC,CAAuC,EACvC,EAAE;IACF,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;QACtD,MAAM,CAAC,GAAG,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC;QACnD,IAAI,CAAC,KAAK,CAAC;YAAE,OAAO,CAAC,CAAC;IACxB,CAAC;IACD,OAAO,CAAC,CAAC;AACX,CAAC,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Validate [semver](https://semver.org/) version strings.
|
|
3
|
+
*
|
|
4
|
+
* @param version Version number to validate
|
|
5
|
+
* @returns `true` if the version number is a valid semver version number, `false` otherwise.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```
|
|
9
|
+
* validate('1.0.0-rc.1'); // return true
|
|
10
|
+
* validate('1.0-rc.1'); // return false
|
|
11
|
+
* validate('foo'); // return false
|
|
12
|
+
* ```
|
|
13
|
+
*/
|
|
14
|
+
export declare const validate: (version: string) => boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Validate [semver](https://semver.org/) version strings strictly. Will not accept wildcards and version ranges.
|
|
17
|
+
*
|
|
18
|
+
* @param version Version number to validate
|
|
19
|
+
* @returns `true` if the version number is a valid semver version number `false` otherwise
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* ```
|
|
23
|
+
* validate('1.0.0-rc.1'); // return true
|
|
24
|
+
* validate('1.0-rc.1'); // return false
|
|
25
|
+
* validate('foo'); // return false
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
28
|
+
export declare const validateStrict: (version: string) => boolean;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { semver } from './utils.js';
|
|
2
|
+
/**
|
|
3
|
+
* Validate [semver](https://semver.org/) version strings.
|
|
4
|
+
*
|
|
5
|
+
* @param version Version number to validate
|
|
6
|
+
* @returns `true` if the version number is a valid semver version number, `false` otherwise.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```
|
|
10
|
+
* validate('1.0.0-rc.1'); // return true
|
|
11
|
+
* validate('1.0-rc.1'); // return false
|
|
12
|
+
* validate('foo'); // return false
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
15
|
+
export const validate = (version) => typeof version === 'string' && /^[v\d]/.test(version) && semver.test(version);
|
|
16
|
+
/**
|
|
17
|
+
* Validate [semver](https://semver.org/) version strings strictly. Will not accept wildcards and version ranges.
|
|
18
|
+
*
|
|
19
|
+
* @param version Version number to validate
|
|
20
|
+
* @returns `true` if the version number is a valid semver version number `false` otherwise
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* ```
|
|
24
|
+
* validate('1.0.0-rc.1'); // return true
|
|
25
|
+
* validate('1.0-rc.1'); // return false
|
|
26
|
+
* validate('foo'); // return false
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
29
|
+
export const validateStrict = (version) => typeof version === 'string' &&
|
|
30
|
+
/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/.test(version);
|
|
31
|
+
//# sourceMappingURL=validate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validate.js","sourceRoot":"","sources":["../../src/validate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAEpC;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,OAAe,EAAE,EAAE,CAC1C,OAAO,OAAO,KAAK,QAAQ,IAAI,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;AAEhF;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,OAAe,EAAE,EAAE,CAChD,OAAO,OAAO,KAAK,QAAQ;IAC3B,qLAAqL,CAAC,IAAI,CACxL,OAAO,CACR,CAAC"}
|