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/shared.mjs
CHANGED
|
@@ -1,12 +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 path from 'path';
|
|
6
|
-
import path__default from 'path';
|
|
7
|
-
import { createHash } from 'crypto';
|
|
8
|
-
import { fileURLToPath } from 'url';
|
|
9
|
-
|
|
10
1
|
/* tailwind-styled-v4 v5.0.4 | MIT | https://github.com/dictionar32/tailwind-styled-v4 */
|
|
11
2
|
var __defProp = Object.defineProperty;
|
|
12
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
@@ -127,6 +118,7 @@ function getPipelinePercentages(metrics) {
|
|
|
127
118
|
}
|
|
128
119
|
var init_trace = __esm({
|
|
129
120
|
"packages/domain/shared/src/trace.ts"() {
|
|
121
|
+
"use strict";
|
|
130
122
|
}
|
|
131
123
|
});
|
|
132
124
|
|
|
@@ -141,6 +133,7 @@ function formatErrorCode(code) {
|
|
|
141
133
|
var ERROR_CODES, ERROR_SUGGESTIONS;
|
|
142
134
|
var init_error_codes = __esm({
|
|
143
135
|
"packages/domain/shared/src/error-codes.ts"() {
|
|
136
|
+
"use strict";
|
|
144
137
|
ERROR_CODES = {
|
|
145
138
|
// E0xx — Native binding
|
|
146
139
|
NATIVE_NOT_FOUND: "E001",
|
|
@@ -207,8 +200,12 @@ function isTailwindV4() {
|
|
|
207
200
|
}
|
|
208
201
|
var init_compatibility = __esm({
|
|
209
202
|
"packages/domain/shared/src/compatibility.ts"() {
|
|
203
|
+
"use strict";
|
|
210
204
|
}
|
|
211
205
|
});
|
|
206
|
+
|
|
207
|
+
// packages/domain/shared/src/native-schemas.ts
|
|
208
|
+
import { z } from "zod";
|
|
212
209
|
function safeParseNative(schema, data, fallback) {
|
|
213
210
|
const result = schema.safeParse(data);
|
|
214
211
|
return result.success ? result.data : fallback;
|
|
@@ -224,9 +221,10 @@ function parseNative(schema, data, context) {
|
|
|
224
221
|
}
|
|
225
222
|
return result.data;
|
|
226
223
|
}
|
|
227
|
-
var NativeScanFileSchema, NativeScanResultSchema, NativeClassUsageSchema, NativeAnalyzerReportSchema, NativeTransformResultSchema, NativeCssCompileResultSchema, NativeWatchResultSchema, NativeCacheEntrySchema, NativeCacheReadResultSchema;
|
|
224
|
+
var NativeScanFileSchema, NativeScanResultSchema, NativeClassUsageSchema, NativeAnalyzerReportSchema, NativeTransformResultSchema, NativeCssCompileResultSchema, NativeWatchEventSchema, NativeWatchResultSchema, NativeCacheEntrySchema, NativeCacheReadResultSchema;
|
|
228
225
|
var init_native_schemas = __esm({
|
|
229
226
|
"packages/domain/shared/src/native-schemas.ts"() {
|
|
227
|
+
"use strict";
|
|
230
228
|
NativeScanFileSchema = z.object({
|
|
231
229
|
file: z.string().min(1, "file path cannot be empty"),
|
|
232
230
|
classes: z.array(z.string()),
|
|
@@ -266,7 +264,7 @@ var init_native_schemas = __esm({
|
|
|
266
264
|
resolvedClasses: z.array(z.string()),
|
|
267
265
|
unresolvedClasses: z.array(z.string()).optional()
|
|
268
266
|
});
|
|
269
|
-
z.object({
|
|
267
|
+
NativeWatchEventSchema = z.object({
|
|
270
268
|
type: z.enum(["change", "unlink", "create"]),
|
|
271
269
|
path: z.string()
|
|
272
270
|
});
|
|
@@ -302,48 +300,78 @@ function getNodeModuleRef() {
|
|
|
302
300
|
return null;
|
|
303
301
|
}
|
|
304
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
|
+
}
|
|
305
312
|
function getNodePath() {
|
|
306
313
|
if (isBrowser) throw new Error("node:path not available in browser");
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
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
|
+
}
|
|
310
323
|
return _nodePath;
|
|
311
324
|
}
|
|
312
325
|
function getNodeUrl() {
|
|
313
326
|
if (isBrowser) throw new Error("node:url not available in browser");
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
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
|
+
}
|
|
317
336
|
return _nodeUrl;
|
|
318
337
|
}
|
|
319
338
|
function getNodeFs() {
|
|
320
339
|
if (isBrowser) throw new Error("node:fs not available in browser");
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
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
|
+
}
|
|
324
349
|
return _nodeFs;
|
|
325
350
|
}
|
|
326
351
|
function createEsmRequire(importMetaUrl) {
|
|
327
352
|
if (isBrowser) throw new Error("require not available in browser");
|
|
353
|
+
if (typeof __require === "function") return __require;
|
|
328
354
|
const nodeRequire = getNodeModuleRef();
|
|
329
355
|
if (!nodeRequire) throw new Error("require not available");
|
|
330
356
|
return nodeRequire.createRequire(importMetaUrl);
|
|
331
357
|
}
|
|
332
358
|
function getDirname(importMetaUrl) {
|
|
333
359
|
if (isBrowser) return "";
|
|
360
|
+
if (typeof __dirname !== "undefined") return __dirname;
|
|
334
361
|
const nodePath = getNodePath();
|
|
335
362
|
const nodeUrl = getNodeUrl();
|
|
336
363
|
return nodePath.dirname(nodeUrl.fileURLToPath(importMetaUrl));
|
|
337
364
|
}
|
|
338
365
|
function getFilename(importMetaUrl) {
|
|
339
366
|
if (isBrowser) return "";
|
|
367
|
+
if (typeof __filename !== "undefined") return __filename;
|
|
340
368
|
return getNodeUrl().fileURLToPath(importMetaUrl);
|
|
341
369
|
}
|
|
342
370
|
function resolveFromRoot(...segments) {
|
|
343
371
|
if (isBrowser) return segments.join("/");
|
|
344
372
|
const nodePath = getNodePath();
|
|
345
373
|
const nodeFs = getNodeFs();
|
|
346
|
-
let dir = getDirname(
|
|
374
|
+
let dir = typeof __dirname !== "undefined" ? __dirname : getDirname(getCurrentFileUrl());
|
|
347
375
|
for (let i = 0; i < 10; i++) {
|
|
348
376
|
const pkgPath = nodePath.join(dir, "package.json");
|
|
349
377
|
try {
|
|
@@ -372,6 +400,7 @@ function resolveNativeNodePath(importMetaUrl, ...relativeSegments) {
|
|
|
372
400
|
var isBrowser, nodeModuleRef, _nodePath, _nodeUrl, _nodeFs;
|
|
373
401
|
var init_esmHelpers = __esm({
|
|
374
402
|
"packages/domain/shared/src/esmHelpers.ts"() {
|
|
403
|
+
"use strict";
|
|
375
404
|
isBrowser = typeof window !== "undefined" || typeof document !== "undefined";
|
|
376
405
|
nodeModuleRef = null;
|
|
377
406
|
_nodePath = null;
|
|
@@ -422,6 +451,7 @@ function createBuildTimer() {
|
|
|
422
451
|
var RING_BUFFER_SIZE, TelemetryCollector, _globalCollector;
|
|
423
452
|
var init_telemetry = __esm({
|
|
424
453
|
"packages/domain/shared/src/telemetry.ts"() {
|
|
454
|
+
"use strict";
|
|
425
455
|
RING_BUFFER_SIZE = 100;
|
|
426
456
|
TelemetryCollector = class {
|
|
427
457
|
data = [];
|
|
@@ -488,6 +518,9 @@ var init_telemetry = __esm({
|
|
|
488
518
|
_globalCollector = null;
|
|
489
519
|
}
|
|
490
520
|
});
|
|
521
|
+
|
|
522
|
+
// packages/domain/shared/src/configSchemas.ts
|
|
523
|
+
import { z as z2 } from "zod";
|
|
491
524
|
function parseJsonWithSchema(jsonString, schema, sourceName) {
|
|
492
525
|
let parsed;
|
|
493
526
|
try {
|
|
@@ -521,67 +554,68 @@ function parseJsonFileWithSchema(filePath, schema) {
|
|
|
521
554
|
var ScanCacheClassEntrySchema, ScanCacheSchema, TailwindContentItemSchema, TailwindConfigSchema, RegistryPluginEntrySchema, RegistryFileSchema, PackageJsonSchema;
|
|
522
555
|
var init_configSchemas = __esm({
|
|
523
556
|
"packages/domain/shared/src/configSchemas.ts"() {
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
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([])
|
|
530
564
|
});
|
|
531
|
-
ScanCacheSchema =
|
|
532
|
-
version:
|
|
533
|
-
generatedAt:
|
|
534
|
-
root:
|
|
535
|
-
classNames:
|
|
536
|
-
totalFiles:
|
|
537
|
-
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()
|
|
538
572
|
});
|
|
539
|
-
TailwindContentItemSchema =
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
raw:
|
|
543
|
-
extension:
|
|
573
|
+
TailwindContentItemSchema = z2.union([
|
|
574
|
+
z2.string(),
|
|
575
|
+
z2.object({
|
|
576
|
+
raw: z2.string(),
|
|
577
|
+
extension: z2.string().optional()
|
|
544
578
|
}),
|
|
545
|
-
|
|
546
|
-
files:
|
|
547
|
-
transform:
|
|
579
|
+
z2.object({
|
|
580
|
+
files: z2.array(z2.string()),
|
|
581
|
+
transform: z2.record(z2.string(), z2.unknown()).optional()
|
|
548
582
|
})
|
|
549
583
|
]);
|
|
550
|
-
TailwindConfigSchema =
|
|
551
|
-
content:
|
|
552
|
-
theme:
|
|
553
|
-
plugins:
|
|
554
|
-
darkMode:
|
|
555
|
-
prefix:
|
|
556
|
-
safelist:
|
|
557
|
-
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()
|
|
558
592
|
}).passthrough();
|
|
559
|
-
RegistryPluginEntrySchema =
|
|
560
|
-
name:
|
|
561
|
-
description:
|
|
562
|
-
version:
|
|
563
|
-
tags:
|
|
564
|
-
official:
|
|
565
|
-
docs:
|
|
566
|
-
install:
|
|
567
|
-
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()
|
|
568
602
|
});
|
|
569
|
-
RegistryFileSchema =
|
|
570
|
-
version:
|
|
571
|
-
official:
|
|
572
|
-
community:
|
|
603
|
+
RegistryFileSchema = z2.object({
|
|
604
|
+
version: z2.string(),
|
|
605
|
+
official: z2.array(RegistryPluginEntrySchema).default([]),
|
|
606
|
+
community: z2.array(RegistryPluginEntrySchema).default([])
|
|
573
607
|
});
|
|
574
|
-
PackageJsonSchema =
|
|
575
|
-
name:
|
|
576
|
-
version:
|
|
577
|
-
scripts:
|
|
578
|
-
dependencies:
|
|
579
|
-
devDependencies:
|
|
580
|
-
peerDependencies:
|
|
581
|
-
main:
|
|
582
|
-
module:
|
|
583
|
-
exports:
|
|
584
|
-
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()
|
|
585
619
|
}).passthrough();
|
|
586
620
|
}
|
|
587
621
|
});
|
|
@@ -669,6 +703,7 @@ function resolveLoaderPath(loaderBasename, importMetaUrl) {
|
|
|
669
703
|
var isBrowser2, NODE_URL, NODE_FS, NODE_PATH;
|
|
670
704
|
var init_workerResolver = __esm({
|
|
671
705
|
"packages/domain/shared/src/workerResolver.ts"() {
|
|
706
|
+
"use strict";
|
|
672
707
|
isBrowser2 = typeof window !== "undefined" || typeof document !== "undefined";
|
|
673
708
|
NODE_URL = typeof window === "undefined" || typeof document === "undefined" ? "node:url" : null;
|
|
674
709
|
NODE_FS = typeof window === "undefined" || typeof document === "undefined" ? "node:fs" : null;
|
|
@@ -818,13 +853,13 @@ function generateClassRenameCodemod(renames, opts = {}) {
|
|
|
818
853
|
}
|
|
819
854
|
return lines.join("\n");
|
|
820
855
|
}
|
|
821
|
-
function generateBarrelFile(exports
|
|
856
|
+
function generateBarrelFile(exports, dir, opts = {}) {
|
|
822
857
|
const { includeTypes = true } = opts;
|
|
823
858
|
const lines = [];
|
|
824
859
|
lines.push(`// Auto-generated barrel file for ${dir}`);
|
|
825
860
|
lines.push(`// Run: npx tsx scripts/generate-barrel.ts to regenerate`);
|
|
826
861
|
lines.push(``);
|
|
827
|
-
for (const name of exports
|
|
862
|
+
for (const name of exports) {
|
|
828
863
|
lines.push(`export { default as ${name}, type ${name}Props } from "./${name}"`);
|
|
829
864
|
if (includeTypes) {
|
|
830
865
|
lines.push(`export type * from "./${name}"`);
|
|
@@ -834,8 +869,14 @@ function generateBarrelFile(exports$1, dir, opts = {}) {
|
|
|
834
869
|
}
|
|
835
870
|
var init_codegen = __esm({
|
|
836
871
|
"packages/domain/shared/src/codegen.ts"() {
|
|
872
|
+
"use strict";
|
|
837
873
|
}
|
|
838
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";
|
|
839
880
|
function platformKey() {
|
|
840
881
|
if (isBrowser3) return "browser";
|
|
841
882
|
return `${process.platform}-${process.arch}`;
|
|
@@ -851,7 +892,7 @@ function resolveNativeBinary(runtimeDir) {
|
|
|
851
892
|
}
|
|
852
893
|
const envPath = process.env.TW_NATIVE_PATH?.trim();
|
|
853
894
|
if (envPath) {
|
|
854
|
-
if (
|
|
895
|
+
if (fs.existsSync(envPath)) {
|
|
855
896
|
return { path: envPath, source: "env", platform, tried };
|
|
856
897
|
}
|
|
857
898
|
tried.push(`env:${envPath} (not found)`);
|
|
@@ -860,7 +901,7 @@ function resolveNativeBinary(runtimeDir) {
|
|
|
860
901
|
for (const pkg of prebuiltPkgs) {
|
|
861
902
|
try {
|
|
862
903
|
const candidate = _require.resolve(`${pkg}/tailwind_styled_parser.node`);
|
|
863
|
-
if (
|
|
904
|
+
if (fs.existsSync(candidate)) {
|
|
864
905
|
return { path: candidate, source: "prebuilt", platform, tried };
|
|
865
906
|
}
|
|
866
907
|
tried.push(`prebuilt:${pkg} (resolved but missing)`);
|
|
@@ -877,7 +918,7 @@ function resolveNativeBinary(runtimeDir) {
|
|
|
877
918
|
for (const suffix of ["", `.${platform}`, `.${napiPlatform}`]) {
|
|
878
919
|
const candidate = path.resolve(pkgRoot, "native", `${bin}${suffix}.node`);
|
|
879
920
|
tried.push(`self-bundled:${candidate}`);
|
|
880
|
-
if (
|
|
921
|
+
if (fs.existsSync(candidate)) {
|
|
881
922
|
return { path: candidate, source: "prebuilt", platform, tried };
|
|
882
923
|
}
|
|
883
924
|
}
|
|
@@ -911,7 +952,7 @@ function resolveNativeBinary(runtimeDir) {
|
|
|
911
952
|
}
|
|
912
953
|
for (const candidate of localCandidates) {
|
|
913
954
|
tried.push(`local:${candidate}`);
|
|
914
|
-
if (
|
|
955
|
+
if (fs.existsSync(candidate)) {
|
|
915
956
|
return { path: candidate, source: "local", platform, tried };
|
|
916
957
|
}
|
|
917
958
|
}
|
|
@@ -934,8 +975,11 @@ function formatNativeNotFoundError(result) {
|
|
|
934
975
|
var isBrowser3, _require, PLATFORM_MAP;
|
|
935
976
|
var init_native_resolution = __esm({
|
|
936
977
|
"packages/domain/shared/src/native-resolution.ts"() {
|
|
978
|
+
"use strict";
|
|
937
979
|
isBrowser3 = typeof window !== "undefined" || typeof document !== "undefined";
|
|
938
|
-
_require =
|
|
980
|
+
_require = createRequire(
|
|
981
|
+
typeof __require !== "undefined" ? typeof __filename !== "undefined" ? `file://${__filename}` : "file://unknown" : import.meta.url
|
|
982
|
+
);
|
|
939
983
|
PLATFORM_MAP = {
|
|
940
984
|
"linux-x64": ["@tailwind-styled/native-linux-x64-gnu", "@tailwind-styled/native-linux-x64"],
|
|
941
985
|
"linux-arm64": ["@tailwind-styled/native-linux-arm64-gnu", "@tailwind-styled/native-linux-arm64"],
|
|
@@ -981,6 +1025,7 @@ function createObservabilityClient(opts = {}) {
|
|
|
981
1025
|
}
|
|
982
1026
|
var init_observability = __esm({
|
|
983
1027
|
"packages/domain/shared/src/observability.ts"() {
|
|
1028
|
+
"use strict";
|
|
984
1029
|
}
|
|
985
1030
|
});
|
|
986
1031
|
|
|
@@ -988,6 +1033,7 @@ var init_observability = __esm({
|
|
|
988
1033
|
var _loadNative, log, NATIVE_UNAVAILABLE_MESSAGE, nativeBridge, bridgeLoadAttempted, bridgeLoadError, isValidNativeBridge, getNativeBridge, adaptNativeResult;
|
|
989
1034
|
var init_nativeBridge = __esm({
|
|
990
1035
|
"packages/domain/compiler/src/nativeBridge.ts"() {
|
|
1036
|
+
"use strict";
|
|
991
1037
|
init_src2();
|
|
992
1038
|
_loadNative = (path6) => __require(path6);
|
|
993
1039
|
log = (...args) => {
|
|
@@ -1127,6 +1173,7 @@ function resetCacheStats() {
|
|
|
1127
1173
|
}
|
|
1128
1174
|
var init_cssGeneratorNative = __esm({
|
|
1129
1175
|
"packages/domain/compiler/src/compiler/cssGeneratorNative.ts"() {
|
|
1176
|
+
"use strict";
|
|
1130
1177
|
init_nativeBridge();
|
|
1131
1178
|
}
|
|
1132
1179
|
});
|
|
@@ -1199,6 +1246,7 @@ function atomicRegistrySize() {
|
|
|
1199
1246
|
}
|
|
1200
1247
|
var init_compilationNative = __esm({
|
|
1201
1248
|
"packages/domain/compiler/src/compiler/compilationNative.ts"() {
|
|
1249
|
+
"use strict";
|
|
1202
1250
|
init_nativeBridge();
|
|
1203
1251
|
}
|
|
1204
1252
|
});
|
|
@@ -1342,6 +1390,7 @@ function twMergeRaw(classLists) {
|
|
|
1342
1390
|
}
|
|
1343
1391
|
var init_cssCompilationNative = __esm({
|
|
1344
1392
|
"packages/domain/compiler/src/compiler/cssCompilationNative.ts"() {
|
|
1393
|
+
"use strict";
|
|
1345
1394
|
init_nativeBridge();
|
|
1346
1395
|
}
|
|
1347
1396
|
});
|
|
@@ -1441,6 +1490,7 @@ function idRegistryImport(importedData) {
|
|
|
1441
1490
|
}
|
|
1442
1491
|
var init_idRegistryNative = __esm({
|
|
1443
1492
|
"packages/domain/compiler/src/compiler/idRegistryNative.ts"() {
|
|
1493
|
+
"use strict";
|
|
1444
1494
|
init_nativeBridge();
|
|
1445
1495
|
}
|
|
1446
1496
|
});
|
|
@@ -1582,9 +1632,13 @@ function scanFilesBatchNative(filesJson) {
|
|
|
1582
1632
|
}
|
|
1583
1633
|
var init_streamingNative = __esm({
|
|
1584
1634
|
"packages/domain/compiler/src/compiler/streamingNative.ts"() {
|
|
1635
|
+
"use strict";
|
|
1585
1636
|
init_nativeBridge();
|
|
1586
1637
|
}
|
|
1587
1638
|
});
|
|
1639
|
+
|
|
1640
|
+
// packages/domain/compiler/src/tailwindEngine.ts
|
|
1641
|
+
import { createRequire as createRequire2 } from "module";
|
|
1588
1642
|
function loadTailwindEngine() {
|
|
1589
1643
|
if (_twEngine) return _twEngine;
|
|
1590
1644
|
if (_twEngineError) throw _twEngineError;
|
|
@@ -1604,10 +1658,10 @@ async function generateRawCss(classes, cssEntryContent, root) {
|
|
|
1604
1658
|
if (classes.length === 0) return "";
|
|
1605
1659
|
const tw = loadTailwindEngine();
|
|
1606
1660
|
const input = cssEntryContent ?? "@import 'tailwindcss';";
|
|
1607
|
-
const { readFileSync, existsSync: existsSync3 } = await import(
|
|
1608
|
-
const { dirname, resolve: resolve2 } = await import(
|
|
1661
|
+
const { readFileSync, existsSync: existsSync3 } = await import("fs");
|
|
1662
|
+
const { dirname, resolve: resolve2 } = await import("path");
|
|
1609
1663
|
const projectRoot = root ?? process.cwd();
|
|
1610
|
-
const req =
|
|
1664
|
+
const req = createRequire2(resolve2(projectRoot, "package.json"));
|
|
1611
1665
|
const loadStylesheet = async (id, base) => {
|
|
1612
1666
|
try {
|
|
1613
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;
|
|
@@ -1627,10 +1681,14 @@ async function generateRawCss(classes, cssEntryContent, root) {
|
|
|
1627
1681
|
const compiler = await Promise.resolve(tw.compile(input, { loadStylesheet }));
|
|
1628
1682
|
return compiler.build(classes);
|
|
1629
1683
|
}
|
|
1630
|
-
var require2, _twEngine, _twEngineError;
|
|
1684
|
+
var require2, MAX_CACHE_MEMORY, _twEngine, _twEngineError;
|
|
1631
1685
|
var init_tailwindEngine = __esm({
|
|
1632
1686
|
"packages/domain/compiler/src/tailwindEngine.ts"() {
|
|
1633
|
-
|
|
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;
|
|
1634
1692
|
_twEngine = null;
|
|
1635
1693
|
_twEngineError = null;
|
|
1636
1694
|
}
|
|
@@ -1645,6 +1703,7 @@ __export(tailwindEngine_exports, {
|
|
|
1645
1703
|
runCssPipeline: () => runCssPipeline,
|
|
1646
1704
|
runCssPipelineSync: () => runCssPipelineSync
|
|
1647
1705
|
});
|
|
1706
|
+
import { createRequire as createRequire3 } from "module";
|
|
1648
1707
|
function _getCacheKey(classes, minify, cssEntry, root) {
|
|
1649
1708
|
const sorted = [...classes].sort().join(",");
|
|
1650
1709
|
const flags = `${minify ? "1" : "0"}${cssEntry ? "1" : "0"}${root ? "1" : "0"}`;
|
|
@@ -1811,24 +1870,29 @@ function processTailwindCssWithTargets(css, targets) {
|
|
|
1811
1870
|
}
|
|
1812
1871
|
return result.css;
|
|
1813
1872
|
}
|
|
1814
|
-
var _cssCache, _cacheHits, _cacheMisses, MAX_CACHE_SIZE;
|
|
1873
|
+
var require3, _cssCache, _cacheHits, _cacheMisses, MAX_CACHE_SIZE, MAX_CACHE_MEMORY2;
|
|
1815
1874
|
var init_tailwindEngine2 = __esm({
|
|
1816
1875
|
"packages/domain/compiler/src/compiler/tailwindEngine.ts"() {
|
|
1876
|
+
"use strict";
|
|
1817
1877
|
init_nativeBridge();
|
|
1818
1878
|
init_cssGeneratorNative();
|
|
1819
1879
|
init_cssCompilationNative();
|
|
1820
1880
|
init_tailwindEngine();
|
|
1821
|
-
|
|
1881
|
+
require3 = createRequire3(
|
|
1882
|
+
typeof __filename !== "undefined" ? `file://${__filename}` : typeof import.meta !== "undefined" && import.meta.url ? import.meta.url : "file://unknown"
|
|
1883
|
+
);
|
|
1822
1884
|
_cssCache = /* @__PURE__ */ new Map();
|
|
1823
1885
|
_cacheHits = 0;
|
|
1824
1886
|
_cacheMisses = 0;
|
|
1825
1887
|
MAX_CACHE_SIZE = 100;
|
|
1888
|
+
MAX_CACHE_MEMORY2 = 256 * 1024;
|
|
1826
1889
|
}
|
|
1827
1890
|
});
|
|
1828
1891
|
|
|
1829
1892
|
// packages/domain/compiler/src/compiler/index.ts
|
|
1830
1893
|
var init_compiler = __esm({
|
|
1831
1894
|
"packages/domain/compiler/src/compiler/index.ts"() {
|
|
1895
|
+
"use strict";
|
|
1832
1896
|
init_cssGeneratorNative();
|
|
1833
1897
|
init_compilationNative();
|
|
1834
1898
|
init_cssCompilationNative();
|
|
@@ -1841,6 +1905,7 @@ var init_compiler = __esm({
|
|
|
1841
1905
|
var parseClasses, parseClass, extractAllClasses, extractClassesFromSource, astExtractClasses, normalizeClasses, mergeClassesStatic, normalizeAndDedupClasses, extractComponentUsage, batchExtractClasses, checkAgainstSafelist, diffClassLists;
|
|
1842
1906
|
var init_parser = __esm({
|
|
1843
1907
|
"packages/domain/compiler/src/parser/index.ts"() {
|
|
1908
|
+
"use strict";
|
|
1844
1909
|
init_nativeBridge();
|
|
1845
1910
|
parseClasses = (raw) => {
|
|
1846
1911
|
const native = getNativeBridge();
|
|
@@ -2019,6 +2084,7 @@ function resetMemoryStats() {
|
|
|
2019
2084
|
}
|
|
2020
2085
|
var init_analyzerNative = __esm({
|
|
2021
2086
|
"packages/domain/compiler/src/analyzer/analyzerNative.ts"() {
|
|
2087
|
+
"use strict";
|
|
2022
2088
|
init_nativeBridge();
|
|
2023
2089
|
}
|
|
2024
2090
|
});
|
|
@@ -2112,6 +2178,7 @@ function resolveSimpleVariants(configJson) {
|
|
|
2112
2178
|
}
|
|
2113
2179
|
var init_themeResolutionNative = __esm({
|
|
2114
2180
|
"packages/domain/compiler/src/analyzer/themeResolutionNative.ts"() {
|
|
2181
|
+
"use strict";
|
|
2115
2182
|
init_nativeBridge();
|
|
2116
2183
|
}
|
|
2117
2184
|
});
|
|
@@ -2159,6 +2226,7 @@ function generateSubComponentTypes(root, outputPath) {
|
|
|
2159
2226
|
}
|
|
2160
2227
|
var init_scannerNative = __esm({
|
|
2161
2228
|
"packages/domain/compiler/src/analyzer/scannerNative.ts"() {
|
|
2229
|
+
"use strict";
|
|
2162
2230
|
init_nativeBridge();
|
|
2163
2231
|
}
|
|
2164
2232
|
});
|
|
@@ -2166,6 +2234,7 @@ var init_scannerNative = __esm({
|
|
|
2166
2234
|
// packages/domain/compiler/src/analyzer/index.ts
|
|
2167
2235
|
var init_analyzer = __esm({
|
|
2168
2236
|
"packages/domain/compiler/src/analyzer/index.ts"() {
|
|
2237
|
+
"use strict";
|
|
2169
2238
|
init_analyzerNative();
|
|
2170
2239
|
init_themeResolutionNative();
|
|
2171
2240
|
init_scannerNative();
|
|
@@ -2354,6 +2423,7 @@ function resetResolverPoolStats() {
|
|
|
2354
2423
|
}
|
|
2355
2424
|
var init_cacheNative = __esm({
|
|
2356
2425
|
"packages/domain/compiler/src/cache/cacheNative.ts"() {
|
|
2426
|
+
"use strict";
|
|
2357
2427
|
init_nativeBridge();
|
|
2358
2428
|
}
|
|
2359
2429
|
});
|
|
@@ -2361,6 +2431,7 @@ var init_cacheNative = __esm({
|
|
|
2361
2431
|
// packages/domain/compiler/src/cache/index.ts
|
|
2362
2432
|
var init_cache = __esm({
|
|
2363
2433
|
"packages/domain/compiler/src/cache/index.ts"() {
|
|
2434
|
+
"use strict";
|
|
2364
2435
|
init_cacheNative();
|
|
2365
2436
|
}
|
|
2366
2437
|
});
|
|
@@ -2609,6 +2680,7 @@ function redisDiagnose() {
|
|
|
2609
2680
|
}
|
|
2610
2681
|
var init_redisNative = __esm({
|
|
2611
2682
|
"packages/domain/compiler/src/redis/redisNative.ts"() {
|
|
2683
|
+
"use strict";
|
|
2612
2684
|
init_nativeBridge();
|
|
2613
2685
|
}
|
|
2614
2686
|
});
|
|
@@ -2616,6 +2688,7 @@ var init_redisNative = __esm({
|
|
|
2616
2688
|
// packages/domain/compiler/src/redis/index.ts
|
|
2617
2689
|
var init_redis = __esm({
|
|
2618
2690
|
"packages/domain/compiler/src/redis/index.ts"() {
|
|
2691
|
+
"use strict";
|
|
2619
2692
|
init_redisNative();
|
|
2620
2693
|
}
|
|
2621
2694
|
});
|
|
@@ -2754,6 +2827,7 @@ function getCompilerDiagnostics() {
|
|
|
2754
2827
|
}
|
|
2755
2828
|
var init_watchSystemNative = __esm({
|
|
2756
2829
|
"packages/domain/compiler/src/watch/watchSystemNative.ts"() {
|
|
2830
|
+
"use strict";
|
|
2757
2831
|
init_nativeBridge();
|
|
2758
2832
|
}
|
|
2759
2833
|
});
|
|
@@ -2761,9 +2835,15 @@ var init_watchSystemNative = __esm({
|
|
|
2761
2835
|
// packages/domain/compiler/src/watch/index.ts
|
|
2762
2836
|
var init_watch = __esm({
|
|
2763
2837
|
"packages/domain/compiler/src/watch/index.ts"() {
|
|
2838
|
+
"use strict";
|
|
2764
2839
|
init_watchSystemNative();
|
|
2765
2840
|
}
|
|
2766
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";
|
|
2767
2847
|
function _layoutClassesToCss(classes) {
|
|
2768
2848
|
const native = getNativeBridge();
|
|
2769
2849
|
if (!native?.layoutClassesToCss) {
|
|
@@ -2801,6 +2881,7 @@ function extractContainerCssFromSource(source) {
|
|
|
2801
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;
|
|
2802
2882
|
var init_src = __esm({
|
|
2803
2883
|
"packages/domain/compiler/src/index.ts"() {
|
|
2884
|
+
"use strict";
|
|
2804
2885
|
init_nativeBridge();
|
|
2805
2886
|
init_compiler();
|
|
2806
2887
|
init_parser();
|
|
@@ -2808,7 +2889,9 @@ var init_src = __esm({
|
|
|
2808
2889
|
init_cache();
|
|
2809
2890
|
init_redis();
|
|
2810
2891
|
init_watch();
|
|
2811
|
-
_require2 =
|
|
2892
|
+
_require2 = createRequire4(
|
|
2893
|
+
typeof __require !== "undefined" ? typeof __filename !== "undefined" ? `file://${__filename}` : "file://unknown" : import.meta.url
|
|
2894
|
+
);
|
|
2812
2895
|
transformSource = (source, opts) => {
|
|
2813
2896
|
const native = getNativeBridge();
|
|
2814
2897
|
if (!native?.transformSource) {
|
|
@@ -2900,7 +2983,7 @@ var init_src = __esm({
|
|
|
2900
2983
|
};
|
|
2901
2984
|
scanProjectUsage = (dirs, cwd) => {
|
|
2902
2985
|
const { batchExtractClasses: batchExtractClasses2 } = _require2("./parser");
|
|
2903
|
-
const files = dirs.map((dir) =>
|
|
2986
|
+
const files = dirs.map((dir) => path2.resolve(cwd, dir));
|
|
2904
2987
|
const results = batchExtractClasses2(files) || [];
|
|
2905
2988
|
const combined = {};
|
|
2906
2989
|
for (const result of results) {
|
|
@@ -2917,13 +3000,13 @@ var init_src = __esm({
|
|
|
2917
3000
|
const classes = scanProjectUsage(scanDirs, cwd || process.cwd());
|
|
2918
3001
|
const allClasses = Object.keys(classes).sort();
|
|
2919
3002
|
if (outputPath) {
|
|
2920
|
-
|
|
3003
|
+
fs2.writeFileSync(outputPath, JSON.stringify(allClasses, null, 2));
|
|
2921
3004
|
}
|
|
2922
3005
|
return allClasses;
|
|
2923
3006
|
};
|
|
2924
3007
|
loadSafelist = (safelistPath) => {
|
|
2925
3008
|
try {
|
|
2926
|
-
const content =
|
|
3009
|
+
const content = fs2.readFileSync(safelistPath, "utf-8");
|
|
2927
3010
|
return JSON.parse(content);
|
|
2928
3011
|
} catch {
|
|
2929
3012
|
return [];
|
|
@@ -2937,8 +3020,8 @@ var init_src = __esm({
|
|
|
2937
3020
|
"tailwind.config.cjs"
|
|
2938
3021
|
];
|
|
2939
3022
|
for (const file of configFiles) {
|
|
2940
|
-
const fullPath =
|
|
2941
|
-
if (
|
|
3023
|
+
const fullPath = path2.join(cwd, file);
|
|
3024
|
+
if (fs2.existsSync(fullPath)) {
|
|
2942
3025
|
const mod = __require(fullPath);
|
|
2943
3026
|
return mod.default || mod;
|
|
2944
3027
|
}
|
|
@@ -2948,9 +3031,9 @@ var init_src = __esm({
|
|
|
2948
3031
|
getContentPaths = (cwd = process.cwd()) => {
|
|
2949
3032
|
return {
|
|
2950
3033
|
content: [
|
|
2951
|
-
|
|
2952
|
-
|
|
2953
|
-
|
|
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}")
|
|
2954
3037
|
]
|
|
2955
3038
|
};
|
|
2956
3039
|
};
|
|
@@ -3364,6 +3447,7 @@ __export(internal_exports, {
|
|
|
3364
3447
|
});
|
|
3365
3448
|
var init_internal = __esm({
|
|
3366
3449
|
"packages/domain/compiler/src/internal.ts"() {
|
|
3450
|
+
"use strict";
|
|
3367
3451
|
init_src();
|
|
3368
3452
|
init_tailwindEngine2();
|
|
3369
3453
|
init_compiler();
|
|
@@ -3374,6 +3458,10 @@ var init_internal = __esm({
|
|
|
3374
3458
|
init_watch();
|
|
3375
3459
|
}
|
|
3376
3460
|
});
|
|
3461
|
+
|
|
3462
|
+
// packages/domain/shared/src/staticStateExtractor.ts
|
|
3463
|
+
import fs3 from "fs";
|
|
3464
|
+
import path3 from "path";
|
|
3377
3465
|
function getNative() {
|
|
3378
3466
|
if (_native) return _native;
|
|
3379
3467
|
try {
|
|
@@ -3403,17 +3491,17 @@ function getNative() {
|
|
|
3403
3491
|
function* walkSourceFiles(dir) {
|
|
3404
3492
|
let entries;
|
|
3405
3493
|
try {
|
|
3406
|
-
entries =
|
|
3494
|
+
entries = fs3.readdirSync(dir, { withFileTypes: true });
|
|
3407
3495
|
} catch {
|
|
3408
3496
|
return;
|
|
3409
3497
|
}
|
|
3410
3498
|
for (const entry of entries) {
|
|
3411
|
-
const fullPath =
|
|
3499
|
+
const fullPath = path3.join(dir, entry.name);
|
|
3412
3500
|
if (entry.isDirectory()) {
|
|
3413
3501
|
if (IGNORE_PATTERNS.some((p) => entry.name === p || entry.name.startsWith(p))) continue;
|
|
3414
3502
|
yield* walkSourceFiles(fullPath);
|
|
3415
3503
|
} else if (entry.isFile()) {
|
|
3416
|
-
const ext =
|
|
3504
|
+
const ext = path3.extname(entry.name);
|
|
3417
3505
|
if (SOURCE_EXTENSIONS.has(ext)) yield fullPath;
|
|
3418
3506
|
}
|
|
3419
3507
|
}
|
|
@@ -3477,7 +3565,7 @@ function extractStaticStateCss(srcDir, options = {}) {
|
|
|
3477
3565
|
allConfigs.push(...configs);
|
|
3478
3566
|
if (verbose) {
|
|
3479
3567
|
process.stderr.write(
|
|
3480
|
-
`[tw:static-state] ${
|
|
3568
|
+
`[tw:static-state] ${path3.relative(srcDir, filePath)}: ${configs.length} komponen
|
|
3481
3569
|
`
|
|
3482
3570
|
);
|
|
3483
3571
|
}
|
|
@@ -3488,7 +3576,7 @@ function extractStaticStateCss(srcDir, options = {}) {
|
|
|
3488
3576
|
if (filesScanned >= maxFiles) break;
|
|
3489
3577
|
let source;
|
|
3490
3578
|
try {
|
|
3491
|
-
source =
|
|
3579
|
+
source = fs3.readFileSync(filePath, "utf-8");
|
|
3492
3580
|
} catch {
|
|
3493
3581
|
continue;
|
|
3494
3582
|
}
|
|
@@ -3501,7 +3589,7 @@ function extractStaticStateCss(srcDir, options = {}) {
|
|
|
3501
3589
|
allConfigs.push(...configs);
|
|
3502
3590
|
if (verbose) {
|
|
3503
3591
|
process.stderr.write(
|
|
3504
|
-
`[tw:static-state] ${
|
|
3592
|
+
`[tw:static-state] ${path3.relative(srcDir, filePath)}: ${configs.length} komponen
|
|
3505
3593
|
`
|
|
3506
3594
|
);
|
|
3507
3595
|
}
|
|
@@ -3595,12 +3683,12 @@ function appendStaticStateCssToSafelist(srcDir, safelistPath, options = {}) {
|
|
|
3595
3683
|
resolvedCss: options.resolvedCss || ""
|
|
3596
3684
|
// ← ensure always passed
|
|
3597
3685
|
});
|
|
3598
|
-
const twClassesDir =
|
|
3599
|
-
|
|
3600
|
-
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);
|
|
3601
3689
|
if (result.rulesGenerated === 0) {
|
|
3602
3690
|
try {
|
|
3603
|
-
|
|
3691
|
+
fs3.writeFileSync(
|
|
3604
3692
|
stateFilePath,
|
|
3605
3693
|
"/* tw-state-static.css \u2014 tidak ada state rules yang di-generate */\n",
|
|
3606
3694
|
"utf-8"
|
|
@@ -3610,7 +3698,7 @@ function appendStaticStateCssToSafelist(srcDir, safelistPath, options = {}) {
|
|
|
3610
3698
|
return `[tw:static-state] tidak ada state rules yang di-generate (${result.filesScanned} files di-scan)`;
|
|
3611
3699
|
}
|
|
3612
3700
|
try {
|
|
3613
|
-
|
|
3701
|
+
fs3.writeFileSync(stateFilePath, result.generatedCss, "utf-8");
|
|
3614
3702
|
return [
|
|
3615
3703
|
`[tw:static-state] ${result.rulesGenerated} static state rules di-generate`,
|
|
3616
3704
|
` \u2192 ${result.filesScanned} files scanned, ${result.filesWithStates} dengan states`,
|
|
@@ -3625,12 +3713,17 @@ function appendStaticStateCssToSafelist(srcDir, safelistPath, options = {}) {
|
|
|
3625
3713
|
var SOURCE_EXTENSIONS, IGNORE_PATTERNS, _native, TW_STATE_STATIC_FILENAME;
|
|
3626
3714
|
var init_staticStateExtractor = __esm({
|
|
3627
3715
|
"packages/domain/shared/src/staticStateExtractor.ts"() {
|
|
3716
|
+
"use strict";
|
|
3628
3717
|
SOURCE_EXTENSIONS = /* @__PURE__ */ new Set([".ts", ".tsx", ".js", ".jsx", ".mts", ".mjs"]);
|
|
3629
3718
|
IGNORE_PATTERNS = ["node_modules", ".next", "dist", "build", ".git", "coverage", "__tests__"];
|
|
3630
3719
|
_native = null;
|
|
3631
3720
|
TW_STATE_STATIC_FILENAME = "_tw-state-static.css";
|
|
3632
3721
|
}
|
|
3633
3722
|
});
|
|
3723
|
+
|
|
3724
|
+
// packages/domain/shared/src/logger.ts
|
|
3725
|
+
import fs4 from "fs";
|
|
3726
|
+
import path4 from "path";
|
|
3634
3727
|
function getEnvLevel() {
|
|
3635
3728
|
const env = process.env.TWS_LOG_LEVEL?.toLowerCase();
|
|
3636
3729
|
if (env && env in LEVELS) return env;
|
|
@@ -3640,8 +3733,8 @@ function setGlobalLogFile(filePath) {
|
|
|
3640
3733
|
_globalLogFile = filePath;
|
|
3641
3734
|
_logFileInitialized = false;
|
|
3642
3735
|
try {
|
|
3643
|
-
|
|
3644
|
-
|
|
3736
|
+
fs4.mkdirSync(path4.dirname(filePath), { recursive: true });
|
|
3737
|
+
fs4.writeFileSync(
|
|
3645
3738
|
filePath,
|
|
3646
3739
|
`# tailwind-styled build log \u2014 ${(/* @__PURE__ */ new Date()).toISOString()}
|
|
3647
3740
|
`,
|
|
@@ -3654,13 +3747,13 @@ function setGlobalLogFile(filePath) {
|
|
|
3654
3747
|
function writeToFile(line) {
|
|
3655
3748
|
if (!_globalLogFile || !_logFileInitialized) return;
|
|
3656
3749
|
try {
|
|
3657
|
-
|
|
3750
|
+
fs4.appendFileSync(_globalLogFile, line);
|
|
3658
3751
|
} catch {
|
|
3659
3752
|
}
|
|
3660
3753
|
}
|
|
3661
3754
|
function createLogger(prefix, level) {
|
|
3662
3755
|
const loggerState = {
|
|
3663
|
-
currentLevel: getEnvLevel(),
|
|
3756
|
+
currentLevel: level ?? getEnvLevel(),
|
|
3664
3757
|
setLevel(l) {
|
|
3665
3758
|
this.currentLevel = l;
|
|
3666
3759
|
}
|
|
@@ -3681,15 +3774,23 @@ function createLogger(prefix, level) {
|
|
|
3681
3774
|
setLogFile: (filePath) => setGlobalLogFile(filePath)
|
|
3682
3775
|
};
|
|
3683
3776
|
}
|
|
3684
|
-
var LEVELS, _globalLogFile, _logFileInitialized;
|
|
3777
|
+
var LEVELS, _globalLogFile, _logFileInitialized, logger;
|
|
3685
3778
|
var init_logger = __esm({
|
|
3686
3779
|
"packages/domain/shared/src/logger.ts"() {
|
|
3780
|
+
"use strict";
|
|
3687
3781
|
LEVELS = { silent: 0, error: 1, warn: 2, info: 3, debug: 4 };
|
|
3688
3782
|
_globalLogFile = null;
|
|
3689
3783
|
_logFileInitialized = false;
|
|
3690
|
-
createLogger("tailwind-styled");
|
|
3784
|
+
logger = createLogger("tailwind-styled");
|
|
3691
3785
|
}
|
|
3692
3786
|
});
|
|
3787
|
+
|
|
3788
|
+
// packages/domain/shared/src/index.ts
|
|
3789
|
+
import { createHash } from "crypto";
|
|
3790
|
+
import fs5 from "fs";
|
|
3791
|
+
import path5 from "path";
|
|
3792
|
+
import { fileURLToPath } from "url";
|
|
3793
|
+
import { createRequire as createRequire5 } from "module";
|
|
3693
3794
|
function createLogger2(namespace) {
|
|
3694
3795
|
const prefix = `[${namespace}]`;
|
|
3695
3796
|
return {
|
|
@@ -3735,9 +3836,9 @@ function loadNativeBinding(options) {
|
|
|
3735
3836
|
const { runtimeDir, candidates, isValid } = options;
|
|
3736
3837
|
const loadErrors = [];
|
|
3737
3838
|
for (const candidate of candidates) {
|
|
3738
|
-
const candidatePath =
|
|
3839
|
+
const candidatePath = path5.resolve(runtimeDir, candidate);
|
|
3739
3840
|
try {
|
|
3740
|
-
if (!
|
|
3841
|
+
if (!fs5.existsSync(candidatePath) && !fs5.existsSync(candidatePath + ".node")) {
|
|
3741
3842
|
continue;
|
|
3742
3843
|
}
|
|
3743
3844
|
const mod = requireNativeModule(candidatePath);
|
|
@@ -3769,9 +3870,9 @@ function resolveNativeBindingCandidates(options) {
|
|
|
3769
3870
|
}
|
|
3770
3871
|
}
|
|
3771
3872
|
if (!includeDefaultCandidates) return candidates;
|
|
3772
|
-
if (
|
|
3873
|
+
if (fs5.existsSync(runtimeDir)) {
|
|
3773
3874
|
try {
|
|
3774
|
-
for (const entry of
|
|
3875
|
+
for (const entry of fs5.readdirSync(runtimeDir)) {
|
|
3775
3876
|
if (entry.endsWith(".node")) candidates.push(entry);
|
|
3776
3877
|
}
|
|
3777
3878
|
} catch {
|
|
@@ -3780,22 +3881,22 @@ function resolveNativeBindingCandidates(options) {
|
|
|
3780
3881
|
const BINARY_NAMES = ["tailwind-styled-native", "tailwind_styled_parser"];
|
|
3781
3882
|
const napiPlatform = process.platform === "linux" && process.arch === "x64" ? "linux-x64-gnu" : process.platform === "linux" && process.arch === "arm64" ? "linux-arm64-gnu" : `${process.platform}-${process.arch}`;
|
|
3782
3883
|
for (const bin of BINARY_NAMES) {
|
|
3783
|
-
candidates.push(
|
|
3784
|
-
candidates.push(
|
|
3785
|
-
candidates.push(
|
|
3786
|
-
candidates.push(
|
|
3787
|
-
candidates.push(
|
|
3788
|
-
candidates.push(
|
|
3789
|
-
candidates.push(
|
|
3790
|
-
candidates.push(
|
|
3791
|
-
candidates.push(
|
|
3884
|
+
candidates.push(path5.resolve(runtimeDir, `${bin}.node`));
|
|
3885
|
+
candidates.push(path5.resolve(runtimeDir, `${bin}.${napiPlatform}.node`));
|
|
3886
|
+
candidates.push(path5.resolve(runtimeDir, "..", "native", `${bin}.node`));
|
|
3887
|
+
candidates.push(path5.resolve(runtimeDir, "..", "native", `${bin}.${napiPlatform}.node`));
|
|
3888
|
+
candidates.push(path5.resolve(process.cwd(), "native", `${bin}.node`));
|
|
3889
|
+
candidates.push(path5.resolve(process.cwd(), "native", `${bin}.${napiPlatform}.node`));
|
|
3890
|
+
candidates.push(path5.resolve(runtimeDir, "..", "..", "..", "..", "native", `${bin}.node`));
|
|
3891
|
+
candidates.push(path5.resolve(runtimeDir, "..", "..", "..", "..", "native", `${bin}.${napiPlatform}.node`));
|
|
3892
|
+
candidates.push(path5.resolve(runtimeDir, "..", "..", "..", "native", `${bin}.node`));
|
|
3792
3893
|
}
|
|
3793
3894
|
return Array.from(new Set(candidates));
|
|
3794
3895
|
}
|
|
3795
3896
|
function resolveRuntimeDir(dir, importMetaUrl) {
|
|
3796
|
-
if (dir) return
|
|
3897
|
+
if (dir) return path5.resolve(dir);
|
|
3797
3898
|
try {
|
|
3798
|
-
return
|
|
3899
|
+
return path5.dirname(fileURLToPath(importMetaUrl));
|
|
3799
3900
|
} catch {
|
|
3800
3901
|
return process.cwd();
|
|
3801
3902
|
}
|
|
@@ -3812,6 +3913,7 @@ function formatErrorMessage(error) {
|
|
|
3812
3913
|
var TwError, _require3, LRUCache;
|
|
3813
3914
|
var init_src2 = __esm({
|
|
3814
3915
|
"packages/domain/shared/src/index.ts"() {
|
|
3916
|
+
"use strict";
|
|
3815
3917
|
init_trace();
|
|
3816
3918
|
init_error_codes();
|
|
3817
3919
|
init_compatibility();
|
|
@@ -3877,7 +3979,9 @@ var init_src2 = __esm({
|
|
|
3877
3979
|
return `[${this.source.toUpperCase()}:${this.code}] ${this.message}`;
|
|
3878
3980
|
}
|
|
3879
3981
|
};
|
|
3880
|
-
_require3 =
|
|
3982
|
+
_require3 = createRequire5(
|
|
3983
|
+
typeof __filename !== "undefined" ? `file://${__filename}` : import.meta.url ?? "file://unknown"
|
|
3984
|
+
);
|
|
3881
3985
|
LRUCache = class {
|
|
3882
3986
|
capacity;
|
|
3883
3987
|
cache;
|
|
@@ -3924,7 +4028,74 @@ var init_src2 = __esm({
|
|
|
3924
4028
|
|
|
3925
4029
|
// src/umbrella/shared.ts
|
|
3926
4030
|
init_src2();
|
|
3927
|
-
|
|
3928
|
-
|
|
3929
|
-
|
|
4031
|
+
export {
|
|
4032
|
+
ERROR_CODES,
|
|
4033
|
+
LRUCache,
|
|
4034
|
+
NativeAnalyzerReportSchema,
|
|
4035
|
+
NativeCacheEntrySchema,
|
|
4036
|
+
NativeCacheReadResultSchema,
|
|
4037
|
+
NativeCssCompileResultSchema,
|
|
4038
|
+
NativeScanFileSchema,
|
|
4039
|
+
NativeScanResultSchema,
|
|
4040
|
+
NativeTransformResultSchema,
|
|
4041
|
+
NativeWatchResultSchema,
|
|
4042
|
+
PackageJsonSchema,
|
|
4043
|
+
RegistryFileSchema,
|
|
4044
|
+
RegistryPluginEntrySchema,
|
|
4045
|
+
ScanCacheClassEntrySchema,
|
|
4046
|
+
ScanCacheSchema,
|
|
4047
|
+
TW_STATE_STATIC_FILENAME,
|
|
4048
|
+
TailwindConfigSchema,
|
|
4049
|
+
TelemetryCollector,
|
|
4050
|
+
TwError,
|
|
4051
|
+
appendStaticStateCssToSafelist,
|
|
4052
|
+
assertTailwindV4,
|
|
4053
|
+
calculateHealth,
|
|
4054
|
+
createBuildTimer,
|
|
4055
|
+
createDebugLogger,
|
|
4056
|
+
createEsmRequire,
|
|
4057
|
+
createLogger2 as createLogger,
|
|
4058
|
+
createObservabilityClient,
|
|
4059
|
+
createTraceSnapshot,
|
|
4060
|
+
detectTailwind,
|
|
4061
|
+
extractStaticStateCss,
|
|
4062
|
+
formatDuration,
|
|
4063
|
+
formatErrorCode,
|
|
4064
|
+
formatErrorMessage,
|
|
4065
|
+
formatMemory,
|
|
4066
|
+
formatNativeNotFoundError,
|
|
4067
|
+
generateBarrelFile,
|
|
4068
|
+
generateClassRenameCodemod,
|
|
4069
|
+
generateComponentCode,
|
|
4070
|
+
generateStorybookStory,
|
|
4071
|
+
getBuildTimeColor,
|
|
4072
|
+
getDirname,
|
|
4073
|
+
getFilename,
|
|
4074
|
+
getGlobalTelemetry,
|
|
4075
|
+
getHealthColor,
|
|
4076
|
+
getMemoryColor,
|
|
4077
|
+
getModeColor,
|
|
4078
|
+
getPipelinePercentages,
|
|
4079
|
+
getSuggestion,
|
|
4080
|
+
getTailwindVersion,
|
|
4081
|
+
hashContent2 as hashContent,
|
|
4082
|
+
isTailwindV4,
|
|
4083
|
+
isTwError,
|
|
4084
|
+
loadNativeBinding,
|
|
4085
|
+
parseJsonFileWithSchema,
|
|
4086
|
+
parseJsonWithSchema,
|
|
4087
|
+
parseNative,
|
|
4088
|
+
resetGlobalTelemetry,
|
|
4089
|
+
resolveFromRoot,
|
|
4090
|
+
resolveLoaderPath,
|
|
4091
|
+
resolveNativeBinary,
|
|
4092
|
+
resolveNativeBindingCandidates,
|
|
4093
|
+
resolveNativeNodePath,
|
|
4094
|
+
resolveRuntimeDir,
|
|
4095
|
+
resolveWorkerPath,
|
|
4096
|
+
safeParseNative,
|
|
4097
|
+
setGlobalLogFile,
|
|
4098
|
+
tryRequire,
|
|
4099
|
+
wrapUnknownError
|
|
4100
|
+
};
|
|
3930
4101
|
//# sourceMappingURL=shared.mjs.map
|