refactor/deps(frontend): shikiのdeprecated表現を修正 (#15169)

* fix(frontend): shikiのdeprecated表現を修正

* update aiscript-vscode

* ✌️

* fix

* remove unused imports

* bump aiscript-vscode to 0.1.15
This commit is contained in:
かっこかり 2025-01-11 22:47:15 +09:00 committed by GitHub
parent c4192e81ed
commit d60c307c4e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 14 additions and 14 deletions

View file

@ -29,7 +29,7 @@
"@twemoji/parser": "15.1.1", "@twemoji/parser": "15.1.1",
"@vitejs/plugin-vue": "5.2.0", "@vitejs/plugin-vue": "5.2.0",
"@vue/compiler-sfc": "3.5.12", "@vue/compiler-sfc": "3.5.12",
"aiscript-vscode": "github:aiscript-dev/aiscript-vscode#v0.1.11", "aiscript-vscode": "github:aiscript-dev/aiscript-vscode#v0.1.15",
"astring": "1.9.0", "astring": "1.9.0",
"broadcast-channel": "7.0.0", "broadcast-channel": "7.0.0",
"buraha": "0.0.1", "buraha": "0.0.1",

View file

@ -3,7 +3,8 @@
* SPDX-License-Identifier: AGPL-3.0-only * SPDX-License-Identifier: AGPL-3.0-only
*/ */
import { createHighlighterCore, loadWasm } from 'shiki/core'; import { createHighlighterCore } from 'shiki/core';
import { createOnigurumaEngine } from 'shiki/engine/oniguruma';
import darkPlus from 'shiki/themes/dark-plus.mjs'; import darkPlus from 'shiki/themes/dark-plus.mjs';
import { bundledThemesInfo } from 'shiki/themes'; import { bundledThemesInfo } from 'shiki/themes';
import { bundledLanguagesInfo } from 'shiki/langs'; import { bundledLanguagesInfo } from 'shiki/langs';
@ -60,8 +61,6 @@ export async function getHighlighter(): Promise<HighlighterCore> {
} }
async function initHighlighter() { async function initHighlighter() {
await loadWasm(import('shiki/onig.wasm?init'));
// テーマの重複を消す // テーマの重複を消す
const themes = unique([ const themes = unique([
darkPlus, darkPlus,
@ -70,6 +69,7 @@ async function initHighlighter() {
const jsLangInfo = bundledLanguagesInfo.find(t => t.id === 'javascript'); const jsLangInfo = bundledLanguagesInfo.find(t => t.id === 'javascript');
const highlighter = await createHighlighterCore({ const highlighter = await createHighlighterCore({
engine: createOnigurumaEngine(() => import('shiki/onig.wasm?init')),
themes, themes,
langs: [ langs: [
...(jsLangInfo ? [async () => await jsLangInfo.import()] : []), ...(jsLangInfo ? [async () => await jsLangInfo.import()] : []),

View file

@ -7,10 +7,10 @@ import { deepClone } from './clone.js';
import type { Cloneable } from './clone.js'; import type { Cloneable } from './clone.js';
export type DeepPartial<T> = { export type DeepPartial<T> = {
[P in keyof T]?: T[P] extends Record<string | number | symbol, unknown> ? DeepPartial<T[P]> : T[P]; [P in keyof T]?: T[P] extends Record<PropertyKey, unknown> ? DeepPartial<T[P]> : T[P];
}; };
function isPureObject(value: unknown): value is Record<string | number | symbol, unknown> { function isPureObject(value: unknown): value is Record<PropertyKey, unknown> {
return typeof value === 'object' && value !== null && !Array.isArray(value); return typeof value === 'object' && value !== null && !Array.isArray(value);
} }
@ -18,14 +18,14 @@ function isPureObject(value: unknown): value is Record<string | number | symbol,
* valueにないキーをdefからもらう\ * valueにないキーをdefからもらう\
* nullはそのままundefinedはdefの値 * nullはそのままundefinedはdefの値
**/ **/
export function deepMerge<X extends Record<string | number | symbol, unknown>>(value: DeepPartial<X>, def: X): X { export function deepMerge<X extends Record<PropertyKey, unknown>>(value: DeepPartial<X>, def: X): X {
if (isPureObject(value) && isPureObject(def)) { if (isPureObject(value) && isPureObject(def)) {
const result = deepClone(value as Cloneable) as X; const result = deepClone(value as Cloneable) as X;
for (const [k, v] of Object.entries(def) as [keyof X, X[keyof X]][]) { for (const [k, v] of Object.entries(def) as [keyof X, X[keyof X]][]) {
if (!Object.prototype.hasOwnProperty.call(value, k) || value[k] === undefined) { if (!Object.prototype.hasOwnProperty.call(value, k) || value[k] === undefined) {
result[k] = v; result[k] = v;
} else if (isPureObject(v) && isPureObject(result[k])) { } else if (isPureObject(v) && isPureObject(result[k])) {
const child = deepClone(result[k] as Cloneable) as DeepPartial<X[keyof X] & Record<string | number | symbol, unknown>>; const child = deepClone(result[k] as Cloneable) as DeepPartial<X[keyof X] & Record<PropertyKey, unknown>>;
result[k] = deepMerge<typeof v>(child, v); result[k] = deepMerge<typeof v>(child, v);
} }
} }

View file

@ -728,8 +728,8 @@ importers:
specifier: 3.5.12 specifier: 3.5.12
version: 3.5.12 version: 3.5.12
aiscript-vscode: aiscript-vscode:
specifier: github:aiscript-dev/aiscript-vscode#v0.1.11 specifier: github:aiscript-dev/aiscript-vscode#v0.1.15
version: https://codeload.github.com/aiscript-dev/aiscript-vscode/tar.gz/e1e1b27f2f72cd28a473e004b6da0d8fc0bd40d9 version: https://codeload.github.com/aiscript-dev/aiscript-vscode/tar.gz/c3cde89e79a41d93540cf8a48cd619c3f2dcb1b7
astring: astring:
specifier: 1.9.0 specifier: 1.9.0
version: 1.9.0 version: 1.9.0
@ -4938,9 +4938,9 @@ packages:
resolution: {integrity: sha512-gOsf2YwSlleG6IjRYG2A7k0HmBMEo6qVNk9Bp/EaLgAJT5ngH6PXbqa4ItvnEwCm/velL5jAnQgsHsWnjhGmvw==} resolution: {integrity: sha512-gOsf2YwSlleG6IjRYG2A7k0HmBMEo6qVNk9Bp/EaLgAJT5ngH6PXbqa4ItvnEwCm/velL5jAnQgsHsWnjhGmvw==}
engines: {node: '>=18'} engines: {node: '>=18'}
aiscript-vscode@https://codeload.github.com/aiscript-dev/aiscript-vscode/tar.gz/e1e1b27f2f72cd28a473e004b6da0d8fc0bd40d9: aiscript-vscode@https://codeload.github.com/aiscript-dev/aiscript-vscode/tar.gz/c3cde89e79a41d93540cf8a48cd619c3f2dcb1b7:
resolution: {tarball: https://codeload.github.com/aiscript-dev/aiscript-vscode/tar.gz/e1e1b27f2f72cd28a473e004b6da0d8fc0bd40d9} resolution: {tarball: https://codeload.github.com/aiscript-dev/aiscript-vscode/tar.gz/c3cde89e79a41d93540cf8a48cd619c3f2dcb1b7}
version: 0.1.11 version: 0.1.15
engines: {vscode: ^1.83.0} engines: {vscode: ^1.83.0}
ajv-draft-04@1.0.0: ajv-draft-04@1.0.0:
@ -15664,7 +15664,7 @@ snapshots:
clean-stack: 5.2.0 clean-stack: 5.2.0
indent-string: 5.0.0 indent-string: 5.0.0
aiscript-vscode@https://codeload.github.com/aiscript-dev/aiscript-vscode/tar.gz/e1e1b27f2f72cd28a473e004b6da0d8fc0bd40d9: aiscript-vscode@https://codeload.github.com/aiscript-dev/aiscript-vscode/tar.gz/c3cde89e79a41d93540cf8a48cd619c3f2dcb1b7:
dependencies: dependencies:
'@aiscript-dev/aiscript-languageserver': https://github.com/aiscript-dev/aiscript-languageserver/releases/download/0.1.6/aiscript-dev-aiscript-languageserver-0.1.6.tgz '@aiscript-dev/aiscript-languageserver': https://github.com/aiscript-dev/aiscript-languageserver/releases/download/0.1.6/aiscript-dev-aiscript-languageserver-0.1.6.tgz
vscode-languageclient: 9.0.1 vscode-languageclient: 9.0.1