tailwind-styled-v4 5.0.8 → 5.0.10
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/CHANGELOG.md +204 -416
- package/README.md +45 -15
- package/dist/{analyzeWorkspace-DuJKh7Ty.d.mts → analyzeWorkspace-BS5O4rhC.d.mts} +47 -2
- package/dist/{analyzeWorkspace-Ct_NTAWt.d.ts → analyzeWorkspace-DDOQdzzI.d.ts} +47 -2
- package/dist/analyzer.d.mts +5 -3
- package/dist/analyzer.d.ts +5 -3
- package/dist/analyzer.js +563 -468
- package/dist/analyzer.js.map +1 -1
- package/dist/analyzer.mjs +562 -467
- package/dist/analyzer.mjs.map +1 -1
- package/dist/animate.d.mts +4 -7
- package/dist/animate.d.ts +4 -7
- package/dist/animate.js +171 -265
- package/dist/animate.js.map +1 -1
- package/dist/animate.mjs +165 -264
- package/dist/animate.mjs.map +1 -1
- package/dist/atomic.d.mts +22 -1
- package/dist/atomic.d.ts +22 -1
- package/dist/atomic.js +221 -165
- package/dist/atomic.js.map +1 -1
- package/dist/atomic.mjs +200 -165
- package/dist/atomic.mjs.map +1 -1
- package/dist/cli.d.mts +60 -1
- package/dist/cli.d.ts +60 -1
- package/dist/cli.js +1261 -1517
- package/dist/cli.js.map +1 -1
- package/dist/cli.mjs +1238 -1513
- package/dist/cli.mjs.map +1 -1
- package/dist/compiler.d.mts +38 -7
- package/dist/compiler.d.ts +38 -7
- package/dist/compiler.js +174 -197
- package/dist/compiler.js.map +1 -1
- package/dist/compiler.mjs +151 -194
- package/dist/compiler.mjs.map +1 -1
- package/dist/devtools.js +7 -31
- package/dist/devtools.js.map +1 -1
- package/dist/devtools.mjs +7 -31
- package/dist/devtools.mjs.map +1 -1
- package/dist/engine.d.mts +134 -63
- package/dist/engine.d.ts +134 -63
- package/dist/engine.js +2863 -2482
- package/dist/engine.js.map +1 -1
- package/dist/engine.mjs +2852 -2485
- package/dist/engine.mjs.map +1 -1
- package/dist/{index-eWAocnD2.d.mts → index-NDINUhLN.d.mts} +3 -1
- package/dist/{index-eWAocnD2.d.ts → index-NDINUhLN.d.ts} +3 -1
- package/dist/index.d.mts +63 -32
- package/dist/index.d.ts +63 -32
- package/dist/index.js +335 -169
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +315 -169
- package/dist/index.mjs.map +1 -1
- package/dist/{liveTokenEngine-DSUk88P6.d.ts → liveTokenEngine-CN9ian1R.d.ts} +1 -1
- package/dist/{liveTokenEngine-CX5_0c4q.d.mts → liveTokenEngine-DKoWRtqH.d.mts} +1 -1
- package/dist/next.d.mts +10 -4
- package/dist/next.d.ts +10 -4
- package/dist/next.js +32 -45
- package/dist/next.js.map +1 -1
- package/dist/next.mjs +30 -43
- package/dist/next.mjs.map +1 -1
- package/dist/plugin-api.d.mts +8 -2
- package/dist/plugin-api.d.ts +8 -2
- package/dist/plugin-api.js +14 -2
- package/dist/plugin-api.js.map +1 -1
- package/dist/plugin-api.mjs +14 -3
- package/dist/plugin-api.mjs.map +1 -1
- package/dist/plugin-registry.js +51 -11
- package/dist/plugin-registry.js.map +1 -1
- package/dist/plugin-registry.mjs +51 -11
- package/dist/plugin-registry.mjs.map +1 -1
- package/dist/plugin.d.mts +5 -7
- package/dist/plugin.d.ts +5 -7
- package/dist/plugin.js +16 -15
- package/dist/plugin.js.map +1 -1
- package/dist/plugin.mjs +16 -16
- package/dist/plugin.mjs.map +1 -1
- package/dist/rspack.js +17 -38
- package/dist/rspack.js.map +1 -1
- package/dist/rspack.mjs +15 -36
- package/dist/rspack.mjs.map +1 -1
- package/dist/runtime.d.mts +2 -2
- package/dist/runtime.d.ts +2 -2
- package/dist/scanner.d.mts +10 -1
- package/dist/scanner.d.ts +10 -1
- package/dist/scanner.js +298 -124
- package/dist/scanner.js.map +1 -1
- package/dist/scanner.mjs +296 -124
- package/dist/scanner.mjs.map +1 -1
- package/dist/shared.d.mts +1 -1
- package/dist/shared.d.ts +1 -1
- package/dist/shared.js +104 -176
- package/dist/shared.js.map +1 -1
- package/dist/shared.mjs +85 -176
- package/dist/shared.mjs.map +1 -1
- package/dist/storybook-addon.d.mts +1 -1
- package/dist/storybook-addon.d.ts +1 -1
- package/dist/svelte.d.mts +1 -1
- package/dist/svelte.d.ts +1 -1
- package/dist/svelte.js +166 -3
- package/dist/svelte.js.map +1 -1
- package/dist/svelte.mjs +143 -1
- package/dist/svelte.mjs.map +1 -1
- package/dist/syntax.js +21 -21
- package/dist/syntax.js.map +1 -1
- package/dist/syntax.mjs +21 -21
- package/dist/syntax.mjs.map +1 -1
- package/dist/testing.js +9 -1
- package/dist/testing.js.map +1 -1
- package/dist/testing.mjs +9 -1
- package/dist/testing.mjs.map +1 -1
- package/dist/theme.d.mts +2 -2
- package/dist/theme.d.ts +2 -2
- package/dist/theme.js +40 -112
- package/dist/theme.js.map +1 -1
- package/dist/theme.mjs +37 -110
- package/dist/theme.mjs.map +1 -1
- package/dist/turbopackLoader.js +84 -126
- package/dist/turbopackLoader.js.map +1 -1
- package/dist/turbopackLoader.mjs +68 -124
- package/dist/turbopackLoader.mjs.map +1 -1
- package/dist/tw.js +1256 -1517
- package/dist/tw.js.map +1 -1
- package/dist/tw.mjs +1236 -1513
- package/dist/tw.mjs.map +1 -1
- package/dist/vite.js +1783 -823
- package/dist/vite.js.map +1 -1
- package/dist/vite.mjs +1767 -821
- package/dist/vite.mjs.map +1 -1
- package/dist/vue.d.mts +1 -1
- package/dist/vue.d.ts +1 -1
- package/dist/vue.js +165 -4
- package/dist/vue.js.map +1 -1
- package/dist/vue.mjs +141 -1
- package/dist/vue.mjs.map +1 -1
- package/dist/webpackLoader.js +69 -108
- package/dist/webpackLoader.js.map +1 -1
- package/dist/webpackLoader.mjs +49 -104
- package/dist/webpackLoader.mjs.map +1 -1
- package/native/tailwind-styled-native.node +0 -0
- package/package.json +22 -24
package/dist/turbopackLoader.js
CHANGED
|
@@ -1,14 +1,32 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var module$1 = require('module');
|
|
4
|
-
var
|
|
4
|
+
var fs3 = require('fs');
|
|
5
5
|
var path = require('path');
|
|
6
|
+
require('crypto');
|
|
7
|
+
var url = require('url');
|
|
6
8
|
|
|
7
9
|
var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
|
|
8
|
-
function
|
|
10
|
+
function _interopNamespace(e) {
|
|
11
|
+
if (e && e.__esModule) return e;
|
|
12
|
+
var n = Object.create(null);
|
|
13
|
+
if (e) {
|
|
14
|
+
Object.keys(e).forEach(function (k) {
|
|
15
|
+
if (k !== 'default') {
|
|
16
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
17
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
18
|
+
enumerable: true,
|
|
19
|
+
get: function () { return e[k]; }
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
n.default = e;
|
|
25
|
+
return Object.freeze(n);
|
|
26
|
+
}
|
|
9
27
|
|
|
10
|
-
var
|
|
11
|
-
var
|
|
28
|
+
var fs3__namespace = /*#__PURE__*/_interopNamespace(fs3);
|
|
29
|
+
var path__namespace = /*#__PURE__*/_interopNamespace(path);
|
|
12
30
|
|
|
13
31
|
/* tailwind-styled-v4 v5.0.4 | MIT | https://github.com/dictionar32/tailwind-styled-v4 */
|
|
14
32
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
@@ -21,45 +39,6 @@ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require
|
|
|
21
39
|
var __esm = (fn, res) => function __init() {
|
|
22
40
|
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
23
41
|
};
|
|
24
|
-
|
|
25
|
-
// packages/domain/shared/src/native-resolution.ts
|
|
26
|
-
function getNodeModuleRef() {
|
|
27
|
-
if (isBrowser) return null;
|
|
28
|
-
if (nodeModuleRef !== null) return nodeModuleRef;
|
|
29
|
-
try {
|
|
30
|
-
const test = typeof __require === "function" ? __require("module") : null;
|
|
31
|
-
nodeModuleRef = test;
|
|
32
|
-
return test;
|
|
33
|
-
} catch {
|
|
34
|
-
nodeModuleRef = null;
|
|
35
|
-
return null;
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
function getNodeFs() {
|
|
39
|
-
if (isBrowser) return { existsSync: () => false };
|
|
40
|
-
const nodeRequire = getNodeModuleRef();
|
|
41
|
-
if (!nodeRequire) return { existsSync: () => false };
|
|
42
|
-
if (!_nodeFs) _nodeFs = nodeRequire.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('turbopackLoader.js', document.baseURI).href)))("node:fs");
|
|
43
|
-
return _nodeFs;
|
|
44
|
-
}
|
|
45
|
-
function getNodePath() {
|
|
46
|
-
if (isBrowser) return { resolve: () => "", dirname: "" };
|
|
47
|
-
const nodeRequire = getNodeModuleRef();
|
|
48
|
-
if (!nodeRequire) return { resolve: () => "", dirname: "" };
|
|
49
|
-
if (!_nodePath) _nodePath = nodeRequire.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('turbopackLoader.js', document.baseURI).href)))("node:path");
|
|
50
|
-
return _nodePath;
|
|
51
|
-
}
|
|
52
|
-
function getRequire(_importMetaUrl) {
|
|
53
|
-
if (isBrowser) return () => {
|
|
54
|
-
throw new Error("node:module not available");
|
|
55
|
-
};
|
|
56
|
-
const nodeRequire = getNodeModuleRef();
|
|
57
|
-
if (!nodeRequire) return () => {
|
|
58
|
-
throw new Error("require not available");
|
|
59
|
-
};
|
|
60
|
-
if (!_require) _require = nodeRequire.createRequire(_importMetaUrl);
|
|
61
|
-
return _require;
|
|
62
|
-
}
|
|
63
42
|
function platformKey() {
|
|
64
43
|
if (isBrowser) return "browser";
|
|
65
44
|
return `${process.platform}-${process.arch}`;
|
|
@@ -70,24 +49,21 @@ function resolveNativeBinary(runtimeDir) {
|
|
|
70
49
|
if (isBrowser) {
|
|
71
50
|
return { path: null, source: "not-found", platform, tried: ["not available in browser"] };
|
|
72
51
|
}
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
52
|
+
if (process.env.TWS_DISABLE_NATIVE === "1") {
|
|
53
|
+
return { path: null, source: "not-found", platform, tried: [] };
|
|
54
|
+
}
|
|
76
55
|
const envPath = process.env.TW_NATIVE_PATH?.trim();
|
|
77
56
|
if (envPath) {
|
|
78
|
-
if (
|
|
57
|
+
if (fs3__namespace.existsSync(envPath)) {
|
|
79
58
|
return { path: envPath, source: "env", platform, tried };
|
|
80
59
|
}
|
|
81
60
|
tried.push(`env:${envPath} (not found)`);
|
|
82
61
|
}
|
|
83
|
-
if (process.env.TWS_NO_NATIVE === "1" || process.env.TWS_NO_RUST === "1" || process.env.TWS_DISABLE_NATIVE === "1") {
|
|
84
|
-
return { path: null, source: "not-found", platform, tried: ["disabled by env"] };
|
|
85
|
-
}
|
|
86
62
|
const prebuiltPkgs = PLATFORM_MAP[platform] ?? [];
|
|
87
63
|
for (const pkg of prebuiltPkgs) {
|
|
88
64
|
try {
|
|
89
|
-
const candidate =
|
|
90
|
-
if (
|
|
65
|
+
const candidate = _require.resolve(`${pkg}/tailwind_styled_parser.node`);
|
|
66
|
+
if (fs3__namespace.existsSync(candidate)) {
|
|
91
67
|
return { path: candidate, source: "prebuilt", platform, tried };
|
|
92
68
|
}
|
|
93
69
|
tried.push(`prebuilt:${pkg} (resolved but missing)`);
|
|
@@ -97,30 +73,43 @@ function resolveNativeBinary(runtimeDir) {
|
|
|
97
73
|
}
|
|
98
74
|
const cwd = process.cwd();
|
|
99
75
|
const base = runtimeDir ?? cwd;
|
|
100
|
-
const
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
76
|
+
const napiPlatform = platform === "linux-x64" ? "linux-x64-gnu" : platform === "linux-arm64" ? "linux-arm64-gnu" : platform;
|
|
77
|
+
const BINARY_NAMES = ["tailwind-styled-native", "tailwind_styled_parser"];
|
|
78
|
+
const localCandidates = [];
|
|
79
|
+
for (const bin of BINARY_NAMES) {
|
|
80
|
+
localCandidates.push(path__namespace.resolve(base, `${bin}.node`));
|
|
81
|
+
localCandidates.push(path__namespace.resolve(base, "..", `${bin}.node`));
|
|
82
|
+
localCandidates.push(path__namespace.resolve(base, `${bin}.${platform}.node`));
|
|
83
|
+
localCandidates.push(path__namespace.resolve(base, `${bin}.${napiPlatform}.node`));
|
|
84
|
+
}
|
|
85
|
+
for (const startDir of [cwd, base]) {
|
|
86
|
+
let dir = startDir;
|
|
87
|
+
for (let i = 0; i < 6; i++) {
|
|
88
|
+
const nativeDir = path__namespace.resolve(dir, "native");
|
|
89
|
+
for (const bin of BINARY_NAMES) {
|
|
90
|
+
localCandidates.push(path__namespace.resolve(nativeDir, `${bin}.node`));
|
|
91
|
+
localCandidates.push(path__namespace.resolve(nativeDir, `${bin}.${platform}.node`));
|
|
92
|
+
localCandidates.push(path__namespace.resolve(nativeDir, `${bin}.${napiPlatform}.node`));
|
|
93
|
+
localCandidates.push(path__namespace.resolve(nativeDir, "target", "release", `${bin}.node`));
|
|
94
|
+
}
|
|
95
|
+
const parent = path__namespace.resolve(dir, "..");
|
|
96
|
+
if (parent === dir) break;
|
|
97
|
+
dir = parent;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
108
100
|
for (const candidate of localCandidates) {
|
|
109
101
|
tried.push(`local:${candidate}`);
|
|
110
|
-
if (
|
|
102
|
+
if (fs3__namespace.existsSync(candidate)) {
|
|
111
103
|
return { path: candidate, source: "local", platform, tried };
|
|
112
104
|
}
|
|
113
105
|
}
|
|
114
106
|
return { path: null, source: "not-found", platform, tried };
|
|
115
107
|
}
|
|
116
|
-
var isBrowser,
|
|
108
|
+
var isBrowser, _require, PLATFORM_MAP;
|
|
117
109
|
var init_native_resolution = __esm({
|
|
118
110
|
"packages/domain/shared/src/native-resolution.ts"() {
|
|
119
111
|
isBrowser = typeof window !== "undefined" || typeof document !== "undefined";
|
|
120
|
-
|
|
121
|
-
_nodeFs = null;
|
|
122
|
-
_nodePath = null;
|
|
123
|
-
_require = null;
|
|
112
|
+
_require = typeof __require !== "undefined" ? __require : module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('turbopackLoader.js', document.baseURI).href)));
|
|
124
113
|
PLATFORM_MAP = {
|
|
125
114
|
"linux-x64": ["@tailwind-styled/native-linux-x64"],
|
|
126
115
|
"linux-arm64": ["@tailwind-styled/native-linux-arm64"],
|
|
@@ -131,59 +120,26 @@ var init_native_resolution = __esm({
|
|
|
131
120
|
};
|
|
132
121
|
}
|
|
133
122
|
});
|
|
134
|
-
|
|
135
|
-
// packages/domain/shared/src/index.ts
|
|
136
|
-
function getNodeModuleRef2() {
|
|
137
|
-
if (isBrowser2) return null;
|
|
138
|
-
if (nodeModuleRef2 !== null) return nodeModuleRef2;
|
|
139
|
-
try {
|
|
140
|
-
const test = typeof __require === "function" ? __require("module") : null;
|
|
141
|
-
nodeModuleRef2 = test;
|
|
142
|
-
return test;
|
|
143
|
-
} catch {
|
|
144
|
-
nodeModuleRef2 = null;
|
|
145
|
-
return null;
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
function getNodeUrl() {
|
|
149
|
-
if (isBrowser2) throw new Error("node:url not available in browser");
|
|
150
|
-
const nodeRequire = getNodeModuleRef2();
|
|
151
|
-
if (!nodeRequire) throw new Error("require not available");
|
|
152
|
-
if (!_nodeUrl) _nodeUrl = nodeRequire.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('turbopackLoader.js', document.baseURI).href)))("node:url");
|
|
153
|
-
return _nodeUrl;
|
|
154
|
-
}
|
|
155
|
-
function getRequire2() {
|
|
156
|
-
if (isBrowser2) return (() => {
|
|
157
|
-
throw new Error("require not available in browser");
|
|
158
|
-
});
|
|
159
|
-
const nodeRequire = getNodeModuleRef2();
|
|
160
|
-
if (!nodeRequire) return (() => {
|
|
161
|
-
throw new Error("require not available");
|
|
162
|
-
});
|
|
163
|
-
return nodeRequire.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('turbopackLoader.js', document.baseURI).href)));
|
|
164
|
-
}
|
|
165
123
|
function resolveRuntimeDir(dir, importMetaUrl) {
|
|
166
|
-
if (isBrowser2) return "";
|
|
167
124
|
try {
|
|
168
|
-
return
|
|
125
|
+
return path__namespace.default.dirname(url.fileURLToPath(importMetaUrl));
|
|
169
126
|
} catch {
|
|
170
127
|
return process.cwd();
|
|
171
128
|
}
|
|
172
129
|
}
|
|
173
|
-
var isBrowser2, nodeModuleRef2, _nodeUrl;
|
|
174
130
|
var init_src = __esm({
|
|
175
131
|
"packages/domain/shared/src/index.ts"() {
|
|
176
132
|
init_native_resolution();
|
|
177
|
-
|
|
178
|
-
nodeModuleRef2 = null;
|
|
179
|
-
_nodeUrl = null;
|
|
180
|
-
getRequire2();
|
|
133
|
+
module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('turbopackLoader.js', document.baseURI).href)));
|
|
181
134
|
}
|
|
182
135
|
});
|
|
183
|
-
|
|
136
|
+
|
|
137
|
+
// packages/domain/compiler/src/nativeBridge.ts
|
|
138
|
+
var _loadNative, log, NATIVE_UNAVAILABLE_MESSAGE, nativeBridge, bridgeLoadAttempted, bridgeLoadError, isValidNativeBridge, getNativeBridge;
|
|
184
139
|
var init_nativeBridge = __esm({
|
|
185
140
|
"packages/domain/compiler/src/nativeBridge.ts"() {
|
|
186
141
|
init_src();
|
|
142
|
+
_loadNative = (path4) => __require(path4);
|
|
187
143
|
log = (...args) => {
|
|
188
144
|
if (process.env.DEBUG?.includes("compiler:native")) {
|
|
189
145
|
console.log("[compiler:native]", ...args);
|
|
@@ -210,11 +166,10 @@ var init_nativeBridge = __esm({
|
|
|
210
166
|
bridgeLoadAttempted = true;
|
|
211
167
|
try {
|
|
212
168
|
const runtimeDir = resolveRuntimeDir(void 0, (typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('turbopackLoader.js', document.baseURI).href)));
|
|
213
|
-
const require2 = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('turbopackLoader.js', document.baseURI).href)));
|
|
214
169
|
const result = resolveNativeBinary(runtimeDir);
|
|
215
170
|
if (result.path && result.path.endsWith(".node")) {
|
|
216
171
|
try {
|
|
217
|
-
const binding =
|
|
172
|
+
const binding = _loadNative(result.path);
|
|
218
173
|
if (isValidNativeBridge(binding)) {
|
|
219
174
|
nativeBridge = binding;
|
|
220
175
|
log("Native bridge loaded successfully from:", result.path);
|
|
@@ -264,7 +219,7 @@ var runLoaderTransform = (ctx) => {
|
|
|
264
219
|
classes: result?.classes || []
|
|
265
220
|
};
|
|
266
221
|
};
|
|
267
|
-
var registerFileClasses = (
|
|
222
|
+
var registerFileClasses = (_filepath, _classes) => {
|
|
268
223
|
};
|
|
269
224
|
function parseBool(val, fallback = false) {
|
|
270
225
|
if (typeof val === "boolean") return val;
|
|
@@ -282,10 +237,13 @@ function detectRouter(resourcePath) {
|
|
|
282
237
|
if (/\/pages\//.test(normalized)) return "pages";
|
|
283
238
|
return "unknown";
|
|
284
239
|
}
|
|
240
|
+
var NEXT_RSC_ENTRIES = /(?:^|[\\/])(?:layout|page|loading|error|not-found|template|default)\.[jt]sx?$/;
|
|
285
241
|
function isSkippable(resourcePath) {
|
|
286
242
|
const normalized = resourcePath.replace(/\\/g, "/");
|
|
287
243
|
return normalized.includes("/node_modules/") || normalized.endsWith(".d.ts") || normalized.endsWith(".d.mts") || normalized.endsWith(".d.cts") || // Skip CSS/assets
|
|
288
|
-
/\.(css|scss|sass|less|svg|png|jpg|jpeg|gif|webp|ico|woff|woff2|ttf|eot)$/.test(normalized)
|
|
244
|
+
/\.(css|scss|sass|less|svg|png|jpg|jpeg|gif|webp|ico|woff|woff2|ttf|eot)$/.test(normalized) || // Skip Next.js RSC entry files — Turbopack tidak punya exclude di rule level,
|
|
245
|
+
// jadi guard ini menggantikan NEXT_RSC_ENTRIES exclude yang ada di webpack path.
|
|
246
|
+
NEXT_RSC_ENTRIES.test(normalized);
|
|
289
247
|
}
|
|
290
248
|
function extractDirective(source) {
|
|
291
249
|
const match = source.match(/^(\s*["'](use client|use server)["']\s*;?\s*\n?)/);
|
|
@@ -298,29 +256,29 @@ var CYCLE_SENTINEL = "_cycle.txt";
|
|
|
298
256
|
var START_SENTINEL = "_start.txt";
|
|
299
257
|
var _workerCache = /* @__PURE__ */ new Map();
|
|
300
258
|
function getTwClassesDir(safelistPath) {
|
|
301
|
-
return
|
|
259
|
+
return path__namespace.default.join(path__namespace.default.dirname(safelistPath), "tw-classes");
|
|
302
260
|
}
|
|
303
261
|
function readSentinel(filePath) {
|
|
304
262
|
try {
|
|
305
|
-
return
|
|
263
|
+
return fs3__namespace.default.readFileSync(filePath, "utf-8").trim();
|
|
306
264
|
} catch {
|
|
307
265
|
return "";
|
|
308
266
|
}
|
|
309
267
|
}
|
|
310
268
|
function clearAndMarkCycle(twClassesDir, startId) {
|
|
311
269
|
try {
|
|
312
|
-
if (
|
|
313
|
-
for (const file of
|
|
270
|
+
if (fs3__namespace.default.existsSync(twClassesDir)) {
|
|
271
|
+
for (const file of fs3__namespace.default.readdirSync(twClassesDir)) {
|
|
314
272
|
if (file === START_SENTINEL || file === "_webpack-merged.css") continue;
|
|
315
273
|
try {
|
|
316
|
-
|
|
274
|
+
fs3__namespace.default.unlinkSync(path__namespace.default.join(twClassesDir, file));
|
|
317
275
|
} catch {
|
|
318
276
|
}
|
|
319
277
|
}
|
|
320
278
|
} else {
|
|
321
|
-
|
|
279
|
+
fs3__namespace.default.mkdirSync(twClassesDir, { recursive: true });
|
|
322
280
|
}
|
|
323
|
-
|
|
281
|
+
fs3__namespace.default.writeFileSync(path__namespace.default.join(twClassesDir, CYCLE_SENTINEL), startId, "utf-8");
|
|
324
282
|
_workerCache.set(twClassesDir, startId);
|
|
325
283
|
} catch {
|
|
326
284
|
}
|
|
@@ -328,32 +286,32 @@ function clearAndMarkCycle(twClassesDir, startId) {
|
|
|
328
286
|
function getPerFileSafelistPath(safelistDir, resourcePath) {
|
|
329
287
|
const normalized = resourcePath.replace(/\\/g, "/");
|
|
330
288
|
const slug = normalized.replace(/^.*\/src\//, "").replace(/\.[tj]sx?$/, "").replace(/[^a-zA-Z0-9]/g, "_").slice(0, 80);
|
|
331
|
-
return
|
|
289
|
+
return path__namespace.default.join(safelistDir, `${slug}.css`);
|
|
332
290
|
}
|
|
333
291
|
function writePerFileSafelist(safelistPath, resourcePath, classes) {
|
|
334
292
|
if (!safelistPath || classes.length === 0) return;
|
|
335
293
|
try {
|
|
336
294
|
const twClassesDir = getTwClassesDir(safelistPath);
|
|
337
|
-
const startId = readSentinel(
|
|
338
|
-
const cachedCycle = _workerCache.get(twClassesDir) ?? readSentinel(
|
|
295
|
+
const startId = readSentinel(path__namespace.default.join(twClassesDir, START_SENTINEL));
|
|
296
|
+
const cachedCycle = _workerCache.get(twClassesDir) ?? readSentinel(path__namespace.default.join(twClassesDir, CYCLE_SENTINEL));
|
|
339
297
|
if (startId && cachedCycle !== startId) {
|
|
340
298
|
clearAndMarkCycle(twClassesDir, startId);
|
|
341
|
-
} else if (!
|
|
342
|
-
|
|
299
|
+
} else if (!fs3__namespace.default.existsSync(twClassesDir)) {
|
|
300
|
+
fs3__namespace.default.mkdirSync(twClassesDir, { recursive: true });
|
|
343
301
|
}
|
|
344
302
|
const outPath = getPerFileSafelistPath(twClassesDir, resourcePath);
|
|
345
303
|
const sorted = [...new Set(classes)].sort();
|
|
346
304
|
const css = [
|
|
347
|
-
`/* tw-safelist: ${
|
|
305
|
+
`/* tw-safelist: ${path__namespace.default.basename(resourcePath)} \u2014 auto-generated */`,
|
|
348
306
|
"@layer utilities {",
|
|
349
307
|
sorted.map((cls) => `.${cls.replace(/([^a-zA-Z0-9_-])/g, "\\$1")} {}`).join("\n"),
|
|
350
308
|
"}"
|
|
351
309
|
].join("\n");
|
|
352
310
|
try {
|
|
353
|
-
if (
|
|
311
|
+
if (fs3__namespace.default.readFileSync(outPath, "utf-8") === css) return;
|
|
354
312
|
} catch {
|
|
355
313
|
}
|
|
356
|
-
|
|
314
|
+
fs3__namespace.default.writeFileSync(outPath, css, "utf-8");
|
|
357
315
|
} catch {
|
|
358
316
|
}
|
|
359
317
|
}
|
|
@@ -362,7 +320,7 @@ function turbopackLoader(source, options = {}) {
|
|
|
362
320
|
const router = detectRouter(this.resourcePath);
|
|
363
321
|
const nextMajor = parseNum(options.nextMajor);
|
|
364
322
|
const debug = parseBool(options.debug);
|
|
365
|
-
const filename =
|
|
323
|
+
const filename = path__namespace.default.basename(this.resourcePath);
|
|
366
324
|
const effective = {
|
|
367
325
|
addDataAttr: parseBool(options.addDataAttr),
|
|
368
326
|
// App Router: selalu auto-detect client boundary
|
|
@@ -383,7 +341,7 @@ function turbopackLoader(source, options = {}) {
|
|
|
383
341
|
source: stripped,
|
|
384
342
|
options: effective
|
|
385
343
|
});
|
|
386
|
-
if (!output.changed
|
|
344
|
+
if (!output.changed) return source;
|
|
387
345
|
if (output.classes.length > 0) {
|
|
388
346
|
registerFileClasses(this.resourcePath, output.classes);
|
|
389
347
|
writePerFileSafelist(options.safelistPath, this.resourcePath, output.classes);
|