diff options
| author | Igor Soarez <igor@soarez.org> | 2026-10-25 20:03:05 +0000 |
|---|---|---|
| committer | Igor Soarez <igor@soarez.org> | 2026-10-25 20:03:05 +0000 |
| commit | 1062478e81a49f19537c2610d8f1b25e2054d6fa (patch) | |
| tree | d093b3092b1a453913cada45ae2a93f56851ff5d | |
| parent | 7a9ef1f9704fe724409f4d9002474049ca0776d0 (diff) | |
pirc-extension 0.1.9-dev+69800ee67711
| -rw-r--r-- | README.md | 3 | ||||
| -rw-r--r-- | loader.js | 15 | ||||
| -rw-r--r-- | package.json | 4 | ||||
| -rw-r--r-- | pirc.js (renamed from index.js) | 6 |
4 files changed, 22 insertions, 6 deletions
@@ -7,7 +7,8 @@ client. You need a relay of your own; PiRC's self-hosting guide covers running one. This repository holds releases only: the extension built into one file -(`index.js`). Its source is in PiRC's repository. +(`pirc.js`), and `loader.js`, which loads it. Its source is in PiRC's +repository. ## Install diff --git a/loader.js b/loader.js new file mode 100644 index 0000000..247724f --- /dev/null +++ b/loader.js @@ -0,0 +1,15 @@ +// The published extension's entry point. pi's /reload imports the +// extension again, but Node keeps every JavaScript module it has imported, +// so a bundle updated in place would not run until pi restarted. This file +// imports the bundle beside it by a URL that changes when the file does, +// so a reload after an update runs the new code, and is the same in every +// version, so that its own copy, which Node keeps, is never stale. Not +// index.js: versions before it had their bundle there, which Node would +// still hold after updating from one of them. +import { statSync } from "node:fs"; + +export default async function (pi) { + const bundle = new URL("./pirc.js", import.meta.url); + const { default: factory } = await import(`${bundle.href}?t=${statSync(bundle).mtimeMs}`); + return factory(pi); +} diff --git a/package.json b/package.json index 6e3d708..1b03009 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "pirc-extension", - "version": "0.1.9-dev+3bc256ad5274", + "version": "0.1.9-dev+69800ee67711", "description": "PiRC: puts every interactive pi session on a PiRC relay", "license": "MIT", "homepage": "https://pirc.dev", @@ -10,7 +10,7 @@ ], "pi": { "extensions": [ - "./index.js" + "./loader.js" ] }, "peerDependencies": { @@ -1,4 +1,4 @@ -// PiRC extension 0.1.9-dev+3bc256ad5274. Third-party code in this file: @bufbuild/protobuf@2.16.0, ws@8.22.0; see NOTICE. +// PiRC extension 0.1.9-dev+69800ee67711. Third-party code in this file: @bufbuild/protobuf@2.16.0, ws@8.22.0; see NOTICE. import { createRequire as __pircCreateRequire } from "node:module"; const require = __pircCreateRequire(import.meta.url); var __create = Object.create; @@ -8717,7 +8717,7 @@ function requestIdOf(m) { } // extension/src/index.ts -var EXTENSION_VERSION = true ? "0.1.9-dev+3bc256ad5274" : "dev"; +var EXTENSION_VERSION = true ? "0.1.9-dev+69800ee67711" : "dev"; function piVersion() { try { let dir = dirname3(realpathSync(process.argv[1])); @@ -8732,7 +8732,7 @@ function piVersion() { } return "unknown"; } -var LOAD = true ? "0.1.9-dev+3bc256ad5274" : `dev ${randomBytes3(4).toString("hex")}`; +var LOAD = true ? "0.1.9-dev+69800ee67711" : `dev ${randomBytes3(4).toString("hex")}`; var KEY = /* @__PURE__ */ Symbol.for("pirc.extension"); var proc = globalThis[KEY] ??= {}; if (!proc.host || proc.load !== LOAD) { |
