diff --git a/.github/renovate.json5 b/.github/renovate.json5 index 17898db2741284..05c1c02ab4cb12 100644 --- a/.github/renovate.json5 +++ b/.github/renovate.json5 @@ -16,7 +16,6 @@ "esbuild", "rollup", "node", - "ts-node", "typescript", // breaking changes diff --git a/.npmrc b/.npmrc index 0a8182ea5f2c53..10aa0abfa4707b 100644 --- a/.npmrc +++ b/.npmrc @@ -4,3 +4,4 @@ hoist-pattern[]=@emotion/* hoist-pattern[]=postcss hoist-pattern[]=pug hoist-pattern[]=source-map-support +hoist-pattern[]=ts-node diff --git a/package.json b/package.json index 9c8a0929ce8d44..c9b88ee78a3138 100644 --- a/package.json +++ b/package.json @@ -28,8 +28,8 @@ "docs-serve": "vitepress serve docs", "build": "pnpm -r --filter=./packages/* run build", "dev": "pnpm -r --parallel --filter=./packages/* run dev", - "release": "ts-node scripts/release.ts", - "ci-publish": "ts-node scripts/publishCI.ts", + "release": "esno scripts/release.ts", + "ci-publish": "esno scripts/publishCI.ts", "ci-docs": "run-s build docs-build" }, "devDependencies": { @@ -64,6 +64,7 @@ "eslint-define-config": "^1.4.0", "eslint-plugin-import": "^2.26.0", "eslint-plugin-node": "^11.1.0", + "esno": "^0.16.3", "execa": "^5.1.1", "fs-extra": "^10.1.0", "kill-port": "^1.6.1", @@ -81,7 +82,6 @@ "semver": "^7.3.7", "simple-git-hooks": "^2.7.0", "sirv": "^2.0.2", - "ts-node": "^10.7.0", "tslib": "^2.4.0", "typescript": "^4.6.4", "unbuild": "^0.7.4", @@ -92,7 +92,7 @@ }, "simple-git-hooks": { "pre-commit": "pnpm exec lint-staged --concurrent false", - "commit-msg": "pnpm exec ts-node scripts/verifyCommit.ts $1" + "commit-msg": "pnpm exec esno scripts/verifyCommit.ts $1" }, "lint-staged": { "*": [ diff --git a/packages/plugin-legacy/package.json b/packages/plugin-legacy/package.json index bea89ef7bc492d..507869594055b8 100644 --- a/packages/plugin-legacy/package.json +++ b/packages/plugin-legacy/package.json @@ -19,7 +19,7 @@ "scripts": { "dev": "unbuild --stub", "build": "unbuild && pnpm run patch-cjs", - "patch-cjs": "ts-node ../../scripts/patchCJS.ts", + "patch-cjs": "esno ../../scripts/patchCJS.ts", "prepublishOnly": "npm run build" }, "engines": { diff --git a/packages/plugin-react/package.json b/packages/plugin-react/package.json index 68169a451ccb6e..1cde923171bbae 100644 --- a/packages/plugin-react/package.json +++ b/packages/plugin-react/package.json @@ -23,7 +23,7 @@ "scripts": { "dev": "unbuild --stub", "build": "unbuild && pnpm run patch-cjs", - "patch-cjs": "ts-node ../../scripts/patchCJS.ts", + "patch-cjs": "esno ../../scripts/patchCJS.ts", "prepublishOnly": "npm run build" }, "engines": { diff --git a/packages/plugin-vue-jsx/package.json b/packages/plugin-vue-jsx/package.json index 8764b168fb8069..d4cb8b7d82f3e3 100644 --- a/packages/plugin-vue-jsx/package.json +++ b/packages/plugin-vue-jsx/package.json @@ -19,7 +19,7 @@ "scripts": { "dev": "unbuild --stub", "build": "unbuild && pnpm run patch-cjs", - "patch-cjs": "ts-node ../../scripts/patchCJS.ts", + "patch-cjs": "esno ../../scripts/patchCJS.ts", "prepublishOnly": "npm run build" }, "engines": { diff --git a/packages/plugin-vue/package.json b/packages/plugin-vue/package.json index 04f3f998b9ecf4..0706b8c140840f 100644 --- a/packages/plugin-vue/package.json +++ b/packages/plugin-vue/package.json @@ -19,7 +19,7 @@ "scripts": { "dev": "unbuild --stub", "build": "unbuild && pnpm run patch-cjs", - "patch-cjs": "ts-node ../../scripts/patchCJS.ts", + "patch-cjs": "esno ../../scripts/patchCJS.ts", "prepublishOnly": "npm run build" }, "engines": { diff --git a/packages/vite/scripts/patchTypes.ts b/packages/vite/scripts/patchTypes.ts index 38c6300ea1954b..e31f3a39e82325 100644 --- a/packages/vite/scripts/patchTypes.ts +++ b/packages/vite/scripts/patchTypes.ts @@ -7,11 +7,9 @@ import type { File } from '@babel/types' import colors from 'picocolors' import MagicString from 'magic-string' -// @ts-ignore -const __dirname = resolve(fileURLToPath(import.meta.url), '..') - -const tempDir = resolve(__dirname, '../temp/node') -const typesDir = resolve(__dirname, '../types') +const dir = dirname(fileURLToPath(import.meta.url)) +const tempDir = resolve(dir, '../temp/node') +const typesDir = resolve(dir, '../types') // walk through the temp dts dir, find all import/export of types/* // and rewrite them into relative imports - so that api-extractor actually diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 038440869ee5f2..177082b1e5b7c6 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -41,6 +41,7 @@ importers: eslint-define-config: ^1.4.0 eslint-plugin-import: ^2.26.0 eslint-plugin-node: ^11.1.0 + esno: ^0.16.3 execa: ^5.1.1 fs-extra: ^10.1.0 kill-port: ^1.6.1 @@ -58,7 +59,6 @@ importers: semver: ^7.3.7 simple-git-hooks: ^2.7.0 sirv: ^2.0.2 - ts-node: ^10.7.0 tslib: ^2.4.0 typescript: ^4.6.4 unbuild: ^0.7.4 @@ -98,6 +98,7 @@ importers: eslint-define-config: 1.4.0 eslint-plugin-import: 2.26.0_doddzorl55y6dbr5ij3nshfl64 eslint-plugin-node: 11.1.0_eslint@8.15.0 + esno: 0.16.3 execa: 5.1.1 fs-extra: 10.1.0 kill-port: 1.6.1 @@ -115,7 +116,6 @@ importers: semver: 7.3.7 simple-git-hooks: 2.7.0 sirv: 2.0.2 - ts-node: 10.7.0_sm5zkxj4s52nbddwl76qwfh6ya tslib: 2.4.0 typescript: 4.6.4 unbuild: 0.7.4 @@ -1495,12 +1495,14 @@ packages: /@cspotcode/source-map-consumer/0.8.0: resolution: {integrity: sha512-41qniHzTU8yAGbCp04ohlmSrZf8bkf/iJsl3V0dRGsQN/5GFfx+LbCSsCpp2gqrqjTVg/K6O8ycoV35JIwAzAg==} engines: {node: '>= 12'} + dev: true /@cspotcode/source-map-support/0.7.0: resolution: {integrity: sha512-X4xqRHqN8ACt2aHVe51OxeA2HjbcL4MqFqXkrmQszJ1NOUuUu5u6Vqx/0lZSVNku7velL5FC/s5uEAj1lsBMhA==} engines: {node: '>=12'} dependencies: '@cspotcode/source-map-consumer': 0.8.0 + dev: true /@docsearch/css/3.0.0: resolution: {integrity: sha512-1kkV7tkAsiuEd0shunYRByKJe3xQDG2q7wYg24SOw1nV9/2lwEd4WrUYRJC/ukGTl2/kHeFxsaUvtiOy0y6fFA==} @@ -1976,15 +1978,19 @@ packages: /@tsconfig/node10/1.0.8: resolution: {integrity: sha512-6XFfSQmMgq0CFLY1MslA/CPUfhIL919M1rMsa5lP2P097N2Wd1sSX0tx1u4olM16fLNhtHZpRhedZJphNJqmZg==} + dev: true /@tsconfig/node12/1.0.9: resolution: {integrity: sha512-/yBMcem+fbvhSREH+s14YJi18sp7J9jpuhYByADT2rypfajMZZN4WQ6zBGgBKp53NKmqI36wFYDb3yaMPurITw==} + dev: true /@tsconfig/node14/1.0.1: resolution: {integrity: sha512-509r2+yARFfHHE7T6Puu2jjkoycftovhXRqW328PDXTVGKihlb1P8Z9mMZH04ebyajfRY7dedfGynlrFHJUQCg==} + dev: true /@tsconfig/node16/1.0.2: resolution: {integrity: sha512-eZxlbI8GZscaGS7kkc/trHTT5xgrjH3/1n2JDwusC9iahPKWMRvRjJSAN5mCXviuTGQ/lHnhvv8Q1YTpnfz9gA==} + dev: true /@types/argparse/1.0.38: resolution: {integrity: sha512-ebDJ9b0e702Yr7pWgB0jzm+CX4Srzz8RcXtLJDJB+BSccqMa36uyH/zUsSYao5+BD1ytv3k3rPYCq4mAE1hsXA==} @@ -2491,6 +2497,7 @@ packages: /acorn-walk/8.2.0: resolution: {integrity: sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA==} engines: {node: '>=0.4.0'} + dev: true /acorn/7.4.1: resolution: {integrity: sha512-nQyp0o1/mNdbTO1PO6kHkwSrmgZ0MT/jCCpNiwbUjGoRN4dlBhqJtoQuCnEOKzgTVwg0ZWiCoQy6SxMebQVh8A==} @@ -2501,6 +2508,7 @@ packages: resolution: {integrity: sha512-Xx54uLJQZ19lKygFXOWsscKUbsBZW0CPykPhVQdhIeIwrbPmJzqeASDInc8nKBnp/JT6igTs82qPXz069H8I/A==} engines: {node: '>=0.4.0'} hasBin: true + dev: true /add-stream/1.0.0: resolution: {integrity: sha1-anmQQ3ynNtXhKI25K9MmbV9csqo=} @@ -2604,6 +2612,7 @@ packages: /arg/4.1.3: resolution: {integrity: sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==} + dev: true /arg/5.0.1: resolution: {integrity: sha512-e0hDa9H2Z9AwFkk2qDlwhoMYE4eToKarchkQHovNdLTCYMHZHeRjI71crOh+dio4K6u1IcwubQqo79Ga4CyAQA==} @@ -3389,6 +3398,7 @@ packages: /create-require/1.1.1: resolution: {integrity: sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==} + dev: true /cross-env/7.0.3: resolution: {integrity: sha512-+/HKd6EgcQCJGh2PSjZuUitQBQynKor4wrFbRg4DtAgS1aWO+gU52xpH7M9ScGgXSYmAVS9bIJ8EzuaGw0oNAw==} @@ -3652,6 +3662,7 @@ packages: /diff/4.0.2: resolution: {integrity: sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==} engines: {node: '>=0.3.1'} + dev: true /dir-glob/3.0.1: resolution: {integrity: sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==} @@ -5715,6 +5726,7 @@ packages: /make-error/1.3.6: resolution: {integrity: sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==} + dev: true /map-obj/1.0.1: resolution: {integrity: sha1-2TPOuSBdgr3PSIb2dCvcK03qFG0=} @@ -8098,36 +8110,6 @@ packages: make-error: 1.3.6 v8-compile-cache-lib: 3.0.1 yn: 3.1.1 - - /ts-node/10.7.0_sm5zkxj4s52nbddwl76qwfh6ya: - resolution: {integrity: sha512-TbIGS4xgJoX2i3do417KSaep1uRAW/Lu+WAL2doDHC0D6ummjirVOXU5/7aiZotbQ5p1Zp9tP7U6cYhA0O7M8A==} - hasBin: true - peerDependencies: - '@swc/core': '>=1.2.50' - '@swc/wasm': '>=1.2.50' - '@types/node': '*' - typescript: '>=2.7' - peerDependenciesMeta: - '@swc/core': - optional: true - '@swc/wasm': - optional: true - dependencies: - '@cspotcode/source-map-support': 0.7.0 - '@tsconfig/node10': 1.0.8 - '@tsconfig/node12': 1.0.9 - '@tsconfig/node14': 1.0.1 - '@tsconfig/node16': 1.0.2 - '@types/node': 17.0.32 - acorn: 8.7.1 - acorn-walk: 8.2.0 - arg: 4.1.3 - create-require: 1.1.1 - diff: 4.0.2 - make-error: 1.3.6 - typescript: 4.6.4 - v8-compile-cache-lib: 3.0.1 - yn: 3.1.1 dev: true /tsconfck/2.0.0: @@ -8370,6 +8352,7 @@ packages: /v8-compile-cache-lib/3.0.1: resolution: {integrity: sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg==} + dev: true /v8-compile-cache/2.3.0: resolution: {integrity: sha512-l8lCEmLcLYZh4nbunNZvQCJc5pv7+RCwa8q/LdUx8u7lsWvPDKmpodJAJNwkAhJC//dFY48KuIEmjtd4RViDrA==} @@ -8702,6 +8685,7 @@ packages: /yn/3.1.1: resolution: {integrity: sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==} engines: {node: '>=6'} + dev: true /youch/2.2.2: resolution: {integrity: sha512-/FaCeG3GkuJwaMR34GHVg0l8jCbafZLHiFowSjqLlqhC6OMyf2tPJBu8UirF7/NI9X/R5ai4QfEKUCOxMAGxZQ==} diff --git a/scripts/patchCJS.ts b/scripts/patchCJS.ts index 76edf3fcfa6da5..e225d9455e98dc 100644 --- a/scripts/patchCJS.ts +++ b/scripts/patchCJS.ts @@ -17,7 +17,7 @@ module.exports.parseVueRequest = parseVueRequest; */ import { readFileSync, writeFileSync } from 'fs' -import { bold, red } from 'picocolors' +import colors from 'picocolors' const indexPath = 'dist/index.cjs' let code = readFileSync(indexPath, 'utf-8') @@ -40,7 +40,7 @@ if (matchMixed) { writeFileSync(indexPath, lines.join('\n')) - console.log(bold(`${indexPath} CJS patched`)) + console.log(colors.bold(`${indexPath} CJS patched`)) process.exit() } @@ -49,9 +49,9 @@ const matchDefault = code.match(/\nmodule.exports = (\w+);/) if (matchDefault) { code += `module.exports["default"] = ${matchDefault[1]};\n` writeFileSync(indexPath, code) - console.log(bold(`${indexPath} CJS patched`)) + console.log(colors.bold(`${indexPath} CJS patched`)) process.exit() } -console.error(red(`${indexPath} CJS patch failed`)) +console.error(colors.red(`${indexPath} CJS patch failed`)) process.exit(1)