Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

svelte

Package Overview
Dependencies
Maintainers
3
Versions
774
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

svelte - npm Package Compare versions

Comparing version 5.0.0-next.194 to 5.0.0-next.195

2

package.json

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

"license": "MIT",
"version": "5.0.0-next.194",
"version": "5.0.0-next.195",
"type": "module",

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

@@ -420,4 +420,15 @@ /** @import * as ESTree from 'estree' */

if (options.hmr) {
const id = b.id(analysis.name);
const HMR = b.id('$.HMR');
const existing = b.member(id, HMR, true);
const incoming = b.member(b.id('module.default'), HMR, true);
const accept_fn_body = [
b.stmt(b.call('$.set', b.id('s'), b.member(b.id('module.default'), b.id('$.ORIGINAL'), true)))
b.stmt(
b.assignment('=', b.member(incoming, b.id('source')), b.member(existing, b.id('source')))
),
b.stmt(
b.call('$.set', b.member(existing, b.id('source')), b.member(incoming, b.id('original')))
)
];

@@ -442,22 +453,6 @@

const hmr = b.block([
b.const(b.id('s'), b.call('$.source', b.id(analysis.name))),
b.const(b.id('$$filename'), b.member(b.id(analysis.name), b.id('$.FILENAME'), true)),
b.const(b.id('$$original'), b.id(analysis.name)),
b.stmt(b.assignment('=', b.id(analysis.name), b.call('$.hmr', b.id('s')))),
b.stmt(
b.assignment(
'=',
b.member(b.id(analysis.name), b.id('$.FILENAME'), true),
b.id('$$filename')
)
b.assignment('=', id, b.call('$.hmr', id, b.thunk(b.member(existing, b.id('source')))))
),
// Assign the original component to the wrapper so we can use it on hot reload patching,
// else we would call the HMR function two times
b.stmt(
b.assignment(
'=',
b.member(b.id(analysis.name), b.id('$.ORIGINAL'), true),
b.id('$$original')
)
),
b.stmt(b.call('import.meta.hot.accept', b.arrow([b.id('module')], b.block(accept_fn_body))))

@@ -464,0 +459,0 @@ ]);

@@ -35,3 +35,3 @@ export const EACH_ITEM_REACTIVE = 1;

export const FILENAME = Symbol('filename');
export const ORIGINAL = Symbol('original');
export const HMR = Symbol('hmr');

@@ -38,0 +38,0 @@ /** List of elements that require raw contents and should not have SSR comments put in them */

/** @import { Source, Effect } from '#client' */
import { FILENAME, HMR } from '../../../constants.js';
import { EFFECT_TRANSPARENT } from '../constants.js';
import { block, branch, destroy_effect } from '../reactivity/effects.js';
import { source } from '../reactivity/sources.js';
import { set_should_intro } from '../render.js';

@@ -9,5 +11,6 @@ import { get } from '../runtime.js';

* @template {(anchor: Comment, props: any) => any} Component
* @param {Source<Component>} source
* @param {Component} original
* @param {() => Source<Component>} get_source
*/
export function hmr(source) {
export function hmr(original, get_source) {
/**

@@ -17,3 +20,3 @@ * @param {Comment} anchor

*/
return function (anchor, props) {
function wrapper(anchor, props) {
let instance = {};

@@ -27,2 +30,3 @@

block(() => {
const source = get_source();
const component = get(source);

@@ -56,3 +60,18 @@

return instance;
}
// @ts-expect-error
wrapper[FILENAME] = original[FILENAME];
// @ts-expect-error
wrapper[HMR] = {
// When we accept an update, we set the original source to the new component
original,
// The `get_source` parameter reads `wrapper[HMR].source`, but in the `accept`
// function we always replace it with `previous[HMR].source`, which in practice
// means we only ever update the original
source: source(original)
};
return wrapper;
}

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

export { FILENAME, ORIGINAL } from '../../constants.js';
export { FILENAME, HMR } from '../../constants.js';
export { add_locations } from './dev/elements.js';

@@ -3,0 +3,0 @@ export { hmr } from './dev/hmr.js';

/** @import { Component, Payload, RenderOutput } from '#server' */
/** @import { Store } from '#shared' */
export { FILENAME, ORIGINAL } from '../../constants.js';
export { FILENAME, HMR } from '../../constants.js';
import { is_promise, noop } from '../shared/utils.js';

@@ -5,0 +5,0 @@ import { subscribe_to_store } from '../../store/utils.js';

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

*/
export const VERSION = '5.0.0-next.194';
export const VERSION = '5.0.0-next.195';
export const PUBLIC_VERSION = '5';

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc