opal-optimizer 0.1.7 → 0.1.8

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
  SHA256:
3
- metadata.gz: bf23005730649eb821541375811e4f3fe609b571778edc431f1027d938067c1a
4
- data.tar.gz: 68677aaf76724edbb197b204524022370f2f583e2f6f353ed89c2bc1438fd3f6
3
+ metadata.gz: 4ee7a8b44f7cab98ff99da447a9b934387c9f2e9533af55bea08edea9cd9cc22
4
+ data.tar.gz: 7de32b2e91a478e68fc89bdbaa7868b26033fe8f8dca2fcbd489b6777c7d8cbb
5
5
  SHA512:
6
- metadata.gz: 7918f4b13862e97666dc14c11e6e20cc28a25614cd297fe02f3154ba1d4f497a2a9f2c574fc623ae0d5b279d0e8c3d451ddddfbbb867aaa1d23db6076dab6a3a
7
- data.tar.gz: c983e86359e2f6d7878ff982b217febdf6f40108c16fa71b4bcd9cdbc21877d6fbea88cc208c237ad0af45c40e7acd4ea917b527260280ec3b04bba0a02df41a
6
+ metadata.gz: 54374902a29fd0e30c7599f5034ee3d993d94aa294d16899fb2fd53b9ddba19cb0c8d6d1fcc7e83179abc8ebb2e80f75244ad2331868c5fbd4acd7216e474517
7
+ data.tar.gz: da1bf3efc02c9087da38eb28e771210ba01a148565a9fb98efc0bf18451be9c3d6a3bac1e7353b2b3fb10502677b70a137be72083ffabda339b39f3bce43edb0
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## v0.1.8
2
+
3
+ * Improve interop with Sprockets when non-Opal javascripts are compiled as well
4
+
1
5
  ## v0.1.7
2
6
 
3
7
  * Opal 1.6 compatibility
@@ -7,6 +7,8 @@ module Opal; class Optimizer
7
7
  module Sprockets
8
8
  def self.call input
9
9
  Opal::Optimizer.new(input[:data]).optimize
10
+ rescue NonOpalArgumentError
11
+ input[:data]
10
12
  end
11
13
  end
12
14
 
@@ -1,5 +1,5 @@
1
1
  module Opal
2
2
  class Optimizer
3
- VERSION = "0.1.7"
3
+ VERSION = "0.1.8"
4
4
  end
5
5
  end
@@ -3,10 +3,10 @@ require "rkelly"
3
3
  require "opal/optimizer/helpers"
4
4
  require "opal/compiler"
5
5
 
6
- require "pry"
7
-
8
6
  module Opal
9
7
  class Optimizer
8
+ class NonOpalArgumentError < ArgumentError; end
9
+
10
10
  include Helpers
11
11
 
12
12
  attr_accessor :ast, :opal_version, :corelib, :corelib_source, :corelib_calls,
@@ -15,6 +15,12 @@ module Opal
15
15
  attr_accessor :exports
16
16
 
17
17
  def initialize(code, exports: "", force_corelib: true)
18
+ if force_corelib
19
+ unless code.include? "// A few conventions for the documentation of this file:"
20
+ raise NonOpalArgumentError, "A non-Opal code provided"
21
+ end
22
+ end
23
+
18
24
  @ast = parse_js(code)
19
25
 
20
26
  @corelib = @ast.value.find do |i|
@@ -0,0 +1,2 @@
1
+ require "opal/optimizer"
2
+
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: opal-optimizer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.7
4
+ version: 0.1.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - hmdne
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-11-20 00:00:00.000000000 Z
11
+ date: 2023-02-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rkelly-turbo
@@ -58,6 +58,7 @@ files:
58
58
  - bin/opal-optimizer
59
59
  - bin/setup
60
60
  - exe/opal-optimizer
61
+ - lib/opal-optimizer.rb
61
62
  - lib/opal/optimizer.rb
62
63
  - lib/opal/optimizer/helpers.rb
63
64
  - lib/opal/optimizer/sprockets.rb
@@ -88,7 +89,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
88
89
  - !ruby/object:Gem::Version
89
90
  version: '0'
90
91
  requirements: []
91
- rubygems_version: 3.3.7
92
+ rubygems_version: 3.4.6
92
93
  signing_key:
93
94
  specification_version: 4
94
95
  summary: Optimize Opal's resulting javascript code