(ctx, line)
| 1850 | } |
| 1851 | |
| 1852 | function markNodeModules(ctx, line) { |
| 1853 | let tempLine = ''; |
| 1854 | let lastPos = 0; |
| 1855 | let searchFrom = 0; |
| 1856 | |
| 1857 | while (true) { |
| 1858 | const nodeModulePosition = StringPrototypeIndexOf(line, 'node_modules', searchFrom); |
| 1859 | if (nodeModulePosition === -1) { |
| 1860 | break; |
| 1861 | } |
| 1862 | |
| 1863 | // Ensure it's a path segment: must have a path separator before and after |
| 1864 | const separator = line[nodeModulePosition - 1]; |
| 1865 | const after = line[nodeModulePosition + 12]; // 'node_modules'.length === 12 |
| 1866 | |
| 1867 | if ((after !== '/' && after !== '\\') || (separator !== '/' && separator !== '\\')) { |
| 1868 | // Not a proper segment; continue searching |
| 1869 | searchFrom = nodeModulePosition + 1; |
| 1870 | continue; |
| 1871 | } |
| 1872 | |
| 1873 | const moduleStart = nodeModulePosition + 13; // Include trailing separator |
| 1874 | |
| 1875 | // Append up to and including '/node_modules/' |
| 1876 | tempLine += StringPrototypeSlice(line, lastPos, moduleStart); |
| 1877 | |
| 1878 | let moduleEnd = StringPrototypeIndexOf(line, separator, moduleStart); |
| 1879 | if (line[moduleStart] === '@') { |
| 1880 | // Namespaced modules have an extra slash: @namespace/package |
| 1881 | moduleEnd = StringPrototypeIndexOf(line, separator, moduleEnd + 1); |
| 1882 | } |
| 1883 | |
| 1884 | const nodeModule = StringPrototypeSlice(line, moduleStart, moduleEnd); |
| 1885 | tempLine += ctx.stylize(nodeModule, 'module'); |
| 1886 | |
| 1887 | lastPos = moduleEnd; |
| 1888 | searchFrom = moduleEnd; |
| 1889 | } |
| 1890 | |
| 1891 | if (lastPos !== 0) { |
| 1892 | line = tempLine + StringPrototypeSlice(line, lastPos); |
| 1893 | } |
| 1894 | return line; |
| 1895 | } |
| 1896 | |
| 1897 | function markCwd(ctx, line, workingDirectory) { |
| 1898 | let cwdStartPos = StringPrototypeIndexOf(line, workingDirectory); |
no outgoing calls
no test coverage detected
searching dependent graphs…