compatfactory
Advanced tools
Comparing version 2.0.9 to 3.0.0
@@ -1,2 +0,2 @@ | ||
import * as TS from "typescript"; | ||
import type * as TS from "typescript"; | ||
export declare function ensureNodeFactory(factoryLike: TS.NodeFactory | typeof TS): TS.NodeFactory; |
{ | ||
"name": "compatfactory", | ||
"version": "2.0.9", | ||
"version": "3.0.0", | ||
"description": "A library that unifies the TypeScript Compiler API factory functions across all versions of TypeScript and makes them conform with the Node Factory API", | ||
@@ -12,3 +12,3 @@ "scripts": { | ||
"prettier": "prettier --write \"{src,test,documentation}/**/*.{js,ts,json,html,xml,css,md}\"", | ||
"test": "ava", | ||
"test": "cross-env NODE_NO_WARNINGS=1 FORCE_COLOR=3 NODE_OPTIONS=\"--loader=tsx --max_old_space_size=4096\" ava", | ||
"prebuild": "pnpm run clean", | ||
@@ -18,4 +18,4 @@ "build": "pnpm run prebuild && pnpm run tsc", | ||
"watch": "pnpm run prewatch && pnpm run tsc -- --watch", | ||
"tsc:cjs": "tsc -p tsconfig.build.json --module nodenext --outDir dist/cjs", | ||
"tsc:esm": "tsc -p tsconfig.build.json --module esnext --outDir dist/esm", | ||
"tsc:cjs": "tsc -p tsconfig.build.cjs.json --outDir dist/cjs", | ||
"tsc:esm": "tsc -p tsconfig.build.json --outDir dist/esm", | ||
"tsc": "pnpm run tsc:cjs && pnpm run tsc:esm", | ||
@@ -25,4 +25,4 @@ "preversion": "pnpm run lint && pnpm run build && dotcjs dist/cjs", | ||
"release": "np --no-cleanup --no-yarn", | ||
"update:check": "pnpx npm-check-updates -x typescript-*,ava --dep dev,prod", | ||
"update:commit": "pnpx npm-check-updates -u -x typescript-*,ava --dep dev,prod && pnpm update && pnpm install" | ||
"update:check": "pnpx npm-check-updates -x typescript-* --dep dev,prod", | ||
"update:commit": "pnpx npm-check-updates -u -x typescript-* --dep dev,prod && pnpm update && pnpm install" | ||
}, | ||
@@ -55,27 +55,29 @@ "keywords": [ | ||
"devDependencies": { | ||
"@typescript-eslint/eslint-plugin": "^5.48.0", | ||
"@typescript-eslint/parser": "^5.48.0", | ||
"@types/semver": "^7.3.13", | ||
"@types/node": "18.11.18", | ||
"@wessberg/ts-config": "^2.0.4", | ||
"@prettier/sync": "0.3.0", | ||
"@types/node": "20.4.5", | ||
"@types/semver": "^7.5.0", | ||
"@typescript-eslint/eslint-plugin": "^6.2.1", | ||
"@typescript-eslint/parser": "^6.2.1", | ||
"@wessberg/prettier-config": "1.0.0", | ||
"semver": "^7.3.8", | ||
"sandhog": "^2.0.2", | ||
"@wessberg/ts-config": "^4.0.0", | ||
"ava": "5.3.1", | ||
"cross-env": "^7.0.3", | ||
"crosspath": "2.0.0", | ||
"dotcjs": "1.0.1", | ||
"ava": "3.15.0", | ||
"eslint": "^8.31.0", | ||
"eslint-config-prettier": "^8.6.0", | ||
"eslint-plugin-import": "^2.26.0", | ||
"eslint-plugin-jsdoc": "^39.6.4", | ||
"eslint": "^8.46.0", | ||
"eslint-config-prettier": "^8.9.0", | ||
"eslint-plugin-import": "^2.28.0", | ||
"eslint-plugin-jsdoc": "^46.4.5", | ||
"husky": "^8.0.3", | ||
"np": "7.6.3", | ||
"pnpm": "^7.23.0", | ||
"prettier": "^2.8.2", | ||
"np": "8.0.4", | ||
"npm-check-updates": "^16.10.17", | ||
"pnpm": "^8.6.11", | ||
"prettier": "^3.0.0", | ||
"pretty-quick": "^3.1.3", | ||
"rimraf": "^3.0.2", | ||
"standard-changelog": "^2.0.27", | ||
"ts-node": "^10.9.1", | ||
"npm-check-updates": "^16.6.2", | ||
"typescript": "4.9.4", | ||
"rimraf": "^5.0.1", | ||
"sandhog": "^2.0.2", | ||
"semver": "^7.5.4", | ||
"standard-changelog": "^3.0.0", | ||
"tsx": "^3.12.7", | ||
"typescript": "5.1.6", | ||
"typescript-3-0-1": "npm:typescript@3.0.1", | ||
@@ -99,6 +101,8 @@ "typescript-3-1-1": "npm:typescript@3.1.1", | ||
"typescript-4-7-2": "npm:typescript@4.7.2", | ||
"typescript-4-8-2": "npm:typescript@4.8.2" | ||
"typescript-4-8-2": "npm:typescript@4.8.2", | ||
"typescript-4-9-4": "npm:typescript@4.9.4", | ||
"typescript-5-0-4": "npm:typescript@5.0.4" | ||
}, | ||
"peerDependencies": { | ||
"typescript": ">=3.x || >= 4.x" | ||
"typescript": ">=3.x || >= 4.x || >= 5.x" | ||
}, | ||
@@ -130,15 +134,6 @@ "exports": { | ||
"timeout": "400s", | ||
"nonSemVerExperiments": { | ||
"configurableModuleFormat": true | ||
}, | ||
"extensions": { | ||
"ts": "module" | ||
}, | ||
"nodeArguments": [ | ||
"--loader=ts-node/esm" | ||
], | ||
"environmentVariables": { | ||
"FORCE_COLOR": "3" | ||
} | ||
} | ||
} |
@@ -31,11 +31,10 @@ <!-- SHADOW_SECTION_LOGO_START --> | ||
With the release of TypeScript 4.0, the team announced that [they would move away](https://devblogs.microsoft.com/typescript/announcing-typescript-4-0/#usage-of-typescripts-compatfactory-is-deprecated) from the old | ||
set of factory functions for creating and updating nodes, and over to a new Node Factory API. | ||
TypeScript's Compiler APIs are constantly evolving. With the release of TypeScript 4.0, the TypeScript team announced that [they would move away](https://devblogs.microsoft.com/typescript/announcing-typescript-4-0/#usage-of-typescripts-compatfactory-is-deprecated) from the old | ||
set of factory functions for creating and updating nodes, and over to a new Node Factory API. With the release of TypeScript 5.0, the old factory functions were removed entirely. | ||
While this is great, a lot of tooling around TypeScript works across multiple versions of it and either have to stick with the old, deprecated factory functions, stop supporting older versions of TypeScript, | ||
or interchangeably use the old or new factory functions depending on the TypeScript version being used. This is cumbersome, error prone, difficult to read, and hard to maintain. | ||
Nowadays, if you maintain a library or a tool that needs to work across multiple versions of TypeScript and you use any of TypeScript's Compiler APIs, you're going to have a really tough time. It will be error prone, difficult to read, and hard to maintain. There are many differences between the signatures of these methods across all versions of TypeScript, and many may not even exist. | ||
This library provides a little helper function, `ensureNodeFactory`, which takes a `NodeFactory` or a typescript object, and then returns an object conforming to the `NodeFactory` interface. | ||
This library exists to fix this problem. It simply provides a helper function, `ensureNodeFactory`, which takes a `NodeFactory` or a typescript object, and then returns an object conforming to the `NodeFactory` interface. | ||
In case a `NodeFactory` is passed to it, or if one could be found via the `typescript.factory` property, it will patch any inconsistencies there may be between the signatures of the factory functions across TypeScript versions and most often simply return the existing one with no further edits. For older TypeScript versions, it will | ||
wrap its factory functions with the new API such that you can simply use one API for all your operations. | ||
wrap its factory functions with the new API such that you can simply use one API for all your operations! 🎉 | ||
@@ -48,4 +47,4 @@ <!-- SHADOW_SECTION_FEATURES_START --> | ||
- A simple wrapper that enables you to use one API for every TypeScript version | ||
- Simple and tiny | ||
- A simple wrapper that enables you to use the most recent TypeScript Compiler API for every TypeScript version without having to worry about inconsistensies | ||
- Tiny | ||
@@ -60,5 +59,5 @@ <!-- SHADOW_SECTION_FEATURE_IMAGE_START --> | ||
| <a href="https://usebubbles.com"><img alt="Bubbles" src="https://uploads-ssl.webflow.com/5d682047c28b217055606673/5e5360be16879c1d0dca6514_icon-thin-128x128%402x.png" height="70" /></a> | <a href="https://www.xerox.com"><img alt="Xerox" src="https://avatars.githubusercontent.com/u/9158512?s=200&v=4" height="70" /></a> | <a href="https://changelog.me"><img alt="Trent Raymond" src="https://avatars.githubusercontent.com/u/1509616?v=4" height="70" /></a> | <a href="https://scrubtheweb.com"><img alt="scrubtheweb" src="https://avatars.githubusercontent.com/u/41668218?v=4" height="70" /></a> | <a href="https://github.com/hjoelh"><img alt="Joel" src="https://avatars.githubusercontent.com/u/68335961?v=4" height="70" /></a> | | ||
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------- | | ||
| [Bubbles](https://usebubbles.com)<br><strong>Twitter</strong>: [@usebubbles](https://twitter.com/usebubbles) | [Xerox](https://www.xerox.com) | [Trent Raymond](https://changelog.me) | [scrubtheweb](https://scrubtheweb.com) | [Joel](https://github.com/hjoelh) | | ||
| <a href="https://changelog.me"><img alt="Trent Raymond" src="https://avatars.githubusercontent.com/u/1509616?v=4" height="70" /></a> | <a href="https://scrubtheweb.com/computers/programming/1"><img alt="scrubtheweb" src="https://avatars.githubusercontent.com/u/41668218?v=4" height="70" /></a> | | ||
| -------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------- | | ||
| [Trent Raymond](https://changelog.me) | [scrubtheweb](https://scrubtheweb.com/computers/programming/1) | | ||
@@ -65,0 +64,0 @@ ### Patreon |
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 too big to display
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
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
621088
5096
48
184