weapp-tailwindcss 4.7.4 → 4.7.5-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.
- package/dist/{chunk-T5BSWDY2.js → chunk-24ADBRZN.js} +25 -15
- package/dist/{chunk-FPX2BD2A.mjs → chunk-42FXROX4.mjs} +23 -13
- package/dist/{chunk-QA6SPWSQ.js → chunk-E5LRICST.js} +253 -25
- package/dist/{chunk-SIZNRUIV.js → chunk-GGD75A34.js} +8 -0
- package/dist/{chunk-6IYMPBCH.mjs → chunk-PUFKPENL.mjs} +56 -14
- package/dist/{chunk-I6FBWASF.js → chunk-RLWIDWTA.js} +59 -17
- package/dist/{chunk-3ARXMTWC.mjs → chunk-SHMBWMDV.mjs} +8 -0
- package/dist/{chunk-HMTZ4JJN.js → chunk-SJV6DCNZ.js} +22 -15
- package/dist/{chunk-JII7EQ6K.mjs → chunk-TK5LOBHZ.mjs} +23 -16
- package/dist/{chunk-V35QS2PT.mjs → chunk-XEQBYGBX.mjs} +229 -1
- package/dist/cli.js +5 -5
- package/dist/cli.mjs +2 -2
- package/dist/core.js +29 -13
- package/dist/core.mjs +30 -14
- package/dist/gulp.js +4 -5
- package/dist/gulp.mjs +3 -4
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +6 -7
- package/dist/index.mjs +5 -6
- package/dist/presets.js +2 -2
- package/dist/presets.mjs +1 -1
- package/dist/types.d.mts +11 -1
- package/dist/types.d.ts +11 -1
- package/dist/vite.js +4 -5
- package/dist/vite.mjs +3 -4
- package/dist/webpack.js +4 -5
- package/dist/webpack.mjs +3 -4
- package/dist/webpack4.js +26 -16
- package/dist/webpack4.mjs +24 -14
- package/package.json +1 -1
- package/dist/chunk-667CYXAH.mjs +0 -133
- package/dist/chunk-BUMQQPAO.js +0 -133
package/dist/vite.js
CHANGED
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkRLWIDWTAjs = require('./chunk-RLWIDWTA.js');
|
|
4
4
|
require('./chunk-W7BVY5S5.js');
|
|
5
5
|
require('./chunk-LTJQUORK.js');
|
|
6
|
-
require('./chunk-
|
|
7
|
-
require('./chunk-QA6SPWSQ.js');
|
|
6
|
+
require('./chunk-E5LRICST.js');
|
|
8
7
|
require('./chunk-DWAEHRHN.js');
|
|
9
|
-
require('./chunk-
|
|
8
|
+
require('./chunk-GGD75A34.js');
|
|
10
9
|
require('./chunk-WXBFAARR.js');
|
|
11
10
|
require('./chunk-UW3WHSZ5.js');
|
|
12
11
|
require('./chunk-R7GWRQDJ.js');
|
|
13
12
|
|
|
14
13
|
|
|
15
|
-
exports.UnifiedViteWeappTailwindcssPlugin =
|
|
14
|
+
exports.UnifiedViteWeappTailwindcssPlugin = _chunkRLWIDWTAjs.UnifiedViteWeappTailwindcssPlugin;
|
package/dist/vite.mjs
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
UnifiedViteWeappTailwindcssPlugin
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-PUFKPENL.mjs";
|
|
4
4
|
import "./chunk-KZUIVLPP.mjs";
|
|
5
5
|
import "./chunk-RRHPTTCP.mjs";
|
|
6
|
-
import "./chunk-
|
|
7
|
-
import "./chunk-V35QS2PT.mjs";
|
|
6
|
+
import "./chunk-XEQBYGBX.mjs";
|
|
8
7
|
import "./chunk-VSRDBMDB.mjs";
|
|
9
|
-
import "./chunk-
|
|
8
|
+
import "./chunk-SHMBWMDV.mjs";
|
|
10
9
|
import "./chunk-KZJLIZIK.mjs";
|
|
11
10
|
import "./chunk-ZNKIYZRQ.mjs";
|
|
12
11
|
import "./chunk-SCOGAO45.mjs";
|
package/dist/webpack.js
CHANGED
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunk24ADBRZNjs = require('./chunk-24ADBRZN.js');
|
|
4
4
|
require('./chunk-6GP37C26.js');
|
|
5
5
|
require('./chunk-W7BVY5S5.js');
|
|
6
6
|
require('./chunk-LTJQUORK.js');
|
|
7
|
-
require('./chunk-
|
|
8
|
-
require('./chunk-QA6SPWSQ.js');
|
|
7
|
+
require('./chunk-E5LRICST.js');
|
|
9
8
|
require('./chunk-DWAEHRHN.js');
|
|
10
|
-
require('./chunk-
|
|
9
|
+
require('./chunk-GGD75A34.js');
|
|
11
10
|
require('./chunk-WXBFAARR.js');
|
|
12
11
|
require('./chunk-UW3WHSZ5.js');
|
|
13
12
|
require('./chunk-R7GWRQDJ.js');
|
|
14
13
|
|
|
15
14
|
|
|
16
|
-
exports.UnifiedWebpackPluginV5 =
|
|
15
|
+
exports.UnifiedWebpackPluginV5 = _chunk24ADBRZNjs.UnifiedWebpackPluginV5;
|
package/dist/webpack.mjs
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
UnifiedWebpackPluginV5
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-42FXROX4.mjs";
|
|
4
4
|
import "./chunk-2F7HOQQY.mjs";
|
|
5
5
|
import "./chunk-KZUIVLPP.mjs";
|
|
6
6
|
import "./chunk-RRHPTTCP.mjs";
|
|
7
|
-
import "./chunk-
|
|
8
|
-
import "./chunk-V35QS2PT.mjs";
|
|
7
|
+
import "./chunk-XEQBYGBX.mjs";
|
|
9
8
|
import "./chunk-VSRDBMDB.mjs";
|
|
10
|
-
import "./chunk-
|
|
9
|
+
import "./chunk-SHMBWMDV.mjs";
|
|
11
10
|
import "./chunk-KZJLIZIK.mjs";
|
|
12
11
|
import "./chunk-ZNKIYZRQ.mjs";
|
|
13
12
|
import "./chunk-SCOGAO45.mjs";
|
package/dist/webpack4.js
CHANGED
|
@@ -13,13 +13,12 @@ var _chunkLTJQUORKjs = require('./chunk-LTJQUORK.js');
|
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
|
|
16
|
-
var _chunkBUMQQPAOjs = require('./chunk-BUMQQPAO.js');
|
|
17
16
|
|
|
18
17
|
|
|
19
18
|
|
|
20
|
-
var
|
|
19
|
+
var _chunkE5LRICSTjs = require('./chunk-E5LRICST.js');
|
|
21
20
|
require('./chunk-DWAEHRHN.js');
|
|
22
|
-
require('./chunk-
|
|
21
|
+
require('./chunk-GGD75A34.js');
|
|
23
22
|
require('./chunk-WXBFAARR.js');
|
|
24
23
|
|
|
25
24
|
|
|
@@ -31,10 +30,10 @@ var _fs = require('fs'); var _fs2 = _interopRequireDefault(_fs);
|
|
|
31
30
|
var _path = require('path'); var _path2 = _interopRequireDefault(_path);
|
|
32
31
|
var _process = require('process'); var _process2 = _interopRequireDefault(_process);
|
|
33
32
|
var _webpacksources = require('webpack-sources');
|
|
34
|
-
var debug =
|
|
33
|
+
var debug = _chunkE5LRICSTjs.createDebug.call(void 0, );
|
|
35
34
|
var UnifiedWebpackPluginV4 = class {
|
|
36
35
|
constructor(options = {}) {
|
|
37
|
-
this.options =
|
|
36
|
+
this.options = _chunkE5LRICSTjs.getCompilerContext.call(void 0, options);
|
|
38
37
|
this.appType = this.options.appType;
|
|
39
38
|
}
|
|
40
39
|
apply(compiler) {
|
|
@@ -50,15 +49,24 @@ var UnifiedWebpackPluginV4 = class {
|
|
|
50
49
|
jsHandler,
|
|
51
50
|
runtimeLoaderPath,
|
|
52
51
|
cache,
|
|
53
|
-
twPatcher
|
|
52
|
+
twPatcher: initialTwPatcher,
|
|
53
|
+
refreshTailwindcssPatcher
|
|
54
54
|
} = this.options;
|
|
55
55
|
if (disabled) {
|
|
56
56
|
return;
|
|
57
57
|
}
|
|
58
|
-
const
|
|
58
|
+
const runtimeState = {
|
|
59
|
+
twPatcher: initialTwPatcher,
|
|
60
|
+
patchPromise: _chunkE5LRICSTjs.createTailwindPatchPromise.call(void 0, initialTwPatcher),
|
|
61
|
+
refreshTailwindcssPatcher
|
|
62
|
+
};
|
|
63
|
+
const refreshRuntimeState = async (force) => {
|
|
64
|
+
await _chunkE5LRICSTjs.refreshTailwindRuntimeState.call(void 0, runtimeState, force);
|
|
65
|
+
};
|
|
59
66
|
async function getClassSetInLoader() {
|
|
60
|
-
await
|
|
61
|
-
await
|
|
67
|
+
await refreshRuntimeState(true);
|
|
68
|
+
await runtimeState.patchPromise;
|
|
69
|
+
await _chunkE5LRICSTjs.collectRuntimeClassSet.call(void 0, runtimeState.twPatcher, { force: true, skipRefresh: true });
|
|
62
70
|
}
|
|
63
71
|
onLoad();
|
|
64
72
|
const loader = _nullishCoalesce(runtimeLoaderPath, () => ( _path2.default.resolve(__dirname, "./weapp-tw-runtime-loader.js")));
|
|
@@ -71,8 +79,8 @@ var UnifiedWebpackPluginV4 = class {
|
|
|
71
79
|
ident: null,
|
|
72
80
|
type: null
|
|
73
81
|
};
|
|
74
|
-
compiler.hooks.compilation.tap(
|
|
75
|
-
compilation.hooks.normalModuleLoader.tap(
|
|
82
|
+
compiler.hooks.compilation.tap(_chunkE5LRICSTjs.pluginName, (compilation) => {
|
|
83
|
+
compilation.hooks.normalModuleLoader.tap(_chunkE5LRICSTjs.pluginName, (_loaderContext, module) => {
|
|
76
84
|
if (isExisted) {
|
|
77
85
|
const idx = module.loaders.findIndex((x) => x.loader.includes("postcss-loader"));
|
|
78
86
|
if (idx > -1) {
|
|
@@ -81,8 +89,8 @@ var UnifiedWebpackPluginV4 = class {
|
|
|
81
89
|
}
|
|
82
90
|
});
|
|
83
91
|
});
|
|
84
|
-
compiler.hooks.emit.tapPromise(
|
|
85
|
-
await patchPromise;
|
|
92
|
+
compiler.hooks.emit.tapPromise(_chunkE5LRICSTjs.pluginName, async (compilation) => {
|
|
93
|
+
await runtimeState.patchPromise;
|
|
86
94
|
onStart();
|
|
87
95
|
debug("start");
|
|
88
96
|
for (const chunk of compilation.chunks) {
|
|
@@ -145,7 +153,9 @@ var UnifiedWebpackPluginV4 = class {
|
|
|
145
153
|
}
|
|
146
154
|
};
|
|
147
155
|
const groupedEntries = _chunkUW3WHSZ5js.getGroupedEntries.call(void 0, entries, this.options);
|
|
148
|
-
|
|
156
|
+
await refreshRuntimeState(true);
|
|
157
|
+
await runtimeState.patchPromise;
|
|
158
|
+
const runtimeSet = await _chunkE5LRICSTjs.collectRuntimeClassSet.call(void 0, runtimeState.twPatcher, { force: true, skipRefresh: true });
|
|
149
159
|
debug("get runtimeSet, class count: %d", runtimeSet.size);
|
|
150
160
|
const tasks = [];
|
|
151
161
|
if (Array.isArray(groupedEntries.html)) {
|
|
@@ -241,7 +251,7 @@ var UnifiedWebpackPluginV4 = class {
|
|
|
241
251
|
debug("css cache hit: %s", file);
|
|
242
252
|
},
|
|
243
253
|
transform: async () => {
|
|
244
|
-
await patchPromise;
|
|
254
|
+
await runtimeState.patchPromise;
|
|
245
255
|
const { css } = await styleHandler(rawSource, {
|
|
246
256
|
isMainChunk: mainCssChunkMatcher(file, this.appType),
|
|
247
257
|
postcssOptions: {
|
|
@@ -249,7 +259,7 @@ var UnifiedWebpackPluginV4 = class {
|
|
|
249
259
|
from: file
|
|
250
260
|
}
|
|
251
261
|
},
|
|
252
|
-
majorVersion: twPatcher.majorVersion
|
|
262
|
+
majorVersion: runtimeState.twPatcher.majorVersion
|
|
253
263
|
});
|
|
254
264
|
const source = new (0, _webpacksources.ConcatSource)(css);
|
|
255
265
|
onUpdate(file, rawSource, css);
|
package/dist/webpack4.mjs
CHANGED
|
@@ -12,14 +12,13 @@ import {
|
|
|
12
12
|
import {
|
|
13
13
|
collectRuntimeClassSet,
|
|
14
14
|
createDebug,
|
|
15
|
-
createTailwindPatchPromise
|
|
16
|
-
} from "./chunk-667CYXAH.mjs";
|
|
17
|
-
import {
|
|
15
|
+
createTailwindPatchPromise,
|
|
18
16
|
getCompilerContext,
|
|
19
|
-
pluginName
|
|
20
|
-
|
|
17
|
+
pluginName,
|
|
18
|
+
refreshTailwindRuntimeState
|
|
19
|
+
} from "./chunk-XEQBYGBX.mjs";
|
|
21
20
|
import "./chunk-VSRDBMDB.mjs";
|
|
22
|
-
import "./chunk-
|
|
21
|
+
import "./chunk-SHMBWMDV.mjs";
|
|
23
22
|
import "./chunk-KZJLIZIK.mjs";
|
|
24
23
|
import {
|
|
25
24
|
getGroupedEntries
|
|
@@ -52,15 +51,24 @@ var UnifiedWebpackPluginV4 = class {
|
|
|
52
51
|
jsHandler,
|
|
53
52
|
runtimeLoaderPath,
|
|
54
53
|
cache,
|
|
55
|
-
twPatcher
|
|
54
|
+
twPatcher: initialTwPatcher,
|
|
55
|
+
refreshTailwindcssPatcher
|
|
56
56
|
} = this.options;
|
|
57
57
|
if (disabled) {
|
|
58
58
|
return;
|
|
59
59
|
}
|
|
60
|
-
const
|
|
60
|
+
const runtimeState = {
|
|
61
|
+
twPatcher: initialTwPatcher,
|
|
62
|
+
patchPromise: createTailwindPatchPromise(initialTwPatcher),
|
|
63
|
+
refreshTailwindcssPatcher
|
|
64
|
+
};
|
|
65
|
+
const refreshRuntimeState = async (force) => {
|
|
66
|
+
await refreshTailwindRuntimeState(runtimeState, force);
|
|
67
|
+
};
|
|
61
68
|
async function getClassSetInLoader() {
|
|
62
|
-
await
|
|
63
|
-
await
|
|
69
|
+
await refreshRuntimeState(true);
|
|
70
|
+
await runtimeState.patchPromise;
|
|
71
|
+
await collectRuntimeClassSet(runtimeState.twPatcher, { force: true, skipRefresh: true });
|
|
64
72
|
}
|
|
65
73
|
onLoad();
|
|
66
74
|
const loader = runtimeLoaderPath ?? path.resolve(__dirname, "./weapp-tw-runtime-loader.js");
|
|
@@ -84,7 +92,7 @@ var UnifiedWebpackPluginV4 = class {
|
|
|
84
92
|
});
|
|
85
93
|
});
|
|
86
94
|
compiler.hooks.emit.tapPromise(pluginName, async (compilation) => {
|
|
87
|
-
await patchPromise;
|
|
95
|
+
await runtimeState.patchPromise;
|
|
88
96
|
onStart();
|
|
89
97
|
debug("start");
|
|
90
98
|
for (const chunk of compilation.chunks) {
|
|
@@ -147,7 +155,9 @@ var UnifiedWebpackPluginV4 = class {
|
|
|
147
155
|
}
|
|
148
156
|
};
|
|
149
157
|
const groupedEntries = getGroupedEntries(entries, this.options);
|
|
150
|
-
|
|
158
|
+
await refreshRuntimeState(true);
|
|
159
|
+
await runtimeState.patchPromise;
|
|
160
|
+
const runtimeSet = await collectRuntimeClassSet(runtimeState.twPatcher, { force: true, skipRefresh: true });
|
|
151
161
|
debug("get runtimeSet, class count: %d", runtimeSet.size);
|
|
152
162
|
const tasks = [];
|
|
153
163
|
if (Array.isArray(groupedEntries.html)) {
|
|
@@ -243,7 +253,7 @@ var UnifiedWebpackPluginV4 = class {
|
|
|
243
253
|
debug("css cache hit: %s", file);
|
|
244
254
|
},
|
|
245
255
|
transform: async () => {
|
|
246
|
-
await patchPromise;
|
|
256
|
+
await runtimeState.patchPromise;
|
|
247
257
|
const { css } = await styleHandler(rawSource, {
|
|
248
258
|
isMainChunk: mainCssChunkMatcher(file, this.appType),
|
|
249
259
|
postcssOptions: {
|
|
@@ -251,7 +261,7 @@ var UnifiedWebpackPluginV4 = class {
|
|
|
251
261
|
from: file
|
|
252
262
|
}
|
|
253
263
|
},
|
|
254
|
-
majorVersion: twPatcher.majorVersion
|
|
264
|
+
majorVersion: runtimeState.twPatcher.majorVersion
|
|
255
265
|
});
|
|
256
266
|
const source = new ConcatSource(css);
|
|
257
267
|
onUpdate(file, rawSource, css);
|
package/package.json
CHANGED
package/dist/chunk-667CYXAH.mjs
DELETED
|
@@ -1,133 +0,0 @@
|
|
|
1
|
-
// src/tailwindcss/runtime.ts
|
|
2
|
-
import { statSync } from "fs";
|
|
3
|
-
|
|
4
|
-
// src/debug/index.ts
|
|
5
|
-
import _createDebug from "debug";
|
|
6
|
-
var _debug = _createDebug("weapp-tw");
|
|
7
|
-
function createDebug(prefix) {
|
|
8
|
-
function debug2(formatter, ...args) {
|
|
9
|
-
return _debug((prefix ?? "") + formatter, ...args);
|
|
10
|
-
}
|
|
11
|
-
return debug2;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
// src/tailwindcss/runtime.ts
|
|
15
|
-
var debug = createDebug("[tailwindcss:runtime] ");
|
|
16
|
-
var runtimeClassSetCache = /* @__PURE__ */ new WeakMap();
|
|
17
|
-
function getCacheEntry(twPatcher) {
|
|
18
|
-
let entry = runtimeClassSetCache.get(twPatcher);
|
|
19
|
-
if (!entry) {
|
|
20
|
-
entry = {};
|
|
21
|
-
runtimeClassSetCache.set(twPatcher, entry);
|
|
22
|
-
}
|
|
23
|
-
return entry;
|
|
24
|
-
}
|
|
25
|
-
function getTailwindConfigSignature(twPatcher) {
|
|
26
|
-
const configPath = twPatcher.options?.tailwind?.config;
|
|
27
|
-
if (typeof configPath !== "string" || configPath.length === 0) {
|
|
28
|
-
return void 0;
|
|
29
|
-
}
|
|
30
|
-
try {
|
|
31
|
-
const stats = statSync(configPath);
|
|
32
|
-
return `${configPath}:${stats.size}:${stats.mtimeMs}`;
|
|
33
|
-
} catch {
|
|
34
|
-
return `${configPath}:missing`;
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
function invalidateRuntimeClassSet(twPatcher) {
|
|
38
|
-
if (!twPatcher) {
|
|
39
|
-
return;
|
|
40
|
-
}
|
|
41
|
-
runtimeClassSetCache.delete(twPatcher);
|
|
42
|
-
}
|
|
43
|
-
function createTailwindPatchPromise(twPatcher) {
|
|
44
|
-
return Promise.resolve(twPatcher.patch()).then((result) => {
|
|
45
|
-
invalidateRuntimeClassSet(twPatcher);
|
|
46
|
-
return result;
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
function shouldPreferSync(majorVersion) {
|
|
50
|
-
if (majorVersion == null) {
|
|
51
|
-
return true;
|
|
52
|
-
}
|
|
53
|
-
if (majorVersion === 3) {
|
|
54
|
-
return true;
|
|
55
|
-
}
|
|
56
|
-
if (majorVersion === 4) {
|
|
57
|
-
return true;
|
|
58
|
-
}
|
|
59
|
-
return false;
|
|
60
|
-
}
|
|
61
|
-
function tryGetRuntimeClassSetSync(twPatcher) {
|
|
62
|
-
if (typeof twPatcher.getClassSetSync !== "function") {
|
|
63
|
-
return void 0;
|
|
64
|
-
}
|
|
65
|
-
if (!shouldPreferSync(twPatcher.majorVersion)) {
|
|
66
|
-
return void 0;
|
|
67
|
-
}
|
|
68
|
-
try {
|
|
69
|
-
return twPatcher.getClassSetSync();
|
|
70
|
-
} catch (error) {
|
|
71
|
-
if (twPatcher.majorVersion === 4) {
|
|
72
|
-
debug("getClassSetSync() unavailable for tailwindcss v4, fallback to async getClassSet(): %O", error);
|
|
73
|
-
} else {
|
|
74
|
-
debug("getClassSetSync() failed, fallback to async getClassSet(): %O", error);
|
|
75
|
-
}
|
|
76
|
-
return void 0;
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
async function collectRuntimeClassSet(twPatcher, options = {}) {
|
|
80
|
-
const entry = getCacheEntry(twPatcher);
|
|
81
|
-
const signature = getTailwindConfigSignature(twPatcher);
|
|
82
|
-
if (!options.force) {
|
|
83
|
-
if (entry.value && entry.signature === signature) {
|
|
84
|
-
return entry.value;
|
|
85
|
-
}
|
|
86
|
-
if (entry.promise) {
|
|
87
|
-
return entry.promise;
|
|
88
|
-
}
|
|
89
|
-
} else {
|
|
90
|
-
entry.value = void 0;
|
|
91
|
-
}
|
|
92
|
-
const task = (async () => {
|
|
93
|
-
const syncSet = tryGetRuntimeClassSetSync(twPatcher);
|
|
94
|
-
if (syncSet) {
|
|
95
|
-
return syncSet;
|
|
96
|
-
}
|
|
97
|
-
try {
|
|
98
|
-
const result = await twPatcher.extract({ write: false });
|
|
99
|
-
if (result?.classSet) {
|
|
100
|
-
return result.classSet;
|
|
101
|
-
}
|
|
102
|
-
} catch (error) {
|
|
103
|
-
debug("extract() failed, fallback to getClassSet(): %O", error);
|
|
104
|
-
}
|
|
105
|
-
try {
|
|
106
|
-
const fallbackSet = await Promise.resolve(twPatcher.getClassSet());
|
|
107
|
-
if (fallbackSet) {
|
|
108
|
-
return fallbackSet;
|
|
109
|
-
}
|
|
110
|
-
} catch (error) {
|
|
111
|
-
debug("getClassSet() failed, returning empty set: %O", error);
|
|
112
|
-
}
|
|
113
|
-
return /* @__PURE__ */ new Set();
|
|
114
|
-
})();
|
|
115
|
-
entry.promise = task;
|
|
116
|
-
entry.signature = signature;
|
|
117
|
-
try {
|
|
118
|
-
const resolved = await task;
|
|
119
|
-
entry.value = resolved;
|
|
120
|
-
entry.promise = void 0;
|
|
121
|
-
entry.signature = signature;
|
|
122
|
-
return resolved;
|
|
123
|
-
} catch (error) {
|
|
124
|
-
entry.promise = void 0;
|
|
125
|
-
throw error;
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
export {
|
|
130
|
-
createDebug,
|
|
131
|
-
createTailwindPatchPromise,
|
|
132
|
-
collectRuntimeClassSet
|
|
133
|
-
};
|
package/dist/chunk-BUMQQPAO.js
DELETED
|
@@ -1,133 +0,0 @@
|
|
|
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/tailwindcss/runtime.ts
|
|
2
|
-
var _fs = require('fs');
|
|
3
|
-
|
|
4
|
-
// src/debug/index.ts
|
|
5
|
-
var _debug2 = require('debug'); var _debug3 = _interopRequireDefault(_debug2);
|
|
6
|
-
var _debug = _debug3.default.call(void 0, "weapp-tw");
|
|
7
|
-
function createDebug(prefix) {
|
|
8
|
-
function debug2(formatter, ...args) {
|
|
9
|
-
return _debug((_nullishCoalesce(prefix, () => ( ""))) + formatter, ...args);
|
|
10
|
-
}
|
|
11
|
-
return debug2;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
// src/tailwindcss/runtime.ts
|
|
15
|
-
var debug = createDebug("[tailwindcss:runtime] ");
|
|
16
|
-
var runtimeClassSetCache = /* @__PURE__ */ new WeakMap();
|
|
17
|
-
function getCacheEntry(twPatcher) {
|
|
18
|
-
let entry = runtimeClassSetCache.get(twPatcher);
|
|
19
|
-
if (!entry) {
|
|
20
|
-
entry = {};
|
|
21
|
-
runtimeClassSetCache.set(twPatcher, entry);
|
|
22
|
-
}
|
|
23
|
-
return entry;
|
|
24
|
-
}
|
|
25
|
-
function getTailwindConfigSignature(twPatcher) {
|
|
26
|
-
const configPath = _optionalChain([twPatcher, 'access', _ => _.options, 'optionalAccess', _2 => _2.tailwind, 'optionalAccess', _3 => _3.config]);
|
|
27
|
-
if (typeof configPath !== "string" || configPath.length === 0) {
|
|
28
|
-
return void 0;
|
|
29
|
-
}
|
|
30
|
-
try {
|
|
31
|
-
const stats = _fs.statSync.call(void 0, configPath);
|
|
32
|
-
return `${configPath}:${stats.size}:${stats.mtimeMs}`;
|
|
33
|
-
} catch (e) {
|
|
34
|
-
return `${configPath}:missing`;
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
function invalidateRuntimeClassSet(twPatcher) {
|
|
38
|
-
if (!twPatcher) {
|
|
39
|
-
return;
|
|
40
|
-
}
|
|
41
|
-
runtimeClassSetCache.delete(twPatcher);
|
|
42
|
-
}
|
|
43
|
-
function createTailwindPatchPromise(twPatcher) {
|
|
44
|
-
return Promise.resolve(twPatcher.patch()).then((result) => {
|
|
45
|
-
invalidateRuntimeClassSet(twPatcher);
|
|
46
|
-
return result;
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
function shouldPreferSync(majorVersion) {
|
|
50
|
-
if (majorVersion == null) {
|
|
51
|
-
return true;
|
|
52
|
-
}
|
|
53
|
-
if (majorVersion === 3) {
|
|
54
|
-
return true;
|
|
55
|
-
}
|
|
56
|
-
if (majorVersion === 4) {
|
|
57
|
-
return true;
|
|
58
|
-
}
|
|
59
|
-
return false;
|
|
60
|
-
}
|
|
61
|
-
function tryGetRuntimeClassSetSync(twPatcher) {
|
|
62
|
-
if (typeof twPatcher.getClassSetSync !== "function") {
|
|
63
|
-
return void 0;
|
|
64
|
-
}
|
|
65
|
-
if (!shouldPreferSync(twPatcher.majorVersion)) {
|
|
66
|
-
return void 0;
|
|
67
|
-
}
|
|
68
|
-
try {
|
|
69
|
-
return twPatcher.getClassSetSync();
|
|
70
|
-
} catch (error) {
|
|
71
|
-
if (twPatcher.majorVersion === 4) {
|
|
72
|
-
debug("getClassSetSync() unavailable for tailwindcss v4, fallback to async getClassSet(): %O", error);
|
|
73
|
-
} else {
|
|
74
|
-
debug("getClassSetSync() failed, fallback to async getClassSet(): %O", error);
|
|
75
|
-
}
|
|
76
|
-
return void 0;
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
async function collectRuntimeClassSet(twPatcher, options = {}) {
|
|
80
|
-
const entry = getCacheEntry(twPatcher);
|
|
81
|
-
const signature = getTailwindConfigSignature(twPatcher);
|
|
82
|
-
if (!options.force) {
|
|
83
|
-
if (entry.value && entry.signature === signature) {
|
|
84
|
-
return entry.value;
|
|
85
|
-
}
|
|
86
|
-
if (entry.promise) {
|
|
87
|
-
return entry.promise;
|
|
88
|
-
}
|
|
89
|
-
} else {
|
|
90
|
-
entry.value = void 0;
|
|
91
|
-
}
|
|
92
|
-
const task = (async () => {
|
|
93
|
-
const syncSet = tryGetRuntimeClassSetSync(twPatcher);
|
|
94
|
-
if (syncSet) {
|
|
95
|
-
return syncSet;
|
|
96
|
-
}
|
|
97
|
-
try {
|
|
98
|
-
const result = await twPatcher.extract({ write: false });
|
|
99
|
-
if (_optionalChain([result, 'optionalAccess', _4 => _4.classSet])) {
|
|
100
|
-
return result.classSet;
|
|
101
|
-
}
|
|
102
|
-
} catch (error) {
|
|
103
|
-
debug("extract() failed, fallback to getClassSet(): %O", error);
|
|
104
|
-
}
|
|
105
|
-
try {
|
|
106
|
-
const fallbackSet = await Promise.resolve(twPatcher.getClassSet());
|
|
107
|
-
if (fallbackSet) {
|
|
108
|
-
return fallbackSet;
|
|
109
|
-
}
|
|
110
|
-
} catch (error) {
|
|
111
|
-
debug("getClassSet() failed, returning empty set: %O", error);
|
|
112
|
-
}
|
|
113
|
-
return /* @__PURE__ */ new Set();
|
|
114
|
-
})();
|
|
115
|
-
entry.promise = task;
|
|
116
|
-
entry.signature = signature;
|
|
117
|
-
try {
|
|
118
|
-
const resolved = await task;
|
|
119
|
-
entry.value = resolved;
|
|
120
|
-
entry.promise = void 0;
|
|
121
|
-
entry.signature = signature;
|
|
122
|
-
return resolved;
|
|
123
|
-
} catch (error) {
|
|
124
|
-
entry.promise = void 0;
|
|
125
|
-
throw error;
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
exports.createDebug = createDebug; exports.createTailwindPatchPromise = createTailwindPatchPromise; exports.collectRuntimeClassSet = collectRuntimeClassSet;
|