Comparing version 2.0.12 to 2.1.0
@@ -8,2 +8,35 @@ Changelog | ||
### 2.1.0 | ||
- Fixes #47 - Added support for "taglib-imports" | ||
### 2.0.12 | ||
- Fixes #31 - Add support for providing prefix when scanning for tags | ||
- Allow "code" to be a function that lazily evaluates to a code string during code generation | ||
### 2.0.11 | ||
- Added method for custom node compilers to get access to the `escapeXml` function at runtime | ||
### 2.0.10 | ||
- Fixes #39 - Added missing return when using hot-reload | ||
### 2.0.9 | ||
- Fixed bad publish | ||
### 2.0.8 | ||
- Better merging of tags when loading and merging taglibs | ||
### 2.0.7 | ||
- Changes to avoid problems associated with the same taglib being found multiple times in the search path | ||
### 2.0.6 | ||
- `renderBody` function is only added if tag has children | ||
### 2.0.5 | ||
@@ -10,0 +43,0 @@ |
@@ -459,2 +459,34 @@ var fs ; | ||
}, | ||
taglibImports: function(imports) { | ||
if (imports && Array.isArray(imports)) { | ||
for (var i=0; i<imports.length; i++) { | ||
var curImport = imports[i]; | ||
if (typeof curImport === 'string') { | ||
var basename = nodePath.basename(curImport); | ||
if (basename === 'package.json') { | ||
var packagePath = resolve(curImport, dirname); | ||
var pkg = require(packagePath); | ||
var dependencies = pkg.dependencies; | ||
if (dependencies) { | ||
var dependencyNames = Object.keys(dependencies); | ||
for (var j=0; j<dependencyNames.length; j++) { | ||
var dependencyName = dependencyNames[j]; | ||
var importPath; | ||
try { | ||
importPath = require('resolve-from')(dirname, dependencyName + '/marko-taglib.json'); | ||
} catch(e) {} | ||
if (importPath) { | ||
taglib.addImport(importPath); | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
textTransformer: function(value) { | ||
@@ -461,0 +493,0 @@ var transformer = new Taglib.Transformer(); |
@@ -25,3 +25,11 @@ | ||
for (var i=taglibs.length-1; i>=0; i--) { | ||
lookup.addTaglib(taglibs[i]); | ||
var taglib = taglibs[i]; | ||
lookup.addTaglib(taglib); | ||
if (taglib.imports) { | ||
for (var j=0; j<taglib.imports.length; j++) { | ||
var importedTaglib = taglibLoader.load(taglib.imports[j]); | ||
lookup.addTaglib(importedTaglib); | ||
} | ||
} | ||
} | ||
@@ -28,0 +36,0 @@ |
@@ -39,2 +39,3 @@ /* | ||
this.inputFilesLookup = {}; | ||
this.imports = null; | ||
} | ||
@@ -86,2 +87,9 @@ | ||
}, this); | ||
}, | ||
addImport: function(path) { | ||
if (!this.imports) { | ||
this.imports = []; | ||
} | ||
this.imports.push(path); | ||
} | ||
@@ -88,0 +96,0 @@ }; |
@@ -61,3 +61,3 @@ { | ||
}, | ||
"version": "2.0.12" | ||
"version": "2.1.0" | ||
} |
@@ -69,3 +69,8 @@ /* | ||
out.sync(); | ||
out.global = extend(out.global, data.$global); | ||
if (data.$global) { | ||
out.global = extend(out.global, data.$global); | ||
delete data.$global; | ||
} | ||
this._(data, out); | ||
@@ -128,3 +133,6 @@ out.end(); | ||
finalOut.global = extend(finalOut.global, finalData.$global); | ||
if (finalData.$global) { | ||
finalOut.global = extend(finalOut.global, finalData.$global); | ||
delete finalData.$global; | ||
} | ||
@@ -131,0 +139,0 @@ renderFunc(finalData, finalOut); |
@@ -380,3 +380,5 @@ 'use strict'; | ||
it("should support importing taglibs into other taglibs", function(done) { | ||
testRender("test-project/html-templates/taglib-imports.marko", {}, done); | ||
}); | ||
}); |
@@ -101,3 +101,4 @@ { | ||
}, | ||
"tags-dir": "./scanned-tags" | ||
"tags-dir": "./scanned-tags", | ||
"taglib-imports": ["./package.json"] | ||
} |
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
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
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
473775
386
8667
28