@tamagui/static 1.14.0 → 1.14.2

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 (195) hide show
  1. package/dist/cjs/constants.js +52 -1
  2. package/dist/cjs/constants.js.map +2 -2
  3. package/dist/cjs/extractor/accessSafe.js +52 -1
  4. package/dist/cjs/extractor/accessSafe.js.map +2 -2
  5. package/dist/cjs/extractor/babelParse.js +66 -1
  6. package/dist/cjs/extractor/babelParse.js.map +2 -2
  7. package/dist/cjs/extractor/buildClassName.js +99 -1
  8. package/dist/cjs/extractor/buildClassName.js.map +2 -2
  9. package/dist/cjs/extractor/bundle.js +126 -1
  10. package/dist/cjs/extractor/bundle.js.map +2 -2
  11. package/dist/cjs/extractor/createEvaluator.js +86 -1
  12. package/dist/cjs/extractor/createEvaluator.js.map +2 -2
  13. package/dist/cjs/extractor/createExtractor.js +1630 -15
  14. package/dist/cjs/extractor/createExtractor.js.map +2 -2
  15. package/dist/cjs/extractor/ensureImportingConcat.js +64 -1
  16. package/dist/cjs/extractor/ensureImportingConcat.js.map +2 -2
  17. package/dist/cjs/extractor/evaluateAstNode.js +130 -1
  18. package/dist/cjs/extractor/evaluateAstNode.js.map +2 -2
  19. package/dist/cjs/extractor/extractHelpers.js +207 -1
  20. package/dist/cjs/extractor/extractHelpers.js.map +2 -2
  21. package/dist/cjs/extractor/extractMediaStyle.js +193 -1
  22. package/dist/cjs/extractor/extractMediaStyle.js.map +2 -2
  23. package/dist/cjs/extractor/extractToClassNames.js +413 -13
  24. package/dist/cjs/extractor/extractToClassNames.js.map +2 -2
  25. package/dist/cjs/extractor/findTopmostFunction.js +43 -1
  26. package/dist/cjs/extractor/findTopmostFunction.js.map +2 -2
  27. package/dist/cjs/extractor/generatedUid.js +59 -1
  28. package/dist/cjs/extractor/generatedUid.js.map +2 -2
  29. package/dist/cjs/extractor/getPrefixLogs.js +31 -1
  30. package/dist/cjs/extractor/getPrefixLogs.js.map +2 -2
  31. package/dist/cjs/extractor/getPropValueFromAttributes.js +89 -1
  32. package/dist/cjs/extractor/getPropValueFromAttributes.js.map +2 -2
  33. package/dist/cjs/extractor/getSourceModule.js +103 -1
  34. package/dist/cjs/extractor/getSourceModule.js.map +2 -2
  35. package/dist/cjs/extractor/getStaticBindingsForScope.js +225 -1
  36. package/dist/cjs/extractor/getStaticBindingsForScope.js.map +2 -2
  37. package/dist/cjs/extractor/hoistClassNames.js +74 -1
  38. package/dist/cjs/extractor/hoistClassNames.js.map +2 -2
  39. package/dist/cjs/extractor/literalToAst.js +115 -1
  40. package/dist/cjs/extractor/literalToAst.js.map +2 -2
  41. package/dist/cjs/extractor/loadFile.js +20 -2
  42. package/dist/cjs/extractor/loadFile.js.map +2 -2
  43. package/dist/cjs/extractor/loadTamagui.js +432 -15
  44. package/dist/cjs/extractor/loadTamagui.js.map +2 -2
  45. package/dist/cjs/extractor/logLines.js +43 -3
  46. package/dist/cjs/extractor/logLines.js.map +2 -2
  47. package/dist/cjs/extractor/normalizeTernaries.js +85 -1
  48. package/dist/cjs/extractor/normalizeTernaries.js.map +2 -2
  49. package/dist/cjs/extractor/removeUnusedHooks.js +109 -1
  50. package/dist/cjs/extractor/removeUnusedHooks.js.map +2 -2
  51. package/dist/cjs/extractor/timer.js +52 -1
  52. package/dist/cjs/extractor/timer.js.map +2 -2
  53. package/dist/cjs/extractor/validHTMLAttributes.js +126 -1
  54. package/dist/cjs/extractor/validHTMLAttributes.js.map +2 -2
  55. package/dist/cjs/getPragmaOptions.js +67 -2
  56. package/dist/cjs/getPragmaOptions.js.map +2 -2
  57. package/dist/cjs/helpers/memoize.js +45 -1
  58. package/dist/cjs/helpers/memoize.js.map +2 -2
  59. package/dist/cjs/index.js +42 -1
  60. package/dist/cjs/index.js.map +2 -2
  61. package/dist/cjs/require.js +81 -5
  62. package/dist/cjs/require.js.map +2 -2
  63. package/dist/cjs/types.js +16 -1
  64. package/dist/cjs/types.js.map +2 -2
  65. package/dist/cjs/webpackPlugin.js +34 -1
  66. package/dist/cjs/webpackPlugin.js.map +2 -2
  67. package/dist/esm/constants.js +14 -1
  68. package/dist/esm/constants.js.map +2 -2
  69. package/dist/esm/constants.mjs +14 -1
  70. package/dist/esm/constants.mjs.map +2 -2
  71. package/dist/esm/extractor/accessSafe.js +18 -1
  72. package/dist/esm/extractor/accessSafe.js.map +2 -2
  73. package/dist/esm/extractor/accessSafe.mjs +18 -1
  74. package/dist/esm/extractor/accessSafe.mjs.map +2 -2
  75. package/dist/esm/extractor/babelParse.js +31 -1
  76. package/dist/esm/extractor/babelParse.js.map +2 -2
  77. package/dist/esm/extractor/babelParse.mjs +31 -1
  78. package/dist/esm/extractor/babelParse.mjs.map +2 -2
  79. package/dist/esm/extractor/buildClassName.js +64 -1
  80. package/dist/esm/extractor/buildClassName.js.map +2 -2
  81. package/dist/esm/extractor/buildClassName.mjs +64 -1
  82. package/dist/esm/extractor/buildClassName.mjs.map +2 -2
  83. package/dist/esm/extractor/bundle.js +91 -1
  84. package/dist/esm/extractor/bundle.js.map +2 -2
  85. package/dist/esm/extractor/bundle.mjs +91 -1
  86. package/dist/esm/extractor/bundle.mjs.map +2 -2
  87. package/dist/esm/extractor/createEvaluator.js +51 -1
  88. package/dist/esm/extractor/createEvaluator.js.map +2 -2
  89. package/dist/esm/extractor/createEvaluator.mjs +51 -1
  90. package/dist/esm/extractor/createEvaluator.mjs.map +2 -2
  91. package/dist/esm/extractor/createExtractor.js +1613 -15
  92. package/dist/esm/extractor/createExtractor.js.map +2 -2
  93. package/dist/esm/extractor/createExtractor.mjs +1613 -15
  94. package/dist/esm/extractor/createExtractor.mjs.map +2 -2
  95. package/dist/esm/extractor/ensureImportingConcat.js +30 -1
  96. package/dist/esm/extractor/ensureImportingConcat.js.map +2 -2
  97. package/dist/esm/extractor/ensureImportingConcat.mjs +30 -1
  98. package/dist/esm/extractor/ensureImportingConcat.mjs.map +2 -2
  99. package/dist/esm/extractor/evaluateAstNode.js +96 -1
  100. package/dist/esm/extractor/evaluateAstNode.js.map +2 -2
  101. package/dist/esm/extractor/evaluateAstNode.mjs +96 -1
  102. package/dist/esm/extractor/evaluateAstNode.mjs.map +2 -2
  103. package/dist/esm/extractor/extractHelpers.js +161 -1
  104. package/dist/esm/extractor/extractHelpers.js.map +2 -2
  105. package/dist/esm/extractor/extractHelpers.mjs +161 -1
  106. package/dist/esm/extractor/extractHelpers.mjs.map +2 -2
  107. package/dist/esm/extractor/extractMediaStyle.js +158 -1
  108. package/dist/esm/extractor/extractMediaStyle.js.map +2 -2
  109. package/dist/esm/extractor/extractMediaStyle.mjs +158 -1
  110. package/dist/esm/extractor/extractMediaStyle.mjs.map +2 -2
  111. package/dist/esm/extractor/extractToClassNames.js +379 -13
  112. package/dist/esm/extractor/extractToClassNames.js.map +2 -2
  113. package/dist/esm/extractor/extractToClassNames.mjs +379 -13
  114. package/dist/esm/extractor/extractToClassNames.mjs.map +2 -2
  115. package/dist/esm/extractor/findTopmostFunction.js +19 -1
  116. package/dist/esm/extractor/findTopmostFunction.js.map +2 -2
  117. package/dist/esm/extractor/findTopmostFunction.mjs +19 -1
  118. package/dist/esm/extractor/findTopmostFunction.mjs.map +2 -2
  119. package/dist/esm/extractor/generatedUid.js +25 -1
  120. package/dist/esm/extractor/generatedUid.js.map +2 -2
  121. package/dist/esm/extractor/generatedUid.mjs +25 -1
  122. package/dist/esm/extractor/generatedUid.mjs.map +2 -2
  123. package/dist/esm/extractor/getPrefixLogs.js +7 -1
  124. package/dist/esm/extractor/getPrefixLogs.js.map +2 -2
  125. package/dist/esm/extractor/getPrefixLogs.mjs +7 -1
  126. package/dist/esm/extractor/getPrefixLogs.mjs.map +2 -2
  127. package/dist/esm/extractor/getPropValueFromAttributes.js +55 -1
  128. package/dist/esm/extractor/getPropValueFromAttributes.js.map +2 -2
  129. package/dist/esm/extractor/getPropValueFromAttributes.mjs +55 -1
  130. package/dist/esm/extractor/getPropValueFromAttributes.mjs.map +2 -2
  131. package/dist/esm/extractor/getSourceModule.js +69 -1
  132. package/dist/esm/extractor/getSourceModule.js.map +2 -2
  133. package/dist/esm/extractor/getSourceModule.mjs +69 -1
  134. package/dist/esm/extractor/getSourceModule.mjs.map +2 -2
  135. package/dist/esm/extractor/getStaticBindingsForScope.js +190 -1
  136. package/dist/esm/extractor/getStaticBindingsForScope.js.map +2 -2
  137. package/dist/esm/extractor/getStaticBindingsForScope.mjs +190 -1
  138. package/dist/esm/extractor/getStaticBindingsForScope.mjs.map +2 -2
  139. package/dist/esm/extractor/hoistClassNames.js +40 -1
  140. package/dist/esm/extractor/hoistClassNames.js.map +2 -2
  141. package/dist/esm/extractor/hoistClassNames.mjs +40 -1
  142. package/dist/esm/extractor/hoistClassNames.mjs.map +2 -2
  143. package/dist/esm/extractor/literalToAst.js +80 -1
  144. package/dist/esm/extractor/literalToAst.js.map +2 -2
  145. package/dist/esm/extractor/literalToAst.mjs +80 -1
  146. package/dist/esm/extractor/literalToAst.mjs.map +2 -2
  147. package/dist/esm/extractor/loadFile.js +19 -2
  148. package/dist/esm/extractor/loadFile.js.map +2 -2
  149. package/dist/esm/extractor/loadFile.mjs +19 -2
  150. package/dist/esm/extractor/loadFile.mjs.map +2 -2
  151. package/dist/esm/extractor/loadTamagui.js +396 -15
  152. package/dist/esm/extractor/loadTamagui.js.map +2 -2
  153. package/dist/esm/extractor/loadTamagui.mjs +396 -15
  154. package/dist/esm/extractor/loadTamagui.mjs.map +2 -2
  155. package/dist/esm/extractor/logLines.js +19 -3
  156. package/dist/esm/extractor/logLines.js.map +2 -2
  157. package/dist/esm/extractor/logLines.mjs +19 -3
  158. package/dist/esm/extractor/logLines.mjs.map +2 -2
  159. package/dist/esm/extractor/normalizeTernaries.js +51 -1
  160. package/dist/esm/extractor/normalizeTernaries.js.map +2 -2
  161. package/dist/esm/extractor/normalizeTernaries.mjs +51 -1
  162. package/dist/esm/extractor/normalizeTernaries.mjs.map +2 -2
  163. package/dist/esm/extractor/removeUnusedHooks.js +75 -1
  164. package/dist/esm/extractor/removeUnusedHooks.js.map +2 -2
  165. package/dist/esm/extractor/removeUnusedHooks.mjs +75 -1
  166. package/dist/esm/extractor/removeUnusedHooks.mjs.map +2 -2
  167. package/dist/esm/extractor/timer.js +28 -1
  168. package/dist/esm/extractor/timer.js.map +2 -2
  169. package/dist/esm/extractor/timer.mjs +28 -1
  170. package/dist/esm/extractor/timer.mjs.map +2 -2
  171. package/dist/esm/extractor/validHTMLAttributes.js +101 -1
  172. package/dist/esm/extractor/validHTMLAttributes.js.map +2 -2
  173. package/dist/esm/extractor/validHTMLAttributes.mjs +101 -1
  174. package/dist/esm/extractor/validHTMLAttributes.mjs.map +2 -2
  175. package/dist/esm/getPragmaOptions.js +43 -2
  176. package/dist/esm/getPragmaOptions.js.map +2 -2
  177. package/dist/esm/getPragmaOptions.mjs +43 -2
  178. package/dist/esm/getPragmaOptions.mjs.map +2 -2
  179. package/dist/esm/helpers/memoize.js +21 -1
  180. package/dist/esm/helpers/memoize.js.map +2 -2
  181. package/dist/esm/helpers/memoize.mjs +21 -1
  182. package/dist/esm/helpers/memoize.mjs.map +2 -2
  183. package/dist/esm/index.js +15 -1
  184. package/dist/esm/index.js.map +2 -2
  185. package/dist/esm/index.mjs +15 -1
  186. package/dist/esm/index.mjs.map +2 -2
  187. package/dist/esm/require.js +55 -5
  188. package/dist/esm/require.js.map +2 -2
  189. package/dist/esm/require.mjs +55 -5
  190. package/dist/esm/require.mjs.map +2 -2
  191. package/dist/esm/webpackPlugin.js +10 -1
  192. package/dist/esm/webpackPlugin.js.map +2 -2
  193. package/dist/esm/webpackPlugin.mjs +10 -1
  194. package/dist/esm/webpackPlugin.mjs.map +2 -2
  195. package/package.json +14 -14
