generated from sonofmagic/monorepo-template
-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4f0cefc
commit ad528ca
Showing
11 changed files
with
1,100 additions
and
8 deletions.
There are no files selected for viewing
368 changes: 368 additions & 0 deletions
368
packages/tailwindcss-patch/test/__snapshots__/index.test.ts.snap
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
packages/tailwindcss-patch/test/fixtures/versions/3.4.7/lib/index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
"use strict"; | ||
module.exports = require("./plugin"); |
48 changes: 48 additions & 0 deletions
48
packages/tailwindcss-patch/test/fixtures/versions/3.4.7/lib/plugin.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
const _setupTrackingContext = /*#__PURE__*/ _interop_require_default(require("./lib/setupTrackingContext")); | ||
const _processTailwindFeatures = /*#__PURE__*/ _interop_require_default(require("./processTailwindFeatures")); | ||
const _sharedState = require("./lib/sharedState"); | ||
const _findAtConfigPath = require("./lib/findAtConfigPath"); | ||
function _interop_require_default(obj) { | ||
return obj && obj.__esModule ? obj : { | ||
default: obj | ||
}; | ||
} | ||
module.exports = function tailwindcss(configOrPath) { | ||
return { | ||
postcssPlugin: "tailwindcss", | ||
plugins: [ | ||
_sharedState.env.DEBUG && function(root) { | ||
console.log("\n"); | ||
console.time("JIT TOTAL"); | ||
return root; | ||
}, | ||
async function(root, result) { | ||
var _findAtConfigPath1; | ||
// Use the path for the `@config` directive if it exists, otherwise use the | ||
// path for the file being processed | ||
configOrPath = (_findAtConfigPath1 = (0, _findAtConfigPath.findAtConfigPath)(root, result)) !== null && _findAtConfigPath1 !== void 0 ? _findAtConfigPath1 : configOrPath; | ||
let context = (0, _setupTrackingContext.default)(configOrPath); | ||
if (root.type === "document") { | ||
let roots = root.nodes.filter((node)=>node.type === "root"); | ||
for (const root of roots){ | ||
if (root.type === "root") { | ||
await (0, _processTailwindFeatures.default)(context)(root, result); | ||
} | ||
} | ||
return; | ||
} | ||
await (0, _processTailwindFeatures.default)(context)(root, result); | ||
}, | ||
_sharedState.env.DEBUG && function(root) { | ||
console.timeEnd("JIT TOTAL"); | ||
console.log("\n"); | ||
return root; | ||
} | ||
].filter(Boolean) | ||
}; | ||
}; | ||
module.exports.postcss = true; |
62 changes: 62 additions & 0 deletions
62
packages/tailwindcss-patch/test/fixtures/versions/3.4.7/lib/processTailwindFeatures.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
Object.defineProperty(exports, "default", { | ||
enumerable: true, | ||
get: function() { | ||
return processTailwindFeatures; | ||
} | ||
}); | ||
const _normalizeTailwindDirectives = /*#__PURE__*/ _interop_require_default(require("./lib/normalizeTailwindDirectives")); | ||
const _expandTailwindAtRules = /*#__PURE__*/ _interop_require_default(require("./lib/expandTailwindAtRules")); | ||
const _expandApplyAtRules = /*#__PURE__*/ _interop_require_default(require("./lib/expandApplyAtRules")); | ||
const _evaluateTailwindFunctions = /*#__PURE__*/ _interop_require_default(require("./lib/evaluateTailwindFunctions")); | ||
const _substituteScreenAtRules = /*#__PURE__*/ _interop_require_default(require("./lib/substituteScreenAtRules")); | ||
const _resolveDefaultsAtRules = /*#__PURE__*/ _interop_require_default(require("./lib/resolveDefaultsAtRules")); | ||
const _collapseAdjacentRules = /*#__PURE__*/ _interop_require_default(require("./lib/collapseAdjacentRules")); | ||
const _collapseDuplicateDeclarations = /*#__PURE__*/ _interop_require_default(require("./lib/collapseDuplicateDeclarations")); | ||
const _partitionApplyAtRules = /*#__PURE__*/ _interop_require_default(require("./lib/partitionApplyAtRules")); | ||
const _setupContextUtils = require("./lib/setupContextUtils"); | ||
const _featureFlags = require("./featureFlags"); | ||
function _interop_require_default(obj) { | ||
return obj && obj.__esModule ? obj : { | ||
default: obj | ||
}; | ||
} | ||
function processTailwindFeatures(setupContext) { | ||
return async function(root, result) { | ||
let { tailwindDirectives , applyDirectives } = (0, _normalizeTailwindDirectives.default)(root); | ||
// Partition apply rules that are found in the css | ||
// itself. | ||
(0, _partitionApplyAtRules.default)()(root, result); | ||
let context = setupContext({ | ||
tailwindDirectives, | ||
applyDirectives, | ||
registerDependency (dependency) { | ||
result.messages.push({ | ||
plugin: "tailwindcss", | ||
parent: result.opts.from, | ||
...dependency | ||
}); | ||
}, | ||
createContext (tailwindConfig, changedContent) { | ||
return (0, _setupContextUtils.createContext)(tailwindConfig, changedContent, root); | ||
} | ||
})(root, result); | ||
if (context.tailwindConfig.separator === "-") { | ||
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."); | ||
} | ||
(0, _featureFlags.issueFlagNotices)(context.tailwindConfig); | ||
await (0, _expandTailwindAtRules.default)(context)(root, result); | ||
// Partition apply rules that are generated by | ||
// addComponents, addUtilities and so on. | ||
(0, _partitionApplyAtRules.default)()(root, result); | ||
(0, _expandApplyAtRules.default)(context)(root, result); | ||
(0, _evaluateTailwindFunctions.default)(context)(root, result); | ||
(0, _substituteScreenAtRules.default)(context)(root, result); | ||
(0, _resolveDefaultsAtRules.default)(context)(root, result); | ||
(0, _collapseAdjacentRules.default)(context)(root, result); | ||
(0, _collapseDuplicateDeclarations.default)(context)(root, result); | ||
}; | ||
} |
Oops, something went wrong.