@vxrn/compiler 1.25.3 → 1.25.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +3 -3
- package/src/index.ts +5 -0
- package/src/transformBabel.test.ts +44 -2
- package/src/transformBabel.ts +2 -7
- package/src/types.ts +1 -0
- package/types/types.d.ts +1 -0
- package/dist/cjs/cache.cjs +0 -132
- package/dist/cjs/configure.cjs +0 -37
- package/dist/cjs/constants.cjs +0 -77
- package/dist/cjs/index.cjs +0 -425
- package/dist/cjs/refresh-runtime.cjs +0 -452
- package/dist/cjs/transformBabel.cjs +0 -271
- package/dist/cjs/transformBabel.test.cjs +0 -19
- package/dist/cjs/transformSWC.cjs +0 -318
- package/dist/cjs/types.cjs +0 -18
- package/dist/esm/cache.mjs +0 -104
- package/dist/esm/cache.mjs.map +0 -1
- package/dist/esm/configure.mjs +0 -11
- package/dist/esm/configure.mjs.map +0 -1
- package/dist/esm/constants.mjs +0 -48
- package/dist/esm/constants.mjs.map +0 -1
- package/dist/esm/index.js +0 -398
- package/dist/esm/index.js.map +0 -1
- package/dist/esm/index.mjs +0 -398
- package/dist/esm/index.mjs.map +0 -1
- package/dist/esm/refresh-runtime.mjs +0 -421
- package/dist/esm/refresh-runtime.mjs.map +0 -1
- package/dist/esm/transformBabel.mjs +0 -233
- package/dist/esm/transformBabel.mjs.map +0 -1
- package/dist/esm/transformBabel.test.mjs +0 -20
- package/dist/esm/transformBabel.test.mjs.map +0 -1
- package/dist/esm/transformSWC.mjs +0 -292
- package/dist/esm/transformSWC.mjs.map +0 -1
- package/dist/esm/types.mjs +0 -2
- package/dist/esm/types.mjs.map +0 -1
- package/types/cache.d.ts.map +0 -1
- package/types/configure.d.ts.map +0 -1
- package/types/constants.d.ts.map +0 -1
- package/types/index.d.ts.map +0 -1
- package/types/transformBabel.d.ts.map +0 -1
- package/types/transformBabel.test.d.ts.map +0 -1
- package/types/transformSWC.d.ts.map +0 -1
- package/types/types.d.ts.map +0 -1
|
@@ -1,421 +0,0 @@
|
|
|
1
|
-
/*! Copyright (c) Meta Platforms, Inc. and affiliates. **/
|
|
2
|
-
const REACT_FORWARD_REF_TYPE = /* @__PURE__ */Symbol.for("react.forward_ref");
|
|
3
|
-
const REACT_MEMO_TYPE = /* @__PURE__ */Symbol.for("react.memo");
|
|
4
|
-
let allFamiliesByID = /* @__PURE__ */new Map();
|
|
5
|
-
let allFamiliesByType = /* @__PURE__ */new WeakMap();
|
|
6
|
-
let allSignaturesByType = /* @__PURE__ */new WeakMap();
|
|
7
|
-
const updatedFamiliesByType = /* @__PURE__ */new WeakMap();
|
|
8
|
-
let pendingUpdates = [];
|
|
9
|
-
const helpersByRendererID = /* @__PURE__ */new Map();
|
|
10
|
-
const helpersByRoot = /* @__PURE__ */new Map();
|
|
11
|
-
const mountedRoots = /* @__PURE__ */new Set();
|
|
12
|
-
const failedRoots = /* @__PURE__ */new Set();
|
|
13
|
-
let rootElements = /* @__PURE__ */new WeakMap();
|
|
14
|
-
let isPerformingRefresh = false;
|
|
15
|
-
function computeFullKey(signature) {
|
|
16
|
-
if (signature.fullKey !== null) {
|
|
17
|
-
return signature.fullKey;
|
|
18
|
-
}
|
|
19
|
-
let fullKey = signature.ownKey;
|
|
20
|
-
let hooks2;
|
|
21
|
-
try {
|
|
22
|
-
hooks2 = signature.getCustomHooks();
|
|
23
|
-
} catch (err) {
|
|
24
|
-
signature.forceReset = true;
|
|
25
|
-
signature.fullKey = fullKey;
|
|
26
|
-
return fullKey;
|
|
27
|
-
}
|
|
28
|
-
for (let i = 0; i < hooks2.length; i++) {
|
|
29
|
-
const hook = hooks2[i];
|
|
30
|
-
if (typeof hook !== "function") {
|
|
31
|
-
signature.forceReset = true;
|
|
32
|
-
signature.fullKey = fullKey;
|
|
33
|
-
return fullKey;
|
|
34
|
-
}
|
|
35
|
-
const nestedHookSignature = allSignaturesByType.get(hook);
|
|
36
|
-
if (nestedHookSignature === void 0) {
|
|
37
|
-
continue;
|
|
38
|
-
}
|
|
39
|
-
const nestedHookKey = computeFullKey(nestedHookSignature);
|
|
40
|
-
if (nestedHookSignature.forceReset) {
|
|
41
|
-
signature.forceReset = true;
|
|
42
|
-
}
|
|
43
|
-
fullKey += "\n---\n" + nestedHookKey;
|
|
44
|
-
}
|
|
45
|
-
signature.fullKey = fullKey;
|
|
46
|
-
return fullKey;
|
|
47
|
-
}
|
|
48
|
-
function haveEqualSignatures(prevType, nextType) {
|
|
49
|
-
const prevSignature = allSignaturesByType.get(prevType);
|
|
50
|
-
const nextSignature = allSignaturesByType.get(nextType);
|
|
51
|
-
if (prevSignature === void 0 && nextSignature === void 0) {
|
|
52
|
-
return true;
|
|
53
|
-
}
|
|
54
|
-
if (prevSignature === void 0 || nextSignature === void 0) {
|
|
55
|
-
return false;
|
|
56
|
-
}
|
|
57
|
-
if (computeFullKey(prevSignature) !== computeFullKey(nextSignature)) {
|
|
58
|
-
return false;
|
|
59
|
-
}
|
|
60
|
-
if (nextSignature.forceReset) {
|
|
61
|
-
return false;
|
|
62
|
-
}
|
|
63
|
-
return true;
|
|
64
|
-
}
|
|
65
|
-
function isReactClass(type) {
|
|
66
|
-
return type.prototype && type.prototype.isReactComponent;
|
|
67
|
-
}
|
|
68
|
-
function canPreserveStateBetween(prevType, nextType) {
|
|
69
|
-
if (isReactClass(prevType) || isReactClass(nextType)) {
|
|
70
|
-
return false;
|
|
71
|
-
}
|
|
72
|
-
if (haveEqualSignatures(prevType, nextType)) {
|
|
73
|
-
return true;
|
|
74
|
-
}
|
|
75
|
-
return false;
|
|
76
|
-
}
|
|
77
|
-
function resolveFamily(type) {
|
|
78
|
-
return updatedFamiliesByType.get(type);
|
|
79
|
-
}
|
|
80
|
-
function getProperty(object, property) {
|
|
81
|
-
try {
|
|
82
|
-
return object[property];
|
|
83
|
-
} catch (err) {
|
|
84
|
-
return void 0;
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
function performReactRefresh() {
|
|
88
|
-
if (pendingUpdates.length === 0) {
|
|
89
|
-
return null;
|
|
90
|
-
}
|
|
91
|
-
if (isPerformingRefresh) {
|
|
92
|
-
return null;
|
|
93
|
-
}
|
|
94
|
-
isPerformingRefresh = true;
|
|
95
|
-
try {
|
|
96
|
-
const staleFamilies = /* @__PURE__ */new Set();
|
|
97
|
-
const updatedFamilies = /* @__PURE__ */new Set();
|
|
98
|
-
const updates = pendingUpdates;
|
|
99
|
-
pendingUpdates = [];
|
|
100
|
-
updates.forEach(([family, nextType]) => {
|
|
101
|
-
const prevType = family.current;
|
|
102
|
-
updatedFamiliesByType.set(prevType, family);
|
|
103
|
-
updatedFamiliesByType.set(nextType, family);
|
|
104
|
-
family.current = nextType;
|
|
105
|
-
if (canPreserveStateBetween(prevType, nextType)) {
|
|
106
|
-
updatedFamilies.add(family);
|
|
107
|
-
} else {
|
|
108
|
-
staleFamilies.add(family);
|
|
109
|
-
}
|
|
110
|
-
});
|
|
111
|
-
const update = {
|
|
112
|
-
updatedFamilies,
|
|
113
|
-
// Families that will re-render preserving state
|
|
114
|
-
staleFamilies
|
|
115
|
-
// Families that will be remounted
|
|
116
|
-
};
|
|
117
|
-
helpersByRendererID.forEach(helpers => {
|
|
118
|
-
helpers.setRefreshHandler(resolveFamily);
|
|
119
|
-
});
|
|
120
|
-
let didError = false;
|
|
121
|
-
let firstError = null;
|
|
122
|
-
const failedRootsSnapshot = new Set(failedRoots);
|
|
123
|
-
const mountedRootsSnapshot = new Set(mountedRoots);
|
|
124
|
-
const helpersByRootSnapshot = new Map(helpersByRoot);
|
|
125
|
-
failedRootsSnapshot.forEach(root => {
|
|
126
|
-
const helpers = helpersByRootSnapshot.get(root);
|
|
127
|
-
if (helpers === void 0) {
|
|
128
|
-
throw new Error("Could not find helpers for a root. This is a bug in React Refresh.");
|
|
129
|
-
}
|
|
130
|
-
if (!failedRoots.has(root)) {}
|
|
131
|
-
if (rootElements === null) {
|
|
132
|
-
return;
|
|
133
|
-
}
|
|
134
|
-
if (!rootElements.has(root)) {
|
|
135
|
-
return;
|
|
136
|
-
}
|
|
137
|
-
const element = rootElements.get(root);
|
|
138
|
-
try {
|
|
139
|
-
helpers.scheduleRoot(root, element);
|
|
140
|
-
} catch (err) {
|
|
141
|
-
if (!didError) {
|
|
142
|
-
didError = true;
|
|
143
|
-
firstError = err;
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
});
|
|
147
|
-
mountedRootsSnapshot.forEach(root => {
|
|
148
|
-
const helpers = helpersByRootSnapshot.get(root);
|
|
149
|
-
if (helpers === void 0) {
|
|
150
|
-
throw new Error("Could not find helpers for a root. This is a bug in React Refresh.");
|
|
151
|
-
}
|
|
152
|
-
if (!mountedRoots.has(root)) {}
|
|
153
|
-
try {
|
|
154
|
-
helpers.scheduleRefresh(root, update);
|
|
155
|
-
} catch (err) {
|
|
156
|
-
if (!didError) {
|
|
157
|
-
didError = true;
|
|
158
|
-
firstError = err;
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
});
|
|
162
|
-
if (didError) {
|
|
163
|
-
throw firstError;
|
|
164
|
-
}
|
|
165
|
-
return update;
|
|
166
|
-
} finally {
|
|
167
|
-
isPerformingRefresh = false;
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
function register(type, id) {
|
|
171
|
-
if (type === null) {
|
|
172
|
-
return;
|
|
173
|
-
}
|
|
174
|
-
if (typeof type !== "function" && typeof type !== "object") {
|
|
175
|
-
return;
|
|
176
|
-
}
|
|
177
|
-
if (allFamiliesByType.has(type)) {
|
|
178
|
-
return;
|
|
179
|
-
}
|
|
180
|
-
let family = allFamiliesByID.get(id);
|
|
181
|
-
if (family === void 0) {
|
|
182
|
-
family = {
|
|
183
|
-
current: type
|
|
184
|
-
};
|
|
185
|
-
allFamiliesByID.set(id, family);
|
|
186
|
-
} else {
|
|
187
|
-
pendingUpdates.push([family, type]);
|
|
188
|
-
}
|
|
189
|
-
allFamiliesByType.set(type, family);
|
|
190
|
-
if (typeof type === "object" && type !== null) {
|
|
191
|
-
switch (getProperty(type, "$$typeof")) {
|
|
192
|
-
case REACT_FORWARD_REF_TYPE:
|
|
193
|
-
register(type.render, id + "$render");
|
|
194
|
-
break;
|
|
195
|
-
case REACT_MEMO_TYPE:
|
|
196
|
-
register(type.type, id + "$type");
|
|
197
|
-
break;
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
function setSignature(type, key, forceReset, getCustomHooks) {
|
|
202
|
-
if (!allSignaturesByType.has(type)) {
|
|
203
|
-
allSignaturesByType.set(type, {
|
|
204
|
-
forceReset,
|
|
205
|
-
ownKey: key,
|
|
206
|
-
fullKey: null,
|
|
207
|
-
getCustomHooks: getCustomHooks || (() => [])
|
|
208
|
-
});
|
|
209
|
-
}
|
|
210
|
-
if (typeof type === "object" && type !== null) {
|
|
211
|
-
switch (getProperty(type, "$$typeof")) {
|
|
212
|
-
case REACT_FORWARD_REF_TYPE:
|
|
213
|
-
setSignature(type.render, key, forceReset, getCustomHooks);
|
|
214
|
-
break;
|
|
215
|
-
case REACT_MEMO_TYPE:
|
|
216
|
-
setSignature(type.type, key, forceReset, getCustomHooks);
|
|
217
|
-
break;
|
|
218
|
-
}
|
|
219
|
-
}
|
|
220
|
-
}
|
|
221
|
-
function collectCustomHooksForSignature(type) {
|
|
222
|
-
const signature = allSignaturesByType.get(type);
|
|
223
|
-
if (signature !== void 0) {
|
|
224
|
-
computeFullKey(signature);
|
|
225
|
-
}
|
|
226
|
-
}
|
|
227
|
-
function injectIntoGlobalHook(globalObject) {
|
|
228
|
-
let hook = globalObject.__REACT_DEVTOOLS_GLOBAL_HOOK__;
|
|
229
|
-
if (hook === void 0) {
|
|
230
|
-
let nextID = 0;
|
|
231
|
-
globalObject.__REACT_DEVTOOLS_GLOBAL_HOOK__ = hook = {
|
|
232
|
-
renderers: /* @__PURE__ */new Map(),
|
|
233
|
-
supportsFiber: true,
|
|
234
|
-
inject: injected => nextID++,
|
|
235
|
-
onScheduleFiberRoot: (id, root, children) => {},
|
|
236
|
-
onCommitFiberRoot: (id, root, maybePriorityLevel, didError) => {},
|
|
237
|
-
onCommitFiberUnmount() {}
|
|
238
|
-
};
|
|
239
|
-
}
|
|
240
|
-
if (hook.isDisabled) {
|
|
241
|
-
console["warn"]("Something has shimmed the React DevTools global hook (__REACT_DEVTOOLS_GLOBAL_HOOK__). Fast Refresh is not compatible with this shim and will be disabled.");
|
|
242
|
-
return;
|
|
243
|
-
}
|
|
244
|
-
const oldInject = hook.inject;
|
|
245
|
-
hook.inject = function (injected) {
|
|
246
|
-
const id = oldInject.apply(this, arguments);
|
|
247
|
-
if (typeof injected.scheduleRefresh === "function" && typeof injected.setRefreshHandler === "function") {
|
|
248
|
-
helpersByRendererID.set(id, injected);
|
|
249
|
-
}
|
|
250
|
-
return id;
|
|
251
|
-
};
|
|
252
|
-
hook.renderers.forEach((injected, id) => {
|
|
253
|
-
if (typeof injected.scheduleRefresh === "function" && typeof injected.setRefreshHandler === "function") {
|
|
254
|
-
helpersByRendererID.set(id, injected);
|
|
255
|
-
}
|
|
256
|
-
});
|
|
257
|
-
const oldOnCommitFiberRoot = hook.onCommitFiberRoot;
|
|
258
|
-
const oldOnScheduleFiberRoot = hook.onScheduleFiberRoot || (() => {});
|
|
259
|
-
hook.onScheduleFiberRoot = function (id, root, children) {
|
|
260
|
-
if (!isPerformingRefresh) {
|
|
261
|
-
failedRoots.delete(root);
|
|
262
|
-
if (rootElements !== null) {
|
|
263
|
-
rootElements.set(root, children);
|
|
264
|
-
}
|
|
265
|
-
}
|
|
266
|
-
return oldOnScheduleFiberRoot.apply(this, arguments);
|
|
267
|
-
};
|
|
268
|
-
hook.onCommitFiberRoot = function (id, root, maybePriorityLevel, didError) {
|
|
269
|
-
const helpers = helpersByRendererID.get(id);
|
|
270
|
-
if (helpers !== void 0) {
|
|
271
|
-
helpersByRoot.set(root, helpers);
|
|
272
|
-
const current = root.current;
|
|
273
|
-
const alternate = current.alternate;
|
|
274
|
-
if (alternate !== null) {
|
|
275
|
-
const wasMounted = alternate.memoizedState != null && alternate.memoizedState.element != null && mountedRoots.has(root);
|
|
276
|
-
const isMounted = current.memoizedState != null && current.memoizedState.element != null;
|
|
277
|
-
if (!wasMounted && isMounted) {
|
|
278
|
-
mountedRoots.add(root);
|
|
279
|
-
failedRoots.delete(root);
|
|
280
|
-
} else if (wasMounted && isMounted) {} else if (wasMounted && !isMounted) {
|
|
281
|
-
mountedRoots.delete(root);
|
|
282
|
-
if (didError) {
|
|
283
|
-
failedRoots.add(root);
|
|
284
|
-
} else {
|
|
285
|
-
helpersByRoot.delete(root);
|
|
286
|
-
}
|
|
287
|
-
} else if (!wasMounted && !isMounted) {
|
|
288
|
-
if (didError) {
|
|
289
|
-
failedRoots.add(root);
|
|
290
|
-
}
|
|
291
|
-
}
|
|
292
|
-
} else {
|
|
293
|
-
mountedRoots.add(root);
|
|
294
|
-
}
|
|
295
|
-
}
|
|
296
|
-
return oldOnCommitFiberRoot.apply(this, arguments);
|
|
297
|
-
};
|
|
298
|
-
}
|
|
299
|
-
function createSignatureFunctionForTransform() {
|
|
300
|
-
let savedType;
|
|
301
|
-
let hasCustomHooks;
|
|
302
|
-
let didCollectHooks = false;
|
|
303
|
-
return (type, key, forceReset, getCustomHooks) => {
|
|
304
|
-
if (typeof key === "string") {
|
|
305
|
-
if (!savedType) {
|
|
306
|
-
savedType = type;
|
|
307
|
-
hasCustomHooks = typeof getCustomHooks === "function";
|
|
308
|
-
}
|
|
309
|
-
if (type != null && (typeof type === "function" || typeof type === "object")) {
|
|
310
|
-
setSignature(type, key, forceReset, getCustomHooks);
|
|
311
|
-
}
|
|
312
|
-
return type;
|
|
313
|
-
}
|
|
314
|
-
if (!didCollectHooks && hasCustomHooks) {
|
|
315
|
-
didCollectHooks = true;
|
|
316
|
-
collectCustomHooksForSignature(savedType);
|
|
317
|
-
}
|
|
318
|
-
};
|
|
319
|
-
}
|
|
320
|
-
function isLikelyComponentType(type) {
|
|
321
|
-
switch (typeof type) {
|
|
322
|
-
case "function":
|
|
323
|
-
{
|
|
324
|
-
if (type.prototype != null) {
|
|
325
|
-
if (type.prototype.isReactComponent) {
|
|
326
|
-
return true;
|
|
327
|
-
}
|
|
328
|
-
const ownNames = Object.getOwnPropertyNames(type.prototype);
|
|
329
|
-
if (ownNames.length > 1 || ownNames[0] !== "constructor") {
|
|
330
|
-
return false;
|
|
331
|
-
}
|
|
332
|
-
if (type.prototype.__proto__ !== Object.prototype) {
|
|
333
|
-
return false;
|
|
334
|
-
}
|
|
335
|
-
}
|
|
336
|
-
const name = type.name || type.displayName;
|
|
337
|
-
return typeof name === "string" && /^[A-Z]/.test(name);
|
|
338
|
-
}
|
|
339
|
-
case "object":
|
|
340
|
-
{
|
|
341
|
-
if (type != null) {
|
|
342
|
-
switch (getProperty(type, "$$typeof")) {
|
|
343
|
-
case REACT_FORWARD_REF_TYPE:
|
|
344
|
-
case REACT_MEMO_TYPE:
|
|
345
|
-
return true;
|
|
346
|
-
default:
|
|
347
|
-
return false;
|
|
348
|
-
}
|
|
349
|
-
}
|
|
350
|
-
return false;
|
|
351
|
-
}
|
|
352
|
-
default:
|
|
353
|
-
{
|
|
354
|
-
return false;
|
|
355
|
-
}
|
|
356
|
-
}
|
|
357
|
-
}
|
|
358
|
-
function getRefreshReg(filename) {
|
|
359
|
-
return (type, id) => register(type, filename + " " + id);
|
|
360
|
-
}
|
|
361
|
-
function registerExportsForReactRefresh(filename, moduleExports) {
|
|
362
|
-
for (const key in moduleExports) {
|
|
363
|
-
if (key === "__esModule") continue;
|
|
364
|
-
const exportValue = moduleExports[key];
|
|
365
|
-
if (isLikelyComponentType(exportValue)) {
|
|
366
|
-
register(exportValue, filename + " export " + key);
|
|
367
|
-
}
|
|
368
|
-
}
|
|
369
|
-
}
|
|
370
|
-
function debounce(fn, delay) {
|
|
371
|
-
let handle;
|
|
372
|
-
return () => {
|
|
373
|
-
clearTimeout(handle);
|
|
374
|
-
handle = setTimeout(fn, delay);
|
|
375
|
-
};
|
|
376
|
-
}
|
|
377
|
-
const hooks = [];
|
|
378
|
-
window.__registerBeforePerformReactRefresh = cb => {
|
|
379
|
-
hooks.push(cb);
|
|
380
|
-
};
|
|
381
|
-
const enqueueUpdate = debounce(async () => {
|
|
382
|
-
if (hooks.length) await Promise.all(hooks.map(cb => cb()));
|
|
383
|
-
performReactRefresh();
|
|
384
|
-
}, 16);
|
|
385
|
-
function validateRefreshBoundaryAndEnqueueUpdate(id, prevExports, nextExports) {
|
|
386
|
-
const ignoredExports = ["sitemap", "loader", "generateStaticParams"];
|
|
387
|
-
if (predicateOnExport(ignoredExports, prevExports, key => key in nextExports) !== true) {
|
|
388
|
-
return "Could not Fast Refresh (export removed)";
|
|
389
|
-
}
|
|
390
|
-
if (predicateOnExport(ignoredExports, nextExports, key => key in prevExports) !== true) {
|
|
391
|
-
return "Could not Fast Refresh (new export)";
|
|
392
|
-
}
|
|
393
|
-
let hasExports = false;
|
|
394
|
-
const allExportsAreComponentsOrUnchanged = predicateOnExport(ignoredExports, nextExports, (key, value) => {
|
|
395
|
-
hasExports = true;
|
|
396
|
-
if (isLikelyComponentType(value)) return true;
|
|
397
|
-
return prevExports[key] === nextExports[key];
|
|
398
|
-
});
|
|
399
|
-
if (hasExports && allExportsAreComponentsOrUnchanged === true) {
|
|
400
|
-
enqueueUpdate();
|
|
401
|
-
} else {
|
|
402
|
-
return `Could not Fast Refresh ("${allExportsAreComponentsOrUnchanged}" export is incompatible). Learn more at https://github.com/vitejs/vite-plugin-react-swc#consistent-components-exports`;
|
|
403
|
-
}
|
|
404
|
-
}
|
|
405
|
-
function predicateOnExport(ignoredExports, moduleExports, predicate) {
|
|
406
|
-
for (const key in moduleExports) {
|
|
407
|
-
if (key === "__esModule") continue;
|
|
408
|
-
if (ignoredExports.includes(key)) continue;
|
|
409
|
-
const desc = Object.getOwnPropertyDescriptor(moduleExports, key);
|
|
410
|
-
if (desc && desc.get) return key;
|
|
411
|
-
if (!predicate(key, moduleExports[key])) return key;
|
|
412
|
-
}
|
|
413
|
-
return true;
|
|
414
|
-
}
|
|
415
|
-
const __hmr_import = module => import(/* @vite-ignore */
|
|
416
|
-
module);
|
|
417
|
-
var refresh_runtime_default = {
|
|
418
|
-
injectIntoGlobalHook
|
|
419
|
-
};
|
|
420
|
-
export { __hmr_import, createSignatureFunctionForTransform, refresh_runtime_default as default, getRefreshReg, injectIntoGlobalHook, registerExportsForReactRefresh, validateRefreshBoundaryAndEnqueueUpdate };
|
|
421
|
-
//# sourceMappingURL=refresh-runtime.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["REACT_FORWARD_REF_TYPE","Symbol","for","REACT_MEMO_TYPE","allFamiliesByID","Map","allFamiliesByType","WeakMap","allSignaturesByType","updatedFamiliesByType","pendingUpdates","helpersByRendererID","helpersByRoot","mountedRoots","Set","failedRoots","rootElements","isPerformingRefresh","computeFullKey","signature","fullKey","ownKey","hooks","getCustomHooks","err","forceReset","i","length","hook","nestedHookSignature","get","nestedHookKey","haveEqualSignatures","prevType","nextType","prevSignature","nextSignature","isReactClass","type","prototype","isReactComponent","canPreserveStateBetween","resolveFamily","getProperty","object","property","performReactRefresh","staleFamilies","updatedFamilies","updates","forEach","family","current","set","add","update","helpers","setRefreshHandler","didError","firstError","failedRootsSnapshot","mountedRootsSnapshot","helpersByRootSnapshot","root","Error","has","element","scheduleRoot","scheduleRefresh","register","id","push","render","setSignature","key","collectCustomHooksForSignature","injectIntoGlobalHook","globalObject","__REACT_DEVTOOLS_GLOBAL_HOOK__","nextID","renderers","supportsFiber","inject","injected","onScheduleFiberRoot","children","onCommitFiberRoot","maybePriorityLevel","onCommitFiberUnmount","isDisabled","console","oldInject","apply","arguments","oldOnCommitFiberRoot","oldOnScheduleFiberRoot","delete","alternate","wasMounted","memoizedState","isMounted","createSignatureFunctionForTransform","savedType","hasCustomHooks","didCollectHooks","isLikelyComponentType","ownNames","Object","getOwnPropertyNames","__proto__","name","displayName","test","getRefreshReg","filename","registerExportsForReactRefresh","moduleExports","exportValue","debounce","fn","delay","handle","clearTimeout","setTimeout","window","__registerBeforePerformReactRefresh","cb","enqueueUpdate","Promise","all","map","validateRefreshBoundaryAndEnqueueUpdate","prevExports","nextExports","ignoredExports","predicateOnExport","hasExports","allExportsAreComponentsOrUnchanged","value","predicate","includes","desc","getOwnPropertyDescriptor","__hmr_import","module","refresh_runtime_default"],"sources":["../../src/refresh-runtime.js"],"sourcesContent":[null],"mappings":"AAAA;AAOA,MAAMA,sBAAA,GAAyB,eAAAC,MAAA,CAAOC,GAAA,CAAI,mBAAmB;AAC7D,MAAMC,eAAA,GAAkB,eAAAF,MAAA,CAAOC,GAAA,CAAI,YAAY;AAI/C,IAAIE,eAAA,GAAkB,mBAAIC,GAAA,CAAI;AAC9B,IAAIC,iBAAA,GAAoB,mBAAIC,OAAA,CAAQ;AACpC,IAAIC,mBAAA,GAAsB,mBAAID,OAAA,CAAQ;AAItC,MAAME,qBAAA,GAAwB,mBAAIF,OAAA,CAAQ;AAI1C,IAAIG,cAAA,GAAiB,EAAC;AAGtB,MAAMC,mBAAA,GAAsB,mBAAIN,GAAA,CAAI;AAEpC,MAAMO,aAAA,GAAgB,mBAAIP,GAAA,CAAI;AAG9B,MAAMQ,YAAA,GAAe,mBAAIC,GAAA,CAAI;AAE7B,MAAMC,WAAA,GAAc,mBAAID,GAAA,CAAI;AAK5B,IAAIE,YAAA,GAAe,mBAAIT,OAAA,CAAQ;AAC/B,IAAIU,mBAAA,GAAsB;AAE1B,SAASC,eAAeC,SAAA,EAAW;EACjC,IAAIA,SAAA,CAAUC,OAAA,KAAY,MAAM;IAC9B,OAAOD,SAAA,CAAUC,OAAA;EACnB;EAEA,IAAIA,OAAA,GAAUD,SAAA,CAAUE,MAAA;EACxB,IAAIC,MAAA;EACJ,IAAI;IACFA,MAAA,GAAQH,SAAA,CAAUI,cAAA,CAAe;EACnC,SAASC,GAAA,EAAK;IAIZL,SAAA,CAAUM,UAAA,GAAa;IACvBN,SAAA,CAAUC,OAAA,G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C,uBAAA,GAAQ;EAAErE;AAAqB","ignoreList":[]}
|
|
@@ -1,233 +0,0 @@
|
|
|
1
|
-
import { extname, relative } from "node:path";
|
|
2
|
-
import babel from "@babel/core";
|
|
3
|
-
import { resolvePath } from "@vxrn/utils";
|
|
4
|
-
import hermesParserPlugin from "babel-plugin-syntax-hermes-parser";
|
|
5
|
-
import { normalizePath } from "vite";
|
|
6
|
-
import { configuration } from "./configure.mjs";
|
|
7
|
-
import { asyncGeneratorRegex, debug } from "./constants.mjs";
|
|
8
|
-
function getBabelOptions(props) {
|
|
9
|
-
props = {
|
|
10
|
-
...props,
|
|
11
|
-
id: normalizePath(props.id.split("?")[0])
|
|
12
|
-
};
|
|
13
|
-
if (props.userSetting === "babel") {
|
|
14
|
-
return getOptions(props, true);
|
|
15
|
-
}
|
|
16
|
-
if (typeof props.userSetting === "undefined" || typeof props.userSetting === "object" && props.userSetting.transform === "babel") {
|
|
17
|
-
if (props.userSetting?.excludeDefaultPlugins) {
|
|
18
|
-
return props.userSetting;
|
|
19
|
-
}
|
|
20
|
-
return getOptions(props);
|
|
21
|
-
}
|
|
22
|
-
return null;
|
|
23
|
-
}
|
|
24
|
-
const getOptions = (props, force = false) => {
|
|
25
|
-
let plugins = [];
|
|
26
|
-
if (force || shouldBabelGenerators(props)) {
|
|
27
|
-
plugins = getBasePlugins(props);
|
|
28
|
-
}
|
|
29
|
-
const enableNativewind = configuration.enableNativewind && (props.environment === "ios" || props.environment === "android") &&
|
|
30
|
-
// if reanimated gets wrapped in transform it causes circular dep issues
|
|
31
|
-
!/node_modules/.test(props.id) &&
|
|
32
|
-
// only needed for createElement calls, so be a bit conservative
|
|
33
|
-
props.code.includes("createElement");
|
|
34
|
-
if (enableNativewind) {
|
|
35
|
-
if (!props.id.includes("node_modules")) {
|
|
36
|
-
plugins.push(resolvePath("react-native-css-interop/dist/babel-plugin.js"));
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
if (enableNativewind || shouldBabelReanimated(props)) {
|
|
40
|
-
debug?.(`Using babel reanimated on file ${props.id}`);
|
|
41
|
-
plugins.push(
|
|
42
|
-
// TODO make this configurable
|
|
43
|
-
process.env.VXRN_WORKLET_PLUGIN ? "react-native-worklets/plugin" : "react-native-reanimated/plugin");
|
|
44
|
-
}
|
|
45
|
-
if (shouldBabelReactCompiler(props)) {
|
|
46
|
-
debug?.(`Using babel react compiler on file`);
|
|
47
|
-
plugins.push(getBabelReactCompilerPlugin(props));
|
|
48
|
-
}
|
|
49
|
-
if (shouldBabelReactNativeCodegen(props)) {
|
|
50
|
-
debug?.(`Using babel @react-native/babel-plugin-codegen on file`);
|
|
51
|
-
plugins.push("@react-native/babel-plugin-codegen");
|
|
52
|
-
}
|
|
53
|
-
if (plugins.length) {
|
|
54
|
-
return {
|
|
55
|
-
plugins
|
|
56
|
-
};
|
|
57
|
-
}
|
|
58
|
-
return null;
|
|
59
|
-
};
|
|
60
|
-
async function transformOxcReactCompiler(id, code, target) {
|
|
61
|
-
const {
|
|
62
|
-
transform
|
|
63
|
-
} = await import("oxc-transform-react");
|
|
64
|
-
const result = await transform(id, code, {
|
|
65
|
-
jsx: "preserve",
|
|
66
|
-
reactCompiler: {
|
|
67
|
-
target
|
|
68
|
-
}
|
|
69
|
-
});
|
|
70
|
-
if (result.fatal) {
|
|
71
|
-
throw new Error(`[vxrn:compiler] oxc react compiler failed on ${id}: ${(result.errors ?? []).map(e => e.message ?? String(e)).join(", ")}`);
|
|
72
|
-
}
|
|
73
|
-
if (result.errors?.length) {
|
|
74
|
-
debug?.(`[compiler/bailout] ${id}: ${result.errors.map(e => e.message ?? String(e)).join(", ")}`);
|
|
75
|
-
}
|
|
76
|
-
return {
|
|
77
|
-
code: result.code,
|
|
78
|
-
map: void 0
|
|
79
|
-
};
|
|
80
|
-
}
|
|
81
|
-
async function transformBabel(id, code, options) {
|
|
82
|
-
const extension = extname(id);
|
|
83
|
-
const isTSX = extension === ".tsx";
|
|
84
|
-
const isTS = isTSX || extension === ".ts";
|
|
85
|
-
const babelOptions = {
|
|
86
|
-
filename: id,
|
|
87
|
-
compact: false,
|
|
88
|
-
babelrc: false,
|
|
89
|
-
configFile: false,
|
|
90
|
-
sourceMaps: false,
|
|
91
|
-
minified: false,
|
|
92
|
-
...options,
|
|
93
|
-
presets: [isTS ? ["@babel/preset-typescript", {
|
|
94
|
-
isTSX,
|
|
95
|
-
allExtensions: isTSX
|
|
96
|
-
}] : "", ...(options.presets || [])].filter(Boolean),
|
|
97
|
-
// non-TS files use React Native's Flow dialect. RN's own component specs are
|
|
98
|
-
// Flow `.js` (`import type`, `codegenNativeComponent<T>(…)`, `(expr: Type)` casts).
|
|
99
|
-
// enable Hermes Flow parsing + stripping, mirroring the TypeScript preset above
|
|
100
|
-
// (`@react-native/babel-preset` uses the same parser for JS). without it babel
|
|
101
|
-
// can't parse current RN Flow syntax such as `call<T>(...) as HostComponent<T>`, so
|
|
102
|
-
// plugins like
|
|
103
|
-
// @react-native/babel-plugin-codegen silently fail on RN specs and the runtime
|
|
104
|
-
// "Codegen didn't run" warning fires. TS path is byte-identical (empty slice).
|
|
105
|
-
plugins: [...(isTS ? [] : [[hermesParserPlugin, {
|
|
106
|
-
parseLangTypes: "flow",
|
|
107
|
-
reactRuntimeTarget: "19"
|
|
108
|
-
}]]), ...(options.plugins || []), ...(isTS ? [] : ["@babel/plugin-transform-flow-strip-types"])]
|
|
109
|
-
};
|
|
110
|
-
try {
|
|
111
|
-
const out = await new Promise((res, rej) => {
|
|
112
|
-
babel.transform(code, babelOptions, (err, result) => {
|
|
113
|
-
if (!result || err) {
|
|
114
|
-
return rej(err || "no res");
|
|
115
|
-
}
|
|
116
|
-
res(result);
|
|
117
|
-
});
|
|
118
|
-
});
|
|
119
|
-
return out;
|
|
120
|
-
} catch (err) {
|
|
121
|
-
if (err?.message?.includes("Could not find component config")) {
|
|
122
|
-
return;
|
|
123
|
-
}
|
|
124
|
-
console.error(`[vxrn:compiler] babel transform error`, err, `with options`, babelOptions);
|
|
125
|
-
console.error("code", code);
|
|
126
|
-
console.error("id", id);
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
const getBasePlugins = ({
|
|
130
|
-
development
|
|
131
|
-
}) => [["@babel/plugin-transform-destructuring"], ["@babel/plugin-transform-react-jsx", {
|
|
132
|
-
development
|
|
133
|
-
}], ["@babel/plugin-transform-async-generator-functions"], ["@babel/plugin-transform-async-to-generator"], ["@babel/plugin-transform-runtime", {
|
|
134
|
-
helpers: true,
|
|
135
|
-
// NOTE THIS WAS SPELLED WRONG BEFOER THIS COMMIT MAYBE IT WAS UNINTENTIONALLY WORKING
|
|
136
|
-
regenerator: false
|
|
137
|
-
}]];
|
|
138
|
-
const NATIVE_COMPONENT_RE = /NativeComponent\.[jt]sx?$/;
|
|
139
|
-
const SPEC_FILE_RE = /[/\\]specs?[/\\]/;
|
|
140
|
-
const shouldBabelReactNativeCodegen = ({
|
|
141
|
-
id,
|
|
142
|
-
environment
|
|
143
|
-
}) => {
|
|
144
|
-
return (environment === "ios" || environment === "android") && (NATIVE_COMPONENT_RE.test(id) || SPEC_FILE_RE.test(id));
|
|
145
|
-
};
|
|
146
|
-
const shouldBabelReactCompiler = props => {
|
|
147
|
-
if (props.environment === "ssr") {
|
|
148
|
-
return false;
|
|
149
|
-
}
|
|
150
|
-
if (!configuration.enableCompiler) {
|
|
151
|
-
return false;
|
|
152
|
-
}
|
|
153
|
-
const {
|
|
154
|
-
enableCompiler
|
|
155
|
-
} = configuration;
|
|
156
|
-
if (typeof enableCompiler === "object" && !Array.isArray(enableCompiler) && !(enableCompiler instanceof RegExp)) {
|
|
157
|
-
const isNative = props.environment === "ios" || props.environment === "android";
|
|
158
|
-
const filter = isNative ? enableCompiler.native : enableCompiler.web;
|
|
159
|
-
if (!filter) return false;
|
|
160
|
-
return applyCompilerFilter(filter, props);
|
|
161
|
-
}
|
|
162
|
-
if (typeof enableCompiler === "function") {
|
|
163
|
-
return enableCompiler(props.id, props.environment);
|
|
164
|
-
}
|
|
165
|
-
if (enableCompiler instanceof RegExp) {
|
|
166
|
-
return enableCompiler.test(props.id);
|
|
167
|
-
}
|
|
168
|
-
if (Array.isArray(enableCompiler)) {
|
|
169
|
-
if (!enableCompiler.includes(props.environment)) {
|
|
170
|
-
return false;
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
return applyDefaultFilters(props);
|
|
174
|
-
};
|
|
175
|
-
function applyCompilerFilter(filter, props) {
|
|
176
|
-
if (typeof filter === "function") {
|
|
177
|
-
return filter(props.id, props.environment);
|
|
178
|
-
}
|
|
179
|
-
if (filter instanceof RegExp) {
|
|
180
|
-
return filter.test(props.id);
|
|
181
|
-
}
|
|
182
|
-
if (filter === true) {
|
|
183
|
-
return applyDefaultFilters(props);
|
|
184
|
-
}
|
|
185
|
-
return false;
|
|
186
|
-
}
|
|
187
|
-
function applyDefaultFilters(props) {
|
|
188
|
-
if (!/(\.tsx?)$/.test(props.id)) return false;
|
|
189
|
-
if (props.id.includes("node_modules")) return false;
|
|
190
|
-
if (props.id.includes("+api.")) return false;
|
|
191
|
-
if (props.code.startsWith("// disable-compiler")) return false;
|
|
192
|
-
return true;
|
|
193
|
-
}
|
|
194
|
-
const getBabelReactCompilerPlugin = props => {
|
|
195
|
-
const target = props.reactForRNVersion === "18" && (props.environment === "ios" || props.environment === "android") ? "18" : "19";
|
|
196
|
-
return ["babel-plugin-react-compiler", {
|
|
197
|
-
target
|
|
198
|
-
}];
|
|
199
|
-
};
|
|
200
|
-
function shouldBabelGenerators({
|
|
201
|
-
code
|
|
202
|
-
}) {
|
|
203
|
-
if (process.env.VXRN_USE_BABEL_FOR_GENERATORS) {
|
|
204
|
-
return asyncGeneratorRegex.test(code);
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
|
-
const REANIMATED_AUTOWORKLETIZATION_KEYWORDS = ["worklet", "useAnimatedGestureHandler", "useAnimatedScrollHandler", "useFrameCallback", "useAnimatedStyle", "useAnimatedProps", "createAnimatedPropAdapter", "useDerivedValue", "useAnimatedReaction", "useWorkletCallback", "withTiming", "withSpring", "withDecay", "withRepeat", "runOnUI", "executeOnUIRuntimeSync"];
|
|
208
|
-
const REANIMATED_REGEX = new RegExp(REANIMATED_AUTOWORKLETIZATION_KEYWORDS.join("|"));
|
|
209
|
-
const REANIMATED_IGNORED_PATHS = [
|
|
210
|
-
// Prebuilt/vendored react-native that shouldn't be transformed
|
|
211
|
-
"react-native-prebuilt", "node_modules/.vxrn/react-native",
|
|
212
|
-
// Known false positives - they mention worklet keywords in comments/strings but don't use them
|
|
213
|
-
"node_modules/react/", "node_modules/react-dom/", "node_modules/react-native/", "node_modules/react-native-web/"];
|
|
214
|
-
const REANIMATED_IGNORED_PATHS_REGEX = new RegExp(REANIMATED_IGNORED_PATHS.join("|"));
|
|
215
|
-
function shouldBabelReanimated({
|
|
216
|
-
code,
|
|
217
|
-
id
|
|
218
|
-
}) {
|
|
219
|
-
if (!configuration.enableReanimated) {
|
|
220
|
-
return false;
|
|
221
|
-
}
|
|
222
|
-
if (REANIMATED_IGNORED_PATHS_REGEX.test(id)) {
|
|
223
|
-
return false;
|
|
224
|
-
}
|
|
225
|
-
if (REANIMATED_REGEX.test(code)) {
|
|
226
|
-
const location = id.includes("node_modules") ? "node_modules" : "user-code";
|
|
227
|
-
debug?.(` \u{1FA84} [reanimated/${location}] ${relative(process.cwd(), id)}`);
|
|
228
|
-
return true;
|
|
229
|
-
}
|
|
230
|
-
return false;
|
|
231
|
-
}
|
|
232
|
-
export { getBabelOptions, transformBabel, transformOxcReactCompiler };
|
|
233
|
-
//# sourceMappingURL=transformBabel.mjs.map
|