tailwind-styled-v4 5.0.36 → 5.0.38
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/analyzer.d.mts +152 -5
- package/dist/analyzer.d.ts +152 -5
- package/dist/analyzer.js +213 -161
- package/dist/analyzer.js.map +1 -1
- package/dist/analyzer.mjs +118 -82
- package/dist/analyzer.mjs.map +1 -1
- package/dist/animate.d.mts +30 -3
- package/dist/animate.d.ts +30 -3
- package/dist/animate.js +131 -87
- package/dist/animate.js.map +1 -1
- package/dist/animate.mjs +28 -14
- package/dist/animate.mjs.map +1 -1
- package/dist/atomic.js +105 -68
- package/dist/atomic.js.map +1 -1
- package/dist/atomic.mjs +40 -13
- package/dist/atomic.mjs.map +1 -1
- package/dist/cli.js +577 -426
- package/dist/cli.js.map +1 -1
- package/dist/cli.mjs +466 -304
- package/dist/cli.mjs.map +1 -1
- package/dist/compiler.d.mts +5 -0
- package/dist/compiler.d.ts +5 -0
- package/dist/compiler.js +826 -508
- package/dist/compiler.js.map +1 -1
- package/dist/compiler.mjs +287 -29
- package/dist/compiler.mjs.map +1 -1
- package/dist/dashboard.js +71 -41
- package/dist/dashboard.js.map +1 -1
- package/dist/dashboard.mjs +12 -6
- package/dist/dashboard.mjs.map +1 -1
- package/dist/devtools.d.mts +88 -2
- package/dist/devtools.d.ts +88 -2
- package/dist/devtools.js +333 -289
- package/dist/devtools.js.map +1 -1
- package/dist/devtools.mjs +26 -11
- package/dist/devtools.mjs.map +1 -1
- package/dist/engine.d.mts +557 -6
- package/dist/engine.d.ts +557 -6
- package/dist/engine.js +679 -502
- package/dist/engine.js.map +1 -1
- package/dist/engine.mjs +467 -307
- package/dist/engine.mjs.map +1 -1
- package/dist/index.d.mts +180 -127
- package/dist/index.d.ts +180 -127
- package/dist/index.js +1329 -7441
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1266 -7385
- package/dist/index.mjs.map +1 -1
- package/dist/next.js +318 -243
- package/dist/next.js.map +1 -1
- package/dist/next.mjs +256 -181
- package/dist/next.mjs.map +1 -1
- package/dist/plugin-api.d.mts +4 -2
- package/dist/plugin-api.d.ts +4 -2
- package/dist/plugin-api.js +93 -49
- package/dist/plugin-api.js.map +1 -1
- package/dist/plugin-api.mjs +26 -6
- package/dist/plugin-api.mjs.map +1 -1
- package/dist/plugin-registry.js +103 -62
- package/dist/plugin-registry.js.map +1 -1
- package/dist/plugin-registry.mjs +53 -35
- package/dist/plugin-registry.mjs.map +1 -1
- package/dist/plugin.d.mts +165 -5
- package/dist/plugin.d.ts +165 -5
- package/dist/plugin.js +115 -50
- package/dist/plugin.js.map +1 -1
- package/dist/plugin.mjs +44 -6
- package/dist/plugin.mjs.map +1 -1
- package/dist/preset.js +47 -15
- package/dist/preset.js.map +1 -1
- package/dist/preset.mjs +13 -5
- package/dist/preset.mjs.map +1 -1
- package/dist/rspack.js +82 -50
- package/dist/rspack.js.map +1 -1
- package/dist/rspack.mjs +20 -12
- package/dist/rspack.mjs.map +1 -1
- package/dist/runtime-css.js +62 -24
- package/dist/runtime-css.js.map +1 -1
- package/dist/runtime-css.mjs +15 -7
- package/dist/runtime-css.mjs.map +1 -1
- package/dist/runtime.d.mts +38 -3
- package/dist/runtime.d.ts +38 -3
- package/dist/runtime.js +97 -44
- package/dist/runtime.js.map +1 -1
- package/dist/runtime.mjs +31 -8
- package/dist/runtime.mjs.map +1 -1
- package/dist/scanner.d.mts +58 -4
- package/dist/scanner.d.ts +58 -4
- package/dist/scanner.js +163 -120
- package/dist/scanner.js.map +1 -1
- package/dist/scanner.mjs +67 -39
- package/dist/scanner.mjs.map +1 -1
- package/dist/shared.d.mts +185 -3
- package/dist/shared.d.ts +185 -3
- package/dist/shared.js +441 -295
- package/dist/shared.js.map +1 -1
- package/dist/shared.mjs +253 -122
- package/dist/shared.mjs.map +1 -1
- package/dist/storybook-addon.d.mts +2 -2
- package/dist/storybook-addon.d.ts +2 -2
- package/dist/storybook-addon.js +39 -10
- package/dist/storybook-addon.js.map +1 -1
- package/dist/storybook-addon.mjs +8 -3
- package/dist/storybook-addon.mjs.map +1 -1
- package/dist/svelte.d.mts +2 -1
- package/dist/svelte.d.ts +2 -1
- package/dist/svelte.js +88 -64
- package/dist/svelte.js.map +1 -1
- package/dist/svelte.mjs +28 -13
- package/dist/svelte.mjs.map +1 -1
- package/dist/syntax.js +68 -37
- package/dist/syntax.js.map +1 -1
- package/dist/syntax.mjs +8 -7
- package/dist/syntax.mjs.map +1 -1
- package/dist/testing.js +55 -18
- package/dist/testing.js.map +1 -1
- package/dist/testing.mjs +16 -3
- package/dist/testing.mjs.map +1 -1
- package/dist/theme.d.mts +38 -3
- package/dist/theme.d.ts +38 -3
- package/dist/theme.js +131 -74
- package/dist/theme.js.map +1 -1
- package/dist/theme.mjs +42 -13
- package/dist/theme.mjs.map +1 -1
- package/dist/turbopackLoader.js +150 -116
- package/dist/turbopackLoader.js.map +1 -1
- package/dist/turbopackLoader.mjs +124 -81
- package/dist/turbopackLoader.mjs.map +1 -1
- package/dist/tw.js +560 -421
- package/dist/tw.js.map +1 -1
- package/dist/tw.mjs +460 -302
- package/dist/tw.mjs.map +1 -1
- package/dist/vite.js +561 -446
- package/dist/vite.js.map +1 -1
- package/dist/vite.mjs +433 -321
- package/dist/vite.mjs.map +1 -1
- package/dist/vue.d.mts +4 -1
- package/dist/vue.d.ts +4 -1
- package/dist/vue.js +95 -70
- package/dist/vue.js.map +1 -1
- package/dist/vue.mjs +30 -14
- package/dist/vue.mjs.map +1 -1
- package/dist/webpackLoader.js +110 -78
- package/dist/webpackLoader.js.map +1 -1
- package/dist/webpackLoader.mjs +45 -17
- package/dist/webpackLoader.mjs.map +1 -1
- package/native/tailwind-styled-native.linux-x64-gnu.node +0 -0
- package/native/tailwind-styled-native.node +0 -0
- package/package.json +3 -1
- package/dist/analyzeWorkspace-B1_XRfdl.d.ts +0 -134
- package/dist/analyzeWorkspace-hYfu4Hg3.d.mts +0 -134
- package/dist/index-DQI6O24n.d.mts +0 -464
- package/dist/index-NDINUhLN.d.mts +0 -90
- package/dist/index-NDINUhLN.d.ts +0 -90
- package/dist/index-UkYbyBkR.d.ts +0 -464
- package/dist/liveTokenEngine-CN9ian1R.d.ts +0 -38
- package/dist/liveTokenEngine-DKoWRtqH.d.mts +0 -38
- package/dist/schemas-DR-SLxZZ.d.mts +0 -59
- package/dist/schemas-DR-SLxZZ.d.ts +0 -59
- package/dist/trace-Dz4vmZdy.d.mts +0 -96
- package/dist/trace-Dz4vmZdy.d.ts +0 -96
- package/dist/types-DXr2PmGP.d.mts +0 -31
- package/dist/types-DXr2PmGP.d.ts +0 -31
package/dist/next.mjs
CHANGED
|
@@ -1,13 +1,3 @@
|
|
|
1
|
-
import { createRequire } from 'module';
|
|
2
|
-
import * as fs10 from 'fs';
|
|
3
|
-
import fs10__default from 'fs';
|
|
4
|
-
import * as path11 from 'path';
|
|
5
|
-
import path11__default from 'path';
|
|
6
|
-
import 'crypto';
|
|
7
|
-
import { fileURLToPath } from 'url';
|
|
8
|
-
import { z } from 'zod';
|
|
9
|
-
import 'worker_threads';
|
|
10
|
-
|
|
11
1
|
/* tailwind-styled-v4 v5.0.4 | MIT | https://github.com/dictionar32/tailwind-styled-v4 */
|
|
12
2
|
var __defProp = Object.defineProperty;
|
|
13
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
@@ -119,12 +109,18 @@ function resolveLoaderPath(loaderBasename, importMetaUrl) {
|
|
|
119
109
|
var isBrowser, NODE_URL, NODE_FS, NODE_PATH;
|
|
120
110
|
var init_workerResolver = __esm({
|
|
121
111
|
"packages/domain/shared/src/workerResolver.ts"() {
|
|
112
|
+
"use strict";
|
|
122
113
|
isBrowser = typeof window !== "undefined" || typeof document !== "undefined";
|
|
123
114
|
NODE_URL = typeof window === "undefined" || typeof document === "undefined" ? "node:url" : null;
|
|
124
115
|
NODE_FS = typeof window === "undefined" || typeof document === "undefined" ? "node:fs" : null;
|
|
125
116
|
NODE_PATH = typeof window === "undefined" || typeof document === "undefined" ? "node:path" : null;
|
|
126
117
|
}
|
|
127
118
|
});
|
|
119
|
+
|
|
120
|
+
// packages/domain/shared/src/native-resolution.ts
|
|
121
|
+
import { createRequire } from "module";
|
|
122
|
+
import * as fs from "fs";
|
|
123
|
+
import * as path from "path";
|
|
128
124
|
function platformKey() {
|
|
129
125
|
if (isBrowser2) return "browser";
|
|
130
126
|
return `${process.platform}-${process.arch}`;
|
|
@@ -140,7 +136,7 @@ function resolveNativeBinary(runtimeDir) {
|
|
|
140
136
|
}
|
|
141
137
|
const envPath = process.env.TW_NATIVE_PATH?.trim();
|
|
142
138
|
if (envPath) {
|
|
143
|
-
if (
|
|
139
|
+
if (fs.existsSync(envPath)) {
|
|
144
140
|
return { path: envPath, source: "env", platform, tried };
|
|
145
141
|
}
|
|
146
142
|
tried.push(`env:${envPath} (not found)`);
|
|
@@ -149,7 +145,7 @@ function resolveNativeBinary(runtimeDir) {
|
|
|
149
145
|
for (const pkg of prebuiltPkgs) {
|
|
150
146
|
try {
|
|
151
147
|
const candidate = _require.resolve(`${pkg}/tailwind_styled_parser.node`);
|
|
152
|
-
if (
|
|
148
|
+
if (fs.existsSync(candidate)) {
|
|
153
149
|
return { path: candidate, source: "prebuilt", platform, tried };
|
|
154
150
|
}
|
|
155
151
|
tried.push(`prebuilt:${pkg} (resolved but missing)`);
|
|
@@ -160,13 +156,13 @@ function resolveNativeBinary(runtimeDir) {
|
|
|
160
156
|
const napiPlatform = platform === "linux-x64" ? "linux-x64-gnu" : platform === "linux-arm64" ? "linux-arm64-gnu" : platform;
|
|
161
157
|
const BINARY_NAMES_SELF = ["tailwind-styled-native", "tailwind_styled_parser"];
|
|
162
158
|
if (runtimeDir) {
|
|
163
|
-
for (const depth of ["..",
|
|
164
|
-
const pkgRoot =
|
|
159
|
+
for (const depth of ["..", path.join("..", ".."), path.join("..", "..", "..")]) {
|
|
160
|
+
const pkgRoot = path.resolve(runtimeDir, depth);
|
|
165
161
|
for (const bin of BINARY_NAMES_SELF) {
|
|
166
162
|
for (const suffix of ["", `.${platform}`, `.${napiPlatform}`]) {
|
|
167
|
-
const candidate =
|
|
163
|
+
const candidate = path.resolve(pkgRoot, "native", `${bin}${suffix}.node`);
|
|
168
164
|
tried.push(`self-bundled:${candidate}`);
|
|
169
|
-
if (
|
|
165
|
+
if (fs.existsSync(candidate)) {
|
|
170
166
|
return { path: candidate, source: "prebuilt", platform, tried };
|
|
171
167
|
}
|
|
172
168
|
}
|
|
@@ -178,29 +174,29 @@ function resolveNativeBinary(runtimeDir) {
|
|
|
178
174
|
const BINARY_NAMES = ["tailwind-styled-native", "tailwind_styled_parser"];
|
|
179
175
|
const localCandidates = [];
|
|
180
176
|
for (const bin of BINARY_NAMES) {
|
|
181
|
-
localCandidates.push(
|
|
182
|
-
localCandidates.push(
|
|
183
|
-
localCandidates.push(
|
|
184
|
-
localCandidates.push(
|
|
177
|
+
localCandidates.push(path.resolve(base, `${bin}.node`));
|
|
178
|
+
localCandidates.push(path.resolve(base, "..", `${bin}.node`));
|
|
179
|
+
localCandidates.push(path.resolve(base, `${bin}.${platform}.node`));
|
|
180
|
+
localCandidates.push(path.resolve(base, `${bin}.${napiPlatform}.node`));
|
|
185
181
|
}
|
|
186
182
|
for (const startDir of [cwd, base]) {
|
|
187
183
|
let dir = startDir;
|
|
188
184
|
for (let i = 0; i < 6; i++) {
|
|
189
|
-
const nativeDir =
|
|
185
|
+
const nativeDir = path.resolve(dir, "native");
|
|
190
186
|
for (const bin of BINARY_NAMES) {
|
|
191
|
-
localCandidates.push(
|
|
192
|
-
localCandidates.push(
|
|
193
|
-
localCandidates.push(
|
|
194
|
-
localCandidates.push(
|
|
187
|
+
localCandidates.push(path.resolve(nativeDir, `${bin}.node`));
|
|
188
|
+
localCandidates.push(path.resolve(nativeDir, `${bin}.${platform}.node`));
|
|
189
|
+
localCandidates.push(path.resolve(nativeDir, `${bin}.${napiPlatform}.node`));
|
|
190
|
+
localCandidates.push(path.resolve(nativeDir, "target", "release", `${bin}.node`));
|
|
195
191
|
}
|
|
196
|
-
const parent =
|
|
192
|
+
const parent = path.resolve(dir, "..");
|
|
197
193
|
if (parent === dir) break;
|
|
198
194
|
dir = parent;
|
|
199
195
|
}
|
|
200
196
|
}
|
|
201
197
|
for (const candidate of localCandidates) {
|
|
202
198
|
tried.push(`local:${candidate}`);
|
|
203
|
-
if (
|
|
199
|
+
if (fs.existsSync(candidate)) {
|
|
204
200
|
return { path: candidate, source: "local", platform, tried };
|
|
205
201
|
}
|
|
206
202
|
}
|
|
@@ -209,6 +205,7 @@ function resolveNativeBinary(runtimeDir) {
|
|
|
209
205
|
var isBrowser2, _require, PLATFORM_MAP;
|
|
210
206
|
var init_native_resolution = __esm({
|
|
211
207
|
"packages/domain/shared/src/native-resolution.ts"() {
|
|
208
|
+
"use strict";
|
|
212
209
|
isBrowser2 = typeof window !== "undefined" || typeof document !== "undefined";
|
|
213
210
|
_require = typeof __require !== "undefined" ? __require : createRequire(import.meta.url);
|
|
214
211
|
PLATFORM_MAP = {
|
|
@@ -226,6 +223,7 @@ var init_native_resolution = __esm({
|
|
|
226
223
|
var _loadNative, log, NATIVE_UNAVAILABLE_MESSAGE, nativeBridge, bridgeLoadAttempted, bridgeLoadError, isValidNativeBridge, getNativeBridge, resetNativeBridgeCache, adaptNativeResult;
|
|
227
224
|
var init_nativeBridge = __esm({
|
|
228
225
|
"packages/domain/compiler/src/nativeBridge.ts"() {
|
|
226
|
+
"use strict";
|
|
229
227
|
init_src2();
|
|
230
228
|
_loadNative = (path12) => __require(path12);
|
|
231
229
|
log = (...args) => {
|
|
@@ -383,6 +381,7 @@ function resetCacheStats() {
|
|
|
383
381
|
}
|
|
384
382
|
var init_cssGeneratorNative = __esm({
|
|
385
383
|
"packages/domain/compiler/src/compiler/cssGeneratorNative.ts"() {
|
|
384
|
+
"use strict";
|
|
386
385
|
init_nativeBridge();
|
|
387
386
|
}
|
|
388
387
|
});
|
|
@@ -455,6 +454,7 @@ function atomicRegistrySize() {
|
|
|
455
454
|
}
|
|
456
455
|
var init_compilationNative = __esm({
|
|
457
456
|
"packages/domain/compiler/src/compiler/compilationNative.ts"() {
|
|
457
|
+
"use strict";
|
|
458
458
|
init_nativeBridge();
|
|
459
459
|
}
|
|
460
460
|
});
|
|
@@ -598,6 +598,7 @@ function twMergeRaw(classLists) {
|
|
|
598
598
|
}
|
|
599
599
|
var init_cssCompilationNative = __esm({
|
|
600
600
|
"packages/domain/compiler/src/compiler/cssCompilationNative.ts"() {
|
|
601
|
+
"use strict";
|
|
601
602
|
init_nativeBridge();
|
|
602
603
|
}
|
|
603
604
|
});
|
|
@@ -697,6 +698,7 @@ function idRegistryImport(importedData) {
|
|
|
697
698
|
}
|
|
698
699
|
var init_idRegistryNative = __esm({
|
|
699
700
|
"packages/domain/compiler/src/compiler/idRegistryNative.ts"() {
|
|
701
|
+
"use strict";
|
|
700
702
|
init_nativeBridge();
|
|
701
703
|
}
|
|
702
704
|
});
|
|
@@ -838,9 +840,13 @@ function scanFilesBatchNative(filesJson) {
|
|
|
838
840
|
}
|
|
839
841
|
var init_streamingNative = __esm({
|
|
840
842
|
"packages/domain/compiler/src/compiler/streamingNative.ts"() {
|
|
843
|
+
"use strict";
|
|
841
844
|
init_nativeBridge();
|
|
842
845
|
}
|
|
843
846
|
});
|
|
847
|
+
|
|
848
|
+
// packages/domain/compiler/src/tailwindEngine.ts
|
|
849
|
+
import { createRequire as createRequire2 } from "module";
|
|
844
850
|
function loadTailwindEngine() {
|
|
845
851
|
if (_twEngine) return _twEngine;
|
|
846
852
|
if (_twEngineError) throw _twEngineError;
|
|
@@ -860,10 +866,10 @@ async function generateRawCss(classes, cssEntryContent, root) {
|
|
|
860
866
|
if (classes.length === 0) return "";
|
|
861
867
|
const tw = loadTailwindEngine();
|
|
862
868
|
const input = cssEntryContent ?? "@import 'tailwindcss';";
|
|
863
|
-
const { readFileSync, existsSync: existsSync3 } = await import(
|
|
864
|
-
const { dirname, resolve: resolve2 } = await import(
|
|
869
|
+
const { readFileSync, existsSync: existsSync3 } = await import("fs");
|
|
870
|
+
const { dirname, resolve: resolve2 } = await import("path");
|
|
865
871
|
const projectRoot = root ?? process.cwd();
|
|
866
|
-
const req =
|
|
872
|
+
const req = createRequire2(resolve2(projectRoot, "package.json"));
|
|
867
873
|
const loadStylesheet = async (id, base) => {
|
|
868
874
|
try {
|
|
869
875
|
const cssId = id === "tailwindcss" ? "tailwindcss/index.css" : id === "tailwindcss/preflight" ? "tailwindcss/preflight.css" : id === "tailwindcss/utilities" ? "tailwindcss/utilities.css" : id === "tailwindcss/theme" ? "tailwindcss/theme.css" : id;
|
|
@@ -883,10 +889,12 @@ async function generateRawCss(classes, cssEntryContent, root) {
|
|
|
883
889
|
const compiler = await Promise.resolve(tw.compile(input, { loadStylesheet }));
|
|
884
890
|
return compiler.build(classes);
|
|
885
891
|
}
|
|
886
|
-
var require2, _twEngine, _twEngineError;
|
|
892
|
+
var require2, MAX_CACHE_MEMORY, _twEngine, _twEngineError;
|
|
887
893
|
var init_tailwindEngine = __esm({
|
|
888
894
|
"packages/domain/compiler/src/tailwindEngine.ts"() {
|
|
889
|
-
|
|
895
|
+
"use strict";
|
|
896
|
+
require2 = createRequire2(import.meta.url);
|
|
897
|
+
MAX_CACHE_MEMORY = 256 * 1024;
|
|
890
898
|
_twEngine = null;
|
|
891
899
|
_twEngineError = null;
|
|
892
900
|
}
|
|
@@ -901,6 +909,7 @@ __export(tailwindEngine_exports, {
|
|
|
901
909
|
runCssPipeline: () => runCssPipeline,
|
|
902
910
|
runCssPipelineSync: () => runCssPipelineSync
|
|
903
911
|
});
|
|
912
|
+
import { createRequire as createRequire3 } from "module";
|
|
904
913
|
function _getCacheKey(classes, minify, cssEntry, root) {
|
|
905
914
|
const sorted = [...classes].sort().join(",");
|
|
906
915
|
const flags = `${minify ? "1" : "0"}${cssEntry ? "1" : "0"}${root ? "1" : "0"}`;
|
|
@@ -1067,24 +1076,27 @@ function processTailwindCssWithTargets(css, targets) {
|
|
|
1067
1076
|
}
|
|
1068
1077
|
return result.css;
|
|
1069
1078
|
}
|
|
1070
|
-
var _cssCache, _cacheHits, _cacheMisses, MAX_CACHE_SIZE;
|
|
1079
|
+
var require3, _cssCache, _cacheHits, _cacheMisses, MAX_CACHE_SIZE, MAX_CACHE_MEMORY2;
|
|
1071
1080
|
var init_tailwindEngine2 = __esm({
|
|
1072
1081
|
"packages/domain/compiler/src/compiler/tailwindEngine.ts"() {
|
|
1082
|
+
"use strict";
|
|
1073
1083
|
init_nativeBridge();
|
|
1074
1084
|
init_cssGeneratorNative();
|
|
1075
1085
|
init_cssCompilationNative();
|
|
1076
1086
|
init_tailwindEngine();
|
|
1077
|
-
|
|
1087
|
+
require3 = createRequire3(import.meta.url);
|
|
1078
1088
|
_cssCache = /* @__PURE__ */ new Map();
|
|
1079
1089
|
_cacheHits = 0;
|
|
1080
1090
|
_cacheMisses = 0;
|
|
1081
1091
|
MAX_CACHE_SIZE = 100;
|
|
1092
|
+
MAX_CACHE_MEMORY2 = 256 * 1024;
|
|
1082
1093
|
}
|
|
1083
1094
|
});
|
|
1084
1095
|
|
|
1085
1096
|
// packages/domain/compiler/src/compiler/index.ts
|
|
1086
1097
|
var init_compiler = __esm({
|
|
1087
1098
|
"packages/domain/compiler/src/compiler/index.ts"() {
|
|
1099
|
+
"use strict";
|
|
1088
1100
|
init_cssGeneratorNative();
|
|
1089
1101
|
init_compilationNative();
|
|
1090
1102
|
init_cssCompilationNative();
|
|
@@ -1098,6 +1110,7 @@ var init_compiler = __esm({
|
|
|
1098
1110
|
var parseClasses, parseClass, extractAllClasses, extractClassesFromSource, astExtractClasses, normalizeClasses, mergeClassesStatic, normalizeAndDedupClasses, extractComponentUsage, batchExtractClasses, checkAgainstSafelist, diffClassLists;
|
|
1099
1111
|
var init_parser = __esm({
|
|
1100
1112
|
"packages/domain/compiler/src/parser/index.ts"() {
|
|
1113
|
+
"use strict";
|
|
1101
1114
|
init_nativeBridge();
|
|
1102
1115
|
parseClasses = (raw) => {
|
|
1103
1116
|
const native = getNativeBridge();
|
|
@@ -1276,6 +1289,7 @@ function resetMemoryStats() {
|
|
|
1276
1289
|
}
|
|
1277
1290
|
var init_analyzerNative = __esm({
|
|
1278
1291
|
"packages/domain/compiler/src/analyzer/analyzerNative.ts"() {
|
|
1292
|
+
"use strict";
|
|
1279
1293
|
init_nativeBridge();
|
|
1280
1294
|
}
|
|
1281
1295
|
});
|
|
@@ -1369,6 +1383,7 @@ function resolveSimpleVariants(configJson) {
|
|
|
1369
1383
|
}
|
|
1370
1384
|
var init_themeResolutionNative = __esm({
|
|
1371
1385
|
"packages/domain/compiler/src/analyzer/themeResolutionNative.ts"() {
|
|
1386
|
+
"use strict";
|
|
1372
1387
|
init_nativeBridge();
|
|
1373
1388
|
}
|
|
1374
1389
|
});
|
|
@@ -1416,6 +1431,7 @@ function generateSubComponentTypes(root, outputPath) {
|
|
|
1416
1431
|
}
|
|
1417
1432
|
var init_scannerNative = __esm({
|
|
1418
1433
|
"packages/domain/compiler/src/analyzer/scannerNative.ts"() {
|
|
1434
|
+
"use strict";
|
|
1419
1435
|
init_nativeBridge();
|
|
1420
1436
|
}
|
|
1421
1437
|
});
|
|
@@ -1423,6 +1439,7 @@ var init_scannerNative = __esm({
|
|
|
1423
1439
|
// packages/domain/compiler/src/analyzer/index.ts
|
|
1424
1440
|
var init_analyzer = __esm({
|
|
1425
1441
|
"packages/domain/compiler/src/analyzer/index.ts"() {
|
|
1442
|
+
"use strict";
|
|
1426
1443
|
init_analyzerNative();
|
|
1427
1444
|
init_themeResolutionNative();
|
|
1428
1445
|
init_scannerNative();
|
|
@@ -1611,6 +1628,7 @@ function resetResolverPoolStats() {
|
|
|
1611
1628
|
}
|
|
1612
1629
|
var init_cacheNative = __esm({
|
|
1613
1630
|
"packages/domain/compiler/src/cache/cacheNative.ts"() {
|
|
1631
|
+
"use strict";
|
|
1614
1632
|
init_nativeBridge();
|
|
1615
1633
|
}
|
|
1616
1634
|
});
|
|
@@ -1618,6 +1636,7 @@ var init_cacheNative = __esm({
|
|
|
1618
1636
|
// packages/domain/compiler/src/cache/index.ts
|
|
1619
1637
|
var init_cache = __esm({
|
|
1620
1638
|
"packages/domain/compiler/src/cache/index.ts"() {
|
|
1639
|
+
"use strict";
|
|
1621
1640
|
init_cacheNative();
|
|
1622
1641
|
}
|
|
1623
1642
|
});
|
|
@@ -1866,6 +1885,7 @@ function redisDiagnose() {
|
|
|
1866
1885
|
}
|
|
1867
1886
|
var init_redisNative = __esm({
|
|
1868
1887
|
"packages/domain/compiler/src/redis/redisNative.ts"() {
|
|
1888
|
+
"use strict";
|
|
1869
1889
|
init_nativeBridge();
|
|
1870
1890
|
}
|
|
1871
1891
|
});
|
|
@@ -1873,6 +1893,7 @@ var init_redisNative = __esm({
|
|
|
1873
1893
|
// packages/domain/compiler/src/redis/index.ts
|
|
1874
1894
|
var init_redis = __esm({
|
|
1875
1895
|
"packages/domain/compiler/src/redis/index.ts"() {
|
|
1896
|
+
"use strict";
|
|
1876
1897
|
init_redisNative();
|
|
1877
1898
|
}
|
|
1878
1899
|
});
|
|
@@ -2011,6 +2032,7 @@ function getCompilerDiagnostics() {
|
|
|
2011
2032
|
}
|
|
2012
2033
|
var init_watchSystemNative = __esm({
|
|
2013
2034
|
"packages/domain/compiler/src/watch/watchSystemNative.ts"() {
|
|
2035
|
+
"use strict";
|
|
2014
2036
|
init_nativeBridge();
|
|
2015
2037
|
}
|
|
2016
2038
|
});
|
|
@@ -2018,6 +2040,7 @@ var init_watchSystemNative = __esm({
|
|
|
2018
2040
|
// packages/domain/compiler/src/watch/index.ts
|
|
2019
2041
|
var init_watch = __esm({
|
|
2020
2042
|
"packages/domain/compiler/src/watch/index.ts"() {
|
|
2043
|
+
"use strict";
|
|
2021
2044
|
init_watchSystemNative();
|
|
2022
2045
|
}
|
|
2023
2046
|
});
|
|
@@ -2245,6 +2268,9 @@ __export(src_exports, {
|
|
|
2245
2268
|
watchRemovePattern: () => watchRemovePattern,
|
|
2246
2269
|
watchResume: () => watchResume
|
|
2247
2270
|
});
|
|
2271
|
+
import fs2 from "fs";
|
|
2272
|
+
import path2 from "path";
|
|
2273
|
+
import { createRequire as createRequire4 } from "module";
|
|
2248
2274
|
function _layoutClassesToCss(classes) {
|
|
2249
2275
|
const native = getNativeBridge();
|
|
2250
2276
|
if (!native?.layoutClassesToCss) {
|
|
@@ -2282,6 +2308,7 @@ function extractContainerCssFromSource(source) {
|
|
|
2282
2308
|
var _require2, transformSource, hasTwUsage, isAlreadyTransformed, shouldProcess, compileCssFromClasses, buildStyleTag, generateCssForClasses, eliminateDeadCss, findDeadVariants, runElimination, scanProjectUsage, generateSafelist, loadSafelist, loadTailwindConfig, getContentPaths, _CONTAINER_BREAKPOINTS, runLoaderTransform, shouldSkipFile, fileToRoute, getAllRoutes, getRouteClasses, registerFileClasses, registerGlobalClasses, _incrementalEngineInstance, getIncrementalEngine, resetIncrementalEngine, IncrementalEngine, getBucketEngine, resetBucketEngine, BucketEngine, classifyNode, detectConflicts, bucketSort, analyzeFile, analyzeVariantUsage, injectClientDirective, injectServerOnlyComment, analyzeClasses, extractTwStateConfigs, generateStaticStateCss, extractAndGenerateStateCss;
|
|
2283
2309
|
var init_src = __esm({
|
|
2284
2310
|
"packages/domain/compiler/src/index.ts"() {
|
|
2311
|
+
"use strict";
|
|
2285
2312
|
init_nativeBridge();
|
|
2286
2313
|
init_compiler();
|
|
2287
2314
|
init_parser();
|
|
@@ -2289,7 +2316,7 @@ var init_src = __esm({
|
|
|
2289
2316
|
init_cache();
|
|
2290
2317
|
init_redis();
|
|
2291
2318
|
init_watch();
|
|
2292
|
-
_require2 =
|
|
2319
|
+
_require2 = createRequire4(import.meta.url);
|
|
2293
2320
|
transformSource = (source, opts) => {
|
|
2294
2321
|
const native = getNativeBridge();
|
|
2295
2322
|
if (!native?.transformSource) {
|
|
@@ -2381,7 +2408,7 @@ var init_src = __esm({
|
|
|
2381
2408
|
};
|
|
2382
2409
|
scanProjectUsage = (dirs, cwd) => {
|
|
2383
2410
|
const { batchExtractClasses: batchExtractClasses2 } = _require2("./parser");
|
|
2384
|
-
const files = dirs.map((dir) =>
|
|
2411
|
+
const files = dirs.map((dir) => path2.resolve(cwd, dir));
|
|
2385
2412
|
const results = batchExtractClasses2(files) || [];
|
|
2386
2413
|
const combined = {};
|
|
2387
2414
|
for (const result of results) {
|
|
@@ -2398,13 +2425,13 @@ var init_src = __esm({
|
|
|
2398
2425
|
const classes = scanProjectUsage(scanDirs, cwd || process.cwd());
|
|
2399
2426
|
const allClasses = Object.keys(classes).sort();
|
|
2400
2427
|
if (outputPath) {
|
|
2401
|
-
|
|
2428
|
+
fs2.writeFileSync(outputPath, JSON.stringify(allClasses, null, 2));
|
|
2402
2429
|
}
|
|
2403
2430
|
return allClasses;
|
|
2404
2431
|
};
|
|
2405
2432
|
loadSafelist = (safelistPath) => {
|
|
2406
2433
|
try {
|
|
2407
|
-
const content =
|
|
2434
|
+
const content = fs2.readFileSync(safelistPath, "utf-8");
|
|
2408
2435
|
return JSON.parse(content);
|
|
2409
2436
|
} catch {
|
|
2410
2437
|
return [];
|
|
@@ -2418,8 +2445,8 @@ var init_src = __esm({
|
|
|
2418
2445
|
"tailwind.config.cjs"
|
|
2419
2446
|
];
|
|
2420
2447
|
for (const file of configFiles) {
|
|
2421
|
-
const fullPath =
|
|
2422
|
-
if (
|
|
2448
|
+
const fullPath = path2.join(cwd, file);
|
|
2449
|
+
if (fs2.existsSync(fullPath)) {
|
|
2423
2450
|
const mod = __require(fullPath);
|
|
2424
2451
|
return mod.default || mod;
|
|
2425
2452
|
}
|
|
@@ -2429,9 +2456,9 @@ var init_src = __esm({
|
|
|
2429
2456
|
getContentPaths = (cwd = process.cwd()) => {
|
|
2430
2457
|
return {
|
|
2431
2458
|
content: [
|
|
2432
|
-
|
|
2433
|
-
|
|
2434
|
-
|
|
2459
|
+
path2.join(cwd, "src/**/*.{js,ts,jsx,tsx}"),
|
|
2460
|
+
path2.join(cwd, "app/**/*.{js,ts,jsx,tsx}"),
|
|
2461
|
+
path2.join(cwd, "pages/**/*.{js,ts,jsx,tsx}")
|
|
2435
2462
|
]
|
|
2436
2463
|
};
|
|
2437
2464
|
};
|
|
@@ -2850,6 +2877,7 @@ __export(internal_exports, {
|
|
|
2850
2877
|
});
|
|
2851
2878
|
var init_internal = __esm({
|
|
2852
2879
|
"packages/domain/compiler/src/internal.ts"() {
|
|
2880
|
+
"use strict";
|
|
2853
2881
|
init_src();
|
|
2854
2882
|
init_tailwindEngine2();
|
|
2855
2883
|
init_compiler();
|
|
@@ -2860,6 +2888,10 @@ var init_internal = __esm({
|
|
|
2860
2888
|
init_watch();
|
|
2861
2889
|
}
|
|
2862
2890
|
});
|
|
2891
|
+
|
|
2892
|
+
// packages/domain/shared/src/staticStateExtractor.ts
|
|
2893
|
+
import fs3 from "fs";
|
|
2894
|
+
import path3 from "path";
|
|
2863
2895
|
function getNative() {
|
|
2864
2896
|
if (_native) return _native;
|
|
2865
2897
|
try {
|
|
@@ -2889,17 +2921,17 @@ function getNative() {
|
|
|
2889
2921
|
function* walkSourceFiles(dir) {
|
|
2890
2922
|
let entries;
|
|
2891
2923
|
try {
|
|
2892
|
-
entries =
|
|
2924
|
+
entries = fs3.readdirSync(dir, { withFileTypes: true });
|
|
2893
2925
|
} catch {
|
|
2894
2926
|
return;
|
|
2895
2927
|
}
|
|
2896
2928
|
for (const entry of entries) {
|
|
2897
|
-
const fullPath =
|
|
2929
|
+
const fullPath = path3.join(dir, entry.name);
|
|
2898
2930
|
if (entry.isDirectory()) {
|
|
2899
2931
|
if (IGNORE_PATTERNS.some((p) => entry.name === p || entry.name.startsWith(p))) continue;
|
|
2900
2932
|
yield* walkSourceFiles(fullPath);
|
|
2901
2933
|
} else if (entry.isFile()) {
|
|
2902
|
-
const ext =
|
|
2934
|
+
const ext = path3.extname(entry.name);
|
|
2903
2935
|
if (SOURCE_EXTENSIONS.has(ext)) yield fullPath;
|
|
2904
2936
|
}
|
|
2905
2937
|
}
|
|
@@ -2963,7 +2995,7 @@ function extractStaticStateCss(srcDir, options = {}) {
|
|
|
2963
2995
|
allConfigs.push(...configs);
|
|
2964
2996
|
if (verbose) {
|
|
2965
2997
|
process.stderr.write(
|
|
2966
|
-
`[tw:static-state] ${
|
|
2998
|
+
`[tw:static-state] ${path3.relative(srcDir, filePath)}: ${configs.length} komponen
|
|
2967
2999
|
`
|
|
2968
3000
|
);
|
|
2969
3001
|
}
|
|
@@ -2974,7 +3006,7 @@ function extractStaticStateCss(srcDir, options = {}) {
|
|
|
2974
3006
|
if (filesScanned >= maxFiles) break;
|
|
2975
3007
|
let source;
|
|
2976
3008
|
try {
|
|
2977
|
-
source =
|
|
3009
|
+
source = fs3.readFileSync(filePath, "utf-8");
|
|
2978
3010
|
} catch {
|
|
2979
3011
|
continue;
|
|
2980
3012
|
}
|
|
@@ -2987,7 +3019,7 @@ function extractStaticStateCss(srcDir, options = {}) {
|
|
|
2987
3019
|
allConfigs.push(...configs);
|
|
2988
3020
|
if (verbose) {
|
|
2989
3021
|
process.stderr.write(
|
|
2990
|
-
`[tw:static-state] ${
|
|
3022
|
+
`[tw:static-state] ${path3.relative(srcDir, filePath)}: ${configs.length} komponen
|
|
2991
3023
|
`
|
|
2992
3024
|
);
|
|
2993
3025
|
}
|
|
@@ -3081,12 +3113,12 @@ function appendStaticStateCssToSafelist(srcDir, safelistPath, options = {}) {
|
|
|
3081
3113
|
resolvedCss: options.resolvedCss || ""
|
|
3082
3114
|
// ← ensure always passed
|
|
3083
3115
|
});
|
|
3084
|
-
const twClassesDir =
|
|
3085
|
-
|
|
3086
|
-
const stateFilePath =
|
|
3116
|
+
const twClassesDir = path3.join(path3.dirname(safelistPath), "tw-classes");
|
|
3117
|
+
fs3.mkdirSync(twClassesDir, { recursive: true });
|
|
3118
|
+
const stateFilePath = path3.join(twClassesDir, TW_STATE_STATIC_FILENAME);
|
|
3087
3119
|
if (result.rulesGenerated === 0) {
|
|
3088
3120
|
try {
|
|
3089
|
-
|
|
3121
|
+
fs3.writeFileSync(
|
|
3090
3122
|
stateFilePath,
|
|
3091
3123
|
"/* tw-state-static.css \u2014 tidak ada state rules yang di-generate */\n",
|
|
3092
3124
|
"utf-8"
|
|
@@ -3096,7 +3128,7 @@ function appendStaticStateCssToSafelist(srcDir, safelistPath, options = {}) {
|
|
|
3096
3128
|
return `[tw:static-state] tidak ada state rules yang di-generate (${result.filesScanned} files di-scan)`;
|
|
3097
3129
|
}
|
|
3098
3130
|
try {
|
|
3099
|
-
|
|
3131
|
+
fs3.writeFileSync(stateFilePath, result.generatedCss, "utf-8");
|
|
3100
3132
|
return [
|
|
3101
3133
|
`[tw:static-state] ${result.rulesGenerated} static state rules di-generate`,
|
|
3102
3134
|
` \u2192 ${result.filesScanned} files scanned, ${result.filesWithStates} dengan states`,
|
|
@@ -3111,12 +3143,17 @@ function appendStaticStateCssToSafelist(srcDir, safelistPath, options = {}) {
|
|
|
3111
3143
|
var SOURCE_EXTENSIONS, IGNORE_PATTERNS, _native, TW_STATE_STATIC_FILENAME;
|
|
3112
3144
|
var init_staticStateExtractor = __esm({
|
|
3113
3145
|
"packages/domain/shared/src/staticStateExtractor.ts"() {
|
|
3146
|
+
"use strict";
|
|
3114
3147
|
SOURCE_EXTENSIONS = /* @__PURE__ */ new Set([".ts", ".tsx", ".js", ".jsx", ".mts", ".mjs"]);
|
|
3115
3148
|
IGNORE_PATTERNS = ["node_modules", ".next", "dist", "build", ".git", "coverage", "__tests__"];
|
|
3116
3149
|
_native = null;
|
|
3117
3150
|
TW_STATE_STATIC_FILENAME = "_tw-state-static.css";
|
|
3118
3151
|
}
|
|
3119
3152
|
});
|
|
3153
|
+
|
|
3154
|
+
// packages/domain/shared/src/logger.ts
|
|
3155
|
+
import fs4 from "fs";
|
|
3156
|
+
import path4 from "path";
|
|
3120
3157
|
function getEnvLevel() {
|
|
3121
3158
|
const env = process.env.TWS_LOG_LEVEL?.toLowerCase();
|
|
3122
3159
|
if (env && env in LEVELS) return env;
|
|
@@ -3126,8 +3163,8 @@ function setGlobalLogFile(filePath) {
|
|
|
3126
3163
|
_globalLogFile = filePath;
|
|
3127
3164
|
_logFileInitialized = false;
|
|
3128
3165
|
try {
|
|
3129
|
-
|
|
3130
|
-
|
|
3166
|
+
fs4.mkdirSync(path4.dirname(filePath), { recursive: true });
|
|
3167
|
+
fs4.writeFileSync(
|
|
3131
3168
|
filePath,
|
|
3132
3169
|
`# tailwind-styled build log \u2014 ${(/* @__PURE__ */ new Date()).toISOString()}
|
|
3133
3170
|
`,
|
|
@@ -3140,13 +3177,13 @@ function setGlobalLogFile(filePath) {
|
|
|
3140
3177
|
function writeToFile(line) {
|
|
3141
3178
|
if (!_globalLogFile || !_logFileInitialized) return;
|
|
3142
3179
|
try {
|
|
3143
|
-
|
|
3180
|
+
fs4.appendFileSync(_globalLogFile, line);
|
|
3144
3181
|
} catch {
|
|
3145
3182
|
}
|
|
3146
3183
|
}
|
|
3147
3184
|
function createLogger(prefix, level) {
|
|
3148
3185
|
const loggerState = {
|
|
3149
|
-
currentLevel: getEnvLevel(),
|
|
3186
|
+
currentLevel: level ?? getEnvLevel(),
|
|
3150
3187
|
setLevel(l) {
|
|
3151
3188
|
this.currentLevel = l;
|
|
3152
3189
|
}
|
|
@@ -3167,15 +3204,23 @@ function createLogger(prefix, level) {
|
|
|
3167
3204
|
setLogFile: (filePath) => setGlobalLogFile(filePath)
|
|
3168
3205
|
};
|
|
3169
3206
|
}
|
|
3170
|
-
var LEVELS, _globalLogFile, _logFileInitialized;
|
|
3207
|
+
var LEVELS, _globalLogFile, _logFileInitialized, logger;
|
|
3171
3208
|
var init_logger = __esm({
|
|
3172
3209
|
"packages/domain/shared/src/logger.ts"() {
|
|
3210
|
+
"use strict";
|
|
3173
3211
|
LEVELS = { silent: 0, error: 1, warn: 2, info: 3, debug: 4 };
|
|
3174
3212
|
_globalLogFile = null;
|
|
3175
3213
|
_logFileInitialized = false;
|
|
3176
|
-
createLogger("tailwind-styled");
|
|
3214
|
+
logger = createLogger("tailwind-styled");
|
|
3177
3215
|
}
|
|
3178
3216
|
});
|
|
3217
|
+
|
|
3218
|
+
// packages/domain/shared/src/index.ts
|
|
3219
|
+
import { createHash } from "crypto";
|
|
3220
|
+
import fs5 from "fs";
|
|
3221
|
+
import path5 from "path";
|
|
3222
|
+
import { fileURLToPath } from "url";
|
|
3223
|
+
import { createRequire as createRequire5 } from "module";
|
|
3179
3224
|
function createLogger2(namespace) {
|
|
3180
3225
|
const prefix = `[${namespace}]`;
|
|
3181
3226
|
return {
|
|
@@ -3198,7 +3243,7 @@ function createLogger2(namespace) {
|
|
|
3198
3243
|
};
|
|
3199
3244
|
}
|
|
3200
3245
|
function createDebugLogger(namespace, label) {
|
|
3201
|
-
const prefix = `[${namespace}]`;
|
|
3246
|
+
const prefix = label ? `[${namespace}:${label}]` : `[${namespace}]`;
|
|
3202
3247
|
return (msg) => {
|
|
3203
3248
|
if (process.env.DEBUG?.includes(namespace) || process.env.TW_DEBUG) {
|
|
3204
3249
|
console.debug(prefix, msg);
|
|
@@ -3215,9 +3260,9 @@ function loadNativeBinding(options) {
|
|
|
3215
3260
|
const { runtimeDir, candidates, isValid } = options;
|
|
3216
3261
|
const loadErrors = [];
|
|
3217
3262
|
for (const candidate of candidates) {
|
|
3218
|
-
const candidatePath =
|
|
3263
|
+
const candidatePath = path5.resolve(runtimeDir, candidate);
|
|
3219
3264
|
try {
|
|
3220
|
-
if (!
|
|
3265
|
+
if (!fs5.existsSync(candidatePath) && !fs5.existsSync(candidatePath + ".node")) {
|
|
3221
3266
|
continue;
|
|
3222
3267
|
}
|
|
3223
3268
|
const mod = requireNativeModule(candidatePath);
|
|
@@ -3249,9 +3294,9 @@ function resolveNativeBindingCandidates(options) {
|
|
|
3249
3294
|
}
|
|
3250
3295
|
}
|
|
3251
3296
|
if (!includeDefaultCandidates) return candidates;
|
|
3252
|
-
if (
|
|
3297
|
+
if (fs5.existsSync(runtimeDir)) {
|
|
3253
3298
|
try {
|
|
3254
|
-
for (const entry of
|
|
3299
|
+
for (const entry of fs5.readdirSync(runtimeDir)) {
|
|
3255
3300
|
if (entry.endsWith(".node")) candidates.push(entry);
|
|
3256
3301
|
}
|
|
3257
3302
|
} catch {
|
|
@@ -3260,21 +3305,22 @@ function resolveNativeBindingCandidates(options) {
|
|
|
3260
3305
|
const BINARY_NAMES = ["tailwind-styled-native", "tailwind_styled_parser"];
|
|
3261
3306
|
const napiPlatform = process.platform === "linux" && process.arch === "x64" ? "linux-x64-gnu" : process.platform === "linux" && process.arch === "arm64" ? "linux-arm64-gnu" : `${process.platform}-${process.arch}`;
|
|
3262
3307
|
for (const bin of BINARY_NAMES) {
|
|
3263
|
-
candidates.push(
|
|
3264
|
-
candidates.push(
|
|
3265
|
-
candidates.push(
|
|
3266
|
-
candidates.push(
|
|
3267
|
-
candidates.push(
|
|
3268
|
-
candidates.push(
|
|
3269
|
-
candidates.push(
|
|
3270
|
-
candidates.push(
|
|
3271
|
-
candidates.push(
|
|
3308
|
+
candidates.push(path5.resolve(runtimeDir, `${bin}.node`));
|
|
3309
|
+
candidates.push(path5.resolve(runtimeDir, `${bin}.${napiPlatform}.node`));
|
|
3310
|
+
candidates.push(path5.resolve(runtimeDir, "..", "native", `${bin}.node`));
|
|
3311
|
+
candidates.push(path5.resolve(runtimeDir, "..", "native", `${bin}.${napiPlatform}.node`));
|
|
3312
|
+
candidates.push(path5.resolve(process.cwd(), "native", `${bin}.node`));
|
|
3313
|
+
candidates.push(path5.resolve(process.cwd(), "native", `${bin}.${napiPlatform}.node`));
|
|
3314
|
+
candidates.push(path5.resolve(runtimeDir, "..", "..", "..", "..", "native", `${bin}.node`));
|
|
3315
|
+
candidates.push(path5.resolve(runtimeDir, "..", "..", "..", "..", "native", `${bin}.${napiPlatform}.node`));
|
|
3316
|
+
candidates.push(path5.resolve(runtimeDir, "..", "..", "..", "native", `${bin}.node`));
|
|
3272
3317
|
}
|
|
3273
3318
|
return Array.from(new Set(candidates));
|
|
3274
3319
|
}
|
|
3275
3320
|
function resolveRuntimeDir(dir, importMetaUrl) {
|
|
3321
|
+
if (dir) return path5.resolve(dir);
|
|
3276
3322
|
try {
|
|
3277
|
-
return
|
|
3323
|
+
return path5.dirname(fileURLToPath(importMetaUrl));
|
|
3278
3324
|
} catch {
|
|
3279
3325
|
return process.cwd();
|
|
3280
3326
|
}
|
|
@@ -3282,6 +3328,7 @@ function resolveRuntimeDir(dir, importMetaUrl) {
|
|
|
3282
3328
|
var TwError, _require3;
|
|
3283
3329
|
var init_src2 = __esm({
|
|
3284
3330
|
"packages/domain/shared/src/index.ts"() {
|
|
3331
|
+
"use strict";
|
|
3285
3332
|
init_workerResolver();
|
|
3286
3333
|
init_native_resolution();
|
|
3287
3334
|
init_staticStateExtractor();
|
|
@@ -3338,7 +3385,7 @@ var init_src2 = __esm({
|
|
|
3338
3385
|
return `[${this.source.toUpperCase()}:${this.code}] ${this.message}`;
|
|
3339
3386
|
}
|
|
3340
3387
|
};
|
|
3341
|
-
_require3 =
|
|
3388
|
+
_require3 = createRequire5(import.meta.url);
|
|
3342
3389
|
}
|
|
3343
3390
|
});
|
|
3344
3391
|
|
|
@@ -3371,12 +3418,14 @@ __export(native_bridge_exports, {
|
|
|
3371
3418
|
startWatchNative: () => startWatchNative,
|
|
3372
3419
|
stopWatchNative: () => stopWatchNative
|
|
3373
3420
|
});
|
|
3421
|
+
import path6 from "path";
|
|
3422
|
+
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
3374
3423
|
function getDirname() {
|
|
3375
3424
|
if (typeof __dirname !== "undefined") {
|
|
3376
3425
|
return __dirname;
|
|
3377
3426
|
}
|
|
3378
3427
|
if (typeof import.meta !== "undefined" && import.meta.url) {
|
|
3379
|
-
return
|
|
3428
|
+
return path6.dirname(fileURLToPath2(import.meta.url));
|
|
3380
3429
|
}
|
|
3381
3430
|
return process.cwd();
|
|
3382
3431
|
}
|
|
@@ -3584,6 +3633,7 @@ function hasNativeWatchBinding() {
|
|
|
3584
3633
|
var log2, isValidScannerBinding, createScannerBridgeLoader, scannerBridgeLoader, scannerGetBinding, resetScannerBridgeCache;
|
|
3585
3634
|
var init_native_bridge = __esm({
|
|
3586
3635
|
"packages/domain/scanner/src/native-bridge.ts"() {
|
|
3636
|
+
"use strict";
|
|
3587
3637
|
init_src2();
|
|
3588
3638
|
log2 = createDebugLogger("scanner:native");
|
|
3589
3639
|
isValidScannerBinding = (module) => {
|
|
@@ -3664,6 +3714,9 @@ var init_native_bridge = __esm({
|
|
|
3664
3714
|
resetScannerBridgeCache = scannerBridgeLoader.reset;
|
|
3665
3715
|
}
|
|
3666
3716
|
});
|
|
3717
|
+
|
|
3718
|
+
// packages/presentation/next/src/schemas.ts
|
|
3719
|
+
import { z } from "zod";
|
|
3667
3720
|
var formatIssues = (error) => error.issues.map((issue) => {
|
|
3668
3721
|
const p = issue.path.length > 0 ? issue.path.join(".") : "<root>";
|
|
3669
3722
|
return `${p}: ${issue.message}`;
|
|
@@ -3688,19 +3741,30 @@ var parseNextAdapterOptions = (options) => parseWithSchema(NextAdapterOptionsSch
|
|
|
3688
3741
|
|
|
3689
3742
|
// packages/presentation/next/src/withTailwindStyled.ts
|
|
3690
3743
|
init_src2();
|
|
3744
|
+
import fs10 from "fs";
|
|
3745
|
+
import { createRequire as createRequire7 } from "module";
|
|
3746
|
+
import path11 from "path";
|
|
3691
3747
|
|
|
3692
3748
|
// packages/domain/scanner/src/index.ts
|
|
3693
3749
|
init_src2();
|
|
3750
|
+
import fs7 from "fs";
|
|
3751
|
+
import { createRequire as createRequire6 } from "module";
|
|
3752
|
+
import path8 from "path";
|
|
3753
|
+
import { fileURLToPath as fileURLToPath3 } from "url";
|
|
3754
|
+
import { Worker } from "worker_threads";
|
|
3694
3755
|
|
|
3695
3756
|
// packages/domain/scanner/src/cache-native.ts
|
|
3696
3757
|
init_native_bridge();
|
|
3758
|
+
import fs6 from "fs";
|
|
3759
|
+
import path7 from "path";
|
|
3697
3760
|
function defaultCachePath(rootDir, cacheDir) {
|
|
3698
|
-
const dir = cacheDir ?
|
|
3699
|
-
return
|
|
3761
|
+
const dir = cacheDir ? path7.resolve(rootDir, cacheDir) : path7.join(process.cwd(), ".cache", "tailwind-styled");
|
|
3762
|
+
return path7.join(dir, "scanner-cache.json");
|
|
3700
3763
|
}
|
|
3764
|
+
var STALE_THRESHOLD_MS = 7 * 24 * 60 * 60 * 1e3;
|
|
3701
3765
|
function readCache(rootDir, cacheDir) {
|
|
3702
3766
|
const cachePath = defaultCachePath(rootDir, cacheDir);
|
|
3703
|
-
|
|
3767
|
+
fs6.mkdirSync(path7.dirname(cachePath), { recursive: true });
|
|
3704
3768
|
const result = cacheReadNative(cachePath);
|
|
3705
3769
|
if (!result) return [];
|
|
3706
3770
|
return result.entries.map((e) => ({
|
|
@@ -3715,7 +3779,7 @@ function readCache(rootDir, cacheDir) {
|
|
|
3715
3779
|
}
|
|
3716
3780
|
function writeCache(rootDir, entries, cacheDir) {
|
|
3717
3781
|
const cachePath = defaultCachePath(rootDir, cacheDir);
|
|
3718
|
-
|
|
3782
|
+
fs6.mkdirSync(path7.dirname(cachePath), { recursive: true });
|
|
3719
3783
|
const success = cacheWriteNative(cachePath, entries);
|
|
3720
3784
|
if (!success) {
|
|
3721
3785
|
throw new Error(
|
|
@@ -3740,6 +3804,7 @@ init_native_bridge();
|
|
|
3740
3804
|
|
|
3741
3805
|
// packages/domain/scanner/src/schemas.ts
|
|
3742
3806
|
init_src2();
|
|
3807
|
+
import { z as z2 } from "zod";
|
|
3743
3808
|
var formatIssuePath2 = (path12) => path12.length > 0 ? path12.map(
|
|
3744
3809
|
(segment) => typeof segment === "symbol" ? segment.description ?? segment.toString() : String(segment)
|
|
3745
3810
|
).join(".") : "<root>";
|
|
@@ -3758,40 +3823,40 @@ var parseWithSchema2 = (schema, data, label) => {
|
|
|
3758
3823
|
parsed.error
|
|
3759
3824
|
);
|
|
3760
3825
|
};
|
|
3761
|
-
var NonNegativeIntegerSchema =
|
|
3762
|
-
var ScanWorkspaceOptionsSchema =
|
|
3763
|
-
includeExtensions:
|
|
3764
|
-
ignoreDirectories:
|
|
3765
|
-
useCache:
|
|
3766
|
-
cacheDir:
|
|
3767
|
-
smartInvalidation:
|
|
3826
|
+
var NonNegativeIntegerSchema = z2.number().int().min(0);
|
|
3827
|
+
var ScanWorkspaceOptionsSchema = z2.object({
|
|
3828
|
+
includeExtensions: z2.array(z2.string()).optional(),
|
|
3829
|
+
ignoreDirectories: z2.array(z2.string()).optional(),
|
|
3830
|
+
useCache: z2.boolean().optional(),
|
|
3831
|
+
cacheDir: z2.string().min(1).optional(),
|
|
3832
|
+
smartInvalidation: z2.boolean().optional()
|
|
3768
3833
|
});
|
|
3769
|
-
var ScanFileResultSchema =
|
|
3770
|
-
file:
|
|
3771
|
-
classes:
|
|
3772
|
-
hash:
|
|
3834
|
+
var ScanFileResultSchema = z2.object({
|
|
3835
|
+
file: z2.string(),
|
|
3836
|
+
classes: z2.array(z2.string()),
|
|
3837
|
+
hash: z2.string().optional()
|
|
3773
3838
|
});
|
|
3774
|
-
var ScanWorkspaceResultSchema =
|
|
3775
|
-
files:
|
|
3839
|
+
var ScanWorkspaceResultSchema = z2.object({
|
|
3840
|
+
files: z2.array(ScanFileResultSchema),
|
|
3776
3841
|
totalFiles: NonNegativeIntegerSchema,
|
|
3777
|
-
uniqueClasses:
|
|
3842
|
+
uniqueClasses: z2.array(z2.string())
|
|
3778
3843
|
}).refine((value) => value.totalFiles === value.files.length, {
|
|
3779
3844
|
message: "scan result totalFiles must match files.length",
|
|
3780
3845
|
path: ["totalFiles"]
|
|
3781
3846
|
});
|
|
3782
|
-
|
|
3783
|
-
rootDir:
|
|
3847
|
+
var ScannerWorkerRequestSchema = z2.object({
|
|
3848
|
+
rootDir: z2.string().min(1),
|
|
3784
3849
|
options: ScanWorkspaceOptionsSchema.optional()
|
|
3785
3850
|
});
|
|
3786
|
-
var ScannerWorkerSuccessMessageSchema =
|
|
3787
|
-
ok:
|
|
3851
|
+
var ScannerWorkerSuccessMessageSchema = z2.object({
|
|
3852
|
+
ok: z2.literal(true),
|
|
3788
3853
|
result: ScanWorkspaceResultSchema
|
|
3789
3854
|
});
|
|
3790
|
-
var ScannerWorkerErrorMessageSchema =
|
|
3791
|
-
ok:
|
|
3792
|
-
error:
|
|
3855
|
+
var ScannerWorkerErrorMessageSchema = z2.object({
|
|
3856
|
+
ok: z2.literal(false),
|
|
3857
|
+
error: z2.string().optional()
|
|
3793
3858
|
});
|
|
3794
|
-
|
|
3859
|
+
var ScannerWorkerMessageSchema = z2.union([
|
|
3795
3860
|
ScannerWorkerSuccessMessageSchema,
|
|
3796
3861
|
ScannerWorkerErrorMessageSchema
|
|
3797
3862
|
]);
|
|
@@ -3805,7 +3870,7 @@ function getRuntimeDir() {
|
|
|
3805
3870
|
return __dirname;
|
|
3806
3871
|
}
|
|
3807
3872
|
if (typeof import.meta !== "undefined" && import.meta.url) {
|
|
3808
|
-
return
|
|
3873
|
+
return path8.dirname(fileURLToPath3(import.meta.url));
|
|
3809
3874
|
}
|
|
3810
3875
|
return process.cwd();
|
|
3811
3876
|
}
|
|
@@ -3820,7 +3885,7 @@ var createNativeParserLoader = () => {
|
|
|
3820
3885
|
const loadNativeParserBinding = () => {
|
|
3821
3886
|
if (_state.binding !== void 0) return _state.binding;
|
|
3822
3887
|
const runtimeDir = getRuntimeDir();
|
|
3823
|
-
const req =
|
|
3888
|
+
const req = createRequire6(path8.join(runtimeDir, "noop.cjs"));
|
|
3824
3889
|
const _platform = process.platform;
|
|
3825
3890
|
const _arch = process.arch;
|
|
3826
3891
|
const _platformArch = `${_platform}-${_arch}`;
|
|
@@ -3828,27 +3893,27 @@ var createNativeParserLoader = () => {
|
|
|
3828
3893
|
const candidates = [
|
|
3829
3894
|
// ── binaryName baru: tailwind-styled-native (napi-rs naming) ──
|
|
3830
3895
|
// cwd = repo root saat run dari root, atau package dir saat workspaces
|
|
3831
|
-
|
|
3832
|
-
|
|
3833
|
-
|
|
3896
|
+
path8.resolve(process.cwd(), "native", "tailwind-styled-native.node"),
|
|
3897
|
+
path8.resolve(process.cwd(), "native", `tailwind-styled-native.${_platformArch}.node`),
|
|
3898
|
+
path8.resolve(process.cwd(), "native", `tailwind-styled-native.${_platformArchGnu}.node`),
|
|
3834
3899
|
// runtimeDir = dist/ → naik 1 level ke package root (npm install case)
|
|
3835
3900
|
// e.g. node_modules/tailwind-styled-v4/dist/ → node_modules/tailwind-styled-v4/native/
|
|
3836
|
-
|
|
3837
|
-
|
|
3838
|
-
|
|
3901
|
+
path8.resolve(runtimeDir, "..", "native", "tailwind-styled-native.node"),
|
|
3902
|
+
path8.resolve(runtimeDir, "..", "native", `tailwind-styled-native.${_platformArch}.node`),
|
|
3903
|
+
path8.resolve(runtimeDir, "..", "native", `tailwind-styled-native.${_platformArchGnu}.node`),
|
|
3839
3904
|
// runtimeDir = dist/ → naik 4 level ke repo root (monorepo dev case)
|
|
3840
|
-
|
|
3841
|
-
|
|
3905
|
+
path8.resolve(runtimeDir, "..", "..", "..", "..", "native", "tailwind-styled-native.node"),
|
|
3906
|
+
path8.resolve(runtimeDir, "..", "..", "..", "..", "native", `tailwind-styled-native.${_platformArchGnu}.node`),
|
|
3842
3907
|
// 3 level fallback (jika package di-nest lebih dangkal)
|
|
3843
|
-
|
|
3844
|
-
|
|
3908
|
+
path8.resolve(runtimeDir, "..", "..", "..", "native", "tailwind-styled-native.node"),
|
|
3909
|
+
path8.resolve(runtimeDir, "..", "..", "..", "native", `tailwind-styled-native.${_platformArchGnu}.node`),
|
|
3845
3910
|
// ── binaryName lama: tailwind_styled_parser (backward compat) ──
|
|
3846
|
-
|
|
3847
|
-
|
|
3848
|
-
|
|
3849
|
-
|
|
3850
|
-
|
|
3851
|
-
|
|
3911
|
+
path8.resolve(process.cwd(), "native/tailwind_styled_parser.node"),
|
|
3912
|
+
path8.resolve(process.cwd(), "native/build/Release/tailwind_styled_parser.node"),
|
|
3913
|
+
path8.resolve(runtimeDir, "..", "native", "tailwind_styled_parser.node"),
|
|
3914
|
+
path8.resolve(runtimeDir, "..", "..", "..", "..", "native", "tailwind_styled_parser.node"),
|
|
3915
|
+
path8.resolve(runtimeDir, "..", "..", "..", "native", "tailwind_styled_parser.node"),
|
|
3916
|
+
path8.resolve(
|
|
3852
3917
|
runtimeDir,
|
|
3853
3918
|
"..",
|
|
3854
3919
|
"..",
|
|
@@ -3860,7 +3925,7 @@ var createNativeParserLoader = () => {
|
|
|
3860
3925
|
)
|
|
3861
3926
|
];
|
|
3862
3927
|
for (const fullPath of candidates) {
|
|
3863
|
-
if (!
|
|
3928
|
+
if (!fs7.existsSync(fullPath)) continue;
|
|
3864
3929
|
try {
|
|
3865
3930
|
const required = req(fullPath);
|
|
3866
3931
|
if (required && (typeof required.extractClassesFromSource === "function" || typeof required.parseClasses === "function" || typeof required.parse_classes === "function")) {
|
|
@@ -3901,19 +3966,19 @@ function collectCandidates(rootDir, ignoreDirectories, extensionSet) {
|
|
|
3901
3966
|
if (!currentDir) continue;
|
|
3902
3967
|
const entries = (() => {
|
|
3903
3968
|
try {
|
|
3904
|
-
return
|
|
3969
|
+
return fs7.readdirSync(currentDir, { withFileTypes: true });
|
|
3905
3970
|
} catch {
|
|
3906
3971
|
return [];
|
|
3907
3972
|
}
|
|
3908
3973
|
})();
|
|
3909
3974
|
for (const entry of entries) {
|
|
3910
|
-
const fullPath =
|
|
3975
|
+
const fullPath = path8.join(currentDir, entry.name);
|
|
3911
3976
|
if (entry.isDirectory()) {
|
|
3912
3977
|
if (!ignoreDirectories.has(entry.name)) directories.push(fullPath);
|
|
3913
3978
|
continue;
|
|
3914
3979
|
}
|
|
3915
3980
|
if (!entry.isFile()) continue;
|
|
3916
|
-
if (!extensionSet.has(
|
|
3981
|
+
if (!extensionSet.has(path8.extname(entry.name))) continue;
|
|
3917
3982
|
candidates.push(fullPath);
|
|
3918
3983
|
}
|
|
3919
3984
|
}
|
|
@@ -3957,7 +4022,7 @@ function scanWorkspace2(rootDir, options = {}) {
|
|
|
3957
4022
|
const extensionSet = buildExtensionSet(includeExtensions);
|
|
3958
4023
|
const ignoreDirectories = new Set(normalizedOptions.ignoreDirectories ?? DEFAULT_IGNORES);
|
|
3959
4024
|
const useCache = normalizedOptions.useCache ?? true;
|
|
3960
|
-
normalizedOptions.smartInvalidation ?? true;
|
|
4025
|
+
const _smartInvalidation = normalizedOptions.smartInvalidation ?? true;
|
|
3961
4026
|
const files = [];
|
|
3962
4027
|
const unique = /* @__PURE__ */ new Set();
|
|
3963
4028
|
const candidates = collectCandidates(rootDir, ignoreDirectories, extensionSet);
|
|
@@ -3997,7 +4062,7 @@ function scanWorkspace2(rootDir, options = {}) {
|
|
|
3997
4062
|
for (const filePath of candidates) {
|
|
3998
4063
|
const stat = (() => {
|
|
3999
4064
|
try {
|
|
4000
|
-
return
|
|
4065
|
+
return fs7.statSync(filePath);
|
|
4001
4066
|
} catch {
|
|
4002
4067
|
return null;
|
|
4003
4068
|
}
|
|
@@ -4023,7 +4088,7 @@ function scanWorkspace2(rootDir, options = {}) {
|
|
|
4023
4088
|
for (const { filePath, stat, size, cached } of ranked) {
|
|
4024
4089
|
const content = (() => {
|
|
4025
4090
|
try {
|
|
4026
|
-
return
|
|
4091
|
+
return fs7.readFileSync(filePath, "utf8");
|
|
4027
4092
|
} catch {
|
|
4028
4093
|
return null;
|
|
4029
4094
|
}
|
|
@@ -4089,6 +4154,8 @@ init_src2();
|
|
|
4089
4154
|
|
|
4090
4155
|
// packages/presentation/next/src/incrementalOrchestrator.ts
|
|
4091
4156
|
init_src();
|
|
4157
|
+
import fs8 from "fs";
|
|
4158
|
+
import path9 from "path";
|
|
4092
4159
|
var _fingerprintCache = /* @__PURE__ */ new Map();
|
|
4093
4160
|
function getNative2() {
|
|
4094
4161
|
try {
|
|
@@ -4099,10 +4166,10 @@ function getNative2() {
|
|
|
4099
4166
|
}
|
|
4100
4167
|
function fingerprintFile(filePath) {
|
|
4101
4168
|
try {
|
|
4102
|
-
const stat =
|
|
4169
|
+
const stat = fs8.statSync(filePath);
|
|
4103
4170
|
const native = getNative2();
|
|
4104
4171
|
if (native?.create_fingerprint) {
|
|
4105
|
-
const content =
|
|
4172
|
+
const content = fs8.readFileSync(filePath, "utf-8");
|
|
4106
4173
|
const hash = native.create_fingerprint(filePath, content);
|
|
4107
4174
|
return { hash, mtime: stat.mtimeMs };
|
|
4108
4175
|
}
|
|
@@ -4142,14 +4209,18 @@ function hasSourceChanged(sourceFiles) {
|
|
|
4142
4209
|
}
|
|
4143
4210
|
function isIncrementalEnabled(cwd) {
|
|
4144
4211
|
try {
|
|
4145
|
-
const configPath =
|
|
4146
|
-
if (!
|
|
4147
|
-
const config = JSON.parse(
|
|
4212
|
+
const configPath = path9.join(cwd, "tailwind-styled.config.json");
|
|
4213
|
+
if (!fs8.existsSync(configPath)) return false;
|
|
4214
|
+
const config = JSON.parse(fs8.readFileSync(configPath, "utf-8"));
|
|
4148
4215
|
return config.compiler?.incremental === true;
|
|
4149
4216
|
} catch {
|
|
4150
4217
|
return false;
|
|
4151
4218
|
}
|
|
4152
4219
|
}
|
|
4220
|
+
|
|
4221
|
+
// packages/presentation/next/src/staticCssWebpackPlugin.ts
|
|
4222
|
+
import fs9 from "fs";
|
|
4223
|
+
import path10 from "path";
|
|
4153
4224
|
var _fileStaticCssMap = /* @__PURE__ */ new Map();
|
|
4154
4225
|
function setFileStaticCss(filepath, css) {
|
|
4155
4226
|
if (css && css.trim()) {
|
|
@@ -4183,14 +4254,14 @@ var StaticCssWebpackPlugin = class _StaticCssWebpackPlugin {
|
|
|
4183
4254
|
static PLUGIN_NAME = "TailwindStyledStaticCss";
|
|
4184
4255
|
outPath;
|
|
4185
4256
|
constructor(safelistPath) {
|
|
4186
|
-
this.outPath =
|
|
4257
|
+
this.outPath = path10.join(path10.dirname(safelistPath), "_tw-state-static.css");
|
|
4187
4258
|
}
|
|
4188
4259
|
apply(compiler) {
|
|
4189
4260
|
compiler.hooks.done.tap(_StaticCssWebpackPlugin.PLUGIN_NAME, () => {
|
|
4190
4261
|
try {
|
|
4191
4262
|
const content = buildContent(_fileStaticCssMap);
|
|
4192
|
-
|
|
4193
|
-
|
|
4263
|
+
fs9.mkdirSync(path10.dirname(this.outPath), { recursive: true });
|
|
4264
|
+
fs9.writeFileSync(
|
|
4194
4265
|
this.outPath,
|
|
4195
4266
|
HEADER + (content || "/* no static rules yet */") + "\n",
|
|
4196
4267
|
"utf-8"
|
|
@@ -4216,7 +4287,7 @@ function getDirnameFromUrl2(importMetaUrl) {
|
|
|
4216
4287
|
const lastSlash = Math.max(importMetaUrl.lastIndexOf("/"), importMetaUrl.lastIndexOf("\\"));
|
|
4217
4288
|
return lastSlash > 0 ? importMetaUrl.slice(0, lastSlash) : "";
|
|
4218
4289
|
}
|
|
4219
|
-
var require4 =
|
|
4290
|
+
var require4 = createRequire7(import.meta.url);
|
|
4220
4291
|
var resolveRuntimeDir2 = () => getDirnameFromUrl2(import.meta.url);
|
|
4221
4292
|
var resolveLoaderPath2 = (basename) => {
|
|
4222
4293
|
try {
|
|
@@ -4224,12 +4295,12 @@ var resolveLoaderPath2 = (basename) => {
|
|
|
4224
4295
|
} catch {
|
|
4225
4296
|
const runtimeDir = resolveRuntimeDir2();
|
|
4226
4297
|
const candidates = [
|
|
4227
|
-
|
|
4228
|
-
|
|
4229
|
-
|
|
4298
|
+
path11.resolve(runtimeDir, `${basename}.mjs`),
|
|
4299
|
+
path11.resolve(runtimeDir, `${basename}.js`),
|
|
4300
|
+
path11.resolve(runtimeDir, `${basename}.cjs`)
|
|
4230
4301
|
];
|
|
4231
4302
|
for (const candidate of candidates) {
|
|
4232
|
-
if (
|
|
4303
|
+
if (fs10.existsSync(candidate)) {
|
|
4233
4304
|
return candidate;
|
|
4234
4305
|
}
|
|
4235
4306
|
}
|
|
@@ -4267,7 +4338,7 @@ var createLoaderOptions = (options) => {
|
|
|
4267
4338
|
preserveImports: true
|
|
4268
4339
|
};
|
|
4269
4340
|
if (options.verbose !== void 0) opts.verbose = options.verbose;
|
|
4270
|
-
opts.safelistPath = options.safelistPath ??
|
|
4341
|
+
opts.safelistPath = options.safelistPath ?? path11.join(process.cwd(), ".next", "tailwind-styled-safelist.css");
|
|
4271
4342
|
return Object.freeze(opts);
|
|
4272
4343
|
};
|
|
4273
4344
|
var buildTurbopackRules = (loaderPath, loaderOptions) => {
|
|
@@ -4280,7 +4351,7 @@ var buildTurbopackRules = (loaderPath, loaderOptions) => {
|
|
|
4280
4351
|
])
|
|
4281
4352
|
);
|
|
4282
4353
|
};
|
|
4283
|
-
var normalizeLoaderPath = (loaderPath) =>
|
|
4354
|
+
var normalizeLoaderPath = (loaderPath) => path11.resolve(loaderPath);
|
|
4284
4355
|
var applyWebpackRule = (config, options, loaderPath) => {
|
|
4285
4356
|
const loaderOptions = createLoaderOptions(options);
|
|
4286
4357
|
const rules = config.module?.rules ?? [];
|
|
@@ -4297,7 +4368,7 @@ var applyWebpackRule = (config, options, loaderPath) => {
|
|
|
4297
4368
|
enforce: "pre",
|
|
4298
4369
|
use: [{ loader: loaderPath, options: loaderOptions }]
|
|
4299
4370
|
};
|
|
4300
|
-
const safelistPath = loaderOptions.safelistPath ??
|
|
4371
|
+
const safelistPath = loaderOptions.safelistPath ?? path11.join(process.cwd(), ".next", "tailwind-styled-safelist.css");
|
|
4301
4372
|
const pluginAlreadyRegistered = (config.plugins ?? []).some(
|
|
4302
4373
|
(p) => p?.constructor?.name === StaticCssWebpackPlugin.PLUGIN_NAME
|
|
4303
4374
|
);
|
|
@@ -4397,17 +4468,17 @@ function withTailwindStyled(options = {}) {
|
|
|
4397
4468
|
return fullCss.slice(startIdx, endIdx + 1);
|
|
4398
4469
|
};
|
|
4399
4470
|
var extractUtilitiesLayer = extractUtilitiesLayer2;
|
|
4400
|
-
const twClassesDir =
|
|
4401
|
-
|
|
4402
|
-
setGlobalLogFile(
|
|
4403
|
-
|
|
4404
|
-
|
|
4471
|
+
const twClassesDir = path11.join(path11.dirname(safelistPath), "tw-classes");
|
|
4472
|
+
fs10.mkdirSync(twClassesDir, { recursive: true });
|
|
4473
|
+
setGlobalLogFile(path11.join(twClassesDir, "_tw-build.log"));
|
|
4474
|
+
fs10.writeFileSync(
|
|
4475
|
+
path11.join(twClassesDir, "_start.txt"),
|
|
4405
4476
|
String(Date.now()),
|
|
4406
4477
|
"utf-8"
|
|
4407
4478
|
);
|
|
4408
|
-
const stateStaticPath =
|
|
4479
|
+
const stateStaticPath = path11.join(twClassesDir, TW_STATE_STATIC_FILENAME);
|
|
4409
4480
|
try {
|
|
4410
|
-
|
|
4481
|
+
fs10.writeFileSync(
|
|
4411
4482
|
stateStaticPath,
|
|
4412
4483
|
"/* tw-state-static.css \u2014 placeholder, akan di-generate setelah scan */\n",
|
|
4413
4484
|
"utf-8"
|
|
@@ -4423,14 +4494,14 @@ function withTailwindStyled(options = {}) {
|
|
|
4423
4494
|
"src/index.css",
|
|
4424
4495
|
"styles/globals.css"
|
|
4425
4496
|
];
|
|
4426
|
-
const safelistDir =
|
|
4497
|
+
const safelistDir = path11.dirname(safelistPath);
|
|
4427
4498
|
for (const candidate of CSS_CANDIDATES) {
|
|
4428
|
-
const candidatePath =
|
|
4429
|
-
if (!
|
|
4430
|
-
const content =
|
|
4499
|
+
const candidatePath = path11.join(process.cwd(), candidate);
|
|
4500
|
+
if (!fs10.existsSync(candidatePath)) continue;
|
|
4501
|
+
const content = fs10.readFileSync(candidatePath, "utf-8");
|
|
4431
4502
|
if (content.includes("_tw-state-static.css")) break;
|
|
4432
|
-
const globalsDir =
|
|
4433
|
-
const rel =
|
|
4503
|
+
const globalsDir = path11.dirname(candidatePath);
|
|
4504
|
+
const rel = path11.relative(globalsDir, stateStaticPath).replace(/\\/g, "/");
|
|
4434
4505
|
const importLine = `@import "./${rel}";`;
|
|
4435
4506
|
const tailwindImportRe = /(@import\s+["']tailwindcss["']\s*;[^\n]*\n?)/;
|
|
4436
4507
|
let updated;
|
|
@@ -4444,7 +4515,7 @@ function withTailwindStyled(options = {}) {
|
|
|
4444
4515
|
updated = `${importLine}
|
|
4445
4516
|
${content}`;
|
|
4446
4517
|
}
|
|
4447
|
-
|
|
4518
|
+
fs10.writeFileSync(candidatePath, updated, "utf-8");
|
|
4448
4519
|
if (options.verbose) {
|
|
4449
4520
|
console.log(
|
|
4450
4521
|
`[tailwind-styled] Auto-injected "${importLine}" into ${candidate}`
|
|
@@ -4456,27 +4527,27 @@ ${content}`;
|
|
|
4456
4527
|
}
|
|
4457
4528
|
if (!process.env.TW_NATIVE_PATH) {
|
|
4458
4529
|
const runtimeDir = resolveRuntimeDir2();
|
|
4459
|
-
const nativePath =
|
|
4460
|
-
if (
|
|
4530
|
+
const nativePath = path11.resolve(runtimeDir, "..", "native", "tailwind-styled-native.node");
|
|
4531
|
+
if (fs10.existsSync(nativePath)) {
|
|
4461
4532
|
process.env.TW_NATIVE_PATH = nativePath;
|
|
4462
4533
|
}
|
|
4463
4534
|
}
|
|
4464
|
-
const srcDir =
|
|
4465
|
-
if (
|
|
4535
|
+
const srcDir = path11.join(process.cwd(), "src");
|
|
4536
|
+
if (fs10.existsSync(srcDir)) {
|
|
4466
4537
|
try {
|
|
4467
4538
|
const result = scanWorkspace2(srcDir);
|
|
4468
4539
|
if (result.uniqueClasses.length > 0) {
|
|
4469
4540
|
let atomicWriteFile2 = function(filePath, content) {
|
|
4470
4541
|
const tmpPath = `${filePath}.tmp`;
|
|
4471
4542
|
try {
|
|
4472
|
-
|
|
4473
|
-
|
|
4543
|
+
fs10.writeFileSync(tmpPath, content, "utf-8");
|
|
4544
|
+
fs10.renameSync(tmpPath, filePath);
|
|
4474
4545
|
} catch {
|
|
4475
4546
|
try {
|
|
4476
|
-
|
|
4547
|
+
fs10.unlinkSync(tmpPath);
|
|
4477
4548
|
} catch {
|
|
4478
4549
|
}
|
|
4479
|
-
|
|
4550
|
+
fs10.writeFileSync(filePath, content, "utf-8");
|
|
4480
4551
|
}
|
|
4481
4552
|
};
|
|
4482
4553
|
var atomicWriteFile = atomicWriteFile2;
|
|
@@ -4539,14 +4610,14 @@ ${content}`;
|
|
|
4539
4610
|
"styles/globals.css"
|
|
4540
4611
|
];
|
|
4541
4612
|
try {
|
|
4542
|
-
const twConfigPath =
|
|
4543
|
-
if (
|
|
4544
|
-
const twConfig = JSON.parse(
|
|
4613
|
+
const twConfigPath = path11.join(process.cwd(), "tailwind-styled.config.json");
|
|
4614
|
+
if (fs10.existsSync(twConfigPath)) {
|
|
4615
|
+
const twConfig = JSON.parse(fs10.readFileSync(twConfigPath, "utf-8"));
|
|
4545
4616
|
const cssEntry = twConfig.css?.entry;
|
|
4546
4617
|
if (cssEntry) {
|
|
4547
|
-
const cssEntryPath =
|
|
4548
|
-
if (
|
|
4549
|
-
cssEntryContent =
|
|
4618
|
+
const cssEntryPath = path11.join(process.cwd(), cssEntry);
|
|
4619
|
+
if (fs10.existsSync(cssEntryPath)) {
|
|
4620
|
+
cssEntryContent = fs10.readFileSync(cssEntryPath, "utf-8");
|
|
4550
4621
|
}
|
|
4551
4622
|
}
|
|
4552
4623
|
}
|
|
@@ -4554,9 +4625,9 @@ ${content}`;
|
|
|
4554
4625
|
}
|
|
4555
4626
|
if (!cssEntryContent) {
|
|
4556
4627
|
for (const candidate of CSS_CANDIDATES) {
|
|
4557
|
-
const candidatePath =
|
|
4558
|
-
if (
|
|
4559
|
-
cssEntryContent =
|
|
4628
|
+
const candidatePath = path11.join(process.cwd(), candidate);
|
|
4629
|
+
if (fs10.existsSync(candidatePath)) {
|
|
4630
|
+
cssEntryContent = fs10.readFileSync(candidatePath, "utf-8");
|
|
4560
4631
|
break;
|
|
4561
4632
|
}
|
|
4562
4633
|
}
|
|
@@ -4564,8 +4635,8 @@ ${content}`;
|
|
|
4564
4635
|
if (cssEntryContent) {
|
|
4565
4636
|
cssEntryContent = cssEntryContent.replace(/@source\s+["'][^"']+["']\s*;?\s*/g, "").replace(/←[^\n]*/g, "").trim();
|
|
4566
4637
|
}
|
|
4567
|
-
const initialScanPath =
|
|
4568
|
-
if (!
|
|
4638
|
+
const initialScanPath = path11.join(twClassesDir, "_initial-scan.css");
|
|
4639
|
+
if (!fs10.existsSync(initialScanPath)) {
|
|
4569
4640
|
atomicWriteFile2(
|
|
4570
4641
|
initialScanPath,
|
|
4571
4642
|
"/* tw-classes: initial scan \u2014 generating... */\n@layer utilities {}\n"
|
|
@@ -4573,7 +4644,7 @@ ${content}`;
|
|
|
4573
4644
|
}
|
|
4574
4645
|
const sourceFiles = result.files?.map((f) => f.file) ?? [];
|
|
4575
4646
|
const incremental = isIncrementalEnabled(process.cwd());
|
|
4576
|
-
if (incremental &&
|
|
4647
|
+
if (incremental && fs10.existsSync(initialScanPath) && !hasSourceChanged(sourceFiles)) {
|
|
4577
4648
|
if (options.verbose) console.log("[tailwind-styled] Incremental: tidak ada perubahan, skip regenerate CSS");
|
|
4578
4649
|
} else {
|
|
4579
4650
|
void (async () => {
|
|
@@ -4691,7 +4762,11 @@ ${err.message}`,
|
|
|
4691
4762
|
};
|
|
4692
4763
|
};
|
|
4693
4764
|
}
|
|
4694
|
-
|
|
4695
|
-
|
|
4696
|
-
|
|
4765
|
+
export {
|
|
4766
|
+
NextAdapterOptionsSchema,
|
|
4767
|
+
StaticCssWebpackPlugin,
|
|
4768
|
+
parseNextAdapterOptions,
|
|
4769
|
+
setFileStaticCss,
|
|
4770
|
+
withTailwindStyled
|
|
4771
|
+
};
|
|
4697
4772
|
//# sourceMappingURL=next.mjs.map
|