Commit Graph

5672 Commits

Author SHA1 Message Date
Alois Klink 1527956669
fix(git): support unusual prefixes in branch name
jison throws an error if a branch name starts with an unusual prefix.

For example, a branch named `branch/test-branch` will throw a
parse error, since jison thinks it's a `branch` command, and not
a branch id.

An easy fix is to use the `(?=\s|$)` regex to ensure that only
'branch ' or 'branch\n' will be parsed as the branch command.

Fixes: https://github.com/mermaid-js/mermaid/issues/3362
2022-09-11 22:52:02 +01:00
Ashley Engelund (weedySeaDragon @ github) 9cc7da09fc formatting 2022-09-11 14:10:34 -07:00
Alois Klink 5554725f63
build: change package export to mermaid.core.mjs
`mermaid.core.mjs` should be the default export.
This is because it does not bundle `node_modules/`, allowing users of
mermaid to bundle dependencies themselves,
using Webpack/ESBuild/others.
2022-09-11 21:56:32 +01:00
Alois Klink 37aaca0090
build: convert core build to unbundled ESM
The `mermaid.core.js` build was previously a UMD build that did not
have `node_modules` bundled.

This was designed for users to add `mermaid` to their own apps,
then bundle with Webpack/ESBuild.
Hence the bundle test in `cypress/platform/bundle-test.js`.

As ESBuild does not support UMD, I've switched the `mermaid.core.js`
to instead use ESM, as Mermaid now requires ESM
(due to d3 requiring ESM). All modern bundlers also support ESM.
2022-09-11 21:56:30 +01:00
Alois Klink 48a899f7a9
build: remove main function from `.jison` files
When converting a `.jison` file into a CommonJS module,
jison by default adds a main() function that calls `require("fs");`

Even though the main function is never used in the browser,
because `fs` is a Node.JS only module, this causes some esbuild issues.

To disable this, we can just set an empty main to the jison generator.
2022-09-11 21:56:26 +01:00
Ashley Engelund (weedySeaDragon @ github) 6ad9208119 eslint fixes 2022-09-11 11:37:23 -07:00
Knut Sveidqvist fc9d22562b Creating detectors and moving out diagram specific code from the diagramAPI 2022-09-10 15:53:50 +02:00
Ashley Engelund (weedySeaDragon @ github) ad56a22277 Merge remote-tracking branch 'MERMAID/develop' into docs/3418_auto_generated_comment_html_files
# Conflicts:
#	src/docs.mts
2022-09-09 18:48:21 -07:00
Ashley Engelund (weedySeaDragon @ github) 8ca91d6303 add eslint-disable no-console for file 2022-09-09 18:32:26 -07:00
Sidharth Vinod 9d0901801b
Suppress errors 2022-09-09 18:26:57 +05:30
Knut Sveidqvist f63acea34a
Merge pull request #3393 from mermaid-js/sidv/typescript
Introduce stricter typescript linting
2022-09-09 14:51:33 +02:00
Sidharth Vinod 5a1e3ed5c6
Merge branch 'develop' into sidv/typescript
* develop: (67 commits)
  fix: Tsconfig
  Update prettier
  chore: Run postbuild with prepare
  (formatting) prettier fix
  Removed warnings in the grammar oand some console logging
  ci: lint .jison files for any console.log()
  fix JSDOC @param, @returns; fixed a few minor typos in comments
  unmangle sentence about doc changes committed and showing up on docsify site
  change references from /docs to /src/docs; rework doc section in CONTRIBUTING
  Update after lint comments
  Regenerate the directive docs as I changed them
  chore(deps-dev): bump typescript from 4.7.4 to 4.8.2
  Update duplicate copy pasted directive description
  chore(deps-dev): bump @types/dompurify from 2.3.3 to 2.3.4
  chore(deps-dev): bump jest-environment-jsdom from 29.0.1 to 29.0.2
  chore(deps-dev): bump babel-jest from 29.0.1 to 29.0.2
  Lint fixes
  Removing requirement to add ids for nodes with a shape
  #3336 Merged typescript changes
  Merged typescript changes
  ...
2022-09-09 18:12:41 +05:30
Sidharth Vinod 5148acb20f
Specify `iife` format 2022-09-09 17:49:11 +05:30
Sidharth Vinod c8d3c3ac4f
Correct name `umd` -> `iife` 2022-09-09 17:48:09 +05:30
Sidharth Vinod 1029ce4527
fix: Add `.core` build. 2022-09-09 17:32:13 +05:30
Knut Sveidqvist 0f56c9a85d Fix for issue #3428, load the configured diagrams even when initialize has not been called. 2022-09-09 13:37:37 +02:00
Knut Sveidqvist ffcb73ad5f
Merge pull request #3434 from mermaid-js/sidv/memoize
Fix memoize
2022-09-09 13:34:31 +02:00
Sidharth Vinod d2e7b1e56f
fix: Support treeshaking 2022-09-09 16:58:48 +05:30
Sidharth Vinod b1770d3d06
Merge branch 'sidv/esbuild' into sidv/memoize
* sidv/esbuild:
2022-09-09 16:37:29 +05:30
Sidharth Vinod 8e2287a86d
Merge branch 'develop' into sidv/esbuild
* develop: (22 commits)
  fix: Tsconfig
  ci: lint .jison files for any console.log()
  refactor: remove `console.log` in c4Diagram.jison
  style: forbid using `console` in mermaid src code
  Add tests for other boundary properties
  Add first test for Boundary
  Test all different types of systems
  Introduce shape list in test
  Add tests for C4 System
  Make test grouping more explicit
  Copy tests from Person to PersonExt
  Add test for link to Person_Ext
  Add question on Person_Ext
  Add test for structure of Person_Ext
  Add test for alias
  Add test for label
  Add test for description
  Add test for $tags
  Add test for $link
  Add test for $sprite
  ...
2022-09-09 16:36:46 +05:30
Sidharth Vinod 5aae45dc97
fix: Use lodash memoize 2022-09-09 16:34:57 +05:30
Sidharth Vinod 1c6328cc1b
Merge branch 'develop' into sidv/memoize
* develop: (22 commits)
  fix: Tsconfig
  ci: lint .jison files for any console.log()
  refactor: remove `console.log` in c4Diagram.jison
  style: forbid using `console` in mermaid src code
  Add tests for other boundary properties
  Add first test for Boundary
  Test all different types of systems
  Introduce shape list in test
  Add tests for C4 System
  Make test grouping more explicit
  Copy tests from Person to PersonExt
  Add test for link to Person_Ext
  Add question on Person_Ext
  Add test for structure of Person_Ext
  Add test for alias
  Add test for label
  Add test for description
  Add test for $tags
  Add test for $link
  Add test for $sprite
  ...
2022-09-09 16:02:37 +05:30
Sidharth Vinod 8a476f882d
Remove native memoize 2022-09-09 16:02:26 +05:30
Knut Sveidqvist d78adc6fb9
Merge pull request #3367 from dbartholomae/add_tests_for_C4_system_context_macros
Add tests for C4 system context macros
2022-09-09 09:35:51 +02:00
Sidharth Vinod 2611a430b9
Merge pull request #3405 from aloisklink/other/3339_forbid-console-in-src-code
style: forbid using `console` in mermaid src code
2022-09-09 08:32:55 +05:30
Sidharth Vinod f8eaccb4c1
fix: Run precommit hook for doc.mts changes too 2022-09-08 21:54:51 +05:30
Sidharth Vinod b0559df903
chore: Updated doc files 2022-09-08 21:52:41 +05:30
Sidharth Vinod 2826bf6823
fix: Formatting issue 2022-09-08 21:51:42 +05:30
Ashley Engelund (weedySeaDragon @ github) 9acf63f7d6 (formatting only) sort imports just to force a new CI lint check 2022-09-08 07:44:36 -07:00
Alois Klink 5d72585705
ci: re-enable coveralls coverage upload
Reverts commits:
  - Disabling coveralls temporarilly
    aedf066337
  - Tmo disabling of coveralls
    a6b4cb24b8

I'm not 100% sure whether the `parallel` option is needed,
but I've left it disabled for now, since it'd would mean that we need
to merge both the `test.yml` and the `e2e.yml` file together.
2022-09-08 04:03:57 +01:00
Alois Klink b760e717d0
build(dev-deps): remove unused `coveralls`
This devDependency is currently unused, and seems to have been unused
for a while.
2022-09-08 03:39:27 +01:00
Alois Klink fe8f52fb1b
test: disable coverage for `.jison` files
Coverage for `.jison` files doesn't make sense, since most of the
created JS lines are auto-generated.

If jison ever adds a source-map feature, we can renable coverage for
jison.
2022-09-08 03:35:50 +01:00
Ashley Engelund (weedySeaDragon @ github) fd567f833e (minor) clarify var names (file -> filename); comments 2022-09-07 14:15:54 -07:00
Ashley Engelund (weedySeaDragon @ github) 6376c9ae43 switch order of params so the last one can be omitted 2022-09-07 14:15:09 -07:00
Ashley Engelund (weedySeaDragon @ github) 48b0076ea5 Merge remote-tracking branch 'MERMAID/develop' into docs/3418_auto_generated_comment_html_files 2022-09-07 14:04:56 -07:00
Sidharth Vinod a800cb6fe6 Update prettier 2022-09-07 14:04:35 -07:00
Sidharth Vinod 5f81e3d5ed chore: Run postbuild with prepare
As postbuild was not running with prepare, PR that updated `documentation` package was green,  although it should've failed.
2022-09-07 14:04:35 -07:00
Ashley Engelund (weedySeaDragon @ github) e690da638d (formatting) prettier fix 2022-09-07 14:04:35 -07:00
Ashley Engelund (weedySeaDragon @ github) be28160a4a unmangle sentence about doc changes committed and showing up on docsify site 2022-09-07 14:04:35 -07:00
Ashley Engelund (weedySeaDragon @ github) d18624bbe9 change references from /docs to /src/docs; rework doc section in CONTRIBUTING 2022-09-07 14:04:35 -07:00
Ashley Engelund (weedySeaDragon @ github) 7fe8f260fc minor cleanup, clarify var names, add @todos 2022-09-07 14:04:35 -07:00
Ashley Engelund (weedySeaDragon @ github) 73abcd869c fix: also check other files 2022-09-07 14:04:35 -07:00
Ashley Engelund (weedySeaDragon @ github) d0074356e9 fix: cannot use __dirname with .mts and latest Node 2022-09-07 14:04:35 -07:00
Alois Klink 6e81ee9d97
Merge branch 'develop' into other/3339_forbid-console-in-src-code
Fixes merge conflict in:
  - .eslintrc.json due to 6167eda6b6
  - lint.yml due to 5674f8e675
2022-09-07 21:00:42 +01:00
Sidharth Vinod 3986f48199
fix: Tsconfig 2022-09-08 00:34:52 +05:30
Ashley Engelund (weedySeaDragon @ github) c6ce5a80fa fix: pass in doCopy param 2022-09-07 11:00:59 -07:00
Sidharth Vinod 056d5200c6
Fix postbuild 2022-09-07 21:06:35 +05:30
Ashley Engelund (weedySeaDragon @ github) 411d641aa2 simplfy method to copy transformation to /docs; extract logging
Extract the logging so that it if later we want to turn it on/off with a --verbose flag
2022-09-07 08:35:51 -07:00
Sidharth Vinod 86cbf85358
Merge branch 'develop' into sidv/esbuild
* develop:
  Update prettier
  chore: Run postbuild with prepare
  (formatting) prettier fix
  Removed warnings in the grammar oand some console logging
  unmangle sentence about doc changes committed and showing up on docsify site
  change references from /docs to /src/docs; rework doc section in CONTRIBUTING
2022-09-07 21:03:07 +05:30
Ashley Engelund (weedySeaDragon @ github) a878edfb9b add and use constants; DRY glob patterns in main 2022-09-07 08:32:52 -07:00