opal-erubi 1.0.0 → 2.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +1 -0
- data/Rakefile +1 -1
- data/lib/opal/erubi/builder.rb +1 -4
- data/lib/opal/erubi/processor.rb +6 -22
- data/lib/opal/erubi/version.rb +1 -1
- data/lib/opal/erubi.rb +3 -3
- data/opal-erubi.gemspec +1 -0
- metadata +20 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5cadf4867967a859635dc70b213f9d80cae3b32cb8b55e1bfe5c62bbd8105bcc
|
4
|
+
data.tar.gz: 459de9e8cc8c3fdbc9abb5a382f2d3aadc72379298e222f75d983d6e8fc57fe2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dcd1991528f3cb4c0068cbf4610dc196d79b1ca412ed6295e72aaa3c9aa2d0621587f71881742cbbe761e10c57b576544a67e7ea838bdcba3dbc7f96f54cf762
|
7
|
+
data.tar.gz: 8293bb3f2ae2be604f61afbb34349a7437a32e39c084786387d0ff9bd52ec5cf1bff1c5637f56635df1bffb5a6c5f163f1b5012d572b342256dc489ffdf118f0
|
data/Gemfile
CHANGED
data/Rakefile
CHANGED
data/lib/opal/erubi/builder.rb
CHANGED
@@ -7,6 +7,7 @@ module Opal
|
|
7
7
|
|
8
8
|
def initialize(*args)
|
9
9
|
super
|
10
|
+
@filename = ::Opal::Compiler.module_name(@filename)
|
10
11
|
@source = prepare(@source, @filename)
|
11
12
|
end
|
12
13
|
|
@@ -21,8 +22,4 @@ module Opal
|
|
21
22
|
end
|
22
23
|
end
|
23
24
|
end
|
24
|
-
|
25
|
-
# You could do this if you wanted to reclaim "erb" extension but I'm afraid
|
26
|
-
# it may cause some problems. ERB is used for preprocessing (Opal) Ruby code.
|
27
|
-
#Builder.processors.delete(BuilderProcessors::ERBProcessor)
|
28
25
|
end
|
data/lib/opal/erubi/processor.rb
CHANGED
@@ -4,31 +4,15 @@ require 'opal-sprockets'
|
|
4
4
|
|
5
5
|
module Opal
|
6
6
|
module Erubi
|
7
|
-
class Processor <
|
8
|
-
|
9
|
-
|
10
|
-
def evaluate(context, locals, &block)
|
11
|
-
@data = Opal::Erubi.compile_erubi @data, context.logical_path.gsub(/\Atemplates\//, '')
|
7
|
+
class Processor < Opal::Sprockets::Processor
|
8
|
+
def call
|
9
|
+
@data = Opal::Erubi.compile_erubi @data, context.logical_path.sub(/#{Opal::REGEXP_START}templates\//, '')
|
12
10
|
super
|
13
11
|
end
|
14
|
-
|
15
|
-
def self.compiler_options
|
16
|
-
# otherwise would check current class `attr_accessor`s
|
17
|
-
::Opal::Processor.compiler_options
|
18
|
-
end
|
19
12
|
end
|
20
13
|
end
|
21
14
|
end
|
22
15
|
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
Opal::Sprockets.register_mime_type 'application/html+erubi'
|
27
|
-
else
|
28
|
-
if Sprockets.respond_to? :register_transformer
|
29
|
-
extra_args = [{mime_type: 'application/javascript', silence_deprecation: true}]
|
30
|
-
else
|
31
|
-
extra_args = []
|
32
|
-
end
|
33
|
-
Sprockets.register_engine '.erubi', Opal::Erubi::Processor, *extra_args
|
34
|
-
end
|
16
|
+
Sprockets.register_mime_type 'application/html+erubi', extensions: ['.erubi']
|
17
|
+
Sprockets.register_transformer 'application/html+erubi', 'application/javascript', Opal::Erubi::Processor
|
18
|
+
Opal::Sprockets.register_mime_type 'application/html+erubi'
|
data/lib/opal/erubi/version.rb
CHANGED
data/lib/opal/erubi.rb
CHANGED
@@ -5,12 +5,12 @@ require 'opal/erubi/builder'
|
|
5
5
|
|
6
6
|
#require 'opal/erubi/processor' <<< sprockets support, disabled by default
|
7
7
|
|
8
|
-
Opal.append_path File.expand_path('../../../lib-opal', __FILE__)
|
8
|
+
Opal.append_path File.expand_path('../../../lib-opal', __FILE__)
|
9
9
|
|
10
10
|
module Opal
|
11
11
|
module Erubi
|
12
12
|
def self.compile_erubi(source, path)
|
13
|
-
::Erubi::Engine.new(source.to_s,
|
13
|
+
::Erubi::Engine.new(source.to_s,
|
14
14
|
bufval: "__buf",
|
15
15
|
postamble: "_buf.join }",
|
16
16
|
escape: true,
|
@@ -18,4 +18,4 @@ module Opal
|
|
18
18
|
filename: path).src.dup
|
19
19
|
end
|
20
20
|
end
|
21
|
-
end
|
21
|
+
end
|
data/opal-erubi.gemspec
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: opal-erubi
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- hmdne
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-02-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: opal
|
@@ -30,6 +30,20 @@ dependencies:
|
|
30
30
|
- - "<"
|
31
31
|
- !ruby/object:Gem::Version
|
32
32
|
version: '2'
|
33
|
+
- !ruby/object:Gem::Dependency
|
34
|
+
name: opal-sprockets
|
35
|
+
requirement: !ruby/object:Gem::Requirement
|
36
|
+
requirements:
|
37
|
+
- - ">="
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
version: 0.5.0
|
40
|
+
type: :runtime
|
41
|
+
prerelease: false
|
42
|
+
version_requirements: !ruby/object:Gem::Requirement
|
43
|
+
requirements:
|
44
|
+
- - ">="
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: 0.5.0
|
33
47
|
- !ruby/object:Gem::Dependency
|
34
48
|
name: erubi
|
35
49
|
requirement: !ruby/object:Gem::Requirement
|
@@ -115,7 +129,7 @@ homepage: https://github.com/hmdne/opal-erubi
|
|
115
129
|
licenses:
|
116
130
|
- MIT
|
117
131
|
metadata: {}
|
118
|
-
post_install_message:
|
132
|
+
post_install_message:
|
119
133
|
rdoc_options: []
|
120
134
|
require_paths:
|
121
135
|
- lib
|
@@ -130,8 +144,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
130
144
|
- !ruby/object:Gem::Version
|
131
145
|
version: '0'
|
132
146
|
requirements: []
|
133
|
-
rubygems_version: 3.
|
134
|
-
signing_key:
|
147
|
+
rubygems_version: 3.4.6
|
148
|
+
signing_key:
|
135
149
|
specification_version: 4
|
136
150
|
summary: Run Erubi templates client-side with Opal
|
137
151
|
test_files: []
|