@sanity/pkg-utils 12.0.1 → 12.1.1

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.
Files changed (34) hide show
  1. package/MIGRATE.md +23 -22
  2. package/README.md +59 -4
  3. package/dist/{buildAction-D-M3KYyN.js → buildAction-C8MCKsDz.js} +10 -6
  4. package/dist/buildAction-C8MCKsDz.js.map +1 -0
  5. package/dist/{checkAction-B8M5CP3j.js → checkAction-0QxzAxUd.js} +42 -37
  6. package/dist/checkAction-0QxzAxUd.js.map +1 -0
  7. package/dist/cli.js +5 -5
  8. package/dist/index.d.ts +40 -26
  9. package/dist/index.d.ts.map +1 -1
  10. package/dist/index.js +12 -1
  11. package/dist/index.js.map +1 -1
  12. package/dist/{resolveBuildContext-CbwvYKj1.js → resolveBuildContext-DYZxWVVc.js} +78 -50
  13. package/dist/resolveBuildContext-DYZxWVVc.js.map +1 -0
  14. package/dist/{resolveTsdownConfig-CGE_7cMM.js → resolveTsdownConfig-D4boYIwx.js} +143 -12
  15. package/dist/resolveTsdownConfig-D4boYIwx.js.map +1 -0
  16. package/dist/watchAction-PjRXiQRe.js +117 -0
  17. package/dist/watchAction-PjRXiQRe.js.map +1 -0
  18. package/dist/writeBundleCssExports-DGTofClh.js +64 -0
  19. package/dist/writeBundleCssExports-DGTofClh.js.map +1 -0
  20. package/package.json +11 -10
  21. package/dist/buildAction-D-M3KYyN.js.map +0 -1
  22. package/dist/checkAction-B8M5CP3j.js.map +0 -1
  23. package/dist/createApiExtractorConfig-CJoZqw8e.js +0 -30
  24. package/dist/createApiExtractorConfig-CJoZqw8e.js.map +0 -1
  25. package/dist/createTSDocConfig-ylfirNWP.js +0 -25
  26. package/dist/createTSDocConfig-ylfirNWP.js.map +0 -1
  27. package/dist/getExtractMessagesConfig-CXljwFbQ.js +0 -75
  28. package/dist/getExtractMessagesConfig-CXljwFbQ.js.map +0 -1
  29. package/dist/printExtractMessages-DyaYtByp.js +0 -33
  30. package/dist/printExtractMessages-DyaYtByp.js.map +0 -1
  31. package/dist/resolveBuildContext-CbwvYKj1.js.map +0 -1
  32. package/dist/resolveTsdownConfig-CGE_7cMM.js.map +0 -1
  33. package/dist/watchAction-BQG5_hhl.js +0 -179
  34. package/dist/watchAction-BQG5_hhl.js.map +0 -1
