tailwindcss-patch 9.4.2 → 9.4.4

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.
@@ -0,0 +1,80 @@
1
+ import type {
2
+ TailwindStyleCandidateOptions,
3
+ TailwindStyleSource,
4
+ } from './style-candidates'
5
+ import type {
6
+ TailwindV3StyleGenerateOptions,
7
+ TailwindV3StyleGenerateResult,
8
+ } from './v3'
9
+ import type {
10
+ TailwindV4StyleGenerateOptions,
11
+ TailwindV4StyleGenerateResult,
12
+ } from './v4'
13
+ import { collectTailwindStyleCandidates } from './style-candidates'
14
+ import { generateTailwindV3Style } from './v3'
15
+ import { generateTailwindV4Style } from './v4'
16
+
17
+ export interface CustomTailwindStyleGenerateContext {
18
+ tokens: Set<string>
19
+ classSet: Set<string>
20
+ sources: TailwindStyleSource[]
21
+ }
22
+
23
+ export interface CustomTailwindStyleGenerateOptions extends TailwindStyleCandidateOptions {
24
+ generate: (context: CustomTailwindStyleGenerateContext) => string | Promise<string>
25
+ }
26
+
27
+ export interface CustomTailwindStyleGenerateResult {
28
+ version: 'custom'
29
+ css: string
30
+ tokens: Set<string>
31
+ classSet: Set<string>
32
+ sources: TailwindStyleSource[]
33
+ }
34
+
35
+ export type TailwindStyleGenerateOptions
36
+ = | ({ version: 3 } & TailwindV3StyleGenerateOptions)
37
+ | ({ version: 4 } & TailwindV4StyleGenerateOptions)
38
+ | ({ version: 'custom' } & CustomTailwindStyleGenerateOptions)
39
+
40
+ export type TailwindStyleGenerateResult
41
+ = | TailwindV3StyleGenerateResult
42
+ | (TailwindV4StyleGenerateResult & { version: 4 })
43
+ | CustomTailwindStyleGenerateResult
44
+
45
+ export async function generateCustomStyle(
46
+ options: CustomTailwindStyleGenerateOptions,
47
+ ): Promise<CustomTailwindStyleGenerateResult> {
48
+ const tokens = await collectTailwindStyleCandidates(options)
49
+ const classSet = new Set(tokens)
50
+ const sources = options.sources ?? []
51
+ const css = await options.generate({
52
+ tokens,
53
+ classSet,
54
+ sources,
55
+ })
56
+
57
+ return {
58
+ version: 'custom',
59
+ css,
60
+ tokens,
61
+ classSet,
62
+ sources,
63
+ }
64
+ }
65
+
66
+ export async function generateTailwindStyle(
67
+ options: TailwindStyleGenerateOptions,
68
+ ): Promise<TailwindStyleGenerateResult> {
69
+ if (options.version === 3) {
70
+ return generateTailwindV3Style(options)
71
+ }
72
+ if (options.version === 4) {
73
+ const result = await generateTailwindV4Style(options)
74
+ return {
75
+ ...result,
76
+ version: 4,
77
+ }
78
+ }
79
+ return generateCustomStyle(options)
80
+ }
@@ -0,0 +1,11 @@
1
+ export {
2
+ generateTailwindV3RawStyle,
3
+ generateTailwindV3Style,
4
+ } from './style-generator'
5
+ export type {
6
+ TailwindV3RawStyleGenerateOptions,
7
+ TailwindV3RawStyleGenerateResult,
8
+ TailwindV3StyleGenerateOptions,
9
+ TailwindV3StyleGenerateResult,
10
+ TailwindV3StyleLayer,
11
+ } from './style-generator'
@@ -0,0 +1,384 @@
1
+ import type { Node } from 'postcss'
2
+ import type { Config } from 'tailwindcss'
3
+ import type { TailwindStyleCandidateOptions, TailwindStyleSource } from '../style-candidates'
4
+ import type { TailwindcssRuntimeContext } from '../types'
5
+ import { createRequire } from 'node:module'
6
+ import process from 'node:process'
7
+ import path from 'pathe'
8
+ import postcss from 'postcss'
9
+ import { collectTailwindStyleCandidates } from '../style-candidates'
10
+
11
+ type NodeRequire = ReturnType<typeof createRequire>
12
+
13
+ interface TailwindV3CreateContextModule {
14
+ createContext: (
15
+ tailwindConfig: Config,
16
+ changedContent?: Array<{ content?: string, extension?: string }>,
17
+ root?: ReturnType<typeof postcss.root>,
18
+ ) => TailwindcssRuntimeContext
19
+ }
20
+
21
+ interface TailwindV3GenerateRulesModule {
22
+ generateRules: (
23
+ candidates: Set<string>,
24
+ context: TailwindcssRuntimeContext,
25
+ ) => Array<[unknown, Node]>
26
+ }
27
+
28
+ interface TailwindV3ProcessResult {
29
+ css: string
30
+ messages: Array<Record<string, unknown>>
31
+ }
32
+
33
+ interface TailwindV3CollapseRulesModule {
34
+ default?: (context: TailwindcssRuntimeContext) => (root: postcss.Root, result: TailwindV3ProcessResult) => void
35
+ }
36
+
37
+ interface TailwindV3ProcessTailwindFeaturesModule {
38
+ default?: (
39
+ setupContext: () => (root: postcss.Root) => TailwindcssRuntimeContext,
40
+ ) => (root: postcss.Root, result: TailwindV3ProcessResult) => Promise<TailwindcssRuntimeContext>
41
+ }
42
+
43
+ interface TailwindV3ResolveDefaultsAtRulesModule {
44
+ default?: (context: TailwindcssRuntimeContext) => (root: postcss.Root, result: TailwindV3ProcessResult) => void
45
+ }
46
+
47
+ interface TailwindV3ValidateConfigModule {
48
+ validateConfig: (config: unknown) => Config
49
+ }
50
+
51
+ interface TailwindV3SharedStateModule {
52
+ NOT_ON_DEMAND?: string
53
+ }
54
+
55
+ type ResolveConfig = (config: Config) => Config
56
+
57
+ interface TailwindV3Offsets {
58
+ sort: <T>(rules: Array<[unknown, T]>) => Array<[{
59
+ layer: 'base' | 'components' | 'defaults' | 'utilities' | 'variants'
60
+ }, T]>
61
+ }
62
+
63
+ export interface TailwindV3StyleGenerateOptions extends TailwindStyleCandidateOptions {
64
+ /**
65
+ * Tailwind v3 package name or alias. Defaults to `tailwindcss`.
66
+ */
67
+ packageName?: string
68
+ /**
69
+ * `createRequire` base used to resolve the Tailwind v3 package.
70
+ */
71
+ cwd?: string
72
+ /**
73
+ * Inline Tailwind v3 config. `content` is injected from collected candidates.
74
+ */
75
+ config?: Partial<Config>
76
+ /**
77
+ * Generate all layers by default. Pass a subset to emit only selected layers.
78
+ */
79
+ layers?: TailwindV3StyleLayer[]
80
+ }
81
+
82
+ export type TailwindV3StyleLayer = 'base' | 'components' | 'utilities' | 'variants'
83
+
84
+ export interface TailwindV3RawStyleGenerateOptions extends TailwindStyleCandidateOptions {
85
+ /**
86
+ * Tailwind v3 package name or alias. Defaults to `tailwindcss`.
87
+ */
88
+ packageName?: string
89
+ /**
90
+ * `createRequire` base used to resolve the Tailwind v3 package.
91
+ */
92
+ cwd?: string
93
+ /**
94
+ * Tailwind v3 entry CSS. Defaults to `@tailwind utilities;`.
95
+ */
96
+ css?: string
97
+ /**
98
+ * Inline Tailwind v3 config. Candidate content is injected automatically.
99
+ */
100
+ config?: Partial<Config>
101
+ /**
102
+ * Directly append generated utility rules when the CSS is exactly `@tailwind utilities;`.
103
+ * This mirrors Tailwind v3's internal fast path and keeps output order aligned.
104
+ */
105
+ directUtilitiesOnly?: boolean | 'auto'
106
+ }
107
+
108
+ export interface TailwindV3RawStyleGenerateResult {
109
+ version: 3
110
+ css: string
111
+ tokens: Set<string>
112
+ classSet: Set<string>
113
+ context: TailwindcssRuntimeContext
114
+ dependencies: string[]
115
+ sources: TailwindStyleSource[]
116
+ config: Config
117
+ }
118
+
119
+ export interface TailwindV3StyleGenerateResult {
120
+ version: 3
121
+ css: string
122
+ tokens: Set<string>
123
+ classSet: Set<string>
124
+ sources: TailwindStyleSource[]
125
+ config: Config
126
+ }
127
+
128
+ function createPackageRequire(cwd?: string): NodeRequire {
129
+ return createRequire(path.join(path.resolve(cwd ?? process.cwd()), 'package.json'))
130
+ }
131
+
132
+ function createDefaultTailwindV3Config(tokens: Set<string>): Config {
133
+ return {
134
+ content: [
135
+ {
136
+ raw: [...tokens].join(' '),
137
+ extension: 'html',
138
+ },
139
+ ],
140
+ theme: {
141
+ extend: {},
142
+ },
143
+ plugins: [],
144
+ }
145
+ }
146
+
147
+ function getDefaultExport<T>(module: { default?: T } | T): T {
148
+ if (module && typeof module === 'object' && 'default' in module) {
149
+ return module.default as T
150
+ }
151
+ return module as T
152
+ }
153
+
154
+ function loadTailwindV3Modules(options: Pick<TailwindV3StyleGenerateOptions, 'cwd' | 'packageName'>) {
155
+ const packageName = options.packageName ?? 'tailwindcss'
156
+ const moduleRequire = createPackageRequire(options.cwd)
157
+ const resolveConfig = getDefaultExport<ResolveConfig>(
158
+ moduleRequire(`${packageName}/lib/public/resolve-config`) as { default?: ResolveConfig } | ResolveConfig,
159
+ )
160
+ const contextModule = moduleRequire(`${packageName}/lib/lib/setupContextUtils`) as TailwindV3CreateContextModule
161
+ const generateRulesModule = moduleRequire(`${packageName}/lib/lib/generateRules`) as TailwindV3GenerateRulesModule
162
+ const collapseAdjacentRulesModule = moduleRequire(`${packageName}/lib/lib/collapseAdjacentRules`) as TailwindV3CollapseRulesModule
163
+ const collapseDuplicateDeclarationsModule = moduleRequire(`${packageName}/lib/lib/collapseDuplicateDeclarations`) as TailwindV3CollapseRulesModule
164
+ const processTailwindFeaturesModule = moduleRequire(`${packageName}/lib/processTailwindFeatures`) as TailwindV3ProcessTailwindFeaturesModule
165
+ const resolveDefaultsAtRulesModule = moduleRequire(`${packageName}/lib/lib/resolveDefaultsAtRules`) as TailwindV3ResolveDefaultsAtRulesModule
166
+ const sharedStateModule = moduleRequire(`${packageName}/lib/lib/sharedState`) as TailwindV3SharedStateModule
167
+ const validateConfigModule = moduleRequire(`${packageName}/lib/util/validateConfig.js`) as TailwindV3ValidateConfigModule
168
+ return {
169
+ collapseAdjacentRules: getDefaultExport(collapseAdjacentRulesModule),
170
+ collapseDuplicateDeclarations: getDefaultExport(collapseDuplicateDeclarationsModule),
171
+ createContext: contextModule.createContext,
172
+ generateRules: generateRulesModule.generateRules,
173
+ notOnDemandCandidate: sharedStateModule.NOT_ON_DEMAND ?? '*',
174
+ processTailwindFeatures: getDefaultExport(processTailwindFeaturesModule),
175
+ resolveDefaultsAtRules: getDefaultExport(resolveDefaultsAtRulesModule),
176
+ resolveConfig,
177
+ validateConfig: validateConfigModule.validateConfig,
178
+ }
179
+ }
180
+
181
+ function createRawContentEntries(candidates: Iterable<string>, sources: TailwindStyleSource[]) {
182
+ const entries: Array<{ raw: string, extension: string }> = []
183
+ const candidateContent = [...candidates].join(' ')
184
+ if (candidateContent.length > 0) {
185
+ entries.push({
186
+ raw: candidateContent,
187
+ extension: 'html',
188
+ })
189
+ }
190
+ for (const source of sources) {
191
+ entries.push({
192
+ raw: source.content,
193
+ extension: source.extension ?? 'html',
194
+ })
195
+ }
196
+ return entries
197
+ }
198
+
199
+ function createChangedContentEntries(candidates: Iterable<string>, sources: TailwindStyleSource[]) {
200
+ return createRawContentEntries(candidates, sources).map(entry => ({
201
+ content: entry.raw,
202
+ extension: entry.extension,
203
+ }))
204
+ }
205
+
206
+ function createTailwindConfigWithContent(
207
+ config: Partial<Config> | undefined,
208
+ tokens: Set<string>,
209
+ sources: TailwindStyleSource[],
210
+ ) {
211
+ const userContent = config?.content
212
+ return {
213
+ ...createDefaultTailwindV3Config(tokens),
214
+ ...(config ?? {}),
215
+ content: [
216
+ ...(Array.isArray(userContent) ? userContent : []),
217
+ ...createRawContentEntries(tokens, sources),
218
+ ],
219
+ } as Config
220
+ }
221
+
222
+ function isDirectUtilitiesOnlyCss(css: string) {
223
+ return css.replace(/\s+/g, '') === '@tailwindutilities;'
224
+ }
225
+
226
+ function sortCandidates(candidates: Iterable<string>) {
227
+ return [...candidates].sort((a, z) => {
228
+ if (a === z) {
229
+ return 0
230
+ }
231
+ return a < z ? -1 : 1
232
+ })
233
+ }
234
+
235
+ function appendUtilityRules(
236
+ root: postcss.Root,
237
+ context: TailwindcssRuntimeContext,
238
+ rules: Array<[unknown, Node]>,
239
+ ) {
240
+ const sortedRules = (context.offsets as unknown as TailwindV3Offsets).sort(rules)
241
+ for (const [sort, rule] of sortedRules) {
242
+ const tailwindRaw = rule.raws.tailwind as { parentLayer?: string } | undefined
243
+ if (sort.layer === 'utilities' || (sort.layer === 'variants' && tailwindRaw?.parentLayer === 'utilities')) {
244
+ root.append(rule.clone())
245
+ }
246
+ }
247
+ }
248
+
249
+ function collectClassSet(context: TailwindcssRuntimeContext, notOnDemandCandidate: string) {
250
+ const classSet = new Set<string>()
251
+ for (const candidate of context.classCache.keys()) {
252
+ if (String(candidate) !== String(notOnDemandCandidate)) {
253
+ classSet.add(candidate)
254
+ }
255
+ }
256
+ return classSet
257
+ }
258
+
259
+ function collectDependencyMessages(result: TailwindV3ProcessResult) {
260
+ const dependencies = new Set<string>()
261
+ for (const message of result.messages) {
262
+ const file = message.file
263
+ if (message.type === 'dependency' && typeof file === 'string') {
264
+ dependencies.add(file)
265
+ }
266
+ }
267
+ return [...dependencies]
268
+ }
269
+
270
+ function buildStylesheetNodes(
271
+ rules: Array<[unknown, Node]>,
272
+ context: TailwindcssRuntimeContext,
273
+ layers: TailwindV3StyleLayer[],
274
+ ) {
275
+ const sortedRules = (context.offsets as unknown as TailwindV3Offsets).sort(rules)
276
+ const nodes: Node[] = []
277
+ const layerSet = new Set<TailwindV3StyleLayer>(layers)
278
+
279
+ for (const [sort, rule] of sortedRules) {
280
+ const layer = sort.layer === 'defaults' ? 'base' : sort.layer
281
+ if (layerSet.has(layer)) {
282
+ nodes.push(rule.clone())
283
+ }
284
+ }
285
+ return nodes
286
+ }
287
+
288
+ function createRootFromNodes(nodes: Node[]) {
289
+ const root = postcss.root()
290
+ for (const node of nodes) {
291
+ root.append(node)
292
+ }
293
+ return root
294
+ }
295
+
296
+ export async function generateTailwindV3Style(
297
+ options: TailwindV3StyleGenerateOptions = {},
298
+ ): Promise<TailwindV3StyleGenerateResult> {
299
+ const tokens = await collectTailwindStyleCandidates(options)
300
+ const { createContext, generateRules, resolveConfig } = loadTailwindV3Modules(options)
301
+ const userContent = options.config?.content
302
+ const config = resolveConfig({
303
+ ...createDefaultTailwindV3Config(tokens),
304
+ ...(options.config ?? {}),
305
+ content: [
306
+ ...(Array.isArray(userContent) ? userContent : []),
307
+ {
308
+ raw: [...tokens].join(' '),
309
+ extension: 'html',
310
+ },
311
+ ],
312
+ } as Config)
313
+ const root = postcss.root()
314
+ const context = createContext(config, [], root)
315
+ const rules = generateRules(tokens, context)
316
+ const nodes = buildStylesheetNodes(rules, context, options.layers ?? ['base', 'components', 'utilities', 'variants'])
317
+ const css = createRootFromNodes(nodes).toString()
318
+
319
+ return {
320
+ version: 3,
321
+ css,
322
+ tokens,
323
+ classSet: new Set(context.classCache.keys()),
324
+ sources: options.sources ?? [],
325
+ config,
326
+ }
327
+ }
328
+
329
+ export async function generateTailwindV3RawStyle(
330
+ options: TailwindV3RawStyleGenerateOptions = {},
331
+ ): Promise<TailwindV3RawStyleGenerateResult> {
332
+ const tokens = await collectTailwindStyleCandidates(options)
333
+ const {
334
+ collapseAdjacentRules,
335
+ collapseDuplicateDeclarations,
336
+ createContext,
337
+ generateRules,
338
+ notOnDemandCandidate,
339
+ processTailwindFeatures,
340
+ resolveConfig,
341
+ resolveDefaultsAtRules,
342
+ validateConfig,
343
+ } = loadTailwindV3Modules(options)
344
+ const css = options.css ?? '@tailwind utilities;'
345
+ const config = validateConfig(resolveConfig(createTailwindConfigWithContent(options.config, tokens, options.sources ?? [])))
346
+ const root = postcss.parse(css, {
347
+ from: undefined,
348
+ })
349
+ const result: TailwindV3ProcessResult = {
350
+ css: '',
351
+ messages: [],
352
+ }
353
+ const changedContent = createChangedContentEntries(tokens, options.sources ?? [])
354
+ const shouldUseDirectUtilities = options.directUtilitiesOnly === true
355
+ || (options.directUtilitiesOnly !== false && isDirectUtilitiesOnlyCss(css))
356
+ let context: TailwindcssRuntimeContext
357
+
358
+ if (shouldUseDirectUtilities) {
359
+ context = createContext(config, changedContent, root)
360
+ generateRules(new Set(sortCandidates([notOnDemandCandidate, ...tokens])), context)
361
+ root.removeAll()
362
+ appendUtilityRules(root, context, [...context.ruleCache])
363
+ resolveDefaultsAtRules(context)(root, result)
364
+ collapseAdjacentRules(context)(root, result)
365
+ collapseDuplicateDeclarations(context)(root, result)
366
+ }
367
+ else {
368
+ const setupContext = () => {
369
+ return (currentRoot: postcss.Root) => createContext(config, changedContent, currentRoot)
370
+ }
371
+ context = await processTailwindFeatures(setupContext)(root, result)
372
+ }
373
+
374
+ return {
375
+ version: 3,
376
+ css: root.toString(),
377
+ tokens,
378
+ classSet: collectClassSet(context, notOnDemandCandidate),
379
+ context,
380
+ dependencies: collectDependencyMessages(result),
381
+ sources: options.sources ?? [],
382
+ config,
383
+ }
384
+ }
package/src/v4/index.ts CHANGED
@@ -1,9 +1,3 @@
1
- export {
2
- canonicalizeBareArbitraryValueCandidates,
3
- extractTailwindV4InlineSourceCandidates,
4
- replaceBareArbitraryValueSelectors,
5
- resolveValidTailwindV4Candidates,
6
- } from './candidates'
7
1
  export {
8
2
  escapeCssClassName,
9
3
  extractBareArbitraryValueSourceCandidates,
@@ -11,6 +5,12 @@ export {
11
5
  isBareArbitraryValuesEnabled,
12
6
  resolveBareArbitraryValueCandidate,
13
7
  } from './bare-arbitrary-values'
8
+ export {
9
+ canonicalizeBareArbitraryValueCandidates,
10
+ extractTailwindV4InlineSourceCandidates,
11
+ replaceBareArbitraryValueSelectors,
12
+ resolveValidTailwindV4Candidates,
13
+ } from './candidates'
14
14
  export { createTailwindV4Engine } from './engine'
15
15
  export {
16
16
  compileTailwindV4Source,
@@ -43,6 +43,10 @@ export {
43
43
  TAILWIND_V4_IGNORED_EXTENSIONS,
44
44
  TAILWIND_V4_IGNORED_FILES,
45
45
  } from './source-scan'
46
+ export {
47
+ collectTailwindV4StyleCandidates,
48
+ generateTailwindV4Style,
49
+ } from './style-generator'
46
50
  export type {
47
51
  TailwindV4CandidateSource,
48
52
  TailwindV4CompiledSourceRoot,
@@ -54,4 +58,7 @@ export type {
54
58
  TailwindV4ResolvedSource,
55
59
  TailwindV4SourceOptions,
56
60
  TailwindV4SourcePattern,
61
+ TailwindV4StyleGenerateOptions,
62
+ TailwindV4StyleGenerateResult,
63
+ TailwindV4StyleSource,
57
64
  } from './types'
@@ -0,0 +1,44 @@
1
+ import type {
2
+ TailwindV4SourceOptions,
3
+ TailwindV4StyleGenerateOptions,
4
+ TailwindV4StyleGenerateResult,
5
+ } from './types'
6
+ import { collectTailwindStyleCandidates } from '../style-candidates'
7
+ import { createTailwindV4Engine } from './engine'
8
+ import { resolveTailwindV4Source } from './source'
9
+
10
+ function createSourceOptions(options: TailwindV4StyleGenerateOptions): TailwindV4SourceOptions {
11
+ return {
12
+ ...(options.projectRoot === undefined ? {} : { projectRoot: options.projectRoot }),
13
+ ...(options.cwd === undefined ? {} : { cwd: options.cwd }),
14
+ ...(options.base === undefined ? {} : { base: options.base }),
15
+ ...(options.baseFallbacks === undefined ? {} : { baseFallbacks: options.baseFallbacks }),
16
+ ...(options.css === undefined ? {} : { css: options.css }),
17
+ ...(options.cssSources === undefined ? {} : { cssSources: options.cssSources }),
18
+ ...(options.cssEntries === undefined ? {} : { cssEntries: options.cssEntries }),
19
+ ...(options.packageName === undefined ? {} : { packageName: options.packageName }),
20
+ }
21
+ }
22
+
23
+ export async function collectTailwindV4StyleCandidates(
24
+ options: Pick<TailwindV4StyleGenerateOptions, 'bareArbitraryValues' | 'candidates' | 'sources'>,
25
+ ): Promise<Set<string>> {
26
+ return collectTailwindStyleCandidates(options)
27
+ }
28
+
29
+ export async function generateTailwindV4Style(
30
+ options: TailwindV4StyleGenerateOptions = {},
31
+ ): Promise<TailwindV4StyleGenerateResult> {
32
+ const source = options.source ?? await resolveTailwindV4Source(createSourceOptions(options))
33
+ const candidates = await collectTailwindV4StyleCandidates(options)
34
+ const result = await createTailwindV4Engine(source).generate({
35
+ candidates,
36
+ ...(options.bareArbitraryValues === undefined ? {} : { bareArbitraryValues: options.bareArbitraryValues }),
37
+ ...(options.scanSources === undefined ? {} : { scanSources: options.scanSources }),
38
+ })
39
+ return {
40
+ ...result,
41
+ tokens: result.rawCandidates,
42
+ source,
43
+ }
44
+ }
package/src/v4/types.ts CHANGED
@@ -1,3 +1,5 @@
1
+ import type { TailwindStyleSource } from '../style-candidates'
2
+
1
3
  export interface TailwindV4SourceOptions {
2
4
  projectRoot?: string
3
5
  cwd?: string
@@ -29,6 +31,8 @@ export interface TailwindV4CandidateSource {
29
31
  extension?: string
30
32
  }
31
33
 
34
+ export interface TailwindV4StyleSource extends TailwindStyleSource {}
35
+
32
36
  export interface TailwindV4GenerateOptions {
33
37
  candidates?: Iterable<string>
34
38
  sources?: TailwindV4CandidateSource[]
@@ -67,6 +71,25 @@ export interface TailwindV4GenerateResult {
67
71
  root: TailwindV4CompiledSourceRoot
68
72
  }
69
73
 
74
+ export interface TailwindV4StyleGenerateOptions extends TailwindV4SourceOptions {
75
+ source?: TailwindV4ResolvedSource
76
+ candidates?: Iterable<string>
77
+ sources?: TailwindV4StyleSource[]
78
+ /**
79
+ * Enables UnoCSS-style bare arbitrary values such as `p-10%` and `p-2.5px`.
80
+ */
81
+ bareArbitraryValues?: TailwindV4GenerateOptions['bareArbitraryValues']
82
+ /**
83
+ * Scans the compiled Tailwind CSS v4 source entries in addition to in-memory sources.
84
+ */
85
+ scanSources?: TailwindV4GenerateOptions['scanSources']
86
+ }
87
+
88
+ export interface TailwindV4StyleGenerateResult extends TailwindV4GenerateResult {
89
+ tokens: Set<string>
90
+ source: TailwindV4ResolvedSource
91
+ }
92
+
70
93
  export interface TailwindV4DesignSystem {
71
94
  parseCandidate: (candidate: string) => unknown[]
72
95
  candidatesToCss: (candidates: string[]) => Array<string | null | undefined>
@@ -1,28 +0,0 @@
1
- //#region \0rolldown/runtime.js
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __copyProps = (to, from, except, desc) => {
9
- if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
10
- key = keys[i];
11
- if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
12
- get: ((k) => from[k]).bind(null, key),
13
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
14
- });
15
- }
16
- return to;
17
- };
18
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
19
- value: mod,
20
- enumerable: true
21
- }) : target, mod));
22
- //#endregion
23
- Object.defineProperty(exports, "__toESM", {
24
- enumerable: true,
25
- get: function() {
26
- return __toESM;
27
- }
28
- });
File without changes