File tree Expand file tree Collapse file tree 7 files changed +35
-35
lines changed
Expand file tree Collapse file tree 7 files changed +35
-35
lines changed Original file line number Diff line number Diff line change @@ -7,7 +7,7 @@ import { createDefu } from 'defu'
77import isInCi from 'is-in-ci'
88import { createDebug } from 'obug'
99import { resolveClean } from '../features/clean.ts'
10- import { resolveCssOptions } from '../features/css.ts'
10+ import { resolveCssOptions } from '../features/css/index .ts'
1111import { resolveEntry } from '../features/entry.ts'
1212import { hasExportsTypes } from '../features/pkg/exports.ts'
1313import { resolveTarget } from '../features/target.ts'
Original file line number Diff line number Diff line change 11import type { CopyEntry , CopyOptions , CopyOptionsFn } from '../features/copy.ts'
2- import type { CssOptions } from '../features/css.ts'
2+ import type { CssOptions } from '../features/css/index .ts'
33import type { DevtoolsOptions } from '../features/devtools.ts'
44import type {
55 BuildContext ,
Original file line number Diff line number Diff line change 1+ export interface CssOptions {
2+ /**
3+ * Enable/disable CSS code splitting.
4+ * When set to `false`, all CSS in the entire project will be extracted into a single CSS file.
5+ * When set to `true`, CSS imported in async JS chunks will be preserved as chunks.
6+ * @default true
7+ */
8+ splitting ?: boolean
9+
10+ /**
11+ * Specify the name of the CSS file.
12+ * @default 'style.css'
13+ */
14+ fileName ?: string
15+ }
16+
17+ export const defaultCssBundleName = 'style.css'
18+
19+ export function resolveCssOptions (
20+ options : CssOptions = { } ,
21+ ) : Required < CssOptions > {
22+ return {
23+ splitting : options . splitting ?? true ,
24+ fileName : options . fileName ?? defaultCssBundleName ,
25+ }
26+ }
Original file line number Diff line number Diff line change 1- import { esbuildTargetToLightningCSS } from '../utils/lightningcss.ts'
2- import type { ResolvedConfig } from '../config/index.ts'
1+ import { esbuildTargetToLightningCSS } from '../../ utils/lightningcss.ts'
2+ import type { ResolvedConfig } from '../../ config/index.ts'
33import type { Plugin } from 'rolldown'
44
55export async function LightningCSSPlugin (
Original file line number Diff line number Diff line change 11import { RE_CSS } from 'rolldown-plugin-dts/filename'
2- import type { ResolvedConfig } from '../config/index.ts'
2+ import { defaultCssBundleName } from './index.ts'
3+ import type { ResolvedConfig } from '../../config/index.ts'
34import type { OutputAsset , OutputChunk , Plugin } from 'rolldown'
45
5- export interface CssOptions {
6- /**
7- * Enable/disable CSS code splitting.
8- * When set to `false`, all CSS in the entire project will be extracted into a single CSS file.
9- * When set to `true`, CSS imported in async JS chunks will be preserved as chunks.
10- * @default true
11- */
12- splitting ?: boolean
13-
14- /**
15- * Specify the name of the CSS file.
16- * @default 'style.css'
17- */
18- fileName ?: string
19- }
20-
21- const defaultCssBundleName = 'style.css'
22-
23- export function resolveCssOptions (
24- options : CssOptions = { } ,
25- ) : Required < CssOptions > {
26- return {
27- splitting : options . splitting ?? true ,
28- fileName : options . fileName ?? defaultCssBundleName ,
29- }
30- }
31-
326// Regular expressions for file matching
337const RE_CSS_HASH = / - [ \w - ] + \. c s s $ /
348const RE_CHUNK_HASH = / - [ \w - ] + \. ( m ? j s | c j s ) $ /
Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ import path from 'node:path'
22import process from 'node:process'
33import { describe , test } from 'vitest'
44import { globalLogger } from '../../utils/logger.ts'
5- import { resolveCssOptions } from '../css.ts'
5+ import { resolveCssOptions } from '../css/index .ts'
66import { generateExports as _generateExports } from './exports.ts'
77import type { ResolvedConfig } from '../../config/types.ts'
88import type { ChunksByFormat , RolldownChunk } from '../../utils/chunks.ts'
Original file line number Diff line number Diff line change @@ -16,9 +16,9 @@ import { mergeUserOptions } from '../config/options.ts'
1616import { lowestCommonAncestor } from '../utils/fs.ts'
1717import { importWithError } from '../utils/general.ts'
1818import { LogLevels } from '../utils/logger.ts'
19- import { CssCodeSplitPlugin } from './css.ts'
19+ import { LightningCSSPlugin } from './css/lightningcss.ts'
20+ import { CssCodeSplitPlugin } from './css/splitting.ts'
2021import { ExternalPlugin } from './external.ts'
21- import { LightningCSSPlugin } from './lightningcss.ts'
2222import { NodeProtocolPlugin } from './node-protocol.ts'
2323import { resolveChunkAddon , resolveChunkFilename } from './output.ts'
2424import { ReportPlugin } from './report.ts'
You can’t perform that action at this time.
0 commit comments