@sanity/tsdown-config 0.18.0 → 0.19.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/README.md CHANGED
@@ -130,6 +130,56 @@ Two Sanity-flavored defaults diverge from the bare plugins (which match `@tsdown
130
130
  case. `target: false` disables lowering entirely, and a user-provided `lightningcss.targets`
131
131
  wins over the fallback.
132
132
 
133
+ `vanillaExtract` can be combined with the [`css` option](#css) below when a package also uses
134
+ CSS modules (or other `@tsdown/css` features) — the two pipelines write to different files by
135
+ default (`bundle.css` vs `style.css`) and do not interfere with each other.
136
+
137
+ ## css
138
+
139
+ tsdown's experimental [`css` option](https://tsdown.dev/options/css) is passed through as-is.
140
+ It enables the `@tsdown/css` pipeline for CSS modules, preprocessors, Lightning CSS / PostCSS,
141
+ inject, and related features. Install [`@tsdown/css`](https://www.npmjs.com/package/@tsdown/css)
142
+ in the project first — `@sanity/tsdown-config` only forwards the option and does not depend on
143
+ `@tsdown/css` itself:
144
+
145
+ ```sh
146
+ pnpm add --save-dev @tsdown/css
147
+ ```
148
+
149
+ ```ts
150
+ import {defineConfig} from '@sanity/tsdown-config'
151
+
152
+ export default defineConfig({
153
+ tsconfig: 'tsconfig.dist.json',
154
+ css: {
155
+ inject: true,
156
+ modules: {localsConvention: 'camelCase'},
157
+ },
158
+ })
159
+ ```
160
+
161
+ Both `css` and `vanillaExtract` can be enabled in the same config. Use that when a package
162
+ authors styles with vanilla-extract _and_ CSS modules (`.module.css`):
163
+
164
+ ```ts
165
+ import {defineConfig} from '@sanity/tsdown-config'
166
+
167
+ export default defineConfig({
168
+ tsconfig: 'tsconfig.dist.json',
169
+ vanillaExtract: true,
170
+ css: {
171
+ inject: true,
172
+ modules: {localsConvention: 'camelCase'},
173
+ },
174
+ })
175
+ ```
176
+
177
+ vanilla-extract extracts into `dist/bundle.css` by default (with the conditional
178
+ `"./bundle.css"` export when `inject` stays at its Sanity default), while `@tsdown/css` merges
179
+ other CSS — including scoped CSS modules — into `dist/style.css`. See the
180
+ [`InlineConfig.css`](https://tsdown.dev/reference/api/Interface.InlineConfig#css) API reference
181
+ for the full option surface.
182
+
133
183
  ## dts
134
184
 
135
185
  tsdown's [`dts` option](https://tsdown.dev/options/dts) is passed through as-is. By default tsdown
@@ -309,6 +359,23 @@ export default defineConfig({
309
359
  })
310
360
  ```
311
361
 
362
+ ## checks
363
+
364
+ Rolldown's [`checks.circularDependency`](https://rolldown.rs/reference/InputOptions.checks#circulardependency)
365
+ warning is enabled by default (Rolldown itself defaults it to `false`). Circular imports inflate
366
+ bundle size and can cause execution-order issues, so library builds surface them as warnings.
367
+
368
+ To turn the warning off, merge over the returned config:
369
+
370
+ ```ts
371
+ import {defineConfig} from '@sanity/tsdown-config'
372
+ import {mergeConfig} from 'tsdown'
373
+
374
+ export default mergeConfig(await defineConfig({tsconfig: 'tsconfig.dist.json'}), {
375
+ checks: {circularDependency: false},
376
+ })
377
+ ```
378
+
312
379
  ## Everything else: `mergeConfig`
313
380
 
314
381
  `defineConfig` deliberately only exposes options you're likely to change. For anything else, merge
package/dist/index.d.mts CHANGED
@@ -120,6 +120,16 @@ interface PackageOptions extends Pick<UserConfig, "tsconfig" | "entry" | "format
120
120
  * would replace the array). Other `deps` fields pass through as-is.
121
121
  */
122
122
  deps?: UserConfig["deps"];
123
+ /**
124
+ * tsdown's experimental [`css` option](https://tsdown.dev/options/css) (CSS modules,
125
+ * preprocessors, Lightning CSS / PostCSS, inject, etc). Passed through as-is — requires
126
+ * [`@tsdown/css`](https://www.npmjs.com/package/@tsdown/css) to be installed in the project.
127
+ * Safe to combine with {@link PackageOptions.vanillaExtract}: vanilla-extract extracts into
128
+ * `bundle.css` by default, while `@tsdown/css` merges other CSS (including `.module.css`)
129
+ * into `style.css`, so the two pipelines do not collide.
130
+ * @see https://tsdown.dev/reference/api/Interface.InlineConfig#css
131
+ */
132
+ css?: UserConfig["css"];
123
133
  /**
124
134
  * Runs `babel-plugin-react-compiler` on the source files before they are bundled, so published
125
135
  * components are memoized automatically. Pass `true` to use the defaults, or an options object
@@ -150,6 +160,9 @@ interface PackageOptions extends Pick<UserConfig, "tsconfig" | "entry" | "format
150
160
  * `import "<pkg>/bundle.css"`, emits a `bundle-css.js` shim, and writes the conditional
151
161
  * `"./bundle.css"` export to `package.json` - see {@link PackageVanillaExtractOptions}.
152
162
  * This is the same feature as `rollup.vanillaExtract` in `@sanity/pkg-utils`.
163
+ *
164
+ * Combines with {@link PackageOptions.css}: enable both when a package uses vanilla-extract
165
+ * alongside CSS modules (or other `@tsdown/css` features).
153
166
  * @alpha
154
167
  */
155
168
  vanillaExtract?: boolean | PackageVanillaExtractOptions;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.mts","names":[],"sources":["../src/index.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;KA8BY,+BAA+B;;;;;UAM1B;;EAEf;;;;;EAKA;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;EACA;;EAEA;;;;;;;;;KAUU,uBAAuB,QAAQ;;;;UAK1B,uBAAuB,KACtC;;;;;;;;;;;;;EAeA,WAAW;;;;;;;;;;;;;;;;;;;EAmBX,QAAQ;;;;;;;;;;;;;;;EAeR,UAAU;;;;;;;EAOV,YAAY;;;;;;EAMZ,OAAO;;;;;;;;;;EAUP,0BAA0B;;;;;;;;EAQ1B,6BAA6B;;;;;;;;;;;;;;;EAe7B,2BAA2B;;;;;iBAMP,aAAa,UAAS,iBAAsB,QAAQ"}
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../src/index.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;KA8BY,+BAA+B;;;;;UAM1B;;EAEf;;;;;EAKA;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;EACA;;EAEA;;;;;;;;;KAUU,uBAAuB,QAAQ;;;;UAK1B,uBAAuB,KACtC;;;;;;;;;;;;;EAeA,WAAW;;;;;;;;;;;;;;;;;;;EAmBX,QAAQ;;;;;;;;;;;;;;;EAeR,UAAU;;;;;;;EAOV,YAAY;;;;;;EAMZ,OAAO;;;;;;;;;;EAUP,MAAM;;;;;;;;;;EAUN,0BAA0B;;;;;;;;EAQ1B,6BAA6B;;;;;;;;;;;;;;;;;;EAkB7B,2BAA2B;;;;;iBAMP,aAAa,UAAS,iBAAsB,QAAQ"}
package/dist/index.mjs CHANGED
@@ -4,7 +4,7 @@ import { defineConfig as defineConfig$1, mergeConfig } from "tsdown";
4
4
  * @public
5
5
  */
