@shaderfrog/core 2.0.0-beta.2 → 2.0.0-beta.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -29,9 +29,9 @@ export declare const computeContextForNodes: (engineContext: EngineContext, engi
29
29
  * Compute the context for every node in the graph, done on initial graph load
30
30
  * to compute the inputs/outputs for every node
31
31
  */
32
- export declare const computeAllContexts: (engineContext: EngineContext, engine: Engine, graph: Graph) => Promise<NodeErrors>;
32
+ export declare const computeAllContexts: (engineContext: EngineContext, engine: Engine, graph: Graph) => Promise<NodeErrors | undefined>;
33
33
  /**
34
34
  * Compute the contexts for nodes starting from the outputs, working backwards.
35
35
  * Used to only (re)-compute context for any actively used nodes
36
36
  */
37
- export declare const computeGraphContext: (engineContext: EngineContext, engine: Engine, graph: Graph) => Promise<NodeErrors>;
37
+ export declare const computeGraphContext: (engineContext: EngineContext, engine: Engine, graph: Graph) => Promise<NodeErrors | undefined>;
package/graph/graph.d.ts CHANGED
@@ -18,9 +18,9 @@ export declare const mangleName: (name: string, node: GraphNode, nextSibling?: G
18
18
  export declare const mangleVar: (name: string, engine: Engine, node: GraphNode, sibling?: GraphNode) => string;
19
19
  export declare const mangleEntireProgram: (engine: Engine, ast: FrogProgram, node: GraphNode, sibling?: GraphNode) => void;
20
20
  export declare const mangleMainFn: (ast: Program, node: GraphNode, sibling?: GraphNode) => void;
21
- export declare const ensureFromNode: (graph: Graph, inputEdge: Edge) => GraphNode;
21
+ export declare const ensureFromNode: (graph: Graph, inputEdge: Edge) => import("./data-nodes").NumberNode | import("./data-nodes").TextureNode | import("./data-nodes").SamplerCubeNode | import("./data-nodes").ArrayNode | import("./data-nodes").Vector2Node | import("./data-nodes").Vector3Node | import("./data-nodes").Vector4Node | import("./data-nodes").RgbNode | import("./data-nodes").RgbaNode | CodeNode | import("./code-nodes").BinaryNode;
22
22
  export declare const resetGraphIds: (graph: Graph) => Graph;
23
- export declare const findLinkedNode: (graph: Graph, id: string) => GraphNode;
23
+ export declare const findLinkedNode: (graph: Graph, id: string) => GraphNode | undefined;
24
24
  /**
25
25
  * Find any unconnected vertex nodes linked to collected fragment nodes
26
26
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shaderfrog/core",
3
- "version": "2.0.0-beta.2",
3
+ "version": "2.0.0-beta.3",
4
4
  "description": "Shaderfrog core",
5
5
  "type": "module",
6
6
  "files": [
@@ -48,7 +48,7 @@
48
48
  "lodash.groupby": "^4.6.0"
49
49
  },
50
50
  "peerDependencies": {
51
- "@shaderfrog/glsl-parser": "^5.0.0-beta.3",
51
+ "@shaderfrog/glsl-parser": "^5.0.0-beta.4",
52
52
  "babylonjs": ">=4",
53
53
  "playcanvas": "^1.65.3",
54
54
  "three": ">=0.50"
@@ -15,7 +15,7 @@ export declare const physicalDefaultProperties: {
15
15
  * generation where if you set diffuse to white (1,1,1) then it doesn't
16
16
  * add the diffuse uniform, because that's the default state.
17
17
  */
18
- export declare const defaultPropertySetting: (app: pc.Application, property: NodeProperty) => 0.5 | pc.Texture | pc.Color;
18
+ export declare const defaultPropertySetting: (app: pc.Application, property: NodeProperty) => 0.5 | pc.Texture | pc.Color | undefined;
19
19
  export declare const physicalNode: (id: string, name: string, position: NodePosition, uniforms: UniformDataType[], stage: ShaderStage | undefined) => CodeNode;
20
20
  export type RuntimeContext = {
21
21
  scene: pc.Scene;
@@ -7,7 +7,7 @@ import { NodePosition } from '../../graph/base-node';
7
7
  import { UniformDataType } from '../../graph/data-nodes';
8
8
  export declare const phongNode: (id: string, name: string, position: NodePosition, uniforms: UniformDataType[], stage: ShaderStage | undefined) => CodeNode;
9
9
  export declare const physicalNode: (id: string, name: string, position: NodePosition, uniforms: UniformDataType[], stage: ShaderStage | undefined) => CodeNode;
10
- export declare const defaultPropertySetting: (property: NodeProperty) => 0.5 | Texture | Color | Vector4;
10
+ export declare const defaultPropertySetting: (property: NodeProperty) => 0.5 | Texture | Color | Vector4 | undefined;
11
11
  export type ThreeRuntime = {
12
12
  scene: any;
13
13
  camera: any;
package/util/ast.d.ts CHANGED
@@ -7,7 +7,7 @@ export interface FrogProgram extends Program {
7
7
  outVar?: string;
8
8
  }
9
9
  export declare const findVec4Constructor: (ast: AstNode) => AstNode | undefined;
10
- export declare const findAssignmentTo: (ast: AstNode | Program, assignTo: string, nth?: number) => DeclarationNode | ExpressionStatementNode;
10
+ export declare const findAssignmentTo: (ast: AstNode | Program, assignTo: string, nth?: number) => DeclarationNode | ExpressionStatementNode | undefined;
11
11
  export declare const findDeclarationOf: (ast: AstNode | Program, declarationOf: string) => DeclarationNode | undefined;
12
12
  export declare const from2To3: (ast: Program, stage: ShaderStage) => void;
13
13
  export declare const makeStatement: (stmt: string) => readonly [DeclarationStatementNode | FunctionNode | import("@shaderfrog/glsl-parser/ast").PreprocessorNode, Scope];
@@ -12,7 +12,7 @@ export declare const combineWs: (a: string | string[], b: string | string[]) =>
12
12
  export declare const transferWhitespace: (to: AstNode, from: AstNode) => [AstNode, AstNode];
13
13
  export declare const getLiteralIndent: (node: {
14
14
  whitespace: Whitespace;
15
- }) => string;
15
+ }) => string | undefined;
16
16
  export declare const tryAddTrailingWhitespace: <T extends AstNode>(node: T, ws: string) => T;
17
17
  export declare const guessFnIndent: (fnBody: FunctionNode) => string;
18
18
  export declare const addFnStmtWithIndent: (fnBody: FunctionNode, newNode: string | AstNode) => AstNode[];
@@ -76,7 +76,7 @@ export var tryAddTrailingWhitespace = function (node, ws) {
76
76
  export var guessFnIndent = function (fnBody) {
77
77
  return getLiteralIndent(fnBody.body.lb) ||
78
78
  fnBody.body.statements.reduce(function (ws, n) {
79
- return ws || getLiteralIndent(n.semi);
79
+ return ws || getLiteralIndent(n.semi) || '';
80
80
  }, '');
81
81
  };
82
82
  export var addFnStmtWithIndent = function (fnBody, newNode) {