weapp-tailwindcss 3.5.3 → 3.6.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/cli.js +25 -28
- package/dist/cli.mjs +24 -26
- package/dist/constants.d.ts +1 -1
- package/dist/core.js +3 -2
- package/dist/core.mjs +3 -2
- package/dist/css-macro/index.d.ts +2 -2
- package/dist/css-macro/index.js +3 -3
- package/dist/css-macro/index.mjs +3 -3
- package/dist/gulp.js +4 -3
- package/dist/gulp.mjs +4 -3
- package/dist/{index-BfmTmdHm.mjs → index-BKg5XkrT.mjs} +2 -2
- package/dist/{index-zFq7tKDr.mjs → index-BkGbeUsJ.mjs} +109 -110
- package/dist/{index-BOz3IEuV.mjs → index-C02WsbSC.mjs} +1 -1
- package/dist/{index-DIZlWN56.js → index-CQ2lY08t.js} +2 -2
- package/dist/{index-Dbbfs_Dv.js → index-NUwXJMr-.js} +1 -1
- package/dist/{index-B2LUAr--.js → index-OxGGIRJ6.js} +109 -110
- package/dist/index.js +6 -5
- package/dist/index.mjs +6 -5
- package/dist/js/ast-grep.d.ts +1 -0
- package/dist/js/babel.d.ts +3 -0
- package/dist/js/handlers.d.ts +1 -3
- package/dist/{options-BDij5-AP.mjs → options-BJrhrWVC.mjs} +26 -21
- package/dist/{options-DslwksAa.js → options-BKnJT3al.js} +26 -20
- package/dist/postcss.js +2 -2
- package/dist/postcss.mjs +2 -2
- package/dist/types.d.ts +1 -1
- package/dist/{v5-D7B3M2-H.mjs → v5-CyTrcW-A.mjs} +2 -2
- package/dist/{v5-axtiXCio.js → v5-Dn7xHCrQ.js} +2 -2
- package/dist/vite.js +4 -3
- package/dist/vite.mjs +4 -3
- package/dist/webpack.js +4 -3
- package/dist/webpack.mjs +4 -3
- package/dist/webpack4.js +3 -2
- package/dist/webpack4.mjs +3 -2
- package/package.json +12 -12
package/dist/cli.js
CHANGED
|
@@ -2,24 +2,22 @@
|
|
|
2
2
|
|
|
3
3
|
var process$1 = require('node:process');
|
|
4
4
|
var semver = require('semver');
|
|
5
|
-
var index = require('./index-
|
|
6
|
-
var options = require('./options-
|
|
5
|
+
var index = require('./index-OxGGIRJ6.js');
|
|
6
|
+
var options = require('./options-BKnJT3al.js');
|
|
7
7
|
var require$$0$2 = require('fs');
|
|
8
8
|
var require$$0 = require('constants');
|
|
9
9
|
var require$$0$1 = require('stream');
|
|
10
10
|
var require$$4 = require('util');
|
|
11
11
|
var require$$5 = require('assert');
|
|
12
12
|
var require$$1 = require('path');
|
|
13
|
-
var consola = require('consola');
|
|
14
|
-
var fetch = require('npm-registry-fetch');
|
|
15
13
|
var defu = require('./defu-Cdz2PomB.js');
|
|
16
14
|
require('@csstools/postcss-is-pseudo-class');
|
|
17
15
|
require('postcss-rem-to-responsive-pixel');
|
|
18
|
-
require('postcss');
|
|
19
16
|
require('postcss-selector-parser');
|
|
20
17
|
require('./shared-r_GpWheO.js');
|
|
21
18
|
require('@ast-core/escape');
|
|
22
19
|
require('@weapp-core/escape');
|
|
20
|
+
require('postcss');
|
|
23
21
|
require('lru-cache');
|
|
24
22
|
require('md5');
|
|
25
23
|
require('./defaults-CdqzSWsR.js');
|
|
@@ -27,6 +25,7 @@ require('magic-string');
|
|
|
27
25
|
require('@babel/generator');
|
|
28
26
|
require('@babel/traverse');
|
|
29
27
|
require('@babel/parser');
|
|
28
|
+
require('consola');
|
|
30
29
|
require('@weapp-core/regex');
|
|
31
30
|
require('./replace.js');
|
|
32
31
|
require('@tailwindcss-mangle/shared');
|
|
@@ -45,7 +44,6 @@ var require$$0__default$1 = /*#__PURE__*/_interopDefaultCompat(require$$0$1);
|
|
|
45
44
|
var require$$4__default = /*#__PURE__*/_interopDefaultCompat(require$$4);
|
|
46
45
|
var require$$5__default = /*#__PURE__*/_interopDefaultCompat(require$$5);
|
|
47
46
|
var require$$1__default = /*#__PURE__*/_interopDefaultCompat(require$$1);
|
|
48
|
-
var fetch__default = /*#__PURE__*/_interopDefaultCompat(fetch);
|
|
49
47
|
|
|
50
48
|
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
51
49
|
|
|
@@ -3275,10 +3273,14 @@ function requireSetValue () {
|
|
|
3275
3273
|
var setValueExports = requireSetValue();
|
|
3276
3274
|
var set = /*@__PURE__*/getDefaultExportFromCjs(setValueExports);
|
|
3277
3275
|
|
|
3278
|
-
const logger = consola.createConsola();
|
|
3279
|
-
|
|
3280
3276
|
function fetchPackage(packageName, options) {
|
|
3281
|
-
|
|
3277
|
+
const opts = defu.defu(options, {
|
|
3278
|
+
registry: 'https://registry.npmmirror.com',
|
|
3279
|
+
});
|
|
3280
|
+
return import('npm-registry-fetch')
|
|
3281
|
+
.then(({ json }) => {
|
|
3282
|
+
return json(`/${packageName}`, opts);
|
|
3283
|
+
});
|
|
3282
3284
|
}
|
|
3283
3285
|
function getLatestVersionInRange(packageName, versionRange, options$1) {
|
|
3284
3286
|
return options.__awaiter(this, void 0, void 0, function* () {
|
|
@@ -3322,7 +3324,7 @@ function createContext(options$1) {
|
|
|
3322
3324
|
};
|
|
3323
3325
|
}
|
|
3324
3326
|
else {
|
|
3325
|
-
logger.warn('当前目录下不存在 `package.json` 文件,初始化脚本将被跳过,请执行 `npm init` 或手动创建 `package.json` 后重试 ');
|
|
3327
|
+
options.logger.warn('当前目录下不存在 `package.json` 文件,初始化脚本将被跳过,请执行 `npm init` 或手动创建 `package.json` 后重试 ');
|
|
3326
3328
|
}
|
|
3327
3329
|
});
|
|
3328
3330
|
}
|
|
@@ -3342,8 +3344,9 @@ function touchPostcssConfig(ctx) {
|
|
|
3342
3344
|
tailwindcss: {},
|
|
3343
3345
|
// 假如框架已经内置了 \`autoprefixer\`,可以去除下一行
|
|
3344
3346
|
autoprefixer: {},
|
|
3345
|
-
}
|
|
3346
|
-
}
|
|
3347
|
+
},
|
|
3348
|
+
}
|
|
3349
|
+
`;
|
|
3347
3350
|
yield fs.writeFile(path.resolve(ctx.cwd, ctx.postcssConfigBasename), data);
|
|
3348
3351
|
});
|
|
3349
3352
|
}
|
|
@@ -3353,14 +3356,16 @@ function touchTailwindConfig(ctx) {
|
|
|
3353
3356
|
${ctx.type === 'module' ? 'export default ' : 'module.exports = '}{
|
|
3354
3357
|
// 这里给出了一份 uni-app /taro 通用示例,具体要根据你自己项目的目录结构进行配置
|
|
3355
3358
|
// 不在 content 包括的文件内,你编写的 class,是不会生成对应的css工具类的
|
|
3356
|
-
content: ['./public/index.html', './src/**/*.{html,js,ts,jsx,tsx,vue}'],
|
|
3359
|
+
content: ['./public/index.html', './src/**/*.{wxml,html,js,ts,jsx,tsx,vue}'],
|
|
3357
3360
|
// 其他配置项
|
|
3358
3361
|
// ...
|
|
3359
3362
|
corePlugins: {
|
|
3360
|
-
// 小程序不需要 preflight,因为这主要是给 h5 的,如果你要同时开发小程序和 h5 端,你应该使用环境变量来控制它
|
|
3363
|
+
// 小程序不需要 preflight 和 container,因为这主要是给 h5 的,如果你要同时开发小程序和 h5 端,你应该使用环境变量来控制它
|
|
3361
3364
|
preflight: false,
|
|
3365
|
+
container: false,
|
|
3362
3366
|
},
|
|
3363
|
-
}
|
|
3367
|
+
}
|
|
3368
|
+
`;
|
|
3364
3369
|
yield fs.writeFile(path.resolve(ctx.cwd, ctx.tailwindConfigBasename), data);
|
|
3365
3370
|
});
|
|
3366
3371
|
}
|
|
@@ -3378,8 +3383,12 @@ function init(options$1) {
|
|
|
3378
3383
|
const ctx = yield createContext(opts);
|
|
3379
3384
|
if (ctx) {
|
|
3380
3385
|
yield updatePackageJson(ctx);
|
|
3386
|
+
options.logger.success('`package.json` 文件修改完成!');
|
|
3381
3387
|
yield touchPostcssConfig(ctx);
|
|
3388
|
+
options.logger.success('`postcss.config.js` 文件创建完成!');
|
|
3382
3389
|
yield touchTailwindConfig(ctx);
|
|
3390
|
+
options.logger.success('`tailwind.config.js` 文件创建完成!');
|
|
3391
|
+
options.logger.success('`weapp-tailwindcss` 初始化完成!请根据你自定义的需求,更改对应的配置文件(比如 `tailwind.config.js` 中的 `content` 配置)');
|
|
3383
3392
|
}
|
|
3384
3393
|
});
|
|
3385
3394
|
}
|
|
@@ -3387,8 +3396,7 @@ function init(options$1) {
|
|
|
3387
3396
|
process__default["default"].title = 'node (weapp-tailwindcss)';
|
|
3388
3397
|
const args = process__default["default"].argv.slice(2);
|
|
3389
3398
|
if (semver__default["default"].lt(process__default["default"].versions.node, index.WEAPP_TW_REQUIRED_NODE_VERSION)) {
|
|
3390
|
-
|
|
3391
|
-
process__default["default"].exit(1);
|
|
3399
|
+
options.logger.warn(`You are using Node.js ${process__default["default"].versions.node}. For weapp-tailwindcss, Node.js version >= v${index.WEAPP_TW_REQUIRED_NODE_VERSION} is required.`);
|
|
3392
3400
|
}
|
|
3393
3401
|
const command = args[0];
|
|
3394
3402
|
if (command === 'patch') {
|
|
@@ -3398,14 +3406,3 @@ if (command === 'patch') {
|
|
|
3398
3406
|
else if (command === 'init') {
|
|
3399
3407
|
init();
|
|
3400
3408
|
}
|
|
3401
|
-
else {
|
|
3402
|
-
try {
|
|
3403
|
-
import('@weapp-tailwindcss/cli').then(({ createCli }) => {
|
|
3404
|
-
createCli().parse();
|
|
3405
|
-
});
|
|
3406
|
-
}
|
|
3407
|
-
catch (error) {
|
|
3408
|
-
console.warn('请先安装 `@weapp-tailwindcss/cli` , 安装完成后再尝试运行!');
|
|
3409
|
-
throw error;
|
|
3410
|
-
}
|
|
3411
|
-
}
|
package/dist/cli.mjs
CHANGED
|
@@ -1,23 +1,21 @@
|
|
|
1
1
|
import process$1 from 'node:process';
|
|
2
2
|
import semver from 'semver';
|
|
3
|
-
import { W as WEAPP_TW_REQUIRED_NODE_VERSION } from './index-
|
|
4
|
-
import { _ as __awaiter, g as getOptions } from './options-
|
|
3
|
+
import { W as WEAPP_TW_REQUIRED_NODE_VERSION } from './index-BkGbeUsJ.mjs';
|
|
4
|
+
import { _ as __awaiter, l as logger, g as getOptions } from './options-BJrhrWVC.mjs';
|
|
5
5
|
import require$$0$2 from 'fs';
|
|
6
6
|
import require$$0 from 'constants';
|
|
7
7
|
import require$$0$1 from 'stream';
|
|
8
8
|
import require$$4 from 'util';
|
|
9
9
|
import require$$5 from 'assert';
|
|
10
10
|
import require$$1 from 'path';
|
|
11
|
-
import { createConsola } from 'consola';
|
|
12
|
-
import fetch from 'npm-registry-fetch';
|
|
13
11
|
import { d as defu } from './defu-n46TJT6t.mjs';
|
|
14
12
|
import '@csstools/postcss-is-pseudo-class';
|
|
15
13
|
import 'postcss-rem-to-responsive-pixel';
|
|
16
|
-
import 'postcss';
|
|
17
14
|
import 'postcss-selector-parser';
|
|
18
15
|
import './shared-COWjpokr.mjs';
|
|
19
16
|
import '@ast-core/escape';
|
|
20
17
|
import '@weapp-core/escape';
|
|
18
|
+
import 'postcss';
|
|
21
19
|
import 'lru-cache';
|
|
22
20
|
import 'md5';
|
|
23
21
|
import './defaults-5A8JI2hW.mjs';
|
|
@@ -25,6 +23,7 @@ import 'magic-string';
|
|
|
25
23
|
import '@babel/generator';
|
|
26
24
|
import '@babel/traverse';
|
|
27
25
|
import '@babel/parser';
|
|
26
|
+
import 'consola';
|
|
28
27
|
import '@weapp-core/regex';
|
|
29
28
|
import './replace.mjs';
|
|
30
29
|
import '@tailwindcss-mangle/shared';
|
|
@@ -3261,10 +3260,14 @@ function requireSetValue () {
|
|
|
3261
3260
|
var setValueExports = requireSetValue();
|
|
3262
3261
|
var set = /*@__PURE__*/getDefaultExportFromCjs(setValueExports);
|
|
3263
3262
|
|
|
3264
|
-
const logger = createConsola();
|
|
3265
|
-
|
|
3266
3263
|
function fetchPackage(packageName, options) {
|
|
3267
|
-
|
|
3264
|
+
const opts = defu(options, {
|
|
3265
|
+
registry: 'https://registry.npmmirror.com',
|
|
3266
|
+
});
|
|
3267
|
+
return import('npm-registry-fetch')
|
|
3268
|
+
.then(({ json }) => {
|
|
3269
|
+
return json(`/${packageName}`, opts);
|
|
3270
|
+
});
|
|
3268
3271
|
}
|
|
3269
3272
|
function getLatestVersionInRange(packageName, versionRange, options) {
|
|
3270
3273
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -3328,8 +3331,9 @@ function touchPostcssConfig(ctx) {
|
|
|
3328
3331
|
tailwindcss: {},
|
|
3329
3332
|
// 假如框架已经内置了 \`autoprefixer\`,可以去除下一行
|
|
3330
3333
|
autoprefixer: {},
|
|
3331
|
-
}
|
|
3332
|
-
}
|
|
3334
|
+
},
|
|
3335
|
+
}
|
|
3336
|
+
`;
|
|
3333
3337
|
yield fs.writeFile(path.resolve(ctx.cwd, ctx.postcssConfigBasename), data);
|
|
3334
3338
|
});
|
|
3335
3339
|
}
|
|
@@ -3339,14 +3343,16 @@ function touchTailwindConfig(ctx) {
|
|
|
3339
3343
|
${ctx.type === 'module' ? 'export default ' : 'module.exports = '}{
|
|
3340
3344
|
// 这里给出了一份 uni-app /taro 通用示例,具体要根据你自己项目的目录结构进行配置
|
|
3341
3345
|
// 不在 content 包括的文件内,你编写的 class,是不会生成对应的css工具类的
|
|
3342
|
-
content: ['./public/index.html', './src/**/*.{html,js,ts,jsx,tsx,vue}'],
|
|
3346
|
+
content: ['./public/index.html', './src/**/*.{wxml,html,js,ts,jsx,tsx,vue}'],
|
|
3343
3347
|
// 其他配置项
|
|
3344
3348
|
// ...
|
|
3345
3349
|
corePlugins: {
|
|
3346
|
-
// 小程序不需要 preflight,因为这主要是给 h5 的,如果你要同时开发小程序和 h5 端,你应该使用环境变量来控制它
|
|
3350
|
+
// 小程序不需要 preflight 和 container,因为这主要是给 h5 的,如果你要同时开发小程序和 h5 端,你应该使用环境变量来控制它
|
|
3347
3351
|
preflight: false,
|
|
3352
|
+
container: false,
|
|
3348
3353
|
},
|
|
3349
|
-
}
|
|
3354
|
+
}
|
|
3355
|
+
`;
|
|
3350
3356
|
yield fs.writeFile(path.resolve(ctx.cwd, ctx.tailwindConfigBasename), data);
|
|
3351
3357
|
});
|
|
3352
3358
|
}
|
|
@@ -3364,8 +3370,12 @@ function init(options) {
|
|
|
3364
3370
|
const ctx = yield createContext(opts);
|
|
3365
3371
|
if (ctx) {
|
|
3366
3372
|
yield updatePackageJson(ctx);
|
|
3373
|
+
logger.success('`package.json` 文件修改完成!');
|
|
3367
3374
|
yield touchPostcssConfig(ctx);
|
|
3375
|
+
logger.success('`postcss.config.js` 文件创建完成!');
|
|
3368
3376
|
yield touchTailwindConfig(ctx);
|
|
3377
|
+
logger.success('`tailwind.config.js` 文件创建完成!');
|
|
3378
|
+
logger.success('`weapp-tailwindcss` 初始化完成!请根据你自定义的需求,更改对应的配置文件(比如 `tailwind.config.js` 中的 `content` 配置)');
|
|
3369
3379
|
}
|
|
3370
3380
|
});
|
|
3371
3381
|
}
|
|
@@ -3373,8 +3383,7 @@ function init(options) {
|
|
|
3373
3383
|
process$1.title = 'node (weapp-tailwindcss)';
|
|
3374
3384
|
const args = process$1.argv.slice(2);
|
|
3375
3385
|
if (semver.lt(process$1.versions.node, WEAPP_TW_REQUIRED_NODE_VERSION)) {
|
|
3376
|
-
|
|
3377
|
-
process$1.exit(1);
|
|
3386
|
+
logger.warn(`You are using Node.js ${process$1.versions.node}. For weapp-tailwindcss, Node.js version >= v${WEAPP_TW_REQUIRED_NODE_VERSION} is required.`);
|
|
3378
3387
|
}
|
|
3379
3388
|
const command = args[0];
|
|
3380
3389
|
if (command === 'patch') {
|
|
@@ -3384,14 +3393,3 @@ if (command === 'patch') {
|
|
|
3384
3393
|
else if (command === 'init') {
|
|
3385
3394
|
init();
|
|
3386
3395
|
}
|
|
3387
|
-
else {
|
|
3388
|
-
try {
|
|
3389
|
-
import('@weapp-tailwindcss/cli').then(({ createCli }) => {
|
|
3390
|
-
createCli().parse();
|
|
3391
|
-
});
|
|
3392
|
-
}
|
|
3393
|
-
catch (error) {
|
|
3394
|
-
console.warn('请先安装 `@weapp-tailwindcss/cli` , 安装完成后再尝试运行!');
|
|
3395
|
-
throw error;
|
|
3396
|
-
}
|
|
3397
|
-
}
|
package/dist/constants.d.ts
CHANGED
|
@@ -4,4 +4,4 @@ export declare const ManglePluginHooks = "ManglePluginHooks";
|
|
|
4
4
|
export declare const WeappTailwindcssWebpackPluginOptimizeChunkAssetsHooks = "WeappTailwindcssWebpackPluginOptimizeChunkAssetsHooks";
|
|
5
5
|
export declare const pluginName = "weapp-tailwindcss-webpack-plugin";
|
|
6
6
|
export declare const vitePluginName = "vite-plugin-uni-app-weapp-tailwindcss-adaptor";
|
|
7
|
-
export declare const WEAPP_TW_REQUIRED_NODE_VERSION = "
|
|
7
|
+
export declare const WEAPP_TW_REQUIRED_NODE_VERSION = "18.17.0";
|
package/dist/core.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var options = require('./options-
|
|
5
|
+
var options = require('./options-BKnJT3al.js');
|
|
6
6
|
require('lru-cache');
|
|
7
7
|
require('md5');
|
|
8
8
|
require('./defaults-CdqzSWsR.js');
|
|
@@ -13,12 +13,13 @@ require('magic-string');
|
|
|
13
13
|
require('@babel/generator');
|
|
14
14
|
require('@babel/traverse');
|
|
15
15
|
require('@babel/parser');
|
|
16
|
+
require('consola');
|
|
16
17
|
require('@weapp-core/regex');
|
|
17
18
|
require('./replace.js');
|
|
18
19
|
require('./shared-r_GpWheO.js');
|
|
19
20
|
require('@tailwindcss-mangle/shared');
|
|
20
21
|
require('postcss');
|
|
21
|
-
require('./index-
|
|
22
|
+
require('./index-OxGGIRJ6.js');
|
|
22
23
|
require('@csstools/postcss-is-pseudo-class');
|
|
23
24
|
require('postcss-rem-to-responsive-pixel');
|
|
24
25
|
require('postcss-selector-parser');
|
package/dist/core.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { g as getOptions } from './options-
|
|
1
|
+
import { g as getOptions } from './options-BJrhrWVC.mjs';
|
|
2
2
|
import 'lru-cache';
|
|
3
3
|
import 'md5';
|
|
4
4
|
import './defaults-5A8JI2hW.mjs';
|
|
@@ -9,12 +9,13 @@ import 'magic-string';
|
|
|
9
9
|
import '@babel/generator';
|
|
10
10
|
import '@babel/traverse';
|
|
11
11
|
import '@babel/parser';
|
|
12
|
+
import 'consola';
|
|
12
13
|
import '@weapp-core/regex';
|
|
13
14
|
import './replace.mjs';
|
|
14
15
|
import './shared-COWjpokr.mjs';
|
|
15
16
|
import '@tailwindcss-mangle/shared';
|
|
16
17
|
import 'postcss';
|
|
17
|
-
import './index-
|
|
18
|
+
import './index-BkGbeUsJ.mjs';
|
|
18
19
|
import '@csstools/postcss-is-pseudo-class';
|
|
19
20
|
import 'postcss-rem-to-responsive-pixel';
|
|
20
21
|
import 'postcss-selector-parser';
|
|
@@ -5,11 +5,11 @@ export interface Options {
|
|
|
5
5
|
}>;
|
|
6
6
|
dynamic?: boolean;
|
|
7
7
|
}
|
|
8
|
-
declare const
|
|
8
|
+
declare const cssMacro: {
|
|
9
9
|
(options: Options): {
|
|
10
10
|
handler: import("tailwindcss/types/config").PluginCreator;
|
|
11
11
|
config?: Partial<import("tailwindcss/types/config").Config>;
|
|
12
12
|
};
|
|
13
13
|
__isOptionsFunction: true;
|
|
14
14
|
};
|
|
15
|
-
export default
|
|
15
|
+
export default cssMacro;
|
package/dist/css-macro/index.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var defu = require('../defu-Cdz2PomB.js');
|
|
4
3
|
var plugin = require('tailwindcss/plugin');
|
|
4
|
+
var defu = require('../defu-Cdz2PomB.js');
|
|
5
5
|
var constants = require('../constants-CFM1J-h1.js');
|
|
6
6
|
|
|
7
7
|
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
|
|
8
8
|
|
|
9
9
|
var plugin__default = /*#__PURE__*/_interopDefaultCompat(plugin);
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
const cssMacro = plugin__default["default"].withOptions((options) => {
|
|
12
12
|
const { dynamic: dynamicMode, variantsMap } = defu.defu(options, {
|
|
13
13
|
dynamic: true,
|
|
14
14
|
variantsMap: {},
|
|
@@ -33,4 +33,4 @@ var index = plugin__default["default"].withOptions((options) => {
|
|
|
33
33
|
};
|
|
34
34
|
});
|
|
35
35
|
|
|
36
|
-
module.exports =
|
|
36
|
+
module.exports = cssMacro;
|
package/dist/css-macro/index.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { d as defu } from '../defu-n46TJT6t.mjs';
|
|
2
1
|
import plugin from 'tailwindcss/plugin';
|
|
2
|
+
import { d as defu } from '../defu-n46TJT6t.mjs';
|
|
3
3
|
import { c as createMediaQuery, a as createNegativeMediaQuery } from '../constants-Dy2Dd3Fz.mjs';
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
const cssMacro = plugin.withOptions((options) => {
|
|
6
6
|
const { dynamic: dynamicMode, variantsMap } = defu(options, {
|
|
7
7
|
dynamic: true,
|
|
8
8
|
variantsMap: {},
|
|
@@ -27,4 +27,4 @@ var index = plugin.withOptions((options) => {
|
|
|
27
27
|
};
|
|
28
28
|
});
|
|
29
29
|
|
|
30
|
-
export {
|
|
30
|
+
export { cssMacro as default };
|
package/dist/gulp.js
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var index = require('./index-
|
|
6
|
-
require('./options-
|
|
5
|
+
var index = require('./index-NUwXJMr-.js');
|
|
6
|
+
require('./options-BKnJT3al.js');
|
|
7
7
|
require('lru-cache');
|
|
8
8
|
require('md5');
|
|
9
9
|
require('./defaults-CdqzSWsR.js');
|
|
@@ -14,12 +14,13 @@ require('magic-string');
|
|
|
14
14
|
require('@babel/generator');
|
|
15
15
|
require('@babel/traverse');
|
|
16
16
|
require('@babel/parser');
|
|
17
|
+
require('consola');
|
|
17
18
|
require('@weapp-core/regex');
|
|
18
19
|
require('./replace.js');
|
|
19
20
|
require('./shared-r_GpWheO.js');
|
|
20
21
|
require('@tailwindcss-mangle/shared');
|
|
21
22
|
require('postcss');
|
|
22
|
-
require('./index-
|
|
23
|
+
require('./index-OxGGIRJ6.js');
|
|
23
24
|
require('@csstools/postcss-is-pseudo-class');
|
|
24
25
|
require('postcss-rem-to-responsive-pixel');
|
|
25
26
|
require('postcss-selector-parser');
|
package/dist/gulp.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { c as createPlugins } from './index-
|
|
2
|
-
import './options-
|
|
1
|
+
export { c as createPlugins } from './index-C02WsbSC.mjs';
|
|
2
|
+
import './options-BJrhrWVC.mjs';
|
|
3
3
|
import 'lru-cache';
|
|
4
4
|
import 'md5';
|
|
5
5
|
import './defaults-5A8JI2hW.mjs';
|
|
@@ -10,12 +10,13 @@ import 'magic-string';
|
|
|
10
10
|
import '@babel/generator';
|
|
11
11
|
import '@babel/traverse';
|
|
12
12
|
import '@babel/parser';
|
|
13
|
+
import 'consola';
|
|
13
14
|
import '@weapp-core/regex';
|
|
14
15
|
import './replace.mjs';
|
|
15
16
|
import './shared-COWjpokr.mjs';
|
|
16
17
|
import '@tailwindcss-mangle/shared';
|
|
17
18
|
import 'postcss';
|
|
18
|
-
import './index-
|
|
19
|
+
import './index-BkGbeUsJ.mjs';
|
|
19
20
|
import '@csstools/postcss-is-pseudo-class';
|
|
20
21
|
import 'postcss-rem-to-responsive-pixel';
|
|
21
22
|
import 'postcss-selector-parser';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { g as getOptions, _ as __awaiter } from './options-
|
|
2
|
-
import { v as vitePluginName } from './index-
|
|
1
|
+
import { g as getOptions, _ as __awaiter } from './options-BJrhrWVC.mjs';
|
|
2
|
+
import { v as vitePluginName } from './index-BkGbeUsJ.mjs';
|
|
3
3
|
import { c as createDebug } from './index-BEIjgKpF.mjs';
|
|
4
4
|
import { g as getGroupedEntries } from './defaults-5A8JI2hW.mjs';
|
|
5
5
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import postcssIsPseudoClass from '@csstools/postcss-is-pseudo-class';
|
|
2
2
|
import postcssRem2rpx from 'postcss-rem-to-responsive-pixel';
|
|
3
|
-
import { Declaration, Rule } from 'postcss';
|
|
4
3
|
import selectorParser from 'postcss-selector-parser';
|
|
5
4
|
import { c as composeIsPseudo, i as internalCssSelectorReplacer } from './shared-COWjpokr.mjs';
|
|
5
|
+
import { Declaration, Rule } from 'postcss';
|
|
6
6
|
|
|
7
7
|
const VariablesScopeSymbol = Symbol('VariablesScope');
|
|
8
8
|
|
|
@@ -24,7 +24,114 @@ function createContext() {
|
|
|
24
24
|
const postcssPlugin = 'postcss-weapp-tailwindcss-rename-plugin';
|
|
25
25
|
const pluginName = 'weapp-tailwindcss-webpack-plugin';
|
|
26
26
|
const vitePluginName = 'vite-plugin-uni-app-weapp-tailwindcss-adaptor';
|
|
27
|
-
const WEAPP_TW_REQUIRED_NODE_VERSION = '
|
|
27
|
+
const WEAPP_TW_REQUIRED_NODE_VERSION = '18.17.0';
|
|
28
|
+
|
|
29
|
+
function createRuleTransform(rule, options) {
|
|
30
|
+
const { escapeMap, mangleContext, cssSelectorReplacement, cssRemoveHoverPseudoClass } = options;
|
|
31
|
+
const transform = (selectors) => {
|
|
32
|
+
selectors.walk((selector) => {
|
|
33
|
+
if (selector.type === 'universal' && cssSelectorReplacement && cssSelectorReplacement.universal) {
|
|
34
|
+
selector.value = composeIsPseudo(cssSelectorReplacement.universal);
|
|
35
|
+
}
|
|
36
|
+
if (cssRemoveHoverPseudoClass && selector.type === 'selector') {
|
|
37
|
+
const node = selector.nodes.find(x => x.type === 'pseudo' && x.value === ':hover');
|
|
38
|
+
if (node) {
|
|
39
|
+
selector.remove();
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
if (selector.type === 'pseudo'
|
|
43
|
+
&& selector.value === ':root'
|
|
44
|
+
&& cssSelectorReplacement
|
|
45
|
+
&& cssSelectorReplacement.root) {
|
|
46
|
+
selector.value = composeIsPseudo(cssSelectorReplacement.root);
|
|
47
|
+
}
|
|
48
|
+
if (selector.type === 'class') {
|
|
49
|
+
selector.value = internalCssSelectorReplacer(selector.value, {
|
|
50
|
+
escapeMap,
|
|
51
|
+
mangleContext,
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
if (selectors.length === 0) {
|
|
56
|
+
rule.remove();
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
return transform;
|
|
60
|
+
}
|
|
61
|
+
function getRuleTransformer(rule, options) {
|
|
62
|
+
return selectorParser(createRuleTransform(rule, options));
|
|
63
|
+
}
|
|
64
|
+
function ruleTransformSync(rule, options) {
|
|
65
|
+
const transformer = getRuleTransformer(rule, options);
|
|
66
|
+
return transformer.transformSync(rule, {
|
|
67
|
+
lossless: false,
|
|
68
|
+
updateSelector: true,
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
function isOnlyBeforeAndAfterPseudoElement(node) {
|
|
72
|
+
let b = false;
|
|
73
|
+
let a = false;
|
|
74
|
+
selectorParser((selectors) => {
|
|
75
|
+
selectors.walkPseudos((s) => {
|
|
76
|
+
var _a;
|
|
77
|
+
if (((_a = s.parent) === null || _a === void 0 ? void 0 : _a.length) === 1) {
|
|
78
|
+
if (/^:?:before$/.test(s.value)) {
|
|
79
|
+
b = true;
|
|
80
|
+
}
|
|
81
|
+
if (/^:?:after$/.test(s.value)) {
|
|
82
|
+
a = true;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
}).astSync(node);
|
|
87
|
+
return b && a;
|
|
88
|
+
}
|
|
89
|
+
const fallbackRemove = selectorParser((selectors) => {
|
|
90
|
+
let maybeImportantId = false;
|
|
91
|
+
selectors.walk((selector, idx) => {
|
|
92
|
+
var _a, _b, _c;
|
|
93
|
+
if (idx === 0 && selector.type === 'id') {
|
|
94
|
+
maybeImportantId = true;
|
|
95
|
+
}
|
|
96
|
+
if (selector.type === 'universal') {
|
|
97
|
+
(_a = selector.parent) === null || _a === void 0 ? void 0 : _a.remove();
|
|
98
|
+
}
|
|
99
|
+
if (selector.type === 'pseudo' && selector.value === ':is') {
|
|
100
|
+
if (maybeImportantId && ((_b = selector.nodes[0]) === null || _b === void 0 ? void 0 : _b.type) === 'selector') {
|
|
101
|
+
selector.replaceWith(selector.nodes[0]);
|
|
102
|
+
}
|
|
103
|
+
else {
|
|
104
|
+
(_c = selector.parent) === null || _c === void 0 ? void 0 : _c.remove();
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
const postcssWeappTailwindcssPostPlugin = (options = {
|
|
111
|
+
isMainChunk: true,
|
|
112
|
+
}) => {
|
|
113
|
+
const { customRuleCallback, isMainChunk } = options;
|
|
114
|
+
const p = {
|
|
115
|
+
postcssPlugin,
|
|
116
|
+
};
|
|
117
|
+
if (isMainChunk) {
|
|
118
|
+
p.OnceExit = (root) => {
|
|
119
|
+
root.walkRules((rule) => {
|
|
120
|
+
fallbackRemove.transformSync(rule, {
|
|
121
|
+
updateSelector: true,
|
|
122
|
+
lossless: false,
|
|
123
|
+
});
|
|
124
|
+
});
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
if (typeof customRuleCallback === 'function') {
|
|
128
|
+
p.Rule = (rule) => {
|
|
129
|
+
customRuleCallback(rule, options);
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
return p;
|
|
133
|
+
};
|
|
134
|
+
postcssWeappTailwindcssPostPlugin.postcss = true;
|
|
28
135
|
|
|
29
136
|
var cssVars = [
|
|
30
137
|
{
|
|
@@ -233,78 +340,6 @@ var cssVars = [
|
|
|
233
340
|
},
|
|
234
341
|
];
|
|
235
342
|
|
|
236
|
-
function createRuleTransform(rule, options) {
|
|
237
|
-
const { escapeMap, mangleContext, cssSelectorReplacement, cssRemoveHoverPseudoClass } = options;
|
|
238
|
-
const transform = (selectors) => {
|
|
239
|
-
selectors.walk((selector) => {
|
|
240
|
-
if (selector.type === 'universal' && cssSelectorReplacement && cssSelectorReplacement.universal) {
|
|
241
|
-
selector.value = composeIsPseudo(cssSelectorReplacement.universal);
|
|
242
|
-
}
|
|
243
|
-
if (cssRemoveHoverPseudoClass && selector.type === 'selector') {
|
|
244
|
-
const node = selector.nodes.find(x => x.type === 'pseudo' && x.value === ':hover');
|
|
245
|
-
if (node) {
|
|
246
|
-
selector.remove();
|
|
247
|
-
}
|
|
248
|
-
}
|
|
249
|
-
if (selector.type === 'pseudo'
|
|
250
|
-
&& selector.value === ':root'
|
|
251
|
-
&& cssSelectorReplacement
|
|
252
|
-
&& cssSelectorReplacement.root) {
|
|
253
|
-
selector.value = composeIsPseudo(cssSelectorReplacement.root);
|
|
254
|
-
}
|
|
255
|
-
if (selector.type === 'class') {
|
|
256
|
-
selector.value = internalCssSelectorReplacer(selector.value, {
|
|
257
|
-
escapeMap,
|
|
258
|
-
mangleContext,
|
|
259
|
-
});
|
|
260
|
-
}
|
|
261
|
-
});
|
|
262
|
-
if (selectors.length === 0) {
|
|
263
|
-
rule.remove();
|
|
264
|
-
}
|
|
265
|
-
};
|
|
266
|
-
return transform;
|
|
267
|
-
}
|
|
268
|
-
function getRuleTransformer(rule, options) {
|
|
269
|
-
return selectorParser(createRuleTransform(rule, options));
|
|
270
|
-
}
|
|
271
|
-
function ruleTransformSync(rule, options) {
|
|
272
|
-
const transformer = getRuleTransformer(rule, options);
|
|
273
|
-
return transformer.transformSync(rule, {
|
|
274
|
-
lossless: false,
|
|
275
|
-
updateSelector: true,
|
|
276
|
-
});
|
|
277
|
-
}
|
|
278
|
-
function isOnlyBeforeAndAfterPseudoElement(node) {
|
|
279
|
-
let b = false;
|
|
280
|
-
let a = false;
|
|
281
|
-
selectorParser((selectors) => {
|
|
282
|
-
selectors.walkPseudos((s) => {
|
|
283
|
-
var _a;
|
|
284
|
-
if (((_a = s.parent) === null || _a === void 0 ? void 0 : _a.length) === 1) {
|
|
285
|
-
if (/^:?:before$/.test(s.value)) {
|
|
286
|
-
b = true;
|
|
287
|
-
}
|
|
288
|
-
if (/^:?:after$/.test(s.value)) {
|
|
289
|
-
a = true;
|
|
290
|
-
}
|
|
291
|
-
}
|
|
292
|
-
});
|
|
293
|
-
}).astSync(node);
|
|
294
|
-
return b && a;
|
|
295
|
-
}
|
|
296
|
-
const fallbackRemove = selectorParser((selectors) => {
|
|
297
|
-
selectors.walk((selector) => {
|
|
298
|
-
var _a, _b;
|
|
299
|
-
if (selector.type === 'universal') {
|
|
300
|
-
(_a = selector.parent) === null || _a === void 0 ? void 0 : _a.remove();
|
|
301
|
-
}
|
|
302
|
-
if (selector.type === 'pseudo' && selector.value === ':is') {
|
|
303
|
-
(_b = selector.parent) === null || _b === void 0 ? void 0 : _b.remove();
|
|
304
|
-
}
|
|
305
|
-
});
|
|
306
|
-
});
|
|
307
|
-
|
|
308
343
|
const initialNodes = cssVars.map((x) => {
|
|
309
344
|
return new Declaration({
|
|
310
345
|
prop: x.prop,
|
|
@@ -417,42 +452,6 @@ function commonChunkPreflight(node, options) {
|
|
|
417
452
|
}
|
|
418
453
|
}
|
|
419
454
|
|
|
420
|
-
const postcssWeappTailwindcssPostPlugin = (options = {
|
|
421
|
-
isMainChunk: true,
|
|
422
|
-
}) => {
|
|
423
|
-
const { customRuleCallback, isMainChunk, ctx } = options;
|
|
424
|
-
const p = {
|
|
425
|
-
postcssPlugin,
|
|
426
|
-
};
|
|
427
|
-
if (isMainChunk) {
|
|
428
|
-
p.OnceExit = (root) => {
|
|
429
|
-
root.walkRules((rule) => {
|
|
430
|
-
if (ctx) {
|
|
431
|
-
if (ctx.isVariablesScope(rule)) {
|
|
432
|
-
fallbackRemove.transformSync(rule, {
|
|
433
|
-
updateSelector: true,
|
|
434
|
-
lossless: false,
|
|
435
|
-
});
|
|
436
|
-
}
|
|
437
|
-
}
|
|
438
|
-
else if (testIfVariablesScope(rule)) {
|
|
439
|
-
fallbackRemove.transformSync(rule, {
|
|
440
|
-
updateSelector: true,
|
|
441
|
-
lossless: false,
|
|
442
|
-
});
|
|
443
|
-
}
|
|
444
|
-
});
|
|
445
|
-
};
|
|
446
|
-
}
|
|
447
|
-
if (typeof customRuleCallback === 'function') {
|
|
448
|
-
p.Rule = (rule) => {
|
|
449
|
-
customRuleCallback(rule, options);
|
|
450
|
-
};
|
|
451
|
-
}
|
|
452
|
-
return p;
|
|
453
|
-
};
|
|
454
|
-
postcssWeappTailwindcssPostPlugin.postcss = true;
|
|
455
|
-
|
|
456
455
|
function isAtMediaHover(atRule) {
|
|
457
456
|
return (/media\(\s*hover\s*:\s*hover\s*\)/.test(atRule.name)
|
|
458
457
|
|| (atRule.name === 'media' && /\(\s*hover\s*:\s*hover\s*\)/.test(atRule.params)));
|