(
filePath: string,
absolutePath?: string,
)
| 220 | } |
| 221 | |
| 222 | async function syncWorkspaceTextFile( |
| 223 | filePath: string, |
| 224 | absolutePath?: string, |
| 225 | ): Promise<{ path: string; content: string }> { |
| 226 | const normalizedPath = normalizeDesignFilePath(filePath); |
| 227 | assertWorkspacePathVisible(normalizedPath); |
| 228 | const sourcePath = absolutePath; |
| 229 | let content: string; |
| 230 | if (!sourcePath) { |
| 231 | if (designId === null || db === null) { |
| 232 | throw new Error(`Workspace path unavailable for ${normalizedPath}`); |
| 233 | } |
| 234 | content = await withResolvedWorkspace(normalizedPath, async (_workspacePath, path) => |
| 235 | readFile(path, 'utf8'), |
| 236 | ); |
| 237 | } else { |
| 238 | content = await readFile(sourcePath, 'utf8'); |
| 239 | } |
| 240 | fsMap.set(normalizedPath, content); |
| 241 | emitFsUpdated(normalizedPath, content); |
| 242 | emitSourceIfAssetChanged(normalizedPath); |
| 243 | return { path: normalizedPath, content }; |
| 244 | } |
| 245 | |
| 246 | const fs = { |
| 247 | view(path: string) { |
no test coverage detected