mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-01-14 06:43:25 +08:00
Merge
This commit is contained in:
commit
eb4ac5c103
@ -4,7 +4,7 @@
|
||||
"es6": true,
|
||||
"node": true
|
||||
},
|
||||
"parser": "babel-eslint",
|
||||
"parser": "@babel/eslint-parser",
|
||||
"parserOptions": {
|
||||
"ecmaFeatures": {
|
||||
"experimentalObjectRestSpread": true,
|
||||
|
5
.github/dependabot.yml
vendored
5
.github/dependabot.yml
vendored
@ -1,13 +1,12 @@
|
||||
version: 2
|
||||
|
||||
updates:
|
||||
- package-ecosystem: npm
|
||||
directory: /
|
||||
target-branch: develop
|
||||
schedule:
|
||||
interval: daily
|
||||
interval: weekly
|
||||
- package-ecosystem: github-actions
|
||||
directory: /
|
||||
target-branch: develop
|
||||
schedule:
|
||||
interval: daily
|
||||
interval: weekly
|
||||
|
10
.github/workflows/build.yml
vendored
10
.github/workflows/build.yml
vendored
@ -9,10 +9,10 @@ jobs:
|
||||
matrix:
|
||||
node-version: [16.x]
|
||||
steps:
|
||||
- uses: actions/checkout@v2.3.4
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- name: Setup Node.js ${{ matrix.node-version }}
|
||||
uses: actions/setup-node@v2.2.0
|
||||
uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: ${{ matrix.node-version }}
|
||||
|
||||
@ -20,7 +20,7 @@ jobs:
|
||||
run: npm i yarn --global
|
||||
|
||||
- name: Cache Node Modules
|
||||
uses: actions/cache@v2.1.5
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: .cache
|
||||
key: ${{ runner.OS }}-build-${{ hashFiles('**/yarn.lock') }}
|
||||
@ -36,7 +36,7 @@ jobs:
|
||||
run: yarn build
|
||||
|
||||
- name: Upload Build as Artifact
|
||||
uses: actions/upload-artifact@v2.2.3
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: dist
|
||||
path: dist
|
||||
@ -61,4 +61,4 @@ jobs:
|
||||
# uses: coverallsapp/github-action@master
|
||||
# with:
|
||||
# github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
# parallel-finished: true
|
||||
# parallel-finished: true
|
||||
|
6
.github/workflows/e2e.yml
vendored
6
.github/workflows/e2e.yml
vendored
@ -12,7 +12,7 @@ jobs:
|
||||
- uses: actions/checkout@v2.3.4
|
||||
|
||||
- name: Setup Node.js ${{ matrix.node-version }}
|
||||
uses: actions/setup-node@v2.2.0
|
||||
uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: ${{ matrix.node-version }}
|
||||
|
||||
@ -20,7 +20,7 @@ jobs:
|
||||
run: npm i yarn --global
|
||||
|
||||
- name: Cache Node Modules
|
||||
uses: actions/cache@v2.1.5
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: .cache
|
||||
key: ${{ runner.OS }}-build-${{ hashFiles('**/yarn.lock') }}
|
||||
@ -55,4 +55,4 @@ jobs:
|
||||
# uses: coverallsapp/github-action@master
|
||||
# with:
|
||||
# github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
# parallel-finished: true
|
||||
# parallel-finished: true
|
||||
|
2
.github/workflows/issue-triage.yml
vendored
2
.github/workflows/issue-triage.yml
vendored
@ -8,7 +8,7 @@ jobs:
|
||||
triage:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: andymckay/labeler@1.0.2
|
||||
- uses: andymckay/labeler@1
|
||||
with:
|
||||
repo-token: "${{ secrets.GITHUB_TOKEN }}"
|
||||
labels: "Status: Triage"
|
||||
|
2
.github/workflows/release-draft.yml
vendored
2
.github/workflows/release-draft.yml
vendored
@ -10,6 +10,6 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Draft Release
|
||||
uses: toolmantim/release-drafter@v5.2.0
|
||||
uses: toolmantim/release-drafter@v5
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
@ -9,9 +9,9 @@ jobs:
|
||||
publish:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2.3.4
|
||||
- uses: actions/checkout@v2
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v2.2.0
|
||||
uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: 16.x
|
||||
- name: Install Yarn
|
||||
|
2
.github/workflows/release-publish.yml
vendored
2
.github/workflows/release-publish.yml
vendored
@ -12,7 +12,7 @@ jobs:
|
||||
- uses: fregante/setup-git-user@v1
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v2.2.0
|
||||
uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: 16.x
|
||||
- name: Install Yarn
|
||||
|
@ -3,8 +3,8 @@ module.exports = {
|
||||
[
|
||||
'@babel/preset-env',
|
||||
{
|
||||
targets: "defaults, ie >= 11, current node"
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
targets: 'defaults, ie >= 11, current node',
|
||||
},
|
||||
],
|
||||
],
|
||||
};
|
||||
|
12
dist/mermaid.core.js
vendored
12
dist/mermaid.core.js
vendored
@ -653,10 +653,10 @@ module.exports = function(module) {
|
||||
/*!**********************!*\
|
||||
!*** ./package.json ***!
|
||||
\**********************/
|
||||
/*! exports provided: name, version, description, main, keywords, scripts, repository, author, license, standard, dependencies, devDependencies, files, yarn-upgrade-all, sideEffects, husky, default */
|
||||
/*! exports provided: name, version, description, main, keywords, scripts, repository, author, license, standard, dependencies, devDependencies, files, sideEffects, husky, default */
|
||||
/***/ (function(module) {
|
||||
|
||||
module.exports = JSON.parse("{\"name\":\"mermaid\",\"version\":\"8.11.2\",\"description\":\"Markdownish syntax for generating flowcharts, sequence diagrams, class diagrams, gantt charts and git graphs.\",\"main\":\"dist/mermaid.core.js\",\"keywords\":[\"diagram\",\"markdown\",\"flowchart\",\"sequence diagram\",\"gantt\",\"class diagram\",\"git graph\"],\"scripts\":{\"build:development\":\"webpack --progress --colors\",\"build:production\":\"yarn build:development -p --config webpack.config.prod.babel.js\",\"build\":\"yarn build:development && yarn build:production\",\"postbuild\":\"documentation build src/mermaidAPI.js src/config.js src/defaultConfig.js --shallow -f md --markdown-toc false > docs/Setup.md\",\"build:watch\":\"yarn build --watch\",\"release\":\"yarn build\",\"lint\":\"eslint src\",\"e2e:depr\":\"yarn lint && jest e2e --config e2e/jest.config.js\",\"cypress\":\"percy exec -- cypress run\",\"e2e\":\"start-server-and-test dev http://localhost:9000/ cypress\",\"e2e-upd\":\"yarn lint && jest e2e -u --config e2e/jest.config.js\",\"dev\":\"webpack-dev-server --config webpack.config.e2e.js\",\"test\":\"yarn lint && jest src/.*\",\"test:watch\":\"jest --watch src\",\"prepublishOnly\":\"yarn build && yarn test\",\"prepare\":\"yarn build\"},\"repository\":{\"type\":\"git\",\"url\":\"https://github.com/knsv/mermaid\"},\"author\":\"Knut Sveidqvist\",\"license\":\"MIT\",\"standard\":{\"ignore\":[\"**/parser/*.js\",\"dist/**/*.js\",\"cypress/**/*.js\"],\"globals\":[\"page\"]},\"dependencies\":{\"@braintree/sanitize-url\":\"^3.1.0\",\"@percy/migrate\":\"^0.10.0\",\"d3\":\"^5.7.0\",\"dagre\":\"^0.8.5\",\"dagre-d3\":\"^0.6.4\",\"dompurify\":\"2.3.0\",\"graphlib\":\"^2.1.8\",\"khroma\":\"^1.4.1\",\"moment-mini\":\"^2.24.0\",\"stylis\":\"^4.0.10\"},\"devDependencies\":{\"@babel/core\":\"^7.14.6\",\"@babel/preset-env\":\"^7.14.7\",\"@babel/register\":\"^7.14.5\",\"@percy/cli\":\"^1.0.0-beta.58\",\"@percy/cypress\":\"^3.1.0\",\"babel-core\":\"7.0.0-bridge.0\",\"babel-eslint\":\"^10.1.0\",\"babel-jest\":\"^27.0.6\",\"babel-loader\":\"^8.2.2\",\"coveralls\":\"^3.0.2\",\"css-to-string-loader\":\"^0.1.3\",\"cypress\":\"7.6.0\",\"documentation\":\"13.2.0\",\"eslint\":\"^7.30.0\",\"eslint-config-prettier\":\"^8.3.0\",\"eslint-plugin-prettier\":\"^3.4.0\",\"husky\":\"^7.0.1\",\"identity-obj-proxy\":\"^3.0.0\",\"jest\":\"^27.0.6\",\"jison\":\"^0.4.18\",\"js-base64\":\"3.6.1\",\"moment\":\"^2.23.0\",\"prettier\":\"^2.3.2\",\"start-server-and-test\":\"^1.12.6\",\"terser-webpack-plugin\":\"^2.2.2\",\"webpack\":\"^4.41.2\",\"webpack-bundle-analyzer\":\"^4.4.2\",\"webpack-cli\":\"^3.1.2\",\"webpack-dev-server\":\"^3.4.1\",\"webpack-node-externals\":\"^1.7.2\"},\"files\":[\"dist\"],\"yarn-upgrade-all\":{\"ignore\":[\"babel-core\"]},\"sideEffects\":[\"**/*.css\",\"**/*.scss\"],\"husky\":{\"hooks\":{\"pre-push\":\"yarn test\"}}}");
|
||||
module.exports = JSON.parse("{\"name\":\"mermaid\",\"version\":\"8.11.0\",\"description\":\"Markdownish syntax for generating flowcharts, sequence diagrams, class diagrams, gantt charts and git graphs.\",\"main\":\"dist/mermaid.core.js\",\"keywords\":[\"diagram\",\"markdown\",\"flowchart\",\"sequence diagram\",\"gantt\",\"class diagram\",\"git graph\"],\"scripts\":{\"build:development\":\"webpack --progress --color\",\"build:production\":\"yarn build:development --mode production --config webpack.config.prod.babel.js\",\"build\":\"yarn build:development && yarn build:production\",\"postbuild\":\"documentation build src/mermaidAPI.js src/config.js src/defaultConfig.js --shallow -f md --markdown-toc false > docs/Setup.md\",\"build:watch\":\"yarn build --watch\",\"release\":\"yarn build\",\"lint\":\"eslint src\",\"e2e:depr\":\"yarn lint && jest e2e --config e2e/jest.config.js\",\"cypress\":\"percy exec -- cypress run\",\"e2e\":\"start-server-and-test dev http://localhost:9000/ cypress\",\"e2e-upd\":\"yarn lint && jest e2e -u --config e2e/jest.config.js\",\"dev\":\"webpack serve --config webpack.config.e2e.js\",\"test\":\"yarn lint && jest src/.*\",\"test:watch\":\"jest --watch src\",\"prepublishOnly\":\"yarn build && yarn test\",\"prepare\":\"yarn build\"},\"repository\":{\"type\":\"git\",\"url\":\"https://github.com/knsv/mermaid\"},\"author\":\"Knut Sveidqvist\",\"license\":\"MIT\",\"standard\":{\"ignore\":[\"**/parser/*.js\",\"dist/**/*.js\",\"cypress/**/*.js\"],\"globals\":[\"page\"]},\"dependencies\":{\"@braintree/sanitize-url\":\"^3.1.0\",\"@percy/migrate\":\"^0.11.0\",\"d3\":\"^7.0.0\",\"dagre\":\"^0.8.5\",\"dagre-d3\":\"^0.6.4\",\"graphlib\":\"^2.1.8\",\"khroma\":\"^1.4.1\",\"moment-mini\":\"^2.24.0\",\"stylis\":\"^4.0.10\"},\"devDependencies\":{\"@babel/core\":\"^7.14.6\",\"@babel/eslint-parser\":\"^7.14.7\",\"@babel/preset-env\":\"^7.14.7\",\"@babel/register\":\"^7.14.5\",\"@percy/cli\":\"^1.0.0-beta.58\",\"@percy/cypress\":\"^3.1.0\",\"babel-jest\":\"^27.0.6\",\"babel-loader\":\"^8.2.2\",\"coveralls\":\"^3.0.2\",\"css-to-string-loader\":\"^0.1.3\",\"cypress\":\"8.0.0\",\"documentation\":\"13.2.0\",\"dompurify\":\"2.3.0\",\"eslint\":\"^7.30.0\",\"eslint-config-prettier\":\"^8.3.0\",\"eslint-plugin-prettier\":\"^3.4.0\",\"husky\":\"^7.0.1\",\"identity-obj-proxy\":\"^3.0.0\",\"jest\":\"^27.0.6\",\"jison\":\"^0.4.18\",\"js-base64\":\"3.6.1\",\"moment\":\"^2.23.0\",\"prettier\":\"^2.3.2\",\"start-server-and-test\":\"^1.12.6\",\"terser-webpack-plugin\":\"^4.2.3\",\"webpack\":\"^4.41.2\",\"webpack-cli\":\"^4.7.2\",\"webpack-dev-server\":\"^3.4.1\",\"webpack-node-externals\":\"^3.0.0\"},\"files\":[\"dist\"],\"sideEffects\":[\"**/*.css\",\"**/*.scss\"],\"husky\":{\"hooks\":{\"pre-push\":\"yarn test\"}}}");
|
||||
|
||||
/***/ }),
|
||||
|
||||
@ -3283,10 +3283,8 @@ var rectWithTitle = function rectWithTitle(parent, node) {
|
||||
|
||||
|
||||
var halfPadding = node.padding / 2;
|
||||
Object(d3__WEBPACK_IMPORTED_MODULE_0__["select"])(descr).attr('transform', 'translate( ' + ( // (titleBox.width - bbox.width) / 2 +
|
||||
bbox.width > titleBox.width ? 0 : (titleBox.width - bbox.width) / 2) + ', ' + (titleBox.height + halfPadding + 5) + ')');
|
||||
Object(d3__WEBPACK_IMPORTED_MODULE_0__["select"])(text).attr('transform', 'translate( ' + ( // (titleBox.width - bbox.width) / 2 +
|
||||
bbox.width < titleBox.width ? 0 : -(titleBox.width - bbox.width) / 2) + ', ' + 0 + ')'); // Get the size of the label
|
||||
Object(d3__WEBPACK_IMPORTED_MODULE_0__["select"])(descr).attr('transform', 'translate( ' + (bbox.width > titleBox.width ? 0 : (titleBox.width - bbox.width) / 2) + ', ' + (titleBox.height + halfPadding + 5) + ')');
|
||||
Object(d3__WEBPACK_IMPORTED_MODULE_0__["select"])(text).attr('transform', 'translate( ' + (bbox.width < titleBox.width ? 0 : -(titleBox.width - bbox.width) / 2) + ', ' + 0 + ')'); // Get the size of the label
|
||||
// Bounding box for title and text
|
||||
|
||||
bbox = label.node().getBBox(); // Center the label
|
||||
@ -16931,7 +16929,7 @@ var draw = function draw(txt, id) {
|
||||
var pie = Object(d3__WEBPACK_IMPORTED_MODULE_0__["pie"])().value(function (d) {
|
||||
return d.value;
|
||||
});
|
||||
var dataReady = pie(Object(d3__WEBPACK_IMPORTED_MODULE_0__["entries"])(data)); // Shape helper to build arcs:
|
||||
var dataReady = pie(Object.entries(data)); // Shape helper to build arcs:
|
||||
|
||||
var arcGenerator = Object(d3__WEBPACK_IMPORTED_MODULE_0__["arc"])().innerRadius(0).outerRadius(radius); // Build the pie chart: each part of the pie is a path that we build using the arc function.
|
||||
|
||||
|
2
dist/mermaid.core.js.map
vendored
2
dist/mermaid.core.js.map
vendored
File diff suppressed because one or more lines are too long
64076
dist/mermaid.js
vendored
64076
dist/mermaid.js
vendored
File diff suppressed because one or more lines are too long
2
dist/mermaid.js.map
vendored
2
dist/mermaid.js.map
vendored
File diff suppressed because one or more lines are too long
12
dist/mermaid.min.js
vendored
12
dist/mermaid.min.js
vendored
File diff suppressed because one or more lines are too long
2
dist/mermaid.min.js.map
vendored
2
dist/mermaid.min.js.map
vendored
File diff suppressed because one or more lines are too long
@ -1,14 +1,14 @@
|
||||
const path = require('path');
|
||||
|
||||
module.exports = {
|
||||
testEnvironment:"jsdom",
|
||||
testEnvironment: 'jsdom',
|
||||
transform: {
|
||||
'^.+\\.jsx?$': './transformer.js',
|
||||
'^.+\\.jison$': path.resolve(__dirname, './jisonTransformer.js')
|
||||
'^.+\\.jison$': path.resolve(__dirname, './jisonTransformer.js'),
|
||||
},
|
||||
transformIgnorePatterns: ['/node_modules/(?!dagre-d3-renderer/lib).*\\.js'],
|
||||
moduleNameMapper: {
|
||||
'\\.(css|scss)$': 'identity-obj-proxy'
|
||||
'\\.(css|scss)$': 'identity-obj-proxy',
|
||||
},
|
||||
moduleFileExtensions: ['js', 'json', 'jsx', 'ts', 'tsx', 'node', 'jison']
|
||||
moduleFileExtensions: ['js', 'json', 'jsx', 'ts', 'tsx', 'node', 'jison'],
|
||||
};
|
||||
|
@ -1,6 +1,6 @@
|
||||
const { Generator } = require('jison')
|
||||
const { getOptions } = require('loader-utils')
|
||||
const { Generator } = require('jison');
|
||||
const { getOptions } = require('loader-utils');
|
||||
|
||||
module.exports = function jisonLoader (source) {
|
||||
return new Generator(source, getOptions(this)).generate()
|
||||
}
|
||||
module.exports = function jisonLoader(source) {
|
||||
return new Generator(source, getOptions(this)).generate();
|
||||
};
|
||||
|
@ -3,7 +3,7 @@ const { Generator } = require('jison');
|
||||
module.exports = {
|
||||
process(source, filename, config, transformOptions) {
|
||||
return new Generator(source, {
|
||||
'token-stack': true
|
||||
'token-stack': true,
|
||||
}).generate();
|
||||
}
|
||||
},
|
||||
};
|
||||
|
27
package.json
27
package.json
@ -13,8 +13,8 @@
|
||||
"git graph"
|
||||
],
|
||||
"scripts": {
|
||||
"build:development": "webpack --progress --colors",
|
||||
"build:production": "yarn build:development -p --config webpack.config.prod.babel.js",
|
||||
"build:development": "webpack --progress --color",
|
||||
"build:production": "yarn build:development --mode production --config webpack.config.prod.babel.js",
|
||||
"build": "yarn build:development && yarn build:production",
|
||||
"postbuild": "documentation build src/mermaidAPI.js src/config.js src/defaultConfig.js --shallow -f md --markdown-toc false > docs/Setup.md",
|
||||
"build:watch": "yarn build --watch",
|
||||
@ -24,7 +24,7 @@
|
||||
"cypress": "percy exec -- cypress run",
|
||||
"e2e": "start-server-and-test dev http://localhost:9000/ cypress",
|
||||
"e2e-upd": "yarn lint && jest e2e -u --config e2e/jest.config.js",
|
||||
"dev": "webpack-dev-server --config webpack.config.e2e.js",
|
||||
"dev": "webpack serve --config webpack.config.e2e.js",
|
||||
"test": "yarn lint && jest src/.*",
|
||||
"test:watch": "jest --watch src",
|
||||
"prepublishOnly": "yarn build && yarn test",
|
||||
@ -48,8 +48,8 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"@braintree/sanitize-url": "^3.1.0",
|
||||
"@percy/migrate": "^0.10.0",
|
||||
"d3": "^5.7.0",
|
||||
"@percy/migrate": "^0.11.0",
|
||||
"d3": "^7.0.0",
|
||||
"dagre": "^0.8.5",
|
||||
"dagre-d3": "^0.6.4",
|
||||
"dompurify": "2.3.0",
|
||||
@ -60,17 +60,16 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.14.6",
|
||||
"@babel/eslint-parser": "^7.14.7",
|
||||
"@babel/preset-env": "^7.14.7",
|
||||
"@babel/register": "^7.14.5",
|
||||
"@percy/cli": "^1.0.0-beta.58",
|
||||
"@percy/cypress": "^3.1.0",
|
||||
"babel-core": "7.0.0-bridge.0",
|
||||
"babel-eslint": "^10.1.0",
|
||||
"babel-jest": "^27.0.6",
|
||||
"babel-loader": "^8.2.2",
|
||||
"coveralls": "^3.0.2",
|
||||
"css-to-string-loader": "^0.1.3",
|
||||
"cypress": "7.6.0",
|
||||
"cypress": "8.1.0",
|
||||
"documentation": "13.2.0",
|
||||
"eslint": "^7.30.0",
|
||||
"eslint-config-prettier": "^8.3.0",
|
||||
@ -83,21 +82,15 @@
|
||||
"moment": "^2.23.0",
|
||||
"prettier": "^2.3.2",
|
||||
"start-server-and-test": "^1.12.6",
|
||||
"terser-webpack-plugin": "^2.2.2",
|
||||
"terser-webpack-plugin": "^4.2.3",
|
||||
"webpack": "^4.41.2",
|
||||
"webpack-bundle-analyzer": "^4.4.2",
|
||||
"webpack-cli": "^3.1.2",
|
||||
"webpack-cli": "^4.7.2",
|
||||
"webpack-dev-server": "^3.4.1",
|
||||
"webpack-node-externals": "^1.7.2"
|
||||
"webpack-node-externals": "^3.0.0"
|
||||
},
|
||||
"files": [
|
||||
"dist"
|
||||
],
|
||||
"yarn-upgrade-all": {
|
||||
"ignore": [
|
||||
"babel-core"
|
||||
]
|
||||
},
|
||||
"sideEffects": [
|
||||
"**/*.css",
|
||||
"**/*.scss"
|
||||
|
@ -1,7 +1,7 @@
|
||||
/**
|
||||
* Created by AshishJ on 11-09-2019.
|
||||
*/
|
||||
import { select, scaleOrdinal, pie as d3pie, entries, arc } from 'd3';
|
||||
import { select, scaleOrdinal, pie as d3pie, arc } from 'd3';
|
||||
import pieData from './pieDb';
|
||||
import pieParser from './parser/pie';
|
||||
import { log } from '../../logger';
|
||||
@ -87,7 +87,7 @@ export const draw = (txt, id) => {
|
||||
var pie = d3pie().value(function (d) {
|
||||
return d.value;
|
||||
});
|
||||
var dataReady = pie(entries(data));
|
||||
var dataReady = pie(Object.entries(data));
|
||||
|
||||
// Shape helper to build arcs:
|
||||
var arcGenerator = arc().innerRadius(0).outerRadius(radius);
|
||||
|
@ -1,11 +1,11 @@
|
||||
import nodeExternals from 'webpack-node-externals'
|
||||
import nodeExternals from 'webpack-node-externals';
|
||||
|
||||
import { jsConfig } from './webpack.config.base'
|
||||
import { jsConfig } from './webpack.config.base';
|
||||
|
||||
const config = jsConfig()
|
||||
const config = jsConfig();
|
||||
|
||||
const coreConfig = jsConfig()
|
||||
coreConfig.externals = [nodeExternals()]
|
||||
coreConfig.output.filename = '[name].core.js'
|
||||
const coreConfig = jsConfig();
|
||||
coreConfig.externals = [nodeExternals()];
|
||||
coreConfig.output.filename = '[name].core.js';
|
||||
|
||||
export default [config, coreConfig]
|
||||
export default [config, coreConfig];
|
||||
|
@ -1,10 +1,9 @@
|
||||
import path from 'path';
|
||||
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
|
||||
|
||||
const amdRule = {
|
||||
parser: {
|
||||
amd: false // https://github.com/lodash/lodash/issues/3052
|
||||
}
|
||||
amd: false, // https://github.com/lodash/lodash/issues/3052
|
||||
},
|
||||
};
|
||||
|
||||
const jisonRule = {
|
||||
@ -12,25 +11,25 @@ const jisonRule = {
|
||||
use: {
|
||||
loader: path.resolve(__dirname, './jisonLoader'),
|
||||
options: {
|
||||
'token-stack': true
|
||||
}
|
||||
}
|
||||
'token-stack': true,
|
||||
},
|
||||
},
|
||||
};
|
||||
const jsRule = {
|
||||
test: /\.js$/,
|
||||
include: [
|
||||
path.resolve(__dirname, './src'),
|
||||
path.resolve(__dirname, './node_modules/dagre-d3-renderer/lib')
|
||||
path.resolve(__dirname, './node_modules/dagre-d3-renderer/lib'),
|
||||
],
|
||||
use: {
|
||||
loader: 'babel-loader'
|
||||
}
|
||||
loader: 'babel-loader',
|
||||
},
|
||||
};
|
||||
|
||||
const scssRule = {
|
||||
// load scss to string
|
||||
test: /\.scss$/,
|
||||
use: [{ loader: 'css-to-string-loader' }, { loader: 'css-loader' }, { loader: 'sass-loader' }]
|
||||
use: [{ loader: 'css-to-string-loader' }, { loader: 'css-loader' }, { loader: 'sass-loader' }],
|
||||
};
|
||||
|
||||
export const jsConfig = () => {
|
||||
@ -38,13 +37,13 @@ export const jsConfig = () => {
|
||||
mode: 'development',
|
||||
target: 'web',
|
||||
entry: {
|
||||
mermaid: './src/mermaid.js'
|
||||
mermaid: './src/mermaid.js',
|
||||
},
|
||||
resolve: {
|
||||
extensions: ['.wasm', '.mjs', '.js', '.json', '.jison']
|
||||
extensions: ['.wasm', '.mjs', '.js', '.json', '.jison'],
|
||||
},
|
||||
node: {
|
||||
fs: 'empty' // jison generated code requires 'fs'
|
||||
fs: 'empty', // jison generated code requires 'fs'
|
||||
},
|
||||
output: {
|
||||
path: path.join(__dirname, './dist/'),
|
||||
@ -52,12 +51,11 @@ export const jsConfig = () => {
|
||||
library: 'mermaid',
|
||||
libraryTarget: 'umd',
|
||||
libraryExport: 'default',
|
||||
globalObject: 'typeof self !== "undefined" ? self : this'
|
||||
globalObject: 'typeof self !== "undefined" ? self : this',
|
||||
},
|
||||
module: {
|
||||
rules: [amdRule, jsRule, scssRule, jisonRule]
|
||||
rules: [amdRule, jsRule, scssRule, jisonRule],
|
||||
},
|
||||
// plugins: [new BundleAnalyzerPlugin()],
|
||||
devtool: 'source-map'
|
||||
devtool: 'source-map',
|
||||
};
|
||||
};
|
||||
|
@ -4,8 +4,8 @@ const jsRule = {
|
||||
test: /\.js$/,
|
||||
exclude: /node_modules/,
|
||||
use: {
|
||||
loader: 'babel-loader'
|
||||
}
|
||||
loader: 'babel-loader',
|
||||
},
|
||||
};
|
||||
|
||||
const jisonRule = {
|
||||
@ -13,20 +13,20 @@ const jisonRule = {
|
||||
use: {
|
||||
loader: path.resolve(__dirname, './jisonLoader'),
|
||||
options: {
|
||||
'token-stack': true
|
||||
}
|
||||
}
|
||||
'token-stack': true,
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
const amdRule = {
|
||||
parser: {
|
||||
amd: false // https://github.com/lodash/lodash/issues/3052
|
||||
}
|
||||
amd: false, // https://github.com/lodash/lodash/issues/3052
|
||||
},
|
||||
};
|
||||
const scssRule = {
|
||||
// load scss to string
|
||||
test: /\.scss$/,
|
||||
use: [{ loader: 'css-to-string-loader' }, { loader: 'css-loader' }, { loader: 'sass-loader' }]
|
||||
use: [{ loader: 'css-to-string-loader' }, { loader: 'css-loader' }, { loader: 'sass-loader' }],
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
@ -35,31 +35,31 @@ module.exports = {
|
||||
entry: {
|
||||
mermaid: './src/mermaid.js',
|
||||
e2e: './cypress/platform/viewer.js',
|
||||
'bundle-test': './cypress/platform/bundle-test.js'
|
||||
'bundle-test': './cypress/platform/bundle-test.js',
|
||||
},
|
||||
resolve: {
|
||||
extensions: ['.wasm', '.mjs', '.js', '.json', '.jison']
|
||||
extensions: ['.wasm', '.mjs', '.js', '.json', '.jison'],
|
||||
},
|
||||
node: {
|
||||
fs: 'empty' // jison generated code requires 'fs'
|
||||
fs: 'empty', // jison generated code requires 'fs'
|
||||
},
|
||||
output: {
|
||||
path: path.join(__dirname, './dist/'),
|
||||
filename: '[name].js',
|
||||
library: 'mermaid',
|
||||
libraryTarget: 'umd',
|
||||
libraryExport: 'default'
|
||||
libraryExport: 'default',
|
||||
},
|
||||
devServer: {
|
||||
contentBase: [path.join(__dirname, 'cypress', 'platform'), path.join(__dirname, 'dist')],
|
||||
compress: true,
|
||||
port: 9000
|
||||
port: 9000,
|
||||
},
|
||||
module: {
|
||||
rules: [amdRule, jsRule, scssRule, jisonRule]
|
||||
rules: [amdRule, jsRule, scssRule, jisonRule],
|
||||
},
|
||||
externals: {
|
||||
mermaid: 'mermaid'
|
||||
mermaid: 'mermaid',
|
||||
},
|
||||
devtool: 'source-map'
|
||||
devtool: 'source-map',
|
||||
};
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { jsConfig } from './webpack.config.base'
|
||||
import { jsConfig } from './webpack.config.base';
|
||||
|
||||
const minConfig = jsConfig()
|
||||
minConfig.mode = 'production'
|
||||
minConfig.output.filename = '[name].min.js'
|
||||
const minConfig = jsConfig();
|
||||
minConfig.mode = 'production';
|
||||
minConfig.output.filename = '[name].min.js';
|
||||
|
||||
export default [minConfig]
|
||||
export default [minConfig];
|
||||
|
Loading…
x
Reference in New Issue
Block a user