weapp-tailwindcss 3.4.0-alpha.0 → 3.4.0-alpha.2

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 (124) hide show
  1. package/dist/babel/index.d.ts +16 -0
  2. package/dist/bundlers/gulp/index.d.ts +8 -0
  3. package/dist/bundlers/vite/index.d.ts +3 -0
  4. package/dist/bundlers/webpack/BaseUnifiedPlugin/v4.d.ts +8 -0
  5. package/dist/bundlers/webpack/BaseUnifiedPlugin/v5.d.ts +8 -0
  6. package/dist/bundlers/webpack/index.d.ts +1 -0
  7. package/dist/{weapp-tw-runtime-loader.d.ts → bundlers/webpack/loaders/weapp-tw-runtime-loader.d.ts} +2 -4
  8. package/dist/cache/index.d.ts +32 -0
  9. package/dist/cli.d.ts +1 -2
  10. package/dist/cli.js +51 -1760
  11. package/dist/cli.mjs +45 -34
  12. package/dist/constants-CFM1J-h1.js +42 -0
  13. package/dist/constants-Dy2Dd3Fz.mjs +36 -0
  14. package/dist/constants.d.ts +7 -0
  15. package/dist/core.d.ts +2 -16
  16. package/dist/core.js +60 -1775
  17. package/dist/core.mjs +60 -46
  18. package/dist/css-macro/constants.d.ts +14 -0
  19. package/dist/css-macro/index.d.ts +4 -7
  20. package/dist/css-macro/index.js +30 -140
  21. package/dist/css-macro/index.mjs +28 -35
  22. package/dist/css-macro/postcss.d.ts +3 -5
  23. package/dist/css-macro/postcss.js +46 -99
  24. package/dist/css-macro/postcss.mjs +45 -54
  25. package/dist/debug/index.d.ts +2 -0
  26. package/dist/defaults-DW-EahCC.js +145 -0
  27. package/dist/defaults-w3rlKQwe.mjs +139 -0
  28. package/dist/defaults.d.ts +2 -16
  29. package/dist/defaults.js +7 -208
  30. package/dist/defaults.mjs +4 -9
  31. package/dist/defu-Cdz2PomB.js +60 -0
  32. package/dist/defu-n46TJT6t.mjs +57 -0
  33. package/dist/env.d.ts +2 -0
  34. package/dist/escape.d.ts +4 -0
  35. package/dist/extractors/split.d.ts +3 -0
  36. package/dist/gulp.d.ts +1 -26
  37. package/dist/gulp.js +38 -1898
  38. package/dist/gulp.mjs +30 -15
  39. package/dist/index-B2TNoaOv.mjs +134 -0
  40. package/dist/index-B5NiRecR.js +130 -0
  41. package/dist/index-BEIjgKpF.mjs +11 -0
  42. package/dist/index-BPzIdybK.mjs +513 -0
  43. package/dist/index-DeW_zXzo.mjs +124 -0
  44. package/dist/index-DmzxhHCX.js +136 -0
  45. package/dist/index-DwZHOkK3.js +526 -0
  46. package/dist/index-HC-Qkn0i.js +17 -0
  47. package/dist/index.d.ts +4 -17
  48. package/dist/index.js +43 -2291
  49. package/dist/index.mjs +33 -23
  50. package/dist/js/handlers.d.ts +13 -0
  51. package/dist/js/index.d.ts +7 -0
  52. package/dist/mangle/index.d.ts +8 -0
  53. package/dist/options-7EjuAISl.mjs +869 -0
  54. package/dist/options-C-rvBixk.js +901 -0
  55. package/dist/options.d.ts +2 -0
  56. package/dist/postcss/cssVars.d.ts +5 -0
  57. package/dist/postcss/index.d.ts +3 -0
  58. package/dist/postcss/mp.d.ts +8 -0
  59. package/dist/postcss/plugins/ctx.d.ts +6 -0
  60. package/dist/postcss/plugins/index.d.ts +7 -0
  61. package/dist/postcss/plugins/post.d.ts +5 -0
  62. package/dist/postcss/plugins/pre.d.ts +5 -0
  63. package/dist/postcss/preflight.d.ts +3 -0
  64. package/dist/postcss/selectorParser.d.ts +6 -0
  65. package/dist/postcss/shared.d.ts +3 -0
  66. package/dist/postcss/symbols.d.ts +1 -0
  67. package/dist/postcss.d.ts +1 -23
  68. package/dist/postcss.js +22 -598
  69. package/dist/postcss.mjs +8 -17
  70. package/dist/reg.d.ts +1 -0
  71. package/dist/replace.d.ts +3 -19
  72. package/dist/replace.js +42 -93
  73. package/dist/replace.mjs +26 -30
  74. package/dist/shared-DbJl6i6a.mjs +25 -0
  75. package/dist/shared-hzYeE1wX.js +28 -0
  76. package/dist/tailwindcss/patcher.d.ts +3 -0
  77. package/dist/types.d.ts +165 -0
  78. package/dist/utils.d.ts +18 -0
  79. package/dist/v5-BD9-sqra.mjs +174 -0
  80. package/dist/v5-Ch6783yy.js +181 -0
  81. package/dist/vite.d.ts +1 -22
  82. package/dist/vite.js +36 -1947
  83. package/dist/vite.mjs +28 -15
  84. package/dist/weapp-tw-runtime-loader.js +14 -41
  85. package/dist/weapp-tw-runtime-loader.mjs +8 -12
  86. package/dist/webpack.d.ts +1 -26
  87. package/dist/webpack.js +37 -1994
  88. package/dist/webpack.mjs +29 -15
  89. package/dist/webpack4.d.ts +1 -27
  90. package/dist/webpack4.js +190 -1979
  91. package/dist/webpack4.mjs +188 -211
  92. package/dist/wxml/Tokenizer.d.ts +31 -0
  93. package/dist/wxml/index.d.ts +2 -0
  94. package/dist/wxml/shared.d.ts +2 -0
  95. package/dist/wxml/utils.d.ts +13 -0
  96. package/package.json +3 -3
  97. package/dist/chunk-257YPDSI.mjs +0 -173
  98. package/dist/chunk-75EWCRQW.mjs +0 -13
  99. package/dist/chunk-AB467PG7.mjs +0 -43
  100. package/dist/chunk-E7XGHGC7.mjs +0 -62
  101. package/dist/chunk-GUE4UCRJ.mjs +0 -126
  102. package/dist/chunk-IOYI6MSW.mjs +0 -533
  103. package/dist/chunk-LDWI65M5.mjs +0 -152
  104. package/dist/chunk-NVFWRLOI.mjs +0 -27
  105. package/dist/chunk-ORMKM6ZA.mjs +0 -30
  106. package/dist/chunk-PC4B5JJB.mjs +0 -953
  107. package/dist/chunk-SRLZU2YE.mjs +0 -95
  108. package/dist/chunk-VECXHWWG.mjs +0 -31
  109. package/dist/chunk-VN37QGSM.mjs +0 -216
  110. package/dist/cli.d.mts +0 -2
  111. package/dist/core.d.mts +0 -22
  112. package/dist/css-macro/index.d.mts +0 -18
  113. package/dist/css-macro/postcss.d.mts +0 -7
  114. package/dist/defaults.d.mts +0 -16
  115. package/dist/gulp.d.mts +0 -26
  116. package/dist/index.d.mts +0 -17
  117. package/dist/postcss.d.mts +0 -23
  118. package/dist/replace.d.mts +0 -19
  119. package/dist/types-DSNuiOhH.d.mts +0 -519
  120. package/dist/types-DSNuiOhH.d.ts +0 -519
  121. package/dist/vite.d.mts +0 -22
  122. package/dist/weapp-tw-runtime-loader.d.mts +0 -7
  123. package/dist/webpack.d.mts +0 -26
  124. package/dist/webpack4.d.mts +0 -27
