@sanity/pkg-utils 1.8.2 → 1.9.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/{_build-be4da439.cjs → _build-526356ff.cjs} +11 -8
- package/dist/_build-526356ff.cjs.map +1 -0
- package/dist/{_buildAction-db8d7aa0.cjs → _buildAction-c4426eb4.cjs} +3 -5
- package/dist/{_buildAction-db8d7aa0.cjs.map → _buildAction-c4426eb4.cjs.map} +1 -1
- package/dist/{_check-11811a4d.cjs → _check-069b0db0.cjs} +51 -22
- package/dist/_check-069b0db0.cjs.map +1 -0
- package/dist/{_checkAction-386fe8d4.cjs → _checkAction-d3a8b220.cjs} +4 -4
- package/dist/{_checkAction-386fe8d4.cjs.map → _checkAction-d3a8b220.cjs.map} +1 -1
- package/dist/{_index-066890ec.cjs → _index-bc62cfaa.cjs} +31 -38
- package/dist/_index-bc62cfaa.cjs.map +1 -0
- package/dist/{_watch-feff6936.cjs → _watch-91ef3209.cjs} +11 -8
- package/dist/_watch-91ef3209.cjs.map +1 -0
- package/dist/{_watchAction-453b8884.cjs → _watchAction-10ee08fc.cjs} +3 -5
- package/dist/{_watchAction-453b8884.cjs.map → _watchAction-10ee08fc.cjs.map} +1 -1
- package/dist/cli.cjs +4 -4
- package/dist/index.cjs +6 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +91 -60
- package/dist/index.js.map +1 -1
- package/dist/types/src/node/index.d.ts +4 -0
- package/package.json +15 -13
- package/src/node/_core/config/types.ts +4 -0
- package/src/node/_printPackageTree.ts +31 -6
- package/src/node/_resolveBuildTasks.ts +22 -17
- package/src/node/_resolveWatchTasks.ts +22 -17
- package/src/node/_tasks/dts/_buildTypes.ts +1 -0
- package/src/node/_tasks/dts/_createApiExtractorConfig.ts +13 -5
- package/src/node/_tasks/dts/_doExtract.ts +24 -35
- package/src/node/_tasks/dts/_extractTypes.ts +4 -4
- package/src/node/check.ts +16 -15
- package/src/node/watch.ts +1 -1
- package/dist/_build-be4da439.cjs.map +0 -1
- package/dist/_check-11811a4d.cjs.map +0 -1
- package/dist/_index-066890ec.cjs.map +0 -1
- package/dist/_watch-feff6936.cjs.map +0 -1
|
@@ -20,7 +20,7 @@ require('typescript');
|
|
|
20
20
|
|
|
21
21
|
var fs = require('fs');
|
|
22
22
|
|
|
23
|
-
var index = require('./_index-
|
|
23
|
+
var index = require('./_index-bc62cfaa.cjs');
|
|
24
24
|
|
|
25
25
|
require('esbuild-register/dist/node');
|
|
26
26
|
|
|
@@ -56,6 +56,7 @@ function _resolveWatchTasks(ctx) {
|
|
|
56
56
|
var _a, _b, _c, _d, _e;
|
|
57
57
|
|
|
58
58
|
const {
|
|
59
|
+
config,
|
|
59
60
|
cwd,
|
|
60
61
|
pkg,
|
|
61
62
|
target
|
|
@@ -153,13 +154,15 @@ function _resolveWatchTasks(ctx) {
|
|
|
153
154
|
|
|
154
155
|
tasks.push(...Object.values(rollupTasks));
|
|
155
156
|
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
157
|
+
if (config == null ? void 0 : config.legacyExports) {
|
|
158
|
+
for (const exp of exports) {
|
|
159
|
+
if (exp._exported && exp._path !== ".") {
|
|
160
|
+
const relativeTargetPath = (((_e = exp.browser) == null ? void 0 : _e.import) || exp.import || "").replace(/\.[^/.]+$/, "");
|
|
161
|
+
const ext = index._MODULE_EXT[pkg.type].esm;
|
|
160
162
|
|
|
161
|
-
|
|
162
|
-
|
|
163
|
+
if (relativeTargetPath) {
|
|
164
|
+
fs__default["default"].writeFileSync(path__default["default"].resolve(cwd, "".concat(exp._path, ".js")), ["// AUTO-GENERATED \u2013 DO NOT EDIT", "", "export * from '".concat(relativeTargetPath).concat(pkg.type === "commonjs" ? ext : "", "'"), ""].join("\n"));
|
|
165
|
+
}
|
|
163
166
|
}
|
|
164
167
|
}
|
|
165
168
|
}
|
|
@@ -275,4 +278,4 @@ async function watch(options) {
|
|
|
275
278
|
}
|
|
276
279
|
|
|
277
280
|
exports.watch = watch;
|
|
278
|
-
//# sourceMappingURL=_watch-
|
|
281
|
+
//# sourceMappingURL=_watch-91ef3209.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_watch-91ef3209.cjs","sources":["../src/node/_resolveWatchTasks.ts","../src/node/_globFiles.ts","../src/node/_watchFiles.ts","../src/node/_watchConfigFiles.ts","../src/node/watch.ts"],"sourcesContent":["import fs from 'fs'\nimport path from 'path'\nimport {PkgExport, PkgFormat, PkgRuntime, _BuildContext, _MODULE_EXT} from './_core'\nimport {_WatchTask, _DtsWatchTask, _RollupWatchTask, _RollupTaskEntry} from './_tasks'\n\n/** @internal */\nexport function _resolveWatchTasks(ctx: _BuildContext): _WatchTask[] {\n const {config, cwd, pkg, target} = ctx\n const tasks: _WatchTask[] = []\n\n const exports = Object.entries(ctx.exports || {}).map(\n ([_path, exp]) => ({_path, ...exp} as PkgExport & {_path: string})\n )\n\n const dtsTask: _DtsWatchTask = {\n type: 'watch:dts',\n entries: [],\n }\n\n const rollupTasks: Record<string, _RollupWatchTask> = {}\n\n function _addRollupTaskEntry(format: PkgFormat, runtime: PkgRuntime, entry: _RollupTaskEntry) {\n const buildId = `${format}:${runtime}`\n\n if (rollupTasks[buildId]) {\n rollupTasks[buildId].entries.push(entry)\n } else {\n rollupTasks[buildId] = {\n type: 'watch:js',\n buildId,\n entries: [entry],\n runtime,\n format,\n target: target[runtime],\n }\n }\n }\n\n // Parse `dts` tasks\n for (const exp of exports) {\n const importId = path.join(pkg.name, exp._path)\n\n if (exp.types) {\n dtsTask.entries.push({\n importId,\n exportPath: exp._path,\n sourcePath: exp.source,\n targetPath: exp.types,\n })\n }\n }\n\n // Parse rollup:commonjs:* tasks\n for (const exp of exports) {\n const output = exp.require\n\n if (!output) continue\n\n _addRollupTaskEntry('commonjs', ctx.runtime, {\n path: exp._path,\n source: exp.source,\n output,\n })\n }\n\n // Parse rollup:commonjs:browser tasks\n for (const exp of exports) {\n const output = exp.browser?.require\n\n if (!output) continue\n\n _addRollupTaskEntry('commonjs', 'browser', {\n path: exp._path,\n source: exp.browser?.source || exp.source,\n output,\n })\n }\n\n // Parse rollup:esm:* tasks\n for (const exp of exports) {\n const output = exp.import\n\n if (!output) continue\n\n _addRollupTaskEntry('esm', ctx.runtime, {\n path: exp._path,\n source: exp.source,\n output,\n })\n }\n\n // Parse rollup:esm:browser tasks\n for (const exp of exports) {\n const output = exp.browser?.import\n\n if (!output) continue\n\n _addRollupTaskEntry('esm', 'browser', {\n path: exp._path,\n source: exp.browser?.source || exp.source,\n output,\n })\n }\n\n if (dtsTask.entries.length) {\n tasks.push(dtsTask)\n }\n\n tasks.push(...Object.values(rollupTasks))\n\n // Write legacy exports files\n if (config?.legacyExports) {\n for (const exp of exports) {\n if (exp._exported && exp._path !== '.') {\n const relativeTargetPath = (exp.browser?.import || exp.import || '').replace(\n /\\.[^/.]+$/,\n ''\n )\n const ext = _MODULE_EXT[pkg.type].esm\n\n if (relativeTargetPath) {\n fs.writeFileSync(\n path.resolve(cwd, `${exp._path}.js`),\n [\n `// AUTO-GENERATED – DO NOT EDIT`,\n ``,\n // `export {default} from '${relativeTargetPath}'`,\n `export * from '${relativeTargetPath}${pkg.type === 'commonjs' ? ext : ''}'`,\n ``,\n ].join('\\n')\n )\n }\n }\n }\n }\n\n return tasks\n}\n","import globby from 'globby'\n\nexport function _globFiles(patterns: string[]): Promise<string[]> {\n return globby(patterns)\n}\n","import chokidar from 'chokidar'\nimport {Observable} from 'rxjs'\n\nexport interface _FileEvent {\n type: 'add' | 'addDir' | 'change' | 'unlink' | 'unlinkDir'\n file: string\n}\n\nexport function _watchFiles(patterns: string[]): Observable<_FileEvent> {\n return new Observable((observer) => {\n const watcher = chokidar.watch(patterns, {\n ignoreInitial: true,\n })\n\n function _handleFileEvent(\n type: 'add' | 'addDir' | 'change' | 'unlink' | 'unlinkDir',\n file: string\n ) {\n observer.next({type, file})\n }\n\n watcher.on('all', _handleFileEvent)\n\n return () => {\n watcher.off('all', _handleFileEvent)\n watcher.close()\n }\n })\n}\n","import path from 'path'\nimport chalk from 'chalk'\nimport {Observable} from 'rxjs'\nimport {distinctUntilChanged, scan, startWith} from 'rxjs/operators'\nimport {_globFiles} from './_globFiles'\nimport {_watchFiles} from './_watchFiles'\n\nexport async function _watchConfigFiles(options: {cwd: string}): Promise<Observable<string[]>> {\n const {cwd} = options\n\n const initialFiles = await _globFiles([\n path.resolve(cwd, 'package.json'),\n path.resolve(cwd, 'package.config.cjs'),\n path.resolve(cwd, 'package.config.js'),\n path.resolve(cwd, 'package.config.ts'),\n ])\n\n const fileEvent$ = _watchFiles([\n path.resolve(cwd, 'package.json'),\n path.resolve(cwd, 'package.config.cjs'),\n path.resolve(cwd, 'package.config.js'),\n path.resolve(cwd, 'package.config.ts'),\n ])\n\n return fileEvent$.pipe(\n scan((files, fileEvent) => {\n if (fileEvent.type === 'add') {\n return files.concat(fileEvent.file)\n }\n\n if (fileEvent.type === 'unlink') {\n return files.filter((f) => f !== fileEvent.file)\n }\n\n if (fileEvent.type === 'change') {\n /* eslint-disable no-console */\n console.log(\n '--------------------------------------------------------------------------------'\n )\n console.log(chalk.blue('info '), path.relative(cwd, fileEvent.file), 'changed')\n console.log('')\n /* eslint-enable no-console */\n\n return files.slice(0) // trigger update\n }\n\n return files\n }, initialFiles),\n startWith(initialFiles),\n distinctUntilChanged()\n )\n}\n","import path from 'path'\nimport {switchMap} from 'rxjs'\nimport {_loadConfig, _loadPkgWithReporting} from './_core'\nimport {_resolveBuildContext} from './_resolveBuildContext'\nimport {_resolveWatchTasks} from './_resolveWatchTasks'\nimport {_WatchTask, _TaskHandler, _watchTaskHandlers} from './_tasks'\nimport {_watchConfigFiles} from './_watchConfigFiles'\n\n/** @public */\nexport async function watch(options: {cwd: string; tsconfig?: string}): Promise<void> {\n const {cwd, tsconfig = 'tsconfig.json'} = options\n\n const configFiles$ = await _watchConfigFiles({cwd})\n\n const ctx$ = configFiles$.pipe(\n switchMap(async (configFiles) => {\n const _files = configFiles.map((f) => path.relative(cwd, f))\n\n const packageJsonPath = _files.find((f) => f === 'package.json')\n\n if (!packageJsonPath) {\n throw new Error('missing package.json')\n }\n\n const pkg = await _loadPkgWithReporting({cwd})\n const config = await _loadConfig({cwd})\n\n return _resolveBuildContext({config, cwd, pkg, tsconfig})\n })\n )\n\n ctx$.subscribe(async (ctx) => {\n const watchTasks = _resolveWatchTasks(ctx)\n\n for (const task of watchTasks) {\n const handler = _watchTaskHandlers[task.type] as _TaskHandler<_WatchTask, unknown>\n const result$ = handler.exec(ctx, task)\n\n result$.subscribe({\n error: (err) => {\n ctx.logger.error(err)\n ctx.logger.log()\n\n process.exit(1)\n },\n next: (result) => {\n handler.complete(ctx, task, result)\n },\n complete: () => {\n ctx.logger.success(handler.name(ctx, task))\n ctx.logger.log()\n },\n })\n }\n })\n}\n"],"names":["_resolveWatchTasks","ctx","_a","_b","_c","_d","_e","config","cwd","pkg","target","tasks","exports","Object","entries","map","_path","exp","dtsTask","type","rollupTasks","_addRollupTaskEntry","format","runtime","entry","buildId","push","importId","path","join","name","types","exportPath","sourcePath","source","targetPath","output","require","browser","import","length","values","legacyExports","_exported","relativeTargetPath","replace","ext","_MODULE_EXT","esm","fs","writeFileSync","resolve","_globFiles","patterns","globby","_watchFiles","Observable","observer","watcher","chokidar","watch","ignoreInitial","_handleFileEvent","file","next","on","off","close","_watchConfigFiles","options","initialFiles","fileEvent$","pipe","scan","files","fileEvent","concat","filter","f","console","log","chalk","blue","relative","slice","startWith","distinctUntilChanged","tsconfig","configFiles$","ctx$","switchMap","configFiles","_files","packageJsonPath","find","Error","_loadPkgWithReporting","_loadConfig","_resolveBuildContext","subscribe","watchTasks","task","handler","_watchTaskHandlers","result$","exec","error","err","logger","process","exit","result","complete","success"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGO,SAASA,kBAAT,CAA4BC,GAA5B,EAAiC;EACtC,IA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,SAAL,CAAe,MAAOlG,GAAP,IAAe;IAC5B,MAAMmG,UAAU,GAAGpG,kBAAkB,CAACC,GAAD,CAArC;;IACA,KAAK,MAAMoG,IAAX,IAAmBD,UAAnB,EAA+B;MAC7B,MAAME,OAAO,GAAGC,KAAAA,CAAAA,kBAAAA,CAAmBF,IAAI,CAAClF,IAAxBoF,CAAhB;MACA,MAAMC,OAAO,GAAGF,OAAO,CAACG,IAAR,CAAaxG,GAAb,EAAkBoG,IAAlB,CAAhB;MACAG,OAAO,CAACL,SAAR,CAAkB;QAChBO,KAAK,EAAGC,GAAD,IAAS;UACd1G,GAAG,CAAC2G,MAAJ,CAAWF,KAAX,CAAiBC,GAAjB;UACA1G,GAAG,CAAC2G,MAAJ,CAAW5B,GAAX;UACA6B,OAAO,CAACC,IAAR,CAAa,CAAb;QACD,CALe;QAMhB9C,IAAI,EAAG+C,MAAD,IAAY;UAChBT,OAAO,CAACU,QAAR,CAAiB/G,GAAjB,EAAsBoG,IAAtB,EAA4BU,MAA5B;QACD,CARe;QAShBC,QAAQ,EAAE,MAAM;UACd/G,GAAG,CAAC2G,MAAJ,CAAWK,OAAX,CAAmBX,OAAO,CAACxE,IAAR,CAAa7B,GAAb,EAAkBoG,IAAlB,CAAnB;UACApG,GAAG,CAAC2G,MAAJ,CAAW5B,GAAX;QACD;MAZe,CAAlB;IAcD;EACF,CApBD;AAqBF;;"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var watch = require('./_watch-
|
|
3
|
+
var watch = require('./_watch-91ef3209.cjs');
|
|
4
4
|
|
|
5
5
|
require('path');
|
|
6
6
|
|
|
@@ -26,12 +26,10 @@ require('browserslist');
|
|
|
26
26
|
|
|
27
27
|
require('fs');
|
|
28
28
|
|
|
29
|
-
require('./_index-
|
|
29
|
+
require('./_index-bc62cfaa.cjs');
|
|
30
30
|
|
|
31
31
|
require('util');
|
|
32
32
|
|
|
33
|
-
require('cpx');
|
|
34
|
-
|
|
35
33
|
require('assert');
|
|
36
34
|
|
|
37
35
|
require('events');
|
|
@@ -78,4 +76,4 @@ async function watchAction(options) {
|
|
|
78
76
|
}
|
|
79
77
|
|
|
80
78
|
exports.watchAction = watchAction;
|
|
81
|
-
//# sourceMappingURL=_watchAction-
|
|
79
|
+
//# sourceMappingURL=_watchAction-10ee08fc.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"_watchAction-
|
|
1
|
+
{"version":3,"file":"_watchAction-10ee08fc.cjs","sources":["../src/cli/watchAction.ts"],"sourcesContent":["import {watch} from '../node/watch'\n\nexport async function watchAction(options: {tsconfig?: string}): Promise<void> {\n return await watch({\n cwd: process.cwd(),\n tsconfig: options.tsconfig,\n })\n}\n"],"names":["watchAction","options","watch","cwd","process","tsconfig"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACO,eAAeA,WAAf,CAA2BC,OAA3B,EAAoC;EACzC,OAAO,MAAMC,KAAAA,CAAAA,KAAAA,CAAM;IACjBC,GAAG,EAAEC,OAAO,CAACD,GAAR,EADY;IAEjBE,QAAQ,EAAEJ,OAAO,CAACI;EAFD,CAANH,CAAb;AAIF;;"}
|
package/dist/cli.cjs
CHANGED
|
@@ -10,13 +10,13 @@ function _interopDefaultLegacy(e) {
|
|
|
10
10
|
|
|
11
11
|
var cac__default = /*#__PURE__*/_interopDefaultLegacy(cac);
|
|
12
12
|
|
|
13
|
-
var version = "1.
|
|
13
|
+
var version = "1.9.0";
|
|
14
14
|
const cli = cac__default["default"]();
|
|
15
15
|
cli.command("", "Check").option("--strict", "Strict mode").option("--tsconfig [tsconfig]", "[string] tsconfig.json").action(async options => {
|
|
16
16
|
const {
|
|
17
17
|
checkAction: statusAction
|
|
18
18
|
} = await Promise.resolve().then(function () {
|
|
19
|
-
return require('./_checkAction-
|
|
19
|
+
return require('./_checkAction-d3a8b220.cjs');
|
|
20
20
|
});
|
|
21
21
|
return statusAction(options);
|
|
22
22
|
});
|
|
@@ -24,7 +24,7 @@ cli.command("build", "Build package").option("--tsconfig [tsconfig]", "[string]
|
|
|
24
24
|
const {
|
|
25
25
|
buildAction
|
|
26
26
|
} = await Promise.resolve().then(function () {
|
|
27
|
-
return require('./_buildAction-
|
|
27
|
+
return require('./_buildAction-c4426eb4.cjs');
|
|
28
28
|
});
|
|
29
29
|
return buildAction(options);
|
|
30
30
|
});
|
|
@@ -32,7 +32,7 @@ cli.command("watch", "Watch package").option("--tsconfig [tsconfig]", "[string]
|
|
|
32
32
|
const {
|
|
33
33
|
watchAction
|
|
34
34
|
} = await Promise.resolve().then(function () {
|
|
35
|
-
return require('./_watchAction-
|
|
35
|
+
return require('./_watchAction-10ee08fc.cjs');
|
|
36
36
|
});
|
|
37
37
|
return watchAction(options);
|
|
38
38
|
});
|
package/dist/index.cjs
CHANGED
|
@@ -4,15 +4,15 @@ Object.defineProperty(exports, '__esModule', {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
|
|
7
|
-
var index = require('./_index-
|
|
7
|
+
var index = require('./_index-bc62cfaa.cjs');
|
|
8
8
|
|
|
9
9
|
var _resolveBuildContext = require('./__resolveBuildContext-17992a0e.cjs');
|
|
10
10
|
|
|
11
|
-
var build = require('./_build-
|
|
11
|
+
var build = require('./_build-526356ff.cjs');
|
|
12
12
|
|
|
13
|
-
var check = require('./_check-
|
|
13
|
+
var check = require('./_check-069b0db0.cjs');
|
|
14
14
|
|
|
15
|
-
var watch = require('./_watch-
|
|
15
|
+
var watch = require('./_watch-91ef3209.cjs');
|
|
16
16
|
|
|
17
17
|
require('chalk');
|
|
18
18
|
|
|
@@ -20,12 +20,8 @@ require('rxjs');
|
|
|
20
20
|
|
|
21
21
|
require('path');
|
|
22
22
|
|
|
23
|
-
require('fs/promises');
|
|
24
|
-
|
|
25
23
|
require('util');
|
|
26
24
|
|
|
27
|
-
require('cpx');
|
|
28
|
-
|
|
29
25
|
require('assert');
|
|
30
26
|
|
|
31
27
|
require('fs');
|
|
@@ -34,6 +30,8 @@ require('events');
|
|
|
34
30
|
|
|
35
31
|
require('typescript');
|
|
36
32
|
|
|
33
|
+
require('fs/promises');
|
|
34
|
+
|
|
37
35
|
require('@microsoft/api-extractor');
|
|
38
36
|
|
|
39
37
|
require('mkdirp');
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":["../src/node/_core/config/defineConfig.ts"],"sourcesContent":["import {PkgConfigOptions} from './types'\n\n/** @public */\nexport function defineConfig(configOptions: PkgConfigOptions): PkgConfigOptions {\n return configOptions\n}\n"],"names":["defineConfig","configOptions"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../src/node/_core/config/defineConfig.ts"],"sourcesContent":["import {PkgConfigOptions} from './types'\n\n/** @public */\nexport function defineConfig(configOptions: PkgConfigOptions): PkgConfigOptions {\n return configOptions\n}\n"],"names":["defineConfig","configOptions"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAO,SAASA,YAAT,CAAsBC,aAAtB,EAAqC;EAC1C,OAAOA,aAAP;AACF;;;;;;;;;;;;;;;;;;;;;"}
|
package/dist/index.js
CHANGED
|
@@ -14,14 +14,13 @@ import path$1 from 'path';
|
|
|
14
14
|
import { register } from 'esbuild-register/dist/node';
|
|
15
15
|
import findConfig from 'find-config';
|
|
16
16
|
import pkgUp from 'pkg-up';
|
|
17
|
-
import fs$1, { readFile
|
|
17
|
+
import fs$1, { readFile } from 'fs/promises';
|
|
18
18
|
import { z, ZodError } from 'zod';
|
|
19
19
|
import chalk from 'chalk';
|
|
20
20
|
import ts from 'typescript';
|
|
21
21
|
import fs$2, { statSync } from 'fs';
|
|
22
22
|
import { Observable, switchMap } from 'rxjs';
|
|
23
23
|
import { promisify } from 'util';
|
|
24
|
-
import cpx from 'cpx';
|
|
25
24
|
import require$$5 from 'assert';
|
|
26
25
|
import require$$3 from 'events';
|
|
27
26
|
import { ExtractorConfig, Extractor } from '@microsoft/api-extractor';
|
|
@@ -306,6 +305,7 @@ function _resolveBuildTasks(ctx) {
|
|
|
306
305
|
var _a, _b, _c, _d, _e;
|
|
307
306
|
|
|
308
307
|
const {
|
|
308
|
+
config,
|
|
309
309
|
cwd,
|
|
310
310
|
pkg,
|
|
311
311
|
target
|
|
@@ -403,13 +403,15 @@ function _resolveBuildTasks(ctx) {
|
|
|
403
403
|
|
|
404
404
|
tasks.push(...Object.values(rollupTasks));
|
|
405
405
|
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
406
|
+
if (config == null ? void 0 : config.legacyExports) {
|
|
407
|
+
for (const exp of exports) {
|
|
408
|
+
if (exp._exported && exp._path !== ".") {
|
|
409
|
+
const relativeTargetPath = (((_e = exp.browser) == null ? void 0 : _e.import) || exp.import || "").replace(/\.[^/.]+$/, "");
|
|
410
|
+
const ext = _MODULE_EXT[pkg.type].esm;
|
|
410
411
|
|
|
411
|
-
|
|
412
|
-
|
|
412
|
+
if (relativeTargetPath) {
|
|
413
|
+
fs$2.writeFileSync(path$1.resolve(cwd, "".concat(exp._path, ".js")), ["// AUTO-GENERATED \u2013 DO NOT EDIT", "", "export * from '".concat(relativeTargetPath).concat(pkg.type === "commonjs" ? ext : "", "'"), ""].join("\n"));
|
|
414
|
+
}
|
|
413
415
|
}
|
|
414
416
|
}
|
|
415
417
|
}
|
|
@@ -3983,8 +3985,8 @@ function _createApiExtractorConfig(options) {
|
|
|
3983
3985
|
exportPath,
|
|
3984
3986
|
filePath,
|
|
3985
3987
|
messages,
|
|
3986
|
-
|
|
3987
|
-
|
|
3988
|
+
projectFolder,
|
|
3989
|
+
mainEntryPointFilePath,
|
|
3988
3990
|
tsconfigPath
|
|
3989
3991
|
} = options;
|
|
3990
3992
|
return {
|
|
@@ -4007,8 +4009,8 @@ function _createApiExtractorConfig(options) {
|
|
|
4007
4009
|
enabled: false
|
|
4008
4010
|
},
|
|
4009
4011
|
messages,
|
|
4010
|
-
mainEntryPointFilePath
|
|
4011
|
-
projectFolder
|
|
4012
|
+
mainEntryPointFilePath,
|
|
4013
|
+
projectFolder
|
|
4012
4014
|
};
|
|
4013
4015
|
}
|
|
4014
4016
|
|
|
@@ -4057,7 +4059,7 @@ async function _extractTypes(options) {
|
|
|
4057
4059
|
filePath,
|
|
4058
4060
|
projectPath,
|
|
4059
4061
|
rules,
|
|
4060
|
-
|
|
4062
|
+
sourceTypesPath,
|
|
4061
4063
|
tsconfigPath
|
|
4062
4064
|
} = options;
|
|
4063
4065
|
const tsdocConfigFile = await _createTSDocConfig({
|
|
@@ -4114,8 +4116,8 @@ async function _extractTypes(options) {
|
|
|
4114
4116
|
exportPath,
|
|
4115
4117
|
filePath,
|
|
4116
4118
|
messages: messagesConfig,
|
|
4117
|
-
projectPath,
|
|
4118
|
-
|
|
4119
|
+
projectFolder: projectPath,
|
|
4120
|
+
mainEntryPointFilePath: sourceTypesPath,
|
|
4119
4121
|
tsconfigPath
|
|
4120
4122
|
}),
|
|
4121
4123
|
configObjectFullPath: void 0,
|
|
@@ -4158,7 +4160,6 @@ async function _doExtract(ctx, task) {
|
|
|
4158
4160
|
const {
|
|
4159
4161
|
config,
|
|
4160
4162
|
cwd,
|
|
4161
|
-
dist,
|
|
4162
4163
|
files,
|
|
4163
4164
|
ts
|
|
4164
4165
|
} = ctx;
|
|
@@ -4171,14 +4172,19 @@ async function _doExtract(ctx, task) {
|
|
|
4171
4172
|
};
|
|
4172
4173
|
}
|
|
4173
4174
|
|
|
4174
|
-
const distPath = path$1.resolve(cwd, dist);
|
|
4175
4175
|
const {
|
|
4176
|
-
outDir
|
|
4176
|
+
outDir,
|
|
4177
4177
|
rootDir = cwd
|
|
4178
4178
|
} = ts.config.options;
|
|
4179
|
+
|
|
4180
|
+
if (!outDir) {
|
|
4181
|
+
throw new Error("tsconfig.json is missing `compilerOptions.outDir`");
|
|
4182
|
+
}
|
|
4183
|
+
|
|
4184
|
+
const tmpPath = path$1.resolve(outDir, "__tmp__");
|
|
4179
4185
|
await _buildTypes({
|
|
4180
4186
|
cwd,
|
|
4181
|
-
outDir,
|
|
4187
|
+
outDir: tmpPath,
|
|
4182
4188
|
tsconfig: ts.config
|
|
4183
4189
|
});
|
|
4184
4190
|
const messages = [];
|
|
@@ -4186,37 +4192,30 @@ async function _doExtract(ctx, task) {
|
|
|
4186
4192
|
|
|
4187
4193
|
for (const entry of task.entries) {
|
|
4188
4194
|
const exportPath = entry.exportPath === "." ? "./index" : entry.exportPath;
|
|
4189
|
-
const
|
|
4190
|
-
const
|
|
4195
|
+
const sourceTypesPath = path$1.resolve(tmpPath, path$1.relative(rootDir, path$1.resolve(cwd, entry.sourcePath)).replace(/\.ts$/, ".d.ts"));
|
|
4196
|
+
const targetPath = path$1.resolve(cwd, entry.targetPath);
|
|
4191
4197
|
const result = await _extractTypes({
|
|
4192
4198
|
cwd,
|
|
4193
4199
|
exportPath,
|
|
4194
4200
|
files,
|
|
4195
|
-
filePath,
|
|
4201
|
+
filePath: path$1.relative(outDir, targetPath),
|
|
4196
4202
|
projectPath: cwd,
|
|
4197
4203
|
rules: (_a = config == null ? void 0 : config.extract) == null ? void 0 : _a.rules,
|
|
4198
|
-
|
|
4199
|
-
tsconfigPath: path$1.resolve(cwd, ts.configPath),
|
|
4200
|
-
distPath
|
|
4201
|
-
});
|
|
4202
|
-
results.push({
|
|
4203
|
-
sourcePath,
|
|
4204
|
-
filePath
|
|
4204
|
+
sourceTypesPath,
|
|
4205
|
+
tsconfigPath: path$1.resolve(cwd, ts.configPath || "tsconfig.json"),
|
|
4206
|
+
distPath: outDir
|
|
4205
4207
|
});
|
|
4206
4208
|
messages.push(...result.messages);
|
|
4207
4209
|
|
|
4208
4210
|
if (result.messages.some(msg => msg.logLevel === "error")) {
|
|
4211
|
+
await rimraf(tmpPath);
|
|
4209
4212
|
throw new _DtsError("encountered errors when extracting types", result.messages);
|
|
4210
4213
|
}
|
|
4211
|
-
}
|
|
4212
|
-
|
|
4213
|
-
const tmpPath = path$1.resolve(distPath, "__tmp__");
|
|
4214
|
-
await rename(outDir, tmpPath);
|
|
4215
4214
|
|
|
4216
|
-
|
|
4217
|
-
|
|
4218
|
-
|
|
4219
|
-
|
|
4215
|
+
results.push({
|
|
4216
|
+
sourcePath: path$1.resolve(cwd, entry.sourcePath),
|
|
4217
|
+
filePath: targetPath
|
|
4218
|
+
});
|
|
4220
4219
|
}
|
|
4221
4220
|
|
|
4222
4221
|
await rimraf(tmpPath);
|
|
@@ -4869,16 +4868,28 @@ function _printPackageTree(ctx) {
|
|
|
4869
4868
|
let [exportPath, entry] = _ref11;
|
|
4870
4869
|
const exp = {
|
|
4871
4870
|
source: entry.source,
|
|
4871
|
+
types: void 0,
|
|
4872
|
+
browser: void 0,
|
|
4873
|
+
node: void 0,
|
|
4874
|
+
import: void 0,
|
|
4875
|
+
require: void 0,
|
|
4872
4876
|
default: entry.default
|
|
4873
4877
|
};
|
|
4874
|
-
|
|
4878
|
+
|
|
4879
|
+
if (entry.types) {
|
|
4880
|
+
exp.types = _fileInfo(entry.types);
|
|
4881
|
+
} else {
|
|
4882
|
+
delete exp.types;
|
|
4883
|
+
}
|
|
4875
4884
|
|
|
4876
4885
|
if (entry.browser) {
|
|
4877
4886
|
exp.browser = {
|
|
4878
4887
|
source: entry.browser.source
|
|
4879
4888
|
};
|
|
4880
4889
|
if (entry.browser.import) exp.browser.import = _fileInfo(entry.browser.import);
|
|
4881
|
-
if (entry.browser.require) exp.browser.
|
|
4890
|
+
if (entry.browser.require) exp.browser.require = _fileInfo(entry.browser.require);
|
|
4891
|
+
} else {
|
|
4892
|
+
delete exp.browser;
|
|
4882
4893
|
}
|
|
4883
4894
|
|
|
4884
4895
|
if (entry.node) {
|
|
@@ -4886,11 +4897,23 @@ function _printPackageTree(ctx) {
|
|
|
4886
4897
|
source: entry.node.source
|
|
4887
4898
|
};
|
|
4888
4899
|
if (entry.node.import) exp.node.import = _fileInfo(entry.node.import);
|
|
4889
|
-
if (entry.node.require) exp.node.
|
|
4900
|
+
if (entry.node.require) exp.node.require = _fileInfo(entry.node.require);
|
|
4901
|
+
} else {
|
|
4902
|
+
delete exp.node;
|
|
4903
|
+
}
|
|
4904
|
+
|
|
4905
|
+
if (entry.import) {
|
|
4906
|
+
exp.import = _fileInfo(entry.import);
|
|
4907
|
+
} else {
|
|
4908
|
+
delete exp.import;
|
|
4909
|
+
}
|
|
4910
|
+
|
|
4911
|
+
if (entry.require) {
|
|
4912
|
+
exp.require = _fileInfo(entry.require);
|
|
4913
|
+
} else {
|
|
4914
|
+
delete exp.require;
|
|
4890
4915
|
}
|
|
4891
4916
|
|
|
4892
|
-
if (entry.import) exp.import = _fileInfo(entry.import);
|
|
4893
|
-
if (entry.require) exp.require = _fileInfo(entry.require);
|
|
4894
4917
|
exp.default = _fileInfo(entry.default);
|
|
4895
4918
|
return [chalk.green(path$1.join(pkg.name, exportPath)), exp];
|
|
4896
4919
|
}));
|
|
@@ -4915,6 +4938,9 @@ async function check(options) {
|
|
|
4915
4938
|
pkg,
|
|
4916
4939
|
tsconfig
|
|
4917
4940
|
});
|
|
4941
|
+
const {
|
|
4942
|
+
logger
|
|
4943
|
+
} = ctx;
|
|
4918
4944
|
|
|
4919
4945
|
_printPackageTree(ctx);
|
|
4920
4946
|
|
|
@@ -4940,7 +4966,8 @@ async function check(options) {
|
|
|
4940
4966
|
}
|
|
4941
4967
|
|
|
4942
4968
|
if (missingFiles.length) {
|
|
4943
|
-
|
|
4969
|
+
logger.error("missing files");
|
|
4970
|
+
process.exit(1);
|
|
4944
4971
|
}
|
|
4945
4972
|
|
|
4946
4973
|
const _paths = {
|
|
@@ -4948,10 +4975,10 @@ async function check(options) {
|
|
|
4948
4975
|
import: []
|
|
4949
4976
|
};
|
|
4950
4977
|
|
|
4951
|
-
for (const
|
|
4978
|
+
for (const exp of Object.values(ctx.exports || {})) {
|
|
4952
4979
|
if (!exp._exported) continue;
|
|
4953
|
-
if (exp.require) _paths.require.push(
|
|
4954
|
-
if (exp.import) _paths.import.push(
|
|
4980
|
+
if (exp.require) _paths.require.push(exp.require);
|
|
4981
|
+
if (exp.import) _paths.import.push(exp.import);
|
|
4955
4982
|
}
|
|
4956
4983
|
|
|
4957
4984
|
const external = Object.keys(pkg.dependencies || {}).concat(Object.keys(pkg.devDependencies || {}));
|
|
@@ -4975,7 +5002,7 @@ async function check(options) {
|
|
|
4975
5002
|
});
|
|
4976
5003
|
|
|
4977
5004
|
if (esbuildResult.warnings.length > 0) {
|
|
4978
|
-
|
|
5005
|
+
logger.warn(...esbuildResult.warnings);
|
|
4979
5006
|
}
|
|
4980
5007
|
} catch (err) {
|
|
4981
5008
|
const {
|
|
@@ -4984,14 +5011,14 @@ async function check(options) {
|
|
|
4984
5011
|
|
|
4985
5012
|
for (const _err of errors) {
|
|
4986
5013
|
if (_err.location) {
|
|
4987
|
-
|
|
4988
|
-
|
|
4989
|
-
|
|
5014
|
+
logger.error(_err.detail || _err.text);
|
|
5015
|
+
logger.error("".concat(_err.location.line, " | ").concat(_err.location.lineText));
|
|
5016
|
+
logger.error("in", "./".concat(_err.location.file, ":").concat(_err.location.line, ":").concat(_err.location.column));
|
|
4990
5017
|
} else {
|
|
4991
|
-
|
|
5018
|
+
logger.error(_err.detail || _err.text);
|
|
4992
5019
|
}
|
|
4993
5020
|
|
|
4994
|
-
|
|
5021
|
+
logger.log();
|
|
4995
5022
|
}
|
|
4996
5023
|
|
|
4997
5024
|
process.exit(1);
|
|
@@ -5015,11 +5042,12 @@ async function check(options) {
|
|
|
5015
5042
|
});
|
|
5016
5043
|
|
|
5017
5044
|
if (esbuildResult.errors.length > 0) {
|
|
5018
|
-
|
|
5045
|
+
logger.error(esbuildResult.errors.join(", "));
|
|
5046
|
+
process.exit(1);
|
|
5019
5047
|
}
|
|
5020
5048
|
|
|
5021
5049
|
if (esbuildResult.warnings.length > 0) {
|
|
5022
|
-
|
|
5050
|
+
logger.warn(...esbuildResult.warnings);
|
|
5023
5051
|
}
|
|
5024
5052
|
}
|
|
5025
5053
|
}
|
|
@@ -5029,6 +5057,7 @@ function _resolveWatchTasks(ctx) {
|
|
|
5029
5057
|
var _a, _b, _c, _d, _e;
|
|
5030
5058
|
|
|
5031
5059
|
const {
|
|
5060
|
+
config,
|
|
5032
5061
|
cwd,
|
|
5033
5062
|
pkg,
|
|
5034
5063
|
target
|
|
@@ -5126,13 +5155,15 @@ function _resolveWatchTasks(ctx) {
|
|
|
5126
5155
|
|
|
5127
5156
|
tasks.push(...Object.values(rollupTasks));
|
|
5128
5157
|
|
|
5129
|
-
|
|
5130
|
-
|
|
5131
|
-
|
|
5132
|
-
|
|
5158
|
+
if (config == null ? void 0 : config.legacyExports) {
|
|
5159
|
+
for (const exp of exports) {
|
|
5160
|
+
if (exp._exported && exp._path !== ".") {
|
|
5161
|
+
const relativeTargetPath = (((_e = exp.browser) == null ? void 0 : _e.import) || exp.import || "").replace(/\.[^/.]+$/, "");
|
|
5162
|
+
const ext = _MODULE_EXT[pkg.type].esm;
|
|
5133
5163
|
|
|
5134
|
-
|
|
5135
|
-
|
|
5164
|
+
if (relativeTargetPath) {
|
|
5165
|
+
fs$2.writeFileSync(path$1.resolve(cwd, "".concat(exp._path, ".js")), ["// AUTO-GENERATED \u2013 DO NOT EDIT", "", "export * from '".concat(relativeTargetPath).concat(pkg.type === "commonjs" ? ext : "", "'"), ""].join("\n"));
|
|
5166
|
+
}
|
|
5136
5167
|
}
|
|
5137
5168
|
}
|
|
5138
5169
|
}
|