MCPcopy Create free account
hub / github.com/breck7/scroll / requireAbsOrRelative

Method requireAbsOrRelative

external/.scrollLibs.js:14170–14176  ·  view source on GitHub ↗
(filePath, contextFilePath)

Source from the content-addressed store, hash-verified

14168 return [context, final]
14169 }
14170 static requireAbsOrRelative(filePath, contextFilePath) {
14171 if (!filePath.startsWith(".")) return require(filePath)
14172 const path = require("path")
14173 const folder = this.getPathWithoutFileName(contextFilePath)
14174 const file = path.resolve(folder + "/" + filePath)
14175 return require(file)
14176 }
14177 // Removes last ".*" from this string
14178 static removeFileExtension(filename) {
14179 return filename ? filename.replace(/\.[^\.]+$/, "") : ""

Callers

nothing calls this directly

Calls 1

Tested by

no test coverage detected