Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@dodona/dolos-lib

Package Overview
Dependencies
Maintainers
6
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@dodona/dolos-lib - npm Package Compare versions

Comparing version 3.0.0 to 3.1.0

dist/index.d.ts.map

37

dist/lib/language.js

@@ -26,12 +26,10 @@ var _a;

async loadLanguageModule() {
try {
if (this.languageModule === undefined) {
// @ts-ignore
this.languageModule = (await import("@dodona/dolos-parsers")).default[this.name];
if (this.languageModule === undefined) {
this.languageModule = (await import(`tree-sitter-${this.name}`)).default;
throw new LanguageError("Could not find language module for: " + this.name);
}
return this.languageModule;
}
catch (error) {
throw new Error(`The module 'tree-sitter-${this.name}' could not be found. ` +
"Try to install it using npm or yarn, but it may not be supported (yet).");
}
return this.languageModule;
}

@@ -88,4 +86,4 @@ async createTokenizer() {

for (const extension of language.extensions) {
this.byExtension.set(extension, language);
this.byName.set(language.name, language);
this.byExtension.set(extension.toLowerCase(), language);
this.byName.set(language.name.toLowerCase(), language);
}

@@ -107,6 +105,6 @@ }

for (const file of files) {
const count = ((_b = counts.get(file.extension)) !== null && _b !== void 0 ? _b : 0) + 1;
const count = ((_b = counts.get(file.extension.toLowerCase())) !== null && _b !== void 0 ? _b : 0) + 1;
if (count > maxCount) {
maxCount = count;
language = this.byExtension.get(file.extension);
language = this.byExtension.get(file.extension.toLowerCase());
}

@@ -126,5 +124,5 @@ counts.set(file.extension, count);

async findLanguage(name) {
let language = this.byName.get(name);
let language = this.byName.get(name.toLowerCase());
if (language == null) {
const proglang = new ProgrammingLanguage(name, []);
const proglang = new ProgrammingLanguage(name.toLowerCase(), []);
// Try to load the language module to see if it exists,

@@ -146,11 +144,10 @@ // will throw an error if it does not exist.

new ProgrammingLanguage("php", [".php", ".php3", ".php4", ".php5", ".php7", ".phps", ".phpt", ".phtml"]),
new ProgrammingLanguage("modelica", [".mo", ".mos"]),
new ProgrammingLanguage("java", [".java"]),
new ProgrammingLanguage("javascript", [".js"]),
new CustomTreeSitterLanguage("elm", [".elm"], "@elm-tooling/tree-sitter-elm"),
new CustomTreeSitterLanguage("typescript", [".ts"],
// @ts-ignore
async () => (await import("tree-sitter-typescript")).default.typescript),
new CustomTreeSitterLanguage("tsx", [".tsx"],
// @ts-ignore
async () => (await import("tree-sitter-typescript")).default.tsx),
new ProgrammingLanguage("elm", [".elm"]),
new ProgrammingLanguage("r", [".r", ".rdata", ".rds", ".rda"]),
new ProgrammingLanguage("sql", [".sql"]),
new ProgrammingLanguage("typescript", [".ts"]),
new ProgrammingLanguage("tsx", [".tsx"]),
new CustomTokenizerLanguage("char", [".txt", ".md"], async (self) => {

@@ -157,0 +154,0 @@ const { CharTokenizer } = await import("./tokenizer/charTokenizer.js");

{
"name": "@dodona/dolos-lib",
"version": "3.0.0",
"version": "3.1.0",
"exports": "./dist/index.js",

@@ -30,3 +30,3 @@ "type": "module",

"@ava/typescript": "4.1.0",
"@types/d3-dsv": "3.0.5",
"@types/d3-dsv": "3.0.7",
"@types/node": "^20.3.2",

@@ -36,23 +36,12 @@ "@typescript-eslint/eslint-plugin": "6.8.0",

"ava": "5.3.1",
"eslint": "8.52.0",
"node-gyp": "^9.4.0",
"eslint": "8.53.0",
"node-gyp": "^9.4.1",
"typescript": "5.2.2"
},
"dependencies": {
"@dodona/dolos-core": "1.0.0",
"d3-dsv": "^3.0.0"
"@dodona/dolos-parsers": "1.0.0",
"@dodona/dolos-core": "1.0.1",
"d3-dsv": "^3.0.1",
"tree-sitter": "^0.20.6"
},
"optionalDependencies": {
"@elm-tooling/tree-sitter-elm": "5.6.6",
"tree-sitter": "^0.20.5",
"tree-sitter-bash": "^0.20.3",
"tree-sitter-c": "^0.20.4",
"tree-sitter-c-sharp": "^0.20.0",
"tree-sitter-cpp": "^0.20.2",
"tree-sitter-javascript": "^0.20.0",
"tree-sitter-java": "^0.20.0",
"tree-sitter-php": "^0.19.0",
"tree-sitter-python": "^0.20.3",
"tree-sitter-typescript": "^0.20.0"
},
"bugs": {

@@ -59,0 +48,0 @@ "url": "https://github.com/dodona-edu/dolos/issues"

@@ -17,8 +17,9 @@ # Dolos lib

Dolos uses [tree-sitter](https://www.npmjs.com/package/tree-sitter) to parse
source code files. Tree-sitter currently only runs in node and will thus not
run in browser environments. Since some of the library's functionality is use
by the [Dolos Web UI](https://www.npmjs.com/package/@dodona/dolos-web), the
dependency on tree-sitter is optional.
**Required:** Node.js, Python 3 and a compiler (GCC)
Dolos uses [tree-sitter](https://www.npmjs.com/package/tree-sitter) to parse source code files.
Tree-sitter currently only runs in node and will thus not run in browser environments.
If you only require the matching algorithms, you can use the platform-independent library [Dolos Core](https://www.npmjs.com/package/@dodona/dolos-core).
## Usage

@@ -25,0 +26,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc