@weapp-tailwindcss/postcss 1.0.0-alpha.6 → 1.0.0-alpha.8

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.d.mts CHANGED
@@ -1,13 +1,13 @@
1
- import { I as IStyleHandlerOptions, a as InternalCssSelectorReplacerOptions } from './types-BlpvjUzB.mjs';
2
- export { d as CssPreflightOptions, C as CustomRuleCallback, b as IPropValue, L as LoadedPostcssOptions, R as RequiredStyleHandlerOptions, U as UserDefinedPostcssOptions, c as createInjectPreflight } from './types-BlpvjUzB.mjs';
1
+ import { I as IStyleHandlerOptions, a as InternalCssSelectorReplacerOptions } from './types-CDLWJcpu.mjs';
2
+ export { d as CssPreflightOptions, C as CustomRuleCallback, b as IPropValue, L as LoadedPostcssOptions, R as RequiredStyleHandlerOptions, U as UserDefinedPostcssOptions, c as createInjectPreflight } from './types-CDLWJcpu.mjs';
3
3
  import postcss from 'postcss';
4
- import '@weapp-tailwindcss/mangle/types';
4
+ import '@weapp-tailwindcss/mangle';
5
5
  import 'postcss-load-config';
6
+ import 'postcss-preset-env';
6
7
  import 'postcss-rem-to-responsive-pixel';
7
8
 
8
- declare function styleHandler(rawSource: string, options: IStyleHandlerOptions): Promise<postcss.Result<postcss.Document | postcss.Root>>;
9
9
  declare function createStyleHandler(options: Partial<IStyleHandlerOptions>): (rawSource: string, opt?: Partial<IStyleHandlerOptions>) => Promise<postcss.Result<postcss.Document | postcss.Root>>;
10
10
 
11
11
  declare function internalCssSelectorReplacer(selectors: string, options?: InternalCssSelectorReplacerOptions): string;
12
12
 
13
- export { IStyleHandlerOptions, InternalCssSelectorReplacerOptions, createStyleHandler, internalCssSelectorReplacer, styleHandler };
13
+ export { IStyleHandlerOptions, InternalCssSelectorReplacerOptions, createStyleHandler, internalCssSelectorReplacer };
package/dist/index.d.ts CHANGED
@@ -1,13 +1,13 @@
1
- import { I as IStyleHandlerOptions, a as InternalCssSelectorReplacerOptions } from './types-BlpvjUzB.js';
2
- export { d as CssPreflightOptions, C as CustomRuleCallback, b as IPropValue, L as LoadedPostcssOptions, R as RequiredStyleHandlerOptions, U as UserDefinedPostcssOptions, c as createInjectPreflight } from './types-BlpvjUzB.js';
1
+ import { I as IStyleHandlerOptions, a as InternalCssSelectorReplacerOptions } from './types-CDLWJcpu.js';
2
+ export { d as CssPreflightOptions, C as CustomRuleCallback, b as IPropValue, L as LoadedPostcssOptions, R as RequiredStyleHandlerOptions, U as UserDefinedPostcssOptions, c as createInjectPreflight } from './types-CDLWJcpu.js';
3
3
  import postcss from 'postcss';
4
- import '@weapp-tailwindcss/mangle/types';
4
+ import '@weapp-tailwindcss/mangle';
5
5
  import 'postcss-load-config';
6
+ import 'postcss-preset-env';
6
7
  import 'postcss-rem-to-responsive-pixel';
7
8
 
8
- declare function styleHandler(rawSource: string, options: IStyleHandlerOptions): Promise<postcss.Result<postcss.Document | postcss.Root>>;
9
9
  declare function createStyleHandler(options: Partial<IStyleHandlerOptions>): (rawSource: string, opt?: Partial<IStyleHandlerOptions>) => Promise<postcss.Result<postcss.Document | postcss.Root>>;
10
10
 
11
11
  declare function internalCssSelectorReplacer(selectors: string, options?: InternalCssSelectorReplacerOptions): string;
12
12
 
13
- export { IStyleHandlerOptions, InternalCssSelectorReplacerOptions, createStyleHandler, internalCssSelectorReplacer, styleHandler };
13
+ export { IStyleHandlerOptions, InternalCssSelectorReplacerOptions, createStyleHandler, internalCssSelectorReplacer };
package/dist/index.js CHANGED
@@ -4,6 +4,26 @@
4
4
  var _shared = require('@weapp-tailwindcss/shared');
5
5
  var _postcss = require('postcss'); var _postcss2 = _interopRequireDefault(_postcss);
6
6
 
7
+ // src/defaults.ts
8
+ function getDefaultOptions() {
9
+ return {
10
+ cssPresetEnv: {
11
+ features: {
12
+ "cascade-layers": true,
13
+ "is-pseudo-class": {
14
+ specificityMatchingName: "weapp-tw-ig"
15
+ },
16
+ "oklab-function": true,
17
+ "color-mix": true,
18
+ "custom-properties": false
19
+ },
20
+ autoprefixer: {
21
+ add: false
22
+ }
23
+ }
24
+ };
25
+ }
26
+
7
27
  // src/plugins/index.ts
8
28
  var _postcsspresetenv = require('postcss-preset-env'); var _postcsspresetenv2 = _interopRequireDefault(_postcsspresetenv);
9
29
  var _postcssremtoresponsivepixel = require('postcss-rem-to-responsive-pixel'); var _postcssremtoresponsivepixel2 = _interopRequireDefault(_postcssremtoresponsivepixel);
@@ -137,13 +157,19 @@ function getFallbackRemove(rule) {
137
157
  ];
138
158
  }
139
159
  }
160
+ } else if (selector.value === ":where") {
161
+ for (const n of selector.nodes) {
162
+ for (const node of n.nodes) {
163
+ if (node.type === "attribute") {
164
+ node.remove();
165
+ }
166
+ }
167
+ }
140
168
  }
141
169
  }
142
170
  if (selector.type === "attribute") {
143
171
  if (selector.attribute === "hidden") {
144
172
  _optionalChain([rule, 'optionalAccess', _14 => _14.remove, 'call', _15 => _15()]);
145
- } else {
146
- selector.remove();
147
173
  }
148
174
  }
149
175
  });
