Skip to content

Conversation

@jankapunkt
Copy link
Collaborator

The new SWC compiler in Meteor 3.3 is throwing errors with Blaze, because of the usage of arguments.
This PR attempts to replace all arguments with spread operator ...args

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This draft PR migrates Blaze from using the arguments object to the ES6 spread operator (...args) to ensure compatibility with Meteor 3.3's new SWC compiler. The changes are systematic and comprehensive, affecting the core Spacebars runtime, Blaze templating engine, HTML visitors, and related test files.

Key Changes

  • Replaced all arguments object usage with spread operator parameters (...args) across Spacebars, Blaze, HTMLjs, and observe-sequence packages
  • Eliminated Array.prototype.slice.call(arguments) patterns in favor of using spread parameters directly as arrays
  • Updated function signatures to use rest parameters and destructuring where appropriate

Reviewed changes

Copilot reviewed 16 out of 16 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
packages/spacebars/spacebars-runtime.js Converted mustache implementation functions and helper functions to use spread operators
packages/spacebars-tests/templating_tests.js Updated test helper to use spread operator
packages/spacebars-tests/template_tests.js Updated test functions and fixed variable naming collision (tmpl4→tmpl5)
packages/spacebars-tests/old_templates_tests.js Updated test functions to use spread operator
packages/spacebars-compiler/templatetag.js Converted TemplateTag constructor to use spread operator
packages/spacebars-compiler/optimizer.js Updated TreeTransformer visitAttributes to use spread operator
packages/observe-sequence/observe_sequence_tests.js Converted ArraySubclass constructor to use spread operator
packages/observe-sequence/observe_sequence.js Updated warn function to use spread operator
packages/htmljs/visitors.js Converted visitor methods to use spread operators with proper destructuring
packages/blaze/view.js Updated event handler to use spread operator
packages/blaze/template.js Converted event map handler to use spread operator
packages/blaze/preamble.js Updated Blaze._bind to use spread operator
packages/blaze/exceptions.js Updated exception wrapper to use spread operator
packages/blaze/events.js Converted event handler to use spread operator
packages/blaze/attrs.js Updated UrlHandler update method to use spread operator
packages/blaze-hot/update-templates.js Updated constructView override to use spread operator

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@jankapunkt
Copy link
Collaborator Author

We can continue with this, once #486 is merged

@jankapunkt jankapunkt added this to the 3.1 milestone Dec 17, 2025
@jankapunkt jankapunkt marked this pull request as ready for review December 17, 2025 07:33
@jankapunkt jankapunkt changed the title DRAFT: SWC Compatibility Feature: SWC Compatibility Dec 19, 2025
Copy link
Member

@nachocodoner nachocodoner left a comment

Choose a reason for hiding this comment

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

Looks good to me.

Just double-check that after these changes, and with modern.verbose=true enabled in package.json, there are no errors from the SWC transpiler falling back to Babel. If there are other fallbacks, they should be covered too.

@jankapunkt jankapunkt merged commit da16df1 into master Jan 9, 2026
2 checks passed
@jankapunkt
Copy link
Collaborator Author

@nachocodoner does it make sense to publish an RC so early adopters can verify?

@nachocodoner
Copy link
Member

nachocodoner commented Jan 9, 2026

@jankapunkt: It does make sense. We can also verify it with a Meteor checkout or by copying the packages locally.

Since Blaze is attached to core, and we have already wrapped up 3.4 content and its limits, I’ll plan to do this check myself in the early 3.4.1 beta and include the Blaze package RCs accordingly.

Thanks for these changes!

@nachocodoner nachocodoner deleted the fix/swc-compat branch January 9, 2026 11:05
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.

3 participants