@adobe/helix-html-pipeline 5.2.0 → 5.4.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 +14 -0
- package/package.json +9 -9
- package/src/html-pipe.js +5 -0
- package/src/index.d.ts +7 -7
- package/src/steps/fetch-content.js +1 -1
- package/src/utils/auth.js +3 -2
- package/src/utils/path.js +10 -12
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
# [5.4.0](https://github.com/adobe/helix-html-pipeline/compare/v5.3.0...v5.4.0) (2023-12-15)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* render static html from code bus ([#471](https://github.com/adobe/helix-html-pipeline/issues/471)) ([a46dab0](https://github.com/adobe/helix-html-pipeline/commit/a46dab0a9a2eb33e146bf5995e801da517389f69))
|
|
7
|
+
|
|
8
|
+
# [5.3.0](https://github.com/adobe/helix-html-pipeline/compare/v5.2.0...v5.3.0) (2023-12-05)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Features
|
|
12
|
+
|
|
13
|
+
* add xfh debug ([#468](https://github.com/adobe/helix-html-pipeline/issues/468)) ([940a57b](https://github.com/adobe/helix-html-pipeline/commit/940a57bee7a0b7c394c08da59c3a66b7a1d5868d))
|
|
14
|
+
|
|
1
15
|
# [5.2.0](https://github.com/adobe/helix-html-pipeline/compare/v5.1.3...v5.2.0) (2023-11-15)
|
|
2
16
|
|
|
3
17
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adobe/helix-html-pipeline",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.4.0",
|
|
4
4
|
"description": "Helix HTML Pipeline",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"types": "src/index.d.ts",
|
|
@@ -53,10 +53,10 @@
|
|
|
53
53
|
"hast-util-to-html": "9.0.0",
|
|
54
54
|
"hast-util-to-string": "3.0.0",
|
|
55
55
|
"hastscript": "8.0.0",
|
|
56
|
-
"jose": "5.1.
|
|
56
|
+
"jose": "5.1.3",
|
|
57
57
|
"mdast-util-to-hast": "13.0.2",
|
|
58
58
|
"mdast-util-to-string": "4.0.0",
|
|
59
|
-
"mime": "
|
|
59
|
+
"mime": "4.0.0",
|
|
60
60
|
"rehype-format": "5.0.0",
|
|
61
61
|
"rehype-parse": "9.0.0",
|
|
62
62
|
"remark-parse": "11.0.0",
|
|
@@ -70,26 +70,26 @@
|
|
|
70
70
|
"unist-util-visit-parents": "6.0.1"
|
|
71
71
|
},
|
|
72
72
|
"devDependencies": {
|
|
73
|
-
"@adobe/eslint-config-helix": "2.0.
|
|
73
|
+
"@adobe/eslint-config-helix": "2.0.5",
|
|
74
74
|
"@markedjs/html-differ": "4.0.2",
|
|
75
75
|
"@semantic-release/changelog": "6.0.3",
|
|
76
76
|
"@semantic-release/git": "10.0.1",
|
|
77
|
-
"@semantic-release/npm": "11.0.
|
|
77
|
+
"@semantic-release/npm": "11.0.2",
|
|
78
78
|
"c8": "8.0.1",
|
|
79
|
-
"eslint": "8.
|
|
79
|
+
"eslint": "8.55.0",
|
|
80
80
|
"eslint-import-resolver-exports": "1.0.0-beta.5",
|
|
81
81
|
"eslint-plugin-header": "3.1.1",
|
|
82
82
|
"eslint-plugin-import": "2.29.0",
|
|
83
83
|
"esmock": "2.6.0",
|
|
84
84
|
"husky": "8.0.3",
|
|
85
85
|
"js-yaml": "4.1.0",
|
|
86
|
-
"jsdom": "
|
|
86
|
+
"jsdom": "23.0.1",
|
|
87
87
|
"junit-report-builder": "3.1.0",
|
|
88
|
-
"lint-staged": "15.
|
|
88
|
+
"lint-staged": "15.2.0",
|
|
89
89
|
"mocha": "10.2.0",
|
|
90
90
|
"mocha-multi-reporters": "1.5.1",
|
|
91
91
|
"mocha-suppress-logs": "0.4.1",
|
|
92
|
-
"semantic-release": "22.0.
|
|
92
|
+
"semantic-release": "22.0.10"
|
|
93
93
|
},
|
|
94
94
|
"lint-staged": {
|
|
95
95
|
"*.js": "eslint",
|
package/src/html-pipe.js
CHANGED
|
@@ -96,6 +96,11 @@ export async function htmlPipe(state, req) {
|
|
|
96
96
|
return res;
|
|
97
97
|
}
|
|
98
98
|
|
|
99
|
+
// force code-bus for .html files
|
|
100
|
+
if (state.info.originalExtension === '.html' && state.info.selector !== 'plain') {
|
|
101
|
+
state.content.sourceBus = 'code';
|
|
102
|
+
}
|
|
103
|
+
|
|
99
104
|
// ...and apply the folder mapping
|
|
100
105
|
state.timer?.update('content-fetch');
|
|
101
106
|
let contentPromise = await fetchContent(state, req, res);
|
package/src/index.d.ts
CHANGED
|
@@ -22,7 +22,7 @@ export * from './PipelineStatusError';
|
|
|
22
22
|
/**
|
|
23
23
|
* Path Info
|
|
24
24
|
*/
|
|
25
|
-
declare interface PathInfo {
|
|
25
|
+
export declare interface PathInfo {
|
|
26
26
|
/**
|
|
27
27
|
* Resource path
|
|
28
28
|
* @example '/express/index.md'
|
|
@@ -72,7 +72,7 @@ declare interface PathInfo {
|
|
|
72
72
|
unmappedPath: string;
|
|
73
73
|
}
|
|
74
74
|
|
|
75
|
-
declare interface S3Loader {
|
|
75
|
+
export declare interface S3Loader {
|
|
76
76
|
/**
|
|
77
77
|
* Loads a S3 object from the given bucket and key.
|
|
78
78
|
* @param {string} bucketId
|
|
@@ -88,7 +88,7 @@ declare interface S3Loader {
|
|
|
88
88
|
headObject(bucketId, key): Promise<PipelineResponse>;
|
|
89
89
|
}
|
|
90
90
|
|
|
91
|
-
declare interface AuthEnvLoader {
|
|
91
|
+
export declare interface AuthEnvLoader {
|
|
92
92
|
|
|
93
93
|
/**
|
|
94
94
|
* loads (secret) parameters needed for authentication. The parameters are added to the
|
|
@@ -98,12 +98,12 @@ declare interface AuthEnvLoader {
|
|
|
98
98
|
load(state:PipelineState):Promise<void>;
|
|
99
99
|
}
|
|
100
100
|
|
|
101
|
-
declare interface DispatchMessageResponse {
|
|
101
|
+
export declare interface DispatchMessageResponse {
|
|
102
102
|
messageId:string,
|
|
103
103
|
requestId:string,
|
|
104
104
|
}
|
|
105
105
|
|
|
106
|
-
declare interface FormsMessageDispatcher {
|
|
106
|
+
export declare interface FormsMessageDispatcher {
|
|
107
107
|
/**
|
|
108
108
|
* Dispatches the message to the forms queue
|
|
109
109
|
* @param {object} message
|
|
@@ -114,13 +114,13 @@ declare interface FormsMessageDispatcher {
|
|
|
114
114
|
/**
|
|
115
115
|
* Timer
|
|
116
116
|
*/
|
|
117
|
-
declare interface PipelineTimer {
|
|
117
|
+
export declare interface PipelineTimer {
|
|
118
118
|
/**
|
|
119
119
|
* Records the timestamp of the given `step`
|
|
120
120
|
*/
|
|
121
121
|
update(step:string): void;
|
|
122
122
|
}
|
|
123
123
|
|
|
124
|
-
declare interface PipelineStep {
|
|
124
|
+
export declare interface PipelineStep {
|
|
125
125
|
async(state: PipelineState, req: PipelineRequest, resp: PipelineResponse): Promise<void>;
|
|
126
126
|
}
|
|
@@ -41,7 +41,7 @@ export default async function fetchContent(state, req, res) {
|
|
|
41
41
|
if (redirectLocation) {
|
|
42
42
|
res.status = 301;
|
|
43
43
|
res.body = '';
|
|
44
|
-
if (redirectLocation.startsWith('/') &&
|
|
44
|
+
if (redirectLocation.startsWith('/') && info.selector === 'plain') {
|
|
45
45
|
redirectLocation += '.plain.html';
|
|
46
46
|
}
|
|
47
47
|
res.headers.set('location', redirectLocation);
|
package/src/utils/auth.js
CHANGED
|
@@ -109,7 +109,8 @@ export async function decodeIdToken(state, idToken, lenient = false) {
|
|
|
109
109
|
function getRequestHostAndProto(state, req) {
|
|
110
110
|
// determine the location of 'this' document based on the xfh header. so that logins to
|
|
111
111
|
// .page stay on .page. etc. but fallback to the config.host if non set
|
|
112
|
-
|
|
112
|
+
const xfh = req.headers.get('x-forwarded-host');
|
|
113
|
+
let host = xfh;
|
|
113
114
|
if (host) {
|
|
114
115
|
host = host.split(',')[0].trim();
|
|
115
116
|
}
|
|
@@ -118,7 +119,7 @@ function getRequestHostAndProto(state, req) {
|
|
|
118
119
|
}
|
|
119
120
|
// fastly overrides the x-forwarded-proto, so we use x-forwarded-scheme
|
|
120
121
|
const proto = req.headers.get('x-forwarded-scheme') || req.headers.get('x-forwarded-proto') || 'https';
|
|
121
|
-
state.log.info(`request host is: ${host} (${proto})`);
|
|
122
|
+
state.log.info(`request host is: ${host} (${proto}) (xfh=${xfh})`);
|
|
122
123
|
return {
|
|
123
124
|
host,
|
|
124
125
|
proto,
|
package/src/utils/path.js
CHANGED
|
@@ -43,7 +43,7 @@ export function getPathInfo(path) {
|
|
|
43
43
|
// path -> web path (no .html, no index)
|
|
44
44
|
// resourcePath -> content path (.md)
|
|
45
45
|
let fileName = info.originalFilename;
|
|
46
|
-
if (!fileName || fileName === 'index.
|
|
46
|
+
if (!fileName || fileName === 'index.md' || fileName === 'index') {
|
|
47
47
|
// last segment empty or index
|
|
48
48
|
const lastDot = fileName.lastIndexOf('.');
|
|
49
49
|
if (lastDot >= 0) {
|
|
@@ -62,21 +62,19 @@ export function getPathInfo(path) {
|
|
|
62
62
|
info.extension = fileName.substring(lastDot);
|
|
63
63
|
info.originalExtension = info.extension;
|
|
64
64
|
const baseName = fileName.substring(0, firstDot);
|
|
65
|
+
if (lastDot !== firstDot) {
|
|
66
|
+
info.selector = fileName.substring(firstDot + 1, lastDot);
|
|
67
|
+
}
|
|
65
68
|
let resExt = info.extension;
|
|
66
|
-
if (
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
segs.push(baseName);
|
|
69
|
+
if (info.selector) {
|
|
70
|
+
if (resExt === '.html') {
|
|
71
|
+
// force .plain.html as markdown resources
|
|
72
|
+
resExt = '.md';
|
|
73
|
+
}
|
|
74
|
+
segs.push(`${baseName}.${info.selector}${info.extension}`);
|
|
72
75
|
} else {
|
|
73
76
|
segs.push(`${baseName}${resExt}`);
|
|
74
77
|
}
|
|
75
|
-
|
|
76
|
-
if (lastDot !== firstDot) {
|
|
77
|
-
info.selector = fileName.substring(firstDot + 1, lastDot);
|
|
78
|
-
segs[segs.length - 1] = `${baseName}.${info.selector}${info.extension}`;
|
|
79
|
-
}
|
|
80
78
|
fileName = `${baseName}${resExt}`;
|
|
81
79
|
}
|
|
82
80
|
|