tailwindcss 0.0.0-insiders.ca1dfd6 → 0.0.0-insiders.ca7b10e

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.
Files changed (179) hide show
  1. package/LICENSE +1 -2
  2. package/README.md +18 -11
  3. package/dist/chunk-7MHEDNEU.mjs +1 -0
  4. package/dist/chunk-AZANAYY2.mjs +1 -0
  5. package/dist/chunk-YTVGJJD3.mjs +12 -0
  6. package/dist/colors-b_6i0Oi7.d.ts +295 -0
  7. package/dist/colors.d.mts +295 -0
  8. package/dist/colors.d.ts +5 -0
  9. package/dist/colors.js +1 -0
  10. package/dist/colors.mjs +1 -0
  11. package/dist/default-theme.d.mts +1147 -0
  12. package/dist/default-theme.d.ts +1147 -0
  13. package/dist/default-theme.js +1 -0
  14. package/dist/default-theme.mjs +1 -0
  15. package/dist/flatten-color-palette.d.mts +6 -0
  16. package/dist/flatten-color-palette.d.ts +6 -0
  17. package/dist/flatten-color-palette.js +1 -0
  18. package/dist/flatten-color-palette.mjs +1 -0
  19. package/dist/lib.d.mts +264 -0
  20. package/dist/lib.d.ts +3 -0
  21. package/dist/lib.js +33 -0
  22. package/dist/lib.mjs +22 -0
  23. package/dist/plugin.d.mts +11 -0
  24. package/dist/plugin.d.ts +104 -0
  25. package/dist/plugin.js +1 -0
  26. package/dist/plugin.mjs +1 -0
  27. package/dist/resolve-config-BIFUA2FY.d.ts +29 -0
  28. package/dist/resolve-config-QUZ9b-Gn.d.mts +190 -0
  29. package/dist/types-B254mqw1.d.mts +98 -0
  30. package/index.css +866 -0
  31. package/package.json +73 -100
  32. package/preflight.css +375 -0
  33. package/theme.css +453 -0
  34. package/CHANGELOG.md +0 -1758
  35. package/base.css +0 -1
  36. package/colors.js +0 -1
  37. package/components.css +0 -1
  38. package/defaultConfig.js +0 -1
  39. package/defaultTheme.js +0 -1
  40. package/lib/cli-peer-dependencies.js +0 -15
  41. package/lib/cli.js +0 -707
  42. package/lib/constants.js +0 -37
  43. package/lib/corePluginList.js +0 -169
  44. package/lib/corePlugins.js +0 -3525
  45. package/lib/css/LICENSE +0 -25
  46. package/lib/css/preflight.css +0 -354
  47. package/lib/featureFlags.js +0 -57
  48. package/lib/index.js +0 -32
  49. package/lib/lib/collapseAdjacentRules.js +0 -41
  50. package/lib/lib/detectNesting.js +0 -19
  51. package/lib/lib/evaluateTailwindFunctions.js +0 -167
  52. package/lib/lib/expandApplyAtRules.js +0 -228
  53. package/lib/lib/expandTailwindAtRules.js +0 -257
  54. package/lib/lib/generateRules.js +0 -350
  55. package/lib/lib/getModuleDependencies.js +0 -48
  56. package/lib/lib/normalizeTailwindDirectives.js +0 -75
  57. package/lib/lib/resolveDefaultsAtRules.js +0 -128
  58. package/lib/lib/setupContextUtils.js +0 -791
  59. package/lib/lib/setupTrackingContext.js +0 -170
  60. package/lib/lib/setupWatchingContext.js +0 -284
  61. package/lib/lib/sharedState.js +0 -29
  62. package/lib/lib/substituteScreenAtRules.js +0 -24
  63. package/lib/processTailwindFeatures.js +0 -47
  64. package/lib/public/colors.js +0 -333
  65. package/lib/public/create-plugin.js +0 -13
  66. package/lib/public/default-config.js +0 -14
  67. package/lib/public/default-theme.js +0 -14
  68. package/lib/public/resolve-config.js +0 -19
  69. package/lib/util/bigSign.js +0 -8
  70. package/lib/util/buildMediaQuery.js +0 -31
  71. package/lib/util/cloneDeep.js +0 -19
  72. package/lib/util/cloneNodes.js +0 -14
  73. package/lib/util/color.js +0 -84
  74. package/lib/util/configurePlugins.js +0 -18
  75. package/lib/util/createPlugin.js +0 -30
  76. package/lib/util/createUtilityPlugin.js +0 -53
  77. package/lib/util/dataTypes.js +0 -202
  78. package/lib/util/defaults.js +0 -16
  79. package/lib/util/escapeClassName.js +0 -19
  80. package/lib/util/escapeCommas.js +0 -8
  81. package/lib/util/flattenColorPalette.js +0 -19
  82. package/lib/util/getAllConfigs.js +0 -29
  83. package/lib/util/hashConfig.js +0 -16
  84. package/lib/util/isKeyframeRule.js +0 -8
  85. package/lib/util/isPlainObject.js +0 -12
  86. package/lib/util/log.js +0 -35
  87. package/lib/util/nameClass.js +0 -31
  88. package/lib/util/negateValue.js +0 -17
  89. package/lib/util/parseAnimationValue.js +0 -89
  90. package/lib/util/parseDependency.js +0 -63
  91. package/lib/util/parseObjectStyles.js +0 -31
  92. package/lib/util/pluginUtils.js +0 -282
  93. package/lib/util/prefixSelector.js +0 -23
  94. package/lib/util/resolveConfig.js +0 -293
  95. package/lib/util/resolveConfigPath.js +0 -52
  96. package/lib/util/responsive.js +0 -19
  97. package/lib/util/tap.js +0 -9
  98. package/lib/util/toColorValue.js +0 -9
  99. package/lib/util/toPath.js +0 -9
  100. package/lib/util/transformThemeValue.js +0 -53
  101. package/lib/util/withAlphaVariable.js +0 -67
  102. package/nesting/README.md +0 -42
  103. package/nesting/index.js +0 -12
  104. package/nesting/plugin.js +0 -41
  105. package/peers/index.js +0 -77111
  106. package/plugin.js +0 -1
  107. package/prettier.config.js +0 -19
  108. package/resolveConfig.js +0 -1
  109. package/screens.css +0 -1
  110. package/scripts/create-plugin-list.js +0 -10
  111. package/scripts/install-integrations.js +0 -27
  112. package/scripts/rebuildFixtures.js +0 -68
  113. package/src/cli-peer-dependencies.js +0 -9
  114. package/src/cli.js +0 -762
  115. package/src/constants.js +0 -17
  116. package/src/corePluginList.js +0 -1
  117. package/src/corePlugins.js +0 -2382
  118. package/src/css/LICENSE +0 -25
  119. package/src/css/preflight.css +0 -354
  120. package/src/featureFlags.js +0 -48
  121. package/src/index.js +0 -34
  122. package/src/lib/collapseAdjacentRules.js +0 -39
  123. package/src/lib/detectNesting.js +0 -20
  124. package/src/lib/evaluateTailwindFunctions.js +0 -195
  125. package/src/lib/expandApplyAtRules.js +0 -251
  126. package/src/lib/expandTailwindAtRules.js +0 -266
  127. package/src/lib/generateRules.js +0 -320
  128. package/src/lib/getModuleDependencies.js +0 -39
  129. package/src/lib/normalizeTailwindDirectives.js +0 -77
  130. package/src/lib/resolveDefaultsAtRules.js +0 -125
  131. package/src/lib/setupContextUtils.js +0 -775
  132. package/src/lib/setupTrackingContext.js +0 -184
  133. package/src/lib/setupWatchingContext.js +0 -306
  134. package/src/lib/sharedState.js +0 -13
  135. package/src/lib/substituteScreenAtRules.js +0 -16
  136. package/src/processTailwindFeatures.js +0 -43
  137. package/src/public/colors.js +0 -305
  138. package/src/public/create-plugin.js +0 -2
  139. package/src/public/default-config.js +0 -4
  140. package/src/public/default-theme.js +0 -4
  141. package/src/public/resolve-config.js +0 -7
  142. package/src/util/bigSign.js +0 -3
  143. package/src/util/buildMediaQuery.js +0 -24
  144. package/src/util/cloneDeep.js +0 -11
  145. package/src/util/cloneNodes.js +0 -11
  146. package/src/util/color.js +0 -56
  147. package/src/util/configurePlugins.js +0 -23
  148. package/src/util/createPlugin.js +0 -27
  149. package/src/util/createUtilityPlugin.js +0 -37
  150. package/src/util/dataTypes.js +0 -216
  151. package/src/util/defaults.js +0 -11
  152. package/src/util/escapeClassName.js +0 -8
  153. package/src/util/escapeCommas.js +0 -3
  154. package/src/util/flattenColorPalette.js +0 -13
  155. package/src/util/getAllConfigs.js +0 -19
  156. package/src/util/hashConfig.js +0 -5
  157. package/src/util/isKeyframeRule.js +0 -3
  158. package/src/util/isPlainObject.js +0 -8
  159. package/src/util/log.js +0 -28
  160. package/src/util/nameClass.js +0 -26
  161. package/src/util/negateValue.js +0 -14
  162. package/src/util/parseAnimationValue.js +0 -68
  163. package/src/util/parseDependency.js +0 -49
  164. package/src/util/parseObjectStyles.js +0 -19
  165. package/src/util/pluginUtils.js +0 -288
  166. package/src/util/prefixSelector.js +0 -15
  167. package/src/util/resolveConfig.js +0 -282
  168. package/src/util/resolveConfigPath.js +0 -55
  169. package/src/util/responsive.js +0 -10
  170. package/src/util/tap.js +0 -4
  171. package/src/util/toColorValue.js +0 -3
  172. package/src/util/toPath.js +0 -4
  173. package/src/util/transformThemeValue.js +0 -37
  174. package/src/util/withAlphaVariable.js +0 -49
  175. package/stubs/defaultConfig.stub.js +0 -890
  176. package/stubs/defaultPostCssConfig.stub.js +0 -6
  177. package/stubs/simpleConfig.stub.js +0 -8
  178. package/tailwind.css +0 -5
  179. package/variants.css +0 -1
