linguist-js 2.4.0 → 2.5.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/dist/cli.js +1 -0
- package/dist/helpers/load-data.js +11 -2
- package/dist/helpers/walk-tree.js +14 -8
- package/dist/index.js +70 -55
- package/dist/types.d.ts +1 -0
- package/ext/documentation.yml +17 -0
- package/ext/generated.rb +351 -0
- package/ext/heuristics.yml +669 -0
- package/ext/languages.yml +7480 -0
- package/ext/vendor.yml +165 -0
- package/license.md +1 -1
- package/package.json +10 -7
- package/readme.md +11 -8
- package/dist/helpers/convert-glob.js +0 -11
package/ext/vendor.yml
ADDED
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
|
|
2
|
+
- (^|/)cache/
|
|
3
|
+
- ^[Dd]ependencies/
|
|
4
|
+
- (^|/)dist/
|
|
5
|
+
- ^deps/
|
|
6
|
+
- (^|/)configure$
|
|
7
|
+
- (^|/)config\.guess$
|
|
8
|
+
- (^|/)config\.sub$
|
|
9
|
+
- (^|/)aclocal\.m4
|
|
10
|
+
- (^|/)libtool\.m4
|
|
11
|
+
- (^|/)ltoptions\.m4
|
|
12
|
+
- (^|/)ltsugar\.m4
|
|
13
|
+
- (^|/)ltversion\.m4
|
|
14
|
+
- (^|/)lt~obsolete\.m4
|
|
15
|
+
- (^|/)dotnet-install\.(ps1|sh)$
|
|
16
|
+
- (^|/)cpplint\.py
|
|
17
|
+
- (^|/)node_modules/
|
|
18
|
+
- (^|/)\.yarn/releases/
|
|
19
|
+
- (^|/)\.yarn/plugins/
|
|
20
|
+
- (^|/)\.yarn/sdks/
|
|
21
|
+
- (^|/)\.yarn/versions/
|
|
22
|
+
- (^|/)\.yarn/unplugged/
|
|
23
|
+
- (^|/)_esy$
|
|
24
|
+
- (^|/)bower_components/
|
|
25
|
+
- ^rebar$
|
|
26
|
+
- (^|/)erlang\.mk
|
|
27
|
+
- (^|/)Godeps/_workspace/
|
|
28
|
+
- (^|/)testdata/
|
|
29
|
+
- (^|/)\.indent\.pro
|
|
30
|
+
- (\.|-)min\.(js|css)$
|
|
31
|
+
- ([^\s]*)import\.(css|less|scss|styl)$
|
|
32
|
+
- (^|/)bootstrap([^/.]*)\.(js|css|less|scss|styl)$
|
|
33
|
+
- (^|/)custom\.bootstrap([^\s]*)(js|css|less|scss|styl)$
|
|
34
|
+
- (^|/)font-?awesome\.(css|less|scss|styl)$
|
|
35
|
+
- (^|/)font-?awesome/.*\.(css|less|scss|styl)$
|
|
36
|
+
- (^|/)foundation\.(css|less|scss|styl)$
|
|
37
|
+
- (^|/)normalize\.(css|less|scss|styl)$
|
|
38
|
+
- (^|/)skeleton\.(css|less|scss|styl)$
|
|
39
|
+
- (^|/)[Bb]ourbon/.*\.(css|less|scss|styl)$
|
|
40
|
+
- (^|/)animate\.(css|less|scss|styl)$
|
|
41
|
+
- (^|/)materialize\.(css|less|scss|styl|js)$
|
|
42
|
+
- (^|/)select2/.*\.(css|scss|js)$
|
|
43
|
+
- (^|/)bulma\.(css|sass|scss)$
|
|
44
|
+
- (3rd|[Tt]hird)[-_]?[Pp]arty/
|
|
45
|
+
- (^|/)vendors?/
|
|
46
|
+
- (^|/)[Ee]xtern(als?)?/
|
|
47
|
+
- (^|/)[Vv]+endor/
|
|
48
|
+
- ^debian/
|
|
49
|
+
- (^|/)run\.n$
|
|
50
|
+
- (^|/)bootstrap-datepicker/
|
|
51
|
+
- (^|/)jquery([^.]*)\.js$
|
|
52
|
+
- (^|/)jquery\-\d\.\d+(\.\d+)?\.js$
|
|
53
|
+
- (^|/)jquery\-ui(\-\d\.\d+(\.\d+)?)?(\.\w+)?\.(js|css)$
|
|
54
|
+
- (^|/)jquery\.(ui|effects)\.([^.]*)\.(js|css)$
|
|
55
|
+
- (^|/)jquery\.fn\.gantt\.js
|
|
56
|
+
- (^|/)jquery\.fancybox\.(js|css)
|
|
57
|
+
- (^|/)fuelux\.js
|
|
58
|
+
- (^|/)jquery\.fileupload(-\w+)?\.js$
|
|
59
|
+
- (^|/)jquery\.dataTables\.js
|
|
60
|
+
- (^|/)bootbox\.js
|
|
61
|
+
- (^|/)pdf\.worker\.js
|
|
62
|
+
- (^|/)slick\.\w+.js$
|
|
63
|
+
- (^|/)Leaflet\.Coordinates-\d+\.\d+\.\d+\.src\.js$
|
|
64
|
+
- (^|/)leaflet\.draw-src\.js
|
|
65
|
+
- (^|/)leaflet\.draw\.css
|
|
66
|
+
- (^|/)Control\.FullScreen\.css
|
|
67
|
+
- (^|/)Control\.FullScreen\.js
|
|
68
|
+
- (^|/)leaflet\.spin\.js
|
|
69
|
+
- (^|/)wicket-leaflet\.js
|
|
70
|
+
- (^|/)\.sublime-project
|
|
71
|
+
- (^|/)\.sublime-workspace
|
|
72
|
+
- (^|/)\.vscode/
|
|
73
|
+
- (^|/)prototype(.*)\.js$
|
|
74
|
+
- (^|/)effects\.js$
|
|
75
|
+
- (^|/)controls\.js$
|
|
76
|
+
- (^|/)dragdrop\.js$
|
|
77
|
+
- (.*?)\.d\.ts$
|
|
78
|
+
- (^|/)mootools([^.]*)\d+\.\d+.\d+([^.]*)\.js$
|
|
79
|
+
- (^|/)dojo\.js$
|
|
80
|
+
- (^|/)MochiKit\.js$
|
|
81
|
+
- (^|/)yahoo-([^.]*)\.js$
|
|
82
|
+
- (^|/)yui([^.]*)\.js$
|
|
83
|
+
- (^|/)ckeditor\.js$
|
|
84
|
+
- (^|/)tiny_mce([^.]*)\.js$
|
|
85
|
+
- (^|/)tiny_mce/(langs|plugins|themes|utils)
|
|
86
|
+
- (^|/)ace-builds/
|
|
87
|
+
- (^|/)fontello(.*?)\.css$
|
|
88
|
+
- (^|/)MathJax/
|
|
89
|
+
- (^|/)Chart\.js$
|
|
90
|
+
- (^|/)[Cc]ode[Mm]irror/(\d+\.\d+/)?(lib|mode|theme|addon|keymap|demo)
|
|
91
|
+
- (^|/)shBrush([^.]*)\.js$
|
|
92
|
+
- (^|/)shCore\.js$
|
|
93
|
+
- (^|/)shLegacy\.js$
|
|
94
|
+
- (^|/)angular([^.]*)\.js$
|
|
95
|
+
- (^|\/)d3(\.v\d+)?([^.]*)\.js$
|
|
96
|
+
- (^|/)react(-[^.]*)?\.js$
|
|
97
|
+
- (^|/)flow-typed/.*\.js$
|
|
98
|
+
- (^|/)modernizr\-\d\.\d+(\.\d+)?\.js$
|
|
99
|
+
- (^|/)modernizr\.custom\.\d+\.js$
|
|
100
|
+
- (^|/)knockout-(\d+\.){3}(debug\.)?js$
|
|
101
|
+
- (^|/)docs?/_?(build|themes?|templates?|static)/
|
|
102
|
+
- (^|/)admin_media/
|
|
103
|
+
- (^|/)env/
|
|
104
|
+
- (^|/)fabfile\.py$
|
|
105
|
+
- (^|/)waf$
|
|
106
|
+
- (^|/)\.osx$- \.xctemplate/
|
|
107
|
+
- \.imageset/
|
|
108
|
+
- (^|/)Carthage/
|
|
109
|
+
- (^|/)Sparkle/
|
|
110
|
+
- (^|/)Crashlytics\.framework/
|
|
111
|
+
- (^|/)Fabric\.framework/
|
|
112
|
+
- (^|/)BuddyBuildSDK\.framework/
|
|
113
|
+
- (^|/)Realm\.framework
|
|
114
|
+
- (^|/)RealmSwift\.framework
|
|
115
|
+
- (^|/)\.gitattributes$
|
|
116
|
+
- (^|/)\.gitignore$
|
|
117
|
+
- (^|/)\.gitmodules$
|
|
118
|
+
- (^|/)gradlew$
|
|
119
|
+
- (^|/)gradlew\.bat$
|
|
120
|
+
- (^|/)gradle/wrapper/
|
|
121
|
+
- (^|/)mvnw$
|
|
122
|
+
- (^|/)mvnw\.cmd$
|
|
123
|
+
- (^|/)\.mvn/wrapper/
|
|
124
|
+
- -vsdoc\.js$
|
|
125
|
+
- \.intellisense\.js$
|
|
126
|
+
- (^|/)jquery([^.]*)\.validate(\.unobtrusive)?\.js$
|
|
127
|
+
- (^|/)jquery([^.]*)\.unobtrusive\-ajax\.js$
|
|
128
|
+
- (^|/)[Mm]icrosoft([Mm]vc)?([Aa]jax|[Vv]alidation)(\.debug)?\.js$
|
|
129
|
+
- (^|/)[Pp]ackages\/.+\.\d+\/
|
|
130
|
+
- (^|/)extjs/.*?\.js$
|
|
131
|
+
- (^|/)extjs/.*?\.xml$
|
|
132
|
+
- (^|/)extjs/.*?\.txt$
|
|
133
|
+
- (^|/)extjs/.*?\.html$
|
|
134
|
+
- (^|/)extjs/.*?\.properties$
|
|
135
|
+
- (^|/)extjs/\.sencha/
|
|
136
|
+
- (^|/)extjs/docs/
|
|
137
|
+
- (^|/)extjs/builds/
|
|
138
|
+
- (^|/)extjs/cmd/
|
|
139
|
+
- (^|/)extjs/examples/
|
|
140
|
+
- (^|/)extjs/locale/
|
|
141
|
+
- (^|/)extjs/packages/
|
|
142
|
+
- (^|/)extjs/plugins/
|
|
143
|
+
- (^|/)extjs/resources/
|
|
144
|
+
- (^|/)extjs/src/
|
|
145
|
+
- (^|/)extjs/welcome/
|
|
146
|
+
- (^|/)html5shiv\.js$
|
|
147
|
+
- (^|/)[Tt]ests?/fixtures/
|
|
148
|
+
- (^|/)[Ss]pecs?/fixtures/
|
|
149
|
+
- (^|/)cordova([^.]*)\.js$
|
|
150
|
+
- (^|/)cordova\-\d\.\d(\.\d)?\.js$
|
|
151
|
+
- (^|/)foundation(\..*)?\.js$
|
|
152
|
+
- (^|/)Vagrantfile$
|
|
153
|
+
- (^|/)\.[Dd][Ss]_[Ss]tore$
|
|
154
|
+
- (^|/)vignettes/
|
|
155
|
+
- (^|/)inst/extdata/
|
|
156
|
+
- (^|/)octicons\.css
|
|
157
|
+
- (^|/)sprockets-octicons\.scss
|
|
158
|
+
- (^|/)activator$
|
|
159
|
+
- (^|/)activator\.bat$
|
|
160
|
+
- (^|/)proguard\.pro$
|
|
161
|
+
- (^|/)proguard-rules\.pro$
|
|
162
|
+
- (^|/)puphpet/
|
|
163
|
+
- (^|/)\.google_apis/
|
|
164
|
+
- (^|/)Jenkinsfile$
|
|
165
|
+
- (^|/)\.gitpod\.Dockerfile$
|
package/license.md
CHANGED
package/package.json
CHANGED
|
@@ -1,23 +1,26 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "linguist-js",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.5.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": {
|
|
7
|
+
"linguist-js": "bin/index.js",
|
|
7
8
|
"linguist": "bin/index.js"
|
|
8
9
|
},
|
|
9
10
|
"engines": {
|
|
10
11
|
"node": ">=12"
|
|
11
12
|
},
|
|
12
13
|
"scripts": {
|
|
13
|
-
"
|
|
14
|
+
"download-files": "npx tsx build/download-files",
|
|
15
|
+
"prepare": "npm run download-files && npm test && npm run perf",
|
|
14
16
|
"perf": "tsc && node test/perf",
|
|
15
|
-
"test": "tsc && node test/test"
|
|
17
|
+
"test": "tsc && node test/folder && echo --- && node test/unit"
|
|
16
18
|
},
|
|
17
19
|
"files": [
|
|
18
20
|
"bin/",
|
|
19
21
|
"dist/**/*.js",
|
|
20
|
-
"dist/*.d.ts"
|
|
22
|
+
"dist/*.d.ts",
|
|
23
|
+
"ext/"
|
|
21
24
|
],
|
|
22
25
|
"repository": {
|
|
23
26
|
"type": "git",
|
|
@@ -37,10 +40,10 @@
|
|
|
37
40
|
"homepage": "https://github.com/Nixinova/Linguist#readme",
|
|
38
41
|
"dependencies": {
|
|
39
42
|
"binary-extensions": "^2.2.0",
|
|
40
|
-
"commander": "^9.
|
|
43
|
+
"commander": "^9.2.0",
|
|
41
44
|
"common-path-prefix": "^3.0.0",
|
|
42
45
|
"cross-fetch": "^3.1.5",
|
|
43
|
-
"
|
|
46
|
+
"ignore": "^5.2.0",
|
|
44
47
|
"isbinaryfile": "^4.0.8",
|
|
45
48
|
"js-yaml": "^4.1.0",
|
|
46
49
|
"node-cache": "^5.1.2"
|
|
@@ -50,6 +53,6 @@
|
|
|
50
53
|
"@types/js-yaml": "ts4.6",
|
|
51
54
|
"@types/node": "ts4.6",
|
|
52
55
|
"deep-object-diff": "^1.1.7",
|
|
53
|
-
"typescript": "~4.6.
|
|
56
|
+
"typescript": "~4.6.4"
|
|
54
57
|
}
|
|
55
58
|
}
|
package/readme.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
[](https://github.com/Nixinova/Linguist/releases)
|
|
3
3
|
[](https://www.npmjs.com/package/linguist-js)
|
|
4
4
|
|
|
5
|
-
#
|
|
5
|
+
# LinguistJS
|
|
6
6
|
|
|
7
7
|
Analyses the languages of all files in a given folder and collates the results.
|
|
8
8
|
|
|
@@ -11,7 +11,7 @@ Powered by [github-linguist](https://github.com/github/linguist), although it do
|
|
|
11
11
|
## Install
|
|
12
12
|
|
|
13
13
|
[Node.js](https://nodejs.org) must be installed to be able to use this.
|
|
14
|
-
|
|
14
|
+
LinguistJS is available [on npm](https://npmjs.com/package/linguist-js) as `linguist-js`.
|
|
15
15
|
|
|
16
16
|
Install locally using `npm install linguist-js` and import it into your code like so:
|
|
17
17
|
|
|
@@ -27,7 +27,7 @@ linguist --help
|
|
|
27
27
|
|
|
28
28
|
## Usage
|
|
29
29
|
|
|
30
|
-
|
|
30
|
+
LinguistJS contains one function which analyses a given folder.
|
|
31
31
|
|
|
32
32
|
As an example, take the following file structure:
|
|
33
33
|
|
|
@@ -40,7 +40,7 @@ As an example, take the following file structure:
|
|
|
40
40
|
| no-lang 10B
|
|
41
41
|
```
|
|
42
42
|
|
|
43
|
-
Running
|
|
43
|
+
Running LinguistJS on this folder will return the following JSON:
|
|
44
44
|
|
|
45
45
|
```json
|
|
46
46
|
{
|
|
@@ -78,7 +78,7 @@ Running Linguist on this folder will return the following JSON:
|
|
|
78
78
|
|
|
79
79
|
- File paths in the output use only forward slashes as delimiters, even on Windows.
|
|
80
80
|
- This tool does not work when offline.
|
|
81
|
-
- Do not rely on any language classification output from
|
|
81
|
+
- Do not rely on any language classification output from LinguistJS being unchanged between runs.
|
|
82
82
|
Language data is fetched each run from the latest classifications of [`github-linguist`](https://github.com/github/linguist).
|
|
83
83
|
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
84
|
|
|
@@ -97,7 +97,6 @@ const { files, languages, unknown } = linguist(folder, options);
|
|
|
97
97
|
Analyse the language of all files found in a folder.
|
|
98
98
|
- `entry` (optional; string or string array):
|
|
99
99
|
The folder(s) to analyse (defaults to `./`).
|
|
100
|
-
Analyse multiple folders using the syntax `"{folder1,folder2,...}"`.
|
|
101
100
|
- `opts` (optional; object):
|
|
102
101
|
An object containing analyser options.
|
|
103
102
|
- `fileContent` (string or string array):
|
|
@@ -114,7 +113,9 @@ const { files, languages, unknown } = linguist(folder, options);
|
|
|
114
113
|
- `quick` (boolean):
|
|
115
114
|
Whether to skip complex language analysis such as the checking of heuristics and gitattributes statements (defaults to `false`).
|
|
116
115
|
Alias for `checkAttributes:false, checkIgnored:false, checkHeuristics:false, checkShebang:false, checkModeline:false`.
|
|
117
|
-
- `
|
|
116
|
+
- `offline` (boolean):
|
|
117
|
+
Whether to use pre-packaged metadata files instead of fetching them from GitHub at runtime (defaults to `false`).
|
|
118
|
+
- `keepVendored` (boolean):
|
|
118
119
|
Whether to keep vendored files (dependencies, etc) (defaults to `false`).
|
|
119
120
|
Does nothing when `fileContent` is set.
|
|
120
121
|
- `keepBinary` (boolean):
|
|
@@ -160,7 +161,9 @@ linguist --help
|
|
|
160
161
|
Requires `--json` to be specified.
|
|
161
162
|
- `--quick`:
|
|
162
163
|
Whether to skip the checking of `.gitattributes` and `.gitignore` files for manual language classifications.
|
|
163
|
-
Alias for `--checkAttributes=false --checkIgnored=false --checkHeuristics=false --
|
|
164
|
+
Alias for `--checkAttributes=false --checkIgnored=false --checkHeuristics=false --checkShebang=false --checkModeline=false`.
|
|
165
|
+
- `--offline`:
|
|
166
|
+
Use pre-packaged metadata files instead of fetching them from GitHub at runtime.
|
|
164
167
|
- `--keepVendored`:
|
|
165
168
|
Whether to include vendored files (auto-generated files, dependencies folder, etc).
|
|
166
169
|
- `--keepBinary`:
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const glob_to_regexp_1 = __importDefault(require("glob-to-regexp"));
|
|
7
|
-
function parseGitGlob(path) {
|
|
8
|
-
const globPath = `**/${path}`.replace(/\\/g, '/').replace(/\[:(space|digit):\]/g, (_, val) => `\\${val[0]}`);
|
|
9
|
-
return (0, glob_to_regexp_1.default)(globPath, { globstar: true, extended: true });
|
|
10
|
-
}
|
|
11
|
-
exports.default = parseGitGlob;
|