tailwind-styled-v4 5.0.37 → 5.0.39
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/analyzer.js +213 -161
- package/dist/analyzer.js.map +1 -1
- package/dist/analyzer.mjs +121 -83
- package/dist/analyzer.mjs.map +1 -1
- package/dist/animate.js +131 -87
- package/dist/animate.js.map +1 -1
- package/dist/animate.mjs +31 -15
- package/dist/animate.mjs.map +1 -1
- package/dist/atomic.js +107 -67
- package/dist/atomic.js.map +1 -1
- package/dist/atomic.mjs +47 -14
- package/dist/atomic.mjs.map +1 -1
- package/dist/cli.js +601 -428
- package/dist/cli.js.map +1 -1
- package/dist/cli.mjs +504 -313
- package/dist/cli.mjs.map +1 -1
- package/dist/compiler.js +833 -508
- package/dist/compiler.js.map +1 -1
- package/dist/compiler.mjs +298 -30
- package/dist/compiler.mjs.map +1 -1
- package/dist/dashboard.js +72 -41
- package/dist/dashboard.js.map +1 -1
- package/dist/dashboard.mjs +12 -6
- package/dist/dashboard.mjs.map +1 -1
- package/dist/devtools.js +335 -289
- package/dist/devtools.js.map +1 -1
- package/dist/devtools.mjs +28 -11
- package/dist/devtools.mjs.map +1 -1
- package/dist/engine.js +719 -506
- package/dist/engine.js.map +1 -1
- package/dist/engine.mjs +520 -318
- package/dist/engine.mjs.map +1 -1
- package/dist/index.d.mts +145 -319
- package/dist/index.d.ts +145 -319
- package/dist/index.js +1337 -7442
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1275 -7386
- package/dist/index.mjs.map +1 -1
- package/dist/next.js +327 -242
- package/dist/next.js.map +1 -1
- package/dist/next.mjs +272 -184
- package/dist/next.mjs.map +1 -1
- package/dist/plugin-api.js +94 -49
- package/dist/plugin-api.js.map +1 -1
- package/dist/plugin-api.mjs +26 -6
- package/dist/plugin-api.mjs.map +1 -1
- package/dist/plugin-registry.js +68 -40
- package/dist/plugin-registry.js.map +1 -1
- package/dist/plugin-registry.mjs +14 -10
- package/dist/plugin-registry.mjs.map +1 -1
- package/dist/plugin.js +102 -53
- package/dist/plugin.js.map +1 -1
- package/dist/plugin.mjs +30 -6
- package/dist/plugin.mjs.map +1 -1
- package/dist/preset.js +48 -15
- package/dist/preset.js.map +1 -1
- package/dist/preset.mjs +13 -5
- package/dist/preset.mjs.map +1 -1
- package/dist/rspack.js +108 -53
- package/dist/rspack.js.map +1 -1
- package/dist/rspack.mjs +50 -18
- package/dist/rspack.mjs.map +1 -1
- package/dist/runtime-css.js +63 -24
- package/dist/runtime-css.js.map +1 -1
- package/dist/runtime-css.mjs +15 -7
- package/dist/runtime-css.mjs.map +1 -1
- package/dist/runtime.js +98 -44
- package/dist/runtime.js.map +1 -1
- package/dist/runtime.mjs +31 -8
- package/dist/runtime.mjs.map +1 -1
- package/dist/scanner.js +164 -120
- package/dist/scanner.js.map +1 -1
- package/dist/scanner.mjs +70 -40
- package/dist/scanner.mjs.map +1 -1
- package/dist/shared.d.mts +0 -12
- package/dist/shared.d.ts +0 -12
- package/dist/shared.js +481 -299
- package/dist/shared.js.map +1 -1
- package/dist/shared.mjs +304 -133
- package/dist/shared.mjs.map +1 -1
- package/dist/storybook-addon.js +40 -10
- package/dist/storybook-addon.js.map +1 -1
- package/dist/storybook-addon.mjs +8 -3
- package/dist/storybook-addon.mjs.map +1 -1
- package/dist/svelte.js +95 -64
- package/dist/svelte.js.map +1 -1
- package/dist/svelte.mjs +37 -14
- package/dist/svelte.mjs.map +1 -1
- package/dist/syntax.js +69 -37
- package/dist/syntax.js.map +1 -1
- package/dist/syntax.mjs +8 -7
- package/dist/syntax.mjs.map +1 -1
- package/dist/testing.js +56 -18
- package/dist/testing.js.map +1 -1
- package/dist/testing.mjs +16 -3
- package/dist/testing.mjs.map +1 -1
- package/dist/theme.js +133 -74
- package/dist/theme.js.map +1 -1
- package/dist/theme.mjs +45 -14
- package/dist/theme.mjs.map +1 -1
- package/dist/turbopackLoader.js +156 -115
- package/dist/turbopackLoader.js.map +1 -1
- package/dist/turbopackLoader.mjs +135 -82
- package/dist/turbopackLoader.mjs.map +1 -1
- package/dist/tw.js +584 -423
- package/dist/tw.js.map +1 -1
- package/dist/tw.mjs +498 -311
- package/dist/tw.mjs.map +1 -1
- package/dist/vite.js +599 -450
- package/dist/vite.js.map +1 -1
- package/dist/vite.mjs +484 -332
- package/dist/vite.mjs.map +1 -1
- package/dist/vue.js +102 -70
- package/dist/vue.js.map +1 -1
- package/dist/vue.mjs +39 -15
- package/dist/vue.mjs.map +1 -1
- package/dist/webpackLoader.js +112 -77
- package/dist/webpackLoader.js.map +1 -1
- package/dist/webpackLoader.mjs +52 -18
- package/dist/webpackLoader.mjs.map +1 -1
- package/native/tailwind-styled-native.linux-x64-gnu.node +0 -0
- package/native/tailwind-styled-native.node +0 -0
- package/package.json +3 -1
package/dist/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,8 +205,11 @@ 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
|
-
_require =
|
|
210
|
+
_require = createRequire(
|
|
211
|
+
typeof __require !== "undefined" ? typeof __filename !== "undefined" ? `file://${__filename}` : "file://unknown" : import.meta.url
|
|
212
|
+
);
|
|
214
213
|
PLATFORM_MAP = {
|
|
215
214
|
"linux-x64": ["@tailwind-styled/native-linux-x64-gnu", "@tailwind-styled/native-linux-x64"],
|
|
216
215
|
"linux-arm64": ["@tailwind-styled/native-linux-arm64-gnu", "@tailwind-styled/native-linux-arm64"],
|
|
@@ -226,6 +225,7 @@ var init_native_resolution = __esm({
|
|
|
226
225
|
var _loadNative, log, NATIVE_UNAVAILABLE_MESSAGE, nativeBridge, bridgeLoadAttempted, bridgeLoadError, isValidNativeBridge, getNativeBridge, resetNativeBridgeCache, adaptNativeResult;
|
|
227
226
|
var init_nativeBridge = __esm({
|
|
228
227
|
"packages/domain/compiler/src/nativeBridge.ts"() {
|
|
228
|
+
"use strict";
|
|
229
229
|
init_src2();
|
|
230
230
|
_loadNative = (path12) => __require(path12);
|
|
231
231
|
log = (...args) => {
|
|
@@ -383,6 +383,7 @@ function resetCacheStats() {
|
|
|
383
383
|
}
|
|
384
384
|
var init_cssGeneratorNative = __esm({
|
|
385
385
|
"packages/domain/compiler/src/compiler/cssGeneratorNative.ts"() {
|
|
386
|
+
"use strict";
|
|
386
387
|
init_nativeBridge();
|
|
387
388
|
}
|
|
388
389
|
});
|
|
@@ -455,6 +456,7 @@ function atomicRegistrySize() {
|
|
|
455
456
|
}
|
|
456
457
|
var init_compilationNative = __esm({
|
|
457
458
|
"packages/domain/compiler/src/compiler/compilationNative.ts"() {
|
|
459
|
+
"use strict";
|
|
458
460
|
init_nativeBridge();
|
|
459
461
|
}
|
|
460
462
|
});
|
|
@@ -598,6 +600,7 @@ function twMergeRaw(classLists) {
|
|
|
598
600
|
}
|
|
599
601
|
var init_cssCompilationNative = __esm({
|
|
600
602
|
"packages/domain/compiler/src/compiler/cssCompilationNative.ts"() {
|
|
603
|
+
"use strict";
|
|
601
604
|
init_nativeBridge();
|
|
602
605
|
}
|
|
603
606
|
});
|
|
@@ -697,6 +700,7 @@ function idRegistryImport(importedData) {
|
|
|
697
700
|
}
|
|
698
701
|
var init_idRegistryNative = __esm({
|
|
699
702
|
"packages/domain/compiler/src/compiler/idRegistryNative.ts"() {
|
|
703
|
+
"use strict";
|
|
700
704
|
init_nativeBridge();
|
|
701
705
|
}
|
|
702
706
|
});
|
|
@@ -838,9 +842,13 @@ function scanFilesBatchNative(filesJson) {
|
|
|
838
842
|
}
|
|
839
843
|
var init_streamingNative = __esm({
|
|
840
844
|
"packages/domain/compiler/src/compiler/streamingNative.ts"() {
|
|
845
|
+
"use strict";
|
|
841
846
|
init_nativeBridge();
|
|
842
847
|
}
|
|
843
848
|
});
|
|
849
|
+
|
|
850
|
+
// packages/domain/compiler/src/tailwindEngine.ts
|
|
851
|
+
import { createRequire as createRequire2 } from "module";
|
|
844
852
|
function loadTailwindEngine() {
|
|
845
853
|
if (_twEngine) return _twEngine;
|
|
846
854
|
if (_twEngineError) throw _twEngineError;
|
|
@@ -860,10 +868,10 @@ async function generateRawCss(classes, cssEntryContent, root) {
|
|
|
860
868
|
if (classes.length === 0) return "";
|
|
861
869
|
const tw = loadTailwindEngine();
|
|
862
870
|
const input = cssEntryContent ?? "@import 'tailwindcss';";
|
|
863
|
-
const { readFileSync, existsSync: existsSync3 } = await import(
|
|
864
|
-
const { dirname, resolve: resolve2 } = await import(
|
|
871
|
+
const { readFileSync, existsSync: existsSync3 } = await import("fs");
|
|
872
|
+
const { dirname, resolve: resolve2 } = await import("path");
|
|
865
873
|
const projectRoot = root ?? process.cwd();
|
|
866
|
-
const req =
|
|
874
|
+
const req = createRequire2(resolve2(projectRoot, "package.json"));
|
|
867
875
|
const loadStylesheet = async (id, base) => {
|
|
868
876
|
try {
|
|
869
877
|
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 +891,14 @@ async function generateRawCss(classes, cssEntryContent, root) {
|
|
|
883
891
|
const compiler = await Promise.resolve(tw.compile(input, { loadStylesheet }));
|
|
884
892
|
return compiler.build(classes);
|
|
885
893
|
}
|
|
886
|
-
var require2, _twEngine, _twEngineError;
|
|
894
|
+
var require2, MAX_CACHE_MEMORY, _twEngine, _twEngineError;
|
|
887
895
|
var init_tailwindEngine = __esm({
|
|
888
896
|
"packages/domain/compiler/src/tailwindEngine.ts"() {
|
|
889
|
-
|
|
897
|
+
"use strict";
|
|
898
|
+
require2 = createRequire2(
|
|
899
|
+
typeof __filename !== "undefined" ? `file://${__filename}` : typeof import.meta !== "undefined" && import.meta.url ? import.meta.url : "file://unknown"
|
|
900
|
+
);
|
|
901
|
+
MAX_CACHE_MEMORY = 256 * 1024;
|
|
890
902
|
_twEngine = null;
|
|
891
903
|
_twEngineError = null;
|
|
892
904
|
}
|
|
@@ -901,6 +913,7 @@ __export(tailwindEngine_exports, {
|
|
|
901
913
|
runCssPipeline: () => runCssPipeline,
|
|
902
914
|
runCssPipelineSync: () => runCssPipelineSync
|
|
903
915
|
});
|
|
916
|
+
import { createRequire as createRequire3 } from "module";
|
|
904
917
|
function _getCacheKey(classes, minify, cssEntry, root) {
|
|
905
918
|
const sorted = [...classes].sort().join(",");
|
|
906
919
|
const flags = `${minify ? "1" : "0"}${cssEntry ? "1" : "0"}${root ? "1" : "0"}`;
|
|
@@ -1067,24 +1080,29 @@ function processTailwindCssWithTargets(css, targets) {
|
|
|
1067
1080
|
}
|
|
1068
1081
|
return result.css;
|
|
1069
1082
|
}
|
|
1070
|
-
var _cssCache, _cacheHits, _cacheMisses, MAX_CACHE_SIZE;
|
|
1083
|
+
var require3, _cssCache, _cacheHits, _cacheMisses, MAX_CACHE_SIZE, MAX_CACHE_MEMORY2;
|
|
1071
1084
|
var init_tailwindEngine2 = __esm({
|
|
1072
1085
|
"packages/domain/compiler/src/compiler/tailwindEngine.ts"() {
|
|
1086
|
+
"use strict";
|
|
1073
1087
|
init_nativeBridge();
|
|
1074
1088
|
init_cssGeneratorNative();
|
|
1075
1089
|
init_cssCompilationNative();
|
|
1076
1090
|
init_tailwindEngine();
|
|
1077
|
-
|
|
1091
|
+
require3 = createRequire3(
|
|
1092
|
+
typeof __filename !== "undefined" ? `file://${__filename}` : typeof import.meta !== "undefined" && import.meta.url ? import.meta.url : "file://unknown"
|
|
1093
|
+
);
|
|
1078
1094
|
_cssCache = /* @__PURE__ */ new Map();
|
|
1079
1095
|
_cacheHits = 0;
|
|
1080
1096
|
_cacheMisses = 0;
|
|
1081
1097
|
MAX_CACHE_SIZE = 100;
|
|
1098
|
+
MAX_CACHE_MEMORY2 = 256 * 1024;
|
|
1082
1099
|
}
|
|
1083
1100
|
});
|
|
1084
1101
|
|
|
1085
1102
|
// packages/domain/compiler/src/compiler/index.ts
|
|
1086
1103
|
var init_compiler = __esm({
|
|
1087
1104
|
"packages/domain/compiler/src/compiler/index.ts"() {
|
|
1105
|
+
"use strict";
|
|
1088
1106
|
init_cssGeneratorNative();
|
|
1089
1107
|
init_compilationNative();
|
|
1090
1108
|
init_cssCompilationNative();
|
|
@@ -1098,6 +1116,7 @@ var init_compiler = __esm({
|
|
|
1098
1116
|
var parseClasses, parseClass, extractAllClasses, extractClassesFromSource, astExtractClasses, normalizeClasses, mergeClassesStatic, normalizeAndDedupClasses, extractComponentUsage, batchExtractClasses, checkAgainstSafelist, diffClassLists;
|
|
1099
1117
|
var init_parser = __esm({
|
|
1100
1118
|
"packages/domain/compiler/src/parser/index.ts"() {
|
|
1119
|
+
"use strict";
|
|
1101
1120
|
init_nativeBridge();
|
|
1102
1121
|
parseClasses = (raw) => {
|
|
1103
1122
|
const native = getNativeBridge();
|
|
@@ -1276,6 +1295,7 @@ function resetMemoryStats() {
|
|
|
1276
1295
|
}
|
|
1277
1296
|
var init_analyzerNative = __esm({
|
|
1278
1297
|
"packages/domain/compiler/src/analyzer/analyzerNative.ts"() {
|
|
1298
|
+
"use strict";
|
|
1279
1299
|
init_nativeBridge();
|
|
1280
1300
|
}
|
|
1281
1301
|
});
|
|
@@ -1369,6 +1389,7 @@ function resolveSimpleVariants(configJson) {
|
|
|
1369
1389
|
}
|
|
1370
1390
|
var init_themeResolutionNative = __esm({
|
|
1371
1391
|
"packages/domain/compiler/src/analyzer/themeResolutionNative.ts"() {
|
|
1392
|
+
"use strict";
|
|
1372
1393
|
init_nativeBridge();
|
|
1373
1394
|
}
|
|
1374
1395
|
});
|
|
@@ -1416,6 +1437,7 @@ function generateSubComponentTypes(root, outputPath) {
|
|
|
1416
1437
|
}
|
|
1417
1438
|
var init_scannerNative = __esm({
|
|
1418
1439
|
"packages/domain/compiler/src/analyzer/scannerNative.ts"() {
|
|
1440
|
+
"use strict";
|
|
1419
1441
|
init_nativeBridge();
|
|
1420
1442
|
}
|
|
1421
1443
|
});
|
|
@@ -1423,6 +1445,7 @@ var init_scannerNative = __esm({
|
|
|
1423
1445
|
// packages/domain/compiler/src/analyzer/index.ts
|
|
1424
1446
|
var init_analyzer = __esm({
|
|
1425
1447
|
"packages/domain/compiler/src/analyzer/index.ts"() {
|
|
1448
|
+
"use strict";
|
|
1426
1449
|
init_analyzerNative();
|
|
1427
1450
|
init_themeResolutionNative();
|
|
1428
1451
|
init_scannerNative();
|
|
@@ -1611,6 +1634,7 @@ function resetResolverPoolStats() {
|
|
|
1611
1634
|
}
|
|
1612
1635
|
var init_cacheNative = __esm({
|
|
1613
1636
|
"packages/domain/compiler/src/cache/cacheNative.ts"() {
|
|
1637
|
+
"use strict";
|
|
1614
1638
|
init_nativeBridge();
|
|
1615
1639
|
}
|
|
1616
1640
|
});
|
|
@@ -1618,6 +1642,7 @@ var init_cacheNative = __esm({
|
|
|
1618
1642
|
// packages/domain/compiler/src/cache/index.ts
|
|
1619
1643
|
var init_cache = __esm({
|
|
1620
1644
|
"packages/domain/compiler/src/cache/index.ts"() {
|
|
1645
|
+
"use strict";
|
|
1621
1646
|
init_cacheNative();
|
|
1622
1647
|
}
|
|
1623
1648
|
});
|
|
@@ -1866,6 +1891,7 @@ function redisDiagnose() {
|
|
|
1866
1891
|
}
|
|
1867
1892
|
var init_redisNative = __esm({
|
|
1868
1893
|
"packages/domain/compiler/src/redis/redisNative.ts"() {
|
|
1894
|
+
"use strict";
|
|
1869
1895
|
init_nativeBridge();
|
|
1870
1896
|
}
|
|
1871
1897
|
});
|
|
@@ -1873,6 +1899,7 @@ var init_redisNative = __esm({
|
|
|
1873
1899
|
// packages/domain/compiler/src/redis/index.ts
|
|
1874
1900
|
var init_redis = __esm({
|
|
1875
1901
|
"packages/domain/compiler/src/redis/index.ts"() {
|
|
1902
|
+
"use strict";
|
|
1876
1903
|
init_redisNative();
|
|
1877
1904
|
}
|
|
1878
1905
|
});
|
|
@@ -2011,6 +2038,7 @@ function getCompilerDiagnostics() {
|
|
|
2011
2038
|
}
|
|
2012
2039
|
var init_watchSystemNative = __esm({
|
|
2013
2040
|
"packages/domain/compiler/src/watch/watchSystemNative.ts"() {
|
|
2041
|
+
"use strict";
|
|
2014
2042
|
init_nativeBridge();
|
|
2015
2043
|
}
|
|
2016
2044
|
});
|
|
@@ -2018,6 +2046,7 @@ var init_watchSystemNative = __esm({
|
|
|
2018
2046
|
// packages/domain/compiler/src/watch/index.ts
|
|
2019
2047
|
var init_watch = __esm({
|
|
2020
2048
|
"packages/domain/compiler/src/watch/index.ts"() {
|
|
2049
|
+
"use strict";
|
|
2021
2050
|
init_watchSystemNative();
|
|
2022
2051
|
}
|
|
2023
2052
|
});
|
|
@@ -2245,6 +2274,9 @@ __export(src_exports, {
|
|
|
2245
2274
|
watchRemovePattern: () => watchRemovePattern,
|
|
2246
2275
|
watchResume: () => watchResume
|
|
2247
2276
|
});
|
|
2277
|
+
import fs2 from "fs";
|
|
2278
|
+
import path2 from "path";
|
|
2279
|
+
import { createRequire as createRequire4 } from "module";
|
|
2248
2280
|
function _layoutClassesToCss(classes) {
|
|
2249
2281
|
const native = getNativeBridge();
|
|
2250
2282
|
if (!native?.layoutClassesToCss) {
|
|
@@ -2282,6 +2314,7 @@ function extractContainerCssFromSource(source) {
|
|
|
2282
2314
|
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
2315
|
var init_src = __esm({
|
|
2284
2316
|
"packages/domain/compiler/src/index.ts"() {
|
|
2317
|
+
"use strict";
|
|
2285
2318
|
init_nativeBridge();
|
|
2286
2319
|
init_compiler();
|
|
2287
2320
|
init_parser();
|
|
@@ -2289,7 +2322,9 @@ var init_src = __esm({
|
|
|
2289
2322
|
init_cache();
|
|
2290
2323
|
init_redis();
|
|
2291
2324
|
init_watch();
|
|
2292
|
-
_require2 =
|
|
2325
|
+
_require2 = createRequire4(
|
|
2326
|
+
typeof __require !== "undefined" ? typeof __filename !== "undefined" ? `file://${__filename}` : "file://unknown" : import.meta.url
|
|
2327
|
+
);
|
|
2293
2328
|
transformSource = (source, opts) => {
|
|
2294
2329
|
const native = getNativeBridge();
|
|
2295
2330
|
if (!native?.transformSource) {
|
|
@@ -2381,7 +2416,7 @@ var init_src = __esm({
|
|
|
2381
2416
|
};
|
|
2382
2417
|
scanProjectUsage = (dirs, cwd) => {
|
|
2383
2418
|
const { batchExtractClasses: batchExtractClasses2 } = _require2("./parser");
|
|
2384
|
-
const files = dirs.map((dir) =>
|
|
2419
|
+
const files = dirs.map((dir) => path2.resolve(cwd, dir));
|
|
2385
2420
|
const results = batchExtractClasses2(files) || [];
|
|
2386
2421
|
const combined = {};
|
|
2387
2422
|
for (const result of results) {
|
|
@@ -2398,13 +2433,13 @@ var init_src = __esm({
|
|
|
2398
2433
|
const classes = scanProjectUsage(scanDirs, cwd || process.cwd());
|
|
2399
2434
|
const allClasses = Object.keys(classes).sort();
|
|
2400
2435
|
if (outputPath) {
|
|
2401
|
-
|
|
2436
|
+
fs2.writeFileSync(outputPath, JSON.stringify(allClasses, null, 2));
|
|
2402
2437
|
}
|
|
2403
2438
|
return allClasses;
|
|
2404
2439
|
};
|
|
2405
2440
|
loadSafelist = (safelistPath) => {
|
|
2406
2441
|
try {
|
|
2407
|
-
const content =
|
|
2442
|
+
const content = fs2.readFileSync(safelistPath, "utf-8");
|
|
2408
2443
|
return JSON.parse(content);
|
|
2409
2444
|
} catch {
|
|
2410
2445
|
return [];
|
|
@@ -2418,8 +2453,8 @@ var init_src = __esm({
|
|
|
2418
2453
|
"tailwind.config.cjs"
|
|
2419
2454
|
];
|
|
2420
2455
|
for (const file of configFiles) {
|
|
2421
|
-
const fullPath =
|
|
2422
|
-
if (
|
|
2456
|
+
const fullPath = path2.join(cwd, file);
|
|
2457
|
+
if (fs2.existsSync(fullPath)) {
|
|
2423
2458
|
const mod = __require(fullPath);
|
|
2424
2459
|
return mod.default || mod;
|
|
2425
2460
|
}
|
|
@@ -2429,9 +2464,9 @@ var init_src = __esm({
|
|
|
2429
2464
|
getContentPaths = (cwd = process.cwd()) => {
|
|
2430
2465
|
return {
|
|
2431
2466
|
content: [
|
|
2432
|
-
|
|
2433
|
-
|
|
2434
|
-
|
|
2467
|
+
path2.join(cwd, "src/**/*.{js,ts,jsx,tsx}"),
|
|
2468
|
+
path2.join(cwd, "app/**/*.{js,ts,jsx,tsx}"),
|
|
2469
|
+
path2.join(cwd, "pages/**/*.{js,ts,jsx,tsx}")
|
|
2435
2470
|
]
|
|
2436
2471
|
};
|
|
2437
2472
|
};
|
|
@@ -2850,6 +2885,7 @@ __export(internal_exports, {
|
|
|
2850
2885
|
});
|
|
2851
2886
|
var init_internal = __esm({
|
|
2852
2887
|
"packages/domain/compiler/src/internal.ts"() {
|
|
2888
|
+
"use strict";
|
|
2853
2889
|
init_src();
|
|
2854
2890
|
init_tailwindEngine2();
|
|
2855
2891
|
init_compiler();
|
|
@@ -2860,6 +2896,10 @@ var init_internal = __esm({
|
|
|
2860
2896
|
init_watch();
|
|
2861
2897
|
}
|
|
2862
2898
|
});
|
|
2899
|
+
|
|
2900
|
+
// packages/domain/shared/src/staticStateExtractor.ts
|
|
2901
|
+
import fs3 from "fs";
|
|
2902
|
+
import path3 from "path";
|
|
2863
2903
|
function getNative() {
|
|
2864
2904
|
if (_native) return _native;
|
|
2865
2905
|
try {
|
|
@@ -2889,17 +2929,17 @@ function getNative() {
|
|
|
2889
2929
|
function* walkSourceFiles(dir) {
|
|
2890
2930
|
let entries;
|
|
2891
2931
|
try {
|
|
2892
|
-
entries =
|
|
2932
|
+
entries = fs3.readdirSync(dir, { withFileTypes: true });
|
|
2893
2933
|
} catch {
|
|
2894
2934
|
return;
|
|
2895
2935
|
}
|
|
2896
2936
|
for (const entry of entries) {
|
|
2897
|
-
const fullPath =
|
|
2937
|
+
const fullPath = path3.join(dir, entry.name);
|
|
2898
2938
|
if (entry.isDirectory()) {
|
|
2899
2939
|
if (IGNORE_PATTERNS.some((p) => entry.name === p || entry.name.startsWith(p))) continue;
|
|
2900
2940
|
yield* walkSourceFiles(fullPath);
|
|
2901
2941
|
} else if (entry.isFile()) {
|
|
2902
|
-
const ext =
|
|
2942
|
+
const ext = path3.extname(entry.name);
|
|
2903
2943
|
if (SOURCE_EXTENSIONS.has(ext)) yield fullPath;
|
|
2904
2944
|
}
|
|
2905
2945
|
}
|
|
@@ -2963,7 +3003,7 @@ function extractStaticStateCss(srcDir, options = {}) {
|
|
|
2963
3003
|
allConfigs.push(...configs);
|
|
2964
3004
|
if (verbose) {
|
|
2965
3005
|
process.stderr.write(
|
|
2966
|
-
`[tw:static-state] ${
|
|
3006
|
+
`[tw:static-state] ${path3.relative(srcDir, filePath)}: ${configs.length} komponen
|
|
2967
3007
|
`
|
|
2968
3008
|
);
|
|
2969
3009
|
}
|
|
@@ -2974,7 +3014,7 @@ function extractStaticStateCss(srcDir, options = {}) {
|
|
|
2974
3014
|
if (filesScanned >= maxFiles) break;
|
|
2975
3015
|
let source;
|
|
2976
3016
|
try {
|
|
2977
|
-
source =
|
|
3017
|
+
source = fs3.readFileSync(filePath, "utf-8");
|
|
2978
3018
|
} catch {
|
|
2979
3019
|
continue;
|
|
2980
3020
|
}
|
|
@@ -2987,7 +3027,7 @@ function extractStaticStateCss(srcDir, options = {}) {
|
|
|
2987
3027
|
allConfigs.push(...configs);
|
|
2988
3028
|
if (verbose) {
|
|
2989
3029
|
process.stderr.write(
|
|
2990
|
-
`[tw:static-state] ${
|
|
3030
|
+
`[tw:static-state] ${path3.relative(srcDir, filePath)}: ${configs.length} komponen
|
|
2991
3031
|
`
|
|
2992
3032
|
);
|
|
2993
3033
|
}
|
|
@@ -3081,12 +3121,12 @@ function appendStaticStateCssToSafelist(srcDir, safelistPath, options = {}) {
|
|
|
3081
3121
|
resolvedCss: options.resolvedCss || ""
|
|
3082
3122
|
// ← ensure always passed
|
|
3083
3123
|
});
|
|
3084
|
-
const twClassesDir =
|
|
3085
|
-
|
|
3086
|
-
const stateFilePath =
|
|
3124
|
+
const twClassesDir = path3.join(path3.dirname(safelistPath), "tw-classes");
|
|
3125
|
+
fs3.mkdirSync(twClassesDir, { recursive: true });
|
|
3126
|
+
const stateFilePath = path3.join(twClassesDir, TW_STATE_STATIC_FILENAME);
|
|
3087
3127
|
if (result.rulesGenerated === 0) {
|
|
3088
3128
|
try {
|
|
3089
|
-
|
|
3129
|
+
fs3.writeFileSync(
|
|
3090
3130
|
stateFilePath,
|
|
3091
3131
|
"/* tw-state-static.css \u2014 tidak ada state rules yang di-generate */\n",
|
|
3092
3132
|
"utf-8"
|
|
@@ -3096,7 +3136,7 @@ function appendStaticStateCssToSafelist(srcDir, safelistPath, options = {}) {
|
|
|
3096
3136
|
return `[tw:static-state] tidak ada state rules yang di-generate (${result.filesScanned} files di-scan)`;
|
|
3097
3137
|
}
|
|
3098
3138
|
try {
|
|
3099
|
-
|
|
3139
|
+
fs3.writeFileSync(stateFilePath, result.generatedCss, "utf-8");
|
|
3100
3140
|
return [
|
|
3101
3141
|
`[tw:static-state] ${result.rulesGenerated} static state rules di-generate`,
|
|
3102
3142
|
` \u2192 ${result.filesScanned} files scanned, ${result.filesWithStates} dengan states`,
|
|
@@ -3111,12 +3151,17 @@ function appendStaticStateCssToSafelist(srcDir, safelistPath, options = {}) {
|
|
|
3111
3151
|
var SOURCE_EXTENSIONS, IGNORE_PATTERNS, _native, TW_STATE_STATIC_FILENAME;
|
|
3112
3152
|
var init_staticStateExtractor = __esm({
|
|
3113
3153
|
"packages/domain/shared/src/staticStateExtractor.ts"() {
|
|
3154
|
+
"use strict";
|
|
3114
3155
|
SOURCE_EXTENSIONS = /* @__PURE__ */ new Set([".ts", ".tsx", ".js", ".jsx", ".mts", ".mjs"]);
|
|
3115
3156
|
IGNORE_PATTERNS = ["node_modules", ".next", "dist", "build", ".git", "coverage", "__tests__"];
|
|
3116
3157
|
_native = null;
|
|
3117
3158
|
TW_STATE_STATIC_FILENAME = "_tw-state-static.css";
|
|
3118
3159
|
}
|
|
3119
3160
|
});
|
|
3161
|
+
|
|
3162
|
+
// packages/domain/shared/src/logger.ts
|
|
3163
|
+
import fs4 from "fs";
|
|
3164
|
+
import path4 from "path";
|
|
3120
3165
|
function getEnvLevel() {
|
|
3121
3166
|
const env = process.env.TWS_LOG_LEVEL?.toLowerCase();
|
|
3122
3167
|
if (env && env in LEVELS) return env;
|
|
@@ -3126,8 +3171,8 @@ function setGlobalLogFile(filePath) {
|
|
|
3126
3171
|
_globalLogFile = filePath;
|
|
3127
3172
|
_logFileInitialized = false;
|
|
3128
3173
|
try {
|
|
3129
|
-
|
|
3130
|
-
|
|
3174
|
+
fs4.mkdirSync(path4.dirname(filePath), { recursive: true });
|
|
3175
|
+
fs4.writeFileSync(
|
|
3131
3176
|
filePath,
|
|
3132
3177
|
`# tailwind-styled build log \u2014 ${(/* @__PURE__ */ new Date()).toISOString()}
|
|
3133
3178
|
`,
|
|
@@ -3140,13 +3185,13 @@ function setGlobalLogFile(filePath) {
|
|
|
3140
3185
|
function writeToFile(line) {
|
|
3141
3186
|
if (!_globalLogFile || !_logFileInitialized) return;
|
|
3142
3187
|
try {
|
|
3143
|
-
|
|
3188
|
+
fs4.appendFileSync(_globalLogFile, line);
|
|
3144
3189
|
} catch {
|
|
3145
3190
|
}
|
|
3146
3191
|
}
|
|
3147
3192
|
function createLogger(prefix, level) {
|
|
3148
3193
|
const loggerState = {
|
|
3149
|
-
currentLevel: getEnvLevel(),
|
|
3194
|
+
currentLevel: level ?? getEnvLevel(),
|
|
3150
3195
|
setLevel(l) {
|
|
3151
3196
|
this.currentLevel = l;
|
|
3152
3197
|
}
|
|
@@ -3167,15 +3212,23 @@ function createLogger(prefix, level) {
|
|
|
3167
3212
|
setLogFile: (filePath) => setGlobalLogFile(filePath)
|
|
3168
3213
|
};
|
|
3169
3214
|
}
|
|
3170
|
-
var LEVELS, _globalLogFile, _logFileInitialized;
|
|
3215
|
+
var LEVELS, _globalLogFile, _logFileInitialized, logger;
|
|
3171
3216
|
var init_logger = __esm({
|
|
3172
3217
|
"packages/domain/shared/src/logger.ts"() {
|
|
3218
|
+
"use strict";
|
|
3173
3219
|
LEVELS = { silent: 0, error: 1, warn: 2, info: 3, debug: 4 };
|
|
3174
3220
|
_globalLogFile = null;
|
|
3175
3221
|
_logFileInitialized = false;
|
|
3176
|
-
createLogger("tailwind-styled");
|
|
3222
|
+
logger = createLogger("tailwind-styled");
|
|
3177
3223
|
}
|
|
3178
3224
|
});
|
|
3225
|
+
|
|
3226
|
+
// packages/domain/shared/src/index.ts
|
|
3227
|
+
import { createHash } from "crypto";
|
|
3228
|
+
import fs5 from "fs";
|
|
3229
|
+
import path5 from "path";
|
|
3230
|
+
import { fileURLToPath } from "url";
|
|
3231
|
+
import { createRequire as createRequire5 } from "module";
|
|
3179
3232
|
function createLogger2(namespace) {
|
|
3180
3233
|
const prefix = `[${namespace}]`;
|
|
3181
3234
|
return {
|
|
@@ -3198,7 +3251,7 @@ function createLogger2(namespace) {
|
|
|
3198
3251
|
};
|
|
3199
3252
|
}
|
|
3200
3253
|
function createDebugLogger(namespace, label) {
|
|
3201
|
-
const prefix = `[${namespace}]`;
|
|
3254
|
+
const prefix = label ? `[${namespace}:${label}]` : `[${namespace}]`;
|
|
3202
3255
|
return (msg) => {
|
|
3203
3256
|
if (process.env.DEBUG?.includes(namespace) || process.env.TW_DEBUG) {
|
|
3204
3257
|
console.debug(prefix, msg);
|
|
@@ -3215,9 +3268,9 @@ function loadNativeBinding(options) {
|
|
|
3215
3268
|
const { runtimeDir, candidates, isValid } = options;
|
|
3216
3269
|
const loadErrors = [];
|
|
3217
3270
|
for (const candidate of candidates) {
|
|
3218
|
-
const candidatePath =
|
|
3271
|
+
const candidatePath = path5.resolve(runtimeDir, candidate);
|
|
3219
3272
|
try {
|
|
3220
|
-
if (!
|
|
3273
|
+
if (!fs5.existsSync(candidatePath) && !fs5.existsSync(candidatePath + ".node")) {
|
|
3221
3274
|
continue;
|
|
3222
3275
|
}
|
|
3223
3276
|
const mod = requireNativeModule(candidatePath);
|
|
@@ -3249,9 +3302,9 @@ function resolveNativeBindingCandidates(options) {
|
|
|
3249
3302
|
}
|
|
3250
3303
|
}
|
|
3251
3304
|
if (!includeDefaultCandidates) return candidates;
|
|
3252
|
-
if (
|
|
3305
|
+
if (fs5.existsSync(runtimeDir)) {
|
|
3253
3306
|
try {
|
|
3254
|
-
for (const entry of
|
|
3307
|
+
for (const entry of fs5.readdirSync(runtimeDir)) {
|
|
3255
3308
|
if (entry.endsWith(".node")) candidates.push(entry);
|
|
3256
3309
|
}
|
|
3257
3310
|
} catch {
|
|
@@ -3260,21 +3313,22 @@ function resolveNativeBindingCandidates(options) {
|
|
|
3260
3313
|
const BINARY_NAMES = ["tailwind-styled-native", "tailwind_styled_parser"];
|
|
3261
3314
|
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
3315
|
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(
|
|
3316
|
+
candidates.push(path5.resolve(runtimeDir, `${bin}.node`));
|
|
3317
|
+
candidates.push(path5.resolve(runtimeDir, `${bin}.${napiPlatform}.node`));
|
|
3318
|
+
candidates.push(path5.resolve(runtimeDir, "..", "native", `${bin}.node`));
|
|
3319
|
+
candidates.push(path5.resolve(runtimeDir, "..", "native", `${bin}.${napiPlatform}.node`));
|
|
3320
|
+
candidates.push(path5.resolve(process.cwd(), "native", `${bin}.node`));
|
|
3321
|
+
candidates.push(path5.resolve(process.cwd(), "native", `${bin}.${napiPlatform}.node`));
|
|
3322
|
+
candidates.push(path5.resolve(runtimeDir, "..", "..", "..", "..", "native", `${bin}.node`));
|
|
3323
|
+
candidates.push(path5.resolve(runtimeDir, "..", "..", "..", "..", "native", `${bin}.${napiPlatform}.node`));
|
|
3324
|
+
candidates.push(path5.resolve(runtimeDir, "..", "..", "..", "native", `${bin}.node`));
|
|
3272
3325
|
}
|
|
3273
3326
|
return Array.from(new Set(candidates));
|
|
3274
3327
|
}
|
|
3275
3328
|
function resolveRuntimeDir(dir, importMetaUrl) {
|
|
3329
|
+
if (dir) return path5.resolve(dir);
|
|
3276
3330
|
try {
|
|
3277
|
-
return
|
|
3331
|
+
return path5.dirname(fileURLToPath(importMetaUrl));
|
|
3278
3332
|
} catch {
|
|
3279
3333
|
return process.cwd();
|
|
3280
3334
|
}
|
|
@@ -3282,6 +3336,7 @@ function resolveRuntimeDir(dir, importMetaUrl) {
|
|
|
3282
3336
|
var TwError, _require3;
|
|
3283
3337
|
var init_src2 = __esm({
|
|
3284
3338
|
"packages/domain/shared/src/index.ts"() {
|
|
3339
|
+
"use strict";
|
|
3285
3340
|
init_workerResolver();
|
|
3286
3341
|
init_native_resolution();
|
|
3287
3342
|
init_staticStateExtractor();
|
|
@@ -3338,7 +3393,9 @@ var init_src2 = __esm({
|
|
|
3338
3393
|
return `[${this.source.toUpperCase()}:${this.code}] ${this.message}`;
|
|
3339
3394
|
}
|
|
3340
3395
|
};
|
|
3341
|
-
_require3 =
|
|
3396
|
+
_require3 = createRequire5(
|
|
3397
|
+
typeof __filename !== "undefined" ? `file://${__filename}` : import.meta.url ?? "file://unknown"
|
|
3398
|
+
);
|
|
3342
3399
|
}
|
|
3343
3400
|
});
|
|
3344
3401
|
|
|
@@ -3371,12 +3428,14 @@ __export(native_bridge_exports, {
|
|
|
3371
3428
|
startWatchNative: () => startWatchNative,
|
|
3372
3429
|
stopWatchNative: () => stopWatchNative
|
|
3373
3430
|
});
|
|
3431
|
+
import path6 from "path";
|
|
3432
|
+
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
3374
3433
|
function getDirname() {
|
|
3375
3434
|
if (typeof __dirname !== "undefined") {
|
|
3376
3435
|
return __dirname;
|
|
3377
3436
|
}
|
|
3378
3437
|
if (typeof import.meta !== "undefined" && import.meta.url) {
|
|
3379
|
-
return
|
|
3438
|
+
return path6.dirname(fileURLToPath2(import.meta.url));
|
|
3380
3439
|
}
|
|
3381
3440
|
return process.cwd();
|
|
3382
3441
|
}
|
|
@@ -3584,6 +3643,7 @@ function hasNativeWatchBinding() {
|
|
|
3584
3643
|
var log2, isValidScannerBinding, createScannerBridgeLoader, scannerBridgeLoader, scannerGetBinding, resetScannerBridgeCache;
|
|
3585
3644
|
var init_native_bridge = __esm({
|
|
3586
3645
|
"packages/domain/scanner/src/native-bridge.ts"() {
|
|
3646
|
+
"use strict";
|
|
3587
3647
|
init_src2();
|
|
3588
3648
|
log2 = createDebugLogger("scanner:native");
|
|
3589
3649
|
isValidScannerBinding = (module) => {
|
|
@@ -3664,6 +3724,9 @@ var init_native_bridge = __esm({
|
|
|
3664
3724
|
resetScannerBridgeCache = scannerBridgeLoader.reset;
|
|
3665
3725
|
}
|
|
3666
3726
|
});
|
|
3727
|
+
|
|
3728
|
+
// packages/presentation/next/src/schemas.ts
|
|
3729
|
+
import { z } from "zod";
|
|
3667
3730
|
var formatIssues = (error) => error.issues.map((issue) => {
|
|
3668
3731
|
const p = issue.path.length > 0 ? issue.path.join(".") : "<root>";
|
|
3669
3732
|
return `${p}: ${issue.message}`;
|
|
@@ -3688,19 +3751,30 @@ var parseNextAdapterOptions = (options) => parseWithSchema(NextAdapterOptionsSch
|
|
|
3688
3751
|
|
|
3689
3752
|
// packages/presentation/next/src/withTailwindStyled.ts
|
|
3690
3753
|
init_src2();
|
|
3754
|
+
import fs10 from "fs";
|
|
3755
|
+
import { createRequire as createRequire7 } from "module";
|
|
3756
|
+
import path11 from "path";
|
|
3691
3757
|
|
|
3692
3758
|
// packages/domain/scanner/src/index.ts
|
|
3693
3759
|
init_src2();
|
|
3760
|
+
import fs7 from "fs";
|
|
3761
|
+
import { createRequire as createRequire6 } from "module";
|
|
3762
|
+
import path8 from "path";
|
|
3763
|
+
import { fileURLToPath as fileURLToPath3 } from "url";
|
|
3764
|
+
import { Worker } from "worker_threads";
|
|
3694
3765
|
|
|
3695
3766
|
// packages/domain/scanner/src/cache-native.ts
|
|
3696
3767
|
init_native_bridge();
|
|
3768
|
+
import fs6 from "fs";
|
|
3769
|
+
import path7 from "path";
|
|
3697
3770
|
function defaultCachePath(rootDir, cacheDir) {
|
|
3698
|
-
const dir = cacheDir ?
|
|
3699
|
-
return
|
|
3771
|
+
const dir = cacheDir ? path7.resolve(rootDir, cacheDir) : path7.join(process.cwd(), ".cache", "tailwind-styled");
|
|
3772
|
+
return path7.join(dir, "scanner-cache.json");
|
|
3700
3773
|
}
|
|
3774
|
+
var STALE_THRESHOLD_MS = 7 * 24 * 60 * 60 * 1e3;
|
|
3701
3775
|
function readCache(rootDir, cacheDir) {
|
|
3702
3776
|
const cachePath = defaultCachePath(rootDir, cacheDir);
|
|
3703
|
-
|
|
3777
|
+
fs6.mkdirSync(path7.dirname(cachePath), { recursive: true });
|
|
3704
3778
|
const result = cacheReadNative(cachePath);
|
|
3705
3779
|
if (!result) return [];
|
|
3706
3780
|
return result.entries.map((e) => ({
|
|
@@ -3715,7 +3789,7 @@ function readCache(rootDir, cacheDir) {
|
|
|
3715
3789
|
}
|
|
3716
3790
|
function writeCache(rootDir, entries, cacheDir) {
|
|
3717
3791
|
const cachePath = defaultCachePath(rootDir, cacheDir);
|
|
3718
|
-
|
|
3792
|
+
fs6.mkdirSync(path7.dirname(cachePath), { recursive: true });
|
|
3719
3793
|
const success = cacheWriteNative(cachePath, entries);
|
|
3720
3794
|
if (!success) {
|
|
3721
3795
|
throw new Error(
|
|
@@ -3740,6 +3814,7 @@ init_native_bridge();
|
|
|
3740
3814
|
|
|
3741
3815
|
// packages/domain/scanner/src/schemas.ts
|
|
3742
3816
|
init_src2();
|
|
3817
|
+
import { z as z2 } from "zod";
|
|
3743
3818
|
var formatIssuePath2 = (path12) => path12.length > 0 ? path12.map(
|
|
3744
3819
|
(segment) => typeof segment === "symbol" ? segment.description ?? segment.toString() : String(segment)
|
|
3745
3820
|
).join(".") : "<root>";
|
|
@@ -3758,40 +3833,40 @@ var parseWithSchema2 = (schema, data, label) => {
|
|
|
3758
3833
|
parsed.error
|
|
3759
3834
|
);
|
|
3760
3835
|
};
|
|
3761
|
-
var NonNegativeIntegerSchema =
|
|
3762
|
-
var ScanWorkspaceOptionsSchema =
|
|
3763
|
-
includeExtensions:
|
|
3764
|
-
ignoreDirectories:
|
|
3765
|
-
useCache:
|
|
3766
|
-
cacheDir:
|
|
3767
|
-
smartInvalidation:
|
|
3836
|
+
var NonNegativeIntegerSchema = z2.number().int().min(0);
|
|
3837
|
+
var ScanWorkspaceOptionsSchema = z2.object({
|
|
3838
|
+
includeExtensions: z2.array(z2.string()).optional(),
|
|
3839
|
+
ignoreDirectories: z2.array(z2.string()).optional(),
|
|
3840
|
+
useCache: z2.boolean().optional(),
|
|
3841
|
+
cacheDir: z2.string().min(1).optional(),
|
|
3842
|
+
smartInvalidation: z2.boolean().optional()
|
|
3768
3843
|
});
|
|
3769
|
-
var ScanFileResultSchema =
|
|
3770
|
-
file:
|
|
3771
|
-
classes:
|
|
3772
|
-
hash:
|
|
3844
|
+
var ScanFileResultSchema = z2.object({
|
|
3845
|
+
file: z2.string(),
|
|
3846
|
+
classes: z2.array(z2.string()),
|
|
3847
|
+
hash: z2.string().optional()
|
|
3773
3848
|
});
|
|
3774
|
-
var ScanWorkspaceResultSchema =
|
|
3775
|
-
files:
|
|
3849
|
+
var ScanWorkspaceResultSchema = z2.object({
|
|
3850
|
+
files: z2.array(ScanFileResultSchema),
|
|
3776
3851
|
totalFiles: NonNegativeIntegerSchema,
|
|
3777
|
-
uniqueClasses:
|
|
3852
|
+
uniqueClasses: z2.array(z2.string())
|
|
3778
3853
|
}).refine((value) => value.totalFiles === value.files.length, {
|
|
3779
3854
|
message: "scan result totalFiles must match files.length",
|
|
3780
3855
|
path: ["totalFiles"]
|
|
3781
3856
|
});
|
|
3782
|
-
|
|
3783
|
-
rootDir:
|
|
3857
|
+
var ScannerWorkerRequestSchema = z2.object({
|
|
3858
|
+
rootDir: z2.string().min(1),
|
|
3784
3859
|
options: ScanWorkspaceOptionsSchema.optional()
|
|
3785
3860
|
});
|
|
3786
|
-
var ScannerWorkerSuccessMessageSchema =
|
|
3787
|
-
ok:
|
|
3861
|
+
var ScannerWorkerSuccessMessageSchema = z2.object({
|
|
3862
|
+
ok: z2.literal(true),
|
|
3788
3863
|
result: ScanWorkspaceResultSchema
|
|
3789
3864
|
});
|
|
3790
|
-
var ScannerWorkerErrorMessageSchema =
|
|
3791
|
-
ok:
|
|
3792
|
-
error:
|
|
3865
|
+
var ScannerWorkerErrorMessageSchema = z2.object({
|
|
3866
|
+
ok: z2.literal(false),
|
|
3867
|
+
error: z2.string().optional()
|
|
3793
3868
|
});
|
|
3794
|
-
|
|
3869
|
+
var ScannerWorkerMessageSchema = z2.union([
|
|
3795
3870
|
ScannerWorkerSuccessMessageSchema,
|
|
3796
3871
|
ScannerWorkerErrorMessageSchema
|
|
3797
3872
|
]);
|
|
@@ -3805,7 +3880,7 @@ function getRuntimeDir() {
|
|
|
3805
3880
|
return __dirname;
|
|
3806
3881
|
}
|
|
3807
3882
|
if (typeof import.meta !== "undefined" && import.meta.url) {
|
|
3808
|
-
return
|
|
3883
|
+
return path8.dirname(fileURLToPath3(import.meta.url));
|
|
3809
3884
|
}
|
|
3810
3885
|
return process.cwd();
|
|
3811
3886
|
}
|
|
@@ -3820,7 +3895,7 @@ var createNativeParserLoader = () => {
|
|
|
3820
3895
|
const loadNativeParserBinding = () => {
|
|
3821
3896
|
if (_state.binding !== void 0) return _state.binding;
|
|
3822
3897
|
const runtimeDir = getRuntimeDir();
|
|
3823
|
-
const req =
|
|
3898
|
+
const req = createRequire6(path8.join(runtimeDir, "noop.cjs"));
|
|
3824
3899
|
const _platform = process.platform;
|
|
3825
3900
|
const _arch = process.arch;
|
|
3826
3901
|
const _platformArch = `${_platform}-${_arch}`;
|
|
@@ -3828,27 +3903,27 @@ var createNativeParserLoader = () => {
|
|
|
3828
3903
|
const candidates = [
|
|
3829
3904
|
// ── binaryName baru: tailwind-styled-native (napi-rs naming) ──
|
|
3830
3905
|
// cwd = repo root saat run dari root, atau package dir saat workspaces
|
|
3831
|
-
|
|
3832
|
-
|
|
3833
|
-
|
|
3906
|
+
path8.resolve(process.cwd(), "native", "tailwind-styled-native.node"),
|
|
3907
|
+
path8.resolve(process.cwd(), "native", `tailwind-styled-native.${_platformArch}.node`),
|
|
3908
|
+
path8.resolve(process.cwd(), "native", `tailwind-styled-native.${_platformArchGnu}.node`),
|
|
3834
3909
|
// runtimeDir = dist/ → naik 1 level ke package root (npm install case)
|
|
3835
3910
|
// e.g. node_modules/tailwind-styled-v4/dist/ → node_modules/tailwind-styled-v4/native/
|
|
3836
|
-
|
|
3837
|
-
|
|
3838
|
-
|
|
3911
|
+
path8.resolve(runtimeDir, "..", "native", "tailwind-styled-native.node"),
|
|
3912
|
+
path8.resolve(runtimeDir, "..", "native", `tailwind-styled-native.${_platformArch}.node`),
|
|
3913
|
+
path8.resolve(runtimeDir, "..", "native", `tailwind-styled-native.${_platformArchGnu}.node`),
|
|
3839
3914
|
// runtimeDir = dist/ → naik 4 level ke repo root (monorepo dev case)
|
|
3840
|
-
|
|
3841
|
-
|
|
3915
|
+
path8.resolve(runtimeDir, "..", "..", "..", "..", "native", "tailwind-styled-native.node"),
|
|
3916
|
+
path8.resolve(runtimeDir, "..", "..", "..", "..", "native", `tailwind-styled-native.${_platformArchGnu}.node`),
|
|
3842
3917
|
// 3 level fallback (jika package di-nest lebih dangkal)
|
|
3843
|
-
|
|
3844
|
-
|
|
3918
|
+
path8.resolve(runtimeDir, "..", "..", "..", "native", "tailwind-styled-native.node"),
|
|
3919
|
+
path8.resolve(runtimeDir, "..", "..", "..", "native", `tailwind-styled-native.${_platformArchGnu}.node`),
|
|
3845
3920
|
// ── binaryName lama: tailwind_styled_parser (backward compat) ──
|
|
3846
|
-
|
|
3847
|
-
|
|
3848
|
-
|
|
3849
|
-
|
|
3850
|
-
|
|
3851
|
-
|
|
3921
|
+
path8.resolve(process.cwd(), "native/tailwind_styled_parser.node"),
|
|
3922
|
+
path8.resolve(process.cwd(), "native/build/Release/tailwind_styled_parser.node"),
|
|
3923
|
+
path8.resolve(runtimeDir, "..", "native", "tailwind_styled_parser.node"),
|
|
3924
|
+
path8.resolve(runtimeDir, "..", "..", "..", "..", "native", "tailwind_styled_parser.node"),
|
|
3925
|
+
path8.resolve(runtimeDir, "..", "..", "..", "native", "tailwind_styled_parser.node"),
|
|
3926
|
+
path8.resolve(
|
|
3852
3927
|
runtimeDir,
|
|
3853
3928
|
"..",
|
|
3854
3929
|
"..",
|
|
@@ -3860,7 +3935,7 @@ var createNativeParserLoader = () => {
|
|
|
3860
3935
|
)
|
|
3861
3936
|
];
|
|
3862
3937
|
for (const fullPath of candidates) {
|
|
3863
|
-
if (!
|
|
3938
|
+
if (!fs7.existsSync(fullPath)) continue;
|
|
3864
3939
|
try {
|
|
3865
3940
|
const required = req(fullPath);
|
|
3866
3941
|
if (required && (typeof required.extractClassesFromSource === "function" || typeof required.parseClasses === "function" || typeof required.parse_classes === "function")) {
|
|
@@ -3901,19 +3976,19 @@ function collectCandidates(rootDir, ignoreDirectories, extensionSet) {
|
|
|
3901
3976
|
if (!currentDir) continue;
|
|
3902
3977
|
const entries = (() => {
|
|
3903
3978
|
try {
|
|
3904
|
-
return
|
|
3979
|
+
return fs7.readdirSync(currentDir, { withFileTypes: true });
|
|
3905
3980
|
} catch {
|
|
3906
3981
|
return [];
|
|
3907
3982
|
}
|
|
3908
3983
|
})();
|
|
3909
3984
|
for (const entry of entries) {
|
|
3910
|
-
const fullPath =
|
|
3985
|
+
const fullPath = path8.join(currentDir, entry.name);
|
|
3911
3986
|
if (entry.isDirectory()) {
|
|
3912
3987
|
if (!ignoreDirectories.has(entry.name)) directories.push(fullPath);
|
|
3913
3988
|
continue;
|
|
3914
3989
|
}
|
|
3915
3990
|
if (!entry.isFile()) continue;
|
|
3916
|
-
if (!extensionSet.has(
|
|
3991
|
+
if (!extensionSet.has(path8.extname(entry.name))) continue;
|
|
3917
3992
|
candidates.push(fullPath);
|
|
3918
3993
|
}
|
|
3919
3994
|
}
|
|
@@ -3957,7 +4032,7 @@ function scanWorkspace2(rootDir, options = {}) {
|
|
|
3957
4032
|
const extensionSet = buildExtensionSet(includeExtensions);
|
|
3958
4033
|
const ignoreDirectories = new Set(normalizedOptions.ignoreDirectories ?? DEFAULT_IGNORES);
|
|
3959
4034
|
const useCache = normalizedOptions.useCache ?? true;
|
|
3960
|
-
normalizedOptions.smartInvalidation ?? true;
|
|
4035
|
+
const _smartInvalidation = normalizedOptions.smartInvalidation ?? true;
|
|
3961
4036
|
const files = [];
|
|
3962
4037
|
const unique = /* @__PURE__ */ new Set();
|
|
3963
4038
|
const candidates = collectCandidates(rootDir, ignoreDirectories, extensionSet);
|
|
@@ -3997,7 +4072,7 @@ function scanWorkspace2(rootDir, options = {}) {
|
|
|
3997
4072
|
for (const filePath of candidates) {
|
|
3998
4073
|
const stat = (() => {
|
|
3999
4074
|
try {
|
|
4000
|
-
return
|
|
4075
|
+
return fs7.statSync(filePath);
|
|
4001
4076
|
} catch {
|
|
4002
4077
|
return null;
|
|
4003
4078
|
}
|
|
@@ -4023,7 +4098,7 @@ function scanWorkspace2(rootDir, options = {}) {
|
|
|
4023
4098
|
for (const { filePath, stat, size, cached } of ranked) {
|
|
4024
4099
|
const content = (() => {
|
|
4025
4100
|
try {
|
|
4026
|
-
return
|
|
4101
|
+
return fs7.readFileSync(filePath, "utf8");
|
|
4027
4102
|
} catch {
|
|
4028
4103
|
return null;
|
|
4029
4104
|
}
|
|
@@ -4089,6 +4164,8 @@ init_src2();
|
|
|
4089
4164
|
|
|
4090
4165
|
// packages/presentation/next/src/incrementalOrchestrator.ts
|
|
4091
4166
|
init_src();
|
|
4167
|
+
import fs8 from "fs";
|
|
4168
|
+
import path9 from "path";
|
|
4092
4169
|
var _fingerprintCache = /* @__PURE__ */ new Map();
|
|
4093
4170
|
function getNative2() {
|
|
4094
4171
|
try {
|
|
@@ -4099,10 +4176,10 @@ function getNative2() {
|
|
|
4099
4176
|
}
|
|
4100
4177
|
function fingerprintFile(filePath) {
|
|
4101
4178
|
try {
|
|
4102
|
-
const stat =
|
|
4179
|
+
const stat = fs8.statSync(filePath);
|
|
4103
4180
|
const native = getNative2();
|
|
4104
4181
|
if (native?.create_fingerprint) {
|
|
4105
|
-
const content =
|
|
4182
|
+
const content = fs8.readFileSync(filePath, "utf-8");
|
|
4106
4183
|
const hash = native.create_fingerprint(filePath, content);
|
|
4107
4184
|
return { hash, mtime: stat.mtimeMs };
|
|
4108
4185
|
}
|
|
@@ -4142,14 +4219,18 @@ function hasSourceChanged(sourceFiles) {
|
|
|
4142
4219
|
}
|
|
4143
4220
|
function isIncrementalEnabled(cwd) {
|
|
4144
4221
|
try {
|
|
4145
|
-
const configPath =
|
|
4146
|
-
if (!
|
|
4147
|
-
const config = JSON.parse(
|
|
4222
|
+
const configPath = path9.join(cwd, "tailwind-styled.config.json");
|
|
4223
|
+
if (!fs8.existsSync(configPath)) return false;
|
|
4224
|
+
const config = JSON.parse(fs8.readFileSync(configPath, "utf-8"));
|
|
4148
4225
|
return config.compiler?.incremental === true;
|
|
4149
4226
|
} catch {
|
|
4150
4227
|
return false;
|
|
4151
4228
|
}
|
|
4152
4229
|
}
|
|
4230
|
+
|
|
4231
|
+
// packages/presentation/next/src/staticCssWebpackPlugin.ts
|
|
4232
|
+
import fs9 from "fs";
|
|
4233
|
+
import path10 from "path";
|
|
4153
4234
|
var _fileStaticCssMap = /* @__PURE__ */ new Map();
|
|
4154
4235
|
function setFileStaticCss(filepath, css) {
|
|
4155
4236
|
if (css && css.trim()) {
|
|
@@ -4183,14 +4264,14 @@ var StaticCssWebpackPlugin = class _StaticCssWebpackPlugin {
|
|
|
4183
4264
|
static PLUGIN_NAME = "TailwindStyledStaticCss";
|
|
4184
4265
|
outPath;
|
|
4185
4266
|
constructor(safelistPath) {
|
|
4186
|
-
this.outPath =
|
|
4267
|
+
this.outPath = path10.join(path10.dirname(safelistPath), "_tw-state-static.css");
|
|
4187
4268
|
}
|
|
4188
4269
|
apply(compiler) {
|
|
4189
4270
|
compiler.hooks.done.tap(_StaticCssWebpackPlugin.PLUGIN_NAME, () => {
|
|
4190
4271
|
try {
|
|
4191
4272
|
const content = buildContent(_fileStaticCssMap);
|
|
4192
|
-
|
|
4193
|
-
|
|
4273
|
+
fs9.mkdirSync(path10.dirname(this.outPath), { recursive: true });
|
|
4274
|
+
fs9.writeFileSync(
|
|
4194
4275
|
this.outPath,
|
|
4195
4276
|
HEADER + (content || "/* no static rules yet */") + "\n",
|
|
4196
4277
|
"utf-8"
|
|
@@ -4216,20 +4297,23 @@ function getDirnameFromUrl2(importMetaUrl) {
|
|
|
4216
4297
|
const lastSlash = Math.max(importMetaUrl.lastIndexOf("/"), importMetaUrl.lastIndexOf("\\"));
|
|
4217
4298
|
return lastSlash > 0 ? importMetaUrl.slice(0, lastSlash) : "";
|
|
4218
4299
|
}
|
|
4219
|
-
var require4 =
|
|
4220
|
-
|
|
4300
|
+
var require4 = createRequire7(
|
|
4301
|
+
typeof import.meta !== "undefined" && import.meta.url ? import.meta.url : typeof __filename !== "undefined" ? `file://${__filename}` : "file://unknown"
|
|
4302
|
+
);
|
|
4303
|
+
var _importMetaUrl = typeof import.meta !== "undefined" && import.meta.url ? import.meta.url : typeof __filename !== "undefined" ? `file://${__filename}` : void 0;
|
|
4304
|
+
var resolveRuntimeDir2 = () => _importMetaUrl ? getDirnameFromUrl2(_importMetaUrl) : __dirname;
|
|
4221
4305
|
var resolveLoaderPath2 = (basename) => {
|
|
4222
4306
|
try {
|
|
4223
|
-
return resolveLoaderPath(basename,
|
|
4307
|
+
return resolveLoaderPath(basename, _importMetaUrl ?? `file://${__filename}`);
|
|
4224
4308
|
} catch {
|
|
4225
4309
|
const runtimeDir = resolveRuntimeDir2();
|
|
4226
4310
|
const candidates = [
|
|
4227
|
-
|
|
4228
|
-
|
|
4229
|
-
|
|
4311
|
+
path11.resolve(runtimeDir, `${basename}.mjs`),
|
|
4312
|
+
path11.resolve(runtimeDir, `${basename}.js`),
|
|
4313
|
+
path11.resolve(runtimeDir, `${basename}.cjs`)
|
|
4230
4314
|
];
|
|
4231
4315
|
for (const candidate of candidates) {
|
|
4232
|
-
if (
|
|
4316
|
+
if (fs10.existsSync(candidate)) {
|
|
4233
4317
|
return candidate;
|
|
4234
4318
|
}
|
|
4235
4319
|
}
|
|
@@ -4267,7 +4351,7 @@ var createLoaderOptions = (options) => {
|
|
|
4267
4351
|
preserveImports: true
|
|
4268
4352
|
};
|
|
4269
4353
|
if (options.verbose !== void 0) opts.verbose = options.verbose;
|
|
4270
|
-
opts.safelistPath = options.safelistPath ??
|
|
4354
|
+
opts.safelistPath = options.safelistPath ?? path11.join(process.cwd(), ".next", "tailwind-styled-safelist.css");
|
|
4271
4355
|
return Object.freeze(opts);
|
|
4272
4356
|
};
|
|
4273
4357
|
var buildTurbopackRules = (loaderPath, loaderOptions) => {
|
|
@@ -4280,7 +4364,7 @@ var buildTurbopackRules = (loaderPath, loaderOptions) => {
|
|
|
4280
4364
|
])
|
|
4281
4365
|
);
|
|
4282
4366
|
};
|
|
4283
|
-
var normalizeLoaderPath = (loaderPath) =>
|
|
4367
|
+
var normalizeLoaderPath = (loaderPath) => path11.resolve(loaderPath);
|
|
4284
4368
|
var applyWebpackRule = (config, options, loaderPath) => {
|
|
4285
4369
|
const loaderOptions = createLoaderOptions(options);
|
|
4286
4370
|
const rules = config.module?.rules ?? [];
|
|
@@ -4297,7 +4381,7 @@ var applyWebpackRule = (config, options, loaderPath) => {
|
|
|
4297
4381
|
enforce: "pre",
|
|
4298
4382
|
use: [{ loader: loaderPath, options: loaderOptions }]
|
|
4299
4383
|
};
|
|
4300
|
-
const safelistPath = loaderOptions.safelistPath ??
|
|
4384
|
+
const safelistPath = loaderOptions.safelistPath ?? path11.join(process.cwd(), ".next", "tailwind-styled-safelist.css");
|
|
4301
4385
|
const pluginAlreadyRegistered = (config.plugins ?? []).some(
|
|
4302
4386
|
(p) => p?.constructor?.name === StaticCssWebpackPlugin.PLUGIN_NAME
|
|
4303
4387
|
);
|
|
@@ -4397,17 +4481,17 @@ function withTailwindStyled(options = {}) {
|
|
|
4397
4481
|
return fullCss.slice(startIdx, endIdx + 1);
|
|
4398
4482
|
};
|
|
4399
4483
|
var extractUtilitiesLayer = extractUtilitiesLayer2;
|
|
4400
|
-
const twClassesDir =
|
|
4401
|
-
|
|
4402
|
-
setGlobalLogFile(
|
|
4403
|
-
|
|
4404
|
-
|
|
4484
|
+
const twClassesDir = path11.join(path11.dirname(safelistPath), "tw-classes");
|
|
4485
|
+
fs10.mkdirSync(twClassesDir, { recursive: true });
|
|
4486
|
+
setGlobalLogFile(path11.join(twClassesDir, "_tw-build.log"));
|
|
4487
|
+
fs10.writeFileSync(
|
|
4488
|
+
path11.join(twClassesDir, "_start.txt"),
|
|
4405
4489
|
String(Date.now()),
|
|
4406
4490
|
"utf-8"
|
|
4407
4491
|
);
|
|
4408
|
-
const stateStaticPath =
|
|
4492
|
+
const stateStaticPath = path11.join(twClassesDir, TW_STATE_STATIC_FILENAME);
|
|
4409
4493
|
try {
|
|
4410
|
-
|
|
4494
|
+
fs10.writeFileSync(
|
|
4411
4495
|
stateStaticPath,
|
|
4412
4496
|
"/* tw-state-static.css \u2014 placeholder, akan di-generate setelah scan */\n",
|
|
4413
4497
|
"utf-8"
|
|
@@ -4423,14 +4507,14 @@ function withTailwindStyled(options = {}) {
|
|
|
4423
4507
|
"src/index.css",
|
|
4424
4508
|
"styles/globals.css"
|
|
4425
4509
|
];
|
|
4426
|
-
const safelistDir =
|
|
4510
|
+
const safelistDir = path11.dirname(safelistPath);
|
|
4427
4511
|
for (const candidate of CSS_CANDIDATES) {
|
|
4428
|
-
const candidatePath =
|
|
4429
|
-
if (!
|
|
4430
|
-
const content =
|
|
4512
|
+
const candidatePath = path11.join(process.cwd(), candidate);
|
|
4513
|
+
if (!fs10.existsSync(candidatePath)) continue;
|
|
4514
|
+
const content = fs10.readFileSync(candidatePath, "utf-8");
|
|
4431
4515
|
if (content.includes("_tw-state-static.css")) break;
|
|
4432
|
-
const globalsDir =
|
|
4433
|
-
const rel =
|
|
4516
|
+
const globalsDir = path11.dirname(candidatePath);
|
|
4517
|
+
const rel = path11.relative(globalsDir, stateStaticPath).replace(/\\/g, "/");
|
|
4434
4518
|
const importLine = `@import "./${rel}";`;
|
|
4435
4519
|
const tailwindImportRe = /(@import\s+["']tailwindcss["']\s*;[^\n]*\n?)/;
|
|
4436
4520
|
let updated;
|
|
@@ -4444,7 +4528,7 @@ function withTailwindStyled(options = {}) {
|
|
|
4444
4528
|
updated = `${importLine}
|
|
4445
4529
|
${content}`;
|
|
4446
4530
|
}
|
|
4447
|
-
|
|
4531
|
+
fs10.writeFileSync(candidatePath, updated, "utf-8");
|
|
4448
4532
|
if (options.verbose) {
|
|
4449
4533
|
console.log(
|
|
4450
4534
|
`[tailwind-styled] Auto-injected "${importLine}" into ${candidate}`
|
|
@@ -4456,27 +4540,27 @@ ${content}`;
|
|
|
4456
4540
|
}
|
|
4457
4541
|
if (!process.env.TW_NATIVE_PATH) {
|
|
4458
4542
|
const runtimeDir = resolveRuntimeDir2();
|
|
4459
|
-
const nativePath =
|
|
4460
|
-
if (
|
|
4543
|
+
const nativePath = path11.resolve(runtimeDir, "..", "native", "tailwind-styled-native.node");
|
|
4544
|
+
if (fs10.existsSync(nativePath)) {
|
|
4461
4545
|
process.env.TW_NATIVE_PATH = nativePath;
|
|
4462
4546
|
}
|
|
4463
4547
|
}
|
|
4464
|
-
const srcDir =
|
|
4465
|
-
if (
|
|
4548
|
+
const srcDir = path11.join(process.cwd(), "src");
|
|
4549
|
+
if (fs10.existsSync(srcDir)) {
|
|
4466
4550
|
try {
|
|
4467
4551
|
const result = scanWorkspace2(srcDir);
|
|
4468
4552
|
if (result.uniqueClasses.length > 0) {
|
|
4469
4553
|
let atomicWriteFile2 = function(filePath, content) {
|
|
4470
4554
|
const tmpPath = `${filePath}.tmp`;
|
|
4471
4555
|
try {
|
|
4472
|
-
|
|
4473
|
-
|
|
4556
|
+
fs10.writeFileSync(tmpPath, content, "utf-8");
|
|
4557
|
+
fs10.renameSync(tmpPath, filePath);
|
|
4474
4558
|
} catch {
|
|
4475
4559
|
try {
|
|
4476
|
-
|
|
4560
|
+
fs10.unlinkSync(tmpPath);
|
|
4477
4561
|
} catch {
|
|
4478
4562
|
}
|
|
4479
|
-
|
|
4563
|
+
fs10.writeFileSync(filePath, content, "utf-8");
|
|
4480
4564
|
}
|
|
4481
4565
|
};
|
|
4482
4566
|
var atomicWriteFile = atomicWriteFile2;
|
|
@@ -4539,14 +4623,14 @@ ${content}`;
|
|
|
4539
4623
|
"styles/globals.css"
|
|
4540
4624
|
];
|
|
4541
4625
|
try {
|
|
4542
|
-
const twConfigPath =
|
|
4543
|
-
if (
|
|
4544
|
-
const twConfig = JSON.parse(
|
|
4626
|
+
const twConfigPath = path11.join(process.cwd(), "tailwind-styled.config.json");
|
|
4627
|
+
if (fs10.existsSync(twConfigPath)) {
|
|
4628
|
+
const twConfig = JSON.parse(fs10.readFileSync(twConfigPath, "utf-8"));
|
|
4545
4629
|
const cssEntry = twConfig.css?.entry;
|
|
4546
4630
|
if (cssEntry) {
|
|
4547
|
-
const cssEntryPath =
|
|
4548
|
-
if (
|
|
4549
|
-
cssEntryContent =
|
|
4631
|
+
const cssEntryPath = path11.join(process.cwd(), cssEntry);
|
|
4632
|
+
if (fs10.existsSync(cssEntryPath)) {
|
|
4633
|
+
cssEntryContent = fs10.readFileSync(cssEntryPath, "utf-8");
|
|
4550
4634
|
}
|
|
4551
4635
|
}
|
|
4552
4636
|
}
|
|
@@ -4554,9 +4638,9 @@ ${content}`;
|
|
|
4554
4638
|
}
|
|
4555
4639
|
if (!cssEntryContent) {
|
|
4556
4640
|
for (const candidate of CSS_CANDIDATES) {
|
|
4557
|
-
const candidatePath =
|
|
4558
|
-
if (
|
|
4559
|
-
cssEntryContent =
|
|
4641
|
+
const candidatePath = path11.join(process.cwd(), candidate);
|
|
4642
|
+
if (fs10.existsSync(candidatePath)) {
|
|
4643
|
+
cssEntryContent = fs10.readFileSync(candidatePath, "utf-8");
|
|
4560
4644
|
break;
|
|
4561
4645
|
}
|
|
4562
4646
|
}
|
|
@@ -4564,8 +4648,8 @@ ${content}`;
|
|
|
4564
4648
|
if (cssEntryContent) {
|
|
4565
4649
|
cssEntryContent = cssEntryContent.replace(/@source\s+["'][^"']+["']\s*;?\s*/g, "").replace(/←[^\n]*/g, "").trim();
|
|
4566
4650
|
}
|
|
4567
|
-
const initialScanPath =
|
|
4568
|
-
if (!
|
|
4651
|
+
const initialScanPath = path11.join(twClassesDir, "_initial-scan.css");
|
|
4652
|
+
if (!fs10.existsSync(initialScanPath)) {
|
|
4569
4653
|
atomicWriteFile2(
|
|
4570
4654
|
initialScanPath,
|
|
4571
4655
|
"/* tw-classes: initial scan \u2014 generating... */\n@layer utilities {}\n"
|
|
@@ -4573,7 +4657,7 @@ ${content}`;
|
|
|
4573
4657
|
}
|
|
4574
4658
|
const sourceFiles = result.files?.map((f) => f.file) ?? [];
|
|
4575
4659
|
const incremental = isIncrementalEnabled(process.cwd());
|
|
4576
|
-
if (incremental &&
|
|
4660
|
+
if (incremental && fs10.existsSync(initialScanPath) && !hasSourceChanged(sourceFiles)) {
|
|
4577
4661
|
if (options.verbose) console.log("[tailwind-styled] Incremental: tidak ada perubahan, skip regenerate CSS");
|
|
4578
4662
|
} else {
|
|
4579
4663
|
void (async () => {
|
|
@@ -4691,7 +4775,11 @@ ${err.message}`,
|
|
|
4691
4775
|
};
|
|
4692
4776
|
};
|
|
4693
4777
|
}
|
|
4694
|
-
|
|
4695
|
-
|
|
4696
|
-
|
|
4778
|
+
export {
|
|
4779
|
+
NextAdapterOptionsSchema,
|
|
4780
|
+
StaticCssWebpackPlugin,
|
|
4781
|
+
parseNextAdapterOptions,
|
|
4782
|
+
setFileStaticCss,
|
|
4783
|
+
withTailwindStyled
|
|
4784
|
+
};
|
|
4697
4785
|
//# sourceMappingURL=next.mjs.map
|