@adobe/helix-html-pipeline 6.4.1 → 6.5.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.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,15 @@
1
+ # [6.5.0](https://github.com/adobe/helix-html-pipeline/compare/v6.4.1...v6.5.0) (2024-02-09)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * allow static html with selectors ([#510](https://github.com/adobe/helix-html-pipeline/issues/510)) ([91e20a1](https://github.com/adobe/helix-html-pipeline/commit/91e20a19ec4bfbdbfe80b6ee78b256a7ebc208d1)), closes [#481](https://github.com/adobe/helix-html-pipeline/issues/481)
7
+
8
+
9
+ ### Features
10
+
11
+ * remove source-location surrogate key ([049caf0](https://github.com/adobe/helix-html-pipeline/commit/049caf059530ca11025a3f4b6c9ca50db0e13122))
12
+
1
13
  ## [6.4.1](https://github.com/adobe/helix-html-pipeline/compare/v6.4.0...v6.4.1) (2024-02-08)
2
14
 
3
15
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adobe/helix-html-pipeline",
3
- "version": "6.4.1",
3
+ "version": "6.5.0",
4
4
  "description": "Helix HTML Pipeline",
5
5
  "main": "src/index.js",
6
6
  "types": "src/index.d.ts",
@@ -42,19 +42,16 @@ export async function getPathKey(state) {
42
42
  */
43
43
  export default async function setXSurrogateKeyHeader(state, req, res) {
44
44
  const {
45
- content, contentBusId, owner, repo, ref,
45
+ contentBusId, owner, repo, ref,
46
46
  } = state;
47
-
48
- const keys = [];
49
- if (content.sourceLocation) {
50
- keys.push(await computeSurrogateKey(content.sourceLocation));
51
- }
52
-
53
47
  const hash = await getPathKey(state);
54
- keys.push(hash);
55
- keys.push(`${contentBusId}_metadata`);
56
- keys.push(`${ref}--${repo}--${owner}_head`);
48
+ const keys = [
49
+ hash,
50
+ `${contentBusId}_metadata`,
51
+ `${ref}--${repo}--${owner}_head`,
52
+ ];
57
53
 
54
+ // for folder-mapped resources, we also need to include the surrogate key of the mapped metadata
58
55
  if (state.mapped) {
59
56
  keys.push(`${hash}_metadata`);
60
57
  }
package/src/utils/path.js CHANGED
@@ -67,15 +67,18 @@ export function getPathInfo(path) {
67
67
  }
68
68
  let resExt = info.extension;
69
69
  if (info.selector) {
70
- if (resExt === '.html') {
71
- // force .plain.html as markdown resources
70
+ if (info.selector === 'plain' && resExt === '.html') {
71
+ // force .plain.html as markdown resources and remove selector from path
72
72
  resExt = '.md';
73
+ fileName = `${baseName}${resExt}`;
74
+ } else {
75
+ fileName = `${baseName}.${info.selector}${resExt}`;
73
76
  }
74
77
  segs.push(`${baseName}.${info.selector}${info.extension}`);
75
78
  } else {
76
79
  segs.push(`${baseName}${resExt}`);
80
+ fileName = `${baseName}${resExt}`;
77
81
  }
78
- fileName = `${baseName}${resExt}`;
79
82
  }
80
83
 
81
84
  info.path = `/${segs.join('/')}`;
@@ -94,14 +97,8 @@ export function validatePathInfo(info) {
94
97
  return false;
95
98
  }
96
99
 
97
- // only support empty selector or plain with html
98
- if (info.selector) {
99
- if (info.selector !== 'plain') {
100
- return false;
101
- }
102
- return info.extension === '.html';
103
- }
104
- return true;
100
+ // only support selector for html
101
+ return info.selector === '' || info.extension === '.html';
105
102
  }
106
103
 
107
104
  /**