weapp-tailwindcss 3.7.0 → 3.8.0-alpha.1

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-2STNBSVB.js +216 -0
  3. package/dist/chunk-35CYTBPM.js +26 -0
  4. package/dist/chunk-6FNC3XMI.js +45 -0
  5. package/dist/chunk-6Z776ZWK.js +43 -0
  6. package/dist/chunk-75EWCRQW.mjs +13 -0
  7. package/dist/chunk-AB467PG7.mjs +43 -0
  8. package/dist/chunk-AXBFBHS2.mjs +45 -0
  9. package/dist/chunk-EODGLB63.mjs +173 -0
  10. package/dist/chunk-FG63RW47.mjs +7106 -0
  11. package/dist/chunk-HBQASQKY.js +13 -0
  12. package/dist/chunk-IETFIAKJ.js +152 -0
  13. package/dist/chunk-KE7J6XFD.mjs +537 -0
  14. package/dist/chunk-LQN2VTMU.js +537 -0
  15. package/dist/chunk-LWRZXI5T.js +1003 -0
  16. package/dist/chunk-MUJ65IQ3.mjs +26 -0
  17. package/dist/chunk-MWTUP5KG.mjs +1003 -0
  18. package/dist/chunk-NLFQ7XRK.mjs +152 -0
  19. package/dist/chunk-QEEWOML6.mjs +216 -0
  20. package/dist/chunk-RFNUATFD.js +24 -0
  21. package/dist/chunk-U7O2XXYR.mjs +24 -0
  22. package/dist/chunk-VKSQ6BRD.mjs +27 -0
  23. package/dist/chunk-XSZXPWWL.js +27 -0
  24. package/dist/chunk-YSEHQ3FF.js +173 -0
  25. package/dist/chunk-YYT4NLHK.js +7109 -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 +29 -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
@@ -1,174 +0,0 @@
1
- import { g as getOptions, _ as __awaiter } from './options-yXyCFCtr.mjs';
2
- import fs from 'node:fs';
3
- import path from 'node:path';
4
- import { b as pluginName } from './index-BF8k8rHr.mjs';
5
- import { c as createDebug } from './index-BEIjgKpF.mjs';
6
- import { g as getGroupedEntries, r as removeExt } from './defaults-5A8JI2hW.mjs';
7
-
8
- const debug = createDebug();
9
- class UnifiedWebpackPluginV5 {
10
- constructor(options = {}) {
11
- this.options = getOptions(options);
12
- this.appType = this.options.appType;
13
- }
14
- apply(compiler) {
15
- const { mainCssChunkMatcher, disabled, onLoad, onUpdate, onEnd, onStart, styleHandler, patch, templateHandler, jsHandler, setMangleRuntimeSet, runtimeLoaderPath, cache, twPatcher, } = this.options;
16
- if (disabled) {
17
- return;
18
- }
19
- patch === null || patch === void 0 ? void 0 : patch();
20
- const { Compilation, sources, NormalModule } = compiler.webpack;
21
- const { ConcatSource, RawSource } = sources;
22
- function getClassSet() {
23
- return twPatcher.getClassSet();
24
- }
25
- onLoad();
26
- const loader = runtimeLoaderPath !== null && runtimeLoaderPath !== void 0 ? runtimeLoaderPath : path.resolve(__dirname, './weapp-tw-runtime-loader.js');
27
- const isExisted = fs.existsSync(loader);
28
- const WeappTwRuntimeAopLoader = {
29
- loader,
30
- options: {
31
- getClassSet,
32
- },
33
- ident: null,
34
- type: null,
35
- };
36
- compiler.hooks.compilation.tap(pluginName, (compilation) => {
37
- NormalModule.getCompilationHooks(compilation).loader.tap(pluginName, (_loaderContext, module) => {
38
- if (isExisted) {
39
- const idx = module.loaders.findIndex(x => x.loader.includes('postcss-loader'));
40
- if (idx > -1) {
41
- module.loaders.unshift(WeappTwRuntimeAopLoader);
42
- }
43
- }
44
- });
45
- compilation.hooks.processAssets.tapPromise({
46
- name: pluginName,
47
- stage: Compilation.PROCESS_ASSETS_STAGE_SUMMARIZE,
48
- }, (assets) => __awaiter(this, void 0, void 0, function* () {
49
- onStart();
50
- debug('start');
51
- for (const chunk of compilation.chunks) {
52
- if (chunk.id && chunk.hash) {
53
- cache.calcHashValueChanged(chunk.id, chunk.hash);
54
- }
55
- }
56
- const entries = Object.entries(assets);
57
- const groupedEntries = getGroupedEntries(entries, this.options);
58
- const runtimeSet = getClassSet();
59
- setMangleRuntimeSet(runtimeSet);
60
- debug('get runtimeSet, class count: %d', runtimeSet.size);
61
- if (Array.isArray(groupedEntries.html)) {
62
- let noCachedCount = 0;
63
- for (let i = 0; i < groupedEntries.html.length; i++) {
64
- const [file, originalSource] = groupedEntries.html[i];
65
- const rawSource = originalSource.source().toString();
66
- const hash = cache.computeHash(rawSource);
67
- const cacheKey = file;
68
- cache.calcHashValueChanged(cacheKey, hash);
69
- yield cache.process(cacheKey, () => {
70
- const source = cache.get(cacheKey);
71
- if (source) {
72
- compilation.updateAsset(file, source);
73
- debug('html cache hit: %s', file);
74
- }
75
- else {
76
- return false;
77
- }
78
- }, () => __awaiter(this, void 0, void 0, function* () {
79
- const wxml = yield templateHandler(rawSource, {
80
- runtimeSet,
81
- });
82
- const source = new ConcatSource(wxml);
83
- compilation.updateAsset(file, source);
84
- onUpdate(file, rawSource, wxml);
85
- debug('html handle: %s', file);
86
- noCachedCount++;
87
- return {
88
- key: cacheKey,
89
- source,
90
- };
91
- }));
92
- }
93
- debug('html handle finish, total: %d, no-cached: %d', groupedEntries.html.length, noCachedCount);
94
- }
95
- if (Array.isArray(groupedEntries.js)) {
96
- let noCachedCount = 0;
97
- for (let i = 0; i < groupedEntries.js.length; i++) {
98
- const [file, originalSource] = groupedEntries.js[i];
99
- const cacheKey = removeExt(file);
100
- yield cache.process(cacheKey, () => {
101
- const source = cache.get(cacheKey);
102
- if (source) {
103
- compilation.updateAsset(file, source);
104
- debug('js cache hit: %s', file);
105
- }
106
- else {
107
- return false;
108
- }
109
- }, () => __awaiter(this, void 0, void 0, function* () {
110
- const rawSource = originalSource.source().toString();
111
- const mapFilename = `${file}.map`;
112
- const hasMap = Boolean(assets[mapFilename]);
113
- const { code, map } = yield jsHandler(rawSource, runtimeSet, {
114
- generateMap: hasMap,
115
- });
116
- const source = new ConcatSource(code);
117
- compilation.updateAsset(file, source);
118
- onUpdate(file, rawSource, code);
119
- debug('js handle: %s', file);
120
- noCachedCount++;
121
- if (hasMap && map) {
122
- const source = new RawSource(map.toString());
123
- compilation.updateAsset(mapFilename, source);
124
- }
125
- return {
126
- key: cacheKey,
127
- source,
128
- };
129
- }));
130
- }
131
- debug('js handle finish, total: %d, no-cached: %d', groupedEntries.js.length, noCachedCount);
132
- }
133
- if (Array.isArray(groupedEntries.css)) {
134
- let noCachedCount = 0;
135
- for (let i = 0; i < groupedEntries.css.length; i++) {
136
- const [file, originalSource] = groupedEntries.css[i];
137
- const rawSource = originalSource.source().toString();
138
- const hash = cache.computeHash(rawSource);
139
- const cacheKey = file;
140
- cache.calcHashValueChanged(cacheKey, hash);
141
- yield cache.process(cacheKey, () => {
142
- const source = cache.get(cacheKey);
143
- if (source) {
144
- compilation.updateAsset(file, source);
145
- debug('css cache hit: %s', file);
146
- }
147
- else {
148
- return false;
149
- }
150
- }, () => __awaiter(this, void 0, void 0, function* () {
151
- const { css } = yield styleHandler(rawSource, {
152
- isMainChunk: mainCssChunkMatcher(file, this.appType),
153
- });
154
- const source = new ConcatSource(css);
155
- compilation.updateAsset(file, source);
156
- onUpdate(file, rawSource, css);
157
- debug('css handle: %s', file);
158
- noCachedCount++;
159
- return {
160
- key: cacheKey,
161
- source,
162
- };
163
- }));
164
- }
165
- debug('css handle finish, total: %d, no-cached: %d', groupedEntries.css.length, noCachedCount);
166
- }
167
- debug('end');
168
- onEnd();
169
- }));
170
- });
171
- }
172
- }
173
-
174
- export { UnifiedWebpackPluginV5 as U };
@@ -1,31 +0,0 @@
1
- export declare enum State {
2
- START = 0,
3
- TEXT = 1,
4
- OPEN_BRACE = 2,
5
- POTENTIAL_CLOSE = 3,
6
- BRACES_COMPLETE = 4
7
- }
8
- export interface Expression {
9
- start: number;
10
- end: number;
11
- value: string;
12
- }
13
- export interface Token {
14
- start: number;
15
- end: number;
16
- value: string;
17
- expressions: Expression[];
18
- }
19
- export declare class Tokenizer {
20
- private state;
21
- private buffer;
22
- private tokens;
23
- private bufferStartIndex;
24
- private expressionStartIndex;
25
- private expressionBuffer;
26
- private expressions;
27
- constructor();
28
- private processChar;
29
- run(input: string): Token[];
30
- reset(): void;
31
- }
@@ -1,2 +0,0 @@
1
- export { replaceWxml } from './shared';
2
- export { createTemplateHandler, customTemplateHandler, generateCode, templateReplacer } from './utils';
@@ -1,2 +0,0 @@
1
- import type { ITemplateHandlerOptions } from '../types';
2
- export declare function replaceWxml(original: string, options?: ITemplateHandlerOptions): string;
@@ -1,10 +0,0 @@
1
- import type { ItemOrItemArray } from '../reg';
2
- import type { ITemplateHandlerOptions } from '../types';
3
- import type { Token } from './Tokenizer';
4
- import MagicString from 'magic-string';
5
- export declare function generateCode(match: string, options?: ITemplateHandlerOptions): string;
6
- export declare function handleEachClassFragment(ms: MagicString, tokens: Token[], options?: ITemplateHandlerOptions): void;
7
- export declare function templateReplacer(original: string, options?: ITemplateHandlerOptions): string;
8
- export declare function isPropsMatch(props: ItemOrItemArray<string | RegExp>, attr: string): boolean;
9
- export declare function customTemplateHandler(rawSource: string, options: Required<ITemplateHandlerOptions>): Promise<string>;
10
- export declare function createTemplateHandler(options?: Omit<ITemplateHandlerOptions, 'runtimeSet'>): (rawSource: string, opt?: Pick<ITemplateHandlerOptions, "runtimeSet">) => Promise<string>;