Svelte setup ok

This commit is contained in:
Simon Cambier
2022-04-14 22:50:56 +02:00
parent 5602b1d8c8
commit e1d24fc562
7 changed files with 223 additions and 49 deletions

View File

@@ -1,7 +1,9 @@
import esbuild from 'esbuild' import esbuild from 'esbuild'
import sveltePlugin from 'esbuild-svelte'
import sveltePreprocess from 'svelte-preprocess'
import { copy } from 'esbuild-plugin-copy'
import process from 'process' import process from 'process'
import builtins from 'builtin-modules' import builtins from 'builtin-modules'
import { copy } from 'esbuild-plugin-copy'
import path from 'path' import path from 'path'
const banner = `/* const banner = `/*
@@ -47,6 +49,9 @@ esbuild
], ],
outfile: path.join('./dist', 'main.js'), outfile: path.join('./dist', 'main.js'),
plugins: [ plugins: [
sveltePlugin({
preprocess: sveltePreprocess(),
}),
copy({ copy({
assets: { assets: {
from: ['./assets/*'], from: ['./assets/*'],

View File

@@ -12,12 +12,14 @@
"author": "", "author": "",
"license": "MIT", "license": "MIT",
"devDependencies": { "devDependencies": {
"@tsconfig/svelte": "^3.0.0",
"@types/node": "^16.11.6", "@types/node": "^16.11.6",
"@typescript-eslint/eslint-plugin": "^5.18.0", "@typescript-eslint/eslint-plugin": "^5.18.0",
"@typescript-eslint/parser": "^5.18.0", "@typescript-eslint/parser": "^5.18.0",
"builtin-modules": "^3.2.0", "builtin-modules": "^3.2.0",
"esbuild": "0.13.12", "esbuild": "0.13.12",
"esbuild-plugin-copy": "^1.2.1", "esbuild-plugin-copy": "^1.2.1",
"esbuild-svelte": "^0.7.0",
"eslint": "7.12.1", "eslint": "7.12.1",
"eslint-config-standard": "^16.0.3", "eslint-config-standard": "^16.0.3",
"eslint-plugin-import": "2.22.1", "eslint-plugin-import": "2.22.1",
@@ -26,8 +28,10 @@
"obsidian": "latest", "obsidian": "latest",
"prettier": "^2.6.2", "prettier": "^2.6.2",
"prettier-eslint": "^13.0.0", "prettier-eslint": "^13.0.0",
"svelte": "^3.47.0",
"svelte-preprocess": "^4.10.6",
"tslib": "2.3.1", "tslib": "2.3.1",
"typescript": "4.4.4" "typescript": "^4.6.3"
}, },
"dependencies": { "dependencies": {
"markdown-to-txt": "^2.0.0", "markdown-to-txt": "^2.0.0",

207
pnpm-lock.yaml generated
View File

@@ -1,12 +1,14 @@
lockfileVersion: 5.3 lockfileVersion: 5.3
specifiers: specifiers:
'@tsconfig/svelte': ^3.0.0
'@types/node': ^16.11.6 '@types/node': ^16.11.6
'@typescript-eslint/eslint-plugin': ^5.18.0 '@typescript-eslint/eslint-plugin': ^5.18.0
'@typescript-eslint/parser': ^5.18.0 '@typescript-eslint/parser': ^5.18.0
builtin-modules: ^3.2.0 builtin-modules: ^3.2.0
esbuild: 0.13.12 esbuild: 0.13.12
esbuild-plugin-copy: ^1.2.1 esbuild-plugin-copy: ^1.2.1
esbuild-svelte: ^0.7.0
eslint: 7.12.1 eslint: 7.12.1
eslint-config-standard: ^16.0.3 eslint-config-standard: ^16.0.3
eslint-plugin-import: 2.22.1 eslint-plugin-import: 2.22.1
@@ -17,30 +19,36 @@ specifiers:
obsidian: latest obsidian: latest
prettier: ^2.6.2 prettier: ^2.6.2
prettier-eslint: ^13.0.0 prettier-eslint: ^13.0.0
svelte: ^3.47.0
svelte-preprocess: ^4.10.6
tslib: 2.3.1 tslib: 2.3.1
typescript: 4.4.4 typescript: ^4.6.3
dependencies: dependencies:
markdown-to-txt: 2.0.0 markdown-to-txt: 2.0.0
minisearch: 5.0.0-beta1 minisearch: 5.0.0-beta1
devDependencies: devDependencies:
'@tsconfig/svelte': 3.0.0
'@types/node': 16.11.26 '@types/node': 16.11.26
'@typescript-eslint/eslint-plugin': 5.18.0_1a8b6b4079a82f2b09d10180d5dea1f6 '@typescript-eslint/eslint-plugin': 5.18.0_2e93aa916703472007e9b5dfec98785b
'@typescript-eslint/parser': 5.18.0_eslint@7.12.1+typescript@4.4.4 '@typescript-eslint/parser': 5.18.0_eslint@7.12.1+typescript@4.6.3
builtin-modules: 3.2.0 builtin-modules: 3.2.0
esbuild: 0.13.12 esbuild: 0.13.12
esbuild-plugin-copy: 1.2.1_esbuild@0.13.12 esbuild-plugin-copy: 1.2.1_esbuild@0.13.12
esbuild-svelte: 0.7.0_esbuild@0.13.12+svelte@3.47.0
eslint: 7.12.1 eslint: 7.12.1
eslint-config-standard: 16.0.3_0fed5a0754053d34bf68c4e5b9539157 eslint-config-standard: 16.0.3_0fed5a0754053d34bf68c4e5b9539157
eslint-plugin-import: 2.22.1_eslint@7.12.1 eslint-plugin-import: 2.22.1_eslint@7.12.1
eslint-plugin-node: 11.1.0_eslint@7.12.1 eslint-plugin-node: 11.1.0_eslint@7.12.1
eslint-plugin-promise: 5.0.0_eslint@7.12.1 eslint-plugin-promise: 5.0.0_eslint@7.12.1
obsidian: 0.14.4 obsidian: 0.14.6
prettier: 2.6.2 prettier: 2.6.2
prettier-eslint: 13.0.0 prettier-eslint: 13.0.0
svelte: 3.47.0
svelte-preprocess: 4.10.6_svelte@3.47.0+typescript@4.6.3
tslib: 2.3.1 tslib: 2.3.1
typescript: 4.4.4 typescript: 4.6.3
packages: packages:
@@ -130,6 +138,10 @@ packages:
fastq: 1.13.0 fastq: 1.13.0
dev: true dev: true
/@tsconfig/svelte/3.0.0:
resolution: {integrity: sha512-pYrtLtOwku/7r1i9AMONsJMVYAtk3hzOfiGNekhtq5tYBGA7unMve8RvUclKLMT3PrihvJqUmzsRGh0RP84hKg==}
dev: true
/@types/codemirror/0.0.108: /@types/codemirror/0.0.108:
resolution: {integrity: sha512-3FGFcus0P7C2UOGCNUVENqObEb4SFk+S8Dnxq7K6aIsLVs/vDtlangl3PEO0ykaKXyK56swVF6Nho7VsA44uhw==} resolution: {integrity: sha512-3FGFcus0P7C2UOGCNUVENqObEb4SFk+S8Dnxq7K6aIsLVs/vDtlangl3PEO0ykaKXyK56swVF6Nho7VsA44uhw==}
dependencies: dependencies:
@@ -156,13 +168,23 @@ packages:
resolution: {integrity: sha512-GZ7bu5A6+4DtG7q9GsoHXy3ALcgeIHP4NnL0Vv2wu0uUB/yQex26v0tf6/na1mm0+bS9Uw+0DFex7aaKr2qawQ==} resolution: {integrity: sha512-GZ7bu5A6+4DtG7q9GsoHXy3ALcgeIHP4NnL0Vv2wu0uUB/yQex26v0tf6/na1mm0+bS9Uw+0DFex7aaKr2qawQ==}
dev: true dev: true
/@types/pug/2.0.6:
resolution: {integrity: sha512-SnHmG9wN1UVmagJOnyo/qkk0Z7gejYxOYYmaAwr5u2yFYfsupN3sg10kyzN8Hep/2zbHxCnsumxOoRIRMBwKCg==}
dev: true
/@types/sass/1.43.1:
resolution: {integrity: sha512-BPdoIt1lfJ6B7rw35ncdwBZrAssjcwzI5LByIrYs+tpXlj/CAkuVdRsgZDdP4lq5EjyWzwxZCqAoFyHKFwp32g==}
dependencies:
'@types/node': 16.11.26
dev: true
/@types/tern/0.23.4: /@types/tern/0.23.4:
resolution: {integrity: sha512-JAUw1iXGO1qaWwEOzxTKJZ/5JxVeON9kvGZ/osgZaJImBnyjyn0cjovPsf6FNLmyGY8Vw9DoXZCMlfMkMwHRWg==} resolution: {integrity: sha512-JAUw1iXGO1qaWwEOzxTKJZ/5JxVeON9kvGZ/osgZaJImBnyjyn0cjovPsf6FNLmyGY8Vw9DoXZCMlfMkMwHRWg==}
dependencies: dependencies:
'@types/estree': 0.0.51 '@types/estree': 0.0.51
dev: true dev: true
/@typescript-eslint/eslint-plugin/5.18.0_1a8b6b4079a82f2b09d10180d5dea1f6: /@typescript-eslint/eslint-plugin/5.18.0_2e93aa916703472007e9b5dfec98785b:
resolution: {integrity: sha512-tzrmdGMJI/uii9/V6lurMo4/o+dMTKDH82LkNjhJ3adCW22YQydoRs5MwTiqxGF9CSYxPxQ7EYb4jLNlIs+E+A==} resolution: {integrity: sha512-tzrmdGMJI/uii9/V6lurMo4/o+dMTKDH82LkNjhJ3adCW22YQydoRs5MwTiqxGF9CSYxPxQ7EYb4jLNlIs+E+A==}
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
peerDependencies: peerDependencies:
@@ -173,18 +195,18 @@ packages:
typescript: typescript:
optional: true optional: true
dependencies: dependencies:
'@typescript-eslint/parser': 5.18.0_eslint@7.12.1+typescript@4.4.4 '@typescript-eslint/parser': 5.18.0_eslint@7.12.1+typescript@4.6.3
'@typescript-eslint/scope-manager': 5.18.0 '@typescript-eslint/scope-manager': 5.18.0
'@typescript-eslint/type-utils': 5.18.0_eslint@7.12.1+typescript@4.4.4 '@typescript-eslint/type-utils': 5.18.0_eslint@7.12.1+typescript@4.6.3
'@typescript-eslint/utils': 5.18.0_eslint@7.12.1+typescript@4.4.4 '@typescript-eslint/utils': 5.18.0_eslint@7.12.1+typescript@4.6.3
debug: 4.3.4 debug: 4.3.4
eslint: 7.12.1 eslint: 7.12.1
functional-red-black-tree: 1.0.1 functional-red-black-tree: 1.0.1
ignore: 5.2.0 ignore: 5.2.0
regexpp: 3.2.0 regexpp: 3.2.0
semver: 7.3.5 semver: 7.3.5
tsutils: 3.21.0_typescript@4.4.4 tsutils: 3.21.0_typescript@4.6.3
typescript: 4.4.4 typescript: 4.6.3
transitivePeerDependencies: transitivePeerDependencies:
- supports-color - supports-color
dev: true dev: true
@@ -227,7 +249,7 @@ packages:
- supports-color - supports-color
dev: true dev: true
/@typescript-eslint/parser/5.18.0_eslint@7.12.1+typescript@4.4.4: /@typescript-eslint/parser/5.18.0_eslint@7.12.1+typescript@4.6.3:
resolution: {integrity: sha512-+08nYfurBzSSPndngnHvFw/fniWYJ5ymOrn/63oMIbgomVQOvIDhBoJmYZ9lwQOCnQV9xHGvf88ze3jFGUYooQ==} resolution: {integrity: sha512-+08nYfurBzSSPndngnHvFw/fniWYJ5ymOrn/63oMIbgomVQOvIDhBoJmYZ9lwQOCnQV9xHGvf88ze3jFGUYooQ==}
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
peerDependencies: peerDependencies:
@@ -239,10 +261,10 @@ packages:
dependencies: dependencies:
'@typescript-eslint/scope-manager': 5.18.0 '@typescript-eslint/scope-manager': 5.18.0
'@typescript-eslint/types': 5.18.0 '@typescript-eslint/types': 5.18.0
'@typescript-eslint/typescript-estree': 5.18.0_typescript@4.4.4 '@typescript-eslint/typescript-estree': 5.18.0_typescript@4.6.3
debug: 4.3.4 debug: 4.3.4
eslint: 7.12.1 eslint: 7.12.1
typescript: 4.4.4 typescript: 4.6.3
transitivePeerDependencies: transitivePeerDependencies:
- supports-color - supports-color
dev: true dev: true
@@ -255,7 +277,7 @@ packages:
'@typescript-eslint/visitor-keys': 5.18.0 '@typescript-eslint/visitor-keys': 5.18.0
dev: true dev: true
/@typescript-eslint/type-utils/5.18.0_eslint@7.12.1+typescript@4.4.4: /@typescript-eslint/type-utils/5.18.0_eslint@7.12.1+typescript@4.6.3:
resolution: {integrity: sha512-vcn9/6J5D6jtHxpEJrgK8FhaM8r6J1/ZiNu70ZUJN554Y3D9t3iovi6u7JF8l/e7FcBIxeuTEidZDR70UuCIfA==} resolution: {integrity: sha512-vcn9/6J5D6jtHxpEJrgK8FhaM8r6J1/ZiNu70ZUJN554Y3D9t3iovi6u7JF8l/e7FcBIxeuTEidZDR70UuCIfA==}
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
peerDependencies: peerDependencies:
@@ -265,11 +287,11 @@ packages:
typescript: typescript:
optional: true optional: true
dependencies: dependencies:
'@typescript-eslint/utils': 5.18.0_eslint@7.12.1+typescript@4.4.4 '@typescript-eslint/utils': 5.18.0_eslint@7.12.1+typescript@4.6.3
debug: 4.3.4 debug: 4.3.4
eslint: 7.12.1 eslint: 7.12.1
tsutils: 3.21.0_typescript@4.4.4 tsutils: 3.21.0_typescript@4.6.3
typescript: 4.4.4 typescript: 4.6.3
transitivePeerDependencies: transitivePeerDependencies:
- supports-color - supports-color
dev: true dev: true
@@ -306,7 +328,7 @@ packages:
- supports-color - supports-color
dev: true dev: true
/@typescript-eslint/typescript-estree/5.18.0_typescript@4.4.4: /@typescript-eslint/typescript-estree/5.18.0_typescript@4.6.3:
resolution: {integrity: sha512-wa+2VAhOPpZs1bVij9e5gyVu60ReMi/KuOx4LKjGx2Y3XTNUDJgQ+5f77D49pHtqef/klglf+mibuHs9TrPxdQ==} resolution: {integrity: sha512-wa+2VAhOPpZs1bVij9e5gyVu60ReMi/KuOx4LKjGx2Y3XTNUDJgQ+5f77D49pHtqef/klglf+mibuHs9TrPxdQ==}
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
peerDependencies: peerDependencies:
@@ -321,13 +343,13 @@ packages:
globby: 11.1.0 globby: 11.1.0
is-glob: 4.0.3 is-glob: 4.0.3
semver: 7.3.5 semver: 7.3.5
tsutils: 3.21.0_typescript@4.4.4 tsutils: 3.21.0_typescript@4.6.3
typescript: 4.4.4 typescript: 4.6.3
transitivePeerDependencies: transitivePeerDependencies:
- supports-color - supports-color
dev: true dev: true
/@typescript-eslint/utils/5.18.0_eslint@7.12.1+typescript@4.4.4: /@typescript-eslint/utils/5.18.0_eslint@7.12.1+typescript@4.6.3:
resolution: {integrity: sha512-+hFGWUMMri7OFY26TsOlGa+zgjEy1ssEipxpLjtl4wSll8zy85x0GrUSju/FHdKfVorZPYJLkF3I4XPtnCTewA==} resolution: {integrity: sha512-+hFGWUMMri7OFY26TsOlGa+zgjEy1ssEipxpLjtl4wSll8zy85x0GrUSju/FHdKfVorZPYJLkF3I4XPtnCTewA==}
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
peerDependencies: peerDependencies:
@@ -336,7 +358,7 @@ packages:
'@types/json-schema': 7.0.11 '@types/json-schema': 7.0.11
'@typescript-eslint/scope-manager': 5.18.0 '@typescript-eslint/scope-manager': 5.18.0
'@typescript-eslint/types': 5.18.0 '@typescript-eslint/types': 5.18.0
'@typescript-eslint/typescript-estree': 5.18.0_typescript@4.4.4 '@typescript-eslint/typescript-estree': 5.18.0_typescript@4.6.3
eslint: 7.12.1 eslint: 7.12.1
eslint-scope: 5.1.1 eslint-scope: 5.1.1
eslint-utils: 3.0.0_eslint@7.12.1 eslint-utils: 3.0.0_eslint@7.12.1
@@ -481,6 +503,10 @@ packages:
fill-range: 7.0.1 fill-range: 7.0.1
dev: true dev: true
/buffer-crc32/0.2.13:
resolution: {integrity: sha1-DTM+PwDqxQqhRUq9MO+MKl2ackI=}
dev: true
/builtin-modules/3.2.0: /builtin-modules/3.2.0:
resolution: {integrity: sha512-lGzLKcioL90C7wMczpkY0n/oART3MbBa8R9OFGE1rJxoVI86u4WAGfEk8Wjv10eKSyTHVGkSo3bvBylCEtk7LA==} resolution: {integrity: sha512-lGzLKcioL90C7wMczpkY0n/oART3MbBa8R9OFGE1rJxoVI86u4WAGfEk8Wjv10eKSyTHVGkSo3bvBylCEtk7LA==}
engines: {node: '>=6'} engines: {node: '>=6'}
@@ -605,6 +631,11 @@ packages:
object-keys: 1.1.1 object-keys: 1.1.1
dev: true dev: true
/detect-indent/6.1.0:
resolution: {integrity: sha512-reYkTUJAZb9gUuZ2RvVCNhVHdg62RHnJ7WJl8ftMi4diZ6NWlciOzQN88pUhSELEwflJht4oQDv0F0BMlwaYtA==}
engines: {node: '>=8'}
dev: true
/dir-glob/3.0.1: /dir-glob/3.0.1:
resolution: {integrity: sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==} resolution: {integrity: sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==}
engines: {node: '>=8'} engines: {node: '>=8'}
@@ -683,6 +714,10 @@ packages:
is-symbol: 1.0.4 is-symbol: 1.0.4
dev: true dev: true
/es6-promise/3.3.1:
resolution: {integrity: sha1-oIzd6EzNvzTQJ6FFG8kdS80ophM=}
dev: true
/esbuild-android-arm64/0.13.12: /esbuild-android-arm64/0.13.12:
resolution: {integrity: sha512-TSVZVrb4EIXz6KaYjXfTzPyyRpXV5zgYIADXtQsIenjZ78myvDGaPi11o4ZSaHIwFHsuwkB6ne5SZRBwAQ7maw==} resolution: {integrity: sha512-TSVZVrb4EIXz6KaYjXfTzPyyRpXV5zgYIADXtQsIenjZ78myvDGaPi11o4ZSaHIwFHsuwkB6ne5SZRBwAQ7maw==}
cpu: [arm64] cpu: [arm64]
@@ -806,6 +841,17 @@ packages:
dev: true dev: true
optional: true optional: true
/esbuild-svelte/0.7.0_esbuild@0.13.12+svelte@3.47.0:
resolution: {integrity: sha512-hfiauhEXtGocUf7oVcxTrLhhF57ajBbvNCCClsS3KntEeITddKU+1WFhmsCt9SO0dQJlCFzJtpPu2dI7dRkXBw==}
engines: {node: '>=12'}
peerDependencies:
esbuild: '>=0.9.6'
svelte: '>=3.43.0'
dependencies:
esbuild: 0.13.12
svelte: 3.47.0
dev: true
/esbuild-windows-32/0.13.12: /esbuild-windows-32/0.13.12:
resolution: {integrity: sha512-L9m4lLFQrFeR7F+eLZXG82SbXZfUhyfu6CexZEil6vm+lc7GDCE0Q8DiNutkpzjv1+RAbIGVva9muItQ7HVTkQ==} resolution: {integrity: sha512-L9m4lLFQrFeR7F+eLZXG82SbXZfUhyfu6CexZEil6vm+lc7GDCE0Q8DiNutkpzjv1+RAbIGVva9muItQ7HVTkQ==}
cpu: [ia32] cpu: [ia32]
@@ -1525,6 +1571,12 @@ packages:
yallist: 4.0.0 yallist: 4.0.0
dev: true dev: true
/magic-string/0.25.9:
resolution: {integrity: sha512-RmF0AsMzgt25qzqqLc1+MbHmhdx0ojF2Fvs4XnOqz2ZOBXzzkEwc/dJQZCYHAn7v1jbVOjAZfK8msRn4BxO4VQ==}
dependencies:
sourcemap-codec: 1.4.8
dev: true
/markdown-to-txt/2.0.0: /markdown-to-txt/2.0.0:
resolution: {integrity: sha512-H5DSAY6frUQ6/CR0nJMlGCEuSA3pvi14dYfICJPKLAvd/rDk6eb+cj84zU5XTNYzECyCcujoAL1PHhjmOgeqUw==} resolution: {integrity: sha512-H5DSAY6frUQ6/CR0nJMlGCEuSA3pvi14dYfICJPKLAvd/rDk6eb+cj84zU5XTNYzECyCcujoAL1PHhjmOgeqUw==}
dependencies: dependencies:
@@ -1552,6 +1604,11 @@ packages:
picomatch: 2.3.1 picomatch: 2.3.1
dev: true dev: true
/min-indent/1.0.1:
resolution: {integrity: sha512-I9jwMn07Sy/IwOj3zVkVik2JTvgpaykDZEigL6Rx6N9LbMywwUSMtxET+7lVoDLLd3O3IXwJwvuuns8UB/HeAg==}
engines: {node: '>=4'}
dev: true
/minimatch/3.1.2: /minimatch/3.1.2:
resolution: {integrity: sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==} resolution: {integrity: sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==}
dependencies: dependencies:
@@ -1573,8 +1630,8 @@ packages:
minimist: 1.2.6 minimist: 1.2.6
dev: true dev: true
/moment/2.29.1: /moment/2.29.2:
resolution: {integrity: sha512-kHmoybcPV8Sqy59DwNDY3Jefr64lK/by/da0ViFcuA4DH0vQg5Q6Ze5VimxkfQNSC+Mls/Kx53s7TjP1RhFEDQ==} resolution: {integrity: sha512-UgzG4rvxYpN15jgCmVJwac49h9ly9NurikMWGPdVxm8GZD6XjkKPxDTjQQ43gtGgnV3X0cAyWDdP2Wexoquifg==}
dev: true dev: true
/ms/2.0.0: /ms/2.0.0:
@@ -1626,13 +1683,13 @@ packages:
es-abstract: 1.19.2 es-abstract: 1.19.2
dev: true dev: true
/obsidian/0.14.4: /obsidian/0.14.6:
resolution: {integrity: sha512-lWU1w/NlXuswAa35ImAbyElLOOno1C13KCZE19kqtcxSPIquvi5Fzy8zBbQ6ZRZZvkvftUiToCp5lcZFRMGxrQ==} resolution: {integrity: sha512-oXPJ8Zt10WhN19bk5l4mZuXRZbbdT1QoMgxGGJ0bB7UcJa0bozDzugS5L/QiV9gDoujpUPxDWNVahEel6r0Fpw==}
dependencies: dependencies:
'@codemirror/state': 0.19.9 '@codemirror/state': 0.19.9
'@codemirror/view': 0.19.48 '@codemirror/view': 0.19.48
'@types/codemirror': 0.0.108 '@types/codemirror': 0.0.108
moment: 2.29.1 moment: 2.29.2
dev: true dev: true
/once/1.4.0: /once/1.4.0:
@@ -1837,6 +1894,15 @@ packages:
queue-microtask: 1.2.3 queue-microtask: 1.2.3
dev: true dev: true
/sander/0.5.1:
resolution: {integrity: sha1-dB4kXiMfB8r7b98PEzrfohalAq0=}
dependencies:
es6-promise: 3.3.1
graceful-fs: 4.2.9
mkdirp: 0.5.6
rimraf: 2.6.3
dev: true
/semver/5.7.1: /semver/5.7.1:
resolution: {integrity: sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==} resolution: {integrity: sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==}
hasBin: true hasBin: true
@@ -1889,6 +1955,20 @@ packages:
is-fullwidth-code-point: 2.0.0 is-fullwidth-code-point: 2.0.0
dev: true dev: true
/sorcery/0.10.0:
resolution: {integrity: sha1-iukK19fLBfxZ8asMY3hF1cFaUrc=}
hasBin: true
dependencies:
buffer-crc32: 0.2.13
minimist: 1.2.6
sander: 0.5.1
sourcemap-codec: 1.4.8
dev: true
/sourcemap-codec/1.4.8:
resolution: {integrity: sha512-9NykojV5Uih4lgo5So5dtw+f0JgJX30KCNI8gwhz2J9A15wD0Ml6tjHKwf6fTSa6fAdVBdZeNOs9eJ71qCk8vA==}
dev: true
/spdx-correct/3.1.1: /spdx-correct/3.1.1:
resolution: {integrity: sha512-cOYcUWwhCuHCXi49RhFRCyJEK3iPj1Ziz9DpViV3tbZOwXD49QzIN3MpOLJNxh2qwq2lJJZaKMVw9qNi4jTC0w==} resolution: {integrity: sha512-cOYcUWwhCuHCXi49RhFRCyJEK3iPj1Ziz9DpViV3tbZOwXD49QzIN3MpOLJNxh2qwq2lJJZaKMVw9qNi4jTC0w==}
dependencies: dependencies:
@@ -1964,6 +2044,13 @@ packages:
engines: {node: '>=4'} engines: {node: '>=4'}
dev: true dev: true
/strip-indent/3.0.0:
resolution: {integrity: sha512-laJTa3Jb+VQpaC6DseHhF7dXVqHTfJPCRDaEbid/drOhgitgYku/letMUqOXFoWV0zIIUbjpdH2t+tYj4bQMRQ==}
engines: {node: '>=8'}
dependencies:
min-indent: 1.0.1
dev: true
/strip-json-comments/3.1.1: /strip-json-comments/3.1.1:
resolution: {integrity: sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==} resolution: {integrity: sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==}
engines: {node: '>=8'} engines: {node: '>=8'}
@@ -1997,6 +2084,62 @@ packages:
engines: {node: '>= 0.4'} engines: {node: '>= 0.4'}
dev: true dev: true
/svelte-preprocess/4.10.6_svelte@3.47.0+typescript@4.6.3:
resolution: {integrity: sha512-I2SV1w/AveMvgIQlUF/ZOO3PYVnhxfcpNyGt8pxpUVhPfyfL/CZBkkw/KPfuFix5FJ9TnnNYMhACK3DtSaYVVQ==}
engines: {node: '>= 9.11.2'}
requiresBuild: true
peerDependencies:
'@babel/core': ^7.10.2
coffeescript: ^2.5.1
less: ^3.11.3 || ^4.0.0
node-sass: '*'
postcss: ^7 || ^8
postcss-load-config: ^2.1.0 || ^3.0.0
pug: ^3.0.0
sass: ^1.26.8
stylus: ^0.55.0
sugarss: ^2.0.0
svelte: ^3.23.0
typescript: ^3.9.5 || ^4.0.0
peerDependenciesMeta:
'@babel/core':
optional: true
coffeescript:
optional: true
less:
optional: true
node-sass:
optional: true
postcss:
optional: true
postcss-load-config:
optional: true
pug:
optional: true
sass:
optional: true
stylus:
optional: true
sugarss:
optional: true
typescript:
optional: true
dependencies:
'@types/pug': 2.0.6
'@types/sass': 1.43.1
detect-indent: 6.1.0
magic-string: 0.25.9
sorcery: 0.10.0
strip-indent: 3.0.0
svelte: 3.47.0
typescript: 4.6.3
dev: true
/svelte/3.47.0:
resolution: {integrity: sha512-4JaJp3HEoTCGARRWZQIZDUanhYv0iyoHikklVHVLH9xFE9db22g4TDv7CPeNA8HD1JgjXI1vlhR1JZvvhaTu2Q==}
engines: {node: '>= 8'}
dev: true
/table/5.4.6: /table/5.4.6:
resolution: {integrity: sha512-wmEc8m4fjnob4gt5riFRtTu/6+4rSe12TpAELNSqHMfF3IqnA+CH37USM6/YR3qRZv7e56kAEAtd6nKZaxe0Ug==} resolution: {integrity: sha512-wmEc8m4fjnob4gt5riFRtTu/6+4rSe12TpAELNSqHMfF3IqnA+CH37USM6/YR3qRZv7e56kAEAtd6nKZaxe0Ug==}
engines: {node: '>=6.0.0'} engines: {node: '>=6.0.0'}
@@ -2045,14 +2188,14 @@ packages:
typescript: 3.9.10 typescript: 3.9.10
dev: true dev: true
/tsutils/3.21.0_typescript@4.4.4: /tsutils/3.21.0_typescript@4.6.3:
resolution: {integrity: sha512-mHKK3iUXL+3UF6xL5k0PEhKRUBKPBCv/+RkEOpjRWxxx27KKRBmmA60A9pgOUvMi8GKhRMPEmjBRPzs2W7O1OA==} resolution: {integrity: sha512-mHKK3iUXL+3UF6xL5k0PEhKRUBKPBCv/+RkEOpjRWxxx27KKRBmmA60A9pgOUvMi8GKhRMPEmjBRPzs2W7O1OA==}
engines: {node: '>= 6'} engines: {node: '>= 6'}
peerDependencies: peerDependencies:
typescript: '>=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta' typescript: '>=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta'
dependencies: dependencies:
tslib: 1.14.1 tslib: 1.14.1
typescript: 4.4.4 typescript: 4.6.3
dev: true dev: true
/type-check/0.4.0: /type-check/0.4.0:
@@ -2073,8 +2216,8 @@ packages:
hasBin: true hasBin: true
dev: true dev: true
/typescript/4.4.4: /typescript/4.6.3:
resolution: {integrity: sha512-DqGhF5IKoBl8WNf8C1gu8q0xZSInh9j1kJJMqT3a94w1JzVaBU4EXOSMrz9yDqMT0xt3selp83fuFMQ0uzv6qA==} resolution: {integrity: sha512-yNIatDa5iaofVozS/uQJEl3JRWLKKGJKh6Yaiv0GLGSuhpFJe7P3SbHZ8/yjAHRQwKRoA6YZqlfjXWmVzoVSMw==}
engines: {node: '>=4.2.0'} engines: {node: '>=4.2.0'}
hasBin: true hasBin: true
dev: true dev: true

11
src/Component.svelte Normal file
View File

@@ -0,0 +1,11 @@
<script lang="ts">
export let variable: number;
</script>
<div class="number"><span>My number is {variable}!</span></div>
<style>
.number {
color: red;
}
</style>

View File

@@ -1,11 +1,7 @@
import { Notice, Plugin, TAbstractFile, TFile } from 'obsidian' import { Notice, Plugin, TAbstractFile, TFile } from 'obsidian'
import MiniSearch from 'minisearch' import MiniSearch from 'minisearch'
import { import { clearContent, extractHeadingsFromCache, wait } from './utils'
clearContent, import type { IndexedNote } from './globals'
extractHeadingsFromCache,
wait,
} from './utils'
import { IndexedNote } from './globals'
import { OmnisearchModal } from './modal' import { OmnisearchModal } from './modal'
export default class OmnisearchPlugin extends Plugin { export default class OmnisearchPlugin extends Plugin {
@@ -108,9 +104,15 @@ export default class OmnisearchPlugin extends Plugin {
basename: file.basename, basename: file.basename,
content: tmp.innerText, content: tmp.innerText,
path: file.path, path: file.path,
headings1: fileCache ? extractHeadingsFromCache(fileCache, 1).join(' ') : '', headings1: fileCache
headings2: fileCache ? extractHeadingsFromCache(fileCache, 2).join(' ') : '', ? extractHeadingsFromCache(fileCache, 1).join(' ')
headings3: fileCache ? extractHeadingsFromCache(fileCache, 3).join(' ') : '', : '',
headings2: fileCache
? extractHeadingsFromCache(fileCache, 2).join(' ')
: '',
headings3: fileCache
? extractHeadingsFromCache(fileCache, 3).join(' ')
: '',
} }
this.minisearch.add(note) this.minisearch.add(note)
this.indexedNotes[file.path] = note this.indexedNotes[file.path] = note

View File

@@ -1,7 +1,8 @@
import { MarkdownView, SuggestModal, TFile } from 'obsidian' import { MarkdownView, SuggestModal, TFile } from 'obsidian'
import { ResultNote } from './globals' import type { ResultNote } from './globals'
import OmnisearchPlugin from './main' import type OmnisearchPlugin from './main'
import { escapeRegex, getAllIndexes, highlighter } from './utils' import { escapeRegex, getAllIndexes, highlighter } from './utils'
import Component from './Component.svelte'
export class OmnisearchModal extends SuggestModal<ResultNote> { export class OmnisearchModal extends SuggestModal<ResultNote> {
private plugin: OmnisearchPlugin private plugin: OmnisearchPlugin
@@ -64,7 +65,8 @@ export class OmnisearchModal extends SuggestModal<ResultNote> {
const record = events.find(event => const record = events.find(event =>
(event.target as HTMLDivElement).classList.contains('is-selected'), (event.target as HTMLDivElement).classList.contains('is-selected'),
) )
const id = (record?.target as HTMLElement)?.getAttribute('data-note-id') ?? null const id =
(record?.target as HTMLElement)?.getAttribute('data-note-id') ?? null
if (id) { if (id) {
this.selectedNoteId = id this.selectedNoteId = id
} }
@@ -160,6 +162,10 @@ export class OmnisearchModal extends SuggestModal<ResultNote> {
} }
renderSuggestion(value: ResultNote, el: HTMLElement): void { renderSuggestion(value: ResultNote, el: HTMLElement): void {
const component = new Component({
target: el,
props: { variable: 1 },
})
el.setAttribute('data-note-id', value.path) el.setAttribute('data-note-id', value.path)
el.addClass('omnisearch-result') el.addClass('omnisearch-result')

View File

@@ -1,9 +1,12 @@
{ {
"extends": "@tsconfig/svelte/tsconfig.json",
"compilerOptions": { "compilerOptions": {
"types": [
"svelte",
"node"
],
"strict": true, "strict": true,
"baseUrl": ".", "baseUrl": ".",
"inlineSourceMap": true,
"inlineSources": true,
"module": "ESNext", "module": "ESNext",
"target": "ES6", "target": "ES6",
"allowJs": true, "allowJs": true,
@@ -21,4 +24,4 @@
"include": [ "include": [
"**/*.ts" "**/*.ts"
] ]
} }