@@ -1,179 +0,0 @@
1
- import { n as createLogger, r as isRecord, t as handleError } from "./handleError-83GwKIFM.js";
2
- import { a as loadPkgWithReporting, o as loadConfig, t as resolveBuildContext } from "./resolveBuildContext-CbwvYKj1.js";
3
- import { n as resolveTsdownBuilds, t as resolveTsdownConfig } from "./resolveTsdownConfig-CGE_7cMM.js";
4
- import path from "node:path";
5
- import { up } from "empathic/package";
6
- import { build } from "tsdown";
7
- import { readFile, writeFile } from "node:fs/promises";
8
- import { switchMap } from "rxjs";
9
- /**
10
- * The no-op JS shim file name for a CSS file under vanilla-extract compat mode.
11
- *
12
- * `bundle.css` → `bundle-css.js` — deliberately not `${cssFileName}.js` (`bundle.css.js`),
13
- * which vanilla-extract's `cssFileFilter` (`/\.css\.(js|cjs|mjs|jsx|ts|tsx)$/`) would treat as
14
- * a stylesheet module. Kept in sync with `cssShimFileName` in
15
- * `@sanity/vanilla-extract-rolldown-plugin`.
16
- *
17
- * @internal
18
- */
19
- function cssShimFileName(cssFileName) {
20
- return `${cssFileName.replace(/\.css$/, "-css")}.js`;
21
- }
22
- /**
23
- * The `.d.ts` companion for {@link cssShimFileName}. `bundle.css` → `bundle-css.d.ts`.
24
- *
25
- * @internal
26
- */
27
- function cssShimDtsFileName(cssFileName) {
28
- return `${cssFileName.replace(/\.css$/, "-css")}.d.ts`;
29
- }
30
- /**
31
- * Build the conditional CSS export object that vanilla-extract compat mode expects, e.g.
32
- * ```json
33
- * {
34
- * "types": "./dist/bundle-css.d.ts",
35
- * "browser": "./dist/bundle.css",
36
- * "style": "./dist/bundle.css",
37
- * "node": "./dist/bundle-css.js",
38
- * "default": "./dist/bundle-css.js"
39
- * }
40
- * ```
41
- * The shim is named `bundle-css.js` (not `bundle.css.js`) so it does not match
42
- * vanilla-extract's `cssFileFilter`. An explicit `types` condition (rather than relying on
43
- * TypeScript's extension-substitution fallback, which only works when the shim shares the CSS
44
- * file's basename, and which TypeScript is deprecating anyway - microsoft/TypeScript#50762)
45
- * points resolvers straight at the shim's declaration file.
46
- *
47
- * Kept in sync with `createConditionalCssExport` in `@sanity/vanilla-extract-tsdown-plugin`,
48
- * which writes the same entry through tsdown's `exports.customExports` during full builds.
49
- */
50
- function createConditionalCssExport(cssFile, shimFile, shimDtsFile) {
51
- return {
52
- types: shimDtsFile,
53
- browser: cssFile,
54
- style: cssFile,
55
- node: shimFile,
56
- default: shimFile
57
- };
58
- }
59
- function hasMatchingExport(value, expected) {
60
- if (typeof value != "object" || !value) return !1;
61
- let actual = Object.fromEntries(Object.entries(value)), keys = Object.keys(expected);
62
- return keys.length === Object.keys(actual).length && keys.every((key) => actual[key] === expected[key]);
63
- }
64
- /**
65
- * Insert (or replace) the `"./<cssName>"` export in an `exports`-shaped map, preserving the existing
66
- * order and placing it before `./package.json` when present.
67
- */
68
- function insertCssExport(exports, exportKey, conditionalExport) {
69
- let nextExports = {}, inserted = !1;
70
- for (let [key, value] of Object.entries(exports)) key !== exportKey && (key === "./package.json" && !inserted && (nextExports[exportKey] = conditionalExport, inserted = !0), nextExports[key] = value);
71
- return inserted || (nextExports[exportKey] = conditionalExport), nextExports;
72
- }
73
- function detectIndent(source) {
74
- let match = source.match(/\n([ \t]+)\S/);
75
- if (!match) return 2;
76
- let indent = match[1];
77
- return indent.includes(" ") ? " " : indent.length;
78
- }
79
- /**
80
- * Write the conditional `"./<cssName>"` export to `package.json` (used by vanilla-extract compat
81
- * mode), so userland does not have to maintain it by hand. The write is idempotent: if the export
82
- * already matches, the file is left untouched.
83
- *
84
- * Full builds write this entry through tsdown's `exports.customExports` (the
85
- * `@sanity/vanilla-extract-tsdown-plugin` composition), but watch mode disables tsdown's
86
- * `exports` feature (a `package.json` write per rebuild would loop the watcher) — `pkg watch`
87
- * calls this once per context instead, like v11 did.
88
- *
89
- * When `publishConfig.exports` is present, the same conditional CSS export is mirrored into it. The
90
- * conditional CSS export has no `source`/`development`/`monorepo` conditions to strip, so the entry
91
- * is identical in both places. Keeping them in sync prevents the `publishConfig.exports` validation
92
- * from failing with a "missing export path" error for the auto-added `./<cssName>` export.
93
- *
94
- * @internal
95
- */
96
- async function writeBundleCssExports(options) {
97
- let { cwd, distPath, cssName, logger } = options, pkgPath = path.resolve(cwd, "package.json"), source = await readFile(pkgPath, "utf8"), pkg = JSON.parse(source), distRel = (path.relative(cwd, distPath) || "dist").split(path.sep).join("/"), exportKey = `./${cssName}`, conditionalExport = createConditionalCssExport(`./${path.posix.join(distRel, cssName)}`, `./${path.posix.join(distRel, cssShimFileName(cssName))}`, `./${path.posix.join(distRel, cssShimDtsFileName(cssName))}`), publishConfig = pkg.publishConfig, publishConfigExports = isRecord(publishConfig?.exports) ? publishConfig.exports : void 0, exportsMatch = hasMatchingExport(pkg.exports?.[exportKey], conditionalExport), publishConfigExportsMatch = !publishConfigExports || hasMatchingExport(publishConfigExports[exportKey], conditionalExport);
98
- exportsMatch && publishConfigExportsMatch || (pkg.exports = insertCssExport(pkg.exports ?? {}, exportKey, conditionalExport), publishConfig && publishConfigExports && (publishConfig.exports = insertCssExport(publishConfigExports, exportKey, conditionalExport)), await writeFile(pkgPath, `${JSON.stringify(pkg, null, detectIndent(source))}\n`), logger.log(`Updated package.json: added \`exports["${exportKey}"]\`${publishConfigExports ? ` and \`publishConfig.exports["${exportKey}"]\`` : ""} for vanilla-extract compat mode`));
99
- }
100
- const asyncDispose = Symbol.asyncDispose || Symbol.for("Symbol.asyncDispose");
101
- /** @public */
102
- async function watch(options) {
103
- let { cwd, strict = !1, tsconfig: tsconfigOption, signal } = options, logger = createLogger(), { watchConfigFiles } = await import("./watchConfigFiles-AGBDblwf.js"), configFiles$ = await watchConfigFiles({
104
- cwd,
105
- logger
106
- }), bundles = [], runId = 0, disposeBundles = async () => {
107
- let disposing = bundles;
108
- bundles = [];
109
- for (let bundle of disposing) await bundle[asyncDispose]();
110
- }, ctxSubscription = configFiles$.pipe(switchMap(async () => {
111
- let pkgPath = up({ cwd });
112
- if (!pkgPath) throw Error("missing package.json", { cause: { cwd } });
113
- let config = await loadConfig({
114
- cwd,
115
- pkgPath
116
- }), { parseStrictOptions } = await import("./resolveBuildContext-CbwvYKj1.js").then((n) => n.n), strictOptions = parseStrictOptions(config?.strictOptions ?? {}), pkg = await loadPkgWithReporting({
117
- pkgPath,
118
- logger,
119
- strict,
120
- strictOptions
121
- }), tsconfig = tsconfigOption || config?.tsconfig || "tsconfig.json";
122
- return resolveBuildContext({
123
- config,
124
- cwd,
125
- logger,
126
- pkg,
127
- strict,
128
- tsconfig
129
- });
130
- })).subscribe(async (ctx) => {
131
- let id = ++runId, runBundles = [];
132
- try {
133
- await disposeBundles();
134
- let vanillaExtract = ctx.config?.vanillaExtract;
135
- if (vanillaExtract) {
136
- let veOptions = vanillaExtract === !0 ? {} : vanillaExtract, inject = veOptions.inject ?? { nodeCompat: !0 };
137
- isRecord(inject) && inject.nodeCompat && await writeBundleCssExports({
138
- cwd,
139
- distPath: ctx.distPath,
140
- cssName: veOptions.fileName || "bundle.css",
141
- logger
142
- });
143
- }
144
- let builds = resolveTsdownBuilds(ctx), first = !0;
145
- for (let buildDef of builds) {
146
- if (id !== runId) break;
147
- let inlineConfig = await resolveTsdownConfig(ctx, buildDef, {
148
- clean: first,
149
- watch: !0
150
- });
151
- first = !1, runBundles.push(...await build(inlineConfig));
152
- }
153
- if (id !== runId) {
154
- for (let bundle of runBundles) await bundle[asyncDispose]();
155
- return;
156
- }
157
- bundles = runBundles, logger.success(`${ctx.pkg.name}: watching for file changes\u2026`), logger.log();
158
- } catch (err) {
159
- ctx.logger.error(err), ctx.logger.log(), process.exit(1);
160
- }
161
- });
162
- signal && signal.addEventListener("abort", () => {
163
- runId++, ctxSubscription.unsubscribe(), disposeBundles();
164
- }, { once: !0 });
165
- }
166
- async function watchAction(options) {
167
- try {
168
- await watch({
169
- cwd: process.cwd(),
170
- strict: options.strict,
171
- tsconfig: options.tsconfig
172
- });
173
- } catch (err) {
174
- handleError(err);
175
- }
176
- }
177
- export { watchAction };
178
-
179
- //# sourceMappingURL=watchAction-BQG5_hhl.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"watchAction-BQG5_hhl.js","names":["findPkgPath","tsdownBuild"],"sources":["../src/node/core/pkg/cssShimFileName.ts","../src/node/core/pkg/writeBundleCssExports.ts","../src/node/watch.ts","../src/cli/watchAction.ts"],"sourcesContent":["/**\n * The no-op JS shim file name for a CSS file under vanilla-extract compat mode.\n *\n * `bundle.css` → `bundle-css.js` — deliberately not `${cssFileName}.js` (`bundle.css.js`),\n * which vanilla-extract's `cssFileFilter` (`/\\.css\\.(js|cjs|mjs|jsx|ts|tsx)$/`) would treat as\n * a stylesheet module. Kept in sync with `cssShimFileName` in\n * `@sanity/vanilla-extract-rolldown-plugin`.\n *\n * @internal\n */\nexport function cssShimFileName(cssFileName: string): string {\n return `${cssFileName.replace(/\\.css$/, '-css')}.js`\n}\n\n/**\n * The `.d.ts` companion for {@link cssShimFileName}. `bundle.css` → `bundle-css.d.ts`.\n *\n * @internal\n */\nexport function cssShimDtsFileName(cssFileName: string): string {\n return `${cssFileName.replace(/\\.css$/, '-css')}.d.ts`\n}\n","import {readFile, writeFile} from 'node:fs/promises'\nimport path from 'node:path'\nimport type {Logger} from '../../logger.ts'\nimport {isRecord} from '../isRecord.ts'\nimport {cssShimDtsFileName, cssShimFileName} from './cssShimFileName.ts'\n\n/**\n * Build the conditional CSS export object that vanilla-extract compat mode expects, e.g.\n * ```json\n * {\n * \"types\": \"./dist/bundle-css.d.ts\",\n * \"browser\": \"./dist/bundle.css\",\n * \"style\": \"./dist/bundle.css\",\n * \"node\": \"./dist/bundle-css.js\",\n * \"default\": \"./dist/bundle-css.js\"\n * }\n * ```\n * The shim is named `bundle-css.js` (not `bundle.css.js`) so it does not match\n * vanilla-extract's `cssFileFilter`. An explicit `types` condition (rather than relying on\n * TypeScript's extension-substitution fallback, which only works when the shim shares the CSS\n * file's basename, and which TypeScript is deprecating anyway - microsoft/TypeScript#50762)\n * points resolvers straight at the shim's declaration file.\n *\n * Kept in sync with `createConditionalCssExport` in `@sanity/vanilla-extract-tsdown-plugin`,\n * which writes the same entry through tsdown's `exports.customExports` during full builds.\n */\nfunction createConditionalCssExport(cssFile: string, shimFile: string, shimDtsFile: string) {\n return {types: shimDtsFile, browser: cssFile, style: cssFile, node: shimFile, default: shimFile}\n}\n\nfunction hasMatchingExport(value: unknown, expected: Record<string, string>): boolean {\n if (typeof value !== 'object' || value === null) return false\n const actual = Object.fromEntries(Object.entries(value))\n const keys = Object.keys(expected)\n return (\n keys.length === Object.keys(actual).length && keys.every((key) => actual[key] === expected[key])\n )\n}\n\n/**\n * Insert (or replace) the `\"./<cssName>\"` export in an `exports`-shaped map, preserving the existing\n * order and placing it before `./package.json` when present.\n */\nfunction insertCssExport(\n exports: Record<string, unknown>,\n exportKey: string,\n conditionalExport: Record<string, string>,\n): Record<string, unknown> {\n const nextExports: Record<string, unknown> = {}\n let inserted = false\n for (const [key, value] of Object.entries(exports)) {\n if (key === exportKey) continue\n if (key === './package.json' && !inserted) {\n nextExports[exportKey] = conditionalExport\n inserted = true\n }\n nextExports[key] = value\n }\n if (!inserted) {\n nextExports[exportKey] = conditionalExport\n }\n return nextExports\n}\n\nfunction detectIndent(source: string): string | number {\n const match = source.match(/\\n([ \\t]+)\\S/)\n if (!match) return 2\n const indent = match[1]!\n return indent.includes('\\t') ? '\\t' : indent.length\n}\n\n/**\n * Write the conditional `\"./<cssName>\"` export to `package.json` (used by vanilla-extract compat\n * mode), so userland does not have to maintain it by hand. The write is idempotent: if the export\n * already matches, the file is left untouched.\n *\n * Full builds write this entry through tsdown's `exports.customExports` (the\n * `@sanity/vanilla-extract-tsdown-plugin` composition), but watch mode disables tsdown's\n * `exports` feature (a `package.json` write per rebuild would loop the watcher) — `pkg watch`\n * calls this once per context instead, like v11 did.\n *\n * When `publishConfig.exports` is present, the same conditional CSS export is mirrored into it. The\n * conditional CSS export has no `source`/`development`/`monorepo` conditions to strip, so the entry\n * is identical in both places. Keeping them in sync prevents the `publishConfig.exports` validation\n * from failing with a \"missing export path\" error for the auto-added `./<cssName>` export.\n *\n * @internal\n */\nexport async function writeBundleCssExports(options: {\n cwd: string\n distPath: string\n cssName: string\n logger: Logger\n}): Promise<void> {\n const {cwd, distPath, cssName, logger} = options\n\n const pkgPath = path.resolve(cwd, 'package.json')\n const source = await readFile(pkgPath, 'utf8')\n // oxlint-disable-next-line no-unsafe-type-assertion\n const pkg = JSON.parse(source) as {\n exports?: Record<string, unknown>\n publishConfig?: {exports?: Record<string, unknown>}\n }\n\n // Normalize to POSIX separators - `path.relative` uses `\\\\` on Windows, but `exports` paths in\n // package.json must always use `/`.\n const distRel = (path.relative(cwd, distPath) || 'dist').split(path.sep).join('/')\n const exportKey = `./${cssName}`\n const cssFile = `./${path.posix.join(distRel, cssName)}`\n const shimFile = `./${path.posix.join(distRel, cssShimFileName(cssName))}`\n const shimDtsFile = `./${path.posix.join(distRel, cssShimDtsFileName(cssName))}`\n const conditionalExport = createConditionalCssExport(cssFile, shimFile, shimDtsFile)\n\n // Only mirror into `publishConfig.exports` when it already exists; never create it here.\n const publishConfig = pkg.publishConfig\n const publishConfigExports = isRecord(publishConfig?.exports) ? publishConfig.exports : undefined\n\n const exportsMatch = hasMatchingExport(pkg.exports?.[exportKey], conditionalExport)\n const publishConfigExportsMatch =\n !publishConfigExports || hasMatchingExport(publishConfigExports[exportKey], conditionalExport)\n\n if (exportsMatch && publishConfigExportsMatch) {\n return\n }\n\n pkg.exports = insertCssExport(pkg.exports ?? {}, exportKey, conditionalExport)\n\n if (publishConfig && publishConfigExports) {\n publishConfig.exports = insertCssExport(publishConfigExports, exportKey, conditionalExport)\n }\n\n await writeFile(pkgPath, `${JSON.stringify(pkg, null, detectIndent(source))}\\n`)\n logger.log(\n `Updated package.json: added \\`exports[\"${exportKey}\"]\\`${\n publishConfigExports ? ` and \\`publishConfig.exports[\"${exportKey}\"]\\`` : ''\n } for vanilla-extract compat mode`,\n )\n}\n","import {up as findPkgPath} from 'empathic/package'\nimport type {Subscription} from 'rxjs'\nimport {switchMap} from 'rxjs'\nimport {build as tsdownBuild, type TsdownBundle} from 'tsdown'\nimport {loadConfig} from './core/config/loadConfig.ts'\nimport {isRecord} from './core/isRecord.ts'\nimport {loadPkgWithReporting} from './core/pkg/loadPkgWithReporting.ts'\nimport {writeBundleCssExports} from './core/pkg/writeBundleCssExports.ts'\nimport {createLogger} from './logger.ts'\nimport {resolveBuildContext} from './resolveBuildContext.ts'\nimport {resolveTsdownBuilds} from './tasks/tsdown/resolveTsdownBuilds.ts'\nimport {resolveTsdownConfig} from './tasks/tsdown/resolveTsdownConfig.ts'\n\nconst asyncDispose: typeof Symbol.asyncDispose =\n Symbol.asyncDispose || Symbol.for('Symbol.asyncDispose')\n\n/** @public */\nexport async function watch(options: {\n cwd: string\n strict?: boolean\n tsconfig?: string\n signal?: AbortSignal\n}): Promise<void> {\n const {cwd, strict = false, tsconfig: tsconfigOption, signal} = options\n\n const logger = createLogger()\n\n const {watchConfigFiles} = await import('./watchConfigFiles.ts')\n const configFiles$ = await watchConfigFiles({cwd, logger})\n\n // Every rebuild of the waterfall holds tsdown watchers (one per platform build); they are\n // disposed when the config files change (the waterfall restarts) or the signal aborts.\n // RxJS does not await async subscriber callbacks, so a monotonically increasing run id\n // guards the rebuilds: only the latest run may publish into `bundles`, and a run that turns\n // stale mid-flight (a newer config-file event, or the abort signal) disposes the watchers\n // it created instead of leaking them.\n let bundles: TsdownBundle[] = []\n let runId = 0\n const disposeBundles = async () => {\n const disposing = bundles\n bundles = []\n for (const bundle of disposing) {\n await bundle[asyncDispose]()\n }\n }\n\n const ctx$ = configFiles$.pipe(\n switchMap(async () => {\n const pkgPath = findPkgPath({cwd})\n if (!pkgPath) {\n throw new Error('missing package.json', {cause: {cwd}})\n }\n\n const config = await loadConfig({cwd, pkgPath})\n const {parseStrictOptions} = await import('./strict.ts')\n const strictOptions = parseStrictOptions(config?.strictOptions ?? {})\n const pkg = await loadPkgWithReporting({pkgPath, logger, strict, strictOptions})\n const tsconfig = tsconfigOption || config?.tsconfig || 'tsconfig.json'\n\n return resolveBuildContext({config, cwd, logger, pkg, strict, tsconfig})\n }),\n )\n\n const ctxSubscription: Subscription = ctx$.subscribe(async (ctx) => {\n const id = ++runId\n const runBundles: TsdownBundle[] = []\n try {\n await disposeBundles()\n\n // Full builds write the conditional `./<css>` export through tsdown's\n // `exports.customExports` composition, but watch mode disables tsdown's `exports` feature\n // (a package.json write per rebuild would loop the watcher). Keep the export in sync here\n // instead, once per context, like v11 — the write is idempotent, so it won't loop.\n const vanillaExtract = ctx.config?.vanillaExtract\n if (vanillaExtract) {\n const veOptions = vanillaExtract === true ? {} : vanillaExtract\n // `@sanity/tsdown-config` defaults `inject` to `{nodeCompat: true}` (the conditional\n // CSS export pattern); an explicit user `inject` replaces that default\n const inject = veOptions.inject ?? {nodeCompat: true}\n if (isRecord(inject) && inject['nodeCompat']) {\n await writeBundleCssExports({\n cwd,\n distPath: ctx.distPath,\n cssName: veOptions.fileName || 'bundle.css',\n logger,\n })\n }\n }\n\n const builds = resolveTsdownBuilds(ctx)\n\n let first = true\n for (const buildDef of builds) {\n if (id !== runId) break\n\n const inlineConfig = await resolveTsdownConfig(ctx, buildDef, {\n clean: first,\n watch: true,\n })\n first = false\n\n runBundles.push(...(await tsdownBuild(inlineConfig)))\n }\n\n if (id !== runId) {\n // A newer run (or the abort signal) took over while this rebuild was in flight —\n // dispose everything this run created instead of publishing it\n for (const bundle of runBundles) {\n await bundle[asyncDispose]()\n }\n return\n }\n\n bundles = runBundles\n\n logger.success(`${ctx.pkg.name}: watching for file changes\\u2026`)\n logger.log()\n } catch (err) {\n ctx.logger.error(err)\n ctx.logger.log()\n\n process.exit(1)\n }\n })\n\n if (signal) {\n signal.addEventListener(\n 'abort',\n () => {\n runId++\n ctxSubscription.unsubscribe()\n void disposeBundles()\n },\n {once: true},\n )\n }\n}\n","import {watch} from '../node/watch.ts'\nimport {handleError} from './handleError.ts'\n\nexport async function watchAction(options: {strict?: boolean; tsconfig?: string}): Promise<void> {\n try {\n await watch({\n cwd: process.cwd(),\n strict: options.strict,\n tsconfig: options.tsconfig,\n })\n } catch (err) {\n handleError(err)\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAUA,SAAgB,gBAAgB,aAA6B;CAC3D,OAAO,GAAG,YAAY,QAAQ,UAAU,MAAM,EAAE;AAClD;;;;;;AAOA,SAAgB,mBAAmB,aAA6B;CAC9D,OAAO,GAAG,YAAY,QAAQ,UAAU,MAAM,EAAE;AAClD;;;;;;;;;;;;;;;;;;;;;ACKA,SAAS,2BAA2B,SAAiB,UAAkB,aAAqB;CAC1F,OAAO;EAAC,OAAO;EAAa,SAAS;EAAS,OAAO;EAAS,MAAM;EAAU,SAAS;CAAQ;AACjG;AAEA,SAAS,kBAAkB,OAAgB,UAA2C;CACpF,IAAI,OAAO,SAAU,aAAY,OAAgB,OAAO;CACxD,IAAM,SAAS,OAAO,YAAY,OAAO,QAAQ,KAAK,CAAC,GACjD,OAAO,OAAO,KAAK,QAAQ;CACjC,OACE,KAAK,WAAW,OAAO,KAAK,MAAM,CAAC,CAAC,UAAU,KAAK,OAAO,QAAQ,OAAO,SAAS,SAAS,IAAI;AAEnG;;;;;AAMA,SAAS,gBACP,SACA,WACA,mBACyB;CACzB,IAAM,cAAuC,CAAC,GAC1C,WAAW;CACf,KAAK,IAAM,CAAC,KAAK,UAAU,OAAO,QAAQ,OAAO,GAC3C,QAAQ,cACR,QAAQ,oBAAoB,CAAC,aAC/B,YAAY,aAAa,mBACzB,WAAW,KAEb,YAAY,OAAO;CAKrB,OAHK,aACH,YAAY,aAAa,oBAEpB;AACT;AAEA,SAAS,aAAa,QAAiC;CACrD,IAAM,QA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