tailwind-styled-v4 5.0.37 → 5.0.39
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/analyzer.js +213 -161
- package/dist/analyzer.js.map +1 -1
- package/dist/analyzer.mjs +121 -83
- package/dist/analyzer.mjs.map +1 -1
- package/dist/animate.js +131 -87
- package/dist/animate.js.map +1 -1
- package/dist/animate.mjs +31 -15
- package/dist/animate.mjs.map +1 -1
- package/dist/atomic.js +107 -67
- package/dist/atomic.js.map +1 -1
- package/dist/atomic.mjs +47 -14
- package/dist/atomic.mjs.map +1 -1
- package/dist/cli.js +601 -428
- package/dist/cli.js.map +1 -1
- package/dist/cli.mjs +504 -313
- package/dist/cli.mjs.map +1 -1
- package/dist/compiler.js +833 -508
- package/dist/compiler.js.map +1 -1
- package/dist/compiler.mjs +298 -30
- package/dist/compiler.mjs.map +1 -1
- package/dist/dashboard.js +72 -41
- package/dist/dashboard.js.map +1 -1
- package/dist/dashboard.mjs +12 -6
- package/dist/dashboard.mjs.map +1 -1
- package/dist/devtools.js +335 -289
- package/dist/devtools.js.map +1 -1
- package/dist/devtools.mjs +28 -11
- package/dist/devtools.mjs.map +1 -1
- package/dist/engine.js +719 -506
- package/dist/engine.js.map +1 -1
- package/dist/engine.mjs +520 -318
- package/dist/engine.mjs.map +1 -1
- package/dist/index.d.mts +145 -319
- package/dist/index.d.ts +145 -319
- package/dist/index.js +1337 -7442
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1275 -7386
- package/dist/index.mjs.map +1 -1
- package/dist/next.js +327 -242
- package/dist/next.js.map +1 -1
- package/dist/next.mjs +272 -184
- package/dist/next.mjs.map +1 -1
- package/dist/plugin-api.js +94 -49
- package/dist/plugin-api.js.map +1 -1
- package/dist/plugin-api.mjs +26 -6
- package/dist/plugin-api.mjs.map +1 -1
- package/dist/plugin-registry.js +68 -40
- package/dist/plugin-registry.js.map +1 -1
- package/dist/plugin-registry.mjs +14 -10
- package/dist/plugin-registry.mjs.map +1 -1
- package/dist/plugin.js +102 -53
- package/dist/plugin.js.map +1 -1
- package/dist/plugin.mjs +30 -6
- package/dist/plugin.mjs.map +1 -1
- package/dist/preset.js +48 -15
- package/dist/preset.js.map +1 -1
- package/dist/preset.mjs +13 -5
- package/dist/preset.mjs.map +1 -1
- package/dist/rspack.js +108 -53
- package/dist/rspack.js.map +1 -1
- package/dist/rspack.mjs +50 -18
- package/dist/rspack.mjs.map +1 -1
- package/dist/runtime-css.js +63 -24
- package/dist/runtime-css.js.map +1 -1
- package/dist/runtime-css.mjs +15 -7
- package/dist/runtime-css.mjs.map +1 -1
- package/dist/runtime.js +98 -44
- package/dist/runtime.js.map +1 -1
- package/dist/runtime.mjs +31 -8
- package/dist/runtime.mjs.map +1 -1
- package/dist/scanner.js +164 -120
- package/dist/scanner.js.map +1 -1
- package/dist/scanner.mjs +70 -40
- package/dist/scanner.mjs.map +1 -1
- package/dist/shared.d.mts +0 -12
- package/dist/shared.d.ts +0 -12
- package/dist/shared.js +481 -299
- package/dist/shared.js.map +1 -1
- package/dist/shared.mjs +304 -133
- package/dist/shared.mjs.map +1 -1
- package/dist/storybook-addon.js +40 -10
- package/dist/storybook-addon.js.map +1 -1
- package/dist/storybook-addon.mjs +8 -3
- package/dist/storybook-addon.mjs.map +1 -1
- package/dist/svelte.js +95 -64
- package/dist/svelte.js.map +1 -1
- package/dist/svelte.mjs +37 -14
- package/dist/svelte.mjs.map +1 -1
- package/dist/syntax.js +69 -37
- package/dist/syntax.js.map +1 -1
- package/dist/syntax.mjs +8 -7
- package/dist/syntax.mjs.map +1 -1
- package/dist/testing.js +56 -18
- package/dist/testing.js.map +1 -1
- package/dist/testing.mjs +16 -3
- package/dist/testing.mjs.map +1 -1
- package/dist/theme.js +133 -74
- package/dist/theme.js.map +1 -1
- package/dist/theme.mjs +45 -14
- package/dist/theme.mjs.map +1 -1
- package/dist/turbopackLoader.js +156 -115
- package/dist/turbopackLoader.js.map +1 -1
- package/dist/turbopackLoader.mjs +135 -82
- package/dist/turbopackLoader.mjs.map +1 -1
- package/dist/tw.js +584 -423
- package/dist/tw.js.map +1 -1
- package/dist/tw.mjs +498 -311
- package/dist/tw.mjs.map +1 -1
- package/dist/vite.js +599 -450
- package/dist/vite.js.map +1 -1
- package/dist/vite.mjs +484 -332
- package/dist/vite.mjs.map +1 -1
- package/dist/vue.js +102 -70
- package/dist/vue.js.map +1 -1
- package/dist/vue.mjs +39 -15
- package/dist/vue.mjs.map +1 -1
- package/dist/webpackLoader.js +112 -77
- package/dist/webpackLoader.js.map +1 -1
- package/dist/webpackLoader.mjs +52 -18
- package/dist/webpackLoader.mjs.map +1 -1
- package/native/tailwind-styled-native.linux-x64-gnu.node +0 -0
- package/native/tailwind-styled-native.node +0 -0
- package/package.json +3 -1
package/dist/engine.mjs
CHANGED
|
@@ -1,15 +1,3 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import { createRequire } from 'module';
|
|
3
|
-
import * as fs3 from 'fs';
|
|
4
|
-
import fs3__default from 'fs';
|
|
5
|
-
import * as path9 from 'path';
|
|
6
|
-
import path9__default from 'path';
|
|
7
|
-
import { createHash } from 'crypto';
|
|
8
|
-
import { fileURLToPath, pathToFileURL } from 'url';
|
|
9
|
-
import { Worker, isMainThread, parentPort, workerData } from 'worker_threads';
|
|
10
|
-
import { availableParallelism } from 'os';
|
|
11
|
-
import 'perf_hooks';
|
|
12
|
-
|
|
13
1
|
/* tailwind-styled-v4 v5.0.4 | MIT | https://github.com/dictionar32/tailwind-styled-v4 */
|
|
14
2
|
var __defProp = Object.defineProperty;
|
|
15
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
@@ -130,6 +118,7 @@ function getPipelinePercentages(metrics) {
|
|
|
130
118
|
}
|
|
131
119
|
var init_trace = __esm({
|
|
132
120
|
"packages/domain/shared/src/trace.ts"() {
|
|
121
|
+
"use strict";
|
|
133
122
|
}
|
|
134
123
|
});
|
|
135
124
|
|
|
@@ -144,6 +133,7 @@ function formatErrorCode(code) {
|
|
|
144
133
|
var ERROR_CODES, ERROR_SUGGESTIONS;
|
|
145
134
|
var init_error_codes = __esm({
|
|
146
135
|
"packages/domain/shared/src/error-codes.ts"() {
|
|
136
|
+
"use strict";
|
|
147
137
|
ERROR_CODES = {
|
|
148
138
|
// E0xx — Native binding
|
|
149
139
|
NATIVE_NOT_FOUND: "E001",
|
|
@@ -210,8 +200,12 @@ function isTailwindV4() {
|
|
|
210
200
|
}
|
|
211
201
|
var init_compatibility = __esm({
|
|
212
202
|
"packages/domain/shared/src/compatibility.ts"() {
|
|
203
|
+
"use strict";
|
|
213
204
|
}
|
|
214
205
|
});
|
|
206
|
+
|
|
207
|
+
// packages/domain/shared/src/native-schemas.ts
|
|
208
|
+
import { z } from "zod";
|
|
215
209
|
function safeParseNative(schema, data, fallback) {
|
|
216
210
|
const result = schema.safeParse(data);
|
|
217
211
|
return result.success ? result.data : fallback;
|
|
@@ -227,9 +221,10 @@ function parseNative(schema, data, context) {
|
|
|
227
221
|
}
|
|
228
222
|
return result.data;
|
|
229
223
|
}
|
|
230
|
-
var NativeScanFileSchema, NativeScanResultSchema, NativeClassUsageSchema, NativeAnalyzerReportSchema, NativeTransformResultSchema, NativeCssCompileResultSchema, NativeWatchResultSchema, NativeCacheEntrySchema, NativeCacheReadResultSchema;
|
|
224
|
+
var NativeScanFileSchema, NativeScanResultSchema, NativeClassUsageSchema, NativeAnalyzerReportSchema, NativeTransformResultSchema, NativeCssCompileResultSchema, NativeWatchEventSchema, NativeWatchResultSchema, NativeCacheEntrySchema, NativeCacheReadResultSchema;
|
|
231
225
|
var init_native_schemas = __esm({
|
|
232
226
|
"packages/domain/shared/src/native-schemas.ts"() {
|
|
227
|
+
"use strict";
|
|
233
228
|
NativeScanFileSchema = z.object({
|
|
234
229
|
file: z.string().min(1, "file path cannot be empty"),
|
|
235
230
|
classes: z.array(z.string()),
|
|
@@ -269,7 +264,7 @@ var init_native_schemas = __esm({
|
|
|
269
264
|
resolvedClasses: z.array(z.string()),
|
|
270
265
|
unresolvedClasses: z.array(z.string()).optional()
|
|
271
266
|
});
|
|
272
|
-
z.object({
|
|
267
|
+
NativeWatchEventSchema = z.object({
|
|
273
268
|
type: z.enum(["change", "unlink", "create"]),
|
|
274
269
|
path: z.string()
|
|
275
270
|
});
|
|
@@ -305,48 +300,78 @@ function getNodeModuleRef() {
|
|
|
305
300
|
return null;
|
|
306
301
|
}
|
|
307
302
|
}
|
|
303
|
+
function getCurrentFileUrl() {
|
|
304
|
+
if (import.meta.url) {
|
|
305
|
+
return import.meta.url;
|
|
306
|
+
}
|
|
307
|
+
if (typeof __filename !== "undefined") {
|
|
308
|
+
return `file://${__filename.replace(/\\/g, "/")}`;
|
|
309
|
+
}
|
|
310
|
+
return "file://unknown";
|
|
311
|
+
}
|
|
308
312
|
function getNodePath() {
|
|
309
313
|
if (isBrowser) throw new Error("node:path not available in browser");
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
314
|
+
if (!_nodePath) {
|
|
315
|
+
if (typeof __require === "function") {
|
|
316
|
+
_nodePath = __require("path");
|
|
317
|
+
} else {
|
|
318
|
+
const nodeRequire = getNodeModuleRef();
|
|
319
|
+
if (!nodeRequire) throw new Error("require not available");
|
|
320
|
+
_nodePath = nodeRequire.createRequire(getCurrentFileUrl())("node:path");
|
|
321
|
+
}
|
|
322
|
+
}
|
|
313
323
|
return _nodePath;
|
|
314
324
|
}
|
|
315
325
|
function getNodeUrl() {
|
|
316
326
|
if (isBrowser) throw new Error("node:url not available in browser");
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
327
|
+
if (!_nodeUrl) {
|
|
328
|
+
if (typeof __require === "function") {
|
|
329
|
+
_nodeUrl = __require("url");
|
|
330
|
+
} else {
|
|
331
|
+
const nodeRequire = getNodeModuleRef();
|
|
332
|
+
if (!nodeRequire) throw new Error("require not available");
|
|
333
|
+
_nodeUrl = nodeRequire.createRequire(getCurrentFileUrl())("node:url");
|
|
334
|
+
}
|
|
335
|
+
}
|
|
320
336
|
return _nodeUrl;
|
|
321
337
|
}
|
|
322
338
|
function getNodeFs() {
|
|
323
339
|
if (isBrowser) throw new Error("node:fs not available in browser");
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
340
|
+
if (!_nodeFs) {
|
|
341
|
+
if (typeof __require === "function") {
|
|
342
|
+
_nodeFs = __require("fs");
|
|
343
|
+
} else {
|
|
344
|
+
const nodeRequire = getNodeModuleRef();
|
|
345
|
+
if (!nodeRequire) throw new Error("require not available");
|
|
346
|
+
_nodeFs = nodeRequire.createRequire(getCurrentFileUrl())("node:fs");
|
|
347
|
+
}
|
|
348
|
+
}
|
|
327
349
|
return _nodeFs;
|
|
328
350
|
}
|
|
329
351
|
function createEsmRequire(importMetaUrl) {
|
|
330
352
|
if (isBrowser) throw new Error("require not available in browser");
|
|
353
|
+
if (typeof __require === "function") return __require;
|
|
331
354
|
const nodeRequire = getNodeModuleRef();
|
|
332
355
|
if (!nodeRequire) throw new Error("require not available");
|
|
333
356
|
return nodeRequire.createRequire(importMetaUrl);
|
|
334
357
|
}
|
|
335
358
|
function getDirname(importMetaUrl) {
|
|
336
359
|
if (isBrowser) return "";
|
|
360
|
+
if (typeof __dirname !== "undefined") return __dirname;
|
|
337
361
|
const nodePath = getNodePath();
|
|
338
362
|
const nodeUrl = getNodeUrl();
|
|
339
363
|
return nodePath.dirname(nodeUrl.fileURLToPath(importMetaUrl));
|
|
340
364
|
}
|
|
341
365
|
function getFilename(importMetaUrl) {
|
|
342
366
|
if (isBrowser) return "";
|
|
367
|
+
if (typeof __filename !== "undefined") return __filename;
|
|
343
368
|
return getNodeUrl().fileURLToPath(importMetaUrl);
|
|
344
369
|
}
|
|
345
370
|
function resolveFromRoot(...segments) {
|
|
346
371
|
if (isBrowser) return segments.join("/");
|
|
347
372
|
const nodePath = getNodePath();
|
|
348
373
|
const nodeFs = getNodeFs();
|
|
349
|
-
let dir = getDirname(
|
|
374
|
+
let dir = typeof __dirname !== "undefined" ? __dirname : getDirname(getCurrentFileUrl());
|
|
350
375
|
for (let i = 0; i < 10; i++) {
|
|
351
376
|
const pkgPath = nodePath.join(dir, "package.json");
|
|
352
377
|
try {
|
|
@@ -375,6 +400,7 @@ function resolveNativeNodePath(importMetaUrl, ...relativeSegments) {
|
|
|
375
400
|
var isBrowser, nodeModuleRef, _nodePath, _nodeUrl, _nodeFs;
|
|
376
401
|
var init_esmHelpers = __esm({
|
|
377
402
|
"packages/domain/shared/src/esmHelpers.ts"() {
|
|
403
|
+
"use strict";
|
|
378
404
|
isBrowser = typeof window !== "undefined" || typeof document !== "undefined";
|
|
379
405
|
nodeModuleRef = null;
|
|
380
406
|
_nodePath = null;
|
|
@@ -425,6 +451,7 @@ function createBuildTimer() {
|
|
|
425
451
|
var RING_BUFFER_SIZE, TelemetryCollector, _globalCollector;
|
|
426
452
|
var init_telemetry = __esm({
|
|
427
453
|
"packages/domain/shared/src/telemetry.ts"() {
|
|
454
|
+
"use strict";
|
|
428
455
|
RING_BUFFER_SIZE = 100;
|
|
429
456
|
TelemetryCollector = class {
|
|
430
457
|
data = [];
|
|
@@ -491,6 +518,9 @@ var init_telemetry = __esm({
|
|
|
491
518
|
_globalCollector = null;
|
|
492
519
|
}
|
|
493
520
|
});
|
|
521
|
+
|
|
522
|
+
// packages/domain/shared/src/configSchemas.ts
|
|
523
|
+
import { z as z2 } from "zod";
|
|
494
524
|
function parseJsonWithSchema(jsonString, schema, sourceName) {
|
|
495
525
|
let parsed;
|
|
496
526
|
try {
|
|
@@ -524,67 +554,68 @@ function parseJsonFileWithSchema(filePath, schema) {
|
|
|
524
554
|
var ScanCacheClassEntrySchema, ScanCacheSchema, TailwindContentItemSchema, TailwindConfigSchema, RegistryPluginEntrySchema, RegistryFileSchema, PackageJsonSchema;
|
|
525
555
|
var init_configSchemas = __esm({
|
|
526
556
|
"packages/domain/shared/src/configSchemas.ts"() {
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
557
|
+
"use strict";
|
|
558
|
+
ScanCacheClassEntrySchema = z2.object({
|
|
559
|
+
name: z2.string().min(1),
|
|
560
|
+
usedIn: z2.array(z2.string()),
|
|
561
|
+
risk: z2.enum(["low", "medium", "high"]).default("low"),
|
|
562
|
+
bundleContribution: z2.number().nonnegative().default(0),
|
|
563
|
+
variants: z2.array(z2.string()).default([])
|
|
533
564
|
});
|
|
534
|
-
ScanCacheSchema =
|
|
535
|
-
version:
|
|
536
|
-
generatedAt:
|
|
537
|
-
root:
|
|
538
|
-
classNames:
|
|
539
|
-
totalFiles:
|
|
540
|
-
uniqueCount:
|
|
565
|
+
ScanCacheSchema = z2.object({
|
|
566
|
+
version: z2.string().default("1"),
|
|
567
|
+
generatedAt: z2.string(),
|
|
568
|
+
root: z2.string(),
|
|
569
|
+
classNames: z2.array(ScanCacheClassEntrySchema),
|
|
570
|
+
totalFiles: z2.number().int().nonnegative(),
|
|
571
|
+
uniqueCount: z2.number().int().nonnegative()
|
|
541
572
|
});
|
|
542
|
-
TailwindContentItemSchema =
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
raw:
|
|
546
|
-
extension:
|
|
573
|
+
TailwindContentItemSchema = z2.union([
|
|
574
|
+
z2.string(),
|
|
575
|
+
z2.object({
|
|
576
|
+
raw: z2.string(),
|
|
577
|
+
extension: z2.string().optional()
|
|
547
578
|
}),
|
|
548
|
-
|
|
549
|
-
files:
|
|
550
|
-
transform:
|
|
579
|
+
z2.object({
|
|
580
|
+
files: z2.array(z2.string()),
|
|
581
|
+
transform: z2.record(z2.string(), z2.unknown()).optional()
|
|
551
582
|
})
|
|
552
583
|
]);
|
|
553
|
-
TailwindConfigSchema =
|
|
554
|
-
content:
|
|
555
|
-
theme:
|
|
556
|
-
plugins:
|
|
557
|
-
darkMode:
|
|
558
|
-
prefix:
|
|
559
|
-
safelist:
|
|
560
|
-
blocklist:
|
|
584
|
+
TailwindConfigSchema = z2.object({
|
|
585
|
+
content: z2.array(TailwindContentItemSchema).optional(),
|
|
586
|
+
theme: z2.record(z2.string(), z2.unknown()).optional(),
|
|
587
|
+
plugins: z2.array(z2.unknown()).optional(),
|
|
588
|
+
darkMode: z2.union([z2.literal("class"), z2.literal("media"), z2.literal(false)]).optional(),
|
|
589
|
+
prefix: z2.string().optional(),
|
|
590
|
+
safelist: z2.array(z2.union([z2.string(), z2.object({ pattern: z2.instanceof(RegExp) })])).optional(),
|
|
591
|
+
blocklist: z2.array(z2.string()).optional()
|
|
561
592
|
}).passthrough();
|
|
562
|
-
RegistryPluginEntrySchema =
|
|
563
|
-
name:
|
|
564
|
-
description:
|
|
565
|
-
version:
|
|
566
|
-
tags:
|
|
567
|
-
official:
|
|
568
|
-
docs:
|
|
569
|
-
install:
|
|
570
|
-
integrity:
|
|
593
|
+
RegistryPluginEntrySchema = z2.object({
|
|
594
|
+
name: z2.string().min(1),
|
|
595
|
+
description: z2.string(),
|
|
596
|
+
version: z2.string(),
|
|
597
|
+
tags: z2.array(z2.string()).default([]),
|
|
598
|
+
official: z2.boolean().default(false),
|
|
599
|
+
docs: z2.string().url().optional(),
|
|
600
|
+
install: z2.string().optional(),
|
|
601
|
+
integrity: z2.string().optional()
|
|
571
602
|
});
|
|
572
|
-
RegistryFileSchema =
|
|
573
|
-
version:
|
|
574
|
-
official:
|
|
575
|
-
community:
|
|
603
|
+
RegistryFileSchema = z2.object({
|
|
604
|
+
version: z2.string(),
|
|
605
|
+
official: z2.array(RegistryPluginEntrySchema).default([]),
|
|
606
|
+
community: z2.array(RegistryPluginEntrySchema).default([])
|
|
576
607
|
});
|
|
577
|
-
PackageJsonSchema =
|
|
578
|
-
name:
|
|
579
|
-
version:
|
|
580
|
-
scripts:
|
|
581
|
-
dependencies:
|
|
582
|
-
devDependencies:
|
|
583
|
-
peerDependencies:
|
|
584
|
-
main:
|
|
585
|
-
module:
|
|
586
|
-
exports:
|
|
587
|
-
type:
|
|
608
|
+
PackageJsonSchema = z2.object({
|
|
609
|
+
name: z2.string(),
|
|
610
|
+
version: z2.string(),
|
|
611
|
+
scripts: z2.record(z2.string(), z2.string()).optional(),
|
|
612
|
+
dependencies: z2.record(z2.string(), z2.string()).optional(),
|
|
613
|
+
devDependencies: z2.record(z2.string(), z2.string()).optional(),
|
|
614
|
+
peerDependencies: z2.record(z2.string(), z2.string()).optional(),
|
|
615
|
+
main: z2.string().optional(),
|
|
616
|
+
module: z2.string().optional(),
|
|
617
|
+
exports: z2.unknown().optional(),
|
|
618
|
+
type: z2.enum(["module", "commonjs"]).optional()
|
|
588
619
|
}).passthrough();
|
|
589
620
|
}
|
|
590
621
|
});
|
|
@@ -672,6 +703,7 @@ function resolveLoaderPath(loaderBasename, importMetaUrl) {
|
|
|
672
703
|
var isBrowser2, NODE_URL, NODE_FS, NODE_PATH;
|
|
673
704
|
var init_workerResolver = __esm({
|
|
674
705
|
"packages/domain/shared/src/workerResolver.ts"() {
|
|
706
|
+
"use strict";
|
|
675
707
|
isBrowser2 = typeof window !== "undefined" || typeof document !== "undefined";
|
|
676
708
|
NODE_URL = typeof window === "undefined" || typeof document === "undefined" ? "node:url" : null;
|
|
677
709
|
NODE_FS = typeof window === "undefined" || typeof document === "undefined" ? "node:fs" : null;
|
|
@@ -821,13 +853,13 @@ function generateClassRenameCodemod(renames, opts = {}) {
|
|
|
821
853
|
}
|
|
822
854
|
return lines.join("\n");
|
|
823
855
|
}
|
|
824
|
-
function generateBarrelFile(exports
|
|
856
|
+
function generateBarrelFile(exports, dir, opts = {}) {
|
|
825
857
|
const { includeTypes = true } = opts;
|
|
826
858
|
const lines = [];
|
|
827
859
|
lines.push(`// Auto-generated barrel file for ${dir}`);
|
|
828
860
|
lines.push(`// Run: npx tsx scripts/generate-barrel.ts to regenerate`);
|
|
829
861
|
lines.push(``);
|
|
830
|
-
for (const name of exports
|
|
862
|
+
for (const name of exports) {
|
|
831
863
|
lines.push(`export { default as ${name}, type ${name}Props } from "./${name}"`);
|
|
832
864
|
if (includeTypes) {
|
|
833
865
|
lines.push(`export type * from "./${name}"`);
|
|
@@ -837,8 +869,14 @@ function generateBarrelFile(exports$1, dir, opts = {}) {
|
|
|
837
869
|
}
|
|
838
870
|
var init_codegen = __esm({
|
|
839
871
|
"packages/domain/shared/src/codegen.ts"() {
|
|
872
|
+
"use strict";
|
|
840
873
|
}
|
|
841
874
|
});
|
|
875
|
+
|
|
876
|
+
// packages/domain/shared/src/native-resolution.ts
|
|
877
|
+
import { createRequire } from "module";
|
|
878
|
+
import * as fs from "fs";
|
|
879
|
+
import * as path from "path";
|
|
842
880
|
function platformKey() {
|
|
843
881
|
if (isBrowser3) return "browser";
|
|
844
882
|
return `${process.platform}-${process.arch}`;
|
|
@@ -854,7 +892,7 @@ function resolveNativeBinary(runtimeDir) {
|
|
|
854
892
|
}
|
|
855
893
|
const envPath = process.env.TW_NATIVE_PATH?.trim();
|
|
856
894
|
if (envPath) {
|
|
857
|
-
if (
|
|
895
|
+
if (fs.existsSync(envPath)) {
|
|
858
896
|
return { path: envPath, source: "env", platform, tried };
|
|
859
897
|
}
|
|
860
898
|
tried.push(`env:${envPath} (not found)`);
|
|
@@ -863,7 +901,7 @@ function resolveNativeBinary(runtimeDir) {
|
|
|
863
901
|
for (const pkg of prebuiltPkgs) {
|
|
864
902
|
try {
|
|
865
903
|
const candidate = _require.resolve(`${pkg}/tailwind_styled_parser.node`);
|
|
866
|
-
if (
|
|
904
|
+
if (fs.existsSync(candidate)) {
|
|
867
905
|
return { path: candidate, source: "prebuilt", platform, tried };
|
|
868
906
|
}
|
|
869
907
|
tried.push(`prebuilt:${pkg} (resolved but missing)`);
|
|
@@ -874,13 +912,13 @@ function resolveNativeBinary(runtimeDir) {
|
|
|
874
912
|
const napiPlatform = platform === "linux-x64" ? "linux-x64-gnu" : platform === "linux-arm64" ? "linux-arm64-gnu" : platform;
|
|
875
913
|
const BINARY_NAMES_SELF = ["tailwind-styled-native", "tailwind_styled_parser"];
|
|
876
914
|
if (runtimeDir) {
|
|
877
|
-
for (const depth of ["..",
|
|
878
|
-
const pkgRoot =
|
|
915
|
+
for (const depth of ["..", path.join("..", ".."), path.join("..", "..", "..")]) {
|
|
916
|
+
const pkgRoot = path.resolve(runtimeDir, depth);
|
|
879
917
|
for (const bin of BINARY_NAMES_SELF) {
|
|
880
918
|
for (const suffix of ["", `.${platform}`, `.${napiPlatform}`]) {
|
|
881
|
-
const candidate =
|
|
919
|
+
const candidate = path.resolve(pkgRoot, "native", `${bin}${suffix}.node`);
|
|
882
920
|
tried.push(`self-bundled:${candidate}`);
|
|
883
|
-
if (
|
|
921
|
+
if (fs.existsSync(candidate)) {
|
|
884
922
|
return { path: candidate, source: "prebuilt", platform, tried };
|
|
885
923
|
}
|
|
886
924
|
}
|
|
@@ -892,29 +930,29 @@ function resolveNativeBinary(runtimeDir) {
|
|
|
892
930
|
const BINARY_NAMES = ["tailwind-styled-native", "tailwind_styled_parser"];
|
|
893
931
|
const localCandidates = [];
|
|
894
932
|
for (const bin of BINARY_NAMES) {
|
|
895
|
-
localCandidates.push(
|
|
896
|
-
localCandidates.push(
|
|
897
|
-
localCandidates.push(
|
|
898
|
-
localCandidates.push(
|
|
933
|
+
localCandidates.push(path.resolve(base, `${bin}.node`));
|
|
934
|
+
localCandidates.push(path.resolve(base, "..", `${bin}.node`));
|
|
935
|
+
localCandidates.push(path.resolve(base, `${bin}.${platform}.node`));
|
|
936
|
+
localCandidates.push(path.resolve(base, `${bin}.${napiPlatform}.node`));
|
|
899
937
|
}
|
|
900
938
|
for (const startDir of [cwd, base]) {
|
|
901
939
|
let dir = startDir;
|
|
902
940
|
for (let i = 0; i < 6; i++) {
|
|
903
|
-
const nativeDir =
|
|
941
|
+
const nativeDir = path.resolve(dir, "native");
|
|
904
942
|
for (const bin of BINARY_NAMES) {
|
|
905
|
-
localCandidates.push(
|
|
906
|
-
localCandidates.push(
|
|
907
|
-
localCandidates.push(
|
|
908
|
-
localCandidates.push(
|
|
943
|
+
localCandidates.push(path.resolve(nativeDir, `${bin}.node`));
|
|
944
|
+
localCandidates.push(path.resolve(nativeDir, `${bin}.${platform}.node`));
|
|
945
|
+
localCandidates.push(path.resolve(nativeDir, `${bin}.${napiPlatform}.node`));
|
|
946
|
+
localCandidates.push(path.resolve(nativeDir, "target", "release", `${bin}.node`));
|
|
909
947
|
}
|
|
910
|
-
const parent =
|
|
948
|
+
const parent = path.resolve(dir, "..");
|
|
911
949
|
if (parent === dir) break;
|
|
912
950
|
dir = parent;
|
|
913
951
|
}
|
|
914
952
|
}
|
|
915
953
|
for (const candidate of localCandidates) {
|
|
916
954
|
tried.push(`local:${candidate}`);
|
|
917
|
-
if (
|
|
955
|
+
if (fs.existsSync(candidate)) {
|
|
918
956
|
return { path: candidate, source: "local", platform, tried };
|
|
919
957
|
}
|
|
920
958
|
}
|
|
@@ -937,8 +975,11 @@ function formatNativeNotFoundError(result) {
|
|
|
937
975
|
var isBrowser3, _require, PLATFORM_MAP;
|
|
938
976
|
var init_native_resolution = __esm({
|
|
939
977
|
"packages/domain/shared/src/native-resolution.ts"() {
|
|
978
|
+
"use strict";
|
|
940
979
|
isBrowser3 = typeof window !== "undefined" || typeof document !== "undefined";
|
|
941
|
-
_require =
|
|
980
|
+
_require = createRequire(
|
|
981
|
+
typeof __require !== "undefined" ? typeof __filename !== "undefined" ? `file://${__filename}` : "file://unknown" : import.meta.url
|
|
982
|
+
);
|
|
942
983
|
PLATFORM_MAP = {
|
|
943
984
|
"linux-x64": ["@tailwind-styled/native-linux-x64-gnu", "@tailwind-styled/native-linux-x64"],
|
|
944
985
|
"linux-arm64": ["@tailwind-styled/native-linux-arm64-gnu", "@tailwind-styled/native-linux-arm64"],
|
|
@@ -984,6 +1025,7 @@ function createObservabilityClient(opts = {}) {
|
|
|
984
1025
|
}
|
|
985
1026
|
var init_observability = __esm({
|
|
986
1027
|
"packages/domain/shared/src/observability.ts"() {
|
|
1028
|
+
"use strict";
|
|
987
1029
|
}
|
|
988
1030
|
});
|
|
989
1031
|
|
|
@@ -991,6 +1033,7 @@ var init_observability = __esm({
|
|
|
991
1033
|
var _loadNative, log, NATIVE_UNAVAILABLE_MESSAGE, nativeBridge, bridgeLoadAttempted, bridgeLoadError, isValidNativeBridge, getNativeBridge, adaptNativeResult;
|
|
992
1034
|
var init_nativeBridge = __esm({
|
|
993
1035
|
"packages/domain/compiler/src/nativeBridge.ts"() {
|
|
1036
|
+
"use strict";
|
|
994
1037
|
init_src2();
|
|
995
1038
|
_loadNative = (path16) => __require(path16);
|
|
996
1039
|
log = (...args) => {
|
|
@@ -1130,6 +1173,7 @@ function resetCacheStats() {
|
|
|
1130
1173
|
}
|
|
1131
1174
|
var init_cssGeneratorNative = __esm({
|
|
1132
1175
|
"packages/domain/compiler/src/compiler/cssGeneratorNative.ts"() {
|
|
1176
|
+
"use strict";
|
|
1133
1177
|
init_nativeBridge();
|
|
1134
1178
|
}
|
|
1135
1179
|
});
|
|
@@ -1202,6 +1246,7 @@ function atomicRegistrySize() {
|
|
|
1202
1246
|
}
|
|
1203
1247
|
var init_compilationNative = __esm({
|
|
1204
1248
|
"packages/domain/compiler/src/compiler/compilationNative.ts"() {
|
|
1249
|
+
"use strict";
|
|
1205
1250
|
init_nativeBridge();
|
|
1206
1251
|
}
|
|
1207
1252
|
});
|
|
@@ -1345,6 +1390,7 @@ function twMergeRaw(classLists) {
|
|
|
1345
1390
|
}
|
|
1346
1391
|
var init_cssCompilationNative = __esm({
|
|
1347
1392
|
"packages/domain/compiler/src/compiler/cssCompilationNative.ts"() {
|
|
1393
|
+
"use strict";
|
|
1348
1394
|
init_nativeBridge();
|
|
1349
1395
|
}
|
|
1350
1396
|
});
|
|
@@ -1444,6 +1490,7 @@ function idRegistryImport(importedData) {
|
|
|
1444
1490
|
}
|
|
1445
1491
|
var init_idRegistryNative = __esm({
|
|
1446
1492
|
"packages/domain/compiler/src/compiler/idRegistryNative.ts"() {
|
|
1493
|
+
"use strict";
|
|
1447
1494
|
init_nativeBridge();
|
|
1448
1495
|
}
|
|
1449
1496
|
});
|
|
@@ -1585,9 +1632,13 @@ function scanFilesBatchNative(filesJson) {
|
|
|
1585
1632
|
}
|
|
1586
1633
|
var init_streamingNative = __esm({
|
|
1587
1634
|
"packages/domain/compiler/src/compiler/streamingNative.ts"() {
|
|
1635
|
+
"use strict";
|
|
1588
1636
|
init_nativeBridge();
|
|
1589
1637
|
}
|
|
1590
1638
|
});
|
|
1639
|
+
|
|
1640
|
+
// packages/domain/compiler/src/tailwindEngine.ts
|
|
1641
|
+
import { createRequire as createRequire2 } from "module";
|
|
1591
1642
|
function loadTailwindEngine() {
|
|
1592
1643
|
if (_twEngine) return _twEngine;
|
|
1593
1644
|
if (_twEngineError) throw _twEngineError;
|
|
@@ -1607,10 +1658,10 @@ async function generateRawCss(classes, cssEntryContent, root) {
|
|
|
1607
1658
|
if (classes.length === 0) return "";
|
|
1608
1659
|
const tw = loadTailwindEngine();
|
|
1609
1660
|
const input = cssEntryContent ?? "@import 'tailwindcss';";
|
|
1610
|
-
const { readFileSync, existsSync: existsSync3 } = await import(
|
|
1611
|
-
const { dirname, resolve: resolve2 } = await import(
|
|
1661
|
+
const { readFileSync, existsSync: existsSync3 } = await import("fs");
|
|
1662
|
+
const { dirname, resolve: resolve2 } = await import("path");
|
|
1612
1663
|
const projectRoot = root ?? process.cwd();
|
|
1613
|
-
const req =
|
|
1664
|
+
const req = createRequire2(resolve2(projectRoot, "package.json"));
|
|
1614
1665
|
const loadStylesheet = async (id, base) => {
|
|
1615
1666
|
try {
|
|
1616
1667
|
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;
|
|
@@ -1630,10 +1681,14 @@ async function generateRawCss(classes, cssEntryContent, root) {
|
|
|
1630
1681
|
const compiler = await Promise.resolve(tw.compile(input, { loadStylesheet }));
|
|
1631
1682
|
return compiler.build(classes);
|
|
1632
1683
|
}
|
|
1633
|
-
var require2, _twEngine, _twEngineError;
|
|
1684
|
+
var require2, MAX_CACHE_MEMORY, _twEngine, _twEngineError;
|
|
1634
1685
|
var init_tailwindEngine = __esm({
|
|
1635
1686
|
"packages/domain/compiler/src/tailwindEngine.ts"() {
|
|
1636
|
-
|
|
1687
|
+
"use strict";
|
|
1688
|
+
require2 = createRequire2(
|
|
1689
|
+
typeof __filename !== "undefined" ? `file://${__filename}` : typeof import.meta !== "undefined" && import.meta.url ? import.meta.url : "file://unknown"
|
|
1690
|
+
);
|
|
1691
|
+
MAX_CACHE_MEMORY = 256 * 1024;
|
|
1637
1692
|
_twEngine = null;
|
|
1638
1693
|
_twEngineError = null;
|
|
1639
1694
|
}
|
|
@@ -1648,6 +1703,7 @@ __export(tailwindEngine_exports, {
|
|
|
1648
1703
|
runCssPipeline: () => runCssPipeline,
|
|
1649
1704
|
runCssPipelineSync: () => runCssPipelineSync
|
|
1650
1705
|
});
|
|
1706
|
+
import { createRequire as createRequire3 } from "module";
|
|
1651
1707
|
function _getCacheKey(classes, minify, cssEntry, root) {
|
|
1652
1708
|
const sorted = [...classes].sort().join(",");
|
|
1653
1709
|
const flags = `${minify ? "1" : "0"}${cssEntry ? "1" : "0"}${root ? "1" : "0"}`;
|
|
@@ -1814,24 +1870,29 @@ function processTailwindCssWithTargets(css, targets) {
|
|
|
1814
1870
|
}
|
|
1815
1871
|
return result.css;
|
|
1816
1872
|
}
|
|
1817
|
-
var _cssCache, _cacheHits, _cacheMisses, MAX_CACHE_SIZE;
|
|
1873
|
+
var require3, _cssCache, _cacheHits, _cacheMisses, MAX_CACHE_SIZE, MAX_CACHE_MEMORY2;
|
|
1818
1874
|
var init_tailwindEngine2 = __esm({
|
|
1819
1875
|
"packages/domain/compiler/src/compiler/tailwindEngine.ts"() {
|
|
1876
|
+
"use strict";
|
|
1820
1877
|
init_nativeBridge();
|
|
1821
1878
|
init_cssGeneratorNative();
|
|
1822
1879
|
init_cssCompilationNative();
|
|
1823
1880
|
init_tailwindEngine();
|
|
1824
|
-
|
|
1881
|
+
require3 = createRequire3(
|
|
1882
|
+
typeof __filename !== "undefined" ? `file://${__filename}` : typeof import.meta !== "undefined" && import.meta.url ? import.meta.url : "file://unknown"
|
|
1883
|
+
);
|
|
1825
1884
|
_cssCache = /* @__PURE__ */ new Map();
|
|
1826
1885
|
_cacheHits = 0;
|
|
1827
1886
|
_cacheMisses = 0;
|
|
1828
1887
|
MAX_CACHE_SIZE = 100;
|
|
1888
|
+
MAX_CACHE_MEMORY2 = 256 * 1024;
|
|
1829
1889
|
}
|
|
1830
1890
|
});
|
|
1831
1891
|
|
|
1832
1892
|
// packages/domain/compiler/src/compiler/index.ts
|
|
1833
1893
|
var init_compiler = __esm({
|
|
1834
1894
|
"packages/domain/compiler/src/compiler/index.ts"() {
|
|
1895
|
+
"use strict";
|
|
1835
1896
|
init_cssGeneratorNative();
|
|
1836
1897
|
init_compilationNative();
|
|
1837
1898
|
init_cssCompilationNative();
|
|
@@ -1844,6 +1905,7 @@ var init_compiler = __esm({
|
|
|
1844
1905
|
var parseClasses, parseClass, extractAllClasses, extractClassesFromSource, astExtractClasses, normalizeClasses, mergeClassesStatic, normalizeAndDedupClasses, extractComponentUsage, batchExtractClasses, checkAgainstSafelist, diffClassLists;
|
|
1845
1906
|
var init_parser = __esm({
|
|
1846
1907
|
"packages/domain/compiler/src/parser/index.ts"() {
|
|
1908
|
+
"use strict";
|
|
1847
1909
|
init_nativeBridge();
|
|
1848
1910
|
parseClasses = (raw) => {
|
|
1849
1911
|
const native = getNativeBridge();
|
|
@@ -2022,6 +2084,7 @@ function resetMemoryStats() {
|
|
|
2022
2084
|
}
|
|
2023
2085
|
var init_analyzerNative = __esm({
|
|
2024
2086
|
"packages/domain/compiler/src/analyzer/analyzerNative.ts"() {
|
|
2087
|
+
"use strict";
|
|
2025
2088
|
init_nativeBridge();
|
|
2026
2089
|
}
|
|
2027
2090
|
});
|
|
@@ -2115,6 +2178,7 @@ function resolveSimpleVariants(configJson) {
|
|
|
2115
2178
|
}
|
|
2116
2179
|
var init_themeResolutionNative = __esm({
|
|
2117
2180
|
"packages/domain/compiler/src/analyzer/themeResolutionNative.ts"() {
|
|
2181
|
+
"use strict";
|
|
2118
2182
|
init_nativeBridge();
|
|
2119
2183
|
}
|
|
2120
2184
|
});
|
|
@@ -2162,6 +2226,7 @@ function generateSubComponentTypes(root, outputPath) {
|
|
|
2162
2226
|
}
|
|
2163
2227
|
var init_scannerNative = __esm({
|
|
2164
2228
|
"packages/domain/compiler/src/analyzer/scannerNative.ts"() {
|
|
2229
|
+
"use strict";
|
|
2165
2230
|
init_nativeBridge();
|
|
2166
2231
|
}
|
|
2167
2232
|
});
|
|
@@ -2169,6 +2234,7 @@ var init_scannerNative = __esm({
|
|
|
2169
2234
|
// packages/domain/compiler/src/analyzer/index.ts
|
|
2170
2235
|
var init_analyzer = __esm({
|
|
2171
2236
|
"packages/domain/compiler/src/analyzer/index.ts"() {
|
|
2237
|
+
"use strict";
|
|
2172
2238
|
init_analyzerNative();
|
|
2173
2239
|
init_themeResolutionNative();
|
|
2174
2240
|
init_scannerNative();
|
|
@@ -2357,6 +2423,7 @@ function resetResolverPoolStats() {
|
|
|
2357
2423
|
}
|
|
2358
2424
|
var init_cacheNative = __esm({
|
|
2359
2425
|
"packages/domain/compiler/src/cache/cacheNative.ts"() {
|
|
2426
|
+
"use strict";
|
|
2360
2427
|
init_nativeBridge();
|
|
2361
2428
|
}
|
|
2362
2429
|
});
|
|
@@ -2364,6 +2431,7 @@ var init_cacheNative = __esm({
|
|
|
2364
2431
|
// packages/domain/compiler/src/cache/index.ts
|
|
2365
2432
|
var init_cache = __esm({
|
|
2366
2433
|
"packages/domain/compiler/src/cache/index.ts"() {
|
|
2434
|
+
"use strict";
|
|
2367
2435
|
init_cacheNative();
|
|
2368
2436
|
}
|
|
2369
2437
|
});
|
|
@@ -2612,6 +2680,7 @@ function redisDiagnose() {
|
|
|
2612
2680
|
}
|
|
2613
2681
|
var init_redisNative = __esm({
|
|
2614
2682
|
"packages/domain/compiler/src/redis/redisNative.ts"() {
|
|
2683
|
+
"use strict";
|
|
2615
2684
|
init_nativeBridge();
|
|
2616
2685
|
}
|
|
2617
2686
|
});
|
|
@@ -2619,6 +2688,7 @@ var init_redisNative = __esm({
|
|
|
2619
2688
|
// packages/domain/compiler/src/redis/index.ts
|
|
2620
2689
|
var init_redis = __esm({
|
|
2621
2690
|
"packages/domain/compiler/src/redis/index.ts"() {
|
|
2691
|
+
"use strict";
|
|
2622
2692
|
init_redisNative();
|
|
2623
2693
|
}
|
|
2624
2694
|
});
|
|
@@ -2757,6 +2827,7 @@ function getCompilerDiagnostics() {
|
|
|
2757
2827
|
}
|
|
2758
2828
|
var init_watchSystemNative = __esm({
|
|
2759
2829
|
"packages/domain/compiler/src/watch/watchSystemNative.ts"() {
|
|
2830
|
+
"use strict";
|
|
2760
2831
|
init_nativeBridge();
|
|
2761
2832
|
}
|
|
2762
2833
|
});
|
|
@@ -2764,9 +2835,15 @@ var init_watchSystemNative = __esm({
|
|
|
2764
2835
|
// packages/domain/compiler/src/watch/index.ts
|
|
2765
2836
|
var init_watch = __esm({
|
|
2766
2837
|
"packages/domain/compiler/src/watch/index.ts"() {
|
|
2838
|
+
"use strict";
|
|
2767
2839
|
init_watchSystemNative();
|
|
2768
2840
|
}
|
|
2769
2841
|
});
|
|
2842
|
+
|
|
2843
|
+
// packages/domain/compiler/src/index.ts
|
|
2844
|
+
import fs2 from "fs";
|
|
2845
|
+
import path2 from "path";
|
|
2846
|
+
import { createRequire as createRequire4 } from "module";
|
|
2770
2847
|
function _layoutClassesToCss(classes) {
|
|
2771
2848
|
const native = getNativeBridge();
|
|
2772
2849
|
if (!native?.layoutClassesToCss) {
|
|
@@ -2804,6 +2881,7 @@ function extractContainerCssFromSource(source) {
|
|
|
2804
2881
|
var _require2, transformSource, hasTwUsage, isAlreadyTransformed, shouldProcess, compileCssFromClasses, buildStyleTag, generateCssForClasses, eliminateDeadCss, findDeadVariants, runElimination, scanProjectUsage, generateSafelist, loadSafelist, loadTailwindConfig, getContentPaths, _CONTAINER_BREAKPOINTS, runLoaderTransform, shouldSkipFile, fileToRoute, getAllRoutes, getRouteClasses, registerFileClasses, registerGlobalClasses, _incrementalEngineInstance, getIncrementalEngine, resetIncrementalEngine, IncrementalEngine, getBucketEngine, resetBucketEngine, classifyNode, detectConflicts, bucketSort, analyzeFile, analyzeVariantUsage, injectClientDirective, injectServerOnlyComment, analyzeClasses, extractTwStateConfigs, generateStaticStateCss, extractAndGenerateStateCss;
|
|
2805
2882
|
var init_src = __esm({
|
|
2806
2883
|
"packages/domain/compiler/src/index.ts"() {
|
|
2884
|
+
"use strict";
|
|
2807
2885
|
init_nativeBridge();
|
|
2808
2886
|
init_compiler();
|
|
2809
2887
|
init_parser();
|
|
@@ -2811,7 +2889,9 @@ var init_src = __esm({
|
|
|
2811
2889
|
init_cache();
|
|
2812
2890
|
init_redis();
|
|
2813
2891
|
init_watch();
|
|
2814
|
-
_require2 =
|
|
2892
|
+
_require2 = createRequire4(
|
|
2893
|
+
typeof __require !== "undefined" ? typeof __filename !== "undefined" ? `file://${__filename}` : "file://unknown" : import.meta.url
|
|
2894
|
+
);
|
|
2815
2895
|
transformSource = (source, opts) => {
|
|
2816
2896
|
const native = getNativeBridge();
|
|
2817
2897
|
if (!native?.transformSource) {
|
|
@@ -2903,7 +2983,7 @@ var init_src = __esm({
|
|
|
2903
2983
|
};
|
|
2904
2984
|
scanProjectUsage = (dirs, cwd) => {
|
|
2905
2985
|
const { batchExtractClasses: batchExtractClasses2 } = _require2("./parser");
|
|
2906
|
-
const files = dirs.map((dir) =>
|
|
2986
|
+
const files = dirs.map((dir) => path2.resolve(cwd, dir));
|
|
2907
2987
|
const results = batchExtractClasses2(files) || [];
|
|
2908
2988
|
const combined = {};
|
|
2909
2989
|
for (const result of results) {
|
|
@@ -2920,13 +3000,13 @@ var init_src = __esm({
|
|
|
2920
3000
|
const classes = scanProjectUsage(scanDirs, cwd || process.cwd());
|
|
2921
3001
|
const allClasses = Object.keys(classes).sort();
|
|
2922
3002
|
if (outputPath) {
|
|
2923
|
-
|
|
3003
|
+
fs2.writeFileSync(outputPath, JSON.stringify(allClasses, null, 2));
|
|
2924
3004
|
}
|
|
2925
3005
|
return allClasses;
|
|
2926
3006
|
};
|
|
2927
3007
|
loadSafelist = (safelistPath) => {
|
|
2928
3008
|
try {
|
|
2929
|
-
const content =
|
|
3009
|
+
const content = fs2.readFileSync(safelistPath, "utf-8");
|
|
2930
3010
|
return JSON.parse(content);
|
|
2931
3011
|
} catch {
|
|
2932
3012
|
return [];
|
|
@@ -2940,8 +3020,8 @@ var init_src = __esm({
|
|
|
2940
3020
|
"tailwind.config.cjs"
|
|
2941
3021
|
];
|
|
2942
3022
|
for (const file of configFiles) {
|
|
2943
|
-
const fullPath =
|
|
2944
|
-
if (
|
|
3023
|
+
const fullPath = path2.join(cwd, file);
|
|
3024
|
+
if (fs2.existsSync(fullPath)) {
|
|
2945
3025
|
const mod = __require(fullPath);
|
|
2946
3026
|
return mod.default || mod;
|
|
2947
3027
|
}
|
|
@@ -2951,9 +3031,9 @@ var init_src = __esm({
|
|
|
2951
3031
|
getContentPaths = (cwd = process.cwd()) => {
|
|
2952
3032
|
return {
|
|
2953
3033
|
content: [
|
|
2954
|
-
|
|
2955
|
-
|
|
2956
|
-
|
|
3034
|
+
path2.join(cwd, "src/**/*.{js,ts,jsx,tsx}"),
|
|
3035
|
+
path2.join(cwd, "app/**/*.{js,ts,jsx,tsx}"),
|
|
3036
|
+
path2.join(cwd, "pages/**/*.{js,ts,jsx,tsx}")
|
|
2957
3037
|
]
|
|
2958
3038
|
};
|
|
2959
3039
|
};
|
|
@@ -3367,6 +3447,7 @@ __export(internal_exports, {
|
|
|
3367
3447
|
});
|
|
3368
3448
|
var init_internal = __esm({
|
|
3369
3449
|
"packages/domain/compiler/src/internal.ts"() {
|
|
3450
|
+
"use strict";
|
|
3370
3451
|
init_src();
|
|
3371
3452
|
init_tailwindEngine2();
|
|
3372
3453
|
init_compiler();
|
|
@@ -3377,6 +3458,10 @@ var init_internal = __esm({
|
|
|
3377
3458
|
init_watch();
|
|
3378
3459
|
}
|
|
3379
3460
|
});
|
|
3461
|
+
|
|
3462
|
+
// packages/domain/shared/src/staticStateExtractor.ts
|
|
3463
|
+
import fs3 from "fs";
|
|
3464
|
+
import path3 from "path";
|
|
3380
3465
|
function getNative() {
|
|
3381
3466
|
if (_native) return _native;
|
|
3382
3467
|
try {
|
|
@@ -3406,17 +3491,17 @@ function getNative() {
|
|
|
3406
3491
|
function* walkSourceFiles(dir) {
|
|
3407
3492
|
let entries;
|
|
3408
3493
|
try {
|
|
3409
|
-
entries =
|
|
3494
|
+
entries = fs3.readdirSync(dir, { withFileTypes: true });
|
|
3410
3495
|
} catch {
|
|
3411
3496
|
return;
|
|
3412
3497
|
}
|
|
3413
3498
|
for (const entry of entries) {
|
|
3414
|
-
const fullPath =
|
|
3499
|
+
const fullPath = path3.join(dir, entry.name);
|
|
3415
3500
|
if (entry.isDirectory()) {
|
|
3416
3501
|
if (IGNORE_PATTERNS.some((p) => entry.name === p || entry.name.startsWith(p))) continue;
|
|
3417
3502
|
yield* walkSourceFiles(fullPath);
|
|
3418
3503
|
} else if (entry.isFile()) {
|
|
3419
|
-
const ext =
|
|
3504
|
+
const ext = path3.extname(entry.name);
|
|
3420
3505
|
if (SOURCE_EXTENSIONS.has(ext)) yield fullPath;
|
|
3421
3506
|
}
|
|
3422
3507
|
}
|
|
@@ -3480,7 +3565,7 @@ function extractStaticStateCss(srcDir, options = {}) {
|
|
|
3480
3565
|
allConfigs.push(...configs);
|
|
3481
3566
|
if (verbose) {
|
|
3482
3567
|
process.stderr.write(
|
|
3483
|
-
`[tw:static-state] ${
|
|
3568
|
+
`[tw:static-state] ${path3.relative(srcDir, filePath)}: ${configs.length} komponen
|
|
3484
3569
|
`
|
|
3485
3570
|
);
|
|
3486
3571
|
}
|
|
@@ -3491,7 +3576,7 @@ function extractStaticStateCss(srcDir, options = {}) {
|
|
|
3491
3576
|
if (filesScanned >= maxFiles) break;
|
|
3492
3577
|
let source;
|
|
3493
3578
|
try {
|
|
3494
|
-
source =
|
|
3579
|
+
source = fs3.readFileSync(filePath, "utf-8");
|
|
3495
3580
|
} catch {
|
|
3496
3581
|
continue;
|
|
3497
3582
|
}
|
|
@@ -3504,7 +3589,7 @@ function extractStaticStateCss(srcDir, options = {}) {
|
|
|
3504
3589
|
allConfigs.push(...configs);
|
|
3505
3590
|
if (verbose) {
|
|
3506
3591
|
process.stderr.write(
|
|
3507
|
-
`[tw:static-state] ${
|
|
3592
|
+
`[tw:static-state] ${path3.relative(srcDir, filePath)}: ${configs.length} komponen
|
|
3508
3593
|
`
|
|
3509
3594
|
);
|
|
3510
3595
|
}
|
|
@@ -3598,12 +3683,12 @@ function appendStaticStateCssToSafelist(srcDir, safelistPath, options = {}) {
|
|
|
3598
3683
|
resolvedCss: options.resolvedCss || ""
|
|
3599
3684
|
// ← ensure always passed
|
|
3600
3685
|
});
|
|
3601
|
-
const twClassesDir =
|
|
3602
|
-
|
|
3603
|
-
const stateFilePath =
|
|
3686
|
+
const twClassesDir = path3.join(path3.dirname(safelistPath), "tw-classes");
|
|
3687
|
+
fs3.mkdirSync(twClassesDir, { recursive: true });
|
|
3688
|
+
const stateFilePath = path3.join(twClassesDir, TW_STATE_STATIC_FILENAME);
|
|
3604
3689
|
if (result.rulesGenerated === 0) {
|
|
3605
3690
|
try {
|
|
3606
|
-
|
|
3691
|
+
fs3.writeFileSync(
|
|
3607
3692
|
stateFilePath,
|
|
3608
3693
|
"/* tw-state-static.css \u2014 tidak ada state rules yang di-generate */\n",
|
|
3609
3694
|
"utf-8"
|
|
@@ -3613,7 +3698,7 @@ function appendStaticStateCssToSafelist(srcDir, safelistPath, options = {}) {
|
|
|
3613
3698
|
return `[tw:static-state] tidak ada state rules yang di-generate (${result.filesScanned} files di-scan)`;
|
|
3614
3699
|
}
|
|
3615
3700
|
try {
|
|
3616
|
-
|
|
3701
|
+
fs3.writeFileSync(stateFilePath, result.generatedCss, "utf-8");
|
|
3617
3702
|
return [
|
|
3618
3703
|
`[tw:static-state] ${result.rulesGenerated} static state rules di-generate`,
|
|
3619
3704
|
` \u2192 ${result.filesScanned} files scanned, ${result.filesWithStates} dengan states`,
|
|
@@ -3628,12 +3713,17 @@ function appendStaticStateCssToSafelist(srcDir, safelistPath, options = {}) {
|
|
|
3628
3713
|
var SOURCE_EXTENSIONS, IGNORE_PATTERNS, _native, TW_STATE_STATIC_FILENAME;
|
|
3629
3714
|
var init_staticStateExtractor = __esm({
|
|
3630
3715
|
"packages/domain/shared/src/staticStateExtractor.ts"() {
|
|
3716
|
+
"use strict";
|
|
3631
3717
|
SOURCE_EXTENSIONS = /* @__PURE__ */ new Set([".ts", ".tsx", ".js", ".jsx", ".mts", ".mjs"]);
|
|
3632
3718
|
IGNORE_PATTERNS = ["node_modules", ".next", "dist", "build", ".git", "coverage", "__tests__"];
|
|
3633
3719
|
_native = null;
|
|
3634
3720
|
TW_STATE_STATIC_FILENAME = "_tw-state-static.css";
|
|
3635
3721
|
}
|
|
3636
3722
|
});
|
|
3723
|
+
|
|
3724
|
+
// packages/domain/shared/src/logger.ts
|
|
3725
|
+
import fs4 from "fs";
|
|
3726
|
+
import path4 from "path";
|
|
3637
3727
|
function getEnvLevel() {
|
|
3638
3728
|
const env = process.env.TWS_LOG_LEVEL?.toLowerCase();
|
|
3639
3729
|
if (env && env in LEVELS) return env;
|
|
@@ -3643,8 +3733,8 @@ function setGlobalLogFile(filePath) {
|
|
|
3643
3733
|
_globalLogFile = filePath;
|
|
3644
3734
|
_logFileInitialized = false;
|
|
3645
3735
|
try {
|
|
3646
|
-
|
|
3647
|
-
|
|
3736
|
+
fs4.mkdirSync(path4.dirname(filePath), { recursive: true });
|
|
3737
|
+
fs4.writeFileSync(
|
|
3648
3738
|
filePath,
|
|
3649
3739
|
`# tailwind-styled build log \u2014 ${(/* @__PURE__ */ new Date()).toISOString()}
|
|
3650
3740
|
`,
|
|
@@ -3657,13 +3747,13 @@ function setGlobalLogFile(filePath) {
|
|
|
3657
3747
|
function writeToFile(line) {
|
|
3658
3748
|
if (!_globalLogFile || !_logFileInitialized) return;
|
|
3659
3749
|
try {
|
|
3660
|
-
|
|
3750
|
+
fs4.appendFileSync(_globalLogFile, line);
|
|
3661
3751
|
} catch {
|
|
3662
3752
|
}
|
|
3663
3753
|
}
|
|
3664
3754
|
function createLogger(prefix, level) {
|
|
3665
3755
|
const loggerState = {
|
|
3666
|
-
currentLevel: getEnvLevel(),
|
|
3756
|
+
currentLevel: level ?? getEnvLevel(),
|
|
3667
3757
|
setLevel(l) {
|
|
3668
3758
|
this.currentLevel = l;
|
|
3669
3759
|
}
|
|
@@ -3684,13 +3774,14 @@ function createLogger(prefix, level) {
|
|
|
3684
3774
|
setLogFile: (filePath) => setGlobalLogFile(filePath)
|
|
3685
3775
|
};
|
|
3686
3776
|
}
|
|
3687
|
-
var LEVELS, _globalLogFile, _logFileInitialized;
|
|
3777
|
+
var LEVELS, _globalLogFile, _logFileInitialized, logger;
|
|
3688
3778
|
var init_logger = __esm({
|
|
3689
3779
|
"packages/domain/shared/src/logger.ts"() {
|
|
3780
|
+
"use strict";
|
|
3690
3781
|
LEVELS = { silent: 0, error: 1, warn: 2, info: 3, debug: 4 };
|
|
3691
3782
|
_globalLogFile = null;
|
|
3692
3783
|
_logFileInitialized = false;
|
|
3693
|
-
createLogger("tailwind-styled");
|
|
3784
|
+
logger = createLogger("tailwind-styled");
|
|
3694
3785
|
}
|
|
3695
3786
|
});
|
|
3696
3787
|
|
|
@@ -3766,6 +3857,11 @@ __export(src_exports, {
|
|
|
3766
3857
|
tryRequire: () => tryRequire,
|
|
3767
3858
|
wrapUnknownError: () => wrapUnknownError
|
|
3768
3859
|
});
|
|
3860
|
+
import { createHash } from "crypto";
|
|
3861
|
+
import fs5 from "fs";
|
|
3862
|
+
import path5 from "path";
|
|
3863
|
+
import { fileURLToPath } from "url";
|
|
3864
|
+
import { createRequire as createRequire5 } from "module";
|
|
3769
3865
|
function createLogger2(namespace) {
|
|
3770
3866
|
const prefix = `[${namespace}]`;
|
|
3771
3867
|
return {
|
|
@@ -3811,9 +3907,9 @@ function loadNativeBinding(options) {
|
|
|
3811
3907
|
const { runtimeDir, candidates, isValid } = options;
|
|
3812
3908
|
const loadErrors = [];
|
|
3813
3909
|
for (const candidate of candidates) {
|
|
3814
|
-
const candidatePath =
|
|
3910
|
+
const candidatePath = path5.resolve(runtimeDir, candidate);
|
|
3815
3911
|
try {
|
|
3816
|
-
if (!
|
|
3912
|
+
if (!fs5.existsSync(candidatePath) && !fs5.existsSync(candidatePath + ".node")) {
|
|
3817
3913
|
continue;
|
|
3818
3914
|
}
|
|
3819
3915
|
const mod = requireNativeModule(candidatePath);
|
|
@@ -3845,9 +3941,9 @@ function resolveNativeBindingCandidates(options) {
|
|
|
3845
3941
|
}
|
|
3846
3942
|
}
|
|
3847
3943
|
if (!includeDefaultCandidates) return candidates;
|
|
3848
|
-
if (
|
|
3944
|
+
if (fs5.existsSync(runtimeDir)) {
|
|
3849
3945
|
try {
|
|
3850
|
-
for (const entry of
|
|
3946
|
+
for (const entry of fs5.readdirSync(runtimeDir)) {
|
|
3851
3947
|
if (entry.endsWith(".node")) candidates.push(entry);
|
|
3852
3948
|
}
|
|
3853
3949
|
} catch {
|
|
@@ -3856,22 +3952,22 @@ function resolveNativeBindingCandidates(options) {
|
|
|
3856
3952
|
const BINARY_NAMES = ["tailwind-styled-native", "tailwind_styled_parser"];
|
|
3857
3953
|
const napiPlatform = process.platform === "linux" && process.arch === "x64" ? "linux-x64-gnu" : process.platform === "linux" && process.arch === "arm64" ? "linux-arm64-gnu" : `${process.platform}-${process.arch}`;
|
|
3858
3954
|
for (const bin of BINARY_NAMES) {
|
|
3859
|
-
candidates.push(
|
|
3860
|
-
candidates.push(
|
|
3861
|
-
candidates.push(
|
|
3862
|
-
candidates.push(
|
|
3863
|
-
candidates.push(
|
|
3864
|
-
candidates.push(
|
|
3865
|
-
candidates.push(
|
|
3866
|
-
candidates.push(
|
|
3867
|
-
candidates.push(
|
|
3955
|
+
candidates.push(path5.resolve(runtimeDir, `${bin}.node`));
|
|
3956
|
+
candidates.push(path5.resolve(runtimeDir, `${bin}.${napiPlatform}.node`));
|
|
3957
|
+
candidates.push(path5.resolve(runtimeDir, "..", "native", `${bin}.node`));
|
|
3958
|
+
candidates.push(path5.resolve(runtimeDir, "..", "native", `${bin}.${napiPlatform}.node`));
|
|
3959
|
+
candidates.push(path5.resolve(process.cwd(), "native", `${bin}.node`));
|
|
3960
|
+
candidates.push(path5.resolve(process.cwd(), "native", `${bin}.${napiPlatform}.node`));
|
|
3961
|
+
candidates.push(path5.resolve(runtimeDir, "..", "..", "..", "..", "native", `${bin}.node`));
|
|
3962
|
+
candidates.push(path5.resolve(runtimeDir, "..", "..", "..", "..", "native", `${bin}.${napiPlatform}.node`));
|
|
3963
|
+
candidates.push(path5.resolve(runtimeDir, "..", "..", "..", "native", `${bin}.node`));
|
|
3868
3964
|
}
|
|
3869
3965
|
return Array.from(new Set(candidates));
|
|
3870
3966
|
}
|
|
3871
3967
|
function resolveRuntimeDir(dir, importMetaUrl) {
|
|
3872
|
-
if (dir) return
|
|
3968
|
+
if (dir) return path5.resolve(dir);
|
|
3873
3969
|
try {
|
|
3874
|
-
return
|
|
3970
|
+
return path5.dirname(fileURLToPath(importMetaUrl));
|
|
3875
3971
|
} catch {
|
|
3876
3972
|
return process.cwd();
|
|
3877
3973
|
}
|
|
@@ -3888,6 +3984,7 @@ function formatErrorMessage(error) {
|
|
|
3888
3984
|
var TwError, _require3, LRUCache;
|
|
3889
3985
|
var init_src2 = __esm({
|
|
3890
3986
|
"packages/domain/shared/src/index.ts"() {
|
|
3987
|
+
"use strict";
|
|
3891
3988
|
init_trace();
|
|
3892
3989
|
init_error_codes();
|
|
3893
3990
|
init_compatibility();
|
|
@@ -3953,7 +4050,9 @@ var init_src2 = __esm({
|
|
|
3953
4050
|
return `[${this.source.toUpperCase()}:${this.code}] ${this.message}`;
|
|
3954
4051
|
}
|
|
3955
4052
|
};
|
|
3956
|
-
_require3 =
|
|
4053
|
+
_require3 = createRequire5(
|
|
4054
|
+
typeof __filename !== "undefined" ? `file://${__filename}` : import.meta.url ?? "file://unknown"
|
|
4055
|
+
);
|
|
3957
4056
|
LRUCache = class {
|
|
3958
4057
|
capacity;
|
|
3959
4058
|
cache;
|
|
@@ -4027,12 +4126,14 @@ __export(native_bridge_exports, {
|
|
|
4027
4126
|
startWatchNative: () => startWatchNative,
|
|
4028
4127
|
stopWatchNative: () => stopWatchNative
|
|
4029
4128
|
});
|
|
4129
|
+
import path6 from "path";
|
|
4130
|
+
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
4030
4131
|
function getDirname2() {
|
|
4031
4132
|
if (typeof __dirname !== "undefined") {
|
|
4032
4133
|
return __dirname;
|
|
4033
4134
|
}
|
|
4034
4135
|
if (typeof import.meta !== "undefined" && import.meta.url) {
|
|
4035
|
-
return
|
|
4136
|
+
return path6.dirname(fileURLToPath2(import.meta.url));
|
|
4036
4137
|
}
|
|
4037
4138
|
return process.cwd();
|
|
4038
4139
|
}
|
|
@@ -4240,6 +4341,7 @@ function hasNativeWatchBinding() {
|
|
|
4240
4341
|
var log2, isValidScannerBinding, createScannerBridgeLoader, scannerBridgeLoader, scannerGetBinding, resetScannerBridgeCache;
|
|
4241
4342
|
var init_native_bridge = __esm({
|
|
4242
4343
|
"packages/domain/scanner/src/native-bridge.ts"() {
|
|
4344
|
+
"use strict";
|
|
4243
4345
|
init_src2();
|
|
4244
4346
|
log2 = createDebugLogger("scanner:native");
|
|
4245
4347
|
isValidScannerBinding = (module) => {
|
|
@@ -4320,13 +4422,17 @@ var init_native_bridge = __esm({
|
|
|
4320
4422
|
resetScannerBridgeCache = scannerBridgeLoader.reset;
|
|
4321
4423
|
}
|
|
4322
4424
|
});
|
|
4425
|
+
|
|
4426
|
+
// packages/domain/scanner/src/cache-native.ts
|
|
4427
|
+
import fs6 from "fs";
|
|
4428
|
+
import path7 from "path";
|
|
4323
4429
|
function defaultCachePath(rootDir, cacheDir) {
|
|
4324
|
-
const dir = cacheDir ?
|
|
4325
|
-
return
|
|
4430
|
+
const dir = cacheDir ? path7.resolve(rootDir, cacheDir) : path7.join(process.cwd(), ".cache", "tailwind-styled");
|
|
4431
|
+
return path7.join(dir, "scanner-cache.json");
|
|
4326
4432
|
}
|
|
4327
4433
|
function readCache(rootDir, cacheDir) {
|
|
4328
4434
|
const cachePath = defaultCachePath(rootDir, cacheDir);
|
|
4329
|
-
|
|
4435
|
+
fs6.mkdirSync(path7.dirname(cachePath), { recursive: true });
|
|
4330
4436
|
const result = cacheReadNative(cachePath);
|
|
4331
4437
|
if (!result) return [];
|
|
4332
4438
|
return result.entries.map((e) => ({
|
|
@@ -4341,7 +4447,7 @@ function readCache(rootDir, cacheDir) {
|
|
|
4341
4447
|
}
|
|
4342
4448
|
function writeCache(rootDir, entries, cacheDir) {
|
|
4343
4449
|
const cachePath = defaultCachePath(rootDir, cacheDir);
|
|
4344
|
-
|
|
4450
|
+
fs6.mkdirSync(path7.dirname(cachePath), { recursive: true });
|
|
4345
4451
|
const success = cacheWriteNative(cachePath, entries);
|
|
4346
4452
|
if (!success) {
|
|
4347
4453
|
throw new Error(
|
|
@@ -4360,11 +4466,20 @@ function filePriority(mtimeMs, size, cached, nowMs = Date.now()) {
|
|
|
4360
4466
|
nowMs
|
|
4361
4467
|
);
|
|
4362
4468
|
}
|
|
4469
|
+
var STALE_THRESHOLD_MS;
|
|
4363
4470
|
var init_cache_native = __esm({
|
|
4364
4471
|
"packages/domain/scanner/src/cache-native.ts"() {
|
|
4472
|
+
"use strict";
|
|
4365
4473
|
init_native_bridge();
|
|
4474
|
+
STALE_THRESHOLD_MS = 7 * 24 * 60 * 60 * 1e3;
|
|
4366
4475
|
}
|
|
4367
4476
|
});
|
|
4477
|
+
|
|
4478
|
+
// packages/domain/scanner/src/parallel-scanner.ts
|
|
4479
|
+
import { Worker, isMainThread, parentPort, workerData } from "worker_threads";
|
|
4480
|
+
import path8 from "path";
|
|
4481
|
+
import { availableParallelism } from "os";
|
|
4482
|
+
import { fileURLToPath as fileURLToPath3 } from "url";
|
|
4368
4483
|
function collectFiles2(rootDir, extensions, ignoreDirs) {
|
|
4369
4484
|
const native = collectFilesNative(rootDir, extensions, ignoreDirs);
|
|
4370
4485
|
if (native !== null) return native;
|
|
@@ -4405,7 +4520,7 @@ async function scanWorkspaceParallel(rootDir, options = {}) {
|
|
|
4405
4520
|
maxWorkers = Math.max(1, availableParallelism() - 1),
|
|
4406
4521
|
chunkSize = DEFAULT_CHUNK_SIZE
|
|
4407
4522
|
} = options;
|
|
4408
|
-
const files = collectFiles2(
|
|
4523
|
+
const files = collectFiles2(path8.resolve(rootDir), extensions, ignoreDirs);
|
|
4409
4524
|
if (files.length < PARALLEL_THRESHOLD) {
|
|
4410
4525
|
return mergeResults(batchExtractClassesNative2(files));
|
|
4411
4526
|
}
|
|
@@ -4424,6 +4539,7 @@ async function scanWorkspaceParallel(rootDir, options = {}) {
|
|
|
4424
4539
|
var PARALLEL_THRESHOLD, DEFAULT_CHUNK_SIZE, _workerFilename;
|
|
4425
4540
|
var init_parallel_scanner = __esm({
|
|
4426
4541
|
"packages/domain/scanner/src/parallel-scanner.ts"() {
|
|
4542
|
+
"use strict";
|
|
4427
4543
|
init_src3();
|
|
4428
4544
|
init_native_bridge();
|
|
4429
4545
|
PARALLEL_THRESHOLD = 50;
|
|
@@ -4442,12 +4558,16 @@ var init_parallel_scanner = __esm({
|
|
|
4442
4558
|
parentPort.postMessage(msg);
|
|
4443
4559
|
}
|
|
4444
4560
|
}
|
|
4445
|
-
_workerFilename = typeof __filename !== "undefined" ? __filename :
|
|
4561
|
+
_workerFilename = typeof __filename !== "undefined" ? __filename : fileURLToPath3(import.meta.url);
|
|
4446
4562
|
}
|
|
4447
4563
|
});
|
|
4448
|
-
|
|
4564
|
+
|
|
4565
|
+
// packages/domain/scanner/src/schemas.ts
|
|
4566
|
+
import { z as z3 } from "zod";
|
|
4567
|
+
var formatIssuePath2, formatIssues, parseWithSchema, NonNegativeIntegerSchema, ScanWorkspaceOptionsSchema, ScanFileResultSchema, ScanWorkspaceResultSchema, ScannerWorkerRequestSchema, ScannerWorkerSuccessMessageSchema, ScannerWorkerErrorMessageSchema, ScannerWorkerMessageSchema, parseScanWorkspaceOptions, parseScanWorkspaceResult, parseScannerWorkerMessage;
|
|
4449
4568
|
var init_schemas = __esm({
|
|
4450
4569
|
"packages/domain/scanner/src/schemas.ts"() {
|
|
4570
|
+
"use strict";
|
|
4451
4571
|
init_src2();
|
|
4452
4572
|
formatIssuePath2 = (path16) => path16.length > 0 ? path16.map(
|
|
4453
4573
|
(segment) => typeof segment === "symbol" ? segment.description ?? segment.toString() : String(segment)
|
|
@@ -4467,40 +4587,40 @@ var init_schemas = __esm({
|
|
|
4467
4587
|
parsed.error
|
|
4468
4588
|
);
|
|
4469
4589
|
};
|
|
4470
|
-
NonNegativeIntegerSchema =
|
|
4471
|
-
ScanWorkspaceOptionsSchema =
|
|
4472
|
-
includeExtensions:
|
|
4473
|
-
ignoreDirectories:
|
|
4474
|
-
useCache:
|
|
4475
|
-
cacheDir:
|
|
4476
|
-
smartInvalidation:
|
|
4590
|
+
NonNegativeIntegerSchema = z3.number().int().min(0);
|
|
4591
|
+
ScanWorkspaceOptionsSchema = z3.object({
|
|
4592
|
+
includeExtensions: z3.array(z3.string()).optional(),
|
|
4593
|
+
ignoreDirectories: z3.array(z3.string()).optional(),
|
|
4594
|
+
useCache: z3.boolean().optional(),
|
|
4595
|
+
cacheDir: z3.string().min(1).optional(),
|
|
4596
|
+
smartInvalidation: z3.boolean().optional()
|
|
4477
4597
|
});
|
|
4478
|
-
ScanFileResultSchema =
|
|
4479
|
-
file:
|
|
4480
|
-
classes:
|
|
4481
|
-
hash:
|
|
4598
|
+
ScanFileResultSchema = z3.object({
|
|
4599
|
+
file: z3.string(),
|
|
4600
|
+
classes: z3.array(z3.string()),
|
|
4601
|
+
hash: z3.string().optional()
|
|
4482
4602
|
});
|
|
4483
|
-
ScanWorkspaceResultSchema =
|
|
4484
|
-
files:
|
|
4603
|
+
ScanWorkspaceResultSchema = z3.object({
|
|
4604
|
+
files: z3.array(ScanFileResultSchema),
|
|
4485
4605
|
totalFiles: NonNegativeIntegerSchema,
|
|
4486
|
-
uniqueClasses:
|
|
4606
|
+
uniqueClasses: z3.array(z3.string())
|
|
4487
4607
|
}).refine((value) => value.totalFiles === value.files.length, {
|
|
4488
4608
|
message: "scan result totalFiles must match files.length",
|
|
4489
4609
|
path: ["totalFiles"]
|
|
4490
4610
|
});
|
|
4491
|
-
|
|
4492
|
-
rootDir:
|
|
4611
|
+
ScannerWorkerRequestSchema = z3.object({
|
|
4612
|
+
rootDir: z3.string().min(1),
|
|
4493
4613
|
options: ScanWorkspaceOptionsSchema.optional()
|
|
4494
4614
|
});
|
|
4495
|
-
ScannerWorkerSuccessMessageSchema =
|
|
4496
|
-
ok:
|
|
4615
|
+
ScannerWorkerSuccessMessageSchema = z3.object({
|
|
4616
|
+
ok: z3.literal(true),
|
|
4497
4617
|
result: ScanWorkspaceResultSchema
|
|
4498
4618
|
});
|
|
4499
|
-
ScannerWorkerErrorMessageSchema =
|
|
4500
|
-
ok:
|
|
4501
|
-
error:
|
|
4619
|
+
ScannerWorkerErrorMessageSchema = z3.object({
|
|
4620
|
+
ok: z3.literal(false),
|
|
4621
|
+
error: z3.string().optional()
|
|
4502
4622
|
});
|
|
4503
|
-
ScannerWorkerMessageSchema =
|
|
4623
|
+
ScannerWorkerMessageSchema = z3.union([
|
|
4504
4624
|
ScannerWorkerSuccessMessageSchema,
|
|
4505
4625
|
ScannerWorkerErrorMessageSchema
|
|
4506
4626
|
]);
|
|
@@ -4526,12 +4646,17 @@ __export(src_exports2, {
|
|
|
4526
4646
|
scanWorkspace: () => scanWorkspace2,
|
|
4527
4647
|
scanWorkspaceAsync: () => scanWorkspaceAsync
|
|
4528
4648
|
});
|
|
4649
|
+
import fs7 from "fs";
|
|
4650
|
+
import { createRequire as createRequire6 } from "module";
|
|
4651
|
+
import path9 from "path";
|
|
4652
|
+
import { fileURLToPath as fileURLToPath4 } from "url";
|
|
4653
|
+
import { Worker as Worker2 } from "worker_threads";
|
|
4529
4654
|
function getRuntimeDir() {
|
|
4530
4655
|
if (typeof __dirname !== "undefined" && __dirname.length > 0) {
|
|
4531
4656
|
return __dirname;
|
|
4532
4657
|
}
|
|
4533
4658
|
if (typeof import.meta !== "undefined" && import.meta.url) {
|
|
4534
|
-
return
|
|
4659
|
+
return path9.dirname(fileURLToPath4(import.meta.url));
|
|
4535
4660
|
}
|
|
4536
4661
|
return process.cwd();
|
|
4537
4662
|
}
|
|
@@ -4541,17 +4666,17 @@ function resolveScannerWorkerModulePath() {
|
|
|
4541
4666
|
return __dirname;
|
|
4542
4667
|
}
|
|
4543
4668
|
if (typeof import.meta !== "undefined" && import.meta.url) {
|
|
4544
|
-
return
|
|
4669
|
+
return path9.dirname(fileURLToPath4(import.meta.url));
|
|
4545
4670
|
}
|
|
4546
4671
|
return process.cwd();
|
|
4547
4672
|
})();
|
|
4548
4673
|
const candidates = [
|
|
4549
|
-
|
|
4550
|
-
|
|
4551
|
-
|
|
4674
|
+
path9.resolve(runtimeDir, "worker.cjs"),
|
|
4675
|
+
path9.resolve(runtimeDir, "worker.js"),
|
|
4676
|
+
path9.resolve(runtimeDir, "worker.ts")
|
|
4552
4677
|
];
|
|
4553
4678
|
for (const candidate of candidates) {
|
|
4554
|
-
if (
|
|
4679
|
+
if (fs7.existsSync(candidate)) return candidate;
|
|
4555
4680
|
}
|
|
4556
4681
|
return null;
|
|
4557
4682
|
}
|
|
@@ -4563,7 +4688,7 @@ function scanWorkspaceInWorker(rootDir, options) {
|
|
|
4563
4688
|
}
|
|
4564
4689
|
return new Promise((resolve2, reject) => {
|
|
4565
4690
|
const settleState = { settled: false };
|
|
4566
|
-
const worker = new
|
|
4691
|
+
const worker = new Worker2(modulePath, { workerData: { rootDir, options: normalizedOptions } });
|
|
4567
4692
|
const timeout = setTimeout(() => {
|
|
4568
4693
|
if (!settleState.settled) {
|
|
4569
4694
|
settleState.settled = true;
|
|
@@ -4608,19 +4733,19 @@ function collectCandidates(rootDir, ignoreDirectories, extensionSet) {
|
|
|
4608
4733
|
if (!currentDir) continue;
|
|
4609
4734
|
const entries = (() => {
|
|
4610
4735
|
try {
|
|
4611
|
-
return
|
|
4736
|
+
return fs7.readdirSync(currentDir, { withFileTypes: true });
|
|
4612
4737
|
} catch {
|
|
4613
4738
|
return [];
|
|
4614
4739
|
}
|
|
4615
4740
|
})();
|
|
4616
4741
|
for (const entry of entries) {
|
|
4617
|
-
const fullPath =
|
|
4742
|
+
const fullPath = path9.join(currentDir, entry.name);
|
|
4618
4743
|
if (entry.isDirectory()) {
|
|
4619
4744
|
if (!ignoreDirectories.has(entry.name)) directories.push(fullPath);
|
|
4620
4745
|
continue;
|
|
4621
4746
|
}
|
|
4622
4747
|
if (!entry.isFile()) continue;
|
|
4623
|
-
if (!extensionSet.has(
|
|
4748
|
+
if (!extensionSet.has(path9.extname(entry.name))) continue;
|
|
4624
4749
|
candidates.push(fullPath);
|
|
4625
4750
|
}
|
|
4626
4751
|
}
|
|
@@ -4647,7 +4772,7 @@ function scanSource(source) {
|
|
|
4647
4772
|
);
|
|
4648
4773
|
}
|
|
4649
4774
|
function isScannableFile2(filePath, includeExtensions = DEFAULT_EXTENSIONS) {
|
|
4650
|
-
return includeExtensions.includes(
|
|
4775
|
+
return includeExtensions.includes(path9.extname(filePath));
|
|
4651
4776
|
}
|
|
4652
4777
|
function scanFile2(filePath) {
|
|
4653
4778
|
const { scanFileNative: scanFileNative3 } = (init_native_bridge(), __toCommonJS(native_bridge_exports));
|
|
@@ -4667,7 +4792,7 @@ function scanWorkspace2(rootDir, options = {}) {
|
|
|
4667
4792
|
const extensionSet = buildExtensionSet(includeExtensions);
|
|
4668
4793
|
const ignoreDirectories = new Set(normalizedOptions.ignoreDirectories ?? DEFAULT_IGNORES);
|
|
4669
4794
|
const useCache = normalizedOptions.useCache ?? true;
|
|
4670
|
-
normalizedOptions.smartInvalidation ?? true;
|
|
4795
|
+
const _smartInvalidation = normalizedOptions.smartInvalidation ?? true;
|
|
4671
4796
|
const files = [];
|
|
4672
4797
|
const unique = /* @__PURE__ */ new Set();
|
|
4673
4798
|
const candidates = collectCandidates(rootDir, ignoreDirectories, extensionSet);
|
|
@@ -4707,7 +4832,7 @@ function scanWorkspace2(rootDir, options = {}) {
|
|
|
4707
4832
|
for (const filePath of candidates) {
|
|
4708
4833
|
const stat = (() => {
|
|
4709
4834
|
try {
|
|
4710
|
-
return
|
|
4835
|
+
return fs7.statSync(filePath);
|
|
4711
4836
|
} catch {
|
|
4712
4837
|
return null;
|
|
4713
4838
|
}
|
|
@@ -4733,7 +4858,7 @@ function scanWorkspace2(rootDir, options = {}) {
|
|
|
4733
4858
|
for (const { filePath, stat, size, cached } of ranked) {
|
|
4734
4859
|
const content = (() => {
|
|
4735
4860
|
try {
|
|
4736
|
-
return
|
|
4861
|
+
return fs7.readFileSync(filePath, "utf8");
|
|
4737
4862
|
} catch {
|
|
4738
4863
|
return null;
|
|
4739
4864
|
}
|
|
@@ -4817,6 +4942,7 @@ async function scanWorkspaceAsync(rootDir, options = {}) {
|
|
|
4817
4942
|
var log3, SCAN_WORKER_TIMEOUT_MS, createNativeParserLoader, nativeParserLoader, DEFAULT_EXTENSIONS, DEFAULT_IGNORES;
|
|
4818
4943
|
var init_src3 = __esm({
|
|
4819
4944
|
"packages/domain/scanner/src/index.ts"() {
|
|
4945
|
+
"use strict";
|
|
4820
4946
|
init_src2();
|
|
4821
4947
|
init_cache_native();
|
|
4822
4948
|
init_native_bridge();
|
|
@@ -4837,7 +4963,7 @@ var init_src3 = __esm({
|
|
|
4837
4963
|
const loadNativeParserBinding = () => {
|
|
4838
4964
|
if (_state.binding !== void 0) return _state.binding;
|
|
4839
4965
|
const runtimeDir = getRuntimeDir();
|
|
4840
|
-
const req =
|
|
4966
|
+
const req = createRequire6(path9.join(runtimeDir, "noop.cjs"));
|
|
4841
4967
|
const _platform = process.platform;
|
|
4842
4968
|
const _arch = process.arch;
|
|
4843
4969
|
const _platformArch = `${_platform}-${_arch}`;
|
|
@@ -4845,27 +4971,27 @@ var init_src3 = __esm({
|
|
|
4845
4971
|
const candidates = [
|
|
4846
4972
|
// ── binaryName baru: tailwind-styled-native (napi-rs naming) ──
|
|
4847
4973
|
// cwd = repo root saat run dari root, atau package dir saat workspaces
|
|
4848
|
-
|
|
4849
|
-
|
|
4850
|
-
|
|
4974
|
+
path9.resolve(process.cwd(), "native", "tailwind-styled-native.node"),
|
|
4975
|
+
path9.resolve(process.cwd(), "native", `tailwind-styled-native.${_platformArch}.node`),
|
|
4976
|
+
path9.resolve(process.cwd(), "native", `tailwind-styled-native.${_platformArchGnu}.node`),
|
|
4851
4977
|
// runtimeDir = dist/ → naik 1 level ke package root (npm install case)
|
|
4852
4978
|
// e.g. node_modules/tailwind-styled-v4/dist/ → node_modules/tailwind-styled-v4/native/
|
|
4853
|
-
|
|
4854
|
-
|
|
4855
|
-
|
|
4979
|
+
path9.resolve(runtimeDir, "..", "native", "tailwind-styled-native.node"),
|
|
4980
|
+
path9.resolve(runtimeDir, "..", "native", `tailwind-styled-native.${_platformArch}.node`),
|
|
4981
|
+
path9.resolve(runtimeDir, "..", "native", `tailwind-styled-native.${_platformArchGnu}.node`),
|
|
4856
4982
|
// runtimeDir = dist/ → naik 4 level ke repo root (monorepo dev case)
|
|
4857
|
-
|
|
4858
|
-
|
|
4983
|
+
path9.resolve(runtimeDir, "..", "..", "..", "..", "native", "tailwind-styled-native.node"),
|
|
4984
|
+
path9.resolve(runtimeDir, "..", "..", "..", "..", "native", `tailwind-styled-native.${_platformArchGnu}.node`),
|
|
4859
4985
|
// 3 level fallback (jika package di-nest lebih dangkal)
|
|
4860
|
-
|
|
4861
|
-
|
|
4986
|
+
path9.resolve(runtimeDir, "..", "..", "..", "native", "tailwind-styled-native.node"),
|
|
4987
|
+
path9.resolve(runtimeDir, "..", "..", "..", "native", `tailwind-styled-native.${_platformArchGnu}.node`),
|
|
4862
4988
|
// ── binaryName lama: tailwind_styled_parser (backward compat) ──
|
|
4863
|
-
|
|
4864
|
-
|
|
4865
|
-
|
|
4866
|
-
|
|
4867
|
-
|
|
4868
|
-
|
|
4989
|
+
path9.resolve(process.cwd(), "native/tailwind_styled_parser.node"),
|
|
4990
|
+
path9.resolve(process.cwd(), "native/build/Release/tailwind_styled_parser.node"),
|
|
4991
|
+
path9.resolve(runtimeDir, "..", "native", "tailwind_styled_parser.node"),
|
|
4992
|
+
path9.resolve(runtimeDir, "..", "..", "..", "..", "native", "tailwind_styled_parser.node"),
|
|
4993
|
+
path9.resolve(runtimeDir, "..", "..", "..", "native", "tailwind_styled_parser.node"),
|
|
4994
|
+
path9.resolve(
|
|
4869
4995
|
runtimeDir,
|
|
4870
4996
|
"..",
|
|
4871
4997
|
"..",
|
|
@@ -4877,7 +5003,7 @@ var init_src3 = __esm({
|
|
|
4877
5003
|
)
|
|
4878
5004
|
];
|
|
4879
5005
|
for (const fullPath of candidates) {
|
|
4880
|
-
if (!
|
|
5006
|
+
if (!fs7.existsSync(fullPath)) continue;
|
|
4881
5007
|
try {
|
|
4882
5008
|
const required = req(fullPath);
|
|
4883
5009
|
if (required && (typeof required.extractClassesFromSource === "function" || typeof required.parseClasses === "function" || typeof required.parse_classes === "function")) {
|
|
@@ -4924,6 +5050,7 @@ function getNativeEngineBinding() {
|
|
|
4924
5050
|
var log4, isValidEngineBinding, createEngineBindingLoader, engineBindingLoader;
|
|
4925
5051
|
var init_native_bridge2 = __esm({
|
|
4926
5052
|
"packages/domain/engine/src/native-bridge.ts"() {
|
|
5053
|
+
"use strict";
|
|
4927
5054
|
init_src2();
|
|
4928
5055
|
log4 = createDebugLogger("engine:native");
|
|
4929
5056
|
isValidEngineBinding = (module) => {
|
|
@@ -5047,6 +5174,7 @@ function createResolutionReason(causes, finalDecision) {
|
|
|
5047
5174
|
var RuleId, SelectorId, VariantChainId, PropertyId, ValueId, LayerId, ConditionId, CascadeResolutionId, Origin, Importance, ConditionResult, CascadeStage;
|
|
5048
5175
|
var init_ir = __esm({
|
|
5049
5176
|
"packages/domain/engine/src/ir.ts"() {
|
|
5177
|
+
"use strict";
|
|
5050
5178
|
init_native_bridge2();
|
|
5051
5179
|
RuleId = class {
|
|
5052
5180
|
constructor(value) {
|
|
@@ -5218,6 +5346,7 @@ function buildResolutionsMap(nativeResult, rules, styleGraph) {
|
|
|
5218
5346
|
var CascadeResolver;
|
|
5219
5347
|
var init_resolver = __esm({
|
|
5220
5348
|
"packages/domain/engine/src/resolver.ts"() {
|
|
5349
|
+
"use strict";
|
|
5221
5350
|
init_ir();
|
|
5222
5351
|
init_native_bridge2();
|
|
5223
5352
|
CascadeResolver = class {
|
|
@@ -5412,7 +5541,7 @@ function _parseCssToIrFallback(css, prefix, native) {
|
|
|
5412
5541
|
const parsed = native.parseCssRules(css);
|
|
5413
5542
|
for (const r of parsed) {
|
|
5414
5543
|
const className = prefix + r.className;
|
|
5415
|
-
r.variants.length > 0;
|
|
5544
|
+
const hasVariants = r.variants.length > 0;
|
|
5416
5545
|
const layerName = detectLayerFromClassName(className);
|
|
5417
5546
|
const layer = layerName ? getOrCreateLayerId(layerName) : null;
|
|
5418
5547
|
const layerOrder = layerName ? layerOrderMap.get(layerName) ?? 4 : 4;
|
|
@@ -5451,6 +5580,7 @@ function _parseCssToIrFallback(css, prefix, native) {
|
|
|
5451
5580
|
var _defaultIdGen, generateRuleId, generateSelectorId, generatePropertyId, generateValueId, generateLayerId, generateConditionId, getNextInsertionOrder, resetIdGenerator, layerMap, layerOrderMap, LAYER_ORDER;
|
|
5452
5581
|
var init_cssToIr = __esm({
|
|
5453
5582
|
"packages/domain/engine/src/cssToIr.ts"() {
|
|
5583
|
+
"use strict";
|
|
5454
5584
|
init_native_bridge2();
|
|
5455
5585
|
init_ir();
|
|
5456
5586
|
_defaultIdGen = createIdGenerator();
|
|
@@ -5583,18 +5713,26 @@ function trace(className, resolver) {
|
|
|
5583
5713
|
}
|
|
5584
5714
|
var init_trace2 = __esm({
|
|
5585
5715
|
"packages/domain/engine/src/trace.ts"() {
|
|
5716
|
+
"use strict";
|
|
5586
5717
|
init_ir();
|
|
5587
5718
|
}
|
|
5588
5719
|
});
|
|
5589
5720
|
|
|
5721
|
+
// packages/domain/engine/src/index.ts
|
|
5722
|
+
import fs12 from "fs";
|
|
5723
|
+
import path15 from "path";
|
|
5724
|
+
import { pathToFileURL as pathToFileURL2 } from "url";
|
|
5725
|
+
|
|
5590
5726
|
// packages/domain/analyzer/src/analyzeWorkspace.ts
|
|
5591
5727
|
init_src3();
|
|
5728
|
+
import path11 from "path";
|
|
5592
5729
|
|
|
5593
5730
|
// packages/domain/analyzer/src/binding.ts
|
|
5594
5731
|
init_src2();
|
|
5595
5732
|
|
|
5596
5733
|
// packages/domain/analyzer/src/utils.ts
|
|
5597
5734
|
init_src2();
|
|
5735
|
+
import fs8 from "fs";
|
|
5598
5736
|
var DEFAULT_TOP_LIMIT = 10;
|
|
5599
5737
|
var DEFAULT_FREQUENT_THRESHOLD = 2;
|
|
5600
5738
|
var DEBUG_NAMESPACE = "tailwind-styled:analyzer";
|
|
@@ -5608,7 +5746,7 @@ function isRecord(value) {
|
|
|
5608
5746
|
}
|
|
5609
5747
|
async function pathExists(filePath) {
|
|
5610
5748
|
try {
|
|
5611
|
-
await
|
|
5749
|
+
await fs8.promises.access(filePath, fs8.constants.F_OK);
|
|
5612
5750
|
return true;
|
|
5613
5751
|
} catch {
|
|
5614
5752
|
return false;
|
|
@@ -5707,6 +5845,7 @@ async function requireNativeBinding() {
|
|
|
5707
5845
|
|
|
5708
5846
|
// packages/domain/analyzer/src/schemas.ts
|
|
5709
5847
|
init_src2();
|
|
5848
|
+
import { z as z4 } from "zod";
|
|
5710
5849
|
var formatIssuePath3 = (path16) => path16.length > 0 ? path16.map(
|
|
5711
5850
|
(segment) => typeof segment === "symbol" ? segment.description ?? segment.toString() : String(segment)
|
|
5712
5851
|
).join(".") : "<root>";
|
|
@@ -5730,81 +5869,86 @@ var parseWithSchema2 = (schema, data, label) => {
|
|
|
5730
5869
|
parsed.error
|
|
5731
5870
|
);
|
|
5732
5871
|
};
|
|
5733
|
-
var CountSchema =
|
|
5734
|
-
|
|
5735
|
-
name:
|
|
5872
|
+
var CountSchema = z4.number().int().min(0);
|
|
5873
|
+
var ClassUsageSchema = z4.object({
|
|
5874
|
+
name: z4.string(),
|
|
5736
5875
|
count: CountSchema,
|
|
5737
|
-
isUnused:
|
|
5738
|
-
isConflict:
|
|
5876
|
+
isUnused: z4.boolean().optional(),
|
|
5877
|
+
isConflict: z4.boolean().optional()
|
|
5739
5878
|
});
|
|
5740
|
-
|
|
5741
|
-
className:
|
|
5742
|
-
variants:
|
|
5743
|
-
classes:
|
|
5744
|
-
message:
|
|
5879
|
+
var ClassConflictSchema = z4.object({
|
|
5880
|
+
className: z4.string(),
|
|
5881
|
+
variants: z4.array(z4.string()),
|
|
5882
|
+
classes: z4.array(z4.string()),
|
|
5883
|
+
message: z4.string()
|
|
5745
5884
|
});
|
|
5746
|
-
var ClassCountSchema =
|
|
5747
|
-
name:
|
|
5885
|
+
var ClassCountSchema = z4.object({
|
|
5886
|
+
name: z4.string(),
|
|
5748
5887
|
count: CountSchema
|
|
5749
5888
|
});
|
|
5750
|
-
var NativeReportSchema =
|
|
5751
|
-
root:
|
|
5889
|
+
var NativeReportSchema = z4.object({
|
|
5890
|
+
root: z4.string(),
|
|
5752
5891
|
totalFiles: CountSchema,
|
|
5753
5892
|
uniqueClassCount: CountSchema,
|
|
5754
5893
|
totalClassOccurrences: CountSchema,
|
|
5755
|
-
topClasses:
|
|
5756
|
-
duplicateCandidates:
|
|
5757
|
-
safelist:
|
|
5894
|
+
topClasses: z4.array(ClassCountSchema),
|
|
5895
|
+
duplicateCandidates: z4.array(ClassCountSchema),
|
|
5896
|
+
safelist: z4.array(z4.string())
|
|
5758
5897
|
});
|
|
5759
|
-
|
|
5760
|
-
css:
|
|
5761
|
-
resolvedClasses:
|
|
5762
|
-
unknownClasses:
|
|
5898
|
+
var NativeCssCompileResultSchema2 = z4.object({
|
|
5899
|
+
css: z4.string(),
|
|
5900
|
+
resolvedClasses: z4.array(z4.string()),
|
|
5901
|
+
unknownClasses: z4.array(z4.string()),
|
|
5763
5902
|
sizeBytes: CountSchema
|
|
5764
5903
|
});
|
|
5765
|
-
var AnalyzerClassStatsSchema =
|
|
5766
|
-
top:
|
|
5904
|
+
var AnalyzerClassStatsSchema = z4.object({
|
|
5905
|
+
top: z4.number({
|
|
5767
5906
|
error: "analyzeWorkspace options.classStats.top must be a number when provided."
|
|
5768
5907
|
}).finite().optional(),
|
|
5769
|
-
frequentThreshold:
|
|
5908
|
+
frequentThreshold: z4.number({
|
|
5770
5909
|
error: "analyzeWorkspace options.classStats.frequentThreshold must be a number when provided."
|
|
5771
5910
|
}).finite().optional()
|
|
5772
5911
|
});
|
|
5773
|
-
var AnalyzerSemanticOptionsSchema =
|
|
5774
|
-
tailwindConfigPath:
|
|
5912
|
+
var AnalyzerSemanticOptionsSchema = z4.object({
|
|
5913
|
+
tailwindConfigPath: z4.string({
|
|
5775
5914
|
error: "analyzeWorkspace options.semantic.tailwindConfigPath must be a non-empty string when provided."
|
|
5776
5915
|
}).min(
|
|
5777
5916
|
1,
|
|
5778
5917
|
"analyzeWorkspace options.semantic.tailwindConfigPath must be a non-empty string when provided."
|
|
5779
5918
|
).optional()
|
|
5780
5919
|
});
|
|
5781
|
-
var AnalyzerOptionsSchema =
|
|
5782
|
-
scanner:
|
|
5920
|
+
var AnalyzerOptionsSchema = z4.object({
|
|
5921
|
+
scanner: z4.custom(
|
|
5783
5922
|
(value) => isPlainObject(value),
|
|
5784
5923
|
"analyzeWorkspace options.scanner must be an object when provided."
|
|
5785
5924
|
).optional(),
|
|
5786
5925
|
classStats: AnalyzerClassStatsSchema.optional(),
|
|
5787
|
-
semantic:
|
|
5788
|
-
|
|
5926
|
+
semantic: z4.union([
|
|
5927
|
+
z4.boolean({
|
|
5789
5928
|
error: "analyzeWorkspace options.semantic must be a boolean or an object when provided."
|
|
5790
5929
|
}),
|
|
5791
5930
|
AnalyzerSemanticOptionsSchema
|
|
5792
5931
|
]).optional(),
|
|
5793
|
-
includeClass:
|
|
5932
|
+
includeClass: z4.custom(
|
|
5794
5933
|
(value) => typeof value === "function",
|
|
5795
5934
|
"analyzeWorkspace options.includeClass must be a function when provided."
|
|
5796
5935
|
).optional()
|
|
5797
5936
|
});
|
|
5798
|
-
|
|
5799
|
-
prefix:
|
|
5937
|
+
var ClassToCssOptionsSchema = z4.object({
|
|
5938
|
+
prefix: z4.union([z4.string(), z4.null()], {
|
|
5800
5939
|
error: "classToCss options.prefix must be a string or null when provided."
|
|
5801
5940
|
}).optional(),
|
|
5802
|
-
strict:
|
|
5941
|
+
strict: z4.boolean({
|
|
5803
5942
|
error: "classToCss options.strict must be a boolean when provided."
|
|
5804
5943
|
}).optional()
|
|
5805
5944
|
});
|
|
5806
5945
|
var parseAnalyzerOptions = (options) => parseWithSchema2(AnalyzerOptionsSchema, options ?? {}, "analyzeWorkspace options are invalid");
|
|
5807
5946
|
var parseNativeReport = (report) => parseWithSchema2(NativeReportSchema, report, "Native analyzer report is invalid");
|
|
5947
|
+
|
|
5948
|
+
// packages/domain/analyzer/src/semantic.ts
|
|
5949
|
+
import fs9 from "fs";
|
|
5950
|
+
import path10 from "path";
|
|
5951
|
+
import { pathToFileURL } from "url";
|
|
5808
5952
|
var SUPPORTED_TAILWIND_CONFIG_EXTENSIONS = /* @__PURE__ */ new Set([".ts", ".js", ".cjs", ".mjs"]);
|
|
5809
5953
|
var tailwindConfigCache = /* @__PURE__ */ new Map();
|
|
5810
5954
|
var detectConflicts2 = async (usages) => {
|
|
@@ -5824,11 +5968,11 @@ var detectConflicts2 = async (usages) => {
|
|
|
5824
5968
|
};
|
|
5825
5969
|
};
|
|
5826
5970
|
var isSupportedTailwindConfigPath = (configPath) => {
|
|
5827
|
-
return SUPPORTED_TAILWIND_CONFIG_EXTENSIONS.has(
|
|
5971
|
+
return SUPPORTED_TAILWIND_CONFIG_EXTENSIONS.has(path10.extname(configPath).toLowerCase());
|
|
5828
5972
|
};
|
|
5829
5973
|
var resolveTailwindConfigPath = async (root, explicitPath) => {
|
|
5830
5974
|
if (explicitPath) {
|
|
5831
|
-
const resolved =
|
|
5975
|
+
const resolved = path10.resolve(root, explicitPath);
|
|
5832
5976
|
if (!await pathExists(resolved)) return null;
|
|
5833
5977
|
return resolved;
|
|
5834
5978
|
}
|
|
@@ -5839,7 +5983,7 @@ var resolveTailwindConfigPath = async (root, explicitPath) => {
|
|
|
5839
5983
|
"tailwind.config.mjs"
|
|
5840
5984
|
];
|
|
5841
5985
|
for (const candidate of candidates) {
|
|
5842
|
-
const fullPath =
|
|
5986
|
+
const fullPath = path10.resolve(root, candidate);
|
|
5843
5987
|
if (await pathExists(fullPath)) return fullPath;
|
|
5844
5988
|
}
|
|
5845
5989
|
return null;
|
|
@@ -5893,7 +6037,7 @@ var collectCustomUtilities = (config) => {
|
|
|
5893
6037
|
return out;
|
|
5894
6038
|
};
|
|
5895
6039
|
var collectSafelistFromSource = async (configPath) => {
|
|
5896
|
-
const source = await
|
|
6040
|
+
const source = await fs9.promises.readFile(configPath, "utf8");
|
|
5897
6041
|
const { extractClassesNative: extractClassesNative2 } = await Promise.resolve().then(() => (init_src3(), src_exports2));
|
|
5898
6042
|
const allTokens = extractClassesNative2(source);
|
|
5899
6043
|
const hasSafelist = source.includes("safelist");
|
|
@@ -5920,7 +6064,7 @@ var loadTailwindConfig2 = async (root, semanticOption) => {
|
|
|
5920
6064
|
customUtilities: /* @__PURE__ */ new Set()
|
|
5921
6065
|
};
|
|
5922
6066
|
}
|
|
5923
|
-
const configStat = await
|
|
6067
|
+
const configStat = await fs9.promises.stat(configPath).catch(() => null);
|
|
5924
6068
|
if (configStat) {
|
|
5925
6069
|
const cached = tailwindConfigCache.get(configPath);
|
|
5926
6070
|
if (cached && cached.mtimeMs === configStat.mtimeMs && cached.size === configStat.size) {
|
|
@@ -6079,7 +6223,7 @@ async function buildDistribution(usages, native) {
|
|
|
6079
6223
|
}
|
|
6080
6224
|
async function analyzeWorkspace(root, options = {}) {
|
|
6081
6225
|
const startedAtMs = Date.now();
|
|
6082
|
-
const resolvedRoot =
|
|
6226
|
+
const resolvedRoot = path11.resolve(root);
|
|
6083
6227
|
const normalizedOptions = parseAnalyzerOptions(options);
|
|
6084
6228
|
const scan = await (async () => {
|
|
6085
6229
|
const scanStartedAtMs = Date.now();
|
|
@@ -6191,6 +6335,8 @@ init_src2();
|
|
|
6191
6335
|
init_src3();
|
|
6192
6336
|
init_src2();
|
|
6193
6337
|
init_native_bridge2();
|
|
6338
|
+
import fs10 from "fs";
|
|
6339
|
+
import path12 from "path";
|
|
6194
6340
|
var DEFAULT_EXTENSIONS2 = [".js", ".jsx", ".ts", ".tsx", ".mjs", ".cjs"];
|
|
6195
6341
|
var log5 = createLogger2("engine:incremental");
|
|
6196
6342
|
function rebuildWorkspaceResult2(byFile) {
|
|
@@ -6223,8 +6369,8 @@ function areClassSetsEqual(a, b) {
|
|
|
6223
6369
|
function applyIncrementalChange(previous, filePath, type, scanner) {
|
|
6224
6370
|
const includeExtensions = scanner?.includeExtensions ?? DEFAULT_EXTENSIONS2;
|
|
6225
6371
|
if (!isScannableFile2(filePath, includeExtensions)) return previous;
|
|
6226
|
-
const byFile = new Map(previous.files.map((f) => [
|
|
6227
|
-
const normalizedPath =
|
|
6372
|
+
const byFile = new Map(previous.files.map((f) => [path12.resolve(f.file), f]));
|
|
6373
|
+
const normalizedPath = path12.resolve(filePath);
|
|
6228
6374
|
const native = getNativeEngineBinding();
|
|
6229
6375
|
if (!native?.processFileChange) {
|
|
6230
6376
|
throw new Error(
|
|
@@ -6240,7 +6386,7 @@ function applyIncrementalChange(previous, filePath, type, scanner) {
|
|
|
6240
6386
|
}
|
|
6241
6387
|
log5.debug(`native change ${normalizedPath}`);
|
|
6242
6388
|
const scanned = scanFile2(normalizedPath);
|
|
6243
|
-
const content =
|
|
6389
|
+
const content = fs10.readFileSync(normalizedPath, "utf8");
|
|
6244
6390
|
const diff = native.processFileChange(normalizedPath, scanned.classes, content);
|
|
6245
6391
|
const existing = byFile.get(normalizedPath);
|
|
6246
6392
|
if (diff && existing) {
|
|
@@ -6586,12 +6732,16 @@ var EngineMetricsCollector = class {
|
|
|
6586
6732
|
|
|
6587
6733
|
// packages/domain/engine/src/metricsWriter.ts
|
|
6588
6734
|
init_src2();
|
|
6735
|
+
import fs11 from "fs";
|
|
6736
|
+
import path13 from "path";
|
|
6737
|
+
import { performance } from "perf_hooks";
|
|
6738
|
+
var _log = createLogger2("tw:metrics");
|
|
6589
6739
|
var METRICS_FILE_NAME = "metrics.json";
|
|
6590
6740
|
var CACHE_DIR = ".tw-cache";
|
|
6591
6741
|
function writeMetrics(metrics, cwd = process.cwd()) {
|
|
6592
6742
|
try {
|
|
6593
|
-
const cacheDir =
|
|
6594
|
-
|
|
6743
|
+
const cacheDir = path13.join(cwd, CACHE_DIR);
|
|
6744
|
+
fs11.mkdirSync(cacheDir, { recursive: true });
|
|
6595
6745
|
const mem = process.memoryUsage();
|
|
6596
6746
|
const data = {
|
|
6597
6747
|
...metrics,
|
|
@@ -6602,7 +6752,7 @@ function writeMetrics(metrics, cwd = process.cwd()) {
|
|
|
6602
6752
|
},
|
|
6603
6753
|
generatedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
6604
6754
|
};
|
|
6605
|
-
|
|
6755
|
+
fs11.writeFileSync(path13.join(cacheDir, METRICS_FILE_NAME), JSON.stringify(data, null, 2));
|
|
6606
6756
|
} catch {
|
|
6607
6757
|
}
|
|
6608
6758
|
}
|
|
@@ -6654,6 +6804,9 @@ async function runAfterWatch(plugins, context) {
|
|
|
6654
6804
|
await plugin.afterWatch?.(context);
|
|
6655
6805
|
}
|
|
6656
6806
|
}
|
|
6807
|
+
|
|
6808
|
+
// packages/domain/engine/src/schemas.ts
|
|
6809
|
+
import { z as z5 } from "zod";
|
|
6657
6810
|
var formatIssues3 = (error) => error.issues.map((issue) => {
|
|
6658
6811
|
const p = issue.path.length > 0 ? issue.path.join(".") : "<root>";
|
|
6659
6812
|
return `${p}: ${issue.message}`;
|
|
@@ -6663,46 +6816,46 @@ var parseWithSchema3 = (schema, data, label) => {
|
|
|
6663
6816
|
if (parsed.success) return parsed.data;
|
|
6664
6817
|
throw new TypeError(`${label}: ${formatIssues3(parsed.error)}`);
|
|
6665
6818
|
};
|
|
6666
|
-
var EngineOptionsSchema =
|
|
6667
|
-
root:
|
|
6668
|
-
scanner:
|
|
6669
|
-
includeExtensions:
|
|
6670
|
-
ignoreDirectories:
|
|
6671
|
-
useCache:
|
|
6672
|
-
cacheDir:
|
|
6673
|
-
smartInvalidation:
|
|
6819
|
+
var EngineOptionsSchema = z5.object({
|
|
6820
|
+
root: z5.string().optional(),
|
|
6821
|
+
scanner: z5.object({
|
|
6822
|
+
includeExtensions: z5.array(z5.string()).optional(),
|
|
6823
|
+
ignoreDirectories: z5.array(z5.string()).optional(),
|
|
6824
|
+
useCache: z5.boolean().optional(),
|
|
6825
|
+
cacheDir: z5.string().min(1).optional(),
|
|
6826
|
+
smartInvalidation: z5.boolean().optional()
|
|
6674
6827
|
}).optional(),
|
|
6675
|
-
compileCss:
|
|
6676
|
-
tailwindConfigPath:
|
|
6677
|
-
analyze:
|
|
6678
|
-
plugins:
|
|
6828
|
+
compileCss: z5.boolean().optional(),
|
|
6829
|
+
tailwindConfigPath: z5.string().optional(),
|
|
6830
|
+
analyze: z5.boolean().optional(),
|
|
6831
|
+
plugins: z5.array(z5.custom()).optional()
|
|
6679
6832
|
});
|
|
6680
|
-
var EngineWatchOptionsSchema =
|
|
6681
|
-
debounceMs:
|
|
6682
|
-
maxEventsPerFlush:
|
|
6683
|
-
largeFileThreshold:
|
|
6833
|
+
var EngineWatchOptionsSchema = z5.object({
|
|
6834
|
+
debounceMs: z5.number().int().min(0).optional(),
|
|
6835
|
+
maxEventsPerFlush: z5.number().int().min(1).optional(),
|
|
6836
|
+
largeFileThreshold: z5.number().int().min(0).optional()
|
|
6684
6837
|
});
|
|
6685
|
-
var BuildResultSchema =
|
|
6686
|
-
scan:
|
|
6687
|
-
files:
|
|
6688
|
-
|
|
6838
|
+
var BuildResultSchema = z5.object({
|
|
6839
|
+
scan: z5.object({
|
|
6840
|
+
files: z5.array(
|
|
6841
|
+
z5.object({ file: z5.string(), classes: z5.array(z5.string()), hash: z5.string().optional() })
|
|
6689
6842
|
),
|
|
6690
|
-
totalFiles:
|
|
6691
|
-
uniqueClasses:
|
|
6843
|
+
totalFiles: z5.number().int().min(0),
|
|
6844
|
+
uniqueClasses: z5.array(z5.string())
|
|
6692
6845
|
}),
|
|
6693
|
-
mergedClassList:
|
|
6694
|
-
css:
|
|
6695
|
-
analysis:
|
|
6696
|
-
unusedClasses:
|
|
6697
|
-
classConflicts:
|
|
6698
|
-
|
|
6699
|
-
className:
|
|
6700
|
-
files:
|
|
6701
|
-
classes:
|
|
6702
|
-
message:
|
|
6846
|
+
mergedClassList: z5.string(),
|
|
6847
|
+
css: z5.string(),
|
|
6848
|
+
analysis: z5.object({
|
|
6849
|
+
unusedClasses: z5.array(z5.string()),
|
|
6850
|
+
classConflicts: z5.array(
|
|
6851
|
+
z5.object({
|
|
6852
|
+
className: z5.string(),
|
|
6853
|
+
files: z5.array(z5.string()),
|
|
6854
|
+
classes: z5.array(z5.string()).optional(),
|
|
6855
|
+
message: z5.string().optional()
|
|
6703
6856
|
})
|
|
6704
6857
|
),
|
|
6705
|
-
classUsage:
|
|
6858
|
+
classUsage: z5.record(z5.string(), z5.number())
|
|
6706
6859
|
}).optional()
|
|
6707
6860
|
});
|
|
6708
6861
|
var parseEngineOptions = (options) => parseWithSchema3(EngineOptionsSchema, options ?? {}, "engine options are invalid");
|
|
@@ -6864,6 +7017,8 @@ init_cssToIr();
|
|
|
6864
7017
|
|
|
6865
7018
|
// packages/domain/engine/src/watch-native.ts
|
|
6866
7019
|
init_src2();
|
|
7020
|
+
import { createRequire as createRequire7 } from "module";
|
|
7021
|
+
import path14 from "path";
|
|
6867
7022
|
var watchBindingState = {
|
|
6868
7023
|
binding: void 0
|
|
6869
7024
|
};
|
|
@@ -6877,27 +7032,29 @@ var getBinding = () => {
|
|
|
6877
7032
|
return watchBindingState.binding;
|
|
6878
7033
|
}
|
|
6879
7034
|
const runtimeDir = typeof __dirname === "string" ? __dirname : process.cwd();
|
|
6880
|
-
const req =
|
|
7035
|
+
const req = createRequire7(
|
|
7036
|
+
typeof __filename !== "undefined" ? `file://${__filename}` : typeof import.meta !== "undefined" && import.meta.url ? import.meta.url : "file://unknown"
|
|
7037
|
+
);
|
|
6881
7038
|
const _pa = `${process.platform}-${process.arch}`;
|
|
6882
7039
|
const _paGnu = _pa === "linux-x64" ? "linux-x64-gnu" : _pa === "linux-arm64" ? "linux-arm64-gnu" : _pa;
|
|
6883
7040
|
const candidates = [
|
|
6884
7041
|
// new binary name: tailwind-styled-native
|
|
6885
|
-
|
|
6886
|
-
|
|
7042
|
+
path14.resolve(process.cwd(), "native", "tailwind-styled-native.node"),
|
|
7043
|
+
path14.resolve(process.cwd(), "native", `tailwind-styled-native.${_pa}.node`),
|
|
6887
7044
|
// npm install case: dist/../native/
|
|
6888
|
-
|
|
6889
|
-
|
|
6890
|
-
|
|
7045
|
+
path14.resolve(runtimeDir, "..", "native", "tailwind-styled-native.node"),
|
|
7046
|
+
path14.resolve(runtimeDir, "..", "native", `tailwind-styled-native.${_pa}.node`),
|
|
7047
|
+
path14.resolve(runtimeDir, "..", "native", `tailwind-styled-native.${_paGnu}.node`),
|
|
6891
7048
|
// monorepo dev: 4-level up
|
|
6892
|
-
|
|
6893
|
-
|
|
7049
|
+
path14.resolve(runtimeDir, "..", "..", "..", "..", "native", "tailwind-styled-native.node"),
|
|
7050
|
+
path14.resolve(runtimeDir, "..", "..", "..", "..", "native", `tailwind-styled-native.${_paGnu}.node`),
|
|
6894
7051
|
// 3-level fallback
|
|
6895
|
-
|
|
7052
|
+
path14.resolve(runtimeDir, "..", "..", "..", "native", "tailwind-styled-native.node"),
|
|
6896
7053
|
// backward compat: tailwind_styled_parser
|
|
6897
|
-
|
|
6898
|
-
|
|
6899
|
-
|
|
6900
|
-
|
|
7054
|
+
path14.resolve(process.cwd(), "native", "tailwind_styled_parser.node"),
|
|
7055
|
+
path14.resolve(runtimeDir, "..", "native", "tailwind_styled_parser.node"),
|
|
7056
|
+
path14.resolve(runtimeDir, "..", "..", "..", "..", "native", "tailwind_styled_parser.node"),
|
|
7057
|
+
path14.resolve(runtimeDir, "..", "..", "..", "native", "tailwind_styled_parser.node")
|
|
6901
7058
|
];
|
|
6902
7059
|
for (const c of candidates) {
|
|
6903
7060
|
try {
|
|
@@ -6918,7 +7075,7 @@ var log6 = createLogger2("engine:watch-native");
|
|
|
6918
7075
|
function watchWorkspace2(rootDir, callback, options = {}) {
|
|
6919
7076
|
const binding = getBinding();
|
|
6920
7077
|
const pollMs = options.pollIntervalMs ?? 500;
|
|
6921
|
-
const resolvedRoot =
|
|
7078
|
+
const resolvedRoot = path14.resolve(rootDir);
|
|
6922
7079
|
const result = (() => {
|
|
6923
7080
|
try {
|
|
6924
7081
|
return binding.startWatch(resolvedRoot);
|
|
@@ -6955,7 +7112,7 @@ This package requires native Rust bindings.`
|
|
|
6955
7112
|
const deduped = /* @__PURE__ */ new Set();
|
|
6956
7113
|
const events = [];
|
|
6957
7114
|
for (const e of raw) {
|
|
6958
|
-
const absPath =
|
|
7115
|
+
const absPath = path14.isAbsolute(e.path) ? path14.normalize(e.path) : path14.resolve(resolvedRoot, e.path);
|
|
6959
7116
|
const kind = e.kind;
|
|
6960
7117
|
const key = `${kind}:${absPath}`;
|
|
6961
7118
|
if (deduped.has(key)) continue;
|
|
@@ -6995,11 +7152,11 @@ var configState = {
|
|
|
6995
7152
|
var log7 = createLogger2("engine");
|
|
6996
7153
|
async function loadTailwindConfigFromPath(root, tailwindConfigPath) {
|
|
6997
7154
|
if (!tailwindConfigPath) return void 0;
|
|
6998
|
-
const configPath =
|
|
6999
|
-
if (!
|
|
7155
|
+
const configPath = path15.resolve(root, tailwindConfigPath);
|
|
7156
|
+
if (!fs12.existsSync(configPath)) {
|
|
7000
7157
|
throw TwError.fromIo("CONFIG_NOT_FOUND", `tailwindConfigPath not found: ${configPath}`);
|
|
7001
7158
|
}
|
|
7002
|
-
const imported = await import(
|
|
7159
|
+
const imported = await import(pathToFileURL2(configPath).href);
|
|
7003
7160
|
const config = imported.default ?? imported;
|
|
7004
7161
|
return config;
|
|
7005
7162
|
}
|
|
@@ -7062,11 +7219,11 @@ async function buildFromScan(scan, root, options, tailwindConfig) {
|
|
|
7062
7219
|
};
|
|
7063
7220
|
}
|
|
7064
7221
|
function countWorkspacePackages(root) {
|
|
7065
|
-
const packagesDir =
|
|
7066
|
-
if (!
|
|
7222
|
+
const packagesDir = path15.join(root, "packages");
|
|
7223
|
+
if (!fs12.existsSync(packagesDir)) return 0;
|
|
7067
7224
|
try {
|
|
7068
|
-
return
|
|
7069
|
-
(entry) => entry.isDirectory() &&
|
|
7225
|
+
return fs12.readdirSync(packagesDir, { withFileTypes: true }).filter(
|
|
7226
|
+
(entry) => entry.isDirectory() && fs12.existsSync(path15.join(packagesDir, entry.name, "package.json"))
|
|
7070
7227
|
).length;
|
|
7071
7228
|
} catch (err) {
|
|
7072
7229
|
log7.debug(`countWorkspacePackages: ${err instanceof Error ? err.message : String(err)}`);
|
|
@@ -7103,7 +7260,7 @@ function writeDashboardMetrics(root, mode, result, metrics) {
|
|
|
7103
7260
|
async function createEngine(rawOptions = {}) {
|
|
7104
7261
|
const options = parseEngineOptions(rawOptions);
|
|
7105
7262
|
const root = options.root ?? process.cwd();
|
|
7106
|
-
const resolvedRoot =
|
|
7263
|
+
const resolvedRoot = path15.resolve(root);
|
|
7107
7264
|
const plugins = rawOptions.plugins ?? [];
|
|
7108
7265
|
const getTailwindConfig = async () => {
|
|
7109
7266
|
if (configState.isLoaded()) return configState.getConfig();
|
|
@@ -7250,7 +7407,7 @@ async function createEngine(rawOptions = {}) {
|
|
|
7250
7407
|
const shouldForceFullRescan = (event) => {
|
|
7251
7408
|
if (event.type === "unlink") return false;
|
|
7252
7409
|
try {
|
|
7253
|
-
const stat =
|
|
7410
|
+
const stat = fs12.statSync(event.filePath);
|
|
7254
7411
|
if (stat.size > largeFileThreshold) {
|
|
7255
7412
|
metrics.markSkippedLargeFile();
|
|
7256
7413
|
return true;
|
|
@@ -7368,14 +7525,14 @@ async function createEngine(rawOptions = {}) {
|
|
|
7368
7525
|
};
|
|
7369
7526
|
}
|
|
7370
7527
|
async function scanWorkspace3(opts = {}) {
|
|
7371
|
-
const root =
|
|
7528
|
+
const root = path15.resolve(opts.root ?? process.cwd());
|
|
7372
7529
|
return scanWorkspaceAsync(root, {
|
|
7373
7530
|
includeExtensions: opts.extensions,
|
|
7374
7531
|
ignoreDirectories: opts.ignoreDirectories
|
|
7375
7532
|
});
|
|
7376
7533
|
}
|
|
7377
7534
|
async function analyzeWorkspace2(opts = {}) {
|
|
7378
|
-
const root =
|
|
7535
|
+
const root = path15.resolve(opts.root ?? process.cwd());
|
|
7379
7536
|
return analyzeWorkspace(root, {
|
|
7380
7537
|
classStats: { top: opts.top ?? 20 }
|
|
7381
7538
|
});
|
|
@@ -7447,7 +7604,52 @@ async function inspectClass(className, scanResult, css = "") {
|
|
|
7447
7604
|
bundleBytes: impact.bundleSizeBytes
|
|
7448
7605
|
};
|
|
7449
7606
|
}
|
|
7450
|
-
|
|
7451
|
-
|
|
7452
|
-
|
|
7607
|
+
export {
|
|
7608
|
+
BuildResultSchema,
|
|
7609
|
+
BundleAnalyzer,
|
|
7610
|
+
CascadeResolutionId,
|
|
7611
|
+
CascadeResolver,
|
|
7612
|
+
CascadeStage,
|
|
7613
|
+
ConditionId,
|
|
7614
|
+
ConditionResult,
|
|
7615
|
+
EngineMetricsCollector,
|
|
7616
|
+
EngineOptionsSchema,
|
|
7617
|
+
EngineWatchOptionsSchema,
|
|
7618
|
+
ImpactTracker,
|
|
7619
|
+
Importance,
|
|
7620
|
+
LayerId,
|
|
7621
|
+
Origin,
|
|
7622
|
+
PropertyId,
|
|
7623
|
+
ReverseLookup,
|
|
7624
|
+
RuleId,
|
|
7625
|
+
SelectorId,
|
|
7626
|
+
ValueId,
|
|
7627
|
+
VariantChainId,
|
|
7628
|
+
analyzeWorkspace2 as analyzeWorkspace,
|
|
7629
|
+
applyIncrementalChange,
|
|
7630
|
+
build,
|
|
7631
|
+
buildProvenanceChain,
|
|
7632
|
+
createEngine,
|
|
7633
|
+
createFingerprint2 as createFingerprint,
|
|
7634
|
+
createResolutionReason,
|
|
7635
|
+
generateSafelist2 as generateSafelist,
|
|
7636
|
+
inspectClass,
|
|
7637
|
+
parseCssToIr,
|
|
7638
|
+
parseEngineOptions,
|
|
7639
|
+
parseEngineWatchOptions,
|
|
7640
|
+
runAfterBuild,
|
|
7641
|
+
runAfterScan,
|
|
7642
|
+
runAfterWatch,
|
|
7643
|
+
runBeforeBuild,
|
|
7644
|
+
runBeforeScan,
|
|
7645
|
+
runBeforeWatch,
|
|
7646
|
+
runOnError,
|
|
7647
|
+
runTransformClasses,
|
|
7648
|
+
scanWorkspace3 as scanWorkspace,
|
|
7649
|
+
trace,
|
|
7650
|
+
traceClass,
|
|
7651
|
+
traceClasses,
|
|
7652
|
+
watchWorkspace as watchWorkspaceLegacy,
|
|
7653
|
+
watchWorkspace2 as watchWorkspaceNative
|
|
7654
|
+
};
|
|
7453
7655
|
//# sourceMappingURL=engine.mjs.map
|