svelte
Advanced tools
Comparing version 5.0.0-next.180 to 5.0.0-next.181
@@ -5,3 +5,3 @@ { | ||
"license": "MIT", | ||
"version": "5.0.0-next.180", | ||
"version": "5.0.0-next.181", | ||
"type": "module", | ||
@@ -8,0 +8,0 @@ "types": "./types/index.d.ts", |
@@ -440,32 +440,11 @@ /** @import * as ESTree from 'estree' */ | ||
body.push( | ||
component, | ||
b.if( | ||
b.id('import.meta.hot'), | ||
b.block([ | ||
b.const(b.id('s'), b.call('$.source', b.id(analysis.name))), | ||
b.const(b.id('filename'), b.member(b.id(analysis.name), b.id('filename'))), | ||
b.const(b.id('accept'), b.arrow([b.id('module')], b.block(accept_fn_body))), | ||
b.stmt(b.assignment('=', b.id(analysis.name), b.call('$.hmr', b.id('s')))), | ||
b.stmt( | ||
b.assignment('=', b.member(b.id(analysis.name), b.id('filename')), b.id('filename')) | ||
), | ||
b.if( | ||
b.id('import.meta.hot.acceptExports'), | ||
b.block([ | ||
b.stmt( | ||
b.call( | ||
'import.meta.hot.acceptExports', | ||
b.array([b.literal('default')]), | ||
b.id('accept') | ||
) | ||
) | ||
]), | ||
b.block([b.stmt(b.call('import.meta.hot.accept', b.id('accept')))]) | ||
) | ||
]) | ||
), | ||
const hmr = b.block([ | ||
b.const(b.id('s'), b.call('$.source', b.id(analysis.name))), | ||
b.const(b.id('filename'), b.member(b.id(analysis.name), b.id('filename'))), | ||
b.stmt(b.assignment('=', b.id(analysis.name), b.call('$.hmr', b.id('s')))), | ||
b.stmt(b.assignment('=', b.member(b.id(analysis.name), b.id('filename')), b.id('filename'))), | ||
b.stmt(b.call('import.meta.hot.accept', b.arrow([b.id('module')], b.block(accept_fn_body)))) | ||
]); | ||
b.export_default(b.id(analysis.name)) | ||
); | ||
body.push(component, b.if(b.id('import.meta.hot'), hmr), b.export_default(b.id(analysis.name))); | ||
} else { | ||
@@ -472,0 +451,0 @@ body.push(b.export_default(component)); |
/** @import { Source, Effect } from '#client' */ | ||
import { EFFECT_TRANSPARENT } from '../constants.js'; | ||
import { block, branch, destroy_effect } from '../reactivity/effects.js'; | ||
@@ -47,3 +48,3 @@ import { set_should_intro } from '../render.js'; | ||
}); | ||
}); | ||
}, EFFECT_TRANSPARENT); | ||
@@ -50,0 +51,0 @@ ran = true; |
export { SvelteDate } from './date.js'; | ||
export { SvelteSet } from './set.js'; | ||
export { SvelteMap } from './map.js'; | ||
export { SvelteURL, SvelteURLSearchParams } from './url.js'; | ||
export { SvelteURL } from './url.js'; | ||
export { SvelteURLSearchParams } from './url-search-params.js'; | ||
@@ -6,0 +7,0 @@ /** @deprecated Use `SvelteDate` instead */ |
import { source, set } from '../internal/client/reactivity/sources.js'; | ||
import { get } from '../internal/client/runtime.js'; | ||
import { increment } from './utils.js'; | ||
import { REPLACE, SvelteURLSearchParams } from './url-search-params.js'; | ||
const REPLACE = Symbol(); | ||
/** @type {SvelteURL | null} */ | ||
let current_url = null; | ||
export function get_current_url() { | ||
// ideally we'd just export `current_url` directly, but it seems Vitest doesn't respect live bindings | ||
return current_url; | ||
} | ||
export class SvelteURL extends URL { | ||
@@ -15,3 +21,4 @@ #protocol = source(super.protocol); | ||
#hash = source(super.hash); | ||
#searchParams = new SvelteURLSearchParams(); | ||
#search = source(super.search); | ||
#searchParams; | ||
@@ -25,3 +32,6 @@ /** | ||
super(url); | ||
this.#searchParams[REPLACE](url.searchParams); | ||
current_url = this; | ||
this.#searchParams = new SvelteURLSearchParams(url.searchParams); | ||
current_url = null; | ||
} | ||
@@ -67,3 +77,3 @@ | ||
get(this.#hash); | ||
this.#searchParams.toString(); | ||
get(this.#search); | ||
return super.href; | ||
@@ -81,2 +91,3 @@ } | ||
set(this.#hash, super.hash); | ||
set(this.#search, super.search); | ||
this.#searchParams[REPLACE](super.searchParams); | ||
@@ -122,4 +133,3 @@ } | ||
get search() { | ||
const search = this.#searchParams?.toString(); | ||
return search ? `?${search}` : ''; | ||
return get(this.#search); | ||
} | ||
@@ -129,3 +139,4 @@ | ||
super.search = value; | ||
this.#searchParams[REPLACE](new URLSearchParams(value.replace(/^\?/, ''))); | ||
set(this.#search, value); | ||
this.#searchParams[REPLACE](super.searchParams); | ||
} | ||
@@ -161,112 +172,1 @@ | ||
} | ||
export class SvelteURLSearchParams extends URLSearchParams { | ||
#version = source(0); | ||
/** | ||
* @param {URLSearchParams} params | ||
*/ | ||
[REPLACE](params) { | ||
for (const key of [...super.keys()]) { | ||
super.delete(key); | ||
} | ||
for (const [key, value] of params) { | ||
super.append(key, value); | ||
} | ||
increment(this.#version); | ||
} | ||
/** | ||
* @param {string} name | ||
* @param {string} value | ||
* @returns {void} | ||
*/ | ||
append(name, value) { | ||
increment(this.#version); | ||
return super.append(name, value); | ||
} | ||
/** | ||
* @param {string} name | ||
* @param {string=} value | ||
* @returns {void} | ||
*/ | ||
delete(name, value) { | ||
increment(this.#version); | ||
return super.delete(name, value); | ||
} | ||
/** | ||
* @param {string} name | ||
* @returns {string|null} | ||
*/ | ||
get(name) { | ||
get(this.#version); | ||
return super.get(name); | ||
} | ||
/** | ||
* @param {string} name | ||
* @returns {string[]} | ||
*/ | ||
getAll(name) { | ||
get(this.#version); | ||
return super.getAll(name); | ||
} | ||
/** | ||
* @param {string} name | ||
* @param {string=} value | ||
* @returns {boolean} | ||
*/ | ||
has(name, value) { | ||
get(this.#version); | ||
return super.has(name, value); | ||
} | ||
keys() { | ||
get(this.#version); | ||
return super.keys(); | ||
} | ||
/** | ||
* @param {string} name | ||
* @param {string} value | ||
* @returns {void} | ||
*/ | ||
set(name, value) { | ||
increment(this.#version); | ||
return super.set(name, value); | ||
} | ||
sort() { | ||
increment(this.#version); | ||
return super.sort(); | ||
} | ||
toString() { | ||
get(this.#version); | ||
return super.toString(); | ||
} | ||
values() { | ||
get(this.#version); | ||
return super.values(); | ||
} | ||
entries() { | ||
get(this.#version); | ||
return super.entries(); | ||
} | ||
[Symbol.iterator]() { | ||
return this.entries(); | ||
} | ||
get size() { | ||
get(this.#version); | ||
return super.size; | ||
} | ||
} |
@@ -9,3 +9,3 @@ // generated during release, do not modify | ||
*/ | ||
export const VERSION = '5.0.0-next.180'; | ||
export const VERSION = '5.0.0-next.181'; | ||
export const PUBLIC_VERSION = '5'; |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
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
2129313
213
46733