@adobe/helix-html-pipeline 3.11.9 → 3.11.11
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/CHANGELOG.md +15 -0
- package/package.json +11 -11
- package/src/steps/create-pictures.js +4 -3
- package/src/steps/utils.js +20 -16
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,18 @@
|
|
|
1
|
+
## [3.11.11](https://github.com/adobe/helix-html-pipeline/compare/v3.11.10...v3.11.11) (2023-06-03)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* ignore invalid urls in link rewriter ([#329](https://github.com/adobe/helix-html-pipeline/issues/329)) ([03a8e35](https://github.com/adobe/helix-html-pipeline/commit/03a8e354af1f88d0d7dc1b9ad4537c7fbf8382f3)), closes [#328](https://github.com/adobe/helix-html-pipeline/issues/328)
|
|
7
|
+
|
|
8
|
+
## [3.11.10](https://github.com/adobe/helix-html-pipeline/compare/v3.11.9...v3.11.10) (2023-06-01)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* coverage ([#326](https://github.com/adobe/helix-html-pipeline/issues/326)) ([31a34b9](https://github.com/adobe/helix-html-pipeline/commit/31a34b96a5ed01c002e9951507712904f8ff5615))
|
|
14
|
+
* output image title attribute ([3893776](https://github.com/adobe/helix-html-pipeline/commit/3893776a5b6ce786e69e9475dc148955a634d719)), closes [#308](https://github.com/adobe/helix-html-pipeline/issues/308)
|
|
15
|
+
|
|
1
16
|
## [3.11.9](https://github.com/adobe/helix-html-pipeline/compare/v3.11.8...v3.11.9) (2023-05-25)
|
|
2
17
|
|
|
3
18
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adobe/helix-html-pipeline",
|
|
3
|
-
"version": "3.11.
|
|
3
|
+
"version": "3.11.11",
|
|
4
4
|
"description": "Helix HTML Pipeline",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"types": "src/index.d.ts",
|
|
@@ -57,12 +57,12 @@
|
|
|
57
57
|
"mdast-util-gfm-task-list-item": "1.0.2",
|
|
58
58
|
"mdast-util-to-hast": "12.3.0",
|
|
59
59
|
"mdast-util-to-string": "3.2.0",
|
|
60
|
-
"micromark-extension-gfm-footnote": "1.1.
|
|
61
|
-
"micromark-extension-gfm-strikethrough": "1.0.
|
|
62
|
-
"micromark-extension-gfm-table": "1.0.
|
|
60
|
+
"micromark-extension-gfm-footnote": "1.1.2",
|
|
61
|
+
"micromark-extension-gfm-strikethrough": "1.0.7",
|
|
62
|
+
"micromark-extension-gfm-table": "1.0.7",
|
|
63
63
|
"micromark-extension-gfm-tagfilter": "1.0.2",
|
|
64
|
-
"micromark-extension-gfm-task-list-item": "1.0.
|
|
65
|
-
"micromark-util-combine-extensions": "1.
|
|
64
|
+
"micromark-extension-gfm-task-list-item": "1.0.5",
|
|
65
|
+
"micromark-util-combine-extensions": "1.1.0",
|
|
66
66
|
"mime": "3.0.0",
|
|
67
67
|
"rehype-format": "4.0.1",
|
|
68
68
|
"rehype-parse": "8.0.4",
|
|
@@ -82,21 +82,21 @@
|
|
|
82
82
|
"@semantic-release/changelog": "6.0.3",
|
|
83
83
|
"@semantic-release/git": "10.0.1",
|
|
84
84
|
"@semantic-release/npm": "10.0.3",
|
|
85
|
-
"c8": "7.
|
|
86
|
-
"eslint": "8.
|
|
85
|
+
"c8": "7.14.0",
|
|
86
|
+
"eslint": "8.42.0",
|
|
87
87
|
"eslint-import-resolver-exports": "1.0.0-beta.5",
|
|
88
88
|
"eslint-plugin-header": "3.1.1",
|
|
89
89
|
"eslint-plugin-import": "2.27.5",
|
|
90
|
-
"esmock": "2.
|
|
90
|
+
"esmock": "2.3.1",
|
|
91
91
|
"husky": "8.0.3",
|
|
92
92
|
"js-yaml": "4.1.0",
|
|
93
|
-
"jsdom": "22.
|
|
93
|
+
"jsdom": "22.1.0",
|
|
94
94
|
"junit-report-builder": "3.0.1",
|
|
95
95
|
"lint-staged": "13.2.2",
|
|
96
96
|
"mocha": "10.2.0",
|
|
97
97
|
"mocha-multi-reporters": "1.5.1",
|
|
98
98
|
"remark-gfm": "3.0.1",
|
|
99
|
-
"semantic-release": "21.0.
|
|
99
|
+
"semantic-release": "21.0.3"
|
|
100
100
|
},
|
|
101
101
|
"lint-staged": {
|
|
102
102
|
"*.js": "eslint",
|
|
@@ -18,7 +18,7 @@ const BREAK_POINTS = [
|
|
|
18
18
|
{ width: '750' },
|
|
19
19
|
];
|
|
20
20
|
|
|
21
|
-
export function createOptimizedPicture(src, alt = '') {
|
|
21
|
+
export function createOptimizedPicture(src, alt = '', title = undefined) {
|
|
22
22
|
const url = new URL(src, 'https://localhost/');
|
|
23
23
|
const { pathname, hash = '' } = url;
|
|
24
24
|
const props = new URLSearchParams(hash.substring(1));
|
|
@@ -55,6 +55,7 @@ export function createOptimizedPicture(src, alt = '') {
|
|
|
55
55
|
return h('img', {
|
|
56
56
|
loading: 'lazy',
|
|
57
57
|
alt,
|
|
58
|
+
'data-title': title === alt ? undefined : title,
|
|
58
59
|
type: v.type,
|
|
59
60
|
src: srcset,
|
|
60
61
|
width,
|
|
@@ -78,8 +79,8 @@ export default async function createPictures({ content }) {
|
|
|
78
79
|
const { hast } = content;
|
|
79
80
|
|
|
80
81
|
visitParents(hast, isMediaImage, (img, parents) => {
|
|
81
|
-
const { src, alt } = img.properties;
|
|
82
|
-
const picture = createOptimizedPicture(src, alt);
|
|
82
|
+
const { src, alt, title } = img.properties;
|
|
83
|
+
const picture = createOptimizedPicture(src, alt, title);
|
|
83
84
|
|
|
84
85
|
// check if parent has style and unwrap if needed
|
|
85
86
|
const parent = parents[parents.length - 1];
|
package/src/steps/utils.js
CHANGED
|
@@ -185,25 +185,29 @@ export function rewriteUrl(state, url) {
|
|
|
185
185
|
if (!url || !url.startsWith('https://')) {
|
|
186
186
|
return url;
|
|
187
187
|
}
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
188
|
+
try {
|
|
189
|
+
const { pathname, search, hash } = new URL(url);
|
|
190
|
+
|
|
191
|
+
if (AZURE_BLOB_REGEXP.test(url)) {
|
|
192
|
+
const filename = pathname.split('/').pop();
|
|
193
|
+
const [name, props] = hash.split('?');
|
|
194
|
+
const extension = name.split('.').pop() || 'jpg';
|
|
195
|
+
const newHash = props ? `#${props}` : '';
|
|
196
|
+
return `./media_${filename}.${extension}${newHash}`;
|
|
197
|
+
}
|
|
197
198
|
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
199
|
+
if (MEDIA_BLOB_REGEXP.test(url)) {
|
|
200
|
+
return `.${pathname}${hash}`;
|
|
201
|
+
}
|
|
201
202
|
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
203
|
+
if (HELIX_URL_REGEXP.test(url)) {
|
|
204
|
+
if (hash && pathname === state.info?.path) {
|
|
205
|
+
return hash;
|
|
206
|
+
}
|
|
207
|
+
return `${pathname}${search}${hash}`;
|
|
205
208
|
}
|
|
206
|
-
|
|
209
|
+
} catch {
|
|
210
|
+
// ignore
|
|
207
211
|
}
|
|
208
212
|
|
|
209
213
|
return url;
|