weapp-tailwindcss 2.4.4 → 2.6.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.
- package/README.md +2 -8
- package/dist/cli.js +2 -2
- package/dist/cli.mjs +2 -2
- package/dist/constants.d.ts +1 -1
- package/dist/gulp.js +9 -7
- package/dist/gulp.mjs +9 -7
- package/dist/index.js +4 -4
- package/dist/index.mjs +4 -4
- package/dist/{options-887b74ca.js → options-487394fa.js} +50 -36
- package/dist/{options-879de0a2.mjs → options-f7b71f03.mjs} +50 -36
- package/dist/postcss/cssVars.d.ts +5 -0
- package/dist/postcss/mp.d.ts +4 -0
- package/dist/postcss-760298ba.mjs +351 -0
- package/dist/postcss-b53e9504.js +359 -0
- package/dist/postcss.js +1 -1
- package/dist/postcss.mjs +1 -1
- package/dist/reg.d.ts +1 -1
- package/dist/types.d.ts +8 -3
- package/dist/vite.js +8 -6
- package/dist/vite.mjs +8 -6
- package/dist/weapp-tw-runtime-loader.js +16 -0
- package/dist/weapp-tw-runtime-loader.mjs +10 -0
- package/dist/webpack/BaseUnifiedPlugin/v5.d.ts +0 -1
- package/dist/webpack/loaders/weapp-tw-runtime-loader.d.ts +5 -0
- package/dist/webpack.js +36 -19
- package/dist/webpack.mjs +31 -19
- package/dist/wxml/index.d.ts +1 -1
- package/dist/wxml/utils.d.ts +2 -2
- package/package.json +39 -32
- package/dist/postcss-33ef0bd0.js +0 -125
- package/dist/postcss-ea625621.mjs +0 -116
package/dist/postcss.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { p as postcssWeappTailwindcss } from './postcss-
|
|
1
|
+
export { p as postcssWeappTailwindcss } from './postcss-760298ba.mjs';
|
|
2
2
|
export { default as postcssIsPseudoClass } from '@csstools/postcss-is-pseudo-class';
|
|
3
3
|
import 'postcss-selector-parser';
|
|
4
4
|
import './shared-7c88fb94.mjs';
|
package/dist/reg.d.ts
CHANGED
|
@@ -12,13 +12,13 @@ export declare function createTempleteHandlerMatchRegexp(tag: string | RegExp, a
|
|
|
12
12
|
export declare function createTemplateClassRegexp(attrs: ItemOrItemArray<string | RegExp>, options?: ICreateRegexpOptions): RegExp;
|
|
13
13
|
export declare function makeCustomAttributes(entries?: [string | RegExp, ItemOrItemArray<string | RegExp>][]): ICustomRegexp[] | undefined;
|
|
14
14
|
export declare const variableRegExp: RegExp;
|
|
15
|
-
export declare function variableMatch(original: string): RegExpExecArray | null;
|
|
16
15
|
export declare const classRegexp: RegExp;
|
|
17
16
|
export declare const vueTemplateClassRegexp: RegExp;
|
|
18
17
|
export declare const tagRegexp: RegExp;
|
|
19
18
|
export declare const tagWithClassRegexp: RegExp;
|
|
20
19
|
export declare function classStringReplace(str: string, replacement: (substring: string, ...args: any[]) => string): string;
|
|
21
20
|
export declare function tagStringReplace(str: string, replacement: (substring: string, ...args: any[]) => string): string;
|
|
21
|
+
export declare const wxsTagRegexp: RegExp;
|
|
22
22
|
export declare const wxmlAllowClassCharsRegExp: RegExp;
|
|
23
23
|
export declare function createWxmlAllowClassCharsRegExp(): RegExp;
|
|
24
24
|
export declare const doubleQuoteRegexp: RegExp;
|
package/dist/types.d.ts
CHANGED
|
@@ -19,6 +19,7 @@ export type RequiredStyleHandlerOptions = {
|
|
|
19
19
|
cssChildCombinatorReplaceValue?: string | string[];
|
|
20
20
|
replaceUniversalSelectorWith?: string | false;
|
|
21
21
|
escapeMap?: Record<string, string>;
|
|
22
|
+
injectAdditionalCssVarScope?: boolean;
|
|
22
23
|
};
|
|
23
24
|
export type CustomRuleCallback = (node: Rule, options: Readonly<RequiredStyleHandlerOptions>) => void;
|
|
24
25
|
export interface InternalCssSelectorReplacerOptions {
|
|
@@ -43,8 +44,6 @@ export interface RawSource {
|
|
|
43
44
|
end: number;
|
|
44
45
|
raw: string;
|
|
45
46
|
source?: string;
|
|
46
|
-
prevConcatenated: boolean;
|
|
47
|
-
nextConcatenated: boolean;
|
|
48
47
|
}
|
|
49
48
|
export interface ILengthUnitsPatchDangerousOptions {
|
|
50
49
|
packageName?: string;
|
|
@@ -89,6 +88,9 @@ export interface UserDefinedOptions {
|
|
|
89
88
|
mangle?: boolean | IMangleOptions;
|
|
90
89
|
arbitraryValues?: IArbitraryValues;
|
|
91
90
|
cssChildCombinatorReplaceValue?: string | string[];
|
|
91
|
+
wxsMatcher?: ((name: string) => boolean) | string | string[];
|
|
92
|
+
inlineWxs?: boolean;
|
|
93
|
+
injectAdditionalCssVarScope?: boolean;
|
|
92
94
|
}
|
|
93
95
|
export interface IMangleScopeContext {
|
|
94
96
|
rawOptions: UserDefinedOptions['mangle'];
|
|
@@ -113,8 +115,11 @@ export interface ITempleteHandlerOptions extends ICommonReplaceOptions {
|
|
|
113
115
|
customAttributesEntities?: ICustomAttributesEntities;
|
|
114
116
|
escapeMap?: Record<string, string>;
|
|
115
117
|
mangleContext?: IMangleScopeContext;
|
|
118
|
+
inlineWxs?: boolean;
|
|
119
|
+
jsHandler?: (rawSource: string, set: Set<string>) => GeneratorResult;
|
|
120
|
+
runtimeSet?: Set<string>;
|
|
116
121
|
}
|
|
117
|
-
export type GlobOrFunctionMatchers = 'htmlMatcher' | 'cssMatcher' | 'jsMatcher' | 'mainCssChunkMatcher';
|
|
122
|
+
export type GlobOrFunctionMatchers = 'htmlMatcher' | 'cssMatcher' | 'jsMatcher' | 'mainCssChunkMatcher' | 'wxsMatcher';
|
|
118
123
|
export type InternalUserDefinedOptions = Required<Omit<UserDefinedOptions, GlobOrFunctionMatchers | 'supportCustomLengthUnitsPatch' | 'customReplaceDictionary'> & {
|
|
119
124
|
[K in GlobOrFunctionMatchers]: K extends 'mainCssChunkMatcher' ? (name: string, appType?: AppType) => boolean : (name: string) => boolean;
|
|
120
125
|
} & {
|
package/dist/vite.js
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var options = require('./options-
|
|
6
|
-
var postcss = require('./postcss-
|
|
5
|
+
var options = require('./options-487394fa.js');
|
|
6
|
+
var postcss = require('./postcss-b53e9504.js');
|
|
7
7
|
require('micromatch');
|
|
8
8
|
require('@babel/types');
|
|
9
9
|
require('@babel/generator');
|
|
@@ -41,13 +41,15 @@ function UnifiedViteWeappTailwindcssPlugin(options$1 = {}) {
|
|
|
41
41
|
generateBundle(opt, bundle, isWrite) {
|
|
42
42
|
const entries = Object.entries(bundle);
|
|
43
43
|
const groupedEntries = options.getGroupedEntries(entries, opts);
|
|
44
|
-
const
|
|
45
|
-
setMangleRuntimeSet(
|
|
44
|
+
const runtimeSet = twPatcher.getClassSet();
|
|
45
|
+
setMangleRuntimeSet(runtimeSet);
|
|
46
46
|
if (Array.isArray(groupedEntries.html)) {
|
|
47
47
|
for (let i = 0; i < groupedEntries.html.length; i++) {
|
|
48
48
|
const [file, originalSource] = groupedEntries.html[i];
|
|
49
49
|
const oldVal = originalSource.source.toString();
|
|
50
|
-
originalSource.source = templeteHandler(oldVal
|
|
50
|
+
originalSource.source = templeteHandler(oldVal, {
|
|
51
|
+
runtimeSet
|
|
52
|
+
});
|
|
51
53
|
onUpdate(file, oldVal, originalSource.source);
|
|
52
54
|
}
|
|
53
55
|
}
|
|
@@ -66,7 +68,7 @@ function UnifiedViteWeappTailwindcssPlugin(options$1 = {}) {
|
|
|
66
68
|
for (let i = 0; i < groupedEntries.js.length; i++) {
|
|
67
69
|
const [file, originalSource] = groupedEntries.js[i];
|
|
68
70
|
const rawSource = originalSource.code;
|
|
69
|
-
const { code } = jsHandler(rawSource,
|
|
71
|
+
const { code } = jsHandler(rawSource, runtimeSet);
|
|
70
72
|
originalSource.code = code;
|
|
71
73
|
onUpdate(file, rawSource, code);
|
|
72
74
|
}
|
package/dist/vite.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { g as getOptions, a as createTailwindcssPatcher, b as getGroupedEntries } from './options-
|
|
2
|
-
import { v as vitePluginName } from './postcss-
|
|
1
|
+
import { g as getOptions, a as createTailwindcssPatcher, b as getGroupedEntries } from './options-f7b71f03.mjs';
|
|
2
|
+
import { v as vitePluginName } from './postcss-760298ba.mjs';
|
|
3
3
|
import 'micromatch';
|
|
4
4
|
import '@babel/types';
|
|
5
5
|
import '@babel/generator';
|
|
@@ -37,13 +37,15 @@ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
|
|
|
37
37
|
generateBundle(opt, bundle, isWrite) {
|
|
38
38
|
const entries = Object.entries(bundle);
|
|
39
39
|
const groupedEntries = getGroupedEntries(entries, opts);
|
|
40
|
-
const
|
|
41
|
-
setMangleRuntimeSet(
|
|
40
|
+
const runtimeSet = twPatcher.getClassSet();
|
|
41
|
+
setMangleRuntimeSet(runtimeSet);
|
|
42
42
|
if (Array.isArray(groupedEntries.html)) {
|
|
43
43
|
for (let i = 0; i < groupedEntries.html.length; i++) {
|
|
44
44
|
const [file, originalSource] = groupedEntries.html[i];
|
|
45
45
|
const oldVal = originalSource.source.toString();
|
|
46
|
-
originalSource.source = templeteHandler(oldVal
|
|
46
|
+
originalSource.source = templeteHandler(oldVal, {
|
|
47
|
+
runtimeSet
|
|
48
|
+
});
|
|
47
49
|
onUpdate(file, oldVal, originalSource.source);
|
|
48
50
|
}
|
|
49
51
|
}
|
|
@@ -62,7 +64,7 @@ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
|
|
|
62
64
|
for (let i = 0; i < groupedEntries.js.length; i++) {
|
|
63
65
|
const [file, originalSource] = groupedEntries.js[i];
|
|
64
66
|
const rawSource = originalSource.code;
|
|
65
|
-
const { code } = jsHandler(rawSource,
|
|
67
|
+
const { code } = jsHandler(rawSource, runtimeSet);
|
|
66
68
|
originalSource.code = code;
|
|
67
69
|
onUpdate(file, rawSource, code);
|
|
68
70
|
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var loaderUtils = require('loader-utils');
|
|
4
|
+
|
|
5
|
+
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
6
|
+
|
|
7
|
+
var loaderUtils__default = /*#__PURE__*/_interopDefaultCompat(loaderUtils);
|
|
8
|
+
|
|
9
|
+
const WeappTwRuntimeAopLoader = function (source) {
|
|
10
|
+
var _a;
|
|
11
|
+
const opt = loaderUtils__default["default"].getOptions(this);
|
|
12
|
+
(_a = opt === null || opt === void 0 ? void 0 : opt.getClassSet) === null || _a === void 0 ? void 0 : _a.call(opt);
|
|
13
|
+
return source;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
module.exports = WeappTwRuntimeAopLoader;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import loaderUtils from 'loader-utils';
|
|
2
|
+
|
|
3
|
+
const WeappTwRuntimeAopLoader = function (source) {
|
|
4
|
+
var _a;
|
|
5
|
+
const opt = loaderUtils.getOptions(this);
|
|
6
|
+
(_a = opt === null || opt === void 0 ? void 0 : opt.getClassSet) === null || _a === void 0 ? void 0 : _a.call(opt);
|
|
7
|
+
return source;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export { WeappTwRuntimeAopLoader as default };
|
|
@@ -3,7 +3,6 @@ import type { AppType, UserDefinedOptions, InternalUserDefinedOptions, IBaseWebp
|
|
|
3
3
|
export declare class UnifiedWebpackPluginV5 implements IBaseWebpackPlugin {
|
|
4
4
|
options: InternalUserDefinedOptions;
|
|
5
5
|
appType?: AppType;
|
|
6
|
-
static NS: string;
|
|
7
6
|
constructor(options?: UserDefinedOptions);
|
|
8
7
|
apply(compiler: Compiler): void;
|
|
9
8
|
}
|
package/dist/webpack.js
CHANGED
|
@@ -2,8 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var
|
|
6
|
-
var
|
|
5
|
+
var path = require('node:path');
|
|
6
|
+
var fs = require('node:fs');
|
|
7
|
+
var options = require('./options-487394fa.js');
|
|
8
|
+
var postcss = require('./postcss-b53e9504.js');
|
|
7
9
|
require('micromatch');
|
|
8
10
|
require('@babel/types');
|
|
9
11
|
require('@babel/generator');
|
|
@@ -13,13 +15,16 @@ require('./replace.js');
|
|
|
13
15
|
require('./shared-ae7dd073.js');
|
|
14
16
|
require('postcss');
|
|
15
17
|
require('@csstools/postcss-is-pseudo-class');
|
|
16
|
-
require('node:path');
|
|
17
|
-
require('node:fs');
|
|
18
18
|
require('semver');
|
|
19
19
|
require('tailwindcss-patch');
|
|
20
20
|
require('tailwindcss-mangle-shared');
|
|
21
21
|
require('postcss-selector-parser');
|
|
22
22
|
|
|
23
|
+
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
24
|
+
|
|
25
|
+
var path__default = /*#__PURE__*/_interopDefaultCompat(path);
|
|
26
|
+
var fs__default = /*#__PURE__*/_interopDefaultCompat(fs);
|
|
27
|
+
|
|
23
28
|
class UnifiedWebpackPluginV5 {
|
|
24
29
|
constructor(options$1 = {}) {
|
|
25
30
|
if (options$1.customReplaceDictionary === undefined) {
|
|
@@ -34,21 +39,32 @@ class UnifiedWebpackPluginV5 {
|
|
|
34
39
|
return;
|
|
35
40
|
}
|
|
36
41
|
patch === null || patch === void 0 ? void 0 : patch();
|
|
37
|
-
const Compilation = compiler.webpack
|
|
38
|
-
const { ConcatSource } =
|
|
42
|
+
const { Compilation, sources, NormalModule } = compiler.webpack;
|
|
43
|
+
const { ConcatSource } = sources;
|
|
39
44
|
const twPatcher = options.createTailwindcssPatcher();
|
|
40
45
|
function getClassSet() {
|
|
41
|
-
|
|
42
|
-
if (set.size === 0) {
|
|
43
|
-
const cacheSet = twPatcher.getCache();
|
|
44
|
-
if (cacheSet && cacheSet.size > 0) {
|
|
45
|
-
set = cacheSet;
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
return set;
|
|
46
|
+
return twPatcher.getClassSet();
|
|
49
47
|
}
|
|
50
48
|
onLoad();
|
|
49
|
+
const loader = path__default["default"].resolve(__dirname, './weapp-tw-runtime-loader.js');
|
|
50
|
+
const isExisted = fs__default["default"].existsSync(loader);
|
|
51
|
+
const WeappTwRuntimeAopLoader = {
|
|
52
|
+
loader,
|
|
53
|
+
options: {
|
|
54
|
+
getClassSet
|
|
55
|
+
},
|
|
56
|
+
ident: null,
|
|
57
|
+
type: null
|
|
58
|
+
};
|
|
51
59
|
compiler.hooks.compilation.tap(postcss.pluginName, (compilation) => {
|
|
60
|
+
NormalModule.getCompilationHooks(compilation).loader.tap(postcss.pluginName, (loaderContext, module) => {
|
|
61
|
+
if (isExisted) {
|
|
62
|
+
const idx = module.loaders.findIndex((x) => x.loader.includes('postcss-loader'));
|
|
63
|
+
if (idx > -1) {
|
|
64
|
+
module.loaders.unshift(WeappTwRuntimeAopLoader);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
});
|
|
52
68
|
compilation.hooks.processAssets.tap({
|
|
53
69
|
name: postcss.pluginName,
|
|
54
70
|
stage: Compilation.PROCESS_ASSETS_STAGE_SUMMARIZE
|
|
@@ -56,13 +72,15 @@ class UnifiedWebpackPluginV5 {
|
|
|
56
72
|
onStart();
|
|
57
73
|
const entries = Object.entries(assets);
|
|
58
74
|
const groupedEntries = options.getGroupedEntries(entries, this.options);
|
|
59
|
-
const
|
|
60
|
-
setMangleRuntimeSet(
|
|
75
|
+
const runtimeSet = getClassSet();
|
|
76
|
+
setMangleRuntimeSet(runtimeSet);
|
|
61
77
|
if (Array.isArray(groupedEntries.html)) {
|
|
62
78
|
for (let i = 0; i < groupedEntries.html.length; i++) {
|
|
63
79
|
const [file, originalSource] = groupedEntries.html[i];
|
|
64
80
|
const rawSource = originalSource.source().toString();
|
|
65
|
-
const wxml = templeteHandler(rawSource
|
|
81
|
+
const wxml = templeteHandler(rawSource, {
|
|
82
|
+
runtimeSet
|
|
83
|
+
});
|
|
66
84
|
const source = new ConcatSource(wxml);
|
|
67
85
|
compilation.updateAsset(file, source);
|
|
68
86
|
onUpdate(file, rawSource, wxml);
|
|
@@ -72,7 +90,7 @@ class UnifiedWebpackPluginV5 {
|
|
|
72
90
|
for (let i = 0; i < groupedEntries.js.length; i++) {
|
|
73
91
|
const [file, originalSource] = groupedEntries.js[i];
|
|
74
92
|
const rawSource = originalSource.source().toString();
|
|
75
|
-
const { code } = jsHandler(rawSource,
|
|
93
|
+
const { code } = jsHandler(rawSource, runtimeSet);
|
|
76
94
|
const source = new ConcatSource(code);
|
|
77
95
|
compilation.updateAsset(file, source);
|
|
78
96
|
onUpdate(file, rawSource, code);
|
|
@@ -95,6 +113,5 @@ class UnifiedWebpackPluginV5 {
|
|
|
95
113
|
});
|
|
96
114
|
}
|
|
97
115
|
}
|
|
98
|
-
UnifiedWebpackPluginV5.NS = postcss.NS;
|
|
99
116
|
|
|
100
117
|
exports.UnifiedWebpackPluginV5 = UnifiedWebpackPluginV5;
|
package/dist/webpack.mjs
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import path from 'node:path';
|
|
2
|
+
import fs from 'node:fs';
|
|
3
|
+
import { g as getOptions, a as createTailwindcssPatcher, b as getGroupedEntries } from './options-f7b71f03.mjs';
|
|
4
|
+
import { a as pluginName } from './postcss-760298ba.mjs';
|
|
3
5
|
import 'micromatch';
|
|
4
6
|
import '@babel/types';
|
|
5
7
|
import '@babel/generator';
|
|
@@ -9,8 +11,6 @@ import './replace.mjs';
|
|
|
9
11
|
import './shared-7c88fb94.mjs';
|
|
10
12
|
import 'postcss';
|
|
11
13
|
import '@csstools/postcss-is-pseudo-class';
|
|
12
|
-
import 'node:path';
|
|
13
|
-
import 'node:fs';
|
|
14
14
|
import 'semver';
|
|
15
15
|
import 'tailwindcss-patch';
|
|
16
16
|
import 'tailwindcss-mangle-shared';
|
|
@@ -30,21 +30,32 @@ class UnifiedWebpackPluginV5 {
|
|
|
30
30
|
return;
|
|
31
31
|
}
|
|
32
32
|
patch === null || patch === void 0 ? void 0 : patch();
|
|
33
|
-
const Compilation = compiler.webpack
|
|
34
|
-
const { ConcatSource } =
|
|
33
|
+
const { Compilation, sources, NormalModule } = compiler.webpack;
|
|
34
|
+
const { ConcatSource } = sources;
|
|
35
35
|
const twPatcher = createTailwindcssPatcher();
|
|
36
36
|
function getClassSet() {
|
|
37
|
-
|
|
38
|
-
if (set.size === 0) {
|
|
39
|
-
const cacheSet = twPatcher.getCache();
|
|
40
|
-
if (cacheSet && cacheSet.size > 0) {
|
|
41
|
-
set = cacheSet;
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
return set;
|
|
37
|
+
return twPatcher.getClassSet();
|
|
45
38
|
}
|
|
46
39
|
onLoad();
|
|
40
|
+
const loader = path.resolve(__dirname, './weapp-tw-runtime-loader.js');
|
|
41
|
+
const isExisted = fs.existsSync(loader);
|
|
42
|
+
const WeappTwRuntimeAopLoader = {
|
|
43
|
+
loader,
|
|
44
|
+
options: {
|
|
45
|
+
getClassSet
|
|
46
|
+
},
|
|
47
|
+
ident: null,
|
|
48
|
+
type: null
|
|
49
|
+
};
|
|
47
50
|
compiler.hooks.compilation.tap(pluginName, (compilation) => {
|
|
51
|
+
NormalModule.getCompilationHooks(compilation).loader.tap(pluginName, (loaderContext, module) => {
|
|
52
|
+
if (isExisted) {
|
|
53
|
+
const idx = module.loaders.findIndex((x) => x.loader.includes('postcss-loader'));
|
|
54
|
+
if (idx > -1) {
|
|
55
|
+
module.loaders.unshift(WeappTwRuntimeAopLoader);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
});
|
|
48
59
|
compilation.hooks.processAssets.tap({
|
|
49
60
|
name: pluginName,
|
|
50
61
|
stage: Compilation.PROCESS_ASSETS_STAGE_SUMMARIZE
|
|
@@ -52,13 +63,15 @@ class UnifiedWebpackPluginV5 {
|
|
|
52
63
|
onStart();
|
|
53
64
|
const entries = Object.entries(assets);
|
|
54
65
|
const groupedEntries = getGroupedEntries(entries, this.options);
|
|
55
|
-
const
|
|
56
|
-
setMangleRuntimeSet(
|
|
66
|
+
const runtimeSet = getClassSet();
|
|
67
|
+
setMangleRuntimeSet(runtimeSet);
|
|
57
68
|
if (Array.isArray(groupedEntries.html)) {
|
|
58
69
|
for (let i = 0; i < groupedEntries.html.length; i++) {
|
|
59
70
|
const [file, originalSource] = groupedEntries.html[i];
|
|
60
71
|
const rawSource = originalSource.source().toString();
|
|
61
|
-
const wxml = templeteHandler(rawSource
|
|
72
|
+
const wxml = templeteHandler(rawSource, {
|
|
73
|
+
runtimeSet
|
|
74
|
+
});
|
|
62
75
|
const source = new ConcatSource(wxml);
|
|
63
76
|
compilation.updateAsset(file, source);
|
|
64
77
|
onUpdate(file, rawSource, wxml);
|
|
@@ -68,7 +81,7 @@ class UnifiedWebpackPluginV5 {
|
|
|
68
81
|
for (let i = 0; i < groupedEntries.js.length; i++) {
|
|
69
82
|
const [file, originalSource] = groupedEntries.js[i];
|
|
70
83
|
const rawSource = originalSource.source().toString();
|
|
71
|
-
const { code } = jsHandler(rawSource,
|
|
84
|
+
const { code } = jsHandler(rawSource, runtimeSet);
|
|
72
85
|
const source = new ConcatSource(code);
|
|
73
86
|
compilation.updateAsset(file, source);
|
|
74
87
|
onUpdate(file, rawSource, code);
|
|
@@ -91,6 +104,5 @@ class UnifiedWebpackPluginV5 {
|
|
|
91
104
|
});
|
|
92
105
|
}
|
|
93
106
|
}
|
|
94
|
-
UnifiedWebpackPluginV5.NS = NS;
|
|
95
107
|
|
|
96
108
|
export { UnifiedWebpackPluginV5 };
|
package/dist/wxml/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { replaceWxml } from './shared';
|
|
2
|
-
export { generateCode, templeteHandler, templeteReplacer } from './utils';
|
|
2
|
+
export { generateCode, templeteHandler, templeteReplacer, customTempleteHandler, createTempleteHandler, extractSource } from './utils';
|
package/dist/wxml/utils.d.ts
CHANGED
|
@@ -3,5 +3,5 @@ export declare function generateCode(match: string, options?: ITempleteHandlerOp
|
|
|
3
3
|
export declare function extractSource(original: string): RawSource[];
|
|
4
4
|
export declare function templeteReplacer(original: string, options?: ITempleteHandlerOptions): string;
|
|
5
5
|
export declare function templeteHandler(rawSource: string, options?: ITempleteHandlerOptions): string;
|
|
6
|
-
export declare function customTempleteHandler(rawSource: string, options
|
|
7
|
-
export declare function createTempleteHandler(options?: ITempleteHandlerOptions): (rawSource: string, opt?: ITempleteHandlerOptions) => string;
|
|
6
|
+
export declare function customTempleteHandler(rawSource: string, options: Required<ITempleteHandlerOptions>): string;
|
|
7
|
+
export declare function createTempleteHandler(options?: Omit<ITempleteHandlerOptions, 'runtimeSet'>): (rawSource: string, opt?: Pick<ITempleteHandlerOptions, 'runtimeSet'>) => string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "weapp-tailwindcss",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.6.0",
|
|
4
4
|
"description": "把tailwindcss jit引擎,带给小程序开发者们\nbring tailwindcss jit engine to our miniprogram developers!",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -96,50 +96,54 @@
|
|
|
96
96
|
},
|
|
97
97
|
"homepage": "https://weapp-tw.icebreaker.top",
|
|
98
98
|
"devDependencies": {
|
|
99
|
-
"@babel/core": "^7.
|
|
99
|
+
"@babel/core": "^7.22.8",
|
|
100
100
|
"@icebreakers/cli": "^0.1.1",
|
|
101
101
|
"@icebreakers/readme": "0.1.0",
|
|
102
102
|
"@rollup/plugin-alias": "^5.0.0",
|
|
103
|
-
"@rollup/plugin-commonjs": "^25.0.
|
|
103
|
+
"@rollup/plugin-commonjs": "^25.0.2",
|
|
104
104
|
"@rollup/plugin-json": "^6.0.0",
|
|
105
105
|
"@rollup/plugin-node-resolve": "^15.1.0",
|
|
106
106
|
"@rollup/plugin-terser": "^0.4.3",
|
|
107
|
-
"@rollup/plugin-typescript": "^11.1.
|
|
107
|
+
"@rollup/plugin-typescript": "^11.1.2",
|
|
108
108
|
"@tsconfig/recommended": "^1.0.2",
|
|
109
109
|
"@types/babel__generator": "^7.6.4",
|
|
110
|
-
"@types/babel__traverse": "^7.
|
|
110
|
+
"@types/babel__traverse": "^7.20.1",
|
|
111
111
|
"@types/fs-extra": "^11.0.1",
|
|
112
|
-
"@types/gulp": "^4.0.
|
|
112
|
+
"@types/gulp": "^4.0.13",
|
|
113
113
|
"@types/gulp-postcss": "^8.0.3",
|
|
114
114
|
"@types/jest": "^29.5.2",
|
|
115
|
+
"@types/klaw": "^3.0.3",
|
|
116
|
+
"@types/loader-utils": "^2.0.3",
|
|
115
117
|
"@types/lodash": "^4.14.195",
|
|
116
118
|
"@types/micromatch": "^4.0.2",
|
|
117
|
-
"@types/node": "^20.
|
|
119
|
+
"@types/node": "^20.4.1",
|
|
118
120
|
"@types/semver": "^7.5.0",
|
|
119
121
|
"@types/vinyl": "^2.0.7",
|
|
120
122
|
"@types/webpack": "^5.28.1",
|
|
121
123
|
"@types/webpack-sources": "^3.2.0",
|
|
122
|
-
"@vitest/coverage-v8": "^0.
|
|
124
|
+
"@vitest/coverage-v8": "^0.33.0",
|
|
123
125
|
"autoprefixer": "^10.4.14",
|
|
124
|
-
"babel-loader": "^9.1.
|
|
126
|
+
"babel-loader": "^9.1.3",
|
|
125
127
|
"bumpp": "^9.1.1",
|
|
126
128
|
"chalk": "4.1.2",
|
|
127
129
|
"cross-env": "^7.0.3",
|
|
128
130
|
"css-loader": "^6.8.1",
|
|
129
131
|
"defu": "6.1.2",
|
|
130
132
|
"del": "^6.1.1",
|
|
131
|
-
"eslint": "8.
|
|
133
|
+
"eslint": "8.44.0",
|
|
132
134
|
"eslint-config-icebreaker": "^1.1.0",
|
|
133
135
|
"eslint-config-prettier": "^8.8.0",
|
|
134
136
|
"eslint-plugin-prettier": "^4.2.1",
|
|
135
137
|
"execa": "5",
|
|
136
|
-
"fast-glob": "^3.
|
|
138
|
+
"fast-glob": "^3.3.0",
|
|
137
139
|
"fs-extra": "^11.1.1",
|
|
138
140
|
"gulp": "^4.0.2",
|
|
139
141
|
"gulp-postcss": "^9.0.1",
|
|
140
142
|
"html-loader": "^4.2.0",
|
|
141
|
-
"jest": "^29.
|
|
143
|
+
"jest": "^29.6.1",
|
|
144
|
+
"klaw": "^4.1.0",
|
|
142
145
|
"lodash": "^4.17.21",
|
|
146
|
+
"magic-string": "^0.30.1",
|
|
143
147
|
"mini-css-extract-plugin": "^2.7.6",
|
|
144
148
|
"miniprogram-automator": "^0.12.0",
|
|
145
149
|
"pkg-types": "^1.0.3",
|
|
@@ -147,40 +151,41 @@
|
|
|
147
151
|
"postcss-loader": "^7.3.3",
|
|
148
152
|
"postcss-rem-to-responsive-pixel": "^5.1.3",
|
|
149
153
|
"prettier": "^2.8.8",
|
|
150
|
-
"
|
|
154
|
+
"promisify-loader-runner": "^1.0.0",
|
|
155
|
+
"rollup": "^3.26.2",
|
|
151
156
|
"rollup-plugin-visualizer": "^5.9.2",
|
|
152
157
|
"style-loader": "^3.3.3",
|
|
153
158
|
"tailwind-children": "^0.5.0",
|
|
154
159
|
"tailwindcss": "^3.3.2",
|
|
155
|
-
"ts-jest": "^29.1.
|
|
160
|
+
"ts-jest": "^29.1.1",
|
|
156
161
|
"ts-node": "^10.9.1",
|
|
157
|
-
"ts-patch": "^
|
|
162
|
+
"ts-patch": "^3.0.1",
|
|
158
163
|
"tsd": "^0.28.1",
|
|
159
|
-
"tslib": "^2.
|
|
160
|
-
"
|
|
161
|
-
"typescript": "^4.9.5",
|
|
164
|
+
"tslib": "^2.6.0",
|
|
165
|
+
"typescript": "^5.1.6",
|
|
162
166
|
"typescript-transform-paths": "^3.4.6",
|
|
163
167
|
"vinyl": "^3.0.0",
|
|
164
|
-
"vite": "^4.
|
|
165
|
-
"vitest": "^0.
|
|
168
|
+
"vite": "^4.4.2",
|
|
169
|
+
"vitest": "^0.33.0",
|
|
166
170
|
"weapp-tailwindcss-children": "^0.1.0",
|
|
167
|
-
"webpack": "^5.
|
|
168
|
-
"webpack-build-utils": "^0.0.
|
|
171
|
+
"webpack": "^5.88.1",
|
|
172
|
+
"webpack-build-utils": "^0.0.4"
|
|
169
173
|
},
|
|
170
174
|
"dependencies": {
|
|
171
|
-
"@babel/generator": "^7.
|
|
172
|
-
"@babel/parser": "^7.
|
|
173
|
-
"@babel/traverse": "^7.
|
|
174
|
-
"@babel/types": "^7.
|
|
175
|
-
"@csstools/postcss-is-pseudo-class": "^
|
|
175
|
+
"@babel/generator": "^7.22.7",
|
|
176
|
+
"@babel/parser": "^7.22.7",
|
|
177
|
+
"@babel/traverse": "^7.22.8",
|
|
178
|
+
"@babel/types": "^7.22.5",
|
|
179
|
+
"@csstools/postcss-is-pseudo-class": "^4.0.0",
|
|
180
|
+
"loader-utils": "^2.0.3",
|
|
176
181
|
"micromatch": "^4.0.5",
|
|
177
|
-
"postcss": "8.4.
|
|
182
|
+
"postcss": "8.4.25",
|
|
178
183
|
"postcss-selector-parser": "^6.0.13",
|
|
179
|
-
"semver": "^7.5.
|
|
180
|
-
"tailwindcss-mangle-shared": "^1.2.
|
|
181
|
-
"tailwindcss-patch": "^1.2.
|
|
184
|
+
"semver": "^7.5.4",
|
|
185
|
+
"tailwindcss-mangle-shared": "^1.2.6",
|
|
186
|
+
"tailwindcss-patch": "^1.2.6"
|
|
182
187
|
},
|
|
183
|
-
"packageManager": "pnpm@8.6.
|
|
188
|
+
"packageManager": "pnpm@8.6.3",
|
|
184
189
|
"scripts": {
|
|
185
190
|
"dev": "yarn clean && yarn dts && cross-env NODE_ENV=development rollup -c rollup.config.ts --configPlugin typescript -w",
|
|
186
191
|
"build": "yarn clean && cross-env NODE_ENV=production rollup -c rollup.config.ts --configPlugin typescript && yarn dts",
|
|
@@ -189,6 +194,7 @@
|
|
|
189
194
|
"dts": "tsc --emitDeclarationOnly -p tsconfig.dts.json",
|
|
190
195
|
"test": "jest && vitest run",
|
|
191
196
|
"jest-u": "jest -u",
|
|
197
|
+
"jest:u": "jest -u",
|
|
192
198
|
"test:dev": "vitest",
|
|
193
199
|
"vitest:coverage": "vitest run --coverage",
|
|
194
200
|
"e2e": "vitest run -c ./vitest.e2e.config.ts",
|
|
@@ -199,6 +205,7 @@
|
|
|
199
205
|
"clean": "node scripts/clean.js",
|
|
200
206
|
"debug:web": "cd demo/web && yarn dev",
|
|
201
207
|
"raw": "ts-node scripts/raw",
|
|
208
|
+
"get-decl": "ts-node scripts/get-decl.ts",
|
|
202
209
|
"demo:dev": "node scripts/demo/dev.js",
|
|
203
210
|
"demo:build": "node scripts/demo/build.js",
|
|
204
211
|
"demo:build:local": "node scripts/demo/build.js --local",
|