Skip to content

Commit

Permalink
fix(workspace-tools): Removed instance of JSDocs parser in tsup patch
Browse files Browse the repository at this point in the history
  • Loading branch information
sullivanpj committed Jan 17, 2024
1 parent cc62836 commit 4c8448e
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 56 deletions.
28 changes: 14 additions & 14 deletions packages/config-tools/src/utilities/logger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,13 @@ export const getLogFn = (
) {
return (message: string) => {
console.error(
`\n\n ${chalk.bold.hex(config?.colors?.fatal ? config.colors.fatal : "#1fb2a6")(
`\n\n\n ${chalk.bold.hex(config?.colors?.fatal ? config.colors.fatal : "#1fb2a6")(
">"
)} ${chalk.bold
.bgHex(config?.colors?.fatal ? config.colors.fatal : "#1fb2a6")
.white(" 💀 Fatal ")} ${chalk.reset.hex(
config?.colors?.fatal ? config.colors.fatal : "#1fb2a6"
)(message)} \n\n`
)(message)} \n\n\n`
);
};
}
Expand All @@ -48,13 +48,13 @@ export const getLogFn = (
) {
return (message: string) => {
console.error(
`\n\n ${chalk.bold.hex(config?.colors?.error ? config.colors.error : "#7d1a1a")(
`\n\n\n ${chalk.bold.hex(config?.colors?.error ? config.colors.error : "#7d1a1a")(
">"
)} ${chalk.bold
.bgHex(config?.colors?.error ? config.colors.error : "#7d1a1a")
.white(" 🛑 Error ")} ${chalk.reset.hex(
config?.colors?.error ? config.colors.error : "#7d1a1a"
)(message)} \n\n`
)(message)} \n\n\n`
);
};
}
Expand All @@ -65,13 +65,13 @@ export const getLogFn = (
) {
return (message: string) => {
console.warn(
`\n\n ${chalk.bold.hex(config?.colors?.warning ? config.colors.warning : "#fcc419")(
`\n\n\n ${chalk.bold.hex(config?.colors?.warning ? config.colors.warning : "#fcc419")(
">"
)} ${chalk.bold
.bgHex(config?.colors?.warning ? config.colors.warning : "#fcc419")
.white(" ⚠️ Warn ")} ${chalk.reset.hex(
config?.colors?.warning ? config.colors.warning : "#fcc419"
)(message)} \n\n`
)(message)} \n\n\n`
);
};
}
Expand All @@ -82,13 +82,13 @@ export const getLogFn = (
) {
return (message: string) => {
console.info(
`\n\n ${chalk.bold.hex(config?.colors?.info ? config.colors.info : "#0ea5e9")(
`\n\n\n ${chalk.bold.hex(config?.colors?.info ? config.colors.info : "#0ea5e9")(
">"
)} ${chalk.bold
.bgHex(config?.colors?.info ? config.colors.info : "#0ea5e9")
.white(" 📬 Info ")} ${chalk.reset.hex(
config?.colors?.info ? config.colors.info : "#0ea5e9"
)(message)} \n\n`
)(message)} \n\n\n`
);
};
}
Expand All @@ -99,13 +99,13 @@ export const getLogFn = (
) {
return (message: string) => {
console.info(
`\n\n ${chalk.bold.hex(config?.colors?.success ? config.colors.success : "#087f5b")(
`\n\n\n ${chalk.bold.hex(config?.colors?.success ? config.colors.success : "#087f5b")(
">"
)} ${chalk.bold
.bgHex(config?.colors?.success ? config.colors.success : "#087f5b")
.white(" 🎉 Success ")} ${chalk.reset.hex(
config?.colors?.success ? config.colors.success : "#087f5b"
)(message)} \n\n`
)(message)} \n\n\n`
);
};
}
Expand All @@ -116,26 +116,26 @@ export const getLogFn = (
) {
return (message: string) => {
console.debug(
`\n\n ${chalk.bold.hex(config?.colors?.primary ? config.colors.primary : "#1fb2a6")(
`\n\n\n ${chalk.bold.hex(config?.colors?.primary ? config.colors.primary : "#1fb2a6")(
">"
)} ${chalk.bold
.bgHex(config?.colors?.primary ? config.colors.primary : "#1fb2a6")
.white(" 🧪 Debug ")} ${chalk.reset.hex(
config?.colors?.primary ? config.colors.primary : "#1fb2a6"
)(message)} \n\n`
)(message)} \n\n\n`
);
};
}