@@ -1,2 +1,60 @@
1
- "use strict";var s=Object.create;var n=Object.defineProperty;var f=Object.getOwnPropertyDescriptor;var d=Object.getOwnPropertyNames;var g=Object.getPrototypeOf,l=Object.prototype.hasOwnProperty;var p=(e,t)=>{for(var r in t)n(e,r,{get:t[r],enumerable:!0})},o=(e,t,r,a)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of d(t))!l.call(e,i)&&i!==r&&n(e,i,{get:()=>t[i],enumerable:!(a=f(t,i))||a.enumerable});return e};var c=(e,t,r)=>(r=e!=null?s(g(e)):{},o(t||!e||!e.__esModule?n(r,"default",{value:e,enumerable:!0}):r,e)),u=e=>o(n({},"__esModule",{value:!0}),e);var m={};p(m,{generateUid:()=>b});module.exports=u(m);var h=c(require("@babel/types"));function b(e,t){if(typeof e!="object")throw"generateUid expects a scope object as its first parameter";if(!(typeof t=="string"&&t!==""))throw"generateUid expects a valid name as its second parameter";t=h.toIdentifier(t).replace(/^_+/,"").replace(/[0-9]+$/g,"");let r,a=0;do a>1?r=t+a:r=t,a++;while(e.hasLabel(r)||e.hasBinding(r)||e.hasGlobal(r)||e.hasReference(r));const i=e.getProgramParent();return i.references[r]=!0,i.uids[r]=!0,r}0&&(module.exports={generateUid});
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+ var generatedUid_exports = {};
30
+ __export(generatedUid_exports, {
31
+ generateUid: () => generateUid
32
+ });
33
+ module.exports = __toCommonJS(generatedUid_exports);
34
+ var t = __toESM(require("@babel/types"));
35
+ function generateUid(scope, name) {
36
+ if (!(typeof scope === "object"))
37
+ throw "generateUid expects a scope object as its first parameter";
38
+ if (!(typeof name === "string" && name !== ""))
39
+ throw "generateUid expects a valid name as its second parameter";
40
+ name = t.toIdentifier(name).replace(/^_+/, "").replace(/[0-9]+$/g, "");
41
+ let uid;
42
+ let i = 0;
43
+ do {
44
+ if (i > 1) {
45
+ uid = name + i;
46
+ } else {
47
+ uid = name;
48
+ }
49
+ i++;
50
+ } while (scope.hasLabel(uid) || scope.hasBinding(uid) || scope.hasGlobal(uid) || scope.hasReference(uid));
51
+ const program = scope.getProgramParent();
52
+ program.references[uid] = true;
53
+ program.uids[uid] = true;
54
+ return uid;
55
+ }
56
+ // Annotate the CommonJS export names for ESM import in node:
57
+ 0 && (module.exports = {
58
+ generateUid
59
+ });
2
60
  //# sourceMappingURL=generatedUid.js.map
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../../src/extractor/generatedUid.ts"],
4
4
  "sourcesContent": ["import * as t from '@babel/types'\nimport invariant from 'invariant'\n\n// TODO: open a PR upstream\ndeclare module '@babel/types' {\n export function toIdentifier(input: string): string\n}\n\n// A clone of path.scope.generateUid that doesn't prepend underscores\nexport function generateUid(scope: any, name: string): string {\n if (!(typeof scope === 'object'))\n throw 'generateUid expects a scope object as its first parameter'\n if (!(typeof name === 'string' && name !== ''))\n throw 'generateUid expects a valid name as its second parameter'\n\n name = t\n .toIdentifier(name)\n .replace(/^_+/, '')\n .replace(/[0-9]+$/g, '')\n\n let uid\n let i = 0\n do {\n if (i > 1) {\n uid = name + i\n } else {\n uid = name\n }\n i++\n } while (\n scope.hasLabel(uid) ||\n scope.hasBinding(uid) ||\n scope.hasGlobal(uid) ||\n scope.hasReference(uid)\n )\n\n const program = scope.getProgramParent()\n program.references[uid] = true\n program.uids[uid] = true\n\n return uid\n}\n"],
5
- "mappings": "0jBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,iBAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAAmB,2BASZ,SAASF,EAAYG,EAAYC,EAAsB,CAC5D,GAAM,OAAOD,GAAU,SACrB,KAAM,4DACR,GAAI,EAAE,OAAOC,GAAS,UAAYA,IAAS,IACzC,KAAM,2DAERA,EAAOF,EACJ,aAAaE,CAAI,EACjB,QAAQ,MAAO,EAAE,EACjB,QAAQ,WAAY,EAAE,EAEzB,IAAIC,EACAC,EAAI,EACR,GACMA,EAAI,EACND,EAAMD,EAAOE,EAEbD,EAAMD,EAERE,UAEAH,EAAM,SAASE,CAAG,GAClBF,EAAM,WAAWE,CAAG,GACpBF,EAAM,UAAUE,CAAG,GACnBF,EAAM,aAAaE,CAAG,GAGxB,MAAME,EAAUJ,EAAM,iBAAiB,EACvC,OAAAI,EAAQ,WAAWF,CAAG,EAAI,GAC1BE,EAAQ,KAAKF,CAAG,EAAI,GAEbA,CACT",
6
- "names": ["generatedUid_exports", "__export", "generateUid", "__toCommonJS", "t", "scope", "name", "uid", "i", "program"]
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,QAAmB;AASZ,SAAS,YAAY,OAAY,MAAsB;AAC5D,MAAI,EAAE,OAAO,UAAU;AACrB,UAAM;AACR,MAAI,EAAE,OAAO,SAAS,YAAY,SAAS;AACzC,UAAM;AAER,SAAO,EACJ,aAAa,IAAI,EACjB,QAAQ,OAAO,EAAE,EACjB,QAAQ,YAAY,EAAE;AAEzB,MAAI;AACJ,MAAI,IAAI;AACR,KAAG;AACD,QAAI,IAAI,GAAG;AACT,YAAM,OAAO;AAAA,IACf,OAAO;AACL,YAAM;AAAA,IACR;AACA;AAAA,EACF,SACE,MAAM,SAAS,GAAG,KAClB,MAAM,WAAW,GAAG,KACpB,MAAM,UAAU,GAAG,KACnB,MAAM,aAAa,GAAG;AAGxB,QAAM,UAAU,MAAM,iBAAiB;AACvC,UAAQ,WAAW,GAAG,IAAI;AAC1B,UAAQ,KAAK,GAAG,IAAI;AAEpB,SAAO;AACT;",
6
+ "names": []
7
7
  }
@@ -1,2 +1,32 @@
1
- "use strict";var a=Object.defineProperty;var i=Object.getOwnPropertyDescriptor;var m=Object.getOwnPropertyNames;var t=Object.prototype.hasOwnProperty;var u=(r,e)=>{for(var T in e)a(r,T,{get:e[T],enumerable:!0})},c=(r,e,T,f)=>{if(e&&typeof e=="object"||typeof e=="function")for(let g of m(e))!t.call(r,g)&&g!==T&&a(r,g,{get:()=>e[g],enumerable:!(f=i(e,g))||f.enumerable});return r};var n=r=>c(a({},"__esModule",{value:!0}),r);var x={};u(x,{getPrefixLogs:()=>s});module.exports=n(x);function s(r){const{TAMAGUI_TARGET:e}=process.env;return(r==null?void 0:r.prefixLogs)??` ${e} | `}0&&(module.exports={getPrefixLogs});
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var getPrefixLogs_exports = {};
20
+ __export(getPrefixLogs_exports, {
21
+ getPrefixLogs: () => getPrefixLogs
22
+ });
23
+ module.exports = __toCommonJS(getPrefixLogs_exports);
24
+ function getPrefixLogs(options) {
25
+ const { TAMAGUI_TARGET } = process.env;
26
+ return (options == null ? void 0 : options.prefixLogs) ?? ` ${TAMAGUI_TARGET} | `;
27
+ }
28
+ // Annotate the CommonJS export names for ESM import in node:
29
+ 0 && (module.exports = {
30
+ getPrefixLogs
31
+ });
2
32
  //# sourceMappingURL=getPrefixLogs.js.map
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../../src/extractor/getPrefixLogs.ts"],
4
4
  "sourcesContent": ["import { TamaguiOptions } from '../types.js'\n\nexport function getPrefixLogs(options?: TamaguiOptions) {\n const { TAMAGUI_TARGET } = process.env\n return options?.prefixLogs ?? ` ${TAMAGUI_TARGET} | `\n}\n"],
5
- "mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,mBAAAE,IAAA,eAAAC,EAAAH,GAEO,SAASE,EAAcE,EAA0B,CACtD,KAAM,CAAE,eAAAC,CAAe,EAAI,QAAQ,IACnC,OAAOD,GAAA,YAAAA,EAAS,aAAc,IAAIC,OACpC",
6
- "names": ["getPrefixLogs_exports", "__export", "getPrefixLogs", "__toCommonJS", "options", "TAMAGUI_TARGET"]
5
+ "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEO,SAAS,cAAc,SAA0B;AACtD,QAAM,EAAE,eAAe,IAAI,QAAQ;AACnC,UAAO,mCAAS,eAAc,IAAI;AACpC;",
6
+ "names": []
7
7
  }
