diff --git a/.github/renovate.json5 b/.github/renovate.json5 index 05c1c02ab4cb12..17898db2741284 100644 --- a/.github/renovate.json5 +++ b/.github/renovate.json5 @@ -16,6 +16,7 @@ "esbuild", "rollup", "node", + "ts-node", "typescript", // breaking changes diff --git a/.npmrc b/.npmrc index 10aa0abfa4707b..0a8182ea5f2c53 100644 --- a/.npmrc +++ b/.npmrc @@ -4,4 +4,3 @@ 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 aa8ca679682beb..dd19523dfdc497 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": "esno scripts/release.ts", - "ci-publish": "esno scripts/publishCI.ts", + "release": "ts-node scripts/release.ts", + "ci-publish": "ts-node scripts/publishCI.ts", "ci-docs": "run-s build docs-build" }, "devDependencies": { @@ -63,7 +63,6 @@ "eslint-define-config": "^1.4.0", "eslint-plugin-import": "^2.26.0", "eslint-plugin-node": "^11.1.0", - "esno": "^0.15.0", "execa": "^5.1.1", "fs-extra": "^10.1.0", "kill-port": "^1.6.1", @@ -80,6 +79,7 @@ "semver": "^7.3.7", "simple-git-hooks": "^2.7.0", "sirv": "^2.0.2", + "ts-node": "^10.7.0", "typescript": "^4.6.4", "unbuild": "^0.7.4", "vite": "workspace:*", @@ -89,7 +89,7 @@ }, "simple-git-hooks": { "pre-commit": "pnpm exec lint-staged --concurrent false", - "commit-msg": "pnpm exec esno scripts/verifyCommit.ts $1" + "commit-msg": "pnpm exec ts-node scripts/verifyCommit.ts $1" }, "lint-staged": { "*": [ diff --git a/packages/plugin-legacy/package.json b/packages/plugin-legacy/package.json index e14b02b64c53ba..828b31d57ddfe2 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": "esno ../../scripts/patchCJS.ts", + "patch-cjs": "ts-node ../../scripts/patchCJS.ts", "prepublishOnly": "npm run build" }, "engines": { diff --git a/packages/plugin-react/package.json b/packages/plugin-react/package.json index 55a54a3cbcacb6..deed747475b175 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": "esno ../../scripts/patchCJS.ts", + "patch-cjs": "ts-node ../../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 79ee5706f06dfb..6dbd11389eab5b 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": "esno ../../scripts/patchCJS.ts", + "patch-cjs": "ts-node ../../scripts/patchCJS.ts", "prepublishOnly": "npm run build" }, "engines": { diff --git a/packages/plugin-vue/package.json b/packages/plugin-vue/package.json index cb43d13c0828d0..eef528d8fc46f0 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": "esno ../../scripts/patchCJS.ts", + "patch-cjs": "ts-node ../../scripts/patchCJS.ts", "prepublishOnly": "npm run build" }, "engines": { diff --git a/packages/vite/package.json b/packages/vite/package.json index 7e28c2ae3ea693..7fa8f652b56729 100644 --- a/packages/vite/package.json +++ b/packages/vite/package.json @@ -34,7 +34,7 @@ "build-bundle": "rollup -c", "build-types": "run-s build-temp-types patch-types roll-types", "build-temp-types": "tsc --emitDeclarationOnly --outDir temp/node -p src/node", - "patch-types": "esno scripts/patchTypes.ts", + "patch-types": "ts-node scripts/patchTypes.ts", "roll-types": "api-extractor run && rimraf temp", "lint": "eslint --ext .ts src/**", "format": "prettier --write --parser typescript \"src/**/*.ts\"", diff --git a/packages/vite/scripts/patchTypes.ts b/packages/vite/scripts/patchTypes.ts index e31f3a39e82325..ec5ade0224391c 100644 --- a/packages/vite/scripts/patchTypes.ts +++ b/packages/vite/scripts/patchTypes.ts @@ -1,15 +1,13 @@ -import { readFileSync, readdirSync, statSync, writeFileSync } from 'fs' -import { dirname, relative, resolve } from 'path' -import { fileURLToPath } from 'url' import type { ParseResult } from '@babel/parser' import { parse } from '@babel/parser' import type { File } from '@babel/types' import colors from 'picocolors' +import { readdirSync, readFileSync, statSync, writeFileSync } from 'fs' import MagicString from 'magic-string' +import { dirname, relative, resolve } from 'path' -const dir = dirname(fileURLToPath(import.meta.url)) -const tempDir = resolve(dir, '../temp/node') -const typesDir = resolve(dir, '../types') +const tempDir = resolve(__dirname, '../temp/node') +const typesDir = resolve(__dirname, '../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 80213ee89c0fac..00d6847a132bf4 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -40,7 +40,6 @@ importers: eslint-define-config: ^1.4.0 eslint-plugin-import: ^2.26.0 eslint-plugin-node: ^11.1.0 - esno: ^0.15.0 execa: ^5.1.1 fs-extra: ^10.1.0 kill-port: ^1.6.1 @@ -57,6 +56,7 @@ importers: semver: ^7.3.7 simple-git-hooks: ^2.7.0 sirv: ^2.0.2 + ts-node: ^10.7.0 typescript: ^4.6.4 unbuild: ^0.7.4 vite: workspace:* @@ -94,7 +94,6 @@ 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.15.0 execa: 5.1.1 fs-extra: 10.1.0 kill-port: 1.6.1 @@ -111,6 +110,7 @@ importers: semver: 7.3.7 simple-git-hooks: 2.7.0 sirv: 2.0.2 + ts-node: 10.7.0_sm5zkxj4s52nbddwl76qwfh6ya typescript: 4.6.4 unbuild: 0.7.4 vite: link:packages/vite @@ -1593,27 +1593,6 @@ packages: resolution: {integrity: sha512-6U71C2Wp7r5XtFtQzYrW5iKFT67OixrSxjI4MptCHzdSVlgabczzqLe0ZSgnub/5Kp4hSbpDB1tMytZY9pwxxA==} dev: false - /@esbuild-kit/cjs-loader/1.0.0: - resolution: {integrity: sha512-6oPhu5QcuTsU5nO3hBCd6OdfeaGsheU6OZrQSAzBsXOiZQ+lB2Zy1bAeAPKqzVGz16kBbheW+OuL54gLD79HdA==} - dependencies: - '@esbuild-kit/core-utils': 1.0.0 - get-tsconfig: 3.0.1 - dev: true - - /@esbuild-kit/core-utils/1.0.0: - resolution: {integrity: sha512-OpBaYYkCxIFnTjk46dYaZplHrLXkYZvw0FporqTEPEWNJV8k2/+LTIZ1U49NdEBB33A3Ke/78KG78EoDnLENcg==} - dependencies: - esbuild: 0.14.38 - dev: true - - /@esbuild-kit/esm-loader/1.0.0: - resolution: {integrity: sha512-fZtvhHmO0fKNHszwb9GtBr4eaBA4ZAPxDpV/oWLh0R45IgMNz7lDIGeqsDHFTwQ4LeFgOMjzRIH0JapX8FUQmQ==} - dependencies: - '@esbuild-kit/core-utils': 1.0.0 - es-module-lexer: 0.10.5 - get-tsconfig: 3.0.1 - dev: true - /@eslint/eslintrc/1.2.3: resolution: {integrity: sha512-uGo44hIwoLGNyduRpjdEpovcbMdd+Nv7amtmJxnKmI8xj6yd5LncmSwDa5NgX/41lIFJtkjD6YdVfgEzPfJ5UA==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} @@ -4309,13 +4288,6 @@ packages: - supports-color dev: true - /esno/0.15.0: - resolution: {integrity: sha512-Wws1YgB/PBUtc/Pq755Crv2r5XIcSZyqC/9qyiczzQoDNNIUdxQ75uSd6gaMJFJ+pieljcH3f9JawmrHk0vLXw==} - hasBin: true - dependencies: - tsx: 2.0.1 - dev: true - /espree/9.3.2: resolution: {integrity: sha512-D211tC7ZwouTIuY5x9XnS0E9sWNChB7IYKX/Xp5eQj3nFXhqmiUDB9q27y76oFl8jTg3pXcQx/bpxMfs3CIZbA==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} @@ -4717,10 +4689,6 @@ packages: resolution: {integrity: sha1-dKILqKSr7OWuGZrQPyvMaP38m6U=} dev: true - /get-tsconfig/3.0.1: - resolution: {integrity: sha512-+m30eQjbcf3xMNdnacXH5IDAKUMbI7Mhbf3e1BHif1FzBlUhBzBlmOVc7kL4+kB035l8OCyBdI3dNXZ3of9HqA==} - dev: true - /git-raw-commits/2.0.11: resolution: {integrity: sha512-VnctFhw+xfj8Va1xtfEqCUD2XDrbAPSJx+hSrE5K7fGdjZruW7XV+QOrN7LF/RJyvspRiD2I0asWsxFp0ya26A==} engines: {node: '>=10'} @@ -8021,6 +7989,37 @@ packages: yn: 3.1.1 dev: true + /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: resolution: {integrity: sha512-GVDTXF4MdNBBxKfUfjs/wkb7LHd8Ho8WLavESCddTFQFG9AUZOZEm6kODBGmQopQ9OG+EHpkT6dBaIIGhYVt+Q==} engines: {node: ^14.13.1 || ^16 || >=18, pnpm: ^7.0.1} @@ -8059,16 +8058,6 @@ packages: typescript: 4.6.4 dev: true - /tsx/2.0.1: - resolution: {integrity: sha512-qOzBwD5DkUodG7PjIUTPmRdAknYHC4jh7cOchnUScJCyayI8Cy8WqoD1rc7+zhM6x5a4YDoE5CJ+t3a92K4j2w==} - hasBin: true - dependencies: - '@esbuild-kit/cjs-loader': 1.0.0 - '@esbuild-kit/esm-loader': 1.0.0 - optionalDependencies: - fsevents: 2.3.2 - dev: true - /type-check/0.4.0: resolution: {integrity: sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==} engines: {node: '>= 0.8.0'} diff --git a/scripts/patchCJS.ts b/scripts/patchCJS.ts index e225d9455e98dc..76edf3fcfa6da5 100644 --- a/scripts/patchCJS.ts +++ b/scripts/patchCJS.ts @@ -17,7 +17,7 @@ module.exports.parseVueRequest = parseVueRequest; */ import { readFileSync, writeFileSync } from 'fs' -import colors from 'picocolors' +import { bold, red } 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(colors.bold(`${indexPath} CJS patched`)) + console.log(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(colors.bold(`${indexPath} CJS patched`)) + console.log(bold(`${indexPath} CJS patched`)) process.exit() } -console.error(colors.red(`${indexPath} CJS patch failed`)) +console.error(red(`${indexPath} CJS patch failed`)) process.exit(1)