Cache eslint using `--cache-strategy content` instead of the default
`--cache-strategy metadata`.
By default, `eslint` uses the file metadata (e.g. modification time)
to detect when the cache should be invalidated.
However, this is not efficient with `git`, since git constantly changes
the modification time,
e.g. running `git switch main && git switch original-branch` would not
change the file contents, but would change the file mtimes and force
eslint to re-lint everything.
Using the file contents is slower (~3% for me), but more resilient.
See
https://eslint.org/docs/latest/use/command-line-interface#--cache-strategy
[Prettier 2.7.0](https://prettier.io/blog/2022/06/14/2.7.0.html) added
a `--cache` CLI option to greatly speed up subsequent prettier runs.
By default, the cache is stored in
`./node_modules/.cache/prettier/.prettier-cache` and uses an `md5`
checksum of the contents as the cache-key.
On my PC, running `pnpm run lint` used to take 13.9 seconds, but now
it only takes 6 seconds.
Potential issues
----------------
Although updating Node.JS/Prettier will invalidate the cache,
updating or changing prettier plugins won't invalidate the cache.
Since we do use `prettier-plugin-jsdoc` in Mermaid, this might cause
a minor issue, but CI should catch it.
* master: (23 commits)
Update vitepress
fix: Add icon css
fix Top level await
v9.3.0
bump dagre-es 7.0.6
Bump mermaid version
Update dagre-es
Bump mermaid version
fix: Incorrect removal of existing elements
fix: add .js to external imports.
fix: add .js to external imports.
Bump mermaid version
fix: add .js to external imports.
Bump mermaid version
fix: Throw correct errors when parsing diagrams with errors
Update url snapshot test for external diagrams
Update url snapshot test for external diagrams
Updated package number
Updated package number
Updated package number to 9.3.0-rc1
...
* develop: (79 commits)
chore: docs:build
chore: docs:build
tiny fix and change: "The/y cannot" -> "Cannot..."
remove 'horz' from cSpell.json
update demos/state.html to includ examples; formatting
add 'horz' to cSpell (in pieDetector.ts commented out barChart work)
refine - what is not done yet
remove 'horz' from cSpell.json
Revert "Added pie"
chore: Fix cSpell in pieRenderer
update demos/state.html to includ examples; formatting
add 'horz' to cSpell (in pieDetector.ts commented out barChart work)
refine - what is not done yet
remove console stmt
#3831 Re-enabling themes for er diagrams
#3835 Adding path to list of elements to be styled
#3882 fix for issues with mindmaps with only a single node
chore(deps): update pnpm to v7.17.0
docs: Remove warning in readme
chore(deps): update lycheeverse/lychee-action action to v1.5.4
...
Replace the dagre and dagre-d3 libraries with dagre-d3-es.
Both dagre and dagre-d3 are deprecated and unmaintained,
and haven't been updated for more than 3 years.
Since dagre-d3 still requires an old version of d3, this causes
a bunch of security warnings,
e.g. https://github.com/advisories/GHSA-36jr-mh4h-2g58
The [dagre-d3-es](https://github.com/tbo47/dagre-es) package is a fork
that contains support for `"d3": "^7.6.1"`. Also, it's ESM, so we will
hopefully get smaller bundle sizes too. The only issue is that this
fork isn't very well used (only has 3000 weekly downloads),
compared to `dagre-d3`'s 250,000 weekly downloads.
(although to be fair, a large proportion of dagre-d3's downloads
probably come from mermaid)
Since it's is a less popular package,
**I've pinned `dagre-d3-es` to `"7.0.2"` instead of `"^7.0.2"`**.
This does mean if there is a bug in `dagre-d3-es`, we will have to
manually bump it ourselves, but it also means we won't accidentally
be sending a buggy version of `dagre-d3-es` out to users in cases
something changes (it might be worth disabling renovate for this
if we're feeling paranoid!)
* develop:
chore(deps): update all non-major dependencies
fix(deps): update all non-major dependencies
fix: `sourceLinkTemplate` in typedoc
only call getClasses if the diagram renderer supports it
fix typo
merge fix: get classDefs only if diagram is in CLASSDEF_DIAGRAMS
use lodash isEmpty instead of method defined in utils
chore: Fix cspell
fix: Type of DiagramStyleClassDef, general cleanup
change spec descriptions to active voice (= shorter b/c 'should' isn't needed)
functions and specs: removeExistingElements
functions and specs: createUserstyles; minor changes
functions and specs: createCssStyles, appendDivSvgG,cleanUpSvgCode, putIntoIFrame [for render]
add MockedD3.ts
const isSandboxed, isLooseSecurityLevel, fontFamily; a few more CONSTs
more meaningful var names; move related lines together; const idSelector
comment the main steps (prepare to break into functions that can be tested)
render: define const iFrameId, enclosingDivID and _selector to use in function
specs: encodeEntities, decodeEntities
render: constants