return (message: string) => {
console.log(
`\n\n ${chalk.bold.hex(config?.colors?.primary ? config.colors.primary : "#1fb2a6")(
`\n\n\n ${chalk.bold.hex(config?.colors?.primary ? config.colors.primary : "#1fb2a6")(
">"
)} ${chalk.bold
.bgHex(config?.colors?.primary ? config.colors.primary : "#1fb2a6")
.white(" 📢 System ")} ${chalk.bold.hex(
config?.colors?.primary ? config.colors.primary : "#1fb2a6"
)(message)} \n\n`
)(message)} \n\n\n`
);
};
};
Expand Down
73 changes: 34 additions & 39 deletions patches/tsup@8.0.0.patch
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ index 36191e8e511f9cc413d70403ac86c989890f8d65..3165f63da893d94058af2ebda01f89fd
interface NormalizedExperimentalDtsConfig {
entry: {
diff --git a/dist/index.js b/dist/index.js
index 2c8ba016932710c259e84a7a070271eb4f73da5b..5225317a6ca2fc858520c63f9e3ea5884048960a 100644
index 2c8ba016932710c259e84a7a070271eb4f73da5b..46e2322dad69c10f02a4978cc42258d07f51e2d3 100644
--- a/dist/index.js
+++ b/dist/index.js
@@ -1,4 +1,4 @@
Expand Down Expand Up @@ -1192,7 +1192,7 @@ index 2c8ba016932710c259e84a7a070271eb4f73da5b..5225317a6ca2fc858520c63f9e3ea588
if (diagnostic.file) {
let { line, character } = _typescript2.default.getLineAndCharacterOfPosition(
diagnostic.file,
@@ -2283,52 +2378,54 @@ function emitDtsFiles(program, host) {
@@ -2283,52 +2378,49 @@ function emitDtsFiles(program, host) {
"TSC",
"Failed to emit declaration files.\n\n" + diagnosticMessage
);
Expand All @@ -1207,7 +1207,26 @@ index 2c8ba016932710c259e84a7a070271eb4f73da5b..5225317a6ca2fc858520c63f9e3ea588
- let rawTsconfig = _bundlerequire.loadTsConfig.call(void 0, cwd, tsconfig);
- if (!rawTsconfig) {
- throw new Error(`Unable to find ${tsconfig || "tsconfig.json"} in ${cwd}`);
- }
+
+async function emit(options, compilerOptions, tsconfig) {
+ logger.info("tsc", "Using the following compiler Options: ");
+ logger.info("tsc", compilerOptions);
+
+ const host = _typescript2.default.createCompilerHost(compilerOptions.options);
+ const program = _typescript2.default.createProgram({
+ rootNames: compilerOptions.fileNames,
+ options: compilerOptions.options,
+ host,
+ });
+
+ const fileMapping = emitDtsFiles(program, host, options);
+ if (!fileMapping || fileMapping.size === 0) {
+ logger.warn("tsc", "No files were emitted during DTS generation!");
+ } else {
+ let resultLog = "Emitted the following file names: \n";
+ fileMapping.forEach((value, key) => resultLog += ` -> ${key}: ${value}\n`);
+ logger.info("tsc", resultLog);
}
- let declarationDir = _chunkGQ77QZBOjs.ensureTempDeclarationDir.call(void 0, );
- let parsedTsconfig = _typescript2.default.parseJsonConfigFileContent(
- {
Expand All @@ -1221,21 +1240,7 @@ index 2c8ba016932710c259e84a7a070271eb4f73da5b..5225317a6ca2fc858520c63f9e3ea588
- declarationDir,
- emitDeclarationOnly: true
- }
+
+async function emit(options, compilerOptions, tsconfig) {
+ logger.info("tsc", "Using the following compiler Options: ");
+ logger.info("tsc", compilerOptions);
+
+ const host = _typescript2.default.createCompilerHost(compilerOptions.options);
+ const program = _typescript2.default.createProgram({
+ rootNames: compilerOptions.fileNames,
+ options: compilerOptions.options,
+ host: {
+ ...host,
+ jsDocParsingMode: _typescript2.default.JSDocParsingMode?.ParseAll !== undefined
+ ? _typescript2.default.JSDocParsingMode.ParseAll
+ : 0
},
- },
- _typescript2.default.sys,
- tsconfig ? _path.dirname.call(void 0, tsconfig) : "./"
- );
Expand All @@ -1248,16 +1253,6 @@ index 2c8ba016932710c259e84a7a070271eb4f73da5b..5225317a6ca2fc858520c63f9e3ea588
- );
- let fileMapping = emitDtsFiles(program, host);
- return getExports(program, fileMapping);
+ });
+
+ const fileMapping = emitDtsFiles(program, host, options);
+ if (!fileMapping || fileMapping.size === 0) {
+ logger.warn("tsc", "No files were emitted during DTS generation!");
+ } else {
+ let resultLog = "Emitted the following file names: \n";
+ fileMapping.forEach((value, key) => resultLog += ` -> ${key}: ${value}\n`);
+ logger.info("tsc", resultLog);
+ }
+
+ return getExports(options, program, fileMapping);
}
Expand All @@ -1280,7 +1275,7 @@ index 2c8ba016932710c259e84a7a070271eb4f73da5b..5225317a6ca2fc858520c63f9e3ea588
logger.success("tsc", `\u26A1\uFE0F Build success in ${getDuration()}`);
return exports;
} catch (error) {
@@ -2352,7 +2449,7 @@ function formatAggregationExports(exports, declarationDirPath) {
@@ -2352,7 +2444,7 @@ function formatAggregationExports(exports, declarationDirPath) {
return lines.join("\n") + "\n";
}
function formatAggregationExport(declaration, declarationDirPath) {
Expand All @@ -1289,7 +1284,7 @@ index 2c8ba016932710c259e84a7a070271eb4f73da5b..5225317a6ca2fc858520c63f9e3ea588
"./" + _path2.default.posix.normalize(
_chunkGQ77QZBOjs.slash.call(void 0, _path2.default.relative(declarationDirPath, declaration.destFileName))
)
@@ -2374,7 +2471,7 @@ function formatAggregationExport(declaration, declarationDirPath) {
@@ -2374,7 +2466,7 @@ function formatAggregationExport(declaration, declarationDirPath) {
}
}
function formatDistributionExports(exports, fromFilePath, toFilePath) {
Expand All @@ -1298,7 +1293,7 @@ index 2c8ba016932710c259e84a7a070271eb4f73da5b..5225317a6ca2fc858520c63f9e3ea588
_path2.default.posix.relative(
_path2.default.posix.dirname(_path2.default.posix.normalize(_chunkGQ77QZBOjs.slash.call(void 0, fromFilePath))),
_path2.default.posix.normalize(_chunkGQ77QZBOjs.slash.call(void 0, toFilePath))
@@ -2427,41 +2524,83 @@ function formatDistributionExport(declaration, dest) {
@@ -2427,41 +2519,83 @@ function formatDistributionExport(declaration, dest) {
}

// src/api-extractor.ts
Expand Down Expand Up @@ -1396,7 +1391,7 @@ index 2c8ba016932710c259e84a7a070271eb4f73da5b..5225317a6ca2fc858520c63f9e3ea588
const extractorResult = Extractor.invoke(extractorConfig, {
// Equivalent to the "--local" command-line parameter
localBuild: true,
@@ -2474,36 +2613,54 @@ function rollupDtsFile(inputFilePath, outputFilePath, tsconfigFilePath) {
@@ -2474,36 +2608,54 @@ function rollupDtsFile(inputFilePath, outputFilePath, tsconfigFilePath) {
);
}
}
Expand Down Expand Up @@ -1460,7 +1455,7 @@ index 2c8ba016932710c259e84a7a070271eb4f73da5b..5225317a6ca2fc858520c63f9e3ea588
}
async function runDtsRollup(options, exports) {
try {
@@ -2592,11 +2749,14 @@ var normalizeOptions = async (logger3, optionsFromConfigFile, optionsOverride) =
@@ -2592,11 +2744,14 @@ var normalizeOptions = async (logger3, optionsFromConfigFile, optionsOverride) =
options.entry = entry;
logger3.info("CLI", `Building entry: ${JSON.stringify(entry)}`);
}
Expand All @@ -1477,7 +1472,7 @@ index 2c8ba016932710c259e84a7a070271eb4f73da5b..5225317a6ca2fc858520c63f9e3ea588
);
options.tsconfig = tsconfig.path;
options.tsconfigResolvePaths = _optionalChain([tsconfig, 'access', _20 => _20.data, 'optionalAccess', _21 => _21.compilerOptions, 'optionalAccess', _22 => _22.paths]) || {};
@@ -2610,9 +2770,10 @@ var normalizeOptions = async (logger3, optionsFromConfigFile, optionsOverride) =
@@ -2610,9 +2765,10 @@ var normalizeOptions = async (logger3, optionsFromConfigFile, optionsOverride) =
if (options.experimentalDts) {
options.experimentalDts.compilerOptions = {
...tsconfig.data.compilerOptions || {},
Expand All @@ -1490,7 +1485,7 @@ index 2c8ba016932710c259e84a7a070271eb4f73da5b..5225317a6ca2fc858520c63f9e3ea588
Object.keys(options.experimentalDts.entry).length > 0 ? options.experimentalDts.entry : options.entry
);
}
@@ -2628,8 +2789,8 @@ var normalizeOptions = async (logger3, optionsFromConfigFile, optionsOverride) =
@@ -2628,8 +2784,8 @@ var normalizeOptions = async (logger3, optionsFromConfigFile, optionsOverride) =
return options;
};
async function build(_options) {
Expand All @@ -1501,7 +1496,7 @@ index 2c8ba016932710c259e84a7a070271eb4f73da5b..5225317a6ca2fc858520c63f9e3ea588
_options.config === true ? void 0 : _options.config
);
const configData = typeof config.data === "function" ? await config.data(_options) : config.data;
@@ -2652,7 +2813,7 @@ async function build(_options) {
@@ -2652,7 +2808,7 @@ async function build(_options) {
);
}
if (options.experimentalDts) {
Expand All @@ -1510,7 +1505,7 @@ index 2c8ba016932710c259e84a7a070271eb4f73da5b..5225317a6ca2fc858520c63f9e3ea588
await runDtsRollup(options, exports);
}
if (options.dts) {
@@ -2695,7 +2856,7 @@ async function build(_options) {
@@ -2695,7 +2851,7 @@ async function build(_options) {
let onSuccessProcess;
let onSuccessCleanup;
const buildDependencies = /* @__PURE__ */ new Set();
Expand All @@ -1519,7 +1514,7 @@ index 2c8ba016932710c259e84a7a070271eb4f73da5b..5225317a6ca2fc858520c63f9e3ea588
const doOnSuccessCleanup = async () => {
if (onSuccessProcess) {
await killProcess({
@@ -2708,7 +2869,7 @@ async function build(_options) {
@@ -2708,7 +2864,7 @@ async function build(_options) {
onSuccessProcess = void 0;
onSuccessCleanup = void 0;
};
Expand All @@ -1528,7 +1523,7 @@ index 2c8ba016932710c259e84a7a070271eb4f73da5b..5225317a6ca2fc858520c63f9e3ea588
() => {
return buildAll();
},
@@ -2816,7 +2977,7 @@ async function build(_options) {
@@ -2816,7 +2972,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 4c8448e

Please sign in to comment.