Skip to content

Commit

Permalink
Reuse getSemis
Browse files Browse the repository at this point in the history
  • Loading branch information
TrySound committed Aug 6, 2016
1 parent 6144240 commit 179010d
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 10 deletions.
5 changes: 1 addition & 4 deletions src/Bundle.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import MagicString from './MagicString.js';
import SourceMap from './utils/SourceMap.js';
import getSemis from './utils/getSemis.js';
import getRelativePath from './utils/getRelativePath.js';
import hasOwnProp from './utils/hasOwnProp.js';
import isObject from './utils/isObject.js';
Expand Down Expand Up @@ -235,7 +236,3 @@ Bundle.prototype = {
return this;
}
};

function getSemis ( str ) {
return new Array( str.split( '\n' ).length ).join( ';' );
}
9 changes: 3 additions & 6 deletions src/utils/encodeMappings.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { encode } from 'vlq';
import getSemis from './getSemis.js';
import getLocator from './getLocator.js';

const nonWhitespace = /\S/;
Expand Down Expand Up @@ -109,9 +110,7 @@ export default function encodeMappings ( original, intro, outro, chunk, hires, s
offsets.sourceCodeColumn = offsets.sourceCodeColumn || 0;
offsets.sourceCodeName = offsets.sourceCodeName || 0;

const outroSemis = outro.split( '\n' ).map( () => '' ).join( ';' );

const encoded = rawLines.map( segments => {
return rawLines.map( segments => {
let generatedCodeColumn = 0;

return segments.map( segment => {
Expand All @@ -134,7 +133,5 @@ export default function encodeMappings ( original, intro, outro, chunk, hires, s

return encode( arr );
}).join( ',' );
}).join( ';' ) + outroSemis;

return encoded;
}).join( ';' ) + getSemis(outro);
}
3 changes: 3 additions & 0 deletions src/utils/getSemis.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export default function getSemis ( str ) {
return new Array( str.split( '\n' ).length ).join( ';' );
}

0 comments on commit 179010d

Please sign in to comment.