repo
stringlengths
7
64
file_url
stringlengths
81
338
file_path
stringlengths
5
257
content
stringlengths
0
32.8k
language
stringclasses
1 value
license
stringclasses
7 values
commit_sha
stringlengths
40
40
retrieved_at
stringdate
2026-01-04 15:25:31
2026-01-05 01:50:38
truncated
bool
2 classes
vuejs/core
https://github.com/vuejs/core/blob/aac7e1898907445c8f89b22047a9bfcf0a6e91b8/packages/reactivity/__tests__/shallowReactive.spec.ts
packages/reactivity/__tests__/shallowReactive.spec.ts
import { isReactive, isShallow, reactive, shallowReactive, shallowReadonly, } from '../src/reactive' import { effect } from '../src/effect' import { type Ref, isRef, ref } from '../src/ref' describe('shallowReactive', () => { test('should not make non-reactive properties reactive', () => { const props...
typescript
MIT
aac7e1898907445c8f89b22047a9bfcf0a6e91b8
2026-01-04T15:31:41.625443Z
false
vuejs/core
https://github.com/vuejs/core/blob/aac7e1898907445c8f89b22047a9bfcf0a6e91b8/packages/reactivity/__tests__/shallowReadonly.spec.ts
packages/reactivity/__tests__/shallowReadonly.spec.ts
import { isReactive, isReadonly, readonly, shallowReadonly } from '../src' describe('reactivity/shallowReadonly', () => { test('should not make non-reactive properties reactive', () => { const props = shallowReadonly({ n: { foo: 1 } }) expect(isReactive(props.n)).toBe(false) }) test('should make root le...
typescript
MIT
aac7e1898907445c8f89b22047a9bfcf0a6e91b8
2026-01-04T15:31:41.625443Z
false
vuejs/core
https://github.com/vuejs/core/blob/aac7e1898907445c8f89b22047a9bfcf0a6e91b8/packages/reactivity/__tests__/reactiveArray.spec.ts
packages/reactivity/__tests__/reactiveArray.spec.ts
import { type ComputedRef, computed } from '../src/computed' import { isReactive, reactive, shallowReactive, toRaw } from '../src/reactive' import { isRef, ref } from '../src/ref' import { effect } from '../src/effect' describe('reactivity/reactive/Array', () => { test('should make Array reactive', () => { const...
typescript
MIT
aac7e1898907445c8f89b22047a9bfcf0a6e91b8
2026-01-04T15:31:41.625443Z
false
vuejs/core
https://github.com/vuejs/core/blob/aac7e1898907445c8f89b22047a9bfcf0a6e91b8/packages/reactivity/__tests__/reactive.spec.ts
packages/reactivity/__tests__/reactive.spec.ts
import { isRef, ref, shallowRef } from '../src/ref' import { isProxy, isReactive, isReadonly, isShallow, markRaw, reactive, readonly, shallowReactive, shallowReadonly, toRaw, } from '../src/reactive' import { computed } from '../src/computed' import { effect } from '../src/effect' import { targetMap...
typescript
MIT
aac7e1898907445c8f89b22047a9bfcf0a6e91b8
2026-01-04T15:31:41.625443Z
false
vuejs/core
https://github.com/vuejs/core/blob/aac7e1898907445c8f89b22047a9bfcf0a6e91b8/packages/reactivity/__tests__/ref.spec.ts
packages/reactivity/__tests__/ref.spec.ts
import { type Ref, effect, isReactive, isRef, reactive, ref, toRef, toRefs, toValue, } from '../src/index' import { computed } from '@vue/runtime-dom' import { customRef, shallowRef, triggerRef, unref } from '../src/ref' import { isReadonly, isShallow, readonly, shallowReactive, shallowReado...
typescript
MIT
aac7e1898907445c8f89b22047a9bfcf0a6e91b8
2026-01-04T15:31:41.625443Z
false
vuejs/core
https://github.com/vuejs/core/blob/aac7e1898907445c8f89b22047a9bfcf0a6e91b8/packages/reactivity/__tests__/effectScope.spec.ts
packages/reactivity/__tests__/effectScope.spec.ts
import { nextTick, watch, watchEffect } from '@vue/runtime-core' import { type ComputedRef, EffectScope, computed, effect, effectScope, getCurrentScope, onScopeDispose, reactive, ref, } from '../src' describe('reactivity/effect/scope', () => { it('should run', () => { const fnSpy = vi.fn(() => ...
typescript
MIT
aac7e1898907445c8f89b22047a9bfcf0a6e91b8
2026-01-04T15:31:41.625443Z
false
vuejs/core
https://github.com/vuejs/core/blob/aac7e1898907445c8f89b22047a9bfcf0a6e91b8/packages/reactivity/__tests__/gc.spec.ts
packages/reactivity/__tests__/gc.spec.ts
import { type ComputedRef, computed, effect, reactive, shallowRef as ref, toRaw, } from '../src/index' import { getDepFromReactive } from '../src/dep' describe.skipIf(!global.gc)('reactivity/gc', () => { const gc = () => { return new Promise<void>(resolve => { setTimeout(() => { global....
typescript
MIT
aac7e1898907445c8f89b22047a9bfcf0a6e91b8
2026-01-04T15:31:41.625443Z
false
vuejs/core
https://github.com/vuejs/core/blob/aac7e1898907445c8f89b22047a9bfcf0a6e91b8/packages/reactivity/__tests__/computed.spec.ts
packages/reactivity/__tests__/computed.spec.ts
import { type TestElement, defineComponent, h, nextTick, nodeOps, onMounted, onUnmounted, render, serializeInner, triggerEvent, } from '@vue/runtime-test' import { type DebuggerEvent, ITERATE_KEY, TrackOpTypes, TriggerOpTypes, type WritableComputedRef, computed, effect, isReadonly, ...
typescript
MIT
aac7e1898907445c8f89b22047a9bfcf0a6e91b8
2026-01-04T15:31:41.625443Z
false
vuejs/core
https://github.com/vuejs/core/blob/aac7e1898907445c8f89b22047a9bfcf0a6e91b8/packages/reactivity/__tests__/readonly.spec.ts
packages/reactivity/__tests__/readonly.spec.ts
import { computed, effect, isProxy, isReactive, isReadonly, markRaw, reactive, readonly, ref, shallowRef, toRaw, triggerRef, } from '../src' /** * @see https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-4.html */ type Writable<T> = { -readonly [P in keyof T]: T[P] } desc...
typescript
MIT
aac7e1898907445c8f89b22047a9bfcf0a6e91b8
2026-01-04T15:31:41.625443Z
false
vuejs/core
https://github.com/vuejs/core/blob/aac7e1898907445c8f89b22047a9bfcf0a6e91b8/packages/reactivity/__tests__/watch.spec.ts
packages/reactivity/__tests__/watch.spec.ts
import { EffectScope, type Ref, WatchErrorCodes, type WatchOptions, type WatchScheduler, computed, onWatcherCleanup, ref, watch, } from '../src' const queue: (() => void)[] = [] // a simple scheduler for testing purposes let isFlushPending = false const resolvedPromise = /*@__PURE__*/ Promise.resolv...
typescript
MIT
aac7e1898907445c8f89b22047a9bfcf0a6e91b8
2026-01-04T15:31:41.625443Z
false
vuejs/core
https://github.com/vuejs/core/blob/aac7e1898907445c8f89b22047a9bfcf0a6e91b8/packages/reactivity/__tests__/collections/WeakSet.spec.ts
packages/reactivity/__tests__/collections/WeakSet.spec.ts
import { effect, isReactive, reactive, toRaw } from '../../src' describe('reactivity/collections', () => { describe('WeakSet', () => { it('instanceof', () => { const original = new WeakSet() const observed = reactive(original) expect(isReactive(observed)).toBe(true) expect(original).toBeI...
typescript
MIT
aac7e1898907445c8f89b22047a9bfcf0a6e91b8
2026-01-04T15:31:41.625443Z
false
vuejs/core
https://github.com/vuejs/core/blob/aac7e1898907445c8f89b22047a9bfcf0a6e91b8/packages/reactivity/__tests__/collections/Set.spec.ts
packages/reactivity/__tests__/collections/Set.spec.ts
import { effect, isReactive, reactive, toRaw } from '../../src' describe('reactivity/collections', () => { function coverCollectionFn(collection: Set<any>, fnName: string) { const spy = vi.fn() let proxy = reactive(collection) ;(collection as any)[fnName] = spy return [proxy as any, spy] } descr...
typescript
MIT
aac7e1898907445c8f89b22047a9bfcf0a6e91b8
2026-01-04T15:31:41.625443Z
false
vuejs/core
https://github.com/vuejs/core/blob/aac7e1898907445c8f89b22047a9bfcf0a6e91b8/packages/reactivity/__tests__/collections/shallowReadonly.spec.ts
packages/reactivity/__tests__/collections/shallowReadonly.spec.ts
import { isReactive, isReadonly, shallowReadonly } from '../../src' describe('reactivity/collections', () => { describe('shallowReadonly/Map', () => { ;[Map, WeakMap].forEach(Collection => { test('should make the map/weak-map readonly', () => { const key = {} const val = { foo: 1 } ...
typescript
MIT
aac7e1898907445c8f89b22047a9bfcf0a6e91b8
2026-01-04T15:31:41.625443Z
false
vuejs/core
https://github.com/vuejs/core/blob/aac7e1898907445c8f89b22047a9bfcf0a6e91b8/packages/reactivity/__tests__/collections/Map.spec.ts
packages/reactivity/__tests__/collections/Map.spec.ts
import { effect, isReactive, reactive, toRaw } from '../../src' describe('reactivity/collections', () => { function coverCollectionFn(collection: Map<any, any>, fnName: string) { const spy = vi.fn() let proxy = reactive(collection) ;(collection as any)[fnName] = spy return [proxy as any, spy] } ...
typescript
MIT
aac7e1898907445c8f89b22047a9bfcf0a6e91b8
2026-01-04T15:31:41.625443Z
false
vuejs/core
https://github.com/vuejs/core/blob/aac7e1898907445c8f89b22047a9bfcf0a6e91b8/packages/reactivity/__tests__/collections/WeakMap.spec.ts
packages/reactivity/__tests__/collections/WeakMap.spec.ts
import { effect, isReactive, reactive, toRaw } from '../../src' describe('reactivity/collections', () => { describe('WeakMap', () => { test('instanceof', () => { const original = new WeakMap() const observed = reactive(original) expect(isReactive(observed)).toBe(true) expect(original).toB...
typescript
MIT
aac7e1898907445c8f89b22047a9bfcf0a6e91b8
2026-01-04T15:31:41.625443Z
false
vuejs/core
https://github.com/vuejs/core/blob/aac7e1898907445c8f89b22047a9bfcf0a6e91b8/packages/vue-compat/src/createCompatVue.ts
packages/vue-compat/src/createCompatVue.ts
// This entry exports the runtime only, and is built as // `dist/vue.esm-bundler.js` which is used by default for bundlers. import { initDev } from './dev' import { type CompatVue, DeprecationTypes, KeepAlive, Transition, TransitionGroup, compatUtils, createApp, vModelDynamic, vShow, } from '@vue/runt...
typescript
MIT
aac7e1898907445c8f89b22047a9bfcf0a6e91b8
2026-01-04T15:31:41.625443Z
false
vuejs/core
https://github.com/vuejs/core/blob/aac7e1898907445c8f89b22047a9bfcf0a6e91b8/packages/vue-compat/src/dev.ts
packages/vue-compat/src/dev.ts
import { initCustomFormatter } from '@vue/runtime-dom' export function initDev(): void { if (__BROWSER__) { if (!__ESM_BUNDLER__) { console.info( `You are running a development build of Vue.\n` + `Make sure to use the production build (*.prod.js) when deploying for production.`, ) ...
typescript
MIT
aac7e1898907445c8f89b22047a9bfcf0a6e91b8
2026-01-04T15:31:41.625443Z
false
vuejs/core
https://github.com/vuejs/core/blob/aac7e1898907445c8f89b22047a9bfcf0a6e91b8/packages/vue-compat/src/esm-runtime.ts
packages/vue-compat/src/esm-runtime.ts
import Vue from './runtime' export default Vue export * from '@vue/runtime-dom' const configureCompat: typeof Vue.configureCompat = Vue.configureCompat export { configureCompat }
typescript
MIT
aac7e1898907445c8f89b22047a9bfcf0a6e91b8
2026-01-04T15:31:41.625443Z
false
vuejs/core
https://github.com/vuejs/core/blob/aac7e1898907445c8f89b22047a9bfcf0a6e91b8/packages/vue-compat/src/esm-index.ts
packages/vue-compat/src/esm-index.ts
import Vue from './index' export default Vue export * from '@vue/runtime-dom' const configureCompat: typeof Vue.configureCompat = Vue.configureCompat export { configureCompat }
typescript
MIT
aac7e1898907445c8f89b22047a9bfcf0a6e91b8
2026-01-04T15:31:41.625443Z
false
vuejs/core
https://github.com/vuejs/core/blob/aac7e1898907445c8f89b22047a9bfcf0a6e91b8/packages/vue-compat/src/runtime.ts
packages/vue-compat/src/runtime.ts
// This entry exports the runtime only, and is built as // `dist/vue.esm-bundler.js` which is used by default for bundlers. import { createCompatVue } from './createCompatVue' import { type CompatVue, warn } from '@vue/runtime-core' const Vue: CompatVue = createCompatVue() Vue.compile = (() => { if (__DEV__) { ...
typescript
MIT
aac7e1898907445c8f89b22047a9bfcf0a6e91b8
2026-01-04T15:31:41.625443Z
false
vuejs/core
https://github.com/vuejs/core/blob/aac7e1898907445c8f89b22047a9bfcf0a6e91b8/packages/vue-compat/src/index.ts
packages/vue-compat/src/index.ts
// This entry is the "full-build" that includes both the runtime // and the compiler, and supports on-the-fly compilation of the template option. import { createCompatVue } from './createCompatVue' import { type CompilerError, type CompilerOptions, compile, } from '@vue/compiler-dom' import { type CompatVue, ...
typescript
MIT
aac7e1898907445c8f89b22047a9bfcf0a6e91b8
2026-01-04T15:31:41.625443Z
false
vuejs/core
https://github.com/vuejs/core/blob/aac7e1898907445c8f89b22047a9bfcf0a6e91b8/packages/vue-compat/__tests__/componentVModel.spec.ts
packages/vue-compat/__tests__/componentVModel.spec.ts
import Vue from '@vue/compat' import type { ComponentOptions } from '../../runtime-core/src/component' import { nextTick } from '../../runtime-core/src/scheduler' import { DeprecationTypes, deprecationData, toggleDeprecationWarning, } from '../../runtime-core/src/compat/compatConfig' import { triggerEvent } from ...
typescript
MIT
aac7e1898907445c8f89b22047a9bfcf0a6e91b8
2026-01-04T15:31:41.625443Z
false
vuejs/core
https://github.com/vuejs/core/blob/aac7e1898907445c8f89b22047a9bfcf0a6e91b8/packages/vue-compat/__tests__/options.spec.ts
packages/vue-compat/__tests__/options.spec.ts
import Vue from '@vue/compat' import { nextTick } from '../../runtime-core/src/scheduler' import { DeprecationTypes, deprecationData, toggleDeprecationWarning, } from '../../runtime-core/src/compat/compatConfig' beforeEach(() => { toggleDeprecationWarning(true) Vue.configureCompat({ MODE: 2, GLOBAL_M...
typescript
MIT
aac7e1898907445c8f89b22047a9bfcf0a6e91b8
2026-01-04T15:31:41.625443Z
false
vuejs/core
https://github.com/vuejs/core/blob/aac7e1898907445c8f89b22047a9bfcf0a6e91b8/packages/vue-compat/__tests__/misc.spec.ts
packages/vue-compat/__tests__/misc.spec.ts
import Vue from '@vue/compat' import { nextTick } from '../../runtime-core/src/scheduler' import { DeprecationTypes, deprecationData, toggleDeprecationWarning, } from '../../runtime-core/src/compat/compatConfig' import { triggerEvent } from './utils' import { h } from '@vue/runtime-core' beforeEach(() => { tog...
typescript
MIT
aac7e1898907445c8f89b22047a9bfcf0a6e91b8
2026-01-04T15:31:41.625443Z
false
vuejs/core
https://github.com/vuejs/core/blob/aac7e1898907445c8f89b22047a9bfcf0a6e91b8/packages/vue-compat/__tests__/utils.ts
packages/vue-compat/__tests__/utils.ts
export function triggerEvent( target: Element, event: string, process?: (e: any) => any, ): Event { const e = new Event(event, { bubbles: true, cancelable: true, }) if (process) process(e) target.dispatchEvent(e) return e }
typescript
MIT
aac7e1898907445c8f89b22047a9bfcf0a6e91b8
2026-01-04T15:31:41.625443Z
false
vuejs/core
https://github.com/vuejs/core/blob/aac7e1898907445c8f89b22047a9bfcf0a6e91b8/packages/vue-compat/__tests__/componentAsync.spec.ts
packages/vue-compat/__tests__/componentAsync.spec.ts
import Vue from '@vue/compat' import { DeprecationTypes, deprecationData, toggleDeprecationWarning, } from '../../runtime-core/src/compat/compatConfig' beforeEach(() => { toggleDeprecationWarning(true) Vue.configureCompat({ MODE: 2, GLOBAL_MOUNT: 'suppress-warning', }) }) afterEach(() => { toggl...
typescript
MIT
aac7e1898907445c8f89b22047a9bfcf0a6e91b8
2026-01-04T15:31:41.625443Z
false
vuejs/core
https://github.com/vuejs/core/blob/aac7e1898907445c8f89b22047a9bfcf0a6e91b8/packages/vue-compat/__tests__/globalConfig.spec.ts
packages/vue-compat/__tests__/globalConfig.spec.ts
import Vue from '@vue/compat' import { DeprecationTypes, toggleDeprecationWarning, } from '../../runtime-core/src/compat/compatConfig' import { createApp } from '../src/esm-index' import { triggerEvent } from './utils' beforeEach(() => { toggleDeprecationWarning(false) Vue.configureCompat({ MODE: 2 }) }) afte...
typescript
MIT
aac7e1898907445c8f89b22047a9bfcf0a6e91b8
2026-01-04T15:31:41.625443Z
false
vuejs/core
https://github.com/vuejs/core/blob/aac7e1898907445c8f89b22047a9bfcf0a6e91b8/packages/vue-compat/__tests__/instance.spec.ts
packages/vue-compat/__tests__/instance.spec.ts
import type { Mock } from 'vitest' import Vue from '@vue/compat' import type { Slots } from '../../runtime-core/src/componentSlots' import { Text } from '../../runtime-core/src/vnode' import { DeprecationTypes, deprecationData, toggleDeprecationWarning, } from '../../runtime-core/src/compat/compatConfig' import t...
typescript
MIT
aac7e1898907445c8f89b22047a9bfcf0a6e91b8
2026-01-04T15:31:41.625443Z
false
vuejs/core
https://github.com/vuejs/core/blob/aac7e1898907445c8f89b22047a9bfcf0a6e91b8/packages/vue-compat/__tests__/renderFn.spec.ts
packages/vue-compat/__tests__/renderFn.spec.ts
import { ShapeFlags } from '@vue/shared' import Vue from '@vue/compat' import { createComponentInstance } from '../../runtime-core/src/component' import { setCurrentRenderingInstance } from '../../runtime-core/src/componentRenderContext' import type { DirectiveBinding } from '../../runtime-core/src/directives' import {...
typescript
MIT
aac7e1898907445c8f89b22047a9bfcf0a6e91b8
2026-01-04T15:31:41.625443Z
false
vuejs/core
https://github.com/vuejs/core/blob/aac7e1898907445c8f89b22047a9bfcf0a6e91b8/packages/vue-compat/__tests__/compiler.spec.ts
packages/vue-compat/__tests__/compiler.spec.ts
import Vue from '@vue/compat' import { nextTick } from '@vue/runtime-core' import { CompilerDeprecationTypes } from '@vue/compiler-core' import { toggleDeprecationWarning } from '../../runtime-core/src/compat/compatConfig' import { triggerEvent } from './utils' beforeEach(() => { toggleDeprecationWarning(false) Vu...
typescript
MIT
aac7e1898907445c8f89b22047a9bfcf0a6e91b8
2026-01-04T15:31:41.625443Z
false
vuejs/core
https://github.com/vuejs/core/blob/aac7e1898907445c8f89b22047a9bfcf0a6e91b8/packages/vue-compat/__tests__/global.spec.ts
packages/vue-compat/__tests__/global.spec.ts
import Vue from '@vue/compat' import { effect, isReactive } from '@vue/reactivity' import { h, nextTick } from '@vue/runtime-core' import { DeprecationTypes, deprecationData, toggleDeprecationWarning, } from '../../runtime-core/src/compat/compatConfig' import { singletonApp } from '../../runtime-core/src/compat/g...
typescript
MIT
aac7e1898907445c8f89b22047a9bfcf0a6e91b8
2026-01-04T15:31:41.625443Z
false
vuejs/core
https://github.com/vuejs/core/blob/aac7e1898907445c8f89b22047a9bfcf0a6e91b8/packages/vue-compat/__tests__/filters.spec.ts
packages/vue-compat/__tests__/filters.spec.ts
import Vue from '@vue/compat' import { CompilerDeprecationTypes } from '../../compiler-core/src' import { DeprecationTypes, deprecationData, toggleDeprecationWarning, } from '../../runtime-core/src/compat/compatConfig' beforeEach(() => { toggleDeprecationWarning(false) Vue.configureCompat({ MODE: 2, GLOBAL_M...
typescript
MIT
aac7e1898907445c8f89b22047a9bfcf0a6e91b8
2026-01-04T15:31:41.625443Z
false
vuejs/core
https://github.com/vuejs/core/blob/aac7e1898907445c8f89b22047a9bfcf0a6e91b8/packages/vue-compat/__tests__/componentFunctional.spec.ts
packages/vue-compat/__tests__/componentFunctional.spec.ts
import Vue from '@vue/compat' import { DeprecationTypes, deprecationData, toggleDeprecationWarning, } from '../../runtime-core/src/compat/compatConfig' beforeEach(() => { toggleDeprecationWarning(true) Vue.configureCompat({ MODE: 2, GLOBAL_MOUNT: 'suppress-warning', }) }) afterEach(() => { toggl...
typescript
MIT
aac7e1898907445c8f89b22047a9bfcf0a6e91b8
2026-01-04T15:31:41.625443Z
false
mermaid-js/mermaid
https://github.com/mermaid-js/mermaid/blob/d5bc07dc0c23e496b5356880dc524ca988f2d3c3/cypress.config.ts
cypress.config.ts
import eyesPlugin from '@applitools/eyes-cypress'; import { registerArgosTask } from '@argos-ci/cypress/task'; import coverage from '@cypress/code-coverage/task.js'; import { defineConfig } from 'cypress'; import { addMatchImageSnapshotPlugin } from 'cypress-image-snapshot/plugin.js'; import cypressSplit from 'cypress-...
typescript
MIT
d5bc07dc0c23e496b5356880dc524ca988f2d3c3
2026-01-04T15:25:31.872456Z
false
mermaid-js/mermaid
https://github.com/mermaid-js/mermaid/blob/d5bc07dc0c23e496b5356880dc524ca988f2d3c3/vite.config.ts
vite.config.ts
import jison from './.vite/jisonPlugin.js'; import jsonSchemaPlugin from './.vite/jsonSchemaPlugin.js'; import typescript from '@rollup/plugin-typescript'; import { defaultExclude, defineConfig } from 'vitest/config'; export default defineConfig({ resolve: { extensions: ['.js'], }, plugins: [ jison(), ...
typescript
MIT
d5bc07dc0c23e496b5356880dc524ca988f2d3c3
2026-01-04T15:25:31.872456Z
false
mermaid-js/mermaid
https://github.com/mermaid-js/mermaid/blob/d5bc07dc0c23e496b5356880dc524ca988f2d3c3/scripts/coverage.ts
scripts/coverage.ts
import { execSync } from 'child_process'; import { cp } from 'fs/promises'; const main = async () => { const coverageDir = 'coverage'; const coverageFiles = ['vitest', 'cypress'].map( (dir) => `${coverageDir}/${dir}/coverage-final.json` ); //copy coverage files from vitest and cypress to coverage folder ...
typescript
MIT
d5bc07dc0c23e496b5356880dc524ca988f2d3c3
2026-01-04T15:25:31.872456Z
false
mermaid-js/mermaid
https://github.com/mermaid-js/mermaid/blob/d5bc07dc0c23e496b5356880dc524ca988f2d3c3/scripts/fixCSpell.ts
scripts/fixCSpell.ts
/** * Sorts all the `words` in the cSpell.json file. * * Run from the same folder as the `cSpell.json` file * (i.e. the root of the Mermaid project). */ import { readFileSync, writeFileSync, readdirSync } from 'node:fs'; import { join } from 'node:path'; const cSpellDictionaryDir = './.cspell'; function sortWor...
typescript
MIT
d5bc07dc0c23e496b5356880dc524ca988f2d3c3
2026-01-04T15:25:31.872456Z
false
mermaid-js/mermaid
https://github.com/mermaid-js/mermaid/blob/d5bc07dc0c23e496b5356880dc524ca988f2d3c3/scripts/compare-timings.ts
scripts/compare-timings.ts
/** * Compares new E2E test timings with previous timings and determines whether to keep the new timings. * * The script will: * 1. Read old timings from git HEAD * 2. Read new timings from the current file * 3. Compare the timings and specs * 4. Keep new timings if: * - Specs were added/removed * - Any ...
typescript
MIT
d5bc07dc0c23e496b5356880dc524ca988f2d3c3
2026-01-04T15:25:31.872456Z
false
mermaid-js/mermaid
https://github.com/mermaid-js/mermaid/blob/d5bc07dc0c23e496b5356880dc524ca988f2d3c3/scripts/size.ts
scripts/size.ts
/* eslint-disable no-console */ import type { Metafile } from 'esbuild'; import { readFile } from 'fs/promises'; import { globby } from 'globby'; import { markdownTable } from 'markdown-table'; export const getSizes = (metafile: Metafile) => { const { outputs } = metafile; const sizes = Object.keys(outputs) .fi...
typescript
MIT
d5bc07dc0c23e496b5356880dc524ca988f2d3c3
2026-01-04T15:25:31.872456Z
false
mermaid-js/mermaid
https://github.com/mermaid-js/mermaid/blob/d5bc07dc0c23e496b5356880dc524ca988f2d3c3/scripts/tsc-check.ts
scripts/tsc-check.ts
/** * Verify the as-built tarballs can be imported into a fresh, out-of-tree TypeScript project. */ /* eslint-disable no-console */ import { mkdtemp, mkdir, writeFile, readFile, readdir, copyFile, rm } from 'node:fs/promises'; import { execFileSync } from 'child_process'; import * as path from 'path'; import { fileU...
typescript
MIT
d5bc07dc0c23e496b5356880dc524ca988f2d3c3
2026-01-04T15:25:31.872456Z
false
mermaid-js/mermaid
https://github.com/mermaid-js/mermaid/blob/d5bc07dc0c23e496b5356880dc524ca988f2d3c3/.esbuild/jsonSchemaPlugin.ts
.esbuild/jsonSchemaPlugin.ts
import type { JSONSchemaType } from 'ajv/dist/2019.js'; import type { MermaidConfig } from '../packages/mermaid/src/config.type.js'; import { readFile } from 'node:fs/promises'; import { getDefaults, getSchema, loadSchema } from '../.build/jsonSchema.js'; /** * ESBuild plugin that handles JSON Schemas saved as a `.sc...
typescript
MIT
d5bc07dc0c23e496b5356880dc524ca988f2d3c3
2026-01-04T15:25:31.872456Z
false
mermaid-js/mermaid
https://github.com/mermaid-js/mermaid/blob/d5bc07dc0c23e496b5356880dc524ca988f2d3c3/.esbuild/util.ts
.esbuild/util.ts
import { resolve } from 'path'; import { fileURLToPath } from 'url'; import type { BuildOptions } from 'esbuild'; import { readFileSync } from 'fs'; import jsonSchemaPlugin from './jsonSchemaPlugin.js'; import type { PackageOptions } from '../.build/common.js'; import { jisonPlugin } from './jisonPlugin.js'; const __d...
typescript
MIT
d5bc07dc0c23e496b5356880dc524ca988f2d3c3
2026-01-04T15:25:31.872456Z
false
mermaid-js/mermaid
https://github.com/mermaid-js/mermaid/blob/d5bc07dc0c23e496b5356880dc524ca988f2d3c3/.esbuild/build.ts
.esbuild/build.ts
import { build } from 'esbuild'; import { cp, mkdir, readFile, rename, writeFile } from 'node:fs/promises'; import { packageOptions } from '../.build/common.js'; import { generateLangium } from '../.build/generateLangium.js'; import type { MermaidBuildOptions } from './util.js'; import { defaultOptions, getBuildConfig ...
typescript
MIT
d5bc07dc0c23e496b5356880dc524ca988f2d3c3
2026-01-04T15:25:31.872456Z
false
mermaid-js/mermaid
https://github.com/mermaid-js/mermaid/blob/d5bc07dc0c23e496b5356880dc524ca988f2d3c3/.esbuild/server.ts
.esbuild/server.ts
/* eslint-disable no-console */ import chokidar from 'chokidar'; import cors from 'cors'; import { context } from 'esbuild'; import type { Request, Response } from 'express'; import express from 'express'; import { packageOptions } from '../.build/common.js'; import { generateLangium } from '../.build/generateLangium.j...
typescript
MIT
d5bc07dc0c23e496b5356880dc524ca988f2d3c3
2026-01-04T15:25:31.872456Z
false
mermaid-js/mermaid
https://github.com/mermaid-js/mermaid/blob/d5bc07dc0c23e496b5356880dc524ca988f2d3c3/.esbuild/jisonPlugin.ts
.esbuild/jisonPlugin.ts
import { readFile } from 'node:fs/promises'; import { transformJison } from '../.build/jisonTransformer.js'; import type { Plugin } from 'esbuild'; export const jisonPlugin: Plugin = { name: 'jison', setup(build) { build.onLoad({ filter: /\.jison$/ }, async (args) => { // Load the file from the file syst...
typescript
MIT
d5bc07dc0c23e496b5356880dc524ca988f2d3c3
2026-01-04T15:25:31.872456Z
false
mermaid-js/mermaid
https://github.com/mermaid-js/mermaid/blob/d5bc07dc0c23e496b5356880dc524ca988f2d3c3/cypress/support/eyes-index.d.ts
cypress/support/eyes-index.d.ts
import '@applitools/eyes-cypress';
typescript
MIT
d5bc07dc0c23e496b5356880dc524ca988f2d3c3
2026-01-04T15:25:31.872456Z
false
mermaid-js/mermaid
https://github.com/mermaid-js/mermaid/blob/d5bc07dc0c23e496b5356880dc524ca988f2d3c3/cypress/integration/rendering/oldShapes.spec.ts
cypress/integration/rendering/oldShapes.spec.ts
import { imgSnapshotTest } from '../../helpers/util'; const looks = ['classic', 'handDrawn'] as const; const directions = [ 'TB', //'BT', 'LR', //'RL' ] as const; const shapesSet1 = ['text', 'card', 'lin-rect', 'diamond', 'hexagon'] as const; // removing labelRect, need have alias for it const shapesSet2 = [...
typescript
MIT
d5bc07dc0c23e496b5356880dc524ca988f2d3c3
2026-01-04T15:25:31.872456Z
false
mermaid-js/mermaid
https://github.com/mermaid-js/mermaid/blob/d5bc07dc0c23e496b5356880dc524ca988f2d3c3/cypress/integration/rendering/mindmap.spec.ts
cypress/integration/rendering/mindmap.spec.ts
import { imgSnapshotTest } from '../../helpers/util.ts'; /** * Check whether the SVG Element has a Mindmap root * * Sometimes, Cypress takes a snapshot before the mermaid mindmap has finished * generating the SVG. * * @param $p - The element to check. */ function shouldHaveRoot($p: JQuery<SVGSVGElement>) { //...
typescript
MIT
d5bc07dc0c23e496b5356880dc524ca988f2d3c3
2026-01-04T15:25:31.872456Z
false
mermaid-js/mermaid
https://github.com/mermaid-js/mermaid/blob/d5bc07dc0c23e496b5356880dc524ca988f2d3c3/cypress/integration/rendering/timeline.spec.ts
cypress/integration/rendering/timeline.spec.ts
import { imgSnapshotTest } from '../../helpers/util.ts'; describe('Timeline diagram', () => { it('1: should render a simple timeline with no specific sections', () => { imgSnapshotTest( `timeline title History of Social Media Platform 2002 : LinkedIn 2004 : Facebook : Google 2005 : YouTube ...
typescript
MIT
d5bc07dc0c23e496b5356880dc524ca988f2d3c3
2026-01-04T15:25:31.872456Z
false
mermaid-js/mermaid
https://github.com/mermaid-js/mermaid/blob/d5bc07dc0c23e496b5356880dc524ca988f2d3c3/cypress/integration/rendering/newShapes.spec.ts
cypress/integration/rendering/newShapes.spec.ts
import { imgSnapshotTest } from '../../helpers/util.ts'; const looks = ['classic', 'handDrawn'] as const; const directions = [ 'TB', //'BT', 'LR', //'RL' ] as const; const newShapesSet1 = [ 'triangle', 'sloped-rectangle', 'horizontal-cylinder', 'flipped-triangle', 'hourglass', ] as const; const newSh...
typescript
MIT
d5bc07dc0c23e496b5356880dc524ca988f2d3c3
2026-01-04T15:25:31.872456Z
false
mermaid-js/mermaid
https://github.com/mermaid-js/mermaid/blob/d5bc07dc0c23e496b5356880dc524ca988f2d3c3/cypress/integration/rendering/flowchart-shape-alias.spec.ts
cypress/integration/rendering/flowchart-shape-alias.spec.ts
import { imgSnapshotTest } from '../../helpers/util.ts'; const aliasSet1 = ['process', 'rect', 'proc', 'rectangle'] as const; const aliasSet2 = ['event', 'rounded'] as const; const aliasSet3 = ['stadium', 'pill', 'terminal'] as const; const aliasSet4 = ['fr-rect', 'subproc', 'subprocess', 'framed-rectangle', 'subro...
typescript
MIT
d5bc07dc0c23e496b5356880dc524ca988f2d3c3
2026-01-04T15:25:31.872456Z
false
mermaid-js/mermaid
https://github.com/mermaid-js/mermaid/blob/d5bc07dc0c23e496b5356880dc524ca988f2d3c3/cypress/integration/rendering/sankey.spec.ts
cypress/integration/rendering/sankey.spec.ts
import { imgSnapshotTest, renderGraph } from '../../helpers/util.ts'; describe('Sankey Diagram', () => { it('should render a simple example', () => { imgSnapshotTest( ` sankey-beta sourceNode,targetNode,10 `, {} ); }); describe('when given a linkColor', function () {...
typescript
MIT
d5bc07dc0c23e496b5356880dc524ca988f2d3c3
2026-01-04T15:25:31.872456Z
false
mermaid-js/mermaid
https://github.com/mermaid-js/mermaid/blob/d5bc07dc0c23e496b5356880dc524ca988f2d3c3/cypress/integration/rendering/imageShape.spec.ts
cypress/integration/rendering/imageShape.spec.ts
import { imgSnapshotTest } from '../../helpers/util'; const looks = ['classic', 'handDrawn'] as const; const directions = [ 'TB', //'BT', 'LR', // 'RL' ] as const; const labelPos = [undefined, 't', 'b'] as const; looks.forEach((look) => { directions.forEach((direction) => { labelPos.forEach((pos) => { ...
typescript
MIT
d5bc07dc0c23e496b5356880dc524ca988f2d3c3
2026-01-04T15:25:31.872456Z
false
mermaid-js/mermaid
https://github.com/mermaid-js/mermaid/blob/d5bc07dc0c23e496b5356880dc524ca988f2d3c3/cypress/integration/rendering/architecture.spec.ts
cypress/integration/rendering/architecture.spec.ts
import { imgSnapshotTest, urlSnapshotTest } from '../../helpers/util.ts'; describe.skip('architecture diagram', () => { it('should render a simple architecture diagram with groups', () => { imgSnapshotTest( `architecture-beta group api(cloud)[API] service db(database)[Datab...
typescript
MIT
d5bc07dc0c23e496b5356880dc524ca988f2d3c3
2026-01-04T15:25:31.872456Z
false
mermaid-js/mermaid
https://github.com/mermaid-js/mermaid/blob/d5bc07dc0c23e496b5356880dc524ca988f2d3c3/cypress/integration/rendering/iconShape.spec.ts
cypress/integration/rendering/iconShape.spec.ts
import { imgSnapshotTest } from '../../helpers/util'; const looks = ['classic', 'handDrawn'] as const; const directions = [ 'TB', //'BT', 'LR', // 'RL' ] as const; const forms = [undefined, 'square', 'circle', 'rounded'] as const; const labelPos = [undefined, 't', 'b'] as const; looks.forEach((look) => { d...
typescript
MIT
d5bc07dc0c23e496b5356880dc524ca988f2d3c3
2026-01-04T15:25:31.872456Z
false
mermaid-js/mermaid
https://github.com/mermaid-js/mermaid/blob/d5bc07dc0c23e496b5356880dc524ca988f2d3c3/cypress/integration/rendering/pie.spec.ts
cypress/integration/rendering/pie.spec.ts
import { imgSnapshotTest, renderGraph } from '../../helpers/util.ts'; describe('pie chart', () => { it('should render a simple pie diagram', () => { imgSnapshotTest( `pie title Sports in Sweden "Bandy": 40 "Ice-Hockey": 80 "Football": 90 ` ); }); it('should render a s...
typescript
MIT
d5bc07dc0c23e496b5356880dc524ca988f2d3c3
2026-01-04T15:25:31.872456Z
false
mermaid-js/mermaid
https://github.com/mermaid-js/mermaid/blob/d5bc07dc0c23e496b5356880dc524ca988f2d3c3/cypress/integration/rendering/treemap.spec.ts
cypress/integration/rendering/treemap.spec.ts
import { imgSnapshotTest } from '../../helpers/util.ts'; describe('Treemap Diagram', () => { it('1: should render a basic treemap', () => { imgSnapshotTest( `treemap-beta "Category A" "Item A1": 10 "Item A2": 20 "Category B" "Item B1": 15 "Item B2": 25 `, {} ); }); it('...
typescript
MIT
d5bc07dc0c23e496b5356880dc524ca988f2d3c3
2026-01-04T15:25:31.872456Z
false
mermaid-js/mermaid
https://github.com/mermaid-js/mermaid/blob/d5bc07dc0c23e496b5356880dc524ca988f2d3c3/cypress/integration/rendering/packet.spec.ts
cypress/integration/rendering/packet.spec.ts
import { imgSnapshotTest } from '../../helpers/util'; describe('packet structure', () => { it('should render a simple packet-beta diagram', () => { imgSnapshotTest( `packet-beta title Hello world 0-10: "hello" ` ); }); it('should render a simple packet diagram', () => { imgSnapshotTest( ...
typescript
MIT
d5bc07dc0c23e496b5356880dc524ca988f2d3c3
2026-01-04T15:25:31.872456Z
false
mermaid-js/mermaid
https://github.com/mermaid-js/mermaid/blob/d5bc07dc0c23e496b5356880dc524ca988f2d3c3/cypress/integration/rendering/info.spec.ts
cypress/integration/rendering/info.spec.ts
import { imgSnapshotTest } from '../../helpers/util.ts'; describe('info diagram', () => { it('should handle an info definition', () => { imgSnapshotTest(`info`); }); it('should handle an info definition with showInfo', () => { imgSnapshotTest(`info showInfo`); }); });
typescript
MIT
d5bc07dc0c23e496b5356880dc524ca988f2d3c3
2026-01-04T15:25:31.872456Z
false
mermaid-js/mermaid
https://github.com/mermaid-js/mermaid/blob/d5bc07dc0c23e496b5356880dc524ca988f2d3c3/cypress/integration/rendering/kanban.spec.ts
cypress/integration/rendering/kanban.spec.ts
import { imgSnapshotTest } from '../../helpers/util.ts'; describe('Kanban diagram', () => { it('1: should render a kanban with a single section', () => { imgSnapshotTest( `kanban id1[Todo] docs[Create Documentation] docs[Create Blog about the new diagram] `, {} ); }); it('2: s...
typescript
MIT
d5bc07dc0c23e496b5356880dc524ca988f2d3c3
2026-01-04T15:25:31.872456Z
false
mermaid-js/mermaid
https://github.com/mermaid-js/mermaid/blob/d5bc07dc0c23e496b5356880dc524ca988f2d3c3/cypress/helpers/util.ts
cypress/helpers/util.ts
/* eslint-disable @typescript-eslint/no-explicit-any */ import { Buffer } from 'buffer'; import type { MermaidConfig } from '../../packages/mermaid/src/config.type.js'; interface CypressConfig { listUrl?: boolean; listId?: string; name?: string; screenshot?: boolean; } type CypressMermaidConfig = MermaidConfig...
typescript
MIT
d5bc07dc0c23e496b5356880dc524ca988f2d3c3
2026-01-04T15:25:31.872456Z
false
mermaid-js/mermaid
https://github.com/mermaid-js/mermaid/blob/d5bc07dc0c23e496b5356880dc524ca988f2d3c3/.build/jsonSchema.ts
.build/jsonSchema.ts
import { load, JSON_SCHEMA } from 'js-yaml'; import assert from 'node:assert'; import Ajv2019, { type JSONSchemaType } from 'ajv/dist/2019.js'; import type { MermaidConfig, BaseDiagramConfig } from '../packages/mermaid/src/config.type.js'; /** * All of the keys in the mermaid config that have a mermaid diagram config...
typescript
MIT
d5bc07dc0c23e496b5356880dc524ca988f2d3c3
2026-01-04T15:25:31.872456Z
false
mermaid-js/mermaid
https://github.com/mermaid-js/mermaid/blob/d5bc07dc0c23e496b5356880dc524ca988f2d3c3/.build/common.ts
.build/common.ts
export interface PackageOptions { name: string; packageName: string; file: string; } /** * Shared common options for both ESBuild and Vite */ export const packageOptions = { parser: { name: 'mermaid-parser', packageName: 'parser', file: 'index.ts', }, mermaid: { name: 'mermaid', packa...
typescript
MIT
d5bc07dc0c23e496b5356880dc524ca988f2d3c3
2026-01-04T15:25:31.872456Z
false
mermaid-js/mermaid
https://github.com/mermaid-js/mermaid/blob/d5bc07dc0c23e496b5356880dc524ca988f2d3c3/.build/types.ts
.build/types.ts
/* eslint-disable no-console */ import { packageOptions } from './common.js'; import { execSync } from 'child_process'; const buildType = (packageName: string) => { console.log(`Building types for ${packageName}`); try { const out = execSync(`tsc -p ./packages/${packageName}/tsconfig.json --emitDeclarationOnly...
typescript
MIT
d5bc07dc0c23e496b5356880dc524ca988f2d3c3
2026-01-04T15:25:31.872456Z
false
mermaid-js/mermaid
https://github.com/mermaid-js/mermaid/blob/d5bc07dc0c23e496b5356880dc524ca988f2d3c3/.build/generateLangium.ts
.build/generateLangium.ts
import { generate } from 'langium-cli'; export async function generateLangium() { await generate({ file: `./packages/parser/langium-config.json` }); }
typescript
MIT
d5bc07dc0c23e496b5356880dc524ca988f2d3c3
2026-01-04T15:25:31.872456Z
false
mermaid-js/mermaid
https://github.com/mermaid-js/mermaid/blob/d5bc07dc0c23e496b5356880dc524ca988f2d3c3/.build/jisonTransformer.ts
.build/jisonTransformer.ts
import jison from 'jison'; export const transformJison = (src: string): string => { // @ts-ignore - Jison is not typed properly const parser = new jison.Generator(src, { moduleType: 'js', 'token-stack': true, }); const source = parser.generate({ moduleMain: '() => {}' }); const exporter = ` parser.p...
typescript
MIT
d5bc07dc0c23e496b5356880dc524ca988f2d3c3
2026-01-04T15:25:31.872456Z
false
mermaid-js/mermaid
https://github.com/mermaid-js/mermaid/blob/d5bc07dc0c23e496b5356880dc524ca988f2d3c3/.vite/jsonSchemaPlugin.ts
.vite/jsonSchemaPlugin.ts
import type { PluginOption } from 'vite'; import { getDefaults, getSchema, loadSchema } from '../.build/jsonSchema.js'; /** * Vite plugin that handles JSON Schemas saved as a `.schema.yaml` file. * * Use `my-example.schema.yaml?only-defaults=true` to only load the default values. */ export default function jsonSch...
typescript
MIT
d5bc07dc0c23e496b5356880dc524ca988f2d3c3
2026-01-04T15:25:31.872456Z
false
mermaid-js/mermaid
https://github.com/mermaid-js/mermaid/blob/d5bc07dc0c23e496b5356880dc524ca988f2d3c3/.vite/build.ts
.vite/build.ts
import type { InlineConfig } from 'vite'; import { build, type PluginOption } from 'vite'; import { resolve } from 'path'; import { fileURLToPath } from 'url'; import jisonPlugin from './jisonPlugin.js'; import jsonSchemaPlugin from './jsonSchemaPlugin.js'; import typescript from '@rollup/plugin-typescript'; import { v...
typescript
MIT
d5bc07dc0c23e496b5356880dc524ca988f2d3c3
2026-01-04T15:25:31.872456Z
false
mermaid-js/mermaid
https://github.com/mermaid-js/mermaid/blob/d5bc07dc0c23e496b5356880dc524ca988f2d3c3/.vite/server.ts
.vite/server.ts
import express from 'express'; import cors from 'cors'; import { createServer as createViteServer } from 'vite'; import { packageOptions } from '../.build/common.js'; async function createServer() { const app = express(); // Create Vite server in middleware mode const vite = await createViteServer({ configF...
typescript
MIT
d5bc07dc0c23e496b5356880dc524ca988f2d3c3
2026-01-04T15:25:31.872456Z
false
mermaid-js/mermaid
https://github.com/mermaid-js/mermaid/blob/d5bc07dc0c23e496b5356880dc524ca988f2d3c3/.vite/jisonPlugin.ts
.vite/jisonPlugin.ts
import { transformJison } from '../.build/jisonTransformer.js'; const fileRegex = /\.(jison)$/; export default function jison() { return { name: 'jison', transform(src: string, id: string) { if (fileRegex.test(id)) { return { code: transformJison(src), map: null, // provide...
typescript
MIT
d5bc07dc0c23e496b5356880dc524ca988f2d3c3
2026-01-04T15:25:31.872456Z
false
mermaid-js/mermaid
https://github.com/mermaid-js/mermaid/blob/d5bc07dc0c23e496b5356880dc524ca988f2d3c3/packages/mermaid-example-diagram/src/diagram-definition.ts
packages/mermaid-example-diagram/src/diagram-definition.ts
// @ts-ignore: TODO Fix ts errors import parser from './parser/exampleDiagram.jison'; import * as db from './exampleDiagramDb.js'; import renderer from './exampleDiagramRenderer.js'; import styles from './styles.js'; import { injectUtils } from './mermaidUtils.js'; export const diagram = { db, renderer, parser, ...
typescript
MIT
d5bc07dc0c23e496b5356880dc524ca988f2d3c3
2026-01-04T15:25:31.872456Z
false
mermaid-js/mermaid
https://github.com/mermaid-js/mermaid/blob/d5bc07dc0c23e496b5356880dc524ca988f2d3c3/packages/mermaid-example-diagram/src/mermaidUtils.ts
packages/mermaid-example-diagram/src/mermaidUtils.ts
/* eslint-disable @typescript-eslint/no-explicit-any */ const warning = (s: string) => { // Todo remove debug code // eslint-disable-next-line no-console console.error('Log function was called before initialization', s); }; export type LogLevel = 'trace' | 'debug' | 'info' | 'warn' | 'error' | 'fatal'; export c...
typescript
MIT
d5bc07dc0c23e496b5356880dc524ca988f2d3c3
2026-01-04T15:25:31.872456Z
false
mermaid-js/mermaid
https://github.com/mermaid-js/mermaid/blob/d5bc07dc0c23e496b5356880dc524ca988f2d3c3/packages/mermaid-example-diagram/src/detector.ts
packages/mermaid-example-diagram/src/detector.ts
import type { ExternalDiagramDefinition } from 'mermaid'; const id = 'example-diagram'; const detector = (txt: string) => { return /^\s*example-diagram/.test(txt); }; const loader = async () => { const { diagram } = await import('./diagram-definition.js'); return { id, diagram }; }; const plugin: ExternalDiag...
typescript
MIT
d5bc07dc0c23e496b5356880dc524ca988f2d3c3
2026-01-04T15:25:31.872456Z
false
mermaid-js/mermaid
https://github.com/mermaid-js/mermaid/blob/d5bc07dc0c23e496b5356880dc524ca988f2d3c3/packages/mermaid-example-diagram/src/types/index.d.ts
packages/mermaid-example-diagram/src/types/index.d.ts
export {}; declare global { interface Window { mermaid: any; // 👈️ turn off type checking } }
typescript
MIT
d5bc07dc0c23e496b5356880dc524ca988f2d3c3
2026-01-04T15:25:31.872456Z
false
mermaid-js/mermaid
https://github.com/mermaid-js/mermaid/blob/d5bc07dc0c23e496b5356880dc524ca988f2d3c3/packages/mermaid-layout-elk/src/find-common-ancestor.d.ts
packages/mermaid-layout-elk/src/find-common-ancestor.d.ts
export interface TreeData { parentById: Record<string, string>; childrenById: Record<string, string[]>; } export declare const findCommonAncestor: ( id1: string, id2: string, { parentById }: TreeData ) => string;
typescript
MIT
d5bc07dc0c23e496b5356880dc524ca988f2d3c3
2026-01-04T15:25:31.872456Z
false
mermaid-js/mermaid
https://github.com/mermaid-js/mermaid/blob/d5bc07dc0c23e496b5356880dc524ca988f2d3c3/packages/mermaid-layout-elk/src/layouts.ts
packages/mermaid-layout-elk/src/layouts.ts
import type { LayoutLoaderDefinition } from 'mermaid'; const loader = async () => await import(`./render.js`); const algos = ['elk.stress', 'elk.force', 'elk.mrtree', 'elk.sporeOverlap']; const layouts: LayoutLoaderDefinition[] = [ { name: 'elk', loader, algorithm: 'elk.layered', }, ...algos.map((al...
typescript
MIT
d5bc07dc0c23e496b5356880dc524ca988f2d3c3
2026-01-04T15:25:31.872456Z
false
mermaid-js/mermaid
https://github.com/mermaid-js/mermaid/blob/d5bc07dc0c23e496b5356880dc524ca988f2d3c3/packages/mermaid-layout-elk/src/render.ts
packages/mermaid-layout-elk/src/render.ts
import type { InternalHelpers, LayoutData, RenderOptions, SVG, SVGGroup } from 'mermaid'; // @ts-ignore TODO: Investigate D3 issue import { curveLinear } from 'd3'; import ELK from 'elkjs/lib/elk.bundled.js'; import { type TreeData, findCommonAncestor } from './find-common-ancestor.js'; import { type P, type RectL...
typescript
MIT
d5bc07dc0c23e496b5356880dc524ca988f2d3c3
2026-01-04T15:25:31.872456Z
true
mermaid-js/mermaid
https://github.com/mermaid-js/mermaid/blob/d5bc07dc0c23e496b5356880dc524ca988f2d3c3/packages/mermaid-layout-elk/src/find-common-ancestor.ts
packages/mermaid-layout-elk/src/find-common-ancestor.ts
export interface TreeData { parentById: Record<string, string>; childrenById: Record<string, string[]>; } export const findCommonAncestor = (id1: string, id2: string, { parentById }: TreeData) => { const visited = new Set(); let currentId = id1; // Edge case with self edges if (id1 === id2) { return p...
typescript
MIT
d5bc07dc0c23e496b5356880dc524ca988f2d3c3
2026-01-04T15:25:31.872456Z
false
mermaid-js/mermaid
https://github.com/mermaid-js/mermaid/blob/d5bc07dc0c23e496b5356880dc524ca988f2d3c3/packages/mermaid-layout-elk/src/geometry.ts
packages/mermaid-layout-elk/src/geometry.ts
/* Geometry utilities extracted from render.ts for reuse and testing */ export interface P { x: number; y: number; } export interface RectLike { x: number; // center x y: number; // center y width: number; height: number; padding?: number; } export interface NodeLike { intersect?: (p: P) => P | null;...
typescript
MIT
d5bc07dc0c23e496b5356880dc524ca988f2d3c3
2026-01-04T15:25:31.872456Z
false
mermaid-js/mermaid
https://github.com/mermaid-js/mermaid/blob/d5bc07dc0c23e496b5356880dc524ca988f2d3c3/packages/mermaid-layout-elk/src/__tests__/geometry.spec.ts
packages/mermaid-layout-elk/src/__tests__/geometry.spec.ts
import { describe, it, expect } from 'vitest'; import { intersection, ensureTrulyOutside, makeInsidePoint, tryNodeIntersect, replaceEndpoint, type RectLike, type P, } from '../geometry.js'; const approx = (a: number, b: number, eps = 1e-6) => Math.abs(a - b) < eps; describe('geometry helpers', () => { ...
typescript
MIT
d5bc07dc0c23e496b5356880dc524ca988f2d3c3
2026-01-04T15:25:31.872456Z
false
mermaid-js/mermaid
https://github.com/mermaid-js/mermaid/blob/d5bc07dc0c23e496b5356880dc524ca988f2d3c3/packages/mermaid/scripts/docs.spec.ts
packages/mermaid/scripts/docs.spec.ts
import { buildShapeDoc, transformMarkdownAst, transformToBlockQuote } from './docs.mjs'; import { remark } from 'remark'; // import it this way so we can mock it import remarkFrontmatter from 'remark-frontmatter'; import { vi, afterEach, describe, it, expect } from 'vitest'; afterEach(() => { vi.restoreAllMocks(); ...
typescript
MIT
d5bc07dc0c23e496b5356880dc524ca988f2d3c3
2026-01-04T15:25:31.872456Z
false
mermaid-js/mermaid
https://github.com/mermaid-js/mermaid/blob/d5bc07dc0c23e496b5356880dc524ca988f2d3c3/packages/mermaid/src/mermaid.ts
packages/mermaid/src/mermaid.ts
/** * Web page integration module for the mermaid framework. It uses the mermaidAPI for mermaid * functionality and to render the diagrams to svg code! */ import { registerIconPacks } from './rendering-util/icons.js'; import { dedent } from 'ts-dedent'; import type { MermaidConfig } from './config.type.js'; import {...
typescript
MIT
d5bc07dc0c23e496b5356880dc524ca988f2d3c3
2026-01-04T15:25:31.872456Z
false
mermaid-js/mermaid
https://github.com/mermaid-js/mermaid/blob/d5bc07dc0c23e496b5356880dc524ca988f2d3c3/packages/mermaid/src/config.ts
packages/mermaid/src/config.ts
import assignWithDepth from './assignWithDepth.js'; import { log } from './logger.js'; import theme from './themes/index.js'; import config from './defaultConfig.js'; import type { MermaidConfig } from './config.type.js'; import { sanitizeDirective } from './utils/sanitizeDirective.js'; export const defaultConfig: Mer...
typescript
MIT
d5bc07dc0c23e496b5356880dc524ca988f2d3c3
2026-01-04T15:25:31.872456Z
false
mermaid-js/mermaid
https://github.com/mermaid-js/mermaid/blob/d5bc07dc0c23e496b5356880dc524ca988f2d3c3/packages/mermaid/src/styles.spec.ts
packages/mermaid/src/styles.spec.ts
import { vi } from 'vitest'; // @ts-expect-error This module has no TypeScript types import { validate } from 'csstree-validator'; import { compile, serialize, stringify } from 'stylis'; import { getConfig } from './config.js'; import theme from './themes/index.js'; /** * Import the getStyles function from each dia...
typescript
MIT
d5bc07dc0c23e496b5356880dc524ca988f2d3c3
2026-01-04T15:25:31.872456Z
false
mermaid-js/mermaid
https://github.com/mermaid-js/mermaid/blob/d5bc07dc0c23e496b5356880dc524ca988f2d3c3/packages/mermaid/src/accessibility.ts
packages/mermaid/src/accessibility.ts
/** * Accessibility (a11y) functions, types, helpers. * * @see https://www.w3.org/WAI/ * @see https://www.w3.org/TR/wai-aria-1.1/ * @see https://www.w3.org/TR/svg-aam-1.0/ */ import type { D3Element } from './types.js'; /** * SVG element role: * The SVG element role _should_ be set to 'graphics-document' per S...
typescript
MIT
d5bc07dc0c23e496b5356880dc524ca988f2d3c3
2026-01-04T15:25:31.872456Z
false
mermaid-js/mermaid
https://github.com/mermaid-js/mermaid/blob/d5bc07dc0c23e496b5356880dc524ca988f2d3c3/packages/mermaid/src/errors.ts
packages/mermaid/src/errors.ts
export class UnknownDiagramError extends Error { constructor(message: string) { super(message); this.name = 'UnknownDiagramError'; } }
typescript
MIT
d5bc07dc0c23e496b5356880dc524ca988f2d3c3
2026-01-04T15:25:31.872456Z
false
mermaid-js/mermaid
https://github.com/mermaid-js/mermaid/blob/d5bc07dc0c23e496b5356880dc524ca988f2d3c3/packages/mermaid/src/utils.ts
packages/mermaid/src/utils.ts
import { sanitizeUrl } from '@braintree/sanitize-url'; import type { BaseType, CurveFactory } from 'd3'; import { curveBasis, curveBasisClosed, curveBasisOpen, curveBumpX, curveBumpY, curveBundle, curveCardinalClosed, curveCardinalOpen, curveCardinal, curveCatmullRomClosed, curveCatmullRomOpen, ...
typescript
MIT
d5bc07dc0c23e496b5356880dc524ca988f2d3c3
2026-01-04T15:25:31.872456Z
false
mermaid-js/mermaid
https://github.com/mermaid-js/mermaid/blob/d5bc07dc0c23e496b5356880dc524ca988f2d3c3/packages/mermaid/src/assignWithDepth.ts
packages/mermaid/src/assignWithDepth.ts
/* eslint-disable @typescript-eslint/no-explicit-any */ /** * assignWithDepth Extends the functionality of {@link Object.assign} with the * ability to merge arbitrary-depth objects For each key in src with path `k` (recursively) * performs an Object.assign(dst[`k`], src[`k`]) with a slight change from the typic...
typescript
MIT
d5bc07dc0c23e496b5356880dc524ca988f2d3c3
2026-01-04T15:25:31.872456Z
false
mermaid-js/mermaid
https://github.com/mermaid-js/mermaid/blob/d5bc07dc0c23e496b5356880dc524ca988f2d3c3/packages/mermaid/src/mermaid.spec.ts
packages/mermaid/src/mermaid.spec.ts
import mermaid from './mermaid.js'; import { mermaidAPI } from './mermaidAPI.js'; import './diagram-api/diagram-orchestration.js'; import { addDiagrams } from './diagram-api/diagram-orchestration.js'; import { beforeAll, describe, it, expect, vi, afterEach } from 'vitest'; import type { DiagramDefinition } from './diag...
typescript
MIT
d5bc07dc0c23e496b5356880dc524ca988f2d3c3
2026-01-04T15:25:31.872456Z
false
mermaid-js/mermaid
https://github.com/mermaid-js/mermaid/blob/d5bc07dc0c23e496b5356880dc524ca988f2d3c3/packages/mermaid/src/config.type.ts
packages/mermaid/src/config.type.ts
/* eslint-disable */ /** * This file was automatically generated by json-schema-to-typescript. * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, * and run json-schema-to-typescript to regenerate this file. */ /** * JavaScript function that returns a `FontConfig`. * * By default, these retu...
typescript
MIT
d5bc07dc0c23e496b5356880dc524ca988f2d3c3
2026-01-04T15:25:31.872456Z
true
mermaid-js/mermaid
https://github.com/mermaid-js/mermaid/blob/d5bc07dc0c23e496b5356880dc524ca988f2d3c3/packages/mermaid/src/preprocess.ts
packages/mermaid/src/preprocess.ts
import { cleanupComments } from './diagram-api/comments.js'; import { extractFrontMatter } from './diagram-api/frontmatter.js'; import type { DiagramMetadata } from './diagram-api/types.js'; import utils, { cleanAndMerge, removeDirectives } from './utils.js'; const cleanupText = (code: string) => { return ( code...
typescript
MIT
d5bc07dc0c23e496b5356880dc524ca988f2d3c3
2026-01-04T15:25:31.872456Z
false
mermaid-js/mermaid
https://github.com/mermaid-js/mermaid/blob/d5bc07dc0c23e496b5356880dc524ca988f2d3c3/packages/mermaid/src/diagram.spec.ts
packages/mermaid/src/diagram.spec.ts
import { describe, test, expect } from 'vitest'; import { Diagram } from './Diagram.js'; import { addDetector } from './diagram-api/detectType.js'; import { addDiagrams } from './diagram-api/diagram-orchestration.js'; import type { DiagramLoader } from './diagram-api/types.js'; addDiagrams(); const getDummyDiagram = ...
typescript
MIT
d5bc07dc0c23e496b5356880dc524ca988f2d3c3
2026-01-04T15:25:31.872456Z
false
mermaid-js/mermaid
https://github.com/mermaid-js/mermaid/blob/d5bc07dc0c23e496b5356880dc524ca988f2d3c3/packages/mermaid/src/mermaidAPI.ts
packages/mermaid/src/mermaidAPI.ts
/** * This file contains functions that are used internally by mermaid * and is not intended to be used by the end user. */ // @ts-ignore TODO: Investigate D3 issue import { select } from 'd3'; import { compile, serialize, stringify } from 'stylis'; import DOMPurify from 'dompurify'; import isEmpty from 'lodash-es/i...
typescript
MIT
d5bc07dc0c23e496b5356880dc524ca988f2d3c3
2026-01-04T15:25:31.872456Z
false
mermaid-js/mermaid
https://github.com/mermaid-js/mermaid/blob/d5bc07dc0c23e496b5356880dc524ca988f2d3c3/packages/mermaid/src/logger.ts
packages/mermaid/src/logger.ts
/* eslint-disable @typescript-eslint/no-empty-function */ /* eslint-disable @typescript-eslint/no-explicit-any */ /* eslint-disable no-console */ import dayjs from 'dayjs'; export type LogLevel = 'trace' | 'debug' | 'info' | 'warn' | 'error' | 'fatal'; export const LEVELS: Record<LogLevel, number> = { trace: 0, ...
typescript
MIT
d5bc07dc0c23e496b5356880dc524ca988f2d3c3
2026-01-04T15:25:31.872456Z
false
mermaid-js/mermaid
https://github.com/mermaid-js/mermaid/blob/d5bc07dc0c23e496b5356880dc524ca988f2d3c3/packages/mermaid/src/Diagram.ts
packages/mermaid/src/Diagram.ts
import * as configApi from './config.js'; import { getDiagram, registerDiagram } from './diagram-api/diagramAPI.js'; import { detectType, getDiagramLoader } from './diagram-api/detectType.js'; import { UnknownDiagramError } from './errors.js'; import { encodeEntities } from './utils.js'; import type { DetailedError } f...
typescript
MIT
d5bc07dc0c23e496b5356880dc524ca988f2d3c3
2026-01-04T15:25:31.872456Z
false
mermaid-js/mermaid
https://github.com/mermaid-js/mermaid/blob/d5bc07dc0c23e496b5356880dc524ca988f2d3c3/packages/mermaid/src/styles.ts
packages/mermaid/src/styles.ts
import type { FlowChartStyleOptions } from './diagrams/flowchart/styles.js'; import { log } from './logger.js'; import type { DiagramStylesProvider } from './diagram-api/types.js'; const themes: Record<string, DiagramStylesProvider> = {}; const getStyles = ( type: string, userStyles: string, options: { font...
typescript
MIT
d5bc07dc0c23e496b5356880dc524ca988f2d3c3
2026-01-04T15:25:31.872456Z
false
mermaid-js/mermaid
https://github.com/mermaid-js/mermaid/blob/d5bc07dc0c23e496b5356880dc524ca988f2d3c3/packages/mermaid/src/defaultConfig.ts
packages/mermaid/src/defaultConfig.ts
import type { RequiredDeep } from 'type-fest'; import theme from './themes/index.js'; import type { MermaidConfig } from './config.type.js'; // Uses our custom Vite jsonSchemaPlugin to load only the default values from // our JSON Schema // @ts-expect-error This file is automatically generated via a custom Vite plugi...
typescript
MIT
d5bc07dc0c23e496b5356880dc524ca988f2d3c3
2026-01-04T15:25:31.872456Z
false
mermaid-js/mermaid
https://github.com/mermaid-js/mermaid/blob/d5bc07dc0c23e496b5356880dc524ca988f2d3c3/packages/mermaid/src/types.ts
packages/mermaid/src/types.ts
export interface NodeMetaData { shape?: string; label?: string; icon?: string; form?: string; pos?: 't' | 'b'; img?: string; w?: string; h?: string; constraint?: 'on' | 'off'; priority: 'Very High' | 'High' | 'Medium' | 'Low' | 'Very Low'; assigned?: string; ticket?: string; } export interface ...
typescript
MIT
d5bc07dc0c23e496b5356880dc524ca988f2d3c3
2026-01-04T15:25:31.872456Z
false
mermaid-js/mermaid
https://github.com/mermaid-js/mermaid/blob/d5bc07dc0c23e496b5356880dc524ca988f2d3c3/packages/mermaid/src/accessibility.spec.ts
packages/mermaid/src/accessibility.spec.ts
import { addSVGa11yTitleDescription, setA11yDiagramInfo } from './accessibility.js'; import { ensureNodeFromSelector, jsdomIt } from './tests/util.js'; import { expect } from 'vitest'; describe('accessibility', () => { describe('setA11yDiagramInfo', () => { jsdomIt('should set svg element role to "graphics-docum...
typescript
MIT
d5bc07dc0c23e496b5356880dc524ca988f2d3c3
2026-01-04T15:25:31.872456Z
false
mermaid-js/mermaid
https://github.com/mermaid-js/mermaid/blob/d5bc07dc0c23e496b5356880dc524ca988f2d3c3/packages/mermaid/src/interactionDb.ts
packages/mermaid/src/interactionDb.ts
let interactionFunctions: (() => void)[] = []; export const addFunction = (func: () => void) => { interactionFunctions.push(func); }; export const attachFunctions = () => { interactionFunctions.forEach((f) => { f(); }); interactionFunctions = []; };
typescript
MIT
d5bc07dc0c23e496b5356880dc524ca988f2d3c3
2026-01-04T15:25:31.872456Z
false