mirror of
https://seed.radicle.dev/rad:z4V1sjrXqjvFdnCUbxPFqd5p4DtH5.git
synced 2026-11-01 09:40:28 +08:00
Vendor onig WASM dependency
Instead of letting `starry-night` fetch the `vscode-oniguruma` WASM, we fetch it from the `node_modules` folder and do the same in the e2e tests. For this to work we need to update `starry-night` to version `1.5.0` Signed-off-by: Sebastian Martinez <me@sebastinez.dev>
This commit is contained in:
Generated
+4
-4
@@ -12,7 +12,7 @@
|
||||
"@radicle/gray-matter": "4.1.0",
|
||||
"@stardazed/streams": "^3.1.0",
|
||||
"@walletconnect/client": "^1.8.0",
|
||||
"@wooorm/starry-night": "^1.4.2",
|
||||
"@wooorm/starry-night": "^1.5.0",
|
||||
"buffer": "^6.0.3",
|
||||
"dompurify": "^2.4.1",
|
||||
"ethers": "^5.7.2",
|
||||
@@ -1784,9 +1784,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@wooorm/starry-night": {
|
||||
"version": "1.4.2",
|
||||
"resolved": "https://registry.npmjs.org/@wooorm/starry-night/-/starry-night-1.4.2.tgz",
|
||||
"integrity": "sha512-SkhIweiThgUK+KmvZPR2VCSnA1m0awTi/jPHey71MtR+jZG6phmcc9F9b0xpvxmHFFiKqxkgD/UKSVWVua+xrw==",
|
||||
"version": "1.5.0",
|
||||
"resolved": "https://registry.npmjs.org/@wooorm/starry-night/-/starry-night-1.5.0.tgz",
|
||||
"integrity": "sha512-YEkNgM8IxKwzRQgTp1nyiraB5rc4LiLpnMTrJvX5+SVs7zgVqkTx6QAZgZFqrZrqq/UCWVYBzE9+zZfxpLPTYQ==",
|
||||
"dependencies": {
|
||||
"@types/hast": "^2.0.0",
|
||||
"import-meta-resolve": "^2.0.0",
|
||||
|
||||
+1
-1
@@ -46,7 +46,7 @@
|
||||
"@radicle/gray-matter": "4.1.0",
|
||||
"@stardazed/streams": "^3.1.0",
|
||||
"@walletconnect/client": "^1.8.0",
|
||||
"@wooorm/starry-night": "^1.4.2",
|
||||
"@wooorm/starry-night": "^1.5.0",
|
||||
"buffer": "^6.0.3",
|
||||
"dompurify": "^2.4.1",
|
||||
"ethers": "^5.7.2",
|
||||
|
||||
+11
-8
@@ -1,14 +1,15 @@
|
||||
import type { Root } from "@wooorm/starry-night";
|
||||
import type { ElementContent } from "hast";
|
||||
|
||||
import { createStarryNight, common } from "@wooorm/starry-night";
|
||||
import sourceTsx from "@wooorm/starry-night/lang/source.tsx";
|
||||
import sourceSvelte from "@wooorm/starry-night/lang/source.svelte.js";
|
||||
import sourceSolidity from "@wooorm/starry-night/lang/source.solidity.js";
|
||||
import sourceToml from "@wooorm/starry-night/lang/source.toml";
|
||||
import sourceErlang from "@wooorm/starry-night/lang/source.erlang.js";
|
||||
import sourceDockerfile from "@wooorm/starry-night/lang/source.dockerfile";
|
||||
import onigurumaWASMUrl from "vscode-oniguruma/release/onig.wasm?url";
|
||||
import sourceAsciiDoc from "@wooorm/starry-night/lang/text.html.asciidoc";
|
||||
import sourceDockerfile from "@wooorm/starry-night/lang/source.dockerfile";
|
||||
import sourceErlang from "@wooorm/starry-night/lang/source.erlang.js";
|
||||
import sourceSolidity from "@wooorm/starry-night/lang/source.solidity.js";
|
||||
import sourceSvelte from "@wooorm/starry-night/lang/source.svelte.js";
|
||||
import sourceToml from "@wooorm/starry-night/lang/source.toml";
|
||||
import sourceTsx from "@wooorm/starry-night/lang/source.tsx";
|
||||
import { createStarryNight, common } from "@wooorm/starry-night";
|
||||
|
||||
export type MaybeHighlighted = Root | undefined;
|
||||
|
||||
@@ -37,7 +38,9 @@ export async function highlight(
|
||||
grammar: string,
|
||||
): Promise<MaybeHighlighted> {
|
||||
if (starryNight === undefined) {
|
||||
starryNight = await createStarryNight(grammars);
|
||||
starryNight = await createStarryNight(grammars, {
|
||||
getOnigurumaUrlFetch: () => new URL(onigurumaWASMUrl, import.meta.url),
|
||||
});
|
||||
}
|
||||
const scope = starryNight.flagToScope(grammar);
|
||||
return starryNight.highlight(content, scope ?? "text.raw");
|
||||
|
||||
@@ -83,13 +83,6 @@ export const test = base.extend<{
|
||||
status: 200,
|
||||
path: "./public/favicon.ico",
|
||||
});
|
||||
} else if (
|
||||
route.request().url().startsWith("https://esm.sh/vscode-oniguruma@1")
|
||||
) {
|
||||
route.fulfill({
|
||||
status: 200,
|
||||
path: "./tests/support/onig.wasm",
|
||||
});
|
||||
} else {
|
||||
log(
|
||||
`Aborted remote request: ${route.request().url()}`,
|
||||
|
||||
Binary file not shown.
Reference in New Issue
Block a user