basisjs-tools
Advanced tools
Comparing version 0.0.31 to 0.0.32
@@ -147,5 +147,5 @@ | ||
if (file.rule) | ||
file.ast = csso.parse('{' + file.content + '}', 'block'); | ||
file.ast = csso.parse('{' + file.content + '}', 'block', true); | ||
else | ||
file.ast = csso.parse(file.content, 'stylesheet'); | ||
file.ast = csso.parse(file.content, 'stylesheet', true); | ||
@@ -152,0 +152,0 @@ // search and extract css files |
@@ -73,5 +73,3 @@ | ||
require('./js/extract'), | ||
//require('./js/ast_tools/translator_test'), | ||
require('./tmpl/extract'), | ||
@@ -82,2 +80,5 @@ require('./css/extract'), | ||
// input file graph | ||
options.target == 'input-graph' ? require('./misc/makeInputGraph') : false, | ||
// process css | ||
@@ -115,2 +116,8 @@ require('./css/makePackages'), | ||
require('./html/translate'), | ||
// output file graph | ||
options.target == 'output-graph' ? require('./misc/makeOutputGraph') : false, | ||
// make a zip | ||
options.target == 'zip' ? require('./misc/makeZip') : false, | ||
@@ -121,3 +128,3 @@ // flush output | ||
finalHandler | ||
]; | ||
].filter(Boolean); | ||
@@ -144,5 +151,2 @@ var taskCount = 0; | ||
//fconsole.log(''); | ||
//fconsole.log('Time: ' + (time.time / 1000).toFixed(3) + 's'); | ||
process.nextTick(runHandler); | ||
@@ -149,0 +153,0 @@ } |
@@ -39,7 +39,12 @@ module.exports = function(flow){ | ||
return [ | ||
'call', | ||
expr, | ||
entry.args | ||
]; | ||
return (/*flow.options.l10nPack | ||
? [ | ||
'name', | ||
'false' | ||
] | ||
: */[ | ||
'call', | ||
expr, | ||
entry.args | ||
]); | ||
@@ -46,0 +51,0 @@ case GET_TOKEN: |
@@ -154,2 +154,8 @@ | ||
} | ||
/*for (var name in dictionaries) | ||
{ | ||
dictionaries[name].location = 'l10n'; | ||
loadCultureForDictionary(dictionaries[name], currentCulture); | ||
}*/ | ||
} + ')()')); | ||
@@ -156,0 +162,0 @@ } |
@@ -307,2 +307,11 @@ | ||
/** | ||
* Remove all files | ||
*/ | ||
clear: function(){ | ||
this.queue.slice().forEach(function(file){ | ||
this.remove(file); | ||
}, this); | ||
}, | ||
mkdir: function(dirpath){ | ||
@@ -309,0 +318,0 @@ if (!fs.existsSync(dirpath)) |
@@ -9,12 +9,7 @@ | ||
// | ||
// Create output folders (if required) | ||
// | ||
//flow.files.mkdir(flow.options.output); | ||
flow.files.mkdir(flow.options.output); | ||
flow.files.mkdir(path.resolve(flow.options.output, flow.outputResourceDir)); | ||
// | ||
// Save files content | ||
// Save output files to disk | ||
// | ||
@@ -27,8 +22,33 @@ | ||
fconsole.log(file.relpath + ' -> ' + file.relOutputFilename); | ||
fs.writeFile(path.resolve(flow.options.output, file.outputFilename), file.outputContent, file.encoding); | ||
fs.writeFile( | ||
resolveDirPath(fconsole, path.resolve(flow.options.output, file.outputFilename)), | ||
file.outputContent, | ||
file.encoding | ||
); | ||
} | ||
} | ||
} | ||
module.exports.handlerName = '[fs] Write output files'; | ||
module.exports.handlerName = '[fs] Write output files'; | ||
function resolveDirPath(fconsole, filename){ | ||
var dirpath = path.dirname(path.normalize(filename)); | ||
if (!fs.existsSync(dirpath)) | ||
{ | ||
var parts = dirpath.split(path.sep); | ||
var curpath = ''; | ||
for (var i = 0; i < parts.length; i++) | ||
{ | ||
curpath += (curpath && path.sep) + parts[i]; | ||
//console.log(curpath, parts[i], fs.existsSync(curpath)); | ||
if (!fs.existsSync(curpath)) | ||
{ | ||
fconsole.log('Create dir', curpath); | ||
fs.mkdirSync(curpath); | ||
} | ||
} | ||
} | ||
return filename; | ||
} |
@@ -19,2 +19,3 @@ | ||
var targets = ['zip', 'input-graph', 'output-graph', 'fs']; // last is default | ||
var handlers = { | ||
@@ -30,2 +31,10 @@ pack: function(){ | ||
this.cssSingleFile = false; | ||
}, | ||
target: function(target){ | ||
target = String(target).toLowerCase(); | ||
if (targets.indexOf(target) == -1) | ||
return 'fs'; | ||
return target; | ||
} | ||
@@ -75,2 +84,4 @@ } | ||
.option('-t, --target <target>', 'Define what build should produce. Target could be: ' + targets.join(', ') + ' (file system, by default).', handlers.target, targets[targets.length - 1]) | ||
// bulk flags | ||
@@ -85,3 +96,3 @@ .option('-p, --pack', 'Pack sources. It equals to: --js-build-mode --js-cut-dev --js-pack --css-pack') | ||
.option('--js-build-mode', 'Evaluate modules code (close to how basis.require works).') | ||
.option('--js-cut-dev', 'Remove code marked as debug from javascript source (cut lines after ;;; and /** @cut .. */)') | ||
.option('--js-cut-dev', 'Remove code marked as debug from javascript source (cut off lines after ;;; and /** @cut .. */)') | ||
.option('-r, --js-resolve-path', '(experimental) Resolve local pathes to globals and replace for global references') | ||
@@ -92,9 +103,13 @@ .option('--js-pack', 'Pack javascript source.') | ||
.option('--css-no-single-file', 'Avoid merge CSS source into one file.') | ||
//.option('--css-optimize-names', 'Replace css class names for shorter one.') | ||
.option('--css-optimize-names', '(reserved, but not work for now) Replace css class names for shorter one.') | ||
.option('--css-pack', 'Pack CSS source.') | ||
//.option('--css-inline-image-size <n>', 'Max size for resource to be inlined (in bytes).', Number, 0) | ||
.option('-i, --css-inline-image-size <max-size>', '(reserved, but not work for now) Max size for resource to be inlined (in bytes). Default is 0, don\'t inline images.', Number, 0) | ||
//experimental | ||
.option('-l, --l10n-pack', 'Build l10n index, pack dictionaries and replace token names for shorter one if possible.') | ||
//.on('target', handlers.target) | ||
.on('*', function(args){ | ||
console.log(args); | ||
this.file = path.resolve(args[0]); | ||
@@ -111,3 +126,2 @@ }); | ||
// TODO: remove | ||
@@ -114,0 +128,0 @@ options.buildMode = true; |
{ | ||
"name": "basisjs-tools", | ||
"title": "Basis developer tools", | ||
"version": "0.0.31", | ||
"version": "0.0.32", | ||
"homepage": "https://github.com/lahmatiy/basisjs-tools", | ||
@@ -38,8 +38,9 @@ "description": "Developer tools for basis.js framework", | ||
"htmlparser2": "~2.3.0", | ||
"csso": "~1.2.14", | ||
"csso": "~1.3.5", | ||
"uglify-js": "~1.3.0", | ||
"socket.io": "~0.9.9", | ||
"mime": "~1.2.6", | ||
"jsdom-nocontextifiy": "~0.2.10" | ||
"jsdom-nocontextifiy": "~0.2.10", | ||
"node-zip": "0.0.2" | ||
} | ||
} |
@@ -0,0 +0,0 @@ var util = require('util'); |
@@ -0,0 +0,0 @@ var htmlparser = require("htmlparser2"); |
@@ -0,0 +0,0 @@ var parse = require('../../../build/js/parse.js'); |
@@ -0,0 +0,0 @@ var parser = require('uglify-js').parser; |
@@ -0,0 +0,0 @@ var parser = require('uglify-js').parser; |
@@ -0,0 +0,0 @@ var parse = require('../../../build/tmpl/parse.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
Non-existent author
Supply chain riskThe package was published by an npm account that no longer exists.
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
283154
74
7701
8
1
11
+ Addednode-zip@0.0.2
+ Addedcsso@1.3.12(transitive)
+ Addednode-zip@0.0.2(transitive)
- Removedcsso@1.2.18(transitive)
Updatedcsso@~1.3.5