update to v0.9.1.

add npm package link
prep for jsr support (I hope)
add favicon
update installation instructions
This commit is contained in:
2026-02-23 00:27:59 -05:00
parent 9dbf7ae796
commit 475fcf6331
36 changed files with 208 additions and 162 deletions

View File

@@ -68,6 +68,15 @@ button {
background-color: var(--link-active);
}
code {
background-color: var(--bg-dark);
color: var(--fg-main);
font-size: smaller;
padding: 0 .5rem;
white-space: pre-wrap;
}
label {
display: inline-block;
border: none;
@@ -182,6 +191,7 @@ summary {
bottom: 0;
display: none;
left: 0;
line-height: 1.5rem;
overflow: auto;
padding: 0 1rem 1rem;
right: 0;

View File

@@ -1,14 +1,2 @@
export default function loadAndParseTwtxtFile(url?: string): Promise<{
lastModified: string;
following: import('./types.ts').Twttr[];
metadata: import('./types.ts').Metadata;
twts: {
content: string;
created: string;
createdUTC: string;
hash: string;
replyHash: string | undefined;
replyNick: string | undefined;
replyUrl: string | undefined;
}[];
}>;
import { Twtxt } from './types.ts';
export default function loadAndParseTwtxtFile(url?: string): Promise<Twtxt>;

View File

@@ -1,18 +1,6 @@
import { Metadata, Twttr } from './types.ts';
import { Twtxt } from './types.ts';
/**
* @param twtxt
* @returns object containing: following, metadata, twts
*/
export default function parseTwtxt(twtxt: string): {
following: Twttr[];
metadata: Metadata;
twts: {
content: string;
created: string;
createdUTC: string;
hash: string;
replyHash: string | undefined;
replyNick: string | undefined;
replyUrl: string | undefined;
}[];
};
export default function parseTwtxt(twtxt: string): Twtxt;

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -26,6 +26,7 @@ export interface Twttr {
}
export interface Twtxt {
following: Twttr[];
lastModified?: string;
metadata: Metadata;
twts: Twt[];
}

View File

@@ -1,2 +1,2 @@
export declare const base32Encode: (payload: string | Uint8Array<ArrayBufferLike>) => any;
export declare const base32Encode: (payload: string | Uint8Array<ArrayBufferLike>) => string;
export declare const getValueOrFirstEntry: (value: unknown | unknown[]) => any;

BIN
dist-demo/favicon-16x16.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 687 B

BIN
dist-demo/favicon-32x32.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 909 B

BIN
dist-demo/favicon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 687 B

View File

@@ -4,6 +4,9 @@
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>twtxt-lib Demo</title>
<link rel="shortcut icon" href="favicon.ico"/>
<link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png">
<link rel="stylesheet" href="/demo/styles.css" />
</head>
@@ -47,32 +50,65 @@
<a href="/dist-browser/twtxt-lib.js">ES6+ library for the browser</a>,
with NPM and JSR versions coming soon.
<li>Fully typed and source-mapped.</li>
<li><a href="https://caniuse.com/es6-module">ESM</a> (and <a href="https://antfu.me/posts/move-on-to-esm-only">ESM only</a>)</li>
<li>Built as an <a href="https://caniuse.com/es6-module">ES6 module</a> (and <a href="https://antfu.me/posts/move-on-to-esm-only">ESM only</a>)</li>
<li>Includes an interactive demo <em>(you&apos;re looking at it)</em>.</li>
</ul>
<h2>Installation</h2>
<p>
Browser
<ul>
<li>Download <a href="/dist-browser/twtxt-lib.js">library</a> (or
<a href="/dist-browser/twtxt-lib.min.js">minified version</a>).</li>
<li>Import desired function(s) into your project: `import { hashTwt, loadAndParseTwtxtFile } from "./twtxt-lib.js"`</li>
</ul>
</p>
<p>
JSR
<ul>
<li>Coming soon</li>
</ul>
</p>
<p>
NPM
<ul>
<li>Coming soon</li>
</ul>
</p>
<p>This library can be installed in several different ways:</p>
<h3>For the Browser</h3>
<ol>
<li>
Grab the latest copy of the <code>twtxt-lib.js</code> file, either by
downloading it from the
<a href="https://git.itsericwoodward.com/eric/twtxt-lib/raw/branch/main/dist-browser/twtxt-lib.js">git
repo</a>, the
<a href="/dist-browser/twtxt-lib.js">website</a>, or doing a
<code>git clone https://git.itsericwoodward.com/eric/twtxt-lib.git</code>
and pulling it out of the <code>dist-browser</code> folder.
<ul>
<li>
Alternatively, you can grab the minified version from the
<a href="https://git.itsericwoodward.com/eric/twtxt-lib/raw/branch/main/dist-browser/twtxt-lib.min.js">same</a>
<a href="https://twtxt-lib.itsericwoodward.com/dist-browser/twtxt-lib.min.js">sources</a>.
</li>
</ul>
</li>
<li>
Add the newly acquired file to your static site / progressive web app /
over-engineered blog.
</li>
<li>
Import the desired function(s) via ESM:
<code>import { hashTwt, loadAndParseTwtxtFile } from "./twtxt-lib.js";</code>
</li>
</ol>
<h3>For Node</h3>
<ol>
<li>
Add the package to your project.
<ul>
<li>
Via <a href="https://www.npmjs.com/package/twtxt-lib">NPM</a>:
<code>yarn add twtxt-lib</code>
</li>
<li>
Via <a href="https://jsr.io/@itsericwoodward/twtxt-lib">JSR</a>:
<code>yarn add jsr:@itsericwoodward/twtxt-lib</code>
</li>
</ul>
</li>
<li>
Import the desired function(s) into your code:
<code>import { hashTwt, loadAndParseTwtxtFile } from "twtxt-lib";</code>
</li>
</ol>
<p>Use the tabs to learn more.</p>