@@ -1,2 +1,90 @@
1
- "use strict";var E=Object.create;var u=Object.defineProperty;var g=Object.getOwnPropertyDescriptor;var J=Object.getOwnPropertyNames;var X=Object.getPrototypeOf,c=Object.prototype.hasOwnProperty;var d=(e,r)=>{for(var i in r)u(e,i,{get:r[i],enumerable:!0})},m=(e,r,i,o)=>{if(r&&typeof r=="object"||typeof r=="function")for(let n of J(r))!c.call(e,n)&&n!==i&&u(e,n,{get:()=>r[n],enumerable:!(o=g(r,n))||o.enumerable});return e};var f=(e,r,i)=>(i=e!=null?E(X(e)):{},m(r||!e||!e.__esModule?u(i,"default",{value:e,enumerable:!0}):i,e)),b=e=>m(u({},"__esModule",{value:!0}),e);var y={};d(y,{getPropValueFromAttributes:()=>A});module.exports=b(y);var S=f(require("@babel/generator")),s=f(require("@babel/types")),x=require("./accessSafe.js");function A(e,r){let i=-1,o=null;for(let t=-1,l=r.length;++t<l;){const p=r[t];if(s.isJSXAttribute(p)&&p.name&&p.name.name===e){i=t,o=p;break}}if(!o||o.value==null)return null;let n=o.value;if(s.isJSXExpressionContainer(n)&&(n=n.expression),s.isJSXEmptyExpression(n))return console.error("encountered JSXEmptyExpression"),null;const a=r.filter((t,l)=>{if(s.isJSXSpreadAttribute(t)){if(s.isIdentifier(t.argument)||s.isMemberExpression(t.argument))return l>i;if(s.isLogicalExpression(t.argument))return!1;throw new Error(`unsupported spread of type "${t.argument.type}": ${(0,S.default)(t).code}`)}return!1}).map(t=>t.argument);return a.length>0&&(n=a.reduce((t,l)=>s.logicalExpression("||",(0,x.accessSafe)(l,e),t),n)),n}0&&(module.exports={getPropValueFromAttributes});
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+ var getPropValueFromAttributes_exports = {};
30
+ __export(getPropValueFromAttributes_exports, {
31
+ getPropValueFromAttributes: () => getPropValueFromAttributes
32
+ });
33
+ module.exports = __toCommonJS(getPropValueFromAttributes_exports);
34
+ var import_generator = __toESM(require("@babel/generator"));
35
+ var t = __toESM(require("@babel/types"));
36
+ var import_accessSafe = require("./accessSafe.js");
37
+ function getPropValueFromAttributes(propName, attrs) {
38
+ let propIndex = -1;
39
+ let jsxAttr = null;
40
+ for (let idx = -1, len = attrs.length; ++idx < len; ) {
41
+ const attr = attrs[idx];
42
+ if (t.isJSXAttribute(attr) && attr.name && attr.name.name === propName) {
43
+ propIndex = idx;
44
+ jsxAttr = attr;
45
+ break;
46
+ }
47
+ }
48
+ if (!jsxAttr || jsxAttr.value == null) {
49
+ return null;
50
+ }
51
+ let propValue = jsxAttr.value;
52
+ if (t.isJSXExpressionContainer(propValue)) {
53
+ propValue = propValue.expression;
54
+ }
55
+ if (t.isJSXEmptyExpression(propValue)) {
56
+ console.error("encountered JSXEmptyExpression");
57
+ return null;
58
+ }
59
+ const applicableSpreads = attrs.filter(
60
+ // 1. idx is greater than propValue prop index
61
+ // 2. attr is a spread operator
62
+ (attr, idx) => {
63
+ if (t.isJSXSpreadAttribute(attr)) {
64
+ if (t.isIdentifier(attr.argument) || t.isMemberExpression(attr.argument)) {
65
+ return idx > propIndex;
66
+ }
67
+ if (t.isLogicalExpression(attr.argument)) {
68
+ return false;
69
+ }
70
+ throw new Error(
71
+ `unsupported spread of type "${attr.argument.type}": ${// @ts-ignore
72
+ (0, import_generator.default)(attr).code}`
73
+ );
74
+ }
75
+ return false;
76
+ }
77
+ ).map((attr) => attr.argument);
78
+ if (applicableSpreads.length > 0) {
79
+ propValue = applicableSpreads.reduce(
80
+ (acc, val) => t.logicalExpression("||", (0, import_accessSafe.accessSafe)(val, propName), acc),
81
+ propValue
82
+ );
83
+ }
84
+ return propValue;
85
+ }
86
+ // Annotate the CommonJS export names for ESM import in node:
87
+ 0 && (module.exports = {
88
+ getPropValueFromAttributes
89
+ });
2
90
  //# sourceMappingURL=getPropValueFromAttributes.js.map
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../../src/extractor/getPropValueFromAttributes.ts"],
4
4
  "sourcesContent": ["import generate from '@babel/generator'\nimport * as t from '@babel/types'\n\nimport { accessSafe } from './accessSafe.js'\n\n/**\n * getPropValueFromAttributes gets a prop by name from a list of attributes and accounts for potential spread operators.\n * Here's an example. Given this component:\n * ```\n * <Block coolProp=\"wow\" {...spread1} neatProp=\"ok\" {...spread2} />```\n * getPropValueFromAttributes will return the following:\n * - for propName `coolProp`:\n * ```\n * accessSafe(spread1, 'coolProp') || accessSafe(spread2, 'coolProp') || 'wow'```\n * - for propName `neatProp`:\n * ```\n * accessSafe(spread2, 'neatProp') || 'ok'```\n * - for propName `notPresent`: `null`\n *\n * The returned value should (obviously) be placed after spread operators.\n */\nexport function getPropValueFromAttributes(\n propName: string,\n attrs: (t.JSXAttribute | t.JSXSpreadAttribute)[]\n): t.Expression | null {\n let propIndex = -1\n let jsxAttr: t.JSXAttribute | null = null\n for (let idx = -1, len = attrs.length; ++idx < len; ) {\n const attr = attrs[idx]\n if (t.isJSXAttribute(attr) && attr.name && attr.name.name === propName) {\n propIndex = idx\n jsxAttr = attr\n break\n }\n }\n\n if (!jsxAttr || jsxAttr.value == null) {\n return null\n }\n\n let propValue:\n | t.JSXElement\n | t.JSXFragment\n | t.StringLiteral\n | t.JSXExpressionContainer\n | t.JSXEmptyExpression\n | t.Expression = jsxAttr.value\n\n if (t.isJSXExpressionContainer(propValue)) {\n propValue = propValue.expression\n }\n\n // TODO how to handle this??\n if (t.isJSXEmptyExpression(propValue)) {\n // eslint-disable-next-line no-console\n console.error('encountered JSXEmptyExpression')\n return null\n }\n\n // filter out spread props that occur before propValue\n const applicableSpreads = attrs\n .filter(\n // 1. idx is greater than propValue prop index\n // 2. attr is a spread operator\n (attr, idx): attr is t.JSXSpreadAttribute => {\n if (t.isJSXSpreadAttribute(attr)) {\n if (t.isIdentifier(attr.argument) || t.isMemberExpression(attr.argument)) {\n return idx > propIndex\n }\n if (t.isLogicalExpression(attr.argument)) {\n return false\n }\n throw new Error(\n `unsupported spread of type \"${attr.argument.type}\": ${\n // @ts-ignore\n generate(attr as any).code\n }`\n )\n }\n return false\n }\n )\n .map((attr) => attr.argument)\n\n // if spread operators occur after propValue, create a binary expression for each operator\n // i.e. before1.propValue || before2.propValue || propValue\n // TODO: figure out how to do this without all the extra parens\n if (applicableSpreads.length > 0) {\n propValue = applicableSpreads.reduce<t.Expression>(\n (acc, val) => t.logicalExpression('||', accessSafe(val, propName), acc),\n propValue\n )\n }\n\n return propValue\n}\n"],
