Skip to content

Implement simple import for quickjs#76

Draft
Perlmint wants to merge 4 commits into
dodok8:mainfrom
Perlmint:feature/simple_import
Draft

Implement simple import for quickjs#76
Perlmint wants to merge 4 commits into
dodok8:mainfrom
Perlmint:feature/simple_import

Conversation

@Perlmint

Copy link
Copy Markdown

Summary

Add local module import support to the QuickJS executor. Workflow scripts can now import from sibling TypeScript/JavaScript files, enabling shared utilities across workflows.

Non-local specifiers (npm packages, URLs) and dynamic import() calls are not supported. The executor returns an error for these cases so callers can fall back to a Node.js-based runner.

Changes

  • Introduce ModuleResolver that resolves transitive local dependencies, strips TypeScript, and converts export declarations to var so exported names persist as globals across sequential eval() calls
  • Cache type-stripped modules within a single build run — each file is processed only once even when multiple workflows share the same dependency
  • Remove the previous approach of forcibly injecting the runtime as a bundled prefix; the runtime is now just another module loaded through the resolver
  • Add workflows/lib/common.ts as a working example: shared step helpers imported by update-workflows.ts and vitepress.ts

Checklist

  • cargo test --all-features passes
  • cargo clippy --all-targets --all-features -- -D warnings passes
  • cargo fmt --all --check passes
  • Updated documentation if needed
  • Added tests for new functionality

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.

1 participant