Comparing version 0.1.0 to 0.2.0
20
index.js
@@ -19,4 +19,5 @@ var through = require('through2'), | ||
options = extend({ | ||
amd: true, | ||
autoReturn: true | ||
format: 'amd', | ||
autoReturn: true, | ||
onlySource: true | ||
}, options); | ||
@@ -36,5 +37,16 @@ | ||
var contents = Vdt.compile(file.contents.toString(), options).source; | ||
if (options.amd) { | ||
var fn = Vdt.compile(file.contents.toString(), options); | ||
var contents = fn.source; | ||
var pos = contents.indexOf('\n'); | ||
if (options.amd === false) { | ||
options.format = ''; | ||
} | ||
if (options.format === 'amd') { | ||
contents = 'define(function(require) {\n return ' + contents + '\n})'; | ||
} else if (options.format === 'cjs') { | ||
contents = [ | ||
fn.head || '', | ||
'module.exports = ' + contents.substr(0, pos), | ||
contents.substr(pos) | ||
].join('\n'); | ||
} | ||
@@ -41,0 +53,0 @@ |
{ | ||
"name": "gulp-vdt", | ||
"description": "a plugin of gulp for compiling vdt template", | ||
"version": "0.1.0", | ||
"version": "0.2.0", | ||
"main": "index.js", | ||
@@ -19,4 +19,5 @@ "repository": { | ||
"devDependencies": { | ||
"gulp": "^3.9.0" | ||
"gulp": "^3.9.0", | ||
"vdt": "^1.1.2-22" | ||
} | ||
} |
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
2549
51
2