dresscode-resources
Advanced tools
Comparing version 0.0.4 to 0.0.5
21
index.js
@@ -43,3 +43,3 @@ var {DressCode} = require('dresscodejs'); | ||
if (diritems) { | ||
var result = ''; | ||
var result = []; | ||
var resources = []; | ||
@@ -55,7 +55,9 @@ await Promise.all(diritems.map(async(fname) => { | ||
var mimeType = mime.getType(path.extname(fname)); | ||
result += `${cname}['${normalizedLocalName}'] = new ${ctor}('${mimeType}', '${Buffer.from(fcontent, 'binary').toString('base64')}');\n`; | ||
result.push({ | ||
fname: fname, | ||
content: `${cname}['${normalizedLocalName}'] = new ${ctor}('${mimeType}', '${Buffer.from(fcontent, 'binary').toString('base64')}');\n` | ||
}); | ||
resources.push(fname); | ||
} else if (stat.isDirectory()) { | ||
var [dirresult, dirresources] = await compileResources(basedir, localName, cname, ctor); | ||
result += dirresult; | ||
var diritems = dirresources.map((resource) => { | ||
@@ -65,9 +67,18 @@ resources.push(`${fname}/${resource}`); | ||
}); | ||
result += `${cname}['${localName}'] = {\n${diritems.join(',\n')}\n};\n` | ||
result.push({ | ||
fname: fname, | ||
content: `${dirresult}${cname}['${localName}'] = {\n${diritems.join(',\n')}\n};\n` | ||
}) | ||
} | ||
} | ||
})); | ||
return [result, resources]; | ||
result.sort((item1, item2) => { | ||
return item1.fname > item2.fname ? 1 : item1.fname < item2.fname ? -1 : 0; | ||
}); | ||
var textResult = result.map((item) => { | ||
return item.content; | ||
}).join(''); | ||
return [textResult, resources]; | ||
} | ||
return []; | ||
} |
{ | ||
"name": "dresscode-resources", | ||
"version": "0.0.4", | ||
"version": "0.0.5", | ||
"description": "Compiler from binary files to JavaScript-code in DressCodeJS-notation.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
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
5675
112