Socket
Socket
Sign inDemoInstall

@definitelytyped/definitions-parser

Package Overview
Dependencies
Maintainers
8
Versions
536
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@definitelytyped/definitions-parser - npm Package Compare versions

Comparing version 0.0.202 to 0.1.0

13

CHANGELOG.md
# @definitelytyped/definitions-parser
## 0.1.0
### Minor Changes
- 2d7a5d3: Require Node 18+
### Patch Changes
- Updated dependencies [2d7a5d3]
- @definitelytyped/typescript-versions@0.1.0
- @definitelytyped/header-parser@0.2.0
- @definitelytyped/utils@0.1.0
## 0.0.202

@@ -4,0 +17,0 @@

3

dist/lib/definition-parser.js

@@ -42,3 +42,2 @@ "use strict";

const older = await Promise.all(olderVersionDirectories.map(async ({ directoryName, version: directoryVersion }) => {
var _a;
if (matchesVersion(latestData, directoryVersion, considerLibraryMinorVersion)) {

@@ -60,3 +59,3 @@ const latest = `${latestData.header.libraryMajorVersion}.${latestData.header.libraryMinorVersion}`;

if (considerLibraryMinorVersion) {
errors.push(`Directory ${directoryName} indicates major.minor version ${directoryVersion.major}.${(_a = directoryVersion.minor) !== null && _a !== void 0 ? _a : "*"}, ` +
errors.push(`Directory ${directoryName} indicates major.minor version ${directoryVersion.major}.${directoryVersion.minor ?? "*"}, ` +
`but package.json indicates major.minor version ${data.header.libraryMajorVersion}.${data.header.libraryMinorVersion}`);

@@ -63,0 +62,0 @@ }

@@ -31,2 +31,4 @@ "use strict";

class DTMock {
fs;
root;
constructor() {

@@ -33,0 +35,0 @@ this.root = new utils_1.Dir(undefined);

@@ -34,2 +34,5 @@ "use strict";

class AllPackages {
dt;
types;
notNeeded;
static fromFS(dt) {

@@ -59,2 +62,5 @@ return new AllPackages(dt, new Map(), readNotNeededPackages(dt));

}
/** Keys are `typesDirectoryName` strings */
errors = new Map();
isComplete = false;
constructor(dt,

@@ -66,5 +72,2 @@ /** Keys are `typesDirectoryName` strings */

this.notNeeded = notNeeded;
/** Keys are `typesDirectoryName` strings */
this.errors = new Map();
this.isComplete = false;
}

@@ -90,11 +93,9 @@ getNotNeededPackage(typesDirectoryName) {

async tryResolve(dep) {
var _a, _b;
const typesDirectoryName = (_a = dep.typesDirectoryName) !== null && _a !== void 0 ? _a : (0, utils_1.trimAtTypesPrefixIfPresent)(dep.name);
const typesDirectoryName = dep.typesDirectoryName ?? (0, utils_1.trimAtTypesPrefixIfPresent)(dep.name);
const versions = await this.tryGetTypingsVersions(typesDirectoryName);
const depVersion = new semver.Range(dep.version === "*" ? "*" : `^${formatTypingVersion(dep.version)}`);
return (versions && ((_b = versions.tryGet(depVersion)) === null || _b === void 0 ? void 0 : _b.id)) || dep;
return (versions && versions.tryGet(depVersion)?.id) || dep;
}
async resolve(dep) {
var _a;
const typesDirectoryName = (_a = dep.typesDirectoryName) !== null && _a !== void 0 ? _a : (0, utils_1.trimAtTypesPrefixIfPresent)(dep.name);
const typesDirectoryName = dep.typesDirectoryName ?? (0, utils_1.trimAtTypesPrefixIfPresent)(dep.name);
const versions = await this.tryGetTypingsVersions(typesDirectoryName);

@@ -130,4 +131,3 @@ if (!versions) {

async tryGetTypingsData(pkg) {
var _a;
const typesDirectoryName = (_a = pkg.typesDirectoryName) !== null && _a !== void 0 ? _a : (0, utils_1.trimAtTypesPrefixIfPresent)(pkg.name);
const typesDirectoryName = pkg.typesDirectoryName ?? (0, utils_1.trimAtTypesPrefixIfPresent)(pkg.name);
const versions = await this.tryGetTypingsVersions(typesDirectoryName);

@@ -246,2 +246,5 @@ return (versions && versions.tryGet(new semver.Range(pkg.version === "*" ? "*" : `^${formatTypingVersion(pkg.version)}`)));

class NotNeededPackage extends PackageBase {
name;
libraryName;
version;
get license() {

@@ -295,2 +298,7 @@ return "MIT" /* License.MIT */;

class TypingsVersions {
map;
/**
* Sorted from latest to oldest.
*/
versions;
constructor(dt, data) {

@@ -331,2 +339,5 @@ /**

class TypingsData extends PackageBase {
dt;
data;
isLatest;
constructor(dt, data, isLatest) {

@@ -342,4 +353,3 @@ super();

get libraryName() {
var _a, _b;
return ((_b = (_a = this.data.header.nonNpmDescription) !== null && _a !== void 0 ? _a : (0, utils_1.unmangleScopedPackage)(this.typesDirectoryName)) !== null && _b !== void 0 ? _b : this.typesDirectoryName);
return (this.data.header.nonNpmDescription ?? (0, utils_1.unmangleScopedPackage)(this.typesDirectoryName) ?? this.typesDirectoryName);
}

@@ -366,2 +376,3 @@ get contributors() {

}
_files;
getFiles() {

@@ -381,8 +392,6 @@ if (!this._files) {

get dependencies() {
var _a;
return (_a = this.data.dependencies) !== null && _a !== void 0 ? _a : {};
return this.data.dependencies ?? {};
}
get devDependencies() {
var _a;
return (_a = this.data.devDependencies) !== null && _a !== void 0 ? _a : {};
return this.data.devDependencies ?? {};
}

@@ -397,5 +406,5 @@ *allPackageJsonDependencies() {

}
_contentHash;
getContentHash() {
var _a;
return ((_a = this._contentHash) !== null && _a !== void 0 ? _a : (this._contentHash = hash([...this.getFiles(), "package.json"], this.dt.subDir("types").subDir(this.subDirectoryPath))));
return (this._contentHash ??= hash([...this.getFiles(), "package.json"], this.dt.subDir("types").subDir(this.subDirectoryPath)));
}

@@ -437,3 +446,2 @@ get projectName() {

function getDependencyFromFile(file) {
var _a;
const parts = file.split("/");

@@ -449,3 +457,3 @@ if (parts.length <= 2) {

const [typesDirName, name, packageVersion, tsVersion, scripts] = parts;
const version = (_a = (0, definition_parser_1.parseVersionFromDirectoryName)(packageVersion)) !== null && _a !== void 0 ? _a : "*";
const version = (0, definition_parser_1.parseVersionFromDirectoryName)(packageVersion) ?? "*";
if (

@@ -452,0 +460,0 @@ // package is not in types directory

{
"name": "@definitelytyped/definitions-parser",
"version": "0.0.202",
"version": "0.1.0",
"description": "Reads the DefinitelyTyped repository and provides an API for querying its metadata",

@@ -18,9 +18,9 @@ "homepage": "https://github.com/microsoft/DefinitelyTyped-tools/tree/main/packages/definitions-parser#readme",

"dependencies": {
"@types/node": "^16.18.71",
"@types/node": "^18.19.7",
"@types/semver": "^7.5.6",
"pacote": "^17.0.5",
"semver": "^7.5.4",
"@definitelytyped/header-parser": "0.1.2",
"@definitelytyped/typescript-versions": "0.0.184",
"@definitelytyped/utils": "0.0.192"
"@definitelytyped/header-parser": "0.2.0",
"@definitelytyped/typescript-versions": "0.1.0",
"@definitelytyped/utils": "0.1.0"
},

@@ -38,3 +38,3 @@ "devDependencies": {

"engines": {
"node": ">=16.17.0"
"node": ">=18.18.0"
},

@@ -41,0 +41,0 @@ "scripts": {

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc