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

@toml-tools/parser

Package Overview
Dependencies
Maintainers
2
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@toml-tools/parser - npm Package Compare versions

Comparing version 0.4.0 to 1.0.0

34

benchmark/benchmark.js

@@ -1,12 +0,14 @@

const Benchmark = require("benchmark");
const _ = require("lodash");
const fs = require("fs");
const path = require("path");
const klawSync = require("klaw-sync");
const tomlToolsParse = require("../").parse;
const iarnaTomlParse = require("@iarna/toml").parse;
const tomlNode = require("toml").parse;
const tomlj4Parse = require("toml-j0.4").parse;
import Benchmark from "benchmark";
import _ from "lodash-es";
import fs from "fs";
import path from "path";
import { fileURLToPath } from "url";
import klawSync from "klaw-sync";
import { parse as tomlToolsParse } from "@toml-tools/parser";
import { parse as iarnaTomlParse } from "@iarna/toml";
import { parse as tomlNode } from "toml";
import tomlj4 from "toml-j0.4";
import bombadil from "@sgarciac/bombadil";
const bombadil = require("@sgarciac/bombadil");
const tomlj4Parse = tomlj4.parse;

@@ -18,17 +20,19 @@ function parseBombadil(input) {

const _dirname = path.dirname(fileURLToPath(import.meta.url));
// Processing the input samples **before** the benchmark
const samplesDir = path.join(__dirname, "./samples/");
const samplesDir = path.join(_dirname, "./samples/");
const allSampleFiles = klawSync(samplesDir);
const tomlSampleFiles = _.filter(allSampleFiles, (fileDesc) =>
fileDesc.path.endsWith(".toml")
fileDesc.path.endsWith(".toml"),
);
const relTomlFilesPaths = _.map(tomlSampleFiles, (fileDesc) =>
path.relative(__dirname, fileDesc.path)
path.relative(_dirname, fileDesc.path),
);
const tomlFilesContents = _.map(tomlSampleFiles, (fileDesc) =>
fs.readFileSync(fileDesc.path, "utf8")
fs.readFileSync(fileDesc.path, "utf8"),
);
const samplesRelPathToContent = _.zipObject(
relTomlFilesPaths,
tomlFilesContents
tomlFilesContents,
);

@@ -35,0 +39,0 @@

# @toml-tools/parser
## 1.0.0
### Major Changes
- [#67](https://github.com/un-ts/toml-tools/pull/67) [`8daff91`](https://github.com/un-ts/toml-tools/commit/8daff91c3cce09e3c8bb3501be8b9be39e796f63) Thanks [@JounQin](https://github.com/JounQin)! - feat!: migrate to pure ESM and prettier v3
### Patch Changes
- Updated dependencies [[`8daff91`](https://github.com/un-ts/toml-tools/commit/8daff91c3cce09e3c8bb3501be8b9be39e796f63)]:
- @toml-tools/lexer@1.0.0
## 0.4.0

@@ -4,0 +15,0 @@

@@ -1,3 +0,3 @@

const { tokenize } = require("@toml-tools/lexer");
const { TomlParser } = require("./parser");
import { tokenize } from "@toml-tools/lexer";
import { TomlParser } from "./parser.js";

@@ -22,3 +22,3 @@ const parser = new TomlParser();

"!\n" +
firstError.message
firstError.message,
);

@@ -39,3 +39,3 @@ }

// TODO: should the stack always appear on errors msg?
error.context.ruleStack.join("\n\t->")
error.context.ruleStack.join("\n\t->"),
);

@@ -47,6 +47,7 @@ }

module.exports = {
export {
parse,
BaseTomlCstVisitor,
BaseTomlCstVisitorWithDefaults,
TomlParser,
};

@@ -1,3 +0,3 @@

const { CstParser } = require("chevrotain");
const { tokensDictionary: t } = require("@toml-tools/lexer");
import { CstParser } from "chevrotain";
import { tokensDictionary as t } from "@toml-tools/lexer";

@@ -47,3 +47,3 @@ class TomlParser extends CstParser {

{ ALT: () => $.CONSUME(t.Comment) },
])
]),
);

@@ -81,3 +81,3 @@ $.OPTION(() => {

{ ALT: () => $.CONSUME(t.IInteger) },
])
]),
);

@@ -179,4 +179,2 @@ });

module.exports = {
TomlParser,
};
export { TomlParser };
{
"name": "@toml-tools/parser",
"version": "0.4.0",
"version": "1.0.0",
"type": "module",
"description": "TOML Parser Implemented in JavaScript",
"repository": "https://github.com/un-ts/toml-tools/tree/master/packages/parser",
"license": "MIT",
"main": "lib/api.js",
"exports": {
".": {
"types": "./api.d.ts",
"default": "./lib/api.js"
},
"./package.json": "./package.json"
},
"types": ".api.d.ts",
"keywords": [

@@ -9,9 +21,2 @@ "toml",

],
"main": "lib/api.js",
"repository": "https://github.com/un-ts/toml-tools/tree/master/packages/parser",
"license": "MIT",
"dependencies": {
"@toml-tools/lexer": "^0.4.0",
"chevrotain": "^10.4.2"
},
"scripts": {

@@ -21,5 +26,5 @@ "benchmark": "node ./benchmark/benchmark.js",

},
"typings": "./api.d.ts",
"publishConfig": {
"access": "public"
"dependencies": {
"@toml-tools/lexer": "^1.0.0",
"chevrotain": "^11.0.1"
},

@@ -31,3 +36,6 @@ "devDependencies": {

"toml-j0.4": "^1.1.1"
},
"publishConfig": {
"access": "public"
}
}

@@ -1,3 +0,3 @@

const { parse, BaseTomlCstVisitorWithDefaults } = require("../");
const { expect } = require("chai");
import { parse, BaseTomlCstVisitorWithDefaults } from "@toml-tools/parser";
import { expect } from "chai";

@@ -4,0 +4,0 @@ describe("The Toml Tools Parser", () => {

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