flight-for-rails 1.4.0 → 1.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8f59894274e7f2232081a6dfd22968c2f8517af0
4
- data.tar.gz: f1fe68c6d5bd82ac478f354f177fee9c401a26a7
3
+ metadata.gz: e82302342ecb36ec039517cad38d77939f4448da
4
+ data.tar.gz: b3f1a8107db18cd3abe7ac98d52afb45e7ce4922
5
5
  SHA512:
6
- metadata.gz: 66b2828118f504bf268ef5e51be6ae0b6ab1250951b855dcea0f80754176c371ee6ec472cde8ae3d3f69283db88b5eabd69df083b45a63d32439219572e6422d
7
- data.tar.gz: 0a312a8372b8cffc039f9279de4ad8c4a29d964b5231dcb43577166062b1ced9a71bf6e5e9955b7185976148f3737e62a24f70ee913b0e77c6925312eee2cec7
6
+ metadata.gz: 4fb952989e5591bff2459f9a2b057a1657bb3b233937e822aea21d485f9036217621e4c5f835fecf5e2d10e97477801f3e62a03703f9f317530fee4732851e34
7
+ data.tar.gz: 2d68ae5407347d29823bae526b3b8b39af4cad8c98d1b51aae25a23d1f0eea776b8d0653d16c12d2b8941b83598bcd2a830aeb347b91929316efd14b72e6b1be
data/README.md CHANGED
@@ -20,7 +20,7 @@ This gem vendors Flight files and dependecies for Rails assets pipeline.
20
20
  First add the following lines to your application `Gemfile`:
21
21
 
22
22
  ``` ruby
23
- gem 'flight-for-rails', '~> 1.4.0'
23
+ gem 'flight-for-rails', '~> 1.5.0'
24
24
  ```
25
25
 
26
26
  Then run `bundle install` to update your's gems bundle.
@@ -1,5 +1,5 @@
1
1
  # This file is automatically generated.
2
2
  # Change template/version.erb if you need.
3
3
  module FlightForRails
4
- VERSION = '1.4.0'
4
+ VERSION = '1.5.0'
5
5
  end
@@ -1,4 +1,4 @@
1
- /*! Flight v1.4.0 | (c) Twitter, Inc. | MIT License */
1
+ /*! Flight v1.5.0 | (c) Twitter, Inc. | MIT License */
2
2
  (function webpackUniversalModuleDefinition(root, factory) {
3
3
  if(typeof exports === 'object' && typeof module === 'object')
4
4
  module.exports = factory();
@@ -168,6 +168,10 @@ var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* Copyright 201
168
168
  'use strict';
169
169
 
170
170
  var functionNameRegEx = /function (.*?)\s?\(/;
171
+ var ignoredMixin = {
172
+ withBase: true,
173
+ withLogging: true
174
+ };
171
175
 
172
176
  // teardown for all instances of this constructor
173
177
  function teardownAll() {
@@ -216,9 +220,8 @@ var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* Copyright 201
216
220
  // function name property not supported by this browser, use regex
217
221
  var m = mixin.toString().match(functionNameRegEx);
218
222
  return (m && m[1]) ? m[1] : '';
219
- } else {
220
- return (mixin.name != 'withBase') ? mixin.name : '';
221
223
  }
224
+ return (!ignoredMixin[mixin.name] ? mixin.name : '');
222
225
  }).filter(Boolean).join(', ');
223
226
  };
224
227
 
@@ -455,6 +458,12 @@ var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* Copyright 201
455
458
  window.DEBUG = this;
456
459
  },
457
460
 
461
+ warn: function (message) {
462
+ if (!window.console) { return; }
463
+ var fn = (console.warn || console.log);
464
+ fn.call(console, this.toString() + ': ' + message);
465
+ },
466
+
458
467
  registry: registry,
459
468
 
460
469
  find: {
@@ -1146,13 +1155,20 @@ var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* Copyright 201
1146
1155
  try {
1147
1156
  window.postMessage(data, '*');
1148
1157
  } catch (e) {
1149
- console.log('unserializable data for event',type,':',data);
1150
- throw new Error(
1151
- ['The event', type, 'on component', this.toString(), 'was triggered with non-serializable data'].join(' ')
1152
- );
1158
+ debug.warn.call(this, [
1159
+ 'Event "', type, '" was triggered with non-serializable data. ',
1160
+ 'Flight recommends you avoid passing non-serializable data in events.'
1161
+ ].join(''));
1153
1162
  }
1154
1163
  }
1155
1164
 
1165
+ function warnAboutReferenceType(key) {
1166
+ debug.warn.call(this, [
1167
+ 'Attribute "', key, '" defaults to an array or object. ',
1168
+ 'Enclose this in a function to avoid sharing between component instances.'
1169
+ ].join(''));
1170
+ }
1171
+
1156
1172
  function initAttributes(attrs) {
1157
1173
  var definedKeys = [], incomingKeys;
1158
1174
 
@@ -1166,8 +1182,7 @@ var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* Copyright 201
1166
1182
 
1167
1183
  for (var i = incomingKeys.length - 1; i >= 0; i--) {
1168
1184
  if (definedKeys.indexOf(incomingKeys[i]) == -1) {
1169
- console.warn('Passed unused attributes including "' + incomingKeys[i] +
1170
- '" to component "' + this.toString() + '".');
1185
+ debug.warn.call(this, 'Passed unused attribute "' + incomingKeys[i] + '".');
1171
1186
  break;
1172
1187
  }
1173
1188
  }
@@ -1179,6 +1194,10 @@ var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* Copyright 201
1179
1194
  throw new Error('Required attribute "' + key +
1180
1195
  '" not specified in attachTo for component "' + this.toString() + '".');
1181
1196
  }
1197
+ // Warn about reference types in attributes
1198
+ if (debug.enabled && typeof this.attr[key] === 'object') {
1199
+ warnAboutReferenceType.call(this, key);
1200
+ }
1182
1201
  } else {
1183
1202
  this.attr[key] = attrs[key];
1184
1203
  }
@@ -1198,6 +1217,10 @@ var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* Copyright 201
1198
1217
  for (var key in this.defaults) {
1199
1218
  if (!attrs.hasOwnProperty(key)) {
1200
1219
  attr[key] = this.defaults[key];
1220
+ // Warn about reference types in defaultAttrs
1221
+ if (debug.enabled && typeof this.defaults[key] === 'object') {
1222
+ warnAboutReferenceType.call(this, key);
1223
+ }
1201
1224
  }
1202
1225
  }
1203
1226
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: flight-for-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.0
4
+ version: 1.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sergey Rezvanov