bootsnap 1.26.0 → 1.26.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6227028d2a559d0e5129ef91915f65a064082b2e1326517dd67da2f11d91d194
4
- data.tar.gz: 1c7cbf82581f9162601a7723812201d240661c0d3477373b820cf7e942b9d416
3
+ metadata.gz: 60ae2eb0837949aa24f9b7a0f26091e3dbfc0254824da896199c376cf5040701
4
+ data.tar.gz: e443d064c6dcfbf2dd9265b54fbf65972154f5104c8f675f1595baa04eb78aae
5
5
  SHA512:
6
- metadata.gz: 385183b9de17b6f72634b7307fdfc5481108afc06554b48bb2dede97e51ba4275d076357934d338286fceb3a221f1468ec2ea10e2f0f869de5a7b5b97fc444a8
7
- data.tar.gz: c74bb8bdfe0e6f3615bbc4a6ea4f7c5a7a1d8589a3469da964c25b44451fbb3f54f10521b8549dc6ac400d7fb17ba4a686b5b289115e8b3bac81d7a5449e3c0b
6
+ metadata.gz: d216ef8ec68ba89acdff4fb8c40288feb4f1363705d39b10c25172e0d426cf53609404c73d761ada31f7c1ad880da6bc247d637bb6cb2e4393699de287c88c62
7
+ data.tar.gz: 5dffa5c439dfbb15e020f2704f2400b44f8c0dfe5c14afbae18d68f7f1cc33f06cb6fce6ccb315ffd32b309b460e955e247af399d4ba2712fd48dd5e40ab1add
data/CHANGELOG.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # Unreleased
2
2
 
3
+ # 1.26.1
4
+
5
+ * Fix `Bootsnap.enable_frozen_string_literal(app_only: true)` raising `NameError` when the compile cache is disabled.
6
+ App files are now compiled with frozen string literals on every load, without caching.
7
+
8
+ * Avoid transcoding Ruby source when the Prism workaround runs with a default internal encoding.
9
+
10
+ * Better detect support for fast path scanning. Fix compilation on Illumos.
11
+
3
12
  # 1.26.0
4
13
 
5
14
  * Handle top level `Coverage` constant being defined, but without it being the true stdlib `coverage` module.
@@ -149,7 +149,7 @@ bs_rb_get_path(VALUE self, VALUE fname)
149
149
  return rb_get_path(fname);
150
150
  }
151
151
 
152
- #ifdef HAVE_FSTATAT
152
+ #if defined(HAVE_FSTATAT) && defined(HAVE_STRUCT_DIRENT_D_TYPE)
153
153
 
154
154
  RBIMPL_ATTR_NORETURN()
155
155
  static void
@@ -275,7 +275,7 @@ Init_bootsnap(void)
275
275
 
276
276
  rb_define_singleton_method(rb_mBootsnap, "rb_get_path", bs_rb_get_path, 1);
277
277
 
278
- #ifdef HAVE_FSTATAT
278
+ #if defined(HAVE_FSTATAT) && defined(HAVE_STRUCT_DIRENT_D_TYPE)
279
279
  VALUE rb_mBootsnap_LoadPathCache = rb_define_module_under(rb_mBootsnap, "LoadPathCache");
280
280
  VALUE rb_mBootsnap_LoadPathCache_Native = rb_define_module_under(rb_mBootsnap_LoadPathCache, "Native");
281
281
 
@@ -5,6 +5,7 @@ require "mkmf"
5
5
  if %w[ruby truffleruby].include?(RUBY_ENGINE)
6
6
  have_func "fdatasync", "unistd.h"
7
7
  have_func "fstatat", "sys/stat.h"
8
+ have_struct_member "struct dirent", "d_type", "dirent.h"
8
9
 
9
10
  unless RUBY_PLATFORM.match?(/mswin|mingw|cygwin/)
10
11
  append_cppflags ["-D_GNU_SOURCE"] # Needed of O_NOATIME
@@ -11,7 +11,7 @@ module Bootsnap
11
11
  attr_accessor :compiler_selector, :default_compiler
12
12
 
13
13
  def cache_dir=(cache_dir)
14
- @cache_dir = cache_dir.end_with?("/") ? "#{cache_dir}iseq" : "#{cache_dir}-iseq"
14
+ @cache_dir = cache_dir && (cache_dir.end_with?("/") ? "#{cache_dir}iseq" : "#{cache_dir}-iseq")
15
15
  end
16
16
 
17
17
  def supported?
@@ -72,7 +72,8 @@ module Bootsnap
72
72
 
73
73
  if has_ruby_bug_22023_bis
74
74
  def compile_file_prism(path, options = nil)
75
- compile_prism(::File.read(path, encoding: Encoding::UTF_8), path, path, nil, options)
75
+ source = ::File.read(path, external_encoding: Encoding::UTF_8, internal_encoding: nil)
76
+ compile_prism(source, path, path, nil, options)
76
77
  end
77
78
  end
78
79
  end
@@ -151,13 +152,17 @@ module Bootsnap
151
152
  return nil
152
153
  end
153
154
 
154
- Bootsnap::CompileCache::Native.fetch(
155
- cache_dir,
156
- compiler.namespace,
157
- path.to_s,
158
- compiler,
159
- nil,
160
- )
155
+ if cache_dir
156
+ Bootsnap::CompileCache::Native.fetch(
157
+ cache_dir,
158
+ compiler.namespace,
159
+ path.to_s,
160
+ compiler,
161
+ nil,
162
+ )
163
+ else
164
+ compiler.input_to_output(nil, path.to_s, nil)
165
+ end
161
166
  end
162
167
 
163
168
  def self.precompile(path)
@@ -16,7 +16,6 @@ module Bootsnap
16
16
 
17
17
  if iseq
18
18
  if supported?
19
- require_relative "compile_cache/iseq"
20
19
  Bootsnap::CompileCache::ISeq.install!(cache_dir)
21
20
  elsif $VERBOSE
22
21
  warn("[bootsnap/setup] bytecode caching is not supported on this implementation of Ruby")
@@ -45,3 +44,8 @@ module Bootsnap
45
44
  end
46
45
  end
47
46
  end
47
+
48
+ if RUBY_ENGINE != "jruby"
49
+ require_relative "compile_cache/iseq"
50
+ Bootsnap::CompileCache::ISeq.install!(nil)
51
+ end
@@ -72,7 +72,7 @@ module Bootsnap
72
72
 
73
73
  def load_data
74
74
  @data = begin
75
- data = File.open(@store_path, encoding: Encoding::BINARY) do |io|
75
+ data = File.open(@store_path, binmode: true, encoding: Encoding::BINARY) do |io|
76
76
  MessagePack.load(io, freeze: true)
77
77
  end
78
78
  if data.is_a?(Hash) && data[VERSION_KEY] == CURRENT_VERSION
@@ -100,7 +100,7 @@ module Bootsnap
100
100
  exclusive_write = File::Constants::CREAT | File::Constants::EXCL | File::Constants::WRONLY
101
101
  # `encoding:` looks redundant wrt `binwrite`, but necessary on windows
102
102
  # because binary is part of mode.
103
- File.open(tmp, mode: exclusive_write, encoding: Encoding::BINARY) do |io|
103
+ File.open(tmp, mode: exclusive_write, binmode: true, encoding: Encoding::BINARY) do |io|
104
104
  MessagePack.dump(@data, io)
105
105
  end
106
106
  File.rename(tmp, @store_path)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Bootsnap
4
- VERSION = "1.26.0"
4
+ VERSION = "1.26.1"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bootsnap
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.26.0
4
+ version: 1.26.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Burke Libbey
@@ -81,7 +81,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
83
  requirements: []
84
- rubygems_version: 4.0.16
84
+ rubygems_version: 4.0.20
85
85
  specification_version: 4
86
86
  summary: Boot large ruby/rails apps faster
87
87
  test_files: []