Commit 5f66e2d6 authored by KS Support 2's avatar KS Support 2
Browse files

fixing object of the day

parent b53fc57c
......@@ -25,7 +25,7 @@
"_resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.12.11.tgz",
"_shasum": "f4ad435aa263db935b8f10f2c552d23fb716a63f",
"_spec": "@babel/code-frame@^7.10.4",
"_where": "/home/davidrhoderick/Development/mvm/mvm-frontity/node_modules/@babel/core",
"_where": "/Users/kssupport2/Desktop/AtrlyticalMedia/Museum/mv-museum-frontity-theme/node_modules/@babel/core",
"author": {
"name": "Sebastian McKenzie",
"email": "sebmck@gmail.com"
......
......@@ -23,7 +23,7 @@
"_resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.12.7.tgz",
"_shasum": "9329b4782a7d6bbd7eef57e11addf91ee3ef1e41",
"_spec": "@babel/compat-data@^7.12.7",
"_where": "/home/davidrhoderick/Development/mvm/mvm-frontity/node_modules/@babel/preset-env",
"_where": "/Users/kssupport2/Desktop/AtrlyticalMedia/Museum/mv-museum-frontity-theme/node_modules/@babel/preset-env",
"author": {
"name": "The Babel Team",
"url": "https://babeljs.io/team"
......
......@@ -22,7 +22,7 @@
"_resolved": "https://registry.npmjs.org/@babel/core/-/core-7.12.10.tgz",
"_shasum": "b79a2e1b9f70ed3d84bbfb6d8c4ef825f606bccd",
"_spec": "@babel/core@^7.3.4",
"_where": "/home/davidrhoderick/Development/mvm/mvm-frontity/node_modules/@frontity/core",
"_where": "/Users/kssupport2/Desktop/AtrlyticalMedia/Museum/mv-museum-frontity-theme/node_modules/@frontity/core",
"author": {
"name": "Sebastian McKenzie",
"email": "sebmck@gmail.com"
......
......@@ -23,7 +23,7 @@
"_resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.12.11.tgz",
"_shasum": "98a7df7b8c358c9a37ab07a24056853016aba3af",
"_spec": "@babel/generator@^7.12.10",
"_where": "/home/davidrhoderick/Development/mvm/mvm-frontity/node_modules/@babel/core",
"_where": "/Users/kssupport2/Desktop/AtrlyticalMedia/Museum/mv-museum-frontity-theme/node_modules/@babel/core",
"author": {
"name": "Sebastian McKenzie",
"email": "sebmck@gmail.com"
......
......@@ -17,17 +17,16 @@
"fetchSpec": "^7.10.4"
},
"_requiredBy": [
"/@babel/helper-builder-react-jsx",
"/@babel/helper-builder-react-jsx-experimental",
"/@babel/helper-create-regexp-features-plugin",
"/@babel/helper-remap-async-to-generator",
"/@babel/plugin-transform-classes",
"/@babel/plugin-transform-react-jsx",
"/@babel/plugin-transform-react-pure-annotations"
],
"_resolved": "https://registry.npmjs.org/@babel/helper-annotate-as-pure/-/helper-annotate-as-pure-7.12.10.tgz",
"_shasum": "54ab9b000e60a93644ce17b3f37d313aaf1d115d",
"_spec": "@babel/helper-annotate-as-pure@^7.10.4",
"_where": "/home/davidrhoderick/Development/mvm/mvm-frontity/node_modules/@babel/helper-remap-async-to-generator",
"_where": "/Users/kssupport2/Desktop/AtrlyticalMedia/Museum/mv-museum-frontity-theme/node_modules/@babel/helper-remap-async-to-generator",
"bugs": {
"url": "https://github.com/babel/babel/issues"
},
......
......@@ -22,7 +22,7 @@
"_resolved": "https://registry.npmjs.org/@babel/helper-builder-binary-assignment-operator-visitor/-/helper-builder-binary-assignment-operator-visitor-7.10.4.tgz",
"_shasum": "bb0b75f31bf98cbf9ff143c1ae578b87274ae1a3",
"_spec": "@babel/helper-builder-binary-assignment-operator-visitor@^7.10.4",
"_where": "/home/davidrhoderick/Development/mvm/mvm-frontity/node_modules/@babel/plugin-transform-exponentiation-operator",
"_where": "/Users/kssupport2/Desktop/AtrlyticalMedia/Museum/mv-museum-frontity-theme/node_modules/@babel/plugin-transform-exponentiation-operator",
"bugs": {
"url": "https://github.com/babel/babel/issues"
},
......
MIT License
Copyright (c) 2014-present Sebastian McKenzie and other contributors
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.
{
"_from": "@babel/helper-builder-react-jsx-experimental@^7.12.11",
"_id": "@babel/helper-builder-react-jsx-experimental@7.12.11",
"_inBundle": false,
"_integrity": "sha512-4oGVOekPI8dh9JphkPXC68iIuP6qp/RPbaPmorRmEFbRAHZjSqxPjqHudn18GVDPgCuFM/KdFXc63C17Ygfa9w==",
"_location": "/@babel/helper-builder-react-jsx-experimental",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "@babel/helper-builder-react-jsx-experimental@^7.12.11",
"name": "@babel/helper-builder-react-jsx-experimental",
"escapedName": "@babel%2fhelper-builder-react-jsx-experimental",
"scope": "@babel",
"rawSpec": "^7.12.11",
"saveSpec": null,
"fetchSpec": "^7.12.11"
},
"_requiredBy": [
"/@babel/plugin-transform-react-jsx",
"/@babel/plugin-transform-react-jsx-development"
],
"_resolved": "https://registry.npmjs.org/@babel/helper-builder-react-jsx-experimental/-/helper-builder-react-jsx-experimental-7.12.11.tgz",
"_shasum": "a39616d7e4cf8f9da1f82b5fc3ee1f7406beeb11",
"_spec": "@babel/helper-builder-react-jsx-experimental@^7.12.11",
"_where": "/home/davidrhoderick/Development/mvm/mvm-frontity/node_modules/@babel/plugin-transform-react-jsx",
"bugs": {
"url": "https://github.com/babel/babel/issues"
},
"bundleDependencies": false,
"dependencies": {
"@babel/helper-annotate-as-pure": "^7.12.10",
"@babel/helper-module-imports": "^7.12.5",
"@babel/types": "^7.12.11"
},
"deprecated": false,
"description": "Helper function to build react jsx",
"homepage": "https://github.com/babel/babel#readme",
"license": "MIT",
"main": "lib/index.js",
"name": "@babel/helper-builder-react-jsx-experimental",
"publishConfig": {
"access": "public"
},
"repository": {
"type": "git",
"url": "git+https://github.com/babel/babel.git",
"directory": "packages/babel-helper-builder-react-jsx-experimental"
},
"version": "7.12.11"
}
MIT License
Copyright (c) 2014-present Sebastian McKenzie and other contributors
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.
# @babel/helper-builder-react-jsx
> Helper function to build react jsx
See our website [@babel/helper-builder-react-jsx](https://babeljs.io/docs/en/next/babel-helper-builder-react-jsx.html) for more information.
## Install
Using npm:
```sh
npm install --save-dev @babel/helper-builder-react-jsx
```
or using yarn:
```sh
yarn add @babel/helper-builder-react-jsx --dev
```
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = _default;
var t = _interopRequireWildcard(require("@babel/types"));
var _helperAnnotateAsPure = _interopRequireDefault(require("@babel/helper-annotate-as-pure"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
function _default(opts) {
const visitor = {};
visitor.JSXNamespacedName = function (path) {
if (opts.throwIfNamespace) {
throw path.buildCodeFrameError(`Namespace tags are not supported by default. React's JSX doesn't support namespace tags. \
You can set \`throwIfNamespace: false\` to bypass this warning.`);
}
};
visitor.JSXSpreadChild = function (path) {
throw path.buildCodeFrameError("Spread children are not supported in React.");
};
visitor.JSXElement = {
exit(path, file) {
const callExpr = buildElementCall(path, file);
if (callExpr) {
path.replaceWith(t.inherits(callExpr, path.node));
}
}
};
visitor.JSXFragment = {
exit(path, file) {
if (opts.compat) {
throw path.buildCodeFrameError("Fragment tags are only supported in React 16 and up.");
}
const callExpr = buildFragmentCall(path, file);
if (callExpr) {
path.replaceWith(t.inherits(callExpr, path.node));
}
}
};
return visitor;
function convertJSXIdentifier(node, parent) {
if (t.isJSXIdentifier(node)) {
if (node.name === "this" && t.isReferenced(node, parent)) {
return t.thisExpression();
} else if (t.isValidIdentifier(node.name, false)) {
node.type = "Identifier";
} else {
return t.stringLiteral(node.name);
}
} else if (t.isJSXMemberExpression(node)) {
return t.memberExpression(convertJSXIdentifier(node.object, node), convertJSXIdentifier(node.property, node));
} else if (t.isJSXNamespacedName(node)) {
return t.stringLiteral(`${node.namespace.name}:${node.name.name}`);
}
return node;
}
function convertAttributeValue(node) {
if (t.isJSXExpressionContainer(node)) {
return node.expression;
} else {
return node;
}
}
function convertAttribute(node) {
const value = convertAttributeValue(node.value || t.booleanLiteral(true));
if (t.isJSXSpreadAttribute(node)) {
return t.spreadElement(node.argument);
}
if (t.isStringLiteral(value) && !t.isJSXExpressionContainer(node.value)) {
var _value$extra;
value.value = value.value.replace(/\n\s+/g, " ");
(_value$extra = value.extra) == null ? true : delete _value$extra.raw;
}
if (t.isJSXNamespacedName(node.name)) {
node.name = t.stringLiteral(node.name.namespace.name + ":" + node.name.name.name);
} else if (t.isValidIdentifier(node.name.name, false)) {
node.name.type = "Identifier";
} else {
node.name = t.stringLiteral(node.name.name);
}
return t.inherits(t.objectProperty(node.name, value), node);
}
function buildElementCall(path, file) {
if (opts.filter && !opts.filter(path.node, file)) return;
const openingPath = path.get("openingElement");
openingPath.parent.children = t.react.buildChildren(openingPath.parent);
const tagExpr = convertJSXIdentifier(openingPath.node.name, openingPath.node);
const args = [];
let tagName;
if (t.isIdentifier(tagExpr)) {
tagName = tagExpr.name;
} else if (t.isLiteral(tagExpr)) {
tagName = tagExpr.value;
}
const state = {
tagExpr: tagExpr,
tagName: tagName,
args: args,
pure: false
};
if (opts.pre) {
opts.pre(state, file);
}
let attribs = openingPath.node.attributes;
if (attribs.length) {
attribs = buildOpeningElementAttributes(attribs, file);
} else {
attribs = t.nullLiteral();
}
args.push(attribs, ...path.node.children);
if (opts.post) {
opts.post(state, file);
}
const call = state.call || t.callExpression(state.callee, args);
if (state.pure) (0, _helperAnnotateAsPure.default)(call);
return call;
}
function pushProps(_props, objs) {
if (!_props.length) return _props;
objs.push(t.objectExpression(_props));
return [];
}
function buildOpeningElementAttributes(attribs, file) {
let _props = [];
const objs = [];
const {
useSpread = false
} = file.opts;
if (typeof useSpread !== "boolean") {
throw new Error("transform-react-jsx currently only accepts a boolean option for " + "useSpread (defaults to false)");
}
const useBuiltIns = file.opts.useBuiltIns || false;
if (typeof useBuiltIns !== "boolean") {
throw new Error("transform-react-jsx currently only accepts a boolean option for " + "useBuiltIns (defaults to false)");
}
if (useSpread && useBuiltIns) {
throw new Error("transform-react-jsx currently only accepts useBuiltIns or useSpread " + "but not both");
}
if (useSpread) {
const props = attribs.map(convertAttribute);
return t.objectExpression(props);
}
while (attribs.length) {
const prop = attribs.shift();
if (t.isJSXSpreadAttribute(prop)) {
_props = pushProps(_props, objs);
objs.push(prop.argument);
} else {
_props.push(convertAttribute(prop));
}
}
pushProps(_props, objs);
if (objs.length === 1) {
attribs = objs[0];
} else {
if (!t.isObjectExpression(objs[0])) {
objs.unshift(t.objectExpression([]));
}
const helper = useBuiltIns ? t.memberExpression(t.identifier("Object"), t.identifier("assign")) : file.addHelper("extends");
attribs = t.callExpression(helper, objs);
}
return attribs;
}
function buildFragmentCall(path, file) {
if (opts.filter && !opts.filter(path.node, file)) return;
const openingPath = path.get("openingElement");
openingPath.parent.children = t.react.buildChildren(openingPath.parent);
const args = [];
const tagName = null;
const tagExpr = file.get("jsxFragIdentifier")();
const state = {
tagExpr: tagExpr,
tagName: tagName,
args: args,
pure: false
};
if (opts.pre) {
opts.pre(state, file);
}
args.push(t.nullLiteral(), ...path.node.children);
if (opts.post) {
opts.post(state, file);
}
file.set("usedFragment", true);
const call = state.call || t.callExpression(state.callee, args);
if (state.pure) (0, _helperAnnotateAsPure.default)(call);
return call;
}
}
\ No newline at end of file
{
"_from": "@babel/helper-builder-react-jsx@^7.10.4",
"_id": "@babel/helper-builder-react-jsx@7.10.4",
"_inBundle": false,
"_integrity": "sha512-5nPcIZ7+KKDxT1427oBivl9V9YTal7qk0diccnh7RrcgrT/pGFOjgGw1dgryyx1GvHEpXVfoDF6Ak3rTiWh8Rg==",
"_location": "/@babel/helper-builder-react-jsx",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "@babel/helper-builder-react-jsx@^7.10.4",
"name": "@babel/helper-builder-react-jsx",
"escapedName": "@babel%2fhelper-builder-react-jsx",
"scope": "@babel",
"rawSpec": "^7.10.4",
"saveSpec": null,
"fetchSpec": "^7.10.4"
},
"_requiredBy": [
"/@babel/plugin-transform-react-jsx"
],
"_resolved": "https://registry.npmjs.org/@babel/helper-builder-react-jsx/-/helper-builder-react-jsx-7.10.4.tgz",
"_shasum": "8095cddbff858e6fa9c326daee54a2f2732c1d5d",
"_spec": "@babel/helper-builder-react-jsx@^7.10.4",
"_where": "/home/davidrhoderick/Development/mvm/mvm-frontity/node_modules/@babel/plugin-transform-react-jsx",
"bugs": {
"url": "https://github.com/babel/babel/issues"
},
"bundleDependencies": false,
"dependencies": {
"@babel/helper-annotate-as-pure": "^7.10.4",
"@babel/types": "^7.10.4"
},
"deprecated": false,
"description": "Helper function to build react jsx",
"gitHead": "7fd40d86a0d03ff0e9c3ea16b29689945433d4df",
"homepage": "https://github.com/babel/babel#readme",
"license": "MIT",
"main": "lib/index.js",
"name": "@babel/helper-builder-react-jsx",
"publishConfig": {
"access": "public"
},
"repository": {
"type": "git",
"url": "git+https://github.com/babel/babel.git",
"directory": "packages/babel-helper-builder-react-jsx"
},
"version": "7.10.4"
}
......@@ -22,7 +22,7 @@
"_resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.12.5.tgz",
"_shasum": "cb470c76198db6a24e9dbc8987275631e5d29831",
"_spec": "@babel/helper-compilation-targets@^7.12.5",
"_where": "/home/davidrhoderick/Development/mvm/mvm-frontity/node_modules/@babel/preset-env",
"_where": "/Users/kssupport2/Desktop/AtrlyticalMedia/Museum/mv-museum-frontity-theme/node_modules/@babel/preset-env",
"author": {
"name": "The Babel Team",
"url": "https://babeljs.io/team"
......
......@@ -24,7 +24,7 @@
"_resolved": "https://registry.npmjs.org/@babel/helper-create-class-features-plugin/-/helper-create-class-features-plugin-7.12.1.tgz",
"_shasum": "3c45998f431edd4a9214c5f1d3ad1448a6137f6e",
"_spec": "@babel/helper-create-class-features-plugin@^7.12.1",
"_where": "/home/davidrhoderick/Development/mvm/mvm-frontity/node_modules/@babel/plugin-proposal-class-properties",
"_where": "/Users/kssupport2/Desktop/AtrlyticalMedia/Museum/mv-museum-frontity-theme/node_modules/@babel/plugin-proposal-class-properties",
"author": {
"name": "The Babel Team",
"url": "https://babeljs.io/team"
......
......@@ -25,7 +25,7 @@
"_resolved": "https://registry.npmjs.org/@babel/helper-create-regexp-features-plugin/-/helper-create-regexp-features-plugin-7.12.7.tgz",
"_shasum": "2084172e95443fa0a09214ba1bb328f9aea1278f",
"_spec": "@babel/helper-create-regexp-features-plugin@^7.12.1",
"_where": "/home/davidrhoderick/Development/mvm/mvm-frontity/node_modules/@babel/plugin-proposal-unicode-property-regex",
"_where": "/Users/kssupport2/Desktop/AtrlyticalMedia/Museum/mv-museum-frontity-theme/node_modules/@babel/plugin-proposal-unicode-property-regex",
"author": {
"name": "The Babel Team",
"url": "https://babeljs.io/team"
......
......@@ -22,7 +22,7 @@
"_resolved": "https://registry.npmjs.org/@babel/helper-define-map/-/helper-define-map-7.10.5.tgz",
"_shasum": "b53c10db78a640800152692b13393147acb9bb30",
"_spec": "@babel/helper-define-map@^7.10.4",
"_where": "/home/davidrhoderick/Development/mvm/mvm-frontity/node_modules/@babel/plugin-transform-classes",
"_where": "/Users/kssupport2/Desktop/AtrlyticalMedia/Museum/mv-museum-frontity-theme/node_modules/@babel/plugin-transform-classes",
"bugs": {
"url": "https://github.com/babel/babel/issues"
},
......
......@@ -22,7 +22,7 @@
"_resolved": "https://registry.npmjs.org/@babel/helper-explode-assignable-expression/-/helper-explode-assignable-expression-7.12.1.tgz",
"_shasum": "8006a466695c4ad86a2a5f2fb15b5f2c31ad5633",
"_spec": "@babel/helper-explode-assignable-expression@^7.10.4",
"_where": "/home/davidrhoderick/Development/mvm/mvm-frontity/node_modules/@babel/helper-builder-binary-assignment-operator-visitor",
"_where": "/Users/kssupport2/Desktop/AtrlyticalMedia/Museum/mv-museum-frontity-theme/node_modules/@babel/helper-builder-binary-assignment-operator-visitor",
"bugs": {
"url": "https://github.com/babel/babel/issues"
},
......
{
"_from": "@babel/helper-function-name@^7.10.4",
"_from": "@babel/helper-function-name@^7.12.11",
"_id": "@babel/helper-function-name@7.12.11",
"_inBundle": false,
"_integrity": "sha512-AtQKjtYNolKNi6nNNVLQ27CP6D9oFR6bq/HPYSizlzbp7uC1M59XJe8L+0uXjbIaZaUJF99ruHqVGiKXU/7ybA==",
......@@ -8,13 +8,13 @@
"_requested": {
"type": "range",
"registry": true,
"raw": "@babel/helper-function-name@^7.10.4",
"raw": "@babel/helper-function-name@^7.12.11",
"name": "@babel/helper-function-name",
"escapedName": "@babel%2fhelper-function-name",
"scope": "@babel",
"rawSpec": "^7.10.4",
"rawSpec": "^7.12.11",
"saveSpec": null,
"fetchSpec": "^7.10.4"
"fetchSpec": "^7.12.11"
},
"_requiredBy": [
"/@babel/helper-create-class-features-plugin",
......@@ -26,8 +26,8 @@
],
"_resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.12.11.tgz",
"_shasum": "1fd7738aee5dcf53c3ecff24f1da9c511ec47b42",
"_spec": "@babel/helper-function-name@^7.10.4",
"_where": "/home/davidrhoderick/Development/mvm/mvm-frontity/node_modules/@babel/traverse",
"_spec": "@babel/helper-function-name@^7.12.11",