🎩 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.3.2-dev.1556
to
2.3.2
dist/tests/docloader-BOGED_Op.mjs

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

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

+113
const require_chunk = require("./chunk-C2EiDwsr.cjs");
let node_process = require("node:process");
node_process = require_chunk.__toESM(node_process, 1);
//#region deno.json
var name = "@fedify/vocab-runtime";
var version = "2.3.2";
//#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;
/**
* The HTTP response that failed, if available.
*/
response;
/**
* Constructs a new `FetchError`.
*
* @param url The URL that failed to fetch.
* @param message Error message.
* @param response The failed HTTP response, if available.
*/
constructor(url, message, response) {
super(message == null ? url.toString() : `${url}: ${message}`);
this.name = "FetchError";
this.url = typeof url === "string" ? new URL(url) : url;
this.response = response;
}
};
/**
* 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.3.2";
//#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;
/**
* The HTTP response that failed, if available.
*/
response;
/**
* Constructs a new `FetchError`.
*
* @param url The URL that failed to fetch.
* @param message Error message.
* @param response The failed HTTP response, if available.
*/
constructor(url, message, response) {
super(message == null ? url.toString() : `${url}: ${message}`);
this.name = "FetchError";
this.url = typeof url === "string" ? new URL(url) : url;
this.response = response;
}
};
/**
* 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 };
+1
-1
{
"name": "@fedify/vocab-runtime",
"version": "2.3.2-dev.1556+3e14f2d7",
"version": "2.3.2",
"license": "MIT",

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

require("./chunk-C2EiDwsr.cjs");
require("./docloader-dOzCqf3N.cjs");
require("./docloader-DmWDiCxH.cjs");
require("./url-C20FhC7p.cjs");

@@ -4,0 +4,0 @@ require("./key-pMmqUKuo.cjs");

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

import "./docloader-CXChKvdE.mjs";
import "./docloader-BOGED_Op.mjs";
import "./url-m9Qzxy-Y.mjs";

@@ -3,0 +3,0 @@ import "./key-CrrK9mYh.mjs";

const require_chunk = require("./chunk-C2EiDwsr.cjs");
const require_docloader = require("./docloader-dOzCqf3N.cjs");
const require_request = require("./request-CiXkZkTU.cjs");
const require_docloader = require("./docloader-DmWDiCxH.cjs");
const require_request = require("./request-ClAnB4aH.cjs");
const require_url = require("./url-C20FhC7p.cjs");

@@ -5,0 +5,0 @@ let node_assert = require("node:assert");

@@ -1,3 +0,3 @@

import { n as preloadedContexts, t as getDocumentLoader } from "./docloader-CXChKvdE.mjs";
import { t as FetchError } from "./request-B_w4OTut.mjs";
import { n as preloadedContexts, t as getDocumentLoader } from "./docloader-BOGED_Op.mjs";
import { t as FetchError } from "./request-DcqSc5NX.mjs";
import { t as UrlError } from "./url-m9Qzxy-Y.mjs";

@@ -4,0 +4,0 @@ import { deepStrictEqual, ok, rejects } from "node:assert";

const require_chunk = require("./chunk-C2EiDwsr.cjs");
const require_request = require("./request-CiXkZkTU.cjs");
const require_request = require("./request-ClAnB4aH.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-B_w4OTut.mjs";
import { o as version, r as getUserAgent } from "./request-DcqSc5NX.mjs";
import { deepStrictEqual } from "node:assert";

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

{
"name": "@fedify/vocab-runtime",
"version": "2.3.2-dev.1556+3e14f2d7",
"version": "2.3.2",
"homepage": "https://fedify.dev/",

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

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

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

import process from "node:process";
//#region deno.json
var name = "@fedify/vocab-runtime";
var version = "2.3.2-dev.1556+3e14f2d7";
//#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;
/**
* The HTTP response that failed, if available.
*/
response;
/**
* Constructs a new `FetchError`.
*
* @param url The URL that failed to fetch.
* @param message Error message.
* @param response The failed HTTP response, if available.
*/
constructor(url, message, response) {
super(message == null ? url.toString() : `${url}: ${message}`);
this.name = "FetchError";
this.url = typeof url === "string" ? new URL(url) : url;
this.response = response;
}
};
/**
* 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-C2EiDwsr.cjs");
let node_process = require("node:process");
node_process = require_chunk.__toESM(node_process, 1);
//#region deno.json
var name = "@fedify/vocab-runtime";
var version = "2.3.2-dev.1556+3e14f2d7";
//#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;
/**
* The HTTP response that failed, if available.
*/
response;
/**
* Constructs a new `FetchError`.
*
* @param url The URL that failed to fetch.
* @param message Error message.
* @param response The failed HTTP response, if available.
*/
constructor(url, message, response) {
super(message == null ? url.toString() : `${url}: ${message}`);
this.name = "FetchError";
this.url = typeof url === "string" ? new URL(url) : url;
this.response = response;
}
};
/**
* 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;
}
});

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

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