tailwind-styled-v4 5.0.37 → 5.0.39
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 +121 -83
- package/dist/analyzer.mjs.map +1 -1
- package/dist/animate.js +131 -87
- package/dist/animate.js.map +1 -1
- package/dist/animate.mjs +31 -15
- package/dist/animate.mjs.map +1 -1
- package/dist/atomic.js +107 -67
- package/dist/atomic.js.map +1 -1
- package/dist/atomic.mjs +47 -14
- package/dist/atomic.mjs.map +1 -1
- package/dist/cli.js +601 -428
- package/dist/cli.js.map +1 -1
- package/dist/cli.mjs +504 -313
- package/dist/cli.mjs.map +1 -1
- package/dist/compiler.js +833 -508
- package/dist/compiler.js.map +1 -1
- package/dist/compiler.mjs +298 -30
- package/dist/compiler.mjs.map +1 -1
- package/dist/dashboard.js +72 -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 +335 -289
- package/dist/devtools.js.map +1 -1
- package/dist/devtools.mjs +28 -11
- package/dist/devtools.mjs.map +1 -1
- package/dist/engine.js +719 -506
- package/dist/engine.js.map +1 -1
- package/dist/engine.mjs +520 -318
- 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 +1337 -7442
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1275 -7386
- package/dist/index.mjs.map +1 -1
- package/dist/next.js +327 -242
- package/dist/next.js.map +1 -1
- package/dist/next.mjs +272 -184
- package/dist/next.mjs.map +1 -1
- package/dist/plugin-api.js +94 -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 +68 -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 +102 -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 +48 -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 +108 -53
- package/dist/rspack.js.map +1 -1
- package/dist/rspack.mjs +50 -18
- package/dist/rspack.mjs.map +1 -1
- package/dist/runtime-css.js +63 -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 +98 -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 +164 -120
- package/dist/scanner.js.map +1 -1
- package/dist/scanner.mjs +70 -40
- package/dist/scanner.mjs.map +1 -1
- package/dist/shared.d.mts +0 -12
- package/dist/shared.d.ts +0 -12
- package/dist/shared.js +481 -299
- package/dist/shared.js.map +1 -1
- package/dist/shared.mjs +304 -133
- package/dist/shared.mjs.map +1 -1
- package/dist/storybook-addon.js +40 -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 +95 -64
- package/dist/svelte.js.map +1 -1
- package/dist/svelte.mjs +37 -14
- package/dist/svelte.mjs.map +1 -1
- package/dist/syntax.js +69 -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 +56 -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 +133 -74
- package/dist/theme.js.map +1 -1
- package/dist/theme.mjs +45 -14
- package/dist/theme.mjs.map +1 -1
- package/dist/turbopackLoader.js +156 -115
- package/dist/turbopackLoader.js.map +1 -1
- package/dist/turbopackLoader.mjs +135 -82
- package/dist/turbopackLoader.mjs.map +1 -1
- package/dist/tw.js +584 -423
- package/dist/tw.js.map +1 -1
- package/dist/tw.mjs +498 -311
- package/dist/tw.mjs.map +1 -1
- package/dist/vite.js +599 -450
- package/dist/vite.js.map +1 -1
- package/dist/vite.mjs +484 -332
- package/dist/vite.mjs.map +1 -1
- package/dist/vue.js +102 -70
- package/dist/vue.js.map +1 -1
- package/dist/vue.mjs +39 -15
- package/dist/vue.mjs.map +1 -1
- package/dist/webpackLoader.js +112 -77
- package/dist/webpackLoader.js.map +1 -1
- package/dist/webpackLoader.mjs +52 -18
- package/dist/webpackLoader.mjs.map +1 -1
- package/native/tailwind-styled-native.linux-x64-gnu.node +0 -0
- package/native/tailwind-styled-native.node +0 -0
- package/package.json +3 -1
package/dist/vite.js
CHANGED
|
@@ -1,48 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var zod = require('zod');
|
|
4
|
-
var module$1 = require('module');
|
|
5
|
-
var fs13 = require('fs');
|
|
6
|
-
var path9 = require('path');
|
|
7
|
-
var crypto = require('crypto');
|
|
8
|
-
var url = require('url');
|
|
9
|
-
var worker_threads = require('worker_threads');
|
|
10
|
-
var os = require('os');
|
|
11
|
-
require('perf_hooks');
|
|
12
|
-
|
|
13
|
-
var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
|
|
14
|
-
function _interopNamespace(e) {
|
|
15
|
-
if (e && e.__esModule) return e;
|
|
16
|
-
var n = Object.create(null);
|
|
17
|
-
if (e) {
|
|
18
|
-
Object.keys(e).forEach(function (k) {
|
|
19
|
-
if (k !== 'default') {
|
|
20
|
-
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
21
|
-
Object.defineProperty(n, k, d.get ? d : {
|
|
22
|
-
enumerable: true,
|
|
23
|
-
get: function () { return e[k]; }
|
|
24
|
-
});
|
|
25
|
-
}
|
|
26
|
-
});
|
|
27
|
-
}
|
|
28
|
-
n.default = e;
|
|
29
|
-
return Object.freeze(n);
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
var fs13__namespace = /*#__PURE__*/_interopNamespace(fs13);
|
|
33
|
-
var path9__namespace = /*#__PURE__*/_interopNamespace(path9);
|
|
34
|
-
|
|
1
|
+
const __importMetaUrl = typeof __filename !== "undefined" ? require("node:url").pathToFileURL(__filename).href : "file://unknown";
|
|
35
2
|
/* tailwind-styled-v4 v5.0.4 | MIT | https://github.com/dictionar32/tailwind-styled-v4 */
|
|
3
|
+
"use strict";
|
|
4
|
+
var __create = Object.create;
|
|
36
5
|
var __defProp = Object.defineProperty;
|
|
37
6
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
38
7
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
8
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
39
9
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
40
|
-
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
41
|
-
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
42
|
-
}) : x)(function(x) {
|
|
43
|
-
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
44
|
-
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
45
|
-
});
|
|
46
10
|
var __esm = (fn, res) => function __init() {
|
|
47
11
|
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
48
12
|
};
|
|
@@ -58,6 +22,14 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
58
22
|
}
|
|
59
23
|
return to;
|
|
60
24
|
};
|
|
25
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
26
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
27
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
28
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
29
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
30
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
31
|
+
mod
|
|
32
|
+
));
|
|
61
33
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
62
34
|
|
|
63
35
|
// packages/domain/shared/src/trace.ts
|
|
@@ -152,6 +124,7 @@ function getPipelinePercentages(metrics) {
|
|
|
152
124
|
}
|
|
153
125
|
var init_trace = __esm({
|
|
154
126
|
"packages/domain/shared/src/trace.ts"() {
|
|
127
|
+
"use strict";
|
|
155
128
|
}
|
|
156
129
|
});
|
|
157
130
|
|
|
@@ -166,6 +139,7 @@ function formatErrorCode(code) {
|
|
|
166
139
|
var ERROR_CODES, ERROR_SUGGESTIONS;
|
|
167
140
|
var init_error_codes = __esm({
|
|
168
141
|
"packages/domain/shared/src/error-codes.ts"() {
|
|
142
|
+
"use strict";
|
|
169
143
|
ERROR_CODES = {
|
|
170
144
|
// E0xx — Native binding
|
|
171
145
|
NATIVE_NOT_FOUND: "E001",
|
|
@@ -207,8 +181,8 @@ var init_error_codes = __esm({
|
|
|
207
181
|
// packages/domain/shared/src/compatibility.ts
|
|
208
182
|
function detectTailwind() {
|
|
209
183
|
try {
|
|
210
|
-
const pkgPath =
|
|
211
|
-
const { version } =
|
|
184
|
+
const pkgPath = require.resolve("tailwindcss/package.json");
|
|
185
|
+
const { version } = require(pkgPath);
|
|
212
186
|
const major = Number.parseInt(version.split(".")[0], 10);
|
|
213
187
|
return { version, major, supported: major >= 4, path: pkgPath };
|
|
214
188
|
} catch {
|
|
@@ -232,8 +206,11 @@ function isTailwindV4() {
|
|
|
232
206
|
}
|
|
233
207
|
var init_compatibility = __esm({
|
|
234
208
|
"packages/domain/shared/src/compatibility.ts"() {
|
|
209
|
+
"use strict";
|
|
235
210
|
}
|
|
236
211
|
});
|
|
212
|
+
|
|
213
|
+
// packages/domain/shared/src/native-schemas.ts
|
|
237
214
|
function safeParseNative(schema, data, fallback) {
|
|
238
215
|
const result = schema.safeParse(data);
|
|
239
216
|
return result.success ? result.data : fallback;
|
|
@@ -249,67 +226,69 @@ function parseNative(schema, data, context) {
|
|
|
249
226
|
}
|
|
250
227
|
return result.data;
|
|
251
228
|
}
|
|
252
|
-
var NativeScanFileSchema, NativeScanResultSchema, NativeClassUsageSchema, NativeAnalyzerReportSchema, NativeTransformResultSchema, NativeCssCompileResultSchema, NativeWatchResultSchema, NativeCacheEntrySchema, NativeCacheReadResultSchema;
|
|
229
|
+
var import_zod, NativeScanFileSchema, NativeScanResultSchema, NativeClassUsageSchema, NativeAnalyzerReportSchema, NativeTransformResultSchema, NativeCssCompileResultSchema, NativeWatchEventSchema, NativeWatchResultSchema, NativeCacheEntrySchema, NativeCacheReadResultSchema;
|
|
253
230
|
var init_native_schemas = __esm({
|
|
254
231
|
"packages/domain/shared/src/native-schemas.ts"() {
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
232
|
+
"use strict";
|
|
233
|
+
import_zod = require("zod");
|
|
234
|
+
NativeScanFileSchema = import_zod.z.object({
|
|
235
|
+
file: import_zod.z.string().min(1, "file path cannot be empty"),
|
|
236
|
+
classes: import_zod.z.array(import_zod.z.string()),
|
|
237
|
+
hash: import_zod.z.string().optional()
|
|
259
238
|
});
|
|
260
|
-
NativeScanResultSchema =
|
|
261
|
-
files:
|
|
262
|
-
totalFiles:
|
|
263
|
-
uniqueClasses:
|
|
239
|
+
NativeScanResultSchema = import_zod.z.object({
|
|
240
|
+
files: import_zod.z.array(NativeScanFileSchema),
|
|
241
|
+
totalFiles: import_zod.z.number().int().nonnegative(),
|
|
242
|
+
uniqueClasses: import_zod.z.array(import_zod.z.string())
|
|
264
243
|
});
|
|
265
|
-
NativeClassUsageSchema =
|
|
266
|
-
name:
|
|
267
|
-
count:
|
|
268
|
-
files:
|
|
244
|
+
NativeClassUsageSchema = import_zod.z.object({
|
|
245
|
+
name: import_zod.z.string(),
|
|
246
|
+
count: import_zod.z.number().int().nonnegative(),
|
|
247
|
+
files: import_zod.z.array(import_zod.z.string()).optional()
|
|
269
248
|
});
|
|
270
|
-
NativeAnalyzerReportSchema =
|
|
271
|
-
root:
|
|
272
|
-
topClasses:
|
|
273
|
-
safelist:
|
|
274
|
-
css:
|
|
275
|
-
conflicts:
|
|
276
|
-
unusedClasses:
|
|
277
|
-
durationMs:
|
|
249
|
+
NativeAnalyzerReportSchema = import_zod.z.object({
|
|
250
|
+
root: import_zod.z.string(),
|
|
251
|
+
topClasses: import_zod.z.array(NativeClassUsageSchema).optional(),
|
|
252
|
+
safelist: import_zod.z.array(import_zod.z.string()).optional(),
|
|
253
|
+
css: import_zod.z.string().optional(),
|
|
254
|
+
conflicts: import_zod.z.array(import_zod.z.unknown()).optional(),
|
|
255
|
+
unusedClasses: import_zod.z.array(import_zod.z.string()).optional(),
|
|
256
|
+
durationMs: import_zod.z.number().nonnegative().optional()
|
|
278
257
|
});
|
|
279
|
-
NativeTransformResultSchema =
|
|
280
|
-
code:
|
|
281
|
-
classes:
|
|
282
|
-
changed:
|
|
283
|
-
rsc:
|
|
284
|
-
isServer:
|
|
285
|
-
needsClientDirective:
|
|
286
|
-
clientReasons:
|
|
258
|
+
NativeTransformResultSchema = import_zod.z.object({
|
|
259
|
+
code: import_zod.z.string(),
|
|
260
|
+
classes: import_zod.z.array(import_zod.z.string()),
|
|
261
|
+
changed: import_zod.z.boolean(),
|
|
262
|
+
rsc: import_zod.z.object({
|
|
263
|
+
isServer: import_zod.z.boolean(),
|
|
264
|
+
needsClientDirective: import_zod.z.boolean(),
|
|
265
|
+
clientReasons: import_zod.z.array(import_zod.z.string())
|
|
287
266
|
}).optional()
|
|
288
267
|
});
|
|
289
|
-
NativeCssCompileResultSchema =
|
|
290
|
-
css:
|
|
291
|
-
resolvedClasses:
|
|
292
|
-
unresolvedClasses:
|
|
268
|
+
NativeCssCompileResultSchema = import_zod.z.object({
|
|
269
|
+
css: import_zod.z.string(),
|
|
270
|
+
resolvedClasses: import_zod.z.array(import_zod.z.string()),
|
|
271
|
+
unresolvedClasses: import_zod.z.array(import_zod.z.string()).optional()
|
|
293
272
|
});
|
|
294
|
-
|
|
295
|
-
type:
|
|
296
|
-
path:
|
|
273
|
+
NativeWatchEventSchema = import_zod.z.object({
|
|
274
|
+
type: import_zod.z.enum(["change", "unlink", "create"]),
|
|
275
|
+
path: import_zod.z.string()
|
|
297
276
|
});
|
|
298
|
-
NativeWatchResultSchema =
|
|
299
|
-
status:
|
|
300
|
-
handleId:
|
|
301
|
-
error:
|
|
277
|
+
NativeWatchResultSchema = import_zod.z.object({
|
|
278
|
+
status: import_zod.z.enum(["ok", "error"]),
|
|
279
|
+
handleId: import_zod.z.string().optional(),
|
|
280
|
+
error: import_zod.z.string().optional()
|
|
302
281
|
});
|
|
303
|
-
NativeCacheEntrySchema =
|
|
304
|
-
file:
|
|
305
|
-
hash:
|
|
306
|
-
classes:
|
|
307
|
-
timestamp:
|
|
308
|
-
size:
|
|
282
|
+
NativeCacheEntrySchema = import_zod.z.object({
|
|
283
|
+
file: import_zod.z.string(),
|
|
284
|
+
hash: import_zod.z.string(),
|
|
285
|
+
classes: import_zod.z.array(import_zod.z.string()),
|
|
286
|
+
timestamp: import_zod.z.number(),
|
|
287
|
+
size: import_zod.z.number().optional()
|
|
309
288
|
});
|
|
310
|
-
NativeCacheReadResultSchema =
|
|
311
|
-
entries:
|
|
312
|
-
version:
|
|
289
|
+
NativeCacheReadResultSchema = import_zod.z.object({
|
|
290
|
+
entries: import_zod.z.array(NativeCacheEntrySchema),
|
|
291
|
+
version: import_zod.z.string().optional()
|
|
313
292
|
});
|
|
314
293
|
}
|
|
315
294
|
});
|
|
@@ -319,7 +298,7 @@ function getNodeModuleRef() {
|
|
|
319
298
|
if (isBrowser) return null;
|
|
320
299
|
if (nodeModuleRef !== null) return nodeModuleRef;
|
|
321
300
|
try {
|
|
322
|
-
const test = typeof
|
|
301
|
+
const test = typeof require === "function" ? require("module") : null;
|
|
323
302
|
nodeModuleRef = test;
|
|
324
303
|
return test;
|
|
325
304
|
} catch {
|
|
@@ -327,48 +306,78 @@ function getNodeModuleRef() {
|
|
|
327
306
|
return null;
|
|
328
307
|
}
|
|
329
308
|
}
|
|
309
|
+
function getCurrentFileUrl() {
|
|
310
|
+
if (__importMetaUrl) {
|
|
311
|
+
return __importMetaUrl;
|
|
312
|
+
}
|
|
313
|
+
if (typeof __filename !== "undefined") {
|
|
314
|
+
return `file://${__filename.replace(/\\/g, "/")}`;
|
|
315
|
+
}
|
|
316
|
+
return "file://unknown";
|
|
317
|
+
}
|
|
330
318
|
function getNodePath() {
|
|
331
319
|
if (isBrowser) throw new Error("node:path not available in browser");
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
320
|
+
if (!_nodePath) {
|
|
321
|
+
if (typeof require === "function") {
|
|
322
|
+
_nodePath = require("path");
|
|
323
|
+
} else {
|
|
324
|
+
const nodeRequire = getNodeModuleRef();
|
|
325
|
+
if (!nodeRequire) throw new Error("require not available");
|
|
326
|
+
_nodePath = nodeRequire.createRequire(getCurrentFileUrl())("node:path");
|
|
327
|
+
}
|
|
328
|
+
}
|
|
335
329
|
return _nodePath;
|
|
336
330
|
}
|
|
337
331
|
function getNodeUrl() {
|
|
338
332
|
if (isBrowser) throw new Error("node:url not available in browser");
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
333
|
+
if (!_nodeUrl) {
|
|
334
|
+
if (typeof require === "function") {
|
|
335
|
+
_nodeUrl = require("url");
|
|
336
|
+
} else {
|
|
337
|
+
const nodeRequire = getNodeModuleRef();
|
|
338
|
+
if (!nodeRequire) throw new Error("require not available");
|
|
339
|
+
_nodeUrl = nodeRequire.createRequire(getCurrentFileUrl())("node:url");
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
342
|
return _nodeUrl;
|
|
343
343
|
}
|
|
344
344
|
function getNodeFs() {
|
|
345
345
|
if (isBrowser) throw new Error("node:fs not available in browser");
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
346
|
+
if (!_nodeFs) {
|
|
347
|
+
if (typeof require === "function") {
|
|
348
|
+
_nodeFs = require("fs");
|
|
349
|
+
} else {
|
|
350
|
+
const nodeRequire = getNodeModuleRef();
|
|
351
|
+
if (!nodeRequire) throw new Error("require not available");
|
|
352
|
+
_nodeFs = nodeRequire.createRequire(getCurrentFileUrl())("node:fs");
|
|
353
|
+
}
|
|
354
|
+
}
|
|
349
355
|
return _nodeFs;
|
|
350
356
|
}
|
|
351
357
|
function createEsmRequire(importMetaUrl) {
|
|
352
358
|
if (isBrowser) throw new Error("require not available in browser");
|
|
359
|
+
if (typeof require === "function") return require;
|
|
353
360
|
const nodeRequire = getNodeModuleRef();
|
|
354
361
|
if (!nodeRequire) throw new Error("require not available");
|
|
355
362
|
return nodeRequire.createRequire(importMetaUrl);
|
|
356
363
|
}
|
|
357
364
|
function getDirname(importMetaUrl) {
|
|
358
365
|
if (isBrowser) return "";
|
|
366
|
+
if (typeof __dirname !== "undefined") return __dirname;
|
|
359
367
|
const nodePath = getNodePath();
|
|
360
368
|
const nodeUrl = getNodeUrl();
|
|
361
369
|
return nodePath.dirname(nodeUrl.fileURLToPath(importMetaUrl));
|
|
362
370
|
}
|
|
363
371
|
function getFilename(importMetaUrl) {
|
|
364
372
|
if (isBrowser) return "";
|
|
373
|
+
if (typeof __filename !== "undefined") return __filename;
|
|
365
374
|
return getNodeUrl().fileURLToPath(importMetaUrl);
|
|
366
375
|
}
|
|
367
376
|
function resolveFromRoot(...segments) {
|
|
368
377
|
if (isBrowser) return segments.join("/");
|
|
369
378
|
const nodePath = getNodePath();
|
|
370
379
|
const nodeFs = getNodeFs();
|
|
371
|
-
let dir =
|
|
380
|
+
let dir = typeof __dirname !== "undefined" ? __dirname : getDirname(getCurrentFileUrl());
|
|
372
381
|
for (let i = 0; i < 10; i++) {
|
|
373
382
|
const pkgPath = nodePath.join(dir, "package.json");
|
|
374
383
|
try {
|
|
@@ -397,6 +406,7 @@ function resolveNativeNodePath(importMetaUrl, ...relativeSegments) {
|
|
|
397
406
|
var isBrowser, nodeModuleRef, _nodePath, _nodeUrl, _nodeFs;
|
|
398
407
|
var init_esmHelpers = __esm({
|
|
399
408
|
"packages/domain/shared/src/esmHelpers.ts"() {
|
|
409
|
+
"use strict";
|
|
400
410
|
isBrowser = typeof window !== "undefined" || typeof document !== "undefined";
|
|
401
411
|
nodeModuleRef = null;
|
|
402
412
|
_nodePath = null;
|
|
@@ -447,6 +457,7 @@ function createBuildTimer() {
|
|
|
447
457
|
var RING_BUFFER_SIZE, TelemetryCollector, _globalCollector;
|
|
448
458
|
var init_telemetry = __esm({
|
|
449
459
|
"packages/domain/shared/src/telemetry.ts"() {
|
|
460
|
+
"use strict";
|
|
450
461
|
RING_BUFFER_SIZE = 100;
|
|
451
462
|
TelemetryCollector = class {
|
|
452
463
|
data = [];
|
|
@@ -513,6 +524,8 @@ var init_telemetry = __esm({
|
|
|
513
524
|
_globalCollector = null;
|
|
514
525
|
}
|
|
515
526
|
});
|
|
527
|
+
|
|
528
|
+
// packages/domain/shared/src/configSchemas.ts
|
|
516
529
|
function parseJsonWithSchema(jsonString, schema, sourceName) {
|
|
517
530
|
let parsed;
|
|
518
531
|
try {
|
|
@@ -531,8 +544,8 @@ ${issues}`);
|
|
|
531
544
|
return result.data;
|
|
532
545
|
}
|
|
533
546
|
function parseJsonFileWithSchema(filePath, schema) {
|
|
534
|
-
const { readFileSync } =
|
|
535
|
-
const { basename } =
|
|
547
|
+
const { readFileSync } = require("fs");
|
|
548
|
+
const { basename } = require("path");
|
|
536
549
|
let content;
|
|
537
550
|
try {
|
|
538
551
|
content = readFileSync(filePath, "utf-8");
|
|
@@ -543,70 +556,72 @@ function parseJsonFileWithSchema(filePath, schema) {
|
|
|
543
556
|
}
|
|
544
557
|
return parseJsonWithSchema(content, schema, basename(filePath));
|
|
545
558
|
}
|
|
546
|
-
var ScanCacheClassEntrySchema, ScanCacheSchema, TailwindContentItemSchema, TailwindConfigSchema, RegistryPluginEntrySchema, RegistryFileSchema, PackageJsonSchema;
|
|
559
|
+
var import_zod2, ScanCacheClassEntrySchema, ScanCacheSchema, TailwindContentItemSchema, TailwindConfigSchema, RegistryPluginEntrySchema, RegistryFileSchema, PackageJsonSchema;
|
|
547
560
|
var init_configSchemas = __esm({
|
|
548
561
|
"packages/domain/shared/src/configSchemas.ts"() {
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
562
|
+
"use strict";
|
|
563
|
+
import_zod2 = require("zod");
|
|
564
|
+
ScanCacheClassEntrySchema = import_zod2.z.object({
|
|
565
|
+
name: import_zod2.z.string().min(1),
|
|
566
|
+
usedIn: import_zod2.z.array(import_zod2.z.string()),
|
|
567
|
+
risk: import_zod2.z.enum(["low", "medium", "high"]).default("low"),
|
|
568
|
+
bundleContribution: import_zod2.z.number().nonnegative().default(0),
|
|
569
|
+
variants: import_zod2.z.array(import_zod2.z.string()).default([])
|
|
555
570
|
});
|
|
556
|
-
ScanCacheSchema =
|
|
557
|
-
version:
|
|
558
|
-
generatedAt:
|
|
559
|
-
root:
|
|
560
|
-
classNames:
|
|
561
|
-
totalFiles:
|
|
562
|
-
uniqueCount:
|
|
571
|
+
ScanCacheSchema = import_zod2.z.object({
|
|
572
|
+
version: import_zod2.z.string().default("1"),
|
|
573
|
+
generatedAt: import_zod2.z.string(),
|
|
574
|
+
root: import_zod2.z.string(),
|
|
575
|
+
classNames: import_zod2.z.array(ScanCacheClassEntrySchema),
|
|
576
|
+
totalFiles: import_zod2.z.number().int().nonnegative(),
|
|
577
|
+
uniqueCount: import_zod2.z.number().int().nonnegative()
|
|
563
578
|
});
|
|
564
|
-
TailwindContentItemSchema =
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
raw:
|
|
568
|
-
extension:
|
|
579
|
+
TailwindContentItemSchema = import_zod2.z.union([
|
|
580
|
+
import_zod2.z.string(),
|
|
581
|
+
import_zod2.z.object({
|
|
582
|
+
raw: import_zod2.z.string(),
|
|
583
|
+
extension: import_zod2.z.string().optional()
|
|
569
584
|
}),
|
|
570
|
-
|
|
571
|
-
files:
|
|
572
|
-
transform:
|
|
585
|
+
import_zod2.z.object({
|
|
586
|
+
files: import_zod2.z.array(import_zod2.z.string()),
|
|
587
|
+
transform: import_zod2.z.record(import_zod2.z.string(), import_zod2.z.unknown()).optional()
|
|
573
588
|
})
|
|
574
589
|
]);
|
|
575
|
-
TailwindConfigSchema =
|
|
576
|
-
content:
|
|
577
|
-
theme:
|
|
578
|
-
plugins:
|
|
579
|
-
darkMode:
|
|
580
|
-
prefix:
|
|
581
|
-
safelist:
|
|
582
|
-
blocklist:
|
|
590
|
+
TailwindConfigSchema = import_zod2.z.object({
|
|
591
|
+
content: import_zod2.z.array(TailwindContentItemSchema).optional(),
|
|
592
|
+
theme: import_zod2.z.record(import_zod2.z.string(), import_zod2.z.unknown()).optional(),
|
|
593
|
+
plugins: import_zod2.z.array(import_zod2.z.unknown()).optional(),
|
|
594
|
+
darkMode: import_zod2.z.union([import_zod2.z.literal("class"), import_zod2.z.literal("media"), import_zod2.z.literal(false)]).optional(),
|
|
595
|
+
prefix: import_zod2.z.string().optional(),
|
|
596
|
+
safelist: import_zod2.z.array(import_zod2.z.union([import_zod2.z.string(), import_zod2.z.object({ pattern: import_zod2.z.instanceof(RegExp) })])).optional(),
|
|
597
|
+
blocklist: import_zod2.z.array(import_zod2.z.string()).optional()
|
|
583
598
|
}).passthrough();
|
|
584
|
-
RegistryPluginEntrySchema =
|
|
585
|
-
name:
|
|
586
|
-
description:
|
|
587
|
-
version:
|
|
588
|
-
tags:
|
|
589
|
-
official:
|
|
590
|
-
docs:
|
|
591
|
-
install:
|
|
592
|
-
integrity:
|
|
599
|
+
RegistryPluginEntrySchema = import_zod2.z.object({
|
|
600
|
+
name: import_zod2.z.string().min(1),
|
|
601
|
+
description: import_zod2.z.string(),
|
|
602
|
+
version: import_zod2.z.string(),
|
|
603
|
+
tags: import_zod2.z.array(import_zod2.z.string()).default([]),
|
|
604
|
+
official: import_zod2.z.boolean().default(false),
|
|
605
|
+
docs: import_zod2.z.string().url().optional(),
|
|
606
|
+
install: import_zod2.z.string().optional(),
|
|
607
|
+
integrity: import_zod2.z.string().optional()
|
|
593
608
|
});
|
|
594
|
-
RegistryFileSchema =
|
|
595
|
-
version:
|
|
596
|
-
official:
|
|
597
|
-
community:
|
|
609
|
+
RegistryFileSchema = import_zod2.z.object({
|
|
610
|
+
version: import_zod2.z.string(),
|
|
611
|
+
official: import_zod2.z.array(RegistryPluginEntrySchema).default([]),
|
|
612
|
+
community: import_zod2.z.array(RegistryPluginEntrySchema).default([])
|
|
598
613
|
});
|
|
599
|
-
PackageJsonSchema =
|
|
600
|
-
name:
|
|
601
|
-
version:
|
|
602
|
-
scripts:
|
|
603
|
-
dependencies:
|
|
604
|
-
devDependencies:
|
|
605
|
-
peerDependencies:
|
|
606
|
-
main:
|
|
607
|
-
module:
|
|
608
|
-
exports:
|
|
609
|
-
type:
|
|
614
|
+
PackageJsonSchema = import_zod2.z.object({
|
|
615
|
+
name: import_zod2.z.string(),
|
|
616
|
+
version: import_zod2.z.string(),
|
|
617
|
+
scripts: import_zod2.z.record(import_zod2.z.string(), import_zod2.z.string()).optional(),
|
|
618
|
+
dependencies: import_zod2.z.record(import_zod2.z.string(), import_zod2.z.string()).optional(),
|
|
619
|
+
devDependencies: import_zod2.z.record(import_zod2.z.string(), import_zod2.z.string()).optional(),
|
|
620
|
+
peerDependencies: import_zod2.z.record(import_zod2.z.string(), import_zod2.z.string()).optional(),
|
|
621
|
+
main: import_zod2.z.string().optional(),
|
|
622
|
+
module: import_zod2.z.string().optional(),
|
|
623
|
+
exports: import_zod2.z.unknown().optional(),
|
|
624
|
+
type: import_zod2.z.enum(["module", "commonjs"]).optional()
|
|
610
625
|
}).passthrough();
|
|
611
626
|
}
|
|
612
627
|
});
|
|
@@ -616,8 +631,8 @@ function getDirnameFromUrl(importMetaUrl) {
|
|
|
616
631
|
if (!importMetaUrl) return "";
|
|
617
632
|
if (isBrowser2) return "";
|
|
618
633
|
try {
|
|
619
|
-
const nodeUrl =
|
|
620
|
-
const nodePath =
|
|
634
|
+
const nodeUrl = require(NODE_URL);
|
|
635
|
+
const nodePath = require(NODE_PATH);
|
|
621
636
|
return nodePath.dirname(nodeUrl.fileURLToPath(importMetaUrl));
|
|
622
637
|
} catch {
|
|
623
638
|
if (importMetaUrl.startsWith("file://")) {
|
|
@@ -631,7 +646,7 @@ function getDirnameFromUrl(importMetaUrl) {
|
|
|
631
646
|
function resolvePath(...segments) {
|
|
632
647
|
if (isBrowser2) return segments.join("/").replace(/\/+/g, "/");
|
|
633
648
|
try {
|
|
634
|
-
const nodePath =
|
|
649
|
+
const nodePath = require(NODE_PATH);
|
|
635
650
|
return nodePath.resolve(...segments);
|
|
636
651
|
} catch {
|
|
637
652
|
return segments.join("/").replace(/\/+/g, "/");
|
|
@@ -640,7 +655,7 @@ function resolvePath(...segments) {
|
|
|
640
655
|
function existsSync(path16) {
|
|
641
656
|
if (isBrowser2) return false;
|
|
642
657
|
try {
|
|
643
|
-
const nodeFs =
|
|
658
|
+
const nodeFs = require(NODE_FS);
|
|
644
659
|
return nodeFs.existsSync(path16);
|
|
645
660
|
} catch {
|
|
646
661
|
return false;
|
|
@@ -694,6 +709,7 @@ function resolveLoaderPath(loaderBasename, importMetaUrl) {
|
|
|
694
709
|
var isBrowser2, NODE_URL, NODE_FS, NODE_PATH;
|
|
695
710
|
var init_workerResolver = __esm({
|
|
696
711
|
"packages/domain/shared/src/workerResolver.ts"() {
|
|
712
|
+
"use strict";
|
|
697
713
|
isBrowser2 = typeof window !== "undefined" || typeof document !== "undefined";
|
|
698
714
|
NODE_URL = typeof window === "undefined" || typeof document === "undefined" ? "node:url" : null;
|
|
699
715
|
NODE_FS = typeof window === "undefined" || typeof document === "undefined" ? "node:fs" : null;
|
|
@@ -843,13 +859,13 @@ function generateClassRenameCodemod(renames, opts = {}) {
|
|
|
843
859
|
}
|
|
844
860
|
return lines.join("\n");
|
|
845
861
|
}
|
|
846
|
-
function generateBarrelFile(
|
|
862
|
+
function generateBarrelFile(exports2, dir, opts = {}) {
|
|
847
863
|
const { includeTypes = true } = opts;
|
|
848
864
|
const lines = [];
|
|
849
865
|
lines.push(`// Auto-generated barrel file for ${dir}`);
|
|
850
866
|
lines.push(`// Run: npx tsx scripts/generate-barrel.ts to regenerate`);
|
|
851
867
|
lines.push(``);
|
|
852
|
-
for (const name of
|
|
868
|
+
for (const name of exports2) {
|
|
853
869
|
lines.push(`export { default as ${name}, type ${name}Props } from "./${name}"`);
|
|
854
870
|
if (includeTypes) {
|
|
855
871
|
lines.push(`export type * from "./${name}"`);
|
|
@@ -859,8 +875,11 @@ function generateBarrelFile(exports$1, dir, opts = {}) {
|
|
|
859
875
|
}
|
|
860
876
|
var init_codegen = __esm({
|
|
861
877
|
"packages/domain/shared/src/codegen.ts"() {
|
|
878
|
+
"use strict";
|
|
862
879
|
}
|
|
863
880
|
});
|
|
881
|
+
|
|
882
|
+
// packages/domain/shared/src/native-resolution.ts
|
|
864
883
|
function platformKey() {
|
|
865
884
|
if (isBrowser3) return "browser";
|
|
866
885
|
return `${process.platform}-${process.arch}`;
|
|
@@ -876,7 +895,7 @@ function resolveNativeBinary(runtimeDir) {
|
|
|
876
895
|
}
|
|
877
896
|
const envPath = process.env.TW_NATIVE_PATH?.trim();
|
|
878
897
|
if (envPath) {
|
|
879
|
-
if (
|
|
898
|
+
if (fs.existsSync(envPath)) {
|
|
880
899
|
return { path: envPath, source: "env", platform, tried };
|
|
881
900
|
}
|
|
882
901
|
tried.push(`env:${envPath} (not found)`);
|
|
@@ -885,7 +904,7 @@ function resolveNativeBinary(runtimeDir) {
|
|
|
885
904
|
for (const pkg of prebuiltPkgs) {
|
|
886
905
|
try {
|
|
887
906
|
const candidate = _require.resolve(`${pkg}/tailwind_styled_parser.node`);
|
|
888
|
-
if (
|
|
907
|
+
if (fs.existsSync(candidate)) {
|
|
889
908
|
return { path: candidate, source: "prebuilt", platform, tried };
|
|
890
909
|
}
|
|
891
910
|
tried.push(`prebuilt:${pkg} (resolved but missing)`);
|
|
@@ -896,13 +915,13 @@ function resolveNativeBinary(runtimeDir) {
|
|
|
896
915
|
const napiPlatform = platform === "linux-x64" ? "linux-x64-gnu" : platform === "linux-arm64" ? "linux-arm64-gnu" : platform;
|
|
897
916
|
const BINARY_NAMES_SELF = ["tailwind-styled-native", "tailwind_styled_parser"];
|
|
898
917
|
if (runtimeDir) {
|
|
899
|
-
for (const depth of ["..",
|
|
900
|
-
const pkgRoot =
|
|
918
|
+
for (const depth of ["..", path.join("..", ".."), path.join("..", "..", "..")]) {
|
|
919
|
+
const pkgRoot = path.resolve(runtimeDir, depth);
|
|
901
920
|
for (const bin of BINARY_NAMES_SELF) {
|
|
902
921
|
for (const suffix of ["", `.${platform}`, `.${napiPlatform}`]) {
|
|
903
|
-
const candidate =
|
|
922
|
+
const candidate = path.resolve(pkgRoot, "native", `${bin}${suffix}.node`);
|
|
904
923
|
tried.push(`self-bundled:${candidate}`);
|
|
905
|
-
if (
|
|
924
|
+
if (fs.existsSync(candidate)) {
|
|
906
925
|
return { path: candidate, source: "prebuilt", platform, tried };
|
|
907
926
|
}
|
|
908
927
|
}
|
|
@@ -914,29 +933,29 @@ function resolveNativeBinary(runtimeDir) {
|
|
|
914
933
|
const BINARY_NAMES = ["tailwind-styled-native", "tailwind_styled_parser"];
|
|
915
934
|
const localCandidates = [];
|
|
916
935
|
for (const bin of BINARY_NAMES) {
|
|
917
|
-
localCandidates.push(
|
|
918
|
-
localCandidates.push(
|
|
919
|
-
localCandidates.push(
|
|
920
|
-
localCandidates.push(
|
|
936
|
+
localCandidates.push(path.resolve(base, `${bin}.node`));
|
|
937
|
+
localCandidates.push(path.resolve(base, "..", `${bin}.node`));
|
|
938
|
+
localCandidates.push(path.resolve(base, `${bin}.${platform}.node`));
|
|
939
|
+
localCandidates.push(path.resolve(base, `${bin}.${napiPlatform}.node`));
|
|
921
940
|
}
|
|
922
941
|
for (const startDir of [cwd, base]) {
|
|
923
942
|
let dir = startDir;
|
|
924
943
|
for (let i = 0; i < 6; i++) {
|
|
925
|
-
const nativeDir =
|
|
944
|
+
const nativeDir = path.resolve(dir, "native");
|
|
926
945
|
for (const bin of BINARY_NAMES) {
|
|
927
|
-
localCandidates.push(
|
|
928
|
-
localCandidates.push(
|
|
929
|
-
localCandidates.push(
|
|
930
|
-
localCandidates.push(
|
|
946
|
+
localCandidates.push(path.resolve(nativeDir, `${bin}.node`));
|
|
947
|
+
localCandidates.push(path.resolve(nativeDir, `${bin}.${platform}.node`));
|
|
948
|
+
localCandidates.push(path.resolve(nativeDir, `${bin}.${napiPlatform}.node`));
|
|
949
|
+
localCandidates.push(path.resolve(nativeDir, "target", "release", `${bin}.node`));
|
|
931
950
|
}
|
|
932
|
-
const parent =
|
|
951
|
+
const parent = path.resolve(dir, "..");
|
|
933
952
|
if (parent === dir) break;
|
|
934
953
|
dir = parent;
|
|
935
954
|
}
|
|
936
955
|
}
|
|
937
956
|
for (const candidate of localCandidates) {
|
|
938
957
|
tried.push(`local:${candidate}`);
|
|
939
|
-
if (
|
|
958
|
+
if (fs.existsSync(candidate)) {
|
|
940
959
|
return { path: candidate, source: "local", platform, tried };
|
|
941
960
|
}
|
|
942
961
|
}
|
|
@@ -956,11 +975,17 @@ function formatNativeNotFoundError(result) {
|
|
|
956
975
|
];
|
|
957
976
|
return lines.join("\n");
|
|
958
977
|
}
|
|
959
|
-
var isBrowser3, _require, PLATFORM_MAP;
|
|
978
|
+
var import_node_module, fs, path, isBrowser3, _require, PLATFORM_MAP;
|
|
960
979
|
var init_native_resolution = __esm({
|
|
961
980
|
"packages/domain/shared/src/native-resolution.ts"() {
|
|
981
|
+
"use strict";
|
|
982
|
+
import_node_module = require("module");
|
|
983
|
+
fs = __toESM(require("fs"));
|
|
984
|
+
path = __toESM(require("path"));
|
|
962
985
|
isBrowser3 = typeof window !== "undefined" || typeof document !== "undefined";
|
|
963
|
-
_require =
|
|
986
|
+
_require = (0, import_node_module.createRequire)(
|
|
987
|
+
typeof require !== "undefined" ? typeof __filename !== "undefined" ? `file://${__filename}` : "file://unknown" : __importMetaUrl
|
|
988
|
+
);
|
|
964
989
|
PLATFORM_MAP = {
|
|
965
990
|
"linux-x64": ["@tailwind-styled/native-linux-x64-gnu", "@tailwind-styled/native-linux-x64"],
|
|
966
991
|
"linux-arm64": ["@tailwind-styled/native-linux-arm64-gnu", "@tailwind-styled/native-linux-arm64"],
|
|
@@ -1006,6 +1031,7 @@ function createObservabilityClient(opts = {}) {
|
|
|
1006
1031
|
}
|
|
1007
1032
|
var init_observability = __esm({
|
|
1008
1033
|
"packages/domain/shared/src/observability.ts"() {
|
|
1034
|
+
"use strict";
|
|
1009
1035
|
}
|
|
1010
1036
|
});
|
|
1011
1037
|
|
|
@@ -1044,6 +1070,7 @@ function resetCacheStats() {
|
|
|
1044
1070
|
}
|
|
1045
1071
|
var init_cssGeneratorNative = __esm({
|
|
1046
1072
|
"packages/domain/compiler/src/compiler/cssGeneratorNative.ts"() {
|
|
1073
|
+
"use strict";
|
|
1047
1074
|
init_nativeBridge();
|
|
1048
1075
|
}
|
|
1049
1076
|
});
|
|
@@ -1187,9 +1214,12 @@ function twMergeRaw(classLists) {
|
|
|
1187
1214
|
}
|
|
1188
1215
|
var init_cssCompilationNative = __esm({
|
|
1189
1216
|
"packages/domain/compiler/src/compiler/cssCompilationNative.ts"() {
|
|
1217
|
+
"use strict";
|
|
1190
1218
|
init_nativeBridge();
|
|
1191
1219
|
}
|
|
1192
1220
|
});
|
|
1221
|
+
|
|
1222
|
+
// packages/domain/compiler/src/tailwindEngine.ts
|
|
1193
1223
|
function loadTailwindEngine() {
|
|
1194
1224
|
if (_twEngine) return _twEngine;
|
|
1195
1225
|
if (_twEngineError) throw _twEngineError;
|
|
@@ -1209,10 +1239,10 @@ async function generateRawCss(classes, cssEntryContent, root) {
|
|
|
1209
1239
|
if (classes.length === 0) return "";
|
|
1210
1240
|
const tw = loadTailwindEngine();
|
|
1211
1241
|
const input = cssEntryContent ?? "@import 'tailwindcss';";
|
|
1212
|
-
const { readFileSync, existsSync: existsSync3 } = await import(
|
|
1213
|
-
const { dirname, resolve: resolve2 } = await import(
|
|
1242
|
+
const { readFileSync, existsSync: existsSync3 } = await import("fs");
|
|
1243
|
+
const { dirname, resolve: resolve2 } = await import("path");
|
|
1214
1244
|
const projectRoot = root ?? process.cwd();
|
|
1215
|
-
const req =
|
|
1245
|
+
const req = (0, import_node_module2.createRequire)(resolve2(projectRoot, "package.json"));
|
|
1216
1246
|
const loadStylesheet = async (id, base) => {
|
|
1217
1247
|
try {
|
|
1218
1248
|
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;
|
|
@@ -1232,10 +1262,16 @@ async function generateRawCss(classes, cssEntryContent, root) {
|
|
|
1232
1262
|
const compiler = await Promise.resolve(tw.compile(input, { loadStylesheet }));
|
|
1233
1263
|
return compiler.build(classes);
|
|
1234
1264
|
}
|
|
1235
|
-
var require2, _twEngine, _twEngineError;
|
|
1265
|
+
var import_node_module2, import_meta, require2, MAX_CACHE_MEMORY, _twEngine, _twEngineError;
|
|
1236
1266
|
var init_tailwindEngine = __esm({
|
|
1237
1267
|
"packages/domain/compiler/src/tailwindEngine.ts"() {
|
|
1238
|
-
|
|
1268
|
+
"use strict";
|
|
1269
|
+
import_node_module2 = require("module");
|
|
1270
|
+
import_meta = {};
|
|
1271
|
+
require2 = (0, import_node_module2.createRequire)(
|
|
1272
|
+
typeof __filename !== "undefined" ? `file://${__filename}` : typeof import_meta !== "undefined" && __importMetaUrl ? __importMetaUrl : "file://unknown"
|
|
1273
|
+
);
|
|
1274
|
+
MAX_CACHE_MEMORY = 256 * 1024;
|
|
1239
1275
|
_twEngine = null;
|
|
1240
1276
|
_twEngineError = null;
|
|
1241
1277
|
}
|
|
@@ -1416,18 +1452,24 @@ function processTailwindCssWithTargets(css, targets) {
|
|
|
1416
1452
|
}
|
|
1417
1453
|
return result.css;
|
|
1418
1454
|
}
|
|
1419
|
-
var _cssCache, _cacheHits, _cacheMisses, MAX_CACHE_SIZE;
|
|
1455
|
+
var import_node_module3, import_meta2, require3, _cssCache, _cacheHits, _cacheMisses, MAX_CACHE_SIZE, MAX_CACHE_MEMORY2;
|
|
1420
1456
|
var init_tailwindEngine2 = __esm({
|
|
1421
1457
|
"packages/domain/compiler/src/compiler/tailwindEngine.ts"() {
|
|
1458
|
+
"use strict";
|
|
1459
|
+
import_node_module3 = require("module");
|
|
1422
1460
|
init_nativeBridge();
|
|
1423
1461
|
init_cssGeneratorNative();
|
|
1424
1462
|
init_cssCompilationNative();
|
|
1425
1463
|
init_tailwindEngine();
|
|
1426
|
-
|
|
1464
|
+
import_meta2 = {};
|
|
1465
|
+
require3 = (0, import_node_module3.createRequire)(
|
|
1466
|
+
typeof __filename !== "undefined" ? `file://${__filename}` : typeof import_meta2 !== "undefined" && __importMetaUrl ? __importMetaUrl : "file://unknown"
|
|
1467
|
+
);
|
|
1427
1468
|
_cssCache = /* @__PURE__ */ new Map();
|
|
1428
1469
|
_cacheHits = 0;
|
|
1429
1470
|
_cacheMisses = 0;
|
|
1430
1471
|
MAX_CACHE_SIZE = 100;
|
|
1472
|
+
MAX_CACHE_MEMORY2 = 256 * 1024;
|
|
1431
1473
|
}
|
|
1432
1474
|
});
|
|
1433
1475
|
|
|
@@ -1499,6 +1541,7 @@ function atomicRegistrySize() {
|
|
|
1499
1541
|
}
|
|
1500
1542
|
var init_compilationNative = __esm({
|
|
1501
1543
|
"packages/domain/compiler/src/compiler/compilationNative.ts"() {
|
|
1544
|
+
"use strict";
|
|
1502
1545
|
init_nativeBridge();
|
|
1503
1546
|
}
|
|
1504
1547
|
});
|
|
@@ -1598,6 +1641,7 @@ function idRegistryImport(importedData) {
|
|
|
1598
1641
|
}
|
|
1599
1642
|
var init_idRegistryNative = __esm({
|
|
1600
1643
|
"packages/domain/compiler/src/compiler/idRegistryNative.ts"() {
|
|
1644
|
+
"use strict";
|
|
1601
1645
|
init_nativeBridge();
|
|
1602
1646
|
}
|
|
1603
1647
|
});
|
|
@@ -1739,6 +1783,7 @@ function scanFilesBatchNative(filesJson) {
|
|
|
1739
1783
|
}
|
|
1740
1784
|
var init_streamingNative = __esm({
|
|
1741
1785
|
"packages/domain/compiler/src/compiler/streamingNative.ts"() {
|
|
1786
|
+
"use strict";
|
|
1742
1787
|
init_nativeBridge();
|
|
1743
1788
|
}
|
|
1744
1789
|
});
|
|
@@ -1746,6 +1791,7 @@ var init_streamingNative = __esm({
|
|
|
1746
1791
|
// packages/domain/compiler/src/compiler/index.ts
|
|
1747
1792
|
var init_compiler = __esm({
|
|
1748
1793
|
"packages/domain/compiler/src/compiler/index.ts"() {
|
|
1794
|
+
"use strict";
|
|
1749
1795
|
init_cssGeneratorNative();
|
|
1750
1796
|
init_compilationNative();
|
|
1751
1797
|
init_cssCompilationNative();
|
|
@@ -1758,6 +1804,7 @@ var init_compiler = __esm({
|
|
|
1758
1804
|
var parseClasses, parseClass, extractAllClasses, extractClassesFromSource, astExtractClasses, normalizeClasses, mergeClassesStatic, normalizeAndDedupClasses, extractComponentUsage, batchExtractClasses, checkAgainstSafelist, diffClassLists;
|
|
1759
1805
|
var init_parser = __esm({
|
|
1760
1806
|
"packages/domain/compiler/src/parser/index.ts"() {
|
|
1807
|
+
"use strict";
|
|
1761
1808
|
init_nativeBridge();
|
|
1762
1809
|
parseClasses = (raw) => {
|
|
1763
1810
|
const native = getNativeBridge();
|
|
@@ -1936,6 +1983,7 @@ function resetMemoryStats() {
|
|
|
1936
1983
|
}
|
|
1937
1984
|
var init_analyzerNative = __esm({
|
|
1938
1985
|
"packages/domain/compiler/src/analyzer/analyzerNative.ts"() {
|
|
1986
|
+
"use strict";
|
|
1939
1987
|
init_nativeBridge();
|
|
1940
1988
|
}
|
|
1941
1989
|
});
|
|
@@ -2029,6 +2077,7 @@ function resolveSimpleVariants(configJson) {
|
|
|
2029
2077
|
}
|
|
2030
2078
|
var init_themeResolutionNative = __esm({
|
|
2031
2079
|
"packages/domain/compiler/src/analyzer/themeResolutionNative.ts"() {
|
|
2080
|
+
"use strict";
|
|
2032
2081
|
init_nativeBridge();
|
|
2033
2082
|
}
|
|
2034
2083
|
});
|
|
@@ -2076,6 +2125,7 @@ function generateSubComponentTypes(root, outputPath) {
|
|
|
2076
2125
|
}
|
|
2077
2126
|
var init_scannerNative = __esm({
|
|
2078
2127
|
"packages/domain/compiler/src/analyzer/scannerNative.ts"() {
|
|
2128
|
+
"use strict";
|
|
2079
2129
|
init_nativeBridge();
|
|
2080
2130
|
}
|
|
2081
2131
|
});
|
|
@@ -2083,6 +2133,7 @@ var init_scannerNative = __esm({
|
|
|
2083
2133
|
// packages/domain/compiler/src/analyzer/index.ts
|
|
2084
2134
|
var init_analyzer = __esm({
|
|
2085
2135
|
"packages/domain/compiler/src/analyzer/index.ts"() {
|
|
2136
|
+
"use strict";
|
|
2086
2137
|
init_analyzerNative();
|
|
2087
2138
|
init_themeResolutionNative();
|
|
2088
2139
|
init_scannerNative();
|
|
@@ -2271,6 +2322,7 @@ function resetResolverPoolStats() {
|
|
|
2271
2322
|
}
|
|
2272
2323
|
var init_cacheNative = __esm({
|
|
2273
2324
|
"packages/domain/compiler/src/cache/cacheNative.ts"() {
|
|
2325
|
+
"use strict";
|
|
2274
2326
|
init_nativeBridge();
|
|
2275
2327
|
}
|
|
2276
2328
|
});
|
|
@@ -2278,6 +2330,7 @@ var init_cacheNative = __esm({
|
|
|
2278
2330
|
// packages/domain/compiler/src/cache/index.ts
|
|
2279
2331
|
var init_cache = __esm({
|
|
2280
2332
|
"packages/domain/compiler/src/cache/index.ts"() {
|
|
2333
|
+
"use strict";
|
|
2281
2334
|
init_cacheNative();
|
|
2282
2335
|
}
|
|
2283
2336
|
});
|
|
@@ -2526,6 +2579,7 @@ function redisDiagnose() {
|
|
|
2526
2579
|
}
|
|
2527
2580
|
var init_redisNative = __esm({
|
|
2528
2581
|
"packages/domain/compiler/src/redis/redisNative.ts"() {
|
|
2582
|
+
"use strict";
|
|
2529
2583
|
init_nativeBridge();
|
|
2530
2584
|
}
|
|
2531
2585
|
});
|
|
@@ -2533,6 +2587,7 @@ var init_redisNative = __esm({
|
|
|
2533
2587
|
// packages/domain/compiler/src/redis/index.ts
|
|
2534
2588
|
var init_redis = __esm({
|
|
2535
2589
|
"packages/domain/compiler/src/redis/index.ts"() {
|
|
2590
|
+
"use strict";
|
|
2536
2591
|
init_redisNative();
|
|
2537
2592
|
}
|
|
2538
2593
|
});
|
|
@@ -2671,6 +2726,7 @@ function getCompilerDiagnostics() {
|
|
|
2671
2726
|
}
|
|
2672
2727
|
var init_watchSystemNative = __esm({
|
|
2673
2728
|
"packages/domain/compiler/src/watch/watchSystemNative.ts"() {
|
|
2729
|
+
"use strict";
|
|
2674
2730
|
init_nativeBridge();
|
|
2675
2731
|
}
|
|
2676
2732
|
});
|
|
@@ -2678,6 +2734,7 @@ var init_watchSystemNative = __esm({
|
|
|
2678
2734
|
// packages/domain/compiler/src/watch/index.ts
|
|
2679
2735
|
var init_watch = __esm({
|
|
2680
2736
|
"packages/domain/compiler/src/watch/index.ts"() {
|
|
2737
|
+
"use strict";
|
|
2681
2738
|
init_watchSystemNative();
|
|
2682
2739
|
}
|
|
2683
2740
|
});
|
|
@@ -2906,6 +2963,7 @@ __export(internal_exports, {
|
|
|
2906
2963
|
});
|
|
2907
2964
|
var init_internal = __esm({
|
|
2908
2965
|
"packages/domain/compiler/src/internal.ts"() {
|
|
2966
|
+
"use strict";
|
|
2909
2967
|
init_src2();
|
|
2910
2968
|
init_tailwindEngine2();
|
|
2911
2969
|
init_compiler();
|
|
@@ -2916,6 +2974,8 @@ var init_internal = __esm({
|
|
|
2916
2974
|
init_watch();
|
|
2917
2975
|
}
|
|
2918
2976
|
});
|
|
2977
|
+
|
|
2978
|
+
// packages/domain/shared/src/staticStateExtractor.ts
|
|
2919
2979
|
function getNative() {
|
|
2920
2980
|
if (_native) return _native;
|
|
2921
2981
|
try {
|
|
@@ -2945,17 +3005,17 @@ function getNative() {
|
|
|
2945
3005
|
function* walkSourceFiles(dir) {
|
|
2946
3006
|
let entries;
|
|
2947
3007
|
try {
|
|
2948
|
-
entries =
|
|
3008
|
+
entries = import_node_fs.default.readdirSync(dir, { withFileTypes: true });
|
|
2949
3009
|
} catch {
|
|
2950
3010
|
return;
|
|
2951
3011
|
}
|
|
2952
3012
|
for (const entry of entries) {
|
|
2953
|
-
const fullPath =
|
|
3013
|
+
const fullPath = import_node_path.default.join(dir, entry.name);
|
|
2954
3014
|
if (entry.isDirectory()) {
|
|
2955
3015
|
if (IGNORE_PATTERNS.some((p) => entry.name === p || entry.name.startsWith(p))) continue;
|
|
2956
3016
|
yield* walkSourceFiles(fullPath);
|
|
2957
3017
|
} else if (entry.isFile()) {
|
|
2958
|
-
const ext =
|
|
3018
|
+
const ext = import_node_path.default.extname(entry.name);
|
|
2959
3019
|
if (SOURCE_EXTENSIONS.has(ext)) yield fullPath;
|
|
2960
3020
|
}
|
|
2961
3021
|
}
|
|
@@ -3019,7 +3079,7 @@ function extractStaticStateCss(srcDir, options = {}) {
|
|
|
3019
3079
|
allConfigs.push(...configs);
|
|
3020
3080
|
if (verbose) {
|
|
3021
3081
|
process.stderr.write(
|
|
3022
|
-
`[tw:static-state] ${
|
|
3082
|
+
`[tw:static-state] ${import_node_path.default.relative(srcDir, filePath)}: ${configs.length} komponen
|
|
3023
3083
|
`
|
|
3024
3084
|
);
|
|
3025
3085
|
}
|
|
@@ -3030,7 +3090,7 @@ function extractStaticStateCss(srcDir, options = {}) {
|
|
|
3030
3090
|
if (filesScanned >= maxFiles) break;
|
|
3031
3091
|
let source;
|
|
3032
3092
|
try {
|
|
3033
|
-
source =
|
|
3093
|
+
source = import_node_fs.default.readFileSync(filePath, "utf-8");
|
|
3034
3094
|
} catch {
|
|
3035
3095
|
continue;
|
|
3036
3096
|
}
|
|
@@ -3043,7 +3103,7 @@ function extractStaticStateCss(srcDir, options = {}) {
|
|
|
3043
3103
|
allConfigs.push(...configs);
|
|
3044
3104
|
if (verbose) {
|
|
3045
3105
|
process.stderr.write(
|
|
3046
|
-
`[tw:static-state] ${
|
|
3106
|
+
`[tw:static-state] ${import_node_path.default.relative(srcDir, filePath)}: ${configs.length} komponen
|
|
3047
3107
|
`
|
|
3048
3108
|
);
|
|
3049
3109
|
}
|
|
@@ -3137,12 +3197,12 @@ function appendStaticStateCssToSafelist(srcDir, safelistPath, options = {}) {
|
|
|
3137
3197
|
resolvedCss: options.resolvedCss || ""
|
|
3138
3198
|
// ← ensure always passed
|
|
3139
3199
|
});
|
|
3140
|
-
const twClassesDir =
|
|
3141
|
-
|
|
3142
|
-
const stateFilePath =
|
|
3200
|
+
const twClassesDir = import_node_path.default.join(import_node_path.default.dirname(safelistPath), "tw-classes");
|
|
3201
|
+
import_node_fs.default.mkdirSync(twClassesDir, { recursive: true });
|
|
3202
|
+
const stateFilePath = import_node_path.default.join(twClassesDir, TW_STATE_STATIC_FILENAME);
|
|
3143
3203
|
if (result.rulesGenerated === 0) {
|
|
3144
3204
|
try {
|
|
3145
|
-
|
|
3205
|
+
import_node_fs.default.writeFileSync(
|
|
3146
3206
|
stateFilePath,
|
|
3147
3207
|
"/* tw-state-static.css \u2014 tidak ada state rules yang di-generate */\n",
|
|
3148
3208
|
"utf-8"
|
|
@@ -3152,7 +3212,7 @@ function appendStaticStateCssToSafelist(srcDir, safelistPath, options = {}) {
|
|
|
3152
3212
|
return `[tw:static-state] tidak ada state rules yang di-generate (${result.filesScanned} files di-scan)`;
|
|
3153
3213
|
}
|
|
3154
3214
|
try {
|
|
3155
|
-
|
|
3215
|
+
import_node_fs.default.writeFileSync(stateFilePath, result.generatedCss, "utf-8");
|
|
3156
3216
|
return [
|
|
3157
3217
|
`[tw:static-state] ${result.rulesGenerated} static state rules di-generate`,
|
|
3158
3218
|
` \u2192 ${result.filesScanned} files scanned, ${result.filesWithStates} dengan states`,
|
|
@@ -3164,15 +3224,20 @@ function appendStaticStateCssToSafelist(srcDir, safelistPath, options = {}) {
|
|
|
3164
3224
|
return `[tw:static-state] gagal tulis state CSS: ${msg}`;
|
|
3165
3225
|
}
|
|
3166
3226
|
}
|
|
3167
|
-
var SOURCE_EXTENSIONS, IGNORE_PATTERNS, _native, TW_STATE_STATIC_FILENAME;
|
|
3227
|
+
var import_node_fs, import_node_path, SOURCE_EXTENSIONS, IGNORE_PATTERNS, _native, TW_STATE_STATIC_FILENAME;
|
|
3168
3228
|
var init_staticStateExtractor = __esm({
|
|
3169
3229
|
"packages/domain/shared/src/staticStateExtractor.ts"() {
|
|
3230
|
+
"use strict";
|
|
3231
|
+
import_node_fs = __toESM(require("fs"));
|
|
3232
|
+
import_node_path = __toESM(require("path"));
|
|
3170
3233
|
SOURCE_EXTENSIONS = /* @__PURE__ */ new Set([".ts", ".tsx", ".js", ".jsx", ".mts", ".mjs"]);
|
|
3171
3234
|
IGNORE_PATTERNS = ["node_modules", ".next", "dist", "build", ".git", "coverage", "__tests__"];
|
|
3172
3235
|
_native = null;
|
|
3173
3236
|
TW_STATE_STATIC_FILENAME = "_tw-state-static.css";
|
|
3174
3237
|
}
|
|
3175
3238
|
});
|
|
3239
|
+
|
|
3240
|
+
// packages/domain/shared/src/logger.ts
|
|
3176
3241
|
function getEnvLevel() {
|
|
3177
3242
|
const env = process.env.TWS_LOG_LEVEL?.toLowerCase();
|
|
3178
3243
|
if (env && env in LEVELS) return env;
|
|
@@ -3182,8 +3247,8 @@ function setGlobalLogFile(filePath) {
|
|
|
3182
3247
|
_globalLogFile = filePath;
|
|
3183
3248
|
_logFileInitialized = false;
|
|
3184
3249
|
try {
|
|
3185
|
-
|
|
3186
|
-
|
|
3250
|
+
import_node_fs2.default.mkdirSync(import_node_path2.default.dirname(filePath), { recursive: true });
|
|
3251
|
+
import_node_fs2.default.writeFileSync(
|
|
3187
3252
|
filePath,
|
|
3188
3253
|
`# tailwind-styled build log \u2014 ${(/* @__PURE__ */ new Date()).toISOString()}
|
|
3189
3254
|
`,
|
|
@@ -3196,13 +3261,13 @@ function setGlobalLogFile(filePath) {
|
|
|
3196
3261
|
function writeToFile(line) {
|
|
3197
3262
|
if (!_globalLogFile || !_logFileInitialized) return;
|
|
3198
3263
|
try {
|
|
3199
|
-
|
|
3264
|
+
import_node_fs2.default.appendFileSync(_globalLogFile, line);
|
|
3200
3265
|
} catch {
|
|
3201
3266
|
}
|
|
3202
3267
|
}
|
|
3203
3268
|
function createLogger(prefix, level) {
|
|
3204
3269
|
const loggerState = {
|
|
3205
|
-
currentLevel: getEnvLevel(),
|
|
3270
|
+
currentLevel: level ?? getEnvLevel(),
|
|
3206
3271
|
setLevel(l) {
|
|
3207
3272
|
this.currentLevel = l;
|
|
3208
3273
|
}
|
|
@@ -3223,13 +3288,16 @@ function createLogger(prefix, level) {
|
|
|
3223
3288
|
setLogFile: (filePath) => setGlobalLogFile(filePath)
|
|
3224
3289
|
};
|
|
3225
3290
|
}
|
|
3226
|
-
var LEVELS, _globalLogFile, _logFileInitialized;
|
|
3291
|
+
var import_node_fs2, import_node_path2, LEVELS, _globalLogFile, _logFileInitialized, logger;
|
|
3227
3292
|
var init_logger = __esm({
|
|
3228
3293
|
"packages/domain/shared/src/logger.ts"() {
|
|
3294
|
+
"use strict";
|
|
3295
|
+
import_node_fs2 = __toESM(require("fs"));
|
|
3296
|
+
import_node_path2 = __toESM(require("path"));
|
|
3229
3297
|
LEVELS = { silent: 0, error: 1, warn: 2, info: 3, debug: 4 };
|
|
3230
3298
|
_globalLogFile = null;
|
|
3231
3299
|
_logFileInitialized = false;
|
|
3232
|
-
createLogger("tailwind-styled");
|
|
3300
|
+
logger = createLogger("tailwind-styled");
|
|
3233
3301
|
}
|
|
3234
3302
|
});
|
|
3235
3303
|
|
|
@@ -3350,9 +3418,9 @@ function loadNativeBinding(options) {
|
|
|
3350
3418
|
const { runtimeDir, candidates, isValid } = options;
|
|
3351
3419
|
const loadErrors = [];
|
|
3352
3420
|
for (const candidate of candidates) {
|
|
3353
|
-
const candidatePath =
|
|
3421
|
+
const candidatePath = import_node_path3.default.resolve(runtimeDir, candidate);
|
|
3354
3422
|
try {
|
|
3355
|
-
if (!
|
|
3423
|
+
if (!import_node_fs3.default.existsSync(candidatePath) && !import_node_fs3.default.existsSync(candidatePath + ".node")) {
|
|
3356
3424
|
continue;
|
|
3357
3425
|
}
|
|
3358
3426
|
const mod = requireNativeModule(candidatePath);
|
|
@@ -3384,9 +3452,9 @@ function resolveNativeBindingCandidates(options) {
|
|
|
3384
3452
|
}
|
|
3385
3453
|
}
|
|
3386
3454
|
if (!includeDefaultCandidates) return candidates;
|
|
3387
|
-
if (
|
|
3455
|
+
if (import_node_fs3.default.existsSync(runtimeDir)) {
|
|
3388
3456
|
try {
|
|
3389
|
-
for (const entry of
|
|
3457
|
+
for (const entry of import_node_fs3.default.readdirSync(runtimeDir)) {
|
|
3390
3458
|
if (entry.endsWith(".node")) candidates.push(entry);
|
|
3391
3459
|
}
|
|
3392
3460
|
} catch {
|
|
@@ -3395,28 +3463,28 @@ function resolveNativeBindingCandidates(options) {
|
|
|
3395
3463
|
const BINARY_NAMES = ["tailwind-styled-native", "tailwind_styled_parser"];
|
|
3396
3464
|
const napiPlatform = process.platform === "linux" && process.arch === "x64" ? "linux-x64-gnu" : process.platform === "linux" && process.arch === "arm64" ? "linux-arm64-gnu" : `${process.platform}-${process.arch}`;
|
|
3397
3465
|
for (const bin of BINARY_NAMES) {
|
|
3398
|
-
candidates.push(
|
|
3399
|
-
candidates.push(
|
|
3400
|
-
candidates.push(
|
|
3401
|
-
candidates.push(
|
|
3402
|
-
candidates.push(
|
|
3403
|
-
candidates.push(
|
|
3404
|
-
candidates.push(
|
|
3405
|
-
candidates.push(
|
|
3406
|
-
candidates.push(
|
|
3466
|
+
candidates.push(import_node_path3.default.resolve(runtimeDir, `${bin}.node`));
|
|
3467
|
+
candidates.push(import_node_path3.default.resolve(runtimeDir, `${bin}.${napiPlatform}.node`));
|
|
3468
|
+
candidates.push(import_node_path3.default.resolve(runtimeDir, "..", "native", `${bin}.node`));
|
|
3469
|
+
candidates.push(import_node_path3.default.resolve(runtimeDir, "..", "native", `${bin}.${napiPlatform}.node`));
|
|
3470
|
+
candidates.push(import_node_path3.default.resolve(process.cwd(), "native", `${bin}.node`));
|
|
3471
|
+
candidates.push(import_node_path3.default.resolve(process.cwd(), "native", `${bin}.${napiPlatform}.node`));
|
|
3472
|
+
candidates.push(import_node_path3.default.resolve(runtimeDir, "..", "..", "..", "..", "native", `${bin}.node`));
|
|
3473
|
+
candidates.push(import_node_path3.default.resolve(runtimeDir, "..", "..", "..", "..", "native", `${bin}.${napiPlatform}.node`));
|
|
3474
|
+
candidates.push(import_node_path3.default.resolve(runtimeDir, "..", "..", "..", "native", `${bin}.node`));
|
|
3407
3475
|
}
|
|
3408
3476
|
return Array.from(new Set(candidates));
|
|
3409
3477
|
}
|
|
3410
3478
|
function resolveRuntimeDir(dir, importMetaUrl) {
|
|
3411
|
-
if (dir) return
|
|
3479
|
+
if (dir) return import_node_path3.default.resolve(dir);
|
|
3412
3480
|
try {
|
|
3413
|
-
return
|
|
3481
|
+
return import_node_path3.default.dirname((0, import_node_url.fileURLToPath)(importMetaUrl));
|
|
3414
3482
|
} catch {
|
|
3415
3483
|
return process.cwd();
|
|
3416
3484
|
}
|
|
3417
3485
|
}
|
|
3418
3486
|
function hashContent2(content, algorithm = "md5", length) {
|
|
3419
|
-
const hash =
|
|
3487
|
+
const hash = (0, import_node_crypto.createHash)(algorithm).update(content).digest("hex");
|
|
3420
3488
|
return length ? hash.slice(0, length) : hash;
|
|
3421
3489
|
}
|
|
3422
3490
|
function formatErrorMessage(error) {
|
|
@@ -3424,9 +3492,15 @@ function formatErrorMessage(error) {
|
|
|
3424
3492
|
if (error instanceof Error) return error.message;
|
|
3425
3493
|
return String(error);
|
|
3426
3494
|
}
|
|
3427
|
-
var TwError, _require2, LRUCache;
|
|
3495
|
+
var import_node_crypto, import_node_fs3, import_node_path3, import_node_url, import_node_module4, TwError, _require2, LRUCache;
|
|
3428
3496
|
var init_src = __esm({
|
|
3429
3497
|
"packages/domain/shared/src/index.ts"() {
|
|
3498
|
+
"use strict";
|
|
3499
|
+
import_node_crypto = require("crypto");
|
|
3500
|
+
import_node_fs3 = __toESM(require("fs"));
|
|
3501
|
+
import_node_path3 = __toESM(require("path"));
|
|
3502
|
+
import_node_url = require("url");
|
|
3503
|
+
import_node_module4 = require("module");
|
|
3430
3504
|
init_trace();
|
|
3431
3505
|
init_error_codes();
|
|
3432
3506
|
init_compatibility();
|
|
@@ -3492,7 +3566,9 @@ var init_src = __esm({
|
|
|
3492
3566
|
return `[${this.source.toUpperCase()}:${this.code}] ${this.message}`;
|
|
3493
3567
|
}
|
|
3494
3568
|
};
|
|
3495
|
-
_require2 =
|
|
3569
|
+
_require2 = (0, import_node_module4.createRequire)(
|
|
3570
|
+
typeof __filename !== "undefined" ? `file://${__filename}` : __importMetaUrl ?? "file://unknown"
|
|
3571
|
+
);
|
|
3496
3572
|
LRUCache = class {
|
|
3497
3573
|
capacity;
|
|
3498
3574
|
cache;
|
|
@@ -3541,8 +3617,9 @@ var init_src = __esm({
|
|
|
3541
3617
|
var _loadNative, log, NATIVE_UNAVAILABLE_MESSAGE, nativeBridge, bridgeLoadAttempted, bridgeLoadError, isValidNativeBridge, getNativeBridge, adaptNativeResult;
|
|
3542
3618
|
var init_nativeBridge = __esm({
|
|
3543
3619
|
"packages/domain/compiler/src/nativeBridge.ts"() {
|
|
3620
|
+
"use strict";
|
|
3544
3621
|
init_src();
|
|
3545
|
-
_loadNative = (path16) =>
|
|
3622
|
+
_loadNative = (path16) => require(path16);
|
|
3546
3623
|
log = (...args) => {
|
|
3547
3624
|
if (process.env.DEBUG?.includes("compiler:native")) {
|
|
3548
3625
|
console.log("[compiler:native]", ...args);
|
|
@@ -3568,7 +3645,7 @@ var init_nativeBridge = __esm({
|
|
|
3568
3645
|
}
|
|
3569
3646
|
bridgeLoadAttempted = true;
|
|
3570
3647
|
try {
|
|
3571
|
-
const runtimeDir = resolveRuntimeDir(void 0,
|
|
3648
|
+
const runtimeDir = resolveRuntimeDir(void 0, __importMetaUrl);
|
|
3572
3649
|
const result = resolveNativeBinary(runtimeDir);
|
|
3573
3650
|
if (result.path && result.path.endsWith(".node")) {
|
|
3574
3651
|
try {
|
|
@@ -3644,6 +3721,8 @@ Tried paths: ${result.tried.join("\n")}`);
|
|
|
3644
3721
|
}
|
|
3645
3722
|
}
|
|
3646
3723
|
});
|
|
3724
|
+
|
|
3725
|
+
// packages/domain/compiler/src/index.ts
|
|
3647
3726
|
function _layoutClassesToCss(classes) {
|
|
3648
3727
|
const native = getNativeBridge();
|
|
3649
3728
|
if (!native?.layoutClassesToCss) {
|
|
@@ -3678,9 +3757,13 @@ function extractContainerCssFromSource(source) {
|
|
|
3678
3757
|
}
|
|
3679
3758
|
return rules.join("\n");
|
|
3680
3759
|
}
|
|
3681
|
-
var _require3, 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, classifyNode, detectConflicts, bucketSort, analyzeFile, analyzeVariantUsage, injectClientDirective, injectServerOnlyComment, analyzeClasses, extractTwStateConfigs, generateStaticStateCss, extractAndGenerateStateCss;
|
|
3760
|
+
var import_node_fs4, import_node_path4, import_node_module5, _require3, 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, classifyNode, detectConflicts, bucketSort, analyzeFile, analyzeVariantUsage, injectClientDirective, injectServerOnlyComment, analyzeClasses, extractTwStateConfigs, generateStaticStateCss, extractAndGenerateStateCss;
|
|
3682
3761
|
var init_src2 = __esm({
|
|
3683
3762
|
"packages/domain/compiler/src/index.ts"() {
|
|
3763
|
+
"use strict";
|
|
3764
|
+
import_node_fs4 = __toESM(require("fs"), 1);
|
|
3765
|
+
import_node_path4 = __toESM(require("path"), 1);
|
|
3766
|
+
import_node_module5 = require("module");
|
|
3684
3767
|
init_nativeBridge();
|
|
3685
3768
|
init_compiler();
|
|
3686
3769
|
init_parser();
|
|
@@ -3688,7 +3771,9 @@ var init_src2 = __esm({
|
|
|
3688
3771
|
init_cache();
|
|
3689
3772
|
init_redis();
|
|
3690
3773
|
init_watch();
|
|
3691
|
-
_require3 =
|
|
3774
|
+
_require3 = (0, import_node_module5.createRequire)(
|
|
3775
|
+
typeof require !== "undefined" ? typeof __filename !== "undefined" ? `file://${__filename}` : "file://unknown" : __importMetaUrl
|
|
3776
|
+
);
|
|
3692
3777
|
transformSource = (source, opts) => {
|
|
3693
3778
|
const native = getNativeBridge();
|
|
3694
3779
|
if (!native?.transformSource) {
|
|
@@ -3780,7 +3865,7 @@ var init_src2 = __esm({
|
|
|
3780
3865
|
};
|
|
3781
3866
|
scanProjectUsage = (dirs, cwd) => {
|
|
3782
3867
|
const { batchExtractClasses: batchExtractClasses2 } = _require3("./parser");
|
|
3783
|
-
const files = dirs.map((dir) =>
|
|
3868
|
+
const files = dirs.map((dir) => import_node_path4.default.resolve(cwd, dir));
|
|
3784
3869
|
const results = batchExtractClasses2(files) || [];
|
|
3785
3870
|
const combined = {};
|
|
3786
3871
|
for (const result of results) {
|
|
@@ -3797,13 +3882,13 @@ var init_src2 = __esm({
|
|
|
3797
3882
|
const classes = scanProjectUsage(scanDirs, cwd || process.cwd());
|
|
3798
3883
|
const allClasses = Object.keys(classes).sort();
|
|
3799
3884
|
if (outputPath) {
|
|
3800
|
-
|
|
3885
|
+
import_node_fs4.default.writeFileSync(outputPath, JSON.stringify(allClasses, null, 2));
|
|
3801
3886
|
}
|
|
3802
3887
|
return allClasses;
|
|
3803
3888
|
};
|
|
3804
3889
|
loadSafelist = (safelistPath) => {
|
|
3805
3890
|
try {
|
|
3806
|
-
const content =
|
|
3891
|
+
const content = import_node_fs4.default.readFileSync(safelistPath, "utf-8");
|
|
3807
3892
|
return JSON.parse(content);
|
|
3808
3893
|
} catch {
|
|
3809
3894
|
return [];
|
|
@@ -3817,9 +3902,9 @@ var init_src2 = __esm({
|
|
|
3817
3902
|
"tailwind.config.cjs"
|
|
3818
3903
|
];
|
|
3819
3904
|
for (const file of configFiles) {
|
|
3820
|
-
const fullPath =
|
|
3821
|
-
if (
|
|
3822
|
-
const mod =
|
|
3905
|
+
const fullPath = import_node_path4.default.join(cwd, file);
|
|
3906
|
+
if (import_node_fs4.default.existsSync(fullPath)) {
|
|
3907
|
+
const mod = require(fullPath);
|
|
3823
3908
|
return mod.default || mod;
|
|
3824
3909
|
}
|
|
3825
3910
|
}
|
|
@@ -3828,9 +3913,9 @@ var init_src2 = __esm({
|
|
|
3828
3913
|
getContentPaths = (cwd = process.cwd()) => {
|
|
3829
3914
|
return {
|
|
3830
3915
|
content: [
|
|
3831
|
-
|
|
3832
|
-
|
|
3833
|
-
|
|
3916
|
+
import_node_path4.default.join(cwd, "src/**/*.{js,ts,jsx,tsx}"),
|
|
3917
|
+
import_node_path4.default.join(cwd, "app/**/*.{js,ts,jsx,tsx}"),
|
|
3918
|
+
import_node_path4.default.join(cwd, "pages/**/*.{js,ts,jsx,tsx}")
|
|
3834
3919
|
]
|
|
3835
3920
|
};
|
|
3836
3921
|
};
|
|
@@ -4053,8 +4138,8 @@ function getDirname2() {
|
|
|
4053
4138
|
if (typeof __dirname !== "undefined") {
|
|
4054
4139
|
return __dirname;
|
|
4055
4140
|
}
|
|
4056
|
-
if (typeof
|
|
4057
|
-
return
|
|
4141
|
+
if (typeof import_meta3 !== "undefined" && __importMetaUrl) {
|
|
4142
|
+
return import_node_path5.default.dirname((0, import_node_url2.fileURLToPath)(__importMetaUrl));
|
|
4058
4143
|
}
|
|
4059
4144
|
return process.cwd();
|
|
4060
4145
|
}
|
|
@@ -4259,13 +4344,17 @@ function hasNativeWatchBinding() {
|
|
|
4259
4344
|
return false;
|
|
4260
4345
|
}
|
|
4261
4346
|
}
|
|
4262
|
-
var log2, isValidScannerBinding, createScannerBridgeLoader, scannerBridgeLoader, scannerGetBinding, resetScannerBridgeCache;
|
|
4347
|
+
var import_node_path5, import_node_url2, import_meta3, log2, isValidScannerBinding, createScannerBridgeLoader, scannerBridgeLoader, scannerGetBinding, resetScannerBridgeCache;
|
|
4263
4348
|
var init_native_bridge = __esm({
|
|
4264
4349
|
"packages/domain/scanner/src/native-bridge.ts"() {
|
|
4350
|
+
"use strict";
|
|
4351
|
+
import_node_path5 = __toESM(require("path"), 1);
|
|
4352
|
+
import_node_url2 = require("url");
|
|
4265
4353
|
init_src();
|
|
4354
|
+
import_meta3 = {};
|
|
4266
4355
|
log2 = createDebugLogger("scanner:native");
|
|
4267
|
-
isValidScannerBinding = (
|
|
4268
|
-
const candidate =
|
|
4356
|
+
isValidScannerBinding = (module2) => {
|
|
4357
|
+
const candidate = module2;
|
|
4269
4358
|
return !!(candidate && (candidate.scanWorkspace || candidate.extractClassesFromSource || candidate.hashFileContent || candidate.cacheRead || candidate.cacheWrite));
|
|
4270
4359
|
};
|
|
4271
4360
|
createScannerBridgeLoader = () => {
|
|
@@ -4342,13 +4431,15 @@ var init_native_bridge = __esm({
|
|
|
4342
4431
|
resetScannerBridgeCache = scannerBridgeLoader.reset;
|
|
4343
4432
|
}
|
|
4344
4433
|
});
|
|
4434
|
+
|
|
4435
|
+
// packages/domain/scanner/src/cache-native.ts
|
|
4345
4436
|
function defaultCachePath(rootDir, cacheDir) {
|
|
4346
|
-
const dir = cacheDir ?
|
|
4347
|
-
return
|
|
4437
|
+
const dir = cacheDir ? import_node_path6.default.resolve(rootDir, cacheDir) : import_node_path6.default.join(process.cwd(), ".cache", "tailwind-styled");
|
|
4438
|
+
return import_node_path6.default.join(dir, "scanner-cache.json");
|
|
4348
4439
|
}
|
|
4349
4440
|
function readCache(rootDir, cacheDir) {
|
|
4350
4441
|
const cachePath = defaultCachePath(rootDir, cacheDir);
|
|
4351
|
-
|
|
4442
|
+
import_node_fs5.default.mkdirSync(import_node_path6.default.dirname(cachePath), { recursive: true });
|
|
4352
4443
|
const result = cacheReadNative(cachePath);
|
|
4353
4444
|
if (!result) return [];
|
|
4354
4445
|
return result.entries.map((e) => ({
|
|
@@ -4363,7 +4454,7 @@ function readCache(rootDir, cacheDir) {
|
|
|
4363
4454
|
}
|
|
4364
4455
|
function writeCache(rootDir, entries, cacheDir) {
|
|
4365
4456
|
const cachePath = defaultCachePath(rootDir, cacheDir);
|
|
4366
|
-
|
|
4457
|
+
import_node_fs5.default.mkdirSync(import_node_path6.default.dirname(cachePath), { recursive: true });
|
|
4367
4458
|
const success = cacheWriteNative(cachePath, entries);
|
|
4368
4459
|
if (!success) {
|
|
4369
4460
|
throw new Error(
|
|
@@ -4382,11 +4473,18 @@ function filePriority(mtimeMs, size, cached, nowMs = Date.now()) {
|
|
|
4382
4473
|
nowMs
|
|
4383
4474
|
);
|
|
4384
4475
|
}
|
|
4476
|
+
var import_node_fs5, import_node_path6, STALE_THRESHOLD_MS;
|
|
4385
4477
|
var init_cache_native = __esm({
|
|
4386
4478
|
"packages/domain/scanner/src/cache-native.ts"() {
|
|
4479
|
+
"use strict";
|
|
4480
|
+
import_node_fs5 = __toESM(require("fs"), 1);
|
|
4481
|
+
import_node_path6 = __toESM(require("path"), 1);
|
|
4387
4482
|
init_native_bridge();
|
|
4483
|
+
STALE_THRESHOLD_MS = 7 * 24 * 60 * 60 * 1e3;
|
|
4388
4484
|
}
|
|
4389
4485
|
});
|
|
4486
|
+
|
|
4487
|
+
// packages/domain/scanner/src/parallel-scanner.ts
|
|
4390
4488
|
function collectFiles2(rootDir, extensions, ignoreDirs) {
|
|
4391
4489
|
const native = collectFilesNative(rootDir, extensions, ignoreDirs);
|
|
4392
4490
|
if (native !== null) return native;
|
|
@@ -4404,7 +4502,7 @@ function mergeResults(batchResults) {
|
|
|
4404
4502
|
}
|
|
4405
4503
|
function runChunkInWorker(filePaths) {
|
|
4406
4504
|
return new Promise((resolve2, reject) => {
|
|
4407
|
-
const worker = new
|
|
4505
|
+
const worker = new import_node_worker_threads.Worker(_workerFilename, {
|
|
4408
4506
|
workerData: { filePaths }
|
|
4409
4507
|
});
|
|
4410
4508
|
worker.once("message", (payload) => {
|
|
@@ -4424,10 +4522,10 @@ async function scanWorkspaceParallel(rootDir, options = {}) {
|
|
|
4424
4522
|
const {
|
|
4425
4523
|
extensions = DEFAULT_EXTENSIONS,
|
|
4426
4524
|
ignoreDirs = DEFAULT_IGNORES,
|
|
4427
|
-
maxWorkers = Math.max(1,
|
|
4525
|
+
maxWorkers = Math.max(1, (0, import_node_os.availableParallelism)() - 1),
|
|
4428
4526
|
chunkSize = DEFAULT_CHUNK_SIZE
|
|
4429
4527
|
} = options;
|
|
4430
|
-
const files = collectFiles2(
|
|
4528
|
+
const files = collectFiles2(import_node_path7.default.resolve(rootDir), extensions, ignoreDirs);
|
|
4431
4529
|
if (files.length < PARALLEL_THRESHOLD) {
|
|
4432
4530
|
return mergeResults(batchExtractClassesNative2(files));
|
|
4433
4531
|
}
|
|
@@ -4443,33 +4541,42 @@ async function scanWorkspaceParallel(rootDir, options = {}) {
|
|
|
4443
4541
|
}
|
|
4444
4542
|
return mergeResults(allResults);
|
|
4445
4543
|
}
|
|
4446
|
-
var PARALLEL_THRESHOLD, DEFAULT_CHUNK_SIZE, _workerFilename;
|
|
4544
|
+
var import_node_worker_threads, import_node_path7, import_node_os, import_node_url3, PARALLEL_THRESHOLD, DEFAULT_CHUNK_SIZE, _workerFilename;
|
|
4447
4545
|
var init_parallel_scanner = __esm({
|
|
4448
4546
|
"packages/domain/scanner/src/parallel-scanner.ts"() {
|
|
4547
|
+
"use strict";
|
|
4548
|
+
import_node_worker_threads = require("worker_threads");
|
|
4549
|
+
import_node_path7 = __toESM(require("path"), 1);
|
|
4550
|
+
import_node_os = require("os");
|
|
4551
|
+
import_node_url3 = require("url");
|
|
4449
4552
|
init_src3();
|
|
4450
4553
|
init_native_bridge();
|
|
4451
4554
|
PARALLEL_THRESHOLD = 50;
|
|
4452
4555
|
DEFAULT_CHUNK_SIZE = 150;
|
|
4453
|
-
if (!
|
|
4454
|
-
const { filePaths } =
|
|
4556
|
+
if (!import_node_worker_threads.isMainThread && import_node_worker_threads.parentPort) {
|
|
4557
|
+
const { filePaths } = import_node_worker_threads.workerData;
|
|
4455
4558
|
try {
|
|
4456
4559
|
const results = batchExtractClassesNative2(filePaths);
|
|
4457
4560
|
const msg = { ok: true, results };
|
|
4458
|
-
|
|
4561
|
+
import_node_worker_threads.parentPort.postMessage(msg);
|
|
4459
4562
|
} catch (error) {
|
|
4460
4563
|
const msg = {
|
|
4461
4564
|
ok: false,
|
|
4462
4565
|
error: error instanceof Error ? error.message : String(error)
|
|
4463
4566
|
};
|
|
4464
|
-
|
|
4567
|
+
import_node_worker_threads.parentPort.postMessage(msg);
|
|
4465
4568
|
}
|
|
4466
4569
|
}
|
|
4467
|
-
_workerFilename = typeof __filename !== "undefined" ? __filename :
|
|
4570
|
+
_workerFilename = typeof __filename !== "undefined" ? __filename : (0, import_node_url3.fileURLToPath)(__importMetaUrl);
|
|
4468
4571
|
}
|
|
4469
4572
|
});
|
|
4470
|
-
|
|
4573
|
+
|
|
4574
|
+
// packages/domain/scanner/src/schemas.ts
|
|
4575
|
+
var import_zod3, formatIssuePath2, formatIssues, parseWithSchema, NonNegativeIntegerSchema, ScanWorkspaceOptionsSchema, ScanFileResultSchema, ScanWorkspaceResultSchema, ScannerWorkerRequestSchema, ScannerWorkerSuccessMessageSchema, ScannerWorkerErrorMessageSchema, ScannerWorkerMessageSchema, parseScanWorkspaceOptions, parseScanWorkspaceResult, parseScannerWorkerMessage;
|
|
4471
4576
|
var init_schemas = __esm({
|
|
4472
4577
|
"packages/domain/scanner/src/schemas.ts"() {
|
|
4578
|
+
"use strict";
|
|
4579
|
+
import_zod3 = require("zod");
|
|
4473
4580
|
init_src();
|
|
4474
4581
|
formatIssuePath2 = (path16) => path16.length > 0 ? path16.map(
|
|
4475
4582
|
(segment) => typeof segment === "symbol" ? segment.description ?? segment.toString() : String(segment)
|
|
@@ -4489,40 +4596,40 @@ var init_schemas = __esm({
|
|
|
4489
4596
|
parsed.error
|
|
4490
4597
|
);
|
|
4491
4598
|
};
|
|
4492
|
-
NonNegativeIntegerSchema =
|
|
4493
|
-
ScanWorkspaceOptionsSchema =
|
|
4494
|
-
includeExtensions:
|
|
4495
|
-
ignoreDirectories:
|
|
4496
|
-
useCache:
|
|
4497
|
-
cacheDir:
|
|
4498
|
-
smartInvalidation:
|
|
4599
|
+
NonNegativeIntegerSchema = import_zod3.z.number().int().min(0);
|
|
4600
|
+
ScanWorkspaceOptionsSchema = import_zod3.z.object({
|
|
4601
|
+
includeExtensions: import_zod3.z.array(import_zod3.z.string()).optional(),
|
|
4602
|
+
ignoreDirectories: import_zod3.z.array(import_zod3.z.string()).optional(),
|
|
4603
|
+
useCache: import_zod3.z.boolean().optional(),
|
|
4604
|
+
cacheDir: import_zod3.z.string().min(1).optional(),
|
|
4605
|
+
smartInvalidation: import_zod3.z.boolean().optional()
|
|
4499
4606
|
});
|
|
4500
|
-
ScanFileResultSchema =
|
|
4501
|
-
file:
|
|
4502
|
-
classes:
|
|
4503
|
-
hash:
|
|
4607
|
+
ScanFileResultSchema = import_zod3.z.object({
|
|
4608
|
+
file: import_zod3.z.string(),
|
|
4609
|
+
classes: import_zod3.z.array(import_zod3.z.string()),
|
|
4610
|
+
hash: import_zod3.z.string().optional()
|
|
4504
4611
|
});
|
|
4505
|
-
ScanWorkspaceResultSchema =
|
|
4506
|
-
files:
|
|
4612
|
+
ScanWorkspaceResultSchema = import_zod3.z.object({
|
|
4613
|
+
files: import_zod3.z.array(ScanFileResultSchema),
|
|
4507
4614
|
totalFiles: NonNegativeIntegerSchema,
|
|
4508
|
-
uniqueClasses:
|
|
4615
|
+
uniqueClasses: import_zod3.z.array(import_zod3.z.string())
|
|
4509
4616
|
}).refine((value) => value.totalFiles === value.files.length, {
|
|
4510
4617
|
message: "scan result totalFiles must match files.length",
|
|
4511
4618
|
path: ["totalFiles"]
|
|
4512
4619
|
});
|
|
4513
|
-
|
|
4514
|
-
rootDir:
|
|
4620
|
+
ScannerWorkerRequestSchema = import_zod3.z.object({
|
|
4621
|
+
rootDir: import_zod3.z.string().min(1),
|
|
4515
4622
|
options: ScanWorkspaceOptionsSchema.optional()
|
|
4516
4623
|
});
|
|
4517
|
-
ScannerWorkerSuccessMessageSchema =
|
|
4518
|
-
ok:
|
|
4624
|
+
ScannerWorkerSuccessMessageSchema = import_zod3.z.object({
|
|
4625
|
+
ok: import_zod3.z.literal(true),
|
|
4519
4626
|
result: ScanWorkspaceResultSchema
|
|
4520
4627
|
});
|
|
4521
|
-
ScannerWorkerErrorMessageSchema =
|
|
4522
|
-
ok:
|
|
4523
|
-
error:
|
|
4628
|
+
ScannerWorkerErrorMessageSchema = import_zod3.z.object({
|
|
4629
|
+
ok: import_zod3.z.literal(false),
|
|
4630
|
+
error: import_zod3.z.string().optional()
|
|
4524
4631
|
});
|
|
4525
|
-
ScannerWorkerMessageSchema =
|
|
4632
|
+
ScannerWorkerMessageSchema = import_zod3.z.union([
|
|
4526
4633
|
ScannerWorkerSuccessMessageSchema,
|
|
4527
4634
|
ScannerWorkerErrorMessageSchema
|
|
4528
4635
|
]);
|
|
@@ -4552,8 +4659,8 @@ function getRuntimeDir() {
|
|
|
4552
4659
|
if (typeof __dirname !== "undefined" && __dirname.length > 0) {
|
|
4553
4660
|
return __dirname;
|
|
4554
4661
|
}
|
|
4555
|
-
if (typeof
|
|
4556
|
-
return
|
|
4662
|
+
if (typeof import_meta4 !== "undefined" && __importMetaUrl) {
|
|
4663
|
+
return import_node_path8.default.dirname((0, import_node_url4.fileURLToPath)(__importMetaUrl));
|
|
4557
4664
|
}
|
|
4558
4665
|
return process.cwd();
|
|
4559
4666
|
}
|
|
@@ -4562,18 +4669,18 @@ function resolveScannerWorkerModulePath() {
|
|
|
4562
4669
|
if (typeof __dirname !== "undefined" && __dirname.length > 0) {
|
|
4563
4670
|
return __dirname;
|
|
4564
4671
|
}
|
|
4565
|
-
if (typeof
|
|
4566
|
-
return
|
|
4672
|
+
if (typeof import_meta4 !== "undefined" && __importMetaUrl) {
|
|
4673
|
+
return import_node_path8.default.dirname((0, import_node_url4.fileURLToPath)(__importMetaUrl));
|
|
4567
4674
|
}
|
|
4568
4675
|
return process.cwd();
|
|
4569
4676
|
})();
|
|
4570
4677
|
const candidates = [
|
|
4571
|
-
|
|
4572
|
-
|
|
4573
|
-
|
|
4678
|
+
import_node_path8.default.resolve(runtimeDir, "worker.cjs"),
|
|
4679
|
+
import_node_path8.default.resolve(runtimeDir, "worker.js"),
|
|
4680
|
+
import_node_path8.default.resolve(runtimeDir, "worker.ts")
|
|
4574
4681
|
];
|
|
4575
4682
|
for (const candidate of candidates) {
|
|
4576
|
-
if (
|
|
4683
|
+
if (import_node_fs6.default.existsSync(candidate)) return candidate;
|
|
4577
4684
|
}
|
|
4578
4685
|
return null;
|
|
4579
4686
|
}
|
|
@@ -4585,7 +4692,7 @@ function scanWorkspaceInWorker(rootDir, options) {
|
|
|
4585
4692
|
}
|
|
4586
4693
|
return new Promise((resolve2, reject) => {
|
|
4587
4694
|
const settleState = { settled: false };
|
|
4588
|
-
const worker = new
|
|
4695
|
+
const worker = new import_node_worker_threads2.Worker(modulePath, { workerData: { rootDir, options: normalizedOptions } });
|
|
4589
4696
|
const timeout = setTimeout(() => {
|
|
4590
4697
|
if (!settleState.settled) {
|
|
4591
4698
|
settleState.settled = true;
|
|
@@ -4630,19 +4737,19 @@ function collectCandidates(rootDir, ignoreDirectories, extensionSet) {
|
|
|
4630
4737
|
if (!currentDir) continue;
|
|
4631
4738
|
const entries = (() => {
|
|
4632
4739
|
try {
|
|
4633
|
-
return
|
|
4740
|
+
return import_node_fs6.default.readdirSync(currentDir, { withFileTypes: true });
|
|
4634
4741
|
} catch {
|
|
4635
4742
|
return [];
|
|
4636
4743
|
}
|
|
4637
4744
|
})();
|
|
4638
4745
|
for (const entry of entries) {
|
|
4639
|
-
const fullPath =
|
|
4746
|
+
const fullPath = import_node_path8.default.join(currentDir, entry.name);
|
|
4640
4747
|
if (entry.isDirectory()) {
|
|
4641
4748
|
if (!ignoreDirectories.has(entry.name)) directories.push(fullPath);
|
|
4642
4749
|
continue;
|
|
4643
4750
|
}
|
|
4644
4751
|
if (!entry.isFile()) continue;
|
|
4645
|
-
if (!extensionSet.has(
|
|
4752
|
+
if (!extensionSet.has(import_node_path8.default.extname(entry.name))) continue;
|
|
4646
4753
|
candidates.push(fullPath);
|
|
4647
4754
|
}
|
|
4648
4755
|
}
|
|
@@ -4669,7 +4776,7 @@ function scanSource(source) {
|
|
|
4669
4776
|
);
|
|
4670
4777
|
}
|
|
4671
4778
|
function isScannableFile2(filePath, includeExtensions = DEFAULT_EXTENSIONS) {
|
|
4672
|
-
return includeExtensions.includes(
|
|
4779
|
+
return includeExtensions.includes(import_node_path8.default.extname(filePath));
|
|
4673
4780
|
}
|
|
4674
4781
|
function scanFile2(filePath) {
|
|
4675
4782
|
const { scanFileNative: scanFileNative3 } = (init_native_bridge(), __toCommonJS(native_bridge_exports));
|
|
@@ -4689,7 +4796,7 @@ function scanWorkspace2(rootDir, options = {}) {
|
|
|
4689
4796
|
const extensionSet = buildExtensionSet(includeExtensions);
|
|
4690
4797
|
const ignoreDirectories = new Set(normalizedOptions.ignoreDirectories ?? DEFAULT_IGNORES);
|
|
4691
4798
|
const useCache = normalizedOptions.useCache ?? true;
|
|
4692
|
-
normalizedOptions.smartInvalidation ?? true;
|
|
4799
|
+
const _smartInvalidation = normalizedOptions.smartInvalidation ?? true;
|
|
4693
4800
|
const files = [];
|
|
4694
4801
|
const unique = /* @__PURE__ */ new Set();
|
|
4695
4802
|
const candidates = collectCandidates(rootDir, ignoreDirectories, extensionSet);
|
|
@@ -4729,7 +4836,7 @@ function scanWorkspace2(rootDir, options = {}) {
|
|
|
4729
4836
|
for (const filePath of candidates) {
|
|
4730
4837
|
const stat = (() => {
|
|
4731
4838
|
try {
|
|
4732
|
-
return
|
|
4839
|
+
return import_node_fs6.default.statSync(filePath);
|
|
4733
4840
|
} catch {
|
|
4734
4841
|
return null;
|
|
4735
4842
|
}
|
|
@@ -4755,7 +4862,7 @@ function scanWorkspace2(rootDir, options = {}) {
|
|
|
4755
4862
|
for (const { filePath, stat, size, cached } of ranked) {
|
|
4756
4863
|
const content = (() => {
|
|
4757
4864
|
try {
|
|
4758
|
-
return
|
|
4865
|
+
return import_node_fs6.default.readFileSync(filePath, "utf8");
|
|
4759
4866
|
} catch {
|
|
4760
4867
|
return null;
|
|
4761
4868
|
}
|
|
@@ -4836,9 +4943,15 @@ async function scanWorkspaceAsync(rootDir, options = {}) {
|
|
|
4836
4943
|
return scanWorkspace2(rootDir, normalizedOptions);
|
|
4837
4944
|
}
|
|
4838
4945
|
}
|
|
4839
|
-
var log3, SCAN_WORKER_TIMEOUT_MS, createNativeParserLoader, nativeParserLoader, DEFAULT_EXTENSIONS, DEFAULT_IGNORES;
|
|
4946
|
+
var import_node_fs6, import_node_module6, import_node_path8, import_node_url4, import_node_worker_threads2, import_meta4, log3, SCAN_WORKER_TIMEOUT_MS, createNativeParserLoader, nativeParserLoader, DEFAULT_EXTENSIONS, DEFAULT_IGNORES;
|
|
4840
4947
|
var init_src3 = __esm({
|
|
4841
4948
|
"packages/domain/scanner/src/index.ts"() {
|
|
4949
|
+
"use strict";
|
|
4950
|
+
import_node_fs6 = __toESM(require("fs"), 1);
|
|
4951
|
+
import_node_module6 = require("module");
|
|
4952
|
+
import_node_path8 = __toESM(require("path"), 1);
|
|
4953
|
+
import_node_url4 = require("url");
|
|
4954
|
+
import_node_worker_threads2 = require("worker_threads");
|
|
4842
4955
|
init_src();
|
|
4843
4956
|
init_cache_native();
|
|
4844
4957
|
init_native_bridge();
|
|
@@ -4846,6 +4959,7 @@ var init_src3 = __esm({
|
|
|
4846
4959
|
init_schemas();
|
|
4847
4960
|
init_schemas();
|
|
4848
4961
|
init_native_bridge();
|
|
4962
|
+
import_meta4 = {};
|
|
4849
4963
|
log3 = createLogger2("scanner");
|
|
4850
4964
|
SCAN_WORKER_TIMEOUT_MS = 12e4;
|
|
4851
4965
|
createNativeParserLoader = () => {
|
|
@@ -4859,7 +4973,7 @@ var init_src3 = __esm({
|
|
|
4859
4973
|
const loadNativeParserBinding = () => {
|
|
4860
4974
|
if (_state.binding !== void 0) return _state.binding;
|
|
4861
4975
|
const runtimeDir = getRuntimeDir();
|
|
4862
|
-
const req =
|
|
4976
|
+
const req = (0, import_node_module6.createRequire)(import_node_path8.default.join(runtimeDir, "noop.cjs"));
|
|
4863
4977
|
const _platform = process.platform;
|
|
4864
4978
|
const _arch = process.arch;
|
|
4865
4979
|
const _platformArch = `${_platform}-${_arch}`;
|
|
@@ -4867,27 +4981,27 @@ var init_src3 = __esm({
|
|
|
4867
4981
|
const candidates = [
|
|
4868
4982
|
// ── binaryName baru: tailwind-styled-native (napi-rs naming) ──
|
|
4869
4983
|
// cwd = repo root saat run dari root, atau package dir saat workspaces
|
|
4870
|
-
|
|
4871
|
-
|
|
4872
|
-
|
|
4984
|
+
import_node_path8.default.resolve(process.cwd(), "native", "tailwind-styled-native.node"),
|
|
4985
|
+
import_node_path8.default.resolve(process.cwd(), "native", `tailwind-styled-native.${_platformArch}.node`),
|
|
4986
|
+
import_node_path8.default.resolve(process.cwd(), "native", `tailwind-styled-native.${_platformArchGnu}.node`),
|
|
4873
4987
|
// runtimeDir = dist/ → naik 1 level ke package root (npm install case)
|
|
4874
4988
|
// e.g. node_modules/tailwind-styled-v4/dist/ → node_modules/tailwind-styled-v4/native/
|
|
4875
|
-
|
|
4876
|
-
|
|
4877
|
-
|
|
4989
|
+
import_node_path8.default.resolve(runtimeDir, "..", "native", "tailwind-styled-native.node"),
|
|
4990
|
+
import_node_path8.default.resolve(runtimeDir, "..", "native", `tailwind-styled-native.${_platformArch}.node`),
|
|
4991
|
+
import_node_path8.default.resolve(runtimeDir, "..", "native", `tailwind-styled-native.${_platformArchGnu}.node`),
|
|
4878
4992
|
// runtimeDir = dist/ → naik 4 level ke repo root (monorepo dev case)
|
|
4879
|
-
|
|
4880
|
-
|
|
4993
|
+
import_node_path8.default.resolve(runtimeDir, "..", "..", "..", "..", "native", "tailwind-styled-native.node"),
|
|
4994
|
+
import_node_path8.default.resolve(runtimeDir, "..", "..", "..", "..", "native", `tailwind-styled-native.${_platformArchGnu}.node`),
|
|
4881
4995
|
// 3 level fallback (jika package di-nest lebih dangkal)
|
|
4882
|
-
|
|
4883
|
-
|
|
4996
|
+
import_node_path8.default.resolve(runtimeDir, "..", "..", "..", "native", "tailwind-styled-native.node"),
|
|
4997
|
+
import_node_path8.default.resolve(runtimeDir, "..", "..", "..", "native", `tailwind-styled-native.${_platformArchGnu}.node`),
|
|
4884
4998
|
// ── binaryName lama: tailwind_styled_parser (backward compat) ──
|
|
4885
|
-
|
|
4886
|
-
|
|
4887
|
-
|
|
4888
|
-
|
|
4889
|
-
|
|
4890
|
-
|
|
4999
|
+
import_node_path8.default.resolve(process.cwd(), "native/tailwind_styled_parser.node"),
|
|
5000
|
+
import_node_path8.default.resolve(process.cwd(), "native/build/Release/tailwind_styled_parser.node"),
|
|
5001
|
+
import_node_path8.default.resolve(runtimeDir, "..", "native", "tailwind_styled_parser.node"),
|
|
5002
|
+
import_node_path8.default.resolve(runtimeDir, "..", "..", "..", "..", "native", "tailwind_styled_parser.node"),
|
|
5003
|
+
import_node_path8.default.resolve(runtimeDir, "..", "..", "..", "native", "tailwind_styled_parser.node"),
|
|
5004
|
+
import_node_path8.default.resolve(
|
|
4891
5005
|
runtimeDir,
|
|
4892
5006
|
"..",
|
|
4893
5007
|
"..",
|
|
@@ -4899,7 +5013,7 @@ var init_src3 = __esm({
|
|
|
4899
5013
|
)
|
|
4900
5014
|
];
|
|
4901
5015
|
for (const fullPath of candidates) {
|
|
4902
|
-
if (!
|
|
5016
|
+
if (!import_node_fs6.default.existsSync(fullPath)) continue;
|
|
4903
5017
|
try {
|
|
4904
5018
|
const required = req(fullPath);
|
|
4905
5019
|
if (required && (typeof required.extractClassesFromSource === "function" || typeof required.parseClasses === "function" || typeof required.parse_classes === "function")) {
|
|
@@ -4935,21 +5049,23 @@ var init_src3 = __esm({
|
|
|
4935
5049
|
// packages/domain/engine/src/native-bridge.ts
|
|
4936
5050
|
function getDirname3() {
|
|
4937
5051
|
if (typeof __dirname !== "undefined") return __dirname;
|
|
4938
|
-
if (typeof
|
|
4939
|
-
return getDirname(
|
|
5052
|
+
if (typeof import_meta5 !== "undefined" && __importMetaUrl) {
|
|
5053
|
+
return getDirname(__importMetaUrl);
|
|
4940
5054
|
}
|
|
4941
5055
|
return process.cwd();
|
|
4942
5056
|
}
|
|
4943
5057
|
function getNativeEngineBinding() {
|
|
4944
5058
|
return engineBindingLoader.get();
|
|
4945
5059
|
}
|
|
4946
|
-
var log4, isValidEngineBinding, createEngineBindingLoader, engineBindingLoader;
|
|
5060
|
+
var import_meta5, log4, isValidEngineBinding, createEngineBindingLoader, engineBindingLoader;
|
|
4947
5061
|
var init_native_bridge2 = __esm({
|
|
4948
5062
|
"packages/domain/engine/src/native-bridge.ts"() {
|
|
5063
|
+
"use strict";
|
|
4949
5064
|
init_src();
|
|
5065
|
+
import_meta5 = {};
|
|
4950
5066
|
log4 = createDebugLogger("engine:native");
|
|
4951
|
-
isValidEngineBinding = (
|
|
4952
|
-
const candidate =
|
|
5067
|
+
isValidEngineBinding = (module2) => {
|
|
5068
|
+
const candidate = module2;
|
|
4953
5069
|
return !!(candidate && (candidate.computeIncrementalDiff || candidate.processFileChange || candidate.hashFileContent));
|
|
4954
5070
|
};
|
|
4955
5071
|
createEngineBindingLoader = () => {
|
|
@@ -5024,16 +5140,32 @@ var init_native_bridge2 = __esm({
|
|
|
5024
5140
|
}
|
|
5025
5141
|
});
|
|
5026
5142
|
|
|
5143
|
+
// src/umbrella/vite.ts
|
|
5144
|
+
var vite_exports = {};
|
|
5145
|
+
__export(vite_exports, {
|
|
5146
|
+
tailwindStyledPlugin: () => tailwindStyledPlugin
|
|
5147
|
+
});
|
|
5148
|
+
module.exports = __toCommonJS(vite_exports);
|
|
5149
|
+
|
|
5027
5150
|
// packages/presentation/vite/src/plugin.ts
|
|
5151
|
+
var import_node_fs12 = __toESM(require("fs"), 1);
|
|
5152
|
+
var import_node_path14 = __toESM(require("path"), 1);
|
|
5028
5153
|
init_src2();
|
|
5029
5154
|
|
|
5155
|
+
// packages/domain/engine/src/index.ts
|
|
5156
|
+
var import_node_fs11 = __toESM(require("fs"), 1);
|
|
5157
|
+
var import_node_path13 = __toESM(require("path"), 1);
|
|
5158
|
+
var import_node_url6 = require("url");
|
|
5159
|
+
|
|
5030
5160
|
// packages/domain/analyzer/src/analyzeWorkspace.ts
|
|
5161
|
+
var import_node_path10 = __toESM(require("path"), 1);
|
|
5031
5162
|
init_src3();
|
|
5032
5163
|
|
|
5033
5164
|
// packages/domain/analyzer/src/binding.ts
|
|
5034
5165
|
init_src();
|
|
5035
5166
|
|
|
5036
5167
|
// packages/domain/analyzer/src/utils.ts
|
|
5168
|
+
var import_node_fs7 = __toESM(require("fs"), 1);
|
|
5037
5169
|
init_src();
|
|
5038
5170
|
var DEFAULT_TOP_LIMIT = 10;
|
|
5039
5171
|
var DEFAULT_FREQUENT_THRESHOLD = 2;
|
|
@@ -5048,7 +5180,7 @@ function isRecord(value) {
|
|
|
5048
5180
|
}
|
|
5049
5181
|
async function pathExists(filePath) {
|
|
5050
5182
|
try {
|
|
5051
|
-
await
|
|
5183
|
+
await import_node_fs7.default.promises.access(filePath, import_node_fs7.default.constants.F_OK);
|
|
5052
5184
|
return true;
|
|
5053
5185
|
} catch {
|
|
5054
5186
|
return false;
|
|
@@ -5065,8 +5197,8 @@ function sanitizeFrequentThreshold(value) {
|
|
|
5065
5197
|
}
|
|
5066
5198
|
|
|
5067
5199
|
// packages/domain/analyzer/src/binding.ts
|
|
5068
|
-
var isAnalyzerModule = (
|
|
5069
|
-
const candidate =
|
|
5200
|
+
var isAnalyzerModule = (module2) => {
|
|
5201
|
+
const candidate = module2;
|
|
5070
5202
|
return typeof candidate?.analyzeClasses === "function" || typeof candidate?.analyzeClassesWorkspace === "function";
|
|
5071
5203
|
};
|
|
5072
5204
|
var createAnalyzerBindingLoader = () => {
|
|
@@ -5076,7 +5208,7 @@ var createAnalyzerBindingLoader = () => {
|
|
|
5076
5208
|
_state.bindingPromise = (async () => {
|
|
5077
5209
|
const runtimeDir = resolveRuntimeDir(
|
|
5078
5210
|
typeof __dirname === "string" ? __dirname : void 0,
|
|
5079
|
-
|
|
5211
|
+
__importMetaUrl
|
|
5080
5212
|
);
|
|
5081
5213
|
const candidates = resolveNativeBindingCandidates({
|
|
5082
5214
|
runtimeDir,
|
|
@@ -5119,7 +5251,7 @@ async function requireNativeBinding() {
|
|
|
5119
5251
|
if (binding?.analyzeClasses) return binding;
|
|
5120
5252
|
const runtimeDir = resolveRuntimeDir(
|
|
5121
5253
|
typeof __dirname === "string" ? __dirname : void 0,
|
|
5122
|
-
|
|
5254
|
+
__importMetaUrl
|
|
5123
5255
|
);
|
|
5124
5256
|
const candidates = resolveNativeBindingCandidates({
|
|
5125
5257
|
runtimeDir,
|
|
@@ -5147,6 +5279,7 @@ async function requireNativeBinding() {
|
|
|
5147
5279
|
|
|
5148
5280
|
// packages/domain/analyzer/src/schemas.ts
|
|
5149
5281
|
init_src();
|
|
5282
|
+
var import_zod4 = require("zod");
|
|
5150
5283
|
var formatIssuePath3 = (path16) => path16.length > 0 ? path16.map(
|
|
5151
5284
|
(segment) => typeof segment === "symbol" ? segment.description ?? segment.toString() : String(segment)
|
|
5152
5285
|
).join(".") : "<root>";
|
|
@@ -5170,81 +5303,86 @@ var parseWithSchema2 = (schema, data, label) => {
|
|
|
5170
5303
|
parsed.error
|
|
5171
5304
|
);
|
|
5172
5305
|
};
|
|
5173
|
-
var CountSchema =
|
|
5174
|
-
|
|
5175
|
-
name:
|
|
5306
|
+
var CountSchema = import_zod4.z.number().int().min(0);
|
|
5307
|
+
var ClassUsageSchema = import_zod4.z.object({
|
|
5308
|
+
name: import_zod4.z.string(),
|
|
5176
5309
|
count: CountSchema,
|
|
5177
|
-
isUnused:
|
|
5178
|
-
isConflict:
|
|
5310
|
+
isUnused: import_zod4.z.boolean().optional(),
|
|
5311
|
+
isConflict: import_zod4.z.boolean().optional()
|
|
5179
5312
|
});
|
|
5180
|
-
|
|
5181
|
-
className:
|
|
5182
|
-
variants:
|
|
5183
|
-
classes:
|
|
5184
|
-
message:
|
|
5313
|
+
var ClassConflictSchema = import_zod4.z.object({
|
|
5314
|
+
className: import_zod4.z.string(),
|
|
5315
|
+
variants: import_zod4.z.array(import_zod4.z.string()),
|
|
5316
|
+
classes: import_zod4.z.array(import_zod4.z.string()),
|
|
5317
|
+
message: import_zod4.z.string()
|
|
5185
5318
|
});
|
|
5186
|
-
var ClassCountSchema =
|
|
5187
|
-
name:
|
|
5319
|
+
var ClassCountSchema = import_zod4.z.object({
|
|
5320
|
+
name: import_zod4.z.string(),
|
|
5188
5321
|
count: CountSchema
|
|
5189
5322
|
});
|
|
5190
|
-
var NativeReportSchema =
|
|
5191
|
-
root:
|
|
5323
|
+
var NativeReportSchema = import_zod4.z.object({
|
|
5324
|
+
root: import_zod4.z.string(),
|
|
5192
5325
|
totalFiles: CountSchema,
|
|
5193
5326
|
uniqueClassCount: CountSchema,
|
|
5194
5327
|
totalClassOccurrences: CountSchema,
|
|
5195
|
-
topClasses:
|
|
5196
|
-
duplicateCandidates:
|
|
5197
|
-
safelist:
|
|
5328
|
+
topClasses: import_zod4.z.array(ClassCountSchema),
|
|
5329
|
+
duplicateCandidates: import_zod4.z.array(ClassCountSchema),
|
|
5330
|
+
safelist: import_zod4.z.array(import_zod4.z.string())
|
|
5198
5331
|
});
|
|
5199
|
-
|
|
5200
|
-
css:
|
|
5201
|
-
resolvedClasses:
|
|
5202
|
-
unknownClasses:
|
|
5332
|
+
var NativeCssCompileResultSchema2 = import_zod4.z.object({
|
|
5333
|
+
css: import_zod4.z.string(),
|
|
5334
|
+
resolvedClasses: import_zod4.z.array(import_zod4.z.string()),
|
|
5335
|
+
unknownClasses: import_zod4.z.array(import_zod4.z.string()),
|
|
5203
5336
|
sizeBytes: CountSchema
|
|
5204
5337
|
});
|
|
5205
|
-
var AnalyzerClassStatsSchema =
|
|
5206
|
-
top:
|
|
5338
|
+
var AnalyzerClassStatsSchema = import_zod4.z.object({
|
|
5339
|
+
top: import_zod4.z.number({
|
|
5207
5340
|
error: "analyzeWorkspace options.classStats.top must be a number when provided."
|
|
5208
5341
|
}).finite().optional(),
|
|
5209
|
-
frequentThreshold:
|
|
5342
|
+
frequentThreshold: import_zod4.z.number({
|
|
5210
5343
|
error: "analyzeWorkspace options.classStats.frequentThreshold must be a number when provided."
|
|
5211
5344
|
}).finite().optional()
|
|
5212
5345
|
});
|
|
5213
|
-
var AnalyzerSemanticOptionsSchema =
|
|
5214
|
-
tailwindConfigPath:
|
|
5346
|
+
var AnalyzerSemanticOptionsSchema = import_zod4.z.object({
|
|
5347
|
+
tailwindConfigPath: import_zod4.z.string({
|
|
5215
5348
|
error: "analyzeWorkspace options.semantic.tailwindConfigPath must be a non-empty string when provided."
|
|
5216
5349
|
}).min(
|
|
5217
5350
|
1,
|
|
5218
5351
|
"analyzeWorkspace options.semantic.tailwindConfigPath must be a non-empty string when provided."
|
|
5219
5352
|
).optional()
|
|
5220
5353
|
});
|
|
5221
|
-
var AnalyzerOptionsSchema =
|
|
5222
|
-
scanner:
|
|
5354
|
+
var AnalyzerOptionsSchema = import_zod4.z.object({
|
|
5355
|
+
scanner: import_zod4.z.custom(
|
|
5223
5356
|
(value) => isPlainObject(value),
|
|
5224
5357
|
"analyzeWorkspace options.scanner must be an object when provided."
|
|
5225
5358
|
).optional(),
|
|
5226
5359
|
classStats: AnalyzerClassStatsSchema.optional(),
|
|
5227
|
-
semantic:
|
|
5228
|
-
|
|
5360
|
+
semantic: import_zod4.z.union([
|
|
5361
|
+
import_zod4.z.boolean({
|
|
5229
5362
|
error: "analyzeWorkspace options.semantic must be a boolean or an object when provided."
|
|
5230
5363
|
}),
|
|
5231
5364
|
AnalyzerSemanticOptionsSchema
|
|
5232
5365
|
]).optional(),
|
|
5233
|
-
includeClass:
|
|
5366
|
+
includeClass: import_zod4.z.custom(
|
|
5234
5367
|
(value) => typeof value === "function",
|
|
5235
5368
|
"analyzeWorkspace options.includeClass must be a function when provided."
|
|
5236
5369
|
).optional()
|
|
5237
5370
|
});
|
|
5238
|
-
|
|
5239
|
-
prefix:
|
|
5371
|
+
var ClassToCssOptionsSchema = import_zod4.z.object({
|
|
5372
|
+
prefix: import_zod4.z.union([import_zod4.z.string(), import_zod4.z.null()], {
|
|
5240
5373
|
error: "classToCss options.prefix must be a string or null when provided."
|
|
5241
5374
|
}).optional(),
|
|
5242
|
-
strict:
|
|
5375
|
+
strict: import_zod4.z.boolean({
|
|
5243
5376
|
error: "classToCss options.strict must be a boolean when provided."
|
|
5244
5377
|
}).optional()
|
|
5245
5378
|
});
|
|
5246
5379
|
var parseAnalyzerOptions = (options) => parseWithSchema2(AnalyzerOptionsSchema, options ?? {}, "analyzeWorkspace options are invalid");
|
|
5247
5380
|
var parseNativeReport = (report) => parseWithSchema2(NativeReportSchema, report, "Native analyzer report is invalid");
|
|
5381
|
+
|
|
5382
|
+
// packages/domain/analyzer/src/semantic.ts
|
|
5383
|
+
var import_node_fs8 = __toESM(require("fs"), 1);
|
|
5384
|
+
var import_node_path9 = __toESM(require("path"), 1);
|
|
5385
|
+
var import_node_url5 = require("url");
|
|
5248
5386
|
var SUPPORTED_TAILWIND_CONFIG_EXTENSIONS = /* @__PURE__ */ new Set([".ts", ".js", ".cjs", ".mjs"]);
|
|
5249
5387
|
var tailwindConfigCache = /* @__PURE__ */ new Map();
|
|
5250
5388
|
var detectConflicts2 = async (usages) => {
|
|
@@ -5264,11 +5402,11 @@ var detectConflicts2 = async (usages) => {
|
|
|
5264
5402
|
};
|
|
5265
5403
|
};
|
|
5266
5404
|
var isSupportedTailwindConfigPath = (configPath) => {
|
|
5267
|
-
return SUPPORTED_TAILWIND_CONFIG_EXTENSIONS.has(
|
|
5405
|
+
return SUPPORTED_TAILWIND_CONFIG_EXTENSIONS.has(import_node_path9.default.extname(configPath).toLowerCase());
|
|
5268
5406
|
};
|
|
5269
5407
|
var resolveTailwindConfigPath = async (root, explicitPath) => {
|
|
5270
5408
|
if (explicitPath) {
|
|
5271
|
-
const resolved =
|
|
5409
|
+
const resolved = import_node_path9.default.resolve(root, explicitPath);
|
|
5272
5410
|
if (!await pathExists(resolved)) return null;
|
|
5273
5411
|
return resolved;
|
|
5274
5412
|
}
|
|
@@ -5279,7 +5417,7 @@ var resolveTailwindConfigPath = async (root, explicitPath) => {
|
|
|
5279
5417
|
"tailwind.config.mjs"
|
|
5280
5418
|
];
|
|
5281
5419
|
for (const candidate of candidates) {
|
|
5282
|
-
const fullPath =
|
|
5420
|
+
const fullPath = import_node_path9.default.resolve(root, candidate);
|
|
5283
5421
|
if (await pathExists(fullPath)) return fullPath;
|
|
5284
5422
|
}
|
|
5285
5423
|
return null;
|
|
@@ -5333,7 +5471,7 @@ var collectCustomUtilities = (config) => {
|
|
|
5333
5471
|
return out;
|
|
5334
5472
|
};
|
|
5335
5473
|
var collectSafelistFromSource = async (configPath) => {
|
|
5336
|
-
const source = await
|
|
5474
|
+
const source = await import_node_fs8.default.promises.readFile(configPath, "utf8");
|
|
5337
5475
|
const { extractClassesNative: extractClassesNative2 } = await Promise.resolve().then(() => (init_src3(), src_exports2));
|
|
5338
5476
|
const allTokens = extractClassesNative2(source);
|
|
5339
5477
|
const hasSafelist = source.includes("safelist");
|
|
@@ -5360,7 +5498,7 @@ var loadTailwindConfig2 = async (root, semanticOption) => {
|
|
|
5360
5498
|
customUtilities: /* @__PURE__ */ new Set()
|
|
5361
5499
|
};
|
|
5362
5500
|
}
|
|
5363
|
-
const configStat = await
|
|
5501
|
+
const configStat = await import_node_fs8.default.promises.stat(configPath).catch(() => null);
|
|
5364
5502
|
if (configStat) {
|
|
5365
5503
|
const cached = tailwindConfigCache.get(configPath);
|
|
5366
5504
|
if (cached && cached.mtimeMs === configStat.mtimeMs && cached.size === configStat.size) {
|
|
@@ -5373,7 +5511,7 @@ var loadTailwindConfig2 = async (root, semanticOption) => {
|
|
|
5373
5511
|
const result = await (async () => {
|
|
5374
5512
|
try {
|
|
5375
5513
|
const cacheBustToken = Math.trunc(configStat?.mtimeMs ?? Date.now());
|
|
5376
|
-
const imported = await import(`${
|
|
5514
|
+
const imported = await import(`${(0, import_node_url5.pathToFileURL)(configPath).href}?tws_mtime=${cacheBustToken}`);
|
|
5377
5515
|
const candidate = imported.default ?? imported;
|
|
5378
5516
|
if (isRecord(candidate)) {
|
|
5379
5517
|
return { config: candidate, warning: void 0 };
|
|
@@ -5519,7 +5657,7 @@ async function buildDistribution(usages, native) {
|
|
|
5519
5657
|
}
|
|
5520
5658
|
async function analyzeWorkspace(root, options = {}) {
|
|
5521
5659
|
const startedAtMs = Date.now();
|
|
5522
|
-
const resolvedRoot =
|
|
5660
|
+
const resolvedRoot = import_node_path10.default.resolve(root);
|
|
5523
5661
|
const normalizedOptions = parseAnalyzerOptions(options);
|
|
5524
5662
|
const scan = await (async () => {
|
|
5525
5663
|
const scanStartedAtMs = Date.now();
|
|
@@ -5628,6 +5766,8 @@ init_src3();
|
|
|
5628
5766
|
init_src();
|
|
5629
5767
|
|
|
5630
5768
|
// packages/domain/engine/src/incremental.ts
|
|
5769
|
+
var import_node_fs9 = __toESM(require("fs"), 1);
|
|
5770
|
+
var import_node_path11 = __toESM(require("path"), 1);
|
|
5631
5771
|
init_src3();
|
|
5632
5772
|
init_src();
|
|
5633
5773
|
init_native_bridge2();
|
|
@@ -5663,8 +5803,8 @@ function areClassSetsEqual(a, b) {
|
|
|
5663
5803
|
function applyIncrementalChange(previous, filePath, type, scanner) {
|
|
5664
5804
|
const includeExtensions = scanner?.includeExtensions ?? DEFAULT_EXTENSIONS2;
|
|
5665
5805
|
if (!isScannableFile2(filePath, includeExtensions)) return previous;
|
|
5666
|
-
const byFile = new Map(previous.files.map((f) => [
|
|
5667
|
-
const normalizedPath =
|
|
5806
|
+
const byFile = new Map(previous.files.map((f) => [import_node_path11.default.resolve(f.file), f]));
|
|
5807
|
+
const normalizedPath = import_node_path11.default.resolve(filePath);
|
|
5668
5808
|
const native = getNativeEngineBinding();
|
|
5669
5809
|
if (!native?.processFileChange) {
|
|
5670
5810
|
throw new Error(
|
|
@@ -5680,7 +5820,7 @@ function applyIncrementalChange(previous, filePath, type, scanner) {
|
|
|
5680
5820
|
}
|
|
5681
5821
|
log5.debug(`native change ${normalizedPath}`);
|
|
5682
5822
|
const scanned = scanFile2(normalizedPath);
|
|
5683
|
-
const content =
|
|
5823
|
+
const content = import_node_fs9.default.readFileSync(normalizedPath, "utf8");
|
|
5684
5824
|
const diff = native.processFileChange(normalizedPath, scanned.classes, content);
|
|
5685
5825
|
const existing = byFile.get(normalizedPath);
|
|
5686
5826
|
if (diff && existing) {
|
|
@@ -5744,13 +5884,17 @@ var EngineMetricsCollector = class {
|
|
|
5744
5884
|
};
|
|
5745
5885
|
|
|
5746
5886
|
// packages/domain/engine/src/metricsWriter.ts
|
|
5887
|
+
var import_node_fs10 = __toESM(require("fs"), 1);
|
|
5888
|
+
var import_node_path12 = __toESM(require("path"), 1);
|
|
5889
|
+
var import_node_perf_hooks = require("perf_hooks");
|
|
5747
5890
|
init_src();
|
|
5891
|
+
var _log = createLogger2("tw:metrics");
|
|
5748
5892
|
var METRICS_FILE_NAME = "metrics.json";
|
|
5749
5893
|
var CACHE_DIR = ".tw-cache";
|
|
5750
5894
|
function writeMetrics(metrics, cwd = process.cwd()) {
|
|
5751
5895
|
try {
|
|
5752
|
-
const cacheDir =
|
|
5753
|
-
|
|
5896
|
+
const cacheDir = import_node_path12.default.join(cwd, CACHE_DIR);
|
|
5897
|
+
import_node_fs10.default.mkdirSync(cacheDir, { recursive: true });
|
|
5754
5898
|
const mem = process.memoryUsage();
|
|
5755
5899
|
const data = {
|
|
5756
5900
|
...metrics,
|
|
@@ -5761,7 +5905,7 @@ function writeMetrics(metrics, cwd = process.cwd()) {
|
|
|
5761
5905
|
},
|
|
5762
5906
|
generatedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
5763
5907
|
};
|
|
5764
|
-
|
|
5908
|
+
import_node_fs10.default.writeFileSync(import_node_path12.default.join(cacheDir, METRICS_FILE_NAME), JSON.stringify(data, null, 2));
|
|
5765
5909
|
} catch {
|
|
5766
5910
|
}
|
|
5767
5911
|
}
|
|
@@ -5813,6 +5957,9 @@ async function runAfterWatch(plugins, context) {
|
|
|
5813
5957
|
await plugin.afterWatch?.(context);
|
|
5814
5958
|
}
|
|
5815
5959
|
}
|
|
5960
|
+
|
|
5961
|
+
// packages/domain/engine/src/schemas.ts
|
|
5962
|
+
var import_zod5 = require("zod");
|
|
5816
5963
|
var formatIssues3 = (error) => error.issues.map((issue) => {
|
|
5817
5964
|
const p = issue.path.length > 0 ? issue.path.join(".") : "<root>";
|
|
5818
5965
|
return `${p}: ${issue.message}`;
|
|
@@ -5822,46 +5969,46 @@ var parseWithSchema3 = (schema, data, label) => {
|
|
|
5822
5969
|
if (parsed.success) return parsed.data;
|
|
5823
5970
|
throw new TypeError(`${label}: ${formatIssues3(parsed.error)}`);
|
|
5824
5971
|
};
|
|
5825
|
-
var EngineOptionsSchema =
|
|
5826
|
-
root:
|
|
5827
|
-
scanner:
|
|
5828
|
-
includeExtensions:
|
|
5829
|
-
ignoreDirectories:
|
|
5830
|
-
useCache:
|
|
5831
|
-
cacheDir:
|
|
5832
|
-
smartInvalidation:
|
|
5972
|
+
var EngineOptionsSchema = import_zod5.z.object({
|
|
5973
|
+
root: import_zod5.z.string().optional(),
|
|
5974
|
+
scanner: import_zod5.z.object({
|
|
5975
|
+
includeExtensions: import_zod5.z.array(import_zod5.z.string()).optional(),
|
|
5976
|
+
ignoreDirectories: import_zod5.z.array(import_zod5.z.string()).optional(),
|
|
5977
|
+
useCache: import_zod5.z.boolean().optional(),
|
|
5978
|
+
cacheDir: import_zod5.z.string().min(1).optional(),
|
|
5979
|
+
smartInvalidation: import_zod5.z.boolean().optional()
|
|
5833
5980
|
}).optional(),
|
|
5834
|
-
compileCss:
|
|
5835
|
-
tailwindConfigPath:
|
|
5836
|
-
analyze:
|
|
5837
|
-
plugins:
|
|
5981
|
+
compileCss: import_zod5.z.boolean().optional(),
|
|
5982
|
+
tailwindConfigPath: import_zod5.z.string().optional(),
|
|
5983
|
+
analyze: import_zod5.z.boolean().optional(),
|
|
5984
|
+
plugins: import_zod5.z.array(import_zod5.z.custom()).optional()
|
|
5838
5985
|
});
|
|
5839
|
-
var EngineWatchOptionsSchema =
|
|
5840
|
-
debounceMs:
|
|
5841
|
-
maxEventsPerFlush:
|
|
5842
|
-
largeFileThreshold:
|
|
5986
|
+
var EngineWatchOptionsSchema = import_zod5.z.object({
|
|
5987
|
+
debounceMs: import_zod5.z.number().int().min(0).optional(),
|
|
5988
|
+
maxEventsPerFlush: import_zod5.z.number().int().min(1).optional(),
|
|
5989
|
+
largeFileThreshold: import_zod5.z.number().int().min(0).optional()
|
|
5843
5990
|
});
|
|
5844
|
-
|
|
5845
|
-
scan:
|
|
5846
|
-
files:
|
|
5847
|
-
|
|
5991
|
+
var BuildResultSchema = import_zod5.z.object({
|
|
5992
|
+
scan: import_zod5.z.object({
|
|
5993
|
+
files: import_zod5.z.array(
|
|
5994
|
+
import_zod5.z.object({ file: import_zod5.z.string(), classes: import_zod5.z.array(import_zod5.z.string()), hash: import_zod5.z.string().optional() })
|
|
5848
5995
|
),
|
|
5849
|
-
totalFiles:
|
|
5850
|
-
uniqueClasses:
|
|
5996
|
+
totalFiles: import_zod5.z.number().int().min(0),
|
|
5997
|
+
uniqueClasses: import_zod5.z.array(import_zod5.z.string())
|
|
5851
5998
|
}),
|
|
5852
|
-
mergedClassList:
|
|
5853
|
-
css:
|
|
5854
|
-
analysis:
|
|
5855
|
-
unusedClasses:
|
|
5856
|
-
classConflicts:
|
|
5857
|
-
|
|
5858
|
-
className:
|
|
5859
|
-
files:
|
|
5860
|
-
classes:
|
|
5861
|
-
message:
|
|
5999
|
+
mergedClassList: import_zod5.z.string(),
|
|
6000
|
+
css: import_zod5.z.string(),
|
|
6001
|
+
analysis: import_zod5.z.object({
|
|
6002
|
+
unusedClasses: import_zod5.z.array(import_zod5.z.string()),
|
|
6003
|
+
classConflicts: import_zod5.z.array(
|
|
6004
|
+
import_zod5.z.object({
|
|
6005
|
+
className: import_zod5.z.string(),
|
|
6006
|
+
files: import_zod5.z.array(import_zod5.z.string()),
|
|
6007
|
+
classes: import_zod5.z.array(import_zod5.z.string()).optional(),
|
|
6008
|
+
message: import_zod5.z.string().optional()
|
|
5862
6009
|
})
|
|
5863
6010
|
),
|
|
5864
|
-
classUsage:
|
|
6011
|
+
classUsage: import_zod5.z.record(import_zod5.z.string(), import_zod5.z.number())
|
|
5865
6012
|
}).optional()
|
|
5866
6013
|
});
|
|
5867
6014
|
var parseEngineOptions = (options) => parseWithSchema3(EngineOptionsSchema, options ?? {}, "engine options are invalid");
|
|
@@ -5875,7 +6022,7 @@ function getNativeWatcher() {
|
|
|
5875
6022
|
const { resolveNativeBinary: resolveNativeBinary2 } = (init_src(), __toCommonJS(src_exports));
|
|
5876
6023
|
const { path: binPath } = resolveNativeBinary2(__dirname);
|
|
5877
6024
|
if (binPath) {
|
|
5878
|
-
_native2 =
|
|
6025
|
+
_native2 = require(binPath);
|
|
5879
6026
|
}
|
|
5880
6027
|
} catch {
|
|
5881
6028
|
_native2 = {};
|
|
@@ -5960,11 +6107,11 @@ var configState = {
|
|
|
5960
6107
|
var log6 = createLogger2("engine");
|
|
5961
6108
|
async function loadTailwindConfigFromPath(root, tailwindConfigPath) {
|
|
5962
6109
|
if (!tailwindConfigPath) return void 0;
|
|
5963
|
-
const configPath =
|
|
5964
|
-
if (!
|
|
6110
|
+
const configPath = import_node_path13.default.resolve(root, tailwindConfigPath);
|
|
6111
|
+
if (!import_node_fs11.default.existsSync(configPath)) {
|
|
5965
6112
|
throw TwError.fromIo("CONFIG_NOT_FOUND", `tailwindConfigPath not found: ${configPath}`);
|
|
5966
6113
|
}
|
|
5967
|
-
const imported = await import(
|
|
6114
|
+
const imported = await import((0, import_node_url6.pathToFileURL)(configPath).href);
|
|
5968
6115
|
const config = imported.default ?? imported;
|
|
5969
6116
|
return config;
|
|
5970
6117
|
}
|
|
@@ -6027,11 +6174,11 @@ async function buildFromScan(scan, root, options, tailwindConfig) {
|
|
|
6027
6174
|
};
|
|
6028
6175
|
}
|
|
6029
6176
|
function countWorkspacePackages(root) {
|
|
6030
|
-
const packagesDir =
|
|
6031
|
-
if (!
|
|
6177
|
+
const packagesDir = import_node_path13.default.join(root, "packages");
|
|
6178
|
+
if (!import_node_fs11.default.existsSync(packagesDir)) return 0;
|
|
6032
6179
|
try {
|
|
6033
|
-
return
|
|
6034
|
-
(entry) => entry.isDirectory() &&
|
|
6180
|
+
return import_node_fs11.default.readdirSync(packagesDir, { withFileTypes: true }).filter(
|
|
6181
|
+
(entry) => entry.isDirectory() && import_node_fs11.default.existsSync(import_node_path13.default.join(packagesDir, entry.name, "package.json"))
|
|
6035
6182
|
).length;
|
|
6036
6183
|
} catch (err) {
|
|
6037
6184
|
log6.debug(`countWorkspacePackages: ${err instanceof Error ? err.message : String(err)}`);
|
|
@@ -6068,7 +6215,7 @@ function writeDashboardMetrics(root, mode, result, metrics) {
|
|
|
6068
6215
|
async function createEngine(rawOptions = {}) {
|
|
6069
6216
|
const options = parseEngineOptions(rawOptions);
|
|
6070
6217
|
const root = options.root ?? process.cwd();
|
|
6071
|
-
const resolvedRoot =
|
|
6218
|
+
const resolvedRoot = import_node_path13.default.resolve(root);
|
|
6072
6219
|
const plugins = rawOptions.plugins ?? [];
|
|
6073
6220
|
const getTailwindConfig = async () => {
|
|
6074
6221
|
if (configState.isLoaded()) return configState.getConfig();
|
|
@@ -6215,7 +6362,7 @@ async function createEngine(rawOptions = {}) {
|
|
|
6215
6362
|
const shouldForceFullRescan = (event) => {
|
|
6216
6363
|
if (event.type === "unlink") return false;
|
|
6217
6364
|
try {
|
|
6218
|
-
const stat =
|
|
6365
|
+
const stat = import_node_fs11.default.statSync(event.filePath);
|
|
6219
6366
|
if (stat.size > largeFileThreshold) {
|
|
6220
6367
|
metrics.markSkippedLargeFile();
|
|
6221
6368
|
return true;
|
|
@@ -6334,6 +6481,7 @@ async function createEngine(rawOptions = {}) {
|
|
|
6334
6481
|
}
|
|
6335
6482
|
|
|
6336
6483
|
// packages/presentation/vite/src/schemas.ts
|
|
6484
|
+
var import_zod6 = require("zod");
|
|
6337
6485
|
init_src();
|
|
6338
6486
|
var formatIssuePath4 = (path16) => path16.length > 0 ? path16.map(
|
|
6339
6487
|
(segment) => typeof segment === "symbol" ? segment.description ?? segment.toString() : String(segment)
|
|
@@ -6353,23 +6501,23 @@ var parseWithSchema4 = (schema, data, label) => {
|
|
|
6353
6501
|
parsed.error
|
|
6354
6502
|
);
|
|
6355
6503
|
};
|
|
6356
|
-
var VitePluginOptionsSchema =
|
|
6357
|
-
include:
|
|
6358
|
-
exclude:
|
|
6359
|
-
scanDirs:
|
|
6360
|
-
safelistOutput:
|
|
6361
|
-
generateSafelist:
|
|
6362
|
-
scanReportOutput:
|
|
6363
|
-
useEngineBuild:
|
|
6364
|
-
analyze:
|
|
6365
|
-
strict:
|
|
6366
|
-
mode:
|
|
6367
|
-
routeCss:
|
|
6368
|
-
deadStyleElimination:
|
|
6369
|
-
addDataAttr:
|
|
6370
|
-
autoClientBoundary:
|
|
6371
|
-
hoist:
|
|
6372
|
-
incremental:
|
|
6504
|
+
var VitePluginOptionsSchema = import_zod6.z.object({
|
|
6505
|
+
include: import_zod6.z.instanceof(RegExp).optional(),
|
|
6506
|
+
exclude: import_zod6.z.instanceof(RegExp).optional(),
|
|
6507
|
+
scanDirs: import_zod6.z.array(import_zod6.z.string()).optional(),
|
|
6508
|
+
safelistOutput: import_zod6.z.string().optional(),
|
|
6509
|
+
generateSafelist: import_zod6.z.boolean().optional(),
|
|
6510
|
+
scanReportOutput: import_zod6.z.string().optional(),
|
|
6511
|
+
useEngineBuild: import_zod6.z.boolean().optional(),
|
|
6512
|
+
analyze: import_zod6.z.boolean().optional(),
|
|
6513
|
+
strict: import_zod6.z.boolean().optional(),
|
|
6514
|
+
mode: import_zod6.z.enum(["zero-runtime", "runtime"]).optional(),
|
|
6515
|
+
routeCss: import_zod6.z.boolean().optional(),
|
|
6516
|
+
deadStyleElimination: import_zod6.z.boolean().optional(),
|
|
6517
|
+
addDataAttr: import_zod6.z.boolean().optional(),
|
|
6518
|
+
autoClientBoundary: import_zod6.z.boolean().optional(),
|
|
6519
|
+
hoist: import_zod6.z.boolean().optional(),
|
|
6520
|
+
incremental: import_zod6.z.boolean().optional()
|
|
6373
6521
|
});
|
|
6374
6522
|
var parseVitePluginOptions = (options) => parseWithSchema4(VitePluginOptionsSchema, options ?? {}, "vite plugin options are invalid");
|
|
6375
6523
|
|
|
@@ -6381,14 +6529,14 @@ function warnDeprecated(options, key, message) {
|
|
|
6381
6529
|
}
|
|
6382
6530
|
}
|
|
6383
6531
|
function isInsideDirectory(filePath, directory) {
|
|
6384
|
-
const relative =
|
|
6385
|
-
return relative === "" || !relative.startsWith("..") && !
|
|
6532
|
+
const relative = import_node_path14.default.relative(directory, filePath);
|
|
6533
|
+
return relative === "" || !relative.startsWith("..") && !import_node_path14.default.isAbsolute(relative);
|
|
6386
6534
|
}
|
|
6387
6535
|
function filterScanToDirs(scan, root, scanDirs) {
|
|
6388
|
-
const resolvedDirs = scanDirs.map((dir) =>
|
|
6536
|
+
const resolvedDirs = scanDirs.map((dir) => import_node_path14.default.resolve(root, dir));
|
|
6389
6537
|
if (resolvedDirs.length === 0) return scan;
|
|
6390
6538
|
const files = scan.files.filter((file) => {
|
|
6391
|
-
const absoluteFile =
|
|
6539
|
+
const absoluteFile = import_node_path14.default.resolve(file.file);
|
|
6392
6540
|
return resolvedDirs.some((directory) => isInsideDirectory(absoluteFile, directory));
|
|
6393
6541
|
});
|
|
6394
6542
|
const uniqueClasses = Array.from(new Set(files.flatMap((file) => file.classes))).sort();
|
|
@@ -6399,9 +6547,9 @@ function filterScanToDirs(scan, root, scanDirs) {
|
|
|
6399
6547
|
};
|
|
6400
6548
|
}
|
|
6401
6549
|
function writeJsonArtifact(root, relativePath, value) {
|
|
6402
|
-
const outputPath =
|
|
6403
|
-
|
|
6404
|
-
|
|
6550
|
+
const outputPath = import_node_path14.default.resolve(root, relativePath);
|
|
6551
|
+
import_node_fs12.default.mkdirSync(import_node_path14.default.dirname(outputPath), { recursive: true });
|
|
6552
|
+
import_node_fs12.default.writeFileSync(outputPath, `${JSON.stringify(value, null, 2)}
|
|
6405
6553
|
`);
|
|
6406
6554
|
}
|
|
6407
6555
|
function tailwindStyledPlugin(opts = {}) {
|
|
@@ -6442,7 +6590,7 @@ function tailwindStyledPlugin(opts = {}) {
|
|
|
6442
6590
|
return rules.join("\n");
|
|
6443
6591
|
}
|
|
6444
6592
|
function getStaticCssOutputPath(root, safelistOutputPath) {
|
|
6445
|
-
return
|
|
6593
|
+
return import_node_path14.default.resolve(root, import_node_path14.default.dirname(safelistOutputPath), "_tw-state-static.css");
|
|
6446
6594
|
}
|
|
6447
6595
|
function flushStaticCss(root) {
|
|
6448
6596
|
if (staticCssPerFile.size === 0) return;
|
|
@@ -6451,8 +6599,8 @@ function tailwindStyledPlugin(opts = {}) {
|
|
|
6451
6599
|
if (!deduped.trim()) return;
|
|
6452
6600
|
const outPath = getStaticCssOutputPath(root, safelistOutput);
|
|
6453
6601
|
try {
|
|
6454
|
-
|
|
6455
|
-
|
|
6602
|
+
import_node_fs12.default.mkdirSync(import_node_path14.default.dirname(outPath), { recursive: true });
|
|
6603
|
+
import_node_fs12.default.writeFileSync(
|
|
6456
6604
|
outPath,
|
|
6457
6605
|
`/* _tw-state-static.css \u2014 Auto-generated by tailwind-styled-v4. DO NOT EDIT.
|
|
6458
6606
|
* Import this in globals.css: @import "./_tw-state-static.css";
|
|
@@ -6484,17 +6632,17 @@ ${deduped}
|
|
|
6484
6632
|
"src/style.css"
|
|
6485
6633
|
];
|
|
6486
6634
|
for (const candidate of CSS_CANDIDATES) {
|
|
6487
|
-
const candidatePath =
|
|
6488
|
-
if (!
|
|
6489
|
-
const content =
|
|
6635
|
+
const candidatePath = import_node_path14.default.resolve(config.root, candidate);
|
|
6636
|
+
if (!import_node_fs12.default.existsSync(candidatePath)) continue;
|
|
6637
|
+
const content = import_node_fs12.default.readFileSync(candidatePath, "utf-8");
|
|
6490
6638
|
if (content.includes("_tw-state-static.css")) break;
|
|
6491
|
-
const rel =
|
|
6639
|
+
const rel = import_node_path14.default.relative(import_node_path14.default.dirname(candidatePath), outPath).replace(/\\/g, "/");
|
|
6492
6640
|
const importLine = `@import "./${rel}";`;
|
|
6493
6641
|
const tailwindImportRe = /(@import\s+["']tailwindcss["']\s*;[^\n]*\n?)/;
|
|
6494
6642
|
const updated = tailwindImportRe.test(content) ? content.replace(tailwindImportRe, `$1${importLine}
|
|
6495
6643
|
`) : `${importLine}
|
|
6496
6644
|
${content}`;
|
|
6497
|
-
|
|
6645
|
+
import_node_fs12.default.writeFileSync(candidatePath, updated, "utf-8");
|
|
6498
6646
|
break;
|
|
6499
6647
|
}
|
|
6500
6648
|
} catch {
|
|
@@ -6578,7 +6726,8 @@ ${content}`;
|
|
|
6578
6726
|
}
|
|
6579
6727
|
};
|
|
6580
6728
|
}
|
|
6581
|
-
|
|
6582
|
-
exports
|
|
6583
|
-
|
|
6729
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
6730
|
+
0 && (module.exports = {
|
|
6731
|
+
tailwindStyledPlugin
|
|
6732
|
+
});
|
|
6584
6733
|
//# sourceMappingURL=vite.js.map
|