File tree Expand file tree Collapse file tree 15 files changed +31
-1112
lines changed
constant-template-literal
multi-entry-module-exports
multiple-var-declarations-b
multiple-var-declarations-c
multiple-var-declarations
unambiguous-with-default-export
unambiguous-with-named-export Expand file tree Collapse file tree 15 files changed +31
-1112
lines changed Original file line number Diff line number Diff line change @@ -227,9 +227,10 @@ export default async function transformCommonjs(
227227 let shouldRemoveRequireStatement = false ;
228228
229229 if ( currentTryBlockEnd !== null ) {
230- ( { canConvertRequire, shouldRemoveRequireStatement } =
231- getIgnoreTryCatchRequireStatementMode ( node . arguments [ 0 ] . value ) ) ;
232-
230+ const ignoreTryCatchRequire = getIgnoreTryCatchRequireStatementMode (
231+ node . arguments [ 0 ] . value
232+ ) ;
233+ ( { canConvertRequire, shouldRemoveRequireStatement } = ignoreTryCatchRequire ) ;
233234 if ( shouldRemoveRequireStatement ) {
234235 hasRemovedRequire = true ;
235236 }
@@ -490,17 +491,15 @@ export default async function transformCommonjs(
490491 }
491492
492493 if ( usesRequireWrapper ) {
493- magicString
494- . trim ( )
495- . indent ( '\t' )
496- . prepend (
497- `var ${ isRequiredName } ;
494+ magicString . trim ( ) . indent ( '\t' ) ;
495+ magicString . prepend (
496+ `var ${ isRequiredName } ;
498497
499498function ${ requireName } () {
500499\tif (${ isRequiredName } ) return ${ exportsName } ;
501500\t${ isRequiredName } = 1;
502501`
503- ) . append ( `
502+ ) . append ( `
504503\treturn ${ exportsName } ;
505504}` ) ;
506505 if ( exportMode === 'replace' ) {
Original file line number Diff line number Diff line change 11import * as commonjsHelpers from "_commonjsHelpers.js" ;
22import { commonjsRequire as commonjsRequire } from "_commonjs-dynamic-modules" ;
33import { __exports as input } from "\u0000fixtures/form/constant-template-literal/input.js?commonjs-exports"
4- import require$$0 from "\u0000/Users/lukastaegert/Github/rollup-plugins/packages/commonjs/test /fixtures/form/constant-template-literal/tape.js?commonjs-proxy" ;
4+ import require$$0 from "\u0000CWD /fixtures/form/constant-template-literal/tape.js?commonjs-proxy" ;
55
66var foo = require$$0 ;
77console . log ( foo ) ;
Original file line number Diff line number Diff line change 11import * as commonjsHelpers from "_commonjsHelpers.js" ;
22import { commonjsRequire as commonjsRequire } from "_commonjs-dynamic-modules" ;
33import { __exports as input } from "\u0000fixtures/form/ignore-ids-function/input.js?commonjs-exports"
4- import require$$0 from "\u0000/Users/lukastaegert/Github/rollup-plugins/packages/commonjs/test /fixtures/form/ignore-ids-function/bar.js?commonjs-proxy" ;
4+ import require$$0 from "\u0000CWD /fixtures/form/ignore-ids-function/bar.js?commonjs-proxy" ;
55
66var foo = require ( 'foo' ) ;
77var bar = require$$0 ;
Original file line number Diff line number Diff line change 11import * as commonjsHelpers from "_commonjsHelpers.js" ;
22import { commonjsRequire as commonjsRequire } from "_commonjs-dynamic-modules" ;
33import { __exports as input } from "\u0000fixtures/form/ignore-ids/input.js?commonjs-exports"
4- import require$$0 from "\u0000/Users/lukastaegert/Github/rollup-plugins/packages/commonjs/test /fixtures/form/ignore-ids/bar.js?commonjs-proxy" ;
4+ import require$$0 from "\u0000CWD /fixtures/form/ignore-ids/bar.js?commonjs-proxy" ;
55
66var foo = require ( 'foo' ) ;
77var bar = require$$0 ;
Original file line number Diff line number Diff line change 11import * as commonjsHelpers from "_commonjsHelpers.js" ;
22import { commonjsRequire as commonjsRequire } from "_commonjs-dynamic-modules" ;
3- import require$$0 from "\u0000/Users/lukastaegert/Github/rollup-plugins/packages/commonjs/test /fixtures/form/multi-entry-module-exports/input2.js?commonjs-proxy" ;
3+ import require$$0 from "\u0000CWD /fixtures/form/multi-entry-module-exports/input2.js?commonjs-proxy" ;
44
55const t2 = require$$0 ;
66
Original file line number Diff line number Diff line change 11import * as commonjsHelpers from "_commonjsHelpers.js" ;
22import { commonjsRequire as commonjsRequire } from "_commonjs-dynamic-modules" ;
33import { __exports as input } from "\u0000fixtures/form/multiple-var-declarations-b/input.js?commonjs-exports"
4- import require$$0 from "\u0000/Users/lukastaegert/Github/rollup-plugins/packages/commonjs/test /fixtures/form/multiple-var-declarations-b/a.js?commonjs-proxy" ;
4+ import require$$0 from "\u0000CWD /fixtures/form/multiple-var-declarations-b/a.js?commonjs-proxy" ;
55
66var a = require$$0
77 , b = 42 ;
Original file line number Diff line number Diff line change 11import * as commonjsHelpers from "_commonjsHelpers.js" ;
22import { commonjsRequire as commonjsRequire } from "_commonjs-dynamic-modules" ;
33import { __exports as input } from "\u0000fixtures/form/multiple-var-declarations-c/input.js?commonjs-exports"
4- import require$$0 from "\u0000/Users/lukastaegert/Github/rollup-plugins/packages/commonjs/test /fixtures/form/multiple-var-declarations-c/b.js?commonjs-proxy" ;
4+ import require$$0 from "\u0000CWD /fixtures/form/multiple-var-declarations-c/b.js?commonjs-proxy" ;
55
66var a = 'a'
77 , b = require$$0
Original file line number Diff line number Diff line change 11import * as commonjsHelpers from "_commonjsHelpers.js" ;
22import { commonjsRequire as commonjsRequire } from "_commonjs-dynamic-modules" ;
33import { __exports as input } from "\u0000fixtures/form/multiple-var-declarations/input.js?commonjs-exports"
4- import require$$0 from "\u0000/Users/lukastaegert/Github/rollup-plugins/packages/commonjs/test /fixtures/form/multiple-var-declarations/a.js?commonjs-proxy" ;
5- import require$$1 from "\u0000/Users/lukastaegert/Github/rollup-plugins/packages/commonjs/test /fixtures/form/multiple-var-declarations/b.js?commonjs-proxy" ;
4+ import require$$0 from "\u0000CWD /fixtures/form/multiple-var-declarations/a.js?commonjs-proxy" ;
5+ import require$$1 from "\u0000CWD /fixtures/form/multiple-var-declarations/b.js?commonjs-proxy" ;
66
77var a = require$$0 ( )
88 , b = require$$1 ;
Original file line number Diff line number Diff line change 11import * as commonjsHelpers from "_commonjsHelpers.js" ;
22import { commonjsRequire as commonjsRequire } from "_commonjs-dynamic-modules" ;
33import { __exports as input_1 } from "\u0000fixtures/form/no-exports-entry/input.js?commonjs-exports"
4- import require$$0 from "\u0000/Users/lukastaegert/Github/rollup-plugins/packages/commonjs/test /fixtures/form/no-exports-entry/dummy.js?commonjs-proxy" ;
4+ import require$$0 from "\u0000CWD /fixtures/form/no-exports-entry/dummy.js?commonjs-proxy" ;
55
66var dummy = require$$0 ;
77
Original file line number Diff line number Diff line change 11import * as commonjsHelpers from "_commonjsHelpers.js" ;
22import { commonjsRequire as commonjsRequire } from "_commonjs-dynamic-modules" ;
33import { __exports as input } from "\u0000fixtures/form/require-collision/input.js?commonjs-exports"
4- import require$$1 from "\u0000/Users/lukastaegert/Github/rollup-plugins/packages/commonjs/test /fixtures/form/require-collision/foo.js?commonjs-proxy" ;
4+ import require$$1 from "\u0000CWD /fixtures/form/require-collision/foo.js?commonjs-proxy" ;
55
66( function ( ) {
77 var foo = require$$1 ;
You can’t perform that action at this time.
0 commit comments