chore: remove stuff identified by knip as unused (#12815)

* chore: remove stuff identified by knip as unused

* need to continue exporting Parser, it is referenced as a type
pull/12816/head
Rich Harris 1 month ago committed by GitHub
parent dfb6755514
commit b13d331f78
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -150,7 +150,9 @@
"src/*/index.js", "src/*/index.js",
"src/index-client.ts", "src/index-client.ts",
"src/index-server.ts", "src/index-server.ts",
"src/index.d.ts" "src/index.d.ts",
"tests/**/*.js",
"tests/**/*.ts"
], ],
"project": [ "project": [
"src/**" "src/**"

@ -2,7 +2,7 @@ import { CompileDiagnostic } from './utils/compile_diagnostic.js';
/** @typedef {{ start?: number, end?: number }} NodeLike */ /** @typedef {{ start?: number, end?: number }} NodeLike */
export class InternalCompileError extends CompileDiagnostic { class InternalCompileError extends CompileDiagnostic {
name = 'CompileError'; name = 'CompileError';
/** /**

@ -3,7 +3,7 @@ import { CompileDiagnostic } from './utils/compile_diagnostic.js';
/** @typedef {{ start?: number, end?: number }} NodeLike */ /** @typedef {{ start?: number, end?: number }} NodeLike */
export class InternalCompileWarning extends CompileDiagnostic { class InternalCompileWarning extends CompileDiagnostic {
name = 'CompileWarning'; name = 'CompileWarning';
/** /**

@ -3,7 +3,7 @@
import { CompileDiagnostic } from './utils/compile_diagnostic.js'; import { CompileDiagnostic } from './utils/compile_diagnostic.js';
/** @typedef {{ start?: number, end?: number }} NodeLike */ /** @typedef {{ start?: number, end?: number }} NodeLike */
export class InternalCompileError extends CompileDiagnostic { class InternalCompileError extends CompileDiagnostic {
name = 'CompileError'; name = 'CompileError';
/** /**

@ -21,7 +21,7 @@ export function AssignmentExpression(node, context) {
* @param {Context} context * @param {Context} context
* @returns {Expression | null} * @returns {Expression | null}
*/ */
export function build_assignment(operator, left, right, context) { function build_assignment(operator, left, right, context) {
// Handle class private/public state assignment cases // Handle class private/public state assignment cases
if ( if (
context.state.analysis.runes && context.state.analysis.runes &&

@ -1,12 +1,3 @@
/**
* @template T
* @param {T} value
* @returns {asserts value is NonNullable<T>}
*/
export function ok(value) {
if (!value) throw new Error('Assertion failed');
}
/** /**
* @template T * @template T
* @param {any} actual * @param {any} actual

@ -10,7 +10,7 @@ import {
import { CompileDiagnostic } from './utils/compile_diagnostic.js'; import { CompileDiagnostic } from './utils/compile_diagnostic.js';
/** @typedef {{ start?: number, end?: number }} NodeLike */ /** @typedef {{ start?: number, end?: number }} NodeLike */
export class InternalCompileWarning extends CompileDiagnostic { class InternalCompileWarning extends CompileDiagnostic {
name = 'CompileWarning'; name = 'CompileWarning';
/** /**

@ -14,8 +14,6 @@ import {
import { equals, safe_equals } from './equality.js'; import { equals, safe_equals } from './equality.js';
import * as e from '../errors.js'; import * as e from '../errors.js';
export let updating_derived = false;
/** /**
* @template V * @template V
* @param {() => V} fn * @param {() => V} fn
@ -101,11 +99,8 @@ export function update_derived(derived) {
stack.push(derived); stack.push(derived);
} }
var previous_updating_derived = updating_derived;
updating_derived = true;
destroy_derived_children(derived); destroy_derived_children(derived);
var value = update_reaction(derived); var value = update_reaction(derived);
updating_derived = previous_updating_derived;
if (DEV) { if (DEV) {
stack.pop(); stack.pop();
@ -128,7 +123,7 @@ export function update_derived(derived) {
* @param {Derived} signal * @param {Derived} signal
* @returns {void} * @returns {void}
*/ */
export function destroy_derived(signal) { function destroy_derived(signal) {
destroy_derived_children(signal); destroy_derived_children(signal);
remove_reactions(signal, 0); remove_reactions(signal, 0);
set_signal_status(signal, DESTROYED); set_signal_status(signal, DESTROYED);

@ -61,7 +61,7 @@ export function validate_effect(rune) {
* @param {Effect} effect * @param {Effect} effect
* @param {Reaction} parent_effect * @param {Reaction} parent_effect
*/ */
export function push_effect(effect, parent_effect) { function push_effect(effect, parent_effect) {
var parent_last = parent_effect.last; var parent_last = parent_effect.last;
if (parent_last === null) { if (parent_last === null) {
parent_effect.last = parent_effect.first = effect; parent_effect.last = parent_effect.first = effect;

@ -3,9 +3,7 @@
export var is_array = Array.isArray; export var is_array = Array.isArray;
export var array_from = Array.from; export var array_from = Array.from;
export var object_keys = Object.keys; export var object_keys = Object.keys;
export var object_assign = Object.assign;
export var is_frozen = Object.isFrozen; export var is_frozen = Object.isFrozen;
export var object_freeze = Object.freeze;
export var define_property = Object.defineProperty; export var define_property = Object.defineProperty;
export var get_descriptor = Object.getOwnPropertyDescriptor; export var get_descriptor = Object.getOwnPropertyDescriptor;
export var get_descriptors = Object.getOwnPropertyDescriptors; export var get_descriptors = Object.getOwnPropertyDescriptors;

@ -1,36 +1,6 @@
/** @import { Source } from '#client' */ /** @import { Source } from '#client' */
import { set } from '../internal/client/reactivity/sources.js'; import { set } from '../internal/client/reactivity/sources.js';
/**
* @template T
* @template U
* @param {Iterable<T>} iterable
* @param {(value: T) => U} fn
* @param {string} name
* @returns {IterableIterator<U>}
*/
export function map(iterable, fn, name) {
return {
[Symbol.iterator]: get_this,
next() {
for (const value of iterable) {
return { done: false, value: fn(value) };
}
return { done: true, value: undefined };
},
// @ts-expect-error
get [Symbol.toStringTag]() {
return name;
}
};
}
/** @this {any} */
function get_this() {
return this;
}
/** @param {Source<number>} source */ /** @param {Source<number>} source */
export function increment(source) { export function increment(source) {
set(source, source.v + 1); set(source, source.v + 1);

@ -107,7 +107,7 @@ export function is_capture_event(name) {
} }
/** List of Element events that will be delegated */ /** List of Element events that will be delegated */
export const DELEGATED_EVENTS = [ const DELEGATED_EVENTS = [
'beforeinput', 'beforeinput',
'click', 'click',
'change', 'change',
@ -144,7 +144,7 @@ export function is_delegated(event_name) {
/** /**
* Attributes that are boolean, i.e. they are present or not present. * Attributes that are boolean, i.e. they are present or not present.
*/ */
export const DOM_BOOLEAN_ATTRIBUTES = [ const DOM_BOOLEAN_ATTRIBUTES = [
'allowfullscreen', 'allowfullscreen',
'async', 'async',
'autofocus', 'autofocus',

Loading…
Cancel
Save