Browse Source

linting

contingency-plan
Rich Harris 10 years ago
parent
commit
f2628b5ca0
  1. 8
      src/Bundle.js
  2. 1
      src/Module.js
  3. 3
      src/Statement.js
  4. 2
      src/finalisers/cjs.js
  5. 2
      src/finalisers/umd.js
  6. 2
      src/utils/resolvePath.js

8
src/Bundle.js

@ -1,5 +1,5 @@
import { basename, dirname, extname, relative, resolve } from 'path';
import { readFile, Promise } from 'sander';
import { Promise } from 'sander';
import MagicString from 'magic-string';
import { blank, keys } from './utils/object';
import Module from './Module';
@ -13,10 +13,6 @@ import getExportMode from './utils/getExportMode';
import getIndentString from './utils/getIndentString';
import { unixizePath } from './utils/normalizePlatform.js';
function badExports ( option, keys ) {
throw new Error( `'${option}' was specified for options.exports, but entry module has following exports: ${keys.join(', ')}` );
}
export default class Bundle {
constructor ( options ) {
this.entryPath = resolve( options.entry ).replace( /\.js$/, '' ) + '.js';
@ -381,7 +377,7 @@ export default class Bundle {
// make sources relative. TODO fix this upstream?
const dir = dirname( map.file );
map.sources = map.sources.map( source => {
return source ? unixizePath( relative( dir, source ) ) : null
return source ? unixizePath( relative( dir, source ) ) : null;
});
}

1
src/Module.js

@ -236,7 +236,6 @@ export default class Module {
// name was defined by this module, if any
let i = this.statements.length;
while ( i-- ) {
const statement = this.statements[i];
const declaration = this.statements[i].scope.declarations[ localName ];
if ( declaration ) {
return declaration;

3
src/Statement.js

@ -1,6 +1,5 @@
import { blank, keys } from './utils/object';
import { sequence } from './utils/promise';
import { getName } from './utils/map-helpers';
import getLocation from './utils/getLocation';
import walk from './ast/walk';
import Scope from './ast/Scope';
@ -254,8 +253,6 @@ export default class Statement {
}
replaceIdentifiers ( names, bundleExports ) {
const module = this.module;
const magicString = this.magicString.clone();
const replacementStack = [ names ];
const nameList = keys( names );

2
src/finalisers/cjs.js

@ -1,5 +1,3 @@
import { keys } from '../utils/object';
export default function cjs ( bundle, magicString, { exportMode }) {
let intro = `'use strict';\n\n`;

2
src/finalisers/umd.js

@ -6,8 +6,6 @@ export default function umd ( bundle, magicString, { exportMode, indentString },
throw new Error( 'You must supply options.moduleName for UMD bundles' );
}
const indentStr = magicString.getIndentString();
const globalNames = options.globals || blank();
let amdDeps = bundle.externalModules.map( quoteId );

2
src/utils/resolvePath.js

@ -18,7 +18,7 @@ export function defaultResolver ( importee, importer, options ) {
return resolve( dirname( importer ), importee ).replace( /\.js$/, '' ) + '.js';
}
export function defaultExternalResolver ( id, importer, options ) {
export function defaultExternalResolver ( id, importer ) {
// for now, only node_modules is supported, and only jsnext:main
const root = absolutePath.exec( importer )[0];
let dir = dirname( importer );

Loading…
Cancel
Save