Merge pull request #486 from tmcw/browser-compatibility

Browser compatibility
This commit is contained in:
Robert Plummer 2019-06-27 13:41:35 -04:00 committed by GitHub
commit 85d64e9f52
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 39 additions and 69 deletions

View File

@ -5,13 +5,13 @@
* GPU Accelerated JavaScript
*
* @version 2.0.0-rc.17
* @date Mon Jun 24 2019 21:10:10 GMT-0400 (Eastern Daylight Time)
* @date Wed Jun 26 2019 14:12:44 GMT-0700 (Pacific Daylight Time)
*
* @license MIT
* The MIT License
*
* Copyright (c) 2019 gpu.js Team
*/(function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){
*/(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.GPU = f()}})(function(){var define,module,exports;return (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){
},{}],2:[function(require,module,exports){
function glWiretap(gl, options = {}) {
@ -11159,15 +11159,8 @@ for (const p in lib) {
if (p === 'GPU') continue;
GPU[p] = lib[p];
}
if (typeof module !== 'undefined') {
module.exports = GPU;
}
if (typeof window !== 'undefined') {
window.GPU = GPU;
}
if (typeof self !== 'undefined') {
self.GPU = GPU;
}
module.exports = GPU;
},{"./index":84}],83:[function(require,module,exports){
const gpuMock = require('gpu-mock.js');
const { utils } = require('./utils');
@ -12452,4 +12445,5 @@ const _systemEndianness = utils.getSystemEndianness();
module.exports = {
utils
};
},{"./input":85,"./texture":88,"acorn":1}]},{},[82]);
},{"./input":85,"./texture":88,"acorn":1}]},{},[82])(82)
});

View File

@ -5,7 +5,7 @@
* GPU Accelerated JavaScript
*
* @version 2.0.0-rc.17
* @date Mon Jun 24 2019 21:10:12 GMT-0400 (Eastern Daylight Time)
* @date Wed Jun 26 2019 14:12:46 GMT-0700 (Pacific Daylight Time)
*
* @license MIT
* The MIT License
@ -18,13 +18,13 @@
* GPU Accelerated JavaScript
*
* @version 2.0.0-rc.17
* @date Mon Jun 24 2019 21:10:10 GMT-0400 (Eastern Daylight Time)
* @date Wed Jun 26 2019 14:12:44 GMT-0700 (Pacific Daylight Time)
*
* @license MIT
* The MIT License
*
* Copyright (c) 2019 gpu.js Team
*/(function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){
*/(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.GPU = f()}})(function(){var define,module,exports;return (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){
},{}],2:[function(require,module,exports){
function glWiretap(gl, options = {}) {
@ -11172,15 +11172,8 @@ for (const p in lib) {
if (p === 'GPU') continue;
GPU[p] = lib[p];
}
if (typeof module !== 'undefined') {
module.exports = GPU;
}
if (typeof window !== 'undefined') {
window.GPU = GPU;
}
if (typeof self !== 'undefined') {
self.GPU = GPU;
}
module.exports = GPU;
},{"./index":84}],83:[function(require,module,exports){
const gpuMock = require('gpu-mock.js');
const { utils } = require('./utils');
@ -12465,4 +12458,5 @@ const _systemEndianness = utils.getSystemEndianness();
module.exports = {
utils
};
},{"./input":85,"./texture":88,"acorn":1}]},{},[82]);
},{"./input":85,"./texture":88,"acorn":1}]},{},[82])(82)
});

View File

@ -5,13 +5,13 @@
* GPU Accelerated JavaScript
*
* @version 2.0.0-rc.17
* @date Mon Jun 24 2019 21:10:10 GMT-0400 (Eastern Daylight Time)
* @date Wed Jun 26 2019 14:12:45 GMT-0700 (Pacific Daylight Time)
*
* @license MIT
* The MIT License
*
* Copyright (c) 2019 gpu.js Team
*/(function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){
*/(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.GPU = f()}})(function(){var define,module,exports;return (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
typeof define === 'function' && define.amd ? define(['exports'], factory) :
@ -15923,15 +15923,8 @@ for (const p in lib) {
if (p === 'GPU') continue;
GPU[p] = lib[p];
}
if (typeof module !== 'undefined') {
module.exports = GPU;
}
if (typeof window !== 'undefined') {
window.GPU = GPU;
}
if (typeof self !== 'undefined') {
self.GPU = GPU;
}
module.exports = GPU;
},{"./index":85}],84:[function(require,module,exports){
const gpuMock = require('gpu-mock.js');
const { utils } = require('./utils');
@ -17216,4 +17209,5 @@ const _systemEndianness = utils.getSystemEndianness();
module.exports = {
utils
};
},{"./input":86,"./texture":89,"acorn":1}]},{},[83]);
},{"./input":86,"./texture":89,"acorn":1}]},{},[83])(83)
});

View File

@ -5,7 +5,7 @@
* GPU Accelerated JavaScript
*
* @version 2.0.0-rc.17
* @date Mon Jun 24 2019 21:10:12 GMT-0400 (Eastern Daylight Time)
* @date Wed Jun 26 2019 14:12:46 GMT-0700 (Pacific Daylight Time)
*
* @license MIT
* The MIT License
@ -18,13 +18,13 @@
* GPU Accelerated JavaScript
*
* @version 2.0.0-rc.17
* @date Mon Jun 24 2019 21:10:10 GMT-0400 (Eastern Daylight Time)
* @date Wed Jun 26 2019 14:12:45 GMT-0700 (Pacific Daylight Time)
*
* @license MIT
* The MIT License
*
* Copyright (c) 2019 gpu.js Team
*/(function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){
*/(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.GPU = f()}})(function(){var define,module,exports;return (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
typeof define === 'function' && define.amd ? define(['exports'], factory) :
@ -15936,15 +15936,8 @@ for (const p in lib) {
if (p === 'GPU') continue;
GPU[p] = lib[p];
}
if (typeof module !== 'undefined') {
module.exports = GPU;
}
if (typeof window !== 'undefined') {
window.GPU = GPU;
}
if (typeof self !== 'undefined') {
self.GPU = GPU;
}
module.exports = GPU;
},{"./index":85}],84:[function(require,module,exports){
const gpuMock = require('gpu-mock.js');
const { utils } = require('./utils');
@ -17229,4 +17222,5 @@ const _systemEndianness = utils.getSystemEndianness();
module.exports = {
utils
};
},{"./input":86,"./texture":89,"acorn":1}]},{},[83]);
},{"./input":86,"./texture":89,"acorn":1}]},{},[83])(83)
});

View File

@ -12,17 +12,17 @@ const stripComments = require('gulp-strip-comments');
const merge = require('merge-stream');
gulp.task('build', function() {
const gpu = browserify('./src/browser.js')
const gpu = browserify('./src/browser.js', {standalone: 'GPU'})
.ignore('gl')
.bundle()
.pipe(source('gpu-browser.js'))
.pipe(buffer())
.pipe(stripComments())
.pipe(header(fs.readFileSync('./src/browser-header.txt', 'utf8'), { pkg : pkg }))
.pipe(gulp.dest('bin'))
.pipe(gulp.dest('dist'))
.on('error', console.error);
const gpuCore = browserify('./src/browser.js')
const gpuCore = browserify('./src/browser.js', {standalone: 'GPU'})
.ignore('gl')
.ignore('acorn')
.bundle()
@ -30,7 +30,7 @@ gulp.task('build', function() {
.pipe(buffer())
.pipe(stripComments())
.pipe(header(fs.readFileSync('./src/browser-header.txt', 'utf8'), { pkg : pkg }))
.pipe(gulp.dest('bin'))
.pipe(gulp.dest('dist'))
.on('error', console.error);
return merge(gpu, gpuCore);
@ -38,16 +38,16 @@ gulp.task('build', function() {
/// Minify the build script, after building it
gulp.task('minify', function() {
const gpu = gulp.src('bin/gpu-browser.js')
const gpu = gulp.src('dist/gpu-browser.js')
.pipe(rename('gpu-browser.min.js'))
.pipe(header(fs.readFileSync('./src/browser-header.txt', 'utf8'), { pkg : pkg }))
.pipe(gulp.dest('bin'))
.pipe(gulp.dest('dist'))
.on('error', console.error);
const gpuCore = gulp.src('bin/gpu-browser-core.js')
const gpuCore = gulp.src('dist/gpu-browser-core.js')
.pipe(rename('gpu-browser-core.min.js'))
.pipe(header(fs.readFileSync('./src/browser-header.txt', 'utf8'), { pkg : pkg }))
.pipe(gulp.dest('bin'))
.pipe(gulp.dest('dist'))
.on('error', console.error);
return merge(gpu, gpuCore);

View File

@ -7,8 +7,10 @@
},
"main": "./src/index.js",
"files": [
"src"
"src", "dist"
],
"unpkg": "./dist/gpu-browser.min.js",
"jsdelivr": "./dist/gpu-browser.min.js",
"directories": {
"doc": "doc",
"test": "test"

View File

@ -5,12 +5,4 @@ for (const p in lib) {
if (p === 'GPU') continue; //prevent recursive reference
GPU[p] = lib[p];
}
if (typeof module !== 'undefined') {
module.exports = GPU;
}
if (typeof window !== 'undefined') {
window.GPU = GPU;
}
if (typeof self !== 'undefined') {
self.GPU = GPU;
}
module.exports = GPU;

View File

@ -6,7 +6,7 @@
<link rel="stylesheet" href="../node_modules/qunit/qunit/qunit.css">
<!-- gpu.js scripts -->
<script src="../bin/gpu-browser.js"></script>
<script src="../dist/gpu-browser.js"></script>
</head>
<body>
<div id="qunit"></div>