@shaderfrog/core 1.1.0 → 1.1.2

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.
Files changed (89) hide show
  1. package/{dist/engine.js → engine.js} +28 -19
  2. package/graph/base-node.js +13 -0
  3. package/{dist/graph → graph}/code-nodes.js +9 -4
  4. package/{dist/graph → graph}/context.js +39 -29
  5. package/{dist/graph → graph}/data-nodes.js +27 -12
  6. package/graph/edge.js +12 -0
  7. package/{dist/graph → graph}/evaluate.js +10 -5
  8. package/{dist/graph → graph}/graph-node.js +28 -20
  9. package/{dist/graph → graph}/graph-types.js +10 -7
  10. package/{dist/graph → graph}/graph.js +129 -102
  11. package/{dist/graph → graph}/graph.test.js +41 -36
  12. package/graph/index.js +27 -0
  13. package/{dist/graph → graph}/parsers.js +45 -39
  14. package/{dist/graph → graph}/shader-sections.js +36 -24
  15. package/index.js +19 -0
  16. package/package.json +10 -2
  17. package/{dist/plugins → plugins}/babylon/bablyengine.js +86 -78
  18. package/{dist/plugins → plugins}/babylon/importers.js +7 -5
  19. package/plugins/babylon/index.js +5 -0
  20. package/{dist/plugins → plugins}/playcanvas/importers.js +5 -3
  21. package/plugins/playcanvas/index.js +5 -0
  22. package/{dist/plugins → plugins}/playcanvas/playengine.js +96 -64
  23. package/{dist/plugins → plugins}/three/importers.js +5 -3
  24. package/plugins/three/index.js +6 -0
  25. package/{dist/plugins → plugins}/three/threngine.js +122 -111
  26. package/strategy/assignemntTo.js +31 -0
  27. package/strategy/declarationOf.js +28 -0
  28. package/{dist/strategy → strategy}/hardCode.js +9 -4
  29. package/strategy/index.js +25 -0
  30. package/{dist/strategy → strategy}/inject.js +13 -8
  31. package/{dist/strategy → strategy}/namedAttribute.js +13 -8
  32. package/strategy/strategy.js +35 -0
  33. package/{dist/strategy → strategy}/stratgies.test.js +59 -31
  34. package/{dist/strategy → strategy}/texture2D.js +15 -10
  35. package/{dist/strategy → strategy}/uniform.js +17 -12
  36. package/{dist/strategy → strategy}/variable.js +14 -9
  37. package/{dist/util → util}/ast.js +59 -40
  38. package/{dist/util → util}/ensure.js +5 -1
  39. package/util/id.js +6 -0
  40. package/dist/graph/base-node.js +0 -9
  41. package/dist/graph/edge.js +0 -7
  42. package/dist/graph/index.js +0 -11
  43. package/dist/index.js +0 -3
  44. package/dist/plugins/babylon/index.js +0 -2
  45. package/dist/plugins/playcanvas/index.js +0 -2
  46. package/dist/plugins/three/index.js +0 -2
  47. package/dist/strategy/assignemntTo.js +0 -26
  48. package/dist/strategy/declarationOf.js +0 -23
  49. package/dist/strategy/index.js +0 -9
  50. package/dist/strategy/strategy.js +0 -31
  51. package/dist/util/id.js +0 -2
  52. /package/{dist/engine.d.ts → engine.d.ts} +0 -0
  53. /package/{dist/graph → graph}/base-node.d.ts +0 -0
  54. /package/{dist/graph → graph}/code-nodes.d.ts +0 -0
  55. /package/{dist/graph → graph}/context.d.ts +0 -0
  56. /package/{dist/graph → graph}/data-nodes.d.ts +0 -0
  57. /package/{dist/graph → graph}/edge.d.ts +0 -0
  58. /package/{dist/graph → graph}/evaluate.d.ts +0 -0
  59. /package/{dist/graph → graph}/graph-node.d.ts +0 -0
  60. /package/{dist/graph → graph}/graph-types.d.ts +0 -0
  61. /package/{dist/graph → graph}/graph.d.ts +0 -0
  62. /package/{dist/graph → graph}/graph.test.d.ts +0 -0
  63. /package/{dist/graph → graph}/index.d.ts +0 -0
  64. /package/{dist/graph → graph}/parsers.d.ts +0 -0
  65. /package/{dist/graph → graph}/shader-sections.d.ts +0 -0
  66. /package/{dist/index.d.ts → index.d.ts} +0 -0
  67. /package/{dist/plugins → plugins}/babylon/bablyengine.d.ts +0 -0
  68. /package/{dist/plugins → plugins}/babylon/importers.d.ts +0 -0
  69. /package/{dist/plugins → plugins}/babylon/index.d.ts +0 -0
  70. /package/{dist/plugins → plugins}/playcanvas/importers.d.ts +0 -0
  71. /package/{dist/plugins → plugins}/playcanvas/index.d.ts +0 -0
  72. /package/{dist/plugins → plugins}/playcanvas/playengine.d.ts +0 -0
  73. /package/{dist/plugins → plugins}/three/importers.d.ts +0 -0
  74. /package/{dist/plugins → plugins}/three/index.d.ts +0 -0
  75. /package/{dist/plugins → plugins}/three/threngine.d.ts +0 -0
  76. /package/{dist/strategy → strategy}/assignemntTo.d.ts +0 -0
  77. /package/{dist/strategy → strategy}/declarationOf.d.ts +0 -0
  78. /package/{dist/strategy → strategy}/hardCode.d.ts +0 -0
  79. /package/{dist/strategy → strategy}/index.d.ts +0 -0
  80. /package/{dist/strategy → strategy}/inject.d.ts +0 -0
  81. /package/{dist/strategy → strategy}/namedAttribute.d.ts +0 -0
  82. /package/{dist/strategy → strategy}/strategy.d.ts +0 -0
  83. /package/{dist/strategy → strategy}/stratgies.test.d.ts +0 -0
  84. /package/{dist/strategy → strategy}/texture2D.d.ts +0 -0
  85. /package/{dist/strategy → strategy}/uniform.d.ts +0 -0
  86. /package/{dist/strategy → strategy}/variable.d.ts +0 -0
  87. /package/{dist/util → util}/ast.d.ts +0 -0
  88. /package/{dist/util → util}/ensure.d.ts +0 -0
  89. /package/{dist/util → util}/id.d.ts +0 -0
@@ -1,3 +1,4 @@
1
+ "use strict";
1
2
  var __read = (this && this.__read) || function (o, n) {
2
3
  var m = typeof Symbol === "function" && o[Symbol.iterator];
3
4
  if (!m) return o;
@@ -23,8 +24,10 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
23
24
  }
24
25
  return to.concat(ar || Array.prototype.slice.call(from));
25
26
  };
26
- import { parser, generate } from '@shaderfrog/glsl-parser';
27
- import { visit, } from '@shaderfrog/glsl-parser/ast';
27
+ Object.defineProperty(exports, "__esModule", { value: true });
28
+ exports.generateFiller = exports.convert300MainToReturn = exports.returnGlPositionVec3Right = exports.returnGlPositionHardCoded = exports.returnGlPosition = exports.findFn = exports.makeFnBodyStatementWithScopes = exports.makeExpressionWithScopes = exports.makeExpression = exports.makeFnStatement = exports.makeStatement = exports.outDeclaration = exports.from2To3 = exports.findDeclarationOf = exports.findAssignmentTo = exports.findVec4Constructor = void 0;
29
+ var glsl_parser_1 = require("@shaderfrog/glsl-parser");
30
+ var ast_1 = require("@shaderfrog/glsl-parser/ast");
28
31
  var log = function () {
29
32
  var _a;
30
33
  var args = [];
@@ -33,7 +36,7 @@ var log = function () {
33
36
  }
34
37
  return (_a = console.log).call.apply(_a, __spreadArray([console, '\x1b[31m(core.manipulate)\x1b[0m'], __read(args), false));
35
38
  };
