@adobe/aem-cli 16.0.5 → 16.0.7

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,17 @@
1
+ ## [16.0.7](https://github.com/adobe/helix-cli/compare/v16.0.6...v16.0.7) (2023-11-16)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * defer loading of head.html to allow inclusion of request cookie ([1a8d2ac](https://github.com/adobe/helix-cli/commit/1a8d2ac65af58f07e2ad8911f8e9c3619f83ac7b)), closes [#2274](https://github.com/adobe/helix-cli/issues/2274)
7
+
8
+ ## [16.0.6](https://github.com/adobe/helix-cli/compare/v16.0.5...v16.0.6) (2023-11-13)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * **deps:** update external fixes ([#2273](https://github.com/adobe/helix-cli/issues/2273)) ([2f74d4d](https://github.com/adobe/helix-cli/commit/2f74d4d425ad32f199b5940d96c33c08395502be))
14
+
1
15
  ## [16.0.5](https://github.com/adobe/helix-cli/compare/v16.0.4...v16.0.5) (2023-10-31)
2
16
 
3
17
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adobe/aem-cli",
3
- "version": "16.0.5",
3
+ "version": "16.0.7",
4
4
  "description": "AEM CLI",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -46,7 +46,7 @@
46
46
  "chalk-template": "1.1.0",
47
47
  "chokidar": "3.5.3",
48
48
  "compression": "1.7.4",
49
- "cookie": "0.5.0",
49
+ "cookie": "0.6.0",
50
50
  "cookie-parser": "1.4.6",
51
51
  "dotenv": "16.3.1",
52
52
  "express": "4.18.2",
@@ -54,12 +54,12 @@
54
54
  "fs-extra": "11.1.1",
55
55
  "glob": "10.3.10",
56
56
  "glob-to-regexp": "0.4.1",
57
- "hast-util-select": "6.0.1",
57
+ "hast-util-select": "6.0.2",
58
58
  "http-proxy-agent": "7.0.0",
59
59
  "https-proxy-agent": "7.0.2",
60
60
  "ignore": "5.2.4",
61
61
  "ini": "4.1.1",
62
- "isomorphic-git": "1.24.5",
62
+ "isomorphic-git": "1.25.0",
63
63
  "livereload-js": "4.0.2",
64
64
  "node-fetch": "3.3.2",
65
65
  "open": "9.1.0",
@@ -80,16 +80,16 @@
80
80
  "@semantic-release/changelog": "6.0.3",
81
81
  "@semantic-release/git": "10.0.1",
82
82
  "c8": "8.0.1",
83
- "eslint": "8.52.0",
84
- "esmock": "2.5.8",
83
+ "eslint": "8.53.0",
84
+ "esmock": "2.6.0",
85
85
  "husky": "8.0.3",
86
86
  "junit-report-builder": "3.1.0",
87
- "lint-staged": "15.0.2",
87
+ "lint-staged": "15.1.0",
88
88
  "mocha": "10.2.0",
89
89
  "mocha-multi-reporters": "1.5.1",
90
- "nock": "13.3.6",
91
- "semantic-release": "22.0.5",
92
- "sinon": "17.0.0"
90
+ "nock": "13.3.8",
91
+ "semantic-release": "22.0.7",
92
+ "sinon": "17.0.1"
93
93
  },
