bridgetown-core 1.3.2 → 1.3.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: 556799feca958f64e151dff3c039cc98240bc611a60cf650e3658f50490dcf79
4
- data.tar.gz: 74bed3c07355d9b54107ce92334a0cf32a4d8909dd002efdeb4cbf6b0a729128
3
+ metadata.gz: bb150e09ad6d4f40f0f5cd7a636b19b4ff0d40922d31601f33c67a98e7ffd24b
4
+ data.tar.gz: '02795bee7a4b0ec92ef8fd8d2c61c2295e9882e145e023a2de697a56a3b3a4a4'
5
5
  SHA512:
6
- metadata.gz: 8617f84687052ac6ed4b2413bbb4418fc3a332395fd647902379e75e4d22857d43a49edb30b8dbbb8aad7fe067412ad6c397fe0a05fd73ab5b3d3ea6866a7c55
7
- data.tar.gz: 6c60464867cfb5fe8baf9e86d983a5392075a92f278f30499c68e1a1dec58b3be53991b7725b31de0c445f4afd448ca0056aa1841ecce79b2daa857c5cb43f6f
6
+ metadata.gz: 94f8313458630933d419a4b001a9da01328c92a0668068198a6b84330ce79e37dde9d6dffcb6db5d56596c243ca1740ab7e04045fabaf608e3ee8ca36be5742f
7
+ data.tar.gz: 7ebe8c1ae5bbdd275b31d321fd8d3c9d007abd3679e8b9d61fc370970470830c60373b7ea84dad8a1c043461d38fa1ee90747bb0df2c9d1c033fccf8f747db60
@@ -44,11 +44,11 @@ Gem::Specification.new do |s|
44
44
  s.add_runtime_dependency("i18n", "~> 1.0")
45
45
  s.add_runtime_dependency("kramdown", "~> 2.1")
46
46
  s.add_runtime_dependency("kramdown-parser-gfm", "~> 1.0")
47
- s.add_runtime_dependency("liquid", "~> 5.0")
47
+ s.add_runtime_dependency("liquid", [">= 5.0", "< 5.5"])
48
48
  s.add_runtime_dependency("listen", "~> 3.0")
49
49
  s.add_runtime_dependency("rake", ">= 13.0")
50
50
  s.add_runtime_dependency("roda", "~> 3.46")
51
- s.add_runtime_dependency("rouge", "~> 3.0")
51
+ s.add_runtime_dependency("rouge", [">= 3.0", "< 5.0"])
52
52
  s.add_runtime_dependency("serbea", "~> 1.0")
53
53
  s.add_runtime_dependency("thor", "~> 1.1")
54
54
  s.add_runtime_dependency("tilt", "~> 2.0")
@@ -2,17 +2,11 @@
2
2
 
3
3
  module Bridgetown
4
4
  module ConsoleMethods
5
- def site
6
- Bridgetown::Current.site
7
- end
8
-
9
- def collections
10
- site.collections
11
- end
12
-
13
5
  def reload!
14
6
  Bridgetown.logger.info "Reloading site..."
15
7
 
8
+ site = Bridgetown::Current.site
9
+
16
10
  I18n.reload! # make sure any locale files get read again
17
11
  Bridgetown::Hooks.trigger :site, :pre_reload, site
18
12
  Bridgetown::Hooks.clear_reloadable_hooks
@@ -99,6 +93,8 @@ module Bridgetown
99
93
  IRB::ExtendCommandBundle.include ConsoleMethods
100
94
  IRB.setup(nil)
101
95
  workspace = IRB::WorkSpace.new
96
+ workspace.main.define_singleton_method(:site) { Bridgetown::Current.site }
97
+ workspace.main.define_singleton_method(:collections) { site.collections }
102
98
  irb = IRB::Irb.new(workspace)
103
99
  IRB.conf[:IRB_RC]&.call(irb.context)
104
100
  IRB.conf[:MAIN_CONTEXT] = irb.context
@@ -323,9 +323,13 @@ module.exports = async (esbuildOptions, ...args) => {
323
323
  bundle: true,
324
324
  loader: {
325
325
  ".jpg": "file",
326
+ ".jpeg": "file",
326
327
  ".png": "file",
327
328
  ".gif": "file",
328
329
  ".svg": "file",
330
+ ".avif": "file",
331
+ ".jxl": "file",
332
+ ".webp": "file",
329
333
  ".woff": "file",
330
334
  ".woff2": "file",
331
335
  ".ttf": "file",
@@ -6,5 +6,5 @@
6
6
  "$javascript/*": ["./frontend/javascript/*"],
7
7
  "$components/*": ["./src/_components/*"]
8
8
  }
9
- },
9
+ },
10
10
  }
