tailwind-styled-v4 5.0.37 → 5.0.38
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/analyzer.js +213 -161
- package/dist/analyzer.js.map +1 -1
- package/dist/analyzer.mjs +118 -82
- package/dist/analyzer.mjs.map +1 -1
- package/dist/animate.js +131 -87
- package/dist/animate.js.map +1 -1
- package/dist/animate.mjs +28 -14
- package/dist/animate.mjs.map +1 -1
- package/dist/atomic.js +105 -68
- package/dist/atomic.js.map +1 -1
- package/dist/atomic.mjs +40 -13
- package/dist/atomic.mjs.map +1 -1
- package/dist/cli.js +577 -426
- package/dist/cli.js.map +1 -1
- package/dist/cli.mjs +466 -304
- package/dist/cli.mjs.map +1 -1
- package/dist/compiler.js +826 -508
- package/dist/compiler.js.map +1 -1
- package/dist/compiler.mjs +287 -29
- package/dist/compiler.mjs.map +1 -1
- package/dist/dashboard.js +71 -41
- package/dist/dashboard.js.map +1 -1
- package/dist/dashboard.mjs +12 -6
- package/dist/dashboard.mjs.map +1 -1
- package/dist/devtools.js +333 -289
- package/dist/devtools.js.map +1 -1
- package/dist/devtools.mjs +26 -11
- package/dist/devtools.mjs.map +1 -1
- package/dist/engine.js +679 -502
- package/dist/engine.js.map +1 -1
- package/dist/engine.mjs +467 -307
- package/dist/engine.mjs.map +1 -1
- package/dist/index.d.mts +145 -319
- package/dist/index.d.ts +145 -319
- package/dist/index.js +1329 -7441
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1266 -7385
- package/dist/index.mjs.map +1 -1
- package/dist/next.js +318 -243
- package/dist/next.js.map +1 -1
- package/dist/next.mjs +256 -181
- package/dist/next.mjs.map +1 -1
- package/dist/plugin-api.js +93 -49
- package/dist/plugin-api.js.map +1 -1
- package/dist/plugin-api.mjs +26 -6
- package/dist/plugin-api.mjs.map +1 -1
- package/dist/plugin-registry.js +67 -40
- package/dist/plugin-registry.js.map +1 -1
- package/dist/plugin-registry.mjs +14 -10
- package/dist/plugin-registry.mjs.map +1 -1
- package/dist/plugin.js +101 -53
- package/dist/plugin.js.map +1 -1
- package/dist/plugin.mjs +30 -6
- package/dist/plugin.mjs.map +1 -1
- package/dist/preset.js +47 -15
- package/dist/preset.js.map +1 -1
- package/dist/preset.mjs +13 -5
- package/dist/preset.mjs.map +1 -1
- package/dist/rspack.js +82 -50
- package/dist/rspack.js.map +1 -1
- package/dist/rspack.mjs +20 -12
- package/dist/rspack.mjs.map +1 -1
- package/dist/runtime-css.js +62 -24
- package/dist/runtime-css.js.map +1 -1
- package/dist/runtime-css.mjs +15 -7
- package/dist/runtime-css.mjs.map +1 -1
- package/dist/runtime.js +97 -44
- package/dist/runtime.js.map +1 -1
- package/dist/runtime.mjs +31 -8
- package/dist/runtime.mjs.map +1 -1
- package/dist/scanner.js +163 -120
- package/dist/scanner.js.map +1 -1
- package/dist/scanner.mjs +67 -39
- package/dist/scanner.mjs.map +1 -1
- package/dist/shared.js +441 -295
- package/dist/shared.js.map +1 -1
- package/dist/shared.mjs +253 -122
- package/dist/shared.mjs.map +1 -1
- package/dist/storybook-addon.js +39 -10
- package/dist/storybook-addon.js.map +1 -1
- package/dist/storybook-addon.mjs +8 -3
- package/dist/storybook-addon.mjs.map +1 -1
- package/dist/svelte.js +88 -64
- package/dist/svelte.js.map +1 -1
- package/dist/svelte.mjs +28 -13
- package/dist/svelte.mjs.map +1 -1
- package/dist/syntax.js +68 -37
- package/dist/syntax.js.map +1 -1
- package/dist/syntax.mjs +8 -7
- package/dist/syntax.mjs.map +1 -1
- package/dist/testing.js +55 -18
- package/dist/testing.js.map +1 -1
- package/dist/testing.mjs +16 -3
- package/dist/testing.mjs.map +1 -1
- package/dist/theme.js +131 -74
- package/dist/theme.js.map +1 -1
- package/dist/theme.mjs +42 -13
- package/dist/theme.mjs.map +1 -1
- package/dist/turbopackLoader.js +150 -116
- package/dist/turbopackLoader.js.map +1 -1
- package/dist/turbopackLoader.mjs +124 -81
- package/dist/turbopackLoader.mjs.map +1 -1
- package/dist/tw.js +560 -421
- package/dist/tw.js.map +1 -1
- package/dist/tw.mjs +460 -302
- package/dist/tw.mjs.map +1 -1
- package/dist/vite.js +561 -446
- package/dist/vite.js.map +1 -1
- package/dist/vite.mjs +433 -321
- package/dist/vite.mjs.map +1 -1
- package/dist/vue.js +95 -70
- package/dist/vue.js.map +1 -1
- package/dist/vue.mjs +30 -14
- package/dist/vue.mjs.map +1 -1
- package/dist/webpackLoader.js +110 -78
- package/dist/webpackLoader.js.map +1 -1
- package/dist/webpackLoader.mjs +45 -17
- package/dist/webpackLoader.mjs.map +1 -1
- package/package.json +3 -1
package/dist/next.js
CHANGED
|
@@ -1,46 +1,11 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var module$1 = require('module');
|
|
4
|
-
var fs10 = require('fs');
|
|
5
|
-
var path11 = require('path');
|
|
6
|
-
require('crypto');
|
|
7
|
-
var url = require('url');
|
|
8
|
-
var zod = require('zod');
|
|
9
|
-
require('worker_threads');
|
|
10
|
-
|
|
11
|
-
var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
|
|
12
|
-
function _interopNamespace(e) {
|
|
13
|
-
if (e && e.__esModule) return e;
|
|
14
|
-
var n = Object.create(null);
|
|
15
|
-
if (e) {
|
|
16
|
-
Object.keys(e).forEach(function (k) {
|
|
17
|
-
if (k !== 'default') {
|
|
18
|
-
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
19
|
-
Object.defineProperty(n, k, d.get ? d : {
|
|
20
|
-
enumerable: true,
|
|
21
|
-
get: function () { return e[k]; }
|
|
22
|
-
});
|
|
23
|
-
}
|
|
24
|
-
});
|
|
25
|
-
}
|
|
26
|
-
n.default = e;
|
|
27
|
-
return Object.freeze(n);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
var fs10__namespace = /*#__PURE__*/_interopNamespace(fs10);
|
|
31
|
-
var path11__namespace = /*#__PURE__*/_interopNamespace(path11);
|
|
32
|
-
|
|
33
1
|
/* tailwind-styled-v4 v5.0.4 | MIT | https://github.com/dictionar32/tailwind-styled-v4 */
|
|
2
|
+
"use strict";
|
|
3
|
+
var __create = Object.create;
|
|
34
4
|
var __defProp = Object.defineProperty;
|
|
35
5
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
36
6
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
37
8
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
38
|
-
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
39
|
-
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
40
|
-
}) : x)(function(x) {
|
|
41
|
-
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
42
|
-
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
43
|
-
});
|
|
44
9
|
var __esm = (fn, res) => function __init() {
|
|
45
10
|
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
46
11
|
};
|
|
@@ -56,6 +21,14 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
56
21
|
}
|
|
57
22
|
return to;
|
|
58
23
|
};
|
|
24
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
25
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
26
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
27
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
28
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
29
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
30
|
+
mod
|
|
31
|
+
));
|
|
59
32
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
60
33
|
|
|
61
34
|
// packages/domain/shared/src/workerResolver.ts
|
|
@@ -63,8 +36,8 @@ function getDirnameFromUrl(importMetaUrl) {
|
|
|
63
36
|
if (!importMetaUrl) return "";
|
|
64
37
|
if (isBrowser) return "";
|
|
65
38
|
try {
|
|
66
|
-
const nodeUrl =
|
|
67
|
-
const nodePath =
|
|
39
|
+
const nodeUrl = require(NODE_URL);
|
|
40
|
+
const nodePath = require(NODE_PATH);
|
|
68
41
|
return nodePath.dirname(nodeUrl.fileURLToPath(importMetaUrl));
|
|
69
42
|
} catch {
|
|
70
43
|
if (importMetaUrl.startsWith("file://")) {
|
|
@@ -78,7 +51,7 @@ function getDirnameFromUrl(importMetaUrl) {
|
|
|
78
51
|
function resolvePath(...segments) {
|
|
79
52
|
if (isBrowser) return segments.join("/").replace(/\/+/g, "/");
|
|
80
53
|
try {
|
|
81
|
-
const nodePath =
|
|
54
|
+
const nodePath = require(NODE_PATH);
|
|
82
55
|
return nodePath.resolve(...segments);
|
|
83
56
|
} catch {
|
|
84
57
|
return segments.join("/").replace(/\/+/g, "/");
|
|
@@ -87,7 +60,7 @@ function resolvePath(...segments) {
|
|
|
87
60
|
function existsSync(path12) {
|
|
88
61
|
if (isBrowser) return false;
|
|
89
62
|
try {
|
|
90
|
-
const nodeFs =
|
|
63
|
+
const nodeFs = require(NODE_FS);
|
|
91
64
|
return nodeFs.existsSync(path12);
|
|
92
65
|
} catch {
|
|
93
66
|
return false;
|
|
@@ -141,12 +114,15 @@ function resolveLoaderPath(loaderBasename, importMetaUrl) {
|
|
|
141
114
|
var isBrowser, NODE_URL, NODE_FS, NODE_PATH;
|
|
142
115
|
var init_workerResolver = __esm({
|
|
143
116
|
"packages/domain/shared/src/workerResolver.ts"() {
|
|
117
|
+
"use strict";
|
|
144
118
|
isBrowser = typeof window !== "undefined" || typeof document !== "undefined";
|
|
145
119
|
NODE_URL = typeof window === "undefined" || typeof document === "undefined" ? "node:url" : null;
|
|
146
120
|
NODE_FS = typeof window === "undefined" || typeof document === "undefined" ? "node:fs" : null;
|
|
147
121
|
NODE_PATH = typeof window === "undefined" || typeof document === "undefined" ? "node:path" : null;
|
|
148
122
|
}
|
|
149
123
|
});
|
|
124
|
+
|
|
125
|
+
// packages/domain/shared/src/native-resolution.ts
|
|
150
126
|
function platformKey() {
|
|
151
127
|
if (isBrowser2) return "browser";
|
|
152
128
|
return `${process.platform}-${process.arch}`;
|
|
@@ -162,7 +138,7 @@ function resolveNativeBinary(runtimeDir) {
|
|
|
162
138
|
}
|
|
163
139
|
const envPath = process.env.TW_NATIVE_PATH?.trim();
|
|
164
140
|
if (envPath) {
|
|
165
|
-
if (
|
|
141
|
+
if (fs.existsSync(envPath)) {
|
|
166
142
|
return { path: envPath, source: "env", platform, tried };
|
|
167
143
|
}
|
|
168
144
|
tried.push(`env:${envPath} (not found)`);
|
|
@@ -171,7 +147,7 @@ function resolveNativeBinary(runtimeDir) {
|
|
|
171
147
|
for (const pkg of prebuiltPkgs) {
|
|
172
148
|
try {
|
|
173
149
|
const candidate = _require.resolve(`${pkg}/tailwind_styled_parser.node`);
|
|
174
|
-
if (
|
|
150
|
+
if (fs.existsSync(candidate)) {
|
|
175
151
|
return { path: candidate, source: "prebuilt", platform, tried };
|
|
176
152
|
}
|
|
177
153
|
tried.push(`prebuilt:${pkg} (resolved but missing)`);
|
|
@@ -182,13 +158,13 @@ function resolveNativeBinary(runtimeDir) {
|
|
|
182
158
|
const napiPlatform = platform === "linux-x64" ? "linux-x64-gnu" : platform === "linux-arm64" ? "linux-arm64-gnu" : platform;
|
|
183
159
|
const BINARY_NAMES_SELF = ["tailwind-styled-native", "tailwind_styled_parser"];
|
|
184
160
|
if (runtimeDir) {
|
|
185
|
-
for (const depth of ["..",
|
|
186
|
-
const pkgRoot =
|
|
161
|
+
for (const depth of ["..", path.join("..", ".."), path.join("..", "..", "..")]) {
|
|
162
|
+
const pkgRoot = path.resolve(runtimeDir, depth);
|
|
187
163
|
for (const bin of BINARY_NAMES_SELF) {
|
|
188
164
|
for (const suffix of ["", `.${platform}`, `.${napiPlatform}`]) {
|
|
189
|
-
const candidate =
|
|
165
|
+
const candidate = path.resolve(pkgRoot, "native", `${bin}${suffix}.node`);
|
|
190
166
|
tried.push(`self-bundled:${candidate}`);
|
|
191
|
-
if (
|
|
167
|
+
if (fs.existsSync(candidate)) {
|
|
192
168
|
return { path: candidate, source: "prebuilt", platform, tried };
|
|
193
169
|
}
|
|
194
170
|
}
|
|
@@ -200,39 +176,44 @@ function resolveNativeBinary(runtimeDir) {
|
|
|
200
176
|
const BINARY_NAMES = ["tailwind-styled-native", "tailwind_styled_parser"];
|
|
201
177
|
const localCandidates = [];
|
|
202
178
|
for (const bin of BINARY_NAMES) {
|
|
203
|
-
localCandidates.push(
|
|
204
|
-
localCandidates.push(
|
|
205
|
-
localCandidates.push(
|
|
206
|
-
localCandidates.push(
|
|
179
|
+
localCandidates.push(path.resolve(base, `${bin}.node`));
|
|
180
|
+
localCandidates.push(path.resolve(base, "..", `${bin}.node`));
|
|
181
|
+
localCandidates.push(path.resolve(base, `${bin}.${platform}.node`));
|
|
182
|
+
localCandidates.push(path.resolve(base, `${bin}.${napiPlatform}.node`));
|
|
207
183
|
}
|
|
208
184
|
for (const startDir of [cwd, base]) {
|
|
209
185
|
let dir = startDir;
|
|
210
186
|
for (let i = 0; i < 6; i++) {
|
|
211
|
-
const nativeDir =
|
|
187
|
+
const nativeDir = path.resolve(dir, "native");
|
|
212
188
|
for (const bin of BINARY_NAMES) {
|
|
213
|
-
localCandidates.push(
|
|
214
|
-
localCandidates.push(
|
|
215
|
-
localCandidates.push(
|
|
216
|
-
localCandidates.push(
|
|
189
|
+
localCandidates.push(path.resolve(nativeDir, `${bin}.node`));
|
|
190
|
+
localCandidates.push(path.resolve(nativeDir, `${bin}.${platform}.node`));
|
|
191
|
+
localCandidates.push(path.resolve(nativeDir, `${bin}.${napiPlatform}.node`));
|
|
192
|
+
localCandidates.push(path.resolve(nativeDir, "target", "release", `${bin}.node`));
|
|
217
193
|
}
|
|
218
|
-
const parent =
|
|
194
|
+
const parent = path.resolve(dir, "..");
|
|
219
195
|
if (parent === dir) break;
|
|
220
196
|
dir = parent;
|
|
221
197
|
}
|
|
222
198
|
}
|
|
223
199
|
for (const candidate of localCandidates) {
|
|
224
200
|
tried.push(`local:${candidate}`);
|
|
225
|
-
if (
|
|
201
|
+
if (fs.existsSync(candidate)) {
|
|
226
202
|
return { path: candidate, source: "local", platform, tried };
|
|
227
203
|
}
|
|
228
204
|
}
|
|
229
205
|
return { path: null, source: "not-found", platform, tried };
|
|
230
206
|
}
|
|
231
|
-
var isBrowser2, _require, PLATFORM_MAP;
|
|
207
|
+
var import_node_module, fs, path, import_meta, isBrowser2, _require, PLATFORM_MAP;
|
|
232
208
|
var init_native_resolution = __esm({
|
|
233
209
|
"packages/domain/shared/src/native-resolution.ts"() {
|
|
210
|
+
"use strict";
|
|
211
|
+
import_node_module = require("module");
|
|
212
|
+
fs = __toESM(require("fs"));
|
|
213
|
+
path = __toESM(require("path"));
|
|
214
|
+
import_meta = {};
|
|
234
215
|
isBrowser2 = typeof window !== "undefined" || typeof document !== "undefined";
|
|
235
|
-
_require = typeof
|
|
216
|
+
_require = typeof require !== "undefined" ? require : (0, import_node_module.createRequire)(import_meta.url);
|
|
236
217
|
PLATFORM_MAP = {
|
|
237
218
|
"linux-x64": ["@tailwind-styled/native-linux-x64-gnu", "@tailwind-styled/native-linux-x64"],
|
|
238
219
|
"linux-arm64": ["@tailwind-styled/native-linux-arm64-gnu", "@tailwind-styled/native-linux-arm64"],
|
|
@@ -245,11 +226,13 @@ var init_native_resolution = __esm({
|
|
|
245
226
|
});
|
|
246
227
|
|
|
247
228
|
// packages/domain/compiler/src/nativeBridge.ts
|
|
248
|
-
var _loadNative, log, NATIVE_UNAVAILABLE_MESSAGE, nativeBridge, bridgeLoadAttempted, bridgeLoadError, isValidNativeBridge, getNativeBridge, resetNativeBridgeCache, adaptNativeResult;
|
|
229
|
+
var import_meta2, _loadNative, log, NATIVE_UNAVAILABLE_MESSAGE, nativeBridge, bridgeLoadAttempted, bridgeLoadError, isValidNativeBridge, getNativeBridge, resetNativeBridgeCache, adaptNativeResult;
|
|
249
230
|
var init_nativeBridge = __esm({
|
|
250
231
|
"packages/domain/compiler/src/nativeBridge.ts"() {
|
|
232
|
+
"use strict";
|
|
251
233
|
init_src2();
|
|
252
|
-
|
|
234
|
+
import_meta2 = {};
|
|
235
|
+
_loadNative = (path12) => require(path12);
|
|
253
236
|
log = (...args) => {
|
|
254
237
|
if (process.env.DEBUG?.includes("compiler:native")) {
|
|
255
238
|
console.log("[compiler:native]", ...args);
|
|
@@ -275,7 +258,7 @@ var init_nativeBridge = __esm({
|
|
|
275
258
|
}
|
|
276
259
|
bridgeLoadAttempted = true;
|
|
277
260
|
try {
|
|
278
|
-
const runtimeDir = resolveRuntimeDir(void 0,
|
|
261
|
+
const runtimeDir = resolveRuntimeDir(void 0, import_meta2.url);
|
|
279
262
|
const result = resolveNativeBinary(runtimeDir);
|
|
280
263
|
if (result.path && result.path.endsWith(".node")) {
|
|
281
264
|
try {
|
|
@@ -405,6 +388,7 @@ function resetCacheStats() {
|
|
|
405
388
|
}
|
|
406
389
|
var init_cssGeneratorNative = __esm({
|
|
407
390
|
"packages/domain/compiler/src/compiler/cssGeneratorNative.ts"() {
|
|
391
|
+
"use strict";
|
|
408
392
|
init_nativeBridge();
|
|
409
393
|
}
|
|
410
394
|
});
|
|
@@ -477,6 +461,7 @@ function atomicRegistrySize() {
|
|
|
477
461
|
}
|
|
478
462
|
var init_compilationNative = __esm({
|
|
479
463
|
"packages/domain/compiler/src/compiler/compilationNative.ts"() {
|
|
464
|
+
"use strict";
|
|
480
465
|
init_nativeBridge();
|
|
481
466
|
}
|
|
482
467
|
});
|
|
@@ -620,6 +605,7 @@ function twMergeRaw(classLists) {
|
|
|
620
605
|
}
|
|
621
606
|
var init_cssCompilationNative = __esm({
|
|
622
607
|
"packages/domain/compiler/src/compiler/cssCompilationNative.ts"() {
|
|
608
|
+
"use strict";
|
|
623
609
|
init_nativeBridge();
|
|
624
610
|
}
|
|
625
611
|
});
|
|
@@ -719,6 +705,7 @@ function idRegistryImport(importedData) {
|
|
|
719
705
|
}
|
|
720
706
|
var init_idRegistryNative = __esm({
|
|
721
707
|
"packages/domain/compiler/src/compiler/idRegistryNative.ts"() {
|
|
708
|
+
"use strict";
|
|
722
709
|
init_nativeBridge();
|
|
723
710
|
}
|
|
724
711
|
});
|
|
@@ -860,9 +847,12 @@ function scanFilesBatchNative(filesJson) {
|
|
|
860
847
|
}
|
|
861
848
|
var init_streamingNative = __esm({
|
|
862
849
|
"packages/domain/compiler/src/compiler/streamingNative.ts"() {
|
|
850
|
+
"use strict";
|
|
863
851
|
init_nativeBridge();
|
|
864
852
|
}
|
|
865
853
|
});
|
|
854
|
+
|
|
855
|
+
// packages/domain/compiler/src/tailwindEngine.ts
|
|
866
856
|
function loadTailwindEngine() {
|
|
867
857
|
if (_twEngine) return _twEngine;
|
|
868
858
|
if (_twEngineError) throw _twEngineError;
|
|
@@ -882,10 +872,10 @@ async function generateRawCss(classes, cssEntryContent, root) {
|
|
|
882
872
|
if (classes.length === 0) return "";
|
|
883
873
|
const tw = loadTailwindEngine();
|
|
884
874
|
const input = cssEntryContent ?? "@import 'tailwindcss';";
|
|
885
|
-
const { readFileSync, existsSync: existsSync3 } = await import(
|
|
886
|
-
const { dirname, resolve: resolve2 } = await import(
|
|
875
|
+
const { readFileSync, existsSync: existsSync3 } = await import("fs");
|
|
876
|
+
const { dirname, resolve: resolve2 } = await import("path");
|
|
887
877
|
const projectRoot = root ?? process.cwd();
|
|
888
|
-
const req =
|
|
878
|
+
const req = (0, import_node_module2.createRequire)(resolve2(projectRoot, "package.json"));
|
|
889
879
|
const loadStylesheet = async (id, base) => {
|
|
890
880
|
try {
|
|
891
881
|
const cssId = id === "tailwindcss" ? "tailwindcss/index.css" : id === "tailwindcss/preflight" ? "tailwindcss/preflight.css" : id === "tailwindcss/utilities" ? "tailwindcss/utilities.css" : id === "tailwindcss/theme" ? "tailwindcss/theme.css" : id;
|
|
@@ -905,10 +895,14 @@ async function generateRawCss(classes, cssEntryContent, root) {
|
|
|
905
895
|
const compiler = await Promise.resolve(tw.compile(input, { loadStylesheet }));
|
|
906
896
|
return compiler.build(classes);
|
|
907
897
|
}
|
|
908
|
-
var require2, _twEngine, _twEngineError;
|
|
898
|
+
var import_node_module2, import_meta3, require2, MAX_CACHE_MEMORY, _twEngine, _twEngineError;
|
|
909
899
|
var init_tailwindEngine = __esm({
|
|
910
900
|
"packages/domain/compiler/src/tailwindEngine.ts"() {
|
|
911
|
-
|
|
901
|
+
"use strict";
|
|
902
|
+
import_node_module2 = require("module");
|
|
903
|
+
import_meta3 = {};
|
|
904
|
+
require2 = (0, import_node_module2.createRequire)(import_meta3.url);
|
|
905
|
+
MAX_CACHE_MEMORY = 256 * 1024;
|
|
912
906
|
_twEngine = null;
|
|
913
907
|
_twEngineError = null;
|
|
914
908
|
}
|
|
@@ -1089,24 +1083,29 @@ function processTailwindCssWithTargets(css, targets) {
|
|
|
1089
1083
|
}
|
|
1090
1084
|
return result.css;
|
|
1091
1085
|
}
|
|
1092
|
-
var _cssCache, _cacheHits, _cacheMisses, MAX_CACHE_SIZE;
|
|
1086
|
+
var import_node_module3, import_meta4, require3, _cssCache, _cacheHits, _cacheMisses, MAX_CACHE_SIZE, MAX_CACHE_MEMORY2;
|
|
1093
1087
|
var init_tailwindEngine2 = __esm({
|
|
1094
1088
|
"packages/domain/compiler/src/compiler/tailwindEngine.ts"() {
|
|
1089
|
+
"use strict";
|
|
1090
|
+
import_node_module3 = require("module");
|
|
1095
1091
|
init_nativeBridge();
|
|
1096
1092
|
init_cssGeneratorNative();
|
|
1097
1093
|
init_cssCompilationNative();
|
|
1098
1094
|
init_tailwindEngine();
|
|
1099
|
-
|
|
1095
|
+
import_meta4 = {};
|
|
1096
|
+
require3 = (0, import_node_module3.createRequire)(import_meta4.url);
|
|
1100
1097
|
_cssCache = /* @__PURE__ */ new Map();
|
|
1101
1098
|
_cacheHits = 0;
|
|
1102
1099
|
_cacheMisses = 0;
|
|
1103
1100
|
MAX_CACHE_SIZE = 100;
|
|
1101
|
+
MAX_CACHE_MEMORY2 = 256 * 1024;
|
|
1104
1102
|
}
|
|
1105
1103
|
});
|
|
1106
1104
|
|
|
1107
1105
|
// packages/domain/compiler/src/compiler/index.ts
|
|
1108
1106
|
var init_compiler = __esm({
|
|
1109
1107
|
"packages/domain/compiler/src/compiler/index.ts"() {
|
|
1108
|
+
"use strict";
|
|
1110
1109
|
init_cssGeneratorNative();
|
|
1111
1110
|
init_compilationNative();
|
|
1112
1111
|
init_cssCompilationNative();
|
|
@@ -1120,6 +1119,7 @@ var init_compiler = __esm({
|
|
|
1120
1119
|
var parseClasses, parseClass, extractAllClasses, extractClassesFromSource, astExtractClasses, normalizeClasses, mergeClassesStatic, normalizeAndDedupClasses, extractComponentUsage, batchExtractClasses, checkAgainstSafelist, diffClassLists;
|
|
1121
1120
|
var init_parser = __esm({
|
|
1122
1121
|
"packages/domain/compiler/src/parser/index.ts"() {
|
|
1122
|
+
"use strict";
|
|
1123
1123
|
init_nativeBridge();
|
|
1124
1124
|
parseClasses = (raw) => {
|
|
1125
1125
|
const native = getNativeBridge();
|
|
@@ -1298,6 +1298,7 @@ function resetMemoryStats() {
|
|
|
1298
1298
|
}
|
|
1299
1299
|
var init_analyzerNative = __esm({
|
|
1300
1300
|
"packages/domain/compiler/src/analyzer/analyzerNative.ts"() {
|
|
1301
|
+
"use strict";
|
|
1301
1302
|
init_nativeBridge();
|
|
1302
1303
|
}
|
|
1303
1304
|
});
|
|
@@ -1391,6 +1392,7 @@ function resolveSimpleVariants(configJson) {
|
|
|
1391
1392
|
}
|
|
1392
1393
|
var init_themeResolutionNative = __esm({
|
|
1393
1394
|
"packages/domain/compiler/src/analyzer/themeResolutionNative.ts"() {
|
|
1395
|
+
"use strict";
|
|
1394
1396
|
init_nativeBridge();
|
|
1395
1397
|
}
|
|
1396
1398
|
});
|
|
@@ -1438,6 +1440,7 @@ function generateSubComponentTypes(root, outputPath) {
|
|
|
1438
1440
|
}
|
|
1439
1441
|
var init_scannerNative = __esm({
|
|
1440
1442
|
"packages/domain/compiler/src/analyzer/scannerNative.ts"() {
|
|
1443
|
+
"use strict";
|
|
1441
1444
|
init_nativeBridge();
|
|
1442
1445
|
}
|
|
1443
1446
|
});
|
|
@@ -1445,6 +1448,7 @@ var init_scannerNative = __esm({
|
|
|
1445
1448
|
// packages/domain/compiler/src/analyzer/index.ts
|
|
1446
1449
|
var init_analyzer = __esm({
|
|
1447
1450
|
"packages/domain/compiler/src/analyzer/index.ts"() {
|
|
1451
|
+
"use strict";
|
|
1448
1452
|
init_analyzerNative();
|
|
1449
1453
|
init_themeResolutionNative();
|
|
1450
1454
|
init_scannerNative();
|
|
@@ -1633,6 +1637,7 @@ function resetResolverPoolStats() {
|
|
|
1633
1637
|
}
|
|
1634
1638
|
var init_cacheNative = __esm({
|
|
1635
1639
|
"packages/domain/compiler/src/cache/cacheNative.ts"() {
|
|
1640
|
+
"use strict";
|
|
1636
1641
|
init_nativeBridge();
|
|
1637
1642
|
}
|
|
1638
1643
|
});
|
|
@@ -1640,6 +1645,7 @@ var init_cacheNative = __esm({
|
|
|
1640
1645
|
// packages/domain/compiler/src/cache/index.ts
|
|
1641
1646
|
var init_cache = __esm({
|
|
1642
1647
|
"packages/domain/compiler/src/cache/index.ts"() {
|
|
1648
|
+
"use strict";
|
|
1643
1649
|
init_cacheNative();
|
|
1644
1650
|
}
|
|
1645
1651
|
});
|
|
@@ -1888,6 +1894,7 @@ function redisDiagnose() {
|
|
|
1888
1894
|
}
|
|
1889
1895
|
var init_redisNative = __esm({
|
|
1890
1896
|
"packages/domain/compiler/src/redis/redisNative.ts"() {
|
|
1897
|
+
"use strict";
|
|
1891
1898
|
init_nativeBridge();
|
|
1892
1899
|
}
|
|
1893
1900
|
});
|
|
@@ -1895,6 +1902,7 @@ var init_redisNative = __esm({
|
|
|
1895
1902
|
// packages/domain/compiler/src/redis/index.ts
|
|
1896
1903
|
var init_redis = __esm({
|
|
1897
1904
|
"packages/domain/compiler/src/redis/index.ts"() {
|
|
1905
|
+
"use strict";
|
|
1898
1906
|
init_redisNative();
|
|
1899
1907
|
}
|
|
1900
1908
|
});
|
|
@@ -2033,6 +2041,7 @@ function getCompilerDiagnostics() {
|
|
|
2033
2041
|
}
|
|
2034
2042
|
var init_watchSystemNative = __esm({
|
|
2035
2043
|
"packages/domain/compiler/src/watch/watchSystemNative.ts"() {
|
|
2044
|
+
"use strict";
|
|
2036
2045
|
init_nativeBridge();
|
|
2037
2046
|
}
|
|
2038
2047
|
});
|
|
@@ -2040,6 +2049,7 @@ var init_watchSystemNative = __esm({
|
|
|
2040
2049
|
// packages/domain/compiler/src/watch/index.ts
|
|
2041
2050
|
var init_watch = __esm({
|
|
2042
2051
|
"packages/domain/compiler/src/watch/index.ts"() {
|
|
2052
|
+
"use strict";
|
|
2043
2053
|
init_watchSystemNative();
|
|
2044
2054
|
}
|
|
2045
2055
|
});
|
|
@@ -2301,9 +2311,13 @@ function extractContainerCssFromSource(source) {
|
|
|
2301
2311
|
}
|
|
2302
2312
|
return rules.join("\n");
|
|
2303
2313
|
}
|
|
2304
|
-
var _require2, transformSource, hasTwUsage, isAlreadyTransformed, shouldProcess, compileCssFromClasses, buildStyleTag, generateCssForClasses, eliminateDeadCss, findDeadVariants, runElimination, scanProjectUsage, generateSafelist, loadSafelist, loadTailwindConfig, getContentPaths, _CONTAINER_BREAKPOINTS, runLoaderTransform, shouldSkipFile, fileToRoute, getAllRoutes, getRouteClasses, registerFileClasses, registerGlobalClasses, _incrementalEngineInstance, getIncrementalEngine, resetIncrementalEngine, IncrementalEngine, getBucketEngine, resetBucketEngine, BucketEngine, classifyNode, detectConflicts, bucketSort, analyzeFile, analyzeVariantUsage, injectClientDirective, injectServerOnlyComment, analyzeClasses, extractTwStateConfigs, generateStaticStateCss, extractAndGenerateStateCss;
|
|
2314
|
+
var import_node_fs, import_node_path, import_node_module4, import_meta5, _require2, transformSource, hasTwUsage, isAlreadyTransformed, shouldProcess, compileCssFromClasses, buildStyleTag, generateCssForClasses, eliminateDeadCss, findDeadVariants, runElimination, scanProjectUsage, generateSafelist, loadSafelist, loadTailwindConfig, getContentPaths, _CONTAINER_BREAKPOINTS, runLoaderTransform, shouldSkipFile, fileToRoute, getAllRoutes, getRouteClasses, registerFileClasses, registerGlobalClasses, _incrementalEngineInstance, getIncrementalEngine, resetIncrementalEngine, IncrementalEngine, getBucketEngine, resetBucketEngine, BucketEngine, classifyNode, detectConflicts, bucketSort, analyzeFile, analyzeVariantUsage, injectClientDirective, injectServerOnlyComment, analyzeClasses, extractTwStateConfigs, generateStaticStateCss, extractAndGenerateStateCss;
|
|
2305
2315
|
var init_src = __esm({
|
|
2306
2316
|
"packages/domain/compiler/src/index.ts"() {
|
|
2317
|
+
"use strict";
|
|
2318
|
+
import_node_fs = __toESM(require("fs"), 1);
|
|
2319
|
+
import_node_path = __toESM(require("path"), 1);
|
|
2320
|
+
import_node_module4 = require("module");
|
|
2307
2321
|
init_nativeBridge();
|
|
2308
2322
|
init_compiler();
|
|
2309
2323
|
init_parser();
|
|
@@ -2311,7 +2325,8 @@ var init_src = __esm({
|
|
|
2311
2325
|
init_cache();
|
|
2312
2326
|
init_redis();
|
|
2313
2327
|
init_watch();
|
|
2314
|
-
|
|
2328
|
+
import_meta5 = {};
|
|
2329
|
+
_require2 = (0, import_node_module4.createRequire)(import_meta5.url);
|
|
2315
2330
|
transformSource = (source, opts) => {
|
|
2316
2331
|
const native = getNativeBridge();
|
|
2317
2332
|
if (!native?.transformSource) {
|
|
@@ -2403,7 +2418,7 @@ var init_src = __esm({
|
|
|
2403
2418
|
};
|
|
2404
2419
|
scanProjectUsage = (dirs, cwd) => {
|
|
2405
2420
|
const { batchExtractClasses: batchExtractClasses2 } = _require2("./parser");
|
|
2406
|
-
const files = dirs.map((dir) =>
|
|
2421
|
+
const files = dirs.map((dir) => import_node_path.default.resolve(cwd, dir));
|
|
2407
2422
|
const results = batchExtractClasses2(files) || [];
|
|
2408
2423
|
const combined = {};
|
|
2409
2424
|
for (const result of results) {
|
|
@@ -2420,13 +2435,13 @@ var init_src = __esm({
|
|
|
2420
2435
|
const classes = scanProjectUsage(scanDirs, cwd || process.cwd());
|
|
2421
2436
|
const allClasses = Object.keys(classes).sort();
|
|
2422
2437
|
if (outputPath) {
|
|
2423
|
-
|
|
2438
|
+
import_node_fs.default.writeFileSync(outputPath, JSON.stringify(allClasses, null, 2));
|
|
2424
2439
|
}
|
|
2425
2440
|
return allClasses;
|
|
2426
2441
|
};
|
|
2427
2442
|
loadSafelist = (safelistPath) => {
|
|
2428
2443
|
try {
|
|
2429
|
-
const content =
|
|
2444
|
+
const content = import_node_fs.default.readFileSync(safelistPath, "utf-8");
|
|
2430
2445
|
return JSON.parse(content);
|
|
2431
2446
|
} catch {
|
|
2432
2447
|
return [];
|
|
@@ -2440,9 +2455,9 @@ var init_src = __esm({
|
|
|
2440
2455
|
"tailwind.config.cjs"
|
|
2441
2456
|
];
|
|
2442
2457
|
for (const file of configFiles) {
|
|
2443
|
-
const fullPath =
|
|
2444
|
-
if (
|
|
2445
|
-
const mod =
|
|
2458
|
+
const fullPath = import_node_path.default.join(cwd, file);
|
|
2459
|
+
if (import_node_fs.default.existsSync(fullPath)) {
|
|
2460
|
+
const mod = require(fullPath);
|
|
2446
2461
|
return mod.default || mod;
|
|
2447
2462
|
}
|
|
2448
2463
|
}
|
|
@@ -2451,9 +2466,9 @@ var init_src = __esm({
|
|
|
2451
2466
|
getContentPaths = (cwd = process.cwd()) => {
|
|
2452
2467
|
return {
|
|
2453
2468
|
content: [
|
|
2454
|
-
|
|
2455
|
-
|
|
2456
|
-
|
|
2469
|
+
import_node_path.default.join(cwd, "src/**/*.{js,ts,jsx,tsx}"),
|
|
2470
|
+
import_node_path.default.join(cwd, "app/**/*.{js,ts,jsx,tsx}"),
|
|
2471
|
+
import_node_path.default.join(cwd, "pages/**/*.{js,ts,jsx,tsx}")
|
|
2457
2472
|
]
|
|
2458
2473
|
};
|
|
2459
2474
|
};
|
|
@@ -2872,6 +2887,7 @@ __export(internal_exports, {
|
|
|
2872
2887
|
});
|
|
2873
2888
|
var init_internal = __esm({
|
|
2874
2889
|
"packages/domain/compiler/src/internal.ts"() {
|
|
2890
|
+
"use strict";
|
|
2875
2891
|
init_src();
|
|
2876
2892
|
init_tailwindEngine2();
|
|
2877
2893
|
init_compiler();
|
|
@@ -2882,6 +2898,8 @@ var init_internal = __esm({
|
|
|
2882
2898
|
init_watch();
|
|
2883
2899
|
}
|
|
2884
2900
|
});
|
|
2901
|
+
|
|
2902
|
+
// packages/domain/shared/src/staticStateExtractor.ts
|
|
2885
2903
|
function getNative() {
|
|
2886
2904
|
if (_native) return _native;
|
|
2887
2905
|
try {
|
|
@@ -2911,17 +2929,17 @@ function getNative() {
|
|
|
2911
2929
|
function* walkSourceFiles(dir) {
|
|
2912
2930
|
let entries;
|
|
2913
2931
|
try {
|
|
2914
|
-
entries =
|
|
2932
|
+
entries = import_node_fs2.default.readdirSync(dir, { withFileTypes: true });
|
|
2915
2933
|
} catch {
|
|
2916
2934
|
return;
|
|
2917
2935
|
}
|
|
2918
2936
|
for (const entry of entries) {
|
|
2919
|
-
const fullPath =
|
|
2937
|
+
const fullPath = import_node_path2.default.join(dir, entry.name);
|
|
2920
2938
|
if (entry.isDirectory()) {
|
|
2921
2939
|
if (IGNORE_PATTERNS.some((p) => entry.name === p || entry.name.startsWith(p))) continue;
|
|
2922
2940
|
yield* walkSourceFiles(fullPath);
|
|
2923
2941
|
} else if (entry.isFile()) {
|
|
2924
|
-
const ext =
|
|
2942
|
+
const ext = import_node_path2.default.extname(entry.name);
|
|
2925
2943
|
if (SOURCE_EXTENSIONS.has(ext)) yield fullPath;
|
|
2926
2944
|
}
|
|
2927
2945
|
}
|
|
@@ -2985,7 +3003,7 @@ function extractStaticStateCss(srcDir, options = {}) {
|
|
|
2985
3003
|
allConfigs.push(...configs);
|
|
2986
3004
|
if (verbose) {
|
|
2987
3005
|
process.stderr.write(
|
|
2988
|
-
`[tw:static-state] ${
|
|
3006
|
+
`[tw:static-state] ${import_node_path2.default.relative(srcDir, filePath)}: ${configs.length} komponen
|
|
2989
3007
|
`
|
|
2990
3008
|
);
|
|
2991
3009
|
}
|
|
@@ -2996,7 +3014,7 @@ function extractStaticStateCss(srcDir, options = {}) {
|
|
|
2996
3014
|
if (filesScanned >= maxFiles) break;
|
|
2997
3015
|
let source;
|
|
2998
3016
|
try {
|
|
2999
|
-
source =
|
|
3017
|
+
source = import_node_fs2.default.readFileSync(filePath, "utf-8");
|
|
3000
3018
|
} catch {
|
|
3001
3019
|
continue;
|
|
3002
3020
|
}
|
|
@@ -3009,7 +3027,7 @@ function extractStaticStateCss(srcDir, options = {}) {
|
|
|
3009
3027
|
allConfigs.push(...configs);
|
|
3010
3028
|
if (verbose) {
|
|
3011
3029
|
process.stderr.write(
|
|
3012
|
-
`[tw:static-state] ${
|
|
3030
|
+
`[tw:static-state] ${import_node_path2.default.relative(srcDir, filePath)}: ${configs.length} komponen
|
|
3013
3031
|
`
|
|
3014
3032
|
);
|
|
3015
3033
|
}
|
|
@@ -3103,12 +3121,12 @@ function appendStaticStateCssToSafelist(srcDir, safelistPath, options = {}) {
|
|
|
3103
3121
|
resolvedCss: options.resolvedCss || ""
|
|
3104
3122
|
// ← ensure always passed
|
|
3105
3123
|
});
|
|
3106
|
-
const twClassesDir =
|
|
3107
|
-
|
|
3108
|
-
const stateFilePath =
|
|
3124
|
+
const twClassesDir = import_node_path2.default.join(import_node_path2.default.dirname(safelistPath), "tw-classes");
|
|
3125
|
+
import_node_fs2.default.mkdirSync(twClassesDir, { recursive: true });
|
|
3126
|
+
const stateFilePath = import_node_path2.default.join(twClassesDir, TW_STATE_STATIC_FILENAME);
|
|
3109
3127
|
if (result.rulesGenerated === 0) {
|
|
3110
3128
|
try {
|
|
3111
|
-
|
|
3129
|
+
import_node_fs2.default.writeFileSync(
|
|
3112
3130
|
stateFilePath,
|
|
3113
3131
|
"/* tw-state-static.css \u2014 tidak ada state rules yang di-generate */\n",
|
|
3114
3132
|
"utf-8"
|
|
@@ -3118,7 +3136,7 @@ function appendStaticStateCssToSafelist(srcDir, safelistPath, options = {}) {
|
|
|
3118
3136
|
return `[tw:static-state] tidak ada state rules yang di-generate (${result.filesScanned} files di-scan)`;
|
|
3119
3137
|
}
|
|
3120
3138
|
try {
|
|
3121
|
-
|
|
3139
|
+
import_node_fs2.default.writeFileSync(stateFilePath, result.generatedCss, "utf-8");
|
|
3122
3140
|
return [
|
|
3123
3141
|
`[tw:static-state] ${result.rulesGenerated} static state rules di-generate`,
|
|
3124
3142
|
` \u2192 ${result.filesScanned} files scanned, ${result.filesWithStates} dengan states`,
|
|
@@ -3130,15 +3148,20 @@ function appendStaticStateCssToSafelist(srcDir, safelistPath, options = {}) {
|
|
|
3130
3148
|
return `[tw:static-state] gagal tulis state CSS: ${msg}`;
|
|
3131
3149
|
}
|
|
3132
3150
|
}
|
|
3133
|
-
var SOURCE_EXTENSIONS, IGNORE_PATTERNS, _native, TW_STATE_STATIC_FILENAME;
|
|
3151
|
+
var import_node_fs2, import_node_path2, SOURCE_EXTENSIONS, IGNORE_PATTERNS, _native, TW_STATE_STATIC_FILENAME;
|
|
3134
3152
|
var init_staticStateExtractor = __esm({
|
|
3135
3153
|
"packages/domain/shared/src/staticStateExtractor.ts"() {
|
|
3154
|
+
"use strict";
|
|
3155
|
+
import_node_fs2 = __toESM(require("fs"));
|
|
3156
|
+
import_node_path2 = __toESM(require("path"));
|
|
3136
3157
|
SOURCE_EXTENSIONS = /* @__PURE__ */ new Set([".ts", ".tsx", ".js", ".jsx", ".mts", ".mjs"]);
|
|
3137
3158
|
IGNORE_PATTERNS = ["node_modules", ".next", "dist", "build", ".git", "coverage", "__tests__"];
|
|
3138
3159
|
_native = null;
|
|
3139
3160
|
TW_STATE_STATIC_FILENAME = "_tw-state-static.css";
|
|
3140
3161
|
}
|
|
3141
3162
|
});
|
|
3163
|
+
|
|
3164
|
+
// packages/domain/shared/src/logger.ts
|
|
3142
3165
|
function getEnvLevel() {
|
|
3143
3166
|
const env = process.env.TWS_LOG_LEVEL?.toLowerCase();
|
|
3144
3167
|
if (env && env in LEVELS) return env;
|
|
@@ -3148,8 +3171,8 @@ function setGlobalLogFile(filePath) {
|
|
|
3148
3171
|
_globalLogFile = filePath;
|
|
3149
3172
|
_logFileInitialized = false;
|
|
3150
3173
|
try {
|
|
3151
|
-
|
|
3152
|
-
|
|
3174
|
+
import_node_fs3.default.mkdirSync(import_node_path3.default.dirname(filePath), { recursive: true });
|
|
3175
|
+
import_node_fs3.default.writeFileSync(
|
|
3153
3176
|
filePath,
|
|
3154
3177
|
`# tailwind-styled build log \u2014 ${(/* @__PURE__ */ new Date()).toISOString()}
|
|
3155
3178
|
`,
|
|
@@ -3162,13 +3185,13 @@ function setGlobalLogFile(filePath) {
|
|
|
3162
3185
|
function writeToFile(line) {
|
|
3163
3186
|
if (!_globalLogFile || !_logFileInitialized) return;
|
|
3164
3187
|
try {
|
|
3165
|
-
|
|
3188
|
+
import_node_fs3.default.appendFileSync(_globalLogFile, line);
|
|
3166
3189
|
} catch {
|
|
3167
3190
|
}
|
|
3168
3191
|
}
|
|
3169
3192
|
function createLogger(prefix, level) {
|
|
3170
3193
|
const loggerState = {
|
|
3171
|
-
currentLevel: getEnvLevel(),
|
|
3194
|
+
currentLevel: level ?? getEnvLevel(),
|
|
3172
3195
|
setLevel(l) {
|
|
3173
3196
|
this.currentLevel = l;
|
|
3174
3197
|
}
|
|
@@ -3189,15 +3212,20 @@ function createLogger(prefix, level) {
|
|
|
3189
3212
|
setLogFile: (filePath) => setGlobalLogFile(filePath)
|
|
3190
3213
|
};
|
|
3191
3214
|
}
|
|
3192
|
-
var LEVELS, _globalLogFile, _logFileInitialized;
|
|
3215
|
+
var import_node_fs3, import_node_path3, LEVELS, _globalLogFile, _logFileInitialized, logger;
|
|
3193
3216
|
var init_logger = __esm({
|
|
3194
3217
|
"packages/domain/shared/src/logger.ts"() {
|
|
3218
|
+
"use strict";
|
|
3219
|
+
import_node_fs3 = __toESM(require("fs"));
|
|
3220
|
+
import_node_path3 = __toESM(require("path"));
|
|
3195
3221
|
LEVELS = { silent: 0, error: 1, warn: 2, info: 3, debug: 4 };
|
|
3196
3222
|
_globalLogFile = null;
|
|
3197
3223
|
_logFileInitialized = false;
|
|
3198
|
-
createLogger("tailwind-styled");
|
|
3224
|
+
logger = createLogger("tailwind-styled");
|
|
3199
3225
|
}
|
|
3200
3226
|
});
|
|
3227
|
+
|
|
3228
|
+
// packages/domain/shared/src/index.ts
|
|
3201
3229
|
function createLogger2(namespace) {
|
|
3202
3230
|
const prefix = `[${namespace}]`;
|
|
3203
3231
|
return {
|
|
@@ -3220,7 +3248,7 @@ function createLogger2(namespace) {
|
|
|
3220
3248
|
};
|
|
3221
3249
|
}
|
|
3222
3250
|
function createDebugLogger(namespace, label) {
|
|
3223
|
-
const prefix = `[${namespace}]`;
|
|
3251
|
+
const prefix = label ? `[${namespace}:${label}]` : `[${namespace}]`;
|
|
3224
3252
|
return (msg) => {
|
|
3225
3253
|
if (process.env.DEBUG?.includes(namespace) || process.env.TW_DEBUG) {
|
|
3226
3254
|
console.debug(prefix, msg);
|
|
@@ -3237,9 +3265,9 @@ function loadNativeBinding(options) {
|
|
|
3237
3265
|
const { runtimeDir, candidates, isValid } = options;
|
|
3238
3266
|
const loadErrors = [];
|
|
3239
3267
|
for (const candidate of candidates) {
|
|
3240
|
-
const candidatePath =
|
|
3268
|
+
const candidatePath = import_node_path4.default.resolve(runtimeDir, candidate);
|
|
3241
3269
|
try {
|
|
3242
|
-
if (!
|
|
3270
|
+
if (!import_node_fs4.default.existsSync(candidatePath) && !import_node_fs4.default.existsSync(candidatePath + ".node")) {
|
|
3243
3271
|
continue;
|
|
3244
3272
|
}
|
|
3245
3273
|
const mod = requireNativeModule(candidatePath);
|
|
@@ -3271,9 +3299,9 @@ function resolveNativeBindingCandidates(options) {
|
|
|
3271
3299
|
}
|
|
3272
3300
|
}
|
|
3273
3301
|
if (!includeDefaultCandidates) return candidates;
|
|
3274
|
-
if (
|
|
3302
|
+
if (import_node_fs4.default.existsSync(runtimeDir)) {
|
|
3275
3303
|
try {
|
|
3276
|
-
for (const entry of
|
|
3304
|
+
for (const entry of import_node_fs4.default.readdirSync(runtimeDir)) {
|
|
3277
3305
|
if (entry.endsWith(".node")) candidates.push(entry);
|
|
3278
3306
|
}
|
|
3279
3307
|
} catch {
|
|
@@ -3282,32 +3310,40 @@ function resolveNativeBindingCandidates(options) {
|
|
|
3282
3310
|
const BINARY_NAMES = ["tailwind-styled-native", "tailwind_styled_parser"];
|
|
3283
3311
|
const napiPlatform = process.platform === "linux" && process.arch === "x64" ? "linux-x64-gnu" : process.platform === "linux" && process.arch === "arm64" ? "linux-arm64-gnu" : `${process.platform}-${process.arch}`;
|
|
3284
3312
|
for (const bin of BINARY_NAMES) {
|
|
3285
|
-
candidates.push(
|
|
3286
|
-
candidates.push(
|
|
3287
|
-
candidates.push(
|
|
3288
|
-
candidates.push(
|
|
3289
|
-
candidates.push(
|
|
3290
|
-
candidates.push(
|
|
3291
|
-
candidates.push(
|
|
3292
|
-
candidates.push(
|
|
3293
|
-
candidates.push(
|
|
3313
|
+
candidates.push(import_node_path4.default.resolve(runtimeDir, `${bin}.node`));
|
|
3314
|
+
candidates.push(import_node_path4.default.resolve(runtimeDir, `${bin}.${napiPlatform}.node`));
|
|
3315
|
+
candidates.push(import_node_path4.default.resolve(runtimeDir, "..", "native", `${bin}.node`));
|
|
3316
|
+
candidates.push(import_node_path4.default.resolve(runtimeDir, "..", "native", `${bin}.${napiPlatform}.node`));
|
|
3317
|
+
candidates.push(import_node_path4.default.resolve(process.cwd(), "native", `${bin}.node`));
|
|
3318
|
+
candidates.push(import_node_path4.default.resolve(process.cwd(), "native", `${bin}.${napiPlatform}.node`));
|
|
3319
|
+
candidates.push(import_node_path4.default.resolve(runtimeDir, "..", "..", "..", "..", "native", `${bin}.node`));
|
|
3320
|
+
candidates.push(import_node_path4.default.resolve(runtimeDir, "..", "..", "..", "..", "native", `${bin}.${napiPlatform}.node`));
|
|
3321
|
+
candidates.push(import_node_path4.default.resolve(runtimeDir, "..", "..", "..", "native", `${bin}.node`));
|
|
3294
3322
|
}
|
|
3295
3323
|
return Array.from(new Set(candidates));
|
|
3296
3324
|
}
|
|
3297
3325
|
function resolveRuntimeDir(dir, importMetaUrl) {
|
|
3326
|
+
if (dir) return import_node_path4.default.resolve(dir);
|
|
3298
3327
|
try {
|
|
3299
|
-
return
|
|
3328
|
+
return import_node_path4.default.dirname((0, import_node_url.fileURLToPath)(importMetaUrl));
|
|
3300
3329
|
} catch {
|
|
3301
3330
|
return process.cwd();
|
|
3302
3331
|
}
|
|
3303
3332
|
}
|
|
3304
|
-
var TwError, _require3;
|
|
3333
|
+
var import_node_crypto, import_node_fs4, import_node_path4, import_node_url, import_node_module5, import_meta6, TwError, _require3;
|
|
3305
3334
|
var init_src2 = __esm({
|
|
3306
3335
|
"packages/domain/shared/src/index.ts"() {
|
|
3336
|
+
"use strict";
|
|
3337
|
+
import_node_crypto = require("crypto");
|
|
3338
|
+
import_node_fs4 = __toESM(require("fs"));
|
|
3339
|
+
import_node_path4 = __toESM(require("path"));
|
|
3340
|
+
import_node_url = require("url");
|
|
3341
|
+
import_node_module5 = require("module");
|
|
3307
3342
|
init_workerResolver();
|
|
3308
3343
|
init_native_resolution();
|
|
3309
3344
|
init_staticStateExtractor();
|
|
3310
3345
|
init_logger();
|
|
3346
|
+
import_meta6 = {};
|
|
3311
3347
|
TwError = class _TwError extends Error {
|
|
3312
3348
|
/** @deprecated Gunakan source */
|
|
3313
3349
|
domain;
|
|
@@ -3360,7 +3396,7 @@ var init_src2 = __esm({
|
|
|
3360
3396
|
return `[${this.source.toUpperCase()}:${this.code}] ${this.message}`;
|
|
3361
3397
|
}
|
|
3362
3398
|
};
|
|
3363
|
-
_require3 =
|
|
3399
|
+
_require3 = (0, import_node_module5.createRequire)(import_meta6.url);
|
|
3364
3400
|
}
|
|
3365
3401
|
});
|
|
3366
3402
|
|
|
@@ -3397,8 +3433,8 @@ function getDirname() {
|
|
|
3397
3433
|
if (typeof __dirname !== "undefined") {
|
|
3398
3434
|
return __dirname;
|
|
3399
3435
|
}
|
|
3400
|
-
if (typeof
|
|
3401
|
-
return
|
|
3436
|
+
if (typeof import_meta7 !== "undefined" && import_meta7.url) {
|
|
3437
|
+
return import_node_path5.default.dirname((0, import_node_url2.fileURLToPath)(import_meta7.url));
|
|
3402
3438
|
}
|
|
3403
3439
|
return process.cwd();
|
|
3404
3440
|
}
|
|
@@ -3603,13 +3639,17 @@ function hasNativeWatchBinding() {
|
|
|
3603
3639
|
return false;
|
|
3604
3640
|
}
|
|
3605
3641
|
}
|
|
3606
|
-
var log2, isValidScannerBinding, createScannerBridgeLoader, scannerBridgeLoader, scannerGetBinding, resetScannerBridgeCache;
|
|
3642
|
+
var import_node_path5, import_node_url2, import_meta7, log2, isValidScannerBinding, createScannerBridgeLoader, scannerBridgeLoader, scannerGetBinding, resetScannerBridgeCache;
|
|
3607
3643
|
var init_native_bridge = __esm({
|
|
3608
3644
|
"packages/domain/scanner/src/native-bridge.ts"() {
|
|
3645
|
+
"use strict";
|
|
3646
|
+
import_node_path5 = __toESM(require("path"), 1);
|
|
3647
|
+
import_node_url2 = require("url");
|
|
3609
3648
|
init_src2();
|
|
3649
|
+
import_meta7 = {};
|
|
3610
3650
|
log2 = createDebugLogger("scanner:native");
|
|
3611
|
-
isValidScannerBinding = (
|
|
3612
|
-
const candidate =
|
|
3651
|
+
isValidScannerBinding = (module2) => {
|
|
3652
|
+
const candidate = module2;
|
|
3613
3653
|
return !!(candidate && (candidate.scanWorkspace || candidate.extractClassesFromSource || candidate.hashFileContent || candidate.cacheRead || candidate.cacheWrite));
|
|
3614
3654
|
};
|
|
3615
3655
|
createScannerBridgeLoader = () => {
|
|
@@ -3686,6 +3726,20 @@ var init_native_bridge = __esm({
|
|
|
3686
3726
|
resetScannerBridgeCache = scannerBridgeLoader.reset;
|
|
3687
3727
|
}
|
|
3688
3728
|
});
|
|
3729
|
+
|
|
3730
|
+
// src/umbrella/next.ts
|
|
3731
|
+
var next_exports = {};
|
|
3732
|
+
__export(next_exports, {
|
|
3733
|
+
NextAdapterOptionsSchema: () => NextAdapterOptionsSchema,
|
|
3734
|
+
StaticCssWebpackPlugin: () => StaticCssWebpackPlugin,
|
|
3735
|
+
parseNextAdapterOptions: () => parseNextAdapterOptions,
|
|
3736
|
+
setFileStaticCss: () => setFileStaticCss,
|
|
3737
|
+
withTailwindStyled: () => withTailwindStyled
|
|
3738
|
+
});
|
|
3739
|
+
module.exports = __toCommonJS(next_exports);
|
|
3740
|
+
|
|
3741
|
+
// packages/presentation/next/src/schemas.ts
|
|
3742
|
+
var import_zod = require("zod");
|
|
3689
3743
|
var formatIssues = (error) => error.issues.map((issue) => {
|
|
3690
3744
|
const p = issue.path.length > 0 ? issue.path.join(".") : "<root>";
|
|
3691
3745
|
return `${p}: ${issue.message}`;
|
|
@@ -3695,34 +3749,45 @@ var parseWithSchema = (schema, data, label) => {
|
|
|
3695
3749
|
if (parsed.success) return parsed.data;
|
|
3696
3750
|
throw new TypeError(`${label}: ${formatIssues(parsed.error)}`);
|
|
3697
3751
|
};
|
|
3698
|
-
var NextAdapterOptionsSchema =
|
|
3699
|
-
mode:
|
|
3700
|
-
autoClientBoundary:
|
|
3701
|
-
addDataAttr:
|
|
3702
|
-
hoist:
|
|
3703
|
-
routeCss:
|
|
3704
|
-
incremental:
|
|
3705
|
-
verbose:
|
|
3706
|
-
include:
|
|
3707
|
-
exclude:
|
|
3752
|
+
var NextAdapterOptionsSchema = import_zod.z.object({
|
|
3753
|
+
mode: import_zod.z.literal("zero-runtime").optional(),
|
|
3754
|
+
autoClientBoundary: import_zod.z.boolean().optional(),
|
|
3755
|
+
addDataAttr: import_zod.z.boolean().optional(),
|
|
3756
|
+
hoist: import_zod.z.boolean().optional(),
|
|
3757
|
+
routeCss: import_zod.z.boolean().optional(),
|
|
3758
|
+
incremental: import_zod.z.boolean().optional(),
|
|
3759
|
+
verbose: import_zod.z.boolean().optional(),
|
|
3760
|
+
include: import_zod.z.instanceof(RegExp).optional(),
|
|
3761
|
+
exclude: import_zod.z.instanceof(RegExp).optional()
|
|
3708
3762
|
});
|
|
3709
3763
|
var parseNextAdapterOptions = (options) => parseWithSchema(NextAdapterOptionsSchema, options ?? {}, "next adapter options are invalid");
|
|
3710
3764
|
|
|
3711
3765
|
// packages/presentation/next/src/withTailwindStyled.ts
|
|
3766
|
+
var import_node_fs9 = __toESM(require("fs"), 1);
|
|
3767
|
+
var import_node_module7 = require("module");
|
|
3768
|
+
var import_node_path10 = __toESM(require("path"), 1);
|
|
3712
3769
|
init_src2();
|
|
3713
3770
|
|
|
3714
3771
|
// packages/domain/scanner/src/index.ts
|
|
3772
|
+
var import_node_fs6 = __toESM(require("fs"), 1);
|
|
3773
|
+
var import_node_module6 = require("module");
|
|
3774
|
+
var import_node_path7 = __toESM(require("path"), 1);
|
|
3775
|
+
var import_node_url3 = require("url");
|
|
3776
|
+
var import_node_worker_threads = require("worker_threads");
|
|
3715
3777
|
init_src2();
|
|
3716
3778
|
|
|
3717
3779
|
// packages/domain/scanner/src/cache-native.ts
|
|
3780
|
+
var import_node_fs5 = __toESM(require("fs"), 1);
|
|
3781
|
+
var import_node_path6 = __toESM(require("path"), 1);
|
|
3718
3782
|
init_native_bridge();
|
|
3719
3783
|
function defaultCachePath(rootDir, cacheDir) {
|
|
3720
|
-
const dir = cacheDir ?
|
|
3721
|
-
return
|
|
3784
|
+
const dir = cacheDir ? import_node_path6.default.resolve(rootDir, cacheDir) : import_node_path6.default.join(process.cwd(), ".cache", "tailwind-styled");
|
|
3785
|
+
return import_node_path6.default.join(dir, "scanner-cache.json");
|
|
3722
3786
|
}
|
|
3787
|
+
var STALE_THRESHOLD_MS = 7 * 24 * 60 * 60 * 1e3;
|
|
3723
3788
|
function readCache(rootDir, cacheDir) {
|
|
3724
3789
|
const cachePath = defaultCachePath(rootDir, cacheDir);
|
|
3725
|
-
|
|
3790
|
+
import_node_fs5.default.mkdirSync(import_node_path6.default.dirname(cachePath), { recursive: true });
|
|
3726
3791
|
const result = cacheReadNative(cachePath);
|
|
3727
3792
|
if (!result) return [];
|
|
3728
3793
|
return result.entries.map((e) => ({
|
|
@@ -3737,7 +3802,7 @@ function readCache(rootDir, cacheDir) {
|
|
|
3737
3802
|
}
|
|
3738
3803
|
function writeCache(rootDir, entries, cacheDir) {
|
|
3739
3804
|
const cachePath = defaultCachePath(rootDir, cacheDir);
|
|
3740
|
-
|
|
3805
|
+
import_node_fs5.default.mkdirSync(import_node_path6.default.dirname(cachePath), { recursive: true });
|
|
3741
3806
|
const success = cacheWriteNative(cachePath, entries);
|
|
3742
3807
|
if (!success) {
|
|
3743
3808
|
throw new Error(
|
|
@@ -3761,6 +3826,7 @@ function filePriority(mtimeMs, size, cached, nowMs = Date.now()) {
|
|
|
3761
3826
|
init_native_bridge();
|
|
3762
3827
|
|
|
3763
3828
|
// packages/domain/scanner/src/schemas.ts
|
|
3829
|
+
var import_zod2 = require("zod");
|
|
3764
3830
|
init_src2();
|
|
3765
3831
|
var formatIssuePath2 = (path12) => path12.length > 0 ? path12.map(
|
|
3766
3832
|
(segment) => typeof segment === "symbol" ? segment.description ?? segment.toString() : String(segment)
|
|
@@ -3780,40 +3846,40 @@ var parseWithSchema2 = (schema, data, label) => {
|
|
|
3780
3846
|
parsed.error
|
|
3781
3847
|
);
|
|
3782
3848
|
};
|
|
3783
|
-
var NonNegativeIntegerSchema =
|
|
3784
|
-
var ScanWorkspaceOptionsSchema =
|
|
3785
|
-
includeExtensions:
|
|
3786
|
-
ignoreDirectories:
|
|
3787
|
-
useCache:
|
|
3788
|
-
cacheDir:
|
|
3789
|
-
smartInvalidation:
|
|
3849
|
+
var NonNegativeIntegerSchema = import_zod2.z.number().int().min(0);
|
|
3850
|
+
var ScanWorkspaceOptionsSchema = import_zod2.z.object({
|
|
3851
|
+
includeExtensions: import_zod2.z.array(import_zod2.z.string()).optional(),
|
|
3852
|
+
ignoreDirectories: import_zod2.z.array(import_zod2.z.string()).optional(),
|
|
3853
|
+
useCache: import_zod2.z.boolean().optional(),
|
|
3854
|
+
cacheDir: import_zod2.z.string().min(1).optional(),
|
|
3855
|
+
smartInvalidation: import_zod2.z.boolean().optional()
|
|
3790
3856
|
});
|
|
3791
|
-
var ScanFileResultSchema =
|
|
3792
|
-
file:
|
|
3793
|
-
classes:
|
|
3794
|
-
hash:
|
|
3857
|
+
var ScanFileResultSchema = import_zod2.z.object({
|
|
3858
|
+
file: import_zod2.z.string(),
|
|
3859
|
+
classes: import_zod2.z.array(import_zod2.z.string()),
|
|
3860
|
+
hash: import_zod2.z.string().optional()
|
|
3795
3861
|
});
|
|
3796
|
-
var ScanWorkspaceResultSchema =
|
|
3797
|
-
files:
|
|
3862
|
+
var ScanWorkspaceResultSchema = import_zod2.z.object({
|
|
3863
|
+
files: import_zod2.z.array(ScanFileResultSchema),
|
|
3798
3864
|
totalFiles: NonNegativeIntegerSchema,
|
|
3799
|
-
uniqueClasses:
|
|
3865
|
+
uniqueClasses: import_zod2.z.array(import_zod2.z.string())
|
|
3800
3866
|
}).refine((value) => value.totalFiles === value.files.length, {
|
|
3801
3867
|
message: "scan result totalFiles must match files.length",
|
|
3802
3868
|
path: ["totalFiles"]
|
|
3803
3869
|
});
|
|
3804
|
-
|
|
3805
|
-
rootDir:
|
|
3870
|
+
var ScannerWorkerRequestSchema = import_zod2.z.object({
|
|
3871
|
+
rootDir: import_zod2.z.string().min(1),
|
|
3806
3872
|
options: ScanWorkspaceOptionsSchema.optional()
|
|
3807
3873
|
});
|
|
3808
|
-
var ScannerWorkerSuccessMessageSchema =
|
|
3809
|
-
ok:
|
|
3874
|
+
var ScannerWorkerSuccessMessageSchema = import_zod2.z.object({
|
|
3875
|
+
ok: import_zod2.z.literal(true),
|
|
3810
3876
|
result: ScanWorkspaceResultSchema
|
|
3811
3877
|
});
|
|
3812
|
-
var ScannerWorkerErrorMessageSchema =
|
|
3813
|
-
ok:
|
|
3814
|
-
error:
|
|
3878
|
+
var ScannerWorkerErrorMessageSchema = import_zod2.z.object({
|
|
3879
|
+
ok: import_zod2.z.literal(false),
|
|
3880
|
+
error: import_zod2.z.string().optional()
|
|
3815
3881
|
});
|
|
3816
|
-
|
|
3882
|
+
var ScannerWorkerMessageSchema = import_zod2.z.union([
|
|
3817
3883
|
ScannerWorkerSuccessMessageSchema,
|
|
3818
3884
|
ScannerWorkerErrorMessageSchema
|
|
3819
3885
|
]);
|
|
@@ -3821,13 +3887,14 @@ var parseScanWorkspaceOptions = (options) => parseWithSchema2(ScanWorkspaceOptio
|
|
|
3821
3887
|
var parseScanWorkspaceResult = (result) => parseWithSchema2(ScanWorkspaceResultSchema, result, "scanner workspace result is invalid");
|
|
3822
3888
|
|
|
3823
3889
|
// packages/domain/scanner/src/index.ts
|
|
3890
|
+
var import_meta8 = {};
|
|
3824
3891
|
var log3 = createLogger2("scanner");
|
|
3825
3892
|
function getRuntimeDir() {
|
|
3826
3893
|
if (typeof __dirname !== "undefined" && __dirname.length > 0) {
|
|
3827
3894
|
return __dirname;
|
|
3828
3895
|
}
|
|
3829
|
-
if (typeof
|
|
3830
|
-
return
|
|
3896
|
+
if (typeof import_meta8 !== "undefined" && import_meta8.url) {
|
|
3897
|
+
return import_node_path7.default.dirname((0, import_node_url3.fileURLToPath)(import_meta8.url));
|
|
3831
3898
|
}
|
|
3832
3899
|
return process.cwd();
|
|
3833
3900
|
}
|
|
@@ -3842,7 +3909,7 @@ var createNativeParserLoader = () => {
|
|
|
3842
3909
|
const loadNativeParserBinding = () => {
|
|
3843
3910
|
if (_state.binding !== void 0) return _state.binding;
|
|
3844
3911
|
const runtimeDir = getRuntimeDir();
|
|
3845
|
-
const req =
|
|
3912
|
+
const req = (0, import_node_module6.createRequire)(import_node_path7.default.join(runtimeDir, "noop.cjs"));
|
|
3846
3913
|
const _platform = process.platform;
|
|
3847
3914
|
const _arch = process.arch;
|
|
3848
3915
|
const _platformArch = `${_platform}-${_arch}`;
|
|
@@ -3850,27 +3917,27 @@ var createNativeParserLoader = () => {
|
|
|
3850
3917
|
const candidates = [
|
|
3851
3918
|
// ── binaryName baru: tailwind-styled-native (napi-rs naming) ──
|
|
3852
3919
|
// cwd = repo root saat run dari root, atau package dir saat workspaces
|
|
3853
|
-
|
|
3854
|
-
|
|
3855
|
-
|
|
3920
|
+
import_node_path7.default.resolve(process.cwd(), "native", "tailwind-styled-native.node"),
|
|
3921
|
+
import_node_path7.default.resolve(process.cwd(), "native", `tailwind-styled-native.${_platformArch}.node`),
|
|
3922
|
+
import_node_path7.default.resolve(process.cwd(), "native", `tailwind-styled-native.${_platformArchGnu}.node`),
|
|
3856
3923
|
// runtimeDir = dist/ → naik 1 level ke package root (npm install case)
|
|
3857
3924
|
// e.g. node_modules/tailwind-styled-v4/dist/ → node_modules/tailwind-styled-v4/native/
|
|
3858
|
-
|
|
3859
|
-
|
|
3860
|
-
|
|
3925
|
+
import_node_path7.default.resolve(runtimeDir, "..", "native", "tailwind-styled-native.node"),
|
|
3926
|
+
import_node_path7.default.resolve(runtimeDir, "..", "native", `tailwind-styled-native.${_platformArch}.node`),
|
|
3927
|
+
import_node_path7.default.resolve(runtimeDir, "..", "native", `tailwind-styled-native.${_platformArchGnu}.node`),
|
|
3861
3928
|
// runtimeDir = dist/ → naik 4 level ke repo root (monorepo dev case)
|
|
3862
|
-
|
|
3863
|
-
|
|
3929
|
+
import_node_path7.default.resolve(runtimeDir, "..", "..", "..", "..", "native", "tailwind-styled-native.node"),
|
|
3930
|
+
import_node_path7.default.resolve(runtimeDir, "..", "..", "..", "..", "native", `tailwind-styled-native.${_platformArchGnu}.node`),
|
|
3864
3931
|
// 3 level fallback (jika package di-nest lebih dangkal)
|
|
3865
|
-
|
|
3866
|
-
|
|
3932
|
+
import_node_path7.default.resolve(runtimeDir, "..", "..", "..", "native", "tailwind-styled-native.node"),
|
|
3933
|
+
import_node_path7.default.resolve(runtimeDir, "..", "..", "..", "native", `tailwind-styled-native.${_platformArchGnu}.node`),
|
|
3867
3934
|
// ── binaryName lama: tailwind_styled_parser (backward compat) ──
|
|
3868
|
-
|
|
3869
|
-
|
|
3870
|
-
|
|
3871
|
-
|
|
3872
|
-
|
|
3873
|
-
|
|
3935
|
+
import_node_path7.default.resolve(process.cwd(), "native/tailwind_styled_parser.node"),
|
|
3936
|
+
import_node_path7.default.resolve(process.cwd(), "native/build/Release/tailwind_styled_parser.node"),
|
|
3937
|
+
import_node_path7.default.resolve(runtimeDir, "..", "native", "tailwind_styled_parser.node"),
|
|
3938
|
+
import_node_path7.default.resolve(runtimeDir, "..", "..", "..", "..", "native", "tailwind_styled_parser.node"),
|
|
3939
|
+
import_node_path7.default.resolve(runtimeDir, "..", "..", "..", "native", "tailwind_styled_parser.node"),
|
|
3940
|
+
import_node_path7.default.resolve(
|
|
3874
3941
|
runtimeDir,
|
|
3875
3942
|
"..",
|
|
3876
3943
|
"..",
|
|
@@ -3882,7 +3949,7 @@ var createNativeParserLoader = () => {
|
|
|
3882
3949
|
)
|
|
3883
3950
|
];
|
|
3884
3951
|
for (const fullPath of candidates) {
|
|
3885
|
-
if (!
|
|
3952
|
+
if (!import_node_fs6.default.existsSync(fullPath)) continue;
|
|
3886
3953
|
try {
|
|
3887
3954
|
const required = req(fullPath);
|
|
3888
3955
|
if (required && (typeof required.extractClassesFromSource === "function" || typeof required.parseClasses === "function" || typeof required.parse_classes === "function")) {
|
|
@@ -3923,19 +3990,19 @@ function collectCandidates(rootDir, ignoreDirectories, extensionSet) {
|
|
|
3923
3990
|
if (!currentDir) continue;
|
|
3924
3991
|
const entries = (() => {
|
|
3925
3992
|
try {
|
|
3926
|
-
return
|
|
3993
|
+
return import_node_fs6.default.readdirSync(currentDir, { withFileTypes: true });
|
|
3927
3994
|
} catch {
|
|
3928
3995
|
return [];
|
|
3929
3996
|
}
|
|
3930
3997
|
})();
|
|
3931
3998
|
for (const entry of entries) {
|
|
3932
|
-
const fullPath =
|
|
3999
|
+
const fullPath = import_node_path7.default.join(currentDir, entry.name);
|
|
3933
4000
|
if (entry.isDirectory()) {
|
|
3934
4001
|
if (!ignoreDirectories.has(entry.name)) directories.push(fullPath);
|
|
3935
4002
|
continue;
|
|
3936
4003
|
}
|
|
3937
4004
|
if (!entry.isFile()) continue;
|
|
3938
|
-
if (!extensionSet.has(
|
|
4005
|
+
if (!extensionSet.has(import_node_path7.default.extname(entry.name))) continue;
|
|
3939
4006
|
candidates.push(fullPath);
|
|
3940
4007
|
}
|
|
3941
4008
|
}
|
|
@@ -3979,7 +4046,7 @@ function scanWorkspace2(rootDir, options = {}) {
|
|
|
3979
4046
|
const extensionSet = buildExtensionSet(includeExtensions);
|
|
3980
4047
|
const ignoreDirectories = new Set(normalizedOptions.ignoreDirectories ?? DEFAULT_IGNORES);
|
|
3981
4048
|
const useCache = normalizedOptions.useCache ?? true;
|
|
3982
|
-
normalizedOptions.smartInvalidation ?? true;
|
|
4049
|
+
const _smartInvalidation = normalizedOptions.smartInvalidation ?? true;
|
|
3983
4050
|
const files = [];
|
|
3984
4051
|
const unique = /* @__PURE__ */ new Set();
|
|
3985
4052
|
const candidates = collectCandidates(rootDir, ignoreDirectories, extensionSet);
|
|
@@ -4019,7 +4086,7 @@ function scanWorkspace2(rootDir, options = {}) {
|
|
|
4019
4086
|
for (const filePath of candidates) {
|
|
4020
4087
|
const stat = (() => {
|
|
4021
4088
|
try {
|
|
4022
|
-
return
|
|
4089
|
+
return import_node_fs6.default.statSync(filePath);
|
|
4023
4090
|
} catch {
|
|
4024
4091
|
return null;
|
|
4025
4092
|
}
|
|
@@ -4045,7 +4112,7 @@ function scanWorkspace2(rootDir, options = {}) {
|
|
|
4045
4112
|
for (const { filePath, stat, size, cached } of ranked) {
|
|
4046
4113
|
const content = (() => {
|
|
4047
4114
|
try {
|
|
4048
|
-
return
|
|
4115
|
+
return import_node_fs6.default.readFileSync(filePath, "utf8");
|
|
4049
4116
|
} catch {
|
|
4050
4117
|
return null;
|
|
4051
4118
|
}
|
|
@@ -4110,6 +4177,8 @@ function scanWorkspace2(rootDir, options = {}) {
|
|
|
4110
4177
|
init_src2();
|
|
4111
4178
|
|
|
4112
4179
|
// packages/presentation/next/src/incrementalOrchestrator.ts
|
|
4180
|
+
var import_node_fs7 = __toESM(require("fs"), 1);
|
|
4181
|
+
var import_node_path8 = __toESM(require("path"), 1);
|
|
4113
4182
|
init_src();
|
|
4114
4183
|
var _fingerprintCache = /* @__PURE__ */ new Map();
|
|
4115
4184
|
function getNative2() {
|
|
@@ -4121,10 +4190,10 @@ function getNative2() {
|
|
|
4121
4190
|
}
|
|
4122
4191
|
function fingerprintFile(filePath) {
|
|
4123
4192
|
try {
|
|
4124
|
-
const stat =
|
|
4193
|
+
const stat = import_node_fs7.default.statSync(filePath);
|
|
4125
4194
|
const native = getNative2();
|
|
4126
4195
|
if (native?.create_fingerprint) {
|
|
4127
|
-
const content =
|
|
4196
|
+
const content = import_node_fs7.default.readFileSync(filePath, "utf-8");
|
|
4128
4197
|
const hash = native.create_fingerprint(filePath, content);
|
|
4129
4198
|
return { hash, mtime: stat.mtimeMs };
|
|
4130
4199
|
}
|
|
@@ -4164,14 +4233,18 @@ function hasSourceChanged(sourceFiles) {
|
|
|
4164
4233
|
}
|
|
4165
4234
|
function isIncrementalEnabled(cwd) {
|
|
4166
4235
|
try {
|
|
4167
|
-
const configPath =
|
|
4168
|
-
if (!
|
|
4169
|
-
const config = JSON.parse(
|
|
4236
|
+
const configPath = import_node_path8.default.join(cwd, "tailwind-styled.config.json");
|
|
4237
|
+
if (!import_node_fs7.default.existsSync(configPath)) return false;
|
|
4238
|
+
const config = JSON.parse(import_node_fs7.default.readFileSync(configPath, "utf-8"));
|
|
4170
4239
|
return config.compiler?.incremental === true;
|
|
4171
4240
|
} catch {
|
|
4172
4241
|
return false;
|
|
4173
4242
|
}
|
|
4174
4243
|
}
|
|
4244
|
+
|
|
4245
|
+
// packages/presentation/next/src/staticCssWebpackPlugin.ts
|
|
4246
|
+
var import_node_fs8 = __toESM(require("fs"), 1);
|
|
4247
|
+
var import_node_path9 = __toESM(require("path"), 1);
|
|
4175
4248
|
var _fileStaticCssMap = /* @__PURE__ */ new Map();
|
|
4176
4249
|
function setFileStaticCss(filepath, css) {
|
|
4177
4250
|
if (css && css.trim()) {
|
|
@@ -4205,14 +4278,14 @@ var StaticCssWebpackPlugin = class _StaticCssWebpackPlugin {
|
|
|
4205
4278
|
static PLUGIN_NAME = "TailwindStyledStaticCss";
|
|
4206
4279
|
outPath;
|
|
4207
4280
|
constructor(safelistPath) {
|
|
4208
|
-
this.outPath =
|
|
4281
|
+
this.outPath = import_node_path9.default.join(import_node_path9.default.dirname(safelistPath), "_tw-state-static.css");
|
|
4209
4282
|
}
|
|
4210
4283
|
apply(compiler) {
|
|
4211
4284
|
compiler.hooks.done.tap(_StaticCssWebpackPlugin.PLUGIN_NAME, () => {
|
|
4212
4285
|
try {
|
|
4213
4286
|
const content = buildContent(_fileStaticCssMap);
|
|
4214
|
-
|
|
4215
|
-
|
|
4287
|
+
import_node_fs8.default.mkdirSync(import_node_path9.default.dirname(this.outPath), { recursive: true });
|
|
4288
|
+
import_node_fs8.default.writeFileSync(
|
|
4216
4289
|
this.outPath,
|
|
4217
4290
|
HEADER + (content || "/* no static rules yet */") + "\n",
|
|
4218
4291
|
"utf-8"
|
|
@@ -4225,6 +4298,7 @@ var StaticCssWebpackPlugin = class _StaticCssWebpackPlugin {
|
|
|
4225
4298
|
};
|
|
4226
4299
|
|
|
4227
4300
|
// packages/presentation/next/src/withTailwindStyled.ts
|
|
4301
|
+
var import_meta9 = {};
|
|
4228
4302
|
function getDirnameFromUrl2(importMetaUrl) {
|
|
4229
4303
|
if (typeof importMetaUrl !== "string") return "";
|
|
4230
4304
|
if (importMetaUrl.startsWith("file://")) {
|
|
@@ -4238,20 +4312,20 @@ function getDirnameFromUrl2(importMetaUrl) {
|
|
|
4238
4312
|
const lastSlash = Math.max(importMetaUrl.lastIndexOf("/"), importMetaUrl.lastIndexOf("\\"));
|
|
4239
4313
|
return lastSlash > 0 ? importMetaUrl.slice(0, lastSlash) : "";
|
|
4240
4314
|
}
|
|
4241
|
-
var require4 =
|
|
4242
|
-
var resolveRuntimeDir2 = () => getDirnameFromUrl2(
|
|
4315
|
+
var require4 = (0, import_node_module7.createRequire)(import_meta9.url);
|
|
4316
|
+
var resolveRuntimeDir2 = () => getDirnameFromUrl2(import_meta9.url);
|
|
4243
4317
|
var resolveLoaderPath2 = (basename) => {
|
|
4244
4318
|
try {
|
|
4245
|
-
return resolveLoaderPath(basename,
|
|
4319
|
+
return resolveLoaderPath(basename, import_meta9.url);
|
|
4246
4320
|
} catch {
|
|
4247
4321
|
const runtimeDir = resolveRuntimeDir2();
|
|
4248
4322
|
const candidates = [
|
|
4249
|
-
|
|
4250
|
-
|
|
4251
|
-
|
|
4323
|
+
import_node_path10.default.resolve(runtimeDir, `${basename}.mjs`),
|
|
4324
|
+
import_node_path10.default.resolve(runtimeDir, `${basename}.js`),
|
|
4325
|
+
import_node_path10.default.resolve(runtimeDir, `${basename}.cjs`)
|
|
4252
4326
|
];
|
|
4253
4327
|
for (const candidate of candidates) {
|
|
4254
|
-
if (
|
|
4328
|
+
if (import_node_fs9.default.existsSync(candidate)) {
|
|
4255
4329
|
return candidate;
|
|
4256
4330
|
}
|
|
4257
4331
|
}
|
|
@@ -4289,7 +4363,7 @@ var createLoaderOptions = (options) => {
|
|
|
4289
4363
|
preserveImports: true
|
|
4290
4364
|
};
|
|
4291
4365
|
if (options.verbose !== void 0) opts.verbose = options.verbose;
|
|
4292
|
-
opts.safelistPath = options.safelistPath ??
|
|
4366
|
+
opts.safelistPath = options.safelistPath ?? import_node_path10.default.join(process.cwd(), ".next", "tailwind-styled-safelist.css");
|
|
4293
4367
|
return Object.freeze(opts);
|
|
4294
4368
|
};
|
|
4295
4369
|
var buildTurbopackRules = (loaderPath, loaderOptions) => {
|
|
@@ -4302,7 +4376,7 @@ var buildTurbopackRules = (loaderPath, loaderOptions) => {
|
|
|
4302
4376
|
])
|
|
4303
4377
|
);
|
|
4304
4378
|
};
|
|
4305
|
-
var normalizeLoaderPath = (loaderPath) =>
|
|
4379
|
+
var normalizeLoaderPath = (loaderPath) => import_node_path10.default.resolve(loaderPath);
|
|
4306
4380
|
var applyWebpackRule = (config, options, loaderPath) => {
|
|
4307
4381
|
const loaderOptions = createLoaderOptions(options);
|
|
4308
4382
|
const rules = config.module?.rules ?? [];
|
|
@@ -4319,7 +4393,7 @@ var applyWebpackRule = (config, options, loaderPath) => {
|
|
|
4319
4393
|
enforce: "pre",
|
|
4320
4394
|
use: [{ loader: loaderPath, options: loaderOptions }]
|
|
4321
4395
|
};
|
|
4322
|
-
const safelistPath = loaderOptions.safelistPath ??
|
|
4396
|
+
const safelistPath = loaderOptions.safelistPath ?? import_node_path10.default.join(process.cwd(), ".next", "tailwind-styled-safelist.css");
|
|
4323
4397
|
const pluginAlreadyRegistered = (config.plugins ?? []).some(
|
|
4324
4398
|
(p) => p?.constructor?.name === StaticCssWebpackPlugin.PLUGIN_NAME
|
|
4325
4399
|
);
|
|
@@ -4419,17 +4493,17 @@ function withTailwindStyled(options = {}) {
|
|
|
4419
4493
|
return fullCss.slice(startIdx, endIdx + 1);
|
|
4420
4494
|
};
|
|
4421
4495
|
var extractUtilitiesLayer = extractUtilitiesLayer2;
|
|
4422
|
-
const twClassesDir =
|
|
4423
|
-
|
|
4424
|
-
setGlobalLogFile(
|
|
4425
|
-
|
|
4426
|
-
|
|
4496
|
+
const twClassesDir = import_node_path10.default.join(import_node_path10.default.dirname(safelistPath), "tw-classes");
|
|
4497
|
+
import_node_fs9.default.mkdirSync(twClassesDir, { recursive: true });
|
|
4498
|
+
setGlobalLogFile(import_node_path10.default.join(twClassesDir, "_tw-build.log"));
|
|
4499
|
+
import_node_fs9.default.writeFileSync(
|
|
4500
|
+
import_node_path10.default.join(twClassesDir, "_start.txt"),
|
|
4427
4501
|
String(Date.now()),
|
|
4428
4502
|
"utf-8"
|
|
4429
4503
|
);
|
|
4430
|
-
const stateStaticPath =
|
|
4504
|
+
const stateStaticPath = import_node_path10.default.join(twClassesDir, TW_STATE_STATIC_FILENAME);
|
|
4431
4505
|
try {
|
|
4432
|
-
|
|
4506
|
+
import_node_fs9.default.writeFileSync(
|
|
4433
4507
|
stateStaticPath,
|
|
4434
4508
|
"/* tw-state-static.css \u2014 placeholder, akan di-generate setelah scan */\n",
|
|
4435
4509
|
"utf-8"
|
|
@@ -4445,14 +4519,14 @@ function withTailwindStyled(options = {}) {
|
|
|
4445
4519
|
"src/index.css",
|
|
4446
4520
|
"styles/globals.css"
|
|
4447
4521
|
];
|
|
4448
|
-
const safelistDir =
|
|
4522
|
+
const safelistDir = import_node_path10.default.dirname(safelistPath);
|
|
4449
4523
|
for (const candidate of CSS_CANDIDATES) {
|
|
4450
|
-
const candidatePath =
|
|
4451
|
-
if (!
|
|
4452
|
-
const content =
|
|
4524
|
+
const candidatePath = import_node_path10.default.join(process.cwd(), candidate);
|
|
4525
|
+
if (!import_node_fs9.default.existsSync(candidatePath)) continue;
|
|
4526
|
+
const content = import_node_fs9.default.readFileSync(candidatePath, "utf-8");
|
|
4453
4527
|
if (content.includes("_tw-state-static.css")) break;
|
|
4454
|
-
const globalsDir =
|
|
4455
|
-
const rel =
|
|
4528
|
+
const globalsDir = import_node_path10.default.dirname(candidatePath);
|
|
4529
|
+
const rel = import_node_path10.default.relative(globalsDir, stateStaticPath).replace(/\\/g, "/");
|
|
4456
4530
|
const importLine = `@import "./${rel}";`;
|
|
4457
4531
|
const tailwindImportRe = /(@import\s+["']tailwindcss["']\s*;[^\n]*\n?)/;
|
|
4458
4532
|
let updated;
|
|
@@ -4466,7 +4540,7 @@ function withTailwindStyled(options = {}) {
|
|
|
4466
4540
|
updated = `${importLine}
|
|
4467
4541
|
${content}`;
|
|
4468
4542
|
}
|
|
4469
|
-
|
|
4543
|
+
import_node_fs9.default.writeFileSync(candidatePath, updated, "utf-8");
|
|
4470
4544
|
if (options.verbose) {
|
|
4471
4545
|
console.log(
|
|
4472
4546
|
`[tailwind-styled] Auto-injected "${importLine}" into ${candidate}`
|
|
@@ -4478,27 +4552,27 @@ ${content}`;
|
|
|
4478
4552
|
}
|
|
4479
4553
|
if (!process.env.TW_NATIVE_PATH) {
|
|
4480
4554
|
const runtimeDir = resolveRuntimeDir2();
|
|
4481
|
-
const nativePath =
|
|
4482
|
-
if (
|
|
4555
|
+
const nativePath = import_node_path10.default.resolve(runtimeDir, "..", "native", "tailwind-styled-native.node");
|
|
4556
|
+
if (import_node_fs9.default.existsSync(nativePath)) {
|
|
4483
4557
|
process.env.TW_NATIVE_PATH = nativePath;
|
|
4484
4558
|
}
|
|
4485
4559
|
}
|
|
4486
|
-
const srcDir =
|
|
4487
|
-
if (
|
|
4560
|
+
const srcDir = import_node_path10.default.join(process.cwd(), "src");
|
|
4561
|
+
if (import_node_fs9.default.existsSync(srcDir)) {
|
|
4488
4562
|
try {
|
|
4489
4563
|
const result = scanWorkspace2(srcDir);
|
|
4490
4564
|
if (result.uniqueClasses.length > 0) {
|
|
4491
4565
|
let atomicWriteFile2 = function(filePath, content) {
|
|
4492
4566
|
const tmpPath = `${filePath}.tmp`;
|
|
4493
4567
|
try {
|
|
4494
|
-
|
|
4495
|
-
|
|
4568
|
+
import_node_fs9.default.writeFileSync(tmpPath, content, "utf-8");
|
|
4569
|
+
import_node_fs9.default.renameSync(tmpPath, filePath);
|
|
4496
4570
|
} catch {
|
|
4497
4571
|
try {
|
|
4498
|
-
|
|
4572
|
+
import_node_fs9.default.unlinkSync(tmpPath);
|
|
4499
4573
|
} catch {
|
|
4500
4574
|
}
|
|
4501
|
-
|
|
4575
|
+
import_node_fs9.default.writeFileSync(filePath, content, "utf-8");
|
|
4502
4576
|
}
|
|
4503
4577
|
};
|
|
4504
4578
|
var atomicWriteFile = atomicWriteFile2;
|
|
@@ -4561,14 +4635,14 @@ ${content}`;
|
|
|
4561
4635
|
"styles/globals.css"
|
|
4562
4636
|
];
|
|
4563
4637
|
try {
|
|
4564
|
-
const twConfigPath =
|
|
4565
|
-
if (
|
|
4566
|
-
const twConfig = JSON.parse(
|
|
4638
|
+
const twConfigPath = import_node_path10.default.join(process.cwd(), "tailwind-styled.config.json");
|
|
4639
|
+
if (import_node_fs9.default.existsSync(twConfigPath)) {
|
|
4640
|
+
const twConfig = JSON.parse(import_node_fs9.default.readFileSync(twConfigPath, "utf-8"));
|
|
4567
4641
|
const cssEntry = twConfig.css?.entry;
|
|
4568
4642
|
if (cssEntry) {
|
|
4569
|
-
const cssEntryPath =
|
|
4570
|
-
if (
|
|
4571
|
-
cssEntryContent =
|
|
4643
|
+
const cssEntryPath = import_node_path10.default.join(process.cwd(), cssEntry);
|
|
4644
|
+
if (import_node_fs9.default.existsSync(cssEntryPath)) {
|
|
4645
|
+
cssEntryContent = import_node_fs9.default.readFileSync(cssEntryPath, "utf-8");
|
|
4572
4646
|
}
|
|
4573
4647
|
}
|
|
4574
4648
|
}
|
|
@@ -4576,9 +4650,9 @@ ${content}`;
|
|
|
4576
4650
|
}
|
|
4577
4651
|
if (!cssEntryContent) {
|
|
4578
4652
|
for (const candidate of CSS_CANDIDATES) {
|
|
4579
|
-
const candidatePath =
|
|
4580
|
-
if (
|
|
4581
|
-
cssEntryContent =
|
|
4653
|
+
const candidatePath = import_node_path10.default.join(process.cwd(), candidate);
|
|
4654
|
+
if (import_node_fs9.default.existsSync(candidatePath)) {
|
|
4655
|
+
cssEntryContent = import_node_fs9.default.readFileSync(candidatePath, "utf-8");
|
|
4582
4656
|
break;
|
|
4583
4657
|
}
|
|
4584
4658
|
}
|
|
@@ -4586,8 +4660,8 @@ ${content}`;
|
|
|
4586
4660
|
if (cssEntryContent) {
|
|
4587
4661
|
cssEntryContent = cssEntryContent.replace(/@source\s+["'][^"']+["']\s*;?\s*/g, "").replace(/←[^\n]*/g, "").trim();
|
|
4588
4662
|
}
|
|
4589
|
-
const initialScanPath =
|
|
4590
|
-
if (!
|
|
4663
|
+
const initialScanPath = import_node_path10.default.join(twClassesDir, "_initial-scan.css");
|
|
4664
|
+
if (!import_node_fs9.default.existsSync(initialScanPath)) {
|
|
4591
4665
|
atomicWriteFile2(
|
|
4592
4666
|
initialScanPath,
|
|
4593
4667
|
"/* tw-classes: initial scan \u2014 generating... */\n@layer utilities {}\n"
|
|
@@ -4595,7 +4669,7 @@ ${content}`;
|
|
|
4595
4669
|
}
|
|
4596
4670
|
const sourceFiles = result.files?.map((f) => f.file) ?? [];
|
|
4597
4671
|
const incremental = isIncrementalEnabled(process.cwd());
|
|
4598
|
-
if (incremental &&
|
|
4672
|
+
if (incremental && import_node_fs9.default.existsSync(initialScanPath) && !hasSourceChanged(sourceFiles)) {
|
|
4599
4673
|
if (options.verbose) console.log("[tailwind-styled] Incremental: tidak ada perubahan, skip regenerate CSS");
|
|
4600
4674
|
} else {
|
|
4601
4675
|
void (async () => {
|
|
@@ -4713,11 +4787,12 @@ ${err.message}`,
|
|
|
4713
4787
|
};
|
|
4714
4788
|
};
|
|
4715
4789
|
}
|
|
4716
|
-
|
|
4717
|
-
exports
|
|
4718
|
-
|
|
4719
|
-
|
|
4720
|
-
|
|
4721
|
-
|
|
4722
|
-
|
|
4790
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
4791
|
+
0 && (module.exports = {
|
|
4792
|
+
NextAdapterOptionsSchema,
|
|
4793
|
+
StaticCssWebpackPlugin,
|
|
4794
|
+
parseNextAdapterOptions,
|
|
4795
|
+
setFileStaticCss,
|
|
4796
|
+
withTailwindStyled
|
|
4797
|
+
});
|
|
4723
4798
|
//# sourceMappingURL=next.js.map
|