Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(angular): adding initial support #3009

Merged
merged 34 commits into from
May 8, 2023

Conversation

zackarychapple
Copy link
Contributor

@zackarychapple zackarychapple commented May 4, 2023

Related issue (if exists)

A large portion of this work is copy pasted from the initial angular support task by @edusperoni but is a new branch because copy pasting was easier for me to get a new branch off of main.
Angular Support Tracking Issue
Angular Support Request

Closes these PRs as well:
Angular WIP
Angular WIP 2

Summary

🤖 Generated by Copilot at e2aaf1b

This pull request adds a new example of using rspack with Angular and updates the debugger configurations for Visual Studio Code. It also introduces a new hook for rspack that allows custom logic to run before compilation. It modifies the node_binding and rspack_core crates to support the new hook and the name field for the stats. It adds new files for the Angular project, such as the configuration, module, component, and test files. It uses the @angular-devkit/build-angular:browser-esbuild builder and some plugins from the @angular-devkit/build-angular package to integrate with rspack.

Walkthrough

🤖 Generated by Copilot at e2aaf1b

  • Add a new example of using rspack to bundle an Angular project (F9-F18)
    • Use the @angular-devkit/build-angular:browser-esbuild builder to use esbuild instead of webpack (link)
    • Add the @rspack/cli and @rspack/plugin-minify packages as devDependencies (link)
    • Define the configuration file for the rspack command with various options and plugins (link)
    • Modify the launch.json file for the Visual Studio Code debugger to use the new example and add a new configuration for debugging the Rust code (link, link)
    • Add a new variant to the Hook enum and a new match arm to the from_str function in the crates/node_binding/src/hook.rs file (link, link)
    • Add a new field to the Hooks struct in the crates/node_binding/src/js_values/hooks.rs file to hold the reference to the JavaScript function for the beforeCompile hook (link)
    • Add a new field to the Stats struct in the crates/node_binding/src/js_values/stats.rs and crates/rspack_core/src/stats.rs files to hold the name of the compilation (link, link)
    • Add a new assignment to the from_stats function in the crates/node_binding/src/js_values/stats.rs file and the from_details function in the crates/rspack_core/src/stats.rs file to set the name field of the Stats struct (link, link)
    • Add a new field, a new method, and a new argument to the Plugin struct in the crates/node_binding/src/plugins/mod.rs file to handle the beforeCompile hook (link, link, link)
    • Add a new field and a new assignment to the PluginBuilder struct in the crates/node_binding/src/plugins/mod.rs file to create a threadsafe function from the beforeCompile hook function (link, link)
    • Add a new line to the compile method of the Compiler struct in the crates/rspack_core/src/compiler/mod.rs file to call the before_compile method of the plugin_driver field (link)
    • Add a new method to the Plugin trait in the crates/rspack_core/src/plugin/api.rs file with a default implementation that does nothing (link)
    • Add a new method to the PluginDriver struct in the crates/rspack_core/src/plugin/plugin_driver.rs file that iterates over the plugins and calls the before_compile method of each plugin (link)

IWANABETHATGUY and others added 27 commits April 26, 2023 21:18

Unverified

This commit is not signed, but one or more authors requires that any commit attributed to them is signed.
feat: add EntryPlugin as a workaround
@changeset-bot
Copy link

changeset-bot bot commented May 4, 2023

⚠️ No Changeset found

Latest commit: 2f38f94

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.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

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

@CLAassistant
Copy link

CLAassistant commented May 4, 2023

CLA assistant check
All committers have signed the CLA.

@hyf0 hyf0 changed the title Angular Support feat(angular): make supporting happens May 4, 2023
@zackarychapple zackarychapple changed the title feat(angular): make supporting happens feat(angular): adding initial support May 5, 2023
@hyf0 hyf0 unassigned h-a-n-a May 8, 2023
@hyf0
Copy link
Contributor

hyf0 commented May 8, 2023

Let me solve the conflicts and we are good to merge.

Thanks for your guys and great work!

hyf0
hyf0 previously approved these changes May 8, 2023
@IWANABETHATGUY
Copy link
Contributor

Those NIT markers are used for refactoring, I think it is good enough to merge first.

@IWANABETHATGUY IWANABETHATGUY enabled auto-merge May 8, 2023 04:49
@IWANABETHATGUY IWANABETHATGUY added this pull request to the merge queue May 8, 2023
Merged via the queue into web-infra-dev:main with commit f44d6c8 May 8, 2023
@edusperoni edusperoni mentioned this pull request May 8, 2023
7 tasks
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.

7 participants