chore: re-export shared errors (#16356)

pull/16358/head
Rich Harris 2 months ago committed by GitHub
parent 58baf80a70
commit 61f75651d6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -1,5 +1,7 @@
import { DEV } from 'esm-env'; import { DEV } from 'esm-env';
export * from '../shared/errors.js';
/** /**
* MESSAGE * MESSAGE
* @param {string} PARAMETER * @param {string} PARAMETER

@ -1,3 +1,5 @@
export * from '../shared/errors.js';
/** /**
* MESSAGE * MESSAGE
* @param {string} PARAMETER * @param {string} PARAMETER

@ -5,7 +5,6 @@ import { active_reaction, untrack } from './internal/client/runtime.js';
import { is_array } from './internal/shared/utils.js'; import { is_array } from './internal/shared/utils.js';
import { user_effect } from './internal/client/index.js'; import { user_effect } from './internal/client/index.js';
import * as e from './internal/client/errors.js'; import * as e from './internal/client/errors.js';
import { lifecycle_outside_component } from './internal/shared/errors.js';
import { legacy_mode_flag } from './internal/flags/index.js'; import { legacy_mode_flag } from './internal/flags/index.js';
import { component_context } from './internal/client/context.js'; import { component_context } from './internal/client/context.js';
import { DEV } from 'esm-env'; import { DEV } from 'esm-env';
@ -91,7 +90,7 @@ export function getAbortSignal() {
*/ */
export function onMount(fn) { export function onMount(fn) {
if (component_context === null) { if (component_context === null) {
lifecycle_outside_component('onMount'); e.lifecycle_outside_component('onMount');
} }
if (legacy_mode_flag && component_context.l !== null) { if (legacy_mode_flag && component_context.l !== null) {
@ -115,7 +114,7 @@ export function onMount(fn) {
*/ */
export function onDestroy(fn) { export function onDestroy(fn) {
if (component_context === null) { if (component_context === null) {
lifecycle_outside_component('onDestroy'); e.lifecycle_outside_component('onDestroy');
} }
onMount(() => () => untrack(fn)); onMount(() => () => untrack(fn));
@ -158,7 +157,7 @@ function create_custom_event(type, detail, { bubbles = false, cancelable = false
export function createEventDispatcher() { export function createEventDispatcher() {
const active_component_context = component_context; const active_component_context = component_context;
if (active_component_context === null) { if (active_component_context === null) {
lifecycle_outside_component('createEventDispatcher'); e.lifecycle_outside_component('createEventDispatcher');
} }
return (type, detail, options) => { return (type, detail, options) => {
@ -196,7 +195,7 @@ export function createEventDispatcher() {
*/ */
export function beforeUpdate(fn) { export function beforeUpdate(fn) {
if (component_context === null) { if (component_context === null) {
lifecycle_outside_component('beforeUpdate'); e.lifecycle_outside_component('beforeUpdate');
} }
if (component_context.l === null) { if (component_context.l === null) {
@ -219,7 +218,7 @@ export function beforeUpdate(fn) {
*/ */
export function afterUpdate(fn) { export function afterUpdate(fn) {
if (component_context === null) { if (component_context === null) {
lifecycle_outside_component('afterUpdate'); e.lifecycle_outside_component('afterUpdate');
} }
if (component_context.l === null) { if (component_context.l === null) {

@ -1,7 +1,7 @@
/** @import { ComponentContext, DevStackEntry } from '#client' */ /** @import { ComponentContext, DevStackEntry } from '#client' */
import { DEV } from 'esm-env'; import { DEV } from 'esm-env';
import { lifecycle_outside_component } from '../shared/errors.js'; import * as e from './errors.js';
import { source } from './reactivity/sources.js'; import { source } from './reactivity/sources.js';
import { import {
active_effect, active_effect,
@ -205,7 +205,7 @@ export function is_runes() {
*/ */
function get_or_init_context_map(name) { function get_or_init_context_map(name) {
if (component_context === null) { if (component_context === null) {
lifecycle_outside_component(name); e.lifecycle_outside_component(name);
} }
return (component_context.c ??= new Map(get_parent_context(component_context) || undefined)); return (component_context.c ??= new Map(get_parent_context(component_context) || undefined));

@ -1,15 +1,16 @@
import { invalid_snippet_arguments } from '../../shared/errors.js'; import * as e from '../errors.js';
/** /**
* @param {Node} anchor * @param {Node} anchor
* @param {...(()=>any)[]} args * @param {...(()=>any)[]} args
*/ */
export function validate_snippet_args(anchor, ...args) { export function validate_snippet_args(anchor, ...args) {
if (typeof anchor !== 'object' || !(anchor instanceof Node)) { if (typeof anchor !== 'object' || !(anchor instanceof Node)) {
invalid_snippet_arguments(); e.invalid_snippet_arguments();
} }
for (let arg of args) { for (let arg of args) {
if (typeof arg !== 'function') { if (typeof arg !== 'function') {
invalid_snippet_arguments(); e.invalid_snippet_arguments();
} }
} }
} }

@ -2,6 +2,8 @@
import { DEV } from 'esm-env'; import { DEV } from 'esm-env';
export * from '../shared/errors.js';
/** /**
* Using `bind:value` together with a checkbox input is not allowed. Use `bind:checked` instead * Using `bind:value` together with a checkbox input is not allowed. Use `bind:checked` instead
* @returns {never} * @returns {never}

@ -1,7 +1,7 @@
/** @import { Component } from '#server' */ /** @import { Component } from '#server' */
import { DEV } from 'esm-env'; import { DEV } from 'esm-env';
import { on_destroy } from './index.js'; import { on_destroy } from './index.js';
import * as e from '../shared/errors.js'; import * as e from './errors.js';
/** @type {Component | null} */ /** @type {Component | null} */
export var current_component = null; export var current_component = null;

@ -5,7 +5,7 @@ import {
is_tag_valid_with_parent is_tag_valid_with_parent
} from '../../html-tree-validation.js'; } from '../../html-tree-validation.js';
import { current_component } from './context.js'; import { current_component } from './context.js';
import { invalid_snippet_arguments } from '../shared/errors.js'; import * as e from './errors.js';
import { HeadPayload, Payload } from './payload.js'; import { HeadPayload, Payload } from './payload.js';
/** /**
@ -102,6 +102,6 @@ export function validate_snippet_args(payload) {
// for some reason typescript consider the type of payload as never after the first instanceof // for some reason typescript consider the type of payload as never after the first instanceof
!(payload instanceof Payload || /** @type {any} */ (payload) instanceof HeadPayload) !(payload instanceof Payload || /** @type {any} */ (payload) instanceof HeadPayload)
) { ) {
invalid_snippet_arguments(); e.invalid_snippet_arguments();
} }
} }

@ -1,6 +1,6 @@
/* This file is generated by scripts/process-messages/index.js. Do not edit! */ /* This file is generated by scripts/process-messages/index.js. Do not edit! */
export * from '../shared/errors.js';
/** /**
* `%name%(...)` is not available on the server * `%name%(...)` is not available on the server

@ -4,8 +4,8 @@ import { user_pre_effect } from '../internal/client/reactivity/effects.js';
import { mutable_source, set } from '../internal/client/reactivity/sources.js'; import { mutable_source, set } from '../internal/client/reactivity/sources.js';
import { hydrate, mount, unmount } from '../internal/client/render.js'; import { hydrate, mount, unmount } from '../internal/client/render.js';
import { active_effect, flushSync, get, set_signal_status } from '../internal/client/runtime.js'; import { active_effect, flushSync, get, set_signal_status } from '../internal/client/runtime.js';
import { lifecycle_outside_component } from '../internal/shared/errors.js';
import { define_property, is_array } from '../internal/shared/utils.js'; import { define_property, is_array } from '../internal/shared/utils.js';
import * as e from '../internal/client/errors.js';
import * as w from '../internal/client/warnings.js'; import * as w from '../internal/client/warnings.js';
import { DEV } from 'esm-env'; import { DEV } from 'esm-env';
import { FILENAME } from '../constants.js'; import { FILENAME } from '../constants.js';
@ -245,7 +245,7 @@ export function handlers(...handlers) {
export function createBubbler() { export function createBubbler() {
const active_component_context = component_context; const active_component_context = component_context;
if (active_component_context === null) { if (active_component_context === null) {
lifecycle_outside_component('createBubbler'); e.lifecycle_outside_component('createBubbler');
} }
return (/**@type {string}*/ type) => (/**@type {Event}*/ event) => { return (/**@type {string}*/ type) => (/**@type {Event}*/ event) => {

Loading…
Cancel
Save