Comparing version 1.4.1 to 2.0.0
@@ -29,35 +29,37 @@ 'use strict'; | ||
Object.keys(accord.all()).map(function (engine) { | ||
if (adapters.indexOf(engine) === -1) { | ||
return undefined; | ||
} | ||
try { | ||
return accord.load(engine); | ||
} catch (e) { | ||
if (e.code !== 'MODULE_NOT_FOUND') { | ||
console.error(e.message.replace(/^error: ?/i, 'Accord Error: ') + '. Try updating to the latest version'); | ||
var loadAdapters = function(customPath) { | ||
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, customPath); | ||
} catch (e) { | ||
if (e.code !== 'MODULE_NOT_FOUND') { | ||
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); | ||
}); | ||
}); | ||
}); | ||
}; | ||
@@ -94,2 +96,3 @@ var targetExtension = {}; | ||
isMinifiable: minify.isMinifiable, | ||
loadAdapters: loadAdapters, | ||
read: function (pathName, options) { | ||
@@ -96,0 +99,0 @@ options = options || {}; |
{ | ||
"name": "baby-tolk", | ||
"version": "1.4.1", | ||
"version": "2.0.0", | ||
"description": "A file reader that promises to translate non-web assets to web assets given the available transpilers, sourcemaps and all", | ||
@@ -42,29 +42,29 @@ "main": "lib/baby-tolk.js", | ||
"accord": "davej/accord#patch-1-build", | ||
"clean-css": "3.4.6", | ||
"es6-promise": "3.0.2", | ||
"html-minifier": "1.0.0", | ||
"uglify-js": "2.5.0", | ||
"when": "3.7.3" | ||
"clean-css": "^3.4.9", | ||
"es6-promise": "^3.0.2", | ||
"html-minifier": "^1.1.0", | ||
"uglify-js": "^2.6.1", | ||
"when": "^3.7.5" | ||
}, | ||
"devDependencies": { | ||
"LiveScript": "1.3.1", | ||
"babel": "5.8.23", | ||
"coco": "0.9.1", | ||
"coffee-script": "1.10.0", | ||
"coveralls": "2.11.4", | ||
"css-parse": "2.0.0", | ||
"dogescript": "2.3.0", | ||
"istanbul": "0.4.0", | ||
"jade": "1.11.0", | ||
"jshint": "2.8.0", | ||
"less": "2.5.3", | ||
"marked": "0.3.5", | ||
"mocha": "2.3.3", | ||
"mocha-lcov-reporter": "0.0.1", | ||
"myth": "1.3.0", | ||
"node-sass": "3.3.3", | ||
"stylus": "0.52.4", | ||
"swig": "1.4.2", | ||
"unexpected": "10.0.1" | ||
"LiveScript": "^1.3.1", | ||
"babel": "^5.8.29", | ||
"coco": "^0.9.1", | ||
"coffee-script": "^1.10.0", | ||
"coveralls": "^2.11.6", | ||
"css-parse": "^2.0.0", | ||
"dogescript": "^2.3.0", | ||
"istanbul": "^0.4.1", | ||
"jade": "^1.11.0", | ||
"jshint": "^2.9.1-rc1", | ||
"less": "^2.5.3", | ||
"marked": "^0.3.5", | ||
"mocha": "^2.3.4", | ||
"mocha-lcov-reporter": "^1.0.0", | ||
"myth": "^1.5.0", | ||
"node-sass": "^3.4.2", | ||
"stylus": "^0.52.4", | ||
"swig": "^1.4.2", | ||
"unexpected": "^10.4.0" | ||
} | ||
} |
@@ -9,3 +9,3 @@ Baby Tolk | ||
This is based on the [Tolk](https://github.com/Munter/tolk) library but does less things based on the "small modules that do one thing" philosophy. Specifically, it doesn't inline sourcemaps and doesn't autoprefix CSS. | ||
This is based on the [Tolk](https://github.com/Munter/tolk) library but does less things based on the "small modules that do one thing" philosophy. Specifically, it doesn't inline sourcemaps and doesn't autoprefix CSS. It can also optionally minify assets, which Tolk doesn't support. | ||
@@ -36,3 +36,3 @@ Baby Tolk is a "do the right thing" tool for transpiling. It reads a file from the file system, transpiles it (including sourcemaps where supported) with the available transpilers. It can also optionally minify the output. | ||
Now you are ready to start reading files from the file system. Baby Tolk automatically loads the transpilers it has access to in the scope it is run in. By convention Baby Tolk won't compile any files if the filename begins with an underscore `_` character. | ||
Now you are ready to start reading files from the file system. Baby Tolk automatically loads the transpilers it has access to in the scope it is run in. You can change the scope by passing a custom path to the `loadAdapters` method. By convention Baby Tolk won't compile any files if the filename begins with an underscore `_` character. | ||
@@ -42,2 +42,6 @@ ```javascript | ||
babyTolk.loadAdapters(); | ||
// Alternatively, you can pass a `customPath` to the node_modules folder if desired | ||
// babyTolk.loadAdapters('/some/folder/node_modules'); | ||
babyTolk.read('path/to/stylesheet.scss').then(function (compiled) { | ||
@@ -44,0 +48,0 @@ // compiled.result is the transpiled output as a string |
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
12717
216
93
+ Addedalign-text@0.1.4(transitive)
+ Addedcenter-align@0.1.3(transitive)
+ Addedclean-css@3.4.28(transitive)
+ Addedcliui@2.1.0(transitive)
+ Addedcommander@2.9.0(transitive)
+ Addedes6-promise@3.3.1(transitive)
+ Addedhe@1.0.0(transitive)
+ Addedhtml-minifier@1.5.0(transitive)
+ Addedis-buffer@1.1.6(transitive)
+ Addedkind-of@3.2.2(transitive)
+ Addedlazy-cache@1.0.4(transitive)
+ Addedlongest@1.0.1(transitive)
+ Addedncname@1.0.0(transitive)
+ Addedrepeat-string@1.6.1(transitive)
+ Addedright-align@0.1.3(transitive)
+ Addeduglify-js@2.6.42.8.29(transitive)
+ Addedwhen@3.7.8(transitive)
+ Addedxml-char-classes@1.0.0(transitive)
+ Addedyargs@3.10.0(transitive)
- Removedbalanced-match@1.0.2(transitive)
- Removedbrace-expansion@1.1.11(transitive)
- Removedclean-css@3.4.6(transitive)
- Removedcli@0.11.3(transitive)
- Removedconcat-map@0.0.1(transitive)
- Removedes6-promise@3.0.2(transitive)
- Removedexit@0.1.2(transitive)
- Removedfs.realpath@1.0.0(transitive)
- Removedglob@7.2.3(transitive)
- Removedhtml-minifier@1.0.0(transitive)
- Removedinflight@1.0.6(transitive)
- Removedminimatch@3.1.2(transitive)
- Removedonce@1.4.0(transitive)
- Removedpath-is-absolute@1.0.1(transitive)
- Removeduglify-js@2.5.0(transitive)
- Removedwhen@3.7.3(transitive)
- Removedwrappy@1.0.2(transitive)
- Removedyargs@3.5.4(transitive)
Updatedclean-css@^3.4.9
Updatedes6-promise@^3.0.2
Updatedhtml-minifier@^1.1.0
Updateduglify-js@^2.6.1
Updatedwhen@^3.7.5