@stoplight/path
Advanced tools
Comparing version 2.0.0-beta.2 to 2.0.0
@@ -156,8 +156,9 @@ "use strict"; | ||
var peg$c1 = "https://"; | ||
var peg$c2 = "file://"; | ||
var peg$c3 = "file:"; | ||
var peg$c4 = ":"; | ||
var peg$c5 = "."; | ||
var peg$c6 = "/"; | ||
var peg$c7 = "\\"; | ||
var peg$c2 = "stoplight://"; | ||
var peg$c3 = "file://"; | ||
var peg$c4 = "file:"; | ||
var peg$c5 = ":"; | ||
var peg$c6 = "."; | ||
var peg$c7 = "/"; | ||
var peg$c8 = "\\"; | ||
var peg$r0 = /^[A-Za-z]/; | ||
@@ -167,10 +168,11 @@ var peg$r1 = /^[^\/\\]/; | ||
var peg$e1 = peg$literalExpectation("https://", true); | ||
var peg$e2 = peg$literalExpectation("file://", true); | ||
var peg$e3 = peg$literalExpectation("file:", true); | ||
var peg$e4 = peg$classExpectation([["A", "Z"], ["a", "z"]], false, false); | ||
var peg$e5 = peg$literalExpectation(":", false); | ||
var peg$e6 = peg$literalExpectation(".", false); | ||
var peg$e7 = peg$literalExpectation("/", false); | ||
var peg$e8 = peg$literalExpectation("\\", false); | ||
var peg$e9 = peg$classExpectation(["/", "\\"], true, false); | ||
var peg$e2 = peg$literalExpectation("stoplight://", true); | ||
var peg$e3 = peg$literalExpectation("file://", true); | ||
var peg$e4 = peg$literalExpectation("file:", true); | ||
var peg$e5 = peg$classExpectation([["A", "Z"], ["a", "z"]], false, false); | ||
var peg$e6 = peg$literalExpectation(":", false); | ||
var peg$e7 = peg$literalExpectation(".", false); | ||
var peg$e8 = peg$literalExpectation("/", false); | ||
var peg$e9 = peg$literalExpectation("\\", false); | ||
var peg$e10 = peg$classExpectation(["/", "\\"], true, false); | ||
var peg$f0 = function (protocol, origin, root, path) { | ||
@@ -200,4 +202,7 @@ return { | ||
}; | ||
var peg$f4 = function () { return null; }; | ||
var peg$f5 = function (protocol, root, path) { | ||
var peg$f4 = function (raw) { | ||
return 'stoplight'; | ||
}; | ||
var peg$f5 = function () { return null; }; | ||
var peg$f6 = function (protocol, root, path) { | ||
return { | ||
@@ -211,6 +216,6 @@ protocol, | ||
}; | ||
var peg$f6 = function (raw) { | ||
var peg$f7 = function (raw) { | ||
return 'file'; | ||
}; | ||
var peg$f7 = function (root, path) { | ||
var peg$f8 = function (root, path) { | ||
return { | ||
@@ -224,3 +229,3 @@ protocol: 'file', | ||
}; | ||
var peg$f8 = function (drive) { | ||
var peg$f9 = function (drive) { | ||
return { | ||
@@ -230,3 +235,3 @@ drive: drive.toLowerCase() + ':' | ||
}; | ||
var peg$f9 = function () { | ||
var peg$f10 = function () { | ||
return { | ||
@@ -236,3 +241,3 @@ drive: null | ||
}; | ||
var peg$f10 = function () { | ||
var peg$f11 = function () { | ||
return { | ||
@@ -242,3 +247,3 @@ drive: null | ||
}; | ||
var peg$f11 = function (path) { | ||
var peg$f12 = function (path) { | ||
return { | ||
@@ -252,3 +257,3 @@ protocol: null, | ||
}; | ||
var peg$f12 = function (path) { | ||
var peg$f13 = function (path) { | ||
return { | ||
@@ -258,4 +263,4 @@ path, | ||
}; | ||
var peg$f13 = function (head, tail) { return [head, ...tail]; }; | ||
var peg$f14 = function (head) { return [head]; }; | ||
var peg$f14 = function (head, tail) { return [head, ...tail]; }; | ||
var peg$f15 = function (head) { return [head]; }; | ||
var peg$currPos = 0; | ||
@@ -454,2 +459,5 @@ var peg$savedPos = 0; | ||
s0 = peg$parseHttpsProtocol(); | ||
if (s0 === peg$FAILED) { | ||
s0 = peg$parseStoplightProtocol(); | ||
} | ||
} | ||
@@ -498,2 +506,22 @@ return s0; | ||
} | ||
function peg$parseStoplightProtocol() { | ||
var s0, s1; | ||
s0 = peg$currPos; | ||
if (input.substr(peg$currPos, 12).toLowerCase() === peg$c2) { | ||
s1 = input.substr(peg$currPos, 12); | ||
peg$currPos += 12; | ||
} | ||
else { | ||
s1 = peg$FAILED; | ||
if (peg$silentFails === 0) { | ||
peg$fail(peg$e2); | ||
} | ||
} | ||
if (s1 !== peg$FAILED) { | ||
peg$savedPos = s0; | ||
s1 = peg$f4(s1); | ||
} | ||
s0 = s1; | ||
return s0; | ||
} | ||
function peg$parseOrigin() { | ||
@@ -523,3 +551,3 @@ var s0, s1, s2; | ||
peg$savedPos = s0; | ||
s1 = peg$f4(); | ||
s1 = peg$f5(); | ||
s0 = s1; | ||
@@ -539,3 +567,3 @@ } | ||
peg$savedPos = s0; | ||
s0 = peg$f5(s1, s2, s3); | ||
s0 = peg$f6(s1, s2, s3); | ||
} | ||
@@ -561,3 +589,3 @@ else { | ||
s0 = peg$currPos; | ||
if (input.substr(peg$currPos, 7).toLowerCase() === peg$c2) { | ||
if (input.substr(peg$currPos, 7).toLowerCase() === peg$c3) { | ||
s1 = input.substr(peg$currPos, 7); | ||
@@ -569,7 +597,7 @@ peg$currPos += 7; | ||
if (peg$silentFails === 0) { | ||
peg$fail(peg$e2); | ||
peg$fail(peg$e3); | ||
} | ||
} | ||
if (s1 === peg$FAILED) { | ||
if (input.substr(peg$currPos, 5).toLowerCase() === peg$c3) { | ||
if (input.substr(peg$currPos, 5).toLowerCase() === peg$c4) { | ||
s1 = input.substr(peg$currPos, 5); | ||
@@ -581,3 +609,3 @@ peg$currPos += 5; | ||
if (peg$silentFails === 0) { | ||
peg$fail(peg$e3); | ||
peg$fail(peg$e4); | ||
} | ||
@@ -588,3 +616,3 @@ } | ||
peg$savedPos = s0; | ||
s1 = peg$f6(s1); | ||
s1 = peg$f7(s1); | ||
} | ||
@@ -602,3 +630,3 @@ s0 = s1; | ||
peg$savedPos = s0; | ||
s0 = peg$f7(s1, s2); | ||
s0 = peg$f8(s1, s2); | ||
} | ||
@@ -638,3 +666,3 @@ else { | ||
if (peg$silentFails === 0) { | ||
peg$fail(peg$e4); | ||
peg$fail(peg$e5); | ||
} | ||
@@ -644,3 +672,3 @@ } | ||
if (input.charCodeAt(peg$currPos) === 58) { | ||
s3 = peg$c4; | ||
s3 = peg$c5; | ||
peg$currPos++; | ||
@@ -651,3 +679,3 @@ } | ||
if (peg$silentFails === 0) { | ||
peg$fail(peg$e5); | ||
peg$fail(peg$e6); | ||
} | ||
@@ -659,3 +687,3 @@ } | ||
peg$savedPos = s0; | ||
s0 = peg$f8(s2); | ||
s0 = peg$f9(s2); | ||
} | ||
@@ -684,3 +712,3 @@ else { | ||
peg$savedPos = s0; | ||
s1 = peg$f9(); | ||
s1 = peg$f10(); | ||
} | ||
@@ -695,3 +723,3 @@ s0 = s1; | ||
peg$savedPos = s0; | ||
s1 = peg$f10(); | ||
s1 = peg$f11(); | ||
s0 = s1; | ||
@@ -708,3 +736,3 @@ return s0; | ||
peg$savedPos = s0; | ||
s0 = peg$f11(s2); | ||
s0 = peg$f12(s2); | ||
} | ||
@@ -728,3 +756,3 @@ else { | ||
peg$savedPos = s0; | ||
s1 = peg$f12(s1); | ||
s1 = peg$f13(s1); | ||
} | ||
@@ -744,3 +772,3 @@ s0 = s1; | ||
peg$savedPos = s0; | ||
s0 = peg$f13(s1, s3); | ||
s0 = peg$f14(s1, s3); | ||
} | ||
@@ -766,3 +794,3 @@ else { | ||
peg$savedPos = s0; | ||
s1 = peg$f14(s1); | ||
s1 = peg$f15(s1); | ||
} | ||
@@ -810,3 +838,3 @@ s0 = s1; | ||
if (input.charCodeAt(peg$currPos) === 46) { | ||
s1 = peg$c5; | ||
s1 = peg$c6; | ||
peg$currPos++; | ||
@@ -817,3 +845,3 @@ } | ||
if (peg$silentFails === 0) { | ||
peg$fail(peg$e6); | ||
peg$fail(peg$e7); | ||
} | ||
@@ -846,3 +874,3 @@ } | ||
if (input.charCodeAt(peg$currPos) === 47) { | ||
s0 = peg$c6; | ||
s0 = peg$c7; | ||
peg$currPos++; | ||
@@ -853,3 +881,3 @@ } | ||
if (peg$silentFails === 0) { | ||
peg$fail(peg$e7); | ||
peg$fail(peg$e8); | ||
} | ||
@@ -859,3 +887,3 @@ } | ||
if (input.charCodeAt(peg$currPos) === 92) { | ||
s0 = peg$c7; | ||
s0 = peg$c8; | ||
peg$currPos++; | ||
@@ -866,3 +894,3 @@ } | ||
if (peg$silentFails === 0) { | ||
peg$fail(peg$e8); | ||
peg$fail(peg$e9); | ||
} | ||
@@ -882,3 +910,3 @@ } | ||
if (peg$silentFails === 0) { | ||
peg$fail(peg$e9); | ||
peg$fail(peg$e10); | ||
} | ||
@@ -885,0 +913,0 @@ } |
@@ -23,2 +23,3 @@ "use strict"; | ||
__exportStar(require("./isAbsolute.js"), exports); | ||
__exportStar(require("./isStoplightURI.js"), exports); | ||
__exportStar(require("./isURL.js"), exports); | ||
@@ -25,0 +26,0 @@ __exportStar(require("./join.js"), exports); |
@@ -152,8 +152,9 @@ // Generated by Peggy 2.0.1. | ||
var peg$c1 = "https://"; | ||
var peg$c2 = "file://"; | ||
var peg$c3 = "file:"; | ||
var peg$c4 = ":"; | ||
var peg$c5 = "."; | ||
var peg$c6 = "/"; | ||
var peg$c7 = "\\"; | ||
var peg$c2 = "stoplight://"; | ||
var peg$c3 = "file://"; | ||
var peg$c4 = "file:"; | ||
var peg$c5 = ":"; | ||
var peg$c6 = "."; | ||
var peg$c7 = "/"; | ||
var peg$c8 = "\\"; | ||
var peg$r0 = /^[A-Za-z]/; | ||
@@ -163,10 +164,11 @@ var peg$r1 = /^[^\/\\]/; | ||
var peg$e1 = peg$literalExpectation("https://", true); | ||
var peg$e2 = peg$literalExpectation("file://", true); | ||
var peg$e3 = peg$literalExpectation("file:", true); | ||
var peg$e4 = peg$classExpectation([["A", "Z"], ["a", "z"]], false, false); | ||
var peg$e5 = peg$literalExpectation(":", false); | ||
var peg$e6 = peg$literalExpectation(".", false); | ||
var peg$e7 = peg$literalExpectation("/", false); | ||
var peg$e8 = peg$literalExpectation("\\", false); | ||
var peg$e9 = peg$classExpectation(["/", "\\"], true, false); | ||
var peg$e2 = peg$literalExpectation("stoplight://", true); | ||
var peg$e3 = peg$literalExpectation("file://", true); | ||
var peg$e4 = peg$literalExpectation("file:", true); | ||
var peg$e5 = peg$classExpectation([["A", "Z"], ["a", "z"]], false, false); | ||
var peg$e6 = peg$literalExpectation(":", false); | ||
var peg$e7 = peg$literalExpectation(".", false); | ||
var peg$e8 = peg$literalExpectation("/", false); | ||
var peg$e9 = peg$literalExpectation("\\", false); | ||
var peg$e10 = peg$classExpectation(["/", "\\"], true, false); | ||
var peg$f0 = function (protocol, origin, root, path) { | ||
@@ -196,4 +198,7 @@ return { | ||
}; | ||
var peg$f4 = function () { return null; }; | ||
var peg$f5 = function (protocol, root, path) { | ||
var peg$f4 = function (raw) { | ||
return 'stoplight'; | ||
}; | ||
var peg$f5 = function () { return null; }; | ||
var peg$f6 = function (protocol, root, path) { | ||
return { | ||
@@ -207,6 +212,6 @@ protocol, | ||
}; | ||
var peg$f6 = function (raw) { | ||
var peg$f7 = function (raw) { | ||
return 'file'; | ||
}; | ||
var peg$f7 = function (root, path) { | ||
var peg$f8 = function (root, path) { | ||
return { | ||
@@ -220,3 +225,3 @@ protocol: 'file', | ||
}; | ||
var peg$f8 = function (drive) { | ||
var peg$f9 = function (drive) { | ||
return { | ||
@@ -226,3 +231,3 @@ drive: drive.toLowerCase() + ':' | ||
}; | ||
var peg$f9 = function () { | ||
var peg$f10 = function () { | ||
return { | ||
@@ -232,3 +237,3 @@ drive: null | ||
}; | ||
var peg$f10 = function () { | ||
var peg$f11 = function () { | ||
return { | ||
@@ -238,3 +243,3 @@ drive: null | ||
}; | ||
var peg$f11 = function (path) { | ||
var peg$f12 = function (path) { | ||
return { | ||
@@ -248,3 +253,3 @@ protocol: null, | ||
}; | ||
var peg$f12 = function (path) { | ||
var peg$f13 = function (path) { | ||
return { | ||
@@ -254,4 +259,4 @@ path, | ||
}; | ||
var peg$f13 = function (head, tail) { return [head, ...tail]; }; | ||
var peg$f14 = function (head) { return [head]; }; | ||
var peg$f14 = function (head, tail) { return [head, ...tail]; }; | ||
var peg$f15 = function (head) { return [head]; }; | ||
var peg$currPos = 0; | ||
@@ -450,2 +455,5 @@ var peg$savedPos = 0; | ||
s0 = peg$parseHttpsProtocol(); | ||
if (s0 === peg$FAILED) { | ||
s0 = peg$parseStoplightProtocol(); | ||
} | ||
} | ||
@@ -494,2 +502,22 @@ return s0; | ||
} | ||
function peg$parseStoplightProtocol() { | ||
var s0, s1; | ||
s0 = peg$currPos; | ||
if (input.substr(peg$currPos, 12).toLowerCase() === peg$c2) { | ||
s1 = input.substr(peg$currPos, 12); | ||
peg$currPos += 12; | ||
} | ||
else { | ||
s1 = peg$FAILED; | ||
if (peg$silentFails === 0) { | ||
peg$fail(peg$e2); | ||
} | ||
} | ||
if (s1 !== peg$FAILED) { | ||
peg$savedPos = s0; | ||
s1 = peg$f4(s1); | ||
} | ||
s0 = s1; | ||
return s0; | ||
} | ||
function peg$parseOrigin() { | ||
@@ -519,3 +547,3 @@ var s0, s1, s2; | ||
peg$savedPos = s0; | ||
s1 = peg$f4(); | ||
s1 = peg$f5(); | ||
s0 = s1; | ||
@@ -535,3 +563,3 @@ } | ||
peg$savedPos = s0; | ||
s0 = peg$f5(s1, s2, s3); | ||
s0 = peg$f6(s1, s2, s3); | ||
} | ||
@@ -557,3 +585,3 @@ else { | ||
s0 = peg$currPos; | ||
if (input.substr(peg$currPos, 7).toLowerCase() === peg$c2) { | ||
if (input.substr(peg$currPos, 7).toLowerCase() === peg$c3) { | ||
s1 = input.substr(peg$currPos, 7); | ||
@@ -565,7 +593,7 @@ peg$currPos += 7; | ||
if (peg$silentFails === 0) { | ||
peg$fail(peg$e2); | ||
peg$fail(peg$e3); | ||
} | ||
} | ||
if (s1 === peg$FAILED) { | ||
if (input.substr(peg$currPos, 5).toLowerCase() === peg$c3) { | ||
if (input.substr(peg$currPos, 5).toLowerCase() === peg$c4) { | ||
s1 = input.substr(peg$currPos, 5); | ||
@@ -577,3 +605,3 @@ peg$currPos += 5; | ||
if (peg$silentFails === 0) { | ||
peg$fail(peg$e3); | ||
peg$fail(peg$e4); | ||
} | ||
@@ -584,3 +612,3 @@ } | ||
peg$savedPos = s0; | ||
s1 = peg$f6(s1); | ||
s1 = peg$f7(s1); | ||
} | ||
@@ -598,3 +626,3 @@ s0 = s1; | ||
peg$savedPos = s0; | ||
s0 = peg$f7(s1, s2); | ||
s0 = peg$f8(s1, s2); | ||
} | ||
@@ -634,3 +662,3 @@ else { | ||
if (peg$silentFails === 0) { | ||
peg$fail(peg$e4); | ||
peg$fail(peg$e5); | ||
} | ||
@@ -640,3 +668,3 @@ } | ||
if (input.charCodeAt(peg$currPos) === 58) { | ||
s3 = peg$c4; | ||
s3 = peg$c5; | ||
peg$currPos++; | ||
@@ -647,3 +675,3 @@ } | ||
if (peg$silentFails === 0) { | ||
peg$fail(peg$e5); | ||
peg$fail(peg$e6); | ||
} | ||
@@ -655,3 +683,3 @@ } | ||
peg$savedPos = s0; | ||
s0 = peg$f8(s2); | ||
s0 = peg$f9(s2); | ||
} | ||
@@ -680,3 +708,3 @@ else { | ||
peg$savedPos = s0; | ||
s1 = peg$f9(); | ||
s1 = peg$f10(); | ||
} | ||
@@ -691,3 +719,3 @@ s0 = s1; | ||
peg$savedPos = s0; | ||
s1 = peg$f10(); | ||
s1 = peg$f11(); | ||
s0 = s1; | ||
@@ -704,3 +732,3 @@ return s0; | ||
peg$savedPos = s0; | ||
s0 = peg$f11(s2); | ||
s0 = peg$f12(s2); | ||
} | ||
@@ -724,3 +752,3 @@ else { | ||
peg$savedPos = s0; | ||
s1 = peg$f12(s1); | ||
s1 = peg$f13(s1); | ||
} | ||
@@ -740,3 +768,3 @@ s0 = s1; | ||
peg$savedPos = s0; | ||
s0 = peg$f13(s1, s3); | ||
s0 = peg$f14(s1, s3); | ||
} | ||
@@ -762,3 +790,3 @@ else { | ||
peg$savedPos = s0; | ||
s1 = peg$f14(s1); | ||
s1 = peg$f15(s1); | ||
} | ||
@@ -806,3 +834,3 @@ s0 = s1; | ||
if (input.charCodeAt(peg$currPos) === 46) { | ||
s1 = peg$c5; | ||
s1 = peg$c6; | ||
peg$currPos++; | ||
@@ -813,3 +841,3 @@ } | ||
if (peg$silentFails === 0) { | ||
peg$fail(peg$e6); | ||
peg$fail(peg$e7); | ||
} | ||
@@ -842,3 +870,3 @@ } | ||
if (input.charCodeAt(peg$currPos) === 47) { | ||
s0 = peg$c6; | ||
s0 = peg$c7; | ||
peg$currPos++; | ||
@@ -849,3 +877,3 @@ } | ||
if (peg$silentFails === 0) { | ||
peg$fail(peg$e7); | ||
peg$fail(peg$e8); | ||
} | ||
@@ -855,3 +883,3 @@ } | ||
if (input.charCodeAt(peg$currPos) === 92) { | ||
s0 = peg$c7; | ||
s0 = peg$c8; | ||
peg$currPos++; | ||
@@ -862,3 +890,3 @@ } | ||
if (peg$silentFails === 0) { | ||
peg$fail(peg$e8); | ||
peg$fail(peg$e9); | ||
} | ||
@@ -878,3 +906,3 @@ } | ||
if (peg$silentFails === 0) { | ||
peg$fail(peg$e9); | ||
peg$fail(peg$e10); | ||
} | ||
@@ -881,0 +909,0 @@ } |
@@ -6,2 +6,3 @@ export * from './basename.js'; | ||
export * from './isAbsolute.js'; | ||
export * from './isStoplightURI.js'; | ||
export * from './isURL.js'; | ||
@@ -8,0 +9,0 @@ export * from './join.js'; |
@@ -6,2 +6,3 @@ export * from './basename.js'; | ||
export * from './isAbsolute.js'; | ||
export * from './isStoplightURI.js'; | ||
export * from './isURL.js'; | ||
@@ -8,0 +9,0 @@ export * from './join.js'; |
export interface IPath { | ||
protocol: 'file' | 'http' | 'https' | null; | ||
protocol: 'file' | 'http' | 'https' | 'stoplight' | null; | ||
origin: string | null; | ||
@@ -4,0 +4,0 @@ absolute: boolean; |
{ | ||
"name": "@stoplight/path", | ||
"version": "2.0.0-beta.2", | ||
"version": "2.0.0", | ||
"description": "", | ||
@@ -40,3 +40,3 @@ "keywords": [], | ||
"lint": "eslint 'src/**/*.ts' && prettier --check 'src/**/*.ts'", | ||
"lint.fix": "yarn lint --fix", | ||
"lint.fix": "eslint 'src/**/*.ts' --fix && prettier --write 'src/**/*.ts'", | ||
"release": "semantic-release", | ||
@@ -43,0 +43,0 @@ "pretest": "yarn build.grammar", |
@@ -17,2 +17,3 @@ import { isAbsolute } from '../isAbsolute.js'; | ||
'https://stoplight.io', | ||
'stoplight://resources/overrides/abc', | ||
'file:///this/is/also/absolute', | ||
@@ -19,0 +20,0 @@ 'file://c:/and/this/is/../absolute', |
@@ -176,8 +176,9 @@ // Generated by Peggy 2.0.1. | ||
var peg$c1 = "https://"; | ||
var peg$c2 = "file://"; | ||
var peg$c3 = "file:"; | ||
var peg$c4 = ":"; | ||
var peg$c5 = "."; | ||
var peg$c6 = "/"; | ||
var peg$c7 = "\\"; | ||
var peg$c2 = "stoplight://"; | ||
var peg$c3 = "file://"; | ||
var peg$c4 = "file:"; | ||
var peg$c5 = ":"; | ||
var peg$c6 = "."; | ||
var peg$c7 = "/"; | ||
var peg$c8 = "\\"; | ||
@@ -189,10 +190,11 @@ var peg$r0 = /^[A-Za-z]/; | ||
var peg$e1 = peg$literalExpectation("https://", true); | ||
var peg$e2 = peg$literalExpectation("file://", true); | ||
var peg$e3 = peg$literalExpectation("file:", true); | ||
var peg$e4 = peg$classExpectation([["A", "Z"], ["a", "z"]], false, false); | ||
var peg$e5 = peg$literalExpectation(":", false); | ||
var peg$e6 = peg$literalExpectation(".", false); | ||
var peg$e7 = peg$literalExpectation("/", false); | ||
var peg$e8 = peg$literalExpectation("\\", false); | ||
var peg$e9 = peg$classExpectation(["/", "\\"], true, false); | ||
var peg$e2 = peg$literalExpectation("stoplight://", true); | ||
var peg$e3 = peg$literalExpectation("file://", true); | ||
var peg$e4 = peg$literalExpectation("file:", true); | ||
var peg$e5 = peg$classExpectation([["A", "Z"], ["a", "z"]], false, false); | ||
var peg$e6 = peg$literalExpectation(":", false); | ||
var peg$e7 = peg$literalExpectation(".", false); | ||
var peg$e8 = peg$literalExpectation("/", false); | ||
var peg$e9 = peg$literalExpectation("\\", false); | ||
var peg$e10 = peg$classExpectation(["/", "\\"], true, false); | ||
@@ -223,4 +225,7 @@ var peg$f0 = function(protocol, origin, root, path) { | ||
}; | ||
var peg$f4 = function() { return null }; | ||
var peg$f5 = function(protocol, root, path) { | ||
var peg$f4 = function(raw) { | ||
return 'stoplight' | ||
}; | ||
var peg$f5 = function() { return null }; | ||
var peg$f6 = function(protocol, root, path) { | ||
return { | ||
@@ -234,6 +239,6 @@ protocol, | ||
}; | ||
var peg$f6 = function(raw) { | ||
var peg$f7 = function(raw) { | ||
return 'file' | ||
}; | ||
var peg$f7 = function(root, path) { | ||
var peg$f8 = function(root, path) { | ||
return { | ||
@@ -247,3 +252,3 @@ protocol: 'file', | ||
}; | ||
var peg$f8 = function(drive) { | ||
var peg$f9 = function(drive) { | ||
return { | ||
@@ -253,3 +258,3 @@ drive: drive.toLowerCase() + ':' | ||
}; | ||
var peg$f9 = function() { | ||
var peg$f10 = function() { | ||
return { | ||
@@ -259,3 +264,3 @@ drive: null | ||
}; | ||
var peg$f10 = function() { | ||
var peg$f11 = function() { | ||
return { | ||
@@ -265,3 +270,3 @@ drive: null | ||
}; | ||
var peg$f11 = function(path) { | ||
var peg$f12 = function(path) { | ||
return { | ||
@@ -275,3 +280,3 @@ protocol: null, | ||
}; | ||
var peg$f12 = function(path) { | ||
var peg$f13 = function(path) { | ||
return { | ||
@@ -281,4 +286,4 @@ path, | ||
}; | ||
var peg$f13 = function(head, tail) { return [head, ...tail] }; | ||
var peg$f14 = function(head) { return [head] }; | ||
var peg$f14 = function(head, tail) { return [head, ...tail] }; | ||
var peg$f15 = function(head) { return [head] }; | ||
var peg$currPos = 0; | ||
@@ -514,2 +519,5 @@ var peg$savedPos = 0; | ||
s0 = peg$parseHttpsProtocol(); | ||
if (s0 === peg$FAILED) { | ||
s0 = peg$parseStoplightProtocol(); | ||
} | ||
} | ||
@@ -560,2 +568,22 @@ | ||
function peg$parseStoplightProtocol() { | ||
var s0, s1; | ||
s0 = peg$currPos; | ||
if (input.substr(peg$currPos, 12).toLowerCase() === peg$c2) { | ||
s1 = input.substr(peg$currPos, 12); | ||
peg$currPos += 12; | ||
} else { | ||
s1 = peg$FAILED; | ||
if (peg$silentFails === 0) { peg$fail(peg$e2); } | ||
} | ||
if (s1 !== peg$FAILED) { | ||
peg$savedPos = s0; | ||
s1 = peg$f4(s1); | ||
} | ||
s0 = s1; | ||
return s0; | ||
} | ||
function peg$parseOrigin() { | ||
@@ -584,3 +612,3 @@ var s0, s1, s2; | ||
peg$savedPos = s0; | ||
s1 = peg$f4(); | ||
s1 = peg$f5(); | ||
s0 = s1; | ||
@@ -603,3 +631,3 @@ } | ||
peg$savedPos = s0; | ||
s0 = peg$f5(s1, s2, s3); | ||
s0 = peg$f6(s1, s2, s3); | ||
} else { | ||
@@ -625,3 +653,3 @@ peg$currPos = s0; | ||
s0 = peg$currPos; | ||
if (input.substr(peg$currPos, 7).toLowerCase() === peg$c2) { | ||
if (input.substr(peg$currPos, 7).toLowerCase() === peg$c3) { | ||
s1 = input.substr(peg$currPos, 7); | ||
@@ -631,6 +659,6 @@ peg$currPos += 7; | ||
s1 = peg$FAILED; | ||
if (peg$silentFails === 0) { peg$fail(peg$e2); } | ||
if (peg$silentFails === 0) { peg$fail(peg$e3); } | ||
} | ||
if (s1 === peg$FAILED) { | ||
if (input.substr(peg$currPos, 5).toLowerCase() === peg$c3) { | ||
if (input.substr(peg$currPos, 5).toLowerCase() === peg$c4) { | ||
s1 = input.substr(peg$currPos, 5); | ||
@@ -640,3 +668,3 @@ peg$currPos += 5; | ||
s1 = peg$FAILED; | ||
if (peg$silentFails === 0) { peg$fail(peg$e3); } | ||
if (peg$silentFails === 0) { peg$fail(peg$e4); } | ||
} | ||
@@ -646,3 +674,3 @@ } | ||
peg$savedPos = s0; | ||
s1 = peg$f6(s1); | ||
s1 = peg$f7(s1); | ||
} | ||
@@ -663,3 +691,3 @@ s0 = s1; | ||
peg$savedPos = s0; | ||
s0 = peg$f7(s1, s2); | ||
s0 = peg$f8(s1, s2); | ||
} else { | ||
@@ -701,11 +729,11 @@ peg$currPos = s0; | ||
s2 = peg$FAILED; | ||
if (peg$silentFails === 0) { peg$fail(peg$e4); } | ||
if (peg$silentFails === 0) { peg$fail(peg$e5); } | ||
} | ||
if (s2 !== peg$FAILED) { | ||
if (input.charCodeAt(peg$currPos) === 58) { | ||
s3 = peg$c4; | ||
s3 = peg$c5; | ||
peg$currPos++; | ||
} else { | ||
s3 = peg$FAILED; | ||
if (peg$silentFails === 0) { peg$fail(peg$e5); } | ||
if (peg$silentFails === 0) { peg$fail(peg$e6); } | ||
} | ||
@@ -716,3 +744,3 @@ if (s3 !== peg$FAILED) { | ||
peg$savedPos = s0; | ||
s0 = peg$f8(s2); | ||
s0 = peg$f9(s2); | ||
} else { | ||
@@ -741,3 +769,3 @@ peg$currPos = s0; | ||
peg$savedPos = s0; | ||
s1 = peg$f9(); | ||
s1 = peg$f10(); | ||
} | ||
@@ -755,3 +783,3 @@ s0 = s1; | ||
peg$savedPos = s0; | ||
s1 = peg$f10(); | ||
s1 = peg$f11(); | ||
s0 = s1; | ||
@@ -771,3 +799,3 @@ | ||
peg$savedPos = s0; | ||
s0 = peg$f11(s2); | ||
s0 = peg$f12(s2); | ||
} else { | ||
@@ -792,3 +820,3 @@ peg$currPos = s0; | ||
peg$savedPos = s0; | ||
s1 = peg$f12(s1); | ||
s1 = peg$f13(s1); | ||
} | ||
@@ -811,3 +839,3 @@ s0 = s1; | ||
peg$savedPos = s0; | ||
s0 = peg$f13(s1, s3); | ||
s0 = peg$f14(s1, s3); | ||
} else { | ||
@@ -830,3 +858,3 @@ peg$currPos = s0; | ||
peg$savedPos = s0; | ||
s1 = peg$f14(s1); | ||
s1 = peg$f15(s1); | ||
} | ||
@@ -881,7 +909,7 @@ s0 = s1; | ||
if (input.charCodeAt(peg$currPos) === 46) { | ||
s1 = peg$c5; | ||
s1 = peg$c6; | ||
peg$currPos++; | ||
} else { | ||
s1 = peg$FAILED; | ||
if (peg$silentFails === 0) { peg$fail(peg$e6); } | ||
if (peg$silentFails === 0) { peg$fail(peg$e7); } | ||
} | ||
@@ -917,15 +945,15 @@ if (s1 !== peg$FAILED) { | ||
if (input.charCodeAt(peg$currPos) === 47) { | ||
s0 = peg$c6; | ||
s0 = peg$c7; | ||
peg$currPos++; | ||
} else { | ||
s0 = peg$FAILED; | ||
if (peg$silentFails === 0) { peg$fail(peg$e7); } | ||
if (peg$silentFails === 0) { peg$fail(peg$e8); } | ||
} | ||
if (s0 === peg$FAILED) { | ||
if (input.charCodeAt(peg$currPos) === 92) { | ||
s0 = peg$c7; | ||
s0 = peg$c8; | ||
peg$currPos++; | ||
} else { | ||
s0 = peg$FAILED; | ||
if (peg$silentFails === 0) { peg$fail(peg$e8); } | ||
if (peg$silentFails === 0) { peg$fail(peg$e9); } | ||
} | ||
@@ -945,3 +973,3 @@ } | ||
s0 = peg$FAILED; | ||
if (peg$silentFails === 0) { peg$fail(peg$e9); } | ||
if (peg$silentFails === 0) { peg$fail(peg$e10); } | ||
} | ||
@@ -948,0 +976,0 @@ |
@@ -6,2 +6,3 @@ export * from './basename.js'; | ||
export * from './isAbsolute.js'; | ||
export * from './isStoplightURI.js'; | ||
export * from './isURL.js'; | ||
@@ -8,0 +9,0 @@ export * from './join.js'; |
export interface IPath { | ||
protocol: 'file' | 'http' | 'https' | null; | ||
protocol: 'file' | 'http' | 'https' | 'stoplight' | null; | ||
origin: string | null; | ||
@@ -4,0 +4,0 @@ absolute: boolean; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
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 v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
217401
143
4135
0