tailwind-styled-v4 5.0.36 → 5.0.38
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/analyzer.d.mts +152 -5
- package/dist/analyzer.d.ts +152 -5
- package/dist/analyzer.js +213 -161
- package/dist/analyzer.js.map +1 -1
- package/dist/analyzer.mjs +118 -82
- package/dist/analyzer.mjs.map +1 -1
- package/dist/animate.d.mts +30 -3
- package/dist/animate.d.ts +30 -3
- package/dist/animate.js +131 -87
- package/dist/animate.js.map +1 -1
- package/dist/animate.mjs +28 -14
- package/dist/animate.mjs.map +1 -1
- package/dist/atomic.js +105 -68
- package/dist/atomic.js.map +1 -1
- package/dist/atomic.mjs +40 -13
- package/dist/atomic.mjs.map +1 -1
- package/dist/cli.js +577 -426
- package/dist/cli.js.map +1 -1
- package/dist/cli.mjs +466 -304
- package/dist/cli.mjs.map +1 -1
- package/dist/compiler.d.mts +5 -0
- package/dist/compiler.d.ts +5 -0
- package/dist/compiler.js +826 -508
- package/dist/compiler.js.map +1 -1
- package/dist/compiler.mjs +287 -29
- package/dist/compiler.mjs.map +1 -1
- package/dist/dashboard.js +71 -41
- package/dist/dashboard.js.map +1 -1
- package/dist/dashboard.mjs +12 -6
- package/dist/dashboard.mjs.map +1 -1
- package/dist/devtools.d.mts +88 -2
- package/dist/devtools.d.ts +88 -2
- package/dist/devtools.js +333 -289
- package/dist/devtools.js.map +1 -1
- package/dist/devtools.mjs +26 -11
- package/dist/devtools.mjs.map +1 -1
- package/dist/engine.d.mts +557 -6
- package/dist/engine.d.ts +557 -6
- package/dist/engine.js +679 -502
- package/dist/engine.js.map +1 -1
- package/dist/engine.mjs +467 -307
- package/dist/engine.mjs.map +1 -1
- package/dist/index.d.mts +180 -127
- package/dist/index.d.ts +180 -127
- package/dist/index.js +1329 -7441
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1266 -7385
- package/dist/index.mjs.map +1 -1
- package/dist/next.js +318 -243
- package/dist/next.js.map +1 -1
- package/dist/next.mjs +256 -181
- package/dist/next.mjs.map +1 -1
- package/dist/plugin-api.d.mts +4 -2
- package/dist/plugin-api.d.ts +4 -2
- package/dist/plugin-api.js +93 -49
- package/dist/plugin-api.js.map +1 -1
- package/dist/plugin-api.mjs +26 -6
- package/dist/plugin-api.mjs.map +1 -1
- package/dist/plugin-registry.js +103 -62
- package/dist/plugin-registry.js.map +1 -1
- package/dist/plugin-registry.mjs +53 -35
- package/dist/plugin-registry.mjs.map +1 -1
- package/dist/plugin.d.mts +165 -5
- package/dist/plugin.d.ts +165 -5
- package/dist/plugin.js +115 -50
- package/dist/plugin.js.map +1 -1
- package/dist/plugin.mjs +44 -6
- package/dist/plugin.mjs.map +1 -1
- package/dist/preset.js +47 -15
- package/dist/preset.js.map +1 -1
- package/dist/preset.mjs +13 -5
- package/dist/preset.mjs.map +1 -1
- package/dist/rspack.js +82 -50
- package/dist/rspack.js.map +1 -1
- package/dist/rspack.mjs +20 -12
- package/dist/rspack.mjs.map +1 -1
- package/dist/runtime-css.js +62 -24
- package/dist/runtime-css.js.map +1 -1
- package/dist/runtime-css.mjs +15 -7
- package/dist/runtime-css.mjs.map +1 -1
- package/dist/runtime.d.mts +38 -3
- package/dist/runtime.d.ts +38 -3
- package/dist/runtime.js +97 -44
- package/dist/runtime.js.map +1 -1
- package/dist/runtime.mjs +31 -8
- package/dist/runtime.mjs.map +1 -1
- package/dist/scanner.d.mts +58 -4
- package/dist/scanner.d.ts +58 -4
- package/dist/scanner.js +163 -120
- package/dist/scanner.js.map +1 -1
- package/dist/scanner.mjs +67 -39
- package/dist/scanner.mjs.map +1 -1
- package/dist/shared.d.mts +185 -3
- package/dist/shared.d.ts +185 -3
- package/dist/shared.js +441 -295
- package/dist/shared.js.map +1 -1
- package/dist/shared.mjs +253 -122
- package/dist/shared.mjs.map +1 -1
- package/dist/storybook-addon.d.mts +2 -2
- package/dist/storybook-addon.d.ts +2 -2
- package/dist/storybook-addon.js +39 -10
- package/dist/storybook-addon.js.map +1 -1
- package/dist/storybook-addon.mjs +8 -3
- package/dist/storybook-addon.mjs.map +1 -1
- package/dist/svelte.d.mts +2 -1
- package/dist/svelte.d.ts +2 -1
- package/dist/svelte.js +88 -64
- package/dist/svelte.js.map +1 -1
- package/dist/svelte.mjs +28 -13
- package/dist/svelte.mjs.map +1 -1
- package/dist/syntax.js +68 -37
- package/dist/syntax.js.map +1 -1
- package/dist/syntax.mjs +8 -7
- package/dist/syntax.mjs.map +1 -1
- package/dist/testing.js +55 -18
- package/dist/testing.js.map +1 -1
- package/dist/testing.mjs +16 -3
- package/dist/testing.mjs.map +1 -1
- package/dist/theme.d.mts +38 -3
- package/dist/theme.d.ts +38 -3
- package/dist/theme.js +131 -74
- package/dist/theme.js.map +1 -1
- package/dist/theme.mjs +42 -13
- package/dist/theme.mjs.map +1 -1
- package/dist/turbopackLoader.js +150 -116
- package/dist/turbopackLoader.js.map +1 -1
- package/dist/turbopackLoader.mjs +124 -81
- package/dist/turbopackLoader.mjs.map +1 -1
- package/dist/tw.js +560 -421
- package/dist/tw.js.map +1 -1
- package/dist/tw.mjs +460 -302
- package/dist/tw.mjs.map +1 -1
- package/dist/vite.js +561 -446
- package/dist/vite.js.map +1 -1
- package/dist/vite.mjs +433 -321
- package/dist/vite.mjs.map +1 -1
- package/dist/vue.d.mts +4 -1
- package/dist/vue.d.ts +4 -1
- package/dist/vue.js +95 -70
- package/dist/vue.js.map +1 -1
- package/dist/vue.mjs +30 -14
- package/dist/vue.mjs.map +1 -1
- package/dist/webpackLoader.js +110 -78
- package/dist/webpackLoader.js.map +1 -1
- package/dist/webpackLoader.mjs +45 -17
- package/dist/webpackLoader.mjs.map +1 -1
- package/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/analyzeWorkspace-B1_XRfdl.d.ts +0 -134
- package/dist/analyzeWorkspace-hYfu4Hg3.d.mts +0 -134
- package/dist/index-DQI6O24n.d.mts +0 -464
- package/dist/index-NDINUhLN.d.mts +0 -90
- package/dist/index-NDINUhLN.d.ts +0 -90
- package/dist/index-UkYbyBkR.d.ts +0 -464
- package/dist/liveTokenEngine-CN9ian1R.d.ts +0 -38
- package/dist/liveTokenEngine-DKoWRtqH.d.mts +0 -38
- package/dist/schemas-DR-SLxZZ.d.mts +0 -59
- package/dist/schemas-DR-SLxZZ.d.ts +0 -59
- package/dist/trace-Dz4vmZdy.d.mts +0 -96
- package/dist/trace-Dz4vmZdy.d.ts +0 -96
- package/dist/types-DXr2PmGP.d.mts +0 -31
- package/dist/types-DXr2PmGP.d.ts +0 -31
package/dist/vite.js
CHANGED
|
@@ -1,48 +1,11 @@
|
|
|
1
|
-
'use strict';
|
|
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
|
-
|
|
35
1
|
/* tailwind-styled-v4 v5.0.4 | MIT | https://github.com/dictionar32/tailwind-styled-v4 */
|
|
2
|
+
"use strict";
|
|
3
|
+
var __create = Object.create;
|
|
36
4
|
var __defProp = Object.defineProperty;
|
|
37
5
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
38
6
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
39
8
|
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
9
|
var __esm = (fn, res) => function __init() {
|
|
47
10
|
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
48
11
|
};
|
|
@@ -58,6 +21,14 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
58
21
|
}
|
|
59
22
|
return to;
|
|
60
23
|
};
|
|
24
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
25
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
26
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
27
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
28
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
29
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
30
|
+
mod
|
|
31
|
+
));
|
|
61
32
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
62
33
|
|
|
63
34
|
// packages/domain/shared/src/trace.ts
|
|
@@ -152,6 +123,7 @@ function getPipelinePercentages(metrics) {
|
|
|
152
123
|
}
|
|
153
124
|
var init_trace = __esm({
|
|
154
125
|
"packages/domain/shared/src/trace.ts"() {
|
|
126
|
+
"use strict";
|
|
155
127
|
}
|
|
156
128
|
});
|
|
157
129
|
|
|
@@ -166,6 +138,7 @@ function formatErrorCode(code) {
|
|
|
166
138
|
var ERROR_CODES, ERROR_SUGGESTIONS;
|
|
167
139
|
var init_error_codes = __esm({
|
|
168
140
|
"packages/domain/shared/src/error-codes.ts"() {
|
|
141
|
+
"use strict";
|
|
169
142
|
ERROR_CODES = {
|
|
170
143
|
// E0xx — Native binding
|
|
171
144
|
NATIVE_NOT_FOUND: "E001",
|
|
@@ -207,8 +180,8 @@ var init_error_codes = __esm({
|
|
|
207
180
|
// packages/domain/shared/src/compatibility.ts
|
|
208
181
|
function detectTailwind() {
|
|
209
182
|
try {
|
|
210
|
-
const pkgPath =
|
|
211
|
-
const { version } =
|
|
183
|
+
const pkgPath = require.resolve("tailwindcss/package.json");
|
|
184
|
+
const { version } = require(pkgPath);
|
|
212
185
|
const major = Number.parseInt(version.split(".")[0], 10);
|
|
213
186
|
return { version, major, supported: major >= 4, path: pkgPath };
|
|
214
187
|
} catch {
|
|
@@ -232,8 +205,11 @@ function isTailwindV4() {
|
|
|
232
205
|
}
|
|
233
206
|
var init_compatibility = __esm({
|
|
234
207
|
"packages/domain/shared/src/compatibility.ts"() {
|
|
208
|
+
"use strict";
|
|
235
209
|
}
|
|
236
210
|
});
|
|
211
|
+
|
|
212
|
+
// packages/domain/shared/src/native-schemas.ts
|
|
237
213
|
function safeParseNative(schema, data, fallback) {
|
|
238
214
|
const result = schema.safeParse(data);
|
|
239
215
|
return result.success ? result.data : fallback;
|
|
@@ -249,67 +225,69 @@ function parseNative(schema, data, context) {
|
|
|
249
225
|
}
|
|
250
226
|
return result.data;
|
|
251
227
|
}
|
|
252
|
-
var NativeScanFileSchema, NativeScanResultSchema, NativeClassUsageSchema, NativeAnalyzerReportSchema, NativeTransformResultSchema, NativeCssCompileResultSchema, NativeWatchResultSchema, NativeCacheEntrySchema, NativeCacheReadResultSchema;
|
|
228
|
+
var import_zod, NativeScanFileSchema, NativeScanResultSchema, NativeClassUsageSchema, NativeAnalyzerReportSchema, NativeTransformResultSchema, NativeCssCompileResultSchema, NativeWatchEventSchema, NativeWatchResultSchema, NativeCacheEntrySchema, NativeCacheReadResultSchema;
|
|
253
229
|
var init_native_schemas = __esm({
|
|
254
230
|
"packages/domain/shared/src/native-schemas.ts"() {
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
231
|
+
"use strict";
|
|
232
|
+
import_zod = require("zod");
|
|
233
|
+
NativeScanFileSchema = import_zod.z.object({
|
|
234
|
+
file: import_zod.z.string().min(1, "file path cannot be empty"),
|
|
235
|
+
classes: import_zod.z.array(import_zod.z.string()),
|
|
236
|
+
hash: import_zod.z.string().optional()
|
|
259
237
|
});
|
|
260
|
-
NativeScanResultSchema =
|
|
261
|
-
files:
|
|
262
|
-
totalFiles:
|
|
263
|
-
uniqueClasses:
|
|
238
|
+
NativeScanResultSchema = import_zod.z.object({
|
|
239
|
+
files: import_zod.z.array(NativeScanFileSchema),
|
|
240
|
+
totalFiles: import_zod.z.number().int().nonnegative(),
|
|
241
|
+
uniqueClasses: import_zod.z.array(import_zod.z.string())
|
|
264
242
|
});
|
|
265
|
-
NativeClassUsageSchema =
|
|
266
|
-
name:
|
|
267
|
-
count:
|
|
268
|
-
files:
|
|
243
|
+
NativeClassUsageSchema = import_zod.z.object({
|
|
244
|
+
name: import_zod.z.string(),
|
|
245
|
+
count: import_zod.z.number().int().nonnegative(),
|
|
246
|
+
files: import_zod.z.array(import_zod.z.string()).optional()
|
|
269
247
|
});
|
|
270
|
-
NativeAnalyzerReportSchema =
|
|
271
|
-
root:
|
|
272
|
-
topClasses:
|
|
273
|
-
safelist:
|
|
274
|
-
css:
|
|
275
|
-
conflicts:
|
|
276
|
-
unusedClasses:
|
|
277
|
-
durationMs:
|
|
248
|
+
NativeAnalyzerReportSchema = import_zod.z.object({
|
|
249
|
+
root: import_zod.z.string(),
|
|
250
|
+
topClasses: import_zod.z.array(NativeClassUsageSchema).optional(),
|
|
251
|
+
safelist: import_zod.z.array(import_zod.z.string()).optional(),
|
|
252
|
+
css: import_zod.z.string().optional(),
|
|
253
|
+
conflicts: import_zod.z.array(import_zod.z.unknown()).optional(),
|
|
254
|
+
unusedClasses: import_zod.z.array(import_zod.z.string()).optional(),
|
|
255
|
+
durationMs: import_zod.z.number().nonnegative().optional()
|
|
278
256
|
});
|
|
279
|
-
NativeTransformResultSchema =
|
|
280
|
-
code:
|
|
281
|
-
classes:
|
|
282
|
-
changed:
|
|
283
|
-
rsc:
|
|
284
|
-
isServer:
|
|
285
|
-
needsClientDirective:
|
|
286
|
-
clientReasons:
|
|
257
|
+
NativeTransformResultSchema = import_zod.z.object({
|
|
258
|
+
code: import_zod.z.string(),
|
|
259
|
+
classes: import_zod.z.array(import_zod.z.string()),
|
|
260
|
+
changed: import_zod.z.boolean(),
|
|
261
|
+
rsc: import_zod.z.object({
|
|
262
|
+
isServer: import_zod.z.boolean(),
|
|
263
|
+
needsClientDirective: import_zod.z.boolean(),
|
|
264
|
+
clientReasons: import_zod.z.array(import_zod.z.string())
|
|
287
265
|
}).optional()
|
|
288
266
|
});
|
|
289
|
-
NativeCssCompileResultSchema =
|
|
290
|
-
css:
|
|
291
|
-
resolvedClasses:
|
|
292
|
-
unresolvedClasses:
|
|
267
|
+
NativeCssCompileResultSchema = import_zod.z.object({
|
|
268
|
+
css: import_zod.z.string(),
|
|
269
|
+
resolvedClasses: import_zod.z.array(import_zod.z.string()),
|
|
270
|
+
unresolvedClasses: import_zod.z.array(import_zod.z.string()).optional()
|
|
293
271
|
});
|
|
294
|
-
|
|
295
|
-
type:
|
|
296
|
-
path:
|
|
272
|
+
NativeWatchEventSchema = import_zod.z.object({
|
|
273
|
+
type: import_zod.z.enum(["change", "unlink", "create"]),
|
|
274
|
+
path: import_zod.z.string()
|
|
297
275
|
});
|
|
298
|
-
NativeWatchResultSchema =
|
|
299
|
-
status:
|
|
300
|
-
handleId:
|
|
301
|
-
error:
|
|
276
|
+
NativeWatchResultSchema = import_zod.z.object({
|
|
277
|
+
status: import_zod.z.enum(["ok", "error"]),
|
|
278
|
+
handleId: import_zod.z.string().optional(),
|
|
279
|
+
error: import_zod.z.string().optional()
|
|
302
280
|
});
|
|
303
|
-
NativeCacheEntrySchema =
|
|
304
|
-
file:
|
|
305
|
-
hash:
|
|
306
|
-
classes:
|
|
307
|
-
timestamp:
|
|
308
|
-
size:
|
|
281
|
+
NativeCacheEntrySchema = import_zod.z.object({
|
|
282
|
+
file: import_zod.z.string(),
|
|
283
|
+
hash: import_zod.z.string(),
|
|
284
|
+
classes: import_zod.z.array(import_zod.z.string()),
|
|
285
|
+
timestamp: import_zod.z.number(),
|
|
286
|
+
size: import_zod.z.number().optional()
|
|
309
287
|
});
|
|
310
|
-
NativeCacheReadResultSchema =
|
|
311
|
-
entries:
|
|
312
|
-
version:
|
|
288
|
+
NativeCacheReadResultSchema = import_zod.z.object({
|
|
289
|
+
entries: import_zod.z.array(NativeCacheEntrySchema),
|
|
290
|
+
version: import_zod.z.string().optional()
|
|
313
291
|
});
|
|
314
292
|
}
|
|
315
293
|
});
|
|
@@ -319,7 +297,7 @@ function getNodeModuleRef() {
|
|
|
319
297
|
if (isBrowser) return null;
|
|
320
298
|
if (nodeModuleRef !== null) return nodeModuleRef;
|
|
321
299
|
try {
|
|
322
|
-
const test = typeof
|
|
300
|
+
const test = typeof require === "function" ? require("module") : null;
|
|
323
301
|
nodeModuleRef = test;
|
|
324
302
|
return test;
|
|
325
303
|
} catch {
|
|
@@ -331,21 +309,21 @@ function getNodePath() {
|
|
|
331
309
|
if (isBrowser) throw new Error("node:path not available in browser");
|
|
332
310
|
const nodeRequire = getNodeModuleRef();
|
|
333
311
|
if (!nodeRequire) throw new Error("require not available");
|
|
334
|
-
if (!_nodePath) _nodePath = nodeRequire.createRequire(
|
|
312
|
+
if (!_nodePath) _nodePath = nodeRequire.createRequire(import_meta.url)("node:path");
|
|
335
313
|
return _nodePath;
|
|
336
314
|
}
|
|
337
315
|
function getNodeUrl() {
|
|
338
316
|
if (isBrowser) throw new Error("node:url not available in browser");
|
|
339
317
|
const nodeRequire = getNodeModuleRef();
|
|
340
318
|
if (!nodeRequire) throw new Error("require not available");
|
|
341
|
-
if (!_nodeUrl) _nodeUrl = nodeRequire.createRequire(
|
|
319
|
+
if (!_nodeUrl) _nodeUrl = nodeRequire.createRequire(import_meta.url)("node:url");
|
|
342
320
|
return _nodeUrl;
|
|
343
321
|
}
|
|
344
322
|
function getNodeFs() {
|
|
345
323
|
if (isBrowser) throw new Error("node:fs not available in browser");
|
|
346
324
|
const nodeRequire = getNodeModuleRef();
|
|
347
325
|
if (!nodeRequire) throw new Error("require not available");
|
|
348
|
-
if (!_nodeFs) _nodeFs = nodeRequire.createRequire(
|
|
326
|
+
if (!_nodeFs) _nodeFs = nodeRequire.createRequire(import_meta.url)("node:fs");
|
|
349
327
|
return _nodeFs;
|
|
350
328
|
}
|
|
351
329
|
function createEsmRequire(importMetaUrl) {
|
|
@@ -368,7 +346,7 @@ function resolveFromRoot(...segments) {
|
|
|
368
346
|
if (isBrowser) return segments.join("/");
|
|
369
347
|
const nodePath = getNodePath();
|
|
370
348
|
const nodeFs = getNodeFs();
|
|
371
|
-
let dir = getDirname(
|
|
349
|
+
let dir = getDirname(import_meta.url);
|
|
372
350
|
for (let i = 0; i < 10; i++) {
|
|
373
351
|
const pkgPath = nodePath.join(dir, "package.json");
|
|
374
352
|
try {
|
|
@@ -394,9 +372,11 @@ function resolveNativeNodePath(importMetaUrl, ...relativeSegments) {
|
|
|
394
372
|
if (isBrowser) return relativeSegments.join("/");
|
|
395
373
|
return getNodePath().resolve(getDirname(importMetaUrl), ...relativeSegments);
|
|
396
374
|
}
|
|
397
|
-
var isBrowser, nodeModuleRef, _nodePath, _nodeUrl, _nodeFs;
|
|
375
|
+
var import_meta, isBrowser, nodeModuleRef, _nodePath, _nodeUrl, _nodeFs;
|
|
398
376
|
var init_esmHelpers = __esm({
|
|
399
377
|
"packages/domain/shared/src/esmHelpers.ts"() {
|
|
378
|
+
"use strict";
|
|
379
|
+
import_meta = {};
|
|
400
380
|
isBrowser = typeof window !== "undefined" || typeof document !== "undefined";
|
|
401
381
|
nodeModuleRef = null;
|
|
402
382
|
_nodePath = null;
|
|
@@ -447,6 +427,7 @@ function createBuildTimer() {
|
|
|
447
427
|
var RING_BUFFER_SIZE, TelemetryCollector, _globalCollector;
|
|
448
428
|
var init_telemetry = __esm({
|
|
449
429
|
"packages/domain/shared/src/telemetry.ts"() {
|
|
430
|
+
"use strict";
|
|
450
431
|
RING_BUFFER_SIZE = 100;
|
|
451
432
|
TelemetryCollector = class {
|
|
452
433
|
data = [];
|
|
@@ -513,6 +494,8 @@ var init_telemetry = __esm({
|
|
|
513
494
|
_globalCollector = null;
|
|
514
495
|
}
|
|
515
496
|
});
|
|
497
|
+
|
|
498
|
+
// packages/domain/shared/src/configSchemas.ts
|
|
516
499
|
function parseJsonWithSchema(jsonString, schema, sourceName) {
|
|
517
500
|
let parsed;
|
|
518
501
|
try {
|
|
@@ -531,8 +514,8 @@ ${issues}`);
|
|
|
531
514
|
return result.data;
|
|
532
515
|
}
|
|
533
516
|
function parseJsonFileWithSchema(filePath, schema) {
|
|
534
|
-
const { readFileSync } =
|
|
535
|
-
const { basename } =
|
|
517
|
+
const { readFileSync } = require("fs");
|
|
518
|
+
const { basename } = require("path");
|
|
536
519
|
let content;
|
|
537
520
|
try {
|
|
538
521
|
content = readFileSync(filePath, "utf-8");
|
|
@@ -543,70 +526,72 @@ function parseJsonFileWithSchema(filePath, schema) {
|
|
|
543
526
|
}
|
|
544
527
|
return parseJsonWithSchema(content, schema, basename(filePath));
|
|
545
528
|
}
|
|
546
|
-
var ScanCacheClassEntrySchema, ScanCacheSchema, TailwindContentItemSchema, TailwindConfigSchema, RegistryPluginEntrySchema, RegistryFileSchema, PackageJsonSchema;
|
|
529
|
+
var import_zod2, ScanCacheClassEntrySchema, ScanCacheSchema, TailwindContentItemSchema, TailwindConfigSchema, RegistryPluginEntrySchema, RegistryFileSchema, PackageJsonSchema;
|
|
547
530
|
var init_configSchemas = __esm({
|
|
548
531
|
"packages/domain/shared/src/configSchemas.ts"() {
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
532
|
+
"use strict";
|
|
533
|
+
import_zod2 = require("zod");
|
|
534
|
+
ScanCacheClassEntrySchema = import_zod2.z.object({
|
|
535
|
+
name: import_zod2.z.string().min(1),
|
|
536
|
+
usedIn: import_zod2.z.array(import_zod2.z.string()),
|
|
537
|
+
risk: import_zod2.z.enum(["low", "medium", "high"]).default("low"),
|
|
538
|
+
bundleContribution: import_zod2.z.number().nonnegative().default(0),
|
|
539
|
+
variants: import_zod2.z.array(import_zod2.z.string()).default([])
|
|
555
540
|
});
|
|
556
|
-
ScanCacheSchema =
|
|
557
|
-
version:
|
|
558
|
-
generatedAt:
|
|
559
|
-
root:
|
|
560
|
-
classNames:
|
|
561
|
-
totalFiles:
|
|
562
|
-
uniqueCount:
|
|
541
|
+
ScanCacheSchema = import_zod2.z.object({
|
|
542
|
+
version: import_zod2.z.string().default("1"),
|
|
543
|
+
generatedAt: import_zod2.z.string(),
|
|
544
|
+
root: import_zod2.z.string(),
|
|
545
|
+
classNames: import_zod2.z.array(ScanCacheClassEntrySchema),
|
|
546
|
+
totalFiles: import_zod2.z.number().int().nonnegative(),
|
|
547
|
+
uniqueCount: import_zod2.z.number().int().nonnegative()
|
|
563
548
|
});
|
|
564
|
-
TailwindContentItemSchema =
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
raw:
|
|
568
|
-
extension:
|
|
549
|
+
TailwindContentItemSchema = import_zod2.z.union([
|
|
550
|
+
import_zod2.z.string(),
|
|
551
|
+
import_zod2.z.object({
|
|
552
|
+
raw: import_zod2.z.string(),
|
|
553
|
+
extension: import_zod2.z.string().optional()
|
|
569
554
|
}),
|
|
570
|
-
|
|
571
|
-
files:
|
|
572
|
-
transform:
|
|
555
|
+
import_zod2.z.object({
|
|
556
|
+
files: import_zod2.z.array(import_zod2.z.string()),
|
|
557
|
+
transform: import_zod2.z.record(import_zod2.z.string(), import_zod2.z.unknown()).optional()
|
|
573
558
|
})
|
|
574
559
|
]);
|
|
575
|
-
TailwindConfigSchema =
|
|
576
|
-
content:
|
|
577
|
-
theme:
|
|
578
|
-
plugins:
|
|
579
|
-
darkMode:
|
|
580
|
-
prefix:
|
|
581
|
-
safelist:
|
|
582
|
-
blocklist:
|
|
560
|
+
TailwindConfigSchema = import_zod2.z.object({
|
|
561
|
+
content: import_zod2.z.array(TailwindContentItemSchema).optional(),
|
|
562
|
+
theme: import_zod2.z.record(import_zod2.z.string(), import_zod2.z.unknown()).optional(),
|
|
563
|
+
plugins: import_zod2.z.array(import_zod2.z.unknown()).optional(),
|
|
564
|
+
darkMode: import_zod2.z.union([import_zod2.z.literal("class"), import_zod2.z.literal("media"), import_zod2.z.literal(false)]).optional(),
|
|
565
|
+
prefix: import_zod2.z.string().optional(),
|
|
566
|
+
safelist: import_zod2.z.array(import_zod2.z.union([import_zod2.z.string(), import_zod2.z.object({ pattern: import_zod2.z.instanceof(RegExp) })])).optional(),
|
|
567
|
+
blocklist: import_zod2.z.array(import_zod2.z.string()).optional()
|
|
583
568
|
}).passthrough();
|
|
584
|
-
RegistryPluginEntrySchema =
|
|
585
|
-
name:
|
|
586
|
-
description:
|
|
587
|
-
version:
|
|
588
|
-
tags:
|
|
589
|
-
official:
|
|
590
|
-
docs:
|
|
591
|
-
install:
|
|
592
|
-
integrity:
|
|
569
|
+
RegistryPluginEntrySchema = import_zod2.z.object({
|
|
570
|
+
name: import_zod2.z.string().min(1),
|
|
571
|
+
description: import_zod2.z.string(),
|
|
572
|
+
version: import_zod2.z.string(),
|
|
573
|
+
tags: import_zod2.z.array(import_zod2.z.string()).default([]),
|
|
574
|
+
official: import_zod2.z.boolean().default(false),
|
|
575
|
+
docs: import_zod2.z.string().url().optional(),
|
|
576
|
+
install: import_zod2.z.string().optional(),
|
|
577
|
+
integrity: import_zod2.z.string().optional()
|
|
593
578
|
});
|
|
594
|
-
RegistryFileSchema =
|
|
595
|
-
version:
|
|
596
|
-
official:
|
|
597
|
-
community:
|
|
579
|
+
RegistryFileSchema = import_zod2.z.object({
|
|
580
|
+
version: import_zod2.z.string(),
|
|
581
|
+
official: import_zod2.z.array(RegistryPluginEntrySchema).default([]),
|
|
582
|
+
community: import_zod2.z.array(RegistryPluginEntrySchema).default([])
|
|
598
583
|
});
|
|
599
|
-
PackageJsonSchema =
|
|
600
|
-
name:
|
|
601
|
-
version:
|
|
602
|
-
scripts:
|
|
603
|
-
dependencies:
|
|
604
|
-
devDependencies:
|
|
605
|
-
peerDependencies:
|
|
606
|
-
main:
|
|
607
|
-
module:
|
|
608
|
-
exports:
|
|
609
|
-
type:
|
|
584
|
+
PackageJsonSchema = import_zod2.z.object({
|
|
585
|
+
name: import_zod2.z.string(),
|
|
586
|
+
version: import_zod2.z.string(),
|
|
587
|
+
scripts: import_zod2.z.record(import_zod2.z.string(), import_zod2.z.string()).optional(),
|
|
588
|
+
dependencies: import_zod2.z.record(import_zod2.z.string(), import_zod2.z.string()).optional(),
|
|
589
|
+
devDependencies: import_zod2.z.record(import_zod2.z.string(), import_zod2.z.string()).optional(),
|
|
590
|
+
peerDependencies: import_zod2.z.record(import_zod2.z.string(), import_zod2.z.string()).optional(),
|
|
591
|
+
main: import_zod2.z.string().optional(),
|
|
592
|
+
module: import_zod2.z.string().optional(),
|
|
593
|
+
exports: import_zod2.z.unknown().optional(),
|
|
594
|
+
type: import_zod2.z.enum(["module", "commonjs"]).optional()
|
|
610
595
|
}).passthrough();
|
|
611
596
|
}
|
|
612
597
|
});
|
|
@@ -616,8 +601,8 @@ function getDirnameFromUrl(importMetaUrl) {
|
|
|
616
601
|
if (!importMetaUrl) return "";
|
|
617
602
|
if (isBrowser2) return "";
|
|
618
603
|
try {
|
|
619
|
-
const nodeUrl =
|
|
620
|
-
const nodePath =
|
|
604
|
+
const nodeUrl = require(NODE_URL);
|
|
605
|
+
const nodePath = require(NODE_PATH);
|
|
621
606
|
return nodePath.dirname(nodeUrl.fileURLToPath(importMetaUrl));
|
|
622
607
|
} catch {
|
|
623
608
|
if (importMetaUrl.startsWith("file://")) {
|
|
@@ -631,7 +616,7 @@ function getDirnameFromUrl(importMetaUrl) {
|
|
|
631
616
|
function resolvePath(...segments) {
|
|
632
617
|
if (isBrowser2) return segments.join("/").replace(/\/+/g, "/");
|
|
633
618
|
try {
|
|
634
|
-
const nodePath =
|
|
619
|
+
const nodePath = require(NODE_PATH);
|
|
635
620
|
return nodePath.resolve(...segments);
|
|
636
621
|
} catch {
|
|
637
622
|
return segments.join("/").replace(/\/+/g, "/");
|
|
@@ -640,7 +625,7 @@ function resolvePath(...segments) {
|
|
|
640
625
|
function existsSync(path16) {
|
|
641
626
|
if (isBrowser2) return false;
|
|
642
627
|
try {
|
|
643
|
-
const nodeFs =
|
|
628
|
+
const nodeFs = require(NODE_FS);
|
|
644
629
|
return nodeFs.existsSync(path16);
|
|
645
630
|
} catch {
|
|
646
631
|
return false;
|
|
@@ -694,6 +679,7 @@ function resolveLoaderPath(loaderBasename, importMetaUrl) {
|
|
|
694
679
|
var isBrowser2, NODE_URL, NODE_FS, NODE_PATH;
|
|
695
680
|
var init_workerResolver = __esm({
|
|
696
681
|
"packages/domain/shared/src/workerResolver.ts"() {
|
|
682
|
+
"use strict";
|
|
697
683
|
isBrowser2 = typeof window !== "undefined" || typeof document !== "undefined";
|
|
698
684
|
NODE_URL = typeof window === "undefined" || typeof document === "undefined" ? "node:url" : null;
|
|
699
685
|
NODE_FS = typeof window === "undefined" || typeof document === "undefined" ? "node:fs" : null;
|
|
@@ -843,13 +829,13 @@ function generateClassRenameCodemod(renames, opts = {}) {
|
|
|
843
829
|
}
|
|
844
830
|
return lines.join("\n");
|
|
845
831
|
}
|
|
846
|
-
function generateBarrelFile(
|
|
832
|
+
function generateBarrelFile(exports2, dir, opts = {}) {
|
|
847
833
|
const { includeTypes = true } = opts;
|
|
848
834
|
const lines = [];
|
|
849
835
|
lines.push(`// Auto-generated barrel file for ${dir}`);
|
|
850
836
|
lines.push(`// Run: npx tsx scripts/generate-barrel.ts to regenerate`);
|
|
851
837
|
lines.push(``);
|
|
852
|
-
for (const name of
|
|
838
|
+
for (const name of exports2) {
|
|
853
839
|
lines.push(`export { default as ${name}, type ${name}Props } from "./${name}"`);
|
|
854
840
|
if (includeTypes) {
|
|
855
841
|
lines.push(`export type * from "./${name}"`);
|
|
@@ -859,8 +845,11 @@ function generateBarrelFile(exports$1, dir, opts = {}) {
|
|
|
859
845
|
}
|
|
860
846
|
var init_codegen = __esm({
|
|
861
847
|
"packages/domain/shared/src/codegen.ts"() {
|
|
848
|
+
"use strict";
|
|
862
849
|
}
|
|
863
850
|
});
|
|
851
|
+
|
|
852
|
+
// packages/domain/shared/src/native-resolution.ts
|
|
864
853
|
function platformKey() {
|
|
865
854
|
if (isBrowser3) return "browser";
|
|
866
855
|
return `${process.platform}-${process.arch}`;
|
|
@@ -876,7 +865,7 @@ function resolveNativeBinary(runtimeDir) {
|
|
|
876
865
|
}
|
|
877
866
|
const envPath = process.env.TW_NATIVE_PATH?.trim();
|
|
878
867
|
if (envPath) {
|
|
879
|
-
if (
|
|
868
|
+
if (fs.existsSync(envPath)) {
|
|
880
869
|
return { path: envPath, source: "env", platform, tried };
|
|
881
870
|
}
|
|
882
871
|
tried.push(`env:${envPath} (not found)`);
|
|
@@ -885,7 +874,7 @@ function resolveNativeBinary(runtimeDir) {
|
|
|
885
874
|
for (const pkg of prebuiltPkgs) {
|
|
886
875
|
try {
|
|
887
876
|
const candidate = _require.resolve(`${pkg}/tailwind_styled_parser.node`);
|
|
888
|
-
if (
|
|
877
|
+
if (fs.existsSync(candidate)) {
|
|
889
878
|
return { path: candidate, source: "prebuilt", platform, tried };
|
|
890
879
|
}
|
|
891
880
|
tried.push(`prebuilt:${pkg} (resolved but missing)`);
|
|
@@ -896,13 +885,13 @@ function resolveNativeBinary(runtimeDir) {
|
|
|
896
885
|
const napiPlatform = platform === "linux-x64" ? "linux-x64-gnu" : platform === "linux-arm64" ? "linux-arm64-gnu" : platform;
|
|
897
886
|
const BINARY_NAMES_SELF = ["tailwind-styled-native", "tailwind_styled_parser"];
|
|
898
887
|
if (runtimeDir) {
|
|
899
|
-
for (const depth of ["..",
|
|
900
|
-
const pkgRoot =
|
|
888
|
+
for (const depth of ["..", path.join("..", ".."), path.join("..", "..", "..")]) {
|
|
889
|
+
const pkgRoot = path.resolve(runtimeDir, depth);
|
|
901
890
|
for (const bin of BINARY_NAMES_SELF) {
|
|
902
891
|
for (const suffix of ["", `.${platform}`, `.${napiPlatform}`]) {
|
|
903
|
-
const candidate =
|
|
892
|
+
const candidate = path.resolve(pkgRoot, "native", `${bin}${suffix}.node`);
|
|
904
893
|
tried.push(`self-bundled:${candidate}`);
|
|
905
|
-
if (
|
|
894
|
+
if (fs.existsSync(candidate)) {
|
|
906
895
|
return { path: candidate, source: "prebuilt", platform, tried };
|
|
907
896
|
}
|
|
908
897
|
}
|
|
@@ -914,29 +903,29 @@ function resolveNativeBinary(runtimeDir) {
|
|
|
914
903
|
const BINARY_NAMES = ["tailwind-styled-native", "tailwind_styled_parser"];
|
|
915
904
|
const localCandidates = [];
|
|
916
905
|
for (const bin of BINARY_NAMES) {
|
|
917
|
-
localCandidates.push(
|
|
918
|
-
localCandidates.push(
|
|
919
|
-
localCandidates.push(
|
|
920
|
-
localCandidates.push(
|
|
906
|
+
localCandidates.push(path.resolve(base, `${bin}.node`));
|
|
907
|
+
localCandidates.push(path.resolve(base, "..", `${bin}.node`));
|
|
908
|
+
localCandidates.push(path.resolve(base, `${bin}.${platform}.node`));
|
|
909
|
+
localCandidates.push(path.resolve(base, `${bin}.${napiPlatform}.node`));
|
|
921
910
|
}
|
|
922
911
|
for (const startDir of [cwd, base]) {
|
|
923
912
|
let dir = startDir;
|
|
924
913
|
for (let i = 0; i < 6; i++) {
|
|
925
|
-
const nativeDir =
|
|
914
|
+
const nativeDir = path.resolve(dir, "native");
|
|
926
915
|
for (const bin of BINARY_NAMES) {
|
|
927
|
-
localCandidates.push(
|
|
928
|
-
localCandidates.push(
|
|
929
|
-
localCandidates.push(
|
|
930
|
-
localCandidates.push(
|
|
916
|
+
localCandidates.push(path.resolve(nativeDir, `${bin}.node`));
|
|
917
|
+
localCandidates.push(path.resolve(nativeDir, `${bin}.${platform}.node`));
|
|
918
|
+
localCandidates.push(path.resolve(nativeDir, `${bin}.${napiPlatform}.node`));
|
|
919
|
+
localCandidates.push(path.resolve(nativeDir, "target", "release", `${bin}.node`));
|
|
931
920
|
}
|
|
932
|
-
const parent =
|
|
921
|
+
const parent = path.resolve(dir, "..");
|
|
933
922
|
if (parent === dir) break;
|
|
934
923
|
dir = parent;
|
|
935
924
|
}
|
|
936
925
|
}
|
|
937
926
|
for (const candidate of localCandidates) {
|
|
938
927
|
tried.push(`local:${candidate}`);
|
|
939
|
-
if (
|
|
928
|
+
if (fs.existsSync(candidate)) {
|
|
940
929
|
return { path: candidate, source: "local", platform, tried };
|
|
941
930
|
}
|
|
942
931
|
}
|
|
@@ -956,11 +945,16 @@ function formatNativeNotFoundError(result) {
|
|
|
956
945
|
];
|
|
957
946
|
return lines.join("\n");
|
|
958
947
|
}
|
|
959
|
-
var isBrowser3, _require, PLATFORM_MAP;
|
|
948
|
+
var import_node_module, fs, path, import_meta2, isBrowser3, _require, PLATFORM_MAP;
|
|
960
949
|
var init_native_resolution = __esm({
|
|
961
950
|
"packages/domain/shared/src/native-resolution.ts"() {
|
|
951
|
+
"use strict";
|
|
952
|
+
import_node_module = require("module");
|
|
953
|
+
fs = __toESM(require("fs"));
|
|
954
|
+
path = __toESM(require("path"));
|
|
955
|
+
import_meta2 = {};
|
|
962
956
|
isBrowser3 = typeof window !== "undefined" || typeof document !== "undefined";
|
|
963
|
-
_require = typeof
|
|
957
|
+
_require = typeof require !== "undefined" ? require : (0, import_node_module.createRequire)(import_meta2.url);
|
|
964
958
|
PLATFORM_MAP = {
|
|
965
959
|
"linux-x64": ["@tailwind-styled/native-linux-x64-gnu", "@tailwind-styled/native-linux-x64"],
|
|
966
960
|
"linux-arm64": ["@tailwind-styled/native-linux-arm64-gnu", "@tailwind-styled/native-linux-arm64"],
|
|
@@ -1006,6 +1000,7 @@ function createObservabilityClient(opts = {}) {
|
|
|
1006
1000
|
}
|
|
1007
1001
|
var init_observability = __esm({
|
|
1008
1002
|
"packages/domain/shared/src/observability.ts"() {
|
|
1003
|
+
"use strict";
|
|
1009
1004
|
}
|
|
1010
1005
|
});
|
|
1011
1006
|
|
|
@@ -1044,6 +1039,7 @@ function resetCacheStats() {
|
|
|
1044
1039
|
}
|
|
1045
1040
|
var init_cssGeneratorNative = __esm({
|
|
1046
1041
|
"packages/domain/compiler/src/compiler/cssGeneratorNative.ts"() {
|
|
1042
|
+
"use strict";
|
|
1047
1043
|
init_nativeBridge();
|
|
1048
1044
|
}
|
|
1049
1045
|
});
|
|
@@ -1187,9 +1183,12 @@ function twMergeRaw(classLists) {
|
|
|
1187
1183
|
}
|
|
1188
1184
|
var init_cssCompilationNative = __esm({
|
|
1189
1185
|
"packages/domain/compiler/src/compiler/cssCompilationNative.ts"() {
|
|
1186
|
+
"use strict";
|
|
1190
1187
|
init_nativeBridge();
|
|
1191
1188
|
}
|
|
1192
1189
|
});
|
|
1190
|
+
|
|
1191
|
+
// packages/domain/compiler/src/tailwindEngine.ts
|
|
1193
1192
|
function loadTailwindEngine() {
|
|
1194
1193
|
if (_twEngine) return _twEngine;
|
|
1195
1194
|
if (_twEngineError) throw _twEngineError;
|
|
@@ -1209,10 +1208,10 @@ async function generateRawCss(classes, cssEntryContent, root) {
|
|
|
1209
1208
|
if (classes.length === 0) return "";
|
|
1210
1209
|
const tw = loadTailwindEngine();
|
|
1211
1210
|
const input = cssEntryContent ?? "@import 'tailwindcss';";
|
|
1212
|
-
const { readFileSync, existsSync: existsSync3 } = await import(
|
|
1213
|
-
const { dirname, resolve: resolve2 } = await import(
|
|
1211
|
+
const { readFileSync, existsSync: existsSync3 } = await import("fs");
|
|
1212
|
+
const { dirname, resolve: resolve2 } = await import("path");
|
|
1214
1213
|
const projectRoot = root ?? process.cwd();
|
|
1215
|
-
const req =
|
|
1214
|
+
const req = (0, import_node_module2.createRequire)(resolve2(projectRoot, "package.json"));
|
|
1216
1215
|
const loadStylesheet = async (id, base) => {
|
|
1217
1216
|
try {
|
|
1218
1217
|
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 +1231,14 @@ async function generateRawCss(classes, cssEntryContent, root) {
|
|
|
1232
1231
|
const compiler = await Promise.resolve(tw.compile(input, { loadStylesheet }));
|
|
1233
1232
|
return compiler.build(classes);
|
|
1234
1233
|
}
|
|
1235
|
-
var require2, _twEngine, _twEngineError;
|
|
1234
|
+
var import_node_module2, import_meta3, require2, MAX_CACHE_MEMORY, _twEngine, _twEngineError;
|
|
1236
1235
|
var init_tailwindEngine = __esm({
|
|
1237
1236
|
"packages/domain/compiler/src/tailwindEngine.ts"() {
|
|
1238
|
-
|
|
1237
|
+
"use strict";
|
|
1238
|
+
import_node_module2 = require("module");
|
|
1239
|
+
import_meta3 = {};
|
|
1240
|
+
require2 = (0, import_node_module2.createRequire)(import_meta3.url);
|
|
1241
|
+
MAX_CACHE_MEMORY = 256 * 1024;
|
|
1239
1242
|
_twEngine = null;
|
|
1240
1243
|
_twEngineError = null;
|
|
1241
1244
|
}
|
|
@@ -1416,18 +1419,22 @@ function processTailwindCssWithTargets(css, targets) {
|
|
|
1416
1419
|
}
|
|
1417
1420
|
return result.css;
|
|
1418
1421
|
}
|
|
1419
|
-
var _cssCache, _cacheHits, _cacheMisses, MAX_CACHE_SIZE;
|
|
1422
|
+
var import_node_module3, import_meta4, require3, _cssCache, _cacheHits, _cacheMisses, MAX_CACHE_SIZE, MAX_CACHE_MEMORY2;
|
|
1420
1423
|
var init_tailwindEngine2 = __esm({
|
|
1421
1424
|
"packages/domain/compiler/src/compiler/tailwindEngine.ts"() {
|
|
1425
|
+
"use strict";
|
|
1426
|
+
import_node_module3 = require("module");
|
|
1422
1427
|
init_nativeBridge();
|
|
1423
1428
|
init_cssGeneratorNative();
|
|
1424
1429
|
init_cssCompilationNative();
|
|
1425
1430
|
init_tailwindEngine();
|
|
1426
|
-
|
|
1431
|
+
import_meta4 = {};
|
|
1432
|
+
require3 = (0, import_node_module3.createRequire)(import_meta4.url);
|
|
1427
1433
|
_cssCache = /* @__PURE__ */ new Map();
|
|
1428
1434
|
_cacheHits = 0;
|
|
1429
1435
|
_cacheMisses = 0;
|
|
1430
1436
|
MAX_CACHE_SIZE = 100;
|
|
1437
|
+
MAX_CACHE_MEMORY2 = 256 * 1024;
|
|
1431
1438
|
}
|
|
1432
1439
|
});
|
|
1433
1440
|
|
|
@@ -1499,6 +1506,7 @@ function atomicRegistrySize() {
|
|
|
1499
1506
|
}
|
|
1500
1507
|
var init_compilationNative = __esm({
|
|
1501
1508
|
"packages/domain/compiler/src/compiler/compilationNative.ts"() {
|
|
1509
|
+
"use strict";
|
|
1502
1510
|
init_nativeBridge();
|
|
1503
1511
|
}
|
|
1504
1512
|
});
|
|
@@ -1598,6 +1606,7 @@ function idRegistryImport(importedData) {
|
|
|
1598
1606
|
}
|
|
1599
1607
|
var init_idRegistryNative = __esm({
|
|
1600
1608
|
"packages/domain/compiler/src/compiler/idRegistryNative.ts"() {
|
|
1609
|
+
"use strict";
|
|
1601
1610
|
init_nativeBridge();
|
|
1602
1611
|
}
|
|
1603
1612
|
});
|
|
@@ -1739,6 +1748,7 @@ function scanFilesBatchNative(filesJson) {
|
|
|
1739
1748
|
}
|
|
1740
1749
|
var init_streamingNative = __esm({
|
|
1741
1750
|
"packages/domain/compiler/src/compiler/streamingNative.ts"() {
|
|
1751
|
+
"use strict";
|
|
1742
1752
|
init_nativeBridge();
|
|
1743
1753
|
}
|
|
1744
1754
|
});
|
|
@@ -1746,6 +1756,7 @@ var init_streamingNative = __esm({
|
|
|
1746
1756
|
// packages/domain/compiler/src/compiler/index.ts
|
|
1747
1757
|
var init_compiler = __esm({
|
|
1748
1758
|
"packages/domain/compiler/src/compiler/index.ts"() {
|
|
1759
|
+
"use strict";
|
|
1749
1760
|
init_cssGeneratorNative();
|
|
1750
1761
|
init_compilationNative();
|
|
1751
1762
|
init_cssCompilationNative();
|
|
@@ -1758,6 +1769,7 @@ var init_compiler = __esm({
|
|
|
1758
1769
|
var parseClasses, parseClass, extractAllClasses, extractClassesFromSource, astExtractClasses, normalizeClasses, mergeClassesStatic, normalizeAndDedupClasses, extractComponentUsage, batchExtractClasses, checkAgainstSafelist, diffClassLists;
|
|
1759
1770
|
var init_parser = __esm({
|
|
1760
1771
|
"packages/domain/compiler/src/parser/index.ts"() {
|
|
1772
|
+
"use strict";
|
|
1761
1773
|
init_nativeBridge();
|
|
1762
1774
|
parseClasses = (raw) => {
|
|
1763
1775
|
const native = getNativeBridge();
|
|
@@ -1936,6 +1948,7 @@ function resetMemoryStats() {
|
|
|
1936
1948
|
}
|
|
1937
1949
|
var init_analyzerNative = __esm({
|
|
1938
1950
|
"packages/domain/compiler/src/analyzer/analyzerNative.ts"() {
|
|
1951
|
+
"use strict";
|
|
1939
1952
|
init_nativeBridge();
|
|
1940
1953
|
}
|
|
1941
1954
|
});
|
|
@@ -2029,6 +2042,7 @@ function resolveSimpleVariants(configJson) {
|
|
|
2029
2042
|
}
|
|
2030
2043
|
var init_themeResolutionNative = __esm({
|
|
2031
2044
|
"packages/domain/compiler/src/analyzer/themeResolutionNative.ts"() {
|
|
2045
|
+
"use strict";
|
|
2032
2046
|
init_nativeBridge();
|
|
2033
2047
|
}
|
|
2034
2048
|
});
|
|
@@ -2076,6 +2090,7 @@ function generateSubComponentTypes(root, outputPath) {
|
|
|
2076
2090
|
}
|
|
2077
2091
|
var init_scannerNative = __esm({
|
|
2078
2092
|
"packages/domain/compiler/src/analyzer/scannerNative.ts"() {
|
|
2093
|
+
"use strict";
|
|
2079
2094
|
init_nativeBridge();
|
|
2080
2095
|
}
|
|
2081
2096
|
});
|
|
@@ -2083,6 +2098,7 @@ var init_scannerNative = __esm({
|
|
|
2083
2098
|
// packages/domain/compiler/src/analyzer/index.ts
|
|
2084
2099
|
var init_analyzer = __esm({
|
|
2085
2100
|
"packages/domain/compiler/src/analyzer/index.ts"() {
|
|
2101
|
+
"use strict";
|
|
2086
2102
|
init_analyzerNative();
|
|
2087
2103
|
init_themeResolutionNative();
|
|
2088
2104
|
init_scannerNative();
|
|
@@ -2271,6 +2287,7 @@ function resetResolverPoolStats() {
|
|
|
2271
2287
|
}
|
|
2272
2288
|
var init_cacheNative = __esm({
|
|
2273
2289
|
"packages/domain/compiler/src/cache/cacheNative.ts"() {
|
|
2290
|
+
"use strict";
|
|
2274
2291
|
init_nativeBridge();
|
|
2275
2292
|
}
|
|
2276
2293
|
});
|
|
@@ -2278,6 +2295,7 @@ var init_cacheNative = __esm({
|
|
|
2278
2295
|
// packages/domain/compiler/src/cache/index.ts
|
|
2279
2296
|
var init_cache = __esm({
|
|
2280
2297
|
"packages/domain/compiler/src/cache/index.ts"() {
|
|
2298
|
+
"use strict";
|
|
2281
2299
|
init_cacheNative();
|
|
2282
2300
|
}
|
|
2283
2301
|
});
|
|
@@ -2526,6 +2544,7 @@ function redisDiagnose() {
|
|
|
2526
2544
|
}
|
|
2527
2545
|
var init_redisNative = __esm({
|
|
2528
2546
|
"packages/domain/compiler/src/redis/redisNative.ts"() {
|
|
2547
|
+
"use strict";
|
|
2529
2548
|
init_nativeBridge();
|
|
2530
2549
|
}
|
|
2531
2550
|
});
|
|
@@ -2533,6 +2552,7 @@ var init_redisNative = __esm({
|
|
|
2533
2552
|
// packages/domain/compiler/src/redis/index.ts
|
|
2534
2553
|
var init_redis = __esm({
|
|
2535
2554
|
"packages/domain/compiler/src/redis/index.ts"() {
|
|
2555
|
+
"use strict";
|
|
2536
2556
|
init_redisNative();
|
|
2537
2557
|
}
|
|
2538
2558
|
});
|
|
@@ -2671,6 +2691,7 @@ function getCompilerDiagnostics() {
|
|
|
2671
2691
|
}
|
|
2672
2692
|
var init_watchSystemNative = __esm({
|
|
2673
2693
|
"packages/domain/compiler/src/watch/watchSystemNative.ts"() {
|
|
2694
|
+
"use strict";
|
|
2674
2695
|
init_nativeBridge();
|
|
2675
2696
|
}
|
|
2676
2697
|
});
|
|
@@ -2678,6 +2699,7 @@ var init_watchSystemNative = __esm({
|
|
|
2678
2699
|
// packages/domain/compiler/src/watch/index.ts
|
|
2679
2700
|
var init_watch = __esm({
|
|
2680
2701
|
"packages/domain/compiler/src/watch/index.ts"() {
|
|
2702
|
+
"use strict";
|
|
2681
2703
|
init_watchSystemNative();
|
|
2682
2704
|
}
|
|
2683
2705
|
});
|
|
@@ -2906,6 +2928,7 @@ __export(internal_exports, {
|
|
|
2906
2928
|
});
|
|
2907
2929
|
var init_internal = __esm({
|
|
2908
2930
|
"packages/domain/compiler/src/internal.ts"() {
|
|
2931
|
+
"use strict";
|
|
2909
2932
|
init_src2();
|
|
2910
2933
|
init_tailwindEngine2();
|
|
2911
2934
|
init_compiler();
|
|
@@ -2916,6 +2939,8 @@ var init_internal = __esm({
|
|
|
2916
2939
|
init_watch();
|
|
2917
2940
|
}
|
|
2918
2941
|
});
|
|
2942
|
+
|
|
2943
|
+
// packages/domain/shared/src/staticStateExtractor.ts
|
|
2919
2944
|
function getNative() {
|
|
2920
2945
|
if (_native) return _native;
|
|
2921
2946
|
try {
|
|
@@ -2945,17 +2970,17 @@ function getNative() {
|
|
|
2945
2970
|
function* walkSourceFiles(dir) {
|
|
2946
2971
|
let entries;
|
|
2947
2972
|
try {
|
|
2948
|
-
entries =
|
|
2973
|
+
entries = import_node_fs.default.readdirSync(dir, { withFileTypes: true });
|
|
2949
2974
|
} catch {
|
|
2950
2975
|
return;
|
|
2951
2976
|
}
|
|
2952
2977
|
for (const entry of entries) {
|
|
2953
|
-
const fullPath =
|
|
2978
|
+
const fullPath = import_node_path.default.join(dir, entry.name);
|
|
2954
2979
|
if (entry.isDirectory()) {
|
|
2955
2980
|
if (IGNORE_PATTERNS.some((p) => entry.name === p || entry.name.startsWith(p))) continue;
|
|
2956
2981
|
yield* walkSourceFiles(fullPath);
|
|
2957
2982
|
} else if (entry.isFile()) {
|
|
2958
|
-
const ext =
|
|
2983
|
+
const ext = import_node_path.default.extname(entry.name);
|
|
2959
2984
|
if (SOURCE_EXTENSIONS.has(ext)) yield fullPath;
|
|
2960
2985
|
}
|
|
2961
2986
|
}
|
|
@@ -3019,7 +3044,7 @@ function extractStaticStateCss(srcDir, options = {}) {
|
|
|
3019
3044
|
allConfigs.push(...configs);
|
|
3020
3045
|
if (verbose) {
|
|
3021
3046
|
process.stderr.write(
|
|
3022
|
-
`[tw:static-state] ${
|
|
3047
|
+
`[tw:static-state] ${import_node_path.default.relative(srcDir, filePath)}: ${configs.length} komponen
|
|
3023
3048
|
`
|
|
3024
3049
|
);
|
|
3025
3050
|
}
|
|
@@ -3030,7 +3055,7 @@ function extractStaticStateCss(srcDir, options = {}) {
|
|
|
3030
3055
|
if (filesScanned >= maxFiles) break;
|
|
3031
3056
|
let source;
|
|
3032
3057
|
try {
|
|
3033
|
-
source =
|
|
3058
|
+
source = import_node_fs.default.readFileSync(filePath, "utf-8");
|
|
3034
3059
|
} catch {
|
|
3035
3060
|
continue;
|
|
3036
3061
|
}
|
|
@@ -3043,7 +3068,7 @@ function extractStaticStateCss(srcDir, options = {}) {
|
|
|
3043
3068
|
allConfigs.push(...configs);
|
|
3044
3069
|
if (verbose) {
|
|
3045
3070
|
process.stderr.write(
|
|
3046
|
-
`[tw:static-state] ${
|
|
3071
|
+
`[tw:static-state] ${import_node_path.default.relative(srcDir, filePath)}: ${configs.length} komponen
|
|
3047
3072
|
`
|
|
3048
3073
|
);
|
|
3049
3074
|
}
|
|
@@ -3137,12 +3162,12 @@ function appendStaticStateCssToSafelist(srcDir, safelistPath, options = {}) {
|
|
|
3137
3162
|
resolvedCss: options.resolvedCss || ""
|
|
3138
3163
|
// ← ensure always passed
|
|
3139
3164
|
});
|
|
3140
|
-
const twClassesDir =
|
|
3141
|
-
|
|
3142
|
-
const stateFilePath =
|
|
3165
|
+
const twClassesDir = import_node_path.default.join(import_node_path.default.dirname(safelistPath), "tw-classes");
|
|
3166
|
+
import_node_fs.default.mkdirSync(twClassesDir, { recursive: true });
|
|
3167
|
+
const stateFilePath = import_node_path.default.join(twClassesDir, TW_STATE_STATIC_FILENAME);
|
|
3143
3168
|
if (result.rulesGenerated === 0) {
|
|
3144
3169
|
try {
|
|
3145
|
-
|
|
3170
|
+
import_node_fs.default.writeFileSync(
|
|
3146
3171
|
stateFilePath,
|
|
3147
3172
|
"/* tw-state-static.css \u2014 tidak ada state rules yang di-generate */\n",
|
|
3148
3173
|
"utf-8"
|
|
@@ -3152,7 +3177,7 @@ function appendStaticStateCssToSafelist(srcDir, safelistPath, options = {}) {
|
|
|
3152
3177
|
return `[tw:static-state] tidak ada state rules yang di-generate (${result.filesScanned} files di-scan)`;
|
|
3153
3178
|
}
|
|
3154
3179
|
try {
|
|
3155
|
-
|
|
3180
|
+
import_node_fs.default.writeFileSync(stateFilePath, result.generatedCss, "utf-8");
|
|
3156
3181
|
return [
|
|
3157
3182
|
`[tw:static-state] ${result.rulesGenerated} static state rules di-generate`,
|
|
3158
3183
|
` \u2192 ${result.filesScanned} files scanned, ${result.filesWithStates} dengan states`,
|
|
@@ -3164,15 +3189,20 @@ function appendStaticStateCssToSafelist(srcDir, safelistPath, options = {}) {
|
|
|
3164
3189
|
return `[tw:static-state] gagal tulis state CSS: ${msg}`;
|
|
3165
3190
|
}
|
|
3166
3191
|
}
|
|
3167
|
-
var SOURCE_EXTENSIONS, IGNORE_PATTERNS, _native, TW_STATE_STATIC_FILENAME;
|
|
3192
|
+
var import_node_fs, import_node_path, SOURCE_EXTENSIONS, IGNORE_PATTERNS, _native, TW_STATE_STATIC_FILENAME;
|
|
3168
3193
|
var init_staticStateExtractor = __esm({
|
|
3169
3194
|
"packages/domain/shared/src/staticStateExtractor.ts"() {
|
|
3195
|
+
"use strict";
|
|
3196
|
+
import_node_fs = __toESM(require("fs"));
|
|
3197
|
+
import_node_path = __toESM(require("path"));
|
|
3170
3198
|
SOURCE_EXTENSIONS = /* @__PURE__ */ new Set([".ts", ".tsx", ".js", ".jsx", ".mts", ".mjs"]);
|
|
3171
3199
|
IGNORE_PATTERNS = ["node_modules", ".next", "dist", "build", ".git", "coverage", "__tests__"];
|
|
3172
3200
|
_native = null;
|
|
3173
3201
|
TW_STATE_STATIC_FILENAME = "_tw-state-static.css";
|
|
3174
3202
|
}
|
|
3175
3203
|
});
|
|
3204
|
+
|
|
3205
|
+
// packages/domain/shared/src/logger.ts
|
|
3176
3206
|
function getEnvLevel() {
|
|
3177
3207
|
const env = process.env.TWS_LOG_LEVEL?.toLowerCase();
|
|
3178
3208
|
if (env && env in LEVELS) return env;
|
|
@@ -3182,8 +3212,8 @@ function setGlobalLogFile(filePath) {
|
|
|
3182
3212
|
_globalLogFile = filePath;
|
|
3183
3213
|
_logFileInitialized = false;
|
|
3184
3214
|
try {
|
|
3185
|
-
|
|
3186
|
-
|
|
3215
|
+
import_node_fs2.default.mkdirSync(import_node_path2.default.dirname(filePath), { recursive: true });
|
|
3216
|
+
import_node_fs2.default.writeFileSync(
|
|
3187
3217
|
filePath,
|
|
3188
3218
|
`# tailwind-styled build log \u2014 ${(/* @__PURE__ */ new Date()).toISOString()}
|
|
3189
3219
|
`,
|
|
@@ -3196,13 +3226,13 @@ function setGlobalLogFile(filePath) {
|
|
|
3196
3226
|
function writeToFile(line) {
|
|
3197
3227
|
if (!_globalLogFile || !_logFileInitialized) return;
|
|
3198
3228
|
try {
|
|
3199
|
-
|
|
3229
|
+
import_node_fs2.default.appendFileSync(_globalLogFile, line);
|
|
3200
3230
|
} catch {
|
|
3201
3231
|
}
|
|
3202
3232
|
}
|
|
3203
3233
|
function createLogger(prefix, level) {
|
|
3204
3234
|
const loggerState = {
|
|
3205
|
-
currentLevel: getEnvLevel(),
|
|
3235
|
+
currentLevel: level ?? getEnvLevel(),
|
|
3206
3236
|
setLevel(l) {
|
|
3207
3237
|
this.currentLevel = l;
|
|
3208
3238
|
}
|
|
@@ -3223,13 +3253,16 @@ function createLogger(prefix, level) {
|
|
|
3223
3253
|
setLogFile: (filePath) => setGlobalLogFile(filePath)
|
|
3224
3254
|
};
|
|
3225
3255
|
}
|
|
3226
|
-
var LEVELS, _globalLogFile, _logFileInitialized;
|
|
3256
|
+
var import_node_fs2, import_node_path2, LEVELS, _globalLogFile, _logFileInitialized, logger;
|
|
3227
3257
|
var init_logger = __esm({
|
|
3228
3258
|
"packages/domain/shared/src/logger.ts"() {
|
|
3259
|
+
"use strict";
|
|
3260
|
+
import_node_fs2 = __toESM(require("fs"));
|
|
3261
|
+
import_node_path2 = __toESM(require("path"));
|
|
3229
3262
|
LEVELS = { silent: 0, error: 1, warn: 2, info: 3, debug: 4 };
|
|
3230
3263
|
_globalLogFile = null;
|
|
3231
3264
|
_logFileInitialized = false;
|
|
3232
|
-
createLogger("tailwind-styled");
|
|
3265
|
+
logger = createLogger("tailwind-styled");
|
|
3233
3266
|
}
|
|
3234
3267
|
});
|
|
3235
3268
|
|
|
@@ -3350,9 +3383,9 @@ function loadNativeBinding(options) {
|
|
|
3350
3383
|
const { runtimeDir, candidates, isValid } = options;
|
|
3351
3384
|
const loadErrors = [];
|
|
3352
3385
|
for (const candidate of candidates) {
|
|
3353
|
-
const candidatePath =
|
|
3386
|
+
const candidatePath = import_node_path3.default.resolve(runtimeDir, candidate);
|
|
3354
3387
|
try {
|
|
3355
|
-
if (!
|
|
3388
|
+
if (!import_node_fs3.default.existsSync(candidatePath) && !import_node_fs3.default.existsSync(candidatePath + ".node")) {
|
|
3356
3389
|
continue;
|
|
3357
3390
|
}
|
|
3358
3391
|
const mod = requireNativeModule(candidatePath);
|
|
@@ -3384,9 +3417,9 @@ function resolveNativeBindingCandidates(options) {
|
|
|
3384
3417
|
}
|
|
3385
3418
|
}
|
|
3386
3419
|
if (!includeDefaultCandidates) return candidates;
|
|
3387
|
-
if (
|
|
3420
|
+
if (import_node_fs3.default.existsSync(runtimeDir)) {
|
|
3388
3421
|
try {
|
|
3389
|
-
for (const entry of
|
|
3422
|
+
for (const entry of import_node_fs3.default.readdirSync(runtimeDir)) {
|
|
3390
3423
|
if (entry.endsWith(".node")) candidates.push(entry);
|
|
3391
3424
|
}
|
|
3392
3425
|
} catch {
|
|
@@ -3395,28 +3428,28 @@ function resolveNativeBindingCandidates(options) {
|
|
|
3395
3428
|
const BINARY_NAMES = ["tailwind-styled-native", "tailwind_styled_parser"];
|
|
3396
3429
|
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
3430
|
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(
|
|
3431
|
+
candidates.push(import_node_path3.default.resolve(runtimeDir, `${bin}.node`));
|
|
3432
|
+
candidates.push(import_node_path3.default.resolve(runtimeDir, `${bin}.${napiPlatform}.node`));
|
|
3433
|
+
candidates.push(import_node_path3.default.resolve(runtimeDir, "..", "native", `${bin}.node`));
|
|
3434
|
+
candidates.push(import_node_path3.default.resolve(runtimeDir, "..", "native", `${bin}.${napiPlatform}.node`));
|
|
3435
|
+
candidates.push(import_node_path3.default.resolve(process.cwd(), "native", `${bin}.node`));
|
|
3436
|
+
candidates.push(import_node_path3.default.resolve(process.cwd(), "native", `${bin}.${napiPlatform}.node`));
|
|
3437
|
+
candidates.push(import_node_path3.default.resolve(runtimeDir, "..", "..", "..", "..", "native", `${bin}.node`));
|
|
3438
|
+
candidates.push(import_node_path3.default.resolve(runtimeDir, "..", "..", "..", "..", "native", `${bin}.${napiPlatform}.node`));
|
|
3439
|
+
candidates.push(import_node_path3.default.resolve(runtimeDir, "..", "..", "..", "native", `${bin}.node`));
|
|
3407
3440
|
}
|
|
3408
3441
|
return Array.from(new Set(candidates));
|
|
3409
3442
|
}
|
|
3410
3443
|
function resolveRuntimeDir(dir, importMetaUrl) {
|
|
3411
|
-
if (dir) return
|
|
3444
|
+
if (dir) return import_node_path3.default.resolve(dir);
|
|
3412
3445
|
try {
|
|
3413
|
-
return
|
|
3446
|
+
return import_node_path3.default.dirname((0, import_node_url.fileURLToPath)(importMetaUrl));
|
|
3414
3447
|
} catch {
|
|
3415
3448
|
return process.cwd();
|
|
3416
3449
|
}
|
|
3417
3450
|
}
|
|
3418
3451
|
function hashContent2(content, algorithm = "md5", length) {
|
|
3419
|
-
const hash =
|
|
3452
|
+
const hash = (0, import_node_crypto.createHash)(algorithm).update(content).digest("hex");
|
|
3420
3453
|
return length ? hash.slice(0, length) : hash;
|
|
3421
3454
|
}
|
|
3422
3455
|
function formatErrorMessage(error) {
|
|
@@ -3424,9 +3457,15 @@ function formatErrorMessage(error) {
|
|
|
3424
3457
|
if (error instanceof Error) return error.message;
|
|
3425
3458
|
return String(error);
|
|
3426
3459
|
}
|
|
3427
|
-
var TwError, _require2, LRUCache;
|
|
3460
|
+
var import_node_crypto, import_node_fs3, import_node_path3, import_node_url, import_node_module4, import_meta5, TwError, _require2, LRUCache;
|
|
3428
3461
|
var init_src = __esm({
|
|
3429
3462
|
"packages/domain/shared/src/index.ts"() {
|
|
3463
|
+
"use strict";
|
|
3464
|
+
import_node_crypto = require("crypto");
|
|
3465
|
+
import_node_fs3 = __toESM(require("fs"));
|
|
3466
|
+
import_node_path3 = __toESM(require("path"));
|
|
3467
|
+
import_node_url = require("url");
|
|
3468
|
+
import_node_module4 = require("module");
|
|
3430
3469
|
init_trace();
|
|
3431
3470
|
init_error_codes();
|
|
3432
3471
|
init_compatibility();
|
|
@@ -3440,6 +3479,7 @@ var init_src = __esm({
|
|
|
3440
3479
|
init_observability();
|
|
3441
3480
|
init_staticStateExtractor();
|
|
3442
3481
|
init_logger();
|
|
3482
|
+
import_meta5 = {};
|
|
3443
3483
|
TwError = class _TwError extends Error {
|
|
3444
3484
|
/** @deprecated Gunakan source */
|
|
3445
3485
|
domain;
|
|
@@ -3492,7 +3532,7 @@ var init_src = __esm({
|
|
|
3492
3532
|
return `[${this.source.toUpperCase()}:${this.code}] ${this.message}`;
|
|
3493
3533
|
}
|
|
3494
3534
|
};
|
|
3495
|
-
_require2 =
|
|
3535
|
+
_require2 = (0, import_node_module4.createRequire)(import_meta5.url);
|
|
3496
3536
|
LRUCache = class {
|
|
3497
3537
|
capacity;
|
|
3498
3538
|
cache;
|
|
@@ -3538,11 +3578,13 @@ var init_src = __esm({
|
|
|
3538
3578
|
});
|
|
3539
3579
|
|
|
3540
3580
|
// packages/domain/compiler/src/nativeBridge.ts
|
|
3541
|
-
var _loadNative, log, NATIVE_UNAVAILABLE_MESSAGE, nativeBridge, bridgeLoadAttempted, bridgeLoadError, isValidNativeBridge, getNativeBridge, adaptNativeResult;
|
|
3581
|
+
var import_meta6, _loadNative, log, NATIVE_UNAVAILABLE_MESSAGE, nativeBridge, bridgeLoadAttempted, bridgeLoadError, isValidNativeBridge, getNativeBridge, adaptNativeResult;
|
|
3542
3582
|
var init_nativeBridge = __esm({
|
|
3543
3583
|
"packages/domain/compiler/src/nativeBridge.ts"() {
|
|
3584
|
+
"use strict";
|
|
3544
3585
|
init_src();
|
|
3545
|
-
|
|
3586
|
+
import_meta6 = {};
|
|
3587
|
+
_loadNative = (path16) => require(path16);
|
|
3546
3588
|
log = (...args) => {
|
|
3547
3589
|
if (process.env.DEBUG?.includes("compiler:native")) {
|
|
3548
3590
|
console.log("[compiler:native]", ...args);
|
|
@@ -3568,7 +3610,7 @@ var init_nativeBridge = __esm({
|
|
|
3568
3610
|
}
|
|
3569
3611
|
bridgeLoadAttempted = true;
|
|
3570
3612
|
try {
|
|
3571
|
-
const runtimeDir = resolveRuntimeDir(void 0,
|
|
3613
|
+
const runtimeDir = resolveRuntimeDir(void 0, import_meta6.url);
|
|
3572
3614
|
const result = resolveNativeBinary(runtimeDir);
|
|
3573
3615
|
if (result.path && result.path.endsWith(".node")) {
|
|
3574
3616
|
try {
|
|
@@ -3644,6 +3686,8 @@ Tried paths: ${result.tried.join("\n")}`);
|
|
|
3644
3686
|
}
|
|
3645
3687
|
}
|
|
3646
3688
|
});
|
|
3689
|
+
|
|
3690
|
+
// packages/domain/compiler/src/index.ts
|
|
3647
3691
|
function _layoutClassesToCss(classes) {
|
|
3648
3692
|
const native = getNativeBridge();
|
|
3649
3693
|
if (!native?.layoutClassesToCss) {
|
|
@@ -3678,9 +3722,13 @@ function extractContainerCssFromSource(source) {
|
|
|
3678
3722
|
}
|
|
3679
3723
|
return rules.join("\n");
|
|
3680
3724
|
}
|
|
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;
|
|
3725
|
+
var import_node_fs4, import_node_path4, import_node_module5, import_meta7, _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
3726
|
var init_src2 = __esm({
|
|
3683
3727
|
"packages/domain/compiler/src/index.ts"() {
|
|
3728
|
+
"use strict";
|
|
3729
|
+
import_node_fs4 = __toESM(require("fs"), 1);
|
|
3730
|
+
import_node_path4 = __toESM(require("path"), 1);
|
|
3731
|
+
import_node_module5 = require("module");
|
|
3684
3732
|
init_nativeBridge();
|
|
3685
3733
|
init_compiler();
|
|
3686
3734
|
init_parser();
|
|
@@ -3688,7 +3736,8 @@ var init_src2 = __esm({
|
|
|
3688
3736
|
init_cache();
|
|
3689
3737
|
init_redis();
|
|
3690
3738
|
init_watch();
|
|
3691
|
-
|
|
3739
|
+
import_meta7 = {};
|
|
3740
|
+
_require3 = (0, import_node_module5.createRequire)(import_meta7.url);
|
|
3692
3741
|
transformSource = (source, opts) => {
|
|
3693
3742
|
const native = getNativeBridge();
|
|
3694
3743
|
if (!native?.transformSource) {
|
|
@@ -3780,7 +3829,7 @@ var init_src2 = __esm({
|
|
|
3780
3829
|
};
|
|
3781
3830
|
scanProjectUsage = (dirs, cwd) => {
|
|
3782
3831
|
const { batchExtractClasses: batchExtractClasses2 } = _require3("./parser");
|
|
3783
|
-
const files = dirs.map((dir) =>
|
|
3832
|
+
const files = dirs.map((dir) => import_node_path4.default.resolve(cwd, dir));
|
|
3784
3833
|
const results = batchExtractClasses2(files) || [];
|
|
3785
3834
|
const combined = {};
|
|
3786
3835
|
for (const result of results) {
|
|
@@ -3797,13 +3846,13 @@ var init_src2 = __esm({
|
|
|
3797
3846
|
const classes = scanProjectUsage(scanDirs, cwd || process.cwd());
|
|
3798
3847
|
const allClasses = Object.keys(classes).sort();
|
|
3799
3848
|
if (outputPath) {
|
|
3800
|
-
|
|
3849
|
+
import_node_fs4.default.writeFileSync(outputPath, JSON.stringify(allClasses, null, 2));
|
|
3801
3850
|
}
|
|
3802
3851
|
return allClasses;
|
|
3803
3852
|
};
|
|
3804
3853
|
loadSafelist = (safelistPath) => {
|
|
3805
3854
|
try {
|
|
3806
|
-
const content =
|
|
3855
|
+
const content = import_node_fs4.default.readFileSync(safelistPath, "utf-8");
|
|
3807
3856
|
return JSON.parse(content);
|
|
3808
3857
|
} catch {
|
|
3809
3858
|
return [];
|
|
@@ -3817,9 +3866,9 @@ var init_src2 = __esm({
|
|
|
3817
3866
|
"tailwind.config.cjs"
|
|
3818
3867
|
];
|
|
3819
3868
|
for (const file of configFiles) {
|
|
3820
|
-
const fullPath =
|
|
3821
|
-
if (
|
|
3822
|
-
const mod =
|
|
3869
|
+
const fullPath = import_node_path4.default.join(cwd, file);
|
|
3870
|
+
if (import_node_fs4.default.existsSync(fullPath)) {
|
|
3871
|
+
const mod = require(fullPath);
|
|
3823
3872
|
return mod.default || mod;
|
|
3824
3873
|
}
|
|
3825
3874
|
}
|
|
@@ -3828,9 +3877,9 @@ var init_src2 = __esm({
|
|
|
3828
3877
|
getContentPaths = (cwd = process.cwd()) => {
|
|
3829
3878
|
return {
|
|
3830
3879
|
content: [
|
|
3831
|
-
|
|
3832
|
-
|
|
3833
|
-
|
|
3880
|
+
import_node_path4.default.join(cwd, "src/**/*.{js,ts,jsx,tsx}"),
|
|
3881
|
+
import_node_path4.default.join(cwd, "app/**/*.{js,ts,jsx,tsx}"),
|
|
3882
|
+
import_node_path4.default.join(cwd, "pages/**/*.{js,ts,jsx,tsx}")
|
|
3834
3883
|
]
|
|
3835
3884
|
};
|
|
3836
3885
|
};
|
|
@@ -4053,8 +4102,8 @@ function getDirname2() {
|
|
|
4053
4102
|
if (typeof __dirname !== "undefined") {
|
|
4054
4103
|
return __dirname;
|
|
4055
4104
|
}
|
|
4056
|
-
if (typeof
|
|
4057
|
-
return
|
|
4105
|
+
if (typeof import_meta8 !== "undefined" && import_meta8.url) {
|
|
4106
|
+
return import_node_path5.default.dirname((0, import_node_url2.fileURLToPath)(import_meta8.url));
|
|
4058
4107
|
}
|
|
4059
4108
|
return process.cwd();
|
|
4060
4109
|
}
|
|
@@ -4259,13 +4308,17 @@ function hasNativeWatchBinding() {
|
|
|
4259
4308
|
return false;
|
|
4260
4309
|
}
|
|
4261
4310
|
}
|
|
4262
|
-
var log2, isValidScannerBinding, createScannerBridgeLoader, scannerBridgeLoader, scannerGetBinding, resetScannerBridgeCache;
|
|
4311
|
+
var import_node_path5, import_node_url2, import_meta8, log2, isValidScannerBinding, createScannerBridgeLoader, scannerBridgeLoader, scannerGetBinding, resetScannerBridgeCache;
|
|
4263
4312
|
var init_native_bridge = __esm({
|
|
4264
4313
|
"packages/domain/scanner/src/native-bridge.ts"() {
|
|
4314
|
+
"use strict";
|
|
4315
|
+
import_node_path5 = __toESM(require("path"), 1);
|
|
4316
|
+
import_node_url2 = require("url");
|
|
4265
4317
|
init_src();
|
|
4318
|
+
import_meta8 = {};
|
|
4266
4319
|
log2 = createDebugLogger("scanner:native");
|
|
4267
|
-
isValidScannerBinding = (
|
|
4268
|
-
const candidate =
|
|
4320
|
+
isValidScannerBinding = (module2) => {
|
|
4321
|
+
const candidate = module2;
|
|
4269
4322
|
return !!(candidate && (candidate.scanWorkspace || candidate.extractClassesFromSource || candidate.hashFileContent || candidate.cacheRead || candidate.cacheWrite));
|
|
4270
4323
|
};
|
|
4271
4324
|
createScannerBridgeLoader = () => {
|
|
@@ -4342,13 +4395,15 @@ var init_native_bridge = __esm({
|
|
|
4342
4395
|
resetScannerBridgeCache = scannerBridgeLoader.reset;
|
|
4343
4396
|
}
|
|
4344
4397
|
});
|
|
4398
|
+
|
|
4399
|
+
// packages/domain/scanner/src/cache-native.ts
|
|
4345
4400
|
function defaultCachePath(rootDir, cacheDir) {
|
|
4346
|
-
const dir = cacheDir ?
|
|
4347
|
-
return
|
|
4401
|
+
const dir = cacheDir ? import_node_path6.default.resolve(rootDir, cacheDir) : import_node_path6.default.join(process.cwd(), ".cache", "tailwind-styled");
|
|
4402
|
+
return import_node_path6.default.join(dir, "scanner-cache.json");
|
|
4348
4403
|
}
|
|
4349
4404
|
function readCache(rootDir, cacheDir) {
|
|
4350
4405
|
const cachePath = defaultCachePath(rootDir, cacheDir);
|
|
4351
|
-
|
|
4406
|
+
import_node_fs5.default.mkdirSync(import_node_path6.default.dirname(cachePath), { recursive: true });
|
|
4352
4407
|
const result = cacheReadNative(cachePath);
|
|
4353
4408
|
if (!result) return [];
|
|
4354
4409
|
return result.entries.map((e) => ({
|
|
@@ -4363,7 +4418,7 @@ function readCache(rootDir, cacheDir) {
|
|
|
4363
4418
|
}
|
|
4364
4419
|
function writeCache(rootDir, entries, cacheDir) {
|
|
4365
4420
|
const cachePath = defaultCachePath(rootDir, cacheDir);
|
|
4366
|
-
|
|
4421
|
+
import_node_fs5.default.mkdirSync(import_node_path6.default.dirname(cachePath), { recursive: true });
|
|
4367
4422
|
const success = cacheWriteNative(cachePath, entries);
|
|
4368
4423
|
if (!success) {
|
|
4369
4424
|
throw new Error(
|
|
@@ -4382,11 +4437,18 @@ function filePriority(mtimeMs, size, cached, nowMs = Date.now()) {
|
|
|
4382
4437
|
nowMs
|
|
4383
4438
|
);
|
|
4384
4439
|
}
|
|
4440
|
+
var import_node_fs5, import_node_path6, STALE_THRESHOLD_MS;
|
|
4385
4441
|
var init_cache_native = __esm({
|
|
4386
4442
|
"packages/domain/scanner/src/cache-native.ts"() {
|
|
4443
|
+
"use strict";
|
|
4444
|
+
import_node_fs5 = __toESM(require("fs"), 1);
|
|
4445
|
+
import_node_path6 = __toESM(require("path"), 1);
|
|
4387
4446
|
init_native_bridge();
|
|
4447
|
+
STALE_THRESHOLD_MS = 7 * 24 * 60 * 60 * 1e3;
|
|
4388
4448
|
}
|
|
4389
4449
|
});
|
|
4450
|
+
|
|
4451
|
+
// packages/domain/scanner/src/parallel-scanner.ts
|
|
4390
4452
|
function collectFiles2(rootDir, extensions, ignoreDirs) {
|
|
4391
4453
|
const native = collectFilesNative(rootDir, extensions, ignoreDirs);
|
|
4392
4454
|
if (native !== null) return native;
|
|
@@ -4404,7 +4466,7 @@ function mergeResults(batchResults) {
|
|
|
4404
4466
|
}
|
|
4405
4467
|
function runChunkInWorker(filePaths) {
|
|
4406
4468
|
return new Promise((resolve2, reject) => {
|
|
4407
|
-
const worker = new
|
|
4469
|
+
const worker = new import_node_worker_threads.Worker(_workerFilename, {
|
|
4408
4470
|
workerData: { filePaths }
|
|
4409
4471
|
});
|
|
4410
4472
|
worker.once("message", (payload) => {
|
|
@@ -4424,10 +4486,10 @@ async function scanWorkspaceParallel(rootDir, options = {}) {
|
|
|
4424
4486
|
const {
|
|
4425
4487
|
extensions = DEFAULT_EXTENSIONS,
|
|
4426
4488
|
ignoreDirs = DEFAULT_IGNORES,
|
|
4427
|
-
maxWorkers = Math.max(1,
|
|
4489
|
+
maxWorkers = Math.max(1, (0, import_node_os.availableParallelism)() - 1),
|
|
4428
4490
|
chunkSize = DEFAULT_CHUNK_SIZE
|
|
4429
4491
|
} = options;
|
|
4430
|
-
const files = collectFiles2(
|
|
4492
|
+
const files = collectFiles2(import_node_path7.default.resolve(rootDir), extensions, ignoreDirs);
|
|
4431
4493
|
if (files.length < PARALLEL_THRESHOLD) {
|
|
4432
4494
|
return mergeResults(batchExtractClassesNative2(files));
|
|
4433
4495
|
}
|
|
@@ -4443,33 +4505,43 @@ async function scanWorkspaceParallel(rootDir, options = {}) {
|
|
|
4443
4505
|
}
|
|
4444
4506
|
return mergeResults(allResults);
|
|
4445
4507
|
}
|
|
4446
|
-
var PARALLEL_THRESHOLD, DEFAULT_CHUNK_SIZE, _workerFilename;
|
|
4508
|
+
var import_node_worker_threads, import_node_path7, import_node_os, import_node_url3, import_meta9, PARALLEL_THRESHOLD, DEFAULT_CHUNK_SIZE, _workerFilename;
|
|
4447
4509
|
var init_parallel_scanner = __esm({
|
|
4448
4510
|
"packages/domain/scanner/src/parallel-scanner.ts"() {
|
|
4511
|
+
"use strict";
|
|
4512
|
+
import_node_worker_threads = require("worker_threads");
|
|
4513
|
+
import_node_path7 = __toESM(require("path"), 1);
|
|
4514
|
+
import_node_os = require("os");
|
|
4515
|
+
import_node_url3 = require("url");
|
|
4449
4516
|
init_src3();
|
|
4450
4517
|
init_native_bridge();
|
|
4518
|
+
import_meta9 = {};
|
|
4451
4519
|
PARALLEL_THRESHOLD = 50;
|
|
4452
4520
|
DEFAULT_CHUNK_SIZE = 150;
|
|
4453
|
-
if (!
|
|
4454
|
-
const { filePaths } =
|
|
4521
|
+
if (!import_node_worker_threads.isMainThread && import_node_worker_threads.parentPort) {
|
|
4522
|
+
const { filePaths } = import_node_worker_threads.workerData;
|
|
4455
4523
|
try {
|
|
4456
4524
|
const results = batchExtractClassesNative2(filePaths);
|
|
4457
4525
|
const msg = { ok: true, results };
|
|
4458
|
-
|
|
4526
|
+
import_node_worker_threads.parentPort.postMessage(msg);
|
|
4459
4527
|
} catch (error) {
|
|
4460
4528
|
const msg = {
|
|
4461
4529
|
ok: false,
|
|
4462
4530
|
error: error instanceof Error ? error.message : String(error)
|
|
4463
4531
|
};
|
|
4464
|
-
|
|
4532
|
+
import_node_worker_threads.parentPort.postMessage(msg);
|
|
4465
4533
|
}
|
|
4466
4534
|
}
|
|
4467
|
-
_workerFilename = typeof __filename !== "undefined" ? __filename :
|
|
4535
|
+
_workerFilename = typeof __filename !== "undefined" ? __filename : (0, import_node_url3.fileURLToPath)(import_meta9.url);
|
|
4468
4536
|
}
|
|
4469
4537
|
});
|
|
4470
|
-
|
|
4538
|
+
|
|
4539
|
+
// packages/domain/scanner/src/schemas.ts
|
|
4540
|
+
var import_zod3, formatIssuePath2, formatIssues, parseWithSchema, NonNegativeIntegerSchema, ScanWorkspaceOptionsSchema, ScanFileResultSchema, ScanWorkspaceResultSchema, ScannerWorkerRequestSchema, ScannerWorkerSuccessMessageSchema, ScannerWorkerErrorMessageSchema, ScannerWorkerMessageSchema, parseScanWorkspaceOptions, parseScanWorkspaceResult, parseScannerWorkerMessage;
|
|
4471
4541
|
var init_schemas = __esm({
|
|
4472
4542
|
"packages/domain/scanner/src/schemas.ts"() {
|
|
4543
|
+
"use strict";
|
|
4544
|
+
import_zod3 = require("zod");
|
|
4473
4545
|
init_src();
|
|
4474
4546
|
formatIssuePath2 = (path16) => path16.length > 0 ? path16.map(
|
|
4475
4547
|
(segment) => typeof segment === "symbol" ? segment.description ?? segment.toString() : String(segment)
|
|
@@ -4489,40 +4561,40 @@ var init_schemas = __esm({
|
|
|
4489
4561
|
parsed.error
|
|
4490
4562
|
);
|
|
4491
4563
|
};
|
|
4492
|
-
NonNegativeIntegerSchema =
|
|
4493
|
-
ScanWorkspaceOptionsSchema =
|
|
4494
|
-
includeExtensions:
|
|
4495
|
-
ignoreDirectories:
|
|
4496
|
-
useCache:
|
|
4497
|
-
cacheDir:
|
|
4498
|
-
smartInvalidation:
|
|
4564
|
+
NonNegativeIntegerSchema = import_zod3.z.number().int().min(0);
|
|
4565
|
+
ScanWorkspaceOptionsSchema = import_zod3.z.object({
|
|
4566
|
+
includeExtensions: import_zod3.z.array(import_zod3.z.string()).optional(),
|
|
4567
|
+
ignoreDirectories: import_zod3.z.array(import_zod3.z.string()).optional(),
|
|
4568
|
+
useCache: import_zod3.z.boolean().optional(),
|
|
4569
|
+
cacheDir: import_zod3.z.string().min(1).optional(),
|
|
4570
|
+
smartInvalidation: import_zod3.z.boolean().optional()
|
|
4499
4571
|
});
|
|
4500
|
-
ScanFileResultSchema =
|
|
4501
|
-
file:
|
|
4502
|
-
classes:
|
|
4503
|
-
hash:
|
|
4572
|
+
ScanFileResultSchema = import_zod3.z.object({
|
|
4573
|
+
file: import_zod3.z.string(),
|
|
4574
|
+
classes: import_zod3.z.array(import_zod3.z.string()),
|
|
4575
|
+
hash: import_zod3.z.string().optional()
|
|
4504
4576
|
});
|
|
4505
|
-
ScanWorkspaceResultSchema =
|
|
4506
|
-
files:
|
|
4577
|
+
ScanWorkspaceResultSchema = import_zod3.z.object({
|
|
4578
|
+
files: import_zod3.z.array(ScanFileResultSchema),
|
|
4507
4579
|
totalFiles: NonNegativeIntegerSchema,
|
|
4508
|
-
uniqueClasses:
|
|
4580
|
+
uniqueClasses: import_zod3.z.array(import_zod3.z.string())
|
|
4509
4581
|
}).refine((value) => value.totalFiles === value.files.length, {
|
|
4510
4582
|
message: "scan result totalFiles must match files.length",
|
|
4511
4583
|
path: ["totalFiles"]
|
|
4512
4584
|
});
|
|
4513
|
-
|
|
4514
|
-
rootDir:
|
|
4585
|
+
ScannerWorkerRequestSchema = import_zod3.z.object({
|
|
4586
|
+
rootDir: import_zod3.z.string().min(1),
|
|
4515
4587
|
options: ScanWorkspaceOptionsSchema.optional()
|
|
4516
4588
|
});
|
|
4517
|
-
ScannerWorkerSuccessMessageSchema =
|
|
4518
|
-
ok:
|
|
4589
|
+
ScannerWorkerSuccessMessageSchema = import_zod3.z.object({
|
|
4590
|
+
ok: import_zod3.z.literal(true),
|
|
4519
4591
|
result: ScanWorkspaceResultSchema
|
|
4520
4592
|
});
|
|
4521
|
-
ScannerWorkerErrorMessageSchema =
|
|
4522
|
-
ok:
|
|
4523
|
-
error:
|
|
4593
|
+
ScannerWorkerErrorMessageSchema = import_zod3.z.object({
|
|
4594
|
+
ok: import_zod3.z.literal(false),
|
|
4595
|
+
error: import_zod3.z.string().optional()
|
|
4524
4596
|
});
|
|
4525
|
-
ScannerWorkerMessageSchema =
|
|
4597
|
+
ScannerWorkerMessageSchema = import_zod3.z.union([
|
|
4526
4598
|
ScannerWorkerSuccessMessageSchema,
|
|
4527
4599
|
ScannerWorkerErrorMessageSchema
|
|
4528
4600
|
]);
|
|
@@ -4552,8 +4624,8 @@ function getRuntimeDir() {
|
|
|
4552
4624
|
if (typeof __dirname !== "undefined" && __dirname.length > 0) {
|
|
4553
4625
|
return __dirname;
|
|
4554
4626
|
}
|
|
4555
|
-
if (typeof
|
|
4556
|
-
return
|
|
4627
|
+
if (typeof import_meta10 !== "undefined" && import_meta10.url) {
|
|
4628
|
+
return import_node_path8.default.dirname((0, import_node_url4.fileURLToPath)(import_meta10.url));
|
|
4557
4629
|
}
|
|
4558
4630
|
return process.cwd();
|
|
4559
4631
|
}
|
|
@@ -4562,18 +4634,18 @@ function resolveScannerWorkerModulePath() {
|
|
|
4562
4634
|
if (typeof __dirname !== "undefined" && __dirname.length > 0) {
|
|
4563
4635
|
return __dirname;
|
|
4564
4636
|
}
|
|
4565
|
-
if (typeof
|
|
4566
|
-
return
|
|
4637
|
+
if (typeof import_meta10 !== "undefined" && import_meta10.url) {
|
|
4638
|
+
return import_node_path8.default.dirname((0, import_node_url4.fileURLToPath)(import_meta10.url));
|
|
4567
4639
|
}
|
|
4568
4640
|
return process.cwd();
|
|
4569
4641
|
})();
|
|
4570
4642
|
const candidates = [
|
|
4571
|
-
|
|
4572
|
-
|
|
4573
|
-
|
|
4643
|
+
import_node_path8.default.resolve(runtimeDir, "worker.cjs"),
|
|
4644
|
+
import_node_path8.default.resolve(runtimeDir, "worker.js"),
|
|
4645
|
+
import_node_path8.default.resolve(runtimeDir, "worker.ts")
|
|
4574
4646
|
];
|
|
4575
4647
|
for (const candidate of candidates) {
|
|
4576
|
-
if (
|
|
4648
|
+
if (import_node_fs6.default.existsSync(candidate)) return candidate;
|
|
4577
4649
|
}
|
|
4578
4650
|
return null;
|
|
4579
4651
|
}
|
|
@@ -4585,7 +4657,7 @@ function scanWorkspaceInWorker(rootDir, options) {
|
|
|
4585
4657
|
}
|
|
4586
4658
|
return new Promise((resolve2, reject) => {
|
|
4587
4659
|
const settleState = { settled: false };
|
|
4588
|
-
const worker = new
|
|
4660
|
+
const worker = new import_node_worker_threads2.Worker(modulePath, { workerData: { rootDir, options: normalizedOptions } });
|
|
4589
4661
|
const timeout = setTimeout(() => {
|
|
4590
4662
|
if (!settleState.settled) {
|
|
4591
4663
|
settleState.settled = true;
|
|
@@ -4630,19 +4702,19 @@ function collectCandidates(rootDir, ignoreDirectories, extensionSet) {
|
|
|
4630
4702
|
if (!currentDir) continue;
|
|
4631
4703
|
const entries = (() => {
|
|
4632
4704
|
try {
|
|
4633
|
-
return
|
|
4705
|
+
return import_node_fs6.default.readdirSync(currentDir, { withFileTypes: true });
|
|
4634
4706
|
} catch {
|
|
4635
4707
|
return [];
|
|
4636
4708
|
}
|
|
4637
4709
|
})();
|
|
4638
4710
|
for (const entry of entries) {
|
|
4639
|
-
const fullPath =
|
|
4711
|
+
const fullPath = import_node_path8.default.join(currentDir, entry.name);
|
|
4640
4712
|
if (entry.isDirectory()) {
|
|
4641
4713
|
if (!ignoreDirectories.has(entry.name)) directories.push(fullPath);
|
|
4642
4714
|
continue;
|
|
4643
4715
|
}
|
|
4644
4716
|
if (!entry.isFile()) continue;
|
|
4645
|
-
if (!extensionSet.has(
|
|
4717
|
+
if (!extensionSet.has(import_node_path8.default.extname(entry.name))) continue;
|
|
4646
4718
|
candidates.push(fullPath);
|
|
4647
4719
|
}
|
|
4648
4720
|
}
|
|
@@ -4669,7 +4741,7 @@ function scanSource(source) {
|
|
|
4669
4741
|
);
|
|
4670
4742
|
}
|
|
4671
4743
|
function isScannableFile2(filePath, includeExtensions = DEFAULT_EXTENSIONS) {
|
|
4672
|
-
return includeExtensions.includes(
|
|
4744
|
+
return includeExtensions.includes(import_node_path8.default.extname(filePath));
|
|
4673
4745
|
}
|
|
4674
4746
|
function scanFile2(filePath) {
|
|
4675
4747
|
const { scanFileNative: scanFileNative3 } = (init_native_bridge(), __toCommonJS(native_bridge_exports));
|
|
@@ -4689,7 +4761,7 @@ function scanWorkspace2(rootDir, options = {}) {
|
|
|
4689
4761
|
const extensionSet = buildExtensionSet(includeExtensions);
|
|
4690
4762
|
const ignoreDirectories = new Set(normalizedOptions.ignoreDirectories ?? DEFAULT_IGNORES);
|
|
4691
4763
|
const useCache = normalizedOptions.useCache ?? true;
|
|
4692
|
-
normalizedOptions.smartInvalidation ?? true;
|
|
4764
|
+
const _smartInvalidation = normalizedOptions.smartInvalidation ?? true;
|
|
4693
4765
|
const files = [];
|
|
4694
4766
|
const unique = /* @__PURE__ */ new Set();
|
|
4695
4767
|
const candidates = collectCandidates(rootDir, ignoreDirectories, extensionSet);
|
|
@@ -4729,7 +4801,7 @@ function scanWorkspace2(rootDir, options = {}) {
|
|
|
4729
4801
|
for (const filePath of candidates) {
|
|
4730
4802
|
const stat = (() => {
|
|
4731
4803
|
try {
|
|
4732
|
-
return
|
|
4804
|
+
return import_node_fs6.default.statSync(filePath);
|
|
4733
4805
|
} catch {
|
|
4734
4806
|
return null;
|
|
4735
4807
|
}
|
|
@@ -4755,7 +4827,7 @@ function scanWorkspace2(rootDir, options = {}) {
|
|
|
4755
4827
|
for (const { filePath, stat, size, cached } of ranked) {
|
|
4756
4828
|
const content = (() => {
|
|
4757
4829
|
try {
|
|
4758
|
-
return
|
|
4830
|
+
return import_node_fs6.default.readFileSync(filePath, "utf8");
|
|
4759
4831
|
} catch {
|
|
4760
4832
|
return null;
|
|
4761
4833
|
}
|
|
@@ -4836,9 +4908,15 @@ async function scanWorkspaceAsync(rootDir, options = {}) {
|
|
|
4836
4908
|
return scanWorkspace2(rootDir, normalizedOptions);
|
|
4837
4909
|
}
|
|
4838
4910
|
}
|
|
4839
|
-
var log3, SCAN_WORKER_TIMEOUT_MS, createNativeParserLoader, nativeParserLoader, DEFAULT_EXTENSIONS, DEFAULT_IGNORES;
|
|
4911
|
+
var import_node_fs6, import_node_module6, import_node_path8, import_node_url4, import_node_worker_threads2, import_meta10, log3, SCAN_WORKER_TIMEOUT_MS, createNativeParserLoader, nativeParserLoader, DEFAULT_EXTENSIONS, DEFAULT_IGNORES;
|
|
4840
4912
|
var init_src3 = __esm({
|
|
4841
4913
|
"packages/domain/scanner/src/index.ts"() {
|
|
4914
|
+
"use strict";
|
|
4915
|
+
import_node_fs6 = __toESM(require("fs"), 1);
|
|
4916
|
+
import_node_module6 = require("module");
|
|
4917
|
+
import_node_path8 = __toESM(require("path"), 1);
|
|
4918
|
+
import_node_url4 = require("url");
|
|
4919
|
+
import_node_worker_threads2 = require("worker_threads");
|
|
4842
4920
|
init_src();
|
|
4843
4921
|
init_cache_native();
|
|
4844
4922
|
init_native_bridge();
|
|
@@ -4846,6 +4924,7 @@ var init_src3 = __esm({
|
|
|
4846
4924
|
init_schemas();
|
|
4847
4925
|
init_schemas();
|
|
4848
4926
|
init_native_bridge();
|
|
4927
|
+
import_meta10 = {};
|
|
4849
4928
|
log3 = createLogger2("scanner");
|
|
4850
4929
|
SCAN_WORKER_TIMEOUT_MS = 12e4;
|
|
4851
4930
|
createNativeParserLoader = () => {
|
|
@@ -4859,7 +4938,7 @@ var init_src3 = __esm({
|
|
|
4859
4938
|
const loadNativeParserBinding = () => {
|
|
4860
4939
|
if (_state.binding !== void 0) return _state.binding;
|
|
4861
4940
|
const runtimeDir = getRuntimeDir();
|
|
4862
|
-
const req =
|
|
4941
|
+
const req = (0, import_node_module6.createRequire)(import_node_path8.default.join(runtimeDir, "noop.cjs"));
|
|
4863
4942
|
const _platform = process.platform;
|
|
4864
4943
|
const _arch = process.arch;
|
|
4865
4944
|
const _platformArch = `${_platform}-${_arch}`;
|
|
@@ -4867,27 +4946,27 @@ var init_src3 = __esm({
|
|
|
4867
4946
|
const candidates = [
|
|
4868
4947
|
// ── binaryName baru: tailwind-styled-native (napi-rs naming) ──
|
|
4869
4948
|
// cwd = repo root saat run dari root, atau package dir saat workspaces
|
|
4870
|
-
|
|
4871
|
-
|
|
4872
|
-
|
|
4949
|
+
import_node_path8.default.resolve(process.cwd(), "native", "tailwind-styled-native.node"),
|
|
4950
|
+
import_node_path8.default.resolve(process.cwd(), "native", `tailwind-styled-native.${_platformArch}.node`),
|
|
4951
|
+
import_node_path8.default.resolve(process.cwd(), "native", `tailwind-styled-native.${_platformArchGnu}.node`),
|
|
4873
4952
|
// runtimeDir = dist/ → naik 1 level ke package root (npm install case)
|
|
4874
4953
|
// e.g. node_modules/tailwind-styled-v4/dist/ → node_modules/tailwind-styled-v4/native/
|
|
4875
|
-
|
|
4876
|
-
|
|
4877
|
-
|
|
4954
|
+
import_node_path8.default.resolve(runtimeDir, "..", "native", "tailwind-styled-native.node"),
|
|
4955
|
+
import_node_path8.default.resolve(runtimeDir, "..", "native", `tailwind-styled-native.${_platformArch}.node`),
|
|
4956
|
+
import_node_path8.default.resolve(runtimeDir, "..", "native", `tailwind-styled-native.${_platformArchGnu}.node`),
|
|
4878
4957
|
// runtimeDir = dist/ → naik 4 level ke repo root (monorepo dev case)
|
|
4879
|
-
|
|
4880
|
-
|
|
4958
|
+
import_node_path8.default.resolve(runtimeDir, "..", "..", "..", "..", "native", "tailwind-styled-native.node"),
|
|
4959
|
+
import_node_path8.default.resolve(runtimeDir, "..", "..", "..", "..", "native", `tailwind-styled-native.${_platformArchGnu}.node`),
|
|
4881
4960
|
// 3 level fallback (jika package di-nest lebih dangkal)
|
|
4882
|
-
|
|
4883
|
-
|
|
4961
|
+
import_node_path8.default.resolve(runtimeDir, "..", "..", "..", "native", "tailwind-styled-native.node"),
|
|
4962
|
+
import_node_path8.default.resolve(runtimeDir, "..", "..", "..", "native", `tailwind-styled-native.${_platformArchGnu}.node`),
|
|
4884
4963
|
// ── binaryName lama: tailwind_styled_parser (backward compat) ──
|
|
4885
|
-
|
|
4886
|
-
|
|
4887
|
-
|
|
4888
|
-
|
|
4889
|
-
|
|
4890
|
-
|
|
4964
|
+
import_node_path8.default.resolve(process.cwd(), "native/tailwind_styled_parser.node"),
|
|
4965
|
+
import_node_path8.default.resolve(process.cwd(), "native/build/Release/tailwind_styled_parser.node"),
|
|
4966
|
+
import_node_path8.default.resolve(runtimeDir, "..", "native", "tailwind_styled_parser.node"),
|
|
4967
|
+
import_node_path8.default.resolve(runtimeDir, "..", "..", "..", "..", "native", "tailwind_styled_parser.node"),
|
|
4968
|
+
import_node_path8.default.resolve(runtimeDir, "..", "..", "..", "native", "tailwind_styled_parser.node"),
|
|
4969
|
+
import_node_path8.default.resolve(
|
|
4891
4970
|
runtimeDir,
|
|
4892
4971
|
"..",
|
|
4893
4972
|
"..",
|
|
@@ -4899,7 +4978,7 @@ var init_src3 = __esm({
|
|
|
4899
4978
|
)
|
|
4900
4979
|
];
|
|
4901
4980
|
for (const fullPath of candidates) {
|
|
4902
|
-
if (!
|
|
4981
|
+
if (!import_node_fs6.default.existsSync(fullPath)) continue;
|
|
4903
4982
|
try {
|
|
4904
4983
|
const required = req(fullPath);
|
|
4905
4984
|
if (required && (typeof required.extractClassesFromSource === "function" || typeof required.parseClasses === "function" || typeof required.parse_classes === "function")) {
|
|
@@ -4935,21 +5014,23 @@ var init_src3 = __esm({
|
|
|
4935
5014
|
// packages/domain/engine/src/native-bridge.ts
|
|
4936
5015
|
function getDirname3() {
|
|
4937
5016
|
if (typeof __dirname !== "undefined") return __dirname;
|
|
4938
|
-
if (typeof
|
|
4939
|
-
return getDirname(
|
|
5017
|
+
if (typeof import_meta12 !== "undefined" && import_meta12.url) {
|
|
5018
|
+
return getDirname(import_meta12.url);
|
|
4940
5019
|
}
|
|
4941
5020
|
return process.cwd();
|
|
4942
5021
|
}
|
|
4943
5022
|
function getNativeEngineBinding() {
|
|
4944
5023
|
return engineBindingLoader.get();
|
|
4945
5024
|
}
|
|
4946
|
-
var log4, isValidEngineBinding, createEngineBindingLoader, engineBindingLoader;
|
|
5025
|
+
var import_meta12, log4, isValidEngineBinding, createEngineBindingLoader, engineBindingLoader;
|
|
4947
5026
|
var init_native_bridge2 = __esm({
|
|
4948
5027
|
"packages/domain/engine/src/native-bridge.ts"() {
|
|
5028
|
+
"use strict";
|
|
4949
5029
|
init_src();
|
|
5030
|
+
import_meta12 = {};
|
|
4950
5031
|
log4 = createDebugLogger("engine:native");
|
|
4951
|
-
isValidEngineBinding = (
|
|
4952
|
-
const candidate =
|
|
5032
|
+
isValidEngineBinding = (module2) => {
|
|
5033
|
+
const candidate = module2;
|
|
4953
5034
|
return !!(candidate && (candidate.computeIncrementalDiff || candidate.processFileChange || candidate.hashFileContent));
|
|
4954
5035
|
};
|
|
4955
5036
|
createEngineBindingLoader = () => {
|
|
@@ -5024,16 +5105,32 @@ var init_native_bridge2 = __esm({
|
|
|
5024
5105
|
}
|
|
5025
5106
|
});
|
|
5026
5107
|
|
|
5108
|
+
// src/umbrella/vite.ts
|
|
5109
|
+
var vite_exports = {};
|
|
5110
|
+
__export(vite_exports, {
|
|
5111
|
+
tailwindStyledPlugin: () => tailwindStyledPlugin
|
|
5112
|
+
});
|
|
5113
|
+
module.exports = __toCommonJS(vite_exports);
|
|
5114
|
+
|
|
5027
5115
|
// packages/presentation/vite/src/plugin.ts
|
|
5116
|
+
var import_node_fs12 = __toESM(require("fs"), 1);
|
|
5117
|
+
var import_node_path14 = __toESM(require("path"), 1);
|
|
5028
5118
|
init_src2();
|
|
5029
5119
|
|
|
5120
|
+
// packages/domain/engine/src/index.ts
|
|
5121
|
+
var import_node_fs11 = __toESM(require("fs"), 1);
|
|
5122
|
+
var import_node_path13 = __toESM(require("path"), 1);
|
|
5123
|
+
var import_node_url6 = require("url");
|
|
5124
|
+
|
|
5030
5125
|
// packages/domain/analyzer/src/analyzeWorkspace.ts
|
|
5126
|
+
var import_node_path10 = __toESM(require("path"), 1);
|
|
5031
5127
|
init_src3();
|
|
5032
5128
|
|
|
5033
5129
|
// packages/domain/analyzer/src/binding.ts
|
|
5034
5130
|
init_src();
|
|
5035
5131
|
|
|
5036
5132
|
// packages/domain/analyzer/src/utils.ts
|
|
5133
|
+
var import_node_fs7 = __toESM(require("fs"), 1);
|
|
5037
5134
|
init_src();
|
|
5038
5135
|
var DEFAULT_TOP_LIMIT = 10;
|
|
5039
5136
|
var DEFAULT_FREQUENT_THRESHOLD = 2;
|
|
@@ -5048,7 +5145,7 @@ function isRecord(value) {
|
|
|
5048
5145
|
}
|
|
5049
5146
|
async function pathExists(filePath) {
|
|
5050
5147
|
try {
|
|
5051
|
-
await
|
|
5148
|
+
await import_node_fs7.default.promises.access(filePath, import_node_fs7.default.constants.F_OK);
|
|
5052
5149
|
return true;
|
|
5053
5150
|
} catch {
|
|
5054
5151
|
return false;
|
|
@@ -5065,8 +5162,9 @@ function sanitizeFrequentThreshold(value) {
|
|
|
5065
5162
|
}
|
|
5066
5163
|
|
|
5067
5164
|
// packages/domain/analyzer/src/binding.ts
|
|
5068
|
-
var
|
|
5069
|
-
|
|
5165
|
+
var import_meta11 = {};
|
|
5166
|
+
var isAnalyzerModule = (module2) => {
|
|
5167
|
+
const candidate = module2;
|
|
5070
5168
|
return typeof candidate?.analyzeClasses === "function" || typeof candidate?.analyzeClassesWorkspace === "function";
|
|
5071
5169
|
};
|
|
5072
5170
|
var createAnalyzerBindingLoader = () => {
|
|
@@ -5076,7 +5174,7 @@ var createAnalyzerBindingLoader = () => {
|
|
|
5076
5174
|
_state.bindingPromise = (async () => {
|
|
5077
5175
|
const runtimeDir = resolveRuntimeDir(
|
|
5078
5176
|
typeof __dirname === "string" ? __dirname : void 0,
|
|
5079
|
-
|
|
5177
|
+
import_meta11.url
|
|
5080
5178
|
);
|
|
5081
5179
|
const candidates = resolveNativeBindingCandidates({
|
|
5082
5180
|
runtimeDir,
|
|
@@ -5119,7 +5217,7 @@ async function requireNativeBinding() {
|
|
|
5119
5217
|
if (binding?.analyzeClasses) return binding;
|
|
5120
5218
|
const runtimeDir = resolveRuntimeDir(
|
|
5121
5219
|
typeof __dirname === "string" ? __dirname : void 0,
|
|
5122
|
-
|
|
5220
|
+
import_meta11.url
|
|
5123
5221
|
);
|
|
5124
5222
|
const candidates = resolveNativeBindingCandidates({
|
|
5125
5223
|
runtimeDir,
|
|
@@ -5147,6 +5245,7 @@ async function requireNativeBinding() {
|
|
|
5147
5245
|
|
|
5148
5246
|
// packages/domain/analyzer/src/schemas.ts
|
|
5149
5247
|
init_src();
|
|
5248
|
+
var import_zod4 = require("zod");
|
|
5150
5249
|
var formatIssuePath3 = (path16) => path16.length > 0 ? path16.map(
|
|
5151
5250
|
(segment) => typeof segment === "symbol" ? segment.description ?? segment.toString() : String(segment)
|
|
5152
5251
|
).join(".") : "<root>";
|
|
@@ -5170,81 +5269,86 @@ var parseWithSchema2 = (schema, data, label) => {
|
|
|
5170
5269
|
parsed.error
|
|
5171
5270
|
);
|
|
5172
5271
|
};
|
|
5173
|
-
var CountSchema =
|
|
5174
|
-
|
|
5175
|
-
name:
|
|
5272
|
+
var CountSchema = import_zod4.z.number().int().min(0);
|
|
5273
|
+
var ClassUsageSchema = import_zod4.z.object({
|
|
5274
|
+
name: import_zod4.z.string(),
|
|
5176
5275
|
count: CountSchema,
|
|
5177
|
-
isUnused:
|
|
5178
|
-
isConflict:
|
|
5276
|
+
isUnused: import_zod4.z.boolean().optional(),
|
|
5277
|
+
isConflict: import_zod4.z.boolean().optional()
|
|
5179
5278
|
});
|
|
5180
|
-
|
|
5181
|
-
className:
|
|
5182
|
-
variants:
|
|
5183
|
-
classes:
|
|
5184
|
-
message:
|
|
5279
|
+
var ClassConflictSchema = import_zod4.z.object({
|
|
5280
|
+
className: import_zod4.z.string(),
|
|
5281
|
+
variants: import_zod4.z.array(import_zod4.z.string()),
|
|
5282
|
+
classes: import_zod4.z.array(import_zod4.z.string()),
|
|
5283
|
+
message: import_zod4.z.string()
|
|
5185
5284
|
});
|
|
5186
|
-
var ClassCountSchema =
|
|
5187
|
-
name:
|
|
5285
|
+
var ClassCountSchema = import_zod4.z.object({
|
|
5286
|
+
name: import_zod4.z.string(),
|
|
5188
5287
|
count: CountSchema
|
|
5189
5288
|
});
|
|
5190
|
-
var NativeReportSchema =
|
|
5191
|
-
root:
|
|
5289
|
+
var NativeReportSchema = import_zod4.z.object({
|
|
5290
|
+
root: import_zod4.z.string(),
|
|
5192
5291
|
totalFiles: CountSchema,
|
|
5193
5292
|
uniqueClassCount: CountSchema,
|
|
5194
5293
|
totalClassOccurrences: CountSchema,
|
|
5195
|
-
topClasses:
|
|
5196
|
-
duplicateCandidates:
|
|
5197
|
-
safelist:
|
|
5294
|
+
topClasses: import_zod4.z.array(ClassCountSchema),
|
|
5295
|
+
duplicateCandidates: import_zod4.z.array(ClassCountSchema),
|
|
5296
|
+
safelist: import_zod4.z.array(import_zod4.z.string())
|
|
5198
5297
|
});
|
|
5199
|
-
|
|
5200
|
-
css:
|
|
5201
|
-
resolvedClasses:
|
|
5202
|
-
unknownClasses:
|
|
5298
|
+
var NativeCssCompileResultSchema2 = import_zod4.z.object({
|
|
5299
|
+
css: import_zod4.z.string(),
|
|
5300
|
+
resolvedClasses: import_zod4.z.array(import_zod4.z.string()),
|
|
5301
|
+
unknownClasses: import_zod4.z.array(import_zod4.z.string()),
|
|
5203
5302
|
sizeBytes: CountSchema
|
|
5204
5303
|
});
|
|
5205
|
-
var AnalyzerClassStatsSchema =
|
|
5206
|
-
top:
|
|
5304
|
+
var AnalyzerClassStatsSchema = import_zod4.z.object({
|
|
5305
|
+
top: import_zod4.z.number({
|
|
5207
5306
|
error: "analyzeWorkspace options.classStats.top must be a number when provided."
|
|
5208
5307
|
}).finite().optional(),
|
|
5209
|
-
frequentThreshold:
|
|
5308
|
+
frequentThreshold: import_zod4.z.number({
|
|
5210
5309
|
error: "analyzeWorkspace options.classStats.frequentThreshold must be a number when provided."
|
|
5211
5310
|
}).finite().optional()
|
|
5212
5311
|
});
|
|
5213
|
-
var AnalyzerSemanticOptionsSchema =
|
|
5214
|
-
tailwindConfigPath:
|
|
5312
|
+
var AnalyzerSemanticOptionsSchema = import_zod4.z.object({
|
|
5313
|
+
tailwindConfigPath: import_zod4.z.string({
|
|
5215
5314
|
error: "analyzeWorkspace options.semantic.tailwindConfigPath must be a non-empty string when provided."
|
|
5216
5315
|
}).min(
|
|
5217
5316
|
1,
|
|
5218
5317
|
"analyzeWorkspace options.semantic.tailwindConfigPath must be a non-empty string when provided."
|
|
5219
5318
|
).optional()
|
|
5220
5319
|
});
|
|
5221
|
-
var AnalyzerOptionsSchema =
|
|
5222
|
-
scanner:
|
|
5320
|
+
var AnalyzerOptionsSchema = import_zod4.z.object({
|
|
5321
|
+
scanner: import_zod4.z.custom(
|
|
5223
5322
|
(value) => isPlainObject(value),
|
|
5224
5323
|
"analyzeWorkspace options.scanner must be an object when provided."
|
|
5225
5324
|
).optional(),
|
|
5226
5325
|
classStats: AnalyzerClassStatsSchema.optional(),
|
|
5227
|
-
semantic:
|
|
5228
|
-
|
|
5326
|
+
semantic: import_zod4.z.union([
|
|
5327
|
+
import_zod4.z.boolean({
|
|
5229
5328
|
error: "analyzeWorkspace options.semantic must be a boolean or an object when provided."
|
|
5230
5329
|
}),
|
|
5231
5330
|
AnalyzerSemanticOptionsSchema
|
|
5232
5331
|
]).optional(),
|
|
5233
|
-
includeClass:
|
|
5332
|
+
includeClass: import_zod4.z.custom(
|
|
5234
5333
|
(value) => typeof value === "function",
|
|
5235
5334
|
"analyzeWorkspace options.includeClass must be a function when provided."
|
|
5236
5335
|
).optional()
|
|
5237
5336
|
});
|
|
5238
|
-
|
|
5239
|
-
prefix:
|
|
5337
|
+
var ClassToCssOptionsSchema = import_zod4.z.object({
|
|
5338
|
+
prefix: import_zod4.z.union([import_zod4.z.string(), import_zod4.z.null()], {
|
|
5240
5339
|
error: "classToCss options.prefix must be a string or null when provided."
|
|
5241
5340
|
}).optional(),
|
|
5242
|
-
strict:
|
|
5341
|
+
strict: import_zod4.z.boolean({
|
|
5243
5342
|
error: "classToCss options.strict must be a boolean when provided."
|
|
5244
5343
|
}).optional()
|
|
5245
5344
|
});
|
|
5246
5345
|
var parseAnalyzerOptions = (options) => parseWithSchema2(AnalyzerOptionsSchema, options ?? {}, "analyzeWorkspace options are invalid");
|
|
5247
5346
|
var parseNativeReport = (report) => parseWithSchema2(NativeReportSchema, report, "Native analyzer report is invalid");
|
|
5347
|
+
|
|
5348
|
+
// packages/domain/analyzer/src/semantic.ts
|
|
5349
|
+
var import_node_fs8 = __toESM(require("fs"), 1);
|
|
5350
|
+
var import_node_path9 = __toESM(require("path"), 1);
|
|
5351
|
+
var import_node_url5 = require("url");
|
|
5248
5352
|
var SUPPORTED_TAILWIND_CONFIG_EXTENSIONS = /* @__PURE__ */ new Set([".ts", ".js", ".cjs", ".mjs"]);
|
|
5249
5353
|
var tailwindConfigCache = /* @__PURE__ */ new Map();
|
|
5250
5354
|
var detectConflicts2 = async (usages) => {
|
|
@@ -5264,11 +5368,11 @@ var detectConflicts2 = async (usages) => {
|
|
|
5264
5368
|
};
|
|
5265
5369
|
};
|
|
5266
5370
|
var isSupportedTailwindConfigPath = (configPath) => {
|
|
5267
|
-
return SUPPORTED_TAILWIND_CONFIG_EXTENSIONS.has(
|
|
5371
|
+
return SUPPORTED_TAILWIND_CONFIG_EXTENSIONS.has(import_node_path9.default.extname(configPath).toLowerCase());
|
|
5268
5372
|
};
|
|
5269
5373
|
var resolveTailwindConfigPath = async (root, explicitPath) => {
|
|
5270
5374
|
if (explicitPath) {
|
|
5271
|
-
const resolved =
|
|
5375
|
+
const resolved = import_node_path9.default.resolve(root, explicitPath);
|
|
5272
5376
|
if (!await pathExists(resolved)) return null;
|
|
5273
5377
|
return resolved;
|
|
5274
5378
|
}
|
|
@@ -5279,7 +5383,7 @@ var resolveTailwindConfigPath = async (root, explicitPath) => {
|
|
|
5279
5383
|
"tailwind.config.mjs"
|
|
5280
5384
|
];
|
|
5281
5385
|
for (const candidate of candidates) {
|
|
5282
|
-
const fullPath =
|
|
5386
|
+
const fullPath = import_node_path9.default.resolve(root, candidate);
|
|
5283
5387
|
if (await pathExists(fullPath)) return fullPath;
|
|
5284
5388
|
}
|
|
5285
5389
|
return null;
|
|
@@ -5333,7 +5437,7 @@ var collectCustomUtilities = (config) => {
|
|
|
5333
5437
|
return out;
|
|
5334
5438
|
};
|
|
5335
5439
|
var collectSafelistFromSource = async (configPath) => {
|
|
5336
|
-
const source = await
|
|
5440
|
+
const source = await import_node_fs8.default.promises.readFile(configPath, "utf8");
|
|
5337
5441
|
const { extractClassesNative: extractClassesNative2 } = await Promise.resolve().then(() => (init_src3(), src_exports2));
|
|
5338
5442
|
const allTokens = extractClassesNative2(source);
|
|
5339
5443
|
const hasSafelist = source.includes("safelist");
|
|
@@ -5360,7 +5464,7 @@ var loadTailwindConfig2 = async (root, semanticOption) => {
|
|
|
5360
5464
|
customUtilities: /* @__PURE__ */ new Set()
|
|
5361
5465
|
};
|
|
5362
5466
|
}
|
|
5363
|
-
const configStat = await
|
|
5467
|
+
const configStat = await import_node_fs8.default.promises.stat(configPath).catch(() => null);
|
|
5364
5468
|
if (configStat) {
|
|
5365
5469
|
const cached = tailwindConfigCache.get(configPath);
|
|
5366
5470
|
if (cached && cached.mtimeMs === configStat.mtimeMs && cached.size === configStat.size) {
|
|
@@ -5373,7 +5477,7 @@ var loadTailwindConfig2 = async (root, semanticOption) => {
|
|
|
5373
5477
|
const result = await (async () => {
|
|
5374
5478
|
try {
|
|
5375
5479
|
const cacheBustToken = Math.trunc(configStat?.mtimeMs ?? Date.now());
|
|
5376
|
-
const imported = await import(`${
|
|
5480
|
+
const imported = await import(`${(0, import_node_url5.pathToFileURL)(configPath).href}?tws_mtime=${cacheBustToken}`);
|
|
5377
5481
|
const candidate = imported.default ?? imported;
|
|
5378
5482
|
if (isRecord(candidate)) {
|
|
5379
5483
|
return { config: candidate, warning: void 0 };
|
|
@@ -5519,7 +5623,7 @@ async function buildDistribution(usages, native) {
|
|
|
5519
5623
|
}
|
|
5520
5624
|
async function analyzeWorkspace(root, options = {}) {
|
|
5521
5625
|
const startedAtMs = Date.now();
|
|
5522
|
-
const resolvedRoot =
|
|
5626
|
+
const resolvedRoot = import_node_path10.default.resolve(root);
|
|
5523
5627
|
const normalizedOptions = parseAnalyzerOptions(options);
|
|
5524
5628
|
const scan = await (async () => {
|
|
5525
5629
|
const scanStartedAtMs = Date.now();
|
|
@@ -5628,6 +5732,8 @@ init_src3();
|
|
|
5628
5732
|
init_src();
|
|
5629
5733
|
|
|
5630
5734
|
// packages/domain/engine/src/incremental.ts
|
|
5735
|
+
var import_node_fs9 = __toESM(require("fs"), 1);
|
|
5736
|
+
var import_node_path11 = __toESM(require("path"), 1);
|
|
5631
5737
|
init_src3();
|
|
5632
5738
|
init_src();
|
|
5633
5739
|
init_native_bridge2();
|
|
@@ -5663,8 +5769,8 @@ function areClassSetsEqual(a, b) {
|
|
|
5663
5769
|
function applyIncrementalChange(previous, filePath, type, scanner) {
|
|
5664
5770
|
const includeExtensions = scanner?.includeExtensions ?? DEFAULT_EXTENSIONS2;
|
|
5665
5771
|
if (!isScannableFile2(filePath, includeExtensions)) return previous;
|
|
5666
|
-
const byFile = new Map(previous.files.map((f) => [
|
|
5667
|
-
const normalizedPath =
|
|
5772
|
+
const byFile = new Map(previous.files.map((f) => [import_node_path11.default.resolve(f.file), f]));
|
|
5773
|
+
const normalizedPath = import_node_path11.default.resolve(filePath);
|
|
5668
5774
|
const native = getNativeEngineBinding();
|
|
5669
5775
|
if (!native?.processFileChange) {
|
|
5670
5776
|
throw new Error(
|
|
@@ -5680,7 +5786,7 @@ function applyIncrementalChange(previous, filePath, type, scanner) {
|
|
|
5680
5786
|
}
|
|
5681
5787
|
log5.debug(`native change ${normalizedPath}`);
|
|
5682
5788
|
const scanned = scanFile2(normalizedPath);
|
|
5683
|
-
const content =
|
|
5789
|
+
const content = import_node_fs9.default.readFileSync(normalizedPath, "utf8");
|
|
5684
5790
|
const diff = native.processFileChange(normalizedPath, scanned.classes, content);
|
|
5685
5791
|
const existing = byFile.get(normalizedPath);
|
|
5686
5792
|
if (diff && existing) {
|
|
@@ -5744,13 +5850,17 @@ var EngineMetricsCollector = class {
|
|
|
5744
5850
|
};
|
|
5745
5851
|
|
|
5746
5852
|
// packages/domain/engine/src/metricsWriter.ts
|
|
5853
|
+
var import_node_fs10 = __toESM(require("fs"), 1);
|
|
5854
|
+
var import_node_path12 = __toESM(require("path"), 1);
|
|
5855
|
+
var import_node_perf_hooks = require("perf_hooks");
|
|
5747
5856
|
init_src();
|
|
5857
|
+
var _log = createLogger2("tw:metrics");
|
|
5748
5858
|
var METRICS_FILE_NAME = "metrics.json";
|
|
5749
5859
|
var CACHE_DIR = ".tw-cache";
|
|
5750
5860
|
function writeMetrics(metrics, cwd = process.cwd()) {
|
|
5751
5861
|
try {
|
|
5752
|
-
const cacheDir =
|
|
5753
|
-
|
|
5862
|
+
const cacheDir = import_node_path12.default.join(cwd, CACHE_DIR);
|
|
5863
|
+
import_node_fs10.default.mkdirSync(cacheDir, { recursive: true });
|
|
5754
5864
|
const mem = process.memoryUsage();
|
|
5755
5865
|
const data = {
|
|
5756
5866
|
...metrics,
|
|
@@ -5761,7 +5871,7 @@ function writeMetrics(metrics, cwd = process.cwd()) {
|
|
|
5761
5871
|
},
|
|
5762
5872
|
generatedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
5763
5873
|
};
|
|
5764
|
-
|
|
5874
|
+
import_node_fs10.default.writeFileSync(import_node_path12.default.join(cacheDir, METRICS_FILE_NAME), JSON.stringify(data, null, 2));
|
|
5765
5875
|
} catch {
|
|
5766
5876
|
}
|
|
5767
5877
|
}
|
|
@@ -5813,6 +5923,9 @@ async function runAfterWatch(plugins, context) {
|
|
|
5813
5923
|
await plugin.afterWatch?.(context);
|
|
5814
5924
|
}
|
|
5815
5925
|
}
|
|
5926
|
+
|
|
5927
|
+
// packages/domain/engine/src/schemas.ts
|
|
5928
|
+
var import_zod5 = require("zod");
|
|
5816
5929
|
var formatIssues3 = (error) => error.issues.map((issue) => {
|
|
5817
5930
|
const p = issue.path.length > 0 ? issue.path.join(".") : "<root>";
|
|
5818
5931
|
return `${p}: ${issue.message}`;
|
|
@@ -5822,46 +5935,46 @@ var parseWithSchema3 = (schema, data, label) => {
|
|
|
5822
5935
|
if (parsed.success) return parsed.data;
|
|
5823
5936
|
throw new TypeError(`${label}: ${formatIssues3(parsed.error)}`);
|
|
5824
5937
|
};
|
|
5825
|
-
var EngineOptionsSchema =
|
|
5826
|
-
root:
|
|
5827
|
-
scanner:
|
|
5828
|
-
includeExtensions:
|
|
5829
|
-
ignoreDirectories:
|
|
5830
|
-
useCache:
|
|
5831
|
-
cacheDir:
|
|
5832
|
-
smartInvalidation:
|
|
5938
|
+
var EngineOptionsSchema = import_zod5.z.object({
|
|
5939
|
+
root: import_zod5.z.string().optional(),
|
|
5940
|
+
scanner: import_zod5.z.object({
|
|
5941
|
+
includeExtensions: import_zod5.z.array(import_zod5.z.string()).optional(),
|
|
5942
|
+
ignoreDirectories: import_zod5.z.array(import_zod5.z.string()).optional(),
|
|
5943
|
+
useCache: import_zod5.z.boolean().optional(),
|
|
5944
|
+
cacheDir: import_zod5.z.string().min(1).optional(),
|
|
5945
|
+
smartInvalidation: import_zod5.z.boolean().optional()
|
|
5833
5946
|
}).optional(),
|
|
5834
|
-
compileCss:
|
|
5835
|
-
tailwindConfigPath:
|
|
5836
|
-
analyze:
|
|
5837
|
-
plugins:
|
|
5947
|
+
compileCss: import_zod5.z.boolean().optional(),
|
|
5948
|
+
tailwindConfigPath: import_zod5.z.string().optional(),
|
|
5949
|
+
analyze: import_zod5.z.boolean().optional(),
|
|
5950
|
+
plugins: import_zod5.z.array(import_zod5.z.custom()).optional()
|
|
5838
5951
|
});
|
|
5839
|
-
var EngineWatchOptionsSchema =
|
|
5840
|
-
debounceMs:
|
|
5841
|
-
maxEventsPerFlush:
|
|
5842
|
-
largeFileThreshold:
|
|
5952
|
+
var EngineWatchOptionsSchema = import_zod5.z.object({
|
|
5953
|
+
debounceMs: import_zod5.z.number().int().min(0).optional(),
|
|
5954
|
+
maxEventsPerFlush: import_zod5.z.number().int().min(1).optional(),
|
|
5955
|
+
largeFileThreshold: import_zod5.z.number().int().min(0).optional()
|
|
5843
5956
|
});
|
|
5844
|
-
|
|
5845
|
-
scan:
|
|
5846
|
-
files:
|
|
5847
|
-
|
|
5957
|
+
var BuildResultSchema = import_zod5.z.object({
|
|
5958
|
+
scan: import_zod5.z.object({
|
|
5959
|
+
files: import_zod5.z.array(
|
|
5960
|
+
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
5961
|
),
|
|
5849
|
-
totalFiles:
|
|
5850
|
-
uniqueClasses:
|
|
5962
|
+
totalFiles: import_zod5.z.number().int().min(0),
|
|
5963
|
+
uniqueClasses: import_zod5.z.array(import_zod5.z.string())
|
|
5851
5964
|
}),
|
|
5852
|
-
mergedClassList:
|
|
5853
|
-
css:
|
|
5854
|
-
analysis:
|
|
5855
|
-
unusedClasses:
|
|
5856
|
-
classConflicts:
|
|
5857
|
-
|
|
5858
|
-
className:
|
|
5859
|
-
files:
|
|
5860
|
-
classes:
|
|
5861
|
-
message:
|
|
5965
|
+
mergedClassList: import_zod5.z.string(),
|
|
5966
|
+
css: import_zod5.z.string(),
|
|
5967
|
+
analysis: import_zod5.z.object({
|
|
5968
|
+
unusedClasses: import_zod5.z.array(import_zod5.z.string()),
|
|
5969
|
+
classConflicts: import_zod5.z.array(
|
|
5970
|
+
import_zod5.z.object({
|
|
5971
|
+
className: import_zod5.z.string(),
|
|
5972
|
+
files: import_zod5.z.array(import_zod5.z.string()),
|
|
5973
|
+
classes: import_zod5.z.array(import_zod5.z.string()).optional(),
|
|
5974
|
+
message: import_zod5.z.string().optional()
|
|
5862
5975
|
})
|
|
5863
5976
|
),
|
|
5864
|
-
classUsage:
|
|
5977
|
+
classUsage: import_zod5.z.record(import_zod5.z.string(), import_zod5.z.number())
|
|
5865
5978
|
}).optional()
|
|
5866
5979
|
});
|
|
5867
5980
|
var parseEngineOptions = (options) => parseWithSchema3(EngineOptionsSchema, options ?? {}, "engine options are invalid");
|
|
@@ -5875,7 +5988,7 @@ function getNativeWatcher() {
|
|
|
5875
5988
|
const { resolveNativeBinary: resolveNativeBinary2 } = (init_src(), __toCommonJS(src_exports));
|
|
5876
5989
|
const { path: binPath } = resolveNativeBinary2(__dirname);
|
|
5877
5990
|
if (binPath) {
|
|
5878
|
-
_native2 =
|
|
5991
|
+
_native2 = require(binPath);
|
|
5879
5992
|
}
|
|
5880
5993
|
} catch {
|
|
5881
5994
|
_native2 = {};
|
|
@@ -5960,11 +6073,11 @@ var configState = {
|
|
|
5960
6073
|
var log6 = createLogger2("engine");
|
|
5961
6074
|
async function loadTailwindConfigFromPath(root, tailwindConfigPath) {
|
|
5962
6075
|
if (!tailwindConfigPath) return void 0;
|
|
5963
|
-
const configPath =
|
|
5964
|
-
if (!
|
|
6076
|
+
const configPath = import_node_path13.default.resolve(root, tailwindConfigPath);
|
|
6077
|
+
if (!import_node_fs11.default.existsSync(configPath)) {
|
|
5965
6078
|
throw TwError.fromIo("CONFIG_NOT_FOUND", `tailwindConfigPath not found: ${configPath}`);
|
|
5966
6079
|
}
|
|
5967
|
-
const imported = await import(
|
|
6080
|
+
const imported = await import((0, import_node_url6.pathToFileURL)(configPath).href);
|
|
5968
6081
|
const config = imported.default ?? imported;
|
|
5969
6082
|
return config;
|
|
5970
6083
|
}
|
|
@@ -6027,11 +6140,11 @@ async function buildFromScan(scan, root, options, tailwindConfig) {
|
|
|
6027
6140
|
};
|
|
6028
6141
|
}
|
|
6029
6142
|
function countWorkspacePackages(root) {
|
|
6030
|
-
const packagesDir =
|
|
6031
|
-
if (!
|
|
6143
|
+
const packagesDir = import_node_path13.default.join(root, "packages");
|
|
6144
|
+
if (!import_node_fs11.default.existsSync(packagesDir)) return 0;
|
|
6032
6145
|
try {
|
|
6033
|
-
return
|
|
6034
|
-
(entry) => entry.isDirectory() &&
|
|
6146
|
+
return import_node_fs11.default.readdirSync(packagesDir, { withFileTypes: true }).filter(
|
|
6147
|
+
(entry) => entry.isDirectory() && import_node_fs11.default.existsSync(import_node_path13.default.join(packagesDir, entry.name, "package.json"))
|
|
6035
6148
|
).length;
|
|
6036
6149
|
} catch (err) {
|
|
6037
6150
|
log6.debug(`countWorkspacePackages: ${err instanceof Error ? err.message : String(err)}`);
|
|
@@ -6068,7 +6181,7 @@ function writeDashboardMetrics(root, mode, result, metrics) {
|
|
|
6068
6181
|
async function createEngine(rawOptions = {}) {
|
|
6069
6182
|
const options = parseEngineOptions(rawOptions);
|
|
6070
6183
|
const root = options.root ?? process.cwd();
|
|
6071
|
-
const resolvedRoot =
|
|
6184
|
+
const resolvedRoot = import_node_path13.default.resolve(root);
|
|
6072
6185
|
const plugins = rawOptions.plugins ?? [];
|
|
6073
6186
|
const getTailwindConfig = async () => {
|
|
6074
6187
|
if (configState.isLoaded()) return configState.getConfig();
|
|
@@ -6215,7 +6328,7 @@ async function createEngine(rawOptions = {}) {
|
|
|
6215
6328
|
const shouldForceFullRescan = (event) => {
|
|
6216
6329
|
if (event.type === "unlink") return false;
|
|
6217
6330
|
try {
|
|
6218
|
-
const stat =
|
|
6331
|
+
const stat = import_node_fs11.default.statSync(event.filePath);
|
|
6219
6332
|
if (stat.size > largeFileThreshold) {
|
|
6220
6333
|
metrics.markSkippedLargeFile();
|
|
6221
6334
|
return true;
|
|
@@ -6334,6 +6447,7 @@ async function createEngine(rawOptions = {}) {
|
|
|
6334
6447
|
}
|
|
6335
6448
|
|
|
6336
6449
|
// packages/presentation/vite/src/schemas.ts
|
|
6450
|
+
var import_zod6 = require("zod");
|
|
6337
6451
|
init_src();
|
|
6338
6452
|
var formatIssuePath4 = (path16) => path16.length > 0 ? path16.map(
|
|
6339
6453
|
(segment) => typeof segment === "symbol" ? segment.description ?? segment.toString() : String(segment)
|
|
@@ -6353,23 +6467,23 @@ var parseWithSchema4 = (schema, data, label) => {
|
|
|
6353
6467
|
parsed.error
|
|
6354
6468
|
);
|
|
6355
6469
|
};
|
|
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:
|
|
6470
|
+
var VitePluginOptionsSchema = import_zod6.z.object({
|
|
6471
|
+
include: import_zod6.z.instanceof(RegExp).optional(),
|
|
6472
|
+
exclude: import_zod6.z.instanceof(RegExp).optional(),
|
|
6473
|
+
scanDirs: import_zod6.z.array(import_zod6.z.string()).optional(),
|
|
6474
|
+
safelistOutput: import_zod6.z.string().optional(),
|
|
6475
|
+
generateSafelist: import_zod6.z.boolean().optional(),
|
|
6476
|
+
scanReportOutput: import_zod6.z.string().optional(),
|
|
6477
|
+
useEngineBuild: import_zod6.z.boolean().optional(),
|
|
6478
|
+
analyze: import_zod6.z.boolean().optional(),
|
|
6479
|
+
strict: import_zod6.z.boolean().optional(),
|
|
6480
|
+
mode: import_zod6.z.enum(["zero-runtime", "runtime"]).optional(),
|
|
6481
|
+
routeCss: import_zod6.z.boolean().optional(),
|
|
6482
|
+
deadStyleElimination: import_zod6.z.boolean().optional(),
|
|
6483
|
+
addDataAttr: import_zod6.z.boolean().optional(),
|
|
6484
|
+
autoClientBoundary: import_zod6.z.boolean().optional(),
|
|
6485
|
+
hoist: import_zod6.z.boolean().optional(),
|
|
6486
|
+
incremental: import_zod6.z.boolean().optional()
|
|
6373
6487
|
});
|
|
6374
6488
|
var parseVitePluginOptions = (options) => parseWithSchema4(VitePluginOptionsSchema, options ?? {}, "vite plugin options are invalid");
|
|
6375
6489
|
|
|
@@ -6381,14 +6495,14 @@ function warnDeprecated(options, key, message) {
|
|
|
6381
6495
|
}
|
|
6382
6496
|
}
|
|
6383
6497
|
function isInsideDirectory(filePath, directory) {
|
|
6384
|
-
const relative =
|
|
6385
|
-
return relative === "" || !relative.startsWith("..") && !
|
|
6498
|
+
const relative = import_node_path14.default.relative(directory, filePath);
|
|
6499
|
+
return relative === "" || !relative.startsWith("..") && !import_node_path14.default.isAbsolute(relative);
|
|
6386
6500
|
}
|
|
6387
6501
|
function filterScanToDirs(scan, root, scanDirs) {
|
|
6388
|
-
const resolvedDirs = scanDirs.map((dir) =>
|
|
6502
|
+
const resolvedDirs = scanDirs.map((dir) => import_node_path14.default.resolve(root, dir));
|
|
6389
6503
|
if (resolvedDirs.length === 0) return scan;
|
|
6390
6504
|
const files = scan.files.filter((file) => {
|
|
6391
|
-
const absoluteFile =
|
|
6505
|
+
const absoluteFile = import_node_path14.default.resolve(file.file);
|
|
6392
6506
|
return resolvedDirs.some((directory) => isInsideDirectory(absoluteFile, directory));
|
|
6393
6507
|
});
|
|
6394
6508
|
const uniqueClasses = Array.from(new Set(files.flatMap((file) => file.classes))).sort();
|
|
@@ -6399,9 +6513,9 @@ function filterScanToDirs(scan, root, scanDirs) {
|
|
|
6399
6513
|
};
|
|
6400
6514
|
}
|
|
6401
6515
|
function writeJsonArtifact(root, relativePath, value) {
|
|
6402
|
-
const outputPath =
|
|
6403
|
-
|
|
6404
|
-
|
|
6516
|
+
const outputPath = import_node_path14.default.resolve(root, relativePath);
|
|
6517
|
+
import_node_fs12.default.mkdirSync(import_node_path14.default.dirname(outputPath), { recursive: true });
|
|
6518
|
+
import_node_fs12.default.writeFileSync(outputPath, `${JSON.stringify(value, null, 2)}
|
|
6405
6519
|
`);
|
|
6406
6520
|
}
|
|
6407
6521
|
function tailwindStyledPlugin(opts = {}) {
|
|
@@ -6442,7 +6556,7 @@ function tailwindStyledPlugin(opts = {}) {
|
|
|
6442
6556
|
return rules.join("\n");
|
|
6443
6557
|
}
|
|
6444
6558
|
function getStaticCssOutputPath(root, safelistOutputPath) {
|
|
6445
|
-
return
|
|
6559
|
+
return import_node_path14.default.resolve(root, import_node_path14.default.dirname(safelistOutputPath), "_tw-state-static.css");
|
|
6446
6560
|
}
|
|
6447
6561
|
function flushStaticCss(root) {
|
|
6448
6562
|
if (staticCssPerFile.size === 0) return;
|
|
@@ -6451,8 +6565,8 @@ function tailwindStyledPlugin(opts = {}) {
|
|
|
6451
6565
|
if (!deduped.trim()) return;
|
|
6452
6566
|
const outPath = getStaticCssOutputPath(root, safelistOutput);
|
|
6453
6567
|
try {
|
|
6454
|
-
|
|
6455
|
-
|
|
6568
|
+
import_node_fs12.default.mkdirSync(import_node_path14.default.dirname(outPath), { recursive: true });
|
|
6569
|
+
import_node_fs12.default.writeFileSync(
|
|
6456
6570
|
outPath,
|
|
6457
6571
|
`/* _tw-state-static.css \u2014 Auto-generated by tailwind-styled-v4. DO NOT EDIT.
|
|
6458
6572
|
* Import this in globals.css: @import "./_tw-state-static.css";
|
|
@@ -6484,17 +6598,17 @@ ${deduped}
|
|
|
6484
6598
|
"src/style.css"
|
|
6485
6599
|
];
|
|
6486
6600
|
for (const candidate of CSS_CANDIDATES) {
|
|
6487
|
-
const candidatePath =
|
|
6488
|
-
if (!
|
|
6489
|
-
const content =
|
|
6601
|
+
const candidatePath = import_node_path14.default.resolve(config.root, candidate);
|
|
6602
|
+
if (!import_node_fs12.default.existsSync(candidatePath)) continue;
|
|
6603
|
+
const content = import_node_fs12.default.readFileSync(candidatePath, "utf-8");
|
|
6490
6604
|
if (content.includes("_tw-state-static.css")) break;
|
|
6491
|
-
const rel =
|
|
6605
|
+
const rel = import_node_path14.default.relative(import_node_path14.default.dirname(candidatePath), outPath).replace(/\\/g, "/");
|
|
6492
6606
|
const importLine = `@import "./${rel}";`;
|
|
6493
6607
|
const tailwindImportRe = /(@import\s+["']tailwindcss["']\s*;[^\n]*\n?)/;
|
|
6494
6608
|
const updated = tailwindImportRe.test(content) ? content.replace(tailwindImportRe, `$1${importLine}
|
|
6495
6609
|
`) : `${importLine}
|
|
6496
6610
|
${content}`;
|
|
6497
|
-
|
|
6611
|
+
import_node_fs12.default.writeFileSync(candidatePath, updated, "utf-8");
|
|
6498
6612
|
break;
|
|
6499
6613
|
}
|
|
6500
6614
|
} catch {
|
|
@@ -6578,7 +6692,8 @@ ${content}`;
|
|
|
6578
6692
|
}
|
|
6579
6693
|
};
|
|
6580
6694
|
}
|
|
6581
|
-
|
|
6582
|
-
exports
|
|
6583
|
-
|
|
6695
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
6696
|
+
0 && (module.exports = {
|
|
6697
|
+
tailwindStyledPlugin
|
|
6698
|
+
});
|
|
6584
6699
|
//# sourceMappingURL=vite.js.map
|