-
Notifications
You must be signed in to change notification settings - Fork 472
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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: string replace dependency #3219
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
github-actions
bot
added
release: feature
team
The issue/pr is created by the member of Rspack.
labels
May 18, 2023
underfin
force-pushed
the
denpendcy-add-string-replace
branch
from
May 23, 2023 09:29
5d24e95
to
0386544
Compare
!bench |
Benchmark Results
|
underfin
force-pushed
the
denpendcy-add-string-replace
branch
from
May 24, 2023 11:40
0386544
to
7e95cd7
Compare
Closed
underfin
force-pushed
the
denpendcy-add-string-replace
branch
4 times, most recently
from
May 25, 2023 06:27
d131ac3
to
55ad484
Compare
underfin
force-pushed
the
denpendcy-add-string-replace
branch
from
May 25, 2023 06:47
55ad484
to
94ede6b
Compare
hyf0
approved these changes
May 25, 2023
h-a-n-a
approved these changes
May 25, 2023
!bench |
underfin
commented
May 25, 2023
Benchmark Results
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Related issue (if exists)
Summary
馃 Generated by Copilot at 5d24e95
This pull request adds new features and refactors some existing code in the
rspack
project, which is a Rust-based web packer. The main feature is the static import and export handling by therspack_plugin_javascript
crate, which enables tree-shaking and code generation for modules that use ES6 syntax. To support this feature, therspack_core
crate was updated with new dependency types, a newModuleGraphModule
struct, and new runtime constants. The other plugins,rspack_plugin_asset
andrspack_plugin_css
, were also updated to comply with the newParseResult
struct. Thestatic-import
fixture was modified and extended to test the new feature.Walkthrough
馃 Generated by Copilot at 5d24e95
code_generatable_dependency.rs
file torspack_core
crate, definingCodeReplaceSourceDependency
trait and helper functions for dependencies that can modify module source code (link)replace_const_dependency.rs
file torspack_core
crate, definingReplaceConstDependency
struct that implementsCodeReplaceSourceDependency
trait and can replace source code range with constant string (link, link)code_generatable_dependency.rs
andreplace_const_dependency.rs
independency/mod.rs
andmodule.rs
files ofrspack_core
crate (link, link, link)Dependency
trait withas_code_replace_source_dependency
method that returns optionalBox<dyn CodeReplaceSourceDependency>
independency/mod.rs
file ofrspack_core
crate (link)module_graph_module.rs
file torspack_core
crate, definingModuleGraphModule
struct that represents module in module graph with connections, dependencies, and metadata (link, link)module_graph_module.rs
inmodule.rs
file ofrspack_core
crate (link)ExportsType
enum tomodule.rs
file ofrspack_core
crate, defining possible types of exports that module can have (link)Module
trait withget_string_replace_generation_dependencies
method that returns optional slice ofBox<dyn CodeReplaceSourceDependency>
inmodule.rs
file ofrspack_core
crate (link)NormalModule
struct innormal_module.rs
file ofrspack_core
crate, removingHashSet
type andModuleGraphModule
struct, and addingcode_replace_source_dependencies
field (link, link, link)code_replace_source_dependencies
field innew
,build
, andbuild_result
methods ofNormalModule
struct innormal_module.rs
file ofrspack_core
crate (link, link, link)get_string_replace_generation_dependencies
method forNormalModule
struct innormal_module.rs
file ofrspack_core
crate, returning slice ofBox<dyn CodeReplaceSourceDependency>
fromcode_replace_source_dependencies
field (link)code_replace_source_dependencies
field toParseResult
struct inparser_and_generator.rs
file ofrspack_core
crate, holding vector ofBox<dyn CodeReplaceSourceDependency>
for dependencies that can modify module source code (link)MAKE_NAMESPACE_OBJECT
,EXPORTS
,COMPAT_GET_DEFAULT_EXPORT
, andCREATE_FAKE_NAMESPACE_OBJECT
constants toRuntimeGlobals
enum inruntime_globals.rs
file ofrspack_core
crate, representing runtime functions and variables for static import and export handling (link, link)code_replace_source_dependencies
field to empty vector ingenerate
methods ofAssetParserAndGenerator
struct inlib.rs
file ofrspack_plugin_asset
crate andCssParserAndGenerator
struct inparser_and_generator/mod.rs
file ofrspack_plugin_css
crate, indicating no dependencies that can modify module source code (link, link)harmony_compatibility_dependency.rs
file torspack_plugin_javascript
crate, definingHarmonyCompatibilityDependency
struct that implementsCodeReplaceSourceDependency
trait and can mark module as__esModule
and add runtime function call to make module namespace object (link)harmony_evaluated_import_specifier_dependency.rs
file torspack_plugin_javascript
crate, defining emptyHarmonyEvaluatedImportSpecifierDependency
struct as placeholder for future dependency that can handle dynamic import specifiers (link)harmony_export_expression_dependency.rs
file torspack_plugin_javascript
crate, definingHarmonyExpressionHeaderDependency
struct that implementsCodeReplaceSourceDependency
trait and can replace export expression with variable assignment (link)rspack
fixture to only usestatic-import
subdirectory, and comment out other fixtures, for testing purposes (link, link)a.js
,b.js
, andindex.js
files and addc.js
ande.js
files instatic-import
fixture, to test different scenarios of static import and export handling by plugin (link, link, link, link, link)