Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding more exports from root #33

Merged
merged 2 commits into from
Aug 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`);
Expand All @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
12 changes: 11 additions & 1 deletion src/parser/parser.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

after merge this doesn't work lol


export type Parse = {
(input: string, options?: ParserOptions): Program;
Expand Down
Loading