package/dist/core.mjs CHANGED
@@ -1,49 +1,63 @@
1
- import {
2
- getOptions
3
- } from "./chunk-PC4B5JJB.mjs";
4
- import "./chunk-SRLZU2YE.mjs";
5
- import "./chunk-GUE4UCRJ.mjs";
6
- import "./chunk-IOYI6MSW.mjs";
7
- import "./chunk-NVFWRLOI.mjs";
8
- import "./chunk-ORMKM6ZA.mjs";
9
- import "./chunk-VECXHWWG.mjs";
10
- import {
11
- __async
12
- } from "./chunk-E7XGHGC7.mjs";
1
+ import { g as getOptions, _ as __awaiter } from './options-7EjuAISl.mjs';
2
+ import 'magic-string';
3
+ import './replace.mjs';
4
+ import '@weapp-core/escape';
5
+ import '@ast-core/escape';
6
+ import './shared-DbJl6i6a.mjs';
7
+ import '@weapp-core/regex';
8
+ import '@babel/generator';
9
+ import '@babel/traverse';
10
+ import '@babel/parser';
11
+ import './defaults-w3rlKQwe.mjs';
12
+ import './defu-n46TJT6t.mjs';
13
+ import '@babel/types';
14
+ import 'htmlparser2';
15
+ import 'postcss';
16
+ import './index-BPzIdybK.mjs';
17
+ import '@csstools/postcss-is-pseudo-class';
18
+ import 'postcss-rem-to-responsive-pixel';
19
+ import 'postcss-selector-parser';
20
+ import 'node:path';
21
+ import 'node:process';
22
+ import 'tailwindcss-patch';
23
+ import '@tailwindcss-mangle/shared';
24
+ import 'lru-cache';
25
+ import 'md5';
13
26
 
