| 21 | return rel !== '..' && !rel.startsWith(`..${process.platform === 'win32' ? '\\' : '/'}`) && !isAbsolute(rel); |
| 22 | }; |
| 23 | function localPath(path: string): string { |
| 24 | const actual = realpathSync(path); |
| 25 | const dependencies = realpathSync(join(root, 'node_modules')); |
| 26 | if (inside(dependencies, actual)) return `node_modules/${slash(relative(dependencies, actual))}`; |
| 27 | if (inside(realpathSync(root), actual)) return slash(relative(realpathSync(root), actual)); |
| 28 | throw new Error(`License inventory input outside the UI: ${path}`); |
| 29 | } |
| 30 | function record(path: string): string | undefined { |
| 31 | const clean = path.split('?')[0]; |
| 32 | if (!clean || clean.includes('\0') || !isAbsolute(clean) || !existsSync(clean) || !statSync(clean).isFile()) return; |