@fluentui-react-native/framework-base 0.2.1 → 0.3.0

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 (187) hide show
  1. package/CHANGELOG.json +1 -1
  2. package/CHANGELOG.md +35 -2
  3. package/README.md +18 -1
  4. package/babel.config.js +1 -1
  5. package/jsx-runtime.js +1 -0
  6. package/lib/component-patterns/directComponent.d.ts +7 -0
  7. package/lib/component-patterns/directComponent.d.ts.map +1 -0
  8. package/lib/component-patterns/directComponent.js +8 -0
  9. package/lib/component-patterns/directComponent.js.map +1 -0
  10. package/lib/component-patterns/extract.d.ts +22 -0
  11. package/lib/component-patterns/extract.d.ts.map +1 -0
  12. package/lib/component-patterns/extract.js +25 -0
  13. package/lib/component-patterns/extract.js.map +1 -0
  14. package/lib/component-patterns/phasedComponent.d.ts +18 -0
  15. package/lib/component-patterns/phasedComponent.d.ts.map +1 -0
  16. package/lib/component-patterns/phasedComponent.js +51 -0
  17. package/lib/component-patterns/phasedComponent.js.map +1 -0
  18. package/lib/component-patterns/render.d.ts +9 -3
  19. package/lib/component-patterns/render.d.ts.map +1 -1
  20. package/lib/component-patterns/render.js +39 -32
  21. package/lib/component-patterns/render.js.map +1 -1
  22. package/lib/component-patterns/render.types.d.ts +60 -34
  23. package/lib/component-patterns/render.types.d.ts.map +1 -1
  24. package/lib/component-patterns/render.types.js +1 -1
  25. package/lib/component-patterns/stagedComponent.d.ts +3 -8
  26. package/lib/component-patterns/stagedComponent.d.ts.map +1 -1
  27. package/lib/component-patterns/stagedComponent.js +10 -27
  28. package/lib/component-patterns/stagedComponent.js.map +1 -1
  29. package/lib/component-patterns/withSlots.d.ts +6 -2
  30. package/lib/component-patterns/withSlots.d.ts.map +1 -1
  31. package/lib/component-patterns/withSlots.js +3 -3
  32. package/lib/component-patterns/withSlots.js.map +1 -1
  33. package/lib/immutable-merge/Merge.d.ts +6 -3
  34. package/lib/immutable-merge/Merge.js +79 -83
  35. package/lib/immutable-merge/Merge.js.map +1 -1
  36. package/lib/immutable-merge/Merge.test.d.ts +1 -1
  37. package/lib/immutable-merge/Merge.test.js +231 -219
  38. package/lib/immutable-merge/Merge.test.js.map +1 -1
  39. package/lib/index.d.ts +33 -5
  40. package/lib/index.d.ts.map +1 -1
  41. package/lib/index.js +13 -4
  42. package/lib/index.js.map +1 -1
  43. package/lib/jsx-namespace.d.ts +65 -0
  44. package/lib/jsx-namespace.d.ts.map +1 -0
  45. package/lib/jsx-namespace.js +2 -0
  46. package/lib/jsx-namespace.js.map +1 -0
  47. package/lib/jsx-runtime.d.ts +6 -4
  48. package/lib/jsx-runtime.d.ts.map +1 -1
  49. package/lib/jsx-runtime.js +9 -7
  50. package/lib/jsx-runtime.js.map +1 -1
  51. package/lib/memo-cache/getCacheEntry.d.ts +13 -13
  52. package/lib/memo-cache/getCacheEntry.js +20 -22
  53. package/lib/memo-cache/getCacheEntry.js.map +1 -1
  54. package/lib/memo-cache/getCacheEntry.test.d.ts +1 -1
  55. package/lib/memo-cache/getCacheEntry.test.js +90 -90
  56. package/lib/memo-cache/getCacheEntry.test.js.map +1 -1
  57. package/lib/memo-cache/getMemoCache.d.ts +1 -1
  58. package/lib/memo-cache/getMemoCache.js +11 -11
  59. package/lib/memo-cache/getMemoCache.js.map +1 -1
  60. package/lib/memo-cache/getMemoCache.test.d.ts +1 -1
  61. package/lib/memo-cache/getMemoCache.test.js +73 -73
  62. package/lib/memo-cache/getMemoCache.test.js.map +1 -1
  63. package/lib/memo-cache/memoize.d.ts +1 -1
  64. package/lib/memo-cache/memoize.js +9 -9
  65. package/lib/memo-cache/memoize.js.map +1 -1
  66. package/lib/memo-cache/memoize.test.d.ts +1 -1
  67. package/lib/memo-cache/memoize.test.js +36 -38
  68. package/lib/memo-cache/memoize.test.js.map +1 -1
  69. package/lib/merge-props/index.d.ts +1 -1
  70. package/lib/merge-props/index.js +1 -1
  71. package/lib/merge-props/mergeProps.d.ts +1 -1
  72. package/lib/merge-props/mergeProps.js +4 -4
  73. package/lib/merge-props/mergeProps.js.map +1 -1
  74. package/lib/merge-props/mergeStyles.d.ts +33 -4
  75. package/lib/merge-props/mergeStyles.d.ts.map +1 -1
  76. package/lib/merge-props/mergeStyles.js +16 -17
  77. package/lib/merge-props/mergeStyles.js.map +1 -1
  78. package/lib/merge-props/mergeStyles.test.d.ts +1 -1
  79. package/lib/merge-props/mergeStyles.test.js +75 -75
  80. package/lib/merge-props/mergeStyles.test.js.map +1 -1
  81. package/lib/merge-props/mergeStyles.types.d.ts +4 -4
  82. package/lib/merge-props/mergeStyles.types.d.ts.map +1 -1
  83. package/lib/merge-props/mergeStyles.types.js +1 -1
  84. package/lib/utilities/filterProps.d.ts +3 -0
  85. package/lib/utilities/filterProps.d.ts.map +1 -0
  86. package/lib/utilities/filterProps.js +12 -0
  87. package/lib/utilities/filterProps.js.map +1 -0
  88. package/lib-commonjs/component-patterns/directComponent.d.ts +7 -0
  89. package/lib-commonjs/component-patterns/directComponent.d.ts.map +1 -0
  90. package/lib-commonjs/component-patterns/directComponent.js +11 -0
  91. package/lib-commonjs/component-patterns/directComponent.js.map +1 -0
  92. package/lib-commonjs/component-patterns/extract.d.ts +22 -0
  93. package/lib-commonjs/component-patterns/extract.d.ts.map +1 -0
  94. package/lib-commonjs/component-patterns/extract.js +30 -0
  95. package/lib-commonjs/component-patterns/extract.js.map +1 -0
  96. package/lib-commonjs/component-patterns/phasedComponent.d.ts +18 -0
  97. package/lib-commonjs/component-patterns/phasedComponent.d.ts.map +1 -0
  98. package/lib-commonjs/component-patterns/phasedComponent.js +60 -0
  99. package/lib-commonjs/component-patterns/phasedComponent.js.map +1 -0
  100. package/lib-commonjs/component-patterns/render.d.ts +9 -3
  101. package/lib-commonjs/component-patterns/render.d.ts.map +1 -1
  102. package/lib-commonjs/component-patterns/render.js +101 -64
  103. package/lib-commonjs/component-patterns/render.js.map +1 -1
  104. package/lib-commonjs/component-patterns/render.types.d.ts +60 -34
  105. package/lib-commonjs/component-patterns/render.types.d.ts.map +1 -1
  106. package/lib-commonjs/component-patterns/render.types.js +3 -3
  107. package/lib-commonjs/component-patterns/stagedComponent.d.ts +3 -8
  108. package/lib-commonjs/component-patterns/stagedComponent.d.ts.map +1 -1
  109. package/lib-commonjs/component-patterns/stagedComponent.js +64 -56
  110. package/lib-commonjs/component-patterns/stagedComponent.js.map +1 -1
  111. package/lib-commonjs/component-patterns/withSlots.d.ts +6 -2
  112. package/lib-commonjs/component-patterns/withSlots.d.ts.map +1 -1
  113. package/lib-commonjs/component-patterns/withSlots.js +7 -8
  114. package/lib-commonjs/component-patterns/withSlots.js.map +1 -1
  115. package/lib-commonjs/immutable-merge/Merge.d.ts +6 -3
  116. package/lib-commonjs/immutable-merge/Merge.js +85 -90
  117. package/lib-commonjs/immutable-merge/Merge.js.map +1 -1
  118. package/lib-commonjs/immutable-merge/Merge.test.d.ts +1 -1
  119. package/lib-commonjs/immutable-merge/Merge.test.js +234 -222
  120. package/lib-commonjs/immutable-merge/Merge.test.js.map +1 -1
  121. package/lib-commonjs/index.d.ts +33 -5
  122. package/lib-commonjs/index.d.ts.map +1 -1
  123. package/lib-commonjs/index.js +184 -31
  124. package/lib-commonjs/index.js.map +1 -1
  125. package/lib-commonjs/jsx-namespace.d.ts +65 -0
  126. package/lib-commonjs/jsx-namespace.d.ts.map +1 -0
  127. package/lib-commonjs/jsx-namespace.js +3 -0
  128. package/lib-commonjs/jsx-namespace.js.map +1 -0
  129. package/lib-commonjs/jsx-runtime.d.ts +6 -4
  130. package/lib-commonjs/jsx-runtime.d.ts.map +1 -1
  131. package/lib-commonjs/jsx-runtime.js +69 -34
  132. package/lib-commonjs/jsx-runtime.js.map +1 -1
  133. package/lib-commonjs/memo-cache/getCacheEntry.d.ts +13 -13
  134. package/lib-commonjs/memo-cache/getCacheEntry.js +23 -26
  135. package/lib-commonjs/memo-cache/getCacheEntry.js.map +1 -1
  136. package/lib-commonjs/memo-cache/getCacheEntry.test.d.ts +1 -1
  137. package/lib-commonjs/memo-cache/getCacheEntry.test.js +93 -93
  138. package/lib-commonjs/memo-cache/getCacheEntry.test.js.map +1 -1
  139. package/lib-commonjs/memo-cache/getMemoCache.d.ts +1 -1
  140. package/lib-commonjs/memo-cache/getMemoCache.js +16 -17
  141. package/lib-commonjs/memo-cache/getMemoCache.js.map +1 -1
  142. package/lib-commonjs/memo-cache/getMemoCache.test.d.ts +1 -1
  143. package/lib-commonjs/memo-cache/getMemoCache.test.js +76 -76
  144. package/lib-commonjs/memo-cache/getMemoCache.test.js.map +1 -1
  145. package/lib-commonjs/memo-cache/memoize.d.ts +1 -1
  146. package/lib-commonjs/memo-cache/memoize.js +13 -14
  147. package/lib-commonjs/memo-cache/memoize.js.map +1 -1
  148. package/lib-commonjs/memo-cache/memoize.test.d.ts +1 -1
  149. package/lib-commonjs/memo-cache/memoize.test.js +39 -41
  150. package/lib-commonjs/memo-cache/memoize.test.js.map +1 -1
  151. package/lib-commonjs/merge-props/index.d.ts +1 -1
  152. package/lib-commonjs/merge-props/index.js +17 -7
  153. package/lib-commonjs/merge-props/index.js.map +1 -1
  154. package/lib-commonjs/merge-props/mergeProps.d.ts +1 -1
  155. package/lib-commonjs/merge-props/mergeProps.js +9 -10
  156. package/lib-commonjs/merge-props/mergeProps.js.map +1 -1
  157. package/lib-commonjs/merge-props/mergeStyles.d.ts +33 -4
  158. package/lib-commonjs/merge-props/mergeStyles.d.ts.map +1 -1
  159. package/lib-commonjs/merge-props/mergeStyles.js +23 -25
  160. package/lib-commonjs/merge-props/mergeStyles.js.map +1 -1
  161. package/lib-commonjs/merge-props/mergeStyles.test.d.ts +1 -1
  162. package/lib-commonjs/merge-props/mergeStyles.test.js +78 -78
  163. package/lib-commonjs/merge-props/mergeStyles.test.js.map +1 -1
  164. package/lib-commonjs/merge-props/mergeStyles.types.d.ts +4 -4
  165. package/lib-commonjs/merge-props/mergeStyles.types.d.ts.map +1 -1
  166. package/lib-commonjs/merge-props/mergeStyles.types.js +3 -3
  167. package/lib-commonjs/utilities/filterProps.d.ts +3 -0
  168. package/lib-commonjs/utilities/filterProps.d.ts.map +1 -0
  169. package/lib-commonjs/utilities/filterProps.js +15 -0
  170. package/lib-commonjs/utilities/filterProps.js.map +1 -0
  171. package/package.json +48 -26
  172. package/src/component-patterns/README.md +53 -16
  173. package/src/component-patterns/directComponent.ts +9 -0
  174. package/src/component-patterns/extract.ts +32 -0
  175. package/src/component-patterns/phasedComponent.ts +54 -0
  176. package/src/component-patterns/render.ts +21 -13
  177. package/src/component-patterns/render.types.ts +55 -30
  178. package/src/component-patterns/stagedComponent.ts +24 -0
  179. package/src/immutable-merge/Merge.test.ts +5 -1
  180. package/src/index.ts +27 -7
  181. package/src/jsx-namespace.ts +83 -0
  182. package/src/jsx-runtime.ts +8 -4
  183. package/src/memo-cache/README.md +1 -1
  184. package/src/merge-props/mergeStyles.ts +52 -4
  185. package/src/merge-props/mergeStyles.types.ts +2 -2
  186. package/src/utilities/filterProps.ts +14 -0
  187. package/src/component-patterns/stagedComponent.tsx +0 -45
