Comparing version 1.1.2 to 1.2.0
@@ -14,3 +14,2 @@ 'use strict'; | ||
// Helper class to display nested error in a sensible way | ||
var NestedError = function (_Error) { | ||
@@ -24,3 +23,3 @@ _inherits(NestedError, _Error); | ||
var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(NestedError).call(this, message)); | ||
var _this = _possibleConstructorReturn(this, (NestedError.__proto__ || Object.getPrototypeOf(NestedError)).call(this, message)); | ||
@@ -37,3 +36,10 @@ _this.stack += '\n\nParent ' + (parent.stack || parent.message || parent).toString(); | ||
var syntaxFailures = {}; | ||
var EARLIST_V8_MAJOR_VERSION_THAT_SUPPORTS_ESNEXT = 4; | ||
var syntaxFailedCombitions = {}; // sorted lowercase syntax combination => Error instance of failure | ||
var syntaxSupport = { | ||
esnext: process && process.versions && process.versions.v8 ? parseInt(process.versions.v8.split('.')[0], 10) >= EARLIST_V8_MAJOR_VERSION_THAT_SUPPORTS_ESNEXT : null, | ||
import: false, | ||
coffeescript: false, | ||
typescript: false | ||
}; | ||
@@ -91,13 +97,24 @@ /** | ||
// Check syntax support | ||
// Convert syntaxes into a sorted lowercase string | ||
var s = syntaxes && syntaxes.map(function (i) { | ||
var syntaxCombination = syntaxes && syntaxes.map(function (i) { | ||
return i.toLowerCase(); | ||
}).sort().join(', '); | ||
// Is this syntax combination unsupported? If so skip it with a soft failure to try the next edition | ||
if (s && syntaxFailures[s]) { | ||
var syntaxFailure = syntaxFailures[s]; | ||
lastEditionFailure = new NestedError('Skipped package [' + name + '] edition at [' + entryPath + '] with blacklisted syntax [' + s + ']', syntaxFailure); | ||
if (debug) console.error('DEBUG: ' + lastEditionFailure.stack); | ||
continue; | ||
if (syntaxCombination) { | ||
// Check if any of the syntaxes are unsupported | ||
var unsupportedSyntaxes = syntaxes.filter(function (i) { | ||
return syntaxSupport[i.toLowerCase()] === false; | ||
}); | ||
if (unsupportedSyntaxes.length) { | ||
lastEditionFailure = new Error('Skipped package [' + name + '] edition at [' + entryPath + '] with unsupported syntaxes [' + unsupportedSyntaxes + ']'); | ||
if (debug) console.error('DEBUG: ' + lastEditionFailure.stack); | ||
continue; | ||
} | ||
// Is this syntax combination unsupported? If so skip it with a soft failure to try the next edition | ||
else if (syntaxFailedCombitions[syntaxCombination]) { | ||
var syntaxFailure = syntaxFailedCombitions[syntaxCombination]; | ||
lastEditionFailure = new NestedError('Skipped package [' + name + '] edition at [' + entryPath + '] with blacklisted syntax combination [' + syntaxCombination + ']', syntaxFailure); | ||
if (debug) console.error('DEBUG: ' + lastEditionFailure.stack); | ||
continue; | ||
} | ||
} | ||
@@ -110,3 +127,3 @@ | ||
// Note the error with more details | ||
lastEditionFailure = new NestedError('Unable to load package [' + name + '] edition at [' + entryPath + '] with syntax [' + (s || 'no syntaxes specified') + ']', error); | ||
lastEditionFailure = new NestedError('Unable to load package [' + name + '] edition at [' + entryPath + '] with syntax [' + (syntaxCombination || 'no syntaxes specified') + ']', error); | ||
if (debug) console.error('DEBUG: ' + lastEditionFailure.stack); | ||
@@ -116,3 +133,3 @@ | ||
// Perhaps in the future note if that if it did work previously, then we should instruct module owners to be more specific with their syntaxes | ||
if (s) syntaxFailures[s] = lastEditionFailure; | ||
if (syntaxCombination) syntaxFailedCombitions[syntaxCombination] = lastEditionFailure; | ||
} | ||
@@ -119,0 +136,0 @@ } |
# History | ||
## v1.2.0 2016 October 10 | ||
- Skip syntaxes that require preprocessors | ||
- Skip `import` syntax, as the `module` field inside `package.json` skips the autoloader if supported | ||
- Skip `esnext` syntax on v8 engines <= 4 as esnext is unsupported in those environments | ||
## v1.1.2 2016 June 16 | ||
@@ -4,0 +9,0 @@ - Parent errors are now displayed in a more sensible way |
{ | ||
"name": "editions", | ||
"version": "1.1.2", | ||
"version": "1.2.0", | ||
"description": "Publish multiple editions for your JavaScript packages consistently and easily (e.g. source edition, esnext edition, es2015 edition)", | ||
@@ -49,3 +49,4 @@ "homepage": "https://github.com/bevry/editions", | ||
"contributors": [ | ||
"Benjamin Lupton <b@lupton.cc> (http://balupton.com)" | ||
"Benjamin Lupton <b@lupton.cc> (http://balupton.com)", | ||
"Zlatan Vasović <zlatanvasovic@gmail.com> (http://zdroid.github.io)" | ||
], | ||
@@ -55,6 +56,3 @@ "bugs": { | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "http://github.com/bevry/editions.git" | ||
}, | ||
"repository": "bevry/editions", | ||
"engines": { | ||
@@ -113,5 +111,5 @@ "node": ">=0.10" | ||
"babel-preset-es2015": "^6.9.0", | ||
"documentation": "^4.0.0-beta5", | ||
"documentation": "^4.0.0-beta10", | ||
"eslint": "^2.12.0", | ||
"flow-bin": "^0.27.0", | ||
"flow-bin": "^0.33.0", | ||
"joe": "^1.8.0", | ||
@@ -118,0 +116,0 @@ "joe-reporter-console": "^1.2.1", |
@@ -36,4 +36,6 @@ <!-- TITLE/ --> | ||
[Discover what the fuss is about!](https://github.com/bevry/editions/wiki) | ||
[Watch the talk.](https://youtu.be/IAB8_UlcNWI) | ||
[Get started with the guides and explanations.](https://github.com/bevry/editions/wiki) | ||
[View the API documentation.](http://rawgit.com/bevry/editions/master/docs/index.html) | ||
@@ -85,3 +87,4 @@ | ||
<ul><li><a href="http://balupton.com">Benjamin Lupton</a> — <a href="https://github.com/bevry/editions/commits?author=balupton" title="View the GitHub contributions of Benjamin Lupton on repository bevry/editions">view contributions</a></li></ul> | ||
<ul><li><a href="http://balupton.com">Benjamin Lupton</a> — <a href="https://github.com/bevry/editions/commits?author=balupton" title="View the GitHub contributions of Benjamin Lupton on repository bevry/editions">view contributions</a></li> | ||
<li><a href="http://zdroid.github.io">Zlatan Vasović</a> — <a href="https://github.com/bevry/editions/commits?author=zdroid" title="View the GitHub contributions of Zlatan Vasović on repository bevry/editions">view contributions</a></li></ul> | ||
@@ -88,0 +91,0 @@ <a href="https://github.com/bevry/editions/blob/master/CONTRIBUTING.md#files">Discover how you can contribute by heading on over to the <code>CONTRIBUTING.md</code> file.</a> |
@@ -15,3 +15,12 @@ /* @flow */ | ||
// Cache of which syntax combinations are supported or unsupported, hash of booleans | ||
const syntaxFailures = {} | ||
const EARLIST_V8_MAJOR_VERSION_THAT_SUPPORTS_ESNEXT = 4 | ||
const syntaxFailedCombitions = {} // sorted lowercase syntax combination => Error instance of failure | ||
const syntaxSupport = { | ||
esnext: (process && process.versions && process.versions.v8) | ||
? (parseInt(process.versions.v8.split('.')[0], 10) >= EARLIST_V8_MAJOR_VERSION_THAT_SUPPORTS_ESNEXT) | ||
: null, | ||
import: false, | ||
coffeescript: false, | ||
typescript: false | ||
} | ||
@@ -62,11 +71,20 @@ /** | ||
// Check syntax support | ||
// Convert syntaxes into a sorted lowercase string | ||
const s = syntaxes && syntaxes.map((i) => i.toLowerCase()).sort().join(', ') | ||
// Is this syntax combination unsupported? If so skip it with a soft failure to try the next edition | ||
if ( s && syntaxFailures[s] ) { | ||
const syntaxFailure = syntaxFailures[s] | ||
lastEditionFailure = new NestedError(`Skipped package [${name}] edition at [${entryPath}] with blacklisted syntax [${s}]`, syntaxFailure) | ||
if ( debug ) console.error(`DEBUG: ${lastEditionFailure.stack}`) | ||
continue | ||
const syntaxCombination = syntaxes && syntaxes.map((i) => i.toLowerCase()).sort().join(', ') | ||
if ( syntaxCombination ) { | ||
// Check if any of the syntaxes are unsupported | ||
const unsupportedSyntaxes = syntaxes.filter((i) => syntaxSupport[i.toLowerCase()] === false) | ||
if ( unsupportedSyntaxes.length ) { | ||
lastEditionFailure = new Error(`Skipped package [${name}] edition at [${entryPath}] with unsupported syntaxes [${unsupportedSyntaxes}]`) | ||
if ( debug ) console.error(`DEBUG: ${lastEditionFailure.stack}`) | ||
continue | ||
} | ||
// Is this syntax combination unsupported? If so skip it with a soft failure to try the next edition | ||
else if ( syntaxFailedCombitions[syntaxCombination] ) { | ||
const syntaxFailure = syntaxFailedCombitions[syntaxCombination] | ||
lastEditionFailure = new NestedError(`Skipped package [${name}] edition at [${entryPath}] with blacklisted syntax combination [${syntaxCombination}]`, syntaxFailure) | ||
if ( debug ) console.error(`DEBUG: ${lastEditionFailure.stack}`) | ||
continue | ||
} | ||
} | ||
@@ -80,3 +98,3 @@ | ||
// Note the error with more details | ||
lastEditionFailure = new NestedError(`Unable to load package [${name}] edition at [${entryPath}] with syntax [${s || 'no syntaxes specified'}]`, error) | ||
lastEditionFailure = new NestedError(`Unable to load package [${name}] edition at [${entryPath}] with syntax [${syntaxCombination || 'no syntaxes specified'}]`, error) | ||
if ( debug ) console.error(`DEBUG: ${lastEditionFailure.stack}`) | ||
@@ -86,3 +104,3 @@ | ||
// Perhaps in the future note if that if it did work previously, then we should instruct module owners to be more specific with their syntaxes | ||
if ( s ) syntaxFailures[s] = lastEditionFailure | ||
if ( syntaxCombination ) syntaxFailedCombitions[syntaxCombination] = lastEditionFailure | ||
} | ||
@@ -89,0 +107,0 @@ } |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
24441
203
107
0
7