Comparing version 0.0.18 to 0.1.0
@@ -19,7 +19,2 @@ var PATH = require('path'), | ||
.def(PATH.join(__dirname, 'tech.js')) | ||
.val(function(t) { | ||
t = PATH.basename(t) === t ? | ||
PATH.join(__dirname, 'techs', t + '.js') : | ||
PATH.resolve(t); | ||
return new (require(t).Tech)() }) | ||
.end() | ||
@@ -37,9 +32,24 @@ .opt() | ||
.end() | ||
.opt() | ||
.name('freeze').title('Freeze') | ||
.short('f').long('freeze') | ||
.def('yes') | ||
.val(function(f) { | ||
return (f == 'yes' || f == 'no')? f : 'yes'; | ||
}) | ||
.end() | ||
.act(function(opts, args, res) { | ||
var t = opts.tech, | ||
tech; | ||
return opts.tech | ||
.createFile(opts.input) | ||
t = PATH.basename(t) === t ? | ||
PATH.join(__dirname, 'techs', t + '.js') : | ||
PATH.resolve(t); | ||
tech = new (require(t).Tech)(opts); | ||
return tech | ||
.createFile(opts.input) | ||
.read() | ||
.write(opts.output); | ||
}); |
@@ -10,2 +10,6 @@ var Q = require('q'), | ||
__constructor: function(opts) { | ||
this.opts = opts; | ||
}, | ||
createFile: function(path, type, parent) { | ||
@@ -12,0 +16,0 @@ var file = new this.File(this, path, type, parent); |
var INHERIT = require('inherit'), | ||
base = require('../tech'), | ||
cssbase = require('./css-base'), | ||
FREEZE = require('../freeze'), | ||
stringRe = "(?:(?:'[^'\\r\\n]*')|(?:\"[^\"\\r\\n]*\"))", | ||
@@ -11,6 +14,5 @@ urlRe = "(?:(?:url\\(\\s*" + stringRe + "\\s*\\))|(?:url\\(\\s*[^\\s\\r\\n'\"]*\\s*\\)))", | ||
exports.Tech = INHERIT(base.Tech, { | ||
exports.Tech = INHERIT(cssbase.Tech, { | ||
File: INHERIT(cssbase.File, { | ||
File: INHERIT(base.File, { | ||
parseInclude: function(content) { | ||
@@ -27,7 +29,7 @@ var m, found = []; | ||
var url = parseUrl(m[1]); | ||
if (isRelative(url)) found.push({ type: 'include', url: url, range: [ m.index, allRe.lastIndex ] }); | ||
if (isProcessable(url)) found.push({ type: 'include', url: url, range: [ m.index, allRe.lastIndex ] }); | ||
} else if (urlStringRx.test(m[0])) { | ||
// url(...) | ||
var url = parseUrl(m[0]); | ||
if (isRelative(url)) found.push({ type: 'link', url: url, range: [ m.index, allRe.lastIndex-1 ] }); | ||
if (isProcessable(url)) found.push({ type: 'link', url: url, range: [ m.index, allRe.lastIndex-1 ] }); | ||
} else { | ||
@@ -64,3 +66,3 @@ throw new Error('Failed to match: ' + m[0]); | ||
processLink: function(path) { | ||
return 'url(' + this.pathFrom(path) + ')'; | ||
return 'url(' + this.__base(path) + ')'; | ||
}, | ||
@@ -83,3 +85,4 @@ | ||
function isRelative(url) { | ||
function isProcessable(url) { | ||
if (url.indexOf('#') === 0 || url.indexOf('?') === 0) return false; | ||
return !((url.lastIndexOf('/', 0) === 0) || /^\w+:/.test(url)); | ||
@@ -86,0 +89,0 @@ } |
var INHERIT = require('inherit'), | ||
FREEZE = require('../freeze'), | ||
util = require('util'), | ||
base = require('../tech'), | ||
cssbase = require('./css-base'), | ||
ometajs = require('./css.ometajs.js'), | ||
@@ -21,4 +23,4 @@ parser = ometajs.BorschikCSSParser, | ||
exports.Tech = INHERIT(base.Tech, { | ||
File: INHERIT(base.File, { | ||
exports.Tech = INHERIT(cssbase.Tech, { | ||
File: INHERIT(cssbase.File, { | ||
@@ -52,6 +54,2 @@ __constructor: function(tech, path, type, parent) { | ||
processLink: function(path) { | ||
return JSON.stringify(this.pathFrom(path)) | ||
}, | ||
processPath: function(path) { | ||
@@ -58,0 +56,0 @@ return path.replace(/^(.*?)(\?|$)/, '$1'); |
@@ -69,3 +69,3 @@ var ometajs_ = require("ometajs"); | ||
return this._match("uri") && this._list(function() { | ||
return (this._match("string") || this._match("raw")) && this._skip() && (uri = this._getIntermediate(), true) && !uri.replace(/["']/g, "").match(/^((\w+:)?\/\/|data\:)/); | ||
return (this._match("string") || this._match("raw")) && this._skip() && (uri = this._getIntermediate(), true) && !uri.replace(/["']/g, "").match(/^((\w+:)?\/\/|data\:|\/|#|\?)/); | ||
}); | ||
@@ -72,0 +72,0 @@ }) && this._exec([ "uri", [ "borschik", this._file.child("link", uri.replace(/["']/g, "")) ] ]); |
{ | ||
"name": "borschik", | ||
"description": "Extendable builder for text-based file formats", | ||
"version": "0.0.18", | ||
"version": "0.1.0", | ||
"homepage": "http://github.com/veged/borschik", | ||
"author": "Sergey Berezhnoy <veged@ya.ru> (http://github.com/veged)", | ||
"maintainers": [], | ||
"maintainers": [ | ||
"Sergey Belov <peimei@ya.ru> (http://github.com/arikon)" | ||
], | ||
"repository": { | ||
@@ -15,3 +17,2 @@ "type": "git", | ||
}, | ||
"main": "./lib/borschik.js", | ||
"bin": { | ||
@@ -29,4 +30,12 @@ "borschik": "./bin/borschik" | ||
"devDependencies": { | ||
"ometajs": "~3.1.5" | ||
"istanbul": "~0.1.22", | ||
"mocha-as-promised": "*", | ||
"mocha-istanbul": "*", | ||
"ometajs": "~3.1.15", | ||
"mocha": "~1.7.0" | ||
}, | ||
"scripts": { | ||
"test": "make test", | ||
"coverage": "make coverage" | ||
}, | ||
"engines": [ | ||
@@ -37,3 +46,3 @@ "node >= 0.6.0" | ||
{ | ||
"type": "AS IS" | ||
"type": "MIT" | ||
} | ||
@@ -40,0 +49,0 @@ ], |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
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
No License Found
License(Experimental) License information could not be found.
Found 1 instance in 1 package
49812
47
0
1063
5
6