@sanity/pkg-utils 9.2.3 → 10.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_chunks-es/buildAction.js +151 -2
- package/dist/_chunks-es/buildAction.js.map +1 -1
- package/dist/_chunks-es/checkAction.js +183 -2
- package/dist/_chunks-es/checkAction.js.map +1 -1
- package/dist/_chunks-es/createApiExtractorConfig.js +52 -0
- package/dist/_chunks-es/createApiExtractorConfig.js.map +1 -0
- package/dist/_chunks-es/createTSDocConfig.js +31 -0
- package/dist/_chunks-es/createTSDocConfig.js.map +1 -0
- package/dist/_chunks-es/defaults.js +36 -0
- package/dist/_chunks-es/defaults.js.map +1 -0
- package/dist/_chunks-es/define.js +7 -0
- package/dist/_chunks-es/define.js.map +1 -0
- package/dist/_chunks-es/fileExists.js +12 -0
- package/dist/_chunks-es/fileExists.js.map +1 -0
- package/dist/_chunks-es/getExtractMessagesConfig.js +83 -0
- package/dist/_chunks-es/getExtractMessagesConfig.js.map +1 -0
- package/dist/_chunks-es/handleError.js +25 -1
- package/dist/_chunks-es/handleError.js.map +1 -1
- package/dist/_chunks-es/index.js +8 -212
- package/dist/_chunks-es/index.js.map +1 -1
- package/dist/_chunks-es/initAction.js +515 -2
- package/dist/_chunks-es/initAction.js.map +1 -1
- package/dist/_chunks-es/printExtractMessages.js +44 -0
- package/dist/_chunks-es/printExtractMessages.js.map +1 -0
- package/dist/_chunks-es/{consoleSpy.js → resolveBuildContext.js} +51 -167
- package/dist/_chunks-es/resolveBuildContext.js.map +1 -0
- package/dist/_chunks-es/resolveRolldownConfig.js +1 -1
- package/dist/_chunks-es/watchAction.js +108 -2
- package/dist/_chunks-es/watchAction.js.map +1 -1
- package/dist/cli.js +1 -1
- package/dist/index.d.ts +5 -208
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +3 -18
- package/dist/index.js.map +1 -1
- package/package.json +8 -14
- package/dist/_chunks-es/build.js +0 -150
- package/dist/_chunks-es/build.js.map +0 -1
- package/dist/_chunks-es/check.js +0 -189
- package/dist/_chunks-es/check.js.map +0 -1
- package/dist/_chunks-es/consoleSpy.js.map +0 -1
- package/dist/_chunks-es/init.js +0 -520
- package/dist/_chunks-es/init.js.map +0 -1
- package/dist/_chunks-es/isRecord.js +0 -37
- package/dist/_chunks-es/isRecord.js.map +0 -1
- package/dist/_chunks-es/watch.js +0 -109
- package/dist/_chunks-es/watch.js.map +0 -1
- package/tsconfig/isolated-declarations.json +0 -11
- package/tsconfig/recommended.json +0 -24
- package/tsconfig/strict.json +0 -15
- package/tsconfig/strictest.json +0 -16
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { ExtractorLogLevel } from "@microsoft/api-extractor";
|
|
2
|
+
const LOG_LEVELS = {
|
|
3
|
+
error: ExtractorLogLevel.Error,
|
|
4
|
+
info: ExtractorLogLevel.Info,
|
|
5
|
+
off: ExtractorLogLevel.None,
|
|
6
|
+
warn: ExtractorLogLevel.Warning
|
|
7
|
+
};
|
|
8
|
+
function getExtractMessagesConfig(options) {
|
|
9
|
+
const { rules, disabled = !1 } = options;
|
|
10
|
+
function ruleToLogLevel(key, defaultLevel) {
|
|
11
|
+
const r = rules?.[key];
|
|
12
|
+
return r ? LOG_LEVELS[r] : defaultLevel || ExtractorLogLevel.Warning;
|
|
13
|
+
}
|
|
14
|
+
return {
|
|
15
|
+
compilerMessageReporting: {
|
|
16
|
+
default: {
|
|
17
|
+
logLevel: disabled ? ExtractorLogLevel.None : ExtractorLogLevel.Warning
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
extractorMessageReporting: disabled ? {
|
|
21
|
+
default: {
|
|
22
|
+
logLevel: ExtractorLogLevel.None,
|
|
23
|
+
addToApiReportFile: !1
|
|
24
|
+
}
|
|
25
|
+
} : {
|
|
26
|
+
default: {
|
|
27
|
+
logLevel: ExtractorLogLevel.Warning,
|
|
28
|
+
addToApiReportFile: !1
|
|
29
|
+
},
|
|
30
|
+
"ae-forgotten-export": {
|
|
31
|
+
/**
|
|
32
|
+
* This is hardcoded to `none` as it's no longer needed since TypeScript 5.5 https://github.com/microsoft/TypeScript/issues/42873
|
|
33
|
+
* It's hardcoded to `none` since supported by API Extractor when using `module: 'Preserve'` doesn't support it well since `@microsoft/api-extractor` v7.49.0, which upgraded from TS 5.4 to 5.7 internally
|
|
34
|
+
*/
|
|
35
|
+
logLevel: ExtractorLogLevel.None,
|
|
36
|
+
addToApiReportFile: !1
|
|
37
|
+
},
|
|
38
|
+
"ae-incompatible-release-tags": {
|
|
39
|
+
logLevel: ruleToLogLevel("ae-incompatible-release-tags", ExtractorLogLevel.Error),
|
|
40
|
+
addToApiReportFile: !1
|
|
41
|
+
},
|
|
42
|
+
"ae-internal-missing-underscore": {
|
|
43
|
+
logLevel: ruleToLogLevel("ae-internal-missing-underscore"),
|
|
44
|
+
addToApiReportFile: !1
|
|
45
|
+
},
|
|
46
|
+
"ae-missing-release-tag": {
|
|
47
|
+
logLevel: ruleToLogLevel("ae-missing-release-tag", ExtractorLogLevel.Error),
|
|
48
|
+
addToApiReportFile: !1
|
|
49
|
+
},
|
|
50
|
+
"ae-wrong-input-file-type": {
|
|
51
|
+
logLevel: ExtractorLogLevel.None,
|
|
52
|
+
addToApiReportFile: !1
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
tsdocMessageReporting: disabled ? {
|
|
56
|
+
default: {
|
|
57
|
+
logLevel: ExtractorLogLevel.None,
|
|
58
|
+
addToApiReportFile: !1
|
|
59
|
+
}
|
|
60
|
+
} : {
|
|
61
|
+
default: {
|
|
62
|
+
logLevel: ExtractorLogLevel.Warning,
|
|
63
|
+
addToApiReportFile: !1
|
|
64
|
+
},
|
|
65
|
+
"tsdoc-link-tag-unescaped-text": {
|
|
66
|
+
logLevel: ruleToLogLevel("tsdoc-link-tag-unescaped-text", ExtractorLogLevel.Warning),
|
|
67
|
+
addToApiReportFile: !1
|
|
68
|
+
},
|
|
69
|
+
"tsdoc-undefined-tag": {
|
|
70
|
+
logLevel: ruleToLogLevel("tsdoc-undefined-tag", ExtractorLogLevel.Error),
|
|
71
|
+
addToApiReportFile: !1
|
|
72
|
+
},
|
|
73
|
+
"tsdoc-unsupported-tag": {
|
|
74
|
+
logLevel: ruleToLogLevel("tsdoc-unsupported-tag", ExtractorLogLevel.None),
|
|
75
|
+
addToApiReportFile: !1
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
export {
|
|
81
|
+
getExtractMessagesConfig
|
|
82
|
+
};
|
|
83
|
+
//# sourceMappingURL=getExtractMessagesConfig.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getExtractMessagesConfig.js","sources":["../../src/node/tasks/dts/getExtractMessagesConfig.ts"],"sourcesContent":["import {ExtractorLogLevel, type IExtractorMessagesConfig} from '@microsoft/api-extractor'\nimport type {PkgConfigOptions, PkgRuleLevel} from '../../core/config/types.ts'\n\nconst LOG_LEVELS: Record<PkgRuleLevel, ExtractorLogLevel> = {\n error: ExtractorLogLevel.Error,\n info: ExtractorLogLevel.Info,\n off: ExtractorLogLevel.None,\n warn: ExtractorLogLevel.Warning,\n}\n\n/** @alpha */\nexport function getExtractMessagesConfig(options: {\n rules: NonNullable<PkgConfigOptions['extract']>['rules']\n disabled?: boolean\n}): IExtractorMessagesConfig {\n const {rules, disabled = false} = options\n\n function ruleToLogLevel(\n key: keyof NonNullable<NonNullable<PkgConfigOptions['extract']>['rules']>,\n defaultLevel?: ExtractorLogLevel,\n ) {\n const r = rules?.[key]\n\n return r ? LOG_LEVELS[r] : defaultLevel || ExtractorLogLevel.Warning\n }\n\n return {\n compilerMessageReporting: {\n default: {\n logLevel: disabled ? ExtractorLogLevel.None : ExtractorLogLevel.Warning,\n },\n },\n\n extractorMessageReporting: disabled\n ? {\n default: {\n logLevel: ExtractorLogLevel.None,\n addToApiReportFile: false,\n },\n }\n : {\n 'default': {\n logLevel: ExtractorLogLevel.Warning,\n addToApiReportFile: false,\n },\n\n 'ae-forgotten-export': {\n /**\n * This is hardcoded to `none` as it's no longer needed since TypeScript 5.5 https://github.com/microsoft/TypeScript/issues/42873\n * It's hardcoded to `none` since supported by API Extractor when using `module: 'Preserve'` doesn't support it well since `@microsoft/api-extractor` v7.49.0, which upgraded from TS 5.4 to 5.7 internally\n */\n logLevel: ExtractorLogLevel.None,\n addToApiReportFile: false,\n },\n\n 'ae-incompatible-release-tags': {\n logLevel: ruleToLogLevel('ae-incompatible-release-tags', ExtractorLogLevel.Error),\n addToApiReportFile: false,\n },\n\n 'ae-internal-missing-underscore': {\n logLevel: ruleToLogLevel('ae-internal-missing-underscore'),\n addToApiReportFile: false,\n },\n\n 'ae-missing-release-tag': {\n logLevel: ruleToLogLevel('ae-missing-release-tag', ExtractorLogLevel.Error),\n addToApiReportFile: false,\n },\n\n 'ae-wrong-input-file-type': {\n logLevel: ExtractorLogLevel.None,\n addToApiReportFile: false,\n },\n },\n\n tsdocMessageReporting: disabled\n ? {\n default: {\n logLevel: ExtractorLogLevel.None,\n addToApiReportFile: false,\n },\n }\n : {\n 'default': {\n logLevel: ExtractorLogLevel.Warning,\n addToApiReportFile: false,\n },\n\n 'tsdoc-link-tag-unescaped-text': {\n logLevel: ruleToLogLevel('tsdoc-link-tag-unescaped-text', ExtractorLogLevel.Warning),\n addToApiReportFile: false,\n },\n\n 'tsdoc-undefined-tag': {\n logLevel: ruleToLogLevel('tsdoc-undefined-tag', ExtractorLogLevel.Error),\n addToApiReportFile: false,\n },\n\n 'tsdoc-unsupported-tag': {\n logLevel: ruleToLogLevel('tsdoc-unsupported-tag', ExtractorLogLevel.None),\n addToApiReportFile: false,\n },\n },\n }\n}\n"],"names":[],"mappings":";AAGA,MAAM,aAAsD;AAAA,EAC1D,OAAO,kBAAkB;AAAA,EACzB,MAAM,kBAAkB;AAAA,EACxB,KAAK,kBAAkB;AAAA,EACvB,MAAM,kBAAkB;AAC1B;AAGO,SAAS,yBAAyB,SAGZ;AAC3B,QAAM,EAAC,OAAO,WAAW,GAAA,IAAS;AAElC,WAAS,eACP,KACA,cACA;AACA,UAAM,IAAI,QAAQ,GAAG;AAErB,WAAO,IAAI,WAAW,CAAC,IAAI,gBAAgB,kBAAkB;AAAA,EAC/D;AAEA,SAAO;AAAA,IACL,0BAA0B;AAAA,MACxB,SAAS;AAAA,QACP,UAAU,WAAW,kBAAkB,OAAO,kBAAkB;AAAA,MAAA;AAAA,IAClE;AAAA,IAGF,2BAA2B,WACvB;AAAA,MACE,SAAS;AAAA,QACP,UAAU,kBAAkB;AAAA,QAC5B,oBAAoB;AAAA,MAAA;AAAA,IACtB,IAEF;AAAA,MACE,SAAW;AAAA,QACT,UAAU,kBAAkB;AAAA,QAC5B,oBAAoB;AAAA,MAAA;AAAA,MAGtB,uBAAuB;AAAA;AAAA;AAAA;AAAA;AAAA,QAKrB,UAAU,kBAAkB;AAAA,QAC5B,oBAAoB;AAAA,MAAA;AAAA,MAGtB,gCAAgC;AAAA,QAC9B,UAAU,eAAe,gCAAgC,kBAAkB,KAAK;AAAA,QAChF,oBAAoB;AAAA,MAAA;AAAA,MAGtB,kCAAkC;AAAA,QAChC,UAAU,eAAe,gCAAgC;AAAA,QACzD,oBAAoB;AAAA,MAAA;AAAA,MAGtB,0BAA0B;AAAA,QACxB,UAAU,eAAe,0BAA0B,kBAAkB,KAAK;AAAA,QAC1E,oBAAoB;AAAA,MAAA;AAAA,MAGtB,4BAA4B;AAAA,QAC1B,UAAU,kBAAkB;AAAA,QAC5B,oBAAoB;AAAA,MAAA;AAAA,IACtB;AAAA,IAGN,uBAAuB,WACnB;AAAA,MACE,SAAS;AAAA,QACP,UAAU,kBAAkB;AAAA,QAC5B,oBAAoB;AAAA,MAAA;AAAA,IACtB,IAEF;AAAA,MACE,SAAW;AAAA,QACT,UAAU,kBAAkB;AAAA,QAC5B,oBAAoB;AAAA,MAAA;AAAA,MAGtB,iCAAiC;AAAA,QAC/B,UAAU,eAAe,iCAAiC,kBAAkB,OAAO;AAAA,QACnF,oBAAoB;AAAA,MAAA;AAAA,MAGtB,uBAAuB;AAAA,QACrB,UAAU,eAAe,uBAAuB,kBAAkB,KAAK;AAAA,QACvE,oBAAoB;AAAA,MAAA;AAAA,MAGtB,yBAAyB;AAAA,QACvB,UAAU,eAAe,yBAAyB,kBAAkB,IAAI;AAAA,QACxE,oBAAoB;AAAA,MAAA;AAAA,IACtB;AAAA,EACF;AAER;"}
|
|
@@ -1,8 +1,32 @@
|
|
|
1
1
|
import chalk from "chalk";
|
|
2
|
+
function createLogger(quiet = !1) {
|
|
3
|
+
return {
|
|
4
|
+
log: (...args) => {
|
|
5
|
+
quiet || console.log(...args);
|
|
6
|
+
},
|
|
7
|
+
info: (...args) => {
|
|
8
|
+
quiet || console.log(chalk.blue("[info]"), ...args);
|
|
9
|
+
},
|
|
10
|
+
warn: (...args) => {
|
|
11
|
+
console.log(chalk.yellow("[warning]"), ...args);
|
|
12
|
+
},
|
|
13
|
+
error: (...args) => {
|
|
14
|
+
console.log(chalk.red("[error]"), ...args);
|
|
15
|
+
},
|
|
16
|
+
success: (...args) => {
|
|
17
|
+
quiet || console.log(chalk.green("[success]"), ...args);
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
function isRecord(value) {
|
|
22
|
+
return !!value && !Array.isArray(value) && typeof value == "object";
|
|
23
|
+
}
|
|
2
24
|
function handleError(err) {
|
|
3
25
|
err instanceof Error ? console.error(chalk.red("error"), err.stack) : console.error(err), process.exit(1);
|
|
4
26
|
}
|
|
5
27
|
export {
|
|
6
|
-
|
|
28
|
+
createLogger,
|
|
29
|
+
handleError,
|
|
30
|
+
isRecord
|
|
7
31
|
};
|
|
8
32
|
//# sourceMappingURL=handleError.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handleError.js","sources":["../../src/cli/handleError.ts"],"sourcesContent":["import chalk from 'chalk'\n\nexport function handleError(err: unknown): void {\n if (err instanceof Error) {\n console.error(chalk.red('error'), err.stack)\n } else {\n console.error(err)\n }\n\n process.exit(1)\n}\n"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"handleError.js","sources":["../../src/node/logger.ts","../../src/node/core/isRecord.ts","../../src/cli/handleError.ts"],"sourcesContent":["// oxlint-disable no-console\nimport chalk from 'chalk'\n\n/** @alpha */\nexport interface Logger {\n log: (...args: unknown[]) => void\n info: (...args: unknown[]) => void\n warn: (...args: unknown[]) => void\n error: (...args: unknown[]) => void\n success: (...args: unknown[]) => void\n}\n\n/** @alpha */\nexport function createLogger(quiet = false): Logger {\n return {\n log: (...args) => {\n if (!quiet) console.log(...args)\n },\n info: (...args) => {\n if (!quiet) console.log(chalk.blue('[info]'), ...args)\n },\n warn: (...args) => {\n console.log(chalk.yellow('[warning]'), ...args)\n },\n error: (...args) => {\n console.log(chalk.red('[error]'), ...args)\n },\n success: (...args) => {\n if (!quiet) console.log(chalk.green('[success]'), ...args)\n },\n }\n}\n","/** @internal */\nexport function isRecord(value: unknown): value is Record<string, unknown> {\n return Boolean(value) && !Array.isArray(value) && typeof value === 'object'\n}\n","import chalk from 'chalk'\n\nexport function handleError(err: unknown): void {\n if (err instanceof Error) {\n console.error(chalk.red('error'), err.stack)\n } else {\n console.error(err)\n }\n\n process.exit(1)\n}\n"],"names":[],"mappings":";AAaO,SAAS,aAAa,QAAQ,IAAe;AAClD,SAAO;AAAA,IACL,KAAK,IAAI,SAAS;AACX,eAAO,QAAQ,IAAI,GAAG,IAAI;AAAA,IACjC;AAAA,IACA,MAAM,IAAI,SAAS;AACZ,eAAO,QAAQ,IAAI,MAAM,KAAK,QAAQ,GAAG,GAAG,IAAI;AAAA,IACvD;AAAA,IACA,MAAM,IAAI,SAAS;AACjB,cAAQ,IAAI,MAAM,OAAO,WAAW,GAAG,GAAG,IAAI;AAAA,IAChD;AAAA,IACA,OAAO,IAAI,SAAS;AAClB,cAAQ,IAAI,MAAM,IAAI,SAAS,GAAG,GAAG,IAAI;AAAA,IAC3C;AAAA,IACA,SAAS,IAAI,SAAS;AACf,eAAO,QAAQ,IAAI,MAAM,MAAM,WAAW,GAAG,GAAG,IAAI;AAAA,IAC3D;AAAA,EAAA;AAEJ;AC9BO,SAAS,SAAS,OAAkD;AACzE,SAAO,CAAA,CAAQ,SAAU,CAAC,MAAM,QAAQ,KAAK,KAAK,OAAO,SAAU;AACrE;ACDO,SAAS,YAAY,KAAoB;AAC1C,iBAAe,QACjB,QAAQ,MAAM,MAAM,IAAI,OAAO,GAAG,IAAI,KAAK,IAE3C,QAAQ,MAAM,GAAG,GAGnB,QAAQ,KAAK,CAAC;AAChB;"}
|
package/dist/_chunks-es/index.js
CHANGED
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
import chalk from "chalk";
|
|
2
2
|
import { from, Observable } from "rxjs";
|
|
3
|
+
import { printExtractMessages } from "./printExtractMessages.js";
|
|
3
4
|
import path, { basename } from "node:path";
|
|
4
|
-
import {
|
|
5
|
+
import { ExtractorConfig, Extractor, ExtractorLogLevel } from "@microsoft/api-extractor";
|
|
5
6
|
import * as rimraf from "rimraf";
|
|
6
7
|
import { rimraf as rimraf$1 } from "rimraf";
|
|
7
8
|
import ts from "typescript";
|
|
8
|
-
import fs
|
|
9
|
+
import fs from "node:fs/promises";
|
|
9
10
|
import { mkdirp } from "mkdirp";
|
|
10
11
|
import * as prettier from "prettier";
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import { createConsoleSpy, resolveConfigProperty, pkgExtMap
|
|
12
|
+
import { createApiExtractorConfig } from "./createApiExtractorConfig.js";
|
|
13
|
+
import { createTSDocConfig } from "./createTSDocConfig.js";
|
|
14
|
+
import { getExtractMessagesConfig } from "./getExtractMessagesConfig.js";
|
|
15
|
+
import { createConsoleSpy, resolveConfigProperty, pkgExtMap } from "./resolveBuildContext.js";
|
|
15
16
|
import { rollup, watch } from "rollup";
|
|
16
17
|
import { optimizeLodashImports } from "@optimize-lodash/rollup-plugin";
|
|
17
18
|
import alias from "@rollup/plugin-alias";
|
|
@@ -23,49 +24,9 @@ import replace from "@rollup/plugin-replace";
|
|
|
23
24
|
import terser from "@rollup/plugin-terser";
|
|
24
25
|
import { vanillaExtractPlugin } from "@vanilla-extract/rollup-plugin";
|
|
25
26
|
import esbuild from "rollup-plugin-esbuild";
|
|
27
|
+
import { DEFAULT_BROWSERSLIST_QUERY } from "./defaults.js";
|
|
26
28
|
import browserslist from "browserslist";
|
|
27
29
|
import { browserslistToTargets, transform } from "lightningcss";
|
|
28
|
-
function printExtractMessages(ctx, messages) {
|
|
29
|
-
const { cwd, logger } = ctx, warnings = messages.filter((msg) => msg.logLevel === ExtractorLogLevel.Warning);
|
|
30
|
-
warnings.length && logger.log();
|
|
31
|
-
for (const msg of warnings) {
|
|
32
|
-
const sourceFilePath = msg.sourceFilePath && path.relative(cwd, msg.sourceFilePath);
|
|
33
|
-
msg.messageId !== "TS6307" && logger.log(
|
|
34
|
-
[
|
|
35
|
-
chalk.cyan(sourceFilePath || "?"),
|
|
36
|
-
`:${chalk.yellow(msg.sourceFileLine)}:${chalk.yellow(msg.sourceFileColumn)}`,
|
|
37
|
-
` - ${chalk.yellow("warning")} ${chalk.gray(msg.messageId)}
|
|
38
|
-
`,
|
|
39
|
-
msg.text,
|
|
40
|
-
`
|
|
41
|
-
`
|
|
42
|
-
].join("")
|
|
43
|
-
);
|
|
44
|
-
}
|
|
45
|
-
const errors = messages.filter(
|
|
46
|
-
(msg) => msg.logLevel === ExtractorLogLevel.Error
|
|
47
|
-
);
|
|
48
|
-
!warnings.length && errors.length && logger.log("");
|
|
49
|
-
for (const msg of errors) {
|
|
50
|
-
const sourceFilePath = msg.sourceFilePath && path.relative(cwd, msg.sourceFilePath);
|
|
51
|
-
logger.log(
|
|
52
|
-
[
|
|
53
|
-
chalk.cyan(sourceFilePath || "?"),
|
|
54
|
-
`:${chalk.yellow(msg.sourceFileLine)}:${chalk.yellow(msg.sourceFileColumn)}`,
|
|
55
|
-
` - ${chalk.red("error")} ${chalk.gray(msg.messageId)}
|
|
56
|
-
`,
|
|
57
|
-
msg.text,
|
|
58
|
-
`
|
|
59
|
-
`
|
|
60
|
-
].join("")
|
|
61
|
-
);
|
|
62
|
-
}
|
|
63
|
-
errors.length && process.exit(1);
|
|
64
|
-
}
|
|
65
|
-
var printExtractMessages$1 = /* @__PURE__ */ Object.freeze({
|
|
66
|
-
__proto__: null,
|
|
67
|
-
printExtractMessages
|
|
68
|
-
});
|
|
69
30
|
function printDiagnostic(options) {
|
|
70
31
|
const { cwd, logger, diagnostic } = options;
|
|
71
32
|
if (diagnostic.file && diagnostic.start) {
|
|
@@ -101,166 +62,6 @@ class DtsError extends Error {
|
|
|
101
62
|
super(message), this.messages = messages;
|
|
102
63
|
}
|
|
103
64
|
}
|
|
104
|
-
function createApiExtractorConfig(options) {
|
|
105
|
-
const {
|
|
106
|
-
bundledPackages,
|
|
107
|
-
distPath,
|
|
108
|
-
exportPath,
|
|
109
|
-
filePath,
|
|
110
|
-
messages,
|
|
111
|
-
projectFolder,
|
|
112
|
-
mainEntryPointFilePath,
|
|
113
|
-
tsconfig,
|
|
114
|
-
tsconfigPath,
|
|
115
|
-
dtsRollupEnabled
|
|
116
|
-
} = options;
|
|
117
|
-
return {
|
|
118
|
-
apiReport: {
|
|
119
|
-
enabled: !1,
|
|
120
|
-
reportFileName: "<unscopedPackageName>.api.md"
|
|
121
|
-
},
|
|
122
|
-
bundledPackages,
|
|
123
|
-
// If `paths` are used for self-referencing imports (e.g. the module is named `sanity`, and the `sanity/structure` export is also importing from `sanity/router`),
|
|
124
|
-
compiler: tsconfig.options.paths ? {
|
|
125
|
-
overrideTsconfig: {
|
|
126
|
-
extends: tsconfigPath,
|
|
127
|
-
compilerOptions: {
|
|
128
|
-
// An empty object replaces whatever is in the original tsconfig file
|
|
129
|
-
paths: {}
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
} : { tsconfigFilePath: tsconfigPath },
|
|
133
|
-
docModel: {
|
|
134
|
-
enabled: !1,
|
|
135
|
-
apiJsonFilePath: path.resolve(distPath, `${exportPath}.api.json`)
|
|
136
|
-
},
|
|
137
|
-
dtsRollup: {
|
|
138
|
-
enabled: dtsRollupEnabled,
|
|
139
|
-
untrimmedFilePath: path.resolve(distPath, filePath)
|
|
140
|
-
// betaTrimmedFilePath: path.resolve(distPath, filePath.replace('.d.ts', '-beta.d.ts')),
|
|
141
|
-
// publicTrimmedFilePath: path.resolve(distPath, filePath.replace('.d.ts', '-public.d.ts')),
|
|
142
|
-
},
|
|
143
|
-
tsdocMetadata: {
|
|
144
|
-
enabled: !1
|
|
145
|
-
},
|
|
146
|
-
messages,
|
|
147
|
-
mainEntryPointFilePath,
|
|
148
|
-
projectFolder
|
|
149
|
-
};
|
|
150
|
-
}
|
|
151
|
-
var createApiExtractorConfig$1 = /* @__PURE__ */ Object.freeze({
|
|
152
|
-
__proto__: null,
|
|
153
|
-
createApiExtractorConfig
|
|
154
|
-
});
|
|
155
|
-
const require$1 = createRequire(import.meta.url);
|
|
156
|
-
async function createTSDocConfig(opts) {
|
|
157
|
-
const { customTags } = opts;
|
|
158
|
-
if (customTags.length === 0)
|
|
159
|
-
return;
|
|
160
|
-
const tsDocBaseBuf = await readFile(
|
|
161
|
-
require$1.resolve("@microsoft/api-extractor/extends/tsdoc-base.json")
|
|
162
|
-
), tsDocBaseConfig = parse(tsDocBaseBuf.toString()), tagDefinitions = (tsDocBaseConfig.tagDefinitions || []).concat(
|
|
163
|
-
customTags.map((t) => ({
|
|
164
|
-
tagName: `@${t.name}`,
|
|
165
|
-
syntaxKind: t.syntaxKind,
|
|
166
|
-
allowMultiple: t.allowMultiple
|
|
167
|
-
}))
|
|
168
|
-
), supportForTags = { ...tsDocBaseConfig.supportForTags };
|
|
169
|
-
for (const customTag of customTags)
|
|
170
|
-
supportForTags[`@${customTag.name}`] = !0;
|
|
171
|
-
return TSDocConfigFile.loadFromObject({
|
|
172
|
-
...tsDocBaseConfig,
|
|
173
|
-
noStandardTags: !1,
|
|
174
|
-
tagDefinitions,
|
|
175
|
-
supportForTags
|
|
176
|
-
});
|
|
177
|
-
}
|
|
178
|
-
var createTSDocConfig$1 = /* @__PURE__ */ Object.freeze({
|
|
179
|
-
__proto__: null,
|
|
180
|
-
createTSDocConfig
|
|
181
|
-
});
|
|
182
|
-
const LOG_LEVELS = {
|
|
183
|
-
error: ExtractorLogLevel.Error,
|
|
184
|
-
info: ExtractorLogLevel.Info,
|
|
185
|
-
off: ExtractorLogLevel.None,
|
|
186
|
-
warn: ExtractorLogLevel.Warning
|
|
187
|
-
};
|
|
188
|
-
function getExtractMessagesConfig(options) {
|
|
189
|
-
const { rules, disabled = !1 } = options;
|
|
190
|
-
function ruleToLogLevel(key, defaultLevel) {
|
|
191
|
-
const r = rules?.[key];
|
|
192
|
-
return r ? LOG_LEVELS[r] : defaultLevel || ExtractorLogLevel.Warning;
|
|
193
|
-
}
|
|
194
|
-
return {
|
|
195
|
-
compilerMessageReporting: {
|
|
196
|
-
default: {
|
|
197
|
-
logLevel: disabled ? ExtractorLogLevel.None : ExtractorLogLevel.Warning
|
|
198
|
-
}
|
|
199
|
-
},
|
|
200
|
-
extractorMessageReporting: disabled ? {
|
|
201
|
-
default: {
|
|
202
|
-
logLevel: ExtractorLogLevel.None,
|
|
203
|
-
addToApiReportFile: !1
|
|
204
|
-
}
|
|
205
|
-
} : {
|
|
206
|
-
default: {
|
|
207
|
-
logLevel: ExtractorLogLevel.Warning,
|
|
208
|
-
addToApiReportFile: !1
|
|
209
|
-
},
|
|
210
|
-
"ae-forgotten-export": {
|
|
211
|
-
/**
|
|
212
|
-
* This is hardcoded to `none` as it's no longer needed since TypeScript 5.5 https://github.com/microsoft/TypeScript/issues/42873
|
|
213
|
-
* It's hardcoded to `none` since supported by API Extractor when using `module: 'Preserve'` doesn't support it well since `@microsoft/api-extractor` v7.49.0, which upgraded from TS 5.4 to 5.7 internally
|
|
214
|
-
*/
|
|
215
|
-
logLevel: ExtractorLogLevel.None,
|
|
216
|
-
addToApiReportFile: !1
|
|
217
|
-
},
|
|
218
|
-
"ae-incompatible-release-tags": {
|
|
219
|
-
logLevel: ruleToLogLevel("ae-incompatible-release-tags", ExtractorLogLevel.Error),
|
|
220
|
-
addToApiReportFile: !1
|
|
221
|
-
},
|
|
222
|
-
"ae-internal-missing-underscore": {
|
|
223
|
-
logLevel: ruleToLogLevel("ae-internal-missing-underscore"),
|
|
224
|
-
addToApiReportFile: !1
|
|
225
|
-
},
|
|
226
|
-
"ae-missing-release-tag": {
|
|
227
|
-
logLevel: ruleToLogLevel("ae-missing-release-tag", ExtractorLogLevel.Error),
|
|
228
|
-
addToApiReportFile: !1
|
|
229
|
-
},
|
|
230
|
-
"ae-wrong-input-file-type": {
|
|
231
|
-
logLevel: ExtractorLogLevel.None,
|
|
232
|
-
addToApiReportFile: !1
|
|
233
|
-
}
|
|
234
|
-
},
|
|
235
|
-
tsdocMessageReporting: disabled ? {
|
|
236
|
-
default: {
|
|
237
|
-
logLevel: ExtractorLogLevel.None,
|
|
238
|
-
addToApiReportFile: !1
|
|
239
|
-
}
|
|
240
|
-
} : {
|
|
241
|
-
default: {
|
|
242
|
-
logLevel: ExtractorLogLevel.Warning,
|
|
243
|
-
addToApiReportFile: !1
|
|
244
|
-
},
|
|
245
|
-
"tsdoc-link-tag-unescaped-text": {
|
|
246
|
-
logLevel: ruleToLogLevel("tsdoc-link-tag-unescaped-text", ExtractorLogLevel.Warning),
|
|
247
|
-
addToApiReportFile: !1
|
|
248
|
-
},
|
|
249
|
-
"tsdoc-undefined-tag": {
|
|
250
|
-
logLevel: ruleToLogLevel("tsdoc-undefined-tag", ExtractorLogLevel.Error),
|
|
251
|
-
addToApiReportFile: !1
|
|
252
|
-
},
|
|
253
|
-
"tsdoc-unsupported-tag": {
|
|
254
|
-
logLevel: ruleToLogLevel("tsdoc-unsupported-tag", ExtractorLogLevel.None),
|
|
255
|
-
addToApiReportFile: !1
|
|
256
|
-
}
|
|
257
|
-
}
|
|
258
|
-
};
|
|
259
|
-
}
|
|
260
|
-
var getExtractMessagesConfig$1 = /* @__PURE__ */ Object.freeze({
|
|
261
|
-
__proto__: null,
|
|
262
|
-
getExtractMessagesConfig
|
|
263
|
-
});
|
|
264
65
|
async function extractTypes(options) {
|
|
265
66
|
const {
|
|
266
67
|
bundledPackages,
|
|
@@ -894,11 +695,6 @@ const rollupWatchTask = {
|
|
|
894
695
|
};
|
|
895
696
|
export {
|
|
896
697
|
buildTaskHandlers,
|
|
897
|
-
createApiExtractorConfig$1 as createApiExtractorConfig,
|
|
898
|
-
createTSDocConfig$1 as createTSDocConfig,
|
|
899
|
-
getExtractMessagesConfig,
|
|
900
|
-
getExtractMessagesConfig$1,
|
|
901
|
-
printExtractMessages$1 as printExtractMessages,
|
|
902
698
|
watchTaskHandlers
|
|
903
699
|
};
|
|
904
700
|
//# sourceMappingURL=index.js.map
|