vite-plugin-glsl
Advanced tools
Comparing version
@@ -9,3 +9,3 @@ { | ||
"main": "./src/index.js", | ||
"version": "1.4.1", | ||
"version": "1.4.2", | ||
"private": false, | ||
@@ -12,0 +12,0 @@ "license": "MIT", |
@@ -5,3 +5,3 @@ /** | ||
* @description Import, inline (and minify) GLSL/WGSL shader files | ||
* @version 1.4.1 | ||
* @version 1.4.2 | ||
* @license MIT | ||
@@ -8,0 +8,0 @@ */ |
import { dirname, resolve, extname, posix, sep } from 'path'; | ||
import { emitWarning, cwd } from 'process'; | ||
import { readFileSync } from 'fs'; | ||
import { platform } from 'os'; | ||
@@ -151,5 +152,6 @@ /** | ||
* | ||
* @param {string} path Shader's absolute path | ||
* @param {boolean} warn Check already included chunks | ||
* @param {boolean} ignore Ignore already included chunks | ||
* @param {string} path Shader's absolute path | ||
* @param {string} lowPath Shader's lowercase path | ||
* @param {boolean} warn Check already included chunks | ||
* @param {boolean} ignore Ignore already included chunks | ||
* | ||
@@ -159,4 +161,4 @@ * @returns {boolean | null} Import recursion has occurred | ||
*/ | ||
function checkRecursiveImports (path, warn, ignore) { | ||
if (allChunks.has(path)) { | ||
function checkRecursiveImports (path, lowPath, warn, ignore) { | ||
if (allChunks.has(lowPath)) { | ||
if (ignore) return null; | ||
@@ -248,4 +250,8 @@ warn && checkDuplicatedImports(path); | ||
const chunkPath = platform() === 'win32' && | ||
unixPath.toLocaleLowerCase() || unixPath; | ||
const recursion = checkRecursiveImports( | ||
unixPath, warnDuplicatedImports, | ||
unixPath, chunkPath, | ||
warnDuplicatedImports, | ||
removeDuplicatedImports | ||
@@ -259,3 +265,3 @@ ); | ||
let directory = dirname(unixPath); | ||
allChunks.add(unixPath); | ||
allChunks.add(chunkPath); | ||
@@ -301,3 +307,3 @@ if (include.test(source)) { | ||
throw new Error( | ||
`Recursion detected when importing '${recursiveChunk}' in '${caller}'.` | ||
`Recursion detected when importing "${recursiveChunk}" in "${caller}".` | ||
); | ||
@@ -304,0 +310,0 @@ } |
Sorry, the diff of this file is not supported yet
41559
0.52%562
0.9%