(options: ExtractJSDocsOptions)
| 1880 | * @since 4.0.0 |
| 1881 | */ |
| 1882 | export function computeJSDocInputHash(options: ExtractJSDocsOptions): string { |
| 1883 | const cwd = path.resolve(options.cwd ?? process.cwd()) |
| 1884 | const hash = crypto.createHash("sha256") |
| 1885 | const files = new Set<string>() |
| 1886 | |
| 1887 | hash.update(JSON.stringify({ |
| 1888 | tsconfig: options.tsconfig, |
| 1889 | include: options.include, |
| 1890 | exclude: options.exclude ?? [], |
| 1891 | output: options.output |
| 1892 | })) |
| 1893 | |
| 1894 | addInputFile(files, path.join(cwd, "jsdocs.config.json")) |
| 1895 | addInputFile(files, path.resolve(cwd, options.tsconfig)) |
| 1896 | |
| 1897 | for ( |
| 1898 | const filename of globSync([...options.include], { |
| 1899 | cwd, |
| 1900 | absolute: true, |
| 1901 | nodir: true, |
| 1902 | ignore: ["**/node_modules/**"] |
| 1903 | }) |
| 1904 | ) { |
| 1905 | addInputFile(files, filename) |
| 1906 | } |
| 1907 | |
| 1908 | for ( |
| 1909 | const filename of globSync([ |
| 1910 | "package.json", |
| 1911 | "packages/**/package.json", |
| 1912 | "tsconfig*.json", |
| 1913 | "packages/**/tsconfig*.json" |
| 1914 | ], { |
| 1915 | cwd, |
| 1916 | absolute: true, |
| 1917 | nodir: true, |
| 1918 | ignore: ["**/node_modules/**"] |
| 1919 | }) |
| 1920 | ) { |
| 1921 | addInputFile(files, filename) |
| 1922 | } |
| 1923 | |
| 1924 | for (const filename of Array.from(files).sort()) { |
| 1925 | hash.update("\0") |
| 1926 | hash.update(normalizeFile(cwd, filename)) |
| 1927 | hash.update("\0") |
| 1928 | hash.update(hashSource(fs.readFileSync(filename, "utf8"))) |
| 1929 | } |
| 1930 | |
| 1931 | return hash.digest("hex") |
| 1932 | } |
| 1933 | |
| 1934 | function isIdentifierName(value: string): boolean { |
| 1935 | return /^[$A-Z_a-z][$\w]*$/.test(value) |
no test coverage detected