@tamagui/static 2.0.0-rc.3 → 2.0.0-rc.30
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/checkDeps.cjs +164 -31
- package/dist/exports.cjs +3 -0
- package/dist/extractor/bundle.cjs +72 -35
- package/dist/extractor/bundleConfig.cjs +219 -35
- package/dist/extractor/createExtractor.cjs +170 -28
- package/dist/extractor/detectModuleFormat.cjs +49 -0
- package/dist/extractor/esbuildTsconfigPaths.cjs +3 -1
- package/dist/extractor/extractToClassNames.cjs +7 -5
- package/dist/extractor/extractToNative.cjs +7 -8
- package/dist/extractor/loadTamagui.cjs +1 -1
- package/dist/getPragmaOptions.cjs +7 -3
- package/dist/index.js +26 -16
- package/dist/registerRequire.cjs +23 -14
- package/package.json +26 -22
- package/src/checkDeps.ts +305 -68
- package/src/exports.ts +1 -0
- package/src/extractor/bundle.ts +140 -37
- package/src/extractor/bundleConfig.ts +435 -61
- package/src/extractor/createExtractor.ts +261 -41
- 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 +32 -25
- package/src/extractor/loadTamagui.ts +2 -2
- package/src/getPragmaOptions.ts +6 -1
- package/src/registerRequire.ts +40 -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/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/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/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
|
@@ -39,7 +39,9 @@ var import_traverse = __toESM(require("@babel/traverse")),
|
|
|
39
39
|
import_cli_color = require("@tamagui/cli-color"),
|
|
40
40
|
reactNativeWebInternals = __toESM(require("@tamagui/react-native-web-internals")),
|
|
41
41
|
import_web = require("@tamagui/web"),
|
|
42
|
+
import_node_fs = require("node:fs"),
|
|
42
43
|
import_node_path = require("node:path"),
|
|
44
|
+
import_typescript = require("typescript"),
|
|
43
45
|
import_constants = require("../constants.cjs"),
|
|
44
46
|
import_requireTamaguiCore = require("../helpers/requireTamaguiCore.cjs"),
|
|
45
47
|
import_createEvaluator = require("./createEvaluator.cjs"),
|
|
@@ -54,7 +56,8 @@ var import_traverse = __toESM(require("@babel/traverse")),
|
|
|
54
56
|
import_propsToFontFamilyCache = require("./propsToFontFamilyCache.cjs"),
|
|
55
57
|
import_timer = require("./timer.cjs"),
|
|
56
58
|
import_validHTMLAttributes = require("./validHTMLAttributes.cjs"),
|
|
57
|
-
import_errors = require("./errors.cjs")
|
|
59
|
+
import_errors = require("./errors.cjs"),
|
|
60
|
+
import_esbuildTsconfigPaths = require("./esbuildTsconfigPaths.cjs");
|
|
58
61
|
const UNTOUCHED_PROPS = {
|
|
59
62
|
key: !0,
|
|
60
63
|
style: !0,
|
|
@@ -80,6 +83,29 @@ function createExtractor({
|
|
|
80
83
|
onHoverOut: "onMouseLeave",
|
|
81
84
|
onPressIn: "onMouseDown",
|
|
82
85
|
onPressOut: "onMouseUp"
|
|
86
|
+
}),
|
|
87
|
+
...(platform === "native" && {
|
|
88
|
+
// native view props that should pass through without preventing flattening
|
|
89
|
+
testID: "testID",
|
|
90
|
+
nativeID: "nativeID",
|
|
91
|
+
accessibilityLabel: "accessibilityLabel",
|
|
92
|
+
accessibilityHint: "accessibilityHint",
|
|
93
|
+
accessibilityRole: "accessibilityRole",
|
|
94
|
+
accessibilityState: "accessibilityState",
|
|
95
|
+
accessibilityValue: "accessibilityValue",
|
|
96
|
+
accessibilityActions: "accessibilityActions",
|
|
97
|
+
accessibilityLabelledBy: "accessibilityLabelledBy",
|
|
98
|
+
accessibilityLiveRegion: "accessibilityLiveRegion",
|
|
99
|
+
accessibilityElementsHidden: "accessibilityElementsHidden",
|
|
100
|
+
accessibilityViewIsModal: "accessibilityViewIsModal",
|
|
101
|
+
importantForAccessibility: "importantForAccessibility",
|
|
102
|
+
collapsable: "collapsable",
|
|
103
|
+
needsOffscreenAlphaCompositing: "needsOffscreenAlphaCompositing",
|
|
104
|
+
removeClippedSubviews: "removeClippedSubviews",
|
|
105
|
+
renderToHardwareTextureAndroid: "renderToHardwareTextureAndroid",
|
|
106
|
+
shouldRasterizeIOS: "shouldRasterizeIOS",
|
|
107
|
+
hitSlop: "hitSlop",
|
|
108
|
+
pointerEvents: "pointerEvents"
|
|
83
109
|
})
|
|
84
110
|
},
|
|
85
111
|
componentState = {
|
|
@@ -101,6 +127,52 @@ function createExtractor({
|
|
|
101
127
|
// really basic disable this for next.js because it messes with ssr
|
|
102
128
|
!process.env.npm_package_dependencies_next && !0 && process.env.IDENTIFY_TAGS !== "false" && (process.env.NODE_ENV === "development" || process.env.IDENTIFY_TAGS);
|
|
103
129
|
let projectInfo = null;
|
|
130
|
+
const dynamicComponentCache = /* @__PURE__ */new Map(),
|
|
131
|
+
dynamicLoadingInProgress = /* @__PURE__ */new Set();
|
|
132
|
+
let _compilerOptions = null;
|
|
133
|
+
function getCompilerOptions() {
|
|
134
|
+
if (!_compilerOptions) try {
|
|
135
|
+
_compilerOptions = (0, import_esbuildTsconfigPaths.loadCompilerOptionsFromTsconfig)();
|
|
136
|
+
} catch {
|
|
137
|
+
_compilerOptions = {};
|
|
138
|
+
}
|
|
139
|
+
return _compilerOptions;
|
|
140
|
+
}
|
|
141
|
+
function resolveImportPath(fromFile, importPath) {
|
|
142
|
+
if (importPath.startsWith(".")) {
|
|
143
|
+
const dir = (0, import_node_path.dirname)(fromFile),
|
|
144
|
+
base = (0, import_node_path.resolve)(dir, importPath),
|
|
145
|
+
extensions = [".tsx", ".ts", ".jsx", ".js"];
|
|
146
|
+
for (const ext of extensions) {
|
|
147
|
+
const full = base + ext;
|
|
148
|
+
if ((0, import_node_fs.existsSync)(full)) return full;
|
|
149
|
+
}
|
|
150
|
+
for (const ext of extensions) {
|
|
151
|
+
const full = (0, import_node_path.resolve)(base, `index${ext}`);
|
|
152
|
+
if ((0, import_node_fs.existsSync)(full)) return full;
|
|
153
|
+
}
|
|
154
|
+
return null;
|
|
155
|
+
}
|
|
156
|
+
const compilerOptions = getCompilerOptions();
|
|
157
|
+
if (compilerOptions.paths) try {
|
|
158
|
+
const {
|
|
159
|
+
resolvedModule
|
|
160
|
+
} = (0, import_typescript.nodeModuleNameResolver)(importPath, fromFile, compilerOptions, import_typescript.sys);
|
|
161
|
+
if (resolvedModule && !resolvedModule.resolvedFileName.endsWith(".d.ts") && !resolvedModule.isExternalLibraryImport) return resolvedModule.resolvedFileName;
|
|
162
|
+
} catch {}
|
|
163
|
+
return null;
|
|
164
|
+
}
|
|
165
|
+
const styledCheckCache = /* @__PURE__ */new Map();
|
|
166
|
+
function mightHaveStyledComponents(filePath) {
|
|
167
|
+
const cached = styledCheckCache.get(filePath);
|
|
168
|
+
if (cached !== void 0) return cached;
|
|
169
|
+
try {
|
|
170
|
+
const result = (0, import_node_fs.readFileSync)(filePath, "utf-8").includes("styled(");
|
|
171
|
+
return styledCheckCache.set(filePath, result), result;
|
|
172
|
+
} catch {
|
|
173
|
+
return styledCheckCache.set(filePath, !1), !1;
|
|
174
|
+
}
|
|
175
|
+
}
|
|
104
176
|
function loadSync(props) {
|
|
105
177
|
return isFullyDisabled(props) ? null : projectInfo ||= (0, import_loadTamagui.loadTamaguiSync)(props);
|
|
106
178
|
}
|
|
@@ -152,7 +224,7 @@ function createExtractor({
|
|
|
152
224
|
platform: platform2,
|
|
153
225
|
...restProps
|
|
154
226
|
} = options;
|
|
155
|
-
if (sourcePath.includes(".tamagui-dynamic-eval")) return null;
|
|
227
|
+
if (sourcePath && dynamicComponentCache.has(sourcePath) && (dynamicComponentCache.delete(sourcePath), styledCheckCache.delete(sourcePath)), sourcePath.includes(".tamagui-dynamic-eval")) return null;
|
|
156
228
|
const {
|
|
157
229
|
normalizeStyle,
|
|
158
230
|
getSplitStyles,
|
|
@@ -219,24 +291,32 @@ function createExtractor({
|
|
|
219
291
|
const node = "node" in bodyPath ? bodyPath.node : bodyPath,
|
|
220
292
|
moduleName = node.source.value,
|
|
221
293
|
valid = (0, import_extractHelpers.isValidImport)(propsWithFileInfo, moduleName);
|
|
222
|
-
if (valid && importDeclarations.push(node), shouldPrintDebug === "verbose" && logger.info(` - import via ${moduleName} ${valid}`), extractStyledDefinitions &&
|
|
223
|
-
doesUseValidImport = !0;
|
|
224
|
-
break;
|
|
225
|
-
}
|
|
226
|
-
if (valid) {
|
|
294
|
+
if (valid && importDeclarations.push(node), shouldPrintDebug === "verbose" && logger.info(` - import via ${moduleName} ${valid}`), extractStyledDefinitions && enableDynamicEvaluation && node.specifiers.some(specifier => specifier.local.name === "styled") && (doesUseValidImport = !0), valid) {
|
|
227
295
|
const names = node.specifiers.map(specifier => specifier.local.name),
|
|
228
296
|
isValidComponent = names.some(name => !!(0, import_extractHelpers.isValidImport)(propsWithFileInfo, moduleName, name));
|
|
229
|
-
if (shouldPrintDebug === "verbose" && logger.info(` - import ${isValidComponent ? "\u2705" : "\u21E3"} - ${names.join(", ")} via package '${moduleName}' - (valid: ${JSON.stringify((0, import_extractHelpers.getValidComponentsPaths)(propsWithFileInfo))})`), isValidComponent)
|
|
230
|
-
doesUseValidImport = !0;
|
|
231
|
-
break;
|
|
232
|
-
}
|
|
297
|
+
if (shouldPrintDebug === "verbose" && logger.info(` - import ${isValidComponent ? "\u2705" : "\u21E3"} - ${names.join(", ")} via package '${moduleName}' - (valid: ${JSON.stringify((0, import_extractHelpers.getValidComponentsPaths)(propsWithFileInfo))})`), isValidComponent && (doesUseValidImport = !0, !(extractStyledDefinitions && enableDynamicEvaluation))) break;
|
|
233
298
|
}
|
|
234
299
|
}
|
|
235
300
|
if (shouldPrintDebug && logger.info(`${JSON.stringify({
|
|
236
301
|
doesUseValidImport,
|
|
237
302
|
hasImportedTheme
|
|
238
303
|
}, null, 2)}
|
|
239
|
-
`), !doesUseValidImport)
|
|
304
|
+
`), !doesUseValidImport && extractStyledDefinitions && enableDynamicEvaluation && sourcePath) for (const bodyPath of body) {
|
|
305
|
+
if (bodyPath.type !== "ImportDeclaration") continue;
|
|
306
|
+
const moduleName = ("node" in bodyPath ? bodyPath.node : bodyPath).source.value,
|
|
307
|
+
resolved = resolveImportPath(sourcePath, moduleName);
|
|
308
|
+
if (resolved) {
|
|
309
|
+
if (dynamicComponentCache.has(resolved)) {
|
|
310
|
+
doesUseValidImport = !0;
|
|
311
|
+
break;
|
|
312
|
+
}
|
|
313
|
+
if (mightHaveStyledComponents(resolved)) {
|
|
314
|
+
doesUseValidImport = !0;
|
|
315
|
+
break;
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
if (!doesUseValidImport) return null;
|
|
240
320
|
function getValidImportedComponent(componentName) {
|
|
241
321
|
const importDeclaration = importDeclarations.find(dec => dec.specifiers.some(spec => spec.local.name === componentName));
|
|
242
322
|
return importDeclaration ? (0, import_extractHelpers.getValidImport)(propsWithFileInfo, importDeclaration.source.value, componentName) : null;
|
|
@@ -266,15 +346,16 @@ function createExtractor({
|
|
|
266
346
|
// styled() calls
|
|
267
347
|
CallExpression(path) {
|
|
268
348
|
if (disable || shouldDisableExtraction || extractStyledDefinitions === !1 || !t.isIdentifier(path.node.callee) || path.node.callee.name !== "styled") return;
|
|
269
|
-
const variableName = t.isVariableDeclarator(path.parent) && t.isIdentifier(path.parent.id) ? path.parent.id.name : "unknown"
|
|
270
|
-
|
|
349
|
+
const variableName = t.isVariableDeclarator(path.parent) && t.isIdentifier(path.parent.id) ? path.parent.id.name : "unknown";
|
|
350
|
+
shouldPrintDebug && logger.info(` [styled] Found styled(${variableName})`);
|
|
351
|
+
const parentNode = path.node.arguments[0];
|
|
271
352
|
if (!t.isIdentifier(parentNode)) return;
|
|
272
353
|
const parentName = parentNode.name,
|
|
273
354
|
definition = path.node.arguments[1];
|
|
274
355
|
if (!parentName || !definition || !t.isObjectExpression(definition)) return;
|
|
275
|
-
let Component = getValidImportedComponent(variableName);
|
|
356
|
+
let Component = getValidImportedComponent(parentName) || getValidImportedComponent(variableName);
|
|
276
357
|
if (!Component) {
|
|
277
|
-
if (enableDynamicEvaluation
|
|
358
|
+
if (!enableDynamicEvaluation) return;
|
|
278
359
|
try {
|
|
279
360
|
shouldPrintDebug && logger.info(`Unknown component: ${variableName} = styled(${parentName}) attempting dynamic load: ${sourcePath}`);
|
|
280
361
|
const out2 = (0, import_loadTamagui.loadTamaguiSync)({
|
|
@@ -305,6 +386,7 @@ function createExtractor({
|
|
|
305
386
|
"fontFamily", "name", "focusStyle", "focusVisibleStyle", "focusWithinStyle", "disabledStyle", "hoverStyle", "pressStyle"]),
|
|
306
387
|
skipped = /* @__PURE__ */new Set(),
|
|
307
388
|
styles = {},
|
|
389
|
+
staticDefaultProps = {},
|
|
308
390
|
staticNamespace = (0, import_getStaticBindingsForScope.getStaticBindingsForScope)(path.scope, importsWhitelist, sourcePath, bindingCache, shouldPrintDebug),
|
|
309
391
|
attemptEval = evaluateVars ? (0, import_createEvaluator.createEvaluator)({
|
|
310
392
|
props: propsWithFileInfo,
|
|
@@ -314,6 +396,11 @@ function createExtractor({
|
|
|
314
396
|
}) : import_evaluateAstNode.evaluateAstNode,
|
|
315
397
|
attemptEvalSafe = (0, import_createEvaluator.createSafeEvaluator)(attemptEval);
|
|
316
398
|
for (const property of definition.properties) {
|
|
399
|
+
if (t.isObjectProperty(property) && (t.isIdentifier(property.key) || t.isStringLiteral(property.key))) {
|
|
400
|
+
const key = t.isIdentifier(property.key) ? property.key.name : property.key.value,
|
|
401
|
+
defaultPropValue = attemptEvalSafe(property.value);
|
|
402
|
+
defaultPropValue !== import_constants.FAILED_EVAL && (staticDefaultProps[key] = defaultPropValue);
|
|
403
|
+
}
|
|
317
404
|
if (!t.isObjectProperty(property) || !t.isIdentifier(property.key) || !isValidStyleKey(property.key.name, Component.staticConfig) ||
|
|
318
405
|
// TODO make pseudos and variants work
|
|
319
406
|
// skip pseudos
|
|
@@ -333,16 +420,36 @@ function createExtractor({
|
|
|
333
420
|
if (shouldPrintDebug && logger.info([`Extracted styled(${variableName})
|
|
334
421
|
`, JSON.stringify(styles, null, 2), `
|
|
335
422
|
classNames:`, JSON.stringify(classNames, null, 2), `
|
|
336
|
-
rulesToInsert:`, out.rulesToInsert].join(" ")),
|
|
337
|
-
if (skipped.has(prop) || !t.isObjectProperty(prop) || !t.isIdentifier(prop.key)) return prop;
|
|
338
|
-
const key = prop.key.name,
|
|
339
|
-
value = classNames[key];
|
|
340
|
-
return value ? t.objectProperty(t.stringLiteral(key), t.stringLiteral(value)) : prop;
|
|
341
|
-
}), out.rulesToInsert) for (const key in out.rulesToInsert) {
|
|
423
|
+
rulesToInsert:`, out.rulesToInsert].join(" ")), out.rulesToInsert) for (const key in out.rulesToInsert) {
|
|
342
424
|
const styleObject = out.rulesToInsert[key];
|
|
343
425
|
onStyledDefinitionRule?.(styleObject[import_web.StyleObjectIdentifier], styleObject[import_web.StyleObjectRules]);
|
|
344
426
|
}
|
|
345
|
-
res.styled++,
|
|
427
|
+
if (res.styled++, extractStyledDefinitions && enableDynamicEvaluation && Component) {
|
|
428
|
+
const dynamicStaticConfig = {
|
|
429
|
+
...Component.staticConfig,
|
|
430
|
+
defaultProps: {
|
|
431
|
+
...Component.staticConfig.defaultProps,
|
|
432
|
+
...staticDefaultProps
|
|
433
|
+
}
|
|
434
|
+
};
|
|
435
|
+
if (propsWithFileInfo.allLoadedComponents.push({
|
|
436
|
+
moduleName: "",
|
|
437
|
+
nameToInfo: {
|
|
438
|
+
[variableName]: {
|
|
439
|
+
staticConfig: dynamicStaticConfig
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
}), sourcePath) {
|
|
443
|
+
let existing = dynamicComponentCache.get(sourcePath);
|
|
444
|
+
existing || (existing = {
|
|
445
|
+
moduleName: sourcePath,
|
|
446
|
+
nameToInfo: {}
|
|
447
|
+
}, dynamicComponentCache.set(sourcePath, existing)), existing.nameToInfo[variableName] = {
|
|
448
|
+
staticConfig: dynamicStaticConfig
|
|
449
|
+
};
|
|
450
|
+
}
|
|
451
|
+
}
|
|
452
|
+
shouldPrintDebug && logger.info(`Extracted styled(${variableName})`);
|
|
346
453
|
},
|
|
347
454
|
JSXElement(traversePath) {
|
|
348
455
|
tm.mark("jsx-element", !!shouldPrintDebug);
|
|
@@ -357,13 +464,49 @@ function createExtractor({
|
|
|
357
464
|
return;
|
|
358
465
|
}
|
|
359
466
|
const binding = traversePath.scope.getBinding(node.name.name);
|
|
360
|
-
let moduleName = ""
|
|
467
|
+
let moduleName = "",
|
|
468
|
+
dynamicComponent = null;
|
|
361
469
|
if (binding && t.isImportDeclaration(binding.path.parent) && (moduleName = binding.path.parent.source.value, !(0, import_extractHelpers.isValidImport)(propsWithFileInfo, moduleName, binding.identifier.name))) {
|
|
362
|
-
|
|
470
|
+
if (enableDynamicEvaluation && sourcePath) {
|
|
471
|
+
const resolved = resolveImportPath(sourcePath, moduleName);
|
|
472
|
+
if (resolved) {
|
|
473
|
+
const cached = dynamicComponentCache.get(resolved);
|
|
474
|
+
if (cached?.nameToInfo[binding.identifier.name]) dynamicComponent = cached.nameToInfo[binding.identifier.name];else if (!dynamicLoadingInProgress.has(resolved) && mightHaveStyledComponents(resolved)) {
|
|
475
|
+
dynamicLoadingInProgress.add(resolved);
|
|
476
|
+
try {
|
|
477
|
+
const out = (0, import_loadTamagui.loadTamaguiSync)({
|
|
478
|
+
forceExports: !0,
|
|
479
|
+
components: [resolved]
|
|
480
|
+
});
|
|
481
|
+
if (out?.components) {
|
|
482
|
+
for (const comp of out.components) {
|
|
483
|
+
let existing = dynamicComponentCache.get(resolved);
|
|
484
|
+
existing || (existing = {
|
|
485
|
+
moduleName: resolved,
|
|
486
|
+
nameToInfo: {}
|
|
487
|
+
}, dynamicComponentCache.set(resolved, existing)), Object.assign(existing.nameToInfo, comp.nameToInfo), propsWithFileInfo.allLoadedComponents.push({
|
|
488
|
+
moduleName: resolved,
|
|
489
|
+
nameToInfo: comp.nameToInfo
|
|
490
|
+
});
|
|
491
|
+
}
|
|
492
|
+
const cachedNow = dynamicComponentCache.get(resolved);
|
|
493
|
+
cachedNow?.nameToInfo[binding.identifier.name] && (dynamicComponent = cachedNow.nameToInfo[binding.identifier.name]);
|
|
494
|
+
}
|
|
495
|
+
} catch (err) {
|
|
496
|
+
shouldPrintDebug && logger.info(` - Failed to dynamically load ${resolved}: ${err}`);
|
|
497
|
+
} finally {
|
|
498
|
+
dynamicLoadingInProgress.delete(resolved);
|
|
499
|
+
}
|
|
500
|
+
}
|
|
501
|
+
}
|
|
502
|
+
}
|
|
503
|
+
if (!dynamicComponent) {
|
|
504
|
+
shouldPrintDebug && logger.info(` - Binding in component ${componentName} not valid import: "${binding.identifier.name}" isn't in ${moduleName}
|
|
363
505
|
`);
|
|
364
|
-
|
|
506
|
+
return;
|
|
507
|
+
}
|
|
365
508
|
}
|
|
366
|
-
const component = (0, import_extractHelpers.getValidComponent)(propsWithFileInfo, moduleName, node.name.name);
|
|
509
|
+
const component = dynamicComponent || (0, import_extractHelpers.getValidComponent)(propsWithFileInfo, moduleName, node.name.name);
|
|
367
510
|
if (!component || !component.staticConfig) {
|
|
368
511
|
shouldPrintDebug && logger.info(`
|
|
369
512
|
- No Tamagui conf for: ${node.name.name}
|
|
@@ -645,7 +788,6 @@ function createExtractor({
|
|
|
645
788
|
variants = staticConfig.variants || {},
|
|
646
789
|
isTextView = staticConfig.isText || !1,
|
|
647
790
|
validStyles = staticConfig?.validStyles ?? {};
|
|
648
|
-
if (process.env.NODE_ENV === "production" && isTextView) return;
|
|
649
791
|
let tagName = defaultProps.render ?? (isTextView ? "span" : "div");
|
|
650
792
|
traversePath.get("openingElement").get("attributes").forEach(path => {
|
|
651
793
|
const attr = path.node;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
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, {
|
|
13
|
+
get: () => from[key],
|
|
14
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
15
|
+
});
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
19
|
+
value: !0
|
|
20
|
+
}), mod);
|
|
21
|
+
var detectModuleFormat_exports = {};
|
|
22
|
+
__export(detectModuleFormat_exports, {
|
|
23
|
+
clearFormatCache: () => clearFormatCache,
|
|
24
|
+
detectModuleFormat: () => detectModuleFormat
|
|
25
|
+
});
|
|
26
|
+
module.exports = __toCommonJS(detectModuleFormat_exports);
|
|
27
|
+
var import_node_fs = require("node:fs"),
|
|
28
|
+
import_node_path = require("node:path");
|
|
29
|
+
const formatCache = /* @__PURE__ */new Map();
|
|
30
|
+
function detectModuleFormat(filePath) {
|
|
31
|
+
const ext = (0, import_node_path.extname)(filePath);
|
|
32
|
+
if (ext === ".mjs") return "esm";
|
|
33
|
+
if (ext === ".cjs") return "cjs";
|
|
34
|
+
let dir = (0, import_node_path.dirname)(filePath);
|
|
35
|
+
for (;;) {
|
|
36
|
+
if (formatCache.has(dir)) return formatCache.get(dir);
|
|
37
|
+
try {
|
|
38
|
+
const format = JSON.parse((0, import_node_fs.readFileSync)((0, import_node_path.join)(dir, "package.json"), "utf-8")).type === "module" ? "esm" : "cjs";
|
|
39
|
+
return formatCache.set(dir, format), format;
|
|
40
|
+
} catch {}
|
|
41
|
+
const parent = (0, import_node_path.dirname)(dir);
|
|
42
|
+
if (parent === dir) break;
|
|
43
|
+
dir = parent;
|
|
44
|
+
}
|
|
45
|
+
return "cjs";
|
|
46
|
+
}
|
|
47
|
+
function clearFormatCache() {
|
|
48
|
+
formatCache.clear();
|
|
49
|
+
}
|
|
@@ -31,7 +31,8 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
31
31
|
}), mod);
|
|
32
32
|
var esbuildTsconfigPaths_exports = {};
|
|
33
33
|
__export(esbuildTsconfigPaths_exports, {
|
|
34
|
-
TsconfigPathsPlugin: () => TsconfigPathsPlugin
|
|
34
|
+
TsconfigPathsPlugin: () => TsconfigPathsPlugin,
|
|
35
|
+
loadCompilerOptionsFromTsconfig: () => loadCompilerOptionsFromTsconfig
|
|
35
36
|
});
|
|
36
37
|
module.exports = __toCommonJS(esbuildTsconfigPaths_exports);
|
|
37
38
|
var import_node_fs = __toESM(require("node:fs")),
|
|
@@ -48,6 +49,7 @@ function TsconfigPathsPlugin() {
|
|
|
48
49
|
onResolve({
|
|
49
50
|
filter: /.*/
|
|
50
51
|
}, args => {
|
|
52
|
+
if (args.path.startsWith("@tamagui/")) return null;
|
|
51
53
|
const paths = compilerOptions.paths || {};
|
|
52
54
|
if (!Object.keys(paths).some(p => new RegExp(p.replace("*", "\\w*")).test(args.path))) return null;
|
|
53
55
|
const {
|
|
@@ -85,7 +85,8 @@ async function extractToClassNames({
|
|
|
85
85
|
sourcePath,
|
|
86
86
|
extractStyledDefinitions: !0,
|
|
87
87
|
onStyledDefinitionRule(identifier, rules) {
|
|
88
|
-
const css = rules.join(
|
|
88
|
+
const css = rules.join(`
|
|
89
|
+
`);
|
|
89
90
|
shouldPrintDebug && console.info(`adding styled() rule: .${identifier} ${css}`), cssMap.set(`.${identifier}`, {
|
|
90
91
|
css,
|
|
91
92
|
commentTexts: []
|
|
@@ -182,8 +183,9 @@ async function extractToClassNames({
|
|
|
182
183
|
hasTernaries = !!onlyTernaries.length,
|
|
183
184
|
baseClassNames = mergeForwardBaseStyle ? addStyles(mergeForwardBaseStyle) : null;
|
|
184
185
|
let baseClassNameStr = baseClassNames ? baseClassNames.join(" ") : "";
|
|
185
|
-
baseFontFamily && (baseClassNameStr = `font_${baseFontFamily}${baseClassNameStr ? ` ${baseClassNameStr}` : ""}`)
|
|
186
|
-
|
|
186
|
+
baseFontFamily && (baseClassNameStr = `font_${baseFontFamily}${baseClassNameStr ? ` ${baseClassNameStr}` : ""}`), baseClassNameStr = `${staticConfig.isText ? "is_Text" : "is_View"}${baseClassNameStr ? ` ${baseClassNameStr}` : ""}`;
|
|
187
|
+
const componentNameFinal = staticConfig.componentName;
|
|
188
|
+
let base = componentNameFinal && componentNameFinal !== "Text" ? t.stringLiteral(`is_${componentNameFinal}${baseClassNameStr ? ` ${baseClassNameStr}` : ""}`) : t.stringLiteral(baseClassNameStr || "");
|
|
187
189
|
attrClassName = attrClassName;
|
|
188
190
|
const baseClassNameExpression = attrClassName ? t.isStringLiteral(attrClassName) ? t.stringLiteral(base.value ? `${base.value} ${attrClassName.value}` : attrClassName.value) : t.binaryExpression("+", t.binaryExpression("+", attrClassName, spaceString), base) : base,
|
|
189
191
|
expandedTernaries = [];
|
|
@@ -314,6 +316,6 @@ function hoistClassName(path2, str) {
|
|
|
314
316
|
}
|
|
315
317
|
function cleanupClassName(inStr) {
|
|
316
318
|
const out = /* @__PURE__ */new Set();
|
|
317
|
-
for (const part of inStr.split(" ")) part
|
|
318
|
-
return [...out].join(" ")
|
|
319
|
+
for (const part of inStr.split(" ")) !part || part === " " || part !== "font_" && out.add(part);
|
|
320
|
+
return [...out].join(" ");
|
|
319
321
|
}
|
|
@@ -56,12 +56,7 @@ const __ReactNativeText = require('react-native').Text;
|
|
|
56
56
|
importStyleSheet = (0, import_template.default)(`
|
|
57
57
|
const __ReactNativeStyleSheet = require('react-native').StyleSheet;
|
|
58
58
|
`),
|
|
59
|
-
importWithStyle =
|
|
60
|
-
const __withStableStyle = require('@tamagui/core')._withStableStyle;
|
|
61
|
-
`),
|
|
62
|
-
importReactUseMemo = (0, import_template.default)(`
|
|
63
|
-
const __ReactUseMemo = require('react').useMemo;
|
|
64
|
-
`),
|
|
59
|
+
importWithStyle = import_template.default.ast("import { _withStableStyle } from '@tamagui/core';"),
|
|
65
60
|
extractor = (0, import_createExtractor.createExtractor)({
|
|
66
61
|
platform: "native"
|
|
67
62
|
});
|
|
@@ -137,6 +132,8 @@ function getBabelParseDefinition(options) {
|
|
|
137
132
|
res = extractor.parseSync(root, {
|
|
138
133
|
importsWhitelist: ["constants.js", "colors.js"],
|
|
139
134
|
excludeProps: /* @__PURE__ */new Set(["className", "userSelect", "whiteSpace", "textOverflow", "cursor", "contain"]),
|
|
135
|
+
// native props that should pass through without preventing extraction
|
|
136
|
+
inlineProps: /* @__PURE__ */new Set(["testID", "nativeID", "accessibilityLabel", "accessibilityHint", "accessibilityRole", "accessibilityState", "accessibilityValue", "accessibilityActions", "accessibilityLabelledBy", "accessibilityLiveRegion", "accessibilityElementsHidden", "accessibilityViewIsModal", "importantForAccessibility", "onAccessibilityAction", "onAccessibilityEscape", "onAccessibilityTap", "onMagicTap", "collapsable", "needsOffscreenAlphaCompositing", "removeClippedSubviews", "renderToHardwareTextureAndroid", "shouldRasterizeIOS", "hitSlop", "pointerEvents"]),
|
|
140
137
|
shouldPrintDebug,
|
|
141
138
|
...finalOptions,
|
|
142
139
|
// disable extracting variables as no native concept of them (only theme values)
|
|
@@ -215,12 +212,14 @@ function getBabelParseDefinition(options) {
|
|
|
215
212
|
}
|
|
216
213
|
}
|
|
217
214
|
if (props.node.attributes = finalAttrs, themeKeysUsed.size || hocStylesExpr.elements.length > 1 || hasDynamicStyle) {
|
|
218
|
-
hasImportedViewWrapper || (root.unshiftContainer("body", importWithStyle
|
|
215
|
+
hasImportedViewWrapper || (root.unshiftContainer("body", importWithStyle), hasImportedViewWrapper = !0);
|
|
219
216
|
const name = props.flatNodeName || props.node.name.name,
|
|
220
217
|
wrapperName = `_${name.replace(/^_+/, "")}Styled${wrapperCount++}`,
|
|
221
218
|
WrapperIdentifier = t.identifier(wrapperName),
|
|
222
219
|
WrapperJSXIdentifier = t.jsxIdentifier(wrapperName);
|
|
223
|
-
root.pushContainer("body", t.variableDeclaration("const", [t.variableDeclarator(WrapperIdentifier, t.callExpression(t.identifier("
|
|
220
|
+
root.pushContainer("body", t.variableDeclaration("const", [t.variableDeclarator(WrapperIdentifier, t.callExpression(t.identifier("_withStableStyle"), [t.identifier(name), t.arrowFunctionExpression([t.identifier("theme"), t.identifier("_expressions")],
|
|
221
|
+
// return styles directly - no useMemo, theme changes must trigger style recalc
|
|
222
|
+
t.arrayExpression([...hocStylesExpr.elements]))]))])), props.node.name = WrapperJSXIdentifier, props.jsxPath.node.openingElement.name = WrapperJSXIdentifier, props.jsxPath.node.closingElement && (props.jsxPath.node.closingElement.name = t.jsxIdentifier(wrapperName)), expressions.length && props.node.attributes.push(t.jsxAttribute(t.jsxIdentifier("_expressions"), t.jsxExpressionContainer(t.arrayExpression(expressions))));
|
|
224
223
|
} else props.node.attributes.push(t.jsxAttribute(t.jsxIdentifier("style"), t.jsxExpressionContainer(stylesExpr.elements.length === 1 ? stylesExpr.elements[0] : stylesExpr)));
|
|
225
224
|
}
|
|
226
225
|
});
|
|
@@ -190,7 +190,7 @@ function loadTamaguiSync({
|
|
|
190
190
|
createTamagui(tamaguiConfig);
|
|
191
191
|
}
|
|
192
192
|
}
|
|
193
|
-
const components = (0, import_bundleConfig.
|
|
193
|
+
const components = (0, import_bundleConfig.loadComponentsSync)(props, forceExports);
|
|
194
194
|
if (!components) throw new Error("No components loaded");
|
|
195
195
|
process.env.DEBUG === "tamagui" && console.info("components", components), process.env.IS_STATIC = void 0, globalThis.__DEV__ = devValueOG;
|
|
196
196
|
const info = {
|
|
@@ -32,9 +32,13 @@ function getPragmaOptions({
|
|
|
32
32
|
const firstLines = source.slice(0, 800);
|
|
33
33
|
let pragma = "";
|
|
34
34
|
for (const line of firstLines.split(`
|
|
35
|
-
`))
|
|
36
|
-
|
|
37
|
-
break;
|
|
35
|
+
`)) {
|
|
36
|
+
const trimmed = line.trim();
|
|
37
|
+
if (trimmed && !trimmed.startsWith("//") && !trimmed.startsWith("/*")) break;
|
|
38
|
+
if (pragma = trimmed.match(/(\/\/|\/\*)\s?!?\s?(tamagui-ignore|debug|debug-verbose)(\n|\s|$).*/)?.[2].trim() || "", pragma) {
|
|
39
|
+
pragma = pragma.replace("!", "").trim();
|
|
40
|
+
break;
|
|
41
|
+
}
|
|
38
42
|
}
|
|
39
43
|
switch (pragma) {
|
|
40
44
|
case "tamagui-ignore":
|
package/dist/index.js
CHANGED
|
@@ -2,29 +2,39 @@ 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,
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf,
|
|
6
|
+
__hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
7
|
var __export = (target, all) => {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
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, {
|
|
15
|
+
get: () => from[key],
|
|
16
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
17
|
+
});
|
|
18
|
+
return to;
|
|
19
|
+
},
|
|
20
|
+
__reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default")),
|
|
21
|
+
__toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
15
22
|
// If the importer is in node compatibility mode or this is not an ESM
|
|
16
23
|
// file that has been converted to a CommonJS file using a Babel-
|
|
17
24
|
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
18
25
|
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
19
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
20
|
-
|
|
21
|
-
|
|
26
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
27
|
+
value: mod,
|
|
28
|
+
enumerable: !0
|
|
29
|
+
}) : target, mod)),
|
|
30
|
+
__toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
31
|
+
value: !0
|
|
32
|
+
}), mod);
|
|
22
33
|
var index_exports = {};
|
|
23
34
|
__export(index_exports, {
|
|
24
35
|
default: () => index_default
|
|
25
36
|
});
|
|
26
37
|
module.exports = __toCommonJS(index_exports);
|
|
27
|
-
var Static1 = __toESM(require("./exports"));
|
|
28
|
-
__reExport(index_exports, require("./exports"), module.exports);
|
|
29
|
-
var index_default = Static1;
|
|
30
|
-
//# sourceMappingURL=index.js.map
|
|
38
|
+
var Static1 = __toESM(require("./exports.cjs"));
|
|
39
|
+
__reExport(index_exports, require("./exports.cjs"), module.exports);
|
|
40
|
+
var index_default = Static1;
|
package/dist/registerRequire.cjs
CHANGED
|
@@ -50,12 +50,18 @@ function registerRequire(platform, {
|
|
|
50
50
|
tamaguiRequire: require,
|
|
51
51
|
unregister: () => {}
|
|
52
52
|
};
|
|
53
|
-
const
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
53
|
+
const originalResolveFilename = Module._resolveFilename,
|
|
54
|
+
{
|
|
55
|
+
unregister
|
|
56
|
+
} = (0, import_node.register)({
|
|
57
|
+
hookIgnoreNodeModules: !1,
|
|
58
|
+
// don't transform @tamagui packages - they have pre-built dist files
|
|
59
|
+
hookMatcher: filename => !(filename.includes("@tamagui") || /\/tamagui\/code\/(core|ui|packages)\//.test(filename))
|
|
60
|
+
}),
|
|
61
|
+
tsconfigPatchedResolve = Module._resolveFilename;
|
|
62
|
+
Module._resolveFilename = function (request, ...args) {
|
|
63
|
+
return request.startsWith("@tamagui/") ? originalResolveFilename.call(this, request, ...args) : tsconfigPatchedResolve.call(this, request, ...args);
|
|
64
|
+
}, og || (og = Module.prototype.require), isRegistered = !0, Module.prototype.require = tamaguiRequire;
|
|
59
65
|
function tamaguiRequire(path) {
|
|
60
66
|
if (path === "tamagui" && platform === "native") return og.apply(this, ["tamagui/native"]);
|
|
61
67
|
if (path === "@tamagui/core") return (0, import_requireTamaguiCore.requireTamaguiCore)(platform, path2 => og.apply(this, [path2]));
|
|
@@ -68,16 +74,15 @@ function registerRequire(platform, {
|
|
|
68
74
|
} catch {
|
|
69
75
|
return og.apply(this, ["@tamagui/react-native-web-lite"]);
|
|
70
76
|
}
|
|
71
|
-
if (!whitelisted[path] && proxyWormImports && !path.includes(".tamagui-dynamic-eval"))
|
|
77
|
+
if (!whitelisted[path] && proxyWormImports && !path.includes(".tamagui-dynamic-eval")) {
|
|
78
|
+
const callerFile = this?.filename || this?.id || "",
|
|
79
|
+
isFromTamaguiPkg = callerFile.includes("@tamagui") || callerFile.includes("node_modules/tamagui/");
|
|
80
|
+
return path === "tamagui" || path.startsWith("@tamagui/") || isFromTamaguiPkg ? og.apply(this, [path]) : proxyWorm;
|
|
81
|
+
}
|
|
72
82
|
try {
|
|
73
83
|
return og.apply(this, arguments);
|
|
74
|
-
} catch
|
|
75
|
-
return !process.env.TAMAGUI_ENABLE_WARN_DYNAMIC_LOAD && path.includes("tamagui-dynamic-eval") ? void 0 : (allowedIgnores[path] || IGNORES === "true" || (!process.env.TAMAGUI_SHOW_FULL_BUNDLE_ERRORS && !process.env.DEBUG ? hasWarnedForModules.has(path) || hasWarnedForModules.add(path) : console.
|
|
76
|
-
|
|
77
|
-
${err.message}
|
|
78
|
-
${err.stack}
|
|
79
|
-
|
|
80
|
-
`)), proxyWorm);
|
|
84
|
+
} catch {
|
|
85
|
+
return !process.env.TAMAGUI_ENABLE_WARN_DYNAMIC_LOAD && path.includes("tamagui-dynamic-eval") ? void 0 : (allowedIgnores[path] || IGNORES === "true" || (!process.env.TAMAGUI_SHOW_FULL_BUNDLE_ERRORS && !process.env.DEBUG ? hasWarnedForModules.has(path) || hasWarnedForModules.add(path) : console.warn(` [tamagui] skipped "${path}" (set TAMAGUI_IGNORE_BUNDLE_ERRORS="${path}" to silence)`)), proxyWorm);
|
|
81
86
|
}
|
|
82
87
|
}
|
|
83
88
|
return {
|
|
@@ -96,6 +101,10 @@ const IGNORES = process.env.TAMAGUI_IGNORE_BUNDLE_ERRORS,
|
|
|
96
101
|
"expo-linear-gradient": !0,
|
|
97
102
|
"@expo/vector-icons": !0,
|
|
98
103
|
"tamagui/linear-gradient": !0,
|
|
104
|
+
// animation libraries not needed for static extraction
|
|
105
|
+
"@emotion/is-prop-valid": !0,
|
|
106
|
+
"framer-motion": !0,
|
|
107
|
+
motion: !0,
|
|
99
108
|
...Object.fromEntries(extraIgnores?.map(k => [k, !0]) || [])
|
|
100
109
|
},
|
|
101
110
|
hasWarnedForModules = /* @__PURE__ */new Set(),
|