Add plannotator extension v0.19.10
This commit is contained in:
20
extensions/plannotator/generated/code-file.ts
Normal file
20
extensions/plannotator/generated/code-file.ts
Normal file
@@ -0,0 +1,20 @@
|
||||
// @generated — DO NOT EDIT. Source: packages/shared/code-file.ts
|
||||
export const CODE_FILE_REGEX = /(?:\.(tsx?|jsx?|py|rb|go|rs|java|c|cpp|h|hpp|cs|swift|kt|scala|sh|bash|zsh|sql|graphql|json|ya?ml|toml|ini|css|scss|less|xml|tf|lua|r|dart|ex|exs|vue|svelte|astro|zig|proto)|(?:^|\/)(Dockerfile|Makefile|Rakefile|Gemfile|Procfile|Vagrantfile|Brewfile|Justfile))$/i;
|
||||
|
||||
export const CODE_PATH_BARE_REGEX = /(?:\.{0,2}\/)?(?:[a-zA-Z0-9_@.\-\[\]]+\/)+[a-zA-Z0-9_.\-\[\]]+\.[a-zA-Z0-9]+/g;
|
||||
|
||||
const IMPLAUSIBLE_CHARS = /[{},*?\s]/;
|
||||
|
||||
export function isPlausibleCodeFilePath(input: string): boolean {
|
||||
return !IMPLAUSIBLE_CHARS.test(input);
|
||||
}
|
||||
|
||||
export function isCodeFilePath(input: string): boolean {
|
||||
if (!isPlausibleCodeFilePath(input)) return false;
|
||||
return CODE_FILE_REGEX.test(input.replace(/#.*$/, ''))
|
||||
&& !input.startsWith('http://') && !input.startsWith('https://');
|
||||
}
|
||||
|
||||
export function isCodeFilePathStrict(input: string): boolean {
|
||||
return input.includes('/') && isCodeFilePath(input);
|
||||
}
|
||||
Reference in New Issue
Block a user