@weapp-tailwindcss/merge 1.1.0 → 1.2.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.
@@ -0,0 +1,32 @@
1
+ "use strict"; function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }// src/postinstall.ts
2
+ var _fs = require('fs'); var _fs2 = _interopRequireDefault(_fs);
3
+ var _path = require('path'); var _path2 = _interopRequireDefault(_path);
4
+ var _localpkg = require('local-pkg');
5
+ var _satisfiesjs = require('semver/functions/satisfies.js'); var _satisfiesjs2 = _interopRequireDefault(_satisfiesjs);
6
+ function main() {
7
+ const distDir = _path2.default.resolve(__dirname, "../dist");
8
+ if (!_fs2.default.existsSync(distDir)) {
9
+ return;
10
+ }
11
+ const packageInfo = _localpkg.getPackageInfoSync.call(void 0, "tailwindcss");
12
+ if (!packageInfo) {
13
+ console.warn("tailwindcss not found in the project. Skipping swicth version of tailwind-merge.");
14
+ return;
15
+ }
16
+ const tailwindVersion = packageInfo.version;
17
+ let targetVersion = 3;
18
+ if (_satisfiesjs2.default.call(void 0, tailwindVersion, "^4.0.0")) {
19
+ targetVersion = 4;
20
+ }
21
+ console.log(`tailwindcss version: ${tailwindVersion}`);
22
+ console.log(`Switch version of tailwind-merge to v${targetVersion - 1}.`);
23
+ for (const ext of ["cjs", "d.cts", "d.ts", "js"]) {
24
+ const file = `v${targetVersion}.${ext}`;
25
+ _fs2.default.copyFileSync(
26
+ _path2.default.resolve(distDir, file),
27
+ _path2.default.resolve(distDir, `index.${ext}`)
28
+ );
29
+ }
30
+ console.log("Switch version of tailwind-merge success.");
31
+ }
32
+ main();
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@weapp-tailwindcss/merge",
3
3
  "type": "module",
4
- "version": "1.1.0",
4
+ "version": "1.2.0",
5
5
  "description": "weapp-tailwindcss",
6
6
  "author": "ice breaker <1324318532@qq.com>",
7
7
  "license": "MIT",
@@ -52,11 +52,11 @@
52
52
  "clsx": "^2.1.1",
53
53
  "local-pkg": "^1.1.1",
54
54
  "semver": "^7.7.1",
55
- "tailwind-merge": "^3.1.0",
55
+ "tailwind-merge": "^3.3.0",
56
56
  "tailwind-merge-v2": "npm:tailwind-merge@^2.6.0"
57
57
  },
58
58
  "devDependencies": {
59
- "weapp-tailwindcss": "4.1.3"
59
+ "weapp-tailwindcss": "4.1.7"
60
60
  },
61
61
  "scripts": {
62
62
  "dev": "tsup --watch --sourcemap",
@@ -66,6 +66,6 @@
66
66
  "release": "pnpm publish",
67
67
  "lint": "eslint .",
68
68
  "lint:fix": "eslint . --fix",
69
- "postinstall": "node scripts/postinstall.js"
69
+ "postinstall": "node scripts/postinstall.cjs"
70
70
  }
71
71
  }
@@ -0,0 +1,14 @@
1
+ const fs = require('node:fs')
2
+ const path = require('node:path')
3
+
4
+ function main() {
5
+ const targetPath = path.resolve(__dirname, '../dist/postinstall.cjs')
6
+ if (fs.existsSync(targetPath)) {
7
+ require(targetPath)
8
+ }
9
+ else {
10
+ console.log('postinstall.cjs not found')
11
+ }
12
+ }
13
+
14
+ main()
@@ -1,39 +0,0 @@
1
- import fs from 'node:fs'
2
- import path from 'node:path'
3
- import { getPackageInfoSync } from 'local-pkg'
4
- import satisfies from 'semver/functions/satisfies.js'
5
-
6
- function main() {
7
- const distDir = path.resolve(import.meta.dirname, '../dist')
8
-
9
- if (!fs.existsSync(distDir)) {
10
- return
11
- }
12
- const packageInfo = getPackageInfoSync('tailwindcss')
13
-
14
- if (!packageInfo) {
15
- console.warn('tailwindcss not found in the project. Skipping swicth version of tailwind-merge.')
16
- return
17
- }
18
-
19
- const tailwindVersion = packageInfo.version
20
-
21
- let targetVersion = 3
22
-
23
- if (satisfies(tailwindVersion, '^4.0.0')) {
24
- targetVersion = 4
25
- }
26
-
27
- console.log(`tailwindcss version: ${tailwindVersion}`)
28
- console.log(`Switch version of tailwind-merge to v${targetVersion - 1}.`)
29
- for (const ext of ['cjs', 'd.cts', 'd.ts', 'js']) {
30
- const file = `v${targetVersion}.${ext}`
31
- fs.copyFileSync(
32
- path.resolve(distDir, file),
33
- path.resolve(distDir, `index.${ext}`),
34
- )
35
- }
36
- console.log('Switch version of tailwind-merge success.')
37
- }
38
-
39
- main()