@adobe/aem-cli 16.15.1 → 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 +7 -0
- package/package.json +1 -1
- package/src/server/HelixProject.js +46 -0
- package/src/server/HelixServer.js +10 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
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
|
+
|
|
1
8
|
## [16.15.1](https://github.com/adobe/helix-cli/compare/v16.15.0...v16.15.1) (2025-09-22)
|
|
2
9
|
|
|
3
10
|
|
package/package.json
CHANGED
|
@@ -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);
|