MCPcopy
hub / github.com/FredKSchott/snowpack / getPackageSource

Function getPackageSource

snowpack/src/sources/util.ts:25–43  ·  view source on GitHub ↗
(config: SnowpackConfig)

Source from the content-addressed store, hash-verified

23const localSourceCache = new WeakMap<SnowpackConfig, PackageSource>();
24
25export function getPackageSource(config: SnowpackConfig): PackageSource {
26 if (config.packageOptions.source === 'remote') {
27 if (remoteSourceCache.has(config)) {
28 return remoteSourceCache.get(config)!;
29 }
30
31 const source = new PackageSourceRemote(config);
32 remoteSourceCache.set(config, source);
33 return source;
34 }
35
36 if (localSourceCache.has(config)) {
37 return localSourceCache.get(config)!;
38 }
39
40 const source = new PackageSourceLocal(config);
41 localSourceCache.set(config, source);
42 return source;
43}

Callers 5

preparePackagesFunction · 0.90
addCommandFunction · 0.90
rmCommandFunction · 0.90
commandFunction · 0.90
startServerFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected