@tamagui/static 1.0.1-beta.104 → 1.0.1-beta.107

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 (52) hide show
  1. package/dist/cjs/constants.js +4 -0
  2. package/dist/cjs/constants.js.map +2 -2
  3. package/dist/cjs/extractor/createEvaluator.js.map +1 -1
  4. package/dist/cjs/extractor/defaultTamaguiConfig.js +177 -0
  5. package/dist/cjs/extractor/defaultTamaguiConfig.js.map +7 -0
  6. package/dist/cjs/extractor/loadTamagui.js +45 -66
  7. package/dist/cjs/extractor/loadTamagui.js.map +2 -2
  8. package/dist/cjs/index.js +1 -0
  9. package/dist/cjs/index.js.map +2 -2
  10. package/dist/cjs/require.js +99 -0
  11. package/dist/cjs/require.js.map +7 -0
  12. package/dist/esm/constants.js +3 -0
  13. package/dist/esm/constants.js.map +2 -2
  14. package/dist/esm/extractor/createEvaluator.js.map +1 -1
  15. package/dist/esm/extractor/defaultTamaguiConfig.js +156 -0
  16. package/dist/esm/extractor/defaultTamaguiConfig.js.map +7 -0
  17. package/dist/esm/extractor/loadTamagui.js +45 -66
  18. package/dist/esm/extractor/loadTamagui.js.map +2 -2
  19. package/dist/esm/index.js +1 -0
  20. package/dist/esm/index.js.map +2 -2
  21. package/dist/esm/require.js +74 -0
  22. package/dist/esm/require.js.map +7 -0
  23. package/dist/jsx/constants.js +3 -0
  24. package/dist/jsx/constants.js.map +2 -2
  25. package/dist/jsx/extractor/createEvaluator.js.map +1 -1
  26. package/dist/jsx/extractor/defaultTamaguiConfig.js +143 -0
  27. package/dist/jsx/extractor/defaultTamaguiConfig.js.map +7 -0
  28. package/dist/jsx/extractor/loadTamagui.js +45 -66
  29. package/dist/jsx/extractor/loadTamagui.js.map +2 -2
  30. package/dist/jsx/index.js +1 -0
  31. package/dist/jsx/index.js.map +2 -2
  32. package/dist/jsx/require.js +74 -0
  33. package/dist/jsx/require.js.map +7 -0
  34. package/package.json +9 -8
  35. package/src/constants.ts +2 -0
  36. package/src/extractor/createEvaluator.ts +1 -1
  37. package/src/extractor/defaultTamaguiConfig.ts +150 -0
  38. package/src/extractor/loadTamagui.ts +50 -85
  39. package/src/index.ts +1 -0
  40. package/src/require.ts +93 -0
  41. package/types/constants.d.ts +1 -0
  42. package/types/constants.d.ts.map +1 -1
  43. package/types/extractor/createEvaluator.d.ts +1 -1
  44. package/types/extractor/createEvaluator.d.ts.map +1 -1
  45. package/types/extractor/defaultTamaguiConfig.d.ts +15 -0
  46. package/types/extractor/defaultTamaguiConfig.d.ts.map +1 -0
  47. package/types/extractor/loadTamagui.d.ts +1 -1
  48. package/types/extractor/loadTamagui.d.ts.map +1 -1
  49. package/types/index.d.ts +1 -0
  50. package/types/index.d.ts.map +1 -1
  51. package/types/require.d.ts +4 -0
  52. package/types/require.d.ts.map +1 -0
@@ -24,21 +24,25 @@ __export(constants_exports, {
24
24
  CSS_FILE_NAME: () => CSS_FILE_NAME,
25
25
  FAILED_EVAL: () => FAILED_EVAL,
26
26
  MEDIA_SEP: () => MEDIA_SEP,
27
+ SHOULD_DEBUG: () => SHOULD_DEBUG,
27
28
  cacheDir: () => cacheDir
28
29
  });
29
30
  module.exports = __toCommonJS(constants_exports);
30
31
  var import_find_cache_dir = __toESM(require("find-cache-dir"));
32
+ var _a;
31
33
  const CSS_FILE_NAME = "__snack.css";
32
34
  const MEDIA_SEP = "_";
33
35
  const cacheDir = (0, import_find_cache_dir.default)({ name: "tamagui", create: true });
34
36
  const FAILED_EVAL = Symbol("failed_style_eval");
35
37
  const CONCAT_CLASSNAME_IMPORT = "concatClassName";
38
+ const SHOULD_DEBUG = process.env.DEBUG === "*" || ((_a = process.env.DEBUG) == null ? void 0 : _a.startsWith("tamagui"));
36
39
  // Annotate the CommonJS export names for ESM import in node:
37
40
  0 && (module.exports = {
38
41
  CONCAT_CLASSNAME_IMPORT,
39
42
  CSS_FILE_NAME,
40
43
  FAILED_EVAL,
41
44
  MEDIA_SEP,
45
+ SHOULD_DEBUG,
42
46
  cacheDir
43
47
  });
44
48
  //# sourceMappingURL=constants.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/constants.ts"],
