@cldmv/fix-headers 1.3.12 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +202 -0
- package/README.md +313 -25
- package/bin/fix-headers.mjs +70 -0
- package/dist/index.cjs +28 -0
- package/dist/index.mjs +23 -0
- package/package.json +39 -19
- package/types/src/cli.d.mts +20 -2
- package/types/src/config/load.d.mts +36 -0
- package/types/src/constants.d.mts +1 -23
- package/types/src/core/file-discovery.d.mts +17 -5
- package/types/src/core/fix-headers.d.mts +59 -4
- package/types/src/core/ignore-rules.d.mts +38 -0
- package/types/src/detect/project.d.mts +64 -15
- package/types/src/detectors/css.d.mts +0 -8
- package/types/src/detectors/go.d.mts +0 -8
- package/types/src/detectors/html.d.mts +0 -8
- package/types/src/detectors/index.d.mts +28 -7
- package/types/src/detectors/json.d.mts +0 -8
- package/types/src/detectors/node.d.mts +0 -8
- package/types/src/detectors/php.d.mts +0 -8
- package/types/src/detectors/python.d.mts +0 -8
- package/types/src/detectors/rust.d.mts +0 -8
- package/types/src/detectors/yaml.d.mts +0 -8
- package/types/src/drivers/go.d.mts +2 -0
- package/types/src/drivers/index.d.mts +154 -0
- package/types/src/drivers/node.d.mts +2 -0
- package/types/src/drivers/php.d.mts +2 -0
- package/types/src/drivers/python.d.mts +2 -0
- package/types/src/drivers/rust.d.mts +2 -0
- package/types/src/drivers/shared.d.mts +78 -0
- package/types/src/header/dates.d.mts +108 -0
- package/types/src/header/fields.d.mts +48 -0
- package/types/src/header/template.d.mts +4 -3
- package/types/src/utils/diff.d.mts +53 -0
- package/types/src/utils/fs.d.mts +10 -3
- package/types/src/utils/git.d.mts +27 -0
- package/types/src/utils/time.d.mts +55 -0
- package/index.cjs +0 -39
- package/index.mjs +0 -20
- package/src/cli.mjs +0 -323
- package/src/constants.mjs +0 -50
- package/src/core/file-discovery.mjs +0 -213
- package/src/core/fix-headers.mjs +0 -413
- package/src/detect/project.mjs +0 -190
- package/src/detectors/css.mjs +0 -67
- package/src/detectors/go.mjs +0 -65
- package/src/detectors/html.mjs +0 -67
- package/src/detectors/index.mjs +0 -187
- package/src/detectors/json.mjs +0 -76
- package/src/detectors/node.mjs +0 -90
- package/src/detectors/php.mjs +0 -66
- package/src/detectors/python.mjs +0 -75
- package/src/detectors/rust.mjs +0 -62
- package/src/detectors/shared.mjs +0 -45
- package/src/detectors/yaml.mjs +0 -79
- package/src/fix-header.mjs +0 -30
- package/src/header/parser.mjs +0 -145
- package/src/header/syntax.mjs +0 -69
- package/src/header/template.mjs +0 -65
- package/src/utils/fs.mjs +0 -138
- package/src/utils/git.mjs +0 -135
- package/src/utils/time.mjs +0 -44
- package/types/src/detectors/shared.d.mts +0 -14
|
@@ -12,6 +12,12 @@ export type FixHeadersOptions = {
|
|
|
12
12
|
cwd?: string;
|
|
13
13
|
input?: string;
|
|
14
14
|
dryRun?: boolean;
|
|
15
|
+
check?: boolean;
|
|
16
|
+
fixCreatedDate?: boolean;
|
|
17
|
+
strictCreatedDate?: boolean;
|
|
18
|
+
normalizeDateFormat?: boolean;
|
|
19
|
+
timezone?: string;
|
|
20
|
+
convertTimezone?: boolean;
|
|
15
21
|
configFile?: string;
|
|
16
22
|
sampleOutput?: boolean;
|
|
17
23
|
forceAuthorUpdate?: boolean;
|
|
@@ -26,7 +32,10 @@ export type FixHeadersOptions = {
|
|
|
26
32
|
blockLinePrefix?: string;
|
|
27
33
|
blockEnd?: string;
|
|
28
34
|
}>;
|
|
29
|
-
includeFolders?: string
|
|
35
|
+
includeFolders?: Array<string | {
|
|
36
|
+
path: string;
|
|
37
|
+
recursive?: boolean;
|
|
38
|
+
}>;
|
|
30
39
|
excludeFolders?: string[];
|
|
31
40
|
includeExtensions?: string[];
|
|
32
41
|
gitignore?: boolean | string | string[];
|
|
@@ -40,36 +49,82 @@ export type FixHeadersOptions = {
|
|
|
40
49
|
companyName?: string;
|
|
41
50
|
copyrightStartYear?: number;
|
|
42
51
|
};
|
|
52
|
+
export type HeaderFieldIssue = import("../header/fields.mjs").HeaderFieldIssue;
|
|
53
|
+
/**
|
|
54
|
+
* Rewrites a header date payload (format or zone), keeping its instant.
|
|
55
|
+
*/
|
|
56
|
+
export type DateRewrite = (payload: {
|
|
57
|
+
date: string;
|
|
58
|
+
timestamp: number;
|
|
59
|
+
}) => {
|
|
60
|
+
date: string;
|
|
61
|
+
timestamp: number;
|
|
62
|
+
};
|
|
63
|
+
/**
|
|
64
|
+
* Result of a run. With `sampleOutput: true`, each changed entry carries a `sample`:
|
|
65
|
+
* - `previousValue` / `newValue` - the header block before (null when the file had none) and after.
|
|
66
|
+
* - `diff` - a unified diff of the header block (`--- a/<file>` / `+++ b/<file>`, `/dev/null`
|
|
67
|
+
* when there was no previous header), with hunk line numbers relative to the file.
|
|
68
|
+
* - `issues` - one `{ field, previous, detected }` entry per header field whose written value
|
|
69
|
+
* differs from the existing header. Values are the field text as written in the header
|
|
70
|
+
* (dates keep their `date (timestamp)` form; `previous` is null when the field was missing).
|
|
71
|
+
* Fields fix-headers preserves - the original `@Author`/`@Email` and `@Last modified by`
|
|
72
|
+
* identity, unless `forceAuthorUpdate` / `forceLastModifiedAuthorUpdate` is set - are compared
|
|
73
|
+
* against what is actually written, so they only appear when they really change. Because an
|
|
74
|
+
* updated file gets a fresh `@Last modified time`, `lastModifiedAt` is listed for every
|
|
75
|
+
* changed file that already had a header.
|
|
76
|
+
* - `detectedValues` - the metadata resolved for the file. `projectNameSource` says where
|
|
77
|
+
* `projectName` came from: `{ from: "manifest", driver, manifest, dir }`,
|
|
78
|
+
* `{ from: "folder", dir }` or `{ from: "option" }`. `companyName` is the `@Copyright` holder
|
|
79
|
+
* (null when nothing provides one, and the line then carries none), and `companyNameSource`
|
|
80
|
+
* says where it came from: `{ from: "manifest", driver, manifest, dir }`, `{ from: "option" }`
|
|
81
|
+
* or `{ from: "none" }`. `copyrightStartYear` is the start year written for the file, and
|
|
82
|
+
* `copyrightStartYearSource` says where it came from: `"option"` (`copyrightStartYear`) or
|
|
83
|
+
* `"created-date"` (the year of the file's `@Date`).
|
|
84
|
+
*
|
|
85
|
+
* `metadata.copyrightStartYear` is the `copyrightStartYear` option, or null when it is not set.
|
|
86
|
+
*/
|
|
43
87
|
export type FixHeadersResult = {
|
|
44
88
|
metadata: {
|
|
45
89
|
projectName: string;
|
|
90
|
+
projectNameSource: import("../detect/project.mjs").ProjectNameSource;
|
|
46
91
|
language: string;
|
|
47
92
|
projectRoot: string;
|
|
48
93
|
marker: string | null;
|
|
49
94
|
authorName: string;
|
|
50
95
|
authorEmail: string;
|
|
51
|
-
companyName: string;
|
|
52
|
-
|
|
96
|
+
companyName: string | null;
|
|
97
|
+
companyNameSource: import("../detect/project.mjs").CompanyNameSource;
|
|
98
|
+
copyrightStartYear: number | null;
|
|
53
99
|
};
|
|
54
100
|
detectedProjects: string[];
|
|
55
101
|
filesScanned: number;
|
|
56
102
|
filesUpdated: number;
|
|
57
103
|
dryRun: boolean;
|
|
104
|
+
check: boolean;
|
|
105
|
+
filesWithDateDrift?: number;
|
|
106
|
+
dateAdvisories?: number;
|
|
58
107
|
changes: Array<{
|
|
59
108
|
file: string;
|
|
60
109
|
changed: boolean;
|
|
110
|
+
dateIssues?: import("../header/dates.mjs").DateCheckIssue[];
|
|
61
111
|
sample?: {
|
|
62
112
|
previousValue: string | null;
|
|
63
113
|
newValue: string;
|
|
114
|
+
diff: string;
|
|
115
|
+
issues: HeaderFieldIssue[];
|
|
64
116
|
detectedValues?: {
|
|
65
117
|
projectName: string;
|
|
118
|
+
projectNameSource: import("../detect/project.mjs").ProjectNameSource;
|
|
66
119
|
language: string;
|
|
67
120
|
projectRoot: string;
|
|
68
121
|
marker: string | null;
|
|
69
122
|
authorName: string;
|
|
70
123
|
authorEmail: string;
|
|
71
|
-
companyName: string;
|
|
124
|
+
companyName: string | null;
|
|
125
|
+
companyNameSource: import("../detect/project.mjs").CompanyNameSource;
|
|
72
126
|
copyrightStartYear: number;
|
|
127
|
+
copyrightStartYearSource: "option" | "created-date";
|
|
73
128
|
createdAtSource: string;
|
|
74
129
|
lastModifiedAtSource: string;
|
|
75
130
|
createdAt: {
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Creates the ignore filter for one discovery root.
|
|
3
|
+
* @param {{ root: string, gitignore?: boolean | string | string[] }} options - `gitignore`: `false`
|
|
4
|
+
* disables ignore files entirely; a path or array of paths (relative to the root) uses exactly
|
|
5
|
+
* those files, without asking git; anything else asks git / parses `.gitignore` files.
|
|
6
|
+
* @returns {{ isIgnored: (targetPath: string, isDirectory: boolean) => Promise<boolean> }} Filter.
|
|
7
|
+
*/
|
|
8
|
+
export function createIgnoreFilter(options: {
|
|
9
|
+
root: string;
|
|
10
|
+
gitignore?: boolean | string | string[];
|
|
11
|
+
}): {
|
|
12
|
+
isIgnored: (targetPath: string, isDirectory: boolean) => Promise<boolean>;
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* Parsed rules of one ignore file, matched relative to `base`.
|
|
16
|
+
*/
|
|
17
|
+
export type IgnoreMatcher = {
|
|
18
|
+
base: string;
|
|
19
|
+
rules: import("ignore").Ignore;
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* A folder's ignore state. `git`: the files git lists for the repository rooted at `root`;
|
|
23
|
+
* `rules`: parsed ignore files, innermost last; `nested` says whether `.gitignore` files and
|
|
24
|
+
* repositories below are picked up while walking (false for explicit ignore files); `excluded`
|
|
25
|
+
* marks a folder the rules ignore, so everything inside it is ignored too — as in git, a file
|
|
26
|
+
* cannot be re-included when a parent folder is excluded.
|
|
27
|
+
*/
|
|
28
|
+
export type IgnoreContext = {
|
|
29
|
+
kind: "git";
|
|
30
|
+
root: string;
|
|
31
|
+
entries: Set<string>;
|
|
32
|
+
dirs: Set<string>;
|
|
33
|
+
} | {
|
|
34
|
+
kind: "rules";
|
|
35
|
+
nested: boolean;
|
|
36
|
+
excluded: boolean;
|
|
37
|
+
matchers: IgnoreMatcher[];
|
|
38
|
+
};
|
|
@@ -1,33 +1,45 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Detects project
|
|
3
|
-
* @
|
|
4
|
-
*
|
|
2
|
+
* Detects the project a path belongs to from the manifests of the project it sits in (see
|
|
3
|
+
* {@link resolveManifestProject}), independent of the file's type.
|
|
4
|
+
*
|
|
5
|
+
* `language` is the id of the file-type detector for `preferredExtension` when one handles
|
|
6
|
+
* it; otherwise the first driver claiming the project root, or `unknown` without one. With
|
|
7
|
+
* no manifest up to the repository root (a folder holding `.git`), that repository root is
|
|
8
|
+
* the project root; with neither, the start folder is. The project name is then that
|
|
9
|
+
* folder's name. The copyright holder (`companyName`) comes from the manifests' authors the same
|
|
10
|
+
* way, and is null when none of them provides one.
|
|
11
|
+
* @param {string} cwd - Starting directory (a file's folder, or the scan root).
|
|
12
|
+
* @param {{ detectors?: { id: string, extensions: string[] }[], enabledDetectors?: string[], disabledDetectors?: string[], preferredExtension?: string, drivers?: import("../drivers/index.mjs").ManifestDriver[], scanRoot?: string }} [options={}] - Detection options. `scanRoot` bounds how far values missing from the nearest manifests are looked up in ancestor folders; without it they aren't.
|
|
5
13
|
* @returns {Promise<{
|
|
6
14
|
* language: string,
|
|
7
15
|
* rootDir: string,
|
|
8
16
|
* marker: string | null,
|
|
9
|
-
* projectName: string
|
|
17
|
+
* projectName: string,
|
|
18
|
+
* projectNameSource: ProjectNameSource,
|
|
19
|
+
* companyName: string | null,
|
|
20
|
+
* companyNameSource: CompanyNameSource,
|
|
21
|
+
* drivers: string[]
|
|
10
22
|
* }>} Detection result.
|
|
11
23
|
*/
|
|
12
24
|
export function detectProjectFromMarkers(cwd: string, options?: {
|
|
13
25
|
detectors?: {
|
|
14
26
|
id: string;
|
|
15
27
|
extensions: string[];
|
|
16
|
-
priority?: number;
|
|
17
|
-
findNearestConfig: (path: string) => Promise<{
|
|
18
|
-
root: string;
|
|
19
|
-
marker: string;
|
|
20
|
-
} | null>;
|
|
21
|
-
parseProjectName: (marker: string, content: string, rootDirName: string) => string;
|
|
22
28
|
}[];
|
|
23
29
|
enabledDetectors?: string[];
|
|
24
30
|
disabledDetectors?: string[];
|
|
25
31
|
preferredExtension?: string;
|
|
32
|
+
drivers?: import("../drivers/index.mjs").ManifestDriver[];
|
|
33
|
+
scanRoot?: string;
|
|
26
34
|
}): Promise<{
|
|
27
35
|
language: string;
|
|
28
36
|
rootDir: string;
|
|
29
37
|
marker: string | null;
|
|
30
38
|
projectName: string;
|
|
39
|
+
projectNameSource: ProjectNameSource;
|
|
40
|
+
companyName: string | null;
|
|
41
|
+
companyNameSource: CompanyNameSource;
|
|
42
|
+
drivers: string[];
|
|
31
43
|
}>;
|
|
32
44
|
/**
|
|
33
45
|
* Resolves project metadata with override support for every auto-detected field.
|
|
@@ -49,14 +61,19 @@ export function detectProjectFromMarkers(cwd: string, options?: {
|
|
|
49
61
|
* }} [options={}] - Detection options and overrides.
|
|
50
62
|
* @returns {Promise<{
|
|
51
63
|
* projectName: string,
|
|
64
|
+
* projectNameSource: ProjectNameSource,
|
|
52
65
|
* language: string,
|
|
53
66
|
* projectRoot: string,
|
|
54
67
|
* marker: string | null,
|
|
55
68
|
* authorName: string,
|
|
56
69
|
* authorEmail: string,
|
|
57
|
-
* companyName: string,
|
|
58
|
-
*
|
|
59
|
-
*
|
|
70
|
+
* companyName: string | null,
|
|
71
|
+
* companyNameSource: CompanyNameSource,
|
|
72
|
+
* copyrightStartYear: number | null
|
|
73
|
+
* }>} Final metadata. `companyName` is the `companyName` option when it is set, else the
|
|
74
|
+
* holder the project's manifests provide, else null (no holder on the `@Copyright` line).
|
|
75
|
+
* `copyrightStartYear` is null when the option is not set: each file's start year then comes
|
|
76
|
+
* from its own `@Date`.
|
|
60
77
|
*/
|
|
61
78
|
export function resolveProjectMetadata(options?: {
|
|
62
79
|
cwd?: string;
|
|
@@ -75,11 +92,43 @@ export function resolveProjectMetadata(options?: {
|
|
|
75
92
|
copyrightStartYear?: number;
|
|
76
93
|
}): Promise<{
|
|
77
94
|
projectName: string;
|
|
95
|
+
projectNameSource: ProjectNameSource;
|
|
78
96
|
language: string;
|
|
79
97
|
projectRoot: string;
|
|
80
98
|
marker: string | null;
|
|
81
99
|
authorName: string;
|
|
82
100
|
authorEmail: string;
|
|
83
|
-
companyName: string;
|
|
84
|
-
|
|
101
|
+
companyName: string | null;
|
|
102
|
+
companyNameSource: CompanyNameSource;
|
|
103
|
+
copyrightStartYear: number | null;
|
|
85
104
|
}>;
|
|
105
|
+
/**
|
|
106
|
+
* Where `projectName` came from: a manifest (the driver, its manifest and the folder it sits
|
|
107
|
+
* in), the project root's folder name, or the `projectName` option.
|
|
108
|
+
*/
|
|
109
|
+
export type ProjectNameSource = {
|
|
110
|
+
from: "manifest";
|
|
111
|
+
driver: string;
|
|
112
|
+
manifest: string;
|
|
113
|
+
dir: string;
|
|
114
|
+
} | {
|
|
115
|
+
from: "folder";
|
|
116
|
+
dir: string;
|
|
117
|
+
} | {
|
|
118
|
+
from: "option";
|
|
119
|
+
};
|
|
120
|
+
/**
|
|
121
|
+
* Where `companyName` (the `@Copyright` holder) came from: a manifest's author (the driver, its
|
|
122
|
+
* manifest and the folder it sits in), the `companyName` option, or nothing (`companyName` is
|
|
123
|
+
* null and the `@Copyright` line carries no holder).
|
|
124
|
+
*/
|
|
125
|
+
export type CompanyNameSource = {
|
|
126
|
+
from: "manifest";
|
|
127
|
+
driver: string;
|
|
128
|
+
manifest: string;
|
|
129
|
+
dir: string;
|
|
130
|
+
} | {
|
|
131
|
+
from: "option";
|
|
132
|
+
} | {
|
|
133
|
+
from: "none";
|
|
134
|
+
};
|
|
@@ -1,14 +1,7 @@
|
|
|
1
1
|
export namespace detector {
|
|
2
2
|
export let id: string;
|
|
3
|
-
export let priority: number;
|
|
4
|
-
export { markers };
|
|
5
3
|
export { extensions };
|
|
6
4
|
export let enabledByDefault: boolean;
|
|
7
|
-
export function findNearestConfig(startPath: any): Promise<{
|
|
8
|
-
root: string;
|
|
9
|
-
marker: string;
|
|
10
|
-
}>;
|
|
11
|
-
export function parseProjectName(_marker: any, _markerContent: any, rootDirName: any): string;
|
|
12
5
|
export function resolveCommentSyntax(filePath: any): {
|
|
13
6
|
kind: "block";
|
|
14
7
|
blockStart: string;
|
|
@@ -20,6 +13,5 @@ export namespace detector {
|
|
|
20
13
|
* @fileoverview CSS detector implementation.
|
|
21
14
|
* @module fix-headers/detectors/css
|
|
22
15
|
*/
|
|
23
|
-
declare const markers: string[];
|
|
24
16
|
declare const extensions: string[];
|
|
25
17
|
export {};
|
|
@@ -1,14 +1,7 @@
|
|
|
1
1
|
export namespace detector {
|
|
2
2
|
export let id: string;
|
|
3
|
-
export let priority: number;
|
|
4
|
-
export { markers };
|
|
5
3
|
export { extensions };
|
|
6
4
|
export let enabledByDefault: boolean;
|
|
7
|
-
export function findNearestConfig(startPath: any): Promise<{
|
|
8
|
-
root: string;
|
|
9
|
-
marker: string;
|
|
10
|
-
}>;
|
|
11
|
-
export function parseProjectName(_marker: any, markerContent: any, rootDirName: any): any;
|
|
12
5
|
export function resolveCommentSyntax(filePath: any): {
|
|
13
6
|
kind: "block";
|
|
14
7
|
blockStart: string;
|
|
@@ -20,6 +13,5 @@ export namespace detector {
|
|
|
20
13
|
* @fileoverview Go detector implementation.
|
|
21
14
|
* @module fix-headers/detectors/go
|
|
22
15
|
*/
|
|
23
|
-
declare const markers: string[];
|
|
24
16
|
declare const extensions: string[];
|
|
25
17
|
export {};
|
|
@@ -1,14 +1,7 @@
|
|
|
1
1
|
export namespace detector {
|
|
2
2
|
export let id: string;
|
|
3
|
-
export let priority: number;
|
|
4
|
-
export { markers };
|
|
5
3
|
export { extensions };
|
|
6
4
|
export let enabledByDefault: boolean;
|
|
7
|
-
export function findNearestConfig(startPath: any): Promise<{
|
|
8
|
-
root: string;
|
|
9
|
-
marker: string;
|
|
10
|
-
}>;
|
|
11
|
-
export function parseProjectName(_marker: any, _markerContent: any, rootDirName: any): string;
|
|
12
5
|
export function resolveCommentSyntax(filePath: any): {
|
|
13
6
|
kind: "html";
|
|
14
7
|
blockStart: string;
|
|
@@ -20,6 +13,5 @@ export namespace detector {
|
|
|
20
13
|
* @fileoverview HTML detector implementation.
|
|
21
14
|
* @module fix-headers/detectors/html
|
|
22
15
|
*/
|
|
23
|
-
declare const markers: string[];
|
|
24
16
|
declare const extensions: string[];
|
|
25
17
|
export {};
|
|
@@ -61,17 +61,39 @@ export function getPreservedPrefixForFile(filePath: string, content: string, opt
|
|
|
61
61
|
enabledDetectors?: string[];
|
|
62
62
|
disabledDetectors?: string[];
|
|
63
63
|
}): string;
|
|
64
|
+
/**
|
|
65
|
+
* @fileoverview Detector registry and shared selector helpers.
|
|
66
|
+
* @module fix-headers/detectors
|
|
67
|
+
*/
|
|
68
|
+
/**
|
|
69
|
+
* @typedef {{
|
|
70
|
+
* id: string,
|
|
71
|
+
* extensions: string[],
|
|
72
|
+
* enabledByDefault: boolean,
|
|
73
|
+
* resolveCommentSyntax: (filePath: string) => ({kind: "block" | "line" | "html", linePrefix?: string, lineSeparator?: string, blockStart?: string, blockLinePrefix?: string, blockEnd?: string} | null),
|
|
74
|
+
* resolvePreservedPrefix?: (filePath: string, content: string) => string
|
|
75
|
+
* }} DetectorProfile
|
|
76
|
+
* A file-type detector: which extensions it handles and the comment syntax (and preserved
|
|
77
|
+
* leading prefix) of those files. Which project a file belongs to is resolved separately,
|
|
78
|
+
* from the manifest drivers in `src/drivers/`.
|
|
79
|
+
*/
|
|
80
|
+
/**
|
|
81
|
+
* Registered detector profiles, in alphabetical order by module name. Imported
|
|
82
|
+
* statically (not discovered from the directory at runtime) so the registry
|
|
83
|
+
* survives bundling into dist/. Add a new detector module here. The cast keeps the
|
|
84
|
+
* public type `DetectorProfile[]`: the detector modules' object literals widen their
|
|
85
|
+
* `kind` strings, which the typedef narrows to its literal union.
|
|
86
|
+
*/
|
|
64
87
|
export const DETECTOR_PROFILES: DetectorProfile[];
|
|
88
|
+
/**
|
|
89
|
+
* A file-type detector: which extensions it handles and the comment syntax (and preserved
|
|
90
|
+
* leading prefix) of those files. Which project a file belongs to is resolved separately,
|
|
91
|
+
* from the manifest drivers in `src/drivers/`.
|
|
92
|
+
*/
|
|
65
93
|
export type DetectorProfile = {
|
|
66
94
|
id: string;
|
|
67
|
-
markers: string[];
|
|
68
95
|
extensions: string[];
|
|
69
96
|
enabledByDefault: boolean;
|
|
70
|
-
findNearestConfig: (startPath: string) => Promise<{
|
|
71
|
-
root: string;
|
|
72
|
-
marker: string;
|
|
73
|
-
} | null>;
|
|
74
|
-
parseProjectName: (marker: string, markerContent: string, rootDirName: string) => string;
|
|
75
97
|
resolveCommentSyntax: (filePath: string) => ({
|
|
76
98
|
kind: "block" | "line" | "html";
|
|
77
99
|
linePrefix?: string;
|
|
@@ -81,5 +103,4 @@ export type DetectorProfile = {
|
|
|
81
103
|
blockEnd?: string;
|
|
82
104
|
} | null);
|
|
83
105
|
resolvePreservedPrefix?: (filePath: string, content: string) => string;
|
|
84
|
-
priority?: number;
|
|
85
106
|
};
|
|
@@ -1,14 +1,7 @@
|
|
|
1
1
|
export namespace detector {
|
|
2
2
|
export let id: string;
|
|
3
|
-
export let priority: number;
|
|
4
|
-
export { markers };
|
|
5
3
|
export { extensions };
|
|
6
4
|
export let enabledByDefault: boolean;
|
|
7
|
-
export function findNearestConfig(startPath: any): Promise<{
|
|
8
|
-
root: string;
|
|
9
|
-
marker: string;
|
|
10
|
-
}>;
|
|
11
|
-
export function parseProjectName(_marker: any, markerContent: any, rootDirName: any): string;
|
|
12
5
|
export function resolveCommentSyntax(filePath: any): {
|
|
13
6
|
kind: "block";
|
|
14
7
|
blockStart: string;
|
|
@@ -20,6 +13,5 @@ export namespace detector {
|
|
|
20
13
|
* @fileoverview JSON-family detector implementation.
|
|
21
14
|
* @module fix-headers/detectors/json
|
|
22
15
|
*/
|
|
23
|
-
declare const markers: string[];
|
|
24
16
|
declare const extensions: string[];
|
|
25
17
|
export {};
|
|
@@ -1,14 +1,7 @@
|
|
|
1
1
|
export namespace detector {
|
|
2
2
|
export let id: string;
|
|
3
|
-
export let priority: number;
|
|
4
|
-
export { markers };
|
|
5
3
|
export { extensions };
|
|
6
4
|
export let enabledByDefault: boolean;
|
|
7
|
-
export function findNearestConfig(startPath: any): Promise<{
|
|
8
|
-
root: string;
|
|
9
|
-
marker: string;
|
|
10
|
-
}>;
|
|
11
|
-
export function parseProjectName(_marker: any, markerContent: any, rootDirName: any): string;
|
|
12
5
|
export function resolvePreservedPrefix(filePath: any, content: any): string;
|
|
13
6
|
export function resolveCommentSyntax(filePath: any): {
|
|
14
7
|
kind: "block";
|
|
@@ -21,6 +14,5 @@ export namespace detector {
|
|
|
21
14
|
* @fileoverview Node.js detector implementation.
|
|
22
15
|
* @module fix-headers/detectors/node
|
|
23
16
|
*/
|
|
24
|
-
declare const markers: string[];
|
|
25
17
|
declare const extensions: string[];
|
|
26
18
|
export {};
|
|
@@ -1,14 +1,7 @@
|
|
|
1
1
|
export namespace detector {
|
|
2
2
|
export let id: string;
|
|
3
|
-
export let priority: number;
|
|
4
|
-
export { markers };
|
|
5
3
|
export { extensions };
|
|
6
4
|
export let enabledByDefault: boolean;
|
|
7
|
-
export function findNearestConfig(startPath: any): Promise<{
|
|
8
|
-
root: string;
|
|
9
|
-
marker: string;
|
|
10
|
-
}>;
|
|
11
|
-
export function parseProjectName(_marker: any, markerContent: any, rootDirName: any): any;
|
|
12
5
|
export function resolveCommentSyntax(filePath: any): {
|
|
13
6
|
kind: "block";
|
|
14
7
|
blockStart: string;
|
|
@@ -20,6 +13,5 @@ export namespace detector {
|
|
|
20
13
|
* @fileoverview PHP detector implementation.
|
|
21
14
|
* @module fix-headers/detectors/php
|
|
22
15
|
*/
|
|
23
|
-
declare const markers: string[];
|
|
24
16
|
declare const extensions: string[];
|
|
25
17
|
export {};
|
|
@@ -1,14 +1,7 @@
|
|
|
1
1
|
export namespace detector {
|
|
2
2
|
export let id: string;
|
|
3
|
-
export let priority: number;
|
|
4
|
-
export { markers };
|
|
5
3
|
export { extensions };
|
|
6
4
|
export let enabledByDefault: boolean;
|
|
7
|
-
export function findNearestConfig(startPath: any): Promise<{
|
|
8
|
-
root: string;
|
|
9
|
-
marker: string;
|
|
10
|
-
}>;
|
|
11
|
-
export function parseProjectName(_marker: any, markerContent: any, rootDirName: any): string;
|
|
12
5
|
export function resolvePreservedPrefix(filePath: any, content: any): string;
|
|
13
6
|
export function resolveCommentSyntax(filePath: any): {
|
|
14
7
|
kind: string;
|
|
@@ -19,6 +12,5 @@ export namespace detector {
|
|
|
19
12
|
* @fileoverview Python detector implementation.
|
|
20
13
|
* @module fix-headers/detectors/python
|
|
21
14
|
*/
|
|
22
|
-
declare const markers: string[];
|
|
23
15
|
declare const extensions: string[];
|
|
24
16
|
export {};
|
|
@@ -1,14 +1,7 @@
|
|
|
1
1
|
export namespace detector {
|
|
2
2
|
export let id: string;
|
|
3
|
-
export let priority: number;
|
|
4
|
-
export { markers };
|
|
5
3
|
export { extensions };
|
|
6
4
|
export let enabledByDefault: boolean;
|
|
7
|
-
export function findNearestConfig(startPath: any): Promise<{
|
|
8
|
-
root: string;
|
|
9
|
-
marker: string;
|
|
10
|
-
}>;
|
|
11
|
-
export function parseProjectName(_marker: any, markerContent: any, rootDirName: any): any;
|
|
12
5
|
export function resolveCommentSyntax(filePath: any): {
|
|
13
6
|
kind: "block";
|
|
14
7
|
blockStart: string;
|
|
@@ -20,6 +13,5 @@ export namespace detector {
|
|
|
20
13
|
* @fileoverview Rust detector implementation.
|
|
21
14
|
* @module fix-headers/detectors/rust
|
|
22
15
|
*/
|
|
23
|
-
declare const markers: string[];
|
|
24
16
|
declare const extensions: string[];
|
|
25
17
|
export {};
|
|
@@ -1,14 +1,7 @@
|
|
|
1
1
|
export namespace detector {
|
|
2
2
|
export let id: string;
|
|
3
|
-
export let priority: number;
|
|
4
|
-
export { markers };
|
|
5
3
|
export { extensions };
|
|
6
4
|
export let enabledByDefault: boolean;
|
|
7
|
-
export function findNearestConfig(startPath: any): Promise<{
|
|
8
|
-
root: string;
|
|
9
|
-
marker: string;
|
|
10
|
-
}>;
|
|
11
|
-
export function parseProjectName(marker: any, markerContent: any, rootDirName: any): string;
|
|
12
5
|
export function resolveCommentSyntax(filePath: any): {
|
|
13
6
|
kind: "line";
|
|
14
7
|
linePrefix: string;
|
|
@@ -18,6 +11,5 @@ export namespace detector {
|
|
|
18
11
|
* @fileoverview YAML detector implementation.
|
|
19
12
|
* @module fix-headers/detectors/yaml
|
|
20
13
|
*/
|
|
21
|
-
declare const markers: string[];
|
|
22
14
|
declare const extensions: string[];
|
|
23
15
|
export {};
|