sprockets-es6 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: cf08868785e7ddde2ba480c2841923057fd9318b
4
- data.tar.gz: 92cc1dfc9bf93141e701377dd62c9b39fb7da235
3
+ metadata.gz: 5bf0c0e0db08ba61dc723093a37cedf1563c2fa5
4
+ data.tar.gz: 5bfacde8d667d0e4746aa1600b858063cb789977
5
5
  SHA512:
6
- metadata.gz: a97e1f3be566c79121098c236c3574fbbc7aa52f988a40cf5de798d1e5afbc979d98bd4393f473ef15ed33764fbc9ee277e4f3680f73f4d424f00cbe48c6bca5
7
- data.tar.gz: 15190a70ffcca0aedb7190cb3e5c98cfc95f71ea1ad4691201e6578d46a2f7c7d86b1a6a93873bc6b39a14ab13e59508add9d7a7bc94ecd366c7319f93882eb4
6
+ metadata.gz: 3c202b33c3466523de2fd958bd7f961fd42adf8d4be326e7ef4c47ee0bd8700c8c35e690d5c1b4e8f51106ea1063d2797174c788352ce389810fe02a81e64a4c
7
+ data.tar.gz: 0388841eabe6ef52c92c8b79e0bd0ec529e299ccd3dc557380ccbf3fbaeb4bad5bc1f4376499abb308dc99a415cce2b8d632eed1371aae4d468082cc7af8567c
data/README.md CHANGED
@@ -4,12 +4,19 @@ A Sprockets transformer that converts ES6 code into vanilla ES5 with [6to5](http
4
4
 
5
5
  ## Usage
6
6
 
7
+ ``` ruby
8
+ # Gemfile
9
+ gem 'sprockets'
10
+ gem 'sprockets-es6'
11
+ ```
12
+
13
+
7
14
  ``` ruby
8
15
  require 'sprockets/es6'
9
16
  ```
10
17
 
11
18
  ``` js
12
- # app.es6
19
+ // app.es6
13
20
 
14
21
  square = (x) => x * x
15
22
 
@@ -19,3 +26,7 @@ class Animal {
19
26
  }
20
27
  }
21
28
  ```
29
+
30
+ ## Caveats
31
+
32
+ Requires Sprockets 3 betas.
@@ -1,4 +1,5 @@
1
1
  !function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var f;"undefined"!=typeof window?f=window:"undefined"!=typeof global?f=global:"undefined"!=typeof self&&(f=self),f.to5=e()}}(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
2
+ (function (global){
2
3
  var transform = module.exports = require("./transformation/transform");
3
4
 
4
5
  transform.transform = transform;
@@ -13,7 +14,7 @@ transform.load = function (url, callback, opts, hold) {
13
14
  opts = opts || {};
14
15
  opts.filename = opts.filename || url;
15
16
 
16
- var xhr = window.ActiveXObject ? new window.ActiveXObject("Microsoft.XMLHTTP") : new window.XMLHttpRequest();
17
+ var xhr = global.ActiveXObject ? new global.ActiveXObject("Microsoft.XMLHTTP") : new global.XMLHttpRequest();
17
18
  xhr.open("GET", url, true);
18
19
  if ("overrideMimeType" in xhr) xhr.overrideMimeType("text/plain");
19
20
 
@@ -61,7 +62,7 @@ var runScripts = function () {
61
62
  }
62
63
  };
63
64
 
64
- var _scripts = window.document.getElementsByTagName("script");
65
+ var _scripts = global.document.getElementsByTagName("script");
65
66
  for (var i in _scripts) {
66
67
  var _script = _scripts[i];
67
68
  if (types.indexOf(_script.type) >= 0) scripts.push(_script);
@@ -74,12 +75,13 @@ var runScripts = function () {
74
75
  exec();
75
76
  };
76
77
 
77
- if (window.addEventListener) {
78
- window.addEventListener("DOMContentLoaded", runScripts, false);
79
- } else {
80
- window.attachEvent("onload", runScripts);
78
+ if (global.addEventListener) {
79
+ global.addEventListener("DOMContentLoaded", runScripts, false);
80
+ } else if (global.attachEvent) {
81
+ global.attachEvent("onload", runScripts);
81
82
  }
82
83
 
84
+ }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
83
85
  },{"./transformation/transform":26}],2:[function(require,module,exports){
84
86
  module.exports = File;
85
87
 
data/lib/sprockets/es6.rb CHANGED
@@ -3,15 +3,11 @@ require 'sprockets'
3
3
 
4
4
  module Sprockets
5
5
  class ES6
6
- VERSION = '0.1.0'
6
+ VERSION = '0.1.1'
7
7
 
8
8
  def self.context
9
9
  @context ||= begin
10
10
  js = <<-JS
11
- // TODO: Patch 6to5
12
- window = global;
13
- window.attachEvent = function() {};
14
-
15
11
  #{File.read(File.expand_path("../es6/6to5.js", __FILE__))}
16
12
 
17
13
  function _transform() {
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sprockets-es6
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joshua Peek