browser-extension-manager 1.0.13 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (242) hide show
  1. package/CHANGELOG.md +43 -0
  2. package/CLAUDE.md +672 -0
  3. package/TODO.md +3 -0
  4. package/dist/assets/css/browser-extension-manager.scss +18 -0
  5. package/dist/assets/css/components/content/index.scss +5 -0
  6. package/dist/assets/css/components/options/index.scss +5 -0
  7. package/dist/assets/css/components/pages/index.scss +5 -0
  8. package/dist/assets/css/components/popup/index.scss +5 -0
  9. package/dist/assets/css/core/_animations.scss +64 -0
  10. package/dist/assets/css/core/_initialize.scss +23 -0
  11. package/dist/assets/css/core/_utilities.scss +80 -0
  12. package/dist/assets/themes/_template/_theme.js +5 -0
  13. package/dist/assets/themes/_template/_theme.scss +5 -0
  14. package/dist/assets/themes/bootstrap/_theme.js +16 -0
  15. package/dist/assets/themes/bootstrap/_theme.scss +232 -0
  16. package/dist/assets/themes/bootstrap/js/index.esm.js +19 -0
  17. package/dist/assets/themes/bootstrap/js/index.umd.js +34 -0
  18. package/dist/assets/themes/bootstrap/js/src/alert.js +87 -0
  19. package/dist/assets/themes/bootstrap/js/src/base-component.js +86 -0
  20. package/dist/assets/themes/bootstrap/js/src/button.js +72 -0
  21. package/dist/assets/themes/bootstrap/js/src/carousel.js +474 -0
  22. package/dist/assets/themes/bootstrap/js/src/collapse.js +297 -0
  23. package/dist/assets/themes/bootstrap/js/src/dom/data.js +55 -0
  24. package/dist/assets/themes/bootstrap/js/src/dom/event-handler.js +317 -0
  25. package/dist/assets/themes/bootstrap/js/src/dom/manipulator.js +71 -0
  26. package/dist/assets/themes/bootstrap/js/src/dom/selector-engine.js +126 -0
  27. package/dist/assets/themes/bootstrap/js/src/dropdown.js +458 -0
  28. package/dist/assets/themes/bootstrap/js/src/modal.js +378 -0
  29. package/dist/assets/themes/bootstrap/js/src/offcanvas.js +282 -0
  30. package/dist/assets/themes/bootstrap/js/src/popover.js +97 -0
  31. package/dist/assets/themes/bootstrap/js/src/scrollspy.js +296 -0
  32. package/dist/assets/themes/bootstrap/js/src/tab.js +315 -0
  33. package/dist/assets/themes/bootstrap/js/src/toast.js +224 -0
  34. package/dist/assets/themes/bootstrap/js/src/tooltip.js +632 -0
  35. package/dist/assets/themes/bootstrap/js/src/util/backdrop.js +151 -0
  36. package/dist/assets/themes/bootstrap/js/src/util/component-functions.js +35 -0
  37. package/dist/assets/themes/bootstrap/js/src/util/config.js +65 -0
  38. package/dist/assets/themes/bootstrap/js/src/util/focustrap.js +115 -0
  39. package/dist/assets/themes/bootstrap/js/src/util/index.js +306 -0
  40. package/dist/assets/themes/bootstrap/js/src/util/sanitizer.js +117 -0
  41. package/dist/assets/themes/bootstrap/js/src/util/scrollbar.js +114 -0
  42. package/dist/assets/themes/bootstrap/js/src/util/swipe.js +146 -0
  43. package/dist/assets/themes/bootstrap/js/src/util/template-factory.js +160 -0
  44. package/dist/assets/themes/bootstrap/scss/_accordion.scss +153 -0
  45. package/dist/assets/themes/bootstrap/scss/_alert.scss +68 -0
  46. package/dist/assets/themes/bootstrap/scss/_badge.scss +38 -0
  47. package/dist/assets/themes/bootstrap/scss/_breadcrumb.scss +40 -0
  48. package/dist/assets/themes/bootstrap/scss/_button-group.scss +147 -0
  49. package/dist/assets/themes/bootstrap/scss/_buttons.scss +216 -0
  50. package/dist/assets/themes/bootstrap/scss/_card.scss +238 -0
  51. package/dist/assets/themes/bootstrap/scss/_carousel.scss +226 -0
  52. package/dist/assets/themes/bootstrap/scss/_close.scss +66 -0
  53. package/dist/assets/themes/bootstrap/scss/_containers.scss +41 -0
  54. package/dist/assets/themes/bootstrap/scss/_dropdown.scss +250 -0
  55. package/dist/assets/themes/bootstrap/scss/_forms.scss +9 -0
  56. package/dist/assets/themes/bootstrap/scss/_functions.scss +302 -0
  57. package/dist/assets/themes/bootstrap/scss/_grid.scss +39 -0
  58. package/dist/assets/themes/bootstrap/scss/_helpers.scss +12 -0
  59. package/dist/assets/themes/bootstrap/scss/_images.scss +42 -0
  60. package/dist/assets/themes/bootstrap/scss/_list-group.scss +199 -0
  61. package/dist/assets/themes/bootstrap/scss/_maps.scss +174 -0
  62. package/dist/assets/themes/bootstrap/scss/_mixins.scss +42 -0
  63. package/dist/assets/themes/bootstrap/scss/_modal.scss +240 -0
  64. package/dist/assets/themes/bootstrap/scss/_nav.scss +197 -0
  65. package/dist/assets/themes/bootstrap/scss/_navbar.scss +289 -0
  66. package/dist/assets/themes/bootstrap/scss/_offcanvas.scss +147 -0
  67. package/dist/assets/themes/bootstrap/scss/_pagination.scss +109 -0
  68. package/dist/assets/themes/bootstrap/scss/_placeholders.scss +51 -0
  69. package/dist/assets/themes/bootstrap/scss/_popover.scss +196 -0
  70. package/dist/assets/themes/bootstrap/scss/_progress.scss +68 -0
  71. package/dist/assets/themes/bootstrap/scss/_reboot.scss +611 -0
  72. package/dist/assets/themes/bootstrap/scss/_root.scss +187 -0
  73. package/dist/assets/themes/bootstrap/scss/_spinners.scss +85 -0
  74. package/dist/assets/themes/bootstrap/scss/_tables.scss +171 -0
  75. package/dist/assets/themes/bootstrap/scss/_toasts.scss +73 -0
  76. package/dist/assets/themes/bootstrap/scss/_tooltip.scss +119 -0
  77. package/dist/assets/themes/bootstrap/scss/_transitions.scss +27 -0
  78. package/dist/assets/themes/bootstrap/scss/_type.scss +106 -0
  79. package/dist/assets/themes/bootstrap/scss/_utilities.scss +806 -0
  80. package/dist/assets/themes/bootstrap/scss/_variables-dark.scss +102 -0
  81. package/dist/assets/themes/bootstrap/scss/_variables.scss +1753 -0
  82. package/dist/assets/themes/bootstrap/scss/bootstrap-grid.scss +62 -0
  83. package/dist/assets/themes/bootstrap/scss/bootstrap-reboot.scss +10 -0
  84. package/dist/assets/themes/bootstrap/scss/bootstrap-utilities.scss +19 -0
  85. package/dist/assets/themes/bootstrap/scss/bootstrap.scss +52 -0
  86. package/dist/assets/themes/bootstrap/scss/forms/_floating-labels.scss +97 -0
  87. package/dist/assets/themes/bootstrap/scss/forms/_form-check.scss +189 -0
  88. package/dist/assets/themes/bootstrap/scss/forms/_form-control.scss +214 -0
  89. package/dist/assets/themes/bootstrap/scss/forms/_form-range.scss +91 -0
  90. package/dist/assets/themes/bootstrap/scss/forms/_form-select.scss +80 -0
  91. package/dist/assets/themes/bootstrap/scss/forms/_form-text.scss +11 -0
  92. package/dist/assets/themes/bootstrap/scss/forms/_input-group.scss +132 -0
  93. package/dist/assets/themes/bootstrap/scss/forms/_labels.scss +36 -0
  94. package/dist/assets/themes/bootstrap/scss/forms/_validation.scss +12 -0
  95. package/dist/assets/themes/bootstrap/scss/helpers/_clearfix.scss +3 -0
  96. package/dist/assets/themes/bootstrap/scss/helpers/_color-bg.scss +7 -0
  97. package/dist/assets/themes/bootstrap/scss/helpers/_colored-links.scss +30 -0
  98. package/dist/assets/themes/bootstrap/scss/helpers/_focus-ring.scss +5 -0
  99. package/dist/assets/themes/bootstrap/scss/helpers/_icon-link.scss +25 -0
  100. package/dist/assets/themes/bootstrap/scss/helpers/_position.scss +36 -0
  101. package/dist/assets/themes/bootstrap/scss/helpers/_ratio.scss +26 -0
  102. package/dist/assets/themes/bootstrap/scss/helpers/_stacks.scss +15 -0
  103. package/dist/assets/themes/bootstrap/scss/helpers/_stretched-link.scss +15 -0
  104. package/dist/assets/themes/bootstrap/scss/helpers/_text-truncation.scss +7 -0
  105. package/dist/assets/themes/bootstrap/scss/helpers/_visually-hidden.scss +8 -0
  106. package/dist/assets/themes/bootstrap/scss/helpers/_vr.scss +8 -0
  107. package/dist/assets/themes/bootstrap/scss/mixins/_alert.scss +18 -0
  108. package/dist/assets/themes/bootstrap/scss/mixins/_backdrop.scss +14 -0
  109. package/dist/assets/themes/bootstrap/scss/mixins/_banner.scss +7 -0
  110. package/dist/assets/themes/bootstrap/scss/mixins/_border-radius.scss +78 -0
  111. package/dist/assets/themes/bootstrap/scss/mixins/_box-shadow.scss +18 -0
  112. package/dist/assets/themes/bootstrap/scss/mixins/_breakpoints.scss +127 -0
  113. package/dist/assets/themes/bootstrap/scss/mixins/_buttons.scss +70 -0
  114. package/dist/assets/themes/bootstrap/scss/mixins/_caret.scss +69 -0
  115. package/dist/assets/themes/bootstrap/scss/mixins/_clearfix.scss +9 -0
  116. package/dist/assets/themes/bootstrap/scss/mixins/_color-mode.scss +21 -0
  117. package/dist/assets/themes/bootstrap/scss/mixins/_color-scheme.scss +7 -0
  118. package/dist/assets/themes/bootstrap/scss/mixins/_container.scss +11 -0
  119. package/dist/assets/themes/bootstrap/scss/mixins/_deprecate.scss +10 -0
  120. package/dist/assets/themes/bootstrap/scss/mixins/_forms.scss +163 -0
  121. package/dist/assets/themes/bootstrap/scss/mixins/_gradients.scss +47 -0
  122. package/dist/assets/themes/bootstrap/scss/mixins/_grid.scss +151 -0
  123. package/dist/assets/themes/bootstrap/scss/mixins/_image.scss +16 -0
  124. package/dist/assets/themes/bootstrap/scss/mixins/_list-group.scss +26 -0
  125. package/dist/assets/themes/bootstrap/scss/mixins/_lists.scss +7 -0
  126. package/dist/assets/themes/bootstrap/scss/mixins/_pagination.scss +10 -0
  127. package/dist/assets/themes/bootstrap/scss/mixins/_reset-text.scss +17 -0
  128. package/dist/assets/themes/bootstrap/scss/mixins/_resize.scss +6 -0
  129. package/dist/assets/themes/bootstrap/scss/mixins/_table-variants.scss +24 -0
  130. package/dist/assets/themes/bootstrap/scss/mixins/_text-truncate.scss +8 -0
  131. package/dist/assets/themes/bootstrap/scss/mixins/_transition.scss +26 -0
  132. package/dist/assets/themes/bootstrap/scss/mixins/_utilities.scss +97 -0
  133. package/dist/assets/themes/bootstrap/scss/mixins/_visually-hidden.scss +38 -0
  134. package/dist/assets/themes/bootstrap/scss/tests/jasmine.js +16 -0
  135. package/dist/assets/themes/bootstrap/scss/tests/mixins/_auto-import-of-variables-dark.test.scss +7 -0
  136. package/dist/assets/themes/bootstrap/scss/tests/mixins/_color-modes.test.scss +69 -0
  137. package/dist/assets/themes/bootstrap/scss/tests/mixins/_media-query-color-mode-full.test.scss +8 -0
  138. package/dist/assets/themes/bootstrap/scss/tests/mixins/_utilities.test.scss +393 -0
  139. package/dist/assets/themes/bootstrap/scss/tests/sass-true/register.js +14 -0
  140. package/dist/assets/themes/bootstrap/scss/tests/sass-true/runner.js +17 -0
  141. package/dist/assets/themes/bootstrap/scss/tests/utilities/_api.test.scss +75 -0
  142. package/dist/assets/themes/bootstrap/scss/utilities/_api.scss +47 -0
  143. package/dist/assets/themes/bootstrap/scss/vendor/_rfs.scss +348 -0
  144. package/dist/assets/themes/classy/README.md +75 -0
  145. package/dist/assets/themes/classy/_config.scss +185 -0
  146. package/dist/assets/themes/classy/_theme.js +29 -0
  147. package/dist/assets/themes/classy/_theme.scss +34 -0
  148. package/dist/assets/themes/classy/css/base/_animations.scss +27 -0
  149. package/dist/assets/themes/classy/css/base/_backgrounds.scss +191 -0
  150. package/dist/assets/themes/classy/css/base/_borders.scss +65 -0
  151. package/dist/assets/themes/classy/css/base/_root.scss +58 -0
  152. package/dist/assets/themes/classy/css/base/_soft-colors.scss +92 -0
  153. package/dist/assets/themes/classy/css/base/_spacing.scss +64 -0
  154. package/dist/assets/themes/classy/css/base/_typography.scss +179 -0
  155. package/dist/assets/themes/classy/css/base/_utilities.scss +77 -0
  156. package/dist/assets/themes/classy/css/components/_accordion.scss +33 -0
  157. package/dist/assets/themes/classy/css/components/_avatars.scss +32 -0
  158. package/dist/assets/themes/classy/css/components/_badges.scss +25 -0
  159. package/dist/assets/themes/classy/css/components/_buttons.scss +397 -0
  160. package/dist/assets/themes/classy/css/components/_cards.scss +33 -0
  161. package/dist/assets/themes/classy/css/components/_carousel.scss +41 -0
  162. package/dist/assets/themes/classy/css/components/_forms.scss +115 -0
  163. package/dist/assets/themes/classy/css/components/_links.scss +19 -0
  164. package/dist/assets/themes/classy/css/components/_logo-scroll.scss +57 -0
  165. package/dist/assets/themes/classy/css/components/_spinners.scss +19 -0
  166. package/dist/assets/themes/classy/css/components/_text.scss +41 -0
  167. package/dist/assets/themes/classy/css/layout/_blog.scss +42 -0
  168. package/dist/assets/themes/classy/css/layout/_general.scss +139 -0
  169. package/dist/assets/themes/classy/css/layout/_navigation.scss +576 -0
  170. package/dist/assets/themes/classy/css/layout/_team.scss +18 -0
  171. package/dist/assets/themes/classy/js/logo-scroll.js +83 -0
  172. package/dist/assets/themes/classy/js/navbar-scroll.js +65 -0
  173. package/dist/background.js +236 -260
  174. package/dist/build.js +93 -4
  175. package/dist/commands/setup.js +0 -268
  176. package/dist/config/manifest.json +11 -3
  177. package/dist/config/page-template.html +21 -0
  178. package/dist/defaults/.nvmrc +1 -1
  179. package/dist/defaults/CLAUDE.md +8 -0
  180. package/dist/defaults/config/browser-extension-manager.json +37 -0
  181. package/dist/defaults/src/assets/css/components/content/index.scss +11 -0
  182. package/dist/defaults/src/assets/css/components/options/index.scss +14 -0
  183. package/dist/defaults/src/assets/css/components/pages/index.scss +10 -0
  184. package/dist/defaults/src/assets/css/components/popup/index.scss +10 -0
  185. package/dist/defaults/src/assets/css/components/sidepanel/index.scss +6 -0
  186. package/dist/defaults/src/assets/css/main.scss +32 -0
  187. package/dist/defaults/src/assets/js/components/background/index.js +22 -0
  188. package/dist/defaults/src/assets/js/components/content/index.js +22 -0
  189. package/dist/defaults/src/assets/js/components/options/index.js +22 -0
  190. package/dist/defaults/src/assets/js/components/pages/index.js +22 -0
  191. package/dist/defaults/src/assets/js/components/popup/index.js +22 -0
  192. package/dist/defaults/src/assets/js/components/sidepanel/index.js +20 -0
  193. package/dist/defaults/src/assets/vendor/.gitkeep +0 -0
  194. package/dist/defaults/src/manifest.json +11 -6
  195. package/dist/defaults/src/views/options/index.html +8 -0
  196. package/dist/defaults/src/views/pages/index.html +10 -0
  197. package/dist/defaults/src/views/popup/index.html +4 -0
  198. package/dist/defaults/src/views/sidepanel/index.html +4 -0
  199. package/dist/gulp/main.js +11 -5
  200. package/dist/gulp/plugins/webpack/strip-dev-blocks.js +53 -0
  201. package/dist/gulp/tasks/{_package.js → BU/_package.js} +1 -1
  202. package/dist/gulp/tasks/{developmentRebuild.js → BU/developmentRebuild.js} +1 -1
  203. package/dist/gulp/tasks/{themes.js → BU/themes.js} +3 -2
  204. package/dist/gulp/tasks/{test.js → _.js} +3 -3
  205. package/dist/gulp/tasks/audit.js +154 -0
  206. package/dist/gulp/tasks/defaults.js +308 -0
  207. package/dist/gulp/tasks/distribute.js +87 -92
  208. package/dist/gulp/tasks/html.js +150 -0
  209. package/dist/gulp/tasks/icons.js +3 -2
  210. package/dist/gulp/tasks/package.js +216 -27
  211. package/dist/gulp/tasks/sass.js +188 -43
  212. package/dist/gulp/tasks/serve.js +1 -0
  213. package/dist/gulp/tasks/utils/template-transform.js +50 -0
  214. package/dist/gulp/tasks/webpack.js +338 -134
  215. package/dist/index.js +34 -34
  216. package/dist/options.js +40 -0
  217. package/dist/page.js +40 -0
  218. package/dist/popup.js +40 -0
  219. package/dist/sidepanel.js +40 -0
  220. package/firebase-debug.log +322 -0
  221. package/package.json +25 -18
  222. package/dist/assets/css/main.scss +0 -3
  223. package/dist/assets/themes/bootstrap/5.3.3/css/bootstrap.css +0 -12057
  224. package/dist/assets/themes/bootstrap/5.3.3/css/bootstrap.css.map +0 -1
  225. package/dist/assets/themes/bootstrap/5.3.3/js/bootstrap.bundle.js +0 -6314
  226. package/dist/assets/themes/bootstrap/5.3.3/js/bootstrap.bundle.js.map +0 -1
  227. package/dist/assets/themes/bootstrap/5.3.3/js/bootstrap.js +0 -4494
  228. package/dist/assets/themes/bootstrap/5.3.3/js/bootstrap.js.map +0 -1
  229. package/dist/defaults/src/assets/css/content.scss +0 -2
  230. package/dist/defaults/src/assets/css/options.scss +0 -11
  231. package/dist/defaults/src/assets/css/popup.scss +0 -14
  232. package/dist/defaults/src/assets/js/background.js +0 -18
  233. package/dist/defaults/src/assets/js/content.js +0 -15
  234. package/dist/defaults/src/assets/js/options.js +0 -17
  235. package/dist/defaults/src/assets/js/popup.js +0 -17
  236. package/dist/defaults/src/pages/options.html +0 -26
  237. package/dist/defaults/src/pages/popup.html +0 -26
  238. /package/dist/{defaults/src/assets/images/_ → assets/css/bundles/.gitkeep} +0 -0
  239. /package/dist/assets/css/{fontawesome.scss → core/_fontawesome.scss} +0 -0
  240. /package/dist/defaults/src/assets/{vendor/_ → images/.gitkeep} +0 -0
  241. /package/dist/gulp/tasks/{_importer.js → BU/_importer.js} +0 -0
  242. /package/dist/gulp/tasks/{_vendor.js → BU/_vendor.js} +0 -0
