Skip to content

Commit

Permalink
update dependencies, lint
Browse files Browse the repository at this point in the history
  • Loading branch information
Rich-Harris committed Aug 12, 2017
1 parent ed6aeef commit 3c1b2ff
Show file tree
Hide file tree
Showing 7 changed files with 76 additions and 81 deletions.
16 changes: 8 additions & 8 deletions browser/path.js
@@ -1,4 +1,4 @@
export const absolutePath = /^(?:\/|(?:[A-Za-z]:)?[\\|\/])/;
export const absolutePath = /^(?:\/|(?:[A-Za-z]:)?[\\|/])/;
export const relativePath = /^\.?\.\//;

export function isAbsolute ( path ) {
Expand All @@ -18,7 +18,7 @@ export function basename ( path ) {
}

export function dirname ( path ) {
const match = /(\/|\\)[^\/\\]*$/.exec( path );
const match = /(\/|\\)[^/\\]*$/.exec( path );
if ( !match ) return '.';

const dir = path.slice( 0, -match[0].length );
Expand All @@ -28,14 +28,14 @@ export function dirname ( path ) {
}

export function extname ( path ) {
const match = /\.[^\.]+$/.exec( basename( path ) );
const match = /\.[^.]+$/.exec( basename( path ) );
if ( !match ) return '';
return match[0];
}

export function relative ( from, to ) {
const fromParts = from.split( /[\/\\]/ ).filter( Boolean );
const toParts = to.split( /[\/\\]/ ).filter( Boolean );
const fromParts = from.split( /[/\\]/ ).filter( Boolean );
const toParts = to.split( /[/\\]/ ).filter( Boolean );

while ( fromParts[0] && toParts[0] && fromParts[0] === toParts[0] ) {
fromParts.shift();
Expand All @@ -57,13 +57,13 @@ export function relative ( from, to ) {
}

export function resolve ( ...paths ) {
let resolvedParts = paths.shift().split( /[\/\\]/ );
let resolvedParts = paths.shift().split( /[/\\]/ );

paths.forEach( path => {
if ( isAbsolute( path ) ) {
resolvedParts = path.split( /[\/\\]/ );
resolvedParts = path.split( /[/\\]/ );
} else {
const parts = path.split( /[\/\\]/ );
const parts = path.split( /[/\\]/ );

while ( parts[0] === '.' || parts[0] === '..' ) {
const part = parts.shift();
Expand Down
13 changes: 5 additions & 8 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions package.json
Expand Up @@ -47,21 +47,21 @@
"devDependencies": {
"acorn": "^5.1.1",
"buble": "^0.15.1",
"chalk": "^1.1.3",
"chalk": "^2.1.0",
"codecov.io": "^0.1.6",
"console-group": "^0.3.1",
"eslint": "^3.12.2",
"eslint": "^4.4.1",
"eslint-plugin-import": "^2.2.0",
"is-reference": "^1.0.0",
"istanbul": "^0.4.3",
"locate-character": "^2.0.0",
"magic-string": "^0.21.3",
"magic-string": "^0.22.4",
"minimist": "^1.2.0",
"mocha": "^3.0.0",
"pretty-ms": "^3.0.0",
"remap-istanbul": "^0.9.5",
"require-relative": "^0.8.7",
"rollup": "^0.42.0",
"rollup": "^0.47.0",
"rollup-plugin-buble": "^0.15.0",
"rollup-plugin-commonjs": "^8.0.2",
"rollup-plugin-json": "^2.3.0",
Expand Down
4 changes: 2 additions & 2 deletions src/Bundle.js
Expand Up @@ -390,8 +390,8 @@ export default class Bundle {
return ( resolvedId ? Promise.resolve( resolvedId ) : this.resolveId( source, module.id ) )
.then( resolvedId => {
const externalId = resolvedId || (
isRelative( source ) ? resolve( module.id, '..', source ) : source
);
isRelative( source ) ? resolve( module.id, '..', source ) : source
);

let isExternal = this.isExternal( externalId );

Expand Down
2 changes: 1 addition & 1 deletion src/ast/nodes/shared/pureFunctions.js
Expand Up @@ -37,6 +37,6 @@ simdTypes.forEach( t => {
simdTypes.map( t => `SIMD.${t}` ),
allSimdMethods
).forEach( name => pureFunctions[ name ] = true );
// TODO add others to this list from https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects
// TODO add others to this list from https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects

export default pureFunctions;
2 changes: 1 addition & 1 deletion src/utils/path.js
@@ -1,4 +1,4 @@
export const absolutePath = /^(?:\/|(?:[A-Za-z]:)?[\\|\/])/;
export const absolutePath = /^(?:\/|(?:[A-Za-z]:)?[\\|/])/;
export const relativePath = /^\.?\.\//;

export function isAbsolute ( path ) {
Expand Down
112 changes: 55 additions & 57 deletions test/form/index.js
Expand Up @@ -35,74 +35,72 @@ describe('form', () => {
config.options
);

(config.skip
? describe.skip
: config.solo ? describe.only : describe)(dir, () => {
let promise;
const createBundle = () => promise || (promise = rollup.rollup(options));
(config.skip ? describe.skip : config.solo ? describe.only : describe)(dir, () => {
let promise;
const createBundle = () => promise || (promise = rollup.rollup(options));

FORMATS.forEach(format => {
it('generates ' + format, () => {
process.chdir(samples + '/' + dir);
FORMATS.forEach(format => {
it('generates ' + format, () => {
process.chdir(samples + '/' + dir);

return createBundle().then(bundle => {
const options = extend({}, config.options, {
dest: samples + '/' + dir + '/_actual/' + format + '.js',
format
});
return createBundle().then(bundle => {
const options = extend({}, config.options, {
dest: samples + '/' + dir + '/_actual/' + format + '.js',
format
});

return bundle.write(options).then(() => {
const actualCode = normaliseOutput(
sander.readFileSync(samples, dir, '_actual', format + '.js')
);
let expectedCode;
let actualMap;
let expectedMap;
return bundle.write(options).then(() => {
const actualCode = normaliseOutput(
sander.readFileSync(samples, dir, '_actual', format + '.js')
);
let expectedCode;
let actualMap;
let expectedMap;

try {
expectedCode = normaliseOutput(
sander.readFileSync(samples, dir, '_expected', format + '.js')
);
} catch (err) {
expectedCode = 'missing file';
}
try {
expectedCode = normaliseOutput(
sander.readFileSync(samples, dir, '_expected', format + '.js')
);
} catch (err) {
expectedCode = 'missing file';
}

try {
actualMap = JSON.parse(
sander
.readFileSync(samples, dir, '_actual', format + '.js.map')
.toString()
);
actualMap.sourcesContent = actualMap.sourcesContent.map(
normaliseOutput
);
} catch (err) {
assert.equal(err.code, 'ENOENT');
}
try {
actualMap = JSON.parse(
sander
.readFileSync(samples, dir, '_actual', format + '.js.map')
.toString()
);
actualMap.sourcesContent = actualMap.sourcesContent.map(
normaliseOutput
);
} catch (err) {
assert.equal(err.code, 'ENOENT');
}

try {
expectedMap = JSON.parse(
sander
.readFileSync(samples, dir, '_expected', format + '.js.map')
.toString()
);
expectedMap.sourcesContent = expectedMap.sourcesContent.map(
normaliseOutput
);
} catch (err) {
assert.equal(err.code, 'ENOENT');
}
try {
expectedMap = JSON.parse(
sander
.readFileSync(samples, dir, '_expected', format + '.js.map')
.toString()
);
expectedMap.sourcesContent = expectedMap.sourcesContent.map(
normaliseOutput
);
} catch (err) {
assert.equal(err.code, 'ENOENT');
}

if (config.show) {
console.log(actualCode + '\n\n\n');
}
if (config.show) {
console.log(actualCode + '\n\n\n');
}

assert.equal(actualCode, expectedCode);
assert.deepEqual(actualMap, expectedMap);
});
assert.equal(actualCode, expectedCode);
assert.deepEqual(actualMap, expectedMap);
});
});
});
});
});
});
});

0 comments on commit 3c1b2ff

Please sign in to comment.