bridgetown-core 2.0.1 → 2.0.2
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 +4 -4
- data/lib/bridgetown-core/commands/console.rb +1 -4
- data/lib/bridgetown-core/commands/esbuild/esbuild.defaults.js.erb +1 -1
- data/lib/bridgetown-core/concerns/site/fast_refreshable.rb +1 -4
- data/lib/bridgetown-core/configuration.rb +2 -1
- data/lib/bridgetown-core/converters/erb_templates.rb +68 -32
- data/lib/bridgetown-core/filters/url_filters.rb +8 -1
- data/lib/bridgetown-core/helpers.rb +1 -1
- data/lib/bridgetown-core/rack/boot.rb +5 -6
- data/lib/bridgetown-core/utils/loaders_manager.rb +6 -1
- data/lib/bridgetown-core/watcher.rb +1 -6
- data/lib/site_template/package.json.erb +7 -8
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c61ad30c885a073e5b971cab23538dd307ae100d1acbccf8cb62e6d773cedd7f
|
4
|
+
data.tar.gz: 18400fd73d5e012ac9e9e7f728aa49074d3317d4eaf0373f57925e54eba44a0c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 56d2548389959f4ab4bf8387d63b44149411beff8dcefc6ed906b53719aacb4b132399daae07691262ce0c977821d0e3e822b7b4e4abd0b3c2bc90643934807d
|
7
|
+
data.tar.gz: 96853e7021946b336f44f9c8160056cc9126a07d14ab621f6589477ea01f7a2833bafe3ea86f746fc947dc754a0eac0b1328fc50b942337e807e6a37731bd53f
|
@@ -8,10 +8,7 @@ module Bridgetown
|
|
8
8
|
site = Bridgetown::Current.site
|
9
9
|
|
10
10
|
I18n.reload! # make sure any locale files get read again
|
11
|
-
|
12
|
-
Bridgetown::Hooks.clear_reloadable_hooks
|
13
|
-
site.loaders_manager.reload_loaders
|
14
|
-
Bridgetown::Hooks.trigger :site, :post_reload, site
|
11
|
+
site.loaders_manager.reload_loaders(site)
|
15
12
|
|
16
13
|
ConsoleMethods.site_reset(site)
|
17
14
|
end
|
@@ -58,10 +58,7 @@ class Bridgetown::Site
|
|
58
58
|
if full_abort || (marked_resources.empty? && !found_gen_pages && !found_route_file)
|
59
59
|
# Darn, a full reload is needed (unless we're on a super-fast track)
|
60
60
|
if reload_if_needed
|
61
|
-
|
62
|
-
Bridgetown::Hooks.clear_reloadable_hooks
|
63
|
-
loaders_manager.reload_loaders
|
64
|
-
Bridgetown::Hooks.trigger :site, :post_reload, self, paths
|
61
|
+
loaders_manager.reload_loaders(self, paths)
|
65
62
|
process # bring out the big guns
|
66
63
|
end
|
67
64
|
return
|
@@ -29,9 +29,10 @@ module Bridgetown
|
|
29
29
|
DEFAULTS = {
|
30
30
|
# Where things are
|
31
31
|
"root_dir" => Dir.pwd,
|
32
|
-
"plugins_dir" => "plugins",
|
33
32
|
"source" => "src",
|
34
33
|
"destination" => "output",
|
34
|
+
"plugins_dir" => "plugins",
|
35
|
+
"server_dir" => "server",
|
35
36
|
"collections_dir" => "",
|
36
37
|
"cache_dir" => ".bridgetown-cache",
|
37
38
|
"layouts_dir" => "_layouts",
|
@@ -1,63 +1,98 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require "tilt/erubi"
|
4
|
+
require "erubi/capture_block"
|
4
5
|
|
5
6
|
module Bridgetown
|
6
|
-
class OutputBuffer
|
7
|
-
|
8
|
-
|
9
|
-
|
7
|
+
class OutputBuffer
|
8
|
+
extend Forwardable
|
9
|
+
|
10
|
+
def_delegators :@buffer,
|
11
|
+
:empty?,
|
12
|
+
:encode,
|
13
|
+
:encode!,
|
14
|
+
:encoding,
|
15
|
+
:force_encoding,
|
16
|
+
:length,
|
17
|
+
:lines,
|
18
|
+
:reverse,
|
19
|
+
:strip,
|
20
|
+
:valid_encoding?
|
21
|
+
|
22
|
+
def initialize(buffer = "")
|
23
|
+
@buffer = String.new(buffer)
|
24
|
+
@buffer.encode!
|
10
25
|
end
|
11
26
|
|
27
|
+
def initialize_copy(other)
|
28
|
+
@buffer = other.to_str
|
29
|
+
end
|
30
|
+
|
31
|
+
# Concatenation for <%= %> expressions, whose output is escaped.
|
12
32
|
def <<(value)
|
13
33
|
return self if value.nil?
|
14
34
|
|
15
|
-
|
35
|
+
value = value.to_s
|
36
|
+
value = Erubi.h(value) unless value.html_safe?
|
37
|
+
|
38
|
+
@buffer << value
|
39
|
+
|
40
|
+
self
|
16
41
|
end
|
17
42
|
alias_method :append=, :<<
|
18
43
|
|
44
|
+
# Concatenation for <%== %> expressions, whose output is not escaped.
|
45
|
+
#
|
46
|
+
# rubocop:disable Naming/BinaryOperatorParameterName
|
47
|
+
def |(value)
|
48
|
+
return self if value.nil?
|
49
|
+
|
50
|
+
safe_concat(value.to_s)
|
51
|
+
end
|
52
|
+
# rubocop:enable Naming/BinaryOperatorParameterName
|
53
|
+
|
54
|
+
def ==(other)
|
55
|
+
other.instance_of?(OutputBuffer) &&
|
56
|
+
@buffer == other.to_str
|
57
|
+
end
|
58
|
+
|
59
|
+
def html_safe?
|
60
|
+
true
|
61
|
+
end
|
62
|
+
|
63
|
+
def html_safe = to_s
|
64
|
+
|
65
|
+
def safe_concat(value)
|
66
|
+
@buffer << value
|
67
|
+
self
|
68
|
+
end
|
69
|
+
alias_method :safe_append=, :safe_concat
|
70
|
+
|
19
71
|
def safe_expr_append=(val)
|
20
72
|
return self if val.nil? # rubocop:disable Lint/ReturnInVoidContext
|
21
73
|
|
22
74
|
safe_concat val.to_s
|
23
75
|
end
|
24
76
|
|
25
|
-
|
77
|
+
def to_s
|
78
|
+
@buffer.html_safe
|
79
|
+
end
|
80
|
+
|
81
|
+
def to_str
|
82
|
+
@buffer.dup
|
83
|
+
end
|
26
84
|
end
|
27
85
|
|
28
|
-
class ERBEngine < Erubi::
|
86
|
+
class ERBEngine < Erubi::CaptureBlockEngine
|
29
87
|
private
|
30
88
|
|
31
|
-
def add_code(code)
|
32
|
-
@src << code
|
33
|
-
@src << ";#{@bufvar};" if code.strip.split(".").first == "end"
|
34
|
-
@src << ";" unless code[Erubi::RANGE_LAST] == "\n"
|
35
|
-
end
|
36
|
-
|
37
89
|
def add_text(text)
|
38
90
|
return if text.empty?
|
39
91
|
|
40
|
-
src << bufvar << ".
|
92
|
+
src << bufvar << ".safe_concat'"
|
41
93
|
src << text.gsub(%r{['\\]}, '\\\\\&')
|
42
94
|
src << "'.freeze;"
|
43
95
|
end
|
44
|
-
|
45
|
-
# pulled from Rails' ActionView
|
46
|
-
BLOCK_EXPR = %r!\s*((\s+|\))do|\{)(\s*\|[^|]*\|)?\s*\Z!
|
47
|
-
|
48
|
-
def add_expression(indicator, code)
|
49
|
-
src << bufvar << if (indicator == "==") || @escape
|
50
|
-
".safe_expr_append="
|
51
|
-
else
|
52
|
-
".append="
|
53
|
-
end
|
54
|
-
|
55
|
-
if BLOCK_EXPR.match?(code)
|
56
|
-
src << " " << code
|
57
|
-
else
|
58
|
-
src << "(" << code << ");"
|
59
|
-
end
|
60
|
-
end
|
61
96
|
end
|
62
97
|
|
63
98
|
module ERBCapture
|
@@ -67,8 +102,9 @@ module Bridgetown
|
|
67
102
|
result = yield(*args)
|
68
103
|
result = @_erbout.presence || result
|
69
104
|
@_erbout = previous_buffer_state
|
105
|
+
return result.to_s if result.is_a?(OutputBuffer)
|
70
106
|
|
71
|
-
result.is_a?(String) ?
|
107
|
+
result.is_a?(String) ? Erubi.h(result) : result
|
72
108
|
end
|
73
109
|
end
|
74
110
|
|
@@ -70,7 +70,14 @@ module Bridgetown
|
|
70
70
|
# @return [String]
|
71
71
|
def strip_extname(input)
|
72
72
|
Pathname.new(input.to_s).then do |path|
|
73
|
-
|
73
|
+
basename = path.basename
|
74
|
+
while basename.to_s.include?(".")
|
75
|
+
new_basename = basename.basename(".*")
|
76
|
+
break if new_basename == basename
|
77
|
+
|
78
|
+
basename = new_basename
|
79
|
+
end
|
80
|
+
path.dirname + basename
|
74
81
|
end.to_s
|
75
82
|
end
|
76
83
|
|
@@ -154,7 +154,7 @@ module Bridgetown
|
|
154
154
|
|
155
155
|
if key&.start_with?(".")
|
156
156
|
view_path = Bridgetown::Filters::URLFilters.strip_extname(view.resource.relative_path)
|
157
|
-
key = "#{view_path.tr("
|
157
|
+
key = "#{view_path.tr("/", ".").lstrip.delete_prefix("_")}#{key}"
|
158
158
|
end
|
159
159
|
|
160
160
|
return I18n.translate(key, **options) unless %r{(?:_|\b)html\z}.match?(key)
|
@@ -22,12 +22,11 @@ module Bridgetown
|
|
22
22
|
# Roda app is provided the preloaded Bridgetown site configuration. Handle
|
23
23
|
# any uncaught Roda errors.
|
24
24
|
def self.boot(*)
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
)
|
25
|
+
config = Bridgetown::Current.preloaded_configuration
|
26
|
+
self.loaders_manager = Bridgetown::Utils::LoadersManager.new(config)
|
27
|
+
|
28
|
+
config.run_initializers! context: :server
|
29
|
+
LoaderHooks.autoload_server_folder(File.join(config.root_dir, config.server_dir))
|
31
30
|
end
|
32
31
|
end
|
33
32
|
end
|
@@ -61,7 +61,10 @@ module Bridgetown
|
|
61
61
|
end
|
62
62
|
end
|
63
63
|
|
64
|
-
def reload_loaders
|
64
|
+
def reload_loaders(site, paths = [])
|
65
|
+
Bridgetown::Hooks.trigger :site, :pre_reload, site, paths
|
66
|
+
Bridgetown::Hooks.clear_reloadable_hooks
|
67
|
+
|
65
68
|
FileUtils.rm_f(Bridgetown.build_errors_path)
|
66
69
|
|
67
70
|
@loaders.each do |load_path, loader|
|
@@ -72,6 +75,8 @@ module Bridgetown
|
|
72
75
|
loader.eager_load if config.eager_load_paths.include?(load_path)
|
73
76
|
Bridgetown::Hooks.trigger :loader, :post_reload, loader, load_path
|
74
77
|
end
|
78
|
+
|
79
|
+
Bridgetown::Hooks.trigger :site, :post_reload, site, paths
|
75
80
|
end
|
76
81
|
end
|
77
82
|
end
|
@@ -101,12 +101,7 @@ module Bridgetown
|
|
101
101
|
I18n.reload! # make sure any locale files get read again
|
102
102
|
Bridgetown::Current.sites[site.label] = site # needed in SSR mode apparently
|
103
103
|
catch :halt do
|
104
|
-
unless fast_refreshable
|
105
|
-
Bridgetown::Hooks.trigger :site, :pre_reload, site, paths
|
106
|
-
Bridgetown::Hooks.clear_reloadable_hooks
|
107
|
-
site.loaders_manager.reload_loaders
|
108
|
-
Bridgetown::Hooks.trigger :site, :post_reload, site, paths
|
109
|
-
end
|
104
|
+
site.loaders_manager.reload_loaders(site, paths) unless fast_refreshable
|
110
105
|
|
111
106
|
if site.ssr?
|
112
107
|
site.reset(soft: true)
|
@@ -8,19 +8,18 @@
|
|
8
8
|
"esbuild-dev": "node esbuild.config.js --watch"
|
9
9
|
},
|
10
10
|
"devDependencies": {
|
11
|
-
"esbuild": "^0.
|
12
|
-
"glob": "^
|
11
|
+
"esbuild": "^0.25.11",
|
12
|
+
"glob": "^11.0.3",
|
13
13
|
<%- unless disable_postcss? -%>
|
14
|
-
"postcss": "^8.
|
14
|
+
"postcss": "^8.5.6",
|
15
15
|
"postcss-flexbugs-fixes": "^5.0.2",
|
16
|
-
"postcss-import": "^
|
17
|
-
"postcss-load-config": "^
|
18
|
-
"postcss-preset-env": "^
|
16
|
+
"postcss-import": "^16.1.0",
|
17
|
+
"postcss-load-config": "^6.0.1",
|
18
|
+
"postcss-preset-env": "^10.4.0",
|
19
19
|
"read-cache": "^1.0.0"<%= "," unless postcss_option %>
|
20
20
|
<%- end -%>
|
21
21
|
<%- unless postcss_option -%>
|
22
|
-
"sass": "^1.
|
23
|
-
"sass-loader": "^13.3.2"
|
22
|
+
"sass": "^1.93.2"
|
24
23
|
<%- end -%>
|
25
24
|
}
|
26
25
|
}
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bridgetown-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bridgetown Team
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-10-
|
11
|
+
date: 2025-10-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -64,14 +64,14 @@ dependencies:
|
|
64
64
|
requirements:
|
65
65
|
- - '='
|
66
66
|
- !ruby/object:Gem::Version
|
67
|
-
version: 2.0.
|
67
|
+
version: 2.0.2
|
68
68
|
type: :runtime
|
69
69
|
prerelease: false
|
70
70
|
version_requirements: !ruby/object:Gem::Requirement
|
71
71
|
requirements:
|
72
72
|
- - '='
|
73
73
|
- !ruby/object:Gem::Version
|
74
|
-
version: 2.0.
|
74
|
+
version: 2.0.2
|
75
75
|
- !ruby/object:Gem::Dependency
|
76
76
|
name: csv
|
77
77
|
requirement: !ruby/object:Gem::Requirement
|