JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 21
  • Score
    100M100P100Q46908F
  • License MIT

A cli build tool for userscript

Package Exports

  • bocchi
  • bocchi/dist/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (bocchi) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

bocchi

A cli build tool for userscript

Install

# npm
npm i bocchi -D

# yarn
yarn add bocchi -D

# pnpm
pnpm i bocchi -D

Create with template

# npm
npm create bocchi-app <name>

# yarn
yarn create bocchi-app <name>

# pnpm
pnpm create bocchi-app <name>

Usage

  1. create meta.template
// ==UserScript==
// @name
// @namespace    #homepage#
// @version      #version#
// @description  #description#
// @author
// @match        https://example.com/*
// @grant        none
// @downloadURL
// @updateURL
// ==/UserScript==
  1. write entry src/index.(j|t)s
  2. add scripts to package.json
{
  "scripts": {
    "dev": "bocchi dev",
    "build": "bocchi build"
  }
}
  1. npm run dev for development, npm run build for bundle production

Feature

  1. package.json support rollup globals
{
  "globals": {
    "lodash": "window._"
  }
}
  1. support [name].template.html
<!-- file: [name].template.html -->
<template id="tmpId">
  <span>1</span>
</template>

<a id="anchorId"></a>
// file: index.js
import tmp from './[name].template.html'

console.log(tmp.tmpId) //=> <template id="tmpId">\n  <span>1</span>\n</template>
console.log(tmp.anchorId) //=> <a id="anchorId"></a>
  1. auto load postcss.config.js