tailwindcss 0.0.0-oxide-insiders.0e171fd → 0.0.0-oxide-insiders.f49b054

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.
@@ -0,0 +1,49 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "handleImportAtRules", {
6
+ enumerable: true,
7
+ get: function() {
8
+ return handleImportAtRules;
9
+ }
10
+ });
11
+ const _postcss = /*#__PURE__*/ _interop_require_default(require("postcss"));
12
+ function _interop_require_default(obj) {
13
+ return obj && obj.__esModule ? obj : {
14
+ default: obj
15
+ };
16
+ }
17
+ const TAILWIND = Symbol();
18
+ function handleImportAtRules(postcssImport = require("postcss-import")) {
19
+ let RESTORE_ATRULE_COMMENT = "__TAILWIND_RESTORE__";
20
+ let atRulesToRestore = [
21
+ "tailwind",
22
+ "config"
23
+ ];
24
+ return [
25
+ (root)=>{
26
+ root.walkAtRules((rule)=>{
27
+ if (!atRulesToRestore.includes(rule.name)) return rule;
28
+ rule.after(_postcss.default.comment({
29
+ text: RESTORE_ATRULE_COMMENT,
30
+ raws: {
31
+ [TAILWIND]: {
32
+ rule
33
+ }
34
+ }
35
+ }));
36
+ rule.remove();
37
+ });
38
+ },
39
+ postcssImport(),
40
+ (root)=>{
41
+ root.walkComments((rule)=>{
42
+ if (rule.text === RESTORE_ATRULE_COMMENT) {
43
+ rule.after(rule.raws[TAILWIND].rule);
44
+ rule.remove();
45
+ }
46
+ });
47
+ }
48
+ ];
49
+ }
@@ -22,19 +22,21 @@ function normalizeTailwindDirectives(root) {
22
22
  if (atRule.name === "apply") {
23
23
  applyDirectives.add(atRule);
24
24
  }
25
- if (atRule.name === "import") {
26
- if (atRule.params === '"tailwindcss/base"' || atRule.params === "'tailwindcss/base'") {
27
- atRule.name = "tailwind";
28
- atRule.params = "base";
29
- } else if (atRule.params === '"tailwindcss/components"' || atRule.params === "'tailwindcss/components'") {
30
- atRule.name = "tailwind";
31
- atRule.params = "components";
32
- } else if (atRule.params === '"tailwindcss/utilities"' || atRule.params === "'tailwindcss/utilities'") {
33
- atRule.name = "tailwind";
34
- atRule.params = "utilities";
35
- } else if (atRule.params === '"tailwindcss/screens"' || atRule.params === "'tailwindcss/screens'" || atRule.params === '"tailwindcss/variants"' || atRule.params === "'tailwindcss/variants'") {
36
- atRule.name = "tailwind";
37
- atRule.params = "variants";
25
+ if (!true) {
26
+ if (atRule.name === "import") {
27
+ if (atRule.params === '"tailwindcss/base"' || atRule.params === "'tailwindcss/base'") {
28
+ atRule.name = "tailwind";
29
+ atRule.params = "base";
30
+ } else if (atRule.params === '"tailwindcss/components"' || atRule.params === "'tailwindcss/components'") {
31
+ atRule.name = "tailwind";
32
+ atRule.params = "components";
33
+ } else if (atRule.params === '"tailwindcss/utilities"' || atRule.params === "'tailwindcss/utilities'") {
34
+ atRule.name = "tailwind";
35
+ atRule.params = "utilities";
36
+ } else if (atRule.params === '"tailwindcss/screens"' || atRule.params === "'tailwindcss/screens'" || atRule.params === '"tailwindcss/variants"' || atRule.params === "'tailwindcss/variants'") {
37
+ atRule.name = "tailwind";
38
+ atRule.params = "variants";
39
+ }
38
40
  }
39
41
  }
40
42
  if (atRule.name === "tailwind") {
@@ -29,6 +29,7 @@ const _log = /*#__PURE__*/ _interop_require_default(require("../../../util/log")
29
29
  const _loadconfig = require("../../../lib/load-config");
30
30
  const _getModuleDependencies = /*#__PURE__*/ _interop_require_default(require("../../../lib/getModuleDependencies"));
31
31
  const _validateConfig = require("../../../util/validateConfig");
32
+ const _handleImportAtRules = require("../../../lib/handleImportAtRules");
32
33
  function _interop_require_default(obj) {
33
34
  return obj && obj.__esModule ? obj : {
34
35
  default: obj
@@ -76,38 +77,6 @@ function _interop_require_default(obj) {
76
77
  config.options
77
78
  ];
78
79
  }
79
- function loadBuiltinPostcssPlugins() {
80
- let postcss = (0, _deps.loadPostcss)();
81
- let IMPORT_COMMENT = "__TAILWIND_RESTORE_IMPORT__: ";
82
- return [
83
- [
84
- (root)=>{
85
- root.walkAtRules("import", (rule)=>{
86
- if (rule.params.slice(1).startsWith("tailwindcss/")) {
87
- rule.after(postcss.comment({
88
- text: IMPORT_COMMENT + rule.params
89
- }));
90
- rule.remove();
91
- }
92
- });
93
- },
94
- (0, _deps.loadPostcssImport)(),
95
- (root)=>{
96
- root.walkComments((rule)=>{
97
- if (rule.text.startsWith(IMPORT_COMMENT)) {
98
- rule.after(postcss.atRule({
99
- name: "import",
100
- params: rule.text.replace(IMPORT_COMMENT, "")
101
- }));
102
- rule.remove();
103
- }
104
- });
105
- }
106
- ],
107
- [],
108
- {}
109
- ];
110
- }
111
80
  let state = {
112
81
  /** @type {any} */ context: null,
113
82
  /** @type {ReturnType<typeof createWatcher> | null} */ watcher: null,
@@ -234,7 +203,12 @@ async function createProcessor(args, cliConfigPath) {
234
203
  let output = args["--output"];
235
204
  let includePostCss = args["--postcss"];
236
205
  let customPostCssPath = typeof args["--postcss"] === "string" ? args["--postcss"] : undefined;
237
- let [beforePlugins, afterPlugins, postcssOptions] = includePostCss ? await loadPostCssPlugins(customPostCssPath) : loadBuiltinPostcssPlugins();
206
+ let [beforePlugins, afterPlugins, postcssOptions] = includePostCss ? await loadPostCssPlugins(customPostCssPath) : [
207
+ [],
208
+ [],
209
+ {}
210
+ ];
211
+ beforePlugins.unshift(...(0, _handleImportAtRules.handleImportAtRules)((0, _deps.loadPostcssImport)()));
238
212
  if (args["--purge"]) {
239
213
  _log.default.warn("purge-flag-deprecated", [
240
214
  "The `--purge` flag has been deprecated.",
package/lib/plugin.js CHANGED
@@ -6,6 +6,7 @@ const _setupTrackingContext = /*#__PURE__*/ _interop_require_default(require("./
6
6
  const _processTailwindFeatures = /*#__PURE__*/ _interop_require_default(require("./processTailwindFeatures"));
7
7
  const _sharedState = require("./lib/sharedState");
8
8
  const _findAtConfigPath = require("./lib/findAtConfigPath");
9
+ const _handleImportAtRules = require("./lib/handleImportAtRules");
9
10
  function _interop_require_default(obj) {
10
11
  return obj && obj.__esModule ? obj : {
11
12
  default: obj
@@ -20,6 +21,7 @@ module.exports = function tailwindcss(configOrPath) {
20
21
  console.time("JIT TOTAL");
21
22
  return root;
22
23
  },
24
+ ...true ? (0, _handleImportAtRules.handleImportAtRules)() : [],
23
25
  function(root, result) {
24
26
  var _findAtConfigPath1;
25
27
  // Use the path for the `@config` directive if it exists, otherwise use the
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tailwindcss",
3
- "version": "0.0.0-oxide-insiders.0e171fd",
3
+ "version": "0.0.0-oxide-insiders.f49b054",
4
4
  "description": "A utility-first CSS framework for rapidly building custom user interfaces.",
5
5
  "license": "MIT",
6
6
  "main": "lib/index.js",
@@ -68,7 +68,7 @@
68
68
  },
69
69
  "dependencies": {
70
70
  "@alloc/quick-lru": "^5.2.0",
71
- "@tailwindcss/oxide": "0.0.0-oxide-insiders.0e171fd",
71
+ "@tailwindcss/oxide": "0.0.0-oxide-insiders.f49b054",
72
72
  "arg": "^5.0.2",
73
73
  "browserslist": "^4.21.5",
74
74
  "chokidar": "^3.5.3",
@@ -0,0 +1,33 @@
1
+ import postcss from 'postcss'
2
+
3
+ const TAILWIND = Symbol()
4
+
5
+ export function handleImportAtRules(postcssImport = require('postcss-import')) {
6
+ let RESTORE_ATRULE_COMMENT = '__TAILWIND_RESTORE__'
7
+ let atRulesToRestore = ['tailwind', 'config']
8
+
9
+ return [
10
+ (root) => {
11
+ root.walkAtRules((rule) => {
12
+ if (!atRulesToRestore.includes(rule.name)) return rule
13
+
14
+ rule.after(
15
+ postcss.comment({
16
+ text: RESTORE_ATRULE_COMMENT,
17
+ raws: { [TAILWIND]: { rule } },
18
+ })
19
+ )
20
+ rule.remove()
21
+ })
22
+ },
23
+ postcssImport(),
24
+ (root) => {
25
+ root.walkComments((rule) => {
26
+ if (rule.text === RESTORE_ATRULE_COMMENT) {
27
+ rule.after(rule.raws[TAILWIND].rule)
28
+ rule.remove()
29
+ }
30
+ })
31
+ },
32
+ ]
33
+ }
@@ -10,30 +10,32 @@ export default function normalizeTailwindDirectives(root) {
10
10
  applyDirectives.add(atRule)
11
11
  }
12
12
 
13
- if (atRule.name === 'import') {
14
- if (atRule.params === '"tailwindcss/base"' || atRule.params === "'tailwindcss/base'") {
15
- atRule.name = 'tailwind'
16
- atRule.params = 'base'
17
- } else if (
18
- atRule.params === '"tailwindcss/components"' ||
19
- atRule.params === "'tailwindcss/components'"
20
- ) {
21
- atRule.name = 'tailwind'
22
- atRule.params = 'components'
23
- } else if (
24
- atRule.params === '"tailwindcss/utilities"' ||
25
- atRule.params === "'tailwindcss/utilities'"
26
- ) {
27
- atRule.name = 'tailwind'
28
- atRule.params = 'utilities'
29
- } else if (
30
- atRule.params === '"tailwindcss/screens"' ||
31
- atRule.params === "'tailwindcss/screens'" ||
32
- atRule.params === '"tailwindcss/variants"' ||
33
- atRule.params === "'tailwindcss/variants'"
34
- ) {
35
- atRule.name = 'tailwind'
36
- atRule.params = 'variants'
13
+ if (!__OXIDE__) {
14
+ if (atRule.name === 'import') {
15
+ if (atRule.params === '"tailwindcss/base"' || atRule.params === "'tailwindcss/base'") {
16
+ atRule.name = 'tailwind'
17
+ atRule.params = 'base'
18
+ } else if (
19
+ atRule.params === '"tailwindcss/components"' ||
20
+ atRule.params === "'tailwindcss/components'"
21
+ ) {
22
+ atRule.name = 'tailwind'
23
+ atRule.params = 'components'
24
+ } else if (
25
+ atRule.params === '"tailwindcss/utilities"' ||
26
+ atRule.params === "'tailwindcss/utilities'"
27
+ ) {
28
+ atRule.name = 'tailwind'
29
+ atRule.params = 'utilities'
30
+ } else if (
31
+ atRule.params === '"tailwindcss/screens"' ||
32
+ atRule.params === "'tailwindcss/screens'" ||
33
+ atRule.params === '"tailwindcss/variants"' ||
34
+ atRule.params === "'tailwindcss/variants'"
35
+ ) {
36
+ atRule.name = 'tailwind'
37
+ atRule.params = 'variants'
38
+ }
37
39
  }
38
40
  }
39
41
 
@@ -19,6 +19,7 @@ import { loadConfig } from '../../../lib/load-config'
19
19
  import getModuleDependencies from '../../../lib/getModuleDependencies'
20
20
  import type { Config } from '../../../../types'
21
21
  import { validateConfig } from '../../../util/validateConfig'
22
+ import { handleImportAtRules } from '../../../lib/handleImportAtRules'
22
23
 
23
24
  /**
24
25
  *
@@ -75,39 +76,6 @@ async function loadPostCssPlugins(customPostCssPath) {
75
76
  return [beforePlugins, afterPlugins, config.options]
76
77
  }
77
78
 
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
-
111
79
  let state = {
112
80
  /** @type {any} */
113
81
  context: null,
@@ -266,7 +234,9 @@ export async function createProcessor(args, cliConfigPath) {
266
234
 
267
235
  let [beforePlugins, afterPlugins, postcssOptions] = includePostCss
268
236
  ? await loadPostCssPlugins(customPostCssPath)
269
- : loadBuiltinPostcssPlugins()
237
+ : [[], [], {}]
238
+
239
+ beforePlugins.unshift(...handleImportAtRules(loadPostcssImport()))
270
240
 
271
241
  if (args['--purge']) {
272
242
  log.warn('purge-flag-deprecated', [
package/src/plugin.js CHANGED
@@ -2,6 +2,7 @@ import setupTrackingContext from './lib/setupTrackingContext'
2
2
  import processTailwindFeatures from './processTailwindFeatures'
3
3
  import { env } from './lib/sharedState'
4
4
  import { findAtConfigPath } from './lib/findAtConfigPath'
5
+ import { handleImportAtRules } from './lib/handleImportAtRules'
5
6
 
6
7
  module.exports = function tailwindcss(configOrPath) {
7
8
  return {
@@ -13,6 +14,7 @@ module.exports = function tailwindcss(configOrPath) {
13
14
  console.time('JIT TOTAL')
14
15
  return root
15
16
  },
17
+ ...(__OXIDE__ ? handleImportAtRules() : []),
16
18
  function (root, result) {
17
19
  // Use the path for the `@config` directive if it exists, otherwise use the
18
20
  // path for the file being processed