tailwindcss 3.4.1 → 4.0.0-alpha.2
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 +5 -6
- package/dist/lib.d.mts +324 -0
- package/dist/lib.d.ts +324 -0
- package/dist/lib.js +11 -0
- package/dist/lib.mjs +11 -0
- package/index.css +5 -0
- package/package.json +29 -107
- package/preflight.css +355 -0
- package/theme.css +465 -0
- package/CHANGELOG.md +0 -2571
- package/base.css +0 -1
- package/colors.d.ts +0 -3
- package/colors.js +0 -2
- package/components.css +0 -1
- package/defaultConfig.d.ts +0 -3
- package/defaultConfig.js +0 -2
- package/defaultTheme.d.ts +0 -4
- package/defaultTheme.js +0 -2
- package/lib/cli/build/deps.js +0 -62
- package/lib/cli/build/index.js +0 -54
- package/lib/cli/build/plugin.js +0 -378
- package/lib/cli/build/utils.js +0 -88
- package/lib/cli/build/watching.js +0 -182
- package/lib/cli/help/index.js +0 -73
- package/lib/cli/index.js +0 -230
- package/lib/cli/init/index.js +0 -63
- package/lib/cli-peer-dependencies.js +0 -36
- package/lib/cli.js +0 -7
- package/lib/corePluginList.js +0 -190
- package/lib/corePlugins.js +0 -4282
- package/lib/css/LICENSE +0 -25
- package/lib/css/preflight.css +0 -385
- package/lib/featureFlags.js +0 -83
- package/lib/index.js +0 -2
- package/lib/lib/cacheInvalidation.js +0 -92
- package/lib/lib/collapseAdjacentRules.js +0 -61
- package/lib/lib/collapseDuplicateDeclarations.js +0 -85
- package/lib/lib/content.js +0 -181
- package/lib/lib/defaultExtractor.js +0 -251
- package/lib/lib/detectNesting.js +0 -45
- package/lib/lib/evaluateTailwindFunctions.js +0 -238
- package/lib/lib/expandApplyAtRules.js +0 -540
- package/lib/lib/expandTailwindAtRules.js +0 -291
- package/lib/lib/findAtConfigPath.js +0 -46
- package/lib/lib/generateRules.js +0 -904
- package/lib/lib/getModuleDependencies.js +0 -99
- package/lib/lib/load-config.js +0 -53
- package/lib/lib/normalizeTailwindDirectives.js +0 -89
- package/lib/lib/offsets.js +0 -306
- package/lib/lib/partitionApplyAtRules.js +0 -58
- package/lib/lib/regex.js +0 -74
- package/lib/lib/remap-bitfield.js +0 -89
- package/lib/lib/resolveDefaultsAtRules.js +0 -165
- package/lib/lib/setupContextUtils.js +0 -1294
- package/lib/lib/setupTrackingContext.js +0 -166
- package/lib/lib/sharedState.js +0 -87
- package/lib/lib/substituteScreenAtRules.js +0 -31
- package/lib/oxide/cli/build/deps.js +0 -89
- package/lib/oxide/cli/build/index.js +0 -53
- package/lib/oxide/cli/build/plugin.js +0 -375
- package/lib/oxide/cli/build/utils.js +0 -87
- package/lib/oxide/cli/build/watching.js +0 -179
- package/lib/oxide/cli/help/index.js +0 -72
- package/lib/oxide/cli/index.js +0 -214
- package/lib/oxide/cli/init/index.js +0 -52
- package/lib/oxide/cli.js +0 -5
- package/lib/oxide/postcss-plugin.js +0 -2
- package/lib/plugin.js +0 -98
- package/lib/postcss-plugins/nesting/README.md +0 -42
- package/lib/postcss-plugins/nesting/index.js +0 -21
- package/lib/postcss-plugins/nesting/plugin.js +0 -89
- package/lib/processTailwindFeatures.js +0 -64
- package/lib/public/colors.js +0 -355
- package/lib/public/create-plugin.js +0 -17
- package/lib/public/default-config.js +0 -18
- package/lib/public/default-theme.js +0 -18
- package/lib/public/load-config.js +0 -12
- package/lib/public/resolve-config.js +0 -24
- package/lib/util/applyImportantSelector.js +0 -36
- package/lib/util/bigSign.js +0 -13
- package/lib/util/buildMediaQuery.js +0 -27
- package/lib/util/cloneDeep.js +0 -22
- package/lib/util/cloneNodes.js +0 -54
- package/lib/util/color.js +0 -116
- package/lib/util/colorNames.js +0 -752
- package/lib/util/configurePlugins.js +0 -23
- package/lib/util/createPlugin.js +0 -32
- package/lib/util/createUtilityPlugin.js +0 -53
- package/lib/util/dataTypes.js +0 -415
- package/lib/util/defaults.js +0 -27
- package/lib/util/escapeClassName.js +0 -24
- package/lib/util/escapeCommas.js +0 -13
- package/lib/util/flattenColorPalette.js +0 -18
- package/lib/util/formatVariantSelector.js +0 -270
- package/lib/util/getAllConfigs.js +0 -50
- package/lib/util/hashConfig.js +0 -21
- package/lib/util/isKeyframeRule.js +0 -13
- package/lib/util/isPlainObject.js +0 -17
- package/lib/util/isSyntacticallyValidPropertyValue.js +0 -74
- package/lib/util/log.js +0 -61
- package/lib/util/nameClass.js +0 -49
- package/lib/util/negateValue.js +0 -36
- package/lib/util/normalizeConfig.js +0 -282
- package/lib/util/normalizeScreens.js +0 -178
- package/lib/util/parseAnimationValue.js +0 -93
- package/lib/util/parseBoxShadowValue.js +0 -88
- package/lib/util/parseDependency.js +0 -47
- package/lib/util/parseGlob.js +0 -36
- package/lib/util/parseObjectStyles.js +0 -36
- package/lib/util/pluginUtils.js +0 -289
- package/lib/util/prefixSelector.js +0 -39
- package/lib/util/pseudoElements.js +0 -212
- package/lib/util/removeAlphaVariables.js +0 -31
- package/lib/util/resolveConfig.js +0 -256
- package/lib/util/resolveConfigPath.js +0 -70
- package/lib/util/responsive.js +0 -24
- package/lib/util/splitAtTopLevelOnly.js +0 -51
- package/lib/util/tap.js +0 -14
- package/lib/util/toColorValue.js +0 -13
- package/lib/util/toPath.js +0 -32
- package/lib/util/transformThemeValue.js +0 -73
- package/lib/util/validateConfig.js +0 -37
- package/lib/util/validateFormalSyntax.js +0 -26
- package/lib/util/withAlphaVariable.js +0 -79
- package/lib/value-parser/LICENSE +0 -22
- package/lib/value-parser/README.md +0 -3
- package/lib/value-parser/index.d.js +0 -2
- package/lib/value-parser/index.js +0 -22
- package/lib/value-parser/parse.js +0 -259
- package/lib/value-parser/stringify.js +0 -38
- package/lib/value-parser/unit.js +0 -86
- package/lib/value-parser/walk.js +0 -16
- package/loadConfig.d.ts +0 -4
- package/loadConfig.js +0 -2
- package/nesting/index.d.ts +0 -4
- package/nesting/index.js +0 -2
- package/peers/index.js +0 -96624
- package/plugin.d.ts +0 -11
- package/plugin.js +0 -2
- package/prettier.config.js +0 -19
- package/resolveConfig.d.ts +0 -31
- package/resolveConfig.js +0 -2
- package/screens.css +0 -1
- package/scripts/create-plugin-list.js +0 -10
- package/scripts/generate-types.js +0 -104
- package/scripts/release-channel.js +0 -18
- package/scripts/release-notes.js +0 -21
- package/scripts/swap-engines.js +0 -40
- package/scripts/type-utils.js +0 -27
- package/src/cli/build/deps.js +0 -56
- package/src/cli/build/index.js +0 -49
- package/src/cli/build/plugin.js +0 -444
- package/src/cli/build/utils.js +0 -76
- package/src/cli/build/watching.js +0 -229
- package/src/cli/help/index.js +0 -70
- package/src/cli/index.js +0 -216
- package/src/cli/init/index.js +0 -79
- package/src/cli-peer-dependencies.js +0 -15
- package/src/cli.js +0 -7
- package/src/corePluginList.js +0 -1
- package/src/corePlugins.js +0 -2943
- package/src/css/LICENSE +0 -25
- package/src/css/preflight.css +0 -385
- package/src/featureFlags.js +0 -66
- package/src/index.js +0 -1
- package/src/lib/cacheInvalidation.js +0 -52
- package/src/lib/collapseAdjacentRules.js +0 -58
- package/src/lib/collapseDuplicateDeclarations.js +0 -93
- package/src/lib/content.js +0 -208
- package/src/lib/defaultExtractor.js +0 -230
- package/src/lib/detectNesting.js +0 -47
- package/src/lib/evaluateTailwindFunctions.js +0 -272
- package/src/lib/expandApplyAtRules.js +0 -620
- package/src/lib/expandTailwindAtRules.js +0 -300
- package/src/lib/findAtConfigPath.js +0 -48
- package/src/lib/generateRules.js +0 -951
- package/src/lib/getModuleDependencies.js +0 -79
- package/src/lib/load-config.ts +0 -39
- package/src/lib/normalizeTailwindDirectives.js +0 -84
- package/src/lib/offsets.js +0 -373
- package/src/lib/partitionApplyAtRules.js +0 -52
- package/src/lib/regex.js +0 -74
- package/src/lib/remap-bitfield.js +0 -82
- package/src/lib/resolveDefaultsAtRules.js +0 -163
- package/src/lib/setupContextUtils.js +0 -1366
- package/src/lib/setupTrackingContext.js +0 -169
- package/src/lib/sharedState.js +0 -61
- package/src/lib/substituteScreenAtRules.js +0 -19
- package/src/oxide/cli/build/deps.ts +0 -91
- package/src/oxide/cli/build/index.ts +0 -47
- package/src/oxide/cli/build/plugin.ts +0 -442
- package/src/oxide/cli/build/utils.ts +0 -74
- package/src/oxide/cli/build/watching.ts +0 -225
- package/src/oxide/cli/help/index.ts +0 -69
- package/src/oxide/cli/index.ts +0 -204
- package/src/oxide/cli/init/index.ts +0 -59
- package/src/oxide/cli.ts +0 -1
- package/src/oxide/postcss-plugin.ts +0 -1
- package/src/plugin.js +0 -107
- package/src/postcss-plugins/nesting/README.md +0 -42
- package/src/postcss-plugins/nesting/index.js +0 -13
- package/src/postcss-plugins/nesting/plugin.js +0 -80
- package/src/processTailwindFeatures.js +0 -59
- package/src/public/colors.js +0 -322
- package/src/public/create-plugin.js +0 -2
- package/src/public/default-config.js +0 -4
- package/src/public/default-theme.js +0 -4
- package/src/public/load-config.js +0 -2
- package/src/public/resolve-config.js +0 -7
- package/src/util/applyImportantSelector.js +0 -27
- package/src/util/bigSign.js +0 -3
- package/src/util/buildMediaQuery.js +0 -22
- package/src/util/cloneDeep.js +0 -11
- package/src/util/cloneNodes.js +0 -49
- package/src/util/color.js +0 -88
- package/src/util/colorNames.js +0 -150
- package/src/util/configurePlugins.js +0 -23
- package/src/util/createPlugin.js +0 -27
- package/src/util/createUtilityPlugin.js +0 -37
- package/src/util/dataTypes.js +0 -406
- package/src/util/defaults.js +0 -17
- package/src/util/escapeClassName.js +0 -8
- package/src/util/escapeCommas.js +0 -3
- package/src/util/flattenColorPalette.js +0 -13
- package/src/util/formatVariantSelector.js +0 -324
- package/src/util/getAllConfigs.js +0 -38
- package/src/util/hashConfig.js +0 -5
- package/src/util/isKeyframeRule.js +0 -3
- package/src/util/isPlainObject.js +0 -8
- package/src/util/isSyntacticallyValidPropertyValue.js +0 -61
- package/src/util/log.js +0 -29
- package/src/util/nameClass.js +0 -30
- package/src/util/negateValue.js +0 -24
- package/src/util/normalizeConfig.js +0 -301
- package/src/util/normalizeScreens.js +0 -140
- package/src/util/parseAnimationValue.js +0 -68
- package/src/util/parseBoxShadowValue.js +0 -72
- package/src/util/parseDependency.js +0 -44
- package/src/util/parseGlob.js +0 -24
- package/src/util/parseObjectStyles.js +0 -19
- package/src/util/pluginUtils.js +0 -307
- package/src/util/prefixSelector.js +0 -33
- package/src/util/pseudoElements.js +0 -171
- package/src/util/removeAlphaVariables.js +0 -24
- package/src/util/resolveConfig.js +0 -277
- package/src/util/resolveConfigPath.js +0 -66
- package/src/util/responsive.js +0 -10
- package/src/util/splitAtTopLevelOnly.js +0 -52
- package/src/util/tap.js +0 -4
- package/src/util/toColorValue.js +0 -3
- package/src/util/toPath.js +0 -26
- package/src/util/transformThemeValue.js +0 -62
- package/src/util/validateConfig.js +0 -26
- package/src/util/validateFormalSyntax.js +0 -34
- package/src/util/withAlphaVariable.js +0 -49
- package/src/value-parser/LICENSE +0 -22
- package/src/value-parser/README.md +0 -3
- package/src/value-parser/index.d.ts +0 -177
- package/src/value-parser/index.js +0 -28
- package/src/value-parser/parse.js +0 -303
- package/src/value-parser/stringify.js +0 -41
- package/src/value-parser/unit.js +0 -118
- package/src/value-parser/walk.js +0 -18
- package/stubs/.gitignore +0 -1
- package/stubs/.prettierrc.json +0 -6
- package/stubs/config.full.js +0 -1062
- package/stubs/config.simple.js +0 -7
- package/stubs/postcss.config.cjs +0 -6
- package/stubs/postcss.config.js +0 -6
- package/stubs/tailwind.config.cjs +0 -2
- package/stubs/tailwind.config.js +0 -2
- package/stubs/tailwind.config.ts +0 -3
- package/tailwind.css +0 -5
- package/types/config.d.ts +0 -376
- package/types/generated/.gitkeep +0 -0
- package/types/generated/colors.d.ts +0 -298
- package/types/generated/corePluginList.d.ts +0 -1
- package/types/generated/default-theme.d.ts +0 -397
- package/types/index.d.ts +0 -11
- package/variants.css +0 -1
@@ -1,72 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
3
|
-
value: true
|
4
|
-
});
|
5
|
-
Object.defineProperty(exports, "help", {
|
6
|
-
enumerable: true,
|
7
|
-
get: function() {
|
8
|
-
return help;
|
9
|
-
}
|
10
|
-
});
|
11
|
-
const _packagejson = /*#__PURE__*/ _interop_require_default(require("../../../../package.json"));
|
12
|
-
function _interop_require_default(obj) {
|
13
|
-
return obj && obj.__esModule ? obj : {
|
14
|
-
default: obj
|
15
|
-
};
|
16
|
-
}
|
17
|
-
function help({ message , usage , commands , options }) {
|
18
|
-
let indent = 2;
|
19
|
-
// Render header
|
20
|
-
console.log();
|
21
|
-
console.log(`${_packagejson.default.name} v${_packagejson.default.version}`);
|
22
|
-
// Render message
|
23
|
-
if (message) {
|
24
|
-
console.log();
|
25
|
-
for (let msg of message.split("\n")){
|
26
|
-
console.log(msg);
|
27
|
-
}
|
28
|
-
}
|
29
|
-
// Render usage
|
30
|
-
if (usage && usage.length > 0) {
|
31
|
-
console.log();
|
32
|
-
console.log("Usage:");
|
33
|
-
for (let example of usage){
|
34
|
-
console.log(" ".repeat(indent), example);
|
35
|
-
}
|
36
|
-
}
|
37
|
-
// Render commands
|
38
|
-
if (commands && commands.length > 0) {
|
39
|
-
console.log();
|
40
|
-
console.log("Commands:");
|
41
|
-
for (let command of commands){
|
42
|
-
console.log(" ".repeat(indent), command);
|
43
|
-
}
|
44
|
-
}
|
45
|
-
// Render options
|
46
|
-
if (options) {
|
47
|
-
let groupedOptions = {};
|
48
|
-
for (let [key, value] of Object.entries(options)){
|
49
|
-
if (typeof value === "object") {
|
50
|
-
groupedOptions[key] = {
|
51
|
-
...value,
|
52
|
-
flags: [
|
53
|
-
key
|
54
|
-
]
|
55
|
-
};
|
56
|
-
} else {
|
57
|
-
groupedOptions[value].flags.push(key);
|
58
|
-
}
|
59
|
-
}
|
60
|
-
console.log();
|
61
|
-
console.log("Options:");
|
62
|
-
for (let { flags , description , deprecated } of Object.values(groupedOptions)){
|
63
|
-
if (deprecated) continue;
|
64
|
-
if (flags.length === 1) {
|
65
|
-
console.log(" ".repeat(indent + 4 /* 4 = "-i, ".length */ ), flags.slice().reverse().join(", ").padEnd(20, " "), description);
|
66
|
-
} else {
|
67
|
-
console.log(" ".repeat(indent), flags.slice().reverse().join(", ").padEnd(24, " "), description);
|
68
|
-
}
|
69
|
-
}
|
70
|
-
}
|
71
|
-
console.log();
|
72
|
-
}
|
package/lib/oxide/cli/index.js
DELETED
@@ -1,214 +0,0 @@
|
|
1
|
-
#!/usr/bin/env node
|
2
|
-
"use strict";
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
4
|
-
value: true
|
5
|
-
});
|
6
|
-
const _path = /*#__PURE__*/ _interop_require_default(require("path"));
|
7
|
-
const _arg = /*#__PURE__*/ _interop_require_default(require("arg"));
|
8
|
-
const _fs = /*#__PURE__*/ _interop_require_default(require("fs"));
|
9
|
-
const _build = require("./build");
|
10
|
-
const _help = require("./help");
|
11
|
-
const _init = require("./init");
|
12
|
-
function _interop_require_default(obj) {
|
13
|
-
return obj && obj.__esModule ? obj : {
|
14
|
-
default: obj
|
15
|
-
};
|
16
|
-
}
|
17
|
-
// ---
|
18
|
-
function oneOf(...options) {
|
19
|
-
return Object.assign((value = true)=>{
|
20
|
-
for (let option of options){
|
21
|
-
let parsed = option(value);
|
22
|
-
if (parsed === value) {
|
23
|
-
return parsed;
|
24
|
-
}
|
25
|
-
}
|
26
|
-
throw new Error("...");
|
27
|
-
}, {
|
28
|
-
manualParsing: true
|
29
|
-
});
|
30
|
-
}
|
31
|
-
let commands = {
|
32
|
-
init: {
|
33
|
-
run: _init.init,
|
34
|
-
args: {
|
35
|
-
"--esm": {
|
36
|
-
type: Boolean,
|
37
|
-
description: `Initialize configuration file as ESM`
|
38
|
-
},
|
39
|
-
"--ts": {
|
40
|
-
type: Boolean,
|
41
|
-
description: `Initialize configuration file as TypeScript`
|
42
|
-
},
|
43
|
-
"--full": {
|
44
|
-
type: Boolean,
|
45
|
-
description: `Include the default values for all options in the generated configuration file`
|
46
|
-
},
|
47
|
-
"-f": "--full"
|
48
|
-
}
|
49
|
-
},
|
50
|
-
build: {
|
51
|
-
run: _build.build,
|
52
|
-
args: {
|
53
|
-
"--input": {
|
54
|
-
type: String,
|
55
|
-
description: "Input file"
|
56
|
-
},
|
57
|
-
"--output": {
|
58
|
-
type: String,
|
59
|
-
description: "Output file"
|
60
|
-
},
|
61
|
-
"--watch": {
|
62
|
-
type: oneOf(String, Boolean),
|
63
|
-
description: "Watch for changes and rebuild as needed"
|
64
|
-
},
|
65
|
-
"--poll": {
|
66
|
-
type: Boolean,
|
67
|
-
description: "Use polling instead of filesystem events when watching"
|
68
|
-
},
|
69
|
-
"--content": {
|
70
|
-
type: String,
|
71
|
-
description: "Content paths to use for removing unused classes"
|
72
|
-
},
|
73
|
-
"--minify": {
|
74
|
-
type: Boolean,
|
75
|
-
description: "Minify the output"
|
76
|
-
},
|
77
|
-
"--config": {
|
78
|
-
type: String,
|
79
|
-
description: "Path to a custom config file"
|
80
|
-
},
|
81
|
-
"-c": "--config",
|
82
|
-
"-i": "--input",
|
83
|
-
"-o": "--output",
|
84
|
-
"-m": "--minify",
|
85
|
-
"-w": "--watch",
|
86
|
-
"-p": "--poll"
|
87
|
-
}
|
88
|
-
}
|
89
|
-
};
|
90
|
-
let sharedFlags = {
|
91
|
-
"--help": {
|
92
|
-
type: Boolean,
|
93
|
-
description: "Display usage information"
|
94
|
-
},
|
95
|
-
"-h": "--help"
|
96
|
-
};
|
97
|
-
if (process.stdout.isTTY /* Detect redirecting output to a file */ && (process.argv[2] === undefined || process.argv.slice(2).every((flag)=>sharedFlags[flag] !== undefined))) {
|
98
|
-
(0, _help.help)({
|
99
|
-
usage: [
|
100
|
-
"tailwindcss [--input input.css] [--output output.css] [--watch] [options...]",
|
101
|
-
"tailwindcss init [--full] [options...]"
|
102
|
-
],
|
103
|
-
commands: Object.keys(commands).filter((command)=>command !== "build").map((command)=>`${command} [options]`),
|
104
|
-
options: {
|
105
|
-
...commands.build.args,
|
106
|
-
...sharedFlags
|
107
|
-
}
|
108
|
-
});
|
109
|
-
process.exit(0);
|
110
|
-
}
|
111
|
-
let command = ((arg = "")=>arg.startsWith("-") ? undefined : arg)(process.argv[2]) || "build";
|
112
|
-
if (commands[command] === undefined) {
|
113
|
-
if (_fs.default.existsSync(_path.default.resolve(command))) {
|
114
|
-
// TODO: Deprecate this in future versions
|
115
|
-
// Check if non-existing command, might be a file.
|
116
|
-
command = "build";
|
117
|
-
} else {
|
118
|
-
(0, _help.help)({
|
119
|
-
message: `Invalid command: ${command}`,
|
120
|
-
usage: [
|
121
|
-
"tailwindcss <command> [options]"
|
122
|
-
],
|
123
|
-
commands: Object.keys(commands).filter((command)=>command !== "build").map((command)=>`${command} [options]`),
|
124
|
-
options: sharedFlags
|
125
|
-
});
|
126
|
-
process.exit(1);
|
127
|
-
}
|
128
|
-
}
|
129
|
-
// Execute command
|
130
|
-
let { args: flags , run } = commands[command];
|
131
|
-
let args = (()=>{
|
132
|
-
try {
|
133
|
-
let result = (0, _arg.default)(Object.fromEntries(Object.entries({
|
134
|
-
...flags,
|
135
|
-
...sharedFlags
|
136
|
-
}).filter(([_key, value])=>{
|
137
|
-
var _value_type;
|
138
|
-
return !(value === null || value === void 0 ? void 0 : (_value_type = value.type) === null || _value_type === void 0 ? void 0 : _value_type.manualParsing);
|
139
|
-
}).map(([key, value])=>[
|
140
|
-
key,
|
141
|
-
typeof value === "object" ? value.type : value
|
142
|
-
])), {
|
143
|
-
permissive: true
|
144
|
-
});
|
145
|
-
// Manual parsing of flags to allow for special flags like oneOf(Boolean, String)
|
146
|
-
for(let i = result["_"].length - 1; i >= 0; --i){
|
147
|
-
let flag = result["_"][i];
|
148
|
-
if (!flag.startsWith("-")) continue;
|
149
|
-
let [flagName, flagValue] = flag.split("=");
|
150
|
-
let handler = flags[flagName];
|
151
|
-
// Resolve flagName & handler
|
152
|
-
while(typeof handler === "string"){
|
153
|
-
flagName = handler;
|
154
|
-
handler = flags[handler];
|
155
|
-
}
|
156
|
-
if (!handler) continue;
|
157
|
-
let args = [];
|
158
|
-
let offset = i + 1;
|
159
|
-
// --flag value syntax was used so we need to pull `value` from `args`
|
160
|
-
if (flagValue === undefined) {
|
161
|
-
// Parse args for current flag
|
162
|
-
while(result["_"][offset] && !result["_"][offset].startsWith("-")){
|
163
|
-
args.push(result["_"][offset++]);
|
164
|
-
}
|
165
|
-
// Cleanup manually parsed flags + args
|
166
|
-
result["_"].splice(i, 1 + args.length);
|
167
|
-
// No args were provided, use default value defined in handler
|
168
|
-
// One arg was provided, use that directly
|
169
|
-
// Multiple args were provided so pass them all in an array
|
170
|
-
flagValue = args.length === 0 ? undefined : args.length === 1 ? args[0] : args;
|
171
|
-
} else {
|
172
|
-
// Remove the whole flag from the args array
|
173
|
-
result["_"].splice(i, 1);
|
174
|
-
}
|
175
|
-
// Set the resolved value in the `result` object
|
176
|
-
result[flagName] = handler.type(flagValue, flagName);
|
177
|
-
}
|
178
|
-
// Ensure that the `command` is always the first argument in the `args`.
|
179
|
-
// This is important so that we don't have to check if a default command
|
180
|
-
// (build) was used or not from within each plugin.
|
181
|
-
//
|
182
|
-
// E.g.: tailwindcss input.css -> _: ['build', 'input.css']
|
183
|
-
// E.g.: tailwindcss build input.css -> _: ['build', 'input.css']
|
184
|
-
if (result["_"][0] !== command) {
|
185
|
-
result["_"].unshift(command);
|
186
|
-
}
|
187
|
-
return result;
|
188
|
-
} catch (err) {
|
189
|
-
if (err.code === "ARG_UNKNOWN_OPTION") {
|
190
|
-
(0, _help.help)({
|
191
|
-
message: err.message,
|
192
|
-
usage: [
|
193
|
-
"tailwindcss <command> [options]"
|
194
|
-
],
|
195
|
-
options: sharedFlags
|
196
|
-
});
|
197
|
-
process.exit(1);
|
198
|
-
}
|
199
|
-
throw err;
|
200
|
-
}
|
201
|
-
})();
|
202
|
-
if (args["--help"]) {
|
203
|
-
(0, _help.help)({
|
204
|
-
options: {
|
205
|
-
...flags,
|
206
|
-
...sharedFlags
|
207
|
-
},
|
208
|
-
usage: [
|
209
|
-
`tailwindcss ${command} [options]`
|
210
|
-
]
|
211
|
-
});
|
212
|
-
process.exit(0);
|
213
|
-
}
|
214
|
-
run(args);
|
@@ -1,52 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
3
|
-
value: true
|
4
|
-
});
|
5
|
-
Object.defineProperty(exports, "init", {
|
6
|
-
enumerable: true,
|
7
|
-
get: function() {
|
8
|
-
return init;
|
9
|
-
}
|
10
|
-
});
|
11
|
-
const _fs = /*#__PURE__*/ _interop_require_default(require("fs"));
|
12
|
-
const _path = /*#__PURE__*/ _interop_require_default(require("path"));
|
13
|
-
function _interop_require_default(obj) {
|
14
|
-
return obj && obj.__esModule ? obj : {
|
15
|
-
default: obj
|
16
|
-
};
|
17
|
-
}
|
18
|
-
function isESM() {
|
19
|
-
const pkgPath = _path.default.resolve("./package.json");
|
20
|
-
try {
|
21
|
-
let pkg = JSON.parse(_fs.default.readFileSync(pkgPath, "utf8"));
|
22
|
-
return pkg.type && pkg.type === "module";
|
23
|
-
} catch (err) {
|
24
|
-
return false;
|
25
|
-
}
|
26
|
-
}
|
27
|
-
function init(args) {
|
28
|
-
let messages = [];
|
29
|
-
let isProjectESM = args["--ts"] || args["--esm"] || isESM();
|
30
|
-
let syntax = args["--ts"] ? "ts" : isProjectESM ? "js" : "cjs";
|
31
|
-
let extension = args["--ts"] ? "ts" : "js";
|
32
|
-
var _args___;
|
33
|
-
let tailwindConfigLocation = _path.default.resolve((_args___ = args["_"][1]) !== null && _args___ !== void 0 ? _args___ : `./tailwind.config.${extension}`);
|
34
|
-
if (_fs.default.existsSync(tailwindConfigLocation)) {
|
35
|
-
messages.push(`${_path.default.basename(tailwindConfigLocation)} already exists.`);
|
36
|
-
} else {
|
37
|
-
let stubContentsFile = _fs.default.readFileSync(args["--full"] ? _path.default.resolve(__dirname, "../../../../stubs/config.full.js") : _path.default.resolve(__dirname, "../../../../stubs/config.simple.js"), "utf8");
|
38
|
-
let stubFile = _fs.default.readFileSync(_path.default.resolve(__dirname, `../../../../stubs/tailwind.config.${syntax}`), "utf8");
|
39
|
-
// Change colors import
|
40
|
-
stubContentsFile = stubContentsFile.replace("../colors", "tailwindcss/colors");
|
41
|
-
// Replace contents of {ts,js,cjs} file with the stub {simple,full}.
|
42
|
-
stubFile = stubFile.replace("__CONFIG__", stubContentsFile.replace("module.exports =", "").trim()).trim() + "\n\n";
|
43
|
-
_fs.default.writeFileSync(tailwindConfigLocation, stubFile, "utf8");
|
44
|
-
messages.push(`Created Tailwind CSS config file: ${_path.default.basename(tailwindConfigLocation)}`);
|
45
|
-
}
|
46
|
-
if (messages.length > 0) {
|
47
|
-
console.log();
|
48
|
-
for (let message of messages){
|
49
|
-
console.log(message);
|
50
|
-
}
|
51
|
-
}
|
52
|
-
}
|
package/lib/oxide/cli.js
DELETED
package/lib/plugin.js
DELETED
@@ -1,98 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
3
|
-
value: true
|
4
|
-
});
|
5
|
-
const _setupTrackingContext = /*#__PURE__*/ _interop_require_default(require("./lib/setupTrackingContext"));
|
6
|
-
const _processTailwindFeatures = /*#__PURE__*/ _interop_require_default(require("./processTailwindFeatures"));
|
7
|
-
const _sharedState = require("./lib/sharedState");
|
8
|
-
const _findAtConfigPath = require("./lib/findAtConfigPath");
|
9
|
-
function _interop_require_default(obj) {
|
10
|
-
return obj && obj.__esModule ? obj : {
|
11
|
-
default: obj
|
12
|
-
};
|
13
|
-
}
|
14
|
-
module.exports = function tailwindcss(configOrPath) {
|
15
|
-
return {
|
16
|
-
postcssPlugin: "tailwindcss",
|
17
|
-
plugins: [
|
18
|
-
_sharedState.env.DEBUG && function(root) {
|
19
|
-
console.log("\n");
|
20
|
-
console.time("JIT TOTAL");
|
21
|
-
return root;
|
22
|
-
},
|
23
|
-
async function(root, result) {
|
24
|
-
var _findAtConfigPath1;
|
25
|
-
// Use the path for the `@config` directive if it exists, otherwise use the
|
26
|
-
// path for the file being processed
|
27
|
-
configOrPath = (_findAtConfigPath1 = (0, _findAtConfigPath.findAtConfigPath)(root, result)) !== null && _findAtConfigPath1 !== void 0 ? _findAtConfigPath1 : configOrPath;
|
28
|
-
let context = (0, _setupTrackingContext.default)(configOrPath);
|
29
|
-
if (root.type === "document") {
|
30
|
-
let roots = root.nodes.filter((node)=>node.type === "root");
|
31
|
-
for (const root of roots){
|
32
|
-
if (root.type === "root") {
|
33
|
-
await (0, _processTailwindFeatures.default)(context)(root, result);
|
34
|
-
}
|
35
|
-
}
|
36
|
-
return;
|
37
|
-
}
|
38
|
-
await (0, _processTailwindFeatures.default)(context)(root, result);
|
39
|
-
},
|
40
|
-
false && function lightningCssPlugin(_root, result) {
|
41
|
-
let postcss = require("postcss");
|
42
|
-
let lightningcss = require("lightningcss");
|
43
|
-
let browserslist = require("browserslist");
|
44
|
-
try {
|
45
|
-
let transformed = lightningcss.transform({
|
46
|
-
filename: result.opts.from,
|
47
|
-
code: Buffer.from(result.root.toString()),
|
48
|
-
minify: false,
|
49
|
-
sourceMap: !!result.map,
|
50
|
-
inputSourceMap: result.map ? result.map.toString() : undefined,
|
51
|
-
targets: typeof process !== "undefined" && process.env.JEST_WORKER_ID ? {
|
52
|
-
chrome: 106 << 16
|
53
|
-
} : lightningcss.browserslistToTargets(browserslist(require("../package.json").browserslist)),
|
54
|
-
drafts: {
|
55
|
-
nesting: true,
|
56
|
-
customMedia: true
|
57
|
-
}
|
58
|
-
});
|
59
|
-
var _result_map;
|
60
|
-
result.map = Object.assign((_result_map = result.map) !== null && _result_map !== void 0 ? _result_map : {}, {
|
61
|
-
toJSON () {
|
62
|
-
return transformed.map.toJSON();
|
63
|
-
},
|
64
|
-
toString () {
|
65
|
-
return transformed.map.toString();
|
66
|
-
}
|
67
|
-
});
|
68
|
-
result.root = postcss.parse(transformed.code.toString("utf8"));
|
69
|
-
} catch (err) {
|
70
|
-
if (typeof process !== "undefined" && process.env.JEST_WORKER_ID) {
|
71
|
-
let lines = err.source.split("\n");
|
72
|
-
err = new Error([
|
73
|
-
"Error formatting using Lightning CSS:",
|
74
|
-
"",
|
75
|
-
...[
|
76
|
-
"```css",
|
77
|
-
...lines.slice(Math.max(err.loc.line - 3, 0), err.loc.line),
|
78
|
-
" ".repeat(err.loc.column - 1) + "^-- " + err.toString(),
|
79
|
-
...lines.slice(err.loc.line, err.loc.line + 2),
|
80
|
-
"```"
|
81
|
-
]
|
82
|
-
].join("\n"));
|
83
|
-
}
|
84
|
-
if (Error.captureStackTrace) {
|
85
|
-
Error.captureStackTrace(err, lightningCssPlugin);
|
86
|
-
}
|
87
|
-
throw err;
|
88
|
-
}
|
89
|
-
},
|
90
|
-
_sharedState.env.DEBUG && function(root) {
|
91
|
-
console.timeEnd("JIT TOTAL");
|
92
|
-
console.log("\n");
|
93
|
-
return root;
|
94
|
-
}
|
95
|
-
].filter(Boolean)
|
96
|
-
};
|
97
|
-
};
|
98
|
-
module.exports.postcss = true;
|
@@ -1,42 +0,0 @@
|
|
1
|
-
# tailwindcss/nesting
|
2
|
-
|
3
|
-
This is a PostCSS plugin that wraps [postcss-nested](https://github.com/postcss/postcss-nested) or [postcss-nesting](https://github.com/csstools/postcss-plugins/tree/main/plugins/postcss-nesting) and acts as a compatibility layer to make sure your nesting plugin of choice properly understands Tailwind's custom syntax like `@apply` and `@screen`.
|
4
|
-
|
5
|
-
Add it to your PostCSS configuration, somewhere before Tailwind itself:
|
6
|
-
|
7
|
-
```js
|
8
|
-
// postcss.config.js
|
9
|
-
module.exports = {
|
10
|
-
plugins: [
|
11
|
-
require('postcss-import'),
|
12
|
-
require('tailwindcss/nesting'),
|
13
|
-
require('tailwindcss'),
|
14
|
-
require('autoprefixer'),
|
15
|
-
]
|
16
|
-
}
|
17
|
-
```
|
18
|
-
|
19
|
-
By default, it uses the [postcss-nested](https://github.com/postcss/postcss-nested) plugin under the hood, which uses a Sass-like syntax and is the plugin that powers nesting support in the [Tailwind CSS plugin API](https://tailwindcss.com/docs/plugins#css-in-js-syntax).
|
20
|
-
|
21
|
-
If you'd rather use [postcss-nesting](https://github.com/csstools/postcss-plugins/tree/main/plugins/postcss-nesting) (which is based on the work-in-progress [CSS Nesting](https://drafts.csswg.org/css-nesting-1/) specification), first install the plugin alongside:
|
22
|
-
|
23
|
-
```shell
|
24
|
-
npm install postcss-nesting
|
25
|
-
```
|
26
|
-
|
27
|
-
Then pass the plugin itself as an argument to `tailwindcss/nesting` in your PostCSS configuration:
|
28
|
-
|
29
|
-
```js
|
30
|
-
// postcss.config.js
|
31
|
-
module.exports = {
|
32
|
-
plugins: [
|
33
|
-
require('postcss-import'),
|
34
|
-
require('tailwindcss/nesting')(require('postcss-nesting')),
|
35
|
-
require('tailwindcss'),
|
36
|
-
require('autoprefixer'),
|
37
|
-
]
|
38
|
-
}
|
39
|
-
```
|
40
|
-
|
41
|
-
This can also be helpful if for whatever reason you need to use a very specific version of `postcss-nested` and want to override the version we bundle with `tailwindcss/nesting` itself.
|
42
|
-
|
@@ -1,21 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
3
|
-
value: true
|
4
|
-
});
|
5
|
-
Object.defineProperty(exports, "default", {
|
6
|
-
enumerable: true,
|
7
|
-
get: function() {
|
8
|
-
return _default;
|
9
|
-
}
|
10
|
-
});
|
11
|
-
const _plugin = require("./plugin");
|
12
|
-
const _default = Object.assign(function(opts) {
|
13
|
-
return {
|
14
|
-
postcssPlugin: "tailwindcss/nesting",
|
15
|
-
Once (root, { result }) {
|
16
|
-
return (0, _plugin.nesting)(opts)(root, result);
|
17
|
-
}
|
18
|
-
};
|
19
|
-
}, {
|
20
|
-
postcss: true
|
21
|
-
});
|
@@ -1,89 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
3
|
-
value: true
|
4
|
-
});
|
5
|
-
Object.defineProperty(exports, "nesting", {
|
6
|
-
enumerable: true,
|
7
|
-
get: function() {
|
8
|
-
return nesting;
|
9
|
-
}
|
10
|
-
});
|
11
|
-
const _postcss = /*#__PURE__*/ _interop_require_default(require("postcss"));
|
12
|
-
const _postcssnested = /*#__PURE__*/ _interop_require_default(require("postcss-nested"));
|
13
|
-
function _interop_require_default(obj) {
|
14
|
-
return obj && obj.__esModule ? obj : {
|
15
|
-
default: obj
|
16
|
-
};
|
17
|
-
}
|
18
|
-
function nesting(opts = _postcssnested.default) {
|
19
|
-
return (root, result)=>{
|
20
|
-
root.walkAtRules("screen", (rule)=>{
|
21
|
-
rule.name = "media";
|
22
|
-
rule.params = `screen(${rule.params})`;
|
23
|
-
});
|
24
|
-
root.walkAtRules("apply", (rule)=>{
|
25
|
-
rule.before(_postcss.default.decl({
|
26
|
-
prop: "__apply",
|
27
|
-
value: rule.params,
|
28
|
-
source: rule.source
|
29
|
-
}));
|
30
|
-
rule.remove();
|
31
|
-
});
|
32
|
-
let plugin = (()=>{
|
33
|
-
var _opts_hasOwnProperty;
|
34
|
-
if (typeof opts === "function" || typeof opts === "object" && (opts === null || opts === void 0 ? void 0 : (_opts_hasOwnProperty = opts.hasOwnProperty) === null || _opts_hasOwnProperty === void 0 ? void 0 : _opts_hasOwnProperty.call(opts, "postcssPlugin"))) {
|
35
|
-
return opts;
|
36
|
-
}
|
37
|
-
if (typeof opts === "string") {
|
38
|
-
return require(opts);
|
39
|
-
}
|
40
|
-
if (Object.keys(opts).length <= 0) {
|
41
|
-
return _postcssnested.default;
|
42
|
-
}
|
43
|
-
throw new Error("tailwindcss/nesting should be loaded with a nesting plugin.");
|
44
|
-
})();
|
45
|
-
(0, _postcss.default)([
|
46
|
-
plugin
|
47
|
-
]).process(root, result.opts).sync();
|
48
|
-
root.walkDecls("__apply", (decl)=>{
|
49
|
-
decl.before(_postcss.default.atRule({
|
50
|
-
name: "apply",
|
51
|
-
params: decl.value,
|
52
|
-
source: decl.source
|
53
|
-
}));
|
54
|
-
decl.remove();
|
55
|
-
});
|
56
|
-
/**
|
57
|
-
* Use a private PostCSS API to remove the "clean" flag from the entire AST.
|
58
|
-
* This is done because running process() on the AST will set the "clean"
|
59
|
-
* flag on all nodes, which we don't want.
|
60
|
-
*
|
61
|
-
* This causes downstream plugins using the visitor API to be skipped.
|
62
|
-
*
|
63
|
-
* This is guarded because the PostCSS API is not public
|
64
|
-
* and may change in future versions of PostCSS.
|
65
|
-
*
|
66
|
-
* See https://github.com/postcss/postcss/issues/1712 for more details
|
67
|
-
*
|
68
|
-
* @param {import('postcss').Node} node
|
69
|
-
*/ function markDirty(node) {
|
70
|
-
if (!("markDirty" in node)) {
|
71
|
-
return;
|
72
|
-
}
|
73
|
-
// Traverse the tree down to the leaf nodes
|
74
|
-
if (node.nodes) {
|
75
|
-
node.nodes.forEach((n)=>markDirty(n));
|
76
|
-
}
|
77
|
-
// If it's a leaf node mark it as dirty
|
78
|
-
// We do this here because marking a node as dirty
|
79
|
-
// will walk up the tree and mark all parents as dirty
|
80
|
-
// resulting in a lot of unnecessary work if we did this
|
81
|
-
// for every single node
|
82
|
-
if (!node.nodes) {
|
83
|
-
node.markDirty();
|
84
|
-
}
|
85
|
-
}
|
86
|
-
markDirty(root);
|
87
|
-
return root;
|
88
|
-
};
|
89
|
-
}
|
@@ -1,64 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
3
|
-
value: true
|
4
|
-
});
|
5
|
-
Object.defineProperty(exports, "default", {
|
6
|
-
enumerable: true,
|
7
|
-
get: function() {
|
8
|
-
return processTailwindFeatures;
|
9
|
-
}
|
10
|
-
});
|
11
|
-
const _normalizeTailwindDirectives = /*#__PURE__*/ _interop_require_default(require("./lib/normalizeTailwindDirectives"));
|
12
|
-
const _expandTailwindAtRules = /*#__PURE__*/ _interop_require_default(require("./lib/expandTailwindAtRules"));
|
13
|
-
const _expandApplyAtRules = /*#__PURE__*/ _interop_require_default(require("./lib/expandApplyAtRules"));
|
14
|
-
const _evaluateTailwindFunctions = /*#__PURE__*/ _interop_require_default(require("./lib/evaluateTailwindFunctions"));
|
15
|
-
const _substituteScreenAtRules = /*#__PURE__*/ _interop_require_default(require("./lib/substituteScreenAtRules"));
|
16
|
-
const _resolveDefaultsAtRules = /*#__PURE__*/ _interop_require_default(require("./lib/resolveDefaultsAtRules"));
|
17
|
-
const _collapseAdjacentRules = /*#__PURE__*/ _interop_require_default(require("./lib/collapseAdjacentRules"));
|
18
|
-
const _collapseDuplicateDeclarations = /*#__PURE__*/ _interop_require_default(require("./lib/collapseDuplicateDeclarations"));
|
19
|
-
const _partitionApplyAtRules = /*#__PURE__*/ _interop_require_default(require("./lib/partitionApplyAtRules"));
|
20
|
-
const _detectNesting = /*#__PURE__*/ _interop_require_default(require("./lib/detectNesting"));
|
21
|
-
const _setupContextUtils = require("./lib/setupContextUtils");
|
22
|
-
const _featureFlags = require("./featureFlags");
|
23
|
-
function _interop_require_default(obj) {
|
24
|
-
return obj && obj.__esModule ? obj : {
|
25
|
-
default: obj
|
26
|
-
};
|
27
|
-
}
|
28
|
-
function processTailwindFeatures(setupContext) {
|
29
|
-
return async function(root, result) {
|
30
|
-
let { tailwindDirectives , applyDirectives } = (0, _normalizeTailwindDirectives.default)(root);
|
31
|
-
(0, _detectNesting.default)()(root, result);
|
32
|
-
// Partition apply rules that are found in the css
|
33
|
-
// itself.
|
34
|
-
(0, _partitionApplyAtRules.default)()(root, result);
|
35
|
-
let context = setupContext({
|
36
|
-
tailwindDirectives,
|
37
|
-
applyDirectives,
|
38
|
-
registerDependency (dependency) {
|
39
|
-
result.messages.push({
|
40
|
-
plugin: "tailwindcss",
|
41
|
-
parent: result.opts.from,
|
42
|
-
...dependency
|
43
|
-
});
|
44
|
-
},
|
45
|
-
createContext (tailwindConfig, changedContent) {
|
46
|
-
return (0, _setupContextUtils.createContext)(tailwindConfig, changedContent, root);
|
47
|
-
}
|
48
|
-
})(root, result);
|
49
|
-
if (context.tailwindConfig.separator === "-") {
|
50
|
-
throw new Error("The '-' character cannot be used as a custom separator in JIT mode due to parsing ambiguity. Please use another character like '_' instead.");
|
51
|
-
}
|
52
|
-
(0, _featureFlags.issueFlagNotices)(context.tailwindConfig);
|
53
|
-
await (0, _expandTailwindAtRules.default)(context)(root, result);
|
54
|
-
// Partition apply rules that are generated by
|
55
|
-
// addComponents, addUtilities and so on.
|
56
|
-
(0, _partitionApplyAtRules.default)()(root, result);
|
57
|
-
(0, _expandApplyAtRules.default)(context)(root, result);
|
58
|
-
(0, _evaluateTailwindFunctions.default)(context)(root, result);
|
59
|
-
(0, _substituteScreenAtRules.default)(context)(root, result);
|
60
|
-
(0, _resolveDefaultsAtRules.default)(context)(root, result);
|
61
|
-
(0, _collapseAdjacentRules.default)(context)(root, result);
|
62
|
-
(0, _collapseDuplicateDeclarations.default)(context)(root, result);
|
63
|
-
};
|
64
|
-
}
|