@@ -6,6 +6,7 @@ const glob = require('glob').globSync;
6
6
  const path = require('path');
7
7
  const wp = require('webpack');
8
8
  const ReplacePlugin = require('../plugins/webpack/replace.js');
9
+ const StripDevBlocksPlugin = require('../plugins/webpack/strip-dev-blocks.js');
9
10
  const version = require('wonderful-version');
10
11
 
11
12
  // Load package
@@ -16,118 +17,287 @@ const config = Manager.getConfig();
16
17
  const rootPathPackage = Manager.getRootPath('main');
17
18
  const rootPathProject = Manager.getRootPath('project');
18
19
 
19
- // Settings
20
- // const MINIFY = false;
21
- const MINIFY = Manager.getEnvironment() === 'production';
20
+ // Define bundle files separately for easier tracking
21
+ const bundleFiles = [
22
+ // Main bundles (if any exist in bundles/ directory)
23
+ `${rootPathPackage}/dist/assets/js/bundles/*.js`,
24
+
25
+ // Project bundles
26
+ 'src/assets/js/bundles/*.js',
27
+ ];
28
+
29
+ // Entry points to compile (only index.js files)
22
30
  const input = [
23
- // Include the project's src files
24
- 'src/assets/js/**/*.js',
31
+ // Bundle files (if any exist)
32
+ ...bundleFiles,
33
+
34
+ // Component-specific JS (only index.js entry points)
35
+ `${rootPathPackage}/dist/assets/js/components/**/index.js`,
36
+ 'src/assets/js/components/**/index.js',
37
+ ];
38
+
39
+ // Additional files to watch (but not compile as entry points)
40
+ const watchInput = [
41
+ // Watch the paths we're compiling
42
+ ...input,
25
43
 
26
- // Include service worker
27
- 'src/assets/js/background.js',
44
+ // Core JS - watch for changes but don't compile as entry points
45
+ `${rootPathPackage}/dist/assets/js/**/*.js`,
28
46
 
29
- // Include UJ's dist files
30
- `${rootPathPackage}/dist/assets/js/**/*`,
47
+ // Component files - watch for changes to trigger recompile
48
+ `${rootPathPackage}/src/popup.js`,
49
+ `${rootPathPackage}/src/options.js`,
50
+ `${rootPathPackage}/src/page.js`,
51
+ `${rootPathPackage}/src/sidepanel.js`,
52
+ `${rootPathPackage}/src/index.js`,
31
53
 
32
- // Files to exclude
33
- // '!dist/**',
54
+ // Theme js - watch for changes but don't compile as entry points
55
+ `${rootPathPackage}/dist/assets/themes/**/*.js`,
56
+ 'src/assets/themes/**/*.js',
34
57
  ];
58
+
35
59
  const delay = 250;
60
+ const compiled = {};
36
61
 
37
- const settings = {
38
- mode: 'production',
39
- target: ['web', 'es5'],
40
- plugins: [
41
- new ReplacePlugin(getTemplateReplaceOptions(), { type: 'template' }),
42
- // new ReplacePlugin(getRawReplaceOptions(), { type: 'raw', regex: true }),
62
+ // Bundle naming configuration
63
+ const bundleNaming = {
64
+ // Files that should have stable (non-hashed) names
65
+ stable: [
66
+ /^bundles\//, // All bundle files get stable names
67
+ /^components\//, // All component files get stable names
68
+ /^pages\//, // All page files get stable names
43
69
  ],
44
- entry: {
45
- // Entry is dynamically generated
46
- },
47
- output: {
48
- // Set the path to the dist folder
49
- path: path.resolve(process.cwd(), 'dist/assets/js'),
50
-
51
- // Set the public path
52
- // publicPath: '',
53
- publicPath: '/assets/js/',
54
-
55
- // https://github.com/webpack/webpack/issues/959
56
- chunkFilename: (data) => {
57
- // Special case for the main chunk
58
- if (data.chunk.name === 'main') {
59
- return '[name].chunk.js';
70
+ // Special output paths (relative to dist/assets/js/)
71
+ specialPaths: {
72
+ // Example: 'components/background': 'background.js'
73
+ // Can be configured per project if needed
74
+ }
75
+ };
76
+
77
+ // Helper function to determine if a bundle should have a stable name
78
+ function shouldHaveStableName(name) {
79
+ return bundleNaming.stable.some(pattern => pattern.test(name));
80
+ }
81
+
82
+ // Helper function to get webpack settings (called at runtime)
83
+ function getSettings() {
84
+ return {
85
+ mode: Manager.actLikeProduction() ? 'production' : 'development',
86
+ target: ['web', 'es2015'],
87
+ // Browser extensions have CSP restrictions, so use source-map instead of eval-source-map
88
+ devtool: Manager.actLikeProduction() ? false : 'source-map',
89
+ plugins: [
90
+ new StripDevBlocksPlugin(),
91
+ new ReplacePlugin(getTemplateReplaceOptions(), { type: 'template' }),
92
+ ],
93
+ entry: {
94
+ // Entry is dynamically generated
95
+ },
96
+ resolve: {
97
+ alias: {
98
+ // For importing assets
99
+ '__main_assets__': path.resolve(rootPathPackage, 'dist/assets'),
100
+ '__project_assets__': path.resolve(process.cwd(), 'src/assets'),
101
+
102
+ // For importing the theme
103
+ '__theme__': path.resolve(rootPathPackage, 'dist/assets/themes', config.theme?.id || 'classy'),
104
+ },
105
+ // Add module resolution paths
106
+ modules: [
107
+ // Package's node_modules
108
+ path.resolve(rootPathPackage, 'node_modules'),
109
+
110
+ // Project's node_modules
111
+ path.resolve(process.cwd(), 'node_modules'),
112
+ 'node_modules' // Default fallback
113
+ ],
114
+ // Fallbacks for Node.js modules that don't work in the browser
115
+ fallback: {
116
+ fs: false,
117
+ path: false,
118
+ crypto: false,
119
+ os: false,
120
+ util: false,
121
+ assert: false,
122
+ stream: false,
123
+ buffer: false,
124
+ process: false
60
125
  }
126
+ },
127
+ output: {
128
+ // Set the path to the dist folder
129
+ path: path.resolve(process.cwd(), 'dist/assets/js'),
61
130
 
62
- // Otherwise, use the default chunk filename
63
- return '[name].chunk.[chunkhash].js';
131
+ // Set the public path
132
+ publicPath: '/assets/js/',
133
+
134
+ // https://github.com/webpack/webpack/issues/959
135
+ chunkFilename: (data) => {
136
+ const name = data.chunk.name;
137
+
138
+ // Check if this chunk should have a stable name
139
+ if (shouldHaveStableName(name)) {
140
+ return '[name].chunk.js';
141
+ }
142
+
143
+ // Otherwise, use hashed filename
144
+ return '[name].chunk.[chunkhash].js';
145
+ },
146
+ filename: (data) => {
147
+ const name = data.chunk.name;
148
+
149
+ // Check for special output paths (like service worker)
150
+ if (bundleNaming.specialPaths[name]) {
151
+ return bundleNaming.specialPaths[name];
152
+ }
153
+
154
+ // Check if this bundle should have a stable name
155
+ if (shouldHaveStableName(name)) {
156
+ return '[name].bundle.js';
157
+ }
158
+
159
+ // Everything else gets hashed
160
+ return '[name].bundle.[contenthash].js';
161
+ },
64
162
  },
65
- filename: (data) => {
66
- // Special case for the background chunk
67
- // if (data.chunk.name === 'background') {
68
- // return 'background.js';
69
- // }
70
-
71
- // Otherwise, use the default filename
72
- return '[name].bundle.js';
163
+ resolveLoader: {
164
+ modules: [
165
+ path.resolve(process.cwd(), 'node_modules', package.name, 'node_modules'), // Path to your helper module's node_modules
166
+ path.resolve(process.cwd(), 'node_modules'), // Default project node_modules
167
+ 'node_modules', // Fallback to global
168
+ ]
73
169
  },
74
- },
75
- resolveLoader: {
76
- modules: [
77
- path.resolve(process.cwd(), 'node_modules', package.name, 'node_modules'), // Path to your helper module's node_modules
78
- path.resolve(process.cwd(), 'node_modules'), // Default project node_modules
79
- 'node_modules', // Fallback to global
80
- ]
81
- },
82
- module: {
83
- rules: [
84
- {
85
- test: /\.js$/,
86
- exclude: /node_modules/,
87
- use: {
88
- loader: 'babel-loader',
89
- options: {
90
- // presets: ['@babel/preset-env'],
91
- presets: [
92
- require.resolve('@babel/preset-env', {
93
- paths: [path.resolve(process.cwd(), 'node_modules', package.name, 'node_modules')]
94
- })
95
- ],
96
- compact: MINIFY,
170
+ module: {
171
+ rules: [
172
+ {
173
+ test: /\.js$/,
174
+ exclude: /node_modules/,
175
+ use: {
176
+ loader: 'babel-loader',
177
+ options: {
178
+ sourceMaps: !Manager.actLikeProduction(),
179
+ presets: [
180
+ [require.resolve('@babel/preset-env', {
181
+ paths: [path.resolve(process.cwd(), 'node_modules', package.name, 'node_modules')]
182
+ }), {
183
+ exclude: [
184
+ // Prevent lighthouse error in 2025 about Legacy JavaScript
185
+ // 'es.array.from',
186
+ ]
187
+ }]
188
+ ],
189
+ compact: Manager.isBuildMode(),
190
+ }
97
191
  }
98
192
  }
99
- }
100
- ]
101
- },
102
- optimization: {
103
- minimize: MINIFY,
104
- },
193
+ ]
194
+ },
195
+ optimization: {
196
+ minimize: Manager.actLikeProduction(),
197
+ },
198
+ };
105
199
  }
106
200
 
107
201
  // Task
108
202
  function webpack(complete) {
203
+ // Get settings (loads config at runtime)
204
+ const settings = getSettings();
205
+
109
206
  // Log
110
207
  logger.log('Starting...');
208
+ Manager.logMemory(logger, 'Start');
209
+
210
+ // Log mode and devtools
211
+ logger.log(`Mode: ${settings.mode}`);
212
+ logger.log(`Target: ${settings.target[1]}`);
213
+ logger.log(`Devtool: ${settings.devtool}`);
111
214
 
112
- // Update entry points
113
- updateEntryPoints();
215
+ // Build configs array
216
+ const configs = [];
217
+
218
+ // Main entries config
219
+ const mainEntries = updateEntryPoints(input);
220
+ if (Object.keys(mainEntries).length > 0) {
221
+ configs.push({
222
+ ...settings,
223
+ entry: mainEntries
224
+ });
225
+ }
226
+
227
+ // Check if we have a background component that needs service worker config
228
+ const hasBackgroundComponent = Object.keys(mainEntries).some(key =>
229
+ key === 'components/background' || key.includes('components/background/')
230
+ );
231
+
232
+ if (hasBackgroundComponent) {
233
+ // Create separate config for background with service worker settings
234
+ const backgroundEntry = {};
235
+ Object.keys(mainEntries).forEach(key => {
236
+ if (key === 'components/background' || key.includes('components/background/')) {
237
+ backgroundEntry[key] = mainEntries[key];
238
+ delete mainEntries[key];
239
+ }
240
+ });
241
+
242
+ configs.push({
243
+ ...settings,
244
+ entry: backgroundEntry,
245
+ output: {
246
+ ...settings.output,
247
+ // Set global object for service worker
248
+ globalObject: 'self',
249
+ // Service worker output format - use umd to avoid module issues
250
+ libraryTarget: 'umd',
251
+ },
252
+ target: 'webworker',
253
+ optimization: {
254
+ ...settings.optimization,
255
+ // Disable runtime chunk for service worker
256
+ runtimeChunk: false,
257
+ // Disable splitting for service worker to avoid chunk loading issues
258
+ splitChunks: false
259
+ }
260
+ });
261
+ }
114
262
 
115
263
  // Compiler
116
- const compiler = wp(settings, (e, stats) => {
264
+ wp(configs, (e, stats) => {
117
265
  // Log
118
266
  logger.log('Finished!');
119
267
 
120
- // Error
268
+ // Handle fatal webpack errors
121
269
  if (e) {
122
- logger.error(e);
123
- } else {
124
- logger.log('Stats:\n', stats.toString({ colors: true }));
270
+ logger.error('Fatal webpack error:', e);
271
+ return Manager.reportBuildError(Object.assign(e, { plugin: 'Webpack' }), complete);
272
+ }
273
+
274
+ // Log stats
275
+ const statsString = stats.toString({ colors: true });
276
+ logger.log('Stats:\n', statsString);
277
+
278
+ // Check for compilation errors
279
+ if (stats.hasErrors()) {
280
+ const info = stats.toJson();
281
+ logger.error('Webpack compilation failed with errors');
282
+ // Create an error to pass to complete() so the build fails
283
+ const compilationError = new Error(`Webpack compilation failed: ${info.errors.length} error(s)`);
284
+ return Manager.reportBuildError(Object.assign(compilationError, { plugin: 'Webpack' }), complete);
285
+ }
286
+
287
+ // Check for warnings (optional - don't fail build but log them)
288
+ if (stats.hasWarnings()) {
289
+ const info = stats.toJson();
290
+ logger.warn(`Webpack compilation completed with ${info.warnings.length} warning(s)`);
125
291
  }
126
292
 
127
- // Complete
128
- return complete(e);
293
+ // Trigger rebuild
294
+ Manager.triggerRebuild(compiled);
295
+
296
+ // Complete successfully
297
+ return complete();
129
298
  });
130
299
  }
300
+
131
301
  // Watcher task
132
302
  function webpackWatcher(complete) {
133
303
  // Quit if in build mode
@@ -140,35 +310,77 @@ function webpackWatcher(complete) {
140
310
  logger.log('[watcher] Watching for changes...');
141
311
 
142
312
  // Watch for changes
143
- watch(input, { delay: delay }, webpack)
144
- .on('change', function(path) {
313
+ watch(watchInput, { delay: delay, dot: true }, webpack)
314
+ .on('change', (path) => {
145
315
  // Log
146
- logger.log(`[watcher] File ${path} was changed`);
316
+ logger.log(`[watcher] File changed (${path})`);
147
317
  });
148
318
 
149
319
  // Complete
150
320
  return complete();
151
321
  }
152
322
 
153
- function updateEntryPoints() {
323
+ function updateEntryPoints(inputArray) {
154
324
  // Get all JS files
155
- const files = glob(input);
325
+ const files = glob(inputArray).map((f) => path.resolve(f));
326
+
327
+ // Sort: main files first
328
+ files.sort((a, b) => {
329
+ const aIsMain = a.startsWith(rootPathPackage);
330
+ const bIsMain = b.startsWith(rootPathPackage);
331
+ return aIsMain === bIsMain ? 0 : aIsMain ? -1 : 1;
332
+ });
156
333
 
157
334
  // Update from src
158
- settings.entry = files.reduce((acc, file) => {
159
- // Get the file name
160
- const name = path.basename(file, path.extname(file));
335
+ const entries = files.reduce((acc, file) => {
336
+ let name;
337
+
338
+ // Determine naming based on file type
339
+ if (file.includes('/assets/js/bundles/')) {
340
+ // Bundle files: bundles/my-bundle.js -> bundles/my-bundle
341
+ name = file.split('/assets/js/')[1];
342
+ } else if (file.includes('/assets/js/components/')) {
343
+ // Component files: special handling for pages vs other components
344
+ // Pages can have multiple files (index, pricing, login, etc.)
345
+ // Other components (popup, options, etc.) only have index
346
+ const componentPath = file.split('/assets/js/')[1];
347
+ const isInPages = componentPath.includes('/pages/');
348
+
349
+ if (componentPath.endsWith('/index.js') && !isInPages) {
350
+ // For non-pages components: strip /index.js
351
+ // components/popup/index.js -> components/popup
352
+ const parts = componentPath.split('/');
353
+ parts.pop(); // remove index.js
354
+ name = parts.join('/');
355
+ } else {
356
+ // For pages or non-index files: keep full path
357
+ // components/pages/index.js -> components/pages/index
358
+ // components/pages/pricing.js -> components/pages/pricing
359
+ name = componentPath.replace(/\.js$/, '');
360
+ }
361
+ } else if (file.includes('/assets/js/pages/')) {
362
+ // Page files: keep full path
363
+ name = file.split('/assets/js/')[1].replace(/\.js$/, '');
364
+ } else {
365
+ // Everything else: just use the base filename
366
+ name = path.basename(file);
367
+ name = name.replace(/\.js$/, '');
368
+ }
369
+
370
+ // Track the full output path
371
+ const fullPath = path.resolve(process.cwd(), 'dist/assets/js', `${name}.bundle.js`);
372
+ compiled[fullPath] = true;
161
373
 
162
- // Add to entry points starting with "./"
163
- // acc[name] = `./${file}`;
164
- acc[name] = path.resolve(file);
374
+ // Update entry points
375
+ acc[name] = file;
165
376
 
166
377
  // Return
167
378
  return acc;
168
379
  }, {});
169
380
 
170
381
  // Log
171
- logger.log('Updated entry points:', settings.entry);
382
+ logger.log('Updated entry points:', entries);
383
+ return entries;
172
384
  }
173
385
 
174
386
  function getTemplateReplaceOptions() {
@@ -188,49 +400,41 @@ function getTemplateReplaceOptions() {
188
400
  }
189
401
  const now = Math.round(new Date().getTime() / 1000);
190
402
 
191
- // Set webManagerConfiguration
403
+ // Set webManagerConfiguration (matching web-manager's expected structure)
404
+ const webManagerConfig = options.webManager || {};
192
405
  options.webManagerConfiguration = JSON.stringify({
193
- global: {
194
- app: options.app.id,
195
- version: options.version,
196
- url: options.brand.url,
197
- buildTime: now,
198
- cacheBreaker: now,
199
- brand: options.brand.name,
200
- contact: {
201
- emailBusiness: options.brand.email,
202
- emailSupport: options.brand.email,
406
+ environment: options.environment || 'production',
407
+ buildTime: now,
408
+ brand: {
409
+ id: options.app?.id || 'extension',
410
+ name: options.brand?.name || 'Extension',
411
+ url: options.brand?.url || '',
412
+ email: options.brand?.email || '',
413
+ brandmark: options.brand?.brandmark || '',
414
+ wordmark: options.brand?.wordmark || '',
415
+ combomark: options.brand?.combomark || '',
416
+ },
417
+ auth: webManagerConfig.auth || { enabled: true, config: {} },
418
+ firebase: {
419
+ app: {
420
+ enabled: !!(options.firebaseConfig?.apiKey || webManagerConfig.firebase?.app?.config?.apiKey),
421
+ config: options.firebaseConfig || webManagerConfig.firebase?.app?.config || {},
203
422
  },
204
- download: {},
205
- extension: {},
206
- validRedirectHosts: ['itwcreativeworks.com'],
207
- settings: {
208
- refreshNewVersion: {
209
- enabled: false,
210
- },
211
- exitPopup: {
212
- enabled: false,
213
- },
214
- libraries: {
215
- firebase_app: {
216
- enabled: !!options.firebaseConfig.apiKey,
217
- config: options.firebaseConfig,
218
- },
219
- firebase_appCheck: {
220
- enabled: false,
221
- },
222
- cookieconsent: {
223
- enabled: false,
224
- },
225
- chatsy: {
226
- enabled: false,
227
- },
228
- sentry: {
229
- enabled: false,
230
- },
231
- }
232
- }
233
- }
423
+ appCheck: webManagerConfig.firebase?.appCheck || { enabled: false, config: {} },
424
+ },
425
+ cookieConsent: webManagerConfig.cookieConsent || { enabled: true, config: {} },
426
+ chatsy: webManagerConfig.chatsy || { enabled: true, config: {} },
427
+ sentry: webManagerConfig.sentry || {
428
+ enabled: !!options.sentry?.dsn,
429
+ config: options.sentry || {}
430
+ },
431
+ exitPopup: webManagerConfig.exitPopup || { enabled: false, config: {} },
432
+ lazyLoading: webManagerConfig.lazyLoading || { enabled: true, config: {} },
433
+ socialSharing: webManagerConfig.socialSharing || { enabled: false, config: {} },
434
+ pushNotifications: webManagerConfig.pushNotifications || { enabled: false, config: {} },
435
+ validRedirectHosts: webManagerConfig.validRedirectHosts || ['itwcreativeworks.com'],
436
+ refreshNewVersion: webManagerConfig.refreshNewVersion || { enabled: true, config: {} },
437
+ serviceWorker: webManagerConfig.serviceWorker || { enabled: false, config: {} },
234
438
  });
235
439
 
236
440
  // Return
package/dist/index.js CHANGED
@@ -1,46 +1,46 @@
1
- // Libraries
2
- const WebManager = require('web-manager');
1
+ // // Libraries
2
+ // const WebManager = require('web-manager');
3
3
 
4
- // Class
5
- function Manager() {
6
- const self = this;
4
+ // // Class
5
+ // function Manager() {
6
+ // const self = this;
7
7
 
8
- // Properties
9
- self.extension = null;
10
- self.messenger = null;
11
- self.logger = null;
12
- self.webManager = null;
8
+ // // Properties
9
+ // self.extension = null;
10
+ // self.messenger = null;
11
+ // self.logger = null;
12
+ // self.webManager = null;
13
13
 
14
- // Return
15
- return self;
16
- }
14
+ // // Return
15
+ // return self;
16
+ // }
17
17
 
18
- Manager.prototype.initialize = function (callback) {
19
- const self = this;
18
+ // Manager.prototype.initialize = function (callback) {
19
+ // const self = this;
20
20
 
21
- // Configuration
22
- const configuration = JSON.parse('%%% webManagerConfiguration %%%');
21
+ // // Configuration
22
+ // const configuration = window.BEM_BUILD_JSON?.config;
23
23
 
24
- // Initiate the web manager
25
- self.extension = require('./lib/extension');
26
- self.messenger = null;
27
- self.logger = new (require('./lib/logger-lite'))('popup');
28
- self.webManager = new WebManager();
24
+ // // Initiate the web manager
25
+ // self.extension = require('./lib/extension');
26
+ // self.messenger = null;
27
+ // self.logger = new (require('./lib/logger-lite'))('popup');
28
+ // self.webManager = new WebManager();
29
29
 
30
- // Initialize
31
- self.webManager.init(configuration, callback);
30
+ // // Initialize
31
+ // self.webManager.init(configuration, callback);
32
32
 
33
- // Return
34
- return self.webManager;
35
- };
33
+ // // Return
34
+ // return self.webManager;
35
+ // };
36
36
 
37
- Manager.prototype.library = function (name) {
38
- const self = this;
37
+ // Manager.prototype.library = function (name) {
38
+ // const self = this;
39
39
 
40
- // Return
41
- return require(`./lib/${name}`);
42
- };
40
+ // // Return
41
+ // return require(`./lib/${name}`);
42
+ // };
43
43
 
44
44
 
45
- // Export
46
- module.exports = Manager;
45
+ // // Export
46
+ // module.exports = Manager;
@@ -0,0 +1,40 @@
1
+ // Libraries
2
+ import { Manager as WebManager } from 'web-manager';
3
+ import extension from './lib/extension.js';
4
+ import LoggerLite from './lib/logger-lite.js';
5
+
6
+ // Class
7
+ class Manager {
8
+ constructor() {
9
+ // Properties
10
+ this.extension = null;
11
+ this.messenger = null;
12
+ this.logger = null;
13
+ this.webManager = null;
14
+ }
15
+
16
+ async initialize() {
17
+ // Configuration
18
+ const configuration = window.BEM_BUILD_JSON?.config;
19
+
20
+ // Set properties
21
+ this.extension = extension;
22
+ this.messenger = null;
23
+ this.logger = new LoggerLite('options');
24
+ this.webManager = new WebManager();
25
+
26
+ // Initialize
27
+ await this.webManager.initialize(configuration);
28
+
29
+ // Return manager instance
30
+ return this;
31
+ }
32
+
33
+ library(name) {
34
+ // Dynamic import for libraries
35
+ return import(`./lib/${name}.js`);
36
+ }
37
+ }
38
+
39
+ // Export
40
+ export default Manager;