react-refresh 0.15.0-next-5dd90c562-20230502 → 0.16.0-beta-94eed63c49-20240425

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/babel.js CHANGED
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  if (process.env.NODE_ENV === 'production') {
4
- module.exports = require('./cjs/react-refresh-babel.production.min.js');
4
+ module.exports = require('./cjs/react-refresh-babel.production.js');
5
5
  } else {
6
6
  module.exports = require('./cjs/react-refresh-babel.development.js');
7
7
  }
@@ -269,6 +269,24 @@ function ReactFreshBabelPlugin (babel) {
269
269
  case 'React.useImperativeHandle':
270
270
  case 'useDebugValue':
271
271
  case 'React.useDebugValue':
272
+ case 'useId':
273
+ case 'React.useId':
274
+ case 'useDeferredValue':
275
+ case 'React.useDeferredValue':
276
+ case 'useTransition':
277
+ case 'React.useTransition':
278
+ case 'useInsertionEffect':
279
+ case 'React.useInsertionEffect':
280
+ case 'useSyncExternalStore':
281
+ case 'React.useSyncExternalStore':
282
+ case 'useFormStatus':
283
+ case 'React.useFormStatus':
284
+ case 'useFormState':
285
+ case 'React.useFormState':
286
+ case 'useActionState':
287
+ case 'React.useActionState':
288
+ case 'useOptimistic':
289
+ case 'React.useOptimistic':
272
290
  return true;
273
291
 
274
292
  default:
@@ -0,0 +1,586 @@
1
+ /**
2
+ * @license React
3
+ * react-refresh-babel.production.js
4
+ *
5
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
6
+ *
7
+ * This source code is licensed under the MIT license found in the
8
+ * LICENSE file in the root directory of this source tree.
9
+ */
10
+
11
+ "use strict";
12
+ module.exports = function (babel) {
13
+ function createRegistration(programPath, persistentID) {
14
+ var handle = programPath.scope.generateUidIdentifier("c");
15
+ registrationsByProgramPath.has(programPath) ||
16
+ registrationsByProgramPath.set(programPath, []);
17
+ registrationsByProgramPath
18
+ .get(programPath)
19
+ .push({ handle: handle, persistentID: persistentID });
20
+ return handle;
21
+ }
22
+ function isComponentishName(name) {
23
+ return "string" === typeof name && "A" <= name[0] && "Z" >= name[0];
24
+ }
25
+ function findInnerComponents(inferredName, path, callback) {
26
+ var node = path.node;
27
+ switch (node.type) {
28
+ case "Identifier":
29
+ if (!isComponentishName(node.name)) break;
30
+ callback(inferredName, node, null);
31
+ return !0;
32
+ case "FunctionDeclaration":
33
+ return callback(inferredName, node.id, null), !0;
34
+ case "ArrowFunctionExpression":
35
+ if ("ArrowFunctionExpression" === node.body.type) break;
36
+ callback(inferredName, node, path);
37
+ return !0;
38
+ case "FunctionExpression":
39
+ return callback(inferredName, node, path), !0;
40
+ case "CallExpression":
41
+ var argsPath = path.get("arguments");
42
+ if (void 0 === argsPath || 0 === argsPath.length) break;
43
+ var calleePath = path.get("callee");
44
+ switch (calleePath.node.type) {
45
+ case "MemberExpression":
46
+ case "Identifier":
47
+ calleePath = calleePath.getSource();
48
+ if (
49
+ !findInnerComponents(
50
+ inferredName + "$" + calleePath,
51
+ argsPath[0],
52
+ callback
53
+ )
54
+ )
55
+ return !1;
56
+ callback(inferredName, node, path);
57
+ return !0;
58
+ default:
59
+ return !1;
60
+ }
61
+ case "VariableDeclarator":
62
+ if (
63
+ ((argsPath = node.init),
64
+ null !== argsPath &&
65
+ ((calleePath = node.id.name), isComponentishName(calleePath)))
66
+ ) {
67
+ switch (argsPath.type) {
68
+ case "ArrowFunctionExpression":
69
+ case "FunctionExpression":
70
+ break;
71
+ case "CallExpression":
72
+ node = argsPath.callee;
73
+ var calleeType = node.type;
74
+ if (
75
+ "Import" === calleeType ||
76
+ ("Identifier" === calleeType &&
77
+ (0 === node.name.indexOf("require") ||
78
+ 0 === node.name.indexOf("import")))
79
+ )
80
+ return !1;
81
+ break;
82
+ case "TaggedTemplateExpression":
83
+ break;
84
+ default:
85
+ return !1;
86
+ }
87
+ node = path.get("init");
88
+ if (findInnerComponents(inferredName, node, callback)) return !0;
89
+ calleePath = path.scope.getBinding(calleePath);
90
+ if (void 0 === calleePath) return;
91
+ path = !1;
92
+ calleePath = calleePath.referencePaths;
93
+ for (calleeType = 0; calleeType < calleePath.length; calleeType++) {
94
+ var ref = calleePath[calleeType];
95
+ if (
96
+ !ref.node ||
97
+ "JSXIdentifier" === ref.node.type ||
98
+ "Identifier" === ref.node.type
99
+ ) {
100
+ ref = ref.parent;
101
+ if ("JSXOpeningElement" === ref.type) path = !0;
102
+ else if ("CallExpression" === ref.type) {
103
+ ref = ref.callee;
104
+ var fnName = void 0;
105
+ switch (ref.type) {
106
+ case "Identifier":
107
+ fnName = ref.name;
108
+ break;
109
+ case "MemberExpression":
110
+ fnName = ref.property.name;
111
+ }
112
+ switch (fnName) {
113
+ case "createElement":
114
+ case "jsx":
115
+ case "jsxDEV":
116
+ case "jsxs":
117
+ path = !0;
118
+ }
119
+ }
120
+ if (path) return callback(inferredName, argsPath, node), !0;
121
+ }
122
+ }
123
+ }
124
+ }
125
+ return !1;
126
+ }
127
+ function getHookCallsSignature(functionNode) {
128
+ functionNode = hookCalls.get(functionNode);
129
+ return void 0 === functionNode
130
+ ? null
131
+ : {
132
+ key: functionNode
133
+ .map(function (call) {
134
+ return call.name + "{" + call.key + "}";
135
+ })
136
+ .join("\n"),
137
+ customHooks: functionNode
138
+ .filter(function (call) {
139
+ a: switch (call.name) {
140
+ case "useState":
141
+ case "React.useState":
142
+ case "useReducer":
143
+ case "React.useReducer":
144
+ case "useEffect":
145
+ case "React.useEffect":
146
+ case "useLayoutEffect":
147
+ case "React.useLayoutEffect":
148
+ case "useMemo":
149
+ case "React.useMemo":
150
+ case "useCallback":
151
+ case "React.useCallback":
152
+ case "useRef":
153
+ case "React.useRef":
154
+ case "useContext":
155
+ case "React.useContext":
156
+ case "useImperativeHandle":
157
+ case "React.useImperativeHandle":
158
+ case "useDebugValue":
159
+ case "React.useDebugValue":
160
+ case "useId":
161
+ case "React.useId":
162
+ case "useDeferredValue":
163
+ case "React.useDeferredValue":
164
+ case "useTransition":
165
+ case "React.useTransition":
166
+ case "useInsertionEffect":
167
+ case "React.useInsertionEffect":
168
+ case "useSyncExternalStore":
169
+ case "React.useSyncExternalStore":
170
+ case "useFormStatus":
171
+ case "React.useFormStatus":
172
+ case "useFormState":
173
+ case "React.useFormState":
174
+ case "useActionState":
175
+ case "React.useActionState":
176
+ case "useOptimistic":
177
+ case "React.useOptimistic":
178
+ call = !0;
179
+ break a;
180
+ default:
181
+ call = !1;
182
+ }
183
+ return !call;
184
+ })
185
+ .map(function (call) {
186
+ return t.cloneDeep(call.callee);
187
+ })
188
+ };
189
+ }
190
+ function hasForceResetComment(path) {
191
+ path = path.hub.file;
192
+ var hasForceReset = hasForceResetCommentByFile.get(path);
193
+ if (void 0 !== hasForceReset) return hasForceReset;
194
+ hasForceReset = !1;
195
+ for (var comments = path.ast.comments, i = 0; i < comments.length; i++)
196
+ if (-1 !== comments[i].value.indexOf("@refresh reset")) {
197
+ hasForceReset = !0;
198
+ break;
199
+ }
200
+ hasForceResetCommentByFile.set(path, hasForceReset);
201
+ return hasForceReset;
202
+ }
203
+ function createArgumentsForSignature(node, signature, scope) {
204
+ var key = signature.key;
205
+ signature = signature.customHooks;
206
+ var forceReset = hasForceResetComment(scope.path),
207
+ customHooksInScope = [];
208
+ signature.forEach(function (callee) {
209
+ switch (callee.type) {
210
+ case "MemberExpression":
211
+ if ("Identifier" === callee.object.type)
212
+ var bindingName = callee.object.name;
213
+ break;
214
+ case "Identifier":
215
+ bindingName = callee.name;
216
+ }
217
+ scope.hasBinding(bindingName)
218
+ ? customHooksInScope.push(callee)
219
+ : (forceReset = !0);
220
+ });
221
+ signature = key;
222
+ "function" !== typeof require ||
223
+ opts.emitFullSignatures ||
224
+ (signature = require("crypto")
225
+ .createHash("sha1")
226
+ .update(key)
227
+ .digest("base64"));
228
+ node = [node, t.stringLiteral(signature)];
229
+ (forceReset || 0 < customHooksInScope.length) &&
230
+ node.push(t.booleanLiteral(forceReset));
231
+ 0 < customHooksInScope.length &&
232
+ node.push(
233
+ t.functionExpression(
234
+ null,
235
+ [],
236
+ t.blockStatement([
237
+ t.returnStatement(t.arrayExpression(customHooksInScope))
238
+ ])
239
+ )
240
+ );
241
+ return node;
242
+ }
243
+ function findHOCCallPathsAbove(path) {
244
+ for (var calls = []; ; ) {
245
+ if (!path) return calls;
246
+ var parentPath = path.parentPath;
247
+ if (!parentPath) return calls;
248
+ if (
249
+ "AssignmentExpression" === parentPath.node.type &&
250
+ path.node === parentPath.node.right
251
+ )
252
+ path = parentPath;
253
+ else if (
254
+ "CallExpression" === parentPath.node.type &&
255
+ path.node !== parentPath.node.callee
256
+ )
257
+ calls.push(parentPath), (path = parentPath);
258
+ else return calls;
259
+ }
260
+ }
261
+ var opts =
262
+ 1 < arguments.length && void 0 !== arguments[1] ? arguments[1] : {};
263
+ if ("function" === typeof babel.env) {
264
+ var env = babel.env();
265
+ if ("development" !== env && !opts.skipEnvCheck)
266
+ throw Error(
267
+ 'React Refresh Babel transform should only be enabled in development environment. Instead, the environment is: "' +
268
+ env +
269
+ '". If you want to override this check, pass {skipEnvCheck: true} as plugin options.'
270
+ );
271
+ }
272
+ var t = babel.types,
273
+ refreshReg = t.identifier(opts.refreshReg || "$RefreshReg$"),
274
+ refreshSig = t.identifier(opts.refreshSig || "$RefreshSig$"),
275
+ registrationsByProgramPath = new Map(),
276
+ hasForceResetCommentByFile = new WeakMap(),
277
+ seenForRegistration = new WeakSet(),
278
+ seenForSignature = new WeakSet(),
279
+ seenForOutro = new WeakSet(),
280
+ hookCalls = new WeakMap(),
281
+ HookCallsVisitor = {
282
+ CallExpression: function (path) {
283
+ var callee = path.node.callee,
284
+ name = null;
285
+ switch (callee.type) {
286
+ case "Identifier":
287
+ name = callee.name;
288
+ break;
289
+ case "MemberExpression":
290
+ name = callee.property.name;
291
+ }
292
+ if (
293
+ null !== name &&
294
+ /^use[A-Z]/.test(name) &&
295
+ ((callee = path.scope.getFunctionParent()), null !== callee)
296
+ ) {
297
+ callee = callee.block;
298
+ hookCalls.has(callee) || hookCalls.set(callee, []);
299
+ callee = hookCalls.get(callee);
300
+ var key = "";
301
+ "VariableDeclarator" === path.parent.type &&
302
+ (key = path.parentPath.get("id").getSource());
303
+ var args = path.get("arguments");
304
+ "useState" === name && 0 < args.length
305
+ ? (key += "(" + args[0].getSource() + ")")
306
+ : "useReducer" === name &&
307
+ 1 < args.length &&
308
+ (key += "(" + args[1].getSource() + ")");
309
+ callee.push({ callee: path.node.callee, name: name, key: key });
310
+ }
311
+ }
312
+ };
313
+ return {
314
+ visitor: {
315
+ ExportDefaultDeclaration: function (path) {
316
+ var node = path.node,
317
+ decl = node.declaration,
318
+ declPath = path.get("declaration");
319
+ if ("CallExpression" === decl.type && !seenForRegistration.has(node)) {
320
+ seenForRegistration.add(node);
321
+ var programPath = path.parentPath;
322
+ findInnerComponents(
323
+ "%default%",
324
+ declPath,
325
+ function (persistentID, targetExpr, targetPath) {
326
+ null !== targetPath &&
327
+ ((persistentID = createRegistration(programPath, persistentID)),
328
+ targetPath.replaceWith(
329
+ t.assignmentExpression("=", persistentID, targetExpr)
330
+ ));
331
+ }
332
+ );
333
+ }
334
+ },
335
+ FunctionDeclaration: {
336
+ enter: function (path) {
337
+ var node = path.node,
338
+ modulePrefix = "";
339
+ switch (path.parent.type) {
340
+ case "Program":
341
+ var insertAfterPath = path;
342
+ var programPath = path.parentPath;
343
+ break;
344
+ case "TSModuleBlock":
345
+ insertAfterPath = path;
346
+ programPath = insertAfterPath.parentPath.parentPath;
347
+ break;
348
+ case "ExportNamedDeclaration":
349
+ insertAfterPath = path.parentPath;
350
+ programPath = insertAfterPath.parentPath;
351
+ break;
352
+ case "ExportDefaultDeclaration":
353
+ insertAfterPath = path.parentPath;
354
+ programPath = insertAfterPath.parentPath;
355
+ break;
356
+ default:
357
+ return;
358
+ }
359
+ if (
360
+ "TSModuleBlock" === path.parent.type ||
361
+ "ExportNamedDeclaration" === path.parent.type
362
+ )
363
+ for (; "Program" !== programPath.type; ) {
364
+ if ("TSModuleDeclaration" === programPath.type) {
365
+ if (
366
+ "Program" !== programPath.parentPath.type &&
367
+ "ExportNamedDeclaration" !== programPath.parentPath.type
368
+ )
369
+ return;
370
+ modulePrefix = programPath.node.id.name + "$" + modulePrefix;
371
+ }
372
+ programPath = programPath.parentPath;
373
+ }
374
+ var id = node.id;
375
+ null !== id &&
376
+ ((id = id.name),
377
+ isComponentishName(id) &&
378
+ !seenForRegistration.has(node) &&
379
+ (seenForRegistration.add(node),
380
+ findInnerComponents(
381
+ modulePrefix + id,
382
+ path,
383
+ function (persistentID, targetExpr) {
384
+ persistentID = createRegistration(programPath, persistentID);
385
+ insertAfterPath.insertAfter(
386
+ t.expressionStatement(
387
+ t.assignmentExpression("=", persistentID, targetExpr)
388
+ )
389
+ );
390
+ }
391
+ )));
392
+ },
393
+ exit: function (path) {
394
+ var node = path.node,
395
+ id = node.id;
396
+ if (null !== id) {
397
+ var signature = getHookCallsSignature(node);
398
+ if (null !== signature && !seenForSignature.has(node)) {
399
+ seenForSignature.add(node);
400
+ node = path.scope.generateUidIdentifier("_s");
401
+ path.scope.parent.push({
402
+ id: node,
403
+ init: t.callExpression(refreshSig, [])
404
+ });
405
+ path
406
+ .get("body")
407
+ .unshiftContainer(
408
+ "body",
409
+ t.expressionStatement(t.callExpression(node, []))
410
+ );
411
+ var insertAfterPath = null;
412
+ path.find(function (p) {
413
+ if (p.parentPath.isBlock()) return (insertAfterPath = p), !0;
414
+ });
415
+ null !== insertAfterPath &&
416
+ insertAfterPath.insertAfter(
417
+ t.expressionStatement(
418
+ t.callExpression(
419
+ node,
420
+ createArgumentsForSignature(
421
+ id,
422
+ signature,
423
+ insertAfterPath.scope
424
+ )
425
+ )
426
+ )
427
+ );
428
+ }
429
+ }
430
+ }
431
+ },
432
+ "ArrowFunctionExpression|FunctionExpression": {
433
+ exit: function (path) {
434
+ var node = path.node,
435
+ signature = getHookCallsSignature(node);
436
+ if (null !== signature && !seenForSignature.has(node)) {
437
+ seenForSignature.add(node);
438
+ var sigCallID = path.scope.generateUidIdentifier("_s");
439
+ path.scope.parent.push({
440
+ id: sigCallID,
441
+ init: t.callExpression(refreshSig, [])
442
+ });
443
+ "BlockStatement" !== path.node.body.type &&
444
+ (path.node.body = t.blockStatement([
445
+ t.returnStatement(path.node.body)
446
+ ]));
447
+ path
448
+ .get("body")
449
+ .unshiftContainer(
450
+ "body",
451
+ t.expressionStatement(t.callExpression(sigCallID, []))
452
+ );
453
+ if ("VariableDeclarator" === path.parent.type) {
454
+ var insertAfterPath = null;
455
+ path.find(function (p) {
456
+ if (p.parentPath.isBlock()) return (insertAfterPath = p), !0;
457
+ });
458
+ null !== insertAfterPath &&
459
+ insertAfterPath.insertAfter(
460
+ t.expressionStatement(
461
+ t.callExpression(
462
+ sigCallID,
463
+ createArgumentsForSignature(
464
+ path.parent.id,
465
+ signature,
466
+ insertAfterPath.scope
467
+ )
468
+ )
469
+ )
470
+ );
471
+ } else
472
+ [path].concat(findHOCCallPathsAbove(path)).forEach(function (p) {
473
+ p.replaceWith(
474
+ t.callExpression(
475
+ sigCallID,
476
+ createArgumentsForSignature(p.node, signature, p.scope)
477
+ )
478
+ );
479
+ });
480
+ }
481
+ }
482
+ },
483
+ VariableDeclaration: function (path) {
484
+ var node = path.node,
485
+ modulePrefix = "";
486
+ switch (path.parent.type) {
487
+ case "Program":
488
+ var insertAfterPath = path;
489
+ var programPath = path.parentPath;
490
+ break;
491
+ case "TSModuleBlock":
492
+ insertAfterPath = path;
493
+ programPath = insertAfterPath.parentPath.parentPath;
494
+ break;
495
+ case "ExportNamedDeclaration":
496
+ insertAfterPath = path.parentPath;
497
+ programPath = insertAfterPath.parentPath;
498
+ break;
499
+ case "ExportDefaultDeclaration":
500
+ insertAfterPath = path.parentPath;
501
+ programPath = insertAfterPath.parentPath;
502
+ break;
503
+ default:
504
+ return;
505
+ }
506
+ if (
507
+ "TSModuleBlock" === path.parent.type ||
508
+ "ExportNamedDeclaration" === path.parent.type
509
+ )
510
+ for (; "Program" !== programPath.type; ) {
511
+ if ("TSModuleDeclaration" === programPath.type) {
512
+ if (
513
+ "Program" !== programPath.parentPath.type &&
514
+ "ExportNamedDeclaration" !== programPath.parentPath.type
515
+ )
516
+ return;
517
+ modulePrefix = programPath.node.id.name + "$" + modulePrefix;
518
+ }
519
+ programPath = programPath.parentPath;
520
+ }
521
+ if (
522
+ !seenForRegistration.has(node) &&
523
+ (seenForRegistration.add(node),
524
+ (path = path.get("declarations")),
525
+ 1 === path.length)
526
+ ) {
527
+ var declPath = path[0];
528
+ findInnerComponents(
529
+ modulePrefix + declPath.node.id.name,
530
+ declPath,
531
+ function (persistentID, targetExpr, targetPath) {
532
+ null !== targetPath &&
533
+ ((persistentID = createRegistration(programPath, persistentID)),
534
+ "VariableDeclarator" === targetPath.parent.type
535
+ ? insertAfterPath.insertAfter(
536
+ t.expressionStatement(
537
+ t.assignmentExpression(
538
+ "=",
539
+ persistentID,
540
+ declPath.node.id
541
+ )
542
+ )
543
+ )
544
+ : targetPath.replaceWith(
545
+ t.assignmentExpression("=", persistentID, targetExpr)
546
+ ));
547
+ }
548
+ );
549
+ }
550
+ },
551
+ Program: {
552
+ enter: function (path) {
553
+ path.traverse(HookCallsVisitor);
554
+ },
555
+ exit: function (path) {
556
+ var registrations = registrationsByProgramPath.get(path);
557
+ if (void 0 !== registrations) {
558
+ var node = path.node;
559
+ if (!seenForOutro.has(node)) {
560
+ seenForOutro.add(node);
561
+ registrationsByProgramPath.delete(path);
562
+ var declarators = [];
563
+ path.pushContainer(
564
+ "body",
565
+ t.variableDeclaration("var", declarators)
566
+ );
567
+ registrations.forEach(function (_ref) {
568
+ var handle = _ref.handle;
569
+ path.pushContainer(
570
+ "body",
571
+ t.expressionStatement(
572
+ t.callExpression(refreshReg, [
573
+ handle,
574
+ t.stringLiteral(_ref.persistentID)
575
+ ])
576
+ )
577
+ );
578
+ declarators.push(t.variableDeclarator(handle));
579
+ });
580
+ }
581
+ }
582
+ }
583
+ }
584
+ }
585
+ };
586
+ };
@@ -14,7 +14,6 @@ if (process.env.NODE_ENV !== "production") {
14
14
  (function() {
15
15
  'use strict';
16
16
 
17
- // ATTENTION
18
17
  var REACT_FORWARD_REF_TYPE = Symbol.for('react.forward_ref');
19
18
  var REACT_MEMO_TYPE = Symbol.for('react.memo');
20
19
 
@@ -557,7 +556,6 @@ function createSignatureFunctionForTransform() {
557
556
  // in HOC chains like _s(hoc1(_s(hoc2(_s(actualFunction))))).
558
557
  if (!savedType) {
559
558
  // We're in the innermost call, so this is the actual type.
560
- // $FlowFixMe[escaped-generic] discovered when updating Flow
561
559
  savedType = type;
562
560
  hasCustomHooks = typeof getCustomHooks === 'function';
563
561
  } // Set the signature for all types (even wrappers!) in case
@@ -1,10 +1,14 @@
1
1
  /**
2
2
  * @license React
3
- * react-refresh-runtime.production.min.js
3
+ * react-refresh-runtime.production.js
4
4
  *
5
5
  * Copyright (c) Meta Platforms, Inc. and affiliates.
6
6
  *
7
7
  * This source code is licensed under the MIT license found in the
8
8
  * LICENSE file in the root directory of this source tree.
9
9
  */
10
- 'use strict';throw Error("React Refresh runtime should not be included in the production bundle.");
10
+
11
+ "use strict";
12
+ throw Error(
13
+ "React Refresh runtime should not be included in the production bundle."
14
+ );
package/package.json CHANGED
@@ -4,8 +4,8 @@
4
4
  "keywords": [
5
5
  "react"
6
6
  ],
7
- "version": "0.15.0-next-5dd90c562-20230502",
8
- "homepage": "https://reactjs.org/",
7
+ "version": "0.16.0-beta-94eed63c49-20240425",
8
+ "homepage": "https://react.dev/",
9
9
  "bugs": "https://github.com/facebook/react/issues",
10
10
  "license": "MIT",
11
11
  "files": [
@@ -13,8 +13,7 @@
13
13
  "README.md",
14
14
  "babel.js",
15
15
  "runtime.js",
16
- "cjs/",
17
- "umd/"
16
+ "cjs/"
18
17
  ],
19
18
  "main": "runtime.js",
20
19
  "exports": {
package/runtime.js CHANGED
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  if (process.env.NODE_ENV === 'production') {
4
- module.exports = require('./cjs/react-refresh-runtime.production.min.js');
4
+ module.exports = require('./cjs/react-refresh-runtime.production.js');
5
5
  } else {
6
6
  module.exports = require('./cjs/react-refresh-runtime.development.js');
7
7
  }
@@ -1,24 +0,0 @@
1
- /**
2
- * @license React
3
- * react-refresh-babel.production.min.js
4
- *
5
- * Copyright (c) Meta Platforms, Inc. and affiliates.
6
- *
7
- * This source code is licensed under the MIT license found in the
8
- * LICENSE file in the root directory of this source tree.
9
- */
10
- 'use strict';module.exports=function(u){function v(a,b){var e=a.scope.generateUidIdentifier("c");n.has(a)||n.set(a,[]);n.get(a).push({handle:e,persistentID:b});return e}function w(a){return"string"===typeof a&&"A"<=a[0]&&"Z">=a[0]}function p(a,b,e){var c=b.node;switch(c.type){case "Identifier":if(!w(c.name))break;e(a,c,null);return!0;case "FunctionDeclaration":return e(a,c.id,null),!0;case "ArrowFunctionExpression":if("ArrowFunctionExpression"===c.body.type)break;e(a,c,b);return!0;case "FunctionExpression":return e(a,
11
- c,b),!0;case "CallExpression":var d=b.get("arguments");if(void 0===d||0===d.length)break;var f=b.get("callee");switch(f.node.type){case "MemberExpression":case "Identifier":f=f.getSource();if(!p(a+"$"+f,d[0],e))return!1;e(a,c,b);return!0;default:return!1}case "VariableDeclarator":if(d=c.init,null!==d&&(f=c.id.name,w(f))){switch(d.type){case "ArrowFunctionExpression":case "FunctionExpression":break;case "CallExpression":c=d.callee;var h=c.type;if("Import"===h||"Identifier"===h&&(0===c.name.indexOf("require")||
12
- 0===c.name.indexOf("import")))return!1;break;case "TaggedTemplateExpression":break;default:return!1}c=b.get("init");if(p(a,c,e))return!0;f=b.scope.getBinding(f);if(void 0===f)return;b=!1;f=f.referencePaths;for(h=0;h<f.length;h++){var k=f[h];if(!k.node||"JSXIdentifier"===k.node.type||"Identifier"===k.node.type){k=k.parent;if("JSXOpeningElement"===k.type)b=!0;else if("CallExpression"===k.type){k=k.callee;var l=void 0;switch(k.type){case "Identifier":l=k.name;break;case "MemberExpression":l=k.property.name}switch(l){case "createElement":case "jsx":case "jsxDEV":case "jsxs":b=
13
- !0}}if(b)return e(a,d,c),!0}}}}return!1}function y(a){a=q.get(a);return void 0===a?null:{key:a.map(function(b){return b.name+"{"+b.key+"}"}).join("\n"),customHooks:a.filter(function(b){a:switch(b.name){case "useState":case "React.useState":case "useReducer":case "React.useReducer":case "useEffect":case "React.useEffect":case "useLayoutEffect":case "React.useLayoutEffect":case "useMemo":case "React.useMemo":case "useCallback":case "React.useCallback":case "useRef":case "React.useRef":case "useContext":case "React.useContext":case "useImperativeHandle":case "React.useImperativeHandle":case "useDebugValue":case "React.useDebugValue":b=
14
- !0;break a;default:b=!1}return!b}).map(function(b){return g.cloneDeep(b.callee)})}}function D(a){a=a.hub.file;var b=z.get(a);if(void 0!==b)return b;b=!1;for(var e=a.ast.comments,c=0;c<e.length;c++)if(-1!==e[c].value.indexOf("@refresh reset")){b=!0;break}z.set(a,b);return b}function x(a,b,e){var c=b.key;b=b.customHooks;var d=D(e.path),f=[];b.forEach(function(h){switch(h.type){case "MemberExpression":if("Identifier"===h.object.type)var k=h.object.name;break;case "Identifier":k=h.name}e.hasBinding(k)?
15
- f.push(h):d=!0});b=c;"function"!==typeof require||r.emitFullSignatures||(b=require("crypto").createHash("sha1").update(c).digest("base64"));a=[a,g.stringLiteral(b)];(d||0<f.length)&&a.push(g.booleanLiteral(d));0<f.length&&a.push(g.functionExpression(null,[],g.blockStatement([g.returnStatement(g.arrayExpression(f))])));return a}function E(a){for(var b=[];;){if(!a)return b;var e=a.parentPath;if(!e)return b;if("AssignmentExpression"===e.node.type&&a.node===e.node.right)a=e;else if("CallExpression"===
16
- e.node.type&&a.node!==e.node.callee)b.push(e),a=e;else return b}}var r=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{};if("function"===typeof u.env){var A=u.env();if("development"!==A&&!r.skipEnvCheck)throw Error('React Refresh Babel transform should only be enabled in development environment. Instead, the environment is: "'+A+'". If you want to override this check, pass {skipEnvCheck: true} as plugin options.');}var g=u.types,F=g.identifier(r.refreshReg||"$RefreshReg$"),B=g.identifier(r.refreshSig||
17
- "$RefreshSig$"),n=new Map,z=new WeakMap,m=new WeakSet,t=new WeakSet,C=new WeakSet,q=new WeakMap,G={CallExpression:function(a){var b=a.node.callee,e=null;switch(b.type){case "Identifier":e=b.name;break;case "MemberExpression":e=b.property.name}if(null!==e&&/^use[A-Z]/.test(e)&&(b=a.scope.getFunctionParent(),null!==b)){b=b.block;q.has(b)||q.set(b,[]);b=q.get(b);var c="";"VariableDeclarator"===a.parent.type&&(c=a.parentPath.get("id").getSource());var d=a.get("arguments");"useState"===e&&0<d.length?c+=
18
- "("+d[0].getSource()+")":"useReducer"===e&&1<d.length&&(c+="("+d[1].getSource()+")");b.push({callee:a.node.callee,name:e,key:c})}}};return{visitor:{ExportDefaultDeclaration:function(a){var b=a.node,e=b.declaration,c=a.get("declaration");if("CallExpression"===e.type&&!m.has(b)){m.add(b);var d=a.parentPath;p("%default%",c,function(f,h,k){null!==k&&(f=v(d,f),k.replaceWith(g.assignmentExpression("=",f,h)))})}},FunctionDeclaration:{enter:function(a){var b=a.node,e="";switch(a.parent.type){case "Program":var c=
19
- a;var d=a.parentPath;break;case "TSModuleBlock":c=a;d=c.parentPath.parentPath;break;case "ExportNamedDeclaration":c=a.parentPath;d=c.parentPath;break;case "ExportDefaultDeclaration":c=a.parentPath;d=c.parentPath;break;default:return}if("TSModuleBlock"===a.parent.type||"ExportNamedDeclaration"===a.parent.type)for(;"Program"!==d.type;){if("TSModuleDeclaration"===d.type){if("Program"!==d.parentPath.type&&"ExportNamedDeclaration"!==d.parentPath.type)return;e=d.node.id.name+"$"+e}d=d.parentPath}var f=
20
- b.id;null!==f&&(f=f.name,w(f)&&!m.has(b)&&(m.add(b),p(e+f,a,function(h,k){h=v(d,h);c.insertAfter(g.expressionStatement(g.assignmentExpression("=",h,k)))})))},exit:function(a){var b=a.node,e=b.id;if(null!==e){var c=y(b);if(null!==c&&!t.has(b)){t.add(b);b=a.scope.generateUidIdentifier("_s");a.scope.parent.push({id:b,init:g.callExpression(B,[])});a.get("body").unshiftContainer("body",g.expressionStatement(g.callExpression(b,[])));var d=null;a.find(function(f){if(f.parentPath.isBlock())return d=f,!0});
21
- null!==d&&d.insertAfter(g.expressionStatement(g.callExpression(b,x(e,c,d.scope))))}}}},"ArrowFunctionExpression|FunctionExpression":{exit:function(a){var b=a.node,e=y(b);if(null!==e&&!t.has(b)){t.add(b);var c=a.scope.generateUidIdentifier("_s");a.scope.parent.push({id:c,init:g.callExpression(B,[])});"BlockStatement"!==a.node.body.type&&(a.node.body=g.blockStatement([g.returnStatement(a.node.body)]));a.get("body").unshiftContainer("body",g.expressionStatement(g.callExpression(c,[])));if("VariableDeclarator"===
22
- a.parent.type){var d=null;a.find(function(f){if(f.parentPath.isBlock())return d=f,!0});null!==d&&d.insertAfter(g.expressionStatement(g.callExpression(c,x(a.parent.id,e,d.scope))))}else[a].concat(E(a)).forEach(function(f){f.replaceWith(g.callExpression(c,x(f.node,e,f.scope)))})}}},VariableDeclaration:function(a){var b=a.node,e="";switch(a.parent.type){case "Program":var c=a;var d=a.parentPath;break;case "TSModuleBlock":c=a;d=c.parentPath.parentPath;break;case "ExportNamedDeclaration":c=a.parentPath;
23
- d=c.parentPath;break;case "ExportDefaultDeclaration":c=a.parentPath;d=c.parentPath;break;default:return}if("TSModuleBlock"===a.parent.type||"ExportNamedDeclaration"===a.parent.type)for(;"Program"!==d.type;){if("TSModuleDeclaration"===d.type){if("Program"!==d.parentPath.type&&"ExportNamedDeclaration"!==d.parentPath.type)return;e=d.node.id.name+"$"+e}d=d.parentPath}if(!m.has(b)&&(m.add(b),a=a.get("declarations"),1===a.length)){var f=a[0];p(e+f.node.id.name,f,function(h,k,l){null!==l&&(h=v(d,h),"VariableDeclarator"===
24
- l.parent.type?c.insertAfter(g.expressionStatement(g.assignmentExpression("=",h,f.node.id))):l.replaceWith(g.assignmentExpression("=",h,k)))})}},Program:{enter:function(a){a.traverse(G)},exit:function(a){var b=n.get(a);if(void 0!==b){var e=a.node;if(!C.has(e)){C.add(e);n.delete(a);var c=[];a.pushContainer("body",g.variableDeclaration("var",c));b.forEach(function(d){var f=d.handle;a.pushContainer("body",g.expressionStatement(g.callExpression(F,[f,g.stringLiteral(d.persistentID)])));c.push(g.variableDeclarator(f))})}}}}}}};