From e4c2b34104a13eae35bcc1e11aa0870bc2a4d5d2 Mon Sep 17 00:00:00 2001 From: Tom MacWright Date: Wed, 26 Jun 2019 14:14:40 -0700 Subject: [PATCH] Browser compatibility This allows downstream consumers to use GPU.js with requirejs, d3-require, unpkg, jsdelivr, and probably some other systems. The main changes: - Set { standalone: 'UMD' } in browserify configuration. This makes it publish a UMD build that exposes a 'UMD' export or global for CommonJS, require, and AMD. - Move bin/ to dist/, because these are properly distribution files rather than binaries. - Update tests to point to the dist/ version. - Simplify browser.js to always export, because it is not the recommended entry point for any browser. - Add unpkg and jsdelivr fields to package.json so that those CDNs automatically pick up on the right file when someone tries to include from them. --- {bin => dist}/gpu-browser-core.js | 18 ++++++------------ {bin => dist}/gpu-browser-core.min.js | 20 +++++++------------- {bin => dist}/gpu-browser.js | 18 ++++++------------ {bin => dist}/gpu-browser.min.js | 20 +++++++------------- gulpfile.js | 16 ++++++++-------- package.json | 4 +++- src/browser.js | 10 +--------- test/all.html | 2 +- 8 files changed, 39 insertions(+), 69 deletions(-) rename {bin => dist}/gpu-browser-core.js (99%) rename {bin => dist}/gpu-browser-core.min.js (99%) rename {bin => dist}/gpu-browser.js (99%) rename {bin => dist}/gpu-browser.min.js (99%) diff --git a/bin/gpu-browser-core.js b/dist/gpu-browser-core.js similarity index 99% rename from bin/gpu-browser-core.js rename to dist/gpu-browser-core.js index 3a212a56..d6935399 100644 --- a/bin/gpu-browser-core.js +++ b/dist/gpu-browser-core.js @@ -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 - +