tailwindcss 0.0.0-insiders.bd970d0 → 0.0.0-insiders.bda8421
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 +1 -2
- package/lib/cli/build/deps.js +62 -0
- package/lib/cli/build/index.js +12 -15
- package/lib/cli/build/plugin.js +107 -167
- package/lib/cli/build/utils.js +13 -13
- package/lib/cli/build/watching.js +10 -10
- package/lib/cli/help/index.js +11 -11
- package/lib/cli/index.js +60 -61
- package/lib/cli/init/index.js +16 -16
- package/lib/cli-peer-dependencies.js +36 -0
- package/lib/cli.js +1 -1
- package/lib/corePluginList.js +4 -1
- package/lib/corePlugins.js +2018 -1905
- package/lib/css/preflight.css +18 -12
- package/lib/featureFlags.js +17 -23
- package/lib/index.js +1 -1
- package/lib/lib/cacheInvalidation.js +3 -3
- package/lib/lib/collapseAdjacentRules.js +6 -6
- package/lib/lib/collapseDuplicateDeclarations.js +1 -1
- package/lib/lib/content.js +39 -32
- package/lib/lib/defaultExtractor.js +40 -17
- package/lib/lib/evaluateTailwindFunctions.js +23 -23
- package/lib/lib/expandApplyAtRules.js +37 -18
- package/lib/lib/expandTailwindAtRules.js +49 -85
- package/lib/lib/findAtConfigPath.js +5 -5
- package/lib/lib/generateRules.js +82 -55
- package/lib/lib/getModuleDependencies.js +23 -23
- package/lib/lib/load-config.js +21 -6
- package/lib/lib/normalizeTailwindDirectives.js +36 -21
- package/lib/lib/offsets.js +97 -48
- package/lib/lib/partitionApplyAtRules.js +2 -2
- package/lib/lib/regex.js +5 -5
- package/lib/lib/resolveDefaultsAtRules.js +27 -25
- package/lib/lib/setupContextUtils.js +195 -167
- package/lib/lib/setupTrackingContext.js +4 -5
- package/lib/lib/sharedState.js +10 -10
- package/lib/lib/substituteScreenAtRules.js +4 -4
- package/lib/plugin.js +8 -124
- package/lib/postcss-plugins/nesting/index.js +2 -2
- package/lib/postcss-plugins/nesting/plugin.js +11 -11
- package/lib/processTailwindFeatures.js +3 -5
- package/lib/public/colors.js +264 -264
- package/lib/util/applyImportantSelector.js +2 -2
- package/lib/util/buildMediaQuery.js +2 -2
- package/lib/util/cloneDeep.js +1 -1
- package/lib/util/cloneNodes.js +33 -13
- package/lib/util/color.js +19 -19
- package/lib/util/createUtilityPlugin.js +3 -3
- package/lib/util/dataTypes.js +170 -113
- package/lib/util/defaults.js +4 -4
- package/lib/util/escapeClassName.js +2 -2
- package/lib/util/escapeCommas.js +1 -1
- package/lib/util/flattenColorPalette.js +2 -2
- package/lib/util/formatVariantSelector.js +24 -19
- package/lib/util/getAllConfigs.js +4 -5
- package/lib/util/isKeyframeRule.js +1 -1
- package/lib/util/isPlainObject.js +2 -2
- package/lib/util/isSyntacticallyValidPropertyValue.js +10 -10
- package/lib/util/log.js +6 -23
- package/lib/util/nameClass.js +4 -4
- package/lib/util/negateValue.js +8 -8
- package/lib/util/normalizeConfig.js +63 -94
- package/lib/util/normalizeScreens.js +18 -18
- package/lib/util/parseAnimationValue.js +38 -38
- package/lib/util/parseBoxShadowValue.js +18 -18
- package/lib/util/parseDependency.js +4 -4
- package/lib/util/parseGlob.js +4 -4
- package/lib/util/parseObjectStyles.js +1 -1
- package/lib/util/pluginUtils.js +36 -21
- package/lib/util/prefixSelector.js +4 -4
- package/lib/util/pseudoElements.js +72 -69
- package/lib/util/removeAlphaVariables.js +1 -1
- package/lib/util/resolveConfig.js +11 -15
- package/lib/util/resolveConfigPath.js +6 -6
- package/lib/util/responsive.js +1 -1
- package/lib/util/splitAtTopLevelOnly.js +3 -3
- package/lib/util/toColorValue.js +1 -1
- package/lib/util/toPath.js +2 -2
- package/lib/util/transformThemeValue.js +24 -24
- package/lib/util/validateConfig.js +9 -20
- package/lib/util/validateFormalSyntax.js +5 -5
- package/lib/util/withAlphaVariable.js +5 -5
- package/lib/value-parser/index.js +5 -5
- package/lib/value-parser/parse.js +43 -43
- package/lib/value-parser/stringify.js +11 -11
- package/lib/value-parser/unit.js +5 -5
- package/lib/value-parser/walk.js +1 -1
- package/nesting/index.d.ts +4 -0
- package/package.json +41 -36
- package/peers/index.js +96503 -0
- package/resolveConfig.d.ts +22 -3
- package/scripts/generate-types.js +1 -2
- package/scripts/release-notes.js +1 -1
- package/src/cli/build/deps.js +56 -0
- package/src/cli/build/index.js +0 -4
- package/src/cli/build/plugin.js +53 -85
- package/src/cli/build/watching.js +1 -1
- package/src/cli/index.js +0 -1
- package/src/cli-peer-dependencies.js +15 -0
- package/src/corePluginList.js +1 -1
- package/src/corePlugins.js +118 -31
- package/src/css/preflight.css +18 -12
- package/src/featureFlags.js +3 -5
- package/src/lib/content.js +39 -30
- package/src/lib/defaultExtractor.js +29 -6
- package/src/lib/expandApplyAtRules.js +24 -0
- package/src/lib/expandTailwindAtRules.js +19 -56
- package/src/lib/generateRules.js +39 -8
- package/src/lib/load-config.ts +13 -0
- package/src/lib/normalizeTailwindDirectives.js +27 -0
- package/src/lib/offsets.js +62 -3
- package/src/lib/resolveDefaultsAtRules.js +5 -1
- package/src/lib/setupContextUtils.js +79 -39
- package/src/plugin.js +0 -86
- package/src/processTailwindFeatures.js +0 -3
- package/src/util/cloneNodes.js +35 -14
- package/src/util/dataTypes.js +72 -6
- package/src/util/formatVariantSelector.js +7 -0
- package/src/util/isPlainObject.js +1 -1
- package/src/util/log.js +0 -24
- package/src/util/normalizeConfig.js +11 -38
- package/src/util/pluginUtils.js +20 -0
- package/src/util/pseudoElements.js +4 -0
- package/src/util/validateConfig.js +0 -10
- package/stubs/config.full.js +68 -8
- package/stubs/config.simple.js +1 -1
- package/stubs/postcss.config.cjs +1 -0
- package/stubs/postcss.config.js +1 -0
- package/types/config.d.ts +12 -5
- package/types/generated/corePluginList.d.ts +1 -1
- package/types/generated/default-theme.d.ts +28 -9
- package/types/index.d.ts +7 -3
- package/index.css +0 -5
- package/lib/lib/detectNesting.js +0 -45
- package/lib/lib/handleImportAtRules.js +0 -50
- package/src/lib/detectNesting.js +0 -47
- package/src/lib/handleImportAtRules.js +0 -34
package/resolveConfig.d.ts
CHANGED
|
@@ -1,11 +1,30 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { Config, ResolvableTo, ThemeConfig } from './types/config'
|
|
2
|
+
import { DefaultTheme } from './types/generated/default-theme'
|
|
3
|
+
import { DefaultColors } from './types/generated/colors'
|
|
4
|
+
|
|
5
|
+
type ResolvedConfig<T extends Config> = Omit<T, 'theme'> & {
|
|
6
|
+
theme: MergeThemes<
|
|
7
|
+
UnwrapResolvables<Omit<T['theme'], 'extend'>>,
|
|
8
|
+
T['theme'] extends { extend: infer TExtend } ? UnwrapResolvables<TExtend> : {}
|
|
9
|
+
>
|
|
10
|
+
}
|
|
2
11
|
|
|
3
12
|
type UnwrapResolvables<T> = {
|
|
4
13
|
[K in keyof T]: T[K] extends ResolvableTo<infer R> ? R : T[K]
|
|
5
14
|
}
|
|
6
15
|
|
|
7
|
-
type
|
|
8
|
-
|
|
16
|
+
type ThemeConfigResolved = UnwrapResolvables<ThemeConfig>
|
|
17
|
+
type DefaultThemeFull = DefaultTheme & { colors: DefaultColors }
|
|
18
|
+
|
|
19
|
+
type MergeThemes<Overrides extends object, Extensions extends object> = {
|
|
20
|
+
[K in keyof ThemeConfigResolved | keyof Overrides]: (K extends keyof Overrides
|
|
21
|
+
? Overrides[K]
|
|
22
|
+
: K extends keyof DefaultThemeFull
|
|
23
|
+
? DefaultThemeFull[K]
|
|
24
|
+
: K extends keyof ThemeConfigResolved
|
|
25
|
+
? ThemeConfigResolved[K]
|
|
26
|
+
: never) &
|
|
27
|
+
(K extends keyof Extensions ? Extensions[K] : {})
|
|
9
28
|
}
|
|
10
29
|
|
|
11
30
|
declare function resolveConfig<T extends Config>(config: T): ResolvedConfig<T>
|
|
@@ -91,9 +91,8 @@ fs.writeFileSync(
|
|
|
91
91
|
path.join(process.cwd(), 'types', 'generated', 'default-theme.d.ts'),
|
|
92
92
|
prettier.format(
|
|
93
93
|
`
|
|
94
|
-
import { Config } from '../../types'
|
|
95
94
|
type CSSDeclarationList = Record<string, string>
|
|
96
|
-
export type DefaultTheme =
|
|
95
|
+
export type DefaultTheme = { ${defaultThemeTypes} }
|
|
97
96
|
`,
|
|
98
97
|
{
|
|
99
98
|
semi: false,
|
package/scripts/release-notes.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// Given a version, figure out what the release notes are so that we can use this to pre-fill the
|
|
2
|
-
//
|
|
2
|
+
// relase notes on a GitHub release for the current version.
|
|
3
3
|
|
|
4
4
|
let path = require('path')
|
|
5
5
|
let fs = require('fs')
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
// @ts-check
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
// @ts-ignore
|
|
5
|
+
lazyPostcss,
|
|
6
|
+
|
|
7
|
+
// @ts-ignore
|
|
8
|
+
lazyPostcssImport,
|
|
9
|
+
|
|
10
|
+
// @ts-ignore
|
|
11
|
+
lazyCssnano,
|
|
12
|
+
|
|
13
|
+
// @ts-ignore
|
|
14
|
+
lazyAutoprefixer,
|
|
15
|
+
} from '../../../peers/index.js'
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* @returns {import('postcss')}
|
|
19
|
+
*/
|
|
20
|
+
export function loadPostcss() {
|
|
21
|
+
// Try to load a local `postcss` version first
|
|
22
|
+
try {
|
|
23
|
+
return require('postcss')
|
|
24
|
+
} catch {}
|
|
25
|
+
|
|
26
|
+
return lazyPostcss()
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export function loadPostcssImport() {
|
|
30
|
+
// Try to load a local `postcss-import` version first
|
|
31
|
+
try {
|
|
32
|
+
return require('postcss-import')
|
|
33
|
+
} catch {}
|
|
34
|
+
|
|
35
|
+
return lazyPostcssImport()
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export function loadCssNano() {
|
|
39
|
+
let options = { preset: ['default', { cssDeclarationSorter: false }] }
|
|
40
|
+
|
|
41
|
+
// Try to load a local `cssnano` version first
|
|
42
|
+
try {
|
|
43
|
+
return require('cssnano')
|
|
44
|
+
} catch {}
|
|
45
|
+
|
|
46
|
+
return lazyCssnano()(options)
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export function loadAutoprefixer() {
|
|
50
|
+
// Try to load a local `autoprefixer` version first
|
|
51
|
+
try {
|
|
52
|
+
return require('autoprefixer')
|
|
53
|
+
} catch {}
|
|
54
|
+
|
|
55
|
+
return lazyAutoprefixer()
|
|
56
|
+
}
|
package/src/cli/build/index.js
CHANGED
|
@@ -25,10 +25,6 @@ export async function build(args) {
|
|
|
25
25
|
process.exit(9)
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
if (args['--no-autoprefixer']) {
|
|
29
|
-
console.error('[deprecation] The --no-autoprefixer flag is deprecated and has no effect.')
|
|
30
|
-
}
|
|
31
|
-
|
|
32
28
|
// TODO: Reference the @config path here if exists
|
|
33
29
|
let configPath = args['--config'] ? args['--config'] : resolveDefaultConfigPath()
|
|
34
30
|
|
package/src/cli/build/plugin.js
CHANGED
|
@@ -1,17 +1,14 @@
|
|
|
1
1
|
// @ts-check
|
|
2
2
|
|
|
3
|
-
import pkg from '../../../package.json'
|
|
4
3
|
import path from 'path'
|
|
5
4
|
import fs from 'fs'
|
|
6
|
-
import postcss from 'postcss'
|
|
7
5
|
import postcssrc from 'postcss-load-config'
|
|
8
|
-
import browserslist from 'browserslist'
|
|
9
|
-
import lightning, { Features } from 'lightningcss'
|
|
10
6
|
import { lilconfig } from 'lilconfig'
|
|
11
7
|
import loadPlugins from 'postcss-load-config/src/plugins' // Little bit scary, looking at private/internal API
|
|
12
8
|
import loadOptions from 'postcss-load-config/src/options' // Little bit scary, looking at private/internal API
|
|
13
9
|
|
|
14
10
|
import tailwind from '../../processTailwindFeatures'
|
|
11
|
+
import { loadAutoprefixer, loadCssNano, loadPostcss, loadPostcssImport } from './deps'
|
|
15
12
|
import { formatNodes, drainStdin, outputFile } from './utils'
|
|
16
13
|
import { env } from '../../lib/sharedState'
|
|
17
14
|
import resolveConfig from '../../../resolveConfig.js'
|
|
@@ -22,53 +19,6 @@ import { findAtConfigPath } from '../../lib/findAtConfigPath.js'
|
|
|
22
19
|
import log from '../../util/log'
|
|
23
20
|
import { loadConfig } from '../../lib/load-config'
|
|
24
21
|
import getModuleDependencies from '../../lib/getModuleDependencies'
|
|
25
|
-
import { validateConfig } from '../../util/validateConfig'
|
|
26
|
-
import { handleImportAtRules } from '../../lib/handleImportAtRules'
|
|
27
|
-
import { flagEnabled } from '../../featureFlags'
|
|
28
|
-
|
|
29
|
-
function license() {
|
|
30
|
-
return `/* ! tailwindcss v${pkg.version} | MIT License | https://tailwindcss.com */\n`
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
async function lightningcss(result, { map = true, minify = true } = {}) {
|
|
34
|
-
try {
|
|
35
|
-
let resolvedBrowsersListConfig = browserslist.findConfig(
|
|
36
|
-
result.opts.from ?? process.cwd()
|
|
37
|
-
)?.defaults
|
|
38
|
-
let defaultBrowsersListConfig = pkg.browserslist
|
|
39
|
-
let browsersListConfig = resolvedBrowsersListConfig ?? defaultBrowsersListConfig
|
|
40
|
-
|
|
41
|
-
let transformed = lightning.transform({
|
|
42
|
-
filename: result.opts.from || 'input.css',
|
|
43
|
-
code: Buffer.from(result.css, 'utf-8'),
|
|
44
|
-
minify,
|
|
45
|
-
sourceMap: result.map === undefined ? map : !!result.map,
|
|
46
|
-
inputSourceMap: result.map ? result.map.toString() : undefined,
|
|
47
|
-
targets: lightning.browserslistToTargets(browserslist(browsersListConfig)),
|
|
48
|
-
drafts: {
|
|
49
|
-
nesting: true,
|
|
50
|
-
},
|
|
51
|
-
include: Features.Nesting,
|
|
52
|
-
exclude: Features.LogicalProperties,
|
|
53
|
-
})
|
|
54
|
-
|
|
55
|
-
return Object.assign(result, {
|
|
56
|
-
css: transformed.code.toString('utf8'),
|
|
57
|
-
map: result.map
|
|
58
|
-
? Object.assign(result.map, {
|
|
59
|
-
toString() {
|
|
60
|
-
return transformed.map?.toString()
|
|
61
|
-
},
|
|
62
|
-
})
|
|
63
|
-
: result.map,
|
|
64
|
-
})
|
|
65
|
-
} catch (err) {
|
|
66
|
-
console.error('Unable to use Lightning CSS. Using raw version instead.')
|
|
67
|
-
console.error(err)
|
|
68
|
-
|
|
69
|
-
return result
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
22
|
|
|
73
23
|
/**
|
|
74
24
|
*
|
|
@@ -125,6 +75,39 @@ async function loadPostCssPlugins(customPostCssPath) {
|
|
|
125
75
|
return [beforePlugins, afterPlugins, config.options]
|
|
126
76
|
}
|
|
127
77
|
|
|
78
|
+
function loadBuiltinPostcssPlugins() {
|
|
79
|
+
let postcss = loadPostcss()
|
|
80
|
+
let IMPORT_COMMENT = '__TAILWIND_RESTORE_IMPORT__: '
|
|
81
|
+
return [
|
|
82
|
+
[
|
|
83
|
+
(root) => {
|
|
84
|
+
root.walkAtRules('import', (rule) => {
|
|
85
|
+
if (rule.params.slice(1).startsWith('tailwindcss/')) {
|
|
86
|
+
rule.after(postcss.comment({ text: IMPORT_COMMENT + rule.params }))
|
|
87
|
+
rule.remove()
|
|
88
|
+
}
|
|
89
|
+
})
|
|
90
|
+
},
|
|
91
|
+
loadPostcssImport(),
|
|
92
|
+
(root) => {
|
|
93
|
+
root.walkComments((rule) => {
|
|
94
|
+
if (rule.text.startsWith(IMPORT_COMMENT)) {
|
|
95
|
+
rule.after(
|
|
96
|
+
postcss.atRule({
|
|
97
|
+
name: 'import',
|
|
98
|
+
params: rule.text.replace(IMPORT_COMMENT, ''),
|
|
99
|
+
})
|
|
100
|
+
)
|
|
101
|
+
rule.remove()
|
|
102
|
+
}
|
|
103
|
+
})
|
|
104
|
+
},
|
|
105
|
+
],
|
|
106
|
+
[],
|
|
107
|
+
{},
|
|
108
|
+
]
|
|
109
|
+
}
|
|
110
|
+
|
|
128
111
|
let state = {
|
|
129
112
|
/** @type {any} */
|
|
130
113
|
context: null,
|
|
@@ -135,7 +118,7 @@ let state = {
|
|
|
135
118
|
/** @type {{content: string, extension: string}[]} */
|
|
136
119
|
changedContent: [],
|
|
137
120
|
|
|
138
|
-
/** @type {
|
|
121
|
+
/** @type {ReturnType<typeof load> | null} */
|
|
139
122
|
configBag: null,
|
|
140
123
|
|
|
141
124
|
contextDependencies: new Set(),
|
|
@@ -177,7 +160,8 @@ let state = {
|
|
|
177
160
|
},
|
|
178
161
|
}
|
|
179
162
|
|
|
180
|
-
|
|
163
|
+
// @ts-ignore
|
|
164
|
+
this.configBag.config = resolveConfig(this.configBag.config, { content: { files: [] } })
|
|
181
165
|
|
|
182
166
|
// Override content files if `--content` has been passed explicitly
|
|
183
167
|
if (content?.length > 0) {
|
|
@@ -201,17 +185,10 @@ let state = {
|
|
|
201
185
|
let files = fastGlob.sync(this.contentPatterns.all)
|
|
202
186
|
|
|
203
187
|
for (let file of files) {
|
|
204
|
-
|
|
205
|
-
content.
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
})
|
|
209
|
-
} else {
|
|
210
|
-
content.push({
|
|
211
|
-
content: fs.readFileSync(path.resolve(file), 'utf8'),
|
|
212
|
-
extension: path.extname(file).slice(1),
|
|
213
|
-
})
|
|
214
|
-
}
|
|
188
|
+
content.push({
|
|
189
|
+
content: fs.readFileSync(path.resolve(file), 'utf8'),
|
|
190
|
+
extension: path.extname(file).slice(1),
|
|
191
|
+
})
|
|
215
192
|
}
|
|
216
193
|
|
|
217
194
|
// Resolve raw content in the tailwind config
|
|
@@ -227,16 +204,16 @@ let state = {
|
|
|
227
204
|
},
|
|
228
205
|
|
|
229
206
|
getContext({ createContext, cliConfigPath, root, result, content }) {
|
|
207
|
+
env.DEBUG && console.time('Searching for config')
|
|
208
|
+
let configPath = findAtConfigPath(root, result) ?? cliConfigPath
|
|
209
|
+
env.DEBUG && console.timeEnd('Searching for config')
|
|
210
|
+
|
|
230
211
|
if (this.context) {
|
|
231
212
|
this.context.changedContent = this.changedContent.splice(0)
|
|
232
213
|
|
|
233
214
|
return this.context
|
|
234
215
|
}
|
|
235
216
|
|
|
236
|
-
env.DEBUG && console.time('Searching for config')
|
|
237
|
-
let configPath = findAtConfigPath(root, result) ?? cliConfigPath
|
|
238
|
-
env.DEBUG && console.timeEnd('Searching for config')
|
|
239
|
-
|
|
240
217
|
env.DEBUG && console.time('Loading config')
|
|
241
218
|
let config = this.loadConfig(configPath, content)
|
|
242
219
|
env.DEBUG && console.timeEnd('Loading config')
|
|
@@ -267,6 +244,8 @@ let state = {
|
|
|
267
244
|
}
|
|
268
245
|
|
|
269
246
|
export async function createProcessor(args, cliConfigPath) {
|
|
247
|
+
let postcss = loadPostcss()
|
|
248
|
+
|
|
270
249
|
let input = args['--input']
|
|
271
250
|
let output = args['--output']
|
|
272
251
|
let includePostCss = args['--postcss']
|
|
@@ -274,9 +253,7 @@ export async function createProcessor(args, cliConfigPath) {
|
|
|
274
253
|
|
|
275
254
|
let [beforePlugins, afterPlugins, postcssOptions] = includePostCss
|
|
276
255
|
? await loadPostCssPlugins(customPostCssPath)
|
|
277
|
-
:
|
|
278
|
-
|
|
279
|
-
beforePlugins.unshift(...handleImportAtRules())
|
|
256
|
+
: loadBuiltinPostcssPlugins()
|
|
280
257
|
|
|
281
258
|
if (args['--purge']) {
|
|
282
259
|
log.warn('purge-flag-deprecated', [
|
|
@@ -322,6 +299,8 @@ export async function createProcessor(args, cliConfigPath) {
|
|
|
322
299
|
tailwindPlugin,
|
|
323
300
|
!args['--minify'] && formatNodes,
|
|
324
301
|
...afterPlugins,
|
|
302
|
+
!args['--no-autoprefixer'] && loadAutoprefixer(),
|
|
303
|
+
args['--minify'] && loadCssNano(),
|
|
325
304
|
].filter(Boolean)
|
|
326
305
|
|
|
327
306
|
/** @type {import('postcss').Processor} */
|
|
@@ -345,20 +324,9 @@ export async function createProcessor(args, cliConfigPath) {
|
|
|
345
324
|
|
|
346
325
|
async function build() {
|
|
347
326
|
let start = process.hrtime.bigint()
|
|
348
|
-
let options = {
|
|
349
|
-
...postcssOptions,
|
|
350
|
-
from: input,
|
|
351
|
-
to: output,
|
|
352
|
-
}
|
|
353
327
|
|
|
354
328
|
return readInput()
|
|
355
|
-
.then((css) => processor.process(css,
|
|
356
|
-
.then((result) =>
|
|
357
|
-
lightningcss(result, {
|
|
358
|
-
...options,
|
|
359
|
-
minify: !!args['--minify'],
|
|
360
|
-
})
|
|
361
|
-
)
|
|
329
|
+
.then((css) => processor.process(css, { ...postcssOptions, from: input, to: output }))
|
|
362
330
|
.then((result) => {
|
|
363
331
|
if (!state.watcher) {
|
|
364
332
|
return result
|
|
@@ -381,12 +349,12 @@ export async function createProcessor(args, cliConfigPath) {
|
|
|
381
349
|
})
|
|
382
350
|
.then((result) => {
|
|
383
351
|
if (!output) {
|
|
384
|
-
process.stdout.write(
|
|
352
|
+
process.stdout.write(result.css)
|
|
385
353
|
return
|
|
386
354
|
}
|
|
387
355
|
|
|
388
356
|
return Promise.all([
|
|
389
|
-
outputFile(result.opts.to,
|
|
357
|
+
outputFile(result.opts.to, result.css),
|
|
390
358
|
result.map && outputFile(result.opts.to + '.map', result.map.toString()),
|
|
391
359
|
])
|
|
392
360
|
})
|
|
@@ -164,7 +164,7 @@ export function createWatcher(args, { state, rebuild }) {
|
|
|
164
164
|
// This is very likely a chokidar bug but it's one we need to work around
|
|
165
165
|
// We treat this as a change event and rebuild the CSS
|
|
166
166
|
watcher.on('raw', (evt, filePath, meta) => {
|
|
167
|
-
if (evt !== 'rename') {
|
|
167
|
+
if (evt !== 'rename' || filePath === null) {
|
|
168
168
|
return
|
|
169
169
|
}
|
|
170
170
|
|
package/src/cli/index.js
CHANGED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export function lazyPostcss() {
|
|
2
|
+
return require('postcss')
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
export function lazyPostcssImport() {
|
|
6
|
+
return require('postcss-import')
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export function lazyAutoprefixer() {
|
|
10
|
+
return require('autoprefixer')
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export function lazyCssnano() {
|
|
14
|
+
return require('cssnano')
|
|
15
|
+
}
|
package/src/corePluginList.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export default ["preflight","container","accessibility","pointerEvents","visibility","position","inset","isolation","zIndex","order","gridColumn","gridColumnStart","gridColumnEnd","gridRow","gridRowStart","gridRowEnd","float","clear","margin","boxSizing","lineClamp","display","aspectRatio","height","maxHeight","minHeight","width","minWidth","maxWidth","flex","flexShrink","flexGrow","flexBasis","tableLayout","captionSide","borderCollapse","borderSpacing","transformOrigin","translate","rotate","skew","scale","transform","animation","cursor","touchAction","userSelect","resize","scrollSnapType","scrollSnapAlign","scrollSnapStop","scrollMargin","scrollPadding","listStylePosition","listStyleType","listStyleImage","appearance","columns","breakBefore","breakInside","breakAfter","gridAutoColumns","gridAutoFlow","gridAutoRows","gridTemplateColumns","gridTemplateRows","flexDirection","flexWrap","placeContent","placeItems","alignContent","alignItems","justifyContent","justifyItems","gap","space","divideWidth","divideStyle","divideColor","divideOpacity","placeSelf","alignSelf","justifySelf","overflow","overscrollBehavior","scrollBehavior","textOverflow","hyphens","whitespace","textWrap","wordBreak","borderRadius","borderWidth","borderStyle","borderColor","borderOpacity","backgroundColor","backgroundOpacity","backgroundImage","gradientColorStops","boxDecorationBreak","backgroundSize","backgroundAttachment","backgroundClip","backgroundPosition","backgroundRepeat","backgroundOrigin","fill","stroke","strokeWidth","objectFit","objectPosition","padding","textAlign","textIndent","verticalAlign","fontFamily","fontSize","fontWeight","textTransform","fontStyle","fontVariantNumeric","lineHeight","letterSpacing","textColor","textOpacity","textDecoration","textDecorationColor","textDecorationStyle","textDecorationThickness","textUnderlineOffset","fontSmoothing","placeholderColor","placeholderOpacity","caretColor","accentColor","opacity","backgroundBlendMode","mixBlendMode","boxShadow","boxShadowColor","outlineStyle","outlineWidth","outlineOffset","outlineColor","ringWidth","ringColor","ringOpacity","ringOffsetWidth","ringOffsetColor","blur","brightness","contrast","dropShadow","grayscale","hueRotate","invert","saturate","sepia","filter","backdropBlur","backdropBrightness","backdropContrast","backdropGrayscale","backdropHueRotate","backdropInvert","backdropOpacity","backdropSaturate","backdropSepia","backdropFilter","transitionProperty","transitionDelay","transitionDuration","transitionTimingFunction","willChange","content"]
|
|
1
|
+
export default ["preflight","container","accessibility","pointerEvents","visibility","position","inset","isolation","zIndex","order","gridColumn","gridColumnStart","gridColumnEnd","gridRow","gridRowStart","gridRowEnd","float","clear","margin","boxSizing","lineClamp","display","aspectRatio","size","height","maxHeight","minHeight","width","minWidth","maxWidth","flex","flexShrink","flexGrow","flexBasis","tableLayout","captionSide","borderCollapse","borderSpacing","transformOrigin","translate","rotate","skew","scale","transform","animation","cursor","touchAction","userSelect","resize","scrollSnapType","scrollSnapAlign","scrollSnapStop","scrollMargin","scrollPadding","listStylePosition","listStyleType","listStyleImage","appearance","columns","breakBefore","breakInside","breakAfter","gridAutoColumns","gridAutoFlow","gridAutoRows","gridTemplateColumns","gridTemplateRows","flexDirection","flexWrap","placeContent","placeItems","alignContent","alignItems","justifyContent","justifyItems","gap","space","divideWidth","divideStyle","divideColor","divideOpacity","placeSelf","alignSelf","justifySelf","overflow","overscrollBehavior","scrollBehavior","textOverflow","hyphens","whitespace","textWrap","wordBreak","borderRadius","borderWidth","borderStyle","borderColor","borderOpacity","backgroundColor","backgroundOpacity","backgroundImage","gradientColorStops","boxDecorationBreak","backgroundSize","backgroundAttachment","backgroundClip","backgroundPosition","backgroundRepeat","backgroundOrigin","fill","stroke","strokeWidth","objectFit","objectPosition","padding","textAlign","textIndent","verticalAlign","fontFamily","fontSize","fontWeight","textTransform","fontStyle","fontVariantNumeric","lineHeight","letterSpacing","textColor","textOpacity","textDecoration","textDecorationColor","textDecorationStyle","textDecorationThickness","textUnderlineOffset","fontSmoothing","placeholderColor","placeholderOpacity","caretColor","accentColor","opacity","backgroundBlendMode","mixBlendMode","boxShadow","boxShadowColor","outlineStyle","outlineWidth","outlineOffset","outlineColor","ringWidth","ringColor","ringOpacity","ringOffsetWidth","ringOffsetColor","blur","brightness","contrast","dropShadow","grayscale","hueRotate","invert","saturate","sepia","filter","backdropBlur","backdropBrightness","backdropContrast","backdropGrayscale","backdropHueRotate","backdropInvert","backdropOpacity","backdropSaturate","backdropSepia","backdropFilter","transitionProperty","transitionDelay","transitionDuration","transitionTimingFunction","willChange","contain","content","forcedColorAdjust"]
|