& {
3 | __isCapturedEvent: boolean
4 | }
5 |
6 | export type LastError = chrome.runtime.LastError | undefined
7 |
--------------------------------------------------------------------------------
/packages/vite-plugin/tests/e2e/mv3-vite-vue-page/manifest.json:
--------------------------------------------------------------------------------
1 | {
2 | "manifest_version": 3,
3 | "options_page": "src/index.html",
4 | "background": {
5 | "service_worker": "src/background.js"
6 | },
7 | "name": "Vite Vue Page",
8 | "version": "0.0.1"
9 | }
10 |
--------------------------------------------------------------------------------
/packages/vite-plugin/tests/out/vite-dynamic-script-resources/src/background.ts:
--------------------------------------------------------------------------------
1 | import content1 from './content1.ts?script'
2 | import content2 from './content2.ts?script'
3 |
4 | chrome.scripting.executeScript({
5 | files: [content1, content2],
6 | target: { tabId: 1 },
7 | })
8 |
--------------------------------------------------------------------------------
/packages/vite-plugin/tests/e2e/mv3-vite-vue-page-hmr/manifest.json:
--------------------------------------------------------------------------------
1 | {
2 | "manifest_version": 3,
3 | "options_page": "src/index.html",
4 | "background": {
5 | "service_worker": "src/background.js"
6 | },
7 | "name": "Vite Vue Page",
8 | "version": "0.0.1"
9 | }
10 |
--------------------------------------------------------------------------------
/packages/vite-plugin/tests/out/basic-js/src/popup.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 | import ReactDOM from 'react-dom'
3 | import App from './App'
4 |
5 | console.log('popup script')
6 |
7 | const root = document.querySelector('#root')
8 |
9 | ReactDOM.render(, root)
10 |
--------------------------------------------------------------------------------
/packages/vite-plugin/tests/out/vite-dynamic-script-resources-minify/src/background.ts:
--------------------------------------------------------------------------------
1 | import content1 from './content1.ts?script'
2 | import content2 from './content2.ts?script'
3 |
4 | chrome.scripting.executeScript({
5 | files: [content1, content2],
6 | target: { tabId: 1 },
7 | })
8 |
--------------------------------------------------------------------------------
/packages/vite-plugin/tests/out/with-sourcemaps/src/popup.tsx:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 | import { render } from 'react-dom'
3 | import App from './App'
4 |
5 | console.log('popup script')
6 |
7 | const root = document.querySelector('#root')
8 |
9 | render(, root)
10 |
--------------------------------------------------------------------------------
/packages/vite-plugin/tests/out/basic-js/src/App.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 |
3 | const App = () => {
4 | return (
5 |
6 |
Popup Page
7 |
If you are seeing this, React is working!
8 |
9 | )
10 | }
11 |
12 | export default App
13 |
--------------------------------------------------------------------------------
/packages/rollup-plugin/__fixtures__/extensions/mv2-input-array/manifest.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "input-array",
3 | "description": "input-array chrome extension",
4 | "manifest_version": 2,
5 | "version": "0.1.0",
6 | "background": {
7 | "scripts": ["background.js"]
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/packages/rollup-plugin/__fixtures__/extensions/mv2-input-object/manifest.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "input-array",
3 | "description": "input-array chrome extension",
4 | "manifest_version": 2,
5 | "version": "0.1.0",
6 | "background": {
7 | "scripts": ["background.js"]
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/packages/rollup-plugin/__fixtures__/extensions/mv2-invalid-manifest/manifest.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "invalid-manifest",
3 | "description": "invalid-manifest chrome extension",
4 | "manifest_version": "B",
5 | "versionNumber": "0.1.0",
6 | "background": { "scripts": ["background.js"] }
7 | }
8 |
--------------------------------------------------------------------------------
/packages/rollup-plugin/__fixtures__/extensions/mv3-basic-ts/src/popup.tsx:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 | import { render } from 'react-dom'
3 | import App from './App'
4 |
5 | console.log('popup script')
6 |
7 | const root = document.querySelector('#root')
8 |
9 | render(, root)
10 |
--------------------------------------------------------------------------------
/packages/vite-plugin/tests/e2e/mv3-vite-vanilla-content-script-seq-hmr/src1/root.ts:
--------------------------------------------------------------------------------
1 | import { a } from './a'
2 |
3 | const root = new DOMParser().parseFromString(
4 | `${a}
`,
5 | 'text/html',
6 | ).body.firstElementChild as HTMLDivElement
7 |
8 | document.body.append(root)
9 |
--------------------------------------------------------------------------------
/packages/vite-plugin/tests/out/vite-self-directive-in-csp/src/popup.tsx:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 | import { render } from 'react-dom'
3 | import App from './App'
4 |
5 | console.log('popup script')
6 |
7 | const root = document.querySelector('#root')
8 |
9 | render(, root)
10 |
--------------------------------------------------------------------------------
/packages/rollup-plugin/__fixtures__/extensions/mv3-basic-js/src/popup.js:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 | import ReactDOM from 'react-dom'
3 | import App from './App'
4 |
5 | console.log('popup script')
6 |
7 | const root = document.querySelector('#root')
8 |
9 | ReactDOM.render(, root)
10 |
--------------------------------------------------------------------------------
/packages/vite-plugin/tests/e2e/mv3-vite-react-content-script-seq-hmr/src1/App.jsx:
--------------------------------------------------------------------------------
1 | import { A } from './A'
2 | import { B } from './B'
3 |
4 | function App() {
5 | return (
6 |
10 | )
11 | }
12 |
13 | export default App
14 |
--------------------------------------------------------------------------------
/packages/vite-plugin/tests/out/basic-js/build.test.ts:
--------------------------------------------------------------------------------
1 | import { build } from 'tests/runners'
2 | import { testOutput } from 'tests/testOutput'
3 | import { test } from 'vitest'
4 |
5 | test('build fs output', async () => {
6 | const result = await build(__dirname)
7 | await testOutput(result)
8 | })
9 |
--------------------------------------------------------------------------------
/packages/vite-plugin/tests/out/basic-ts/build.test.ts:
--------------------------------------------------------------------------------
1 | import { build } from 'tests/runners'
2 | import { testOutput } from 'tests/testOutput'
3 | import { test } from 'vitest'
4 |
5 | test('build fs output', async () => {
6 | const result = await build(__dirname)
7 | await testOutput(result)
8 | })
9 |
--------------------------------------------------------------------------------
/packages/vite-plugin/tests/out/basic-ts/src/App.tsx:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 |
3 | const App: React.FC = () => {
4 | return (
5 |
6 |
Popup Page
7 |
If you are seeing this, React is working!
8 |
9 | )
10 | }
11 |
12 | export default App
13 |
--------------------------------------------------------------------------------
/packages/vite-plugin/tsconfig-types.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "./tsconfig.json",
3 | "compilerOptions": {
4 | "declaration": true,
5 | "declarationDir": "dist",
6 | "emitDeclarationOnly": true,
7 | "noEmit": false
8 | },
9 | "include": ["src/node", "modules.d.ts"]
10 | }
11 |
--------------------------------------------------------------------------------
/packages/rollup-plugin/__fixtures__/extensions/mv3-input-array/manifest.json:
--------------------------------------------------------------------------------
1 | {
2 | "background": {
3 | "service_worker": "service_worker.js"
4 | },
5 | "description": "input-array chrome extension",
6 | "manifest_version": 3,
7 | "name": "input-array",
8 | "version": "0.1.0"
9 | }
10 |
--------------------------------------------------------------------------------
/packages/vite-plugin/tests/e2e/mv3-vite-dynamic-content-script-hmr/src1/style.css:
--------------------------------------------------------------------------------
1 | #app {
2 | font-family: Avenir, Helvetica, Arial, sans-serif;
3 | -webkit-font-smoothing: antialiased;
4 | -moz-osx-font-smoothing: grayscale;
5 | text-align: center;
6 | color: #2c3e50;
7 | margin-top: 60px;
8 | }
9 |
--------------------------------------------------------------------------------
/packages/vite-plugin/tests/e2e/mv3-vite-vanilla-content-script-hmr/src1/style.css:
--------------------------------------------------------------------------------
1 | #app {
2 | font-family: Avenir, Helvetica, Arial, sans-serif;
3 | -webkit-font-smoothing: antialiased;
4 | -moz-osx-font-smoothing: grayscale;
5 | text-align: center;
6 | color: #2c3e50;
7 | margin-top: 60px;
8 | }
9 |
--------------------------------------------------------------------------------
/packages/vite-plugin/tests/out/vite-svelte/build.test.ts:
--------------------------------------------------------------------------------
1 | import { build } from '../../runners'
2 | import { testOutput } from '../../testOutput'
3 | import { test } from 'vitest'
4 |
5 | test('build fs output', async () => {
6 | const result = await build(__dirname)
7 | await testOutput(result)
8 | })
9 |
--------------------------------------------------------------------------------
/packages/vite-plugin/tests/out/vite-svelte/serve.test.ts:
--------------------------------------------------------------------------------
1 | import { serve } from '../../runners'
2 | import { testOutput } from '../../testOutput'
3 | import { test } from 'vitest'
4 |
5 | test('serve fs output', async () => {
6 | const result = await serve(__dirname)
7 | await testOutput(result)
8 | })
9 |
--------------------------------------------------------------------------------
/packages/rollup-plugin/__fixtures__/extensions/mv2-basic-ts/src/pages/popup/index.tsx:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 | import { render } from 'react-dom'
3 | import App from './App'
4 |
5 | console.log('popup script')
6 |
7 | const root = document.querySelector('#root')
8 |
9 | render(, root)
10 |
--------------------------------------------------------------------------------
/packages/rollup-plugin/__fixtures__/extensions/mv2-iife-json-paths-html/content/content.js:
--------------------------------------------------------------------------------
1 | import { x } from '../shared/imported1'
2 | import { y } from '../shared/imported2'
3 |
4 | console.log(x)
5 | console.log('🚀: y', y)
6 |
7 | console.log('content.js')
8 |
9 | chrome.contextMenus.removeAll()
10 |
--------------------------------------------------------------------------------
/packages/rollup-plugin/__fixtures__/extensions/mv3-basic-js/src/App.js:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 |
3 | const App = () => {
4 | return (
5 |
6 |
Popup Page
7 |
If you are seeing this, React is working!
8 |
9 | )
10 | }
11 |
12 | export default App
13 |
--------------------------------------------------------------------------------
/packages/rollup-plugin/__fixtures__/extensions/mv3-iife-json-paths-html/content/content.js:
--------------------------------------------------------------------------------
1 | import { x } from '../shared/imported1'
2 | import { y } from '../shared/imported2'
3 |
4 | console.log(x)
5 | console.log('🚀: y', y)
6 |
7 | console.log('content.js')
8 |
9 | chrome.contextMenus.removeAll()
10 |
--------------------------------------------------------------------------------
/packages/rollup-plugin/__fixtures__/extensions/mv3-input-object/manifest.json:
--------------------------------------------------------------------------------
1 | {
2 | "background": {
3 | "service_worker": "service_worker.js"
4 | },
5 | "description": "input-object chrome extension",
6 | "manifest_version": 3,
7 | "name": "input-object",
8 | "version": "0.1.0"
9 | }
10 |
--------------------------------------------------------------------------------
/packages/rollup-plugin/__fixtures__/extensions/mv3-manifest-ts-single-input/src/popup.tsx:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 | import { render } from 'react-dom'
3 | import App from './App'
4 |
5 | console.log('popup script')
6 |
7 | const root = document.querySelector('#root')
8 |
9 | render(, root)
10 |
--------------------------------------------------------------------------------
/packages/vite-plugin/tests/out/dynamic-script/build.test.ts:
--------------------------------------------------------------------------------
1 | import { build } from 'tests/runners'
2 | import { testOutput } from 'tests/testOutput'
3 | import { test } from 'vitest'
4 |
5 | test('build fs output', async () => {
6 | const result = await build(__dirname)
7 | await testOutput(result)
8 | })
9 |
--------------------------------------------------------------------------------
/packages/vite-plugin/tests/out/with-circular-deps/build.test.ts:
--------------------------------------------------------------------------------
1 | import { build } from 'tests/runners'
2 | import { testOutput } from 'tests/testOutput'
3 | import { test } from 'vitest'
4 |
5 | test('build fs output', async () => {
6 | const result = await build(__dirname)
7 | await testOutput(result)
8 | })
9 |
--------------------------------------------------------------------------------
/packages/vite-plugin/tests/out/with-copied-assets/build.test.ts:
--------------------------------------------------------------------------------
1 | import { build } from 'tests/runners'
2 | import { testOutput } from 'tests/testOutput'
3 | import { test } from 'vitest'
4 |
5 | test('build fs output', async () => {
6 | const result = await build(__dirname)
7 | await testOutput(result)
8 | })
9 |
--------------------------------------------------------------------------------
/packages/vite-plugin/tests/out/with-public-dir/build.test.ts:
--------------------------------------------------------------------------------
1 | import { build } from 'tests/runners'
2 | import { testOutput } from 'tests/testOutput'
3 | import { test } from 'vitest'
4 |
5 | test('build fs output', async () => {
6 | const result = await build(__dirname)
7 | await testOutput(result)
8 | })
9 |
--------------------------------------------------------------------------------
/packages/vite-plugin/tests/out/with-sourcemaps/build.test.ts:
--------------------------------------------------------------------------------
1 | import { build } from 'tests/runners'
2 | import { testOutput } from 'tests/testOutput'
3 | import { test } from 'vitest'
4 |
5 | test('build fs output', async () => {
6 | const result = await build(__dirname)
7 | await testOutput(result)
8 | })
9 |
--------------------------------------------------------------------------------
/packages/vite-plugin/tests/out/with-sourcemaps/src/App.tsx:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 |
3 | const App: React.FC = () => {
4 | return (
5 |
6 |
Popup Page
7 |
If you are seeing this, React is working!
8 |
9 | )
10 | }
11 |
12 | export default App
13 |
--------------------------------------------------------------------------------
/packages/rollup-plugin/__fixtures__/extensions/mv2-basic-js/src/pages/popup/index.js:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 | import ReactDOM from 'react-dom'
3 | import App from './App'
4 |
5 | console.log('popup script')
6 |
7 | const root = document.querySelector('#root')
8 |
9 | ReactDOM.render(, root)
10 |
--------------------------------------------------------------------------------
/packages/rollup-plugin/__fixtures__/extensions/mv2-iife-json-paths-bg-only/manifest.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "iife-json-paths-bg-only",
3 | "description": "iife json paths bg only",
4 | "manifest_version": 2,
5 | "version": "1.0.0",
6 | "background": {
7 | "scripts": ["background.js"]
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/packages/vite-plugin/tests/e2e/mv3-vite-svelte-page/__image_snapshots__/vite-build-test-ts-crx-runs-from-build-output-1-snap.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ZainChen/chrome-extension-tools/main/packages/vite-plugin/tests/e2e/mv3-vite-svelte-page/__image_snapshots__/vite-build-test-ts-crx-runs-from-build-output-1-snap.png
--------------------------------------------------------------------------------
/packages/vite-plugin/tests/e2e/mv3-vite-vue-content-script-hmr/manifest.json:
--------------------------------------------------------------------------------
1 | {
2 | "manifest_version": 3,
3 | "content_scripts": [
4 | {
5 | "matches": ["https://example.com/*"],
6 | "js": ["src/main.js"]
7 | }
8 | ],
9 | "name": "Vite Vue Page",
10 | "version": "0.0.1"
11 | }
12 |
--------------------------------------------------------------------------------
/packages/vite-plugin/tests/e2e/mv3-web-accessible-resources/manifest.json:
--------------------------------------------------------------------------------
1 | {
2 | "content_scripts": [
3 | {
4 | "js": ["src/content.ts"],
5 | "matches": ["https://example.com/*"]
6 | }
7 | ],
8 | "manifest_version": 3,
9 | "name": "test extension",
10 | "version": "0.1.0"
11 | }
12 |
--------------------------------------------------------------------------------
/packages/vite-plugin/tests/out/vite-react-fast-refresh/build.test.ts:
--------------------------------------------------------------------------------
1 | import { build } from 'tests/runners'
2 | import { testOutput } from 'tests/testOutput'
3 | import { test } from 'vitest'
4 |
5 | test('build fs output', async () => {
6 | const result = await build(__dirname)
7 | await testOutput(result)
8 | })
9 |
--------------------------------------------------------------------------------
/packages/vite-plugin/tests/out/vite-react-fast-refresh/src/App.tsx:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 |
3 | const App: React.FC = () => {
4 | return (
5 |
6 |
Popup Page
7 |
If you are seeing this, React is working!
8 |
9 | )
10 | }
11 |
12 | export default App
13 |
--------------------------------------------------------------------------------
/packages/vite-plugin/tests/out/vite-react-fast-refresh/src/content.tsx:
--------------------------------------------------------------------------------
1 | import { render } from 'react-dom'
2 | import App from './App'
3 |
4 | console.log('content script')
5 |
6 | const root = document.createElement('div')
7 | root.id = 'root'
8 | document.body.append(root)
9 |
10 | render(, root)
11 |
--------------------------------------------------------------------------------
/packages/rollup-plugin/__fixtures__/extensions/mv2-no-scripts/manifest.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "no-scripts",
3 | "description": "no-scripts chrome extension",
4 | "manifest_version": 2,
5 | "version": "0.1.0",
6 | "browser_action": {
7 | "default_icon": { "16": "images/icon-main-16.png" }
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/packages/rollup-plugin/__fixtures__/extensions/mv3-background-only/src/pages/popup/index.js:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 | import ReactDOM from 'react-dom'
3 | import App from './App'
4 |
5 | console.log('popup script')
6 |
7 | const root = document.querySelector('#root')
8 |
9 | ReactDOM.render(, root)
10 |
--------------------------------------------------------------------------------
/packages/rollup-plugin/__fixtures__/extensions/mv3-basic-ts/src/App.tsx:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 |
3 | const App: React.FC = () => {
4 | return (
5 |
6 |
Popup Page
7 |
If you are seeing this, React is working!
8 |
9 | )
10 | }
11 |
12 | export default App
13 |
--------------------------------------------------------------------------------
/packages/vite-plugin/tests/e2e/mv3-vite-svelte-page/__image_snapshots__/vite-serve-test-ts-crx-runs-from-server-output-1-snap.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ZainChen/chrome-extension-tools/main/packages/vite-plugin/tests/e2e/mv3-vite-svelte-page/__image_snapshots__/vite-serve-test-ts-crx-runs-from-server-output-1-snap.png
--------------------------------------------------------------------------------
/packages/vite-plugin/tests/out/content-script-module-api/build.test.ts:
--------------------------------------------------------------------------------
1 | import { build } from 'tests/runners'
2 | import { testOutput } from 'tests/testOutput'
3 | import { test } from 'vitest'
4 |
5 | test('build fs output', async () => {
6 | const result = await build(__dirname)
7 | await testOutput(result)
8 | })
9 |
--------------------------------------------------------------------------------
/packages/vite-plugin/tests/out/vite-self-directive-in-csp/src/App.tsx:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 |
3 | const App: React.FC = () => {
4 | return (
5 |
6 |
Popup Page
7 |
If you are seeing this, React is working!
8 |
9 | )
10 | }
11 |
12 | export default App
13 |
--------------------------------------------------------------------------------
/packages/vite-plugin/tests/out/with-web-accessible-html/build.test.ts:
--------------------------------------------------------------------------------
1 | import { build } from 'tests/runners'
2 | import { testOutput } from 'tests/testOutput'
3 | import { test } from 'vitest'
4 |
5 | test('build fs output', async () => {
6 | const result = await build(__dirname)
7 | await testOutput(result)
8 | })
9 |
--------------------------------------------------------------------------------
/packages/rollup-plugin/__fixtures__/extensions/mv2-basic-js/src/pages/popup/App.js:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 |
3 | const App = () => {
4 | return (
5 |
6 |
Popup Page
7 |
If you are seeing this, React is working!
8 |
9 | )
10 | }
11 |
12 | export default App
13 |
--------------------------------------------------------------------------------
/packages/rollup-plugin/__fixtures__/extensions/mv2-content-script-react-tsx/src/manifest.json:
--------------------------------------------------------------------------------
1 | {
2 | "content_scripts": [
3 | {
4 | "js": ["content/index.tsx"],
5 | "matches": ["https://*/*", "http://*/*"]
6 | }
7 | ],
8 | "browser_action": { "default_popup": "pages/popup/index.html" }
9 | }
10 |
--------------------------------------------------------------------------------
/packages/rollup-plugin/__fixtures__/extensions/mv2-content-script-react-tsx/src/pages/popup/index.tsx:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 | import { render } from 'react-dom'
3 | import App from './App'
4 |
5 | console.log('popup script')
6 |
7 | const root = document.querySelector('#root')
8 |
9 | render(, root)
10 |
--------------------------------------------------------------------------------
/packages/rollup-plugin/__fixtures__/extensions/mv3-content-script-only/src/pages/popup/index.js:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 | import ReactDOM from 'react-dom'
3 | import App from './App'
4 |
5 | console.log('popup script')
6 |
7 | const root = document.querySelector('#root')
8 |
9 | ReactDOM.render(, root)
10 |
--------------------------------------------------------------------------------
/packages/rollup-plugin/__fixtures__/extensions/mv3-content-script-react-tsx/src/pages/popup/index.tsx:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 | import { render } from 'react-dom'
3 | import App from './App'
4 |
5 | console.log('popup script')
6 |
7 | const root = document.querySelector('#root')
8 |
9 | render(, root)
10 |
--------------------------------------------------------------------------------
/packages/rollup-plugin/__fixtures__/extensions/mv3-iife-json-paths-bg-only/manifest.json:
--------------------------------------------------------------------------------
1 | {
2 | "background": {
3 | "service_worker": "service_worker.js"
4 | },
5 | "description": "iife json paths bg only",
6 | "manifest_version": 3,
7 | "name": "iife-json-paths-bg-only",
8 | "version": "1.0.0"
9 | }
10 |
--------------------------------------------------------------------------------
/packages/vite-plugin/src/node/path.ts:
--------------------------------------------------------------------------------
1 | import { posix } from 'path'
2 |
3 | export const {
4 | basename,
5 | dirname,
6 | extname,
7 | delimiter,
8 | format,
9 | isAbsolute,
10 | join,
11 | normalize,
12 | parse,
13 | relative,
14 | resolve,
15 | toNamespacedPath,
16 | sep,
17 | } = posix
18 |
--------------------------------------------------------------------------------
/packages/vite-plugin/tests/e2e/mv3-vite-react-page/manifest.json:
--------------------------------------------------------------------------------
1 | {
2 | "background": {
3 | "service_worker": "src/background.ts"
4 | },
5 | "description": "test extension",
6 | "manifest_version": 3,
7 | "name": "test extension",
8 | "options_page": "src/options.html",
9 | "version": "1.0.0"
10 | }
11 |
--------------------------------------------------------------------------------
/packages/vite-plugin/tests/out/dynamic-script/src/declared-script.ts:
--------------------------------------------------------------------------------
1 | import fileName from './main-world?script&module'
2 |
3 | console.log('declared script')
4 |
5 | const script = document.createElement('script')
6 | script.src = chrome.runtime.getURL(fileName)
7 | script.type = 'module'
8 | document.head.prepend(script)
9 |
--------------------------------------------------------------------------------
/packages/vite-plugin/tests/out/vite-content-script-css-imports-2/build.test.ts:
--------------------------------------------------------------------------------
1 | import { build } from 'tests/runners'
2 | import { testOutput } from 'tests/testOutput'
3 | import { test } from 'vitest'
4 |
5 | test('build fs output', async () => {
6 | const result = await build(__dirname)
7 | await testOutput(result)
8 | })
9 |
--------------------------------------------------------------------------------
/packages/vite-plugin/tests/out/vite-content-script-css-imports-3/build.test.ts:
--------------------------------------------------------------------------------
1 | import { build } from 'tests/runners'
2 | import { testOutput } from 'tests/testOutput'
3 | import { test } from 'vitest'
4 |
5 | test('build fs output', async () => {
6 | const result = await build(__dirname)
7 | await testOutput(result)
8 | })
9 |
--------------------------------------------------------------------------------
/packages/vite-plugin/tests/out/vite-content-script-css-imports/build.test.ts:
--------------------------------------------------------------------------------
1 | import { build } from 'tests/runners'
2 | import { testOutput } from 'tests/testOutput'
3 | import { test } from 'vitest'
4 |
5 | test('build fs output', async () => {
6 | const result = await build(__dirname)
7 | await testOutput(result)
8 | })
9 |
--------------------------------------------------------------------------------
/packages/vite-plugin/tests/out/vite-content-script-css-imports/manifest.json:
--------------------------------------------------------------------------------
1 | {
2 | "manifest_version": 3,
3 | "content_scripts": [
4 | {
5 | "matches": ["http://*/*", "https://*/*"],
6 | "js": ["src/content.ts"]
7 | }
8 | ],
9 | "name": "test extension",
10 | "version": "0.1.0"
11 | }
12 |
--------------------------------------------------------------------------------
/packages/vite-plugin/tests/out/vite-declared-script-resources/build.test.ts:
--------------------------------------------------------------------------------
1 | import { build } from 'tests/runners'
2 | import { testOutput } from 'tests/testOutput'
3 | import { test } from 'vitest'
4 |
5 | test('build fs output', async () => {
6 | const result = await build(__dirname)
7 | await testOutput(result)
8 | })
9 |
--------------------------------------------------------------------------------
/packages/vite-plugin/tests/out/vite-dynamic-script-resources/build.test.ts:
--------------------------------------------------------------------------------
1 | import { build } from 'tests/runners'
2 | import { testOutput } from 'tests/testOutput'
3 | import { test } from 'vitest'
4 |
5 | test('build fs output', async () => {
6 | const result = await build(__dirname)
7 | await testOutput(result)
8 | })
9 |
--------------------------------------------------------------------------------
/packages/rollup-plugin/__fixtures__/extensions/mv2-content-script-react-js/src/pages/popup/index.js:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 | import ReactDOM from 'react-dom'
3 | import App from './App'
4 |
5 | console.log('popup script')
6 |
7 | const root = document.querySelector('#root')
8 |
9 | ReactDOM.render(, root)
10 |
--------------------------------------------------------------------------------
/packages/rollup-plugin/__fixtures__/extensions/mv3-background-only/src/manifest.json:
--------------------------------------------------------------------------------
1 | {
2 | "background": {
3 | "service_worker": "service_worker.js"
4 | },
5 | "manifest_version": 3,
6 | "name": "mv3-background-only",
7 | "version": "1.0.0",
8 | "description": "Background Only MV3 Chrome Extension"
9 | }
10 |
--------------------------------------------------------------------------------
/packages/rollup-plugin/__fixtures__/extensions/mv3-background-only/src/pages/popup/App.js:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 |
3 | const App = () => {
4 | return (
5 |
6 |
Popup Page
7 |
If you are seeing this, React is working!
8 |
9 | )
10 | }
11 |
12 | export default App
13 |
--------------------------------------------------------------------------------
/packages/rollup-plugin/__fixtures__/extensions/mv3-content-script-react-js/src/pages/popup/index.js:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 | import ReactDOM from 'react-dom'
3 | import App from './App'
4 |
5 | console.log('popup script')
6 |
7 | const root = document.querySelector('#root')
8 |
9 | ReactDOM.render(, root)
10 |
--------------------------------------------------------------------------------
/packages/rollup-plugin/__fixtures__/extensions/mv3-invalid-manifest/manifest.json:
--------------------------------------------------------------------------------
1 | {
2 | "background": {
3 | "service_worker": "service_worker.js"
4 | },
5 | "description": "invalid-manifest chrome extension",
6 | "manifest_version": "b",
7 | "name": "invalid-manifest",
8 | "versionNumber": "0.1.0"
9 | }
10 |
--------------------------------------------------------------------------------
/packages/rollup-plugin/__fixtures__/extensions/mv3-no-scripts/manifest.json:
--------------------------------------------------------------------------------
1 | {
2 | "action": {
3 | "default_icon": {
4 | "16": "images/icon-main-16.png"
5 | }
6 | },
7 | "description": "no-scripts chrome extension",
8 | "manifest_version": 3,
9 | "name": "no-scripts",
10 | "version": "0.1.0"
11 | }
12 |
--------------------------------------------------------------------------------
/packages/vite-plugin/tests/e2e/mv3-vite-hmr-external-xhr/manifest.json:
--------------------------------------------------------------------------------
1 | {
2 | "background": {
3 | "service_worker": "src/background.ts"
4 | },
5 | "options_page": "src/options.html",
6 | "manifest_version": 3,
7 | "name": "test extension",
8 | "version": "1.0.0",
9 | "description": "test extension"
10 | }
11 |
--------------------------------------------------------------------------------
/packages/vite-plugin/tests/e2e/mv3-vite-react-page-hmr/manifest.json:
--------------------------------------------------------------------------------
1 | {
2 | "background": {
3 | "service_worker": "src/background.ts"
4 | },
5 | "description": "test extension",
6 | "manifest_version": 3,
7 | "name": "test extension",
8 | "options_page": "src/options.html",
9 | "version": "1.0.0"
10 | }
11 |
--------------------------------------------------------------------------------
/packages/vite-plugin/tests/out/vite-dynamic-script-resources-minify/build.test.ts:
--------------------------------------------------------------------------------
1 | import { build } from 'tests/runners'
2 | import { testOutput } from 'tests/testOutput'
3 | import { test } from 'vitest'
4 |
5 | test('build fs output', async () => {
6 | const result = await build(__dirname)
7 | await testOutput(result)
8 | })
9 |
--------------------------------------------------------------------------------
/packages/vite-plugin/tests/out/vite-self-directive-in-csp/build.test.ts:
--------------------------------------------------------------------------------
1 | import { build } from 'tests/runners'
2 | import { testOutput } from 'tests/testOutput'
3 | import { test } from 'vitest'
4 |
5 | test("works with 'self' directive", async () => {
6 | const result = await build(__dirname)
7 | await testOutput(result)
8 | })
9 |
--------------------------------------------------------------------------------
/packages/rollup-plugin/__fixtures__/extensions/mv2-basic-ts/src/pages/popup/App.tsx:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 |
3 | const App: React.FC = () => {
4 | return (
5 |
6 |
Popup Page
7 |
If you are seeing this, React is working!
8 |
9 | )
10 | }
11 |
12 | export default App
13 |
--------------------------------------------------------------------------------
/packages/rollup-plugin/__fixtures__/extensions/mv3-content-script-only/src/pages/popup/App.js:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 |
3 | const App = () => {
4 | return (
5 |
6 |
Popup Page
7 |
If you are seeing this, React is working!
8 |
9 | )
10 | }
11 |
12 | export default App
13 |
--------------------------------------------------------------------------------
/packages/vite-plugin/tests/e2e/mv3-vite-hmr-background-define/manifest.json:
--------------------------------------------------------------------------------
1 | {
2 | "manifest_version": 3,
3 | "description": "test extension",
4 | "name": "test extension",
5 | "options_page": "src/options.html",
6 | "version": "1.0.0",
7 | "background": {
8 | "service_worker": "src/background.ts"
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/packages/vite-plugin/tests/e2e/mv3-vite-svelte-content-script/__image_snapshots__/vite-build-test-ts-crx-runs-from-build-output-1-snap.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ZainChen/chrome-extension-tools/main/packages/vite-plugin/tests/e2e/mv3-vite-svelte-content-script/__image_snapshots__/vite-build-test-ts-crx-runs-from-build-output-1-snap.png
--------------------------------------------------------------------------------
/packages/vite-plugin/tests/e2e/mv3-vite-svelte-page/src/content.js:
--------------------------------------------------------------------------------
1 | import App from './App.svelte'
2 |
3 | const html = ``
4 | const target = new DOMParser().parseFromString(html).body.firstElementChild
5 | document.body.append(target)
6 |
7 | const app = new App({ target })
8 |
9 | export default app
10 |
--------------------------------------------------------------------------------
/renovate.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": ["config:base"],
3 | "timezone": "America/Chicago",
4 | "schedule": ["every weekend"],
5 | "packageRules": [
6 | {
7 | "matchPackageNames": ["@types/"],
8 | "groupName": "types"
9 | },
10 | { "matchPackageNames": ["eslint"], "groupName": "eslint" }
11 | ]
12 | }
13 |
--------------------------------------------------------------------------------
/packages/rollup-plugin/__fixtures__/extensions/mv2-content-script-react-js/src/pages/popup/App.js:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 |
3 | const App = () => {
4 | return (
5 |
6 |
Popup Page
7 |
If you are seeing this, React is working!
8 |
9 | )
10 | }
11 |
12 | export default App
13 |
--------------------------------------------------------------------------------
/packages/rollup-plugin/__fixtures__/extensions/mv3-content-script-react-js/src/pages/popup/App.js:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 |
3 | const App = () => {
4 | return (
5 |
6 |
Popup Page
7 |
If you are seeing this, React is working!
8 |
9 | )
10 | }
11 |
12 | export default App
13 |
--------------------------------------------------------------------------------
/packages/rollup-plugin/__fixtures__/extensions/mv3-manifest-ts-single-input/src/App.tsx:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 |
3 | const App: React.FC = () => {
4 | return (
5 |
6 |
Popup Page
7 |
If you are seeing this, React is working!
8 |
9 | )
10 | }
11 |
12 | export default App
13 |
--------------------------------------------------------------------------------
/packages/vite-plugin/tests/e2e/mv3-vite-react-sandbox/manifest.json:
--------------------------------------------------------------------------------
1 | {
2 | "background": {
3 | "service_worker": "src/background.ts"
4 | },
5 | "description": "test extension",
6 | "manifest_version": 3,
7 | "name": "test extension",
8 | "sandbox": { "pages": ["src/sandbox.html"] },
9 | "version": "1.0.0"
10 | }
11 |
--------------------------------------------------------------------------------
/packages/vite-plugin/tests/e2e/mv3-vite-svelte-content-script/__image_snapshots__/vite-serve-test-ts-crx-runs-from-server-output-1-snap.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ZainChen/chrome-extension-tools/main/packages/vite-plugin/tests/e2e/mv3-vite-svelte-content-script/__image_snapshots__/vite-serve-test-ts-crx-runs-from-server-output-1-snap.png
--------------------------------------------------------------------------------
/packages/vite-plugin/tests/e2e/mv3-vite-svelte-page-hmr/src1/content.js:
--------------------------------------------------------------------------------
1 | import App from './App.svelte'
2 |
3 | const html = ``
4 | const target = new DOMParser().parseFromString(html).body.firstElementChild
5 | document.body.append(target)
6 |
7 | const app = new App({ target })
8 |
9 | export default app
10 |
--------------------------------------------------------------------------------
/packages/vite-plugin/tests/out/vite-declared-script-resources/manifest.json:
--------------------------------------------------------------------------------
1 | {
2 | "content_scripts": [
3 | {
4 | "js": ["src/content.ts"],
5 | "matches": ["https://google.com/search*", "*://a.com/*"]
6 | }
7 | ],
8 | "manifest_version": 3,
9 | "name": "test extension",
10 | "version": "0.1.0"
11 | }
12 |
--------------------------------------------------------------------------------
/.changeset/config.json:
--------------------------------------------------------------------------------
1 | {
2 | "$schema": "https://unpkg.com/@changesets/config@2.0.0/schema.json",
3 | "changelog": "@changesets/cli/changelog",
4 | "commit": false,
5 | "fixed": [],
6 | "linked": [],
7 | "access": "public",
8 | "baseBranch": "main",
9 | "updateInternalDependencies": "patch",
10 | "ignore": []
11 | }
12 |
--------------------------------------------------------------------------------
/packages/vite-plugin/tests/e2e/mv3-vite-dynamic-content-script-hmr/src2/style.css:
--------------------------------------------------------------------------------
1 | #app {
2 | font-family: Avenir, Helvetica, Arial, sans-serif;
3 | -webkit-font-smoothing: antialiased;
4 | -moz-osx-font-smoothing: grayscale;
5 | text-align: center;
6 | color: #2c3e50;
7 | margin-top: 60px;
8 | background-color: red;
9 | }
10 |
--------------------------------------------------------------------------------
/packages/vite-plugin/tests/e2e/mv3-vite-vanilla-content-script-hmr/src2/style.css:
--------------------------------------------------------------------------------
1 | #app {
2 | font-family: Avenir, Helvetica, Arial, sans-serif;
3 | -webkit-font-smoothing: antialiased;
4 | -moz-osx-font-smoothing: grayscale;
5 | text-align: center;
6 | color: #2c3e50;
7 | margin-top: 60px;
8 | background-color: red;
9 | }
10 |
--------------------------------------------------------------------------------
/packages/vite-plugin/tests/e2e/mv3-vite-vanilla-content-script-seq-hmr/src2/root.ts:
--------------------------------------------------------------------------------
1 | import { a } from './a'
2 |
3 | console.log('updated root')
4 |
5 | const root = new DOMParser().parseFromString(
6 | `${a}
`,
7 | 'text/html',
8 | ).body.firstElementChild as HTMLDivElement
9 |
10 | document.body.append(root)
11 |
--------------------------------------------------------------------------------
/packages/rollup-plugin/__fixtures__/extensions/mv2-content-script-react-tsx/src/pages/popup/App.tsx:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 |
3 | const App: React.FC = () => {
4 | return (
5 |
6 |
Popup Page
7 |
If you are seeing this, React is working!
8 |
9 | )
10 | }
11 |
12 | export default App
13 |
--------------------------------------------------------------------------------
/packages/rollup-plugin/__fixtures__/extensions/mv3-content-script-react-tsx/src/pages/popup/App.tsx:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 |
3 | const App: React.FC = () => {
4 | return (
5 |
6 |
Popup Page
7 |
If you are seeing this, React is working!
8 |
9 | )
10 | }
11 |
12 | export default App
13 |
--------------------------------------------------------------------------------
/packages/vite-plugin/tests/e2e/mv3-vite-react-new-tab/manifest.json:
--------------------------------------------------------------------------------
1 | {
2 | "background": {
3 | "service_worker": "src/background.ts"
4 | },
5 | "description": "test extension",
6 | "manifest_version": 3,
7 | "name": "test extension",
8 | "chrome_url_overrides": { "newtab": "src/newtab.html" },
9 | "version": "1.0.0"
10 | }
11 |
--------------------------------------------------------------------------------
/packages/vite-plugin/tests/e2e/mv3-vite-vue-content-script/manifest.json:
--------------------------------------------------------------------------------
1 | {
2 | "description": "test extension",
3 | "manifest_version": 3,
4 | "name": "test extension",
5 | "content_scripts": [
6 | {
7 | "matches": ["https://example.com/*"],
8 | "js": ["src/main.js"]
9 | }
10 | ],
11 | "version": "1.0.0"
12 | }
13 |
--------------------------------------------------------------------------------
/packages/vite-plugin/tests/out/vite-svelte/src/content.js:
--------------------------------------------------------------------------------
1 | import App from './App.svelte'
2 |
3 | const html = ``
4 | const target = new DOMParser().parseFromString(html, 'text/html').body
5 | .firstElementChild
6 | document.body.append(target)
7 |
8 | const app = new App({ target })
9 |
10 | export default app
11 |
--------------------------------------------------------------------------------
/packages/rollup-plugin/__fixtures__/extensions/mv2-external-dependency/background/background.js:
--------------------------------------------------------------------------------
1 | import { x } from '../shared/imported'
2 | import path from 'path'
3 |
4 | console.log(x)
5 |
6 | console.log('background.js')
7 |
8 | chrome.storage.local.clear()
9 |
10 | const joined = path.join('a', 'b')
11 |
12 | console.log('joined', joined)
13 |
--------------------------------------------------------------------------------
/packages/rollup-plugin/__fixtures__/extensions/mv3-external-dependency/service_worker.js:
--------------------------------------------------------------------------------
1 | import { x } from '../shared/imported'
2 | import path from 'path'
3 |
4 | console.log(x)
5 |
6 | console.log('service_worker.js')
7 |
8 | chrome.storage.local.clear()
9 |
10 | const joined = path.join('a', 'b')
11 |
12 | console.log('joined', joined)
13 |
--------------------------------------------------------------------------------
/packages/rollup-plugin/src/browser-polyfill/browser/.eslintrc.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | env: {
3 | browser: true,
4 | webextensions: true,
5 | node: false,
6 | },
7 | parserOptions: {
8 | ecmaVersion: 2018,
9 | sourceType: 'module',
10 | project: './tsconfig.json',
11 | tsconfigRootDir: __dirname,
12 | },
13 | }
14 |
--------------------------------------------------------------------------------
/packages/rollup-plugin/src/manifest-input/browser/.eslintrc.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | env: {
3 | browser: true,
4 | webextensions: true,
5 | node: false,
6 | },
7 | parserOptions: {
8 | ecmaVersion: 2018,
9 | sourceType: 'module',
10 | project: './tsconfig.json',
11 | tsconfigRootDir: __dirname,
12 | },
13 | }
14 |
--------------------------------------------------------------------------------
/packages/rollup-plugin/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "./tsconfigs/tsconfig-base.json",
3 | "include": [
4 | "src/**/*",
5 | "__fixtures__/**/*",
6 | "__tests__/**/*",
7 | "jest.setup.ts",
8 | "examples/**/*.ts"
9 | ],
10 | "exclude": ["src/manifest-input/browser"],
11 | "typeAcquisition": { "enable": true }
12 | }
13 |
--------------------------------------------------------------------------------
/packages/vite-plugin/tests/e2e/mv3-crx-iframe/src/background.ts:
--------------------------------------------------------------------------------
1 | // This fixes `self`'s type.
2 | declare const self: ServiceWorkerGlobalScope
3 | export {}
4 |
5 | chrome.runtime.onInstalled.addListener(async () => {
6 | await self.skipWaiting()
7 | await new Promise((r) => setTimeout(r, 100))
8 | chrome.runtime.openOptionsPage()
9 | })
10 |
--------------------------------------------------------------------------------
/packages/vite-plugin/tests/e2e/mv3-vite-react-content-script/manifest.json:
--------------------------------------------------------------------------------
1 | {
2 | "description": "test extension",
3 | "manifest_version": 3,
4 | "name": "test extension",
5 | "content_scripts": [
6 | {
7 | "matches": ["https://example.com/*"],
8 | "js": ["src/main.jsx"]
9 | }
10 | ],
11 | "version": "1.0.0"
12 | }
13 |
--------------------------------------------------------------------------------
/packages/vite-plugin/tests/e2e/mv3-vite-react-page/src/main.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 | import ReactDOM from 'react-dom'
3 | import './index.css'
4 | import App from './App'
5 |
6 | const root = document.getElementById('root')
7 |
8 | ReactDOM.render(
9 |
10 |
11 | ,
12 | root,
13 | )
14 |
--------------------------------------------------------------------------------
/packages/rollup-plugin/__fixtures__/extensions/mv2-content-script-react-js/src/content1/index.js:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 | import { render } from 'react-dom'
3 |
4 | console.log('content script')
5 |
6 | const root = document.createElement('div')
7 | root.id = 'root'
8 | document.body.append(root)
9 |
10 | render(Hello World!
, root)
11 |
--------------------------------------------------------------------------------
/packages/rollup-plugin/__fixtures__/extensions/mv2-content-script-react-js/src/content2/index.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 | import { render } from 'react-dom'
3 |
4 | console.log('content script')
5 |
6 | const root = document.createElement('div')
7 | root.id = 'root'
8 | document.body.append(root)
9 |
10 | render(Hello World!
, root)
11 |
--------------------------------------------------------------------------------
/packages/rollup-plugin/__fixtures__/extensions/mv2-content-script-react-tsx/src/content/index.tsx:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 | import { render } from 'react-dom'
3 |
4 | console.log('content script')
5 |
6 | const root = document.createElement('div')
7 | root.id = 'root'
8 | document.body.append(root)
9 |
10 | render(Hello World!
, root)
11 |
--------------------------------------------------------------------------------
/packages/rollup-plugin/__fixtures__/extensions/mv3-content-script-react-js/src/content1/index.js:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 | import { render } from 'react-dom'
3 |
4 | console.log('content script')
5 |
6 | const root = document.createElement('div')
7 | root.id = 'root'
8 | document.body.append(root)
9 |
10 | render(Hello World!
, root)
11 |
--------------------------------------------------------------------------------
/packages/rollup-plugin/__fixtures__/extensions/mv3-content-script-react-js/src/content2/index.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 | import { render } from 'react-dom'
3 |
4 | console.log('content script')
5 |
6 | const root = document.createElement('div')
7 | root.id = 'root'
8 | document.body.append(root)
9 |
10 | render(Hello World!
, root)
11 |
--------------------------------------------------------------------------------
/packages/rollup-plugin/__fixtures__/extensions/mv3-content-script-react-tsx/src/content/index.tsx:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 | import { render } from 'react-dom'
3 |
4 | console.log('content script')
5 |
6 | const root = document.createElement('div')
7 | root.id = 'root'
8 | document.body.append(root)
9 |
10 | render(Hello World!
, root)
11 |
--------------------------------------------------------------------------------
/packages/rollup-plugin/src/validate-names/__tests__/validate__init.test.ts:
--------------------------------------------------------------------------------
1 | import { validateNames } from '../index'
2 |
3 | test('returns object with name & generatedBundle', () => {
4 | const plugin = validateNames()
5 |
6 | expect(plugin).toEqual({
7 | name: 'validate-names',
8 | generateBundle: expect.any(Function),
9 | })
10 | })
11 |
--------------------------------------------------------------------------------
/packages/vite-plugin/tests/e2e/mv3-vite-react-content-script-hmr/manifest.json:
--------------------------------------------------------------------------------
1 | {
2 | "description": "test extension",
3 | "manifest_version": 3,
4 | "name": "test extension",
5 | "content_scripts": [
6 | {
7 | "matches": ["https://example.com/*"],
8 | "js": ["src/main.jsx"]
9 | }
10 | ],
11 | "version": "1.0.0"
12 | }
13 |
--------------------------------------------------------------------------------
/packages/vite-plugin/tests/e2e/mv3-vite-react-new-tab/src/main.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 | import ReactDOM from 'react-dom'
3 | import './index.css'
4 | import App from './App'
5 |
6 | const root = document.getElementById('root')
7 |
8 | ReactDOM.render(
9 |
10 |
11 | ,
12 | root,
13 | )
14 |
--------------------------------------------------------------------------------
/packages/vite-plugin/tests/e2e/mv3-vite-react-page-hmr/src1/main.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 | import ReactDOM from 'react-dom'
3 | import './index.css'
4 | import App from './App'
5 |
6 | const root = document.getElementById('root')
7 |
8 | ReactDOM.render(
9 |
10 |
11 | ,
12 | root,
13 | )
14 |
--------------------------------------------------------------------------------
/packages/vite-plugin/tests/e2e/mv3-vite-react-sandbox/src/main.jsx:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 | import ReactDOM from 'react-dom'
3 | import './index.css'
4 | import App from './App'
5 |
6 | const root = document.getElementById('root')
7 |
8 | ReactDOM.render(
9 |
10 |
11 | ,
12 | root,
13 | )
14 |
--------------------------------------------------------------------------------