aboutsummaryrefslogtreecommitdiff
path: root/node_modules/istanbul/lib/util/yui-load-hook.js
diff options
context:
space:
mode:
authorFlorian Dold <florian.dold@gmail.com>2017-05-27 17:36:13 +0200
committerFlorian Dold <florian.dold@gmail.com>2017-05-27 17:36:13 +0200
commit5f466137ad6ac596600e3ff53c9b786815398445 (patch)
treef914c221874f0b16bf3def7ac01d59d1a99a3b0b /node_modules/istanbul/lib/util/yui-load-hook.js
parentc9f5ac8e763eda19aa0564179300cfff76785435 (diff)
node_modules, clean up package.json
Diffstat (limited to 'node_modules/istanbul/lib/util/yui-load-hook.js')
-rw-r--r--node_modules/istanbul/lib/util/yui-load-hook.js49
1 files changed, 0 insertions, 49 deletions
diff --git a/node_modules/istanbul/lib/util/yui-load-hook.js b/node_modules/istanbul/lib/util/yui-load-hook.js
deleted file mode 100644
index 9b1365d7a..000000000
--- a/node_modules/istanbul/lib/util/yui-load-hook.js
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- Copyright (c) 2012, Yahoo! Inc. All rights reserved.
- Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms.
- */
-
-//EXPERIMENTAL code: do not rely on this in anyway until the docs say it is allowed
-
-var path = require('path'),
- yuiRegexp = /yui-nodejs\.js$/;
-
-module.exports = function (matchFn, transformFn, verbose) {
- return function (file) {
- if (!file.match(yuiRegexp)) {
- return;
- }
- var YMain = require(file),
- YUI,
- loaderFn,
- origGet;
-
- if (YMain.YUI) {
- YUI = YMain.YUI;
- loaderFn = YUI.Env && YUI.Env.mods && YUI.Env.mods['loader-base'] ? YUI.Env.mods['loader-base'].fn : null;
- if (!loaderFn) { return; }
- if (verbose) { console.log('Applying YUI load post-hook'); }
- YUI.Env.mods['loader-base'].fn = function (Y) {
- loaderFn.call(null, Y);
- origGet = Y.Get._exec;
- Y.Get._exec = function (data, url, cb) {
- if (matchFn(url) || matchFn(path.resolve(url))) { //allow for relative paths as well
- if (verbose) {
- console.log('Transforming [' + url + ']');
- }
- try {
- data = transformFn(data, url);
- } catch (ex) {
- console.error('Error transforming: ' + url + ' return original code');
- console.error(ex.message || ex);
- if (ex.stack) { console.error(ex.stack); }
- }
- }
- return origGet.call(Y, data, url, cb);
- };
- return Y;
- };
- }
- };
-};
-