MCPcopy
hub / github.com/freshframework/fresh / parseDenoSpecifier

Function parseDenoSpecifier

packages/plugin-vite/src/plugins/deno.ts:329–353  ·  view source on GitHub ↗
(
  spec: DenoSpecifier,
)

Source from the content-addressed store, hash-verified

327}
328
329function parseDenoSpecifier(
330 spec: DenoSpecifier,
331): { type: RequestedModuleType; specifier: string } {
332 const match = spec.match(/^\0deno::([^:]+)::(.*)$/)!;
333
334 let specifier = match[2];
335
336 const specMatch = specifier.match(/^(\w+):\/([^/].*)$/);
337 if (specMatch !== null) {
338 const protocol = specMatch[1];
339
340 let rest = specMatch[2];
341 if (protocol === "file") {
342 rest = "/" + rest;
343 }
344
345 specifier = `${protocol}://${rest}`;
346 }
347
348 if (path.isAbsolute(specifier)) {
349 specifier = path.toFileUrl(specifier).href;
350 }
351
352 return { type: +match[1], specifier };
353}
354
355function getDenoType(id: string, type: string): RequestedModuleType {
356 switch (type) {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected