@weapp-tailwindcss/postcss 1.0.0-alpha.1 → 1.0.0-alpha.3

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 ADDED
@@ -0,0 +1,100 @@
1
+ <p align="center">
2
+
3
+ <a href="https://tw.icebreaker.top">
4
+
5
+ <img src="./assets/logo.png" alt="weapp-tailwindcss-logo" width="128">
6
+ </a>
7
+
8
+ <br>
9
+
10
+ <h1 align="center">weapp-tailwindcss</h1>
11
+
12
+ </p>
13
+
14
+ > 简体中文(zh-cn) | [English](./README_en.md)
15
+
16
+ ![star](https://badgen.net/github/stars/sonofmagic/weapp-tailwindcss)
17
+ ![dm0](https://badgen.net/npm/dm/weapp-tailwindcss)
18
+ ![dm1](https://badgen.net/npm/dm/weapp-tailwindcss-webpack-plugin)
19
+ ![license](https://badgen.net/npm/license/weapp-tailwindcss)
20
+ [![test](https://github.com/sonofmagic/weapp-tailwindcss/actions/workflows/test.yml/badge.svg?branch=main)](https://github.com/sonofmagic/weapp-tailwindcss/actions/workflows/test.yml)
21
+ [![codecov](https://codecov.io/gh/sonofmagic/weapp-tailwindcss/branch/main/graph/badge.svg?token=zn05qXYznt)](https://codecov.io/gh/sonofmagic/weapp-tailwindcss)
22
+
23
+ > [!NOTE]
24
+ > 降低开发维护成本,提升开发效率的 `小程序` `tailwindcss` 全方面解决方案
25
+ >
26
+ > 小程序原生工具链 `weapp-vite` 已经发布,使用它改善你的原生小程序开发体验吧,更多详见 [官方文档](https://vite.icebreaker.top/)
27
+
28
+ \[[文档地址](https://tw.icebreaker.top)\] \| \[[加入技术交流群](https://tw.icebreaker.top/docs/community/group)\]
29
+
30
+ - [特性](#特性)
31
+ - [版本对应](#版本对应)
32
+ - [安装与使用方式](#安装与使用方式)
33
+ - [生态和解决方案](#生态和解决方案)
34
+ - [常见问题](#常见问题)
35
+ - [各个框架的模板](#各个框架的模板)
36
+ - [旧版本迁移指南](#旧版本迁移指南)
37
+ - [配置项参考](#配置项参考)
38
+ - [变更日志](#变更日志)
39
+ - [Contribute](#contribute)
40
+ - [License](#license)
41
+ - [Star History](#star-history)
42
+ - [Related projects](#related-projects)
43
+ - [weapp-vite](#weapp-vite)
44
+
45
+ ## 特性
46
+
47
+ | 不仅仅是`webpack` | 主流框架与原生开发支持 |
48
+ | --------------------------------------------------- | ----------------------------------------------- |
49
+ | ![wepback+vite+gulp](./assets/weapp-tw-plugins.png) | ![frameworks](./assets/weapp-tw-frameworks.png) |
50
+
51
+ 核心插件支持 `webpack`/`vite`/`gulp` 为基底的框架类小程序开发,涵盖了市面上几乎所有的主流的开发框架。
52
+
53
+ 同时也支持最原生的开发者工具创建的原生小程序应用。
54
+
55
+ 这些插件能够自动识别并精确处理所有 `tailwindcss` 的工具类来适配小程序环境。
56
+
57
+ ## 版本对应
58
+
59
+ 目前,`weapp-tailwindcss` 的 `2.x` 和 `3.x` 支持最新版本的 `tailwindcss v3.x.x` 版本和 `webpack5`,`webpack4`, `vite` 和 `gulp`。从 `3.2.0` 开始,`weapp-tailwindcss` 支持最原生的小程序开发方式。
60
+
61
+ > 如果你还在使用 `tailwindcss@2` 版本,那你应该使用从 `weapp-tailwindcss/webpack4` 导出的本插件的 `postcss7` `webpack4` 版本。另外请确保你的 `nodejs` 版本 `>=16.6.0`。目前低于 `16` 的长期维护版本(`偶数版本`) 都已经结束了生命周期,建议安装 `nodejs` 的 `LTS` 版本,详见 [nodejs/release](https://github.com/nodejs/release)
62
+
63
+ ## [安装与使用方式](https://tw.icebreaker.top/docs/quick-start/install)
64
+
65
+ ## [生态和解决方案](https://tw.icebreaker.top/docs/community/templates)
66
+
67
+ ## [常见问题](https://tw.icebreaker.top/docs/issues/)
68
+
69
+ ## [各个框架的模板](https://tw.icebreaker.top/docs/community/templates)
70
+
71
+ ## [旧版本迁移指南](https://tw.icebreaker.top/docs/migrations/v2)
72
+
73
+ ## [配置项参考](https://tw.icebreaker.top/docs/api/interfaces/UserDefinedOptions)
74
+
75
+ ## [变更日志](./CHANGELOG.md)
76
+
77
+ ## Contribute
78
+
79
+ 我们邀请你来贡献和帮助改进 `weapp-tailwindcss` 💚💚💚
80
+
81
+ 以下有几个方式可以参与:
82
+
83
+ - 报告错误:如果您遇到任何错误或问题,请提`issue`并提供完善的错误信息和复现方式。
84
+ - 建议:有增强 `weapp-tailwindcss` 的想法吗?请提 `issue` 来分享您的建议。
85
+ - 文档:如果您对文档有更好的见解或者更棒的修辞方式,欢迎 `pr`。
86
+ - 代码:任何人的代码都不是完美的,我们欢迎你通过 `pr` 给代码提供更好的质量与活力。
87
+
88
+ ## License
89
+
90
+ [MIT](./LICENSE)
91
+
92
+ ## Star History
93
+
94
+ [![Star History Chart](https://api.star-history.com/svg?repos=sonofmagic/weapp-tailwindcss&type=Date)](https://star-history.com/#sonofmagic/weapp-tailwindcss&Date)
95
+
96
+ ## Related projects
97
+
98
+ ### weapp-vite
99
+
100
+ [weapp-vite](https://vite.icebreaker.top/): 把现代化的开发模式带入小程序开发!
@@ -0,0 +1 @@
1
+ "use strict";
File without changes
package/dist/index.d.mts CHANGED
@@ -1,13 +1,13 @@
1
- import { I as InternalCssSelectorReplacerOptions, a as IStyleHandlerOptions } from './types-DxWi_8fe.mjs';
2
- export { c as createInjectPreflight } from './types-DxWi_8fe.mjs';
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';
3
3
  import postcss from 'postcss';
4
4
  import '@weapp-tailwindcss/mangle/types';
5
5
  import 'postcss-load-config';
6
6
  import 'postcss-rem-to-responsive-pixel';
7
7
 
8
- declare function internalCssSelectorReplacer(selectors: string, options?: InternalCssSelectorReplacerOptions): string;
9
-
10
8
  declare function styleHandler(rawSource: string, options: IStyleHandlerOptions): Promise<postcss.Result<postcss.Document | postcss.Root>>;
11
9
  declare function createStyleHandler(options: Partial<IStyleHandlerOptions>): (rawSource: string, opt?: Partial<IStyleHandlerOptions>) => Promise<postcss.Result<postcss.Document | postcss.Root>>;
12
10
 
13
- export { createStyleHandler, internalCssSelectorReplacer, styleHandler };
11
+ declare function internalCssSelectorReplacer(selectors: string, options?: InternalCssSelectorReplacerOptions): string;
12
+
13
+ export { IStyleHandlerOptions, InternalCssSelectorReplacerOptions, createStyleHandler, internalCssSelectorReplacer, styleHandler };
package/dist/index.d.ts CHANGED
@@ -1,13 +1,13 @@
1
- import { I as InternalCssSelectorReplacerOptions, a as IStyleHandlerOptions } from './types-DxWi_8fe.js';
2
- export { c as createInjectPreflight } from './types-DxWi_8fe.js';
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';
3
3
  import postcss from 'postcss';
4
4
  import '@weapp-tailwindcss/mangle/types';
5
5
  import 'postcss-load-config';
6
6
  import 'postcss-rem-to-responsive-pixel';
7
7
 
8
- declare function internalCssSelectorReplacer(selectors: string, options?: InternalCssSelectorReplacerOptions): string;
9
-
10
8
  declare function styleHandler(rawSource: string, options: IStyleHandlerOptions): Promise<postcss.Result<postcss.Document | postcss.Root>>;
11
9
  declare function createStyleHandler(options: Partial<IStyleHandlerOptions>): (rawSource: string, opt?: Partial<IStyleHandlerOptions>) => Promise<postcss.Result<postcss.Document | postcss.Root>>;
12
10
 
13
- export { createStyleHandler, internalCssSelectorReplacer, styleHandler };
11
+ declare function internalCssSelectorReplacer(selectors: string, options?: InternalCssSelectorReplacerOptions): string;
12
+
13
+ export { IStyleHandlerOptions, InternalCssSelectorReplacerOptions, createStyleHandler, internalCssSelectorReplacer, styleHandler };
package/dist/index.js CHANGED
@@ -1,4 +1,6 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }// src/index.ts
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }require('./chunk-GGNOJ77I.js');
2
+
3
+ // src/handler.ts
2
4
  var _shared = require('@weapp-tailwindcss/shared');
3
5
  var _postcss = require('postcss'); var _postcss2 = _interopRequireDefault(_postcss);
4
6
 
@@ -543,6 +545,24 @@ function getPlugins(options) {
543
545
  return plugins;
544
546
  }
545
547
 
548
+ // src/handler.ts
549
+ function styleHandler(rawSource, options) {
550
+ return _postcss2.default.call(void 0, getPlugins(options)).process(
551
+ rawSource,
552
+ _nullishCoalesce(_optionalChain([options, 'access', _18 => _18.postcssOptions, 'optionalAccess', _19 => _19.options]), () => ( {
553
+ from: void 0
554
+ }))
555
+ ).async();
556
+ }
557
+ function createStyleHandler(options) {
558
+ return (rawSource, opt) => {
559
+ return styleHandler(
560
+ rawSource,
561
+ _shared.defuOverrideArray.call(void 0, opt, options)
562
+ );
563
+ };
564
+ }
565
+
546
566
  // src/preflight.ts
547
567
  function createInjectPreflight(options) {
548
568
  const result = [];
@@ -562,24 +582,6 @@ function createInjectPreflight(options) {
562
582
  };
563
583
  }
564
584
 
565
- // src/index.ts
566
- function styleHandler(rawSource, options) {
567
- return _postcss2.default.call(void 0, getPlugins(options)).process(
568
- rawSource,
569
- _nullishCoalesce(_optionalChain([options, 'access', _18 => _18.postcssOptions, 'optionalAccess', _19 => _19.options]), () => ( {
570
- from: void 0
571
- }))
572
- ).async();
573
- }
574
- function createStyleHandler(options) {
575
- return (rawSource, opt) => {
576
- return styleHandler(
577
- rawSource,
578
- _shared.defuOverrideArray.call(void 0, opt, options)
579
- );
580
- };
581
- }
582
-
583
585
 
584
586
 
585
587
 
package/dist/index.mjs CHANGED
@@ -1,4 +1,6 @@
1
- // src/index.ts
1
+ import "./chunk-WAXGOBY2.mjs";
2
+
3
+ // src/handler.ts
2
4
  import { defuOverrideArray } from "@weapp-tailwindcss/shared";
3
5
  import postcss from "postcss";
4
6
 
@@ -543,6 +545,24 @@ function getPlugins(options) {
543
545
  return plugins;
544
546
  }
545
547
 
548
+ // src/handler.ts
549
+ function styleHandler(rawSource, options) {
550
+ return postcss(getPlugins(options)).process(
551
+ rawSource,
552
+ options.postcssOptions?.options ?? {
553
+ from: void 0
554
+ }
555
+ ).async();
556
+ }
557
+ function createStyleHandler(options) {
558
+ return (rawSource, opt) => {
559
+ return styleHandler(
560
+ rawSource,
561
+ defuOverrideArray(opt, options)
562
+ );
563
+ };
564
+ }
565
+
546
566
  // src/preflight.ts
547
567
  function createInjectPreflight(options) {
548
568
  const result = [];
@@ -561,24 +581,6 @@ function createInjectPreflight(options) {
561
581
  return result;
562
582
  };
563
583
  }
564
-
565
- // src/index.ts
566
- function styleHandler(rawSource, options) {
567
- return postcss(getPlugins(options)).process(
568
- rawSource,
569
- options.postcssOptions?.options ?? {
570
- from: void 0
571
- }
572
- ).async();
573
- }
574
- function createStyleHandler(options) {
575
- return (rawSource, opt) => {
576
- return styleHandler(
577
- rawSource,
578
- defuOverrideArray(opt, options)
579
- );
580
- };
581
- }
582
584
  export {
583
585
  createInjectPreflight,
584
586
  createStyleHandler,
@@ -180,4 +180,4 @@ interface UserDefinedPostcssOptions {
180
180
  customRuleCallback?: CustomRuleCallback;
181
181
  }
182
182
 
183
- export { type CustomRuleCallback as C, type InternalCssSelectorReplacerOptions as I, type LoadedPostcssOptions as L, type RequiredStyleHandlerOptions as R, type UserDefinedPostcssOptions as U, type IStyleHandlerOptions as a, type IPropValue as b, createInjectPreflight as c, type CssPreflightOptions as d };
183
+ export { type CustomRuleCallback as C, type IStyleHandlerOptions as I, type LoadedPostcssOptions as L, type RequiredStyleHandlerOptions as R, type UserDefinedPostcssOptions as U, type InternalCssSelectorReplacerOptions as a, type IPropValue as b, createInjectPreflight as c, type CssPreflightOptions as d };
@@ -180,4 +180,4 @@ interface UserDefinedPostcssOptions {
180
180
  customRuleCallback?: CustomRuleCallback;
181
181
  }
182
182
 
183
- export { type CustomRuleCallback as C, type InternalCssSelectorReplacerOptions as I, type LoadedPostcssOptions as L, type RequiredStyleHandlerOptions as R, type UserDefinedPostcssOptions as U, type IStyleHandlerOptions as a, type IPropValue as b, createInjectPreflight as c, type CssPreflightOptions as d };
183
+ export { type CustomRuleCallback as C, type IStyleHandlerOptions as I, type LoadedPostcssOptions as L, type RequiredStyleHandlerOptions as R, type UserDefinedPostcssOptions as U, type InternalCssSelectorReplacerOptions as a, type IPropValue as b, createInjectPreflight as c, type CssPreflightOptions as d };
package/dist/types.d.mts CHANGED
@@ -2,4 +2,4 @@ import '@weapp-tailwindcss/mangle/types';
2
2
  import 'postcss';
3
3
  import 'postcss-load-config';
4
4
  import 'postcss-rem-to-responsive-pixel';
5
- export { d as CssPreflightOptions, C as CustomRuleCallback, b as IPropValue, a as IStyleHandlerOptions, I as InternalCssSelectorReplacerOptions, L as LoadedPostcssOptions, R as RequiredStyleHandlerOptions, U as UserDefinedPostcssOptions } from './types-DxWi_8fe.mjs';
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';
package/dist/types.d.ts CHANGED
@@ -2,4 +2,4 @@ import '@weapp-tailwindcss/mangle/types';
2
2
  import 'postcss';
3
3
  import 'postcss-load-config';
4
4
  import 'postcss-rem-to-responsive-pixel';
5
- export { d as CssPreflightOptions, C as CustomRuleCallback, b as IPropValue, a as IStyleHandlerOptions, I as InternalCssSelectorReplacerOptions, L as LoadedPostcssOptions, R as RequiredStyleHandlerOptions, U as UserDefinedPostcssOptions } from './types-DxWi_8fe.js';
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';
package/dist/types.js CHANGED
@@ -1 +1 @@
1
- "use strict";
1
+ "use strict";require('./chunk-GGNOJ77I.js');
package/dist/types.mjs CHANGED
@@ -0,0 +1 @@
1
+ import "./chunk-WAXGOBY2.mjs";
package/package.json CHANGED
@@ -1,16 +1,16 @@
1
1
  {
2
2
  "name": "@weapp-tailwindcss/postcss",
3
- "version": "1.0.0-alpha.1",
3
+ "version": "1.0.0-alpha.3",
4
4
  "description": "@weapp-tailwindcss/postcss",
5
5
  "author": "ice breaker <1324318532@qq.com>",
6
6
  "license": "MIT",
7
7
  "repository": {
8
8
  "type": "git",
9
- "url": "git+https://github.com/sonofmagic/monorepo-template.git",
10
- "directory": "packages/bar"
9
+ "url": "git+https://github.com/sonofmagic/weapp-tailwindcss.git",
10
+ "directory": "packages/postcss"
11
11
  },
12
12
  "bugs": {
13
- "url": "https://github.com/sonofmagic/monorepo-template/issues"
13
+ "url": "https://github.com/sonofmagic/weapp-tailwindcss/issues"
14
14
  },
15
15
  "keywords": [],
16
16
  "sideEffects": false,
@@ -35,13 +35,13 @@
35
35
  "dependencies": {
36
36
  "@csstools/postcss-is-pseudo-class": "^5.0.1",
37
37
  "@weapp-core/escape": "~3.0.2",
38
- "postcss": "~8.4.49",
38
+ "postcss": "~8.5.1",
39
39
  "postcss-rem-to-responsive-pixel": "~6.0.2",
40
40
  "postcss-selector-parser": "~7.0.0",
41
- "@weapp-tailwindcss/shared": "1.0.0-alpha.1"
41
+ "@weapp-tailwindcss/shared": "1.0.0-alpha.2"
42
42
  },
43
43
  "devDependencies": {
44
- "@weapp-tailwindcss/mangle": "1.0.0-alpha.1"
44
+ "@weapp-tailwindcss/mangle": "1.0.0-alpha.3"
45
45
  },
46
46
  "scripts": {
47
47
  "dev": "tsup --watch --sourcemap",