signalium 2.2.2 → 2.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +18 -0
- package/dist/cjs/development/config-B0MtLBgx.js.map +1 -1
- package/dist/cjs/development/{debug-DuXQhd5q.js → debug-gCDAvnLM.js} +237 -214
- package/dist/cjs/development/debug-gCDAvnLM.js.map +1 -0
- package/dist/cjs/development/debug.js +9 -3
- package/dist/cjs/development/debug.js.map +1 -1
- package/dist/cjs/development/index.js +8 -8
- package/dist/cjs/development/react/index.js +43 -38
- package/dist/cjs/development/react/index.js.map +1 -1
- package/dist/cjs/development/snapshot-Di0yziPX.js +147 -0
- package/dist/cjs/development/snapshot-Di0yziPX.js.map +1 -0
- package/dist/cjs/development/transform/index.js +137 -118
- package/dist/cjs/development/transform/index.js.map +1 -1
- package/dist/cjs/development/utils.js +5 -3
- package/dist/cjs/development/utils.js.map +1 -1
- package/dist/cjs/production/config-B0MtLBgx.js.map +1 -1
- package/dist/cjs/production/{contexts-DOH1tHd8.js → contexts-Wgq2NOVX.js} +156 -140
- package/dist/cjs/production/contexts-Wgq2NOVX.js.map +1 -0
- package/dist/cjs/production/debug.js +61 -66
- package/dist/cjs/production/debug.js.map +1 -1
- package/dist/cjs/production/index.js +8 -8
- package/dist/cjs/production/react/index.js +43 -38
- package/dist/cjs/production/react/index.js.map +1 -1
- package/dist/cjs/production/snapshot-YJJyLbxS.js +147 -0
- package/dist/cjs/production/snapshot-YJJyLbxS.js.map +1 -0
- package/dist/cjs/production/transform/index.js +137 -118
- package/dist/cjs/production/transform/index.js.map +1 -1
- package/dist/cjs/production/utils.js +5 -3
- package/dist/cjs/production/utils.js.map +1 -1
- package/dist/esm/development/config-CPQL7hX-.js.map +1 -1
- package/dist/esm/development/{debug-E2E1pZe5.js → debug-AoHfqs62.js} +221 -196
- package/dist/esm/development/debug-AoHfqs62.js.map +1 -0
- package/dist/esm/development/debug.js +1 -1
- package/dist/esm/development/index.js +6 -6
- package/dist/esm/development/react/index.js +43 -38
- package/dist/esm/development/react/index.js.map +1 -1
- package/dist/esm/development/snapshot-Bq0Um_hQ.js +148 -0
- package/dist/esm/development/snapshot-Bq0Um_hQ.js.map +1 -0
- package/dist/esm/development/transform/index.js +137 -118
- package/dist/esm/development/transform/index.js.map +1 -1
- package/dist/esm/development/utils.js +7 -4
- package/dist/esm/development/utils.js.map +1 -1
- package/dist/esm/internals/async.d.ts.map +1 -1
- package/dist/esm/internals/core-api.d.ts +2 -2
- package/dist/esm/internals/core-api.d.ts.map +1 -1
- package/dist/esm/internals/edge.d.ts +4 -4
- package/dist/esm/internals/edge.d.ts.map +1 -1
- package/dist/esm/internals/reactive.d.ts +14 -4
- package/dist/esm/internals/reactive.d.ts.map +1 -1
- package/dist/esm/internals/scheduling.d.ts.map +1 -1
- package/dist/esm/internals/signal.d.ts.map +1 -1
- package/dist/esm/internals/utils/snapshot.d.ts +29 -0
- package/dist/esm/internals/utils/snapshot.d.ts.map +1 -0
- package/dist/esm/production/config-CPQL7hX-.js.map +1 -1
- package/dist/esm/production/{contexts-Dj9Y86xW.js → contexts-X0gSj6rQ.js} +159 -143
- package/dist/esm/production/contexts-X0gSj6rQ.js.map +1 -0
- package/dist/esm/production/debug.js +51 -54
- package/dist/esm/production/debug.js.map +1 -1
- package/dist/esm/production/index.js +7 -7
- package/dist/esm/production/react/index.js +43 -38
- package/dist/esm/production/react/index.js.map +1 -1
- package/dist/esm/production/snapshot-CDS1d8mq.js +148 -0
- package/dist/esm/production/snapshot-CDS1d8mq.js.map +1 -0
- package/dist/esm/production/transform/index.js +137 -118
- package/dist/esm/production/transform/index.js.map +1 -1
- package/dist/esm/production/utils.js +7 -4
- package/dist/esm/production/utils.js.map +1 -1
- package/dist/esm/react/index.d.ts +1 -1
- package/dist/esm/react/index.d.ts.map +1 -1
- package/dist/esm/react/provider.d.ts.map +1 -1
- package/dist/esm/react/use-reactive.d.ts +1 -0
- package/dist/esm/react/use-reactive.d.ts.map +1 -1
- package/dist/esm/transform/callback.d.ts.map +1 -1
- package/dist/esm/transform/promise.d.ts.map +1 -1
- package/dist/esm/types.d.ts +5 -1
- package/dist/esm/types.d.ts.map +1 -1
- package/dist/esm/utils.d.ts +1 -0
- package/dist/esm/utils.d.ts.map +1 -1
- package/package.json +7 -5
- package/dist/cjs/development/core-api-C8J7lYBC.js +0 -55
- package/dist/cjs/development/core-api-C8J7lYBC.js.map +0 -1
- package/dist/cjs/development/debug-DuXQhd5q.js.map +0 -1
- package/dist/cjs/production/contexts-DOH1tHd8.js.map +0 -1
- package/dist/cjs/production/core-api-Cx2_AumW.js +0 -55
- package/dist/cjs/production/core-api-Cx2_AumW.js.map +0 -1
- package/dist/esm/development/core-api-CF5aK2Lx.js +0 -56
- package/dist/esm/development/core-api-CF5aK2Lx.js.map +0 -1
- package/dist/esm/development/debug-E2E1pZe5.js.map +0 -1
- package/dist/esm/production/contexts-Dj9Y86xW.js.map +0 -1
- package/dist/esm/production/core-api-D_uw3umM.js +0 -56
- package/dist/esm/production/core-api-D_uw3umM.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../src/transform/utils.ts","../../../../src/transform/async.ts","../../../../src/transform/callback.ts","../../../../src/transform/promise.ts","../../../../src/transform/preset.ts"],"sourcesContent":["import { ConfigAPI } from '@babel/core';\n\nexport const isBabelApi = (value: unknown): value is ConfigAPI =>\n !!value && typeof value === 'object' && 'types' in value;\n\nexport const createTransformedImports = (\n defaultImports: [string, [string | RegExp]][],\n additionalImports?: [string, string | RegExp][],\n globalImportPaths?: (string | RegExp)[],\n) => {\n if (globalImportPaths) {\n defaultImports.forEach(([name, paths]) => {\n paths.push(...globalImportPaths);\n });\n }\n\n const transformedImports = new Map(defaultImports);\n\n if (additionalImports && additionalImports.length > 0) {\n for (const [name, path] of additionalImports) {\n const existing = transformedImports.get(name);\n if (existing) {\n existing.push(path);\n } else {\n transformedImports.set(name, [path]);\n }\n }\n }\n\n return transformedImports;\n};\n","import type { NodePath, PluginObj, types as t } from '@babel/core';\nimport { createTransformedImports, isBabelApi } from './utils.js';\n\nexport interface SignaliumAsyncTransformOptions {\n transformedImports: [string, string | RegExp][];\n importPaths?: (string | RegExp)[];\n}\n\nfunction createSignaliumAsyncTransform(api: any, opts?: SignaliumAsyncTransformOptions): PluginObj {\n const transformedImports = createTransformedImports(\n [\n ['callback', ['signalium']],\n ['reactive', ['signalium']],\n ['reactiveMethod', ['signalium']],\n ['relay', ['signalium']],\n ['task', ['signalium']],\n ['watcher', ['signalium']],\n ],\n opts?.transformedImports,\n opts?.importPaths,\n );\n\n const t = api.types;\n\n const isTrackedImport = (localName: string, path: NodePath<any>): boolean => {\n const binding = path.scope.getBinding(localName);\n if (!binding || !t.isImportSpecifier(binding.path.node)) return false;\n\n const importSpec = binding.path.node as t.ImportSpecifier;\n const importedName = (importSpec.imported as t.Identifier).name;\n const importDecl = binding.path.parent as t.ImportDeclaration;\n if (!t.isImportDeclaration(importDecl)) return false;\n\n const importPaths = transformedImports.get(importedName);\n if (!importPaths) return false;\n\n return importPaths.some(p =>\n typeof p === 'string' ? importDecl.source.value === p : p.test(importDecl.source.value),\n );\n };\n\n const isReactiveCall = (path: NodePath<any>) => {\n if (!t.isCallExpression(path.node)) return false;\n const callee = path.node.callee;\n if (!t.isIdentifier(callee)) return false;\n return isTrackedImport(callee.name, path);\n };\n\n const isWithinTrackedCall = (path: NodePath) => {\n let current: NodePath | null = path.parentPath;\n while (current) {\n if (current.isCallExpression() && isReactiveCall(current as any)) return true;\n current = current.parentPath;\n }\n return false;\n };\n\n function convertReactiveToGenerator(path: NodePath<t.FunctionExpression | t.ArrowFunctionExpression>) {\n if (!isWithinTrackedCall(path)) return;\n if (!path.node.async) return;\n\n path.traverse({\n AwaitExpression(awaitPath) {\n const funcParent = awaitPath.getFunctionParent();\n if (funcParent?.node !== path.node) return;\n awaitPath.replaceWith(t.yieldExpression(awaitPath.node.argument));\n },\n });\n\n path.node.async = false;\n\n if (t.isArrowFunctionExpression(path.node)) {\n let hasThis = false;\n path.traverse({\n ThisExpression() {\n hasThis = true;\n },\n });\n\n const functionBody = t.isBlockStatement(path.node.body)\n ? path.node.body\n : t.blockStatement([t.returnStatement(path.node.body)]);\n\n const newFunction = t.functionExpression(null, path.node.params, functionBody, true, false);\n\n if (hasThis) {\n path.replaceWith(t.callExpression(t.memberExpression(newFunction, t.identifier('bind')), [t.thisExpression()]));\n } else {\n path.replaceWith(newFunction);\n }\n } else {\n path.node.generator = true;\n }\n }\n\n return {\n name: 'signalium-transform-reactive-async',\n visitor: {\n FunctionExpression: convertReactiveToGenerator,\n ArrowFunctionExpression: convertReactiveToGenerator,\n },\n };\n}\n\nexport function signaliumAsyncTransform(api: any, opts?: SignaliumAsyncTransformOptions): PluginObj;\nexport function signaliumAsyncTransform(opts?: SignaliumAsyncTransformOptions): (api: any) => PluginObj;\nexport function signaliumAsyncTransform(\n apiOrOpts?: any | SignaliumAsyncTransformOptions,\n maybeOpts?: SignaliumAsyncTransformOptions,\n): ((api: any) => PluginObj) | PluginObj {\n if (isBabelApi(apiOrOpts)) {\n return createSignaliumAsyncTransform(apiOrOpts as any, maybeOpts);\n }\n return (api: any) => createSignaliumAsyncTransform(api, apiOrOpts as SignaliumAsyncTransformOptions | undefined);\n}\n","import type { ConfigAPI, NodePath, PluginObj, types as t } from '@babel/core';\nimport { createTransformedImports, isBabelApi } from './utils.js';\n\nexport interface SignaliumCallbackTransformOptions {\n transformedImports: [string, string | RegExp][];\n importPaths?: (string | RegExp)[];\n callbackImportPath?: string;\n}\n\nfunction createSignaliumCallbackTransform(api: any, opts?: SignaliumCallbackTransformOptions) {\n const transformedImports = createTransformedImports(\n [\n ['component', ['signalium/react']],\n ['reactive', ['signalium']],\n ['reactiveMethod', ['signalium']],\n ['relay', ['signalium']],\n ['task', ['signalium']],\n ],\n\n opts?.transformedImports,\n opts?.importPaths,\n );\n\n const t = api.types;\n const callbackImportPath = opts?.callbackImportPath ?? 'signalium';\n\n const isTrackedImport = (localName: string, path: NodePath<any>): false | string => {\n const binding = path.scope.getBinding(localName);\n if (!binding || !t.isImportSpecifier(binding.path.node)) return false;\n\n const importSpec = binding.path.node as t.ImportSpecifier;\n const importedName = (importSpec.imported as t.Identifier).name;\n const importDecl = binding.path.parent as t.ImportDeclaration;\n if (!t.isImportDeclaration(importDecl)) return false;\n\n const importPaths = transformedImports.get(importedName);\n if (!importPaths) return false;\n\n const matches = importPaths.find(p =>\n typeof p === 'string' ? importDecl.source.value === p : p.test(importDecl.source.value),\n );\n\n return matches ? (typeof matches === 'string' ? matches : importDecl.source.value) : false;\n };\n\n const isTargetWrapperCall = (path: NodePath<any>) => {\n if (!t.isCallExpression(path.node)) return false;\n const callee = path.node.callee;\n if (!t.isIdentifier(callee)) return false;\n return !!isTrackedImport(callee.name, path);\n };\n\n function isIdentifierInTypePosition(refPath: NodePath<t.Identifier>): boolean {\n // Walk up ancestors and detect if the identifier is within TS type-only constructs\n // Allow identifiers inside the expression arm of TS* expression wrappers\n let current: NodePath | null = refPath.parentPath;\n let child: NodePath = refPath;\n while (current) {\n const nodeType = (current.node as any).type as string | undefined;\n if (nodeType && nodeType.startsWith('TS')) {\n if (\n current.isTSAsExpression() ||\n (current as any).isTSSatisfiesExpression?.() ||\n current.isTSNonNullExpression() ||\n (current as any).isTSInstantiationExpression?.()\n ) {\n // If we reached this TS* expression via its 'expression' arm, it's runtime, not type-only\n if (child.key === 'expression') return false;\n return true;\n }\n return true;\n }\n child = current;\n current = current.parentPath;\n }\n return false;\n }\n\n function ensureCallbackIdentifier(programPath: NodePath<t.Program>): string {\n // Try to find an existing direct import: import { callback as X } from 'signalium'\n for (const bodyPath of programPath.get('body')) {\n if (!bodyPath.isImportDeclaration()) continue;\n const importDecl = bodyPath.node as t.ImportDeclaration;\n if (importDecl.source.value !== callbackImportPath) continue;\n for (const spec of importDecl.specifiers) {\n if ((spec as any).type === 'ImportSpecifier') {\n const ispec = spec as unknown as t.ImportSpecifier;\n const imported = ispec.imported as t.Identifier;\n if (imported && (imported as any).name === 'callback') {\n return (ispec.local as t.Identifier).name;\n }\n }\n }\n }\n\n // Try to augment an existing import from 'signalium'\n for (const bodyPath of programPath.get('body')) {\n if (!bodyPath.isImportDeclaration()) continue;\n const node = bodyPath.node as t.ImportDeclaration;\n if (node.source.value !== callbackImportPath) continue;\n const localName = programPath.scope.generateUidIdentifier('callback').name;\n node.specifiers.push(t.importSpecifier(t.identifier(localName), t.identifier('callback')));\n return localName;\n }\n\n // Otherwise, insert a new import from 'signalium'\n const localName = 'callback';\n const importDecl = t.importDeclaration(\n [t.importSpecifier(t.identifier(localName), t.identifier('callback'))],\n t.stringLiteral(callbackImportPath),\n );\n\n const [first] = programPath.get('body');\n if (first) {\n first.insertBefore(importDecl);\n } else {\n programPath.pushContainer('body', importDecl);\n }\n\n return localName;\n }\n\n function collectDeps(\n innerFn: NodePath<t.FunctionExpression> | NodePath<t.ArrowFunctionExpression> | NodePath<t.FunctionDeclaration>,\n ) {\n const depNames = new Set<string>();\n const innerScope = innerFn.scope;\n const innerNode = innerFn.node as t.Function;\n innerFn.traverse({\n ReferencedIdentifier(refPath) {\n // Only consider refs whose nearest function parent is the inner function\n const nearestFn = refPath.getFunctionParent();\n if (!nearestFn || (nearestFn as any).node !== innerNode) return;\n\n const name = refPath.node.name;\n const binding = refPath.scope.getBinding(name);\n if (!binding) return;\n\n // Ignore identifiers that appear only in type positions\n if (isIdentifierInTypePosition(refPath as unknown as NodePath<t.Identifier>)) return;\n\n // Exclude module scope\n if (binding.scope.path.isProgram()) return;\n\n // Exclude identifiers declared within the inner function itself or any nested scope inside it\n let declScope: any = binding.scope;\n while (declScope) {\n if (declScope === innerScope) return;\n declScope = declScope.parent;\n }\n\n // Exclude only the inner function's own parameters\n if (binding.kind === 'param' && binding.scope === innerScope) return;\n\n depNames.add(name);\n },\n });\n return depNames;\n }\n\n return {\n name: 'signalium-transform-callback-wrapping',\n visitor: {\n CallExpression(callPath: NodePath<t.CallExpression>) {\n if (!isTargetWrapperCall(callPath)) return;\n\n const arg0 = callPath.get('arguments')[0] as NodePath | undefined;\n if (!arg0) return;\n if (!(arg0.isFunctionExpression() || arg0.isArrowFunctionExpression())) return;\n\n const outerFn = arg0 as NodePath<t.FunctionExpression | t.ArrowFunctionExpression>;\n const programPath = callPath.findParent((p: NodePath) => p.isProgram()) as NodePath<t.Program>;\n const callbackName = ensureCallbackIdentifier(programPath);\n\n // Maintain per-function counters\n const counters = new WeakMap<object, number>();\n counters.set(outerFn.node as unknown as object, 0);\n\n const getNextIndexFor = (fnNode: object) => {\n const current = counters.get(fnNode) ?? 0;\n counters.set(fnNode, current + 1);\n return current;\n };\n\n outerFn.traverse({\n // Initialize counters for any function-like node when first seen\n FunctionExpression: {\n enter(fnPath) {\n if (!counters.has(fnPath.node as unknown as object)) counters.set(fnPath.node as unknown as object, 0);\n },\n exit(innerFnPath) {\n if (innerFnPath.node === outerFn.node) return;\n // Skip converting when the function is passed directly as a callback\n // to a tracked call AND that call is nested within another tracked call.\n const immediateParent = innerFnPath.parentPath;\n if (immediateParent && immediateParent.isCallExpression()) {\n const callee = immediateParent.node.callee;\n if (t.isIdentifier(callee)) {\n const calleeId = callee as unknown as t.Identifier;\n if (isTrackedImport(calleeId.name, immediateParent as any)) {\n let current: NodePath | null = immediateParent.parentPath;\n while (current) {\n if (current.isCallExpression()) {\n const parentCallee = (current.node as t.CallExpression).callee;\n if (t.isIdentifier(parentCallee)) {\n const parentCalleeId = parentCallee as unknown as t.Identifier;\n if (isTrackedImport(parentCalleeId.name, current as any)) {\n return; // nested direct callback – skip\n }\n }\n }\n current = current.parentPath;\n }\n }\n }\n }\n // Skip if already wrapped in callback()\n const parent = innerFnPath.parentPath;\n if (parent && parent.isCallExpression()) {\n const callee = parent.node.callee;\n if (t.isIdentifier(callee)) {\n const calleeId = callee as unknown as t.Identifier;\n if (calleeId.name === callbackName) {\n return;\n }\n }\n }\n const deps = Array.from(collectDeps(innerFnPath as NodePath<t.FunctionExpression>));\n // Determine parent function to index against\n const parentFn = (innerFnPath.parentPath?.getFunctionParent() || outerFn) as NodePath<any>;\n const argIndex = getNextIndexFor(parentFn.node as unknown as object);\n const args = [innerFnPath.node as t.Expression, t.numericLiteral(argIndex)] as t.Expression[];\n if (deps.length > 0) {\n args.push(t.arrayExpression(deps.map(n => t.identifier(n))));\n }\n const wrapped = t.callExpression(t.identifier(callbackName), args);\n innerFnPath.replaceWith(wrapped);\n innerFnPath.skip();\n },\n },\n ArrowFunctionExpression: {\n enter(fnPath) {\n if (!counters.has(fnPath.node as unknown as object)) counters.set(fnPath.node as unknown as object, 0);\n },\n exit(innerFnPath) {\n if (innerFnPath.node === outerFn.node) return;\n // Skip converting when the function is passed directly as a callback\n // to a tracked call AND that call is nested within another tracked call.\n const immediateParent = innerFnPath.parentPath;\n if (immediateParent && immediateParent.isCallExpression()) {\n const callee = immediateParent.node.callee;\n if (t.isIdentifier(callee)) {\n const calleeId = callee as unknown as t.Identifier;\n if (isTrackedImport(calleeId.name, immediateParent as any)) {\n let current: NodePath | null = immediateParent.parentPath;\n while (current) {\n if (current.isCallExpression()) {\n const parentCallee = (current.node as t.CallExpression).callee;\n if (t.isIdentifier(parentCallee)) {\n const parentCalleeId = parentCallee as unknown as t.Identifier;\n if (isTrackedImport(parentCalleeId.name, current as any)) {\n return; // nested direct callback – skip\n }\n }\n }\n current = current.parentPath;\n }\n }\n }\n }\n // Skip if already wrapped in callback()\n const parent = innerFnPath.parentPath;\n if (parent && parent.isCallExpression()) {\n const callee = parent.node.callee;\n if (t.isIdentifier(callee)) {\n const calleeId = callee as unknown as t.Identifier;\n if (calleeId.name === callbackName) {\n return;\n }\n }\n }\n const deps = Array.from(collectDeps(innerFnPath as NodePath<t.ArrowFunctionExpression>));\n const parentFn = (innerFnPath.parentPath?.getFunctionParent() || outerFn) as NodePath<any>;\n const argIndex = getNextIndexFor(parentFn.node as unknown as object);\n const args = [innerFnPath.node as t.Expression, t.numericLiteral(argIndex)] as t.Expression[];\n if (deps.length > 0) {\n args.push(t.arrayExpression(deps.map(n => t.identifier(n))));\n }\n const wrapped = t.callExpression(t.identifier(callbackName), args);\n innerFnPath.replaceWith(wrapped);\n innerFnPath.skip();\n },\n },\n FunctionDeclaration: {\n enter(fnPath) {\n if (!counters.has(fnPath.node as unknown as object)) counters.set(fnPath.node as unknown as object, 0);\n },\n exit(innerDeclPath) {\n const id = innerDeclPath.node.id;\n if (!id) return;\n\n const fnExpr = t.functionExpression(\n id,\n innerDeclPath.node.params,\n innerDeclPath.node.body,\n innerDeclPath.node.generator,\n innerDeclPath.node.async,\n );\n\n const deps = Array.from(collectDeps(innerDeclPath as unknown as NodePath<t.FunctionDeclaration>));\n\n const parentFn = (innerDeclPath.parentPath?.getFunctionParent() || outerFn) as NodePath<any>;\n const argIndex = getNextIndexFor(parentFn.node as unknown as object);\n const args = [fnExpr as t.Expression, t.numericLiteral(argIndex)] as t.Expression[];\n if (deps.length > 0) {\n args.push(t.arrayExpression(deps.map(n => t.identifier(n))));\n }\n const wrapped = t.callExpression(t.identifier(callbackName), args);\n\n const constDecl = t.variableDeclaration('const', [t.variableDeclarator(id, wrapped)]);\n innerDeclPath.replaceWith(constDecl);\n innerDeclPath.skip();\n },\n },\n ObjectMethod: {\n enter(fnPath) {\n if (!counters.has(fnPath.node as unknown as object)) counters.set(fnPath.node as unknown as object, 0);\n },\n exit(innerMethodPath) {\n if (innerMethodPath.node.kind !== 'method') return;\n const fnExpr = t.functionExpression(\n null,\n innerMethodPath.node.params,\n innerMethodPath.node.body,\n innerMethodPath.node.generator,\n innerMethodPath.node.async,\n );\n const deps = Array.from(collectDeps(innerMethodPath as unknown as NodePath<t.FunctionExpression>));\n const parentFn = (innerMethodPath.parentPath?.getFunctionParent() || outerFn) as NodePath<any>;\n const argIndex = getNextIndexFor(parentFn.node as unknown as object);\n const args = [fnExpr as t.Expression, t.numericLiteral(argIndex)] as t.Expression[];\n if (deps.length > 0) {\n args.push(t.arrayExpression(deps.map(n => t.identifier(n))));\n }\n const wrapped = t.callExpression(t.identifier(callbackName), args);\n\n const key = innerMethodPath.node.key;\n const computed = innerMethodPath.node.computed || false;\n const prop = t.objectProperty(key, wrapped, computed);\n innerMethodPath.replaceWith(prop);\n innerMethodPath.skip();\n },\n },\n });\n },\n },\n };\n}\n\nexport function signaliumCallbackTransform(api: any, opts?: SignaliumCallbackTransformOptions): PluginObj;\nexport function signaliumCallbackTransform(opts?: SignaliumCallbackTransformOptions): (api: any) => PluginObj;\nexport function signaliumCallbackTransform(\n apiOrOpts: any | SignaliumCallbackTransformOptions,\n opts?: SignaliumCallbackTransformOptions,\n): ((api: any) => PluginObj) | PluginObj {\n if (isBabelApi(apiOrOpts)) {\n return createSignaliumCallbackTransform(apiOrOpts, opts);\n } else {\n return (api: any) => createSignaliumCallbackTransform(api, apiOrOpts);\n }\n}\n","import type { NodePath, PluginObj, types as t } from '@babel/core';\nimport { createTransformedImports, isBabelApi } from './utils.js';\n\nexport interface SignaliumPromiseMethodsTransformOptions {\n transformedImports: [string, string | RegExp][];\n importPaths?: (string | RegExp)[];\n promiseImportPath?: string;\n}\n\nconst PROMISE_STATIC_METHODS = new Set(['all', 'race', 'any', 'allSettled', 'resolve', 'reject', 'withResolvers']);\n\nfunction createSignaliumPromiseMethodsTransform(api: any, opts?: SignaliumPromiseMethodsTransformOptions): PluginObj {\n const transformedImports = createTransformedImports(\n [\n ['callback', ['signalium']],\n ['reactive', ['signalium']],\n ['reactiveMethod', ['signalium']],\n ['relay', ['signalium']],\n ['task', ['signalium']],\n ],\n opts?.transformedImports,\n opts?.importPaths,\n );\n\n const t = api.types as typeof import('@babel/types');\n const promiseImportPath = opts?.promiseImportPath ?? 'signalium';\n\n const isTrackedImport = (localName: string, path: NodePath<any>): boolean => {\n const binding = path.scope.getBinding(localName);\n if (!binding || !t.isImportSpecifier(binding.path.node)) return false;\n const importSpec = binding.path.node as t.ImportSpecifier;\n const importedName = (importSpec.imported as t.Identifier).name;\n const importDecl = binding.path.parent as t.ImportDeclaration;\n if (!t.isImportDeclaration(importDecl)) return false;\n const importPaths = transformedImports.get(importedName);\n if (!importPaths) return false;\n return importPaths.some(p =>\n typeof p === 'string' ? importDecl.source.value === p : p.test(importDecl.source.value),\n );\n };\n\n const isReactiveCall = (path: NodePath<any>) => {\n if (!t.isCallExpression(path.node)) return false;\n const callee = path.node.callee;\n if (!t.isIdentifier(callee)) return false;\n return isTrackedImport(callee.name, path);\n };\n\n const isWithinTrackedCall = (path: NodePath) => {\n let current: NodePath | null = path.parentPath;\n while (current) {\n if (current.isCallExpression() && isReactiveCall(current as any)) return true;\n current = current.parentPath;\n }\n return false;\n };\n\n function ensureReactivePromiseIdentifier(programPath: NodePath<t.Program>): string {\n for (const bodyPath of programPath.get('body')) {\n if (!bodyPath.isImportDeclaration()) continue;\n const importDecl = bodyPath.node as t.ImportDeclaration;\n if (importDecl.source.value !== promiseImportPath) continue;\n for (const spec of importDecl.specifiers) {\n if ((spec as any).type === 'ImportSpecifier') {\n const ispec = spec as unknown as t.ImportSpecifier;\n const imported = ispec.imported as t.Identifier;\n if (imported && (imported as any).name === 'ReactivePromise') {\n return (ispec.local as t.Identifier).name;\n }\n }\n }\n }\n\n for (const bodyPath of programPath.get('body')) {\n if (!bodyPath.isImportDeclaration()) continue;\n const node = bodyPath.node as t.ImportDeclaration;\n if (node.source.value !== promiseImportPath) continue;\n const localName = 'ReactivePromise';\n node.specifiers.push(t.importSpecifier(t.identifier(localName), t.identifier('ReactivePromise')));\n return localName;\n }\n\n const localName = 'ReactivePromise';\n const importDecl = t.importDeclaration(\n [t.importSpecifier(t.identifier(localName), t.identifier('ReactivePromise'))],\n t.stringLiteral(promiseImportPath),\n );\n\n const [first] = programPath.get('body');\n if (first) {\n first.insertBefore(importDecl);\n } else {\n programPath.pushContainer('body', importDecl);\n }\n\n return localName;\n }\n\n return {\n name: 'signalium-transform-reactive-promise-methods',\n visitor: {\n CallExpression(callPath: NodePath<t.CallExpression>) {\n if (!isWithinTrackedCall(callPath)) return;\n\n const callee = callPath.node.callee;\n if (!t.isMemberExpression(callee)) return;\n if (callee.computed) return;\n\n const object = callee.object;\n const property = callee.property;\n\n if (!t.isIdentifier(object, { name: 'Promise' })) return;\n if (callPath.scope.getBinding('Promise')) return;\n\n if (!t.isIdentifier(property)) return;\n const methodName = property.name;\n if (!PROMISE_STATIC_METHODS.has(methodName)) return;\n\n const programPath = callPath.findParent((p: NodePath) => p.isProgram()) as NodePath<t.Program>;\n const reactivePromiseId = ensureReactivePromiseIdentifier(programPath);\n const newCallee = t.memberExpression(t.identifier(reactivePromiseId), t.identifier(methodName));\n callPath.node.callee = newCallee;\n },\n },\n };\n}\n\nexport function signaliumPromiseMethodsTransform(api: any, opts?: SignaliumPromiseMethodsTransformOptions): PluginObj;\nexport function signaliumPromiseMethodsTransform(\n opts?: SignaliumPromiseMethodsTransformOptions,\n): (api: any) => PluginObj;\nexport function signaliumPromiseMethodsTransform(\n apiOrOpts?: any | SignaliumPromiseMethodsTransformOptions,\n maybeOpts?: SignaliumPromiseMethodsTransformOptions,\n): ((api: any) => PluginObj) | PluginObj {\n if (isBabelApi(apiOrOpts)) {\n return createSignaliumPromiseMethodsTransform(apiOrOpts as any, maybeOpts);\n }\n return (api: any) =>\n createSignaliumPromiseMethodsTransform(api, apiOrOpts as SignaliumPromiseMethodsTransformOptions | undefined);\n}\n","import { signaliumAsyncTransform } from './async.js';\nimport { signaliumCallbackTransform } from './callback.js';\nimport { signaliumPromiseMethodsTransform } from './promise.js';\nimport { isBabelApi } from './utils.js';\n\nexport interface SignaliumTransformOptions {\n transformedImports?: [string, string | RegExp][];\n importPaths?: (string | RegExp)[];\n callbackImportPath?: string;\n promiseImportPath?: string;\n}\n\n// Babel preset that sequences the two plugins just like separate entries\n// Usage in babel config: presets: [[require('signalium/transform').signaliumPreset(options)]\nfunction createSignaliumPreset(api: any, opts?: SignaliumTransformOptions) {\n return {\n plugins: [\n signaliumCallbackTransform({\n transformedImports: opts?.transformedImports ?? [],\n importPaths: opts?.importPaths,\n callbackImportPath: opts?.callbackImportPath,\n }),\n signaliumAsyncTransform({ transformedImports: opts?.transformedImports ?? [], importPaths: opts?.importPaths }),\n signaliumPromiseMethodsTransform({\n transformedImports: opts?.transformedImports ?? [],\n importPaths: opts?.importPaths,\n promiseImportPath: opts?.promiseImportPath,\n }),\n ],\n };\n}\n\nexport function signaliumPreset(api: any, opts?: SignaliumTransformOptions): any;\nexport function signaliumPreset(opts?: SignaliumTransformOptions): (api: any) => any;\nexport function signaliumPreset(\n apiOrOpts?: any | SignaliumTransformOptions,\n maybeOpts?: SignaliumTransformOptions,\n): ((api: any) => any) | any {\n if (isBabelApi(apiOrOpts)) {\n return createSignaliumPreset(apiOrOpts as any, maybeOpts);\n }\n return (api: any) => createSignaliumPreset(api, apiOrOpts as SignaliumTransformOptions | undefined);\n}\n"],"names":["importDecl","localName"],"mappings":";;AAEO,MAAM,aAAa,CAAC,UACzB,CAAC,CAAC,SAAS,OAAO,UAAU,YAAY,WAAW;AAE9C,MAAM,2BAA2B,CACtC,gBACA,mBACA,sBACG;AACH,MAAI,mBAAmB;AACrB,mBAAe,QAAQ,CAAC,CAAC,MAAM,KAAK,MAAM;AACxC,YAAM,KAAK,GAAG,iBAAiB;AAAA,IACjC,CAAC;AAAA,EACH;AAEA,QAAM,qBAAqB,IAAI,IAAI,cAAc;AAEjD,MAAI,qBAAqB,kBAAkB,SAAS,GAAG;AACrD,eAAW,CAAC,MAAM,IAAI,KAAK,mBAAmB;AAC5C,YAAM,WAAW,mBAAmB,IAAI,IAAI;AAC5C,UAAI,UAAU;AACZ,iBAAS,KAAK,IAAI;AAAA,MACpB,OAAO;AACL,2BAAmB,IAAI,MAAM,CAAC,IAAI,CAAC;AAAA,MACrC;AAAA,IACF;AAAA,EACF;AAEA,SAAO;AACT;ACtBA,SAAS,8BAA8B,KAAU,MAAkD;AACjG,QAAM,qBAAqB;AAAA,IACzB;AAAA,MACE,CAAC,YAAY,CAA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A,MAAA,CAC3B;AAAA,MACD,wBAAwB,EAAE,oBAAoB,MAAM,sBAAsB,CAAA,GAAI,aAAa,MAAM,aAAa;AAAA,MAC9G,iCAAiC;AAAA,QAC/B,oBAAoB,MAAM,sBAAsB,CAAA;AAAA,QAChD,aAAa,MAAM;AAAA,QACnB,mBAAmB,MAAM;AAAA,MAAA,CAC1B;AAAA,IAAA;AAAA,EACH;AAEJ;AAIO,SAAS,gBACd,WACA,WAC2B;AAC3B,MAAI,WAAW,SAAS,GAAG;AACzB,WAAO,sBAAsB,WAAkB,SAAS;AAAA,EAC1D;AACA,SAAO,CAAC,QAAa,sBAAsB,KAAK,SAAkD;AACpG;;;;;"}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../.tsc-out/transform/utils.js","../../../../.tsc-out/transform/async.js","../../../../.tsc-out/transform/callback.js","../../../../.tsc-out/transform/promise.js","../../../../.tsc-out/transform/preset.js"],"sourcesContent":["export const isBabelApi = (value) => !!value && typeof value === 'object' && 'types' in value;\nexport const createTransformedImports = (defaultImports, additionalImports, globalImportPaths) => {\n if (globalImportPaths) {\n defaultImports.forEach(([name, paths]) => {\n paths.push(...globalImportPaths);\n });\n }\n const transformedImports = new Map(defaultImports);\n if (additionalImports && additionalImports.length > 0) {\n for (const [name, path] of additionalImports) {\n const existing = transformedImports.get(name);\n if (existing) {\n existing.push(path);\n }\n else {\n transformedImports.set(name, [path]);\n }\n }\n }\n return transformedImports;\n};\n","import { createTransformedImports, isBabelApi } from './utils.js';\nfunction createSignaliumAsyncTransform(api, opts) {\n const transformedImports = createTransformedImports([\n ['callback', ['signalium']],\n ['reactive', ['signalium']],\n ['reactiveMethod', ['signalium']],\n ['relay', ['signalium']],\n ['task', ['signalium']],\n ['watcher', ['signalium']],\n ], opts?.transformedImports, opts?.importPaths);\n const t = api.types;\n const isTrackedImport = (localName, path) => {\n const binding = path.scope.getBinding(localName);\n if (!binding || !t.isImportSpecifier(binding.path.node))\n return false;\n const importSpec = binding.path.node;\n const importedName = importSpec.imported.name;\n const importDecl = binding.path.parent;\n if (!t.isImportDeclaration(importDecl))\n return false;\n const importPaths = transformedImports.get(importedName);\n if (!importPaths)\n return false;\n return importPaths.some(p => typeof p === 'string' ? importDecl.source.value === p : p.test(importDecl.source.value));\n };\n const isReactiveCall = (path) => {\n if (!t.isCallExpression(path.node))\n return false;\n const callee = path.node.callee;\n if (!t.isIdentifier(callee))\n return false;\n return isTrackedImport(callee.name, path);\n };\n const isWithinTrackedCall = (path) => {\n let current = path.parentPath;\n while (current) {\n if (current.isCallExpression() && isReactiveCall(current))\n return true;\n current = current.parentPath;\n }\n return false;\n };\n function convertReactiveToGenerator(path) {\n if (!isWithinTrackedCall(path))\n return;\n if (!path.node.async)\n return;\n path.traverse({\n AwaitExpression(awaitPath) {\n const funcParent = awaitPath.getFunctionParent();\n if (funcParent?.node !== path.node)\n return;\n awaitPath.replaceWith(t.yieldExpression(awaitPath.node.argument));\n },\n });\n path.node.async = false;\n if (t.isArrowFunctionExpression(path.node)) {\n let hasThis = false;\n path.traverse({\n ThisExpression() {\n hasThis = true;\n },\n });\n const functionBody = t.isBlockStatement(path.node.body)\n ? path.node.body\n : t.blockStatement([t.returnStatement(path.node.body)]);\n const newFunction = t.functionExpression(null, path.node.params, functionBody, true, false);\n if (hasThis) {\n path.replaceWith(t.callExpression(t.memberExpression(newFunction, t.identifier('bind')), [t.thisExpression()]));\n }\n else {\n path.replaceWith(newFunction);\n }\n }\n else {\n path.node.generator = true;\n }\n }\n return {\n name: 'signalium-transform-reactive-async',\n visitor: {\n FunctionExpression: convertReactiveToGenerator,\n ArrowFunctionExpression: convertReactiveToGenerator,\n },\n };\n}\nexport function signaliumAsyncTransform(apiOrOpts, maybeOpts) {\n if (isBabelApi(apiOrOpts)) {\n return createSignaliumAsyncTransform(apiOrOpts, maybeOpts);\n }\n return (api) => createSignaliumAsyncTransform(api, apiOrOpts);\n}\n","import { createTransformedImports, isBabelApi } from './utils.js';\nfunction createSignaliumCallbackTransform(api, opts) {\n const transformedImports = createTransformedImports([\n ['component', ['signalium/react']],\n ['reactive', ['signalium']],\n ['reactiveMethod', ['signalium']],\n ['relay', ['signalium']],\n ['task', ['signalium']],\n ['watcher', ['signalium']],\n ], opts?.transformedImports, opts?.importPaths);\n const t = api.types;\n const callbackImportPath = opts?.callbackImportPath ?? 'signalium';\n const isTrackedImport = (localName, path) => {\n const binding = path.scope.getBinding(localName);\n if (!binding || !t.isImportSpecifier(binding.path.node))\n return false;\n const importSpec = binding.path.node;\n const importedName = importSpec.imported.name;\n const importDecl = binding.path.parent;\n if (!t.isImportDeclaration(importDecl))\n return false;\n const importPaths = transformedImports.get(importedName);\n if (!importPaths)\n return false;\n const matches = importPaths.find(p => typeof p === 'string' ? importDecl.source.value === p : p.test(importDecl.source.value));\n return matches ? (typeof matches === 'string' ? matches : importDecl.source.value) : false;\n };\n const isTargetWrapperCall = (path) => {\n if (!t.isCallExpression(path.node))\n return false;\n const callee = path.node.callee;\n if (!t.isIdentifier(callee))\n return false;\n return !!isTrackedImport(callee.name, path);\n };\n function isIdentifierInTypePosition(refPath) {\n // Walk up ancestors and detect if the identifier is within TS type-only constructs\n // Allow identifiers inside the expression arm of TS* expression wrappers\n let current = refPath.parentPath;\n let child = refPath;\n while (current) {\n const nodeType = current.node.type;\n if (nodeType && nodeType.startsWith('TS')) {\n if (current.isTSAsExpression() ||\n current.isTSSatisfiesExpression?.() ||\n current.isTSNonNullExpression() ||\n current.isTSInstantiationExpression?.()) {\n // If we reached this TS* expression via its 'expression' arm, it's runtime, not type-only\n if (child.key === 'expression')\n return false;\n return true;\n }\n return true;\n }\n child = current;\n current = current.parentPath;\n }\n return false;\n }\n function ensureCallbackIdentifier(programPath) {\n // Try to find an existing direct import: import { callback as X } from 'signalium'\n for (const bodyPath of programPath.get('body')) {\n if (!bodyPath.isImportDeclaration())\n continue;\n const importDecl = bodyPath.node;\n if (importDecl.source.value !== callbackImportPath)\n continue;\n for (const spec of importDecl.specifiers) {\n if (spec.type === 'ImportSpecifier') {\n const ispec = spec;\n const imported = ispec.imported;\n if (imported && imported.name === 'callback') {\n return ispec.local.name;\n }\n }\n }\n }\n // Try to augment an existing import from 'signalium'\n for (const bodyPath of programPath.get('body')) {\n if (!bodyPath.isImportDeclaration())\n continue;\n const node = bodyPath.node;\n if (node.source.value !== callbackImportPath)\n continue;\n const localName = programPath.scope.generateUidIdentifier('callback').name;\n node.specifiers.push(t.importSpecifier(t.identifier(localName), t.identifier('callback')));\n return localName;\n }\n // Otherwise, insert a new import from 'signalium'\n const localName = 'callback';\n const importDecl = t.importDeclaration([t.importSpecifier(t.identifier(localName), t.identifier('callback'))], t.stringLiteral(callbackImportPath));\n const [first] = programPath.get('body');\n if (first) {\n first.insertBefore(importDecl);\n }\n else {\n programPath.pushContainer('body', importDecl);\n }\n return localName;\n }\n function collectDeps(innerFn) {\n const depNames = new Set();\n const innerScope = innerFn.scope;\n const innerNode = innerFn.node;\n innerFn.traverse({\n ReferencedIdentifier(refPath) {\n // Only consider refs whose nearest function parent is the inner function\n const nearestFn = refPath.getFunctionParent();\n if (!nearestFn || nearestFn.node !== innerNode)\n return;\n const name = refPath.node.name;\n const binding = refPath.scope.getBinding(name);\n if (!binding)\n return;\n // Ignore identifiers that appear only in type positions\n if (isIdentifierInTypePosition(refPath))\n return;\n // Exclude module scope\n if (binding.scope.path.isProgram())\n return;\n // Exclude identifiers declared within the inner function itself or any nested scope inside it\n let declScope = binding.scope;\n while (declScope) {\n if (declScope === innerScope)\n return;\n declScope = declScope.parent;\n }\n // Exclude only the inner function's own parameters\n if (binding.kind === 'param' && binding.scope === innerScope)\n return;\n depNames.add(name);\n },\n });\n return depNames;\n }\n return {\n name: 'signalium-transform-callback-wrapping',\n visitor: {\n CallExpression(callPath) {\n if (!isTargetWrapperCall(callPath))\n return;\n const arg0 = callPath.get('arguments')[0];\n if (!arg0)\n return;\n if (!(arg0.isFunctionExpression() || arg0.isArrowFunctionExpression()))\n return;\n const outerFn = arg0;\n const programPath = callPath.findParent((p) => p.isProgram());\n const callbackName = ensureCallbackIdentifier(programPath);\n // Maintain per-function counters\n const counters = new WeakMap();\n counters.set(outerFn.node, 0);\n const getNextIndexFor = (fnNode) => {\n const current = counters.get(fnNode) ?? 0;\n counters.set(fnNode, current + 1);\n return current;\n };\n outerFn.traverse({\n // Initialize counters for any function-like node when first seen\n FunctionExpression: {\n enter(fnPath) {\n if (!counters.has(fnPath.node))\n counters.set(fnPath.node, 0);\n },\n exit(innerFnPath) {\n if (innerFnPath.node === outerFn.node)\n return;\n // Skip converting when the function is passed directly as a callback\n // to a tracked call AND that call is nested within another tracked call.\n const immediateParent = innerFnPath.parentPath;\n if (immediateParent && immediateParent.isCallExpression()) {\n const callee = immediateParent.node.callee;\n if (t.isIdentifier(callee)) {\n const calleeId = callee;\n if (isTrackedImport(calleeId.name, immediateParent)) {\n let current = immediateParent.parentPath;\n while (current) {\n if (current.isCallExpression()) {\n const parentCallee = current.node.callee;\n if (t.isIdentifier(parentCallee)) {\n const parentCalleeId = parentCallee;\n if (isTrackedImport(parentCalleeId.name, current)) {\n return; // nested direct callback – skip\n }\n }\n }\n current = current.parentPath;\n }\n }\n }\n }\n // Skip if already wrapped in callback()\n const parent = innerFnPath.parentPath;\n if (parent && parent.isCallExpression()) {\n const callee = parent.node.callee;\n if (t.isIdentifier(callee)) {\n const calleeId = callee;\n if (calleeId.name === callbackName) {\n return;\n }\n }\n }\n const deps = Array.from(collectDeps(innerFnPath));\n // Determine parent function to index against\n const parentFn = (innerFnPath.parentPath?.getFunctionParent() || outerFn);\n const argIndex = getNextIndexFor(parentFn.node);\n const args = [innerFnPath.node, t.numericLiteral(argIndex)];\n if (deps.length > 0) {\n args.push(t.arrayExpression(deps.map(n => t.identifier(n))));\n }\n const wrapped = t.callExpression(t.identifier(callbackName), args);\n innerFnPath.replaceWith(wrapped);\n innerFnPath.skip();\n },\n },\n ArrowFunctionExpression: {\n enter(fnPath) {\n if (!counters.has(fnPath.node))\n counters.set(fnPath.node, 0);\n },\n exit(innerFnPath) {\n if (innerFnPath.node === outerFn.node)\n return;\n // Skip converting when the function is passed directly as a callback\n // to a tracked call AND that call is nested within another tracked call.\n const immediateParent = innerFnPath.parentPath;\n if (immediateParent && immediateParent.isCallExpression()) {\n const callee = immediateParent.node.callee;\n if (t.isIdentifier(callee)) {\n const calleeId = callee;\n if (isTrackedImport(calleeId.name, immediateParent)) {\n let current = immediateParent.parentPath;\n while (current) {\n if (current.isCallExpression()) {\n const parentCallee = current.node.callee;\n if (t.isIdentifier(parentCallee)) {\n const parentCalleeId = parentCallee;\n if (isTrackedImport(parentCalleeId.name, current)) {\n return; // nested direct callback – skip\n }\n }\n }\n current = current.parentPath;\n }\n }\n }\n }\n // Skip if already wrapped in callback()\n const parent = innerFnPath.parentPath;\n if (parent && parent.isCallExpression()) {\n const callee = parent.node.callee;\n if (t.isIdentifier(callee)) {\n const calleeId = callee;\n if (calleeId.name === callbackName) {\n return;\n }\n }\n }\n const deps = Array.from(collectDeps(innerFnPath));\n const parentFn = (innerFnPath.parentPath?.getFunctionParent() || outerFn);\n const argIndex = getNextIndexFor(parentFn.node);\n const args = [innerFnPath.node, t.numericLiteral(argIndex)];\n if (deps.length > 0) {\n args.push(t.arrayExpression(deps.map(n => t.identifier(n))));\n }\n const wrapped = t.callExpression(t.identifier(callbackName), args);\n innerFnPath.replaceWith(wrapped);\n innerFnPath.skip();\n },\n },\n FunctionDeclaration: {\n enter(fnPath) {\n if (!counters.has(fnPath.node))\n counters.set(fnPath.node, 0);\n },\n exit(innerDeclPath) {\n const id = innerDeclPath.node.id;\n if (!id)\n return;\n const fnExpr = t.functionExpression(id, innerDeclPath.node.params, innerDeclPath.node.body, innerDeclPath.node.generator, innerDeclPath.node.async);\n const deps = Array.from(collectDeps(innerDeclPath));\n const parentFn = (innerDeclPath.parentPath?.getFunctionParent() || outerFn);\n const argIndex = getNextIndexFor(parentFn.node);\n const args = [fnExpr, t.numericLiteral(argIndex)];\n if (deps.length > 0) {\n args.push(t.arrayExpression(deps.map(n => t.identifier(n))));\n }\n const wrapped = t.callExpression(t.identifier(callbackName), args);\n const constDecl = t.variableDeclaration('const', [t.variableDeclarator(id, wrapped)]);\n innerDeclPath.replaceWith(constDecl);\n innerDeclPath.skip();\n },\n },\n ObjectMethod: {\n enter(fnPath) {\n if (!counters.has(fnPath.node))\n counters.set(fnPath.node, 0);\n },\n exit(innerMethodPath) {\n if (innerMethodPath.node.kind !== 'method')\n return;\n const fnExpr = t.functionExpression(null, innerMethodPath.node.params, innerMethodPath.node.body, innerMethodPath.node.generator, innerMethodPath.node.async);\n const deps = Array.from(collectDeps(innerMethodPath));\n const parentFn = (innerMethodPath.parentPath?.getFunctionParent() || outerFn);\n const argIndex = getNextIndexFor(parentFn.node);\n const args = [fnExpr, t.numericLiteral(argIndex)];\n if (deps.length > 0) {\n args.push(t.arrayExpression(deps.map(n => t.identifier(n))));\n }\n const wrapped = t.callExpression(t.identifier(callbackName), args);\n const key = innerMethodPath.node.key;\n const computed = innerMethodPath.node.computed || false;\n const prop = t.objectProperty(key, wrapped, computed);\n innerMethodPath.replaceWith(prop);\n innerMethodPath.skip();\n },\n },\n });\n },\n },\n };\n}\nexport function signaliumCallbackTransform(apiOrOpts, opts) {\n if (isBabelApi(apiOrOpts)) {\n return createSignaliumCallbackTransform(apiOrOpts, opts);\n }\n else {\n return (api) => createSignaliumCallbackTransform(api, apiOrOpts);\n }\n}\n","import { createTransformedImports, isBabelApi } from './utils.js';\nconst PROMISE_STATIC_METHODS = new Set(['all', 'race', 'any', 'allSettled', 'resolve', 'reject', 'withResolvers']);\nfunction createSignaliumPromiseMethodsTransform(api, opts) {\n const transformedImports = createTransformedImports([\n ['callback', ['signalium']],\n ['reactive', ['signalium']],\n ['reactiveMethod', ['signalium']],\n ['relay', ['signalium']],\n ['task', ['signalium']],\n ['watcher', ['signalium']],\n ], opts?.transformedImports, opts?.importPaths);\n const t = api.types;\n const promiseImportPath = opts?.promiseImportPath ?? 'signalium';\n const isTrackedImport = (localName, path) => {\n const binding = path.scope.getBinding(localName);\n if (!binding || !t.isImportSpecifier(binding.path.node))\n return false;\n const importSpec = binding.path.node;\n const importedName = importSpec.imported.name;\n const importDecl = binding.path.parent;\n if (!t.isImportDeclaration(importDecl))\n return false;\n const importPaths = transformedImports.get(importedName);\n if (!importPaths)\n return false;\n return importPaths.some(p => typeof p === 'string' ? importDecl.source.value === p : p.test(importDecl.source.value));\n };\n const isReactiveCall = (path) => {\n if (!t.isCallExpression(path.node))\n return false;\n const callee = path.node.callee;\n if (!t.isIdentifier(callee))\n return false;\n return isTrackedImport(callee.name, path);\n };\n const isWithinTrackedCall = (path) => {\n let current = path.parentPath;\n while (current) {\n if (current.isCallExpression() && isReactiveCall(current))\n return true;\n current = current.parentPath;\n }\n return false;\n };\n function ensureReactivePromiseIdentifier(programPath) {\n for (const bodyPath of programPath.get('body')) {\n if (!bodyPath.isImportDeclaration())\n continue;\n const importDecl = bodyPath.node;\n if (importDecl.source.value !== promiseImportPath)\n continue;\n for (const spec of importDecl.specifiers) {\n if (spec.type === 'ImportSpecifier') {\n const ispec = spec;\n const imported = ispec.imported;\n if (imported && imported.name === 'ReactivePromise') {\n return ispec.local.name;\n }\n }\n }\n }\n for (const bodyPath of programPath.get('body')) {\n if (!bodyPath.isImportDeclaration())\n continue;\n const node = bodyPath.node;\n if (node.source.value !== promiseImportPath)\n continue;\n const localName = 'ReactivePromise';\n node.specifiers.push(t.importSpecifier(t.identifier(localName), t.identifier('ReactivePromise')));\n return localName;\n }\n const localName = 'ReactivePromise';\n const importDecl = t.importDeclaration([t.importSpecifier(t.identifier(localName), t.identifier('ReactivePromise'))], t.stringLiteral(promiseImportPath));\n const [first] = programPath.get('body');\n if (first) {\n first.insertBefore(importDecl);\n }\n else {\n programPath.pushContainer('body', importDecl);\n }\n return localName;\n }\n return {\n name: 'signalium-transform-reactive-promise-methods',\n visitor: {\n CallExpression(callPath) {\n if (!isWithinTrackedCall(callPath))\n return;\n const callee = callPath.node.callee;\n if (!t.isMemberExpression(callee))\n return;\n if (callee.computed)\n return;\n const object = callee.object;\n const property = callee.property;\n if (!t.isIdentifier(object, { name: 'Promise' }))\n return;\n if (callPath.scope.getBinding('Promise'))\n return;\n if (!t.isIdentifier(property))\n return;\n const methodName = property.name;\n if (!PROMISE_STATIC_METHODS.has(methodName))\n return;\n const programPath = callPath.findParent((p) => p.isProgram());\n const reactivePromiseId = ensureReactivePromiseIdentifier(programPath);\n const newCallee = t.memberExpression(t.identifier(reactivePromiseId), t.identifier(methodName));\n callPath.node.callee = newCallee;\n },\n },\n };\n}\nexport function signaliumPromiseMethodsTransform(apiOrOpts, maybeOpts) {\n if (isBabelApi(apiOrOpts)) {\n return createSignaliumPromiseMethodsTransform(apiOrOpts, maybeOpts);\n }\n return (api) => createSignaliumPromiseMethodsTransform(api, apiOrOpts);\n}\n","import { signaliumAsyncTransform } from './async.js';\nimport { signaliumCallbackTransform } from './callback.js';\nimport { signaliumPromiseMethodsTransform } from './promise.js';\nimport { isBabelApi } from './utils.js';\n// Babel preset that sequences the two plugins just like separate entries\n// Usage in babel config: presets: [[require('signalium/transform').signaliumPreset(options)]\nfunction createSignaliumPreset(api, opts) {\n return {\n plugins: [\n signaliumCallbackTransform({\n transformedImports: opts?.transformedImports ?? [],\n importPaths: opts?.importPaths,\n callbackImportPath: opts?.callbackImportPath,\n }),\n signaliumAsyncTransform({ transformedImports: opts?.transformedImports ?? [], importPaths: opts?.importPaths }),\n signaliumPromiseMethodsTransform({\n transformedImports: opts?.transformedImports ?? [],\n importPaths: opts?.importPaths,\n promiseImportPath: opts?.promiseImportPath,\n }),\n ],\n };\n}\nexport function signaliumPreset(apiOrOpts, maybeOpts) {\n if (isBabelApi(apiOrOpts)) {\n return createSignaliumPreset(apiOrOpts, maybeOpts);\n }\n return (api) => createSignaliumPreset(api, apiOrOpts);\n}\n"],"names":["importDecl","localName"],"mappings":";;AAAO,MAAM,aAAa,CAAC,UAAU,CAAC,CAAC,SAAS,OAAO,U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KAAK,SAAS;AAAA,MAC3B;AAAA,IACZ;AAAA,EACA;AACA;AACO,SAAS,iCAAiC,WAAW,WAAW;AACnE,MAAI,WAAW,SAAS,GAAG;AACvB,WAAO,uCAAuC,WAAW,SAAS;AAAA,EACtE;AACA,SAAO,CAAC,QAAQ,uCAAuC,KAAK,SAAS;AACzE;AC/GA,SAAS,sBAAsB,KAAK,MAAM;AACtC,SAAO;AAAA,IACH,SAAS;AAAA,MACL,2BAA2B;AAAA,QACvB,oBAAoB,MAAM,sBAAsB,CAAA;AAAA,QAChD,aAAa,MAAM;AAAA,QACnB,oBAAoB,MAAM;AAAA,MAC1C,CAAa;AAAA,MACD,wBAAwB,EAAE,oBAAoB,MAAM,sBAAsB,CAAA,GAAI,aAAa,MAAM,aAAa;AAAA,MAC9G,iCAAiC;AAAA,QAC7B,oBAAoB,MAAM,sBAAsB,CAAA;AAAA,QAChD,aAAa,MAAM;AAAA,QACnB,mBAAmB,MAAM;AAAA,MACzC,CAAa;AAAA,IACb;AAAA,EACA;AACA;AACO,SAAS,gBAAgB,WAAW,WAAW;AAClD,MAAI,WAAW,SAAS,GAAG;AACvB,WAAO,sBAAsB,WAAW,SAAS;AAAA,EACrD;AACA,SAAO,CAAC,QAAQ,sBAAsB,KAAK,SAAS;AACxD;;;;;"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const
|
|
4
|
-
const debug = require("./debug-
|
|
3
|
+
const snapshot = require("./snapshot-Di0yziPX.js");
|
|
4
|
+
const debug = require("./debug-gCDAvnLM.js");
|
|
5
5
|
function watchOnce(fn) {
|
|
6
|
-
const signal =
|
|
6
|
+
const signal = snapshot.watcher(fn);
|
|
7
7
|
try {
|
|
8
8
|
debug.watchSignal(signal, false);
|
|
9
9
|
let result = debug.getSignal(signal);
|
|
@@ -42,6 +42,8 @@ function forwardRelay(state, sourceRelay) {
|
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
|
+
exports.registerCustomSnapshot = snapshot.registerCustomSnapshot;
|
|
46
|
+
exports.snapshot = snapshot.snapshot;
|
|
45
47
|
exports.hashValue = debug.hashValue;
|
|
46
48
|
exports.registerCustomHash = debug.registerCustomHash;
|
|
47
49
|
exports.setReactivePromise = debug.setReactivePromise;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sources":["
|
|
1
|
+
{"version":3,"file":"utils.js","sources":["../../../.tsc-out/utils.js"],"sourcesContent":["export { hashValue, registerCustomHash } from './internals/utils/hash.js';\nexport { snapshot, registerCustomSnapshot } from './internals/utils/snapshot.js';\nimport { watcher } from './internals/core-api.js';\nimport { watchSignal, unwatchSignal } from './internals/watch.js';\nimport { getSignal } from './internals/get.js';\nimport { isReactivePromise } from './internals/async.js';\nimport { isPromise } from './internals/utils/type-utils.js';\n/**\n * Watches a function once in a reactive context, activating any relays,\n * then automatically tears down the watcher when complete.\n *\n * This is useful for testing or one-time reactive operations where you need\n * relays to be active but don't want the watcher to reschedule on updates.\n *\n * @param fn - A sync or async function to watch once\n * @returns A promise that resolves with the function's return value\n *\n * @example\n * ```ts\n * await watchOnce(async () => {\n * const data = relay((state) => {\n * // relay will be activated during watchOnce\n * fetch('/api/data').then(res => state.value = res.data);\n * });\n * await data;\n * return data.value;\n * });\n * ```\n */\nexport function watchOnce(fn) {\n // Create a watcher signal\n const signal = watcher(fn);\n try {\n // Watch the signal to activate any relays\n watchSignal(signal, false);\n // Get the value, which runs the function\n let result = getSignal(signal);\n if (isReactivePromise(result) || isPromise(result)) {\n result = result.finally(() => {\n unwatchSignal(signal, false);\n });\n }\n else {\n unwatchSignal(signal, false);\n }\n return result;\n }\n catch (error) {\n unwatchSignal(signal, false);\n throw error;\n }\n}\nexport { setReactivePromise } from './internals/async.js';\n/**\n * Forwards state from a source relay to the target relay's state.\n * This enables composition patterns where relays can add side effects\n * while transparently forwarding state from another relay.\n *\n * The forwarding is automatically tracked through the signal graph.\n * When the source relay updates, the target relay will re-run its\n * activation function, and forwardRelay will forward the new state.\n * No cleanup is needed - dependencies are managed automatically.\n *\n * @param state - The target relay's state object\n * @param sourceRelay - The source relay to forward state from\n *\n * @example\n * ```ts\n * const sourceRelay = relay(state => {\n * // ... source relay logic\n * });\n *\n * const forwardedRelay = relay(state => {\n * // Add additional side effect\n * const cleanup = setupSomeEffect();\n *\n * // Forward state from source relay (automatically tracked and cleaned up)\n * forwardRelay(state, sourceRelay);\n *\n * return cleanup; // Only return cleanup for the additional effect\n * });\n * ```\n */\nexport function forwardRelay(state, sourceRelay) {\n // Verify that sourceRelay is actually a ReactivePromiseImpl\n if (!isReactivePromise(sourceRelay)) {\n throw new Error('forwardRelay: sourceRelay must be a ReactivePromise');\n }\n // Read from source relay to establish dependency and forward state\n // When sourceRelay updates, this relay's activation function will be called again,\n // and forwardRelay will be called again, forwarding the new state\n if (sourceRelay.isPending) {\n // For pending state, try to forward the promise if available\n // Accessing isPending establishes the dependency\n const source = sourceRelay;\n const promise = source['_promise'];\n if (promise) {\n state.setPromise(promise);\n }\n }\n else if (sourceRelay.isRejected) {\n // Accessing error establishes dependency and forwards it\n const error = sourceRelay.error;\n if (error !== undefined) {\n state.setError(error);\n }\n }\n else if (sourceRelay.isResolved && sourceRelay.isReady) {\n // Accessing value establishes dependency and forwards it\n const value = sourceRelay.value;\n if (value !== undefined) {\n state.value = value;\n }\n }\n}\n"],"names":["watcher","watchSignal","getSignal","isReactivePromise","isPromise","unwatchSignal"],"mappings":";;;;AA6BO,SAAS,UAAU,IAAI;AAE1B,QAAM,SAASA,SAAAA,QAAQ,EAAE;AACzB,MAAI;AAEAC,UAAAA,YAAY,QAAQ,KAAK;AAEzB,QAAI,SAASC,MAAAA,UAAU,MAAM;AAC7B,QAAIC,MAAAA,kBAAkB,MAAM,KAAKC,MAAAA,UAAU,MAAM,GAAG;AAChD,eAAS,OAAO,QAAQ,MAAM;AAC1BC,cAAAA,cAAc,QAAQ,KAAK;AAAA,MAC/B,CAAC;AAAA,IACL,OACK;AACDA,YAAAA,cAAc,QAAQ,KAAK;AAAA,IAC/B;AACA,WAAO;AAAA,EACX,SACO,OAAO;AACVA,UAAAA,cAAc,QAAQ,KAAK;AAC3B,UAAM;AAAA,EACV;AACJ;AAgCO,SAAS,aAAa,OAAO,aAAa;AAE7C,MAAI,CAACF,MAAAA,kBAAkB,WAAW,GAAG;AACjC,UAAM,IAAI,MAAM,qDAAqD;AAAA,EACzE;AAIA,MAAI,YAAY,WAAW;AAGvB,UAAM,SAAS;AACf,UAAM,UAAU,OAAO,UAAU;AACjC,QAAI,SAAS;AACT,YAAM,WAAW,OAAO;AAAA,IAC5B;AAAA,EACJ,WACS,YAAY,YAAY;AAE7B,UAAM,QAAQ,YAAY;AAC1B,QAAI,UAAU,QAAW;AACrB,YAAM,SAAS,KAAK;AAAA,IACxB;AAAA,EACJ,WACS,YAAY,cAAc,YAAY,SAAS;AAEpD,UAAM,QAAQ,YAAY;AAC1B,QAAI,UAAU,QAAW;AACrB,YAAM,QAAQ;AAAA,IAClB;AAAA,EACJ;AACJ;;;;;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config-B0MtLBgx.js","sources":["
|
|
1
|
+
{"version":3,"file":"config-B0MtLBgx.js","sources":["../../../.tsc-out/internals/config.js"],"sourcesContent":["let _scheduleFlush = flushWatchers => {\n setTimeout(() => {\n flushWatchers();\n }, 0);\n};\nlet _runBatch = fn => fn();\nexport function setConfig(cfg) {\n _scheduleFlush = cfg.scheduleFlush ?? _scheduleFlush;\n _runBatch = cfg.runBatch ?? _runBatch;\n}\nexport const scheduleFlush = (fn) => {\n _scheduleFlush(fn);\n};\nexport const runBatch = (fn) => {\n _runBatch(fn);\n};\n"],"names":[],"mappings":";AAAA,IAAI,iBAAiB,mBAAiB;AAClC,aAAW,MAAM;AACb,kBAAa;AAAA,EACjB,GAAG,CAAC;AACR;AACA,IAAI,YAAY,QAAM,GAAE;AACjB,SAAS,UAAU,KAAK;AAC3B,mBAAiB,IAAI,iBAAiB;AACtC,cAAY,IAAI,YAAY;AAChC;AACY,MAAC,gBAAgB,CAAC,OAAO;AACjC,iBAAe,EAAE;AACrB;AACY,MAAC,WAAW,CAAC,OAAO;AAC5B,YAAU,EAAE;AAChB;;;;"}
|