resolve issue with missing vite-plugin-node-polyfills

add LibreJS licenses to all demo JS
split browser build from node build
add copyright info to license files
update to use yarn v4.13.0
update to v0.9.2
This commit is contained in:
2026-03-07 20:47:14 -05:00
parent 475fcf6331
commit 1c06197be0
51 changed files with 259 additions and 56 deletions

View File

@@ -1,6 +1,10 @@
// @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt
document.addEventListener("DOMContentLoaded", () => {
// add default #overview route
if (!window.location.hash) {
window.location.hash = "overview";
}
});
// @license-end

View File

@@ -0,0 +1,7 @@
// @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt
const isGecko = !!navigator.userAgent.match(/gecko/i);
if (isGecko) document.body.classList.add("isGecko");
// @license-end

View File

@@ -1,3 +1,5 @@
// @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt
document.addEventListener("DOMContentLoaded", () => {
const currentHost = window.location.hostname;
@@ -10,3 +12,5 @@ document.addEventListener("DOMContentLoaded", () => {
}
});
});
// @license-end

View File

@@ -1,3 +1,5 @@
// @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt
export default function formatSource(source, panelId) {
source = (source ?? "").trim();
@@ -42,3 +44,5 @@ export default function formatSource(source, panelId) {
.getElementById(panelId)
.insertAdjacentHTML("beforeend", sourceHTML);
}
// @license-end

View File

@@ -1,3 +1,5 @@
// @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt
import { hashTwt } from "/dist-browser/twtxt-lib.js";
let wasHashTwtResultAppended = false;
@@ -61,3 +63,5 @@ formHash.addEventListener("submit", (e) => {
document.body.classList.add("isLoaded");
wasHashTwtResultAppended = true;
});
// @license-end

View File

@@ -1,3 +1,5 @@
// @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt
import formatSource from "./format-source.js";
formatSource(
@@ -38,3 +40,5 @@ formatSource(
`,
"tabHashTwt-panel",
);
// @license-end

View File

@@ -1,3 +1,5 @@
// @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt
import { loadAndParseTwtxtFile } from "/dist-browser/twtxt-lib.js";
const tabLoadAndParsePanel = document.getElementById("tabLoadAndParse-panel");
@@ -77,3 +79,5 @@ const loadAndParseClickHandler = (ev) => {
.getElementById(curr)
.addEventListener("click", loadAndParseClickHandler);
});
// @license-end

View File

@@ -1,3 +1,5 @@
// @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt
import formatSource from "./format-source.js";
formatSource(
@@ -23,3 +25,5 @@ formatSource(
`,
"tabLoadAndParse-panel",
);
// @license-end

View File

@@ -1,3 +1,5 @@
// @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt
import { loadAndParseTwtxtFile } from "/dist-browser/twtxt-lib.js";
// run in an IIFE (or event listener) to avoid issues with top-level await
@@ -34,3 +36,5 @@ import { loadAndParseTwtxtFile } from "/dist-browser/twtxt-lib.js";
console.error(err);
}
})();
// @license-end

View File

@@ -1,3 +1,5 @@
// @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt
import formatSource from "./format-source.js";
formatSource(
@@ -22,3 +24,5 @@ formatSource(
`,
"tabOverview-example",
);
// @license-end

View File

@@ -1,3 +1,5 @@
// @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt
import { parseTwtxt } from "/dist-browser/twtxt-lib.js";
const tabParsePanel = document.getElementById("tabParse-panel");
@@ -74,3 +76,5 @@ const parseClickHandler = (ev) => {
.addEventListener("click", parseClickHandler);
},
);
// @license-end

View File

@@ -1,3 +1,5 @@
// @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt
import formatSource from "./format-source.js";
formatSource(
@@ -25,3 +27,5 @@ formatSource(
`,
"tabParse-panel",
);
// @license-end

View File

@@ -365,24 +365,37 @@ body:not(:has(:target)) #tabOverview-link {
margin-top: -4.55rem;
}
.tab:target .tab-panel {
position: absolute;
z-index: 1;
}
body:not(:has(:target)) #tabOverview-panel {
display: block;
position: absolute;
z-index: 1;
}
.themeToggle-button {
bottom: auto;
position: absolute;
right: 1rem;
top: 1rem;
}
body:not(:has(:target)) #tabOverview-panel {
display: block;
position: absolute;
z-index: 1;
}
body.isGecko .tab-link {
margin-top: -4.65rem;
}
body.isGecko .tab-link:hover {
margin-top: -4.9rem;
}
body.isGecko .tab:target .tab-link,
body.isGecko .tab:target .tab-link:hover {
margin-top: -4.85rem;
}
}
/** State-Based Overrides */

View File

@@ -1,3 +1,5 @@
// @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt
document.addEventListener("DOMContentLoaded", () => {
const toggle = document.createElement("button");
@@ -27,3 +29,5 @@ document.addEventListener("DOMContentLoaded", () => {
document.body.appendChild(toggle);
});
// @license-end

5
dist-demo/dist-browser/browser.d.ts vendored Normal file
View File

@@ -0,0 +1,5 @@
export type * from './types.ts';
export { default as hashTwt } from './hashTwt.ts';
export { default as loadAndParseTwtxtFile } from './loadAndParseTwtxt.ts';
export { default as parseTwtxt } from './parseTwtxt.ts';
export { base32Encode } from './utils.ts';

View File

@@ -1,4 +1,10 @@
// @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt
/*
* twtxt-lib
* https://twtxt-lib.itsericwoodward.com/
* Copyright (c) 2026 Eric Woodward
* Released under the MIT License
*/
var __defProp = Object.defineProperty;
var __defProps = Object.defineProperties;
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
@@ -2894,7 +2900,6 @@ const base32Encode = (payload) => {
return encoder.write(payload).finalize();
};
const getValueOrFirstEntry = (value) => Array.isArray(value) && value.length ? value[0] : value;
globalThis.Buffer = Buffer$1;
const dateRegex = /^(\d{4})-(\d{2})-(\d{2})([tT ])(\d{2}):(\d{2}):(\d{2})\.?(\d{3})?(?:(?:([+-]\d{2}):?(\d{2}))|Z)?$/;
const formatRFC3339 = (date) => {
const pad = (num = 0) => `${+num < 10 ? 0 : ""}${+num}`;
@@ -3391,6 +3396,7 @@ function loadAndParseTwtxtFile(url = "") {
}
});
}
globalThis.Buffer = Buffer$1;
export {
base32Encode,
hashTwt,

File diff suppressed because one or more lines are too long

View File

@@ -1,4 +1,10 @@
// @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt
/*
* twtxt-lib
* https://twtxt-lib.itsericwoodward.com/
* Copyright (c) 2026 Eric Woodward
* Released under the MIT License
*/
var er = Object.defineProperty, nr = Object.defineProperties;
var ir = Object.getOwnPropertyDescriptors;
var _t = Object.getOwnPropertySymbols;
@@ -1847,9 +1853,7 @@ function br() {
})(kt)), kt;
}
var Br = br();
const Er = /* @__PURE__ */ Mt(Br), Ir = (f) => new Er.Encoder({ type: "rfc4648" }).write(f).finalize(), $r = (f) => Array.isArray(f) && f.length ? f[0] : f;
globalThis.Buffer = yr;
const Fr = /^(\d{4})-(\d{2})-(\d{2})([tT ])(\d{2}):(\d{2}):(\d{2})\.?(\d{3})?(?:(?:([+-]\d{2}):?(\d{2}))|Z)?$/, Ur = (f) => {
const Er = /* @__PURE__ */ Mt(Br), Ir = (f) => new Er.Encoder({ type: "rfc4648" }).write(f).finalize(), $r = (f) => Array.isArray(f) && f.length ? f[0] : f, Fr = /^(\d{4})-(\d{2})-(\d{2})([tT ])(\d{2}):(\d{2}):(\d{2})\.?(\d{3})?(?:(?:([+-]\d{2}):?(\d{2}))|Z)?$/, Ur = (f) => {
const l = (p = 0) => `${+p < 10 ? 0 : ""}${+p}`, x = (p = 0) => `${+p < 1e3 ? 0 : ""}${+p < 100 ? 0 : ""}${+p < 10 ? 0 : ""}${+p}`;
let d = Fr.exec(f);
d && (d == null ? void 0 : d[9]) === void 0 && (d[9] = "+00"), d && (d == null ? void 0 : d[10]) === void 0 && (d[10] = "00");
@@ -2308,6 +2312,7 @@ function te(f = "") {
}
});
}
globalThis.Buffer = yr;
export {
Ir as base32Encode,
Ar as hashTwt,

File diff suppressed because one or more lines are too long

View File

@@ -318,9 +318,10 @@
</ul>
<script src="/dist-browser/twtxt-lib.js" type="module"></script>
<script src="/demo/theme-toggle.js" type="module"></script>
<script src="/demo/external-links.js" type="module"></script>
<script src="/demo/add-default-route.js" type="module"></script>
<script src="/demo/browser-detection.js" type="module"></script>
<script src="/demo/external-links.js" type="module"></script>
<script src="/demo/theme-toggle.js" type="module"></script>
<script src="/demo/overview-example-source.js" type="module"></script>
<script src="/demo/overview-example-result.js" type="module"></script>
<script src="/demo/hashTwt-example-source.js" type="module"></script>