@khorsheed/dsh-reader 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.en.md +90 -0
- package/README.i18n.yaml +6 -0
- package/README.md +90 -0
- package/cordis.patch.yml +13 -0
- package/lib/client.js +15119 -0
- package/lib/index.js +3660 -0
- package/lib/invariant.js +38 -0
- package/lib/typert.host.d.ts +3 -0
- package/lib/typert.host.js +1738 -0
- package/lib/typert.remote-client.d.ts +82 -0
- package/lib/typert.remote-client.js +1115 -0
- package/lib/types/arxiv.d.ts +47 -0
- package/lib/types/arxiv.js +76 -0
- package/lib/types/client/ReaderPane.d.ts +71 -0
- package/lib/types/client/ReaderPane.js +3135 -0
- package/lib/types/client/contract.d.ts +254 -0
- package/lib/types/client/contract.js +1 -0
- package/lib/types/client/definition.d.ts +27 -0
- package/lib/types/client/definition.js +32 -0
- package/lib/types/client/extract-article.d.ts +102 -0
- package/lib/types/client/extract-article.js +1024 -0
- package/lib/types/client/icons.d.ts +27 -0
- package/lib/types/client/icons.js +11 -0
- package/lib/types/client/index.d.ts +34 -0
- package/lib/types/client/index.js +222 -0
- package/lib/types/client/locales.d.ts +391 -0
- package/lib/types/client/locales.js +382 -0
- package/lib/types/client/parse-rss.d.ts +69 -0
- package/lib/types/client/parse-rss.js +656 -0
- package/lib/types/client/quote.d.ts +89 -0
- package/lib/types/client/quote.js +119 -0
- package/lib/types/client/selectors.d.ts +167 -0
- package/lib/types/client/selectors.js +413 -0
- package/lib/types/client/session.d.ts +171 -0
- package/lib/types/client/session.js +223 -0
- package/lib/types/client/store.d.ts +181 -0
- package/lib/types/client/store.js +226 -0
- package/lib/types/client/translate.d.ts +379 -0
- package/lib/types/client/translate.js +873 -0
- package/lib/types/index.d.ts +48 -0
- package/lib/types/index.js +25 -0
- package/lib/types/invariant.d.ts +29 -0
- package/lib/types/invariant.js +38 -0
- package/lib/types/link-resolvers.d.ts +107 -0
- package/lib/types/link-resolvers.js +299 -0
- package/lib/types/remote.d.ts +224 -0
- package/lib/types/remote.js +275 -0
- package/lib/types/schedule.d.ts +78 -0
- package/lib/types/schedule.js +114 -0
- package/lib/types/service.d.ts +633 -0
- package/lib/types/service.js +1697 -0
- package/lib/types/store.d.ts +224 -0
- package/lib/types/store.js +916 -0
- package/lib/types/types.d.ts +710 -0
- package/lib/types/types.js +182 -0
- package/locale/en.json +6 -0
- package/locale/zh.json +6 -0
- package/package.json +128 -0
package/lib/invariant.js
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
//#region lib/types/invariant.js
|
|
2
|
+
/**
|
|
3
|
+
* Package-owned invariant companion for `@khorsheed/dsh-reader`.
|
|
4
|
+
* @module @khorsheed/dsh-reader/invariant
|
|
5
|
+
*/
|
|
6
|
+
/** The identity the package publishes under (the manifest's `name`). */
|
|
7
|
+
const PACKAGE_NAME = "@khorsheed/dsh-reader";
|
|
8
|
+
/** Cordis companion plugin name. */
|
|
9
|
+
const name = "reader-invariant";
|
|
10
|
+
/** Service required before the companion can reserve package ownership. */
|
|
11
|
+
const inject = ["invariants"];
|
|
12
|
+
/**
|
|
13
|
+
* Capability probe for the reader: the host half fetches and persists, so it
|
|
14
|
+
* needs a runtime that has `URL` (for the source-URL policy) and a timer (for
|
|
15
|
+
* the daily refresh). Both are standard in a dsh host, so this is a
|
|
16
|
+
* low-value check — registered for package-ownership consistency, and kept
|
|
17
|
+
* pure (no network, no filesystem, no session) so a broken deployment is never
|
|
18
|
+
* reported as a healthy one and vice versa.
|
|
19
|
+
*
|
|
20
|
+
* @param _ctx - host context (unused; the probe touches process globals only).
|
|
21
|
+
* @param fail - invariant failure reporter.
|
|
22
|
+
*/
|
|
23
|
+
const install = async (_ctx, fail) => {
|
|
24
|
+
try {
|
|
25
|
+
if (typeof globalThis.URL !== "function") fail("reader requires a runtime with URL");
|
|
26
|
+
if (typeof globalThis.setTimeout !== "function") fail("reader requires a runtime with timers");
|
|
27
|
+
} catch {
|
|
28
|
+
fail("reader requires a standard node runtime");
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
/**
|
|
32
|
+
* Register this package's invariant companion.
|
|
33
|
+
* @param ctx - Cordis context carrying the invariant service.
|
|
34
|
+
* @returns the installed registration's disposer after setup succeeds.
|
|
35
|
+
*/
|
|
36
|
+
const apply = (ctx) => Promise.resolve(ctx.invariants.register(PACKAGE_NAME, install));
|
|
37
|
+
//#endregion
|
|
38
|
+
export { apply, inject, install, name };
|