Skip to content

Commit 10d6c17

Browse files
committed
Merge branch 'develop' into sidv/testArgos
* develop: (80 commits) chore: update browsers list chore(deps): update eslint fix(class): #5624 Reset direction to default in classDiagram ci: upgrade to pnpm/action-setup@v4 to avoid CI failures chore(deps): update dependency eslint-plugin-unicorn to v54 chore(deps): update dependency eslint-plugin-jsdoc to v48.5.0 chore(deps): update all patch dependencies Sync docs folder Add Doctave to .cspell libraries Adds Doctave to list of integrations chore: update browsers list chore: Cleanup tsconfig chore: Fix lint Apply suggestions from code review chore: Remove extra words from cspell chore: Log granular rebuild times fix: Message wrap fix: Message wrap chore: Use `??` instead of `||` chore: Organise imports ...
2 parents 3f58ebe + d44c65e commit 10d6c17

File tree

187 files changed

+4164
-3801
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

187 files changed

+4164
-3801
lines changed

.build/types.ts

+10-3
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,22 @@
1+
/* eslint-disable no-console */
12
import { packageOptions } from './common.js';
23
import { execSync } from 'child_process';
34

45
const buildType = (packageName: string) => {
56
console.log(`Building types for ${packageName}`);
67
try {
78
const out = execSync(`tsc -p ./packages/${packageName}/tsconfig.json --emitDeclarationOnly`);
8-
out.length > 0 && console.log(out.toString());
9+
if (out.length > 0) {
10+
console.log(out.toString());
11+
}
912
} catch (e) {
1013
console.error(e);
11-
e.stdout.length > 0 && console.error(e.stdout.toString());
12-
e.stderr.length > 0 && console.error(e.stderr.toString());
14+
if (e.stdout.length > 0) {
15+
console.error(e.stdout.toString());
16+
}
17+
if (e.stderr.length > 0) {
18+
console.error(e.stderr.toString());
19+
}
1320
}
1421
};
1522

.cspell/code-terms.txt

+3
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ bqstring
1313
BQUOTE
1414
bramp
1515
BRKT
16+
brotli
1617
callbackargs
1718
callbackname
1819
classdef
@@ -111,6 +112,7 @@ STYLECLASS
111112
STYLEOPTS
112113
subcomponent
113114
subcomponents
115+
subconfig
114116
SUBROUTINEEND
115117
SUBROUTINESTART
116118
Subschemas
@@ -125,6 +127,7 @@ titlevalue
125127
topbar
126128
TRAPEND
127129
TRAPSTART
130+
treemap
128131
ts-nocheck
129132
tsdoc
130133
typeof

.cspell/contributors.txt

+1
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,6 @@ cpettitt
44
Dong Cai
55
Nikolay Rozhkov
66
Peng Xiao
7+
Per Brolin
78
subhash-halder
89
Vinod Sidharth

.cspell/libraries.txt

+3
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ dagre-d3
2020
Deepdwn
2121
Docsify
2222
Docsy
23+
Doctave
2324
DokuWiki
2425
dompurify
2526
elkjs
@@ -55,12 +56,14 @@ pyplot
5556
redmine
5657
rehype
5758
rscratch
59+
shiki
5860
sparkline
5961
sphinxcontrib
6062
ssim
6163
stylis
6264
Swimm
6365
tsbuildinfo
66+
tseslint
6467
Tuleap
6568
Typora
6669
unocss

.cspell/misc-terms.txt

+3
Original file line numberDiff line numberDiff line change
@@ -1 +1,4 @@
1+
BRANDES
2+
handdrawn
3+
KOEPF
14
newbranch

.esbuild/build.ts

+6-4
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ import { build } from 'esbuild';
22
import { mkdir, writeFile } from 'node:fs/promises';
33
import { packageOptions } from '../.build/common.js';
44
import { generateLangium } from '../.build/generateLangium.js';
5-
import { MermaidBuildOptions, defaultOptions, getBuildConfig } from './util.js';
5+
import type { MermaidBuildOptions } from './util.js';
6+
import { defaultOptions, getBuildConfig } from './util.js';
67

78
const shouldVisualize = process.argv.includes('--visualize');
89

@@ -35,11 +36,11 @@ const buildPackage = async (entryName: keyof typeof packageOptions) => {
3536

3637
if (shouldVisualize) {
3738
for (const { metafile } of results) {
38-
if (!metafile) {
39+
if (!metafile?.outputs) {
3940
continue;
4041
}
4142
const fileName = Object.keys(metafile.outputs)
42-
.filter((file) => !file.includes('chunks') && file.endsWith('js'))[0]
43+
.find((file) => !file.includes('chunks') && file.endsWith('js'))
4344
.replace('dist/', '');
4445
// Upload metafile into https://esbuild.github.io/analyze/
4546
await writeFile(`stats/${fileName}.meta.json`, JSON.stringify(metafile));
@@ -48,13 +49,14 @@ const buildPackage = async (entryName: keyof typeof packageOptions) => {
4849
};
4950

5051
const handler = (e) => {
52+
// eslint-disable-next-line no-console
5153
console.error(e);
5254
process.exit(1);
5355
};
5456

5557
const main = async () => {
5658
await generateLangium();
57-
await mkdir('stats').catch(() => {});
59+
await mkdir('stats', { recursive: true });
5860
const packageNames = Object.keys(packageOptions) as (keyof typeof packageOptions)[];
5961
// it should build `parser` before `mermaid` because it's a dependency
6062
for (const pkg of packageNames) {

.esbuild/jisonPlugin.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { readFile } from 'node:fs/promises';
22
import { transformJison } from '../.build/jisonTransformer.js';
3-
import { Plugin } from 'esbuild';
3+
import type { Plugin } from 'esbuild';
44

55
export const jisonPlugin: Plugin = {
66
name: 'jison',

.esbuild/server.ts

+33-18
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1-
import express from 'express';
2-
import type { NextFunction, Request, Response } from 'express';
1+
/* eslint-disable no-console */
2+
import chokidar from 'chokidar';
33
import cors from 'cors';
4-
import { getBuildConfig, defaultOptions } from './util.js';
54
import { context } from 'esbuild';
6-
import chokidar from 'chokidar';
7-
import { generateLangium } from '../.build/generateLangium.js';
5+
import type { Request, Response } from 'express';
6+
import express from 'express';
87
import { packageOptions } from '../.build/common.js';
8+
import { generateLangium } from '../.build/generateLangium.js';
9+
import { defaultOptions, getBuildConfig } from './util.js';
910

1011
const configs = Object.values(packageOptions).map(({ packageName }) =>
1112
getBuildConfig({ ...defaultOptions, minify: false, core: false, entryName: packageName })
@@ -19,16 +20,28 @@ const mermaidIIFEConfig = getBuildConfig({
1920
});
2021
configs.push(mermaidIIFEConfig);
2122

22-
const contexts = await Promise.all(configs.map((config) => context(config)));
23+
const contexts = await Promise.all(
24+
configs.map(async (config) => ({ config, context: await context(config) }))
25+
);
2326

27+
let rebuildCounter = 1;
2428
const rebuildAll = async () => {
25-
console.time('Rebuild time');
26-
await Promise.all(contexts.map((ctx) => ctx.rebuild())).catch((e) => console.error(e));
27-
console.timeEnd('Rebuild time');
29+
const buildNumber = rebuildCounter++;
30+
const timeLabel = `Rebuild ${buildNumber} Time (total)`;
31+
console.time(timeLabel);
32+
await Promise.all(
33+
contexts.map(async ({ config, context }) => {
34+
const buildVariant = `Rebuild ${buildNumber} Time (${Object.keys(config.entryPoints!)[0]} ${config.format})`;
35+
console.time(buildVariant);
36+
await context.rebuild();
37+
console.timeEnd(buildVariant);
38+
})
39+
).catch((e) => console.error(e));
40+
console.timeEnd(timeLabel);
2841
};
2942

3043
let clients: { id: number; response: Response }[] = [];
31-
function eventsHandler(request: Request, response: Response, next: NextFunction) {
44+
function eventsHandler(request: Request, response: Response) {
3245
const headers = {
3346
'Content-Type': 'text/event-stream',
3447
Connection: 'keep-alive',
@@ -45,19 +58,20 @@ function eventsHandler(request: Request, response: Response, next: NextFunction)
4558
});
4659
}
4760

48-
let timeoutId: NodeJS.Timeout | undefined = undefined;
61+
let timeoutID: NodeJS.Timeout | undefined = undefined;
4962

5063
/**
5164
* Debounce file change events to avoid rebuilding multiple times.
5265
*/
5366
function handleFileChange() {
54-
if (timeoutId !== undefined) {
55-
clearTimeout(timeoutId);
67+
if (timeoutID !== undefined) {
68+
clearTimeout(timeoutID);
5669
}
57-
timeoutId = setTimeout(async () => {
70+
// eslint-disable-next-line @typescript-eslint/no-misused-promises
71+
timeoutID = setTimeout(async () => {
5872
await rebuildAll();
5973
sendEventsToAll();
60-
timeoutId = undefined;
74+
timeoutID = undefined;
6175
}, 100);
6276
}
6377

@@ -74,15 +88,16 @@ async function createServer() {
7488
ignoreInitial: true,
7589
ignored: [/node_modules/, /dist/, /docs/, /coverage/],
7690
})
91+
// eslint-disable-next-line @typescript-eslint/no-misused-promises
7792
.on('all', async (event, path) => {
7893
// Ignore other events.
7994
if (!['add', 'change'].includes(event)) {
8095
return;
8196
}
82-
if (/\.langium$/.test(path)) {
97+
console.log(`${path} changed. Rebuilding...`);
98+
if (path.endsWith('.langium')) {
8399
await generateLangium();
84100
}
85-
console.log(`${path} changed. Rebuilding...`);
86101
handleFileChange();
87102
});
88103

@@ -99,4 +114,4 @@ async function createServer() {
99114
});
100115
}
101116

102-
createServer();
117+
void createServer();

.esbuild/util.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ export const getBuildConfig = (options: MermaidBuildOptions): BuildOptions => {
5656
const external: string[] = ['require', 'fs', 'path'];
5757
const { name, file, packageName } = packageOptions[entryName];
5858
const outFileName = getFileName(name, options);
59-
let output: BuildOptions = buildOptions({
59+
const output: BuildOptions = buildOptions({
6060
absWorkingDir: resolve(__dirname, `../packages/${packageName}`),
6161
entryPoints: {
6262
[outFileName]: `src/${file}`,

.eslintignore

-1
This file was deleted.

0 commit comments

Comments
 (0)