tailwind-styled-v4 5.0.11 → 5.0.13
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/README.md +100 -4
- package/dist/{analyzeWorkspace-DDOQdzzI.d.ts → analyzeWorkspace-CopJNGmi.d.ts} +2 -0
- package/dist/{analyzeWorkspace-BS5O4rhC.d.mts → analyzeWorkspace-DpVPccjz.d.mts} +2 -0
- package/dist/analyzer.d.mts +4 -4
- package/dist/analyzer.d.ts +4 -4
- package/dist/analyzer.js +34 -69
- package/dist/analyzer.js.map +1 -1
- package/dist/analyzer.mjs +33 -68
- package/dist/analyzer.mjs.map +1 -1
- package/dist/animate.d.mts +4 -0
- package/dist/animate.d.ts +4 -0
- package/dist/animate.js +33 -11
- package/dist/animate.js.map +1 -1
- package/dist/animate.mjs +33 -11
- package/dist/animate.mjs.map +1 -1
- package/dist/atomic.js +57 -6
- package/dist/atomic.js.map +1 -1
- package/dist/atomic.mjs +57 -6
- package/dist/atomic.mjs.map +1 -1
- package/dist/cli.js +404 -190
- package/dist/cli.js.map +1 -1
- package/dist/cli.mjs +401 -187
- package/dist/cli.mjs.map +1 -1
- package/dist/compiler.d.mts +2700 -212
- package/dist/compiler.d.ts +2700 -212
- package/dist/compiler.js +1996 -503
- package/dist/compiler.js.map +1 -1
- package/dist/compiler.mjs +1847 -448
- package/dist/compiler.mjs.map +1 -1
- package/dist/devtools.js +17 -4
- package/dist/devtools.js.map +1 -1
- package/dist/devtools.mjs +17 -4
- package/dist/devtools.mjs.map +1 -1
- package/dist/engine.d.mts +11 -470
- package/dist/engine.d.ts +11 -470
- package/dist/engine.js +2777 -455
- package/dist/engine.js.map +1 -1
- package/dist/engine.mjs +2776 -454
- package/dist/engine.mjs.map +1 -1
- package/dist/index-BDQw13kn.d.ts +464 -0
- package/dist/index-DJv28Uzq.d.mts +464 -0
- package/dist/index.browser.mjs +143 -255
- package/dist/index.browser.mjs.map +1 -1
- package/dist/index.d.mts +23 -39
- package/dist/index.d.ts +23 -39
- package/dist/index.js +7234 -1400
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +7234 -1400
- package/dist/index.mjs.map +1 -1
- package/dist/next.d.mts +44 -1
- package/dist/next.d.ts +44 -1
- package/dist/next.js +3224 -1065
- package/dist/next.js.map +1 -1
- package/dist/next.mjs +3223 -1066
- package/dist/next.mjs.map +1 -1
- package/dist/rspack.d.mts +9 -0
- package/dist/rspack.d.ts +9 -0
- package/dist/rspack.js +99 -61
- package/dist/rspack.js.map +1 -1
- package/dist/rspack.mjs +99 -61
- package/dist/rspack.mjs.map +1 -1
- package/dist/runtime-css.d.mts +8 -0
- package/dist/runtime-css.d.ts +8 -0
- package/dist/runtime-css.js +23 -7
- package/dist/runtime-css.js.map +1 -1
- package/dist/runtime-css.mjs +23 -7
- package/dist/runtime-css.mjs.map +1 -1
- package/dist/scanner.js +16 -37
- package/dist/scanner.js.map +1 -1
- package/dist/scanner.mjs +15 -36
- package/dist/scanner.mjs.map +1 -1
- package/dist/shared.d.mts +107 -1
- package/dist/shared.d.ts +107 -1
- package/dist/shared.js +3014 -466
- package/dist/shared.js.map +1 -1
- package/dist/shared.mjs +3008 -445
- package/dist/shared.mjs.map +1 -1
- package/dist/svelte.js +39 -35
- package/dist/svelte.js.map +1 -1
- package/dist/svelte.mjs +38 -34
- package/dist/svelte.mjs.map +1 -1
- package/dist/theme.js +85 -76
- package/dist/theme.js.map +1 -1
- package/dist/theme.mjs +83 -74
- package/dist/theme.mjs.map +1 -1
- package/dist/turbopackLoader.js +2351 -187
- package/dist/turbopackLoader.js.map +1 -1
- package/dist/turbopackLoader.mjs +2351 -187
- package/dist/turbopackLoader.mjs.map +1 -1
- package/dist/tw.js +404 -190
- package/dist/tw.js.map +1 -1
- package/dist/tw.mjs +401 -187
- package/dist/tw.mjs.map +1 -1
- package/dist/vite.js +2657 -320
- package/dist/vite.js.map +1 -1
- package/dist/vite.mjs +2657 -320
- package/dist/vite.mjs.map +1 -1
- package/dist/vue.js +39 -35
- package/dist/vue.js.map +1 -1
- package/dist/vue.mjs +38 -34
- package/dist/vue.mjs.map +1 -1
- package/dist/webpackLoader.js +190 -33
- package/dist/webpackLoader.js.map +1 -1
- package/dist/webpackLoader.mjs +190 -33
- package/dist/webpackLoader.mjs.map +1 -1
- package/native/index.node +0 -0
- package/native/tailwind-styled-native.node +0 -0
- package/native/tailwind-styled-native.win32-x64-msvc.node +0 -0
- package/package.json +9 -4
- package/CHANGELOG.md +0 -285
package/dist/shared.mjs
CHANGED
|
@@ -1,19 +1,39 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { createRequire } from 'module';
|
|
3
|
+
import * as fs3 from 'fs';
|
|
4
|
+
import fs3__default from 'fs';
|
|
4
5
|
import * as path from 'path';
|
|
5
6
|
import path__default from 'path';
|
|
7
|
+
import { createHash } from 'crypto';
|
|
6
8
|
import { fileURLToPath } from 'url';
|
|
7
|
-
import { createRequire } from 'module';
|
|
8
|
-
import { z } from 'zod';
|
|
9
9
|
|
|
10
10
|
/* tailwind-styled-v4 v5.0.4 | MIT | https://github.com/dictionar32/tailwind-styled-v4 */
|
|
11
|
+
var __defProp = Object.defineProperty;
|
|
12
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
13
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
14
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
11
15
|
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
12
16
|
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
13
17
|
}) : x)(function(x) {
|
|
14
18
|
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
15
19
|
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
16
20
|
});
|
|
21
|
+
var __esm = (fn, res) => function __init() {
|
|
22
|
+
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
23
|
+
};
|
|
24
|
+
var __export = (target, all) => {
|
|
25
|
+
for (var name in all)
|
|
26
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
27
|
+
};
|
|
28
|
+
var __copyProps = (to, from, except, desc) => {
|
|
29
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
30
|
+
for (let key of __getOwnPropNames(from))
|
|
31
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
32
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
33
|
+
}
|
|
34
|
+
return to;
|
|
35
|
+
};
|
|
36
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
17
37
|
|
|
18
38
|
// packages/domain/shared/src/trace.ts
|
|
19
39
|
function getHealthColor(status) {
|
|
@@ -105,43 +125,12 @@ function getPipelinePercentages(metrics) {
|
|
|
105
125
|
compilePct: compile / total * 100
|
|
106
126
|
};
|
|
107
127
|
}
|
|
128
|
+
var init_trace = __esm({
|
|
129
|
+
"packages/domain/shared/src/trace.ts"() {
|
|
130
|
+
}
|
|
131
|
+
});
|
|
108
132
|
|
|
109
133
|
// packages/domain/shared/src/error-codes.ts
|
|
110
|
-
var ERROR_CODES = {
|
|
111
|
-
// E0xx — Native binding
|
|
112
|
-
NATIVE_NOT_FOUND: "E001",
|
|
113
|
-
NATIVE_LOAD_FAILED: "E002",
|
|
114
|
-
NATIVE_VERSION_MISMATCH: "E003",
|
|
115
|
-
SCANNER_NATIVE_NOT_FOUND: "E004",
|
|
116
|
-
SCANNER_HASH_FAILED: "E005",
|
|
117
|
-
NATIVE_TRANSFORM_UNAVAILABLE: "E006",
|
|
118
|
-
// E2xx — Compilation
|
|
119
|
-
MISSING_REACT_IMPORT: "E201",
|
|
120
|
-
UNSUPPORTED_PATTERN: "E202",
|
|
121
|
-
TEMPLATE_PARSE_ERROR: "E203",
|
|
122
|
-
COMPILE_TIMEOUT: "E204",
|
|
123
|
-
// E3xx — Compatibility
|
|
124
|
-
TAILWIND_VERSION_UNSUPPORTED: "E301",
|
|
125
|
-
NODE_VERSION_UNSUPPORTED: "E302",
|
|
126
|
-
// E4xx — Cache
|
|
127
|
-
CACHE_READ_FAILED: "E401",
|
|
128
|
-
CACHE_WRITE_FAILED: "E402",
|
|
129
|
-
CACHE_CORRUPTED: "E403",
|
|
130
|
-
// E5xx — RSC
|
|
131
|
-
RSC_BOUNDARY_CONFLICT: "E501",
|
|
132
|
-
// W1xx — Warnings
|
|
133
|
-
DYNAMIC_CONTENT: "W101",
|
|
134
|
-
INVALID_VARIANT_VALUE: "W201",
|
|
135
|
-
DEPRECATED_MODE: "W301"
|
|
136
|
-
};
|
|
137
|
-
var ERROR_SUGGESTIONS = {
|
|
138
|
-
E001: "Run: npm install @tailwind-styled/native-{platform} or build from source",
|
|
139
|
-
E002: "Try: npm rebuild or reinstall the package",
|
|
140
|
-
E003: "Run: npm install tailwind-styled-v4@latest to sync versions",
|
|
141
|
-
E004: "Run: npm install @tailwind-styled/scanner",
|
|
142
|
-
E006: "Run: npm install @tailwind-styled/compiler",
|
|
143
|
-
E301: "Upgrade: npm install tailwindcss@^4"
|
|
144
|
-
};
|
|
145
134
|
function getSuggestion(code) {
|
|
146
135
|
return ERROR_SUGGESTIONS[code];
|
|
147
136
|
}
|
|
@@ -149,6 +138,46 @@ function formatErrorCode(code) {
|
|
|
149
138
|
const prefix = code.startsWith("E") ? "Error" : code.startsWith("W") ? "Warning" : "Code";
|
|
150
139
|
return `[${prefix} ${code}]`;
|
|
151
140
|
}
|
|
141
|
+
var ERROR_CODES, ERROR_SUGGESTIONS;
|
|
142
|
+
var init_error_codes = __esm({
|
|
143
|
+
"packages/domain/shared/src/error-codes.ts"() {
|
|
144
|
+
ERROR_CODES = {
|
|
145
|
+
// E0xx — Native binding
|
|
146
|
+
NATIVE_NOT_FOUND: "E001",
|
|
147
|
+
NATIVE_LOAD_FAILED: "E002",
|
|
148
|
+
NATIVE_VERSION_MISMATCH: "E003",
|
|
149
|
+
SCANNER_NATIVE_NOT_FOUND: "E004",
|
|
150
|
+
SCANNER_HASH_FAILED: "E005",
|
|
151
|
+
NATIVE_TRANSFORM_UNAVAILABLE: "E006",
|
|
152
|
+
// E2xx — Compilation
|
|
153
|
+
MISSING_REACT_IMPORT: "E201",
|
|
154
|
+
UNSUPPORTED_PATTERN: "E202",
|
|
155
|
+
TEMPLATE_PARSE_ERROR: "E203",
|
|
156
|
+
COMPILE_TIMEOUT: "E204",
|
|
157
|
+
// E3xx — Compatibility
|
|
158
|
+
TAILWIND_VERSION_UNSUPPORTED: "E301",
|
|
159
|
+
NODE_VERSION_UNSUPPORTED: "E302",
|
|
160
|
+
// E4xx — Cache
|
|
161
|
+
CACHE_READ_FAILED: "E401",
|
|
162
|
+
CACHE_WRITE_FAILED: "E402",
|
|
163
|
+
CACHE_CORRUPTED: "E403",
|
|
164
|
+
// E5xx — RSC
|
|
165
|
+
RSC_BOUNDARY_CONFLICT: "E501",
|
|
166
|
+
// W1xx — Warnings
|
|
167
|
+
DYNAMIC_CONTENT: "W101",
|
|
168
|
+
INVALID_VARIANT_VALUE: "W201",
|
|
169
|
+
DEPRECATED_MODE: "W301"
|
|
170
|
+
};
|
|
171
|
+
ERROR_SUGGESTIONS = {
|
|
172
|
+
E001: "Run: npm install @tailwind-styled/native-{platform} or build from source",
|
|
173
|
+
E002: "Try: npm rebuild or reinstall the package",
|
|
174
|
+
E003: "Run: npm install tailwind-styled-v4@latest to sync versions",
|
|
175
|
+
E004: "Run: npm install @tailwind-styled/scanner",
|
|
176
|
+
E006: "Run: npm install @tailwind-styled/compiler",
|
|
177
|
+
E301: "Upgrade: npm install tailwindcss@^4"
|
|
178
|
+
};
|
|
179
|
+
}
|
|
180
|
+
});
|
|
152
181
|
|
|
153
182
|
// packages/domain/shared/src/compatibility.ts
|
|
154
183
|
function detectTailwind() {
|
|
@@ -176,64 +205,9 @@ function getTailwindVersion() {
|
|
|
176
205
|
function isTailwindV4() {
|
|
177
206
|
return detectTailwind().supported;
|
|
178
207
|
}
|
|
179
|
-
var
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
hash: z.string().optional()
|
|
183
|
-
});
|
|
184
|
-
var NativeScanResultSchema = z.object({
|
|
185
|
-
files: z.array(NativeScanFileSchema),
|
|
186
|
-
totalFiles: z.number().int().nonnegative(),
|
|
187
|
-
uniqueClasses: z.array(z.string())
|
|
188
|
-
});
|
|
189
|
-
var NativeClassUsageSchema = z.object({
|
|
190
|
-
name: z.string(),
|
|
191
|
-
count: z.number().int().nonnegative(),
|
|
192
|
-
files: z.array(z.string()).optional()
|
|
193
|
-
});
|
|
194
|
-
var NativeAnalyzerReportSchema = z.object({
|
|
195
|
-
root: z.string(),
|
|
196
|
-
topClasses: z.array(NativeClassUsageSchema).optional(),
|
|
197
|
-
safelist: z.array(z.string()).optional(),
|
|
198
|
-
css: z.string().optional(),
|
|
199
|
-
conflicts: z.array(z.unknown()).optional(),
|
|
200
|
-
unusedClasses: z.array(z.string()).optional(),
|
|
201
|
-
durationMs: z.number().nonnegative().optional()
|
|
202
|
-
});
|
|
203
|
-
var NativeTransformResultSchema = z.object({
|
|
204
|
-
code: z.string(),
|
|
205
|
-
classes: z.array(z.string()),
|
|
206
|
-
changed: z.boolean(),
|
|
207
|
-
rsc: z.object({
|
|
208
|
-
isServer: z.boolean(),
|
|
209
|
-
needsClientDirective: z.boolean(),
|
|
210
|
-
clientReasons: z.array(z.string())
|
|
211
|
-
}).optional()
|
|
212
|
-
});
|
|
213
|
-
var NativeCssCompileResultSchema = z.object({
|
|
214
|
-
css: z.string(),
|
|
215
|
-
resolvedClasses: z.array(z.string()),
|
|
216
|
-
unresolvedClasses: z.array(z.string()).optional()
|
|
217
|
-
});
|
|
218
|
-
z.object({
|
|
219
|
-
type: z.enum(["change", "unlink", "create"]),
|
|
220
|
-
path: z.string()
|
|
221
|
-
});
|
|
222
|
-
var NativeWatchResultSchema = z.object({
|
|
223
|
-
status: z.enum(["ok", "error"]),
|
|
224
|
-
handleId: z.string().optional(),
|
|
225
|
-
error: z.string().optional()
|
|
226
|
-
});
|
|
227
|
-
var NativeCacheEntrySchema = z.object({
|
|
228
|
-
file: z.string(),
|
|
229
|
-
hash: z.string(),
|
|
230
|
-
classes: z.array(z.string()),
|
|
231
|
-
timestamp: z.number(),
|
|
232
|
-
size: z.number().optional()
|
|
233
|
-
});
|
|
234
|
-
var NativeCacheReadResultSchema = z.object({
|
|
235
|
-
entries: z.array(NativeCacheEntrySchema),
|
|
236
|
-
version: z.string().optional()
|
|
208
|
+
var init_compatibility = __esm({
|
|
209
|
+
"packages/domain/shared/src/compatibility.ts"() {
|
|
210
|
+
}
|
|
237
211
|
});
|
|
238
212
|
function safeParseNative(schema, data, fallback) {
|
|
239
213
|
const result = schema.safeParse(data);
|
|
@@ -243,17 +217,79 @@ function parseNative(schema, data, context) {
|
|
|
243
217
|
const result = schema.safeParse(data);
|
|
244
218
|
if (!result.success) {
|
|
245
219
|
const first = result.error.issues[0];
|
|
246
|
-
const
|
|
220
|
+
const path6 = first?.path?.join(".") ?? "(root)";
|
|
247
221
|
throw new Error(
|
|
248
|
-
`[${context}] Native binding returned unexpected data: ${
|
|
222
|
+
`[${context}] Native binding returned unexpected data: ${path6}: ${first?.message ?? "validation failed"}`
|
|
249
223
|
);
|
|
250
224
|
}
|
|
251
225
|
return result.data;
|
|
252
226
|
}
|
|
227
|
+
var NativeScanFileSchema, NativeScanResultSchema, NativeClassUsageSchema, NativeAnalyzerReportSchema, NativeTransformResultSchema, NativeCssCompileResultSchema, NativeWatchResultSchema, NativeCacheEntrySchema, NativeCacheReadResultSchema;
|
|
228
|
+
var init_native_schemas = __esm({
|
|
229
|
+
"packages/domain/shared/src/native-schemas.ts"() {
|
|
230
|
+
NativeScanFileSchema = z.object({
|
|
231
|
+
file: z.string().min(1, "file path cannot be empty"),
|
|
232
|
+
classes: z.array(z.string()),
|
|
233
|
+
hash: z.string().optional()
|
|
234
|
+
});
|
|
235
|
+
NativeScanResultSchema = z.object({
|
|
236
|
+
files: z.array(NativeScanFileSchema),
|
|
237
|
+
totalFiles: z.number().int().nonnegative(),
|
|
238
|
+
uniqueClasses: z.array(z.string())
|
|
239
|
+
});
|
|
240
|
+
NativeClassUsageSchema = z.object({
|
|
241
|
+
name: z.string(),
|
|
242
|
+
count: z.number().int().nonnegative(),
|
|
243
|
+
files: z.array(z.string()).optional()
|
|
244
|
+
});
|
|
245
|
+
NativeAnalyzerReportSchema = z.object({
|
|
246
|
+
root: z.string(),
|
|
247
|
+
topClasses: z.array(NativeClassUsageSchema).optional(),
|
|
248
|
+
safelist: z.array(z.string()).optional(),
|
|
249
|
+
css: z.string().optional(),
|
|
250
|
+
conflicts: z.array(z.unknown()).optional(),
|
|
251
|
+
unusedClasses: z.array(z.string()).optional(),
|
|
252
|
+
durationMs: z.number().nonnegative().optional()
|
|
253
|
+
});
|
|
254
|
+
NativeTransformResultSchema = z.object({
|
|
255
|
+
code: z.string(),
|
|
256
|
+
classes: z.array(z.string()),
|
|
257
|
+
changed: z.boolean(),
|
|
258
|
+
rsc: z.object({
|
|
259
|
+
isServer: z.boolean(),
|
|
260
|
+
needsClientDirective: z.boolean(),
|
|
261
|
+
clientReasons: z.array(z.string())
|
|
262
|
+
}).optional()
|
|
263
|
+
});
|
|
264
|
+
NativeCssCompileResultSchema = z.object({
|
|
265
|
+
css: z.string(),
|
|
266
|
+
resolvedClasses: z.array(z.string()),
|
|
267
|
+
unresolvedClasses: z.array(z.string()).optional()
|
|
268
|
+
});
|
|
269
|
+
z.object({
|
|
270
|
+
type: z.enum(["change", "unlink", "create"]),
|
|
271
|
+
path: z.string()
|
|
272
|
+
});
|
|
273
|
+
NativeWatchResultSchema = z.object({
|
|
274
|
+
status: z.enum(["ok", "error"]),
|
|
275
|
+
handleId: z.string().optional(),
|
|
276
|
+
error: z.string().optional()
|
|
277
|
+
});
|
|
278
|
+
NativeCacheEntrySchema = z.object({
|
|
279
|
+
file: z.string(),
|
|
280
|
+
hash: z.string(),
|
|
281
|
+
classes: z.array(z.string()),
|
|
282
|
+
timestamp: z.number(),
|
|
283
|
+
size: z.number().optional()
|
|
284
|
+
});
|
|
285
|
+
NativeCacheReadResultSchema = z.object({
|
|
286
|
+
entries: z.array(NativeCacheEntrySchema),
|
|
287
|
+
version: z.string().optional()
|
|
288
|
+
});
|
|
289
|
+
}
|
|
290
|
+
});
|
|
253
291
|
|
|
254
292
|
// packages/domain/shared/src/esmHelpers.ts
|
|
255
|
-
var isBrowser = typeof window !== "undefined" || typeof document !== "undefined";
|
|
256
|
-
var nodeModuleRef = null;
|
|
257
293
|
function getNodeModuleRef() {
|
|
258
294
|
if (isBrowser) return null;
|
|
259
295
|
if (nodeModuleRef !== null) return nodeModuleRef;
|
|
@@ -266,9 +302,6 @@ function getNodeModuleRef() {
|
|
|
266
302
|
return null;
|
|
267
303
|
}
|
|
268
304
|
}
|
|
269
|
-
var _nodePath = null;
|
|
270
|
-
var _nodeUrl = null;
|
|
271
|
-
var _nodeFs = null;
|
|
272
305
|
function getNodePath() {
|
|
273
306
|
if (isBrowser) throw new Error("node:path not available in browser");
|
|
274
307
|
const nodeRequire = getNodeModuleRef();
|
|
@@ -336,72 +369,18 @@ function resolveNativeNodePath(importMetaUrl, ...relativeSegments) {
|
|
|
336
369
|
if (isBrowser) return relativeSegments.join("/");
|
|
337
370
|
return getNodePath().resolve(getDirname(importMetaUrl), ...relativeSegments);
|
|
338
371
|
}
|
|
372
|
+
var isBrowser, nodeModuleRef, _nodePath, _nodeUrl, _nodeFs;
|
|
373
|
+
var init_esmHelpers = __esm({
|
|
374
|
+
"packages/domain/shared/src/esmHelpers.ts"() {
|
|
375
|
+
isBrowser = typeof window !== "undefined" || typeof document !== "undefined";
|
|
376
|
+
nodeModuleRef = null;
|
|
377
|
+
_nodePath = null;
|
|
378
|
+
_nodeUrl = null;
|
|
379
|
+
_nodeFs = null;
|
|
380
|
+
}
|
|
381
|
+
});
|
|
339
382
|
|
|
340
383
|
// packages/domain/shared/src/telemetry.ts
|
|
341
|
-
var RING_BUFFER_SIZE = 100;
|
|
342
|
-
var TelemetryCollector = class {
|
|
343
|
-
data = [];
|
|
344
|
-
enabled;
|
|
345
|
-
constructor(enabled) {
|
|
346
|
-
this.enabled = enabled ?? (process.env.TWS_TELEMETRY === "1" || process.env.TWS_TELEMETRY === "true");
|
|
347
|
-
}
|
|
348
|
-
record(build) {
|
|
349
|
-
if (!this.enabled) return;
|
|
350
|
-
if (this.data.length >= RING_BUFFER_SIZE) {
|
|
351
|
-
this.data.shift();
|
|
352
|
-
}
|
|
353
|
-
this.data.push(build);
|
|
354
|
-
}
|
|
355
|
-
snapshot() {
|
|
356
|
-
return [...this.data];
|
|
357
|
-
}
|
|
358
|
-
summary() {
|
|
359
|
-
if (this.data.length === 0) return null;
|
|
360
|
-
const durations = this.data.map((d) => d.durationMs).sort((a, b) => a - b);
|
|
361
|
-
const p95Idx = Math.floor(durations.length * 0.95);
|
|
362
|
-
const avg = (arr) => arr.reduce((a, b) => a + b, 0) / arr.length;
|
|
363
|
-
return {
|
|
364
|
-
totalBuilds: this.data.length,
|
|
365
|
-
avgDurationMs: avg(durations),
|
|
366
|
-
p95DurationMs: durations[p95Idx] ?? durations[durations.length - 1] ?? 0,
|
|
367
|
-
avgCacheHitRate: avg(this.data.map((d) => d.cacheHitRate)),
|
|
368
|
-
avgFilesScanned: avg(this.data.map((d) => d.filesScanned)),
|
|
369
|
-
avgClassesExtracted: avg(this.data.map((d) => d.classesExtracted)),
|
|
370
|
-
phaseAvgs: {
|
|
371
|
-
scan: avg(this.data.map((d) => d.phases.scan)),
|
|
372
|
-
compile: avg(this.data.map((d) => d.phases.compile)),
|
|
373
|
-
engine: avg(this.data.map((d) => d.phases.engine)),
|
|
374
|
-
output: avg(this.data.map((d) => d.phases.output))
|
|
375
|
-
},
|
|
376
|
-
slowestBuildMs: durations[durations.length - 1] ?? 0,
|
|
377
|
-
fastestBuildMs: durations[0] ?? 0
|
|
378
|
-
};
|
|
379
|
-
}
|
|
380
|
-
reset() {
|
|
381
|
-
this.data = [];
|
|
382
|
-
}
|
|
383
|
-
/** Format ringkas untuk CLI output */
|
|
384
|
-
formatCli() {
|
|
385
|
-
const s = this.summary();
|
|
386
|
-
if (!s) return "[telemetry] no data";
|
|
387
|
-
return [
|
|
388
|
-
`[telemetry] ${s.totalBuilds} builds`,
|
|
389
|
-
`avg ${s.avgDurationMs.toFixed(0)}ms`,
|
|
390
|
-
`p95 ${s.p95DurationMs.toFixed(0)}ms`,
|
|
391
|
-
`cache hit ${(s.avgCacheHitRate * 100).toFixed(0)}%`,
|
|
392
|
-
`${s.avgFilesScanned.toFixed(0)} files`
|
|
393
|
-
].join(" \xB7 ");
|
|
394
|
-
}
|
|
395
|
-
/** Export sebagai JSON untuk dashboard/prometheus */
|
|
396
|
-
toJSON() {
|
|
397
|
-
return {
|
|
398
|
-
summary: this.summary(),
|
|
399
|
-
history: this.data.slice(-20)
|
|
400
|
-
// last 20 builds
|
|
401
|
-
};
|
|
402
|
-
}
|
|
403
|
-
};
|
|
404
|
-
var _globalCollector = null;
|
|
405
384
|
function getGlobalTelemetry() {
|
|
406
385
|
if (!_globalCollector) {
|
|
407
386
|
_globalCollector = new TelemetryCollector();
|
|
@@ -440,68 +419,75 @@ function createBuildTimer() {
|
|
|
440
419
|
}
|
|
441
420
|
};
|
|
442
421
|
}
|
|
443
|
-
var
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
}
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
}
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
422
|
+
var RING_BUFFER_SIZE, TelemetryCollector, _globalCollector;
|
|
423
|
+
var init_telemetry = __esm({
|
|
424
|
+
"packages/domain/shared/src/telemetry.ts"() {
|
|
425
|
+
RING_BUFFER_SIZE = 100;
|
|
426
|
+
TelemetryCollector = class {
|
|
427
|
+
data = [];
|
|
428
|
+
enabled;
|
|
429
|
+
constructor(enabled) {
|
|
430
|
+
this.enabled = enabled ?? (process.env.TWS_TELEMETRY === "1" || process.env.TWS_TELEMETRY === "true");
|
|
431
|
+
}
|
|
432
|
+
record(build) {
|
|
433
|
+
if (!this.enabled) return;
|
|
434
|
+
if (this.data.length >= RING_BUFFER_SIZE) {
|
|
435
|
+
this.data.shift();
|
|
436
|
+
}
|
|
437
|
+
this.data.push(build);
|
|
438
|
+
}
|
|
439
|
+
snapshot() {
|
|
440
|
+
return [...this.data];
|
|
441
|
+
}
|
|
442
|
+
summary() {
|
|
443
|
+
if (this.data.length === 0) return null;
|
|
444
|
+
const durations = this.data.map((d) => d.durationMs).sort((a, b) => a - b);
|
|
445
|
+
const p95Idx = Math.floor(durations.length * 0.95);
|
|
446
|
+
const avg = (arr) => arr.reduce((a, b) => a + b, 0) / arr.length;
|
|
447
|
+
return {
|
|
448
|
+
totalBuilds: this.data.length,
|
|
449
|
+
avgDurationMs: avg(durations),
|
|
450
|
+
p95DurationMs: durations[p95Idx] ?? durations[durations.length - 1] ?? 0,
|
|
451
|
+
avgCacheHitRate: avg(this.data.map((d) => d.cacheHitRate)),
|
|
452
|
+
avgFilesScanned: avg(this.data.map((d) => d.filesScanned)),
|
|
453
|
+
avgClassesExtracted: avg(this.data.map((d) => d.classesExtracted)),
|
|
454
|
+
phaseAvgs: {
|
|
455
|
+
scan: avg(this.data.map((d) => d.phases.scan)),
|
|
456
|
+
compile: avg(this.data.map((d) => d.phases.compile)),
|
|
457
|
+
engine: avg(this.data.map((d) => d.phases.engine)),
|
|
458
|
+
output: avg(this.data.map((d) => d.phases.output))
|
|
459
|
+
},
|
|
460
|
+
slowestBuildMs: durations[durations.length - 1] ?? 0,
|
|
461
|
+
fastestBuildMs: durations[0] ?? 0
|
|
462
|
+
};
|
|
463
|
+
}
|
|
464
|
+
reset() {
|
|
465
|
+
this.data = [];
|
|
466
|
+
}
|
|
467
|
+
/** Format ringkas untuk CLI output */
|
|
468
|
+
formatCli() {
|
|
469
|
+
const s = this.summary();
|
|
470
|
+
if (!s) return "[telemetry] no data";
|
|
471
|
+
return [
|
|
472
|
+
`[telemetry] ${s.totalBuilds} builds`,
|
|
473
|
+
`avg ${s.avgDurationMs.toFixed(0)}ms`,
|
|
474
|
+
`p95 ${s.p95DurationMs.toFixed(0)}ms`,
|
|
475
|
+
`cache hit ${(s.avgCacheHitRate * 100).toFixed(0)}%`,
|
|
476
|
+
`${s.avgFilesScanned.toFixed(0)} files`
|
|
477
|
+
].join(" \xB7 ");
|
|
478
|
+
}
|
|
479
|
+
/** Export sebagai JSON untuk dashboard/prometheus */
|
|
480
|
+
toJSON() {
|
|
481
|
+
return {
|
|
482
|
+
summary: this.summary(),
|
|
483
|
+
history: this.data.slice(-20)
|
|
484
|
+
// last 20 builds
|
|
485
|
+
};
|
|
486
|
+
}
|
|
487
|
+
};
|
|
488
|
+
_globalCollector = null;
|
|
489
|
+
}
|
|
492
490
|
});
|
|
493
|
-
var PackageJsonSchema = z.object({
|
|
494
|
-
name: z.string(),
|
|
495
|
-
version: z.string(),
|
|
496
|
-
scripts: z.record(z.string(), z.string()).optional(),
|
|
497
|
-
dependencies: z.record(z.string(), z.string()).optional(),
|
|
498
|
-
devDependencies: z.record(z.string(), z.string()).optional(),
|
|
499
|
-
peerDependencies: z.record(z.string(), z.string()).optional(),
|
|
500
|
-
main: z.string().optional(),
|
|
501
|
-
module: z.string().optional(),
|
|
502
|
-
exports: z.unknown().optional(),
|
|
503
|
-
type: z.enum(["module", "commonjs"]).optional()
|
|
504
|
-
}).passthrough();
|
|
505
491
|
function parseJsonWithSchema(jsonString, schema, sourceName) {
|
|
506
492
|
let parsed;
|
|
507
493
|
try {
|
|
@@ -532,12 +518,75 @@ function parseJsonFileWithSchema(filePath, schema) {
|
|
|
532
518
|
}
|
|
533
519
|
return parseJsonWithSchema(content, schema, basename(filePath));
|
|
534
520
|
}
|
|
521
|
+
var ScanCacheClassEntrySchema, ScanCacheSchema, TailwindContentItemSchema, TailwindConfigSchema, RegistryPluginEntrySchema, RegistryFileSchema, PackageJsonSchema;
|
|
522
|
+
var init_configSchemas = __esm({
|
|
523
|
+
"packages/domain/shared/src/configSchemas.ts"() {
|
|
524
|
+
ScanCacheClassEntrySchema = z.object({
|
|
525
|
+
name: z.string().min(1),
|
|
526
|
+
usedIn: z.array(z.string()),
|
|
527
|
+
risk: z.enum(["low", "medium", "high"]).default("low"),
|
|
528
|
+
bundleContribution: z.number().nonnegative().default(0),
|
|
529
|
+
variants: z.array(z.string()).default([])
|
|
530
|
+
});
|
|
531
|
+
ScanCacheSchema = z.object({
|
|
532
|
+
version: z.string().default("1"),
|
|
533
|
+
generatedAt: z.string(),
|
|
534
|
+
root: z.string(),
|
|
535
|
+
classNames: z.array(ScanCacheClassEntrySchema),
|
|
536
|
+
totalFiles: z.number().int().nonnegative(),
|
|
537
|
+
uniqueCount: z.number().int().nonnegative()
|
|
538
|
+
});
|
|
539
|
+
TailwindContentItemSchema = z.union([
|
|
540
|
+
z.string(),
|
|
541
|
+
z.object({
|
|
542
|
+
raw: z.string(),
|
|
543
|
+
extension: z.string().optional()
|
|
544
|
+
}),
|
|
545
|
+
z.object({
|
|
546
|
+
files: z.array(z.string()),
|
|
547
|
+
transform: z.record(z.string(), z.unknown()).optional()
|
|
548
|
+
})
|
|
549
|
+
]);
|
|
550
|
+
TailwindConfigSchema = z.object({
|
|
551
|
+
content: z.array(TailwindContentItemSchema).optional(),
|
|
552
|
+
theme: z.record(z.string(), z.unknown()).optional(),
|
|
553
|
+
plugins: z.array(z.unknown()).optional(),
|
|
554
|
+
darkMode: z.union([z.literal("class"), z.literal("media"), z.literal(false)]).optional(),
|
|
555
|
+
prefix: z.string().optional(),
|
|
556
|
+
safelist: z.array(z.union([z.string(), z.object({ pattern: z.instanceof(RegExp) })])).optional(),
|
|
557
|
+
blocklist: z.array(z.string()).optional()
|
|
558
|
+
}).passthrough();
|
|
559
|
+
RegistryPluginEntrySchema = z.object({
|
|
560
|
+
name: z.string().min(1),
|
|
561
|
+
description: z.string(),
|
|
562
|
+
version: z.string(),
|
|
563
|
+
tags: z.array(z.string()).default([]),
|
|
564
|
+
official: z.boolean().default(false),
|
|
565
|
+
docs: z.string().url().optional(),
|
|
566
|
+
install: z.string().optional(),
|
|
567
|
+
integrity: z.string().optional()
|
|
568
|
+
});
|
|
569
|
+
RegistryFileSchema = z.object({
|
|
570
|
+
version: z.string(),
|
|
571
|
+
official: z.array(RegistryPluginEntrySchema).default([]),
|
|
572
|
+
community: z.array(RegistryPluginEntrySchema).default([])
|
|
573
|
+
});
|
|
574
|
+
PackageJsonSchema = z.object({
|
|
575
|
+
name: z.string(),
|
|
576
|
+
version: z.string(),
|
|
577
|
+
scripts: z.record(z.string(), z.string()).optional(),
|
|
578
|
+
dependencies: z.record(z.string(), z.string()).optional(),
|
|
579
|
+
devDependencies: z.record(z.string(), z.string()).optional(),
|
|
580
|
+
peerDependencies: z.record(z.string(), z.string()).optional(),
|
|
581
|
+
main: z.string().optional(),
|
|
582
|
+
module: z.string().optional(),
|
|
583
|
+
exports: z.unknown().optional(),
|
|
584
|
+
type: z.enum(["module", "commonjs"]).optional()
|
|
585
|
+
}).passthrough();
|
|
586
|
+
}
|
|
587
|
+
});
|
|
535
588
|
|
|
536
589
|
// packages/domain/shared/src/workerResolver.ts
|
|
537
|
-
var isBrowser2 = typeof window !== "undefined" || typeof document !== "undefined";
|
|
538
|
-
var NODE_URL = typeof window === "undefined" || typeof document === "undefined" ? "node:url" : null;
|
|
539
|
-
var NODE_FS = typeof window === "undefined" || typeof document === "undefined" ? "node:fs" : null;
|
|
540
|
-
var NODE_PATH = typeof window === "undefined" || typeof document === "undefined" ? "node:path" : null;
|
|
541
590
|
function getDirnameFromUrl(importMetaUrl) {
|
|
542
591
|
if (!importMetaUrl) return "";
|
|
543
592
|
if (isBrowser2) return "";
|
|
@@ -563,11 +612,11 @@ function resolvePath(...segments) {
|
|
|
563
612
|
return segments.join("/").replace(/\/+/g, "/");
|
|
564
613
|
}
|
|
565
614
|
}
|
|
566
|
-
function existsSync(
|
|
615
|
+
function existsSync(path6) {
|
|
567
616
|
if (isBrowser2) return false;
|
|
568
617
|
try {
|
|
569
618
|
const nodeFs = __require(NODE_FS);
|
|
570
|
-
return nodeFs.existsSync(
|
|
619
|
+
return nodeFs.existsSync(path6);
|
|
571
620
|
} catch {
|
|
572
621
|
return false;
|
|
573
622
|
}
|
|
@@ -617,6 +666,15 @@ function resolveLoaderPath(loaderBasename, importMetaUrl) {
|
|
|
617
666
|
subdirs: [".", "loaders", "lib"]
|
|
618
667
|
}).path;
|
|
619
668
|
}
|
|
669
|
+
var isBrowser2, NODE_URL, NODE_FS, NODE_PATH;
|
|
670
|
+
var init_workerResolver = __esm({
|
|
671
|
+
"packages/domain/shared/src/workerResolver.ts"() {
|
|
672
|
+
isBrowser2 = typeof window !== "undefined" || typeof document !== "undefined";
|
|
673
|
+
NODE_URL = typeof window === "undefined" || typeof document === "undefined" ? "node:url" : null;
|
|
674
|
+
NODE_FS = typeof window === "undefined" || typeof document === "undefined" ? "node:fs" : null;
|
|
675
|
+
NODE_PATH = typeof window === "undefined" || typeof document === "undefined" ? "node:path" : null;
|
|
676
|
+
}
|
|
677
|
+
});
|
|
620
678
|
|
|
621
679
|
// packages/domain/shared/src/codegen.ts
|
|
622
680
|
function generateComponentCode(opts) {
|
|
@@ -774,16 +832,10 @@ function generateBarrelFile(exports$1, dir, opts = {}) {
|
|
|
774
832
|
}
|
|
775
833
|
return lines.join("\n");
|
|
776
834
|
}
|
|
777
|
-
var
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
"linux-arm64": ["@tailwind-styled/native-linux-arm64-gnu", "@tailwind-styled/native-linux-arm64"],
|
|
782
|
-
"darwin-x64": ["@tailwind-styled/native-darwin-x64"],
|
|
783
|
-
"darwin-arm64": ["@tailwind-styled/native-darwin-arm64"],
|
|
784
|
-
"win32-x64": ["@tailwind-styled/native-win32-x64-msvc", "@tailwind-styled/native-win32-x64"],
|
|
785
|
-
"win32-arm64": ["@tailwind-styled/native-win32-arm64-msvc", "@tailwind-styled/native-win32-arm64"]
|
|
786
|
-
};
|
|
835
|
+
var init_codegen = __esm({
|
|
836
|
+
"packages/domain/shared/src/codegen.ts"() {
|
|
837
|
+
}
|
|
838
|
+
});
|
|
787
839
|
function platformKey() {
|
|
788
840
|
if (isBrowser3) return "browser";
|
|
789
841
|
return `${process.platform}-${process.arch}`;
|
|
@@ -794,12 +846,12 @@ function resolveNativeBinary(runtimeDir) {
|
|
|
794
846
|
if (isBrowser3) {
|
|
795
847
|
return { path: null, source: "not-found", platform, tried: ["not available in browser"] };
|
|
796
848
|
}
|
|
797
|
-
if (process.env.TWS_DISABLE_NATIVE === "1") {
|
|
849
|
+
if (process.env.TWS_NO_NATIVE === "1" || process.env.TWS_DISABLE_NATIVE === "1") {
|
|
798
850
|
return { path: null, source: "not-found", platform, tried: [] };
|
|
799
851
|
}
|
|
800
852
|
const envPath = process.env.TW_NATIVE_PATH?.trim();
|
|
801
853
|
if (envPath) {
|
|
802
|
-
if (
|
|
854
|
+
if (fs3.existsSync(envPath)) {
|
|
803
855
|
return { path: envPath, source: "env", platform, tried };
|
|
804
856
|
}
|
|
805
857
|
tried.push(`env:${envPath} (not found)`);
|
|
@@ -808,7 +860,7 @@ function resolveNativeBinary(runtimeDir) {
|
|
|
808
860
|
for (const pkg of prebuiltPkgs) {
|
|
809
861
|
try {
|
|
810
862
|
const candidate = _require.resolve(`${pkg}/tailwind_styled_parser.node`);
|
|
811
|
-
if (
|
|
863
|
+
if (fs3.existsSync(candidate)) {
|
|
812
864
|
return { path: candidate, source: "prebuilt", platform, tried };
|
|
813
865
|
}
|
|
814
866
|
tried.push(`prebuilt:${pkg} (resolved but missing)`);
|
|
@@ -825,7 +877,7 @@ function resolveNativeBinary(runtimeDir) {
|
|
|
825
877
|
for (const suffix of ["", `.${platform}`, `.${napiPlatform}`]) {
|
|
826
878
|
const candidate = path.resolve(pkgRoot, "native", `${bin}${suffix}.node`);
|
|
827
879
|
tried.push(`self-bundled:${candidate}`);
|
|
828
|
-
if (
|
|
880
|
+
if (fs3.existsSync(candidate)) {
|
|
829
881
|
return { path: candidate, source: "prebuilt", platform, tried };
|
|
830
882
|
}
|
|
831
883
|
}
|
|
@@ -859,7 +911,7 @@ function resolveNativeBinary(runtimeDir) {
|
|
|
859
911
|
}
|
|
860
912
|
for (const candidate of localCandidates) {
|
|
861
913
|
tried.push(`local:${candidate}`);
|
|
862
|
-
if (
|
|
914
|
+
if (fs3.existsSync(candidate)) {
|
|
863
915
|
return { path: candidate, source: "local", platform, tried };
|
|
864
916
|
}
|
|
865
917
|
}
|
|
@@ -879,13 +931,28 @@ function formatNativeNotFoundError(result) {
|
|
|
879
931
|
];
|
|
880
932
|
return lines.join("\n");
|
|
881
933
|
}
|
|
934
|
+
var isBrowser3, _require, PLATFORM_MAP;
|
|
935
|
+
var init_native_resolution = __esm({
|
|
936
|
+
"packages/domain/shared/src/native-resolution.ts"() {
|
|
937
|
+
isBrowser3 = typeof window !== "undefined" || typeof document !== "undefined";
|
|
938
|
+
_require = typeof __require !== "undefined" ? __require : createRequire(import.meta.url);
|
|
939
|
+
PLATFORM_MAP = {
|
|
940
|
+
"linux-x64": ["@tailwind-styled/native-linux-x64-gnu", "@tailwind-styled/native-linux-x64"],
|
|
941
|
+
"linux-arm64": ["@tailwind-styled/native-linux-arm64-gnu", "@tailwind-styled/native-linux-arm64"],
|
|
942
|
+
"darwin-x64": ["@tailwind-styled/native-darwin-x64"],
|
|
943
|
+
"darwin-arm64": ["@tailwind-styled/native-darwin-arm64"],
|
|
944
|
+
"win32-x64": ["@tailwind-styled/native-win32-x64-msvc", "@tailwind-styled/native-win32-x64"],
|
|
945
|
+
"win32-arm64": ["@tailwind-styled/native-win32-arm64-msvc", "@tailwind-styled/native-win32-arm64"]
|
|
946
|
+
};
|
|
947
|
+
}
|
|
948
|
+
});
|
|
882
949
|
|
|
883
950
|
// packages/domain/shared/src/observability.ts
|
|
884
951
|
function createObservabilityClient(opts = {}) {
|
|
885
952
|
const { baseUrl = "http://localhost:7421", timeoutMs = 3e3 } = opts;
|
|
886
|
-
async function fetchJson(
|
|
953
|
+
async function fetchJson(path6) {
|
|
887
954
|
try {
|
|
888
|
-
const res = await fetch(`${baseUrl}${
|
|
955
|
+
const res = await fetch(`${baseUrl}${path6}`, {
|
|
889
956
|
signal: AbortSignal.timeout(timeoutMs)
|
|
890
957
|
});
|
|
891
958
|
if (!res.ok) return null;
|
|
@@ -912,222 +979,2718 @@ function createObservabilityClient(opts = {}) {
|
|
|
912
979
|
}
|
|
913
980
|
};
|
|
914
981
|
}
|
|
982
|
+
var init_observability = __esm({
|
|
983
|
+
"packages/domain/shared/src/observability.ts"() {
|
|
984
|
+
}
|
|
985
|
+
});
|
|
915
986
|
|
|
916
|
-
// packages/domain/
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
987
|
+
// packages/domain/compiler/src/nativeBridge.ts
|
|
988
|
+
var _loadNative, log, NATIVE_UNAVAILABLE_MESSAGE, nativeBridge, bridgeLoadAttempted, bridgeLoadError, isValidNativeBridge, getNativeBridge, adaptNativeResult;
|
|
989
|
+
var init_nativeBridge = __esm({
|
|
990
|
+
"packages/domain/compiler/src/nativeBridge.ts"() {
|
|
991
|
+
init_src2();
|
|
992
|
+
_loadNative = (path6) => __require(path6);
|
|
993
|
+
log = (...args) => {
|
|
994
|
+
if (process.env.DEBUG?.includes("compiler:native")) {
|
|
995
|
+
console.log("[compiler:native]", ...args);
|
|
996
|
+
}
|
|
997
|
+
};
|
|
998
|
+
NATIVE_UNAVAILABLE_MESSAGE = "[tailwind-styled/compiler v5] Native binding is required but not available.\nThis package requires native Rust bindings. There is no JavaScript fallback.\nPlease ensure:\n 1. The native module is properly installed\n 2. You have run: npm run build:rust (or use prebuilt binary)\n\nFor help, see: https://tailwind-styled.dev/docs/install";
|
|
999
|
+
nativeBridge = null;
|
|
1000
|
+
bridgeLoadAttempted = false;
|
|
1001
|
+
bridgeLoadError = null;
|
|
1002
|
+
isValidNativeBridge = (mod) => {
|
|
1003
|
+
const m = mod;
|
|
1004
|
+
return !!(typeof m.transformSource === "function" || typeof m.extractAllClasses === "function" || typeof m.hasTwUsage === "function");
|
|
1005
|
+
};
|
|
1006
|
+
getNativeBridge = () => {
|
|
1007
|
+
if (nativeBridge) {
|
|
1008
|
+
return nativeBridge;
|
|
1009
|
+
}
|
|
1010
|
+
if (bridgeLoadAttempted) {
|
|
1011
|
+
if (bridgeLoadError) {
|
|
1012
|
+
throw bridgeLoadError;
|
|
1013
|
+
}
|
|
1014
|
+
throw new Error(NATIVE_UNAVAILABLE_MESSAGE);
|
|
1015
|
+
}
|
|
1016
|
+
bridgeLoadAttempted = true;
|
|
1017
|
+
try {
|
|
1018
|
+
const runtimeDir = resolveRuntimeDir(void 0, import.meta.url);
|
|
1019
|
+
const result = resolveNativeBinary(runtimeDir);
|
|
1020
|
+
if (result.path && result.path.endsWith(".node")) {
|
|
1021
|
+
try {
|
|
1022
|
+
const binding = _loadNative(result.path);
|
|
1023
|
+
if (isValidNativeBridge(binding)) {
|
|
1024
|
+
nativeBridge = binding;
|
|
1025
|
+
log("Native bridge loaded successfully from:", result.path);
|
|
1026
|
+
return nativeBridge;
|
|
1027
|
+
}
|
|
1028
|
+
} catch (e) {
|
|
1029
|
+
log("Failed to require native binding:", e);
|
|
1030
|
+
}
|
|
1031
|
+
}
|
|
1032
|
+
throw new Error(`${NATIVE_UNAVAILABLE_MESSAGE}
|
|
1033
|
+
|
|
1034
|
+
Tried paths: ${result.tried.join("\n")}`);
|
|
1035
|
+
} catch (err) {
|
|
1036
|
+
bridgeLoadError = err instanceof Error ? err : new Error(String(err));
|
|
1037
|
+
log("Failed to load native bridge:", bridgeLoadError.message);
|
|
1038
|
+
throw bridgeLoadError;
|
|
1039
|
+
}
|
|
1040
|
+
};
|
|
1041
|
+
adaptNativeResult = (raw) => {
|
|
1042
|
+
return {
|
|
1043
|
+
code: raw.code ?? "",
|
|
1044
|
+
classes: raw.classes ?? [],
|
|
1045
|
+
changed: raw.changed ?? false,
|
|
1046
|
+
rsc: raw.rscJson ? JSON.parse(raw.rscJson) : void 0,
|
|
1047
|
+
metadata: raw.metadataJson ? JSON.parse(raw.metadataJson) : void 0
|
|
1048
|
+
};
|
|
1049
|
+
};
|
|
1050
|
+
if (typeof process !== "undefined" && !bridgeLoadAttempted) {
|
|
1051
|
+
try {
|
|
1052
|
+
getNativeBridge();
|
|
1053
|
+
} catch {
|
|
1054
|
+
}
|
|
979
1055
|
}
|
|
980
|
-
return new _TwError("rust", "RUST_ERROR", String(err), err);
|
|
981
1056
|
}
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
return new _TwError(source, code, String(err), err);
|
|
993
|
-
}
|
|
994
|
-
toString() {
|
|
995
|
-
return `TwError [${this.source}:${this.code}] ${this.message}`;
|
|
1057
|
+
});
|
|
1058
|
+
|
|
1059
|
+
// packages/domain/compiler/src/compiler/cssGeneratorNative.ts
|
|
1060
|
+
async function generateCssNative(classes, options) {
|
|
1061
|
+
const { theme } = options;
|
|
1062
|
+
const native = getNativeBridge();
|
|
1063
|
+
if (!native?.generateCssNative) {
|
|
1064
|
+
throw new Error(
|
|
1065
|
+
"FATAL: Rust CSS generator (generateCssNative) is required but not available. Ensure native binding is properly loaded. Check that native/.node binary exists."
|
|
1066
|
+
);
|
|
996
1067
|
}
|
|
997
|
-
|
|
998
|
-
|
|
1068
|
+
const themeJson = JSON.stringify(theme);
|
|
1069
|
+
const css = native.generateCssNative(classes, themeJson);
|
|
1070
|
+
return css;
|
|
1071
|
+
}
|
|
1072
|
+
function clearThemeCache() {
|
|
1073
|
+
try {
|
|
1074
|
+
const native = getNativeBridge();
|
|
1075
|
+
if (!native?.clearThemeCache) {
|
|
1076
|
+
return;
|
|
1077
|
+
}
|
|
1078
|
+
native.clearThemeCache();
|
|
1079
|
+
} catch {
|
|
999
1080
|
}
|
|
1000
|
-
|
|
1001
|
-
|
|
1081
|
+
}
|
|
1082
|
+
var init_cssGeneratorNative = __esm({
|
|
1083
|
+
"packages/domain/compiler/src/compiler/cssGeneratorNative.ts"() {
|
|
1084
|
+
init_nativeBridge();
|
|
1002
1085
|
}
|
|
1003
|
-
};
|
|
1004
|
-
|
|
1005
|
-
|
|
1086
|
+
});
|
|
1087
|
+
|
|
1088
|
+
// packages/domain/compiler/src/compiler/compilationNative.ts
|
|
1089
|
+
function compileCssNative2(classes, prefix) {
|
|
1090
|
+
const native = getNativeBridge();
|
|
1091
|
+
if (!native?.compileCss) throw new Error("compileCss not available");
|
|
1092
|
+
return native.compileCss(classes, prefix);
|
|
1006
1093
|
}
|
|
1007
|
-
function
|
|
1008
|
-
|
|
1094
|
+
function compileCssLightning(classes) {
|
|
1095
|
+
const native = getNativeBridge();
|
|
1096
|
+
if (!native?.compileCssLightning) throw new Error("compileCssLightning not available");
|
|
1097
|
+
return native.compileCssLightning(classes);
|
|
1009
1098
|
}
|
|
1010
|
-
function
|
|
1011
|
-
const
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
const candidatePath = path__default.resolve(runtimeDir, candidate);
|
|
1015
|
-
try {
|
|
1016
|
-
if (!fs__default.existsSync(candidatePath) && !fs__default.existsSync(candidatePath + ".node")) {
|
|
1017
|
-
continue;
|
|
1018
|
-
}
|
|
1019
|
-
const mod = requireNativeModule(candidatePath);
|
|
1020
|
-
if (mod && isValid(mod)) {
|
|
1021
|
-
return { binding: mod, loadErrors, loadedPath: candidatePath };
|
|
1022
|
-
}
|
|
1023
|
-
loadErrors.push({ path: candidatePath, message: options.invalidExportMessage });
|
|
1024
|
-
} catch (e) {
|
|
1025
|
-
loadErrors.push({ path: candidatePath, message: e instanceof Error ? e.message : String(e) });
|
|
1026
|
-
}
|
|
1027
|
-
}
|
|
1028
|
-
return { binding: null, loadErrors };
|
|
1099
|
+
function extractTwStateConfigsNative(source, filename) {
|
|
1100
|
+
const native = getNativeBridge();
|
|
1101
|
+
if (!native?.extractTwStateConfigs) throw new Error("extractTwStateConfigs not available");
|
|
1102
|
+
return native.extractTwStateConfigs(source, filename);
|
|
1029
1103
|
}
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1104
|
+
function generateStaticStateCssNative(inputs, resolvedCss) {
|
|
1105
|
+
const native = getNativeBridge();
|
|
1106
|
+
if (!native?.generateStaticStateCss) throw new Error("generateStaticStateCss not available");
|
|
1107
|
+
return native.generateStaticStateCss(inputs, resolvedCss ?? null);
|
|
1033
1108
|
}
|
|
1034
|
-
function
|
|
1035
|
-
const
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
const
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1109
|
+
function extractAndGenerateStateCssNative(source, filename) {
|
|
1110
|
+
const native = getNativeBridge();
|
|
1111
|
+
if (!native?.extractAndGenerateStateCss) throw new Error("extractAndGenerateStateCss not available");
|
|
1112
|
+
return native.extractAndGenerateStateCss(source, filename);
|
|
1113
|
+
}
|
|
1114
|
+
function layoutClassesToCss(classes) {
|
|
1115
|
+
const native = getNativeBridge();
|
|
1116
|
+
if (!native?.layoutClassesToCss) throw new Error("layoutClassesToCss not available");
|
|
1117
|
+
return native.layoutClassesToCss(classes);
|
|
1118
|
+
}
|
|
1119
|
+
function hashContent(input, algorithm = "sha256", length = 8) {
|
|
1120
|
+
const native = getNativeBridge();
|
|
1121
|
+
if (!native?.hashContent) throw new Error("hashContent not available");
|
|
1122
|
+
return native.hashContent(input, algorithm, length);
|
|
1123
|
+
}
|
|
1124
|
+
function extractTwContainerConfigs(source) {
|
|
1125
|
+
const native = getNativeBridge();
|
|
1126
|
+
if (!native?.extractTwContainerConfigs) throw new Error("extractTwContainerConfigs not available");
|
|
1127
|
+
return native.extractTwContainerConfigs(source);
|
|
1128
|
+
}
|
|
1129
|
+
function parseAtomicClass(twClass) {
|
|
1130
|
+
const native = getNativeBridge();
|
|
1131
|
+
if (!native?.parseAtomicClass) throw new Error("parseAtomicClass not available");
|
|
1132
|
+
return native.parseAtomicClass(twClass);
|
|
1133
|
+
}
|
|
1134
|
+
function generateAtomicCss(rulesJson) {
|
|
1135
|
+
const native = getNativeBridge();
|
|
1136
|
+
if (!native?.generateAtomicCss) throw new Error("generateAtomicCss not available");
|
|
1137
|
+
return native.generateAtomicCss(rulesJson);
|
|
1138
|
+
}
|
|
1139
|
+
function toAtomicClasses(twClasses) {
|
|
1140
|
+
const native = getNativeBridge();
|
|
1141
|
+
if (!native?.toAtomicClasses) throw new Error("toAtomicClasses not available");
|
|
1142
|
+
return native.toAtomicClasses(twClasses);
|
|
1143
|
+
}
|
|
1144
|
+
function clearAtomicRegistry() {
|
|
1145
|
+
const native = getNativeBridge();
|
|
1146
|
+
if (!native?.clearAtomicRegistry) return;
|
|
1147
|
+
native.clearAtomicRegistry();
|
|
1148
|
+
}
|
|
1149
|
+
function atomicRegistrySize() {
|
|
1150
|
+
const native = getNativeBridge();
|
|
1151
|
+
if (!native?.atomicRegistrySize) return 0;
|
|
1152
|
+
return native.atomicRegistrySize();
|
|
1153
|
+
}
|
|
1154
|
+
var init_compilationNative = __esm({
|
|
1155
|
+
"packages/domain/compiler/src/compiler/compilationNative.ts"() {
|
|
1156
|
+
init_nativeBridge();
|
|
1056
1157
|
}
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1158
|
+
});
|
|
1159
|
+
|
|
1160
|
+
// packages/domain/compiler/src/compiler/cssCompilationNative.ts
|
|
1161
|
+
function compileClass(input) {
|
|
1162
|
+
const native = getNativeBridge();
|
|
1163
|
+
if (!native?.compile_class) throw new Error("compile_class not available");
|
|
1164
|
+
const resultJson = native.compile_class(input);
|
|
1165
|
+
try {
|
|
1166
|
+
return JSON.parse(resultJson);
|
|
1167
|
+
} catch {
|
|
1168
|
+
return {
|
|
1169
|
+
selector: "",
|
|
1170
|
+
declarations: "",
|
|
1171
|
+
properties: [],
|
|
1172
|
+
specificity: 0
|
|
1173
|
+
};
|
|
1069
1174
|
}
|
|
1070
|
-
return Array.from(new Set(candidates));
|
|
1071
1175
|
}
|
|
1072
|
-
function
|
|
1073
|
-
|
|
1176
|
+
function compileClasses(inputs) {
|
|
1177
|
+
const native = getNativeBridge();
|
|
1178
|
+
if (!native?.compile_classes) throw new Error("compile_classes not available");
|
|
1179
|
+
const resultJson = native.compile_classes(inputs);
|
|
1074
1180
|
try {
|
|
1075
|
-
return
|
|
1181
|
+
return JSON.parse(resultJson);
|
|
1076
1182
|
} catch {
|
|
1077
|
-
return
|
|
1183
|
+
return {
|
|
1184
|
+
css: "",
|
|
1185
|
+
resolved_classes: [],
|
|
1186
|
+
unknown_classes: [],
|
|
1187
|
+
size_bytes: 0,
|
|
1188
|
+
duration_ms: 0
|
|
1189
|
+
};
|
|
1078
1190
|
}
|
|
1079
1191
|
}
|
|
1080
|
-
function
|
|
1081
|
-
const
|
|
1082
|
-
|
|
1192
|
+
function compileToCss(input, minify) {
|
|
1193
|
+
const native = getNativeBridge();
|
|
1194
|
+
if (!native?.compile_to_css) throw new Error("compile_to_css not available");
|
|
1195
|
+
return native.compile_to_css(input, minify ?? false);
|
|
1083
1196
|
}
|
|
1084
|
-
function
|
|
1085
|
-
|
|
1086
|
-
if (
|
|
1087
|
-
return
|
|
1197
|
+
function compileToCssBatch(inputs, minify) {
|
|
1198
|
+
const native = getNativeBridge();
|
|
1199
|
+
if (!native?.compile_to_css_batch) throw new Error("compile_to_css_batch not available");
|
|
1200
|
+
return native.compile_to_css_batch(inputs, minify ?? false);
|
|
1088
1201
|
}
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
return
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
}
|
|
1107
|
-
const firstKey = this.cache.keys().next().value;
|
|
1108
|
-
if (firstKey !== void 0) {
|
|
1109
|
-
this.cache.delete(firstKey);
|
|
1110
|
-
}
|
|
1111
|
-
}
|
|
1112
|
-
this.cache.set(key, value);
|
|
1113
|
-
}
|
|
1114
|
-
delete(key) {
|
|
1115
|
-
return this.cache.delete(key);
|
|
1202
|
+
function minifyCss(css) {
|
|
1203
|
+
const native = getNativeBridge();
|
|
1204
|
+
if (!native?.minify_css) throw new Error("minify_css not available");
|
|
1205
|
+
return native.minify_css(css);
|
|
1206
|
+
}
|
|
1207
|
+
function compileAnimation(animationName, from, to) {
|
|
1208
|
+
const native = getNativeBridge();
|
|
1209
|
+
if (!native?.compile_animation) throw new Error("compile_animation not available");
|
|
1210
|
+
const resultJson = native.compile_animation(animationName, from, to);
|
|
1211
|
+
try {
|
|
1212
|
+
return JSON.parse(resultJson);
|
|
1213
|
+
} catch {
|
|
1214
|
+
return {
|
|
1215
|
+
animation_id: "",
|
|
1216
|
+
keyframes_css: "",
|
|
1217
|
+
animation_rule: "",
|
|
1218
|
+
duration_ms: 0
|
|
1219
|
+
};
|
|
1116
1220
|
}
|
|
1117
|
-
|
|
1118
|
-
|
|
1221
|
+
}
|
|
1222
|
+
function compileKeyframes(name, stopsJson) {
|
|
1223
|
+
const native = getNativeBridge();
|
|
1224
|
+
if (!native?.compile_keyframes) throw new Error("compile_keyframes not available");
|
|
1225
|
+
const resultJson = native.compile_keyframes(name, stopsJson);
|
|
1226
|
+
try {
|
|
1227
|
+
return JSON.parse(resultJson);
|
|
1228
|
+
} catch {
|
|
1229
|
+
return {
|
|
1230
|
+
animation_id: "",
|
|
1231
|
+
keyframes_css: "",
|
|
1232
|
+
animation_rule: "",
|
|
1233
|
+
duration_ms: 0
|
|
1234
|
+
};
|
|
1119
1235
|
}
|
|
1120
|
-
|
|
1121
|
-
|
|
1236
|
+
}
|
|
1237
|
+
function compileTheme(tokensJson, themeName, prefix) {
|
|
1238
|
+
const native = getNativeBridge();
|
|
1239
|
+
if (!native?.compile_theme) throw new Error("compile_theme not available");
|
|
1240
|
+
const resultJson = native.compile_theme(tokensJson, themeName, prefix);
|
|
1241
|
+
try {
|
|
1242
|
+
return JSON.parse(resultJson);
|
|
1243
|
+
} catch {
|
|
1244
|
+
return {
|
|
1245
|
+
selector: ":root",
|
|
1246
|
+
variables: [],
|
|
1247
|
+
variables_css: "",
|
|
1248
|
+
theme_name: themeName
|
|
1249
|
+
};
|
|
1122
1250
|
}
|
|
1123
|
-
|
|
1124
|
-
|
|
1251
|
+
}
|
|
1252
|
+
function twMerge(classString) {
|
|
1253
|
+
const native = getNativeBridge();
|
|
1254
|
+
if (!native?.tw_merge) throw new Error("tw_merge not available");
|
|
1255
|
+
return native.tw_merge(classString);
|
|
1256
|
+
}
|
|
1257
|
+
function twMergeMany(classStrings) {
|
|
1258
|
+
const native = getNativeBridge();
|
|
1259
|
+
if (!native?.tw_merge_many) throw new Error("tw_merge_many not available");
|
|
1260
|
+
return native.tw_merge_many(classStrings);
|
|
1261
|
+
}
|
|
1262
|
+
function twMergeWithSeparator(classString, options) {
|
|
1263
|
+
const native = getNativeBridge();
|
|
1264
|
+
if (!native?.tw_merge_with_separator)
|
|
1265
|
+
throw new Error("tw_merge_with_separator not available");
|
|
1266
|
+
const opts = {
|
|
1267
|
+
separator: options.separator,
|
|
1268
|
+
debug: options.debug
|
|
1269
|
+
};
|
|
1270
|
+
return native.tw_merge_with_separator(classString, opts);
|
|
1271
|
+
}
|
|
1272
|
+
function twMergeManyWithSeparator(classStrings, options) {
|
|
1273
|
+
const native = getNativeBridge();
|
|
1274
|
+
if (!native?.tw_merge_many_with_separator)
|
|
1275
|
+
throw new Error("tw_merge_many_with_separator not available");
|
|
1276
|
+
const opts = {
|
|
1277
|
+
separator: options.separator,
|
|
1278
|
+
debug: options.debug
|
|
1279
|
+
};
|
|
1280
|
+
return native.tw_merge_many_with_separator(classStrings, opts);
|
|
1281
|
+
}
|
|
1282
|
+
function twMergeRaw(classLists) {
|
|
1283
|
+
const native = getNativeBridge();
|
|
1284
|
+
if (!native?.tw_merge_raw) throw new Error("tw_merge_raw not available");
|
|
1285
|
+
return native.tw_merge_raw(classLists);
|
|
1286
|
+
}
|
|
1287
|
+
var init_cssCompilationNative = __esm({
|
|
1288
|
+
"packages/domain/compiler/src/compiler/cssCompilationNative.ts"() {
|
|
1289
|
+
init_nativeBridge();
|
|
1125
1290
|
}
|
|
1126
|
-
|
|
1127
|
-
|
|
1291
|
+
});
|
|
1292
|
+
|
|
1293
|
+
// packages/domain/compiler/src/compiler/idRegistryNative.ts
|
|
1294
|
+
function idRegistryCreate() {
|
|
1295
|
+
const native = getNativeBridge();
|
|
1296
|
+
if (!native?.id_registry_create) throw new Error("id_registry_create not available");
|
|
1297
|
+
return native.id_registry_create();
|
|
1298
|
+
}
|
|
1299
|
+
function idRegistryGenerate(handle, name) {
|
|
1300
|
+
const native = getNativeBridge();
|
|
1301
|
+
if (!native?.id_registry_generate) throw new Error("id_registry_generate not available");
|
|
1302
|
+
return native.id_registry_generate(handle, name);
|
|
1303
|
+
}
|
|
1304
|
+
function idRegistryLookup(handle, name) {
|
|
1305
|
+
const native = getNativeBridge();
|
|
1306
|
+
if (!native?.id_registry_lookup) throw new Error("id_registry_lookup not available");
|
|
1307
|
+
return native.id_registry_lookup(handle, name);
|
|
1308
|
+
}
|
|
1309
|
+
function idRegistryNext(handle) {
|
|
1310
|
+
const native = getNativeBridge();
|
|
1311
|
+
if (!native?.id_registry_next) throw new Error("id_registry_next not available");
|
|
1312
|
+
return native.id_registry_next(handle);
|
|
1313
|
+
}
|
|
1314
|
+
function idRegistryDestroy(handle) {
|
|
1315
|
+
const native = getNativeBridge();
|
|
1316
|
+
if (!native?.id_registry_destroy) return;
|
|
1317
|
+
native.id_registry_destroy(handle);
|
|
1318
|
+
}
|
|
1319
|
+
function idRegistryReset(handle) {
|
|
1320
|
+
const native = getNativeBridge();
|
|
1321
|
+
if (!native?.id_registry_reset) return;
|
|
1322
|
+
native.id_registry_reset(handle);
|
|
1323
|
+
}
|
|
1324
|
+
function idRegistrySnapshot(handle) {
|
|
1325
|
+
const native = getNativeBridge();
|
|
1326
|
+
if (!native?.id_registry_snapshot) throw new Error("id_registry_snapshot not available");
|
|
1327
|
+
const snapshotJson = native.id_registry_snapshot(handle);
|
|
1328
|
+
try {
|
|
1329
|
+
return JSON.parse(snapshotJson);
|
|
1330
|
+
} catch {
|
|
1331
|
+
return {
|
|
1332
|
+
handle,
|
|
1333
|
+
next_id: 0,
|
|
1334
|
+
entries: [],
|
|
1335
|
+
total_entries: 0
|
|
1336
|
+
};
|
|
1128
1337
|
}
|
|
1129
|
-
}
|
|
1338
|
+
}
|
|
1339
|
+
function idRegistryActiveCount() {
|
|
1340
|
+
const native = getNativeBridge();
|
|
1341
|
+
if (!native?.id_registry_active_count) throw new Error("id_registry_active_count not available");
|
|
1342
|
+
return native.id_registry_active_count();
|
|
1343
|
+
}
|
|
1344
|
+
function registerPropertyName(propertyName) {
|
|
1345
|
+
const native = getNativeBridge();
|
|
1346
|
+
if (!native?.register_property_name)
|
|
1347
|
+
throw new Error("register_property_name not available");
|
|
1348
|
+
return native.register_property_name(propertyName);
|
|
1349
|
+
}
|
|
1350
|
+
function registerValueName(valueName) {
|
|
1351
|
+
const native = getNativeBridge();
|
|
1352
|
+
if (!native?.register_value_name) throw new Error("register_value_name not available");
|
|
1353
|
+
return native.register_value_name(valueName);
|
|
1354
|
+
}
|
|
1355
|
+
function propertyIdToString(propertyId) {
|
|
1356
|
+
const native = getNativeBridge();
|
|
1357
|
+
if (!native?.property_id_to_string) throw new Error("property_id_to_string not available");
|
|
1358
|
+
return native.property_id_to_string(propertyId);
|
|
1359
|
+
}
|
|
1360
|
+
function valueIdToString(valueId) {
|
|
1361
|
+
const native = getNativeBridge();
|
|
1362
|
+
if (!native?.value_id_to_string) throw new Error("value_id_to_string not available");
|
|
1363
|
+
return native.value_id_to_string(valueId);
|
|
1364
|
+
}
|
|
1365
|
+
function reverseLookupProperty(propertyId) {
|
|
1366
|
+
const native = getNativeBridge();
|
|
1367
|
+
if (!native?.reverse_lookup_property)
|
|
1368
|
+
throw new Error("reverse_lookup_property not available");
|
|
1369
|
+
return native.reverse_lookup_property(propertyId);
|
|
1370
|
+
}
|
|
1371
|
+
function reverseLookupValue(valueId) {
|
|
1372
|
+
const native = getNativeBridge();
|
|
1373
|
+
if (!native?.reverse_lookup_value) throw new Error("reverse_lookup_value not available");
|
|
1374
|
+
return native.reverse_lookup_value(valueId);
|
|
1375
|
+
}
|
|
1376
|
+
function idRegistryExport(handle) {
|
|
1377
|
+
const native = getNativeBridge();
|
|
1378
|
+
if (!native?.id_registry_export) throw new Error("id_registry_export not available");
|
|
1379
|
+
return native.id_registry_export(handle);
|
|
1380
|
+
}
|
|
1381
|
+
function idRegistryImport(importedData) {
|
|
1382
|
+
const native = getNativeBridge();
|
|
1383
|
+
if (!native?.id_registry_import) throw new Error("id_registry_import not available");
|
|
1384
|
+
return native.id_registry_import(importedData);
|
|
1385
|
+
}
|
|
1386
|
+
var init_idRegistryNative = __esm({
|
|
1387
|
+
"packages/domain/compiler/src/compiler/idRegistryNative.ts"() {
|
|
1388
|
+
init_nativeBridge();
|
|
1389
|
+
}
|
|
1390
|
+
});
|
|
1391
|
+
|
|
1392
|
+
// packages/domain/compiler/src/compiler/streamingNative.ts
|
|
1393
|
+
function processFileChange(fileChangeJson) {
|
|
1394
|
+
const native = getNativeBridge();
|
|
1395
|
+
if (!native?.process_file_change) throw new Error("process_file_change not available");
|
|
1396
|
+
const resultJson = native.process_file_change(fileChangeJson);
|
|
1397
|
+
try {
|
|
1398
|
+
return JSON.parse(resultJson);
|
|
1399
|
+
} catch {
|
|
1400
|
+
return {
|
|
1401
|
+
file_path: "",
|
|
1402
|
+
status: "error",
|
|
1403
|
+
old_classes: [],
|
|
1404
|
+
new_classes: [],
|
|
1405
|
+
added_classes: [],
|
|
1406
|
+
removed_classes: [],
|
|
1407
|
+
changed: false,
|
|
1408
|
+
fingerprint: "",
|
|
1409
|
+
error: "Failed to parse result"
|
|
1410
|
+
};
|
|
1411
|
+
}
|
|
1412
|
+
}
|
|
1413
|
+
function computeIncrementalDiff(oldScanJson, newScanJson) {
|
|
1414
|
+
const native = getNativeBridge();
|
|
1415
|
+
if (!native?.compute_incremental_diff)
|
|
1416
|
+
throw new Error("compute_incremental_diff not available");
|
|
1417
|
+
const resultJson = native.compute_incremental_diff(oldScanJson, newScanJson);
|
|
1418
|
+
try {
|
|
1419
|
+
return JSON.parse(resultJson);
|
|
1420
|
+
} catch {
|
|
1421
|
+
return {
|
|
1422
|
+
is_changed: false,
|
|
1423
|
+
changes_count: 0,
|
|
1424
|
+
diff: {
|
|
1425
|
+
added_files: [],
|
|
1426
|
+
removed_files: [],
|
|
1427
|
+
modified_files: [],
|
|
1428
|
+
added_classes: [],
|
|
1429
|
+
removed_classes: [],
|
|
1430
|
+
total_changes: 0
|
|
1431
|
+
},
|
|
1432
|
+
processing_time_ms: 0
|
|
1433
|
+
};
|
|
1434
|
+
}
|
|
1435
|
+
}
|
|
1436
|
+
function createFingerprint(filePath, fileContent) {
|
|
1437
|
+
const native = getNativeBridge();
|
|
1438
|
+
if (!native?.create_fingerprint) throw new Error("create_fingerprint not available");
|
|
1439
|
+
const fingerprintJson = native.create_fingerprint(filePath, fileContent);
|
|
1440
|
+
try {
|
|
1441
|
+
return JSON.parse(fingerprintJson);
|
|
1442
|
+
} catch {
|
|
1443
|
+
return {
|
|
1444
|
+
file_path: filePath,
|
|
1445
|
+
content_hash: "",
|
|
1446
|
+
size_bytes: fileContent.length,
|
|
1447
|
+
mtime_ms: Date.now(),
|
|
1448
|
+
class_hash: "",
|
|
1449
|
+
signature: ""
|
|
1450
|
+
};
|
|
1451
|
+
}
|
|
1452
|
+
}
|
|
1453
|
+
function injectStateHash(css, stateHash) {
|
|
1454
|
+
const native = getNativeBridge();
|
|
1455
|
+
if (!native?.inject_state_hash) throw new Error("inject_state_hash not available");
|
|
1456
|
+
const resultJson = native.inject_state_hash(css, stateHash);
|
|
1457
|
+
try {
|
|
1458
|
+
return JSON.parse(resultJson);
|
|
1459
|
+
} catch {
|
|
1460
|
+
return {
|
|
1461
|
+
injected: false,
|
|
1462
|
+
state_hash: stateHash,
|
|
1463
|
+
affected_files: 0,
|
|
1464
|
+
total_injected_bytes: 0
|
|
1465
|
+
};
|
|
1466
|
+
}
|
|
1467
|
+
}
|
|
1468
|
+
function pruneStaleCacheEntries(maxAgeSeconds, maxEntries) {
|
|
1469
|
+
const native = getNativeBridge();
|
|
1470
|
+
if (!native?.prune_stale_entries) throw new Error("prune_stale_entries not available");
|
|
1471
|
+
const resultJson = native.prune_stale_entries(maxAgeSeconds, maxEntries);
|
|
1472
|
+
try {
|
|
1473
|
+
return JSON.parse(resultJson);
|
|
1474
|
+
} catch {
|
|
1475
|
+
return {
|
|
1476
|
+
entries_before: 0,
|
|
1477
|
+
entries_after: 0,
|
|
1478
|
+
entries_removed: 0,
|
|
1479
|
+
freed_bytes: 0
|
|
1480
|
+
};
|
|
1481
|
+
}
|
|
1482
|
+
}
|
|
1483
|
+
function rebuildWorkspaceResult(rootDir, extensions) {
|
|
1484
|
+
const native = getNativeBridge();
|
|
1485
|
+
if (!native?.rebuild_workspace_result)
|
|
1486
|
+
throw new Error("rebuild_workspace_result not available");
|
|
1487
|
+
const resultJson = native.rebuild_workspace_result(rootDir, extensions || []);
|
|
1488
|
+
try {
|
|
1489
|
+
return JSON.parse(resultJson);
|
|
1490
|
+
} catch {
|
|
1491
|
+
return {
|
|
1492
|
+
total_files_scanned: 0,
|
|
1493
|
+
total_classes_found: 0,
|
|
1494
|
+
unique_classes: 0,
|
|
1495
|
+
build_time_ms: 0,
|
|
1496
|
+
files_with_changes: 0
|
|
1497
|
+
};
|
|
1498
|
+
}
|
|
1499
|
+
}
|
|
1500
|
+
function scanFileNative(filePath, fileContent) {
|
|
1501
|
+
const native = getNativeBridge();
|
|
1502
|
+
if (!native?.scan_file_native) throw new Error("scan_file_native not available");
|
|
1503
|
+
const resultJson = native.scan_file_native(filePath, fileContent);
|
|
1504
|
+
try {
|
|
1505
|
+
return JSON.parse(resultJson);
|
|
1506
|
+
} catch {
|
|
1507
|
+
return {
|
|
1508
|
+
file: filePath,
|
|
1509
|
+
classes: [],
|
|
1510
|
+
added_classes: [],
|
|
1511
|
+
removed_classes: [],
|
|
1512
|
+
changed: false
|
|
1513
|
+
};
|
|
1514
|
+
}
|
|
1515
|
+
}
|
|
1516
|
+
function scanFilesBatchNative(filesJson) {
|
|
1517
|
+
const native = getNativeBridge();
|
|
1518
|
+
if (!native?.scan_files_batch_native)
|
|
1519
|
+
throw new Error("scan_files_batch_native not available");
|
|
1520
|
+
const resultJson = native.scan_files_batch_native(filesJson);
|
|
1521
|
+
try {
|
|
1522
|
+
return JSON.parse(resultJson);
|
|
1523
|
+
} catch {
|
|
1524
|
+
return [];
|
|
1525
|
+
}
|
|
1526
|
+
}
|
|
1527
|
+
var init_streamingNative = __esm({
|
|
1528
|
+
"packages/domain/compiler/src/compiler/streamingNative.ts"() {
|
|
1529
|
+
init_nativeBridge();
|
|
1530
|
+
}
|
|
1531
|
+
});
|
|
1532
|
+
|
|
1533
|
+
// packages/domain/compiler/src/compiler/tailwindEngine.ts
|
|
1534
|
+
var tailwindEngine_exports = {};
|
|
1535
|
+
__export(tailwindEngine_exports, {
|
|
1536
|
+
clearCache: () => clearCache,
|
|
1537
|
+
getCacheStats: () => getCacheStats,
|
|
1538
|
+
processTailwindCssWithTargets: () => processTailwindCssWithTargets,
|
|
1539
|
+
runCssPipeline: () => runCssPipeline,
|
|
1540
|
+
runCssPipelineSync: () => runCssPipelineSync
|
|
1541
|
+
});
|
|
1542
|
+
function _getCacheKey(classes, minify, cssEntry, root) {
|
|
1543
|
+
const sorted = [...classes].sort().join(",");
|
|
1544
|
+
const flags = `${minify ? "1" : "0"}${cssEntry ? "1" : "0"}${root ? "1" : "0"}`;
|
|
1545
|
+
return `${sorted}|${flags}`;
|
|
1546
|
+
}
|
|
1547
|
+
function _evictOldestIfNeeded() {
|
|
1548
|
+
if (_cssCache.size >= MAX_CACHE_SIZE) {
|
|
1549
|
+
const firstKey = _cssCache.keys().next().value;
|
|
1550
|
+
if (firstKey !== void 0) {
|
|
1551
|
+
_cssCache.delete(firstKey);
|
|
1552
|
+
}
|
|
1553
|
+
}
|
|
1554
|
+
}
|
|
1555
|
+
function getCacheStats() {
|
|
1556
|
+
const total = _cacheHits + _cacheMisses;
|
|
1557
|
+
return {
|
|
1558
|
+
hits: _cacheHits,
|
|
1559
|
+
misses: _cacheMisses,
|
|
1560
|
+
hitRate: total > 0 ? _cacheHits / total : 0,
|
|
1561
|
+
size: _cssCache.size,
|
|
1562
|
+
maxSize: MAX_CACHE_SIZE
|
|
1563
|
+
};
|
|
1564
|
+
}
|
|
1565
|
+
function clearCache() {
|
|
1566
|
+
_cssCache.clear();
|
|
1567
|
+
_cacheHits = 0;
|
|
1568
|
+
_cacheMisses = 0;
|
|
1569
|
+
}
|
|
1570
|
+
function getThemeConfig() {
|
|
1571
|
+
return {
|
|
1572
|
+
colors: {
|
|
1573
|
+
slate: {
|
|
1574
|
+
"50": "#f8fafc",
|
|
1575
|
+
"100": "#f1f5f9",
|
|
1576
|
+
"200": "#e2e8f0",
|
|
1577
|
+
"300": "#cbd5e1",
|
|
1578
|
+
"400": "#94a3b8",
|
|
1579
|
+
"500": "#64748b",
|
|
1580
|
+
"600": "#475569",
|
|
1581
|
+
"700": "#334155",
|
|
1582
|
+
"800": "#1e293b",
|
|
1583
|
+
"900": "#0f172a"
|
|
1584
|
+
},
|
|
1585
|
+
gray: {
|
|
1586
|
+
"50": "#f9fafb",
|
|
1587
|
+
"100": "#f3f4f6",
|
|
1588
|
+
"200": "#e5e7eb",
|
|
1589
|
+
"300": "#d1d5db",
|
|
1590
|
+
"400": "#9ca3af",
|
|
1591
|
+
"500": "#6b7280",
|
|
1592
|
+
"600": "#4b5563",
|
|
1593
|
+
"700": "#374151",
|
|
1594
|
+
"800": "#1f2937",
|
|
1595
|
+
"900": "#111827"
|
|
1596
|
+
},
|
|
1597
|
+
white: "#ffffff",
|
|
1598
|
+
black: "#000000",
|
|
1599
|
+
red: {
|
|
1600
|
+
"500": "#ef4444",
|
|
1601
|
+
"600": "#dc2626"
|
|
1602
|
+
},
|
|
1603
|
+
blue: {
|
|
1604
|
+
"500": "#3b82f6",
|
|
1605
|
+
"600": "#1e40af"
|
|
1606
|
+
}
|
|
1607
|
+
},
|
|
1608
|
+
spacing: {
|
|
1609
|
+
"0": "0px",
|
|
1610
|
+
"1": "0.25rem",
|
|
1611
|
+
"2": "0.5rem",
|
|
1612
|
+
"3": "0.75rem",
|
|
1613
|
+
"4": "1rem",
|
|
1614
|
+
"5": "1.25rem",
|
|
1615
|
+
"6": "1.5rem",
|
|
1616
|
+
"8": "2rem",
|
|
1617
|
+
"10": "2.5rem",
|
|
1618
|
+
"12": "3rem",
|
|
1619
|
+
"16": "4rem",
|
|
1620
|
+
"20": "5rem",
|
|
1621
|
+
"24": "6rem"
|
|
1622
|
+
},
|
|
1623
|
+
breakpoints: {
|
|
1624
|
+
"sm": "640px",
|
|
1625
|
+
"md": "768px",
|
|
1626
|
+
"lg": "1024px",
|
|
1627
|
+
"xl": "1280px",
|
|
1628
|
+
"2xl": "1536px"
|
|
1629
|
+
}
|
|
1630
|
+
};
|
|
1631
|
+
}
|
|
1632
|
+
function postProcessWithLightning(rawCss) {
|
|
1633
|
+
if (!rawCss) return "";
|
|
1634
|
+
const native = getNativeBridge();
|
|
1635
|
+
if (!native?.processTailwindCssLightning) {
|
|
1636
|
+
throw new Error("FATAL: Native binding 'processTailwindCssLightning' is required but not available.");
|
|
1637
|
+
}
|
|
1638
|
+
const result = native.processTailwindCssLightning(rawCss);
|
|
1639
|
+
if (!result?.css) {
|
|
1640
|
+
throw new Error("FATAL: processTailwindCssLightning returned null");
|
|
1641
|
+
}
|
|
1642
|
+
return result.css;
|
|
1643
|
+
}
|
|
1644
|
+
async function runCssPipeline(classes, cssEntryContent, root, minify = true) {
|
|
1645
|
+
const filtered = classes.filter(Boolean);
|
|
1646
|
+
const uniqueMap = /* @__PURE__ */ new Map();
|
|
1647
|
+
filtered.forEach((cls) => uniqueMap.set(cls, cls));
|
|
1648
|
+
const unique = Array.from(uniqueMap.values());
|
|
1649
|
+
if (unique.length === 0) {
|
|
1650
|
+
return { css: "", classes: [], sizeBytes: 0, optimized: false };
|
|
1651
|
+
}
|
|
1652
|
+
const cacheKey = _getCacheKey(unique, minify, cssEntryContent, root);
|
|
1653
|
+
const cached = _cssCache.get(cacheKey);
|
|
1654
|
+
if (cached) {
|
|
1655
|
+
_cacheHits++;
|
|
1656
|
+
if (process.env.DEBUG?.includes("compiler")) {
|
|
1657
|
+
console.log(
|
|
1658
|
+
`[Compiler] Cache HIT: ${unique.length} classes (hit rate: ${(getCacheStats().hitRate * 100).toFixed(1)}%)`
|
|
1659
|
+
);
|
|
1660
|
+
}
|
|
1661
|
+
return cached;
|
|
1662
|
+
}
|
|
1663
|
+
_cacheMisses++;
|
|
1664
|
+
let rawCss;
|
|
1665
|
+
let usedRustCompiler = false;
|
|
1666
|
+
const theme = getThemeConfig();
|
|
1667
|
+
rawCss = await generateCssNative(unique, { theme });
|
|
1668
|
+
usedRustCompiler = true;
|
|
1669
|
+
const finalCss = minify ? postProcessWithLightning(rawCss) : rawCss;
|
|
1670
|
+
if (process.env.DEBUG?.includes("compiler")) {
|
|
1671
|
+
console.log(
|
|
1672
|
+
`[Compiler] Generated CSS from ${unique.length} classes (${usedRustCompiler ? "Rust" : "JavaScript"})`,
|
|
1673
|
+
`Size: ${finalCss.length} bytes`
|
|
1674
|
+
);
|
|
1675
|
+
}
|
|
1676
|
+
const result = {
|
|
1677
|
+
css: finalCss,
|
|
1678
|
+
classes: unique,
|
|
1679
|
+
sizeBytes: finalCss.length,
|
|
1680
|
+
optimized: minify
|
|
1681
|
+
};
|
|
1682
|
+
_evictOldestIfNeeded();
|
|
1683
|
+
_cssCache.set(cacheKey, result);
|
|
1684
|
+
return result;
|
|
1685
|
+
}
|
|
1686
|
+
function runCssPipelineSync(_classes) {
|
|
1687
|
+
return { css: "", classes: [], sizeBytes: 0, optimized: false };
|
|
1688
|
+
}
|
|
1689
|
+
function processTailwindCssWithTargets(css, targets) {
|
|
1690
|
+
const native = getNativeBridge();
|
|
1691
|
+
if (!native?.processTailwindCssWithTargets) {
|
|
1692
|
+
throw new Error("FATAL: Native binding 'processTailwindCssWithTargets' is required but not available.");
|
|
1693
|
+
}
|
|
1694
|
+
const result = native.processTailwindCssWithTargets(css, targets ?? null);
|
|
1695
|
+
if (!result?.css) {
|
|
1696
|
+
throw new Error("FATAL: processTailwindCssWithTargets returned null");
|
|
1697
|
+
}
|
|
1698
|
+
return result.css;
|
|
1699
|
+
}
|
|
1700
|
+
var _cssCache, _cacheHits, _cacheMisses, MAX_CACHE_SIZE;
|
|
1701
|
+
var init_tailwindEngine = __esm({
|
|
1702
|
+
"packages/domain/compiler/src/compiler/tailwindEngine.ts"() {
|
|
1703
|
+
init_nativeBridge();
|
|
1704
|
+
init_cssGeneratorNative();
|
|
1705
|
+
createRequire(import.meta.url);
|
|
1706
|
+
_cssCache = /* @__PURE__ */ new Map();
|
|
1707
|
+
_cacheHits = 0;
|
|
1708
|
+
_cacheMisses = 0;
|
|
1709
|
+
MAX_CACHE_SIZE = 100;
|
|
1710
|
+
}
|
|
1711
|
+
});
|
|
1712
|
+
|
|
1713
|
+
// packages/domain/compiler/src/compiler/index.ts
|
|
1714
|
+
var init_compiler = __esm({
|
|
1715
|
+
"packages/domain/compiler/src/compiler/index.ts"() {
|
|
1716
|
+
init_cssGeneratorNative();
|
|
1717
|
+
init_compilationNative();
|
|
1718
|
+
init_cssCompilationNative();
|
|
1719
|
+
init_idRegistryNative();
|
|
1720
|
+
init_streamingNative();
|
|
1721
|
+
}
|
|
1722
|
+
});
|
|
1723
|
+
|
|
1724
|
+
// packages/domain/compiler/src/parser/index.ts
|
|
1725
|
+
var parser_exports = {};
|
|
1726
|
+
__export(parser_exports, {
|
|
1727
|
+
astExtractClasses: () => astExtractClasses,
|
|
1728
|
+
batchExtractClasses: () => batchExtractClasses,
|
|
1729
|
+
checkAgainstSafelist: () => checkAgainstSafelist,
|
|
1730
|
+
diffClassLists: () => diffClassLists,
|
|
1731
|
+
extractAllClasses: () => extractAllClasses,
|
|
1732
|
+
extractClassesFromSource: () => extractClassesFromSource,
|
|
1733
|
+
extractComponentUsage: () => extractComponentUsage,
|
|
1734
|
+
mergeClassesStatic: () => mergeClassesStatic,
|
|
1735
|
+
normalizeAndDedupClasses: () => normalizeAndDedupClasses,
|
|
1736
|
+
normalizeClasses: () => normalizeClasses,
|
|
1737
|
+
parseClasses: () => parseClasses
|
|
1738
|
+
});
|
|
1739
|
+
var parseClasses, extractAllClasses, extractClassesFromSource, astExtractClasses, normalizeClasses, mergeClassesStatic, normalizeAndDedupClasses, extractComponentUsage, batchExtractClasses, checkAgainstSafelist, diffClassLists;
|
|
1740
|
+
var init_parser = __esm({
|
|
1741
|
+
"packages/domain/compiler/src/parser/index.ts"() {
|
|
1742
|
+
init_nativeBridge();
|
|
1743
|
+
parseClasses = (raw) => {
|
|
1744
|
+
const native = getNativeBridge();
|
|
1745
|
+
if (!native?.parseClasses) {
|
|
1746
|
+
throw new Error("FATAL: Native binding 'parseClasses' is required but not available.");
|
|
1747
|
+
}
|
|
1748
|
+
return native.parseClasses(raw) || [];
|
|
1749
|
+
};
|
|
1750
|
+
extractAllClasses = (source) => {
|
|
1751
|
+
const native = getNativeBridge();
|
|
1752
|
+
if (!native?.extractAllClasses) {
|
|
1753
|
+
throw new Error("FATAL: Native binding 'extractAllClasses' is required but not available.");
|
|
1754
|
+
}
|
|
1755
|
+
return native.extractAllClasses(source) || [];
|
|
1756
|
+
};
|
|
1757
|
+
extractClassesFromSource = (source) => {
|
|
1758
|
+
const native = getNativeBridge();
|
|
1759
|
+
if (!native?.extractClassesFromSource) {
|
|
1760
|
+
throw new Error("FATAL: Native binding 'extractClassesFromSource' is required but not available.");
|
|
1761
|
+
}
|
|
1762
|
+
const result = native.extractClassesFromSource(source);
|
|
1763
|
+
return Array.isArray(result) ? result.join(" ") : String(result || "");
|
|
1764
|
+
};
|
|
1765
|
+
astExtractClasses = (source, _filename) => {
|
|
1766
|
+
const native = getNativeBridge();
|
|
1767
|
+
if (!native?.extractClassesFromSource) {
|
|
1768
|
+
throw new Error("FATAL: Native binding 'extractClassesFromSource' is required but not available.");
|
|
1769
|
+
}
|
|
1770
|
+
return native.extractClassesFromSource(source) || [];
|
|
1771
|
+
};
|
|
1772
|
+
normalizeClasses = (raw) => {
|
|
1773
|
+
const result = normalizeAndDedupClasses(raw);
|
|
1774
|
+
return result?.normalized || "";
|
|
1775
|
+
};
|
|
1776
|
+
mergeClassesStatic = (classes) => {
|
|
1777
|
+
const result = normalizeAndDedupClasses(classes);
|
|
1778
|
+
return result?.normalized || "";
|
|
1779
|
+
};
|
|
1780
|
+
normalizeAndDedupClasses = (raw) => {
|
|
1781
|
+
const native = getNativeBridge();
|
|
1782
|
+
if (!native?.normalizeAndDedupClasses) {
|
|
1783
|
+
throw new Error("FATAL: Native binding 'normalizeAndDedupClasses' is required but not available.");
|
|
1784
|
+
}
|
|
1785
|
+
const result = native.normalizeAndDedupClasses(raw);
|
|
1786
|
+
return result || { normalized: "", duplicatesRemoved: 0, uniqueCount: 0 };
|
|
1787
|
+
};
|
|
1788
|
+
extractComponentUsage = (source) => {
|
|
1789
|
+
const native = getNativeBridge();
|
|
1790
|
+
if (!native?.extractComponentUsage) {
|
|
1791
|
+
throw new Error("FATAL: Native binding 'extractComponentUsage' is required but not available.");
|
|
1792
|
+
}
|
|
1793
|
+
return native.extractComponentUsage(source) || [];
|
|
1794
|
+
};
|
|
1795
|
+
batchExtractClasses = (filePaths) => {
|
|
1796
|
+
const native = getNativeBridge();
|
|
1797
|
+
if (!native?.batchExtractClasses) {
|
|
1798
|
+
throw new Error("FATAL: Native binding 'batchExtractClasses' is required but not available.");
|
|
1799
|
+
}
|
|
1800
|
+
return native.batchExtractClasses(filePaths) || [];
|
|
1801
|
+
};
|
|
1802
|
+
checkAgainstSafelist = (classes, safelist) => {
|
|
1803
|
+
const native = getNativeBridge();
|
|
1804
|
+
if (!native?.checkAgainstSafelist) {
|
|
1805
|
+
throw new Error("FATAL: Native binding 'checkAgainstSafelist' is required but not available.");
|
|
1806
|
+
}
|
|
1807
|
+
return native.checkAgainstSafelist(classes, safelist) || { matched: [], unmatched: [], safelistSize: 0 };
|
|
1808
|
+
};
|
|
1809
|
+
diffClassLists = (previous, current) => {
|
|
1810
|
+
const native = getNativeBridge();
|
|
1811
|
+
if (!native?.diffClassLists) {
|
|
1812
|
+
throw new Error("FATAL: Native binding 'diffClassLists' is required but not available.");
|
|
1813
|
+
}
|
|
1814
|
+
return native.diffClassLists(previous, current) || { added: [], removed: [], unchanged: [], hasChanges: false };
|
|
1815
|
+
};
|
|
1816
|
+
}
|
|
1817
|
+
});
|
|
1818
|
+
|
|
1819
|
+
// packages/domain/compiler/src/analyzer/analyzerNative.ts
|
|
1820
|
+
function detectDeadCode(scanResultJson, css) {
|
|
1821
|
+
const native = getNativeBridge();
|
|
1822
|
+
if (!native?.detectDeadCode) throw new Error("detectDeadCode not available");
|
|
1823
|
+
return native.detectDeadCode(scanResultJson, css);
|
|
1824
|
+
}
|
|
1825
|
+
function analyzeClassUsageNative(classes, scanResultJson, css) {
|
|
1826
|
+
const native = getNativeBridge();
|
|
1827
|
+
if (!native?.analyzeClassUsage) throw new Error("analyzeClassUsage not available");
|
|
1828
|
+
return native.analyzeClassUsage(classes, scanResultJson, css);
|
|
1829
|
+
}
|
|
1830
|
+
function analyzeClassesNative(filesJson, cwd, flags) {
|
|
1831
|
+
const native = getNativeBridge();
|
|
1832
|
+
if (!native?.analyzeClasses) throw new Error("analyzeClasses not available");
|
|
1833
|
+
return native.analyzeClasses(filesJson, cwd, flags ?? 0);
|
|
1834
|
+
}
|
|
1835
|
+
function analyzeRscNative(source, filename) {
|
|
1836
|
+
const native = getNativeBridge();
|
|
1837
|
+
if (!native?.analyzeRsc) throw new Error("analyzeRsc not available");
|
|
1838
|
+
return native.analyzeRsc(source, filename);
|
|
1839
|
+
}
|
|
1840
|
+
function optimizeCssNative(css) {
|
|
1841
|
+
const native = getNativeBridge();
|
|
1842
|
+
if (!native?.processTailwindCssLightning) throw new Error("processTailwindCssLightning not available");
|
|
1843
|
+
const result = native.processTailwindCssLightning(css);
|
|
1844
|
+
return {
|
|
1845
|
+
css: result.css,
|
|
1846
|
+
originalSize: css.length,
|
|
1847
|
+
optimizedSize: result.size_bytes,
|
|
1848
|
+
reductionPercentage: (css.length - result.size_bytes) / css.length * 100
|
|
1849
|
+
};
|
|
1850
|
+
}
|
|
1851
|
+
function processTailwindCssLightning(css) {
|
|
1852
|
+
const native = getNativeBridge();
|
|
1853
|
+
if (!native?.processTailwindCssLightning) throw new Error("processTailwindCssLightning not available");
|
|
1854
|
+
return native.processTailwindCssLightning(css);
|
|
1855
|
+
}
|
|
1856
|
+
function eliminateDeadCssNative(css, deadClasses) {
|
|
1857
|
+
const native = getNativeBridge();
|
|
1858
|
+
if (!native?.eliminateDeadCss) throw new Error("eliminateDeadCss not available");
|
|
1859
|
+
return native.eliminateDeadCss(css, deadClasses);
|
|
1860
|
+
}
|
|
1861
|
+
function hoistComponentsNative(source) {
|
|
1862
|
+
const native = getNativeBridge();
|
|
1863
|
+
if (!native?.hoistComponents) throw new Error("hoistComponents not available");
|
|
1864
|
+
return native.hoistComponents(source);
|
|
1865
|
+
}
|
|
1866
|
+
function compileVariantTableNative(configJson) {
|
|
1867
|
+
const native = getNativeBridge();
|
|
1868
|
+
if (!native?.compileVariantTable) throw new Error("compileVariantTable not available");
|
|
1869
|
+
return native.compileVariantTable(configJson);
|
|
1870
|
+
}
|
|
1871
|
+
function classifyAndSortClassesNative(classes) {
|
|
1872
|
+
const native = getNativeBridge();
|
|
1873
|
+
if (!native?.classifyAndSortClasses) throw new Error("classifyAndSortClasses not available");
|
|
1874
|
+
return native.classifyAndSortClasses(classes);
|
|
1875
|
+
}
|
|
1876
|
+
function mergeCssDeclarationsNative(cssChunks) {
|
|
1877
|
+
const native = getNativeBridge();
|
|
1878
|
+
if (!native?.mergeCssDeclarations) throw new Error("mergeCssDeclarations not available");
|
|
1879
|
+
return native.mergeCssDeclarations(cssChunks);
|
|
1880
|
+
}
|
|
1881
|
+
var init_analyzerNative = __esm({
|
|
1882
|
+
"packages/domain/compiler/src/analyzer/analyzerNative.ts"() {
|
|
1883
|
+
init_nativeBridge();
|
|
1884
|
+
}
|
|
1885
|
+
});
|
|
1886
|
+
|
|
1887
|
+
// packages/domain/compiler/src/analyzer/themeResolutionNative.ts
|
|
1888
|
+
function resolveVariants(configJson) {
|
|
1889
|
+
const native = getNativeBridge();
|
|
1890
|
+
if (!native?.resolve_variants) throw new Error("resolve_variants not available");
|
|
1891
|
+
const resultJson = native.resolve_variants(configJson);
|
|
1892
|
+
try {
|
|
1893
|
+
return JSON.parse(resultJson);
|
|
1894
|
+
} catch {
|
|
1895
|
+
return {
|
|
1896
|
+
variants: [],
|
|
1897
|
+
supported: [],
|
|
1898
|
+
deprecated: [],
|
|
1899
|
+
conflicting: []
|
|
1900
|
+
};
|
|
1901
|
+
}
|
|
1902
|
+
}
|
|
1903
|
+
function validateThemeConfig(configJson) {
|
|
1904
|
+
const native = getNativeBridge();
|
|
1905
|
+
if (!native?.validate_variant_config) throw new Error("validate_variant_config not available");
|
|
1906
|
+
const resultJson = native.validate_variant_config(configJson);
|
|
1907
|
+
try {
|
|
1908
|
+
return JSON.parse(resultJson);
|
|
1909
|
+
} catch {
|
|
1910
|
+
return {
|
|
1911
|
+
is_valid: false,
|
|
1912
|
+
errors: ["Unable to parse configuration"],
|
|
1913
|
+
warnings: [],
|
|
1914
|
+
suggestions: []
|
|
1915
|
+
};
|
|
1916
|
+
}
|
|
1917
|
+
}
|
|
1918
|
+
function resolveCascade(baseThemeJson, overridesJson) {
|
|
1919
|
+
const native = getNativeBridge();
|
|
1920
|
+
if (!native?.resolve_cascade) throw new Error("resolve_cascade not available");
|
|
1921
|
+
const resultJson = native.resolve_cascade(baseThemeJson, overridesJson);
|
|
1922
|
+
try {
|
|
1923
|
+
return JSON.parse(resultJson);
|
|
1924
|
+
} catch {
|
|
1925
|
+
return {
|
|
1926
|
+
base_theme: {},
|
|
1927
|
+
user_overrides: {},
|
|
1928
|
+
merged_theme: {},
|
|
1929
|
+
conflict_resolutions: []
|
|
1930
|
+
};
|
|
1931
|
+
}
|
|
1932
|
+
}
|
|
1933
|
+
function resolveClassNames(classNames, themeJson) {
|
|
1934
|
+
const native = getNativeBridge();
|
|
1935
|
+
if (!native?.resolve_class_names) throw new Error("resolve_class_names not available");
|
|
1936
|
+
const resultJson = native.resolve_class_names(classNames, themeJson);
|
|
1937
|
+
try {
|
|
1938
|
+
return JSON.parse(resultJson);
|
|
1939
|
+
} catch {
|
|
1940
|
+
return [];
|
|
1941
|
+
}
|
|
1942
|
+
}
|
|
1943
|
+
function resolveConflictGroup(groupName, themeJson) {
|
|
1944
|
+
const native = getNativeBridge();
|
|
1945
|
+
if (!native?.resolve_conflict_group)
|
|
1946
|
+
throw new Error("resolve_conflict_group not available");
|
|
1947
|
+
const resultJson = native.resolve_conflict_group(groupName, themeJson);
|
|
1948
|
+
try {
|
|
1949
|
+
return JSON.parse(resultJson);
|
|
1950
|
+
} catch {
|
|
1951
|
+
return {
|
|
1952
|
+
group_name: groupName,
|
|
1953
|
+
conflicting_classes: [],
|
|
1954
|
+
description: "",
|
|
1955
|
+
resolution_strategy: "last-wins"
|
|
1956
|
+
};
|
|
1957
|
+
}
|
|
1958
|
+
}
|
|
1959
|
+
function resolveThemeValue(keyPath, themeJson) {
|
|
1960
|
+
const native = getNativeBridge();
|
|
1961
|
+
if (!native?.resolve_theme_value) throw new Error("resolve_theme_value not available");
|
|
1962
|
+
return native.resolve_theme_value(keyPath, themeJson);
|
|
1963
|
+
}
|
|
1964
|
+
function resolveSimpleVariants(configJson) {
|
|
1965
|
+
const native = getNativeBridge();
|
|
1966
|
+
if (!native?.resolve_simple_variants) throw new Error("resolve_simple_variants not available");
|
|
1967
|
+
const resultJson = native.resolve_simple_variants(configJson);
|
|
1968
|
+
try {
|
|
1969
|
+
return JSON.parse(resultJson);
|
|
1970
|
+
} catch {
|
|
1971
|
+
return [];
|
|
1972
|
+
}
|
|
1973
|
+
}
|
|
1974
|
+
var init_themeResolutionNative = __esm({
|
|
1975
|
+
"packages/domain/compiler/src/analyzer/themeResolutionNative.ts"() {
|
|
1976
|
+
init_nativeBridge();
|
|
1977
|
+
}
|
|
1978
|
+
});
|
|
1979
|
+
|
|
1980
|
+
// packages/domain/compiler/src/analyzer/scannerNative.ts
|
|
1981
|
+
function scanWorkspace(root, extensions) {
|
|
1982
|
+
const native = getNativeBridge();
|
|
1983
|
+
if (!native?.scan_workspace) throw new Error("scan_workspace not available");
|
|
1984
|
+
return native.scan_workspace(root, extensions);
|
|
1985
|
+
}
|
|
1986
|
+
function extractClassesFromSourceNative(source) {
|
|
1987
|
+
const native = getNativeBridge();
|
|
1988
|
+
if (!native?.extract_classes_from_source) throw new Error("extract_classes_from_source not available");
|
|
1989
|
+
return native.extract_classes_from_source(source);
|
|
1990
|
+
}
|
|
1991
|
+
function batchExtractClassesNative(filePaths) {
|
|
1992
|
+
const native = getNativeBridge();
|
|
1993
|
+
if (!native?.batch_extract_classes) throw new Error("batch_extract_classes not available");
|
|
1994
|
+
return native.batch_extract_classes(filePaths);
|
|
1995
|
+
}
|
|
1996
|
+
function checkAgainstSafelistNative(classes, safelist) {
|
|
1997
|
+
const native = getNativeBridge();
|
|
1998
|
+
if (!native?.check_against_safelist) throw new Error("check_against_safelist not available");
|
|
1999
|
+
return native.check_against_safelist(classes, safelist);
|
|
2000
|
+
}
|
|
2001
|
+
function scanFile(filePath) {
|
|
2002
|
+
const native = getNativeBridge();
|
|
2003
|
+
if (!native?.scan_file) throw new Error("scan_file not available");
|
|
2004
|
+
return native.scan_file(filePath);
|
|
2005
|
+
}
|
|
2006
|
+
function collectFiles(root, extensions) {
|
|
2007
|
+
const native = getNativeBridge();
|
|
2008
|
+
if (!native?.collect_files) throw new Error("collect_files not available");
|
|
2009
|
+
return native.collect_files(root, extensions);
|
|
2010
|
+
}
|
|
2011
|
+
function walkAndPrefilterSourceFiles(root, extensions, _parallel) {
|
|
2012
|
+
const native = getNativeBridge();
|
|
2013
|
+
if (!native?.walk_and_prefilter_source_files) throw new Error("walk_and_prefilter_source_files not available");
|
|
2014
|
+
return native.walk_and_prefilter_source_files(root, extensions);
|
|
2015
|
+
}
|
|
2016
|
+
function generateSubComponentTypes(root, outputPath) {
|
|
2017
|
+
const native = getNativeBridge();
|
|
2018
|
+
if (!native?.generate_sub_component_types) throw new Error("generate_sub_component_types not available");
|
|
2019
|
+
return native.generate_sub_component_types(root, outputPath);
|
|
2020
|
+
}
|
|
2021
|
+
var init_scannerNative = __esm({
|
|
2022
|
+
"packages/domain/compiler/src/analyzer/scannerNative.ts"() {
|
|
2023
|
+
init_nativeBridge();
|
|
2024
|
+
}
|
|
2025
|
+
});
|
|
2026
|
+
|
|
2027
|
+
// packages/domain/compiler/src/analyzer/index.ts
|
|
2028
|
+
var init_analyzer = __esm({
|
|
2029
|
+
"packages/domain/compiler/src/analyzer/index.ts"() {
|
|
2030
|
+
init_analyzerNative();
|
|
2031
|
+
init_themeResolutionNative();
|
|
2032
|
+
init_scannerNative();
|
|
2033
|
+
}
|
|
2034
|
+
});
|
|
2035
|
+
|
|
2036
|
+
// packages/domain/compiler/src/cache/cacheNative.ts
|
|
2037
|
+
function getCacheStatistics() {
|
|
2038
|
+
const native = getNativeBridge();
|
|
2039
|
+
if (!native?.get_cache_statistics) throw new Error("get_cache_statistics not available");
|
|
2040
|
+
const statsJson = native.get_cache_statistics();
|
|
2041
|
+
try {
|
|
2042
|
+
return JSON.parse(statsJson);
|
|
2043
|
+
} catch {
|
|
2044
|
+
return {
|
|
2045
|
+
parse_cache: { hits: 0, misses: 0, size: 0 },
|
|
2046
|
+
resolve_cache: { hits: 0, misses: 0, size: 0 },
|
|
2047
|
+
compile_cache: { hits: 0, misses: 0, size: 0 },
|
|
2048
|
+
css_gen_cache: { hits: 0, misses: 0, size: 0 },
|
|
2049
|
+
overall_hit_rate: 0,
|
|
2050
|
+
total_memory_bytes: 0
|
|
2051
|
+
};
|
|
2052
|
+
}
|
|
2053
|
+
}
|
|
2054
|
+
function clearAllCaches() {
|
|
2055
|
+
const native = getNativeBridge();
|
|
2056
|
+
if (!native?.clear_all_caches) return;
|
|
2057
|
+
try {
|
|
2058
|
+
native.clear_all_caches();
|
|
2059
|
+
} catch {
|
|
2060
|
+
}
|
|
2061
|
+
}
|
|
2062
|
+
function clearParseCache() {
|
|
2063
|
+
const native = getNativeBridge();
|
|
2064
|
+
if (!native?.clear_parse_cache) return;
|
|
2065
|
+
try {
|
|
2066
|
+
native.clear_parse_cache();
|
|
2067
|
+
} catch {
|
|
2068
|
+
}
|
|
2069
|
+
}
|
|
2070
|
+
function clearResolveCache() {
|
|
2071
|
+
const native = getNativeBridge();
|
|
2072
|
+
if (!native?.clear_resolve_cache) return;
|
|
2073
|
+
try {
|
|
2074
|
+
native.clear_resolve_cache();
|
|
2075
|
+
} catch {
|
|
2076
|
+
}
|
|
2077
|
+
}
|
|
2078
|
+
function clearCompileCache() {
|
|
2079
|
+
const native = getNativeBridge();
|
|
2080
|
+
if (!native?.clear_compile_cache) return;
|
|
2081
|
+
try {
|
|
2082
|
+
native.clear_compile_cache();
|
|
2083
|
+
} catch {
|
|
2084
|
+
}
|
|
2085
|
+
}
|
|
2086
|
+
function clearCssGenCache() {
|
|
2087
|
+
const native = getNativeBridge();
|
|
2088
|
+
if (!native?.clear_css_gen_cache) return;
|
|
2089
|
+
try {
|
|
2090
|
+
native.clear_css_gen_cache();
|
|
2091
|
+
} catch {
|
|
2092
|
+
}
|
|
2093
|
+
}
|
|
2094
|
+
function getCacheOptimizationHints(hitRatePercent, memoryUsedMb) {
|
|
2095
|
+
const native = getNativeBridge();
|
|
2096
|
+
if (!native?.get_cache_optimization_hints)
|
|
2097
|
+
throw new Error("get_cache_optimization_hints not available");
|
|
2098
|
+
const hintsJson = native.get_cache_optimization_hints(
|
|
2099
|
+
Math.min(100, Math.max(0, hitRatePercent)),
|
|
2100
|
+
Math.max(1, memoryUsedMb)
|
|
2101
|
+
);
|
|
2102
|
+
try {
|
|
2103
|
+
return JSON.parse(hintsJson);
|
|
2104
|
+
} catch {
|
|
2105
|
+
return {
|
|
2106
|
+
current_strategy: "unknown",
|
|
2107
|
+
recommended_strategy: "increase_size",
|
|
2108
|
+
estimated_improvement_percent: 0,
|
|
2109
|
+
suggested_memory_mb: 256,
|
|
2110
|
+
notes: ["Unable to analyze cache statistics"]
|
|
2111
|
+
};
|
|
2112
|
+
}
|
|
2113
|
+
}
|
|
2114
|
+
function estimateOptimalCacheConfig(totalBudgetMb, workloadType) {
|
|
2115
|
+
const native = getNativeBridge();
|
|
2116
|
+
if (!native?.estimate_optimal_cache_config_native)
|
|
2117
|
+
throw new Error("estimate_optimal_cache_config_native not available");
|
|
2118
|
+
const configJson = native.estimate_optimal_cache_config_native(
|
|
2119
|
+
Math.max(64, totalBudgetMb),
|
|
2120
|
+
workloadType
|
|
2121
|
+
);
|
|
2122
|
+
try {
|
|
2123
|
+
return JSON.parse(configJson);
|
|
2124
|
+
} catch {
|
|
2125
|
+
return {
|
|
2126
|
+
parse_cache_size: 128,
|
|
2127
|
+
resolve_cache_size: 64,
|
|
2128
|
+
compile_cache_size: 256,
|
|
2129
|
+
css_gen_cache_size: 128,
|
|
2130
|
+
recommended_eviction_policy: "lru",
|
|
2131
|
+
ttl_seconds: 3600,
|
|
2132
|
+
expected_hit_rate_percent: 75
|
|
2133
|
+
};
|
|
2134
|
+
}
|
|
2135
|
+
}
|
|
2136
|
+
function cacheRead(cachePath) {
|
|
2137
|
+
const native = getNativeBridge();
|
|
2138
|
+
if (!native?.cache_read) throw new Error("cache_read not available");
|
|
2139
|
+
const result = native.cache_read(cachePath);
|
|
2140
|
+
try {
|
|
2141
|
+
return JSON.parse(result.entries_json || "[]");
|
|
2142
|
+
} catch {
|
|
2143
|
+
return [];
|
|
2144
|
+
}
|
|
2145
|
+
}
|
|
2146
|
+
function cacheWrite(cachePath, entries) {
|
|
2147
|
+
const native = getNativeBridge();
|
|
2148
|
+
if (!native?.cache_write) throw new Error("cache_write not available");
|
|
2149
|
+
try {
|
|
2150
|
+
const result = native.cache_write(
|
|
2151
|
+
cachePath,
|
|
2152
|
+
entries.map((e) => ({
|
|
2153
|
+
file: e.file,
|
|
2154
|
+
content_hash: e.contentHash,
|
|
2155
|
+
classes: e.classes,
|
|
2156
|
+
mtime_ms: e.mtimeMs,
|
|
2157
|
+
size_bytes: e.sizeBytes
|
|
2158
|
+
}))
|
|
2159
|
+
);
|
|
2160
|
+
return typeof result === "boolean" ? result : result === true;
|
|
2161
|
+
} catch {
|
|
2162
|
+
return false;
|
|
2163
|
+
}
|
|
2164
|
+
}
|
|
2165
|
+
function cachePriority(mtimeMs, sizeBytes, hitCount) {
|
|
2166
|
+
const native = getNativeBridge();
|
|
2167
|
+
if (!native?.cache_priority) throw new Error("cache_priority not available");
|
|
2168
|
+
return native.cache_priority(mtimeMs, sizeBytes, hitCount);
|
|
2169
|
+
}
|
|
2170
|
+
var init_cacheNative = __esm({
|
|
2171
|
+
"packages/domain/compiler/src/cache/cacheNative.ts"() {
|
|
2172
|
+
init_nativeBridge();
|
|
2173
|
+
}
|
|
2174
|
+
});
|
|
2175
|
+
|
|
2176
|
+
// packages/domain/compiler/src/cache/index.ts
|
|
2177
|
+
var init_cache = __esm({
|
|
2178
|
+
"packages/domain/compiler/src/cache/index.ts"() {
|
|
2179
|
+
init_cacheNative();
|
|
2180
|
+
}
|
|
2181
|
+
});
|
|
2182
|
+
|
|
2183
|
+
// packages/domain/compiler/src/redis/redisNative.ts
|
|
2184
|
+
function redisPing() {
|
|
2185
|
+
const native = getNativeBridge();
|
|
2186
|
+
if (!native?.redis_ping) throw new Error("redis_ping not available");
|
|
2187
|
+
return native.redis_ping();
|
|
2188
|
+
}
|
|
2189
|
+
function redisGet(key) {
|
|
2190
|
+
const native = getNativeBridge();
|
|
2191
|
+
if (!native?.redis_get) throw new Error("redis_get not available");
|
|
2192
|
+
const result = native.redis_get(key);
|
|
2193
|
+
return result === "nil" ? null : result;
|
|
2194
|
+
}
|
|
2195
|
+
function redisSet(key, value, ttl_seconds) {
|
|
2196
|
+
const native = getNativeBridge();
|
|
2197
|
+
if (!native?.redis_set) throw new Error("redis_set not available");
|
|
2198
|
+
return native.redis_set(key, value, ttl_seconds);
|
|
2199
|
+
}
|
|
2200
|
+
function redisDelete(key) {
|
|
2201
|
+
const native = getNativeBridge();
|
|
2202
|
+
if (!native?.redis_delete) throw new Error("redis_delete not available");
|
|
2203
|
+
return native.redis_delete(key);
|
|
2204
|
+
}
|
|
2205
|
+
function redisExists(key) {
|
|
2206
|
+
const native = getNativeBridge();
|
|
2207
|
+
if (!native?.redis_exists) throw new Error("redis_exists not available");
|
|
2208
|
+
return native.redis_exists(key);
|
|
2209
|
+
}
|
|
2210
|
+
function redisMget(keys) {
|
|
2211
|
+
const native = getNativeBridge();
|
|
2212
|
+
if (!native?.redis_mget) throw new Error("redis_mget not available");
|
|
2213
|
+
const result = native.redis_mget(keys);
|
|
2214
|
+
try {
|
|
2215
|
+
return JSON.parse(result);
|
|
2216
|
+
} catch {
|
|
2217
|
+
return keys.map(() => null);
|
|
2218
|
+
}
|
|
2219
|
+
}
|
|
2220
|
+
function redisMset(pairs) {
|
|
2221
|
+
const native = getNativeBridge();
|
|
2222
|
+
if (!native?.redis_mset) throw new Error("redis_mset not available");
|
|
2223
|
+
return native.redis_mset(pairs);
|
|
2224
|
+
}
|
|
2225
|
+
function redisFlushDb() {
|
|
2226
|
+
const native = getNativeBridge();
|
|
2227
|
+
if (!native?.redis_flush_db) throw new Error("redis_flush_db not available");
|
|
2228
|
+
return native.redis_flush_db();
|
|
2229
|
+
}
|
|
2230
|
+
function redisFlushAll() {
|
|
2231
|
+
const native = getNativeBridge();
|
|
2232
|
+
if (!native?.redis_flush_all) throw new Error("redis_flush_all not available");
|
|
2233
|
+
return native.redis_flush_all();
|
|
2234
|
+
}
|
|
2235
|
+
function redisPoolConnect(host, port, pool_size) {
|
|
2236
|
+
const native = getNativeBridge();
|
|
2237
|
+
if (!native?.redis_pool_connect) throw new Error("redis_pool_connect not available");
|
|
2238
|
+
return native.redis_pool_connect(host, port, pool_size);
|
|
2239
|
+
}
|
|
2240
|
+
function redisPoolStats() {
|
|
2241
|
+
const native = getNativeBridge();
|
|
2242
|
+
if (!native?.redis_pool_stats) throw new Error("redis_pool_stats not available");
|
|
2243
|
+
const result = native.redis_pool_stats();
|
|
2244
|
+
try {
|
|
2245
|
+
return JSON.parse(result);
|
|
2246
|
+
} catch {
|
|
2247
|
+
return {
|
|
2248
|
+
connected_count: 0,
|
|
2249
|
+
idle_count: 0,
|
|
2250
|
+
waiting_count: 0,
|
|
2251
|
+
total_requests: 0,
|
|
2252
|
+
total_errors: 0
|
|
2253
|
+
};
|
|
2254
|
+
}
|
|
2255
|
+
}
|
|
2256
|
+
function redisPoolReconnect() {
|
|
2257
|
+
const native = getNativeBridge();
|
|
2258
|
+
if (!native?.redis_pool_reconnect) throw new Error("redis_pool_reconnect not available");
|
|
2259
|
+
return native.redis_pool_reconnect();
|
|
2260
|
+
}
|
|
2261
|
+
function redisEnableCluster(initial_nodes) {
|
|
2262
|
+
const native = getNativeBridge();
|
|
2263
|
+
if (!native?.redis_enable_cluster) throw new Error("redis_enable_cluster not available");
|
|
2264
|
+
const result = native.redis_enable_cluster(initial_nodes);
|
|
2265
|
+
try {
|
|
2266
|
+
return JSON.parse(result);
|
|
2267
|
+
} catch {
|
|
2268
|
+
return {
|
|
2269
|
+
enabled: false,
|
|
2270
|
+
cluster_state: "error",
|
|
2271
|
+
nodes: [],
|
|
2272
|
+
slots_assigned: 0,
|
|
2273
|
+
slots_ok: 0,
|
|
2274
|
+
slots_fail: 0
|
|
2275
|
+
};
|
|
2276
|
+
}
|
|
2277
|
+
}
|
|
2278
|
+
function redisDisableCluster() {
|
|
2279
|
+
const native = getNativeBridge();
|
|
2280
|
+
if (!native?.redis_disable_cluster) throw new Error("redis_disable_cluster not available");
|
|
2281
|
+
return native.redis_disable_cluster();
|
|
2282
|
+
}
|
|
2283
|
+
function redisClusterStatus() {
|
|
2284
|
+
const native = getNativeBridge();
|
|
2285
|
+
if (!native?.redis_cluster_status) throw new Error("redis_cluster_status not available");
|
|
2286
|
+
const result = native.redis_cluster_status();
|
|
2287
|
+
try {
|
|
2288
|
+
return JSON.parse(result);
|
|
2289
|
+
} catch {
|
|
2290
|
+
return {
|
|
2291
|
+
enabled: false,
|
|
2292
|
+
cluster_state: "unknown",
|
|
2293
|
+
nodes: [],
|
|
2294
|
+
slots_assigned: 0,
|
|
2295
|
+
slots_ok: 0,
|
|
2296
|
+
slots_fail: 0
|
|
2297
|
+
};
|
|
2298
|
+
}
|
|
2299
|
+
}
|
|
2300
|
+
function redisSubscribe(channel) {
|
|
2301
|
+
const native = getNativeBridge();
|
|
2302
|
+
if (!native?.redis_subscribe) throw new Error("redis_subscribe not available");
|
|
2303
|
+
return native.redis_subscribe(channel);
|
|
2304
|
+
}
|
|
2305
|
+
function redisPublish(channel, message) {
|
|
2306
|
+
const native = getNativeBridge();
|
|
2307
|
+
if (!native?.redis_publish) throw new Error("redis_publish not available");
|
|
2308
|
+
return native.redis_publish(channel, message);
|
|
2309
|
+
}
|
|
2310
|
+
function redisExpirationSet(key, ttl_seconds) {
|
|
2311
|
+
const native = getNativeBridge();
|
|
2312
|
+
if (!native?.redis_expiration_set) throw new Error("redis_expiration_set not available");
|
|
2313
|
+
return native.redis_expiration_set(key, ttl_seconds);
|
|
2314
|
+
}
|
|
2315
|
+
function redisExpirationGet(key) {
|
|
2316
|
+
const native = getNativeBridge();
|
|
2317
|
+
if (!native?.redis_expiration_get) throw new Error("redis_expiration_get not available");
|
|
2318
|
+
const result = native.redis_expiration_get(key);
|
|
2319
|
+
try {
|
|
2320
|
+
return JSON.parse(result);
|
|
2321
|
+
} catch {
|
|
2322
|
+
return {
|
|
2323
|
+
key,
|
|
2324
|
+
ttl_seconds: -1,
|
|
2325
|
+
expiration_timestamp: 0,
|
|
2326
|
+
is_persistent: true
|
|
2327
|
+
};
|
|
2328
|
+
}
|
|
2329
|
+
}
|
|
2330
|
+
function redisInfo() {
|
|
2331
|
+
const native = getNativeBridge();
|
|
2332
|
+
if (!native?.redis_info) throw new Error("redis_info not available");
|
|
2333
|
+
return native.redis_info();
|
|
2334
|
+
}
|
|
2335
|
+
function redisMonitor() {
|
|
2336
|
+
const native = getNativeBridge();
|
|
2337
|
+
if (!native?.redis_monitor) throw new Error("redis_monitor not available");
|
|
2338
|
+
return native.redis_monitor();
|
|
2339
|
+
}
|
|
2340
|
+
function redisCacheSize() {
|
|
2341
|
+
const native = getNativeBridge();
|
|
2342
|
+
if (!native?.redis_cache_size) throw new Error("redis_cache_size not available");
|
|
2343
|
+
return native.redis_cache_size();
|
|
2344
|
+
}
|
|
2345
|
+
function redisCacheKeyCount() {
|
|
2346
|
+
const native = getNativeBridge();
|
|
2347
|
+
if (!native?.redis_cache_key_count) throw new Error("redis_cache_key_count not available");
|
|
2348
|
+
return native.redis_cache_key_count();
|
|
2349
|
+
}
|
|
2350
|
+
function redisCacheClear() {
|
|
2351
|
+
const native = getNativeBridge();
|
|
2352
|
+
if (!native?.redis_cache_clear) throw new Error("redis_cache_clear not available");
|
|
2353
|
+
return native.redis_cache_clear();
|
|
2354
|
+
}
|
|
2355
|
+
function redisCacheHitRate() {
|
|
2356
|
+
const native = getNativeBridge();
|
|
2357
|
+
if (!native?.redis_cache_hit_rate) throw new Error("redis_cache_hit_rate not available");
|
|
2358
|
+
return native.redis_cache_hit_rate();
|
|
2359
|
+
}
|
|
2360
|
+
function redisEnablePersistence(mode) {
|
|
2361
|
+
const native = getNativeBridge();
|
|
2362
|
+
if (!native?.redis_enable_persistence) throw new Error("redis_enable_persistence not available");
|
|
2363
|
+
return native.redis_enable_persistence(mode);
|
|
2364
|
+
}
|
|
2365
|
+
function redisDisablePersistence() {
|
|
2366
|
+
const native = getNativeBridge();
|
|
2367
|
+
if (!native?.redis_disable_persistence) throw new Error("redis_disable_persistence not available");
|
|
2368
|
+
return native.redis_disable_persistence();
|
|
2369
|
+
}
|
|
2370
|
+
function redisSnapshot() {
|
|
2371
|
+
const native = getNativeBridge();
|
|
2372
|
+
if (!native?.redis_snapshot) throw new Error("redis_snapshot not available");
|
|
2373
|
+
return native.redis_snapshot();
|
|
2374
|
+
}
|
|
2375
|
+
function redisMemoryStats() {
|
|
2376
|
+
const native = getNativeBridge();
|
|
2377
|
+
if (!native?.redis_memory_stats) throw new Error("redis_memory_stats not available");
|
|
2378
|
+
return native.redis_memory_stats();
|
|
2379
|
+
}
|
|
2380
|
+
function redisOptimizeMemory() {
|
|
2381
|
+
const native = getNativeBridge();
|
|
2382
|
+
if (!native?.redis_optimize_memory) throw new Error("redis_optimize_memory not available");
|
|
2383
|
+
return native.redis_optimize_memory();
|
|
2384
|
+
}
|
|
2385
|
+
function redisSetEvictionPolicy(policy) {
|
|
2386
|
+
const native = getNativeBridge();
|
|
2387
|
+
if (!native?.redis_set_eviction_policy) throw new Error("redis_set_eviction_policy not available");
|
|
2388
|
+
return native.redis_set_eviction_policy(policy);
|
|
2389
|
+
}
|
|
2390
|
+
function redisGetEvictionPolicy() {
|
|
2391
|
+
const native = getNativeBridge();
|
|
2392
|
+
if (!native?.redis_get_eviction_policy) throw new Error("redis_get_eviction_policy not available");
|
|
2393
|
+
return native.redis_get_eviction_policy();
|
|
2394
|
+
}
|
|
2395
|
+
function redisReplicate(target_host, target_port) {
|
|
2396
|
+
const native = getNativeBridge();
|
|
2397
|
+
if (!native?.redis_replicate) throw new Error("redis_replicate not available");
|
|
2398
|
+
return native.redis_replicate(target_host, target_port);
|
|
2399
|
+
}
|
|
2400
|
+
function redisReplicationStatus() {
|
|
2401
|
+
const native = getNativeBridge();
|
|
2402
|
+
if (!native?.redis_replication_status) throw new Error("redis_replication_status not available");
|
|
2403
|
+
return native.redis_replication_status();
|
|
2404
|
+
}
|
|
2405
|
+
function redisCacheSync(peers) {
|
|
2406
|
+
const native = getNativeBridge();
|
|
2407
|
+
if (!native?.redis_cache_sync) throw new Error("redis_cache_sync not available");
|
|
2408
|
+
return native.redis_cache_sync(peers);
|
|
2409
|
+
}
|
|
2410
|
+
function redisEnableCacheWarming(key_pattern) {
|
|
2411
|
+
const native = getNativeBridge();
|
|
2412
|
+
if (!native?.redis_enable_cache_warming) throw new Error("redis_enable_cache_warming not available");
|
|
2413
|
+
return native.redis_enable_cache_warming(key_pattern);
|
|
2414
|
+
}
|
|
2415
|
+
function redisDisableCacheWarming() {
|
|
2416
|
+
const native = getNativeBridge();
|
|
2417
|
+
if (!native?.redis_disable_cache_warming) throw new Error("redis_disable_cache_warming not available");
|
|
2418
|
+
return native.redis_disable_cache_warming();
|
|
2419
|
+
}
|
|
2420
|
+
function redisDiagnose() {
|
|
2421
|
+
const native = getNativeBridge();
|
|
2422
|
+
if (!native?.redis_diagnose) throw new Error("redis_diagnose not available");
|
|
2423
|
+
return native.redis_diagnose();
|
|
2424
|
+
}
|
|
2425
|
+
var init_redisNative = __esm({
|
|
2426
|
+
"packages/domain/compiler/src/redis/redisNative.ts"() {
|
|
2427
|
+
init_nativeBridge();
|
|
2428
|
+
}
|
|
2429
|
+
});
|
|
2430
|
+
|
|
2431
|
+
// packages/domain/compiler/src/redis/index.ts
|
|
2432
|
+
var init_redis = __esm({
|
|
2433
|
+
"packages/domain/compiler/src/redis/index.ts"() {
|
|
2434
|
+
init_redisNative();
|
|
2435
|
+
}
|
|
2436
|
+
});
|
|
2437
|
+
|
|
2438
|
+
// packages/domain/compiler/src/watch/watchSystemNative.ts
|
|
2439
|
+
function startWatch(root_path, patterns) {
|
|
2440
|
+
const native = getNativeBridge();
|
|
2441
|
+
if (!native?.start_watch) throw new Error("start_watch not available");
|
|
2442
|
+
return native.start_watch(root_path, patterns);
|
|
2443
|
+
}
|
|
2444
|
+
function pollWatchEvents(handle, timeout_ms) {
|
|
2445
|
+
const native = getNativeBridge();
|
|
2446
|
+
if (!native?.poll_watch_events) throw new Error("poll_watch_events not available");
|
|
2447
|
+
const result = native.poll_watch_events(handle, timeout_ms);
|
|
2448
|
+
try {
|
|
2449
|
+
return JSON.parse(result);
|
|
2450
|
+
} catch {
|
|
2451
|
+
return [];
|
|
2452
|
+
}
|
|
2453
|
+
}
|
|
2454
|
+
function stopWatch(handle) {
|
|
2455
|
+
const native = getNativeBridge();
|
|
2456
|
+
if (!native?.stop_watch) throw new Error("stop_watch not available");
|
|
2457
|
+
return native.stop_watch(handle);
|
|
2458
|
+
}
|
|
2459
|
+
function watchAddPattern(handle, pattern) {
|
|
2460
|
+
const native = getNativeBridge();
|
|
2461
|
+
if (!native?.watch_add_pattern) throw new Error("watch_add_pattern not available");
|
|
2462
|
+
return native.watch_add_pattern(handle, pattern);
|
|
2463
|
+
}
|
|
2464
|
+
function watchRemovePattern(handle, pattern) {
|
|
2465
|
+
const native = getNativeBridge();
|
|
2466
|
+
if (!native?.watch_remove_pattern) throw new Error("watch_remove_pattern not available");
|
|
2467
|
+
return native.watch_remove_pattern(handle, pattern);
|
|
2468
|
+
}
|
|
2469
|
+
function watchGetActiveHandles() {
|
|
2470
|
+
const native = getNativeBridge();
|
|
2471
|
+
if (!native?.watch_get_active_handles) throw new Error("watch_get_active_handles not available");
|
|
2472
|
+
const result = native.watch_get_active_handles();
|
|
2473
|
+
try {
|
|
2474
|
+
return JSON.parse(result);
|
|
2475
|
+
} catch {
|
|
2476
|
+
return [];
|
|
2477
|
+
}
|
|
2478
|
+
}
|
|
2479
|
+
function watchClearAll() {
|
|
2480
|
+
const native = getNativeBridge();
|
|
2481
|
+
if (!native?.watch_clear_all) throw new Error("watch_clear_all not available");
|
|
2482
|
+
return native.watch_clear_all();
|
|
2483
|
+
}
|
|
2484
|
+
function watchEventTypeToString(event_type_code) {
|
|
2485
|
+
const native = getNativeBridge();
|
|
2486
|
+
if (!native?.watch_event_type_to_string) throw new Error("watch_event_type_to_string not available");
|
|
2487
|
+
return native.watch_event_type_to_string(event_type_code);
|
|
2488
|
+
}
|
|
2489
|
+
function isWatchRunning(handle) {
|
|
2490
|
+
const native = getNativeBridge();
|
|
2491
|
+
if (!native?.is_watch_running) throw new Error("is_watch_running not available");
|
|
2492
|
+
return native.is_watch_running(handle);
|
|
2493
|
+
}
|
|
2494
|
+
function getWatchStats() {
|
|
2495
|
+
const native = getNativeBridge();
|
|
2496
|
+
if (!native?.get_watch_stats) throw new Error("get_watch_stats not available");
|
|
2497
|
+
const result = native.get_watch_stats();
|
|
2498
|
+
try {
|
|
2499
|
+
return JSON.parse(result);
|
|
2500
|
+
} catch {
|
|
2501
|
+
return {
|
|
2502
|
+
active_watchers: 0,
|
|
2503
|
+
total_events: 0,
|
|
2504
|
+
events_this_second: 0,
|
|
2505
|
+
average_latency_ms: 0,
|
|
2506
|
+
largest_batch_size: 0
|
|
2507
|
+
};
|
|
2508
|
+
}
|
|
2509
|
+
}
|
|
2510
|
+
function watchPause(handle) {
|
|
2511
|
+
const native = getNativeBridge();
|
|
2512
|
+
if (!native?.watch_pause) throw new Error("watch_pause not available");
|
|
2513
|
+
return native.watch_pause(handle);
|
|
2514
|
+
}
|
|
2515
|
+
function watchResume(handle) {
|
|
2516
|
+
const native = getNativeBridge();
|
|
2517
|
+
if (!native?.watch_resume) throw new Error("watch_resume not available");
|
|
2518
|
+
return native.watch_resume(handle);
|
|
2519
|
+
}
|
|
2520
|
+
function scanCacheOptimizations() {
|
|
2521
|
+
const native = getNativeBridge();
|
|
2522
|
+
if (!native?.scan_cache_optimizations) throw new Error("scan_cache_optimizations not available");
|
|
2523
|
+
return native.scan_cache_optimizations();
|
|
2524
|
+
}
|
|
2525
|
+
function getPluginHooks() {
|
|
2526
|
+
const native = getNativeBridge();
|
|
2527
|
+
if (!native?.get_plugin_hooks) throw new Error("get_plugin_hooks not available");
|
|
2528
|
+
const result = native.get_plugin_hooks();
|
|
2529
|
+
try {
|
|
2530
|
+
return JSON.parse(result);
|
|
2531
|
+
} catch {
|
|
2532
|
+
return [];
|
|
2533
|
+
}
|
|
2534
|
+
}
|
|
2535
|
+
function registerPluginHook(hook_name, handler_id) {
|
|
2536
|
+
const native = getNativeBridge();
|
|
2537
|
+
if (!native?.register_plugin_hook) throw new Error("register_plugin_hook not available");
|
|
2538
|
+
return native.register_plugin_hook(hook_name, handler_id);
|
|
2539
|
+
}
|
|
2540
|
+
function unregisterPluginHook(hook_name, handler_id) {
|
|
2541
|
+
const native = getNativeBridge();
|
|
2542
|
+
if (!native?.unregister_plugin_hook) throw new Error("unregister_plugin_hook not available");
|
|
2543
|
+
return native.unregister_plugin_hook(hook_name, handler_id);
|
|
2544
|
+
}
|
|
2545
|
+
function emitPluginHook(hook_name, data_json) {
|
|
2546
|
+
const native = getNativeBridge();
|
|
2547
|
+
if (!native?.emit_plugin_hook) throw new Error("emit_plugin_hook not available");
|
|
2548
|
+
return native.emit_plugin_hook(hook_name, data_json);
|
|
2549
|
+
}
|
|
2550
|
+
function getCompilationMetrics() {
|
|
2551
|
+
const native = getNativeBridge();
|
|
2552
|
+
if (!native?.get_compilation_metrics) throw new Error("get_compilation_metrics not available");
|
|
2553
|
+
return native.get_compilation_metrics();
|
|
2554
|
+
}
|
|
2555
|
+
function resetCompilationMetrics() {
|
|
2556
|
+
const native = getNativeBridge();
|
|
2557
|
+
if (!native?.reset_compilation_metrics) throw new Error("reset_compilation_metrics not available");
|
|
2558
|
+
return native.reset_compilation_metrics();
|
|
2559
|
+
}
|
|
2560
|
+
function validateCssOutput(css) {
|
|
2561
|
+
const native = getNativeBridge();
|
|
2562
|
+
if (!native?.validate_css_output) throw new Error("validate_css_output not available");
|
|
2563
|
+
return native.validate_css_output(css);
|
|
2564
|
+
}
|
|
2565
|
+
function getCompilerDiagnostics() {
|
|
2566
|
+
const native = getNativeBridge();
|
|
2567
|
+
if (!native?.get_compiler_diagnostics) throw new Error("get_compiler_diagnostics not available");
|
|
2568
|
+
return native.get_compiler_diagnostics();
|
|
2569
|
+
}
|
|
2570
|
+
var init_watchSystemNative = __esm({
|
|
2571
|
+
"packages/domain/compiler/src/watch/watchSystemNative.ts"() {
|
|
2572
|
+
init_nativeBridge();
|
|
2573
|
+
}
|
|
2574
|
+
});
|
|
2575
|
+
|
|
2576
|
+
// packages/domain/compiler/src/watch/index.ts
|
|
2577
|
+
var init_watch = __esm({
|
|
2578
|
+
"packages/domain/compiler/src/watch/index.ts"() {
|
|
2579
|
+
init_watchSystemNative();
|
|
2580
|
+
}
|
|
2581
|
+
});
|
|
2582
|
+
function _layoutClassesToCss(classes) {
|
|
2583
|
+
const native = getNativeBridge();
|
|
2584
|
+
if (!native?.layoutClassesToCss) {
|
|
2585
|
+
throw new Error("FATAL: Native binding 'layoutClassesToCss' is required but not available.");
|
|
2586
|
+
}
|
|
2587
|
+
return native.layoutClassesToCss(classes);
|
|
2588
|
+
}
|
|
2589
|
+
function _hashContainer(tag, containerJson, name) {
|
|
2590
|
+
const sortedKey = tag + (name ?? "") + containerJson;
|
|
2591
|
+
const native = getNativeBridge();
|
|
2592
|
+
if (!native?.hashContent) {
|
|
2593
|
+
throw new Error("FATAL: Native binding 'hashContent' is required but not available.");
|
|
2594
|
+
}
|
|
2595
|
+
return `tw-cq-${native.hashContent(sortedKey, "fnv", 6)}`;
|
|
2596
|
+
}
|
|
2597
|
+
function extractContainerCssFromSource(source) {
|
|
2598
|
+
const native = getNativeBridge();
|
|
2599
|
+
if (!native?.extractTwContainerConfigs) {
|
|
2600
|
+
throw new Error("FATAL: Native binding 'extractTwContainerConfigs' is required but not available.");
|
|
2601
|
+
}
|
|
2602
|
+
const configs = native.extractTwContainerConfigs(source);
|
|
2603
|
+
const rules = [];
|
|
2604
|
+
for (const cfg of configs) {
|
|
2605
|
+
const id = _hashContainer(cfg.tag, cfg.containerJson, cfg.containerName);
|
|
2606
|
+
for (const { key, classes } of cfg.breakpoints) {
|
|
2607
|
+
const minWidth = _CONTAINER_BREAKPOINTS[key] ?? key;
|
|
2608
|
+
const css = _layoutClassesToCss(classes);
|
|
2609
|
+
if (!css) continue;
|
|
2610
|
+
const query = cfg.containerName ? `@container ${cfg.containerName} (min-width: ${minWidth})` : `@container (min-width: ${minWidth})`;
|
|
2611
|
+
rules.push(`${query}{.${id}{${css}}}`);
|
|
2612
|
+
}
|
|
2613
|
+
}
|
|
2614
|
+
return rules.join("\n");
|
|
2615
|
+
}
|
|
2616
|
+
var 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;
|
|
2617
|
+
var init_src = __esm({
|
|
2618
|
+
"packages/domain/compiler/src/index.ts"() {
|
|
2619
|
+
init_nativeBridge();
|
|
2620
|
+
init_compiler();
|
|
2621
|
+
init_parser();
|
|
2622
|
+
init_analyzer();
|
|
2623
|
+
init_cache();
|
|
2624
|
+
init_redis();
|
|
2625
|
+
init_watch();
|
|
2626
|
+
transformSource = (source, opts) => {
|
|
2627
|
+
const native = getNativeBridge();
|
|
2628
|
+
if (!native?.transformSource) {
|
|
2629
|
+
throw new Error("FATAL: Native binding 'transformSource' is required but not available.");
|
|
2630
|
+
}
|
|
2631
|
+
const result = native.transformSource(source, opts);
|
|
2632
|
+
if (!result) {
|
|
2633
|
+
throw new Error("FATAL: transformSource returned null");
|
|
2634
|
+
}
|
|
2635
|
+
return result;
|
|
2636
|
+
};
|
|
2637
|
+
hasTwUsage = (source) => {
|
|
2638
|
+
const native = getNativeBridge();
|
|
2639
|
+
if (!native?.hasTwUsage) {
|
|
2640
|
+
throw new Error("FATAL: Native binding 'hasTwUsage' is required but not available.");
|
|
2641
|
+
}
|
|
2642
|
+
return native.hasTwUsage(source);
|
|
2643
|
+
};
|
|
2644
|
+
isAlreadyTransformed = (source) => {
|
|
2645
|
+
const native = getNativeBridge();
|
|
2646
|
+
if (!native?.isAlreadyTransformed) {
|
|
2647
|
+
throw new Error("FATAL: Native binding 'isAlreadyTransformed' is required but not available.");
|
|
2648
|
+
}
|
|
2649
|
+
return native.isAlreadyTransformed(source);
|
|
2650
|
+
};
|
|
2651
|
+
shouldProcess = (source) => {
|
|
2652
|
+
return hasTwUsage(source) && !isAlreadyTransformed(source);
|
|
2653
|
+
};
|
|
2654
|
+
compileCssFromClasses = (classes, prefix) => {
|
|
2655
|
+
const native = getNativeBridge();
|
|
2656
|
+
if (!native?.transformSource) {
|
|
2657
|
+
throw new Error("FATAL: Native binding 'transformSource' is required but not available.");
|
|
2658
|
+
}
|
|
2659
|
+
const result = native.transformSource(classes.join(" "), { prefix: prefix ?? "" });
|
|
2660
|
+
if (!result) {
|
|
2661
|
+
throw new Error("FATAL: transformSource returned null");
|
|
2662
|
+
}
|
|
2663
|
+
return result;
|
|
2664
|
+
};
|
|
2665
|
+
buildStyleTag = (classes) => {
|
|
2666
|
+
const result = compileCssFromClasses(classes);
|
|
2667
|
+
return result?.code ? `<style data-tailwind-styled>${result.code}</style>` : "";
|
|
2668
|
+
};
|
|
2669
|
+
generateCssForClasses = async (classes, _tailwindConfig, root, cssEntryContent, minify = false) => {
|
|
2670
|
+
try {
|
|
2671
|
+
const { runCssPipeline: runCssPipeline2 } = await Promise.resolve().then(() => (init_tailwindEngine(), tailwindEngine_exports));
|
|
2672
|
+
const result = await runCssPipeline2(classes, cssEntryContent, root, minify);
|
|
2673
|
+
return result.css;
|
|
2674
|
+
} catch {
|
|
2675
|
+
const native = getNativeBridge();
|
|
2676
|
+
if (!native?.transformSource) {
|
|
2677
|
+
throw new Error("FATAL: Native binding 'transformSource' is required but not available.");
|
|
2678
|
+
}
|
|
2679
|
+
const result = native.transformSource(classes.join(" "), {});
|
|
2680
|
+
return result?.code || "";
|
|
2681
|
+
}
|
|
2682
|
+
};
|
|
2683
|
+
eliminateDeadCss = (css, deadClasses) => {
|
|
2684
|
+
const native = getNativeBridge();
|
|
2685
|
+
if (!native?.eliminateDeadCss) {
|
|
2686
|
+
throw new Error("FATAL: Native binding 'eliminateDeadCss' is required but not available.");
|
|
2687
|
+
}
|
|
2688
|
+
return native.eliminateDeadCss(css, Array.from(deadClasses));
|
|
2689
|
+
};
|
|
2690
|
+
findDeadVariants = (variantConfig, usage) => {
|
|
2691
|
+
const unused = [];
|
|
2692
|
+
const configs = Array.isArray(variantConfig) ? variantConfig : [{ name: "__root__", variants: variantConfig }];
|
|
2693
|
+
for (const component of configs) {
|
|
2694
|
+
const componentUsage = usage[component.name] ?? /* @__PURE__ */ new Set();
|
|
2695
|
+
const variants = component.variants;
|
|
2696
|
+
for (const [key, values] of Object.entries(variants)) {
|
|
2697
|
+
for (const [value] of Object.entries(values)) {
|
|
2698
|
+
if (!componentUsage.has(`${key}:${value}`)) {
|
|
2699
|
+
unused.push(`${component.name !== "__root__" ? `${component.name}/` : ""}${key}:${value}`);
|
|
2700
|
+
}
|
|
2701
|
+
}
|
|
2702
|
+
}
|
|
2703
|
+
}
|
|
2704
|
+
return { unusedCount: unused.length, unused };
|
|
2705
|
+
};
|
|
2706
|
+
runElimination = (css, scanResult) => {
|
|
2707
|
+
const native = getNativeBridge();
|
|
2708
|
+
if (!native?.detectDeadCode) {
|
|
2709
|
+
throw new Error("FATAL: Native binding 'detectDeadCode' is required but not available.");
|
|
2710
|
+
}
|
|
2711
|
+
const dead = native.detectDeadCode(JSON.stringify(scanResult), css);
|
|
2712
|
+
return eliminateDeadCss(css, new Set(dead.deadInCss ?? []));
|
|
2713
|
+
};
|
|
2714
|
+
scanProjectUsage = (dirs, cwd) => {
|
|
2715
|
+
const { batchExtractClasses: batchExtractClasses2 } = (init_parser(), __toCommonJS(parser_exports));
|
|
2716
|
+
const files = dirs.map((dir) => path__default.resolve(cwd, dir));
|
|
2717
|
+
const results = batchExtractClasses2(files) || [];
|
|
2718
|
+
const combined = {};
|
|
2719
|
+
for (const result of results) {
|
|
2720
|
+
if (result.ok && result.classes) {
|
|
2721
|
+
for (const cls of result.classes) {
|
|
2722
|
+
if (!combined[cls]) combined[cls] = {};
|
|
2723
|
+
combined[cls][result.file] = /* @__PURE__ */ new Set([cls]);
|
|
2724
|
+
}
|
|
2725
|
+
}
|
|
2726
|
+
}
|
|
2727
|
+
return combined;
|
|
2728
|
+
};
|
|
2729
|
+
generateSafelist = (scanDirs, outputPath, cwd) => {
|
|
2730
|
+
const classes = scanProjectUsage(scanDirs, cwd || process.cwd());
|
|
2731
|
+
const allClasses = Object.keys(classes).sort();
|
|
2732
|
+
if (outputPath) {
|
|
2733
|
+
fs3__default.writeFileSync(outputPath, JSON.stringify(allClasses, null, 2));
|
|
2734
|
+
}
|
|
2735
|
+
return allClasses;
|
|
2736
|
+
};
|
|
2737
|
+
loadSafelist = (safelistPath) => {
|
|
2738
|
+
try {
|
|
2739
|
+
const content = fs3__default.readFileSync(safelistPath, "utf-8");
|
|
2740
|
+
return JSON.parse(content);
|
|
2741
|
+
} catch {
|
|
2742
|
+
return [];
|
|
2743
|
+
}
|
|
2744
|
+
};
|
|
2745
|
+
loadTailwindConfig = (cwd = process.cwd()) => {
|
|
2746
|
+
const configFiles = [
|
|
2747
|
+
"tailwind.config.ts",
|
|
2748
|
+
"tailwind.config.js",
|
|
2749
|
+
"tailwind.config.mjs",
|
|
2750
|
+
"tailwind.config.cjs"
|
|
2751
|
+
];
|
|
2752
|
+
for (const file of configFiles) {
|
|
2753
|
+
const fullPath = path__default.join(cwd, file);
|
|
2754
|
+
if (fs3__default.existsSync(fullPath)) {
|
|
2755
|
+
const mod = __require(fullPath);
|
|
2756
|
+
return mod.default || mod;
|
|
2757
|
+
}
|
|
2758
|
+
}
|
|
2759
|
+
return {};
|
|
2760
|
+
};
|
|
2761
|
+
getContentPaths = (cwd = process.cwd()) => {
|
|
2762
|
+
return {
|
|
2763
|
+
content: [
|
|
2764
|
+
path__default.join(cwd, "src/**/*.{js,ts,jsx,tsx}"),
|
|
2765
|
+
path__default.join(cwd, "app/**/*.{js,ts,jsx,tsx}"),
|
|
2766
|
+
path__default.join(cwd, "pages/**/*.{js,ts,jsx,tsx}")
|
|
2767
|
+
]
|
|
2768
|
+
};
|
|
2769
|
+
};
|
|
2770
|
+
_CONTAINER_BREAKPOINTS = {
|
|
2771
|
+
xs: "240px",
|
|
2772
|
+
sm: "320px",
|
|
2773
|
+
md: "640px",
|
|
2774
|
+
lg: "1024px",
|
|
2775
|
+
xl: "1280px",
|
|
2776
|
+
"2xl": "1536px"
|
|
2777
|
+
};
|
|
2778
|
+
runLoaderTransform = (ctx) => {
|
|
2779
|
+
const { filepath, source, options } = ctx;
|
|
2780
|
+
const result = transformSource(source, { filename: filepath, ...options });
|
|
2781
|
+
let staticCss;
|
|
2782
|
+
try {
|
|
2783
|
+
const cssChunks = [];
|
|
2784
|
+
const stateRules = extractAndGenerateStateCss(source, filepath);
|
|
2785
|
+
if (stateRules.length > 0) {
|
|
2786
|
+
cssChunks.push(stateRules.map((r) => r.cssRule).join("\n"));
|
|
2787
|
+
}
|
|
2788
|
+
const containerCss = extractContainerCssFromSource(source);
|
|
2789
|
+
if (containerCss) cssChunks.push(containerCss);
|
|
2790
|
+
const combined = cssChunks.join("\n").trim();
|
|
2791
|
+
if (combined) staticCss = combined;
|
|
2792
|
+
} catch (err) {
|
|
2793
|
+
console.debug("Static CSS extraction warning:", err);
|
|
2794
|
+
}
|
|
2795
|
+
return {
|
|
2796
|
+
code: result?.code || "",
|
|
2797
|
+
changed: result?.changed || false,
|
|
2798
|
+
classes: result?.classes || [],
|
|
2799
|
+
staticCss
|
|
2800
|
+
};
|
|
2801
|
+
};
|
|
2802
|
+
shouldSkipFile = (filepath) => {
|
|
2803
|
+
const SKIP_PATHS = ["node_modules", ".next", ".rspack-dist", ".turbo", "dist/", "out/"];
|
|
2804
|
+
const skipExtensions = [".css", ".json", ".md", ".txt", ".yaml", ".yml"];
|
|
2805
|
+
for (const p of SKIP_PATHS) {
|
|
2806
|
+
if (filepath.includes(p)) return true;
|
|
2807
|
+
}
|
|
2808
|
+
for (const ext of skipExtensions) {
|
|
2809
|
+
if (filepath.endsWith(ext)) return true;
|
|
2810
|
+
}
|
|
2811
|
+
return false;
|
|
2812
|
+
};
|
|
2813
|
+
fileToRoute = (filepath) => {
|
|
2814
|
+
const normalized = filepath.replace(/\\/g, "/");
|
|
2815
|
+
if (normalized.includes("/layout.") || normalized.includes("/loading.") || normalized.includes("/error.")) {
|
|
2816
|
+
return "__global";
|
|
2817
|
+
}
|
|
2818
|
+
const pageMatch = normalized.match(/\/app\/(.+?)\/page\.[tj]sx?$/);
|
|
2819
|
+
if (pageMatch) return `/${pageMatch[1]}`;
|
|
2820
|
+
const rootPage = normalized.match(/\/app\/page\.[tj]sx?$/);
|
|
2821
|
+
if (rootPage) return "/";
|
|
2822
|
+
return null;
|
|
2823
|
+
};
|
|
2824
|
+
getAllRoutes = () => {
|
|
2825
|
+
const native = getNativeBridge();
|
|
2826
|
+
if (!native?.analyzeClasses) {
|
|
2827
|
+
throw new Error("FATAL: Native binding 'analyzeClasses' is required but not available.");
|
|
2828
|
+
}
|
|
2829
|
+
return ["/", "__global"];
|
|
2830
|
+
};
|
|
2831
|
+
getRouteClasses = (_route) => /* @__PURE__ */ new Set();
|
|
2832
|
+
registerFileClasses = (_filepath, _classes) => {
|
|
2833
|
+
};
|
|
2834
|
+
registerGlobalClasses = (_classes) => {
|
|
2835
|
+
};
|
|
2836
|
+
_incrementalEngineInstance = null;
|
|
2837
|
+
getIncrementalEngine = () => {
|
|
2838
|
+
if (!_incrementalEngineInstance) {
|
|
2839
|
+
_incrementalEngineInstance = new IncrementalEngine();
|
|
2840
|
+
}
|
|
2841
|
+
return _incrementalEngineInstance;
|
|
2842
|
+
};
|
|
2843
|
+
resetIncrementalEngine = () => {
|
|
2844
|
+
_incrementalEngineInstance = null;
|
|
2845
|
+
};
|
|
2846
|
+
IncrementalEngine = class {
|
|
2847
|
+
compile(source) {
|
|
2848
|
+
return transformSource(source);
|
|
2849
|
+
}
|
|
2850
|
+
};
|
|
2851
|
+
getBucketEngine = () => {
|
|
2852
|
+
const native = getNativeBridge();
|
|
2853
|
+
if (!native?.classifyAndSortClasses) {
|
|
2854
|
+
throw new Error("FATAL: Native binding 'classifyAndSortClasses' is required but not available.");
|
|
2855
|
+
}
|
|
2856
|
+
return {
|
|
2857
|
+
add: (className) => className,
|
|
2858
|
+
get: (_bucket) => []
|
|
2859
|
+
};
|
|
2860
|
+
};
|
|
2861
|
+
resetBucketEngine = () => {
|
|
2862
|
+
};
|
|
2863
|
+
classifyNode = (_node) => {
|
|
2864
|
+
const native = getNativeBridge();
|
|
2865
|
+
if (!native?.classifyAndSortClasses) {
|
|
2866
|
+
throw new Error("FATAL: Native binding 'classifyAndSortClasses' is required but not available.");
|
|
2867
|
+
}
|
|
2868
|
+
return "unknown";
|
|
2869
|
+
};
|
|
2870
|
+
detectConflicts = (_classes) => {
|
|
2871
|
+
const native = getNativeBridge();
|
|
2872
|
+
if (!native?.analyzeClassUsage) {
|
|
2873
|
+
throw new Error("FATAL: Native binding 'analyzeClassUsage' is required but not available.");
|
|
2874
|
+
}
|
|
2875
|
+
return [];
|
|
2876
|
+
};
|
|
2877
|
+
bucketSort = (classes) => {
|
|
2878
|
+
const native = getNativeBridge();
|
|
2879
|
+
if (!native?.classifyAndSortClasses) {
|
|
2880
|
+
throw new Error("FATAL: Native binding 'classifyAndSortClasses' is required but not available.");
|
|
2881
|
+
}
|
|
2882
|
+
const sorted = native.classifyAndSortClasses(classes);
|
|
2883
|
+
return sorted.map((c) => c.raw ?? c);
|
|
2884
|
+
};
|
|
2885
|
+
analyzeFile = (source, filename) => {
|
|
2886
|
+
const native = getNativeBridge();
|
|
2887
|
+
if (!native?.analyzeRsc) {
|
|
2888
|
+
throw new Error("FATAL: Native binding 'analyzeRsc' is required but not available.");
|
|
2889
|
+
}
|
|
2890
|
+
const rsc = native.analyzeRsc(source, filename);
|
|
2891
|
+
return {
|
|
2892
|
+
isServer: rsc?.isServer ?? true,
|
|
2893
|
+
needsClientDirective: rsc?.needsClientDirective ?? false,
|
|
2894
|
+
clientReasons: rsc?.clientReasons ?? [],
|
|
2895
|
+
interactiveClasses: [],
|
|
2896
|
+
canStaticResolveVariants: true
|
|
2897
|
+
};
|
|
2898
|
+
};
|
|
2899
|
+
analyzeVariantUsage = (_source, _componentName, _variantKeys) => {
|
|
2900
|
+
return { resolved: {}, dynamic: [] };
|
|
2901
|
+
};
|
|
2902
|
+
injectClientDirective = (source) => {
|
|
2903
|
+
if (!source.includes('"use client"') && !source.includes("'use client'")) {
|
|
2904
|
+
return '"use client";\n' + source;
|
|
2905
|
+
}
|
|
2906
|
+
return source;
|
|
2907
|
+
};
|
|
2908
|
+
injectServerOnlyComment = (source) => {
|
|
2909
|
+
return `/* @server-only */
|
|
2910
|
+
${source}`;
|
|
2911
|
+
};
|
|
2912
|
+
analyzeClasses = (filesJson, cwd, flags) => {
|
|
2913
|
+
const native = getNativeBridge();
|
|
2914
|
+
if (!native?.analyzeClasses) {
|
|
2915
|
+
throw new Error("FATAL: Native binding 'analyzeClasses' is required but not available.");
|
|
2916
|
+
}
|
|
2917
|
+
return native.analyzeClasses(filesJson, cwd, flags);
|
|
2918
|
+
};
|
|
2919
|
+
extractTwStateConfigs = (source, filename) => {
|
|
2920
|
+
const native = getNativeBridge();
|
|
2921
|
+
if (!native?.extractTwStateConfigs) {
|
|
2922
|
+
throw new Error("FATAL: Native binding 'extractTwStateConfigs' is required but not available.");
|
|
2923
|
+
}
|
|
2924
|
+
return native.extractTwStateConfigs(source, filename);
|
|
2925
|
+
};
|
|
2926
|
+
generateStaticStateCss = (entries, _themeConfig) => {
|
|
2927
|
+
const rules = [];
|
|
2928
|
+
for (const entry of entries) {
|
|
2929
|
+
const stateConfig = JSON.parse(entry.statesJson);
|
|
2930
|
+
for (const [stateName, classes] of Object.entries(stateConfig)) {
|
|
2931
|
+
rules.push({
|
|
2932
|
+
selector: `.${entry.componentName}[data-state="${stateName}"]`,
|
|
2933
|
+
declarations: classes,
|
|
2934
|
+
cssRule: `.${entry.componentName}[data-state="${stateName}"]{${classes}}`,
|
|
2935
|
+
componentName: entry.componentName,
|
|
2936
|
+
stateName
|
|
2937
|
+
});
|
|
2938
|
+
}
|
|
2939
|
+
}
|
|
2940
|
+
return rules;
|
|
2941
|
+
};
|
|
2942
|
+
extractAndGenerateStateCss = (source, filename) => {
|
|
2943
|
+
const entries = extractTwStateConfigs(source, filename);
|
|
2944
|
+
return generateStaticStateCss(entries);
|
|
2945
|
+
};
|
|
2946
|
+
}
|
|
2947
|
+
});
|
|
2948
|
+
|
|
2949
|
+
// packages/domain/compiler/src/internal.ts
|
|
2950
|
+
var internal_exports = {};
|
|
2951
|
+
__export(internal_exports, {
|
|
2952
|
+
adaptNativeResult: () => adaptNativeResult,
|
|
2953
|
+
analyzeClassUsageNative: () => analyzeClassUsageNative,
|
|
2954
|
+
analyzeClasses: () => analyzeClasses,
|
|
2955
|
+
analyzeClassesNative: () => analyzeClassesNative,
|
|
2956
|
+
analyzeFile: () => analyzeFile,
|
|
2957
|
+
analyzeRscNative: () => analyzeRscNative,
|
|
2958
|
+
analyzeVariantUsage: () => analyzeVariantUsage,
|
|
2959
|
+
astExtractClasses: () => astExtractClasses,
|
|
2960
|
+
atomicRegistrySize: () => atomicRegistrySize,
|
|
2961
|
+
batchExtractClasses: () => batchExtractClasses,
|
|
2962
|
+
batchExtractClassesNative: () => batchExtractClassesNative,
|
|
2963
|
+
bucketSort: () => bucketSort,
|
|
2964
|
+
buildStyleTag: () => buildStyleTag,
|
|
2965
|
+
cachePriority: () => cachePriority,
|
|
2966
|
+
cacheRead: () => cacheRead,
|
|
2967
|
+
cacheWrite: () => cacheWrite,
|
|
2968
|
+
checkAgainstSafelist: () => checkAgainstSafelist,
|
|
2969
|
+
checkAgainstSafelistNative: () => checkAgainstSafelistNative,
|
|
2970
|
+
classifyAndSortClassesNative: () => classifyAndSortClassesNative,
|
|
2971
|
+
classifyNode: () => classifyNode,
|
|
2972
|
+
clearAllCaches: () => clearAllCaches,
|
|
2973
|
+
clearAtomicRegistry: () => clearAtomicRegistry,
|
|
2974
|
+
clearCache: () => clearCache,
|
|
2975
|
+
clearCompileCache: () => clearCompileCache,
|
|
2976
|
+
clearCssGenCache: () => clearCssGenCache,
|
|
2977
|
+
clearParseCache: () => clearParseCache,
|
|
2978
|
+
clearResolveCache: () => clearResolveCache,
|
|
2979
|
+
clearThemeCache: () => clearThemeCache,
|
|
2980
|
+
collectFiles: () => collectFiles,
|
|
2981
|
+
compileAnimation: () => compileAnimation,
|
|
2982
|
+
compileClass: () => compileClass,
|
|
2983
|
+
compileClasses: () => compileClasses,
|
|
2984
|
+
compileCssFromClasses: () => compileCssFromClasses,
|
|
2985
|
+
compileCssLightning: () => compileCssLightning,
|
|
2986
|
+
compileCssNative2: () => compileCssNative2,
|
|
2987
|
+
compileKeyframes: () => compileKeyframes,
|
|
2988
|
+
compileTheme: () => compileTheme,
|
|
2989
|
+
compileToCss: () => compileToCss,
|
|
2990
|
+
compileToCssBatch: () => compileToCssBatch,
|
|
2991
|
+
compileVariantTableNative: () => compileVariantTableNative,
|
|
2992
|
+
computeIncrementalDiff: () => computeIncrementalDiff,
|
|
2993
|
+
createFingerprint: () => createFingerprint,
|
|
2994
|
+
detectConflicts: () => detectConflicts,
|
|
2995
|
+
detectDeadCode: () => detectDeadCode,
|
|
2996
|
+
diffClassLists: () => diffClassLists,
|
|
2997
|
+
eliminateDeadCss: () => eliminateDeadCss,
|
|
2998
|
+
eliminateDeadCssNative: () => eliminateDeadCssNative,
|
|
2999
|
+
emitPluginHook: () => emitPluginHook,
|
|
3000
|
+
estimateOptimalCacheConfig: () => estimateOptimalCacheConfig,
|
|
3001
|
+
extractAllClasses: () => extractAllClasses,
|
|
3002
|
+
extractAndGenerateStateCss: () => extractAndGenerateStateCss,
|
|
3003
|
+
extractAndGenerateStateCssNative: () => extractAndGenerateStateCssNative,
|
|
3004
|
+
extractClassesFromSource: () => extractClassesFromSource,
|
|
3005
|
+
extractClassesFromSourceNative: () => extractClassesFromSourceNative,
|
|
3006
|
+
extractComponentUsage: () => extractComponentUsage,
|
|
3007
|
+
extractContainerCssFromSource: () => extractContainerCssFromSource,
|
|
3008
|
+
extractTwContainerConfigs: () => extractTwContainerConfigs,
|
|
3009
|
+
extractTwStateConfigs: () => extractTwStateConfigs,
|
|
3010
|
+
extractTwStateConfigsNative: () => extractTwStateConfigsNative,
|
|
3011
|
+
fileToRoute: () => fileToRoute,
|
|
3012
|
+
findDeadVariants: () => findDeadVariants,
|
|
3013
|
+
generateAtomicCss: () => generateAtomicCss,
|
|
3014
|
+
generateCssForClasses: () => generateCssForClasses,
|
|
3015
|
+
generateCssNative: () => generateCssNative,
|
|
3016
|
+
generateSafelist: () => generateSafelist,
|
|
3017
|
+
generateStaticStateCss: () => generateStaticStateCss,
|
|
3018
|
+
generateStaticStateCssNative: () => generateStaticStateCssNative,
|
|
3019
|
+
generateSubComponentTypes: () => generateSubComponentTypes,
|
|
3020
|
+
getAllRoutes: () => getAllRoutes,
|
|
3021
|
+
getBucketEngine: () => getBucketEngine,
|
|
3022
|
+
getCacheOptimizationHints: () => getCacheOptimizationHints,
|
|
3023
|
+
getCacheStatistics: () => getCacheStatistics,
|
|
3024
|
+
getCacheStats: () => getCacheStats,
|
|
3025
|
+
getCompilationMetrics: () => getCompilationMetrics,
|
|
3026
|
+
getCompilerDiagnostics: () => getCompilerDiagnostics,
|
|
3027
|
+
getContentPaths: () => getContentPaths,
|
|
3028
|
+
getIncrementalEngine: () => getIncrementalEngine,
|
|
3029
|
+
getNativeBridge: () => getNativeBridge,
|
|
3030
|
+
getPluginHooks: () => getPluginHooks,
|
|
3031
|
+
getRouteClasses: () => getRouteClasses,
|
|
3032
|
+
getWatchStats: () => getWatchStats,
|
|
3033
|
+
hasTwUsage: () => hasTwUsage,
|
|
3034
|
+
hashContent: () => hashContent,
|
|
3035
|
+
hoistComponentsNative: () => hoistComponentsNative,
|
|
3036
|
+
idRegistryActiveCount: () => idRegistryActiveCount,
|
|
3037
|
+
idRegistryCreate: () => idRegistryCreate,
|
|
3038
|
+
idRegistryDestroy: () => idRegistryDestroy,
|
|
3039
|
+
idRegistryExport: () => idRegistryExport,
|
|
3040
|
+
idRegistryGenerate: () => idRegistryGenerate,
|
|
3041
|
+
idRegistryImport: () => idRegistryImport,
|
|
3042
|
+
idRegistryLookup: () => idRegistryLookup,
|
|
3043
|
+
idRegistryNext: () => idRegistryNext,
|
|
3044
|
+
idRegistryReset: () => idRegistryReset,
|
|
3045
|
+
idRegistrySnapshot: () => idRegistrySnapshot,
|
|
3046
|
+
injectClientDirective: () => injectClientDirective,
|
|
3047
|
+
injectServerOnlyComment: () => injectServerOnlyComment,
|
|
3048
|
+
injectStateHash: () => injectStateHash,
|
|
3049
|
+
isAlreadyTransformed: () => isAlreadyTransformed,
|
|
3050
|
+
isWatchRunning: () => isWatchRunning,
|
|
3051
|
+
layoutClassesToCss: () => layoutClassesToCss,
|
|
3052
|
+
loadSafelist: () => loadSafelist,
|
|
3053
|
+
loadTailwindConfig: () => loadTailwindConfig,
|
|
3054
|
+
mergeClassesStatic: () => mergeClassesStatic,
|
|
3055
|
+
mergeCssDeclarationsNative: () => mergeCssDeclarationsNative,
|
|
3056
|
+
minifyCss: () => minifyCss,
|
|
3057
|
+
normalizeAndDedupClasses: () => normalizeAndDedupClasses,
|
|
3058
|
+
normalizeClasses: () => normalizeClasses,
|
|
3059
|
+
optimizeCssNative: () => optimizeCssNative,
|
|
3060
|
+
parseAtomicClass: () => parseAtomicClass,
|
|
3061
|
+
parseClasses: () => parseClasses,
|
|
3062
|
+
pollWatchEvents: () => pollWatchEvents,
|
|
3063
|
+
processFileChange: () => processFileChange,
|
|
3064
|
+
processTailwindCssLightning: () => processTailwindCssLightning,
|
|
3065
|
+
propertyIdToString: () => propertyIdToString,
|
|
3066
|
+
pruneStaleCacheEntries: () => pruneStaleCacheEntries,
|
|
3067
|
+
rebuildWorkspaceResult: () => rebuildWorkspaceResult,
|
|
3068
|
+
redisCacheClear: () => redisCacheClear,
|
|
3069
|
+
redisCacheHitRate: () => redisCacheHitRate,
|
|
3070
|
+
redisCacheKeyCount: () => redisCacheKeyCount,
|
|
3071
|
+
redisCacheSize: () => redisCacheSize,
|
|
3072
|
+
redisCacheSync: () => redisCacheSync,
|
|
3073
|
+
redisClusterStatus: () => redisClusterStatus,
|
|
3074
|
+
redisDelete: () => redisDelete,
|
|
3075
|
+
redisDiagnose: () => redisDiagnose,
|
|
3076
|
+
redisDisableCacheWarming: () => redisDisableCacheWarming,
|
|
3077
|
+
redisDisableCluster: () => redisDisableCluster,
|
|
3078
|
+
redisDisablePersistence: () => redisDisablePersistence,
|
|
3079
|
+
redisEnableCacheWarming: () => redisEnableCacheWarming,
|
|
3080
|
+
redisEnableCluster: () => redisEnableCluster,
|
|
3081
|
+
redisEnablePersistence: () => redisEnablePersistence,
|
|
3082
|
+
redisExists: () => redisExists,
|
|
3083
|
+
redisExpirationGet: () => redisExpirationGet,
|
|
3084
|
+
redisExpirationSet: () => redisExpirationSet,
|
|
3085
|
+
redisFlushAll: () => redisFlushAll,
|
|
3086
|
+
redisFlushDb: () => redisFlushDb,
|
|
3087
|
+
redisGet: () => redisGet,
|
|
3088
|
+
redisGetEvictionPolicy: () => redisGetEvictionPolicy,
|
|
3089
|
+
redisInfo: () => redisInfo,
|
|
3090
|
+
redisMemoryStats: () => redisMemoryStats,
|
|
3091
|
+
redisMget: () => redisMget,
|
|
3092
|
+
redisMonitor: () => redisMonitor,
|
|
3093
|
+
redisMset: () => redisMset,
|
|
3094
|
+
redisOptimizeMemory: () => redisOptimizeMemory,
|
|
3095
|
+
redisPing: () => redisPing,
|
|
3096
|
+
redisPoolConnect: () => redisPoolConnect,
|
|
3097
|
+
redisPoolReconnect: () => redisPoolReconnect,
|
|
3098
|
+
redisPoolStats: () => redisPoolStats,
|
|
3099
|
+
redisPublish: () => redisPublish,
|
|
3100
|
+
redisReplicate: () => redisReplicate,
|
|
3101
|
+
redisReplicationStatus: () => redisReplicationStatus,
|
|
3102
|
+
redisSet: () => redisSet,
|
|
3103
|
+
redisSetEvictionPolicy: () => redisSetEvictionPolicy,
|
|
3104
|
+
redisSnapshot: () => redisSnapshot,
|
|
3105
|
+
redisSubscribe: () => redisSubscribe,
|
|
3106
|
+
registerFileClasses: () => registerFileClasses,
|
|
3107
|
+
registerGlobalClasses: () => registerGlobalClasses,
|
|
3108
|
+
registerPluginHook: () => registerPluginHook,
|
|
3109
|
+
registerPropertyName: () => registerPropertyName,
|
|
3110
|
+
registerValueName: () => registerValueName,
|
|
3111
|
+
resetBucketEngine: () => resetBucketEngine,
|
|
3112
|
+
resetCompilationMetrics: () => resetCompilationMetrics,
|
|
3113
|
+
resetIncrementalEngine: () => resetIncrementalEngine,
|
|
3114
|
+
resolveCascade: () => resolveCascade,
|
|
3115
|
+
resolveClassNames: () => resolveClassNames,
|
|
3116
|
+
resolveConflictGroup: () => resolveConflictGroup,
|
|
3117
|
+
resolveSimpleVariants: () => resolveSimpleVariants,
|
|
3118
|
+
resolveThemeValue: () => resolveThemeValue,
|
|
3119
|
+
resolveVariants: () => resolveVariants,
|
|
3120
|
+
reverseLookupProperty: () => reverseLookupProperty,
|
|
3121
|
+
reverseLookupValue: () => reverseLookupValue,
|
|
3122
|
+
runCssPipeline: () => runCssPipeline,
|
|
3123
|
+
runCssPipelineSync: () => runCssPipelineSync,
|
|
3124
|
+
runElimination: () => runElimination,
|
|
3125
|
+
runLoaderTransform: () => runLoaderTransform,
|
|
3126
|
+
scanCacheOptimizations: () => scanCacheOptimizations,
|
|
3127
|
+
scanFile: () => scanFile,
|
|
3128
|
+
scanFileNative: () => scanFileNative,
|
|
3129
|
+
scanFilesBatchNative: () => scanFilesBatchNative,
|
|
3130
|
+
scanProjectUsage: () => scanProjectUsage,
|
|
3131
|
+
scanWorkspace: () => scanWorkspace,
|
|
3132
|
+
shouldProcess: () => shouldProcess,
|
|
3133
|
+
shouldSkipFile: () => shouldSkipFile,
|
|
3134
|
+
startWatch: () => startWatch,
|
|
3135
|
+
stopWatch: () => stopWatch,
|
|
3136
|
+
toAtomicClasses: () => toAtomicClasses,
|
|
3137
|
+
transformSource: () => transformSource,
|
|
3138
|
+
twMerge: () => twMerge,
|
|
3139
|
+
twMergeMany: () => twMergeMany,
|
|
3140
|
+
twMergeManyWithSeparator: () => twMergeManyWithSeparator,
|
|
3141
|
+
twMergeRaw: () => twMergeRaw,
|
|
3142
|
+
twMergeWithSeparator: () => twMergeWithSeparator,
|
|
3143
|
+
unregisterPluginHook: () => unregisterPluginHook,
|
|
3144
|
+
validateCssOutput: () => validateCssOutput,
|
|
3145
|
+
validateThemeConfig: () => validateThemeConfig,
|
|
3146
|
+
valueIdToString: () => valueIdToString,
|
|
3147
|
+
walkAndPrefilterSourceFiles: () => walkAndPrefilterSourceFiles,
|
|
3148
|
+
watchAddPattern: () => watchAddPattern,
|
|
3149
|
+
watchClearAll: () => watchClearAll,
|
|
3150
|
+
watchEventTypeToString: () => watchEventTypeToString,
|
|
3151
|
+
watchGetActiveHandles: () => watchGetActiveHandles,
|
|
3152
|
+
watchPause: () => watchPause,
|
|
3153
|
+
watchRemovePattern: () => watchRemovePattern,
|
|
3154
|
+
watchResume: () => watchResume
|
|
3155
|
+
});
|
|
3156
|
+
var init_internal = __esm({
|
|
3157
|
+
"packages/domain/compiler/src/internal.ts"() {
|
|
3158
|
+
init_src();
|
|
3159
|
+
init_tailwindEngine();
|
|
3160
|
+
init_compiler();
|
|
3161
|
+
init_parser();
|
|
3162
|
+
init_analyzer();
|
|
3163
|
+
init_cache();
|
|
3164
|
+
init_redis();
|
|
3165
|
+
init_watch();
|
|
3166
|
+
}
|
|
3167
|
+
});
|
|
3168
|
+
function getNative() {
|
|
3169
|
+
if (_native) return _native;
|
|
3170
|
+
try {
|
|
3171
|
+
const mod = (init_internal(), __toCommonJS(internal_exports));
|
|
3172
|
+
if (typeof mod?.extractTwStateConfigs !== "function" || typeof mod?.generateStaticStateCss !== "function") {
|
|
3173
|
+
return null;
|
|
3174
|
+
}
|
|
3175
|
+
_native = {
|
|
3176
|
+
extractTwStateConfigs: mod.extractTwStateConfigs,
|
|
3177
|
+
generateStaticStateCss: mod.generateStaticStateCss,
|
|
3178
|
+
extractAndGenerateStateCss: mod.extractAndGenerateStateCss ?? // Fallback jika extractAndGenerateStateCss belum di-export
|
|
3179
|
+
((source, filename) => {
|
|
3180
|
+
const configs = mod.extractTwStateConfigs(source, filename);
|
|
3181
|
+
if (configs.length === 0) return [];
|
|
3182
|
+
return mod.generateStaticStateCss(configs.map((c) => ({
|
|
3183
|
+
tag: c.tag,
|
|
3184
|
+
componentName: c.componentName,
|
|
3185
|
+
statesJson: c.statesJson
|
|
3186
|
+
})));
|
|
3187
|
+
})
|
|
3188
|
+
};
|
|
3189
|
+
return _native;
|
|
3190
|
+
} catch {
|
|
3191
|
+
return null;
|
|
3192
|
+
}
|
|
3193
|
+
}
|
|
3194
|
+
function* walkSourceFiles(dir) {
|
|
3195
|
+
let entries;
|
|
3196
|
+
try {
|
|
3197
|
+
entries = fs3__default.readdirSync(dir, { withFileTypes: true });
|
|
3198
|
+
} catch {
|
|
3199
|
+
return;
|
|
3200
|
+
}
|
|
3201
|
+
for (const entry of entries) {
|
|
3202
|
+
const fullPath = path__default.join(dir, entry.name);
|
|
3203
|
+
if (entry.isDirectory()) {
|
|
3204
|
+
if (IGNORE_PATTERNS.some((p) => entry.name === p || entry.name.startsWith(p))) continue;
|
|
3205
|
+
yield* walkSourceFiles(fullPath);
|
|
3206
|
+
} else if (entry.isFile()) {
|
|
3207
|
+
const ext = path__default.extname(entry.name);
|
|
3208
|
+
if (SOURCE_EXTENSIONS.has(ext)) yield fullPath;
|
|
3209
|
+
}
|
|
3210
|
+
}
|
|
3211
|
+
}
|
|
3212
|
+
function buildCssHeader(result) {
|
|
3213
|
+
return [
|
|
3214
|
+
"/* \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500",
|
|
3215
|
+
" * tw-state-static.css \u2014 Auto-generated by staticStateExtractor.ts",
|
|
3216
|
+
" * DO NOT EDIT. Re-generated on each build.",
|
|
3217
|
+
" *",
|
|
3218
|
+
` * Files scanned: ${result.filesScanned}`,
|
|
3219
|
+
` * Files with states: ${result.filesWithStates}`,
|
|
3220
|
+
` * Components found: ${result.componentsFound}`,
|
|
3221
|
+
` * Rules generated: ${result.rulesGenerated}`,
|
|
3222
|
+
` * Rules skipped: ${result.rulesSkipped} (akan di-inject runtime sebagai fallback)`,
|
|
3223
|
+
" *",
|
|
3224
|
+
' * Selector format: .tw-s-[hash][data-stateName="true"] { ... }',
|
|
3225
|
+
" * Hash identik dengan yang dibuat oleh stateEngine.ts di runtime.",
|
|
3226
|
+
" * \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */",
|
|
3227
|
+
""
|
|
3228
|
+
].join("\n");
|
|
3229
|
+
}
|
|
3230
|
+
function extractStaticStateCss(srcDir, options = {}) {
|
|
3231
|
+
const { verbose = false, maxFiles = Infinity } = options;
|
|
3232
|
+
const native = getNative();
|
|
3233
|
+
if (!native) {
|
|
3234
|
+
if (verbose) {
|
|
3235
|
+
process.stderr.write(
|
|
3236
|
+
"[tw:static-state] native module tidak tersedia \u2014 skip static CSS pre-generation\n"
|
|
3237
|
+
);
|
|
3238
|
+
}
|
|
3239
|
+
return {
|
|
3240
|
+
filesScanned: 0,
|
|
3241
|
+
filesWithStates: 0,
|
|
3242
|
+
componentsFound: 0,
|
|
3243
|
+
rulesGenerated: 0,
|
|
3244
|
+
rulesSkipped: 0,
|
|
3245
|
+
generatedCss: "",
|
|
3246
|
+
rules: []
|
|
3247
|
+
};
|
|
3248
|
+
}
|
|
3249
|
+
const allConfigs = [];
|
|
3250
|
+
let filesScanned = 0;
|
|
3251
|
+
let filesWithStates = 0;
|
|
3252
|
+
if (native.walkAndPrefilterSourceFiles) {
|
|
3253
|
+
const prefiltered = native.walkAndPrefilterSourceFiles(
|
|
3254
|
+
srcDir,
|
|
3255
|
+
[".ts", ".tsx", ".js", ".jsx", ".mts", ".mjs"],
|
|
3256
|
+
["node_modules", ".next", "dist", "build", ".git", "coverage", "__tests__"],
|
|
3257
|
+
// Required substrings — AND logic, identik dengan JS pre-filter di bawah
|
|
3258
|
+
["states:", "tw."],
|
|
3259
|
+
maxFiles === Infinity ? null : maxFiles,
|
|
3260
|
+
null
|
|
3261
|
+
// sequential — parallel mode opsional untuk large monorepo
|
|
3262
|
+
);
|
|
3263
|
+
for (const { path: filePath, content: source } of prefiltered) {
|
|
3264
|
+
filesScanned++;
|
|
3265
|
+
const configs = native.extractTwStateConfigs(source, filePath);
|
|
3266
|
+
if (configs.length > 0) {
|
|
3267
|
+
filesWithStates++;
|
|
3268
|
+
allConfigs.push(...configs);
|
|
3269
|
+
if (verbose) {
|
|
3270
|
+
process.stderr.write(
|
|
3271
|
+
`[tw:static-state] ${path__default.relative(srcDir, filePath)}: ${configs.length} komponen
|
|
3272
|
+
`
|
|
3273
|
+
);
|
|
3274
|
+
}
|
|
3275
|
+
}
|
|
3276
|
+
}
|
|
3277
|
+
} else {
|
|
3278
|
+
for (const filePath of walkSourceFiles(srcDir)) {
|
|
3279
|
+
if (filesScanned >= maxFiles) break;
|
|
3280
|
+
let source;
|
|
3281
|
+
try {
|
|
3282
|
+
source = fs3__default.readFileSync(filePath, "utf-8");
|
|
3283
|
+
} catch {
|
|
3284
|
+
continue;
|
|
3285
|
+
}
|
|
3286
|
+
filesScanned++;
|
|
3287
|
+
if (!source.includes("states:") && !source.includes("states :")) continue;
|
|
3288
|
+
if (!source.includes("tw.") && !source.includes("tailwind-styled")) continue;
|
|
3289
|
+
const configs = native.extractTwStateConfigs(source, filePath);
|
|
3290
|
+
if (configs.length > 0) {
|
|
3291
|
+
filesWithStates++;
|
|
3292
|
+
allConfigs.push(...configs);
|
|
3293
|
+
if (verbose) {
|
|
3294
|
+
process.stderr.write(
|
|
3295
|
+
`[tw:static-state] ${path__default.relative(srcDir, filePath)}: ${configs.length} komponen
|
|
3296
|
+
`
|
|
3297
|
+
);
|
|
3298
|
+
}
|
|
3299
|
+
}
|
|
3300
|
+
}
|
|
3301
|
+
}
|
|
3302
|
+
if (allConfigs.length === 0) {
|
|
3303
|
+
return {
|
|
3304
|
+
filesScanned,
|
|
3305
|
+
filesWithStates: 0,
|
|
3306
|
+
componentsFound: 0,
|
|
3307
|
+
rulesGenerated: 0,
|
|
3308
|
+
rulesSkipped: 0,
|
|
3309
|
+
generatedCss: "",
|
|
3310
|
+
rules: []
|
|
3311
|
+
};
|
|
3312
|
+
}
|
|
3313
|
+
const seen = /* @__PURE__ */ new Set();
|
|
3314
|
+
const uniqueConfigs = [];
|
|
3315
|
+
for (const config of allConfigs) {
|
|
3316
|
+
const key = `${config.tag}::${config.statesJson}`;
|
|
3317
|
+
if (!seen.has(key)) {
|
|
3318
|
+
seen.add(key);
|
|
3319
|
+
uniqueConfigs.push({
|
|
3320
|
+
tag: config.tag,
|
|
3321
|
+
componentName: config.componentName,
|
|
3322
|
+
statesJson: config.statesJson
|
|
3323
|
+
});
|
|
3324
|
+
}
|
|
3325
|
+
}
|
|
3326
|
+
const allRules = native.generateStaticStateCss(uniqueConfigs, options.resolvedCss ?? null);
|
|
3327
|
+
const rulesSkipped = uniqueConfigs.reduce((total, cfg) => {
|
|
3328
|
+
try {
|
|
3329
|
+
const stateMap = JSON.parse(cfg.statesJson);
|
|
3330
|
+
return total + Object.keys(stateMap).length;
|
|
3331
|
+
} catch {
|
|
3332
|
+
return total;
|
|
3333
|
+
}
|
|
3334
|
+
}, 0) - allRules.length;
|
|
3335
|
+
const byComponent = /* @__PURE__ */ new Map();
|
|
3336
|
+
for (const rule of allRules) {
|
|
3337
|
+
const existing = byComponent.get(rule.componentName) ?? [];
|
|
3338
|
+
existing.push(rule);
|
|
3339
|
+
byComponent.set(rule.componentName, existing);
|
|
3340
|
+
}
|
|
3341
|
+
const cssBlocks = [];
|
|
3342
|
+
for (const [componentName, rules] of byComponent) {
|
|
3343
|
+
cssBlocks.push(`/* ${componentName} */`);
|
|
3344
|
+
for (const rule of rules) {
|
|
3345
|
+
cssBlocks.push(`/* state: ${rule.stateName} */`);
|
|
3346
|
+
cssBlocks.push(rule.cssRule);
|
|
3347
|
+
}
|
|
3348
|
+
cssBlocks.push("");
|
|
3349
|
+
}
|
|
3350
|
+
const result = {
|
|
3351
|
+
filesScanned,
|
|
3352
|
+
filesWithStates,
|
|
3353
|
+
componentsFound: allConfigs.length,
|
|
3354
|
+
rulesGenerated: allRules.length,
|
|
3355
|
+
rulesSkipped: Math.max(0, rulesSkipped),
|
|
3356
|
+
generatedCss: cssBlocks.join("\n"),
|
|
3357
|
+
rules: allRules
|
|
3358
|
+
};
|
|
3359
|
+
result.generatedCss = buildCssHeader(result) + result.generatedCss;
|
|
3360
|
+
return result;
|
|
3361
|
+
}
|
|
3362
|
+
function appendStaticStateCssToSafelist(srcDir, safelistPath, options = {}) {
|
|
3363
|
+
const result = extractStaticStateCss(srcDir, options);
|
|
3364
|
+
const twClassesDir = path__default.join(path__default.dirname(safelistPath), "tw-classes");
|
|
3365
|
+
fs3__default.mkdirSync(twClassesDir, { recursive: true });
|
|
3366
|
+
const stateFilePath = path__default.join(twClassesDir, TW_STATE_STATIC_FILENAME);
|
|
3367
|
+
if (result.rulesGenerated === 0) {
|
|
3368
|
+
try {
|
|
3369
|
+
fs3__default.writeFileSync(
|
|
3370
|
+
stateFilePath,
|
|
3371
|
+
"/* tw-state-static.css \u2014 tidak ada state rules yang di-generate */\n",
|
|
3372
|
+
"utf-8"
|
|
3373
|
+
);
|
|
3374
|
+
} catch {
|
|
3375
|
+
}
|
|
3376
|
+
return `[tw:static-state] tidak ada state rules yang di-generate (${result.filesScanned} files di-scan)`;
|
|
3377
|
+
}
|
|
3378
|
+
try {
|
|
3379
|
+
fs3__default.writeFileSync(stateFilePath, result.generatedCss, "utf-8");
|
|
3380
|
+
return [
|
|
3381
|
+
`[tw:static-state] ${result.rulesGenerated} static state rules di-generate`,
|
|
3382
|
+
` \u2192 ${result.filesScanned} files scanned, ${result.filesWithStates} dengan states`,
|
|
3383
|
+
` \u2192 ${result.componentsFound} components, ${result.rulesSkipped} rules skipped (fallback ke runtime)`,
|
|
3384
|
+
` \u2192 ditulis ke tw-classes/${TW_STATE_STATIC_FILENAME}`
|
|
3385
|
+
].join("\n");
|
|
3386
|
+
} catch (writeErr) {
|
|
3387
|
+
const msg = writeErr instanceof Error ? writeErr.message : String(writeErr);
|
|
3388
|
+
return `[tw:static-state] gagal tulis state CSS: ${msg}`;
|
|
3389
|
+
}
|
|
3390
|
+
}
|
|
3391
|
+
var SOURCE_EXTENSIONS, IGNORE_PATTERNS, _native, TW_STATE_STATIC_FILENAME;
|
|
3392
|
+
var init_staticStateExtractor = __esm({
|
|
3393
|
+
"packages/domain/shared/src/staticStateExtractor.ts"() {
|
|
3394
|
+
SOURCE_EXTENSIONS = /* @__PURE__ */ new Set([".ts", ".tsx", ".js", ".jsx", ".mts", ".mjs"]);
|
|
3395
|
+
IGNORE_PATTERNS = ["node_modules", ".next", "dist", "build", ".git", "coverage", "__tests__"];
|
|
3396
|
+
_native = null;
|
|
3397
|
+
TW_STATE_STATIC_FILENAME = "_tw-state-static.css";
|
|
3398
|
+
}
|
|
3399
|
+
});
|
|
3400
|
+
function getEnvLevel() {
|
|
3401
|
+
const env = process.env.TWS_LOG_LEVEL?.toLowerCase();
|
|
3402
|
+
if (env && env in LEVELS) return env;
|
|
3403
|
+
return process.env.TWS_DEBUG_SCANNER === "1" ? "debug" : "info";
|
|
3404
|
+
}
|
|
3405
|
+
function setGlobalLogFile(filePath) {
|
|
3406
|
+
_globalLogFile = filePath;
|
|
3407
|
+
_logFileInitialized = false;
|
|
3408
|
+
try {
|
|
3409
|
+
fs3__default.mkdirSync(path__default.dirname(filePath), { recursive: true });
|
|
3410
|
+
fs3__default.writeFileSync(
|
|
3411
|
+
filePath,
|
|
3412
|
+
`# tailwind-styled build log \u2014 ${(/* @__PURE__ */ new Date()).toISOString()}
|
|
3413
|
+
`,
|
|
3414
|
+
"utf-8"
|
|
3415
|
+
);
|
|
3416
|
+
_logFileInitialized = true;
|
|
3417
|
+
} catch {
|
|
3418
|
+
}
|
|
3419
|
+
}
|
|
3420
|
+
function writeToFile(line) {
|
|
3421
|
+
if (!_globalLogFile || !_logFileInitialized) return;
|
|
3422
|
+
try {
|
|
3423
|
+
fs3__default.appendFileSync(_globalLogFile, line);
|
|
3424
|
+
} catch {
|
|
3425
|
+
}
|
|
3426
|
+
}
|
|
3427
|
+
function createLogger(prefix, level) {
|
|
3428
|
+
const loggerState = {
|
|
3429
|
+
currentLevel: getEnvLevel(),
|
|
3430
|
+
setLevel(l) {
|
|
3431
|
+
this.currentLevel = l;
|
|
3432
|
+
}
|
|
3433
|
+
};
|
|
3434
|
+
const log2 = (msgLevel, stream, args) => {
|
|
3435
|
+
if (LEVELS[msgLevel] > LEVELS[loggerState.currentLevel]) return;
|
|
3436
|
+
const line = `[${prefix}] ${args.map(String).join(" ")}
|
|
3437
|
+
`;
|
|
3438
|
+
process[stream].write(line);
|
|
3439
|
+
writeToFile(line);
|
|
3440
|
+
};
|
|
3441
|
+
return {
|
|
3442
|
+
error: (...a) => log2("error", "stderr", a),
|
|
3443
|
+
warn: (...a) => log2("warn", "stderr", a),
|
|
3444
|
+
info: (...a) => log2("info", "stdout", a),
|
|
3445
|
+
debug: (...a) => log2("debug", "stderr", a),
|
|
3446
|
+
setLevel: loggerState.setLevel,
|
|
3447
|
+
setLogFile: (filePath) => setGlobalLogFile(filePath)
|
|
3448
|
+
};
|
|
3449
|
+
}
|
|
3450
|
+
var LEVELS, _globalLogFile, _logFileInitialized;
|
|
3451
|
+
var init_logger = __esm({
|
|
3452
|
+
"packages/domain/shared/src/logger.ts"() {
|
|
3453
|
+
LEVELS = { silent: 0, error: 1, warn: 2, info: 3, debug: 4 };
|
|
3454
|
+
_globalLogFile = null;
|
|
3455
|
+
_logFileInitialized = false;
|
|
3456
|
+
createLogger("tailwind-styled");
|
|
3457
|
+
}
|
|
3458
|
+
});
|
|
3459
|
+
function createLogger2(namespace) {
|
|
3460
|
+
const prefix = `[${namespace}]`;
|
|
3461
|
+
return {
|
|
3462
|
+
warn(...args) {
|
|
3463
|
+
process.stderr.write(`${prefix} ${args.map((a) => typeof a === "string" ? a : String(a)).join(" ")}
|
|
3464
|
+
`);
|
|
3465
|
+
},
|
|
3466
|
+
debug(...args) {
|
|
3467
|
+
process.stderr.write(`${prefix} ${args.map((a) => typeof a === "string" ? a : String(a)).join(" ")}
|
|
3468
|
+
`);
|
|
3469
|
+
},
|
|
3470
|
+
error(...args) {
|
|
3471
|
+
process.stderr.write(`${prefix} ${args.map((a) => typeof a === "string" ? a : String(a)).join(" ")}
|
|
3472
|
+
`);
|
|
3473
|
+
},
|
|
3474
|
+
log(...args) {
|
|
3475
|
+
process.stderr.write(`${prefix} ${args.map((a) => typeof a === "string" ? a : String(a)).join(" ")}
|
|
3476
|
+
`);
|
|
3477
|
+
}
|
|
3478
|
+
};
|
|
3479
|
+
}
|
|
3480
|
+
function createDebugLogger(namespace, label) {
|
|
3481
|
+
const prefix = label ? `[${namespace}:${label}]` : `[${namespace}]`;
|
|
3482
|
+
return (msg) => {
|
|
3483
|
+
if (process.env.DEBUG?.includes(namespace) || process.env.TW_DEBUG) {
|
|
3484
|
+
console.debug(prefix, msg);
|
|
3485
|
+
}
|
|
3486
|
+
};
|
|
3487
|
+
}
|
|
3488
|
+
function formatIssuePath(path6) {
|
|
3489
|
+
if (!path6 || path6.length === 0) return "(root)";
|
|
3490
|
+
return path6.map(
|
|
3491
|
+
(segment) => typeof segment === "symbol" ? segment.description ?? segment.toString() : String(segment)
|
|
3492
|
+
).join(".");
|
|
3493
|
+
}
|
|
3494
|
+
function wrapUnknownError(domain, code, error) {
|
|
3495
|
+
return TwError.wrap(domain, code, error);
|
|
3496
|
+
}
|
|
3497
|
+
function isTwError(err) {
|
|
3498
|
+
return err instanceof TwError;
|
|
3499
|
+
}
|
|
3500
|
+
function loadNativeBinding(options) {
|
|
3501
|
+
const { runtimeDir, candidates, isValid } = options;
|
|
3502
|
+
const loadErrors = [];
|
|
3503
|
+
for (const candidate of candidates) {
|
|
3504
|
+
const candidatePath = path__default.resolve(runtimeDir, candidate);
|
|
3505
|
+
try {
|
|
3506
|
+
if (!fs3__default.existsSync(candidatePath) && !fs3__default.existsSync(candidatePath + ".node")) {
|
|
3507
|
+
continue;
|
|
3508
|
+
}
|
|
3509
|
+
const mod = requireNativeModule(candidatePath);
|
|
3510
|
+
if (mod && isValid(mod)) {
|
|
3511
|
+
return { binding: mod, loadErrors, loadedPath: candidatePath };
|
|
3512
|
+
}
|
|
3513
|
+
loadErrors.push({ path: candidatePath, message: options.invalidExportMessage });
|
|
3514
|
+
} catch (e) {
|
|
3515
|
+
loadErrors.push({ path: candidatePath, message: e instanceof Error ? e.message : String(e) });
|
|
3516
|
+
}
|
|
3517
|
+
}
|
|
3518
|
+
return { binding: null, loadErrors };
|
|
3519
|
+
}
|
|
3520
|
+
function requireNativeModule(p) {
|
|
3521
|
+
return _require2(p);
|
|
3522
|
+
}
|
|
3523
|
+
function resolveNativeBindingCandidates(options) {
|
|
3524
|
+
const {
|
|
3525
|
+
envVarNames = ["TW_NATIVE_PATH", "TWS_NATIVE_PATH"],
|
|
3526
|
+
includeDefaultCandidates = true,
|
|
3527
|
+
enforceNodeExtensionForEnvPath = false
|
|
3528
|
+
} = options;
|
|
3529
|
+
const runtimeDir = options.runtimeDir || process.cwd();
|
|
3530
|
+
const candidates = [];
|
|
3531
|
+
for (const envVar of envVarNames) {
|
|
3532
|
+
const envPath = process.env[envVar];
|
|
3533
|
+
if (envPath) {
|
|
3534
|
+
candidates.push(enforceNodeExtensionForEnvPath && !envPath.endsWith(".node") ? envPath + ".node" : envPath);
|
|
3535
|
+
}
|
|
3536
|
+
}
|
|
3537
|
+
if (!includeDefaultCandidates) return candidates;
|
|
3538
|
+
if (fs3__default.existsSync(runtimeDir)) {
|
|
3539
|
+
try {
|
|
3540
|
+
for (const entry of fs3__default.readdirSync(runtimeDir)) {
|
|
3541
|
+
if (entry.endsWith(".node")) candidates.push(entry);
|
|
3542
|
+
}
|
|
3543
|
+
} catch {
|
|
3544
|
+
}
|
|
3545
|
+
}
|
|
3546
|
+
const BINARY_NAMES = ["tailwind-styled-native", "tailwind_styled_parser"];
|
|
3547
|
+
const napiPlatform = process.platform === "linux" && process.arch === "x64" ? "linux-x64-gnu" : process.platform === "linux" && process.arch === "arm64" ? "linux-arm64-gnu" : `${process.platform}-${process.arch}`;
|
|
3548
|
+
for (const bin of BINARY_NAMES) {
|
|
3549
|
+
candidates.push(path__default.resolve(runtimeDir, `${bin}.node`));
|
|
3550
|
+
candidates.push(path__default.resolve(runtimeDir, `${bin}.${napiPlatform}.node`));
|
|
3551
|
+
candidates.push(path__default.resolve(runtimeDir, "..", "native", `${bin}.node`));
|
|
3552
|
+
candidates.push(path__default.resolve(runtimeDir, "..", "native", `${bin}.${napiPlatform}.node`));
|
|
3553
|
+
candidates.push(path__default.resolve(process.cwd(), "native", `${bin}.node`));
|
|
3554
|
+
candidates.push(path__default.resolve(process.cwd(), "native", `${bin}.${napiPlatform}.node`));
|
|
3555
|
+
candidates.push(path__default.resolve(runtimeDir, "..", "..", "..", "..", "native", `${bin}.node`));
|
|
3556
|
+
candidates.push(path__default.resolve(runtimeDir, "..", "..", "..", "..", "native", `${bin}.${napiPlatform}.node`));
|
|
3557
|
+
candidates.push(path__default.resolve(runtimeDir, "..", "..", "..", "native", `${bin}.node`));
|
|
3558
|
+
}
|
|
3559
|
+
return Array.from(new Set(candidates));
|
|
3560
|
+
}
|
|
3561
|
+
function resolveRuntimeDir(dir, importMetaUrl) {
|
|
3562
|
+
if (dir) return path__default.resolve(dir);
|
|
3563
|
+
try {
|
|
3564
|
+
return path__default.dirname(fileURLToPath(importMetaUrl));
|
|
3565
|
+
} catch {
|
|
3566
|
+
return process.cwd();
|
|
3567
|
+
}
|
|
3568
|
+
}
|
|
3569
|
+
function hashContent2(content, algorithm = "md5", length) {
|
|
3570
|
+
const hash = createHash(algorithm).update(content).digest("hex");
|
|
3571
|
+
return length ? hash.slice(0, length) : hash;
|
|
3572
|
+
}
|
|
3573
|
+
function formatErrorMessage(error) {
|
|
3574
|
+
if (error instanceof TwError) return error.toString();
|
|
3575
|
+
if (error instanceof Error) return error.message;
|
|
3576
|
+
return String(error);
|
|
3577
|
+
}
|
|
3578
|
+
var TwError, _require2, LRUCache;
|
|
3579
|
+
var init_src2 = __esm({
|
|
3580
|
+
"packages/domain/shared/src/index.ts"() {
|
|
3581
|
+
init_trace();
|
|
3582
|
+
init_error_codes();
|
|
3583
|
+
init_compatibility();
|
|
3584
|
+
init_native_schemas();
|
|
3585
|
+
init_esmHelpers();
|
|
3586
|
+
init_telemetry();
|
|
3587
|
+
init_configSchemas();
|
|
3588
|
+
init_workerResolver();
|
|
3589
|
+
init_codegen();
|
|
3590
|
+
init_native_resolution();
|
|
3591
|
+
init_observability();
|
|
3592
|
+
init_staticStateExtractor();
|
|
3593
|
+
init_logger();
|
|
3594
|
+
TwError = class _TwError extends Error {
|
|
3595
|
+
/** @deprecated Gunakan source */
|
|
3596
|
+
domain;
|
|
3597
|
+
source;
|
|
3598
|
+
code;
|
|
3599
|
+
originalCause;
|
|
3600
|
+
constructor(domainOrSource, code, message, cause) {
|
|
3601
|
+
super(message);
|
|
3602
|
+
this.name = "TwError";
|
|
3603
|
+
this.domain = domainOrSource;
|
|
3604
|
+
this.source = domainOrSource;
|
|
3605
|
+
this.code = code;
|
|
3606
|
+
this.originalCause = cause;
|
|
3607
|
+
if (Error.captureStackTrace) Error.captureStackTrace(this, _TwError);
|
|
3608
|
+
}
|
|
3609
|
+
static fromIo(code, message) {
|
|
3610
|
+
return new _TwError("io", code, message);
|
|
3611
|
+
}
|
|
3612
|
+
static fromCompile(code, message) {
|
|
3613
|
+
return new _TwError("compile", code, message);
|
|
3614
|
+
}
|
|
3615
|
+
static fromRust(err) {
|
|
3616
|
+
if (err instanceof _TwError) return err;
|
|
3617
|
+
if (err instanceof Error) return new _TwError("rust", "RUST_ERROR", err.message, err);
|
|
3618
|
+
if (err && typeof err === "object") {
|
|
3619
|
+
const e = err;
|
|
3620
|
+
return new _TwError("rust", e.code ?? "RUST_ERROR", e.message ?? String(err), err);
|
|
3621
|
+
}
|
|
3622
|
+
return new _TwError("rust", "RUST_ERROR", String(err), err);
|
|
3623
|
+
}
|
|
3624
|
+
/** Buat TwError dari ZodError — dukung shape Zod v3 (`errors`) dan v4 (`issues`). */
|
|
3625
|
+
static fromZod(err) {
|
|
3626
|
+
const first = err.issues?.[0] ?? err.errors?.[0];
|
|
3627
|
+
const path6 = formatIssuePath(first?.path);
|
|
3628
|
+
const message = first ? `${path6}: ${first.message}` : "Schema validation failed";
|
|
3629
|
+
return new _TwError("validation", "SCHEMA_VALIDATION_FAILED", message, err);
|
|
3630
|
+
}
|
|
3631
|
+
static wrap(source, code, err) {
|
|
3632
|
+
if (err instanceof _TwError) return err;
|
|
3633
|
+
if (err instanceof Error) return new _TwError(source, code, err.message, err);
|
|
3634
|
+
return new _TwError(source, code, String(err), err);
|
|
3635
|
+
}
|
|
3636
|
+
toString() {
|
|
3637
|
+
return `TwError [${this.source}:${this.code}] ${this.message}`;
|
|
3638
|
+
}
|
|
3639
|
+
toJSON() {
|
|
3640
|
+
return { name: this.name, source: this.source, code: this.code, message: this.message };
|
|
3641
|
+
}
|
|
3642
|
+
toCliMessage() {
|
|
3643
|
+
return `[${this.source.toUpperCase()}:${this.code}] ${this.message}`;
|
|
3644
|
+
}
|
|
3645
|
+
};
|
|
3646
|
+
_require2 = createRequire(import.meta.url);
|
|
3647
|
+
LRUCache = class {
|
|
3648
|
+
capacity;
|
|
3649
|
+
cache;
|
|
3650
|
+
constructor(capacity) {
|
|
3651
|
+
this.capacity = capacity;
|
|
3652
|
+
this.cache = /* @__PURE__ */ new Map();
|
|
3653
|
+
}
|
|
3654
|
+
get(key) {
|
|
3655
|
+
if (!this.cache.has(key)) return void 0;
|
|
3656
|
+
const value = this.cache.get(key);
|
|
3657
|
+
this.cache.delete(key);
|
|
3658
|
+
this.cache.set(key, value);
|
|
3659
|
+
return value;
|
|
3660
|
+
}
|
|
3661
|
+
set(key, value) {
|
|
3662
|
+
if (this.cache.has(key)) {
|
|
3663
|
+
this.cache.delete(key);
|
|
3664
|
+
} else if (this.cache.size >= this.capacity) {
|
|
3665
|
+
const firstKey = this.cache.keys().next().value;
|
|
3666
|
+
if (firstKey !== void 0) {
|
|
3667
|
+
this.cache.delete(firstKey);
|
|
3668
|
+
}
|
|
3669
|
+
}
|
|
3670
|
+
this.cache.set(key, value);
|
|
3671
|
+
}
|
|
3672
|
+
delete(key) {
|
|
3673
|
+
return this.cache.delete(key);
|
|
3674
|
+
}
|
|
3675
|
+
has(key) {
|
|
3676
|
+
return this.cache.has(key);
|
|
3677
|
+
}
|
|
3678
|
+
clear() {
|
|
3679
|
+
this.cache.clear();
|
|
3680
|
+
}
|
|
3681
|
+
entries() {
|
|
3682
|
+
return this.cache.entries();
|
|
3683
|
+
}
|
|
3684
|
+
get size() {
|
|
3685
|
+
return this.cache.size;
|
|
3686
|
+
}
|
|
3687
|
+
};
|
|
3688
|
+
}
|
|
3689
|
+
});
|
|
3690
|
+
|
|
3691
|
+
// src/umbrella/shared.ts
|
|
3692
|
+
init_src2();
|
|
1130
3693
|
|
|
1131
|
-
export { ERROR_CODES, LRUCache, NativeAnalyzerReportSchema, NativeCacheEntrySchema, NativeCacheReadResultSchema, NativeCssCompileResultSchema, NativeScanFileSchema, NativeScanResultSchema, NativeTransformResultSchema, NativeWatchResultSchema, PackageJsonSchema, RegistryFileSchema, RegistryPluginEntrySchema, ScanCacheClassEntrySchema, ScanCacheSchema, TailwindConfigSchema, TelemetryCollector, TwError, assertTailwindV4, calculateHealth, createBuildTimer, createDebugLogger, createEsmRequire, createLogger, createObservabilityClient, createTraceSnapshot, detectTailwind, formatDuration, formatErrorCode, formatErrorMessage, formatMemory, formatNativeNotFoundError, generateBarrelFile, generateClassRenameCodemod, generateComponentCode, generateStorybookStory, getBuildTimeColor, getDirname, getFilename, getGlobalTelemetry, getHealthColor, getMemoryColor, getModeColor, getPipelinePercentages, getSuggestion, getTailwindVersion, hashContent, isTailwindV4, isTwError, loadNativeBinding, parseJsonFileWithSchema, parseJsonWithSchema, parseNative, resetGlobalTelemetry, resolveFromRoot, resolveLoaderPath, resolveNativeBinary, resolveNativeBindingCandidates, resolveNativeNodePath, resolveRuntimeDir, resolveWorkerPath, safeParseNative, tryRequire, wrapUnknownError };
|
|
3694
|
+
export { ERROR_CODES, LRUCache, NativeAnalyzerReportSchema, NativeCacheEntrySchema, NativeCacheReadResultSchema, NativeCssCompileResultSchema, NativeScanFileSchema, NativeScanResultSchema, NativeTransformResultSchema, NativeWatchResultSchema, PackageJsonSchema, RegistryFileSchema, RegistryPluginEntrySchema, ScanCacheClassEntrySchema, ScanCacheSchema, TW_STATE_STATIC_FILENAME, TailwindConfigSchema, TelemetryCollector, TwError, appendStaticStateCssToSafelist, assertTailwindV4, calculateHealth, createBuildTimer, createDebugLogger, createEsmRequire, createLogger2 as createLogger, createObservabilityClient, createTraceSnapshot, detectTailwind, extractStaticStateCss, formatDuration, formatErrorCode, formatErrorMessage, formatMemory, formatNativeNotFoundError, generateBarrelFile, generateClassRenameCodemod, generateComponentCode, generateStorybookStory, getBuildTimeColor, getDirname, getFilename, getGlobalTelemetry, getHealthColor, getMemoryColor, getModeColor, getPipelinePercentages, getSuggestion, getTailwindVersion, hashContent2 as hashContent, isTailwindV4, isTwError, loadNativeBinding, parseJsonFileWithSchema, parseJsonWithSchema, parseNative, resetGlobalTelemetry, resolveFromRoot, resolveLoaderPath, resolveNativeBinary, resolveNativeBindingCandidates, resolveNativeNodePath, resolveRuntimeDir, resolveWorkerPath, safeParseNative, setGlobalLogFile, tryRequire, wrapUnknownError };
|
|
1132
3695
|
//# sourceMappingURL=shared.mjs.map
|
|
1133
3696
|
//# sourceMappingURL=shared.mjs.map
|