From be1d42ce7e1e7546ddc4fd4c13272be600b43b29 Mon Sep 17 00:00:00 2001 From: Anthony Fu Date: Fri, 13 May 2022 15:42:40 +0800 Subject: [PATCH] chore: revert vitejs/vite#8152 (#8161) This reverts commit 612a1b681eb107d61f6897c284740caa267720e1. --- .github/renovate.json5 | 1 + .npmrc | 1 - package.json | 8 ++++---- packages/plugin-vue-jsx/package.json | 2 +- packages/plugin-vue/package.json | 2 +- scripts/patchCJS.ts | 8 ++++---- 6 files changed, 11 insertions(+), 11 deletions(-) diff --git a/.github/renovate.json5 b/.github/renovate.json5 index 05c1c02a..17898db2 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 10aa0abf..0a8182ea 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 aa8ca679..dd19523d 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-vue-jsx/package.json b/packages/plugin-vue-jsx/package.json index 79ee5706..6dbd1138 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 cb43d13c..eef528d8 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/scripts/patchCJS.ts b/scripts/patchCJS.ts index e225d945..76edf3fc 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)