Skip to content

Conversation

quininer
Copy link
Contributor

Description:

Following our previous discussion, I am trying to introduce a self-describing serialization encoding for ast to replace #11069 .

Since serde is currently used for json serialization, it is hard to modify serde to support both json and binary encodings (due to the untagged and flatten attr). So I made our own Encode and Decode proc macro, which also facilitate unknown variant support.

benchmark

I've done some simple benchmarks with a modified swc ast, and I believe we don't have an unacceptable performance loss relative to rkyv.
I'm using cbor4ii here, which I developed, so I'd prefer it if there's no performance difference. but it's easy to migrate to bincode or other scheme.

This also introduces an unknown feature for ecma_ast crate, which should only be enabled by the wasm plugin to ensure that old plugins can decode new AST.

BREAKING CHANGE:

This PR itself only introduces new encoding and will not cause any breakage. However, it may cause breakage when switch the wasm plugin communication scheme in future.

Related issue (if exists):

Copy link

changeset-bot bot commented Sep 18, 2025

⚠️ No Changeset found

Latest commit: 28b12ce

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@quininer quininer force-pushed the r/self-desc-encode branch 2 times, most recently from c9d0a01 to de8261b Compare September 18, 2025 12:27
Copy link

codspeed-hq bot commented Sep 18, 2025

CodSpeed Performance Report

Merging #11100 will not alter performance

Comparing quininer:r/self-desc-encode (3db47aa) with main (117325e)1

Summary

✅ 140 untouched

Footnotes

  1. No successful run was found on main (067dfe4) during the generation of this report, so 117325e was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

Copy link

socket-security bot commented Sep 19, 2025

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Addedcopyfiles@​2.4.110010010078100
Addedwebpack-cli@​3.3.129710010083100
Addedwebpack-dev-server@​3.11.3969310084100
Addedwebpack@​4.47.09710010093100

View full report

Copy link

socket-security bot commented Sep 19, 2025

Warning

Review the following alerts detected in dependencies.

According to your organization's Security Policy, it is recommended to resolve "Warn" alerts. Learn more about Socket for GitHub.

Action Severity Alert  (click "▶" to expand/collapse)
Warn Critical
[email protected] has a Critical CVE.

CVE: GHSA-fjxv-7rqg-78g4 form-data uses unsafe random function in form-data for choosing boundary (CRITICAL)

Affected versions: < 2.5.4; >= 3.0.0 < 3.0.4; >= 4.0.0 < 4.0.4

Patched version: 2.5.4

From: ?npm/[email protected]

ℹ Read more on: This package | This alert | What is a critical CVE?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at [email protected].

Suggestion: Remove or replace dependencies that include known critical CVEs. Consumers can use dependency overrides or npm audit fix --force to remove vulnerable dependencies.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore npm/[email protected]. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

Warn High
[email protected] has Obfuscated code.

Confidence: 0.96

Location: Package overview

From: ?npm/[email protected]npm/[email protected]

ℹ Read more on: This package | This alert | What is obfuscated code?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at [email protected].

Suggestion: Packages should not obfuscate their code. Consider not using packages with obfuscated code.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore npm/[email protected]. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

View full report

@quininer quininer force-pushed the r/self-desc-encode branch 2 times, most recently from eea20ed to 3db47aa Compare September 19, 2025 07:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

1 participant