Socket
Socket
Sign inDemoInstall

prettier-plugin-glsl

Package Overview
Dependencies
11
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.0.10 to 0.1.0

5

package.json

@@ -12,3 +12,3 @@ {

],
"version": "0.0.10",
"version": "0.1.0",
"description": "Prettier (https://prettier.io) plugin for GLSL (OpenGL Shading Language).",

@@ -42,3 +42,3 @@ "exports": "./lib/prettier-plugin.cjs.js",

"peerDependencies": {
"prettier": "^2.0.0"
"prettier": "^3.0.0"
},

@@ -52,3 +52,2 @@ "devDependencies": {

"@types/node-fetch": "^2.6.3",
"@types/prettier": "^2.7.2",
"@typescript-eslint/eslint-plugin": "^5.57.0",

@@ -55,0 +54,0 @@ "@typescript-eslint/parser": "^5.57.0",

51

src/prettier-plugin.ts

@@ -6,3 +6,3 @@ // noinspection JSUnusedGlobalSymbols

Doc,
format,
Options,
ParserOptions,

@@ -50,3 +50,2 @@ Plugin,

const {
utils: { propagateBreaks },
printer: { printDocToString },

@@ -128,3 +127,3 @@ builders: {

"glsl-parser": {
parse(text, _parsers, _options) {
parse(text, _options) {
const translationUnit = parseInput(text)

@@ -308,3 +307,2 @@ translationUnit.comments?.forEach(

function formatMacroDefinition(doc: Doc, options: GlslParserOptions): string {
propagateBreaks(doc)
const formatted = printDocToString(

@@ -805,3 +803,3 @@ doc,

if (!comment.leading && !comment.trailing) {
parts.push(printComment(path, options))
parts.push(print(path))
comment.printed = true

@@ -1096,3 +1094,3 @@ }

? paren(p<typeof n>("node"), isExpression(n.node))
: fill(join(line, path.map(print, "tokens")).parts),
: fill(join(line, path.map(print, "tokens"))),
]),

@@ -1112,3 +1110,3 @@ ])

? p<typeof n>("node")
: fill(join(line, path.map(print, "tokens")).parts),
: fill(join(line, path.map(print, "tokens"))),
),

@@ -1221,4 +1219,26 @@ ]),

},
embed(
path: AstPath,
options: Options,
):
| null
| ((
textToDoc: (text: string, options: Options) => Promise<Doc>,
print: (
selector?: string | number | Array<string | number> | AstPath,
) => Doc,
path: AstPath,
options: Options,
) => Promise<Doc | undefined> | Doc | undefined) {
const node = path.getValue() as Node | Token
if (
!isToken(node) ||
(node.tokenType !== TOKEN.LINE_COMMENT &&
node.tokenType !== TOKEN.MULTILINE_COMMENT)
) {
return null
}
return (textToDoc, print, path, options) => {}
},
// @ts-expect-error getCommentChildNodes isn't in the API for some reason
getCommentChildNodes(node: Node | Token): Node[] {

@@ -1261,9 +1281,10 @@ return isToken(node) ? [] : CHILDREN_VISITOR.visit(node)!

.trim()
const formattedComment = format(src, {
...options,
printWidth: options.printWidth - 3,
parser: "markdown",
proseWrap: "always",
plugins: [],
})
// const formattedComment: string = await format(src, {
// ...options,
// printWidth: options.printWidth - 3,
// parser: "markdown",
// proseWrap: "always",
// plugins: [],
// })
const formattedComment = src
const formattedCommentLines = formattedComment.split("\n")

@@ -1270,0 +1291,0 @@ // Remove the final newline which markdown formatter always adds.

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc