Socket
Socket
Sign inDemoInstall

query-registry

Package Overview
Dependencies
42
Maintainers
1
Versions
24
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.0.0 to 2.1.0-0

2

CHANGELOG.md

@@ -41,2 +41,2 @@ # Changelog

[unreleased]: https://github.com/velut/node-query-registry/compare/v2.0.0...HEAD
[2.0.0]: https://github.com/velut/node-query-registry/compare/v1.2.0...v.2.0.0
[2.0.0]: https://github.com/velut/node-query-registry/compare/v1.2.0...v2.0.0
import { extractRawPackageManifest } from '../utils/extract-package-manifest.esm.js';
import { normalizeRawPackageManifest } from '../utils/normalize-raw-package-manifest.esm.js';
import { getRawPackument } from './get-raw-packument.esm.js';
import { normalizeRawPackageManifest } from '../utils/normalize-raw-package-manifest.esm.js';

@@ -5,0 +5,0 @@ /**

@@ -0,3 +1,3 @@

import { normalizeRawPackument } from '../utils/normalize-raw-packument.esm.js';
import { getRawPackument } from './get-raw-packument.esm.js';
import { normalizeRawPackument } from '../utils/normalize-raw-packument.esm.js';

@@ -4,0 +4,0 @@ /**

export { cloudflareRegistry, npmRegistry, npmRegistryDownloadsAPI, npmRegistryMirrors, yarnRegistry } from './data/registries.esm.js';
export { FetchError, InvalidPackageNameError, InvalidPackageVersionError } from './utils/errors.esm.js';
export { getDailyPackageDownloads } from './endpoints/get-daily-package-downloads.esm.js';
export { getDailyRegistryDownloads } from './endpoints/get-daily-registry-downloads.esm.js';
export { getPackageDownloads } from './endpoints/get-package-downloads.esm.js';
export { getRawPackument } from './endpoints/get-raw-packument.esm.js';
export { getRawPackageManifest } from './endpoints/get-raw-package-manifest.esm.js';
export { getPackageManifest } from './endpoints/get-package-manifest.esm.js';
export { getPackument } from './endpoints/get-packument.esm.js';
export { getRawPackageManifest } from './endpoints/get-raw-package-manifest.esm.js';
export { getRawPackument } from './endpoints/get-raw-packument.esm.js';
export { getRegistryDownloads } from './endpoints/get-registry-downloads.esm.js';
export { getRegistryMetadata } from './endpoints/get-registry-metadata.esm.js';
export { searchPackages } from './endpoints/search-packages.esm.js';
export { FetchError, InvalidPackageNameError, InvalidPackageVersionError } from './utils/errors.esm.js';
//# sourceMappingURL=index.esm.js.map

@@ -5,12 +5,34 @@ 'use strict';

function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
var validatePackageName = _interopDefault(require('validate-npm-package-name'));
var validatePackageName = require('validate-npm-package-name');
var makeError = require('make-error');
var makeError__default = _interopDefault(makeError);
var debug = _interopDefault(require('debug'));
var unfetch = _interopDefault(require('isomorphic-unfetch'));
var lru = _interopDefault(require('tiny-lru'));
var gitUrlParse = _interopDefault(require('git-url-parse'));
var unfetch = require('isomorphic-unfetch');
var lru = require('tiny-lru');
var gitUrlParse = require('git-url-parse');
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
function _interopNamespace(e) {
if (e && e.__esModule) return e;
var n = Object.create(null);
if (e) {
Object.keys(e).forEach(function (k) {
if (k !== 'default') {
var d = Object.getOwnPropertyDescriptor(e, k);
Object.defineProperty(n, k, d.get ? d : {
enumerable: true,
get: function () { return e[k]; }
});
}
});
}
n["default"] = e;
return n;
}
var validatePackageName__default = /*#__PURE__*/_interopDefaultLegacy(validatePackageName);
var makeError__default = /*#__PURE__*/_interopDefaultLegacy(makeError);
var unfetch__default = /*#__PURE__*/_interopDefaultLegacy(unfetch);
var lru__default = /*#__PURE__*/_interopDefaultLegacy(lru);
var gitUrlParse__default = /*#__PURE__*/_interopDefaultLegacy(gitUrlParse);
/**

@@ -70,2 +92,4 @@ * npm registry

super(`fetch: request to ${url} failed with status ${response.statusText}`);
this.url = void 0;
this.response = void 0;
this.url = url;

@@ -85,3 +109,3 @@ this.response = response;

const InvalidPackageNameError = /*#__PURE__*/makeError__default('InvalidPackageNameError');
const InvalidPackageNameError = /*#__PURE__*/makeError__default["default"]('InvalidPackageNameError');
/**

@@ -93,5 +117,15 @@ * `InvalidPackageVersionError` is thrown when a package's version does not exist.

const InvalidPackageVersionError = /*#__PURE__*/makeError__default('InvalidPackageVersionError');
const InvalidPackageVersionError = /*#__PURE__*/makeError__default["default"]('InvalidPackageVersionError');
const log = /*#__PURE__*/debug('query-registry');
async function log(formatter, ...args) {
{
try {
const {
debug
} = await Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require('debug')); });
const logger = debug('query-registry');
logger(formatter, args);
} catch {}
}
}

@@ -104,3 +138,3 @@ function assertValidPackageName({

validForNewPackages
} = validatePackageName(name);
} = validatePackageName__default["default"](name);
const valid = validForOldPackages || validForNewPackages;

@@ -118,3 +152,3 @@

const fiveMinutesTTL = 5 * 60 * 1000;
const cache = /*#__PURE__*/lru(maxItems, fiveMinutesTTL);
const cache = /*#__PURE__*/lru__default["default"](maxItems, fiveMinutesTTL);
async function fetch({

@@ -134,3 +168,3 @@ url,

const response = await unfetch(url);
const response = await unfetch__default["default"](url);

@@ -706,3 +740,3 @@ if (!response.ok) {

try {
info = gitUrlParse(url);
info = gitUrlParse__default["default"](url);
} catch {}

@@ -709,0 +743,0 @@

@@ -1,2 +0,2 @@

"use strict";function r(r){return r&&"object"==typeof r&&"default"in r?r.default:r}Object.defineProperty(exports,"__esModule",{value:!0});var e=r(require("validate-npm-package-name")),t=require("make-error"),n=r(t),a=r(require("debug")),i=r(require("isomorphic-unfetch")),s=r(require("tiny-lru")),o=r(require("git-url-parse"));const c=["https://registry.npmjs.cf","https://registry.yarnpkg.com"];class d extends t.BaseError{constructor(r,e){super(`fetch: request to ${r} failed with status ${e.statusText}`),this.url=r,this.response=e}}const u=n("InvalidPackageNameError"),p=n("InvalidPackageVersionError"),g=a("query-registry");function y({name:r}){const{validForOldPackages:t,validForNewPackages:n}=e(r);if(!t&&!n)throw g("assertValidPackageName: invalid package name: %O",{name:r}),new u(`invalid package name: '${r}'`)}const l=s(250,3e5);async function m({url:r,cached:e=!0}){const t=l.get(r);if(e&&t)return g("fetch: returning cached response: %O",{url:r,cachedJSON:t}),t;const n=await i(r);if(!n.ok)throw g("fetch: request failed: %O",{url:r,status:n.statusText,response:n}),new d(r,n);const a=await n.json();return e&&l.set(r,a),g("fetch: returning fresh response: %O",{url:r,json:a}),a}async function f({endpoint:r,query:e,registry:t="https://registry.npmjs.org",mirrors:n=c,cached:a}){const i=[t,...n].map(t=>{const n=new URL(r,t);return n.search=null!=e?e:"",n.href});let s;for(const r of i)try{return await m({url:r,cached:a})}catch(r){s=r}throw g("fetchFromRegistry: cannot retrieve data from registry or mirrors: %O",{endpoint:r,query:e,registry:t,mirrors:n,lastError:s}),s}async function h({endpoint:r,registryDownloadsAPI:e="https://api.npmjs.org",cached:t}){return f({endpoint:r,registry:e,mirrors:[],cached:t})}function w({rawDownloadPeriod:r="last-week"}){if("string"==typeof r)return r;if(r instanceof Date)return P(r);const{start:e,end:t}=r;return`${P(e)}:${P(t)}`}function P(r){return r.toISOString().split("T")[0]}function k({rawPackument:r,version:e="latest"}){var t;const{name:n,"dist-tags":a,versions:i}=r,s=i[null!=(t=a[e])?t:e];if(!s)throw g("getPackageManifest: invalid package version: %O",{name:n,version:e}),new p(`invalid package version: '${n}@${e}'`);return s}async function v({name:r,registry:e,mirrors:t,cached:n}){return y({name:r}),f({endpoint:"/"+r,registry:e,mirrors:t,cached:n})}async function x({name:r,version:e,registry:t,mirrors:n,cached:a}){return k({rawPackument:await v({name:r,registry:t,mirrors:n,cached:a}),version:e})}function D({rawLicense:r}){if(r&&"string"==typeof r)return r}function $({rawRepository:r}){return function(r){return r&&"object"==typeof r&&"string"==typeof r.url&&["string","undefined"].includes(typeof r.type)&&["string","undefined"].includes(typeof r.directory)}(r)?R({rawRepository:r}):"string"==typeof r?R({rawRepository:{url:r}}):void 0}function R({rawRepository:r}){const{url:e,directory:t}=r,n=function({url:r}){let e;try{e=o(r)}catch{}return e}({url:e});if(!n)return;const{source:a,full_name:i,filepath:s}=n;return{type:"git",url:`https://${a.replace(/^$/,"github.com").replace(/^github$/,"github.com").replace(/^gitlab$/,"gitlab.com").replace(/^bitbucket$/,"bitbucket.org")}/${i}`,directory:null!=t?t:""!==s?s:void 0}}exports.FetchError=d,exports.InvalidPackageNameError=u,exports.InvalidPackageVersionError=p,exports.cloudflareRegistry="https://registry.npmjs.cf",exports.getDailyPackageDownloads=async function({name:r,period:e,registryDownloadsAPI:t,cached:n}){return y({name:r}),h({endpoint:`/downloads/range/${w({rawDownloadPeriod:e})}/${r}`,registryDownloadsAPI:t,cached:n})},exports.getDailyRegistryDownloads=async function({period:r,registryDownloadsAPI:e,cached:t}={}){return h({endpoint:"/downloads/range/"+w({rawDownloadPeriod:r}),registryDownloadsAPI:e,cached:t})},exports.getPackageDownloads=async function({name:r,period:e,registryDownloadsAPI:t,cached:n}){return y({name:r}),h({endpoint:`/downloads/point/${w({rawDownloadPeriod:e})}/${r}`,registryDownloadsAPI:t,cached:n})},exports.getPackageManifest=async function({name:r,version:e,registry:t,mirrors:n,cached:a}){const i=await v({name:r,registry:t,mirrors:n,cached:a}),s=k({rawPackument:i,version:e});return await async function({rawPackageManifest:r,rawPackument:e,registry:t,mirrors:n,cached:a}){const{_id:i,name:s,version:o,license:c,repository:d,_npmUser:u}=r,p=e.time[o],g=D({rawLicense:c}),y=$({rawRepository:d}),l=await async function({rawPackageManifest:r,registry:e,mirrors:t,cached:n}){const{name:a,types:i,typings:s}=r,o=function({name:r}){return r.startsWith("@types/")?r:"@types/"+r.replace("@","").replace("/","__")}({name:a});if(a===o||i||s)return;let c=!1;try{const{deprecated:r}=await x({name:o,registry:e,mirrors:t,cached:n});c=void 0===r}catch{}return c?o:void 0}({rawPackageManifest:r,registry:t,mirrors:n,cached:a}),m=function({name:r}){if(!r.startsWith("@types/"))return;const[e,t]=r.replace("@types/","").split("__");return t?`@${e}/${t}`:e}({name:s});return{...r,id:i,createdAt:p,publisher:u,license:g,gitRepository:y,definitelyTypedName:l,untypedName:m}}({rawPackageManifest:s,rawPackument:i,registry:t,mirrors:n,cached:a})},exports.getPackument=async function({name:r,registry:e,mirrors:t,cached:n}){return function({rawPackument:r}){const{_id:e,"dist-tags":t,time:n,license:a,repository:i}=r,s=D({rawLicense:a}),o=$({rawRepository:i}),c=Object.fromEntries(Object.entries(n).filter(([r])=>!["created","modified"].includes(r)));return{...r,id:e,distTags:t,versionsToTimestamps:c,license:s,gitRepository:o}}({rawPackument:await v({name:r,registry:e,mirrors:t,cached:n})})},exports.getRawPackageManifest=x,exports.getRawPackument=v,exports.getRegistryDownloads=async function({period:r,registryDownloadsAPI:e,cached:t}={}){return h({endpoint:"/downloads/point/"+w({rawDownloadPeriod:r}),registryDownloadsAPI:e,cached:t})},exports.getRegistryMetadata=async function({registry:r,cached:e}={}){return f({registry:r,mirrors:[],endpoint:"/",cached:e})},exports.npmRegistry="https://registry.npmjs.org",exports.npmRegistryDownloadsAPI="https://api.npmjs.org",exports.npmRegistryMirrors=c,exports.searchPackages=async function({query:r,registry:e,mirrors:t,cached:n}){return f({endpoint:"/-/v1/search",query:function({rawSearchCriteria:r}){return Object.entries(r).filter(([,r])=>["string","number"].includes(typeof r)).map(([r,e])=>`${r}=${e}`).join("&")}({rawSearchCriteria:r}),registry:e,mirrors:t,cached:n})},exports.yarnRegistry="https://registry.yarnpkg.com";
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var r=require("validate-npm-package-name"),e=require("make-error"),t=require("isomorphic-unfetch"),n=require("tiny-lru"),a=require("git-url-parse");function i(r){return r&&"object"==typeof r&&"default"in r?r:{default:r}}var s=i(r),o=i(e),c=i(t),d=i(n),u=i(a);const p=["https://registry.npmjs.cf","https://registry.yarnpkg.com"];class y extends e.BaseError{constructor(r,e){super(`fetch: request to ${r} failed with status ${e.statusText}`),this.url=void 0,this.response=void 0,this.url=r,this.response=e}}const g=o.default("InvalidPackageNameError"),l=o.default("InvalidPackageVersionError");async function f(r,...e){}function m({name:r}){const{validForOldPackages:e,validForNewPackages:t}=s.default(r);if(!e&&!t)throw f(),new g(`invalid package name: '${r}'`)}const w=d.default(250,3e5);async function h({url:r,cached:e=!0}){const t=w.get(r);if(e&&t)return f(),t;const n=await c.default(r);if(!n.ok)throw f(),new y(r,n);const a=await n.json();return e&&w.set(r,a),f(),a}async function P({endpoint:r,query:e,registry:t="https://registry.npmjs.org",mirrors:n=p,cached:a}){const i=[t,...n].map((t=>{const n=new URL(r,t);return n.search=null!=e?e:"",n.href}));let s;for(const r of i)try{return await h({url:r,cached:a})}catch(r){s=r}throw f(),s}async function k({endpoint:r,registryDownloadsAPI:e="https://api.npmjs.org",cached:t}){return P({endpoint:r,registry:e,mirrors:[],cached:t})}function v({rawDownloadPeriod:r="last-week"}){if("string"==typeof r)return r;if(r instanceof Date)return $(r);const{start:e,end:t}=r;return`${$(e)}:${$(t)}`}function $(r){return r.toISOString().split("T")[0]}function D({rawPackument:r,version:e="latest"}){var t;const{name:n,"dist-tags":a,versions:i}=r,s=i[null!=(t=a[e])?t:e];if(!s)throw f(),new l(`invalid package version: '${n}@${e}'`);return s}async function x({name:r,registry:e,mirrors:t,cached:n}){return m({name:r}),P({endpoint:`/${r}`,registry:e,mirrors:t,cached:n})}async function R({name:r,version:e,registry:t,mirrors:n,cached:a}){return D({rawPackument:await x({name:r,registry:t,mirrors:n,cached:a}),version:e})}function b({rawLicense:r}){if(r&&"string"==typeof r)return r}function I({rawRepository:r}){return function(r){return r&&"object"==typeof r&&"string"==typeof r.url&&["string","undefined"].includes(typeof r.type)&&["string","undefined"].includes(typeof r.directory)}(r)?j({rawRepository:r}):"string"==typeof r?j({rawRepository:{url:r}}):void 0}function j({rawRepository:r}){const{url:e,directory:t}=r,n=function({url:r}){let e;try{e=u.default(r)}catch{}return e}({url:e});if(!n)return;const{source:a,full_name:i,filepath:s}=n;return{type:"git",url:`https://${a.replace(/^$/,"github.com").replace(/^github$/,"github.com").replace(/^gitlab$/,"gitlab.com").replace(/^bitbucket$/,"bitbucket.org")}/${i}`,directory:null!=t?t:""!==s?s:void 0}}exports.FetchError=y,exports.InvalidPackageNameError=g,exports.InvalidPackageVersionError=l,exports.cloudflareRegistry="https://registry.npmjs.cf",exports.getDailyPackageDownloads=async function({name:r,period:e,registryDownloadsAPI:t,cached:n}){return m({name:r}),k({endpoint:`/downloads/range/${v({rawDownloadPeriod:e})}/${r}`,registryDownloadsAPI:t,cached:n})},exports.getDailyRegistryDownloads=async function({period:r,registryDownloadsAPI:e,cached:t}={}){return k({endpoint:`/downloads/range/${v({rawDownloadPeriod:r})}`,registryDownloadsAPI:e,cached:t})},exports.getPackageDownloads=async function({name:r,period:e,registryDownloadsAPI:t,cached:n}){return m({name:r}),k({endpoint:`/downloads/point/${v({rawDownloadPeriod:e})}/${r}`,registryDownloadsAPI:t,cached:n})},exports.getPackageManifest=async function({name:r,version:e,registry:t,mirrors:n,cached:a}){const i=await x({name:r,registry:t,mirrors:n,cached:a}),s=D({rawPackument:i,version:e});return await async function({rawPackageManifest:r,rawPackument:e,registry:t,mirrors:n,cached:a}){const{_id:i,name:s,version:o,license:c,repository:d,_npmUser:u}=r,p=e.time[o],y=b({rawLicense:c}),g=I({rawRepository:d}),l=await async function({rawPackageManifest:r,registry:e,mirrors:t,cached:n}){const{name:a,types:i,typings:s}=r,o=function({name:r}){return r.startsWith("@types/")?r:`@types/${r.replace("@","").replace("/","__")}`}({name:a});if(a===o||i||s)return;let c=!1;try{const{deprecated:r}=await R({name:o,registry:e,mirrors:t,cached:n});c=void 0===r}catch{}return c?o:void 0}({rawPackageManifest:r,registry:t,mirrors:n,cached:a}),f=function({name:r}){if(!r.startsWith("@types/"))return;const[e,t]=r.replace("@types/","").split("__");return t?`@${e}/${t}`:e}({name:s});return{...r,id:i,createdAt:p,publisher:u,license:y,gitRepository:g,definitelyTypedName:l,untypedName:f}}({rawPackageManifest:s,rawPackument:i,registry:t,mirrors:n,cached:a})},exports.getPackument=async function({name:r,registry:e,mirrors:t,cached:n}){return function({rawPackument:r}){const{_id:e,"dist-tags":t,time:n,license:a,repository:i}=r,s=b({rawLicense:a}),o=I({rawRepository:i}),c=Object.fromEntries(Object.entries(n).filter((([r])=>!["created","modified"].includes(r))));return{...r,id:e,distTags:t,versionsToTimestamps:c,license:s,gitRepository:o}}({rawPackument:await x({name:r,registry:e,mirrors:t,cached:n})})},exports.getRawPackageManifest=R,exports.getRawPackument=x,exports.getRegistryDownloads=async function({period:r,registryDownloadsAPI:e,cached:t}={}){return k({endpoint:`/downloads/point/${v({rawDownloadPeriod:r})}`,registryDownloadsAPI:e,cached:t})},exports.getRegistryMetadata=async function({registry:r,cached:e}={}){return P({registry:r,mirrors:[],endpoint:"/",cached:e})},exports.npmRegistry="https://registry.npmjs.org",exports.npmRegistryDownloadsAPI="https://api.npmjs.org",exports.npmRegistryMirrors=p,exports.searchPackages=async function({query:r,registry:e,mirrors:t,cached:n}){const a=function({rawSearchCriteria:r}){return Object.entries(r).filter((([,r])=>["string","number"].includes(typeof r))).map((([r,e])=>`${r}=${e}`)).join("&")}({rawSearchCriteria:r});return P({endpoint:"/-/v1/search",query:a,registry:e,mirrors:t,cached:n})},exports.yarnRegistry="https://registry.yarnpkg.com";
//# sourceMappingURL=query-registry.cjs.production.min.js.map

@@ -16,2 +16,4 @@ import makeError, { BaseError } from 'make-error';

super(`fetch: request to ${url} failed with status ${response.statusText}`);
this.url = void 0;
this.response = void 0;
this.url = url;

@@ -18,0 +20,0 @@ this.response = response;

import { npmRegistry, npmRegistryMirrors } from '../data/registries.esm.js';
import { fetch } from './fetch.esm.js';
import { log } from './log.esm.js';
import { fetch } from './fetch.esm.js';

@@ -5,0 +5,0 @@ async function fetchFromRegistry({

@@ -0,5 +1,5 @@

import unfetch from 'isomorphic-unfetch';
import lru from 'tiny-lru';
import { FetchError } from './errors.esm.js';
import { log } from './log.esm.js';
import unfetch from 'isomorphic-unfetch';
import lru from 'tiny-lru';

@@ -6,0 +6,0 @@ const maxItems = 250;

@@ -1,3 +0,2 @@

import debug from 'debug';
export declare const log: debug.Debugger;
export declare function log(formatter: any, ...args: any[]): Promise<void>;
//# sourceMappingURL=log.d.ts.map

@@ -1,6 +0,14 @@

import debug from 'debug';
async function log(formatter, ...args) {
if (process.env.NODE_ENV !== 'production') {
try {
const {
debug
} = await import('debug');
const logger = debug('query-registry');
logger(formatter, args);
} catch {}
}
}
const log = /*#__PURE__*/debug('query-registry');
export { log };
//# sourceMappingURL=log.esm.js.map
{
"name": "query-registry",
"description": "Query the npm registry for packuments, manifests, packages and download counts",
"version": "2.0.0",
"author": "velut",
"version": "2.1.0-0",
"author": "Edoardo Scibona (velut)",
"license": "MIT",

@@ -11,2 +11,3 @@ "source": "./src/index.ts",

"types": "./dist/index.d.ts",
"sideEffects": false,
"exports": {

@@ -20,6 +21,5 @@ ".": {

},
"sideEffects": false,
"files": [
"dist",
"src"
"src",
"dist"
],

@@ -30,12 +30,12 @@ "engines": {

"scripts": {
"start": "tsdx watch --target node",
"start": "dts watch --target node",
"build:check": "tsc --noEmit",
"build": "tsc --noEmit && tsdx build --target node",
"test": "tsdx test --runInBand",
"test:cov": "tsdx test --runInBand --coverage",
"test:watch": "tsdx test --runInBand --watchAll --coverage",
"test:ci": "tsdx test --runInBand --ci --coverage",
"lint": "tsdx lint src test",
"lint:fix": "tsdx lint src test --fix",
"prepare": "tsdx build --target node",
"build": "tsc --noEmit && dts build --target node",
"test": "dts test --runInBand",
"test:cov": "dts test --runInBand --coverage",
"test:watch": "dts test --runInBand --watchAll --coverage",
"test:ci": "dts test --runInBand --ci --coverage",
"lint": "dts lint src test",
"lint:fix": "dts lint src test --fix",
"prepare": "husky install && dts build --target node",
"pre-push": "yarn && yarn lint && yarn build && yarn test:cov",

@@ -64,20 +64,2 @@ "release": "np"

],
"husky": {
"hooks": {
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS",
"pre-commit": "yarn lint",
"pre-push": "yarn pre-push"
}
},
"prettier": {
"printWidth": 80,
"tabWidth": 4,
"semi": true,
"singleQuote": true,
"trailingComma": "es5",
"arrowParens": "always"
},
"np": {
"branch": "main"
},
"dependencies": {

@@ -92,25 +74,24 @@ "debug": "^4.1.1",

"devDependencies": {
"@commitlint/cli": "12.0.1",
"@commitlint/config-conventional": "12.0.1",
"@pollyjs/adapter-node-http": "5.1.0",
"@pollyjs/core": "5.1.0",
"@pollyjs/persister-fs": "5.0.0",
"@types/debug": "4.1.5",
"@types/git-url-parse": "9.0.0",
"@commitlint/cli": "15.0.0",
"@commitlint/config-conventional": "15.0.0",
"@pollyjs/adapter-node-http": "5.1.1",
"@pollyjs/core": "5.1.1",
"@pollyjs/persister-fs": "5.1.1",
"@types/debug": "4.1.7",
"@types/git-url-parse": "9.0.1",
"@types/pollyjs__adapter-node-http": "2.0.1",
"@types/pollyjs__core": "4.3.2",
"@types/pollyjs__core": "4.3.3",
"@types/pollyjs__persister-fs": "2.0.1",
"@types/setup-polly-jest": "0.5.1",
"@types/validate-npm-package-name": "3.0.2",
"eslint-plugin-prettier": "3.3.1",
"husky": "4.3.8",
"nock": "13.0.11",
"np": "7.4.0",
"prettier": "2.2.1",
"setup-polly-jest": "0.9.1",
"tsdx": "0.14.1",
"tslib": "2.1.0",
"typescript": "4.2.3"
},
"peerDependencies": {}
"@types/validate-npm-package-name": "3.0.3",
"dts-cli": "0.19.7",
"eslint-plugin-prettier": "4.0.0",
"husky": "7.0.4",
"nock": "13.2.1",
"np": "7.6.0",
"prettier": "2.4.1",
"setup-polly-jest": "0.10.0",
"tslib": "2.3.1",
"typescript": "4.5.2"
}
}

@@ -7,6 +7,5 @@ # query-registry

![Language](https://img.shields.io/github/languages/top/velut/node-query-registry)
[![Dependencies](https://img.shields.io/david/velut/node-query-registry)](https://david-dm.org/velut/node-query-registry)
[![npm bundle size](https://img.shields.io/bundlephobia/min/query-registry)](https://bundlephobia.com/result?p=query-registry)
[![npm](https://img.shields.io/npm/v/query-registry)](https://www.npmjs.com/package/query-registry)
[![License](https://img.shields.io/github/license/velut/node-query-registry)](https://github.com/velut/node-query-registry/blob/master/LICENSE)
[![License](https://img.shields.io/github/license/velut/node-query-registry)](https://github.com/velut/node-query-registry/blob/main/LICENSE)

@@ -31,3 +30,3 @@ This package exports several functions to query the [npm registry](https://www.npmjs.com) (or one of its mirrors) through one of its [endpoints](https://github.com/npm/registry/blob/master/docs/REGISTRY-API.md).

- Explore the API on [**jsDocs.io**](https://www.jsdocs.io/package/query-registry)
- [**Explore the API on jsDocs.io**](https://www.jsdocs.io/package/query-registry)
- View package contents on [**unpkg**](https://unpkg.com/query-registry/)

@@ -34,0 +33,0 @@ - View repository on [**GitHub**](https://github.com/velut/node-query-registry)

@@ -6,5 +6,4 @@ import validatePackageName from 'validate-npm-package-name';

export function assertValidPackageName({ name }: { name: string }): void {
const { validForOldPackages, validForNewPackages } = validatePackageName(
name
);
const { validForOldPackages, validForNewPackages } =
validatePackageName(name);
const valid = validForOldPackages || validForNewPackages;

@@ -11,0 +10,0 @@ if (!valid) {

@@ -32,3 +32,3 @@ import { npmRegistry, npmRegistryMirrors } from '../data/registries';

// Keep last fetch error
lastError = err;
lastError = err as any;
}

@@ -35,0 +35,0 @@ }

@@ -1,3 +0,9 @@

import debug from 'debug';
export const log = debug('query-registry');
export async function log(formatter: any, ...args: any[]): Promise<void> {
if (process.env.NODE_ENV !== 'production') {
try {
const { debug } = await import('debug');
const logger = debug('query-registry');
logger(formatter, args);
} catch {}
}
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc