New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@luma.gl/shadertools

Package Overview
Dependencies
Maintainers
8
Versions
250
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@luma.gl/shadertools - npm Package Compare versions

Comparing version 8.1.0-alpha.2 to 8.1.0-alpha.4

20

dist/es5/lib/assemble-shaders.js

@@ -30,2 +30,3 @@ "use strict";

var REGEX_FIRST_FUNCTION = /^[ \t]*\w+[ \t]+\w+\s*\(/;
var INJECT_SHADER_DECLARATIONS = "\n\n".concat(_injectShader.DECLARATION_INJECT_MARKER, "\n\n");

@@ -76,3 +77,2 @@ var SHADER_TYPE = (_SHADER_TYPE = {}, (0, _defineProperty2["default"])(_SHADER_TYPE, _constants.VERTEX_SHADER, 'vertex'), (0, _defineProperty2["default"])(_SHADER_TYPE, _constants.FRAGMENT_SHADER, 'fragment'), _SHADER_TYPE);

var versionLine = '';
var coreSource = source;

@@ -82,3 +82,3 @@ if (sourceLines[0].indexOf('#version ') === 0) {

versionLine = sourceLines[0];
coreSource = sourceLines.slice(1).join('\n');
sourceLines = sourceLines.slice(1);
} else {

@@ -88,2 +88,12 @@ versionLine = "#version ".concat(glslVersion);

var functionIndex = sourceLines.findIndex(function (l) {
return l.match(REGEX_FIRST_FUNCTION);
});
if (functionIndex === -1) {
functionIndex = 0;
}
var corePreamble = sourceLines.slice(0, functionIndex).join('\n');
var coreMain = sourceLines.slice(functionIndex).join('\n');
var allDefines = {};

@@ -100,3 +110,3 @@ modules.forEach(function (module) {

type: type
}), "\n").concat((0, _platformDefines.getPlatformShaderDefines)(gl), "\n").concat((0, _platformDefines.getVersionDefines)(gl, glslVersion, !isVertex), "\n").concat(getApplicationDefines(allDefines), "\n").concat(isVertex ? '' : FRAGMENT_SHADER_PROLOGUE, "\n") : "".concat(versionLine, "\n");
}), "\n").concat((0, _platformDefines.getPlatformShaderDefines)(gl), "\n").concat((0, _platformDefines.getVersionDefines)(gl, glslVersion, !isVertex), "\n").concat(getApplicationDefines(allDefines), "\n").concat(isVertex ? '' : FRAGMENT_SHADER_PROLOGUE, "\n").concat(corePreamble, "\n") : "".concat(versionLine, "\n").concat(corePreamble, "\n");
hookFunctions = normalizeHookFunctions(hookFunctions);

@@ -132,3 +142,3 @@ var hookInjections = {};

if (log) {
module.checkDeprecations(coreSource, log);
module.checkDeprecations(source, log);
}

@@ -169,3 +179,3 @@

assembledSource += getHookFunctions(hookFunctions[type], hookInjections);
assembledSource += coreSource;
assembledSource += coreMain;
assembledSource = (0, _injectShader["default"])(assembledSource, type, mainInjections);

@@ -172,0 +182,0 @@ assembledSource = (0, _transpileShader["default"])(assembledSource, transpileToGLSL100 ? 100 : glslVersion, isVertex);

@@ -25,3 +25,3 @@ "use strict";

exports.DECLARATION_INJECT_MARKER = DECLARATION_INJECT_MARKER;
var REGEX_START_OF_MAIN = /void main\s*\([^)]*\)\s*\{\n?/;
var REGEX_START_OF_MAIN = /void\s+main\s*\([^)]*\)\s*\{\n?/;
var REGEX_END_OF_MAIN = /}\n?[^{}]*$/;

@@ -28,0 +28,0 @@ var fragments = [];

@@ -7,2 +7,3 @@ import { VERTEX_SHADER, FRAGMENT_SHADER } from './constants';

import { assert } from '../utils';
const REGEX_FIRST_FUNCTION = /^[ \t]*\w+[ \t]+\w+\s*\(/;
const INJECT_SHADER_DECLARATIONS = "\n\n".concat(DECLARATION_INJECT_MARKER, "\n\n");

@@ -50,6 +51,5 @@ const SHADER_TYPE = {

const isVertex = type === VERTEX_SHADER;
const sourceLines = source.split('\n');
let sourceLines = source.split('\n');
let glslVersion = 100;
let versionLine = '';
let coreSource = source;

@@ -59,3 +59,3 @@ if (sourceLines[0].indexOf('#version ') === 0) {

versionLine = sourceLines[0];
coreSource = sourceLines.slice(1).join('\n');
sourceLines = sourceLines.slice(1);
} else {

@@ -65,2 +65,10 @@ versionLine = "#version ".concat(glslVersion);

let functionIndex = sourceLines.findIndex(l => l.match(REGEX_FIRST_FUNCTION));
if (functionIndex === -1) {
functionIndex = 0;
}
const corePreamble = sourceLines.slice(0, functionIndex).join('\n');
const coreMain = sourceLines.slice(functionIndex).join('\n');
const allDefines = {};

@@ -77,3 +85,3 @@ modules.forEach(module => {

type
}), "\n").concat(getPlatformShaderDefines(gl), "\n").concat(getVersionDefines(gl, glslVersion, !isVertex), "\n").concat(getApplicationDefines(allDefines), "\n").concat(isVertex ? '' : FRAGMENT_SHADER_PROLOGUE, "\n") : "".concat(versionLine, "\n");
}), "\n").concat(getPlatformShaderDefines(gl), "\n").concat(getVersionDefines(gl, glslVersion, !isVertex), "\n").concat(getApplicationDefines(allDefines), "\n").concat(isVertex ? '' : FRAGMENT_SHADER_PROLOGUE, "\n").concat(corePreamble, "\n") : "".concat(versionLine, "\n").concat(corePreamble, "\n");
hookFunctions = normalizeHookFunctions(hookFunctions);

@@ -102,3 +110,3 @@ const hookInjections = {};

if (log) {
module.checkDeprecations(coreSource, log);
module.checkDeprecations(source, log);
}

@@ -123,3 +131,3 @@

assembledSource += getHookFunctions(hookFunctions[type], hookInjections);
assembledSource += coreSource;
assembledSource += coreMain;
assembledSource = injectShader(assembledSource, type, mainInjections);

@@ -126,0 +134,0 @@ assembledSource = transpileShader(assembledSource, transpileToGLSL100 ? 100 : glslVersion, isVertex);

@@ -9,3 +9,3 @@ import { MODULE_INJECTORS_VS, MODULE_INJECTORS_FS } from '../modules/module-injectors';

export const DECLARATION_INJECT_MARKER = '__LUMA_INJECT_DECLARATIONS__';
const REGEX_START_OF_MAIN = /void main\s*\([^)]*\)\s*\{\n?/;
const REGEX_START_OF_MAIN = /void\s+main\s*\([^)]*\)\s*\{\n?/;
const REGEX_END_OF_MAIN = /}\n?[^{}]*$/;

@@ -12,0 +12,0 @@ const fragments = [];

@@ -12,2 +12,3 @@ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";

import { assert } from '../utils';
var REGEX_FIRST_FUNCTION = /^[ \t]*\w+[ \t]+\w+\s*\(/;
var INJECT_SHADER_DECLARATIONS = "\n\n".concat(DECLARATION_INJECT_MARKER, "\n\n");

@@ -57,3 +58,2 @@ var SHADER_TYPE = (_SHADER_TYPE = {}, _defineProperty(_SHADER_TYPE, VERTEX_SHADER, 'vertex'), _defineProperty(_SHADER_TYPE, FRAGMENT_SHADER, 'fragment'), _SHADER_TYPE);

var versionLine = '';
var coreSource = source;

@@ -63,3 +63,3 @@ if (sourceLines[0].indexOf('#version ') === 0) {

versionLine = sourceLines[0];
coreSource = sourceLines.slice(1).join('\n');
sourceLines = sourceLines.slice(1);
} else {

@@ -69,2 +69,12 @@ versionLine = "#version ".concat(glslVersion);

var functionIndex = sourceLines.findIndex(function (l) {
return l.match(REGEX_FIRST_FUNCTION);
});
if (functionIndex === -1) {
functionIndex = 0;
}
var corePreamble = sourceLines.slice(0, functionIndex).join('\n');
var coreMain = sourceLines.slice(functionIndex).join('\n');
var allDefines = {};

@@ -81,3 +91,3 @@ modules.forEach(function (module) {

type: type
}), "\n").concat(getPlatformShaderDefines(gl), "\n").concat(getVersionDefines(gl, glslVersion, !isVertex), "\n").concat(getApplicationDefines(allDefines), "\n").concat(isVertex ? '' : FRAGMENT_SHADER_PROLOGUE, "\n") : "".concat(versionLine, "\n");
}), "\n").concat(getPlatformShaderDefines(gl), "\n").concat(getVersionDefines(gl, glslVersion, !isVertex), "\n").concat(getApplicationDefines(allDefines), "\n").concat(isVertex ? '' : FRAGMENT_SHADER_PROLOGUE, "\n").concat(corePreamble, "\n") : "".concat(versionLine, "\n").concat(corePreamble, "\n");
hookFunctions = normalizeHookFunctions(hookFunctions);

