or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

docs

build-utilities.mdcli-tool.mdextension-configuration.mdindex.mdwebpack-plugins.md
tile.json

tessl/npm-jupyterlab--builder

JupyterLab extension builder providing webpack-based compilation and build tools for JupyterLab extensions

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
npmpkg:npm/@jupyterlab/builder@4.4.x

To install, run

npx @tessl/cli install tessl/npm-jupyterlab--builder@4.4.0

index.mddocs/

JupyterLab Builder

JupyterLab Builder is a comprehensive build toolchain specifically designed for compiling and building JupyterLab extensions. It provides webpack-based build infrastructure with TypeScript compilation, asset processing, module federation, and custom plugins for the JupyterLab ecosystem.

Package Information

  • Package Name: @jupyterlab/builder
  • Package Type: npm
  • Language: TypeScript
  • Installation: npm install @jupyterlab/builder
  • Environment: Node.js only (not browser-compatible)

Core Imports

import { Build, WPPlugin } from "@jupyterlab/builder";

For CommonJS:

const { Build, WPPlugin } = require("@jupyterlab/builder");

For extension configuration:

import generateConfig from "@jupyterlab/builder/lib/extensionConfig";

Basic Usage

import { Build, WPPlugin } from "@jupyterlab/builder";
import * as webpack from "webpack";

// Ensure extension assets are available
const themeConfigs = Build.ensureAssets({
  output: "./build",
  packageNames: ["@my-org/my-extension"],
  schemaOutput: "./schemas",
  themeOutput: "./themes"
});

// Use custom webpack plugins
const plugins = [
  new WPPlugin.FrontEndPlugin("./build", "./static"),
  new WPPlugin.JSONLicenseWebpackPlugin()
];

// Create webpack configuration
const compiler = webpack(themeConfigs.concat({
  plugins,
  // ... other webpack config
}));

Architecture

JupyterLab Builder is built around several key components:

  • Build Utilities (Build namespace): Core functions for asset management and extension metadata handling
  • Webpack Plugins (WPPlugin namespace): Custom webpack plugins for JupyterLab-specific build tasks
  • Extension Configuration: Automated webpack configuration generation for extensions
  • CLI Tool: Command-line interface for building extensions from the command line
  • Module Federation: Integration with webpack's module federation for extension isolation

The build system leverages webpack 5's module federation to ensure extensions can be loaded dynamically while sharing common dependencies with the core JupyterLab application.

Capabilities

Build Utilities

Core build functionality for managing JupyterLab extension assets, including schema copying, theme processing, and extension metadata normalization.

namespace Build {
  function ensureAssets(options: IEnsureOptions): webpack.Configuration[];
  function normalizeExtension(module: IModule): ILabExtension;
  
  interface IEnsureOptions {
    output: string;
    schemaOutput?: string;
    themeOutput?: string;
    packageNames: ReadonlyArray<string>;
    packagePaths?: ReadonlyArray<string>;
  }
  
  interface ILabExtension {
    readonly extension?: boolean | string;
    readonly mimeExtension?: boolean | string;
    readonly schemaDir?: string;
    readonly themePath?: string;
  }
  
  interface IModule {
    jupyterlab?: ILabExtension;
    main?: string;
    name: string;
  }
}

Build Utilities

Webpack Plugins

Custom webpack plugins designed for JupyterLab extension building, including asset copying, license reporting, and build optimization.

namespace WPPlugin {
  class FrontEndPlugin {
    constructor(buildDir: string, staticDir: string);
    apply(compiler: webpack.Compiler): void;
  }
  
  class JSONLicenseWebpackPlugin extends LicenseWebpackPlugin {
    constructor(pluginOptions?: PluginOptions);
    renderLicensesJSON(modules: LicenseIdentifiedModule[]): string;
  }
  
  class FilterWatchIgnorePlugin {
    constructor(ignored: (path: string) => boolean);
    apply(compiler: webpack.Compiler): void;
  }
  
  class NowatchDuplicatePackageCheckerPlugin extends DuplicatePackageCheckerPlugin {
    constructor(options: DuplicatePackageCheckerPlugin.Options);
    apply(compiler: webpack.Compiler): void;
  }
  
  const DEFAULT_LICENSE_REPORT_FILENAME: "third-party-licenses.json";
}

Webpack Plugins

Extension Configuration

Automated webpack configuration generation for JupyterLab extensions with module federation, shared dependencies, and asset processing.

interface IOptions {
  packagePath?: string;
  corePath?: string;
  staticUrl?: string;
  mode?: 'development' | 'production';
  devtool?: string;
  watchMode?: boolean;
}

function generateConfig(options?: IOptions): webpack.Configuration[];

Extension Configuration

Command Line Interface

Command-line tool for building JupyterLab extensions with development and production modes.

build-labextension [options] <extensionPath>

CLI Tool