UEA-PRODEM
This commit is contained in:
+19
-12
@@ -101,6 +101,12 @@ function collectComments(execute, fullText) {
|
||||
function isJsxElementOrFragment(node) {
|
||||
return node.kind === ts9__default.default.SyntaxKind.JsxElement || node.kind === ts9__default.default.SyntaxKind.JsxFragment;
|
||||
}
|
||||
var [tsMajor, tsMinor] = ts9__default.default.versionMajorMinor.split(".").map((raw) => Number.parseInt(raw, 10));
|
||||
function isTsVersionAtLeast(major, minor = 0) {
|
||||
return tsMajor > major || tsMajor === major && tsMinor >= minor;
|
||||
}
|
||||
|
||||
// src/compilerOptions.ts
|
||||
function isCompilerOptionEnabled(options, option) {
|
||||
switch (option) {
|
||||
case "allowJs":
|
||||
@@ -139,7 +145,12 @@ function isCompilerOptionEnabled(options, option) {
|
||||
return options[option] === true;
|
||||
}
|
||||
function isStrictCompilerOptionEnabled(options, option) {
|
||||
return (options.strict ? options[option] !== false : options[option] === true) && (option !== "strictPropertyInitialization" || isStrictCompilerOptionEnabled(options, "strictNullChecks"));
|
||||
if (option === "strictPropertyInitialization") {
|
||||
if (!isStrictCompilerOptionEnabled(options, "strictNullChecks")) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return options[option] ?? options.strict ?? isTsVersionAtLeast(6);
|
||||
}
|
||||
function isModifierFlagSet(node, flag) {
|
||||
return isFlagSet(ts9__default.default.getCombinedModifierFlags(node), flag);
|
||||
@@ -480,12 +491,6 @@ function isUnknownKeyword(node) {
|
||||
function isVoidKeyword(node) {
|
||||
return node.kind === ts9__default.default.SyntaxKind.VoidKeyword;
|
||||
}
|
||||
var [tsMajor, tsMinor] = ts9__default.default.versionMajorMinor.split(".").map((raw) => Number.parseInt(raw, 10));
|
||||
function isTsVersionAtLeast(major, minor = 0) {
|
||||
return tsMajor > major || tsMajor === major && tsMinor >= minor;
|
||||
}
|
||||
|
||||
// src/nodes/typeGuards/union.ts
|
||||
function hasDecorators(node) {
|
||||
return ts9__default.default.isParameter(node) || ts9__default.default.isPropertyDeclaration(node) || ts9__default.default.isMethodDeclaration(node) || ts9__default.default.isGetAccessorDeclaration(node) || ts9__default.default.isSetAccessorDeclaration(node) || ts9__default.default.isClassExpression(node) || ts9__default.default.isClassDeclaration(node);
|
||||
}
|
||||
@@ -1183,10 +1188,12 @@ function isReadonlyPropertyIntersection(type, name, typeChecker) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return !!// members of namespace import
|
||||
(isSymbolFlagSet(prop, ts9__default.default.SymbolFlags.ValueModule) || // we unwrapped every mapped type, now we can check the actual declarations
|
||||
// eslint-disable-next-line @typescript-eslint/no-deprecated -- Will be made private-only soon.
|
||||
symbolHasReadonlyDeclaration(prop, typeChecker));
|
||||
return (
|
||||
// members of namespace import
|
||||
isSymbolFlagSet(prop, ts9__default.default.SymbolFlags.ValueModule) || // we unwrapped every mapped type, now we can check the actual declarations
|
||||
// eslint-disable-next-line @typescript-eslint/no-deprecated -- Will be made private-only soon.
|
||||
symbolHasReadonlyDeclaration(prop, typeChecker)
|
||||
);
|
||||
});
|
||||
}
|
||||
function identifierToKeywordKind(node) {
|
||||
@@ -2092,7 +2099,7 @@ function isNamespaceExported(node) {
|
||||
return node.parent.kind === ts9__default.default.SyntaxKind.ModuleDeclaration || includesModifier(node.modifiers, ts9__default.default.SyntaxKind.ExportKeyword);
|
||||
}
|
||||
function namespaceHasExportStatement(ns) {
|
||||
if (ns.body === void 0 || ns.body.kind !== ts9__default.default.SyntaxKind.ModuleBlock) {
|
||||
if (ns.body?.kind !== ts9__default.default.SyntaxKind.ModuleBlock) {
|
||||
return false;
|
||||
}
|
||||
return containsExportStatement(ns.body);
|
||||
|
||||
+4
-1
@@ -1997,7 +1997,7 @@ declare function isVariableLikeDeclaration(node: ts.Node): node is ts.VariableLi
|
||||
* ```ts
|
||||
* declare const node: ts.Node;
|
||||
*
|
||||
* if (isFunctionScopeBoundary(node, ts.ObjectFlags.Anonymous)) {
|
||||
* if (isFunctionScopeBoundary(node)) {
|
||||
* // ...
|
||||
* }
|
||||
* ```
|
||||
@@ -2824,6 +2824,7 @@ declare function isUniqueESSymbolType(type: ts.Type): type is ts.UniqueESSymbolT
|
||||
*/
|
||||
declare function intersectionConstituents(type: ts.Type): ts.Type[];
|
||||
/**
|
||||
* @alias intersectionConstituents
|
||||
* @deprecated Use {@link intersectionConstituents} instead.
|
||||
* @category Types - Utilities
|
||||
* ```
|
||||
@@ -2947,6 +2948,7 @@ declare function typeConstituents(type: ts.Type): ts.Type[];
|
||||
*/
|
||||
declare function typeIsLiteral(type: ts.Type): type is ts.LiteralType;
|
||||
/**
|
||||
* @alias typeConstituents
|
||||
* @deprecated Use {@link typeConstituents} instead.
|
||||
* @category Types - Utilities
|
||||
*/
|
||||
@@ -2967,6 +2969,7 @@ declare const typeParts: typeof typeConstituents;
|
||||
*/
|
||||
declare function unionConstituents(type: ts.Type): ts.Type[];
|
||||
/**
|
||||
* @alias unionConstituents
|
||||
* @deprecated Use {@link unionConstituents} instead.
|
||||
* @category Types - Utilities
|
||||
*/
|
||||
|
||||
+4
-1
@@ -1997,7 +1997,7 @@ declare function isVariableLikeDeclaration(node: ts.Node): node is ts.VariableLi
|
||||
* ```ts
|
||||
* declare const node: ts.Node;
|
||||
*
|
||||
* if (isFunctionScopeBoundary(node, ts.ObjectFlags.Anonymous)) {
|
||||
* if (isFunctionScopeBoundary(node)) {
|
||||
* // ...
|
||||
* }
|
||||
* ```
|
||||
@@ -2824,6 +2824,7 @@ declare function isUniqueESSymbolType(type: ts.Type): type is ts.UniqueESSymbolT
|
||||
*/
|
||||
declare function intersectionConstituents(type: ts.Type): ts.Type[];
|
||||
/**
|
||||
* @alias intersectionConstituents
|
||||
* @deprecated Use {@link intersectionConstituents} instead.
|
||||
* @category Types - Utilities
|
||||
* ```
|
||||
@@ -2947,6 +2948,7 @@ declare function typeConstituents(type: ts.Type): ts.Type[];
|
||||
*/
|
||||
declare function typeIsLiteral(type: ts.Type): type is ts.LiteralType;
|
||||
/**
|
||||
* @alias typeConstituents
|
||||
* @deprecated Use {@link typeConstituents} instead.
|
||||
* @category Types - Utilities
|
||||
*/
|
||||
@@ -2967,6 +2969,7 @@ declare const typeParts: typeof typeConstituents;
|
||||
*/
|
||||
declare function unionConstituents(type: ts.Type): ts.Type[];
|
||||
/**
|
||||
* @alias unionConstituents
|
||||
* @deprecated Use {@link unionConstituents} instead.
|
||||
* @category Types - Utilities
|
||||
*/
|
||||
|
||||
+19
-12
@@ -95,6 +95,12 @@ function collectComments(execute, fullText) {
|
||||
function isJsxElementOrFragment(node) {
|
||||
return node.kind === ts9.SyntaxKind.JsxElement || node.kind === ts9.SyntaxKind.JsxFragment;
|
||||
}
|
||||
var [tsMajor, tsMinor] = ts9.versionMajorMinor.split(".").map((raw) => Number.parseInt(raw, 10));
|
||||
function isTsVersionAtLeast(major, minor = 0) {
|
||||
return tsMajor > major || tsMajor === major && tsMinor >= minor;
|
||||
}
|
||||
|
||||
// src/compilerOptions.ts
|
||||
function isCompilerOptionEnabled(options, option) {
|
||||
switch (option) {
|
||||
case "allowJs":
|
||||
@@ -133,7 +139,12 @@ function isCompilerOptionEnabled(options, option) {
|
||||
return options[option] === true;
|
||||
}
|
||||
function isStrictCompilerOptionEnabled(options, option) {
|
||||
return (options.strict ? options[option] !== false : options[option] === true) && (option !== "strictPropertyInitialization" || isStrictCompilerOptionEnabled(options, "strictNullChecks"));
|
||||
if (option === "strictPropertyInitialization") {
|
||||
if (!isStrictCompilerOptionEnabled(options, "strictNullChecks")) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return options[option] ?? options.strict ?? isTsVersionAtLeast(6);
|
||||
}
|
||||
function isModifierFlagSet(node, flag) {
|
||||
return isFlagSet(ts9.getCombinedModifierFlags(node), flag);
|
||||
@@ -474,12 +485,6 @@ function isUnknownKeyword(node) {
|
||||
function isVoidKeyword(node) {
|
||||
return node.kind === ts9.SyntaxKind.VoidKeyword;
|
||||
}
|
||||
var [tsMajor, tsMinor] = ts9.versionMajorMinor.split(".").map((raw) => Number.parseInt(raw, 10));
|
||||
function isTsVersionAtLeast(major, minor = 0) {
|
||||
return tsMajor > major || tsMajor === major && tsMinor >= minor;
|
||||
}
|
||||
|
||||
// src/nodes/typeGuards/union.ts
|
||||
function hasDecorators(node) {
|
||||
return ts9.isParameter(node) || ts9.isPropertyDeclaration(node) || ts9.isMethodDeclaration(node) || ts9.isGetAccessorDeclaration(node) || ts9.isSetAccessorDeclaration(node) || ts9.isClassExpression(node) || ts9.isClassDeclaration(node);
|
||||
}
|
||||
@@ -1177,10 +1182,12 @@ function isReadonlyPropertyIntersection(type, name, typeChecker) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return !!// members of namespace import
|
||||
(isSymbolFlagSet(prop, ts9.SymbolFlags.ValueModule) || // we unwrapped every mapped type, now we can check the actual declarations
|
||||
// eslint-disable-next-line @typescript-eslint/no-deprecated -- Will be made private-only soon.
|
||||
symbolHasReadonlyDeclaration(prop, typeChecker));
|
||||
return (
|
||||
// members of namespace import
|
||||
isSymbolFlagSet(prop, ts9.SymbolFlags.ValueModule) || // we unwrapped every mapped type, now we can check the actual declarations
|
||||
// eslint-disable-next-line @typescript-eslint/no-deprecated -- Will be made private-only soon.
|
||||
symbolHasReadonlyDeclaration(prop, typeChecker)
|
||||
);
|
||||
});
|
||||
}
|
||||
function identifierToKeywordKind(node) {
|
||||
@@ -2086,7 +2093,7 @@ function isNamespaceExported(node) {
|
||||
return node.parent.kind === ts9.SyntaxKind.ModuleDeclaration || includesModifier(node.modifiers, ts9.SyntaxKind.ExportKeyword);
|
||||
}
|
||||
function namespaceHasExportStatement(ns) {
|
||||
if (ns.body === void 0 || ns.body.kind !== ts9.SyntaxKind.ModuleBlock) {
|
||||
if (ns.body?.kind !== ts9.SyntaxKind.ModuleBlock) {
|
||||
return false;
|
||||
}
|
||||
return containsExportStatement(ns.body);
|
||||
|
||||
+24
-24
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "ts-api-utils",
|
||||
"version": "2.4.0",
|
||||
"version": "2.5.0",
|
||||
"description": "Utility functions for working with TypeScript's API. Successor to the wonderful tsutils. 🛠️️",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
@@ -11,6 +11,7 @@
|
||||
"name": "JoshuaKGoldberg",
|
||||
"email": "npm@joshuakgoldberg.com"
|
||||
},
|
||||
"sideEffects": false,
|
||||
"type": "module",
|
||||
"exports": {
|
||||
".": {
|
||||
@@ -24,10 +25,7 @@
|
||||
},
|
||||
"main": "./lib/index.js",
|
||||
"files": [
|
||||
"lib/",
|
||||
"package.json",
|
||||
"LICENSE.md",
|
||||
"README.md"
|
||||
"lib/"
|
||||
],
|
||||
"scripts": {
|
||||
"build": "tsup src/index.ts && cp lib/index.d.ts lib/index.d.cts",
|
||||
@@ -38,6 +36,7 @@
|
||||
"lint:docs": "typedoc --validation --treatValidationWarningsAsErrors",
|
||||
"lint:knip": "knip",
|
||||
"lint:md": "markdownlint \"**/*.md\" \".github/**/*.md\" --rules sentences-per-line",
|
||||
"lint:package": "publint --strict",
|
||||
"lint:packages": "pnpm dedupe --check",
|
||||
"lint:spelling": "cspell \"**\" \".github/**/*\"",
|
||||
"prepare": "husky",
|
||||
@@ -50,7 +49,7 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"@eslint-community/eslint-plugin-eslint-comments": "^4.4.1",
|
||||
"@eslint/js": "^9.19.0",
|
||||
"@eslint/js": "^10.0.0",
|
||||
"@phenomnomnominal/tsquery": "^6.1.3",
|
||||
"@release-it/conventional-changelog": "^10.0.0",
|
||||
"@types/eslint-plugin-markdown": "^2.0.2",
|
||||
@@ -58,32 +57,33 @@
|
||||
"@typescript/vfs": "^1.6.0",
|
||||
"@vitest/coverage-v8": "^3.0.0",
|
||||
"@vitest/eslint-plugin": "^1.1.25",
|
||||
"console-fail-test": "^0.5.0",
|
||||
"cspell": "^8.17.3",
|
||||
"eslint": "^9.19.0",
|
||||
"eslint-plugin-jsdoc": "^50.6.3",
|
||||
"eslint-plugin-jsonc": "^2.19.1",
|
||||
"console-fail-test": "^0.6.0",
|
||||
"cspell": "^9.0.0",
|
||||
"eslint": "^10.0.0",
|
||||
"eslint-plugin-jsdoc": "^62.0.0",
|
||||
"eslint-plugin-jsonc": "^3.0.0",
|
||||
"eslint-plugin-markdown": "^5.1.0",
|
||||
"eslint-plugin-n": "^17.15.1",
|
||||
"eslint-plugin-package-json": "^0.19.0",
|
||||
"eslint-plugin-perfectionist": "^4.7.0",
|
||||
"eslint-plugin-regexp": "^2.7.0",
|
||||
"eslint-plugin-yml": "^1.16.0",
|
||||
"eslint-plugin-package-json": "^0.91.0",
|
||||
"eslint-plugin-perfectionist": "^5.0.0",
|
||||
"eslint-plugin-regexp": "^3.0.0",
|
||||
"eslint-plugin-yml": "^3.0.0",
|
||||
"husky": "^9.1.7",
|
||||
"jsonc-eslint-parser": "^2.4.0",
|
||||
"jsonc-eslint-parser": "^3.0.0",
|
||||
"knip": "^5.46.0",
|
||||
"lint-staged": "^15.4.3",
|
||||
"markdownlint": "^0.37.4",
|
||||
"markdownlint-cli": "^0.44.0",
|
||||
"lint-staged": "^16.0.0",
|
||||
"markdownlint": "^0.40.0",
|
||||
"markdownlint-cli": "^0.48.0",
|
||||
"prettier": "^3.4.2",
|
||||
"prettier-plugin-curly": "^0.3.1",
|
||||
"prettier-plugin-packagejson": "^2.5.8",
|
||||
"release-it": "^18.1.2",
|
||||
"prettier-plugin-curly": "^0.4.0",
|
||||
"prettier-plugin-packagejson": "^3.0.0",
|
||||
"publint": "^0.3.17",
|
||||
"release-it": "^19.0.0",
|
||||
"sentences-per-line": "^0.3.0",
|
||||
"should-semantic-release": "^0.3.0",
|
||||
"tsup": "^8.3.6",
|
||||
"typedoc": "^0.28.0",
|
||||
"typedoc-plugin-coverage": "^3.4.1",
|
||||
"typedoc-plugin-coverage": "^4.0.0",
|
||||
"typedoc-plugin-custom-validation": "^2.0.2",
|
||||
"typedoc-plugin-konamimojisplosion": "^0.0.2",
|
||||
"typedoc-plugin-mdn-links": "^5.0.0",
|
||||
@@ -94,7 +94,7 @@
|
||||
"peerDependencies": {
|
||||
"typescript": ">=4.8.4"
|
||||
},
|
||||
"packageManager": "pnpm@10.6.5",
|
||||
"packageManager": "pnpm@10.32.1",
|
||||
"engines": {
|
||||
"node": ">=18.12"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user