5
- "mappings": "0jBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,gCAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAAqB,+BACrBC,EAAmB,2BAEnBC,EAA2B,2BAkBpB,SAASJ,EACdK,EACAC,EACqB,CACrB,IAAIC,EAAY,GACZC,EAAiC,KACrC,QAASC,EAAM,GAAIC,EAAMJ,EAAM,OAAQ,EAAEG,EAAMC,GAAO,CACpD,MAAMC,EAAOL,EAAMG,CAAG,EACtB,GAAIN,EAAE,eAAeQ,CAAI,GAAKA,EAAK,MAAQA,EAAK,KAAK,OAASN,EAAU,CACtEE,EAAYE,EACZD,EAAUG,EACV,KACF,CACF,CAEA,GAAI,CAACH,GAAWA,EAAQ,OAAS,KAC/B,OAAO,KAGT,IAAII,EAMeJ,EAAQ,MAO3B,GALIL,EAAE,yBAAyBS,CAAS,IACtCA,EAAYA,EAAU,YAIpBT,EAAE,qBAAqBS,CAAS,EAElC,eAAQ,MAAM,gCAAgC,EACvC,KAIT,MAAMC,EAAoBP,EACvB,OAGC,CAACK,EAAMF,IAAsC,CAC3C,GAAIN,EAAE,qBAAqBQ,CAAI,EAAG,CAChC,GAAIR,EAAE,aAAaQ,EAAK,QAAQ,GAAKR,EAAE,mBAAmBQ,EAAK,QAAQ,EACrE,OAAOF,EAAMF,EAEf,GAAIJ,EAAE,oBAAoBQ,EAAK,QAAQ,EACrC,MAAO,GAET,MAAM,IAAI,MACR,+BAA+BA,EAAK,SAAS,aAE3C,EAAAG,SAASH,CAAW,EAAE,MAE1B,CACF,CACA,MAAO,EACT,CACF,EACC,IAAKA,GAASA,EAAK,QAAQ,EAK9B,OAAIE,EAAkB,OAAS,IAC7BD,EAAYC,EAAkB,OAC5B,CAACE,EAAKC,IAAQb,EAAE,kBAAkB,QAAM,cAAWa,EAAKX,CAAQ,EAAGU,CAAG,EACtEH,CACF,GAGKA,CACT",
6
- "names": ["getPropValueFromAttributes_exports", "__export", "getPropValueFromAttributes", "__toCommonJS", "import_generator", "t", "import_accessSafe", "propName", "attrs", "propIndex", "jsxAttr", "idx", "len", "attr", "propValue", "applicableSpreads", "generate", "acc", "val"]
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAAqB;AACrB,QAAmB;AAEnB,wBAA2B;AAkBpB,SAAS,2BACd,UACA,OACqB;AACrB,MAAI,YAAY;AAChB,MAAI,UAAiC;AACrC,WAAS,MAAM,IAAI,MAAM,MAAM,QAAQ,EAAE,MAAM,OAAO;AACpD,UAAM,OAAO,MAAM,GAAG;AACtB,QAAI,EAAE,eAAe,IAAI,KAAK,KAAK,QAAQ,KAAK,KAAK,SAAS,UAAU;AACtE,kBAAY;AACZ,gBAAU;AACV;AAAA,IACF;AAAA,EACF;AAEA,MAAI,CAAC,WAAW,QAAQ,SAAS,MAAM;AACrC,WAAO;AAAA,EACT;AAEA,MAAI,YAMe,QAAQ;AAE3B,MAAI,EAAE,yBAAyB,SAAS,GAAG;AACzC,gBAAY,UAAU;AAAA,EACxB;AAGA,MAAI,EAAE,qBAAqB,SAAS,GAAG;AAErC,YAAQ,MAAM,gCAAgC;AAC9C,WAAO;AAAA,EACT;AAGA,QAAM,oBAAoB,MACvB;AAAA;AAAA;AAAA,IAGC,CAAC,MAAM,QAAsC;AAC3C,UAAI,EAAE,qBAAqB,IAAI,GAAG;AAChC,YAAI,EAAE,aAAa,KAAK,QAAQ,KAAK,EAAE,mBAAmB,KAAK,QAAQ,GAAG;AACxE,iBAAO,MAAM;AAAA,QACf;AACA,YAAI,EAAE,oBAAoB,KAAK,QAAQ,GAAG;AACxC,iBAAO;AAAA,QACT;AACA,cAAM,IAAI;AAAA,UACR,+BAA+B,KAAK,SAAS;AAAA,cAE3C,iBAAAA,SAAS,IAAW,EAAE;AAAA,QAE1B;AAAA,MACF;AACA,aAAO;AAAA,IACT;AAAA,EACF,EACC,IAAI,CAAC,SAAS,KAAK,QAAQ;AAK9B,MAAI,kBAAkB,SAAS,GAAG;AAChC,gBAAY,kBAAkB;AAAA,MAC5B,CAAC,KAAK,QAAQ,EAAE,kBAAkB,UAAM,8BAAW,KAAK,QAAQ,GAAG,GAAG;AAAA,MACtE;AAAA,IACF;AAAA,EACF;AAEA,SAAO;AACT;",
6
+ "names": ["generate"]
7
7
  }
@@ -1,2 +1,104 @@
1
- "use strict";var p=Object.create;var u=Object.defineProperty;var m=Object.getOwnPropertyDescriptor;var g=Object.getOwnPropertyNames;var b=Object.getPrototypeOf,I=Object.prototype.hasOwnProperty;var S=(r,t)=>{for(var n in t)u(r,n,{get:t[n],enumerable:!0})},f=(r,t,n,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let l of g(t))!I.call(r,l)&&l!==n&&u(r,l,{get:()=>t[l],enumerable:!(o=m(t,l))||o.enumerable});return r};var h=(r,t,n)=>(n=r!=null?p(b(r)):{},f(t||!r||!r.__esModule?u(n,"default",{value:r,enumerable:!0}):n,r)),y=r=>f(u({},"__esModule",{value:!0}),r);var x={};S(x,{getSourceModule:()=>v});module.exports=y(x);var i=h(require("@babel/types"));function v(r,t){if(!t.constant)return null;let n,o,l,a,d=!1;const e=t.path.node;if(i.isImportDefaultSpecifier(e)||i.isImportSpecifier(e))i.isImportDeclaration(t.path.parent)&&(n=t.path.parent.source.value,l=e.local.name,d=!0,i.isImportSpecifier(e)?(o=e.imported.name,a=!0):(o=e.local.name,a=!1));else if(i.isVariableDeclarator(e)&&e.init!=null&&i.isCallExpression(e.init)&&i.isIdentifier(e.init.callee)&&e.init.callee.name==="require"&&e.init.arguments.length===1){const c=e.init.arguments[0];if(!i.isStringLiteral(c))return null;if(n=c.value,i.isIdentifier(e.id))l=e.id.name,o=e.id.name,a=!1;else if(i.isObjectPattern(e.id)){for(const s of e.id.properties)if(i.isObjectProperty(s)&&i.isIdentifier(s.value)&&s.value.name===r){l=s.value.name,o=s.key.name,a=!0;break}if(!l||!o)return console.error("could not find prop with value `%s`",r),null}else return console.error("Unhandled id type: %s",e.id.type),null}else return null;return{destructured:a,imported:o,local:l,sourceModule:n,usesImportSyntax:d}}0&&(module.exports={getSourceModule});
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+ var getSourceModule_exports = {};
30
+ __export(getSourceModule_exports, {
31
+ getSourceModule: () => getSourceModule
32
+ });
33
+ module.exports = __toCommonJS(getSourceModule_exports);
34
+ var t = __toESM(require("@babel/types"));
35
+ function getSourceModule(itemName, itemBinding) {
36
+ if (!itemBinding.constant) {
37
+ return null;
38
+ }
39
+ let sourceModule;
40
+ let imported;
41
+ let local;
42
+ let destructured;
43
+ let usesImportSyntax = false;
44
+ const itemNode = itemBinding.path.node;
45
+ if (
46
+ // import x from 'y';
47
+ t.isImportDefaultSpecifier(itemNode) || // import {x} from 'y';
48
+ t.isImportSpecifier(itemNode)
49
+ ) {
50
+ if (t.isImportDeclaration(itemBinding.path.parent)) {
51
+ sourceModule = itemBinding.path.parent.source.value;
52
+ local = itemNode.local.name;
53
+ usesImportSyntax = true;
54
+ if (t.isImportSpecifier(itemNode)) {
55
+ imported = itemNode.imported["name"];
56
+ destructured = true;
57
+ } else {
58
+ imported = itemNode.local.name;
59
+ destructured = false;
60
+ }
61
+ }
62
+ } else if (t.isVariableDeclarator(itemNode) && itemNode.init != null && t.isCallExpression(itemNode.init) && t.isIdentifier(itemNode.init.callee) && itemNode.init.callee.name === "require" && itemNode.init.arguments.length === 1) {
63
+ const firstArg = itemNode.init.arguments[0];
64
+ if (!t.isStringLiteral(firstArg)) {
65
+ return null;
66
+ }
67
+ sourceModule = firstArg.value;
68
+ if (t.isIdentifier(itemNode.id)) {
69
+ local = itemNode.id.name;
70
+ imported = itemNode.id.name;
71
+ destructured = false;
72
+ } else if (t.isObjectPattern(itemNode.id)) {
73
+ for (const objProp of itemNode.id.properties) {
74
+ if (t.isObjectProperty(objProp) && t.isIdentifier(objProp.value) && objProp.value.name === itemName) {
75
+ local = objProp.value.name;
76
+ imported = objProp.key.name;
77
+ destructured = true;
78
+ break;
79
+ }
80
+ }
81
+ if (!local || !imported) {
82
+ console.error("could not find prop with value `%s`", itemName);
83
+ return null;
84
+ }
85
+ } else {
86
+ console.error("Unhandled id type: %s", itemNode.id.type);
87
+ return null;
88
+ }
89
+ } else {
90
+ return null;
91
+ }
92
+ return {
93
+ destructured,
94
+ imported,
95
+ local,
96
+ sourceModule,
97
+ usesImportSyntax
98
+ };
99
+ }
100
+ // Annotate the CommonJS export names for ESM import in node:
101
+ 0 && (module.exports = {
102
+ getSourceModule
103
+ });
2
104
  //# sourceMappingURL=getSourceModule.js.map
