New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

gulp-ng-html2js

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gulp-ng-html2js - npm Package Compare versions

Comparing version 0.2.1 to 0.2.2

test/expected/exampleWithExportCommon.js

21

index.js

@@ -23,3 +23,7 @@ var _ = require("lodash");

" $templateCache.put('<%= template.url %>',\n '<%= template.prettyEscapedContent %>');\n" +
"}]);\n"
"}]);\n",
COMMON_JS_EXPORTS: "module.exports = ",
SYSTEM_JS_EXPORTS: "export default "
};

@@ -66,2 +70,4 @@

function getTemplate() {
var template;
if (options && options.template) {

@@ -72,3 +78,3 @@ return options.template;

if (options.declareModule === false) {
return TEMPLATES.SINGLE_DECLARED_MODULE;
template = TEMPLATES.SINGLE_DECLARED_MODULE;
}

@@ -80,4 +86,13 @@ else {

else {
return TEMPLATES.MODULE_PER_FILE;
template = TEMPLATES.MODULE_PER_FILE;
}
if (options && options.export === 'commonjs') {
template = TEMPLATES.COMMON_JS_EXPORTS + template;
}
else if (options && options.export === 'system') {
template = TEMPLATES.SYSTEM_JS_EXPORTS + template;
}
return template;
}

@@ -84,0 +99,0 @@

2

package.json
{
"name": "gulp-ng-html2js",
"version": "0.2.1",
"version": "0.2.2",
"description": "A Gulp plugin which generates AngularJS modules, which pre-load your HTML code into the $templateCache. This way AngularJS doesn't need to request the actual HTML files anymore.",

@@ -5,0 +5,0 @@ "keywords": [

@@ -130,2 +130,3 @@ # gulp-ng-html2js [![NPM version][npm-image]][npm-url] [![Build Status][travis-image]][travis-url] [![Dependency Status][depstat-image]][depstat-url]

Example

@@ -144,2 +145,24 @@

### options.export
Type: `String`
* `commonjs`: export the angular module using `module.exports =`
* `system`: export the angular module using `export default`
> Note this does not export anything with `declareModule` set to `true`.
Example
``` javascript
{
export: 'commonjs'
}
```
``` javascript
{
export: 'system'
}
```
## License

@@ -146,0 +169,0 @@

@@ -25,2 +25,68 @@ /*global describe, it*/

describe("when options.export is provided", function(){
it("commonjs", function(done){
var expectedFile = new gutil.File({
path: "test/expected/exampleWithExportCommon.js",
cwd: "test/",
base: "test/expected",
contents: fs.readFileSync("test/expected/exampleWithExportCommon.js")
});
var params = {
export: "commonjs"
};
testBufferedFile(params, expectedFile, done);
});
it("should use common, options.moduleName && options.declareModule when provided", function(done){
var expectedFile = new gutil.File({
path: "test/expected/exampleWithExportCommonModuleNameNoGenerate.js",
cwd: "test/",
base: "test/expected",
contents: fs.readFileSync("test/expected/exampleWithExportCommonModuleNameNoGenerate.js")
});
var params = {
moduleName: "myAwesomePartials",
declareModule: false,
export: "commonjs"
};
testBufferedFile(params, expectedFile, done);
});
it("system", function(done){
var expectedFile = new gutil.File({
path: "test/expected/exampleWithExportSystem.js",
cwd: "test/",
base: "test/expected",
contents: fs.readFileSync("test/expected/exampleWithExportSystem.js")
});
var params = {
export: "system"
};
testBufferedFile(params, expectedFile, done);
});
it("should use system, options.moduleName && options.declareModule when provided", function(done){
var expectedFile = new gutil.File({
path: "test/expected/exampleWithExportSystemModuleNameNoGenerate.js",
cwd: "test/",
base: "test/expected",
contents: fs.readFileSync("test/expected/exampleWithExportSystemModuleNameNoGenerate.js")
});
var params = {
moduleName: "myAwesomePartials",
declareModule: false,
export: "system"
};
testBufferedFile(params, expectedFile, done);
});
});
it("should use options.moduleName when provided", function (done) {

@@ -61,3 +127,3 @@ var expectedFile = new gutil.File({

var expectedFile = new gutil.File({
path: "test/expected/exampleWithModuleName.js",
path: "test/expected/exampleWithModuleNameNoGenerate.js",
cwd: "test/",

@@ -64,0 +130,0 @@ base: "test/expected",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc