defiant-builder
Advanced tools
Comparing version 1.8.0 to 1.8.1
@@ -424,2 +424,25 @@ | ||
// ** Compiles svg icons | ||
async function importXml(dirPath, data) { | ||
let result = [] | ||
let regexp = /@import ['"](.+?)['"]/mg | ||
let imports = data.toString().match(regexp) || [] | ||
await Promise.all(imports.map(async item => { | ||
let importPath = FS.path.join(dirPath, item.slice(9,-1)) | ||
let importDir = FS.path.dirname(importPath) | ||
let importFile = await FS.readFile(importPath) | ||
importFile = importFile.toString() | ||
let subImports = importFile.toString().match(regexp) || [] | ||
if (subImports.length) importFile = await importXml(importDir, importFile) | ||
let rx = new RegExp(item, "im") | ||
data = data.replace(rx, importFile) | ||
})) | ||
return data | ||
} | ||
// ** Builds def-ant application | ||
@@ -471,10 +494,12 @@ const Build = options => { | ||
let regexp = /@import ['"](.+?)['"]/mg | ||
let imports = appXml.match(regexp) || [] | ||
await Promise.all(imports.map(async item => { | ||
let importPath = FS.path.join(options.source, item.slice(9,-1)) | ||
let importFile = await FS.readFile(importPath) | ||
let rx = new RegExp(item, "im") | ||
appXml = appXml.replace(rx, importFile) | ||
})) | ||
// let regexp = /@import ['"](.+?)['"]/mg | ||
// let imports = appXml.match(regexp) || [] | ||
// await Promise.all(imports.map(async item => { | ||
// let importPath = FS.path.join(options.source, item.slice(9,-1)) | ||
// let importFile = await FS.readFile(importPath) | ||
// let rx = new RegExp(item, "im") | ||
// appXml = appXml.replace(rx, importFile) | ||
// })) | ||
appXml = await importXml(options.source, appXml) | ||
// fixes urls in xml, starting with '~' | ||
@@ -481,0 +506,0 @@ appXml = appXml.replace(/(url=")\~/g, `$1/app/${namespace}/${appId}`) |
{ | ||
"name": "defiant-builder", | ||
"version": "1.8.0", | ||
"version": "1.8.1", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "./lib", |
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
59296
628