@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.
- package/dist/check-dep-versions.cjs +201 -96
- package/dist/checkDeps.cjs +250 -46
- package/dist/constants.cjs +32 -30
- package/dist/exports.cjs +18 -13
- package/dist/extractor/accessSafe.cjs +25 -23
- package/dist/extractor/babelParse.cjs +30 -28
- package/dist/extractor/buildClassName.cjs +59 -35
- package/dist/extractor/bundle.cjs +177 -101
- package/dist/extractor/bundleConfig.cjs +554 -167
- package/dist/extractor/concatClassName.cjs +41 -29
- package/dist/extractor/createEvaluator.cjs +54 -41
- package/dist/extractor/createExtractor.cjs +1400 -581
- package/dist/extractor/createLogger.cjs +30 -25
- package/dist/extractor/detectModuleFormat.cjs +55 -0
- package/dist/extractor/ensureImportingConcat.cjs +31 -25
- package/dist/extractor/errors.cjs +12 -10
- package/dist/extractor/esbuildAliasPlugin.cjs +28 -16
- package/dist/extractor/esbuildTsconfigPaths.cjs +60 -36
- package/dist/extractor/evaluateAstNode.cjs +104 -59
- package/dist/extractor/extractHelpers.cjs +130 -67
- package/dist/extractor/extractMediaStyle.cjs +110 -69
- package/dist/extractor/extractToClassNames.cjs +337 -229
- package/dist/extractor/extractToNative.cjs +248 -154
- package/dist/extractor/findTopmostFunction.cjs +22 -13
- package/dist/extractor/generatedUid.cjs +39 -28
- package/dist/extractor/getPrefixLogs.cjs +12 -10
- package/dist/extractor/getPropValueFromAttributes.cjs +52 -34
- package/dist/extractor/getSourceModule.cjs +73 -37
- package/dist/extractor/getStaticBindingsForScope.cjs +131 -68
- package/dist/extractor/getTamaguiConfigPathFromOptionsConfig.cjs +20 -14
- package/dist/extractor/hasTopLevelAwait.cjs +62 -0
- package/dist/extractor/hoistClassNames.cjs +46 -32
- package/dist/extractor/literalToAst.cjs +67 -42
- package/dist/extractor/loadFile.cjs +9 -3
- package/dist/extractor/loadTamagui.cjs +149 -104
- package/dist/extractor/logLines.cjs +27 -19
- package/dist/extractor/normalizeTernaries.cjs +66 -44
- package/dist/extractor/propsToFontFamilyCache.cjs +15 -11
- package/dist/extractor/regenerateConfig.cjs +109 -81
- package/dist/extractor/removeUnusedHooks.cjs +73 -41
- package/dist/extractor/timer.cjs +23 -14
- package/dist/extractor/validHTMLAttributes.cjs +61 -59
- package/dist/extractor/watchTamaguiConfig.cjs +35 -23
- package/dist/getPragmaOptions.cjs +38 -19
- package/dist/helpers/memoize.cjs +24 -16
- package/dist/helpers/requireTamaguiCore.cjs +22 -15
- package/dist/index.cjs +26 -24
- package/dist/registerRequire.cjs +167 -65
- package/dist/server.cjs +35 -28
- package/dist/types.cjs +7 -5
- package/dist/worker.cjs +62 -40
- package/package.json +26 -22
- package/src/checkDeps.ts +305 -68
- package/src/exports.ts +1 -0
- package/src/extractor/babelParse.ts +1 -0
- package/src/extractor/bundle.ts +140 -37
- package/src/extractor/bundleConfig.ts +435 -61
- package/src/extractor/createExtractor.ts +283 -48
- package/src/extractor/detectModuleFormat.ts +42 -0
- package/src/extractor/esbuildTsconfigPaths.ts +6 -1
- package/src/extractor/extractToClassNames.ts +15 -9
- package/src/extractor/extractToNative.ts +66 -33
- package/src/extractor/hasTopLevelAwait.ts +28 -0
- package/src/extractor/loadTamagui.ts +2 -2
- package/src/getPragmaOptions.ts +6 -1
- package/src/registerRequire.ts +88 -8
- package/types/checkDeps.d.ts.map +1 -1
- package/types/exports.d.ts +1 -0
- package/types/exports.d.ts.map +1 -1
- package/types/extractor/babelParse.d.ts.map +1 -1
- package/types/extractor/bundle.d.ts +83 -1
- package/types/extractor/bundle.d.ts.map +1 -1
- package/types/extractor/bundleConfig.d.ts +15 -2
- package/types/extractor/bundleConfig.d.ts.map +1 -1
- package/types/extractor/createExtractor.d.ts.map +1 -1
- package/types/extractor/detectModuleFormat.d.ts +5 -0
- package/types/extractor/detectModuleFormat.d.ts.map +1 -0
- package/types/extractor/esbuildTsconfigPaths.d.ts +8 -0
- package/types/extractor/esbuildTsconfigPaths.d.ts.map +1 -1
- package/types/extractor/extractToClassNames.d.ts.map +1 -1
- package/types/extractor/extractToNative.d.ts.map +1 -1
- package/types/extractor/hasTopLevelAwait.d.ts +2 -0
- package/types/extractor/hasTopLevelAwait.d.ts.map +1 -0
- package/types/getPragmaOptions.d.ts.map +1 -1
- package/types/registerRequire.d.ts.map +1 -1
- package/dist/check-dep-versions.js +0 -389
- package/dist/check-dep-versions.js.map +0 -6
- package/dist/checkDeps.js +0 -60
- package/dist/checkDeps.js.map +0 -6
- package/dist/constants.js +0 -34
- package/dist/constants.js.map +0 -6
- package/dist/exports.js +0 -34
- package/dist/exports.js.map +0 -6
- package/dist/extractor/accessSafe.js +0 -47
- package/dist/extractor/accessSafe.js.map +0 -6
- package/dist/extractor/babelParse.js +0 -59
- package/dist/extractor/babelParse.js.map +0 -6
- package/dist/extractor/buildClassName.js +0 -72
- package/dist/extractor/buildClassName.js.map +0 -6
- package/dist/extractor/bundle.js +0 -135
- package/dist/extractor/bundle.js.map +0 -6
- package/dist/extractor/bundleConfig.js +0 -352
- package/dist/extractor/bundleConfig.js.map +0 -6
- package/dist/extractor/concatClassName.js +0 -69
- package/dist/extractor/concatClassName.js.map +0 -6
- package/dist/extractor/createEvaluator.js +0 -66
- package/dist/extractor/createEvaluator.js.map +0 -6
- package/dist/extractor/createExtractor.js +0 -1215
- package/dist/extractor/createExtractor.js.map +0 -6
- package/dist/extractor/createLogger.js +0 -32
- package/dist/extractor/createLogger.js.map +0 -6
- package/dist/extractor/ensureImportingConcat.js +0 -50
- package/dist/extractor/ensureImportingConcat.js.map +0 -6
- package/dist/extractor/errors.js +0 -22
- package/dist/extractor/errors.js.map +0 -6
- package/dist/extractor/esbuildAliasPlugin.js +0 -36
- package/dist/extractor/esbuildAliasPlugin.js.map +0 -6
- package/dist/extractor/esbuildTsconfigPaths.js +0 -79
- package/dist/extractor/esbuildTsconfigPaths.js.map +0 -6
- package/dist/extractor/evaluateAstNode.js +0 -99
- package/dist/extractor/evaluateAstNode.js.map +0 -6
- package/dist/extractor/extractHelpers.js +0 -108
- package/dist/extractor/extractHelpers.js.map +0 -6
- package/dist/extractor/extractMediaStyle.js +0 -123
- package/dist/extractor/extractMediaStyle.js.map +0 -6
- package/dist/extractor/extractToClassNames.js +0 -351
- package/dist/extractor/extractToClassNames.js.map +0 -6
- package/dist/extractor/extractToNative.js +0 -286
- package/dist/extractor/extractToNative.js.map +0 -6
- package/dist/extractor/findTopmostFunction.js +0 -32
- package/dist/extractor/findTopmostFunction.js.map +0 -6
- package/dist/extractor/generatedUid.js +0 -42
- package/dist/extractor/generatedUid.js.map +0 -6
- package/dist/extractor/getPrefixLogs.js +0 -24
- package/dist/extractor/getPrefixLogs.js.map +0 -6
- package/dist/extractor/getPropValueFromAttributes.js +0 -65
- package/dist/extractor/getPropValueFromAttributes.js.map +0 -6
- package/dist/extractor/getSourceModule.js +0 -62
- package/dist/extractor/getSourceModule.js.map +0 -6
- package/dist/extractor/getStaticBindingsForScope.js +0 -145
- package/dist/extractor/getStaticBindingsForScope.js.map +0 -6
- package/dist/extractor/getTamaguiConfigPathFromOptionsConfig.js +0 -32
- package/dist/extractor/getTamaguiConfigPathFromOptionsConfig.js.map +0 -6
- package/dist/extractor/hoistClassNames.js +0 -63
- package/dist/extractor/hoistClassNames.js.map +0 -6
- package/dist/extractor/literalToAst.js +0 -90
- package/dist/extractor/literalToAst.js.map +0 -6
- package/dist/extractor/loadFile.js +0 -14
- package/dist/extractor/loadFile.js.map +0 -6
- package/dist/extractor/loadTamagui.js +0 -306
- package/dist/extractor/loadTamagui.js.map +0 -6
- package/dist/extractor/logLines.js +0 -30
- package/dist/extractor/logLines.js.map +0 -6
- package/dist/extractor/normalizeTernaries.js +0 -61
- package/dist/extractor/normalizeTernaries.js.map +0 -6
- package/dist/extractor/propsToFontFamilyCache.js +0 -33
- package/dist/extractor/propsToFontFamilyCache.js.map +0 -6
- package/dist/extractor/regenerateConfig.js +0 -123
- package/dist/extractor/regenerateConfig.js.map +0 -6
- package/dist/extractor/removeUnusedHooks.js +0 -72
- package/dist/extractor/removeUnusedHooks.js.map +0 -6
- package/dist/extractor/timer.js +0 -38
- package/dist/extractor/timer.js.map +0 -6
- package/dist/extractor/validHTMLAttributes.js +0 -72
- package/dist/extractor/validHTMLAttributes.js.map +0 -6
- package/dist/extractor/watchTamaguiConfig.js +0 -57
- package/dist/extractor/watchTamaguiConfig.js.map +0 -6
- package/dist/getPragmaOptions.js +0 -46
- package/dist/getPragmaOptions.js.map +0 -6
- package/dist/helpers/memoize.js +0 -33
- package/dist/helpers/memoize.js.map +0 -6
- package/dist/helpers/requireTamaguiCore.js +0 -30
- package/dist/helpers/requireTamaguiCore.js.map +0 -6
- package/dist/index.js +0 -30
- package/dist/index.js.map +0 -6
- package/dist/registerRequire.js +0 -100
- package/dist/registerRequire.js.map +0 -6
- package/dist/server.js +0 -58
- package/dist/server.js.map +0 -6
- package/dist/setup.js +0 -1
- package/dist/setup.js.map +0 -6
- package/dist/types.js +0 -14
- package/dist/types.js.map +0 -6
- package/dist/worker.js +0 -72
- package/dist/worker.js.map +0 -6
package/dist/checkDeps.cjs
CHANGED
|
@@ -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
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
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
|
-
|
|
17
|
-
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
18
20
|
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
19
|
-
value:
|
|
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
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
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
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
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
|
-
|
|
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
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
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
|
}
|
package/dist/constants.cjs
CHANGED
|
@@ -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
|
-
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
7
|
var __export = (target, all) => {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
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
|
-
|
|
19
|
-
|
|
19
|
+
}
|
|
20
|
+
return to;
|
|
21
|
+
};
|
|
20
22
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
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
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
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
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
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
|
-
|
|
17
|
-
|
|
18
|
-
|
|
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:
|
|
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
|
-
|
|
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
|
-
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
7
|
var __export = (target, all) => {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
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
|
-
|
|
19
|
-
|
|
19
|
+
}
|
|
20
|
+
return to;
|
|
21
|
+
};
|
|
20
22
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
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),
|
|
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
|
-
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
7
|
var __export = (target, all) => {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
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
|
-
|
|
19
|
-
|
|
19
|
+
}
|
|
20
|
+
return to;
|
|
21
|
+
};
|
|
20
22
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
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
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
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 {
|