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