signalium 2.2.3 → 2.3.1

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 (94) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/dist/cjs/development/config-B0MtLBgx.js.map +1 -1
  3. package/dist/cjs/development/{debug-3nd-6Gnf.js → debug-CmcrpeEO.js} +228 -207
  4. package/dist/cjs/development/debug-CmcrpeEO.js.map +1 -0
  5. package/dist/cjs/development/debug.js +9 -3
  6. package/dist/cjs/development/debug.js.map +1 -1
  7. package/dist/cjs/development/index.js +9 -8
  8. package/dist/cjs/development/index.js.map +1 -1
  9. package/dist/cjs/development/react/index.js +43 -38
  10. package/dist/cjs/development/react/index.js.map +1 -1
  11. package/dist/cjs/development/snapshot-BJN--_kH.js +147 -0
  12. package/dist/cjs/development/snapshot-BJN--_kH.js.map +1 -0
  13. package/dist/cjs/development/transform/index.js +137 -118
  14. package/dist/cjs/development/transform/index.js.map +1 -1
  15. package/dist/cjs/development/utils.js +5 -3
  16. package/dist/cjs/development/utils.js.map +1 -1
  17. package/dist/cjs/production/config-B0MtLBgx.js.map +1 -1
  18. package/dist/cjs/production/{contexts-DoZWv_3I.js → contexts-DCujds9v.js} +147 -133
  19. package/dist/cjs/production/contexts-DCujds9v.js.map +1 -0
  20. package/dist/cjs/production/debug.js +61 -66
  21. package/dist/cjs/production/debug.js.map +1 -1
  22. package/dist/cjs/production/index.js +9 -8
  23. package/dist/cjs/production/index.js.map +1 -1
  24. package/dist/cjs/production/react/index.js +43 -38
  25. package/dist/cjs/production/react/index.js.map +1 -1
  26. package/dist/cjs/production/snapshot-CRhlFRNu.js +147 -0
  27. package/dist/cjs/production/snapshot-CRhlFRNu.js.map +1 -0
  28. package/dist/cjs/production/transform/index.js +137 -118
  29. package/dist/cjs/production/transform/index.js.map +1 -1
  30. package/dist/cjs/production/utils.js +5 -3
  31. package/dist/cjs/production/utils.js.map +1 -1
  32. package/dist/esm/development/config-CPQL7hX-.js.map +1 -1
  33. package/dist/esm/development/{debug-BfudYKc4.js → debug-B6Cqxyzi.js} +228 -205
  34. package/dist/esm/development/debug-B6Cqxyzi.js.map +1 -0
  35. package/dist/esm/development/debug.js +9 -9
  36. package/dist/esm/development/index.js +15 -14
  37. package/dist/esm/development/react/index.js +43 -38
  38. package/dist/esm/development/react/index.js.map +1 -1
  39. package/dist/esm/development/snapshot-BeaCnwxd.js +148 -0
  40. package/dist/esm/development/snapshot-BeaCnwxd.js.map +1 -0
  41. package/dist/esm/development/transform/index.js +137 -118
  42. package/dist/esm/development/transform/index.js.map +1 -1
  43. package/dist/esm/development/utils.js +7 -4
  44. package/dist/esm/development/utils.js.map +1 -1
  45. package/dist/esm/index.d.ts +1 -1
  46. package/dist/esm/index.d.ts.map +1 -1
  47. package/dist/esm/internals/async.d.ts.map +1 -1
  48. package/dist/esm/internals/core-api.d.ts +2 -2
  49. package/dist/esm/internals/core-api.d.ts.map +1 -1
  50. package/dist/esm/internals/edge.d.ts +4 -4
  51. package/dist/esm/internals/edge.d.ts.map +1 -1
  52. package/dist/esm/internals/reactive.d.ts +1 -0
  53. package/dist/esm/internals/reactive.d.ts.map +1 -1
  54. package/dist/esm/internals/scheduling.d.ts.map +1 -1
  55. package/dist/esm/internals/signal.d.ts +4 -0
  56. package/dist/esm/internals/signal.d.ts.map +1 -1
  57. package/dist/esm/internals/utils/snapshot.d.ts +29 -0
  58. package/dist/esm/internals/utils/snapshot.d.ts.map +1 -0
  59. package/dist/esm/production/config-CPQL7hX-.js.map +1 -1
  60. package/dist/esm/production/{contexts-CilfS6eG.js → contexts-DL91-2Y8.js} +158 -144
  61. package/dist/esm/production/contexts-DL91-2Y8.js.map +1 -0
  62. package/dist/esm/production/debug.js +51 -54
  63. package/dist/esm/production/debug.js.map +1 -1
  64. package/dist/esm/production/index.js +16 -15
  65. package/dist/esm/production/react/index.js +43 -38
  66. package/dist/esm/production/react/index.js.map +1 -1
  67. package/dist/esm/production/snapshot-Cj4ycaEt.js +148 -0
  68. package/dist/esm/production/snapshot-Cj4ycaEt.js.map +1 -0
  69. package/dist/esm/production/transform/index.js +137 -118
  70. package/dist/esm/production/transform/index.js.map +1 -1
  71. package/dist/esm/production/utils.js +7 -4
  72. package/dist/esm/production/utils.js.map +1 -1
  73. package/dist/esm/react/index.d.ts +1 -1
  74. package/dist/esm/react/index.d.ts.map +1 -1
  75. package/dist/esm/react/provider.d.ts.map +1 -1
  76. package/dist/esm/react/use-reactive.d.ts +1 -0
  77. package/dist/esm/react/use-reactive.d.ts.map +1 -1
  78. package/dist/esm/transform/callback.d.ts.map +1 -1
  79. package/dist/esm/transform/promise.d.ts.map +1 -1
  80. package/dist/esm/utils.d.ts +1 -0
  81. package/dist/esm/utils.d.ts.map +1 -1
  82. package/package.json +7 -5
  83. package/dist/cjs/development/core-api-C6HCIyL3.js +0 -55
  84. package/dist/cjs/development/core-api-C6HCIyL3.js.map +0 -1
  85. package/dist/cjs/development/debug-3nd-6Gnf.js.map +0 -1
  86. package/dist/cjs/production/contexts-DoZWv_3I.js.map +0 -1
  87. package/dist/cjs/production/core-api-CUviCxtM.js +0 -55
  88. package/dist/cjs/production/core-api-CUviCxtM.js.map +0 -1
  89. package/dist/esm/development/core-api-CjsScNn1.js +0 -56
  90. package/dist/esm/development/core-api-CjsScNn1.js.map +0 -1
  91. package/dist/esm/development/debug-BfudYKc4.js.map +0 -1
  92. package/dist/esm/production/contexts-CilfS6eG.js.map +0 -1
  93. package/dist/esm/production/core-api-tTQttL8R.js +0 -56
  94. package/dist/esm/production/core-api-tTQttL8R.js.map +0 -1