@@ -1,32 +1,185 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.jsxs = exports.jsx = exports.twoStageComponent = exports.stagedComponent = exports.withSlots = exports.renderSlot = exports.renderForJsxRuntime = exports.renderForClassicRuntime = exports.mergeProps = exports.mergeStyles = exports.memoize = exports.getTypedMemoCache = exports.getMemoCache = exports.filterToObjects = exports.processImmutable = exports.immutableMergeCore = exports.immutableMerge = void 0;
1
+ 'use strict';
2
+ Object.defineProperty(exports, '__esModule', { value: true });
3
+ exports.filterProps =
4
+ exports.jsxs =
5
+ exports.jsx =
6
+ exports.withSlots =
7
+ exports.stagedComponent =
8
+ exports.phasedComponent =
9
+ exports.getPhasedRender =
10
+ exports.directComponent =
11
+ exports.asDirectComponent =
12
+ exports.renderSlot =
13
+ exports.renderForJsxRuntime =
14
+ exports.extractStyle =
15
+ exports.extractProps =
16
+ exports.extractChildren =
17
+ exports.mergeProps =
18
+ exports.mergeStyles =
19
+ exports.memoize =
20
+ exports.getTypedMemoCache =
21
+ exports.getMemoCache =
22
+ exports.filterToObjects =
23
+ exports.processImmutable =
24
+ exports.immutableMergeCore =
25
+ exports.immutableMerge =
26
+ void 0;
4
27
  // immutable-merge exports
