Skip to content

Feat: Extend code stripping to remove export syntax - #1

Merged
davidkpiano merged 2 commits into
statelyai:mainfrom
josephfh:feat/strip-export-syntax
Apr 6, 2026
Merged

Feat: Extend code stripping to remove export syntax#1
davidkpiano merged 2 commits into
statelyai:mainfrom
josephfh:feat/strip-export-syntax

Conversation

@josephfh

Copy link
Copy Markdown
Contributor

Summary

Extends the XState import stripping function to also strip exports so we can prevent this error showing above the code editor:

SyntaxError: export declarations may only appear at top level of a module

Also adds test coverage for both existing import and export patterns.

Verification

  • pnpm test
  • pnpm build
  • pnpm test:e2e

Notes

  • Does not strip exported types and interfaces as tsBlankSpace takes care of this
  • Does not strip every possible export you might find in TS files, just common ways a user might export machines

Screenshot of the syntax error we want to avoid

image

@davidkpiano
davidkpiano merged commit 1ac69e3 into statelyai:main Apr 6, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants