@sanity/tsdown-config 0.12.1 → 0.13.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
@@ -116,7 +116,8 @@ tsdown's [`dts` option](https://tsdown.dev/options/dts) is passed through as-is.
116
116
  auto-detects it from `package.json` (it's enabled when a `types` field or a `types` condition in
117
117
  `exports` is present). Pass an object to customize how the `.d.ts` files are generated, for example
118
118
  to use [`tsgo`](https://github.com/microsoft/typescript-go) (the same feature as the `tsgo` option
119
- in `@sanity/pkg-utils`, requires `@typescript/native-preview` to be installed):
119
+ in `@sanity/pkg-utils`, requires either `typescript` v7 or `@typescript/native-preview` to be
120
+ installed — with `typescript` v7 it's enabled automatically):
120
121
 
121
122
  ```ts
122
123
  import {defineConfig} from '@sanity/tsdown-config'
package/dist/index.d.mts CHANGED
@@ -2,67 +2,67 @@ import { UserConfig } from "tsdown";
2
2
  import { PluginOptions } from "babel-plugin-react-compiler";
3
3
  import { Options } from "@vanilla-extract/rollup-plugin";
4
4
  /**
5
- * Options for the `@vanilla-extract/rollup-plugin` integration, including the same extensions as
6
- * `@sanity/pkg-utils` (`minify`, `browserslist`, and `extract.compatMode`).
7
- * @public
8
- */
5
+ * Options for the `@vanilla-extract/rollup-plugin` integration, including the same extensions as
6
+ * `@sanity/pkg-utils` (`minify`, `browserslist`, and `extract.compatMode`).
7
+ * @public
8
+ */
9
9
  interface PackageVanillaExtractOptions extends Omit<Options, "extract"> {
10
10
  /**
11
- * Minify the extracted CSS with `lightningcss`.
12
- * @defaultValue true
13
- */
11
+ * Minify the extracted CSS with `lightningcss`.
12
+ * @defaultValue true
13
+ */
14
14
  minify?: boolean;
15
15
  /**
16
- * Browserslist query passed to `lightningcss` when optimizing the extracted CSS.
17
- * @defaultValue `@sanity/browserslist-config`
18
- */
16
+ * Browserslist query passed to `lightningcss` when optimizing the extracted CSS.
17
+ * @defaultValue `@sanity/browserslist-config`
18
+ */
19
19
  browserslist?: string | string[];
20
20
  /**
21
- * Different formatting of identifiers (e.g. class names, keyframes, CSS Vars, etc).
22
- * @defaultValue "short"
23
- */
21
+ * Different formatting of identifiers (e.g. class names, keyframes, CSS Vars, etc).
22
+ * @defaultValue "short"
23
+ */
24
24
  identifiers?: Options["identifiers"];
25
25
  /**
26
- * Extract the CSS into a separate file. The CSS is always extracted, so this configures _how_.
27
- */
26
+ * Extract the CSS into a separate file. The CSS is always extracted, so this configures _how_.
27
+ */
28
28
  extract?: {
29
29
  /**
30
- * Name of the emitted `.css` file (and, with `compatMode`, the `exports` subpath + shim base).
31
- * @defaultValue "bundle.css"
32
- */
30
+ * Name of the emitted `.css` file (and, with `compatMode`, the `exports` subpath + shim base).
31
+ * @defaultValue "bundle.css"
32
+ */
33
33
  name?: string;
34
34
  /**
35
- * Generate a `.css.map` sourcemap file.
36
- * @defaultValue true
37
- */
35
+ * Generate a `.css.map` sourcemap file.
36
+ * @defaultValue true
37
+ */
38
38
  sourcemap?: boolean;
39
39
  /**
40
- * Compatibility mode automatically wires up the conditional CSS export pattern so userland does
41
- * not have to. When enabled, the config:
42
- *
43
- * - injects `import "<pkg-name>/<name>"` into the `index` entry chunk,
44
- * - emits a no-op `<name>.js` shim for runtimes that cannot import `.css` files, and
45
- * - writes the conditional `"./<name>"` export to `package.json`
46
- * (`browser`/`style` → the real CSS, `node`/`default` → the shim).
47
- *
48
- * The result is that `import "<pkg>/<name>"` resolves to the real CSS in bundlers/browsers and
49
- * to the no-op shim in Node and similar runtimes. Disable it to wire these up yourself.
50
- * @defaultValue true
51
- */
40
+ * Compatibility mode automatically wires up the conditional CSS export pattern so userland does
41
+ * not have to. When enabled, the config:
42
+ *
43
+ * - injects `import "<pkg-name>/<name>"` into the `index` entry chunk,
44
+ * - emits a no-op `<name>.js` shim for runtimes that cannot import `.css` files, and
45
+ * - writes the conditional `"./<name>"` export to `package.json`
46
+ * (`browser`/`style` → the real CSS, `node`/`default` → the shim).
47
+ *
48
+ * The result is that `import "<pkg>/<name>"` resolves to the real CSS in bundlers/browsers and
49
+ * to the no-op shim in Node and similar runtimes. Disable it to wire these up yourself.
50
+ * @defaultValue true
51
+ */
52
52
  compatMode?: boolean;
53
53
  };
54
54
  }
55
55
  /**
56
- * Options for the `styled-components` transform, the same options as `babel-plugin-styled-components`.
57
- * @public
58
- */
56
+ * Options for the `styled-components` transform, the same options as `babel-plugin-styled-components`.
57
+ * @public
58
+ */
59
59
  interface StyledComponentsOptions {
60
60
  /** @defaultValue true */
61
61
  displayName?: boolean;
62
62
  /**
63
- * @defaultValue []
64
- * @example ["\@xstyled/styled-components", "\@xstyled/styled-components/*"]
65
- */
63
+ * @defaultValue []
64
+ * @example ["\@xstyled/styled-components", "\@xstyled/styled-components/*"]
65
+ */
66
66
  topLevelImportPaths?: string[];
67
67
  /** @defaultValue true */
68
68
  ssr?: boolean;
@@ -79,54 +79,54 @@ interface StyledComponentsOptions {
79
79
  pure?: boolean;
80
80
  }
81
81
  /**
82
- * Options for the React Compiler, the same options as `babel-plugin-react-compiler`.
83
- * The typings resolve in userland once `babel-plugin-react-compiler` (an optional peer
84
- * dependency, required to use `reactCompiler`) is installed, and always match the installed
85
- * version of the compiler.
86
- * @public
87
- */
82
+ * Options for the React Compiler, the same options as `babel-plugin-react-compiler`.
83
+ * The typings resolve in userland once `babel-plugin-react-compiler` (an optional peer
84
+ * dependency, required to use `reactCompiler`) is installed, and always match the installed
85
+ * version of the compiler.
86
+ * @public
87
+ */
88
88
  type ReactCompilerOptions = Partial<PluginOptions>;
89
89
  /**
90
- * @public
91
- */
90
+ * @public
91
+ */
92
92
  interface PackageOptions extends Pick<UserConfig, "tsconfig" | "entry" | "format" | "dts" | "define"> {
93
93
  /**
94
- * @defaultValue 'neutral'
95
- */
94
+ * @defaultValue 'neutral'
95
+ */
96
96
  platform?: UserConfig["platform"];
97
97
  /**
98
- * Runs `babel-plugin-react-compiler` on the source files before they are bundled, so published
99
- * components are memoized automatically. Pass `true` to use the defaults, or an options object
100
- * to configure the compiler (e.g. `{target: '18'}`).
101
- * This is the same feature as the `babel: {reactCompiler: true}` and `reactCompilerOptions`
102
- * options in `@sanity/pkg-utils`. Unlike `styledComponents` there's no oxc native port of the
103
- * React Compiler yet, so `babel-plugin-react-compiler` needs to be installed.
104
- * @defaultValue false
105
- */
98
+ * Runs `babel-plugin-react-compiler` on the source files before they are bundled, so published
99
+ * components are memoized automatically. Pass `true` to use the defaults, or an options object
100
+ * to configure the compiler (e.g. `{target: '18'}`).
101
+ * This is the same feature as the `babel: {reactCompiler: true}` and `reactCompilerOptions`
102
+ * options in `@sanity/pkg-utils`. Unlike `styledComponents` there's no oxc native port of the
103
+ * React Compiler yet, so `babel-plugin-react-compiler` needs to be installed.
104
+ * @defaultValue false
105
+ */
106
106
  reactCompiler?: boolean | ReactCompilerOptions;
107
107
  /**
108
- * Applies the `styled-components` transform (`displayName`, `componentId`, CSS minification, etc)
109
- * with the same defaults as the `babel: {styledComponents: true}` option in `@sanity/pkg-utils`.
110
- * Unlike `@sanity/pkg-utils` it doesn't use `babel-plugin-styled-components`, but oxc's native port of it,
111
- * so there's no need to install babel dependencies.
112
- * @defaultValue false
113
- */
108
+ * Applies the `styled-components` transform (`displayName`, `componentId`, CSS minification, etc)
109
+ * with the same defaults as the `babel: {styledComponents: true}` option in `@sanity/pkg-utils`.
110
+ * Unlike `@sanity/pkg-utils` it doesn't use `babel-plugin-styled-components`, but oxc's native port of it,
111
+ * so there's no need to install babel dependencies.
112
+ * @defaultValue false
113
+ */
114
114
  styledComponents?: boolean | StyledComponentsOptions;
115
115
  /**
116
- * Enables `@vanilla-extract/rollup-plugin` to extract CSS into a separate file, with support for
117
- * minifying the extracted CSS. Pass `true` to use the defaults, or an object to customize.
118
- *
119
- * By default (`extract.compatMode: true`) the config also injects the self-referential
120
- * `import "<pkg>/bundle.css"`, emits a `bundle.css.js` shim, and writes the conditional
121
- * `"./bundle.css"` export to `package.json` - see {@link PackageVanillaExtractOptions}.
122
- * This is the same feature as `rollup.vanillaExtract` in `@sanity/pkg-utils`.
123
- * @alpha
124
- */
116
+ * Enables `@vanilla-extract/rollup-plugin` to extract CSS into a separate file, with support for
117
+ * minifying the extracted CSS. Pass `true` to use the defaults, or an object to customize.
118
+ *
119
+ * By default (`extract.compatMode: true`) the config also injects the self-referential
120
+ * `import "<pkg>/bundle.css"`, emits a `bundle.css.js` shim, and writes the conditional
121
+ * `"./bundle.css"` export to `package.json` - see {@link PackageVanillaExtractOptions}.
122
+ * This is the same feature as `rollup.vanillaExtract` in `@sanity/pkg-utils`.
123
+ * @alpha
124
+ */
125
125
  vanillaExtract?: boolean | PackageVanillaExtractOptions;
126
126
  }
127
127
  /**
128
- * @public
129
- */
128
+ * @public
129
+ */
130
130
  declare function defineConfig(options?: PackageOptions): Promise<UserConfig>;
131
131
  export { PackageOptions, type PackageVanillaExtractOptions, ReactCompilerOptions, StyledComponentsOptions, defineConfig };
132
132
  //# sourceMappingURL=index.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.mts","names":[],"sources":["../src/vanillaExtract.ts","../src/index.ts"],"mappings":";;;;;AAaA;;;UAAiB,4BAAA,SAAqC,IAAA,CAAK,OAAA;;;;;EAKzD,MAAA;;;;;EAKA,YAAA;;;;;EAKA,WAAA,GAAc,OAAA;EA4BZ;;ACzCJ;EDiBE,OAAA;;;;;IAKE,IAAA;ICXF;;;;IDgBE,SAAA;ICPF;;AAAA;AAUF;;;;AAA2C;AAK3C;;;;;IDMI,UAAA;EAAA;AAAA;AA3CJ;;;;AAAA,UCEiB,uBAAA;;EAEf,WAAA;EDJoD;;;;ECSpD,mBAAA;;EAEA,GAAA;;EAEA,QAAA;;EAEA,oBAAA;ED4BE;EC1BF,MAAA;;EAEA,yBAAA;EACA,SAAA;;EAEA,IAAA;AAAA;;;;;;;;KAUU,oBAAA,GAAuB,OAAA,CAAQ,aAAA;;AAVzC;AAUF;UAKiB,cAAA,SAAuB,IAAA,CACtC,UAAA;;;AANyC;EAYzC,QAAA,GAAW,UAAA;EAPI;;;;;;;;;EAiBf,aAAA,aAA0B,oBAAA;;;;;;;;EAQ1B,gBAAA,aAA6B,uBAAA;;;;AAWF;AAoC7B;;;;;;EApCE,cAAA,aAA2B,4BAAA;AAAA;;;;iBAoCP,YAAA,CAAa,OAAA,GAAS,cAAA,GAAsB,OAAA,CAAQ,UAAA"}
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../src/vanillaExtract.ts","../src/index.ts"],"mappings":";;;;;;;;UAaiB,qCAAqC,KAAK;;;;;EAKzD;;;;;EAKA;;;;;EAKA,cAAc;;;;EAId;;;;;IAKE;;;;;IAKA;;;;;;;;;;;;;;IAcA;;;;;;;UCzCa;;EAEf;;;;;EAKA;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;EACA;;EAEA;;;;;;;;;KAUU,uBAAuB,QAAQ;;;;UAK1B,uBAAuB,KACtC;;;;EAMA,WAAW;;;;;;;;;;EAUX,0BAA0B;;;;;;;;EAQ1B,6BAA6B;;;;;;;;;;;EAW7B,2BAA2B;;;;;iBAoCP,aAAa,UAAS,iBAAsB,QAAQ"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":["defineTsdownConfig"],"sources":["../src/index.ts"],"sourcesContent":["import type {PluginOptions as ReactCompilerPluginOptions} from 'babel-plugin-react-compiler'\nimport {\n defineConfig as defineTsdownConfig,\n type NormalizedFormat,\n type Rolldown,\n type UserConfig,\n} from 'tsdown'\nimport type {PackageVanillaExtractOptions} from './vanillaExtract.ts'\n\nexport type {PackageVanillaExtractOptions}\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'\n> {\n /**\n * @defaultValue 'neutral'\n */\n platform?: UserConfig['platform']\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 `@vanilla-extract/rollup-plugin` to extract CSS into a separate file, with support for\n * minifying the extracted CSS. Pass `true` to use the defaults, or an object to customize.\n *\n * By default (`extract.compatMode: true`) the config 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 * Emits shared (non-entry) chunks into subfolders per output flavor, following the same naming\n * convention as `@sanity/pkg-utils` (`_chunks-es`, `_chunks-cjs` and `_chunks-dts`), instead of\n * rolldown's default of placing chunks at the root of the output directory next to the entries.\n * A chunk can otherwise be named like an entry (e.g. code shared between `index` and `theme`\n * entries forms a chunk that rolldown also names `theme`): the JS output deduplicates such\n * filename collisions in favor of the entry, but the d.ts output can resolve them the other way\n * around, handing `theme.d.ts` to the chunk - which re-exports everything under minified aliases -\n * so every named import from the `theme` entry fails to type-check with TS2460\n * (https://github.com/sanity-io/ui/issues/2262).\n */\nfunction resolveChunkFileNames(\n defaultOutputOptions: Rolldown.OutputOptions,\n format: NormalizedFormat,\n): Rolldown.OutputOptions['chunkFileNames'] {\n return (chunk) => {\n // tsdown's default is a `[name]` template string carrying the resolved output extension for\n // the current format and package type (e.g. `[name].mjs`), so reuse it for the file names\n const template =\n (typeof defaultOutputOptions.chunkFileNames === 'function'\n ? defaultOutputOptions.chunkFileNames(chunk)\n : defaultOutputOptions.chunkFileNames) ?? '[name].js'\n // `rolldown-plugin-dts` names d.ts chunks with a `.d` suffix and later rewrites the rendered\n // JS filename to the matching d.ts extension (e.g. `_chunks-dts/[name].mjs` renders\n // `_chunks-dts/theme.mjs`, which becomes `_chunks-dts/theme.d.mts`)\n const folder = chunk.name.endsWith('.d') ? '_chunks-dts' : `_chunks-${format}`\n return `${folder}/${template}`\n }\n}\n\n/**\n * @public\n */\nexport async function defineConfig(options: PackageOptions = {}): Promise<UserConfig> {\n // `dts` and `define` are passed through to tsdown as-is. When left undefined, tsdown keeps its\n // default behavior (`dts` is auto-detected from `package.json`, `define` replaces nothing).\n const {entry, dts, define} = options\n const tsconfig = options.tsconfig ?? 'tsconfig.json'\n const platform = options.platform ?? 'neutral'\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 hash = false\n const format = options.format ?? 'esm'\n const inputOptions = {\n preserveEntrySignatures: 'strict',\n experimental: {attachDebugInfo: 'none'},\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 } as const satisfies UserConfig['inputOptions']\n\n const resolveBaseOutputOptions = (\n defaultOptions: Rolldown.OutputOptions,\n outputFormat: NormalizedFormat,\n ) =>\n ({\n hoistTransitiveImports: false,\n chunkFileNames: resolveChunkFileNames(defaultOptions, outputFormat),\n }) satisfies Rolldown.OutputOptions\n\n let outputOptions: UserConfig['outputOptions'] = resolveBaseOutputOptions\n let treeshake: UserConfig['treeshake']\n let customExports: ((exportsMap: Record<string, unknown>) => Record<string, unknown>) | undefined\n\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 // The plugin types don't match when `@rolldown/plugin-babel` resolves its `rolldown` peer\n // dependency to a different version than the one bundled with `tsdown`, so cast it:\n // https://tsdown.dev/advanced/plugins#rollup-plugins\n // oxlint-disable-next-line no-unsafe-type-assertion\n (await pluginBabel({\n presets: [reactCompilerPreset(typeof reactCompiler === 'object' ? reactCompiler : {})],\n })) as unknown as Rolldown.Plugin,\n )\n }\n if (options.vanillaExtract) {\n // Everything vanilla-extract related is lazy loaded, like `reactCompiler`, so it's only paid\n // for when the option is enabled: `@vanilla-extract/rollup-plugin` compiles the `.css.ts`\n // files, and `optimizeCss` pulls in the CSS toolchain (`lightningcss`, `browserslist`) that\n // minifies the extracted CSS.\n const [\n {vanillaExtractPlugin},\n {default: browserslistConfig},\n {optimizeCss},\n {bundleCssShim},\n {\n composeIntro,\n createConditionalCssExport,\n insertCssExport,\n readPackageName,\n resolveVanillaExtract,\n resolveVanillaExtractCssName,\n },\n ] = await Promise.all([\n import('@vanilla-extract/rollup-plugin'),\n import('@sanity/browserslist-config'),\n import('./optimizeCss.ts'),\n import('./bundleCssShim.ts'),\n import('./vanillaExtract.ts'),\n ])\n\n // Resolve vanilla-extract options + the conditional CSS export \"compat mode\"\n const vanillaExtract = resolveVanillaExtract(options.vanillaExtract)\n const cssName = resolveVanillaExtractCssName(vanillaExtract.options)\n\n plugins.push(\n // Rolldown supports most Rollup plugins, but the plugin types are not identical, so the\n // official guidance is to cast: https://tsdown.dev/advanced/plugins#rollup-plugins\n // oxlint-disable-next-line no-unsafe-type-assertion\n vanillaExtractPlugin({\n identifiers: vanillaExtract.options.identifiers ?? 'short',\n cwd: vanillaExtract.options.cwd,\n esbuildOptions: vanillaExtract.options.esbuildOptions,\n unstable_injectFilescopes: vanillaExtract.options.unstable_injectFilescopes,\n extract: {\n name: cssName,\n sourcemap: vanillaExtract.options.extract?.sourcemap ?? true,\n },\n }) as unknown as Rolldown.Plugin,\n optimizeCss({\n extractFileName: cssName,\n browserslist: vanillaExtract.options.browserslist || browserslistConfig,\n minify: vanillaExtract.options.minify ?? true,\n }),\n )\n\n // The vanilla-extract plugin resolves each compiled `.css.ts` module's CSS to an external,\n // side-effect-only `<file>.vanilla.css` import and extracts the CSS into a single file. The\n // imports are redundant once the CSS is extracted, so let tree-shaking drop them up front:\n // the plugin's own `generateBundle` cleanup only strips imports at the start of a line, which\n // the minifier's statement merging can defeat (e.g. `a(), require(\"….vanilla.css\")` in CJS).\n // Modules not matching the rule keep the default tree-shaking behavior.\n treeshake = {moduleSideEffects: [{test: /\\.vanilla\\.css$/, external: true, sideEffects: false}]}\n\n // In compat mode, the self-referential `import \"<pkg>/<css>\"` needs the package name.\n const cssImportId = vanillaExtract.compatMode\n ? `${readPackageName(process.cwd())}/${cssName}`\n : undefined\n\n outputOptions = (defaultOptions, outputFormat, context) => ({\n ...resolveBaseOutputOptions(defaultOptions, outputFormat),\n // Emit the extracted CSS (and its sourcemap) with a stable name at the root of the tsdown\n // default `outDir` ('dist', not configurable yet) instead of rolldown's default\n // `assets/[name]-[hash][extname]`, so it can back the conditional `./<css>` export.\n assetFileNames: '[name][extname]',\n // In compat mode, inject the self-referential CSS import into the `index` entry chunk so\n // userland does not need to set `outputOptions.intro` themselves. Use `require()` for\n // CommonJS output (a top-level `import` would be invalid in a `.cjs` bundle).\n ...(cssImportId && !context.cjsDts && (outputFormat === 'es' || outputFormat === 'cjs')\n ? {\n intro: composeIntro(\n outputFormat === 'cjs'\n ? `require(${JSON.stringify(cssImportId)})`\n : `import ${JSON.stringify(cssImportId)}`,\n ),\n }\n : {}),\n })\n\n if (vanillaExtract.compatMode) {\n // In compat mode, emit the no-op JS shim that the `node`/`default` conditions of the\n // `./<css>` export resolve to.\n plugins.push(bundleCssShim({fileName: `${cssName}.js`}))\n\n // Write the conditional `./<css>` export to `package.json` (and, through tsdown, mirror it\n // into `publishConfig.exports`) so userland does not have to maintain it.\n const conditionalCssExport = createConditionalCssExport(cssName, 'dist')\n customExports = (exportsMap) =>\n insertCssExport(exportsMap, `./${cssName}`, conditionalCssExport)\n }\n }\n\n const exports = {\n enabled: 'local-only',\n // @TODO use @sanity/parse-package-json to determine if devExports should be `true` or `source`\n devExports: true,\n ...(customExports && {customExports}),\n } as const satisfies UserConfig['exports']\n\n return defineTsdownConfig({\n define,\n dts,\n entry,\n exports,\n format,\n hash,\n inputOptions,\n outputOptions,\n platform,\n plugins,\n publint,\n report,\n treeshake,\n tsconfig,\n minify: {compress: true, codegen: false, mangle: false},\n // `treeshake` stays `undefined` (tsdown's/rolldown's default, `moduleSideEffects: true`)\n // unless vanilla-extract needs its targeted rule above. Previously this set the equivalent of\n // `moduleSideEffects: 'no-external'` (with a `.css` exemption), which stripped intentional\n // side-effect-only imports of external packages (e.g. `import 'react-time-ago/locale/en'`)\n // from the output. The default preserves those imports while still honoring `package.json`\n // `sideEffects` fields for bundled modules.\n })\n}\n"],"mappings":"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"}
1
+ {"version":3,"file":"index.mjs","names":["defineTsdownConfig"],"sources":["../src/index.ts"],"sourcesContent":["import type {PluginOptions as ReactCompilerPluginOptions} from 'babel-plugin-react-compiler'\nimport {\n defineConfig as defineTsdownConfig,\n type NormalizedFormat,\n type Rolldown,\n type UserConfig,\n} from 'tsdown'\nimport type {PackageVanillaExtractOptions} from './vanillaExtract.ts'\n\nexport type {PackageVanillaExtractOptions}\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'\n> {\n /**\n * @defaultValue 'neutral'\n */\n platform?: UserConfig['platform']\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 `@vanilla-extract/rollup-plugin` to extract CSS into a separate file, with support for\n * minifying the extracted CSS. Pass `true` to use the defaults, or an object to customize.\n *\n * By default (`extract.compatMode: true`) the config 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 * Emits shared (non-entry) chunks into subfolders per output flavor, following the same naming\n * convention as `@sanity/pkg-utils` (`_chunks-es`, `_chunks-cjs` and `_chunks-dts`), instead of\n * rolldown's default of placing chunks at the root of the output directory next to the entries.\n * A chunk can otherwise be named like an entry (e.g. code shared between `index` and `theme`\n * entries forms a chunk that rolldown also names `theme`): the JS output deduplicates such\n * filename collisions in favor of the entry, but the d.ts output can resolve them the other way\n * around, handing `theme.d.ts` to the chunk - which re-exports everything under minified aliases -\n * so every named import from the `theme` entry fails to type-check with TS2460\n * (https://github.com/sanity-io/ui/issues/2262).\n */\nfunction resolveChunkFileNames(\n defaultOutputOptions: Rolldown.OutputOptions,\n format: NormalizedFormat,\n): Rolldown.OutputOptions['chunkFileNames'] {\n return (chunk) => {\n // tsdown's default is a `[name]` template string carrying the resolved output extension for\n // the current format and package type (e.g. `[name].mjs`), so reuse it for the file names\n const template =\n (typeof defaultOutputOptions.chunkFileNames === 'function'\n ? defaultOutputOptions.chunkFileNames(chunk)\n : defaultOutputOptions.chunkFileNames) ?? '[name].js'\n // `rolldown-plugin-dts` names d.ts chunks with a `.d` suffix and later rewrites the rendered\n // JS filename to the matching d.ts extension (e.g. `_chunks-dts/[name].mjs` renders\n // `_chunks-dts/theme.mjs`, which becomes `_chunks-dts/theme.d.mts`)\n const folder = chunk.name.endsWith('.d') ? '_chunks-dts' : `_chunks-${format}`\n return `${folder}/${template}`\n }\n}\n\n/**\n * @public\n */\nexport async function defineConfig(options: PackageOptions = {}): Promise<UserConfig> {\n // `dts` and `define` are passed through to tsdown as-is. When left undefined, tsdown keeps its\n // default behavior (`dts` is auto-detected from `package.json`, `define` replaces nothing).\n const {entry, dts, define} = options\n const tsconfig = options.tsconfig ?? 'tsconfig.json'\n const platform = options.platform ?? 'neutral'\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 hash = false\n const format = options.format ?? 'esm'\n const inputOptions = {\n preserveEntrySignatures: 'strict',\n experimental: {attachDebugInfo: 'none'},\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 } as const satisfies UserConfig['inputOptions']\n\n const resolveBaseOutputOptions = (\n defaultOptions: Rolldown.OutputOptions,\n outputFormat: NormalizedFormat,\n ) =>\n ({\n hoistTransitiveImports: false,\n chunkFileNames: resolveChunkFileNames(defaultOptions, outputFormat),\n }) satisfies Rolldown.OutputOptions\n\n let outputOptions: UserConfig['outputOptions'] = resolveBaseOutputOptions\n let treeshake: UserConfig['treeshake']\n let customExports: ((exportsMap: Record<string, unknown>) => Record<string, unknown>) | undefined\n\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 // Everything vanilla-extract related is lazy loaded, like `reactCompiler`, so it's only paid\n // for when the option is enabled: `@vanilla-extract/rollup-plugin` compiles the `.css.ts`\n // files, and `optimizeCss` pulls in the CSS toolchain (`lightningcss`, `browserslist`) that\n // minifies the extracted CSS.\n const [\n {vanillaExtractPlugin},\n {default: browserslistConfig},\n {optimizeCss},\n {bundleCssShim},\n {\n composeIntro,\n createConditionalCssExport,\n insertCssExport,\n readPackageName,\n resolveVanillaExtract,\n resolveVanillaExtractCssName,\n },\n ] = await Promise.all([\n import('@vanilla-extract/rollup-plugin'),\n import('@sanity/browserslist-config'),\n import('./optimizeCss.ts'),\n import('./bundleCssShim.ts'),\n import('./vanillaExtract.ts'),\n ])\n\n // Resolve vanilla-extract options + the conditional CSS export \"compat mode\"\n const vanillaExtract = resolveVanillaExtract(options.vanillaExtract)\n const cssName = resolveVanillaExtractCssName(vanillaExtract.options)\n\n plugins.push(\n // Rolldown supports most Rollup plugins, but the plugin types are not identical, so the\n // official guidance is to cast: https://tsdown.dev/advanced/plugins#rollup-plugins\n // oxlint-disable-next-line no-unsafe-type-assertion\n vanillaExtractPlugin({\n identifiers: vanillaExtract.options.identifiers ?? 'short',\n cwd: vanillaExtract.options.cwd,\n esbuildOptions: vanillaExtract.options.esbuildOptions,\n unstable_injectFilescopes: vanillaExtract.options.unstable_injectFilescopes,\n extract: {\n name: cssName,\n sourcemap: vanillaExtract.options.extract?.sourcemap ?? true,\n },\n }) as unknown as Rolldown.Plugin,\n optimizeCss({\n extractFileName: cssName,\n browserslist: vanillaExtract.options.browserslist || browserslistConfig,\n minify: vanillaExtract.options.minify ?? true,\n }),\n )\n\n // The vanilla-extract plugin resolves each compiled `.css.ts` module's CSS to an external,\n // side-effect-only `<file>.vanilla.css` import and extracts the CSS into a single file. The\n // imports are redundant once the CSS is extracted, so let tree-shaking drop them up front:\n // the plugin's own `generateBundle` cleanup only strips imports at the start of a line, which\n // the minifier's statement merging can defeat (e.g. `a(), require(\"….vanilla.css\")` in CJS).\n // Modules not matching the rule keep the default tree-shaking behavior.\n treeshake = {moduleSideEffects: [{test: /\\.vanilla\\.css$/, external: true, sideEffects: false}]}\n\n // In compat mode, the self-referential `import \"<pkg>/<css>\"` needs the package name.\n const cssImportId = vanillaExtract.compatMode\n ? `${readPackageName(process.cwd())}/${cssName}`\n : undefined\n\n outputOptions = (defaultOptions, outputFormat, context) => ({\n ...resolveBaseOutputOptions(defaultOptions, outputFormat),\n // Emit the extracted CSS (and its sourcemap) with a stable name at the root of the tsdown\n // default `outDir` ('dist', not configurable yet) instead of rolldown's default\n // `assets/[name]-[hash][extname]`, so it can back the conditional `./<css>` export.\n assetFileNames: '[name][extname]',\n // In compat mode, inject the self-referential CSS import into the `index` entry chunk so\n // userland does not need to set `outputOptions.intro` themselves. Use `require()` for\n // CommonJS output (a top-level `import` would be invalid in a `.cjs` bundle).\n ...(cssImportId && !context.cjsDts && (outputFormat === 'es' || outputFormat === 'cjs')\n ? {\n intro: composeIntro(\n outputFormat === 'cjs'\n ? `require(${JSON.stringify(cssImportId)})`\n : `import ${JSON.stringify(cssImportId)}`,\n ),\n }\n : {}),\n })\n\n if (vanillaExtract.compatMode) {\n // In compat mode, emit the no-op JS shim that the `node`/`default` conditions of the\n // `./<css>` export resolve to.\n plugins.push(bundleCssShim({fileName: `${cssName}.js`}))\n\n // Write the conditional `./<css>` export to `package.json` (and, through tsdown, mirror it\n // into `publishConfig.exports`) so userland does not have to maintain it.\n const conditionalCssExport = createConditionalCssExport(cssName, 'dist')\n customExports = (exportsMap) =>\n insertCssExport(exportsMap, `./${cssName}`, conditionalCssExport)\n }\n }\n\n const exports = {\n enabled: 'local-only',\n // @TODO use @sanity/parse-package-json to determine if devExports should be `true` or `source`\n devExports: true,\n ...(customExports && {customExports}),\n } as const satisfies UserConfig['exports']\n\n return defineTsdownConfig({\n define,\n dts,\n entry,\n exports,\n format,\n hash,\n inputOptions,\n outputOptions,\n platform,\n plugins,\n publint,\n report,\n treeshake,\n tsconfig,\n minify: {compress: true, codegen: false, mangle: false},\n // `treeshake` stays `undefined` (tsdown's/rolldown's default, `moduleSideEffects: true`)\n // unless vanilla-extract needs its targeted rule above. Previously this set the equivalent of\n // `moduleSideEffects: 'no-external'` (with a `.css` exemption), which stripped intentional\n // side-effect-only imports of external packages (e.g. `import 'react-time-ago/locale/en'`)\n // from the output. The default preserves those imports while still honoring `package.json`\n // `sideEffects` fields for bundled modules.\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.12.1",
3
+ "version": "0.13.1",
4
4
  "description": "Shared configuration for tsdown",
5
5
  "keywords": [
6
6
  "sanity-io",
@@ -38,7 +38,7 @@
38
38
  "@babel/core": "^7.29.7",
39
39
  "@rolldown/plugin-babel": "^0.2.3",
40
40
  "@sanity/browserslist-config": "^1.0.5",
41
- "@vanilla-extract/rollup-plugin": "^1.5.3",
41
+ "@vanilla-extract/rollup-plugin": "^1.5.4",
42
42
  "@vitejs/plugin-react": "^6.0.3",
43
43
  "browserslist": "^4.28.5",
44
44
  "lightningcss": "^1.32.0",
@@ -46,19 +46,18 @@
46
46
  },
47
47
  "devDependencies": {
48
48
  "@types/babel__core": "^7.20.5",
49
- "@typescript/native-preview": "7.0.0-dev.20260421.2",
50
49
  "babel-plugin-react-compiler": "^1.0.0",
51
50
  "tinyexec": "^1.2.4",
52
- "tsdown": "^0.22.3",
53
- "typescript": "6.0.3",
51
+ "tsdown": "^0.22.5",
52
+ "typescript": "7.0.2",
54
53
  "vitest": "^4.1.10",
55
- "@sanity/pkg-utils": "^10.9.2",
54
+ "@sanity/pkg-utils": "^11.0.1",
56
55
  "@sanity/tsconfig": "^2.2.0"
57
56
  },
58
57
  "peerDependencies": {
59
58
  "babel-plugin-react-compiler": "*",
60
- "tsdown": "0.22.3",
61
- "typescript": "5.8.x || 5.9.x || 6.0.x"
59
+ "tsdown": "0.22.5",
60
+ "typescript": "6.x || 7.x"
62
61
  },
63
62
  "peerDependenciesMeta": {
64
63
  "babel-plugin-react-compiler": {