From 9bc2165e5c14454f60f7c44d46e9481b0909d1d4 Mon Sep 17 00:00:00 2001 From: Kit Langton Date: Fri, 28 Aug 2026 13:26:04 -0400 Subject: [PATCH] refactor(core): reuse lazy shell parser initialization (#45651) --- packages/core/src/shell/parse.ts | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/packages/core/src/shell/parse.ts b/packages/core/src/shell/parse.ts index 5f68468b04c..70d2aa467aa 100644 --- a/packages/core/src/shell/parse.ts +++ b/packages/core/src/shell/parse.ts @@ -7,6 +7,7 @@ import path from "path" import type { Node } from "web-tree-sitter" import { shellParserWasm } from "#shell-parser-wasm" import { ShellSelect } from "./select.js" +import { lazy } from "../util/lazy.js" import { Wildcard } from "../util/wildcard.js" type Part = { type: string; text: string } @@ -355,10 +356,7 @@ function resolve(asset: string) { return fileURLToPath(new URL(asset, import.meta.url)) } -const load = (() => { - let loading: ReturnType | undefined - return () => (loading ??= initialize()) -})() +const load = lazy(initialize) async function initialize() { const { Parser, Language } = await import("web-tree-sitter")