-
-
Notifications
You must be signed in to change notification settings - Fork 735
refactor: compilation getPath #3143
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
Merged
Merged
Conversation
This file contains hidden or 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
hyf0
previously approved these changes
May 12, 2023
h-a-n-a
previously approved these changes
May 12, 2023
hyf0
previously approved these changes
May 12, 2023
underfin
reviewed
May 15, 2023
packages/rspack/tests/runtimeCases/runtime/split-css-chunk-with-content-hash/webpack.config.js
Show resolved
Hide resolved
underfin
previously approved these changes
May 15, 2023
underfin
approved these changes
May 17, 2023
underfin
approved these changes
May 17, 2023
3 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
team
The issue/pr is created by the member of Rspack.
to be discussed
Rspack team would discuss these issues per week
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)
closes #3071
Summary
🤖 Generated by Copilot at 2a2a499
This pull request adds support for filename templates and immutable assets to the
rspackcompiler and its plugins. It introduces thePathDatatype and theget_path_with_infomethod to theCompilationstruct, and updates the node binding and the plugin API to use them. It also simplifies some code, fixes a bug in the HMR plugin, and removes some unused types and imports.Walkthrough
🤖 Generated by Copilot at 2a2a499
immutablefield to theAssetInfoandJsAssetInfostructs, and implement the logic for copying and setting it (link, link, link, link, link)get_path,get_path_with_info,get_asset_path, andget_asset_path_with_infomethods to theCompilationstruct, and implement the logic for generating asset paths and filenames based on templates and data (link)PathDatastruct and its methods to thejs_valuesmodule, and expose it to the node binding (link, link, link)get_asset_pathandget_pathmethods to theJsCompilationstruct, and implement the wrappers for the corresponding methods in theCompilationstruct (link, link)BASE_PLACEHOLDER,QUERY_PLACEHOLDER,FRAGMENT_PLACEHOLDER,RUNTIME_PLACEHOLDER, andURL_PLACEHOLDERconstants to theoutput.rsfile, and implement the logic for replacing them in the filename templates (link, link)FilenameRenderOptionsstruct with thePathDatastruct in theoutput.rsfile, and modify therender,render_with_chunk, andrender_with_chunk_and_filemethods of theFilenamestruct accordingly (link, link)name_for_filename_templatemethod of theChunkstruct to return anOption<&str>instead of anOption<String>(link)emit_assetmethod of theCompilationstruct to split the filename by the query string, and only use the filename part for the asset path (link)emit_hot_updatemethod of theHmrPluginstruct to use the correct chunk ukey to get the chunk from the compilation (link)newandrender_manifestmethods of theRenderManifestEntrystruct to use thePathDatastruct instead of theAssetInfoandFilenameRenderOptionsstructs, and to pass the asset info directly (link, link)codegenmethod of theAssetParserAndGeneratorstruct to use thePathDatastruct instead of theFilenameRenderOptionsstruct, and to call theget_asset_path_with_infomethod of theCompilationstruct instead of therendermethod of theFilenamestruct (link)render_manifestmethod of theAssetParserAndGeneratorstruct to pass the asset info directly to theRenderManifestEntry::newmethod (link)copymethod of theCopyPluginstruct to use thePathDatastruct instead of theFilenameRenderOptionsstruct, and to call theget_asset_pathmethod of theCompilationstruct instead of therendermethod of theFilenamestruct (link)parsemethod of theCssParserAndGeneratorstruct to use thePathtype from thestdcrate instead of thesugar_pathcrate, and to pass the filename as aPathreference to theModulesTransformConfigstruct (link)render_manifestmethod of theCssPluginstruct to use thePathDatastruct instead of theFilenameRenderOptionsstruct, and to call theget_path_with_infomethod of theCompilationstruct instead of therender_with_chunkmethod of theFilenamestruct (link, link)rendermethod of theLocalIdentNamestruct to use thePathDatastruct instead of theFilenameRenderOptionsstruct, and to pass the path data to therendermethod of theFilenamestruct (link)LocalIdentNameRenderOptionsstruct to use thePathDatastruct instead of theFilenameRenderOptionsstruct, and to use references instead of owned values (link)ModulesTransformConfigstruct and itsnew_name_formethod to use thePathtype instead of thename,path, andextfields, and to pass the filename as aPathreference to therendermethod of theLocalIdentNamestruct (link)render_manifestmethod of theDevtoolPluginstruct to use thePathDatastruct instead of theFilenameRenderOptionsstruct, and to call theget_path_with_infomethod of theCompilationstruct instead of therender_with_chunk_and_filemethod of theFilenamestruct (link)codegenmethod of theHtmlPluginstruct to use thePathDatastruct instead of theFilenameRenderOptionsstruct, and to call theget_path_with_infomethod of theCompilationstruct instead of therendermethod of theFilenamestruct (link)render_manifestmethod of theJsPluginstruct to use thePathDatastruct instead of theFilenameRenderOptionsstruct, and to call theget_path_with_infomethod of theCompilationstruct instead of therender_with_chunkmethod of theFilenamestruct (link)rendermethod of theAmdLibraryPluginstruct to use thePathDatastruct instead of theFilenameRenderOptionsstruct, and to call theget_pathmethod of theCompilationstruct instead of therender_with_chunkmethod of theFilenamestruct (link)