Update to Svelte 5
This commit is contained in:
@@ -1,9 +1,8 @@
|
||||
import { build } from 'esbuild'
|
||||
import sveltePlugin from 'esbuild-svelte'
|
||||
import sveltePreprocess from 'svelte-preprocess'
|
||||
import { copy } from 'esbuild-plugin-copy'
|
||||
import esbuild from 'esbuild'
|
||||
import process from 'process'
|
||||
import builtins from 'builtin-modules'
|
||||
import esbuildSvelte from 'esbuild-svelte'
|
||||
import { sveltePreprocess } from 'svelte-preprocess'
|
||||
import path from 'path'
|
||||
|
||||
const banner = `/*
|
||||
@@ -14,7 +13,7 @@ if you want to view the source, please visit the github repository of this plugi
|
||||
|
||||
const prod = process.argv[2] === 'production'
|
||||
|
||||
build({
|
||||
const context = await esbuild.context({
|
||||
banner: {
|
||||
js: banner,
|
||||
},
|
||||
@@ -24,54 +23,36 @@ build({
|
||||
'obsidian',
|
||||
'electron',
|
||||
'@codemirror/autocomplete',
|
||||
'@codemirror/closebrackets',
|
||||
'@codemirror/collab',
|
||||
'@codemirror/commands',
|
||||
'@codemirror/comment',
|
||||
'@codemirror/fold',
|
||||
'@codemirror/gutter',
|
||||
'@codemirror/highlight',
|
||||
'@codemirror/history',
|
||||
'@codemirror/language',
|
||||
'@codemirror/lint',
|
||||
'@codemirror/matchbrackets',
|
||||
'@codemirror/panel',
|
||||
'@codemirror/rangeset',
|
||||
'@codemirror/rectangular-selection',
|
||||
'@codemirror/search',
|
||||
'@codemirror/state',
|
||||
'@codemirror/stream-parser',
|
||||
'@codemirror/text',
|
||||
'@codemirror/tooltip',
|
||||
'@codemirror/view',
|
||||
'@lezer/common',
|
||||
'@lezer/highlight',
|
||||
'@lezer/lr',
|
||||
...builtins,
|
||||
],
|
||||
outfile: path.join('./dist', 'main.js'),
|
||||
plugins: [
|
||||
sveltePlugin({
|
||||
esbuildSvelte({
|
||||
compilerOptions: { css: 'injected' },
|
||||
preprocess: sveltePreprocess(),
|
||||
}),
|
||||
copy({
|
||||
assets: {
|
||||
from: ['./assets/styles.css', 'manifest.json'],
|
||||
to: ['./'],
|
||||
},
|
||||
}),
|
||||
{
|
||||
name: 'resolve-minisearch',
|
||||
setup(build) {
|
||||
build.onResolve({ filter: /^minisearch$/ }, () => {
|
||||
return { path: path.resolve('node_modules/minisearch/src/MiniSearch.ts') };
|
||||
});
|
||||
},
|
||||
},
|
||||
],
|
||||
format: 'cjs',
|
||||
watch: !prod,
|
||||
target: 'chrome98',
|
||||
logLevel: 'info',
|
||||
sourcemap: prod ? false : 'inline',
|
||||
treeShaking: true,
|
||||
minify: prod,
|
||||
legalComments: 'none',
|
||||
}).catch(() => process.exit(1))
|
||||
})
|
||||
|
||||
if (prod) {
|
||||
await context.rebuild()
|
||||
process.exit(0)
|
||||
} else {
|
||||
await context.watch()
|
||||
}
|
||||
|
||||
15
package.json
15
package.json
@@ -24,19 +24,19 @@
|
||||
"@types/pako": "^2.0.3",
|
||||
"babel-jest": "^27.5.1",
|
||||
"builtin-modules": "^3.3.0",
|
||||
"esbuild": "0.14.0",
|
||||
"esbuild": "0.17.19",
|
||||
"esbuild-plugin-copy": "1.3.0",
|
||||
"esbuild-svelte": "0.7.1",
|
||||
"esbuild-svelte": "^0.9.2",
|
||||
"jest": "^27.5.1",
|
||||
"obsidian": "1.7.2",
|
||||
"prettier": "^2.8.8",
|
||||
"prettier-plugin-svelte": "^2.10.1",
|
||||
"svelte": "^3.59.2",
|
||||
"svelte-check": "^2.10.3",
|
||||
"svelte": "^5.23.2",
|
||||
"svelte-check": "^4.1.5",
|
||||
"svelte-jester": "^2.3.2",
|
||||
"svelte-preprocess": "^4.10.7",
|
||||
"svelte-preprocess": "^6.0.3",
|
||||
"tslib": "2.3.1",
|
||||
"typescript": "^4.9.5",
|
||||
"typescript": "^5.8.2",
|
||||
"vite": "^3.2.11"
|
||||
},
|
||||
"dependencies": {
|
||||
@@ -46,7 +46,8 @@
|
||||
"markdown-link-extractor": "^4.0.2",
|
||||
"minisearch": "7.1.0",
|
||||
"pure-md5": "^0.1.14",
|
||||
"search-query-parser": "^1.6.0"
|
||||
"search-query-parser": "^1.6.0",
|
||||
"svelte-multiselect": "github:janosh/svelte-multiselect"
|
||||
},
|
||||
"pnpm": {
|
||||
"overrides": {
|
||||
|
||||
824
pnpm-lock.yaml
generated
824
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
@@ -53,7 +53,7 @@ export default class OmnisearchPlugin extends Plugin {
|
||||
public readonly searchHistory = new SearchHistory(this)
|
||||
|
||||
private ribbonButton?: HTMLElement
|
||||
private refreshIndexCallback?: () => void
|
||||
private refreshIndexCallback?: (ev: FocusEvent) => any
|
||||
|
||||
constructor(app: App, manifest: PluginManifest) {
|
||||
super(app, manifest)
|
||||
@@ -160,7 +160,7 @@ export default class OmnisearchPlugin extends Plugin {
|
||||
this.refreshIndexCallback = this.notesIndexer.refreshIndex.bind(
|
||||
this.notesIndexer
|
||||
)
|
||||
addEventListener('blur', this.refreshIndexCallback)
|
||||
addEventListener('blur', this.refreshIndexCallback!)
|
||||
removeEventListener
|
||||
|
||||
await this.executeFirstLaunchTasks()
|
||||
|
||||
@@ -1,31 +1,27 @@
|
||||
{
|
||||
"extends": "@tsconfig/svelte/tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"types": [
|
||||
"svelte",
|
||||
"node",
|
||||
"jest"
|
||||
],
|
||||
"strict": true,
|
||||
"noUncheckedIndexedAccess": false,
|
||||
"verbatimModuleSyntax": true,
|
||||
"skipLibCheck": true,
|
||||
"baseUrl": ".",
|
||||
"inlineSourceMap": true,
|
||||
"inlineSources": true,
|
||||
"module": "ESNext",
|
||||
"target": "ES2021",
|
||||
"allowJs": true,
|
||||
"noImplicitAny": true,
|
||||
"moduleResolution": "node",
|
||||
"importHelpers": true,
|
||||
"resolveJsonModule": true,
|
||||
"allowSyntheticDefaultImports": true,
|
||||
"isolatedModules": true,
|
||||
"strictNullChecks": true,
|
||||
"lib": [
|
||||
"DOM",
|
||||
"ES2021"
|
||||
],
|
||||
"paths": {
|
||||
"minisearch": ["node_modules/minisearch/src/MiniSearch.ts"]
|
||||
}
|
||||
]
|
||||
},
|
||||
"include": [
|
||||
"**/*.ts",
|
||||
"src/__tests__/event-bus-tests.mts"
|
||||
"**/*.svelte"
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user