@@ -2,6 +2,6 @@
2
2
  "version": 3,
3
3
  "sources": ["../../../src/extractor/getSourceModule.ts"],
4
4
  "sourcesContent": ["import * as t from '@babel/types'\n\nexport interface SourceModule {\n sourceModule?: string\n imported?: string\n local?: string\n destructured?: boolean\n usesImportSyntax: boolean\n}\n\nexport function getSourceModule(\n itemName: string,\n itemBinding: {\n constant?: boolean\n path: { node: t.Node; parent: any }\n }\n): SourceModule | null {\n // TODO: deal with reassignment\n if (!itemBinding.constant) {\n return null\n }\n\n let sourceModule: string | undefined\n let imported: string | undefined\n let local: string | undefined\n let destructured: boolean | undefined\n let usesImportSyntax = false\n\n const itemNode = itemBinding.path.node\n\n if (\n // import x from 'y';\n t.isImportDefaultSpecifier(itemNode) ||\n // import {x} from 'y';\n t.isImportSpecifier(itemNode)\n ) {\n if (t.isImportDeclaration(itemBinding.path.parent)) {\n sourceModule = itemBinding.path.parent.source.value\n local = itemNode.local.name\n usesImportSyntax = true\n if (t.isImportSpecifier(itemNode)) {\n imported = itemNode.imported['name']\n destructured = true\n } else {\n imported = itemNode.local.name\n destructured = false\n }\n }\n } else if (\n t.isVariableDeclarator(itemNode) &&\n itemNode.init != null &&\n t.isCallExpression(itemNode.init) &&\n t.isIdentifier(itemNode.init.callee) &&\n itemNode.init.callee.name === 'require' &&\n itemNode.init.arguments.length === 1\n ) {\n const firstArg = itemNode.init.arguments[0]\n if (!t.isStringLiteral(firstArg)) {\n return null\n }\n sourceModule = firstArg.value\n\n if (t.isIdentifier(itemNode.id)) {\n local = itemNode.id.name\n imported = itemNode.id.name\n destructured = false\n } else if (t.isObjectPattern(itemNode.id)) {\n for (const objProp of itemNode.id.properties) {\n if (\n t.isObjectProperty(objProp) &&\n t.isIdentifier(objProp.value) &&\n objProp.value.name === itemName\n ) {\n local = objProp.value.name\n // @ts-ignore TODO remove this is only an issue on CI\n imported = objProp.key.name\n destructured = true\n break\n }\n }\n\n if (!local || !imported) {\n // eslint-disable-next-line no-console\n console.error('could not find prop with value `%s`', itemName)\n return null\n }\n } else {\n // eslint-disable-next-line no-console\n console.error('Unhandled id type: %s', itemNode.id.type)\n return null\n }\n } else {\n return null\n }\n\n return {\n destructured,\n imported,\n local,\n sourceModule,\n usesImportSyntax,\n }\n}\n"],
