browserify-ng-html2js
Advanced tools
Comparing version 0.3.0 to 0.3.1
var fs = require('fs'), | ||
through = require('through'), | ||
ngHtml2Js = require('ng-html2js'), | ||
burrito = require('burrito'); | ||
ngHtml2Js = require('ng-html2js'); | ||
@@ -32,17 +31,7 @@ function isExtension (file, extension) { | ||
function end () { | ||
var content, src, fileName, exportCall; | ||
var content, src, fileName; | ||
try { | ||
fileName = file.match(/^.*\/(.*)$/)[1]; | ||
content = fs.readFileSync(file, 'utf-8'); | ||
// Function that will be prepended in order to export angular module in a wrapped function | ||
exportCall = 'function exportNgModule(ngModule){ module.exports = ngModule }\n\n'; | ||
// Burrito will wrap the module.run call around a call of the above function in order to export the module | ||
src = exportCall + burrito(ngHtml2Js(fileName, content, opts.module), function (node) { | ||
if(node.name === 'call' && node.label() === 'run') { | ||
node.wrap('exportNgModule(%s)'); | ||
} | ||
}); | ||
src = ngHtml2Js(fileName, content, opts.module, 'ngModule') + '\nmodule.exports = ngModule;'; | ||
} catch (error) { | ||
@@ -49,0 +38,0 @@ this.emit('error', error); |
{ | ||
"name": "browserify-ng-html2js", | ||
"version": "0.3.0", | ||
"version": "0.3.1", | ||
"description": "Browserify transform to compile angular templates into angular modules", | ||
@@ -17,4 +17,3 @@ "main": "lib/index.js", | ||
"dependencies": { | ||
"burrito": "^0.2.12", | ||
"ng-html2js": "^1.2.0", | ||
"ng-html2js": "^2.0.0", | ||
"through": "^2.3.6" | ||
@@ -21,0 +20,0 @@ }, |
@@ -5,7 +5,11 @@ (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){ | ||
},{"./template.html":2}],2:[function(require,module,exports){ | ||
function exportNgModule(ngModule){ module.exports = ngModule } | ||
var ngModule = angular.module('template.html', []); | ||
ngModule.run(['$templateCache', function($templateCache) { | ||
$templateCache.put('template.html', | ||
'<h2>This is an html template</h2>\n' + | ||
'<p>and it should be transformed into a browserify wrapped angular template module</p>\n' + | ||
''); | ||
}]); | ||
exportNgModule(angular.module("template.html", []).run([ "$templateCache", function($templateCache) { | ||
$templateCache.put("template.html", "<h2>This is an html template</h2>\n" + "<p>and it should be transformed into a browserify wrapped angular template module</p>\n" + ""); | ||
} ])); | ||
module.exports = ngModule; | ||
},{}]},{},[1]); |
@@ -5,14 +5,17 @@ (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){ | ||
},{"./template.html":2}],2:[function(require,module,exports){ | ||
function exportNgModule(ngModule){ module.exports = ngModule } | ||
var ngModule; | ||
try { | ||
ngModule = angular.module('templates'); | ||
} catch (e) { | ||
ngModule = angular.module('templates', []); | ||
} | ||
(function(module) { | ||
try { | ||
module = angular.module("templates"); | ||
} catch (e) { | ||
module = angular.module("templates", []); | ||
} | ||
exportNgModule(module.run([ "$templateCache", function($templateCache) { | ||
$templateCache.put("template.html", "<h2>This is an html template</h2>\n" + "<p>and it should be transformed into a browserify wrapped angular template module</p>\n" + ""); | ||
} ])); | ||
})(module); | ||
ngModule.run(['$templateCache', function ($templateCache) { | ||
$templateCache.put('template.html', | ||
'<h2>This is an html template</h2>\n' + | ||
'<p>and it should be transformed into a browserify wrapped angular template module</p>\n' + | ||
''); | ||
}]); | ||
module.exports = ngModule; | ||
},{}]},{},[1]); |
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
2
9516
112
+ Addedng-html2js@2.0.0(transitive)
- Removedburrito@^0.2.12
- Removedburrito@0.2.12(transitive)
- Removedng-html2js@1.2.0(transitive)
- Removedtraverse@0.5.2(transitive)
- Removeduglify-js@1.1.1(transitive)
Updatedng-html2js@^2.0.0