Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

grunt-yate

Package Overview
Dependencies
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

grunt-yate - npm Package Compare versions

Comparing version 0.0.11 to 0.0.12

5

Gruntfile.js

@@ -35,3 +35,6 @@ /*

files: {
'tmp/simple.js': 'test/fixtures/simple.yate'
'tmp/simple.js': [
'test/fixtures/simple.yate',
'test/fixtures/externals.yate'
]
}

@@ -38,0 +41,0 @@ },

{
"name": "grunt-yate",
"description": "Yate compiler plugin",
"version": "0.0.11",
"version": "0.0.12",
"homepage": "https://github.com/lapple/grunt-yate",

@@ -41,3 +41,4 @@ "author": {

"dependencies": {
"yate": ">=0.0.32"
"yate": ">=0.0.32",
"temporary": "0.0.5"
},

@@ -44,0 +45,0 @@ "keywords": [

@@ -53,2 +53,8 @@ # grunt-yate

#### options.modular
Type: `Boolean`
Default value: `false`
`module.exports` main template function so that it can be required as a node module.
#### options.externals

@@ -55,0 +61,0 @@ Type: `String|Array`

57

tasks/yate.js

@@ -11,5 +11,7 @@ /*

var path = require('path');
var yate = require('yate');
var path = require('path');
var TempFile = require('temporary/lib/file');
var yateFolder = path.dirname(require.resolve('yate'));

@@ -26,2 +28,3 @@

autorun: false,
modular: false,

@@ -45,30 +48,31 @@ // List of externals-containing files to be added to the compiled

var temp = new TempFile();
var src;
// Building compiled templates.
var src = f.src.filter(function(filepath) {
temp.writeFileSync(
f.src.filter(function(filepath) {
// Warn on and remove invalid source
// files (if nonull was set).
if (!grunt.file.exists(filepath)) {
grunt.log.warn('Source file "' + filepath + '" not found.');
return false;
} else {
return true;
}
// Warn on and remove invalid source
// files (if nonull was set).
if (!grunt.file.exists(filepath)) {
grunt.log.warn('Source file "' + filepath + '" not found.');
return false;
} else {
return true;
}
}).map(function(filepath) {
var compiled;
}).map(function(filepath) {
return 'include "' + path.resolve(filepath) + '"';
}).join(grunt.util.linefeed)
);
try {
compiled = yate.compile(filepath).js;
} catch(e) {
failure = true;
try {
src = yate.compile(temp.path).js;
} catch(e) {
grunt.event.emit('yate:error', e);
grunt.fail.warn(e);
grunt.event.emit('yate:error', e);
grunt.fail.warn(e);
}
temp.unlink();
return compiled;
}).join(grunt.util.linefeed);
if (failure) {
return next();

@@ -95,2 +99,4 @@ }

src = autorun(src, options.autorun);
} else if (options.modular) {
src = modular(src);
}

@@ -105,2 +111,3 @@

grunt.log.writeln('File ' + f.dest.cyan + ' created.');
temp.unlink();
next();

@@ -118,2 +125,6 @@ });

function modular(code) {
return iife(code + grunt.util.linefeed + 'module.exports = function(data) { return yr.run("main", data); };');
}
function iife(code) {

@@ -120,0 +131,0 @@ return '(function(){' + grunt.util.linefeed + code + grunt.util.linefeed + '})()' + grunt.util.linefeed;

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