linguist-js 2.5.0 → 2.5.3

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.
@@ -12,16 +12,25 @@ function pcre(regex) {
12
12
  replace(match, '');
13
13
  [...flags].forEach(flag => finalFlags.add(flag));
14
14
  }
15
- // Remove invalid syntax
15
+ // Remove PCRE-only syntax
16
16
  replace(/([*+]){2}/g, '$1');
17
17
  replace(/\(\?>/g, '(?:');
18
18
  // Remove start/end-of-file markers
19
19
  if (/\\[AZ]/.test(finalRegex)) {
20
- replace(/\\A/g, '^').replace(/\\Z/g, '$');
20
+ replace(/\\A/g, '^');
21
+ replace(/\\Z/g, '$');
21
22
  finalFlags.delete('m');
22
23
  }
23
- else
24
+ else {
24
25
  finalFlags.add('m');
26
+ }
27
+ // Reformat free-spacing mode
28
+ if (finalFlags.has('x')) {
29
+ finalFlags.delete('x');
30
+ replace(/#.+/g, '');
31
+ replace(/^\s+|\s+$|\n/gm, '');
32
+ replace(/\s+/g, ' ');
33
+ }
25
34
  // Return final regex
26
35
  return RegExp(finalRegex, [...finalFlags].join(''));
27
36
  }
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- const promises_1 = __importDefault(require("fs/promises"));
6
+ const fs_1 = __importDefault(require("fs"));
7
7
  const path_1 = __importDefault(require("path"));
8
8
  const cross_fetch_1 = __importDefault(require("cross-fetch"));
9
9
  const node_cache_1 = __importDefault(require("node-cache"));
@@ -21,7 +21,7 @@ async function loadWebFile(file) {
21
21
  }
22
22
  async function loadLocalFile(file) {
23
23
  const filePath = path_1.default.resolve(__dirname, '../../ext', file);
24
- return promises_1.default.readFile(filePath).then(buffer => buffer.toString());
24
+ return fs_1.default.promises.readFile(filePath).then(buffer => buffer.toString());
25
25
  }
26
26
  /** Load a data file from github-linguist. */
27
27
  async function loadFile(file, offline = false) {
package/dist/index.js CHANGED
@@ -14,8 +14,8 @@ const load_data_1 = __importDefault(require("./helpers/load-data"));
14
14
  const read_file_1 = __importDefault(require("./helpers/read-file"));
15
15
  const convert_pcre_1 = __importDefault(require("./helpers/convert-pcre"));
16
16
  async function analyse(input, opts = {}) {
17
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
18
- var _t, _u, _v;
17
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
18
+ var _u, _v, _w;
19
19
  const useRawContent = opts.fileContent !== undefined;
20
20
  input = [input !== null && input !== void 0 ? input : []].flat();
21
21
  opts.fileContent = [(_a = opts.fileContent) !== null && _a !== void 0 ? _a : []].flat();
@@ -28,7 +28,6 @@ async function analyse(input, opts = {}) {
28
28
  const vendorPaths = [...vendorData, ...docData, ...generatedData];
29
29
  // Setup main variables
30
30
  const fileAssociations = {};
31
- const definiteness = {};
32
31
  const extensions = {};
33
32
  const overrides = {};
34
33
  const results = {
@@ -153,6 +152,8 @@ async function analyse(input, opts = {}) {
153
152
  };
154
153
  const overridesArray = Object.entries(overrides);
155
154
  // List all languages that could be associated with a given file
155
+ const definiteness = {};
156
+ const fromShebang = {};
156
157
  for (const file of files) {
157
158
  let firstLine;
158
159
  if (useRawContent) {
@@ -174,22 +175,27 @@ async function analyse(input, opts = {}) {
174
175
  for (const [lang, data] of Object.entries(langData)) {
175
176
  const langMatcher = (lang) => `\\b${lang.toLowerCase().replace(/\W/g, '\\$&')}(?![\\w#+*]|-\*-)`;
176
177
  // Check for interpreter match
177
- const matchesInterpretor = (_f = data.interpreters) === null || _f === void 0 ? void 0 : _f.some(interpreter => firstLine.match(`\\b${interpreter}\\b`));
178
+ if (opts.checkShebang && hasShebang) {
179
+ const matchesInterpretor = (_f = data.interpreters) === null || _f === void 0 ? void 0 : _f.some(interpreter => firstLine.match(`\\b${interpreter}\\b`));
180
+ if (matchesInterpretor)
181
+ matches.push(lang);
182
+ }
178
183
  // Check modeline declaration
179
- const matchesLang = firstLine.toLowerCase().match(langMatcher(lang));
180
- const matchesAlias = (_g = data.aliases) === null || _g === void 0 ? void 0 : _g.some(lang => firstLine.toLowerCase().match(langMatcher(lang)));
181
- // Add language
182
- const interpretorCheck = opts.checkShebang && matchesInterpretor;
183
- const modelineCheck = opts.checkModeline && (matchesLang || matchesAlias);
184
- if (interpretorCheck || modelineCheck) {
185
- matches.push(lang);
184
+ if (opts.checkModeline && hasModeline) {
185
+ const modelineText = firstLine.toLowerCase().replace(/^.*-\*-(.+)-\*-.*$/, '$1');
186
+ const matchesLang = modelineText.match(langMatcher(lang));
187
+ const matchesAlias = (_g = data.aliases) === null || _g === void 0 ? void 0 : _g.some(lang => modelineText.match(langMatcher(lang)));
188
+ if (matchesLang || matchesAlias)
189
+ matches.push(lang);
186
190
  }
187
191
  }
192
+ // Add identified language(s)
188
193
  if (matches.length) {
189
- // Add explicitly-identified language
190
- const forcedLang = matches[0];
191
- addResult(file, forcedLang);
192
- definiteness[file] = true;
194
+ for (const match of matches)
195
+ addResult(file, match);
196
+ if (matches.length === 1)
197
+ definiteness[file] = true;
198
+ fromShebang[file] = true;
193
199
  continue;
194
200
  }
195
201
  }
@@ -206,22 +212,34 @@ async function analyse(input, opts = {}) {
206
212
  }
207
213
  // Search each language
208
214
  let skipExts = false;
215
+ // Check if filename is a match
209
216
  for (const lang in langData) {
210
- // Check if filename is a match
211
217
  const matchesName = (_h = langData[lang].filenames) === null || _h === void 0 ? void 0 : _h.some(name => path_1.default.basename(file.toLowerCase()) === name.toLowerCase());
212
218
  if (matchesName) {
213
219
  addResult(file, lang);
214
220
  skipExts = true;
215
221
  }
216
222
  }
223
+ // Check if extension is a match
224
+ const possibleExts = [];
217
225
  if (!skipExts)
218
226
  for (const lang in langData) {
219
- // Check if extension is a match
220
- const matchesExt = (_j = langData[lang].extensions) === null || _j === void 0 ? void 0 : _j.some(ext => file.toLowerCase().endsWith(ext.toLowerCase()));
221
- if (matchesExt) {
222
- addResult(file, lang);
227
+ const extMatches = (_j = langData[lang].extensions) === null || _j === void 0 ? void 0 : _j.filter(ext => file.toLowerCase().endsWith(ext.toLowerCase()));
228
+ if (extMatches === null || extMatches === void 0 ? void 0 : extMatches.length) {
229
+ for (const ext of extMatches)
230
+ possibleExts.push({ ext, lang });
223
231
  }
224
232
  }
233
+ // Apply more specific extension if available
234
+ const isComplexExt = (ext) => /\..+\./.test(ext);
235
+ const hasComplexExt = possibleExts.some(data => isComplexExt(data.ext));
236
+ for (const { ext, lang } of possibleExts) {
237
+ if (hasComplexExt && !isComplexExt(ext))
238
+ continue;
239
+ if (!hasComplexExt && isComplexExt(ext))
240
+ continue;
241
+ addResult(file, lang);
242
+ }
225
243
  // Fallback to null if no language matches
226
244
  if (!fileAssociations[file]) {
227
245
  addResult(file, null);
@@ -247,9 +265,8 @@ async function analyse(input, opts = {}) {
247
265
  if (opts.checkHeuristics)
248
266
  for (const heuristics of heuristicsData.disambiguations) {
249
267
  // Make sure the extension matches the current file
250
- if (!heuristics.extensions.includes(extensions[file])) {
268
+ if (!fromShebang[file] && !heuristics.extensions.includes(extensions[file]))
251
269
  continue;
252
- }
253
270
  // Load heuristic rules
254
271
  for (const heuristic of heuristics.rules) {
255
272
  // Make sure the language is not an array
@@ -269,8 +286,16 @@ async function analyse(input, opts = {}) {
269
286
  normalise(heuristic.pattern);
270
287
  if (heuristic.named_pattern)
271
288
  normalise(heuristicsData.named_patterns[heuristic.named_pattern]);
289
+ if (heuristic.and) {
290
+ for (const data of heuristic.and) {
291
+ if (data.pattern)
292
+ normalise(data.pattern);
293
+ if (data.named_pattern)
294
+ normalise(heuristicsData.named_patterns[data.named_pattern]);
295
+ }
296
+ }
272
297
  // Check file contents and apply heuristic patterns
273
- const fileContent = opts.fileContent ? opts.fileContent[files.indexOf(file)] : await (0, read_file_1.default)(file).catch(() => null);
298
+ const fileContent = ((_l = opts.fileContent) === null || _l === void 0 ? void 0 : _l.length) ? opts.fileContent[files.indexOf(file)] : await (0, read_file_1.default)(file).catch(() => null);
274
299
  if (fileContent === null)
275
300
  continue;
276
301
  if (!patterns.length || patterns.some(pattern => (0, convert_pcre_1.default)(pattern).test(fileContent))) {
@@ -280,10 +305,10 @@ async function analyse(input, opts = {}) {
280
305
  }
281
306
  }
282
307
  // If no heuristics, assign a language
283
- (_l = (_t = results.files.results)[file]) !== null && _l !== void 0 ? _l : (_t[file] = fileAssociations[file][0]);
308
+ (_m = (_u = results.files.results)[file]) !== null && _m !== void 0 ? _m : (_u[file] = fileAssociations[file][0]);
284
309
  }
285
310
  // Skip specified categories
286
- if ((_m = opts.categories) === null || _m === void 0 ? void 0 : _m.length) {
311
+ if ((_o = opts.categories) === null || _o === void 0 ? void 0 : _o.length) {
287
312
  const categories = ['data', 'markup', 'programming', 'prose'];
288
313
  const hiddenCategories = categories.filter(cat => !opts.categories.includes(cat));
289
314
  for (const [file, lang] of Object.entries(results.files.results)) {
@@ -319,21 +344,21 @@ async function analyse(input, opts = {}) {
319
344
  for (const [file, lang] of Object.entries(results.files.results)) {
320
345
  if (lang && !langData[lang])
321
346
  continue;
322
- const fileSize = (_q = (_p = (_o = opts.fileContent) === null || _o === void 0 ? void 0 : _o[files.indexOf(file)]) === null || _p === void 0 ? void 0 : _p.length) !== null && _q !== void 0 ? _q : fs_1.default.statSync(file).size;
347
+ const fileSize = (_r = (_q = (_p = opts.fileContent) === null || _p === void 0 ? void 0 : _p[files.indexOf(file)]) === null || _q === void 0 ? void 0 : _q.length) !== null && _r !== void 0 ? _r : fs_1.default.statSync(file).size;
323
348
  results.files.bytes += fileSize;
324
349
  // If no language found, add extension in other section
325
350
  if (!lang) {
326
351
  const ext = path_1.default.extname(file);
327
352
  const unknownType = ext === '' ? 'filenames' : 'extensions';
328
353
  const name = ext === '' ? path_1.default.basename(file) : ext;
329
- (_r = (_u = results.unknown[unknownType])[name]) !== null && _r !== void 0 ? _r : (_u[name] = 0);
354
+ (_s = (_v = results.unknown[unknownType])[name]) !== null && _s !== void 0 ? _s : (_v[name] = 0);
330
355
  results.unknown[unknownType][name] += fileSize;
331
356
  results.unknown.bytes += fileSize;
332
357
  continue;
333
358
  }
334
359
  // Add language and bytes data to corresponding section
335
360
  const { type } = langData[lang];
336
- (_s = (_v = results.languages.results)[lang]) !== null && _s !== void 0 ? _s : (_v[lang] = { type, bytes: 0, color: langData[lang].color });
361
+ (_t = (_w = results.languages.results)[lang]) !== null && _t !== void 0 ? _t : (_w[lang] = { type, bytes: 0, color: langData[lang].color });
337
362
  if (opts.childLanguages) {
338
363
  results.languages.results[lang].parent = langData[lang].group;
339
364
  }
package/ext/generated.rb CHANGED
@@ -146,7 +146,7 @@ module Linguist
146
146
  !!creator.include?("EAGLE") and lines[0..4].find {|line| line =~ /^%%Title: EAGLE Drawing /}
147
147
  end def generated_go?
148
148
  return false unless extname == '.go'
149
- return false unless lines.count > 1 return lines.first(40).any? { |l| l.include? "Code generated by" }
149
+ return false unless lines.count > 1 return lines.first(40).any? { |l| l =~ %r{^// Code generated .*} }
150
150
  end
151
151
  def generated_protocol_buffer_from_go?
152
152
  return false unless extname == '.proto'
@@ -65,10 +65,32 @@ disambiguations:
65
65
  pattern: '(<^\s*; |End Function)'
66
66
  - language: BitBake
67
67
  pattern: '^\s*(# |include|require)\b'
68
+ - language: Clojure
69
+ pattern: '\((def|defn|defmacro|let)\s'
70
+ - extensions: ['.bf']
71
+ rules:
72
+ - language: Beef
73
+ pattern: '(?-m)^\s*using\s+(System|Beefy)(\.(.*))?;\s*$'
74
+ - language: HyPhy
75
+ pattern:
76
+ - '(?-m)^\s*#include\s+".*";\s*$'
77
+ - '\sfprintf\s*\('
78
+ - language: Brainfuck
79
+ pattern: '(>\+>|>\+<)'
68
80
  - extensions: ['.bi']
69
81
  rules:
70
82
  - language: FreeBasic
71
83
  pattern: '^[ \t]*#(?:define|endif|endmacro|ifn?def|if|include|lang|macro)\s'
84
+ - extensions: ['.bs']
85
+ rules:
86
+ - language: Bikeshed
87
+ pattern: '^(?i:<pre\s+class)\s*=\s*(''|\"|\b)metadata\b\1[^>\r\n]*>'
88
+ - language: BrighterScript
89
+ pattern:
90
+ - (?i:^\s*(?=^sub\s)(?:sub\s*\w+\(.*?\))|(?::\s*sub\(.*?\))$)
91
+ - (?i:^\s*(end\ssub)$)
92
+ - (?i:^\s*(?=^function\s)(?:function\s*\w+\(.*?\)\s*as\s*\w*)|(?::\s*function\(.*?\)\s*as\s*\w*)$)
93
+ - (?i:^\s*(end\sfunction)$)
72
94
  - extensions: ['.builds']
73
95
  rules:
74
96
  - language: XML
@@ -100,7 +122,7 @@ disambiguations:
100
122
  - language: Smalltalk
101
123
  pattern: '![\w\s]+methodsFor: '
102
124
  - language: 'C#'
103
- pattern: '^(\s*namespace\s*[\w\.]+\s*{|\s*\/\/)'
125
+ pattern: '^\s*(using\s+[A-Z][\s\w.]+;|namespace\s*[\w\.]+\s*({|;)|\/\/)'
104
126
  - extensions: ['.csc']
105
127
  rules:
106
128
  - language: GSC
@@ -197,6 +219,12 @@ disambiguations:
197
219
  pattern: '^(?:<|[a-zA-Z-][a-zA-Z0-9_-]+[ \t]+\w)|\${\w+[^\n]*?}|^[ \t]*(?:<#--.*?-->|<#([a-z]+)(?=\s|>)[^>]*>.*?</#\1>|\[#--.*?--\]|\[#([a-z]+)(?=\s|\])[^\]]*\].*?\[#\2\])'
198
220
  - language: Fluent
199
221
  pattern: '^-?[a-zA-Z][a-zA-Z0-9_-]* *=|\{\$-?[a-zA-Z][-\w]*(?:\.[a-zA-Z][-\w]*)?\}'
222
+ - extensions: ['.g']
223
+ rules:
224
+ - language: GAP
225
+ pattern: '\s*(Declare|BindGlobal|KeyDependentOperation|Install(Method|GlobalFunction)|SetPackageInfo)'
226
+ - language: G-code
227
+ pattern: '^[MG][0-9]+\n'
200
228
  - extensions: ['.gd']
201
229
  rules:
202
230
  - language: GAP
@@ -446,7 +474,7 @@ disambiguations:
446
474
  - pattern: HEADERS
447
475
  - pattern: SOURCES
448
476
  - language: IDL
449
- pattern: '^\s*function[ \w,]+$'
477
+ pattern: '^\s*(?i:function|pro|compile_opt) \w[ \w,:]*$'
450
478
  - extensions: ['.properties']
451
479
  rules:
452
480
  - language: INI
@@ -525,6 +553,12 @@ disambiguations:
525
553
  pattern: '(?i:\^(this|super)\.|^\s*~\w+\s*=\.)'
526
554
  - language: Scala
527
555
  pattern: '(^\s*import (scala|java)\.|^\s*class\b)'
556
+ - extensions: ['.scd']
557
+ rules:
558
+ - language: SuperCollider
559
+ pattern: '(?i:\^(this|super)\.|^\s*(~\w+\s*=\.|SynthDef\b))'
560
+ - language: Markdown
561
+ pattern: '^#+\s+(NAME|SYNOPSIS|DESCRIPTION)'
528
562
  - extensions: ['.sol']
529
563
  rules:
530
564
  - language: Solidity
@@ -552,6 +586,15 @@ disambiguations:
552
586
  pattern: '\$\w+[($]|(.)!\s*.+?\s*!\1|<!\s*.+?\s*!>|\[!\s*.+?\s*!\]|\{!\s*.+?\s*!\}'
553
587
  - language: Smalltalk
554
588
  pattern: '\A\s*[\[{(^"''\w#]|[a-zA-Z_]\w*\s*:=\s*[a-zA-Z_]\w*|class\s*>>\s*[a-zA-Z_]\w*|^[a-zA-Z_]\w*\s+[a-zA-Z_]\w*:|^Class\s*{|if(?:True|False):\s*\['
589
+ - extensions: ['.star']
590
+ rules:
591
+ - language: STAR
592
+ pattern: '^loop_\s*$'
593
+ - language: Starlark
594
+ - extensions: ['.stl']
595
+ rules:
596
+ - language: STL
597
+ pattern: '\A\s*solid(?=$|\s)(?m:.*?)\Rendsolid(?:$|\s)'
555
598
  - extensions: ['.t']
556
599
  rules:
557
600
  - language: Perl
@@ -586,6 +629,27 @@ disambiguations:
586
629
  rules:
587
630
  - language: Vim Help File
588
631
  pattern: '(?:(?:^|[ \t])(?:vi|Vi(?=m))(?:m[<=>]?[0-9]+|m)?|[ \t]ex)(?=:(?=[ \t]*set?[ \t][^\r\n:]+:)|:(?![ \t]*set?[ \t]))(?:(?:[ \t]*:[ \t]*|[ \t])\w*(?:[ \t]*=(?:[^\\\s]|\\.)*)?)*[ \t:](?:filetype|ft|syntax)[ \t]*=(help)(?=$|\s|:)'
632
+ - language: Adblock Filter List
633
+ pattern: |-
634
+ (?x)\A
635
+ \[
636
+ (?<version>
637
+ (?:
638
+ [Aa]d[Bb]lock
639
+ (?:[ \t][Pp]lus)?
640
+ |
641
+ u[Bb]lock
642
+ (?:[ \t][Oo]rigin)?
643
+ |
644
+ [Aa]d[Gg]uard
645
+ )
646
+ (?:[ \t] \d+(?:\.\d+)*+)?
647
+ )
648
+ (?:
649
+ [ \t]?;[ \t]?
650
+ \g<version>
651
+ )*+
652
+ \]
589
653
  - language: Text
590
654
  - extensions: ['.url']
591
655
  rules:
package/ext/languages.yml CHANGED
@@ -192,6 +192,19 @@ Ada:
192
192
  tm_scope: source.ada
193
193
  ace_mode: ada
194
194
  language_id: 11
195
+ Adblock Filter List:
196
+ type: data
197
+ color: "#800000"
198
+ ace_mode: text
199
+ extensions:
200
+ - ".txt"
201
+ aliases:
202
+ - ad block filters
203
+ - ad block
204
+ - adb
205
+ - adblock
206
+ tm_scope: text.adblock
207
+ language_id: 884614762
195
208
  Adobe Font Metrics:
196
209
  type: data
197
210
  color: "#fa0f00"
@@ -270,6 +283,16 @@ Ant Build System:
270
283
  codemirror_mode: xml
271
284
  codemirror_mime_type: application/xml
272
285
  language_id: 15
286
+ Antlers:
287
+ type: markup
288
+ color: "#ff269e"
289
+ extensions:
290
+ - ".antlers.html"
291
+ - ".antlers.php"
292
+ - ".antlers.xml"
293
+ tm_scope: text.html.statamic
294
+ ace_mode: text
295
+ language_id: 1067292663
273
296
  ApacheConf:
274
297
  type: data
275
298
  color: "#d12127"
@@ -356,6 +379,7 @@ Assembly:
356
379
  - ".a51"
357
380
  - ".i"
358
381
  - ".inc"
382
+ - ".nas"
359
383
  - ".nasm"
360
384
  tm_scope: source.assembly
361
385
  ace_mode: assembly_x86
@@ -482,6 +506,7 @@ Befunge:
482
506
  type: programming
483
507
  extensions:
484
508
  - ".befunge"
509
+ - ".bf"
485
510
  tm_scope: source.befunge
486
511
  ace_mode: text
487
512
  language_id: 30
@@ -515,6 +540,16 @@ Bicep:
515
540
  tm_scope: source.bicep
516
541
  ace_mode: text
517
542
  language_id: 321200902
543
+ Bikeshed:
544
+ type: markup
545
+ color: "#5562ac"
546
+ extensions:
547
+ - ".bs"
548
+ tm_scope: source.csswg
549
+ ace_mode: html
550
+ codemirror_mode: htmlmixed
551
+ codemirror_mime_type: text/html
552
+ language_id: 1055528081
518
553
  Bison:
519
554
  type: programming
520
555
  color: "#6A463F"
@@ -602,12 +637,20 @@ Brainfuck:
602
637
  codemirror_mode: brainfuck
603
638
  codemirror_mime_type: text/x-brainfuck
604
639
  language_id: 38
640
+ BrighterScript:
641
+ type: programming
642
+ color: "#66AABB"
643
+ extensions:
644
+ - ".bs"
645
+ tm_scope: source.brs
646
+ ace_mode: text
647
+ language_id: 943571030
605
648
  Brightscript:
606
649
  type: programming
607
650
  color: "#662D91"
608
651
  extensions:
609
652
  - ".brs"
610
- tm_scope: source.brightscript
653
+ tm_scope: source.brs
611
654
  ace_mode: text
612
655
  language_id: 39
613
656
  Browserslist:
@@ -699,6 +742,16 @@ C2hs Haskell:
699
742
  codemirror_mode: haskell
700
743
  codemirror_mime_type: text/x-haskell
701
744
  language_id: 45
745
+ CAP CDS:
746
+ type: programming
747
+ tm_scope: source.cds
748
+ color: "#0092d1"
749
+ aliases:
750
+ - cds
751
+ extensions:
752
+ - ".cds"
753
+ ace_mode: text
754
+ language_id: 390788699
702
755
  CIL:
703
756
  type: data
704
757
  tm_scope: source.cil
@@ -885,6 +938,39 @@ Charity:
885
938
  tm_scope: none
886
939
  ace_mode: text
887
940
  language_id: 56
941
+ Checksums:
942
+ type: data
943
+ tm_scope: text.checksums
944
+ aliases:
945
+ - checksum
946
+ - hash
947
+ - hashes
948
+ - sum
949
+ - sums
950
+ filenames:
951
+ - MD5SUMS
952
+ - SHA1SUMS
953
+ - SHA256SUMS
954
+ - SHA256SUMS.txt
955
+ - SHA512SUMS
956
+ - checksums.txt
957
+ - cksums
958
+ - md5sum.txt
959
+ extensions:
960
+ - ".crc32"
961
+ - ".md2"
962
+ - ".md4"
963
+ - ".md5"
964
+ - ".sha1"
965
+ - ".sha2"
966
+ - ".sha224"
967
+ - ".sha256"
968
+ - ".sha256sum"
969
+ - ".sha3"
970
+ - ".sha384"
971
+ - ".sha512"
972
+ ace_mode: text
973
+ language_id: 372063053
888
974
  ChucK:
889
975
  type: programming
890
976
  color: "#3f8000"
@@ -955,6 +1041,7 @@ Clojure:
955
1041
  color: "#db5855"
956
1042
  extensions:
957
1043
  - ".clj"
1044
+ - ".bb"
958
1045
  - ".boot"
959
1046
  - ".cl2"
960
1047
  - ".cljc"
@@ -965,6 +1052,8 @@ Clojure:
965
1052
  - ".hic"
966
1053
  filenames:
967
1054
  - riemann.config
1055
+ interpreters:
1056
+ - bb
968
1057
  language_id: 62
969
1058
  Closure Templates:
970
1059
  type: markup
@@ -1591,6 +1680,16 @@ Elm:
1591
1680
  codemirror_mode: elm
1592
1681
  codemirror_mime_type: text/x-elm
1593
1682
  language_id: 101
1683
+ Elvish:
1684
+ type: programming
1685
+ ace_mode: text
1686
+ extensions:
1687
+ - ".elv"
1688
+ interpreters:
1689
+ - elvish
1690
+ tm_scope: source.elvish
1691
+ color: "#55BB55"
1692
+ language_id: 570996448
1594
1693
  Emacs Lisp:
1595
1694
  type: programming
1596
1695
  tm_scope: source.emacs.lisp
@@ -1685,6 +1784,7 @@ F*:
1685
1784
  - fstar
1686
1785
  extensions:
1687
1786
  - ".fst"
1787
+ - ".fsti"
1688
1788
  tm_scope: source.fstar
1689
1789
  ace_mode: text
1690
1790
  language_id: 336943375
@@ -2020,6 +2120,17 @@ Gemfile.lock:
2020
2120
  filenames:
2021
2121
  - Gemfile.lock
2022
2122
  language_id: 907065713
2123
+ Gemini:
2124
+ type: prose
2125
+ color: "#ff6900"
2126
+ ace_mode: text
2127
+ extensions:
2128
+ - ".gmi"
2129
+ aliases:
2130
+ - gemtext
2131
+ wrap: true
2132
+ tm_scope: source.gemini
2133
+ language_id: 310828396
2023
2134
  Genero:
2024
2135
  type: programming
2025
2136
  color: "#63408e"
@@ -2158,6 +2269,16 @@ Git Config:
2158
2269
  codemirror_mime_type: text/x-properties
2159
2270
  tm_scope: source.gitconfig
2160
2271
  language_id: 807968997
2272
+ Git Revision List:
2273
+ type: data
2274
+ color: "#F44D27"
2275
+ aliases:
2276
+ - Git Blame Ignore Revs
2277
+ filenames:
2278
+ - ".git-blame-ignore-revs"
2279
+ tm_scope: source.git-revlist
2280
+ ace_mode: text
2281
+ language_id: 461881235
2161
2282
  Gleam:
2162
2283
  type: programming
2163
2284
  color: "#ffaff3"
@@ -2374,6 +2495,14 @@ HLSL:
2374
2495
  ace_mode: text
2375
2496
  tm_scope: source.hlsl
2376
2497
  language_id: 145
2498
+ HOCON:
2499
+ type: data
2500
+ color: "#9ff8ee"
2501
+ extensions:
2502
+ - ".hocon"
2503
+ tm_scope: source.hocon
2504
+ ace_mode: text
2505
+ language_id: 679725279
2377
2506
  HTML:
2378
2507
  type: markup
2379
2508
  tm_scope: text.html.basic
@@ -2626,8 +2755,11 @@ INI:
2626
2755
  - ".properties"
2627
2756
  - ".url"
2628
2757
  filenames:
2758
+ - ".coveragerc"
2629
2759
  - ".flake8"
2760
+ - ".pylintrc"
2630
2761
  - buildozer.spec
2762
+ - pylintrc
2631
2763
  tm_scope: source.ini
2632
2764
  aliases:
2633
2765
  - dosini
@@ -2794,8 +2926,14 @@ JSON:
2794
2926
  ace_mode: json
2795
2927
  codemirror_mode: javascript
2796
2928
  codemirror_mime_type: application/json
2929
+ aliases:
2930
+ - geojson
2931
+ - jsonl
2932
+ - topojson
2797
2933
  extensions:
2798
2934
  - ".json"
2935
+ - ".4DForm"
2936
+ - ".4DProject"
2799
2937
  - ".avsc"
2800
2938
  - ".geojson"
2801
2939
  - ".gltf"
@@ -3020,6 +3158,20 @@ Jest Snapshot:
3020
3158
  codemirror_mode: javascript
3021
3159
  codemirror_mime_type: application/javascript
3022
3160
  language_id: 774635084
3161
+ JetBrains MPS:
3162
+ type: programming
3163
+ aliases:
3164
+ - mps
3165
+ color: "#21D789"
3166
+ extensions:
3167
+ - ".mps"
3168
+ - ".mpl"
3169
+ - ".msd"
3170
+ ace_mode: xml
3171
+ codemirror_mode: xml
3172
+ codemirror_mime_type: text/xml
3173
+ tm_scope: none
3174
+ language_id: 465165328
3023
3175
  Jinja:
3024
3176
  type: markup
3025
3177
  color: "#a52a22"
@@ -3164,6 +3316,7 @@ KiCad Schematic:
3164
3316
  aliases:
3165
3317
  - eeschema schematic
3166
3318
  extensions:
3319
+ - ".kicad_sch"
3167
3320
  - ".sch"
3168
3321
  tm_scope: source.pcb.schematic
3169
3322
  ace_mode: text
@@ -3193,6 +3346,7 @@ Kusto:
3193
3346
  type: data
3194
3347
  extensions:
3195
3348
  - ".csl"
3349
+ - ".kql"
3196
3350
  tm_scope: source.kusto
3197
3351
  ace_mode: text
3198
3352
  language_id: 225697190
@@ -3653,6 +3807,7 @@ Markdown:
3653
3807
  wrap: true
3654
3808
  extensions:
3655
3809
  - ".md"
3810
+ - ".livemd"
3656
3811
  - ".markdown"
3657
3812
  - ".mdown"
3658
3813
  - ".mdwn"
@@ -3917,6 +4072,14 @@ Motorola 68K Assembly:
3917
4072
  tm_scope: source.m68k
3918
4073
  ace_mode: assembly_x86
3919
4074
  language_id: 477582706
4075
+ Move:
4076
+ type: programming
4077
+ color: "#4a137a"
4078
+ extensions:
4079
+ - ".move"
4080
+ tm_scope: source.move
4081
+ ace_mode: text
4082
+ language_id: 638334599
3920
4083
  Muse:
3921
4084
  type: prose
3922
4085
  extensions:
@@ -4009,6 +4172,14 @@ NWScript:
4009
4172
  codemirror_mode: clike
4010
4173
  codemirror_mime_type: text/x-csrc
4011
4174
  language_id: 731233819
4175
+ Nasal:
4176
+ type: programming
4177
+ color: "#1d2c4e"
4178
+ extensions:
4179
+ - ".nas"
4180
+ tm_scope: none
4181
+ ace_mode: text
4182
+ language_id: 178322513
4012
4183
  Nearley:
4013
4184
  type: programming
4014
4185
  ace_mode: text
@@ -4712,6 +4883,14 @@ Pony:
4712
4883
  tm_scope: source.pony
4713
4884
  ace_mode: text
4714
4885
  language_id: 290
4886
+ Portugol:
4887
+ type: programming
4888
+ color: "#f8bd00"
4889
+ extensions:
4890
+ - ".por"
4891
+ tm_scope: source.portugol
4892
+ ace_mode: text
4893
+ language_id: 832391833
4715
4894
  PostCSS:
4716
4895
  type: markup
4717
4896
  color: "#dc3a0c"
@@ -5460,6 +5639,16 @@ Rouge:
5460
5639
  - ".rg"
5461
5640
  tm_scope: source.clojure
5462
5641
  language_id: 325
5642
+ RouterOS Script:
5643
+ type: programming
5644
+ ace_mode: text
5645
+ extensions:
5646
+ - ".rsc"
5647
+ interpreters:
5648
+ - RouterOS
5649
+ color: "#DE3941"
5650
+ tm_scope: none
5651
+ language_id: 592853203
5463
5652
  Ruby:
5464
5653
  type: programming
5465
5654
  tm_scope: source.ruby
@@ -5667,6 +5856,24 @@ SSH Config:
5667
5856
  ace_mode: text
5668
5857
  tm_scope: source.ssh-config
5669
5858
  language_id: 554920715
5859
+ STAR:
5860
+ type: data
5861
+ extensions:
5862
+ - ".star"
5863
+ tm_scope: source.star
5864
+ ace_mode: text
5865
+ language_id: 424510560
5866
+ STL:
5867
+ type: data
5868
+ color: "#373b5e"
5869
+ aliases:
5870
+ - ascii stl
5871
+ - stla
5872
+ extensions:
5873
+ - ".stl"
5874
+ tm_scope: source.stl
5875
+ ace_mode: text
5876
+ language_id: 455361735
5670
5877
  STON:
5671
5878
  type: data
5672
5879
  group: Smalltalk
@@ -6061,6 +6268,7 @@ Starlark:
6061
6268
  color: "#76d275"
6062
6269
  extensions:
6063
6270
  - ".bzl"
6271
+ - ".star"
6064
6272
  filenames:
6065
6273
  - BUCK
6066
6274
  - BUILD
@@ -6115,7 +6323,6 @@ SugarSS:
6115
6323
  type: markup
6116
6324
  color: "#2fcc9f"
6117
6325
  tm_scope: source.css.postcss.sugarss
6118
- group: CSS
6119
6326
  extensions:
6120
6327
  - ".sss"
6121
6328
  ace_mode: text
@@ -6216,7 +6423,7 @@ TSV:
6216
6423
  language_id: 1035892117
6217
6424
  TSX:
6218
6425
  type: programming
6219
- color: "#2b7489"
6426
+ color: "#3178c6"
6220
6427
  group: TypeScript
6221
6428
  extensions:
6222
6429
  - ".tsx"
@@ -6442,7 +6649,7 @@ Type Language:
6442
6649
  language_id: 632765617
6443
6650
  TypeScript:
6444
6651
  type: programming
6445
- color: "#2b7489"
6652
+ color: "#3178c6"
6446
6653
  aliases:
6447
6654
  - ts
6448
6655
  interpreters:
@@ -6450,6 +6657,8 @@ TypeScript:
6450
6657
  - ts-node
6451
6658
  extensions:
6452
6659
  - ".ts"
6660
+ - ".cts"
6661
+ - ".mts"
6453
6662
  tm_scope: source.ts
6454
6663
  ace_mode: typescript
6455
6664
  codemirror_mode: javascript
@@ -6488,6 +6697,10 @@ Unix Assembly:
6488
6697
  extensions:
6489
6698
  - ".s"
6490
6699
  - ".ms"
6700
+ aliases:
6701
+ - gas
6702
+ - gnu asm
6703
+ - unix asm
6491
6704
  tm_scope: source.x86
6492
6705
  ace_mode: assembly_x86
6493
6706
  language_id: 120
@@ -6608,6 +6821,19 @@ Valve Data Format:
6608
6821
  ace_mode: text
6609
6822
  tm_scope: source.keyvalues
6610
6823
  language_id: 544060961
6824
+ Velocity Template Language:
6825
+ type: markup
6826
+ color: "#507cff"
6827
+ aliases:
6828
+ - vtl
6829
+ - velocity
6830
+ extensions:
6831
+ - ".vtl"
6832
+ ace_mode: velocity
6833
+ tm_scope: source.velocity
6834
+ codemirror_mode: velocity
6835
+ codemirror_mime_type: text/velocity
6836
+ language_id: 292377326
6611
6837
  Verilog:
6612
6838
  type: programming
6613
6839
  color: "#b2b7f8"
@@ -6759,9 +6985,11 @@ WebIDL:
6759
6985
  WebVTT:
6760
6986
  type: data
6761
6987
  wrap: true
6988
+ aliases:
6989
+ - vtt
6762
6990
  extensions:
6763
6991
  - ".vtt"
6764
- tm_scope: source.vtt
6992
+ tm_scope: text.vtt
6765
6993
  ace_mode: text
6766
6994
  language_id: 658679714
6767
6995
  Wget Config:
@@ -6774,6 +7002,14 @@ Wget Config:
6774
7002
  tm_scope: source.wgetrc
6775
7003
  ace_mode: text
6776
7004
  language_id: 668457123
7005
+ Whiley:
7006
+ type: programming
7007
+ color: "#d5c397"
7008
+ extensions:
7009
+ - ".whiley"
7010
+ tm_scope: source.whiley
7011
+ ace_mode: text
7012
+ language_id: 888779559
6777
7013
  Wikitext:
6778
7014
  type: prose
6779
7015
  color: "#fc5757"
@@ -6831,6 +7067,16 @@ World of Warcraft Addon Data:
6831
7067
  tm_scope: source.toc
6832
7068
  ace_mode: text
6833
7069
  language_id: 396
7070
+ Wren:
7071
+ type: programming
7072
+ color: "#383838"
7073
+ aliases:
7074
+ - wrenlang
7075
+ extensions:
7076
+ - ".wren"
7077
+ tm_scope: source.wren
7078
+ ace_mode: text
7079
+ language_id: 713580619
6834
7080
  X BitMap:
6835
7081
  type: data
6836
7082
  group: C
@@ -6963,6 +7209,7 @@ XML:
6963
7209
  - ".ps1xml"
6964
7210
  - ".psc1"
6965
7211
  - ".pt"
7212
+ - ".qhelp"
6966
7213
  - ".rdf"
6967
7214
  - ".res"
6968
7215
  - ".resx"
package/ext/vendor.yml CHANGED
@@ -29,7 +29,7 @@
29
29
  - (^|/)\.indent\.pro
30
30
  - (\.|-)min\.(js|css)$
31
31
  - ([^\s]*)import\.(css|less|scss|styl)$
32
- - (^|/)bootstrap([^/.]*)\.(js|css|less|scss|styl)$
32
+ - (^|/)bootstrap([^/.]*)(?=\.).*\.(js|css|less|scss|styl)$
33
33
  - (^|/)custom\.bootstrap([^\s]*)(js|css|less|scss|styl)$
34
34
  - (^|/)font-?awesome\.(css|less|scss|styl)$
35
35
  - (^|/)font-?awesome/.*\.(css|less|scss|styl)$
@@ -163,3 +163,4 @@
163
163
  - (^|/)\.google_apis/
164
164
  - (^|/)Jenkinsfile$
165
165
  - (^|/)\.gitpod\.Dockerfile$
166
+ - (^|/)\.github/
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "linguist-js",
3
- "version": "2.5.0",
3
+ "version": "2.5.3",
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": {
@@ -11,7 +11,7 @@
11
11
  "node": ">=12"
12
12
  },
13
13
  "scripts": {
14
- "download-files": "npx tsx build/download-files",
14
+ "download-files": "npx tsx@2 build/download-files",
15
15
  "prepare": "npm run download-files && npm test && npm run perf",
16
16
  "perf": "tsc && node test/perf",
17
17
  "test": "tsc && node test/folder && echo --- && node test/unit"
@@ -40,7 +40,7 @@
40
40
  "homepage": "https://github.com/Nixinova/Linguist#readme",
41
41
  "dependencies": {
42
42
  "binary-extensions": "^2.2.0",
43
- "commander": "^9.2.0",
43
+ "commander": "^9.4.0",
44
44
  "common-path-prefix": "^3.0.0",
45
45
  "cross-fetch": "^3.1.5",
46
46
  "ignore": "^5.2.0",
@@ -49,10 +49,9 @@
49
49
  "node-cache": "^5.1.2"
50
50
  },
51
51
  "devDependencies": {
52
- "@types/glob-to-regexp": "ts4.6",
53
- "@types/js-yaml": "ts4.6",
54
- "@types/node": "ts4.6",
52
+ "@types/js-yaml": "^4.0.5",
53
+ "@types/node": "ts4.8",
55
54
  "deep-object-diff": "^1.1.7",
56
- "typescript": "~4.6.4"
55
+ "typescript": "~4.8.2"
57
56
  }
58
57
  }
package/readme.md CHANGED
@@ -77,8 +77,7 @@ Running LinguistJS on this folder will return the following JSON:
77
77
  ### Notes
78
78
 
79
79
  - File paths in the output use only forward slashes as delimiters, even on Windows.
80
- - This tool does not work when offline.
81
- - Do not rely on any language classification output from LinguistJS being unchanged between runs.
80
+ - Unless running in offline mode, do not rely on any language classification output from LinguistJS being unchanged between runs.
82
81
  Language data is fetched each run from the latest classifications of [`github-linguist`](https://github.com/github/linguist).
83
82
  This data is subject to change at any time and may change the results of a run even when using the same version of Linguist.
84
83