config redirect

This commit is contained in:
Nuno Coração
2023-01-29 22:30:24 +00:00
parent 17557c7d73
commit 5fb4bd8083
9905 changed files with 1258996 additions and 36355 deletions

10
node_modules/tailwindcss/scripts/create-plugin-list.js generated vendored Normal file
View File

@@ -0,0 +1,10 @@
import { corePlugins } from '../src/corePlugins'
import fs from 'fs'
import path from 'path'
let corePluginList = Object.keys(corePlugins)
fs.writeFileSync(
path.join(process.cwd(), 'src', 'corePluginList.js'),
`export default ${JSON.stringify(corePluginList)}`
)

105
node_modules/tailwindcss/scripts/generate-types.js generated vendored Normal file
View File

@@ -0,0 +1,105 @@
import prettier from 'prettier'
import { corePlugins } from '../src/corePlugins'
import colors from '../src/public/colors'
import defaultTheme from '../src/public/default-theme'
import fs from 'fs'
import path from 'path'
import * as types from './type-utils'
fs.writeFileSync(
path.join(process.cwd(), 'types', 'generated', 'corePluginList.d.ts'),
`export type CorePluginList = ${Object.keys(corePlugins)
.map((p) => `'${p}'`)
.join(' | ')}`
)
let colorsWithoutDeprecatedColors = Object.fromEntries(
Object.entries(Object.getOwnPropertyDescriptors(colors))
.filter(([_, { value }]) => {
return typeof value !== 'undefined'
})
.map(([name, definition]) => [name, definition.value])
)
let deprecatedColors = Object.entries(Object.getOwnPropertyDescriptors(colors))
.filter(([_, { value }]) => {
return typeof value === 'undefined'
})
.map(([name, definition]) => {
let warn = console.warn
let messages = []
console.warn = (...args) => messages.push(args.pop())
definition.get()
console.warn = warn
let message = messages.join(' ').trim()
let newColor = message.match(/renamed to `(.*)`/)[1]
return `/** @deprecated ${message} */${name}: DefaultColors['${newColor}'],`
})
.join('\n')
fs.writeFileSync(
path.join(process.cwd(), 'types', 'generated', 'colors.d.ts'),
prettier.format(
`export interface DefaultColors { ${JSON.stringify(colorsWithoutDeprecatedColors).slice(
1,
-1
)}\n${deprecatedColors}\n}`,
{
semi: false,
singleQuote: true,
printWidth: 100,
parser: 'typescript',
}
)
)
const defaultThemeTypes = Object.entries(defaultTheme)
.map(([name, value]) => {
// Special cases for slightly more accurate types
if (name === 'keyframes') {
return [name, `Record<${types.forKeys(value)}, Record<string, CSSDeclarationList>>`]
}
if (name === 'fontSize') {
return [name, `Record<${types.forKeys(value)}, [string, { lineHeight: string }]>`]
}
// General cases
if (typeof value === 'string') {
return [name, `string`]
}
if (typeof value === 'function') {
return [name, null]
}
if (typeof value === 'object') {
if (Object.keys(value).length === 0) {
return [name, null]
}
return [name, types.forValue(value)]
}
return [name, `unknown`]
})
.filter(([, type]) => type !== null)
.map(([name, type]) => `${name}: ${type}`)
.join('\n')
fs.writeFileSync(
path.join(process.cwd(), 'types', 'generated', 'default-theme.d.ts'),
prettier.format(
`
import { Config } from '../../types'
type CSSDeclarationList = Record<string, string>
export type DefaultTheme = Config['theme'] & { ${defaultThemeTypes} }
`,
{
semi: false,
singleQuote: true,
printWidth: 100,
parser: 'typescript',
}
)
)

View File

@@ -0,0 +1,27 @@
let fs = require('fs/promises')
let { spawn } = require('child_process')
let path = require('path')
let root = process.cwd()
function npmInstall(cwd) {
return new Promise((resolve) => {
let childProcess = spawn('npm', ['install'], { cwd })
childProcess.on('exit', resolve)
})
}
async function install() {
let base = path.resolve(root, 'integrations')
let ignoreFolders = ['node_modules']
let integrations = (await fs.readdir(base, { withFileTypes: true }))
.filter((integration) => integration.isDirectory())
.filter((integration) => !ignoreFolders.includes(integration.name))
.map((folder) => path.resolve(base, folder.name))
.concat([base])
.map((integration) => npmInstall(integration))
await Promise.all(integrations)
console.log('Done!')
}
install()

