larry babby and threejs for glsl

This commit is contained in:
Sam
2024-06-24 21:24:00 +12:00
parent 87d5dc634d
commit 907ebae4c0
6474 changed files with 1279596 additions and 8 deletions

View File

@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2017-present Devon Govett
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@@ -0,0 +1,63 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
function _path() {
const data = _interopRequireDefault(require("path"));
_path = function () {
return data;
};
return data;
}
function _plugin() {
const data = require("@parcel/plugin");
_plugin = function () {
return data;
};
return data;
}
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function shouldExclude(asset, options) {
return !asset.isSource || !options.hmrOptions || !asset.env.isBrowser() || asset.env.isLibrary || asset.env.isWorker() || asset.env.isWorklet() || options.mode !== 'development' || !asset.getDependencies().find(v => v.specifier === 'react' || v.specifier === 'react/jsx-runtime' || v.specifier === 'react/jsx-dev-runtime' || v.specifier === '@emotion/react' || v.specifier === '@emotion/react/jsx-runtime' || v.specifier === '@emotion/react/jsx-dev-runtime');
}
var _default = exports.default = new (_plugin().Transformer)({
async transform({
asset,
options
}) {
if (shouldExclude(asset, options)) {
return [asset];
}
let wrapperPath = `@parcel/transformer-react-refresh-wrap/${_path().default.basename(__dirname)}/helpers/helpers.js`;
let code = await asset.getCode();
let map = await asset.getMap();
let name = `$parcel$ReactRefreshHelpers$${asset.id.slice(-4)}`;
code = `var ${name} = require(${JSON.stringify(wrapperPath)});
var prevRefreshReg = window.$RefreshReg$;
var prevRefreshSig = window.$RefreshSig$;
${name}.prelude(module);
try {
${code}
${name}.postlude(module);
} finally {
window.$RefreshReg$ = prevRefreshReg;
window.$RefreshSig$ = prevRefreshSig;
}`;
asset.setCode(code);
if (map) {
map.offsetLines(1, 6);
asset.setMap(map);
}
// The JSTransformer has already run, do it manually
asset.addDependency({
specifier: wrapperPath,
specifierType: 'esm',
resolveFrom: __filename
});
return [asset];
}
});

View File

@@ -0,0 +1,173 @@
"use strict";
var Refresh = require('react-refresh/runtime');
function debounce(func, delay) {
if (process.env.NODE_ENV === 'test') {
return function (args) {
func.call(null, args);
};
} else {
let timeout = undefined;
let lastTime = 0;
return function (args) {
// Call immediately if last call was more than the delay ago.
// Otherwise, set a timeout. This means the first call is fast
// (for the common case of a single update), and subsequent updates
// are batched.
let now = Date.now();
if (now - lastTime > delay) {
lastTime = now;
func.call(null, args);
} else {
clearTimeout(timeout);
timeout = setTimeout(function () {
timeout = undefined;
lastTime = Date.now();
func.call(null, args);
}, delay);
}
};
}
}
var enqueueUpdate = debounce(function () {
Refresh.performReactRefresh();
}, 30);
// Everthing below is either adapted or copied from
// https://github.com/facebook/metro/blob/61de16bd1edd7e738dd0311c89555a644023ab2d/packages/metro/src/lib/polyfills/require.js
// MIT License - Copyright (c) Facebook, Inc. and its affiliates.
module.exports.prelude = function (module) {
window.$RefreshReg$ = function (type, id) {
Refresh.register(type, module.id + ' ' + id);
};
window.$RefreshSig$ = Refresh.createSignatureFunctionForTransform;
};
module.exports.postlude = function (module) {
if (isReactRefreshBoundary(module.exports)) {
registerExportsForReactRefresh(module);
if (module.hot) {
module.hot.dispose(function (data) {
if (Refresh.hasUnrecoverableErrors()) {
window.location.reload();
}
data.prevExports = module.exports;
});
module.hot.accept(function (getParents) {
var prevExports = module.hot.data.prevExports;
var nextExports = module.exports;
// Since we just executed the code for it, it's possible
// that the new exports make it ineligible for being a boundary.
var isNoLongerABoundary = !isReactRefreshBoundary(nextExports);
// It can also become ineligible if its exports are incompatible
// with the previous exports.
// For example, if you add/remove/change exports, we'll want
// to re-execute the importing modules, and force those components
// to re-render. Similarly, if you convert a class component
// to a function, we want to invalidate the boundary.
var didInvalidate = shouldInvalidateReactRefreshBoundary(prevExports, nextExports);
if (isNoLongerABoundary || didInvalidate) {
// We'll be conservative. The only case in which we won't do a full
// reload is if all parent modules are also refresh boundaries.
// In that case we'll add them to the current queue.
var parents = getParents();
if (parents.length === 0) {
// Looks like we bubbled to the root. Can't recover from that.
window.location.reload();
return;
}
return parents;
}
enqueueUpdate();
});
}
}
};
function isReactRefreshBoundary(exports) {
if (Refresh.isLikelyComponentType(exports)) {
return true;
}
if (exports == null || typeof exports !== 'object') {
// Exit if we can't iterate over exports.
return false;
}
var hasExports = false;
var areAllExportsComponents = true;
let isESM = ('__esModule' in exports);
for (var key in exports) {
hasExports = true;
if (key === '__esModule') {
continue;
}
var desc = Object.getOwnPropertyDescriptor(exports, key);
if (desc && desc.get && !isESM) {
// Don't invoke getters for CJS as they may have side effects.
return false;
}
var exportValue = exports[key];
if (!Refresh.isLikelyComponentType(exportValue)) {
areAllExportsComponents = false;
}
}
return hasExports && areAllExportsComponents;
}
function shouldInvalidateReactRefreshBoundary(prevExports, nextExports) {
var prevSignature = getRefreshBoundarySignature(prevExports);
var nextSignature = getRefreshBoundarySignature(nextExports);
if (prevSignature.length !== nextSignature.length) {
return true;
}
for (var i = 0; i < nextSignature.length; i++) {
if (prevSignature[i] !== nextSignature[i]) {
return true;
}
}
return false;
}
// When this signature changes, it's unsafe to stop at this refresh boundary.
function getRefreshBoundarySignature(exports) {
var signature = [];
signature.push(Refresh.getFamilyByType(exports));
if (exports == null || typeof exports !== 'object') {
// Exit if we can't iterate over exports.
// (This is important for legacy environments.)
return signature;
}
let isESM = ('__esModule' in exports);
for (var key in exports) {
if (key === '__esModule') {
continue;
}
var desc = Object.getOwnPropertyDescriptor(exports, key);
if (desc && desc.get && !isESM) {
// Don't invoke getters for CJS as they may have side effects.
continue;
}
var exportValue = exports[key];
signature.push(key);
signature.push(Refresh.getFamilyByType(exportValue));
}
return signature;
}
function registerExportsForReactRefresh(module) {
var exports = module.exports,
id = module.id;
Refresh.register(exports, id + ' %exports%');
if (exports == null || typeof exports !== 'object') {
// Exit if we can't iterate over exports.
// (This is important for legacy environments.)
return;
}
let isESM = ('__esModule' in exports);
for (var key in exports) {
var desc = Object.getOwnPropertyDescriptor(exports, key);
if (desc && desc.get && !isESM) {
// Don't invoke getters for CJS as they may have side effects.
continue;
}
var exportValue = exports[key];
var typeID = id + ' %exports% ' + key;
Refresh.register(exportValue, typeID);
}
}

View File

@@ -0,0 +1,28 @@
{
"name": "@parcel/transformer-react-refresh-wrap",
"version": "2.12.0",
"license": "MIT",
"publishConfig": {
"access": "public"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/parcel"
},
"repository": {
"type": "git",
"url": "https://github.com/parcel-bundler/parcel.git"
},
"main": "lib/ReactRefreshWrapTransformer.js",
"source": "src/ReactRefreshWrapTransformer.js",
"engines": {
"node": ">= 12.0.0",
"parcel": "^2.12.0"
},
"dependencies": {
"@parcel/plugin": "2.12.0",
"@parcel/utils": "2.12.0",
"react-refresh": "^0.9.0"
},
"gitHead": "2059029ee91e5f03a273b0954d3e629d7375f986"
}

View File

@@ -0,0 +1,71 @@
// @flow
import path from 'path';
import {Transformer} from '@parcel/plugin';
function shouldExclude(asset, options) {
return (
!asset.isSource ||
!options.hmrOptions ||
!asset.env.isBrowser() ||
asset.env.isLibrary ||
asset.env.isWorker() ||
asset.env.isWorklet() ||
options.mode !== 'development' ||
!asset
.getDependencies()
.find(
v =>
v.specifier === 'react' ||
v.specifier === 'react/jsx-runtime' ||
v.specifier === 'react/jsx-dev-runtime' ||
v.specifier === '@emotion/react' ||
v.specifier === '@emotion/react/jsx-runtime' ||
v.specifier === '@emotion/react/jsx-dev-runtime',
)
);
}
export default (new Transformer({
async transform({asset, options}) {
if (shouldExclude(asset, options)) {
return [asset];
}
let wrapperPath = `@parcel/transformer-react-refresh-wrap/${path.basename(
__dirname,
)}/helpers/helpers.js`;
let code = await asset.getCode();
let map = await asset.getMap();
let name = `$parcel$ReactRefreshHelpers$${asset.id.slice(-4)}`;
code = `var ${name} = require(${JSON.stringify(wrapperPath)});
var prevRefreshReg = window.$RefreshReg$;
var prevRefreshSig = window.$RefreshSig$;
${name}.prelude(module);
try {
${code}
${name}.postlude(module);
} finally {
window.$RefreshReg$ = prevRefreshReg;
window.$RefreshSig$ = prevRefreshSig;
}`;
asset.setCode(code);
if (map) {
map.offsetLines(1, 6);
asset.setMap(map);
}
// The JSTransformer has already run, do it manually
asset.addDependency({
specifier: wrapperPath,
specifierType: 'esm',
resolveFrom: __filename,
});
return [asset];
},
}): Transformer);

View File

@@ -0,0 +1,3 @@
{
"extends": "@parcel/eslint-config-browser"
}

View File

@@ -0,0 +1,182 @@
var Refresh = require('react-refresh/runtime');
function debounce(func, delay) {
if (process.env.NODE_ENV === 'test') {
return function (args) {
func.call(null, args);
};
} else {
let timeout = undefined;
let lastTime = 0;
return function (args) {
// Call immediately if last call was more than the delay ago.
// Otherwise, set a timeout. This means the first call is fast
// (for the common case of a single update), and subsequent updates
// are batched.
let now = Date.now();
if (now - lastTime > delay) {
lastTime = now;
func.call(null, args);
} else {
clearTimeout(timeout);
timeout = setTimeout(function () {
timeout = undefined;
lastTime = Date.now();
func.call(null, args);
}, delay);
}
};
}
}
var enqueueUpdate = debounce(function () {
Refresh.performReactRefresh();
}, 30);
// Everthing below is either adapted or copied from
// https://github.com/facebook/metro/blob/61de16bd1edd7e738dd0311c89555a644023ab2d/packages/metro/src/lib/polyfills/require.js
// MIT License - Copyright (c) Facebook, Inc. and its affiliates.
module.exports.prelude = function (module) {
window.$RefreshReg$ = function (type, id) {
Refresh.register(type, module.id + ' ' + id);
};
window.$RefreshSig$ = Refresh.createSignatureFunctionForTransform;
};
module.exports.postlude = function (module) {
if (isReactRefreshBoundary(module.exports)) {
registerExportsForReactRefresh(module);
if (module.hot) {
module.hot.dispose(function (data) {
if (Refresh.hasUnrecoverableErrors()) {
window.location.reload();
}
data.prevExports = module.exports;
});
module.hot.accept(function (getParents) {
var prevExports = module.hot.data.prevExports;
var nextExports = module.exports;
// Since we just executed the code for it, it's possible
// that the new exports make it ineligible for being a boundary.
var isNoLongerABoundary = !isReactRefreshBoundary(nextExports);
// It can also become ineligible if its exports are incompatible
// with the previous exports.
// For example, if you add/remove/change exports, we'll want
// to re-execute the importing modules, and force those components
// to re-render. Similarly, if you convert a class component
// to a function, we want to invalidate the boundary.
var didInvalidate = shouldInvalidateReactRefreshBoundary(
prevExports,
nextExports,
);
if (isNoLongerABoundary || didInvalidate) {
// We'll be conservative. The only case in which we won't do a full
// reload is if all parent modules are also refresh boundaries.
// In that case we'll add them to the current queue.
var parents = getParents();
if (parents.length === 0) {
// Looks like we bubbled to the root. Can't recover from that.
window.location.reload();
return;
}
return parents;
}
enqueueUpdate();
});
}
}
};
function isReactRefreshBoundary(exports) {
if (Refresh.isLikelyComponentType(exports)) {
return true;
}
if (exports == null || typeof exports !== 'object') {
// Exit if we can't iterate over exports.
return false;
}
var hasExports = false;
var areAllExportsComponents = true;
let isESM = '__esModule' in exports;
for (var key in exports) {
hasExports = true;
if (key === '__esModule') {
continue;
}
var desc = Object.getOwnPropertyDescriptor(exports, key);
if (desc && desc.get && !isESM) {
// Don't invoke getters for CJS as they may have side effects.
return false;
}
var exportValue = exports[key];
if (!Refresh.isLikelyComponentType(exportValue)) {
areAllExportsComponents = false;
}
}
return hasExports && areAllExportsComponents;
}
function shouldInvalidateReactRefreshBoundary(prevExports, nextExports) {
var prevSignature = getRefreshBoundarySignature(prevExports);
var nextSignature = getRefreshBoundarySignature(nextExports);
if (prevSignature.length !== nextSignature.length) {
return true;
}
for (var i = 0; i < nextSignature.length; i++) {
if (prevSignature[i] !== nextSignature[i]) {
return true;
}
}
return false;
}
// When this signature changes, it's unsafe to stop at this refresh boundary.
function getRefreshBoundarySignature(exports) {
var signature = [];
signature.push(Refresh.getFamilyByType(exports));
if (exports == null || typeof exports !== 'object') {
// Exit if we can't iterate over exports.
// (This is important for legacy environments.)
return signature;
}
let isESM = '__esModule' in exports;
for (var key in exports) {
if (key === '__esModule') {
continue;
}
var desc = Object.getOwnPropertyDescriptor(exports, key);
if (desc && desc.get && !isESM) {
// Don't invoke getters for CJS as they may have side effects.
continue;
}
var exportValue = exports[key];
signature.push(key);
signature.push(Refresh.getFamilyByType(exportValue));
}
return signature;
}
function registerExportsForReactRefresh(module) {
var exports = module.exports,
id = module.id;
Refresh.register(exports, id + ' %exports%');
if (exports == null || typeof exports !== 'object') {
// Exit if we can't iterate over exports.
// (This is important for legacy environments.)
return;
}
let isESM = '__esModule' in exports;
for (var key in exports) {
var desc = Object.getOwnPropertyDescriptor(exports, key);
if (desc && desc.get && !isESM) {
// Don't invoke getters for CJS as they may have side effects.
continue;
}
var exportValue = exports[key];
var typeID = id + ' %exports% ' + key;
Refresh.register(exportValue, typeID);
}
}