weapp-tailwindcss 3.3.7 → 3.4.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 (125) hide show
  1. package/dist/chunk-257YPDSI.mjs +173 -0
  2. package/dist/chunk-75EWCRQW.mjs +13 -0
  3. package/dist/chunk-AB467PG7.mjs +43 -0
  4. package/dist/chunk-E7XGHGC7.mjs +62 -0
  5. package/dist/chunk-GUE4UCRJ.mjs +126 -0
  6. package/dist/chunk-IOYI6MSW.mjs +533 -0
  7. package/dist/chunk-LDWI65M5.mjs +152 -0
  8. package/dist/chunk-NVFWRLOI.mjs +27 -0
  9. package/dist/chunk-ORMKM6ZA.mjs +30 -0
  10. package/dist/chunk-PC4B5JJB.mjs +953 -0
  11. package/dist/chunk-SRLZU2YE.mjs +95 -0
  12. package/dist/chunk-VECXHWWG.mjs +31 -0
  13. package/dist/chunk-VN37QGSM.mjs +216 -0
  14. package/dist/cli.d.mts +2 -0
  15. package/dist/cli.d.ts +2 -1
  16. package/dist/cli.js +1760 -52
  17. package/dist/cli.mjs +34 -46
  18. package/dist/core.d.mts +22 -0
  19. package/dist/core.d.ts +16 -2
  20. package/dist/core.js +1775 -62
  21. package/dist/core.mjs +46 -62
  22. package/dist/css-macro/index.d.mts +18 -0
  23. package/dist/css-macro/index.d.ts +7 -4
  24. package/dist/css-macro/index.js +140 -30
  25. package/dist/css-macro/index.mjs +35 -28
  26. package/dist/css-macro/postcss.d.mts +7 -0
  27. package/dist/css-macro/postcss.d.ts +5 -3
  28. package/dist/css-macro/postcss.js +99 -46
  29. package/dist/css-macro/postcss.mjs +54 -45
  30. package/dist/defaults.d.mts +16 -0
  31. package/dist/defaults.d.ts +16 -2
  32. package/dist/defaults.js +208 -7
  33. package/dist/defaults.mjs +9 -4
  34. package/dist/gulp.d.mts +26 -0
  35. package/dist/gulp.d.ts +26 -1
  36. package/dist/gulp.js +1898 -40
  37. package/dist/gulp.mjs +15 -32
  38. package/dist/index.d.mts +17 -0
  39. package/dist/index.d.ts +17 -4
  40. package/dist/index.js +2291 -44
  41. package/dist/index.mjs +23 -34
  42. package/dist/postcss.d.mts +23 -0
  43. package/dist/postcss.d.ts +23 -1
  44. package/dist/postcss.js +598 -22
  45. package/dist/postcss.mjs +17 -8
  46. package/dist/replace.d.mts +19 -0
  47. package/dist/replace.d.ts +19 -3
  48. package/dist/replace.js +93 -42
  49. package/dist/replace.mjs +30 -26
  50. package/dist/types-DSNuiOhH.d.mts +519 -0
  51. package/dist/types-DSNuiOhH.d.ts +519 -0
  52. package/dist/vite.d.mts +22 -0
  53. package/dist/vite.d.ts +22 -1
  54. package/dist/vite.js +1947 -38
  55. package/dist/vite.mjs +15 -30
  56. package/dist/weapp-tw-runtime-loader.d.mts +7 -0
  57. package/dist/{bundlers/webpack/loaders/weapp-tw-runtime-loader.d.ts → weapp-tw-runtime-loader.d.ts} +4 -2
  58. package/dist/weapp-tw-runtime-loader.js +41 -14
  59. package/dist/weapp-tw-runtime-loader.mjs +12 -8
  60. package/dist/webpack.d.mts +26 -0
  61. package/dist/webpack.d.ts +26 -1
  62. package/dist/webpack.js +1994 -38
  63. package/dist/webpack.mjs +15 -30
  64. package/dist/webpack4.d.mts +27 -0
  65. package/dist/webpack4.d.ts +27 -1
  66. package/dist/webpack4.js +1979 -191
  67. package/dist/webpack4.mjs +211 -189
  68. package/package.json +18 -19
  69. package/dist/babel/index.d.ts +0 -16
  70. package/dist/bundlers/gulp/index.d.ts +0 -8
  71. package/dist/bundlers/vite/index.d.ts +0 -3
  72. package/dist/bundlers/webpack/BaseUnifiedPlugin/v4.d.ts +0 -8
  73. package/dist/bundlers/webpack/BaseUnifiedPlugin/v5.d.ts +0 -8
  74. package/dist/bundlers/webpack/index.d.ts +0 -1
  75. package/dist/cache/index.d.ts +0 -32
  76. package/dist/constants-CFM1J-h1.js +0 -42
  77. package/dist/constants-Dy2Dd3Fz.mjs +0 -36
  78. package/dist/constants.d.ts +0 -7
  79. package/dist/css-macro/constants.d.ts +0 -14
  80. package/dist/debug/index.d.ts +0 -2
  81. package/dist/defaults-DUZZvtdg.mjs +0 -149
  82. package/dist/defaults-syv_N3uk.js +0 -156
  83. package/dist/defu-Cdz2PomB.js +0 -60
  84. package/dist/defu-n46TJT6t.mjs +0 -57
  85. package/dist/env.d.ts +0 -2
  86. package/dist/escape.d.ts +0 -4
  87. package/dist/extractors/split.d.ts +0 -3
  88. package/dist/index-B8TOcVAt.js +0 -130
  89. package/dist/index-BEIjgKpF.mjs +0 -11
  90. package/dist/index-BKZH-Gxq.mjs +0 -134
  91. package/dist/index-BPzIdybK.mjs +0 -513
  92. package/dist/index-Bc61v7B0.mjs +0 -124
  93. package/dist/index-DXeB6ex8.js +0 -136
  94. package/dist/index-DwZHOkK3.js +0 -526
  95. package/dist/index-HC-Qkn0i.js +0 -17
  96. package/dist/js/handlers.d.ts +0 -13
  97. package/dist/js/index.d.ts +0 -7
  98. package/dist/mangle/index.d.ts +0 -8
  99. package/dist/options-BHJnjA_a.mjs +0 -981
  100. package/dist/options-DAp5AdGz.js +0 -1014
  101. package/dist/options.d.ts +0 -2
  102. package/dist/postcss/cssVars.d.ts +0 -5
  103. package/dist/postcss/index.d.ts +0 -3
  104. package/dist/postcss/mp.d.ts +0 -8
  105. package/dist/postcss/plugins/ctx.d.ts +0 -6
  106. package/dist/postcss/plugins/index.d.ts +0 -7
  107. package/dist/postcss/plugins/post.d.ts +0 -5
  108. package/dist/postcss/plugins/pre.d.ts +0 -5
  109. package/dist/postcss/preflight.d.ts +0 -3
  110. package/dist/postcss/selectorParser.d.ts +0 -6
  111. package/dist/postcss/shared.d.ts +0 -3
  112. package/dist/postcss/symbols.d.ts +0 -1
  113. package/dist/reg.d.ts +0 -1
  114. package/dist/shared-DbJl6i6a.mjs +0 -25
  115. package/dist/shared-hzYeE1wX.js +0 -28
  116. package/dist/tailwindcss/patcher.d.ts +0 -8
  117. package/dist/tailwindcss/supportCustomUnit.d.ts +0 -6
  118. package/dist/types.d.ts +0 -179
  119. package/dist/utils.d.ts +0 -18
  120. package/dist/v5-B9S3lBOs.mjs +0 -174
  121. package/dist/v5-QURRYPNk.js +0 -181
  122. package/dist/wxml/Tokenizer.d.ts +0 -31
  123. package/dist/wxml/index.d.ts +0 -2
  124. package/dist/wxml/shared.d.ts +0 -2
  125. package/dist/wxml/utils.d.ts +0 -9
