mirror of
https://github.com/tailwindlabs/tailwindcss.git
synced 2025-12-08 21:36:08 +00:00
Generate plugin list file (#4725)
* Generate plugin list file Removes the importing of all plugins in src/util/resolveConfig to avoid importing CSS. Import the built plugin list file instead. * Use `process.cwd()` instead of `__dirname` to resolve path Co-authored-by: Federico Ciardi <fed.ciardi@gmail.com> * Import core plugin list in resolveConfig test * Generate plugin list prebabelify and on install * Move generation from install to postinstall Co-authored-by: Federico Ciardi <fed.ciardi@gmail.com> Co-authored-by: Federico Ciardi <fed.ciardi@gmail.com>
This commit is contained in:
parent
973d53d6dc
commit
c0ee52060c
@ -4,3 +4,4 @@
|
||||
/peers
|
||||
/tests/fixtures/cli-utils.js
|
||||
/stubs/*
|
||||
/src/corePluginList.js
|
||||
|
||||
3
.gitignore
vendored
3
.gitignore
vendored
@ -15,3 +15,6 @@ yarn-error.log
|
||||
|
||||
# Perf related files
|
||||
isolate*.log
|
||||
|
||||
# Generated files
|
||||
/src/corePluginList.js
|
||||
35
package-lock.json
generated
35
package-lock.json
generated
@ -5,8 +5,8 @@
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "tailwindcss",
|
||||
"version": "2.2.2",
|
||||
"hasInstallScript": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@fullhuman/postcss-purgecss": "^4.0.3",
|
||||
@ -11953,7 +11953,8 @@
|
||||
"version": "0.2.1",
|
||||
"resolved": "https://registry.npmjs.org/@tailwindcss/aspect-ratio/-/aspect-ratio-0.2.1.tgz",
|
||||
"integrity": "sha512-aDFi80aHQ3JM3symJ5iKU70lm151ugIGFCI0yRZGpyjgQSDS+Fbe93QwypC1tCEllQE8p0S7TUu20ih1b9IKLA==",
|
||||
"dev": true
|
||||
"dev": true,
|
||||
"requires": {}
|
||||
},
|
||||
"@tootallnate/once": {
|
||||
"version": "1.1.2",
|
||||
@ -12110,7 +12111,8 @@
|
||||
"version": "5.3.1",
|
||||
"resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.1.tgz",
|
||||
"integrity": "sha512-K0Ptm/47OKfQRpNQ2J/oIN/3QYiK6FwW+eJbILhsdxh2WTLdl+30o8aGdTbm5JbffpFFAg/g+zi1E+jvJha5ng==",
|
||||
"dev": true
|
||||
"dev": true,
|
||||
"requires": {}
|
||||
},
|
||||
"acorn-node": {
|
||||
"version": "1.8.2",
|
||||
@ -13111,7 +13113,8 @@
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/cssnano-utils/-/cssnano-utils-2.0.1.tgz",
|
||||
"integrity": "sha512-i8vLRZTnEH9ubIyfdZCAdIdgnHAUeQeByEeQ2I7oTilvP9oHO6RScpeq3GsFUVqeB8uZgOQ9pw8utofNn32hhQ==",
|
||||
"dev": true
|
||||
"dev": true,
|
||||
"requires": {}
|
||||
},
|
||||
"csso": {
|
||||
"version": "4.2.0",
|
||||
@ -13593,7 +13596,8 @@
|
||||
"version": "8.3.0",
|
||||
"resolved": "https://registry.npmjs.org/eslint-config-prettier/-/eslint-config-prettier-8.3.0.tgz",
|
||||
"integrity": "sha512-BgZuLUSeKzvlL/VUjx/Yb787VQ26RU3gGjA3iiFvdsp/2bMfVIWUVP7tjxtjS0e+HP409cPlPvNkQloz8C91ew==",
|
||||
"dev": true
|
||||
"dev": true,
|
||||
"requires": {}
|
||||
},
|
||||
"eslint-plugin-prettier": {
|
||||
"version": "3.4.0",
|
||||
@ -15229,7 +15233,8 @@
|
||||
"version": "1.2.2",
|
||||
"resolved": "https://registry.npmjs.org/jest-pnp-resolver/-/jest-pnp-resolver-1.2.2.tgz",
|
||||
"integrity": "sha512-olV41bKSMm8BdnuMsewT4jqlZ8+3TCARAXjZGT9jcoSnrfUnRCqnMoF9XEeoWjbzObpqF9dRhHQj0Xb9QdF6/w==",
|
||||
"dev": true
|
||||
"dev": true,
|
||||
"requires": {}
|
||||
},
|
||||
"jest-regex-util": {
|
||||
"version": "27.0.1",
|
||||
@ -16453,25 +16458,29 @@
|
||||
"version": "5.0.1",
|
||||
"resolved": "https://registry.npmjs.org/postcss-discard-comments/-/postcss-discard-comments-5.0.1.tgz",
|
||||
"integrity": "sha512-lgZBPTDvWrbAYY1v5GYEv8fEO/WhKOu/hmZqmCYfrpD6eyDWWzAOsl2rF29lpvziKO02Gc5GJQtlpkTmakwOWg==",
|
||||
"dev": true
|
||||
"dev": true,
|
||||
"requires": {}
|
||||
},
|
||||
"postcss-discard-duplicates": {
|
||||
"version": "5.0.1",
|
||||
"resolved": "https://registry.npmjs.org/postcss-discard-duplicates/-/postcss-discard-duplicates-5.0.1.tgz",
|
||||
"integrity": "sha512-svx747PWHKOGpAXXQkCc4k/DsWo+6bc5LsVrAsw+OU+Ibi7klFZCyX54gjYzX4TH+f2uzXjRviLARxkMurA2bA==",
|
||||
"dev": true
|
||||
"dev": true,
|
||||
"requires": {}
|
||||
},
|
||||
"postcss-discard-empty": {
|
||||
"version": "5.0.1",
|
||||
"resolved": "https://registry.npmjs.org/postcss-discard-empty/-/postcss-discard-empty-5.0.1.tgz",
|
||||
"integrity": "sha512-vfU8CxAQ6YpMxV2SvMcMIyF2LX1ZzWpy0lqHDsOdaKKLQVQGVP1pzhrI9JlsO65s66uQTfkQBKBD/A5gp9STFw==",
|
||||
"dev": true
|
||||
"dev": true,
|
||||
"requires": {}
|
||||
},
|
||||
"postcss-discard-overridden": {
|
||||
"version": "5.0.1",
|
||||
"resolved": "https://registry.npmjs.org/postcss-discard-overridden/-/postcss-discard-overridden-5.0.1.tgz",
|
||||
"integrity": "sha512-Y28H7y93L2BpJhrdUR2SR2fnSsT+3TVx1NmVQLbcnZWwIUpJ7mfcTC6Za9M2PG6w8j7UQRfzxqn8jU2VwFxo3Q==",
|
||||
"dev": true
|
||||
"dev": true,
|
||||
"requires": {}
|
||||
},
|
||||
"postcss-js": {
|
||||
"version": "3.0.3",
|
||||
@ -16571,7 +16580,8 @@
|
||||
"version": "5.0.1",
|
||||
"resolved": "https://registry.npmjs.org/postcss-normalize-charset/-/postcss-normalize-charset-5.0.1.tgz",
|
||||
"integrity": "sha512-6J40l6LNYnBdPSk+BHZ8SF+HAkS4q2twe5jnocgd+xWpz/mx/5Sa32m3W1AA8uE8XaXN+eg8trIlfu8V9x61eg==",
|
||||
"dev": true
|
||||
"dev": true,
|
||||
"requires": {}
|
||||
},
|
||||
"postcss-normalize-display-values": {
|
||||
"version": "5.0.1",
|
||||
@ -18159,7 +18169,8 @@
|
||||
"version": "7.4.6",
|
||||
"resolved": "https://registry.npmjs.org/ws/-/ws-7.4.6.tgz",
|
||||
"integrity": "sha512-YmhHDO4MzaDLB+M9ym/mDA5z0naX8j7SIlT8f8z+I0VtzsRbekxEutHSme7NPS2qE8StCYQNUnfWdXta/Yu85A==",
|
||||
"dev": true
|
||||
"dev": true,
|
||||
"requires": {}
|
||||
},
|
||||
"xml-name-validator": {
|
||||
"version": "3.0.0",
|
||||
|
||||
@ -18,7 +18,7 @@
|
||||
"David Hemphill <davidlee.hemphill@gmail.com>"
|
||||
],
|
||||
"scripts": {
|
||||
"prebabelify": "rimraf lib",
|
||||
"prebabelify": "npm run generate:plugin-list && rimraf lib",
|
||||
"babelify": "babel src --out-dir lib --copy-files",
|
||||
"postbabelify": "ncc build lib/cli-peer-dependencies.js -o peers",
|
||||
"rebuild-fixtures": "npm run babelify && babel-node scripts/rebuildFixtures.js",
|
||||
@ -26,10 +26,12 @@
|
||||
"style": "eslint .",
|
||||
"test": "cross-env TAILWIND_MODE=build jest",
|
||||
"test:integrations": "npm run test --prefix ./integrations",
|
||||
"postinstall": "npm run generate:plugin-list",
|
||||
"install:integrations": "node scripts/install-integrations.js",
|
||||
"posttest": "npm run style",
|
||||
"compat": "node scripts/compat.js --prepare",
|
||||
"compat:restore": "node scripts/compat.js --restore"
|
||||
"compat:restore": "node scripts/compat.js --restore",
|
||||
"generate:plugin-list": "babel-node scripts/create-plugin-list.js"
|
||||
},
|
||||
"files": [
|
||||
"dist/*.css",
|
||||
|
||||
10
scripts/create-plugin-list.js
Normal file
10
scripts/create-plugin-list.js
Normal file
@ -0,0 +1,10 @@
|
||||
import * as corePlugins from '../src/plugins'
|
||||
import fs from 'fs'
|
||||
import path from 'path'
|
||||
|
||||
const corePluginList = Object.keys(corePlugins)
|
||||
|
||||
fs.writeFileSync(
|
||||
path.join(process.cwd(), 'src', 'corePluginList.js'),
|
||||
`export default ${JSON.stringify(corePluginList)}`
|
||||
)
|
||||
@ -10,7 +10,7 @@ import toPath from 'lodash/toPath'
|
||||
import head from 'lodash/head'
|
||||
import isPlainObject from 'lodash/isPlainObject'
|
||||
import negateValue from './negateValue'
|
||||
import * as corePlugins from '../plugins'
|
||||
import corePluginList from '../corePluginList'
|
||||
import configurePlugins from './configurePlugins'
|
||||
import defaultConfig from '../../stubs/defaultConfig.stub'
|
||||
import colors from '../../colors'
|
||||
@ -243,7 +243,7 @@ function resolveCorePlugins(corePluginConfigs) {
|
||||
return corePluginConfig({ corePlugins: resolved })
|
||||
}
|
||||
return configurePlugins(corePluginConfig, resolved)
|
||||
}, Object.keys(corePlugins))
|
||||
}, corePluginList)
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
@ -1,7 +1,5 @@
|
||||
import * as corePlugins from '../src/plugins'
|
||||
import resolveConfig from '../src/util/resolveConfig'
|
||||
|
||||
const corePluginList = Object.keys(corePlugins)
|
||||
import corePluginList from '../src/corePluginList'
|
||||
|
||||
test('prefix key overrides default prefix', () => {
|
||||
const userConfig = {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user