@@ -546,10 +572,10 @@ var postcssWeappTailwindcssPrePlugin = (options = {
546
572
  };
547
573
  postcssWeappTailwindcssPrePlugin.postcss = true;
548
574
 
549
- // ../../node_modules/.pnpm/@csstools+postcss-is-pseudo-class@5.0.1_postcss@8.5.1/node_modules/@csstools/postcss-is-pseudo-class/dist/index.mjs
575
+ // ../../node_modules/.pnpm/@csstools+postcss-is-pseudo-class@5.0.1_postcss@8.5.2/node_modules/@csstools/postcss-is-pseudo-class/dist/index.mjs
550
576
 
551
577
 
552
- // ../../node_modules/.pnpm/@csstools+selector-specificity@5.0.0_postcss-selector-parser@7.0.0/node_modules/@csstools/selector-specificity/dist/index.mjs
578
+ // ../../node_modules/.pnpm/@csstools+selector-specificity@5.0.0_postcss-selector-parser@7.1.0/node_modules/@csstools/selector-specificity/dist/index.mjs
553
579
 
554
580
  function compare(e3, t2) {
555
581
  return e3.a === t2.a ? e3.b === t2.b ? e3.c - t2.c : e3.b - t2.b : e3.a - t2.a;
@@ -654,7 +680,7 @@ function selectorNodeContainsNothingOrOnlyUniversal(e3) {
654
680
  return 0 === t2.length || 1 === t2.length && "universal" === t2[0].type;
655
681
  }
656
682
 
657
- // ../../node_modules/.pnpm/@csstools+postcss-is-pseudo-class@5.0.1_postcss@8.5.1/node_modules/@csstools/postcss-is-pseudo-class/dist/index.mjs
683
+ // ../../node_modules/.pnpm/@csstools+postcss-is-pseudo-class@5.0.1_postcss@8.5.2/node_modules/@csstools/postcss-is-pseudo-class/dist/index.mjs
658
684
  function alwaysValidSelector(s) {
659
685
  const o2 = _postcssselectorparser2.default.call(void 0, ).astSync(s);
660
686
  let t2 = true;
@@ -858,16 +884,7 @@ function getPlugins(options) {
858
884
  const plugins = [
859
885
  ..._nullishCoalesce(_optionalChain([options, 'access', _44 => _44.postcssOptions, 'optionalAccess', _45 => _45.plugins]), () => ( [])),
860
886
  postcssWeappTailwindcssPrePlugin(options),
861
- _postcsspresetenv2.default.call(void 0, {
862
- features: {
863
- "cascade-layers": true,
864
- "is-pseudo-class": {
865
- specificityMatchingName: "weapp-tw-ig"
866
- },
867
- "oklab-function": true,
868
- "color-mix": true
869
- }
870
- })
887
+ _postcsspresetenv2.default.call(void 0, options.cssPresetEnv)
871
888
  ];
872
889
  if (options.rem2rpx) {
873
890
  plugins.push(
@@ -886,7 +903,9 @@ function getPlugins(options) {
886
903
 
887
904
  // src/handler.ts
888
905
  function styleHandler(rawSource, options) {
889
- return _postcss2.default.call(void 0, getPlugins(options)).process(
906
+ return _postcss2.default.call(void 0,
907
+ getPlugins(options)
908
+ ).process(
890
909
  rawSource,
891
910
  _nullishCoalesce(_optionalChain([options, 'access', _46 => _46.postcssOptions, 'optionalAccess', _47 => _47.options]), () => ( {
892
911
  from: void 0
@@ -894,10 +913,14 @@ function styleHandler(rawSource, options) {
894
913
  ).async();
895
914
  }
896
915
  function createStyleHandler(options) {
916
+ const cachedOptions = _shared.defuOverrideArray.call(void 0,
917
+ options,
918
+ getDefaultOptions()
919
+ );
897
920
  return (rawSource, opt) => {
898
921
  return styleHandler(
899
922
  rawSource,
900
- _shared.defuOverrideArray.call(void 0, opt, options)
923
+ _shared.defuOverrideArray.call(void 0, opt, cachedOptions)
901
924
  );
902
925
  };
903
926
  }
@@ -924,5 +947,4 @@ function createInjectPreflight(options) {
924
947
 
925
948
 
926
949
 
927
-
928
- exports.createInjectPreflight = createInjectPreflight; exports.createStyleHandler = createStyleHandler; exports.internalCssSelectorReplacer = internalCssSelectorReplacer; exports.styleHandler = styleHandler;
950
+ exports.createInjectPreflight = createInjectPreflight; exports.createStyleHandler = createStyleHandler; exports.internalCssSelectorReplacer = internalCssSelectorReplacer;
package/dist/index.mjs CHANGED
@@ -4,6 +4,26 @@ import "./chunk-WAXGOBY2.mjs";
4
4
  import { defuOverrideArray } from "@weapp-tailwindcss/shared";
5
5
  import postcss from "postcss";
6
6
 
7
+ // src/defaults.ts
8
+ function getDefaultOptions() {
9
+ return {
10
+ cssPresetEnv: {
11
+ features: {
12
+ "cascade-layers": true,
13
+ "is-pseudo-class": {
14
+ specificityMatchingName: "weapp-tw-ig"
15
+ },
16
+ "oklab-function": true,
17
+ "color-mix": true,
18
+ "custom-properties": false
19
+ },
20
+ autoprefixer: {
21
+ add: false
22
+ }
23
+ }
24
+ };
25
+ }
26
+
7
27
  // src/plugins/index.ts
8
28
  import postcssPresetEnv from "postcss-preset-env";
9
29
  import postcssRem2rpx from "postcss-rem-to-responsive-pixel";
@@ -137,13 +157,19 @@ function getFallbackRemove(rule) {
137
157
  ];
138
158
  }
139
159
  }
160
+ } else if (selector.value === ":where") {
161
+ for (const n of selector.nodes) {
162
+ for (const node of n.nodes) {
163
+ if (node.type === "attribute") {
164
+ node.remove();
165
+ }
166
+ }
167
+ }
140
168
  }
141
169
  }
142
170
  if (selector.type === "attribute") {
143
171
  if (selector.attribute === "hidden") {
144
172
  rule?.remove();
145
- } else {
146
- selector.remove();
147
173
  }
148
174
  }
149
175
  });
@@ -546,10 +572,10 @@ var postcssWeappTailwindcssPrePlugin = (options = {
546
572
  };
547
573
  postcssWeappTailwindcssPrePlugin.postcss = true;
548
574
 
549
- // ../../node_modules/.pnpm/@csstools+postcss-is-pseudo-class@5.0.1_postcss@8.5.1/node_modules/@csstools/postcss-is-pseudo-class/dist/index.mjs
575
+ // ../../node_modules/.pnpm/@csstools+postcss-is-pseudo-class@5.0.1_postcss@8.5.2/node_modules/@csstools/postcss-is-pseudo-class/dist/index.mjs
550
576
  import e2 from "postcss-selector-parser";
551
577
 
552
- // ../../node_modules/.pnpm/@csstools+selector-specificity@5.0.0_postcss-selector-parser@7.0.0/node_modules/@csstools/selector-specificity/dist/index.mjs
578
+ // ../../node_modules/.pnpm/@csstools+selector-specificity@5.0.0_postcss-selector-parser@7.1.0/node_modules/@csstools/selector-specificity/dist/index.mjs
553
579
  import e from "postcss-selector-parser";
554
580
  function compare(e3, t2) {
555
581
  return e3.a === t2.a ? e3.b === t2.b ? e3.c - t2.c : e3.b - t2.b : e3.a - t2.a;
@@ -654,7 +680,7 @@ function selectorNodeContainsNothingOrOnlyUniversal(e3) {
654
680
  return 0 === t2.length || 1 === t2.length && "universal" === t2[0].type;
655
681
  }
656
682
 
657
- // ../../node_modules/.pnpm/@csstools+postcss-is-pseudo-class@5.0.1_postcss@8.5.1/node_modules/@csstools/postcss-is-pseudo-class/dist/index.mjs
683
+ // ../../node_modules/.pnpm/@csstools+postcss-is-pseudo-class@5.0.1_postcss@8.5.2/node_modules/@csstools/postcss-is-pseudo-class/dist/index.mjs
658
684
  function alwaysValidSelector(s) {
659
685
  const o2 = e2().astSync(s);
660
686
  let t2 = true;
@@ -858,16 +884,7 @@ function getPlugins(options) {
858
884
  const plugins = [
859
885
  ...options.postcssOptions?.plugins ?? [],
860
886
  postcssWeappTailwindcssPrePlugin(options),
861
- postcssPresetEnv({
862
- features: {
863
- "cascade-layers": true,
864
- "is-pseudo-class": {
865
- specificityMatchingName: "weapp-tw-ig"
866
- },
867
- "oklab-function": true,
868
- "color-mix": true
869
- }
870
- })
887
+ postcssPresetEnv(options.cssPresetEnv)
871
888
  ];
872
889
  if (options.rem2rpx) {
873
890
  plugins.push(
@@ -886,7 +903,9 @@ function getPlugins(options) {
886
903
 
887
904
  // src/handler.ts
888
905
  function styleHandler(rawSource, options) {
889
- return postcss(getPlugins(options)).process(
906
+ return postcss(
907
+ getPlugins(options)
908
+ ).process(
890
909
  rawSource,
891
910
  options.postcssOptions?.options ?? {
892
911
  from: void 0
@@ -894,10 +913,14 @@ function styleHandler(rawSource, options) {
894
913
  ).async();
895
914
  }
896
915
  function createStyleHandler(options) {
916
+ const cachedOptions = defuOverrideArray(
917
+ options,
918
+ getDefaultOptions()
919
+ );
897
920
  return (rawSource, opt) => {
898
921
  return styleHandler(
899
922
  rawSource,
900
- defuOverrideArray(opt, options)
923
+ defuOverrideArray(opt, cachedOptions)
901
924
  );
902
925
  };
903
926
  }
@@ -923,6 +946,5 @@ function createInjectPreflight(options) {
923
946
  export {
924
947
  createInjectPreflight,
925
948
  createStyleHandler,
926
- internalCssSelectorReplacer,
927
- styleHandler
949
+ internalCssSelectorReplacer
928
950
  };
@@ -1,6 +1,7 @@
1
- import { IMangleScopeContext } from '@weapp-tailwindcss/mangle/types';
1
+ import { IMangleScopeContext } from '@weapp-tailwindcss/mangle';
2
2
  import { Rule } from 'postcss';
3
3
  import { Result } from 'postcss-load-config';
4
+ import { pluginOptions } from 'postcss-preset-env';
4
5
  import { UserDefinedOptions } from 'postcss-rem-to-responsive-pixel';
5
6
 
6
7
  declare function createContext(): {
@@ -40,6 +41,7 @@ type IStyleHandlerOptions = {
40
41
  ctx?: IContext;
41
42
  postcssOptions?: LoadedPostcssOptions;
42
43
  cssRemoveHoverPseudoClass?: boolean;
44
+ cssPresetEnv?: pluginOptions;
43
45
  } & RequiredStyleHandlerOptions;
44
46
  interface UserDefinedPostcssOptions {
45
47
  /**
@@ -1,6 +1,7 @@
1
- import { IMangleScopeContext } from '@weapp-tailwindcss/mangle/types';
1
+ import { IMangleScopeContext } from '@weapp-tailwindcss/mangle';
2
2
  import { Rule } from 'postcss';
3
3
  import { Result } from 'postcss-load-config';
4
+ import { pluginOptions } from 'postcss-preset-env';
4
5
  import { UserDefinedOptions } from 'postcss-rem-to-responsive-pixel';
5
6
 
6
7
  declare function createContext(): {
@@ -40,6 +41,7 @@ type IStyleHandlerOptions = {
40
41
  ctx?: IContext;
41
42
  postcssOptions?: LoadedPostcssOptions;
42
43
  cssRemoveHoverPseudoClass?: boolean;
44
+ cssPresetEnv?: pluginOptions;
43
45
  } & RequiredStyleHandlerOptions;
44
46
  interface UserDefinedPostcssOptions {
45
47
  /**
package/dist/types.d.mts CHANGED
@@ -1,5 +1,6 @@
1
- import '@weapp-tailwindcss/mangle/types';
1
+ import '@weapp-tailwindcss/mangle';
2
2
  import 'postcss';
3
3
  import 'postcss-load-config';
4
+ import 'postcss-preset-env';
4
5
  import 'postcss-rem-to-responsive-pixel';
5
- export { d as CssPreflightOptions, C as CustomRuleCallback, b as IPropValue, I as IStyleHandlerOptions, a as InternalCssSelectorReplacerOptions, L as LoadedPostcssOptions, R as RequiredStyleHandlerOptions, U as UserDefinedPostcssOptions } from './types-BlpvjUzB.mjs';
6
+ export { d as CssPreflightOptions, C as CustomRuleCallback, b as IPropValue, I as IStyleHandlerOptions, a as InternalCssSelectorReplacerOptions, L as LoadedPostcssOptions, R as RequiredStyleHandlerOptions, U as UserDefinedPostcssOptions } from './types-CDLWJcpu.mjs';
package/dist/types.d.ts CHANGED
@@ -1,5 +1,6 @@
1
- import '@weapp-tailwindcss/mangle/types';
1
+ import '@weapp-tailwindcss/mangle';
2
2
  import 'postcss';
3
3
  import 'postcss-load-config';
4
+ import 'postcss-preset-env';
4
5
  import 'postcss-rem-to-responsive-pixel';
5
- export { d as CssPreflightOptions, C as CustomRuleCallback, b as IPropValue, I as IStyleHandlerOptions, a as InternalCssSelectorReplacerOptions, L as LoadedPostcssOptions, R as RequiredStyleHandlerOptions, U as UserDefinedPostcssOptions } from './types-BlpvjUzB.js';
6
+ export { d as CssPreflightOptions, C as CustomRuleCallback, b as IPropValue, I as IStyleHandlerOptions, a as InternalCssSelectorReplacerOptions, L as LoadedPostcssOptions, R as RequiredStyleHandlerOptions, U as UserDefinedPostcssOptions } from './types-CDLWJcpu.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@weapp-tailwindcss/postcss",
3
- "version": "1.0.0-alpha.6",
3
+ "version": "1.0.0-alpha.8",
4
4
  "description": "@weapp-tailwindcss/postcss",
5
5
  "author": "ice breaker <1324318532@qq.com>",
6
6
  "license": "MIT",
@@ -34,10 +34,10 @@
34
34
  ],
35
35
  "dependencies": {
36
36
  "@weapp-core/escape": "~4.0.0",
37
- "postcss": "~8.5.1",
37
+ "postcss": "~8.5.2",
38
38
  "postcss-preset-env": "^10.1.3",
39
39
  "postcss-rem-to-responsive-pixel": "~6.0.2",
40
- "postcss-selector-parser": "~7.0.0",
40
+ "postcss-selector-parser": "~7.1.0",
41
41
  "@weapp-tailwindcss/shared": "1.0.0-alpha.4"
42
42
  },
43
43
  "devDependencies": {