@cocreate/server-side-render 1.12.7 → 1.12.8
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.
- package/.github/workflows/automated.yml +5 -5
- package/CHANGELOG.md +8 -0
- package/package.json +1 -1
- package/src/index.js +22 -5
|
@@ -22,13 +22,13 @@ jobs:
|
|
|
22
22
|
runs-on: ubuntu-latest
|
|
23
23
|
steps:
|
|
24
24
|
- name: Checkout
|
|
25
|
-
uses: actions/checkout@
|
|
25
|
+
uses: actions/checkout@v4
|
|
26
26
|
- name: Setup Node.js
|
|
27
|
-
uses: actions/setup-node@
|
|
27
|
+
uses: actions/setup-node@v4
|
|
28
28
|
with:
|
|
29
|
-
node-version:
|
|
29
|
+
node-version: 22 # Required for the latest semantic-release plugins
|
|
30
30
|
- name: Semantic Release
|
|
31
|
-
uses: cycjimmy/semantic-release-action@
|
|
31
|
+
uses: cycjimmy/semantic-release-action@v4 # Update to v4 for better Node 20+ support
|
|
32
32
|
id: semantic
|
|
33
33
|
with:
|
|
34
34
|
extra_plugins: |
|
|
@@ -36,7 +36,7 @@ jobs:
|
|
|
36
36
|
@semantic-release/git
|
|
37
37
|
@semantic-release/github
|
|
38
38
|
env:
|
|
39
|
-
GITHUB_TOKEN: "${{ secrets.
|
|
39
|
+
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" # Use the built-in token if possible
|
|
40
40
|
NPM_TOKEN: "${{ secrets.NPM_TOKEN }}"
|
|
41
41
|
outputs:
|
|
42
42
|
new_release_published: "${{ steps.semantic.outputs.new_release_published }}"
|
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
## [1.12.8](https://github.com/CoCreate-app/CoCreate-server-side-render/compare/v1.12.7...v1.12.8) (2026-04-04)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* enhance chunk rendering logic to support outerHTML insertion ([b605d4a](https://github.com/CoCreate-app/CoCreate-server-side-render/commit/b605d4a775dd7dfb2493d8450f63022e553da5ee))
|
|
7
|
+
* svg images not rendering in server-side rendering ([01a6882](https://github.com/CoCreate-app/CoCreate-server-side-render/commit/01a688296c369bf5ffe32c6b0fb8c8f38e70b243))
|
|
8
|
+
|
|
1
9
|
## [1.12.7](https://github.com/CoCreate-app/CoCreate-server-side-render/compare/v1.12.6...v1.12.7) (2025-10-11)
|
|
2
10
|
|
|
3
11
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cocreate/server-side-render",
|
|
3
|
-
"version": "1.12.
|
|
3
|
+
"version": "1.12.8",
|
|
4
4
|
"description": "A simple server-side-render component in vanilla javascript. Easily configured using HTML5 data-attributes and/or JavaScript API.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"server-side-render",
|
package/src/index.js
CHANGED
|
@@ -141,6 +141,10 @@ class CoCreateServerSideRender {
|
|
|
141
141
|
) {
|
|
142
142
|
let chunk = data.object[0].src;
|
|
143
143
|
|
|
144
|
+
if (typeof chunk === "string" && chunk.startsWith("data:image/svg+xml;base64,")) {
|
|
145
|
+
chunk = Buffer.from(chunk.split(",")[1], "base64").toString("utf-8");
|
|
146
|
+
}
|
|
147
|
+
|
|
144
148
|
// Replace $relativePath in the fetched chunk
|
|
145
149
|
let path =
|
|
146
150
|
el.getAttribute("path") || getRelativePath(file.path);
|
|
@@ -158,11 +162,24 @@ class CoCreateServerSideRender {
|
|
|
158
162
|
let chunkDom = parse(chunk);
|
|
159
163
|
chunkDom = await render(chunkDom);
|
|
160
164
|
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
165
|
+
// If element requests outerHTML insertion, replace the element
|
|
166
|
+
// with the fetched chunk's content. Otherwise append children.
|
|
167
|
+
const valueType = el.getAttribute && el.getAttribute("value-type");
|
|
168
|
+
if (valueType === "outerHTML") {
|
|
169
|
+
// Replace the element with the parsed chunk's child nodes
|
|
170
|
+
// spread child nodes so we don't create an extra wrapper
|
|
171
|
+
if (chunkDom.childNodes && chunkDom.childNodes.length) {
|
|
172
|
+
el.replaceWith(...chunkDom.childNodes);
|
|
173
|
+
} else {
|
|
174
|
+
// If no child nodes, just remove the element
|
|
175
|
+
el.remove();
|
|
176
|
+
}
|
|
177
|
+
} else {
|
|
178
|
+
el.setAttribute("rendered", "");
|
|
179
|
+
el.innerHTML = "";
|
|
180
|
+
for (const child of chunkDom.childNodes) {
|
|
181
|
+
el.appendChild(child);
|
|
182
|
+
}
|
|
166
183
|
}
|
|
167
184
|
}
|
|
168
185
|
}
|