mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-01-28 07:03:17 +08:00
da7ff777d1
mermaid.min.js and mermaid.js will now be IIFE instead of UMD.
39 lines
1.1 KiB
TypeScript
39 lines
1.1 KiB
TypeScript
import express from 'express';
|
|
import cors from 'cors';
|
|
import { getBuildConfig } from './util.js';
|
|
import { context } from 'esbuild';
|
|
|
|
async function createServer() {
|
|
const app = express();
|
|
const mermaidCtx = await context(
|
|
getBuildConfig({ minify: false, core: false, entryName: 'mermaid' })
|
|
);
|
|
const mermaidIIFECtx = await context(
|
|
getBuildConfig({ minify: false, core: false, entryName: 'mermaid', format: 'iife' })
|
|
);
|
|
const externalCtx = await context(
|
|
getBuildConfig({ minify: false, core: false, entryName: 'mermaid-example-diagram' })
|
|
);
|
|
const zenuml = await context(
|
|
getBuildConfig({ minify: false, core: false, entryName: 'mermaid-zenuml' })
|
|
);
|
|
|
|
mermaidCtx.watch();
|
|
mermaidIIFECtx.watch();
|
|
externalCtx.watch();
|
|
zenuml.watch();
|
|
|
|
app.use(cors());
|
|
app.use(express.static('./packages/mermaid/dist'));
|
|
app.use(express.static('./packages/mermaid-zenuml/dist'));
|
|
app.use(express.static('./packages/mermaid-example-diagram/dist'));
|
|
app.use(express.static('demos'));
|
|
app.use(express.static('cypress/platform'));
|
|
|
|
app.listen(9000, () => {
|
|
console.log(`Listening on http://localhost:9000`);
|
|
});
|
|
}
|
|
|
|
createServer();
|