Use relative filenames in strings output

master
Vitaliy Filippov 2021-08-28 16:35:36 +03:00
parent 429a3c1a58
commit 7001bfbc92
1 changed files with 6 additions and 3 deletions

View File

@ -39,7 +39,8 @@ module.exports = function(babel)
};
const addString = function(path, str)
{
strings[path.hub.file.opts.filename][str] = str;
const fn = path.hub.file.opts.filename.substr(path.hub.file.opts.root.length+1);
strings[fn][str] = true;
};
const addImport = function(path)
{
@ -62,12 +63,14 @@ module.exports = function(babel)
Program: {
enter(path, state)
{
strings[path.hub.file.opts.filename] = {};
const fn = path.hub.file.opts.filename.substr(path.hub.file.opts.root.length+1);
strings[fn] = {};
},
exit(path, state)
{
const fn = path.hub.file.opts.filename.substr(path.hub.file.opts.root.length+1);
let found = false;
for (let k in strings[path.hub.file.opts.filename])
for (let k in strings[fn])
{
found = true;
break;