MCPcopy Create free account
hub / github.com/taskforcesh/bullmq / parseScript

Method parseScript

src/commands/script-loader.ts:351–376  ·  view source on GitHub ↗

* Parse a (top-level) lua script * @param filename - the full path to the script * @param content - the content of the script * @param cache - cache

(
    filename: string,
    content: string,
    dir: string,
    cache?: Map<string, ScriptMetadata>,
    isLoadingIncludes = false,
  )

Source from the content-addressed store, hash-verified

349 * @param cache - cache
350 */
351 async parseScript(
352 filename: string,
353 content: string,
354 dir: string,
355 cache?: Map<string, ScriptMetadata>,
356 isLoadingIncludes = false,
357 ): Promise<ScriptMetadata> {
358 const { name, numberOfKeys } = splitFilename(filename);
359 const filePath = isLoadingIncludes ? filename : name;
360 const meta = cache?.get(filePath);
361 if (meta?.content === content) {
362 return meta;
363 }
364 const fileInfo: ScriptMetadata = {
365 dir,
366 path: filePath,
367 token: getPathHash(filePath),
368 content,
369 name,
370 numberOfKeys,
371 includes: [],
372 };
373
374 await this.resolveDependencies(fileInfo, cache, isLoadingIncludes);
375 return fileInfo;
376 }
377
378 /**
379 * Construct the final version of a file by interpolating its includes in dependency order.

Callers 1

loadCommandMethod · 0.95

Calls 4

resolveDependenciesMethod · 0.95
splitFilenameFunction · 0.85
getPathHashFunction · 0.85
getMethod · 0.65

Tested by

no test coverage detected