@@ -1,216 +0,0 @@
1
- import { parseColor } from './color'
2
-
3
- // Ref: https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Types
4
-
5
- let COMMA = /,(?![^(]*\))/g // Comma separator that is not located between brackets. E.g.: `cubiz-bezier(a, b, c)` these don't count.
6
- let UNDERSCORE = /_(?![^(]*\))/g // Underscore separator that is not located between brackets. E.g.: `rgba(255,_255,_255)_black` these don't count.
7
-
8
- // This is not a data type, but rather a function that can normalize the
9
- // correct values.
10
- export function normalize(value) {
11
- // Convert `_` to ` `, except for escaped underscores `\_`
12
- value = value
13
- .replace(
14
- /([^\\])_+/g,
15
- (fullMatch, characterBefore) => characterBefore + ' '.repeat(fullMatch.length - 1)
16
- )
17
- .replace(/^_/g, ' ')
18
- .replace(/\\_/g, '_')
19
-
20
- // Remove leftover whitespace
21
- value = value.trim()
22
-
23
- // Keep raw strings if it starts with `url(`
24
- if (value.startsWith('url(')) return value
25
-
26
- // Add spaces around operators inside calc() that do not follow an operator
27
- // or '('.
28
- return value.replace(
29
- /(-?\d*\.?\d(?!\b-.+[,)](?![^+\-/*])\D)(?:%|[a-z]+)?|\))([+\-/*])/g,
30
- '$1 $2 '
31
- )
32
- }
33
-
34
- export function url(value) {
35
- return value.startsWith('url(')
36
- }
37
-
38
- export function number(value) {
39
- return !isNaN(Number(value))
40
- }
41
-
42
- export function percentage(value) {
43
- return /%$/g.test(value) || /^calc\(.+?%\)/g.test(value)
44
- }
45
-
46
- let lengthUnits = [
47
- 'cm',
48
- 'mm',
49
- 'Q',
50
- 'in',
51
- 'pc',
52
- 'pt',
53
- 'px',
54
- 'em',
55
- 'ex',
56
- 'ch',
57
- 'rem',
58
- 'lh',
59
- 'vw',
60
- 'vh',
61
- 'vmin',
62
- 'vmax',
63
- ]
64
- let lengthUnitsPattern = `(?:${lengthUnits.join('|')})`
65
- export function length(value) {
66
- return (
67
- new RegExp(`${lengthUnitsPattern}$`).test(value) ||
68
- new RegExp(`^calc\\(.+?${lengthUnitsPattern}`).test(value)
69
- )
70
- }
71
-
72
- let lineWidths = new Set(['thin', 'medium', 'thick'])
73
- export function lineWidth(value) {
74
- return lineWidths.has(value)
75
- }
76
-
77
- export function color(value) {
78
- let colors = 0
79
-
80
- let result = value.split(UNDERSCORE).every((part) => {
81
- part = normalize(part)
82
-
83
- if (part.startsWith('var(')) return true
84
- if (parseColor(part) !== null) return colors++, true
85
-
86
- return false
87
- })
88
-
89
- if (!result) return false
90
- return colors > 0
91
- }
92
-
93
- export function image(value) {
94
- let images = 0
95
- let result = value.split(COMMA).every((part) => {
96
- part = normalize(part)
97
-
98
- if (part.startsWith('var(')) return true
99
- if (
100
- url(part) ||
101
- gradient(part) ||
102
- ['element(', 'image(', 'cross-fade(', 'image-set('].some((fn) => part.startsWith(fn))
103
- ) {
104
- images++
105
- return true
106
- }
107
-
108
- return false
109
- })
110
-
111
- if (!result) return false
112
- return images > 0
113
- }
114
-
115
- let gradientTypes = new Set([
116
- 'linear-gradient',
117
- 'radial-gradient',
118
- 'repeating-linear-gradient',
119
- 'repeating-radial-gradient',
120
- 'conic-gradient',
121
- ])
122
- export function gradient(value) {
123
- value = normalize(value)
124
-
125
- for (let type of gradientTypes) {
126
- if (value.startsWith(`${type}(`)) {
127
- return true
128
- }
129
- }
130
- return false
131
- }
132
-
133
- let validPositions = new Set(['center', 'top', 'right', 'bottom', 'left'])
134
- export function position(value) {
135
- let positions = 0
136
- let result = value.split(UNDERSCORE).every((part) => {
137
- part = normalize(part)
138
-
139
- if (part.startsWith('var(')) return true
140
- if (validPositions.has(part) || length(part) || percentage(part)) {
141
- positions++
142
- return true
143
- }
144
-
145
- return false
146
- })
147
-
148
- if (!result) return false
149
- return positions > 0
150
- }
151
-
152
- export function familyName(value) {
153
- let fonts = 0
154
- let result = value.split(COMMA).every((part) => {
155
- part = normalize(part)
156
-
157
- if (part.startsWith('var(')) return true
158
-
159
- // If it contains spaces, then it should be quoted
160
- if (part.includes(' ')) {
161
- if (!/(['"])([^"']+)\1/g.test(part)) {
162
- return false
163
- }
164
- }
165
-
166
- // If it starts with a number, it's invalid
167
- if (/^\d/g.test(part)) {
168
- return false
169
- }
170
-
171
- fonts++
172
-
173
- return true
174
- })
175
-
176
- if (!result) return false
177
- return fonts > 0
178
- }
179
-
180
- let genericNames = new Set([
181
- 'serif',
182
- 'sans-serif',
183
- 'monospace',
184
- 'cursive',
185
- 'fantasy',
186
- 'system-ui',
187
- 'ui-serif',
188
- 'ui-sans-serif',
189
- 'ui-monospace',
190
- 'ui-rounded',
191
- 'math',
192
- 'emoji',
193
- 'fangsong',
194
- ])
195
- export function genericName(value) {
196
- return genericNames.has(value)
197
- }
198
-
199
- let absoluteSizes = new Set([
200
- 'xx-small',
201
- 'x-small',
202
- 'small',
203
- 'medium',
204
- 'large',
205
- 'x-large',
206
- 'x-large',
207
- 'xxx-large',
208
- ])
209
- export function absoluteSize(value) {
210
- return absoluteSizes.has(value)
211
- }
212
-
213
- let relativeSizes = new Set(['larger', 'smaller'])
214
- export function relativeSize(value) {
215
- return relativeSizes.has(value)
216
- }
@@ -1,11 +0,0 @@
1
- export function defaults(target, ...sources) {
2
- for (let source of sources) {
3
- for (let k in source) {
4
- if (!target?.hasOwnProperty?.(k)) {
5
- target[k] = source[k]
6
- }
7
- }
8
- }
9
-
10
- return target
11
- }
@@ -1,8 +0,0 @@
1
- import parser from 'postcss-selector-parser'
2
- import escapeCommas from './escapeCommas'
3
-
4
- export default function escapeClassName(className) {
5
- let node = parser.className()
6
- node.value = className
7
- return escapeCommas(node?.raws?.value ?? node.value)
8
- }
@@ -1,3 +0,0 @@
1
- export default function escapeCommas(className) {
2
- return className.replace(/\\,/g, '\\2c ')
3
- }
@@ -1,13 +0,0 @@
1
- const flattenColorPalette = (colors) =>
2
- Object.assign(
3
- {},
4
- ...Object.entries(colors ?? {}).flatMap(([color, values]) =>
5
- typeof values == 'object'
6
- ? Object.entries(flattenColorPalette(values)).map(([number, hex]) => ({
7
- [color + (number === 'DEFAULT' ? '' : `-${number}`)]: hex,
8
- }))
9
- : [{ [`${color}`]: values }]
10
- )
11
- )
12
-
13
- export default flattenColorPalette
@@ -1,19 +0,0 @@
1
- import defaultConfig from '../../stubs/defaultConfig.stub.js'
2
- import { flagEnabled } from '../featureFlags'
3
-
4
- export default function getAllConfigs(config) {
5
- const configs = (config?.presets ?? [defaultConfig])
6
- .slice()
7
- .reverse()
8
- .flatMap((preset) => getAllConfigs(preset instanceof Function ? preset() : preset))
9
-
10
- const features = {
11
- // Add experimental configs here...
12
- }
13
-
14
- const experimentals = Object.keys(features)
15
- .filter((feature) => flagEnabled(config, feature))
16
- .map((feature) => features[feature])
17
-
18
- return [config, ...experimentals, ...configs]
19
- }
@@ -1,5 +0,0 @@
1
- import hash from 'object-hash'
2
-
3
- export default function hashConfig(config) {
4
- return hash(config, { ignoreUnknown: true })
5
- }
@@ -1,3 +0,0 @@
1
- export default function isKeyframeRule(rule) {
2
- return rule.parent && rule.parent.type === 'atrule' && /keyframes$/.test(rule.parent.name)
3
- }
@@ -1,8 +0,0 @@
1
- export default function isPlainObject(value) {
2
- if (Object.prototype.toString.call(value) !== '[object Object]') {
3
- return false
4
- }
5
-
6
- const prototype = Object.getPrototypeOf(value)
7
- return prototype === null || prototype === Object.prototype
8
- }
package/src/util/log.js DELETED
@@ -1,28 +0,0 @@
1
- import chalk from 'chalk'
2
-
3
- export default {
4
- info(messages) {
5
- if (process.env.JEST_WORKER_ID !== undefined) return
6
-
7
- console.warn('')
8
- messages.forEach((message) => {
9
- console.warn(chalk.bold.cyan('info'), '-', message)
10
- })
11
- },
12
- warn(messages) {
13
- if (process.env.JEST_WORKER_ID !== undefined) return
14
-
15
- console.warn('')
16
- messages.forEach((message) => {
17
- console.warn(chalk.bold.yellow('warn'), '-', message)
18
- })
19
- },
20
- risk(messages) {
21
- if (process.env.JEST_WORKER_ID !== undefined) return
22
-
23
- console.warn('')
24
- messages.forEach((message) => {
25
- console.warn(chalk.bold.magenta('risk'), '-', message)
26
- })
27
- },
28
- }
@@ -1,26 +0,0 @@
1
- import escapeClassName from './escapeClassName'
2
- import escapeCommas from './escapeCommas'
3
-
4
- function asClass(name) {
5
- return escapeCommas(`.${escapeClassName(name)}`)
6
- }
7
-
8
- export default function nameClass(classPrefix, key) {
9
- return asClass(formatClass(classPrefix, key))
10
- }
11
-
12
- export function formatClass(classPrefix, key) {
13
- if (key === 'DEFAULT') {
14
- return classPrefix
15
- }
16
-
17
- if (key === '-') {
18
- return `-${classPrefix}`
19
- }
20
-
21
- if (key.startsWith('-')) {
22
- return `-${classPrefix}${key}`
23
- }
24
-
25
- return `${classPrefix}-${key}`
26
- }
@@ -1,14 +0,0 @@
1
- export default function (value) {
2
- value = `${value}`
3
-
4
- // Flip sign of numbers
5
- if (/^[+-]?(\d+|\d*\.\d+)(e[+-]?\d+)?(%|\w+)?$/.test(value)) {
6
- return value.replace(/^[+-]?/, (sign) => (sign === '-' ? '' : '-'))
7
- }
8
-
9
- if (value.includes('var(') || value.includes('calc(')) {
10
- return `calc(${value} * -1)`
11
- }
12
-
13
- return value
14
- }
@@ -1,68 +0,0 @@
1
- const DIRECTIONS = new Set(['normal', 'reverse', 'alternate', 'alternate-reverse'])
2
- const PLAY_STATES = new Set(['running', 'paused'])
3
- const FILL_MODES = new Set(['none', 'forwards', 'backwards', 'both'])
4
- const ITERATION_COUNTS = new Set(['infinite'])
5
- const TIMINGS = new Set([
6
- 'linear',
7
- 'ease',
8
- 'ease-in',
9
- 'ease-out',
10
- 'ease-in-out',
11
- 'step-start',
12
- 'step-end',
13
- ])
14
- const TIMING_FNS = ['cubic-bezier', 'steps']
15
-
16
- const COMMA = /\,(?![^(]*\))/g // Comma separator that is not located between brackets. E.g.: `cubiz-bezier(a, b, c)` these don't count.
17
- const SPACE = /\ +(?![^(]*\))/g // Similar to the one above, but with spaces instead.
18
- const TIME = /^(-?[\d.]+m?s)$/
19
- const DIGIT = /^(\d+)$/
20
-
21
- export default function parseAnimationValue(input) {
22
- let animations = input.split(COMMA)
23
- return animations.map((animation) => {
24
- let value = animation.trim()
25
- let result = { value }
26
- let parts = value.split(SPACE)
27
- let seen = new Set()
28
-
29
- for (let part of parts) {
30
- if (!seen.has('DIRECTIONS') && DIRECTIONS.has(part)) {
31
- result.direction = part
32
- seen.add('DIRECTIONS')
33
- } else if (!seen.has('PLAY_STATES') && PLAY_STATES.has(part)) {
34
- result.playState = part
35
- seen.add('PLAY_STATES')
36
- } else if (!seen.has('FILL_MODES') && FILL_MODES.has(part)) {
37
- result.fillMode = part
38
- seen.add('FILL_MODES')
39
- } else if (
40
- !seen.has('ITERATION_COUNTS') &&
41
- (ITERATION_COUNTS.has(part) || DIGIT.test(part))
42
- ) {
43
- result.iterationCount = part
44
- seen.add('ITERATION_COUNTS')
45
- } else if (!seen.has('TIMING_FUNCTION') && TIMINGS.has(part)) {
46
- result.timingFunction = part
47
- seen.add('TIMING_FUNCTION')
48
- } else if (!seen.has('TIMING_FUNCTION') && TIMING_FNS.some((f) => part.startsWith(`${f}(`))) {
49
- result.timingFunction = part
50
- seen.add('TIMING_FUNCTION')
51
- } else if (!seen.has('DURATION') && TIME.test(part)) {
52
- result.duration = part
53
- seen.add('DURATION')
54
- } else if (!seen.has('DELAY') && TIME.test(part)) {
55
- result.delay = part
56
- seen.add('DELAY')
57
- } else if (!seen.has('NAME')) {
58
- result.name = part
59
- seen.add('NAME')
60
- } else {
61
- if (!result.unknown) result.unknown = []
62
- result.unknown.push(part)
63
- }
64
- }
65
-
66
- return result
67
- })
68
- }
@@ -1,49 +0,0 @@
1
- import isGlob from 'is-glob'
2
- import globParent from 'glob-parent'
3
- import path from 'path'
4
-
5
- // Based on `glob-base`
6
- // https://github.com/micromatch/glob-base/blob/master/index.js
7
- function parseGlob(pattern) {
8
- let glob = pattern
9
- let base = globParent(pattern)
10
-
11
- if (base !== '.') {
12
- glob = pattern.substr(base.length)
13
- if (glob.charAt(0) === '/') {
14
- glob = glob.substr(1)
15
- }
16
- }
17
-
18
- if (glob.substr(0, 2) === './') {
19
- glob = glob.substr(2)
20
- }
21
- if (glob.charAt(0) === '/') {
22
- glob = glob.substr(1)
23
- }
24
-
25
- return { base, glob }
26
- }
27
-
28
- export default function parseDependency(normalizedFileOrGlob) {
29
- if (normalizedFileOrGlob.startsWith('!')) {
30
- return null
31
- }
32
-
33
- let message
34
-
35
- if (isGlob(normalizedFileOrGlob)) {
36
- let { base, glob } = parseGlob(normalizedFileOrGlob)
37
- message = { type: 'dir-dependency', dir: path.resolve(base), glob }
38
- } else {
39
- message = { type: 'dependency', file: path.resolve(normalizedFileOrGlob) }
40
- }
41
-
42
- // rollup-plugin-postcss does not support dir-dependency messages
43
- // but directories can be watched in the same way as files
44
- if (message.type === 'dir-dependency' && process.env.ROLLUP_WATCH === 'true') {
45
- message = { type: 'dependency', file: message.dir }
46
- }
47
-
48
- return message
49
- }
@@ -1,19 +0,0 @@
1
- import postcss from 'postcss'
2
- import postcssNested from 'postcss-nested'
3
- import postcssJs from 'postcss-js'
4
-
5
- export default function parseObjectStyles(styles) {
6
- if (!Array.isArray(styles)) {
7
- return parseObjectStyles([styles])
8
- }
9
-
10
- return styles.flatMap((style) => {
11
- return postcss([
12
- postcssNested({
13
- bubble: ['screen'],
14
- }),
15
- ]).process(style, {
16
- parser: postcssJs,
17
- }).root.nodes
18
- })
19
- }