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 🙏

© 2024 – Pkg Stats / Ryan Hefner

@timkendrick/monaco-editor-loader

v0.0.7

Published

Webpack loader for the Monaco editor

Downloads

15

Readme

@timkendrick/monaco-editor-loader

npm version Stability

Webpack loader for the Monaco editor

Installation

npm install @timkendrick/monaco-editor-loader --save-dev

Usage

This loader allows you to create a Monaco editor build with arbitrary extensions enabled, as well as optionally bundling web worker scripts into the main output.

See the @timkendrick/monaco-editor repository for a real-life example.

Scenario 1: Serving worker scripts separately (requires external server):

{
  loader: '@timkendrick/monaco-editor-loader',
  options: {
    modules: [
      {
        name: 'vs',
        root: 'path/to/vscode/src',
      },
      {
        name: 'vs/extension/name',
        root: 'path/to/extension/src',
        main: 'monaco.contribution',
        include: true,
      },
      {
        name: 'vs/library/name',
        root: 'path/to/library/src',
        main: 'monaco.contribution',
      },
    ],
    workers: [
      {
        name: 'workerMain.js',
        main: 'path/to/worker/main.ts',
        includes: [
          'path/to/first/worker/service.ts',
          'path/to/second/worker/service.ts',
        ],
      },
    ],
  },
}

In the above example, the compilation emits additional worker scripts that are loaded at runtime from the webpack publicPath directory.

This directory can be overridden at runtime by specifying the MonacoEnvironment.baseUrl global variable before the bundle script is loaded:

<script>
  window.MonacoEnvironment = {
    baseUrl: 'path/to/worker/scripts'
  };
</script>
<script src="monaco/index.js"></script>

Scenario 2: Bundling worker scripts into main output file (no additional server required):

{
  loader: '@timkendrick/monaco-editor-loader',
  options: {
    workerOptions: {
      inline: true,
    },
    modules: [
      {
        name: 'vs',
        root: 'path/to/vscode/src',
      },
      {
        name: 'vs/extension/name',
        root: 'path/to/extension/src',
        main: 'monaco.contribution',
        include: true,
      },
      {
        name: 'vs/library/name',
        root: 'path/to/library/src',
        main: 'monaco.contribution',
      },
    ],
    workers: [
      {
        name: 'workerMain.js',
        main: 'path/to/worker/main.ts',
        includes: [
          'path/to/first/worker/service.ts',
          'path/to/second/worker/service.ts',
        ],
      },
    ],
  },
}

In the above example, worker scripts will be embedded within the main output bundle.

Loader options

| Name | Type | Required | Default | Description | | ----- | ---- | -------- | ------- | ----------- | | modules | Array<ModuleDefinition> | No | [] | Paths to Monaco AMD module definition files | | workers | Array<WorkerDefinition> | No | [] | Worker modules to be included in the compiled output | | workerOptions | object | No | {} | Configuration options for worker scripts | | workerOptions.inline | boolean | No | false | Whether to bundle worker scripts into the main bundle | | workerOptions.filename | string | No | "[hash].worker.js" | Filename template for worker scripts | | workerOptions.baseUrl | string | No | webpack publicPath | Base URL from which to load worker scripts at runtime |

ModuleDefinition

| Name | Type | Required | Default | Description | | ----- | ---- | -------- | ------- | ----------- | | name | string | Yes | N/A | Visual Studio extension name | | root | string | Yes | N/A | Path to extension source files | | main | string | No | undefined | Path to extension entry point file, relative to root | | include | boolean | No | false | Whether to include extension entry point in output bundle |

WorkerDefinition

| Name | Type | Required | Default | Description | | ----- | ---- | -------- | ------- | ----------- | | name | string | Yes | N/A | Name of worker output script | | main | string | Yes | N/A | Path to worker entry point file | | includes | Array<string> | No | [] | List of additional service entry point files to bundle into worker script |