@abi-software/simulationvuer 3.2.6 → 4.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abi-software/simulationvuer",
3
- "version": "3.2.6",
3
+ "version": "4.0.1",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "serve": "vite serve --host --force",
@@ -21,32 +21,35 @@
21
21
  },
22
22
  "dependencies": {
23
23
  "@abi-software/plotvuer": "1.0.7",
24
- "@opencor/opencor": "^0.20260616.0",
24
+ "@opencor/opencor": "^0.20260729.0",
25
25
  "element-plus": "2.8.4",
26
- "jsonschema": "^1.4.0",
27
- "mathjs": "^15.1.0",
26
+ "jsonschema": "^1.5.0",
27
+ "mathjs": "^15.2.0",
28
28
  "unplugin-vue-components": "^0.26.0",
29
- "vue": "^3.4.21"
29
+ "vue": "3.4.21"
30
30
  },
31
31
  "devDependencies": {
32
- "@babel/eslint-parser": "^7.28.6",
33
- "@vitejs/plugin-vue": "^5.0.3",
32
+ "@babel/eslint-parser": "^7.29.7",
33
+ "@vitejs/plugin-vue": "^5.2.4",
34
34
  "@vuese/markdown-render": "^2.11.3",
35
35
  "babel-eslint": "^10.1.0",
36
36
  "babel-plugin-component": "^1.1.1",
37
37
  "base64-inline-loader": "^2.0.1",
38
38
  "chokidar": "^3.6.0",
39
39
  "concurrently": "^8.2.2",
40
- "eslint": "^8.56.0",
41
- "eslint-config-prettier": "^9.0.0",
42
- "eslint-plugin-prettier": "^5.0.0",
43
- "eslint-plugin-vue": "^9.20.1",
44
- "prettier": "^3.0.0",
45
- "sass": "^1.70.0",
46
- "vite": "^5.0.12",
47
- "vitepress": "^1.0.0-rc.45",
40
+ "eslint": "^8.57.1",
41
+ "eslint-config-prettier": "^9.1.2",
42
+ "eslint-plugin-prettier": "^5.5.6",
43
+ "eslint-plugin-vue": "^9.33.0",
44
+ "jsonschema": "^1.5.0",
45
+ "mathjs": "^15.2.0",
46
+ "prettier": "^3.9.6",
47
+ "sass": "^1.102.0",
48
+ "unplugin-vue-components": "^0.26.0",
49
+ "vite": "^5.4.21",
50
+ "vitepress": "^1.6.4",
48
51
  "vue-docgen-api": "^4.79.2",
49
- "vue-router": "^4.2.5",
52
+ "vue-router": "4.2.5",
50
53
  "webpack-node-externals": "^2.5.2"
51
54
  },
52
55
  "eslintConfig": {
package/vite.config.js CHANGED
@@ -1,5 +1,6 @@
1
1
  import vue from "@vitejs/plugin-vue";
2
2
 
3
+ import fs from "node:fs";
3
4
  import path from "node:path";
4
5
  import { fileURLToPath } from "node:url";
5
6
  import { ElementPlusResolver } from "unplugin-vue-components/resolvers";
@@ -25,24 +26,70 @@ export default defineConfig(({ command, mode }) => {
25
26
  ],
26
27
  dts: "src/components.d.ts",
27
28
  }),
28
- ],
29
- build: {
30
- lib: {
31
- entry: path.resolve(__dirname, "./src/components/index.js"),
32
- name: "SimulationVuer",
33
- fileName: "simulationvuer",
34
- },
35
- rollupOptions: {
36
- external: ["vue", "@abi-software/svg-sprite", "@abi-software/plotvuer"],
37
- output: {
38
- globals: {
39
- vue: "Vue",
40
- "@abi-software/svg-sprite": "@abi-software/svg-sprite",
41
- "@abi-software/plotvuer": "@abi-software/plotvuer",
42
- },
29
+
30
+ // Serve the local libopencor/ directory from @opencor/opencor so that the dynamic import in opencor.es.js (new
31
+ // URL("./libopencor/wasm/...", window.location.href)) resolves same-origin. libopencor.js itself is bundled in
32
+ // the package while the threaded WASM is loaded from opencor.ws via locateFile.
33
+
34
+ {
35
+ name: "opencor-serve-local-libopencor",
36
+ configureServer(server) {
37
+ const libopencorDir = path.resolve(
38
+ __dirname,
39
+ "node_modules/@opencor/opencor/dist/libopencor",
40
+ );
41
+
42
+ server.middlewares.use((req, res, next) => {
43
+ const urlPath = req.url;
44
+
45
+ if (urlPath.startsWith("/libopencor/")) {
46
+ const filePath = path.join(
47
+ libopencorDir,
48
+ urlPath.replace("/libopencor/", ""),
49
+ );
50
+
51
+ if (fs.existsSync(filePath)) {
52
+ res.writeHead(200, {
53
+ "Content-Type": "application/javascript",
54
+ "Cross-Origin-Embedder-Policy": "require-corp",
55
+ "Cross-Origin-Resource-Policy": "same-origin",
56
+ });
57
+ res.end(fs.readFileSync(filePath));
58
+
59
+ return;
60
+ }
61
+ }
62
+
63
+ next();
64
+ });
43
65
  },
44
66
  },
45
- },
67
+ ],
68
+ base: mode === "app" ? "./" : "/",
69
+ build:
70
+ mode === "app"
71
+ ? {}
72
+ : {
73
+ lib: {
74
+ entry: path.resolve(__dirname, "./src/components/index.js"),
75
+ name: "SimulationVuer",
76
+ fileName: "simulationvuer",
77
+ },
78
+ rollupOptions: {
79
+ external: [
80
+ "vue",
81
+ "@abi-software/svg-sprite",
82
+ "@abi-software/plotvuer",
83
+ ],
84
+ output: {
85
+ globals: {
86
+ vue: "Vue",
87
+ "@abi-software/svg-sprite": "@abi-software/svg-sprite",
88
+ "@abi-software/plotvuer": "@abi-software/plotvuer",
89
+ },
90
+ },
91
+ },
92
+ },
46
93
  resolve: {
47
94
  alias: {
48
95
  "~/": `${pathSrc}/`,
@@ -53,6 +100,13 @@ export default defineConfig(({ command, mode }) => {
53
100
  if (command === "serve") {
54
101
  config.server = {
55
102
  port: 8081,
103
+
104
+ // Emscripten pthreads require SharedArrayBuffer, which needs cross-origin isolation.
105
+
106
+ headers: {
107
+ "Cross-Origin-Opener-Policy": "same-origin",
108
+ "Cross-Origin-Embedder-Policy": "require-corp",
109
+ },
56
110
  };
57
111
  config.define = {
58
112
  "process.env.HTTP_PROXY": 8081,
@@ -60,13 +114,5 @@ export default defineConfig(({ command, mode }) => {
60
114
  };
61
115
  }
62
116
 
63
- if (mode === "app") {
64
- config.base = "./";
65
-
66
- for (const key of ["build", "define", "resolve", "server"]) {
67
- delete config[key];
68
- }
69
- }
70
-
71
117
  return config;
72
118
  });