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 +4 -4
- data/.github/workflows/ci.yml +3 -4
- data/CHANGELOG.md +7 -0
- data/Gemfile +1 -1
- data/README.md +9 -13
- data/bridgetown-lit-renderer.gemspec +3 -3
- data/lib/bridgetown-lit-renderer/builder.rb +1 -1
- data/lib/bridgetown-lit-renderer/renderer.rb +2 -0
- data/lib/bridgetown-lit-renderer/version.rb +1 -1
- data/package-lock.json +1154 -0
- data/package.json +6 -9
- data/src/{build.js → build.mjs} +12 -5
- metadata +11 -17
- data/yarn.lock +0 -560
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bd593342115c0ed9cf66b160b32765b6956c37c66abc1566760056f0ea495768
|
4
|
+
data.tar.gz: dfb9c7a7995b9e744dc8ab5186bc3b79dfd28924513be143cb82460b2b6aabe9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 97b1817825c5421610227b1b4bfbaf0b45f552ed33c60ee7323264d35f84b87ac82ea503bd538cd2ee533fca46608a2d0e12cc3e3e2ff02dfa459eb0914e23c0
|
7
|
+
data.tar.gz: a2c75fa91ef31d5cdf8f77f0092660d0cdfcf51680b380653033fb2a3ae28ba1defa4e02a3b4fc0ec478032b17be533708aab809224f2c8817c7ba403236b456
|
data/.github/workflows/ci.yml
CHANGED
@@ -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.
|
22
|
+
ruby-version: "3.1"
|
23
23
|
bundler-cache: true
|
24
24
|
- uses: actions/setup-node@v2
|
25
25
|
with:
|
26
|
-
node-version: '
|
27
|
-
cache: 'yarn'
|
26
|
+
node-version: '22'
|
28
27
|
- name: Install NPM packages
|
29
|
-
run:
|
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
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://
|
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
|
-
|
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
|
-
|
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
|
-
$
|
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
|
-
|
46
|
-
|
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
|
-
|
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
|
-
|
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.
|
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 = { "
|
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 = ">=
|
22
|
+
spec.required_ruby_version = ">= 3.1"
|
23
23
|
|
24
|
-
spec.add_dependency "bridgetown", ">=
|
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.
|
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
|
|