From 355d4960235216dc757e98d9cb61fd215fa0e7c3 Mon Sep 17 00:00:00 2001 From: Aron Date: Mon, 26 Feb 2024 08:23:43 +0800 Subject: [PATCH] Update(Build): Replace "load-tsconfig" with "get-tsconfig" --- packages/techor/package.json | 2 +- packages/techor/src/plugins/swc.ts | 5 ++--- pnpm-lock.yaml | 13 +++---------- 3 files changed, 6 insertions(+), 14 deletions(-) diff --git a/packages/techor/package.json b/packages/techor/package.json index a73b89e..556203e 100644 --- a/packages/techor/package.json +++ b/packages/techor/package.json @@ -79,8 +79,8 @@ "escodegen": "^2.1.0", "execa": "^7.2.0", "explore-config": "workspace:^", + "get-tsconfig": "^4.7.2", "hrtime": "^0.5.0", - "load-tsconfig": "^0.2.5", "lodash.isequal": "^4.5.0", "pkg-types": "^1.0.1", "pretty-bytes": "^6.1.0", diff --git a/packages/techor/src/plugins/swc.ts b/packages/techor/src/plugins/swc.ts index 5dcc6c4..3d0665f 100644 --- a/packages/techor/src/plugins/swc.ts +++ b/packages/techor/src/plugins/swc.ts @@ -1,6 +1,5 @@ import type { Plugin } from 'rollup' -// @ts-expect-error Cannot find module 'load-tsconfig' or its corresponding type declarations.ts(2307) -import { loadTsConfig } from 'load-tsconfig' +import { getTsconfig } from 'get-tsconfig' import { Options as SWCOptions, transform } from '@swc/core' import extend from '@techor/extend' import { FilterPattern, createFilter } from '@rollup/pluginutils' @@ -13,7 +12,7 @@ export type Options = SWCOptions & { export default function swc({ tsconfigFile, include, exclude, minify, ...options }: Options = {}): Plugin { const filter = createFilter(include, exclude) - const compilerOptions = tsconfigFile === false ? {} : loadTsConfig('.', tsconfigFile === true ? undefined : tsconfigFile)?.data?.compilerOptions || {} + const compilerOptions = tsconfigFile === false ? {} : getTsconfig('.', tsconfigFile === true ? undefined : tsconfigFile)?.config?.compilerOptions || {} let swcOptions = { jsc: { target: compilerOptions.target, diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 8021482..a281f75 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -325,12 +325,12 @@ importers: explore-config: specifier: workspace:^ version: link:../explore-config + get-tsconfig: + specifier: ^4.7.2 + version: 4.7.2 hrtime: specifier: ^0.5.0 version: 0.5.0 - load-tsconfig: - specifier: ^0.2.5 - version: 0.2.5 lodash.isequal: specifier: ^4.5.0 version: 4.5.0 @@ -3781,7 +3781,6 @@ packages: resolution: {integrity: sha512-wuMsz4leaj5hbGgg4IvDU0bqJagpftG5l5cXIAvo8uZrqn0NJqwtfupTN00VnkQJPcIRrxYrm1Ue24btpCha2A==} dependencies: resolve-pkg-maps: 1.0.0 - dev: true /get-uri@6.0.3: resolution: {integrity: sha512-BzUrJBS9EcUb4cFol8r4W3v1cPsSyajLSthNkz5BxbpDcHN5tIrM10E2eNvfnvBn3DaT3DUgx0OpsBKkaOpanw==} @@ -5084,11 +5083,6 @@ packages: pify: 3.0.0 strip-bom: 3.0.0 - /load-tsconfig@0.2.5: - resolution: {integrity: sha512-IXO6OCs9yg8tMKzfPZ1YmheJbZCiEsnBdcB03l0OcfK9prKnJb96siuHCr5Fl37/yo9DnKU+TLpxzTUspw9shg==} - engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} - dev: false - /locate-path@2.0.0: resolution: {integrity: sha512-NCI2kiDkyR7VeEKm27Kda/iQHyKJe1Bu0FlTbYp3CqJu+9IFe9bLyAjMxf5ZDDbEg+iMPzB5zYyUTSm8wVTKmA==} engines: {node: '>=4'} @@ -6167,7 +6161,6 @@ packages: /resolve-pkg-maps@1.0.0: resolution: {integrity: sha512-seS2Tj26TBVOC2NIc2rOe2y2ZO7efxITtLZcGSOnHHNOQ7CkiUBfw0Iw2ck6xkIhPwLhKNLS8BO+hEpngQlqzw==} - dev: true /resolve.exports@2.0.2: resolution: {integrity: sha512-X2UW6Nw3n/aMgDVy+0rSqgHlv39WZAlZrXCdnbyEiKm17DSqHX4MmQMaST3FbeWR5FTuRcUwYAziZajji0Y7mg==}