5
- var Merge_1 = require("./immutable-merge/Merge");
6
- Object.defineProperty(exports, "immutableMerge", { enumerable: true, get: function () { return Merge_1.immutableMerge; } });
7
- Object.defineProperty(exports, "immutableMergeCore", { enumerable: true, get: function () { return Merge_1.immutableMergeCore; } });
8
- Object.defineProperty(exports, "processImmutable", { enumerable: true, get: function () { return Merge_1.processImmutable; } });
9
- Object.defineProperty(exports, "filterToObjects", { enumerable: true, get: function () { return Merge_1.filterToObjects; } });
10
- var getMemoCache_1 = require("./memo-cache/getMemoCache");
11
- Object.defineProperty(exports, "getMemoCache", { enumerable: true, get: function () { return getMemoCache_1.getMemoCache; } });
12
- Object.defineProperty(exports, "getTypedMemoCache", { enumerable: true, get: function () { return getMemoCache_1.getTypedMemoCache; } });
13
- var memoize_1 = require("./memo-cache/memoize");
14
- Object.defineProperty(exports, "memoize", { enumerable: true, get: function () { return memoize_1.memoize; } });
15
- var mergeStyles_1 = require("./merge-props/mergeStyles");
16
- Object.defineProperty(exports, "mergeStyles", { enumerable: true, get: function () { return mergeStyles_1.mergeStyles; } });
17
- var mergeProps_1 = require("./merge-props/mergeProps");
18
- Object.defineProperty(exports, "mergeProps", { enumerable: true, get: function () { return mergeProps_1.mergeProps; } });
19
- // component pattern exports
20
- var render_1 = require("./component-patterns/render");
21
- Object.defineProperty(exports, "renderForClassicRuntime", { enumerable: true, get: function () { return render_1.renderForClassicRuntime; } });
22
- Object.defineProperty(exports, "renderForJsxRuntime", { enumerable: true, get: function () { return render_1.renderForJsxRuntime; } });
23
- Object.defineProperty(exports, "renderSlot", { enumerable: true, get: function () { return render_1.renderSlot; } });
24
- var withSlots_1 = require("./component-patterns/withSlots");
25
- Object.defineProperty(exports, "withSlots", { enumerable: true, get: function () { return withSlots_1.withSlots; } });
26
- var stagedComponent_1 = require("./component-patterns/stagedComponent");
27
- Object.defineProperty(exports, "stagedComponent", { enumerable: true, get: function () { return stagedComponent_1.stagedComponent; } });
28
- Object.defineProperty(exports, "twoStageComponent", { enumerable: true, get: function () { return stagedComponent_1.twoStageComponent; } });
29
- var jsx_runtime_1 = require("./jsx-runtime");
30
- Object.defineProperty(exports, "jsx", { enumerable: true, get: function () { return jsx_runtime_1.jsx; } });
31
- Object.defineProperty(exports, "jsxs", { enumerable: true, get: function () { return jsx_runtime_1.jsxs; } });
32
- //# sourceMappingURL=index.js.map
28
+ const Merge_1 = require('./immutable-merge/Merge');
29
+ Object.defineProperty(exports, 'immutableMerge', {
30
+ enumerable: true,
31
+ get: function () {
32
+ return Merge_1.immutableMerge;
33
+ },
34
+ });
35
+ Object.defineProperty(exports, 'immutableMergeCore', {
36
+ enumerable: true,
37
+ get: function () {
38
+ return Merge_1.immutableMergeCore;
39
+ },
40
+ });
41
+ Object.defineProperty(exports, 'processImmutable', {
42
+ enumerable: true,
43
+ get: function () {
44
+ return Merge_1.processImmutable;
45
+ },
46
+ });
47
+ Object.defineProperty(exports, 'filterToObjects', {
48
+ enumerable: true,
49
+ get: function () {
50
+ return Merge_1.filterToObjects;
51
+ },
52
+ });
53
+ const getMemoCache_1 = require('./memo-cache/getMemoCache');
54
+ Object.defineProperty(exports, 'getMemoCache', {
55
+ enumerable: true,
56
+ get: function () {
57
+ return getMemoCache_1.getMemoCache;
58
+ },
59
+ });
60
+ Object.defineProperty(exports, 'getTypedMemoCache', {
61
+ enumerable: true,
62
+ get: function () {
63
+ return getMemoCache_1.getTypedMemoCache;
64
+ },
65
+ });
66
+ const memoize_1 = require('./memo-cache/memoize');
67
+ Object.defineProperty(exports, 'memoize', {
68
+ enumerable: true,
69
+ get: function () {
70
+ return memoize_1.memoize;
71
+ },
72
+ });
73
+ const mergeStyles_1 = require('./merge-props/mergeStyles');
74
+ Object.defineProperty(exports, 'mergeStyles', {
75
+ enumerable: true,
76
+ get: function () {
77
+ return mergeStyles_1.mergeStyles;
78
+ },
79
+ });
80
+ const mergeProps_1 = require('./merge-props/mergeProps');
81
+ Object.defineProperty(exports, 'mergeProps', {
82
+ enumerable: true,
83
+ get: function () {
84
+ return mergeProps_1.mergeProps;
85
+ },
86
+ });
87
+ // component pattern exports - extracting from elements
88
+ const extract_1 = require('./component-patterns/extract');
89
+ Object.defineProperty(exports, 'extractChildren', {
90
+ enumerable: true,
91
+ get: function () {
92
+ return extract_1.extractChildren;
93
+ },
94
+ });
95
+ Object.defineProperty(exports, 'extractProps', {
96
+ enumerable: true,
97
+ get: function () {
98
+ return extract_1.extractProps;
99
+ },
100
+ });
101
+ Object.defineProperty(exports, 'extractStyle', {
102
+ enumerable: true,
103
+ get: function () {
104
+ return extract_1.extractStyle;
105
+ },
106
+ });
107
+ // component pattern exports - rendering utilities
108
+ const render_1 = require('./component-patterns/render');
109
+ Object.defineProperty(exports, 'renderForJsxRuntime', {
110
+ enumerable: true,
111
+ get: function () {
112
+ return render_1.renderForJsxRuntime;
113
+ },
114
+ });
115
+ Object.defineProperty(exports, 'renderSlot', {
116
+ enumerable: true,
117
+ get: function () {
118
+ return render_1.renderSlot;
119
+ },
120
+ });
121
+ Object.defineProperty(exports, 'asDirectComponent', {
122
+ enumerable: true,
123
+ get: function () {
124
+ return render_1.asDirectComponent;
125
+ },
126
+ });
127
+ // component pattern exports - component builders
128
+ const directComponent_1 = require('./component-patterns/directComponent');
129
+ Object.defineProperty(exports, 'directComponent', {
130
+ enumerable: true,
131
+ get: function () {
132
+ return directComponent_1.directComponent;
133
+ },
134
+ });
135
+ const phasedComponent_1 = require('./component-patterns/phasedComponent');
136
+ Object.defineProperty(exports, 'getPhasedRender', {
137
+ enumerable: true,
138
+ get: function () {
139
+ return phasedComponent_1.getPhasedRender;
140
+ },
141
+ });
142
+ Object.defineProperty(exports, 'phasedComponent', {
143
+ enumerable: true,
144
+ get: function () {
145
+ return phasedComponent_1.phasedComponent;
146
+ },
147
+ });
148
+ const stagedComponent_1 = require('./component-patterns/stagedComponent');
149
+ Object.defineProperty(exports, 'stagedComponent', {
150
+ enumerable: true,
151
+ get: function () {
152
+ return stagedComponent_1.stagedComponent;
153
+ },
154
+ });
155
+ // component pattern exports - legacy JSX handlers
156
+ const withSlots_1 = require('./component-patterns/withSlots');
157
+ Object.defineProperty(exports, 'withSlots', {
158
+ enumerable: true,
159
+ get: function () {
160
+ return withSlots_1.withSlots;
161
+ },
162
+ });
163
+ // jsx runtime exports
164
+ const jsx_runtime_1 = require('./jsx-runtime');
165
+ Object.defineProperty(exports, 'jsx', {
166
+ enumerable: true,
167
+ get: function () {
168
+ return jsx_runtime_1.jsx;
169
+ },
170
+ });
171
+ Object.defineProperty(exports, 'jsxs', {
172
+ enumerable: true,
173
+ get: function () {
174
+ return jsx_runtime_1.jsxs;
175
+ },
176
+ });
177
+ // general utilities
178
+ const filterProps_1 = require('./utilities/filterProps');
179
+ Object.defineProperty(exports, 'filterProps', {
180
+ enumerable: true,
181
+ get: function () {
182
+ return filterProps_1.filterProps;
183
+ },
184
+ });
185
+ //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,0BAA0B;AAC1B,iDAAgH;AAAvG,uGAAA,cAAc,OAAA;AAAE,2GAAA,kBAAkB,OAAA;AAAE,yGAAA,gBAAgB,OAAA;AAAE,wGAAA,eAAe,OAAA;AAY9E,0DAA4E;AAAnE,4GAAA,YAAY,OAAA;AAAE,iHAAA,iBAAiB,OAAA;AACxC,gDAA+C;AAAtC,kGAAA,OAAO,OAAA;AAIhB,yDAAwD;AAA/C,0GAAA,WAAW,OAAA;AACpB,uDAAsD;AAA7C,wGAAA,UAAU,OAAA;AAEnB,4BAA4B;AAC5B,sDAAuG;AAA9F,iHAAA,uBAAuB,OAAA;AAAE,6GAAA,mBAAmB,OAAA;AAAE,oGAAA,UAAU,OAAA;AAejE,4DAA2D;AAAlD,sGAAA,SAAS,OAAA;AAClB,wEAA0F;AAAjF,kHAAA,eAAe,OAAA;AAAE,oHAAA,iBAAiB,OAAA;AAC3C,6CAA0C;AAAjC,kGAAA,GAAG,OAAA;AAAE,mGAAA,IAAI,OAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,0BAA0B;AAC1B,mDAAgH;AAAvG,uGAAA,cAAc,OAAA;AAAE,2GAAA,kBAAkB,OAAA;AAAE,yGAAA,gBAAgB,OAAA;AAAE,wGAAA,eAAe,OAAA;AAY9E,4DAA4E;AAAnE,4GAAA,YAAY,OAAA;AAAE,iHAAA,iBAAiB,OAAA;AACxC,kDAA+C;AAAtC,kGAAA,OAAO,OAAA;AAIhB,2DAAwD;AAA/C,0GAAA,WAAW,OAAA;AACpB,yDAAsD;AAA7C,wGAAA,UAAU,OAAA;AAEnB,uDAAuD;AACvD,0DAA2F;AAAlF,0GAAA,eAAe,OAAA;AAAE,uGAAA,YAAY,OAAA;AAAE,uGAAA,YAAY,OAAA;AAEpD,kDAAkD;AAClD,wDAAiG;AAAxF,6GAAA,mBAAmB,OAAA;AAAE,oGAAA,UAAU,OAAA;AAAE,2GAAA,iBAAiB,OAAA;AAoB3D,iDAAiD;AACjD,0EAAuE;AAA9D,kHAAA,eAAe,OAAA;AACxB,0EAAwF;AAA/E,kHAAA,eAAe,OAAA;AAAE,kHAAA,eAAe,OAAA;AACzC,0EAAuE;AAA9D,kHAAA,eAAe,OAAA;AAExB,kDAAkD;AAClD,8DAA2D;AAAlD,sGAAA,SAAS,OAAA;AAElB,sBAAsB;AACtB,+CAA0C;AAAjC,kGAAA,GAAG,OAAA;AAAE,mGAAA,IAAI,OAAA;AAGlB,oBAAoB;AACpB,yDAAsD;AAA7C,0GAAA,WAAW,OAAA"}
@@ -0,0 +1,65 @@
1
+ import type React from 'react';
2
+ /**
3
+ * This file defines a custom JSX namespace that re-exports React's JSX types, but also allows us to add our own custom behavior to the JSX runtime.
4
+ * The main reason we need this is to support our "direct component" pattern, which allows certain components to bypass React's createElement and
5
+ * return their own React elements directly from the JSX runtime.
6
+ *
7
+ * Exporting this custom namespace is required to make intrinsic attributes like key and ref work correctly with our custom JSX functions. The normal
8
+ * fallback behavior if not defined is to not allow any attributes on intrinsic elements, which breaks a lot of React functionality.
9
+ *
10
+ * The custom behavior is implemented in the jsx and jsxs functions, which first check if the type being rendered is a direct component and if so, call it directly.
11
+ *
12
+ * Thanks to the emotion library's jsx-namespace for providing a reference implementation of how to do this while handling both React 18 and React 19's
13
+ * changes to the JSX types.
14
+ */
15
+ type IsPreReact19 = 2 extends Parameters<React.FunctionComponent<any>>['length'] ? true : false;
16
+ /**
17
+ * The following types are intrinsic types for React, but handled in a way that allows them to be correctly resolved in both
18
+ * React 18 and React 19.
19
+ *
20
+ * React 18:
21
+ * - JSX.Element, JSX.ElementClass, etc.
22
+ * - no React.JSX namespace
23
+ *
24
+ * React 19:
25
+ * - React.JSX.Element, React.JSX.ElementClass, etc.
26
+ * - no global JSX namespace
27
+ *
28
+ * In both cases, we want to be able to reference these types in our custom JSX namespace, so we conditionally define them based on whether we're in
29
+ * a pre-React 19 environment or not. The @ts-expect-error comments are used because both can't be valid at the same time so there will always be
30
+ * an error.
31
+ */
32
+ /** @ts-expect-error references types for both react 18 and react 19, only one can be valid at a time */
33
+ type ReactJSXElement = true extends IsPreReact19 ? JSX.Element : React.JSX.Element;
34
+ /** @ts-expect-error references types for both react 18 and react 19, only one can be valid at a time */
35
+ type ReactJSXElementClass = true extends IsPreReact19 ? JSX.ElementClass : React.JSX.ElementClass;
36
+ /** @ts-expect-error references types for both react 18 and react 19, only one can be valid at a time */
37
+ type ReactJSXElementAttributesProperty = true extends IsPreReact19 ? JSX.ElementAttributesProperty : React.JSX.ElementAttributesProperty;
38
+ /** @ts-expect-error references types for both react 18 and react 19, only one can be valid at a time */
39
+ type ReactJSXElementChildrenAttribute = true extends IsPreReact19 ? JSX.ElementChildrenAttribute : React.JSX.ElementChildrenAttribute;
40
+ /** @ts-expect-error references types for both react 18 and react 19, only one can be valid at a time */
41
+ type ReactJSXLibraryManagedAttributes<C, P> = true extends IsPreReact19
42
+ ? JSX.LibraryManagedAttributes<C, P>
43
+ : React.JSX.LibraryManagedAttributes<C, P>;
44
+ /** @ts-expect-error references types for both react 18 and react 19, only one can be valid at a time */
45
+ type ReactJSXIntrinsicAttributes = true extends IsPreReact19 ? JSX.IntrinsicAttributes : React.JSX.IntrinsicAttributes;
46
+ /** @ts-expect-error references types for both react 18 and react 19, only one can be valid at a time */
47
+ type ReactJSXIntrinsicClassAttributes<T> = true extends IsPreReact19
48
+ ? JSX.IntrinsicClassAttributes<T>
49
+ : React.JSX.IntrinsicClassAttributes<T>;
50
+ /** @ts-expect-error references types for both react 18 and react 19, only one can be valid at a time */
51
+ type ReactJSXIntrinsicElements = true extends IsPreReact19 ? JSX.IntrinsicElements : React.JSX.IntrinsicElements;
52
+ type ReactJSXElementType = true extends IsPreReact19 ? string | React.JSXElementConstructor<any> : React.JSX.ElementType;
53
+ export declare namespace FurnJSX {
54
+ type ElementType = ReactJSXElementType;
55
+ interface Element extends ReactJSXElement {}
56
+ interface ElementClass extends ReactJSXElementClass {}
57
+ interface ElementAttributesProperty extends ReactJSXElementAttributesProperty {}
58
+ interface ElementChildrenAttribute extends ReactJSXElementChildrenAttribute {}
59
+ type LibraryManagedAttributes<C, P> = ReactJSXLibraryManagedAttributes<C, P>;
60
+ interface IntrinsicAttributes extends ReactJSXIntrinsicAttributes {}
61
+ interface IntrinsicClassAttributes<T> extends ReactJSXIntrinsicClassAttributes<T> {}
62
+ type IntrinsicElements = ReactJSXIntrinsicElements;
63
+ }
64
+ export {};
65
+ //# sourceMappingURL=jsx-namespace.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"jsx-namespace.d.ts","sourceRoot":"","sources":["../src/jsx-namespace.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,M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,CAAC,CAAC,CAAC;AAE/I,wGAAwG;AACxG,KAAK,yBAAyB,GAAG,IAAI,SAAS,YAAY,GAAG,GAAG,CAAC,iBAAiB,GAAG,KAAK,CAAC,GAAG,CAAC,iBAAiB,CAAC;AAIjH,KAAK,mBAAmB,GAAG,IAAI,SAAS,YAAY,GAAG,MAAM,GAAG,KAAK,CAAC,qBAAqB,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC,GAAG,CAAC,WAAW,CAAC;AAGzH,MAAM,CAAC,OAAO,WAAW,OAAO,CAAC,CAAC;IAChC,KAAY,WAAW,GAAG,mBAAmB,CAAC;IAE9C,UAAiB,OAAQ,SAAQ,eAAe;KAAG;IAEnD,UAAiB,YAAa,SAAQ,oBAAoB;KAAG;IAE7D,UAAiB,yBAA0B,SAAQ,iCAAiC;KAAG;IAEvF,UAAiB,wBAAyB,SAAQ,gCAAgC;KAAG;IACrF,KAAY,wBAAwB,CAAC,CAAC,EAAE,CAAC,IAAI,gCAAgC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IAEpF,UAAiB,mBAAoB,SAAQ,2BAA2B;KAAG;IAE3E,UAAiB,wBAAwB,CAAC,CAAC,CAAE,SAAQ,gCAAgC,CAAC,CAAC,CAAC;KAAG;IAC3F,KAAY,iBAAiB,GAAG,yBAAyB,CAAC;CAC3D"}
@@ -0,0 +1,3 @@
1
+ 'use strict';
2
+ Object.defineProperty(exports, '__esModule', { value: true });
3
+ //# sourceMappingURL=jsx-namespace.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"jsx-namespace.js","sourceRoot":"","sources":["../src/jsx-namespace.ts"],"names":[],"mappings":""}
@@ -1,4 +1,6 @@
1
- import type React from 'react';
2
- export declare function jsx(type: React.ElementType, props: React.PropsWithChildren<unknown>, key?: React.Key): React.ReactElement;
3
- export declare function jsxs(type: React.ElementType, props: React.PropsWithChildren<unknown>, key?: React.Key): React.ReactElement;
4
- //# sourceMappingURL=jsx-runtime.d.ts.map
1
+ import * as ReactJSX from 'react/jsx-runtime';
2
+ export type { FurnJSX as JSX } from './jsx-namespace';
3
+ export declare const jsx: typeof ReactJSX.jsx;
4
+ export declare const jsxs: typeof ReactJSX.jsxs;
5
+ export { Fragment } from 'react/jsx-runtime';
6
+ //# sourceMappingURL=jsx-runtime.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"jsx-runtime.d.ts","sourceRoot":"","sources":["../src/jsx-runtime.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,wBAAgB,GAAG,CAAC,IAAI,EAAE,KAAK,CAAC,WAAW,EAAE,KAAK,EAAE,KAAK,CAAC,iBAAiB,CAAC,OAAO,CAAC,EAAE,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,GAAG,KAAK,CAAC,YAAY,CAEzH;AAED,wBAAgB,IAAI,CAAC,IAAI,EAAE,KAAK,CAAC,WAAW,EAAE,KAAK,EAAE,KAAK,CAAC,iBAAiB,CAAC,OAAO,CAAC,EAAE,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,GAAG,KAAK,CAAC,YAAY,CAE1H"}
1
+ {"version":3,"file":"jsx-runtime.d.ts","sourceRoot":"","sources":["../src/jsx-runtime.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,QAAQ,MAAM,mBAAmB,CAAC;AAE9C,YAAY,EAAE,OAAO,IAAI,GAAG,EAAE,MAAM,iBAAiB,CAAC;AAEtD,eAAO,MAAM,GAAG,EAAE,OAAO,QAAQ,CAAC,GAEjC,CAAC;AAEF,eAAO,MAAM,IAAI,EAAE,OAAO,QAAQ,CAAC,IAElC,CAAC;AAGF,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC"}
@@ -1,37 +1,72 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
1
+ 'use strict';
2
+ var __createBinding =
3
+ (this && this.__createBinding) ||
4
+ (Object.create
5
+ ? function (o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ var desc = Object.getOwnPropertyDescriptor(m, k);
8
+ if (!desc || ('get' in desc ? !m.__esModule : desc.writable || desc.configurable)) {
9
+ desc = {
10
+ enumerable: true,
11
+ get: function () {
12
+ return m[k];
13
+ },
14
+ };
15
+ }
16
+ Object.defineProperty(o, k2, desc);
17
+ }
18
+ : function (o, m, k, k2) {
19
+ if (k2 === undefined) k2 = k;
20
+ o[k2] = m[k];
21
+ });
22
+ var __setModuleDefault =
23
+ (this && this.__setModuleDefault) ||
24
+ (Object.create
25
+ ? function (o, v) {
26
+ Object.defineProperty(o, 'default', { enumerable: true, value: v });
27
+ }
28
+ : function (o, v) {
29
+ o['default'] = v;
30
+ });
31
+ var __importStar =
32
+ (this && this.__importStar) ||
33
+ (function () {
34
+ var ownKeys = function (o) {
35
+ ownKeys =
36
+ Object.getOwnPropertyNames ||
37
+ function (o) {
38
+ var ar = [];
39
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
40
+ return ar;
41
+ };
42
+ return ownKeys(o);
43
+ };
44
+ return function (mod) {
45
+ if (mod && mod.__esModule) return mod;
46
+ var result = {};
47
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== 'default') __createBinding(result, mod, k[i]);
48
+ __setModuleDefault(result, mod);
49
+ return result;
50
+ };
51
+ })();
52
+ Object.defineProperty(exports, '__esModule', { value: true });
53
+ exports.Fragment = exports.jsxs = exports.jsx = void 0;
54
+ const ReactJSX = __importStar(require('react/jsx-runtime'));
55
+ const render_1 = require('./component-patterns/render');
56
+ const jsx = (type, props, key) => {
57
+ return (0, render_1.renderForJsxRuntime)(type, props, key, ReactJSX.jsx);
24
58
  };
25
- Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.jsxs = exports.jsx = void 0;
27
- const ReactJSX = __importStar(require("react/jsx-runtime"));
28
- const render_1 = require("./component-patterns/render");
29
- function jsx(type, props, key) {
30
- return (0, render_1.renderForJsxRuntime)(type, props, key, ReactJSX.jsx);
31
- }
32
59
  exports.jsx = jsx;
33
- function jsxs(type, props, key) {
34
- return (0, render_1.renderForJsxRuntime)(type, props, key, ReactJSX.jsxs);
35
- }
60
+ const jsxs = (type, props, key) => {
61
+ return (0, render_1.renderForJsxRuntime)(type, props, key, ReactJSX.jsxs);
62
+ };
36
63
  exports.jsxs = jsxs;
37
- //# sourceMappingURL=jsx-runtime.js.map
64
+ // Re-export Fragment for <></> syntax
65
+ const jsx_runtime_1 = require('react/jsx-runtime');
66
+ Object.defineProperty(exports, 'Fragment', {
67
+ enumerable: true,
68
+ get: function () {
69
+ return jsx_runtime_1.Fragment;
70
+ },
71
+ });
72
+ //# sourceMappingURL=jsx-runtime.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"jsx-runtime.js","sourceRoot":"","sources":["../src/jsx-runtime.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AACA,4DAA8C;AAC9C,wDAAkE;AAElE,SAAgB,GAAG,CAAC,IAAuB,EAAE,KAAuC,EAAE,GAAe;IACnG,OAAO,IAAA,4BAAmB,EAAC,IAAI,EAAE,KAAK,EAAE,GAAG,EAAE,QAAQ,CAAC,GAAG,CAAC,CAAC;AAC7D,CAAC;AAFD,kBAEC;AAED,SAAgB,IAAI,CAAC,IAAuB,EAAE,KAAuC,EAAE,GAAe;IACpG,OAAO,IAAA,4BAAmB,EAAC,IAAI,EAAE,KAAK,EAAE,GAAG,EAAE,QAAQ,CAAC,IAAI,CAAC,CAAC;AAC9D,CAAC;AAFD,oBAEC"}
1
+ {"version":3,"file":"jsx-runtime.js","sourceRoot":"","sources":["../src/jsx-runtime.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,MAAY,QAAQ,8CAA0B;AAC9C,wDAAkE;AAG3D,MAAM,GAAG,GAAwB,CAAC,IAAI,EAAE,KAAK,EAAE,GAAe,EAAE,EAAE,CAAC;IACxE,OAAO,IAAA,4BAAmB,EAAC,IAAI,EAAE,KAAK,EAAE,GAAG,EAAE,QAAQ,CAAC,GAAG,CAAC,CAAC;AAAA,CAC5D,CAAC;AAFW,QAAA,GAAG,GAAH,GAAG,CAEd;AAEK,MAAM,IAAI,GAAyB,CAAC,IAAI,EAAE,KAAK,EAAE,GAAe,EAAE,EAAE,CAAC;IAC1E,OAAO,IAAA,4BAAmB,EAAC,IAAI,EAAE,KAAK,EAAE,GAAG,EAAE,QAAQ,CAAC,IAAI,CAAC,CAAC;AAAA,CAC7D,CAAC;AAFW,QAAA,IAAI,GAAJ,IAAI,CAEf;AAEF,sCAAsC;AACtC,mDAA6C;AAApC,uGAAA,QAAQ,OAAA"}
@@ -1,18 +1,18 @@
1
1
  /** signature for the object/function key values, used for memoization */
2
2
  export type MemoObjectKey = object | Function;
3
3
  export type CacheEntry<T = unknown> = {
4
- /** stores the cached value if any */
5
- value?: T;
6
- /** entry used for undefined and null values, these both collapse to the same type */
7
- empty?: CacheEntry<T>;
8
- /** entry used for the case where the array of args is null or length 0 */
9
- noargs?: CacheEntry<T>;
10
- /** all remaining non-object types are keyed as strings for lookups */
11
- str?: {
12
- [key: string]: CacheEntry<T>;
13
- };
14
- /** object types are keyed in a weak map on object identity */
15
- obj?: WeakMap<MemoObjectKey, CacheEntry<T>>;
4
+ /** stores the cached value if any */
5
+ value?: T;
6
+ /** entry used for undefined and null values, these both collapse to the same type */
7
+ empty?: CacheEntry<T>;
8
+ /** entry used for the case where the array of args is null or length 0 */
9
+ noargs?: CacheEntry<T>;
10
+ /** all remaining non-object types are keyed as strings for lookups */
11
+ str?: {
12
+ [key: string]: CacheEntry<T>;
13
+ };
14
+ /** object types are keyed in a weak map on object identity */
15
+ obj?: WeakMap<MemoObjectKey, CacheEntry<T>>;
16
16
  };
17
17
  /**
18
18
  * Given a base entry, either traverse or build the cache tree that matches the provided args
@@ -21,4 +21,4 @@ export type CacheEntry<T = unknown> = {
21
21
  * @param args - array of arguments to use to progress deeper into the cache
22
22
  */
23
23
  export declare function getCacheEntry(entry: CacheEntry, args: unknown[]): CacheEntry;
24
- //# sourceMappingURL=getCacheEntry.d.ts.map
24
+ //# sourceMappingURL=getCacheEntry.d.ts.map
@@ -1,6 +1,6 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getCacheEntry = void 0;
1
+ 'use strict';
2
+ Object.defineProperty(exports, '__esModule', { value: true });
3
+ exports.getCacheEntry = getCacheEntry;
4
4
  /**
5
5
  * Step one level deeper in the cache, based on the key value from the current location
6
6
  *
@@ -8,21 +8,21 @@ exports.getCacheEntry = void 0;
8
8
  * @param val - value to use as the key for progressing to the next level of the cache
9
9
  */
10
10
  function jumpToCacheEntry(entry, val) {
11
- if (val === undefined || val === null) {
12
- // undefined or null just routes directly to the empty object. This avoids the issues of string collisions with 'null' or 'undefined'
13
- // when using the string key map, it also avoids creating the WeakMap (since null is technically typoef object), particularly in cases
14
- // where null is just being set on non-object types.
15
- return (entry.empty ??= {});
16
- }
17
- if (typeof val === 'object' || typeof val === 'function') {
18
- // objects and functions will be treated as key values in a WeakMap
19
- const byObj = (entry.obj ??= new WeakMap());
20
- return byObj.get(val) || byObj.set(val, {}).get(val);
21
- }
22
- // otherwise convert everything to a string and store it in the str object (using it as a map)
23
- const key = val + '';
24
- const byString = (entry.str ??= {});
25
- return (byString[key] ??= {});
11
+ if (val === undefined || val === null) {
12
+ // undefined or null just routes directly to the empty object. This avoids the issues of string collisions with 'null' or 'undefined'
13
+ // when using the string key map, it also avoids creating the WeakMap (since null is technically typoef object), particularly in cases
14
+ // where null is just being set on non-object types.
15
+ return (entry.empty ??= {});
16
+ }
17
+ if (typeof val === 'object' || typeof val === 'function') {
18
+ // objects and functions will be treated as key values in a WeakMap
19
+ const byObj = (entry.obj ??= new WeakMap());
20
+ return byObj.get(val) || byObj.set(val, {}).get(val);
21
+ }
22
+ // otherwise convert everything to a string and store it in the str object (using it as a map)
23
+ const key = val + '';
24
+ const byString = (entry.str ??= {});
25
+ return (byString[key] ??= {});
26
26
  }
27
27
  /**
28
28
  * Given a base entry, either traverse or build the cache tree that matches the provided args
@@ -31,12 +31,9 @@ function jumpToCacheEntry(entry, val) {
31
31
  * @param args - array of arguments to use to progress deeper into the cache
32
32
  */
33
33
  function getCacheEntry(entry, args) {
34
- // in the case where the args array exists and is > 0 length:
35
- // - walk the cache from entry, like a linked list, jumping to the next entry by key, building it up as you go
36
- // - otherwise if there are no args just use the noargs branch
37
- return args && args.length > 0
38
- ? args.reduce((previous, arg) => jumpToCacheEntry(previous, arg), entry)
39
- : (entry.noargs ??= {});
34
+ // in the case where the args array exists and is > 0 length:
35
+ // - walk the cache from entry, like a linked list, jumping to the next entry by key, building it up as you go
36
+ // - otherwise if there are no args just use the noargs branch
37
+ return args && args.length > 0 ? args.reduce((previous, arg) => jumpToCacheEntry(previous, arg), entry) : (entry.noargs ??= {});
40
38
  }
41
- exports.getCacheEntry = getCacheEntry;
42
- //# sourceMappingURL=getCacheEntry.js.map
39
+ //# sourceMappingURL=getCacheEntry.js.map
@@ -1 +1 @@
1
- {"version":3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