Releases: crxjs/chrome-extension-tools
Supporting JSX and TSX as content scripts
This release adds support for content scripts in the manifest that end in .jsx
or .tsx
.
The "basic" test has also been renamed to "kitchen-sink", and new "basic-js" and "basic-ts" tests have been added to make it easier for contributors to make a PR.
Thanks to @ZakaryCode and @joegilley for their PRs pointing out the need for this feature!
- docs: tweak sh code blocks da0e502
- chore: sort package json 53b80dd
- tests: config jest to use better test runner 7bcd8c4
- chore: fix eslint config for extension fixtures 1cce902
- tests: add tests for react tsx content scripts 8bbbd85
- tests: add tests for react js content scripts 6ae10dd
- feat: support jsx/tsx as content script entries 3f4cd67
- tests: add basic ts test 8d48d15
- tests: add basic js test 4f65b8e
- tests: rename basic test to kitchen-sink 89738be
- Update README.md (#59) f443253
Minding our own business
Fixes a bug where rollup-plugin-chrome-extension
would throw an error during the generateBundle
hook if there were unresolved dependencies. Now Rollup will show the external dependencies message instead.
Naming chunks correctly
The last release broke chunk file names and paths for non-entry modules, removing subfolders and adding double hashes to output files. The manifest retained the expected file names, but the files were named incorrectly.
This release fixes that problem. We've added some tests to make sure that the file names in the manifest always match the output file names.
Adding browserPolyfill
This release has been a long time coming. It adds the option browserPolyfill
, which adds webextension-polyfill
to your Chrome extension. It also includes some improvements to the simpleReloader
and lays some groundwork for Firefox compatible builds.
Supporting options_ui
Thanks to @jones-sam for adding this feature and updating our Cheerio types!
Sending message responses
This release adds support to send a response to messages in the background page event wrapper. More info about this in #50
Supporting more input types and the WebRequest API
This release adds support for options.input
as an array and object, as well as fixes a bug in the background page import wrapper that was blocking use of the WebRequest API.
For now the new input type support is undocumented.
Thanks to @RoCat for the work on the WebRequest API!
Better dynamic import wrappers
This release adds two new dynamic import wrappers and refactors the old one.
Motivation
These wrappers are necessary because Rollup only supports ES6 modules when output.dir is used, which is necessary for this plugin to work the way that it does. Code splitting is also non-optional with output.dir. This means that we need all script environments to support ES6 modules.
However, in Chrome, background and content scripts do not support ES6 modules! They do support the dynamic import function, which allows us to async load modules into a script.
This introduces another complexity with non-persistent background pages. Events that wake the background page are fired at the end of first event loop, before the dynamic import completes. These import wrappers capture wake events and dispatch them after the dynamic import resolves.
Content Scripts
Content scripts now have their own import wrapper. It simply uses dynamic import to load the content script module and does nothing with events, since content scripts are always persistent.
Background Scripts
The new default import wrapper is the implicit import wrapper. It walks the chrome object and wraps any events that it finds. If your extension uses many permissions, the chrome object will have more namespaces, and it may take slightly more time (~15ms) to load the background page. Consider the following if 15ms is too much for you.
The old import wrapper is now the explicit import wrapper, and uses the same API as before. It is quite fast (~5ms), but wake events that are not defined in dynamicImportWrapper.wakeEvents will be lost. Symptoms of this would be things like having to click the browser action twice to register browserAction.onClicked, or missed events from alarms.onAlarm.
Pull Requests
- Update dynamic import wrappers 4b80336
RIP Push Reloader
This major version removes the FCM based push reloader.
- Fix reloader message formatting 04d461a
Fixing the simple reloader
This release fixes the simple reloader and removes the push reloader completely.