@@ -1,5 +1,17 @@
1
+ [dev]
2
+ command = "bin/bridgetown dev"
3
+ targetPort = 4000
4
+ port = 8888
5
+ publish = "output"
6
+ autoLaunch = true
7
+ framework = "#custom"
8
+
9
+ [context.dev.build.environment]
10
+ NODE_ENV = "development"
11
+ BRIDGETOWN_ENV = "development"
12
+
1
13
  [build]
2
- command = "bin/bridgetown deploy && bin/netlify.sh"
14
+ command = "bin/bridgetown deploy"
3
15
  publish = "output"
4
16
 
5
17
  [build.environment]
@@ -19,14 +31,6 @@
19
31
  Referrer-Policy = "no-referrer-when-downgrade"
20
32
  Cache-Control = "public, max-age=604800, s-max-age=604800"
21
33
 
22
- [[headers]]
23
- for = "/"
24
- [headers.values]
25
- Link = [
26
- "<CSS_PATH>; rel=preload; as=style",
27
- "<JS_PATH>; rel=preload; as=script"
28
- ]
29
-
30
34
  [[headers]]
31
35
  for = "/*.(png|jpg|js|css|svg|woff|ttf|eot|ico|woff2)"
32
36
  [headers.values]
@@ -1,5 +1,3 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  copy_file in_templates_dir("netlify.toml"), "netlify.toml"
4
- copy_file in_templates_dir("netlify.sh"), "bin/netlify.sh"
5
- `chmod a+x ./bin/netlify.sh`
@@ -37,8 +37,8 @@ append_to_file(File.join(javascript_dir, "index.js")) do
37
37
  if (filename.includes("_controller.") || filename.includes("-controller.")) {
38
38
  const identifier = filename.replace("./controllers/", "")
39
39
  .replace(/[_-]controller\\..*$/, "")
40
- .replace("_", "-")
41
- .replace("/", "--")
40
+ .replace(/_/g, "-")
41
+ .replace(/\\//g, "--")
42
42
 
43
43
  Stimulus.register(identifier, controller.default)
44
44
  }
@@ -1,5 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require "active_support/html_safe_translation"
4
+
3
5
  module Bridgetown
4
6
  class RubyTemplateView
5
7
  class Helpers
@@ -128,21 +130,49 @@ module Bridgetown
128
130
  safe(segments.join(" "))
129
131
  end
130
132
 
131
- # Forward all arguments to I18n.t method
133
+ # Delegates to <tt>I18n#translate</tt> but also performs two additional
134
+ # functions.
135
+ #
136
+ # First, if the key starts with a period <tt>translate</tt> will scope
137
+ # the key by the current view. Calling <tt>translate(".foo")</tt> from
138
+ # the <tt>people/index.html.erb</tt> template is equivalent to calling
139
+ # <tt>translate("people.index.foo")</tt>. This makes it less
140
+ # repetitive to translate many keys within the same view and provides
141
+ # a convention to scope keys consistently.
142
+ #
143
+ # Second, the translation will be marked as <tt>html_safe</tt> if the key
144
+ # has the suffix "_html" or the last element of the key is "html". Calling
145
+ # <tt>translate("footer_html")</tt> or <tt>translate("footer.html")</tt>
146
+ # will return an HTML safe string that won't be escaped by other HTML
147
+ # helper methods. This naming convention helps to identify translations
148
+ # that include HTML tags so that you know what kind of output to expect
149
+ # when you call translate in a template and translators know which keys
150
+ # they can provide HTML values for.
132
151
  #
133
152
  # @return [String] the translated string
134
153
  # @see I18n
135
- def t(*args, **kwargs)
136
- I18n.send :t, *args, **kwargs
154
+ def translate(key, **options) # rubocop:disable Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
155
+ return key.map { |k| translate(k, **options) } if key.is_a?(Array)
156
+
157
+ key = key&.to_s
158
+
159
+ if key&.start_with?(".")
160
+ view_path = view&.page&.relative_path&.to_s&.split(".")&.first
161
+ key = "#{view_path.tr("/", ".")}#{key}" if view_path.present?
162
+ end
163
+
164
+ ActiveSupport::HtmlSafeTranslation.translate(key, **options)
137
165
  end
166
+ alias_method :t, :translate
138
167
 
139
- # Forward all arguments to I18n.l method
168
+ # Delegates to <tt>I18n.localize</tt> with no additional functionality.
140
169
  #
141
170
  # @return [String] the localized string
142
171
  # @see I18n
143
- def l(*args, **kwargs)
144
- I18n.send :l, *args, **kwargs
172
+ def localize(...)
173
+ I18n.localize(...)
145
174
  end
175
+ alias_method :l, :localize
146
176
 
147
177
  # For template contexts where ActiveSupport's output safety is loaded, we
148
178
  # can ensure a string has been marked safe
@@ -39,9 +39,11 @@ module Bridgetown
39
39
  end
40
40
 
41
41
  # TODO: this could probably be refactored to work like the above
42
- ActiveSupport::DescendantsTracker.class_variable_get(
43
- :@@direct_descendants
44
- )[value.superclass]&.reject! { _1 == value }
42
+ if ActiveSupport::DescendantsTracker.class_variables.include?(:@@direct_descendants)
43
+ ActiveSupport::DescendantsTracker.class_variable_get(
44
+ :@@direct_descendants
45
+ )[value.superclass]&.reject! { _1 == value }
46
+ end
45
47
  end
46
48
 
47
49
  def setup_loaders(autoload_paths = []) # rubocop:todo Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/MethodLength, Metrics/PerceivedComplexity
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Bridgetown
4
- VERSION = "1.3.2"
4
+ VERSION = "1.3.4"
5
5
  CODE_NAME = "Kelly Butte"
6
6
  end
@@ -1,4 +1,4 @@
1
- module.exports = {
1
+ module.exports = {
2
2
  plugins: {
3
3
  'postcss-flexbugs-fixes': {},
4
4
  'postcss-preset-env': {
@@ -8,4 +8,4 @@ module.exports = {
8
8
  stage: 3
9
9
  }
10
10
  }
11
- }
11
+ }
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.2
4
+ version: 1.3.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bridgetown Team
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-01-02 00:00:00.000000000 Z
11
+ date: 2024-03-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activemodel
@@ -208,16 +208,22 @@ dependencies:
208
208
  name: liquid
209
209
  requirement: !ruby/object:Gem::Requirement
210
210
  requirements:
211
- - - "~>"
211
+ - - ">="
212
212
  - !ruby/object:Gem::Version
213
213
  version: '5.0'
214
+ - - "<"
215
+ - !ruby/object:Gem::Version
216
+ version: '5.5'
214
217
  type: :runtime
215
218
  prerelease: false
216
219
  version_requirements: !ruby/object:Gem::Requirement
217
220
  requirements:
218
- - - "~>"
221
+ - - ">="
219
222
  - !ruby/object:Gem::Version
220
223
  version: '5.0'
224
+ - - "<"
225
+ - !ruby/object:Gem::Version
226
+ version: '5.5'
221
227
  - !ruby/object:Gem::Dependency
222
228
  name: listen
223
229
  requirement: !ruby/object:Gem::Requirement
@@ -264,16 +270,22 @@ dependencies:
264
270
  name: rouge
265
271
  requirement: !ruby/object:Gem::Requirement
266
272
  requirements:
267
- - - "~>"
273
+ - - ">="
268
274
  - !ruby/object:Gem::Version
269
275
  version: '3.0'
276
+ - - "<"
277
+ - !ruby/object:Gem::Version
278
+ version: '5.0'
270
279
  type: :runtime
271
280
  prerelease: false
272
281
  version_requirements: !ruby/object:Gem::Requirement
273
282
  requirements:
274
- - - "~>"
283
+ - - ">="
275
284
  - !ruby/object:Gem::Version
276
285
  version: '3.0'
286
+ - - "<"
287
+ - !ruby/object:Gem::Version
288
+ version: '5.0'
277
289
  - !ruby/object:Gem::Dependency
278
290
  name: serbea
279
291
  requirement: !ruby/object:Gem::Requirement
@@ -415,7 +427,6 @@ files:
415
427
  - lib/bridgetown-core/configurations/lit/lit-ssr.config.js
416
428
  - lib/bridgetown-core/configurations/minitesting.rb
417
429
  - lib/bridgetown-core/configurations/netlify.rb
418
- - lib/bridgetown-core/configurations/netlify/netlify.sh
419
430
  - lib/bridgetown-core/configurations/netlify/netlify.toml
420
431
  - lib/bridgetown-core/configurations/open-props.rb
421
432
  - lib/bridgetown-core/configurations/open-props/variables.css.erb
@@ -1,13 +0,0 @@
1
- #!/usr/bin/env bash
2
- # Taken from https://docs.netlify.com/configure-builds/file-based-configuration/#inject-environment-variable-values
3
-
4
- echo "Updating netlify.toml with references to our built files"
5
-
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
-
9
- echo "CSS Path: ${CSS_PATH}"
10
- echo "JS Path: ${JS_PATH}"
11
-
12
- sed -i s,CSS_PATH,${CSS_PATH},g netlify.toml
13
- sed -i s,JS_PATH,${JS_PATH},g netlify.toml