Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(es/minifier): Make AST compressor respect
toplevel
(#6775)
**Related issue:** - Closes #4386.
- Loading branch information
Showing
12 changed files
with
109 additions
and
2 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
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
4 changes: 4 additions & 0 deletions
4
crates/swc_ecma_minifier/tests/fixture/issues/4386/1/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,4 @@ | ||
{ | ||
"defaults": true, | ||
"toplevel": false | ||
} |
24 changes: 24 additions & 0 deletions
24
crates/swc_ecma_minifier/tests/fixture/issues/4386/1/input.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,24 @@ | ||
var application; | ||
(() => { | ||
var __webpack_require__ = {}; | ||
(() => { | ||
__webpack_require__.d = (exports, definition) => { | ||
}; | ||
})(); | ||
(() => { | ||
__webpack_require__.o = (obj, prop) => { }; | ||
})(); | ||
(() => { | ||
__webpack_require__.r = (exports) => { | ||
}; | ||
})(); | ||
var __webpack_exports__ = {}; | ||
__webpack_require__.r(__webpack_exports__); | ||
__webpack_require__.d(__webpack_exports__, { | ||
"bootstrap": () => (bootstrap) | ||
}); | ||
function bootstrap() { | ||
alert(); | ||
} | ||
application = __webpack_exports__; | ||
})(); |
12 changes: 12 additions & 0 deletions
12
crates/swc_ecma_minifier/tests/fixture/issues/4386/1/output.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,12 @@ | ||
var application; | ||
(()=>{ | ||
var __webpack_require__ = {}; | ||
__webpack_require__.d = (exports, definition)=>{}, __webpack_require__.o = (obj, prop)=>{}, __webpack_require__.r = (exports)=>{}; | ||
var __webpack_exports__ = {}; | ||
function bootstrap() { | ||
alert(); | ||
} | ||
__webpack_require__.r(__webpack_exports__), __webpack_require__.d(__webpack_exports__, { | ||
bootstrap: ()=>bootstrap | ||
}), application = __webpack_exports__; | ||
})(); |
4 changes: 4 additions & 0 deletions
4
crates/swc_ecma_minifier/tests/fixture/issues/4386/2/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,4 @@ | ||
{ | ||
"defaults": true, | ||
"toplevel": true | ||
} |
24 changes: 24 additions & 0 deletions
24
crates/swc_ecma_minifier/tests/fixture/issues/4386/2/input.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,24 @@ | ||
var application; | ||
(() => { | ||
var __webpack_require__ = {}; | ||
(() => { | ||
__webpack_require__.d = (exports, definition) => { | ||
}; | ||
})(); | ||
(() => { | ||
__webpack_require__.o = (obj, prop) => { }; | ||
})(); | ||
(() => { | ||
__webpack_require__.r = (exports) => { | ||
}; | ||
})(); | ||
var __webpack_exports__ = {}; | ||
__webpack_require__.r(__webpack_exports__); | ||
__webpack_require__.d(__webpack_exports__, { | ||
"bootstrap": () => (bootstrap) | ||
}); | ||
function bootstrap() { | ||
alert(); | ||
} | ||
application = __webpack_exports__; | ||
})(); |
11 changes: 11 additions & 0 deletions
11
crates/swc_ecma_minifier/tests/fixture/issues/4386/2/output.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,11 @@ | ||
(()=>{ | ||
var __webpack_require__ = {}; | ||
__webpack_require__.d = (exports, definition)=>{}, __webpack_require__.o = (obj, prop)=>{}, __webpack_require__.r = (exports)=>{}; | ||
var __webpack_exports__ = {}; | ||
function bootstrap() { | ||
alert(); | ||
} | ||
__webpack_require__.r(__webpack_exports__), __webpack_require__.d(__webpack_exports__, { | ||
bootstrap: ()=>bootstrap | ||
}); | ||
})(); |
4 changes: 4 additions & 0 deletions
4
crates/swc_ecma_minifier/tests/fixture/projects/next/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,4 @@ | ||
{ | ||
"defaults": true, | ||
"toplevel": 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
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