Skip to content

Conversation

@grypez
Copy link
Contributor

@grypez grypez commented Jan 23, 2026

WIP

Closes #770


Note

Implements an AST-driven comment stripper for the CLI bundle to avoid SES rejecting import( patterns inside comments.

  • Introduces strip-comments-plugin using Acorn to collect comment ranges and rebuild code without them via Rollup renderChunk
  • Adds comprehensive unit tests covering single-line, multi-line, mixed comments, and preservation of strings/regex/templates
  • Adds acorn as a dependency in the CLI package

Written by Cursor Bugbot for commit 3a59ba8. This will update automatically on new commits. Configure here.

@grypez grypez force-pushed the grypez/bundle-with-vite branch from bdc4c89 to 85c60f8 Compare January 23, 2026 19:56
@grypez grypez force-pushed the grypez/fix-bundle-import-scrubber branch from 1b26e3f to 37b0848 Compare January 23, 2026 20:00
@grypez grypez marked this pull request as ready for review January 23, 2026 20:05
@grypez grypez requested a review from a team as a code owner January 23, 2026 20:05
@github-actions
Copy link
Contributor

github-actions bot commented Jan 23, 2026

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 88.01%
⬇️ -0.21%
5723 / 6502
🔵 Statements 87.9%
⬇️ -0.20%
5816 / 6616
🔵 Functions 86.8%
⬇️ -0.39%
1487 / 1713
🔵 Branches 83.84%
⬇️ -0.68%
2065 / 2463
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
packages/cli/src/vite/strip-comments-plugin.ts 100% 100% 100% 100%
Generated in workflow #3325 for commit 3a59ba8 by the Vitest Coverage Report Action

@grypez grypez changed the base branch from grypez/bundle-with-vite to main January 23, 2026 20:37
@grypez grypez changed the base branch from main to grypez/bundle-with-vite January 23, 2026 20:38
@grypez grypez changed the base branch from grypez/bundle-with-vite to main January 23, 2026 20:55
@grypez grypez force-pushed the grypez/fix-bundle-import-scrubber branch from c331878 to 5e4d039 Compare January 23, 2026 21:00
@grypez grypez changed the base branch from main to grypez/bundle-with-vite January 23, 2026 21:00
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

@grypez grypez force-pushed the grypez/fix-bundle-import-scrubber branch from 5e4d039 to 3a59ba8 Compare January 23, 2026 21:59
@grypez grypez merged commit fcdd1f3 into grypez/bundle-with-vite Jan 23, 2026
28 checks passed
@grypez grypez deleted the grypez/fix-bundle-import-scrubber branch January 23, 2026 22:08
grypez added a commit that referenced this pull request Jan 23, 2026
Reuses the acorn parsing dependency from `@ocap/kernel-agents-repl` to authoritatively scrub comments from vat bundles.

Refs #770

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> Replaces the comment scrubber with an AST-based implementation to
reliably remove comments (including those containing `import(`) from
bundled code.
> 
> - Refactors `vite/strip-comments-plugin` to use Acorn (`parse` with
`onComment`) and return unchanged code when no comments are found
> - Adds unit tests for `strip-comments-plugin` covering
single/multi-line comments, strings, regex, templates, and empty input
> - Adds `acorn` dependency in `@ocap/cli` and updates `yarn.lock`
> 
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
3a59ba8. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
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.

build: Replace fragile string-based comment stripping with AST-based approach

2 participants