MCPcopy
hub / github.com/stenciljs/core / runPluginLoad

Function runPluginLoad

src/compiler/plugin/plugin.ts:34–58  ·  view source on GitHub ↗
(pluginCtx: PluginCtx, id: string)

Source from the content-addressed store, hash-verified

32};
33
34export const runPluginLoad = async (pluginCtx: PluginCtx, id: string) => {
35 for (const plugin of pluginCtx.config?.plugins ?? []) {
36 if (isFunction(plugin.load)) {
37 try {
38 const results = plugin.load(id, pluginCtx);
39
40 if (results != null) {
41 if (isFunction((results as any).then)) {
42 const promiseResults = await results;
43 if (promiseResults != null) {
44 return promiseResults as string;
45 }
46 } else if (isString(results)) {
47 return results;
48 }
49 }
50 } catch (e: any) {
51 catchError(pluginCtx.diagnostics, e);
52 }
53 }
54 }
55
56 // default load()
57 return pluginCtx.fs.readFile(id);
58};
59
60/**
61 * returns a subset of the baseline array of strings

Callers 1

runPluginTransformsFunction · 0.85

Calls 4

isFunctionFunction · 0.85
catchErrorFunction · 0.85
readFileMethod · 0.80
isStringFunction · 0.50

Tested by

no test coverage detected