browser-extension-manager 1.3.21 → 1.3.23
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/CLAUDE.md +11 -11
- package/README.md +3 -3
- package/bin/browser-extension-manager +1 -1
- package/dist/background.js +7 -7
- package/dist/build.js +1 -1
- package/dist/defaults/CLAUDE.md +2 -2
- package/dist/gulp/loaders/webpack/strip-dev-blocks-loader.js +1 -1
- package/dist/gulp/tasks/defaults.js +1 -1
- package/dist/gulp/tasks/package.js +5 -5
- package/dist/gulp/tasks/webpack.js +22 -18
- package/dist/index.js +1 -1
- package/dist/lib/auth-helpers.js +1 -1
- package/dist/options.js +1 -1
- package/dist/page.js +1 -1
- package/dist/popup.js +1 -1
- package/dist/sidepanel.js +1 -1
- package/package.json +8 -8
- package/dist/gulp/plugins/webpack/strip-dev-blocks.js +0 -53
package/CLAUDE.md
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
# Browser Extension Manager (
|
|
1
|
+
# Browser Extension Manager (BXM)
|
|
2
2
|
|
|
3
3
|
## Identity
|
|
4
4
|
|
|
5
|
-
Browser Extension Manager (
|
|
5
|
+
Browser Extension Manager (BXM) is a comprehensive framework for building modern browser extensions. It provides a template-based development system with built-in build tools, component architecture, theming support, and best practices for creating cross-browser extensions.
|
|
6
6
|
|
|
7
7
|
## Quick Start
|
|
8
8
|
|
|
9
|
-
### For Consuming Projects (Extensions Built Using
|
|
9
|
+
### For Consuming Projects (Extensions Built Using BXM)
|
|
10
10
|
1. Run `npx bxm setup` to initialize the project
|
|
11
11
|
2. Run `npm start` to start development
|
|
12
12
|
3. Load `packaged/raw/` directory in browser as unpacked extension
|
|
@@ -14,7 +14,7 @@ Browser Extension Manager (BEM) is a comprehensive framework for building modern
|
|
|
14
14
|
|
|
15
15
|
### For Framework Development (This Repository)
|
|
16
16
|
1. Run `npm start` to watch and compile framework changes
|
|
17
|
-
2. Test changes in a consuming project by linking: `npm link` (in
|
|
17
|
+
2. Test changes in a consuming project by linking: `npm link` (in BXM) then `npm link browser-extension-manager` (in consuming project)
|
|
18
18
|
3. Changes in `src/` compile to `dist/` automatically
|
|
19
19
|
|
|
20
20
|
## Architecture Overview
|
|
@@ -131,7 +131,7 @@ browser-extension-manager/
|
|
|
131
131
|
|
|
132
132
|
## Consuming Project Structure
|
|
133
133
|
|
|
134
|
-
When users create a project using
|
|
134
|
+
When users create a project using BXM, they get this structure:
|
|
135
135
|
|
|
136
136
|
```
|
|
137
137
|
my-extension/
|
|
@@ -149,7 +149,7 @@ my-extension/
|
|
|
149
149
|
│ ├── _locales/ # i18n translations
|
|
150
150
|
│ └── manifest.json # Extension manifest
|
|
151
151
|
├── config/
|
|
152
|
-
│ └── config.json #
|
|
152
|
+
│ └── config.json # BXM configuration
|
|
153
153
|
├── hooks/
|
|
154
154
|
│ ├── build:pre.js # Pre-build hook
|
|
155
155
|
│ └── build:post.js # Post-build hook
|
|
@@ -354,7 +354,7 @@ Provides cross-context auth synchronization and reusable auth UI event handlers.
|
|
|
354
354
|
|
|
355
355
|
### Cross-Context Auth Architecture
|
|
356
356
|
|
|
357
|
-
**Background.js is the source of truth** for authentication. Browser extensions have multiple isolated JavaScript contexts (background, popup, options, pages, sidepanel) - each runs its own Firebase instance.
|
|
357
|
+
**Background.js is the source of truth** for authentication. Browser extensions have multiple isolated JavaScript contexts (background, popup, options, pages, sidepanel) - each runs its own Firebase instance. BXM syncs them via messaging (no storage).
|
|
358
358
|
|
|
359
359
|
**Sign-in Flow:**
|
|
360
360
|
```
|
|
@@ -395,7 +395,7 @@ User clicks .auth-signout-btn
|
|
|
395
395
|
|
|
396
396
|
2. **Firebase in service workers**: Static ES6 imports are required. Dynamic `import()` fails with webpack chunking in service workers.
|
|
397
397
|
|
|
398
|
-
3. **Config path**: `authDomain` is at `config.firebase.app.config.authDomain` (loaded via
|
|
398
|
+
3. **Config path**: `authDomain` is at `config.firebase.app.config.authDomain` (loaded via BXM_BUILD_JSON).
|
|
399
399
|
|
|
400
400
|
4. **Required permission**: `tabs` permission needed for `tabs.onUpdated` listener.
|
|
401
401
|
|
|
@@ -711,7 +711,7 @@ new ReplacePlugin({
|
|
|
711
711
|
|
|
712
712
|
1. **Rebuild framework:** `npm run prepare`
|
|
713
713
|
2. **Reinstall in consuming project:** `npm install browser-extension-manager@latest`
|
|
714
|
-
3. **Or use local link:** `npm link` (in
|
|
714
|
+
3. **Or use local link:** `npm link` (in BXM) then `npm link browser-extension-manager` (in project)
|
|
715
715
|
|
|
716
716
|
### Gulp task errors
|
|
717
717
|
|
|
@@ -736,7 +736,7 @@ new ReplacePlugin({
|
|
|
736
736
|
## Notable Dependencies
|
|
737
737
|
|
|
738
738
|
### Web Manager
|
|
739
|
-
|
|
739
|
+
BXM integrates **Web Manager** for Firebase, analytics, and web services functionality. Each component manager initializes Web Manager automatically with configuration from `config/config.json`.
|
|
740
740
|
|
|
741
741
|
**Web Manager API:**
|
|
742
742
|
- Study the Web Manager API and documentation in the sibling repository
|
|
@@ -744,7 +744,7 @@ BEM integrates **Web Manager** for Firebase, analytics, and web services functio
|
|
|
744
744
|
- GitHub: https://github.com/itw-creative-works/web-manager
|
|
745
745
|
- npm: https://www.npmjs.com/package/web-manager
|
|
746
746
|
|
|
747
|
-
**Usage in
|
|
747
|
+
**Usage in BXM:**
|
|
748
748
|
```javascript
|
|
749
749
|
const Manager = new (require('browser-extension-manager/popup'));
|
|
750
750
|
|
package/README.md
CHANGED
|
@@ -46,7 +46,7 @@ npm start
|
|
|
46
46
|
1. Simply run `npx bxm setup` in Terminal to get all the latest updates from the **Ultimate Browser Extension template**.
|
|
47
47
|
|
|
48
48
|
## 🌐 Automatic Translation
|
|
49
|
-
When you run `npm run build`,
|
|
49
|
+
When you run `npm run build`, BXM automatically translates your `src/_locales/en/messages.json` to 16 languages using Claude CLI:
|
|
50
50
|
`zh`, `es`, `hi`, `ar`, `pt`, `ru`, `ja`, `de`, `fr`, `ko`, `ur`, `id`, `bn`, `tl`, `vi`, `it`
|
|
51
51
|
|
|
52
52
|
Only missing translations are generated - existing translations are preserved.
|
|
@@ -58,7 +58,7 @@ Only missing translations are generated - existing translations are preserved.
|
|
|
58
58
|
2. Upload the `.zip` file to the browser's extension store.
|
|
59
59
|
|
|
60
60
|
### Automatic Publishing
|
|
61
|
-
|
|
61
|
+
BXM can automatically publish to Chrome, Firefox, and Edge stores when `BXM_IS_PUBLISH=true`:
|
|
62
62
|
|
|
63
63
|
```bash
|
|
64
64
|
BXM_IS_PUBLISH=true npm run build
|
|
@@ -88,7 +88,7 @@ Only stores with configured credentials will be published to.
|
|
|
88
88
|
|
|
89
89
|
## 🔐 Authentication
|
|
90
90
|
|
|
91
|
-
|
|
91
|
+
BXM provides built-in authentication that syncs across all extension contexts (popup, options, pages, sidepanel, background).
|
|
92
92
|
|
|
93
93
|
### How It Works
|
|
94
94
|
|
package/dist/background.js
CHANGED
|
@@ -27,13 +27,13 @@ class Manager {
|
|
|
27
27
|
this.serviceWorker = null;
|
|
28
28
|
|
|
29
29
|
// Load config from build.js
|
|
30
|
-
this.config = serviceWorker.
|
|
30
|
+
this.config = serviceWorker.BXM_BUILD_JSON?.config || {};
|
|
31
31
|
|
|
32
32
|
// Defaults
|
|
33
33
|
this.version = this.config?.version || 'unknown';
|
|
34
34
|
this.brand = this.config?.brand || { name: 'unknown' };
|
|
35
35
|
this.app = this.config?.app?.id || 'extension';
|
|
36
|
-
this.environment = this.config?.
|
|
36
|
+
this.environment = this.config?.bxm?.environment || 'production';
|
|
37
37
|
this.libraries = {
|
|
38
38
|
firebase: null,
|
|
39
39
|
firebaseAuth: null,
|
|
@@ -41,7 +41,7 @@ class Manager {
|
|
|
41
41
|
promoServer: false,
|
|
42
42
|
};
|
|
43
43
|
this.cache = {
|
|
44
|
-
breaker: this.config?.
|
|
44
|
+
breaker: this.config?.bxm?.cache_breaker || new Date().getTime(),
|
|
45
45
|
name: ''
|
|
46
46
|
};
|
|
47
47
|
}
|
|
@@ -73,7 +73,7 @@ class Manager {
|
|
|
73
73
|
|
|
74
74
|
// Log
|
|
75
75
|
this.logger.log('Initialized!', this.version, this.cache.name, this);
|
|
76
|
-
this.logger.log('Config loaded from
|
|
76
|
+
this.logger.log('Config loaded from BXM_BUILD_JSON:', this.config);
|
|
77
77
|
|
|
78
78
|
// Return manager instance
|
|
79
79
|
return this;
|
|
@@ -318,7 +318,7 @@ class Manager {
|
|
|
318
318
|
// DEBUG: Log the full config to see what we have
|
|
319
319
|
console.log('[AUTH] setupAuthTokenListener called');
|
|
320
320
|
console.log('[AUTH] this.config:', this.config);
|
|
321
|
-
console.log('[AUTH]
|
|
321
|
+
console.log('[AUTH] BXM_BUILD_JSON:', serviceWorker.BXM_BUILD_JSON);
|
|
322
322
|
|
|
323
323
|
// Get auth domain from config
|
|
324
324
|
// Structure is: this.config.firebase.app.config.authDomain
|
|
@@ -516,7 +516,7 @@ class Manager {
|
|
|
516
516
|
if (this.environment !== 'development') return;
|
|
517
517
|
|
|
518
518
|
// Get port from config or use default
|
|
519
|
-
const port = this.config?.
|
|
519
|
+
const port = this.config?.bxm?.liveReloadPort || 35729;
|
|
520
520
|
|
|
521
521
|
// Setup livereload
|
|
522
522
|
const address = `ws://localhost:${port}/livereload`;
|
|
@@ -613,7 +613,7 @@ function setupGlobalHandlers() {
|
|
|
613
613
|
}
|
|
614
614
|
|
|
615
615
|
// Get website URL from config
|
|
616
|
-
const config = serviceWorker.
|
|
616
|
+
const config = serviceWorker.BXM_BUILD_JSON?.config || {};
|
|
617
617
|
const website = config?.brand?.url;
|
|
618
618
|
|
|
619
619
|
// Skip if no website configured
|
package/dist/build.js
CHANGED
|
@@ -3,7 +3,7 @@ const path = require('path');
|
|
|
3
3
|
const jetpack = require('fs-jetpack');
|
|
4
4
|
const fs = require('fs');
|
|
5
5
|
const JSON5 = require('json5');
|
|
6
|
-
const argv = require('yargs').argv;
|
|
6
|
+
const argv = require('yargs')(process.argv.slice(2)).parseSync();
|
|
7
7
|
const { force, execute } = require('node-powertools');
|
|
8
8
|
|
|
9
9
|
// Class
|
package/dist/defaults/CLAUDE.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# Identity
|
|
2
|
-
This is a browser extension that is "consuming" a browser extension template project called Browser Extension Manager (
|
|
2
|
+
This is a browser extension that is "consuming" a browser extension template project called Browser Extension Manager (BXM)--a collection of components that can be used to build a browser extension quickly and efficiently.
|
|
3
3
|
|
|
4
|
-
##
|
|
4
|
+
## BXM Documentation
|
|
5
5
|
You should have a full understanding of Browser Extension Manager before editing this project, which can be found at: node_modules/browser-extension-manager/CLAUDE.md
|
|
6
6
|
|
|
7
7
|
## Project-specific Notes
|
|
@@ -8,7 +8,7 @@ const path = require('path');
|
|
|
8
8
|
const { minimatch } = require('minimatch');
|
|
9
9
|
const { template } = require('node-powertools');
|
|
10
10
|
const createTemplateTransform = require('./utils/template-transform');
|
|
11
|
-
const argv = require('yargs').argv;
|
|
11
|
+
const argv = require('yargs')(process.argv.slice(2)).parseSync();
|
|
12
12
|
const JSON5 = require('json5');
|
|
13
13
|
|
|
14
14
|
// Load package
|
|
@@ -35,9 +35,9 @@ const JSONP_TEMPLATE = `
|
|
|
35
35
|
const config = { config };
|
|
36
36
|
|
|
37
37
|
// Assign to various global scopes for compatibility
|
|
38
|
-
if (typeof self !== 'undefined') self.
|
|
39
|
-
if (typeof window !== 'undefined') window.
|
|
40
|
-
if (typeof globalThis !== 'undefined') globalThis.
|
|
38
|
+
if (typeof self !== 'undefined') self.BXM_BUILD_JSON = config;
|
|
39
|
+
if (typeof window !== 'undefined') window.BXM_BUILD_JSON = config;
|
|
40
|
+
if (typeof globalThis !== 'undefined') globalThis.BXM_BUILD_JSON = config;
|
|
41
41
|
})();
|
|
42
42
|
`.trim();
|
|
43
43
|
|
|
@@ -66,8 +66,8 @@ async function generateBuildJs(outputDir) {
|
|
|
66
66
|
// Brand configuration (from browser-extension-manager.json or manifest)
|
|
67
67
|
brand: config.brand || {},
|
|
68
68
|
|
|
69
|
-
//
|
|
70
|
-
|
|
69
|
+
// BXM-specific config
|
|
70
|
+
bxm: {
|
|
71
71
|
environment: Manager.getEnvironment(),
|
|
72
72
|
cache_breaker: Math.round(new Date().getTime() / 1000),
|
|
73
73
|
liveReloadPort: config.liveReloadPort || 35729,
|
|
@@ -52,7 +52,7 @@ const watchInput = [
|
|
|
52
52
|
// All project assets js - watch for changes but don't compile as entry points
|
|
53
53
|
'src/assets/js/**/*.js',
|
|
54
54
|
|
|
55
|
-
// All
|
|
55
|
+
// All BXM package src files - watch for changes (includes background.js, popup.js, etc.)
|
|
56
56
|
`${rootPathPackage}/src/**/*.js`,
|
|
57
57
|
|
|
58
58
|
// So we can watch for changes while we're developing web-manager
|
|
@@ -177,23 +177,27 @@ function getSettings() {
|
|
|
177
177
|
{
|
|
178
178
|
test: /\.js$/,
|
|
179
179
|
exclude: /node_modules/,
|
|
180
|
-
use:
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
[
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
180
|
+
use: [
|
|
181
|
+
{
|
|
182
|
+
loader: 'babel-loader',
|
|
183
|
+
options: {
|
|
184
|
+
sourceMaps: !Manager.actLikeProduction(),
|
|
185
|
+
presets: [
|
|
186
|
+
[require.resolve('@babel/preset-env', {
|
|
187
|
+
paths: [path.resolve(process.cwd(), 'node_modules', package.name, 'node_modules')]
|
|
188
|
+
}), {
|
|
189
|
+
exclude: [
|
|
190
|
+
// Prevent lighthouse error in 2025 about Legacy JavaScript
|
|
191
|
+
// 'es.array.from',
|
|
192
|
+
]
|
|
193
|
+
}]
|
|
194
|
+
],
|
|
195
|
+
compact: Manager.isBuildMode(),
|
|
196
|
+
}
|
|
197
|
+
},
|
|
198
|
+
// Strip dev-only blocks before babel processes the file
|
|
199
|
+
stripDevBlocksLoader,
|
|
200
|
+
]
|
|
197
201
|
}
|
|
198
202
|
]
|
|
199
203
|
},
|
package/dist/index.js
CHANGED
package/dist/lib/auth-helpers.js
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
// - Background.js is the SOURCE OF TRUTH for authentication
|
|
6
6
|
// - On context load, contexts wait for WM auth to settle, then ask background if in sync
|
|
7
7
|
// - If out of sync, background provides a fresh custom token (fetched from server)
|
|
8
|
-
// - No
|
|
8
|
+
// - No BXM-specific storage - Web Manager handles auth state internally
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* Sync auth state with background.js on context load
|
package/dist/options.js
CHANGED
package/dist/page.js
CHANGED
package/dist/popup.js
CHANGED
package/dist/sidepanel.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "browser-extension-manager",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.23",
|
|
4
4
|
"description": "Browser Extension Manager dependency manager",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"exports": {
|
|
@@ -66,8 +66,8 @@
|
|
|
66
66
|
},
|
|
67
67
|
"homepage": "https://template.itwcreativeworks.com",
|
|
68
68
|
"dependencies": {
|
|
69
|
-
"@babel/core": "^7.28.
|
|
70
|
-
"@babel/preset-env": "^7.28.
|
|
69
|
+
"@babel/core": "^7.28.6",
|
|
70
|
+
"@babel/preset-env": "^7.28.6",
|
|
71
71
|
"@popperjs/core": "^2.11.8",
|
|
72
72
|
"babel-loader": "^10.0.0",
|
|
73
73
|
"chalk": "^5.6.2",
|
|
@@ -81,18 +81,18 @@
|
|
|
81
81
|
"gulp-sass": "^6.0.1",
|
|
82
82
|
"itwcw-package-analytics": "^1.0.6",
|
|
83
83
|
"json5": "^2.2.3",
|
|
84
|
-
"lodash": "^4.17.
|
|
84
|
+
"lodash": "^4.17.23",
|
|
85
85
|
"minimatch": "^10.1.1",
|
|
86
86
|
"node-powertools": "^2.3.2",
|
|
87
87
|
"npm-api": "^1.0.1",
|
|
88
|
-
"sass": "^1.97.
|
|
88
|
+
"sass": "^1.97.3",
|
|
89
89
|
"through2": "^4.0.2",
|
|
90
|
-
"web-manager": "^4.1.
|
|
90
|
+
"web-manager": "^4.1.6",
|
|
91
91
|
"webpack": "^5.104.1",
|
|
92
92
|
"wonderful-fetch": "^1.3.4",
|
|
93
93
|
"wonderful-version": "^1.3.2",
|
|
94
|
-
"ws": "^8.
|
|
95
|
-
"yargs": "^
|
|
94
|
+
"ws": "^8.19.0",
|
|
95
|
+
"yargs": "^18.0.0"
|
|
96
96
|
},
|
|
97
97
|
"peerDependencies": {
|
|
98
98
|
"gulp": "^5.0.1"
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
// Plugin: StripDevBlocksPlugin
|
|
2
|
-
class StripDevBlocksPlugin {
|
|
3
|
-
constructor(options = {}) {
|
|
4
|
-
this.options = Object.assign(
|
|
5
|
-
{
|
|
6
|
-
fileTest: /\.js$/,
|
|
7
|
-
startMarker: '/* @dev-only:start */',
|
|
8
|
-
endMarker: '/* @dev-only:end */',
|
|
9
|
-
},
|
|
10
|
-
options
|
|
11
|
-
)
|
|
12
|
-
this.enabled = process.env.BEM_BUILD_MODE === 'true'
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
apply(compiler) {
|
|
16
|
-
if (!this.enabled) return
|
|
17
|
-
|
|
18
|
-
compiler.hooks.compilation.tap('StripDevBlocksPlugin', (compilation) => {
|
|
19
|
-
compilation.hooks.processAssets.tap(
|
|
20
|
-
{
|
|
21
|
-
name: 'StripDevBlocksPlugin',
|
|
22
|
-
stage: compilation.PROCESS_ASSETS_STAGE_OPTIMIZE,
|
|
23
|
-
},
|
|
24
|
-
(assets) => {
|
|
25
|
-
for (const filename in assets) {
|
|
26
|
-
if (!this.options.fileTest.test(filename)) continue
|
|
27
|
-
|
|
28
|
-
let source = assets[filename].source()
|
|
29
|
-
|
|
30
|
-
// Strip everything between start and end marker
|
|
31
|
-
const pattern = new RegExp(
|
|
32
|
-
`${this.escape(this.options.startMarker)}[\\s\\S]*?${this.escape(this.options.endMarker)}`,
|
|
33
|
-
'g'
|
|
34
|
-
)
|
|
35
|
-
source = source.replace(pattern, '')
|
|
36
|
-
|
|
37
|
-
compilation.updateAsset(
|
|
38
|
-
filename,
|
|
39
|
-
new compiler.webpack.sources.RawSource(source)
|
|
40
|
-
)
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
)
|
|
44
|
-
})
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
escape(str) {
|
|
48
|
-
return str.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
// Export
|
|
53
|
-
module.exports = StripDevBlocksPlugin
|