MCPcopy Create free account
hub / github.com/TanStack/cli / loadRemoteAddOn

Function loadRemoteAddOn

packages/create/src/edge-add-ons.ts:76–96  ·  view source on GitHub ↗
(url: string)

Source from the content-addressed store, hash-verified

74}
75
76export async function loadRemoteAddOn(url: string): Promise<AddOn> {
77 const response = await fetch(url)
78 const jsonContent = await response.json()
79 const checked = AddOnCompiledSchema.safeParse(jsonContent)
80
81 if (!checked.success) {
82 throw new Error(`Invalid add-on: ${url}`)
83 }
84
85 const addOn = {
86 ...checked.data,
87 id: url,
88 }
89
90 return {
91 ...addOn,
92 getFiles: () => Promise.resolve(Object.keys(addOn.files)),
93 getFileContents: (path: string) => Promise.resolve(addOn.files[path]),
94 getDeletedFiles: () => Promise.resolve(addOn.deletedFiles),
95 }
96}
97
98function findClosestAddOn(
99 input: string,

Callers 3

finalizeAddOnsFunction · 0.70
getAddOnsFunction · 0.70
finalizeAddOnsFunction · 0.70

Calls 1

jsonMethod · 0.80

Tested by

no test coverage detected