Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: opal/opal
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 639cbfc54d29
Choose a base ref
...
head repository: opal/opal
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 2fb50a5f16eb
Choose a head ref
  • 2 commits
  • 1 file changed
  • 1 contributor

Commits on Mar 19, 2015

  1. Unverified

    This commit is not signed, but one or more authors requires that any commit attributed to them is signed.
    Copy the full SHA
    739efc4 View commit details
  2. Unverified

    This commit is not signed, but one or more authors requires that any commit attributed to them is signed.
    Copy the full SHA
    2fb50a5 View commit details
Showing with 8 additions and 17 deletions.
  1. +8 −17 lib/opal/sprockets/processor.rb
25 changes: 8 additions & 17 deletions lib/opal/sprockets/processor.rb
Original file line number Diff line number Diff line change
@@ -63,23 +63,22 @@ class << self


def evaluate(context, locals, &block)
return Opal.compile data unless context.is_a? ::Sprockets::Context
return Opal.compile data, file: file unless context.is_a? ::Sprockets::Context

path = context.logical_path
prerequired = []
compiler_options = self.class.compiler_options.merge(file: logical_path)
logical_path = context.logical_path
sprockets = context.environment

# builder = self.class.new_builder(context)
compiler = Compiler.new(data, self.class.compiler_options.merge(requirable: true, file: context.logical_path))
compiler = Compiler.new(data, compiler_options)
result = compiler.compile

compiler.requires.each do |required|
context.require_asset required
end

# result = builder.build_str(data, path, :prerequired => prerequired)

if self.class.source_map_enabled
map_contents = compiler.source_map.as_json.to_json
::Opal::SourceMapServer.set_map_cache(context.environment, path, map_contents)
::Opal::SourceMapServer.set_map_cache(sprockets, logical_path, map_contents)
end

result.to_s
@@ -126,17 +125,9 @@ def self.compiler_options
:dynamic_require_severity => dynamic_require_severity,
:irb => irb_enabled,
:inline_operators => inline_operators_enabled,
:requirable => true,
}
end

def self.new_builder(context)
path_reader = ::Opal::Sprockets::PathReader.new(context.environment, context)
return Builder.new(
compiler_options: compiler_options,
stubs: stubbed_files,
path_reader: path_reader
)
end
end
end