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

svelte

Package Overview
Dependencies
Maintainers
3
Versions
776
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 2.1.0 to 2.1.1

compiler/compile/Compiler.ts

6

CHANGELOG.md
# Svelte changelog
## 2.1.1
* Report initial `changed` based on state, not expected props ([#1356](https://github.com/sveltejs/svelte/issues/1356))
* Set state to empty object, not null, on destroy ([#1354](https://github.com/sveltejs/svelte/issues/1354))
* Prevent stale state in component event handlers ([#1353](https://github.com/sveltejs/svelte/issues/1353))
## 2.1.0

@@ -4,0 +10,0 @@

48

package.json
{
"name": "svelte",
"version": "2.1.0",
"version": "2.1.1",
"description": "The magical disappearing UI framework",

@@ -46,30 +46,30 @@ "main": "compiler/svelte.js",

"devDependencies": {
"@types/mocha": "^2.2.41",
"@types/node": "^8.0.17",
"@types/mocha": "^5.2.0",
"@types/node": "^9.6.6",
"acorn": "^5.4.1",
"acorn-dynamic-import": "^2.0.2",
"chalk": "^2.0.1",
"codecov": "^2.2.0",
"acorn-dynamic-import": "^3.0.0",
"chalk": "^2.4.0",
"codecov": "^3.0.0",
"console-group": "^0.3.2",
"css-tree": "1.0.0-alpha22",
"eslint": "^4.3.0",
"eslint-plugin-html": "^3.0.0",
"eslint-plugin-import": "^2.2.0",
"eslint": "^4.19.1",
"eslint-plugin-html": "^4.0.3",
"eslint-plugin-import": "^2.11.0",
"estree-walker": "^0.5.1",
"glob": "^7.1.1",
"is-reference": "^1.1.0",
"jsdom": "^11.6.1",
"jsdom": "^11.8.0",
"locate-character": "^2.0.5",
"magic-string": "^0.22.3",
"mocha": "^3.2.0",
"nightmare": "^2.10.0",
"magic-string": "^0.24.0",
"mocha": "3",
"nightmare": "^3.0.1",
"node-resolve": "^1.3.3",
"nyc": "^11.1.0",
"prettier": "^1.7.0",
"reify": "^0.12.3",
"rollup": "^0.56.4",
"rollup-plugin-buble": "^0.15.0",
"rollup-plugin-commonjs": "^8.0.2",
"nyc": "^11.7.1",
"prettier": "^1.12.1",
"reify": "^0.15.1",
"rollup": "^0.58.1",
"rollup-plugin-buble": "^0.19.2",
"rollup-plugin-commonjs": "^9.1.0",
"rollup-plugin-json": "^2.1.0",
"rollup-plugin-node-resolve": "^3.0.0",
"rollup-plugin-node-resolve": "^3.3.0",
"rollup-plugin-replace": "^2.0.0",

@@ -79,7 +79,7 @@ "rollup-plugin-typescript": "^0.8.1",

"rollup-watch": "^4.3.1",
"source-map": "^0.5.6",
"source-map-support": "^0.4.8",
"ts-node": "^3.3.0",
"source-map": "0.6",
"source-map-support": "^0.5.4",
"ts-node": "^6.0.0",
"tslib": "^1.8.0",
"typescript": "^2.6.1"
"typescript": "^2.8.3"
},

@@ -86,0 +86,0 @@ "nyc": {

@@ -8,2 +8,7 @@ function noop() {}

function assignTrue(tar, src) {
for (var k in src) tar[k] = 1;
return tar;
}
function appendNode(node, target) {

@@ -554,7 +559,8 @@ target.appendChild(node);

this.fire('destroy');
this.set = this.get = noop;
this.set = noop;
if (detach !== false) this._fragment.u();
this._fragment.d();
this._fragment = this._state = null;
this._fragment = null;
this._state = {};
}

@@ -714,2 +720,2 @@

export { blankObject, destroy, destroyDev, _differs, _differsImmutable, fire, get, init, on, run, set, _set, setDev, callAll, _mount, _unmount, isPromise, PENDING, SUCCESS, FAILURE, removeFromStore, proto, protoDev, appendNode, insertNode, detachNode, detachBetween, detachBefore, detachAfter, reinsertBetween, reinsertChildren, reinsertAfter, reinsertBefore, destroyEach, createFragment, createElement, createSvgElement, createText, createComment, addListener, removeListener, setAttribute, setAttributes, removeAttribute, setXlinkAttribute, getBindingGroupValue, toNumber, timeRangesToArray, children, claimElement, claimText, setInputType, setStyle, selectOption, selectOptions, selectValue, selectMultipleValue, destroyBlock, outroAndDestroyBlock, updateKeyedEach, getSpreadUpdate, linear, generateRule, hash, wrapTransition, transitionManager, noop, assign };
export { blankObject, destroy, destroyDev, _differs, _differsImmutable, fire, get, init, on, run, set, _set, setDev, callAll, _mount, _unmount, isPromise, PENDING, SUCCESS, FAILURE, removeFromStore, proto, protoDev, appendNode, insertNode, detachNode, detachBetween, detachBefore, detachAfter, reinsertBetween, reinsertChildren, reinsertAfter, reinsertBefore, destroyEach, createFragment, createElement, createSvgElement, createText, createComment, addListener, removeListener, setAttribute, setAttributes, removeAttribute, setXlinkAttribute, getBindingGroupValue, toNumber, timeRangesToArray, children, claimElement, claimText, setInputType, setStyle, selectOption, selectOptions, selectValue, selectMultipleValue, destroyBlock, outroAndDestroyBlock, updateKeyedEach, getSpreadUpdate, linear, generateRule, hash, wrapTransition, transitionManager, noop, assign, assignTrue };

@@ -7,3 +7,3 @@ 'use strict';

let compileOptions = {
var compileOptions = {
extensions: ['.html']

@@ -31,3 +31,3 @@ };

require.extensions[extension] = function(module, filename) {
const name = path.basename(filename)
var name = path.basename(filename)
.slice(0, -path.extname(filename).length)

@@ -37,3 +37,3 @@ .replace(/^\d/, '_$&')

const options = Object.assign({}, compileOptions, {
var options = Object.assign({}, compileOptions, {
filename,

@@ -40,0 +40,0 @@ name: capitalise(name),

@@ -7,205 +7,205 @@ (function (global, factory) {

function assign(tar, src) {
for (var k in src) tar[k] = src[k];
return tar;
}
function assign(tar, src) {
for (var k in src) tar[k] = src[k];
return tar;
}
function blankObject() {
return Object.create(null);
}
function blankObject() {
return Object.create(null);
}
function _differs(a, b) {
return a != a ? b == b : a !== b || ((a && typeof a === 'object') || typeof a === 'function');
}
function _differs(a, b) {
return a != a ? b == b : a !== b || ((a && typeof a === 'object') || typeof a === 'function');
}
function _differsImmutable(a, b) {
return a != a ? b == b : a !== b;
}
function _differsImmutable(a, b) {
return a != a ? b == b : a !== b;
}
function fire(eventName, data) {
var handlers =
eventName in this._handlers && this._handlers[eventName].slice();
if (!handlers) return;
function fire(eventName, data) {
var handlers =
eventName in this._handlers && this._handlers[eventName].slice();
if (!handlers) return;
for (var i = 0; i < handlers.length; i += 1) {
var handler = handlers[i];
for (var i = 0; i < handlers.length; i += 1) {
var handler = handlers[i];
if (!handler.__calling) {
handler.__calling = true;
handler.call(this, data);
handler.__calling = false;
if (!handler.__calling) {
handler.__calling = true;
handler.call(this, data);
handler.__calling = false;
}
}
}
}
function get() {
return this._state;
}
function get() {
return this._state;
}
function on(eventName, handler) {
var handlers = this._handlers[eventName] || (this._handlers[eventName] = []);
handlers.push(handler);
function on(eventName, handler) {
var handlers = this._handlers[eventName] || (this._handlers[eventName] = []);
handlers.push(handler);
return {
cancel: function() {
var index = handlers.indexOf(handler);
if (~index) handlers.splice(index, 1);
}
};
}
return {
cancel: function() {
var index = handlers.indexOf(handler);
if (~index) handlers.splice(index, 1);
}
};
}
function Store(state, options) {
this._handlers = {};
this._dependents = [];
function Store(state, options) {
this._handlers = {};
this._dependents = [];
this._computed = blankObject();
this._sortedComputedProperties = [];
this._computed = blankObject();
this._sortedComputedProperties = [];
this._state = assign({}, state);
this._differs = options && options.immutable ? _differsImmutable : _differs;
}
this._state = assign({}, state);
this._differs = options && options.immutable ? _differsImmutable : _differs;
}
assign(Store.prototype, {
_add: function(component, props) {
this._dependents.push({
component: component,
props: props
});
},
assign(Store.prototype, {
_add: function(component, props) {
this._dependents.push({
component: component,
props: props
});
},
_init: function(props) {
var state = {};
for (var i = 0; i < props.length; i += 1) {
var prop = props[i];
state['$' + prop] = this._state[prop];
}
return state;
},
_init: function(props) {
var state = {};
for (var i = 0; i < props.length; i += 1) {
var prop = props[i];
state['$' + prop] = this._state[prop];
}
return state;
},
_remove: function(component) {
var i = this._dependents.length;
while (i--) {
if (this._dependents[i].component === component) {
this._dependents.splice(i, 1);
return;
_remove: function(component) {
var i = this._dependents.length;
while (i--) {
if (this._dependents[i].component === component) {
this._dependents.splice(i, 1);
return;
}
}
}
},
},
_sortComputedProperties: function() {
var computed = this._computed;
var sorted = this._sortedComputedProperties = [];
var cycles;
var visited = blankObject();
_sortComputedProperties: function() {
var computed = this._computed;
var sorted = this._sortedComputedProperties = [];
var cycles;
var visited = blankObject();
function visit(key) {
if (cycles[key]) {
throw new Error('Cyclical dependency detected');
}
function visit(key) {
if (cycles[key]) {
throw new Error('Cyclical dependency detected');
}
if (visited[key]) return;
visited[key] = true;
if (visited[key]) return;
visited[key] = true;
var c = computed[key];
var c = computed[key];
if (c) {
cycles[key] = true;
c.deps.forEach(visit);
sorted.push(c);
if (c) {
cycles[key] = true;
c.deps.forEach(visit);
sorted.push(c);
}
}
}
for (var key in this._computed) {
cycles = blankObject();
visit(key);
}
},
for (var key in this._computed) {
cycles = blankObject();
visit(key);
}
},
compute: function(key, deps, fn) {
var store = this;
var value;
compute: function(key, deps, fn) {
var store = this;
var value;
var c = {
deps: deps,
update: function(state, changed, dirty) {
var values = deps.map(function(dep) {
if (dep in changed) dirty = true;
return state[dep];
});
var c = {
deps: deps,
update: function(state, changed, dirty) {
var values = deps.map(function(dep) {
if (dep in changed) dirty = true;
return state[dep];
});
if (dirty) {
var newValue = fn.apply(null, values);
if (store._differs(newValue, value)) {
value = newValue;
changed[key] = true;
state[key] = value;
if (dirty) {
var newValue = fn.apply(null, values);
if (store._differs(newValue, value)) {
value = newValue;
changed[key] = true;
state[key] = value;
}
}
}
}
};
};
c.update(this._state, {}, true);
c.update(this._state, {}, true);
this._computed[key] = c;
this._sortComputedProperties();
},
this._computed[key] = c;
this._sortComputedProperties();
},
fire: fire,
fire: fire,
get: get,
get: get,
on: on,
on: on,
set: function(newState) {
var oldState = this._state,
changed = this._changed = {},
dirty = false;
set: function(newState) {
var oldState = this._state,
changed = this._changed = {},
dirty = false;
for (var key in newState) {
if (this._computed[key]) throw new Error("'" + key + "' is a read-only property");
if (this._differs(newState[key], oldState[key])) changed[key] = dirty = true;
}
if (!dirty) return;
for (var key in newState) {
if (this._computed[key]) throw new Error("'" + key + "' is a read-only property");
if (this._differs(newState[key], oldState[key])) changed[key] = dirty = true;
}
if (!dirty) return;
this._state = assign(assign({}, oldState), newState);
this._state = assign(assign({}, oldState), newState);
for (var i = 0; i < this._sortedComputedProperties.length; i += 1) {
this._sortedComputedProperties[i].update(this._state, changed);
}
for (var i = 0; i < this._sortedComputedProperties.length; i += 1) {
this._sortedComputedProperties[i].update(this._state, changed);
}
this.fire('state', {
changed: changed,
current: this._state,
previous: oldState
});
this.fire('state', {
changed: changed,
current: this._state,
previous: oldState
});
var dependents = this._dependents.slice(); // guard against mutations
for (var i = 0; i < dependents.length; i += 1) {
var dependent = dependents[i];
var componentState = {};
dirty = false;
var dependents = this._dependents.slice(); // guard against mutations
for (var i = 0; i < dependents.length; i += 1) {
var dependent = dependents[i];
var componentState = {};
dirty = false;
for (var j = 0; j < dependent.props.length; j += 1) {
var prop = dependent.props[j];
if (prop in changed) {
componentState['$' + prop] = this._state[prop];
dirty = true;
for (var j = 0; j < dependent.props.length; j += 1) {
var prop = dependent.props[j];
if (prop in changed) {
componentState['$' + prop] = this._state[prop];
dirty = true;
}
}
if (dirty) dependent.component.set(componentState);
}
if (dirty) dependent.component.set(componentState);
this.fire('update', {
changed: changed,
current: this._state,
previous: oldState
});
}
});
this.fire('update', {
changed: changed,
current: this._state,
previous: oldState
});
}
});
exports.Store = Store;
exports.Store = Store;
Object.defineProperty(exports, '__esModule', { value: true });
Object.defineProperty(exports, '__esModule', { value: true });
})));

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

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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