From 293f905a53cd34a21814c46048bd415aad7dea4e Mon Sep 17 00:00:00 2001 From: Rich Harris Date: Thu, 28 Mar 2024 19:02:21 -0400 Subject: [PATCH] chore: use #client alias (#10974) --- packages/svelte/src/internal/client/loop.js | 6 ++-- packages/svelte/src/internal/client/proxy.js | 28 +++++++++---------- packages/svelte/src/internal/client/timing.js | 2 +- 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/packages/svelte/src/internal/client/loop.js b/packages/svelte/src/internal/client/loop.js index 1d3aec1be4..d76cd70c34 100644 --- a/packages/svelte/src/internal/client/loop.js +++ b/packages/svelte/src/internal/client/loop.js @@ -22,11 +22,11 @@ function run_tasks(now) { /** * Creates a new task that runs on each raf frame * until it returns a falsy value or is aborted - * @param {import('./types.js').TaskCallback} callback - * @returns {import('./types.js').Task} + * @param {import('#client').TaskCallback} callback + * @returns {import('#client').Task} */ export function loop(callback) { - /** @type {import('./types.js').TaskEntry} */ + /** @type {import('#client').TaskEntry} */ let task; if (raf.tasks.size === 0) { diff --git a/packages/svelte/src/internal/client/proxy.js b/packages/svelte/src/internal/client/proxy.js index e9c3bc8fd1..bf4e15c5ff 100644 --- a/packages/svelte/src/internal/client/proxy.js +++ b/packages/svelte/src/internal/client/proxy.js @@ -22,13 +22,13 @@ import { UNINITIALIZED } from '../../constants.js'; * @param {T} value * @param {boolean} [immutable] * @param {Set | null} [owners] - * @returns {import('./types.js').ProxyStateObject | T} + * @returns {import('#client').ProxyStateObject | T} */ export function proxy(value, immutable = true, owners) { if (typeof value === 'object' && value != null && !is_frozen(value)) { // If we have an existing proxy, return it... if (STATE_SYMBOL in value) { - const metadata = /** @type {import('./types.js').ProxyMetadata} */ (value[STATE_SYMBOL]); + const metadata = /** @type {import('#client').ProxyMetadata} */ (value[STATE_SYMBOL]); // ...unless the proxy belonged to a different object, because // someone copied the state symbol using `Reflect.ownKeys(...)` if (metadata.t === value || metadata.p === value) { @@ -53,7 +53,7 @@ export function proxy(value, immutable = true, owners) { const proxy = new Proxy(value, state_proxy_handler); define_property(value, STATE_SYMBOL, { - value: /** @type {import('./types.js').ProxyMetadata} */ ({ + value: /** @type {import('#client').ProxyMetadata} */ ({ s: new Map(), v: source(0), a: is_array(value), @@ -86,7 +86,7 @@ export function proxy(value, immutable = true, owners) { } /** - * @template {import('./types.js').ProxyStateObject} T + * @template {import('#client').ProxyStateObject} T * @param {T} value * @param {Map>} already_unwrapped * @returns {Record} @@ -138,23 +138,23 @@ function unwrap(value, already_unwrapped) { */ export function unstate(value) { return /** @type {T} */ ( - unwrap(/** @type {import('./types.js').ProxyStateObject} */ (value), new Map()) + unwrap(/** @type {import('#client').ProxyStateObject} */ (value), new Map()) ); } /** - * @param {import('./types.js').Source} signal + * @param {import('#client').Source} signal * @param {1 | -1} [d] */ function update_version(signal, d = 1) { set(signal, signal.v + d); } -/** @type {ProxyHandler>} */ +/** @type {ProxyHandler>} */ const state_proxy_handler = { defineProperty(target, prop, descriptor) { if (descriptor.value) { - /** @type {import('./types.js').ProxyMetadata} */ + /** @type {import('#client').ProxyMetadata} */ const metadata = target[STATE_SYMBOL]; const s = metadata.s.get(prop); @@ -165,7 +165,7 @@ const state_proxy_handler = { }, deleteProperty(target, prop) { - /** @type {import('./types.js').ProxyMetadata} */ + /** @type {import('#client').ProxyMetadata} */ const metadata = target[STATE_SYMBOL]; const s = metadata.s.get(prop); const is_array = metadata.a; @@ -198,7 +198,7 @@ const state_proxy_handler = { return Reflect.get(target, STATE_SYMBOL); } - /** @type {import('./types.js').ProxyMetadata} */ + /** @type {import('#client').ProxyMetadata} */ const metadata = target[STATE_SYMBOL]; let s = metadata.s.get(prop); @@ -229,7 +229,7 @@ const state_proxy_handler = { getOwnPropertyDescriptor(target, prop) { const descriptor = Reflect.getOwnPropertyDescriptor(target, prop); if (descriptor && 'value' in descriptor) { - /** @type {import('./types.js').ProxyMetadata} */ + /** @type {import('#client').ProxyMetadata} */ const metadata = target[STATE_SYMBOL]; const s = metadata.s.get(prop); @@ -245,7 +245,7 @@ const state_proxy_handler = { if (prop === STATE_SYMBOL) { return true; } - /** @type {import('./types.js').ProxyMetadata} */ + /** @type {import('#client').ProxyMetadata} */ const metadata = target[STATE_SYMBOL]; const has = Reflect.has(target, prop); @@ -266,7 +266,7 @@ const state_proxy_handler = { }, set(target, prop, value, receiver) { - /** @type {import('./types.js').ProxyMetadata} */ + /** @type {import('#client').ProxyMetadata} */ const metadata = target[STATE_SYMBOL]; let s = metadata.s.get(prop); // If we haven't yet created a source for this property, we need to ensure @@ -329,7 +329,7 @@ const state_proxy_handler = { }, ownKeys(target) { - /** @type {import('./types.js').ProxyMetadata} */ + /** @type {import('#client').ProxyMetadata} */ const metadata = target[STATE_SYMBOL]; get(metadata.v); diff --git a/packages/svelte/src/internal/client/timing.js b/packages/svelte/src/internal/client/timing.js index 88e3d9dcb2..13d0bd27db 100644 --- a/packages/svelte/src/internal/client/timing.js +++ b/packages/svelte/src/internal/client/timing.js @@ -6,7 +6,7 @@ const request_animation_frame = is_client ? requestAnimationFrame : noop; const now = is_client ? () => performance.now() : () => Date.now(); -/** @type {import('./types.js').Raf} */ +/** @type {import('#client').Raf} */ export const raf = { tick: /** @param {any} _ */ (_) => request_animation_frame(_), now: () => now(),