@weapp-tailwindcss/postcss 1.0.0-alpha.7 → 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);
@@ -552,10 +572,10 @@ var postcssWeappTailwindcssPrePlugin = (options = {
552
572
  };
553
573
  postcssWeappTailwindcssPrePlugin.postcss = true;
554
574
 
555
- // ../../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
556
576
 
557
577
 
558
- // ../../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
559
579
 
560
580
  function compare(e3, t2) {
561
581
  return e3.a === t2.a ? e3.b === t2.b ? e3.c - t2.c : e3.b - t2.b : e3.a - t2.a;
@@ -660,7 +680,7 @@ function selectorNodeContainsNothingOrOnlyUniversal(e3) {
660
680
  return 0 === t2.length || 1 === t2.length && "universal" === t2[0].type;
661
681
  }
662
682
 
663
- // ../../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
664
684
  function alwaysValidSelector(s) {
665
685
  const o2 = _postcssselectorparser2.default.call(void 0, ).astSync(s);
666
686
  let t2 = true;
@@ -864,16 +884,7 @@ function getPlugins(options) {
864
884
  const plugins = [
865
885
  ..._nullishCoalesce(_optionalChain([options, 'access', _44 => _44.postcssOptions, 'optionalAccess', _45 => _45.plugins]), () => ( [])),
866
886
  postcssWeappTailwindcssPrePlugin(options),
867
- _postcsspresetenv2.default.call(void 0, {
868
- features: {
869
- "cascade-layers": true,
870
- "is-pseudo-class": {
871
- specificityMatchingName: "weapp-tw-ig"
872
- },
873
- "oklab-function": true,
874
- "color-mix": true
875
- }
876
- })
887
+ _postcsspresetenv2.default.call(void 0, options.cssPresetEnv)
877
888
  ];
878
889
  if (options.rem2rpx) {
879
890
  plugins.push(
@@ -892,7 +903,9 @@ function getPlugins(options) {
892
903
 
893
904
  // src/handler.ts
894
905
  function styleHandler(rawSource, options) {
895
- return _postcss2.default.call(void 0, getPlugins(options)).process(
906
+ return _postcss2.default.call(void 0,
907
+ getPlugins(options)
908
+ ).process(
896
909
  rawSource,
897
910
  _nullishCoalesce(_optionalChain([options, 'access', _46 => _46.postcssOptions, 'optionalAccess', _47 => _47.options]), () => ( {
898
911
  from: void 0
@@ -900,10 +913,14 @@ function styleHandler(rawSource, options) {
900
913
  ).async();
901
914
  }
902
915
  function createStyleHandler(options) {
916
+ const cachedOptions = _shared.defuOverrideArray.call(void 0,
917
+ options,
918
+ getDefaultOptions()
919
+ );
903
920
  return (rawSource, opt) => {
904
921
  return styleHandler(
905
922
  rawSource,
906
- _shared.defuOverrideArray.call(void 0, opt, options)
923
+ _shared.defuOverrideArray.call(void 0, opt, cachedOptions)
907
924
  );
908
925
  };
909
926
  }
@@ -930,5 +947,4 @@ function createInjectPreflight(options) {
930
947
 
931
948
 
932
949
 
933
-
934
- 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";
@@ -552,10 +572,10 @@ var postcssWeappTailwindcssPrePlugin = (options = {
552
572
  };
553
573
  postcssWeappTailwindcssPrePlugin.postcss = true;
554
574
 
555
- // ../../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
556
576
  import e2 from "postcss-selector-parser";
557
577
 
558
- // ../../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
559
579
  import e from "postcss-selector-parser";
560
580
  function compare(e3, t2) {
561
581
  return e3.a === t2.a ? e3.b === t2.b ? e3.c - t2.c : e3.b - t2.b : e3.a - t2.a;
@@ -660,7 +680,7 @@ function selectorNodeContainsNothingOrOnlyUniversal(e3) {
660
680
  return 0 === t2.length || 1 === t2.length && "universal" === t2[0].type;
661
681
  }
662
682
 
663
- // ../../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
664
684
  function alwaysValidSelector(s) {
665
685
  const o2 = e2().astSync(s);
666
686
  let t2 = true;
@@ -864,16 +884,7 @@ function getPlugins(options) {
864
884
  const plugins = [
865
885
  ...options.postcssOptions?.plugins ?? [],
866
886
  postcssWeappTailwindcssPrePlugin(options),
867
- postcssPresetEnv({
868
- features: {
869
- "cascade-layers": true,
870
- "is-pseudo-class": {
871
- specificityMatchingName: "weapp-tw-ig"
872
- },
873
- "oklab-function": true,
874
- "color-mix": true
875
- }
876
- })
887
+ postcssPresetEnv(options.cssPresetEnv)
877
888
  ];
878
889
  if (options.rem2rpx) {
879
890
  plugins.push(
@@ -892,7 +903,9 @@ function getPlugins(options) {
892
903
 
893
904
  // src/handler.ts
894
905
  function styleHandler(rawSource, options) {
895
- return postcss(getPlugins(options)).process(
906
+ return postcss(
907
+ getPlugins(options)
908
+ ).process(
896
909
  rawSource,
897
910
  options.postcssOptions?.options ?? {
898
911
  from: void 0
@@ -900,10 +913,14 @@ function styleHandler(rawSource, options) {
900
913
  ).async();
901
914
  }
902
915
  function createStyleHandler(options) {
916
+ const cachedOptions = defuOverrideArray(
917
+ options,
918
+ getDefaultOptions()
919
+ );
903
920
  return (rawSource, opt) => {
904
921
  return styleHandler(
905
922
  rawSource,
906
- defuOverrideArray(opt, options)
923
+ defuOverrideArray(opt, cachedOptions)
907
924
  );
908
925
  };
909
926
  }
@@ -929,6 +946,5 @@ function createInjectPreflight(options) {
929
946
  export {
930
947
  createInjectPreflight,
931
948
  createStyleHandler,
932
- internalCssSelectorReplacer,
933
- styleHandler
949
+ internalCssSelectorReplacer
934
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.7",
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": {