linguist-js 2.6.0 → 2.6.1
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/dist/cli.d.ts +1 -1
- package/dist/cli.js +107 -107
- package/dist/helpers/convert-pcre.d.ts +2 -0
- package/dist/helpers/convert-pcre.js +38 -38
- package/dist/helpers/load-data.d.ts +4 -0
- package/dist/helpers/load-data.js +38 -31
- package/dist/helpers/read-file.d.ts +5 -0
- package/dist/helpers/read-file.js +23 -23
- package/dist/helpers/walk-tree.d.ts +20 -0
- package/dist/helpers/walk-tree.js +69 -64
- package/dist/index.d.ts +4 -4
- package/dist/index.js +418 -389
- package/dist/schema.d.ts +37 -37
- package/dist/schema.js +2 -2
- package/dist/types.d.ts +48 -48
- package/dist/types.js +2 -2
- package/ext/generated.rb +24 -399
- package/package.json +3 -4
- package/readme.md +33 -25
package/dist/schema.d.ts
CHANGED
|
@@ -1,37 +1,37 @@
|
|
|
1
|
-
import { Category, Language } from './types';
|
|
2
|
-
export interface LanguagesScema {
|
|
3
|
-
[name: string]: {
|
|
4
|
-
language_id: number;
|
|
5
|
-
fs_name?: Language;
|
|
6
|
-
type: Category;
|
|
7
|
-
group?: Language;
|
|
8
|
-
color?: `#${string}`;
|
|
9
|
-
aliases?: string[];
|
|
10
|
-
extensions?: `.${string}`[];
|
|
11
|
-
filenames?: string[];
|
|
12
|
-
interpreters?: string[];
|
|
13
|
-
tm_scope?: `${'source' | 'text'}.${string}`;
|
|
14
|
-
ace_mode?: string;
|
|
15
|
-
codemirror_mode?: string;
|
|
16
|
-
codemirror_mime_type?: `${string}/${string}`;
|
|
17
|
-
wrap?: boolean;
|
|
18
|
-
};
|
|
19
|
-
}
|
|
20
|
-
interface HeuristicsRules {
|
|
21
|
-
pattern?: string;
|
|
22
|
-
named_pattern?: string;
|
|
23
|
-
named_patterns?: string[];
|
|
24
|
-
negative_pattern?: string;
|
|
25
|
-
}
|
|
26
|
-
export interface HeuristicsSchema {
|
|
27
|
-
disambiguations: Array<{
|
|
28
|
-
extensions: string[];
|
|
29
|
-
rules: Array<HeuristicsRules & {
|
|
30
|
-
language: string | string[];
|
|
31
|
-
and?: HeuristicsRules[];
|
|
32
|
-
}>;
|
|
33
|
-
}>;
|
|
34
|
-
named_patterns: Record<string, string | string[]>;
|
|
35
|
-
}
|
|
36
|
-
export
|
|
37
|
-
export {};
|
|
1
|
+
import { Category, Language } from './types';
|
|
2
|
+
export interface LanguagesScema {
|
|
3
|
+
[name: string]: {
|
|
4
|
+
language_id: number;
|
|
5
|
+
fs_name?: Language;
|
|
6
|
+
type: Category;
|
|
7
|
+
group?: Language;
|
|
8
|
+
color?: `#${string}`;
|
|
9
|
+
aliases?: string[];
|
|
10
|
+
extensions?: `.${string}`[];
|
|
11
|
+
filenames?: string[];
|
|
12
|
+
interpreters?: string[];
|
|
13
|
+
tm_scope?: `${'source' | 'text'}.${string}`;
|
|
14
|
+
ace_mode?: string;
|
|
15
|
+
codemirror_mode?: string;
|
|
16
|
+
codemirror_mime_type?: `${string}/${string}`;
|
|
17
|
+
wrap?: boolean;
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
interface HeuristicsRules {
|
|
21
|
+
pattern?: string;
|
|
22
|
+
named_pattern?: string;
|
|
23
|
+
named_patterns?: string[];
|
|
24
|
+
negative_pattern?: string;
|
|
25
|
+
}
|
|
26
|
+
export interface HeuristicsSchema {
|
|
27
|
+
disambiguations: Array<{
|
|
28
|
+
extensions: string[];
|
|
29
|
+
rules: Array<HeuristicsRules & {
|
|
30
|
+
language: string | string[];
|
|
31
|
+
and?: HeuristicsRules[];
|
|
32
|
+
}>;
|
|
33
|
+
}>;
|
|
34
|
+
named_patterns: Record<string, string | string[]>;
|
|
35
|
+
}
|
|
36
|
+
export type VendorSchema = string[];
|
|
37
|
+
export {};
|
package/dist/schema.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
package/dist/types.d.ts
CHANGED
|
@@ -1,48 +1,48 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
3
|
-
export
|
|
4
|
-
export
|
|
5
|
-
export
|
|
6
|
-
export
|
|
7
|
-
export interface Options {
|
|
8
|
-
fileContent?: string | string[];
|
|
9
|
-
ignoredFiles?: string[];
|
|
10
|
-
ignoredLanguages?: Language[];
|
|
11
|
-
categories?: Category[];
|
|
12
|
-
keepVendored?: boolean;
|
|
13
|
-
keepBinary?: boolean;
|
|
14
|
-
relativePaths?: boolean;
|
|
15
|
-
childLanguages?: boolean;
|
|
16
|
-
quick?: boolean;
|
|
17
|
-
offline?: boolean;
|
|
18
|
-
checkIgnored?: boolean;
|
|
19
|
-
checkAttributes?: boolean;
|
|
20
|
-
checkHeuristics?: boolean;
|
|
21
|
-
checkShebang?: boolean;
|
|
22
|
-
checkModeline?: boolean;
|
|
23
|
-
}
|
|
24
|
-
export interface Results {
|
|
25
|
-
files: {
|
|
26
|
-
count: Integer;
|
|
27
|
-
bytes: Bytes;
|
|
28
|
-
/** Note: Results use slashes as delimiters even on Windows. */
|
|
29
|
-
results: Record<FilePath, LanguageResult>;
|
|
30
|
-
alternatives: Record<FilePath, LanguageResult[]>;
|
|
31
|
-
};
|
|
32
|
-
languages: {
|
|
33
|
-
count: Integer;
|
|
34
|
-
bytes: Bytes;
|
|
35
|
-
results: Record<Language, {
|
|
36
|
-
bytes: Bytes;
|
|
37
|
-
type: Category;
|
|
38
|
-
parent?: Language;
|
|
39
|
-
color?: `#${string}`;
|
|
40
|
-
}>;
|
|
41
|
-
};
|
|
42
|
-
unknown: {
|
|
43
|
-
count: Integer;
|
|
44
|
-
bytes: Bytes;
|
|
45
|
-
extensions: Record<string, Bytes>;
|
|
46
|
-
filenames: Record<string, Bytes>;
|
|
47
|
-
};
|
|
48
|
-
}
|
|
1
|
+
export type LanguageResult = string | null;
|
|
2
|
+
export type Language = string;
|
|
3
|
+
export type Category = 'data' | 'markup' | 'programming' | 'prose';
|
|
4
|
+
export type FilePath = string;
|
|
5
|
+
export type Bytes = Integer;
|
|
6
|
+
export type Integer = number;
|
|
7
|
+
export interface Options {
|
|
8
|
+
fileContent?: string | string[];
|
|
9
|
+
ignoredFiles?: string[];
|
|
10
|
+
ignoredLanguages?: Language[];
|
|
11
|
+
categories?: Category[];
|
|
12
|
+
keepVendored?: boolean;
|
|
13
|
+
keepBinary?: boolean;
|
|
14
|
+
relativePaths?: boolean;
|
|
15
|
+
childLanguages?: boolean;
|
|
16
|
+
quick?: boolean;
|
|
17
|
+
offline?: boolean;
|
|
18
|
+
checkIgnored?: boolean;
|
|
19
|
+
checkAttributes?: boolean;
|
|
20
|
+
checkHeuristics?: boolean;
|
|
21
|
+
checkShebang?: boolean;
|
|
22
|
+
checkModeline?: boolean;
|
|
23
|
+
}
|
|
24
|
+
export interface Results {
|
|
25
|
+
files: {
|
|
26
|
+
count: Integer;
|
|
27
|
+
bytes: Bytes;
|
|
28
|
+
/** Note: Results use slashes as delimiters even on Windows. */
|
|
29
|
+
results: Record<FilePath, LanguageResult>;
|
|
30
|
+
alternatives: Record<FilePath, LanguageResult[]>;
|
|
31
|
+
};
|
|
32
|
+
languages: {
|
|
33
|
+
count: Integer;
|
|
34
|
+
bytes: Bytes;
|
|
35
|
+
results: Record<Language, {
|
|
36
|
+
bytes: Bytes;
|
|
37
|
+
type: Category;
|
|
38
|
+
parent?: Language;
|
|
39
|
+
color?: `#${string}`;
|
|
40
|
+
}>;
|
|
41
|
+
};
|
|
42
|
+
unknown: {
|
|
43
|
+
count: Integer;
|
|
44
|
+
bytes: Bytes;
|
|
45
|
+
extensions: Record<string, Bytes>;
|
|
46
|
+
filenames: Record<string, Bytes>;
|
|
47
|
+
};
|
|
48
|
+
}
|
package/dist/types.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
package/ext/generated.rb
CHANGED
|
@@ -1,399 +1,24 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
generated_net_designer_file? ||
|
|
26
|
-
generated_net_specflow_feature_file? ||
|
|
27
|
-
composer_lock? ||
|
|
28
|
-
cargo_lock? ||
|
|
29
|
-
flake_lock? ||
|
|
30
|
-
node_modules? ||
|
|
31
|
-
go_vendor? ||
|
|
32
|
-
go_lock? ||
|
|
33
|
-
poetry_lock? ||
|
|
34
|
-
pdm_lock? ||
|
|
35
|
-
esy_lock? ||
|
|
36
|
-
npm_shrinkwrap_or_package_lock? ||
|
|
37
|
-
terraform_lock? ||
|
|
38
|
-
generated_yarn_plugnplay? ||
|
|
39
|
-
godeps? ||
|
|
40
|
-
generated_by_zephir? ||
|
|
41
|
-
minified_files? ||
|
|
42
|
-
has_source_map? ||
|
|
43
|
-
source_map? ||
|
|
44
|
-
compiled_coffeescript? ||
|
|
45
|
-
generated_parser? ||
|
|
46
|
-
generated_net_docfile? ||
|
|
47
|
-
generated_postscript? ||
|
|
48
|
-
compiled_cython_file? ||
|
|
49
|
-
pipenv_lock? ||
|
|
50
|
-
generated_go? ||
|
|
51
|
-
generated_protocol_buffer_from_go? ||
|
|
52
|
-
generated_protocol_buffer? ||
|
|
53
|
-
generated_javascript_protocol_buffer? ||
|
|
54
|
-
generated_apache_thrift? ||
|
|
55
|
-
generated_jni_header? ||
|
|
56
|
-
vcr_cassette? ||
|
|
57
|
-
generated_antlr? ||
|
|
58
|
-
generated_module? ||
|
|
59
|
-
generated_unity3d_meta? ||
|
|
60
|
-
generated_racc? ||
|
|
61
|
-
generated_jflex? ||
|
|
62
|
-
generated_grammarkit? ||
|
|
63
|
-
generated_roxygen2? ||
|
|
64
|
-
generated_html? ||
|
|
65
|
-
generated_jison? ||
|
|
66
|
-
generated_grpc_cpp? ||
|
|
67
|
-
generated_dart? ||
|
|
68
|
-
generated_perl_ppport_header? ||
|
|
69
|
-
generated_gamemakerstudio? ||
|
|
70
|
-
generated_gimp? ||
|
|
71
|
-
generated_visualstudio6? ||
|
|
72
|
-
generated_haxe? ||
|
|
73
|
-
generated_jooq? ||
|
|
74
|
-
generated_pascal_tlb? ||
|
|
75
|
-
generated_sorbet_rbi?
|
|
76
|
-
end
|
|
77
|
-
def xcode_file?
|
|
78
|
-
['.nib', '.xcworkspacedata', '.xcuserstate'].include?(extname)
|
|
79
|
-
end
|
|
80
|
-
def intellij_file?
|
|
81
|
-
!!name.match(/(?:^|\/)\.idea\//)
|
|
82
|
-
end
|
|
83
|
-
def cocoapods?
|
|
84
|
-
!!name.match(/(^Pods|\/Pods)\//)
|
|
85
|
-
end
|
|
86
|
-
def carthage_build?
|
|
87
|
-
!!name.match(/(^|\/)Carthage\/Build\//)
|
|
88
|
-
end
|
|
89
|
-
def maybe_minified?
|
|
90
|
-
['.js', '.css'].include? extname.downcase
|
|
91
|
-
end
|
|
92
|
-
def minified_files?
|
|
93
|
-
if maybe_minified? and lines.any?
|
|
94
|
-
(lines.inject(0) { |n, l| n += l.length } / lines.length) > 110
|
|
95
|
-
else
|
|
96
|
-
false
|
|
97
|
-
end
|
|
98
|
-
end
|
|
99
|
-
def has_source_map?
|
|
100
|
-
return false unless maybe_minified?
|
|
101
|
-
lines.last(2).any? { |l| l.match(/^\/[*\/][\#@] source(?:Mapping)?URL|sourceURL=/) }
|
|
102
|
-
end
|
|
103
|
-
def source_map?
|
|
104
|
-
return false unless extname.downcase == '.map'
|
|
105
|
-
|
|
106
|
-
name =~ /(\.css|\.js)\.map$/i ||
|
|
107
|
-
lines[0] =~ /^{"version":\d+,/ ||
|
|
108
|
-
lines[0] =~ /^\/\*\* Begin line maps\. \*\*\/{/
|
|
109
|
-
end
|
|
110
|
-
def compiled_coffeescript?
|
|
111
|
-
return false unless extname == '.js'
|
|
112
|
-
if lines[0] =~ /^\/\/ Generated by /
|
|
113
|
-
return true
|
|
114
|
-
end
|
|
115
|
-
|
|
116
|
-
if lines[0] == '(function() {' &&
|
|
117
|
-
lines[-2] == '}).call(this);' &&
|
|
118
|
-
lines[-1] == ''
|
|
119
|
-
|
|
120
|
-
score = 0
|
|
121
|
-
|
|
122
|
-
lines.each do |line|
|
|
123
|
-
if line =~ /var /
|
|
124
|
-
score += 1 * line.gsub(/(_fn|_i|_len|_ref|_results)/).count
|
|
125
|
-
score += 3 * line.gsub(/(__bind|__extends|__hasProp|__indexOf|__slice)/).count
|
|
126
|
-
end
|
|
127
|
-
end
|
|
128
|
-
score >= 3
|
|
129
|
-
else
|
|
130
|
-
false
|
|
131
|
-
end
|
|
132
|
-
end
|
|
133
|
-
def generated_net_docfile?
|
|
134
|
-
return false unless extname.downcase == ".xml"
|
|
135
|
-
return false unless lines.count > 3
|
|
136
|
-
return lines[1].include?("<doc>") &&
|
|
137
|
-
lines[2].include?("<assembly>") &&
|
|
138
|
-
lines[-2].include?("</doc>")
|
|
139
|
-
end
|
|
140
|
-
def generated_net_designer_file?
|
|
141
|
-
!!name.match(/\.designer\.(cs|vb)$/i)
|
|
142
|
-
end
|
|
143
|
-
def generated_net_specflow_feature_file?
|
|
144
|
-
!!name.match(/\.feature\.cs$/i)
|
|
145
|
-
end
|
|
146
|
-
def generated_parser?
|
|
147
|
-
return false unless extname == '.js'
|
|
148
|
-
if lines[0..4].join('') =~ /^(?:[^\/]|\/[^\*])*\/\*(?:[^\*]|\*[^\/])*Generated by PEG.js/
|
|
149
|
-
return true
|
|
150
|
-
end
|
|
151
|
-
|
|
152
|
-
false
|
|
153
|
-
end
|
|
154
|
-
def generated_postscript?
|
|
155
|
-
return false unless ['.ps', '.eps', '.pfa'].include? extname
|
|
156
|
-
return true if data =~ /(\n|\r\n|\r)\s*(?:currentfile eexec\s+|\/sfnts\s+\[\1<)\h{8,}\1/
|
|
157
|
-
creator = lines[0..9].find {|line| line =~ /^%%Creator: /}
|
|
158
|
-
return false if creator.nil?
|
|
159
|
-
return true if creator =~ /[0-9]|draw|mpage|ImageMagick|inkscape|MATLAB/ ||
|
|
160
|
-
creator =~ /PCBNEW|pnmtops|\(Unknown\)|Serif Affinity|Filterimage -tops/
|
|
161
|
-
!!creator.include?("EAGLE") and lines[0..4].find {|line| line =~ /^%%Title: EAGLE Drawing /}
|
|
162
|
-
end
|
|
163
|
-
|
|
164
|
-
def generated_go?
|
|
165
|
-
return false unless extname == '.go'
|
|
166
|
-
return false unless lines.count > 1
|
|
167
|
-
|
|
168
|
-
return lines.first(40).any? { |l| l =~ %r{^// Code generated .*} }
|
|
169
|
-
end
|
|
170
|
-
def generated_protocol_buffer_from_go?
|
|
171
|
-
return false unless extname == '.proto'
|
|
172
|
-
return false unless lines.count > 1
|
|
173
|
-
|
|
174
|
-
return lines.first(20).any? { |l| l.include? "This file was autogenerated by go-to-protobuf" }
|
|
175
|
-
end
|
|
176
|
-
|
|
177
|
-
PROTOBUF_EXTENSIONS = ['.py', '.java', '.h', '.cc', '.cpp', '.m', '.rb', '.php']
|
|
178
|
-
def generated_protocol_buffer?
|
|
179
|
-
return false unless PROTOBUF_EXTENSIONS.include?(extname)
|
|
180
|
-
return false unless lines.count > 1
|
|
181
|
-
|
|
182
|
-
return lines.first(3).any? { |l| l.include?("Generated by the protocol buffer compiler. DO NOT EDIT!") }
|
|
183
|
-
end
|
|
184
|
-
def generated_javascript_protocol_buffer?
|
|
185
|
-
return false unless extname == ".js"
|
|
186
|
-
return false unless lines.count > 6
|
|
187
|
-
|
|
188
|
-
return lines[5].include?("GENERATED CODE -- DO NOT EDIT!")
|
|
189
|
-
end
|
|
190
|
-
|
|
191
|
-
APACHE_THRIFT_EXTENSIONS = ['.rb', '.py', '.go', '.js', '.m', '.java', '.h', '.cc', '.cpp', '.php']
|
|
192
|
-
def generated_apache_thrift?
|
|
193
|
-
return false unless APACHE_THRIFT_EXTENSIONS.include?(extname)
|
|
194
|
-
return lines.first(6).any? { |l| l.include?("Autogenerated by Thrift Compiler") }
|
|
195
|
-
end
|
|
196
|
-
def generated_jni_header?
|
|
197
|
-
return false unless extname == '.h'
|
|
198
|
-
return false unless lines.count > 2
|
|
199
|
-
|
|
200
|
-
return lines[0].include?("/* DO NOT EDIT THIS FILE - it is machine generated */") &&
|
|
201
|
-
lines[1].include?("#include <jni.h>")
|
|
202
|
-
end
|
|
203
|
-
def node_modules?
|
|
204
|
-
!!name.match(/node_modules\//)
|
|
205
|
-
end
|
|
206
|
-
def go_vendor?
|
|
207
|
-
!!name.match(/vendor\/((?!-)[-0-9A-Za-z]+(?<!-)\.)+(com|edu|gov|in|me|net|org|fm|io)/)
|
|
208
|
-
end
|
|
209
|
-
def go_lock?
|
|
210
|
-
!!name.match(/(Gopkg|glide)\.lock/)
|
|
211
|
-
end
|
|
212
|
-
def poetry_lock?
|
|
213
|
-
!!name.match(/poetry\.lock/)
|
|
214
|
-
end
|
|
215
|
-
def pdm_lock?
|
|
216
|
-
!!name.match(/pdm\.lock/)
|
|
217
|
-
end
|
|
218
|
-
def esy_lock?
|
|
219
|
-
!!name.match(/(^|\/)(\w+\.)?esy.lock$/)
|
|
220
|
-
end
|
|
221
|
-
def npm_shrinkwrap_or_package_lock?
|
|
222
|
-
!!name.match(/npm-shrinkwrap\.json/) || !!name.match(/package-lock\.json/)
|
|
223
|
-
end
|
|
224
|
-
def generated_yarn_plugnplay?
|
|
225
|
-
!!name.match(/(^|\/)\.pnp\..*$/)
|
|
226
|
-
end
|
|
227
|
-
def godeps?
|
|
228
|
-
!!name.match(/Godeps\//)
|
|
229
|
-
end
|
|
230
|
-
def composer_lock?
|
|
231
|
-
!!name.match(/composer\.lock/)
|
|
232
|
-
end
|
|
233
|
-
def generated_by_zephir?
|
|
234
|
-
!!name.match(/.\.zep\.(?:c|h|php)$/)
|
|
235
|
-
end
|
|
236
|
-
def cargo_lock?
|
|
237
|
-
!!name.match(/Cargo\.lock/)
|
|
238
|
-
end
|
|
239
|
-
def flake_lock?
|
|
240
|
-
!!name.match(/(^|\/)flake\.lock$/)
|
|
241
|
-
end
|
|
242
|
-
def vcr_cassette?
|
|
243
|
-
return false unless extname == '.yml'
|
|
244
|
-
return false unless lines.count > 2
|
|
245
|
-
return lines[-2].include?("recorded_with: VCR")
|
|
246
|
-
end
|
|
247
|
-
def generated_antlr?
|
|
248
|
-
return false unless extname == '.g'
|
|
249
|
-
return false unless lines.count > 2
|
|
250
|
-
return lines[1].include?("generated by Xtest")
|
|
251
|
-
end
|
|
252
|
-
def compiled_cython_file?
|
|
253
|
-
return false unless ['.c', '.cpp'].include? extname
|
|
254
|
-
return false unless lines.count > 1
|
|
255
|
-
return lines[0].include?("Generated by Cython")
|
|
256
|
-
end
|
|
257
|
-
def pipenv_lock?
|
|
258
|
-
!!name.match(/Pipfile\.lock/)
|
|
259
|
-
end
|
|
260
|
-
def terraform_lock?
|
|
261
|
-
!!name.match(/(?:^|\/)\.terraform\.lock\.hcl$/)
|
|
262
|
-
end
|
|
263
|
-
def generated_module?
|
|
264
|
-
return false unless extname == '.mod'
|
|
265
|
-
return false unless lines.count > 1
|
|
266
|
-
return lines[0].include?("PCBNEW-LibModule-V") ||
|
|
267
|
-
lines[0].include?("GFORTRAN module version '")
|
|
268
|
-
end
|
|
269
|
-
def generated_unity3d_meta?
|
|
270
|
-
return false unless extname == '.meta'
|
|
271
|
-
return false unless lines.count > 1
|
|
272
|
-
return lines[0].include?("fileFormatVersion: ")
|
|
273
|
-
end
|
|
274
|
-
def generated_racc?
|
|
275
|
-
return false unless extname == '.rb'
|
|
276
|
-
return false unless lines.count > 2
|
|
277
|
-
return lines[2].start_with?("# This file is automatically generated by Racc")
|
|
278
|
-
end
|
|
279
|
-
def generated_jflex?
|
|
280
|
-
return false unless extname == '.java'
|
|
281
|
-
return false unless lines.count > 1
|
|
282
|
-
return lines[0].start_with?("/* The following code was generated by JFlex ")
|
|
283
|
-
end
|
|
284
|
-
def generated_grammarkit?
|
|
285
|
-
return false unless extname == '.java'
|
|
286
|
-
return false unless lines.count > 1
|
|
287
|
-
return lines[0].start_with?("// This is a generated file. Not intended for manual editing.")
|
|
288
|
-
end
|
|
289
|
-
def generated_roxygen2?
|
|
290
|
-
return false unless extname == '.Rd'
|
|
291
|
-
return false unless lines.count > 1
|
|
292
|
-
|
|
293
|
-
return lines[0].include?("% Generated by roxygen2: do not edit by hand")
|
|
294
|
-
end
|
|
295
|
-
def generated_jison?
|
|
296
|
-
return false unless extname == '.js'
|
|
297
|
-
return false unless lines.count > 1
|
|
298
|
-
return lines[0].start_with?("/* parser generated by jison ") ||
|
|
299
|
-
lines[0].start_with?("/* generated by jison-lex ")
|
|
300
|
-
end
|
|
301
|
-
def generated_grpc_cpp?
|
|
302
|
-
return false unless %w{.cpp .hpp .h .cc}.include? extname
|
|
303
|
-
return false unless lines.count > 1
|
|
304
|
-
return lines[0].start_with?("// Generated by the gRPC")
|
|
305
|
-
end
|
|
306
|
-
def generated_dart?
|
|
307
|
-
return false unless extname == '.dart'
|
|
308
|
-
return false unless lines.count > 1
|
|
309
|
-
return lines.first.downcase =~ /generated code\W{2,3}do not modify/
|
|
310
|
-
end
|
|
311
|
-
def generated_perl_ppport_header?
|
|
312
|
-
return false unless name.match(/ppport\.h$/)
|
|
313
|
-
return false unless lines.count > 10
|
|
314
|
-
return lines[8].include?("Automatically created by Devel::PPPort")
|
|
315
|
-
end
|
|
316
|
-
def generated_graphql_relay?
|
|
317
|
-
!!name.match(/__generated__\//)
|
|
318
|
-
end
|
|
319
|
-
def generated_gamemakerstudio?
|
|
320
|
-
return false unless ['.yy', '.yyp'].include? extname
|
|
321
|
-
return false unless lines.count > 3
|
|
322
|
-
return lines[2].match(/\"modelName\"\:\s*\"GM/) ||
|
|
323
|
-
lines[0] =~ /^\d\.\d\.\d.+\|\{/
|
|
324
|
-
end
|
|
325
|
-
def generated_gimp?
|
|
326
|
-
return false unless ['.c', '.h'].include? extname
|
|
327
|
-
return false unless lines.count > 0
|
|
328
|
-
return lines[0].match(/\/\* GIMP [a-zA-Z0-9\- ]+ C\-Source image dump \(.+?\.c\) \*\//) ||
|
|
329
|
-
lines[0].match(/\/\* GIMP header image file format \([a-zA-Z0-9\- ]+\)\: .+?\.h \*\//)
|
|
330
|
-
end
|
|
331
|
-
def generated_visualstudio6?
|
|
332
|
-
return false unless extname.downcase == '.dsp'
|
|
333
|
-
lines.first(3).any? { |l| l.include? '# Microsoft Developer Studio Generated Build File' }
|
|
334
|
-
end
|
|
335
|
-
|
|
336
|
-
HAXE_EXTENSIONS = ['.js', '.py', '.lua', '.cpp', '.h', '.java', '.cs', '.php']
|
|
337
|
-
def generated_haxe?
|
|
338
|
-
return false unless HAXE_EXTENSIONS.include?(extname)
|
|
339
|
-
return lines.first(3).any? { |l| l.include?("Generated by Haxe") }
|
|
340
|
-
end
|
|
341
|
-
def generated_html?
|
|
342
|
-
return false unless ['.html', '.htm', '.xhtml'].include? extname.downcase
|
|
343
|
-
return false unless lines.count > 1
|
|
344
|
-
return true if lines[0..1].any? do |line|
|
|
345
|
-
line.match(/<!-- Generated by pkgdown: do not edit by hand -->/)
|
|
346
|
-
end
|
|
347
|
-
return true if lines.count > 2 && lines[2].start_with?('<!-- This is an automatically generated file.')
|
|
348
|
-
return true if lines[0..30].any? do |line|
|
|
349
|
-
line.match(/<!--\s+Generated by Doxygen\s+[.0-9]+\s*-->/i)
|
|
350
|
-
end
|
|
351
|
-
matches = lines[0..30].join(' ').scan(/<meta(\s+[^>]++)>/i)
|
|
352
|
-
return false if matches.empty?
|
|
353
|
-
return matches.map {|x| extract_html_meta(x) }.any? do |attr|
|
|
354
|
-
attr["name"].to_s.downcase == 'generator' &&
|
|
355
|
-
[attr["content"], attr["value"]].any? do |cv|
|
|
356
|
-
!cv.nil? &&
|
|
357
|
-
cv.match(/^
|
|
358
|
-
( org \s+ mode
|
|
359
|
-
| j?latex2html
|
|
360
|
-
| groff
|
|
361
|
-
| makeinfo
|
|
362
|
-
| texi2html
|
|
363
|
-
| ronn
|
|
364
|
-
) \b
|
|
365
|
-
/ix)
|
|
366
|
-
end
|
|
367
|
-
end
|
|
368
|
-
end
|
|
369
|
-
def generated_jooq?
|
|
370
|
-
return false unless extname.downcase == '.java'
|
|
371
|
-
lines.first(2).any? { |l| l.include? 'This file is generated by jOOQ.' }
|
|
372
|
-
end
|
|
373
|
-
def generated_pascal_tlb?
|
|
374
|
-
!!name.match(/_tlb\.pas$/i)
|
|
375
|
-
end
|
|
376
|
-
def generated_sorbet_rbi?
|
|
377
|
-
return false unless extname.downcase == '.rbi'
|
|
378
|
-
return false unless lines.count >= 5
|
|
379
|
-
lines[0].match?(/^# typed:/) &&
|
|
380
|
-
lines[2].include?("DO NOT EDIT MANUALLY") &&
|
|
381
|
-
lines[4].match?(/^# Please.*run.*`.*tapioca/)
|
|
382
|
-
end
|
|
383
|
-
def extract_html_meta(match)
|
|
384
|
-
(match.last.sub(/\/\Z/, "").strip.scan(/
|
|
385
|
-
(?<=^|\s)
|
|
386
|
-
(name|content|value)
|
|
387
|
-
\s* = \s*
|
|
388
|
-
( "[^"]+"
|
|
389
|
-
| '[^']+'
|
|
390
|
-
| [^\s"']+
|
|
391
|
-
)
|
|
392
|
-
/ix)).map do |match|
|
|
393
|
-
key = match[0].downcase
|
|
394
|
-
val = match[1].gsub(/\A["']|["']\Z/, '')
|
|
395
|
-
[key, val]
|
|
396
|
-
end.select { |x| x.length == 2 }.to_h
|
|
397
|
-
end
|
|
398
|
-
end
|
|
399
|
-
end
|
|
1
|
+
- (?:^|\/)\.idea\/
|
|
2
|
+
- (^Pods|\/Pods)\/
|
|
3
|
+
- (^|\/)Carthage\/Build\/
|
|
4
|
+
- \.designer\.(cs|vb)$
|
|
5
|
+
- \.feature\.cs$
|
|
6
|
+
- node_modules\/
|
|
7
|
+
- vendor\/((?!-)[-0-9A-Za-z]+(?<!-)\.)+(com|edu|gov|in|me|net|org|fm|io)
|
|
8
|
+
- (Gopkg|glide)\.lock
|
|
9
|
+
- poetry\.lock
|
|
10
|
+
- pdm\.lock
|
|
11
|
+
- (^|\/)(\w+\.)?esy.lock$
|
|
12
|
+
- npm-shrinkwrap\.json
|
|
13
|
+
- package-lock\.json
|
|
14
|
+
- (^|\/)\.pnp\..*$
|
|
15
|
+
- Godeps\/
|
|
16
|
+
- composer\.lock
|
|
17
|
+
- .\.zep\.(?:c|h|php)$
|
|
18
|
+
- Cargo\.lock
|
|
19
|
+
- (^|\/)flake\.lock$
|
|
20
|
+
- Pipfile\.lock
|
|
21
|
+
- (?:^|\/)\.terraform\.lock\.hcl$
|
|
22
|
+
- ppport\.h$
|
|
23
|
+
- __generated__\/
|
|
24
|
+
- _tlb\.pas$
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "linguist-js",
|
|
3
|
-
"version": "2.6.
|
|
3
|
+
"version": "2.6.1",
|
|
4
4
|
"description": "Analyse languages used in a folder. Powered by GitHub Linguist, although it doesn't need to be installed.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"bin": {
|
|
@@ -18,8 +18,7 @@
|
|
|
18
18
|
},
|
|
19
19
|
"files": [
|
|
20
20
|
"bin/",
|
|
21
|
-
"dist
|
|
22
|
-
"dist/*.d.ts",
|
|
21
|
+
"dist/",
|
|
23
22
|
"ext/"
|
|
24
23
|
],
|
|
25
24
|
"repository": {
|
|
@@ -42,7 +41,7 @@
|
|
|
42
41
|
"binary-extensions": "^2.2.0",
|
|
43
42
|
"commander": "^9.5.0 <10",
|
|
44
43
|
"common-path-prefix": "^3.0.0",
|
|
45
|
-
"cross-fetch": "^3.1.
|
|
44
|
+
"cross-fetch": "^3.1.8 <4",
|
|
46
45
|
"ignore": "^5.2.4",
|
|
47
46
|
"isbinaryfile": "^4.0.10 <5",
|
|
48
47
|
"js-yaml": "^4.1.0",
|