@tamagui/static 2.0.0-rc.4 → 2.0.0-rc.40

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 (185) hide show
  1. package/dist/check-dep-versions.cjs +201 -96
  2. package/dist/checkDeps.cjs +250 -46
  3. package/dist/constants.cjs +32 -30
  4. package/dist/exports.cjs +18 -13
  5. package/dist/extractor/accessSafe.cjs +25 -23
  6. package/dist/extractor/babelParse.cjs +30 -28
  7. package/dist/extractor/buildClassName.cjs +59 -35
  8. package/dist/extractor/bundle.cjs +177 -101
  9. package/dist/extractor/bundleConfig.cjs +554 -167
  10. package/dist/extractor/concatClassName.cjs +41 -29
  11. package/dist/extractor/createEvaluator.cjs +54 -41
  12. package/dist/extractor/createExtractor.cjs +1400 -581
  13. package/dist/extractor/createLogger.cjs +30 -25
  14. package/dist/extractor/detectModuleFormat.cjs +55 -0
  15. package/dist/extractor/ensureImportingConcat.cjs +31 -25
  16. package/dist/extractor/errors.cjs +12 -10
  17. package/dist/extractor/esbuildAliasPlugin.cjs +28 -16
  18. package/dist/extractor/esbuildTsconfigPaths.cjs +60 -36
  19. package/dist/extractor/evaluateAstNode.cjs +104 -59
  20. package/dist/extractor/extractHelpers.cjs +130 -67
  21. package/dist/extractor/extractMediaStyle.cjs +110 -69
  22. package/dist/extractor/extractToClassNames.cjs +337 -229
  23. package/dist/extractor/extractToNative.cjs +248 -154
  24. package/dist/extractor/findTopmostFunction.cjs +22 -13
  25. package/dist/extractor/generatedUid.cjs +39 -28
  26. package/dist/extractor/getPrefixLogs.cjs +12 -10
  27. package/dist/extractor/getPropValueFromAttributes.cjs +52 -34
  28. package/dist/extractor/getSourceModule.cjs +73 -37
  29. package/dist/extractor/getStaticBindingsForScope.cjs +131 -68
  30. package/dist/extractor/getTamaguiConfigPathFromOptionsConfig.cjs +20 -14
  31. package/dist/extractor/hasTopLevelAwait.cjs +62 -0
  32. package/dist/extractor/hoistClassNames.cjs +46 -32
  33. package/dist/extractor/literalToAst.cjs +67 -42
  34. package/dist/extractor/loadFile.cjs +9 -3
  35. package/dist/extractor/loadTamagui.cjs +149 -104
  36. package/dist/extractor/logLines.cjs +27 -19
  37. package/dist/extractor/normalizeTernaries.cjs +66 -44
  38. package/dist/extractor/propsToFontFamilyCache.cjs +15 -11
  39. package/dist/extractor/regenerateConfig.cjs +109 -81
  40. package/dist/extractor/removeUnusedHooks.cjs +73 -41
  41. package/dist/extractor/timer.cjs +23 -14
  42. package/dist/extractor/validHTMLAttributes.cjs +61 -59
  43. package/dist/extractor/watchTamaguiConfig.cjs +35 -23
  44. package/dist/getPragmaOptions.cjs +38 -19
  45. package/dist/helpers/memoize.cjs +24 -16
  46. package/dist/helpers/requireTamaguiCore.cjs +22 -15
  47. package/dist/index.cjs +26 -24
  48. package/dist/registerRequire.cjs +167 -65
  49. package/dist/server.cjs +35 -28
  50. package/dist/types.cjs +7 -5
  51. package/dist/worker.cjs +62 -40
  52. package/package.json +26 -22
  53. package/src/checkDeps.ts +305 -68
  54. package/src/exports.ts +1 -0
  55. package/src/extractor/babelParse.ts +1 -0
  56. package/src/extractor/bundle.ts +140 -37
  57. package/src/extractor/bundleConfig.ts +435 -61
  58. package/src/extractor/createExtractor.ts +283 -48
  59. package/src/extractor/detectModuleFormat.ts +42 -0
  60. package/src/extractor/esbuildTsconfigPaths.ts +6 -1
  61. package/src/extractor/extractToClassNames.ts +15 -9
  62. package/src/extractor/extractToNative.ts +66 -33
  63. package/src/extractor/hasTopLevelAwait.ts +28 -0
  64. package/src/extractor/loadTamagui.ts +2 -2
  65. package/src/getPragmaOptions.ts +6 -1
  66. package/src/registerRequire.ts +88 -8
  67. package/types/checkDeps.d.ts.map +1 -1
  68. package/types/exports.d.ts +1 -0
  69. package/types/exports.d.ts.map +1 -1
  70. package/types/extractor/babelParse.d.ts.map +1 -1
  71. package/types/extractor/bundle.d.ts +83 -1
  72. package/types/extractor/bundle.d.ts.map +1 -1
  73. package/types/extractor/bundleConfig.d.ts +15 -2
  74. package/types/extractor/bundleConfig.d.ts.map +1 -1
  75. package/types/extractor/createExtractor.d.ts.map +1 -1
  76. package/types/extractor/detectModuleFormat.d.ts +5 -0
  77. package/types/extractor/detectModuleFormat.d.ts.map +1 -0
  78. package/types/extractor/esbuildTsconfigPaths.d.ts +8 -0
  79. package/types/extractor/esbuildTsconfigPaths.d.ts.map +1 -1
  80. package/types/extractor/extractToClassNames.d.ts.map +1 -1
  81. package/types/extractor/extractToNative.d.ts.map +1 -1
  82. package/types/extractor/hasTopLevelAwait.d.ts +2 -0
  83. package/types/extractor/hasTopLevelAwait.d.ts.map +1 -0
  84. package/types/getPragmaOptions.d.ts.map +1 -1
  85. package/types/registerRequire.d.ts.map +1 -1
  86. package/dist/check-dep-versions.js +0 -389
  87. package/dist/check-dep-versions.js.map +0 -6
  88. package/dist/checkDeps.js +0 -60
  89. package/dist/checkDeps.js.map +0 -6
  90. package/dist/constants.js +0 -34
  91. package/dist/constants.js.map +0 -6
  92. package/dist/exports.js +0 -34
  93. package/dist/exports.js.map +0 -6
  94. package/dist/extractor/accessSafe.js +0 -47
  95. package/dist/extractor/accessSafe.js.map +0 -6
  96. package/dist/extractor/babelParse.js +0 -59
  97. package/dist/extractor/babelParse.js.map +0 -6
  98. package/dist/extractor/buildClassName.js +0 -72
  99. package/dist/extractor/buildClassName.js.map +0 -6
  100. package/dist/extractor/bundle.js +0 -135
  101. package/dist/extractor/bundle.js.map +0 -6
  102. package/dist/extractor/bundleConfig.js +0 -352
  103. package/dist/extractor/bundleConfig.js.map +0 -6
  104. package/dist/extractor/concatClassName.js +0 -69
  105. package/dist/extractor/concatClassName.js.map +0 -6
  106. package/dist/extractor/createEvaluator.js +0 -66
  107. package/dist/extractor/createEvaluator.js.map +0 -6
  108. package/dist/extractor/createExtractor.js +0 -1215
  109. package/dist/extractor/createExtractor.js.map +0 -6
  110. package/dist/extractor/createLogger.js +0 -32
  111. package/dist/extractor/createLogger.js.map +0 -6
  112. package/dist/extractor/ensureImportingConcat.js +0 -50
  113. package/dist/extractor/ensureImportingConcat.js.map +0 -6
  114. package/dist/extractor/errors.js +0 -22
  115. package/dist/extractor/errors.js.map +0 -6
  116. package/dist/extractor/esbuildAliasPlugin.js +0 -36
  117. package/dist/extractor/esbuildAliasPlugin.js.map +0 -6
  118. package/dist/extractor/esbuildTsconfigPaths.js +0 -79
  119. package/dist/extractor/esbuildTsconfigPaths.js.map +0 -6
  120. package/dist/extractor/evaluateAstNode.js +0 -99
  121. package/dist/extractor/evaluateAstNode.js.map +0 -6
  122. package/dist/extractor/extractHelpers.js +0 -108
  123. package/dist/extractor/extractHelpers.js.map +0 -6
  124. package/dist/extractor/extractMediaStyle.js +0 -123
  125. package/dist/extractor/extractMediaStyle.js.map +0 -6
  126. package/dist/extractor/extractToClassNames.js +0 -351
  127. package/dist/extractor/extractToClassNames.js.map +0 -6
  128. package/dist/extractor/extractToNative.js +0 -286
  129. package/dist/extractor/extractToNative.js.map +0 -6
  130. package/dist/extractor/findTopmostFunction.js +0 -32
  131. package/dist/extractor/findTopmostFunction.js.map +0 -6
  132. package/dist/extractor/generatedUid.js +0 -42
  133. package/dist/extractor/generatedUid.js.map +0 -6
  134. package/dist/extractor/getPrefixLogs.js +0 -24
  135. package/dist/extractor/getPrefixLogs.js.map +0 -6
  136. package/dist/extractor/getPropValueFromAttributes.js +0 -65
  137. package/dist/extractor/getPropValueFromAttributes.js.map +0 -6
  138. package/dist/extractor/getSourceModule.js +0 -62
  139. package/dist/extractor/getSourceModule.js.map +0 -6
  140. package/dist/extractor/getStaticBindingsForScope.js +0 -145
  141. package/dist/extractor/getStaticBindingsForScope.js.map +0 -6
  142. package/dist/extractor/getTamaguiConfigPathFromOptionsConfig.js +0 -32
  143. package/dist/extractor/getTamaguiConfigPathFromOptionsConfig.js.map +0 -6
  144. package/dist/extractor/hoistClassNames.js +0 -63
  145. package/dist/extractor/hoistClassNames.js.map +0 -6
  146. package/dist/extractor/literalToAst.js +0 -90
  147. package/dist/extractor/literalToAst.js.map +0 -6
  148. package/dist/extractor/loadFile.js +0 -14
  149. package/dist/extractor/loadFile.js.map +0 -6
  150. package/dist/extractor/loadTamagui.js +0 -306
  151. package/dist/extractor/loadTamagui.js.map +0 -6
  152. package/dist/extractor/logLines.js +0 -30
  153. package/dist/extractor/logLines.js.map +0 -6
  154. package/dist/extractor/normalizeTernaries.js +0 -61
  155. package/dist/extractor/normalizeTernaries.js.map +0 -6
  156. package/dist/extractor/propsToFontFamilyCache.js +0 -33
  157. package/dist/extractor/propsToFontFamilyCache.js.map +0 -6
  158. package/dist/extractor/regenerateConfig.js +0 -123
  159. package/dist/extractor/regenerateConfig.js.map +0 -6
  160. package/dist/extractor/removeUnusedHooks.js +0 -72
  161. package/dist/extractor/removeUnusedHooks.js.map +0 -6
  162. package/dist/extractor/timer.js +0 -38
  163. package/dist/extractor/timer.js.map +0 -6
  164. package/dist/extractor/validHTMLAttributes.js +0 -72
  165. package/dist/extractor/validHTMLAttributes.js.map +0 -6
  166. package/dist/extractor/watchTamaguiConfig.js +0 -57
  167. package/dist/extractor/watchTamaguiConfig.js.map +0 -6
  168. package/dist/getPragmaOptions.js +0 -46
  169. package/dist/getPragmaOptions.js.map +0 -6
  170. package/dist/helpers/memoize.js +0 -33
  171. package/dist/helpers/memoize.js.map +0 -6
  172. package/dist/helpers/requireTamaguiCore.js +0 -30
  173. package/dist/helpers/requireTamaguiCore.js.map +0 -6
  174. package/dist/index.js +0 -30
  175. package/dist/index.js.map +0 -6
  176. package/dist/registerRequire.js +0 -100
  177. package/dist/registerRequire.js.map +0 -6
  178. package/dist/server.js +0 -58
  179. package/dist/server.js.map +0 -6
  180. package/dist/setup.js +0 -1
  181. package/dist/setup.js.map +0 -6
  182. package/dist/types.js +0 -14
  183. package/dist/types.js.map +0 -6
  184. package/dist/worker.js +0 -72
  185. package/dist/worker.js.map +0 -6