5
- "mappings": "0jBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,qBAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAAmB,2BAUZ,SAASF,EACdG,EACAC,EAIqB,CAErB,GAAI,CAACA,EAAY,SACf,OAAO,KAGT,IAAIC,EACAC,EACAC,EACAC,EACAC,EAAmB,GAEvB,MAAMC,EAAWN,EAAY,KAAK,KAElC,GAEEF,EAAE,yBAAyBQ,CAAQ,GAEnCR,EAAE,kBAAkBQ,CAAQ,EAExBR,EAAE,oBAAoBE,EAAY,KAAK,MAAM,IAC/CC,EAAeD,EAAY,KAAK,OAAO,OAAO,MAC9CG,EAAQG,EAAS,MAAM,KACvBD,EAAmB,GACfP,EAAE,kBAAkBQ,CAAQ,GAC9BJ,EAAWI,EAAS,SAAS,KAC7BF,EAAe,KAEfF,EAAWI,EAAS,MAAM,KAC1BF,EAAe,aAInBN,EAAE,qBAAqBQ,CAAQ,GAC/BA,EAAS,MAAQ,MACjBR,EAAE,iBAAiBQ,EAAS,IAAI,GAChCR,EAAE,aAAaQ,EAAS,KAAK,MAAM,GACnCA,EAAS,KAAK,OAAO,OAAS,WAC9BA,EAAS,KAAK,UAAU,SAAW,EACnC,CACA,MAAMC,EAAWD,EAAS,KAAK,UAAU,CAAC,EAC1C,GAAI,CAACR,EAAE,gBAAgBS,CAAQ,EAC7B,OAAO,KAIT,GAFAN,EAAeM,EAAS,MAEpBT,EAAE,aAAaQ,EAAS,EAAE,EAC5BH,EAAQG,EAAS,GAAG,KACpBJ,EAAWI,EAAS,GAAG,KACvBF,EAAe,WACNN,EAAE,gBAAgBQ,EAAS,EAAE,EAAG,CACzC,UAAWE,KAAWF,EAAS,GAAG,WAChC,GACER,EAAE,iBAAiBU,CAAO,GAC1BV,EAAE,aAAaU,EAAQ,KAAK,GAC5BA,EAAQ,MAAM,OAAST,EACvB,CACAI,EAAQK,EAAQ,MAAM,KAEtBN,EAAWM,EAAQ,IAAI,KACvBJ,EAAe,GACf,KACF,CAGF,GAAI,CAACD,GAAS,CAACD,EAEb,eAAQ,MAAM,sCAAuCH,CAAQ,EACtD,IAEX,KAEE,gBAAQ,MAAM,wBAAyBO,EAAS,GAAG,IAAI,EAChD,IAEX,KACE,QAAO,KAGT,MAAO,CACL,aAAAF,EACA,SAAAF,EACA,MAAAC,EACA,aAAAF,EACA,iBAAAI,CACF,CACF",
6
- "names": ["getSourceModule_exports", "__export", "getSourceModule", "__toCommonJS", "t", "itemName", "itemBinding", "sourceModule", "imported", "local", "destructured", "usesImportSyntax", "itemNode", "firstArg", "objProp"]
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,QAAmB;AAUZ,SAAS,gBACd,UACA,aAIqB;AAErB,MAAI,CAAC,YAAY,UAAU;AACzB,WAAO;AAAA,EACT;AAEA,MAAI;AACJ,MAAI;AACJ,MAAI;AACJ,MAAI;AACJ,MAAI,mBAAmB;AAEvB,QAAM,WAAW,YAAY,KAAK;AAElC;AAAA;AAAA,IAEE,EAAE,yBAAyB,QAAQ;AAAA,IAEnC,EAAE,kBAAkB,QAAQ;AAAA,IAC5B;AACA,QAAI,EAAE,oBAAoB,YAAY,KAAK,MAAM,GAAG;AAClD,qBAAe,YAAY,KAAK,OAAO,OAAO;AAC9C,cAAQ,SAAS,MAAM;AACvB,yBAAmB;AACnB,UAAI,EAAE,kBAAkB,QAAQ,GAAG;AACjC,mBAAW,SAAS,SAAS,MAAM;AACnC,uBAAe;AAAA,MACjB,OAAO;AACL,mBAAW,SAAS,MAAM;AAC1B,uBAAe;AAAA,MACjB;AAAA,IACF;AAAA,EACF,WACE,EAAE,qBAAqB,QAAQ,KAC/B,SAAS,QAAQ,QACjB,EAAE,iBAAiB,SAAS,IAAI,KAChC,EAAE,aAAa,SAAS,KAAK,MAAM,KACnC,SAAS,KAAK,OAAO,SAAS,aAC9B,SAAS,KAAK,UAAU,WAAW,GACnC;AACA,UAAM,WAAW,SAAS,KAAK,UAAU,CAAC;AAC1C,QAAI,CAAC,EAAE,gBAAgB,QAAQ,GAAG;AAChC,aAAO;AAAA,IACT;AACA,mBAAe,SAAS;AAExB,QAAI,EAAE,aAAa,SAAS,EAAE,GAAG;AAC/B,cAAQ,SAAS,GAAG;AACpB,iBAAW,SAAS,GAAG;AACvB,qBAAe;AAAA,IACjB,WAAW,EAAE,gBAAgB,SAAS,EAAE,GAAG;AACzC,iBAAW,WAAW,SAAS,GAAG,YAAY;AAC5C,YACE,EAAE,iBAAiB,OAAO,KAC1B,EAAE,aAAa,QAAQ,KAAK,KAC5B,QAAQ,MAAM,SAAS,UACvB;AACA,kBAAQ,QAAQ,MAAM;AAEtB,qBAAW,QAAQ,IAAI;AACvB,yBAAe;AACf;AAAA,QACF;AAAA,MACF;AAEA,UAAI,CAAC,SAAS,CAAC,UAAU;AAEvB,gBAAQ,MAAM,uCAAuC,QAAQ;AAC7D,eAAO;AAAA,MACT;AAAA,IACF,OAAO;AAEL,cAAQ,MAAM,yBAAyB,SAAS,GAAG,IAAI;AACvD,aAAO;AAAA,IACT;AAAA,EACF,OAAO;AACL,WAAO;AAAA,EACT;AAEA,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;",
6
+ "names": []
7
7
  }
