barefoot_js 0.31.5
“Engine-agnostic BarefootJS server runtime targeting ERB, ported from packages/adapter-perl/lib/BarefootJS.pm.”
Contains an unbounded block loopimports fileutils
SHA-256b584e5b0f32486225c6c426a107cea089524c942b6da6f408d62668814a30e79
MaleculeH₂(Db₂F)
Evidence
1# frozen_string_literal: true
2
3require 'fileutils'
4
5module BarefootJS
6 # Framework-agnostic dev-only browser auto-reload for BarefootJS apps.
7 #
8 # Ruby port of BarefootJS::DevReload (@barefootjs/perl), companion to
9 # `barefoot build --watch` in @barefootjs/cli. The CLI drops
10 # `<dist>/.dev/build-id` after every successful rebuild that changed output;
11 # a browser snippet subscribes to an SSE endpoint that emits `event: reload`
51:25… dir(dist_dir)
52 dev = File.join(dist_dir, DEV_SUBDIR)
53 FileUtils.mkdir_p(dev)
54 dev
55 end
56
57 def self.read_build_id(path)
58 return '' unless File.file?(path)
59
60 File.read(path, encoding: 'UTF-8').strip
61 rescue Errno::ENOENT
62 ''
63 end
64
65 # The browser sni …
116:54… data: #{initial}\n\n"
117 end
118
119 since_hb = 0
120 loop do
121 sleep(POLL_S)
122 id = read_build_id(path)
123 if !id.empty? && id != last_sent
124 …
52:33… efault: nil)
53 ivar = :"@#{name.to_s.sub(/\A_/, '')}"
54 define_method(name) do |*args|
55 if args.empty?
56 unless instance_variable_defined?(ivar)
57 instance_variable_set(iva …
331:22… t.call(props)
332 elsif manifest_defaults
333 self.class.send(:derive_vars_from_defaults, manifest_defaults, props)
334 else
335 {}
336 end
337
338 h …
No evidence locations were recorded for this file. Raw result