MCPcopy Create free account
hub / github.com/observablehq/framework / getWatchPath

Method getWatchPath

src/loader.ts:245–254  ·  view source on GitHub ↗

* Returns the path to watch, relative to the current working directory, for * the specified source path, relative to the source root.

(path: string)

Source from the content-addressed store, hash-verified

243 * the specified source path, relative to the source root.
244 */
245 getWatchPath(path: string): string | undefined {
246 const exactPath = join(this.root, path);
247 if (existsSync(exactPath)) return exactPath;
248 if (exactPath.endsWith(".js")) {
249 const module = findModule(this.root, path);
250 return module && join(this.root, module.path);
251 }
252 const foundPath = this.find(path)?.path;
253 if (foundPath) return join(this.root, foundPath);
254 }
255
256 watchFiles(path: string, watchPaths: Iterable<string>, callback: (name: string) => void) {
257 return FileWatchers.of(this, path, watchPaths, callback);

Callers 2

loader-test.tsFile · 0.80
ofMethod · 0.80

Calls 3

findMethod · 0.95
existsSyncFunction · 0.85
findModuleFunction · 0.85

Tested by

no test coverage detected