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

prettier-plugin-toml

Package Overview
Dependencies
Maintainers
2
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

prettier-plugin-toml - npm Package Compare versions

Comparing version 0.3.5 to 0.4.0

14

CHANGELOG.md
# prettier-plugin-toml
## 0.4.0
### Minor Changes
- [#64](https://github.com/un-ts/toml-tools/pull/64) [`1da2ff1`](https://github.com/un-ts/toml-tools/commit/1da2ff14f2333008f312534a3016114c94600e06) Thanks [@JounQin](https://github.com/JounQin)! - feat: mark prettier as peer dependency instead
- [#64](https://github.com/un-ts/toml-tools/pull/64) [`1da2ff1`](https://github.com/un-ts/toml-tools/commit/1da2ff14f2333008f312534a3016114c94600e06) Thanks [@JounQin](https://github.com/JounQin)! - feat: upgrade chevrotain to v10
### Patch Changes
- Updated dependencies [[`1da2ff1`](https://github.com/un-ts/toml-tools/commit/1da2ff14f2333008f312534a3016114c94600e06)]:
- @toml-tools/lexer@0.4.0
- @toml-tools/parser@0.4.0
## 0.3.5

@@ -4,0 +18,0 @@

14

lib/api.js

@@ -18,4 +18,4 @@ const { locStart, locEnd } = require("./loc");

language_id: 365,
vscodeLanguageIds: ["toml"]
}
vscodeLanguageIds: ["toml"],
},
];

@@ -29,4 +29,4 @@

locStart,
locEnd
}
locEnd,
},
};

@@ -37,4 +37,4 @@

"toml-cst": {
print
}
print,
},
};

@@ -45,3 +45,3 @@

parsers,
printers
printers,
// TODO: are any options/default options needed?

@@ -48,0 +48,0 @@ // - Prefer certain inline variants when possible?

@@ -11,3 +11,3 @@ function locStart(cstNode) {

locStart,
locEnd
locEnd,
};

@@ -11,3 +11,3 @@ function trimComment(commentText) {

const comments = [];
commentsNL.forEach(commentNLNode => {
commentsNL.forEach((commentNLNode) => {
const commentsTok = commentNLNode.children.Comment;

@@ -34,5 +34,3 @@ if (commentsTok !== undefined) {

throw Error(
`Expecting single item in CST ctx key but found: <${
singleElementValues.length
}> items`
`Expecting single item in CST ctx key but found: <${singleElementValues.length}> items`
);

@@ -83,3 +81,3 @@ }

arrItemProp,
getSingle
getSingle,
};

@@ -9,14 +9,6 @@ const { BaseTomlCstVisitor } = require("@toml-tools/parser");

arrItemProp,
getSingle
getSingle,
} = require("./printer-utils");
const {
concat,
join,
line,
hardline,
softline,
ifBreak,
indent,
group
} = require("prettier").doc.builders;
const { concat, join, line, hardline, softline, ifBreak, indent, group } =
require("prettier").doc.builders;

@@ -31,3 +23,3 @@ class TomlBeautifierVisitor extends BaseTomlCstVisitor {

// false positive errors on redundant methods
this.mapVisit = elements => {
this.mapVisit = (elements) => {
if (elements === undefined) {

@@ -41,3 +33,3 @@ // TODO: can optimize this by returning an immutable empty array singleton.

this.visitSingle = function(ctx) {
this.visitSingle = function (ctx) {
const singleElement = getSingle(ctx);

@@ -51,3 +43,3 @@ return this.visit(singleElement);

const orgVisit = this.visit;
this.visit = function(ctx, inParam) {
this.visit = function (ctx, inParam) {
if (ctx === undefined) {

@@ -115,5 +107,5 @@ // empty Doc

cstGroups.reverse();
const docGroups = cstGroups.map(currGroup => this.mapVisit(currGroup));
const docGroups = cstGroups.map((currGroup) => this.mapVisit(currGroup));
// newlines between each group's elements
const docGroupsInnerNewlines = docGroups.map(currGroup =>
const docGroupsInnerNewlines = docGroups.map((currGroup) =>
join(line, currGroup)

@@ -128,3 +120,3 @@ );

// Terminating newline
line
line,
]);

@@ -160,3 +152,3 @@ }

key(ctx) {
const keyTexts = ctx.IKey.map(tok => tok.image);
const keyTexts = ctx.IKey.map((tok) => tok.image);
// TODO: inspect if the use of a quoted key was really needed

@@ -181,3 +173,3 @@ // and remove quotes if not.

const commentsDocs = concat(
postComments.map(commentTok => {
postComments.map((commentTok) => {
const trimmedCommentText = trimComment(commentTok.image);

@@ -192,3 +184,3 @@ return concat([hardline, trimmedCommentText]);

softline,
"]"
"]",
])

@@ -310,3 +302,3 @@ );

module.exports = {
print
print,
};
{
"name": "prettier-plugin-toml",
"version": "0.3.5",
"version": "0.4.0",
"description": "TOML Prettier Plugin",

@@ -14,7 +14,9 @@ "keywords": [

"license": "MIT",
"dependencies": {
"@toml-tools/lexer": "^0.3.5",
"@toml-tools/parser": "^0.3.5",
"peerDependencies": {
"prettier": "^1.16.0 || ^2.0.0"
},
"dependencies": {
"@toml-tools/lexer": "^0.4.0",
"@toml-tools/parser": "^0.4.0"
},
"scripts": {

@@ -21,0 +23,0 @@ "test": "mocha ./test/**/*spec.js"

@@ -24,3 +24,3 @@ const prettier = require("prettier");

parser: "toml",
plugins: [pluginPath]
plugins: [pluginPath],
});

@@ -36,3 +36,3 @@

parser: "toml",
plugins: [pluginPath]
plugins: [pluginPath],
});

@@ -42,3 +42,3 @@

parser: "toml",
plugins: [pluginPath]
plugins: [pluginPath],
});

@@ -57,3 +57,3 @@ expect(onePass).to.equal(secondPass);

module.exports = {
testSample
testSample,
};
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