Skip to content

fix(core): handle macro data as string in built artifacts#8828

Closed
junmediatek wants to merge 1 commit intoanomalyco:devfrom
junmediatek:fix/models-macro-string-handling
Closed

fix(core): handle macro data as string in built artifacts#8828
junmediatek wants to merge 1 commit intoanomalyco:devfrom
junmediatek:fix/models-macro-string-handling

Conversation

@junmediatek
Copy link
Contributor

@junmediatek junmediatek commented Jan 16, 2026

Adds check for string type to handle Bun macros inlined at build time.

Changes

Modified the type check to include both function and string types:

// Before
if (typeof data === 'function') {
  const json = await data()
  return JSON.parse(json) as Record<string, Provider>
}

// After  
if (typeof data === 'function' || typeof data === 'string') {
  const json = await data()
  return JSON.parse(json) as Record<string, Provider>
}

Context

When Bun macros are enabled during compilation, the data() function may be executed and inlined as a string literal in the built artifacts. The original code only checked for function type, missing the string case.

@github-actions
Copy link
Contributor

Thanks for your contribution!

This PR doesn't have a linked issue. All PRs must reference an existing issue.

Please:

  1. Open an issue describing the bug/feature (if one doesn't exist)
  2. Add Fixes #<number> or Closes #<number> to this PR description

See CONTRIBUTING.md for details.

@github-actions
Copy link
Contributor

The following comment was made by an LLM, it may be inaccurate:

No duplicate PRs found

@junmediatek
Copy link
Contributor Author

junmediatek commented Jan 16, 2026

@rekram1-node

Cloud you help to review this PR 74fa97e

@junmediatek
Copy link
Contributor Author

Hi @rekram1-node

Could you help to check this PR 74fa97e ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants