JSPM

browser-extension-manifest-fields

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

Output a list of HTML, CSS, JavaScript, and static asset fields from a manifest.json file

Package Exports

  • browser-extension-manifest-fields
  • browser-extension-manifest-fields/dist/module.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 (browser-extension-manifest-fields) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

browser-extension-manifest-fields npm

Output file paths from fields declared in a browser extension manifest file.

Get all your HTML, JS and CSS (content_scripts) assets from your manifest, including scripts and CSS declared in HTML files.

Installation

npm i --save-dev browser-extension-manifest-fields

Usage

const manifestFields = require('browser-extension-manifest-fields')

// Sample manifest with workable fields
const manifestSample = {
  author: 'Cezar Augusto',
  background: {
    persistent: false,
    page: 'background/background.html' // Declares background.js via <script>
  },
  browser_action: {
    default_popup: 'popup/popup.html', // Declares popup.js via <script> and popup.css via <link>
    default_title: 'Test'
  },
  chrome_url_overrides: {
    newtab: 'overrides/newtab/newtab.html' // Declares newtab.js via <script> and newtab.css via <link>
  },
  content_scripts: [
    {
      css: ['content/content.css', 'content/content2.css'],
      js: ['content/content.js', 'content/content2.js']
    }
  ],
  devtools_page: 'devtools/devtools.html', // Declares devtools.js via <script> and devtools.css via <link>
  options_ui: {
    chrome_style: true,
    page: 'options/options.html' // Declares options.js via <script> and options.css via <link>
  }
}

console.log(manifestAssets)

Output

{
  html: [], // Array<[string, string]>;
  icons: [], // Array[any, string | string[] | { light: string; dark: string;}]>;
  locale: [], // string[];
  scripts: [], // Array<string, string | { js: string[]; css: string[]; }]>;
  webResources: [] // Array<string, (string | string[])[]]>;
}

License

MIT (c) Cezar Augusto.