14
- // src/core.ts
15
27
  function createContext(options = {}) {
16
- const opts = getOptions(options);
17
- const { templateHandler, styleHandler, patch, jsHandler, twPatcher } = opts;
18
- let runtimeSet = /* @__PURE__ */ new Set();
19
- patch == null ? void 0 : patch();
20
- function transformWxss(rawCss, options2) {
21
- return __async(this, null, function* () {
22
- const code = yield styleHandler(rawCss, Object.assign({
23
- isMainChunk: true
24
- }, options2));
25
- return code;
26
- });
27
- }
28
- function transformJs(_0) {
29
- return __async(this, arguments, function* (rawJs, options2 = {}) {
30
- runtimeSet = options2 && options2.runtimeSet ? options2.runtimeSet : twPatcher.getClassSet();
31
- const { code } = yield jsHandler(rawJs, runtimeSet, options2);
32
- return code;
33
- });
34
- }
35
- function transformWxml(rawWxml, options2) {
36
- const code = templateHandler(rawWxml, Object.assign({
37
- runtimeSet
38
- }, options2));
39
- return code;
40
- }
41
- return {
42
- transformWxss,
43
- transformWxml,
44
- transformJs
45
- };
28
+ const opts = getOptions(options);
29
+ const { templateHandler, styleHandler, patch, jsHandler, twPatcher } = opts;
30
+ let runtimeSet = new Set();
31
+ patch === null || patch === void 0 ? void 0 : patch();
32
+ function transformWxss(rawCss, options) {
33
+ return __awaiter(this, void 0, void 0, function* () {
34
+ const code = yield styleHandler(rawCss, Object.assign({
35
+ isMainChunk: true,
36
+ }, options));
37
+ return code;
38
+ });
39
+ }
40
+ function transformJs(rawJs_1) {
41
+ return __awaiter(this, arguments, void 0, function* (rawJs, options = {}) {
42
+ runtimeSet
43
+ = options && options.runtimeSet
44
+ ? options.runtimeSet
45
+ : twPatcher.getClassSet();
46
+ const { code } = yield jsHandler(rawJs, runtimeSet, options);
47
+ return code;
48
+ });
49
+ }
50
+ function transformWxml(rawWxml, options) {
51
+ const code = templateHandler(rawWxml, Object.assign({
52
+ runtimeSet,
53
+ }, options));
54
+ return code;
55
+ }
56
+ return {
57
+ transformWxss,
58
+ transformWxml,
59
+ transformJs,
60
+ };
46
61
  }
47
- export {
48
- createContext
49
- };
62
+
63
+ export { createContext };
@@ -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;
@@ -1,6 +1,4 @@
1
- import * as tailwindcss_types_config from 'tailwindcss/types/config';
2
-
3
- interface Options {
1
+ export interface Options {
4
2
  variantsMap?: Record<string, string | {
5
3
  value: string;
6
4
  negative?: boolean;
@@ -9,10 +7,9 @@ interface Options {
9
7
  }
10
8
  declare const _default: {
11
9
  (options: Options): {
12
- handler: tailwindcss_types_config.PluginCreator;
13
- config?: Partial<tailwindcss_types_config.Config>;
10
+ handler: import("tailwindcss/types/config").PluginCreator;
11
+ config?: Partial<import("tailwindcss/types/config").Config> | undefined;
14
12
  };
15
13
  __isOptionsFunction: true;
16
14
  };
17
-
18
- export { type Options, _default as default };
15
+ export default _default;
@@ -1,146 +1,36 @@
1
- "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
- var __copyProps = (to, from, except, desc) => {
13
- if (from && typeof from === "object" || typeof from === "function") {
14
- for (let key of __getOwnPropNames(from))
15
- if (!__hasOwnProp.call(to, key) && key !== except)
16
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
- }
18
- return to;
19
- };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
1
+ 'use strict';
29
2
 
30
- // src/css-macro/index.ts
31
- var css_macro_exports = {};
32
- __export(css_macro_exports, {
33
- default: () => css_macro_default
34
- });
35
- module.exports = __toCommonJS(css_macro_exports);
36
- var import_plugin = __toESM(require("tailwindcss/plugin"));
3
+ var plugin = require('tailwindcss/plugin');
4
+ var constants = require('../constants-CFM1J-h1.js');
5
+ var defu = require('../defu-Cdz2PomB.js');
37
6
 
38
- // src/css-macro/constants.ts
39
- var queryKey = "weapp-tw-platform";
40
- function createMediaQuery(value) {
41
- return `@media (${queryKey}:"${value}"){&}`;
42
- }
43
- function createNegativeMediaQuery(value) {
44
- return `@media not screen and (${queryKey}:"${value}"){&}`;
45
- }
7
+ function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
46
8
 
47
- // ../../node_modules/.pnpm/defu@6.1.4/node_modules/defu/dist/defu.mjs
48
- function isPlainObject(value) {
49
- if (value === null || typeof value !== "object") {
50
- return false;
51
- }
52
- const prototype = Object.getPrototypeOf(value);
53
- if (prototype !== null && prototype !== Object.prototype && Object.getPrototypeOf(prototype) !== null) {
54
- return false;
55
- }
56
- if (Symbol.iterator in value) {
57
- return false;
58
- }
59
- if (Symbol.toStringTag in value) {
60
- return Object.prototype.toString.call(value) === "[object Module]";
61
- }
62
- return true;
63
- }
64
- function _defu(baseObject, defaults, namespace = ".", merger) {
65
- if (!isPlainObject(defaults)) {
66
- return _defu(baseObject, {}, namespace, merger);
67
- }
68
- const object = Object.assign({}, defaults);
69
- for (const key in baseObject) {
70
- if (key === "__proto__" || key === "constructor") {
71
- continue;
72
- }
73
- const value = baseObject[key];
74
- if (value === null || value === void 0) {
75
- continue;
76
- }
77
- if (merger && merger(object, key, value, namespace)) {
78
- continue;
79
- }
80
- if (Array.isArray(value) && Array.isArray(object[key])) {
81
- object[key] = [...value, ...object[key]];
82
- } else if (isPlainObject(value) && isPlainObject(object[key])) {
83
- object[key] = _defu(
84
- value,
85
- object[key],
86
- (namespace ? `${namespace}.` : "") + key.toString(),
87
- merger
88
- );
89
- } else {
90
- object[key] = value;
91
- }
92
- }
93
- return object;
94
- }
95
- function createDefu(merger) {
96
- return (...arguments_) => (
97
- // eslint-disable-next-line unicorn/no-array-reduce
98
- arguments_.reduce((p, c) => _defu(p, c, "", merger), {})
99
- );
100
- }
101
- var defu = createDefu();
102
- var defuFn = createDefu((object, key, currentValue) => {
103
- if (object[key] !== void 0 && typeof currentValue === "function") {
104
- object[key] = currentValue(object[key]);
105
- return true;
106
- }
107
- });
108
- var defuArrayFn = createDefu((object, key, currentValue) => {
109
- if (Array.isArray(object[key]) && typeof currentValue === "function") {
110
- object[key] = currentValue(object[key]);
111
- return true;
112
- }
113
- });
9
+ var plugin__default = /*#__PURE__*/_interopDefaultCompat(plugin);
114
10
 
115
- // src/utils.ts
116
- var defuOverrideArray = createDefu((obj, key, value) => {
117
- if (Array.isArray(obj[key]) && Array.isArray(value)) {
118
- obj[key] = value;
119
- return true;
120
- }
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
+ };
121
34
  });
122
35
 
123
- // src/css-macro/index.ts
124
- var css_macro_default = import_plugin.default.withOptions((options) => {
125
- const { dynamic: dynamicMode, variantsMap } = defu(options, {
126
- dynamic: true,
127
- variantsMap: {}
128
- });
129
- return ({ matchVariant, addVariant }) => {
130
- if (dynamicMode) {
131
- matchVariant("ifdef", (value) => {
132
- return createMediaQuery(value);
133
- });
134
- matchVariant("ifndef", (value) => {
135
- return createNegativeMediaQuery(value);
136
- });
137
- }
138
- for (const [name, obj] of Object.entries(variantsMap)) {
139
- if (typeof obj === "string") {
140
- addVariant(name, createMediaQuery(obj));
141
- } else {
142
- addVariant(name, obj.negative ? createNegativeMediaQuery(obj.value) : createMediaQuery(obj.value));
143
- }
144
- }
145
- };
146
- });
36
+ module.exports = index;
@@ -1,37 +1,30 @@
1
- import {
2
- createMediaQuery,
3
- createNegativeMediaQuery
4
- } from "../chunk-AB467PG7.mjs";
5
- import {
6
- defu
7
- } from "../chunk-GUE4UCRJ.mjs";
8
- import "../chunk-E7XGHGC7.mjs";
1
+ import plugin from 'tailwindcss/plugin';
2
+ import { c as createMediaQuery, a as createNegativeMediaQuery } from '../constants-Dy2Dd3Fz.mjs';
3
+ import { d as defu } from '../defu-n46TJT6t.mjs';
9
4
 
10
- // src/css-macro/index.ts
11
- import plugin from "tailwindcss/plugin";
12
- var css_macro_default = 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
- };
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
+ };
34
28
  });
