From fed3df0e9ae1c90c71bbc1d4a7ee880b5953ff8b Mon Sep 17 00:00:00 2001 From: Evgeny Metelkin Date: Thu, 12 Sep 2024 17:46:35 +0300 Subject: [PATCH] relative paths --- package-lock.json | 234 +++++++++++++++++++- package.json | 3 +- src/app.js | 2 +- src/build.js | 8 +- src/heta-templates/platform.yml.template.js | 4 +- src/platform-shemas.js | 36 ++- 6 files changed, 264 insertions(+), 23 deletions(-) diff --git a/package-lock.json b/package-lock.json index e7c160f..cee76a6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,11 +10,12 @@ "license": "Apache-2.0", "dependencies": { "@viz-js/viz": "^3.2.3", - "heta-compiler": "github:hetalang/heta-compiler#rewrite-export", + "heta-compiler": "github:hetalang/heta-compiler#relative-paths", "jquery": "^3.7.0", "js-yaml": "^4.1.0", "jszip": "^3.10.1", "monaco-editor": "^0.44.0", + "monaco-yaml": "^5.2.2", "w3-css": "^4.1.0" }, "devDependencies": { @@ -7355,7 +7356,7 @@ }, "node_modules/heta-compiler": { "version": "0.8.7", - "resolved": "git+ssh://git@github.com/hetalang/heta-compiler.git#ba7dc26731b8472031d6c93b0675f4504db37b5c", + "resolved": "git+ssh://git@github.com/hetalang/heta-compiler.git#af898c0b43e8326198a8233acd4b6dd5a1de620f", "license": "Apache-2.0", "dependencies": { "@insysbio/topo-sort": "^1.0.1", @@ -8554,6 +8555,11 @@ "node": ">=6" } }, + "node_modules/jsonc-parser": { + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/jsonc-parser/-/jsonc-parser-3.3.1.tgz", + "integrity": "sha512-HUgH65KyejrUFPvHFPbqOY0rsFip3Bo5wb4ngvdi1EpCYWUQDC5V+Y7mZws+DLkr4M//zQJoanu1SP+87Dv1oQ==" + }, "node_modules/jsonfile": { "version": "6.1.0", "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.1.0.tgz", @@ -9392,6 +9398,95 @@ "webpack": "^4.5.0 || 5.x" } }, + "node_modules/monaco-languageserver-types": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/monaco-languageserver-types/-/monaco-languageserver-types-0.4.0.tgz", + "integrity": "sha512-QQ3BZiU5LYkJElGncSNb5AKoJ/LCs6YBMCJMAz9EA7v+JaOdn3kx2cXpPTcZfKA5AEsR0vc97sAw+5mdNhVBmw==", + "dependencies": { + "monaco-types": "^0.1.0", + "vscode-languageserver-protocol": "^3.0.0", + "vscode-uri": "^3.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/remcohaszing" + } + }, + "node_modules/monaco-marker-data-provider": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/monaco-marker-data-provider/-/monaco-marker-data-provider-1.2.3.tgz", + "integrity": "sha512-BOiQs9UNEwVrF1rwYI32HUP8D7JTuHlJRlykx83e4+jfh1ceBWIBfB5ENDVSFUz651d95kxjKj36vV2JO3zr9w==", + "dependencies": { + "monaco-types": "^0.1.0" + }, + "funding": { + "url": "https://github.com/sponsors/remcohaszing" + } + }, + "node_modules/monaco-types": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/monaco-types/-/monaco-types-0.1.0.tgz", + "integrity": "sha512-aWK7SN9hAqNYi0WosPoMjenMeXJjwCxDibOqWffyQ/qXdzB/86xshGQobRferfmNz7BSNQ8GB0MD0oby9/5fTQ==", + "funding": { + "url": "https://github.com/sponsors/remcohaszing" + } + }, + "node_modules/monaco-worker-manager": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/monaco-worker-manager/-/monaco-worker-manager-2.0.1.tgz", + "integrity": "sha512-kdPL0yvg5qjhKPNVjJoym331PY/5JC11aPJXtCZNwWRvBr6jhkIamvYAyiY5P1AWFmNOy0aRDRoMdZfa71h8kg==", + "peerDependencies": { + "monaco-editor": ">=0.30.0" + } + }, + "node_modules/monaco-yaml": { + "version": "5.2.2", + "resolved": "https://registry.npmjs.org/monaco-yaml/-/monaco-yaml-5.2.2.tgz", + "integrity": "sha512-NWO/UhtJATlIsqwWPzK7YfbcIvPo3riFGsUkaGxNJoGiNPOvHD8vZ83ecqMQGkHPOpgHtSbe94uokE1AJvpbyQ==", + "dependencies": { + "jsonc-parser": "^3.0.0", + "monaco-languageserver-types": "^0.4.0", + "monaco-marker-data-provider": "^1.0.0", + "monaco-types": "^0.1.0", + "monaco-worker-manager": "^2.0.0", + "path-browserify": "^1.0.0", + "prettier": "^2.0.0", + "vscode-languageserver-textdocument": "^1.0.0", + "vscode-languageserver-types": "^3.0.0", + "vscode-uri": "^3.0.0", + "yaml": "^2.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/remcohaszing" + }, + "peerDependencies": { + "monaco-editor": ">=0.36" + } + }, + "node_modules/monaco-yaml/node_modules/prettier": { + "version": "2.8.8", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.8.8.tgz", + "integrity": "sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q==", + "bin": { + "prettier": "bin-prettier.js" + }, + "engines": { + "node": ">=10.13.0" + }, + "funding": { + "url": "https://github.com/prettier/prettier?sponsor=1" + } + }, + "node_modules/monaco-yaml/node_modules/yaml": { + "version": "2.5.1", + "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.5.1.tgz", + "integrity": "sha512-bLQOjaX/ADgQ20isPJRvF0iRUHIxVhYvr53Of7wGcWlO2jvtUlH5m87DsmulFVxRpNLOnI4tB6p/oh8D7kpn9Q==", + "bin": { + "yaml": "bin.mjs" + }, + "engines": { + "node": ">= 14" + } + }, "node_modules/ms": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", @@ -10650,8 +10745,7 @@ "node_modules/path-browserify": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/path-browserify/-/path-browserify-1.0.1.tgz", - "integrity": "sha512-b7uo2UCUOYZcnF/3ID0lulOJi/bafxa1xPe7ZPsammBSpjSWQkjNxlt635YGS2MiR9GjvuXCtz2emr3jbsz98g==", - "dev": true + "integrity": "sha512-b7uo2UCUOYZcnF/3ID0lulOJi/bafxa1xPe7ZPsammBSpjSWQkjNxlt635YGS2MiR9GjvuXCtz2emr3jbsz98g==" }, "node_modules/path-exists": { "version": "4.0.0", @@ -14164,6 +14258,38 @@ "integrity": "sha512-2ham8XPWTONajOR0ohOKOHXkm3+gaBmGut3SRuu75xLd/RRaY6vqgh8NBYYk7+RW3u5AtzPQZG8F10LHkl0lAQ==", "dev": true }, + "node_modules/vscode-jsonrpc": { + "version": "8.2.0", + "resolved": "https://registry.npmjs.org/vscode-jsonrpc/-/vscode-jsonrpc-8.2.0.tgz", + "integrity": "sha512-C+r0eKJUIfiDIfwJhria30+TYWPtuHJXHtI7J0YlOmKAo7ogxP20T0zxB7HZQIFhIyvoBPwWskjxrvAtfjyZfA==", + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/vscode-languageserver-protocol": { + "version": "3.17.5", + "resolved": "https://registry.npmjs.org/vscode-languageserver-protocol/-/vscode-languageserver-protocol-3.17.5.tgz", + "integrity": "sha512-mb1bvRJN8SVznADSGWM9u/b07H7Ecg0I3OgXDuLdn307rl/J3A9YD6/eYOssqhecL27hK1IPZAsaqh00i/Jljg==", + "dependencies": { + "vscode-jsonrpc": "8.2.0", + "vscode-languageserver-types": "3.17.5" + } + }, + "node_modules/vscode-languageserver-textdocument": { + "version": "1.0.12", + "resolved": "https://registry.npmjs.org/vscode-languageserver-textdocument/-/vscode-languageserver-textdocument-1.0.12.tgz", + "integrity": "sha512-cxWNPesCnQCcMPeenjKKsOCKQZ/L6Tv19DTRIGuLWe32lyzWhihGVJ/rcckZXJxfdKCFvRLS3fpBIsV/ZGX4zA==" + }, + "node_modules/vscode-languageserver-types": { + "version": "3.17.5", + "resolved": "https://registry.npmjs.org/vscode-languageserver-types/-/vscode-languageserver-types-3.17.5.tgz", + "integrity": "sha512-Ld1VelNuX9pdF39h2Hgaeb5hEZM2Z3jUrrMgWQAu82jMtZp7p3vJT3BzToKtZI7NgQssZje5o0zryOrhQvzQAg==" + }, + "node_modules/vscode-uri": { + "version": "3.0.8", + "resolved": "https://registry.npmjs.org/vscode-uri/-/vscode-uri-3.0.8.tgz", + "integrity": "sha512-AyFQ0EVmsOZOlAnxoFOGOq1SQDWAB7C6aqMGS23svWAllfOaxbuFvcT8D1i8z3Gyn8fraVeZNNmN6e9bxxXkKw==" + }, "node_modules/w3-css": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/w3-css/-/w3-css-4.1.0.tgz", @@ -21451,8 +21577,8 @@ "dev": true }, "heta-compiler": { - "version": "git+ssh://git@github.com/hetalang/heta-compiler.git#ba7dc26731b8472031d6c93b0675f4504db37b5c", - "from": "heta-compiler@github:hetalang/heta-compiler#rewrite-export", + "version": "git+ssh://git@github.com/hetalang/heta-compiler.git#af898c0b43e8326198a8233acd4b6dd5a1de620f", + "from": "heta-compiler@hetalang/heta-compiler#relative-paths", "requires": { "@insysbio/topo-sort": "^1.0.1", "ajv": "^8.17.1", @@ -22317,6 +22443,11 @@ "integrity": "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==", "dev": true }, + "jsonc-parser": { + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/jsonc-parser/-/jsonc-parser-3.3.1.tgz", + "integrity": "sha512-HUgH65KyejrUFPvHFPbqOY0rsFip3Bo5wb4ngvdi1EpCYWUQDC5V+Y7mZws+DLkr4M//zQJoanu1SP+87Dv1oQ==" + }, "jsonfile": { "version": "6.1.0", "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.1.0.tgz", @@ -22976,6 +23107,65 @@ "loader-utils": "^2.0.2" } }, + "monaco-languageserver-types": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/monaco-languageserver-types/-/monaco-languageserver-types-0.4.0.tgz", + "integrity": "sha512-QQ3BZiU5LYkJElGncSNb5AKoJ/LCs6YBMCJMAz9EA7v+JaOdn3kx2cXpPTcZfKA5AEsR0vc97sAw+5mdNhVBmw==", + "requires": { + "monaco-types": "^0.1.0", + "vscode-languageserver-protocol": "^3.0.0", + "vscode-uri": "^3.0.0" + } + }, + "monaco-marker-data-provider": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/monaco-marker-data-provider/-/monaco-marker-data-provider-1.2.3.tgz", + "integrity": "sha512-BOiQs9UNEwVrF1rwYI32HUP8D7JTuHlJRlykx83e4+jfh1ceBWIBfB5ENDVSFUz651d95kxjKj36vV2JO3zr9w==", + "requires": { + "monaco-types": "^0.1.0" + } + }, + "monaco-types": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/monaco-types/-/monaco-types-0.1.0.tgz", + "integrity": "sha512-aWK7SN9hAqNYi0WosPoMjenMeXJjwCxDibOqWffyQ/qXdzB/86xshGQobRferfmNz7BSNQ8GB0MD0oby9/5fTQ==" + }, + "monaco-worker-manager": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/monaco-worker-manager/-/monaco-worker-manager-2.0.1.tgz", + "integrity": "sha512-kdPL0yvg5qjhKPNVjJoym331PY/5JC11aPJXtCZNwWRvBr6jhkIamvYAyiY5P1AWFmNOy0aRDRoMdZfa71h8kg==", + "requires": {} + }, + "monaco-yaml": { + "version": "5.2.2", + "resolved": "https://registry.npmjs.org/monaco-yaml/-/monaco-yaml-5.2.2.tgz", + "integrity": "sha512-NWO/UhtJATlIsqwWPzK7YfbcIvPo3riFGsUkaGxNJoGiNPOvHD8vZ83ecqMQGkHPOpgHtSbe94uokE1AJvpbyQ==", + "requires": { + "jsonc-parser": "^3.0.0", + "monaco-languageserver-types": "^0.4.0", + "monaco-marker-data-provider": "^1.0.0", + "monaco-types": "^0.1.0", + "monaco-worker-manager": "^2.0.0", + "path-browserify": "^1.0.0", + "prettier": "^2.0.0", + "vscode-languageserver-textdocument": "^1.0.0", + "vscode-languageserver-types": "^3.0.0", + "vscode-uri": "^3.0.0", + "yaml": "^2.0.0" + }, + "dependencies": { + "prettier": { + "version": "2.8.8", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.8.8.tgz", + "integrity": "sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q==" + }, + "yaml": { + "version": "2.5.1", + "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.5.1.tgz", + "integrity": "sha512-bLQOjaX/ADgQ20isPJRvF0iRUHIxVhYvr53Of7wGcWlO2jvtUlH5m87DsmulFVxRpNLOnI4tB6p/oh8D7kpn9Q==" + } + } + }, "ms": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", @@ -23920,8 +24110,7 @@ "path-browserify": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/path-browserify/-/path-browserify-1.0.1.tgz", - "integrity": "sha512-b7uo2UCUOYZcnF/3ID0lulOJi/bafxa1xPe7ZPsammBSpjSWQkjNxlt635YGS2MiR9GjvuXCtz2emr3jbsz98g==", - "dev": true + "integrity": "sha512-b7uo2UCUOYZcnF/3ID0lulOJi/bafxa1xPe7ZPsammBSpjSWQkjNxlt635YGS2MiR9GjvuXCtz2emr3jbsz98g==" }, "path-exists": { "version": "4.0.0", @@ -26529,6 +26718,35 @@ "integrity": "sha512-2ham8XPWTONajOR0ohOKOHXkm3+gaBmGut3SRuu75xLd/RRaY6vqgh8NBYYk7+RW3u5AtzPQZG8F10LHkl0lAQ==", "dev": true }, + "vscode-jsonrpc": { + "version": "8.2.0", + "resolved": "https://registry.npmjs.org/vscode-jsonrpc/-/vscode-jsonrpc-8.2.0.tgz", + "integrity": "sha512-C+r0eKJUIfiDIfwJhria30+TYWPtuHJXHtI7J0YlOmKAo7ogxP20T0zxB7HZQIFhIyvoBPwWskjxrvAtfjyZfA==" + }, + "vscode-languageserver-protocol": { + "version": "3.17.5", + "resolved": "https://registry.npmjs.org/vscode-languageserver-protocol/-/vscode-languageserver-protocol-3.17.5.tgz", + "integrity": "sha512-mb1bvRJN8SVznADSGWM9u/b07H7Ecg0I3OgXDuLdn307rl/J3A9YD6/eYOssqhecL27hK1IPZAsaqh00i/Jljg==", + "requires": { + "vscode-jsonrpc": "8.2.0", + "vscode-languageserver-types": "3.17.5" + } + }, + "vscode-languageserver-textdocument": { + "version": "1.0.12", + "resolved": "https://registry.npmjs.org/vscode-languageserver-textdocument/-/vscode-languageserver-textdocument-1.0.12.tgz", + "integrity": "sha512-cxWNPesCnQCcMPeenjKKsOCKQZ/L6Tv19DTRIGuLWe32lyzWhihGVJ/rcckZXJxfdKCFvRLS3fpBIsV/ZGX4zA==" + }, + "vscode-languageserver-types": { + "version": "3.17.5", + "resolved": "https://registry.npmjs.org/vscode-languageserver-types/-/vscode-languageserver-types-3.17.5.tgz", + "integrity": "sha512-Ld1VelNuX9pdF39h2Hgaeb5hEZM2Z3jUrrMgWQAu82jMtZp7p3vJT3BzToKtZI7NgQssZje5o0zryOrhQvzQAg==" + }, + "vscode-uri": { + "version": "3.0.8", + "resolved": "https://registry.npmjs.org/vscode-uri/-/vscode-uri-3.0.8.tgz", + "integrity": "sha512-AyFQ0EVmsOZOlAnxoFOGOq1SQDWAB7C6aqMGS23svWAllfOaxbuFvcT8D1i8z3Gyn8fraVeZNNmN6e9bxxXkKw==" + }, "w3-css": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/w3-css/-/w3-css-4.1.0.tgz", diff --git a/package.json b/package.json index 8ae64a3..4f75bde 100644 --- a/package.json +++ b/package.json @@ -47,11 +47,12 @@ }, "dependencies": { "@viz-js/viz": "^3.2.3", - "heta-compiler": "github:hetalang/heta-compiler#rewrite-export", + "heta-compiler": "github:hetalang/heta-compiler#relative-paths", "jquery": "^3.7.0", "js-yaml": "^4.1.0", "jszip": "^3.10.1", "monaco-editor": "^0.44.0", + "monaco-yaml": "^5.2.2", "w3-css": "^4.1.0" }, "engines": { diff --git a/src/app.js b/src/app.js index 289031c..3000b33 100644 --- a/src/app.js +++ b/src/app.js @@ -222,7 +222,7 @@ $(async () => { // save all as object {filepath1: buffer1, filepath2: buffer2, ...} let fileDict = {}; for (let [filepath, page] of leftCollection.pagesStorage) { - fileDict['/' + filepath] = await page.getArrayBuffer(); // ArrayBuffer + fileDict[filepath] = await page.getArrayBuffer(); // ArrayBuffer } // run builder diff --git a/src/build.js b/src/build.js index a719714..eb66ece 100644 --- a/src/build.js +++ b/src/build.js @@ -40,7 +40,7 @@ self.onmessage = (evt) => { return; // BRAKE } -console.log(builder) + if (builder.container.hetaErrors().length > 0) { postMessage({action: 'console', value: 'Compilation ERROR! See logs.\n'}); postMessage({action: 'finished', dict: outputDict}); @@ -57,7 +57,7 @@ function main(inputDict, outputDict) { // === read declaration file === // search - let declarationFileName = ['/platform.json', '/platform.yml', '/platform'].find((x) => inputDict[x]); + let declarationFileName = ['platform.json', 'platform.yml', 'platform'].find((x) => inputDict[x]); let declarationBuffer = inputDict[declarationFileName]; if (!declarationBuffer) { @@ -86,7 +86,9 @@ function main(inputDict, outputDict) { postMessage({action: 'console', value: value}); } } - var builder = new Builder(declaration, '/', (fn) => { + + var builder = new Builder(declaration, '.', (fn) => { + let arrayBuffer = inputDict[fn]; // Uint8Array if (!arrayBuffer) { throw new HetaLevelError(`Module ${fn} is not found,`); diff --git a/src/heta-templates/platform.yml.template.js b/src/heta-templates/platform.yml.template.js index 61784cd..885e0d4 100644 --- a/src/heta-templates/platform.yml.template.js +++ b/src/heta-templates/platform.yml.template.js @@ -20,8 +20,8 @@ export default `{ export: [ { format: JSON, omit: [], noUnitsExpr: false }, #{ format: YAML, omit: [], noUnitsExpr: false }, - #{ format: DBSolve, powTransform: keep, version: 26 }, - #{ format: SLV, eventsOff: false, powTransform: keep, version: 26 }, + #{ format: DBSolve, powTransform: keep, version: 26, groupConstBy: 'tags[0]' }, + #{ format: SLV, eventsOff: false, powTransform: keep, version: 26, groupConstBy: 'tags[0]' }, { format: SBML, version: L2V4 }, #{ format: Simbio }, #{ format: Mrgsolve }, diff --git a/src/platform-shemas.js b/src/platform-shemas.js index 5eb0cbe..73eb2b9 100644 --- a/src/platform-shemas.js +++ b/src/platform-shemas.js @@ -1,13 +1,33 @@ import * as monaco from 'monaco-editor/esm/vs/editor/editor.api'; -import declarationSchema from 'heta-compiler/src/builder/declaration-schema.json'; +//import declarationSchema from 'heta-compiler/src/builder/declaration-schema.json'; +//import { configureMonacoYaml } from 'monaco-yaml'; monaco.languages.json.jsonDefaults.setDiagnosticsOptions({ validate: true, - schemas: [ - { - uri: "https://hetalang.github.io/heta-compiler/declaration-schema.json", - fileMatch: ['*'], - schema: declarationSchema - } - ] + enableSchemaRequest: true }); + +/* +configureMonacoYaml(monaco, { + enableSchemaRequest: true, // XXX: Does not work + //hover: true, // Enable hover information + //completion: true, // Enable auto-completion + validate: true, // Enable validation + //format: true, // Enable formatting +}); + +window.MonacoEnvironment = { + getWorker(moduleId, label) { + switch (label) { + case 'editorWorkerService': + return new Worker(new URL('monaco-editor/esm/vs/editor/editor.worker', import.meta.url)) + case 'yaml': + return new Worker(new URL('monaco-yaml/yaml.worker', import.meta.url)); + case 'json': + return new Worker(new URL('monaco-editor/esm/vs/language/json/json.worker', import.meta.url)); + default: + throw new Error(`Unknown label ${label}`); + } + } +}; +*/ \ No newline at end of file