🎩 You're Invited:Meet the Socket team at Black Hat in Las Vegas, August 3-6.RSVP
Sign In

@fedify/vocab-runtime

Package Overview
Dependencies
Maintainers
3
Versions
312
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@fedify/vocab-runtime - npm Package Compare versions

Comparing version
2.0.22-dev.1565
to
2.0.22
+70
dist/tests/request-BCamQAi7.mjs
import process from "node:process";
//#region deno.json
var name = "@fedify/vocab-runtime";
var version = "2.0.22";
//#endregion
//#region src/request.ts
/**
* Error thrown when fetching a JSON-LD document failed.
*/
var FetchError = class extends Error {
/**
* The URL that failed to fetch.
*/
url;
/**
* Constructs a new `FetchError`.
*
* @param url The URL that failed to fetch.
* @param message Error message.
*/
constructor(url, message) {
super(message == null ? url.toString() : `${url}: ${message}`);
this.name = "FetchError";
this.url = typeof url === "string" ? new URL(url) : url;
}
};
/**
* Creates a request for the given URL.
* @param url The URL to create the request for.
* @param options The options for the request.
* @returns The created request.
* @internal
*/
function createActivityPubRequest(url, options = {}) {
return new Request(url, {
headers: {
Accept: "application/activity+json, application/ld+json",
"User-Agent": typeof options.userAgent === "string" ? options.userAgent : getUserAgent(options.userAgent)
},
redirect: "manual"
});
}
/**
* Gets the user agent string for the given application and URL.
* @param options The options for making the user agent string.
* @returns The user agent string.
* @since 1.3.0
*/
function getUserAgent({ software, url } = {}) {
const fedify = `Fedify/${version}`;
const runtime = globalThis.Deno?.version?.deno != null ? `Deno/${Deno.version.deno}` : globalThis.process?.versions?.bun != null ? `Bun/${process.versions.bun}` : "navigator" in globalThis && navigator.userAgent === "Cloudflare-Workers" ? navigator.userAgent : globalThis.process?.versions?.node != null ? `Node.js/${process.versions.node}` : null;
const userAgent = software == null ? [fedify] : [software, fedify];
if (runtime != null) userAgent.push(runtime);
if (url != null) userAgent.push(`+${url.toString()}`);
return `${userAgent.shift()} (${userAgent.join("; ")})`;
}
/**
* Logs the request.
* @param request The request to log.
* @internal
*/
function logRequest(logger, request) {
logger.debug("Fetching document: {method} {url} {headers}", {
method: request.method,
url: request.url,
headers: Object.fromEntries(request.headers.entries())
});
}
//#endregion
export { name as a, logRequest as i, createActivityPubRequest as n, version as o, getUserAgent as r, FetchError as t };
const require_chunk = require("./chunk-Do9eywBl.cjs");
let node_process = require("node:process");
node_process = require_chunk.__toESM(node_process);
//#region deno.json
var name = "@fedify/vocab-runtime";
var version = "2.0.22";
//#endregion
//#region src/request.ts
/**
* Error thrown when fetching a JSON-LD document failed.
*/
var FetchError = class extends Error {
/**
* The URL that failed to fetch.
*/
url;
/**
* Constructs a new `FetchError`.
*
* @param url The URL that failed to fetch.
* @param message Error message.
*/
constructor(url, message) {
super(message == null ? url.toString() : `${url}: ${message}`);
this.name = "FetchError";
this.url = typeof url === "string" ? new URL(url) : url;
}
};
/**
* Creates a request for the given URL.
* @param url The URL to create the request for.
* @param options The options for the request.
* @returns The created request.
* @internal
*/
function createActivityPubRequest(url, options = {}) {
return new Request(url, {
headers: {
Accept: "application/activity+json, application/ld+json",
"User-Agent": typeof options.userAgent === "string" ? options.userAgent : getUserAgent(options.userAgent)
},
redirect: "manual"
});
}
/**
* Gets the user agent string for the given application and URL.
* @param options The options for making the user agent string.
* @returns The user agent string.
* @since 1.3.0
*/
function getUserAgent({ software, url } = {}) {
const fedify = `Fedify/${version}`;
const runtime = globalThis.Deno?.version?.deno != null ? `Deno/${Deno.version.deno}` : globalThis.process?.versions?.bun != null ? `Bun/${node_process.default.versions.bun}` : "navigator" in globalThis && navigator.userAgent === "Cloudflare-Workers" ? navigator.userAgent : globalThis.process?.versions?.node != null ? `Node.js/${node_process.default.versions.node}` : null;
const userAgent = software == null ? [fedify] : [software, fedify];
if (runtime != null) userAgent.push(runtime);
if (url != null) userAgent.push(`+${url.toString()}`);
return `${userAgent.shift()} (${userAgent.join("; ")})`;
}
/**
* Logs the request.
* @param request The request to log.
* @internal
*/
function logRequest(logger, request) {
logger.debug("Fetching document: {method} {url} {headers}", {
method: request.method,
url: request.url,
headers: Object.fromEntries(request.headers.entries())
});
}
//#endregion
Object.defineProperty(exports, "FetchError", {
enumerable: true,
get: function() {
return FetchError;
}
});
Object.defineProperty(exports, "createActivityPubRequest", {
enumerable: true,
get: function() {
return createActivityPubRequest;
}
});
Object.defineProperty(exports, "getUserAgent", {
enumerable: true,
get: function() {
return getUserAgent;
}
});
Object.defineProperty(exports, "logRequest", {
enumerable: true,
get: function() {
return logRequest;
}
});
Object.defineProperty(exports, "name", {
enumerable: true,
get: function() {
return name;
}
});
Object.defineProperty(exports, "version", {
enumerable: true,
get: function() {
return version;
}
});
+1
-1
{
"name": "@fedify/vocab-runtime",
"version": "2.0.22-dev.1565+b5a902fa",
"version": "2.0.22",
"license": "MIT",

@@ -5,0 +5,0 @@ "exports": {

const require_chunk = require("./chunk-Do9eywBl.cjs");
const require_request = require("./request-BU9pVpmw.cjs");
const require_request = require("./request-C5_wkNY2.cjs");
let node_assert = require("node:assert");

@@ -4,0 +4,0 @@ let node_test = require("node:test");

@@ -1,2 +0,2 @@

import { o as version, r as getUserAgent } from "./request-CzycHiJe.mjs";
import { o as version, r as getUserAgent } from "./request-BCamQAi7.mjs";
import { deepStrictEqual } from "node:assert";

@@ -3,0 +3,0 @@ import { test } from "node:test";

{
"name": "@fedify/vocab-runtime",
"version": "2.0.22-dev.1565+b5a902fa",
"version": "2.0.22",
"homepage": "https://fedify.dev/",

@@ -5,0 +5,0 @@ "repository": {

const require_chunk = require("./chunk-Do9eywBl.cjs");
let node_process = require("node:process");
node_process = require_chunk.__toESM(node_process);
//#region deno.json
var name = "@fedify/vocab-runtime";
var version = "2.0.22-dev.1565+b5a902fa";
//#endregion
//#region src/request.ts
/**
* Error thrown when fetching a JSON-LD document failed.
*/
var FetchError = class extends Error {
/**
* The URL that failed to fetch.
*/
url;
/**
* Constructs a new `FetchError`.
*
* @param url The URL that failed to fetch.
* @param message Error message.
*/
constructor(url, message) {
super(message == null ? url.toString() : `${url}: ${message}`);
this.name = "FetchError";
this.url = typeof url === "string" ? new URL(url) : url;
}
};
/**
* Creates a request for the given URL.
* @param url The URL to create the request for.
* @param options The options for the request.
* @returns The created request.
* @internal
*/
function createActivityPubRequest(url, options = {}) {
return new Request(url, {
headers: {
Accept: "application/activity+json, application/ld+json",
"User-Agent": typeof options.userAgent === "string" ? options.userAgent : getUserAgent(options.userAgent)
},
redirect: "manual"
});
}
/**
* Gets the user agent string for the given application and URL.
* @param options The options for making the user agent string.
* @returns The user agent string.
* @since 1.3.0
*/
function getUserAgent({ software, url } = {}) {
const fedify = `Fedify/${version}`;
const runtime = globalThis.Deno?.version?.deno != null ? `Deno/${Deno.version.deno}` : globalThis.process?.versions?.bun != null ? `Bun/${node_process.default.versions.bun}` : "navigator" in globalThis && navigator.userAgent === "Cloudflare-Workers" ? navigator.userAgent : globalThis.process?.versions?.node != null ? `Node.js/${node_process.default.versions.node}` : null;
const userAgent = software == null ? [fedify] : [software, fedify];
if (runtime != null) userAgent.push(runtime);
if (url != null) userAgent.push(`+${url.toString()}`);
return `${userAgent.shift()} (${userAgent.join("; ")})`;
}
/**
* Logs the request.
* @param request The request to log.
* @internal
*/
function logRequest(logger, request) {
logger.debug("Fetching document: {method} {url} {headers}", {
method: request.method,
url: request.url,
headers: Object.fromEntries(request.headers.entries())
});
}
//#endregion
Object.defineProperty(exports, "FetchError", {
enumerable: true,
get: function() {
return FetchError;
}
});
Object.defineProperty(exports, "createActivityPubRequest", {
enumerable: true,
get: function() {
return createActivityPubRequest;
}
});
Object.defineProperty(exports, "getUserAgent", {
enumerable: true,
get: function() {
return getUserAgent;
}
});
Object.defineProperty(exports, "logRequest", {
enumerable: true,
get: function() {
return logRequest;
}
});
Object.defineProperty(exports, "name", {
enumerable: true,
get: function() {
return name;
}
});
Object.defineProperty(exports, "version", {
enumerable: true,
get: function() {
return version;
}
});
import process from "node:process";
//#region deno.json
var name = "@fedify/vocab-runtime";
var version = "2.0.22-dev.1565+b5a902fa";
//#endregion
//#region src/request.ts
/**
* Error thrown when fetching a JSON-LD document failed.
*/
var FetchError = class extends Error {
/**
* The URL that failed to fetch.
*/
url;
/**
* Constructs a new `FetchError`.
*
* @param url The URL that failed to fetch.
* @param message Error message.
*/
constructor(url, message) {
super(message == null ? url.toString() : `${url}: ${message}`);
this.name = "FetchError";
this.url = typeof url === "string" ? new URL(url) : url;
}
};
/**
* Creates a request for the given URL.
* @param url The URL to create the request for.
* @param options The options for the request.
* @returns The created request.
* @internal
*/
function createActivityPubRequest(url, options = {}) {
return new Request(url, {
headers: {
Accept: "application/activity+json, application/ld+json",
"User-Agent": typeof options.userAgent === "string" ? options.userAgent : getUserAgent(options.userAgent)
},
redirect: "manual"
});
}
/**
* Gets the user agent string for the given application and URL.
* @param options The options for making the user agent string.
* @returns The user agent string.
* @since 1.3.0
*/
function getUserAgent({ software, url } = {}) {
const fedify = `Fedify/${version}`;
const runtime = globalThis.Deno?.version?.deno != null ? `Deno/${Deno.version.deno}` : globalThis.process?.versions?.bun != null ? `Bun/${process.versions.bun}` : "navigator" in globalThis && navigator.userAgent === "Cloudflare-Workers" ? navigator.userAgent : globalThis.process?.versions?.node != null ? `Node.js/${process.versions.node}` : null;
const userAgent = software == null ? [fedify] : [software, fedify];
if (runtime != null) userAgent.push(runtime);
if (url != null) userAgent.push(`+${url.toString()}`);
return `${userAgent.shift()} (${userAgent.join("; ")})`;
}
/**
* Logs the request.
* @param request The request to log.
* @internal
*/
function logRequest(logger, request) {
logger.debug("Fetching document: {method} {url} {headers}", {
method: request.method,
url: request.url,
headers: Object.fromEntries(request.headers.entries())
});
}
//#endregion
export { name as a, logRequest as i, createActivityPubRequest as n, version as o, getUserAgent as r, FetchError as t };

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display