
Security News
rv Is a New Rust-Powered Ruby Version Manager Inspired by Python's uv
Ruby maintainers from Bundler and rbenv teams are building rv to bring Python uv's speed and unified tooling approach to Ruby development.
glsl-token-inject-block
Advanced tools
Injects a "block" of GLSL tokens into a shader, after any #version
, #extension
and precision
statements. This will pad the new tokens with the necessary amount of newlines (but no more).
This module ignores token line
, column
and position
.
Your source:
var tokenizer = require('glsl-tokenizer')
var inject = require('glsl-token-inject-block')
var stringify = require('glsl-token-string')
var tokens = tokenizer(shaderInput)
var newToken = {
type: 'preprocessor',
data: '#define FOOBAR'
}
var source = stringify(inject(tokens, newToken))
console.log(source)
The following shader input:
// some comment
#version 300 es
#extension SOME_EXTENSION : enable
void main() {}
Results in the following injected define:
// some comment
#version 300 es
#extension SOME_EXTENSION : enable
#define FOOBAR
void main() {}
tokens = inject(tokens, newTokens)
For the given shader source (tokens
), injects newTokens
into them, assuming the new tokens are a "block" of code that should be placed on its own line.
newTokens
can be a single token object, or an array of token objects.
Modifies tokens
in place and returns it.
MIT, see LICENSE.md for details.
FAQs
safely inject a block of tokens into a shader
The npm package glsl-token-inject-block receives a total of 260,792 weekly downloads. As such, glsl-token-inject-block popularity was classified as popular.
We found that glsl-token-inject-block demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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.
Security News
Ruby maintainers from Bundler and rbenv teams are building rv to bring Python uv's speed and unified tooling approach to Ruby development.
Security News
Following last week’s supply chain attack, Nx published findings on the GitHub Actions exploit and moved npm publishing to Trusted Publishers.
Security News
AGENTS.md is a fast-growing open format giving AI coding agents a shared, predictable way to understand project setup, style, and workflows.