@weapp-tailwindcss/postcss 2.1.7 → 2.2.0-alpha.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.
@@ -0,0 +1,64 @@
1
+ // src/html-transform.ts
2
+ import process from "process";
3
+ import { defu } from "@weapp-tailwindcss/shared";
4
+ var htmlTags = ["html", "body", "a", "audio", "button", "canvas", "form", "iframe", "img", "input", "label", "progress", "select", "slot", "textarea", "video", "abbr", "area", "b", "bdi", "big", "br", "cite", "code", "data", "datalist", "del", "dfn", "em", "i", "ins", "kbd", "map", "mark", "meter", "output", "picture", "q", "s", "samp", "small", "span", "strong", "sub", "sup", "td", "template", "th", "time", "tt", "u", "var", "wbr", "address", "article", "aside", "blockquote", "caption", "dd", "details", "dialog", "div", "dl", "dt", "fieldset", "figcaption", "figure", "footer", "h1", "h2", "h3", "h4", "h5", "h6", "header", "hgroup", "hr", "legend", "li", "main", "nav", "ol", "p", "pre", "section", "summary", "table", "tbody", "tfoot", "thead", "tr", "ul", "svg"];
5
+ var miniAppTags = ["cover-image", "cover-view", "match-media", "movable-area", "movable-view", "page-container", "scroll-view", "share-element", "swiper", "swiper-item", "view", "icon", "progress", "rich-text", "text", "button", "checkbox", "checkbox-group", "editor", "form", "input", "keyboard-accessory", "label", "picker", "picker-view", "picker-view-column", "radio", "radio-group", "slider", "switch", "textarea", "functional-page-navigator", "navigator", "audio", "camera", "image", "live-player", "live-pusher", "video", "voip-room", "map", "canvas", "web-view", "ad", "ad-custom", "official-account", "open-data", "navigation-bar", "page-meta"];
6
+ var tags2Rgx = (tags = []) => new RegExp(`(^| |\\+|,|~|>|\\n)(${tags.join("|")})\\b(?=$| |\\.|\\+|,|~|:|\\[)`, "g");
7
+ var UNIVERSAL_SELECTOR_RE = /(?:^| )\*(?![=/*])/;
8
+ var postcssHtmlTransform = (opts = {}) => {
9
+ const options = defu(opts, {
10
+ platform: process.env.TARO_ENV
11
+ });
12
+ let selectorFilter;
13
+ let walkRules;
14
+ switch (options.platform) {
15
+ case "h5": {
16
+ selectorFilter = tags2Rgx(miniAppTags);
17
+ walkRules = (rule) => {
18
+ rule.selector = rule.selector.replace(selectorFilter, "$1taro-$2-core");
19
+ };
20
+ break;
21
+ }
22
+ case "rn": {
23
+ break;
24
+ }
25
+ case "quickapp": {
26
+ break;
27
+ }
28
+ default: {
29
+ const selector = tags2Rgx(htmlTags);
30
+ walkRules = (rule) => {
31
+ if (options.removeUniversal && UNIVERSAL_SELECTOR_RE.test(rule.selector)) {
32
+ rule.remove();
33
+ return;
34
+ }
35
+ rule.selector = rule.selector.replace(selector, "$1.h5-$2");
36
+ };
37
+ }
38
+ }
39
+ return {
40
+ postcssPlugin: "postcss-html-transform",
41
+ Rule(rule) {
42
+ if (typeof walkRules === "function") {
43
+ if (selectorFilter && selectorFilter.test(rule.selector)) {
44
+ walkRules(rule);
45
+ } else {
46
+ walkRules(rule);
47
+ }
48
+ }
49
+ },
50
+ Declaration(decl) {
51
+ if (options?.removeCursorStyle) {
52
+ if (decl.prop === "cursor") {
53
+ decl.remove();
54
+ }
55
+ }
56
+ }
57
+ };
58
+ };
59
+ postcssHtmlTransform.postcss = true;
60
+ var html_transform_default = postcssHtmlTransform;
61
+
62
+ export {
63
+ html_transform_default
64
+ };
@@ -0,0 +1,64 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 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/html-transform.ts
2
+ var _process = require('process'); var _process2 = _interopRequireDefault(_process);
3
+ var _shared = require('@weapp-tailwindcss/shared');
4
+ var htmlTags = ["html", "body", "a", "audio", "button", "canvas", "form", "iframe", "img", "input", "label", "progress", "select", "slot", "textarea", "video", "abbr", "area", "b", "bdi", "big", "br", "cite", "code", "data", "datalist", "del", "dfn", "em", "i", "ins", "kbd", "map", "mark", "meter", "output", "picture", "q", "s", "samp", "small", "span", "strong", "sub", "sup", "td", "template", "th", "time", "tt", "u", "var", "wbr", "address", "article", "aside", "blockquote", "caption", "dd", "details", "dialog", "div", "dl", "dt", "fieldset", "figcaption", "figure", "footer", "h1", "h2", "h3", "h4", "h5", "h6", "header", "hgroup", "hr", "legend", "li", "main", "nav", "ol", "p", "pre", "section", "summary", "table", "tbody", "tfoot", "thead", "tr", "ul", "svg"];
5
+ var miniAppTags = ["cover-image", "cover-view", "match-media", "movable-area", "movable-view", "page-container", "scroll-view", "share-element", "swiper", "swiper-item", "view", "icon", "progress", "rich-text", "text", "button", "checkbox", "checkbox-group", "editor", "form", "input", "keyboard-accessory", "label", "picker", "picker-view", "picker-view-column", "radio", "radio-group", "slider", "switch", "textarea", "functional-page-navigator", "navigator", "audio", "camera", "image", "live-player", "live-pusher", "video", "voip-room", "map", "canvas", "web-view", "ad", "ad-custom", "official-account", "open-data", "navigation-bar", "page-meta"];
6
+ var tags2Rgx = (tags = []) => new RegExp(`(^| |\\+|,|~|>|\\n)(${tags.join("|")})\\b(?=$| |\\.|\\+|,|~|:|\\[)`, "g");
7
+ var UNIVERSAL_SELECTOR_RE = /(?:^| )\*(?![=/*])/;
8
+ var postcssHtmlTransform = (opts = {}) => {
9
+ const options = _shared.defu.call(void 0, opts, {
10
+ platform: _process2.default.env.TARO_ENV
11
+ });
12
+ let selectorFilter;
13
+ let walkRules;
14
+ switch (options.platform) {
15
+ case "h5": {
16
+ selectorFilter = tags2Rgx(miniAppTags);
17
+ walkRules = (rule) => {
18
+ rule.selector = rule.selector.replace(selectorFilter, "$1taro-$2-core");
19
+ };
20
+ break;
21
+ }
22
+ case "rn": {
23
+ break;
24
+ }
25
+ case "quickapp": {
26
+ break;
27
+ }
28
+ default: {
29
+ const selector = tags2Rgx(htmlTags);
30
+ walkRules = (rule) => {
31
+ if (options.removeUniversal && UNIVERSAL_SELECTOR_RE.test(rule.selector)) {
32
+ rule.remove();
33
+ return;
34
+ }
35
+ rule.selector = rule.selector.replace(selector, "$1.h5-$2");
36
+ };
37
+ }
38
+ }
39
+ return {
40
+ postcssPlugin: "postcss-html-transform",
41
+ Rule(rule) {
42
+ if (typeof walkRules === "function") {
43
+ if (selectorFilter && selectorFilter.test(rule.selector)) {
44
+ walkRules(rule);
45
+ } else {
46
+ walkRules(rule);
47
+ }
48
+ }
49
+ },
50
+ Declaration(decl) {
51
+ if (_optionalChain([options, 'optionalAccess', _ => _.removeCursorStyle])) {
52
+ if (decl.prop === "cursor") {
53
+ decl.remove();
54
+ }
55
+ }
56
+ }
57
+ };
58
+ };
59
+ postcssHtmlTransform.postcss = true;
60
+ var html_transform_default = postcssHtmlTransform;
61
+
62
+
63
+
64
+ exports.html_transform_default = html_transform_default;
@@ -1,65 +1,8 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 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/html-transform.ts
2
- var _process = require('process'); var _process2 = _interopRequireDefault(_process);
3
- var _shared = require('@weapp-tailwindcss/shared');
4
- var htmlTags = ["html", "body", "a", "audio", "button", "canvas", "form", "iframe", "img", "input", "label", "progress", "select", "slot", "textarea", "video", "abbr", "area", "b", "bdi", "big", "br", "cite", "code", "data", "datalist", "del", "dfn", "em", "i", "ins", "kbd", "map", "mark", "meter", "output", "picture", "q", "s", "samp", "small", "span", "strong", "sub", "sup", "td", "template", "th", "time", "tt", "u", "var", "wbr", "address", "article", "aside", "blockquote", "caption", "dd", "details", "dialog", "div", "dl", "dt", "fieldset", "figcaption", "figure", "footer", "h1", "h2", "h3", "h4", "h5", "h6", "header", "hgroup", "hr", "legend", "li", "main", "nav", "ol", "p", "pre", "section", "summary", "table", "tbody", "tfoot", "thead", "tr", "ul", "svg"];
5
- var miniAppTags = ["cover-image", "cover-view", "match-media", "movable-area", "movable-view", "page-container", "scroll-view", "share-element", "swiper", "swiper-item", "view", "icon", "progress", "rich-text", "text", "button", "checkbox", "checkbox-group", "editor", "form", "input", "keyboard-accessory", "label", "picker", "picker-view", "picker-view-column", "radio", "radio-group", "slider", "switch", "textarea", "functional-page-navigator", "navigator", "audio", "camera", "image", "live-player", "live-pusher", "video", "voip-room", "map", "canvas", "web-view", "ad", "ad-custom", "official-account", "open-data", "navigation-bar", "page-meta"];
6
- var tags2Rgx = (tags = []) => new RegExp(`(^| |\\+|,|~|>|\\n)(${tags.join("|")})\\b(?=$| |\\.|\\+|,|~|:|\\[)`, "g");
7
- var UNIVERSAL_SELECTOR_RE = /(?:^| )\*(?![=/*])/;
8
- var postcssHtmlTransform = (opts = {}) => {
9
- const options = _shared.defu.call(void 0, opts, {
10
- platform: _process2.default.env.TARO_ENV
11
- });
12
- let selectorFilter;
13
- let walkRules;
14
- switch (options.platform) {
15
- case "h5": {
16
- selectorFilter = tags2Rgx(miniAppTags);
17
- walkRules = (rule) => {
18
- rule.selector = rule.selector.replace(selectorFilter, "$1taro-$2-core");
19
- };
20
- break;
21
- }
22
- case "rn": {
23
- break;
24
- }
25
- case "quickapp": {
26
- break;
27
- }
28
- default: {
29
- const selector = tags2Rgx(htmlTags);
30
- walkRules = (rule) => {
31
- if (options.removeUniversal && UNIVERSAL_SELECTOR_RE.test(rule.selector)) {
32
- rule.remove();
33
- return;
34
- }
35
- rule.selector = rule.selector.replace(selector, "$1.h5-$2");
36
- };
37
- }
38
- }
39
- return {
40
- postcssPlugin: "postcss-html-transform",
41
- Rule(rule) {
42
- if (typeof walkRules === "function") {
43
- if (selectorFilter && selectorFilter.test(rule.selector)) {
44
- walkRules(rule);
45
- } else {
46
- walkRules(rule);
47
- }
48
- }
49
- },
50
- Declaration(decl) {
51
- if (_optionalChain([options, 'optionalAccess', _ => _.removeCursorStyle])) {
52
- if (decl.prop === "cursor") {
53
- decl.remove();
54
- }
55
- }
56
- }
57
- };
58
- };
59
- postcssHtmlTransform.postcss = true;
60
- var html_transform_default = postcssHtmlTransform;
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});
61
2
 
3
+ var _chunk2Y3ULRB3js = require('./chunk-2Y3ULRB3.js');
62
4
 
63
- exports.default = html_transform_default;
5
+
6
+ exports.default = _chunk2Y3ULRB3js.html_transform_default;
64
7
 
65
8
  module.exports = exports.default;
@@ -1,63 +1,6 @@
1
- // src/html-transform.ts
2
- import process from "process";
3
- import { defu } from "@weapp-tailwindcss/shared";
4
- var htmlTags = ["html", "body", "a", "audio", "button", "canvas", "form", "iframe", "img", "input", "label", "progress", "select", "slot", "textarea", "video", "abbr", "area", "b", "bdi", "big", "br", "cite", "code", "data", "datalist", "del", "dfn", "em", "i", "ins", "kbd", "map", "mark", "meter", "output", "picture", "q", "s", "samp", "small", "span", "strong", "sub", "sup", "td", "template", "th", "time", "tt", "u", "var", "wbr", "address", "article", "aside", "blockquote", "caption", "dd", "details", "dialog", "div", "dl", "dt", "fieldset", "figcaption", "figure", "footer", "h1", "h2", "h3", "h4", "h5", "h6", "header", "hgroup", "hr", "legend", "li", "main", "nav", "ol", "p", "pre", "section", "summary", "table", "tbody", "tfoot", "thead", "tr", "ul", "svg"];
5
- var miniAppTags = ["cover-image", "cover-view", "match-media", "movable-area", "movable-view", "page-container", "scroll-view", "share-element", "swiper", "swiper-item", "view", "icon", "progress", "rich-text", "text", "button", "checkbox", "checkbox-group", "editor", "form", "input", "keyboard-accessory", "label", "picker", "picker-view", "picker-view-column", "radio", "radio-group", "slider", "switch", "textarea", "functional-page-navigator", "navigator", "audio", "camera", "image", "live-player", "live-pusher", "video", "voip-room", "map", "canvas", "web-view", "ad", "ad-custom", "official-account", "open-data", "navigation-bar", "page-meta"];
6
- var tags2Rgx = (tags = []) => new RegExp(`(^| |\\+|,|~|>|\\n)(${tags.join("|")})\\b(?=$| |\\.|\\+|,|~|:|\\[)`, "g");
7
- var UNIVERSAL_SELECTOR_RE = /(?:^| )\*(?![=/*])/;
8
- var postcssHtmlTransform = (opts = {}) => {
9
- const options = defu(opts, {
10
- platform: process.env.TARO_ENV
11
- });
12
- let selectorFilter;
13
- let walkRules;
14
- switch (options.platform) {
15
- case "h5": {
16
- selectorFilter = tags2Rgx(miniAppTags);
17
- walkRules = (rule) => {
18
- rule.selector = rule.selector.replace(selectorFilter, "$1taro-$2-core");
19
- };
20
- break;
21
- }
22
- case "rn": {
23
- break;
24
- }
25
- case "quickapp": {
26
- break;
27
- }
28
- default: {
29
- const selector = tags2Rgx(htmlTags);
30
- walkRules = (rule) => {
31
- if (options.removeUniversal && UNIVERSAL_SELECTOR_RE.test(rule.selector)) {
32
- rule.remove();
33
- return;
34
- }
35
- rule.selector = rule.selector.replace(selector, "$1.h5-$2");
36
- };
37
- }
38
- }
39
- return {
40
- postcssPlugin: "postcss-html-transform",
41
- Rule(rule) {
42
- if (typeof walkRules === "function") {
43
- if (selectorFilter && selectorFilter.test(rule.selector)) {
44
- walkRules(rule);
45
- } else {
46
- walkRules(rule);
47
- }
48
- }
49
- },
50
- Declaration(decl) {
51
- if (options?.removeCursorStyle) {
52
- if (decl.prop === "cursor") {
53
- decl.remove();
54
- }
55
- }
56
- }
57
- };
58
- };
59
- postcssHtmlTransform.postcss = true;
60
- var html_transform_default = postcssHtmlTransform;
1
+ import {
2
+ html_transform_default
3
+ } from "./chunk-2DNJBRQ3.mjs";
61
4
  export {
62
5
  html_transform_default as default
63
6
  };
package/dist/index.d.mts CHANGED
@@ -1,11 +1,13 @@
1
- import { I as IStyleHandlerOptions, S as StyleHandler, a as InternalCssSelectorReplacerOptions } from './types-CsRGpZ_r.mjs';
2
- export { C as CssCalcOptions, b as CssPreflightOptions, c as IPropValue, L as LoadedPostcssOptions, P as PipelineNodeContext, d as PipelineNodeCursor, e as PipelineStage, f as PresetEnvOptions, R as RequiredStyleHandlerOptions, g as ResolvedPipelineNode, h as StyleProcessingPipeline, U as UserDefinedPostcssOptions, i as createInjectPreflight, j as createStylePipeline } from './types-CsRGpZ_r.mjs';
1
+ import { I as IStyleHandlerOptions, S as StyleHandler, a as InternalCssSelectorReplacerOptions } from './types-DiOShlJF.mjs';
2
+ export { C as CssCalcOptions, b as CssPreflightOptions, c as IPropValue, L as LoadedPostcssOptions, P as PipelineNodeContext, d as PipelineNodeCursor, e as PipelineStage, f as PresetEnvOptions, R as RequiredStyleHandlerOptions, g as ResolvedPipelineNode, h as StyleProcessingPipeline, U as UniAppXCssTarget, i as UniAppXUnsupportedMode, j as UnitsToPxOptions, k as UserDefinedPostcssOptions, W as WeappAutoprefixerOptions, l as createInjectPreflight, m as createStylePipeline } from './types-DiOShlJF.mjs';
3
+ export { IOptions as PostcssHtmlTransformOptions, default as postcssHtmlTransform } from './html-transform.mjs';
3
4
  export { PxTransformOptions as Px2rpxOptions } from 'postcss-pxtrans';
4
5
  export { UserDefinedOptions as Rem2rpxOptions } from 'postcss-rem-to-responsive-pixel';
5
- export { UserDefinedOptions as UnitsToPxOptions } from 'postcss-units-to-px';
6
6
  import '@weapp-tailwindcss/postcss-calc';
7
7
  import 'postcss';
8
8
  import 'postcss-load-config';
9
+ import 'postcss-rule-unit-converter';
10
+ import 'autoprefixer';
9
11
 
10
12
  declare function createStyleHandler(options?: Partial<IStyleHandlerOptions>): StyleHandler;
11
13
 
package/dist/index.d.ts CHANGED
@@ -1,11 +1,13 @@
1
- import { I as IStyleHandlerOptions, S as StyleHandler, a as InternalCssSelectorReplacerOptions } from './types-CsRGpZ_r.js';
2
- export { C as CssCalcOptions, b as CssPreflightOptions, c as IPropValue, L as LoadedPostcssOptions, P as PipelineNodeContext, d as PipelineNodeCursor, e as PipelineStage, f as PresetEnvOptions, R as RequiredStyleHandlerOptions, g as ResolvedPipelineNode, h as StyleProcessingPipeline, U as UserDefinedPostcssOptions, i as createInjectPreflight, j as createStylePipeline } from './types-CsRGpZ_r.js';
1
+ import { I as IStyleHandlerOptions, S as StyleHandler, a as InternalCssSelectorReplacerOptions } from './types-DiOShlJF.js';
2
+ export { C as CssCalcOptions, b as CssPreflightOptions, c as IPropValue, L as LoadedPostcssOptions, P as PipelineNodeContext, d as PipelineNodeCursor, e as PipelineStage, f as PresetEnvOptions, R as RequiredStyleHandlerOptions, g as ResolvedPipelineNode, h as StyleProcessingPipeline, U as UniAppXCssTarget, i as UniAppXUnsupportedMode, j as UnitsToPxOptions, k as UserDefinedPostcssOptions, W as WeappAutoprefixerOptions, l as createInjectPreflight, m as createStylePipeline } from './types-DiOShlJF.js';
3
+ export { IOptions as PostcssHtmlTransformOptions, default as postcssHtmlTransform } from './html-transform.js';
3
4
  export { PxTransformOptions as Px2rpxOptions } from 'postcss-pxtrans';
4
5
  export { UserDefinedOptions as Rem2rpxOptions } from 'postcss-rem-to-responsive-pixel';
5
- export { UserDefinedOptions as UnitsToPxOptions } from 'postcss-units-to-px';
6
6
  import '@weapp-tailwindcss/postcss-calc';
7
7
  import 'postcss';
8
8
  import 'postcss-load-config';
9
+ import 'postcss-rule-unit-converter';
10
+ import 'autoprefixer';
9
11
 
10
12
  declare function createStyleHandler(options?: Partial<IStyleHandlerOptions>): StyleHandler;
11
13