Skip to content

Commit 94cca81

Browse files
Abhishek Bindraclaude
andcommitted
fix(build): add esbuild fallback plugin for standalone CI builds
When axe-core builds outside the a11y-engine monorepo, the relative import to ip-protection/utils/fingerprint fails. Added an esbuild resolve plugin that falls back to a stub returning null when the real file is unavailable. In the monorepo, the real fingerprint is used. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent c459c8e commit 94cca81

2 files changed

Lines changed: 33 additions & 1 deletion

File tree

build/tasks/esbuild.js

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,29 @@
11
const { build } = require('esbuild');
22
const path = require('path');
3+
const fs = require('fs');
4+
5+
// [a11y-core]: resolve ip-protection imports to real file in monorepo,
6+
// or fall back to a stub when building axe-core standalone (CI).
7+
const fingerprintFallback = {
8+
name: 'a11y-fingerprint-fallback',
9+
setup(pluginBuild) {
10+
pluginBuild.onResolve(
11+
{ filter: /ip-protection\/utils\/fingerprint/ },
12+
args => {
13+
const realPath = path.resolve(args.resolveDir, args.path + '.js');
14+
if (fs.existsSync(realPath)) {
15+
return { path: realPath };
16+
}
17+
return {
18+
path: path.resolve(
19+
__dirname,
20+
'../../lib/core/utils/fingerprint-stub.js'
21+
)
22+
};
23+
}
24+
);
25+
}
26+
};
327

428
module.exports = function (grunt) {
529
grunt.registerMultiTask(
@@ -24,7 +48,8 @@ module.exports = function (grunt) {
2448
outfile: path.join(dest, name),
2549
minify: false,
2650
format: 'esm',
27-
bundle: true
51+
bundle: true,
52+
plugins: [fingerprintFallback]
2853
})
2954
.then(done)
3055
.catch(e => {

lib/core/utils/fingerprint-stub.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// Fallback stub used when axe-core builds outside the a11y-engine monorepo.
2+
// The real fingerprint logic lives in ip-protection/utils/fingerprint.js
3+
// and is resolved by the esbuild plugin during monorepo builds.
4+
// eslint-disable-next-line no-unused-vars
5+
export function computeFingerprintHash(_outerHTML) {
6+
return null;
7+
}

0 commit comments

Comments
 (0)