pnpm run format

pull/16485/head
Nathan Shively-Sanders 1 month ago
parent f8bf2826ab
commit 84b50a6468

@ -26,9 +26,11 @@ await createBundle({
// so that types/properties with `@internal` (and its dependencies) are removed from the output
stripInternal: true,
paths: Object.fromEntries(
Object.entries(pkg.imports).map(/** @param {[string,any]} import */([key, value]) => {
return [key, [value.types ?? value.default ?? value]];
})
Object.entries(pkg.imports).map(
/** @param {[string,any]} import */ ([key, value]) => {
return [key, [value.types ?? value.default ?? value]];
}
)
)
},
modules: {

@ -55,7 +55,9 @@ export function convert(source, ast) {
// Insert svelte:options back into the root nodes
if (/** @type {any} */ (options)?.__raw__) {
let idx = node.fragment.nodes.findIndex((node) => /** @type {any} */ (options).end <= node.start);
let idx = node.fragment.nodes.findIndex(
(node) => /** @type {any} */ (options).end <= node.start
);
if (idx === -1) {
idx = node.fragment.nodes.length;
}

@ -1,9 +1,9 @@
/** @import { Equals } from '#client' */
/** @type {Equals} */
export const equals = function(value) {
export const equals = function (value) {
return value === this.v;
}
};
/**
* @param {unknown} a
@ -26,6 +26,6 @@ export function not_equal(a, b) {
}
/** @type {Equals} */
export const safe_equals = function(value) {
export const safe_equals = function (value) {
return !safe_not_equal(value, this.v);
}
};

@ -361,21 +361,23 @@ export function prop(props, key, flags, fallback) {
// means we can just call `$$props.foo = value` directly
if (setter) {
var legacy_parent = props.$$legacy;
return /** @type {() => V} */ (function (/** @type {V} */ value, /** @type {boolean} */ mutation) {
if (arguments.length > 0) {
// We don't want to notify if the value was mutated and the parent is in runes mode.
// In that case the state proxy (if it exists) should take care of the notification.
// If the parent is not in runes mode, we need to notify on mutation, too, that the prop
// has changed because the parent will not be able to detect the change otherwise.
if (!runes || !mutation || legacy_parent || is_store_sub) {
/** @type {Function} */ (setter)(mutation ? getter() : value);
return /** @type {() => V} */ (
function (/** @type {V} */ value, /** @type {boolean} */ mutation) {
if (arguments.length > 0) {
// We don't want to notify if the value was mutated and the parent is in runes mode.
// In that case the state proxy (if it exists) should take care of the notification.
// If the parent is not in runes mode, we need to notify on mutation, too, that the prop
// has changed because the parent will not be able to detect the change otherwise.
if (!runes || !mutation || legacy_parent || is_store_sub) {
/** @type {Function} */ (setter)(mutation ? getter() : value);
}
return value;
}
return value;
return getter();
}
return getter();
});
);
}
// Either prop is written to, but there's no binding, which means we
@ -397,30 +399,32 @@ export function prop(props, key, flags, fallback) {
if (bindable) get(d);
var parent_effect = /** @type {Effect} */ (active_effect);
return /** @type {() => V} */(function (/** @type {any} */ value, /** @type {boolean} */ mutation) {
if (arguments.length > 0) {
const new_value = mutation ? get(d) : runes && bindable ? proxy(value) : value;
set(d, new_value);
overridden = true;
return /** @type {() => V} */ (
function (/** @type {any} */ value, /** @type {boolean} */ mutation) {
if (arguments.length > 0) {
const new_value = mutation ? get(d) : runes && bindable ? proxy(value) : value;
set(d, new_value);
overridden = true;
if (fallback_value !== undefined) {
fallback_value = new_value;
}
if (fallback_value !== undefined) {
fallback_value = new_value;
return value;
}
return value;
}
// special case — avoid recalculating the derived if we're in a
// teardown function and the prop was overridden locally, or the
// component was already destroyed (this latter part is necessary
// because `bind:this` can read props after the component has
// been destroyed. TODO simplify `bind:this`
if ((is_destroying_effect && overridden) || (parent_effect.f & DESTROYED) !== 0) {
return d.v;
}
// special case — avoid recalculating the derived if we're in a
// teardown function and the prop was overridden locally, or the
// component was already destroyed (this latter part is necessary
// because `bind:this` can read props after the component has
// been destroyed. TODO simplify `bind:this`
if ((is_destroying_effect && overridden) || (parent_effect.f & DESTROYED) !== 0) {
return d.v;
return get(d);
}
return get(d);
});
);
}

@ -6,8 +6,12 @@ export class HeadPayload {
uid = () => '';
title = '';
constructor(/** @type {Set<{ hash: string; code: string }>} */ css = new Set(), /** @type {string[]} */ out = [], title = '', uid = () => '') {
constructor(
/** @type {Set<{ hash: string; code: string }>} */ css = new Set(),
/** @type {string[]} */ out = [],
title = '',
uid = () => ''
) {
this.css = css;
this.out = out;
this.title = title;

@ -88,9 +88,11 @@ function normalize_html(window, html) {
/** @param {any} node */
function normalize_children(node) {
// sort attributes
const attributes = Array.from(node.attributes).sort((/** @type {any} */ a,/** @type {any} */ b) => {
return a.name < b.name ? -1 : 1;
});
const attributes = Array.from(node.attributes).sort(
(/** @type {any} */ a, /** @type {any} */ b) => {
return a.name < b.name ? -1 : 1;
}
);
attributes.forEach((/** @type{any} */ attr) => {
node.removeAttribute(attr.name);

Loading…
Cancel
Save