bridgetown-core 1.3.0 → 1.3.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bridgetown-core.gemspec +1 -0
- data/lib/bridgetown-core/commands/console.rb +10 -2
- data/lib/bridgetown-core/commands/esbuild/esbuild.defaults.js.erb +12 -7
- data/lib/bridgetown-core/commands/esbuild/update.rb +1 -1
- data/lib/bridgetown-core/concerns/localizable.rb +13 -1
- data/lib/bridgetown-core/configuration.rb +1 -0
- data/lib/bridgetown-core/configurations/netlify/netlify.sh +2 -3
- data/lib/bridgetown-core/configurations/netlify/netlify.toml +1 -12
- data/lib/bridgetown-core/drops/drop.rb +2 -1
- data/lib/bridgetown-core/filters/localization_filters.rb +28 -2
- data/lib/bridgetown-core/filters/translation_filters.rb +15 -2
- data/lib/bridgetown-core/filters.rb +3 -4
- data/lib/bridgetown-core/generated_page.rb +1 -1
- data/lib/bridgetown-core/generators/prototype_generator.rb +2 -1
- data/lib/bridgetown-core/helpers.rb +4 -3
- data/lib/bridgetown-core/log_writer.rb +3 -9
- data/lib/bridgetown-core/plugin_manager.rb +24 -2
- data/lib/bridgetown-core/rack/boot.rb +13 -2
- data/lib/bridgetown-core/resource/base.rb +1 -1
- data/lib/bridgetown-core/resource/relations.rb +1 -1
- data/lib/bridgetown-core/tags/l.rb +4 -2
- data/lib/bridgetown-core/tags/t.rb +6 -2
- data/lib/bridgetown-core/tasks/bridgetown_tasks.rake +11 -0
- data/lib/bridgetown-core/utils/loaders_manager.rb +3 -4
- data/lib/bridgetown-core/version.rb +1 -1
- data/lib/bridgetown-core/yaml_parser.rb +15 -4
- data/lib/bridgetown-core.rb +1 -1
- data/lib/site_template/config/initializers.rb +20 -0
- data/lib/site_template/package.json.erb +12 -12
- metadata +20 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 556799feca958f64e151dff3c039cc98240bc611a60cf650e3658f50490dcf79
|
4
|
+
data.tar.gz: 74bed3c07355d9b54107ce92334a0cf32a4d8909dd002efdeb4cbf6b0a729128
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8617f84687052ac6ed4b2413bbb4418fc3a332395fd647902379e75e4d22857d43a49edb30b8dbbb8aad7fe067412ad6c397fe0a05fd73ab5b3d3ea6866a7c55
|
7
|
+
data.tar.gz: 6c60464867cfb5fe8baf9e86d983a5392075a92f278f30499c68e1a1dec58b3be53991b7725b31de0c445f4afd448ca0056aa1841ecce79b2daa857c5cb43f6f
|
data/bridgetown-core.gemspec
CHANGED
@@ -36,6 +36,7 @@ Gem::Specification.new do |s|
|
|
36
36
|
s.add_runtime_dependency("addressable", "~> 2.4")
|
37
37
|
s.add_runtime_dependency("amazing_print", "~> 1.2")
|
38
38
|
s.add_runtime_dependency("colorator", "~> 1.0")
|
39
|
+
s.add_runtime_dependency("csv", "~> 3.2")
|
39
40
|
s.add_runtime_dependency("erubi", "~> 1.9")
|
40
41
|
s.add_runtime_dependency("faraday", "~> 2.0")
|
41
42
|
s.add_runtime_dependency("faraday-follow_redirects", "~> 0.3")
|
@@ -66,9 +66,15 @@ module Bridgetown
|
|
66
66
|
type: :boolean,
|
67
67
|
desc: "Print verbose output."
|
68
68
|
|
69
|
-
def console
|
69
|
+
def console # rubocop:disable Metrics
|
70
70
|
require "irb"
|
71
|
-
|
71
|
+
new_history_behavior = false
|
72
|
+
begin
|
73
|
+
require "irb/ext/save-history"
|
74
|
+
rescue LoadError
|
75
|
+
# Code path for Ruby 3.3+
|
76
|
+
new_history_behavior = true
|
77
|
+
end
|
72
78
|
require "amazing_print" unless options[:"bypass-ap"]
|
73
79
|
|
74
80
|
Bridgetown.logger.adjust_verbosity(options)
|
@@ -96,6 +102,7 @@ module Bridgetown
|
|
96
102
|
irb = IRB::Irb.new(workspace)
|
97
103
|
IRB.conf[:IRB_RC]&.call(irb.context)
|
98
104
|
IRB.conf[:MAIN_CONTEXT] = irb.context
|
105
|
+
irb.context.io.load_history if new_history_behavior
|
99
106
|
Bridgetown.logger.info "Console:", "Your site is now available as #{"site".cyan}"
|
100
107
|
Bridgetown.logger.info "",
|
101
108
|
"You can also access #{"collections".cyan} or perform a " \
|
@@ -117,6 +124,7 @@ module Bridgetown
|
|
117
124
|
end
|
118
125
|
ensure
|
119
126
|
IRB.conf[:AT_EXIT].each(&:call)
|
127
|
+
irb.context.io.save_history if new_history_behavior
|
120
128
|
end
|
121
129
|
end
|
122
130
|
end
|
@@ -128,14 +128,19 @@ const importPostCssPlugin = (options, configuration) => ({
|
|
128
128
|
})
|
129
129
|
|
130
130
|
// Process the file through PostCSS
|
131
|
-
|
132
|
-
|
133
|
-
...options.
|
134
|
-
|
135
|
-
|
136
|
-
|
131
|
+
let outputCSS = ""
|
132
|
+
try {
|
133
|
+
const result = await postcss([importPlugin, ...options.plugins]).process(css, {
|
134
|
+
map: true,
|
135
|
+
...options.options,
|
136
|
+
from: args.path,
|
137
|
+
})
|
138
|
+
outputCSS = result.css
|
139
|
+
} catch(err) {
|
140
|
+
console.error(`\nerror: "${err.reason}" while processing CSS file:\n${err.file}:${err.line}:${err.column}\n`)
|
141
|
+
}
|
137
142
|
return {
|
138
|
-
contents:
|
143
|
+
contents: outputCSS,
|
139
144
|
loader: "css",
|
140
145
|
watchFiles: [args.path, ...additionalFilePaths],
|
141
146
|
}
|
@@ -5,5 +5,5 @@ copy_file "jsconfig.json"
|
|
5
5
|
say "🎉 esbuild configuration updated successfully!"
|
6
6
|
say "You may need to add `$styles/` to the front of your main CSS imports."
|
7
7
|
say "See https://www.bridgetownrb.com/docs/frontend-assets#esbuild-setup for details."
|
8
|
-
say "⚠️ Don't forget to update the esbuild version in your `package.json` file to \"^0.
|
8
|
+
say "⚠️ Don't forget to update the esbuild version in your `package.json` file to \"^0.19.2\""
|
9
9
|
say "and run `yarn install`!"
|
@@ -13,12 +13,24 @@ module Bridgetown
|
|
13
13
|
end
|
14
14
|
|
15
15
|
matching_resources = result_set.select do |item|
|
16
|
-
item
|
16
|
+
matches_resource?(item)
|
17
17
|
end
|
18
18
|
|
19
19
|
matching_resources.sort_by do |item|
|
20
20
|
site.config.available_locales.index item.data.locale
|
21
21
|
end
|
22
22
|
end
|
23
|
+
|
24
|
+
def matches_resource?(item)
|
25
|
+
if item.relative_path.is_a?(String)
|
26
|
+
item.localeless_path == localeless_path
|
27
|
+
else
|
28
|
+
item.relative_path.parent == relative_path.parent
|
29
|
+
end && item.data.slug == data.slug
|
30
|
+
end
|
31
|
+
|
32
|
+
def localeless_path
|
33
|
+
relative_path.gsub(%r{\A#{data.locale}/}, "")
|
34
|
+
end
|
23
35
|
end
|
24
36
|
end
|
@@ -41,6 +41,7 @@ module Bridgetown
|
|
41
41
|
category: { key: "categories", title: "Category" }, tag: { key: "tags", title: "Tag" },
|
42
42
|
},
|
43
43
|
"autoload_paths" => [],
|
44
|
+
"inflector" => nil,
|
44
45
|
"eager_load_paths" => [],
|
45
46
|
"autoloader_collapsed_paths" => [],
|
46
47
|
"additional_watch_paths" => [],
|
@@ -3,12 +3,11 @@
|
|
3
3
|
|
4
4
|
echo "Updating netlify.toml with references to our built files"
|
5
5
|
|
6
|
-
CSS_PATH=`find output/_bridgetown/static
|
7
|
-
JS_PATH=`find output/_bridgetown/static
|
6
|
+
CSS_PATH=`find output/_bridgetown/static/*.css -type f | sed -e 's,output\/,/,g'`
|
7
|
+
JS_PATH=`find output/_bridgetown/static/*.js -type f | sed -e 's,output\/,/,g'`
|
8
8
|
|
9
9
|
echo "CSS Path: ${CSS_PATH}"
|
10
10
|
echo "JS Path: ${JS_PATH}"
|
11
11
|
|
12
12
|
sed -i s,CSS_PATH,${CSS_PATH},g netlify.toml
|
13
13
|
sed -i s,JS_PATH,${JS_PATH},g netlify.toml
|
14
|
-
sed -i s,NETLIFY_IMAGES_CDN_DOMAIN,${NETLIFY_IMAGES_CDN_DOMAIN},g netlify.toml
|
@@ -6,18 +6,8 @@
|
|
6
6
|
NODE_ENV = "development"
|
7
7
|
BRIDGETOWN_ENV = "production"
|
8
8
|
|
9
|
-
[build.processing]
|
10
|
-
skip_processing = false
|
11
|
-
[build.processing.css]
|
12
|
-
bundle = false
|
13
|
-
minify = true
|
14
|
-
[build.processing.js]
|
15
|
-
bundle = false
|
16
|
-
minify = true
|
17
9
|
[build.processing.html]
|
18
10
|
pretty_urls = true
|
19
|
-
[build.processing.images]
|
20
|
-
compress = true
|
21
11
|
|
22
12
|
[[headers]]
|
23
13
|
for = "*"
|
@@ -34,8 +24,7 @@
|
|
34
24
|
[headers.values]
|
35
25
|
Link = [
|
36
26
|
"<CSS_PATH>; rel=preload; as=style",
|
37
|
-
"<JS_PATH>; rel=preload; as=script"
|
38
|
-
"<https://NETLIFY_IMAGES_CDN_DOMAIN>; rel=preconnect"
|
27
|
+
"<JS_PATH>; rel=preload; as=script"
|
39
28
|
]
|
40
29
|
|
41
30
|
[[headers]]
|
@@ -202,7 +202,8 @@ module Bridgetown
|
|
202
202
|
return self[key] if key?(key)
|
203
203
|
raise KeyError, %(key not found: "#{key}") if default.nil? && block.nil?
|
204
204
|
return yield(key) unless block.nil?
|
205
|
-
|
205
|
+
|
206
|
+
default unless default.nil?
|
206
207
|
end
|
207
208
|
|
208
209
|
private
|
@@ -3,8 +3,34 @@
|
|
3
3
|
module Bridgetown
|
4
4
|
module Filters
|
5
5
|
module LocalizationFilters
|
6
|
-
def l(input)
|
7
|
-
|
6
|
+
def l(input, format = nil, locale = nil)
|
7
|
+
date = Liquid::Utils.to_date(input)
|
8
|
+
return input if date.nil?
|
9
|
+
|
10
|
+
format = maybe_symbolized(format, date)
|
11
|
+
locale ||= maybe_locale(format)
|
12
|
+
format = nil if locale == format
|
13
|
+
|
14
|
+
I18n.l(date, format: format, locale: locale)
|
15
|
+
end
|
16
|
+
|
17
|
+
private
|
18
|
+
|
19
|
+
def maybe_locale(format)
|
20
|
+
return if format.nil?
|
21
|
+
|
22
|
+
Bridgetown::Current.site.config.available_locales.include?(format.to_sym) ? format : nil
|
23
|
+
end
|
24
|
+
|
25
|
+
def maybe_symbolized(format, object)
|
26
|
+
return if format.nil?
|
27
|
+
|
28
|
+
type = type_of(object)
|
29
|
+
I18n.t("#{type}.formats").key?(format.to_sym) ? format.to_sym : format
|
30
|
+
end
|
31
|
+
|
32
|
+
def type_of(object)
|
33
|
+
object.respond_to?(:sec) ? "time" : "date"
|
8
34
|
end
|
9
35
|
end
|
10
36
|
end
|
@@ -3,8 +3,21 @@
|
|
3
3
|
module Bridgetown
|
4
4
|
module Filters
|
5
5
|
module TranslationFilters
|
6
|
-
def t(input)
|
7
|
-
|
6
|
+
def t(input, options = "")
|
7
|
+
options = string_to_hash(options)
|
8
|
+
locale = options.delete(:locale)
|
9
|
+
count = options.delete(:count)
|
10
|
+
options[:count] = count.to_i unless count.nil?
|
11
|
+
|
12
|
+
I18n.t(input.to_s, locale: locale, **options)
|
13
|
+
rescue ArgumentError
|
14
|
+
input
|
15
|
+
end
|
16
|
+
|
17
|
+
private
|
18
|
+
|
19
|
+
def string_to_hash(options)
|
20
|
+
options.split(",").to_h { |e| e.split(":").map(&:strip) }.symbolize_keys
|
8
21
|
end
|
9
22
|
end
|
10
23
|
end
|
@@ -7,6 +7,8 @@ module Bridgetown
|
|
7
7
|
include URLFilters
|
8
8
|
include GroupingFilters
|
9
9
|
include DateFilters
|
10
|
+
include LocalizationFilters
|
11
|
+
include TranslationFilters
|
10
12
|
include ConditionHelpers
|
11
13
|
|
12
14
|
# Convert a Markdown string into HTML output.
|
@@ -102,7 +104,7 @@ module Bridgetown
|
|
102
104
|
def obfuscate_link(input, prefix = "mailto")
|
103
105
|
link = "<a href=\"#{prefix}:#{input}\">#{input}</a>"
|
104
106
|
script = "<script type=\"text/javascript\">document.currentScript.insertAdjacentHTML('"
|
105
|
-
script += "beforebegin', '#{rot47(link).gsub(
|
107
|
+
script += "beforebegin', '#{rot47(link).gsub("\\", '\\\\\\')}'.replace(/[!-~]/g," # rubocop:disable Style/StringLiteralsInInterpolation
|
106
108
|
script += "function(c){{var j=c.charCodeAt(0);if((j>=33)&&(j<=126)){"
|
107
109
|
script += "return String.fromCharCode(33+((j+ 14)%94));}"
|
108
110
|
script += "else{return String.fromCharCode(j);}}}));</script>"
|
@@ -433,6 +435,3 @@ end
|
|
433
435
|
Liquid::Template.register_filter(
|
434
436
|
Bridgetown::Filters
|
435
437
|
)
|
436
|
-
Liquid::Template.register_filter(
|
437
|
-
Bridgetown::Filters::TranslationFilters
|
438
|
-
)
|
@@ -144,9 +144,10 @@ module Bridgetown
|
|
144
144
|
end
|
145
145
|
|
146
146
|
def process_prototype_page_data(collection, search_term, term)
|
147
|
+
pagination_key = prototyped_page.data.key?("paginate") ? "paginate" : "pagination"
|
147
148
|
# Fill in pagination details to be handled later by Bridgetown::Paginate
|
148
149
|
data["pagination"] = Bridgetown::Utils.deep_merge_hashes(
|
149
|
-
prototyped_page.data[
|
150
|
+
prototyped_page.data[pagination_key].to_h, {
|
150
151
|
"enabled" => true,
|
151
152
|
"collection" => collection,
|
152
153
|
"where_query" => [search_term, term],
|
@@ -97,10 +97,11 @@ module Bridgetown
|
|
97
97
|
# @param options [Hash] key-value pairs of HTML attributes to add to the tag
|
98
98
|
# @return [String] the anchor tag HTML
|
99
99
|
# @raise [ArgumentError] if the file cannot be found
|
100
|
-
def link_to(text, relative_path = nil, options = {})
|
101
|
-
if
|
100
|
+
def link_to(text, relative_path = nil, options = {}, &block)
|
101
|
+
if block.present?
|
102
|
+
options = relative_path || {}
|
102
103
|
relative_path = text
|
103
|
-
text = yield
|
104
|
+
text = view.respond_to?(:capture) ? view.capture(&block) : yield
|
104
105
|
elsif relative_path.nil?
|
105
106
|
raise ArgumentError, "You must provide a relative path"
|
106
107
|
end
|
@@ -2,18 +2,12 @@
|
|
2
2
|
|
3
3
|
module Bridgetown
|
4
4
|
class LogWriter < ::Logger
|
5
|
-
def initialize
|
6
|
-
|
7
|
-
@level = DEBUG
|
8
|
-
@default_formatter = Formatter.new
|
9
|
-
@logdev = $stdout
|
10
|
-
@formatter = proc do |_, _, _, msg|
|
11
|
-
msg.to_s
|
12
|
-
end
|
5
|
+
def initialize
|
6
|
+
super($stdout, formatter: proc { |_, _, _, msg| msg.to_s })
|
13
7
|
end
|
14
8
|
|
15
9
|
def enable_prefix
|
16
|
-
|
10
|
+
self.formatter = proc do |_, _, _, msg|
|
17
11
|
"\e[32m[Bridgetown]\e[0m #{msg}"
|
18
12
|
end
|
19
13
|
end
|
@@ -129,6 +129,24 @@ module Bridgetown
|
|
129
129
|
"Required #{required_gems.map(&:name).join(", ")}")
|
130
130
|
end
|
131
131
|
|
132
|
+
def self.package_manager
|
133
|
+
@package_manager ||= if File.exist?("yarn.lock")
|
134
|
+
"yarn"
|
135
|
+
elsif File.exist?("package-lock.json")
|
136
|
+
"npm"
|
137
|
+
elsif File.exist?("pnpm-lock.yaml")
|
138
|
+
"pnpm"
|
139
|
+
else
|
140
|
+
""
|
141
|
+
end
|
142
|
+
end
|
143
|
+
|
144
|
+
def self.package_manager_install_command
|
145
|
+
package_manager == "npm" ? "install" : "add"
|
146
|
+
end
|
147
|
+
|
148
|
+
# rubocop:disable Metrics/PerceivedComplexity, Metrics/CyclomaticComplexity
|
149
|
+
|
132
150
|
# Iterates through loaded gems and finds yard-add gemspec metadata.
|
133
151
|
# If that exact package hasn't been installed, execute yarn add
|
134
152
|
#
|
@@ -146,18 +164,22 @@ module Bridgetown
|
|
146
164
|
required_gems
|
147
165
|
end
|
148
166
|
|
167
|
+
# all right, time to install the package
|
149
168
|
gems_to_search.each do |loaded_gem|
|
150
169
|
yarn_dependency = find_yarn_dependency(loaded_gem)
|
151
170
|
next unless add_yarn_dependency?(yarn_dependency, package_json)
|
152
171
|
|
153
|
-
|
154
|
-
|
172
|
+
next if package_manager.empty?
|
173
|
+
|
174
|
+
cmd = "#{package_manager} #{package_manager_install_command} #{yarn_dependency.join("@")}"
|
155
175
|
system cmd
|
156
176
|
end
|
157
177
|
|
158
178
|
gems_to_search
|
159
179
|
end
|
160
180
|
|
181
|
+
# rubocop:enable Metrics/PerceivedComplexity, Metrics/CyclomaticComplexity
|
182
|
+
|
161
183
|
def self.find_yarn_dependency(loaded_gem)
|
162
184
|
yarn_dependency = loaded_gem.to_spec&.metadata&.dig("yarn-add")&.match(YARN_DEPENDENCY_REGEXP)
|
163
185
|
return nil if yarn_dependency&.length != 3 || yarn_dependency[2] == ""
|
@@ -48,7 +48,7 @@ module Bridgetown
|
|
48
48
|
end
|
49
49
|
|
50
50
|
# @param root [String] root of Bridgetown site, defaults to config value
|
51
|
-
def self.autoload_server_folder( # rubocop:todo Metrics
|
51
|
+
def self.autoload_server_folder( # rubocop:todo Metrics
|
52
52
|
root: Bridgetown::Current.preloaded_configuration.root_dir
|
53
53
|
)
|
54
54
|
server_folder = File.join(root, "server")
|
@@ -62,7 +62,18 @@ module Bridgetown
|
|
62
62
|
loader.do_not_eager_load(File.join(server_folder, "roda_app.rb"))
|
63
63
|
|
64
64
|
unless ENV["BRIDGETOWN_ENV"] == "production"
|
65
|
-
Listen.to(server_folder) do |
|
65
|
+
Listen.to(server_folder) do |modified, added, removed|
|
66
|
+
c = modified + added + removed
|
67
|
+
n = c.length
|
68
|
+
|
69
|
+
Bridgetown.logger.info(
|
70
|
+
"Reloading…",
|
71
|
+
"#{n} file#{"s" if n > 1} changed at #{Time.now.strftime("%Y-%m-%d %H:%M:%S")}"
|
72
|
+
)
|
73
|
+
c.each do |path|
|
74
|
+
Bridgetown.logger.info "", "- #{path["#{File.dirname(server_folder)}/".length..]}"
|
75
|
+
end
|
76
|
+
|
66
77
|
loader.reload
|
67
78
|
loader.eager_load
|
68
79
|
Bridgetown::Rack::Routes.reload_subclasses
|
@@ -349,7 +349,7 @@ module Bridgetown
|
|
349
349
|
end
|
350
350
|
|
351
351
|
def import_taxonomies_from_data
|
352
|
-
taxonomies.
|
352
|
+
taxonomies.each_value do |metadata|
|
353
353
|
Array(data[metadata.type.key]).each do |term|
|
354
354
|
metadata.terms << TaxonomyTerm.new(
|
355
355
|
resource: self, label: term, type: metadata.type
|
@@ -24,7 +24,7 @@ module Bridgetown
|
|
24
24
|
def relation_types
|
25
25
|
@relation_types ||= begin
|
26
26
|
types = []
|
27
|
-
relation_schema&.
|
27
|
+
relation_schema&.each_value do |collections|
|
28
28
|
types << collections
|
29
29
|
types << Array(collections).map { |item| ActiveSupport::Inflector.pluralize(item) }
|
30
30
|
end
|
@@ -3,9 +3,11 @@
|
|
3
3
|
module Bridgetown
|
4
4
|
module Tags
|
5
5
|
class LocalizationTag < Liquid::Tag
|
6
|
+
include Bridgetown::Filters::LocalizationFilters
|
7
|
+
|
6
8
|
def render(_context)
|
7
|
-
|
8
|
-
|
9
|
+
input, format, locale = @markup.split.map(&:strip)
|
10
|
+
l(input, format, locale)
|
9
11
|
end
|
10
12
|
end
|
11
13
|
end
|
@@ -3,9 +3,13 @@
|
|
3
3
|
module Bridgetown
|
4
4
|
module Tags
|
5
5
|
class TranslationTag < Liquid::Tag
|
6
|
+
include Bridgetown::Filters::TranslationFilters
|
7
|
+
|
6
8
|
def render(_context)
|
7
|
-
|
8
|
-
|
9
|
+
input, options = @markup.split.map(&:strip)
|
10
|
+
options ||= ""
|
11
|
+
|
12
|
+
t(input, options).to_s
|
9
13
|
end
|
10
14
|
end
|
11
15
|
end
|
@@ -73,3 +73,14 @@ task :environment do # rubocop:todo Metrics/BlockLength
|
|
73
73
|
end
|
74
74
|
end
|
75
75
|
end
|
76
|
+
|
77
|
+
# rubocop:disable Bridgetown/NoPutsAllowed
|
78
|
+
desc "Provides a time zone-aware date string you can use in front matter"
|
79
|
+
task date: :environment do
|
80
|
+
run_initializers
|
81
|
+
|
82
|
+
puts "🗓️ Today's date & time in your site's timezone (#{ENV.fetch("TZ", "NOT SET")}):"
|
83
|
+
puts
|
84
|
+
puts "➡️ #{Time.now.strftime("%a, %d %b %Y %T %z")}"
|
85
|
+
end
|
86
|
+
# rubocop:enable Bridgetown/NoPutsAllowed
|
@@ -20,9 +20,7 @@ module Bridgetown
|
|
20
20
|
def unload_loaders
|
21
21
|
return if @loaders.keys.empty?
|
22
22
|
|
23
|
-
@loaders.
|
24
|
-
loader.unload
|
25
|
-
end
|
23
|
+
@loaders.each_value(&:unload)
|
26
24
|
@loaders = {}
|
27
25
|
end
|
28
26
|
|
@@ -47,7 +45,7 @@ module Bridgetown
|
|
47
45
|
end
|
48
46
|
|
49
47
|
def setup_loaders(autoload_paths = []) # rubocop:todo Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/MethodLength, Metrics/PerceivedComplexity
|
50
|
-
(autoload_paths.presence || config.autoload_paths).each do |load_path|
|
48
|
+
(autoload_paths.presence || config.autoload_paths).each do |load_path| # rubocop:todo Metrics/BlockLength
|
51
49
|
if @loaders.key?(load_path)
|
52
50
|
raise "Zeitwerk loader already added for `#{load_path}'. Please check your config"
|
53
51
|
end
|
@@ -55,6 +53,7 @@ module Bridgetown
|
|
55
53
|
next unless Dir.exist? load_path
|
56
54
|
|
57
55
|
loader = Zeitwerk::Loader.new
|
56
|
+
loader.inflector = config.inflector if config.inflector
|
58
57
|
begin
|
59
58
|
loader.push_dir(load_path)
|
60
59
|
rescue Zeitwerk::Error
|
@@ -6,12 +6,23 @@ module Bridgetown
|
|
6
6
|
|
7
7
|
class << self
|
8
8
|
def load_file(filename, **kwargs)
|
9
|
-
|
10
|
-
YAML.safe_load_file(filename, **kwargs)
|
9
|
+
YAML.safe_load_file filename, **merge_permitted_classes(kwargs)
|
11
10
|
end
|
12
11
|
|
13
|
-
def load(yaml)
|
14
|
-
YAML.safe_load yaml,
|
12
|
+
def load(yaml, **kwargs)
|
13
|
+
YAML.safe_load yaml, **merge_permitted_classes(kwargs)
|
14
|
+
end
|
15
|
+
|
16
|
+
private
|
17
|
+
|
18
|
+
def merge_permitted_classes(kwargs)
|
19
|
+
if kwargs.key?(:permitted_classes)
|
20
|
+
kwargs[:permitted_classes] |= PERMITTED_CLASSES
|
21
|
+
else
|
22
|
+
kwargs[:permitted_classes] = PERMITTED_CLASSES
|
23
|
+
end
|
24
|
+
|
25
|
+
kwargs
|
15
26
|
end
|
16
27
|
end
|
17
28
|
end
|
data/lib/bridgetown-core.rb
CHANGED
@@ -77,7 +77,6 @@ module Bridgetown
|
|
77
77
|
autoload :Cleaner, "bridgetown-core/cleaner"
|
78
78
|
autoload :Collection, "bridgetown-core/collection"
|
79
79
|
autoload :Component, "bridgetown-core/component"
|
80
|
-
autoload :Configuration, "bridgetown-core/configuration"
|
81
80
|
autoload :DefaultsReader, "bridgetown-core/readers/defaults_reader"
|
82
81
|
autoload :Deprecator, "bridgetown-core/deprecator"
|
83
82
|
autoload :EntryFilter, "bridgetown-core/entry_filter"
|
@@ -119,6 +118,7 @@ module Bridgetown
|
|
119
118
|
require "bridgetown-core/liquid_extensions"
|
120
119
|
require "bridgetown-core/filters"
|
121
120
|
|
121
|
+
require "bridgetown-core/configuration"
|
122
122
|
require "bridgetown-core/drops/drop"
|
123
123
|
require "bridgetown-core/drops/resource_drop"
|
124
124
|
require_all "bridgetown-core/converters"
|
@@ -10,6 +10,26 @@ Bridgetown.configure do |config|
|
|
10
10
|
# config.autoload_paths << "models"
|
11
11
|
#
|
12
12
|
|
13
|
+
# You can configure the inflector used by Zeitwerk. In v2.0,
|
14
|
+
# ActiveSupport::Inflector will become the default.
|
15
|
+
#
|
16
|
+
# config.inflector = ActiveSupport::Inflector
|
17
|
+
#
|
18
|
+
# Add new inflection rules using the following format. Inflections
|
19
|
+
# are locale specific, and you may define rules for as many different
|
20
|
+
# locales as you wish. All of these examples are active by default:
|
21
|
+
# ActiveSupport::Inflector.inflections(:en) do |inflect|
|
22
|
+
# inflect.plural /^(ox)$/i, "\\1en"
|
23
|
+
# inflect.singular /^(ox)en/i, "\\1"
|
24
|
+
# inflect.irregular "person", "people"
|
25
|
+
# inflect.uncountable %w( fish sheep )
|
26
|
+
# end
|
27
|
+
#
|
28
|
+
# These inflection rules are supported but not enabled by default:
|
29
|
+
# ActiveSupport::Inflector.inflections(:en) do |inflect|
|
30
|
+
# inflect.acronym "RESTful"
|
31
|
+
# end
|
32
|
+
|
13
33
|
# You can use `init` to initialize various Bridgetown features or plugin gems.
|
14
34
|
# For example, you can use the Dotenv gem to load environment variables from
|
15
35
|
# `.env`. Just `bundle add dotenv` and then uncomment this:
|
@@ -13,17 +13,17 @@
|
|
13
13
|
},
|
14
14
|
"devDependencies": {
|
15
15
|
<%- if frontend_bundling_option == "webpack" -%>
|
16
|
-
"css-loader": "^6.
|
16
|
+
"css-loader": "^6.8.1",
|
17
17
|
<%- end -%>
|
18
|
-
"esbuild": "^0.
|
18
|
+
"esbuild": "^0.19.2",
|
19
19
|
<%- if frontend_bundling_option == "webpack" -%>
|
20
|
-
"esbuild-loader": "^
|
21
|
-
"mini-css-extract-plugin": "^2.6
|
20
|
+
"esbuild-loader": "^4.0.2",
|
21
|
+
"mini-css-extract-plugin": "^2.7.6",
|
22
22
|
<%- else -%>
|
23
|
-
"glob": "^10.
|
23
|
+
"glob": "^10.3.3",
|
24
24
|
<%- end -%>
|
25
25
|
<%- unless disable_postcss? -%>
|
26
|
-
"postcss": "^8.4.
|
26
|
+
"postcss": "^8.4.29",
|
27
27
|
"postcss-flexbugs-fixes": "^5.0.2",
|
28
28
|
<%- if frontend_bundling_option == "esbuild" -%>
|
29
29
|
"postcss-import": "^15.1.0",
|
@@ -31,20 +31,20 @@
|
|
31
31
|
<%- else -%>
|
32
32
|
"postcss-loader": "^6.2.1",
|
33
33
|
<%- end -%>
|
34
|
-
"postcss-preset-env": "^
|
34
|
+
"postcss-preset-env": "^9.1.2",
|
35
35
|
<%- if frontend_bundling_option == "esbuild" -%>
|
36
36
|
"read-cache": "^1.0.0"<%= "," unless postcss_option %>
|
37
37
|
<%- end -%>
|
38
38
|
<%- end -%>
|
39
39
|
<%- unless postcss_option -%>
|
40
|
-
"sass": "^1.
|
41
|
-
"sass-loader": "^
|
40
|
+
"sass": "^1.66.1",
|
41
|
+
"sass-loader": "^13.3.2"<%= "," if frontend_bundling_option == "webpack" %>
|
42
42
|
<%- end -%>
|
43
43
|
<%- if frontend_bundling_option == "webpack" -%>
|
44
|
-
"webpack": "^5.
|
45
|
-
"webpack-cli": "^
|
44
|
+
"webpack": "^5.88.2",
|
45
|
+
"webpack-cli": "^5.1.4",
|
46
46
|
"webpack-manifest-plugin": "^5.0.0",
|
47
|
-
"webpack-merge": "^5.
|
47
|
+
"webpack-merge": "^5.9.0"
|
48
48
|
<%- end -%>
|
49
49
|
}
|
50
50
|
}
|
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: 1.3.
|
4
|
+
version: 1.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bridgetown Team
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-01-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activemodel
|
@@ -92,6 +92,20 @@ dependencies:
|
|
92
92
|
- - "~>"
|
93
93
|
- !ruby/object:Gem::Version
|
94
94
|
version: '1.0'
|
95
|
+
- !ruby/object:Gem::Dependency
|
96
|
+
name: csv
|
97
|
+
requirement: !ruby/object:Gem::Requirement
|
98
|
+
requirements:
|
99
|
+
- - "~>"
|
100
|
+
- !ruby/object:Gem::Version
|
101
|
+
version: '3.2'
|
102
|
+
type: :runtime
|
103
|
+
prerelease: false
|
104
|
+
version_requirements: !ruby/object:Gem::Requirement
|
105
|
+
requirements:
|
106
|
+
- - "~>"
|
107
|
+
- !ruby/object:Gem::Version
|
108
|
+
version: '3.2'
|
95
109
|
- !ruby/object:Gem::Dependency
|
96
110
|
name: erubi
|
97
111
|
requirement: !ruby/object:Gem::Requirement
|
@@ -578,7 +592,7 @@ metadata:
|
|
578
592
|
changelog_uri: https://github.com/bridgetownrb/bridgetown/releases
|
579
593
|
homepage_uri: https://www.bridgetownrb.com
|
580
594
|
rubygems_mfa_required: 'true'
|
581
|
-
post_install_message:
|
595
|
+
post_install_message:
|
582
596
|
rdoc_options:
|
583
597
|
- "--charset=UTF-8"
|
584
598
|
require_paths:
|
@@ -594,8 +608,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
594
608
|
- !ruby/object:Gem::Version
|
595
609
|
version: '0'
|
596
610
|
requirements: []
|
597
|
-
rubygems_version: 3.
|
598
|
-
signing_key:
|
611
|
+
rubygems_version: 3.2.33
|
612
|
+
signing_key:
|
599
613
|
specification_version: 4
|
600
614
|
summary: A next-generation, progressive site generator & fullstack framework, powered
|
601
615
|
by Ruby
|