Commit b4820dc
committed
feat(compartment-mapper): expose experimental _redundantPreloadHook on captureFromMap
This adds a new hook option, `_redundantPreloadHook`, which is fired if and only if:
1. A canonical name w/ optional entry is present in the `_preload` array, _and_
2. The corresponding `Compartment` has already had its module sources loaded indirectly via loading the entry `Compartment`.
This better enables the caller to report the information to the end-user.
## Fixes
This change also fixes two bugs:
- The presence of `ModuleSource`s for a given `Compartment` does not imply _all_ preloaded modules have been loaded, as `_preload` may contain multiple entries for the same canonical name. It now checks individual entries.
- The type of `_preload` was incorrect; it demanded either an `Array<string>` _or_ an `Array<{name: string, entry: string}>`, when it should be possible to mix-and-match `string` and `{name: string, entry: string}` in the same array.
## Notes
- We could remove the `log()` call in `capture-lite.js`'s L187-L189 in lieu of the hook.
- Interested in any suggestions to avoid the assumption in `capture-lite.js`'s L181-L191; module resolution seems like a non-starter at this point, but maybe the mapping from `.` to a relative path exists in scope here already?1 parent 6b84fb2 commit b4820dc
File tree
7 files changed
+166
-9
lines changed- .changeset
- packages/compartment-mapper
- src
- types
- test
- fixtures-digest/node_modules/app2
7 files changed
+166
-9
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
112 | 112 | | |
113 | 113 | | |
114 | 114 | | |
115 | | - | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
116 | 121 | | |
117 | 122 | | |
118 | 123 | | |
| |||
173 | 178 | | |
174 | 179 | | |
175 | 180 | | |
176 | | - | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
177 | 194 | | |
178 | | - | |
| 195 | + | |
179 | 196 | | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
180 | 204 | | |
181 | 205 | | |
182 | 206 | | |
| |||
274 | 298 | | |
275 | 299 | | |
276 | 300 | | |
| 301 | + | |
277 | 302 | | |
278 | 303 | | |
279 | 304 | | |
| |||
295 | 320 | | |
296 | 321 | | |
297 | 322 | | |
| 323 | + | |
298 | 324 | | |
299 | 325 | | |
300 | 326 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
141 | 141 | | |
142 | 142 | | |
143 | 143 | | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
144 | 154 | | |
145 | 155 | | |
146 | 156 | | |
| |||
291 | 301 | | |
292 | 302 | | |
293 | 303 | | |
294 | | - | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
295 | 311 | | |
296 | 312 | | |
297 | 313 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
| 44 | + | |
44 | 45 | | |
45 | 46 | | |
46 | 47 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| 19 | + | |
| 20 | + | |
19 | 21 | | |
20 | 22 | | |
21 | 23 | | |
22 | | - | |
23 | 24 | | |
24 | 25 | | |
25 | 26 | | |
| |||
66 | 67 | | |
67 | 68 | | |
68 | 69 | | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
69 | 153 | | |
70 | | - | |
71 | 154 | | |
72 | 155 | | |
73 | 156 | | |
| |||
83 | 166 | | |
84 | 167 | | |
85 | 168 | | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
86 | 172 | | |
87 | 173 | | |
88 | 174 | | |
89 | 175 | | |
90 | 176 | | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
91 | 180 | | |
92 | 181 | | |
93 | 182 | | |
| |||
96 | 185 | | |
97 | 186 | | |
98 | 187 | | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
99 | 193 | | |
100 | 194 | | |
101 | 195 | | |
102 | | - | |
103 | 196 | | |
104 | 197 | | |
105 | 198 | | |
| |||
141 | 234 | | |
142 | 235 | | |
143 | 236 | | |
144 | | - | |
145 | 237 | | |
146 | 238 | | |
147 | 239 | | |
| |||
183 | 275 | | |
184 | 276 | | |
185 | 277 | | |
186 | | - | |
187 | 278 | | |
188 | 279 | | |
189 | 280 | | |
| |||
Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 12 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
0 commit comments