forked from web-infra-dev/rspack
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: support minifyoptions extract comments (web-infra-dev#2882)
* chore: init * feat: support regex match * chore: clear comments in minimized file * chore: update * chore: no license no LICENSE.TXT * test: add test cases * test: add comments for expected * chore: update * chore: remove comments * chore: add expected file * chore: add comments * chore: changeset * chore: comment * chore: update snapshots * chore: update * chore: resolve config * chore: update filename * chore: update name * chore: update name
- Loading branch information
Showing
16 changed files
with
337 additions
and
116 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
"@rspack/binding": patch | ||
"@rspack/core": patch | ||
--- | ||
|
||
add extractComments option |
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
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
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
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
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
1 change: 1 addition & 0 deletions
1
crates/rspack_plugin_javascript/tests/fixtures/builtins/minify/expected/main.js
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
5 changes: 5 additions & 0 deletions
5
crates/rspack_plugin_javascript/tests/fixtures/builtins/minify/expected/main.js.LICENSE.txt
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
/** | ||
* Utility functions for the foo package. | ||
* @license Apache-2.0 | ||
*/ | ||
/* @license */ |
29 changes: 29 additions & 0 deletions
29
crates/rspack_plugin_javascript/tests/fixtures/builtins/minify/index.js
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/*! Legal Comment */ | ||
|
||
/** | ||
* @preserve Copyright 2009 SomeThirdParty. | ||
* Here is the full license text and copyright | ||
* notice for this file. Note that the notice can span several | ||
* lines and is only terminated by the closing star and slash: | ||
*/ | ||
|
||
/** | ||
* Utility functions for the foo package. | ||
* @license Apache-2.0 | ||
*/ | ||
|
||
/*! Legal Foo */ | ||
|
||
// Foo | ||
|
||
/* | ||
Foo Bar | ||
*/ | ||
|
||
// @license | ||
|
||
/* | ||
* Foo | ||
*/ | ||
// @lic | ||
module.exports = Math.random(); |
10 changes: 10 additions & 0 deletions
10
crates/rspack_plugin_javascript/tests/fixtures/builtins/minify/test.config.json
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"builtins": { | ||
"minifyOptions": { | ||
"extractComments": "/@license/" | ||
}, | ||
"codeGeneration": { | ||
"keepComments": true | ||
} | ||
} | ||
} |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,6 +11,6 @@ module.exports = { | |
{ | ||
template: "./index.html" | ||
} | ||
] | ||
], | ||
} | ||
}; |
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
Oops, something went wrong.