Comparing version 2.1.1 to 3.0.0
@@ -10,4 +10,6 @@ 'use strict'; | ||
var extensionMap = {}; | ||
var loadedAdapters = []; | ||
var extensionMap; | ||
var loadedAdapters; | ||
var targetExtension; | ||
var sourceExtension; | ||
@@ -30,52 +32,59 @@ // Whitelisted adapters | ||
Object.keys(accord.all()).map(function (engine) { | ||
if (adapters.indexOf(engine) === -1) { | ||
return undefined; | ||
} | ||
try { | ||
return accord.load(engine, global.babyTolkCompilerModulePath); | ||
} catch (e) { | ||
if (e.code !== 'MODULE_NOT_FOUND' && e.message.indexOf('Cannot find module') === -1) { | ||
console.error(e.message.replace(/^error: ?/i, 'Accord Error: ') + '. Try updating to the latest version'); | ||
function load() { | ||
extensionMap = {}; | ||
loadedAdapters = []; | ||
Object.keys(accord.all()).map(function (engine) { | ||
if (adapters.indexOf(engine) === -1) { | ||
return undefined; | ||
} | ||
// else { | ||
// console.error('Missing adapter:', engine); | ||
// } | ||
} | ||
}).filter(function (engine) { | ||
return engine; | ||
}).forEach(function (adapter) { | ||
if (adapter.engineName === 'babel') { | ||
// Monkey-patching Babel adapter so that it doesn't try and compile all .js files | ||
adapter.extensions = ['jsx', 'es6', 'babel']; | ||
} | ||
loadedAdapters.push(adapter); | ||
var extensions = adapter.extensions.map(function (extension) { return '.' + extension; }); | ||
extensions.forEach(function (extension) { | ||
if (!Array.isArray(extensionMap[extension])) { | ||
extensionMap[extension] = []; | ||
try { | ||
return accord.load(engine, global.babyTolkCompilerModulePath); | ||
} catch (e) { | ||
if (e.code !== 'MODULE_NOT_FOUND' && e.message.indexOf('Cannot find module') === -1) { | ||
console.error(e.message.replace(/^error: ?/i, 'Accord Error: ') + '. Try updating to the latest version'); | ||
} | ||
// else { | ||
// console.error('Missing adapter:', engine); | ||
// } | ||
} | ||
}).filter(function (engine) { | ||
return engine; | ||
}).forEach(function (adapter) { | ||
if (adapter.engineName === 'babel') { | ||
// Monkey-patching Babel adapter so that it doesn't try and compile all .js files | ||
adapter.extensions = ['jsx', 'es6', 'babel']; | ||
} | ||
loadedAdapters.push(adapter); | ||
var extensions = adapter.extensions.map(function (extension) { return '.' + extension; }); | ||
extensionMap[extension].push(adapter); | ||
extensions.forEach(function (extension) { | ||
if (!Array.isArray(extensionMap[extension])) { | ||
extensionMap[extension] = []; | ||
} | ||
extensionMap[extension].push(adapter); | ||
}); | ||
}); | ||
}); | ||
var targetExtension = {}; | ||
var sourceExtension = {}; | ||
targetExtension = {}; | ||
sourceExtension = {}; | ||
Object.keys(extensionMap).forEach(function (sourceExt) { | ||
var adapters = extensionMap[sourceExt]; | ||
var targetExt = '.' + adapters[0].output; | ||
Object.keys(extensionMap).forEach(function (sourceExt) { | ||
var adapters = extensionMap[sourceExt]; | ||
var targetExt = '.' + adapters[0].output; | ||
targetExtension[sourceExt] = targetExt; | ||
targetExtension[sourceExt] = targetExt; | ||
if (!sourceExtension[targetExt]) { | ||
sourceExtension[targetExt] = []; | ||
} | ||
if (!sourceExtension[targetExt]) { | ||
sourceExtension[targetExt] = []; | ||
} | ||
sourceExtension[targetExt].push(sourceExt); | ||
}); | ||
sourceExtension[targetExt].push(sourceExt); | ||
}); | ||
} | ||
load(); | ||
@@ -90,5 +99,12 @@ var dontCompile = function (pathName) { | ||
module.exports = { | ||
extensions: extensionMap, | ||
sourceExtensionMap: sourceExtension, | ||
targetExtensionMap: targetExtension, | ||
get extensions() { | ||
return extensionMap; | ||
}, | ||
get sourceExtensionMap() { | ||
return sourceExtension; | ||
}, | ||
get targetExtensionMap() { | ||
return targetExtension; | ||
}, | ||
reload: load, | ||
adapters: loadedAdapters, | ||
@@ -95,0 +111,0 @@ isMinifiable: minify.isMinifiable, |
{ | ||
"name": "baby-tolk", | ||
"version": "2.1.1", | ||
"version": "3.0.0", | ||
"description": "A file reader that promises to translate non-web assets to web assets given the available transpilers, sourcemaps and all", | ||
@@ -41,6 +41,6 @@ "main": "lib/baby-tolk.js", | ||
"dependencies": { | ||
"accord": "davej/accord#patch-1-build", | ||
"clean-css": "^3.4.9", | ||
"accord": "0.22.3", | ||
"clean-css": "3.4.12", | ||
"es6-promise": "^3.0.2", | ||
"html-minifier": "^1.1.0", | ||
"html-minifier": "2.1.0", | ||
"uglify-js": "^2.6.1", | ||
@@ -51,3 +51,3 @@ "when": "^3.7.5" | ||
"LiveScript": "^1.3.1", | ||
"babel": "^5.8.29", | ||
"babel": "5.8.38", | ||
"coco": "^0.9.1", | ||
@@ -66,7 +66,7 @@ "coffee-script": "^1.10.0", | ||
"myth": "^1.5.0", | ||
"node-sass": "^3.4.2", | ||
"stylus": "^0.52.4", | ||
"node-sass": "3.6.0", | ||
"stylus": "0.54.5", | ||
"swig": "^1.4.2", | ||
"unexpected": "^10.4.0" | ||
"unexpected": "10.13.2" | ||
} | ||
} |
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
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
GitHub dependency
Supply chain riskContains a dependency which resolves to a GitHub URL. Dependencies fetched from GitHub specifiers are not immutable can be used to inject untrusted code or reduce the likelihood of a reproducible install.
Found 1 instance in 1 package
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
12932
227
0
0
+ Addedaccord@0.22.3(transitive)
+ Addedbalanced-match@1.0.2(transitive)
+ Addedbrace-expansion@1.1.11(transitive)
+ Addedclean-css@3.4.12(transitive)
+ Addedconcat-map@0.0.1(transitive)
+ Addedconvert-source-map@1.9.0(transitive)
+ Addedfobject@0.0.3(transitive)
+ Addedfunction-bind@1.1.2(transitive)
+ Addedglob@7.0.3(transitive)
+ Addedgraceful-fs@3.0.12(transitive)
+ Addedhasown@2.0.2(transitive)
+ Addedhtml-minifier@2.1.0(transitive)
+ Addedindx@0.2.3(transitive)
+ Addedinflight@1.0.6(transitive)
+ Addedis-core-module@2.16.1(transitive)
+ Addedlodash@4.6.1(transitive)
+ Addedminimatch@3.1.2(transitive)
+ Addednatives@1.1.6(transitive)
+ Addedonce@1.4.0(transitive)
+ Addedpath-is-absolute@1.0.1(transitive)
+ Addedpath-parse@1.0.7(transitive)
+ Addedresolve@1.22.10(transitive)
+ Addedsemver@4.3.65.7.2(transitive)
+ Addedsupports-preserve-symlinks-flag@1.0.0(transitive)
+ Addedwrappy@1.0.2(transitive)
- Removedclean-css@3.4.28(transitive)
- Removedhtml-minifier@1.5.0(transitive)
Updatedaccord@0.22.3
Updatedclean-css@3.4.12
Updatedhtml-minifier@2.1.0