esbuild-plugin-glsl
Advanced tools
Comparing version
/** | ||
* esbuild-plugin-glsl v1.0.2 build Wed Feb 03 2021 | ||
* esbuild-plugin-glsl v1.0.3 build Sun Feb 21 2021 | ||
* https://github.com/vanruesc/esbuild-plugin-glsl | ||
@@ -7,5 +7,5 @@ * Copyright 2021 Raoul van Rüschen | ||
*/ | ||
import{readFile as u}from"fs";import{promisify as a}from"util";function l(i){let n=/[ \t]*(?:(?:\/\*[\s\S]*?\*\/)|(?:\/\/.*\n))/g,o=/\s*({|}|=|\*|,|\+|\/|>|<|&|\||\[|\]|\(|\)|-|!|;)\s*/g,r=i.replace(/\r/g,"").replace(n,""),t=!1;return r=r.split(/\n+/).reduce((s,e)=>(e=e.trim().replace(/\s{2,}|\t/," "),e[0]==="#"?(t&&s.push(` | ||
import{readFile as a}from"fs";import{promisify as u}from"util";function o(i){let n=/[ \t]*(?:(?:\/\*[\s\S]*?\*\/)|(?:\/\/.*\n))/g,l=/\s*({|}|=|\*|,|\+|\/|>|<|&|\||\[|\]|\(|\)|-|!|;)\s*/g,r=i.replace(/\r/g,"").replace(n,""),t=!1;return r=r.split(/\n+/).reduce((s,e)=>(e=e.trim().replace(/\s{2,}|\t/," "),e[0]==="#"?(t&&s.push(` | ||
`),s.push(e,` | ||
`),t=!1):(e=e.replace(/(else)$/m,"$1 "),s.push(e.replace(o,"$1")),t=!0),s),[]).join(""),r.replace(/\n{2,}/g,` | ||
`)}function p({minify:i=!1}={}){let n=a(u);return{name:"glsl",setup(o){o.onLoad({filter:/\.(?:frag|vert|glsl)$/},async r=>{let t=await n(r.path,"utf8");return{contents:i?l(t):t,loader:"text"}})}}}export{p as default}; | ||
`),t=!1):(e=e.replace(/(else)$/m,"$1 "),s.push(e.replace(l,"$1")),t=!0),s),[]).join(""),r.replace(/\n{2,}/g,` | ||
`)}function p({minify:i=!1}={}){let n=u(a);return{name:"glsl",setup(l){l.onLoad({filter:/\.(?:frag|vert|glsl)$/},async r=>{let t=await n(r.path,"utf8");return{contents:i?o(t):t,loader:"text"}})}}}export{p as default,p as glsl}; |
@@ -5,2 +5,3 @@ import { Plugin } from "esbuild"; | ||
} | ||
export default function ({ minify }?: GLSLOptions): Plugin; | ||
declare function glsl({ minify }?: GLSLOptions): Plugin; | ||
export { glsl, glsl as default }; |
{ | ||
"name": "esbuild-plugin-glsl", | ||
"version": "1.0.2", | ||
"version": "1.0.3", | ||
"description": "A GLSL plugin for esbuild.", | ||
@@ -12,2 +12,3 @@ "homepage": "https://github.com/vanruesc/esbuild-plugin-glsl", | ||
}, | ||
"type": "module", | ||
"sideEffects": false, | ||
@@ -43,5 +44,5 @@ "license": "Zlib", | ||
"build": "run-s build:*", | ||
"build:js": "ts-node-script esbuild", | ||
"build:js": "node esbuild", | ||
"build:dts": "tsc -p tsconfig.d.json", | ||
"lint": "eslint src --fix", | ||
"lint": "tsc --noemit && eslint src --fix", | ||
"prepublishOnly": "npm test", | ||
@@ -53,10 +54,4 @@ "pretest": "del-cli dist test/generated", | ||
"failFast": true, | ||
"extensions": [ | ||
"ts" | ||
], | ||
"files": [ | ||
"test/test.ts" | ||
], | ||
"require": [ | ||
"ts-node/register" | ||
"test/*.js" | ||
] | ||
@@ -80,3 +75,2 @@ }, | ||
"devDependencies": { | ||
"@types/node": "14.x.x", | ||
"@typescript-eslint/eslint-plugin": "4.x.x", | ||
@@ -90,3 +84,2 @@ "@typescript-eslint/parser": "4.x.x", | ||
"npm-run-all": "4.x.x", | ||
"ts-node": "9.x.x", | ||
"tslib": "2.x.x", | ||
@@ -93,0 +86,0 @@ "typescript": "4.x.x" |
@@ -18,3 +18,3 @@ # esbuild-plugin-glsl | ||
import { build } from "esbuild"; | ||
import glsl from "esbuild-plugin-glsl"; | ||
import { glsl } from "esbuild-plugin-glsl"; | ||
@@ -21,0 +21,0 @@ build({ |
Sorry, the diff of this file is not supported yet
10
-16.67%31
3.33%Yes
NaN6120
-0.81%