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