@@ -21,53 +21,56 @@ const createTransformedImports = (defaultImports, additionalImports, globalImpor
21
21
  return transformedImports;
22
22
  };
23
23
  function createSignaliumAsyncTransform(api, opts) {
24
- const transformedImports = createTransformedImports(
25
- [
26
- ["callback", ["signalium"]],
27
- ["reactive", ["signalium"]],
28
- ["reactiveMethod", ["signalium"]],
29
- ["relay", ["signalium"]],
30
- ["task", ["signalium"]],
31
- ["watcher", ["signalium"]]
32
- ],
33
- opts?.transformedImports,
34
- opts?.importPaths
35
- );
24
+ const transformedImports = createTransformedImports([
25
+ ["callback", ["signalium"]],
26
+ ["reactive", ["signalium"]],
27
+ ["reactiveMethod", ["signalium"]],
28
+ ["relay", ["signalium"]],
29
+ ["task", ["signalium"]],
30
+ ["watcher", ["signalium"]]
31
+ ], opts?.transformedImports, opts?.importPaths);
36
32
  const t = api.types;
37
33
  const isTrackedImport = (localName, path) => {
38
34
  const binding = path.scope.getBinding(localName);
39
- if (!binding || !t.isImportSpecifier(binding.path.node)) return false;
35
+ if (!binding || !t.isImportSpecifier(binding.path.node))
36
+ return false;
40
37
  const importSpec = binding.path.node;
41
38
  const importedName = importSpec.imported.name;
42
39
  const importDecl = binding.path.parent;
43
- if (!t.isImportDeclaration(importDecl)) return false;
40
+ if (!t.isImportDeclaration(importDecl))
41
+ return false;
44
42
  const importPaths = transformedImports.get(importedName);
45
- if (!importPaths) return false;
46
- return importPaths.some(
47
- (p) => typeof p === "string" ? importDecl.source.value === p : p.test(importDecl.source.value)
48
- );
43
+ if (!importPaths)
44
+ return false;
45
+ return importPaths.some((p) => typeof p === "string" ? importDecl.source.value === p : p.test(importDecl.source.value));
49
46
  };
50
47
  const isReactiveCall = (path) => {
51
- if (!t.isCallExpression(path.node)) return false;
48
+ if (!t.isCallExpression(path.node))
49
+ return false;
52
50
  const callee = path.node.callee;
53
- if (!t.isIdentifier(callee)) return false;
51
+ if (!t.isIdentifier(callee))
52
+ return false;
54
53
  return isTrackedImport(callee.name, path);
55
54
  };
56
55
  const isWithinTrackedCall = (path) => {
57
56
  let current = path.parentPath;
58
57
  while (current) {
59
- if (current.isCallExpression() && isReactiveCall(current)) return true;
58
+ if (current.isCallExpression() && isReactiveCall(current))
59
+ return true;
60
60
  current = current.parentPath;
61
61
  }
62
62
  return false;
63
63
  };
64
64
  function convertReactiveToGenerator(path) {
65
- if (!isWithinTrackedCall(path)) return;
66
- if (!path.node.async) return;
65
+ if (!isWithinTrackedCall(path))
66
+ return;
67
+ if (!path.node.async)
68
+ return;
67
69
  path.traverse({
68
70
  AwaitExpression(awaitPath) {
69
71
  const funcParent = awaitPath.getFunctionParent();
70
- if (funcParent?.node !== path.node) return;
72
+ if (funcParent?.node !== path.node)
73
+ return;
71
74
  awaitPath.replaceWith(t.yieldExpression(awaitPath.node.argument));
72
75
  }
73
76
  });
@@ -105,37 +108,37 @@ function signaliumAsyncTransform(apiOrOpts, maybeOpts) {
105
108
  return (api) => createSignaliumAsyncTransform(api, apiOrOpts);
106
109
  }
107
110
  function createSignaliumCallbackTransform(api, opts) {
108
- const transformedImports = createTransformedImports(
109
- [
110
- ["component", ["signalium/react"]],
111
- ["reactive", ["signalium"]],
112
- ["reactiveMethod", ["signalium"]],
113
- ["relay", ["signalium"]],
114
- ["task", ["signalium"]]
115
- ],
116
- opts?.transformedImports,
117
- opts?.importPaths
118
- );
111
+ const transformedImports = createTransformedImports([
112
+ ["component", ["signalium/react"]],
113
+ ["reactive", ["signalium"]],
114
+ ["reactiveMethod", ["signalium"]],
115
+ ["relay", ["signalium"]],
116
+ ["task", ["signalium"]],
117
+ ["watcher", ["signalium"]]
118
+ ], opts?.transformedImports, opts?.importPaths);
119
119
  const t = api.types;
120
120
  const callbackImportPath = opts?.callbackImportPath ?? "signalium";
121
121
  const isTrackedImport = (localName, path) => {
122
122
  const binding = path.scope.getBinding(localName);
123
- if (!binding || !t.isImportSpecifier(binding.path.node)) return false;
123
+ if (!binding || !t.isImportSpecifier(binding.path.node))
124
+ return false;
124
125
  const importSpec = binding.path.node;
125
126
  const importedName = importSpec.imported.name;
126
127
  const importDecl = binding.path.parent;
127
- if (!t.isImportDeclaration(importDecl)) return false;
128
+ if (!t.isImportDeclaration(importDecl))
129
+ return false;
128
130
  const importPaths = transformedImports.get(importedName);
129
- if (!importPaths) return false;
130
- const matches = importPaths.find(
131
- (p) => typeof p === "string" ? importDecl.source.value === p : p.test(importDecl.source.value)
132
- );
131
+ if (!importPaths)
132
+ return false;
133
+ const matches = importPaths.find((p) => typeof p === "string" ? importDecl.source.value === p : p.test(importDecl.source.value));
133
134
  return matches ? typeof matches === "string" ? matches : importDecl.source.value : false;
134
135
  };
135
136
  const isTargetWrapperCall = (path) => {
136
- if (!t.isCallExpression(path.node)) return false;
137
+ if (!t.isCallExpression(path.node))
138
+ return false;
137
139
  const callee = path.node.callee;
138
- if (!t.isIdentifier(callee)) return false;
140
+ if (!t.isIdentifier(callee))
141
+ return false;
139
142
  return !!isTrackedImport(callee.name, path);
140
143
  };
141
144
  function isIdentifierInTypePosition(refPath) {
@@ -145,7 +148,8 @@ function createSignaliumCallbackTransform(api, opts) {
145
148
  const nodeType = current.node.type;
146
149
  if (nodeType && nodeType.startsWith("TS")) {
147
150
  if (current.isTSAsExpression() || current.isTSSatisfiesExpression?.() || current.isTSNonNullExpression() || current.isTSInstantiationExpression?.()) {
148
- if (child.key === "expression") return false;
151
+ if (child.key === "expression")
152
+ return false;
149
153
  return true;
150
154
  }
151
155
  return true;
@@ -157,9 +161,11 @@ function createSignaliumCallbackTransform(api, opts) {
157
161
  }
158
162
  function ensureCallbackIdentifier(programPath) {
159
163
  for (const bodyPath of programPath.get("body")) {
160
- if (!bodyPath.isImportDeclaration()) continue;
164
+ if (!bodyPath.isImportDeclaration())
165
+ continue;
161
166
  const importDecl2 = bodyPath.node;
162
- if (importDecl2.source.value !== callbackImportPath) continue;
167
+ if (importDecl2.source.value !== callbackImportPath)
168
+ continue;
163
169
  for (const spec of importDecl2.specifiers) {
164
170
  if (spec.type === "ImportSpecifier") {
165
171
  const ispec = spec;
@@ -171,18 +177,17 @@ function createSignaliumCallbackTransform(api, opts) {
171
177
  }
172
178
  }
173
179
  for (const bodyPath of programPath.get("body")) {
174
- if (!bodyPath.isImportDeclaration()) continue;
180
+ if (!bodyPath.isImportDeclaration())
181
+ continue;
175
182
  const node = bodyPath.node;
176
- if (node.source.value !== callbackImportPath) continue;
183
+ if (node.source.value !== callbackImportPath)
184
+ continue;
177
185
  const localName2 = programPath.scope.generateUidIdentifier("callback").name;
178
186
  node.specifiers.push(t.importSpecifier(t.identifier(localName2), t.identifier("callback")));
179
187
  return localName2;
180
188
  }
181
189
  const localName = "callback";
182
- const importDecl = t.importDeclaration(
183
- [t.importSpecifier(t.identifier(localName), t.identifier("callback"))],
184
- t.stringLiteral(callbackImportPath)
185
- );
190
+ const importDecl = t.importDeclaration([t.importSpecifier(t.identifier(localName), t.identifier("callback"))], t.stringLiteral(callbackImportPath));
186
191
  const [first] = programPath.get("body");
187
192
  if (first) {
188
193
  first.insertBefore(importDecl);
@@ -198,18 +203,24 @@ function createSignaliumCallbackTransform(api, opts) {
198
203
  innerFn.traverse({
199
204
  ReferencedIdentifier(refPath) {
200
205
  const nearestFn = refPath.getFunctionParent();
201
- if (!nearestFn || nearestFn.node !== innerNode) return;
206
+ if (!nearestFn || nearestFn.node !== innerNode)
207
+ return;
202
208
  const name = refPath.node.name;
203
209
  const binding = refPath.scope.getBinding(name);
204
- if (!binding) return;
205
- if (isIdentifierInTypePosition(refPath)) return;
206
- if (binding.scope.path.isProgram()) return;
210
+ if (!binding)
211
+ return;
212
+ if (isIdentifierInTypePosition(refPath))
213
+ return;
214
+ if (binding.scope.path.isProgram())
215
+ return;
207
216
  let declScope = binding.scope;
208
217
  while (declScope) {
209
- if (declScope === innerScope) return;
218
+ if (declScope === innerScope)
219
+ return;
210
220
  declScope = declScope.parent;
211
221
  }
212
- if (binding.kind === "param" && binding.scope === innerScope) return;
222
+ if (binding.kind === "param" && binding.scope === innerScope)
223
+ return;
213
224
  depNames.add(name);
214
225
  }
215
226
  });
@@ -219,10 +230,13 @@ function createSignaliumCallbackTransform(api, opts) {
219
230
  name: "signalium-transform-callback-wrapping",
220
231
  visitor: {
221
232
  CallExpression(callPath) {
222
- if (!isTargetWrapperCall(callPath)) return;
233
+ if (!isTargetWrapperCall(callPath))
234
+ return;
223
235
  const arg0 = callPath.get("arguments")[0];
224
- if (!arg0) return;
225
- if (!(arg0.isFunctionExpression() || arg0.isArrowFunctionExpression())) return;
236
+ if (!arg0)
237
+ return;
238
+ if (!(arg0.isFunctionExpression() || arg0.isArrowFunctionExpression()))
239
+ return;
226
240
  const outerFn = arg0;
227
241
  const programPath = callPath.findParent((p) => p.isProgram());
228
242
  const callbackName = ensureCallbackIdentifier(programPath);
@@ -237,10 +251,12 @@ function createSignaliumCallbackTransform(api, opts) {
237
251
  // Initialize counters for any function-like node when first seen
238
252
  FunctionExpression: {
239
253
  enter(fnPath) {
240
- if (!counters.has(fnPath.node)) counters.set(fnPath.node, 0);
254
+ if (!counters.has(fnPath.node))
255
+ counters.set(fnPath.node, 0);
241
256
  },
242
257
  exit(innerFnPath) {
243
- if (innerFnPath.node === outerFn.node) return;
258
+ if (innerFnPath.node === outerFn.node)
259
+ return;
244
260
  const immediateParent = innerFnPath.parentPath;
245
261
  if (immediateParent && immediateParent.isCallExpression()) {
246
262
  const callee = immediateParent.node.callee;
@@ -287,10 +303,12 @@ function createSignaliumCallbackTransform(api, opts) {
287
303
  },
288
304
  ArrowFunctionExpression: {
289
305
  enter(fnPath) {
290
- if (!counters.has(fnPath.node)) counters.set(fnPath.node, 0);
306
+ if (!counters.has(fnPath.node))
307
+ counters.set(fnPath.node, 0);
291
308
  },
292
309
  exit(innerFnPath) {
293
- if (innerFnPath.node === outerFn.node) return;
310
+ if (innerFnPath.node === outerFn.node)
311
+ return;
294
312
  const immediateParent = innerFnPath.parentPath;
295
313
  if (immediateParent && immediateParent.isCallExpression()) {
296
314
  const callee = immediateParent.node.callee;
@@ -337,18 +355,14 @@ function createSignaliumCallbackTransform(api, opts) {
337
355
  },
338
356
  FunctionDeclaration: {
339
357
  enter(fnPath) {
340
- if (!counters.has(fnPath.node)) counters.set(fnPath.node, 0);
358
+ if (!counters.has(fnPath.node))
359
+ counters.set(fnPath.node, 0);
341
360
  },
342
361
  exit(innerDeclPath) {
343
362
  const id = innerDeclPath.node.id;
344
- if (!id) return;
345
- const fnExpr = t.functionExpression(
346
- id,
347
- innerDeclPath.node.params,
348
- innerDeclPath.node.body,
349
- innerDeclPath.node.generator,
350
- innerDeclPath.node.async
351
- );
363
+ if (!id)
364
+ return;
365
+ const fnExpr = t.functionExpression(id, innerDeclPath.node.params, innerDeclPath.node.body, innerDeclPath.node.generator, innerDeclPath.node.async);
352
366
  const deps = Array.from(collectDeps(innerDeclPath));
353
367
  const parentFn = innerDeclPath.parentPath?.getFunctionParent() || outerFn;
354
368
  const argIndex = getNextIndexFor(parentFn.node);
@@ -364,17 +378,13 @@ function createSignaliumCallbackTransform(api, opts) {
364
378
  },
365
379
  ObjectMethod: {
366
380
  enter(fnPath) {
367
- if (!counters.has(fnPath.node)) counters.set(fnPath.node, 0);
381
+ if (!counters.has(fnPath.node))
382
+ counters.set(fnPath.node, 0);
368
383
  },
369
384
  exit(innerMethodPath) {
370
- if (innerMethodPath.node.kind !== "method") return;
371
- const fnExpr = t.functionExpression(
372
- null,
373
- innerMethodPath.node.params,
374
- innerMethodPath.node.body,
375
- innerMethodPath.node.generator,
376
- innerMethodPath.node.async
377
- );
385
+ if (innerMethodPath.node.kind !== "method")
386
+ return;
387
+ const fnExpr = t.functionExpression(null, innerMethodPath.node.params, innerMethodPath.node.body, innerMethodPath.node.generator, innerMethodPath.node.async);
378
388
  const deps = Array.from(collectDeps(innerMethodPath));
379
389
  const parentFn = innerMethodPath.parentPath?.getFunctionParent() || outerFn;
380
390
  const argIndex = getNextIndexFor(parentFn.node);
@@ -404,51 +414,54 @@ function signaliumCallbackTransform(apiOrOpts, opts) {
404
414
  }
405
415
  const PROMISE_STATIC_METHODS = /* @__PURE__ */ new Set(["all", "race", "any", "allSettled", "resolve", "reject", "withResolvers"]);
406
416
  function createSignaliumPromiseMethodsTransform(api, opts) {
407
- const transformedImports = createTransformedImports(
408
- [
409
- ["callback", ["signalium"]],
410
- ["reactive", ["signalium"]],
411
- ["reactiveMethod", ["signalium"]],
412
- ["relay", ["signalium"]],
413
- ["task", ["signalium"]]
414
- ],
415
- opts?.transformedImports,
416
- opts?.importPaths
417
- );
417
+ const transformedImports = createTransformedImports([
418
+ ["callback", ["signalium"]],
419
+ ["reactive", ["signalium"]],
420
+ ["reactiveMethod", ["signalium"]],
421
+ ["relay", ["signalium"]],
422
+ ["task", ["signalium"]],
423
+ ["watcher", ["signalium"]]
424
+ ], opts?.transformedImports, opts?.importPaths);
418
425
  const t = api.types;
419
426
  const promiseImportPath = opts?.promiseImportPath ?? "signalium";
420
427
  const isTrackedImport = (localName, path) => {
421
428
  const binding = path.scope.getBinding(localName);
422
- if (!binding || !t.isImportSpecifier(binding.path.node)) return false;
429
+ if (!binding || !t.isImportSpecifier(binding.path.node))
430
+ return false;
423
431
  const importSpec = binding.path.node;
424
432
  const importedName = importSpec.imported.name;
425
433
  const importDecl = binding.path.parent;
426
- if (!t.isImportDeclaration(importDecl)) return false;
434
+ if (!t.isImportDeclaration(importDecl))
435
+ return false;
427
436
  const importPaths = transformedImports.get(importedName);
428
- if (!importPaths) return false;
429
- return importPaths.some(
430
- (p) => typeof p === "string" ? importDecl.source.value === p : p.test(importDecl.source.value)
431
- );
437
+ if (!importPaths)
438
+ return false;
439
+ return importPaths.some((p) => typeof p === "string" ? importDecl.source.value === p : p.test(importDecl.source.value));
432
440
  };
433
441
  const isReactiveCall = (path) => {
434
- if (!t.isCallExpression(path.node)) return false;
442
+ if (!t.isCallExpression(path.node))
443
+ return false;
435
444
  const callee = path.node.callee;
436
- if (!t.isIdentifier(callee)) return false;
445
+ if (!t.isIdentifier(callee))
446
+ return false;
437
447
  return isTrackedImport(callee.name, path);
438
448
  };
439
449
  const isWithinTrackedCall = (path) => {
440
450
  let current = path.parentPath;
441
451
  while (current) {
442
- if (current.isCallExpression() && isReactiveCall(current)) return true;
452
+ if (current.isCallExpression() && isReactiveCall(current))
453
+ return true;
443
454
  current = current.parentPath;
444
455
  }
445
456
  return false;
446
457
  };
447
458
  function ensureReactivePromiseIdentifier(programPath) {
448
459
  for (const bodyPath of programPath.get("body")) {
449
- if (!bodyPath.isImportDeclaration()) continue;
460
+ if (!bodyPath.isImportDeclaration())
461
+ continue;
450
462
  const importDecl2 = bodyPath.node;
451
- if (importDecl2.source.value !== promiseImportPath) continue;
463
+ if (importDecl2.source.value !== promiseImportPath)
464
+ continue;
452
465
  for (const spec of importDecl2.specifiers) {
453
466
  if (spec.type === "ImportSpecifier") {
454
467
  const ispec = spec;
@@ -460,18 +473,17 @@ function createSignaliumPromiseMethodsTransform(api, opts) {
460
473
  }
461
474
  }
462
475
  for (const bodyPath of programPath.get("body")) {
463
- if (!bodyPath.isImportDeclaration()) continue;
476
+ if (!bodyPath.isImportDeclaration())
477
+ continue;
464
478
  const node = bodyPath.node;
465
- if (node.source.value !== promiseImportPath) continue;
479
+ if (node.source.value !== promiseImportPath)
480
+ continue;
466
481
  const localName2 = "ReactivePromise";
467
482
  node.specifiers.push(t.importSpecifier(t.identifier(localName2), t.identifier("ReactivePromise")));
468
483
  return localName2;
469
484
  }
470
485
  const localName = "ReactivePromise";
471
- const importDecl = t.importDeclaration(
472
- [t.importSpecifier(t.identifier(localName), t.identifier("ReactivePromise"))],
473
- t.stringLiteral(promiseImportPath)
474
- );
486
+ const importDecl = t.importDeclaration([t.importSpecifier(t.identifier(localName), t.identifier("ReactivePromise"))], t.stringLiteral(promiseImportPath));
475
487
  const [first] = programPath.get("body");
476
488
  if (first) {
477
489
  first.insertBefore(importDecl);
@@ -484,17 +496,24 @@ function createSignaliumPromiseMethodsTransform(api, opts) {
484
496
  name: "signalium-transform-reactive-promise-methods",
485
497
  visitor: {
486
498
  CallExpression(callPath) {
487
- if (!isWithinTrackedCall(callPath)) return;
499
+ if (!isWithinTrackedCall(callPath))
500
+ return;
488
501
  const callee = callPath.node.callee;
489
- if (!t.isMemberExpression(callee)) return;
490
- if (callee.computed) return;
502
+ if (!t.isMemberExpression(callee))
503
+ return;
504
+ if (callee.computed)
505
+ return;
491
506
  const object = callee.object;
492
507
  const property = callee.property;
493
- if (!t.isIdentifier(object, { name: "Promise" })) return;
494
- if (callPath.scope.getBinding("Promise")) return;
495
- if (!t.isIdentifier(property)) return;
508
+ if (!t.isIdentifier(object, { name: "Promise" }))
509
+ return;
510
+ if (callPath.scope.getBinding("Promise"))
511
+ return;
512
+ if (!t.isIdentifier(property))
513
+ return;
496
514
  const methodName = property.name;
497
- if (!PROMISE_STATIC_METHODS.has(methodName)) return;
515
+ if (!PROMISE_STATIC_METHODS.has(methodName))
516
+ return;
498
517
  const programPath = callPath.findParent((p) => p.isProgram());
499
518
  const reactivePromiseId = ensureReactivePromiseIdentifier(programPath);
500
519
  const newCallee = t.memberExpression(t.identifier(reactivePromiseId), t.identifier(methodName));