Skip to content

Commit

Permalink
update deps
Browse files Browse the repository at this point in the history
  • Loading branch information
mProjectsCode committed Dec 4, 2024
1 parent 1952cce commit 3cf09c8
Show file tree
Hide file tree
Showing 16 changed files with 57 additions and 88 deletions.
14 changes: 7 additions & 7 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ labels: bug
assignees: ''
---

- [ ] The Plugin is up to date
- [ ] Obsidian is up to date
- [ ] The Plugin is up to date
- [ ] Obsidian is up to date

**Describe the bug**
A clear and concise description of what the bug is.
Expand All @@ -28,11 +28,11 @@ If applicable, add screenshots to help explain your problem.

**Occurs on**

- [ ] Windows
- [ ] macOS
- [ ] Linux
- [ ] Android
- [ ] iOS
- [ ] Windows
- [ ] macOS
- [ ] Linux
- [ ] Android
- [ ] iOS

**Plugin version**
x.x.x
Expand Down
6 changes: 1 addition & 5 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
{
"plugins": ["prettier-plugin-svelte"],

"printWidth": 160,
"useTabs": true,
"tabWidth": 4,
"semi": true,
"singleQuote": true,
"arrowParens": "avoid",

"svelteAllowShorthand": false
"arrowParens": "avoid"
}
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,5 +119,5 @@ This plugin uses [shiki](https://shiki.style/), [Expressive Code](https://expres

Special thanks to:

- Hippo (hippotastic) for their work and support with Expressive Code
- sailKite for CSS help and testing the plugin
- Hippo (hippotastic) for their work and support with Expressive Code
- sailKite for CSS help and testing the plugin
10 changes: 0 additions & 10 deletions automation/build/esbuild.config.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import builtins from 'builtin-modules';
import esbuild from 'esbuild';
import esbuildSvelte from 'esbuild-svelte';
import sveltePreprocess from 'svelte-preprocess';
import { getBuildBanner } from 'build/buildBanner';
import { nodeModulesPolyfillPlugin } from 'esbuild-plugins-node-modules-polyfill';

Expand Down Expand Up @@ -41,14 +39,6 @@ const build = await esbuild.build({
MB_GLOBAL_CONFIG_DEV_BUILD: 'false',
},
plugins: [
esbuildSvelte({
compilerOptions: { css: 'injected', dev: false, sveltePath: 'svelte' },
preprocess: sveltePreprocess(),
filterWarnings: warning => {
// we don't want warnings from node modules that we can do nothing about
return !warning.filename?.includes('node_modules');
},
}),
nodeModulesPolyfillPlugin({
modules: {
fs: true,
Expand Down
10 changes: 0 additions & 10 deletions automation/build/esbuild.dev.config.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import esbuild from 'esbuild';
import copy from 'esbuild-plugin-copy-watch';
import esbuildSvelte from 'esbuild-svelte';
import sveltePreprocess from 'svelte-preprocess';
import manifest from '../../manifest.json' assert { type: 'json' };
import { getBuildBanner } from 'build/buildBanner';
import { nodeModulesPolyfillPlugin } from 'esbuild-plugins-node-modules-polyfill';
Expand Down Expand Up @@ -52,14 +50,6 @@ const context = await esbuild.context({
},
],
}),
esbuildSvelte({
compilerOptions: { css: 'injected', dev: true, sveltePath: 'svelte' },
preprocess: sveltePreprocess(),
filterWarnings: warning => {
// we don't want warnings from node modules that we can do nothing about
return !warning.filename?.includes('node_modules');
},
}),
nodeModulesPolyfillPlugin({
modules: {
fs: true,
Expand Down
Binary file modified bun.lockb
Binary file not shown.
2 changes: 1 addition & 1 deletion exampleVault/customLanguages/odin.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"comment": "Taken from https://github.com/DanielGavin/ols. Modification of https://github.com/fivemoreminix/odin-vscode",
"$schema": "https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json",
"name": "Odin",
"name": "custom-odin",
"patterns": [
{ "include": "#file-tags" },
{ "include": "#package-name-declaration" },
Expand Down
2 changes: 1 addition & 1 deletion exampleVault/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ Inline code
`{jsx} <button role="button" />`
```Odin
```custom-odin
package main
import "core:fmt"
Expand Down
52 changes: 23 additions & 29 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,55 +9,49 @@
"tsc": "tsc -noEmit -skipLibCheck",
"test": "bun test",
"test:log": "LOG_TESTS=true bun test",
"format": "prettier --write --plugin prettier-plugin-svelte .",
"format:check": "prettier --check --plugin prettier-plugin-svelte .",
"format": "prettier --write .",
"format:check": "prettier --check .",
"lint": "eslint --max-warnings=0 src/**",
"lint:fix": "eslint --max-warnings=0 --fix src/**",
"svelte-check": "svelte-check --compiler-warnings \"unused-export-let:ignore\"",
"check": "bun run format:check && bun run tsc && bun run svelte-check && bun run lint && bun run test",
"check:fix": "bun run format && bun run tsc && bun run svelte-check && bun run lint:fix && bun run test",
"check": "bun run format:check && bun run tsc && bun run lint && bun run test",
"check:fix": "bun run format && bun run tsc && bun run lint:fix && bun run test",
"release": "bun run automation/release.ts",
"stats": "bun run automation/stats.ts"
},
"keywords": [],
"author": "Moritz Jung",
"license": "MIT",
"devDependencies": {
"@codemirror/language": "^6.10.2",
"@codemirror/language": "^6.10.6",
"@codemirror/state": "^6.4.1",
"@codemirror/view": "^6.28.4",
"@eslint/js": "^9.6.0",
"@expressive-code/core": "^0.35.3",
"@expressive-code/plugin-collapsible-sections": "^0.35.3",
"@expressive-code/plugin-frames": "^0.35.3",
"@expressive-code/plugin-line-numbers": "^0.35.3",
"@expressive-code/plugin-shiki": "^0.35.3",
"@expressive-code/plugin-text-markers": "^0.35.3",
"@codemirror/view": "^6.35.0",
"@eslint/js": "^9.16.0",
"@expressive-code/core": "^0.38.3",
"@expressive-code/plugin-collapsible-sections": "^0.38.3",
"@expressive-code/plugin-frames": "^0.38.3",
"@expressive-code/plugin-line-numbers": "^0.38.3",
"@expressive-code/plugin-shiki": "^0.38.3",
"@expressive-code/plugin-text-markers": "^0.38.3",
"@happy-dom/global-registrator": "^14.12.3",
"@lemons_dev/parsinom": "^0.0.12",
"@lezer/common": "^1.2.1",
"@lezer/common": "^1.2.3",
"@tsconfig/svelte": "^5.0.4",
"@types/bun": "^1.1.6",
"@types/bun": "^1.1.14",
"@types/eslint__js": "^8.42.3",
"builtin-modules": "^4.0.0",
"esbuild": "^0.23.0",
"esbuild": "^0.24.0",
"esbuild-plugin-copy-watch": "^2.3.1",
"esbuild-plugins-node-modules-polyfill": "^1.6.4",
"esbuild-svelte": "^0.8.1",
"eslint": "^9.6.0",
"esbuild-plugins-node-modules-polyfill": "^1.6.8",
"eslint": "^9.16.0",
"eslint-plugin-no-relative-import-paths": "^1.5.5",
"eslint-plugin-only-warn": "^1.1.0",
"itertools-ts": "^1.27.1",
"obsidian": "latest",
"prettier": "^3.3.2",
"prettier-plugin-svelte": "^3.2.5",
"shiki": "^1.1.7",
"prettier": "^3.4.2",
"shiki": "^1.24.0",
"string-argv": "^0.3.2",
"svelte": "^4.2.18",
"svelte-check": "^3.8.4",
"svelte-preprocess": "^6.0.2",
"tslib": "^2.6.3",
"typescript": "^5.5.3",
"typescript-eslint": "^7.16.0"
"tslib": "^2.8.1",
"typescript": "^5.7.2",
"typescript-eslint": "^8.17.0"
}
}
1 change: 1 addition & 0 deletions src/Highlighter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,7 @@ export class CodeHighlighter {
*/
obsidianSafeLanguageNames(): string[] {
return this.loadedLanguages.filter(lang => !languageNameBlacklist.has(lang) && !this.plugin.loadedSettings.disabledLanguages.includes(lang));
// .concat(this.customLanguages.map(lang => lang.name));
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/codemirror/Cm6_ViewPlugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ export function createCm6Plugin(plugin: ShikiPlugin) {
if (props.has('HyperMD-codeblock-begin')) {
const content = Cm6_Util.getContent(view.state, node.from, node.to);

lang = content.match(/^```(\S+)/)?.[1] ?? '';
lang = (/^```(\S+)/.exec(content))?.[1] ?? '';
}

if (props.has('HyperMD-codeblock-end')) {
Expand Down
6 changes: 4 additions & 2 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,9 @@ export default class ShikiPlugin extends Plugin {
}

registerCodeBlockProcessors(): void {
for (const language of this.highlighter.obsidianSafeLanguageNames()) {
const languages = this.highlighter.obsidianSafeLanguageNames();

for (const language of languages) {
try {
this.registerMarkdownCodeBlockProcessor(
language,
Expand Down Expand Up @@ -107,7 +109,7 @@ export default class ShikiPlugin extends Plugin {
1000,
);
} catch (e) {
console.warn(`Failed to register code block processor for ${language}`, e);
console.warn(`Failed to register code block processor for ${language}.`, e);
}
}
}
Expand Down
8 changes: 4 additions & 4 deletions src/themes/ECTheme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,17 @@ export function getECTheme(settings: Settings): ExpressiveCodeEngineConfig['styl
const useThemeColors = settings.preferThemeColors && settings.theme !== 'obsidian-theme';

const backgroundColor: UnresolvedStyleValue = ({ theme }: { theme: ExpressiveCodeTheme }): StyleValueOrValues =>
useThemeColors ? theme.colors['editor.background'] ?? 'var(--shiki-code-background)' : 'var(--shiki-code-background)';
useThemeColors ? (theme.colors['editor.background'] ?? 'var(--shiki-code-background)') : 'var(--shiki-code-background)';
const foregroundColor: UnresolvedStyleValue = ({ theme }: { theme: ExpressiveCodeTheme }): StyleValueOrValues =>
theme.colors['editor.foreground'] ?? 'var(--shiki-code-normal)';

const gutterBorderColor: UnresolvedStyleValue = ({ theme }: { theme: ExpressiveCodeTheme }): StyleValueOrValues =>
useThemeColors ? theme.colors['editorLineNumber.foreground'] ?? 'var(--shiki-gutter-border-color)' : 'var(--shiki-gutter-border-color)';
useThemeColors ? (theme.colors['editorLineNumber.foreground'] ?? 'var(--shiki-gutter-border-color)') : 'var(--shiki-gutter-border-color)';
const gutterTextColor: UnresolvedStyleValue = ({ theme }: { theme: ExpressiveCodeTheme }): StyleValueOrValues =>
useThemeColors ? theme.colors['editorLineNumber.foreground'] ?? 'var(--shiki-gutter-text-color)' : 'var(--shiki-gutter-text-color)';
useThemeColors ? (theme.colors['editorLineNumber.foreground'] ?? 'var(--shiki-gutter-text-color)') : 'var(--shiki-gutter-text-color)';
const gutterTextActiveColor: UnresolvedStyleValue = ({ theme }: { theme: ExpressiveCodeTheme }): StyleValueOrValues =>
useThemeColors
? (theme.colors['editorLineNumber.activeForeground'] || theme.colors['editorLineNumber.foreground']) ?? 'var(--shiki-gutter-text-color-highlight)'
? ((theme.colors['editorLineNumber.activeForeground'] || theme.colors['editorLineNumber.foreground']) ?? 'var(--shiki-gutter-text-color-highlight)')
: 'var(--shiki-gutter-text-color-highlight)';

return {
Expand Down
3 changes: 1 addition & 2 deletions src/themes/ThemeMapper.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { type BundledTheme, bundledThemes, type ThemeRegistration } from 'shiki';
import type * as hast_util_to_html_lib_types from 'hast-util-to-html/lib';
import type * as hast_types from 'hast';
import { OBSIDIAN_THEME } from 'src/themes/ObsidianTheme';
import type ShikiPlugin from 'src/main';
Expand Down Expand Up @@ -71,7 +70,7 @@ export class ThemeMapper {
/**
* Maps the placeholder colors in the AST to CSS variables.
*/
fixAST(ast: hast_util_to_html_lib_types.Parents): hast_util_to_html_lib_types.Parents {
fixAST(ast: hast_types.Parents): hast_types.Parents {
if (this.plugin.loadedSettings.theme !== 'obsidian-theme') {
return ast;
}
Expand Down
24 changes: 11 additions & 13 deletions tests/svelteLoader.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
import { plugin } from 'bun';
import sveltePreprocess from 'svelte-preprocess';
import esbuildSvelte from 'esbuild-svelte';

plugin(
// @ts-ignore
esbuildSvelte({
compilerOptions: { css: 'injected' },
preprocess: sveltePreprocess(),
filterWarnings: warning => {
// we don't want warnings from node modules that we can do nothing about
return !warning.filename?.includes('node_modules');
},
}),
);
// plugin(
// // @ts-ignore
// // esbuildSvelte({
// // compilerOptions: { css: 'injected' },
// // preprocess: sveltePreprocess(),
// // filterWarnings: warning => {
// // // we don't want warnings from node modules that we can do nothing about
// // return !warning.filename?.includes('node_modules');
// // },
// // }),
// );
1 change: 0 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
"importHelpers": true,
"isolatedModules": true,
"lib": ["DOM", "ESNext"],
"types": ["svelte"],
"allowSyntheticDefaultImports": true
},
"include": ["src/**/*.ts", "tests/**/*.ts"]
Expand Down

0 comments on commit 3cf09c8

Please sign in to comment.