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

svelte

Package Overview
Dependencies
Maintainers
3
Versions
777
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 1.22.1 to 1.22.2

5

CHANGELOG.md
# Svelte changelog
## 1.22.2
* Escape template strings correctly in SSR output ([#616](https://github.com/sveltejs/svelte/issues/616))
* Prevent magic-string deprecation warning ([#617](https://github.com/sveltejs/svelte/pull/617))
## 1.22.1

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

6

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

@@ -26,3 +26,4 @@ "main": "compiler/svelte.js",

"pretest": "npm run build",
"prepublish": "npm run build && npm run lint"
"prepublish": "npm run build && npm run lint",
"prettier": "prettier --use-tabs --single-quote --trailing-comma es5 --write \"src/**/*.ts\""
},

@@ -74,2 +75,3 @@ "repository": {

"nyc": "^10.0.0",
"prettier": "^1.4.1",
"reify": "^0.4.4",

@@ -76,0 +78,0 @@ "rollup": "^0.39.0",

@@ -1,8 +0,11 @@

function noop () {}
function noop() {}
function assign ( target ) {
var k, source, i = 1, len = arguments.length;
for ( ; i < len; i++ ) {
function assign(target) {
var k,
source,
i = 1,
len = arguments.length;
for (; i < len; i++) {
source = arguments[i];
for ( k in source ) target[k] = source[k];
for (k in source) target[k] = source[k];
}

@@ -13,17 +16,17 @@

function appendNode ( node, target ) {
target.appendChild( node );
function appendNode(node, target) {
target.appendChild(node);
}
function insertNode ( node, target, anchor ) {
target.insertBefore( node, anchor );
function insertNode(node, target, anchor) {
target.insertBefore(node, anchor);
}
function detachNode ( node ) {
node.parentNode.removeChild( node );
function detachNode(node) {
node.parentNode.removeChild(node);
}
function detachBetween ( before, after ) {
while ( before.nextSibling && before.nextSibling !== after ) {
before.parentNode.removeChild( before.nextSibling );
function detachBetween(before, after) {
while (before.nextSibling && before.nextSibling !== after) {
before.parentNode.removeChild(before.nextSibling);
}

@@ -33,44 +36,44 @@ }

// TODO this is out of date
function destroyEach ( iterations, detach, start ) {
for ( var i = start; i < iterations.length; i += 1 ) {
if ( iterations[i] ) iterations[i].destroy( detach );
function destroyEach(iterations, detach, start) {
for (var i = start; i < iterations.length; i += 1) {
if (iterations[i]) iterations[i].destroy(detach);
}
}
function createElement ( name ) {
return document.createElement( name );
function createElement(name) {
return document.createElement(name);
}
function createSvgElement ( name ) {
return document.createElementNS( 'http://www.w3.org/2000/svg', name );
function createSvgElement(name) {
return document.createElementNS('http://www.w3.org/2000/svg', name);
}
function createText ( data ) {
return document.createTextNode( data );
function createText(data) {
return document.createTextNode(data);
}
function createComment () {
return document.createComment( '' );
function createComment() {
return document.createComment('');
}
function addEventListener ( node, event, handler ) {
node.addEventListener( event, handler, false );
function addEventListener(node, event, handler) {
node.addEventListener(event, handler, false);
}
function removeEventListener ( node, event, handler ) {
node.removeEventListener( event, handler, false );
function removeEventListener(node, event, handler) {
node.removeEventListener(event, handler, false);
}
function setAttribute ( node, attribute, value ) {
node.setAttribute( attribute, value );
function setAttribute(node, attribute, value) {
node.setAttribute(attribute, value);
}
function setXlinkAttribute ( node, attribute, value ) {
node.setAttributeNS( 'http://www.w3.org/1999/xlink', attribute, value );
function setXlinkAttribute(node, attribute, value) {
node.setAttributeNS('http://www.w3.org/1999/xlink', attribute, value);
}
function getBindingGroupValue ( group ) {
function getBindingGroupValue(group) {
var value = [];
for ( var i = 0; i < group.length; i += 1 ) {
if ( group[i].checked ) value.push( group[i].__value );
for (var i = 0; i < group.length; i += 1) {
if (group[i].checked) value.push(group[i].__value);
}

@@ -80,35 +83,45 @@ return value;

function toNumber ( value ) {
function toNumber(value) {
return value === '' ? undefined : +value;
}
function linear ( t ) {
function linear(t) {
return t;
}
function generateKeyframes ( a, b, delta, duration, ease, fn, node, style ) {
var id = '__svelte' + ~~( Math.random() * 1e9 ); // TODO make this more robust
function generateKeyframes(
a,
b,
delta,
duration,
ease,
fn,
node,
style
) {
var id = '__svelte' + ~~(Math.random() * 1e9); // TODO make this more robust
var keyframes = '@keyframes ' + id + '{\n';
for ( var p = 0; p <= 1; p += 16.666 / duration ) {
var t = a + delta * ease( p );
keyframes += ( p * 100 ) + '%{' + fn( t ) + '}\n';
for (var p = 0; p <= 1; p += 16.666 / duration) {
var t = a + delta * ease(p);
keyframes += p * 100 + '%{' + fn(t) + '}\n';
}
keyframes += '100% {' + fn( b ) + '}\n}';
keyframes += '100% {' + fn(b) + '}\n}';
style.textContent += keyframes;
document.head.appendChild( style );
document.head.appendChild(style);
node.style.animation = ( node.style.animation || '' ).split( ',' )
.filter( function ( anim ) {
node.style.animation = (node.style.animation || '')
.split(',')
.filter(function(anim) {
// when introing, discard old animations if there are any
return anim && ( delta < 0 || !/__svelte/.test( anim ) );
return anim && (delta < 0 || !/__svelte/.test(anim));
})
.concat( id + ' ' + duration + 'ms linear 1 forwards' )
.join( ', ' );
.concat(id + ' ' + duration + 'ms linear 1 forwards')
.join(', ');
}
function wrapTransition ( node, fn, params, intro, outgroup ) {
var obj = fn( node, params );
function wrapTransition(node, fn, params, intro, outgroup) {
var obj = fn(node, params);
var duration = obj.duration || 300;

@@ -119,13 +132,13 @@ var ease = obj.easing || linear;

// TODO share <style> tag between all transitions?
if ( obj.css ) {
var style = document.createElement( 'style' );
if (obj.css) {
var style = document.createElement('style');
}
if ( intro ) {
if ( obj.css && obj.delay ) {
if (intro) {
if (obj.css && obj.delay) {
cssText = node.style.cssText;
node.style.cssText += obj.css( 0 );
node.style.cssText += obj.css(0);
}
if ( obj.tick ) obj.tick( 0 );
if (obj.tick) obj.tick(0);
}

@@ -138,5 +151,5 @@

pending: null,
run: function ( intro, callback ) {
run: function(intro, callback) {
var program = {
start: window.performance.now() + ( obj.delay || 0 ),
start: window.performance.now() + (obj.delay || 0),
intro: intro,

@@ -146,23 +159,32 @@ callback: callback

if ( obj.delay ) {
if (obj.delay) {
this.pending = program;
} else {
this.start( program );
this.start(program);
}
if ( !this.running ) {
if (!this.running) {
this.running = true;
transitionManager.add( this );
transitionManager.add(this);
}
},
start: function ( program ) {
start: function(program) {
program.a = this.t;
program.b = program.intro ? 1 : 0;
program.delta = program.b - program.a;
program.duration = duration * Math.abs( program.b - program.a );
program.duration = duration * Math.abs(program.b - program.a);
program.end = program.start + program.duration;
if ( obj.css ) {
if ( obj.delay ) node.style.cssText = cssText;
generateKeyframes( program.a, program.b, program.delta, program.duration, ease, obj.css, node, style );
if (obj.css) {
if (obj.delay) node.style.cssText = cssText;
generateKeyframes(
program.a,
program.b,
program.delta,
program.duration,
ease,
obj.css,
node,
style
);
}

@@ -173,14 +195,14 @@

},
update: function ( now ) {
update: function(now) {
var program = this.program;
if ( !program ) return;
if (!program) return;
var p = now - program.start;
this.t = program.a + program.delta * ease( p / program.duration );
if ( obj.tick ) obj.tick( this.t );
this.t = program.a + program.delta * ease(p / program.duration);
if (obj.tick) obj.tick(this.t);
},
done: function () {
done: function() {
this.t = this.program.b;
if ( obj.tick ) obj.tick( this.t );
if ( obj.css ) document.head.removeChild( style );
if (obj.tick) obj.tick(this.t);
if (obj.css) document.head.removeChild(style);
this.program.callback();

@@ -190,5 +212,5 @@ this.program = null;

},
abort: function () {
if ( obj.tick ) obj.tick( 1 );
if ( obj.css ) document.head.removeChild( style );
abort: function() {
if (obj.tick) obj.tick(1);
if (obj.css) document.head.removeChild(style);
this.program = this.pending = null;

@@ -205,6 +227,6 @@ this.running = false;

add: function ( transition ) {
this.transitions.push( transition );
add: function(transition) {
this.transitions.push(transition);
if ( !this.running ) {
if (!this.running) {
this.running = true;

@@ -215,3 +237,3 @@ this.next();

next: function () {
next: function() {
this.running = false;

@@ -222,23 +244,23 @@

while ( i-- ) {
while (i--) {
var transition = this.transitions[i];
if ( transition.program && now >= transition.program.end ) {
if (transition.program && now >= transition.program.end) {
transition.done();
}
if ( transition.pending && now >= transition.pending.start ) {
transition.start( transition.pending );
if (transition.pending && now >= transition.pending.start) {
transition.start(transition.pending);
}
if ( transition.running ) {
transition.update( now );
if (transition.running) {
transition.update(now);
this.running = true;
} else if ( !transition.pending ) {
this.transitions.splice( i, 1 );
} else if (!transition.pending) {
this.transitions.splice(i, 1);
}
}
if ( this.running ) {
requestAnimationFrame( this.bound || ( this.bound = this.next.bind( this ) ) );
if (this.running) {
requestAnimationFrame(this.bound || (this.bound = this.next.bind(this)));
}

@@ -248,23 +270,23 @@ }

function differs ( a, b ) {
return ( a !== b ) || ( a && ( typeof a === 'object' ) || ( typeof a === 'function' ) );
function differs(a, b) {
return a !== b || ((a && typeof a === 'object') || typeof a === 'function');
}
function dispatchObservers ( component, group, newState, oldState ) {
for ( var key in group ) {
if ( !( key in newState ) ) continue;
function dispatchObservers(component, group, newState, oldState) {
for (var key in group) {
if (!(key in newState)) continue;
var newValue = newState[ key ];
var oldValue = oldState[ key ];
var newValue = newState[key];
var oldValue = oldState[key];
if ( differs( newValue, oldValue ) ) {
var callbacks = group[ key ];
if ( !callbacks ) continue;
if (differs(newValue, oldValue)) {
var callbacks = group[key];
if (!callbacks) continue;
for ( var i = 0; i < callbacks.length; i += 1 ) {
for (var i = 0; i < callbacks.length; i += 1) {
var callback = callbacks[i];
if ( callback.__calling ) continue;
if (callback.__calling) continue;
callback.__calling = true;
callback.call( component, newValue, oldValue );
callback.call(component, newValue, oldValue);
callback.__calling = false;

@@ -276,23 +298,26 @@ }

function get ( key ) {
return key ? this._state[ key ] : this._state;
function get(key) {
return key ? this._state[key] : this._state;
}
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 ) {
handlers[i].call( this, data );
for (var i = 0; i < handlers.length; i += 1) {
handlers[i].call(this, data);
}
}
function observe ( key, callback, options ) {
var group = ( options && options.defer ) ? this._observers.post : this._observers.pre;
function observe(key, callback, options) {
var group = options && options.defer
? this._observers.post
: this._observers.pre;
( group[ key ] || ( group[ key ] = [] ) ).push( callback );
(group[key] || (group[key] = [])).push(callback);
if ( !options || options.init !== false ) {
if (!options || options.init !== false) {
callback.__calling = true;
callback.call( this, this._state[ key ] );
callback.call(this, this._state[key]);
callback.__calling = false;

@@ -302,5 +327,5 @@ }

return {
cancel: function () {
var index = group[ key ].indexOf( callback );
if ( ~index ) group[ key ].splice( index, 1 );
cancel: function() {
var index = group[key].indexOf(callback);
if (~index) group[key].splice(index, 1);
}

@@ -310,24 +335,26 @@ };

function observeDev ( key, callback, options ) {
var c = ( key = '' + key ).search( /[^\w]/ );
if ( c > -1 ) {
var message = "The first argument to component.observe(...) must be the name of a top-level property";
if ( c > 0 ) message += ", i.e. '" + key.slice( 0, c ) + "' rather than '" + key + "'";
function observeDev(key, callback, options) {
var c = (key = '' + key).search(/[^\w]/);
if (c > -1) {
var message =
'The first argument to component.observe(...) must be the name of a top-level property';
if (c > 0)
message += ", i.e. '" + key.slice(0, c) + "' rather than '" + key + "'";
throw new Error( message );
throw new Error(message);
}
return observe.call( this, key, callback, options );
return observe.call(this, key, callback, options);
}
function on ( eventName, handler ) {
if ( eventName === 'teardown' ) return this.on( 'destroy', handler );
function on(eventName, handler) {
if (eventName === 'teardown') return this.on('destroy', handler);
var handlers = this._handlers[ eventName ] || ( this._handlers[ eventName ] = [] );
handlers.push( 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 );
cancel: function() {
var index = handlers.indexOf(handler);
if (~index) handlers.splice(index, 1);
}

@@ -337,20 +364,22 @@ };

function onDev ( eventName, handler ) {
if ( eventName === 'teardown' ) {
console.warn( "Use component.on('destroy', ...) instead of component.on('teardown', ...) which has been deprecated and will be unsupported in Svelte 2" );
return this.on( 'destroy', handler );
function onDev(eventName, handler) {
if (eventName === 'teardown') {
console.warn(
"Use component.on('destroy', ...) instead of component.on('teardown', ...) which has been deprecated and will be unsupported in Svelte 2"
);
return this.on('destroy', handler);
}
return on.call( this, eventName, handler );
return on.call(this, eventName, handler);
}
function set ( newState ) {
this._set( assign( {}, newState ) );
function set(newState) {
this._set(assign({}, newState));
this._root._flush();
}
function _flush () {
if ( !this._renderHooks ) return;
function _flush() {
if (!this._renderHooks) return;
while ( this._renderHooks.length ) {
while (this._renderHooks.length) {
this._renderHooks.pop()();

@@ -357,0 +386,0 @@ }

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

function capitalise ( name ) {
return name[0].toUpperCase() + name.slice( 1 );
function capitalise(name) {
return name[0].toUpperCase() + name.slice(1);
}
require.extensions[ '.html' ] = function ( module, filename ) {
var ref = ___compiler_svelte_js.compile( fs.readFileSync( filename, 'utf-8' ), {
require.extensions['.html'] = function(module, filename) {
var ref = ___compiler_svelte_js.compile(fs.readFileSync(filename, 'utf-8'), {
filename,
name: capitalise( path.basename( filename ).replace( /\.html$/, '' ) ),
name: capitalise(path.basename(filename).replace(/\.html$/, '')),
generate: 'ssr'

@@ -20,4 +20,4 @@ });

return module._compile( code, filename );
return module._compile(code, filename);
};
//# sourceMappingURL=register.js.map

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