Socket
Socket
Sign inDemoInstall

@definitelytyped/utils

Package Overview
Dependencies
Maintainers
7
Versions
260
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@definitelytyped/utils - npm Package Compare versions

Comparing version 0.0.183 to 0.0.184

12

CHANGELOG.md
# @definitelytyped/utils
## 0.0.184
### Patch Changes
- a18ce6b1: Remove use of module resolution and OTHER_FILES, instead include all dts files in packages
Files in packages are no longer determined by import resolution stemming from `index.d.ts` and tests (along with those listed in `OTHER_FILES.txt`).
Instead, all files matching the glob `**/*.d.{ts,cts,mts,*.d.ts}` are included in the package, excluding those inside of versioned subdirectories.
While not used for automated package publishing, an `.npmignore` is now required in each package.
This allows for one-off `npm pack`-ing of packages, such that external tooling can get a rough approximation of what will be published for analysis.
## 0.0.183

@@ -4,0 +16,0 @@

1

dist/fs.d.ts

@@ -26,3 +26,2 @@ /** Convert a path to use "/" instead of "\\" for consistency. (This affects content hash.) */

}
export declare function createModuleResolutionHost(fs: FS, ignoreFilesAboveDirectory?: string): import("typescript").ModuleResolutionHost;
interface ReadonlyDir extends ReadonlyMap<string, ReadonlyDir | string> {

@@ -29,0 +28,0 @@ readonly parent: Dir | undefined;

@@ -6,3 +6,3 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.DiskFS = exports.InMemoryFS = exports.Dir = exports.createModuleResolutionHost = exports.joinPaths = exports.hasWindowsSlashes = exports.normalizeSlashes = void 0;
exports.DiskFS = exports.InMemoryFS = exports.Dir = exports.joinPaths = exports.hasWindowsSlashes = exports.normalizeSlashes = void 0;
const assert_1 = __importDefault(require("assert"));

@@ -27,18 +27,2 @@ const path_1 = require("path");

exports.joinPaths = joinPaths;
function createModuleResolutionHost(fs, ignoreFilesAboveDirectory) {
return {
fileExists: (fileName) => !isIgnored(fileName) && fs.exists(fileName),
readFile: (fileName) => ((0, assert_1.default)(!isIgnored(fileName)), fs.readFile(fileName)),
directoryExists: (directoryName) => !isIgnored(directoryName) && fs.exists(directoryName),
getCurrentDirectory: () => "",
realpath: (path) => path,
useCaseSensitiveFileNames: () => true,
};
function isIgnored(path) {
return (ignoreFilesAboveDirectory !== undefined &&
path !== ignoreFilesAboveDirectory &&
!path.startsWith(ignoreFilesAboveDirectory));
}
}
exports.createModuleResolutionHost = createModuleResolutionHost;
// Map entries are Dir for directory and string for file.

@@ -45,0 +29,0 @@ class Dir extends Map {

@@ -12,2 +12,8 @@ export declare function tryParseJson<T>(text: string): unknown;

export declare function mangleScopedPackage(packageName: string): string;
export declare const atTypesSlash = "@types/";
export declare function isTypesPackageName(packageName: string): boolean;
export declare function trimAtTypesPrefixIfPresent(packageName: string): string;
export declare function mustTrimAtTypesPrefix(packageName: string): string;
export declare function typesPackageNameToRealName(typesPackageName: string): string;
export declare function sleep(seconds: number): Promise<void>;
export declare function isDeclarationPath(path: string): boolean;

@@ -6,4 +6,5 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.sleep = exports.mangleScopedPackage = exports.unmangleScopedPackage = exports.isScopedPackage = exports.computeHash = exports.withoutStart = exports.isObject = exports.identity = exports.parseJson = exports.tryParseJson = void 0;
exports.isDeclarationPath = exports.sleep = exports.typesPackageNameToRealName = exports.mustTrimAtTypesPrefix = exports.trimAtTypesPrefixIfPresent = exports.isTypesPackageName = exports.atTypesSlash = exports.mangleScopedPackage = exports.unmangleScopedPackage = exports.isScopedPackage = exports.computeHash = exports.withoutStart = exports.isObject = exports.identity = exports.parseJson = exports.tryParseJson = void 0;
const crypto_1 = __importDefault(require("crypto"));
const minimatch_1 = require("minimatch");
function tryParseJson(text, predicate) {

@@ -67,2 +68,30 @@ try {

exports.mangleScopedPackage = mangleScopedPackage;
exports.atTypesSlash = "@types/";
function isTypesPackageName(packageName) {
return packageName.startsWith(exports.atTypesSlash);
}
exports.isTypesPackageName = isTypesPackageName;
function trimAtTypesPrefix(packageName) {
return packageName.slice(exports.atTypesSlash.length);
}
function trimAtTypesPrefixIfPresent(packageName) {
if (isTypesPackageName(packageName)) {
return trimAtTypesPrefix(packageName);
}
return packageName;
}
exports.trimAtTypesPrefixIfPresent = trimAtTypesPrefixIfPresent;
function mustTrimAtTypesPrefix(packageName) {
if (!isTypesPackageName(packageName)) {
throw new Error(`Not a types package name: ${packageName}`);
}
return trimAtTypesPrefix(packageName);
}
exports.mustTrimAtTypesPrefix = mustTrimAtTypesPrefix;
function typesPackageNameToRealName(typesPackageName) {
var _a;
const name = mustTrimAtTypesPrefix(typesPackageName);
return (_a = unmangleScopedPackage(name)) !== null && _a !== void 0 ? _a : name;
}
exports.typesPackageNameToRealName = typesPackageNameToRealName;
async function sleep(seconds) {

@@ -72,2 +101,10 @@ return new Promise((resolve) => setTimeout(resolve, seconds * 1000));

exports.sleep = sleep;
const declarationMatcher = new minimatch_1.Minimatch("**/*.d.{ts,cts,mts,*.ts}", { optimizationLevel: 2 });
function isDeclarationPath(path) {
if (process.platform === "win32") {
path = path.replace(/\\/g, "/");
}
return declarationMatcher.match(path);
}
exports.isDeclarationPath = isDeclarationPath;
//# sourceMappingURL=miscellany.js.map
{
"name": "@definitelytyped/utils",
"version": "0.0.183",
"version": "0.0.184",
"description": "Shared utilities for DefinitelyTyped tools",

@@ -22,2 +22,3 @@ "homepage": "https://github.com/microsoft/DefinitelyTyped-tools/tree/master/packages/utils#readme",

"fs-extra": "^8.1.0",
"minimatch": "^9.0.3",
"tar": "^6.1.11",

@@ -24,0 +25,0 @@ "tar-stream": "^2.1.4",

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