bridgetown-core 2.0.0.beta5 → 2.0.0
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/collection.rb +4 -3
- data/lib/bridgetown-core/commands/build.rb +2 -2
- data/lib/bridgetown-core/commands/console.rb +1 -1
- data/lib/bridgetown-core/commands/new.rb +9 -4
- data/lib/bridgetown-core/commands/start.rb +17 -2
- data/lib/bridgetown-core/component.rb +8 -3
- data/lib/bridgetown-core/configuration/configuration_dsl.rb +2 -0
- data/lib/bridgetown-core/configurations/lit/esbuild-plugins.js +15 -16
- data/lib/bridgetown-core/configurations/lit/lit-ssr.config.js +2 -2
- data/lib/bridgetown-core/configurations/lit.rb +4 -4
- data/lib/bridgetown-core/configurations/render/render.yaml.erb +40 -4
- data/lib/bridgetown-core/configurations/render.rb +8 -1
- data/lib/bridgetown-core/converters/markdown/kramdown_parser.rb +2 -0
- data/lib/bridgetown-core/helpers.rb +18 -14
- data/lib/bridgetown-core/log_adapter.rb +1 -1
- data/lib/bridgetown-core/model/base.rb +1 -5
- data/lib/bridgetown-core/plugin_manager.rb +2 -2
- data/lib/bridgetown-core/ruby_template_view.rb +1 -1
- data/lib/bridgetown-core/signals.rb +1 -4
- data/lib/bridgetown-core/static_file.rb +2 -1
- data/lib/bridgetown-core/tasks/bridgetown_tasks.rake +1 -1
- data/lib/roda/plugins/bridgetown_server.rb +9 -1
- data/lib/site_template/config/initializers.rb +2 -0
- data/lib/site_template/config/puma.rb +3 -2
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9889270f38c2b3d048f01c752698f114a7658cc04395dd7661c72bd0b56a7192
|
4
|
+
data.tar.gz: f08f67a0089dbe1cd2e2ace89b4cbff51a70caaf1d46982a0ab85982616e23bb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d21d3bca29c9bb0cccf17fabdd1a66a00b720e72fd1803f48e33dcb8e210f492d16a7d5a517b26b5094bde1ae0507a0f86f9496fe0af810a8e2467908066c646
|
7
|
+
data.tar.gz: c5db97ee273e4f62bfeec5cb63251734bfffc6282eb87bf80a3e79e7c3b8716d5f9fee2b4233185233cae66b71da7aae93d9cab7ccbe2aeba35cd791527c5bd8
|
@@ -325,12 +325,13 @@ module Bridgetown
|
|
325
325
|
alias_method :add_model_resource, :add_resource_from_model
|
326
326
|
|
327
327
|
def sort_resources!
|
328
|
-
|
328
|
+
sort_by_value = metadata["sort_by"]
|
329
|
+
if sort_by_value.is_a?(String) || sort_by_value.is_a?(Symbol)
|
329
330
|
sort_resources_by_key!
|
330
331
|
else
|
331
332
|
resources.sort!
|
332
333
|
end
|
333
|
-
resources.reverse! if metadata.sort_direction == "descending"
|
334
|
+
resources.reverse! if metadata.sort_direction.to_s == "descending"
|
334
335
|
end
|
335
336
|
|
336
337
|
private
|
@@ -342,7 +343,7 @@ module Bridgetown
|
|
342
343
|
# A custom sort function based on Schwartzian transform
|
343
344
|
# Refer https://byparker.com/blog/2017/schwartzian-transform-faster-sorting/ for details
|
344
345
|
def sort_resources_by_key!
|
345
|
-
meta_key = metadata["sort_by"]
|
346
|
+
meta_key = metadata["sort_by"].to_s
|
346
347
|
# Modify array to cache property along with the Resource instance
|
347
348
|
resources.map! { |r| [r.data[meta_key], r] }.sort! do |apples, olives|
|
348
349
|
order = determine_sort_order(meta_key, apples, olives)
|
@@ -29,7 +29,7 @@ module Bridgetown
|
|
29
29
|
# Build your bridgetown site
|
30
30
|
# Continuously watch if `watch` is set to true in the config.
|
31
31
|
def build
|
32
|
-
Bridgetown.logger.adjust_verbosity(options)
|
32
|
+
Bridgetown.logger.adjust_verbosity(**options)
|
33
33
|
|
34
34
|
# @type [Bridgetown::Configuration]
|
35
35
|
config_options = configuration_with_overrides(
|
@@ -97,7 +97,7 @@ module Bridgetown
|
|
97
97
|
ai.ipv4? && !ai.ipv4_loopback?
|
98
98
|
end&.ip_address
|
99
99
|
scheme = config_options.bind&.split("://")&.first == "ssl" ? "https" : "http"
|
100
|
-
port =
|
100
|
+
port = config_options.port
|
101
101
|
Bridgetown.logger.info ""
|
102
102
|
Bridgetown.logger.info "Now serving at:", "#{scheme}://localhost:#{port}".magenta
|
103
103
|
Bridgetown.logger.info "", "#{scheme}://#{external_ip}:#{port}".magenta if external_ip
|
@@ -71,7 +71,7 @@ module Bridgetown
|
|
71
71
|
end
|
72
72
|
require "amazing_print" unless options[:"bypass-ap"]
|
73
73
|
|
74
|
-
Bridgetown.logger.adjust_verbosity(options)
|
74
|
+
Bridgetown.logger.adjust_verbosity(**options)
|
75
75
|
|
76
76
|
Bridgetown.logger.info "Starting:", "Bridgetown v#{Bridgetown::VERSION.magenta} " \
|
77
77
|
"(codename \"#{Bridgetown::CODE_NAME.yellow}\") " \
|
@@ -16,6 +16,11 @@ module Bridgetown
|
|
16
16
|
end
|
17
17
|
summary "Creates a new Bridgetown site scaffold in PATH"
|
18
18
|
|
19
|
+
argument :path,
|
20
|
+
type: :string,
|
21
|
+
required: false, # we're changing for path in new_site method
|
22
|
+
desc: "PATH where new Bridgetown site will be created"
|
23
|
+
|
19
24
|
class_option :apply,
|
20
25
|
aliases: "-a",
|
21
26
|
banner: "PATH|URL",
|
@@ -60,9 +65,9 @@ module Bridgetown
|
|
60
65
|
end
|
61
66
|
|
62
67
|
def new_site
|
63
|
-
raise ArgumentError, "You must specify a path." if
|
68
|
+
raise ArgumentError, "You must specify a path." if path.nil? || path.empty?
|
64
69
|
|
65
|
-
new_site_path = File.expand_path(
|
70
|
+
new_site_path = File.expand_path(path, Dir.pwd)
|
66
71
|
@site_name = new_site_path.split(File::SEPARATOR).last
|
67
72
|
|
68
73
|
if preserve_source_location?(new_site_path, options)
|
@@ -77,7 +82,7 @@ module Bridgetown
|
|
77
82
|
|
78
83
|
say_status :create, new_site_path
|
79
84
|
create_site new_site_path
|
80
|
-
after_install new_site_path,
|
85
|
+
after_install new_site_path, path, options
|
81
86
|
rescue ArgumentError => e
|
82
87
|
say_status :alert, e.message, :red
|
83
88
|
ensure
|
@@ -174,7 +179,7 @@ module Bridgetown
|
|
174
179
|
# unless the user opts to skip 'bundle install'.
|
175
180
|
# rubocop:todo Metrics/CyclomaticComplexity
|
176
181
|
# rubocop:disable Metrics/PerceivedComplexity
|
177
|
-
def after_install(path, cli_path, options
|
182
|
+
def after_install(path, cli_path, options)
|
178
183
|
git_init path
|
179
184
|
|
180
185
|
@skipped_bundle = true # is set to false if bundle install worked
|
@@ -42,7 +42,6 @@ module Bridgetown
|
|
42
42
|
class_option :port,
|
43
43
|
aliases: "-P",
|
44
44
|
type: :numeric,
|
45
|
-
default: 4000,
|
46
45
|
desc: "Serve your site on the specified port. Defaults to 4000."
|
47
46
|
class_option :bind,
|
48
47
|
aliases: "-B",
|
@@ -72,7 +71,7 @@ module Bridgetown
|
|
72
71
|
|
73
72
|
# Load Bridgetown configuration into thread memory
|
74
73
|
bt_options = configuration_with_overrides(options)
|
75
|
-
port =
|
74
|
+
bt_options.port = port = load_env_and_determine_port(bt_options, options)
|
76
75
|
# TODO: support Puma serving HTTPS directly?
|
77
76
|
bt_bound_url = "http://#{bt_options.bind}:#{port}"
|
78
77
|
|
@@ -125,6 +124,22 @@ module Bridgetown
|
|
125
124
|
"config.ru" :
|
126
125
|
File.expand_path("../rack/default_config.ru", __dir__)
|
127
126
|
end
|
127
|
+
|
128
|
+
def load_env_and_determine_port(config, options)
|
129
|
+
initializer_file = File.join(config.root_dir, "config", "initializers.rb")
|
130
|
+
if File.exist?(initializer_file) &&
|
131
|
+
File.read(initializer_file) =~ (%r!^[\s]*init[\s]*:dotenv!)
|
132
|
+
require "dotenv"
|
133
|
+
Bridgetown.load_dotenv(root: config.root_dir)
|
134
|
+
end
|
135
|
+
|
136
|
+
# Options ordering for "who wins" is:
|
137
|
+
# 1. CLI
|
138
|
+
# 2. BRIDGETOWN_PORT env var
|
139
|
+
# 3. YAML config (if present)
|
140
|
+
# 4. 4000
|
141
|
+
options[:port] || ENV.fetch("BRIDGETOWN_PORT", config.port || 4000)
|
142
|
+
end
|
128
143
|
end
|
129
144
|
end
|
130
145
|
end
|
@@ -158,10 +158,15 @@ module Bridgetown
|
|
158
158
|
|
159
159
|
# Provide a render helper for evaluation within the component context.
|
160
160
|
#
|
161
|
-
# @param item [Object] a component supporting `render_in
|
162
|
-
# @param options [Hash] passed to the `partial` helper if needed
|
161
|
+
# @param item [Object] a component supporting `render_in`, a Streamlined proc, or a partial name
|
162
|
+
# @param options [Hash] keyword arguments passed to the `partial` helper if needed
|
163
163
|
# @return [String]
|
164
|
-
def render(item
|
164
|
+
def render(item = nil, **options, &block) # rubocop:disable Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
|
165
|
+
return @_rbout if !block && options.empty? && item.nil?
|
166
|
+
|
167
|
+
# Defer to Streamline's rendering logic in this case
|
168
|
+
return super if item.is_a?(Proc) || (block && item.nil?)
|
169
|
+
|
165
170
|
if item.respond_to?(:render_in)
|
166
171
|
result = ""
|
167
172
|
capture do # this ensures no leaky interactions between BT<=>VC blocks
|
@@ -4,21 +4,20 @@
|
|
4
4
|
|
5
5
|
// This plugin will let you import `.lit.css` files as sidecar stylesheets.
|
6
6
|
// Read https://www.bridgetownrb.com/docs/components/lit#sidecar-css-files for documentation.
|
7
|
-
|
8
|
-
|
9
|
-
const postcss = require("postcss")
|
7
|
+
import { litCssPlugin } from "esbuild-plugin-lit-css"
|
8
|
+
import postcss from "postcss"
|
10
9
|
|
11
|
-
|
12
|
-
plugins: [
|
13
|
-
litCssPlugin({
|
14
|
-
filter: /\.lit\.css$/,
|
15
|
-
transform: async (css, { filePath }) => {
|
16
|
-
const postCssConfig = await postcssrc()
|
17
|
-
const postCssProcessor = postcss([...postCssConfig.plugins])
|
10
|
+
const postcssrc = (await import("postcss-load-config")).default
|
18
11
|
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
})
|
23
|
-
|
24
|
-
|
12
|
+
export const plugins = [
|
13
|
+
litCssPlugin({
|
14
|
+
filter: /\.lit\.css$/,
|
15
|
+
transform: async (css, { filePath }) => {
|
16
|
+
const postCssConfig = await postcssrc()
|
17
|
+
const postCssProcessor = postcss([...postCssConfig.plugins])
|
18
|
+
|
19
|
+
const results = await postCssProcessor.process(css, { ...postCssConfig.options, from: filePath })
|
20
|
+
return results.css
|
21
|
+
}
|
22
|
+
}),
|
23
|
+
]
|
@@ -11,19 +11,19 @@ end
|
|
11
11
|
|
12
12
|
say_status :lit, "Installing Lit + SSR Plugin..."
|
13
13
|
|
14
|
-
add_gem "bridgetown-lit-renderer", version: "
|
14
|
+
add_gem "bridgetown-lit-renderer", version: "3.0.0"
|
15
15
|
|
16
|
-
add_npm_package "lit esbuild-plugin-lit-css bridgetown-lit-renderer@
|
16
|
+
add_npm_package "lit esbuild-plugin-lit-css bridgetown-lit-renderer@3.0.0"
|
17
17
|
|
18
18
|
copy_file in_templates_dir("lit-ssr.config.js"), "config/lit-ssr.config.js"
|
19
19
|
copy_file in_templates_dir("lit-components-entry.js"), "config/lit-components-entry.js"
|
20
20
|
copy_file in_templates_dir("esbuild-plugins.js"), "config/esbuild-plugins.js"
|
21
21
|
|
22
22
|
insert_into_file "esbuild.config.js",
|
23
|
-
after: '
|
23
|
+
after: 'import build from "./config/esbuild.defaults.js"' do
|
24
24
|
<<~JS
|
25
25
|
|
26
|
-
|
26
|
+
import { plugins } from "./config/esbuild-plugins.js"
|
27
27
|
JS
|
28
28
|
end
|
29
29
|
|
@@ -1,13 +1,10 @@
|
|
1
1
|
services:
|
2
2
|
- type: web
|
3
3
|
name: <%= @render_service_name %>
|
4
|
-
|
4
|
+
runtime: static
|
5
5
|
buildCommand: bin/bridgetown deploy
|
6
6
|
staticPublishPath: ./output
|
7
7
|
pullRequestPreviewsEnabled: true
|
8
|
-
envVars:
|
9
|
-
- key: BRIDGETOWN_ENV
|
10
|
-
value: production
|
11
8
|
headers:
|
12
9
|
- path: /*
|
13
10
|
name: X-Frame-Options
|
@@ -27,3 +24,42 @@ services:
|
|
27
24
|
- path: /*
|
28
25
|
name: Cache-Control
|
29
26
|
value: "public, max-age=86400, s-max-age=86400"
|
27
|
+
envVars:
|
28
|
+
- key: BRIDGETOWN_ENV
|
29
|
+
value: production
|
30
|
+
###########
|
31
|
+
# Uncomment and modify the following for hybrid deployments, database support, etc.
|
32
|
+
# Use the `routes` rewrite feature to "poke holes" through your static CDN to specific
|
33
|
+
# route handlers in your Roda server application.
|
34
|
+
###########
|
35
|
+
#
|
36
|
+
# - key: DATABASE_URL
|
37
|
+
# fromDatabase:
|
38
|
+
# name: <%= @render_service_name %>_proddb
|
39
|
+
# property: connectionString
|
40
|
+
# - fromGroup: <%= @render_service_name %>-prod-envs
|
41
|
+
# routes:
|
42
|
+
# - type: rewrite
|
43
|
+
# source: /account/*
|
44
|
+
# destination: https://<%= @render_service_name %>-api.onrender.com/account/*
|
45
|
+
# - type: rewrite
|
46
|
+
# source: /auth/*
|
47
|
+
# destination: https://<%= @render_service_name %>-api.onrender.com/auth/*
|
48
|
+
# - type: web
|
49
|
+
# name: <%= @render_service_name %>-api
|
50
|
+
# plan: standard
|
51
|
+
# runtime: ruby
|
52
|
+
# buildCommand: bundle install && npm install && bin/bridgetown frontend:build
|
53
|
+
# startCommand: bin/bridgetown start
|
54
|
+
# envVars:
|
55
|
+
# - key: BRIDGETOWN_ENV
|
56
|
+
# value: production
|
57
|
+
# - key: DATABASE_URL
|
58
|
+
# fromDatabase:
|
59
|
+
# name: <%= @render_service_name %>_proddb
|
60
|
+
# property: connectionString
|
61
|
+
# - fromGroup: <%= @render_service_name %>-prod-envs
|
62
|
+
# databases:
|
63
|
+
# - name: <%= @render_service_name %>_proddb
|
64
|
+
# plan: starter
|
65
|
+
# databaseName: <%= @render_service_name %>_production
|
@@ -3,4 +3,11 @@
|
|
3
3
|
@render_service_name = ask "What would like to call your Render service?"
|
4
4
|
template in_templates_dir("render.yaml.erb"), "render.yaml"
|
5
5
|
|
6
|
-
|
6
|
+
say_status :render, "Your render.yaml file is now configured!"
|
7
|
+
say ""
|
8
|
+
say "Verify its contents and once ready, create a new blueprint from the Render dashboard"
|
9
|
+
say "and connect your repo."
|
10
|
+
say ""
|
11
|
+
say "Optionally, if you're setting up a backend API and database, create a environment group"
|
12
|
+
say "on Render called [yourservicehere]-prod-envs for sharing environment variables between"
|
13
|
+
say "multiple servers."
|
@@ -45,6 +45,8 @@ module Kramdown
|
|
45
45
|
end
|
46
46
|
|
47
47
|
def initialize(source, options = {}) # rubocop:disable Lint/MissingSuper
|
48
|
+
# NOTE: keep `options = {}` instead of the newer `**options` for Kramdown compatibility
|
49
|
+
|
48
50
|
BridgetownDocument.setup(options)
|
49
51
|
|
50
52
|
@options = BridgetownDocument.options
|
@@ -6,6 +6,7 @@ module Bridgetown
|
|
6
6
|
class RubyTemplateView
|
7
7
|
class Helpers
|
8
8
|
using Bridgetown::Refinements
|
9
|
+
include Bridgetown::Refinements::Helper
|
9
10
|
include Bridgetown::Filters
|
10
11
|
include Bridgetown::Filters::FromLiquid
|
11
12
|
include ::Streamlined::Helpers
|
@@ -109,12 +110,11 @@ module Bridgetown
|
|
109
110
|
# @param text [String] the content inside the anchor tag
|
110
111
|
# @param relative_path [String, Object] source file path, e.g.
|
111
112
|
# "_posts/2020-10-20-my-post.md", or object that responds to `url`
|
112
|
-
# @param options [Hash]
|
113
|
+
# @param options [Hash] pass keyword arguments to add HTML attributes
|
113
114
|
# @return [String] the anchor tag HTML
|
114
115
|
# @raise [ArgumentError] if the file cannot be found
|
115
|
-
def link_to(text, relative_path = nil, options
|
116
|
+
def link_to(text, relative_path = nil, **options, &block)
|
116
117
|
if block.present?
|
117
|
-
options = relative_path || {}
|
118
118
|
relative_path = text
|
119
119
|
text = view.respond_to?(:capture) ? view.capture(&block) : yield
|
120
120
|
elsif relative_path.nil?
|
@@ -128,12 +128,10 @@ module Bridgetown
|
|
128
128
|
# Provide backwards compatibility via Streamlined helper
|
129
129
|
alias_method :attributes_from_options, :html_attributes
|
130
130
|
|
131
|
-
# Delegates to
|
132
|
-
# functions.
|
131
|
+
# Delegates to `I18n#translate` but with some additional smarts.
|
133
132
|
#
|
134
|
-
#
|
135
|
-
# the
|
136
|
-
# the <tt>people/index.html.erb</tt> template is equivalent to calling
|
133
|
+
# You can scope to the current view. Calling <tt>translate(".foo")</tt> from
|
134
|
+
# the <tt>people/index.erb</tt> template is equivalent to calling
|
137
135
|
# <tt>translate("people.index.foo")</tt>. This makes it less
|
138
136
|
# repetitive to translate many keys within the same view and provides
|
139
137
|
# a convention to scope keys consistently.
|
@@ -149,14 +147,14 @@ module Bridgetown
|
|
149
147
|
#
|
150
148
|
# @return [String] the translated string
|
151
149
|
# @see I18n
|
152
|
-
def translate(key, **options)
|
150
|
+
def translate(key, **options)
|
153
151
|
return key.map { |k| translate(k, **options) } if key.is_a?(Array)
|
154
152
|
|
155
153
|
key = key&.to_s
|
156
154
|
|
157
155
|
if key&.start_with?(".")
|
158
|
-
view_path = view
|
159
|
-
key = "#{view_path.tr("/", ".")}#{key}"
|
156
|
+
view_path = Bridgetown::Filters::URLFilters.strip_extname(view.resource.relative_path)
|
157
|
+
key = "#{view_path.tr("_/", " .").lstrip}#{key}"
|
160
158
|
end
|
161
159
|
|
162
160
|
return I18n.translate(key, **options) unless %r{(?:_|\b)html\z}.match?(key)
|
@@ -265,14 +263,19 @@ module Bridgetown
|
|
265
263
|
end
|
266
264
|
end
|
267
265
|
|
268
|
-
#
|
266
|
+
# Output a declarative shadow DOM tag to wrap the input argument or block
|
267
|
+
#
|
268
|
+
# @param input [String] content to wrap if block isn't provided
|
269
|
+
# @return [String]
|
269
270
|
def dsd(input = nil, &block)
|
270
271
|
tmpl_content = block.nil? ? input.to_s : view.capture(&block)
|
271
272
|
|
272
273
|
Bridgetown::Utils.dsd_tag(tmpl_content)
|
273
274
|
end
|
274
275
|
|
275
|
-
#
|
276
|
+
# Load a sidecar CSS file with a .dsd.css extension and output a style tag
|
277
|
+
#
|
278
|
+
# @return [String]
|
276
279
|
def dsd_style
|
277
280
|
tmpl_path = caller_locations(1, 2).find do |loc|
|
278
281
|
loc.label.include?("method_missing").!
|
@@ -293,7 +296,8 @@ module Bridgetown
|
|
293
296
|
style_tag.html_safe
|
294
297
|
end
|
295
298
|
|
296
|
-
#
|
299
|
+
# If you need to access signals without creating a tracking dependency, wrap a
|
300
|
+
# block of code in this helper
|
297
301
|
def bypass_tracking(...) = Signalize.untracked(...)
|
298
302
|
end
|
299
303
|
end
|
@@ -145,11 +145,7 @@ module Bridgetown
|
|
145
145
|
return attributes[method_name] if attributes.key?(method_name)
|
146
146
|
|
147
147
|
key = method_name.to_s
|
148
|
-
if key.end_with?("=")
|
149
|
-
key.chop!
|
150
|
-
attributes[key] = args.first
|
151
|
-
return attributes[key]
|
152
|
-
end
|
148
|
+
return attributes[key.chop] = args.first if key.end_with?("=")
|
153
149
|
|
154
150
|
Bridgetown.logger.warn "key `#{method_name}' not found in attributes for " \
|
155
151
|
"#{attributes[:id].presence || "new #{self.class}"}"
|
@@ -102,7 +102,7 @@ module Bridgetown
|
|
102
102
|
|
103
103
|
# rubocop:disable Metrics/PerceivedComplexity, Metrics/CyclomaticComplexity
|
104
104
|
|
105
|
-
# Iterates through loaded gems and finds
|
105
|
+
# Iterates through loaded gems and finds npm_add gemspec metadata.
|
106
106
|
# If that exact package hasn't been installed, execute npm i
|
107
107
|
#
|
108
108
|
# @return [Bundler::SpecSet]
|
@@ -134,7 +134,7 @@ module Bridgetown
|
|
134
134
|
end
|
135
135
|
|
136
136
|
def self.find_npm_dependency(loaded_gem)
|
137
|
-
npm_metadata = loaded_gem.to_spec&.metadata&.dig("
|
137
|
+
npm_metadata = loaded_gem.to_spec&.metadata&.dig("npm_add") ||
|
138
138
|
loaded_gem.to_spec&.metadata&.dig("yarn-add")
|
139
139
|
npm_dependency = npm_metadata&.match(NPM_DEPENDENCY_REGEXP)
|
140
140
|
return nil if npm_dependency&.length != 3 || npm_dependency[2] == ""
|
@@ -59,7 +59,7 @@ module Bridgetown
|
|
59
59
|
end
|
60
60
|
end
|
61
61
|
|
62
|
-
def liquid_render(component, options
|
62
|
+
def liquid_render(component, **options, &block)
|
63
63
|
options[:_block_content] = capture(&block) if block && respond_to?(:capture)
|
64
64
|
render_statement = _render_statement(component, options)
|
65
65
|
|
@@ -55,10 +55,7 @@ class Bridgetown::Signals < Signalize::Struct
|
|
55
55
|
return nil if value.empty? && block.nil?
|
56
56
|
|
57
57
|
key = key.to_s
|
58
|
-
if key.end_with?("=")
|
59
|
-
key.chop!
|
60
|
-
return self[key] = value[0]
|
61
|
-
end
|
58
|
+
return self[key.chop] = value[0] if key.end_with?("=")
|
62
59
|
|
63
60
|
super(key.to_sym)
|
64
61
|
end
|
@@ -166,7 +166,7 @@ module Bridgetown
|
|
166
166
|
|
167
167
|
# Applies a similar URL-building technique as resources that takes
|
168
168
|
# the collection's URL template into account. The default URL template can
|
169
|
-
# be
|
169
|
+
# be overridden in the collection's configuration
|
170
170
|
def url
|
171
171
|
@url ||= begin
|
172
172
|
newly_processed = false
|
@@ -179,6 +179,7 @@ module Bridgetown
|
|
179
179
|
newly_processed ? base : "#{base}#{extname}"
|
180
180
|
end
|
181
181
|
end
|
182
|
+
alias_method :relative_url, :url
|
182
183
|
|
183
184
|
# @return [Symbol, nil] type of the collection if present
|
184
185
|
def type
|
@@ -11,7 +11,7 @@ namespace :frontend do
|
|
11
11
|
task :watcher, :sidecar do |_task, args|
|
12
12
|
# sidecar is when the task is running alongside the start command
|
13
13
|
sidecar = args[:sidecar] == true
|
14
|
-
Bridgetown::Utils::Aux.run_process "Frontend", :
|
14
|
+
Bridgetown::Utils::Aux.run_process "Frontend", :blue, "bridgetown frontend:dev"
|
15
15
|
|
16
16
|
if sidecar
|
17
17
|
# give FE bundler time to boot before returning control to the start command
|
@@ -102,6 +102,8 @@ class Roda
|
|
102
102
|
end
|
103
103
|
|
104
104
|
module InstanceMethods
|
105
|
+
include Bridgetown::Refinements::Helper
|
106
|
+
|
105
107
|
def initialize_bridgetown_context
|
106
108
|
if self.class.opts[:bridgetown_site]
|
107
109
|
# The site had previously been initialized via the bridgetown_ssr plugin
|
@@ -157,9 +159,15 @@ class Roda
|
|
157
159
|
scope.initialize_bridgetown_root
|
158
160
|
|
159
161
|
base_path = Bridgetown::Current.preloaded_configuration.base_path.delete_prefix("/")
|
160
|
-
|
162
|
+
|
163
|
+
if base_path.empty?
|
161
164
|
ssg # static file server
|
162
165
|
Bridgetown::Rack::Routes.load_all scope
|
166
|
+
else
|
167
|
+
on(base_path) do
|
168
|
+
ssg # static file server
|
169
|
+
Bridgetown::Rack::Routes.load_all scope
|
170
|
+
end
|
163
171
|
end
|
164
172
|
end
|
165
173
|
end
|
@@ -76,6 +76,8 @@ Bridgetown.configure do |config|
|
|
76
76
|
#
|
77
77
|
# init :"bridgetown-routes"
|
78
78
|
#
|
79
|
+
# NOTE: you can remove `init :ssr` if you load this initializer
|
80
|
+
#
|
79
81
|
|
80
82
|
# We also recommend that if you're using Roda routes you include this plugin
|
81
83
|
# so you can get a generated routes list in `.routes.json`. You can then run
|
@@ -2,9 +2,10 @@
|
|
2
2
|
#
|
3
3
|
# Learn more at: https://puma.io
|
4
4
|
# Bridgetown configuration documentation:
|
5
|
-
# https://
|
5
|
+
# https://www.bridgetownrb.com/docs/configuration/puma
|
6
6
|
|
7
|
-
# This port number
|
7
|
+
# This port number typically gets overridden by Bridgetown's boot & config loader
|
8
|
+
# so you probably don't want to touch the number here
|
8
9
|
#
|
9
10
|
port ENV.fetch("BRIDGETOWN_PORT") { 4000 }
|
10
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: 2.0.0
|
4
|
+
version: 2.0.0
|
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-
|
11
|
+
date: 2025-09-16 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.0
|
67
|
+
version: 2.0.0
|
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.0
|
74
|
+
version: 2.0.0
|
75
75
|
- !ruby/object:Gem::Dependency
|
76
76
|
name: csv
|
77
77
|
requirement: !ruby/object:Gem::Requirement
|
@@ -668,9 +668,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
668
668
|
version: 3.1.0
|
669
669
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
670
670
|
requirements:
|
671
|
-
- - "
|
671
|
+
- - ">="
|
672
672
|
- !ruby/object:Gem::Version
|
673
|
-
version:
|
673
|
+
version: '0'
|
674
674
|
requirements: []
|
675
675
|
rubygems_version: 3.3.26
|
676
676
|
signing_key:
|