36
- export var findVec4Constructor = function (ast) {
39
+ var findVec4Constructor = function (ast) {
37
40
  var parent;
38
41
  var visitors = {
39
42
  function_call: {
@@ -46,10 +49,11 @@ export var findVec4Constructor = function (ast) {
46
49
  },
47
50
  },
48
51
  };
49
- visit(ast, visitors);
52
+ (0, ast_1.visit)(ast, visitors);
50
53
  return parent;
51
54
  };
52
- export var findAssignmentTo = function (ast, assignTo) {
55
+ exports.findVec4Constructor = findVec4Constructor;
56
+ var findAssignmentTo = function (ast, assignTo) {
53
57
  var assign;
54
58
  var visitors = {
55
59
  expression_statement: {
@@ -62,10 +66,11 @@ export var findAssignmentTo = function (ast, assignTo) {
62
66
  },
63
67
  },
64
68
  };
65
- visit(ast, visitors);
69
+ (0, ast_1.visit)(ast, visitors);
66
70
  return assign;
67
71
  };
68
- export var findDeclarationOf = function (ast, declarationOf) {
72
+ exports.findAssignmentTo = findAssignmentTo;
73
+ var findDeclarationOf = function (ast, declarationOf) {
69
74
  var declaration;
70
75
  var visitors = {
71
76
  declaration_statement: {
@@ -79,10 +84,11 @@ export var findDeclarationOf = function (ast, declarationOf) {
79
84
  },
80
85
  },
81
86
  };
82
- visit(ast, visitors);
87
+ (0, ast_1.visit)(ast, visitors);
83
88
  return declaration;
84
89
  };
85
- export var from2To3 = function (ast, stage) {
90
+ exports.findDeclarationOf = findDeclarationOf;
91
+ var from2To3 = function (ast, stage) {
86
92
  var glOut = 'fragmentColor';
87
93
  // TODO: add this back in when there's only one after the merge
88
94
  // ast.program.unshift({
@@ -91,9 +97,9 @@ export var from2To3 = function (ast, stage) {
91
97
  // _: '\n',
92
98
  // });
93
99
  if (stage === 'fragment') {
94
- ast.program.unshift(makeStatement("out vec4 ".concat(glOut)));
100
+ ast.program.unshift((0, exports.makeStatement)("out vec4 ".concat(glOut)));
95
101
  }
96
- visit(ast, {
102
+ (0, ast_1.visit)(ast, {
97
103
  function_call: {
98
104
  enter: function (path) {
99
105
  var identifier = path.node.identifier;
@@ -121,7 +127,8 @@ export var from2To3 = function (ast, stage) {
121
127
  },
122
128
  });
123
129
  };
124
- export var outDeclaration = function (name) { return ({
130
+ exports.from2To3 = from2To3;
131
+ var outDeclaration = function (name) { return ({
125
132
  type: 'declaration_statement',
126
133
  declaration: {
127
134
  type: 'declarator_list',
@@ -151,11 +158,12 @@ export var outDeclaration = function (name) { return ({
151
158
  },
152
159
  semi: { type: 'literal', literal: ';', whitespace: '\n ' },
153
160
  }); };
154
- export var makeStatement = function (stmt) {
161
+ exports.outDeclaration = outDeclaration;
162
+ var makeStatement = function (stmt) {
155
163
  // log(`Parsing "${stmt}"`);
156
164
  var ast;
157
165
  try {
158
- ast = parser.parse("".concat(stmt, ";\n"), { quiet: true });
166
+ ast = glsl_parser_1.parser.parse("".concat(stmt, ";\n"), { quiet: true });
159
167
  }
160
168
  catch (error) {
161
169
  console.error({ stmt: stmt, error: error });
@@ -164,10 +172,11 @@ export var makeStatement = function (stmt) {
164
172
  // log(util.inspect(ast, false, null, true));
165
173
  return ast.program[0];
166
174
  };
167
- export var makeFnStatement = function (fnStmt) {
175
+ exports.makeStatement = makeStatement;
176
+ var makeFnStatement = function (fnStmt) {
168
177
  var ast;
169
178
  try {
170
- ast = parser.parse("\n void main() {\n ".concat(fnStmt, ";\n }"), { quiet: true });
179
+ ast = glsl_parser_1.parser.parse("\n void main() {\n ".concat(fnStmt, ";\n }"), { quiet: true });
171
180
  }
172
181
  catch (error) {
173
182
  console.error({ fnStmt: fnStmt, error: error });
@@ -176,10 +185,11 @@ export var makeFnStatement = function (fnStmt) {
176
185
  // log(util.inspect(ast, false, null, true));
177
186
  return ast.program[0].body.statements[0];
178
187
  };
179
- export var makeExpression = function (expr) {
188
+ exports.makeFnStatement = makeFnStatement;
189
+ var makeExpression = function (expr) {
180
190
  var ast;
181
191
  try {
182
- ast = parser.parse("void main() {\n a = ".concat(expr, ";\n }"), { quiet: true });
192
+ ast = glsl_parser_1.parser.parse("void main() {\n a = ".concat(expr, ";\n }"), { quiet: true });
183
193
  }
184
194
  catch (error) {
185
195
  console.error({ expr: expr, error: error });
@@ -188,10 +198,11 @@ export var makeExpression = function (expr) {
188
198
  return ast.program[0].body
189
199
  .statements[0].expression.right;
190
200
  };
191
- export var makeExpressionWithScopes = function (expr) {
201
+ exports.makeExpression = makeExpression;
202
+ var makeExpressionWithScopes = function (expr) {
192
203
  var ast;
193
204
  try {
194
- ast = parser.parse("void main() {\n ".concat(expr, ";\n }"), { quiet: true });
205
+ ast = glsl_parser_1.parser.parse("void main() {\n ".concat(expr, ";\n }"), { quiet: true });
195
206
  }
196
207
  catch (error) {
197
208
  console.error({ expr: expr, error: error });
@@ -204,10 +215,11 @@ export var makeExpressionWithScopes = function (expr) {
204
215
  .statements[0].expression,
205
216
  };
206
217
  };
207
- export var makeFnBodyStatementWithScopes = function (body) {
218
+ exports.makeExpressionWithScopes = makeExpressionWithScopes;
219
+ var makeFnBodyStatementWithScopes = function (body) {
208
220
  var ast;
209
221
  try {
210
- ast = parser.parse("void main() {\n".concat(body, "\n }"), { quiet: true });
222
+ ast = glsl_parser_1.parser.parse("void main() {\n".concat(body, "\n }"), { quiet: true });
211
223
  }
212
224
  catch (error) {
213
225
  console.error({ body: body, error: error });
@@ -219,23 +231,27 @@ export var makeFnBodyStatementWithScopes = function (body) {
219
231
  statements: ast.program[0].body.statements,
220
232
  };
221
233
  };
222
- export var findFn = function (ast, name) {
234
+ exports.makeFnBodyStatementWithScopes = makeFnBodyStatementWithScopes;
235
+ var findFn = function (ast, name) {
223
236
  return ast.program.find(function (stmt) {
224
237
  return stmt.type === 'function' && stmt.prototype.header.name.identifier === name;
225
238
  });
226
239
  };
227
- export var returnGlPosition = function (fnName, ast) {
240
+ exports.findFn = findFn;
241
+ var returnGlPosition = function (fnName, ast) {
228
242
  return convertVertexMain(fnName, ast, 'vec4', function (assign) { return assign.expression.right; });
229
243
  };
230
- export var returnGlPositionHardCoded = function (fnName, ast, returnType, hardCodedReturn) {
244
+ exports.returnGlPosition = returnGlPosition;
245
+ var returnGlPositionHardCoded = function (fnName, ast, returnType, hardCodedReturn) {
231
246
  return convertVertexMain(fnName, ast, returnType, function () {
232
- return makeExpression(hardCodedReturn);
247
+ return (0, exports.makeExpression)(hardCodedReturn);
233
248
  });
234
249
  };
235
- export var returnGlPositionVec3Right = function (fnName, ast) {
250
+ exports.returnGlPositionHardCoded = returnGlPositionHardCoded;
251
+ var returnGlPositionVec3Right = function (fnName, ast) {
236
252
  return convertVertexMain(fnName, ast, 'vec3', function (assign) {
237
253
  var found;
238
- visit(assign, {
254
+ (0, ast_1.visit)(assign, {
239
255
  function_call: {
240
256
  enter: function (path) {
241
257
  var _a, _b, _c, _d, _e;
@@ -248,15 +264,16 @@ export var returnGlPositionVec3Right = function (fnName, ast) {
248
264
  },
249
265
  });
250
266
  if (!found) {
251
- console.error(generate(ast));
267
+ console.error((0, glsl_parser_1.generate)(ast));
252
268
  throw new Error('Could not find position assignment to convert to return!');
253
269
  }
254
270
  return found;
255
271
  });
256
272
  };
273
+ exports.returnGlPositionVec3Right = returnGlPositionVec3Right;
257
274
  var convertVertexMain = function (fnName, ast, returnType, generateRight) {
258
275
  var mainReturnVar = "frogOut";
259
- var main = findFn(ast, fnName);
276
+ var main = (0, exports.findFn)(ast, fnName);
260
277
  if (!main) {
261
278
  throw new Error("No ".concat(fnName, " fn found!"));
262
279
  }
@@ -272,13 +289,13 @@ var convertVertexMain = function (fnName, ast, returnType, generateRight) {
272
289
  if (!assign) {
273
290
  throw new Error("No gl position assign found in main fn!");
274
291
  }
275
- var rtnStmt = makeFnStatement("".concat(returnType, " ").concat(mainReturnVar, " = 1.0"));
292
+ var rtnStmt = (0, exports.makeFnStatement)("".concat(returnType, " ").concat(mainReturnVar, " = 1.0"));
276
293
  rtnStmt.declaration.declarations[0].initializer =
277
294
  generateRight(assign);
278
295
  main.body.statements.splice(main.body.statements.indexOf(assign), 1, rtnStmt);
279
- main.body.statements.push(makeFnStatement("return ".concat(mainReturnVar)));
296
+ main.body.statements.push((0, exports.makeFnStatement)("return ".concat(mainReturnVar)));
280
297
  };
281
- export var convert300MainToReturn = function (suffix, ast) {
298
+ var convert300MainToReturn = function (suffix, ast) {
282
299
  var mainReturnVar = "frogOut_".concat(suffix);
283
300
  // Find the output variable, as in "pc_fragColor" from "out highp vec4 pc_fragColor;"
284
301
  var outName;
@@ -297,11 +314,11 @@ export var convert300MainToReturn = function (suffix, ast) {
297
314
  }
298
315
  });
299
316
  if (!outName) {
300
- console.error(generate(ast));
317
+ console.error((0, glsl_parser_1.generate)(ast));
301
318
  throw new Error('No "out vec4" line found in the fragment shader');
302
319
  }
303
- ast.program.unshift(makeStatement("vec4 ".concat(mainReturnVar)));
304
- visit(ast, {
320
+ ast.program.unshift((0, exports.makeStatement)("vec4 ".concat(mainReturnVar)));
321
+ (0, ast_1.visit)(ast, {
305
322
  identifier: {
306
323
  enter: function (path) {
307
324
  if (path.node.identifier === outName) {
@@ -316,17 +333,19 @@ export var convert300MainToReturn = function (suffix, ast) {
316
333
  if (path.node.prototype.header.name.identifier === 'main') {
317
334
  path.node.prototype.header.returnType.specifier
318
335
  .specifier.token = 'vec4';
319
- path.node.body.statements.push(makeFnStatement("return ".concat(mainReturnVar)));
336
+ path.node.body.statements.push((0, exports.makeFnStatement)("return ".concat(mainReturnVar)));
320
337
  }
321
338
  },
322
339
  },
323
340
  });
324
341
  };
325
- export var generateFiller = function (filler) {
342
+ exports.convert300MainToReturn = convert300MainToReturn;
343
+ var generateFiller = function (filler) {
326
344
  if (!filler) {
327
345
  throw new Error('Cannot generate void filler!');
328
346
  }
329
347
  return Array.isArray(filler)
330
- ? filler.map(generate).join('')
331
- : generate(filler);
348
+ ? filler.map(glsl_parser_1.generate).join('')
349
+ : (0, glsl_parser_1.generate)(filler);
332
350
  };
351
+ exports.generateFiller = generateFiller;
@@ -1,7 +1,11 @@
1
- export var ensure = function (argument, message) {
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ensure = void 0;
4
+ var ensure = function (argument, message) {
2
5
  if (message === void 0) { message = 'This value was promised to be there.'; }
3
6
  if (argument === undefined || argument === null) {
4
7
  throw new TypeError(message);
5
8
  }
6
9
  return argument;
7
10
  };
11
+ exports.ensure = ensure;
package/util/id.js ADDED
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.makeId = void 0;
4
+ var counter = 0;
5
+ var makeId = function () { return "".concat(Date.now(), "_").concat(counter++); };
6
+ exports.makeId = makeId;
@@ -1,9 +0,0 @@
1
- export var nodeInput = function (displayName, id, type, dataType, accepts, bakeable, property) { return ({
2
- displayName: displayName,
3
- id: id,
4
- type: type,
5
- dataType: dataType,
6
- accepts: accepts,
7
- bakeable: bakeable,
8
- property: property,
9
- }); };
@@ -1,7 +0,0 @@
1
- import { EdgeLink, LinkHandle } from './graph-types';
2
- export var makeEdge = function (id, from, to, output, input, type) { return ({ id: id, from: from, to: to, output: output, input: input, type: type }); };
3
- export var linkFromVertToFrag = function (id, vertId, fragId) {
4
- return makeEdge(id, vertId, fragId, LinkHandle.NEXT_STAGE, // output from next_stage
5
- LinkHandle.PREVIOUS_STAGE, // input to previous_stage
6
- EdgeLink.NEXT_STAGE);
7
- };
@@ -1,11 +0,0 @@
1
- export * from './base-node';
2
- export * from './data-nodes';
3
- export * from './graph-node';
4
- export * from './code-nodes';
5
- export * from './edge';
6
- export * from './parsers';
7
- export * from './context';
8
- export * from './evaluate';
9
- export * from './graph-types';
10
- export * from './graph';
11
- export * from './shader-sections';
package/dist/index.js DELETED
@@ -1,3 +0,0 @@
1
- export * from './graph';
2
- export * from './strategy';
3
- export * from './engine';
@@ -1,2 +0,0 @@
1
- import { babylengine } from './bablyengine';
2
- export { babylengine as engine };
@@ -1,2 +0,0 @@
1
- import { playengine } from './playengine';
2
- export { playengine as engine };
@@ -1,2 +0,0 @@
1
- import { createMaterial, threngine } from './threngine';
2
- export { createMaterial, threngine as engine };
@@ -1,26 +0,0 @@
1
- import { findAssignmentTo } from '../util/ast';
2
- import { nodeInput } from '../graph/base-node';
3
- import { StrategyType } from '.';
4
- // Constructor
5
- export var assignemntToStrategy = function (assignTo) { return ({
6
- type: StrategyType.ASSIGNMENT_TO,
7
- config: { assignTo: assignTo },
8
- }); };
9
- // Apply the strategy
10
- export var applyAssignmentToStrategy = function (strategy, ast, graphNode, siblingNode) {
11
- var assignNode = findAssignmentTo(ast, strategy.config.assignTo);
12
- var name = strategy.config.assignTo;
13
- return assignNode
14
- ? [
15
- [
16
- nodeInput(name, "filler_".concat(name), 'filler', undefined, // Data type for what plugs into this filler
17
- ['code', 'data'], false),
18
- function (fillerAst) {
19
- assignNode.expression.right =
20
- fillerAst;
21
- return ast;
22
- },
23
- ],
24
- ]
25
- : [];
26
- };
@@ -1,23 +0,0 @@
1
- import { findDeclarationOf } from '../util/ast';
2
- import { nodeInput } from '../graph/base-node';
3
- import { StrategyType } from '.';
4
- export var declarationOfStrategy = function (declarationOf) { return ({
5
- type: StrategyType.DECLARATION_OF,
6
- config: { declarationOf: declarationOf },
7
- }); };
8
- export var constApplyDeclarationOf = function (strategy, ast, graphNode, siblingNode) {
9
- var declaration = findDeclarationOf(ast, strategy.config.declarationOf);
10
- var name = strategy.config.declarationOf;
11
- return declaration
12
- ? [
13
- [
14
- nodeInput(name, "filler_".concat(name), 'filler', undefined, // Data type for what plugs into this filler
15
- ['code', 'data'], false),
16
- function (fillerAst) {
17
- declaration.initializer = fillerAst;
18
- return ast;
19
- },
20
- ],
21
- ]
22
- : [];
23
- };
@@ -1,9 +0,0 @@
1
- export * from './hardCode';
2
- export * from './uniform';
3
- export * from './assignemntTo';
4
- export * from './inject';
5
- export * from './declarationOf';
6
- export * from './texture2D';
7
- export * from './namedAttribute';
8
- export * from './variable';
9
- export * from './strategy';
@@ -1,31 +0,0 @@
1
- var _a;
2
- import { applyHardCodeStrategy } from './hardCode';
3
- import { applyUniformStrategy } from './uniform';
4
- import { applyAssignmentToStrategy, } from './assignemntTo';
5
- import { constApplyDeclarationOf as constApplyDeclarationOfStrategy, } from './declarationOf';
6
- import { applyTexture2DStrategy } from './texture2D';
7
- import { applyNamedAttributeStrategy, } from './namedAttribute';
8
- import { applyVariableStrategy } from './variable';
9
- import { applyInjectStrategy } from './inject';
10
- export var StrategyType;
11
- (function (StrategyType) {
12
- StrategyType["VARIABLE"] = "Variable Names";
13
- StrategyType["ASSIGNMENT_TO"] = "Assignment To";
14
- StrategyType["DECLARATION_OF"] = "Variable Declaration";
15
- StrategyType["TEXTURE_2D"] = "Texture2D";
16
- StrategyType["NAMED_ATTRIBUTE"] = "Named Attribute";
17
- StrategyType["UNIFORM"] = "Uniform";
18
- StrategyType["INJECT"] = "Inject";
19
- StrategyType["HARD_CODE_INPUTS"] = "Hard Code Inputs";
20
- })(StrategyType || (StrategyType = {}));
21
- var strategyRunners = (_a = {},
22
- _a[StrategyType.INJECT] = applyInjectStrategy,
23
- _a[StrategyType.HARD_CODE_INPUTS] = applyHardCodeStrategy,
24
- _a[StrategyType.UNIFORM] = applyUniformStrategy,
25
- _a[StrategyType.ASSIGNMENT_TO] = applyAssignmentToStrategy,
26
- _a[StrategyType.DECLARATION_OF] = constApplyDeclarationOfStrategy,
27
- _a[StrategyType.TEXTURE_2D] = applyTexture2DStrategy,
28
- _a[StrategyType.NAMED_ATTRIBUTE] = applyNamedAttributeStrategy,
29
- _a[StrategyType.VARIABLE] = applyVariableStrategy,
30
- _a);
31
- export var applyStrategy = function (strategy, ast, node, sibling) { return strategyRunners[strategy.type](strategy, ast, node, sibling); };
package/dist/util/id.js DELETED
@@ -1,2 +0,0 @@
1
- var counter = 0;
2
- export var makeId = function () { return "".concat(Date.now(), "_").concat(counter++); };
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes