@weapp-tailwindcss/postcss 1.3.0 → 1.3.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.
- package/dist/index.js +37 -8
- package/dist/index.mjs +38 -9
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -984,7 +984,7 @@ function getPlugins(options) {
|
|
|
984
984
|
postcssPlugin: "postcss-remove-include-custom-properties",
|
|
985
985
|
OnceExit(root) {
|
|
986
986
|
root.walkDecls((decl, idx) => {
|
|
987
|
-
if (idx > 0 &&
|
|
987
|
+
if (idx > 0 && /--/.test(decl.value)) {
|
|
988
988
|
const prevNode = _optionalChain([decl, 'access', _42 => _42.parent, 'optionalAccess', _43 => _43.nodes, 'access', _44 => _44[idx - 1]]);
|
|
989
989
|
if (prevNode && prevNode.prop === decl.prop) {
|
|
990
990
|
const parsed = _postcssvalueparser2.default.call(void 0, decl.value);
|
|
@@ -1027,14 +1027,40 @@ function createInjectPreflight(options) {
|
|
|
1027
1027
|
}
|
|
1028
1028
|
|
|
1029
1029
|
// src/handler.ts
|
|
1030
|
+
function createProcessOptions(options) {
|
|
1031
|
+
return {
|
|
1032
|
+
from: void 0,
|
|
1033
|
+
..._nullishCoalesce(_optionalChain([options, 'access', _45 => _45.postcssOptions, 'optionalAccess', _46 => _46.options]), () => ( {}))
|
|
1034
|
+
};
|
|
1035
|
+
}
|
|
1036
|
+
var pluginCache = /* @__PURE__ */ new WeakMap();
|
|
1037
|
+
var processOptionsCache = /* @__PURE__ */ new WeakMap();
|
|
1038
|
+
var processOptionsSourceCache = /* @__PURE__ */ new WeakMap();
|
|
1039
|
+
function getCachedPlugins(options) {
|
|
1040
|
+
let plugins = pluginCache.get(options);
|
|
1041
|
+
if (!plugins) {
|
|
1042
|
+
plugins = getPlugins(options);
|
|
1043
|
+
pluginCache.set(options, plugins);
|
|
1044
|
+
}
|
|
1045
|
+
return plugins;
|
|
1046
|
+
}
|
|
1047
|
+
function getCachedProcessOptions(options) {
|
|
1048
|
+
const source = _optionalChain([options, 'access', _47 => _47.postcssOptions, 'optionalAccess', _48 => _48.options]);
|
|
1049
|
+
let cached = processOptionsCache.get(options);
|
|
1050
|
+
const cachedSource = processOptionsSourceCache.get(options);
|
|
1051
|
+
if (!cached || cachedSource !== source) {
|
|
1052
|
+
cached = createProcessOptions(options);
|
|
1053
|
+
processOptionsCache.set(options, cached);
|
|
1054
|
+
processOptionsSourceCache.set(options, source);
|
|
1055
|
+
}
|
|
1056
|
+
return { ...cached };
|
|
1057
|
+
}
|
|
1030
1058
|
function styleHandler(rawSource, options) {
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
).process(
|
|
1059
|
+
const plugins = getCachedPlugins(options);
|
|
1060
|
+
const processOptions = getCachedProcessOptions(options);
|
|
1061
|
+
return _postcss2.default.call(void 0, plugins).process(
|
|
1034
1062
|
rawSource,
|
|
1035
|
-
|
|
1036
|
-
from: void 0
|
|
1037
|
-
})
|
|
1063
|
+
processOptions
|
|
1038
1064
|
).async();
|
|
1039
1065
|
}
|
|
1040
1066
|
function createStyleHandler(options) {
|
|
@@ -1043,10 +1069,13 @@ function createStyleHandler(options) {
|
|
|
1043
1069
|
getDefaultOptions(options)
|
|
1044
1070
|
);
|
|
1045
1071
|
cachedOptions.cssInjectPreflight = createInjectPreflight(cachedOptions.cssPreflight);
|
|
1072
|
+
getCachedPlugins(cachedOptions);
|
|
1073
|
+
getCachedProcessOptions(cachedOptions);
|
|
1046
1074
|
return (rawSource, opt) => {
|
|
1075
|
+
const resolvedOptions = _shared.defuOverrideArray.call(void 0, opt, cachedOptions);
|
|
1047
1076
|
return styleHandler(
|
|
1048
1077
|
rawSource,
|
|
1049
|
-
|
|
1078
|
+
resolvedOptions
|
|
1050
1079
|
);
|
|
1051
1080
|
};
|
|
1052
1081
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import "./chunk-WAXGOBY2.mjs";
|
|
2
2
|
|
|
3
3
|
// src/handler.ts
|
|
4
|
-
import {
|
|
4
|
+
import { defuOverrideArray as defuOverrideArray3 } from "@weapp-tailwindcss/shared";
|
|
5
5
|
import postcss from "postcss";
|
|
6
6
|
|
|
7
7
|
// src/defaults.ts
|
|
@@ -984,7 +984,7 @@ function getPlugins(options) {
|
|
|
984
984
|
postcssPlugin: "postcss-remove-include-custom-properties",
|
|
985
985
|
OnceExit(root) {
|
|
986
986
|
root.walkDecls((decl, idx) => {
|
|
987
|
-
if (idx > 0 &&
|
|
987
|
+
if (idx > 0 && /--/.test(decl.value)) {
|
|
988
988
|
const prevNode = decl.parent?.nodes[idx - 1];
|
|
989
989
|
if (prevNode && prevNode.prop === decl.prop) {
|
|
990
990
|
const parsed = valueParser(decl.value);
|
|
@@ -1027,14 +1027,40 @@ function createInjectPreflight(options) {
|
|
|
1027
1027
|
}
|
|
1028
1028
|
|
|
1029
1029
|
// src/handler.ts
|
|
1030
|
+
function createProcessOptions(options) {
|
|
1031
|
+
return {
|
|
1032
|
+
from: void 0,
|
|
1033
|
+
...options.postcssOptions?.options ?? {}
|
|
1034
|
+
};
|
|
1035
|
+
}
|
|
1036
|
+
var pluginCache = /* @__PURE__ */ new WeakMap();
|
|
1037
|
+
var processOptionsCache = /* @__PURE__ */ new WeakMap();
|
|
1038
|
+
var processOptionsSourceCache = /* @__PURE__ */ new WeakMap();
|
|
1039
|
+
function getCachedPlugins(options) {
|
|
1040
|
+
let plugins = pluginCache.get(options);
|
|
1041
|
+
if (!plugins) {
|
|
1042
|
+
plugins = getPlugins(options);
|
|
1043
|
+
pluginCache.set(options, plugins);
|
|
1044
|
+
}
|
|
1045
|
+
return plugins;
|
|
1046
|
+
}
|
|
1047
|
+
function getCachedProcessOptions(options) {
|
|
1048
|
+
const source = options.postcssOptions?.options;
|
|
1049
|
+
let cached = processOptionsCache.get(options);
|
|
1050
|
+
const cachedSource = processOptionsSourceCache.get(options);
|
|
1051
|
+
if (!cached || cachedSource !== source) {
|
|
1052
|
+
cached = createProcessOptions(options);
|
|
1053
|
+
processOptionsCache.set(options, cached);
|
|
1054
|
+
processOptionsSourceCache.set(options, source);
|
|
1055
|
+
}
|
|
1056
|
+
return { ...cached };
|
|
1057
|
+
}
|
|
1030
1058
|
function styleHandler(rawSource, options) {
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
).process(
|
|
1059
|
+
const plugins = getCachedPlugins(options);
|
|
1060
|
+
const processOptions = getCachedProcessOptions(options);
|
|
1061
|
+
return postcss(plugins).process(
|
|
1034
1062
|
rawSource,
|
|
1035
|
-
|
|
1036
|
-
from: void 0
|
|
1037
|
-
})
|
|
1063
|
+
processOptions
|
|
1038
1064
|
).async();
|
|
1039
1065
|
}
|
|
1040
1066
|
function createStyleHandler(options) {
|
|
@@ -1043,10 +1069,13 @@ function createStyleHandler(options) {
|
|
|
1043
1069
|
getDefaultOptions(options)
|
|
1044
1070
|
);
|
|
1045
1071
|
cachedOptions.cssInjectPreflight = createInjectPreflight(cachedOptions.cssPreflight);
|
|
1072
|
+
getCachedPlugins(cachedOptions);
|
|
1073
|
+
getCachedProcessOptions(cachedOptions);
|
|
1046
1074
|
return (rawSource, opt) => {
|
|
1075
|
+
const resolvedOptions = defuOverrideArray3(opt, cachedOptions);
|
|
1047
1076
|
return styleHandler(
|
|
1048
1077
|
rawSource,
|
|
1049
|
-
|
|
1078
|
+
resolvedOptions
|
|
1050
1079
|
);
|
|
1051
1080
|
};
|
|
1052
1081
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@weapp-tailwindcss/postcss",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.1",
|
|
4
4
|
"description": "@weapp-tailwindcss/postcss",
|
|
5
5
|
"author": "ice breaker <1324318532@qq.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -42,8 +42,8 @@
|
|
|
42
42
|
"@weapp-core/escape": "~4.0.1",
|
|
43
43
|
"@weapp-tailwindcss/postcss-calc": "^1.0.0",
|
|
44
44
|
"postcss": "~8.5.6",
|
|
45
|
-
"postcss-preset-env": "^10.
|
|
46
|
-
"postcss-pxtransform": "^4.1.
|
|
45
|
+
"postcss-preset-env": "^10.4.0",
|
|
46
|
+
"postcss-pxtransform": "^4.1.7",
|
|
47
47
|
"postcss-rem-to-responsive-pixel": "~6.1.0",
|
|
48
48
|
"postcss-selector-parser": "~7.1.0",
|
|
49
49
|
"postcss-value-parser": "^4.2.0",
|