mirror of
				https://github.com/mermaid-js/mermaid.git
				synced 2025-11-03 20:34:20 +01:00 
			
		
		
		
	fix: Vite, D3, Vitest Types
This commit is contained in:
		@@ -56,7 +56,7 @@
 | 
			
		||||
    "cytoscape": "^3.23.0",
 | 
			
		||||
    "cytoscape-cose-bilkent": "^4.1.0",
 | 
			
		||||
    "cytoscape-fcose": "^2.1.0",
 | 
			
		||||
    "d3": "^7.0.0",
 | 
			
		||||
    "d3": "^7.4.0",
 | 
			
		||||
    "dagre-d3-es": "7.0.8",
 | 
			
		||||
    "dompurify": "2.4.3",
 | 
			
		||||
    "elkjs": "^0.8.2",
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,5 @@
 | 
			
		||||
/** Created by knut on 14-12-11. */
 | 
			
		||||
// @ts-ignore TODO: Investigate D3 issue
 | 
			
		||||
import { select } from 'd3';
 | 
			
		||||
import { log } from '../../logger';
 | 
			
		||||
import { getErrorMessage } from '../../utils';
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,4 @@
 | 
			
		||||
import { defineConfig, searchForWorkspaceRoot } from 'vite';
 | 
			
		||||
import { defineConfig, searchForWorkspaceRoot, PluginOption } from 'vite';
 | 
			
		||||
import path from 'path';
 | 
			
		||||
// @ts-ignore: still in alpha
 | 
			
		||||
import { SearchPlugin } from 'vitepress-plugin-search';
 | 
			
		||||
@@ -13,12 +13,12 @@ export default defineConfig({
 | 
			
		||||
      // TODO: will be fixed in the next vitepress release.
 | 
			
		||||
      name: 'fix-virtual',
 | 
			
		||||
 | 
			
		||||
      async resolveId(id) {
 | 
			
		||||
      async resolveId(id: string) {
 | 
			
		||||
        if (id === virtualModuleId) {
 | 
			
		||||
          return resolvedVirtualModuleId;
 | 
			
		||||
        }
 | 
			
		||||
      },
 | 
			
		||||
      async load(this, id) {
 | 
			
		||||
      async load(this, id: string) {
 | 
			
		||||
        if (id === resolvedVirtualModuleId) {
 | 
			
		||||
          return `export default ${JSON.stringify({
 | 
			
		||||
            securityLevel: 'loose',
 | 
			
		||||
@@ -26,20 +26,15 @@ export default defineConfig({
 | 
			
		||||
          })};`;
 | 
			
		||||
        }
 | 
			
		||||
      },
 | 
			
		||||
    },
 | 
			
		||||
    } as PluginOption,
 | 
			
		||||
  ],
 | 
			
		||||
  resolve: {
 | 
			
		||||
    alias: {
 | 
			
		||||
      mermaid: path.join(__dirname, '../../dist/mermaid.esm.min.mjs'), // Use this one to build
 | 
			
		||||
 | 
			
		||||
      '@mermaid-js/mermaid-example-diagram': path.join(
 | 
			
		||||
        __dirname,
 | 
			
		||||
        '../../../mermaid-example-diagram/dist/mermaid-example-diagram.esm.min.mjs'
 | 
			
		||||
      ), // Use this one to build
 | 
			
		||||
      // '@mermaid-js/mermaid-timeline': path.join(
 | 
			
		||||
      //   __dirname,
 | 
			
		||||
      //   '../../../mermaid-timeline/dist/mermaid-timeline.esm.min.mjs'
 | 
			
		||||
      // ),
 | 
			
		||||
    },
 | 
			
		||||
  },
 | 
			
		||||
  server: {
 | 
			
		||||
 
 | 
			
		||||
@@ -10,6 +10,7 @@
 | 
			
		||||
 *
 | 
			
		||||
 * In addition to the render function, a number of behavioral configuration options are available.
 | 
			
		||||
 */
 | 
			
		||||
// @ts-ignore TODO: Investigate D3 issue
 | 
			
		||||
import { select } from 'd3';
 | 
			
		||||
import { compile, serialize, stringify } from 'stylis';
 | 
			
		||||
// @ts-ignore: TODO Fix ts errors
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,4 @@
 | 
			
		||||
import type {} from '@vitest/spy';
 | 
			
		||||
import type {} from '@vitest/spy/dist/index';
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * This is a mocked/stubbed version of the d3 Selection type. Each of the main functions are all
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user