linguist-js 2.7.0-pre → 2.7.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.
@@ -10,7 +10,8 @@ const path_1 = __importDefault(require("path"));
10
10
  function parseAttributes(content, folderRoot = '.') {
11
11
  var _a, _b;
12
12
  const output = [];
13
- for (const line of content.split('\n')) {
13
+ for (const rawLine of content.split('\n')) {
14
+ const line = rawLine.replace(/#.*/, '').trim();
14
15
  if (!line)
15
16
  continue;
16
17
  const parts = line.split(/\s+/g);
package/dist/index.js CHANGED
@@ -37,11 +37,11 @@ const load_data_1 = __importStar(require("./helpers/load-data"));
37
37
  const read_file_1 = __importDefault(require("./helpers/read-file"));
38
38
  const parse_gitattributes_1 = __importDefault(require("./helpers/parse-gitattributes"));
39
39
  const convert_pcre_1 = __importDefault(require("./helpers/convert-pcre"));
40
- async function analyse(rawInput, opts = {}) {
40
+ async function analyse(rawPaths, opts = {}) {
41
41
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
42
42
  var _r, _s;
43
43
  const useRawContent = opts.fileContent !== undefined;
44
- const input = [rawInput !== null && rawInput !== void 0 ? rawInput : []].flat();
44
+ const input = [rawPaths !== null && rawPaths !== void 0 ? rawPaths : []].flat();
45
45
  const manualFileContent = [(_a = opts.fileContent) !== null && _a !== void 0 ? _a : []].flat();
46
46
  // Normalise input option arguments
47
47
  opts = {
@@ -101,17 +101,21 @@ async function analyse(rawInput, opts = {}) {
101
101
  folders = data.folders;
102
102
  }
103
103
  // Load gitignore data and apply ignores rules
104
- if (!useRawContent) {
105
- // TODO switch to be like the gitattributes code
106
- for (const folder of folders) {
104
+ if (!useRawContent && opts.checkIgnored) {
105
+ const nestedIgnoreFiles = files.filter(file => file.endsWith('.gitignore'));
106
+ for (const ignoresFile of nestedIgnoreFiles) {
107
+ const relIgnoresFile = relPath(ignoresFile);
108
+ const relIgnoresFolder = path_1.default.dirname(relIgnoresFile);
107
109
  // Parse gitignores
108
- const ignoresFile = path_1.default.join(folder, '.gitignore');
109
- if (opts.checkIgnored && fs_1.default.existsSync(ignoresFile)) {
110
- const ignoresData = await (0, read_file_1.default)(ignoresFile);
111
- const localIgnoresData = ignoresData.replace(/^[\/\\]/g, localRoot(folder) + '/');
112
- ignored.add(localIgnoresData);
113
- files = filterOutIgnored(files, ignored);
114
- }
110
+ const ignoresDataRaw = await (0, read_file_1.default)(ignoresFile);
111
+ const ignoresData = ignoresDataRaw.replace(/#.+|\s+$/gm, '');
112
+ const absoluteIgnoresData = ignoresData
113
+ // '.file' -> 'root/*/.file'
114
+ .replace(/^(?=[^\s\/\\])/gm, localRoot(relIgnoresFolder) + '/*/')
115
+ // '/folder' -> 'root/folder'
116
+ .replace(/^[\/\\]/gm, localRoot(relIgnoresFolder) + '/');
117
+ ignored.add(absoluteIgnoresData);
118
+ files = filterOutIgnored(files, ignored);
115
119
  }
116
120
  }
117
121
  // Fetch and normalise gitattributes data of all subfolders and save to metadata
@@ -137,16 +141,16 @@ async function analyse(rawInput, opts = {}) {
137
141
  const vendorTrueGlobs = [...getFlaggedGlobs('vendored', true), ...getFlaggedGlobs('generated', true), ...getFlaggedGlobs('documentation', true)];
138
142
  const vendorFalseGlobs = [...getFlaggedGlobs('vendored', false), ...getFlaggedGlobs('generated', false), ...getFlaggedGlobs('documentation', false)];
139
143
  // Set up glob ignore object to use for expanding globs to match files
140
- const vendorOverrides = (0, ignore_1.default)().add(vendorFalseGlobs);
144
+ const vendorTrueIgnore = (0, ignore_1.default)().add(vendorTrueGlobs);
145
+ const vendorFalseIgnore = (0, ignore_1.default)().add(vendorFalseGlobs);
141
146
  // Remove all files marked as vendored by default
142
147
  const excludedFiles = files.filter(file => vendorPaths.some(pathPtn => RegExp(pathPtn, 'i').test(relPath(file))));
143
148
  files = files.filter(file => !excludedFiles.includes(file));
144
149
  // Re-add removed files that are overridden manually in gitattributes
145
- const overriddenExcludedFiles = excludedFiles.filter(file => vendorOverrides.ignores(relPath(file)));
150
+ const overriddenExcludedFiles = excludedFiles.filter(file => vendorFalseIgnore.ignores(relPath(file)));
146
151
  files.push(...overriddenExcludedFiles);
147
152
  // Remove files explicitly marked as vendored in gitattributes
148
- // TODO change globs.includes(file) to parse the glob using ignore()
149
- files = files.filter(file => !vendorTrueGlobs.includes(relPath(file)));
153
+ files = files.filter(file => !vendorTrueIgnore.ignores(relPath(file)));
150
154
  }
151
155
  // Filter out binary files
152
156
  if (!opts.keepBinary) {
@@ -157,7 +161,6 @@ async function analyse(rawInput, opts = {}) {
157
161
  files = filterOutIgnored(files, binaryIgnored);
158
162
  // Re-add files manually marked not as binary
159
163
  const binaryUnignored = (0, ignore_1.default)().add(getFlaggedGlobs('binary', false));
160
- // TODO parse the globs using ignore()
161
164
  const unignoredList = filterOutIgnored(files, binaryUnignored);
162
165
  files.push(...unignoredList);
163
166
  }
package/ext/generated.rb CHANGED
@@ -22,3 +22,4 @@
22
22
  - ppport\.h$
23
23
  - __generated__\/
24
24
  - _tlb\.pas$
25
+ - (?:^|\/)htmlcov\/
@@ -45,7 +45,7 @@ disambiguations:
45
45
  - language: Public Key
46
46
  pattern: '^(----[- ]BEGIN|ssh-(rsa|dss)) '
47
47
  - language: AsciiDoc
48
- pattern: '^[=-]+(\s|\n)|\{\{[A-Za-z]'
48
+ pattern: '^[=-]+\s|\{\{[A-Za-z]'
49
49
  - language: AGS Script
50
50
  pattern: '^(\/\/.+|((import|export)\s+)?(function|int|float|char)\s+((room|repeatedly|on|game)_)?([A-Za-z]+[A-Za-z_0-9]+)\s*[;\(])'
51
51
  - extensions: ['.asm']
@@ -101,6 +101,8 @@ disambiguations:
101
101
  - (?i:^\s*(end\ssub)$)
102
102
  - (?i:^\s*(?=^function\s)(?:function\s*\w+\(.*?\)\s*as\s*\w*)|(?::\s*function\(.*?\)\s*as\s*\w*)$)
103
103
  - (?i:^\s*(end\sfunction)$)
104
+ - language: Bluespec BH
105
+ pattern: '^package\s+[A-Za-z_][A-Za-z0-9_'']*(?:\s*\(|\s+where)'
104
106
  - extensions: ['.builds']
105
107
  rules:
106
108
  - language: XML
@@ -132,7 +134,7 @@ disambiguations:
132
134
  - extensions: ['.cmp']
133
135
  rules:
134
136
  - language: Gerber Image
135
- pattern: '^[DGMT][0-9]{2}\*\r?\n'
137
+ pattern: '^[DGMT][0-9]{2}\*(?:\r?\n|\r)'
136
138
  - extensions: ['.cs']
137
139
  rules:
138
140
  - language: Smalltalk
@@ -242,7 +244,7 @@ disambiguations:
242
244
  - extensions: ['.ftl']
243
245
  rules:
244
246
  - language: FreeMarker
245
- pattern: '^(?:<|[a-zA-Z-][a-zA-Z0-9_-]+[ \t]+\w)|\$\{\w+[^\n]*?\}|^[ \t]*(?:<#--.*?-->|<#([a-z]+)(?=\s|>)[^>]*>.*?</#\1>|\[#--.*?--\]|\[#([a-z]+)(?=\s|\])[^\]]*\].*?\[#\2\])'
247
+ pattern: '^(?:<|[a-zA-Z-][a-zA-Z0-9_-]+[ \t]+\w)|\$\{\w+[^\r\n]*?\}|^[ \t]*(?:<#--.*?-->|<#([a-z]+)(?=\s|>)[^>]*>.*?</#\1>|\[#--.*?--\]|\[#([a-z]+)(?=\s|\])[^\]]*\].*?\[#\2\])'
246
248
  - language: Fluent
247
249
  pattern: '^-?[a-zA-Z][a-zA-Z0-9_-]* *=|\{\$-?[a-zA-Z][-\w]*(?:\.[a-zA-Z][-\w]*)?\}'
248
250
  - extensions: ['.g']
@@ -250,7 +252,7 @@ disambiguations:
250
252
  - language: GAP
251
253
  pattern: '\s*(Declare|BindGlobal|KeyDependentOperation|Install(Method|GlobalFunction)|SetPackageInfo)'
252
254
  - language: G-code
253
- pattern: '^[MG][0-9]+\n'
255
+ pattern: '^[MG][0-9]+(?:\r?\n|\r)'
254
256
  - extensions: ['.gd']
255
257
  rules:
256
258
  - language: GAP
@@ -350,6 +352,12 @@ disambiguations:
350
352
  pattern: '^\.[A-Za-z]{2}(\s|$)'
351
353
  - language: PicoLisp
352
354
  pattern: '^\((de|class|rel|code|data|must)\s'
355
+ - extensions: ['.lean']
356
+ rules:
357
+ - language: Lean
358
+ pattern: '^import [a-z]'
359
+ - language: Lean 4
360
+ pattern: '^import [A-Z]'
353
361
  - extensions: ['.ls']
354
362
  rules:
355
363
  - language: LoomScript
@@ -395,7 +403,7 @@ disambiguations:
395
403
  - language: Win32 Message File
396
404
  pattern: '(?i)^[ \t]*(?>\/\*\s*)?MessageId=|^\.$'
397
405
  - language: M4
398
- pattern: '^dnl|^divert\((?:-?\d+)?\)|^\w+\(`[^\n]*?''[),]'
406
+ pattern: '^dnl|^divert\((?:-?\d+)?\)|^\w+\(`[^\r\n]*?''[),]'
399
407
  - language: Monkey C
400
408
  pattern: '\b(?:using|module|function|class|var)\s+\w'
401
409
  - extensions: ['.md']
@@ -440,7 +448,7 @@ disambiguations:
440
448
  - language: XML
441
449
  pattern: '^\s*<\?xml\s+version'
442
450
  - language: Gerber Image
443
- pattern: '^[DGMT][0-9]{2}\*\r?\n'
451
+ pattern: '^[DGMT][0-9]{2}\*(?:\r?\n|\r)'
444
452
  - language: Text
445
453
  pattern: 'THE_TITLE'
446
454
  - extensions: ['.nl']
@@ -504,7 +512,7 @@ disambiguations:
504
512
  - extensions: ['.pod']
505
513
  rules:
506
514
  - language: Pod 6
507
- pattern: '^[\s&&[^\n]]*=(comment|begin pod|begin para|item\d+)'
515
+ pattern: '^[\s&&[^\r\n]]*=(comment|begin pod|begin para|item\d+)'
508
516
  - language: Pod
509
517
  - extensions: ['.pp']
510
518
  rules:
@@ -543,7 +551,7 @@ disambiguations:
543
551
  - extensions: ['.q']
544
552
  rules:
545
553
  - language: q
546
- pattern: '((?i:[A-Z.][\w.]*:\{)|(^|\n)\\(cd?|d|l|p|ts?) )'
554
+ pattern: '((?i:[A-Z.][\w.]*:\{)|^\\(cd?|d|l|p|ts?) )'
547
555
  - language: HiveQL
548
556
  pattern: '(?i:SELECT\s+[\w*,]+\s+FROM|(CREATE|ALTER|DROP)\s(DATABASE|SCHEMA|TABLE))'
549
557
  - extensions: ['.qs']
@@ -556,6 +564,8 @@ disambiguations:
556
564
  rules:
557
565
  - language: Rebol
558
566
  pattern: '(?i:\bRebol\b)'
567
+ - language: Rez
568
+ pattern: '(#include\s+["<](Types\.r|Carbon\/Carbon\.r)[">])|((resource|data|type)\s+''[A-Za-z0-9]{4}''\s+((\(.*\)\s+){0,1}){)'
559
569
  - language: R
560
570
  pattern: '<-|^\s*#'
561
571
  - extensions: ['.re']
@@ -615,7 +625,7 @@ disambiguations:
615
625
  - language: Solidity
616
626
  pattern: '\bpragma\s+solidity\b|\b(?:abstract\s+)?contract\s+(?!\d)[a-zA-Z0-9$_]+(?:\s+is\s+(?:[a-zA-Z0-9$_][^\{]*?)?)?\s*\{'
617
627
  - language: Gerber Image
618
- pattern: '^[DGMT][0-9]{2}\*\r?\n'
628
+ pattern: '^[DGMT][0-9]{2}\*(?:\r?\n|\r)'
619
629
  - extensions: ['.sql']
620
630
  rules:
621
631
  - language: PLpgSQL
@@ -645,7 +655,7 @@ disambiguations:
645
655
  - extensions: ['.stl']
646
656
  rules:
647
657
  - language: STL
648
- pattern: '\A\s*solid(?=$|\s)(?:.|[\r\n])*?^endsolid(?:$|\s)'
658
+ pattern: '\A\s*solid(?:$|\s)[\s\S]*^endsolid(?:$|\s)'
649
659
  - extensions: ['.sw']
650
660
  rules:
651
661
  - language: Sway
@@ -699,10 +709,15 @@ disambiguations:
699
709
  - language: Adblock Filter List
700
710
  pattern: '\A\[(?<version>(?:[Aa]d[Bb]lock(?:[ \t][Pp]lus)?|u[Bb]lock(?:[ \t][Oo]rigin)?|[Aa]d[Gg]uard)(?:[ \t] \d+(?:\.\d+)*+)?)(?:[ \t]?;[ \t]?\g<version>)*+\]'
701
711
  - language: Text
712
+ - extensions: ['.typ']
713
+ rules:
714
+ - language: Typst
715
+ pattern: '^#(import|show|let|set)'
716
+ - language: XML
702
717
  - extensions: ['.url']
703
718
  rules:
704
719
  - language: INI
705
- pattern: '^\[InternetShortcut\](?:\r?\n|\r)(?>[^\s\[][^\n]*(?:\r?\n|\r))*URL='
720
+ pattern: '^\[InternetShortcut\](?:\r?\n|\r)(?>[^\s\[][^\r\n]*(?:\r?\n|\r))*URL='
706
721
  - extensions: ['.v']
707
722
  rules:
708
723
  - language: Coq
package/ext/languages.yml CHANGED
@@ -606,9 +606,28 @@ Bluespec:
606
606
  color: "#12223c"
607
607
  extensions:
608
608
  - ".bsv"
609
+ aliases:
610
+ - bluespec bsv
611
+ - bsv
609
612
  tm_scope: source.bsv
610
613
  ace_mode: verilog
614
+ codemirror_mode: verilog
615
+ codemirror_mime_type: text/x-systemverilog
611
616
  language_id: 36
617
+ Bluespec BH:
618
+ type: programming
619
+ group: Bluespec
620
+ color: "#12223c"
621
+ extensions:
622
+ - ".bs"
623
+ aliases:
624
+ - bh
625
+ - bluespec classic
626
+ tm_scope: source.haskell
627
+ ace_mode: haskell
628
+ codemirror_mode: haskell
629
+ codemirror_mime_type: text/x-haskell
630
+ language_id: 641580358
612
631
  Boo:
613
632
  type: programming
614
633
  color: "#d4bec1"
@@ -1607,7 +1626,7 @@ ECL:
1607
1626
  ECLiPSe:
1608
1627
  type: programming
1609
1628
  color: "#001d9d"
1610
- group: prolog
1629
+ group: Prolog
1611
1630
  extensions:
1612
1631
  - ".ecl"
1613
1632
  tm_scope: source.prolog.eclipse
@@ -1689,6 +1708,17 @@ Ecmarkup:
1689
1708
  aliases:
1690
1709
  - ecmarkdown
1691
1710
  language_id: 844766630
1711
+ EdgeQL:
1712
+ type: programming
1713
+ color: "#31A7FF"
1714
+ aliases:
1715
+ - esdl
1716
+ extensions:
1717
+ - ".edgeql"
1718
+ - ".esdl"
1719
+ ace_mode: text
1720
+ tm_scope: source.edgeql
1721
+ language_id: 925235833
1692
1722
  EditorConfig:
1693
1723
  type: data
1694
1724
  color: "#fff1f2"
@@ -2144,6 +2174,7 @@ GLSL:
2144
2174
  - ".tese"
2145
2175
  - ".vert"
2146
2176
  - ".vrx"
2177
+ - ".vs"
2147
2178
  - ".vsh"
2148
2179
  - ".vshader"
2149
2180
  tm_scope: source.glsl
@@ -2205,20 +2236,20 @@ Gemini:
2205
2236
  wrap: true
2206
2237
  tm_scope: source.gemini
2207
2238
  language_id: 310828396
2208
- Genero:
2239
+ Genero 4gl:
2209
2240
  type: programming
2210
2241
  color: "#63408e"
2211
2242
  extensions:
2212
2243
  - ".4gl"
2213
- tm_scope: source.genero
2244
+ tm_scope: source.genero-4gl
2214
2245
  ace_mode: text
2215
2246
  language_id: 986054050
2216
- Genero Forms:
2247
+ Genero per:
2217
2248
  type: markup
2218
2249
  color: "#d8df39"
2219
2250
  extensions:
2220
2251
  - ".per"
2221
- tm_scope: source.genero-forms
2252
+ tm_scope: source.genero-per
2222
2253
  ace_mode: text
2223
2254
  language_id: 902995658
2224
2255
  Genie:
@@ -2316,7 +2347,6 @@ Gherkin:
2316
2347
  Git Attributes:
2317
2348
  type: data
2318
2349
  color: "#F44D27"
2319
- group: INI
2320
2350
  aliases:
2321
2351
  - gitattributes
2322
2352
  filenames:
@@ -2361,6 +2391,15 @@ Gleam:
2361
2391
  - ".gleam"
2362
2392
  tm_scope: source.gleam
2363
2393
  language_id: 1054258749
2394
+ Glimmer JS:
2395
+ type: programming
2396
+ extensions:
2397
+ - ".gjs"
2398
+ ace_mode: javascript
2399
+ color: "#F5835F"
2400
+ tm_scope: source.gjs
2401
+ group: JavaScript
2402
+ language_id: 5523150
2364
2403
  Glyph:
2365
2404
  type: programming
2366
2405
  color: "#c1ac7f"
@@ -2489,6 +2528,15 @@ Gradle:
2489
2528
  tm_scope: source.groovy.gradle
2490
2529
  ace_mode: text
2491
2530
  language_id: 136
2531
+ Gradle Kotlin DSL:
2532
+ group: Gradle
2533
+ type: data
2534
+ color: "#02303a"
2535
+ extensions:
2536
+ - ".gradle.kts"
2537
+ ace_mode: text
2538
+ tm_scope: source.kotlin
2539
+ language_id: 432600901
2492
2540
  Grammatical Framework:
2493
2541
  type: programming
2494
2542
  aliases:
@@ -2603,8 +2651,8 @@ HOCON:
2603
2651
  extensions:
2604
2652
  - ".hocon"
2605
2653
  filenames:
2606
- - .scalafix.conf
2607
- - .scalafmt.conf
2654
+ - ".scalafix.conf"
2655
+ - ".scalafmt.conf"
2608
2656
  tm_scope: source.hocon
2609
2657
  ace_mode: text
2610
2658
  language_id: 679725279
@@ -2812,6 +2860,8 @@ Hosts File:
2812
2860
  filenames:
2813
2861
  - HOSTS
2814
2862
  - hosts
2863
+ aliases:
2864
+ - hosts
2815
2865
  tm_scope: source.hosts
2816
2866
  ace_mode: text
2817
2867
  language_id: 231021894
@@ -2910,7 +2960,6 @@ Idris:
2910
2960
  Ignore List:
2911
2961
  type: data
2912
2962
  color: "#000000"
2913
- group: INI
2914
2963
  aliases:
2915
2964
  - ignore
2916
2965
  - gitignore
@@ -3104,6 +3153,7 @@ JSON:
3104
3153
  - ".watchmanconfig"
3105
3154
  - Pipfile.lock
3106
3155
  - composer.lock
3156
+ - deno.lock
3107
3157
  - flake.lock
3108
3158
  - mcmod.info
3109
3159
  language_id: 174
@@ -3120,6 +3170,7 @@ JSON with Comments:
3120
3170
  extensions:
3121
3171
  - ".jsonc"
3122
3172
  - ".code-snippets"
3173
+ - ".code-workspace"
3123
3174
  - ".sublime-build"
3124
3175
  - ".sublime-commands"
3125
3176
  - ".sublime-completions"
@@ -3623,6 +3674,14 @@ Lean:
3623
3674
  tm_scope: source.lean
3624
3675
  ace_mode: text
3625
3676
  language_id: 197
3677
+ Lean 4:
3678
+ type: programming
3679
+ group: Lean
3680
+ extensions:
3681
+ - ".lean"
3682
+ tm_scope: source.lean4
3683
+ ace_mode: text
3684
+ language_id: 455147478
3626
3685
  Less:
3627
3686
  type: markup
3628
3687
  color: "#1d365d"
@@ -4374,7 +4433,7 @@ Nasal:
4374
4433
  extensions:
4375
4434
  - ".nas"
4376
4435
  tm_scope: source.nasal
4377
- ace_mode: text
4436
+ ace_mode: nasal
4378
4437
  language_id: 178322513
4379
4438
  Nearley:
4380
4439
  type: programming
@@ -4823,6 +4882,8 @@ Option List:
4823
4882
  - ackrc
4824
4883
  filenames:
4825
4884
  - ".ackrc"
4885
+ - ".rspec"
4886
+ - ".yardopts"
4826
4887
  - ackrc
4827
4888
  - mocha.opts
4828
4889
  tm_scope: source.opts
@@ -5101,6 +5162,8 @@ Pic:
5101
5162
  extensions:
5102
5163
  - ".pic"
5103
5164
  - ".chem"
5165
+ aliases:
5166
+ - pikchr
5104
5167
  ace_mode: text
5105
5168
  codemirror_mode: troff
5106
5169
  codemirror_mime_type: text/troff
@@ -5257,6 +5320,14 @@ PowerShell:
5257
5320
  interpreters:
5258
5321
  - pwsh
5259
5322
  language_id: 293
5323
+ Praat:
5324
+ type: programming
5325
+ color: "#c8506d"
5326
+ tm_scope: source.praat
5327
+ ace_mode: praat
5328
+ extensions:
5329
+ - ".praat"
5330
+ language_id: 106029007
5260
5331
  Prisma:
5261
5332
  type: data
5262
5333
  color: "#0c344b"
@@ -5851,6 +5922,14 @@ RenderScript:
5851
5922
  tm_scope: none
5852
5923
  ace_mode: text
5853
5924
  language_id: 323
5925
+ Rez:
5926
+ type: programming
5927
+ extensions:
5928
+ - ".r"
5929
+ tm_scope: source.rez
5930
+ ace_mode: text
5931
+ color: "#FFDAB3"
5932
+ language_id: 498022874
5854
5933
  Rich Text Format:
5855
5934
  type: markup
5856
5935
  extensions:
@@ -6740,7 +6819,7 @@ Svelte:
6740
6819
  language_id: 928734530
6741
6820
  Sway:
6742
6821
  type: programming
6743
- color: "#dea584"
6822
+ color: "#00F58C"
6744
6823
  extensions:
6745
6824
  - ".sw"
6746
6825
  tm_scope: source.sway
@@ -6748,6 +6827,14 @@ Sway:
6748
6827
  codemirror_mode: rust
6749
6828
  codemirror_mime_type: text/x-rustsrc
6750
6829
  language_id: 271471144
6830
+ Sweave:
6831
+ type: prose
6832
+ color: "#198ce7"
6833
+ extensions:
6834
+ - ".rnw"
6835
+ tm_scope: text.tex.latex.sweave
6836
+ ace_mode: tex
6837
+ language_id: 558779190
6751
6838
  Swift:
6752
6839
  type: programming
6753
6840
  color: "#F05138"
@@ -6784,7 +6871,7 @@ TI Program:
6784
6871
  TL-Verilog:
6785
6872
  type: programming
6786
6873
  extensions:
6787
- - ".tlv"
6874
+ - ".tlv"
6788
6875
  tm_scope: source.tlverilog
6789
6876
  ace_mode: verilog
6790
6877
  color: "#C40023"
@@ -6939,6 +7026,17 @@ Terra:
6939
7026
  interpreters:
6940
7027
  - lua
6941
7028
  language_id: 371
7029
+ Terraform Template:
7030
+ type: markup
7031
+ extensions:
7032
+ - ".tftpl"
7033
+ color: "#7b42bb"
7034
+ tm_scope: source.hcl.terraform
7035
+ ace_mode: ruby
7036
+ codemirror_mode: ruby
7037
+ codemirror_mime_type: text/x-ruby
7038
+ group: HCL
7039
+ language_id: 856832701
6942
7040
  Texinfo:
6943
7041
  type: prose
6944
7042
  wrap: true
@@ -7023,6 +7121,14 @@ Thrift:
7023
7121
  - ".thrift"
7024
7122
  ace_mode: text
7025
7123
  language_id: 374
7124
+ Toit:
7125
+ type: programming
7126
+ color: "#c2c9fb"
7127
+ extensions:
7128
+ - ".toit"
7129
+ tm_scope: source.toit
7130
+ ace_mode: text
7131
+ language_id: 356554395
7026
7132
  Turing:
7027
7133
  type: programming
7028
7134
  color: "#cf142b"
@@ -7077,6 +7183,16 @@ TypeScript:
7077
7183
  codemirror_mode: javascript
7078
7184
  codemirror_mime_type: application/typescript
7079
7185
  language_id: 378
7186
+ Typst:
7187
+ type: programming
7188
+ color: "#239dad"
7189
+ aliases:
7190
+ - typ
7191
+ extensions:
7192
+ - ".typ"
7193
+ tm_scope: source.typst
7194
+ ace_mode: text
7195
+ language_id: 704730682
7080
7196
  Unified Parallel C:
7081
7197
  type: programming
7082
7198
  color: "#4e3617"
@@ -7687,6 +7803,7 @@ XML:
7687
7803
  - ".tml"
7688
7804
  - ".ts"
7689
7805
  - ".tsx"
7806
+ - ".typ"
7690
7807
  - ".ui"
7691
7808
  - ".urdf"
7692
7809
  - ".ux"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "linguist-js",
3
- "version": "2.7.0-pre",
3
+ "version": "2.7.0",
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": {
package/readme.md CHANGED
@@ -95,9 +95,17 @@ Running LinguistJS on this folder will return the following JSON:
95
95
 
96
96
  ```js
97
97
  const linguist = require('linguist-js');
98
- let folder = './src';
99
- let options = { keepVendored: false, quick: false };
100
- const { files, languages, unknown } = linguist(folder, options);
98
+
99
+ // Analyse folder on disc
100
+ const folder = './src';
101
+ const options = { keepVendored: false, quick: false };
102
+ const { files, languages, unknown } = await linguist(folder, options);
103
+
104
+ // Analyse file content from raw input
105
+ const fileNames = ['file1.ts', 'file2.ts', 'ignoreme.js'];
106
+ const fileContent = ['#!/usr/bin/env node', 'console.log("Example");', '"ignored"'];
107
+ const options = { ignoredFiles: ['ignore*'] };
108
+ const { files, languages, unknown } = await linguist(fileNames, { fileContent, ...options });
101
109
  ```
102
110
 
103
111
  - `linguist(entry?, opts?)` (default export):
@@ -122,7 +130,7 @@ const { files, languages, unknown } = linguist(folder, options);
122
130
  Alias for `checkAttributes:false, checkIgnored:false, checkHeuristics:false, checkShebang:false, checkModeline:false`.
123
131
  - `offline` (boolean):
124
132
  Whether to use pre-packaged metadata files instead of fetching them from GitHub at runtime (defaults to `false`).
125
- - `keepVendored` (boolean):
133
+ - `keepVendored` (boolean):
126
134
  Whether to keep vendored files (dependencies, etc) (defaults to `false`).
127
135
  Does nothing when `fileContent` is set.
128
136
  - `keepBinary` (boolean):