babel-source 5.6.6 → 5.6.7

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.
Files changed (4) hide show
  1. checksums.yaml +8 -8
  2. data/lib/babel.js +52 -30
  3. data/lib/babel/source.rb +2 -2
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- OTk5MzQzMGY1NTAwZjE0ODc3MjAyZmVkNjc4NDI1ZDVlNjlhNWIzYg==
4
+ ZmJhMWY5OGYzYzU4ZjgyZDE3ZjkyODc2ZjUwZDZjZDM4ZTkxYzU0Nw==
5
5
  data.tar.gz: !binary |-
6
- OWFiYTI3MWEwOGY5NGEyYTQ3YzFjNTQwNmI1NGU4ZjdjYmJmYmE3OA==
6
+ MjljN2QyY2RiYzljMThlYTU5MzFlOTNmMDI3NWM4YzY0ZjZkNWU5Yg==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- ODljOWQxNWIxMzI2Y2VlNWU5NDc3NDMxNmFhZWQ2OTYzNTU4MGJjNzNmNGQ1
10
- YWViZDcxMWEzY2VkZmM5ZGEyNjRhMWIwOWYyNjk1ODMxM2QxNTkxOTA5NGEy
11
- NWEyZGY5ZDQxYTc3YzJmNGYxMmZjNTg0ODIyYjgyZWY4YzQ1YjY=
9
+ NmU0ODBlNTNlZDBlMTVjNjg3MTk5ZjY1NzVmM2U5YzkwM2U1OTEwMTJmZDFj
10
+ Y2JhNDFkOWYyZDE3ODJiNGFlZDc0ZWEwMDBiMGJjYTc3NTJkNGYyYTI2MGMy
11
+ YzY1NDVmODIzYzE4NTEwM2JjMjM3Yjk5ZDRiOWMyNGQ5YjA5Yjc=
12
12
  data.tar.gz: !binary |-
13
- MGZlZTRhZDllYWM4MWE3MTc2NjVjZjI0NjIyNGFkNTRiMjIyMjNhMGU4NWQ4
14
- YjI3ZTJmMjNhMjQ2NDI4MWY3ZWQ2Y2ZiMDkyYmRkNDc3Y2U2ZmU4MzY1ZWRj
15
- MTY2NWM5ODdkNGYzZjE2MTE1MWZlNTMyY2RlMzY1YjQ3OWMxNTI=
13
+ Mjk4ZmY4YWM3NjBlMDM3NWYwZTgyNGU0YjdjZTVkYmNhMjZiZmQ0YTczMDEw
14
+ ZDIwMjM2ODBhYjA4MjJhNTdkODA0ODI5Y2FkYTFiYTZmNmMxYmIwNjlhZTBm
15
+ YzFlZTBhN2Q2NzRkZjEyZjI1MjQ2YjBhZTczYWJiNmUyY2E0MzU=
@@ -8939,6 +8939,8 @@ var _debugNode2 = _interopRequireDefault(_debugNode);
8939
8939
  var verboseDebug = _debugNode2["default"]("babel:verbose");
8940
8940
  var generalDebug = _debugNode2["default"]("babel");
8941
8941
 
