@adobe/aem-cli 16.15.0 → 16.15.2

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.15.2](https://github.com/adobe/helix-cli/compare/v16.15.1...v16.15.2) (2025-09-24)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * hlx proxy now respects .hlxignore and warns for ignored files ([#2086](https://github.com/adobe/helix-cli/issues/2086)) ([a413938](https://github.com/adobe/helix-cli/commit/a413938bdcbdc8987306c82f90242d110979ea51))
7
+
8
+ ## [16.15.1](https://github.com/adobe/helix-cli/compare/v16.15.0...v16.15.1) (2025-09-22)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * inject hlx:proxyUrl meta tag for 401 and 403 HTML responses ([ff4f2e8](https://github.com/adobe/helix-cli/commit/ff4f2e84e897676141601fccb165d678715b3ac8)), closes [#2414](https://github.com/adobe/helix-cli/issues/2414)
14
+
1
15
  # [16.15.0](https://github.com/adobe/helix-cli/compare/v16.14.0...v16.15.0) (2025-09-22)
2
16
 
3
17
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adobe/aem-cli",
3
- "version": "16.15.0",
3
+ "version": "16.15.2",
4
4
  "description": "AEM CLI",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -11,6 +11,7 @@
11
11
  */
12
12
  import path, { resolve } from 'path';
13
13
  import { lstat } from 'fs/promises';
14
+ import { IgnoreConfig } from '@adobe/helix-shared-config';
14
15
  import { HelixServer } from './HelixServer.js';
15
16
  import { BaseProject } from './BaseProject.js';
16
17
  import HeadHtmlSupport from './HeadHtmlSupport.js';
@@ -25,6 +26,7 @@ export class HelixProject extends BaseProject {
25
26
  this._printIndex = false;
26
27
  this._allowInsecure = false;
27
28
  this._file404html = null;
29
+ this._hlxIgnore = null;
28
30
  }
29
31
 
30
32
  withLiveReload(value) {
@@ -135,12 +137,28 @@ export class HelixProject extends BaseProject {
135
137
  return this._htmlFolder;
136
138
  }
137
139
 
140
+ get hlxIgnore() {
141
+ return this._hlxIgnore;
142
+ }
143
+
138
144
  async init() {
139
145
  await super.init();
140
146
  this._indexer = new Indexer()
141
147
  .withLogger(this._logger)
142
148
  .withCwd(this._cwd)
143
149
  .withPrintIndex(this._printIndex);
150
+
151
+ // Initialize IgnoreConfig for .hlxignore support
152
+ this._hlxIgnore = new IgnoreConfig()
153
+ .withDirectory(this._cwd);
154
+
155
+ try {
156
+ await this._hlxIgnore.init();
157
+ } catch (e) {
158
+ // .hlxignore file doesn't exist or couldn't be loaded, which is fine
159
+ this._hlxIgnore = null;
160
+ }
161
+
144
162
  return this;
145
163
  }
146
164
 
@@ -196,12 +214,40 @@ export class HelixProject extends BaseProject {
196
214
  }
197
215
  }
198
216
 
217
+ async initHlxIgnore() {
218
+ if (this._hlxIgnore && this.liveReload) {
219
+ const hlxIgnorePath = resolve(this.directory, '.hlxignore');
220
+ try {
221
+ await lstat(hlxIgnorePath);
222
+ this.log.debug('detected .hlxignore file');
223
+ if (this.liveReload) {
224
+ this.liveReload.registerFiles([hlxIgnorePath], '/');
225
+ this.liveReload.on('modified', async (modified) => {
226
+ if (modified.includes('.hlxignore')) {
227
+ this.log.debug('Reloading .hlxignore file');
228
+ // Re-initialize the IgnoreConfig to reload the file
229
+ try {
230
+ await this._hlxIgnore.init();
231
+ } catch (e) {
232
+ // If reload fails, just continue without ignore support
233
+ this._hlxIgnore = null;
234
+ }
235
+ }
236
+ });
237
+ }
238
+ } catch (e) {
239
+ // .hlxignore doesn't exist, which is fine
240
+ }
241
+ }
242
+ }
243
+
199
244
  async start() {
200
245
  this.log.debug('Launching AEM dev server...');
201
246
  await super.start();
202
247
  await this.initHeadHtml();
203
248
  await this.init404Html();
204
249
  await this.initHtmlFolder();
250
+ await this.initHlxIgnore();
205
251
  if (this._indexer) {
206
252
  await this._indexer.init();
207
253
  }
@@ -253,6 +253,16 @@ export class HelixServer extends BaseServer {
253
253
  return;
254
254
  }
255
255
 
256
+ // Check if the file is ignored by .hlxignore
257
+ if (this._project.hlxIgnore) {
258
+ // IgnoreConfig expects relative paths from project root
259
+ const relativePath = path.relative(this._project.directory, filePath);
260
+ const isIgnored = this._project.hlxIgnore.ignores(relativePath);
261
+ if (isIgnored) {
262
+ log.warn(`Warning: Proxying ignored file: ${ctx.path} (matched by .hlxignore)`);
263
+ }
264
+ }
265
+
256
266
  const liveReload = this._liveReload;
257
267
  if (liveReload) {
258
268
  liveReload.startRequest(ctx.requestId, ctx.path);
@@ -325,6 +325,7 @@ window.LiveReloadOptions = {
325
325
  }
326
326
 
327
327
  const isHTML = ret.status === 200 && contentType.indexOf('text/html') === 0;
328
+ const isHTMLWithAuthError = (ret.status === 401 || ret.status === 403) && contentType.indexOf('text/html') === 0;
328
329
  const livereload = isHTML && opts.injectLiveReload;
329
330
  const replaceHead = isHTML && opts.headHtml;
330
331
  const doIndex = isHTML && opts.indexer && url.indexOf('.plain.html') < 0;
@@ -380,6 +381,24 @@ window.LiveReloadOptions = {
380
381
  .send(textBody);
381
382
  return;
382
383
  }
384
+ if (isHTMLWithAuthError) {
385
+ // Handle HTML responses with 401/403 status - inject meta tag
386
+ let textBody = await ret.text();
387
+ if (ctx.log.level === 'silly') {
388
+ ctx.log.trace(textBody);
389
+ ctx.log.trace(`[${id}] <<<--------------------------`);
390
+ }
391
+ textBody = utils.injectMeta(textBody, {
392
+ 'hlx:proxyUrl': url,
393
+ });
394
+
395
+ res
396
+ .set(respHeaders)
397
+ .status(ret.status)
398
+ .send(textBody);
399
+ return;
400
+ }
401
+
383
402
  if (ret.status === 401 || ret.status === 403) {
384
403
  const reqHeaders = req.headers;
385
404
  if (opts.autoLogin && opts.loginPath