basisjs-tools-build
Advanced tools
Comparing version 1.0.1 to 1.0.2
@@ -0,1 +1,7 @@ | ||
## 1.0.2 (November 22, 2015) | ||
- extract: return paths relative to `base` | ||
- extract: remove old `basis.js` l10n support in result (prior to `1.0`) | ||
- extract: fix `require` resolving for paths w/o extension for `basis.js` 1.5 | ||
## 1.0.1 (November 10, 2015) | ||
@@ -2,0 +8,0 @@ |
@@ -8,3 +8,2 @@ var path = require('path'); | ||
function resolveCwd(value){ | ||
console.log(value); | ||
return path.resolve(process.env.PWD || process.cwd(), value); | ||
@@ -11,0 +10,0 @@ } |
@@ -680,2 +680,5 @@ var html_at = require('basisjs-tools-ast').html; | ||
if (!path.extname(filename)) | ||
filename += '.js'; | ||
var newFile = flow.files.add({ | ||
@@ -682,0 +685,0 @@ initiator: { |
@@ -40,8 +40,4 @@ var path = require('path'); | ||
if (flow.l10n) | ||
content.push( | ||
'"l10n":' + JSON.stringify(flow.l10n.version == 2 | ||
? getL10nDictionaries(flow) | ||
: getL10nLocations(flow)) | ||
); | ||
if (flow.l10n && flow.l10n.version == 2) | ||
content.push('"l10n":' + JSON.stringify(getL10nDictionaries(flow))); | ||
@@ -65,4 +61,8 @@ flow.result = '{\n' + content.join(',\n') + '\n' + '}'; | ||
function name(file, implicit){ | ||
function rel(name){ | ||
return name ? String(name).replace(/^\//, '') : name; | ||
} | ||
if (file.filename) | ||
file.graphName = file.relpath; | ||
file.graphName = file.filename; | ||
@@ -73,36 +73,7 @@ if (file.sourceFilename) | ||
if (!file.graphName && implicit && file.inline && file.htmlFile) | ||
return file.htmlFile.relpath; | ||
return rel(file.htmlFile.filename); | ||
return file.graphName; | ||
return rel(file.graphName); | ||
} | ||
function getL10nLocations(flow){ | ||
var result = {}; | ||
for (var dictionaryName in flow.l10n.dictionaries) | ||
{ | ||
var tokens = {}; | ||
for (var token in flow.l10n.dictionaries[dictionaryName].tokens) | ||
tokens[token] = { | ||
base: flow.l10n.dictionaries[dictionaryName].tokens[token] | ||
}; | ||
for (var culture in flow.l10n.cultureDictionaries) | ||
{ | ||
for (var token in flow.l10n.cultureDictionaries[culture][dictionaryName]) | ||
{ | ||
if (!tokens[token]) | ||
tokens[token] = {}; | ||
tokens[token][culture] = flow.l10n.cultureDictionaries[culture][dictionaryName][token]; | ||
} | ||
} | ||
result[dictionaryName] = { | ||
path: '/' + path.relative(flow.options.base, flow.l10n.dictionaries[dictionaryName].path).replace(/\\/g, '/'), | ||
tokens: tokens | ||
}; | ||
} | ||
return result; | ||
} | ||
function getL10nDictionaries(flow){ | ||
@@ -124,4 +95,7 @@ var result = {}; | ||
for (var i = 0, ref; ref = token.ref[i]; i++) | ||
if (refs.indexOf(ref.file.relpath) == -1) | ||
refs.push(ref.file.relpath); | ||
{ | ||
var filename = name(ref.file); | ||
if (refs.indexOf(filename) == -1) | ||
refs.push(filename); | ||
} | ||
@@ -135,3 +109,3 @@ data[key] = { | ||
result[file.relpath] = data; | ||
result[name(file)] = data; | ||
} | ||
@@ -138,0 +112,0 @@ |
{ | ||
"name": "basisjs-tools-build", | ||
"title": "Basis.js developer build tools", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"homepage": "https://github.com/basisjs/basisjs-tools", | ||
@@ -6,0 +6,0 @@ "description": "Developer build tools for basis.js framework", |
281406
8731