From 8bcb254fc0045414a80d79b056f6cfde2fd66e68 Mon Sep 17 00:00:00 2001 From: Patrick Sullivan Date: Sat, 25 Nov 2023 06:43:12 -0500 Subject: [PATCH] fix(workspace-tools): Update default compilerOptions prior to calling tsc --- .../src/tsconfig/tsconfig.root.json | 6 ---- patches/tsup@8.0.0.patch | 35 +++++++------------ pnpm-lock.yaml | 6 ++-- 3 files changed, 16 insertions(+), 31 deletions(-) diff --git a/packages/linting-tools/src/tsconfig/tsconfig.root.json b/packages/linting-tools/src/tsconfig/tsconfig.root.json index 8dddcd2f8..5747c62c0 100644 --- a/packages/linting-tools/src/tsconfig/tsconfig.root.json +++ b/packages/linting-tools/src/tsconfig/tsconfig.root.json @@ -29,12 +29,6 @@ "skipDefaultLibCheck": true, "esModuleInterop": true }, - "ts-node": { - "compilerOptions": { - "module": "commonjs", - "esModuleInterop": true - } - }, "include": ["./reset.d.ts"], "exclude": ["**/node_modules", "**/tmp"] } diff --git a/patches/tsup@8.0.0.patch b/patches/tsup@8.0.0.patch index f7325774f..84516447c 100644 --- a/patches/tsup@8.0.0.patch +++ b/patches/tsup@8.0.0.patch @@ -51,7 +51,7 @@ index 36191e8e511f9cc413d70403ac86c989890f8d65..c88e541262ba18e25573b1879e447ac9 interface NormalizedExperimentalDtsConfig { entry: { diff --git a/dist/index.js b/dist/index.js -index 2c8ba016932710c259e84a7a070271eb4f73da5b..57ddc19368abf08a6c9c1b674ec56805cec3cbf1 100644 +index 2c8ba016932710c259e84a7a070271eb4f73da5b..277a9caacca3fed8507aed60d57a43d35779b923 100644 --- a/dist/index.js +++ b/dist/index.js @@ -1590,19 +1590,54 @@ var getOutputExtensionMap = (options, format, pkgType) => { @@ -214,7 +214,7 @@ index 2c8ba016932710c259e84a7a070271eb4f73da5b..57ddc19368abf08a6c9c1b674ec56805 let emitResult = program.emit(void 0, writeFile, void 0, true); let diagnostics = _typescript2.default.getPreEmitDiagnostics(program).concat(emitResult.diagnostics); let diagnosticMessages = []; -@@ -2287,38 +2341,95 @@ function emitDtsFiles(program, host) { +@@ -2287,38 +2341,86 @@ function emitDtsFiles(program, host) { } return fileMapping; } @@ -290,18 +290,9 @@ index 2c8ba016932710c259e84a7a070271eb4f73da5b..57ddc19368abf08a6c9c1b674ec56805 + logger.info("tsc", parsedTsconfig); + + let tsOptions = parsedTsconfig.options; -+ if (parsedTsconfig.raw.include) { -+ tsOptions.include = [ -+ ...(tsOptions.include ?? []), -+ ...parsedTsconfig.raw.include -+ ]; -+ } -+ if (parsedTsconfig.raw.exclude) { -+ tsOptions.exclude = [ -+ ...(tsOptions.exclude ?? []), -+ ...parsedTsconfig.raw.exclude -+ ]; -+ } ++ tsOptions.target = parsedTsconfig.raw.compilerOptions.target; ++ tsOptions.module = parsedTsconfig.raw.compilerOptions.module; ++ tsOptions.moduleResolution = parsedTsconfig.raw.compilerOptions.moduleResolution; + + let host = _typescript2.default.createCompilerHost(tsOptions); let program = _typescript2.default.createProgram( @@ -323,7 +314,7 @@ index 2c8ba016932710c259e84a7a070271eb4f73da5b..57ddc19368abf08a6c9c1b674ec56805 } function runTypeScriptCompiler(options) { try { -@@ -2326,9 +2437,11 @@ function runTypeScriptCompiler(options) { +@@ -2326,9 +2428,11 @@ function runTypeScriptCompiler(options) { const getDuration = () => { return `${Math.floor(Date.now() - start)}ms`; }; @@ -336,7 +327,7 @@ index 2c8ba016932710c259e84a7a070271eb4f73da5b..57ddc19368abf08a6c9c1b674ec56805 logger.success("tsc", `\u26A1\uFE0F Build success in ${getDuration()}`); return exports; } catch (error) { -@@ -2428,40 +2541,91 @@ function formatDistributionExport(declaration, dest) { +@@ -2428,40 +2532,91 @@ function formatDistributionExport(declaration, dest) { // src/api-extractor.ts var logger2 = _chunk7G76EW2Rjs.createLogger.call(void 0, ); @@ -438,7 +429,7 @@ index 2c8ba016932710c259e84a7a070271eb4f73da5b..57ddc19368abf08a6c9c1b674ec56805 const extractorResult = Extractor.invoke(extractorConfig, { // Equivalent to the "--local" command-line parameter localBuild: true, -@@ -2477,31 +2641,49 @@ function rollupDtsFile(inputFilePath, outputFilePath, tsconfigFilePath) { +@@ -2477,31 +2632,49 @@ function rollupDtsFile(inputFilePath, outputFilePath, tsconfigFilePath) { async function rollupDtsFiles(options, exports, format) { let declarationDir = _chunkGQ77QZBOjs.ensureTempDeclarationDir.call(void 0, ); let outDir = options.outDir || "dist"; @@ -494,7 +485,7 @@ index 2c8ba016932710c259e84a7a070271eb4f73da5b..57ddc19368abf08a6c9c1b674ec56805 ); } } -@@ -2592,11 +2774,14 @@ var normalizeOptions = async (logger3, optionsFromConfigFile, optionsOverride) = +@@ -2592,11 +2765,14 @@ var normalizeOptions = async (logger3, optionsFromConfigFile, optionsOverride) = options.entry = entry; logger3.info("CLI", `Building entry: ${JSON.stringify(entry)}`); } @@ -511,7 +502,7 @@ index 2c8ba016932710c259e84a7a070271eb4f73da5b..57ddc19368abf08a6c9c1b674ec56805 ); options.tsconfig = tsconfig.path; options.tsconfigResolvePaths = _optionalChain([tsconfig, 'access', _20 => _20.data, 'optionalAccess', _21 => _21.compilerOptions, 'optionalAccess', _22 => _22.paths]) || {}; -@@ -2610,7 +2795,8 @@ var normalizeOptions = async (logger3, optionsFromConfigFile, optionsOverride) = +@@ -2610,7 +2786,8 @@ var normalizeOptions = async (logger3, optionsFromConfigFile, optionsOverride) = if (options.experimentalDts) { options.experimentalDts.compilerOptions = { ...tsconfig.data.compilerOptions || {}, @@ -521,7 +512,7 @@ index 2c8ba016932710c259e84a7a070271eb4f73da5b..57ddc19368abf08a6c9c1b674ec56805 }; options.experimentalDts.entry = _chunkGQ77QZBOjs.toObjectEntry.call(void 0, Object.keys(options.experimentalDts.entry).length > 0 ? options.experimentalDts.entry : options.entry -@@ -2629,7 +2815,7 @@ var normalizeOptions = async (logger3, optionsFromConfigFile, optionsOverride) = +@@ -2629,7 +2806,7 @@ var normalizeOptions = async (logger3, optionsFromConfigFile, optionsOverride) = }; async function build(_options) { const config = _options.config === false ? {} : await _chunk7G76EW2Rjs.loadTsupConfig.call(void 0, @@ -530,7 +521,7 @@ index 2c8ba016932710c259e84a7a070271eb4f73da5b..57ddc19368abf08a6c9c1b674ec56805 _options.config === true ? void 0 : _options.config ); const configData = typeof config.data === "function" ? await config.data(_options) : config.data; -@@ -2695,7 +2881,7 @@ async function build(_options) { +@@ -2695,7 +2872,7 @@ async function build(_options) { let onSuccessProcess; let onSuccessCleanup; const buildDependencies = /* @__PURE__ */ new Set(); @@ -539,7 +530,7 @@ index 2c8ba016932710c259e84a7a070271eb4f73da5b..57ddc19368abf08a6c9c1b674ec56805 const doOnSuccessCleanup = async () => { if (onSuccessProcess) { await killProcess({ -@@ -2816,7 +3002,7 @@ async function build(_options) { +@@ -2816,7 +2993,7 @@ async function build(_options) { let shouldSkipChange = false; if (options.watch === true) { if (file === "package.json" && !buildDependencies.has(file)) { diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 767474aec..5a9ecac83 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -19,7 +19,7 @@ patchedDependencies: hash: sdh76cbs3s6gimrygngciaff4a path: patches/semantic-release@22.0.7.patch tsup@8.0.0: - hash: 7jigj2h7ragpry4m2qhgbx4ykm + hash: ivifo3ye5m6i6npph7ojmb7sqy path: patches/tsup@8.0.0.patch importers: @@ -533,7 +533,7 @@ importers: version: 2.6.2 tsup: specifier: 8.0.0 - version: 8.0.0(patch_hash=7jigj2h7ragpry4m2qhgbx4ykm)(@microsoft/api-extractor@7.38.3)(@swc/core@1.3.96)(ts-node@10.9.1)(typescript@5.2.2) + version: 8.0.0(patch_hash=ivifo3ye5m6i6npph7ojmb7sqy)(@microsoft/api-extractor@7.38.3)(@swc/core@1.3.96)(ts-node@10.9.1)(typescript@5.2.2) packages: /@aashutoshrathi/word-wrap@1.2.6: @@ -19954,7 +19954,7 @@ packages: engines: { node: ">=0.6.x" } dev: false - /tsup@8.0.0(patch_hash=7jigj2h7ragpry4m2qhgbx4ykm)(@microsoft/api-extractor@7.38.3)(@swc/core@1.3.96)(ts-node@10.9.1)(typescript@5.2.2): + /tsup@8.0.0(patch_hash=ivifo3ye5m6i6npph7ojmb7sqy)(@microsoft/api-extractor@7.38.3)(@swc/core@1.3.96)(ts-node@10.9.1)(typescript@5.2.2): resolution: { integrity: sha512-9rOGn8LsFn2iAg2pCB1jnH7ygVuGjlzIomjw0jKXUxAii3iL5cXgm0jZMPKfFH1bSAjQovJ1DUVPSw+oDuIu8A==