@sanity/pkg-utils 1.7.1 → 1.7.3
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/{__resolveBuildContext-49ce07ba.cjs → __resolveBuildContext-56b6b816.cjs} +214 -102
- package/dist/__resolveBuildContext-56b6b816.cjs.map +1 -0
- package/dist/_build-49dd667f.cjs +208 -0
- package/dist/_build-49dd667f.cjs.map +1 -0
- package/dist/{_buildAction-38c3d2ed.cjs → _buildAction-b58e3a4b.cjs} +33 -6
- package/dist/_buildAction-b58e3a4b.cjs.map +1 -0
- package/dist/{_check-4ce1387d.cjs → _check-0871d90f.cjs} +112 -51
- package/dist/_check-0871d90f.cjs.map +1 -0
- package/dist/{_checkAction-2704266e.cjs → _checkAction-0510605b.cjs} +17 -3
- package/dist/_checkAction-0510605b.cjs.map +1 -0
- package/dist/_index-e3dda92a.cjs +733 -0
- package/dist/_index-e3dda92a.cjs.map +1 -0
- package/dist/_watch-e1c86797.cjs +267 -0
- package/dist/_watch-e1c86797.cjs.map +1 -0
- package/dist/{_watchAction-df30594b.cjs → _watchAction-cfe36cbc.cjs} +36 -6
- package/dist/_watchAction-cfe36cbc.cjs.map +1 -0
- package/dist/cli.cjs +24 -9
- package/dist/cli.cjs.map +1 -1
- package/dist/index.cjs +45 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +792 -516
- package/dist/index.js.map +1 -1
- package/dist/types/src/cli/buildAction.d.ts +4 -0
- package/dist/types/src/cli/buildAction.d.ts.map +1 -0
- package/dist/types/src/cli/checkAction.d.ts +5 -0
- package/dist/types/src/cli/checkAction.d.ts.map +1 -0
- package/dist/types/src/cli/index.d.ts +2 -0
- package/dist/types/src/cli/index.d.ts.map +1 -0
- package/dist/types/src/cli/watchAction.d.ts +4 -0
- package/dist/types/src/cli/watchAction.d.ts.map +1 -0
- package/dist/types/src/node/_core/_defaults.d.ts +5 -0
- package/dist/types/src/node/_core/_defaults.d.ts.map +1 -0
- package/dist/types/src/node/_core/_isRecord.d.ts +3 -0
- package/dist/types/src/node/_core/_isRecord.d.ts.map +1 -0
- package/dist/types/src/node/_core/config/_loadConfig.d.ts +6 -0
- package/dist/types/src/node/_core/config/_loadConfig.d.ts.map +1 -0
- package/dist/types/src/node/_core/config/_resolveConfigProperty.d.ts +4 -0
- package/dist/types/src/node/_core/config/_resolveConfigProperty.d.ts.map +1 -0
- package/dist/types/src/node/_core/config/defineConfig.d.ts +4 -0
- package/dist/types/src/node/_core/config/defineConfig.d.ts.map +1 -0
- package/dist/types/src/node/_core/config/index.d.ts +5 -0
- package/dist/types/src/node/_core/config/index.d.ts.map +1 -0
- package/dist/types/src/node/_core/config/types.d.ts +76 -0
- package/dist/types/src/node/_core/config/types.d.ts.map +1 -0
- package/dist/types/src/node/_core/contexts/buildContext.d.ts +33 -0
- package/dist/types/src/node/_core/contexts/buildContext.d.ts.map +1 -0
- package/dist/types/src/node/_core/contexts/index.d.ts +2 -0
- package/dist/types/src/node/_core/contexts/index.d.ts.map +1 -0
- package/dist/types/src/node/_core/index.d.ts +7 -0
- package/dist/types/src/node/_core/index.d.ts.map +1 -0
- package/dist/types/src/node/_core/pkg/_loadPkg.d.ts +6 -0
- package/dist/types/src/node/_core/pkg/_loadPkg.d.ts.map +1 -0
- package/dist/types/src/node/_core/pkg/_loadPkgWithReporting.d.ts +6 -0
- package/dist/types/src/node/_core/pkg/_loadPkgWithReporting.d.ts.map +1 -0
- package/dist/types/src/node/_core/pkg/_parseExports.d.ts +9 -0
- package/dist/types/src/node/_core/pkg/_parseExports.d.ts.map +1 -0
- package/dist/types/src/node/_core/pkg/_types.d.ts +29 -0
- package/dist/types/src/node/_core/pkg/_types.d.ts.map +1 -0
- package/dist/types/src/node/_core/pkg/index.d.ts +5 -0
- package/dist/types/src/node/_core/pkg/index.d.ts.map +1 -0
- package/dist/types/src/node/_core/ts/_loadTSConfig.d.ts +7 -0
- package/dist/types/src/node/_core/ts/_loadTSConfig.d.ts.map +1 -0
- package/dist/types/src/node/_core/ts/index.d.ts +2 -0
- package/dist/types/src/node/_core/ts/index.d.ts.map +1 -0
- package/dist/types/src/node/_getFilesize.d.ts +2 -0
- package/dist/types/src/node/_getFilesize.d.ts.map +1 -0
- package/dist/types/src/node/_globFiles.d.ts +2 -0
- package/dist/types/src/node/_globFiles.d.ts.map +1 -0
- package/dist/types/src/node/_printExtractMessages.d.ts +4 -0
- package/dist/types/src/node/_printExtractMessages.d.ts.map +1 -0
- package/dist/types/src/node/_printPackageTree.d.ts +4 -0
- package/dist/types/src/node/_printPackageTree.d.ts.map +1 -0
- package/dist/types/src/node/_resolveBrowserTarget.d.ts +3 -0
- package/dist/types/src/node/_resolveBrowserTarget.d.ts.map +1 -0
- package/dist/types/src/node/_resolveBrowserslistVersions.d.ts +11 -0
- package/dist/types/src/node/_resolveBrowserslistVersions.d.ts.map +1 -0
- package/dist/types/src/node/_resolveBuildContext.d.ts +8 -0
- package/dist/types/src/node/_resolveBuildContext.d.ts.map +1 -0
- package/dist/types/src/node/_resolveBuildTasks.d.ts +5 -0
- package/dist/types/src/node/_resolveBuildTasks.d.ts.map +1 -0
- package/dist/types/src/node/_resolveNodeTarget.d.ts +3 -0
- package/dist/types/src/node/_resolveNodeTarget.d.ts.map +1 -0
- package/dist/types/src/node/_resolveWatchTasks.d.ts +5 -0
- package/dist/types/src/node/_resolveWatchTasks.d.ts.map +1 -0
- package/dist/types/src/node/_spinner.d.ts +5 -0
- package/dist/types/src/node/_spinner.d.ts.map +1 -0
- package/dist/types/src/node/_tasks/_types.d.ts +50 -0
- package/dist/types/src/node/_tasks/_types.d.ts.map +1 -0
- package/dist/types/src/node/_tasks/dts/_DtsError.d.ts +7 -0
- package/dist/types/src/node/_tasks/dts/_DtsError.d.ts.map +1 -0
- package/dist/types/src/node/_tasks/dts/_buildTypes.d.ts +9 -0
- package/dist/types/src/node/_tasks/dts/_buildTypes.d.ts.map +1 -0
- package/dist/types/src/node/_tasks/dts/_createApiExtractorConfig.d.ts +11 -0
- package/dist/types/src/node/_tasks/dts/_createApiExtractorConfig.d.ts.map +1 -0
- package/dist/types/src/node/_tasks/dts/_createTSDocConfig.d.ts +12 -0
- package/dist/types/src/node/_tasks/dts/_createTSDocConfig.d.ts.map +1 -0
- package/dist/types/src/node/_tasks/dts/_doExtract.d.ts +4 -0
- package/dist/types/src/node/_tasks/dts/_doExtract.d.ts.map +1 -0
- package/dist/types/src/node/_tasks/dts/_dtsTask.d.ts +5 -0
- package/dist/types/src/node/_tasks/dts/_dtsTask.d.ts.map +1 -0
- package/dist/types/src/node/_tasks/dts/_dtsWatchTask.d.ts +5 -0
- package/dist/types/src/node/_tasks/dts/_dtsWatchTask.d.ts.map +1 -0
- package/dist/types/src/node/_tasks/dts/_extractTypes.d.ts +17 -0
- package/dist/types/src/node/_tasks/dts/_extractTypes.d.ts.map +1 -0
- package/dist/types/src/node/_tasks/dts/_types.d.ts +27 -0
- package/dist/types/src/node/_tasks/dts/_types.d.ts.map +1 -0
- package/dist/types/src/node/_tasks/dts/index.d.ts +4 -0
- package/dist/types/src/node/_tasks/dts/index.d.ts.map +1 -0
- package/dist/types/src/node/_tasks/index.d.ts +9 -0
- package/dist/types/src/node/_tasks/index.d.ts.map +1 -0
- package/dist/types/src/node/_tasks/rollup/_resolveRollupConfig.d.ts +10 -0
- package/dist/types/src/node/_tasks/rollup/_resolveRollupConfig.d.ts.map +1 -0
- package/dist/types/src/node/_tasks/rollup/_rollupTask.d.ts +4 -0
- package/dist/types/src/node/_tasks/rollup/_rollupTask.d.ts.map +1 -0
- package/dist/types/src/node/_tasks/rollup/_rollupWatchTask.d.ts +5 -0
- package/dist/types/src/node/_tasks/rollup/_rollupWatchTask.d.ts.map +1 -0
- package/dist/types/src/node/_tasks/rollup/index.d.ts +3 -0
- package/dist/types/src/node/_tasks/rollup/index.d.ts.map +1 -0
- package/dist/types/src/node/_watchConfigFiles.d.ts +5 -0
- package/dist/types/src/node/_watchConfigFiles.d.ts.map +1 -0
- package/dist/types/src/node/_watchFiles.d.ts +7 -0
- package/dist/types/src/node/_watchFiles.d.ts.map +1 -0
- package/dist/types/src/node/build.d.ts +6 -0
- package/dist/types/src/node/build.d.ts.map +1 -0
- package/dist/types/src/node/check.d.ts +7 -0
- package/dist/types/src/node/check.d.ts.map +1 -0
- package/dist/{index.d.ts → types/src/node/index.d.ts} +12 -8
- package/dist/types/src/node/index.d.ts.map +1 -0
- package/dist/types/src/node/watch.d.ts +6 -0
- package/dist/types/src/node/watch.d.ts.map +1 -0
- package/package.json +16 -9
- package/src/node/_core/config/_loadConfig.ts +5 -0
- package/src/node/_core/pkg/_loadPkgWithReporting.ts +1 -1
- package/src/node/_resolveBuildTasks.ts +19 -17
- package/src/node/_resolveWatchTasks.ts +20 -18
- package/src/node/_tasks/dts/_buildTypes.ts +2 -25
- package/src/node/_tasks/dts/_doExtract.ts +32 -31
- package/src/node/_tasks/dts/_dtsTask.ts +4 -1
- package/src/node/_tasks/dts/_dtsWatchTask.ts +4 -1
- package/src/node/_tasks/dts/_types.ts +12 -8
- package/src/node/_tasks/rollup/_resolveRollupConfig.ts +56 -6
- package/src/node/build.ts +0 -1
- package/dist/__resolveBuildContext-49ce07ba.cjs.map +0 -1
- package/dist/_build-9e9eb450.cjs +0 -159
- package/dist/_build-9e9eb450.cjs.map +0 -1
- package/dist/_buildAction-38c3d2ed.cjs.map +0 -1
- package/dist/_check-4ce1387d.cjs.map +0 -1
- package/dist/_checkAction-2704266e.cjs.map +0 -1
- package/dist/_index-0e8b664d.cjs +0 -607
- package/dist/_index-0e8b664d.cjs.map +0 -1
- package/dist/_watch-fca55d1f.cjs +0 -219
- package/dist/_watch-fca55d1f.cjs.map +0 -1
- package/dist/_watchAction-df30594b.cjs.map +0 -1
- package/src/node/_resolveEsTarget.ts +0 -39
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ExtractorMessage, ExtractorResult } from '@microsoft/api-extractor';
|
|
2
|
+
import { PkgConfigOptions, _BuildFile } from '../../_core';
|
|
3
|
+
export declare function _extractTypes(options: {
|
|
4
|
+
cwd: string;
|
|
5
|
+
distPath: string;
|
|
6
|
+
exportPath: string;
|
|
7
|
+
filePath: string;
|
|
8
|
+
files: _BuildFile[];
|
|
9
|
+
projectPath: string;
|
|
10
|
+
rules?: NonNullable<PkgConfigOptions['extract']>['rules'];
|
|
11
|
+
sourcePath: string;
|
|
12
|
+
tsconfigPath: string;
|
|
13
|
+
}): Promise<{
|
|
14
|
+
extractorResult: ExtractorResult;
|
|
15
|
+
messages: ExtractorMessage[];
|
|
16
|
+
}>;
|
|
17
|
+
//# sourceMappingURL=_extractTypes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_extractTypes.d.ts","sourceRoot":"","sources":["../../../../../../src/node/_tasks/dts/_extractTypes.ts"],"names":[],"mappings":"AAEA,OAAO,EAIL,gBAAgB,EAChB,eAAe,EAEhB,MAAM,0BAA0B,CAAA;AAGjC,OAAO,EAAe,gBAAgB,EAAE,UAAU,EAAC,MAAM,aAAa,CAAA;AAWtE,wBAAsB,aAAa,CAAC,OAAO,EAAE;IAC3C,GAAG,EAAE,MAAM,CAAA;IACX,QAAQ,EAAE,MAAM,CAAA;IAChB,UAAU,EAAE,MAAM,CAAA;IAClB,QAAQ,EAAE,MAAM,CAAA;IAChB,KAAK,EAAE,UAAU,EAAE,CAAA;IACnB,WAAW,EAAE,MAAM,CAAA;IACnB,KAAK,CAAC,EAAE,WAAW,CAAC,gBAAgB,CAAC,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,CAAA;IACzD,UAAU,EAAE,MAAM,CAAA;IAClB,YAAY,EAAE,MAAM,CAAA;CACrB,GAAG,OAAO,CAAC;IAAC,eAAe,EAAE,eAAe,CAAC;IAAC,QAAQ,EAAE,gBAAgB,EAAE,CAAA;CAAC,CAAC,CAkI5E"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { ExtractorMessage } from '@microsoft/api-extractor';
|
|
2
|
+
/** @internal */
|
|
3
|
+
export interface _DtsWatchTask {
|
|
4
|
+
type: 'watch:dts';
|
|
5
|
+
entries: {
|
|
6
|
+
exportPath: string;
|
|
7
|
+
importId: string;
|
|
8
|
+
sourcePath: string;
|
|
9
|
+
targetPath: string;
|
|
10
|
+
}[];
|
|
11
|
+
}
|
|
12
|
+
/** @internal */
|
|
13
|
+
export interface _DtsTask {
|
|
14
|
+
type: 'build:dts';
|
|
15
|
+
entries: {
|
|
16
|
+
exportPath: string;
|
|
17
|
+
importId: string;
|
|
18
|
+
sourcePath: string;
|
|
19
|
+
targetPath: string;
|
|
20
|
+
}[];
|
|
21
|
+
}
|
|
22
|
+
/** @internal */
|
|
23
|
+
export interface _DtsResult {
|
|
24
|
+
type: 'dts';
|
|
25
|
+
messages: ExtractorMessage[];
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=_types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_types.d.ts","sourceRoot":"","sources":["../../../../../../src/node/_tasks/dts/_types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,gBAAgB,EAAC,MAAM,0BAA0B,CAAA;AAEzD,gBAAgB;AAChB,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,WAAW,CAAA;IACjB,OAAO,EAAE;QACP,UAAU,EAAE,MAAM,CAAA;QAClB,QAAQ,EAAE,MAAM,CAAA;QAChB,UAAU,EAAE,MAAM,CAAA;QAClB,UAAU,EAAE,MAAM,CAAA;KACnB,EAAE,CAAA;CACJ;AAED,gBAAgB;AAChB,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,WAAW,CAAA;IACjB,OAAO,EAAE;QACP,UAAU,EAAE,MAAM,CAAA;QAClB,QAAQ,EAAE,MAAM,CAAA;QAChB,UAAU,EAAE,MAAM,CAAA;QAClB,UAAU,EAAE,MAAM,CAAA;KACnB,EAAE,CAAA;CACJ;AAED,gBAAgB;AAChB,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,KAAK,CAAA;IACX,QAAQ,EAAE,gBAAgB,EAAE,CAAA;CAC7B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/node/_tasks/dts/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAA;AAC1B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,UAAU,CAAA"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { _BuildTaskHandlers, _WatchTaskHandlers } from './_types';
|
|
2
|
+
export * from './_types';
|
|
3
|
+
export * from './dts';
|
|
4
|
+
export * from './rollup';
|
|
5
|
+
/** @internal */
|
|
6
|
+
export declare const _buildTaskHandlers: _BuildTaskHandlers;
|
|
7
|
+
/** @internal */
|
|
8
|
+
export declare const _watchTaskHandlers: _WatchTaskHandlers;
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/node/_tasks/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,kBAAkB,EAAE,kBAAkB,EAAC,MAAM,UAAU,CAAA;AAI/D,cAAc,UAAU,CAAA;AACxB,cAAc,OAAO,CAAA;AACrB,cAAc,UAAU,CAAA;AAExB,gBAAgB;AAChB,eAAO,MAAM,kBAAkB,EAAE,kBAGhC,CAAA;AAED,gBAAgB;AAChB,eAAO,MAAM,kBAAkB,EAAE,kBAGhC,CAAA"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { InputOptions, OutputOptions } from 'rollup';
|
|
2
|
+
import { _BuildContext } from '../../_core';
|
|
3
|
+
import { _RollupTask, _RollupWatchTask } from '../_types';
|
|
4
|
+
export interface _RollupConfig {
|
|
5
|
+
inputOptions: InputOptions;
|
|
6
|
+
outputOptions: OutputOptions;
|
|
7
|
+
}
|
|
8
|
+
/** @internal */
|
|
9
|
+
export declare function _resolveRollupConfig(ctx: _BuildContext, buildTask: _RollupTask | _RollupWatchTask): _RollupConfig;
|
|
10
|
+
//# sourceMappingURL=_resolveRollupConfig.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_resolveRollupConfig.d.ts","sourceRoot":"","sources":["../../../../../../src/node/_tasks/rollup/_resolveRollupConfig.ts"],"names":[],"mappings":"AAOA,OAAO,EAAC,YAAY,EAAE,aAAa,EAAC,MAAM,QAAQ,CAAA;AAGlD,OAAO,EAAC,aAAa,EAAY,MAAM,aAAa,CAAA;AACpD,OAAO,EAAC,WAAW,EAAE,gBAAgB,EAAC,MAAM,WAAW,CAAA;AAEvD,MAAM,WAAW,aAAa;IAC5B,YAAY,EAAE,YAAY,CAAA;IAC1B,aAAa,EAAE,aAAa,CAAA;CAC7B;AAED,gBAAgB;AAChB,wBAAgB,oBAAoB,CAClC,GAAG,EAAE,aAAa,EAClB,SAAS,EAAE,WAAW,GAAG,gBAAgB,GACxC,aAAa,CAgKf"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_rollupTask.d.ts","sourceRoot":"","sources":["../../../../../../src/node/_tasks/rollup/_rollupTask.ts"],"names":[],"mappings":"AAOA,OAAO,EAAC,WAAW,EAAE,YAAY,EAAC,MAAM,WAAW,CAAA;AAGnD,gBAAgB;AAChB,eAAO,MAAM,WAAW,EAAE,YAAY,CAAC,WAAW,CAyBjD,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_rollupWatchTask.d.ts","sourceRoot":"","sources":["../../../../../../src/node/_tasks/rollup/_rollupWatchTask.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,kBAAkB,EAA2C,MAAM,QAAQ,CAAA;AAEnF,OAAO,EAAC,gBAAgB,EAAE,YAAY,EAAC,MAAM,WAAW,CAAA;AAGxD,gBAAgB;AAChB,eAAO,MAAM,gBAAgB,EAAE,YAAY,CAAC,gBAAgB,EAAE,kBAAkB,CAqE/E,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/node/_tasks/rollup/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAA;AAC7B,cAAc,oBAAoB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_watchConfigFiles.d.ts","sourceRoot":"","sources":["../../../../src/node/_watchConfigFiles.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,UAAU,EAAC,MAAM,MAAM,CAAA;AAK/B,wBAAsB,iBAAiB,CAAC,OAAO,EAAE;IAAC,GAAG,EAAE,MAAM,CAAA;CAAC,GAAG,OAAO,CAAC,UAAU,CAAC,MAAM,EAAE,CAAC,CAAC,CA4C7F"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Observable } from 'rxjs';
|
|
2
|
+
export interface _FileEvent {
|
|
3
|
+
type: 'add' | 'addDir' | 'change' | 'unlink' | 'unlinkDir';
|
|
4
|
+
file: string;
|
|
5
|
+
}
|
|
6
|
+
export declare function _watchFiles(patterns: string[]): Observable<_FileEvent>;
|
|
7
|
+
//# sourceMappingURL=_watchFiles.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_watchFiles.d.ts","sourceRoot":"","sources":["../../../../src/node/_watchFiles.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,UAAU,EAAC,MAAM,MAAM,CAAA;AAE/B,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,KAAK,GAAG,QAAQ,GAAG,QAAQ,GAAG,QAAQ,GAAG,WAAW,CAAA;IAC1D,IAAI,EAAE,MAAM,CAAA;CACb;AAED,wBAAgB,WAAW,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,UAAU,CAAC,UAAU,CAAC,CAoBtE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../../../../src/node/build.ts"],"names":[],"mappings":"AAMA,cAAc;AACd,wBAAsB,KAAK,CAAC,OAAO,EAAE;IAAC,GAAG,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAsCpF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"check.d.ts","sourceRoot":"","sources":["../../../../src/node/check.ts"],"names":[],"mappings":"AASA,cAAc;AACd,wBAAsB,KAAK,CAAC,OAAO,EAAE;IACnC,GAAG,EAAE,MAAM,CAAA;IACX,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB,GAAG,OAAO,CAAC,IAAI,CAAC,CAyHhB"}
|
|
@@ -73,10 +73,12 @@ export declare interface _DtsResult {
|
|
|
73
73
|
/** @internal */
|
|
74
74
|
export declare interface _DtsTask {
|
|
75
75
|
type: 'build:dts'
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
76
|
+
entries: {
|
|
77
|
+
exportPath: string
|
|
78
|
+
importId: string
|
|
79
|
+
sourcePath: string
|
|
80
|
+
targetPath: string
|
|
81
|
+
}[]
|
|
80
82
|
}
|
|
81
83
|
|
|
82
84
|
/** @internal */
|
|
@@ -85,10 +87,12 @@ export declare const _dtsTask: _TaskHandler<_DtsTask, _DtsResult>
|
|
|
85
87
|
/** @internal */
|
|
86
88
|
export declare interface _DtsWatchTask {
|
|
87
89
|
type: 'watch:dts'
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
90
|
+
entries: {
|
|
91
|
+
exportPath: string
|
|
92
|
+
importId: string
|
|
93
|
+
sourcePath: string
|
|
94
|
+
targetPath: string
|
|
95
|
+
}[]
|
|
92
96
|
}
|
|
93
97
|
|
|
94
98
|
/** @internal */
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/node/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAA;AACvB,cAAc,sBAAsB,CAAA;AACpC,cAAc,UAAU,CAAA;AACxB,cAAc,SAAS,CAAA;AACvB,cAAc,SAAS,CAAA;AACvB,cAAc,SAAS,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"watch.d.ts","sourceRoot":"","sources":["../../../../src/node/watch.ts"],"names":[],"mappings":"AAQA,cAAc;AACd,wBAAsB,KAAK,CAAC,OAAO,EAAE;IAAC,GAAG,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CA8CpF"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sanity/pkg-utils",
|
|
3
|
-
"version": "1.7.
|
|
3
|
+
"version": "1.7.3",
|
|
4
4
|
"author": "Sanity.io <hello@sanity.io>",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"description": "Simple utilities for modern npm packages.",
|
|
@@ -16,10 +16,10 @@
|
|
|
16
16
|
"source": "./src/node/index.ts",
|
|
17
17
|
"main": "./dist/index.cjs",
|
|
18
18
|
"module": "./dist/index.js",
|
|
19
|
-
"types": "./dist/index.d.ts",
|
|
19
|
+
"types": "./dist/types/src/node/index.d.ts",
|
|
20
20
|
"exports": {
|
|
21
21
|
".": {
|
|
22
|
-
"types": "./dist/index.d.ts",
|
|
22
|
+
"types": "./dist/types/src/node/index.d.ts",
|
|
23
23
|
"source": "./src/node/index.ts",
|
|
24
24
|
"import": "./dist/index.js",
|
|
25
25
|
"require": "./dist/index.cjs",
|
|
@@ -36,13 +36,15 @@
|
|
|
36
36
|
"dist"
|
|
37
37
|
],
|
|
38
38
|
"scripts": {
|
|
39
|
-
"build": "node -r esbuild-register scripts/build
|
|
39
|
+
"build": "node -r esbuild-register scripts/build",
|
|
40
40
|
"check:package": "node -r esbuild-register scripts/check",
|
|
41
|
+
"clean": "rimraf dist test/env/__tmp__",
|
|
41
42
|
"commit": "cz",
|
|
42
43
|
"extract": "sanity-tsdoc etl --outDir etc/api/@sanity/pkg-utils --tsconfig tsconfig.dist.json",
|
|
43
44
|
"format": "prettier --write --cache --ignore-unknown .",
|
|
44
45
|
"lint": "eslint . --ext .cjs,.js,.ts",
|
|
45
|
-
"
|
|
46
|
+
"postbuild": "pnpm run check:package",
|
|
47
|
+
"prebuild": "pnpm run clean",
|
|
46
48
|
"prepublishOnly": "pnpm run build",
|
|
47
49
|
"release": "semantic-release",
|
|
48
50
|
"test": "vitest run",
|
|
@@ -50,9 +52,13 @@
|
|
|
50
52
|
"watch": "node -r esbuild-register scripts/watch"
|
|
51
53
|
},
|
|
52
54
|
"dependencies": {
|
|
55
|
+
"@babel/core": "^7.19.0",
|
|
56
|
+
"@babel/plugin-proposal-object-rest-spread": "^7.18.9",
|
|
57
|
+
"@babel/preset-env": "^7.19.0",
|
|
53
58
|
"@microsoft/api-extractor": "^7.29.5",
|
|
54
59
|
"@microsoft/tsdoc-config": "^0.16.1",
|
|
55
60
|
"@rollup/plugin-alias": "^3.1.9",
|
|
61
|
+
"@rollup/plugin-babel": "^5.3.1",
|
|
56
62
|
"@rollup/plugin-commonjs": "^22.0.2",
|
|
57
63
|
"@rollup/plugin-json": "^4.1.0",
|
|
58
64
|
"@rollup/plugin-node-resolve": "^13.3.0",
|
|
@@ -70,26 +76,27 @@
|
|
|
70
76
|
"pkg-up": "^3.1.0",
|
|
71
77
|
"prettier": "^2.7.1",
|
|
72
78
|
"pretty-bytes": "^5.6.0",
|
|
73
|
-
"rimraf": "^3.0.2",
|
|
74
79
|
"rollup": "^2.78.1",
|
|
75
80
|
"rollup-plugin-esbuild": "^4.9.3",
|
|
81
|
+
"rollup-plugin-terser": "^7.0.2",
|
|
76
82
|
"rxjs": "^7.5.6",
|
|
77
83
|
"treeify": "^1.1.0",
|
|
84
|
+
"uuid": "^9.0.0",
|
|
78
85
|
"zod": "^3.18.0"
|
|
79
86
|
},
|
|
80
87
|
"devDependencies": {
|
|
81
88
|
"@commitlint/cli": "^17.0.3",
|
|
82
89
|
"@commitlint/config-conventional": "^17.0.3",
|
|
83
90
|
"@sanity/semantic-release-preset": "^2.0.0",
|
|
91
|
+
"@types/babel__core": "^7.1.19",
|
|
84
92
|
"@types/cpx": "^1.5.2",
|
|
85
93
|
"@types/find-config": "^1.0.1",
|
|
86
|
-
"@types/globby": "^9.1.0",
|
|
87
94
|
"@types/mkdirp": "^1.0.2",
|
|
88
95
|
"@types/node": "^18.7.13",
|
|
89
96
|
"@types/prettier": "^2.7.0",
|
|
90
97
|
"@types/rimraf": "^3.0.2",
|
|
91
|
-
"@types/tmp": "^0.2.3",
|
|
92
98
|
"@types/treeify": "^1.0.0",
|
|
99
|
+
"@types/uuid": "^8.3.4",
|
|
93
100
|
"@typescript-eslint/eslint-plugin": "^5.35.1",
|
|
94
101
|
"@typescript-eslint/parser": "^5.35.1",
|
|
95
102
|
"commitizen": "^4.2.5",
|
|
@@ -101,8 +108,8 @@
|
|
|
101
108
|
"eslint-plugin-prettier": "^4.2.1",
|
|
102
109
|
"husky": "^8.0.1",
|
|
103
110
|
"lint-staged": "^12.5.0",
|
|
111
|
+
"rimraf": "^3.0.2",
|
|
104
112
|
"semantic-release": "^19.0.5",
|
|
105
|
-
"tmp": "^0.2.1",
|
|
106
113
|
"ts-node": "^10.9.1",
|
|
107
114
|
"typescript": "^4.7.4",
|
|
108
115
|
"vitest": "^0.22.1"
|
|
@@ -20,6 +20,11 @@ export async function _loadConfig(options: {cwd: string}): Promise<PkgConfigOpti
|
|
|
20
20
|
return undefined
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
+
// Do not accept config files outside of the root
|
|
24
|
+
if (!configFile.path.startsWith(cwd)) {
|
|
25
|
+
return undefined
|
|
26
|
+
}
|
|
27
|
+
|
|
23
28
|
try {
|
|
24
29
|
const {unregister} = configFile.transform
|
|
25
30
|
? register({extensions: ['.js', '.ts']})
|
|
@@ -15,7 +15,7 @@ export async function _loadPkgWithReporting(options: {cwd: string}): Promise<_Pa
|
|
|
15
15
|
if (issue.code === 'invalid_type') {
|
|
16
16
|
console.log(
|
|
17
17
|
`${chalk.red('invalid type')} in ./package.json at ${chalk.magenta(
|
|
18
|
-
`\`${issue.path.join('')}\``
|
|
18
|
+
`\`${issue.path.join('.')}\``
|
|
19
19
|
)} (expected ${issue.expected}, received ${issue.received})`
|
|
20
20
|
)
|
|
21
21
|
}
|
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
import fs from 'fs'
|
|
2
2
|
import path from 'path'
|
|
3
3
|
import {PkgExport, PkgFormat, PkgRuntime, _BuildContext} from './_core'
|
|
4
|
-
import {_resolveEsTarget} from './_resolveEsTarget'
|
|
5
4
|
import {_BuildTask, _DtsTask, _RollupTask, _RollupTaskEntry} from './_tasks'
|
|
6
5
|
|
|
7
6
|
/** @internal */
|
|
8
7
|
export function _resolveBuildTasks(ctx: _BuildContext): _BuildTask[] {
|
|
9
8
|
const {cwd, pkg, target} = ctx
|
|
10
|
-
const esTarget = _resolveEsTarget(ctx)
|
|
11
9
|
|
|
12
10
|
const tasks: _BuildTask[] = []
|
|
13
11
|
|
|
@@ -15,23 +13,27 @@ export function _resolveBuildTasks(ctx: _BuildContext): _BuildTask[] {
|
|
|
15
13
|
([_path, exp]) => ({_path, ...exp} as PkgExport & {_path: string})
|
|
16
14
|
)
|
|
17
15
|
|
|
18
|
-
const
|
|
16
|
+
const dtsTask: _DtsTask = {
|
|
17
|
+
type: 'build:dts',
|
|
18
|
+
entries: [],
|
|
19
|
+
}
|
|
20
|
+
|
|
19
21
|
const rollupTasks: Record<string, _RollupTask> = {}
|
|
20
22
|
|
|
21
23
|
function _addRollupTaskEntry(format: PkgFormat, runtime: PkgRuntime, entry: _RollupTaskEntry) {
|
|
22
24
|
const buildId = `${format}:${runtime}`
|
|
23
25
|
|
|
24
|
-
if (
|
|
26
|
+
if (rollupTasks[buildId]) {
|
|
27
|
+
rollupTasks[buildId].entries.push(entry)
|
|
28
|
+
} else {
|
|
25
29
|
rollupTasks[buildId] = {
|
|
26
30
|
type: 'build:js',
|
|
27
31
|
buildId,
|
|
28
32
|
entries: [entry],
|
|
29
33
|
runtime,
|
|
30
34
|
format,
|
|
31
|
-
target:
|
|
35
|
+
target: target[runtime],
|
|
32
36
|
}
|
|
33
|
-
} else {
|
|
34
|
-
rollupTasks[buildId].entries.push(entry)
|
|
35
37
|
}
|
|
36
38
|
}
|
|
37
39
|
|
|
@@ -40,15 +42,12 @@ export function _resolveBuildTasks(ctx: _BuildContext): _BuildTask[] {
|
|
|
40
42
|
const importId = path.join(pkg.name, exp._path)
|
|
41
43
|
|
|
42
44
|
if (exp.types) {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
targetPath: exp.types,
|
|
50
|
-
}
|
|
51
|
-
}
|
|
45
|
+
dtsTask.entries.push({
|
|
46
|
+
importId,
|
|
47
|
+
exportPath: exp._path,
|
|
48
|
+
sourcePath: exp.source,
|
|
49
|
+
targetPath: exp.types,
|
|
50
|
+
})
|
|
52
51
|
}
|
|
53
52
|
}
|
|
54
53
|
|
|
@@ -104,7 +103,10 @@ export function _resolveBuildTasks(ctx: _BuildContext): _BuildTask[] {
|
|
|
104
103
|
})
|
|
105
104
|
}
|
|
106
105
|
|
|
107
|
-
|
|
106
|
+
if (dtsTask.entries.length) {
|
|
107
|
+
tasks.push(dtsTask)
|
|
108
|
+
}
|
|
109
|
+
|
|
108
110
|
tasks.push(...Object.values(rollupTasks))
|
|
109
111
|
|
|
110
112
|
// Parse rollup:esm:browser tasks
|
|
@@ -1,36 +1,38 @@
|
|
|
1
1
|
import fs from 'fs'
|
|
2
2
|
import path from 'path'
|
|
3
3
|
import {PkgExport, PkgFormat, PkgRuntime, _BuildContext} from './_core'
|
|
4
|
-
import {_resolveEsTarget} from './_resolveEsTarget'
|
|
5
4
|
import {_WatchTask, _DtsWatchTask, _RollupWatchTask, _RollupTaskEntry} from './_tasks'
|
|
6
5
|
|
|
7
6
|
/** @internal */
|
|
8
7
|
export function _resolveWatchTasks(ctx: _BuildContext): _WatchTask[] {
|
|
9
8
|
const {cwd, pkg, target} = ctx
|
|
10
|
-
const esTarget = _resolveEsTarget(ctx)
|
|
11
9
|
const tasks: _WatchTask[] = []
|
|
12
10
|
|
|
13
11
|
const exports = Object.entries(ctx.exports || {}).map(
|
|
14
12
|
([_path, exp]) => ({_path, ...exp} as PkgExport & {_path: string})
|
|
15
13
|
)
|
|
16
14
|
|
|
17
|
-
const
|
|
15
|
+
const dtsTask: _DtsWatchTask = {
|
|
16
|
+
type: 'watch:dts',
|
|
17
|
+
entries: [],
|
|
18
|
+
}
|
|
19
|
+
|
|
18
20
|
const rollupTasks: Record<string, _RollupWatchTask> = {}
|
|
19
21
|
|
|
20
22
|
function _addRollupTaskEntry(format: PkgFormat, runtime: PkgRuntime, entry: _RollupTaskEntry) {
|
|
21
23
|
const buildId = `${format}:${runtime}`
|
|
22
24
|
|
|
23
|
-
if (
|
|
25
|
+
if (rollupTasks[buildId]) {
|
|
26
|
+
rollupTasks[buildId].entries.push(entry)
|
|
27
|
+
} else {
|
|
24
28
|
rollupTasks[buildId] = {
|
|
25
29
|
type: 'watch:js',
|
|
26
30
|
buildId,
|
|
27
31
|
entries: [entry],
|
|
28
32
|
runtime,
|
|
29
33
|
format,
|
|
30
|
-
target:
|
|
34
|
+
target: target[runtime],
|
|
31
35
|
}
|
|
32
|
-
} else {
|
|
33
|
-
rollupTasks[buildId].entries.push(entry)
|
|
34
36
|
}
|
|
35
37
|
}
|
|
36
38
|
|
|
@@ -39,15 +41,12 @@ export function _resolveWatchTasks(ctx: _BuildContext): _WatchTask[] {
|
|
|
39
41
|
const importId = path.join(pkg.name, exp._path)
|
|
40
42
|
|
|
41
43
|
if (exp.types) {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
targetPath: exp.types,
|
|
49
|
-
}
|
|
50
|
-
}
|
|
44
|
+
dtsTask.entries.push({
|
|
45
|
+
importId,
|
|
46
|
+
exportPath: exp._path,
|
|
47
|
+
sourcePath: exp.source,
|
|
48
|
+
targetPath: exp.types,
|
|
49
|
+
})
|
|
51
50
|
}
|
|
52
51
|
}
|
|
53
52
|
|
|
@@ -103,7 +102,10 @@ export function _resolveWatchTasks(ctx: _BuildContext): _WatchTask[] {
|
|
|
103
102
|
})
|
|
104
103
|
}
|
|
105
104
|
|
|
106
|
-
|
|
105
|
+
if (dtsTask.entries.length) {
|
|
106
|
+
tasks.push(dtsTask)
|
|
107
|
+
}
|
|
108
|
+
|
|
107
109
|
tasks.push(...Object.values(rollupTasks))
|
|
108
110
|
|
|
109
111
|
// Parse rollup:esm:browser tasks
|
|
@@ -117,7 +119,7 @@ export function _resolveWatchTasks(ctx: _BuildContext): _WatchTask[] {
|
|
|
117
119
|
[
|
|
118
120
|
`// AUTO-GENERATED – DO NOT EDIT`,
|
|
119
121
|
``,
|
|
120
|
-
`export {default} from '${relativeTargetPath}'`,
|
|
122
|
+
// `export {default} from '${relativeTargetPath}'`,
|
|
121
123
|
`export * from '${relativeTargetPath}'`,
|
|
122
124
|
``,
|
|
123
125
|
].join('\n')
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
/* eslint-disable no-console */
|
|
2
2
|
|
|
3
|
-
import path from 'path'
|
|
4
3
|
import ts from 'typescript'
|
|
5
4
|
|
|
6
5
|
export const formatHost: ts.FormatDiagnosticsHost = {
|
|
@@ -13,10 +12,9 @@ export const formatHost: ts.FormatDiagnosticsHost = {
|
|
|
13
12
|
export async function _buildTypes(options: {
|
|
14
13
|
cwd: string
|
|
15
14
|
outDir: string
|
|
16
|
-
sourcePath: string
|
|
17
15
|
tsconfig: ts.ParsedCommandLine
|
|
18
|
-
}): Promise<
|
|
19
|
-
const {
|
|
16
|
+
}): Promise<void> {
|
|
17
|
+
const {outDir, tsconfig} = options
|
|
20
18
|
|
|
21
19
|
const compilerOptions: ts.CompilerOptions = {
|
|
22
20
|
...tsconfig.options,
|
|
@@ -27,23 +25,8 @@ export async function _buildTypes(options: {
|
|
|
27
25
|
outDir,
|
|
28
26
|
}
|
|
29
27
|
|
|
30
|
-
const rootDir =
|
|
31
|
-
path.relative(
|
|
32
|
-
cwd,
|
|
33
|
-
compilerOptions.rootDir
|
|
34
|
-
? path.resolve(cwd, compilerOptions.rootDir)
|
|
35
|
-
: path.dirname(path.resolve(cwd, sourcePath))
|
|
36
|
-
) || '.'
|
|
37
|
-
|
|
38
28
|
const program = ts.createProgram(tsconfig.fileNames, compilerOptions)
|
|
39
29
|
|
|
40
|
-
const sourceFiles = program.getSourceFiles()
|
|
41
|
-
const sourceFile = sourceFiles.find((f) => f.fileName === path.resolve(cwd, sourcePath))
|
|
42
|
-
|
|
43
|
-
if (!sourceFile) {
|
|
44
|
-
throw new Error(`source file not found: ${sourcePath}`)
|
|
45
|
-
}
|
|
46
|
-
|
|
47
30
|
const emitResult = program.emit()
|
|
48
31
|
|
|
49
32
|
const allDiagnostics = ts.getPreEmitDiagnostics(program).concat(emitResult.diagnostics)
|
|
@@ -68,10 +51,4 @@ export async function _buildTypes(options: {
|
|
|
68
51
|
throw new Error('failed to compile')
|
|
69
52
|
}
|
|
70
53
|
}
|
|
71
|
-
|
|
72
|
-
const typesPath = path
|
|
73
|
-
.resolve(outDir, path.relative(rootDir, path.resolve(cwd, sourcePath)))
|
|
74
|
-
.replace(/\.[jt]sx?$/, '.d.ts')
|
|
75
|
-
|
|
76
|
-
return {path: typesPath}
|
|
77
54
|
}
|
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
import path from 'path'
|
|
2
|
-
import {
|
|
3
|
-
import rimrafCallback from 'rimraf'
|
|
2
|
+
import {ExtractorMessage} from '@microsoft/api-extractor'
|
|
4
3
|
import {_BuildContext} from '../../_core'
|
|
5
4
|
import {_buildTypes} from './_buildTypes'
|
|
6
5
|
import {_DtsError} from './_DtsError'
|
|
7
6
|
import {_extractTypes} from './_extractTypes'
|
|
8
7
|
import {_DtsResult, _DtsTask, _DtsWatchTask} from './_types'
|
|
9
8
|
|
|
10
|
-
const rimraf = promisify(rimrafCallback)
|
|
11
|
-
|
|
12
9
|
export async function _doExtract(
|
|
13
10
|
ctx: _BuildContext,
|
|
14
11
|
task: _DtsTask | _DtsWatchTask
|
|
@@ -17,40 +14,44 @@ export async function _doExtract(
|
|
|
17
14
|
|
|
18
15
|
if (!ts.config || !ts.configPath) return {type: 'dts', messages: []}
|
|
19
16
|
|
|
20
|
-
const sourcePath = task.sourcePath
|
|
21
|
-
const exportPath = task.exportPath === '.' ? './index' : task.exportPath
|
|
22
17
|
const distPath = path.resolve(cwd, dist)
|
|
23
|
-
const filePath = path.relative(distPath, path.resolve(cwd, task.targetPath))
|
|
24
18
|
|
|
25
|
-
const
|
|
26
|
-
const tmpDir = {
|
|
27
|
-
path: tmpDirPath,
|
|
28
|
-
removeCallback: () => rimraf(tmpDirPath),
|
|
29
|
-
}
|
|
19
|
+
const {outDir = distPath, rootDir = cwd} = ts.config.options
|
|
30
20
|
|
|
31
|
-
|
|
21
|
+
await _buildTypes({
|
|
32
22
|
cwd,
|
|
33
|
-
outDir:
|
|
34
|
-
sourcePath,
|
|
23
|
+
outDir: outDir,
|
|
35
24
|
tsconfig: ts.config,
|
|
36
25
|
})
|
|
37
26
|
|
|
38
|
-
const
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
27
|
+
const messages: ExtractorMessage[] = []
|
|
28
|
+
|
|
29
|
+
for (const entry of task.entries) {
|
|
30
|
+
const exportPath = entry.exportPath === '.' ? './index' : entry.exportPath
|
|
31
|
+
|
|
32
|
+
const filePath = path.relative(distPath, path.resolve(cwd, entry.targetPath))
|
|
33
|
+
|
|
34
|
+
const result = await _extractTypes({
|
|
35
|
+
cwd,
|
|
36
|
+
exportPath,
|
|
37
|
+
files,
|
|
38
|
+
filePath,
|
|
39
|
+
projectPath: cwd,
|
|
40
|
+
rules: config?.extract?.rules,
|
|
41
|
+
sourcePath: path.resolve(
|
|
42
|
+
outDir,
|
|
43
|
+
path.relative(cwd, rootDir),
|
|
44
|
+
entry.sourcePath.replace(/\.ts$/, '.d.ts')
|
|
45
|
+
),
|
|
46
|
+
tsconfigPath: path.resolve(cwd, ts.configPath),
|
|
47
|
+
distPath,
|
|
48
|
+
})
|
|
49
|
+
|
|
50
|
+
messages.push(...result.messages)
|
|
51
|
+
|
|
52
|
+
if (result.messages.some((msg) => msg.logLevel === 'error')) {
|
|
53
|
+
throw new _DtsError('encountered errors when extracting types', result.messages)
|
|
54
|
+
}
|
|
54
55
|
}
|
|
55
56
|
|
|
56
57
|
return {type: 'dts', messages}
|