8942
+ var seenDeprecatedMessages = [];
8943
+
8942
8944
  var Logger = (function () {
8943
8945
  function Logger(file, filename) {
8944
8946
  _classCallCheck(this, Logger);
@@ -8964,9 +8966,17 @@ var Logger = (function () {
8964
8966
  };
8965
8967
 
8966
8968
  Logger.prototype.deprecate = function deprecate(msg) {
8967
- if (!this.file.opts.suppressDeprecationMessages) {
8968
- console.error(this._buildMessage(msg));
8969
- }
8969
+ if (this.file.opts.suppressDeprecationMessages) return;
8970
+
8971
+ msg = this._buildMessage(msg);
8972
+
8973
+ // already seen this message
8974
+ if (seenDeprecatedMessages.indexOf(msg) >= 0) return;
8975
+
8976
+ // make sure we don't see it again
8977
+ seenDeprecatedMessages.push(msg);
8978
+
8979
+ console.error(msg);
8970
8980
  };
8971
8981
 
8972
8982
  Logger.prototype.verbose = function verbose(msg) {
@@ -13057,6 +13067,7 @@ var hoistVarDeclarationsVisitor = {
13057
13067
  } else if (this.isFor()) {
13058
13068
  if (isVar(node.left, node)) {
13059
13069
  node.left = node.left.declarations[0].id;
13070
+ self.pushDeclar(node.left);
13060
13071
  }
13061
13072
  } else if (isVar(node, parent)) {
13062
13073
  return self.pushDeclar(node).map(t.expressionStatement);
@@ -15345,40 +15356,31 @@ var _types = require("../../../types");
15345
15356
  var t = _interopRequireWildcard(_types);
15346
15357
 
15347
15358
  function loose(node, body, objId) {
15348
- for (var i = 0; i < node.properties.length; i++) {
15349
- var prop = node.properties[i];
15359
+ var _arr = node.properties;
15360
+
15361
+ for (var _i = 0; _i < _arr.length; _i++) {
15362
+ var prop = _arr[_i];
15363
+ if (!prop) continue;
15350
15364
 
15351
15365
  body.push(t.expressionStatement(t.assignmentExpression("=", t.memberExpression(objId, prop.key, prop.computed || t.isLiteral(prop.key)), prop.value)));
15352
15366
  }
15353
15367
  }
15354
15368
 
15355
15369
  function spec(node, body, objId, initProps, file) {
15356
- var props = node.properties;
15357
-
15358
- // add all non-computed properties and `__proto__` properties to the initializer
15359
-
15360
- var broken = false;
15361
-
15362
- for (var i = 0; i < props.length; i++) {
15363
- var prop = props[i];
15364
-
15365
- if (prop.computed) {
15366
- broken = true;
15367
- }
15368
-
15369
- if (prop.kind !== "init" || !broken || t.isLiteral(t.toComputedKey(prop, prop.key), { value: "__proto__" })) {
15370
- initProps.push(prop);
15371
- props[i] = null;
15372
- }
15373
- }
15374
-
15375
15370
  // add a simple assignment for all Symbol member expressions due to symbol polyfill limitations
15376
15371
  // otherwise use Object.defineProperty
15377
15372
 
15378
- for (var i = 0; i < props.length; i++) {
15379
- var prop = props[i];
15373
+ var _arr2 = node.properties;
15374
+ for (var _i2 = 0; _i2 < _arr2.length; _i2++) {
15375
+ var prop = _arr2[_i2];
15380
15376
  if (!prop) continue;
15381
15377
 
15378
+ // this wont work with Object.defineProperty
15379
+ if (t.isLiteral(t.toComputedKey(prop), { value: "__proto__" })) {
15380
+ initProps.push(prop);
15381
+ continue;
15382
+ }
15383
+
15382
15384
  var key = prop.key;
15383
15385
  if (t.isIdentifier(key) && !prop.computed) {
15384
15386
  key = t.literal(key.name);
@@ -15406,16 +15408,35 @@ var visitor = {
15406
15408
  exit: function exit(node, parent, scope, file) {
15407
15409
  var hasComputed = false;
15408
15410
 
15409
- var _arr = node.properties;
15410
- for (var _i = 0; _i < _arr.length; _i++) {
15411
- var prop = _arr[_i];
15411
+ var _arr3 = node.properties;
15412
+ for (var _i3 = 0; _i3 < _arr3.length; _i3++) {
15413
+ var prop = _arr3[_i3];
15412
15414
  hasComputed = t.isProperty(prop, { computed: true, kind: "init" });
15413
15415
  if (hasComputed) break;
15414
15416
  }
15415
15417
 
15416
15418
  if (!hasComputed) return;
15417
15419
 
15420
+ // put all getters/setters into the first object expression as well as all initialisers up
15421
+ // to the first computed property
15422
+
15418
15423
  var initProps = [];
15424
+ var stopInits = false;
15425
+
15426
+ for (var i = 0; i < node.properties.length; i++) {
15427
+ var prop = node.properties[i];
15428
+ if (prop.computed) {
15429
+ stopInits = true;
15430
+ }
15431
+
15432
+ if (prop.kind !== "init" || !stopInits) {
15433
+ initProps.push(prop);
15434
+ node.properties[i] = null;
15435
+ }
15436
+ }
15437
+
15438
+ //
15439
+
15419
15440
  var objId = scope.generateUidIdentifierBasedOnNode(parent);
15420
15441
 
15421
15442
  //
@@ -20996,6 +21017,7 @@ function replaceWith(replacement, whateverAllowed) {
20996
21017
 
20997
21018
  if (typeof replacement === "string") {
20998
21019
  if (whateverAllowed) {
21020
+ this.hub.file.log.deprecate("Returning a string from a visitor method will be removed in the future. String " + "building is NOT a substitute for AST generation. String building leads to " + "terrible performance due to the additional parsing overhead and will lead to " + "extremely brittle transformers. For those extreme cases where you're dealing " + "with strings from a foreign source you may continue to use " + "`path.replaceWithSourceString(code)`. Please don't abuse this. Bad plugins " + "hurt the ecosystem.");
20999
21021
  return this.replaceWithSourceString(replacement);
21000
21022
  } else {
21001
21023
  throw new Error("Don't use `path.replaceWith()` with a string, use `path.replaceWithSourceString()`");
@@ -62992,7 +63014,7 @@ module.exports = function (str) {
62992
63014
  module.exports={
62993
63015
  "name": "babel-core",
62994
63016
  "description": "A compiler for writing next generation JavaScript",
62995
- "version": "5.6.6",
63017
+ "version": "5.6.7",
62996
63018
  "author": "Sebastian McKenzie <sebmck@gmail.com>",
62997
63019
  "homepage": "https://babeljs.io/",
62998
63020
  "license": "MIT",
@@ -1,7 +1,7 @@
1
1
  module Babel
2
2
  module Source
3
- VERSION = "5.6.6"
4
- DATE = Time.at(1435184864)
3
+ VERSION = "5.6.7"
4
+ DATE = Time.at(1435202272)
5
5
  PATH = File.expand_path("../..", __FILE__)
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: babel-source
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.6.6
4
+ version: 5.6.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sebastian McKenzie
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-06-24 00:00:00.000000000 Z
11
+ date: 2015-06-25 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description:
14
14
  email: sebmck@gmail.com