Socket
Socket
Sign inDemoInstall

svelte-dev-helper

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

svelte-dev-helper - npm Package Compare versions

Comparing version 1.1.2 to 1.1.3

test/fixtures/mockComponentWithPreload.js

7

lib/proxy.js

@@ -102,3 +102,3 @@ import Registry from './registry';

if (!keepInsertionPoint) {
if (!keepInsertionPoint && this.__insertionPoint) {
//deref for GC before removal of node

@@ -216,3 +216,8 @@ this.__insertionPoint.__component__ = null;

const originalComponent = Registry.get(id).component;
if (originalComponent.preload) {
proxyComponent.preload = originalComponent.preload;
}
return proxyComponent;
}

2

package.json
{
"name": "svelte-dev-helper",
"version": "1.1.2",
"version": "1.1.3",
"description": "Helper for svelte components to ease development",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -6,3 +6,3 @@ # svelte-dev-helper

Helper for svelte components to ease development.
Used under the hood by [svelte-hot-loader](https://github.com/ekhaled/svelte-hot-loader).
Used under the hood by [svelte-loader](https://github.com/sveltejs/svelte-loader).

@@ -9,0 +9,0 @@

@@ -9,2 +9,3 @@ /* global describe, it */

const ErrorComponent = require('./fixtures/mockComponentWithError').default;
const PreloadComponent = require('./fixtures/mockComponentWithPreload').default;

@@ -36,2 +37,3 @@ chai.use(sinonChai);

const id = 'fixtures\\mockComponent.html';
const idPreload = 'fixtures\\mockComponentWithPreload.html';
const allMethods = 'get,fire,observe,on,set,teardown,_recompute,_set,_mount,_unmount,destroy,_register,_rerender'.split(',');

@@ -45,3 +47,4 @@ const straightProxiedMethods = allMethods.slice(0, 7);

SpiedComponent2 = spy(Component),
SpiedErrorComponent = spy(ErrorComponent);
SpiedErrorComponent = spy(ErrorComponent),
SpiedPreload = spy(PreloadComponent, 'preload');

@@ -54,4 +57,11 @@ Registry.set(id, {

Registry.set(idPreload, {
rollback: null,
component: PreloadComponent,
instances: []
});
const Wrapped = createProxy(id),
wrappedComponent = new Wrapped({});
wrappedComponent = new Wrapped({}),
PreloadWrapped = createProxy(idPreload);

@@ -64,2 +74,7 @@ let methodSpies = {};

it('should forward calls to static preload method', function() {
PreloadWrapped.preload();
expect(SpiedPreload).to.be.calledOnce;
});
it('should contain the right component and instance in Registry', function() {

@@ -66,0 +81,0 @@ const item = Registry.get(id);

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