diff --git a/src/index.js b/src/index.js index 0570f3a..fb1f5ce 100644 --- a/src/index.js +++ b/src/index.js @@ -70,9 +70,13 @@ module.exports = (scriptPath, format) => { let script = fs.readFileSync(filePath, 'utf8'), name = path.basename(filePath, '.js'), prefix = name.substr(0, 2).toLowerCase(), - type = $TYPES[prefix] || 'library', + type = $TYPES[prefix], id = (type ? name.substr(3) : name).replace(/[ ;:+=\|\\]/g, '_'); + if (!type) { + type = 'library'; + } + let nsId = ($RE_ID.test(script) ? $RE_ID.exec(script)[2] : id).replace('customscript', ''), nsObj = { id: nsId,