@@ -3,20 +3,22 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
3
  var __getOwnPropNames = Object.getOwnPropertyNames;
4
4
  var __hasOwnProp = Object.prototype.hasOwnProperty;
5
5
  var __export = (target, all) => {
6
- for (var name in all) __defProp(target, name, {
7
- get: all[name],
8
- enumerable: !0
9
- });
10
- },
11
- __copyProps = (to, from, except, desc) => {
12
- if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
6
+ for (var name in all) __defProp(target, name, {
7
+ get: all[name],
8
+ enumerable: true
9
+ });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
13
14
  get: () => from[key],
14
15
  enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
15
16
  });
16
- return to;
17
- };
17
+ }
18
+ return to;
19
+ };
18
20
  var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
19
- value: !0
21
+ value: true
20
22
  }), mod);
21
23
  var checkDeps_exports = {};
22
24
  __export(checkDeps_exports, {
@@ -24,44 +26,246 @@ __export(checkDeps_exports, {
24
26
  checkDeps: () => checkDeps
25
27
  });
26
28
  module.exports = __toCommonJS(checkDeps_exports);
27
- var import_node_fs = require("node:fs"),
28
- import_node_path = require("node:path"),
29
- import_check_dep_versions = require("./check-dep-versions.cjs"),
30
- DEPENDENCY_TYPE = /* @__PURE__ */(DEPENDENCY_TYPE2 => (DEPENDENCY_TYPE2.dependencies = "dependencies", DEPENDENCY_TYPE2.devDependencies = "devDependencies", DEPENDENCY_TYPE2.optionalDependencies = "optionalDependencies", DEPENDENCY_TYPE2.peerDependencies = "peerDependencies", DEPENDENCY_TYPE2.resolutions = "resolutions", DEPENDENCY_TYPE2))(DEPENDENCY_TYPE || {});
31
- function checkTamaguiPackageVersions(root) {
32
- const packageJsonPath = (0, import_node_path.join)(root, "package.json");
33
- if (!(0, import_node_fs.existsSync)(packageJsonPath)) return "";
34
- const packageJson = JSON.parse((0, import_node_fs.readFileSync)(packageJsonPath, "utf8")),
35
- tamaguiDeps = [],
36
- allDeps = {
37
- ...packageJson.dependencies,
38
- ...packageJson.devDependencies,
39
- ...packageJson.optionalDependencies
40
- };
41
- for (const [name, version] of Object.entries(allDeps)) (name === "tamagui" || name.startsWith("@tamagui/")) && tamaguiDeps.push({
42
- name,
43
- version
44
- });
45
- if (tamaguiDeps.length <= 1) return "";
46
- const normalizeVersion = v => v.startsWith("workspace:") ? v : v.replace(/^[\^~>=<]+/, ""),
47
- versionGroups = /* @__PURE__ */new Map();
48
- for (const dep of tamaguiDeps) {
49
- const normalized = normalizeVersion(dep.version);
50
- versionGroups.has(normalized) || versionGroups.set(normalized, []), versionGroups.get(normalized).push(`${dep.name}@${dep.version}`);
29
+ var import_node_fs = require("node:fs");
30
+ var import_node_path = require("node:path");
31
+ var import_check_dep_versions = require("./check-dep-versions.cjs");
32
+ var DEPENDENCY_TYPE = /* @__PURE__ */(DEPENDENCY_TYPE2 => {
33
+ DEPENDENCY_TYPE2["dependencies"] = "dependencies";
34
+ DEPENDENCY_TYPE2["devDependencies"] = "devDependencies";
35
+ DEPENDENCY_TYPE2["optionalDependencies"] = "optionalDependencies";
36
+ DEPENDENCY_TYPE2["peerDependencies"] = "peerDependencies";
37
+ DEPENDENCY_TYPE2["resolutions"] = "resolutions";
38
+ return DEPENDENCY_TYPE2;
39
+ })(DEPENDENCY_TYPE || {});
40
+ const CRITICAL_PACKAGES = ["@tamagui/web", "@tamagui/core", "tamagui"];
41
+ function checkDuplicateInstalls(root) {
42
+ const nodeModules = (0, import_node_path.join)(root, "node_modules");
43
+ if (!(0, import_node_fs.existsSync)(nodeModules)) return "";
44
+ const duplicates = /* @__PURE__ */new Map();
45
+ for (const pkg of CRITICAL_PACKAGES) {
46
+ const locations = findAllInstances(nodeModules, pkg);
47
+ if (locations.length > 1) {
48
+ const realPaths = /* @__PURE__ */new Set();
49
+ const distinctLocations = [];
50
+ for (const loc of locations) {
51
+ try {
52
+ const real = (0, import_node_fs.realpathSync)(loc);
53
+ if (!realPaths.has(real)) {
54
+ realPaths.add(real);
55
+ distinctLocations.push((0, import_node_path.relative)(root, loc));
56
+ }
57
+ } catch {
58
+ distinctLocations.push((0, import_node_path.relative)(root, loc));
59
+ }
60
+ }
61
+ if (distinctLocations.length > 1) {
62
+ duplicates.set(pkg, distinctLocations);
63
+ }
64
+ }
65
+ }
66
+ if (duplicates.size === 0) return "";
67
+ const lines = ["Found duplicate tamagui installations in node_modules:", "", "This causes multiple runtime instances, which breaks theme/config detection.", ""];
68
+ for (const [pkg, locations] of duplicates) {
69
+ lines.push(` ${pkg}:`);
70
+ for (const loc of locations) {
71
+ const pkgJsonPath = (0, import_node_path.join)(root, loc, "package.json");
72
+ let version = "?";
73
+ try {
74
+ version = JSON.parse((0, import_node_fs.readFileSync)(pkgJsonPath, "utf8")).version;
75
+ } catch {}
76
+ lines.push(` ${version} at ${loc}`);
77
+ }
78
+ lines.push("");
79
+ }
80
+ lines.push("Fix: run your package manager's dedupe command:");
81
+ lines.push(" bun install (bun auto-dedupes)");
82
+ lines.push(" npx yarn-deduplicate && yarn install");
83
+ lines.push(" npm dedupe");
84
+ lines.push("");
85
+ lines.push("If that doesn't help, delete node_modules and lockfile, then reinstall.");
86
+ return lines.join("\n");
87
+ }
88
+ function findAllInstances(nodeModulesDir, packageName, found = [], depth = 0) {
89
+ if (depth > 4 || !(0, import_node_fs.existsSync)(nodeModulesDir)) return found;
90
+ const pkgDir = (0, import_node_path.join)(nodeModulesDir, ...packageName.split("/"));
91
+ if ((0, import_node_fs.existsSync)((0, import_node_path.join)(pkgDir, "package.json"))) {
92
+ found.push(pkgDir);
93
+ }
94
+ try {
95
+ const entries = (0, import_node_fs.readdirSync)(nodeModulesDir);
96
+ for (const entry of entries) {
97
+ if (entry.startsWith(".")) continue;
98
+ if (entry.startsWith("@")) {
99
+ const scopeDir = (0, import_node_path.join)(nodeModulesDir, entry);
100
+ try {
101
+ const scopeEntries = (0, import_node_fs.readdirSync)(scopeDir);
102
+ for (const scopeEntry of scopeEntries) {
103
+ const nested = (0, import_node_path.join)(scopeDir, scopeEntry, "node_modules");
104
+ if ((0, import_node_fs.existsSync)(nested)) {
105
+ findAllInstances(nested, packageName, found, depth + 1);
106
+ }
107
+ }
108
+ } catch {}
109
+ } else {
110
+ const nested = (0, import_node_path.join)(nodeModulesDir, entry, "node_modules");
111
+ if ((0, import_node_fs.existsSync)(nested)) {
112
+ findAllInstances(nested, packageName, found, depth + 1);
113
+ }
114
+ }
115
+ }
116
+ } catch {}
117
+ return found;
118
+ }
119
+ function checkLockfileDuplicates(root) {
120
+ const bunLock = (0, import_node_path.join)(root, "bun.lock");
121
+ const yarnLock = (0, import_node_path.join)(root, "yarn.lock");
122
+ const npmLock = (0, import_node_path.join)(root, "package-lock.json");
123
+ if ((0, import_node_fs.existsSync)(bunLock)) return checkBunLockDuplicates(bunLock);
124
+ if ((0, import_node_fs.existsSync)(yarnLock)) return checkYarnLockDuplicates(yarnLock);
125
+ if ((0, import_node_fs.existsSync)(npmLock)) return checkNpmLockDuplicates(npmLock);
126
+ return "";
127
+ }
128
+ function checkBunLockDuplicates(lockPath) {
129
+ try {
130
+ const content = (0, import_node_fs.readFileSync)(lockPath, "utf8");
131
+ const duplicates = /* @__PURE__ */new Map();
132
+ const criticalSet = new Set(CRITICAL_PACKAGES);
133
+ const packagePattern = /["'](@tamagui\/[\w-]+|tamagui)@([^"'\s,]+)["']/g;
134
+ let match;
135
+ while ((match = packagePattern.exec(content)) !== null) {
136
+ const name = match[1];
137
+ const version = match[2];
138
+ if (version.startsWith("workspace:")) continue;
139
+ if (!criticalSet.has(name)) continue;
140
+ if (!duplicates.has(name)) duplicates.set(name, /* @__PURE__ */new Set());
141
+ duplicates.get(name).add(version);
142
+ }
143
+ return formatLockfileDuplicates(duplicates, "bun.lock");
144
+ } catch {
145
+ return "";
51
146
  }
52
- if (versionGroups.size <= 1) return "";
53
- const lines = ["Found mismatched @tamagui/* package versions in package.json:", ""];
54
- for (const [version, packages] of versionGroups) {
55
- lines.push(` ${version}:`);
56
- for (const pkg of packages.sort()) lines.push(` - ${pkg}`);
147
+ }
148
+ function checkYarnLockDuplicates(lockPath) {
149
+ try {
150
+ const content = (0, import_node_fs.readFileSync)(lockPath, "utf8");
151
+ const duplicates = /* @__PURE__ */new Map();
152
+ const criticalSet = new Set(CRITICAL_PACKAGES);
153
+ const entryPattern = /^"?(@tamagui\/[\w-]+|tamagui)@[^":\n]+[":]?\s*$/gm;
154
+ const versionPattern = /^\s+version\s+"([^"]+)"/gm;
155
+ let entryMatch;
156
+ while ((entryMatch = entryPattern.exec(content)) !== null) {
157
+ const name = entryMatch[1];
158
+ if (!criticalSet.has(name)) continue;
159
+ versionPattern.lastIndex = entryMatch.index;
160
+ const verMatch = versionPattern.exec(content);
161
+ if (verMatch) {
162
+ if (!duplicates.has(name)) duplicates.set(name, /* @__PURE__ */new Set());
163
+ duplicates.get(name).add(verMatch[1]);
164
+ }
165
+ }
166
+ return formatLockfileDuplicates(duplicates, "yarn.lock");
167
+ } catch {
168
+ return "";
57
169
  }
58
- return lines.push(""), lines.push("All @tamagui/* packages should use the same version to avoid runtime issues."), lines.push("Run `npx tamagui upgrade` to sync all packages to the latest version."), lines.join(`
59
- `);
170
+ }
171
+ function checkNpmLockDuplicates(lockPath) {
172
+ try {
173
+ const lock = JSON.parse((0, import_node_fs.readFileSync)(lockPath, "utf8"));
174
+ const duplicates = /* @__PURE__ */new Map();
175
+ const criticalSet = new Set(CRITICAL_PACKAGES);
176
+ const packages = lock.packages || {};
177
+ for (const [path, info] of Object.entries(packages)) {
178
+ if (!path) continue;
179
+ const name = info.name || path.split("node_modules/").pop();
180
+ if (!name) continue;
181
+ if (!criticalSet.has(name)) continue;
182
+ const version = info.version;
183
+ if (version) {
184
+ if (!duplicates.has(name)) duplicates.set(name, /* @__PURE__ */new Set());
185
+ duplicates.get(name).add(version);
186
+ }
187
+ }
188
+ return formatLockfileDuplicates(duplicates, "package-lock.json");
189
+ } catch {
190
+ return "";
191
+ }
192
+ }
193
+ function formatLockfileDuplicates(duplicates, lockfileName) {
194
+ const multiVersion = /* @__PURE__ */new Map();
195
+ for (const [name, versions] of duplicates) {
196
+ if (versions.size > 1) {
197
+ multiVersion.set(name, [...versions].sort());
198
+ }
199
+ }
200
+ if (multiVersion.size === 0) return "";
201
+ const lines = [`Found multiple resolved versions in ${lockfileName}:`, ""];
202
+ for (const [name, versions] of multiVersion) {
203
+ lines.push(` ${name}: ${versions.join(", ")}`);
204
+ }
205
+ lines.push("");
206
+ lines.push("Multiple versions cause duplicate runtime instances, breaking config/theme detection.");
207
+ lines.push("Fix: ensure all tamagui packages use the same version range, then dedupe.");
208
+ return lines.join("\n");
209
+ }
210
+ function checkConfigExists(root) {
211
+ const configNames = ["tamagui.config.ts", "tamagui.config.tsx", "tamagui.config.js", "tamagui.config.mjs", "tamagui.config.cjs"];
212
+ const searchDirs = [root, (0, import_node_path.join)(root, "src"), (0, import_node_path.join)(root, "app"), (0, import_node_path.join)(root, "config")];
213
+ for (const dir of searchDirs) {
214
+ for (const name of configNames) {
215
+ if ((0, import_node_fs.existsSync)((0, import_node_path.join)(dir, name))) {
216
+ return "";
217
+ }
218
+ }
219
+ }
220
+ const buildConfigNames = ["tamagui.build.ts", "tamagui.build.js", "tamagui.build.mjs", "tamagui.build.cjs"];
221
+ for (const name of buildConfigNames) {
222
+ const buildPath = (0, import_node_path.join)(root, name);
223
+ if ((0, import_node_fs.existsSync)(buildPath)) {
224
+ try {
225
+ const content = (0, import_node_fs.readFileSync)(buildPath, "utf8");
226
+ const match = content.match(/config\s*:\s*['"`]([^'"`]+)['"`]/);
227
+ if (match) {
228
+ const configPath = (0, import_node_path.join)(root, match[1]);
229
+ if ((0, import_node_fs.existsSync)(configPath)) return "";
230
+ }
231
+ } catch {}
232
+ }
233
+ }
234
+ const pkgJsonPath = (0, import_node_path.join)(root, "package.json");
235
+ if ((0, import_node_fs.existsSync)(pkgJsonPath)) {
236
+ try {
237
+ const pkg = JSON.parse((0, import_node_fs.readFileSync)(pkgJsonPath, "utf8"));
238
+ if (pkg.tamagui?.config) {
239
+ const configPath = (0, import_node_path.join)(root, pkg.tamagui.config);
240
+ if ((0, import_node_fs.existsSync)(configPath)) return "";
241
+ }
242
+ } catch {}
243
+ }
244
+ if ((0, import_node_fs.existsSync)(pkgJsonPath)) {
245
+ try {
246
+ const pkg = JSON.parse((0, import_node_fs.readFileSync)(pkgJsonPath, "utf8"));
247
+ if (pkg.workspaces) return "";
248
+ } catch {}
249
+ }
250
+ return ["No tamagui.config file found.", "", "Tamagui requires a config file (e.g. tamagui.config.ts) that calls createTamagui().", `Without it, components will throw "Can't find Tamagui configuration" at runtime.`, "", "See: https://tamagui.dev/docs/core/configuration"].join("\n");
60
251
  }
61
252
  async function checkDeps(root) {
62
- const tamaguiMismatchSummary = checkTamaguiPackageVersions(root),
63
- workspaceMismatchSummary = new import_check_dep_versions.CDVC(root).toMismatchSummary(),
64
- hasTamaguiMismatch = !!tamaguiMismatchSummary,
65
- hasWorkspaceMismatch = !!workspaceMismatchSummary;
66
- !hasTamaguiMismatch && !hasWorkspaceMismatch && (console.info("Tamagui dependencies look good \u2705"), process.exit(0)), hasTamaguiMismatch && console.error(tamaguiMismatchSummary), hasWorkspaceMismatch && (hasTamaguiMismatch && console.error(""), console.error(workspaceMismatchSummary)), process.exit(1);
253
+ const issues = [];
254
+ const workspaceMismatchSummary = new import_check_dep_versions.CDVC(root).toMismatchSummary();
255
+ if (workspaceMismatchSummary) issues.push(workspaceMismatchSummary);
256
+ const lockfileSummary = checkLockfileDuplicates(root);
257
+ if (lockfileSummary) issues.push(lockfileSummary);
258
+ const duplicatesSummary = checkDuplicateInstalls(root);
259
+ if (duplicatesSummary) issues.push(duplicatesSummary);
260
+ const configSummary = checkConfigExists(root);
261
+ if (configSummary) issues.push(configSummary);
262
+ if (issues.length === 0) {
263
+ console.info(`Tamagui dependencies look good \u2705`);
264
+ process.exit(0);
265
+ }
266
+ for (let i = 0; i < issues.length; i++) {
267
+ if (i > 0) console.error("");
268
+ console.error(issues[i]);
269
+ }
270
+ process.exit(1);
67
271
  }
@@ -2,33 +2,35 @@ var __create = Object.create;
2
2
  var __defProp = Object.defineProperty;
3
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf,
6
- __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
7
  var __export = (target, all) => {
8
- for (var name in all) __defProp(target, name, {
9
- get: all[name],
10
- enumerable: !0
11
- });
12
- },
13
- __copyProps = (to, from, except, desc) => {
14
- if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
8
+ for (var name in all) __defProp(target, name, {
9
+ get: all[name],
10
+ enumerable: true
11
+ });
12
+ };
13
+ var __copyProps = (to, from, except, desc) => {
14
+ if (from && typeof from === "object" || typeof from === "function") {
15
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
15
16
  get: () => from[key],
16
17
  enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
17
18
  });
18
- return to;
19
- };
19
+ }
20
+ return to;
21
+ };
20
22
  var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
26
- value: mod,
27
- enumerable: !0
28
- }) : target, mod)),
29
- __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
30
- value: !0
31
- }), mod);
23
+ // If the importer is in node compatibility mode or this is not an ESM
24
+ // file that has been converted to a CommonJS file using a Babel-
25
+ // compatible transform (i.e. "__esModule" has not been set), then set
26
+ // "default" to the CommonJS "module.exports" for node compatibility.
27
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
28
+ value: mod,
29
+ enumerable: true
30
+ }) : target, mod));
31
+ var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
32
+ value: true
33
+ }), mod);
32
34
  var constants_exports = {};
33
35
  __export(constants_exports, {
34
36
  CSS_FILE_NAME: () => CSS_FILE_NAME,
@@ -39,11 +41,11 @@ __export(constants_exports, {
39
41
  });
40
42
  module.exports = __toCommonJS(constants_exports);
41
43
  var import_find_cache_dir = __toESM(require("find-cache-dir"));
42
- const CSS_FILE_NAME = "__snack.css",
43
- MEDIA_SEP = "_",
44
- cacheDir = (0, import_find_cache_dir.default)({
45
- name: "tamagui",
46
- create: !0
47
- }),
48
- FAILED_EVAL = /* @__PURE__ */Symbol("failed_style_eval"),
49
- SHOULD_DEBUG = process.env.DEBUG === "*" || process.env.DEBUG?.startsWith("tamagui");
44
+ const CSS_FILE_NAME = "__snack.css";
45
+ const MEDIA_SEP = "_";
46
+ const cacheDir = (0, import_find_cache_dir.default)({
47
+ name: "tamagui",
48
+ create: true
49
+ });
50
+ const FAILED_EVAL = /* @__PURE__ */Symbol("failed_style_eval");
51
+ const SHOULD_DEBUG = process.env.DEBUG === "*" || process.env.DEBUG?.startsWith("tamagui");
package/dist/exports.cjs CHANGED
@@ -3,32 +3,36 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
3
  var __getOwnPropNames = Object.getOwnPropertyNames;
4
4
  var __hasOwnProp = Object.prototype.hasOwnProperty;
5
5
  var __export = (target, all) => {
6
- for (var name in all) __defProp(target, name, {
7
- get: all[name],
8
- enumerable: !0
9
- });
10
- },
11
- __copyProps = (to, from, except, desc) => {
12
- if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
6
+ for (var name in all) __defProp(target, name, {
7
+ get: all[name],
8
+ enumerable: true
9
+ });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
13
14
  get: () => from[key],
14
15
  enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
15
16
  });
16
- return to;
17
- },
18
- __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
17
+ }
18
+ return to;
19
+ };
20
+ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
19
21
  var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
20
- value: !0
22
+ value: true
21
23
  }), mod);
22
24
  var exports_exports = {};
23
25
  __export(exports_exports, {
26
+ clearFormatCache: () => import_detectModuleFormat.clearFormatCache,
24
27
  createExtractor: () => import_createExtractor.createExtractor,
28
+ detectModuleFormat: () => import_detectModuleFormat.detectModuleFormat,
25
29
  literalToAst: () => import_literalToAst.literalToAst
26
30
  });
27
31
  module.exports = __toCommonJS(exports_exports);
28
32
  __reExport(exports_exports, require("./checkDeps.cjs"), module.exports);
29
33
  __reExport(exports_exports, require("./types.cjs"), module.exports);
30
- var import_createExtractor = require("./extractor/createExtractor.cjs"),
31
- import_literalToAst = require("./extractor/literalToAst.cjs");
34
+ var import_createExtractor = require("./extractor/createExtractor.cjs");
35
+ var import_literalToAst = require("./extractor/literalToAst.cjs");
32
36
  __reExport(exports_exports, require("./constants.cjs"), module.exports);
33
37
  __reExport(exports_exports, require("./extractor/extractToClassNames.cjs"), module.exports);
34
38
  __reExport(exports_exports, require("./extractor/concatClassName.cjs"), module.exports);
@@ -38,4 +42,5 @@ __reExport(exports_exports, require("./extractor/loadTamagui.cjs"), module.expor
38
42
  __reExport(exports_exports, require("./extractor/watchTamaguiConfig.cjs"), module.exports);
39
43
  __reExport(exports_exports, require("./extractor/createLogger.cjs"), module.exports);
40
44
  __reExport(exports_exports, require("./registerRequire.cjs"), module.exports);
45
+ var import_detectModuleFormat = require("./extractor/detectModuleFormat.cjs");
41
46
  __reExport(exports_exports, require("./getPragmaOptions.cjs"), module.exports);
@@ -2,33 +2,35 @@ var __create = Object.create;
2
2
  var __defProp = Object.defineProperty;
3
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf,
6
- __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
7
  var __export = (target, all) => {
8
- for (var name in all) __defProp(target, name, {
9
- get: all[name],
10
- enumerable: !0
11
- });
12
- },
13
- __copyProps = (to, from, except, desc) => {
14
- if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
8
+ for (var name in all) __defProp(target, name, {
9
+ get: all[name],
10
+ enumerable: true
11
+ });
12
+ };
13
+ var __copyProps = (to, from, except, desc) => {
14
+ if (from && typeof from === "object" || typeof from === "function") {
15
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
15
16
  get: () => from[key],
16
17
  enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
17
18
  });
18
- return to;
19
- };
19
+ }
20
+ return to;
21
+ };
20
22
  var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
26
- value: mod,
27
- enumerable: !0
28
- }) : target, mod)),
29
- __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
30
- value: !0
31
- }), mod);
23
+ // If the importer is in node compatibility mode or this is not an ESM
24
+ // file that has been converted to a CommonJS file using a Babel-
25
+ // compatible transform (i.e. "__esModule" has not been set), then set
26
+ // "default" to the CommonJS "module.exports" for node compatibility.
27
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
28
+ value: mod,
29
+ enumerable: true
30
+ }) : target, mod));
31
+ var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
32
+ value: true
33
+ }), mod);
32
34
  var accessSafe_exports = {};
33
35
  __export(accessSafe_exports, {
34
36
  accessSafe: () => accessSafe
@@ -42,5 +44,5 @@ function accessSafe(obj, member) {
42
44
  // obj !== null
43
45
  t.binaryExpression("!==", obj, t.nullLiteral())),
44
46
  // obj.member
45
- t.memberExpression(obj, t.identifier(member), !1));
47
+ t.memberExpression(obj, t.identifier(member), false));
46
48
  }
@@ -2,33 +2,35 @@ var __create = Object.create;
2
2
  var __defProp = Object.defineProperty;
3
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf,
6
- __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
7
  var __export = (target, all) => {
8
- for (var name in all) __defProp(target, name, {
9
- get: all[name],
10
- enumerable: !0
11
- });
12
- },
13
- __copyProps = (to, from, except, desc) => {
14
- if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
8
+ for (var name in all) __defProp(target, name, {
9
+ get: all[name],
10
+ enumerable: true
11
+ });
12
+ };
13
+ var __copyProps = (to, from, except, desc) => {
14
+ if (from && typeof from === "object" || typeof from === "function") {
15
+ for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
15
16
  get: () => from[key],
16
17
  enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
17
18
  });
18
- return to;
19
- };
19
+ }
20
+ return to;
21
+ };
20
22
  var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
26
- value: mod,
27
- enumerable: !0
28
- }) : target, mod)),
29
- __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
30
- value: !0
31
- }), mod);
23
+ // If the importer is in node compatibility mode or this is not an ESM
24
+ // file that has been converted to a CommonJS file using a Babel-
25
+ // compatible transform (i.e. "__esModule" has not been set), then set
26
+ // "default" to the CommonJS "module.exports" for node compatibility.
27
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
28
+ value: mod,
29
+ enumerable: true
30
+ }) : target, mod));
31
+ var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
32
+ value: true
33
+ }), mod);
32
34
  var babelParse_exports = {};
33
35
  __export(babelParse_exports, {
34
36
  babelParse: () => babelParse,
@@ -36,12 +38,12 @@ __export(babelParse_exports, {
36
38
  });
37
39
  module.exports = __toCommonJS(babelParse_exports);
38
40
  var babelParser = __toESM(require("@babel/parser"));
39
- const plugins = ["asyncGenerators", "classProperties", "dynamicImport", "functionBind", "jsx", "numericSeparator", "objectRestSpread", "optionalCatchBinding", "decorators-legacy", "typescript", "optionalChaining", "nullishCoalescingOperator"],
40
- parserOptions = Object.freeze({
41
- plugins,
42
- sourceType: "module"
43
- }),
44
- parser = babelParser.parse.bind(babelParser);
41
+ const plugins = ["asyncGenerators", "classProperties", "dynamicImport", "functionBind", "jsx", "numericSeparator", "objectRestSpread", "optionalCatchBinding", "decorators-legacy", "typescript", "optionalChaining", "nullishCoalescingOperator", "topLevelAwait"];
42
+ const parserOptions = Object.freeze({
43
+ plugins,
44
+ sourceType: "module"
45
+ });
46
+ const parser = babelParser.parse.bind(babelParser);
45
47
  function babelParse(code, fileName) {
46
48
  const codeString = code.toString();
47
49
  try {