Node.js & npm Notice (since 0.11.1)
Now also published on npm .
Node.js support is experimental: I mainly target Deno and browsers, so I don't actively maintain Node.js compatibility. Some tests run, but there may still be runtime or type gaps remaining. Please use it with that understanding.
That said, issues / PRs to improve Node support are very welcome!
If you don't need a public npm package, you can consume the JSR version directly—
npm
via a custom registry in.npmrc
;yarn
orpnpm
need no extra config. See the JSR docs.
Type definitions for cosense
This library provides TypeScript type definitions for Scrapbox/Cosense and supports both JSR (JavaScript Registry) and npm installation methods.
If you want to use type definitions for REST API, run
deno add jsr:@cosense/types/rest
If you want to use type definitions for UserScript, run
deno add jsr:@cosense/types/userscript
Install via npm:
npm install @cosense/types
Import the library:
// ESM syntax import type { PageList } from "@cosense/types/rest"; import type { Scrapbox } from "@cosense/types/userscript";
// Example for JSR (Deno) import type { PageList } from "jsr:@cosense/types/rest"; const pages: PageList = { projectName: "example-project", skip: 0, limit: 100, count: 42, pages: [], };
For npm users:
// Example for npm (Node.js) import type { PageList } from "@cosense/types/rest"; import type { Scrapbox } from "@cosense/types/userscript"; // Use the types in your Node.js application const pageData: PageList = { projectName: "my-project", skip: 0, limit: 50, count: 10, pages: [], };