@sanity/tsdown-config 0.16.0 → 0.17.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.
package/README.md CHANGED
@@ -71,8 +71,11 @@ export default defineConfig({
71
71
  ## vanilla-extract
72
72
 
73
73
  The same `vanillaExtract` feature as `@sanity/pkg-utils` is available. It extracts the CSS from
74
- `.css.ts` files into a separate, `lightningcss`-optimized file (`dist/bundle.css` by default).
75
- Under the hood it uses [`@sanity/vanilla-extract-tsdown-plugin`](https://github.com/sanity-io/pkg-utils/tree/main/packages/%40sanity/vanilla-extract-tsdown-plugin#readme),
74
+ `.css.ts` files into a separate file (`dist/bundle.css` by default), minified and lowered with
75
+ `lightningcss` for the
76
+ [`@sanity/browserslist-config`](https://github.com/sanity-io/browserslist-config#readme)
77
+ browsers by default. Under the hood it uses
78
+ [`@sanity/vanilla-extract-tsdown-plugin`](https://github.com/sanity-io/pkg-utils/tree/main/packages/@sanity/vanilla-extract-tsdown-plugin#readme),
76
79
  a tsdown-native port of `@vanilla-extract/rollup-plugin`, so enabling it doesn't pull `rollup`
77
80
  into your project. Start by installing `@vanilla-extract/css` for authoring the `.css.ts` files:
78
81
 
@@ -94,10 +97,10 @@ automatically:
94
97
 
95
98
  - injects the self-referential `import "<pkg>/bundle.css"` into the entry chunks that use
96
99
  vanilla-extract styles,
97
- - emits a no-op `bundle.css.js` shim (plus `bundle.css.d.ts`) for runtimes that cannot import
98
- `.css` files, and
99
- - writes the conditional `"./bundle.css"` export to `package.json` (`browser`/`style` → the real
100
- CSS, `node`/`default` → the shim).
100
+ - emits a no-op `bundle-css.js` shim (plus `bundle.css.d.ts` / `bundle-css.d.ts`) for runtimes
101
+ that cannot import `.css` files, and
102
+ - writes the conditional `"./bundle.css"` export to `package.json` (`types` → the shim's `.d.ts`,
103
+ `browser`/`style` → the real CSS, `node`/`default` → the shim).
101
104
 
102
105
  The result is that `import "<pkg>/bundle.css"` resolves to the real CSS in bundlers/browsers and to
103
106
  the no-op shim in Node and similar runtimes. Make sure the extracted CSS survives tree-shaking in
@@ -111,8 +114,21 @@ consumers by adding it to `sideEffects` in `package.json`:
111
114
 
112
115
  Pass an options object instead of `true` to customize - the options are modeled after the
113
116
  [`css` options of `@tsdown/css`](https://tsdown.dev/options/css) (e.g. `fileName`, `minify`,
114
- `target`). Set `inject: true` for a plain relative `import "./bundle.css"` instead of the
115
- conditional export pattern, or `inject: false` to wire up the import, shim, and export yourself.
117
+ `target`, `lightningcss`). Set `inject: true` for a plain relative `import "./bundle.css"`
118
+ instead of the conditional export pattern, or `inject: false` to wire up the import, shim, and
119
+ export yourself.
120
+
121
+ Two Sanity-flavored defaults diverge from the bare plugins (which match `@tsdown/css` exactly):
122
+
123
+ - `minify` defaults to `true` - published Sanity libraries ship minified CSS. Set
124
+ `minify: false` for readable output.
125
+ - The CSS syntax lowering `target` defaults to tsdown's top-level `target`, and when the
126
+ effective target is undefined or names no browsers (e.g. `'node20'`, also what tsdown derives
127
+ from `engines.node` - it speaks to the JS runtime, not the browsers the extracted CSS runs
128
+ in), the lowering targets are resolved from `@sanity/browserslist-config` and passed through
129
+ `lightningcss.targets`. The bare plugins (like `@tsdown/css`) would skip lowering in that
130
+ case. `target: false` disables lowering entirely, and a user-provided `lightningcss.targets`
131
+ wins over the fallback.
116
132
 
117
133
  ## dts
118
134
 
@@ -148,7 +164,7 @@ export default defineConfig({
148
164
 
149
165
  ## Isolated declarations
150
166
 
151
- If you're using the [`@sanity/tsconfig/isolated-declarations`](https://github.com/sanity-io/pkg-utils/tree/main/packages/%40sanity/tsconfig#isolated-declarations-tsconfigjson)
167
+ If you're using the [`@sanity/tsconfig/isolated-declarations`](https://github.com/sanity-io/pkg-utils/tree/main/packages/@sanity/tsconfig#isolated-declarations-tsconfigjson)
152
168
  preset — which makes tsdown generate the `.d.ts` files with oxc's fast isolated declarations
153
169
  transform — annotate the default export of `tsdown.config.ts` with `satisfies Promise<UserConfig>`:
154
170
 
package/dist/index.d.mts CHANGED
@@ -3,11 +3,22 @@ import { Options } from "@sanity/vanilla-extract-tsdown-plugin";
3
3
  import { PluginOptions } from "babel-plugin-react-compiler";
4
4
  /**
5
5
  * Options for the `vanillaExtract` option — the same options as
6
- * `@sanity/vanilla-extract-tsdown-plugin` (`identifiers`, `fileName`, `minify`, `target`, and
7
- * `inject`, all modeled after the `css` options of `@tsdown/css`), with one different default:
8
- * `inject` defaults to `{nodeCompat: true}` (instead of the plugin's `false`), wiring up the
9
- * conditional CSS export pattern that Sanity libraries ship with. Set `inject: true` for a plain
10
- * relative CSS import, or `inject: false` to only extract the CSS.
6
+ * `@sanity/vanilla-extract-tsdown-plugin` (`identifiers`, `fileName`, `minify`, `target`,
7
+ * `lightningcss`, and `inject`, all modeled after the `css` options of `@tsdown/css`), with
8
+ * three Sanity-flavored defaults on top:
9
+ *
10
+ * - `inject` defaults to `{nodeCompat: true}` (instead of the plugin's `false`), wiring up the
11
+ * conditional CSS export pattern that Sanity libraries ship with. Set `inject: true` for a
12
+ * plain relative CSS import, or `inject: false` to only extract the CSS.
13
+ * - `minify` defaults to `true` (instead of the plugin's `false`, which matches `css.minify`
14
+ * in `@tsdown/css`): published Sanity libraries ship minified CSS. Set `minify: false` for
15
+ * readable output.
16
+ * - When the effective CSS syntax lowering target (`target`, falling back to the top-level
17
+ * `target`) is undefined or names no browsers (e.g. `'node20'`, resolved from
18
+ * `engines.node`), the lowering targets are resolved from `@sanity/browserslist-config` and
19
+ * passed through `lightningcss.targets` — where the plugin (like `@tsdown/css`) would skip
20
+ * lowering. `target: false` stays the explicit off switch, and a user-provided
21
+ * `lightningcss.targets` wins over the fallback.
11
22
  * @public
12
23
  */
13
24
  type PackageVanillaExtractOptions = Options;
@@ -109,11 +120,15 @@ interface PackageOptions extends Pick<UserConfig, "tsconfig" | "entry" | "format
109
120
  */
110
121
  styledComponents?: boolean | StyledComponentsOptions;
111
122
  /**
112
- * Enables `@sanity/vanilla-extract-tsdown-plugin` to extract CSS into a separate,
113
- * `lightningcss`-optimized file. Pass `true` to use the defaults, or an object to customize.
123
+ * Enables `@sanity/vanilla-extract-tsdown-plugin` to extract CSS into a separate file,
124
+ * minified and lowered with `lightningcss`. The lowering targets come from the effective
125
+ * `target` (`vanillaExtract.target`, falling back to the top-level `target`) when it names
126
+ * browsers; when it's undefined or browserless (e.g. `'node20'`), they're resolved from
127
+ * `@sanity/browserslist-config` instead — see {@link PackageVanillaExtractOptions}. Pass
128
+ * `true` to use the defaults, or an object to customize.
114
129
  *
115
130
  * By default (`inject: {nodeCompat: true}`) the plugin also injects the self-referential
116
- * `import "<pkg>/bundle.css"`, emits a `bundle.css.js` shim, and writes the conditional
131
+ * `import "<pkg>/bundle.css"`, emits a `bundle-css.js` shim, and writes the conditional
117
132
  * `"./bundle.css"` export to `package.json` - see {@link PackageVanillaExtractOptions}.
118
133
  * This is the same feature as `rollup.vanillaExtract` in `@sanity/pkg-utils`.
119
134
  * @alpha
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.mts","names":[],"sources":["../src/index.ts"],"mappings":";;;;;;;;;;;;KAmBY,+BAA+B;;;;;UAM1B;;EAEf;;;;;EAKA;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;EACA;;EAEA;;;;;;;;;KAUU,uBAAuB,QAAQ;;;;UAK1B,uBAAuB,KACtC;;;;;;;;;;;;;EAeA,WAAW;;;;;;;;;;;;;;;EAeX,UAAU;;;;;;;EAOV,YAAY;;;;;;EAMZ,OAAO;;;;;;;;;;EAUP,0BAA0B;;;;;;;;EAQ1B,6BAA6B;;;;;;;;;;;EAW7B,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;;;;;;;;;;;;;;;EAeX,UAAU;;;;;;;EAOV,YAAY;;;;;;EAMZ,OAAO;;;;;;;;;;EAUP,0BAA0B;;;;;;;;EAQ1B,6BAA6B;;;;;;;;;;;;;;;EAe7B,2BAA2B;;;;;iBAMP,aAAa,UAAS,iBAAsB,QAAQ"}
package/dist/index.mjs CHANGED
@@ -24,10 +24,23 @@ async function defineConfig(options = {}) {
24
24
  plugins.push(await pluginBabel({ presets: [reactCompilerPreset(typeof reactCompiler == "object" ? reactCompiler : {})] }));
25
25
  }
26
26
  if (options.vanillaExtract) {
27
- let { vanillaExtractPlugin } = await import("@sanity/vanilla-extract-tsdown-plugin");
27
+ let { esbuildTargetToLightningCSS, vanillaExtractPlugin } = await import("@sanity/vanilla-extract-tsdown-plugin"), vanillaExtract = options.vanillaExtract === !0 ? {} : options.vanillaExtract, cssTarget = vanillaExtract.target ?? target, { lightningcss } = vanillaExtract;
28
+ if (cssTarget !== !1 && !lightningcss?.targets && (cssTarget === void 0 || !esbuildTargetToLightningCSS(cssTarget))) {
29
+ let [{ default: browserslist }, { default: browserslistConfig }, { browserslistToTargets }] = await Promise.all([
30
+ import("browserslist"),
31
+ import("@sanity/browserslist-config"),
32
+ import("lightningcss")
33
+ ]);
34
+ lightningcss = {
35
+ ...lightningcss,
36
+ targets: browserslistToTargets(browserslist(browserslistConfig))
37
+ };
38
+ }
28
39
  plugins.push(vanillaExtractPlugin({
29
40
  inject: { nodeCompat: !0 },
30
- ...options.vanillaExtract === !0 ? {} : options.vanillaExtract
41
+ minify: !0,
42
+ ...vanillaExtract,
43
+ lightningcss
31
44
  }));
32
45
  }
33
46
  let { exports } = mergeConfig({ exports: {
@@ -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`, and\n * `inject`, all modeled after the `css` options of `@tsdown/css`), with one different default:\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 plain\n * relative CSS import, or `inject: false` to only extract the CSS.\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 * 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,\n * `lightningcss`-optimized file. Pass `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` and `outDir` are passed through to tsdown\n // as-is. When left undefined, tsdown keeps its default behavior (`tsconfig` is auto-detected\n // from the project, `dts` from `package.json`, `define` replaces nothing, `target` applies no\n // syntax downleveling, and `outDir` defaults to `'dist'`).\n const {entry, tsconfig, dts, define, target, outDir} = 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\n // `lightningcss`-optimized file. Its `inject` option is general purpose (and, like\n // `css.inject` in `@tsdown/css`, disabled by default), so this config supplies the default\n // most Sanity libraries want: `{nodeCompat: true}` wires up the whole conditional CSS export\n // pattern - the self-referential CSS import, the no-op JS shim, and the conditional\n // `./<fileName>` export written through this config's `exports` option (which the plugin's\n // `tsdownConfig` hook composes into).\n const {vanillaExtractPlugin} = await import('@sanity/vanilla-extract-tsdown-plugin')\n plugins.push(\n vanillaExtractPlugin({\n inject: {nodeCompat: true},\n ...(options.vanillaExtract === true ? {} : options.vanillaExtract),\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 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":";;;;;AA2IA,eAAsB,aAAa,UAA0B,CAAC,GAAwB;CAKpF,IAAM,EAAC,OAAO,UAAU,KAAK,QAAQ,QAAQ,WAAU,SACjD,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,yBAAwB,MAAM,OAAO;EAC5C,QAAQ,KACN,qBAAqB;GACnB,QAAQ,EAAC,YAAY,GAAI;GACzB,GAAI,QAAQ,mBAAmB,KAAO,CAAC,IAAI,QAAQ;EACrD,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,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 * 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` and `outDir` are passed through to tsdown\n // as-is. When left undefined, tsdown keeps its default behavior (`tsconfig` is auto-detected\n // from the project, `dts` from `package.json`, `define` replaces nothing, `target` applies no\n // syntax downleveling, and `outDir` defaults to `'dist'`).\n const {entry, tsconfig, dts, define, target, outDir} = 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 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":";;;;;AA0JA,eAAsB,aAAa,UAA0B,CAAC,GAAwB;CAKpF,IAAM,EAAC,OAAO,UAAU,KAAK,QAAQ,QAAQ,WAAU,SACjD,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,QAAQ;GAAC,UAAU;GAAM,SAAS;GAAO,QAAQ;EAAK;CACxD,CAAC;AACH"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sanity/tsdown-config",
3
- "version": "0.16.0",
3
+ "version": "0.17.1",
4
4
  "description": "Shared configuration for tsdown",
5
5
  "keywords": [
6
6
  "sanity-io",
@@ -13,7 +13,7 @@
13
13
  "rolldown",
14
14
  "rollup"
15
15
  ],
16
- "homepage": "https://github.com/sanity-io/pkg-utils/tree/main/packages/%40sanity/tsdown-config#readme",
16
+ "homepage": "https://github.com/sanity-io/pkg-utils/tree/main/packages/@sanity/tsdown-config#readme",
17
17
  "bugs": {
18
18
  "url": "https://github.com/sanity-io/pkg-utils/issues"
19
19
  },
@@ -37,20 +37,24 @@
37
37
  "dependencies": {
38
38
  "@babel/core": "^7.29.7",
39
39
  "@rolldown/plugin-babel": "^0.2.3",
40
+ "@sanity/browserslist-config": "^1.0.5",
40
41
  "@vitejs/plugin-react": "^6.0.3",
42
+ "browserslist": "^4.28.6",
43
+ "lightningcss": "^1.32.0",
41
44
  "package-manager-detector": "^1.7.0",
42
45
  "publint": "^0.3.21",
43
- "@sanity/vanilla-extract-tsdown-plugin": "^0.1.2"
46
+ "@sanity/vanilla-extract-tsdown-plugin": "^0.2.1"
44
47
  },
45
48
  "devDependencies": {
46
49
  "@types/babel__core": "^7.20.5",
47
50
  "babel-plugin-react-compiler": "^1.0.0",
51
+ "rolldown": "^1.1.5",
48
52
  "tinyexec": "^1.2.4",
49
53
  "tsdown": "^0.22.8",
50
54
  "typescript": "7.0.2",
51
55
  "vitest": "^4.1.10",
52
- "@sanity/pkg-utils": "^11.0.4",
53
- "@sanity/tsconfig": "^2.2.0"
56
+ "@sanity/pkg-utils": "^11.0.6",
57
+ "@sanity/tsconfig": "^2.2.1"
54
58
  },
55
59
  "peerDependencies": {
56
60
  "babel-plugin-react-compiler": "*",