Repository navigation
feat(transformer_v1): add has_indices and lookbehind_assertion regexp transforms - #1820
Conversation
Deploying swc-next with
|
| Latest commit: |
e78129f
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://532f1e87.swc-next.pages.dev |
| Branch Preview URL: | https://feat-regexp-transforms.swc-next.pages.dev |
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Binary size diffLinux x64 GNU · release · uncompressed, stripped bindings. Merge:
|
…nternal to Rust and target resolution
Gungraun benchmark diffBase SHA: 30325a6 Values are shown as Download the raw Gungraun and Valgrind data (retained for 90 days). Callgrind metric changesCallgrind instruction counts (Ir) for the compare and base revisions. Values are shown as compare / base in K (1,000), truncated to whole thousands. Multi-part profiles use the part numbers from Gungraun and include an aggregated Total. New and Removed identify benchmarks that exist on only one side; the missing value is shown as a dash. Percentages are rounded to at most three decimal places. Lower is better: 🟢 improvement, 🔴 regression, ⚪ unchanged. Formatter
Generator
Minifier
Parser
Semantic
Transform
Type strip
Visit
Benchmark results |
JavaScript API Gungraun benchmark diffBase: Values are shown as Download the raw Gungraun and Valgrind data (retained for 90 days). Callgrind metric changesMedian instruction counts from three processes, shown as compare / base in K (1,000), truncated to whole thousands. Percentages are rounded to at most three decimal places. Lower is better: 🟢 improvement, 🔴 regression, ⚪ unchanged or overlapping ranges (inconclusive). JIT disabled (--jitless); predictable mode enabled (--predictable). Counts are not wall time. Exact counts, ranges and profiles are retained in artifacts. Generate
Lang
Parse
Source type
Walk
Benchmark resultsExact instruction counts: median (min–max).
|
Motivation
swc_next_ecma_transformer_v1only supporteddot_all_regex,sticky_regex,unicode_regex, andunicode_sets_regexfor RegExp constructor rewriting, leavinghas_indices(dflag) andlookbehind_assertion((?<=/(?<!) unsupported even though neither requires a full RegExp AST. Additionally, generatedRegExp(...)calls usedDUMMY_SPinstead of preserving the original literal's span.Changes
has_indices(dflag) andlookbehind_assertion((?<=/(?<!) constructor-rewriting support toRegExpOptionsandRegexpPass, using a lightweight escape- and character-class-aware scan (including nestedv-mode classes) for lookbehind detection.regexp_modifiersfield toRegExpOptionsandRegExpConfig(currently ignored until RegExp AST lowering is implemented) and madeRegExpOptions::is_enabledpublic.RegExpLiteralspan on the generatedRegExp(...)CallExpression.Feature::HasIndicesRegex,Feature::LookbehindAssertion, andFeature::RegexpModifiersintoenv::compatandEnvConfig::to_env_options()so target resolution enables them automatically without exposing non-standard feature names in the public JSfeaturesAPI.cargo test -p swc_next_ecma_transformer_v1andcargo test -p swc_next --features js_transformer_v1,bridge.