From 35fdd69809ebe058ab2605db2ab3e2567085a688 Mon Sep 17 00:00:00 2001 From: Andy Ray Date: Sat, 10 Aug 2024 10:42:32 -0700 Subject: [PATCH 1/2] Adding more exports from root --- package.json | 2 +- src/parser/parser.d.ts | 12 +++++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index c6fe9cd..f2e787e 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "engines": { "node": ">=16" }, - "version": "5.1.0", + "version": "5.1.1", "type": "module", "description": "A GLSL ES 1.0 and 3.0 parser and preprocessor that can preserve whitespace and comments", "scripts": { diff --git a/src/parser/parser.d.ts b/src/parser/parser.d.ts index 4c79cae..424bf5d 100644 --- a/src/parser/parser.d.ts +++ b/src/parser/parser.d.ts @@ -17,7 +17,17 @@ export type ParserOptions = Partial<{ // Allow to fetch util functions from parser directly. I'd like to inline those // functions directly in this file, but then the tests can't find it since jest // can't import from .d.ts files as there's no accompanying ts/js file -export { renameBindings, renameFunctions } from './utils'; +export { + renameBinding, + renameBindings, + renameType, + renameTypes, + renameFunction, + renameFunctions, + debugEntry, + debugFunctionEntry, + debugScopes, +} from './utils'; export type Parse = { (input: string, options?: ParserOptions): Program; From d2a26adff90c751b5192fd10e6651dbbc293c729 Mon Sep 17 00:00:00 2001 From: Andy Ray Date: Sat, 10 Aug 2024 10:45:56 -0700 Subject: [PATCH 2/2] Updating readme import --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 14f6830..5756e64 100644 --- a/README.md +++ b/README.md @@ -457,7 +457,7 @@ If you want your ast.scopes array to stay in sync with your AST, you need to re-assign it to the output of the functions! Examples: ```typescript -import { renameBindings, renameFunctions, renameTypes } from '@shaderfrog/glsl-parser/utils'; +import { renameBindings, renameFunctions, renameTypes } from '@shaderfrog/glsl-parser/parser/utils'; // Suffix top level variables with _x, and update the scope ast.scopes[0].bindings = renameBindings(ast.scopes[0].bindings, (name) => `${name}_x`); @@ -473,7 +473,7 @@ There are also functions to rename only one variable/identifier in a given scope. Use these if you know specifically which variable you want to rename. ```typescript -import { renameBinding, renameFunction, renameType } from '@shaderfrog/glsl-parser/utils'; +import { renameBinding, renameFunction, renameType } from '@shaderfrog/glsl-parser/parser/utils'; // Replace all instances of "oldVar" with "newVar" in the global scope, and // creates a new global scope entry named "newVar"