giga-lite-hub 0.0.1

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 (87) hide show
  1. checksums.yaml +7 -0
  2. data/giga-lite-hub.gemspec +12 -0
  3. data/sprockets-4.2.2/CHANGELOG.md +118 -0
  4. data/sprockets-4.2.2/MIT-LICENSE +21 -0
  5. data/sprockets-4.2.2/README.md +716 -0
  6. data/sprockets-4.2.2/bin/sprockets +93 -0
  7. data/sprockets-4.2.2/lib/rake/sprocketstask.rb +157 -0
  8. data/sprockets-4.2.2/lib/sprockets/add_source_map_comment_to_asset_processor.rb +60 -0
  9. data/sprockets-4.2.2/lib/sprockets/asset.rb +212 -0
  10. data/sprockets-4.2.2/lib/sprockets/autoload/babel.rb +8 -0
  11. data/sprockets-4.2.2/lib/sprockets/autoload/closure.rb +8 -0
  12. data/sprockets-4.2.2/lib/sprockets/autoload/coffee_script.rb +8 -0
  13. data/sprockets-4.2.2/lib/sprockets/autoload/eco.rb +8 -0
  14. data/sprockets-4.2.2/lib/sprockets/autoload/ejs.rb +8 -0
  15. data/sprockets-4.2.2/lib/sprockets/autoload/jsminc.rb +8 -0
  16. data/sprockets-4.2.2/lib/sprockets/autoload/sass.rb +8 -0
  17. data/sprockets-4.2.2/lib/sprockets/autoload/sassc.rb +8 -0
  18. data/sprockets-4.2.2/lib/sprockets/autoload/uglifier.rb +8 -0
  19. data/sprockets-4.2.2/lib/sprockets/autoload/yui.rb +8 -0
  20. data/sprockets-4.2.2/lib/sprockets/autoload/zopfli.rb +7 -0
  21. data/sprockets-4.2.2/lib/sprockets/autoload.rb +16 -0
  22. data/sprockets-4.2.2/lib/sprockets/babel_processor.rb +66 -0
  23. data/sprockets-4.2.2/lib/sprockets/base.rb +147 -0
  24. data/sprockets-4.2.2/lib/sprockets/bower.rb +61 -0
  25. data/sprockets-4.2.2/lib/sprockets/bundle.rb +105 -0
  26. data/sprockets-4.2.2/lib/sprockets/cache/file_store.rb +208 -0
  27. data/sprockets-4.2.2/lib/sprockets/cache/memory_store.rb +84 -0
  28. data/sprockets-4.2.2/lib/sprockets/cache/null_store.rb +54 -0
  29. data/sprockets-4.2.2/lib/sprockets/cache.rb +271 -0
  30. data/sprockets-4.2.2/lib/sprockets/cached_environment.rb +64 -0
  31. data/sprockets-4.2.2/lib/sprockets/closure_compressor.rb +48 -0
  32. data/sprockets-4.2.2/lib/sprockets/coffee_script_processor.rb +39 -0
  33. data/sprockets-4.2.2/lib/sprockets/compressing.rb +134 -0
  34. data/sprockets-4.2.2/lib/sprockets/configuration.rb +79 -0
  35. data/sprockets-4.2.2/lib/sprockets/context.rb +305 -0
  36. data/sprockets-4.2.2/lib/sprockets/dependencies.rb +74 -0
  37. data/sprockets-4.2.2/lib/sprockets/digest_utils.rb +197 -0
  38. data/sprockets-4.2.2/lib/sprockets/directive_processor.rb +432 -0
  39. data/sprockets-4.2.2/lib/sprockets/eco_processor.rb +33 -0
  40. data/sprockets-4.2.2/lib/sprockets/ejs_processor.rb +32 -0
  41. data/sprockets-4.2.2/lib/sprockets/encoding_utils.rb +261 -0
  42. data/sprockets-4.2.2/lib/sprockets/environment.rb +46 -0
  43. data/sprockets-4.2.2/lib/sprockets/erb_processor.rb +43 -0
  44. data/sprockets-4.2.2/lib/sprockets/errors.rb +12 -0
  45. data/sprockets-4.2.2/lib/sprockets/exporters/base.rb +71 -0
  46. data/sprockets-4.2.2/lib/sprockets/exporters/file_exporter.rb +24 -0
  47. data/sprockets-4.2.2/lib/sprockets/exporters/zlib_exporter.rb +33 -0
  48. data/sprockets-4.2.2/lib/sprockets/exporters/zopfli_exporter.rb +14 -0
  49. data/sprockets-4.2.2/lib/sprockets/exporting.rb +73 -0
  50. data/sprockets-4.2.2/lib/sprockets/file_reader.rb +16 -0
  51. data/sprockets-4.2.2/lib/sprockets/http_utils.rb +135 -0
  52. data/sprockets-4.2.2/lib/sprockets/jsminc_compressor.rb +32 -0
  53. data/sprockets-4.2.2/lib/sprockets/jst_processor.rb +50 -0
  54. data/sprockets-4.2.2/lib/sprockets/loader.rb +347 -0
  55. data/sprockets-4.2.2/lib/sprockets/manifest.rb +339 -0
  56. data/sprockets-4.2.2/lib/sprockets/manifest_utils.rb +48 -0
  57. data/sprockets-4.2.2/lib/sprockets/mime.rb +96 -0
  58. data/sprockets-4.2.2/lib/sprockets/npm.rb +52 -0
  59. data/sprockets-4.2.2/lib/sprockets/path_dependency_utils.rb +77 -0
  60. data/sprockets-4.2.2/lib/sprockets/path_digest_utils.rb +48 -0
  61. data/sprockets-4.2.2/lib/sprockets/path_utils.rb +367 -0
  62. data/sprockets-4.2.2/lib/sprockets/paths.rb +82 -0
  63. data/sprockets-4.2.2/lib/sprockets/preprocessors/default_source_map.rb +49 -0
  64. data/sprockets-4.2.2/lib/sprockets/processing.rb +228 -0
  65. data/sprockets-4.2.2/lib/sprockets/processor_utils.rb +170 -0
  66. data/sprockets-4.2.2/lib/sprockets/resolve.rb +295 -0
  67. data/sprockets-4.2.2/lib/sprockets/sass_cache_store.rb +30 -0
  68. data/sprockets-4.2.2/lib/sprockets/sass_compressor.rb +63 -0
  69. data/sprockets-4.2.2/lib/sprockets/sass_functions.rb +3 -0
  70. data/sprockets-4.2.2/lib/sprockets/sass_importer.rb +3 -0
  71. data/sprockets-4.2.2/lib/sprockets/sass_processor.rb +313 -0
  72. data/sprockets-4.2.2/lib/sprockets/sassc_compressor.rb +56 -0
  73. data/sprockets-4.2.2/lib/sprockets/sassc_processor.rb +297 -0
  74. data/sprockets-4.2.2/lib/sprockets/server.rb +315 -0
  75. data/sprockets-4.2.2/lib/sprockets/source_map_processor.rb +66 -0
  76. data/sprockets-4.2.2/lib/sprockets/source_map_utils.rb +483 -0
  77. data/sprockets-4.2.2/lib/sprockets/transformers.rb +173 -0
  78. data/sprockets-4.2.2/lib/sprockets/uglifier_compressor.rb +66 -0
  79. data/sprockets-4.2.2/lib/sprockets/unloaded_asset.rb +139 -0
  80. data/sprockets-4.2.2/lib/sprockets/uri_tar.rb +99 -0
  81. data/sprockets-4.2.2/lib/sprockets/uri_utils.rb +194 -0
  82. data/sprockets-4.2.2/lib/sprockets/utils/gzip.rb +99 -0
  83. data/sprockets-4.2.2/lib/sprockets/utils.rb +210 -0
  84. data/sprockets-4.2.2/lib/sprockets/version.rb +4 -0
  85. data/sprockets-4.2.2/lib/sprockets/yui_compressor.rb +56 -0
  86. data/sprockets-4.2.2/lib/sprockets.rb +232 -0
  87. metadata +126 -0
@@ -0,0 +1,432 @@
1
+ # frozen_string_literal: true
2
+ require 'set'
3
+ require 'shellwords'
4
+
5
+ module Sprockets
6
+ # The `DirectiveProcessor` is responsible for parsing and evaluating
7
+ # directive comments in a source file.
8
+ #
9
+ # A directive comment starts with a comment prefix, followed by an "=",
10
+ # then the directive name, then any arguments.
11
+ #
12
+ # // JavaScript
13
+ # //= require "foo"
14
+ #
15
+ # # CoffeeScript
16
+ # #= require "bar"
17
+ #
18
+ # /* CSS
19
+ # *= require "baz"
20
+ # */
21
+ #
22
+ # This makes it possible to disable or modify the processor to do whatever
23
+ # you'd like. You could add your own custom directives or invent your own
24
+ # directive syntax.
25
+ #
26
+ # `Environment#processors` includes `DirectiveProcessor` by default.
27
+ #
28
+ # To remove the processor entirely:
29
+ #
30
+ # env.unregister_processor('text/css', Sprockets::DirectiveProcessor)
31
+ # env.unregister_processor('application/javascript', Sprockets::DirectiveProcessor)
32
+ #
33
+ # Then inject your own preprocessor:
34
+ #
35
+ # env.register_processor('text/css', MyProcessor)
36
+ #
37
+ class DirectiveProcessor
38
+ # Directives are denoted by a `=` followed by the name, then
39
+ # argument list.
40
+ #
41
+ # A few different styles are allowed:
42
+ #
43
+ # // =require foo
44
+ # //= require foo
45
+ # //= require "foo"
46
+ #
47
+ DIRECTIVE_PATTERN = /
48
+ ^ \W* = \s* (\w+.*?) (\*\/)? $
49
+ /x
50
+
51
+ def self.instance
52
+ # Default to C comment styles
53
+ @instance ||= new(comments: ["//", ["/*", "*/"]])
54
+ end
55
+
56
+ def self.call(input)
57
+ instance.call(input)
58
+ end
59
+
60
+ def initialize(comments: [])
61
+ @header_pattern = compile_header_pattern(Array(comments))
62
+ end
63
+
64
+ def call(input)
65
+ dup._call(input)
66
+ end
67
+
68
+ def _call(input)
69
+ @environment = input[:environment]
70
+ @uri = input[:uri]
71
+ @filename = input[:filename]
72
+ @dirname = File.dirname(@filename)
73
+ # If loading a source map file like `application.js.map` resolve
74
+ # dependencies using `.js` instead of `.js.map`
75
+ @content_type = SourceMapProcessor.original_content_type(input[:content_type], error_when_not_found: false)
76
+ @required = Set.new(input[:metadata][:required])
77
+ @stubbed = Set.new(input[:metadata][:stubbed])
78
+ @links = Set.new(input[:metadata][:links])
79
+ @dependencies = Set.new(input[:metadata][:dependencies])
80
+ @to_link = Set.new
81
+ @to_load = Set.new
82
+
83
+ data, directives = process_source(input[:data])
84
+ process_directives(directives)
85
+
86
+ {
87
+ data: data,
88
+ required: @required,
89
+ stubbed: @stubbed,
90
+ links: @links,
91
+ to_load: @to_load,
92
+ to_link: @to_link,
93
+ dependencies: @dependencies
94
+ }
95
+ end
96
+
97
+ protected
98
+ # Directives will only be picked up if they are in the header
99
+ # of the source file. C style (/* */), JavaScript (//), and
100
+ # Ruby (#) comments are supported.
101
+ #
102
+ # Directives in comments after the first non-whitespace line
103
+ # of code will not be processed.
104
+ def compile_header_pattern(comments)
105
+ re = comments.map { |c|
106
+ case c
107
+ when String
108
+ "(?:#{Regexp.escape(c)}.*\\n?)+"
109
+ when Array
110
+ "(?:#{Regexp.escape(c[0])}(?m:.*?)#{Regexp.escape(c[1])})"
111
+ else
112
+ raise TypeError, "unknown comment type: #{c.class}"
113
+ end
114
+ }.join("|")
115
+ Regexp.compile("\\A(?:(?m:\\s*)(?:#{re}))+")
116
+ end
117
+
118
+ def process_source(source)
119
+ header = source[@header_pattern, 0] || ""
120
+ body = $' || source
121
+
122
+ header, directives = extract_directives(header)
123
+
124
+ data = +""
125
+ data.force_encoding(body.encoding)
126
+ data << header unless header.empty?
127
+ data << body
128
+ # Ensure body ends in a new line
129
+ data << "\n" if data.length > 0 && data[-1] != "\n"
130
+
131
+ return data, directives
132
+ end
133
+
134
+ # Returns an Array of directive structures. Each structure
135
+ # is an Array with the line number as the first element, the
136
+ # directive name as the second element, followed by any
137
+ # arguments.
138
+ #
139
+ # [[1, "require", "foo"], [2, "require", "bar"]]
140
+ #
141
+ def extract_directives(header)
142
+ processed_header = +""
143
+ directives = []
144
+
145
+ header.lines.each_with_index do |line, index|
146
+ if directive = line[DIRECTIVE_PATTERN, 1]
147
+ name, *args = Shellwords.shellwords(directive)
148
+ if respond_to?("process_#{name}_directive", true)
149
+ directives << [index + 1, name, *args]
150
+ # Replace directive line with a clean break
151
+ line = "\n"
152
+ end
153
+ end
154
+ processed_header << line
155
+ end
156
+
157
+ processed_header.chomp!
158
+ # Ensure header ends in a new line like before it was processed
159
+ processed_header << "\n" if processed_header.length > 0 && header[-1] == "\n"
160
+
161
+ return processed_header, directives
162
+ end
163
+
164
+ # Gathers comment directives in the source and processes them.
165
+ # Any directive method matching `process_*_directive` will
166
+ # automatically be available. This makes it easy to extend the
167
+ # processor.
168
+ #
169
+ # To implement a custom directive called `require_glob`, subclass
170
+ # `Sprockets::DirectiveProcessor`, then add a method called
171
+ # `process_require_glob_directive`.
172
+ #
173
+ # class DirectiveProcessor < Sprockets::DirectiveProcessor
174
+ # def process_require_glob_directive(glob)
175
+ # Dir["#{dirname}/#{glob}"].sort.each do |filename|
176
+ # require(filename)
177
+ # end
178
+ # end
179
+ # end
180
+ #
181
+ # Replace the current processor on the environment with your own:
182
+ #
183
+ # env.unregister_processor('text/css', Sprockets::DirectiveProcessor)
184
+ # env.register_processor('text/css', DirectiveProcessor)
185
+ #
186
+ def process_directives(directives)
187
+ directives.each do |line_number, name, *args|
188
+ begin
189
+ send("process_#{name}_directive", *args)
190
+ rescue Exception => e
191
+ e.set_backtrace(["#{@filename}:#{line_number}"] + e.backtrace)
192
+ raise e
193
+ end
194
+ end
195
+ end
196
+
197
+ # The `require` directive functions similar to Ruby's own `require`.
198
+ # It provides a way to declare a dependency on a file in your path
199
+ # and ensures it's only loaded once before the source file.
200
+ #
201
+ # `require` works with files in the environment path:
202
+ #
203
+ # //= require "foo.js"
204
+ #
205
+ # Extensions are optional. If your source file is ".js", it
206
+ # assumes you are requiring another ".js".
207
+ #
208
+ # //= require "foo"
209
+ #
210
+ # Relative paths work too. Use a leading `./` to denote a relative
211
+ # path:
212
+ #
213
+ # //= require "./bar"
214
+ #
215
+ def process_require_directive(path)
216
+ @required << resolve(path, accept: @content_type, pipeline: :self)
217
+ end
218
+
219
+ # `require_self` causes the body of the current file to be inserted
220
+ # before any subsequent `require` directives. Useful in CSS files, where
221
+ # it's common for the index file to contain global styles that need to
222
+ # be defined before other dependencies are loaded.
223
+ #
224
+ # /*= require "reset"
225
+ # *= require_self
226
+ # *= require_tree .
227
+ # */
228
+ #
229
+ def process_require_self_directive
230
+ if @required.include?(@uri)
231
+ raise ArgumentError, "require_self can only be called once per source file"
232
+ end
233
+ @required << @uri
234
+ end
235
+
236
+ # `require_directory` requires all the files inside a single
237
+ # directory. It's similar to `path/*` since it does not follow
238
+ # nested directories.
239
+ #
240
+ # //= require_directory "./javascripts"
241
+ #
242
+ def process_require_directory_directive(path = ".")
243
+ path = expand_relative_dirname(:require_directory, path)
244
+ require_paths(*@environment.stat_directory_with_dependencies(path))
245
+ end
246
+
247
+ # `require_tree` requires all the nested files in a directory.
248
+ # Its glob equivalent is `path/**/*`.
249
+ #
250
+ # //= require_tree "./public"
251
+ #
252
+ def process_require_tree_directive(path = ".")
253
+ path = expand_relative_dirname(:require_tree, path)
254
+ require_paths(*@environment.stat_sorted_tree_with_dependencies(path))
255
+ end
256
+
257
+ # Allows you to state a dependency on a file without
258
+ # including it.
259
+ #
260
+ # This is used for caching purposes. Any changes made to
261
+ # the dependency file will invalidate the cache of the
262
+ # source file.
263
+ #
264
+ # This is useful if you are using ERB and File.read to pull
265
+ # in contents from another file.
266
+ #
267
+ # //= depend_on "foo.png"
268
+ #
269
+ def process_depend_on_directive(path)
270
+ resolve(path)
271
+ end
272
+
273
+ # Allows you to state a dependency on an asset without including
274
+ # it.
275
+ #
276
+ # This is used for caching purposes. Any changes that would
277
+ # invalidate the asset dependency will invalidate the cache of
278
+ # the source file.
279
+ #
280
+ # Unlike `depend_on`, the path must be a requirable asset.
281
+ #
282
+ # //= depend_on_asset "bar.js"
283
+ #
284
+ def process_depend_on_asset_directive(path)
285
+ to_load(resolve(path))
286
+ end
287
+
288
+ # Allows you to state a dependency on a relative directory
289
+ # without including it.
290
+ #
291
+ # This is used for caching purposes. Any changes made to
292
+ # the dependency directory will invalidate the cache of the
293
+ # source file.
294
+ #
295
+ # This is useful if you are using ERB and File.read to pull
296
+ # in contents from multiple files in a directory.
297
+ #
298
+ # //= depend_on_directory ./data
299
+ #
300
+ def process_depend_on_directory_directive(path = ".", accept = nil)
301
+ path = expand_relative_dirname(:depend_on_directory, path)
302
+ accept = expand_accept_shorthand(accept)
303
+ resolve_paths(*@environment.stat_directory_with_dependencies(path), accept: accept)
304
+ end
305
+
306
+ # Allows dependency to be excluded from the asset bundle.
307
+ #
308
+ # The `path` must be a valid asset and may or may not already
309
+ # be part of the bundle. Once stubbed, it is blacklisted and
310
+ # can't be brought back by any other `require`.
311
+ #
312
+ # //= stub "jquery"
313
+ #
314
+ def process_stub_directive(path)
315
+ @stubbed << resolve(path, accept: @content_type, pipeline: :self)
316
+ end
317
+
318
+ # Declares a linked dependency on the target asset.
319
+ #
320
+ # The `path` must be a valid asset and should not already be part of the
321
+ # bundle. Any linked assets will automatically be compiled along with the
322
+ # current.
323
+ #
324
+ # /*= link "logo.png" */
325
+ #
326
+ def process_link_directive(path)
327
+ uri = to_load(resolve(path))
328
+ @to_link << uri
329
+ end
330
+
331
+ # `link_directory` links all the files inside a single
332
+ # directory. It's similar to `path/*` since it does not follow
333
+ # nested directories.
334
+ #
335
+ # //= link_directory "./fonts"
336
+ #
337
+ # Use caution when linking against JS or CSS assets. Include an explicit
338
+ # extension or content type in these cases.
339
+ #
340
+ # //= link_directory "./scripts" .js
341
+ #
342
+ def process_link_directory_directive(path = ".", accept = nil)
343
+ path = expand_relative_dirname(:link_directory, path)
344
+ accept = expand_accept_shorthand(accept)
345
+ link_paths(*@environment.stat_directory_with_dependencies(path), accept)
346
+ end
347
+
348
+ # `link_tree` links all the nested files in a directory.
349
+ # Its glob equivalent is `path/**/*`.
350
+ #
351
+ # //= link_tree "./images"
352
+ #
353
+ # Use caution when linking against JS or CSS assets. Include an explicit
354
+ # extension or content type in these cases.
355
+ #
356
+ # //= link_tree "./styles" .css
357
+ #
358
+ def process_link_tree_directive(path = ".", accept = nil)
359
+ path = expand_relative_dirname(:link_tree, path)
360
+ accept = expand_accept_shorthand(accept)
361
+ link_paths(*@environment.stat_sorted_tree_with_dependencies(path), accept)
362
+ end
363
+
364
+ private
365
+ def expand_accept_shorthand(accept)
366
+ if accept.nil?
367
+ nil
368
+ elsif accept.include?("/")
369
+ accept
370
+ elsif accept.start_with?(".")
371
+ @environment.mime_exts[accept]
372
+ else
373
+ @environment.mime_exts[".#{accept}"]
374
+ end
375
+ end
376
+
377
+ def require_paths(paths, deps)
378
+ resolve_paths(paths, deps, accept: @content_type, pipeline: :self) do |uri|
379
+ @required << uri
380
+ end
381
+ end
382
+
383
+ def link_paths(paths, deps, accept)
384
+ resolve_paths(paths, deps, accept: accept) do |uri|
385
+ @to_link << to_load(uri)
386
+ end
387
+ end
388
+
389
+ def resolve_paths(paths, deps, **kargs)
390
+ @dependencies.merge(deps)
391
+ paths.each do |subpath, stat|
392
+ next if subpath == @filename || stat.directory?
393
+ uri, deps = @environment.resolve(subpath, **kargs)
394
+ @dependencies.merge(deps)
395
+ yield uri if uri && block_given?
396
+ end
397
+ end
398
+
399
+ def expand_relative_dirname(directive, path)
400
+ if @environment.relative_path?(path)
401
+ path = File.expand_path(path, @dirname)
402
+ stat = @environment.stat(path)
403
+
404
+ if stat && stat.directory?
405
+ path
406
+ else
407
+ raise ArgumentError, "#{directive} argument must be a directory"
408
+ end
409
+ else
410
+ # The path must be relative and start with a `./`.
411
+ raise ArgumentError, "#{directive} argument must be a relative path"
412
+ end
413
+ end
414
+
415
+ def to_load(uri)
416
+ @to_load << uri
417
+ uri
418
+ end
419
+
420
+ def resolve(path, **kargs)
421
+ # Prevent absolute paths in directives
422
+ if @environment.absolute_path?(path)
423
+ raise FileOutsidePaths, "can't require absolute file: #{path}"
424
+ end
425
+
426
+ kargs[:base_path] = @dirname
427
+ uri, deps = @environment.resolve!(path, **kargs)
428
+ @dependencies.merge(deps)
429
+ uri
430
+ end
431
+ end
432
+ end
@@ -0,0 +1,33 @@
1
+ # frozen_string_literal: true
2
+ require 'sprockets/autoload'
3
+
4
+ module Sprockets
5
+ # Processor engine class for the Eco compiler. Depends on the `eco` gem.
6
+ #
7
+ # For more information see:
8
+ #
9
+ # https://github.com/sstephenson/ruby-eco
10
+ # https://github.com/sstephenson/eco
11
+ #
12
+ module EcoProcessor
13
+ VERSION = '1'
14
+
15
+ def self.cache_key
16
+ @cache_key ||= "#{name}:#{Autoload::Eco::Source::VERSION}:#{VERSION}".freeze
17
+ end
18
+
19
+ # Compile template data with Eco compiler.
20
+ #
21
+ # Returns a JS function definition String. The result should be
22
+ # assigned to a JS variable.
23
+ #
24
+ # # => "function(...) {...}"
25
+ #
26
+ def self.call(input)
27
+ data = input[:data]
28
+ input[:cache].fetch([cache_key, data]) do
29
+ Autoload::Eco.compile(data)
30
+ end
31
+ end
32
+ end
33
+ end
@@ -0,0 +1,32 @@
1
+ # frozen_string_literal: true
2
+ require 'sprockets/autoload'
3
+
4
+ module Sprockets
5
+ # Processor engine class for the EJS compiler. Depends on the `ejs` gem.
6
+ #
7
+ # For more information see:
8
+ #
9
+ # https://github.com/sstephenson/ruby-ejs
10
+ #
11
+ module EjsProcessor
12
+ VERSION = '1'
13
+
14
+ def self.cache_key
15
+ @cache_key ||= "#{name}:#{VERSION}".freeze
16
+ end
17
+
18
+ # Compile template data with EJS compiler.
19
+ #
20
+ # Returns a JS function definition String. The result should be
21
+ # assigned to a JS variable.
22
+ #
23
+ # # => "function(obj){...}"
24
+ #
25
+ def self.call(input)
26
+ data = input[:data]
27
+ input[:cache].fetch([cache_key, data]) do
28
+ Autoload::EJS.compile(data)
29
+ end
30
+ end
31
+ end
32
+ end