Skip to content

Commit

Permalink
fix(workspace-tools): Update default compilerOptions prior to calling…
Browse files Browse the repository at this point in the history
… tsc
  • Loading branch information
sullivanpj committed Nov 25, 2023
1 parent c142618 commit 8bcb254
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 31 deletions.
6 changes: 0 additions & 6 deletions packages/linting-tools/src/tsconfig/tsconfig.root.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,6 @@
"skipDefaultLibCheck": true,
"esModuleInterop": true
},
"ts-node": {
"compilerOptions": {
"module": "commonjs",
"esModuleInterop": true
}
},
"include": ["./reset.d.ts"],
"exclude": ["**/node_modules", "**/tmp"]
}
35 changes: 13 additions & 22 deletions patches/tsup@8.0.0.patch
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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(
Expand All @@ -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`;
};
Expand All @@ -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, );
Expand Down Expand Up @@ -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";
Expand Down Expand Up @@ -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)}`);
}
Expand All @@ -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 || {},
Expand All @@ -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,
Expand All @@ -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();
Expand All @@ -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)) {
Expand Down
6 changes: 3 additions & 3 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 8bcb254

Please sign in to comment.