Socket
Socket
Sign inDemoInstall

static-tweets

Package Overview
Dependencies
97
Maintainers
1
Versions
22
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.0-alpha.1 to 1.0.0-alpha.5

91

build/index.js

@@ -1,21 +0,1 @@

var __defProp = Object.defineProperty;
var __defProps = Object.defineProperties;
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __propIsEnum = Object.prototype.propertyIsEnumerable;
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var __spreadValues = (a, b) => {
for (var prop in b || (b = {}))
if (__hasOwnProp.call(b, prop))
__defNormalProp(a, prop, b[prop]);
if (__getOwnPropSymbols)
for (var prop of __getOwnPropSymbols(b)) {
if (__propIsEnum.call(b, prop))
__defNormalProp(a, prop, b[prop]);
}
return a;
};
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
// src/fetchTweetAst.ts

@@ -39,5 +19,6 @@ import GithubSlugger from "github-slugger";

async function get(url, opts) {
const res = await got(url, __spreadProps(__spreadValues({}, opts), {
const res = await got(url, {
...opts,
agent: { https: agent }
}));
});
return JSON.parse(res.body);

@@ -55,7 +36,10 @@ }

return null;
return get(`${API_URL}/1.1/statuses/show/${tweetId}.json?include_entities=true&tweet_mode=extended`, {
headers: {
authorization: `Bearer ${process.env.TWITTER_ACCESS_TOKEN}`
return get(
`${API_URL}/1.1/statuses/show/${tweetId}.json?include_entities=true&tweet_mode=extended`,
{
headers: {
authorization: `Bearer ${process.env.TWITTER_ACCESS_TOKEN}`
}
}
});
);
}

@@ -66,7 +50,10 @@ async function fetchTweetWithPoll(tweetId) {

return null;
return get(`${API_URL}/labs/1/tweets?format=compact&expansions=${expansions}&ids=${tweetId}`, {
headers: {
authorization: `Bearer ${process.env.TWITTER_ACCESS_TOKEN}`
return get(
`${API_URL}/labs/1/tweets?format=compact&expansions=${expansions}&ids=${tweetId}`,
{
headers: {
authorization: `Bearer ${process.env.TWITTER_ACCESS_TOKEN}`
}
}
});
);
}

@@ -97,5 +84,11 @@ async function getEmbeddedTweetHtml(url) {

const heartCount = tweetInfo.find('[data-scribe="element:heart_count"]');
const callToAction = container.children('[data-scribe="section:cta component:news"]');
const profileText = callToAction.children('[data-scribe="element:profile_text"]');
const conversationText = callToAction.children('[data-scribe="element:conversation_text"]');
const callToAction = container.children(
'[data-scribe="section:cta component:news"]'
);
const profileText = callToAction.children(
'[data-scribe="element:profile_text"]'
);
const conversationText = callToAction.children(
'[data-scribe="element:conversation_text"]'
);
let quotedTweet;

@@ -181,3 +174,6 @@ let mediaHtml;

}
console.error("An image with the following props is not being handled:", props);
console.error(
"An image with the following props is not being handled:",
props
);
});

@@ -232,3 +228,5 @@ tweetContent.children("a").each(function() {

const container = $("[data-type=video-container]");
const video = $(`<video poster="${poster}" controls preload="none" playsinline>`).append(`<source src="${url}" type="video/mp4">`);
const video = $(
`<video poster="${poster}" controls preload="none" playsinline>`
).append(`<source src="${url}" type="video/mp4">`);
return $("<div>").append(container.append(video)).html();

@@ -245,3 +243,4 @@ }

inlineCode(_, node) {
return __spreadProps(__spreadValues({}, node), {
return {
...node,
type: "element",

@@ -256,3 +255,3 @@ tagName: "code",

]
});
};
}

@@ -278,6 +277,8 @@ };

const poster = video.media_url_https;
const mp4Video = video.video_info.variants.find((v) => v.content_type === "video/mp4");
const mp4Video = video.video_info.variants.find(
(v) => v.content_type === "video/mp4"
);
if (!mp4Video)
return;
return __spreadValues({ poster }, mp4Video);
return { poster, ...mp4Video };
}

@@ -326,3 +327,3 @@ function getPollData(tweet) {

async function getTweetHtml(tweet, context) {
const meta = __spreadProps(__spreadValues({}, tweet.meta), { type: "tweet" });
const meta = { ...tweet.meta, type: "tweet" };
const md = await markdownToAst(tweet.html);

@@ -480,3 +481,7 @@ const html = [

var parent = parents[parents.length - 1];
return visitor(node, parent ? parent.children.indexOf(node) : null, parent);
return visitor(
node,
parent ? parent.children.indexOf(node) : null,
parent
);
}

@@ -577,3 +582,5 @@ };

}
throw new Error(`Unable to handle the following AST: ${JSON.stringify(ast, null, 2)}`);
throw new Error(
`Unable to handle the following AST: ${JSON.stringify(ast, null, 2)}`
);
}

@@ -580,0 +587,0 @@ function rehypeMinify() {

{
"name": "static-tweets",
"version": "1.0.0-alpha.1",
"version": "1.0.0-alpha.5",
"description": "Utilities for fetching and manipulating tweet ASTs.",

@@ -9,3 +9,3 @@ "repository": "transitive-bullshit/react-static-tweets",

"type": "module",
"main": "./build/index.js",
"exports": "./build/index.js",
"module": "./build/index.js",

@@ -40,3 +40,3 @@ "types": "./build/index.d.ts",

},
"gitHead": "820541fe43ea0b721ecbd4f8acc24af3db52d028"
"gitHead": "343cffa2194d8cd03331d40b041dc8d5a0e7eeeb"
}

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc