weapp-tailwindcss 2.9.3 → 2.10.0

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.
Files changed (39) hide show
  1. package/README.md +1 -1
  2. package/dist/cli.js +5 -4
  3. package/dist/cli.mjs +5 -4
  4. package/dist/constants--OCCPvZ8.mjs +36 -0
  5. package/dist/constants-9jsALkux.js +42 -0
  6. package/dist/css-macro/constants.d.ts +14 -0
  7. package/dist/css-macro/index.d.ts +15 -0
  8. package/dist/css-macro/index.js +36 -0
  9. package/dist/css-macro/index.mjs +30 -0
  10. package/dist/css-macro/postcss.d.ts +5 -0
  11. package/dist/css-macro/postcss.js +35 -0
  12. package/dist/css-macro/postcss.mjs +33 -0
  13. package/dist/defaults.js +1 -1
  14. package/dist/defaults.mjs +1 -1
  15. package/dist/defu-R3SAEzGq.mjs +43 -0
  16. package/dist/defu-d2wgbAKv.js +45 -0
  17. package/dist/gulp.js +5 -4
  18. package/dist/gulp.mjs +5 -4
  19. package/dist/index.js +6 -5
  20. package/dist/index.mjs +6 -5
  21. package/dist/{options-63407615.mjs → options-1ejnE5kK.mjs} +3 -44
  22. package/dist/{options-09ebba08.js → options-jeQuZCU1.js} +7 -48
  23. package/dist/{postcss-8d7f67b4.js → postcss-03jfy6ZA.js} +1 -1
  24. package/dist/{postcss-55ed4d42.mjs → postcss-GEOOjC-4.mjs} +1 -1
  25. package/dist/postcss.js +2 -2
  26. package/dist/postcss.mjs +2 -2
  27. package/dist/replace.js +1 -1
  28. package/dist/replace.mjs +1 -1
  29. package/dist/vite.js +6 -5
  30. package/dist/vite.mjs +6 -5
  31. package/dist/webpack.js +6 -5
  32. package/dist/webpack.mjs +6 -5
  33. package/package.json +34 -24
  34. /package/dist/{defaults-b7341550.js → defaults-0O-zKoXE.js} +0 -0
  35. /package/dist/{defaults-d2c66d23.mjs → defaults-dz6xGhOP.mjs} +0 -0
  36. /package/dist/{index-84c7aa87.mjs → index-06BoOZig.mjs} +0 -0
  37. /package/dist/{index-aede98ce.js → index-z25r_Htj.js} +0 -0
  38. /package/dist/{shared-283aac78.mjs → shared-S0v7ZvWs.mjs} +0 -0
  39. /package/dist/{shared-8b9be5f0.js → shared-nXoJWFdz.js} +0 -0
package/README.md CHANGED
@@ -125,7 +125,7 @@
125
125
 
126
126
  ### tailwindcss plugin / util
127
127
 
128
- - [css-to-tailwindcss-plugin](./packages/css-to-tailwindcss-plugin/) transform your `css/scss` to `tailwindcss plugin`
128
+ - [css-to-tailwindcss-plugin](https://github.com/sonofmagic/icestack/tree/main/packages/css-to-tailwindcss-plugin) transform your `css/scss` to `tailwindcss plugin`
129
129
 
130
130
  - [weapp-tailwindcss-children](https://github.com/sonofmagic/weapp-tailwindcss-children)
131
131
 
package/dist/cli.js CHANGED
@@ -1,21 +1,22 @@
1
1
  'use strict';
2
2
 
3
- var options = require('./options-09ebba08.js');
3
+ var options = require('./options-jeQuZCU1.js');
4
4
  require('micromatch');
5
5
  require('magic-string');
6
6
  require('./replace.js');
7
7
  require('@weapp-core/escape');
8
8
  require('@ast-core/escape');
9
- require('./shared-8b9be5f0.js');
9
+ require('./shared-nXoJWFdz.js');
10
10
  require('@weapp-core/regex');
11
11
  require('@babel/generator');
12
12
  require('@babel/parser');
13
13
  require('@babel/traverse');
14
- require('./defaults-b7341550.js');
14
+ require('./defu-d2wgbAKv.js');
15
+ require('./defaults-0O-zKoXE.js');
15
16
  require('@babel/types');
16
17
  require('htmlparser2');
17
18
  require('postcss');
18
- require('./postcss-8d7f67b4.js');
19
+ require('./postcss-03jfy6ZA.js');
19
20
  require('postcss-selector-parser');
20
21
  require('@csstools/postcss-is-pseudo-class');
21
22
  require('node:path');
package/dist/cli.mjs CHANGED
@@ -1,19 +1,20 @@
1
- import { g as getOptions, c as createPatch } from './options-63407615.mjs';
1
+ import { g as getOptions, c as createPatch } from './options-1ejnE5kK.mjs';
2
2
  import 'micromatch';
3
3
  import 'magic-string';
4
4
  import './replace.mjs';
5
5
  import '@weapp-core/escape';
6
6
  import '@ast-core/escape';
7
- import './shared-283aac78.mjs';
7
+ import './shared-S0v7ZvWs.mjs';
8
8
  import '@weapp-core/regex';
9
9
  import '@babel/generator';
10
10
  import '@babel/parser';
11
11
  import '@babel/traverse';
12
- import './defaults-d2c66d23.mjs';
12
+ import './defu-R3SAEzGq.mjs';
13
+ import './defaults-dz6xGhOP.mjs';
13
14
  import '@babel/types';
14
15
  import 'htmlparser2';
15
16
  import 'postcss';
16
- import './postcss-55ed4d42.mjs';
17
+ import './postcss-GEOOjC-4.mjs';
17
18
  import 'postcss-selector-parser';
18
19
  import '@csstools/postcss-is-pseudo-class';
19
20
  import 'node:path';
@@ -0,0 +1,36 @@
1
+ const queryKey = 'weapp-tw-platform';
2
+ function createMediaQuery(value) {
3
+ return `@media (${queryKey}:${value}){&}`;
4
+ }
5
+ function createNegativeMediaQuery(value) {
6
+ return `@media not screen and (${queryKey}:${value}){&}`;
7
+ }
8
+ function normalComment(text) {
9
+ if (typeof text === 'string') {
10
+ return text.replaceAll(/(?<!\\)_/g, ' ');
11
+ }
12
+ return text;
13
+ }
14
+ function ifdef(text) {
15
+ return {
16
+ start: `#ifdef ${normalComment(text)} `,
17
+ end: `#endif`
18
+ };
19
+ }
20
+ function ifndef(text) {
21
+ return {
22
+ start: `#ifndef ${normalComment(text)} `,
23
+ end: `#endif`
24
+ };
25
+ }
26
+ function matchCustomPropertyFromValue(str, cb) {
27
+ let arr;
28
+ let index = 0;
29
+ const regex = new RegExp('\\(\\s*' + queryKey + '\\s*:([^)]*)\\)', 'g');
30
+ while ((arr = regex.exec(str)) !== null) {
31
+ cb(arr, index);
32
+ index++;
33
+ }
34
+ }
35
+
36
+ export { createNegativeMediaQuery as a, ifdef as b, createMediaQuery as c, ifndef as i, matchCustomPropertyFromValue as m };
@@ -0,0 +1,42 @@
1
+ 'use strict';
2
+
3
+ const queryKey = 'weapp-tw-platform';
4
+ function createMediaQuery(value) {
5
+ return `@media (${queryKey}:${value}){&}`;
6
+ }
7
+ function createNegativeMediaQuery(value) {
8
+ return `@media not screen and (${queryKey}:${value}){&}`;
9
+ }
10
+ function normalComment(text) {
11
+ if (typeof text === 'string') {
12
+ return text.replaceAll(/(?<!\\)_/g, ' ');
13
+ }
14
+ return text;
15
+ }
16
+ function ifdef(text) {
17
+ return {
18
+ start: `#ifdef ${normalComment(text)} `,
19
+ end: `#endif`
20
+ };
21
+ }
22
+ function ifndef(text) {
23
+ return {
24
+ start: `#ifndef ${normalComment(text)} `,
25
+ end: `#endif`
26
+ };
27
+ }
28
+ function matchCustomPropertyFromValue(str, cb) {
29
+ let arr;
30
+ let index = 0;
31
+ const regex = new RegExp('\\(\\s*' + queryKey + '\\s*:([^)]*)\\)', 'g');
32
+ while ((arr = regex.exec(str)) !== null) {
33
+ cb(arr, index);
34
+ index++;
35
+ }
36
+ }
37
+
38
+ exports.createMediaQuery = createMediaQuery;
39
+ exports.createNegativeMediaQuery = createNegativeMediaQuery;
40
+ exports.ifdef = ifdef;
41
+ exports.ifndef = ifndef;
42
+ exports.matchCustomPropertyFromValue = matchCustomPropertyFromValue;
@@ -0,0 +1,14 @@
1
+ export declare const uniAppPlatform: string[];
2
+ export declare const queryKey = "weapp-tw-platform";
3
+ export declare function createMediaQuery(value: string): string;
4
+ export declare function createNegativeMediaQuery(value: string): string;
5
+ export declare function normalComment(text: string): string;
6
+ export declare function ifdef(text: string): {
7
+ start: string;
8
+ end: string;
9
+ };
10
+ export declare function ifndef(text: string): {
11
+ start: string;
12
+ end: string;
13
+ };
14
+ export declare function matchCustomPropertyFromValue(str: string, cb: (arr: RegExpExecArray, index: number) => void): void;
@@ -0,0 +1,15 @@
1
+ export interface Options {
2
+ variantsMap?: Record<string, string | {
3
+ value: string;
4
+ negative?: boolean;
5
+ }>;
6
+ dynamic?: boolean;
7
+ }
8
+ declare const _default: {
9
+ (options: Options): {
10
+ handler: import("tailwindcss/types/config").PluginCreator;
11
+ config?: Partial<import("tailwindcss").Config> | undefined;
12
+ };
13
+ __isOptionsFunction: true;
14
+ };
15
+ export default _default;
@@ -0,0 +1,36 @@
1
+ 'use strict';
2
+
3
+ var plugin = require('tailwindcss/plugin');
4
+ var constants = require('../constants-9jsALkux.js');
5
+ var defu = require('../defu-d2wgbAKv.js');
6
+
7
+ function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
8
+
9
+ var plugin__default = /*#__PURE__*/_interopDefaultCompat(plugin);
10
+
11
+ var index = plugin__default["default"].withOptions((options) => {
12
+ const { dynamic: dynamicMode, variantsMap } = defu.defu(options, {
13
+ dynamic: true,
14
+ variantsMap: {}
15
+ });
16
+ return ({ matchVariant, addVariant }) => {
17
+ if (dynamicMode) {
18
+ matchVariant('ifdef', (value) => {
19
+ return constants.createMediaQuery(value);
20
+ });
21
+ matchVariant('ifndef', (value) => {
22
+ return constants.createNegativeMediaQuery(value);
23
+ });
24
+ }
25
+ for (const [name, obj] of Object.entries(variantsMap)) {
26
+ if (typeof obj === 'string') {
27
+ addVariant(name, constants.createMediaQuery(obj));
28
+ }
29
+ else {
30
+ addVariant(name, obj.negative ? constants.createNegativeMediaQuery(obj.value) : constants.createMediaQuery(obj.value));
31
+ }
32
+ }
33
+ };
34
+ });
35
+
36
+ module.exports = index;
@@ -0,0 +1,30 @@
1
+ import plugin from 'tailwindcss/plugin';
2
+ import { c as createMediaQuery, a as createNegativeMediaQuery } from '../constants--OCCPvZ8.mjs';
3
+ import { d as defu } from '../defu-R3SAEzGq.mjs';
4
+
5
+ var index = plugin.withOptions((options) => {
6
+ const { dynamic: dynamicMode, variantsMap } = defu(options, {
7
+ dynamic: true,
8
+ variantsMap: {}
9
+ });
10
+ return ({ matchVariant, addVariant }) => {
11
+ if (dynamicMode) {
12
+ matchVariant('ifdef', (value) => {
13
+ return createMediaQuery(value);
14
+ });
15
+ matchVariant('ifndef', (value) => {
16
+ return createNegativeMediaQuery(value);
17
+ });
18
+ }
19
+ for (const [name, obj] of Object.entries(variantsMap)) {
20
+ if (typeof obj === 'string') {
21
+ addVariant(name, createMediaQuery(obj));
22
+ }
23
+ else {
24
+ addVariant(name, obj.negative ? createNegativeMediaQuery(obj.value) : createMediaQuery(obj.value));
25
+ }
26
+ }
27
+ };
28
+ });
29
+
30
+ export { index as default };
@@ -0,0 +1,5 @@
1
+ import type { PluginCreator } from 'postcss';
2
+ export interface Options {
3
+ }
4
+ declare const creator: PluginCreator<Options>;
5
+ export default creator;
@@ -0,0 +1,35 @@
1
+ 'use strict';
2
+
3
+ var constants = require('../constants-9jsALkux.js');
4
+
5
+ const creator = () => {
6
+ return {
7
+ postcssPlugin: 'postcss-weapp-tw-css-macro-plugin',
8
+ AtRuleExit(atRule, helper) {
9
+ if (atRule.name === 'media') {
10
+ const values = [];
11
+ constants.matchCustomPropertyFromValue(atRule.params, (arr) => {
12
+ values.push(arr[1]);
13
+ });
14
+ if (values.length > 0) {
15
+ const isNegative = atRule.params.includes('not');
16
+ const text = values.join(' ');
17
+ const comment = isNegative ? constants.ifndef(text) : constants.ifdef(text);
18
+ atRule.after([
19
+ helper.comment({
20
+ text: comment.start
21
+ }),
22
+ ...atRule.nodes,
23
+ helper.comment({
24
+ text: comment.end
25
+ })
26
+ ]);
27
+ atRule.remove();
28
+ }
29
+ }
30
+ }
31
+ };
32
+ };
33
+ creator.postcss = true;
34
+
35
+ module.exports = creator;
@@ -0,0 +1,33 @@
1
+ import { m as matchCustomPropertyFromValue, i as ifndef, b as ifdef } from '../constants--OCCPvZ8.mjs';
2
+
3
+ const creator = () => {
4
+ return {
5
+ postcssPlugin: 'postcss-weapp-tw-css-macro-plugin',
6
+ AtRuleExit(atRule, helper) {
7
+ if (atRule.name === 'media') {
8
+ const values = [];
9
+ matchCustomPropertyFromValue(atRule.params, (arr) => {
10
+ values.push(arr[1]);
11
+ });
12
+ if (values.length > 0) {
13
+ const isNegative = atRule.params.includes('not');
14
+ const text = values.join(' ');
15
+ const comment = isNegative ? ifndef(text) : ifdef(text);
16
+ atRule.after([
17
+ helper.comment({
18
+ text: comment.start
19
+ }),
20
+ ...atRule.nodes,
21
+ helper.comment({
22
+ text: comment.end
23
+ })
24
+ ]);
25
+ atRule.remove();
26
+ }
27
+ }
28
+ }
29
+ };
30
+ };
31
+ creator.postcss = true;
32
+
33
+ export { creator as default };
package/dist/defaults.js CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var defaults = require('./defaults-b7341550.js');
5
+ var defaults = require('./defaults-0O-zKoXE.js');
6
6
  require('@weapp-core/escape');
7
7
  require('@ast-core/escape');
8
8
 
package/dist/defaults.mjs CHANGED
@@ -1,3 +1,3 @@
1
- export { d as defaultOptions } from './defaults-d2c66d23.mjs';
1
+ export { d as defaultOptions } from './defaults-dz6xGhOP.mjs';
2
2
  import '@weapp-core/escape';
3
3
  import '@ast-core/escape';
@@ -0,0 +1,43 @@
1
+ function isObject(value) {
2
+ return value !== null && typeof value === "object";
3
+ }
4
+ function _defu(baseObject, defaults, namespace = ".", merger) {
5
+ if (!isObject(defaults)) {
6
+ return _defu(baseObject, {}, namespace, merger);
7
+ }
8
+ const object = Object.assign({}, defaults);
9
+ for (const key in baseObject) {
10
+ if (key === "__proto__" || key === "constructor") {
11
+ continue;
12
+ }
13
+ const value = baseObject[key];
14
+ if (value === null || value === void 0) {
15
+ continue;
16
+ }
17
+ if (merger && merger(object, key, value, namespace)) {
18
+ continue;
19
+ }
20
+ if (Array.isArray(value) && Array.isArray(object[key])) {
21
+ object[key] = [...value, ...object[key]];
22
+ } else if (isObject(value) && isObject(object[key])) {
23
+ object[key] = _defu(
24
+ value,
25
+ object[key],
26
+ (namespace ? `${namespace}.` : "") + key.toString(),
27
+ merger
28
+ );
29
+ } else {
30
+ object[key] = value;
31
+ }
32
+ }
33
+ return object;
34
+ }
35
+ function createDefu(merger) {
36
+ return (...arguments_) => (
37
+ // eslint-disable-next-line unicorn/no-array-reduce
38
+ arguments_.reduce((p, c) => _defu(p, c, "", merger), {})
39
+ );
40
+ }
41
+ const defu = createDefu();
42
+
43
+ export { defu as d };
@@ -0,0 +1,45 @@
1
+ 'use strict';
2
+
3
+ function isObject(value) {
4
+ return value !== null && typeof value === "object";
5
+ }
6
+ function _defu(baseObject, defaults, namespace = ".", merger) {
7
+ if (!isObject(defaults)) {
8
+ return _defu(baseObject, {}, namespace, merger);
9
+ }
10
+ const object = Object.assign({}, defaults);
11
+ for (const key in baseObject) {
12
+ if (key === "__proto__" || key === "constructor") {
13
+ continue;
14
+ }
15
+ const value = baseObject[key];
16
+ if (value === null || value === void 0) {
17
+ continue;
18
+ }
19
+ if (merger && merger(object, key, value, namespace)) {
20
+ continue;
21
+ }
22
+ if (Array.isArray(value) && Array.isArray(object[key])) {
23
+ object[key] = [...value, ...object[key]];
24
+ } else if (isObject(value) && isObject(object[key])) {
25
+ object[key] = _defu(
26
+ value,
27
+ object[key],
28
+ (namespace ? `${namespace}.` : "") + key.toString(),
29
+ merger
30
+ );
31
+ } else {
32
+ object[key] = value;
33
+ }
34
+ }
35
+ return object;
36
+ }
37
+ function createDefu(merger) {
38
+ return (...arguments_) => (
39
+ // eslint-disable-next-line unicorn/no-array-reduce
40
+ arguments_.reduce((p, c) => _defu(p, c, "", merger), {})
41
+ );
42
+ }
43
+ const defu = createDefu();
44
+
45
+ exports.defu = defu;
package/dist/gulp.js CHANGED
@@ -2,23 +2,24 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var options = require('./options-09ebba08.js');
5
+ var options = require('./options-jeQuZCU1.js');
6
6
  var stream = require('node:stream');
7
7
  require('micromatch');
8
8
  require('magic-string');
9
9
  require('./replace.js');
10
10
  require('@weapp-core/escape');
11
11
  require('@ast-core/escape');
12
- require('./shared-8b9be5f0.js');
12
+ require('./shared-nXoJWFdz.js');
13
13
  require('@weapp-core/regex');
14
14
  require('@babel/generator');
15
15
  require('@babel/parser');
16
16
  require('@babel/traverse');
17
- require('./defaults-b7341550.js');
17
+ require('./defu-d2wgbAKv.js');
18
+ require('./defaults-0O-zKoXE.js');
18
19
  require('@babel/types');
19
20
  require('htmlparser2');
20
21
  require('postcss');
21
- require('./postcss-8d7f67b4.js');
22
+ require('./postcss-03jfy6ZA.js');
22
23
  require('postcss-selector-parser');
23
24
  require('@csstools/postcss-is-pseudo-class');
24
25
  require('node:path');
package/dist/gulp.mjs CHANGED
@@ -1,20 +1,21 @@
1
- import { g as getOptions, a as createTailwindcssPatcher, _ as __awaiter } from './options-63407615.mjs';
1
+ import { g as getOptions, a as createTailwindcssPatcher, _ as __awaiter } from './options-1ejnE5kK.mjs';
2
2
  import stream from 'node:stream';
3
3
  import 'micromatch';
4
4
  import 'magic-string';
5
5
  import './replace.mjs';
6
6
  import '@weapp-core/escape';
7
7
  import '@ast-core/escape';
8
- import './shared-283aac78.mjs';
8
+ import './shared-S0v7ZvWs.mjs';
9
9
  import '@weapp-core/regex';
10
10
  import '@babel/generator';
11
11
  import '@babel/parser';
12
12
  import '@babel/traverse';
13
- import './defaults-d2c66d23.mjs';
13
+ import './defu-R3SAEzGq.mjs';
14
+ import './defaults-dz6xGhOP.mjs';
14
15
  import '@babel/types';
15
16
  import 'htmlparser2';
16
17
  import 'postcss';
17
- import './postcss-55ed4d42.mjs';
18
+ import './postcss-GEOOjC-4.mjs';
18
19
  import 'postcss-selector-parser';
19
20
  import '@csstools/postcss-is-pseudo-class';
20
21
  import 'node:path';
package/dist/index.js CHANGED
@@ -5,22 +5,23 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
  var webpack = require('./webpack.js');
6
6
  var vite = require('./vite.js');
7
7
  var gulp = require('./gulp.js');
8
- require('./options-09ebba08.js');
8
+ require('./options-jeQuZCU1.js');
9
9
  require('micromatch');
10
10
  require('magic-string');
11
11
  require('./replace.js');
12
12
  require('@weapp-core/escape');
13
13
  require('@ast-core/escape');
14
- require('./shared-8b9be5f0.js');
14
+ require('./shared-nXoJWFdz.js');
15
15
  require('@weapp-core/regex');
16
16
  require('@babel/generator');
17
17
  require('@babel/parser');
18
18
  require('@babel/traverse');
19
- require('./defaults-b7341550.js');
19
+ require('./defu-d2wgbAKv.js');
20
+ require('./defaults-0O-zKoXE.js');
20
21
  require('@babel/types');
21
22
  require('htmlparser2');
22
23
  require('postcss');
23
- require('./postcss-8d7f67b4.js');
24
+ require('./postcss-03jfy6ZA.js');
24
25
  require('postcss-selector-parser');
25
26
  require('@csstools/postcss-is-pseudo-class');
26
27
  require('node:path');
@@ -30,7 +31,7 @@ require('tailwindcss-patch');
30
31
  require('@tailwindcss-mangle/shared');
31
32
  require('lru-cache');
32
33
  require('md5');
33
- require('./index-aede98ce.js');
34
+ require('./index-z25r_Htj.js');
34
35
  require('debug');
35
36
  require('node:stream');
36
37
 
package/dist/index.mjs CHANGED
@@ -1,22 +1,23 @@
1
1
  export { UnifiedWebpackPluginV5 } from './webpack.mjs';
2
2
  export { UnifiedViteWeappTailwindcssPlugin } from './vite.mjs';
3
3
  export { createPlugins } from './gulp.mjs';
4
- import './options-63407615.mjs';
4
+ import './options-1ejnE5kK.mjs';
5
5
  import 'micromatch';
6
6
  import 'magic-string';
7
7
  import './replace.mjs';
8
8
  import '@weapp-core/escape';
9
9
  import '@ast-core/escape';
10
- import './shared-283aac78.mjs';
10
+ import './shared-S0v7ZvWs.mjs';
11
11
  import '@weapp-core/regex';
12
12
  import '@babel/generator';
13
13
  import '@babel/parser';
14
14
  import '@babel/traverse';
15
- import './defaults-d2c66d23.mjs';
15
+ import './defu-R3SAEzGq.mjs';
16
+ import './defaults-dz6xGhOP.mjs';
16
17
  import '@babel/types';
17
18
  import 'htmlparser2';
18
19
  import 'postcss';
19
- import './postcss-55ed4d42.mjs';
20
+ import './postcss-GEOOjC-4.mjs';
20
21
  import 'postcss-selector-parser';
21
22
  import '@csstools/postcss-is-pseudo-class';
22
23
  import 'node:path';
@@ -26,6 +27,6 @@ import 'tailwindcss-patch';
26
27
  import '@tailwindcss-mangle/shared';
27
28
  import 'lru-cache';
28
29
  import 'md5';
29
- import './index-84c7aa87.mjs';
30
+ import './index-06BoOZig.mjs';
30
31
  import 'debug';
31
32
  import 'node:stream';
@@ -7,11 +7,12 @@ import { jsStringEscape } from '@ast-core/escape';
7
7
  import generate from '@babel/generator';
8
8
  import { parse, parseExpression } from '@babel/parser';
9
9
  import traverse from '@babel/traverse';
10
- import { n as noop, d as defaultOptions, i as isMap } from './defaults-d2c66d23.mjs';
10
+ import { d as defu } from './defu-R3SAEzGq.mjs';
11
+ import { n as noop, d as defaultOptions, i as isMap } from './defaults-dz6xGhOP.mjs';
11
12
  import * as t from '@babel/types';
12
13
  import { Parser } from 'htmlparser2';
13
14
  import postcss from 'postcss';
14
- import { p as postcssWeappTailwindcss } from './postcss-55ed4d42.mjs';
15
+ import { p as postcssWeappTailwindcss } from './postcss-GEOOjC-4.mjs';
15
16
  import postcssIsPseudoClass from '@csstools/postcss-is-pseudo-class';
16
17
  import path from 'node:path';
17
18
  import fs from 'node:fs';
@@ -127,48 +128,6 @@ function replaceHandleValue(str, node, options, ms, offset = 0, needEscaped = fa
127
128
 
128
129
  const isProd = () => process.env.NODE_ENV === 'production';
129
130
 
130
- function isObject(value) {
131
- return value !== null && typeof value === "object";
132
- }
133
- function _defu(baseObject, defaults, namespace = ".", merger) {
134
- if (!isObject(defaults)) {
135
- return _defu(baseObject, {}, namespace, merger);
136
- }
137
- const object = Object.assign({}, defaults);
138
- for (const key in baseObject) {
139
- if (key === "__proto__" || key === "constructor") {
140
- continue;
141
- }
142
- const value = baseObject[key];
143
- if (value === null || value === void 0) {
144
- continue;
145
- }
146
- if (merger && merger(object, key, value, namespace)) {
147
- continue;
148
- }
149
- if (Array.isArray(value) && Array.isArray(object[key])) {
150
- object[key] = [...value, ...object[key]];
151
- } else if (isObject(value) && isObject(object[key])) {
152
- object[key] = _defu(
153
- value,
154
- object[key],
155
- (namespace ? `${namespace}.` : "") + key.toString(),
156
- merger
157
- );
158
- } else {
159
- object[key] = value;
160
- }
161
- }
162
- return object;
163
- }
164
- function createDefu(merger) {
165
- return (...arguments_) => (
166
- // eslint-disable-next-line unicorn/no-array-reduce
167
- arguments_.reduce((p, c) => _defu(p, c, "", merger), {})
168
- );
169
- }
170
- const defu = createDefu();
171
-
172
131
  function isEvalPath(p) {
173
132
  if (p.isCallExpression()) {
174
133
  const calleePath = p.get('callee');
@@ -9,11 +9,12 @@ var escape = require('@ast-core/escape');
9
9
  var generate = require('@babel/generator');
10
10
  var parser = require('@babel/parser');
11
11
  var traverse = require('@babel/traverse');
12
- var defaults = require('./defaults-b7341550.js');
12
+ var defu = require('./defu-d2wgbAKv.js');
13
+ var defaults = require('./defaults-0O-zKoXE.js');
13
14
  var t = require('@babel/types');
14
15
  var htmlparser2 = require('htmlparser2');
15
16
  var postcss = require('postcss');
16
- var postcss$1 = require('./postcss-8d7f67b4.js');
17
+ var postcss$1 = require('./postcss-03jfy6ZA.js');
17
18
  var postcssIsPseudoClass = require('@csstools/postcss-is-pseudo-class');
18
19
  var path = require('node:path');
19
20
  var fs = require('node:fs');
@@ -159,48 +160,6 @@ function replaceHandleValue(str, node, options, ms, offset = 0, needEscaped = fa
159
160
 
160
161
  const isProd = () => process.env.NODE_ENV === 'production';
161
162
 
162
- function isObject(value) {
163
- return value !== null && typeof value === "object";
164
- }
165
- function _defu(baseObject, defaults, namespace = ".", merger) {
166
- if (!isObject(defaults)) {
167
- return _defu(baseObject, {}, namespace, merger);
168
- }
169
- const object = Object.assign({}, defaults);
170
- for (const key in baseObject) {
171
- if (key === "__proto__" || key === "constructor") {
172
- continue;
173
- }
174
- const value = baseObject[key];
175
- if (value === null || value === void 0) {
176
- continue;
177
- }
178
- if (merger && merger(object, key, value, namespace)) {
179
- continue;
180
- }
181
- if (Array.isArray(value) && Array.isArray(object[key])) {
182
- object[key] = [...value, ...object[key]];
183
- } else if (isObject(value) && isObject(object[key])) {
184
- object[key] = _defu(
185
- value,
186
- object[key],
187
- (namespace ? `${namespace}.` : "") + key.toString(),
188
- merger
189
- );
190
- } else {
191
- object[key] = value;
192
- }
193
- }
194
- return object;
195
- }
196
- function createDefu(merger) {
197
- return (...arguments_) => (
198
- // eslint-disable-next-line unicorn/no-array-reduce
199
- arguments_.reduce((p, c) => _defu(p, c, "", merger), {})
200
- );
201
- }
202
- const defu = createDefu();
203
-
204
163
  function isEvalPath(p) {
205
164
  if (p.isCallExpression()) {
206
165
  const calleePath = p.get('callee');
@@ -344,7 +303,7 @@ function jsHandler(rawSource, options) {
344
303
  function createJsHandler(options) {
345
304
  const { mangleContext, arbitraryValues, minifiedJs, escapeMap, jsPreserveClass, strategy, generateMap } = options;
346
305
  return (rawSource, set, options) => {
347
- const opts = defu(options, {
306
+ const opts = defu.defu(options, {
348
307
  classNameSet: set,
349
308
  minifiedJs,
350
309
  escapeMap,
@@ -518,7 +477,7 @@ function customTemplateHandler(rawSource, options) {
518
477
  }
519
478
  function createTemplateHandler(options = {}) {
520
479
  return (rawSource, opt = {}) => {
521
- return customTemplateHandler(rawSource, defu(opt, options));
480
+ return customTemplateHandler(rawSource, defu.defu(opt, options));
522
481
  };
523
482
  }
524
483
 
@@ -531,7 +490,7 @@ function styleHandler(rawSource, options) {
531
490
  }
532
491
  function createStyleHandler(options) {
533
492
  return (rawSource, opt) => {
534
- return styleHandler(rawSource, defu(opt, options));
493
+ return styleHandler(rawSource, defu.defu(opt, options));
535
494
  };
536
495
  }
537
496
 
@@ -826,7 +785,7 @@ function getOptions(options = {}) {
826
785
  normalizeMatcher(options, 'jsMatcher');
827
786
  normalizeMatcher(options, 'wxsMatcher');
828
787
  normalizeMatcher(options, 'mainCssChunkMatcher');
829
- const result = defu(options, defaults.defaultOptions, {
788
+ const result = defu.defu(options, defaults.defaultOptions, {
830
789
  minifiedJs: isProd()
831
790
  });
832
791
  const { cssPreflight, customRuleCallback, cssPreflightRange, replaceUniversalSelectorWith, customAttributes, customReplaceDictionary, supportCustomLengthUnitsPatch, arbitraryValues, cssChildCombinatorReplaceValue, inlineWxs, injectAdditionalCssVarScope, jsPreserveClass, disabledDefaultTemplateHandler, jsEscapeStrategy, cssSelectorReplacement } = result;
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  var selectorParser = require('postcss-selector-parser');
4
- var shared = require('./shared-8b9be5f0.js');
4
+ var shared = require('./shared-nXoJWFdz.js');
5
5
  var postcss = require('postcss');
6
6
  require('@csstools/postcss-is-pseudo-class');
7
7
 
@@ -1,5 +1,5 @@
1
1
  import selectorParser from 'postcss-selector-parser';
2
- import { i as internalCssSelectorReplacer } from './shared-283aac78.mjs';
2
+ import { i as internalCssSelectorReplacer } from './shared-S0v7ZvWs.mjs';
3
3
  import { Declaration, Rule } from 'postcss';
4
4
  import '@csstools/postcss-is-pseudo-class';
5
5
 
package/dist/postcss.js CHANGED
@@ -2,10 +2,10 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var postcss = require('./postcss-8d7f67b4.js');
5
+ var postcss = require('./postcss-03jfy6ZA.js');
6
6
  var postcssIsPseudoClass = require('@csstools/postcss-is-pseudo-class');
7
7
  require('postcss-selector-parser');
8
- require('./shared-8b9be5f0.js');
8
+ require('./shared-nXoJWFdz.js');
9
9
  require('@weapp-core/escape');
10
10
  require('@ast-core/escape');
11
11
  require('postcss');
package/dist/postcss.mjs CHANGED
@@ -1,7 +1,7 @@
1
- export { p as postcssWeappTailwindcss } from './postcss-55ed4d42.mjs';
1
+ export { p as postcssWeappTailwindcss } from './postcss-GEOOjC-4.mjs';
2
2
  export { default as postcssIsPseudoClass } from '@csstools/postcss-is-pseudo-class';
3
3
  import 'postcss-selector-parser';
4
- import './shared-283aac78.mjs';
4
+ import './shared-S0v7ZvWs.mjs';
5
5
  import '@weapp-core/escape';
6
6
  import '@ast-core/escape';
7
7
  import 'postcss';
package/dist/replace.js CHANGED
@@ -4,7 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var escape = require('@weapp-core/escape');
6
6
  require('@ast-core/escape');
7
- var shared = require('./shared-8b9be5f0.js');
7
+ var shared = require('./shared-nXoJWFdz.js');
8
8
 
9
9
  function replaceWxml(original, options = {
10
10
  keepEOL: false,
package/dist/replace.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  import { escape, SimpleMappingChars2String } from '@weapp-core/escape';
2
2
  export { MappingChars2String, MappingChars2StringEntries, SYMBOL_TABLE, SimpleMappingChars2String, SimpleMappingChars2StringEntries } from '@weapp-core/escape';
3
3
  import '@ast-core/escape';
4
- export { i as replaceCss } from './shared-283aac78.mjs';
4
+ export { i as replaceCss } from './shared-S0v7ZvWs.mjs';
5
5
 
6
6
  function replaceWxml(original, options = {
7
7
  keepEOL: false,
package/dist/vite.js CHANGED
@@ -2,20 +2,21 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var options = require('./options-09ebba08.js');
6
- var postcss = require('./postcss-8d7f67b4.js');
7
- var defaults = require('./defaults-b7341550.js');
8
- var index = require('./index-aede98ce.js');
5
+ var options = require('./options-jeQuZCU1.js');
6
+ var postcss = require('./postcss-03jfy6ZA.js');
7
+ var defaults = require('./defaults-0O-zKoXE.js');
8
+ var index = require('./index-z25r_Htj.js');
9
9
  require('micromatch');
10
10
  require('magic-string');
11
11
  require('./replace.js');
12
12
  require('@weapp-core/escape');
13
13
  require('@ast-core/escape');
14
- require('./shared-8b9be5f0.js');
14
+ require('./shared-nXoJWFdz.js');
15
15
  require('@weapp-core/regex');
16
16
  require('@babel/generator');
17
17
  require('@babel/parser');
18
18
  require('@babel/traverse');
19
+ require('./defu-d2wgbAKv.js');
19
20
  require('@babel/types');
20
21
  require('htmlparser2');
21
22
  require('postcss');
package/dist/vite.mjs CHANGED
@@ -1,17 +1,18 @@
1
- import { g as getOptions, a as createTailwindcssPatcher, _ as __awaiter } from './options-63407615.mjs';
2
- import { v as vitePluginName } from './postcss-55ed4d42.mjs';
3
- import { g as getGroupedEntries } from './defaults-d2c66d23.mjs';
4
- import { c as createDebug } from './index-84c7aa87.mjs';
1
+ import { g as getOptions, a as createTailwindcssPatcher, _ as __awaiter } from './options-1ejnE5kK.mjs';
2
+ import { v as vitePluginName } from './postcss-GEOOjC-4.mjs';
3
+ import { g as getGroupedEntries } from './defaults-dz6xGhOP.mjs';
4
+ import { c as createDebug } from './index-06BoOZig.mjs';
5
5
  import 'micromatch';
6
6
  import 'magic-string';
7
7
  import './replace.mjs';
8
8
  import '@weapp-core/escape';
9
9
  import '@ast-core/escape';
10
- import './shared-283aac78.mjs';
10
+ import './shared-S0v7ZvWs.mjs';
11
11
  import '@weapp-core/regex';
12
12
  import '@babel/generator';
13
13
  import '@babel/parser';
14
14
  import '@babel/traverse';
15
+ import './defu-R3SAEzGq.mjs';
15
16
  import '@babel/types';
16
17
  import 'htmlparser2';
17
18
  import 'postcss';
package/dist/webpack.js CHANGED
@@ -2,22 +2,23 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var options = require('./options-09ebba08.js');
5
+ var options = require('./options-jeQuZCU1.js');
6
6
  var path = require('node:path');
7
7
  var fs = require('node:fs');
8
- var postcss = require('./postcss-8d7f67b4.js');
9
- var defaults = require('./defaults-b7341550.js');
10
- var index = require('./index-aede98ce.js');
8
+ var postcss = require('./postcss-03jfy6ZA.js');
9
+ var defaults = require('./defaults-0O-zKoXE.js');
10
+ var index = require('./index-z25r_Htj.js');
11
11
  require('micromatch');
12
12
  require('magic-string');
13
13
  require('./replace.js');
14
14
  require('@weapp-core/escape');
15
15
  require('@ast-core/escape');
16
- require('./shared-8b9be5f0.js');
16
+ require('./shared-nXoJWFdz.js');
17
17
  require('@weapp-core/regex');
18
18
  require('@babel/generator');
19
19
  require('@babel/parser');
20
20
  require('@babel/traverse');
21
+ require('./defu-d2wgbAKv.js');
21
22
  require('@babel/types');
22
23
  require('htmlparser2');
23
24
  require('postcss');
package/dist/webpack.mjs CHANGED
@@ -1,19 +1,20 @@
1
- import { g as getOptions, a as createTailwindcssPatcher, _ as __awaiter } from './options-63407615.mjs';
1
+ import { g as getOptions, a as createTailwindcssPatcher, _ as __awaiter } from './options-1ejnE5kK.mjs';
2
2
  import path from 'node:path';
3
3
  import fs from 'node:fs';
4
- import { a as pluginName } from './postcss-55ed4d42.mjs';
5
- import { g as getGroupedEntries, r as removeExt } from './defaults-d2c66d23.mjs';
6
- import { c as createDebug } from './index-84c7aa87.mjs';
4
+ import { a as pluginName } from './postcss-GEOOjC-4.mjs';
5
+ import { g as getGroupedEntries, r as removeExt } from './defaults-dz6xGhOP.mjs';
6
+ import { c as createDebug } from './index-06BoOZig.mjs';
7
7
  import 'micromatch';
8
8
  import 'magic-string';
9
9
  import './replace.mjs';
10
10
  import '@weapp-core/escape';
11
11
  import '@ast-core/escape';
12
- import './shared-283aac78.mjs';
12
+ import './shared-S0v7ZvWs.mjs';
13
13
  import '@weapp-core/regex';
14
14
  import '@babel/generator';
15
15
  import '@babel/parser';
16
16
  import '@babel/traverse';
17
+ import './defu-R3SAEzGq.mjs';
17
18
  import '@babel/types';
18
19
  import 'htmlparser2';
19
20
  import 'postcss';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "weapp-tailwindcss",
3
- "version": "2.9.3",
3
+ "version": "2.10.0",
4
4
  "description": "把tailwindcss jit引擎,带给小程序开发者们! bring tailwindcss jit engine to miniprogram developers!",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -41,6 +41,16 @@
41
41
  "require": "./dist/defaults.js",
42
42
  "import": "./dist/defaults.mjs"
43
43
  },
44
+ "./css-macro/postcss": {
45
+ "types": "./dist/css-macro/postcss.d.ts",
46
+ "require": "./dist/css-macro/postcss.js",
47
+ "import": "./dist/css-macro/postcss.mjs"
48
+ },
49
+ "./css-macro": {
50
+ "types": "./dist/css-macro/index.d.ts",
51
+ "require": "./dist/css-macro/index.js",
52
+ "import": "./dist/css-macro/index.mjs"
53
+ },
44
54
  "./*": "./*"
45
55
  },
46
56
  "typesVersions": {
@@ -102,22 +112,22 @@
102
112
  },
103
113
  "homepage": "https://weapp-tw.icebreaker.top",
104
114
  "devDependencies": {
105
- "@babel/core": "^7.23.0",
115
+ "@babel/core": "^7.23.2",
106
116
  "@icebreakers/cli": "0.1.1",
107
117
  "@icebreakers/readme": "0.1.0",
108
- "@rollup/plugin-alias": "^5.0.0",
109
- "@rollup/plugin-commonjs": "^25.0.4",
110
- "@rollup/plugin-json": "^6.0.0",
111
- "@rollup/plugin-node-resolve": "^15.2.1",
112
- "@rollup/plugin-terser": "^0.4.3",
113
- "@rollup/plugin-typescript": "^11.1.4",
118
+ "@rollup/plugin-alias": "^5.0.1",
119
+ "@rollup/plugin-commonjs": "^25.0.7",
120
+ "@rollup/plugin-json": "^6.0.1",
121
+ "@rollup/plugin-node-resolve": "^15.2.3",
122
+ "@rollup/plugin-terser": "^0.4.4",
123
+ "@rollup/plugin-typescript": "^11.1.5",
114
124
  "@tsconfig/recommended": "^1.0.3",
115
125
  "@types/babel__generator": "^7.6.5",
116
126
  "@types/babel__traverse": "^7.20.2",
117
127
  "@types/debug": "^4.1.9",
118
- "@types/diff": "^5.0.5",
128
+ "@types/diff": "^5.0.6",
119
129
  "@types/fs-extra": "^11.0.2",
120
- "@types/gulp": "^4.0.14",
130
+ "@types/gulp": "^4.0.15",
121
131
  "@types/gulp-postcss": "^8.0.4",
122
132
  "@types/jest": "^29.5.5",
123
133
  "@types/js-beautify": "^1.14.1",
@@ -126,28 +136,28 @@
126
136
  "@types/lodash": "^4.14.199",
127
137
  "@types/md5": "^2.3.3",
128
138
  "@types/micromatch": "^4.0.3",
129
- "@types/node": "^20.7.0",
139
+ "@types/node": "^20.8.6",
130
140
  "@types/semver": "^7.5.3",
131
141
  "@types/vinyl": "^2.0.8",
132
142
  "@types/webpack": "^5.28.3",
133
143
  "@types/webpack-sources": "^3.2.1",
134
- "@vitest/coverage-v8": "^0.34.5",
144
+ "@vitest/coverage-v8": "^0.34.6",
135
145
  "autoprefixer": "^10.4.16",
136
146
  "babel-loader": "^9.1.3",
137
147
  "bumpp": "^9.2.0",
138
148
  "colorette": "^2.0.20",
139
149
  "cross-env": "^7.0.3",
140
150
  "css-loader": "^6.8.1",
141
- "css-to-tailwindcss-plugin": "^0.1.5",
151
+ "css-to-tailwindcss-plugin": "^0.2.5",
142
152
  "dedent": "^1.5.1",
143
153
  "defu": "6.1.2",
144
154
  "del": "^7.1.0",
145
155
  "diff": "^5.1.0",
146
156
  "domhandler": "^5.0.3",
147
- "eslint": "8.50.0",
157
+ "eslint": "8.51.0",
148
158
  "eslint-config-icebreaker": "^1.2.2",
149
159
  "eslint-config-prettier": "^9.0.0",
150
- "eslint-plugin-prettier": "^5.0.0",
160
+ "eslint-plugin-prettier": "^5.0.1",
151
161
  "execa": "^7.2.0",
152
162
  "fast-glob": "^3.3.1",
153
163
  "fs-extra": "^11.1.1",
@@ -166,9 +176,9 @@
166
176
  "postcss-rem-to-responsive-pixel": "^5.1.3",
167
177
  "prettier": "^3.0.3",
168
178
  "promisify-loader-runner": "^1.0.0",
169
- "rollup": "^3.29.3",
179
+ "rollup": "^4.1.4",
170
180
  "rollup-plugin-visualizer": "^5.9.2",
171
- "sass": "^1.68.0",
181
+ "sass": "^1.69.3",
172
182
  "style-loader": "^3.3.3",
173
183
  "tailwind-children": "^0.5.0",
174
184
  "tailwindcss": "^3.3.3",
@@ -180,19 +190,19 @@
180
190
  "typescript": "^5.2.2",
181
191
  "typescript-transform-paths": "^3.4.6",
182
192
  "vinyl": "^3.0.0",
183
- "vite": "^4.4.9",
184
- "vitest": "^0.34.5",
193
+ "vite": "^4.4.11",
194
+ "vitest": "^0.34.6",
185
195
  "weapp-tailwindcss-children": "^0.1.0",
186
- "webpack": "^5.88.2",
196
+ "webpack": "^5.89.0",
187
197
  "webpack-build-utils": "^0.0.4"
188
198
  },
189
199
  "dependencies": {
190
200
  "@ast-core/escape": "^1.0.1",
191
201
  "@babel/generator": "^7.23.0",
192
202
  "@babel/parser": "^7.23.0",
193
- "@babel/traverse": "^7.23.0",
203
+ "@babel/traverse": "^7.23.2",
194
204
  "@babel/types": "^7.23.0",
195
- "@csstools/postcss-is-pseudo-class": "^4.0.2",
205
+ "@csstools/postcss-is-pseudo-class": "^4.0.3",
196
206
  "@tailwindcss-mangle/shared": "^2.2.2",
197
207
  "@weapp-core/escape": "^2.0.0",
198
208
  "@weapp-core/regex": "^1.0.1",
@@ -200,10 +210,10 @@
200
210
  "htmlparser2": "^9.0.0",
201
211
  "loader-utils": "^2.0.3",
202
212
  "lru-cache": "^10.0.1",
203
- "magic-string": "^0.30.3",
213
+ "magic-string": "^0.30.5",
204
214
  "md5": "^2.3.0",
205
215
  "micromatch": "^4.0.5",
206
- "postcss": "8.4.30",
216
+ "postcss": "8.4.31",
207
217
  "postcss-selector-parser": "^6.0.13",
208
218
  "semver": "^7.5.4",
209
219
  "tailwindcss-patch": "^2.2.2"
File without changes
File without changes
File without changes