npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@osdk/widget.vite-plugin

v3.54.0

Published

A vite plugin that will extract parameter definitions from TS/JS files + entrypoint info into a manifest file to be uploaded to Foundry

Downloads

14,262

Readme

@osdk/widget.vite-plugin

This is a Vite plugin that will automatically discover *.config.(j|t)s files that are imported into entrypoint files and generates a .palantir/widgets.config.json file for Foundry to read from. This allows developers to write out their configuration for custom widgets in Foundry in a single, type-safe file and not worry about generating a manifest file needed for publishing new versions of the widget within Foundry.

Usage

To use the plugin, add it to the plugins list of your vite configuration:

import foundryWidgetPlugin from "@osdk/widget.vite-plugin";
import { defineConfig } from "vite";

export default defineConfig({
  plugins: [foundryWidgetPlugin()],
  // Rest of configuration...
});

Defining configuration

The @osdk/widget.client package exports a defineConfig helper so that you can define a configuration object in the shape that this plugin requires. You can define your config like so:

// main.config.ts
import { defineConfig } from "@osdk/widget.client";

export default defineConfig({
  id: "<Widget ID>", // The unique identifier of the widget within your project
  name: "<Widget Name>", // A user friendly name for your widget
  description: "<Widget Description>", // A user friendly description of your widget
  type: "workshop",
  parameters: {
    headerText: {
      displayName: "Widget title",
      type: "string",
    },
    showWarning: {
      displayName: "Show warning callout",
      type: "boolean",
    },
    todoItems: {
      displayName: "Todo items",
      type: "array",
      subType: "string",
    },
  },
  events: {
    updateHeader: {
      displayName: "Update header",
      parameterUpdateIds: ["headerText"],
    },
    updateTodoItems: {
      displayName: "Update todo items",
      parameterUpdateIds: ["todoItems"],
    },
  },
});

To be able to build your manifest and run developer mode, we require some configuration for your target widget set, and the stack you'll be deploying to. This plugin requires a foundry.config.json file to be present containing this information (auto-generated when using @osdk/create-widget), like so:

{
  "foundryUrl": "https://{YOUR_STACK_URL}",
  "widgetSet": {
    "rid": "{YOUR_WIDGET_SET_RID}"
    // Rest of config
  }
}

Importing the configuration

Import your *.config.ts file in any entrypoint JavaScript/TypeScript file so the plugin can pick it up. Entrypoint files are any that are imported from your root HTML file. For example, if you have the following setup:

src/
  main.tsx
  main.config.ts
index.html

And in index.html, you import main.tsx:

<!doctype html>
<html lang="en">
  <!-- rest of HTML -->
  <body>
    <!-- rest of body -->
    <script type="module" src="/src/main.tsx"></script>
  </body>
</html>

Import your configuration file in src/main.tsx so the vite plugin will discover it:

import { FoundryWidget } from "@osdk/widget.client-react";
import React from "react";
import { createRoot } from "react-dom/client";
import { Widget } from "./Widget.js";
import MainConfig from "./main.config.js";

const root = document.querySelector("body")!;
createRoot(root).render(
  <FoundryWidget config={MainConfig}>
    <Widget />
  </FoundryWidget>
);

Then the vite plugin will automatically find src/main.config.ts file and produce a .palantir/widgets.config.json file in the configured output directory of your vite config. If you don't actually need the config object in your code, you can also just have a simple import statement like import "./main.config.js"; so that the plugin can find it.

Multiple entrypoints

You can configure vite and this plugin to output multiple widgets simultaneously. Vite's entrypoints are based on HTML files, so to add more entrypoints, first add another HTML file:

src/
  main.tsx
  main.config.ts
  second.tsx        // Imported by second.html
  second.config.ts  // Imported by second.tsx
index.html
second.html         // Second entrypoint

And then in your vite config, you will need to configure the build.rollupOptions.input option to discover both entrypoints:

import foundryWidgetPlugin from "@osdk/widget.vite-plugin";
import { defineConfig } from "vite";

export default defineConfig({
  plugins: [foundryWidgetPlugin()],
  build: {
    rollupOptions: {
      input: ["./index.html", "./second.html"],
    },
  },
});

This vite plugin will then discover both entrypoints and output a combined .palantir/widget.config.json file such as:

{
  "manifestVersion": "1.0.0",
  "widgetSet": {
    "rid": "ri.widgetregistry..widget-set.abc",
    "version": "0.0.0",
    "widgets": {
      "main": {
        "entrypointJs": ["assets/main-D7Z1E0qk.js"],
        "entrypointCss": []
        // Rest of config
      },
      "second": {
        "entrypointJs": ["assets/second-CULz-_Ck.js"],
        "entrypointCss": []
        // Rest of config
      }
    }
  }
}

Developer mode

The vite plugin also automatically configures developer mode so that you can preview the changes you make locally live on your Foundry environment. For developer mode to work, make sure you set a FOUNDRY_TOKEN environment variable that has a token with access to your Foundry stack.