Research
Security News
Threat Actor Exposes Playbook for Exploiting npm to Build Blockchain-Powered Botnets
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.
glslify-stream
Advanced tools
given a file path, create a readable stream of glsl-parser AST nodes that represent the complete dependency tree of a glsl program.
// usage: node test.js main.glsl > output.glsl
var glslify = require('./index')
, deparser = require('glsl-deparser')
var file = require('path').resolve(process.argv[process.argv.length - 1])
glslify(file)
.pipe(deparser())
.pipe(process.stdout)
// main.glsl
precision highp float;
uniform float time;
uniform vec2 mouse;
uniform vec2 resolution;
#pragma glslify: program_one = require(./file1, time=time, mouse=mouse, resolution=resolution)
#pragma glslify: program_two = require(./file2, time=time, mouse=mouse, resolution=resolution)
int modulo(float x, float y) {
return int(x - y * floor(x / y));
}
void main(void) {
ivec2 m = ivec2(modulo(gl_FragCoord.x, 2.), modulo(gl_FragCoord.y, 2.));
if(m.x == 0 || m.y == 0) {
program_one();
} else {
program_two();
}
}
// file1.glsl
void main(void) {
gl_FragColor = vec4(1., 0., 0., 1.);
}
#pragma glslify: export(main)
// file2.glsl
void main(void) {
gl_FragColor = vec4(0., 0., 1., 1.);
}
#pragma glslify: export(main)
GLSLify works by mangling top-level identities in non-root modules.
Exported variables will be aliased on requirement.
Import a module and assign it the name VARIABLE
in the local program.
MODULE
may be located within node_modules/
or relative to the current file.
Quotes are not allowed.
If the target module defines attribute
, varying
, or uniform
global variables,
you may map those to a local definition or expression:
attribute vec4 position;
#pragma glslify: x = require(./takes_vec2, module_variable=position.xy)
If a mapping is not defined, those requirements are forwarded on to the module requiring the current module -- if no mappings are found for a definition, an error is raised.
Exports a local name from the current module. If the current module is the root, this is
a no-op. There may be only one exported NAME
per module. The NAME
may represent a
type, function, or variable.
Return a readable stream of AST nodes representing the complete program.
MIT
FAQs
create a readable stream of glsl ast nodes that produce a module system
The npm package glslify-stream receives a total of 285 weekly downloads. As such, glslify-stream popularity was classified as not popular.
We found that glslify-stream demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.
Security News
NVD’s backlog surpasses 20,000 CVEs as analysis slows and NIST announces new system updates to address ongoing delays.
Security News
Research
A malicious npm package disguised as a WhatsApp client is exploiting authentication flows with a remote kill switch to exfiltrate data and destroy files.