@@ -1,181 +0,0 @@
1
- 'use strict';
2
-
3
- var options = require('./options-DAp5AdGz.js');
4
- var path = require('node:path');
5
- var fs = require('node:fs');
6
- var index = require('./index-DwZHOkK3.js');
7
- var defaults = require('./defaults-syv_N3uk.js');
8
- var index$1 = require('./index-HC-Qkn0i.js');
9
-
10
- function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
11
-
12
- var path__default = /*#__PURE__*/_interopDefaultCompat(path);
13
- var fs__default = /*#__PURE__*/_interopDefaultCompat(fs);
14
-
15
- const debug = index$1.createDebug();
16
- class UnifiedWebpackPluginV5 {
17
- constructor(options$1 = {}) {
18
- this.options = options.getOptions(options$1);
19
- this.appType = this.options.appType;
20
- }
21
- apply(compiler) {
22
- const { mainCssChunkMatcher, disabled, onLoad, onUpdate, onEnd, onStart, styleHandler, patch, templateHandler, jsHandler, setMangleRuntimeSet, runtimeLoaderPath, cache, twPatcher, } = this.options;
23
- if (disabled) {
24
- return;
25
- }
26
- patch === null || patch === void 0 ? void 0 : patch();
27
- const { Compilation, sources, NormalModule } = compiler.webpack;
28
- const { ConcatSource, RawSource } = sources;
29
- function getClassSet() {
30
- return twPatcher.getClassSet();
31
- }
32
- onLoad();
33
- const loader = runtimeLoaderPath !== null && runtimeLoaderPath !== void 0 ? runtimeLoaderPath : path__default["default"].resolve(__dirname, './weapp-tw-runtime-loader.js');
34
- const isExisted = fs__default["default"].existsSync(loader);
35
- const WeappTwRuntimeAopLoader = {
36
- loader,
37
- options: {
38
- getClassSet,
39
- },
40
- ident: null,
41
- type: null,
42
- };
43
- compiler.hooks.compilation.tap(index.pluginName, (compilation) => {
44
- NormalModule.getCompilationHooks(compilation).loader.tap(index.pluginName, (_loaderContext, module) => {
45
- if (isExisted) {
46
- const idx = module.loaders.findIndex(x => x.loader.includes('postcss-loader'));
47
- if (idx > -1) {
48
- module.loaders.unshift(WeappTwRuntimeAopLoader);
49
- }
50
- }
51
- });
52
- compilation.hooks.processAssets.tapPromise({
53
- name: index.pluginName,
54
- stage: Compilation.PROCESS_ASSETS_STAGE_SUMMARIZE,
55
- }, (assets) => options.__awaiter(this, void 0, void 0, function* () {
56
- onStart();
57
- debug('start');
58
- for (const chunk of compilation.chunks) {
59
- if (chunk.id && chunk.hash) {
60
- cache.calcHashValueChanged(chunk.id, chunk.hash);
61
- }
62
- }
63
- const entries = Object.entries(assets);
64
- const groupedEntries = defaults.getGroupedEntries(entries, this.options);
65
- const runtimeSet = getClassSet();
66
- setMangleRuntimeSet(runtimeSet);
67
- debug('get runtimeSet, class count: %d', runtimeSet.size);
68
- if (Array.isArray(groupedEntries.html)) {
69
- let noCachedCount = 0;
70
- for (let i = 0; i < groupedEntries.html.length; i++) {
71
- const [file, originalSource] = groupedEntries.html[i];
72
- const rawSource = originalSource.source().toString();
73
- const hash = cache.computeHash(rawSource);
74
- const cacheKey = file;
75
- cache.calcHashValueChanged(cacheKey, hash);
76
- yield cache.process(cacheKey, () => {
77
- const source = cache.get(cacheKey);
78
- if (source) {
79
- compilation.updateAsset(file, source);
80
- debug('html cache hit: %s', file);
81
- }
82
- else {
83
- return false;
84
- }
85
- }, () => options.__awaiter(this, void 0, void 0, function* () {
86
- const wxml = yield templateHandler(rawSource, {
87
- runtimeSet,
88
- });
89
- const source = new ConcatSource(wxml);
90
- compilation.updateAsset(file, source);
91
- onUpdate(file, rawSource, wxml);
92
- debug('html handle: %s', file);
93
- noCachedCount++;
94
- return {
95
- key: cacheKey,
96
- source,
97
- };
98
- }));
99
- }
100
- debug('html handle finish, total: %d, no-cached: %d', groupedEntries.html.length, noCachedCount);
101
- }
102
- if (Array.isArray(groupedEntries.js)) {
103
- let noCachedCount = 0;
104
- for (let i = 0; i < groupedEntries.js.length; i++) {
105
- const [file, originalSource] = groupedEntries.js[i];
106
- const cacheKey = defaults.removeExt(file);
107
- yield cache.process(cacheKey, () => {
108
- const source = cache.get(cacheKey);
109
- if (source) {
110
- compilation.updateAsset(file, source);
111
- debug('js cache hit: %s', file);
112
- }
113
- else {
114
- return false;
115
- }
116
- }, () => options.__awaiter(this, void 0, void 0, function* () {
117
- const rawSource = originalSource.source().toString();
118
- const mapFilename = `${file}.map`;
119
- const hasMap = Boolean(assets[mapFilename]);
120
- const { code, map } = yield jsHandler(rawSource, runtimeSet, {
121
- generateMap: hasMap,
122
- });
123
- const source = new ConcatSource(code);
124
- compilation.updateAsset(file, source);
125
- onUpdate(file, rawSource, code);
126
- debug('js handle: %s', file);
127
- noCachedCount++;
128
- if (hasMap && map) {
129
- const source = new RawSource(map.toString());
130
- compilation.updateAsset(mapFilename, source);
131
- }
132
- return {
133
- key: cacheKey,
134
- source,
135
- };
136
- }));
137
- }
138
- debug('js handle finish, total: %d, no-cached: %d', groupedEntries.js.length, noCachedCount);
139
- }
140
- if (Array.isArray(groupedEntries.css)) {
141
- let noCachedCount = 0;
142
- for (let i = 0; i < groupedEntries.css.length; i++) {
143
- const [file, originalSource] = groupedEntries.css[i];
144
- const rawSource = originalSource.source().toString();
145
- const hash = cache.computeHash(rawSource);
146
- const cacheKey = file;
147
- cache.calcHashValueChanged(cacheKey, hash);
148
- yield cache.process(cacheKey, () => {
149
- const source = cache.get(cacheKey);
150
- if (source) {
151
- compilation.updateAsset(file, source);
152
- debug('css cache hit: %s', file);
153
- }
154
- else {
155
- return false;
156
- }
157
- }, () => options.__awaiter(this, void 0, void 0, function* () {
158
- const css = yield styleHandler(rawSource, {
159
- isMainChunk: mainCssChunkMatcher(file, this.appType),
160
- });
161
- const source = new ConcatSource(css);
162
- compilation.updateAsset(file, source);
163
- onUpdate(file, rawSource, css);
164
- debug('css handle: %s', file);
165
- noCachedCount++;
166
- return {
167
- key: cacheKey,
168
- source,
169
- };
170
- }));
171
- }
172
- debug('css handle finish, total: %d, no-cached: %d', groupedEntries.css.length, noCachedCount);
173
- }
174
- debug('end');
175
- onEnd();
176
- }));
177
- });
178
- }
179
- }
180
-
181
- exports.UnifiedWebpackPluginV5 = UnifiedWebpackPluginV5;
@@ -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 { generateCode, templateReplacer, customTemplateHandler, createTemplateHandler, extractSource } from './utils';
@@ -1,2 +0,0 @@
1
- import type { ITemplateHandlerOptions } from "../types";
2
- export declare function replaceWxml(original: string, options?: ITemplateHandlerOptions): string;
@@ -1,9 +0,0 @@
1
- import type { ItemOrItemArray } from "../reg";
2
- import type { ITemplateHandlerOptions, RawSource } from "../types";
3
- export declare function generateCode(match: string, options?: ITemplateHandlerOptions): string;
4
- export declare function extractSource(original: string): RawSource[];
5
- export declare function handleEachClassFragment(original: string, options?: ITemplateHandlerOptions): string;
6
- export declare function templateReplacer(original: string, options?: ITemplateHandlerOptions): string;
7
- export declare function isPropsMatch(props: ItemOrItemArray<string | RegExp>, attr: string): boolean;
8
- export declare function customTemplateHandler(rawSource: string, options: Required<ITemplateHandlerOptions>): Promise<string>;
9
- export declare function createTemplateHandler(options?: Omit<ITemplateHandlerOptions, 'runtimeSet'>): (rawSource: string, opt?: Pick<ITemplateHandlerOptions, 'runtimeSet'>) => Promise<string>;