feat(minify): use AST parser for safe GLSL mangle #282
Annotations
4 errors
|
build-lint-test
Process completed with exit code 1.
|
|
tests/index.test.ts > minify > can mangle multiple GLSL shaders with collisions:
tests/index.test.ts#L180
Error: Snapshot `minify > can mangle multiple GLSL shaders with collisions 2` mismatched
- Expected
+ Received
"#version 300 es
- in vec2 b;out vec4 a[gl_MaxDrawBuffers];void main(){a[0]=b.sstt;}"
+ in vec2 b;out vec4 a[gl_MaxDrawBuffers];void main(){a[0]=b.a;}"
❯ tests/index.test.ts:180:78
|
|
tests/index.test.ts > minify > can mangle externals in GLSL:
tests/index.test.ts#L164
Error: Snapshot `minify > can mangle externals in GLSL 1` mismatched
- Expected
+ Received
@@ -5,12 +5,12 @@
#if defined(b)
const bool c=true;
#endif
uniform float d,e;uniform sampler2D f;in vec2 g;out vec4 h;
#include <three_test>
- layout(std140)uniform i{mat4 projectionMatrix;mat4 modelViewMatrix;mat3 normalMatrix;float one,two;};layout(std140)uniform j{mat4 projectionMatrix;mat4 modelViewMatrix;mat3 normalMatrix;float one,two;}k;struct l{
+ layout(std140)uniform i{mat4 j;mat4 k;mat3 l;float m,n;};layout(std140)uniform o{mat4 j;mat4 k;mat3 l;float m,n;}p;struct q{
#if !defined(BLA)
- int y;
+ int r;
#else
- float z;
+ float s;
#endif
- };struct m{float intensity;vec3 position;float one,two;};uniform m n[4];invariant h;void main(){vec4 o=vec4(n[0].position.xyz*n[0].intensity,0.0);vec4 p=projectionMatrix*modelViewMatrix*vec4(0,0,0,1);vec4 q=k.projectionMatrix*k.modelViewMatrix*vec4(0,0,0,1);if(false){}h=vec4(texture(f,g).rgb,0.0);float e=0.0;h.a+=1.0+e;}"
+ };struct t{float u;vec3 v;float m,n;};uniform t w[4];invariant h;void main(){vec4 x=vec4(w[0].v.xyz*w[0].u,0.0);vec4 y=j*k*vec4(0,0,0,1);vec4 az=p.j*p.k*vec4(0,0,0,1);if(false){}h=vec4(texture(f,g).rgb,0.0);float e=0.0;h.a+=1.0+e;}"
❯ tests/index.test.ts:164:78
|
|
tests/index.test.ts > minify > can mangle GLSL:
tests/index.test.ts#L152
Error: Snapshot `minify > can mangle GLSL 1` mismatched
- Expected
+ Received
@@ -5,12 +5,12 @@
#if defined(b)
const bool c=true;
#endif
uniform float foo,bar;uniform sampler2D map;in vec2 vUv;out vec4 pc_FragColor;
#include <three_test>
- layout(std140)uniform Uniforms1{mat4 projectionMatrix;mat4 modelViewMatrix;mat3 normalMatrix;float one,two;};layout(std140)uniform Uniforms2{mat4 projectionMatrix;mat4 modelViewMatrix;mat3 normalMatrix;float one,two;}d;struct e{
+ layout(std140)uniform Uniforms1{mat4 projectionMatrix;mat4 modelViewMatrix;mat3 normalMatrix;float one,two;};layout(std140)uniform d{mat4 projectionMatrix;mat4 modelViewMatrix;mat3 normalMatrix;float one,two;}globals;struct e{
#if !defined(BLA)
int y;
#else
float z;
#endif
- };struct f{float intensity;vec3 position;float one,two;};uniform f Light[4];invariant g;void main(){vec4 h=vec4(Light[0].position.xyz*Light[0].intensity,0.0);vec4 i=projectionMatrix*modelViewMatrix*vec4(0,0,0,1);vec4 j=d.projectionMatrix*d.modelViewMatrix*vec4(0,0,0,1);if(false){}g=vec4(texture(map,vUv).rgb,0.0);float k=0.0;g.a+=1.0+k;}"
+ };struct f{float intensity;vec3 position;float one,two;};uniform f Light[4];invariant pc_FragColor;void main(){vec4 g=vec4(Light[0].position.xyz*Light[0].intensity,0.0);vec4 h=projectionMatrix*modelViewMatrix*vec4(0,0,0,1);vec4 i=globals.projectionMatrix*globals.modelViewMatrix*vec4(0,0,0,1);if(false){}pc_FragColor=vec4(texture(map,vUv).rgb,0.0);float j=0.0;pc_FragColor.a+=1.0+j;}"
❯ tests/index.test.ts:152:55
|