4
- "sourcesContent": ["import findCacheDir from 'find-cache-dir'\n\nexport const CSS_FILE_NAME = '__snack.css'\n\n// ENSURE THIS ISNT THE SAME AS THE SEPARATOR USED FOR STYLE KEYS\n// SEE matching one in concatClassName\nexport const MEDIA_SEP = '_'\n\n// ensure cache dir\nexport const cacheDir = findCacheDir({ name: 'tamagui', create: true })\n\nexport const FAILED_EVAL = Symbol('failed_style_eval')\nexport const CONCAT_CLASSNAME_IMPORT = 'concatClassName'\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,4BAAyB;AAElB,MAAM,gBAAgB;AAItB,MAAM,YAAY;AAGlB,MAAM,WAAW,mCAAa,EAAE,MAAM,WAAW,QAAQ,KAAK,CAAC;AAE/D,MAAM,cAAc,OAAO,mBAAmB;AAC9C,MAAM,0BAA0B;",
4
+ "sourcesContent": ["import findCacheDir from 'find-cache-dir'\n\nexport const CSS_FILE_NAME = '__snack.css'\n\n// ENSURE THIS ISNT THE SAME AS THE SEPARATOR USED FOR STYLE KEYS\n// SEE matching one in concatClassName\nexport const MEDIA_SEP = '_'\n\n// ensure cache dir\nexport const cacheDir = findCacheDir({ name: 'tamagui', create: true })\n\nexport const FAILED_EVAL = Symbol('failed_style_eval')\nexport const CONCAT_CLASSNAME_IMPORT = 'concatClassName'\n\nexport const SHOULD_DEBUG = process.env.DEBUG === '*' || process.env.DEBUG?.startsWith('tamagui')\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,4BAAyB;AAAzB;AAEO,MAAM,gBAAgB;AAItB,MAAM,YAAY;AAGlB,MAAM,WAAW,mCAAa,EAAE,MAAM,WAAW,QAAQ,KAAK,CAAC;AAE/D,MAAM,cAAc,OAAO,mBAAmB;AAC9C,MAAM,0BAA0B;AAEhC,MAAM,eAAe,QAAQ,IAAI,UAAU,OAAO,eAAQ,IAAI,UAAZ,mBAAmB,WAAW;",
6
6
  "names": []
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/extractor/createEvaluator.ts"],
4
- "sourcesContent": ["import vm from 'vm'\n\nimport generate from '@babel/generator'\nimport { NodePath } from '@babel/traverse'\nimport * as t from '@babel/types'\nimport type { TamaguiConfig } from '@tamagui/core'\nimport { createCSSVariable } from '@tamagui/core-node'\nimport esbuild from 'esbuild'\n\nimport { FAILED_EVAL } from '../constants'\nimport { evaluateAstNode } from './evaluateAstNode'\nimport { isValidThemeHook } from './extractHelpers'\n\nexport function createEvaluator({\n tamaguiConfig,\n staticNamespace,\n sourcePath,\n traversePath,\n shouldPrintDebug,\n}: {\n tamaguiConfig: TamaguiConfig\n staticNamespace: Record<string, any>\n sourcePath: string\n traversePath?: NodePath<t.JSXElement>\n shouldPrintDebug: boolean | 'verbose'\n}) {\n // called when evaluateAstNode encounters a dynamic-looking prop\n const evalFn = (n: t.Node) => {\n // themes\n if (\n t.isMemberExpression(n) &&\n t.isIdentifier(n.property) &&\n traversePath &&\n isValidThemeHook(traversePath, n, sourcePath)\n ) {\n const key = n.property.name\n if (shouldPrintDebug) {\n console.log(' > found theme prop', key)\n }\n console.log('SHOULD FIND THEME (NESTED NOW)', key) // tamaguiConfig.themes)\n // if (!themeKeys.has(key)) {\n // throw new Error(` > accessing non-existent theme key: ${key}`)\n // }\n return createCSSVariable(key)\n }\n // variable\n if (t.isIdentifier(n) && staticNamespace.hasOwnProperty(n.name)) {\n return staticNamespace[n.name]\n }\n const evalContext = vm.createContext(staticNamespace)\n const codeWithTypescriptAnnotations = `(${generate(n as any).code})`\n const code = esbuild\n .transformSync(codeWithTypescriptAnnotations, { loader: 'tsx' })\n .code.replace(/;\\n$/, '')\n\n if (shouldPrintDebug) {\n console.log('evaluating', code)\n }\n return vm.runInContext(code, evalContext)\n }\n\n return (n: t.Node) => {\n return evaluateAstNode(n, evalFn)\n }\n}\n\nexport function createSafeEvaluator(attemptEval: (n: t.Node) => any) {\n return (n: t.Node) => {\n try {\n return attemptEval(n)\n } catch (err) {\n return FAILED_EVAL\n }\n }\n}\n"],
4
+ "sourcesContent": ["import vm from 'vm'\n\nimport generate from '@babel/generator'\nimport { NodePath } from '@babel/traverse'\nimport * as t from '@babel/types'\nimport type { TamaguiConfig } from '@tamagui/core-node'\nimport { createCSSVariable } from '@tamagui/core-node'\nimport esbuild from 'esbuild'\n\nimport { FAILED_EVAL } from '../constants'\nimport { evaluateAstNode } from './evaluateAstNode'\nimport { isValidThemeHook } from './extractHelpers'\n\nexport function createEvaluator({\n tamaguiConfig,\n staticNamespace,\n sourcePath,\n traversePath,\n shouldPrintDebug,\n}: {\n tamaguiConfig: TamaguiConfig\n staticNamespace: Record<string, any>\n sourcePath: string\n traversePath?: NodePath<t.JSXElement>\n shouldPrintDebug: boolean | 'verbose'\n}) {\n // called when evaluateAstNode encounters a dynamic-looking prop\n const evalFn = (n: t.Node) => {\n // themes\n if (\n t.isMemberExpression(n) &&\n t.isIdentifier(n.property) &&\n traversePath &&\n isValidThemeHook(traversePath, n, sourcePath)\n ) {\n const key = n.property.name\n if (shouldPrintDebug) {\n console.log(' > found theme prop', key)\n }\n console.log('SHOULD FIND THEME (NESTED NOW)', key) // tamaguiConfig.themes)\n // if (!themeKeys.has(key)) {\n // throw new Error(` > accessing non-existent theme key: ${key}`)\n // }\n return createCSSVariable(key)\n }\n // variable\n if (t.isIdentifier(n) && staticNamespace.hasOwnProperty(n.name)) {\n return staticNamespace[n.name]\n }\n const evalContext = vm.createContext(staticNamespace)\n const codeWithTypescriptAnnotations = `(${generate(n as any).code})`\n const code = esbuild\n .transformSync(codeWithTypescriptAnnotations, { loader: 'tsx' })\n .code.replace(/;\\n$/, '')\n\n if (shouldPrintDebug) {\n console.log('evaluating', code)\n }\n return vm.runInContext(code, evalContext)\n }\n\n return (n: t.Node) => {\n return evaluateAstNode(n, evalFn)\n }\n}\n\nexport function createSafeEvaluator(attemptEval: (n: t.Node) => any) {\n return (n: t.Node) => {\n try {\n return attemptEval(n)\n } catch (err) {\n return FAILED_EVAL\n }\n }\n}\n"],
5
5
  "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,gBAAe;AAEf,uBAAqB;AAErB,QAAmB;AAEnB,uBAAkC;AAClC,qBAAoB;AAEpB,uBAA4B;AAC5B,6BAAgC;AAChC,4BAAiC;AAE1B,yBAAyB;AAAA,EAC9B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,GAOC;AAED,QAAM,SAAS,CAAC,MAAc;AAE5B,QACE,EAAE,mBAAmB,CAAC,KACtB,EAAE,aAAa,EAAE,QAAQ,KACzB,gBACA,4CAAiB,cAAc,GAAG,UAAU,GAC5C;AACA,YAAM,MAAM,EAAE,SAAS;AACvB,UAAI,kBAAkB;AACpB,gBAAQ,IAAI,0BAA0B,GAAG;AAAA,MAC3C;AACA,cAAQ,IAAI,kCAAkC,GAAG;AAIjD,aAAO,wCAAkB,GAAG;AAAA,IAC9B;AAEA,QAAI,EAAE,aAAa,CAAC,KAAK,gBAAgB,eAAe,EAAE,IAAI,GAAG;AAC/D,aAAO,gBAAgB,EAAE;AAAA,IAC3B;AACA,UAAM,cAAc,kBAAG,cAAc,eAAe;AACpD,UAAM,gCAAgC,IAAI,8BAAS,CAAQ,EAAE;AAC7D,UAAM,OAAO,uBACV,cAAc,+BAA+B,EAAE,QAAQ,MAAM,CAAC,EAC9D,KAAK,QAAQ,QAAQ,EAAE;AAE1B,QAAI,kBAAkB;AACpB,cAAQ,IAAI,cAAc,IAAI;AAAA,IAChC;AACA,WAAO,kBAAG,aAAa,MAAM,WAAW;AAAA,EAC1C;AAEA,SAAO,CAAC,MAAc;AACpB,WAAO,4CAAgB,GAAG,MAAM;AAAA,EAClC;AACF;AAEO,6BAA6B,aAAiC;AACnE,SAAO,CAAC,MAAc;AACpB,QAAI;AACF,aAAO,YAAY,CAAC;AAAA,IACtB,SAAS,KAAP;AACA,aAAO;AAAA,IACT;AAAA,EACF;AACF;",
6
6
  "names": []
7
7
  }
@@ -0,0 +1,177 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
7
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8
+ var __spreadValues = (a, b) => {
9
+ for (var prop in b || (b = {}))
10
+ if (__hasOwnProp.call(b, prop))
11
+ __defNormalProp(a, prop, b[prop]);
12
+ if (__getOwnPropSymbols)
13
+ for (var prop of __getOwnPropSymbols(b)) {
14
+ if (__propIsEnum.call(b, prop))
15
+ __defNormalProp(a, prop, b[prop]);
16
+ }
17
+ return a;
18
+ };
19
+ var __export = (target, all) => {
20
+ for (var name in all)
21
+ __defProp(target, name, { get: all[name], enumerable: true });
22
+ };
23
+ var __copyProps = (to, from, except, desc) => {
24
+ if (from && typeof from === "object" || typeof from === "function") {
25
+ for (let key of __getOwnPropNames(from))
26
+ if (!__hasOwnProp.call(to, key) && key !== except)
27
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
28
+ }
29
+ return to;
30
+ };
31
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
32
+ var defaultTamaguiConfig_exports = {};
33
+ __export(defaultTamaguiConfig_exports, {
34
+ getDefaultTamaguiConfig: () => getDefaultTamaguiConfig
35
+ });
36
+ module.exports = __toCommonJS(defaultTamaguiConfig_exports);
37
+ var import_core_node = require("@tamagui/core-node");
38
+ var import_shorthands = require("@tamagui/shorthands");
39
+ function getDefaultTamaguiConfig() {
40
+ const font = (0, import_core_node.createFont)({
41
+ family: "System",
42
+ size: {
43
+ 1: 15
44
+ },
45
+ lineHeight: {
46
+ 1: 15
47
+ },
48
+ transform: {},
49
+ weight: {
50
+ 1: "400"
51
+ },
52
+ color: {
53
+ 1: "$color"
54
+ },
55
+ letterSpacing: {
56
+ 1: 0
57
+ }
58
+ });
59
+ const size = {
60
+ 0: 0,
61
+ 0.25: 2,
62
+ 0.5: 4,
63
+ 0.75: 8,
64
+ 1: 20,
65
+ 1.5: 24,
66
+ 2: 28,
67
+ 2.5: 32,
68
+ 3: 36,
69
+ 3.5: 40,
70
+ 4: 44,
71
+ true: 44,
72
+ 4.5: 48,
73
+ 5: 52,
74
+ 5.5: 59,
75
+ 6: 64,
76
+ 6.5: 69,
77
+ 7: 74,
78
+ 7.6: 79,
79
+ 8: 84,
80
+ 8.5: 89,
81
+ 9: 94,
82
+ 9.5: 99,
83
+ 10: 104,
84
+ 11: 124,
85
+ 12: 144,
86
+ 13: 164,
87
+ 14: 184,
88
+ 15: 204,
89
+ 16: 224,
90
+ 17: 224,
91
+ 18: 244,
92
+ 19: 264,
93
+ 20: 284
94
+ };
95
+ const spaces = Object.entries(size).map(([k, v]) => [
96
+ k,
97
+ Math.max(0, v <= 16 ? Math.round(v * 0.333) : Math.floor(v * 0.7 - 12))
98
+ ]);
99
+ const spacesNegative = spaces.map(([k, v]) => [`-${k}`, -v]);
100
+ const space = __spreadValues(__spreadValues({}, Object.fromEntries(spaces)), Object.fromEntries(spacesNegative));
101
+ const zIndex = {
102
+ 0: 0,
103
+ 1: 100,
104
+ 2: 200,
105
+ 3: 300,
106
+ 4: 400,
107
+ 5: 500
108
+ };
109
+ const radius = {
110
+ 0: 0,
111
+ 1: 3,
112
+ 2: 5,
113
+ 3: 7,
114
+ 4: 9,
115
+ 5: 10,
116
+ 6: 16,
117
+ 7: 19,
118
+ 8: 22,
119
+ 9: 26,
120
+ 10: 34,
121
+ 11: 42,
122
+ 12: 50
123
+ };
124
+ const tokens = (0, import_core_node.createTokens)({
125
+ color: {
126
+ white: "#fff",
127
+ black: "#000"
128
+ },
129
+ radius,
130
+ zIndex,
131
+ space,
132
+ size
133
+ });
134
+ const themes = {
135
+ light: {
136
+ background: tokens.color.white,
137
+ color: tokens.color.black
138
+ },
139
+ dark: {
140
+ background: tokens.color.black,
141
+ color: tokens.color.white
142
+ }
143
+ };
144
+ return (0, import_core_node.createTamagui)({
145
+ defaultTheme: "light",
146
+ shouldAddPrefersColorThemes: true,
147
+ themeClassNameOnRoot: true,
148
+ shorthands: import_shorthands.shorthands,
149
+ fonts: {
150
+ heading: font,
151
+ body: font
152
+ },
153
+ themes,
154
+ tokens,
155
+ media: {
156
+ xs: { maxWidth: 660 },
157
+ sm: { maxWidth: 800 },
158
+ md: { maxWidth: 1020 },
159
+ lg: { maxWidth: 1280 },
160
+ xl: { maxWidth: 1420 },
161
+ xxl: { maxWidth: 1600 },
162
+ gtXs: { minWidth: 660 + 1 },
163
+ gtSm: { minWidth: 800 + 1 },
164
+ gtMd: { minWidth: 1020 + 1 },
165
+ gtLg: { minWidth: 1280 + 1 },
166
+ short: { maxHeight: 820 },
167
+ tall: { minHeight: 820 },
168
+ hoverNone: { hover: "none" },
169
+ pointerCoarse: { pointer: "coarse" }
170
+ }
171
+ });
172
+ }
173
+ // Annotate the CommonJS export names for ESM import in node:
174
+ 0 && (module.exports = {
175
+ getDefaultTamaguiConfig
176
+ });
177
+ //# sourceMappingURL=defaultTamaguiConfig.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/extractor/defaultTamaguiConfig.ts"],
4
+ "sourcesContent": ["import { TamaguiInternalConfig, createFont, createTamagui, createTokens } from '@tamagui/core-node'\nimport { shorthands } from '@tamagui/shorthands'\n\n// basic fallback theme just to have compiler load in decent tate\nexport function getDefaultTamaguiConfig() {\n const font = createFont({\n family: 'System',\n size: {\n 1: 15,\n },\n lineHeight: {\n 1: 15,\n },\n transform: {},\n weight: {\n 1: '400',\n },\n color: {\n 1: '$color',\n },\n letterSpacing: {\n 1: 0,\n },\n })\n\n const size = {\n 0: 0,\n 0.25: 2,\n 0.5: 4,\n 0.75: 8,\n 1: 20,\n 1.5: 24,\n 2: 28,\n 2.5: 32,\n 3: 36,\n 3.5: 40,\n 4: 44,\n true: 44,\n 4.5: 48,\n 5: 52,\n 5.5: 59,\n 6: 64,\n 6.5: 69,\n 7: 74,\n 7.6: 79,\n 8: 84,\n 8.5: 89,\n 9: 94,\n 9.5: 99,\n 10: 104,\n 11: 124,\n 12: 144,\n 13: 164,\n 14: 184,\n 15: 204,\n 16: 224,\n 17: 224,\n 18: 244,\n 19: 264,\n 20: 284,\n }\n\n const spaces = Object.entries(size).map(([k, v]) => [\n k,\n Math.max(0, v <= 16 ? Math.round(v * 0.333) : Math.floor(v * 0.7 - 12)),\n ])\n\n const spacesNegative = spaces.map(([k, v]) => [`-${k}`, -v])\n\n const space = {\n ...Object.fromEntries(spaces),\n ...Object.fromEntries(spacesNegative),\n } as any\n\n const zIndex = {\n 0: 0,\n 1: 100,\n 2: 200,\n 3: 300,\n 4: 400,\n 5: 500,\n }\n\n const radius = {\n 0: 0,\n 1: 3,\n 2: 5,\n 3: 7,\n 4: 9,\n 5: 10,\n 6: 16,\n 7: 19,\n 8: 22,\n 9: 26,\n 10: 34,\n 11: 42,\n 12: 50,\n }\n\n const tokens = createTokens({\n color: {\n white: '#fff',\n black: '#000',\n },\n radius,\n zIndex,\n space,\n size,\n })\n\n const themes = {\n light: {\n background: tokens.color.white,\n color: tokens.color.black,\n },\n dark: {\n background: tokens.color.black,\n color: tokens.color.white,\n },\n }\n\n return createTamagui({\n defaultTheme: 'light',\n shouldAddPrefersColorThemes: true,\n themeClassNameOnRoot: true,\n shorthands,\n fonts: {\n heading: font,\n body: font,\n },\n themes,\n tokens,\n media: {\n xs: { maxWidth: 660 },\n sm: { maxWidth: 800 },\n md: { maxWidth: 1020 },\n lg: { maxWidth: 1280 },\n xl: { maxWidth: 1420 },\n xxl: { maxWidth: 1600 },\n gtXs: { minWidth: 660 + 1 },\n gtSm: { minWidth: 800 + 1 },\n gtMd: { minWidth: 1020 + 1 },\n gtLg: { minWidth: 1280 + 1 },\n short: { maxHeight: 820 },\n tall: { minHeight: 820 },\n hoverNone: { hover: 'none' },\n pointerCoarse: { pointer: 'coarse' },\n },\n }) as TamaguiInternalConfig\n}\n"],
5
+ "mappings": "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",
6
+ "names": []
7
+ }
@@ -36,6 +36,9 @@ __export(loadTamagui_exports, {
36
36
  module.exports = __toCommonJS(loadTamagui_exports);
37
37
  var import_path = require("path");
38
38
  var import_core_node = require("@tamagui/core-node");
39
+ var import_constants = require("../constants");
40
+ var import_require = require("../require");
41
+ var import_defaultTamaguiConfig = require("./defaultTamaguiConfig");
39
42
  let loadedTamagui = null;
40
43
  function loadTamagui(props) {
41
44
  if (loadedTamagui) {
@@ -51,85 +54,61 @@ function loadTamagui(props) {
51
54
  if (typeof globalThis["__DEV__"] === "undefined") {
52
55
  globalThis["__DEV__"] = process.env.NODE_ENV === "development";
53
56
  }
54
- const proxyWorm = require("@tamagui/proxy-worm");
55
- const rnw = require("react-native-web");
56
- const Mod = require("module");
57
- const og = Mod.prototype.require;
58
- const nameToPaths = {};
59
- Mod.prototype.require = function(path) {
60
- var _a2, _b;
61
- if (path.endsWith(".css")) {
62
- return {};
63
- }
64
- if (path === "@gorhom/bottom-sheet" || path.startsWith("react-native-reanimated") || path === "expo-linear-gradient") {
65
- return proxyWorm;
66
- }
67
- if (path.startsWith("react-native") && !path.startsWith("react-native-web/dist/cjs/exports")) {
68
- return rnw;
69
- }
70
- try {
71
- const out = og.apply(this, arguments);
72
- if (!nameToPaths[path]) {
73
- if (out && typeof out === "object") {
74
- for (const key in out) {
75
- try {
76
- const conf = (_a2 = out[key]) == null ? void 0 : _a2.staticConfig;
77
- if (conf) {
78
- if (conf.componentName) {
79
- nameToPaths[_b = conf.componentName] ?? (nameToPaths[_b] = /* @__PURE__ */ new Set());
80
- const fullName = path.startsWith(".") ? (0, import_path.join)(`${this.path.replace(/dist(\/cjs)?/, "src")}`, path) : path;
81
- nameToPaths[conf.componentName].add(fullName);
82
- } else {
83
- }
84
- }
85
- } catch {
86
- }
87
- }
88
- }
89
- }
90
- return out;
91
- } catch (err) {
92
- console.error("Tamagui error loading file:\n", path, err.message, "\n", err.stack);
93
- process.exit(1);
94
- }
95
- };
96
- const exp = require(configPath);
97
- const tamaguiConfig = exp["default"] || exp;
98
- if (!tamaguiConfig || !tamaguiConfig.parsed) {
99
- try {
57
+ (0, import_require.registerRequire)();
58
+ try {
59
+ const exp = require(configPath);
60
+ const tamaguiConfig = exp["default"] || exp;
61
+ if (!tamaguiConfig || !tamaguiConfig.parsed) {
100
62
  const confPath = require.resolve(configPath);
101
63
  console.log(`Received:`, tamaguiConfig);
102
64
  throw new Error(`Can't find valid config in ${confPath}`);
103
- } catch (err) {
104
- throw err;
105
65
  }
106
- }
107
- const components = {};
108
- for (const moduleName of props.components) {
109
- const exported = require(moduleName);
110
- for (const Name in exported) {
111
- const val = exported[Name];
112
- const staticConfig = val == null ? void 0 : val.staticConfig;
113
- if (staticConfig) {
114
- const _a = staticConfig, { Component, reactNativeWebComponent } = _a, sc = __objRest(_a, ["Component", "reactNativeWebComponent"]);
115
- Object.assign(components, { [Name]: { staticConfig: sc } });
66
+ const components = {};
67
+ for (const moduleName of props.components) {
68
+ const exported = require(moduleName);
69
+ for (const Name in exported) {
70
+ const val = exported[Name];
71
+ const staticConfig = val == null ? void 0 : val.staticConfig;
72
+ if (staticConfig) {
73
+ const _a = staticConfig, { Component, reactNativeWebComponent } = _a, sc = __objRest(_a, ["Component", "reactNativeWebComponent"]);
74
+ Object.assign(components, { [Name]: { staticConfig: sc } });
75
+ }
76
+ }
77
+ }
78
+ process.env.IS_STATIC = void 0;
79
+ (0, import_core_node.createTamagui)(tamaguiConfig);
80
+ loadedTamagui = {
81
+ components,
82
+ tamaguiConfig,
83
+ nameToPaths: (0, import_require.getNameToPaths)()
84
+ };
85
+ } catch (err) {
86
+ if (err instanceof Error) {
87
+ console.warn(`Error loading tamagui.config.ts (set DEBUG=tamagui to see full stack), running tamagui without custom config`);
88
+ console.log(`
89
+
90
+ ${err.message}
91
+
92
+ `);
93
+ if (import_constants.SHOULD_DEBUG) {
94
+ console.log(err.stack);
116
95
  }
96
+ } else {
97
+ console.error(`Error loading tamagui.config.ts`, err);
117
98
  }
99
+ return {
100
+ components: {},
101
+ tamaguiConfig: (0, import_defaultTamaguiConfig.getDefaultTamaguiConfig)(),
102
+ nameToPaths: {}
103
+ };
118
104
  }
119
- process.env.IS_STATIC = void 0;
120
- Mod.prototype.require = og;
121
- (0, import_core_node.createTamagui)(tamaguiConfig);
122
- loadedTamagui = {
123
- components,
124
- tamaguiConfig,
125
- nameToPaths
126
- };
127
105
  return loadedTamagui;
128
106
  } catch (err) {
129
107
  console.log("Error loading Tamagui", err);
130
108
  throw err;
131
109
  } finally {
132
110
  unregister();
111
+ (0, import_require.unregisterRequire)();
133
112
  }
134
113
  }
135
114
  // Annotate the CommonJS export names for ESM import in node:
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/extractor/loadTamagui.ts"],
4
- "sourcesContent": ["import { join } from 'path'\n\nimport type { StaticConfig, TamaguiComponent, TamaguiInternalConfig } from '@tamagui/core'\nimport { createTamagui } from '@tamagui/core-node'\n\nlet loadedTamagui: any = null\n\ntype NameToPaths = {\n [key: string]: Set<string>\n}\n\nexport type TamaguiProjectInfo = {\n components: Record<string, TamaguiComponent>\n tamaguiConfig: TamaguiInternalConfig\n nameToPaths: NameToPaths\n}\n\nexport function loadTamagui(props: { components: string[]; config: string }): TamaguiProjectInfo {\n if (loadedTamagui) {\n return loadedTamagui\n }\n\n const configPath = join(process.cwd(), props.config)\n\n const { unregister } = require('esbuild-register/dist/node').register({\n target: 'es2019',\n format: 'cjs',\n })\n\n try {\n // lets shim require and avoid importing react-native + react-native-web\n // we just need to read the config around them\n process.env.IS_STATIC = 'is_static'\n // @ts-ignore\n if (typeof globalThis['__DEV__'] === 'undefined') {\n // @ts-ignore\n globalThis['__DEV__'] = process.env.NODE_ENV === 'development'\n }\n\n const proxyWorm = require('@tamagui/proxy-worm')\n const rnw = require('react-native-web')\n const Mod = require('module')\n const og = Mod.prototype.require\n const nameToPaths: NameToPaths = {}\n\n Mod.prototype.require = function (path: string) {\n if (path.endsWith('.css')) {\n return {}\n }\n if (\n path === '@gorhom/bottom-sheet' ||\n path.startsWith('react-native-reanimated') ||\n path === 'expo-linear-gradient'\n ) {\n return proxyWorm\n }\n if (\n path.startsWith('react-native') &&\n // allow our rnw.tsx imports through\n !path.startsWith('react-native-web/dist/cjs/exports')\n ) {\n return rnw\n }\n try {\n const out = og.apply(this, arguments)\n if (!nameToPaths[path]) {\n if (out && typeof out === 'object') {\n for (const key in out) {\n try {\n const conf = out[key]?.staticConfig as StaticConfig\n if (conf) {\n if (conf.componentName) {\n nameToPaths[conf.componentName] ??= new Set()\n const fullName = path.startsWith('.')\n ? join(`${this.path.replace(/dist(\\/cjs)?/, 'src')}`, path)\n : path\n nameToPaths[conf.componentName].add(fullName)\n } else {\n // console.log('no name component', path)\n }\n }\n } catch {\n // ok\n }\n }\n }\n }\n return out\n } catch (err: any) {\n console.error('Tamagui error loading file:\\n', path, err.message, '\\n', err.stack)\n // avoid infinite loops\n process.exit(1)\n }\n }\n\n // import config\n const exp = require(configPath)\n const tamaguiConfig = (exp['default'] || exp) as TamaguiInternalConfig\n\n if (!tamaguiConfig || !tamaguiConfig.parsed) {\n try {\n const confPath = require.resolve(configPath)\n console.log(`Received:`, tamaguiConfig)\n throw new Error(`Can't find valid config in ${confPath}`)\n } catch (err) {\n throw err\n }\n }\n\n // import components\n const components = {}\n for (const moduleName of props.components) {\n const exported = require(moduleName)\n for (const Name in exported) {\n const val = exported[Name]\n const staticConfig = val?.staticConfig as StaticConfig | undefined\n if (staticConfig) {\n // remove non-stringifyable\n const { Component, reactNativeWebComponent, ...sc } = staticConfig\n Object.assign(components, { [Name]: { staticConfig: sc } })\n }\n }\n }\n\n // undo shims\n process.env.IS_STATIC = undefined\n Mod.prototype.require = og\n\n // set up core-node\n createTamagui(tamaguiConfig as any)\n\n loadedTamagui = {\n components,\n tamaguiConfig,\n nameToPaths,\n }\n\n return loadedTamagui\n } catch (err) {\n console.log('Error loading Tamagui', err)\n throw err\n } finally {\n unregister()\n }\n}\n"],
5
- "mappings": "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",
4
+ "sourcesContent": ["import { join } from 'path'\n\nimport type { StaticConfig, TamaguiComponent, TamaguiInternalConfig } from '@tamagui/core-node'\nimport { createTamagui } from '@tamagui/core-node'\n\nimport { SHOULD_DEBUG } from '../constants'\nimport { getNameToPaths, registerRequire, unregisterRequire } from '../require'\nimport { getDefaultTamaguiConfig } from './defaultTamaguiConfig'\n\nlet loadedTamagui: any = null\n\ntype NameToPaths = {\n [key: string]: Set<string>\n}\n\nexport type TamaguiProjectInfo = {\n components: Record<string, TamaguiComponent>\n tamaguiConfig: TamaguiInternalConfig\n nameToPaths: NameToPaths\n}\n\nexport function loadTamagui(props: { components: string[]; config: string }): TamaguiProjectInfo {\n if (loadedTamagui) {\n return loadedTamagui\n }\n\n const configPath = join(process.cwd(), props.config)\n\n const { unregister } = require('esbuild-register/dist/node').register({\n target: 'es2019',\n format: 'cjs',\n })\n\n try {\n // lets shim require and avoid importing react-native + react-native-web\n // we just need to read the config around them\n process.env.IS_STATIC = 'is_static'\n // @ts-ignore\n if (typeof globalThis['__DEV__'] === 'undefined') {\n // @ts-ignore\n globalThis['__DEV__'] = process.env.NODE_ENV === 'development'\n }\n\n registerRequire()\n\n try {\n // import config\n const exp = require(configPath)\n const tamaguiConfig = (exp['default'] || exp) as TamaguiInternalConfig\n\n if (!tamaguiConfig || !tamaguiConfig.parsed) {\n const confPath = require.resolve(configPath)\n console.log(`Received:`, tamaguiConfig)\n throw new Error(`Can't find valid config in ${confPath}`)\n }\n\n // import components\n const components = {}\n for (const moduleName of props.components) {\n const exported = require(moduleName)\n for (const Name in exported) {\n const val = exported[Name]\n const staticConfig = val?.staticConfig as StaticConfig | undefined\n if (staticConfig) {\n // remove non-stringifyable\n const { Component, reactNativeWebComponent, ...sc } = staticConfig\n Object.assign(components, { [Name]: { staticConfig: sc } })\n }\n }\n }\n\n // undo shims\n process.env.IS_STATIC = undefined\n\n // set up core-node\n createTamagui(tamaguiConfig as any)\n\n loadedTamagui = {\n components,\n tamaguiConfig,\n nameToPaths: getNameToPaths(),\n }\n } catch (err) {\n if (err instanceof Error) {\n console.warn(\n `Error loading tamagui.config.ts (set DEBUG=tamagui to see full stack), running tamagui without custom config`\n )\n console.log(`\\n\\n ${err.message}\\n\\n`)\n if (SHOULD_DEBUG) {\n console.log(err.stack)\n }\n } else {\n console.error(`Error loading tamagui.config.ts`, err)\n }\n return {\n components: {},\n tamaguiConfig: getDefaultTamaguiConfig(),\n nameToPaths: {},\n }\n }\n\n return loadedTamagui\n } catch (err) {\n console.log('Error loading Tamagui', err)\n throw err\n } finally {\n unregister()\n unregisterRequire()\n }\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAqB;AAGrB,uBAA8B;AAE9B,uBAA6B;AAC7B,qBAAmE;AACnE,kCAAwC;AAExC,IAAI,gBAAqB;AAYlB,qBAAqB,OAAqE;AAC/F,MAAI,eAAe;AACjB,WAAO;AAAA,EACT;AAEA,QAAM,aAAa,sBAAK,QAAQ,IAAI,GAAG,MAAM,MAAM;AAEnD,QAAM,EAAE,eAAe,QAAQ,4BAA4B,EAAE,SAAS;AAAA,IACpE,QAAQ;AAAA,IACR,QAAQ;AAAA,EACV,CAAC;AAED,MAAI;AAGF,YAAQ,IAAI,YAAY;AAExB,QAAI,OAAO,WAAW,eAAe,aAAa;AAEhD,iBAAW,aAAa,QAAQ,IAAI,aAAa;AAAA,IACnD;AAEA,wCAAgB;AAEhB,QAAI;AAEF,YAAM,MAAM,QAAQ,UAAU;AAC9B,YAAM,gBAAiB,IAAI,cAAc;AAEzC,UAAI,CAAC,iBAAiB,CAAC,cAAc,QAAQ;AAC3C,cAAM,WAA2B,AAAhB,QAAQ,QAAQ;AACjC,gBAAQ,IAAI,aAAa,aAAa;AACtC,cAAM,IAAI,MAAM,8BAA8B,UAAU;AAAA,MAC1D;AAGA,YAAM,aAAa,CAAC;AACpB,iBAAW,cAAc,MAAM,YAAY;AACzC,cAAM,WAAW,QAAQ,UAAU;AACnC,mBAAW,QAAQ,UAAU;AAC3B,gBAAM,MAAM,SAAS;AACrB,gBAAM,eAAe,2BAAK;AAC1B,cAAI,cAAc;AAEhB,kBAAsD,mBAA9C,aAAW,4BAAmC,IAAP,eAAO,IAAP,CAAvC,aAAW;AACnB,mBAAO,OAAO,YAAY,EAAE,CAAC,OAAO,EAAE,cAAc,GAAG,EAAE,CAAC;AAAA,UAC5D;AAAA,QACF;AAAA,MACF;AAGA,cAAQ,IAAI,YAAY;AAGxB,0CAAc,aAAoB;AAElC,sBAAgB;AAAA,QACd;AAAA,QACA;AAAA,QACA,aAAa,mCAAe;AAAA,MAC9B;AAAA,IACF,SAAS,KAAP;AACA,UAAI,eAAe,OAAO;AACxB,gBAAQ,KACN,8GACF;AACA,gBAAQ,IAAI;AAAA;AAAA,MAAW,IAAI;AAAA;AAAA,CAAa;AACxC,YAAI,+BAAc;AAChB,kBAAQ,IAAI,IAAI,KAAK;AAAA,QACvB;AAAA,MACF,OAAO;AACL,gBAAQ,MAAM,mCAAmC,GAAG;AAAA,MACtD;AACA,aAAO;AAAA,QACL,YAAY,CAAC;AAAA,QACb,eAAe,yDAAwB;AAAA,QACvC,aAAa,CAAC;AAAA,MAChB;AAAA,IACF;AAEA,WAAO;AAAA,EACT,SAAS,KAAP;AACA,YAAQ,IAAI,yBAAyB,GAAG;AACxC,UAAM;AAAA,EACR,UAAE;AACA,eAAW;AACX,0CAAkB;AAAA,EACpB;AACF;",
6
6
  "names": []
7
7
  }
package/dist/cjs/index.js CHANGED
@@ -31,6 +31,7 @@ __reExport(src_exports, require("./extractor/extractToClassNames"), module.expor
31
31
  __reExport(src_exports, require("./extractor/extractHelpers"), module.exports);
32
32
  __reExport(src_exports, require("@tamagui/patch-rnw"), module.exports);
33
33
  __reExport(src_exports, require("./extractor/loadTamagui"), module.exports);
34
+ __reExport(src_exports, require("./require"), module.exports);
34
35
  process.env.TAMAGUI_COMPILE_PROCESS = "1";
35
36
  // Annotate the CommonJS export names for ESM import in node:
36
37
  0 && (module.exports = {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/index.ts"],
4
- "sourcesContent": ["process.env.TAMAGUI_COMPILE_PROCESS = '1'\n\nexport { TamaguiOptions } from './types'\nexport { createExtractor } from './extractor/createExtractor'\nexport { literalToAst } from './extractor/literalToAst'\nexport * from './constants'\nexport * from './extractor/extractToClassNames'\nexport * from './extractor/extractHelpers'\nexport * from '@tamagui/patch-rnw'\nexport * from './extractor/loadTamagui'\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,mBAA+B;AAC/B,6BAAgC;AAChC,0BAA6B;AAC7B,wBAAc,wBALd;AAMA,wBAAc,4CANd;AAOA,wBAAc,uCAPd;AAQA,wBAAc,+BARd;AASA,wBAAc,oCATd;AAAA,QAAQ,IAAI,0BAA0B;",
4
+ "sourcesContent": ["process.env.TAMAGUI_COMPILE_PROCESS = '1'\n\nexport { TamaguiOptions } from './types'\nexport { createExtractor } from './extractor/createExtractor'\nexport { literalToAst } from './extractor/literalToAst'\nexport * from './constants'\nexport * from './extractor/extractToClassNames'\nexport * from './extractor/extractHelpers'\nexport * from '@tamagui/patch-rnw'\nexport * from './extractor/loadTamagui'\nexport * from './require'\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,mBAA+B;AAC/B,6BAAgC;AAChC,0BAA6B;AAC7B,wBAAc,wBALd;AAMA,wBAAc,4CANd;AAOA,wBAAc,uCAPd;AAQA,wBAAc,+BARd;AASA,wBAAc,oCATd;AAUA,wBAAc,sBAVd;AAAA,QAAQ,IAAI,0BAA0B;",
6
6
  "names": []
7
7
  }
@@ -0,0 +1,99 @@
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)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+ var require_exports = {};
19
+ __export(require_exports, {
20
+ getNameToPaths: () => getNameToPaths,
21
+ registerRequire: () => registerRequire,
22
+ unregisterRequire: () => unregisterRequire
23
+ });
24
+ module.exports = __toCommonJS(require_exports);
25
+ var import_path = require("path");
26
+ var import_constants = require("./constants");
27
+ const nameToPaths = {};
28
+ const Mod = require("module");
29
+ const og = Mod.prototype.require;
30
+ globalThis["ogRequire"] = og;
31
+ const getNameToPaths = () => nameToPaths;
32
+ let tries = 0;
33
+ setInterval(() => {
34
+ tries = 0;
35
+ }, 500);
36
+ function registerRequire() {
37
+ if (Mod.prototype.require !== globalThis["ogRequire"]) {
38
+ console.warn("didnt unregister before re-registering");
39
+ process.exit(1);
40
+ }
41
+ const proxyWorm = require("@tamagui/proxy-worm");
42
+ const rnw = require("react-native-web");
43
+ Mod.prototype.require = function(path) {
44
+ var _a, _b;
45
+ if (import_constants.SHOULD_DEBUG) {
46
+ console.log("tamagui require", path);
47
+ }
48
+ if (path.endsWith(".css")) {
49
+ return {};
50
+ }
51
+ if (path === "@gorhom/bottom-sheet" || path.startsWith("react-native-reanimated") || path === "expo-linear-gradient") {
52
+ return proxyWorm;
53
+ }
54
+ if (path.startsWith("react-native") && !path.startsWith("react-native-web/dist/cjs/exports")) {
55
+ return rnw;
56
+ }
57
+ try {
58
+ const out = og.apply(this, arguments);
59
+ if (!nameToPaths[path]) {
60
+ if (out && typeof out === "object") {
61
+ for (const key in out) {
62
+ try {
63
+ const conf = (_a = out[key]) == null ? void 0 : _a.staticConfig;
64
+ if (conf) {
65
+ if (conf.componentName) {
66
+ nameToPaths[_b = conf.componentName] ?? (nameToPaths[_b] = /* @__PURE__ */ new Set());
67
+ const fullName = path.startsWith(".") ? (0, import_path.join)(`${this.path.replace(/dist(\/cjs)?/, "src")}`, path) : path;
68
+ nameToPaths[conf.componentName].add(fullName);
69
+ } else {
70
+ }
71
+ }
72
+ } catch {
73
+ }
74
+ }
75
+ }
76
+ }
77
+ return out;
78
+ } catch (err) {
79
+ console.error(`Tamagui failed requiring ${path} from your tamagui.config.ts file, ignoring (set DEBUG=tamagui to see stack)
80
+ `, err.message);
81
+ if (import_constants.SHOULD_DEBUG) {
82
+ console.log(err.stack);
83
+ }
84
+ if (++tries > 10) {
85
+ process.exit(1);
86
+ }
87
+ }
88
+ };
89
+ }
90
+ function unregisterRequire() {
91
+ Mod.prototype.require = og;
92
+ }
93
+ // Annotate the CommonJS export names for ESM import in node:
94
+ 0 && (module.exports = {
95
+ getNameToPaths,
96
+ registerRequire,
97
+ unregisterRequire
98
+ });
99
+ //# sourceMappingURL=require.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/require.ts"],
4
+ "sourcesContent": ["import { join } from 'path'\n\nimport type { StaticConfig } from '@tamagui/core-node'\n\nimport { SHOULD_DEBUG } from './constants'\n\nconst nameToPaths = {}\nconst Mod = require('module')\nconst og = Mod.prototype.require\nglobalThis['ogRequire'] = og\n\nexport const getNameToPaths = () => nameToPaths\n\nlet tries = 0\nsetInterval(() => {\n tries = 0\n}, 500)\n\nexport function registerRequire() {\n if (Mod.prototype.require !== globalThis['ogRequire']) {\n console.warn('didnt unregister before re-registering')\n process.exit(1)\n }\n\n const proxyWorm = require('@tamagui/proxy-worm')\n const rnw = require('react-native-web')\n\n Mod.prototype.require = function (path: string) {\n if (SHOULD_DEBUG) {\n console.log('tamagui require', path)\n }\n if (path.endsWith('.css')) {\n return {}\n }\n if (\n path === '@gorhom/bottom-sheet' ||\n path.startsWith('react-native-reanimated') ||\n path === 'expo-linear-gradient'\n ) {\n return proxyWorm\n }\n if (\n path.startsWith('react-native') &&\n // allow our rnw.tsx imports through\n !path.startsWith('react-native-web/dist/cjs/exports')\n ) {\n return rnw\n // return og('react-native-web')\n }\n try {\n const out = og.apply(this, arguments)\n if (!nameToPaths[path]) {\n if (out && typeof out === 'object') {\n for (const key in out) {\n try {\n const conf = out[key]?.staticConfig as StaticConfig\n if (conf) {\n if (conf.componentName) {\n nameToPaths[conf.componentName] ??= new Set()\n const fullName = path.startsWith('.')\n ? join(`${this.path.replace(/dist(\\/cjs)?/, 'src')}`, path)\n : path\n nameToPaths[conf.componentName].add(fullName)\n } else {\n // console.log('no name component', path)\n }\n }\n } catch {\n // ok\n }\n }\n }\n }\n return out\n } catch (err: any) {\n console.error(\n `Tamagui failed requiring ${path} from your tamagui.config.ts file, ignoring (set DEBUG=tamagui to see stack)\\n`,\n err.message\n )\n if (SHOULD_DEBUG) {\n console.log(err.stack)\n }\n if (++tries > 10) {\n // avoid infinite loops\n process.exit(1)\n }\n }\n }\n}\n\nexport function unregisterRequire() {\n Mod.prototype.require = og\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAqB;AAIrB,uBAA6B;AAE7B,MAAM,cAAc,CAAC;AACrB,MAAM,MAAM,QAAQ,QAAQ;AAC5B,MAAM,KAAK,IAAI,UAAU;AACzB,WAAW,eAAe;AAEnB,MAAM,iBAAiB,MAAM;AAEpC,IAAI,QAAQ;AACZ,YAAY,MAAM;AAChB,UAAQ;AACV,GAAG,GAAG;AAEC,2BAA2B;AAChC,MAAI,IAAI,UAAU,YAAY,WAAW,cAAc;AACrD,YAAQ,KAAK,wCAAwC;AACrD,YAAQ,KAAK,CAAC;AAAA,EAChB;AAEA,QAAM,YAAY,QAAQ,qBAAqB;AAC/C,QAAM,MAAM,QAAQ,kBAAkB;AAEtC,MAAI,UAAU,UAAU,SAAU,MAAc;AA3BlD;AA4BI,QAAI,+BAAc;AAChB,cAAQ,IAAI,mBAAmB,IAAI;AAAA,IACrC;AACA,QAAI,KAAK,SAAS,MAAM,GAAG;AACzB,aAAO,CAAC;AAAA,IACV;AACA,QACE,SAAS,0BACT,KAAK,WAAW,yBAAyB,KACzC,SAAS,wBACT;AACA,aAAO;AAAA,IACT;AACA,QACE,KAAK,WAAW,cAAc,KAE9B,CAAC,KAAK,WAAW,mCAAmC,GACpD;AACA,aAAO;AAAA,IAET;AACA,QAAI;AACF,YAAM,MAAM,GAAG,MAAM,MAAM,SAAS;AACpC,UAAI,CAAC,YAAY,OAAO;AACtB,YAAI,OAAO,OAAO,QAAQ,UAAU;AAClC,qBAAW,OAAO,KAAK;AACrB,gBAAI;AACF,oBAAM,OAAO,UAAI,SAAJ,mBAAU;AACvB,kBAAI,MAAM;AACR,oBAAI,KAAK,eAAe;AACtB,mCAAY,KAAK,kBAAjB,mBAAoC,oBAAI,IAAI;AAC5C,wBAAM,WAAW,KAAK,WAAW,GAAG,IAChC,sBAAK,GAAG,KAAK,KAAK,QAAQ,gBAAgB,KAAK,KAAK,IAAI,IACxD;AACJ,8BAAY,KAAK,eAAe,IAAI,QAAQ;AAAA,gBAC9C,OAAO;AAAA,gBAEP;AAAA,cACF;AAAA,YACF,QAAE;AAAA,YAEF;AAAA,UACF;AAAA,QACF;AAAA,MACF;AACA,aAAO;AAAA,IACT,SAAS,KAAP;AACA,cAAQ,MACN,4BAA4B;AAAA,GAC5B,IAAI,OACN;AACA,UAAI,+BAAc;AAChB,gBAAQ,IAAI,IAAI,KAAK;AAAA,MACvB;AACA,UAAI,EAAE,QAAQ,IAAI;AAEhB,gBAAQ,KAAK,CAAC;AAAA,MAChB;AAAA,IACF;AAAA,EACF;AACF;AAEO,6BAA6B;AAClC,MAAI,UAAU,UAAU;AAC1B;",
6
+ "names": []
7
+ }
@@ -1,14 +1,17 @@
1
+ var _a;
1
2
  import findCacheDir from "find-cache-dir";
2
3
  const CSS_FILE_NAME = "__snack.css";
3
4
  const MEDIA_SEP = "_";
4
5
  const cacheDir = findCacheDir({ name: "tamagui", create: true });
5
6
  const FAILED_EVAL = Symbol("failed_style_eval");
6
7
  const CONCAT_CLASSNAME_IMPORT = "concatClassName";
8
+ const SHOULD_DEBUG = process.env.DEBUG === "*" || ((_a = process.env.DEBUG) == null ? void 0 : _a.startsWith("tamagui"));
7
9
  export {
8
10
  CONCAT_CLASSNAME_IMPORT,
9
11
  CSS_FILE_NAME,
10
12
  FAILED_EVAL,
11
13
  MEDIA_SEP,
14
+ SHOULD_DEBUG,
12
15
  cacheDir
13
16
  };
14
17
  //# sourceMappingURL=constants.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/constants.ts"],
4
- "sourcesContent": ["import findCacheDir from 'find-cache-dir'\n\nexport const CSS_FILE_NAME = '__snack.css'\n\n// ENSURE THIS ISNT THE SAME AS THE SEPARATOR USED FOR STYLE KEYS\n// SEE matching one in concatClassName\nexport const MEDIA_SEP = '_'\n\n// ensure cache dir\nexport const cacheDir = findCacheDir({ name: 'tamagui', create: true })\n\nexport const FAILED_EVAL = Symbol('failed_style_eval')\nexport const CONCAT_CLASSNAME_IMPORT = 'concatClassName'\n"],
5
- "mappings": "AAAA;AAEO,MAAM,gBAAgB;AAItB,MAAM,YAAY;AAGlB,MAAM,WAAW,aAAa,EAAE,MAAM,WAAW,QAAQ,KAAK,CAAC;AAE/D,MAAM,cAAc,OAAO,mBAAmB;AAC9C,MAAM,0BAA0B;",
4
+ "sourcesContent": ["import findCacheDir from 'find-cache-dir'\n\nexport const CSS_FILE_NAME = '__snack.css'\n\n// ENSURE THIS ISNT THE SAME AS THE SEPARATOR USED FOR STYLE KEYS\n// SEE matching one in concatClassName\nexport const MEDIA_SEP = '_'\n\n// ensure cache dir\nexport const cacheDir = findCacheDir({ name: 'tamagui', create: true })\n\nexport const FAILED_EVAL = Symbol('failed_style_eval')\nexport const CONCAT_CLASSNAME_IMPORT = 'concatClassName'\n\nexport const SHOULD_DEBUG = process.env.DEBUG === '*' || process.env.DEBUG?.startsWith('tamagui')\n"],
5
+ "mappings": "AAAA;AAAA;AAEO,MAAM,gBAAgB;AAItB,MAAM,YAAY;AAGlB,MAAM,WAAW,aAAa,EAAE,MAAM,WAAW,QAAQ,KAAK,CAAC;AAE/D,MAAM,cAAc,OAAO,mBAAmB;AAC9C,MAAM,0BAA0B;AAEhC,MAAM,eAAe,QAAQ,IAAI,UAAU,OAAO,eAAQ,IAAI,UAAZ,mBAAmB,WAAW;",
6
6
  "names": []
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/extractor/createEvaluator.ts"],
4
- "sourcesContent": ["import vm from 'vm'\n\nimport generate from '@babel/generator'\nimport { NodePath } from '@babel/traverse'\nimport * as t from '@babel/types'\nimport type { TamaguiConfig } from '@tamagui/core'\nimport { createCSSVariable } from '@tamagui/core-node'\nimport esbuild from 'esbuild'\n\nimport { FAILED_EVAL } from '../constants'\nimport { evaluateAstNode } from './evaluateAstNode'\nimport { isValidThemeHook } from './extractHelpers'\n\nexport function createEvaluator({\n tamaguiConfig,\n staticNamespace,\n sourcePath,\n traversePath,\n shouldPrintDebug,\n}: {\n tamaguiConfig: TamaguiConfig\n staticNamespace: Record<string, any>\n sourcePath: string\n traversePath?: NodePath<t.JSXElement>\n shouldPrintDebug: boolean | 'verbose'\n}) {\n // called when evaluateAstNode encounters a dynamic-looking prop\n const evalFn = (n: t.Node) => {\n // themes\n if (\n t.isMemberExpression(n) &&\n t.isIdentifier(n.property) &&\n traversePath &&\n isValidThemeHook(traversePath, n, sourcePath)\n ) {\n const key = n.property.name\n if (shouldPrintDebug) {\n console.log(' > found theme prop', key)\n }\n console.log('SHOULD FIND THEME (NESTED NOW)', key) // tamaguiConfig.themes)\n // if (!themeKeys.has(key)) {\n // throw new Error(` > accessing non-existent theme key: ${key}`)\n // }\n return createCSSVariable(key)\n }\n // variable\n if (t.isIdentifier(n) && staticNamespace.hasOwnProperty(n.name)) {\n return staticNamespace[n.name]\n }\n const evalContext = vm.createContext(staticNamespace)\n const codeWithTypescriptAnnotations = `(${generate(n as any).code})`\n const code = esbuild\n .transformSync(codeWithTypescriptAnnotations, { loader: 'tsx' })\n .code.replace(/;\\n$/, '')\n\n if (shouldPrintDebug) {\n console.log('evaluating', code)\n }\n return vm.runInContext(code, evalContext)\n }\n\n return (n: t.Node) => {\n return evaluateAstNode(n, evalFn)\n }\n}\n\nexport function createSafeEvaluator(attemptEval: (n: t.Node) => any) {\n return (n: t.Node) => {\n try {\n return attemptEval(n)\n } catch (err) {\n return FAILED_EVAL\n }\n }\n}\n"],
4
+ "sourcesContent": ["import vm from 'vm'\n\nimport generate from '@babel/generator'\nimport { NodePath } from '@babel/traverse'\nimport * as t from '@babel/types'\nimport type { TamaguiConfig } from '@tamagui/core-node'\nimport { createCSSVariable } from '@tamagui/core-node'\nimport esbuild from 'esbuild'\n\nimport { FAILED_EVAL } from '../constants'\nimport { evaluateAstNode } from './evaluateAstNode'\nimport { isValidThemeHook } from './extractHelpers'\n\nexport function createEvaluator({\n tamaguiConfig,\n staticNamespace,\n sourcePath,\n traversePath,\n shouldPrintDebug,\n}: {\n tamaguiConfig: TamaguiConfig\n staticNamespace: Record<string, any>\n sourcePath: string\n traversePath?: NodePath<t.JSXElement>\n shouldPrintDebug: boolean | 'verbose'\n}) {\n // called when evaluateAstNode encounters a dynamic-looking prop\n const evalFn = (n: t.Node) => {\n // themes\n if (\n t.isMemberExpression(n) &&\n t.isIdentifier(n.property) &&\n traversePath &&\n isValidThemeHook(traversePath, n, sourcePath)\n ) {\n const key = n.property.name\n if (shouldPrintDebug) {\n console.log(' > found theme prop', key)\n }\n console.log('SHOULD FIND THEME (NESTED NOW)', key) // tamaguiConfig.themes)\n // if (!themeKeys.has(key)) {\n // throw new Error(` > accessing non-existent theme key: ${key}`)\n // }\n return createCSSVariable(key)\n }\n // variable\n if (t.isIdentifier(n) && staticNamespace.hasOwnProperty(n.name)) {\n return staticNamespace[n.name]\n }\n const evalContext = vm.createContext(staticNamespace)\n const codeWithTypescriptAnnotations = `(${generate(n as any).code})`\n const code = esbuild\n .transformSync(codeWithTypescriptAnnotations, { loader: 'tsx' })\n .code.replace(/;\\n$/, '')\n\n if (shouldPrintDebug) {\n console.log('evaluating', code)\n }\n return vm.runInContext(code, evalContext)\n }\n\n return (n: t.Node) => {\n return evaluateAstNode(n, evalFn)\n }\n}\n\nexport function createSafeEvaluator(attemptEval: (n: t.Node) => any) {\n return (n: t.Node) => {\n try {\n return attemptEval(n)\n } catch (err) {\n return FAILED_EVAL\n }\n }\n}\n"],
5
5
  "mappings": "AAAA;AAEA;AAEA;AAEA;AACA;AAEA;AACA;AACA;AAEO,yBAAyB;AAAA,EAC9B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,GAOC;AAED,QAAM,SAAS,CAAC,MAAc;AAE5B,QACE,EAAE,mBAAmB,CAAC,KACtB,EAAE,aAAa,EAAE,QAAQ,KACzB,gBACA,iBAAiB,cAAc,GAAG,UAAU,GAC5C;AACA,YAAM,MAAM,EAAE,SAAS;AACvB,UAAI,kBAAkB;AACpB,gBAAQ,IAAI,0BAA0B,GAAG;AAAA,MAC3C;AACA,cAAQ,IAAI,kCAAkC,GAAG;AAIjD,aAAO,kBAAkB,GAAG;AAAA,IAC9B;AAEA,QAAI,EAAE,aAAa,CAAC,KAAK,gBAAgB,eAAe,EAAE,IAAI,GAAG;AAC/D,aAAO,gBAAgB,EAAE;AAAA,IAC3B;AACA,UAAM,cAAc,GAAG,cAAc,eAAe;AACpD,UAAM,gCAAgC,IAAI,SAAS,CAAQ,EAAE;AAC7D,UAAM,OAAO,QACV,cAAc,+BAA+B,EAAE,QAAQ,MAAM,CAAC,EAC9D,KAAK,QAAQ,QAAQ,EAAE;AAE1B,QAAI,kBAAkB;AACpB,cAAQ,IAAI,cAAc,IAAI;AAAA,IAChC;AACA,WAAO,GAAG,aAAa,MAAM,WAAW;AAAA,EAC1C;AAEA,SAAO,CAAC,MAAc;AACpB,WAAO,gBAAgB,GAAG,MAAM;AAAA,EAClC;AACF;AAEO,6BAA6B,aAAiC;AACnE,SAAO,CAAC,MAAc;AACpB,QAAI;AACF,aAAO,YAAY,CAAC;AAAA,IACtB,SAAS,KAAP;AACA,aAAO;AAAA,IACT;AAAA,EACF;AACF;",
6
6
  "names": []
7
7
  }