pluginclerk
Advanced tools
Comparing version 5.2.0 to 6.0.0-next.1700434341.648c38d21626f17b3c5ca4027e3ae3cef9b5831c
// Import | ||
import Cachely from 'cachely'; | ||
// Compat until there is a better solution | ||
import semver from 'semver'; | ||
const { satisfies } = semver; | ||
import versionRange from 'version-range'; | ||
import wait from '@bevry/wait'; | ||
/** Construct our PluginClerk class, setting the configuration from the options */ | ||
@@ -44,3 +43,17 @@ export default class PluginClerk { | ||
try { | ||
const response = await fetch(url); | ||
// fetch response, supporting retry on timeouts | ||
let response; | ||
while (true) { | ||
try { | ||
response = await fetch(url); | ||
} | ||
catch (err) { } | ||
if (response && response.ok) { | ||
break; | ||
} | ||
else { | ||
// wait a random duration up to a minute before trying again | ||
await wait(Math.random() * 60000); | ||
} | ||
} | ||
data = await response.json(); | ||
@@ -131,3 +144,3 @@ if (!data || !data.objects) { | ||
if (!acceptedRange || | ||
satisfies(suppliedVersion, acceptedRange) === | ||
versionRange(suppliedVersion, acceptedRange) === | ||
false) { | ||
@@ -145,4 +158,3 @@ // incompatibility | ||
if (suppliedVersion) { | ||
if (satisfies(suppliedVersion, acceptedRange) === | ||
false) { | ||
if (versionRange(suppliedVersion, acceptedRange) === false) { | ||
// incompatibility | ||
@@ -149,0 +161,0 @@ if (skippedVersions[pluginVersion] == null) |
@@ -8,5 +8,4 @@ "use strict"; | ||
const cachely_1 = __importDefault(require("cachely")); | ||
// Compat until there is a better solution | ||
const semver_1 = __importDefault(require("semver")); | ||
const { satisfies } = semver_1.default; | ||
const version_range_1 = __importDefault(require("version-range")); | ||
const wait_1 = __importDefault(require("@bevry/wait")); | ||
/** Construct our PluginClerk class, setting the configuration from the options */ | ||
@@ -50,3 +49,17 @@ class PluginClerk { | ||
try { | ||
const response = await fetch(url); | ||
// fetch response, supporting retry on timeouts | ||
let response; | ||
while (true) { | ||
try { | ||
response = await fetch(url); | ||
} | ||
catch (err) { } | ||
if (response && response.ok) { | ||
break; | ||
} | ||
else { | ||
// wait a random duration up to a minute before trying again | ||
await (0, wait_1.default)(Math.random() * 60000); | ||
} | ||
} | ||
data = await response.json(); | ||
@@ -137,3 +150,3 @@ if (!data || !data.objects) { | ||
if (!acceptedRange || | ||
satisfies(suppliedVersion, acceptedRange) === | ||
(0, version_range_1.default)(suppliedVersion, acceptedRange) === | ||
false) { | ||
@@ -151,4 +164,3 @@ // incompatibility | ||
if (suppliedVersion) { | ||
if (satisfies(suppliedVersion, acceptedRange) === | ||
false) { | ||
if ((0, version_range_1.default)(suppliedVersion, acceptedRange) === false) { | ||
// incompatibility | ||
@@ -155,0 +167,0 @@ if (skippedVersions[pluginVersion] == null) |
{ | ||
"name": "pluginclerk", | ||
"version": "5.2.0", | ||
"version": "6.0.0-next.1700434341.648c38d21626f17b3c5ca4027e3ae3cef9b5831c", | ||
"description": "A clerk for retrieving compatible plugins from the npm database", | ||
@@ -8,2 +8,6 @@ "homepage": "https://github.com/bevry/pluginclerk", | ||
"keywords": [ | ||
"deno", | ||
"deno-edition", | ||
"deno-entry", | ||
"denoland", | ||
"dependencies", | ||
@@ -31,3 +35,2 @@ "es2022", | ||
"patreon", | ||
"flattr", | ||
"liberapay", | ||
@@ -38,3 +41,5 @@ "buymeacoffee", | ||
"paypal", | ||
"wishlist" | ||
"---", | ||
"discord", | ||
"twitch" | ||
], | ||
@@ -44,3 +49,3 @@ "config": { | ||
"githubSponsorsUsername": "balupton", | ||
"thanksdevGithubUsername": "balupton", | ||
"thanksdevGithubUsername": "bevry", | ||
"buymeacoffeeUsername": "balupton", | ||
@@ -54,2 +59,5 @@ "cryptoURL": "https://bevry.me/crypto", | ||
"wishlistURL": "https://bevry.me/wishlist", | ||
"discordServerID": "1147436445783560193", | ||
"discordServerInvite": "nQuXddV7VP", | ||
"twitchUsername": "balupton", | ||
"githubUsername": "bevry", | ||
@@ -120,2 +128,16 @@ "githubRepository": "pluginclerk", | ||
} | ||
}, | ||
{ | ||
"description": "TypeScript source code made to be compatible with Deno", | ||
"directory": "edition-deno", | ||
"entry": "index.ts", | ||
"tags": [ | ||
"typescript", | ||
"import", | ||
"deno" | ||
], | ||
"engines": { | ||
"deno": true, | ||
"browsers": false | ||
} | ||
} | ||
@@ -132,27 +154,31 @@ ], | ||
}, | ||
"deno": "edition-deno/index.ts", | ||
"dependencies": { | ||
"@bevry/wait": "^2.1.0", | ||
"cachely": "^6.3.0", | ||
"semver": "^7.5.4" | ||
"version-range": "^4.2.0" | ||
}, | ||
"devDependencies": { | ||
"@bevry/update-contributors": "^1.23.0", | ||
"@types/node": "^20.9.0", | ||
"@types/node": "^20.9.2", | ||
"@typescript-eslint/eslint-plugin": "^6.11.0", | ||
"@typescript-eslint/parser": "^6.11.0", | ||
"assert-helpers": "^11.4.0", | ||
"eslint": "^8.53.0", | ||
"eslint-config-bevry": "^4.0.0", | ||
"eslint": "^8.54.0", | ||
"eslint-config-bevry": "^5.0.0", | ||
"eslint-config-prettier": "^9.0.0", | ||
"eslint-plugin-prettier": "^5.0.1", | ||
"kava": "^7.2.0", | ||
"make-deno-edition": "^1.3.0", | ||
"prettier": "^3.1.0", | ||
"projectz": "^3.0.0", | ||
"projectz": "^3.2.0", | ||
"surge": "^0.23.1", | ||
"typedoc": "^0.25.3", | ||
"typescript": "5.2.2", | ||
"valid-directory": "^4.2.0" | ||
"valid-directory": "^4.4.0" | ||
}, | ||
"scripts": { | ||
"our:clean": "rm -rf ./docs ./edition* ./es2015 ./es5 ./out ./.next", | ||
"our:compile": "npm run our:compile:edition-es2022 && npm run our:compile:edition-es2022-esm && npm run our:compile:types", | ||
"our:compile": "npm run our:compile:deno && npm run our:compile:edition-es2022 && npm run our:compile:edition-es2022-esm && npm run our:compile:types", | ||
"our:compile:deno": "make-deno-edition --attempt", | ||
"our:compile:edition-es2022": "tsc --module commonjs --target ES2022 --outDir ./edition-es2022 --project tsconfig.json && ( test ! -d edition-es2022/source || ( mv edition-es2022/source edition-temp && rm -rf edition-es2022 && mv edition-temp edition-es2022 ) ) && printf '%s' '{\"type\": \"commonjs\"}' > edition-es2022/package.json", | ||
@@ -190,4 +216,4 @@ "our:compile:edition-es2022-esm": "tsc --module ESNext --target ES2022 --outDir ./edition-es2022-esm --project tsconfig.json && ( test ! -d edition-es2022-esm/source || ( mv edition-es2022-esm/source edition-temp && rm -rf edition-es2022-esm && mv edition-temp edition-es2022-esm ) ) && printf '%s' '{\"type\": \"module\"}' > edition-es2022-esm/package.json", | ||
"singleQuote": true, | ||
"trailingComma": "es5" | ||
"trailingComma": "all" | ||
} | ||
} | ||
} |
@@ -15,5 +15,4 @@ <!-- TITLE/ --> | ||
<span class="badge-githubsponsors"><a href="https://github.com/sponsors/balupton" title="Donate to this project using GitHub Sponsors"><img src="https://img.shields.io/badge/github-donate-yellow.svg" alt="GitHub Sponsors donate button" /></a></span> | ||
<span class="badge-thanksdev"><a href="https://thanks.dev/u/gh/balupton" title="Donate to this project using ThanksDev"><img src="https://img.shields.io/badge/thanksdev-donate-yellow.svg" alt="ThanksDev donate button" /></a></span> | ||
<span class="badge-thanksdev"><a href="https://thanks.dev/u/gh/bevry" title="Donate to this project using ThanksDev"><img src="https://img.shields.io/badge/thanksdev-donate-yellow.svg" alt="ThanksDev donate button" /></a></span> | ||
<span class="badge-patreon"><a href="https://patreon.com/bevry" title="Donate to this project using Patreon"><img src="https://img.shields.io/badge/patreon-donate-yellow.svg" alt="Patreon donate button" /></a></span> | ||
<span class="badge-flattr"><a href="https://flattr.com/profile/balupton" title="Donate to this project using Flattr"><img src="https://img.shields.io/badge/flattr-donate-yellow.svg" alt="Flattr donate button" /></a></span> | ||
<span class="badge-liberapay"><a href="https://liberapay.com/bevry" title="Donate to this project using Liberapay"><img src="https://img.shields.io/badge/liberapay-donate-yellow.svg" alt="Liberapay donate button" /></a></span> | ||
@@ -24,3 +23,5 @@ <span class="badge-buymeacoffee"><a href="https://buymeacoffee.com/balupton" title="Donate to this project using Buy Me A Coffee"><img src="https://img.shields.io/badge/buy%20me%20a%20coffee-donate-yellow.svg" alt="Buy Me A Coffee donate button" /></a></span> | ||
<span class="badge-paypal"><a href="https://bevry.me/paypal" title="Donate to this project using Paypal"><img src="https://img.shields.io/badge/paypal-donate-yellow.svg" alt="PayPal donate button" /></a></span> | ||
<span class="badge-wishlist"><a href="https://bevry.me/wishlist" title="Buy an item on our wishlist for us"><img src="https://img.shields.io/badge/wishlist-donate-yellow.svg" alt="Wishlist browse button" /></a></span> | ||
<br class="badge-separator" /> | ||
<span class="badge-discord"><a href="https://discord.gg/nQuXddV7VP" title="Join this project's community on Discord"><img src="https://img.shields.io/discord/1147436445783560193?logo=discord&label=discord" alt="Discord server badge" /></a></span> | ||
<span class="badge-twitch"><a href="https://www.twitch.tv/balupton" title="Join this project's community on Twitch"><img src="https://img.shields.io/twitch/status/balupton?logo=twitch" alt="Twitch community badge" /></a></span> | ||
@@ -178,2 +179,8 @@ <!-- /BADGES --> | ||
<a href="https://deno.land" title="Deno is a secure runtime for JavaScript and TypeScript, it is an alternative for Node.js"><h3>Deno</h3></a> | ||
``` typescript | ||
import pkg from 'https://unpkg.com/pluginclerk@^6.0.0/edition-deno/index.ts' | ||
``` | ||
<h3><a href="https://editions.bevry.me" title="Editions are the best way to produce and consume packages you care about.">Editions</a></h3> | ||
@@ -186,3 +193,4 @@ | ||
<li><code>pluginclerk/edition-es2022/index.js</code> is <a href="https://www.typescriptlang.org/" title="TypeScript is a typed superset of JavaScript that compiles to plain JavaScript. ">TypeScript</a> compiled against ES2022 for <a href="https://nodejs.org" title="Node.js is a JavaScript runtime built on Chrome's V8 JavaScript engine">Node.js</a> 18 || 20 || 21 with <a href="https://nodejs.org/dist/latest-v5.x/docs/api/modules.html" title="Node/CJS Modules">Require</a> for modules</li> | ||
<li><code>pluginclerk/edition-es2022-esm/index.js</code> is <a href="https://www.typescriptlang.org/" title="TypeScript is a typed superset of JavaScript that compiles to plain JavaScript. ">TypeScript</a> compiled against ES2022 for <a href="https://nodejs.org" title="Node.js is a JavaScript runtime built on Chrome's V8 JavaScript engine">Node.js</a> 18 || 20 || 21 with <a href="https://babeljs.io/docs/learn-es2015/#modules" title="ECMAScript Modules">Import</a> for modules</li></ul> | ||
<li><code>pluginclerk/edition-es2022-esm/index.js</code> is <a href="https://www.typescriptlang.org/" title="TypeScript is a typed superset of JavaScript that compiles to plain JavaScript. ">TypeScript</a> compiled against ES2022 for <a href="https://nodejs.org" title="Node.js is a JavaScript runtime built on Chrome's V8 JavaScript engine">Node.js</a> 18 || 20 || 21 with <a href="https://babeljs.io/docs/learn-es2015/#modules" title="ECMAScript Modules">Import</a> for modules</li> | ||
<li><code>pluginclerk/edition-deno/index.ts</code> is <a href="https://www.typescriptlang.org/" title="TypeScript is a typed superset of JavaScript that compiles to plain JavaScript. ">TypeScript</a> source code made to be compatible with <a href="https://deno.land" title="Deno is a secure runtime for JavaScript and TypeScript, it is an alternative to Node.js">Deno</a></li></ul> | ||
@@ -225,5 +233,4 @@ <!-- /INSTALL --> | ||
<span class="badge-githubsponsors"><a href="https://github.com/sponsors/balupton" title="Donate to this project using GitHub Sponsors"><img src="https://img.shields.io/badge/github-donate-yellow.svg" alt="GitHub Sponsors donate button" /></a></span> | ||
<span class="badge-thanksdev"><a href="https://thanks.dev/u/gh/balupton" title="Donate to this project using ThanksDev"><img src="https://img.shields.io/badge/thanksdev-donate-yellow.svg" alt="ThanksDev donate button" /></a></span> | ||
<span class="badge-thanksdev"><a href="https://thanks.dev/u/gh/bevry" title="Donate to this project using ThanksDev"><img src="https://img.shields.io/badge/thanksdev-donate-yellow.svg" alt="ThanksDev donate button" /></a></span> | ||
<span class="badge-patreon"><a href="https://patreon.com/bevry" title="Donate to this project using Patreon"><img src="https://img.shields.io/badge/patreon-donate-yellow.svg" alt="Patreon donate button" /></a></span> | ||
<span class="badge-flattr"><a href="https://flattr.com/profile/balupton" title="Donate to this project using Flattr"><img src="https://img.shields.io/badge/flattr-donate-yellow.svg" alt="Flattr donate button" /></a></span> | ||
<span class="badge-liberapay"><a href="https://liberapay.com/bevry" title="Donate to this project using Liberapay"><img src="https://img.shields.io/badge/liberapay-donate-yellow.svg" alt="Liberapay donate button" /></a></span> | ||
@@ -234,3 +241,2 @@ <span class="badge-buymeacoffee"><a href="https://buymeacoffee.com/balupton" title="Donate to this project using Buy Me A Coffee"><img src="https://img.shields.io/badge/buy%20me%20a%20coffee-donate-yellow.svg" alt="Buy Me A Coffee donate button" /></a></span> | ||
<span class="badge-paypal"><a href="https://bevry.me/paypal" title="Donate to this project using Paypal"><img src="https://img.shields.io/badge/paypal-donate-yellow.svg" alt="PayPal donate button" /></a></span> | ||
<span class="badge-wishlist"><a href="https://bevry.me/wishlist" title="Buy an item on our wishlist for us"><img src="https://img.shields.io/badge/wishlist-donate-yellow.svg" alt="Wishlist browse button" /></a></span> | ||
@@ -237,0 +243,0 @@ <h3>Contributors</h3> |
// Import | ||
import Cachely from 'cachely' | ||
import versionRange from 'version-range' | ||
import wait from '@bevry/wait' | ||
// Compat until there is a better solution | ||
import semver from 'semver' | ||
const { satisfies } = semver | ||
type Versions = { [name: string]: string | number } | ||
@@ -230,3 +228,3 @@ type Ranges = { [name: string]: string } | ||
throw new Error( | ||
'The plugin clerk requires a keyword to be specified, please refer to the API specification' | ||
'The plugin clerk requires a keyword to be specified, please refer to the API specification', | ||
) | ||
@@ -271,3 +269,15 @@ } | ||
try { | ||
const response = await fetch(url) | ||
// fetch response, supporting retry on timeouts | ||
let response | ||
while (true) { | ||
try { | ||
response = await fetch(url) | ||
} catch (err) {} | ||
if (response && response.ok) { | ||
break | ||
} else { | ||
// wait a random duration up to a minute before trying again | ||
await wait(Math.random() * 60000) | ||
} | ||
} | ||
data = await response.json() | ||
@@ -286,3 +296,3 @@ if (!data || !data.objects) { | ||
const response = await fetch( | ||
`${me.config.registryHostname}/${name}` | ||
`${me.config.registryHostname}/${name}`, | ||
) | ||
@@ -296,4 +306,4 @@ pluginData = await response.json() | ||
new Error( | ||
'name result from search and from package did not match' | ||
) | ||
'name result from search and from package did not match', | ||
), | ||
) | ||
@@ -307,3 +317,3 @@ } | ||
'warn', | ||
`Plugin ${name} will be ignored as it has an invalid name, must be prefixed with: ${me.config.prefix}` | ||
`Plugin ${name} will be ignored as it has an invalid name, must be prefixed with: ${me.config.prefix}`, | ||
) | ||
@@ -316,6 +326,6 @@ return Promise.resolve() | ||
'info', | ||
`Plugin ${name} was successfully added to the database.` | ||
`Plugin ${name} was successfully added to the database.`, | ||
) | ||
return Promise.resolve() | ||
}) | ||
}), | ||
) | ||
@@ -336,3 +346,3 @@ } catch (err: any) { | ||
'info', | ||
'Fetched a portion of the database content, grabbing the rest' | ||
'Fetched a portion of the database content, grabbing the rest', | ||
) | ||
@@ -389,3 +399,3 @@ return this.requestDatabase({ database, offset: subtotal }) | ||
requirements, | ||
dependencies | ||
dependencies, | ||
) | ||
@@ -395,3 +405,3 @@ const requiredDependencies = Object.assign( | ||
pluginVersionData.engines || {}, | ||
pluginVersionData.peerDependencies || {} | ||
pluginVersionData.peerDependencies || {}, | ||
) | ||
@@ -404,3 +414,3 @@ | ||
!acceptedRange || | ||
satisfies(suppliedVersion as string, acceptedRange as string) === | ||
versionRange(suppliedVersion as string, acceptedRange as string) === | ||
false | ||
@@ -418,3 +428,3 @@ ) { | ||
for (const [name, acceptedRange] of Object.entries( | ||
pluginVersionData.peerDependencies || {} | ||
pluginVersionData.peerDependencies || {}, | ||
)) { | ||
@@ -424,4 +434,6 @@ const suppliedVersion = existingDependencies[name] | ||
if ( | ||
satisfies(suppliedVersion as string, acceptedRange as string) === | ||
false | ||
versionRange( | ||
suppliedVersion as string, | ||
acceptedRange as string, | ||
) === false | ||
) { | ||
@@ -513,3 +525,3 @@ // incompatibility | ||
public async fetchPlugin( | ||
opts: FetchPluginOptions | ||
opts: FetchPluginOptions, | ||
): Promise<PluginCompatibilityResult> { | ||
@@ -516,0 +528,0 @@ let database: RegistryPackageResults |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
98429
14
1760
261
3
17
1
+ Added@bevry/wait@^2.1.0
+ Addedversion-range@^4.2.0
+ Added@bevry/wait@2.6.0(transitive)
- Removedsemver@^7.5.4
- Removedsemver@7.6.3(transitive)