@vscode/vscode-languagedetection
Advanced tools
Comparing version 1.0.8 to 1.0.9
@@ -203,19 +203,2 @@ /** | ||
/** | ||
* @license | ||
* Copyright 2021 Google LLC. All Rights Reserved. | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
* ============================================================================= | ||
*/ | ||
/** @license See the LICENSE file. */ |
{ | ||
"name": "@vscode/vscode-languagedetection", | ||
"version": "1.0.8", | ||
"version": "1.0.9", | ||
"description": "An npm package that uses guesslang's ML model to detect source code languages", | ||
"main": "dist/lib/index.commonjs.js", | ||
"main": "dist/lib/index.js", | ||
"module": "dist/lib/index.js", | ||
@@ -25,6 +25,4 @@ "types": "dist/lib/index.d.ts", | ||
"homepage": "https://github.com/microsoft/vscode-languagedetection#readme", | ||
"dependencies": { | ||
"@tensorflow/tfjs": "^3.7.0" | ||
}, | ||
"devDependencies": { | ||
"@tensorflow/tfjs": "^3.7.0", | ||
"@types/chai": "^4.2.21", | ||
@@ -42,5 +40,5 @@ "@types/mocha": "8.2.3", | ||
"typescript": "^4.3.5", | ||
"webpack": "^5.44.0", | ||
"webpack": "~5.44.0", | ||
"webpack-cli": "^4.7.2" | ||
} | ||
} |
@@ -1,13 +0,85 @@ | ||
# Project | ||
# vscode-languagedetection | ||
> This repo has been populated by an initial template to help get you started. Please | ||
> make sure to update the content to build a great experience for community-building. | ||
An npm package that uses machine learning to detect source code languages. Powered by [@yoeo](https://github.com/yoeo)'s [guesslang](https://github.com/yoeo/guesslang) model! | ||
As the maintainer of this project, please make a few updates: | ||
Usage: | ||
- Improving this README.MD file to provide a great experience | ||
- Updating SUPPORT.MD with content about this project's support experience | ||
- Understanding the security reporting process in SECURITY.MD | ||
- Remove this section from the README | ||
First install it in your project: | ||
```sh | ||
npm install --save @vscode/vscode-languagedetection | ||
# or using yarn | ||
yarn add @vscode/vscode-languagedetection | ||
``` | ||
Then instantiate a ModuleOperations and pass it in the `model.json` and `weights` file content: | ||
> NOTE: This is only for VS Code. In the future, you shouldn't have to do this. | ||
```ts | ||
import { ModelJSON, ModelOperations } from "@vscode/vscode-languagedetection"; | ||
const modulOperations = new ModelOperations(async () => { | ||
return JSON.parse(readFileSync(join(__dirname, '..', '..', 'model', 'model.json')).toString()) as ModelJSON; | ||
}, async () => { | ||
return readFileSync(join(__dirname, '..', '..', 'model', 'group1-shard1of1.bin')).buffer; | ||
}); | ||
const result = await modulOperations.runModel(` | ||
function makeThing(): Thing { | ||
let size = 0; | ||
return { | ||
get size(): number { | ||
return size; | ||
}, | ||
set size(value: string | number | boolean) { | ||
let num = Number(value); | ||
// Don't allow NaN and stuff. | ||
if (!Number.isFinite(num)) { | ||
size = 0; | ||
return; | ||
} | ||
size = num; | ||
}, | ||
}; | ||
} | ||
`); | ||
``` | ||
which will give you the following in order of confidence: | ||
```ts | ||
[ | ||
{ languageId: 'ts', confidence: 0.48307517170906067 }, | ||
{ languageId: 'rs', confidence: 0.10045434534549713 }, | ||
{ languageId: 'js', confidence: 0.07833506911993027 }, | ||
{ languageId: 'c', confidence: 0.045049071311950684 }, | ||
{ languageId: 'lua', confidence: 0.044198162853717804 }, | ||
{ languageId: 'cpp', confidence: 0.03847603127360344 }, | ||
{ languageId: 'cs', confidence: 0.03298814222216606 }, | ||
{ languageId: 'mm', confidence: 0.02999635599553585 }, | ||
{ languageId: 'html', confidence: 0.01874217577278614 }, | ||
{ languageId: 'sql', confidence: 0.01811739057302475 }, | ||
{ languageId: 'swift', confidence: 0.01418407540768385 }, | ||
{ languageId: 'pl', confidence: 0.014126052148640156 }, | ||
{ languageId: 'md', confidence: 0.01112559624016285 }, | ||
{ languageId: 'java', confidence: 0.009976979345083237 }, | ||
{ languageId: 'ps1', confidence: 0.009242385625839233 }, | ||
{ languageId: 'php', confidence: 0.008150739595293999 }, | ||
{ languageId: 'go', confidence: 0.0069260732270777225 }, | ||
{ languageId: 'tex', confidence: 0.006594990845769644 }, | ||
{ languageId: 'scala', confidence: 0.00619362760335207 }, | ||
{ languageId: 'py', confidence: 0.004240741487592459 }, | ||
{ languageId: 'r', confidence: 0.0033439004328101873 }, | ||
{ languageId: 'matlab', confidence: 0.0030552551615983248 }, | ||
{ languageId: 'css', confidence: 0.0026798006147146225 }, | ||
{ languageId: 'sh', confidence: 0.0023688252549618483 }, | ||
{ languageId: 'ipynb', confidence: 0.002114647999405861 }, | ||
{ languageId: 'bat', confidence: 0.0018151027616113424 }, | ||
{ languageId: 'hs', confidence: 0.001677449094131589 }, | ||
{ languageId: 'erl', confidence: 0.0014191442169249058 }, | ||
{ languageId: 'coffee', confidence: 0.000696933304425329 }, | ||
{ languageId: 'rb', confidence: 0.0006357143283821642 } | ||
] | ||
``` | ||
## Contributing | ||
@@ -14,0 +86,0 @@ |
@@ -1,11 +0,1 @@ | ||
# TODO: The maintainer of this repo has not yet edited this file | ||
**REPO OWNER**: Do you want Customer Service & Support (CSS) support for this product/project? | ||
- **No CSS support:** Fill out this template with information about how to file issues and get help. | ||
- **Yes CSS support:** Fill out an intake form at [aka.ms/spot](https://aka.ms/spot). CSS will work with/help you to determine next steps. More details also available at [aka.ms/onboardsupport](https://aka.ms/onboardsupport). | ||
- **Not sure?** Fill out a SPOT intake as though the answer were "Yes". CSS will help you decide. | ||
*Then remove this first heading from this SUPPORT.MD file before publishing your repo.* | ||
# Support | ||
@@ -19,5 +9,3 @@ | ||
For help and questions about using this project, please **REPO MAINTAINER: INSERT INSTRUCTIONS HERE | ||
FOR HOW TO ENGAGE REPO OWNERS OR COMMUNITY FOR HELP. COULD BE A STACK OVERFLOW TAG OR OTHER | ||
CHANNEL. WHERE WILL YOU HELP PEOPLE?**. | ||
For help and questions about using this project, please also open issues. | ||
@@ -24,0 +12,0 @@ ## Microsoft Support Policy |
Sorry, the diff of this file is too big to display
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
0
106
4
4343377
15
11
26674
- Removed@tensorflow/tfjs@^3.7.0
- Removed@tensorflow/tfjs@3.21.0(transitive)
- Removed@tensorflow/tfjs-backend-cpu@3.21.0(transitive)
- Removed@tensorflow/tfjs-backend-webgl@3.21.0(transitive)
- Removed@tensorflow/tfjs-converter@3.21.0(transitive)
- Removed@tensorflow/tfjs-core@3.21.0(transitive)
- Removed@tensorflow/tfjs-data@3.21.0(transitive)
- Removed@tensorflow/tfjs-layers@3.21.0(transitive)
- Removed@types/long@4.0.2(transitive)
- Removed@types/node@20.14.2(transitive)
- Removed@types/node-fetch@2.6.11(transitive)
- Removed@types/offscreencanvas@2019.3.0(transitive)
- Removed@types/seedrandom@2.4.34(transitive)
- Removed@types/webgl-ext@0.0.30(transitive)
- Removed@types/webgl2@0.0.6(transitive)
- Removed@webgpu/types@0.1.16(transitive)
- Removedansi-regex@5.0.1(transitive)
- Removedansi-styles@4.3.0(transitive)
- Removedargparse@1.0.10(transitive)
- Removedasynckit@0.4.0(transitive)
- Removedchalk@4.1.2(transitive)
- Removedcliui@7.0.4(transitive)
- Removedcolor-convert@2.0.1(transitive)
- Removedcolor-name@1.1.4(transitive)
- Removedcombined-stream@1.0.8(transitive)
- Removedcore-js@3.37.1(transitive)
- Removeddelayed-stream@1.0.0(transitive)
- Removedemoji-regex@8.0.0(transitive)
- Removedescalade@3.1.2(transitive)
- Removedform-data@4.0.0(transitive)
- Removedget-caller-file@2.0.5(transitive)
- Removedhas-flag@4.0.0(transitive)
- Removedis-fullwidth-code-point@3.0.0(transitive)
- Removedlong@4.0.0(transitive)
- Removedmime-db@1.52.0(transitive)
- Removedmime-types@2.1.35(transitive)
- Removednode-fetch@2.6.13(transitive)
- Removedregenerator-runtime@0.13.11(transitive)
- Removedrequire-directory@2.1.1(transitive)
- Removedsafe-buffer@5.2.1(transitive)
- Removedseedrandom@3.0.5(transitive)
- Removedsprintf-js@1.0.3(transitive)
- Removedstring-width@4.2.3(transitive)
- Removedstring_decoder@1.3.0(transitive)
- Removedstrip-ansi@6.0.1(transitive)
- Removedsupports-color@7.2.0(transitive)
- Removedtr46@0.0.3(transitive)
- Removedundici-types@5.26.5(transitive)
- Removedwebidl-conversions@3.0.1(transitive)
- Removedwhatwg-url@5.0.0(transitive)
- Removedwrap-ansi@7.0.0(transitive)
- Removedy18n@5.0.8(transitive)
- Removedyargs@16.2.0(transitive)
- Removedyargs-parser@20.2.9(transitive)