Files
composiohq__composio/tsdown.config.base.ts
T
Alberto Schiabel 20bf1b6345 chore(ts): quiet tsdown build warnings (#3665)
This PR:
- migrates shared tsdown dependency config from deprecated `external` /
`noExternal` aliases to `deps.neverBundle` / `deps.alwaysBundle`
- disables noisy Rolldown plugin timing and ineffective dynamic-import
diagnostics in shared config while keeping build checks enabled
- fixes the `json-schema-to-zod` `JSONSchema7TypeName` import so it
stays type-only
- keeps the CLI bundle graph aligned with `next` while quieting the
dynamic-import warning through `checks.ineffectiveDynamicImport: false`
- makes the Node file E2Es treat the current external storage
`Unauthorized` upload response as an explicit `UPLOAD_UNAVAILABLE`/skip
outcome instead of failing unrelated SDK build PRs

Verification:
- `pnpm build`
- build log scan for `WARN`, deprecated `external` / `noExternal`,
`deps.onlyBundle`, `PLUGIN_TIMINGS`, and `INEFFECTIVE_DYNAMIC_IMPORT`
- `pnpm --dir ts/packages/cli test -- --runInBand`
- `pnpm --dir ts/e2e-tests/runtimes/node/file-roundtrip typecheck`
- `pnpm --dir ts/e2e-tests/runtimes/node/tool-router-files typecheck`
- `pnpm lint:packages`
- CI: TypeScript build/typecheck/test and Node 22/24/25, Deno,
Cloudflare, and CLI e2e are green on the latest commit
2026-06-26 12:17:33 +04:00

113 lines
2.9 KiB
TypeScript

import type { UserConfig } from 'tsdown';
// Turbo task execution triggers a tsdown tarball-pack path bug for scoped packages:
// an intermittent ENOENT while reading the packed `.tgz` (e.g. composio-anthropic-*.tgz).
// tsdown packs the tarball once and shares it between ATTW and publint, and only runs the
// pack when at least one of them is enabled — so BOTH must be disabled to skip the pack
// under Turbo. Keep both checks for direct package builds; disable them for workspace builds.
const isTurboTask = Boolean(process.env.TURBO_HASH);
export const baseNeverBundle: Array<string | RegExp> = ['zod', '@composio/core', /^node:/];
/**
* tsdown config with shared defaults.
* Package-specific options (e.g., entry, outDir, outExtensions) can be overridden by the caller.
* Paths are relative to the closest `tsdown.config.ts` file that imports this config.
*/
export const baseConfig = {
/**
* Entry points for the build.
*/
entry: ['src/index.ts'],
/**
* Output directory for the build.
*/
outDir: 'dist',
outExtensions: () => ({
js: '.mjs',
dts: '.d.mts',
}),
/**
* Configures the output formats for the build.
* - 'esm' generates ESM (ECMAScript Module) output
*/
format: ['esm'],
/**
* Generates TypeScript declaration files (.d.mts, .d.ts)
*/
dts: true,
/**
* Clean `outDir` before each build.
*/
clean: true,
/**
* Compress code to reduce bundle size.
*/
minify: false,
/**
* Target ECMAScript version for the output.
*/
target: 'es2022',
/**
* Callback function to execute after a successful build.
*/
onSuccess() {
console.info('🙏 Build succeeded!');
},
deps: {
/**
* Dependencies that should not be bundled, but provided by the consumer.
*/
neverBundle: baseNeverBundle,
/**
* Workspace packages intentionally bundle selected dependencies today. Keep
* that behavior explicit without emitting per-package hint noise.
*/
onlyBundle: false,
},
/**
* Control how Node.js built-in module imports are handled.
* When true, imports like `fs` are transformed to `node:fs`.
*/
nodeProtocol: true,
checks: {
pluginTimings: false,
ineffectiveDynamicImport: false,
},
/**
* Configuration for @arethetypeswrong/cli.
* Uses '.' entrypoint to check the package root via the exports field,
* since src/index.ts is only used during development and not exported.
* Uses the ESM-only profile because packages no longer publish CJS entrypoints.
*/
attw: {
entrypoints: ['.'],
enabled: !isTurboTask,
level: 'error',
profile: 'esm-only',
ignoreRules: [
/* Node.js 10 only, attw doesn't automatically exclude it despite the selected profile */ 'internal-resolution-error',
],
},
/**
* Configuration for publint.
*/
publint: {
enabled: !isTurboTask,
level: 'error',
pack: 'pnpm',
},
} satisfies UserConfig;