Unverified Commit 03d278db authored by vercel-fleet-prod[bot]'s avatar vercel-fleet-prod[bot] Committed by GitHub

turbopack: drop pure-only parens after minification

Co-authored-by: 's avatarLuke Sandberg <210140+lukesandberg@users.noreply.github.com>
parent 02717d28
...@@ -7,7 +7,7 @@ use swc_core::{ ...@@ -7,7 +7,7 @@ use swc_core::{
base::try_with_handler, base::try_with_handler,
common::{ common::{
BytePos, FileName, FilePathMapping, GLOBALS, LineCol, Mark, SourceMap as SwcSourceMap, BytePos, FileName, FilePathMapping, GLOBALS, LineCol, Mark, SourceMap as SwcSourceMap,
comments::{Comments, SingleThreadedComments}, comments::SingleThreadedComments,
}, },
ecma::{ ecma::{
self, self,
...@@ -132,9 +132,9 @@ pub fn minify(code: Code, source_maps: bool, mangle: Option<MangleType>) -> Resu ...@@ -132,9 +132,9 @@ pub fn minify(code: Code, source_maps: bool, mangle: Option<MangleType>) -> Resu
})); }));
} }
let program = program.apply(ecma::transforms::base::fixer::fixer(Some( // The final emitter drops comments, so don't preserve parentheses whose only
&comments as &dyn Comments, // purpose is to scope an annotation that won't be emitted.
))); let program = program.apply(ecma::transforms::base::fixer::fixer(None));
Ok((program, source_map_names)) Ok((program, source_map_names))
}) })
......
(()=>{"use strict";module.exports=["[project]/turbopack/crates/turbopack-tests/tests/snapshot/mangle-exports/single-export/input/index.js [test] (ecmascript)",t=>{console.log((0,(t.i("[project]/turbopack/crates/turbopack-tests/tests/snapshot/mangle-exports/single-export/input/lone.js [test] (ecmascript)")).f)()),t.s([])},"[project]/turbopack/crates/turbopack-tests/tests/snapshot/mangle-exports/single-export/input/lone.js [test] (ecmascript)",t=>{t.s(["f",0,function(){return"lone"}])}]})(); (()=>{"use strict";module.exports=["[project]/turbopack/crates/turbopack-tests/tests/snapshot/mangle-exports/single-export/input/index.js [test] (ecmascript)",t=>{console.log((0,t.i("[project]/turbopack/crates/turbopack-tests/tests/snapshot/mangle-exports/single-export/input/lone.js [test] (ecmascript)").f)()),t.s([])},"[project]/turbopack/crates/turbopack-tests/tests/snapshot/mangle-exports/single-export/input/lone.js [test] (ecmascript)",t=>{t.s(["f",0,function(){return"lone"}])}]})();
//# sourceMappingURL=0_9x_turbopack-tests_tests_snapshot_mangle-exports_single-export_input_1mf78g4ogdhgv._.js.map //# sourceMappingURL=0_9x_turbopack-tests_tests_snapshot_mangle-exports_single-export_input_1mf78g4ogdhgv._.js.map
\ No newline at end of file
{"version":3,"sources":["turbopack:///[project]/turbopack/crates/turbopack-tests/tests/snapshot/mangle-exports/single-export/input/index.js","turbopack:///[project]/turbopack/crates/turbopack-tests/tests/snapshot/mangle-exports/single-export/input/lone.js"],"sourcesContent":["import { aLongFunctionNameNobodyWantsInTheBundle } from './lone'\n\nconsole.log(aLongFunctionNameNobodyWantsInTheBundle())\n","// The only export of this module. It is emitted under the fixed single-export key rather than a\n// hashed one, so that every single-export module in the graph produces the same `.f` byte sequence\n// and gzip can share it. Visible in the committed output below.\nexport function aLongFunctionNameNobodyWantsInTheBundle() {\n return 'lone'\n}\n"],"names":["console","log","aLongFunctionNameNobodyWantsInTheBundle"],"mappings":"mKAEAA,QAAQC,GAAG,CAAC,CAAA,EAAA,CAFZ,EAAA,CAAA,CAAA,6HAEY,CAAA,AAAuC,wJCC5C,SAASC,EACd,MAAO,MACT"} {"version":3,"sources":["turbopack:///[project]/turbopack/crates/turbopack-tests/tests/snapshot/mangle-exports/single-export/input/index.js","turbopack:///[project]/turbopack/crates/turbopack-tests/tests/snapshot/mangle-exports/single-export/input/lone.js"],"sourcesContent":["import { aLongFunctionNameNobodyWantsInTheBundle } from './lone'\n\nconsole.log(aLongFunctionNameNobodyWantsInTheBundle())\n","// The only export of this module. It is emitted under the fixed single-export key rather than a\n// hashed one, so that every single-export module in the graph produces the same `.f` byte sequence\n// and gzip can share it. Visible in the committed output below.\nexport function aLongFunctionNameNobodyWantsInTheBundle() {\n return 'lone'\n}\n"],"names":["console","log","aLongFunctionNameNobodyWantsInTheBundle"],"mappings":"mKAEAA,QAAQC,GAAG,CAAC,CAAA,EAFZ,AAEY,EAFZ,CAAA,CAAA,4HAEY,CAAA,AAAuC,wJCC5C,SAASC,EACd,MAAO,MACT"}
\ No newline at end of file \ No newline at end of file
(()=>{"use strict";(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["output/1jsg_tests_snapshot_remove-unused-imports_star-import-string-key_input_03-1fx5_29uet._.js","[project]/turbopack/crates/turbopack-tests/tests/snapshot/remove-unused-imports/star-import-string-key/input/index.js [test] (ecmascript)",t=>{console.log((t.i("[project]/turbopack/crates/turbopack-tests/tests/snapshot/remove-unused-imports/star-import-string-key/input/lit.js [test] (ecmascript)")).foo),t.s([])},"[project]/turbopack/crates/turbopack-tests/tests/snapshot/remove-unused-imports/star-import-string-key/input/lit.js [test] (ecmascript)",t=>{t.s(["foo",0,function(){}])}])})(); (()=>{"use strict";(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["output/1jsg_tests_snapshot_remove-unused-imports_star-import-string-key_input_03-1fx5_29uet._.js","[project]/turbopack/crates/turbopack-tests/tests/snapshot/remove-unused-imports/star-import-string-key/input/index.js [test] (ecmascript)",t=>{console.log(t.i("[project]/turbopack/crates/turbopack-tests/tests/snapshot/remove-unused-imports/star-import-string-key/input/lit.js [test] (ecmascript)").foo),t.s([])},"[project]/turbopack/crates/turbopack-tests/tests/snapshot/remove-unused-imports/star-import-string-key/input/lit.js [test] (ecmascript)",t=>{t.s(["foo",0,function(){}])}])})();
//# sourceMappingURL=1jsg_tests_snapshot_remove-unused-imports_star-import-string-key_input_03-1fx5_29uet._.js.map //# sourceMappingURL=1jsg_tests_snapshot_remove-unused-imports_star-import-string-key_input_03-1fx5_29uet._.js.map
\ No newline at end of file
{"version":3,"sources":["turbopack:///[project]/turbopack/crates/turbopack-tests/tests/snapshot/remove-unused-imports/star-import-string-key/input/index.js","turbopack:///[project]/turbopack/crates/turbopack-tests/tests/snapshot/remove-unused-imports/star-import-string-key/input/lit.js"],"sourcesContent":["import * as lit from './lit.js'\n\n// A string-literal key narrows to `foo`, so `unused` leaves the bundle.\nconsole.log(lit['foo'])\n","export function foo() {}\nexport function unused() {}\n"],"names":["console","log","foo","unused"],"mappings":"8TAGAA,QAAQC,GAAG,CAAC,CAHZ,EAAA,CAAA,CAAA,4IAGY,GAAU,sKCHf,SAASC,EAAO"} {"version":3,"sources":["turbopack:///[project]/turbopack/crates/turbopack-tests/tests/snapshot/remove-unused-imports/star-import-string-key/input/index.js","turbopack:///[project]/turbopack/crates/turbopack-tests/tests/snapshot/remove-unused-imports/star-import-string-key/input/lit.js"],"sourcesContent":["import * as lit from './lit.js'\n\n// A string-literal key narrows to `foo`, so `unused` leaves the bundle.\nconsole.log(lit['foo'])\n","export function foo() {}\nexport function unused() {}\n"],"names":["console","log","foo","unused"],"mappings":"8TAGAA,QAAQC,GAAG,CAHX,AAGY,EAHZ,CAAA,CAAA,2IAGY,GAAU,sKCHf,SAASC,EAAO"}
\ No newline at end of file \ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment