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,164 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
function _plugin() {
const data = require("@parcel/plugin");
_plugin = function () {
return data;
};
return data;
}
function _path() {
const data = _interopRequireDefault(require("path"));
_path = function () {
return data;
};
return data;
}
function _posthtml() {
const data = _interopRequireDefault(require("posthtml"));
_posthtml = function () {
return data;
};
return data;
}
function _posthtmlParser() {
const data = require("posthtml-parser");
_posthtmlParser = function () {
return data;
};
return data;
}
function _posthtmlRender() {
const data = require("posthtml-render");
_posthtmlRender = function () {
return data;
};
return data;
}
function _nullthrows() {
const data = _interopRequireDefault(require("nullthrows"));
_nullthrows = function () {
return data;
};
return data;
}
function _semver() {
const data = _interopRequireDefault(require("semver"));
_semver = function () {
return data;
};
return data;
}
var _loadPlugins = _interopRequireDefault(require("./loadPlugins"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var _default = exports.default = new (_plugin().Transformer)({
async loadConfig({
config,
options,
logger
}) {
if (!config.isSource) {
return;
}
let configFile = await config.getConfig(['.posthtmlrc', '.posthtmlrc.js', '.posthtmlrc.cjs', '.posthtmlrc.mjs', 'posthtml.config.js', 'posthtml.config.cjs', 'posthtml.config.mjs'], {
packageKey: 'posthtml'
});
if (configFile) {
let isJavascript = _path().default.extname(configFile.filePath).endsWith('js');
if (isJavascript) {
// We have to invalidate on startup in case the config is non-deterministic,
// e.g. using unknown environment variables, reading from the filesystem, etc.
logger.warn({
message: 'WARNING: Using a JavaScript PostHTML config file means losing out on caching features of Parcel. Use a .posthtmlrc (JSON) file whenever possible.'
});
}
// Load plugins. This must be done before adding dev dependencies so we auto install.
let plugins = await (0, _loadPlugins.default)(configFile.contents.plugins, config.searchPath, options);
// Now add dev dependencies so we invalidate when they change.
let pluginArray = Array.isArray(configFile.contents.plugins) ? configFile.contents.plugins : Object.keys(configFile.contents.plugins);
for (let p of pluginArray) {
if (typeof p === 'string') {
config.addDevDependency({
specifier: p,
resolveFrom: configFile.filePath
});
}
}
configFile.contents.plugins = plugins;
// tells posthtml that we have already called parse
configFile.contents.skipParse = true;
delete configFile.contents.render;
return configFile.contents;
}
},
canReuseAST({
ast
}) {
return ast.type === 'posthtml' && _semver().default.satisfies(ast.version, '^0.4.0');
},
async parse({
asset,
config
}) {
// if we don't have a config it is posthtml is not configure, don't parse
if (!config) {
return;
}
return {
type: 'posthtml',
version: '0.4.1',
program: (0, _posthtmlParser().parser)(await asset.getCode(), {
lowerCaseAttributeNames: true,
sourceLocations: true,
xmlMode: asset.type === 'xhtml'
})
};
},
async transform({
asset,
config
}) {
if (!config) {
return [asset];
}
let ast = (0, _nullthrows().default)(await asset.getAST());
let res = await (0, _posthtml().default)(config.plugins).process(ast.program, {
...config,
plugins: config.plugins
});
if (res.messages) {
for (let {
type,
file: filePath
} of res.messages) {
if (type === 'dependency') {
asset.invalidateOnFileChange(filePath);
}
}
}
asset.setAST({
type: 'posthtml',
version: '0.4.1',
program: JSON.parse(JSON.stringify(res.tree)) // posthtml adds functions to the AST that are not serializable
});
return [asset];
},
generate({
ast,
asset
}) {
return {
content: (0, _posthtmlRender().render)(ast.program, {
closingSingleTag: asset.type === 'xhtml' ? 'slash' : undefined
})
};
}
});

View File

@@ -0,0 +1,26 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = loadExternalPlugins;
async function loadExternalPlugins(plugins, relative, options) {
if (Array.isArray(plugins)) {
return Promise.all(plugins.map(p => loadPlugin(p, relative, null, options.packageManager, options.shouldAutoInstall)).filter(Boolean));
} else if (typeof plugins === 'object') {
let mapPlugins = await Promise.all(Object.keys(plugins).map(p => loadPlugin(p, relative, plugins[p], options.packageManager, options.shouldAutoInstall)));
return mapPlugins.filter(Boolean);
} else {
return [];
}
}
async function loadPlugin(pluginArg, relative, options = {}, packageManager, shouldAutoInstall) {
if (typeof pluginArg !== 'string') {
return pluginArg;
}
let plugin = await packageManager.require(pluginArg, relative, {
shouldAutoInstall
});
plugin = plugin.default || plugin;
return plugin(options);
}