tailwind-styled-v4 5.0.35 → 5.0.36
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +458 -339
- package/dist/cli.js +9 -6
- package/dist/cli.js.map +1 -1
- package/dist/cli.mjs +9 -6
- package/dist/cli.mjs.map +1 -1
- package/dist/index.browser.mjs +689 -508
- package/dist/index.browser.mjs.map +1 -1
- package/dist/index.js +38 -20
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +38 -20
- package/dist/index.mjs.map +1 -1
- package/dist/next.js +240 -170
- package/dist/next.js.map +1 -1
- package/dist/next.mjs +240 -170
- package/dist/next.mjs.map +1 -1
- package/dist/svelte.js +4 -4
- package/dist/svelte.js.map +1 -1
- package/dist/svelte.mjs +4 -4
- package/dist/svelte.mjs.map +1 -1
- package/dist/tw.js +9 -6
- package/dist/tw.js.map +1 -1
- package/dist/tw.mjs +9 -6
- package/dist/tw.mjs.map +1 -1
- package/dist/vue.js +4 -4
- package/dist/vue.js.map +1 -1
- package/dist/vue.mjs +4 -4
- package/dist/vue.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 +7 -5
package/dist/next.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var module$1 = require('module');
|
|
4
|
-
var
|
|
5
|
-
var
|
|
4
|
+
var fs10 = require('fs');
|
|
5
|
+
var path11 = require('path');
|
|
6
6
|
require('crypto');
|
|
7
7
|
var url = require('url');
|
|
8
8
|
var zod = require('zod');
|
|
@@ -27,8 +27,8 @@ function _interopNamespace(e) {
|
|
|
27
27
|
return Object.freeze(n);
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
var
|
|
31
|
-
var
|
|
30
|
+
var fs10__namespace = /*#__PURE__*/_interopNamespace(fs10);
|
|
31
|
+
var path11__namespace = /*#__PURE__*/_interopNamespace(path11);
|
|
32
32
|
|
|
33
33
|
/* tailwind-styled-v4 v5.0.4 | MIT | https://github.com/dictionar32/tailwind-styled-v4 */
|
|
34
34
|
var __defProp = Object.defineProperty;
|
|
@@ -84,11 +84,11 @@ function resolvePath(...segments) {
|
|
|
84
84
|
return segments.join("/").replace(/\/+/g, "/");
|
|
85
85
|
}
|
|
86
86
|
}
|
|
87
|
-
function existsSync(
|
|
87
|
+
function existsSync(path12) {
|
|
88
88
|
if (isBrowser) return false;
|
|
89
89
|
try {
|
|
90
90
|
const nodeFs = __require(NODE_FS);
|
|
91
|
-
return nodeFs.existsSync(
|
|
91
|
+
return nodeFs.existsSync(path12);
|
|
92
92
|
} catch {
|
|
93
93
|
return false;
|
|
94
94
|
}
|
|
@@ -162,7 +162,7 @@ function resolveNativeBinary(runtimeDir) {
|
|
|
162
162
|
}
|
|
163
163
|
const envPath = process.env.TW_NATIVE_PATH?.trim();
|
|
164
164
|
if (envPath) {
|
|
165
|
-
if (
|
|
165
|
+
if (fs10__namespace.existsSync(envPath)) {
|
|
166
166
|
return { path: envPath, source: "env", platform, tried };
|
|
167
167
|
}
|
|
168
168
|
tried.push(`env:${envPath} (not found)`);
|
|
@@ -171,7 +171,7 @@ function resolveNativeBinary(runtimeDir) {
|
|
|
171
171
|
for (const pkg of prebuiltPkgs) {
|
|
172
172
|
try {
|
|
173
173
|
const candidate = _require.resolve(`${pkg}/tailwind_styled_parser.node`);
|
|
174
|
-
if (
|
|
174
|
+
if (fs10__namespace.existsSync(candidate)) {
|
|
175
175
|
return { path: candidate, source: "prebuilt", platform, tried };
|
|
176
176
|
}
|
|
177
177
|
tried.push(`prebuilt:${pkg} (resolved but missing)`);
|
|
@@ -182,13 +182,13 @@ function resolveNativeBinary(runtimeDir) {
|
|
|
182
182
|
const napiPlatform = platform === "linux-x64" ? "linux-x64-gnu" : platform === "linux-arm64" ? "linux-arm64-gnu" : platform;
|
|
183
183
|
const BINARY_NAMES_SELF = ["tailwind-styled-native", "tailwind_styled_parser"];
|
|
184
184
|
if (runtimeDir) {
|
|
185
|
-
for (const depth of ["..",
|
|
186
|
-
const pkgRoot =
|
|
185
|
+
for (const depth of ["..", path11__namespace.join("..", ".."), path11__namespace.join("..", "..", "..")]) {
|
|
186
|
+
const pkgRoot = path11__namespace.resolve(runtimeDir, depth);
|
|
187
187
|
for (const bin of BINARY_NAMES_SELF) {
|
|
188
188
|
for (const suffix of ["", `.${platform}`, `.${napiPlatform}`]) {
|
|
189
|
-
const candidate =
|
|
189
|
+
const candidate = path11__namespace.resolve(pkgRoot, "native", `${bin}${suffix}.node`);
|
|
190
190
|
tried.push(`self-bundled:${candidate}`);
|
|
191
|
-
if (
|
|
191
|
+
if (fs10__namespace.existsSync(candidate)) {
|
|
192
192
|
return { path: candidate, source: "prebuilt", platform, tried };
|
|
193
193
|
}
|
|
194
194
|
}
|
|
@@ -200,29 +200,29 @@ function resolveNativeBinary(runtimeDir) {
|
|
|
200
200
|
const BINARY_NAMES = ["tailwind-styled-native", "tailwind_styled_parser"];
|
|
201
201
|
const localCandidates = [];
|
|
202
202
|
for (const bin of BINARY_NAMES) {
|
|
203
|
-
localCandidates.push(
|
|
204
|
-
localCandidates.push(
|
|
205
|
-
localCandidates.push(
|
|
206
|
-
localCandidates.push(
|
|
203
|
+
localCandidates.push(path11__namespace.resolve(base, `${bin}.node`));
|
|
204
|
+
localCandidates.push(path11__namespace.resolve(base, "..", `${bin}.node`));
|
|
205
|
+
localCandidates.push(path11__namespace.resolve(base, `${bin}.${platform}.node`));
|
|
206
|
+
localCandidates.push(path11__namespace.resolve(base, `${bin}.${napiPlatform}.node`));
|
|
207
207
|
}
|
|
208
208
|
for (const startDir of [cwd, base]) {
|
|
209
209
|
let dir = startDir;
|
|
210
210
|
for (let i = 0; i < 6; i++) {
|
|
211
|
-
const nativeDir =
|
|
211
|
+
const nativeDir = path11__namespace.resolve(dir, "native");
|
|
212
212
|
for (const bin of BINARY_NAMES) {
|
|
213
|
-
localCandidates.push(
|
|
214
|
-
localCandidates.push(
|
|
215
|
-
localCandidates.push(
|
|
216
|
-
localCandidates.push(
|
|
213
|
+
localCandidates.push(path11__namespace.resolve(nativeDir, `${bin}.node`));
|
|
214
|
+
localCandidates.push(path11__namespace.resolve(nativeDir, `${bin}.${platform}.node`));
|
|
215
|
+
localCandidates.push(path11__namespace.resolve(nativeDir, `${bin}.${napiPlatform}.node`));
|
|
216
|
+
localCandidates.push(path11__namespace.resolve(nativeDir, "target", "release", `${bin}.node`));
|
|
217
217
|
}
|
|
218
|
-
const parent =
|
|
218
|
+
const parent = path11__namespace.resolve(dir, "..");
|
|
219
219
|
if (parent === dir) break;
|
|
220
220
|
dir = parent;
|
|
221
221
|
}
|
|
222
222
|
}
|
|
223
223
|
for (const candidate of localCandidates) {
|
|
224
224
|
tried.push(`local:${candidate}`);
|
|
225
|
-
if (
|
|
225
|
+
if (fs10__namespace.existsSync(candidate)) {
|
|
226
226
|
return { path: candidate, source: "local", platform, tried };
|
|
227
227
|
}
|
|
228
228
|
}
|
|
@@ -249,7 +249,7 @@ var _loadNative, log, NATIVE_UNAVAILABLE_MESSAGE, nativeBridge, bridgeLoadAttemp
|
|
|
249
249
|
var init_nativeBridge = __esm({
|
|
250
250
|
"packages/domain/compiler/src/nativeBridge.ts"() {
|
|
251
251
|
init_src2();
|
|
252
|
-
_loadNative = (
|
|
252
|
+
_loadNative = (path12) => __require(path12);
|
|
253
253
|
log = (...args) => {
|
|
254
254
|
if (process.env.DEBUG?.includes("compiler:native")) {
|
|
255
255
|
console.log("[compiler:native]", ...args);
|
|
@@ -2403,7 +2403,7 @@ var init_src = __esm({
|
|
|
2403
2403
|
};
|
|
2404
2404
|
scanProjectUsage = (dirs, cwd) => {
|
|
2405
2405
|
const { batchExtractClasses: batchExtractClasses2 } = _require2("./parser");
|
|
2406
|
-
const files = dirs.map((dir) =>
|
|
2406
|
+
const files = dirs.map((dir) => path11__namespace.default.resolve(cwd, dir));
|
|
2407
2407
|
const results = batchExtractClasses2(files) || [];
|
|
2408
2408
|
const combined = {};
|
|
2409
2409
|
for (const result of results) {
|
|
@@ -2420,13 +2420,13 @@ var init_src = __esm({
|
|
|
2420
2420
|
const classes = scanProjectUsage(scanDirs, cwd || process.cwd());
|
|
2421
2421
|
const allClasses = Object.keys(classes).sort();
|
|
2422
2422
|
if (outputPath) {
|
|
2423
|
-
|
|
2423
|
+
fs10__namespace.default.writeFileSync(outputPath, JSON.stringify(allClasses, null, 2));
|
|
2424
2424
|
}
|
|
2425
2425
|
return allClasses;
|
|
2426
2426
|
};
|
|
2427
2427
|
loadSafelist = (safelistPath) => {
|
|
2428
2428
|
try {
|
|
2429
|
-
const content =
|
|
2429
|
+
const content = fs10__namespace.default.readFileSync(safelistPath, "utf-8");
|
|
2430
2430
|
return JSON.parse(content);
|
|
2431
2431
|
} catch {
|
|
2432
2432
|
return [];
|
|
@@ -2440,8 +2440,8 @@ var init_src = __esm({
|
|
|
2440
2440
|
"tailwind.config.cjs"
|
|
2441
2441
|
];
|
|
2442
2442
|
for (const file of configFiles) {
|
|
2443
|
-
const fullPath =
|
|
2444
|
-
if (
|
|
2443
|
+
const fullPath = path11__namespace.default.join(cwd, file);
|
|
2444
|
+
if (fs10__namespace.default.existsSync(fullPath)) {
|
|
2445
2445
|
const mod = __require(fullPath);
|
|
2446
2446
|
return mod.default || mod;
|
|
2447
2447
|
}
|
|
@@ -2451,9 +2451,9 @@ var init_src = __esm({
|
|
|
2451
2451
|
getContentPaths = (cwd = process.cwd()) => {
|
|
2452
2452
|
return {
|
|
2453
2453
|
content: [
|
|
2454
|
-
|
|
2455
|
-
|
|
2456
|
-
|
|
2454
|
+
path11__namespace.default.join(cwd, "src/**/*.{js,ts,jsx,tsx}"),
|
|
2455
|
+
path11__namespace.default.join(cwd, "app/**/*.{js,ts,jsx,tsx}"),
|
|
2456
|
+
path11__namespace.default.join(cwd, "pages/**/*.{js,ts,jsx,tsx}")
|
|
2457
2457
|
]
|
|
2458
2458
|
};
|
|
2459
2459
|
};
|
|
@@ -2911,17 +2911,17 @@ function getNative() {
|
|
|
2911
2911
|
function* walkSourceFiles(dir) {
|
|
2912
2912
|
let entries;
|
|
2913
2913
|
try {
|
|
2914
|
-
entries =
|
|
2914
|
+
entries = fs10__namespace.default.readdirSync(dir, { withFileTypes: true });
|
|
2915
2915
|
} catch {
|
|
2916
2916
|
return;
|
|
2917
2917
|
}
|
|
2918
2918
|
for (const entry of entries) {
|
|
2919
|
-
const fullPath =
|
|
2919
|
+
const fullPath = path11__namespace.default.join(dir, entry.name);
|
|
2920
2920
|
if (entry.isDirectory()) {
|
|
2921
2921
|
if (IGNORE_PATTERNS.some((p) => entry.name === p || entry.name.startsWith(p))) continue;
|
|
2922
2922
|
yield* walkSourceFiles(fullPath);
|
|
2923
2923
|
} else if (entry.isFile()) {
|
|
2924
|
-
const ext =
|
|
2924
|
+
const ext = path11__namespace.default.extname(entry.name);
|
|
2925
2925
|
if (SOURCE_EXTENSIONS.has(ext)) yield fullPath;
|
|
2926
2926
|
}
|
|
2927
2927
|
}
|
|
@@ -2985,7 +2985,7 @@ function extractStaticStateCss(srcDir, options = {}) {
|
|
|
2985
2985
|
allConfigs.push(...configs);
|
|
2986
2986
|
if (verbose) {
|
|
2987
2987
|
process.stderr.write(
|
|
2988
|
-
`[tw:static-state] ${
|
|
2988
|
+
`[tw:static-state] ${path11__namespace.default.relative(srcDir, filePath)}: ${configs.length} komponen
|
|
2989
2989
|
`
|
|
2990
2990
|
);
|
|
2991
2991
|
}
|
|
@@ -2996,7 +2996,7 @@ function extractStaticStateCss(srcDir, options = {}) {
|
|
|
2996
2996
|
if (filesScanned >= maxFiles) break;
|
|
2997
2997
|
let source;
|
|
2998
2998
|
try {
|
|
2999
|
-
source =
|
|
2999
|
+
source = fs10__namespace.default.readFileSync(filePath, "utf-8");
|
|
3000
3000
|
} catch {
|
|
3001
3001
|
continue;
|
|
3002
3002
|
}
|
|
@@ -3009,7 +3009,7 @@ function extractStaticStateCss(srcDir, options = {}) {
|
|
|
3009
3009
|
allConfigs.push(...configs);
|
|
3010
3010
|
if (verbose) {
|
|
3011
3011
|
process.stderr.write(
|
|
3012
|
-
`[tw:static-state] ${
|
|
3012
|
+
`[tw:static-state] ${path11__namespace.default.relative(srcDir, filePath)}: ${configs.length} komponen
|
|
3013
3013
|
`
|
|
3014
3014
|
);
|
|
3015
3015
|
}
|
|
@@ -3103,12 +3103,12 @@ function appendStaticStateCssToSafelist(srcDir, safelistPath, options = {}) {
|
|
|
3103
3103
|
resolvedCss: options.resolvedCss || ""
|
|
3104
3104
|
// ← ensure always passed
|
|
3105
3105
|
});
|
|
3106
|
-
const twClassesDir =
|
|
3107
|
-
|
|
3108
|
-
const stateFilePath =
|
|
3106
|
+
const twClassesDir = path11__namespace.default.join(path11__namespace.default.dirname(safelistPath), "tw-classes");
|
|
3107
|
+
fs10__namespace.default.mkdirSync(twClassesDir, { recursive: true });
|
|
3108
|
+
const stateFilePath = path11__namespace.default.join(twClassesDir, TW_STATE_STATIC_FILENAME);
|
|
3109
3109
|
if (result.rulesGenerated === 0) {
|
|
3110
3110
|
try {
|
|
3111
|
-
|
|
3111
|
+
fs10__namespace.default.writeFileSync(
|
|
3112
3112
|
stateFilePath,
|
|
3113
3113
|
"/* tw-state-static.css \u2014 tidak ada state rules yang di-generate */\n",
|
|
3114
3114
|
"utf-8"
|
|
@@ -3118,7 +3118,7 @@ function appendStaticStateCssToSafelist(srcDir, safelistPath, options = {}) {
|
|
|
3118
3118
|
return `[tw:static-state] tidak ada state rules yang di-generate (${result.filesScanned} files di-scan)`;
|
|
3119
3119
|
}
|
|
3120
3120
|
try {
|
|
3121
|
-
|
|
3121
|
+
fs10__namespace.default.writeFileSync(stateFilePath, result.generatedCss, "utf-8");
|
|
3122
3122
|
return [
|
|
3123
3123
|
`[tw:static-state] ${result.rulesGenerated} static state rules di-generate`,
|
|
3124
3124
|
` \u2192 ${result.filesScanned} files scanned, ${result.filesWithStates} dengan states`,
|
|
@@ -3148,8 +3148,8 @@ function setGlobalLogFile(filePath) {
|
|
|
3148
3148
|
_globalLogFile = filePath;
|
|
3149
3149
|
_logFileInitialized = false;
|
|
3150
3150
|
try {
|
|
3151
|
-
|
|
3152
|
-
|
|
3151
|
+
fs10__namespace.default.mkdirSync(path11__namespace.default.dirname(filePath), { recursive: true });
|
|
3152
|
+
fs10__namespace.default.writeFileSync(
|
|
3153
3153
|
filePath,
|
|
3154
3154
|
`# tailwind-styled build log \u2014 ${(/* @__PURE__ */ new Date()).toISOString()}
|
|
3155
3155
|
`,
|
|
@@ -3162,7 +3162,7 @@ function setGlobalLogFile(filePath) {
|
|
|
3162
3162
|
function writeToFile(line) {
|
|
3163
3163
|
if (!_globalLogFile || !_logFileInitialized) return;
|
|
3164
3164
|
try {
|
|
3165
|
-
|
|
3165
|
+
fs10__namespace.default.appendFileSync(_globalLogFile, line);
|
|
3166
3166
|
} catch {
|
|
3167
3167
|
}
|
|
3168
3168
|
}
|
|
@@ -3227,9 +3227,9 @@ function createDebugLogger(namespace, label) {
|
|
|
3227
3227
|
}
|
|
3228
3228
|
};
|
|
3229
3229
|
}
|
|
3230
|
-
function formatIssuePath(
|
|
3231
|
-
if (!
|
|
3232
|
-
return
|
|
3230
|
+
function formatIssuePath(path12) {
|
|
3231
|
+
if (!path12 || path12.length === 0) return "(root)";
|
|
3232
|
+
return path12.map(
|
|
3233
3233
|
(segment) => typeof segment === "symbol" ? segment.description ?? segment.toString() : String(segment)
|
|
3234
3234
|
).join(".");
|
|
3235
3235
|
}
|
|
@@ -3237,9 +3237,9 @@ function loadNativeBinding(options) {
|
|
|
3237
3237
|
const { runtimeDir, candidates, isValid } = options;
|
|
3238
3238
|
const loadErrors = [];
|
|
3239
3239
|
for (const candidate of candidates) {
|
|
3240
|
-
const candidatePath =
|
|
3240
|
+
const candidatePath = path11__namespace.default.resolve(runtimeDir, candidate);
|
|
3241
3241
|
try {
|
|
3242
|
-
if (!
|
|
3242
|
+
if (!fs10__namespace.default.existsSync(candidatePath) && !fs10__namespace.default.existsSync(candidatePath + ".node")) {
|
|
3243
3243
|
continue;
|
|
3244
3244
|
}
|
|
3245
3245
|
const mod = requireNativeModule(candidatePath);
|
|
@@ -3271,9 +3271,9 @@ function resolveNativeBindingCandidates(options) {
|
|
|
3271
3271
|
}
|
|
3272
3272
|
}
|
|
3273
3273
|
if (!includeDefaultCandidates) return candidates;
|
|
3274
|
-
if (
|
|
3274
|
+
if (fs10__namespace.default.existsSync(runtimeDir)) {
|
|
3275
3275
|
try {
|
|
3276
|
-
for (const entry of
|
|
3276
|
+
for (const entry of fs10__namespace.default.readdirSync(runtimeDir)) {
|
|
3277
3277
|
if (entry.endsWith(".node")) candidates.push(entry);
|
|
3278
3278
|
}
|
|
3279
3279
|
} catch {
|
|
@@ -3282,21 +3282,21 @@ function resolveNativeBindingCandidates(options) {
|
|
|
3282
3282
|
const BINARY_NAMES = ["tailwind-styled-native", "tailwind_styled_parser"];
|
|
3283
3283
|
const napiPlatform = process.platform === "linux" && process.arch === "x64" ? "linux-x64-gnu" : process.platform === "linux" && process.arch === "arm64" ? "linux-arm64-gnu" : `${process.platform}-${process.arch}`;
|
|
3284
3284
|
for (const bin of BINARY_NAMES) {
|
|
3285
|
-
candidates.push(
|
|
3286
|
-
candidates.push(
|
|
3287
|
-
candidates.push(
|
|
3288
|
-
candidates.push(
|
|
3289
|
-
candidates.push(
|
|
3290
|
-
candidates.push(
|
|
3291
|
-
candidates.push(
|
|
3292
|
-
candidates.push(
|
|
3293
|
-
candidates.push(
|
|
3285
|
+
candidates.push(path11__namespace.default.resolve(runtimeDir, `${bin}.node`));
|
|
3286
|
+
candidates.push(path11__namespace.default.resolve(runtimeDir, `${bin}.${napiPlatform}.node`));
|
|
3287
|
+
candidates.push(path11__namespace.default.resolve(runtimeDir, "..", "native", `${bin}.node`));
|
|
3288
|
+
candidates.push(path11__namespace.default.resolve(runtimeDir, "..", "native", `${bin}.${napiPlatform}.node`));
|
|
3289
|
+
candidates.push(path11__namespace.default.resolve(process.cwd(), "native", `${bin}.node`));
|
|
3290
|
+
candidates.push(path11__namespace.default.resolve(process.cwd(), "native", `${bin}.${napiPlatform}.node`));
|
|
3291
|
+
candidates.push(path11__namespace.default.resolve(runtimeDir, "..", "..", "..", "..", "native", `${bin}.node`));
|
|
3292
|
+
candidates.push(path11__namespace.default.resolve(runtimeDir, "..", "..", "..", "..", "native", `${bin}.${napiPlatform}.node`));
|
|
3293
|
+
candidates.push(path11__namespace.default.resolve(runtimeDir, "..", "..", "..", "native", `${bin}.node`));
|
|
3294
3294
|
}
|
|
3295
3295
|
return Array.from(new Set(candidates));
|
|
3296
3296
|
}
|
|
3297
3297
|
function resolveRuntimeDir(dir, importMetaUrl) {
|
|
3298
3298
|
try {
|
|
3299
|
-
return
|
|
3299
|
+
return path11__namespace.default.dirname(url.fileURLToPath(importMetaUrl));
|
|
3300
3300
|
} catch {
|
|
3301
3301
|
return process.cwd();
|
|
3302
3302
|
}
|
|
@@ -3341,8 +3341,8 @@ var init_src2 = __esm({
|
|
|
3341
3341
|
/** Buat TwError dari ZodError — dukung shape Zod v3 (`errors`) dan v4 (`issues`). */
|
|
3342
3342
|
static fromZod(err) {
|
|
3343
3343
|
const first = err.issues?.[0] ?? err.errors?.[0];
|
|
3344
|
-
const
|
|
3345
|
-
const message = first ? `${
|
|
3344
|
+
const path12 = formatIssuePath(first?.path);
|
|
3345
|
+
const message = first ? `${path12}: ${first.message}` : "Schema validation failed";
|
|
3346
3346
|
return new _TwError("validation", "SCHEMA_VALIDATION_FAILED", message, err);
|
|
3347
3347
|
}
|
|
3348
3348
|
static wrap(source, code, err) {
|
|
@@ -3398,7 +3398,7 @@ function getDirname() {
|
|
|
3398
3398
|
return __dirname;
|
|
3399
3399
|
}
|
|
3400
3400
|
if (typeof ({ url: (typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('next.js', document.baseURI).href)) }) !== "undefined" && (typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('next.js', document.baseURI).href))) {
|
|
3401
|
-
return
|
|
3401
|
+
return path11__namespace.default.dirname(url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('next.js', document.baseURI).href))));
|
|
3402
3402
|
}
|
|
3403
3403
|
return process.cwd();
|
|
3404
3404
|
}
|
|
@@ -3717,12 +3717,12 @@ init_src2();
|
|
|
3717
3717
|
// packages/domain/scanner/src/cache-native.ts
|
|
3718
3718
|
init_native_bridge();
|
|
3719
3719
|
function defaultCachePath(rootDir, cacheDir) {
|
|
3720
|
-
const dir = cacheDir ?
|
|
3721
|
-
return
|
|
3720
|
+
const dir = cacheDir ? path11__namespace.default.resolve(rootDir, cacheDir) : path11__namespace.default.join(process.cwd(), ".cache", "tailwind-styled");
|
|
3721
|
+
return path11__namespace.default.join(dir, "scanner-cache.json");
|
|
3722
3722
|
}
|
|
3723
3723
|
function readCache(rootDir, cacheDir) {
|
|
3724
3724
|
const cachePath = defaultCachePath(rootDir, cacheDir);
|
|
3725
|
-
|
|
3725
|
+
fs10__namespace.default.mkdirSync(path11__namespace.default.dirname(cachePath), { recursive: true });
|
|
3726
3726
|
const result = cacheReadNative(cachePath);
|
|
3727
3727
|
if (!result) return [];
|
|
3728
3728
|
return result.entries.map((e) => ({
|
|
@@ -3737,7 +3737,7 @@ function readCache(rootDir, cacheDir) {
|
|
|
3737
3737
|
}
|
|
3738
3738
|
function writeCache(rootDir, entries, cacheDir) {
|
|
3739
3739
|
const cachePath = defaultCachePath(rootDir, cacheDir);
|
|
3740
|
-
|
|
3740
|
+
fs10__namespace.default.mkdirSync(path11__namespace.default.dirname(cachePath), { recursive: true });
|
|
3741
3741
|
const success = cacheWriteNative(cachePath, entries);
|
|
3742
3742
|
if (!success) {
|
|
3743
3743
|
throw new Error(
|
|
@@ -3762,12 +3762,12 @@ init_native_bridge();
|
|
|
3762
3762
|
|
|
3763
3763
|
// packages/domain/scanner/src/schemas.ts
|
|
3764
3764
|
init_src2();
|
|
3765
|
-
var formatIssuePath2 = (
|
|
3765
|
+
var formatIssuePath2 = (path12) => path12.length > 0 ? path12.map(
|
|
3766
3766
|
(segment) => typeof segment === "symbol" ? segment.description ?? segment.toString() : String(segment)
|
|
3767
3767
|
).join(".") : "<root>";
|
|
3768
3768
|
var formatIssues2 = (error) => error.issues.map((issue) => {
|
|
3769
|
-
const
|
|
3770
|
-
return `${
|
|
3769
|
+
const path12 = formatIssuePath2(issue.path);
|
|
3770
|
+
return `${path12}: ${issue.message}`;
|
|
3771
3771
|
}).join("; ");
|
|
3772
3772
|
var parseWithSchema2 = (schema, data, label) => {
|
|
3773
3773
|
const parsed = schema.safeParse(data);
|
|
@@ -3827,7 +3827,7 @@ function getRuntimeDir() {
|
|
|
3827
3827
|
return __dirname;
|
|
3828
3828
|
}
|
|
3829
3829
|
if (typeof ({ url: (typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('next.js', document.baseURI).href)) }) !== "undefined" && (typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('next.js', document.baseURI).href))) {
|
|
3830
|
-
return
|
|
3830
|
+
return path11__namespace.default.dirname(url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('next.js', document.baseURI).href))));
|
|
3831
3831
|
}
|
|
3832
3832
|
return process.cwd();
|
|
3833
3833
|
}
|
|
@@ -3842,7 +3842,7 @@ var createNativeParserLoader = () => {
|
|
|
3842
3842
|
const loadNativeParserBinding = () => {
|
|
3843
3843
|
if (_state.binding !== void 0) return _state.binding;
|
|
3844
3844
|
const runtimeDir = getRuntimeDir();
|
|
3845
|
-
const req = module$1.createRequire(
|
|
3845
|
+
const req = module$1.createRequire(path11__namespace.default.join(runtimeDir, "noop.cjs"));
|
|
3846
3846
|
const _platform = process.platform;
|
|
3847
3847
|
const _arch = process.arch;
|
|
3848
3848
|
const _platformArch = `${_platform}-${_arch}`;
|
|
@@ -3850,27 +3850,27 @@ var createNativeParserLoader = () => {
|
|
|
3850
3850
|
const candidates = [
|
|
3851
3851
|
// ── binaryName baru: tailwind-styled-native (napi-rs naming) ──
|
|
3852
3852
|
// cwd = repo root saat run dari root, atau package dir saat workspaces
|
|
3853
|
-
|
|
3854
|
-
|
|
3855
|
-
|
|
3853
|
+
path11__namespace.default.resolve(process.cwd(), "native", "tailwind-styled-native.node"),
|
|
3854
|
+
path11__namespace.default.resolve(process.cwd(), "native", `tailwind-styled-native.${_platformArch}.node`),
|
|
3855
|
+
path11__namespace.default.resolve(process.cwd(), "native", `tailwind-styled-native.${_platformArchGnu}.node`),
|
|
3856
3856
|
// runtimeDir = dist/ → naik 1 level ke package root (npm install case)
|
|
3857
3857
|
// e.g. node_modules/tailwind-styled-v4/dist/ → node_modules/tailwind-styled-v4/native/
|
|
3858
|
-
|
|
3859
|
-
|
|
3860
|
-
|
|
3858
|
+
path11__namespace.default.resolve(runtimeDir, "..", "native", "tailwind-styled-native.node"),
|
|
3859
|
+
path11__namespace.default.resolve(runtimeDir, "..", "native", `tailwind-styled-native.${_platformArch}.node`),
|
|
3860
|
+
path11__namespace.default.resolve(runtimeDir, "..", "native", `tailwind-styled-native.${_platformArchGnu}.node`),
|
|
3861
3861
|
// runtimeDir = dist/ → naik 4 level ke repo root (monorepo dev case)
|
|
3862
|
-
|
|
3863
|
-
|
|
3862
|
+
path11__namespace.default.resolve(runtimeDir, "..", "..", "..", "..", "native", "tailwind-styled-native.node"),
|
|
3863
|
+
path11__namespace.default.resolve(runtimeDir, "..", "..", "..", "..", "native", `tailwind-styled-native.${_platformArchGnu}.node`),
|
|
3864
3864
|
// 3 level fallback (jika package di-nest lebih dangkal)
|
|
3865
|
-
|
|
3866
|
-
|
|
3865
|
+
path11__namespace.default.resolve(runtimeDir, "..", "..", "..", "native", "tailwind-styled-native.node"),
|
|
3866
|
+
path11__namespace.default.resolve(runtimeDir, "..", "..", "..", "native", `tailwind-styled-native.${_platformArchGnu}.node`),
|
|
3867
3867
|
// ── binaryName lama: tailwind_styled_parser (backward compat) ──
|
|
3868
|
-
|
|
3869
|
-
|
|
3870
|
-
|
|
3871
|
-
|
|
3872
|
-
|
|
3873
|
-
|
|
3868
|
+
path11__namespace.default.resolve(process.cwd(), "native/tailwind_styled_parser.node"),
|
|
3869
|
+
path11__namespace.default.resolve(process.cwd(), "native/build/Release/tailwind_styled_parser.node"),
|
|
3870
|
+
path11__namespace.default.resolve(runtimeDir, "..", "native", "tailwind_styled_parser.node"),
|
|
3871
|
+
path11__namespace.default.resolve(runtimeDir, "..", "..", "..", "..", "native", "tailwind_styled_parser.node"),
|
|
3872
|
+
path11__namespace.default.resolve(runtimeDir, "..", "..", "..", "native", "tailwind_styled_parser.node"),
|
|
3873
|
+
path11__namespace.default.resolve(
|
|
3874
3874
|
runtimeDir,
|
|
3875
3875
|
"..",
|
|
3876
3876
|
"..",
|
|
@@ -3882,7 +3882,7 @@ var createNativeParserLoader = () => {
|
|
|
3882
3882
|
)
|
|
3883
3883
|
];
|
|
3884
3884
|
for (const fullPath of candidates) {
|
|
3885
|
-
if (!
|
|
3885
|
+
if (!fs10__namespace.default.existsSync(fullPath)) continue;
|
|
3886
3886
|
try {
|
|
3887
3887
|
const required = req(fullPath);
|
|
3888
3888
|
if (required && (typeof required.extractClassesFromSource === "function" || typeof required.parseClasses === "function" || typeof required.parse_classes === "function")) {
|
|
@@ -3923,19 +3923,19 @@ function collectCandidates(rootDir, ignoreDirectories, extensionSet) {
|
|
|
3923
3923
|
if (!currentDir) continue;
|
|
3924
3924
|
const entries = (() => {
|
|
3925
3925
|
try {
|
|
3926
|
-
return
|
|
3926
|
+
return fs10__namespace.default.readdirSync(currentDir, { withFileTypes: true });
|
|
3927
3927
|
} catch {
|
|
3928
3928
|
return [];
|
|
3929
3929
|
}
|
|
3930
3930
|
})();
|
|
3931
3931
|
for (const entry of entries) {
|
|
3932
|
-
const fullPath =
|
|
3932
|
+
const fullPath = path11__namespace.default.join(currentDir, entry.name);
|
|
3933
3933
|
if (entry.isDirectory()) {
|
|
3934
3934
|
if (!ignoreDirectories.has(entry.name)) directories.push(fullPath);
|
|
3935
3935
|
continue;
|
|
3936
3936
|
}
|
|
3937
3937
|
if (!entry.isFile()) continue;
|
|
3938
|
-
if (!extensionSet.has(
|
|
3938
|
+
if (!extensionSet.has(path11__namespace.default.extname(entry.name))) continue;
|
|
3939
3939
|
candidates.push(fullPath);
|
|
3940
3940
|
}
|
|
3941
3941
|
}
|
|
@@ -4019,7 +4019,7 @@ function scanWorkspace2(rootDir, options = {}) {
|
|
|
4019
4019
|
for (const filePath of candidates) {
|
|
4020
4020
|
const stat = (() => {
|
|
4021
4021
|
try {
|
|
4022
|
-
return
|
|
4022
|
+
return fs10__namespace.default.statSync(filePath);
|
|
4023
4023
|
} catch {
|
|
4024
4024
|
return null;
|
|
4025
4025
|
}
|
|
@@ -4045,7 +4045,7 @@ function scanWorkspace2(rootDir, options = {}) {
|
|
|
4045
4045
|
for (const { filePath, stat, size, cached } of ranked) {
|
|
4046
4046
|
const content = (() => {
|
|
4047
4047
|
try {
|
|
4048
|
-
return
|
|
4048
|
+
return fs10__namespace.default.readFileSync(filePath, "utf8");
|
|
4049
4049
|
} catch {
|
|
4050
4050
|
return null;
|
|
4051
4051
|
}
|
|
@@ -4108,6 +4108,70 @@ function scanWorkspace2(rootDir, options = {}) {
|
|
|
4108
4108
|
|
|
4109
4109
|
// packages/presentation/next/src/withTailwindStyled.ts
|
|
4110
4110
|
init_src2();
|
|
4111
|
+
|
|
4112
|
+
// packages/presentation/next/src/incrementalOrchestrator.ts
|
|
4113
|
+
init_src();
|
|
4114
|
+
var _fingerprintCache = /* @__PURE__ */ new Map();
|
|
4115
|
+
function getNative2() {
|
|
4116
|
+
try {
|
|
4117
|
+
return getNativeBridge();
|
|
4118
|
+
} catch {
|
|
4119
|
+
return null;
|
|
4120
|
+
}
|
|
4121
|
+
}
|
|
4122
|
+
function fingerprintFile(filePath) {
|
|
4123
|
+
try {
|
|
4124
|
+
const stat = fs10__namespace.default.statSync(filePath);
|
|
4125
|
+
const native = getNative2();
|
|
4126
|
+
if (native?.create_fingerprint) {
|
|
4127
|
+
const content = fs10__namespace.default.readFileSync(filePath, "utf-8");
|
|
4128
|
+
const hash = native.create_fingerprint(filePath, content);
|
|
4129
|
+
return { hash, mtime: stat.mtimeMs };
|
|
4130
|
+
}
|
|
4131
|
+
return { hash: `${stat.mtimeMs}-${stat.size}`, mtime: stat.mtimeMs };
|
|
4132
|
+
} catch {
|
|
4133
|
+
return null;
|
|
4134
|
+
}
|
|
4135
|
+
}
|
|
4136
|
+
function hasSourceChanged(sourceFiles) {
|
|
4137
|
+
if (_fingerprintCache.size === 0) {
|
|
4138
|
+
for (const f of sourceFiles) {
|
|
4139
|
+
const fp = fingerprintFile(f);
|
|
4140
|
+
if (fp) _fingerprintCache.set(f, fp);
|
|
4141
|
+
}
|
|
4142
|
+
return true;
|
|
4143
|
+
}
|
|
4144
|
+
let changed = false;
|
|
4145
|
+
for (const f of sourceFiles) {
|
|
4146
|
+
const prev = _fingerprintCache.get(f);
|
|
4147
|
+
const curr = fingerprintFile(f);
|
|
4148
|
+
if (!curr) continue;
|
|
4149
|
+
if (!prev || prev.hash !== curr.hash) {
|
|
4150
|
+
changed = true;
|
|
4151
|
+
_fingerprintCache.set(f, curr);
|
|
4152
|
+
}
|
|
4153
|
+
}
|
|
4154
|
+
for (const f of sourceFiles) {
|
|
4155
|
+
if (!_fingerprintCache.has(f)) {
|
|
4156
|
+
const fp = fingerprintFile(f);
|
|
4157
|
+
if (fp) {
|
|
4158
|
+
_fingerprintCache.set(f, fp);
|
|
4159
|
+
changed = true;
|
|
4160
|
+
}
|
|
4161
|
+
}
|
|
4162
|
+
}
|
|
4163
|
+
return changed;
|
|
4164
|
+
}
|
|
4165
|
+
function isIncrementalEnabled(cwd) {
|
|
4166
|
+
try {
|
|
4167
|
+
const configPath = path11__namespace.default.join(cwd, "tailwind-styled.config.json");
|
|
4168
|
+
if (!fs10__namespace.default.existsSync(configPath)) return false;
|
|
4169
|
+
const config = JSON.parse(fs10__namespace.default.readFileSync(configPath, "utf-8"));
|
|
4170
|
+
return config.compiler?.incremental === true;
|
|
4171
|
+
} catch {
|
|
4172
|
+
return false;
|
|
4173
|
+
}
|
|
4174
|
+
}
|
|
4111
4175
|
var _fileStaticCssMap = /* @__PURE__ */ new Map();
|
|
4112
4176
|
function setFileStaticCss(filepath, css) {
|
|
4113
4177
|
if (css && css.trim()) {
|
|
@@ -4141,14 +4205,14 @@ var StaticCssWebpackPlugin = class _StaticCssWebpackPlugin {
|
|
|
4141
4205
|
static PLUGIN_NAME = "TailwindStyledStaticCss";
|
|
4142
4206
|
outPath;
|
|
4143
4207
|
constructor(safelistPath) {
|
|
4144
|
-
this.outPath =
|
|
4208
|
+
this.outPath = path11__namespace.default.join(path11__namespace.default.dirname(safelistPath), "_tw-state-static.css");
|
|
4145
4209
|
}
|
|
4146
4210
|
apply(compiler) {
|
|
4147
4211
|
compiler.hooks.done.tap(_StaticCssWebpackPlugin.PLUGIN_NAME, () => {
|
|
4148
4212
|
try {
|
|
4149
4213
|
const content = buildContent(_fileStaticCssMap);
|
|
4150
|
-
|
|
4151
|
-
|
|
4214
|
+
fs10__namespace.default.mkdirSync(path11__namespace.default.dirname(this.outPath), { recursive: true });
|
|
4215
|
+
fs10__namespace.default.writeFileSync(
|
|
4152
4216
|
this.outPath,
|
|
4153
4217
|
HEADER + (content || "/* no static rules yet */") + "\n",
|
|
4154
4218
|
"utf-8"
|
|
@@ -4182,12 +4246,12 @@ var resolveLoaderPath2 = (basename) => {
|
|
|
4182
4246
|
} catch {
|
|
4183
4247
|
const runtimeDir = resolveRuntimeDir2();
|
|
4184
4248
|
const candidates = [
|
|
4185
|
-
|
|
4186
|
-
|
|
4187
|
-
|
|
4249
|
+
path11__namespace.default.resolve(runtimeDir, `${basename}.mjs`),
|
|
4250
|
+
path11__namespace.default.resolve(runtimeDir, `${basename}.js`),
|
|
4251
|
+
path11__namespace.default.resolve(runtimeDir, `${basename}.cjs`)
|
|
4188
4252
|
];
|
|
4189
4253
|
for (const candidate of candidates) {
|
|
4190
|
-
if (
|
|
4254
|
+
if (fs10__namespace.default.existsSync(candidate)) {
|
|
4191
4255
|
return candidate;
|
|
4192
4256
|
}
|
|
4193
4257
|
}
|
|
@@ -4225,7 +4289,7 @@ var createLoaderOptions = (options) => {
|
|
|
4225
4289
|
preserveImports: true
|
|
4226
4290
|
};
|
|
4227
4291
|
if (options.verbose !== void 0) opts.verbose = options.verbose;
|
|
4228
|
-
opts.safelistPath = options.safelistPath ??
|
|
4292
|
+
opts.safelistPath = options.safelistPath ?? path11__namespace.default.join(process.cwd(), ".next", "tailwind-styled-safelist.css");
|
|
4229
4293
|
return Object.freeze(opts);
|
|
4230
4294
|
};
|
|
4231
4295
|
var buildTurbopackRules = (loaderPath, loaderOptions) => {
|
|
@@ -4238,7 +4302,7 @@ var buildTurbopackRules = (loaderPath, loaderOptions) => {
|
|
|
4238
4302
|
])
|
|
4239
4303
|
);
|
|
4240
4304
|
};
|
|
4241
|
-
var normalizeLoaderPath = (loaderPath) =>
|
|
4305
|
+
var normalizeLoaderPath = (loaderPath) => path11__namespace.default.resolve(loaderPath);
|
|
4242
4306
|
var applyWebpackRule = (config, options, loaderPath) => {
|
|
4243
4307
|
const loaderOptions = createLoaderOptions(options);
|
|
4244
4308
|
const rules = config.module?.rules ?? [];
|
|
@@ -4255,7 +4319,7 @@ var applyWebpackRule = (config, options, loaderPath) => {
|
|
|
4255
4319
|
enforce: "pre",
|
|
4256
4320
|
use: [{ loader: loaderPath, options: loaderOptions }]
|
|
4257
4321
|
};
|
|
4258
|
-
const safelistPath = loaderOptions.safelistPath ??
|
|
4322
|
+
const safelistPath = loaderOptions.safelistPath ?? path11__namespace.default.join(process.cwd(), ".next", "tailwind-styled-safelist.css");
|
|
4259
4323
|
const pluginAlreadyRegistered = (config.plugins ?? []).some(
|
|
4260
4324
|
(p) => p?.constructor?.name === StaticCssWebpackPlugin.PLUGIN_NAME
|
|
4261
4325
|
);
|
|
@@ -4355,17 +4419,17 @@ function withTailwindStyled(options = {}) {
|
|
|
4355
4419
|
return fullCss.slice(startIdx, endIdx + 1);
|
|
4356
4420
|
};
|
|
4357
4421
|
var extractUtilitiesLayer = extractUtilitiesLayer2;
|
|
4358
|
-
const twClassesDir =
|
|
4359
|
-
|
|
4360
|
-
setGlobalLogFile(
|
|
4361
|
-
|
|
4362
|
-
|
|
4422
|
+
const twClassesDir = path11__namespace.default.join(path11__namespace.default.dirname(safelistPath), "tw-classes");
|
|
4423
|
+
fs10__namespace.default.mkdirSync(twClassesDir, { recursive: true });
|
|
4424
|
+
setGlobalLogFile(path11__namespace.default.join(twClassesDir, "_tw-build.log"));
|
|
4425
|
+
fs10__namespace.default.writeFileSync(
|
|
4426
|
+
path11__namespace.default.join(twClassesDir, "_start.txt"),
|
|
4363
4427
|
String(Date.now()),
|
|
4364
4428
|
"utf-8"
|
|
4365
4429
|
);
|
|
4366
|
-
const stateStaticPath =
|
|
4430
|
+
const stateStaticPath = path11__namespace.default.join(twClassesDir, TW_STATE_STATIC_FILENAME);
|
|
4367
4431
|
try {
|
|
4368
|
-
|
|
4432
|
+
fs10__namespace.default.writeFileSync(
|
|
4369
4433
|
stateStaticPath,
|
|
4370
4434
|
"/* tw-state-static.css \u2014 placeholder, akan di-generate setelah scan */\n",
|
|
4371
4435
|
"utf-8"
|
|
@@ -4381,14 +4445,14 @@ function withTailwindStyled(options = {}) {
|
|
|
4381
4445
|
"src/index.css",
|
|
4382
4446
|
"styles/globals.css"
|
|
4383
4447
|
];
|
|
4384
|
-
const safelistDir =
|
|
4448
|
+
const safelistDir = path11__namespace.default.dirname(safelistPath);
|
|
4385
4449
|
for (const candidate of CSS_CANDIDATES) {
|
|
4386
|
-
const candidatePath =
|
|
4387
|
-
if (!
|
|
4388
|
-
const content =
|
|
4450
|
+
const candidatePath = path11__namespace.default.join(process.cwd(), candidate);
|
|
4451
|
+
if (!fs10__namespace.default.existsSync(candidatePath)) continue;
|
|
4452
|
+
const content = fs10__namespace.default.readFileSync(candidatePath, "utf-8");
|
|
4389
4453
|
if (content.includes("_tw-state-static.css")) break;
|
|
4390
|
-
const globalsDir =
|
|
4391
|
-
const rel =
|
|
4454
|
+
const globalsDir = path11__namespace.default.dirname(candidatePath);
|
|
4455
|
+
const rel = path11__namespace.default.relative(globalsDir, stateStaticPath).replace(/\\/g, "/");
|
|
4392
4456
|
const importLine = `@import "./${rel}";`;
|
|
4393
4457
|
const tailwindImportRe = /(@import\s+["']tailwindcss["']\s*;[^\n]*\n?)/;
|
|
4394
4458
|
let updated;
|
|
@@ -4402,7 +4466,7 @@ function withTailwindStyled(options = {}) {
|
|
|
4402
4466
|
updated = `${importLine}
|
|
4403
4467
|
${content}`;
|
|
4404
4468
|
}
|
|
4405
|
-
|
|
4469
|
+
fs10__namespace.default.writeFileSync(candidatePath, updated, "utf-8");
|
|
4406
4470
|
if (options.verbose) {
|
|
4407
4471
|
console.log(
|
|
4408
4472
|
`[tailwind-styled] Auto-injected "${importLine}" into ${candidate}`
|
|
@@ -4414,27 +4478,27 @@ ${content}`;
|
|
|
4414
4478
|
}
|
|
4415
4479
|
if (!process.env.TW_NATIVE_PATH) {
|
|
4416
4480
|
const runtimeDir = resolveRuntimeDir2();
|
|
4417
|
-
const nativePath =
|
|
4418
|
-
if (
|
|
4481
|
+
const nativePath = path11__namespace.default.resolve(runtimeDir, "..", "native", "tailwind-styled-native.node");
|
|
4482
|
+
if (fs10__namespace.default.existsSync(nativePath)) {
|
|
4419
4483
|
process.env.TW_NATIVE_PATH = nativePath;
|
|
4420
4484
|
}
|
|
4421
4485
|
}
|
|
4422
|
-
const srcDir =
|
|
4423
|
-
if (
|
|
4486
|
+
const srcDir = path11__namespace.default.join(process.cwd(), "src");
|
|
4487
|
+
if (fs10__namespace.default.existsSync(srcDir)) {
|
|
4424
4488
|
try {
|
|
4425
4489
|
const result = scanWorkspace2(srcDir);
|
|
4426
4490
|
if (result.uniqueClasses.length > 0) {
|
|
4427
4491
|
let atomicWriteFile2 = function(filePath, content) {
|
|
4428
4492
|
const tmpPath = `${filePath}.tmp`;
|
|
4429
4493
|
try {
|
|
4430
|
-
|
|
4431
|
-
|
|
4494
|
+
fs10__namespace.default.writeFileSync(tmpPath, content, "utf-8");
|
|
4495
|
+
fs10__namespace.default.renameSync(tmpPath, filePath);
|
|
4432
4496
|
} catch {
|
|
4433
4497
|
try {
|
|
4434
|
-
|
|
4498
|
+
fs10__namespace.default.unlinkSync(tmpPath);
|
|
4435
4499
|
} catch {
|
|
4436
4500
|
}
|
|
4437
|
-
|
|
4501
|
+
fs10__namespace.default.writeFileSync(filePath, content, "utf-8");
|
|
4438
4502
|
}
|
|
4439
4503
|
};
|
|
4440
4504
|
var atomicWriteFile = atomicWriteFile2;
|
|
@@ -4497,14 +4561,14 @@ ${content}`;
|
|
|
4497
4561
|
"styles/globals.css"
|
|
4498
4562
|
];
|
|
4499
4563
|
try {
|
|
4500
|
-
const twConfigPath =
|
|
4501
|
-
if (
|
|
4502
|
-
const twConfig = JSON.parse(
|
|
4564
|
+
const twConfigPath = path11__namespace.default.join(process.cwd(), "tailwind-styled.config.json");
|
|
4565
|
+
if (fs10__namespace.default.existsSync(twConfigPath)) {
|
|
4566
|
+
const twConfig = JSON.parse(fs10__namespace.default.readFileSync(twConfigPath, "utf-8"));
|
|
4503
4567
|
const cssEntry = twConfig.css?.entry;
|
|
4504
4568
|
if (cssEntry) {
|
|
4505
|
-
const cssEntryPath =
|
|
4506
|
-
if (
|
|
4507
|
-
cssEntryContent =
|
|
4569
|
+
const cssEntryPath = path11__namespace.default.join(process.cwd(), cssEntry);
|
|
4570
|
+
if (fs10__namespace.default.existsSync(cssEntryPath)) {
|
|
4571
|
+
cssEntryContent = fs10__namespace.default.readFileSync(cssEntryPath, "utf-8");
|
|
4508
4572
|
}
|
|
4509
4573
|
}
|
|
4510
4574
|
}
|
|
@@ -4512,9 +4576,9 @@ ${content}`;
|
|
|
4512
4576
|
}
|
|
4513
4577
|
if (!cssEntryContent) {
|
|
4514
4578
|
for (const candidate of CSS_CANDIDATES) {
|
|
4515
|
-
const candidatePath =
|
|
4516
|
-
if (
|
|
4517
|
-
cssEntryContent =
|
|
4579
|
+
const candidatePath = path11__namespace.default.join(process.cwd(), candidate);
|
|
4580
|
+
if (fs10__namespace.default.existsSync(candidatePath)) {
|
|
4581
|
+
cssEntryContent = fs10__namespace.default.readFileSync(candidatePath, "utf-8");
|
|
4518
4582
|
break;
|
|
4519
4583
|
}
|
|
4520
4584
|
}
|
|
@@ -4522,46 +4586,52 @@ ${content}`;
|
|
|
4522
4586
|
if (cssEntryContent) {
|
|
4523
4587
|
cssEntryContent = cssEntryContent.replace(/@source\s+["'][^"']+["']\s*;?\s*/g, "").replace(/←[^\n]*/g, "").trim();
|
|
4524
4588
|
}
|
|
4525
|
-
const initialScanPath =
|
|
4526
|
-
if (!
|
|
4589
|
+
const initialScanPath = path11__namespace.default.join(twClassesDir, "_initial-scan.css");
|
|
4590
|
+
if (!fs10__namespace.default.existsSync(initialScanPath)) {
|
|
4527
4591
|
atomicWriteFile2(
|
|
4528
4592
|
initialScanPath,
|
|
4529
4593
|
"/* tw-classes: initial scan \u2014 generating... */\n@layer utilities {}\n"
|
|
4530
4594
|
);
|
|
4531
4595
|
}
|
|
4532
|
-
|
|
4533
|
-
|
|
4534
|
-
|
|
4535
|
-
|
|
4536
|
-
|
|
4537
|
-
|
|
4538
|
-
|
|
4539
|
-
|
|
4540
|
-
|
|
4541
|
-
|
|
4542
|
-
|
|
4543
|
-
|
|
4544
|
-
|
|
4545
|
-
|
|
4546
|
-
|
|
4547
|
-
|
|
4548
|
-
|
|
4596
|
+
const sourceFiles = result.files?.map((f) => f.file) ?? [];
|
|
4597
|
+
const incremental = isIncrementalEnabled(process.cwd());
|
|
4598
|
+
if (incremental && fs10__namespace.default.existsSync(initialScanPath) && !hasSourceChanged(sourceFiles)) {
|
|
4599
|
+
if (options.verbose) console.log("[tailwind-styled] Incremental: tidak ada perubahan, skip regenerate CSS");
|
|
4600
|
+
} else {
|
|
4601
|
+
void (async () => {
|
|
4602
|
+
try {
|
|
4603
|
+
const compiler = await Promise.resolve().then(() => (init_src(), src_exports));
|
|
4604
|
+
const generateCssForClasses2 = compiler.generateCssForClasses;
|
|
4605
|
+
const css = await generateCssForClasses2(
|
|
4606
|
+
filteredClasses,
|
|
4607
|
+
{},
|
|
4608
|
+
process.cwd(),
|
|
4609
|
+
cssEntryContent ?? void 0,
|
|
4610
|
+
process.env.NODE_ENV === "production"
|
|
4611
|
+
// minify hanya di production
|
|
4612
|
+
);
|
|
4613
|
+
if (css) {
|
|
4614
|
+
const utilitiesOnly = extractUtilitiesLayer2(css);
|
|
4615
|
+
atomicWriteFile2(
|
|
4616
|
+
initialScanPath,
|
|
4617
|
+
`/* tw-classes: initial scan \u2014 auto-generated by withTailwindStyled */
|
|
4549
4618
|
${utilitiesOnly}`
|
|
4619
|
+
);
|
|
4620
|
+
const summary = appendStaticStateCssToSafelist(srcDir, safelistPath, {
|
|
4621
|
+
verbose: options.verbose ?? false,
|
|
4622
|
+
resolvedCss: css
|
|
4623
|
+
});
|
|
4624
|
+
if (options.verbose) console.log(summary);
|
|
4625
|
+
}
|
|
4626
|
+
} catch (err) {
|
|
4627
|
+
throw new Error(
|
|
4628
|
+
`[tailwind-styled] generateCssForClasses gagal \u2014 build-time CSS generation wajib berhasil.
|
|
4629
|
+
${err.message}`,
|
|
4630
|
+
{ cause: err }
|
|
4550
4631
|
);
|
|
4551
|
-
const summary = appendStaticStateCssToSafelist(srcDir, safelistPath, {
|
|
4552
|
-
verbose: options.verbose ?? false,
|
|
4553
|
-
resolvedCss: css
|
|
4554
|
-
});
|
|
4555
|
-
if (options.verbose) console.log(summary);
|
|
4556
4632
|
}
|
|
4557
|
-
}
|
|
4558
|
-
|
|
4559
|
-
`[tailwind-styled] generateCssForClasses gagal \u2014 build-time CSS generation wajib berhasil.
|
|
4560
|
-
${err.message}`,
|
|
4561
|
-
{ cause: err }
|
|
4562
|
-
);
|
|
4563
|
-
}
|
|
4564
|
-
})();
|
|
4633
|
+
})();
|
|
4634
|
+
}
|
|
4565
4635
|
}
|
|
4566
4636
|
} catch (e) {
|
|
4567
4637
|
throw new Error(
|