From b1a7c0fe896e90f329f18d1cb81f4aa5a54d6295 Mon Sep 17 00:00:00 2001 From: sixertoy Date: Tue, 14 Jul 2015 16:51:55 +0200 Subject: [PATCH 1/3] add bower --- Gruntfile.js | 14 ++ bower.json | 17 ++ dist/isuri.js | 392 ++++++++++++++++++++++++++++++++++++++++++++++ dist/isuri.min.js | 2 + grunt/aliases.yml | 6 + grunt/bump.js | 21 +++ grunt/clean.js | 8 + grunt/copy.js | 13 ++ grunt/uglify.js | 18 +++ index.js | 390 +-------------------------------------------- package.json | 82 +++++----- src/isuri.js | 392 ++++++++++++++++++++++++++++++++++++++++++++++ src/isuri.map | 1 + 13 files changed, 934 insertions(+), 422 deletions(-) create mode 100644 Gruntfile.js create mode 100644 bower.json create mode 100644 dist/isuri.js create mode 100644 dist/isuri.min.js create mode 100644 grunt/aliases.yml create mode 100644 grunt/bump.js create mode 100644 grunt/clean.js create mode 100644 grunt/copy.js create mode 100644 grunt/uglify.js create mode 100644 src/isuri.js create mode 100644 src/isuri.map diff --git a/Gruntfile.js b/Gruntfile.js new file mode 100644 index 0000000..2718c3e --- /dev/null +++ b/Gruntfile.js @@ -0,0 +1,14 @@ +/** + * + * + * + * Copyright (c) + * Licensed under the MIT license. + * + */ +/*jslint indent: 4 */ +/*global module, require */ +module.exports = function (grunt) { + 'use strict'; + require('load-grunt-config')(grunt); +}; diff --git a/bower.json b/bower.json new file mode 100644 index 0000000..b41239b --- /dev/null +++ b/bower.json @@ -0,0 +1,17 @@ +{ + "name": "isuri", + "main": "dist/isuri.js", + "version": "0.0.2", + "homepage": "https://github.com/sixertoy/isuri", + "authors": [ + "sixertoy " + ], + "license": "MIT", + "ignore": [ + "**/.*", + "node_modules", + "bower_components", + "test", + "tests" + ] +} \ No newline at end of file diff --git a/dist/isuri.js b/dist/isuri.js new file mode 100644 index 0000000..ceea2f4 --- /dev/null +++ b/dist/isuri.js @@ -0,0 +1,392 @@ +/*jslint indent:4, vars: true */ +/*globals module */ +(function () { + + 'use strict'; + + /** + * Basic Values (http://tools.ietf.org/html/rfc3986#page-11) + * + * This specification uses the Augmented Backus-Naur Form (ABNF) + * notation of [RFC2234], including the following core ABNF syntax rules + * defined by that specification: ALPHA (letters), CR (carriage return), + * DIGIT (decimal digits), DQUOTE (double quote), HEXDIG (hexadecimal + * digits), LF (line feed), and SP (space). The complete URI syntax is + * collected in Appendix A. + * + * @type {string} + */ + + /** + * Digit (http://tools.ietf.org/html/rfc2234#page-10) + * + * DIGIT = %x30-39 ; 0-9 + * + * @type {string} + */ + var digit = '0-9', + digitOnly = '[' + digit + ']'; + + /** + * Alpha (http://tools.ietf.org/html/rfc2234#page-11) + * + * ALPHA = %x41-5A / %x61-7A ; A-Z / a-z + * + * @type {string} + */ + var alpha = 'a-zA-Z'; + + /** + * Hexadecimal Digit (http://tools.ietf.org/html/rfc2234#page-11) + * + * HEXDIG = DIGIT / "A" / "B" / "C" / "D" / "E" / "F" + * + * @type {string} + */ + var hexDigit = digit + 'A-F', + hexDigitOnly = '[' + hexDigit + ']'; + + /** + * Unreserved (http://tools.ietf.org/html/rfc3986#page-13) + * + * Characters that are allowed in a URI but do not have a reserved + * purpose are called unreserved. These include uppercase and lowercase + * letters, decimal digits, hyphen, period, underscore, and tilde. + * + * unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~" + * + * @type {string} + */ + var unreserved = alpha + digit + '-\\._~'; + + /** + * Percent Encoded (http://tools.ietf.org/html/rfc3986#page-12) + * + * percent-encoding mechanism is used to represent a data octet in a + * component when that octet's corresponding character is outside the + * allowed set or is being used as a delimiter of, or within, the + * component. A percent-encoded octet is encoded as a character + * triplet, consisting of the percent character "%" followed by the two + * hexadecimal digits representing that octet's numeric value. For + * example, "%20" is the percent-encoding for the binary octet + * "00100000" (ABNF: %x20), which in US-ASCII corresponds to the space + * character (SP). + * + * pct-encoded = "%" HEXDIG HEXDIG + * + * @type {string} + */ + var pctEncoded = '%' + hexDigit; + + /** + * Sub Delimiters (http://tools.ietf.org/html/rfc3986#page-13) + * + * + * + * sub-delims = "!" / "$" / "&" / "'" / "(" / ")" / "*" / "+" / "," / ";" / "=" + * + * @type {string} + */ + var subDelims = '!$&\'()*+,;='; + + /** + * PChar (http://tools.ietf.org/html/rfc3986#page-23) + * + * pchar = unreserved / pct-encoded / sub-delims / ":" / "@" + * + * @type {string} + */ + var pchar = unreserved + pctEncoded + subDelims + ':@', + pcharOnly = '[' + pchar + ']'; + + /** + * Alternative Rules (http://tools.ietf.org/html/rfc2234#page-6) + * + * ements separated by forward slash ("/") are alternatives. + * + * @type {string} + */ + var or = '|'; + + /** + * Rule to support zero-padded addresses. + * + * @type {string} + */ + var zeroPad = '0?'; + + /** + * dec-octect (http://tools.ietf.org/html/rfc3986#page-20) + * + * dec-octet = DIGIT ; 0-9 + * / %x31-39 DIGIT ; 10-99 + * / "1" 2DIGIT ; 100-199 + * / "2" %x30-34 DIGIT ; 200-249 + * / "25" %x30-35 ; 250-255 + * + * @type {string} + */ + var decOctect = '(' + zeroPad + zeroPad + digitOnly + or + zeroPad + '[1-9]' + digitOnly + or + '1' + digitOnly + digitOnly + or + '2' + '[0-4]' + digitOnly + or + '25' + '[0-5])'; + + /** + * Scheme (http://tools.ietf.org/html/rfc3986#page-17) + * + * Scheme names consist of a sequence of characters beginning with a + * letter and followed by any combination of letters, digits, plus + * ("+"), period ("."), or hyphen ("-"). + * + * @type {string} + */ + var scheme = '^[a-zA-Z][a-zA-Z0-9+\\.-]*:'; + + /** + * User Info (http://tools.ietf.org/html/rfc3986#page-18) + * + * The userinfo subcomponent may consist of a user name and, optionally, + * scheme-specific information about how to gain authorization to access + * the resource. The user information, if present, is followed by a + * commercial at-sign ("@") that delimits it from the host. + * + * userinfo = *( unreserved / pct-encoded / sub-delims / ":" ) + * + * @type {string} + */ + var userinfo = '([' + unreserved + pctEncoded + subDelims + ':]*@)?'; + + /** + * IPv4address (http://tools.ietf.org/html/rfc3986#page-20) + * + * A host identified by an IPv4 literal address is represented in + * dotted-decimal notation (a sequence of four decimal numbers in the + * range 0 to 255, separated by "."), as described in [RFC1123] by + * reference to [RFC0952]. Note that other forms of dotted notation may + * be interpreted on some platforms, as described in Section 7.4, but + * only the dotted-decimal form of four octets is allowed by this + * grammar. + * + * IPv4address = dec-octet "." dec-octet "." dec-octet "." dec-octet + * + * @type {string} + */ + var IPv4address = '(' + decOctect + '\\.){3}' + decOctect; + + /** + * IPv6 Address (http://tools.ietf.org/html/rfc3986#page-20) + * + * A 128-bit IPv6 address is divided into eight 16-bit pieces. Each + * piece is represented numerically in case-insensitive hexadecimal, + * using one to four hexadecimal digits (leading zeroes are permitted). + * The eight encoded pieces are given most-significant first, separated + * by colon characters. Optionally, the least-significant two pieces + * may instead be represented in IPv4 address textual format. A + * sequence of one or more consecutive zero-valued 16-bit pieces within + * the address may be elided, omitting all their digits and leaving + * exactly two consecutive colons in their place to mark the elision. + * + * IPv6address = 6( h16 ":" ) ls32 + * / "::" 5( h16 ":" ) ls32 + * / [ h16 ] "::" 4( h16 ":" ) ls32 + * / [ *1( h16 ":" ) h16 ] "::" 3( h16 ":" ) ls32 + * / [ *2( h16 ":" ) h16 ] "::" 2( h16 ":" ) ls32 + * / [ *3( h16 ":" ) h16 ] "::" h16 ":" ls32 + * / [ *4( h16 ":" ) h16 ] "::" ls32 + * / [ *5( h16 ":" ) h16 ] "::" h16 + * / [ *6( h16 ":" ) h16 ] "::" + * + * ls32 = ( h16 ":" h16 ) / IPv4address ; least-significant 32 bits of address + * + * h16 = 1*4HEXDIG ; 16 bits of address represented in hexadecimal + * + * @type {string} + */ + var h16 = '(' + hexDigitOnly + '){1,4}', + ls32 = '(' + h16 + ':' + h16 + '|' + IPv4address + ')', + IPv6SixHex = '(' + h16 + ':){6}' + ls32, + IPv6FiveHex = '::(' + h16 + ':){5}' + ls32, + IPv6FourHex = h16 + '::(' + h16 + ':){4}' + ls32, + IPv6ThreeeHex = '(' + h16 + ':){0,1}' + h16 + '::(' + h16 + ':){3}' + ls32, + IPv6TwoHex = '(' + h16 + ':){0,2}' + h16 + '::(' + h16 + ':){2}' + ls32, + IPv6OneHex = '(' + h16 + ':){0,3}' + h16 + '::' + h16 + ':' + ls32, + IPv6NoneHex = '(' + h16 + ':){0,4}' + h16 + '::' + ls32, + IPv6NoneHex2 = '(' + h16 + ':){0,5}' + h16 + '::' + h16, + IPv6NoneHex3 = '(' + h16 + ':){0,6}' + h16 + '::', + IPv6address = '(' + IPv6SixHex + or + IPv6FiveHex + or + IPv6FourHex + or + IPv6ThreeeHex + or + IPv6TwoHex + or + IPv6OneHex + or + IPv6NoneHex + or + IPv6NoneHex2 + or + IPv6NoneHex3 + ')'; + + /** + * IP Future Versions (http://tools.ietf.org/html/rfc3986#page-19) + * + * IPvFuture = "v" 1*HEXDIG "." 1*( unreserved / sub-delims / ":" ) + * + * @type {string} + */ + var IPvFuture = '(v' + hexDigitOnly + '+\\.[' + unreserved + subDelims + ':]+)'; + + /** + * IP Literal (http://tools.ietf.org/html/rfc3986#page-19) + * + * A host identified by an Internet Protocol literal address, version 6 + * [RFC3513] or later, is distinguished by enclosing the IP literal + * within square brackets ("[" and "]"). This is the only place where + * square bracket characters are allowed in the URI syntax. In + * anticipation of future, as-yet-undefined IP literal address formats, + * an implementation may use an optional version flag to indicate such a + * format explicitly rather than rely on heuristic determination. + * + * IP-literal = "[" ( IPv6address / IPvFuture ) "]" + * + * @type {string} + */ + var IPLiteral = '\\[(' + IPv6address + or + IPvFuture + ')\\]'; + + /** + * Registered Name (http://tools.ietf.org/html/rfc3986#page-21) + * + * A registered name consists of a sequence of domain labels separated + * by ".", each domain label starting and ending with an alphanumeric + * character and possibly also containing "-" characters. The rightmost + * domain label of a fully qualified domain name in DNS may be followed + * by a single "." and should be if it is necessary to distinguish between + * the complete domain name and some local domain. + * + * reg-name = *( unreserved / pct-encoded / sub-delims ) + * + * @type {string} + */ + var regName = '[' + unreserved + pctEncoded + subDelims + ']{0,255}'; + + /** + * Host (http://tools.ietf.org/html/rfc3986#page-18) + * + * The host subcomponent of authority is identified by an IP literal + * encapsulated within square brackets, an IPv4 address in dotted- + * decimal form, or a registered name. + * + * host = IP-literal / IPv4address / reg-name + * + * @type {string} + */ + var host = '(' + IPLiteral + or + IPv4address + or + regName + ')'; + + /** + * Port (http://tools.ietf.org/html/rfc3986#page-22) + * + * The port subcomponent of authority is designated by an optional port + * number in decimal following the host and delimited from it by a + * single colon (":") character. + * + * port = *DIGIT + * + * URI producers and normalizers should omit the port component and its + * ":" delimiter if port is empty or if its value would be the same as + * that of the scheme's default. + * + * @type {string} + */ + var port = '(:' + digitOnly + '*)?'; + + /** + * Authority (http://tools.ietf.org/html/rfc3986#page-17) + * + * The authority component is preceded by a double slash ("//") and is + * terminated by the next slash ("/"), question mark ("?"), or number + * sign ("#") character, or by the end of the URI. + * + * authority = [ userinfo "@" ] host [ ":" port ] + * + * URI producers and normalizers should omit the ":" delimiter that + * separates host from port if the port component is empty. Some + * schemes do not allow the userinfo and/or port subcomponents. + * + * If a URI contains an authority component, then the path component + * must either be empty or begin with a slash ("/") character. + * + * @type {string} + */ + var authority = '(([\\//]{2}[\\//]?)|(?=[^\/]))' + userinfo + host + port; + + /** + * Path (http://tools.ietf.org/html/rfc3986#page-22) + * + * The path component contains data, usually organized in hierarchical + * form, that, along with data in the non-hierarchical query component + * (Section 3.4), serves to identify a resource within the scope of the + * URI's scheme and naming authority (if any). The path is terminated + * by the first question mark ("?") or number sign ("#") character, or + * by the end of the URI. + + * If a URI contains an authority component, then the path component + * must either be empty or begin with a slash ("/") character. + + * path = path-abempty ; begins with "/" or is empty + * / path-absolute ; begins with "/" but not "//" + * / path-noscheme ; begins with a non-colon segment + * / path-rootless ; begins with a segment + * / path-empty ; zero characters + + * path-abempty = *( "/" segment ) + * path-absolute = "/" [ segment-nz *( "/" segment ) ] + * path-noscheme = segment-nz-nc *( "/" segment ) + * path-rootless = segment-nz *( "/" segment ) + * path-empty = 0 + * + * segment = *pchar + * segment-nz = 1*pchar + * segment-nz-nc = 1*( unreserved / pct-encoded / sub-delims / "@" ) + * ; non-zero-length segment without any colon ":" + * + * @type {string} + */ + var segment = pcharOnly + '*', + segmentNz = pcharOnly + '+', + segmentNzNc = '[' + unreserved + pctEncoded + subDelims + '@]+', + pathAbEmpty = '(\\/' + segment + ')*', + pathAbsolute = '\\/' + segmentNz + pathAbEmpty, + pathNoScheme = segmentNzNc + pathAbEmpty, + pathRootless = segmentNz + pathAbEmpty, + path = '(\\/(' + pathAbEmpty + or + pathAbsolute + or + pathNoScheme + or + pathRootless + '))?'; + + /** + * Query (http://tools.ietf.org/html/rfc3986#page-23) + * + * The query component contains non-hierarchical data that, along with + * data in the path component (Section 3.3), serves to identify a + * resource within the scope of the URI's scheme and naming authority + * (if any). The query component is indicated by the first question + * mark ("?") character and terminated by a number sign ("#") character + * or by the end of the URI. + * + * query = *( pchar / "/" / "?" ) + * + * @type {string} + */ + var query = '(\\?[' + pchar + '\\/\\?]*(?=#|$))?'; + + /** + * Fragment (http://tools.ietf.org/html/rfc3986#page-24) + * The fragment identifier component of a URI allows indirect + * identification of a secondary resource by reference to a primary + * resource and additional identifying information. The identified + * secondary resource may be some portion or subset of the primary + * resource, some view on representations of the primary resource, or + * some other resource defined or described by those representations. A + * fragment identifier component is indicated by the presence of a + * number sign ("#") character and terminated by the end of the URI. + * + * fragment = *( pchar / "/" / "?" ) + * + * @type {string} + */ + var fragment = '(#[' + pchar + '\\/\\?]*$)?'; + + var uriRegex = new RegExp(scheme + authority + path + query + fragment); + + function testUri(str) { + return uriRegex.test(str); + } + + module.exports = { + test: testUri, + regex: uriRegex + }; + +}()); \ No newline at end of file diff --git a/dist/isuri.min.js b/dist/isuri.min.js new file mode 100644 index 0000000..d1f2949 --- /dev/null +++ b/dist/isuri.min.js @@ -0,0 +1,2 @@ +!function(){"use strict";function testUri(str){return uriRegex.test(str)}var digit="0-9",digitOnly="["+digit+"]",alpha="a-zA-Z",hexDigit=digit+"A-F",hexDigitOnly="["+hexDigit+"]",unreserved=alpha+digit+"-\\._~",pctEncoded="%"+hexDigit,subDelims="!$&'()*+,;=",pchar=unreserved+pctEncoded+subDelims+":@",pcharOnly="["+pchar+"]",or="|",zeroPad="0?",decOctect="("+zeroPad+zeroPad+digitOnly+or+zeroPad+"[1-9]"+digitOnly+or+"1"+digitOnly+digitOnly+or+"2[0-4]"+digitOnly+or+"25[0-5])",scheme="^[a-zA-Z][a-zA-Z0-9+\\.-]*:",userinfo="(["+unreserved+pctEncoded+subDelims+":]*@)?",IPv4address="("+decOctect+"\\.){3}"+decOctect,h16="("+hexDigitOnly+"){1,4}",ls32="("+h16+":"+h16+"|"+IPv4address+")",IPv6SixHex="("+h16+":){6}"+ls32,IPv6FiveHex="::("+h16+":){5}"+ls32,IPv6FourHex=h16+"::("+h16+":){4}"+ls32,IPv6ThreeeHex="("+h16+":){0,1}"+h16+"::("+h16+":){3}"+ls32,IPv6TwoHex="("+h16+":){0,2}"+h16+"::("+h16+":){2}"+ls32,IPv6OneHex="("+h16+":){0,3}"+h16+"::"+h16+":"+ls32,IPv6NoneHex="("+h16+":){0,4}"+h16+"::"+ls32,IPv6NoneHex2="("+h16+":){0,5}"+h16+"::"+h16,IPv6NoneHex3="("+h16+":){0,6}"+h16+"::",IPv6address="("+IPv6SixHex+or+IPv6FiveHex+or+IPv6FourHex+or+IPv6ThreeeHex+or+IPv6TwoHex+or+IPv6OneHex+or+IPv6NoneHex+or+IPv6NoneHex2+or+IPv6NoneHex3+")",IPvFuture="(v"+hexDigitOnly+"+\\.["+unreserved+subDelims+":]+)",IPLiteral="\\[("+IPv6address+or+IPvFuture+")\\]",regName="["+unreserved+pctEncoded+subDelims+"]{0,255}",host="("+IPLiteral+or+IPv4address+or+regName+")",port="(:"+digitOnly+"*)?",authority="(([\\//]{2}[\\//]?)|(?=[^/]))"+userinfo+host+port,segment=pcharOnly+"*",segmentNz=pcharOnly+"+",segmentNzNc="["+unreserved+pctEncoded+subDelims+"@]+",pathAbEmpty="(\\/"+segment+")*",pathAbsolute="\\/"+segmentNz+pathAbEmpty,pathNoScheme=segmentNzNc+pathAbEmpty,pathRootless=segmentNz+pathAbEmpty,path="(\\/("+pathAbEmpty+or+pathAbsolute+or+pathNoScheme+or+pathRootless+"))?",query="(\\?["+pchar+"\\/\\?]*(?=#|$))?",fragment="(#["+pchar+"\\/\\?]*$)?",uriRegex=new RegExp(scheme+authority+path+query+fragment);module.exports={test:testUri,regex:uriRegex}}(); +//# sourceMappingURL=../src/isuri.map \ No newline at end of file diff --git a/grunt/aliases.yml b/grunt/aliases.yml new file mode 100644 index 0000000..b7a76b3 --- /dev/null +++ b/grunt/aliases.yml @@ -0,0 +1,6 @@ +build: + - clean + - copy + - uglify +default: + - build \ No newline at end of file diff --git a/grunt/bump.js b/grunt/bump.js new file mode 100644 index 0000000..e4d4fb0 --- /dev/null +++ b/grunt/bump.js @@ -0,0 +1,21 @@ +/*jslint indent: 4 */ +/*global module */ +module.exports = function (grunt, options) { + 'use strict'; + return { + options: { + files: ['package.json'], + updateConfigs: [], + commit: false, + commitMessage: '<%= bump.type %>(<%= bump.scope %>): <%= bump.subject %>', + commitFiles: ['-a'], + createTag: false, + tagName: 'v%VERSION%', + tagMessage: 'Version %VERSION%', + push: false, + pushTo: 'origin', + gitDescribeOptions: '--tags --always --abbrev=1 --dirty=-d', + globalReplace: false + } + }; +}; diff --git a/grunt/clean.js b/grunt/clean.js new file mode 100644 index 0000000..eb99556 --- /dev/null +++ b/grunt/clean.js @@ -0,0 +1,8 @@ +/*jslint indent: 4 */ +/*global module */ +module.exports = function (grunt, opts) { + 'use strict'; + return { + build: ['dist/**/*'], + }; +}; \ No newline at end of file diff --git a/grunt/copy.js b/grunt/copy.js new file mode 100644 index 0000000..2b98b8e --- /dev/null +++ b/grunt/copy.js @@ -0,0 +1,13 @@ +/*jslint indent: 4 */ +/*global module */ +module.exports = function (grunt, opts) { + 'use strict'; + return { + all: { + expand: true, + cwd: 'src/', + dest: './dist/', + src: ['**/*.js'] + } + }; +}; \ No newline at end of file diff --git a/grunt/uglify.js b/grunt/uglify.js new file mode 100644 index 0000000..c7b726f --- /dev/null +++ b/grunt/uglify.js @@ -0,0 +1,18 @@ +/*jslint indent: 4 */ +/*global module */ +module.exports = function (grunt, opts) { + 'use strict'; + return { + options: { + mangle: false, + sourceMap: true, + drop_console: true, + sourceMapName: 'src/isuri.map' + }, + all: { + files: { + 'dist/isuri.min.js': 'src/isuri.js' + } + } + }; +}; \ No newline at end of file diff --git a/index.js b/index.js index 7ddd2d0..5aaa1d6 100644 --- a/index.js +++ b/index.js @@ -1,387 +1,9 @@ -(function(module) { +/*jslint indent: 4 */ +/*globals module, require */ +(function () { - /** - * Basic Values (http://tools.ietf.org/html/rfc3986#page-11) - * - * This specification uses the Augmented Backus-Naur Form (ABNF) - * notation of [RFC2234], including the following core ABNF syntax rules - * defined by that specification: ALPHA (letters), CR (carriage return), - * DIGIT (decimal digits), DQUOTE (double quote), HEXDIG (hexadecimal - * digits), LF (line feed), and SP (space). The complete URI syntax is - * collected in Appendix A. - * - * @type {string} - */ + 'use strict'; - /** - * Digit (http://tools.ietf.org/html/rfc2234#page-10) - * - * DIGIT = %x30-39 ; 0-9 - * - * @type {string} - */ - var digit = '0-9', - digitOnly = '[' + digit + ']'; + module.exports = require('./src'); - /** - * Alpha (http://tools.ietf.org/html/rfc2234#page-11) - * - * ALPHA = %x41-5A / %x61-7A ; A-Z / a-z - * - * @type {string} - */ - var alpha = 'a-zA-Z'; - - /** - * Hexadecimal Digit (http://tools.ietf.org/html/rfc2234#page-11) - * - * HEXDIG = DIGIT / "A" / "B" / "C" / "D" / "E" / "F" - * - * @type {string} - */ - var hexDigit = digit + 'A-F', - hexDigitOnly = '[' + hexDigit + ']'; - - /** - * Unreserved (http://tools.ietf.org/html/rfc3986#page-13) - * - * Characters that are allowed in a URI but do not have a reserved - * purpose are called unreserved. These include uppercase and lowercase - * letters, decimal digits, hyphen, period, underscore, and tilde. - * - * unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~" - * - * @type {string} - */ - var unreserved = alpha + digit + '-\\._~'; - - /** - * Percent Encoded (http://tools.ietf.org/html/rfc3986#page-12) - * - * percent-encoding mechanism is used to represent a data octet in a - * component when that octet's corresponding character is outside the - * allowed set or is being used as a delimiter of, or within, the - * component. A percent-encoded octet is encoded as a character - * triplet, consisting of the percent character "%" followed by the two - * hexadecimal digits representing that octet's numeric value. For - * example, "%20" is the percent-encoding for the binary octet - * "00100000" (ABNF: %x20), which in US-ASCII corresponds to the space - * character (SP). - * - * pct-encoded = "%" HEXDIG HEXDIG - * - * @type {string} - */ - var pctEncoded = '%' + hexDigit; - - /** - * Sub Delimiters (http://tools.ietf.org/html/rfc3986#page-13) - * - * - * - * sub-delims = "!" / "$" / "&" / "'" / "(" / ")" / "*" / "+" / "," / ";" / "=" - * - * @type {string} - */ - var subDelims = '!$&\'()*+,;='; - - /** - * PChar (http://tools.ietf.org/html/rfc3986#page-23) - * - * pchar = unreserved / pct-encoded / sub-delims / ":" / "@" - * - * @type {string} - */ - var pchar = unreserved + pctEncoded + subDelims + ':@', - pcharOnly = '[' + pchar + ']'; - - /** - * Alternative Rules (http://tools.ietf.org/html/rfc2234#page-6) - * - * ements separated by forward slash ("/") are alternatives. - * - * @type {string} - */ - var or = '|'; - - /** - * Rule to support zero-padded addresses. - * - * @type {string} - */ - var zeroPad = '0?'; - - /** - * dec-octect (http://tools.ietf.org/html/rfc3986#page-20) - * - * dec-octet = DIGIT ; 0-9 - * / %x31-39 DIGIT ; 10-99 - * / "1" 2DIGIT ; 100-199 - * / "2" %x30-34 DIGIT ; 200-249 - * / "25" %x30-35 ; 250-255 - * - * @type {string} - */ - var decOctect = '(' + zeroPad + zeroPad + digitOnly + or + zeroPad + '[1-9]' + digitOnly + or + '1' + digitOnly + digitOnly + or + '2' + '[0-4]' + digitOnly + or + '25' + '[0-5])'; - - /** - * Scheme (http://tools.ietf.org/html/rfc3986#page-17) - * - * Scheme names consist of a sequence of characters beginning with a - * letter and followed by any combination of letters, digits, plus - * ("+"), period ("."), or hyphen ("-"). - * - * @type {string} - */ - var scheme = '^[a-zA-Z][a-zA-Z0-9+\\.-]*:'; - - /** - * User Info (http://tools.ietf.org/html/rfc3986#page-18) - * - * The userinfo subcomponent may consist of a user name and, optionally, - * scheme-specific information about how to gain authorization to access - * the resource. The user information, if present, is followed by a - * commercial at-sign ("@") that delimits it from the host. - * - * userinfo = *( unreserved / pct-encoded / sub-delims / ":" ) - * - * @type {string} - */ - var userinfo = '([' + unreserved + pctEncoded + subDelims + ':]*@)?'; - - /** - * IPv4address (http://tools.ietf.org/html/rfc3986#page-20) - * - * A host identified by an IPv4 literal address is represented in - * dotted-decimal notation (a sequence of four decimal numbers in the - * range 0 to 255, separated by "."), as described in [RFC1123] by - * reference to [RFC0952]. Note that other forms of dotted notation may - * be interpreted on some platforms, as described in Section 7.4, but - * only the dotted-decimal form of four octets is allowed by this - * grammar. - * - * IPv4address = dec-octet "." dec-octet "." dec-octet "." dec-octet - * - * @type {string} - */ - var IPv4address = '(' + decOctect + '\\.){3}' + decOctect; - - /** - * IPv6 Address (http://tools.ietf.org/html/rfc3986#page-20) - * - * A 128-bit IPv6 address is divided into eight 16-bit pieces. Each - * piece is represented numerically in case-insensitive hexadecimal, - * using one to four hexadecimal digits (leading zeroes are permitted). - * The eight encoded pieces are given most-significant first, separated - * by colon characters. Optionally, the least-significant two pieces - * may instead be represented in IPv4 address textual format. A - * sequence of one or more consecutive zero-valued 16-bit pieces within - * the address may be elided, omitting all their digits and leaving - * exactly two consecutive colons in their place to mark the elision. - * - * IPv6address = 6( h16 ":" ) ls32 - * / "::" 5( h16 ":" ) ls32 - * / [ h16 ] "::" 4( h16 ":" ) ls32 - * / [ *1( h16 ":" ) h16 ] "::" 3( h16 ":" ) ls32 - * / [ *2( h16 ":" ) h16 ] "::" 2( h16 ":" ) ls32 - * / [ *3( h16 ":" ) h16 ] "::" h16 ":" ls32 - * / [ *4( h16 ":" ) h16 ] "::" ls32 - * / [ *5( h16 ":" ) h16 ] "::" h16 - * / [ *6( h16 ":" ) h16 ] "::" - * - * ls32 = ( h16 ":" h16 ) / IPv4address ; least-significant 32 bits of address - * - * h16 = 1*4HEXDIG ; 16 bits of address represented in hexadecimal - * - * @type {string} - */ - var h16 = '(' + hexDigitOnly + '){1,4}', - ls32 = '(' + h16 + ':' + h16 + '|' + IPv4address + ')', - IPv6SixHex = '(' + h16 + ':){6}' + ls32, - IPv6FiveHex = '::(' + h16 + ':){5}' + ls32, - IPv6FourHex = h16 + '::(' + h16 + ':){4}' + ls32, - IPv6ThreeeHex = '(' + h16 + ':){0,1}' + h16 + '::(' + h16 + ':){3}' + ls32, - IPv6TwoHex = '(' + h16 + ':){0,2}' + h16 + '::(' + h16 + ':){2}' + ls32, - IPv6OneHex = '(' + h16 + ':){0,3}' + h16 + '::' + h16 + ':' + ls32, - IPv6NoneHex = '(' + h16 + ':){0,4}' + h16 + '::' + ls32, - IPv6NoneHex2 = '(' + h16 + ':){0,5}' + h16 + '::' + h16, - IPv6NoneHex3 = '(' + h16 + ':){0,6}' + h16 + '::', - IPv6address = '(' + IPv6SixHex + or + IPv6FiveHex + or + IPv6FourHex + or + IPv6ThreeeHex + or + IPv6TwoHex + or + IPv6OneHex + or + IPv6NoneHex + or + IPv6NoneHex2 + or + IPv6NoneHex3 + ')'; - - /** - * IP Future Versions (http://tools.ietf.org/html/rfc3986#page-19) - * - * IPvFuture = "v" 1*HEXDIG "." 1*( unreserved / sub-delims / ":" ) - * - * @type {string} - */ - var IPvFuture = '(v' + hexDigitOnly +'+\\.[' + unreserved + subDelims + ':]+)'; - - /** - * IP Literal (http://tools.ietf.org/html/rfc3986#page-19) - * - * A host identified by an Internet Protocol literal address, version 6 - * [RFC3513] or later, is distinguished by enclosing the IP literal - * within square brackets ("[" and "]"). This is the only place where - * square bracket characters are allowed in the URI syntax. In - * anticipation of future, as-yet-undefined IP literal address formats, - * an implementation may use an optional version flag to indicate such a - * format explicitly rather than rely on heuristic determination. - * - * IP-literal = "[" ( IPv6address / IPvFuture ) "]" - * - * @type {string} - */ - var IPLiteral = '\\[(' + IPv6address + or + IPvFuture + ')\\]'; - - /** - * Registered Name (http://tools.ietf.org/html/rfc3986#page-21) - * - * A registered name consists of a sequence of domain labels separated - * by ".", each domain label starting and ending with an alphanumeric - * character and possibly also containing "-" characters. The rightmost - * domain label of a fully qualified domain name in DNS may be followed - * by a single "." and should be if it is necessary to distinguish between - * the complete domain name and some local domain. - * - * reg-name = *( unreserved / pct-encoded / sub-delims ) - * - * @type {string} - */ - var regName = '[' + unreserved + pctEncoded + subDelims + ']{0,255}'; - - /** - * Host (http://tools.ietf.org/html/rfc3986#page-18) - * - * The host subcomponent of authority is identified by an IP literal - * encapsulated within square brackets, an IPv4 address in dotted- - * decimal form, or a registered name. - * - * host = IP-literal / IPv4address / reg-name - * - * @type {string} - */ - var host = '(' + IPLiteral + or + IPv4address + or + regName + ')'; - - /** - * Port (http://tools.ietf.org/html/rfc3986#page-22) - * - * The port subcomponent of authority is designated by an optional port - * number in decimal following the host and delimited from it by a - * single colon (":") character. - * - * port = *DIGIT - * - * URI producers and normalizers should omit the port component and its - * ":" delimiter if port is empty or if its value would be the same as - * that of the scheme's default. - * - * @type {string} - */ - var port = '(:' + digitOnly + '*)?'; - - /** - * Authority (http://tools.ietf.org/html/rfc3986#page-17) - * - * The authority component is preceded by a double slash ("//") and is - * terminated by the next slash ("/"), question mark ("?"), or number - * sign ("#") character, or by the end of the URI. - * - * authority = [ userinfo "@" ] host [ ":" port ] - * - * URI producers and normalizers should omit the ":" delimiter that - * separates host from port if the port component is empty. Some - * schemes do not allow the userinfo and/or port subcomponents. - * - * If a URI contains an authority component, then the path component - * must either be empty or begin with a slash ("/") character. - * - * @type {string} - */ - var authority = '(([\\//]{2}[\\//]?)|(?=[^\/]))' + userinfo + host + port; - - /** - * Path (http://tools.ietf.org/html/rfc3986#page-22) - * - * The path component contains data, usually organized in hierarchical - * form, that, along with data in the non-hierarchical query component - * (Section 3.4), serves to identify a resource within the scope of the - * URI's scheme and naming authority (if any). The path is terminated - * by the first question mark ("?") or number sign ("#") character, or - * by the end of the URI. - - * If a URI contains an authority component, then the path component - * must either be empty or begin with a slash ("/") character. - - * path = path-abempty ; begins with "/" or is empty - * / path-absolute ; begins with "/" but not "//" - * / path-noscheme ; begins with a non-colon segment - * / path-rootless ; begins with a segment - * / path-empty ; zero characters - - * path-abempty = *( "/" segment ) - * path-absolute = "/" [ segment-nz *( "/" segment ) ] - * path-noscheme = segment-nz-nc *( "/" segment ) - * path-rootless = segment-nz *( "/" segment ) - * path-empty = 0 - * - * segment = *pchar - * segment-nz = 1*pchar - * segment-nz-nc = 1*( unreserved / pct-encoded / sub-delims / "@" ) - * ; non-zero-length segment without any colon ":" - * - * @type {string} - */ - var segment = pcharOnly + '*', - segmentNz = pcharOnly + '+', - segmentNzNc = '[' + unreserved + pctEncoded + subDelims + '@]+', - pathAbEmpty = '(\\/' + segment + ')*', - pathAbsolute = '\\/' + segmentNz + pathAbEmpty, - pathNoScheme =segmentNzNc + pathAbEmpty, - pathRootless = segmentNz + pathAbEmpty, - path = '(\\/(' + pathAbEmpty + or + pathAbsolute + or + pathNoScheme + or + pathRootless + '))?'; - - /** - * Query (http://tools.ietf.org/html/rfc3986#page-23) - * - * The query component contains non-hierarchical data that, along with - * data in the path component (Section 3.3), serves to identify a - * resource within the scope of the URI's scheme and naming authority - * (if any). The query component is indicated by the first question - * mark ("?") character and terminated by a number sign ("#") character - * or by the end of the URI. - * - * query = *( pchar / "/" / "?" ) - * - * @type {string} - */ - var query = '(\\?[' + pchar + '\\/\\?]*(?=#|$))?'; - - /** - * Fragment (http://tools.ietf.org/html/rfc3986#page-24) - * The fragment identifier component of a URI allows indirect - * identification of a secondary resource by reference to a primary - * resource and additional identifying information. The identified - * secondary resource may be some portion or subset of the primary - * resource, some view on representations of the primary resource, or - * some other resource defined or described by those representations. A - * fragment identifier component is indicated by the presence of a - * number sign ("#") character and terminated by the end of the URI. - * - * fragment = *( pchar / "/" / "?" ) - * - * @type {string} - */ - var fragment = '(#[' + pchar +'\\/\\?]*$)?'; - - var uriRegex = new RegExp(scheme + authority + path + query + fragment); - - function testUri(str) { - return uriRegex.test(str); - } - - module.exports = { - test: testUri, - regex: uriRegex - }; -}(module)); \ No newline at end of file +}()); \ No newline at end of file diff --git a/package.json b/package.json index 4d3e724..075b0fc 100644 --- a/package.json +++ b/package.json @@ -1,40 +1,46 @@ { - "name": "isuri", - "description": "Pure Javascript implementation for truly checking if the provided input is an URI. Based on RFC 3986.", - "version": "1.1.0", - "author": { - "name" : "David Pate", - "email" : "me@davidtpate.com", - "url" : "http://davidtpate.com" - }, - "keywords": [ - "uri", - "url", - "type", - "checker", - "validator", - "validate" - ], - "homepage": "https://github.com/DavidTPate/isuri", - "repository": { - "type": "git", - "url": "https://github.com/DavidTPate/isuri.git" - }, - "bugs": { - "url": "https://github.com/DavidTPate/isuri/issues" - }, - "license": "MIT", - "main": "index.js", - "devDependencies": { - "istanbul": "^0.x", - "mocha": "^1.x", - "should": "^4.x", - "benchmark": "^1.x", - "beautify-benchmark": "^0.x" - }, - "scripts": { - "test": "mocha --check-leaks --bail --reporter spec test/", - "test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --check-leaks --reporter dot test/", - "test-travis": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --check-leaks --reporter spec test/" - } + "name": "isuri", + "description": "Pure Javascript implementation for truly checking if the provided input is an URI. Based on RFC 3986.", + "version": "1.1.0", + "author": { + "name": "David Pate", + "email": "me@davidtpate.com", + "url": "http://davidtpate.com" + }, + "keywords": [ + "uri", + "url", + "type", + "checker", + "validator", + "validate" + ], + "homepage": "https://github.com/DavidTPate/isuri", + "repository": { + "type": "git", + "url": "https://github.com/DavidTPate/isuri.git" + }, + "bugs": { + "url": "https://github.com/DavidTPate/isuri/issues" + }, + "license": "MIT", + "main": "index.js", + "devDependencies": { + "beautify-benchmark": "^0.x", + "benchmark": "^1.x", + "grunt": "^0.4.5", + "grunt-bump": "^0.3.1", + "grunt-contrib-clean": "^0.6.0", + "grunt-contrib-copy": "^0.8.0", + "grunt-contrib-uglify": "^0.9.1", + "istanbul": "^0.x", + "load-grunt-config": "^0.17.2", + "mocha": "^1.x", + "should": "^4.x" + }, + "scripts": { + "test": "mocha --check-leaks --bail --reporter spec test/", + "test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --check-leaks --reporter dot test/", + "test-travis": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --check-leaks --reporter spec test/" + } } diff --git a/src/isuri.js b/src/isuri.js new file mode 100644 index 0000000..ceea2f4 --- /dev/null +++ b/src/isuri.js @@ -0,0 +1,392 @@ +/*jslint indent:4, vars: true */ +/*globals module */ +(function () { + + 'use strict'; + + /** + * Basic Values (http://tools.ietf.org/html/rfc3986#page-11) + * + * This specification uses the Augmented Backus-Naur Form (ABNF) + * notation of [RFC2234], including the following core ABNF syntax rules + * defined by that specification: ALPHA (letters), CR (carriage return), + * DIGIT (decimal digits), DQUOTE (double quote), HEXDIG (hexadecimal + * digits), LF (line feed), and SP (space). The complete URI syntax is + * collected in Appendix A. + * + * @type {string} + */ + + /** + * Digit (http://tools.ietf.org/html/rfc2234#page-10) + * + * DIGIT = %x30-39 ; 0-9 + * + * @type {string} + */ + var digit = '0-9', + digitOnly = '[' + digit + ']'; + + /** + * Alpha (http://tools.ietf.org/html/rfc2234#page-11) + * + * ALPHA = %x41-5A / %x61-7A ; A-Z / a-z + * + * @type {string} + */ + var alpha = 'a-zA-Z'; + + /** + * Hexadecimal Digit (http://tools.ietf.org/html/rfc2234#page-11) + * + * HEXDIG = DIGIT / "A" / "B" / "C" / "D" / "E" / "F" + * + * @type {string} + */ + var hexDigit = digit + 'A-F', + hexDigitOnly = '[' + hexDigit + ']'; + + /** + * Unreserved (http://tools.ietf.org/html/rfc3986#page-13) + * + * Characters that are allowed in a URI but do not have a reserved + * purpose are called unreserved. These include uppercase and lowercase + * letters, decimal digits, hyphen, period, underscore, and tilde. + * + * unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~" + * + * @type {string} + */ + var unreserved = alpha + digit + '-\\._~'; + + /** + * Percent Encoded (http://tools.ietf.org/html/rfc3986#page-12) + * + * percent-encoding mechanism is used to represent a data octet in a + * component when that octet's corresponding character is outside the + * allowed set or is being used as a delimiter of, or within, the + * component. A percent-encoded octet is encoded as a character + * triplet, consisting of the percent character "%" followed by the two + * hexadecimal digits representing that octet's numeric value. For + * example, "%20" is the percent-encoding for the binary octet + * "00100000" (ABNF: %x20), which in US-ASCII corresponds to the space + * character (SP). + * + * pct-encoded = "%" HEXDIG HEXDIG + * + * @type {string} + */ + var pctEncoded = '%' + hexDigit; + + /** + * Sub Delimiters (http://tools.ietf.org/html/rfc3986#page-13) + * + * + * + * sub-delims = "!" / "$" / "&" / "'" / "(" / ")" / "*" / "+" / "," / ";" / "=" + * + * @type {string} + */ + var subDelims = '!$&\'()*+,;='; + + /** + * PChar (http://tools.ietf.org/html/rfc3986#page-23) + * + * pchar = unreserved / pct-encoded / sub-delims / ":" / "@" + * + * @type {string} + */ + var pchar = unreserved + pctEncoded + subDelims + ':@', + pcharOnly = '[' + pchar + ']'; + + /** + * Alternative Rules (http://tools.ietf.org/html/rfc2234#page-6) + * + * ements separated by forward slash ("/") are alternatives. + * + * @type {string} + */ + var or = '|'; + + /** + * Rule to support zero-padded addresses. + * + * @type {string} + */ + var zeroPad = '0?'; + + /** + * dec-octect (http://tools.ietf.org/html/rfc3986#page-20) + * + * dec-octet = DIGIT ; 0-9 + * / %x31-39 DIGIT ; 10-99 + * / "1" 2DIGIT ; 100-199 + * / "2" %x30-34 DIGIT ; 200-249 + * / "25" %x30-35 ; 250-255 + * + * @type {string} + */ + var decOctect = '(' + zeroPad + zeroPad + digitOnly + or + zeroPad + '[1-9]' + digitOnly + or + '1' + digitOnly + digitOnly + or + '2' + '[0-4]' + digitOnly + or + '25' + '[0-5])'; + + /** + * Scheme (http://tools.ietf.org/html/rfc3986#page-17) + * + * Scheme names consist of a sequence of characters beginning with a + * letter and followed by any combination of letters, digits, plus + * ("+"), period ("."), or hyphen ("-"). + * + * @type {string} + */ + var scheme = '^[a-zA-Z][a-zA-Z0-9+\\.-]*:'; + + /** + * User Info (http://tools.ietf.org/html/rfc3986#page-18) + * + * The userinfo subcomponent may consist of a user name and, optionally, + * scheme-specific information about how to gain authorization to access + * the resource. The user information, if present, is followed by a + * commercial at-sign ("@") that delimits it from the host. + * + * userinfo = *( unreserved / pct-encoded / sub-delims / ":" ) + * + * @type {string} + */ + var userinfo = '([' + unreserved + pctEncoded + subDelims + ':]*@)?'; + + /** + * IPv4address (http://tools.ietf.org/html/rfc3986#page-20) + * + * A host identified by an IPv4 literal address is represented in + * dotted-decimal notation (a sequence of four decimal numbers in the + * range 0 to 255, separated by "."), as described in [RFC1123] by + * reference to [RFC0952]. Note that other forms of dotted notation may + * be interpreted on some platforms, as described in Section 7.4, but + * only the dotted-decimal form of four octets is allowed by this + * grammar. + * + * IPv4address = dec-octet "." dec-octet "." dec-octet "." dec-octet + * + * @type {string} + */ + var IPv4address = '(' + decOctect + '\\.){3}' + decOctect; + + /** + * IPv6 Address (http://tools.ietf.org/html/rfc3986#page-20) + * + * A 128-bit IPv6 address is divided into eight 16-bit pieces. Each + * piece is represented numerically in case-insensitive hexadecimal, + * using one to four hexadecimal digits (leading zeroes are permitted). + * The eight encoded pieces are given most-significant first, separated + * by colon characters. Optionally, the least-significant two pieces + * may instead be represented in IPv4 address textual format. A + * sequence of one or more consecutive zero-valued 16-bit pieces within + * the address may be elided, omitting all their digits and leaving + * exactly two consecutive colons in their place to mark the elision. + * + * IPv6address = 6( h16 ":" ) ls32 + * / "::" 5( h16 ":" ) ls32 + * / [ h16 ] "::" 4( h16 ":" ) ls32 + * / [ *1( h16 ":" ) h16 ] "::" 3( h16 ":" ) ls32 + * / [ *2( h16 ":" ) h16 ] "::" 2( h16 ":" ) ls32 + * / [ *3( h16 ":" ) h16 ] "::" h16 ":" ls32 + * / [ *4( h16 ":" ) h16 ] "::" ls32 + * / [ *5( h16 ":" ) h16 ] "::" h16 + * / [ *6( h16 ":" ) h16 ] "::" + * + * ls32 = ( h16 ":" h16 ) / IPv4address ; least-significant 32 bits of address + * + * h16 = 1*4HEXDIG ; 16 bits of address represented in hexadecimal + * + * @type {string} + */ + var h16 = '(' + hexDigitOnly + '){1,4}', + ls32 = '(' + h16 + ':' + h16 + '|' + IPv4address + ')', + IPv6SixHex = '(' + h16 + ':){6}' + ls32, + IPv6FiveHex = '::(' + h16 + ':){5}' + ls32, + IPv6FourHex = h16 + '::(' + h16 + ':){4}' + ls32, + IPv6ThreeeHex = '(' + h16 + ':){0,1}' + h16 + '::(' + h16 + ':){3}' + ls32, + IPv6TwoHex = '(' + h16 + ':){0,2}' + h16 + '::(' + h16 + ':){2}' + ls32, + IPv6OneHex = '(' + h16 + ':){0,3}' + h16 + '::' + h16 + ':' + ls32, + IPv6NoneHex = '(' + h16 + ':){0,4}' + h16 + '::' + ls32, + IPv6NoneHex2 = '(' + h16 + ':){0,5}' + h16 + '::' + h16, + IPv6NoneHex3 = '(' + h16 + ':){0,6}' + h16 + '::', + IPv6address = '(' + IPv6SixHex + or + IPv6FiveHex + or + IPv6FourHex + or + IPv6ThreeeHex + or + IPv6TwoHex + or + IPv6OneHex + or + IPv6NoneHex + or + IPv6NoneHex2 + or + IPv6NoneHex3 + ')'; + + /** + * IP Future Versions (http://tools.ietf.org/html/rfc3986#page-19) + * + * IPvFuture = "v" 1*HEXDIG "." 1*( unreserved / sub-delims / ":" ) + * + * @type {string} + */ + var IPvFuture = '(v' + hexDigitOnly + '+\\.[' + unreserved + subDelims + ':]+)'; + + /** + * IP Literal (http://tools.ietf.org/html/rfc3986#page-19) + * + * A host identified by an Internet Protocol literal address, version 6 + * [RFC3513] or later, is distinguished by enclosing the IP literal + * within square brackets ("[" and "]"). This is the only place where + * square bracket characters are allowed in the URI syntax. In + * anticipation of future, as-yet-undefined IP literal address formats, + * an implementation may use an optional version flag to indicate such a + * format explicitly rather than rely on heuristic determination. + * + * IP-literal = "[" ( IPv6address / IPvFuture ) "]" + * + * @type {string} + */ + var IPLiteral = '\\[(' + IPv6address + or + IPvFuture + ')\\]'; + + /** + * Registered Name (http://tools.ietf.org/html/rfc3986#page-21) + * + * A registered name consists of a sequence of domain labels separated + * by ".", each domain label starting and ending with an alphanumeric + * character and possibly also containing "-" characters. The rightmost + * domain label of a fully qualified domain name in DNS may be followed + * by a single "." and should be if it is necessary to distinguish between + * the complete domain name and some local domain. + * + * reg-name = *( unreserved / pct-encoded / sub-delims ) + * + * @type {string} + */ + var regName = '[' + unreserved + pctEncoded + subDelims + ']{0,255}'; + + /** + * Host (http://tools.ietf.org/html/rfc3986#page-18) + * + * The host subcomponent of authority is identified by an IP literal + * encapsulated within square brackets, an IPv4 address in dotted- + * decimal form, or a registered name. + * + * host = IP-literal / IPv4address / reg-name + * + * @type {string} + */ + var host = '(' + IPLiteral + or + IPv4address + or + regName + ')'; + + /** + * Port (http://tools.ietf.org/html/rfc3986#page-22) + * + * The port subcomponent of authority is designated by an optional port + * number in decimal following the host and delimited from it by a + * single colon (":") character. + * + * port = *DIGIT + * + * URI producers and normalizers should omit the port component and its + * ":" delimiter if port is empty or if its value would be the same as + * that of the scheme's default. + * + * @type {string} + */ + var port = '(:' + digitOnly + '*)?'; + + /** + * Authority (http://tools.ietf.org/html/rfc3986#page-17) + * + * The authority component is preceded by a double slash ("//") and is + * terminated by the next slash ("/"), question mark ("?"), or number + * sign ("#") character, or by the end of the URI. + * + * authority = [ userinfo "@" ] host [ ":" port ] + * + * URI producers and normalizers should omit the ":" delimiter that + * separates host from port if the port component is empty. Some + * schemes do not allow the userinfo and/or port subcomponents. + * + * If a URI contains an authority component, then the path component + * must either be empty or begin with a slash ("/") character. + * + * @type {string} + */ + var authority = '(([\\//]{2}[\\//]?)|(?=[^\/]))' + userinfo + host + port; + + /** + * Path (http://tools.ietf.org/html/rfc3986#page-22) + * + * The path component contains data, usually organized in hierarchical + * form, that, along with data in the non-hierarchical query component + * (Section 3.4), serves to identify a resource within the scope of the + * URI's scheme and naming authority (if any). The path is terminated + * by the first question mark ("?") or number sign ("#") character, or + * by the end of the URI. + + * If a URI contains an authority component, then the path component + * must either be empty or begin with a slash ("/") character. + + * path = path-abempty ; begins with "/" or is empty + * / path-absolute ; begins with "/" but not "//" + * / path-noscheme ; begins with a non-colon segment + * / path-rootless ; begins with a segment + * / path-empty ; zero characters + + * path-abempty = *( "/" segment ) + * path-absolute = "/" [ segment-nz *( "/" segment ) ] + * path-noscheme = segment-nz-nc *( "/" segment ) + * path-rootless = segment-nz *( "/" segment ) + * path-empty = 0 + * + * segment = *pchar + * segment-nz = 1*pchar + * segment-nz-nc = 1*( unreserved / pct-encoded / sub-delims / "@" ) + * ; non-zero-length segment without any colon ":" + * + * @type {string} + */ + var segment = pcharOnly + '*', + segmentNz = pcharOnly + '+', + segmentNzNc = '[' + unreserved + pctEncoded + subDelims + '@]+', + pathAbEmpty = '(\\/' + segment + ')*', + pathAbsolute = '\\/' + segmentNz + pathAbEmpty, + pathNoScheme = segmentNzNc + pathAbEmpty, + pathRootless = segmentNz + pathAbEmpty, + path = '(\\/(' + pathAbEmpty + or + pathAbsolute + or + pathNoScheme + or + pathRootless + '))?'; + + /** + * Query (http://tools.ietf.org/html/rfc3986#page-23) + * + * The query component contains non-hierarchical data that, along with + * data in the path component (Section 3.3), serves to identify a + * resource within the scope of the URI's scheme and naming authority + * (if any). The query component is indicated by the first question + * mark ("?") character and terminated by a number sign ("#") character + * or by the end of the URI. + * + * query = *( pchar / "/" / "?" ) + * + * @type {string} + */ + var query = '(\\?[' + pchar + '\\/\\?]*(?=#|$))?'; + + /** + * Fragment (http://tools.ietf.org/html/rfc3986#page-24) + * The fragment identifier component of a URI allows indirect + * identification of a secondary resource by reference to a primary + * resource and additional identifying information. The identified + * secondary resource may be some portion or subset of the primary + * resource, some view on representations of the primary resource, or + * some other resource defined or described by those representations. A + * fragment identifier component is indicated by the presence of a + * number sign ("#") character and terminated by the end of the URI. + * + * fragment = *( pchar / "/" / "?" ) + * + * @type {string} + */ + var fragment = '(#[' + pchar + '\\/\\?]*$)?'; + + var uriRegex = new RegExp(scheme + authority + path + query + fragment); + + function testUri(str) { + return uriRegex.test(str); + } + + module.exports = { + test: testUri, + regex: uriRegex + }; + +}()); \ No newline at end of file diff --git a/src/isuri.map b/src/isuri.map new file mode 100644 index 0000000..9cdf6e0 --- /dev/null +++ b/src/isuri.map @@ -0,0 +1 @@ +{"version":3,"file":"isuri.min.js","sources":["isuri.js"],"names":["testUri","str","uriRegex","test","digit","digitOnly","alpha","hexDigit","hexDigitOnly","unreserved","pctEncoded","subDelims","pchar","pcharOnly","or","zeroPad","decOctect","scheme","userinfo","IPv4address","h16","ls32","IPv6SixHex","IPv6FiveHex","IPv6FourHex","IPv6ThreeeHex","IPv6TwoHex","IPv6OneHex","IPv6NoneHex","IPv6NoneHex2","IPv6NoneHex3","IPv6address","IPvFuture","IPLiteral","regName","host","port","authority","segment","segmentNz","segmentNzNc","pathAbEmpty","pathAbsolute","pathNoScheme","pathRootless","path","query","fragment","RegExp","module","exports","regex"],"mappings":"CAEC,WAEG,YA0XA,SAASA,SAAQC,KACb,MAAOC,UAASC,KAAKF,KArWzB,GAAIG,OAAQ,MACRC,UAAY,IAAMD,MAAQ,IAS1BE,MAAQ,SASRC,SAAWH,MAAQ,MACnBI,aAAe,IAAMD,SAAW,IAahCE,WAAaH,MAAQF,MAAQ,SAmB7BM,WAAa,IAAMH,SAWnBI,UAAY,cASZC,MAAQH,WAAaC,WAAaC,UAAY,KAC9CE,UAAY,IAAMD,MAAQ,IAS1BE,GAAK,IAOLC,QAAU,KAaVC,UAAY,IAAMD,QAAUA,QAAUV,UAAYS,GAAKC,QAAU,QAAUV,UAAYS,GAAK,IAAMT,UAAYA,UAAYS,GAAK,SAAgBT,UAAYS,GAAK,WAWhKG,OAAS,8BAcTC,SAAW,KAAOT,WAAaC,WAAaC,UAAY,SAiBxDQ,YAAc,IAAMH,UAAY,UAAYA,UA+B5CI,IAAM,IAAMZ,aAAe,SAC3Ba,KAAO,IAAMD,IAAM,IAAMA,IAAM,IAAMD,YAAc,IACnDG,WAAa,IAAMF,IAAM,QAAUC,KACnCE,YAAc,MAAQH,IAAM,QAAUC,KACtCG,YAAcJ,IAAM,MAAQA,IAAM,QAAUC,KAC5CI,cAAgB,IAAML,IAAM,UAAYA,IAAM,MAAQA,IAAM,QAAUC,KACtEK,WAAa,IAAMN,IAAM,UAAYA,IAAM,MAAQA,IAAM,QAAUC,KACnEM,WAAa,IAAMP,IAAM,UAAYA,IAAM,KAAOA,IAAM,IAAMC,KAC9DO,YAAc,IAAMR,IAAM,UAAYA,IAAM,KAAOC,KACnDQ,aAAe,IAAMT,IAAM,UAAYA,IAAM,KAAOA,IACpDU,aAAe,IAAMV,IAAM,UAAYA,IAAM,KAC7CW,YAAc,IAAMT,WAAaR,GAAKS,YAAcT,GAAKU,YAAcV,GAAKW,cAAgBX,GAAKY,WAAaZ,GAAKa,WAAab,GAAKc,YAAcd,GAAKe,aAAef,GAAKgB,aAAe,IAS3LE,UAAY,KAAOxB,aAAe,QAAUC,WAAaE,UAAY,OAiBrEsB,UAAY,OAASF,YAAcjB,GAAKkB,UAAY,OAgBpDE,QAAU,IAAMzB,WAAaC,WAAaC,UAAY,WAatDwB,KAAO,IAAMF,UAAYnB,GAAKK,YAAcL,GAAKoB,QAAU,IAiB3DE,KAAO,KAAO/B,UAAY,MAoB1BgC,UAAY,gCAAmCnB,SAAWiB,KAAOC,KAkCjEE,QAAUzB,UAAY,IACtB0B,UAAY1B,UAAY,IACxB2B,YAAc,IAAM/B,WAAaC,WAAaC,UAAY,MAC1D8B,YAAc,OAASH,QAAU,KACjCI,aAAe,MAAQH,UAAYE,YACnCE,aAAeH,YAAcC,YAC7BG,aAAeL,UAAYE,YAC3BI,KAAO,QAAUJ,YAAc3B,GAAK4B,aAAe5B,GAAK6B,aAAe7B,GAAK8B,aAAe,MAgB3FE,MAAQ,QAAUlC,MAAQ,oBAiB1BmC,SAAW,MAAQnC,MAAQ,cAE3BV,SAAW,GAAI8C,QAAO/B,OAASoB,UAAYQ,KAAOC,MAAQC,SAM9DE,QAAOC,SACH/C,KAAMH,QACNmD,MAAOjD"} \ No newline at end of file From ecb1eb72196b5c0368f39669b9db4c2216262da5 Mon Sep 17 00:00:00 2001 From: sixertoy Date: Tue, 14 Jul 2015 16:58:05 +0200 Subject: [PATCH 2/3] update index --- index.js | 2 +- src/isuri.map | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) delete mode 100644 src/isuri.map diff --git a/index.js b/index.js index 5aaa1d6..0f495a3 100644 --- a/index.js +++ b/index.js @@ -4,6 +4,6 @@ 'use strict'; - module.exports = require('./src'); + module.exports = require('./src/isuri.js'); }()); \ No newline at end of file diff --git a/src/isuri.map b/src/isuri.map deleted file mode 100644 index 9cdf6e0..0000000 --- a/src/isuri.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"isuri.min.js","sources":["isuri.js"],"names":["testUri","str","uriRegex","test","digit","digitOnly","alpha","hexDigit","hexDigitOnly","unreserved","pctEncoded","subDelims","pchar","pcharOnly","or","zeroPad","decOctect","scheme","userinfo","IPv4address","h16","ls32","IPv6SixHex","IPv6FiveHex","IPv6FourHex","IPv6ThreeeHex","IPv6TwoHex","IPv6OneHex","IPv6NoneHex","IPv6NoneHex2","IPv6NoneHex3","IPv6address","IPvFuture","IPLiteral","regName","host","port","authority","segment","segmentNz","segmentNzNc","pathAbEmpty","pathAbsolute","pathNoScheme","pathRootless","path","query","fragment","RegExp","module","exports","regex"],"mappings":"CAEC,WAEG,YA0XA,SAASA,SAAQC,KACb,MAAOC,UAASC,KAAKF,KArWzB,GAAIG,OAAQ,MACRC,UAAY,IAAMD,MAAQ,IAS1BE,MAAQ,SASRC,SAAWH,MAAQ,MACnBI,aAAe,IAAMD,SAAW,IAahCE,WAAaH,MAAQF,MAAQ,SAmB7BM,WAAa,IAAMH,SAWnBI,UAAY,cASZC,MAAQH,WAAaC,WAAaC,UAAY,KAC9CE,UAAY,IAAMD,MAAQ,IAS1BE,GAAK,IAOLC,QAAU,KAaVC,UAAY,IAAMD,QAAUA,QAAUV,UAAYS,GAAKC,QAAU,QAAUV,UAAYS,GAAK,IAAMT,UAAYA,UAAYS,GAAK,SAAgBT,UAAYS,GAAK,WAWhKG,OAAS,8BAcTC,SAAW,KAAOT,WAAaC,WAAaC,UAAY,SAiBxDQ,YAAc,IAAMH,UAAY,UAAYA,UA+B5CI,IAAM,IAAMZ,aAAe,SAC3Ba,KAAO,IAAMD,IAAM,IAAMA,IAAM,IAAMD,YAAc,IACnDG,WAAa,IAAMF,IAAM,QAAUC,KACnCE,YAAc,MAAQH,IAAM,QAAUC,KACtCG,YAAcJ,IAAM,MAAQA,IAAM,QAAUC,KAC5CI,cAAgB,IAAML,IAAM,UAAYA,IAAM,MAAQA,IAAM,QAAUC,KACtEK,WAAa,IAAMN,IAAM,UAAYA,IAAM,MAAQA,IAAM,QAAUC,KACnEM,WAAa,IAAMP,IAAM,UAAYA,IAAM,KAAOA,IAAM,IAAMC,KAC9DO,YAAc,IAAMR,IAAM,UAAYA,IAAM,KAAOC,KACnDQ,aAAe,IAAMT,IAAM,UAAYA,IAAM,KAAOA,IACpDU,aAAe,IAAMV,IAAM,UAAYA,IAAM,KAC7CW,YAAc,IAAMT,WAAaR,GAAKS,YAAcT,GAAKU,YAAcV,GAAKW,cAAgBX,GAAKY,WAAaZ,GAAKa,WAAab,GAAKc,YAAcd,GAAKe,aAAef,GAAKgB,aAAe,IAS3LE,UAAY,KAAOxB,aAAe,QAAUC,WAAaE,UAAY,OAiBrEsB,UAAY,OAASF,YAAcjB,GAAKkB,UAAY,OAgBpDE,QAAU,IAAMzB,WAAaC,WAAaC,UAAY,WAatDwB,KAAO,IAAMF,UAAYnB,GAAKK,YAAcL,GAAKoB,QAAU,IAiB3DE,KAAO,KAAO/B,UAAY,MAoB1BgC,UAAY,gCAAmCnB,SAAWiB,KAAOC,KAkCjEE,QAAUzB,UAAY,IACtB0B,UAAY1B,UAAY,IACxB2B,YAAc,IAAM/B,WAAaC,WAAaC,UAAY,MAC1D8B,YAAc,OAASH,QAAU,KACjCI,aAAe,MAAQH,UAAYE,YACnCE,aAAeH,YAAcC,YAC7BG,aAAeL,UAAYE,YAC3BI,KAAO,QAAUJ,YAAc3B,GAAK4B,aAAe5B,GAAK6B,aAAe7B,GAAK8B,aAAe,MAgB3FE,MAAQ,QAAUlC,MAAQ,oBAiB1BmC,SAAW,MAAQnC,MAAQ,cAE3BV,SAAW,GAAI8C,QAAO/B,OAASoB,UAAYQ,KAAOC,MAAQC,SAM9DE,QAAOC,SACH/C,KAAMH,QACNmD,MAAOjD"} \ No newline at end of file From ea93959bf326ff97fc819d6f0bd96eff80593d0a Mon Sep 17 00:00:00 2001 From: sixertoy Date: Tue, 14 Jul 2015 16:59:06 +0200 Subject: [PATCH 3/3] update uglify --- dist/isuri.min.js | 2 +- dist/isuri.min.map | 1 + grunt/uglify.js | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) create mode 100644 dist/isuri.min.map diff --git a/dist/isuri.min.js b/dist/isuri.min.js index d1f2949..5e5d917 100644 --- a/dist/isuri.min.js +++ b/dist/isuri.min.js @@ -1,2 +1,2 @@ !function(){"use strict";function testUri(str){return uriRegex.test(str)}var digit="0-9",digitOnly="["+digit+"]",alpha="a-zA-Z",hexDigit=digit+"A-F",hexDigitOnly="["+hexDigit+"]",unreserved=alpha+digit+"-\\._~",pctEncoded="%"+hexDigit,subDelims="!$&'()*+,;=",pchar=unreserved+pctEncoded+subDelims+":@",pcharOnly="["+pchar+"]",or="|",zeroPad="0?",decOctect="("+zeroPad+zeroPad+digitOnly+or+zeroPad+"[1-9]"+digitOnly+or+"1"+digitOnly+digitOnly+or+"2[0-4]"+digitOnly+or+"25[0-5])",scheme="^[a-zA-Z][a-zA-Z0-9+\\.-]*:",userinfo="(["+unreserved+pctEncoded+subDelims+":]*@)?",IPv4address="("+decOctect+"\\.){3}"+decOctect,h16="("+hexDigitOnly+"){1,4}",ls32="("+h16+":"+h16+"|"+IPv4address+")",IPv6SixHex="("+h16+":){6}"+ls32,IPv6FiveHex="::("+h16+":){5}"+ls32,IPv6FourHex=h16+"::("+h16+":){4}"+ls32,IPv6ThreeeHex="("+h16+":){0,1}"+h16+"::("+h16+":){3}"+ls32,IPv6TwoHex="("+h16+":){0,2}"+h16+"::("+h16+":){2}"+ls32,IPv6OneHex="("+h16+":){0,3}"+h16+"::"+h16+":"+ls32,IPv6NoneHex="("+h16+":){0,4}"+h16+"::"+ls32,IPv6NoneHex2="("+h16+":){0,5}"+h16+"::"+h16,IPv6NoneHex3="("+h16+":){0,6}"+h16+"::",IPv6address="("+IPv6SixHex+or+IPv6FiveHex+or+IPv6FourHex+or+IPv6ThreeeHex+or+IPv6TwoHex+or+IPv6OneHex+or+IPv6NoneHex+or+IPv6NoneHex2+or+IPv6NoneHex3+")",IPvFuture="(v"+hexDigitOnly+"+\\.["+unreserved+subDelims+":]+)",IPLiteral="\\[("+IPv6address+or+IPvFuture+")\\]",regName="["+unreserved+pctEncoded+subDelims+"]{0,255}",host="("+IPLiteral+or+IPv4address+or+regName+")",port="(:"+digitOnly+"*)?",authority="(([\\//]{2}[\\//]?)|(?=[^/]))"+userinfo+host+port,segment=pcharOnly+"*",segmentNz=pcharOnly+"+",segmentNzNc="["+unreserved+pctEncoded+subDelims+"@]+",pathAbEmpty="(\\/"+segment+")*",pathAbsolute="\\/"+segmentNz+pathAbEmpty,pathNoScheme=segmentNzNc+pathAbEmpty,pathRootless=segmentNz+pathAbEmpty,path="(\\/("+pathAbEmpty+or+pathAbsolute+or+pathNoScheme+or+pathRootless+"))?",query="(\\?["+pchar+"\\/\\?]*(?=#|$))?",fragment="(#["+pchar+"\\/\\?]*$)?",uriRegex=new RegExp(scheme+authority+path+query+fragment);module.exports={test:testUri,regex:uriRegex}}(); -//# sourceMappingURL=../src/isuri.map \ No newline at end of file +//# sourceMappingURL=isuri.min.map \ No newline at end of file diff --git a/dist/isuri.min.map b/dist/isuri.min.map new file mode 100644 index 0000000..03e6474 --- /dev/null +++ b/dist/isuri.min.map @@ -0,0 +1 @@ +{"version":3,"file":"isuri.min.js","sources":["../src/isuri.js"],"names":["testUri","str","uriRegex","test","digit","digitOnly","alpha","hexDigit","hexDigitOnly","unreserved","pctEncoded","subDelims","pchar","pcharOnly","or","zeroPad","decOctect","scheme","userinfo","IPv4address","h16","ls32","IPv6SixHex","IPv6FiveHex","IPv6FourHex","IPv6ThreeeHex","IPv6TwoHex","IPv6OneHex","IPv6NoneHex","IPv6NoneHex2","IPv6NoneHex3","IPv6address","IPvFuture","IPLiteral","regName","host","port","authority","segment","segmentNz","segmentNzNc","pathAbEmpty","pathAbsolute","pathNoScheme","pathRootless","path","query","fragment","RegExp","module","exports","regex"],"mappings":"CAEC,WAEG,YA0XA,SAASA,SAAQC,KACb,MAAOC,UAASC,KAAKF,KArWzB,GAAIG,OAAQ,MACRC,UAAY,IAAMD,MAAQ,IAS1BE,MAAQ,SASRC,SAAWH,MAAQ,MACnBI,aAAe,IAAMD,SAAW,IAahCE,WAAaH,MAAQF,MAAQ,SAmB7BM,WAAa,IAAMH,SAWnBI,UAAY,cASZC,MAAQH,WAAaC,WAAaC,UAAY,KAC9CE,UAAY,IAAMD,MAAQ,IAS1BE,GAAK,IAOLC,QAAU,KAaVC,UAAY,IAAMD,QAAUA,QAAUV,UAAYS,GAAKC,QAAU,QAAUV,UAAYS,GAAK,IAAMT,UAAYA,UAAYS,GAAK,SAAgBT,UAAYS,GAAK,WAWhKG,OAAS,8BAcTC,SAAW,KAAOT,WAAaC,WAAaC,UAAY,SAiBxDQ,YAAc,IAAMH,UAAY,UAAYA,UA+B5CI,IAAM,IAAMZ,aAAe,SAC3Ba,KAAO,IAAMD,IAAM,IAAMA,IAAM,IAAMD,YAAc,IACnDG,WAAa,IAAMF,IAAM,QAAUC,KACnCE,YAAc,MAAQH,IAAM,QAAUC,KACtCG,YAAcJ,IAAM,MAAQA,IAAM,QAAUC,KAC5CI,cAAgB,IAAML,IAAM,UAAYA,IAAM,MAAQA,IAAM,QAAUC,KACtEK,WAAa,IAAMN,IAAM,UAAYA,IAAM,MAAQA,IAAM,QAAUC,KACnEM,WAAa,IAAMP,IAAM,UAAYA,IAAM,KAAOA,IAAM,IAAMC,KAC9DO,YAAc,IAAMR,IAAM,UAAYA,IAAM,KAAOC,KACnDQ,aAAe,IAAMT,IAAM,UAAYA,IAAM,KAAOA,IACpDU,aAAe,IAAMV,IAAM,UAAYA,IAAM,KAC7CW,YAAc,IAAMT,WAAaR,GAAKS,YAAcT,GAAKU,YAAcV,GAAKW,cAAgBX,GAAKY,WAAaZ,GAAKa,WAAab,GAAKc,YAAcd,GAAKe,aAAef,GAAKgB,aAAe,IAS3LE,UAAY,KAAOxB,aAAe,QAAUC,WAAaE,UAAY,OAiBrEsB,UAAY,OAASF,YAAcjB,GAAKkB,UAAY,OAgBpDE,QAAU,IAAMzB,WAAaC,WAAaC,UAAY,WAatDwB,KAAO,IAAMF,UAAYnB,GAAKK,YAAcL,GAAKoB,QAAU,IAiB3DE,KAAO,KAAO/B,UAAY,MAoB1BgC,UAAY,gCAAmCnB,SAAWiB,KAAOC,KAkCjEE,QAAUzB,UAAY,IACtB0B,UAAY1B,UAAY,IACxB2B,YAAc,IAAM/B,WAAaC,WAAaC,UAAY,MAC1D8B,YAAc,OAASH,QAAU,KACjCI,aAAe,MAAQH,UAAYE,YACnCE,aAAeH,YAAcC,YAC7BG,aAAeL,UAAYE,YAC3BI,KAAO,QAAUJ,YAAc3B,GAAK4B,aAAe5B,GAAK6B,aAAe7B,GAAK8B,aAAe,MAgB3FE,MAAQ,QAAUlC,MAAQ,oBAiB1BmC,SAAW,MAAQnC,MAAQ,cAE3BV,SAAW,GAAI8C,QAAO/B,OAASoB,UAAYQ,KAAOC,MAAQC,SAM9DE,QAAOC,SACH/C,KAAMH,QACNmD,MAAOjD"} \ No newline at end of file diff --git a/grunt/uglify.js b/grunt/uglify.js index c7b726f..024c9f2 100644 --- a/grunt/uglify.js +++ b/grunt/uglify.js @@ -7,7 +7,7 @@ module.exports = function (grunt, opts) { mangle: false, sourceMap: true, drop_console: true, - sourceMapName: 'src/isuri.map' + sourceMapName: 'dist/isuri.min.map' }, all: { files: {