diff --git a/.env.example b/.env.example
new file mode 100644
index 00000000..31ff0cfe
--- /dev/null
+++ b/.env.example
@@ -0,0 +1,3 @@
+EXTENSION_ENV=
+EXPERIMENTAL_ERRORS_PLUGIN=
+EXPERIMENTAL_EXTENSION_RESOLVER_PLUGIN=
diff --git a/examples/config-babel/extension.config.js b/examples/config-babel/extension.config.js
index 3e57e763..df6ea986 100644
--- a/examples/config-babel/extension.config.js
+++ b/examples/config-babel/extension.config.js
@@ -1,4 +1,4 @@
-/** @type {import('extension-develop').FileConfig} */
+/** @type {import('extension').FileConfig} */
module.exports = {
config: (config) => {
config.module.rules.push(
diff --git a/examples/content-extension-config/content/ContentApp.tsx b/examples/content-extension-config/content/ContentApp.tsx
index 0fb6dc1a..245ca43e 100644
--- a/examples/content-extension-config/content/ContentApp.tsx
+++ b/examples/content-extension-config/content/ContentApp.tsx
@@ -1,5 +1,5 @@
import React from 'react'
-import ReactLogo from '../images/logo.svg'
+import reactLogo from '../images/react.png'
import tailwindBg from '../images/tailwind_bg.png'
import typescriptLogo from '../images/typescript.png'
import tailwindLogo from '../images/tailwind.png'
@@ -38,7 +38,11 @@ export default function ContentApp() {
-
+
+
{
- config.module.rules.push(
- {
- test: /\.svg$/i,
- type: 'asset',
- // *.svg?url
- resourceQuery: /url/
- },
- {
- test: /\.svg$/i,
- issuer: /\.[jt]sx?$/,
- // exclude react component if *.svg?url
- resourceQuery: {not: [/url/]},
- use: ['@svgr/webpack']
- }
- )
-
- return config
- }
+ browsers: {
+ chrome: {
+ // noOpen?: boolean
+ // userDataDir?: string
+ // profile?: string
+ // preferences?: Record
+ // browserFlags?: string[]
+ // startingUrl?: string
+ // chromiumBinary?: string
+ startingUrl: 'https://extension.js.org'
+ },
+ firefox: {
+ // noOpen?: boolean
+ // userDataDir?: string
+ // profile?: string
+ // preferences?: Record
+ // browserFlags?: string[]
+ // startingUrl?: string
+ // geckoBinary?: string
+ startingUrl: 'about:debugging#/runtime/this-firefox'
+ }
+ },
+ development: {
+ // TBD
+ // browser: DevOptions['browser']
+ // port?: number
+ // browser: 'firefox', // can be an array
+ // zipFilename?: string
+ // zip?: boolean
+ // zipSource?: boolean
+ // polyfill?: boolean
+ },
+ deployment: {}
}
diff --git a/examples/content-extension-config/images/logo.svg b/examples/content-extension-config/images/logo.svg
deleted file mode 100644
index ea77a618..00000000
--- a/examples/content-extension-config/images/logo.svg
+++ /dev/null
@@ -1,9 +0,0 @@
-
diff --git a/examples/content-extension-config/images/react.png b/examples/content-extension-config/images/react.png
new file mode 100644
index 00000000..9080fddd
Binary files /dev/null and b/examples/content-extension-config/images/react.png differ
diff --git a/examples/content-extension-config/package.json b/examples/content-extension-config/package.json
index 2d68c29a..29f0235b 100644
--- a/examples/content-extension-config/package.json
+++ b/examples/content-extension-config/package.json
@@ -15,7 +15,6 @@
"url": "https://cezaraugusto.com"
},
"dependencies": {
- "@svgr/webpack": "^8.1.0",
"react": "^18.1.0",
"react-dom": "^18.1.0",
"tailwindcss": "^3.4.1"
diff --git a/examples/content-main-world/extension.config.js b/examples/content-main-world/extension.config.js
index 6784b612..f495a447 100644
--- a/examples/content-main-world/extension.config.js
+++ b/examples/content-main-world/extension.config.js
@@ -1,4 +1,4 @@
-/** @type {import('extension-develop').FileConfig} */
+/** @type {import('extension').FileConfig} */
module.exports = {
config: (config) => {
config.output.publicPath =
diff --git a/examples/content-react-svgr/extension.config.js b/examples/content-react-svgr/extension.config.js
index 9c2bf69f..e7d61e2b 100644
--- a/examples/content-react-svgr/extension.config.js
+++ b/examples/content-react-svgr/extension.config.js
@@ -1,4 +1,4 @@
-/** @type {import('extension-develop').FileConfig} */
+/** @type {import('extension').FileConfig} */
module.exports = {
config: (config) => {
config.module.rules.push(
diff --git a/examples/new-crypto/extension.config.js b/examples/new-crypto/extension.config.js
index 701d253b..31eaea22 100644
--- a/examples/new-crypto/extension.config.js
+++ b/examples/new-crypto/extension.config.js
@@ -1,6 +1,6 @@
const NodePolyfillPlugin = require('node-polyfill-webpack-plugin')
-/** @type {import('extension-develop').FileConfig} */
+/** @type {import('extension').FileConfig} */
module.exports = {
config: (config) => {
config.plugins = [
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 43c6c108..bbf4c8a1 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -53,7 +53,7 @@ importers:
version: 3.3.3
ts-jest:
specifier: ^29.1.2
- version: 29.2.5(@babel/core@7.25.2)(@jest/transform@29.7.0)(@jest/types@29.6.3)(babel-jest@29.7.0(@babel/core@7.25.2))(jest@29.7.0(@types/node@20.16.5)(ts-node@10.9.2(@swc/core@1.7.26)(@types/node@20.16.5)(typescript@5.3.3)))(typescript@5.3.3)
+ version: 29.2.5(@babel/core@7.25.2)(@jest/transform@29.7.0)(@jest/types@29.6.3)(babel-jest@29.7.0(@babel/core@7.25.2))(esbuild@0.23.1)(jest@29.7.0(@types/node@20.16.5)(ts-node@10.9.2(@swc/core@1.7.26)(@types/node@20.16.5)(typescript@5.3.3)))(typescript@5.3.3)
ts-node:
specifier: ^10.9.2
version: 10.9.2(@swc/core@1.7.26)(@types/node@20.16.5)(typescript@5.3.3)
@@ -101,7 +101,7 @@ importers:
version: 7.25.2
babel-loader:
specifier: ^9.1.3
- version: 9.1.3(@babel/core@7.25.2)(webpack@5.92.1(@swc/core@1.7.26))
+ version: 9.1.3(@babel/core@7.25.2)(webpack@5.92.1(@swc/core@1.7.26)(esbuild@0.23.1))
babel-preset-modern-browser-extension:
specifier: ^0.7.0
version: 0.7.0(@babel/core@7.25.2)
@@ -186,9 +186,6 @@ importers:
examples/content-extension-config:
dependencies:
- '@svgr/webpack':
- specifier: ^8.1.0
- version: 8.1.0(typescript@5.3.3)
react:
specifier: ^18.1.0
version: 18.3.1
@@ -350,7 +347,7 @@ importers:
devDependencies:
node-polyfill-webpack-plugin:
specifier: ^4.0.0
- version: 4.0.0(webpack@5.92.1(@swc/core@1.7.26))
+ version: 4.0.0(webpack@5.92.1(@swc/core@1.7.26)(esbuild@0.23.1))
typescript:
specifier: 5.3.3
version: 5.3.3
@@ -547,13 +544,13 @@ importers:
version: 7.5.8
jest:
specifier: ^29.7.0
- version: 29.7.0(@types/node@22.5.5)(ts-node@10.9.2(@swc/core@1.7.26)(@types/node@22.5.5)(typescript@5.3.3))
+ version: 29.7.0(@types/node@22.5.5)(ts-node@10.9.2(@swc/core@1.7.26)(@types/node@20.16.5)(typescript@5.3.3))
mock-fs:
specifier: ^5.2.0
version: 5.2.0
ts-jest:
specifier: ^29.1.2
- version: 29.2.5(@babel/core@7.25.2)(@jest/transform@29.7.0)(@jest/types@29.6.3)(babel-jest@29.7.0(@babel/core@7.25.2))(esbuild@0.23.1)(jest@29.7.0(@types/node@22.5.5)(ts-node@10.9.2(@swc/core@1.7.26)(@types/node@22.5.5)(typescript@5.3.3)))(typescript@5.3.3)
+ version: 29.2.5(@babel/core@7.25.2)(@jest/transform@29.7.0)(@jest/types@29.6.3)(babel-jest@29.7.0(@babel/core@7.25.2))(esbuild@0.23.1)(jest@29.7.0(@types/node@22.5.5)(ts-node@10.9.2(@swc/core@1.7.26)(@types/node@20.16.5)(typescript@5.3.3)))(typescript@5.3.3)
tsconfig:
specifier: '*'
version: 7.0.0
@@ -596,10 +593,10 @@ importers:
version: 15.9.0
jest:
specifier: ^29.7.0
- version: 29.7.0(@types/node@22.5.5)(ts-node@10.9.2(@swc/core@1.7.26)(@types/node@22.5.5)(typescript@5.3.3))
+ version: 29.7.0(@types/node@22.5.5)(ts-node@10.9.2(@swc/core@1.7.26)(@types/node@20.16.5)(typescript@5.3.3))
ts-jest:
specifier: ^29.1.2
- version: 29.2.5(@babel/core@7.25.2)(@jest/transform@29.7.0)(@jest/types@29.6.3)(babel-jest@29.7.0(@babel/core@7.25.2))(esbuild@0.23.1)(jest@29.7.0(@types/node@22.5.5)(ts-node@10.9.2(@swc/core@1.7.26)(@types/node@22.5.5)(typescript@5.3.3)))(typescript@5.3.3)
+ version: 29.2.5(@babel/core@7.25.2)(@jest/transform@29.7.0)(@jest/types@29.6.3)(babel-jest@29.7.0(@babel/core@7.25.2))(esbuild@0.23.1)(jest@29.7.0(@types/node@22.5.5)(ts-node@10.9.2(@swc/core@1.7.26)(@types/node@20.16.5)(typescript@5.3.3)))(typescript@5.3.3)
tsconfig:
specifier: '*'
version: 7.0.0
@@ -814,10 +811,10 @@ importers:
version: 8.5.12
jest:
specifier: ^29.7.0
- version: 29.7.0(@types/node@22.5.5)(ts-node@10.9.2(@swc/core@1.7.26)(@types/node@22.5.5)(typescript@5.3.3))
+ version: 29.7.0(@types/node@22.5.5)(ts-node@10.9.2(@swc/core@1.7.26)(@types/node@20.16.5)(typescript@5.3.3))
ts-jest:
specifier: ^29.1.2
- version: 29.2.5(@babel/core@7.25.2)(@jest/transform@29.7.0)(@jest/types@29.6.3)(babel-jest@29.7.0(@babel/core@7.25.2))(esbuild@0.23.1)(jest@29.7.0(@types/node@22.5.5)(ts-node@10.9.2(@swc/core@1.7.26)(@types/node@22.5.5)(typescript@5.3.3)))(typescript@5.3.3)
+ version: 29.2.5(@babel/core@7.25.2)(@jest/transform@29.7.0)(@jest/types@29.6.3)(babel-jest@29.7.0(@babel/core@7.25.2))(esbuild@0.23.1)(jest@29.7.0(@types/node@22.5.5)(ts-node@10.9.2(@swc/core@1.7.26)(@types/node@20.16.5)(typescript@5.3.3)))(typescript@5.3.3)
tsup:
specifier: ^8.0.1
version: 8.2.4(@swc/core@1.7.26)(jiti@1.21.6)(postcss@8.4.47)(typescript@5.3.3)(yaml@2.5.1)
@@ -8144,41 +8141,6 @@ snapshots:
- supports-color
- ts-node
- '@jest/core@29.7.0(ts-node@10.9.2(@swc/core@1.7.26)(@types/node@22.5.5)(typescript@5.3.3))':
- dependencies:
- '@jest/console': 29.7.0
- '@jest/reporters': 29.7.0
- '@jest/test-result': 29.7.0
- '@jest/transform': 29.7.0
- '@jest/types': 29.6.3
- '@types/node': 20.16.5
- ansi-escapes: 4.3.2
- chalk: 4.1.2
- ci-info: 3.9.0
- exit: 0.1.2
- graceful-fs: 4.2.11
- jest-changed-files: 29.7.0
- jest-config: 29.7.0(@types/node@20.16.5)(ts-node@10.9.2(@swc/core@1.7.26)(@types/node@22.5.5)(typescript@5.3.3))
- jest-haste-map: 29.7.0
- jest-message-util: 29.7.0
- jest-regex-util: 29.6.3
- jest-resolve: 29.7.0
- jest-resolve-dependencies: 29.7.0
- jest-runner: 29.7.0
- jest-runtime: 29.7.0
- jest-snapshot: 29.7.0
- jest-util: 29.7.0
- jest-validate: 29.7.0
- jest-watcher: 29.7.0
- micromatch: 4.0.8
- pretty-format: 29.7.0
- slash: 3.0.0
- strip-ansi: 6.0.1
- transitivePeerDependencies:
- - babel-plugin-macros
- - supports-color
- - ts-node
-
'@jest/environment@29.7.0':
dependencies:
'@jest/fake-timers': 29.7.0
@@ -9356,14 +9318,6 @@ snapshots:
find-cache-dir: 4.0.0
schema-utils: 4.2.0
webpack: 5.92.1(@swc/core@1.7.26)(esbuild@0.23.1)
- optional: true
-
- babel-loader@9.1.3(@babel/core@7.25.2)(webpack@5.92.1(@swc/core@1.7.26)):
- dependencies:
- '@babel/core': 7.25.2
- find-cache-dir: 4.0.0
- schema-utils: 4.2.0
- webpack: 5.92.1(@swc/core@1.7.26)
babel-plugin-istanbul@6.1.1:
dependencies:
@@ -9823,13 +9777,13 @@ snapshots:
- supports-color
- ts-node
- create-jest@29.7.0(@types/node@22.5.5)(ts-node@10.9.2(@swc/core@1.7.26)(@types/node@22.5.5)(typescript@5.3.3)):
+ create-jest@29.7.0(@types/node@22.5.5)(ts-node@10.9.2(@swc/core@1.7.26)(@types/node@20.16.5)(typescript@5.3.3)):
dependencies:
'@jest/types': 29.6.3
chalk: 4.1.2
exit: 0.1.2
graceful-fs: 4.2.11
- jest-config: 29.7.0(@types/node@22.5.5)(ts-node@10.9.2(@swc/core@1.7.26)(@types/node@22.5.5)(typescript@5.3.3))
+ jest-config: 29.7.0(@types/node@22.5.5)(ts-node@10.9.2(@swc/core@1.7.26)(@types/node@20.16.5)(typescript@5.3.3))
jest-util: 29.7.0
prompts: 2.4.2
transitivePeerDependencies:
@@ -10988,16 +10942,16 @@ snapshots:
- supports-color
- ts-node
- jest-cli@29.7.0(@types/node@22.5.5)(ts-node@10.9.2(@swc/core@1.7.26)(@types/node@22.5.5)(typescript@5.3.3)):
+ jest-cli@29.7.0(@types/node@22.5.5)(ts-node@10.9.2(@swc/core@1.7.26)(@types/node@20.16.5)(typescript@5.3.3)):
dependencies:
- '@jest/core': 29.7.0(ts-node@10.9.2(@swc/core@1.7.26)(@types/node@22.5.5)(typescript@5.3.3))
+ '@jest/core': 29.7.0(ts-node@10.9.2(@swc/core@1.7.26)(@types/node@20.16.5)(typescript@5.3.3))
'@jest/test-result': 29.7.0
'@jest/types': 29.6.3
chalk: 4.1.2
- create-jest: 29.7.0(@types/node@22.5.5)(ts-node@10.9.2(@swc/core@1.7.26)(@types/node@22.5.5)(typescript@5.3.3))
+ create-jest: 29.7.0(@types/node@22.5.5)(ts-node@10.9.2(@swc/core@1.7.26)(@types/node@20.16.5)(typescript@5.3.3))
exit: 0.1.2
import-local: 3.2.0
- jest-config: 29.7.0(@types/node@22.5.5)(ts-node@10.9.2(@swc/core@1.7.26)(@types/node@22.5.5)(typescript@5.3.3))
+ jest-config: 29.7.0(@types/node@22.5.5)(ts-node@10.9.2(@swc/core@1.7.26)(@types/node@20.16.5)(typescript@5.3.3))
jest-util: 29.7.0
jest-validate: 29.7.0
yargs: 17.7.2
@@ -11038,38 +10992,7 @@ snapshots:
- babel-plugin-macros
- supports-color
- jest-config@29.7.0(@types/node@20.16.5)(ts-node@10.9.2(@swc/core@1.7.26)(@types/node@22.5.5)(typescript@5.3.3)):
- dependencies:
- '@babel/core': 7.25.2
- '@jest/test-sequencer': 29.7.0
- '@jest/types': 29.6.3
- babel-jest: 29.7.0(@babel/core@7.25.2)
- chalk: 4.1.2
- ci-info: 3.9.0
- deepmerge: 4.3.1
- glob: 7.2.3
- graceful-fs: 4.2.11
- jest-circus: 29.7.0
- jest-environment-node: 29.7.0
- jest-get-type: 29.6.3
- jest-regex-util: 29.6.3
- jest-resolve: 29.7.0
- jest-runner: 29.7.0
- jest-util: 29.7.0
- jest-validate: 29.7.0
- micromatch: 4.0.8
- parse-json: 5.2.0
- pretty-format: 29.7.0
- slash: 3.0.0
- strip-json-comments: 3.1.1
- optionalDependencies:
- '@types/node': 20.16.5
- ts-node: 10.9.2(@swc/core@1.7.26)(@types/node@22.5.5)(typescript@5.3.3)
- transitivePeerDependencies:
- - babel-plugin-macros
- - supports-color
-
- jest-config@29.7.0(@types/node@22.5.5)(ts-node@10.9.2(@swc/core@1.7.26)(@types/node@22.5.5)(typescript@5.3.3)):
+ jest-config@29.7.0(@types/node@22.5.5)(ts-node@10.9.2(@swc/core@1.7.26)(@types/node@20.16.5)(typescript@5.3.3)):
dependencies:
'@babel/core': 7.25.2
'@jest/test-sequencer': 29.7.0
@@ -11095,7 +11018,7 @@ snapshots:
strip-json-comments: 3.1.1
optionalDependencies:
'@types/node': 22.5.5
- ts-node: 10.9.2(@swc/core@1.7.26)(@types/node@22.5.5)(typescript@5.3.3)
+ ts-node: 10.9.2(@swc/core@1.7.26)(@types/node@20.16.5)(typescript@5.3.3)
transitivePeerDependencies:
- babel-plugin-macros
- supports-color
@@ -11333,12 +11256,12 @@ snapshots:
- supports-color
- ts-node
- jest@29.7.0(@types/node@22.5.5)(ts-node@10.9.2(@swc/core@1.7.26)(@types/node@22.5.5)(typescript@5.3.3)):
+ jest@29.7.0(@types/node@22.5.5)(ts-node@10.9.2(@swc/core@1.7.26)(@types/node@20.16.5)(typescript@5.3.3)):
dependencies:
- '@jest/core': 29.7.0(ts-node@10.9.2(@swc/core@1.7.26)(@types/node@22.5.5)(typescript@5.3.3))
+ '@jest/core': 29.7.0(ts-node@10.9.2(@swc/core@1.7.26)(@types/node@20.16.5)(typescript@5.3.3))
'@jest/types': 29.6.3
import-local: 3.2.0
- jest-cli: 29.7.0(@types/node@22.5.5)(ts-node@10.9.2(@swc/core@1.7.26)(@types/node@22.5.5)(typescript@5.3.3))
+ jest-cli: 29.7.0(@types/node@22.5.5)(ts-node@10.9.2(@swc/core@1.7.26)(@types/node@20.16.5)(typescript@5.3.3))
transitivePeerDependencies:
- '@types/node'
- babel-plugin-macros
@@ -11653,7 +11576,7 @@ snapshots:
node-int64@0.4.0: {}
- node-polyfill-webpack-plugin@4.0.0(webpack@5.92.1(@swc/core@1.7.26)):
+ node-polyfill-webpack-plugin@4.0.0(webpack@5.92.1(@swc/core@1.7.26)(esbuild@0.23.1)):
dependencies:
assert: 2.1.0
browserify-zlib: 0.2.0
@@ -11679,7 +11602,7 @@ snapshots:
url: 0.11.4
util: 0.12.5
vm-browserify: 1.1.2
- webpack: 5.92.1(@swc/core@1.7.26)
+ webpack: 5.92.1(@swc/core@1.7.26)(esbuild@0.23.1)
node-releases@2.0.18: {}
@@ -13022,17 +12945,6 @@ snapshots:
'@swc/core': 1.7.26
esbuild: 0.23.1
- terser-webpack-plugin@5.3.10(@swc/core@1.7.26)(webpack@5.92.1(@swc/core@1.7.26)):
- dependencies:
- '@jridgewell/trace-mapping': 0.3.25
- jest-worker: 27.5.1
- schema-utils: 3.3.0
- serialize-javascript: 6.0.2
- terser: 5.32.0
- webpack: 5.92.1(@swc/core@1.7.26)
- optionalDependencies:
- '@swc/core': 1.7.26
-
terser@5.32.0:
dependencies:
'@jridgewell/source-map': 0.3.6
@@ -13107,12 +13019,12 @@ snapshots:
ts-interface-checker@0.1.13: {}
- ts-jest@29.2.5(@babel/core@7.25.2)(@jest/transform@29.7.0)(@jest/types@29.6.3)(babel-jest@29.7.0(@babel/core@7.25.2))(esbuild@0.23.1)(jest@29.7.0(@types/node@22.5.5)(ts-node@10.9.2(@swc/core@1.7.26)(@types/node@22.5.5)(typescript@5.3.3)))(typescript@5.3.3):
+ ts-jest@29.2.5(@babel/core@7.25.2)(@jest/transform@29.7.0)(@jest/types@29.6.3)(babel-jest@29.7.0(@babel/core@7.25.2))(esbuild@0.23.1)(jest@29.7.0(@types/node@20.16.5)(ts-node@10.9.2(@swc/core@1.7.26)(@types/node@20.16.5)(typescript@5.3.3)))(typescript@5.3.3):
dependencies:
bs-logger: 0.2.6
ejs: 3.1.10
fast-json-stable-stringify: 2.1.0
- jest: 29.7.0(@types/node@22.5.5)(ts-node@10.9.2(@swc/core@1.7.26)(@types/node@22.5.5)(typescript@5.3.3))
+ jest: 29.7.0(@types/node@20.16.5)(ts-node@10.9.2(@swc/core@1.7.26)(@types/node@20.16.5)(typescript@5.3.3))
jest-util: 29.7.0
json5: 2.2.3
lodash.memoize: 4.1.2
@@ -13127,12 +13039,12 @@ snapshots:
babel-jest: 29.7.0(@babel/core@7.25.2)
esbuild: 0.23.1
- ts-jest@29.2.5(@babel/core@7.25.2)(@jest/transform@29.7.0)(@jest/types@29.6.3)(babel-jest@29.7.0(@babel/core@7.25.2))(jest@29.7.0(@types/node@20.16.5)(ts-node@10.9.2(@swc/core@1.7.26)(@types/node@20.16.5)(typescript@5.3.3)))(typescript@5.3.3):
+ ts-jest@29.2.5(@babel/core@7.25.2)(@jest/transform@29.7.0)(@jest/types@29.6.3)(babel-jest@29.7.0(@babel/core@7.25.2))(esbuild@0.23.1)(jest@29.7.0(@types/node@22.5.5)(ts-node@10.9.2(@swc/core@1.7.26)(@types/node@20.16.5)(typescript@5.3.3)))(typescript@5.3.3):
dependencies:
bs-logger: 0.2.6
ejs: 3.1.10
fast-json-stable-stringify: 2.1.0
- jest: 29.7.0(@types/node@20.16.5)(ts-node@10.9.2(@swc/core@1.7.26)(@types/node@20.16.5)(typescript@5.3.3))
+ jest: 29.7.0(@types/node@22.5.5)(ts-node@10.9.2(@swc/core@1.7.26)(@types/node@20.16.5)(typescript@5.3.3))
jest-util: 29.7.0
json5: 2.2.3
lodash.memoize: 4.1.2
@@ -13145,6 +13057,7 @@ snapshots:
'@jest/transform': 29.7.0
'@jest/types': 29.6.3
babel-jest: 29.7.0(@babel/core@7.25.2)
+ esbuild: 0.23.1
ts-node@10.9.2(@swc/core@1.7.26)(@types/node@20.16.5)(typescript@5.3.3):
dependencies:
@@ -13466,37 +13379,6 @@ snapshots:
dependencies:
webpack: 5.92.1(@swc/core@1.7.26)(esbuild@0.23.1)
- webpack@5.92.1(@swc/core@1.7.26):
- dependencies:
- '@types/eslint-scope': 3.7.7
- '@types/estree': 1.0.5
- '@webassemblyjs/ast': 1.12.1
- '@webassemblyjs/wasm-edit': 1.12.1
- '@webassemblyjs/wasm-parser': 1.12.1
- acorn: 8.12.1
- acorn-import-attributes: 1.9.5(acorn@8.12.1)
- browserslist: 4.23.3
- chrome-trace-event: 1.0.4
- enhanced-resolve: 5.17.1
- es-module-lexer: 1.5.4
- eslint-scope: 5.1.1
- events: 3.3.0
- glob-to-regexp: 0.4.1
- graceful-fs: 4.2.11
- json-parse-even-better-errors: 2.3.1
- loader-runner: 4.3.0
- mime-types: 2.1.35
- neo-async: 2.6.2
- schema-utils: 3.3.0
- tapable: 2.2.1
- terser-webpack-plugin: 5.3.10(@swc/core@1.7.26)(webpack@5.92.1(@swc/core@1.7.26))
- watchpack: 2.4.2
- webpack-sources: 3.2.3
- transitivePeerDependencies:
- - '@swc/core'
- - esbuild
- - uglify-js
-
webpack@5.92.1(@swc/core@1.7.26)(esbuild@0.23.1):
dependencies:
'@types/eslint-scope': 3.7.7
diff --git a/programs/cli/cli.ts b/programs/cli/cli.ts
index ab99ec96..4762dc5c 100755
--- a/programs/cli/cli.ts
+++ b/programs/cli/cli.ts
@@ -15,14 +15,17 @@ import {
extensionStart,
type StartOptions,
extensionBuild,
- type BuildOptions
- // extensionPreview
+ type BuildOptions,
+ // extensionPreview,
+ type FileConfig
} from 'extension-develop'
import * as messages from './cli-lib/messages'
import type {BrowsersSupported} from './types'
import checkUpdates from './check-updates'
import packageJson from './package.json'
+export {type FileConfig}
+
// Before all, check for updates.
checkUpdates(packageJson)
diff --git a/programs/develop/commands/commands-lib/config-types.ts b/programs/develop/commands/commands-lib/config-types.ts
index 41b53771..fd616335 100644
--- a/programs/develop/commands/commands-lib/config-types.ts
+++ b/programs/develop/commands/commands-lib/config-types.ts
@@ -1,5 +1,13 @@
import {Configuration} from 'webpack'
+import {DevOptions} from '../dev'
+import {StartOptions} from '../start'
+import {PreviewOptions} from '../preview'
+import {BuildOptions} from '../build'
export interface FileConfig {
+ dev: DevOptions
+ start: StartOptions
+ preview: PreviewOptions
+ build: BuildOptions
config: (config: Configuration) => Configuration
}
diff --git a/programs/develop/commands/commands-lib/get-extension-config.ts b/programs/develop/commands/commands-lib/get-extension-config.ts
index 168aaff7..d28a26c4 100644
--- a/programs/develop/commands/commands-lib/get-extension-config.ts
+++ b/programs/develop/commands/commands-lib/get-extension-config.ts
@@ -2,6 +2,7 @@ import fs from 'fs'
import path from 'path'
import {Configuration} from 'webpack'
import {FileConfig} from './config-types'
+import {DevOptions} from '../../commands/dev'
import * as messages from './messages'
export function loadExtensionConfig(projectPath: string) {
@@ -21,10 +22,51 @@ export function loadExtensionConfig(projectPath: string) {
return (config: Configuration) => config
}
+export function loadCommandConfig(
+ projectPath: string,
+ command: 'dev' | 'build' | 'start' | 'preview'
+) {
+ const userConfigPath = path.join(projectPath, 'extension.config.js')
+
+ if (fs.existsSync(userConfigPath)) {
+ if (isUsingExtensionConfig(projectPath)) {
+ const userConfig: any = require(userConfigPath)
+ if (userConfig && userConfig != null) {
+ return userConfig![command]
+ }
+ }
+ }
+
+ return {}
+}
+
+export function loadBrowserConfig(
+ projectPath: string,
+ browser: DevOptions['browser']
+) {
+ const userConfigPath = path.join(projectPath, 'extension.config.js')
+
+ if (fs.existsSync(userConfigPath)) {
+ if (isUsingExtensionConfig(projectPath)) {
+ const userConfig: any = require(userConfigPath)
+ if (userConfig && userConfig != null) {
+ return userConfig.browsers![browser]
+ }
+ }
+ }
+
+ return {}
+}
+
+let userMessageDelivered = false
+
export function isUsingExtensionConfig(projectPath: string) {
const configPath = path.join(projectPath, 'extension.config.js')
if (fs.existsSync(configPath)) {
- console.log(messages.isUsingExtensionConfig('extension.config.js'))
+ if (!userMessageDelivered) {
+ console.log(messages.isUsingExtensionConfig('extension.config.js'))
+ userMessageDelivered = true
+ }
return true
} else {
return false
diff --git a/programs/develop/plugin-browsers/index.ts b/programs/develop/plugin-browsers/index.ts
index 22182b7d..e4572799 100644
--- a/programs/develop/plugin-browsers/index.ts
+++ b/programs/develop/plugin-browsers/index.ts
@@ -5,6 +5,7 @@ import {type PluginInterface} from './browsers-types'
import {RunChromiumPlugin} from './run-chromium'
import {RunFirefoxPlugin} from './run-firefox'
import {DevOptions} from '../commands/dev'
+import {loadBrowserConfig} from '../commands/commands-lib/get-extension-config'
/**
* BrowsersPlugin works by finding the binary for the browser specified in the
@@ -84,27 +85,32 @@ export class BrowsersPlugin {
this.browser,
this.userDataDir || this.profile
),
+ startingUrl: this.startingUrl,
chromiumBinary: this.chromiumBinary,
geckoBinary: this.geckoBinary
}
- console.log('browser', this.browser)
+ const browserConfig = {
+ ...config,
+ ...loadBrowserConfig(compiler.context, this.browser)
+ }
+
switch (this.browser) {
case 'chrome':
case 'edge':
case 'chromium-based': {
- new RunChromiumPlugin(config).apply(compiler)
+ new RunChromiumPlugin(browserConfig).apply(compiler)
break
}
case 'firefox':
case 'gecko-based':
- new RunFirefoxPlugin(config).apply(compiler)
+ new RunFirefoxPlugin(browserConfig).apply(compiler)
break
default: {
new RunChromiumPlugin({
- ...config,
+ ...browserConfig,
browser: 'chrome'
}).apply(compiler)
break
diff --git a/programs/develop/plugin-browsers/run-chromium/browser-config.ts b/programs/develop/plugin-browsers/run-chromium/browser-config.ts
index 666ebf9e..2b3b5ab7 100644
--- a/programs/develop/plugin-browsers/run-chromium/browser-config.ts
+++ b/programs/develop/plugin-browsers/run-chromium/browser-config.ts
@@ -9,7 +9,7 @@ export function browserConfig(configOptions: PluginInterface) {
const userProfilePath = createProfile(
configOptions.browser,
configOptions.profile,
- false
+ configOptions.preferences
)
// Flags set by default:
diff --git a/programs/develop/plugin-browsers/run-chromium/create-profile.ts b/programs/develop/plugin-browsers/run-chromium/create-profile.ts
index 82377023..c6ee18ee 100644
--- a/programs/develop/plugin-browsers/run-chromium/create-profile.ts
+++ b/programs/develop/plugin-browsers/run-chromium/create-profile.ts
@@ -10,8 +10,8 @@ import {DevOptions} from '../../commands/dev'
export function createProfile(
browser: DevOptions['browser'],
- profilePath?: string,
- silent?: boolean
+ profilePath: string | undefined,
+ configPreferences: DevOptions['preferences']
) {
if (profilePath && fs.existsSync(profilePath)) {
return profilePath
@@ -24,22 +24,20 @@ export function createProfile(
const preferences =
browser === 'chrome' ? chromeMasterPreferences : edgeMasterPreferences
- const userProfile = JSON.stringify(preferences)
+ const userProfile = JSON.stringify({...preferences, ...configPreferences})
- if (!silent) {
- addProgressBar(messages.creatingUserProfile(browser), () => {
- const profilePath = path.resolve(__dirname, `run-${browser}-profile`)
- const preferences = path.join(profilePath, 'Default')
+ addProgressBar(messages.creatingUserProfile(browser), () => {
+ const profilePath = path.resolve(__dirname, `run-${browser}-profile`)
+ const preferences = path.join(profilePath, 'Default')
- // Ensure directory exists
- fs.mkdirSync(preferences, {recursive: true})
+ // Ensure directory exists
+ fs.mkdirSync(preferences, {recursive: true})
- const preferencesPath = path.join(preferences, 'Preferences')
+ const preferencesPath = path.join(preferences, 'Preferences')
- // Actually write the user preferences
- fs.writeFileSync(preferencesPath, userProfile, 'utf8')
- })
- }
+ // Actually write the user preferences
+ fs.writeFileSync(preferencesPath, userProfile, 'utf8')
+ })
return path.resolve(__dirname, `run-${browser}-profile`)
}
diff --git a/programs/develop/plugin-browsers/run-chromium/index.ts b/programs/develop/plugin-browsers/run-chromium/index.ts
index a6e4bea8..5fd8216e 100644
--- a/programs/develop/plugin-browsers/run-chromium/index.ts
+++ b/programs/develop/plugin-browsers/run-chromium/index.ts
@@ -67,6 +67,7 @@ export class RunChromiumPlugin {
}
const chromiumConfig = browserConfig(this)
+ console.log('asdlasdlasdaldjsalds', this.startingUrl)
const launchArgs = this.startingUrl
? [this.startingUrl, ...chromiumConfig]
: [...chromiumConfig]
diff --git a/programs/develop/plugin-browsers/run-firefox/firefox/browser-config.ts b/programs/develop/plugin-browsers/run-firefox/firefox/browser-config.ts
index 36910fff..f13c5ea2 100644
--- a/programs/develop/plugin-browsers/run-firefox/firefox/browser-config.ts
+++ b/programs/develop/plugin-browsers/run-firefox/firefox/browser-config.ts
@@ -1,29 +1,24 @@
import {Compiler} from 'webpack'
import {createUserDataDir} from './create-profile'
-import {type PluginInterface} from '../../browsers-types'
+import {type DevOptions} from '../../../commands/dev'
export async function browserConfig(
compiler: Compiler,
- configOptions: PluginInterface
+ configOptions: DevOptions
) {
const {
browser,
startingUrl,
preferences,
userDataDir,
- browserConsole = false,
browserFlags = []
} = configOptions
- const profile = createUserDataDir(browser, userDataDir, preferences)
+ const userProfilePath = createUserDataDir(browser, userDataDir, preferences)
const binaryArgs: string[] = []
if (startingUrl) {
- binaryArgs.push(`--url "${startingUrl}"`)
- }
-
- if (browserConsole) {
- binaryArgs.push('--jsconsole')
+ binaryArgs.push(`--url=${startingUrl}`)
}
if (browserFlags) {
@@ -35,9 +30,9 @@ export async function browserConfig(
: 9222
return [
- `--binary-args "${browserFlags.join(' ')}"`,
- `--profile "${profile.path()}"`,
- `--listen ${port}`,
+ `--binary-args="${binaryArgs.join(' ')}"`,
+ `--profile="${userProfilePath.path()}"`,
+ `--listen=${port}`,
'--verbose'
].join(' ')
}
diff --git a/programs/develop/plugin-browsers/run-firefox/firefox/create-profile.ts b/programs/develop/plugin-browsers/run-firefox/firefox/create-profile.ts
index 1882d839..9b0b72ab 100644
--- a/programs/develop/plugin-browsers/run-firefox/firefox/create-profile.ts
+++ b/programs/develop/plugin-browsers/run-firefox/firefox/create-profile.ts
@@ -5,16 +5,24 @@ import {getPreferences} from './master-preferences'
import * as messages from '../../browsers-lib/messages'
import {addProgressBar} from '../../browsers-lib/add-progress-bar'
import {DevOptions} from '../../../commands/dev'
+import {loadBrowserConfig} from '../../../commands/commands-lib/get-extension-config'
function configureProfile(
profile: FirefoxProfile,
customPreferences: Record
) {
- const preferences: Record = getPreferences(customPreferences)
- const preferenceKeys = Object.keys(preferences)
+ const firefoxMasterPreferences: Record = {
+ ...loadBrowserConfig(path.resolve(__dirname, 'run-firefox'), 'firefox'),
+ ...getPreferences(customPreferences)
+ }
+
+ const preferenceKeys = Object.keys(firefoxMasterPreferences)
preferenceKeys.forEach((preference) => {
- profile.setPreference(preference, preferences[preference] as string)
+ profile.setPreference(
+ preference,
+ firefoxMasterPreferences[preference] as string
+ )
})
const customPreferenceKeys = Object.keys(customPreferences)
@@ -36,7 +44,7 @@ function createProfile(
) {
const profile = new FirefoxProfile({destinationDirectory})
const profileConfigured = configureProfile(profile, customPreferences)
-
+ console.log({profileConfigured})
return profileConfigured
}
@@ -64,21 +72,25 @@ function getProfile(
export function createUserDataDir(
browser: DevOptions['browser'],
dataDirPath: string | undefined,
- preferences?: Record,
- silent?: boolean
+ configPreferences: DevOptions['preferences']
) {
let profile: FirefoxProfile
const dataDir = dataDirPath || path.resolve(__dirname, 'run-firefox-data-dir')
+ const firefoxMasterPreferences: Record = getPreferences(
+ configPreferences || {}
+ )
+
+ const preferences = firefoxMasterPreferences
+
+ const userPreferences = {...preferences, ...configPreferences}
if (fs.existsSync(dataDir)) {
- profile = getProfile(browser, dataDir, preferences || {})
+ profile = getProfile(browser, dataDir, userPreferences)
} else {
- if (!silent) {
- addProgressBar(messages.creatingUserProfile(browser), () => {})
- }
+ addProgressBar(messages.creatingUserProfile(browser), () => {})
fs.mkdirSync(dataDir, {recursive: true})
- profile = createProfile(dataDir, preferences || {})
+ profile = createProfile(dataDir, userPreferences)
}
return profile
diff --git a/programs/develop/plugin-browsers/run-firefox/index.ts b/programs/develop/plugin-browsers/run-firefox/index.ts
index 7bed62e5..6e4a5037 100644
--- a/programs/develop/plugin-browsers/run-firefox/index.ts
+++ b/programs/develop/plugin-browsers/run-firefox/index.ts
@@ -71,15 +71,12 @@ export class RunFirefoxPlugin {
}
}
- private async launchFirefox(
- compiler: Compiler,
- browser: DevOptions['browser']
- ) {
+ private async launchFirefox(compiler: Compiler, options: DevOptions) {
const fxRunnerCmd = await this.getFxRunnerCommand()
let browserBinaryLocation: string
- switch (browser) {
+ switch (options.browser) {
case 'gecko-based':
browserBinaryLocation = path.normalize(this.geckoBinary!)
break
@@ -101,7 +98,7 @@ export class RunFirefoxPlugin {
process.exit(1)
}
- const firefoxConfig = await browserConfig(compiler, this)
+ const firefoxConfig = await browserConfig(compiler, options)
const cmd = `${firefoxLaunchPath} ${firefoxConfig}`
child = exec(cmd, (error, _stdout, stderr) => {
@@ -161,7 +158,15 @@ export class RunFirefoxPlugin {
)
}, 2000)
- await this.launchFirefox(compiler, this.browser)
+ await this.launchFirefox(compiler, {
+ browser: this.browser,
+ browserFlags: this.browserFlags,
+ userDataDir: this.userDataDir,
+ profile: this.profile,
+ preferences: this.preferences,
+ startingUrl: this.startingUrl,
+ mode: compilation.compilation.options.mode
+ })
firefoxDidLaunch = true
done()
diff --git a/programs/develop/webpack/dev-server.ts b/programs/develop/webpack/dev-server.ts
index b0e01ca3..0c57a563 100644
--- a/programs/develop/webpack/dev-server.ts
+++ b/programs/develop/webpack/dev-server.ts
@@ -12,7 +12,10 @@ import {merge} from 'webpack-merge'
import webpackConfig from './webpack-config'
import type {DevOptions} from '../commands/dev'
import * as utils from './lib/utils'
-import {loadExtensionConfig} from '../commands/commands-lib/get-extension-config'
+import {
+ loadCommandConfig,
+ loadExtensionConfig
+} from '../commands/commands-lib/get-extension-config'
function closeAll(devServer: WebpackDevServer) {
devServer
@@ -29,8 +32,10 @@ export async function devServer(
projectPath: string,
{...devOptions}: DevOptions
) {
+ const commandConfig = loadCommandConfig(projectPath, 'dev')
const baseConfig = webpackConfig(projectPath, {
...devOptions,
+ ...commandConfig,
mode: 'development'
})
const userExtensionConfig = loadExtensionConfig(projectPath)
diff --git a/programs/develop/webpack/lib/messages.ts b/programs/develop/webpack/lib/messages.ts
index 10d69ea5..be4b21bd 100644
--- a/programs/develop/webpack/lib/messages.ts
+++ b/programs/develop/webpack/lib/messages.ts
@@ -30,7 +30,7 @@ function getLoggingPrefix(feature: string, type: PrefixType): string {
const arrow = type === 'info' ? cyan('►►►') : brightGreen('►►►')
- return `${arrow} ${feature}`
+ return `${arrow} ${cyan(feature)}`
}
export function capitalizedBrowserName(browser: DevOptions['browser']) {
diff --git a/programs/develop/webpack/plugin-extension/index.ts b/programs/develop/webpack/plugin-extension/index.ts
index 338d12a7..fc625e04 100644
--- a/programs/develop/webpack/plugin-extension/index.ts
+++ b/programs/develop/webpack/plugin-extension/index.ts
@@ -45,7 +45,7 @@ export class ExtensionPlugin {
const manifestFieldsData = getManifestFieldsData({manifestPath})
const specialFoldersData = getSpecialFoldersData({manifestPath})
- process.env.EXTENSION_ENV === 'development' &&
+ process.env.EXPERIMENTAL_EXTENSION_RESOLVER_PLUGIN &&
new ResolvePlugin({
manifestPath,
includeList: {
diff --git a/programs/develop/webpack/webpack-config.ts b/programs/develop/webpack/webpack-config.ts
index 57b97bdc..163a789e 100644
--- a/programs/develop/webpack/webpack-config.ts
+++ b/programs/develop/webpack/webpack-config.ts
@@ -102,7 +102,7 @@ export default function webpackConfig(
new JsFrameworksPlugin({
manifestPath
}),
- process.env.EXTENSION_ENV === 'development' &&
+ process.env.EXPERIMENTAL_ERRORS_PLUGIN &&
new ErrorsPlugin({
manifestPath,
browser