35
- export {
36
- css_macro_default as default
37
- };
29
+
30
+ export { index as default };
@@ -1,7 +1,5 @@
1
- import { PluginCreator } from 'postcss';
2
-
3
- interface Options {
1
+ import type { PluginCreator } from 'postcss';
2
+ export interface Options {
4
3
  }
5
4
  declare const creator: PluginCreator<Options>;
6
-
7
- export { type Options, creator as default };
5
+ export default creator;
@@ -1,104 +1,51 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
1
+ 'use strict';
19
2
 
20
- // src/css-macro/postcss.ts
21
- var postcss_exports = {};
22
- __export(postcss_exports, {
23
- default: () => postcss_default
24
- });
25
- module.exports = __toCommonJS(postcss_exports);
3
+ var constants = require('../constants-CFM1J-h1.js');
26
4
 
27
- // src/css-macro/constants.ts
28
- var queryKey = "weapp-tw-platform";
29
- function normalComment(text) {
30
- if (typeof text === "string") {
31
- return text.replaceAll(new RegExp("(?<!\\\\)_", "g"), " ");
32
- }
33
- return text;
34
- }
35
- function ifdef(text) {
36
- return {
37
- start: `#ifdef ${normalComment(text)}`,
38
- end: `#endif`
39
- };
40
- }
41
- function ifndef(text) {
42
- return {
43
- start: `#ifndef ${normalComment(text)}`,
44
- end: `#endif`
45
- };
46
- }
47
- function matchCustomPropertyFromValue(str, cb) {
48
- let arr;
49
- let index = 0;
50
- const regex = new RegExp(`\\(\\s*${queryKey}\\s*:\\s*"([^)]*)"\\)`, "g");
51
- while ((arr = regex.exec(str)) !== null) {
52
- cb(arr, index);
53
- index++;
54
- }
55
- }
56
-
57
- // src/css-macro/postcss.ts
58
- var creator = () => {
59
- return {
60
- postcssPlugin: "postcss-weapp-tw-css-macro-plugin",
61
- prepare() {
62
- return {
63
- AtRule(atRule, helper) {
64
- var _a;
65
- if (atRule.name === "media") {
66
- const values = [];
67
- matchCustomPropertyFromValue(atRule.params, (arr) => {
68
- values.push(arr[1]);
69
- });
70
- if (values.length > 0) {
71
- const isNegative = atRule.params.includes("not");
72
- const text = values.join(" ");
73
- const comment = isNegative ? ifndef(text) : ifdef(text);
74
- atRule.replaceWith([
75
- helper.comment({
76
- raws: {
77
- before: "\n"
78
- },
79
- text: comment.start
80
- }),
81
- ...(_a = atRule.nodes) != null ? _a : [],
82
- // .map((x) => x.clone()),
83
- helper.comment({
84
- raws: {
85
- before: "\n"
86
- },
87
- text: comment.end
88
- })
89
- ]);
90
- }
91
- }
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
+ };
92
46
  },
93
- CommentExit(comment) {
94
- if (/#(?:ifn?def|endif)/.test(comment.text)) {
95
- comment.raws.left = " ";
96
- comment.raws.right = " ";
97
- }
98
- }
99
- };
100
- }
101
- };
47
+ };
102
48
  };
103
49
  creator.postcss = true;
104
- var postcss_default = creator;
50
+
51
+ module.exports = creator;
@@ -1,58 +1,49 @@
1
- import {
2
- ifdef,
3
- ifndef,
4
- matchCustomPropertyFromValue
5
- } from "../chunk-AB467PG7.mjs";
6
- import "../chunk-E7XGHGC7.mjs";
1
+ import { m as matchCustomPropertyFromValue, i as ifndef, b as ifdef } from '../constants-Dy2Dd3Fz.mjs';
7
2
 
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
- }
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
+ };
43
44
  },
44
- CommentExit(comment) {
45
- if (/#(?:ifn?def|endif)/.test(comment.text)) {
46
- comment.raws.left = " ";
47
- comment.raws.right = " ";
48
- }
49
- }
50
- };
51
- }
52
- };
45
+ };
53
46
  };
54
47
  creator.postcss = true;
55
- var postcss_default = creator;
56
- export {
57
- postcss_default as default
58
- };
48
+
49
+ export { creator as default };
@@ -0,0 +1,2 @@
1
+ declare function createDebug(prefix?: string): (formatter: any, ...args: any[]) => void;
2
+ export { createDebug };