Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ This is a yarn workspace with these packages:
- `@system-dynamics/app` - Frontend application
- `@system-dynamics/server` - Backend API server
- `@system-dynamics/engine2` - WASM simulation engine
- `@system-dynamics/xmutil` - WASM XML utilities

### Prerequisites for Development

Expand Down
9 changes: 3 additions & 6 deletions examples/serialize.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { readFileSync, createWriteStream } from 'fs';
import { fileURLToPath } from 'url';
import { dirname, resolve } from 'path';

import { convertMdlToXmile } from '@system-dynamics/xmutil';
import { Project as Engine2Project } from '@system-dynamics/engine2';

// Compute the WASM path relative to the engine2 package
Expand All @@ -14,11 +13,9 @@ const args = process.argv.slice(2);
const inputFile = args[0];
let contents = readFileSync(args[0], 'utf-8');

if (inputFile.endsWith('.mdl')) {
contents = await convertMdlToXmile(contents, false);
}

const project = await Engine2Project.open(contents, { wasm: wasmPath });
const project = inputFile.endsWith('.mdl')
? await Engine2Project.openVensim(contents, { wasm: wasmPath })
: await Engine2Project.open(contents, { wasm: wasmPath });
const pb = project.serializeProtobuf();

const outputFile = createWriteStream(args[1]);
Expand Down
9 changes: 3 additions & 6 deletions examples/svg.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { readFileSync, createWriteStream } from 'fs';
import { fileURLToPath } from 'url';
import { dirname, resolve } from 'path';

import { convertMdlToXmile } from '@system-dynamics/xmutil';
import { Project as Engine2Project } from '@system-dynamics/engine2';
import { Project } from '@system-dynamics/core/datamodel';
import { renderSvgToString } from '@system-dynamics/diagram/render-common';
Expand All @@ -16,11 +15,9 @@ const args = process.argv.slice(2);
const inputFile = args[0];
let contents = readFileSync(args[0], 'utf-8');

if (inputFile.endsWith('.mdl')) {
contents = await convertMdlToXmile(contents, false);
}

const engine2Project = await Engine2Project.open(contents, { wasm: wasmPath });
const engine2Project = inputFile.endsWith('.mdl')
? await Engine2Project.openVensim(contents, { wasm: wasmPath })
: await Engine2Project.open(contents, { wasm: wasmPath });
const pb = engine2Project.serializeProtobuf();
const project = Project.deserializeBinary(pb);

Expand Down
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
"main": "src/server/lib",
"workspaces": {
"packages": [
"src/xmutil-js",
"src/engine2",
"src/core",
"src/diagram",
Expand Down
25 changes: 7 additions & 18 deletions scripts/debug-diagram-gen.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import { fileURLToPath } from 'node:url';
import { dirname, resolve } from 'node:path';

import { Project as Engine2Project } from '@system-dynamics/engine2';
import { convertMdlToXmile } from '@system-dynamics/xmutil';
import { Project as ProjectDM } from '@system-dynamics/core/datamodel';
import { renderSvgToString } from '@system-dynamics/diagram/render-common';

Expand Down Expand Up @@ -83,22 +82,12 @@ async function main() {

try {
// Read the input file
let contents = readFileSync(inputFile, 'utf-8');

// Convert Vensim files to XMILE if needed
if (inputFile.endsWith('.mdl')) {
const [xmileContents, logs] = await convertMdlToXmile(contents, true);
if (xmileContents.length === 0) {
throw new Error('Vensim converter failed: ' + (logs || 'unknown error'));
}
contents = xmileContents;
if (logs) {
console.log('Conversion logs:', logs);
}
}
const contents = readFileSync(inputFile, 'utf-8');

// Import the XMILE content using engine2
const engine2Project = await Engine2Project.open(contents, { wasm: wasmPath });
// Import the content using engine2
const engine2Project = inputFile.endsWith('.mdl')
? await Engine2Project.openVensim(contents, { wasm: wasmPath })
: await Engine2Project.open(contents, { wasm: wasmPath });
const projectPB = engine2Project.serializeProtobuf();
const project = ProjectDM.deserializeBinary(projectPB);

Expand All @@ -111,8 +100,8 @@ async function main() {
// Create a copy of the XMILE file without views
console.log('\nCreating XMILE copy without views...');

// Use the converted XMILE content if we converted from MDL, otherwise read the original
let xmileContent = contents;
// Get XMILE from the engine project (handles both XMILE and MDL inputs)
const xmileContent = engine2Project.toXmileString();

// Remove the <views>...</views> section using regex
// This regex matches <views> tags with any attributes and all content until the closing </views>
Expand Down
1 change: 0 additions & 1 deletion src/xmutil-js/.npmignore

This file was deleted.

20 changes: 0 additions & 20 deletions src/xmutil-js/LICENSE

This file was deleted.

26 changes: 0 additions & 26 deletions src/xmutil-js/README.md

This file was deleted.

11 changes: 0 additions & 11 deletions src/xmutil-js/eslint.config.js

This file was deleted.

83 changes: 0 additions & 83 deletions src/xmutil-js/index.ts

This file was deleted.

90 changes: 0 additions & 90 deletions src/xmutil-js/index_main.ts

This file was deleted.

33 changes: 0 additions & 33 deletions src/xmutil-js/package.json

This file was deleted.

Loading
Loading