jsdom-url
Advanced tools
Comparing version 2.1.0 to 2.1.1
@@ -0,1 +1,4 @@ | ||
/** | ||
* Created by user on 2018/1/21/021. | ||
*/ | ||
export * from 'whatwg-url'; | ||
@@ -2,0 +5,0 @@ import { isValidURLObject } from './lib/valid/URL'; |
"use strict"; | ||
/** | ||
* Created by user on 2018/1/21/021. | ||
*/ | ||
function __export(m) { | ||
@@ -3,0 +6,0 @@ for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; |
"use strict"; | ||
/** | ||
* Created by user on 2018/1/21/021. | ||
*/ | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -15,2 +18,19 @@ const conversions = require("webidl-conversions"); | ||
class URLCore extends URLImpl_1.URLImplCore { | ||
/* | ||
href: string; | ||
origin: string; | ||
protocol: string; | ||
username: string; | ||
password: string; | ||
host: string; | ||
hostname: string; | ||
port: string; | ||
pathname: string; | ||
search: string; | ||
hash: string; | ||
searchParams: URLSearchParams; | ||
_query?: URLSearchParams; | ||
_url?: URLImplCore.IImpl; | ||
*/ | ||
constructor(href, base) { | ||
@@ -20,2 +40,3 @@ if (Array.isArray(href)) { | ||
} | ||
//console.log(111, [href, base]); | ||
href = conversions["USVString"](URL_2.isValidURLObject(href), { context: "Failed to construct 'URL': parameter 1" }); | ||
@@ -25,2 +46,3 @@ if (base !== undefined && base !== null) { | ||
} | ||
//console.log(333, [href, base]); | ||
super([href, base || undefined]); | ||
@@ -34,2 +56,9 @@ } | ||
exports.URL = URLImpl_1.packProxyURL(URLCore); | ||
/* | ||
let url = new URL(['https://www.npmjs.com/package/dgeni?l=1&l=2&k=kkk前篇']); | ||
let url2 = new URLImpl(['https://www.npmjs.com/package/dgeni?l=1&l=2&k=kkk']); | ||
console.log(url, url instanceof URLImpl); | ||
console.log(url2, url2 instanceof URL, url + ''); | ||
*/ | ||
exports.default = exports.URL; |
@@ -0,1 +1,4 @@ | ||
/** | ||
* Created by user on 2018/2/11/011. | ||
*/ | ||
import createClassProxy from 'class-proxy'; | ||
@@ -2,0 +5,0 @@ import { implementation as WURLImpl } from 'whatwg-url/lib/URL-impl'; |
"use strict"; | ||
/** | ||
* Created by user on 2018/2/11/011. | ||
*/ | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -12,2 +15,3 @@ const class_proxy_1 = require("class-proxy"); | ||
} | ||
//console.log(222, [href, base]); | ||
super([href && href.toString(), base ? base.toString() : undefined]); | ||
@@ -17,2 +21,3 @@ this._query = new URLSearchParams_1.URLSearchParamsImpl(this._query, { | ||
}); | ||
//console.log(this._query); | ||
} | ||
@@ -55,2 +60,3 @@ static create(href, base) { | ||
value._url = target; | ||
//console.log(value); | ||
} | ||
@@ -87,2 +93,19 @@ target[prop] = value; | ||
exports.URLImpl = packProxyURL(URLImplCore); | ||
/* | ||
let url = new URLImpl(['https://www.npmjs.com/package/dgeni?l=1&l=2&k=kkk']); | ||
let url3 = new URLImplProxy([url]); | ||
console.log(url); | ||
console.log(url3, url3 instanceof WURLImpl); | ||
//console.log(Object.keys(url)); | ||
//console.log(Object.keys(url3)); | ||
console.dir(url); | ||
console.dir(url3); | ||
console.dir(url3._url); | ||
//console.dir(url); | ||
*/ | ||
exports.default = exports.URLImpl; |
@@ -0,1 +1,4 @@ | ||
/** | ||
* Created by user on 2018/1/21/021. | ||
*/ | ||
import { interface as WURLSearchParams } from 'whatwg-url/lib/URLSearchParams'; | ||
@@ -14,2 +17,8 @@ import { implementation as WURLSearchParamsImpl } from 'whatwg-url/lib/URLSearchParams-impl'; | ||
constructor(constructorArgs: any, privateData?: URLSearchParamsCore.IPrivateData, ...argv: any[]); | ||
/** | ||
* | ||
* @param unsafe remove ??& | ||
* @param {boolean} unsafe | ||
* @returns {string} | ||
*/ | ||
static stripQMark(s: any, unsafe?: boolean): string; | ||
@@ -26,2 +35,5 @@ static create(constructorArgs: any, IPrivateData?: URLSearchParamsCore.IPrivateData, ...argv: any[]): URLSearchParamsImplCore; | ||
[Symbol.iterator](): any; | ||
keys(): any; | ||
values(): any; | ||
entries(): any; | ||
_updateSteps(): this; | ||
@@ -45,2 +57,9 @@ sort(): this; | ||
readonly length: number; | ||
entries(): any; | ||
keys(): any; | ||
values(): any; | ||
forEach(callback: any): any; | ||
sort(): any; | ||
has(name: any): any; | ||
set(name: any, value: any): any; | ||
} | ||
@@ -53,3 +72,5 @@ export interface IStaticURLSearchParams<T> extends URLSearchParamsCore.IStaticURLSearchParams<T> { | ||
} | ||
export declare type vURLSearchParamsItem = URLSearchParamsCore.vURLSearchParamsItem; | ||
export declare module URLSearchParamsCore { | ||
type vURLSearchParamsItem = [string, string]; | ||
interface IPrivateData { | ||
@@ -56,0 +77,0 @@ doNotStripQMark?: boolean; |
"use strict"; | ||
/** | ||
* Created by user on 2018/1/21/021. | ||
*/ | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -46,5 +49,10 @@ const URLSearchParams_1 = require("whatwg-url/lib/URLSearchParams"); | ||
else { | ||
// console.warn(initArgv); | ||
constructorArgs = initArgv; | ||
} | ||
if (privateData && privateData.doNotStripQMark && typeof constructorArgs[0] == 'string') { | ||
/** | ||
* unsafe remove ??& | ||
* @type {string} | ||
*/ | ||
constructorArgs[0] = unsafeRemoveStr(constructorArgs[0]); | ||
@@ -66,2 +74,8 @@ } | ||
} | ||
/** | ||
* | ||
* @param unsafe remove ??& | ||
* @param {boolean} unsafe | ||
* @returns {string} | ||
*/ | ||
static stripQMark(s, unsafe = true) { | ||
@@ -74,3 +88,3 @@ return unsafe ? unsafeRemoveStr(s) : s.replace(/^\?/, ''); | ||
clone() { | ||
return new exports.URLSearchParamsImpl(this.toString()); | ||
return new exports.URLSearchParamsImpl(this); | ||
} | ||
@@ -110,2 +124,11 @@ get [Symbol.toStringTag]() { | ||
} | ||
keys() { | ||
return URLSearchParams_1.createDefaultIterator(this, 'key'); | ||
} | ||
values() { | ||
return URLSearchParams_1.createDefaultIterator(this, 'values'); | ||
} | ||
entries() { | ||
return super[Symbol.iterator](); | ||
} | ||
_updateSteps() { | ||
@@ -169,2 +192,23 @@ super._updateSteps(); | ||
} | ||
entries() { | ||
return super.entries(); | ||
} | ||
keys() { | ||
return super.keys(); | ||
} | ||
values() { | ||
return super.values(); | ||
} | ||
forEach(callback) { | ||
return super.forEach(callback); | ||
} | ||
sort() { | ||
return super.sort(); | ||
} | ||
has(name) { | ||
return super.has(name); | ||
} | ||
set(name, value) { | ||
return super.set(name, value); | ||
} | ||
} | ||
@@ -171,0 +215,0 @@ exports.URLSearchParamsCore = URLSearchParamsCore; |
@@ -5,3 +5,3 @@ /** | ||
import { interface as WURLSearchParams } from 'whatwg-url/lib/URLSearchParams'; | ||
import { interface as WURLSearchParams, createDefaultIterator } from 'whatwg-url/lib/URLSearchParams'; | ||
import { implementation as WURLSearchParamsImpl } from 'whatwg-url/lib/URLSearchParams-impl'; | ||
@@ -32,14 +32,2 @@ import createClassProxy from 'class-proxy'; | ||
/* | ||
WURLSearchParams.prototype.toJSON = function inspect() | ||
{ | ||
return this.toString(); | ||
}; | ||
Object.defineProperty(WURLSearchParams.prototype, 'toJSON', { | ||
enumerable: false, | ||
}); | ||
*/ | ||
export function unsafeRemoveStr(s): string | ||
@@ -141,3 +129,3 @@ { | ||
{ | ||
return new URLSearchParamsImpl(this.toString()); | ||
return new URLSearchParamsImpl(this); | ||
} | ||
@@ -199,2 +187,17 @@ | ||
keys() | ||
{ | ||
return createDefaultIterator(this, 'key'); | ||
} | ||
values() | ||
{ | ||
return createDefaultIterator(this, 'values'); | ||
} | ||
entries() | ||
{ | ||
return super[Symbol.iterator](); | ||
} | ||
_updateSteps() | ||
@@ -292,2 +295,37 @@ { | ||
} | ||
entries() | ||
{ | ||
return super.entries(); | ||
} | ||
keys() | ||
{ | ||
return super.keys(); | ||
} | ||
values() | ||
{ | ||
return super.values(); | ||
} | ||
forEach(callback) | ||
{ | ||
return super.forEach(callback); | ||
} | ||
sort() | ||
{ | ||
return super.sort(); | ||
} | ||
has(name) | ||
{ | ||
return super.has(name); | ||
} | ||
set(name, value) | ||
{ | ||
return super.set(name, value); | ||
} | ||
} | ||
@@ -297,9 +335,15 @@ | ||
{} | ||
export interface IPrivateData extends URLSearchParamsCore.IPrivateData | ||
{} | ||
export interface IURLSearchParams extends URLSearchParamsCore.IURLSearchParams | ||
{} | ||
export type vURLSearchParamsItem = URLSearchParamsCore.vURLSearchParamsItem; | ||
export module URLSearchParamsCore | ||
{ | ||
export type vURLSearchParamsItem = [string, string]; | ||
export interface IPrivateData | ||
@@ -334,2 +378,3 @@ { | ||
new(constructorArgs, privateData?: IPrivateData, ...argv): T | ||
create(constructorArgs, privateData?: IPrivateData, ...argv): T; | ||
@@ -339,3 +384,5 @@ } | ||
export function packProxyURLSearchParams<T>(classURL: URLSearchParamsCore.IStaticURLSearchParams<T>, handler?: createClassProxy.IClassProxyHandler) | ||
export function packProxyURLSearchParams<T>(classURL: URLSearchParamsCore.IStaticURLSearchParams<T>, | ||
handler?: createClassProxy.IClassProxyHandler | ||
) | ||
{ | ||
@@ -342,0 +389,0 @@ return createClassProxy(classURL, Object.assign({ |
"use strict"; | ||
/** | ||
* Created by user on 2018/1/21/021. | ||
*/ | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -3,0 +6,0 @@ const URL_impl_1 = require("whatwg-url/lib/URL-impl"); |
{ | ||
"name": "jsdom-url", | ||
"version": "2.1.0", | ||
"version": "2.1.1", | ||
"description": "a proxy JSDOM URL object", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
35971
1246