@@ -1,2 +1,226 @@
1
- "use strict";var N=Object.create;var M=Object.defineProperty;var j=Object.getOwnPropertyDescriptor;var R=Object.getOwnPropertyNames;var A=Object.getPrototypeOf,G=Object.prototype.hasOwnProperty;var D=(e,i)=>{for(var r in i)M(e,r,{get:i[r],enumerable:!0})},E=(e,i,r,c)=>{if(i&&typeof i=="object"||typeof i=="function")for(let o of R(i))!G.call(e,o)&&o!==r&&M(e,o,{get:()=>i[o],enumerable:!(c=j(i,o))||c.enumerable});return e};var L=(e,i,r)=>(r=e!=null?N(A(e)):{},E(i||!e||!e.__esModule?M(r,"default",{value:e,enumerable:!0}):r,e)),_=e=>E(M({},"__esModule",{value:!0}),e);var U={};D(U,{cleanupBeforeExit:()=>P,getStaticBindingsForScope:()=>T});module.exports=_(U);var k=require("child_process"),m=require("path"),p=L(require("@babel/types")),B=require("./evaluateAstNode.js"),b=require("./getSourceModule.js");const O=e=>e.startsWith(".")||e.startsWith("/");function S(e,i){const r=(0,m.dirname)(e);return O(i)?((0,m.extname)(i)===""&&(i+=".js"),(0,m.resolve)(r,i)):i}const v=new Map,h=new Map,F=`${(0,m.join)(__dirname,"loadFile.js")}`;let W=!1,s=null;function J(){s=(0,k.fork)(F,[],{execArgv:["-r","esbuild-register"],detached:!1,stdio:"ignore"})}function P(){W||s&&(s.removeAllListeners(),s.unref(),s.disconnect(),s.kill(),W=!0)}process.once("SIGTERM",P),process.once("SIGINT",P),process.once("beforeExit",P);function $(e){if(s||J(),h.has(e))return h.get(e);const i=new Promise((r,c)=>{if(!s)return;if(v.size>2e3&&v.clear(),v.has(e))return v.get(e);const o=d=>{if(!s||!d||typeof d!="string")return;if(d[0]==="-"){c(new Error(d.slice(1)));return}s.removeListener("message",o);const a=JSON.parse(d);v.set(e,a),r(a)};s.once("message",o),s.send(`${e.replace(".js","")}`)});return h.set(e,i),i}async function T(e,i=[],r,c,o){var w;const d=e.getAllBindings(),a={},x=e.getProgramParent().block;for(const t of x.body)if(p.isImportDeclaration(t)){const g=t.source.value;if(!t.specifiers.length||!O(g))continue;const f=S(r,g);if(!i.some(n=>f.endsWith(n)))continue;try{const n=await $(f);if(!n)continue;for(const l of t.specifiers)if(p.isImportSpecifier(l)&&p.isIdentifier(l.imported)&&typeof n[l.imported.name]<"u"){const u=n[l.local.name];a[l.local.name]=u}}catch(n){o?console.warn(` | Skipping partial evaluation of constant file: ${f} (DEBUG=tamagui for more)`):(w=process.env.DEBUG)!=null&&w.startsWith("tamagui")&&console.log("Error in partial evaluation",n.message,n.stack)}}if(!c)throw new Error("BindingCache is a required param");for(const t in d){const g=d[t],f=(0,b.getSourceModule)(t,g);if(f){if(!f.sourceModule)continue;const u=S(r,f.sourceModule);if(i.some(y=>u.endsWith(y))){const y=$(u);if(!y)return console.log(` | \u26A0\uFE0F Missing file ${u} via ${r} import ${f.sourceModule}?`),{};f.destructured?f.imported&&(a[t]=y[f.imported]):a[t]=y}continue}const{parent:I}=g.path;if(!p.isVariableDeclaration(I)||I.kind!=="const")continue;const n=I.declarations.find(u=>p.isIdentifier(u.id)&&u.id.name===t);if(!n||!n.init)continue;if(typeof n.id.start!="number"||typeof n.id.end!="number"){console.error("dec.id.start/end is not a number");continue}if(!p.isIdentifier(n.id)){console.error("dec is not an identifier");continue}const l=`${n.id.name}_${n.id.start}-${n.id.end}`;if(Object.hasOwnProperty.call(c,l)){a[t]=c[l];continue}if(Object.hasOwnProperty.call(c,l)){a[t]=c[l];continue}try{a[t]=(0,B.evaluateAstNode)(n.init,void 0,o),c[l]=a[t];continue}catch{}}return a}0&&(module.exports={cleanupBeforeExit,getStaticBindingsForScope});
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+ var getStaticBindingsForScope_exports = {};
30
+ __export(getStaticBindingsForScope_exports, {
31
+ cleanupBeforeExit: () => cleanupBeforeExit,
32
+ getStaticBindingsForScope: () => getStaticBindingsForScope
33
+ });
34
+ module.exports = __toCommonJS(getStaticBindingsForScope_exports);
35
+ var import_child_process = require("child_process");
36
+ var import_path = require("path");
37
+ var t = __toESM(require("@babel/types"));
38
+ var import_evaluateAstNode = require("./evaluateAstNode.js");
39
+ var import_getSourceModule = require("./getSourceModule.js");
40
+ const isLocalImport = (path) => path.startsWith(".") || path.startsWith("/");
41
+ function resolveImportPath(sourcePath, path) {
42
+ const sourceDir = (0, import_path.dirname)(sourcePath);
43
+ if (isLocalImport(path)) {
44
+ if ((0, import_path.extname)(path) === "") {
45
+ path += ".js";
46
+ }
47
+ return (0, import_path.resolve)(sourceDir, path);
48
+ }
49
+ return path;
50
+ }
51
+ const cache = /* @__PURE__ */ new Map();
52
+ const pending = /* @__PURE__ */ new Map();
53
+ const loadCmd = `${(0, import_path.join)(__dirname, "loadFile.js")}`;
54
+ let exited = false;
55
+ let child = null;
56
+ function forkChild() {
57
+ child = (0, import_child_process.fork)(loadCmd, [], {
58
+ execArgv: ["-r", "esbuild-register"],
59
+ detached: false,
60
+ stdio: "ignore"
61
+ });
62
+ }
63
+ function cleanupBeforeExit() {
64
+ if (exited)
65
+ return;
66
+ if (!child)
67
+ return;
68
+ child.removeAllListeners();
69
+ child.unref();
70
+ child.disconnect();
71
+ child.kill();
72
+ exited = true;
73
+ }
74
+ process.once("SIGTERM", cleanupBeforeExit);
75
+ process.once("SIGINT", cleanupBeforeExit);
76
+ process.once("beforeExit", cleanupBeforeExit);
77
+ function importModule(path) {
78
+ if (!child) {
79
+ forkChild();
80
+ }
81
+ if (pending.has(path)) {
82
+ return pending.get(path);
83
+ }
84
+ const promise = new Promise((res, rej) => {
85
+ if (!child)
86
+ return;
87
+ if (cache.size > 2e3) {
88
+ cache.clear();
89
+ }
90
+ if (cache.has(path)) {
91
+ return cache.get(path);
92
+ }
93
+ const listener = (msg) => {
94
+ if (!child)
95
+ return;
96
+ if (!msg)
97
+ return;
98
+ if (typeof msg !== "string")
99
+ return;
100
+ if (msg[0] === "-") {
101
+ rej(new Error(msg.slice(1)));
102
+ return;
103
+ }
104
+ child.removeListener("message", listener);
105
+ const val = JSON.parse(msg);
106
+ cache.set(path, val);
107
+ res(val);
108
+ };
109
+ child.once("message", listener);
110
+ child.send(`${path.replace(".js", "")}`);
111
+ });
112
+ pending.set(path, promise);
113
+ return promise;
114
+ }
115
+ async function getStaticBindingsForScope(scope, whitelist = [], sourcePath, bindingCache, shouldPrintDebug) {
116
+ var _a;
117
+ const bindings = scope.getAllBindings();
118
+ const ret = {};
119
+ if (shouldPrintDebug) {
120
+ }
121
+ const program = scope.getProgramParent().block;
122
+ for (const node of program.body) {
123
+ if (t.isImportDeclaration(node)) {
124
+ const importPath = node.source.value;
125
+ if (!node.specifiers.length)
126
+ continue;
127
+ if (!isLocalImport(importPath)) {
128
+ continue;
129
+ }
130
+ const moduleName = resolveImportPath(sourcePath, importPath);
131
+ const isOnWhitelist = whitelist.some((test) => moduleName.endsWith(test));
132
+ if (!isOnWhitelist)
133
+ continue;
134
+ try {
135
+ const src = await importModule(moduleName);
136
+ if (!src)
137
+ continue;
138
+ for (const specifier of node.specifiers) {
139
+ if (t.isImportSpecifier(specifier) && t.isIdentifier(specifier.imported)) {
140
+ if (typeof src[specifier.imported.name] !== "undefined") {
141
+ const val = src[specifier.local.name];
142
+ ret[specifier.local.name] = val;
143
+ }
144
+ }
145
+ }
146
+ } catch (err) {
147
+ if (shouldPrintDebug) {
148
+ console.warn(
149
+ ` | Skipping partial evaluation of constant file: ${moduleName} (DEBUG=tamagui for more)`
150
+ );
151
+ } else if ((_a = process.env.DEBUG) == null ? void 0 : _a.startsWith("tamagui")) {
152
+ console.log(`Error in partial evaluation`, err.message, err.stack);
153
+ }
154
+ }
155
+ }
156
+ }
157
+ if (!bindingCache) {
158
+ throw new Error("BindingCache is a required param");
159
+ }
160
+ for (const k in bindings) {
161
+ const binding = bindings[k];
162
+ const sourceModule = (0, import_getSourceModule.getSourceModule)(k, binding);
163
+ if (sourceModule) {
164
+ if (!sourceModule.sourceModule) {
165
+ continue;
166
+ }
167
+ const moduleName = resolveImportPath(sourcePath, sourceModule.sourceModule);
168
+ const isOnWhitelist = whitelist.some((test) => moduleName.endsWith(test));
169
+ if (isOnWhitelist) {
170
+ const src = importModule(moduleName);
171
+ if (!src) {
172
+ console.log(
173
+ ` | \u26A0\uFE0F Missing file ${moduleName} via ${sourcePath} import ${sourceModule.sourceModule}?`
174
+ );
175
+ return {};
176
+ }
177
+ if (sourceModule.destructured) {
178
+ if (sourceModule.imported) {
179
+ ret[k] = src[sourceModule.imported];
180
+ }
181
+ } else {
182
+ ret[k] = src;
183
+ }
184
+ }
185
+ continue;
186
+ }
187
+ const { parent } = binding.path;
188
+ if (!t.isVariableDeclaration(parent) || parent.kind !== "const") {
189
+ continue;
190
+ }
191
+ const dec = parent.declarations.find((d) => t.isIdentifier(d.id) && d.id.name === k);
192
+ if (!dec || !dec.init) {
193
+ continue;
194
+ }
195
+ if (typeof dec.id.start !== "number" || typeof dec.id.end !== "number") {
196
+ console.error("dec.id.start/end is not a number");
197
+ continue;
198
+ }
199
+ if (!t.isIdentifier(dec.id)) {
200
+ console.error("dec is not an identifier");
201
+ continue;
202
+ }
203
+ const cacheKey = `${dec.id.name}_${dec.id.start}-${dec.id.end}`;
204
+ if (Object.hasOwnProperty.call(bindingCache, cacheKey)) {
205
+ ret[k] = bindingCache[cacheKey];
206
+ continue;
207
+ }
208
+ if (Object.hasOwnProperty.call(bindingCache, cacheKey)) {
209
+ ret[k] = bindingCache[cacheKey];
210
+ continue;
211
+ }
212
+ try {
213
+ ret[k] = (0, import_evaluateAstNode.evaluateAstNode)(dec.init, void 0, shouldPrintDebug);
214
+ bindingCache[cacheKey] = ret[k];
215
+ continue;
216
+ } catch {
217
+ }
218
+ }
219
+ return ret;
220
+ }
221
+ // Annotate the CommonJS export names for ESM import in node:
222
+ 0 && (module.exports = {
223
+ cleanupBeforeExit,
224
+ getStaticBindingsForScope
225
+ });
2
226
  //# sourceMappingURL=getStaticBindingsForScope.js.map