94
94
  "lint-staged": {
95
95
  "*.js": "eslint"
@@ -81,6 +81,7 @@ export default class HeadHtmlSupport {
81
81
  this.remoteStatus = 0;
82
82
  this.localHtml = '';
83
83
  this.localStatus = 0;
84
+ this.cookie = '';
84
85
  this.url = new URL(proxyUrl);
85
86
  this.url.pathname = '/head.html';
86
87
  this.filePath = resolve(directory, 'head.html');
@@ -89,8 +90,13 @@ export default class HeadHtmlSupport {
89
90
 
90
91
  async loadRemote() {
91
92
  // load head from server
93
+ const headers = {};
94
+ if (this.cookie) {
95
+ headers.cookie = this.cookie;
96
+ }
92
97
  const resp = await getFetch()(this.url, {
93
98
  cache: 'no-store',
99
+ headers,
94
100
  });
95
101
  this.remoteStatus = resp.status;
96
102
  if (resp.ok) {
@@ -103,6 +109,18 @@ export default class HeadHtmlSupport {
103
109
  }
104
110
  }
105
111
 
112
+ setCookie(cookie) {
113
+ if (this.cookie !== cookie) {
114
+ this.log.trace('registering head-html cookie to ', cookie);
115
+ this.cookie = cookie;
116
+ this.remoteStatus = 0;
117
+ }
118
+ }
119
+
120
+ invalidateLocal() {
121
+ this.localStatus = 0;
122
+ }
123
+
106
124
  async loadLocal() {
107
125
  try {
108
126
  this.localHtml = (await fs.readFile(this.filePath, 'utf-8')).trim();
@@ -114,7 +132,7 @@ export default class HeadHtmlSupport {
114
132
  }
115
133
  }
116
134
 
117
- async init() {
135
+ async update() {
118
136
  if (!this.localStatus) {
119
137
  await this.loadLocal();
120
138
  }
@@ -127,6 +145,7 @@ export default class HeadHtmlSupport {
127
145
  }
128
146
 
129
147
  async replace(source) {
148
+ await this.update();
130
149
  if (!this.isModified) {
131
150
  this.log.trace('head.html ignored: not modified locally.');
132
151
  return source;
@@ -78,15 +78,13 @@ export class HelixProject extends BaseProject {
78
78
  log: this.log,
79
79
  proxyUrl: this.proxyUrl,
80
80
  });
81
- await this._headHtml.init();
82
81
 
83
82
  // register local head in live-reload
84
83
  if (this.liveReload) {
85
84
  this.liveReload.registerFiles([this._headHtml.filePath], '/');
86
85
  this.liveReload.on('modified', async (modified) => {
87
86
  if (modified.indexOf('/') >= 0) {
88
- await this._headHtml.loadLocal();
89
- await this._headHtml.init();
87
+ this._headHtml.invalidateLocal();
90
88
  }
91
89
  });
92
90
  }
@@ -289,7 +289,7 @@ window.LiveReloadOptions = {
289
289
 
290
290
  const isHTML = ret.status === 200 && contentType.indexOf('text/html') === 0;
291
291
  const livereload = isHTML && opts.injectLiveReload;
292
- const replaceHead = isHTML && opts.headHtml && opts.headHtml.isModified;
292
+ const replaceHead = isHTML && opts.headHtml;
293
293
  const doIndex = isHTML && opts.indexer && url.indexOf('.plain.html') < 0;
294
294
 
295
295
  if (isHTML) {
@@ -322,6 +322,7 @@ window.LiveReloadOptions = {
322
322
  ctx.log.trace(lines.join('\n'));
323
323
  }
324
324
  if (replaceHead) {
325
+ await opts.headHtml.setCookie(req.headers.cookie);
325
326
  textBody = await opts.headHtml.replace(textBody);
326
327
  }
327
328
  if (livereload) {
package/src/up.cmd.js CHANGED
@@ -119,7 +119,9 @@ export default class UpCommand extends AbstractServerCommand {
119
119
  const resp = await getFetch()(fstabUrl);
120
120
  await resp.buffer();
121
121
  if (!resp.ok) {
122
- if (ref === 'main') {
122
+ if (resp.status === 401) {
123
+ this.log.warn(chalk`Unable to verify {yellow ${ref}} branch via {blue ${fstabUrl}} for authenticated sites.`);
124
+ } else if (ref === 'main') {
123
125
  this.log.warn(chalk`Unable to verify {yellow main} branch via {blue ${fstabUrl}} (${resp.status}). Maybe not pushed yet?`);
124
126
  } else {
125
127
  this.log.warn(chalk`Unable to verify {yellow ${ref}} branch on {blue ${fstabUrl}} (${resp.status}). Fallback to {yellow main} branch.`);