1
0
forked from icd/rentgen
rentgen/esbuild.config.js
Jacek Wielemborek 34cec21992 feat(verify): enhanced Marionette verification with bidirectional communication
Implemented undeniable proof that extension is actively executing:
- Added content script that communicates with background script
- Background script performs verifiable computation (value*2)+3
- Marionette test dispatches event, verifies round-trip communication
- Results stored in DOM attributes (no console.log dependency)
- Mathematical proof ensures extension code is actually running

Test verifies:
1. Content script injection and event listening
2. Message passing from content to background script
3. Background script computation and response
4. Full bidirectional communication chain

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-26 09:21:18 +01:00

70 lines
2.1 KiB
JavaScript

import esbuild from 'esbuild';
import scss from 'esbuild-plugin-sass';
const watch = process.argv.includes('--watch') && {
onRebuild(error) {
if (error) console.error('[watch] build failed', error);
else console.log('[watch] build finished');
},
};
// see https://github.com/evanw/esbuild/issues/806#issuecomment-779138268
let skipReactImports = {
name: 'skipReactImports',
setup(build) {
build.onResolve({ filter: /^(react(-dom)?|survey-react)$/ }, (args) => {
return {
path: args.path,
namespace: `globalExternal_${args.path}`,
};
});
build.onLoad({ filter: /.*/, namespace: 'globalExternal_react' }, () => {
return {
contents: `module.exports = globalThis.React`,
loader: 'js',
};
});
build.onLoad({ filter: /.*/, namespace: 'globalExternal_react-dom' }, () => {
return {
contents: `module.exports = globalThis.ReactDOM`,
loader: 'js',
};
});
build.onLoad({ filter: /.*/, namespace: 'globalExternal_survey-react' }, () => {
return {
contents: `module.exports = globalThis.Survey`,
loader: 'js',
};
});
},
};
esbuild
.build({
entryPoints: [
'components/toolbar/toolbar.tsx',
'components/sidebar/sidebar.tsx',
'components/report-window/report-window.tsx',
'background.ts',
'test-content-script.js',
'diag.tsx',
'styles/global.scss',
'styles/fonts.scss',
],
bundle: true,
// minify: true,
outdir: './lib',
loader: { '.woff': 'file', '.woff2': 'file' },
plugins: [scss(), skipReactImports],
define: {
PLUGIN_NAME: '"Rentgen"',
PLUGIN_URL: '"https://addons.mozilla.org/pl/firefox/addon/rentgen/"',
},
external: ['react', 'react-dom', 'survey-react'],
watch,
})
.then(() => console.log('Add-on was built'))
.catch(() => process.exit(1));