Skip to content

Build your personal knowledge base with Trilium Notes

fix(client/vite): build errors due to mark.js

Elian Dorane23400bec1ed
diff --git a/apps/client/package.json b/apps/client/package.json
index 8f396cde42..773a27a051 100644
--- a/apps/client/package.json
+++ b/apps/client/package.json
@@ -22,8 +22,8 @@
"@mind-elixir/node-menu": "1.0.5",
"@popperjs/core": "2.11.8",
"@triliumnext/ckeditor5": "workspace:*",
- "@triliumnext/commons": "workspace:*",
"@triliumnext/codemirror": "workspace:*",
+ "@triliumnext/commons": "workspace:*",
"bootstrap": "5.3.6",
"dayjs": "1.11.13",
"dayjs-plugin-utc": "0.1.2",
@@ -57,6 +57,7 @@
"@types/jquery": "3.5.32",
"@types/leaflet": "1.9.17",
"@types/leaflet-gpx": "1.3.7",
+ "@types/mark.js": "8.11.12",
"@types/react": "19.1.4",
"@types/react-dom": "19.1.5",
"copy-webpack-plugin": "13.0.0",
diff --git a/apps/client/src/types-assets.d.ts b/apps/client/src/types-assets.d.ts
index 61242b04e3..36e38fcb33 100644
--- a/apps/client/src/types-assets.d.ts
+++ b/apps/client/src/types-assets.d.ts
@@ -7,5 +7,3 @@ declare module "*.json?external" {
var path: string;
export default path;
}
-
-declare module "script-loader!mark.js/dist/jquery.mark.min.js";
diff --git a/apps/client/src/widgets/find_in_html.ts b/apps/client/src/widgets/find_in_html.ts
index e4d47e6235..fcbc351738 100644
--- a/apps/client/src/widgets/find_in_html.ts
+++ b/apps/client/src/widgets/find_in_html.ts
@@ -21,7 +21,7 @@ export default class FindInHtml {
}
async performFind(searchTerm: string, matchCase: boolean, wholeWord: boolean) {
- await import("script-loader!mark.js/dist/jquery.mark.min.js");
+ await import("mark.js");
const $content = await this.parent?.noteContext?.getContentElement();
@@ -42,7 +42,7 @@ export default class FindInHtml {
const containerTop = scrollingContainer?.getBoundingClientRect().top ?? 0;
const closestIndex = this.$results.toArray().findIndex(el => el.getBoundingClientRect().top >= containerTop);
this.currentIndex = closestIndex >= 0 ? closestIndex : 0;
-
+
await this.jumpTo();
res({
diff --git a/apps/client/src/widgets/view_widgets/list_or_grid_view.ts b/apps/client/src/widgets/view_widgets/list_or_grid_view.ts
index 7733a0d05b..e01fd0c4c2 100644
--- a/apps/client/src/widgets/view_widgets/list_or_grid_view.ts
+++ b/apps/client/src/widgets/view_widgets/list_or_grid_view.ts
@@ -215,7 +215,7 @@ class ListOrGridView extends ViewMode {
const highlightedTokens = this.parentNote.highlightedTokens || [];
if (highlightedTokens.length > 0) {
- await import("script-loader!mark.js/dist/jquery.mark.min.js");
+ await import("mark.js");
const regex = highlightedTokens.map((token) => utils.escapeRegExp(token)).join("|");
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 1fee784b9f..22b41930ce 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -303,6 +303,9 @@ importers:
'@types/leaflet-gpx':
specifier: 1.3.7
version: 1.3.7
+ '@types/mark.js':
+ specifier: 8.11.12
+ version: 8.11.12
'@types/react':
specifier: 19.1.4
version: 19.1.4
@@ -845,7 +848,7 @@ importers:
version: 4.1.0
'@ckeditor/ckeditor5-package-tools':
specifier: ^3.0.1
'@typescript-eslint/eslint-plugin':
specifier: ~8.32.0
@@ -905,7 +908,7 @@ importers:
version: 4.1.0
'@ckeditor/ckeditor5-package-tools':
specifier: ^3.0.1
'@typescript-eslint/eslint-plugin':
specifier: ~8.32.0
@@ -965,7 +968,7 @@ importers:
version: 4.1.0
'@ckeditor/ckeditor5-package-tools':
specifier: ^3.0.1
'@typescript-eslint/eslint-plugin':
specifier: ~8.32.0
@@ -1026,13 +1029,13 @@ importers:
'@ckeditor/ckeditor5-dev-utils':
specifier: 43.0.1
'@ckeditor/ckeditor5-inspector':
specifier: '>=4.1.0'
version: 4.1.0
'@ckeditor/ckeditor5-package-tools':
specifier: ^3.0.1
'@typescript-eslint/eslint-plugin':
specifier: ~8.32.0
@@ -1099,7 +1102,7 @@ importers:
version: 4.1.0
'@ckeditor/ckeditor5-package-tools':
specifier: ^3.0.1
'@typescript-eslint/eslint-plugin':
specifier: ~8.32.0
@@ -5283,6 +5286,9 @@ packages:
resolution: {integrity: sha512-HX7Em5NYQAXKW+1T+FiuG27NGwzJfCX3s1GjOa7ujxZa52kjJLOr4FUxT+giF6Tgxv1e+/czV/iTtBw27WTU9g==}
+ '@types/[email protected]':
+ resolution: {integrity: sha512-244ZnaIBpz4c6xutliAnYVZp6xJlmC569jZqnR3ElO1Y01ooYASSVQEqpd2x0A2UfrgVMs5V9/9tUAdZaDMytQ==}
+
resolution: {integrity: sha512-a79Yc3TOk6dGdituy8hmTTJXjOkZ7zsFYV10L337ttq/rec8lRMDBpV7fL3uLx6TgbFCa5DU/h8FmIBQPSbU0w==}
@@ -15441,30 +15447,30 @@ snapshots:
- uglify-js
- webpack
dependencies:
'@ckeditor/ckeditor5-dev-translations': 43.0.1
chalk: 3.0.0
cli-cursor: 3.1.0
cli-spinners: 2.9.2
cssnano: 6.1.2([email protected])
del: 5.1.0
fs-extra: 11.3.0
is-interactive: 1.0.0
javascript-stringify: 1.6.0
mocha: 7.2.0
postcss: 8.5.3
postcss-import: 14.1.0([email protected])
postcss-mixins: 9.0.4([email protected])
postcss-nesting: 13.0.1([email protected])
shelljs: 0.8.5
through2: 3.0.2
transitivePeerDependencies:
- bluebird
@@ -15773,7 +15779,7 @@ snapshots:
'@ckeditor/ckeditor5-utils': 45.1.0
ckeditor5: 45.1.0(patch_hash=8331a09d41443b39ea1c784daaccfeb0da4f9065ed556e7de92e9c77edd9eb41)
dependencies:
@@ -15795,7 +15801,7 @@ snapshots:
typescript: 5.0.4
transitivePeerDependencies:
- '@rspack/core'
- '@swc/core'
@@ -19805,6 +19811,10 @@ snapshots:
'@types/[email protected]': {}
+ '@types/[email protected]':
+ dependencies:
+ '@types/jquery': 3.5.32
+
'@types/[email protected]': {}
@@ -20192,7 +20202,7 @@ snapshots:
magic-string: 0.30.17
sirv: 3.0.1
tinyrainbow: 2.0.0
optionalDependencies:
playwright: 1.52.0
@@ -20283,7 +20293,7 @@ snapshots:
sirv: 3.0.1
tinyglobby: 0.2.13
tinyrainbow: 2.0.0
'@vitest/[email protected]':
dependencies:
@@ -21913,6 +21923,20 @@ snapshots:
+ dependencies:
+ icss-utils: 5.1.0([email protected])
+ loader-utils: 2.0.4
+ postcss: 8.5.3
+ postcss-modules-extract-imports: 3.1.0([email protected])
+ postcss-modules-local-by-default: 4.2.0([email protected])
+ postcss-modules-scope: 3.2.1([email protected])
+ postcss-modules-values: 4.0.0([email protected])
+ postcss-value-parser: 4.2.0
+ schema-utils: 3.3.0
+ semver: 7.7.1
+
dependencies:
icss-utils: 5.1.0([email protected])
@@ -22995,12 +23019,12 @@ snapshots:
dependencies:
esbuild: 0.17.19
get-tsconfig: 4.10.0
loader-utils: 2.0.4
webpack-sources: 1.4.3
@@ -26041,6 +26065,11 @@ snapshots:
schema-utils: 4.3.2
+ dependencies:
+ schema-utils: 4.3.2
+
dependencies:
schema-utils: 4.3.2
@@ -27147,6 +27176,16 @@ snapshots:
camelcase-css: 2.0.1
postcss: 8.5.3
+ dependencies:
+ cosmiconfig: 7.1.0
+ klona: 2.0.6
+ loader-utils: 2.0.4
+ postcss: 8.5.3
+ schema-utils: 3.3.0
+ semver: 7.7.1
+
dependencies:
cosmiconfig: 7.1.0
@@ -27753,6 +27792,12 @@ snapshots:
+ dependencies:
+ loader-utils: 2.0.4
+ schema-utils: 3.3.0
+
dependencies:
loader-utils: 2.0.4
@@ -28973,6 +29018,12 @@ snapshots:
'@tokenizer/token': 0.3.0
peek-readable: 5.4.2
+ dependencies:
+ loader-utils: 2.0.4
+ schema-utils: 3.3.0
+
dependencies:
loader-utils: 2.0.4
@@ -29346,7 +29397,7 @@ snapshots:
rimraf: 2.6.3
optional: true
dependencies:
cacache: 15.3.0
find-cache-dir: 3.3.2
@@ -29356,7 +29407,7 @@ snapshots:
serialize-javascript: 5.0.1
source-map: 0.6.1
terser: 5.39.0
webpack-sources: 1.4.3
transitivePeerDependencies:
- bluebird
@@ -29373,6 +29424,18 @@ snapshots:
'@swc/core': 1.11.24(@swc/[email protected])
esbuild: 0.25.4
+ dependencies:
+ '@jridgewell/trace-mapping': 0.3.25
+ jest-worker: 27.5.1
+ schema-utils: 4.3.2
+ serialize-javascript: 6.0.2
+ terser: 5.39.0
+ optionalDependencies:
+ '@swc/core': 1.11.24(@swc/[email protected])
+ esbuild: 0.25.4
+
dependencies:
'@jridgewell/trace-mapping': 0.3.25
@@ -30305,7 +30368,7 @@ snapshots:
optionalDependencies:
dependencies:
'@types/bonjour': 3.5.13
'@types/connect-history-api-fallback': 1.5.4
@@ -30333,10 +30396,10 @@ snapshots:
serve-index: 1.9.1
sockjs: 0.3.24
spdy: 4.0.2
- webpack-dev-middleware: 7.4.2([email protected])
optionalDependencies:
webpack-cli: 6.0.1([email protected])
transitivePeerDependencies:
- bufferutil
@@ -30344,7 +30407,7 @@ snapshots:
- supports-color
- utf-8-validate
dependencies:
'@types/bonjour': 3.5.13
'@types/connect-history-api-fallback': 1.5.4
@@ -30372,10 +30435,10 @@ snapshots:
serve-index: 1.9.1
sockjs: 0.3.24
spdy: 4.0.2
+ webpack-dev-middleware: 7.4.2([email protected])
optionalDependencies:
webpack-cli: 6.0.1([email protected])
transitivePeerDependencies:
- bufferutil
@@ -30440,6 +30503,39 @@ snapshots:
- esbuild
- uglify-js
+ dependencies:
+ '@types/eslint-scope': 3.7.7
+ '@types/estree': 1.0.7
+ '@types/json-schema': 7.0.15
+ '@webassemblyjs/ast': 1.14.1
+ '@webassemblyjs/wasm-edit': 1.14.1
+ '@webassemblyjs/wasm-parser': 1.14.1
+ acorn: 8.14.1
+ browserslist: 4.24.4
+ chrome-trace-event: 1.0.4
+ enhanced-resolve: 5.18.1
+ es-module-lexer: 1.7.0
+ eslint-scope: 5.1.1
+ events: 3.3.0
+ glob-to-regexp: 0.4.1
+ graceful-fs: 4.2.11
+ json-parse-even-better-errors: 2.3.1
+ loader-runner: 4.3.0
+ mime-types: 2.1.35
+ neo-async: 2.6.2
+ schema-utils: 4.3.2
+ tapable: 2.2.1
+ watchpack: 2.4.2
+ webpack-sources: 3.2.3
+ optionalDependencies:
+ webpack-cli: 6.0.1([email protected])
+ transitivePeerDependencies:
+ - '@swc/core'
+ - esbuild
+ - uglify-js
+
dependencies:
'@types/eslint-scope': 3.7.7