@abi-software/simulationvuer 4.0.4 → 4.1.0

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.
@@ -0,0 +1,40 @@
1
+ import js from "@eslint/js";
2
+ import prettier from "eslint-plugin-prettier";
3
+ import prettierConfig from "eslint-config-prettier";
4
+ import vue from "eslint-plugin-vue";
5
+ import globals from "globals";
6
+
7
+ export default [
8
+ {
9
+ ignores: ["dist/**", "docs/.vitepress/**", "docs/components/**"],
10
+ },
11
+ js.configs.recommended,
12
+ ...vue.configs["flat/essential"],
13
+ prettierConfig,
14
+ {
15
+ files: ["**/*.{js,vue}"],
16
+ plugins: {
17
+ prettier,
18
+ },
19
+ languageOptions: {
20
+ ecmaVersion: "latest",
21
+ sourceType: "module",
22
+ globals: {
23
+ ...globals.node,
24
+ ...globals.browser,
25
+ },
26
+ },
27
+ rules: {
28
+ "prettier/prettier": "error",
29
+ "arrow-body-style": "off",
30
+ "prefer-arrow-callback": "off",
31
+ "no-unused-vars": [
32
+ "error",
33
+ {
34
+ argsIgnorePattern: "^_",
35
+ caughtErrorsIgnorePattern: "^_",
36
+ },
37
+ ],
38
+ },
39
+ },
40
+ ];
package/package.json CHANGED
@@ -1,7 +1,10 @@
1
1
  {
2
2
  "name": "@abi-software/simulationvuer",
3
- "version": "4.0.4",
3
+ "version": "4.1.0",
4
4
  "private": false,
5
+ "engines": {
6
+ "node": ">=20"
7
+ },
5
8
  "scripts": {
6
9
  "serve": "vite serve --host --force",
7
10
  "build-bundle": "vite build",
@@ -10,7 +13,7 @@
10
13
  "vuese-watch": "node vuese-generator.js watch",
11
14
  "format": "prettier --write .",
12
15
  "format:check": "prettier --check .",
13
- "lint": "eslint . --ext .js,.vue",
16
+ "lint": "eslint .",
14
17
  "release:beta": "npm version prerelease --preid=beta; npm publish --tag beta",
15
18
  "release:minor": "npm version minor; npm publish",
16
19
  "release:patch": "npm version patch; npm publish",
@@ -20,56 +23,41 @@
20
23
  "docs:preview": "vitepress preview docs"
21
24
  },
22
25
  "dependencies": {
23
- "@abi-software/plotvuer": "1.0.7",
24
- "@opencor/opencor": "^0.20260803.0",
25
- "element-plus": "2.8.4",
26
+ "@abi-software/plotvuer": "1.2.0",
27
+ "@opencor/opencor": "^0.20260804.0",
28
+ "element-plus": "^2.14.5",
26
29
  "jsonschema": "^1.5.0",
27
30
  "mathjs": "^15.2.0",
28
- "unplugin-vue-components": "^0.26.0",
29
- "vue": "3.4.21"
31
+ "vue": "^3.5.41",
32
+ "vue-router": "^5.2.0"
30
33
  },
31
34
  "devDependencies": {
32
- "@babel/eslint-parser": "^7.29.7",
33
- "@vitejs/plugin-vue": "^5.2.4",
35
+ "@babel/eslint-parser": "^8.0.1",
36
+ "@eslint/js": "^10.0.1",
37
+ "@vitejs/plugin-vue": "^6.0.8",
34
38
  "@vuese/markdown-render": "^2.11.3",
35
- "babel-eslint": "^10.1.0",
36
39
  "babel-plugin-component": "^1.1.1",
37
40
  "base64-inline-loader": "^2.0.1",
38
- "chokidar": "^3.6.0",
39
- "concurrently": "^8.2.2",
40
- "eslint": "^8.57.1",
41
- "eslint-config-prettier": "^9.1.2",
41
+ "chokidar": "^5.0.0",
42
+ "concurrently": "^9.2.4",
43
+ "globals": "^17.11.0",
44
+ "eslint": "^10.9.1",
45
+ "eslint-config-prettier": "^10.1.8",
42
46
  "eslint-plugin-prettier": "^5.5.6",
43
- "eslint-plugin-vue": "^9.33.0",
44
- "jsonschema": "^1.5.0",
45
- "mathjs": "^15.2.0",
47
+ "eslint-plugin-vue": "^10.10.0",
46
48
  "prettier": "^3.9.6",
47
- "sass": "^1.102.0",
48
- "unplugin-vue-components": "^0.26.0",
49
- "vite": "^5.4.21",
49
+ "sass": "^1.103.1",
50
+ "unplugin-vue-components": "^32.1.0",
51
+ "vite": "^8.2.1",
50
52
  "vitepress": "^1.6.4",
51
- "vue-docgen-api": "^4.79.2",
52
- "vue-router": "4.2.5",
53
- "webpack-node-externals": "^2.5.2"
53
+ "vue-docgen-api": "^4.79.2"
54
54
  },
55
- "eslintConfig": {
56
- "root": true,
57
- "plugins": [
58
- "prettier"
59
- ],
60
- "extends": [
61
- "eslint:recommended",
62
- "plugin:prettier/recommended",
63
- "plugin:vue/essential"
64
- ],
65
- "env": {
66
- "node": true
67
- },
68
- "parserOptions": {
69
- "parser": "@babel/eslint-parser",
70
- "requireConfigFile": false
71
- },
72
- "rules": {}
55
+ "optionalDependencies": {
56
+ "@esbuild/darwin-arm64": "0.28.2",
57
+ "@esbuild/linux-x64": "0.28.2",
58
+ "@rollup/rollup-darwin-arm64": "4.63.0",
59
+ "@rollup/rollup-linux-x64-gnu": "4.63.0",
60
+ "@rollup/rollup-win32-x64-msvc": "4.63.0"
73
61
  },
74
62
  "browserslist": [
75
63
  "> 1%",
@@ -1,6 +1,7 @@
1
- @import url("https://fonts.googleapis.com/css?family=Asap:400,400i,500,600,700&display=swap");
1
+ @use "_variables" as *;
2
+ @forward "_variables";
2
3
 
3
- @import "_variables";
4
+ @import url("https://fonts.googleapis.com/css?family=Asap:400,400i,500,600,700&display=swap");
4
5
 
5
6
  /* icon font path, required */
6
7
  $--color-primary: $app-primary-color !default;
@@ -1,10 +1,14 @@
1
1
  /* eslint-disable */
2
- /* prettier-ignore */
3
2
  // @ts-nocheck
3
+ // biome-ignore lint: disable
4
+ // oxlint-disable
5
+ // ------
4
6
  // Generated by unplugin-vue-components
5
7
  // Read more: https://github.com/vuejs/core/pull/3399
8
+
6
9
  export {}
7
10
 
11
+ /* prettier-ignore */
8
12
  declare module 'vue' {
9
13
  export interface GlobalComponents {
10
14
  ElButton: typeof import('element-plus/es')['ElButton']
@@ -18,7 +22,7 @@ declare module 'vue' {
18
22
  SimulationVuer: typeof import('./components/SimulationVuer.vue')['default']
19
23
  SimulationVuerInput: typeof import('./components/SimulationVuerInput.vue')['default']
20
24
  }
21
- export interface ComponentCustomProperties {
25
+ export interface GlobalDirectives {
22
26
  vLoading: typeof import('element-plus/es')['ElLoadingDirective']
23
27
  }
24
28
  }
package/vite.config.js CHANGED
@@ -16,6 +16,14 @@ const libopencorDir = path.resolve(
16
16
 
17
17
  export default defineConfig(({ command, mode }) => {
18
18
  const config = {
19
+ css: {
20
+ preprocessorOptions: {
21
+ scss: {
22
+ api: "modern-compiler",
23
+ additionalData: `@use '@/assets/styles' as *;`,
24
+ },
25
+ },
26
+ },
19
27
  plugins: [
20
28
  vue(),
21
29
  Components({
@@ -31,53 +39,23 @@ export default defineConfig(({ command, mode }) => {
31
39
  dts: "src/components.d.ts",
32
40
  }),
33
41
 
34
- // Resolve the libopencor.js import URL in @opencor/opencor's opencor.es.js so that it works for all consumers
35
- // (not just Vite projects) and this without server configuration.
42
+ // Serve libOpenCOR for OpenCOR's runtime probe.
36
43
  //
37
- // In @opencor/opencor, the code uses:
38
- // new URL("./libopencor/wasm/<version>/libopencor.js", window.location.href).href
44
+ // In @opencor/opencor, opencor.es.js locates its glue code at runtime:
45
+ // new URL("libopencor/downloads/wasm/<version>/libopencor.js", document.baseURI).href
46
+ // and fetches that same-origin path (HEAD) before falling back to opencor.ws. The WASM is always loaded from a
47
+ // hardcoded opencor.ws base via locateFile. The probe is evaluated at runtime and the glue is imported
48
+ // dynamically (with @vite-ignore), so there is no static URL for Vite to rewrite.
39
49
  //
40
- // This resolves relative to the page URL, requiring the server to host libopencor.js at a page-relative path
41
- // (which doesn't work for library consumers or static builds).
42
- //
43
- // We fix this by:
44
- // - Dev (serve): rewriting to "/libopencor/libopencor.js", served by the middleware below.
45
- // - Build (lib): rewriting to use import.meta.url, so the import resolves relative to simulationvuer.js's URL
46
- // (same directory, libopencor.js is copied alongside it via closeBundle).
50
+ // The probe is satisfied by:
51
+ // - Dev (serve): serving "/libopencor/*" from the installed package via the middleware below, so the probe
52
+ // resolves same-origin (required for pthread Workers).
53
+ // - Build (lib): copying the package's libOpenCOR dir to dist/libopencor via closeBundle, so the
54
+ // document-relative probe hits when the page is served from the dist root (otherwise OpenCOR
55
+ // falls back to opencor.ws).
47
56
 
48
57
  {
49
58
  name: "opencor-libopencor",
50
- transform(code, id) {
51
- if (id.includes("@opencor/opencor") && id.endsWith("opencor.es.js")) {
52
- const importRegex =
53
- /(\/\*\s*@vite-ignore\s*\*\/[\s\n]*)(new URL\("(\.\/libopencor\/wasm\/[^/]+\/libopencor\.js)",\s*window\.location\.href\)\.href)/g;
54
- const res = code.replace(
55
- importRegex,
56
- (_match, prefix, _urlExpr, urlPath) => {
57
- if (command === "serve") {
58
- // Dev mode: absolute path served by the middleware below.
59
-
60
- return `${prefix}"/libopencor/libopencor.js"`;
61
- }
62
-
63
- // Build mode: resolve relative to the bundle's own URL.
64
- // Note: we use replace() instead of new URL(..., import.meta.url) to avoid Vite's asset handler, which
65
- // would inline the file as a data: URL (which breaks Emscripten's pthread Worker creation). At
66
- // runtime, import.meta.url points to simulationvuer.js and the derived path correctly reaches
67
- // libopencor in the same directory (copied alongside by closeBundle).
68
-
69
- return `${prefix}import.meta.url.replace(/[^/]*$/, "") + ${JSON.stringify(urlPath.substring(2))}`;
70
- },
71
- );
72
-
73
- if (res !== code) {
74
- return {
75
- code: res,
76
- map: null,
77
- };
78
- }
79
- }
80
- },
81
59
  configureServer(server) {
82
60
  // Serve libopencor files from @opencor/opencor during development so the dynamic import in opencor.es.js
83
61
  // resolves same-origin (required for pthread Workers).
@@ -178,18 +156,19 @@ export default defineConfig(({ command, mode }) => {
178
156
  });
179
157
  },
180
158
  closeBundle() {
181
- // Copy libopencor alongside the built JavaScript file so that the dynamic import (using import.meta.url as
182
- // base) resolves correctly. App mode puts the built JavaScript file in dist/assets while lib mode puts it in
183
- // dist.
159
+ // Copy liboOpenCOR to the dist root (dist/libopencor) so that OpenCOR's document-relative probe
160
+ // (`<baseURI>/libopencor/downloads/wasm/<version>/libopencor.js`) resolves: in app mode, dist is the
161
+ // deployment root, and in lib mode the probed files ship in the package for consumers that serve them at the
162
+ // page root (everyone else falls back to opencor.ws).
184
163
 
185
164
  if (!fs.existsSync(libopencorDir)) {
186
165
  return;
187
166
  }
188
167
 
189
- const distDir = path.resolve(__dirname, "dist");
190
- const targetDir = fs.existsSync(path.join(distDir, "assets"))
191
- ? path.join(distDir, "assets", "libopencor")
192
- : path.join(distDir, "libopencor");
168
+ const targetDir = path.join(
169
+ path.resolve(__dirname, "dist"),
170
+ "libopencor",
171
+ );
193
172
 
194
173
  fs.cpSync(libopencorDir, targetDir, { recursive: true, force: true });
195
174
  },
@@ -217,11 +196,17 @@ export default defineConfig(({ command, mode }) => {
217
196
  "@abi-software/svg-sprite": "@abi-software/svg-sprite",
218
197
  "@abi-software/plotvuer": "@abi-software/plotvuer",
219
198
  },
199
+ // keep css output name stable for the "./dist/style.css" export/import paths
200
+ assetFileNames: (assetInfo) =>
201
+ assetInfo.name?.endsWith(".css")
202
+ ? "style.css"
203
+ : "assets/[name][extname]",
220
204
  },
221
205
  },
222
206
  },
223
207
  resolve: {
224
208
  alias: {
209
+ "@": pathSrc,
225
210
  "~/": `${pathSrc}/`,
226
211
  },
227
212
  },