Home

Awesome

TypeScript Typings for PocketBase JSVM

This package provides TypeScript typings for the PocketBase JavaScript Virtual Machine (JSVM), based on Goja and Goja-Node.

Usage

Install the package:

npm install pocketbase-jsvm

For PocketBase version matching the package version:

In your tsconfig.json:

{
  "compilerOptions": {
    "types": ["pocketbase-jsvm"],
    "moduleResolution": "node"
  }
}

For Legacy PocketBase Versions or Specific Versions

For older PocketBase versions, use triple-slash directives instead of the types field:

/// <reference path="./node_modules/pocketbase-jsvm/index-v22.d.ts" />  // For v0.22

Important Notes

Example

// Using Goja-Node bindings
const myModule = require('myModule')
const apiKey = process.env.API_KEY

// ECMAScript 2020 features are supported
const myFunc = () => {
  // Your code here
}

Versioning Strategy

pocketbase-ejs uses Upstream Anchoring.

Example:

This keeps our fork aligned with upstream releases and allows us to manage our own revisions effectively.

Updating this fork

git fetch --all
git checkout main

Then, copy the latest jsvm.d.ts and update the version number using the Upstream Anchoring technique described above.