Remove compile workarounds in upstream specs

Part of #242795
This commit is contained in:
Daniel Imms
2025-03-08 06:51:01 -08:00
parent 1073944dfc
commit 6c1afa4f7d
8 changed files with 24 additions and 77 deletions

View File

@@ -24,73 +24,14 @@ const specSpecificReplaceStrings = new Map([
[
'import { ai } from "@fig/autocomplete-generators";',
'function ai(...args: any[]): undefined { return undefined; }'
], [
'const remoteURLs = out.split("\\n").reduce((dict, line) => {',
'const remoteURLs = out.split("\\n").reduce<Record<string, string>>((dict, line) => {',
], [
'prompt: async ({ executeCommand }) => {',
'prompt: async ({ executeCommand }: any) => {'
], [
'message: async ({ executeCommand }) =>',
'message: async ({ executeCommand }: any) =>'
], [
'if (parts.length > 1) {',
'if (parts && parts.length > 1) {'
], [
'if (seen.has(suggestion.name)) return false;',
'if (!suggestion) return false;\n\t\t\t\tif (seen.has(suggestion.name)) return false;'
], [
'return pp(',
'return pp?.('
]
]],
['kill', [[
'out.match(/\\w+/g)',
'out.match(/\\w+/g)?'
]]],
['node', [[
'const isAdonisJsonPresentCommand = "test -f .adonisrc.json";',
''
]]],
['npm', [
[
'keywords?.length > 0 ? `+keywords:${keywords.join(",")}` : "";',
'keywords && keywords.length > 0 ? `+keywords:${keywords.join(",")}` : "";'
], [
'return results.map((item) => ({',
'return results.map((item: any) => ({'
], [
'const suggestions = [];',
'const suggestions: Fig.Suggestion[] = [];'
]
]],
['nvm', [[
'const pattern: Fig.Arg = {\n\tname: "pattern",\n};',
''
]]],
['pnpm', [
[
'if (parts.length > 1) {',
'if (parts && parts.length > 1) {'
], [
'const packages = postProcess(',
'if (postProcess === undefined) return undefined;\n\t\tconst packages = postProcess('
], [
').map(({ name }) => name as string);',
')?.filter((e) => e !== null).map(({ name }) => name as string);'
], [
'.filter((name) => nodeClis.has(name))',
'?.filter((name) => nodeClis.has(name))'
]
]],
['ssh', [[
'const includeLines = await Promise.all(',
'const includeLines: any = await Promise.all('
]]],
['yarn', [[
'(item) =>',
'(item: any) =>'
]]],
]);
for (const spec of upstreamSpecs) {