weapp-tailwindcss 3.5.3 → 3.6.0

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 CHANGED
@@ -2,16 +2,14 @@
2
2
 
3
3
  var process$1 = require('node:process');
4
4
  var semver = require('semver');
5
- var index = require('./index-B2LUAr--.js');
6
- var options = require('./options-DslwksAa.js');
5
+ var index = require('./index-Cuz6je-V.js');
6
+ var options = require('./options-BI6mlQ4i.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');
@@ -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
- return fetch__default["default"].json(`/${packageName}`, options);
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
- console.error(`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.`);
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,15 +1,13 @@
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-zFq7tKDr.mjs';
4
- import { _ as __awaiter, g as getOptions } from './options-BDij5-AP.mjs';
3
+ import { W as WEAPP_TW_REQUIRED_NODE_VERSION } from './index-mmbDSA4j.mjs';
4
+ import { _ as __awaiter, l as logger, g as getOptions } from './options-BH4m6exr.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';
@@ -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
- return fetch.json(`/${packageName}`, options);
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
- console.error(`You are using Node.js ${process$1.versions.node}. For weapp-tailwindcss, Node.js version >= v${WEAPP_TW_REQUIRED_NODE_VERSION} is required.`);
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
- }
@@ -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 = "16.6.0";
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-DslwksAa.js');
5
+ var options = require('./options-BI6mlQ4i.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-B2LUAr--.js');
22
+ require('./index-Cuz6je-V.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-BDij5-AP.mjs';
1
+ import { g as getOptions } from './options-BH4m6exr.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-zFq7tKDr.mjs';
18
+ import './index-mmbDSA4j.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 _default: {
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 _default;
15
+ export default cssMacro;
@@ -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
- var index = plugin__default["default"].withOptions((options) => {
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 = index;
36
+ module.exports = cssMacro;
@@ -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
- var index = plugin.withOptions((options) => {
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 { index as default };
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-Dbbfs_Dv.js');
6
- require('./options-DslwksAa.js');
5
+ var index = require('./index-BUtdpYVL.js');
6
+ require('./options-BI6mlQ4i.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-B2LUAr--.js');
23
+ require('./index-Cuz6je-V.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-BOz3IEuV.mjs';
2
- import './options-BDij5-AP.mjs';
1
+ export { c as createPlugins } from './index-ejL1iIOn.mjs';
2
+ import './options-BH4m6exr.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-zFq7tKDr.mjs';
19
+ import './index-mmbDSA4j.mjs';
19
20
  import '@csstools/postcss-is-pseudo-class';
20
21
  import 'postcss-rem-to-responsive-pixel';
21
22
  import 'postcss-selector-parser';
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var options = require('./options-DslwksAa.js');
3
+ var options = require('./options-BI6mlQ4i.js');
4
4
  var node_buffer = require('node:buffer');
5
5
  var stream = require('node:stream');
6
6
  var index = require('./index-HC-Qkn0i.js');
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
- var options = require('./options-DslwksAa.js');
4
- var index = require('./index-B2LUAr--.js');
3
+ var options = require('./options-BI6mlQ4i.js');
4
+ var index = require('./index-Cuz6je-V.js');
5
5
  var index$1 = require('./index-HC-Qkn0i.js');
6
6
  var defaults = require('./defaults-CdqzSWsR.js');
7
7
 
@@ -32,7 +32,7 @@ function createContext() {
32
32
  const postcssPlugin = 'postcss-weapp-tailwindcss-rename-plugin';
33
33
  const pluginName = 'weapp-tailwindcss-webpack-plugin';
34
34
  const vitePluginName = 'vite-plugin-uni-app-weapp-tailwindcss-adaptor';
35
- const WEAPP_TW_REQUIRED_NODE_VERSION = '16.6.0';
35
+ const WEAPP_TW_REQUIRED_NODE_VERSION = '18.17.0';
36
36
 
37
37
  var cssVars = [
38
38
  {
@@ -1,5 +1,5 @@
1
- import { g as getOptions, _ as __awaiter } from './options-BDij5-AP.mjs';
2
- import { v as vitePluginName } from './index-zFq7tKDr.mjs';
1
+ import { g as getOptions, _ as __awaiter } from './options-BH4m6exr.mjs';
2
+ import { v as vitePluginName } from './index-mmbDSA4j.mjs';
3
3
  import { c as createDebug } from './index-BEIjgKpF.mjs';
4
4
  import { g as getGroupedEntries } from './defaults-5A8JI2hW.mjs';
5
5
 
@@ -1,4 +1,4 @@
1
- import { g as getOptions, _ as __awaiter } from './options-BDij5-AP.mjs';
1
+ import { g as getOptions, _ as __awaiter } from './options-BH4m6exr.mjs';
2
2
  import { Buffer } from 'node:buffer';
3
3
  import stream from 'node:stream';
4
4
  import { c as createDebug } from './index-BEIjgKpF.mjs';
@@ -24,7 +24,7 @@ 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 = '16.6.0';
27
+ const WEAPP_TW_REQUIRED_NODE_VERSION = '18.17.0';
28
28
 
29
29
  var cssVars = [
30
30
  {
package/dist/index.js CHANGED
@@ -2,10 +2,10 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var index = require('./index-Dbbfs_Dv.js');
6
- var index$1 = require('./index-DIZlWN56.js');
7
- var v5 = require('./v5-axtiXCio.js');
8
- require('./options-DslwksAa.js');
5
+ var index = require('./index-BUtdpYVL.js');
6
+ var index$1 = require('./index-CW_nvc9M.js');
7
+ var v5 = require('./v5-DknUknkv.js');
8
+ require('./options-BI6mlQ4i.js');
9
9
  require('lru-cache');
10
10
  require('md5');
11
11
  require('./defaults-CdqzSWsR.js');
@@ -16,12 +16,13 @@ require('magic-string');
16
16
  require('@babel/generator');
17
17
  require('@babel/traverse');
18
18
  require('@babel/parser');
19
+ require('consola');
19
20
  require('@weapp-core/regex');
20
21
  require('./replace.js');
21
22
  require('./shared-r_GpWheO.js');
22
23
  require('@tailwindcss-mangle/shared');
23
24
  require('postcss');
24
- require('./index-B2LUAr--.js');
25
+ require('./index-Cuz6je-V.js');
25
26
  require('@csstools/postcss-is-pseudo-class');
26
27
  require('postcss-rem-to-responsive-pixel');
27
28
  require('postcss-selector-parser');
package/dist/index.mjs CHANGED
@@ -1,7 +1,7 @@
1
- export { c as createPlugins } from './index-BOz3IEuV.mjs';
2
- export { U as UnifiedViteWeappTailwindcssPlugin } from './index-BfmTmdHm.mjs';
3
- export { U as UnifiedWebpackPluginV5 } from './v5-D7B3M2-H.mjs';
4
- import './options-BDij5-AP.mjs';
1
+ export { c as createPlugins } from './index-ejL1iIOn.mjs';
2
+ export { U as UnifiedViteWeappTailwindcssPlugin } from './index-O6zFVUnP.mjs';
3
+ export { U as UnifiedWebpackPluginV5 } from './v5-CafWSEHV.mjs';
4
+ import './options-BH4m6exr.mjs';
5
5
  import 'lru-cache';
6
6
  import 'md5';
7
7
  import './defaults-5A8JI2hW.mjs';
@@ -12,12 +12,13 @@ import 'magic-string';
12
12
  import '@babel/generator';
13
13
  import '@babel/traverse';
14
14
  import '@babel/parser';
15
+ import 'consola';
15
16
  import '@weapp-core/regex';
16
17
  import './replace.mjs';
17
18
  import './shared-COWjpokr.mjs';
18
19
  import '@tailwindcss-mangle/shared';
19
20
  import 'postcss';
20
- import './index-zFq7tKDr.mjs';
21
+ import './index-mmbDSA4j.mjs';
21
22
  import '@csstools/postcss-is-pseudo-class';
22
23
  import 'postcss-rem-to-responsive-pixel';
23
24
  import 'postcss-selector-parser';
@@ -0,0 +1 @@
1
+ export declare function getAstGrep(): Promise<typeof import("@ast-grep/napi").js>;
@@ -0,0 +1,3 @@
1
+ import type { NodePath } from '@babel/traverse';
2
+ import type { Node } from '@babel/types';
3
+ export declare function isEvalPath(p: NodePath<Node>): boolean;
@@ -1,6 +1,6 @@
1
1
  import type MagicString from 'magic-string';
2
2
  import type { IJsHandlerOptions } from '../types';
3
- interface ReplaceNode {
3
+ export interface ReplaceNode {
4
4
  leadingComments?: {
5
5
  value: string;
6
6
  }[] | null | undefined;
@@ -8,6 +8,4 @@ interface ReplaceNode {
8
8
  end?: number | null;
9
9
  }
10
10
  export declare function toUnicodeEscapedString(str: string): string;
11
- export declare function toUnicodeEscapedString2(str: string): string;
12
11
  export declare function replaceHandleValue(str: string, node: ReplaceNode, options: IJsHandlerOptions, ms: MagicString, offset?: number): string;
13
- export {};
@@ -7,11 +7,12 @@ import _babelTraverse from '@babel/traverse';
7
7
  import { parse, parseExpression } from '@babel/parser';
8
8
  import { jsStringEscape } from '@ast-core/escape';
9
9
  import '@weapp-core/escape';
10
+ import { createConsola } from 'consola';
10
11
  import { escapeStringRegexp } from '@weapp-core/regex';
11
12
  import { replaceJs as replaceWxml } from './replace.mjs';
12
13
  import { ClassGenerator, defaultMangleClassFilter } from '@tailwindcss-mangle/shared';
13
14
  import postcss from 'postcss';
14
- import { g as getPlugins } from './index-zFq7tKDr.mjs';
15
+ import { g as getPlugins } from './index-mmbDSA4j.mjs';
15
16
  import path from 'node:path';
16
17
  import process from 'node:process';
17
18
  import { TailwindcssPatcher } from 'tailwindcss-patch';
@@ -139,6 +140,29 @@ function _interopDefaultCompat(e) {
139
140
  _interopDefaultCompat(_babelGenerate);
140
141
  const traverse = _interopDefaultCompat(_babelTraverse);
141
142
 
143
+ const logger = createConsola();
144
+
145
+ function getAstGrep() {
146
+ return __awaiter(this, void 0, void 0, function* () {
147
+ try {
148
+ const { js } = yield import('@ast-grep/napi');
149
+ return js;
150
+ }
151
+ catch (error) {
152
+ logger.warn('请先安装 `@ast-grep/napi` , 安装完成后再尝试运行!');
153
+ throw error;
154
+ }
155
+ });
156
+ }
157
+
158
+ function isEvalPath(p) {
159
+ if (p.isCallExpression()) {
160
+ const calleePath = p.get('callee');
161
+ return calleePath.isIdentifier() && calleePath.node.name === 'eval';
162
+ }
163
+ return false;
164
+ }
165
+
142
166
  const validateFilterRE = /[\w\u00A0-\uFFFF%-?]/;
143
167
  function isValidSelector(selector = '') {
144
168
  return validateFilterRE.test(selector);
@@ -186,25 +210,6 @@ function replaceHandleValue(str, node, options, ms, offset = 0) {
186
210
  return rawStr;
187
211
  }
188
212
 
189
- function isEvalPath(p) {
190
- if (p.isCallExpression()) {
191
- const calleePath = p.get('callee');
192
- return calleePath.isIdentifier() && calleePath.node.name === 'eval';
193
- }
194
- return false;
195
- }
196
- function getAstGrep() {
197
- return __awaiter(this, void 0, void 0, function* () {
198
- try {
199
- const { js } = yield import('@ast-grep/napi');
200
- return js;
201
- }
202
- catch (error) {
203
- console.warn('请先安装 `@ast-grep/napi` , 安装完成后再尝试运行!');
204
- throw error;
205
- }
206
- });
207
- }
208
213
  function astGrepUpdateString(ast, options, ms) {
209
214
  return __awaiter(this, void 0, void 0, function* () {
210
215
  const js = yield getAstGrep();
@@ -836,4 +841,4 @@ function getOptions(opts) {
836
841
  return result;
837
842
  }
838
843
 
839
- export { __awaiter as _, getOptions as g };
844
+ export { __awaiter as _, getOptions as g, logger as l };
@@ -9,11 +9,12 @@ var _babelTraverse = require('@babel/traverse');
9
9
  var parser = require('@babel/parser');
10
10
  var escape = require('@ast-core/escape');
11
11
  require('@weapp-core/escape');
12
+ var consola = require('consola');
12
13
  var regex = require('@weapp-core/regex');
13
14
  var replace = require('./replace.js');
14
15
  var shared = require('@tailwindcss-mangle/shared');
15
16
  var postcss = require('postcss');
16
- var index = require('./index-B2LUAr--.js');
17
+ var index = require('./index-Cuz6je-V.js');
17
18
  var path = require('node:path');
18
19
  var process = require('node:process');
19
20
  var tailwindcssPatch = require('tailwindcss-patch');
@@ -170,6 +171,29 @@ function _interopDefaultCompat$1(e) {
170
171
  _interopDefaultCompat$1(_babelGenerate__default["default"]);
171
172
  const traverse = _interopDefaultCompat$1(_babelTraverse__default["default"]);
172
173
 
174
+ const logger = consola.createConsola();
175
+
176
+ function getAstGrep() {
177
+ return __awaiter(this, void 0, void 0, function* () {
178
+ try {
179
+ const { js } = yield import('@ast-grep/napi');
180
+ return js;
181
+ }
182
+ catch (error) {
183
+ logger.warn('请先安装 `@ast-grep/napi` , 安装完成后再尝试运行!');
184
+ throw error;
185
+ }
186
+ });
187
+ }
188
+
189
+ function isEvalPath(p) {
190
+ if (p.isCallExpression()) {
191
+ const calleePath = p.get('callee');
192
+ return calleePath.isIdentifier() && calleePath.node.name === 'eval';
193
+ }
194
+ return false;
195
+ }
196
+
173
197
  const validateFilterRE = /[\w\u00A0-\uFFFF%-?]/;
174
198
  function isValidSelector(selector = '') {
175
199
  return validateFilterRE.test(selector);
@@ -217,25 +241,6 @@ function replaceHandleValue(str, node, options, ms, offset = 0) {
217
241
  return rawStr;
218
242
  }
219
243
 
220
- function isEvalPath(p) {
221
- if (p.isCallExpression()) {
222
- const calleePath = p.get('callee');
223
- return calleePath.isIdentifier() && calleePath.node.name === 'eval';
224
- }
225
- return false;
226
- }
227
- function getAstGrep() {
228
- return __awaiter(this, void 0, void 0, function* () {
229
- try {
230
- const { js } = yield import('@ast-grep/napi');
231
- return js;
232
- }
233
- catch (error) {
234
- console.warn('请先安装 `@ast-grep/napi` , 安装完成后再尝试运行!');
235
- throw error;
236
- }
237
- });
238
- }
239
244
  function astGrepUpdateString(ast, options, ms) {
240
245
  return __awaiter(this, void 0, void 0, function* () {
241
246
  const js = yield getAstGrep();
@@ -869,3 +874,4 @@ function getOptions(opts) {
869
874
 
870
875
  exports.__awaiter = __awaiter;
871
876
  exports.getOptions = getOptions;
877
+ exports.logger = logger;
package/dist/postcss.js CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var index = require('./index-B2LUAr--.js');
5
+ var index = require('./index-Cuz6je-V.js');
6
6
  var postcssIsPseudoClass = require('@csstools/postcss-is-pseudo-class');
7
7
  var postcssRem2rpx = require('postcss-rem-to-responsive-pixel');
8
8
  require('postcss');
package/dist/postcss.mjs CHANGED
@@ -1,4 +1,4 @@
1
- export { g as getPlugins, p as postcssWeappTailwindcssPostPlugin, a as postcssWeappTailwindcssPrePlugin } from './index-zFq7tKDr.mjs';
1
+ export { g as getPlugins, p as postcssWeappTailwindcssPostPlugin, a as postcssWeappTailwindcssPrePlugin } from './index-mmbDSA4j.mjs';
2
2
  export { default as postcssIsPseudoClass } from '@csstools/postcss-is-pseudo-class';
3
3
  export { default as postcssRem2rpx } from 'postcss-rem-to-responsive-pixel';
4
4
  import 'postcss';
package/dist/types.d.ts CHANGED
@@ -11,7 +11,7 @@ import type { IContext as PostcssContext } from './postcss/plugins/ctx';
11
11
  import type { InjectPreflight } from './postcss/preflight';
12
12
  type PostcssOptions = Partial<Omit<Result, 'file'>>;
13
13
  export type ItemOrItemArray<T> = T | T[];
14
- export type AppType = 'uni-app' | 'uni-app-vite' | 'taro' | 'remax' | 'rax' | 'native' | 'kbone' | 'mpx';
14
+ export type AppType = 'uni-app' | 'uni-app-vite' | 'taro' | 'remax' | 'rax' | 'native' | 'kbone' | 'mpx' | 'weapp-vite';
15
15
  export interface IPropValue {
16
16
  prop: string;
17
17
  value: string;
@@ -1,7 +1,7 @@
1
- import { g as getOptions, _ as __awaiter } from './options-BDij5-AP.mjs';
1
+ import { g as getOptions, _ as __awaiter } from './options-BH4m6exr.mjs';
2
2
  import fs from 'node:fs';
3
3
  import path from 'node:path';
4
- import { b as pluginName } from './index-zFq7tKDr.mjs';
4
+ import { b as pluginName } from './index-mmbDSA4j.mjs';
5
5
  import { c as createDebug } from './index-BEIjgKpF.mjs';
6
6
  import { g as getGroupedEntries, r as removeExt } from './defaults-5A8JI2hW.mjs';
7
7
 
@@ -1,9 +1,9 @@
1
1
  'use strict';
2
2
 
3
- var options = require('./options-DslwksAa.js');
3
+ var options = require('./options-BI6mlQ4i.js');
4
4
  var fs = require('node:fs');
5
5
  var path = require('node:path');
6
- var index = require('./index-B2LUAr--.js');
6
+ var index = require('./index-Cuz6je-V.js');
7
7
  var index$1 = require('./index-HC-Qkn0i.js');
8
8
  var defaults = require('./defaults-CdqzSWsR.js');
9
9
 
package/dist/vite.js CHANGED
@@ -2,8 +2,8 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var index = require('./index-DIZlWN56.js');
6
- require('./options-DslwksAa.js');
5
+ var index = require('./index-CW_nvc9M.js');
6
+ require('./options-BI6mlQ4i.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-B2LUAr--.js');
23
+ require('./index-Cuz6je-V.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/vite.mjs CHANGED
@@ -1,5 +1,5 @@
1
- export { U as UnifiedViteWeappTailwindcssPlugin } from './index-BfmTmdHm.mjs';
2
- import './options-BDij5-AP.mjs';
1
+ export { U as UnifiedViteWeappTailwindcssPlugin } from './index-O6zFVUnP.mjs';
2
+ import './options-BH4m6exr.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-zFq7tKDr.mjs';
19
+ import './index-mmbDSA4j.mjs';
19
20
  import '@csstools/postcss-is-pseudo-class';
20
21
  import 'postcss-rem-to-responsive-pixel';
21
22
  import 'postcss-selector-parser';
package/dist/webpack.js CHANGED
@@ -2,8 +2,8 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var v5 = require('./v5-axtiXCio.js');
6
- require('./options-DslwksAa.js');
5
+ var v5 = require('./v5-DknUknkv.js');
6
+ require('./options-BI6mlQ4i.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-B2LUAr--.js');
23
+ require('./index-Cuz6je-V.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/webpack.mjs CHANGED
@@ -1,5 +1,5 @@
1
- export { U as UnifiedWebpackPluginV5 } from './v5-D7B3M2-H.mjs';
2
- import './options-BDij5-AP.mjs';
1
+ export { U as UnifiedWebpackPluginV5 } from './v5-CafWSEHV.mjs';
2
+ import './options-BH4m6exr.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-zFq7tKDr.mjs';
19
+ import './index-mmbDSA4j.mjs';
19
20
  import '@csstools/postcss-is-pseudo-class';
20
21
  import 'postcss-rem-to-responsive-pixel';
21
22
  import 'postcss-selector-parser';
package/dist/webpack4.js CHANGED
@@ -2,11 +2,11 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var options = require('./options-DslwksAa.js');
5
+ var options = require('./options-BI6mlQ4i.js');
6
6
  var fs = require('node:fs');
7
7
  var path = require('node:path');
8
8
  var webpackSources = require('webpack-sources');
9
- var index = require('./index-B2LUAr--.js');
9
+ var index = require('./index-Cuz6je-V.js');
10
10
  var index$1 = require('./index-HC-Qkn0i.js');
11
11
  var defaults = require('./defaults-CdqzSWsR.js');
12
12
  require('lru-cache');
@@ -17,6 +17,7 @@ require('@babel/traverse');
17
17
  require('@babel/parser');
18
18
  require('@ast-core/escape');
19
19
  require('@weapp-core/escape');
20
+ require('consola');
20
21
  require('@weapp-core/regex');
21
22
  require('./replace.js');
22
23
  require('./shared-r_GpWheO.js');
package/dist/webpack4.mjs CHANGED
@@ -1,8 +1,8 @@
1
- import { g as getOptions, _ as __awaiter } from './options-BDij5-AP.mjs';
1
+ import { g as getOptions, _ as __awaiter } from './options-BH4m6exr.mjs';
2
2
  import fs from 'node:fs';
3
3
  import path from 'node:path';
4
4
  import { ConcatSource, RawSource } from 'webpack-sources';
5
- import { b as pluginName } from './index-zFq7tKDr.mjs';
5
+ import { b as pluginName } from './index-mmbDSA4j.mjs';
6
6
  import { c as createDebug } from './index-BEIjgKpF.mjs';
7
7
  import { g as getGroupedEntries, r as removeExt } from './defaults-5A8JI2hW.mjs';
8
8
  import 'lru-cache';
@@ -13,6 +13,7 @@ import '@babel/traverse';
13
13
  import '@babel/parser';
14
14
  import '@ast-core/escape';
15
15
  import '@weapp-core/escape';
16
+ import 'consola';
16
17
  import '@weapp-core/regex';
17
18
  import './replace.mjs';
18
19
  import './shared-COWjpokr.mjs';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "weapp-tailwindcss",
3
- "version": "3.5.3",
3
+ "version": "3.6.0",
4
4
  "description": "把 tailwindcss 原子化样式思想,带给小程序开发者们! bring tailwindcss to miniprogram developers!",
5
5
  "author": "ice breaker <1324318532@qq.com>",
6
6
  "license": "MIT",
@@ -119,7 +119,7 @@
119
119
  "dist"
120
120
  ],
121
121
  "engines": {
122
- "node": ">=16.6.0"
122
+ "node": "^18.17.0 || >=20.5.0"
123
123
  },
124
124
  "publishConfig": {
125
125
  "access": "public",
@@ -127,11 +127,11 @@
127
127
  },
128
128
  "dependencies": {
129
129
  "@ast-core/escape": "~1.0.1",
130
- "@babel/generator": "~7.25.6",
131
- "@babel/parser": "~7.25.6",
132
- "@babel/traverse": "~7.25.6",
133
- "@babel/types": "~7.25.6",
134
- "@csstools/postcss-is-pseudo-class": "~4.0.8",
130
+ "@babel/generator": "~7.25.7",
131
+ "@babel/parser": "~7.25.8",
132
+ "@babel/traverse": "~7.25.7",
133
+ "@babel/types": "~7.25.8",
134
+ "@csstools/postcss-is-pseudo-class": "~5.0.0",
135
135
  "@tailwindcss-mangle/shared": "~3.0.0",
136
136
  "@weapp-core/escape": "~2.1.0",
137
137
  "@weapp-core/regex": "~1.0.1",
@@ -140,13 +140,13 @@
140
140
  "htmlparser2": "9.1.0",
141
141
  "loader-utils": "2.0.4",
142
142
  "lru-cache": "10.4.3",
143
- "magic-string": "0.30.11",
143
+ "magic-string": "0.30.12",
144
144
  "md5": "2.3.0",
145
- "npm-registry-fetch": "^17.1.0",
145
+ "npm-registry-fetch": "^18.0.1",
146
146
  "postcss": "~8.4.47",
147
147
  "postcss-rem-to-responsive-pixel": "~6.0.2",
148
148
  "postcss-selector-parser": "~6.1.2",
149
- "semver": "~7.6.2",
149
+ "semver": "~7.6.3",
150
150
  "tailwindcss-patch": "~4.0.0",
151
151
  "webpack-sources": "3.2.3"
152
152
  },
@@ -158,13 +158,13 @@
158
158
  "test": "npm run postinstall && vitest run",
159
159
  "test:dev": "vitest",
160
160
  "test:ui": "vitest --ui",
161
- "clean": "node scripts/clean.js",
161
+ "clean": "tsx scripts/clean.ts",
162
162
  "raw": "tsx scripts/raw",
163
163
  "get-decl": "tsx scripts/get-decl.ts",
164
164
  "sync": "cnpm sync weapp-tailwindcss-webpack-plugin weapp-tailwindcss weapp-tw",
165
165
  "ls:pack": "npm pack --dry-run",
166
166
  "cli:patch": "node bin/weapp-tailwindcss.js patch",
167
- "release": "node scripts/release.js",
167
+ "release": "tsx scripts/release.ts",
168
168
  "generate:readme": "tsx --watch scripts/readme/write.ts watch scripts/readme/**/*",
169
169
  "lint": "eslint .",
170
170
  "lint:fix": "eslint ./src --fix",