@toml-tools/parser
Advanced tools
Comparing version 0.4.0 to 1.0.0
@@ -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", () => { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
222759
513
1
Yes
+ Added@chevrotain/cst-dts-gen@11.0.3(transitive)
+ Added@chevrotain/gast@11.0.3(transitive)
+ Added@chevrotain/regexp-to-ast@11.0.3(transitive)
+ Added@chevrotain/types@11.0.3(transitive)
+ Added@chevrotain/utils@11.0.3(transitive)
+ Added@toml-tools/lexer@1.0.1(transitive)
+ Addedchevrotain@11.0.3(transitive)
+ Addedlodash-es@4.17.21(transitive)
- Removed@chevrotain/cst-dts-gen@10.5.0(transitive)
- Removed@chevrotain/gast@10.5.0(transitive)
- Removed@chevrotain/types@10.5.0(transitive)
- Removed@chevrotain/utils@10.5.0(transitive)
- Removed@toml-tools/lexer@0.4.0(transitive)
- Removedchevrotain@10.5.0(transitive)
- Removedlodash@4.17.21(transitive)
- Removedregexp-to-ast@0.5.0(transitive)
Updated@toml-tools/lexer@^1.0.0
Updatedchevrotain@^11.0.1