weapp-tailwindcss 3.7.0 → 3.8.0-alpha.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 (149) hide show
  1. package/README.md +1 -23
  2. package/dist/chunk-35CYTBPM.js +26 -0
  3. package/dist/chunk-6FNC3XMI.js +45 -0
  4. package/dist/chunk-6Z776ZWK.js +43 -0
  5. package/dist/chunk-75EWCRQW.mjs +13 -0
  6. package/dist/chunk-7J6ZENMS.js +216 -0
  7. package/dist/chunk-A2EDVNQK.mjs +173 -0
  8. package/dist/chunk-AB467PG7.mjs +43 -0
  9. package/dist/chunk-AXBFBHS2.mjs +45 -0
  10. package/dist/chunk-C7DFN4K3.js +152 -0
  11. package/dist/chunk-FYOOMUKL.js +115 -0
  12. package/dist/chunk-HBQASQKY.js +13 -0
  13. package/dist/chunk-JVPRWRPJ.mjs +115 -0
  14. package/dist/chunk-K7CL4YBQ.mjs +216 -0
  15. package/dist/chunk-KE7J6XFD.mjs +537 -0
  16. package/dist/chunk-LQN2VTMU.js +537 -0
  17. package/dist/chunk-MUJ65IQ3.mjs +26 -0
  18. package/dist/chunk-QJPVKPQS.js +1003 -0
  19. package/dist/chunk-RFNUATFD.js +24 -0
  20. package/dist/chunk-T4A3DCFN.mjs +152 -0
  21. package/dist/chunk-U7O2XXYR.mjs +24 -0
  22. package/dist/chunk-VFCTLSC3.mjs +1003 -0
  23. package/dist/chunk-VKSQ6BRD.mjs +27 -0
  24. package/dist/chunk-WMQLIT4T.js +173 -0
  25. package/dist/chunk-XSZXPWWL.js +27 -0
  26. package/dist/cli.d.mts +2 -0
  27. package/dist/cli.d.ts +2 -1
  28. package/dist/cli.js +23 -3400
  29. package/dist/cli.mjs +28 -3392
  30. package/dist/core.d.mts +27 -0
  31. package/dist/core.d.ts +23 -4
  32. package/dist/core.js +34 -56
  33. package/dist/core.mjs +36 -54
  34. package/dist/css-macro/postcss.d.mts +7 -0
  35. package/dist/css-macro/postcss.d.ts +5 -3
  36. package/dist/css-macro/postcss.js +54 -45
  37. package/dist/css-macro/postcss.mjs +54 -45
  38. package/dist/css-macro.d.mts +18 -0
  39. package/dist/css-macro.d.ts +18 -0
  40. package/dist/css-macro.js +40 -0
  41. package/dist/css-macro.mjs +38 -0
  42. package/dist/defaults.d.mts +16 -0
  43. package/dist/defaults.d.ts +16 -2
  44. package/dist/defaults.js +5 -9
  45. package/dist/defaults.mjs +8 -4
  46. package/dist/escape.d.mts +19 -0
  47. package/dist/escape.d.ts +19 -4
  48. package/dist/escape.js +11 -0
  49. package/dist/escape.mjs +11 -0
  50. package/dist/gulp.d.mts +26 -0
  51. package/dist/gulp.d.ts +26 -1
  52. package/dist/gulp.js +11 -36
  53. package/dist/gulp.mjs +14 -31
  54. package/dist/index-g4epDIUu.d.mts +534 -0
  55. package/dist/index-g4epDIUu.d.ts +534 -0
  56. package/dist/index.d.mts +17 -0
  57. package/dist/index.d.ts +17 -4
  58. package/dist/index.js +22 -44
  59. package/dist/index.mjs +22 -34
  60. package/dist/postcss.d.mts +28 -0
  61. package/dist/postcss.d.ts +28 -1
  62. package/dist/postcss.js +9 -24
  63. package/dist/postcss.mjs +16 -8
  64. package/dist/replace.d.mts +22 -0
  65. package/dist/replace.d.ts +22 -3
  66. package/dist/replace.js +33 -50
  67. package/dist/replace.mjs +32 -25
  68. package/dist/shared-5ArEo9kL.d.mts +5 -0
  69. package/dist/shared-DI2Qz1ou.d.ts +5 -0
  70. package/dist/vite.d.mts +22 -0
  71. package/dist/vite.d.ts +22 -1
  72. package/dist/vite.js +11 -34
  73. package/dist/vite.mjs +14 -29
  74. package/dist/weapp-tw-runtime-loader.d.mts +7 -0
  75. package/dist/{bundlers/webpack/loaders/weapp-tw-runtime-loader.d.ts → weapp-tw-runtime-loader.d.ts} +4 -2
  76. package/dist/weapp-tw-runtime-loader.js +12 -12
  77. package/dist/weapp-tw-runtime-loader.mjs +12 -8
  78. package/dist/webpack.d.mts +26 -0
  79. package/dist/webpack.d.ts +26 -1
  80. package/dist/webpack.js +11 -35
  81. package/dist/webpack.mjs +14 -30
  82. package/dist/webpack4.d.mts +27 -0
  83. package/dist/webpack4.d.ts +27 -1
  84. package/dist/webpack4.js +204 -192
  85. package/dist/webpack4.mjs +210 -189
  86. package/package.json +26 -19
  87. package/dist/babel/index.d.ts +0 -5
  88. package/dist/bundlers/gulp/index.d.ts +0 -7
  89. package/dist/bundlers/vite/index.d.ts +0 -3
  90. package/dist/bundlers/webpack/BaseUnifiedPlugin/v4.d.ts +0 -8
  91. package/dist/bundlers/webpack/BaseUnifiedPlugin/v5.d.ts +0 -8
  92. package/dist/bundlers/webpack/index.d.ts +0 -1
  93. package/dist/cache/index.d.ts +0 -31
  94. package/dist/constants-CFM1J-h1.js +0 -42
  95. package/dist/constants-Dy2Dd3Fz.mjs +0 -36
  96. package/dist/constants.d.ts +0 -7
  97. package/dist/css-macro/constants.d.ts +0 -14
  98. package/dist/css-macro/index.d.ts +0 -15
  99. package/dist/css-macro/index.js +0 -36
  100. package/dist/css-macro/index.mjs +0 -30
  101. package/dist/debug/index.d.ts +0 -2
  102. package/dist/defaults-5A8JI2hW.mjs +0 -139
  103. package/dist/defaults-CdqzSWsR.js +0 -145
  104. package/dist/defu-Cdz2PomB.js +0 -60
  105. package/dist/defu-n46TJT6t.mjs +0 -57
  106. package/dist/env.d.ts +0 -2
  107. package/dist/extractors/split.d.ts +0 -3
  108. package/dist/index-BEIjgKpF.mjs +0 -11
  109. package/dist/index-BF8k8rHr.mjs +0 -517
  110. package/dist/index-BTXkyxen.js +0 -136
  111. package/dist/index-C0QsyqD6.mjs +0 -134
  112. package/dist/index-ClSBbhnm.js +0 -130
  113. package/dist/index-DoMb0-xW.mjs +0 -124
  114. package/dist/index-HC-Qkn0i.js +0 -17
  115. package/dist/index-h2-ZMO3S.js +0 -530
  116. package/dist/init.d.ts +0 -34
  117. package/dist/js/ast-grep.d.ts +0 -1
  118. package/dist/js/babel.d.ts +0 -3
  119. package/dist/js/handlers.d.ts +0 -11
  120. package/dist/js/index.d.ts +0 -7
  121. package/dist/logger.d.ts +0 -1
  122. package/dist/mangle/index.d.ts +0 -8
  123. package/dist/npm.d.ts +0 -22
  124. package/dist/options-Bv-1GQJY.js +0 -891
  125. package/dist/options-yXyCFCtr.mjs +0 -858
  126. package/dist/options.d.ts +0 -2
  127. package/dist/postcss/cssVars.d.ts +0 -5
  128. package/dist/postcss/index.d.ts +0 -4
  129. package/dist/postcss/mp.d.ts +0 -8
  130. package/dist/postcss/plugins/ctx.d.ts +0 -6
  131. package/dist/postcss/plugins/index.d.ts +0 -7
  132. package/dist/postcss/plugins/post.d.ts +0 -5
  133. package/dist/postcss/plugins/pre.d.ts +0 -5
  134. package/dist/postcss/preflight.d.ts +0 -3
  135. package/dist/postcss/selectorParser.d.ts +0 -6
  136. package/dist/postcss/shared.d.ts +0 -3
  137. package/dist/postcss/symbols.d.ts +0 -1
  138. package/dist/reg.d.ts +0 -1
  139. package/dist/shared-COWjpokr.mjs +0 -25
  140. package/dist/shared-r_GpWheO.js +0 -28
  141. package/dist/tailwindcss/patcher.d.ts +0 -3
  142. package/dist/types.d.ts +0 -165
  143. package/dist/utils.d.ts +0 -18
  144. package/dist/v5-DwFXG7m_.js +0 -181
  145. package/dist/v5-N5BYJ5JY.mjs +0 -174
  146. package/dist/wxml/Tokenizer.d.ts +0 -31
  147. package/dist/wxml/index.d.ts +0 -2
  148. package/dist/wxml/shared.d.ts +0 -2
  149. package/dist/wxml/utils.d.ts +0 -10
@@ -0,0 +1,27 @@
1
+ import { U as UserDefinedOptions, a as IStyleHandlerOptions, l as ITemplateHandlerOptions, q as CreateJsHandlerOptions, e as JsHandlerResult } from './index-g4epDIUu.mjs';
2
+ import * as postcss from 'postcss';
3
+ import '@babel/generator';
4
+ import '@babel/parser';
5
+ import 'magic-string';
6
+ import 'tailwindcss-patch';
7
+ import 'node:buffer';
8
+ import 'webpack';
9
+ import 'lru-cache';
10
+ import '@tailwindcss-mangle/shared';
11
+ import 'postcss-load-config';
12
+ import 'postcss-rem-to-responsive-pixel';
13
+
14
+ /**
15
+ * 创建一个上下文对象,用于处理小程序的模板、样式和脚本转换。
16
+ * @param options - 用户定义的选项对象
17
+ * @returns 返回一个包含 transformWxss、transformWxml 和 transformJs 方法的对象
18
+ */
19
+ declare function createContext(options?: UserDefinedOptions): {
20
+ transformWxss: (rawCss: string, options?: Partial<IStyleHandlerOptions>) => Promise<postcss.Result<postcss.Document | postcss.Root>>;
21
+ transformWxml: (rawWxml: string, options?: ITemplateHandlerOptions) => Promise<string>;
22
+ transformJs: (rawJs: string, options?: {
23
+ runtimeSet?: Set<string>;
24
+ } & CreateJsHandlerOptions) => JsHandlerResult | Promise<JsHandlerResult>;
25
+ };
26
+
27
+ export { createContext };
package/dist/core.d.ts CHANGED
@@ -1,8 +1,27 @@
1
- import type { CreateJsHandlerOptions, IStyleHandlerOptions, ITemplateHandlerOptions, UserDefinedOptions } from './types';
2
- export declare function createContext(options?: UserDefinedOptions): {
3
- transformWxss: (rawCss: string, options?: Partial<IStyleHandlerOptions>) => Promise<import("postcss").Result<import("postcss").Document | import("postcss").Root>>;
1
+ import { U as UserDefinedOptions, a as IStyleHandlerOptions, l as ITemplateHandlerOptions, q as CreateJsHandlerOptions, e as JsHandlerResult } from './index-g4epDIUu.js';
2
+ import * as postcss from 'postcss';
3
+ import '@babel/generator';
4
+ import '@babel/parser';
5
+ import 'magic-string';
6
+ import 'tailwindcss-patch';
7
+ import 'node:buffer';
8
+ import 'webpack';
9
+ import 'lru-cache';
10
+ import '@tailwindcss-mangle/shared';
11
+ import 'postcss-load-config';
12
+ import 'postcss-rem-to-responsive-pixel';
13
+
14
+ /**
15
+ * 创建一个上下文对象,用于处理小程序的模板、样式和脚本转换。
16
+ * @param options - 用户定义的选项对象
17
+ * @returns 返回一个包含 transformWxss、transformWxml 和 transformJs 方法的对象
18
+ */
19
+ declare function createContext(options?: UserDefinedOptions): {
20
+ transformWxss: (rawCss: string, options?: Partial<IStyleHandlerOptions>) => Promise<postcss.Result<postcss.Document | postcss.Root>>;
4
21
  transformWxml: (rawWxml: string, options?: ITemplateHandlerOptions) => Promise<string>;
5
22
  transformJs: (rawJs: string, options?: {
6
23
  runtimeSet?: Set<string>;
7
- } & CreateJsHandlerOptions) => import("./types").JsHandlerResult | Promise<import("./types").JsHandlerResult>;
24
+ } & CreateJsHandlerOptions) => JsHandlerResult | Promise<JsHandlerResult>;
8
25
  };
