webpack fs: 'empty'

This commit is contained in:
Tyler Long
2017-09-11 23:06:34 +08:00
parent c5a7eeaa0f
commit 75d9e7bc59
11 changed files with 110 additions and 107 deletions

View File

@@ -31,7 +31,7 @@ export default function (config) {
}, },
webpack: { webpack: {
externals: webpackConfig.externals, node: webpackConfig.node,
module: webpackConfig.module module: webpackConfig.module
}, },

View File

@@ -1,6 +1,6 @@
{ {
"name": "mermaid", "name": "mermaid",
"version": "7.0.13", "version": "7.0.14",
"description": "Markdownish syntax for generating flowcharts, sequence diagrams, class diagrams, gantt charts and git graphs.", "description": "Markdownish syntax for generating flowcharts, sequence diagrams, class diagrams, gantt charts and git graphs.",
"main": "dist/mermaid.core.js", "main": "dist/mermaid.core.js",
"keywords": [ "keywords": [
@@ -24,7 +24,7 @@
"karma": "node -r babel-register node_modules/.bin/karma start karma.conf.js --single-run", "karma": "node -r babel-register node_modules/.bin/karma start karma.conf.js --single-run",
"jest": "jest --coverage --runInBand", "jest": "jest --coverage --runInBand",
"test": "yarn lint && yarn karma", "test": "yarn lint && yarn karma",
"jison": "gulp jison", "jison": "node -r babel-register node_modules/.bin/gulp jison",
"prepublishOnly": "yarn build && yarn release && yarn test" "prepublishOnly": "yarn build && yarn release && yarn test"
}, },
"repository": { "repository": {

View File

@@ -731,12 +731,12 @@ exports.parser = parser;
exports.Parser = parser.Parser; exports.Parser = parser.Parser;
exports.parse = function () { return parser.parse.apply(parser, arguments); }; exports.parse = function () { return parser.parse.apply(parser, arguments); };
exports.main = function commonjsMain(args) { exports.main = function commonjsMain(args) {
// if (!args[1]) { if (!args[1]) {
// console.log('Usage: '+args[0]+' FILE'); console.log('Usage: '+args[0]+' FILE');
// process.exit(1); process.exit(1);
// } }
// var source = require('fs').readFileSync(require('path').normalize(args[1]), "utf8"); var source = require('fs').readFileSync(require('path').normalize(args[1]), "utf8");
// return exports.parser.parse(source); return exports.parser.parse(source);
}; };
if (typeof module !== 'undefined' && require.main === module) { if (typeof module !== 'undefined' && require.main === module) {
exports.main(process.argv.slice(1)); exports.main(process.argv.slice(1));

View File

@@ -621,12 +621,12 @@ exports.parser = parser;
exports.Parser = parser.Parser; exports.Parser = parser.Parser;
exports.parse = function () { return parser.parse.apply(parser, arguments); }; exports.parse = function () { return parser.parse.apply(parser, arguments); };
exports.main = function commonjsMain(args) { exports.main = function commonjsMain(args) {
// if (!args[1]) { if (!args[1]) {
// console.log('Usage: '+args[0]+' FILE'); console.log('Usage: '+args[0]+' FILE');
// process.exit(1); process.exit(1);
// } }
// var source = require('fs').readFileSync(require('path').normalize(args[1]), "utf8"); var source = require('fs').readFileSync(require('path').normalize(args[1]), "utf8");
// return exports.parser.parse(source); return exports.parser.parse(source);
}; };
if (typeof module !== 'undefined' && require.main === module) { if (typeof module !== 'undefined' && require.main === module) {
exports.main(process.argv.slice(1)); exports.main(process.argv.slice(1));

View File

@@ -731,12 +731,12 @@ exports.parser = parser;
exports.Parser = parser.Parser; exports.Parser = parser.Parser;
exports.parse = function () { return parser.parse.apply(parser, arguments); }; exports.parse = function () { return parser.parse.apply(parser, arguments); };
exports.main = function commonjsMain(args) { exports.main = function commonjsMain(args) {
// if (!args[1]) { if (!args[1]) {
// console.log('Usage: '+args[0]+' FILE'); console.log('Usage: '+args[0]+' FILE');
// process.exit(1); process.exit(1);
// } }
// var source = require('fs').readFileSync(require('path').normalize(args[1]), "utf8"); var source = require('fs').readFileSync(require('path').normalize(args[1]), "utf8");
// return exports.parser.parse(source); return exports.parser.parse(source);
}; };
if (typeof module !== 'undefined' && require.main === module) { if (typeof module !== 'undefined' && require.main === module) {
exports.main(process.argv.slice(1)); exports.main(process.argv.slice(1));

View File

@@ -952,12 +952,12 @@ exports.parser = parser;
exports.Parser = parser.Parser; exports.Parser = parser.Parser;
exports.parse = function () { return parser.parse.apply(parser, arguments); }; exports.parse = function () { return parser.parse.apply(parser, arguments); };
exports.main = function commonjsMain(args) { exports.main = function commonjsMain(args) {
// if (!args[1]) { if (!args[1]) {
// console.log('Usage: '+args[0]+' FILE'); console.log('Usage: '+args[0]+' FILE');
// process.exit(1); process.exit(1);
// } }
// var source = require('fs').readFileSync(require('path').normalize(args[1]), "utf8"); var source = require('fs').readFileSync(require('path').normalize(args[1]), "utf8");
// return exports.parser.parse(source); return exports.parser.parse(source);
}; };
if (typeof module !== 'undefined' && require.main === module) { if (typeof module !== 'undefined' && require.main === module) {
exports.main(process.argv.slice(1)); exports.main(process.argv.slice(1));

View File

@@ -647,12 +647,12 @@ exports.parser = parser;
exports.Parser = parser.Parser; exports.Parser = parser.Parser;
exports.parse = function () { return parser.parse.apply(parser, arguments); }; exports.parse = function () { return parser.parse.apply(parser, arguments); };
exports.main = function commonjsMain(args) { exports.main = function commonjsMain(args) {
// if (!args[1]) { if (!args[1]) {
// console.log('Usage: '+args[0]+' FILE'); console.log('Usage: '+args[0]+' FILE');
// process.exit(1); process.exit(1);
// } }
// var source = require('fs').readFileSync(require('path').normalize(args[1]), "utf8"); var source = require('fs').readFileSync(require('path').normalize(args[1]), "utf8");
// return exports.parser.parse(source); return exports.parser.parse(source);
}; };
if (typeof module !== 'undefined' && require.main === module) { if (typeof module !== 'undefined' && require.main === module) {
exports.main(process.argv.slice(1)); exports.main(process.argv.slice(1));

View File

@@ -687,12 +687,12 @@ exports.parser = parser;
exports.Parser = parser.Parser; exports.Parser = parser.Parser;
exports.parse = function () { return parser.parse.apply(parser, arguments); }; exports.parse = function () { return parser.parse.apply(parser, arguments); };
exports.main = function commonjsMain(args) { exports.main = function commonjsMain(args) {
// if (!args[1]) { if (!args[1]) {
// console.log('Usage: '+args[0]+' FILE'); console.log('Usage: '+args[0]+' FILE');
// process.exit(1); process.exit(1);
// } }
// var source = require('fs').readFileSync(require('path').normalize(args[1]), "utf8"); var source = require('fs').readFileSync(require('path').normalize(args[1]), "utf8");
// return exports.parser.parse(source); return exports.parser.parse(source);
}; };
if (typeof module !== 'undefined' && require.main === module) { if (typeof module !== 'undefined' && require.main === module) {
exports.main(process.argv.slice(1)); exports.main(process.argv.slice(1));

View File

@@ -797,12 +797,12 @@ exports.parser = parser;
exports.Parser = parser.Parser; exports.Parser = parser.Parser;
exports.parse = function () { return parser.parse.apply(parser, arguments); }; exports.parse = function () { return parser.parse.apply(parser, arguments); };
exports.main = function commonjsMain(args) { exports.main = function commonjsMain(args) {
// if (!args[1]) { if (!args[1]) {
// console.log('Usage: '+args[0]+' FILE'); console.log('Usage: '+args[0]+' FILE');
// process.exit(1); process.exit(1);
// } }
// var source = require('fs').readFileSync(require('path').normalize(args[1]), "utf8"); var source = require('fs').readFileSync(require('path').normalize(args[1]), "utf8");
// return exports.parser.parse(source); return exports.parser.parse(source);
}; };
if (typeof module !== 'undefined' && require.main === module) { if (typeof module !== 'undefined' && require.main === module) {
exports.main(process.argv.slice(1)); exports.main(process.argv.slice(1));

View File

@@ -9,6 +9,7 @@
- Get familar with jison - Get familar with jison
- git graph requires a blank line at the end. why? - git graph requires a blank line at the end. why?
- Move cli to mermaid-cli project ? - Move cli to mermaid-cli project ?
- think about it
- Remove 'lodash' as dependency - Remove 'lodash' as dependency
- https://github.com/lodash/babel-plugin-lodash - https://github.com/lodash/babel-plugin-lodash
- https://www.npmjs.com/package/lodash-webpack-plugin - https://www.npmjs.com/package/lodash-webpack-plugin
@@ -22,5 +23,4 @@
- Generate them into system temp folder instead - Generate them into system temp folder instead
- Replace phantomjs with Chrome headless - Replace phantomjs with Chrome headless
- `yarn jest` is disabled - `yarn jest` is disabled
- Don't manually change jison generated files - Travis build failed
- Removed 'fs' dependency from it

View File

@@ -16,6 +16,9 @@ export const jsConfig = () => {
entry: { entry: {
mermaid: './src/mermaid.js' mermaid: './src/mermaid.js'
}, },
node: {
fs: 'empty' // jison generated code requires 'fs'
},
output: { output: {
path: path.join(__dirname, './dist/'), path: path.join(__dirname, './dist/'),
filename: '[name].js', filename: '[name].js',