mirror of
https://github.com/SamEyeBam/animate.git
synced 2025-09-27 22:45:25 +00:00
larry babby and threejs for glsl
This commit is contained in:
21
webGl/my-threejs-test/node_modules/@parcel/packager-svg/LICENSE
generated
vendored
Normal file
21
webGl/my-threejs-test/node_modules/@parcel/packager-svg/LICENSE
generated
vendored
Normal 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.
|
159
webGl/my-threejs-test/node_modules/@parcel/packager-svg/lib/SVGPackager.js
generated
vendored
Normal file
159
webGl/my-threejs-test/node_modules/@parcel/packager-svg/lib/SVGPackager.js
generated
vendored
Normal file
@@ -0,0 +1,159 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
function _assert() {
|
||||
const data = _interopRequireDefault(require("assert"));
|
||||
_assert = function () {
|
||||
return data;
|
||||
};
|
||||
return data;
|
||||
}
|
||||
function _plugin() {
|
||||
const data = require("@parcel/plugin");
|
||||
_plugin = function () {
|
||||
return data;
|
||||
};
|
||||
return data;
|
||||
}
|
||||
function _posthtml() {
|
||||
const data = _interopRequireDefault(require("posthtml"));
|
||||
_posthtml = function () {
|
||||
return data;
|
||||
};
|
||||
return data;
|
||||
}
|
||||
function _utils() {
|
||||
const data = require("@parcel/utils");
|
||||
_utils = function () {
|
||||
return data;
|
||||
};
|
||||
return data;
|
||||
}
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
var _default = exports.default = new (_plugin().Packager)({
|
||||
async package({
|
||||
bundle,
|
||||
bundleGraph,
|
||||
getInlineBundleContents
|
||||
}) {
|
||||
const assets = [];
|
||||
bundle.traverseAssets(asset => {
|
||||
assets.push(asset);
|
||||
});
|
||||
_assert().default.strictEqual(assets.length, 1, 'SVG bundles must only contain one asset');
|
||||
|
||||
// Add bundles in the same bundle group that are not inline. For example, if two inline
|
||||
// bundles refer to the same library that is extracted into a shared bundle.
|
||||
let referencedBundles = [...(0, _utils().setDifference)(new Set(bundleGraph.getReferencedBundles(bundle)), new Set(bundleGraph.getReferencedBundles(bundle, {
|
||||
recursive: false
|
||||
})))];
|
||||
const asset = assets[0];
|
||||
const code = await asset.getCode();
|
||||
let {
|
||||
html: svg
|
||||
} = await (0, _posthtml().default)([tree => insertBundleReferences(referencedBundles, tree), tree => replaceInlineAssetContent(bundleGraph, getInlineBundleContents, tree)]).process(code, {
|
||||
directives: [{
|
||||
name: /^\?/,
|
||||
start: '<',
|
||||
end: '>'
|
||||
}],
|
||||
xmlMode: true
|
||||
});
|
||||
const {
|
||||
contents,
|
||||
map
|
||||
} = (0, _utils().replaceURLReferences)({
|
||||
bundle,
|
||||
bundleGraph,
|
||||
contents: svg,
|
||||
relative: false,
|
||||
getReplacement: contents => contents.replace(/"/g, '"')
|
||||
});
|
||||
return (0, _utils().replaceInlineReferences)({
|
||||
bundle,
|
||||
bundleGraph,
|
||||
contents,
|
||||
getInlineBundleContents,
|
||||
getInlineReplacement: (dep, inlineType, contents) => ({
|
||||
from: dep.id,
|
||||
to: contents.replace(/"/g, '"').trim()
|
||||
}),
|
||||
map
|
||||
});
|
||||
}
|
||||
});
|
||||
async function replaceInlineAssetContent(bundleGraph, getInlineBundleContents, tree) {
|
||||
const inlineNodes = [];
|
||||
tree.walk(node => {
|
||||
if (node.attrs && node.attrs['data-parcel-key']) {
|
||||
inlineNodes.push(node);
|
||||
}
|
||||
return node;
|
||||
});
|
||||
for (const node of inlineNodes) {
|
||||
const newContent = await getAssetContent(bundleGraph, getInlineBundleContents, node.attrs['data-parcel-key']);
|
||||
if (newContent === null) {
|
||||
continue;
|
||||
}
|
||||
node.content = await (0, _utils().blobToString)(newContent.contents);
|
||||
|
||||
// Wrap scripts and styles with CDATA if needed to ensure characters are not interpreted as XML
|
||||
if (node.tag === 'script' || node.tag === 'style') {
|
||||
if (node.content.includes('<') || node.content.includes('&')) {
|
||||
node.content = node.content.replace(/]]>/g, ']\\]>');
|
||||
node.content = `<![CDATA[\n${node.content}\n]]>`;
|
||||
}
|
||||
}
|
||||
|
||||
// remove attr from output
|
||||
delete node.attrs['data-parcel-key'];
|
||||
}
|
||||
return tree;
|
||||
}
|
||||
async function getAssetContent(bundleGraph, getInlineBundleContents, assetId) {
|
||||
let inlineBundle;
|
||||
bundleGraph.traverseBundles((bundle, context, {
|
||||
stop
|
||||
}) => {
|
||||
const entryAssets = bundle.getEntryAssets();
|
||||
if (entryAssets.some(a => a.uniqueKey === assetId)) {
|
||||
inlineBundle = bundle;
|
||||
stop();
|
||||
}
|
||||
});
|
||||
if (!inlineBundle) {
|
||||
return null;
|
||||
}
|
||||
const bundleResult = await getInlineBundleContents(inlineBundle, bundleGraph);
|
||||
return {
|
||||
bundle: inlineBundle,
|
||||
contents: bundleResult.contents
|
||||
};
|
||||
}
|
||||
function insertBundleReferences(siblingBundles, tree) {
|
||||
let scripts = [];
|
||||
let stylesheets = [];
|
||||
for (let bundle of siblingBundles) {
|
||||
if (bundle.type === 'css') {
|
||||
stylesheets.push(`<?xml-stylesheet href=${JSON.stringify((0, _utils().urlJoin)(bundle.target.publicUrl, bundle.name))}?>`);
|
||||
} else if (bundle.type === 'js') {
|
||||
scripts.push({
|
||||
tag: 'script',
|
||||
attrs: {
|
||||
href: (0, _utils().urlJoin)(bundle.target.publicUrl, bundle.name)
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
tree.unshift(...stylesheets);
|
||||
if (scripts.length > 0) {
|
||||
tree.match({
|
||||
tag: 'svg'
|
||||
}, node => {
|
||||
node.content.unshift(...scripts);
|
||||
});
|
||||
}
|
||||
}
|
29
webGl/my-threejs-test/node_modules/@parcel/packager-svg/package.json
generated
vendored
Normal file
29
webGl/my-threejs-test/node_modules/@parcel/packager-svg/package.json
generated
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
{
|
||||
"name": "@parcel/packager-svg",
|
||||
"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/SVGPackager.js",
|
||||
"source": "src/SVGPackager.js",
|
||||
"engines": {
|
||||
"node": ">= 12.0.0",
|
||||
"parcel": "^2.12.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"@parcel/plugin": "2.12.0",
|
||||
"@parcel/types": "2.12.0",
|
||||
"@parcel/utils": "2.12.0",
|
||||
"posthtml": "^0.16.4"
|
||||
},
|
||||
"gitHead": "2059029ee91e5f03a273b0954d3e629d7375f986"
|
||||
}
|
169
webGl/my-threejs-test/node_modules/@parcel/packager-svg/src/SVGPackager.js
generated
vendored
Normal file
169
webGl/my-threejs-test/node_modules/@parcel/packager-svg/src/SVGPackager.js
generated
vendored
Normal file
@@ -0,0 +1,169 @@
|
||||
// @flow
|
||||
|
||||
import type {Bundle, BundleGraph, NamedBundle} from '@parcel/types';
|
||||
import assert from 'assert';
|
||||
import {Packager} from '@parcel/plugin';
|
||||
import posthtml from 'posthtml';
|
||||
import {
|
||||
blobToString,
|
||||
replaceInlineReferences,
|
||||
replaceURLReferences,
|
||||
urlJoin,
|
||||
setDifference,
|
||||
} from '@parcel/utils';
|
||||
|
||||
export default (new Packager({
|
||||
async package({bundle, bundleGraph, getInlineBundleContents}) {
|
||||
const assets = [];
|
||||
bundle.traverseAssets(asset => {
|
||||
assets.push(asset);
|
||||
});
|
||||
|
||||
assert.strictEqual(
|
||||
assets.length,
|
||||
1,
|
||||
'SVG bundles must only contain one asset',
|
||||
);
|
||||
|
||||
// Add bundles in the same bundle group that are not inline. For example, if two inline
|
||||
// bundles refer to the same library that is extracted into a shared bundle.
|
||||
let referencedBundles = [
|
||||
...setDifference(
|
||||
new Set(bundleGraph.getReferencedBundles(bundle)),
|
||||
new Set(bundleGraph.getReferencedBundles(bundle, {recursive: false})),
|
||||
),
|
||||
];
|
||||
|
||||
const asset = assets[0];
|
||||
const code = await asset.getCode();
|
||||
const options = {
|
||||
directives: [
|
||||
{
|
||||
name: /^\?/,
|
||||
start: '<',
|
||||
end: '>',
|
||||
},
|
||||
],
|
||||
xmlMode: true,
|
||||
};
|
||||
|
||||
let {html: svg} = await posthtml([
|
||||
tree => insertBundleReferences(referencedBundles, tree),
|
||||
tree =>
|
||||
replaceInlineAssetContent(bundleGraph, getInlineBundleContents, tree),
|
||||
]).process(code, options);
|
||||
|
||||
const {contents, map} = replaceURLReferences({
|
||||
bundle,
|
||||
bundleGraph,
|
||||
contents: svg,
|
||||
relative: false,
|
||||
getReplacement: contents => contents.replace(/"/g, '"'),
|
||||
});
|
||||
|
||||
return replaceInlineReferences({
|
||||
bundle,
|
||||
bundleGraph,
|
||||
contents,
|
||||
getInlineBundleContents,
|
||||
getInlineReplacement: (dep, inlineType, contents) => ({
|
||||
from: dep.id,
|
||||
to: contents.replace(/"/g, '"').trim(),
|
||||
}),
|
||||
map,
|
||||
});
|
||||
},
|
||||
}): Packager);
|
||||
|
||||
async function replaceInlineAssetContent(
|
||||
bundleGraph: BundleGraph<NamedBundle>,
|
||||
getInlineBundleContents,
|
||||
tree,
|
||||
) {
|
||||
const inlineNodes = [];
|
||||
tree.walk(node => {
|
||||
if (node.attrs && node.attrs['data-parcel-key']) {
|
||||
inlineNodes.push(node);
|
||||
}
|
||||
return node;
|
||||
});
|
||||
|
||||
for (const node of inlineNodes) {
|
||||
const newContent = await getAssetContent(
|
||||
bundleGraph,
|
||||
getInlineBundleContents,
|
||||
node.attrs['data-parcel-key'],
|
||||
);
|
||||
|
||||
if (newContent === null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
node.content = await blobToString(newContent.contents);
|
||||
|
||||
// Wrap scripts and styles with CDATA if needed to ensure characters are not interpreted as XML
|
||||
if (node.tag === 'script' || node.tag === 'style') {
|
||||
if (node.content.includes('<') || node.content.includes('&')) {
|
||||
node.content = node.content.replace(/]]>/g, ']\\]>');
|
||||
node.content = `<![CDATA[\n${node.content}\n]]>`;
|
||||
}
|
||||
}
|
||||
|
||||
// remove attr from output
|
||||
delete node.attrs['data-parcel-key'];
|
||||
}
|
||||
|
||||
return tree;
|
||||
}
|
||||
|
||||
async function getAssetContent(
|
||||
bundleGraph: BundleGraph<NamedBundle>,
|
||||
getInlineBundleContents,
|
||||
assetId,
|
||||
) {
|
||||
let inlineBundle: ?Bundle;
|
||||
bundleGraph.traverseBundles((bundle, context, {stop}) => {
|
||||
const entryAssets = bundle.getEntryAssets();
|
||||
if (entryAssets.some(a => a.uniqueKey === assetId)) {
|
||||
inlineBundle = bundle;
|
||||
stop();
|
||||
}
|
||||
});
|
||||
|
||||
if (!inlineBundle) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const bundleResult = await getInlineBundleContents(inlineBundle, bundleGraph);
|
||||
|
||||
return {bundle: inlineBundle, contents: bundleResult.contents};
|
||||
}
|
||||
|
||||
function insertBundleReferences(siblingBundles, tree) {
|
||||
let scripts = [];
|
||||
let stylesheets = [];
|
||||
|
||||
for (let bundle of siblingBundles) {
|
||||
if (bundle.type === 'css') {
|
||||
stylesheets.push(
|
||||
`<?xml-stylesheet href=${JSON.stringify(
|
||||
urlJoin(bundle.target.publicUrl, bundle.name),
|
||||
)}?>`,
|
||||
);
|
||||
} else if (bundle.type === 'js') {
|
||||
scripts.push({
|
||||
tag: 'script',
|
||||
attrs: {
|
||||
href: urlJoin(bundle.target.publicUrl, bundle.name),
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
tree.unshift(...stylesheets);
|
||||
if (scripts.length > 0) {
|
||||
tree.match({tag: 'svg'}, node => {
|
||||
node.content.unshift(...scripts);
|
||||
});
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user