prettier-plugin-glsl
Advanced tools
Comparing version 0.0.7 to 0.0.8
@@ -1,2 +0,2 @@ | ||
export declare type Matrix = number[] & { | ||
export type Matrix = number[] & { | ||
rows: number; | ||
@@ -3,0 +3,0 @@ }; |
import { TokenType } from "chevrotain"; | ||
import "colors"; | ||
import { Declarator, FunctionDefinition, FunctionPrototype, InitDeclaratorListDeclaration, Node, ParameterDeclaration, StructSpecifier, TranslationUnit } from "./nodes"; | ||
import { CheckError } from "./util"; | ||
declare type BasicType = Readonly<{ | ||
type BasicType = Readonly<{ | ||
kind: "basic"; | ||
type: TokenType; | ||
}>; | ||
declare type ArrayType = Readonly<{ | ||
type ArrayType = Readonly<{ | ||
kind: "array"; | ||
@@ -14,3 +13,3 @@ of: NormalizedType | undefined; | ||
}>; | ||
declare type StructType = Readonly<{ | ||
type StructType = Readonly<{ | ||
kind: "struct"; | ||
@@ -25,4 +24,4 @@ specifier: StructSpecifier; | ||
}>; | ||
export declare type ShaderType = "vertex" | "fragment"; | ||
declare type NormalizedType = BasicType | ArrayType | StructType; | ||
export type ShaderType = "vertex" | "fragment"; | ||
type NormalizedType = BasicType | ArrayType | StructType; | ||
declare function BasicType(type?: TokenType): NormalizedType | undefined; | ||
@@ -37,3 +36,3 @@ declare namespace BasicType { | ||
export declare function typeString(t: NormalizedType | undefined): string; | ||
declare type TypeAndValue = { | ||
type TypeAndValue = { | ||
type: NormalizedType; | ||
@@ -40,0 +39,0 @@ value: any; |
@@ -165,3 +165,3 @@ import { IToken } from "chevrotain"; | ||
} | ||
export declare type Expression = ArrayAccess | AssignmentExpression | BinaryExpression | CommaExpression | ConditionalExpression | ConstantExpression | FieldAccess | FunctionCall | MethodCall | PostfixExpression | UnaryExpression | VariableExpression; | ||
export type Expression = ArrayAccess | AssignmentExpression | BinaryExpression | CommaExpression | ConditionalExpression | ConstantExpression | FieldAccess | FunctionCall | MethodCall | PostfixExpression | UnaryExpression | VariableExpression; | ||
export declare function isExpression(n: Node): n is Expression; | ||
@@ -276,8 +276,8 @@ export interface InitDeclaratorListDeclaration extends BaseNode { | ||
} | ||
export declare type PpNode = PpDefine | PpDir | PpExtension | PpCall | PpPragma; | ||
export declare type Declaration = FunctionDefinition | FunctionPrototype | InitDeclaratorListDeclaration | PrecisionDeclaration | InvariantDeclaration | TypeQualifierDeclaration | UniformBlock | PpNode; | ||
export declare type JumpStatement = ReturnStatement | ContinueStatement | BreakStatement | DiscardStatement; | ||
export declare type IterationStatement = DoWhileStatement | ForStatement | WhileStatement; | ||
export declare type Statement = CaseLabel | CompoundStatement | ExpressionStatement | IterationStatement | JumpStatement | SelectionStatement | SwitchStatement | InitDeclaratorListDeclaration | PpNode; | ||
export declare type Node = ArraySpecifier | CaseBlock | Declaration | Declarator | Expression | FullySpecifiedType | LayoutQualifier | ParameterDeclaration | PpNode | Statement | StorageQualifier | StructDeclaration | StructSpecifier | TranslationUnit | TypeQualifier | TypeSpecifier; | ||
export type PpNode = PpDefine | PpDir | PpExtension | PpCall | PpPragma; | ||
export type Declaration = FunctionDefinition | FunctionPrototype | InitDeclaratorListDeclaration | PrecisionDeclaration | InvariantDeclaration | TypeQualifierDeclaration | UniformBlock | PpNode; | ||
export type JumpStatement = ReturnStatement | ContinueStatement | BreakStatement | DiscardStatement; | ||
export type IterationStatement = DoWhileStatement | ForStatement | WhileStatement; | ||
export type Statement = CaseLabel | CompoundStatement | ExpressionStatement | IterationStatement | JumpStatement | SelectionStatement | SwitchStatement | InitDeclaratorListDeclaration | PpNode; | ||
export type Node = ArraySpecifier | CaseBlock | Declaration | Declarator | Expression | FullySpecifiedType | LayoutQualifier | ParameterDeclaration | PpNode | Statement | StorageQualifier | StructDeclaration | StructSpecifier | TranslationUnit | TypeQualifier | TypeSpecifier; | ||
export declare class AbstractVisitor<R> { | ||
@@ -284,0 +284,0 @@ protected visit(n: Node | undefined): R | undefined; |
import { Token } from "./nodes"; | ||
import { CheckError } from "./util"; | ||
declare type SourceMap = { | ||
type SourceMap = { | ||
columnDiff: number; | ||
@@ -16,3 +16,3 @@ lineDiff: number; | ||
export declare function preproc(input: string): Token[]; | ||
declare type MacroDefinitions = Record<string, { | ||
type MacroDefinitions = Record<string, { | ||
kind: "function"; | ||
@@ -19,0 +19,0 @@ params: string[]; |
import { Many } from "lodash"; | ||
import "colors"; | ||
import { Node, Token } from "./nodes"; | ||
export declare const DEV: boolean; | ||
export declare function invariant(x: unknown, message?: string): void; | ||
export declare function underline(str: string, start: number, end: number, ff?: (x: string) => string, ff2?: (x: string) => string): string; | ||
export declare function underline(str: string, start: number, end: number): string; | ||
/** | ||
@@ -8,0 +7,0 @@ * If array, call .map, otherwise just call f on the one object. |
@@ -12,3 +12,3 @@ { | ||
], | ||
"version": "0.0.7", | ||
"version": "0.0.8", | ||
"description": "Prettier (https://prettier.io) plugin for GLSL (OpenGL Shading Language).", | ||
@@ -38,4 +38,3 @@ "exports": "./lib/prettier-plugin.cjs.js", | ||
"@netflix/nerror": "^1.1.3", | ||
"chevrotain": "^10.1.2", | ||
"colors": "^1.4.0", | ||
"chevrotain": "^10.4.2", | ||
"lodash": "^4.17.21" | ||
@@ -47,26 +46,26 @@ }, | ||
"devDependencies": { | ||
"@rollup/plugin-typescript": "^8.3.4", | ||
"@rollup/plugin-typescript": "^10.0.1", | ||
"@types/dedent": "^0.7.0", | ||
"@types/jest": "^28.1.6", | ||
"@types/lodash": "^4.14.182", | ||
"@types/node": "^18.6.3", | ||
"@types/jest": "^29.2.3", | ||
"@types/lodash": "^4.14.191", | ||
"@types/node": "^18.11.10", | ||
"@types/node-fetch": "^2.6.2", | ||
"@types/prettier": "^2.6.4", | ||
"@typescript-eslint/eslint-plugin": "^5.31.0", | ||
"@typescript-eslint/parser": "^5.31.0", | ||
"eslint": "^8.21.0", | ||
"@types/prettier": "^2.7.1", | ||
"@typescript-eslint/eslint-plugin": "^5.45.0", | ||
"@typescript-eslint/parser": "^5.45.0", | ||
"eslint": "^8.28.0", | ||
"eslint-config-prettier": "^8.5.0", | ||
"eslint-plugin-cflint": "^1.0.0", | ||
"eslint-plugin-import": "^2.26.0", | ||
"filesize": "^9.0.11", | ||
"jest": "^28.1.3", | ||
"node-fetch": "^3.2.10", | ||
"rollup": "^2.77.2", | ||
"filesize": "^10.0.5", | ||
"jest": "^29.3.1", | ||
"node-fetch": "^3.3.0", | ||
"rollup": "^3.5.1", | ||
"rollup-plugin-terser": "^7.0.2", | ||
"ts-jest": "^28.0.7", | ||
"ts-jest": "^29.0.3", | ||
"ts-node-dev": "^2.0.0" | ||
}, | ||
"resolutions": { | ||
"jest": "^28.1.3" | ||
"jest": "^29.3.1" | ||
} | ||
} |
@@ -6,3 +6,2 @@ /* eslint-disable @typescript-eslint/restrict-template-expressions */ | ||
import { TokenType } from "chevrotain" | ||
import "colors" | ||
@@ -9,0 +8,0 @@ import { |
@@ -7,3 +7,2 @@ // // noinspection JSUnusedGlobalSymbols | ||
// import { createSyntaxDiagramsCode } from "chevrotain" | ||
// import "colors" | ||
// // import prettier from "prettier" | ||
@@ -10,0 +9,0 @@ import { mapValues } from "lodash" |
import { Many } from "lodash" | ||
import "colors" | ||
import { isToken, Node, Token } from "./nodes" | ||
@@ -13,14 +12,4 @@ | ||
export function underline( | ||
str: string, | ||
start: number, | ||
end: number, | ||
ff = (x: string) => x.yellow.underline, | ||
ff2 = (x: string) => x, | ||
): string { | ||
return ( | ||
ff2(str.substring(0, start)) + | ||
ff(str.substring(start, end)) + | ||
ff2(str.substring(end)) | ||
) | ||
export function underline(str: string, start: number, end: number): string { | ||
return str + "\n" + "-".repeat(start) + "^".repeat(end - start) | ||
} | ||
@@ -93,9 +82,8 @@ | ||
l, | ||
sLine === n ? token.startColumn - 1 : 0, | ||
eLine === n ? token.endColumn : l.length, | ||
(s) => s.red.underline, | ||
6 + (sLine === n ? token.startColumn - 1 : 0), | ||
6 + (eLine === n ? token.endColumn : l.length), | ||
) | ||
} | ||
return ("" + n).padStart(5).green + " " + l | ||
return ("" + n).padStart(5) + " " + l | ||
}) | ||
@@ -102,0 +90,0 @@ .join("\n") |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
Sorry, the diff of this file is not supported yet
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
4
47
539149
11833
- Removedcolors@^1.4.0
- Removedcolors@1.4.0(transitive)
Updatedchevrotain@^10.4.2