@@ -113,3 +123,3 @@ var hookInjections = {};

if (log) {
module.checkDeprecations(coreSource, log);
module.checkDeprecations(source, log);
}

@@ -150,3 +160,3 @@

assembledSource += getHookFunctions(hookFunctions[type], hookInjections);
assembledSource += coreSource;
assembledSource += coreMain;
assembledSource = injectShader(assembledSource, type, mainInjections);

@@ -153,0 +163,0 @@ assembledSource = transpileShader(assembledSource, transpileToGLSL100 ? 100 : glslVersion, isVertex);

@@ -10,3 +10,3 @@ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";

export var DECLARATION_INJECT_MARKER = '__LUMA_INJECT_DECLARATIONS__';
var REGEX_START_OF_MAIN = /void main\s*\([^)]*\)\s*\{\n?/;
var REGEX_START_OF_MAIN = /void\s+main\s*\([^)]*\)\s*\{\n?/;
var REGEX_END_OF_MAIN = /}\n?[^{}]*$/;

@@ -13,0 +13,0 @@ var fragments = [];

{
"name": "@luma.gl/shadertools",
"version": "8.1.0-alpha.2",
"version": "8.1.0-alpha.4",
"description": "Shader module system for luma.gl",

@@ -42,3 +42,3 @@ "license": "MIT",

},
"gitHead": "c210cb310a98eb750c8b70e6f24d360743690725"
"gitHead": "3ec457e9d3ef10d99dc10ce9021fc049e15dd896"
}

@@ -8,2 +8,3 @@ import {VERTEX_SHADER, FRAGMENT_SHADER} from './constants';

const REGEX_FIRST_FUNCTION = /^[ \t]*\w+[ \t]+\w+\s*\(/;
const INJECT_SHADER_DECLARATIONS = `\n\n${DECLARATION_INJECT_MARKER}\n\n`;

@@ -56,6 +57,6 @@

const sourceLines = source.split('\n');
let sourceLines = source.split('\n');
let glslVersion = 100;
let versionLine = '';
let coreSource = source;
// Extract any version directive string from source.

@@ -66,3 +67,3 @@ // TODO : keep all pre-processor statements at the begining of the shader.

versionLine = sourceLines[0];
coreSource = sourceLines.slice(1).join('\n');
sourceLines = sourceLines.slice(1);
} else {

@@ -72,2 +73,11 @@ versionLine = `#version ${glslVersion}`;

let functionIndex = sourceLines.findIndex(l => l.match(REGEX_FIRST_FUNCTION));
if (functionIndex === -1) {
functionIndex = 0;
}
const corePreamble = sourceLines.slice(0, functionIndex).join('\n');
const coreMain = sourceLines.slice(functionIndex).join('\n');
// Combine Module and Application Defines

@@ -92,4 +102,6 @@ const allDefines = {};

${isVertex ? '' : FRAGMENT_SHADER_PROLOGUE}
${corePreamble}
`
: `${versionLine}
${corePreamble}
`;

@@ -120,3 +132,3 @@

if (log) {
module.checkDeprecations(coreSource, log);
module.checkDeprecations(source, log);
}

@@ -145,3 +157,3 @@ const moduleSource = module.getModuleSource(type, glslVersion);

// Add the version directive and actual source of this shader
assembledSource += coreSource;
assembledSource += coreMain;

@@ -148,0 +160,0 @@ // Apply any requested shader injections

@@ -13,3 +13,3 @@ import {MODULE_INJECTORS_VS, MODULE_INJECTORS_FS} from '../modules/module-injectors';

const REGEX_START_OF_MAIN = /void main\s*\([^)]*\)\s*\{\n?/; // Beginning of main
const REGEX_START_OF_MAIN = /void\s+main\s*\([^)]*\)\s*\{\n?/; // Beginning of main
const REGEX_END_OF_MAIN = /}\n?[^{}]*$/; // End of main, assumes main is last function

@@ -16,0 +16,0 @@ const fragments = [];

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc