tailwindcss-injector 0.1.1 → 0.1.3
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/dist/postcss.cjs +31 -16
- package/dist/postcss.js +31 -16
- package/package.json +1 -1
package/dist/postcss.cjs
CHANGED
|
@@ -216,11 +216,14 @@ var require_set_value = __commonJS({
|
|
|
216
216
|
// src/postcss.ts
|
|
217
217
|
init_cjs_shims();
|
|
218
218
|
var import_set_value = __toESM(require_set_value(), 1);
|
|
219
|
-
var _process = require('process'); var _process2 = _interopRequireDefault(_process);
|
|
220
219
|
var _postcss = require('postcss'); var _postcss2 = _interopRequireDefault(_postcss);
|
|
221
220
|
var _tailwindcss = require('tailwindcss'); var _tailwindcss2 = _interopRequireDefault(_tailwindcss);
|
|
222
221
|
var _tailwindcssconfig = require('tailwindcss-config');
|
|
223
222
|
|
|
223
|
+
// src/config.ts
|
|
224
|
+
init_cjs_shims();
|
|
225
|
+
var _process = require('process'); var _process2 = _interopRequireDefault(_process);
|
|
226
|
+
|
|
224
227
|
// src/utils.ts
|
|
225
228
|
init_cjs_shims();
|
|
226
229
|
var _crypto = require('crypto'); var _crypto2 = _interopRequireDefault(_crypto);
|
|
@@ -321,6 +324,24 @@ function md5(input) {
|
|
|
321
324
|
return hash.digest("hex");
|
|
322
325
|
}
|
|
323
326
|
|
|
327
|
+
// src/config.ts
|
|
328
|
+
function getDefaultConfig() {
|
|
329
|
+
return {
|
|
330
|
+
filter: () => true,
|
|
331
|
+
config: void 0,
|
|
332
|
+
directiveParams: ["utilities", "components"],
|
|
333
|
+
cwd: _process2.default.cwd(),
|
|
334
|
+
extensions: ["wxml", "js", "ts"]
|
|
335
|
+
};
|
|
336
|
+
}
|
|
337
|
+
function getConfig(options) {
|
|
338
|
+
return defuOverrideArray(options, getDefaultConfig());
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
// src/constants.ts
|
|
342
|
+
init_cjs_shims();
|
|
343
|
+
var postcssPlugin = "postcss-tailwindcss-injector";
|
|
344
|
+
|
|
324
345
|
// src/wxml.ts
|
|
325
346
|
init_cjs_shims();
|
|
326
347
|
|
|
@@ -419,26 +440,19 @@ async function getDepFiles(file) {
|
|
|
419
440
|
|
|
420
441
|
// src/postcss.ts
|
|
421
442
|
var creator = (options) => {
|
|
422
|
-
const { config, filter, directiveParams, cwd, extensions } =
|
|
423
|
-
filter: () => true,
|
|
424
|
-
config: void 0,
|
|
425
|
-
directiveParams: ["utilities", "components"],
|
|
426
|
-
cwd: _process2.default.cwd(),
|
|
427
|
-
extensions: ["wxml", "js", "ts"]
|
|
428
|
-
});
|
|
443
|
+
const { config, filter, directiveParams, cwd, extensions } = getConfig(options);
|
|
429
444
|
const extensionsGlob = `{${extensions.join(",")}}`;
|
|
430
445
|
return {
|
|
431
|
-
postcssPlugin
|
|
446
|
+
postcssPlugin,
|
|
432
447
|
plugins: [
|
|
433
448
|
{
|
|
434
|
-
postcssPlugin:
|
|
449
|
+
postcssPlugin: `${postcssPlugin}:post`,
|
|
435
450
|
async Once(root, helpers) {
|
|
436
451
|
if (filter(_optionalChain([root, 'access', _ => _.source, 'optionalAccess', _2 => _2.input]))) {
|
|
437
|
-
let _root = root;
|
|
438
452
|
for (const params of directiveParams) {
|
|
439
453
|
const node = root.nodes.find((x) => x.type === "atrule" && x.params === params);
|
|
440
454
|
if (!node) {
|
|
441
|
-
|
|
455
|
+
root.prepend(helpers.atRule({ name: "tailwind", params }));
|
|
442
456
|
}
|
|
443
457
|
}
|
|
444
458
|
const cfg = typeof config === "function" ? config(_optionalChain([root, 'access', _3 => _3.source, 'optionalAccess', _4 => _4.input])) : config;
|
|
@@ -464,11 +478,12 @@ var creator = (options) => {
|
|
|
464
478
|
tailwindcssConfig.content.push(`${removeFileExtension(dep)}.${extensionsGlob}`);
|
|
465
479
|
}
|
|
466
480
|
}
|
|
481
|
+
await _postcss2.default.call(void 0, [
|
|
482
|
+
_tailwindcss2.default.call(void 0, tailwindcssConfig)
|
|
483
|
+
]).process(root, {
|
|
484
|
+
from: root.source.input.file
|
|
485
|
+
});
|
|
467
486
|
}
|
|
468
|
-
const { root: newRoot } = await _postcss2.default.call(void 0, [
|
|
469
|
-
_tailwindcss2.default.call(void 0, tailwindcssConfig)
|
|
470
|
-
]).process(_root);
|
|
471
|
-
root.replaceWith(newRoot);
|
|
472
487
|
}
|
|
473
488
|
}
|
|
474
489
|
}
|
package/dist/postcss.js
CHANGED
|
@@ -216,11 +216,14 @@ var require_set_value = __commonJS({
|
|
|
216
216
|
// src/postcss.ts
|
|
217
217
|
init_esm_shims();
|
|
218
218
|
var import_set_value = __toESM(require_set_value(), 1);
|
|
219
|
-
import process from "node:process";
|
|
220
219
|
import postcss from "postcss";
|
|
221
220
|
import tailwindcss from "tailwindcss";
|
|
222
221
|
import { loadConfig } from "tailwindcss-config";
|
|
223
222
|
|
|
223
|
+
// src/config.ts
|
|
224
|
+
init_esm_shims();
|
|
225
|
+
import process from "node:process";
|
|
226
|
+
|
|
224
227
|
// src/utils.ts
|
|
225
228
|
init_esm_shims();
|
|
226
229
|
import crypto from "node:crypto";
|
|
@@ -321,6 +324,24 @@ function md5(input) {
|
|
|
321
324
|
return hash.digest("hex");
|
|
322
325
|
}
|
|
323
326
|
|
|
327
|
+
// src/config.ts
|
|
328
|
+
function getDefaultConfig() {
|
|
329
|
+
return {
|
|
330
|
+
filter: () => true,
|
|
331
|
+
config: void 0,
|
|
332
|
+
directiveParams: ["utilities", "components"],
|
|
333
|
+
cwd: process.cwd(),
|
|
334
|
+
extensions: ["wxml", "js", "ts"]
|
|
335
|
+
};
|
|
336
|
+
}
|
|
337
|
+
function getConfig(options) {
|
|
338
|
+
return defuOverrideArray(options, getDefaultConfig());
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
// src/constants.ts
|
|
342
|
+
init_esm_shims();
|
|
343
|
+
var postcssPlugin = "postcss-tailwindcss-injector";
|
|
344
|
+
|
|
324
345
|
// src/wxml.ts
|
|
325
346
|
init_esm_shims();
|
|
326
347
|
import path2 from "node:path";
|
|
@@ -419,26 +440,19 @@ async function getDepFiles(file) {
|
|
|
419
440
|
|
|
420
441
|
// src/postcss.ts
|
|
421
442
|
var creator = (options) => {
|
|
422
|
-
const { config, filter, directiveParams, cwd, extensions } =
|
|
423
|
-
filter: () => true,
|
|
424
|
-
config: void 0,
|
|
425
|
-
directiveParams: ["utilities", "components"],
|
|
426
|
-
cwd: process.cwd(),
|
|
427
|
-
extensions: ["wxml", "js", "ts"]
|
|
428
|
-
});
|
|
443
|
+
const { config, filter, directiveParams, cwd, extensions } = getConfig(options);
|
|
429
444
|
const extensionsGlob = `{${extensions.join(",")}}`;
|
|
430
445
|
return {
|
|
431
|
-
postcssPlugin
|
|
446
|
+
postcssPlugin,
|
|
432
447
|
plugins: [
|
|
433
448
|
{
|
|
434
|
-
postcssPlugin:
|
|
449
|
+
postcssPlugin: `${postcssPlugin}:post`,
|
|
435
450
|
async Once(root, helpers) {
|
|
436
451
|
if (filter(root.source?.input)) {
|
|
437
|
-
let _root = root;
|
|
438
452
|
for (const params of directiveParams) {
|
|
439
453
|
const node = root.nodes.find((x) => x.type === "atrule" && x.params === params);
|
|
440
454
|
if (!node) {
|
|
441
|
-
|
|
455
|
+
root.prepend(helpers.atRule({ name: "tailwind", params }));
|
|
442
456
|
}
|
|
443
457
|
}
|
|
444
458
|
const cfg = typeof config === "function" ? config(root.source?.input) : config;
|
|
@@ -464,11 +478,12 @@ var creator = (options) => {
|
|
|
464
478
|
tailwindcssConfig.content.push(`${removeFileExtension(dep)}.${extensionsGlob}`);
|
|
465
479
|
}
|
|
466
480
|
}
|
|
481
|
+
await postcss([
|
|
482
|
+
tailwindcss(tailwindcssConfig)
|
|
483
|
+
]).process(root, {
|
|
484
|
+
from: root.source.input.file
|
|
485
|
+
});
|
|
467
486
|
}
|
|
468
|
-
const { root: newRoot } = await postcss([
|
|
469
|
-
tailwindcss(tailwindcssConfig)
|
|
470
|
-
]).process(_root);
|
|
471
|
-
root.replaceWith(newRoot);
|
|
472
487
|
}
|
|
473
488
|
}
|
|
474
489
|
}
|