ast_transform 2.1.2 → 2.1.4

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3322dbf3c31a96df5ddea9892b60c40b785842500c13f178d1a9b11b5842bf12
4
- data.tar.gz: aef4ed8d812275368ec5f22c61d9b3d049ecc42490c406d08e8afd4e34e589e7
3
+ metadata.gz: '02391c6a71f241da83617ab3dae2ff61a66c7a9ad3f9d154c6f6f3aee29e86ad'
4
+ data.tar.gz: 9b25a4ae5581efc378793af4b4d3d4fd697cc88104567610caf4dea77c2d4d64
5
5
  SHA512:
6
- metadata.gz: bfd3828a33d2668a854ed4d5b1c299615ca47e92232ccf6705b008437cdb43e6497b9ef517e2664f5cd68b9197f9cc78ef2bd50090152f7889490a18e28cf72a
7
- data.tar.gz: 6f9647eaad1208d3cacb9ba038f8e63ff213d1ae7030bb96ec0a28386125096526f64bffa93100795427d67c2671b2638711c9ca891222beac01b0c046a07afc
6
+ metadata.gz: 0e0c312499e1abdd8eea7f2c704cf3aaca4a06ed1b7c62c048bb6f4b350b85a89fc9170c8dc0d0cfd84d5b1e2c9822608a4767600350c097b1da1f4c98f5d759
7
+ data.tar.gz: d02faba1167586d4bb7aceb138b3452e3cb9ab7c2f294ae02803fb09a565d5ea884ec44568ec60efa1ab3b6600cc17fe911559c02afb6d8e5350bf37ce83ed04
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ast_transform (2.1.2)
4
+ ast_transform (2.1.4)
5
5
  parser (>= 3.0)
6
6
  prism (>= 1.5)
7
7
  unparser (>= 0.6)
@@ -10,9 +10,12 @@ module ASTTransform
10
10
  def load_iseq(source_path)
11
11
  return ASTTransform::MixinUtils.try_super(self, :load_iseq, source_path) if source_path == __FILE__
12
12
 
13
- source = File.read(source_path)
13
+ # Binary read avoids encoding errors during the fast-path check below.
14
+ # Downstream (Prism, RubyVM::InstructionSequence) handle encoding natively
15
+ # via magic comments, so we never need to set it ourselves.
16
+ source = File.binread(source_path)
14
17
 
15
- return ASTTransform::MixinUtils.try_super(self, :load_iseq, source_path) unless source =~ /transform!/
18
+ return ASTTransform::MixinUtils.try_super(self, :load_iseq, source_path) unless source.include?('transform!'.b)
16
19
 
17
20
  ASTTransform::InstructionSequence.source_to_transformed_iseq(source, source_path)
18
21
  end
@@ -16,7 +16,7 @@ module ASTTransform
16
16
  rewritten_source = transformer.transform_file_source(source, source_path, rewritten_file_pathname.to_s)
17
17
  write(rewritten_source, rewritten_file_pathname)
18
18
 
19
- RubyVM::InstructionSequence.compile(rewritten_source, rewritten_file_pathname.to_s, rewritten_file_pathname.to_s)
19
+ RubyVM::InstructionSequence.compile(rewritten_source, source_path, source_path)
20
20
  end
21
21
 
22
22
  def write_pathname(file_path)
@@ -11,6 +11,7 @@ module ASTTransform
11
11
  # @return [void]
12
12
  def register_source_map(source_map)
13
13
  source_maps[source_map.transformed_file_path] = source_map
14
+ source_maps[source_map.source_file_path] = source_map
14
15
 
15
16
  nil
16
17
  end
@@ -1,3 +1,3 @@
1
1
  module ASTTransform
2
- VERSION = "2.1.2"
2
+ VERSION = "2.1.4"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ast_transform
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.2
4
+ version: 2.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jean-Philippe Duchesne