Files
root-at-skic 97b3b5f685 Add a 3D view of every diagram; organise source by job; 0.6.0
3D view: a "3D" menu beside Export switches the diagram to a three.js
scene built from the live Archify SVG. Nodes become blocks topped with
the node as Archify draws it, relationships become lit pipes along
Archify's routes, and the canvas, frames, lanes and legend form the
floor. Clicks and hover go to the SVG nodes, so focus, the Semantic
Passport and the intent trace work as in 2D; Archify's own animations
(trace, node pulse, passport/path/lens flows) are mirrored live. The
menu also offers flat or stacked levels, reset view and a top view;
Export gains "3D view" (PNG). Trackpad scrolling pans, pinch and the
mouse wheel zoom, and the zoom buttons work beyond the 2D limits.
The scene draws only when something moves. New setting
archify.defaultView.

Source: src/ is split by job (commands, views, webview, archify,
sources, language, util, viewer3d); behaviour unchanged.
2026-10-11 00:54:00 +03:00

60 lines
1.7 KiB
JavaScript

import * as esbuild from 'esbuild';
import fs from 'node:fs';
import path from 'node:path';
const production = process.argv.includes('--production');
const watch = process.argv.includes('--watch');
const tests = process.argv.includes('--tests');
const common = {
bundle: true,
format: 'cjs',
platform: 'node',
target: 'node20',
sourcemap: !production,
minify: production,
logLevel: 'info',
// jsonc-parser's UMD entry uses dynamic requires esbuild cannot follow.
mainFields: ['module', 'main'],
};
if (tests) {
// Unit tests cover the modules that do not import 'vscode'; the
// integration suite runs inside VS Code, which provides it.
const entryPoints = fs.readdirSync('test')
.filter((file) => file.endsWith('.test.ts'))
.map((file) => path.join('test', file));
await esbuild.build({ ...common, entryPoints, outdir: 'out/test', sourcemap: true });
await esbuild.build({
...common,
entryPoints: ['test/integration/suite.ts'],
outfile: 'out/test/integration/suite.js',
external: ['vscode'],
sourcemap: true,
});
} else {
const contexts = await Promise.all([
esbuild.context({
...common,
entryPoints: ['src/extension.ts'],
outfile: 'dist/extension.js',
external: ['vscode'],
}),
// Runs inside the Archify page in the webview; three.js is bundled in.
esbuild.context({
...common,
format: 'iife',
platform: 'browser',
target: 'es2022',
entryPoints: ['src/viewer3d/index.ts'],
outfile: 'dist/viewer3d.js',
}),
]);
if (watch) {
await Promise.all(contexts.map((ctx) => ctx.watch()));
} else {
await Promise.all(contexts.map((ctx) => ctx.rebuild()));
await Promise.all(contexts.map((ctx) => ctx.dispose()));
}
}