bridgetown-lit-renderer 2.1.0.beta2 → 3.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e5ebf95cd7904248fbadc134cbf89053b21ad991f625ee767337219e48286367
4
- data.tar.gz: 33ee760e46eb42fbc12f07c83614e86f9246c87580f48ed344a28c365ac58f85
3
+ metadata.gz: bd593342115c0ed9cf66b160b32765b6956c37c66abc1566760056f0ea495768
4
+ data.tar.gz: dfb9c7a7995b9e744dc8ab5186bc3b79dfd28924513be143cb82460b2b6aabe9
5
5
  SHA512:
6
- metadata.gz: 515c90792dd3b3faad5f193ebbfa68eab4ef711962fb82582cac94efe4ec3bfd3029db95714f5d675b1df5b07b6057d467ab4ca425beae90c98cccd3e76a49fd
7
- data.tar.gz: f0c6451c6eab9fd938235648af7938e9cb6ecbe017f5a281ff73839ac0a0f59a241c16d056641b7bdc514dec6f85cf5decd8e976ed904fedcb1d53d6a2bda8b8
6
+ metadata.gz: 97b1817825c5421610227b1b4bfbaf0b45f552ed33c60ee7323264d35f84b87ac82ea503bd538cd2ee533fca46608a2d0e12cc3e3e2ff02dfa459eb0914e23c0
7
+ data.tar.gz: a2c75fa91ef31d5cdf8f77f0092660d0cdfcf51680b380653033fb2a3ae28ba1defa4e02a3b4fc0ec478032b17be533708aab809224f2c8817c7ba403236b456
@@ -19,13 +19,12 @@ jobs:
19
19
  - name: Set up Ruby and Yarn
20
20
  uses: ruby/setup-ruby@v1
21
21
  with:
22
- ruby-version: "3.0"
22
+ ruby-version: "3.1"
23
23
  bundler-cache: true
24
24
  - uses: actions/setup-node@v2
25
25
  with:
26
- node-version: '16'
27
- cache: 'yarn'
26
+ node-version: '22'
28
27
  - name: Install NPM packages
29
- run: yarn install
28
+ run: npm install
30
29
  - name: Run tests
31
30
  run: script/cibuild
data/CHANGELOG.md CHANGED
@@ -7,6 +7,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [3.0.0] - 2025-09-15
11
+
12
+ - Bridgetown 2.0 support
13
+ - Convert build script to ESM
14
+ - Update various dependencies
15
+ - Remove DSD polyfill (it's available in all browsers now)
16
+
10
17
  ## [2.1.0.beta2] - 2023-06-18
11
18
 
12
19
  - Bug fixes based on QA
data/Gemfile CHANGED
@@ -3,7 +3,7 @@
3
3
  source "https://rubygems.org"
4
4
  gemspec
5
5
 
6
- gem "bridgetown", ENV["BRIDGETOWN_VERSION"] if ENV["BRIDGETOWN_VERSION"]
6
+ gem "bridgetown", ENV.fetch("BRIDGETOWN_VERSION", "2.0.0.beta6")
7
7
 
8
8
  group :test do
9
9
  gem "minitest"
data/README.md CHANGED
@@ -9,26 +9,26 @@ This [Bridgetown](https://www.bridgetownrb.com) plugin provides you with an easy
9
9
 
10
10
  ## Documentation
11
11
 
12
- **[The official documentation is now available on the Bridgetown website.](https://edge.bridgetownrb.com/docs/components/lit)**
12
+ **[The official documentation is now available on the Bridgetown website.](https://www.bridgetownrb.com/docs/components/lit)**
13
13
 
14
14
  [Check out the demo site repo.](https://github.com/bridgetownrb/lit-renderer-example)
15
15
 
16
16
  ## Installation
17
17
 
18
- Starting in Bridgetown v1.1, you can install this plugin via a bundled configuration:
18
+ You should likely install this plugin via its bundled configuration:
19
19
 
20
20
  ```shell
21
21
  $ bin/bridgetown configure lit
22
22
  ```
23
23
 
24
- For a manual installation overview (Bridgetown 1.2+):
24
+ However, for a manual installation overview (Bridgetown 1.2+):
25
25
 
26
26
  Run this command to add this plugin to your site's Gemfile, along with JavaScript packages for Lit and SSR support:
27
27
 
28
28
  ```shell
29
29
  $ bundle add bridgetown-lit-renderer
30
30
 
31
- $ yarn add lit bridgetown-lit-renderer
31
+ $ npm i lit bridgetown-lit-renderer
32
32
  ```
33
33
 
34
34
  Then add the initializer to your configuration in `config/initializers.rb`:
@@ -37,13 +37,11 @@ Then add the initializer to your configuration in `config/initializers.rb`:
37
37
  init :"bridgetown-lit-renderer"
38
38
  ```
39
39
 
40
- (For Bridgetown 1.1 or earlier, [read these instructions](https://github.com/bridgetownrb/bridgetown-lit-renderer/tree/v2.0.0.beta3).)
41
-
42
40
  Create a file in `config/lit-ssr.config.js` with the following:
43
41
 
44
42
  ```js
45
- const build = require("bridgetown-lit-renderer/build")
46
- const { plugins } = require("./esbuild-plugins.js")
43
+ import build from "../../../src/build.mjs"
44
+ import { plugins } from "./esbuild-plugins.js"
47
45
 
48
46
  const esbuildOptions = { plugins }
49
47
 
@@ -54,16 +52,14 @@ and `config/esbuild-plugins.js`:
54
52
 
55
53
  ```js
56
54
  // You can add esbuild plugins here you wish to share between the frontend bundles and Lit SSR:
57
- module.exports = {
58
- plugins: []
59
- }
55
+ export const plugins = []
60
56
  ```
61
57
 
62
58
  and if you're using esbuild for your Bridgetown site, modify `esbuild.config.js``:
63
59
 
64
60
  ```js
65
61
  // at the top of your file:
66
- const { plugins } = require("./config/esbuild-plugins.js")
62
+ import { plugins } from "./config/esbuild-plugins.js"
67
63
 
68
64
  const esbuildOptions = {
69
65
  // other options
@@ -126,7 +122,7 @@ you should be doing this:
126
122
  <% end %>
127
123
  ```
128
124
 
129
- **Disabling hydration?** If for some reason you can't permit a `hydrate-root` element to wrap a Lit code block, you can pass a `hydrate_root: false` argument to the `lit` helper. This breaks hydration however, and likewise the [Declarative Shadow DOM (DSD)](https://web.dev/declarative-shadow-dom/) polyfill won't be loaded. (Currently DSD is only supported natively in Chromium-based browsers such as Chrome, Edge, and Brave.) It will thus be up to you to manage those features as you see fit.
125
+ **Disabling hydration?** If for some reason you can't permit a `hydrate-root` element to wrap a Lit code block, you can pass a `hydrate_root: false` argument to the `lit` helper. This breaks hydration however, and likewise the [Declarative Shadow DOM (DSD)](https://web.dev/declarative-shadow-dom/) polyfill won't be loaded. It will thus be up to you to manage those features as you see fit.
130
126
 
131
127
  ## Testing
132
128
 
@@ -16,12 +16,12 @@ Gem::Specification.new do |spec|
16
16
  end
17
17
  spec.test_files = spec.files.grep(%r!^test/!)
18
18
  spec.require_paths = ["lib"]
19
- spec.metadata = { "yarn-add" => "bridgetown-lit-renderer@#{BridgetownLitRenderer::VERSION.sub(".beta", "-beta")}",
19
+ spec.metadata = { "npm_add" => "bridgetown-lit-renderer@#{BridgetownLitRenderer::VERSION.sub(".beta", "-beta")}",
20
20
  "rubygems_mfa_required" => "true", }
21
21
 
22
- spec.required_ruby_version = ">= 2.7.0"
22
+ spec.required_ruby_version = ">= 3.1"
23
23
 
24
- spec.add_dependency "bridgetown", ">= 1.3.0.beta2", "< 2.0"
24
+ spec.add_dependency "bridgetown", ">= 2.0.0.beta6"
25
25
  spec.add_dependency "random-port", ">= 0.5"
26
26
 
27
27
  spec.add_development_dependency "bundler"
@@ -21,7 +21,7 @@ module BridgetownLitRenderer
21
21
  process_tag = ->(tag, attributes, code) do
22
22
  valid_tag = tag.to_s.tr("_", "-")
23
23
  segments = ["<#{valid_tag}"]
24
- attributes.each do |attr, _|
24
+ attributes.each_key do |attr|
25
25
  attr = attr.to_s.tr("_", "-")
26
26
  segments << %( #{attr}="${data.#{attr}}")
27
27
  end
@@ -95,11 +95,13 @@ module BridgetownLitRenderer
95
95
  output = call_http_server("const data = #{data.to_json}; #{built_code}")
96
96
 
97
97
  if output == "SCRIPT NOT VALID!"
98
+ # rubocop:disable Bridgetown/InsecureHeredoc
98
99
  output = <<~HTML
99
100
  <ssr-error style="display:block; padding:0.3em 0.5em; color:white; background:maroon; font-weight:bold">
100
101
  Lit SSR error in #{entry}, see logs
101
102
  </ssr-error>
102
103
  HTML
104
+ # rubocop:enable Bridgetown/InsecureHeredoc
103
105
  cache.delete(cache_key)
104
106
  end
105
107
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module BridgetownLitRenderer
4
- VERSION = "2.1.0.beta2"
4
+ VERSION = "3.0.0"
5
5
  end