6
6
  async function defineConfig(options = {}) {
7
- let { entry, tsconfig, dts, define, target, outDir, clean } = options, platform = options.platform ?? "neutral", sourcemap = options.sourcemap ?? !0, reactCompiler = options.reactCompiler ?? !1, styledComponents = options.styledComponents ?? !1, report = { gzip: !1 }, format = options.format ?? "esm", inputOptions = {
7
+ let { entry, tsconfig, dts, define, target, outDir, clean, css } = options, platform = options.platform ?? "neutral", sourcemap = options.sourcemap ?? !0, reactCompiler = options.reactCompiler ?? !1, styledComponents = options.styledComponents ?? !1, report = { gzip: !1 }, format = options.format ?? "esm", inputOptions = {
8
8
  preserveEntrySignatures: "strict",
9
9
  experimental: { attachDebugInfo: "none" },
10
10
  ...platform === "neutral" && { resolve: { mainFields: ["module", "main"] } },
@@ -48,7 +48,9 @@ async function defineConfig(options = {}) {
48
48
  ...(await detect({ cwd: process.cwd() }))?.name === "pnpm" && { devExports: !0 }
49
49
  } }, { exports: options.exports });
50
50
  return defineConfig$1({
51
+ checks: { circularDependency: !0 },
51
52
  clean,
53
+ css,
52
54
  define,
53
55
  deps,
54
56
  dts,
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":["defineTsdownConfig"],"sources":["../src/index.ts"],"sourcesContent":["import type {Options as VanillaExtractPluginOptions} from '@sanity/vanilla-extract-tsdown-plugin'\nimport type {PluginOptions as ReactCompilerPluginOptions} from 'babel-plugin-react-compiler'\nimport {detect} from 'package-manager-detector/detect'\nimport {\n defineConfig as defineTsdownConfig,\n mergeConfig,\n type Rolldown,\n type UserConfig,\n} from 'tsdown'\n\n/**\n * Options for the `vanillaExtract` option — the same options as\n * `@sanity/vanilla-extract-tsdown-plugin` (`identifiers`, `fileName`, `minify`, `target`,\n * `lightningcss`, and `inject`, all modeled after the `css` options of `@tsdown/css`), with\n * three Sanity-flavored defaults on top:\n *\n * - `inject` defaults to `{nodeCompat: true}` (instead of the plugin's `false`), wiring up the\n * conditional CSS export pattern that Sanity libraries ship with. Set `inject: true` for a\n * plain relative CSS import, or `inject: false` to only extract the CSS.\n * - `minify` defaults to `true` (instead of the plugin's `false`, which matches `css.minify`\n * in `@tsdown/css`): published Sanity libraries ship minified CSS. Set `minify: false` for\n * readable output.\n * - When the effective CSS syntax lowering target (`target`, falling back to the top-level\n * `target`) is undefined or names no browsers (e.g. `'node20'`, resolved from\n * `engines.node`), the lowering targets are resolved from `@sanity/browserslist-config` and\n * passed through `lightningcss.targets` — where the plugin (like `@tsdown/css`) would skip\n * lowering. `target: false` stays the explicit off switch, and a user-provided\n * `lightningcss.targets` wins over the fallback.\n * @public\n */\nexport type PackageVanillaExtractOptions = VanillaExtractPluginOptions\n\n/**\n * Options for the `styled-components` transform, the same options as `babel-plugin-styled-components`.\n * @public\n */\nexport interface StyledComponentsOptions {\n /** @defaultValue true */\n displayName?: boolean\n /**\n * @defaultValue []\n * @example [\"\\@xstyled/styled-components\", \"\\@xstyled/styled-components/*\"]\n */\n topLevelImportPaths?: string[]\n /** @defaultValue true */\n ssr?: boolean\n /** @defaultValue false */\n fileName?: boolean\n /** @defaultValue [\"index\"] */\n meaninglessFileNames?: string[]\n /** @defaultValue true */\n minify?: boolean\n /** @defaultValue false */\n transpileTemplateLiterals?: boolean\n namespace?: string\n /** @defaultValue true */\n pure?: boolean\n}\n\n/**\n * Options for the React Compiler, the same options as `babel-plugin-react-compiler`.\n * The typings resolve in userland once `babel-plugin-react-compiler` (an optional peer\n * dependency, required to use `reactCompiler`) is installed, and always match the installed\n * version of the compiler.\n * @public\n */\nexport type ReactCompilerOptions = Partial<ReactCompilerPluginOptions>\n\n/**\n * @public\n */\nexport interface PackageOptions extends Pick<\n UserConfig,\n 'tsconfig' | 'entry' | 'format' | 'dts' | 'define' | 'target' | 'outDir'\n> {\n /**\n * @defaultValue 'neutral'\n *\n * When left at `'neutral'` (the default), two resolution tweaks compensate for rolldown's\n * strict neutral defaults: `deps.neverBundle` includes `/^node:/` (node built-ins stay external\n * so neutral does not warn about them as unresolvable; only node runtimes execute those code\n * paths), and `inputOptions.resolve.mainFields` falls back to `['module', 'main']` for inlined\n * dependencies that ship no `exports` map (e.g. `rxjs-etc/operators`). Prefer `'neutral'` over\n * `'node'` for packages that also run in the browser - `'node'` makes CommonJS-interop emit a\n * module-scope `createRequire(import.meta.url)` for inlined CJS deps, which crashes\n * browser-bundled consumers.\n */\n platform?: UserConfig['platform']\n /**\n * Clean directories before each build. Prefer an array of folders over a separate `\"clean\"`\n * script in `package.json` (e.g. `rimraf dist coverage`) — tsdown removes them as part of\n * `tsdown` / `pnpm build`, so packages don't need `rimraf`, a `clean` script, or\n * `prebuild`/`run-s clean build` wiring.\n *\n * - `true` (tsdown's default when left undefined) cleans `outDir` (`'dist'` by default)\n * - `false` skips cleaning\n * - a `string[]` replaces that default with the listed paths/globs — include `outDir` (e.g.\n * `'dist'`) when you still want it cleaned alongside other folders\n *\n * @defaultValue true\n * @example\n * ```ts\n * // Instead of `\"clean\": \"rimraf dist coverage\"` in package.json:\n * clean: ['dist', 'coverage']\n * ```\n */\n clean?: UserConfig['clean']\n /**\n * tsdown's `exports` option, with defaults suited for publishing Sanity libraries:\n * `enabled: 'local-only'` generates the `exports` map during local builds and skips it in CI\n * (where the committed `package.json` is already up to date). When pnpm is detected,\n * `devExports: true` also keeps the local `exports` map pointing at source files while\n * `publishConfig.exports` receives the built files.\n *\n * Userland values apply with tsdown's `mergeConfig` semantics: an object deep-merges over\n * these defaults (so individual fields can be overridden), while any other value - `false`\n * to disable exports generation, or a bare CI condition (`'ci-only'`/`'local-only'`) -\n * replaces them entirely.\n * @defaultValue `{enabled: 'local-only', devExports: true}` for pnpm projects;\n * `{enabled: 'local-only'}` otherwise.\n */\n exports?: UserConfig['exports']\n /**\n * Whether to generate source map files. The same default as the `sourcemap` option in\n * `@sanity/pkg-utils` - tsdown itself defaults to `false` and does not read `sourceMap` from\n * the tsconfig.\n * @defaultValue true\n */\n sourcemap?: UserConfig['sourcemap']\n /**\n * tsdown's `deps` option. When `platform` is `'neutral'` (the default), `neverBundle` always\n * includes `/^node:/` and userland `neverBundle` entries are appended (tsdown's `mergeConfig`\n * would replace the array). Other `deps` fields pass through as-is.\n */\n deps?: UserConfig['deps']\n /**\n * Runs `babel-plugin-react-compiler` on the source files before they are bundled, so published\n * components are memoized automatically. Pass `true` to use the defaults, or an options object\n * to configure the compiler (e.g. `{target: '18'}`).\n * This is the same feature as the `babel: {reactCompiler: true}` and `reactCompilerOptions`\n * options in `@sanity/pkg-utils`. Unlike `styledComponents` there's no oxc native port of the\n * React Compiler yet, so `babel-plugin-react-compiler` needs to be installed.\n * @defaultValue false\n */\n reactCompiler?: boolean | ReactCompilerOptions\n /**\n * Applies the `styled-components` transform (`displayName`, `componentId`, CSS minification, etc)\n * with the same defaults as the `babel: {styledComponents: true}` option in `@sanity/pkg-utils`.\n * Unlike `@sanity/pkg-utils` it doesn't use `babel-plugin-styled-components`, but oxc's native port of it,\n * so there's no need to install babel dependencies.\n * @defaultValue false\n */\n styledComponents?: boolean | StyledComponentsOptions\n /**\n * Enables `@sanity/vanilla-extract-tsdown-plugin` to extract CSS into a separate file,\n * minified and lowered with `lightningcss`. The lowering targets come from the effective\n * `target` (`vanillaExtract.target`, falling back to the top-level `target`) when it names\n * browsers; when it's undefined or browserless (e.g. `'node20'`), they're resolved from\n * `@sanity/browserslist-config` instead — see {@link PackageVanillaExtractOptions}. Pass\n * `true` to use the defaults, or an object to customize.\n *\n * By default (`inject: {nodeCompat: true}`) the plugin also injects the self-referential\n * `import \"<pkg>/bundle.css\"`, emits a `bundle-css.js` shim, and writes the conditional\n * `\"./bundle.css\"` export to `package.json` - see {@link PackageVanillaExtractOptions}.\n * This is the same feature as `rollup.vanillaExtract` in `@sanity/pkg-utils`.\n * @alpha\n */\n vanillaExtract?: boolean | PackageVanillaExtractOptions\n}\n\n/**\n * @public\n */\nexport async function defineConfig(options: PackageOptions = {}): Promise<UserConfig> {\n // `tsconfig`, `entry`, `dts`, `define`, `target`, `outDir` and `clean` are passed through to\n // tsdown as-is. When left undefined, tsdown keeps its default behavior (`tsconfig` is\n // auto-detected from the project, `dts` from `package.json`, `define` replaces nothing,\n // `target` applies no syntax downleveling, `outDir` defaults to `'dist'`, and `clean`\n // defaults to `true` — cleaning `outDir` before each build).\n const {entry, tsconfig, dts, define, target, outDir, clean} = options\n const platform = options.platform ?? 'neutral'\n const sourcemap = options.sourcemap ?? true\n const reactCompiler = options.reactCompiler ?? false\n const styledComponents = options.styledComponents ?? false\n const report = {gzip: false} as const satisfies UserConfig['report']\n const publint = true\n const format = options.format ?? 'esm'\n // When `platform` is `'neutral'`, restore the conventional `module`/`main` fallback that\n // rolldown's strict neutral defaults drop - needed for inlined deps without an `exports` map.\n const inputOptions = {\n // https://github.com/rolldown/rolldown/blob/main/packages/rolldown/src/options/docs/preserve-entry-signatures.md#strict\n preserveEntrySignatures: 'strict',\n experimental: {attachDebugInfo: 'none'},\n ...(platform === 'neutral' && {\n resolve: {mainFields: ['module', 'main']},\n }),\n ...(styledComponents !== false && {\n transform: {\n plugins: {\n styledComponents: {\n // The same defaults as `babel: {styledComponents: true}` in `@sanity/pkg-utils`:\n // `fileName` is unnecessary, as the way we use styled-components in Sanity is usually by wrapping\n // `@sanity/ui` primitives, not declaring new ones like \"const Button = styled.button``\"\n fileName: false,\n // Native template literals take less space than this transpilation, and unlike\n // `babel-plugin-styled-components`, oxc doesn't add a `@__PURE__` annotation to the\n // transpiled call expression either, so enabling it wouldn't improve tree-shaking\n transpileTemplateLiterals: false,\n // Helps dead code elimination and tree-shaking, although oxc only annotates plain call\n // expressions so far, not tagged template expressions (https://github.com/rollup/rollup/issues/4035)\n pure: true,\n // Disabled, as tsdown tends to be used for npm publishing, while other tooling,\n // like `sanity dev`, `next dev`, etc are used for testing\n cssProp: false,\n ...(typeof styledComponents === 'object' ? styledComponents : {}),\n },\n },\n },\n }),\n } satisfies UserConfig['inputOptions']\n\n // `neverBundle` is concatenated (not `mergeConfig`'d) so per-package externals add to the\n // `/^node:/` default for `platform: 'neutral'` instead of replacing it. Rolldown's\n // `ExternalOption` array form is `Array<string | RegExp>` only; a function override is composed.\n const userNeverBundle = options.deps?.neverBundle\n const nodeBuiltinExternal = platform === 'neutral' ? /^node:/ : undefined\n const neverBundle: NonNullable<UserConfig['deps']>['neverBundle'] =\n userNeverBundle == null\n ? nodeBuiltinExternal && [nodeBuiltinExternal]\n : nodeBuiltinExternal == null\n ? userNeverBundle\n : typeof userNeverBundle === 'function'\n ? (id, importer, isResolved) =>\n nodeBuiltinExternal.test(id) || userNeverBundle(id, importer, isResolved)\n : [\n nodeBuiltinExternal,\n ...(Array.isArray(userNeverBundle) ? userNeverBundle : [userNeverBundle]),\n ]\n const deps: UserConfig['deps'] =\n options.deps === undefined && neverBundle === undefined\n ? undefined\n : {\n ...options.deps,\n ...(neverBundle === undefined ? {} : {neverBundle}),\n }\n\n // `outputOptions` is left to tsdown's defaults - notably chunk filenames keep tsdown's hashed\n // default (unless userland sets `hash`), which prevents chunk/entry filename collisions\n // (https://github.com/sanity-io/ui/issues/2262).\n const plugins: Rolldown.Plugin[] = []\n if (reactCompiler !== false) {\n // Follows the official tsdown recipe for the React Compiler:\n // https://tsdown.dev/recipes/react-support#enabling-react-compiler\n // The plugins are lazy loaded so they're only paid for when the React Compiler is enabled.\n // `babel-plugin-react-compiler` itself is resolved by Babel from the consumer package during\n // the build, which is why it can be an optional peer dependency. Once rolldown ships its rust\n // port of the React Compiler this can be swapped out for an oxc transform, like `styledComponents`.\n const [{default: pluginBabel}, {reactCompilerPreset}] = await Promise.all([\n import('@rolldown/plugin-babel'),\n import('@vitejs/plugin-react'),\n ])\n plugins.push(\n await pluginBabel({\n presets: [reactCompilerPreset(typeof reactCompiler === 'object' ? reactCompiler : {})],\n }),\n )\n }\n if (options.vanillaExtract) {\n // Lazy loaded, like `reactCompiler`, so the CSS toolchain is only paid for when the option is\n // enabled. The plugin compiles the `.css.ts` files and extracts the CSS into a single file.\n // Its `inject` option is general purpose (and, like `css.inject` in `@tsdown/css`, disabled\n // by default), so this config supplies the default most Sanity libraries want:\n // `{nodeCompat: true}` wires up the whole conditional CSS export pattern - the\n // self-referential CSS import, the no-op JS shim, and the conditional `./<fileName>` export\n // written through this config's `exports` option (which the plugin's `tsdownConfig` hook\n // composes into).\n const {esbuildTargetToLightningCSS, vanillaExtractPlugin} =\n await import('@sanity/vanilla-extract-tsdown-plugin')\n const vanillaExtract = options.vanillaExtract === true ? {} : options.vanillaExtract\n\n // The plugin follows `@tsdown/css`: without browser targets, CSS syntax lowering is\n // skipped. The extracted CSS always runs in browsers, so when the effective target\n // (`vanillaExtract.target`, falling back to the top-level `target`) is undefined or names\n // no browsers (e.g. `'node20'` - also what tsdown derives from `engines.node`, which\n // speaks to the JS runtime), this config resolves the lowering targets from\n // `@sanity/browserslist-config` and passes them through `lightningcss.targets` instead.\n // `target: false` stays the explicit off switch, and a user-provided\n // `lightningcss.targets` wins over the fallback.\n const cssTarget = vanillaExtract.target ?? target\n let {lightningcss} = vanillaExtract\n if (\n cssTarget !== false &&\n !lightningcss?.targets &&\n (cssTarget === undefined || !esbuildTargetToLightningCSS(cssTarget))\n ) {\n // Lazy loaded as well: `browserslistToTargets` is a pure helper, but `lightningcss` is a\n // native package that only needs to load when the fallback applies\n const [{default: browserslist}, {default: browserslistConfig}, {browserslistToTargets}] =\n await Promise.all([\n import('browserslist'),\n import('@sanity/browserslist-config'),\n import('lightningcss'),\n ])\n lightningcss = {\n ...lightningcss,\n targets: browserslistToTargets(browserslist(browserslistConfig)),\n }\n }\n\n plugins.push(\n vanillaExtractPlugin({\n inject: {nodeCompat: true},\n minify: true,\n ...vanillaExtract,\n lightningcss,\n }),\n )\n }\n\n const packageManager = await detect({cwd: process.cwd()})\n // tsdown's `exports` feature is enabled with Sanity-flavored defaults, and userland values\n // apply with tsdown's own `mergeConfig` semantics: an object deep-merges over the defaults,\n // anything else (`false`, a CI condition) replaces them.\n const {exports} = mergeConfig(\n {\n exports: {\n enabled: 'local-only',\n // Only opt in by default when pnpm is detected: support for replacing package fields\n // from `publishConfig` is not reliable across package managers.\n ...(packageManager?.name === 'pnpm' && {devExports: true}),\n },\n },\n {exports: options.exports},\n )\n\n return defineTsdownConfig({\n clean,\n define,\n deps,\n dts,\n entry,\n exports,\n format,\n inputOptions,\n outDir,\n platform,\n plugins,\n publint,\n report,\n sourcemap,\n target,\n tsconfig,\n minify: {compress: true, codegen: false, mangle: false},\n })\n}\n"],"mappings":";;;;;AA6KA,eAAsB,aAAa,UAA0B,CAAC,GAAwB;CAMpF,IAAM,EAAC,OAAO,UAAU,KAAK,QAAQ,QAAQ,QAAQ,UAAS,SACxD,WAAW,QAAQ,YAAY,WAC/B,YAAY,QAAQ,aAAa,IACjC,gBAAgB,QAAQ,iBAAiB,IACzC,mBAAmB,QAAQ,oBAAoB,IAC/C,SAAS,EAAC,MAAM,GAAK,GAErB,SAAS,QAAQ,UAAU,OAG3B,eAAe;EAEnB,yBAAyB;EACzB,cAAc,EAAC,iBAAiB,OAAM;EACtC,GAAI,aAAa,aAAa,EAC5B,SAAS,EAAC,YAAY,CAAC,UAAU,MAAM,EAAC,EAC1C;EACA,GAAI,qBAAqB,MAAS,EAChC,WAAW,EACT,SAAS,EACP,kBAAkB;GAIhB,UAAU;GAIV,2BAA2B;GAG3B,MAAM;GAGN,SAAS;GACT,GAAI,OAAO,oBAAqB,WAAW,mBAAmB,CAAC;EACjE,EACF,EACF,EACF;CACF,GAKM,kBAAkB,QAAQ,MAAM,aAChC,sBAAsB,aAAa,YAAY,WAAW,KAAA,GAC1D,cACJ,mBAAmB,OACf,uBAAuB,CAAC,mBAAmB,IAC3C,uBAAuB,OACrB,kBACA,OAAO,mBAAoB,cACxB,IAAI,UAAU,eACb,oBAAoB,KAAK,EAAE,KAAK,gBAAgB,IAAI,UAAU,UAAU,IAC1E,CACE,qBACA,GAAI,MAAM,QAAQ,eAAe,IAAI,kBAAkB,CAAC,eAAe,CACzE,GACJ,OACJ,QAAQ,SAAS,KAAA,KAAa,gBAAgB,KAAA,IAC1C,KAAA,IACA;EACE,GAAG,QAAQ;EACX,GAAI,gBAAgB,KAAA,IAAY,CAAC,IAAI,EAAC,YAAW;CACnD,GAKA,UAA6B,CAAC;CACpC,IAAI,kBAAkB,IAAO;EAO3B,IAAM,CAAC,EAAC,SAAS,eAAc,EAAC,yBAAwB,MAAM,QAAQ,IAAI,CACxE,OAAO,2BACP,OAAO,uBACT,CAAC;EACD,QAAQ,KACN,MAAM,YAAY,EAChB,SAAS,CAAC,oBAAoB,OAAO,iBAAkB,WAAW,gBAAgB,CAAC,CAAC,CAAC,EACvF,CAAC,CACH;CACF;CACA,IAAI,QAAQ,gBAAgB;EAS1B,IAAM,EAAC,6BAA6B,yBAClC,MAAM,OAAO,0CACT,iBAAiB,QAAQ,mBAAmB,KAAO,CAAC,IAAI,QAAQ,gBAUhE,YAAY,eAAe,UAAU,QACvC,EAAC,iBAAgB;EACrB,IACE,cAAc,MACd,CAAC,cAAc,YACd,cAAc,KAAA,KAAa,CAAC,4BAA4B,SAAS,IAClE;GAGA,IAAM,CAAC,EAAC,SAAS,gBAAe,EAAC,SAAS,sBAAqB,EAAC,2BAC9D,MAAM,QAAQ,IAAI;IAChB,OAAO;IACP,OAAO;IACP,OAAO;GACT,CAAC;GACH,eAAe;IACb,GAAG;IACH,SAAS,sBAAsB,aAAa,kBAAkB,CAAC;GACjE;EACF;EAEA,QAAQ,KACN,qBAAqB;GACnB,QAAQ,EAAC,YAAY,GAAI;GACzB,QAAQ;GACR,GAAG;GACH;EACF,CAAC,CACH;CACF;CAMA,IAAM,EAAC,YAAW,YAChB,EACE,SAAS;EACP,SAAS;EAGT,IAAI,MAVmB,OAAO,EAAC,KAAK,QAAQ,IAAI,EAAC,CAAC,EAAA,EAU9B,SAAS,UAAU,EAAC,YAAY,GAAI;CAC1D,EACF,GACA,EAAC,SAAS,QAAQ,QAAO,CAC3B;CAEA,OAAOA,eAAmB;EACxB;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,QAAQ;GAAC,UAAU;GAAM,SAAS;GAAO,QAAQ;EAAK;CACxD,CAAC;AACH"}
1
+ {"version":3,"file":"index.mjs","names":["defineTsdownConfig"],"sources":["../src/index.ts"],"sourcesContent":["import type {Options as VanillaExtractPluginOptions} from '@sanity/vanilla-extract-tsdown-plugin'\nimport type {PluginOptions as ReactCompilerPluginOptions} from 'babel-plugin-react-compiler'\nimport {detect} from 'package-manager-detector/detect'\nimport {\n defineConfig as defineTsdownConfig,\n mergeConfig,\n type Rolldown,\n type UserConfig,\n} from 'tsdown'\n\n/**\n * Options for the `vanillaExtract` option — the same options as\n * `@sanity/vanilla-extract-tsdown-plugin` (`identifiers`, `fileName`, `minify`, `target`,\n * `lightningcss`, and `inject`, all modeled after the `css` options of `@tsdown/css`), with\n * three Sanity-flavored defaults on top:\n *\n * - `inject` defaults to `{nodeCompat: true}` (instead of the plugin's `false`), wiring up the\n * conditional CSS export pattern that Sanity libraries ship with. Set `inject: true` for a\n * plain relative CSS import, or `inject: false` to only extract the CSS.\n * - `minify` defaults to `true` (instead of the plugin's `false`, which matches `css.minify`\n * in `@tsdown/css`): published Sanity libraries ship minified CSS. Set `minify: false` for\n * readable output.\n * - When the effective CSS syntax lowering target (`target`, falling back to the top-level\n * `target`) is undefined or names no browsers (e.g. `'node20'`, resolved from\n * `engines.node`), the lowering targets are resolved from `@sanity/browserslist-config` and\n * passed through `lightningcss.targets` — where the plugin (like `@tsdown/css`) would skip\n * lowering. `target: false` stays the explicit off switch, and a user-provided\n * `lightningcss.targets` wins over the fallback.\n * @public\n */\nexport type PackageVanillaExtractOptions = VanillaExtractPluginOptions\n\n/**\n * Options for the `styled-components` transform, the same options as `babel-plugin-styled-components`.\n * @public\n */\nexport interface StyledComponentsOptions {\n /** @defaultValue true */\n displayName?: boolean\n /**\n * @defaultValue []\n * @example [\"\\@xstyled/styled-components\", \"\\@xstyled/styled-components/*\"]\n */\n topLevelImportPaths?: string[]\n /** @defaultValue true */\n ssr?: boolean\n /** @defaultValue false */\n fileName?: boolean\n /** @defaultValue [\"index\"] */\n meaninglessFileNames?: string[]\n /** @defaultValue true */\n minify?: boolean\n /** @defaultValue false */\n transpileTemplateLiterals?: boolean\n namespace?: string\n /** @defaultValue true */\n pure?: boolean\n}\n\n/**\n * Options for the React Compiler, the same options as `babel-plugin-react-compiler`.\n * The typings resolve in userland once `babel-plugin-react-compiler` (an optional peer\n * dependency, required to use `reactCompiler`) is installed, and always match the installed\n * version of the compiler.\n * @public\n */\nexport type ReactCompilerOptions = Partial<ReactCompilerPluginOptions>\n\n/**\n * @public\n */\nexport interface PackageOptions extends Pick<\n UserConfig,\n 'tsconfig' | 'entry' | 'format' | 'dts' | 'define' | 'target' | 'outDir'\n> {\n /**\n * @defaultValue 'neutral'\n *\n * When left at `'neutral'` (the default), two resolution tweaks compensate for rolldown's\n * strict neutral defaults: `deps.neverBundle` includes `/^node:/` (node built-ins stay external\n * so neutral does not warn about them as unresolvable; only node runtimes execute those code\n * paths), and `inputOptions.resolve.mainFields` falls back to `['module', 'main']` for inlined\n * dependencies that ship no `exports` map (e.g. `rxjs-etc/operators`). Prefer `'neutral'` over\n * `'node'` for packages that also run in the browser - `'node'` makes CommonJS-interop emit a\n * module-scope `createRequire(import.meta.url)` for inlined CJS deps, which crashes\n * browser-bundled consumers.\n */\n platform?: UserConfig['platform']\n /**\n * Clean directories before each build. Prefer an array of folders over a separate `\"clean\"`\n * script in `package.json` (e.g. `rimraf dist coverage`) — tsdown removes them as part of\n * `tsdown` / `pnpm build`, so packages don't need `rimraf`, a `clean` script, or\n * `prebuild`/`run-s clean build` wiring.\n *\n * - `true` (tsdown's default when left undefined) cleans `outDir` (`'dist'` by default)\n * - `false` skips cleaning\n * - a `string[]` replaces that default with the listed paths/globs — include `outDir` (e.g.\n * `'dist'`) when you still want it cleaned alongside other folders\n *\n * @defaultValue true\n * @example\n * ```ts\n * // Instead of `\"clean\": \"rimraf dist coverage\"` in package.json:\n * clean: ['dist', 'coverage']\n * ```\n */\n clean?: UserConfig['clean']\n /**\n * tsdown's `exports` option, with defaults suited for publishing Sanity libraries:\n * `enabled: 'local-only'` generates the `exports` map during local builds and skips it in CI\n * (where the committed `package.json` is already up to date). When pnpm is detected,\n * `devExports: true` also keeps the local `exports` map pointing at source files while\n * `publishConfig.exports` receives the built files.\n *\n * Userland values apply with tsdown's `mergeConfig` semantics: an object deep-merges over\n * these defaults (so individual fields can be overridden), while any other value - `false`\n * to disable exports generation, or a bare CI condition (`'ci-only'`/`'local-only'`) -\n * replaces them entirely.\n * @defaultValue `{enabled: 'local-only', devExports: true}` for pnpm projects;\n * `{enabled: 'local-only'}` otherwise.\n */\n exports?: UserConfig['exports']\n /**\n * Whether to generate source map files. The same default as the `sourcemap` option in\n * `@sanity/pkg-utils` - tsdown itself defaults to `false` and does not read `sourceMap` from\n * the tsconfig.\n * @defaultValue true\n */\n sourcemap?: UserConfig['sourcemap']\n /**\n * tsdown's `deps` option. When `platform` is `'neutral'` (the default), `neverBundle` always\n * includes `/^node:/` and userland `neverBundle` entries are appended (tsdown's `mergeConfig`\n * would replace the array). Other `deps` fields pass through as-is.\n */\n deps?: UserConfig['deps']\n /**\n * tsdown's experimental [`css` option](https://tsdown.dev/options/css) (CSS modules,\n * preprocessors, Lightning CSS / PostCSS, inject, etc). Passed through as-is — requires\n * [`@tsdown/css`](https://www.npmjs.com/package/@tsdown/css) to be installed in the project.\n * Safe to combine with {@link PackageOptions.vanillaExtract}: vanilla-extract extracts into\n * `bundle.css` by default, while `@tsdown/css` merges other CSS (including `.module.css`)\n * into `style.css`, so the two pipelines do not collide.\n * @see https://tsdown.dev/reference/api/Interface.InlineConfig#css\n */\n css?: UserConfig['css']\n /**\n * Runs `babel-plugin-react-compiler` on the source files before they are bundled, so published\n * components are memoized automatically. Pass `true` to use the defaults, or an options object\n * to configure the compiler (e.g. `{target: '18'}`).\n * This is the same feature as the `babel: {reactCompiler: true}` and `reactCompilerOptions`\n * options in `@sanity/pkg-utils`. Unlike `styledComponents` there's no oxc native port of the\n * React Compiler yet, so `babel-plugin-react-compiler` needs to be installed.\n * @defaultValue false\n */\n reactCompiler?: boolean | ReactCompilerOptions\n /**\n * Applies the `styled-components` transform (`displayName`, `componentId`, CSS minification, etc)\n * with the same defaults as the `babel: {styledComponents: true}` option in `@sanity/pkg-utils`.\n * Unlike `@sanity/pkg-utils` it doesn't use `babel-plugin-styled-components`, but oxc's native port of it,\n * so there's no need to install babel dependencies.\n * @defaultValue false\n */\n styledComponents?: boolean | StyledComponentsOptions\n /**\n * Enables `@sanity/vanilla-extract-tsdown-plugin` to extract CSS into a separate file,\n * minified and lowered with `lightningcss`. The lowering targets come from the effective\n * `target` (`vanillaExtract.target`, falling back to the top-level `target`) when it names\n * browsers; when it's undefined or browserless (e.g. `'node20'`), they're resolved from\n * `@sanity/browserslist-config` instead — see {@link PackageVanillaExtractOptions}. Pass\n * `true` to use the defaults, or an object to customize.\n *\n * By default (`inject: {nodeCompat: true}`) the plugin also injects the self-referential\n * `import \"<pkg>/bundle.css\"`, emits a `bundle-css.js` shim, and writes the conditional\n * `\"./bundle.css\"` export to `package.json` - see {@link PackageVanillaExtractOptions}.\n * This is the same feature as `rollup.vanillaExtract` in `@sanity/pkg-utils`.\n *\n * Combines with {@link PackageOptions.css}: enable both when a package uses vanilla-extract\n * alongside CSS modules (or other `@tsdown/css` features).\n * @alpha\n */\n vanillaExtract?: boolean | PackageVanillaExtractOptions\n}\n\n/**\n * @public\n */\nexport async function defineConfig(options: PackageOptions = {}): Promise<UserConfig> {\n // `tsconfig`, `entry`, `dts`, `define`, `target`, `outDir`, `clean` and `css` are passed\n // through to tsdown as-is. When left undefined, tsdown keeps its default behavior\n // (`tsconfig` is auto-detected from the project, `dts` from `package.json`, `define`\n // replaces nothing, `target` applies no syntax downleveling, `outDir` defaults to `'dist'`,\n // `clean` defaults to `true` — cleaning `outDir` before each build — and `css` stays off\n // unless `@tsdown/css` is installed and the option is set).\n const {entry, tsconfig, dts, define, target, outDir, clean, css} = options\n const platform = options.platform ?? 'neutral'\n const sourcemap = options.sourcemap ?? true\n const reactCompiler = options.reactCompiler ?? false\n const styledComponents = options.styledComponents ?? false\n const report = {gzip: false} as const satisfies UserConfig['report']\n const publint = true\n const format = options.format ?? 'esm'\n // When `platform` is `'neutral'`, restore the conventional `module`/`main` fallback that\n // rolldown's strict neutral defaults drop - needed for inlined deps without an `exports` map.\n const inputOptions = {\n // https://github.com/rolldown/rolldown/blob/main/packages/rolldown/src/options/docs/preserve-entry-signatures.md#strict\n preserveEntrySignatures: 'strict',\n experimental: {attachDebugInfo: 'none'},\n ...(platform === 'neutral' && {\n resolve: {mainFields: ['module', 'main']},\n }),\n ...(styledComponents !== false && {\n transform: {\n plugins: {\n styledComponents: {\n // The same defaults as `babel: {styledComponents: true}` in `@sanity/pkg-utils`:\n // `fileName` is unnecessary, as the way we use styled-components in Sanity is usually by wrapping\n // `@sanity/ui` primitives, not declaring new ones like \"const Button = styled.button``\"\n fileName: false,\n // Native template literals take less space than this transpilation, and unlike\n // `babel-plugin-styled-components`, oxc doesn't add a `@__PURE__` annotation to the\n // transpiled call expression either, so enabling it wouldn't improve tree-shaking\n transpileTemplateLiterals: false,\n // Helps dead code elimination and tree-shaking, although oxc only annotates plain call\n // expressions so far, not tagged template expressions (https://github.com/rollup/rollup/issues/4035)\n pure: true,\n // Disabled, as tsdown tends to be used for npm publishing, while other tooling,\n // like `sanity dev`, `next dev`, etc are used for testing\n cssProp: false,\n ...(typeof styledComponents === 'object' ? styledComponents : {}),\n },\n },\n },\n }),\n } satisfies UserConfig['inputOptions']\n\n // `neverBundle` is concatenated (not `mergeConfig`'d) so per-package externals add to the\n // `/^node:/` default for `platform: 'neutral'` instead of replacing it. Rolldown's\n // `ExternalOption` array form is `Array<string | RegExp>` only; a function override is composed.\n const userNeverBundle = options.deps?.neverBundle\n const nodeBuiltinExternal = platform === 'neutral' ? /^node:/ : undefined\n const neverBundle: NonNullable<UserConfig['deps']>['neverBundle'] =\n userNeverBundle == null\n ? nodeBuiltinExternal && [nodeBuiltinExternal]\n : nodeBuiltinExternal == null\n ? userNeverBundle\n : typeof userNeverBundle === 'function'\n ? (id, importer, isResolved) =>\n nodeBuiltinExternal.test(id) || userNeverBundle(id, importer, isResolved)\n : [\n nodeBuiltinExternal,\n ...(Array.isArray(userNeverBundle) ? userNeverBundle : [userNeverBundle]),\n ]\n const deps: UserConfig['deps'] =\n options.deps === undefined && neverBundle === undefined\n ? undefined\n : {\n ...options.deps,\n ...(neverBundle === undefined ? {} : {neverBundle}),\n }\n\n // `outputOptions` is left to tsdown's defaults - notably chunk filenames keep tsdown's hashed\n // default (unless userland sets `hash`), which prevents chunk/entry filename collisions\n // (https://github.com/sanity-io/ui/issues/2262).\n const plugins: Rolldown.Plugin[] = []\n if (reactCompiler !== false) {\n // Follows the official tsdown recipe for the React Compiler:\n // https://tsdown.dev/recipes/react-support#enabling-react-compiler\n // The plugins are lazy loaded so they're only paid for when the React Compiler is enabled.\n // `babel-plugin-react-compiler` itself is resolved by Babel from the consumer package during\n // the build, which is why it can be an optional peer dependency. Once rolldown ships its rust\n // port of the React Compiler this can be swapped out for an oxc transform, like `styledComponents`.\n const [{default: pluginBabel}, {reactCompilerPreset}] = await Promise.all([\n import('@rolldown/plugin-babel'),\n import('@vitejs/plugin-react'),\n ])\n // `@rolldown/plugin-babel` types against rolldown 1.2.0 while `Rolldown.Plugin`\n // from tsdown is still rolled from ~1.1.5; structurally compatible at runtime but\n // tsc reports \"Excessive stack depth comparing types 'Plugin<any>'\".\n // @ts-expect-error — cross-version rolldown Plugin assignability\n plugins.push(\n // @ts-expect-error — cross-version rolldown Plugin assignability\n await pluginBabel({\n presets: [reactCompilerPreset(typeof reactCompiler === 'object' ? reactCompiler : {})],\n }),\n )\n }\n if (options.vanillaExtract) {\n // Lazy loaded, like `reactCompiler`, so the CSS toolchain is only paid for when the option is\n // enabled. The plugin compiles the `.css.ts` files and extracts the CSS into a single file.\n // Its `inject` option is general purpose (and, like `css.inject` in `@tsdown/css`, disabled\n // by default), so this config supplies the default most Sanity libraries want:\n // `{nodeCompat: true}` wires up the whole conditional CSS export pattern - the\n // self-referential CSS import, the no-op JS shim, and the conditional `./<fileName>` export\n // written through this config's `exports` option (which the plugin's `tsdownConfig` hook\n // composes into).\n const {esbuildTargetToLightningCSS, vanillaExtractPlugin} =\n await import('@sanity/vanilla-extract-tsdown-plugin')\n const vanillaExtract = options.vanillaExtract === true ? {} : options.vanillaExtract\n\n // The plugin follows `@tsdown/css`: without browser targets, CSS syntax lowering is\n // skipped. The extracted CSS always runs in browsers, so when the effective target\n // (`vanillaExtract.target`, falling back to the top-level `target`) is undefined or names\n // no browsers (e.g. `'node20'` - also what tsdown derives from `engines.node`, which\n // speaks to the JS runtime), this config resolves the lowering targets from\n // `@sanity/browserslist-config` and passes them through `lightningcss.targets` instead.\n // `target: false` stays the explicit off switch, and a user-provided\n // `lightningcss.targets` wins over the fallback.\n const cssTarget = vanillaExtract.target ?? target\n let {lightningcss} = vanillaExtract\n if (\n cssTarget !== false &&\n !lightningcss?.targets &&\n (cssTarget === undefined || !esbuildTargetToLightningCSS(cssTarget))\n ) {\n // Lazy loaded as well: `browserslistToTargets` is a pure helper, but `lightningcss` is a\n // native package that only needs to load when the fallback applies\n const [{default: browserslist}, {default: browserslistConfig}, {browserslistToTargets}] =\n await Promise.all([\n import('browserslist'),\n import('@sanity/browserslist-config'),\n import('lightningcss'),\n ])\n lightningcss = {\n ...lightningcss,\n targets: browserslistToTargets(browserslist(browserslistConfig)),\n }\n }\n\n plugins.push(\n vanillaExtractPlugin({\n inject: {nodeCompat: true},\n minify: true,\n ...vanillaExtract,\n lightningcss,\n }),\n )\n }\n\n const packageManager = await detect({cwd: process.cwd()})\n // tsdown's `exports` feature is enabled with Sanity-flavored defaults, and userland values\n // apply with tsdown's own `mergeConfig` semantics: an object deep-merges over the defaults,\n // anything else (`false`, a CI condition) replaces them.\n const {exports} = mergeConfig(\n {\n exports: {\n enabled: 'local-only',\n // Only opt in by default when pnpm is detected: support for replacing package fields\n // from `publishConfig` is not reliable across package managers.\n ...(packageManager?.name === 'pnpm' && {devExports: true}),\n },\n },\n {exports: options.exports},\n )\n\n return defineTsdownConfig({\n // Rolldown defaults `circularDependency` to `false`; enable it so Sanity library builds\n // surface import cycles (bigger bundles / execution-order hazards) as warnings.\n // Override via `mergeConfig(..., {checks: {circularDependency: false}})`.\n // https://rolldown.rs/reference/InputOptions.checks#circulardependency\n checks: {circularDependency: true},\n clean,\n css,\n define,\n deps,\n dts,\n entry,\n exports,\n format,\n inputOptions,\n outDir,\n platform,\n plugins,\n publint,\n report,\n sourcemap,\n target,\n tsconfig,\n minify: {compress: true, codegen: false, mangle: false},\n })\n}\n"],"mappings":"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"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sanity/tsdown-config",
3
- "version": "0.18.0",
3
+ "version": "0.19.0",
4
4
  "description": "Shared configuration for tsdown",
5
5
  "keywords": [
6
6
  "sanity-io",
@@ -46,6 +46,7 @@
46
46
  "@sanity/vanilla-extract-tsdown-plugin": "^0.2.2"
47
47
  },
48
48
  "devDependencies": {
49
+ "@tsdown/css": "0.22.8",
49
50
  "@types/babel__core": "^7.20.5",
50
51
  "babel-plugin-react-compiler": "^1.0.0",
51
52
  "rolldown": "^1.2.0",