MCPcopy Index your code
hub / github.com/scriptscat/scriptcat / getScriptRequire

Function getScriptRequire

src/app/service/content/utils.ts:58–69  ·  view source on GitHub ↗
(scriptRes: ScriptRunResource)

Source from the content-addressed store, hash-verified

56
57// 根据ScriptRunResource获取require的资源
58export function getScriptRequire(scriptRes: ScriptRunResource): CompileScriptCodeResource["require"] {
59 const resourceArray = new Array<{ url: string; content: string }>();
60 if (Array.isArray(scriptRes.metadata.require)) {
61 for (const val of scriptRes.metadata.require) {
62 const res = scriptRes.resource[val];
63 if (res) {
64 resourceArray.push({ url: res.url, content: res.content });
65 }
66 }
67 }
68 return resourceArray;
69}
70
71/**
72 * 构建unwrap脚本运行代码

Callers 2

compileScriptletCodeFunction · 0.85
compileScriptCodeFunction · 0.85

Calls 1

pushMethod · 0.80

Tested by

no test coverage detected