fast-url-parser
Advanced tools
Comparing version 1.0.2-0 to 1.0.3-0
"use strict"; | ||
Error.stackTraceLimit = 100; | ||
var astPasses = require("./ast_passes.js"); | ||
module.exports = function( grunt ) { | ||
var isCI = !!grunt.option("ci"); | ||
var license; | ||
function getLicense() { | ||
if( !license ) { | ||
var fs = require("fs"); | ||
var text = fs.readFileSync("LICENSE", "utf8"); | ||
text = text.split("\n").map(function(line, index){ | ||
return " * " + line; | ||
}).join("\n") | ||
license = "/**\n" + text + "\n */\n"; | ||
} | ||
return license | ||
} | ||
function writeFile( dest, content ) { | ||
@@ -28,21 +12,2 @@ grunt.file.write( dest, content ); | ||
var getGlobals = function() { | ||
var fs = require("fs"); | ||
var file = "./src/constants.js"; | ||
var contents = fs.readFileSync(file, "utf8"); | ||
var rconstantname = /CONSTANT\(\s*([^,]+)/g; | ||
var m; | ||
var globals = { | ||
"console": false, | ||
"require": false, | ||
"module": false, | ||
"define": false, | ||
"escape": false | ||
}; | ||
while( ( m = rconstantname.exec( contents ) ) ) { | ||
globals[m[1]] = false; | ||
} | ||
return globals; | ||
} | ||
gruntConfig.pkg = grunt.file.readJSON("package.json"); | ||
@@ -53,3 +18,9 @@ | ||
options: { | ||
globals: getGlobals(), | ||
globals: { | ||
"console": false, | ||
"require": false, | ||
"module": false, | ||
"define": false, | ||
"escape": false | ||
}, | ||
@@ -117,42 +88,7 @@ "bitwise": false, | ||
if( !isCI ) { | ||
gruntConfig.jshint.all.options.reporter = require("jshint-stylish"); | ||
} | ||
gruntConfig.bump = { | ||
options: { | ||
files: ['package.json'], | ||
updateConfigs: [], | ||
commit: true, | ||
commitMessage: 'Release v%VERSION%', | ||
commitFiles: ['-a'], | ||
createTag: true, | ||
tagName: 'v%VERSION%', | ||
tagMessage: 'Version %VERSION%', | ||
false: true, | ||
pushTo: 'master', | ||
gitDescribeOptions: '--tags --always --abbrev=1 --dirty=-d' // options to use with '$ git describe' | ||
} | ||
}; | ||
gruntConfig.jshint.all.options.reporter = require("jshint-stylish"); | ||
grunt.initConfig(gruntConfig); | ||
grunt.loadNpmTasks('grunt-contrib-jshint'); | ||
grunt.loadNpmTasks('grunt-bump'); | ||
grunt.registerTask( "build", function() { | ||
var fs = require("fs"); | ||
var CONSTANTS_FILE = "./src/constants.js"; | ||
astPasses.readConstants(fs.readFileSync(CONSTANTS_FILE, "utf8"), CONSTANTS_FILE); | ||
var fileNames = ["urlparser.js"]; | ||
fileNames.forEach(function(fileName){ | ||
var src = fs.readFileSync("./src/" + fileName, "utf8"); | ||
src = astPasses.removeComments(src, fileName); | ||
src = astPasses.expandConstants(src, fileName); | ||
src = getLicense() + src; | ||
writeFile("./js/" + fileName, src); | ||
}); | ||
}); | ||
grunt.registerTask( "testrun", function() { | ||
@@ -189,5 +125,5 @@ var fs = require("fs"); | ||
grunt.registerTask( "test", ["jshint", "build", "testrun"] ); | ||
grunt.registerTask( "default", ["jshint", "build"] ); | ||
grunt.registerTask( "test", ["jshint", "testrun"] ); | ||
grunt.registerTask( "default", ["jshint"] ); | ||
}; |
{ | ||
"name": "fast-url-parser", | ||
"description": "Extremely fast implementation of node core url library", | ||
"version": "1.0.2-0", | ||
"version": "1.0.3-0", | ||
"keywords": [ | ||
@@ -6,0 +6,0 @@ "fast", |
@@ -0,1 +1,29 @@ | ||
#Introduction | ||
Fast implementation of an url parser for node.js. | ||
#Quick start | ||
npm install fast-url-parser | ||
```js | ||
var url = require("fast-url-parser"); | ||
``` | ||
#API | ||
This module has exactly the same API and semantics as the `require("url");`- module that comes with node. | ||
See [Node.JS URL API documentation](http://nodejs.org/docs/latest/api/url.html). | ||
If in your application you may want all modules use this parser automatically, you can do so by inserting this line at the beginning of your application: | ||
```js | ||
require("fast-url-parser").replace(); | ||
``` | ||
Anything that now calls `require("url")` will instead get an instance of this module instead of the url parser that comes with node core. | ||
#Performance | ||
Petka Antonov@PETKAANTONOV-PC ~/urlparser (master) | ||
@@ -18,1 +46,25 @@ $ node ./benchmark/urlparser.js | ||
misc/url.js resolve("./foo/bar?baz"): 6968.4 | ||
#License | ||
MIT License: | ||
Copyright (c) 2014 Petka Antonov | ||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
The above copyright notice and this permission notice shall be included in | ||
all copies or substantial portions of the Software. | ||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
THE SOFTWARE. |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
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
70
1
8602
5
106
1