@crxjs/vite-plugin 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +74 -0
- package/client.d.ts +59 -0
- package/dist/index.cjs +3328 -0
- package/dist/index.d.ts +255 -0
- package/dist/index.mjs +3291 -0
- package/manifest.schema.json +15 -0
- package/package.json +126 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2019 jacksteamdev
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
# [rollup-plugin-chrome-extension](https://www.extend-chrome.dev/rollup-plugin)
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/rollup-plugin-chrome-extension)
|
|
4
|
+
[](https://github.com/crxjs/rollup-plugin-chrome-extension)
|
|
5
|
+

|
|
6
|
+
[](#typescript)
|
|
7
|
+
|
|
8
|
+
<a href="https://www.extend-chrome.dev/rollup-plugin" rel="noopener">
|
|
9
|
+
<img width=200px height=200px src="https://imgur.com/wEXnCYK.png" alt="rollup-plugin-chrome-extension logo"></a>
|
|
10
|
+
|
|
11
|
+
The bundler configuration for a Chrome Extension can be pretty complex. This
|
|
12
|
+
plugin makes it simple.
|
|
13
|
+
|
|
14
|
+
The manifest is front and center. Import your manifest to your config file and
|
|
15
|
+
RPCE will do the rest.
|
|
16
|
+
|
|
17
|
+
RPCE simplifies project config and supports many of Vite's features in the
|
|
18
|
+
Chrome Extension environment, including HMR.
|
|
19
|
+
|
|
20
|
+
## Vite Usage (beta)
|
|
21
|
+
|
|
22
|
+
Vite support is in beta! Check out this
|
|
23
|
+
[90 second getting started guide](https://dev.to/jacksteamdev/create-a-vite-react-chrome-extension-in-90-seconds-3df7).
|
|
24
|
+
|
|
25
|
+
```sh
|
|
26
|
+
npm i rollup-plugin-chrome-extension@beta -D
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
```javascript
|
|
30
|
+
// vite.config.js
|
|
31
|
+
|
|
32
|
+
import { defineConfig } from 'vite'
|
|
33
|
+
import react from '@vitejs/plugin-react'
|
|
34
|
+
import { crx } from 'rollup-plugin-chrome-extension'
|
|
35
|
+
import manifest from './manifest.json'
|
|
36
|
+
|
|
37
|
+
export default defineConfig({
|
|
38
|
+
plugins: [react(), crx({ manifest })],
|
|
39
|
+
})
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
Just add new features to your manifest, and RPCE does the rest.
|
|
43
|
+
|
|
44
|
+
## [Documentation for v3](https://www.extend-chrome.dev/rollup-plugin)
|
|
45
|
+
|
|
46
|
+
We have
|
|
47
|
+
[v3 boilerplates](https://www.extend-chrome.dev/rollup-plugin#chrome-extension-boilerplates)
|
|
48
|
+
for [React JavaScript](https://github.com/crxjs/js-react-boilerplate),
|
|
49
|
+
[React TypeScript](https://github.com/crxjs/ts-react-boilerplate) and
|
|
50
|
+
[Svelte](https://github.com/kyrelldixon/svelte-tailwind-extension-boilerplate),
|
|
51
|
+
as well as [instructions](https://www.extend-chrome.dev/rollup-plugin#usage) for
|
|
52
|
+
setting up your project.
|
|
53
|
+
|
|
54
|
+
See the [documentation](https://www.extend-chrome.dev/rollup-plugin) for usage
|
|
55
|
+
and how to get started.
|
|
56
|
+
|
|
57
|
+
## Contributing
|
|
58
|
+
|
|
59
|
+
Your help is super welcome!
|
|
60
|
+
|
|
61
|
+
🎯 Ongoing development is for v4+ only.
|
|
62
|
+
|
|
63
|
+
👀 Be sure to take a look at the issues before starting to work on a new
|
|
64
|
+
feature.
|
|
65
|
+
|
|
66
|
+
🙏 Please update the tests to cover bug fixes or new features.
|
|
67
|
+
|
|
68
|
+
📕 Documentation for v4 has not yet begun, but you can open an issue for help.
|
|
69
|
+
|
|
70
|
+
✨ If you enjoy using RPCE, please help spread the word!
|
|
71
|
+
|
|
72
|
+
## Development
|
|
73
|
+
|
|
74
|
+
This monorepo uses [pnpm](https://pnpm.io/).
|
package/client.d.ts
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
declare module '*?script' {
|
|
2
|
+
/**
|
|
3
|
+
* Alias for `*?script&loader`.
|
|
4
|
+
*
|
|
5
|
+
* Script format is ESM. Loaded via dynamic import script. Supports HMR. Use
|
|
6
|
+
* with the Chrome Scripting API inside of the background service worker or an
|
|
7
|
+
* extension page.
|
|
8
|
+
*
|
|
9
|
+
* Exports the file name of the loader script file.
|
|
10
|
+
*
|
|
11
|
+
* If imported inside a content script, RPCE will include the file name in
|
|
12
|
+
* `web_accessible_resources`.
|
|
13
|
+
*/
|
|
14
|
+
const fileName: string
|
|
15
|
+
export default fileName
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
declare module '*?script&loader' {
|
|
19
|
+
/**
|
|
20
|
+
* Script format is ESM. Loaded via dynamic import script. Supports HMR. Use
|
|
21
|
+
* with the Chrome Scripting API inside of the background service worker or an
|
|
22
|
+
* extension page.
|
|
23
|
+
*
|
|
24
|
+
* Exports the file name of the loader script file.
|
|
25
|
+
*
|
|
26
|
+
* If imported inside a content script, RPCE will include the file name in
|
|
27
|
+
* `web_accessible_resources`.
|
|
28
|
+
*/
|
|
29
|
+
const fileName: string
|
|
30
|
+
export default fileName
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
declare module '*?script&iife' {
|
|
34
|
+
/**
|
|
35
|
+
* Script format is IIFE. Use for content scripts with opaque origins.
|
|
36
|
+
*
|
|
37
|
+
* Exports the file name of the output script file.
|
|
38
|
+
*
|
|
39
|
+
* If imported inside a content script, RPCE will include the file name in
|
|
40
|
+
* `web_accessible_resources`.
|
|
41
|
+
*/
|
|
42
|
+
const fileName: string
|
|
43
|
+
export default fileName
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
declare module '*?script&module' {
|
|
47
|
+
/**
|
|
48
|
+
* Script format is ESM. No loader and no HMR. Does not support frameworks
|
|
49
|
+
* that use HMR. Import into a content script to inject via script tag into
|
|
50
|
+
* the host page main world execution environment.
|
|
51
|
+
*
|
|
52
|
+
* Exports the file name of the output script file.
|
|
53
|
+
*
|
|
54
|
+
* If imported inside a content script, RPCE will include the file name in
|
|
55
|
+
* `web_accessible_resources`.
|
|
56
|
+
*/
|
|
57
|
+
const fileName: string
|
|
58
|
+
export default fileName
|
|
59
|
+
}
|