Socket
Socket
Sign inDemoInstall

svelte

Package Overview
Dependencies
18
Maintainers
3
Versions
617
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 5.0.0-next.114 to 5.0.0-next.115

src/internal/client/errors.js

2

package.json

@@ -5,3 +5,3 @@ {

"license": "MIT",
"version": "5.0.0-next.114",
"version": "5.0.0-next.115",
"type": "module",

@@ -8,0 +8,0 @@ "types": "./types/index.d.ts",

@@ -1,2 +0,2 @@

/* This file is generated by scripts/process-messages.js. Do not edit! */
/* This file is generated by scripts/process-messages/index.js. Do not edit! */

@@ -3,0 +3,0 @@ /** @typedef {{ start?: number, end?: number }} NodeLike */

@@ -239,3 +239,3 @@ import is_reference from 'is-reference';

/** @type {import('estree').Node} */ (ast),
{ scope },
{ scope, analysis: { runes: true } },
// @ts-expect-error TODO clean this mess up

@@ -378,3 +378,3 @@ merge(set_scope(scopes), validation_runes_js, runes_scope_js_tweaker)

? true
: !!options.accessors ||
: (runes ? false : !!options.accessors) ||
// because $set method needs accessors

@@ -400,4 +400,16 @@ !!options.legacy?.componentApi,

if (!options.customElement && root.options?.customElement) {
w.options_missing_custom_element(root.options);
if (root.options) {
for (const attribute of root.options.attributes) {
if (attribute.name === 'accessors') {
w.options_deprecated_accessors(attribute);
}
if (attribute.name === 'customElement' && !options.customElement) {
w.options_missing_custom_element(attribute);
}
if (attribute.name === 'immutable') {
w.options_deprecated_immutable(attribute);
}
}
}

@@ -868,3 +880,3 @@

/** @type {import('zimmerframe').Visitors<import('#compiler').SvelteNode, { scope: Scope }>} */
/** @type {import('zimmerframe').Visitors<import('#compiler').SvelteNode, { scope: Scope, analysis: { runes: true } }>} */
const runes_scope_js_tweaker = {

@@ -871,0 +883,0 @@ VariableDeclarator(node, { state }) {

@@ -235,14 +235,2 @@ import { walk } from 'zimmerframe';

// Bind static exports to props so that people can access them with bind:x
const static_bindings = analysis.exports.map(({ name, alias }) => {
return b.stmt(
b.call(
'$.bind_prop',
b.id('$$props'),
b.literal(alias ?? name),
serialize_get_binding(b.id(name), instance_state)
)
);
});
const component_returned_object = analysis.exports.map(({ name, alias }) => {

@@ -373,6 +361,21 @@ const expression = serialize_get_binding(b.id(name), instance_state);

analysis.runes ? b.empty : b.stmt(b.call('$.init')),
.../** @type {import('estree').Statement[]} */ (template.body),
...static_bindings
.../** @type {import('estree').Statement[]} */ (template.body)
]);
if (!analysis.runes) {
// Bind static exports to props so that people can access them with bind:x
for (const { name, alias } of analysis.exports) {
component_block.body.push(
b.stmt(
b.call(
'$.bind_prop',
b.id('$$props'),
b.literal(alias ?? name),
serialize_get_binding(b.id(name), instance_state)
)
)
);
}
}
const append_styles =

@@ -379,0 +382,0 @@ analysis.inject_styles && analysis.css.ast

@@ -97,2 +97,3 @@ import type {

* @default false
* @deprecated This will have no effect in runes mode
*/

@@ -111,2 +112,3 @@ accessors?: boolean;

* @default false
* @deprecated This will have no effect in runes mode
*/

@@ -113,0 +115,0 @@ immutable?: boolean;

@@ -42,3 +42,3 @@ import * as e from './errors.js';

accessors: boolean(false),
accessors: deprecate(w.options_deprecated_accessors, boolean(false)),

@@ -45,0 +45,0 @@ css: validator('external', (input) => {

@@ -1,2 +0,2 @@

/* This file is generated by scripts/process-messages.js. Do not edit! */
/* This file is generated by scripts/process-messages/index.js. Do not edit! */

@@ -548,2 +548,10 @@ import { getLocator } from 'locate-character';

/**
* e `accessors` option has been deprecated. It will have no effect in runes mode
* @param {null | NodeLike} node
*/
export function options_deprecated_accessors(node) {
w(node, "options_deprecated_accessors", "e `accessors` option has been deprecated. It will have no effect in runes mode");
}
/**
* The `immutable` option has been deprecated. It will have no effect in runes mode

@@ -550,0 +558,0 @@ * @param {null | NodeLike} node

import { current_component_context, flush_sync, untrack } from './internal/client/runtime.js';
import { is_array } from './internal/client/utils.js';
import { user_effect } from './internal/client/index.js';
import * as e from './internal/client/errors.js';

@@ -21,3 +22,3 @@ /**

if (current_component_context === null) {
throw new Error('onMount can only be used during component initialisation.');
e.lifecycle_outside_component('onMount');
}

@@ -47,3 +48,3 @@

if (current_component_context === null) {
throw new Error('onDestroy can only be used during component initialisation.');
e.lifecycle_outside_component('onDestroy');
}

@@ -92,3 +93,3 @@

if (component_context === null) {
throw new Error('createEventDispatcher can only be used during component initialisation.');
e.lifecycle_outside_component('createEventDispatcher');
}

@@ -132,3 +133,3 @@

if (current_component_context === null) {
throw new Error('beforeUpdate can only be used during component initialisation');
e.lifecycle_outside_component('beforeUpdate');
}

@@ -157,7 +158,7 @@

if (current_component_context === null) {
throw new Error('afterUpdate can only be used during component initialisation.');
e.lifecycle_outside_component('afterUpdate');
}
if (current_component_context.l === null) {
throw new Error('afterUpdate cannot be used in runes mode');
e.lifecycle_legacy_only('afterUpdate');
}

@@ -164,0 +165,0 @@

@@ -7,2 +7,3 @@ /** @typedef {{ file: string, line: number, column: number }} Location */

import { get_prototype_of } from '../utils.js';
import * as w from '../warnings.js';

@@ -119,6 +120,3 @@ /** @type {Record<string, Array<{ start: Location, end: Location, component: Function }>>} */

if (owner.filename !== component.filename) {
let message = `${component.filename} passed a value to ${owner.filename} with \`bind:\`, but the value is owned by ${original.filename}. Consider creating a binding between ${original.filename} and ${component.filename}`;
// eslint-disable-next-line no-console
console.warn(message);
w.ownership_invalid_binding(component.filename, owner.filename, original.filename);
}

@@ -239,2 +237,3 @@ }

// TODO get rid of this, but implement message overloads first
// eslint-disable-next-line no-console

@@ -241,0 +240,0 @@ console.warn(

@@ -22,2 +22,3 @@ import { DEV } from 'esm-env';

import { reset_head_anchor } from './dom/blocks/svelte-head.js';
import * as w from './warnings.js';

@@ -122,3 +123,3 @@ /** @type {Set<string>} */

* intro?: boolean;
* recover?: false;
* recover?: boolean;
* }} options

@@ -274,2 +275,3 @@ * @returns {Exports}

root_event_handles.delete(event_handle);
mounted_components.delete(component);
};

@@ -295,4 +297,5 @@ });

if (DEV && !fn) {
w.lifecycle_double_unmount();
// eslint-disable-next-line no-console
console.warn('Tried to unmount a component that was not mounted.');
console.trace('stack trace');
}

@@ -299,0 +302,0 @@ fn?.();

@@ -25,2 +25,3 @@ import { DEV } from 'esm-env';

import { inspect_captured_signals, inspect_fn, set_inspect_fn } from './dev/inspect.js';
import * as e from './errors.js';

@@ -416,9 +417,3 @@ const FLUSH_MICROTASK = 0;

flush_count = 0;
throw new Error(
'ERR_SVELTE_TOO_MANY_UPDATES' +
(DEV
? ': Maximum update depth exceeded. This can happen when a reactive block or effect ' +
'repeatedly sets a new value. Svelte limits the number of nested updates to prevent infinite loops.'
: '')
);
e.effect_update_depth_exceeded();
}

@@ -885,3 +880,3 @@ flush_count++;

export function getContext(key) {
const context_map = get_or_init_context_map();
const context_map = get_or_init_context_map('getContext');
const result = /** @type {T} */ (context_map.get(key));

@@ -891,3 +886,3 @@

// @ts-expect-error
const fn = current_component_context?.function;
const fn = current_component_context.function;
if (fn) {

@@ -915,3 +910,3 @@ add_owner(result, fn, true);

export function setContext(key, context) {
const context_map = get_or_init_context_map();
const context_map = get_or_init_context_map('setContext');
context_map.set(key, context);

@@ -930,3 +925,3 @@ return context;

export function hasContext(key) {
const context_map = get_or_init_context_map();
const context_map = get_or_init_context_map('hasContext');
return context_map.has(key);

@@ -945,3 +940,3 @@ }

export function getAllContexts() {
const context_map = get_or_init_context_map();
const context_map = get_or_init_context_map('getAllContexts');

@@ -961,12 +956,14 @@ if (DEV) {

/** @returns {Map<unknown, unknown>} */
function get_or_init_context_map() {
const component_context = current_component_context;
if (component_context === null) {
throw new Error(
'ERR_SVELTE_ORPHAN_CONTEXT' +
(DEV ? 'Context can only be used during component initialisation.' : '')
);
/**
* @param {string} name
* @returns {Map<unknown, unknown>}
*/
function get_or_init_context_map(name) {
if (current_component_context === null) {
e.lifecycle_outside_component(name);
}
return (component_context.c ??= new Map(get_parent_context(component_context) || undefined));
return (current_component_context.c ??= new Map(
get_parent_context(current_component_context) || undefined
));
}

@@ -973,0 +970,0 @@

import { is_void } from '../../compiler/phases/1-parse/utils/names.js';
import * as w from './warnings.js';

@@ -45,4 +46,3 @@ const snippet_symbol = Symbol.for('svelte.snippet');

if (tag && is_void(tag)) {
// eslint-disable-next-line no-console
console.warn(`<svelte:element this="${tag}"> is self-closing and cannot have content.`);
w.dynamic_void_element_content(false, tag);
}

@@ -49,0 +49,0 @@ }

@@ -9,3 +9,3 @@ // generated during release, do not modify

*/
export const VERSION = '5.0.0-next.114';
export const VERSION = '5.0.0-next.115';
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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc