@sanity/tsdown-config 0.12.0 → 0.13.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 +2 -1
- package/dist/index.d.mts +78 -78
- package/dist/index.d.mts.map +1 -1
- package/package.json +8 -9
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
|
|
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
|
-
*/
|
|
9
|
-
interface PackageVanillaExtractOptions extends Omit<Options,
|
|
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
|
+
interface PackageVanillaExtractOptions extends Omit<Options, 'extract'> {
|
|
10
10
|
/**
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
* Minify the extracted CSS with `lightningcss`.
|
|
12
|
+
* @defaultValue true
|
|
13
|
+
*/
|
|
14
14
|
minify?: boolean;
|
|
15
15
|
/**
|
|
16
|
-
|
|
17
|
-
|
|
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
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
identifiers?: Options[
|
|
21
|
+
* Different formatting of identifiers (e.g. class names, keyframes, CSS Vars, etc).
|
|
22
|
+
* @defaultValue "short"
|
|
23
|
+
*/
|
|
24
|
+
identifiers?: Options['identifiers'];
|
|
25
25
|
/**
|
|
26
|
-
|
|
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
|
-
|
|
31
|
-
|
|
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
|
-
|
|
36
|
-
|
|
37
|
-
|
|
35
|
+
* Generate a `.css.map` sourcemap file.
|
|
36
|
+
* @defaultValue true
|
|
37
|
+
*/
|
|
38
38
|
sourcemap?: boolean;
|
|
39
39
|
/**
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
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
|
-
|
|
64
|
-
|
|
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
|
-
*/
|
|
92
|
-
interface PackageOptions extends Pick<UserConfig,
|
|
90
|
+
* @public
|
|
91
|
+
*/
|
|
92
|
+
interface PackageOptions extends Pick<UserConfig, 'tsconfig' | 'entry' | 'format' | 'dts' | 'define'> {
|
|
93
93
|
/**
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
platform?: UserConfig[
|
|
94
|
+
* @defaultValue 'neutral'
|
|
95
|
+
*/
|
|
96
|
+
platform?: UserConfig['platform'];
|
|
97
97
|
/**
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
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
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
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
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
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
|
package/dist/index.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/vanillaExtract.ts","../src/index.ts"],"mappings":"
|
|
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"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sanity/tsdown-config",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.13.0",
|
|
4
4
|
"description": "Shared configuration for tsdown",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"sanity-io",
|
|
@@ -40,25 +40,24 @@
|
|
|
40
40
|
"@sanity/browserslist-config": "^1.0.5",
|
|
41
41
|
"@vanilla-extract/rollup-plugin": "^1.5.3",
|
|
42
42
|
"@vitejs/plugin-react": "^6.0.3",
|
|
43
|
-
"browserslist": "^4.28.
|
|
43
|
+
"browserslist": "^4.28.5",
|
|
44
44
|
"lightningcss": "^1.32.0",
|
|
45
45
|
"publint": "^0.3.21"
|
|
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.
|
|
53
|
-
"typescript": "
|
|
54
|
-
"vitest": "^4.1.
|
|
55
|
-
"@sanity/pkg-utils": "^
|
|
51
|
+
"tsdown": "^0.22.4",
|
|
52
|
+
"typescript": "7.0.2",
|
|
53
|
+
"vitest": "^4.1.10",
|
|
54
|
+
"@sanity/pkg-utils": "^11.0.0",
|
|
56
55
|
"@sanity/tsconfig": "^2.2.0"
|
|
57
56
|
},
|
|
58
57
|
"peerDependencies": {
|
|
59
58
|
"babel-plugin-react-compiler": "*",
|
|
60
|
-
"tsdown": "0.22.
|
|
61
|
-
"typescript": "
|
|
59
|
+
"tsdown": "0.22.4",
|
|
60
|
+
"typescript": "6.x || 7.x"
|
|
62
61
|
},
|
|
63
62
|
"peerDependenciesMeta": {
|
|
64
63
|
"babel-plugin-react-compiler": {
|