26
+
27
+ export { createContext };
package/dist/core.js CHANGED
@@ -1,61 +1,39 @@
1
- 'use strict';
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- Object.defineProperty(exports, '__esModule', { value: true });
3
+ var _chunkQJPVKPQSjs = require('./chunk-QJPVKPQS.js');
4
+ require('./chunk-FYOOMUKL.js');
5
+ require('./chunk-35CYTBPM.js');
6
+ require('./chunk-LQN2VTMU.js');
7
+ require('./chunk-RFNUATFD.js');
8
+ require('./chunk-XSZXPWWL.js');
9
+ require('./chunk-6FNC3XMI.js');
4
10
 
5
- var options = require('./options-Bv-1GQJY.js');
6
- require('lru-cache');
7
- require('md5');
8
- require('./defaults-CdqzSWsR.js');
9
- require('@ast-core/escape');
10
- require('@weapp-core/escape');
11
- require('./defu-Cdz2PomB.js');
12
- require('magic-string');
13
- require('@babel/generator');
14
- require('@babel/traverse');
15
- require('@babel/parser');
16
- require('consola');
17
- require('@weapp-core/regex');
18
- require('./replace.js');
19
- require('./shared-r_GpWheO.js');
20
- require('@tailwindcss-mangle/shared');
21
- require('postcss');
22
- require('./index-h2-ZMO3S.js');
23
- require('@csstools/postcss-is-pseudo-class');
24
- require('postcss-rem-to-responsive-pixel');
25
- require('postcss-selector-parser');
26
- require('node:path');
27
- require('node:process');
28
- require('tailwindcss-patch');
29
- require('@babel/types');
30
- require('htmlparser2');
31
-
32
- function createContext(options$1 = {}) {
33
- const opts = options.getOptions(options$1);
34
- const { templateHandler, styleHandler, patch, jsHandler, twPatcher } = opts;
35
- let runtimeSet = new Set();
36
- patch === null || patch === void 0 ? void 0 : patch();
37
- function transformWxss(rawCss, options) {
38
- return styleHandler(rawCss, Object.assign({
39
- isMainChunk: true,
40
- }, options));
41
- }
42
- function transformJs(rawJs, options = {}) {
43
- runtimeSet
44
- = options && options.runtimeSet
45
- ? options.runtimeSet
46
- : twPatcher.getClassSet();
47
- return jsHandler(rawJs, runtimeSet, options);
48
- }
49
- function transformWxml(rawWxml, options) {
50
- return templateHandler(rawWxml, Object.assign({
51
- runtimeSet,
52
- }, options));
53
- }
54
- return {
55
- transformWxss,
56
- transformWxml,
57
- transformJs,
58
- };
11
+ // src/core.ts
12
+ function createContext(options = {}) {
13
+ const opts = _chunkQJPVKPQSjs.getOptions.call(void 0, options);
14
+ const { templateHandler, styleHandler, patch, jsHandler, twPatcher } = opts;
15
+ let runtimeSet = /* @__PURE__ */ new Set();
16
+ patch == null ? void 0 : patch();
17
+ function transformWxss(rawCss, options2) {
18
+ return styleHandler(rawCss, Object.assign({
19
+ isMainChunk: true
20
+ }, options2));
21
+ }
22
+ function transformJs(rawJs, options2 = {}) {
23
+ runtimeSet = options2 && options2.runtimeSet ? options2.runtimeSet : twPatcher.getClassSet();
24
+ return jsHandler(rawJs, runtimeSet, options2);
25
+ }
26
+ function transformWxml(rawWxml, options2) {
27
+ return templateHandler(rawWxml, Object.assign({
28
+ runtimeSet
29
+ }, options2));
30
+ }
31
+ return {
32
+ transformWxss,
33
+ transformWxml,
34
+ transformJs
35
+ };
59
36
  }
60
37
 
38
+
61
39
  exports.createContext = createContext;
package/dist/core.mjs CHANGED
@@ -1,57 +1,39 @@
1
- import { g as getOptions } from './options-yXyCFCtr.mjs';
2
- import 'lru-cache';
3
- import 'md5';
4
- import './defaults-5A8JI2hW.mjs';
5
- import '@ast-core/escape';
6
- import '@weapp-core/escape';
7
- import './defu-n46TJT6t.mjs';
8
- import 'magic-string';
9
- import '@babel/generator';
10
- import '@babel/traverse';
11
- import '@babel/parser';
12
- import 'consola';
13
- import '@weapp-core/regex';
14
- import './replace.mjs';
15
- import './shared-COWjpokr.mjs';
16
- import '@tailwindcss-mangle/shared';
17
- import 'postcss';
18
- import './index-BF8k8rHr.mjs';
19
- import '@csstools/postcss-is-pseudo-class';
20
- import 'postcss-rem-to-responsive-pixel';
21
- import 'postcss-selector-parser';
22
- import 'node:path';
23
- import 'node:process';
24
- import 'tailwindcss-patch';
25
- import '@babel/types';
26
- import 'htmlparser2';
1
+ import {
2
+ getOptions
3
+ } from "./chunk-VFCTLSC3.mjs";
4
+ import "./chunk-JVPRWRPJ.mjs";
5
+ import "./chunk-MUJ65IQ3.mjs";
6
+ import "./chunk-KE7J6XFD.mjs";
7
+ import "./chunk-U7O2XXYR.mjs";
8
+ import "./chunk-VKSQ6BRD.mjs";
9
+ import "./chunk-AXBFBHS2.mjs";
27
10
 
11
+ // src/core.ts
28
12
  function createContext(options = {}) {
29
- const opts = getOptions(options);
30
- const { templateHandler, styleHandler, patch, jsHandler, twPatcher } = opts;
31
- let runtimeSet = new Set();
32
- patch === null || patch === void 0 ? void 0 : patch();
33
- function transformWxss(rawCss, options) {
34
- return styleHandler(rawCss, Object.assign({
35
- isMainChunk: true,
36
- }, options));
37
- }
38
- function transformJs(rawJs, options = {}) {
39
- runtimeSet
40
- = options && options.runtimeSet
41
- ? options.runtimeSet
42
- : twPatcher.getClassSet();
43
- return jsHandler(rawJs, runtimeSet, options);
44
- }
45
- function transformWxml(rawWxml, options) {
46
- return templateHandler(rawWxml, Object.assign({
47
- runtimeSet,
48
- }, options));
49
- }
50
- return {
51
- transformWxss,
52
- transformWxml,
53
- transformJs,
54
- };
13
+ const opts = getOptions(options);
14
+ const { templateHandler, styleHandler, patch, jsHandler, twPatcher } = opts;
15
+ let runtimeSet = /* @__PURE__ */ new Set();
16
+ patch == null ? void 0 : patch();
17
+ function transformWxss(rawCss, options2) {
18
+ return styleHandler(rawCss, Object.assign({
19
+ isMainChunk: true
20
+ }, options2));
21
+ }
22
+ function transformJs(rawJs, options2 = {}) {
23
+ runtimeSet = options2 && options2.runtimeSet ? options2.runtimeSet : twPatcher.getClassSet();
24
+ return jsHandler(rawJs, runtimeSet, options2);
25
+ }
26
+ function transformWxml(rawWxml, options2) {
27
+ return templateHandler(rawWxml, Object.assign({
28
+ runtimeSet
29
+ }, options2));
30
+ }
31
+ return {
32
+ transformWxss,
33
+ transformWxml,
34
+ transformJs
35
+ };
55
36
  }
56
-
57
- export { createContext };
37
+ export {
38
+ createContext
39
+ };
@@ -0,0 +1,7 @@
1
+ import { PluginCreator } from 'postcss';
2
+
3
+ interface Options {
4
+ }
5
+ declare const creator: PluginCreator<Options>;
6
+
7
+ export { type Options, creator as default };
@@ -1,5 +1,7 @@
1
- import type { PluginCreator } from 'postcss';
2
- export interface Options {
1
+ import { PluginCreator } from 'postcss';
2
+
3
+ interface Options {
3
4
  }
4
5
  declare const creator: PluginCreator<Options>;
5
- export default creator;
6
+
7
+ export { type Options, creator as default };
@@ -1,51 +1,60 @@
1
- 'use strict';
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var constants = require('../constants-CFM1J-h1.js');
4
3
 
5
- const creator = () => {
6
- return {
7
- postcssPlugin: 'postcss-weapp-tw-css-macro-plugin',
8
- prepare() {
9
- return {
10
- AtRule(atRule, helper) {
11
- var _a;
12
- if (atRule.name === 'media') {
13
- const values = [];
14
- constants.matchCustomPropertyFromValue(atRule.params, (arr) => {
15
- values.push(arr[1]);
16
- });
17
- if (values.length > 0) {
18
- const isNegative = atRule.params.includes('not');
19
- const text = values.join(' ');
20
- const comment = isNegative ? constants.ifndef(text) : constants.ifdef(text);
21
- atRule.replaceWith([
22
- helper.comment({
23
- raws: {
24
- before: '\n',
25
- },
26
- text: comment.start,
27
- }),
28
- ...((_a = atRule.nodes) !== null && _a !== void 0 ? _a : []),
29
- helper.comment({
30
- raws: {
31
- before: '\n',
32
- },
33
- text: comment.end,
34
- }),
35
- ]);
36
- }
37
- }
38
- },
39
- CommentExit(comment) {
40
- if (/#(?:ifn?def|endif)/.test(comment.text)) {
41
- comment.raws.left = ' ';
42
- comment.raws.right = ' ';
43
- }
44
- },
45
- };
4
+
5
+ var _chunk6Z776ZWKjs = require('../chunk-6Z776ZWK.js');
6
+ require('../chunk-6FNC3XMI.js');
7
+
8
+ // src/css-macro/postcss.ts
9
+ var creator = () => {
10
+ return {
11
+ postcssPlugin: "postcss-weapp-tw-css-macro-plugin",
12
+ prepare() {
13
+ return {
14
+ AtRule(atRule, helper) {
15
+ var _a;
16
+ if (atRule.name === "media") {
17
+ const values = [];
18
+ _chunk6Z776ZWKjs.matchCustomPropertyFromValue.call(void 0, atRule.params, (arr) => {
19
+ values.push(arr[1]);
20
+ });
21
+ if (values.length > 0) {
22
+ const isNegative = atRule.params.includes("not");
23
+ const text = values.join(" ");
24
+ const comment = isNegative ? _chunk6Z776ZWKjs.ifndef.call(void 0, text) : _chunk6Z776ZWKjs.ifdef.call(void 0, text);
25
+ atRule.replaceWith([
26
+ helper.comment({
27
+ raws: {
28
+ before: "\n"
29
+ },
30
+ text: comment.start
31
+ }),
32
+ ...(_a = atRule.nodes) != null ? _a : [],
33
+ // .map((x) => x.clone()),
34
+ helper.comment({
35
+ raws: {
36
+ before: "\n"
37
+ },
38
+ text: comment.end
39
+ })
40
+ ]);
41
+ }
42
+ }
46
43
  },
47
- };
44
+ CommentExit(comment) {
45
+ if (/#(?:ifn?def|endif)/.test(comment.text)) {
46
+ comment.raws.left = " ";
47
+ comment.raws.right = " ";
48
+ }
49
+ }
50
+ };
51
+ }
52
+ };
48
53
  };
49
54
  creator.postcss = true;
55
+ var postcss_default = creator;
56
+
57
+
58
+ exports.default = postcss_default;
50
59
 
51
- module.exports = creator;
60
+ module.exports = exports.default;
@@ -1,49 +1,58 @@
1
- import { m as matchCustomPropertyFromValue, i as ifndef, b as ifdef } from '../constants-Dy2Dd3Fz.mjs';
1
+ import {
2
+ ifdef,
3
+ ifndef,
4
+ matchCustomPropertyFromValue
5
+ } from "../chunk-AB467PG7.mjs";
6
+ import "../chunk-AXBFBHS2.mjs";
2
7
 
3
- const creator = () => {
4
- return {
5
- postcssPlugin: 'postcss-weapp-tw-css-macro-plugin',
6
- prepare() {
7
- return {
8
- AtRule(atRule, helper) {
9
- var _a;
10
- if (atRule.name === 'media') {
11
- const values = [];
12
- matchCustomPropertyFromValue(atRule.params, (arr) => {
13
- values.push(arr[1]);
14
- });
15
- if (values.length > 0) {
16
- const isNegative = atRule.params.includes('not');
17
- const text = values.join(' ');
18
- const comment = isNegative ? ifndef(text) : ifdef(text);
19
- atRule.replaceWith([
20
- helper.comment({
21
- raws: {
22
- before: '\n',
23
- },
24
- text: comment.start,
25
- }),
26
- ...((_a = atRule.nodes) !== null && _a !== void 0 ? _a : []),
27
- helper.comment({
28
- raws: {
29
- before: '\n',
30
- },
31
- text: comment.end,
32
- }),
33
- ]);
34
- }
35
- }
36
- },
37
- CommentExit(comment) {
38
- if (/#(?:ifn?def|endif)/.test(comment.text)) {
39
- comment.raws.left = ' ';
40
- comment.raws.right = ' ';
41
- }
42
- },
43
- };
8
+ // src/css-macro/postcss.ts
9
+ var creator = () => {
10
+ return {
11
+ postcssPlugin: "postcss-weapp-tw-css-macro-plugin",
12
+ prepare() {
13
+ return {
14
+ AtRule(atRule, helper) {
15
+ var _a;
16
+ if (atRule.name === "media") {
17
+ const values = [];
18
+ matchCustomPropertyFromValue(atRule.params, (arr) => {
19
+ values.push(arr[1]);
20
+ });
21
+ if (values.length > 0) {
22
+ const isNegative = atRule.params.includes("not");
23
+ const text = values.join(" ");
24
+ const comment = isNegative ? ifndef(text) : ifdef(text);
25
+ atRule.replaceWith([
26
+ helper.comment({
27
+ raws: {
28
+ before: "\n"
29
+ },
30
+ text: comment.start
31
+ }),
32
+ ...(_a = atRule.nodes) != null ? _a : [],
33
+ // .map((x) => x.clone()),
34
+ helper.comment({
35
+ raws: {
36
+ before: "\n"
37
+ },
38
+ text: comment.end
39
+ })
40
+ ]);
41
+ }
42
+ }
44
43
  },
45
- };
44
+ CommentExit(comment) {
45
+ if (/#(?:ifn?def|endif)/.test(comment.text)) {
46
+ comment.raws.left = " ";
47
+ comment.raws.right = " ";
48
+ }
49
+ }
50
+ };
51
+ }
52
+ };
46
53
  };
47
54
  creator.postcss = true;
48
-
49
- export { creator as default };
55
+ var postcss_default = creator;
56
+ export {
57
+ postcss_default as default
58
+ };
@@ -0,0 +1,18 @@
1
+ import * as tailwindcss_types_config from 'tailwindcss/types/config';
2
+
3
+ interface Options {
4
+ variantsMap?: Record<string, string | {
5
+ value: string;
6
+ negative?: boolean;
7
+ }>;
8
+ dynamic?: boolean;
9
+ }
10
+ declare const cssMacro: {
11
+ (options: Options): {
12
+ handler: tailwindcss_types_config.PluginCreator;
13
+ config?: Partial<tailwindcss_types_config.Config>;
14
+ };
15
+ __isOptionsFunction: true;
16
+ };
17
+
18
+ export { type Options, cssMacro as default };
@@ -0,0 +1,18 @@
1
+ import * as tailwindcss_types_config from 'tailwindcss/types/config';
2
+
3
+ interface Options {
4
+ variantsMap?: Record<string, string | {
5
+ value: string;
6
+ negative?: boolean;
7
+ }>;
8
+ dynamic?: boolean;
9
+ }
10
+ declare const cssMacro: {
11
+ (options: Options): {
12
+ handler: tailwindcss_types_config.PluginCreator;
13
+ config?: Partial<tailwindcss_types_config.Config>;
14
+ };
15
+ __isOptionsFunction: true;
16
+ };
17
+
18
+ export { type Options, cssMacro as default };
@@ -0,0 +1,40 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
2
+
3
+
4
+ var _chunk6Z776ZWKjs = require('./chunk-6Z776ZWK.js');
5
+
6
+
7
+ var _chunk35CYTBPMjs = require('./chunk-35CYTBPM.js');
8
+ require('./chunk-6FNC3XMI.js');
9
+
10
+ // src/css-macro/index.ts
11
+ var _plugin = require('tailwindcss/plugin'); var _plugin2 = _interopRequireDefault(_plugin);
12
+ var cssMacro = _plugin2.default.withOptions((options) => {
13
+ const { dynamic: dynamicMode, variantsMap } = _chunk35CYTBPMjs.defu.call(void 0, options, {
14
+ dynamic: true,
15
+ variantsMap: {}
16
+ });
17
+ return ({ matchVariant, addVariant }) => {
18
+ if (dynamicMode) {
19
+ matchVariant("ifdef", (value) => {
20
+ return _chunk6Z776ZWKjs.createMediaQuery.call(void 0, value);
21
+ });
22
+ matchVariant("ifndef", (value) => {
23
+ return _chunk6Z776ZWKjs.createNegativeMediaQuery.call(void 0, value);
24
+ });
25
+ }
26
+ for (const [name, obj] of Object.entries(variantsMap)) {
27
+ if (typeof obj === "string") {
28
+ addVariant(name, _chunk6Z776ZWKjs.createMediaQuery.call(void 0, obj));
29
+ } else {
30
+ addVariant(name, obj.negative ? _chunk6Z776ZWKjs.createNegativeMediaQuery.call(void 0, obj.value) : _chunk6Z776ZWKjs.createMediaQuery.call(void 0, obj.value));
31
+ }
32
+ }
33
+ };
34
+ });
35
+ var css_macro_default = cssMacro;
36
+
37
+
38
+ exports.default = css_macro_default;
39
+
40
+ module.exports = exports.default;
@@ -0,0 +1,38 @@
1
+ import {
2
+ createMediaQuery,
3
+ createNegativeMediaQuery
4
+ } from "./chunk-AB467PG7.mjs";
5
+ import {
6
+ defu
7
+ } from "./chunk-MUJ65IQ3.mjs";
8
+ import "./chunk-AXBFBHS2.mjs";
9
+
10
+ // src/css-macro/index.ts
11
+ import plugin from "tailwindcss/plugin";
12
+ var cssMacro = plugin.withOptions((options) => {
13
+ const { dynamic: dynamicMode, variantsMap } = defu(options, {
14
+ dynamic: true,
15
+ variantsMap: {}
16
+ });
17
+ return ({ matchVariant, addVariant }) => {
18
+ if (dynamicMode) {
19
+ matchVariant("ifdef", (value) => {
20
+ return createMediaQuery(value);
21
+ });
22
+ matchVariant("ifndef", (value) => {
23
+ return createNegativeMediaQuery(value);
24
+ });
25
+ }
26
+ for (const [name, obj] of Object.entries(variantsMap)) {
27
+ if (typeof obj === "string") {
28
+ addVariant(name, createMediaQuery(obj));
29
+ } else {
30
+ addVariant(name, obj.negative ? createNegativeMediaQuery(obj.value) : createMediaQuery(obj.value));
31
+ }
32
+ }
33
+ };
34
+ });
35
+ var css_macro_default = cssMacro;
36
+ export {
37
+ css_macro_default as default
38
+ };
@@ -0,0 +1,16 @@
1
+ import { U as UserDefinedOptions } from './index-g4epDIUu.mjs';
2
+ import '@babel/generator';
3
+ import '@babel/parser';
4
+ import 'magic-string';
5
+ import 'postcss';
6
+ import 'tailwindcss-patch';
7
+ import 'node:buffer';
8
+ import 'webpack';
9
+ import 'lru-cache';
10
+ import '@tailwindcss-mangle/shared';
11
+ import 'postcss-load-config';
12
+ import 'postcss-rem-to-responsive-pixel';
13
+
14
+ declare const defaultOptions: UserDefinedOptions;
15
+
16
+ export { defaultOptions };
@@ -1,2 +1,16 @@
1
- import type { UserDefinedOptions } from './types';
2
- export declare const defaultOptions: UserDefinedOptions;
1
+ import { U as UserDefinedOptions } from './index-g4epDIUu.js';
2
+ import '@babel/generator';
3
+ import '@babel/parser';
4
+ import 'magic-string';
5
+ import 'postcss';
6
+ import 'tailwindcss-patch';
7
+ import 'node:buffer';
8
+ import 'webpack';
9
+ import 'lru-cache';
10
+ import '@tailwindcss-mangle/shared';
11
+ import 'postcss-load-config';
12
+ import 'postcss-rem-to-responsive-pixel';
13
+
14
+ declare const defaultOptions: UserDefinedOptions;
15
+
16
+ export { defaultOptions };
package/dist/defaults.js CHANGED
@@ -1,12 +1,8 @@
1
- 'use strict';
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- Object.defineProperty(exports, '__esModule', { value: true });
3
+ var _chunkFYOOMUKLjs = require('./chunk-FYOOMUKL.js');
4
+ require('./chunk-35CYTBPM.js');
5
+ require('./chunk-6FNC3XMI.js');
4
6
 
5
- require('@ast-core/escape');
6
- require('@weapp-core/escape');
7
- var defaults = require('./defaults-CdqzSWsR.js');
8
- require('./defu-Cdz2PomB.js');
9
7
 
10
-
11
-
12
- exports.defaultOptions = defaults.defaultOptions;
8
+ exports.defaultOptions = _chunkFYOOMUKLjs.defaultOptions;