68
node_modules/tailwindcss/scripts/rebuildFixtures.js generated vendored Normal file
View File

@@ -0,0 +1,68 @@
import fs from 'fs'
import postcss from 'postcss'
import tailwind from '..'
function build({ from, to, config }) {
return new Promise((resolve, reject) => {
console.log(`Processing ./${from}...`)
fs.readFile(`./${from}`, (err, css) => {
if (err) throw err
return postcss([tailwind(config)])
.process(css, {
from: undefined,
})
.then((result) => {
fs.writeFileSync(`./${to}`, result.css)
return result
})
.then(resolve)
.catch((error) => {
console.log(error)
reject()
})
})
})
}
console.info('\nRebuilding fixtures...\n')
Promise.all([
build({
from: 'tests/fixtures/tailwind-input.css',
to: 'tests/fixtures/tailwind-output.css',
config: {},
}),
build({
from: 'tests/fixtures/tailwind-input.css',
to: 'tests/fixtures/tailwind-output-important.css',
config: { important: true },
}),
build({
from: 'tests/fixtures/tailwind-input.css',
to: 'tests/fixtures/tailwind-output-no-color-opacity.css',
config: {
corePlugins: {
textOpacity: false,
backgroundOpacity: false,
borderOpacity: false,
placeholderOpacity: false,
divideOpacity: false,
},
},
}),
build({
from: 'tests/fixtures/tailwind-input.css',
to: 'tests/fixtures/tailwind-output-flagged.css',
config: {
future: 'all',
experimental: 'all',
},
}),
]).then(() => {
console.log('\nFinished rebuilding fixtures.')
console.log(
'\nPlease triple check that the fixture output matches what you expect before committing this change.'
)
})

18
node_modules/tailwindcss/scripts/release-channel.js generated vendored Normal file
View File

@@ -0,0 +1,18 @@
// Given a version, figure out what the release channel is so that we can publish to the correct
// channel on npm.
//
// E.g.:
//
// 1.2.3 -> latest (default)
// 0.0.0-insiders.ffaa88 -> insiders
// 4.1.0-alpha.4 -> alpha
let version =
process.argv[2] || process.env.npm_package_version || require('../package.json').version
let match = /\d+\.\d+\.\d+-(.*)\.\d+/g.exec(version)
if (match) {
console.log(match[1])
} else {
console.log('latest')
}

21
node_modules/tailwindcss/scripts/release-notes.js generated vendored Normal file
View File

@@ -0,0 +1,21 @@
// Given a version, figure out what the release notes are so that we can use this to pre-fill the
// relase notes on a GitHub release for the current version.
let path = require('path')
let fs = require('fs')
let version =
process.argv[2] || process.env.npm_package_version || require('../package.json').version
let changelog = fs.readFileSync(path.resolve(__dirname, '..', 'CHANGELOG.md'), 'utf8')
let match = new RegExp(
`## \\[${version}\\] - (.*)\\n\\n([\\s\\S]*?)\\n(?:(?:##\\s)|(?:\\[))`,
'g'
).exec(changelog)
if (match) {
let [, , notes] = match
console.log(notes.trim())
} else {
console.log(`Placeholder release notes for version: v${version}`)
}

27
node_modules/tailwindcss/scripts/type-utils.js generated vendored Normal file
View File

@@ -0,0 +1,27 @@
export function union(types) {
return [...new Set(types)].join(' | ')
}
export function unionValues(values) {
return union(values.map(forValue))
}
export function forKeys(value) {
return union(Object.keys(value).map((key) => `'${key}'`))
}
export function forValue(value) {
if (Array.isArray(value)) {
return `(${unionValues(value)})[]`
}
if (typeof value === 'object') {
return `Record<${forKeys(value)}, ${unionValues(Object.values(value))}>`
}
if (typeof value === 'string') {
return `string`
}
return `any`
}