Analytics: Banner-Skript und Heatmap-Overlay
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
305939fdbd
commit
5930f052d7
7 files changed
+1379
No files matched your search
@@ -0,0 +1,26 @@
|
||||
// Erzeugt dist/w.js und dist/h.js: core.js + Einstieg als IIFE, ohne import/export (kein Build-Tool).
|
||||
// Aufruf: node client/build.js
|
||||
import { readFileSync, writeFileSync, mkdirSync } from 'node:fs';
|
||||
import { dirname, join } from 'node:path';
|
||||
import { fileURLToPath, pathToFileURL } from 'node:url';
|
||||
|
||||
const DIR = dirname(fileURLToPath(import.meta.url));
|
||||
const read = (f) => readFileSync(join(DIR, f), 'utf8');
|
||||
|
||||
function wrap(name, entry) {
|
||||
const core = read('core.js').replace(/^export\s+/gm, '');
|
||||
const body = read(entry).replace(/^import\s[^\n]*\n/gm, '');
|
||||
return `/* WEBklar Analyse ${name} - generiert aus client/core.js + client/${entry} (node client/build.js), nicht von Hand aendern */\n(function () {\n'use strict';\n${core}\n${body}\n})();\n`;
|
||||
}
|
||||
|
||||
export function buildAll() {
|
||||
return { w: wrap('w.js', 'w.js'), h: wrap('h.js', 'h.js') };
|
||||
}
|
||||
|
||||
if (process.argv[1] && import.meta.url === pathToFileURL(process.argv[1]).href) {
|
||||
const b = buildAll();
|
||||
mkdirSync(join(DIR, 'dist'), { recursive: true });
|
||||
writeFileSync(join(DIR, 'dist', 'w.js'), b.w);
|
||||
writeFileSync(join(DIR, 'dist', 'h.js'), b.h);
|
||||
console.log('dist/w.js', b.w.length, 'Bytes; dist/h.js', b.h.length, 'Bytes');
|
||||
}
|
||||
Reference in new issue
Block a user