browser-extension-manager 1.0.14 → 1.1.1

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 +235 -261
  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 +24 -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} +2 -1
  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 +71 -78
  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 +194 -13
  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 +341 -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 +350 -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,290 @@ 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
+ ];
25
38
 
26
- // Include service worker
27
- 'src/assets/js/background.js',
39
+ // Additional files to watch (but not compile as entry points)
40
+ const watchInput = [
41
+ // Watch the paths we're compiling
42
+ ...input,
28
43
 
29
- // Include UJ's dist files
30
- `${rootPathPackage}/dist/assets/js/**/*`,
44
+ // Core JS - watch for changes but don't compile as entry points
45
+ `${rootPathPackage}/dist/assets/js/**/*.js`,
31
46
 
32
- // Files to exclude
33
- // '!dist/**',
47
+ // Theme js - watch for changes but don't compile as entry points
48
+ `${rootPathPackage}/dist/assets/themes/**/*.js`,
49
+ 'src/assets/themes/**/*.js',
50
+
51
+ // Component files - watch for changes to trigger recompile
52
+ `${rootPathPackage}/src/popup.js`,
53
+ `${rootPathPackage}/src/options.js`,
54
+ `${rootPathPackage}/src/page.js`,
55
+ `${rootPathPackage}/src/sidepanel.js`,
56
+ `${rootPathPackage}/src/index.js`,
57
+
58
+ // So we can watch for changes while we're developing web-manager
59
+ `${rootPathPackage}/../web-manager/src`,
34
60
  ];
61
+
35
62
  const delay = 250;
63
+ const compiled = {};
36
64
 
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 }),
65
+ // Bundle naming configuration
66
+ const bundleNaming = {
67
+ // Files that should have stable (non-hashed) names
68
+ stable: [
69
+ /^bundles\//, // All bundle files get stable names
70
+ /^components\//, // All component files get stable names
71
+ /^pages\//, // All page files get stable names
43
72
  ],
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';
73
+ // Special output paths (relative to dist/assets/js/)
74
+ specialPaths: {
75
+ // Example: 'components/background': 'background.js'
76
+ // Can be configured per project if needed
77
+ }
78
+ };
79
+
80
+ // Helper function to determine if a bundle should have a stable name
81
+ function shouldHaveStableName(name) {
82
+ return bundleNaming.stable.some(pattern => pattern.test(name));
83
+ }
84
+
85
+ // Helper function to get webpack settings (called at runtime)
86
+ function getSettings() {
87
+ return {
88
+ mode: Manager.actLikeProduction() ? 'production' : 'development',
89
+ target: ['web', 'es2015'],
90
+ // Browser extensions have CSP restrictions, so use source-map instead of eval-source-map
91
+ devtool: Manager.actLikeProduction() ? false : 'source-map',
92
+ plugins: [
93
+ new StripDevBlocksPlugin(),
94
+ new ReplacePlugin(getTemplateReplaceOptions(), { type: 'template' }),
95
+ ],
96
+ entry: {
97
+ // Entry is dynamically generated
98
+ },
99
+ resolve: {
100
+ alias: {
101
+ // For importing assets
102
+ '__main_assets__': path.resolve(rootPathPackage, 'dist/assets'),
103
+ '__project_assets__': path.resolve(process.cwd(), 'src/assets'),
104
+
105
+ // For importing the theme
106
+ '__theme__': path.resolve(rootPathPackage, 'dist/assets/themes', config.theme?.id || 'classy'),
107
+ },
108
+ // Add module resolution paths
109
+ modules: [
110
+ // Package's node_modules
111
+ path.resolve(rootPathPackage, 'node_modules'),
112
+
113
+ // Project's node_modules
114
+ path.resolve(process.cwd(), 'node_modules'),
115
+ 'node_modules' // Default fallback
116
+ ],
117
+ // Fallbacks for Node.js modules that don't work in the browser
118
+ fallback: {
119
+ fs: false,
120
+ path: false,
121
+ crypto: false,
122
+ os: false,
123
+ util: false,
124
+ assert: false,
125
+ stream: false,
126
+ buffer: false,
127
+ process: false
60
128
  }
129
+ },
130
+ output: {
131
+ // Set the path to the dist folder
132
+ path: path.resolve(process.cwd(), 'dist/assets/js'),
61
133
 
62
- // Otherwise, use the default chunk filename
63
- return '[name].chunk.[chunkhash].js';
134
+ // Set the public path
135
+ publicPath: '/assets/js/',
136
+
137
+ // https://github.com/webpack/webpack/issues/959
138
+ chunkFilename: (data) => {
139
+ const name = data.chunk.name;
140
+
141
+ // Check if this chunk should have a stable name
142
+ if (shouldHaveStableName(name)) {
143
+ return '[name].chunk.js';
144
+ }
145
+
146
+ // Otherwise, use hashed filename
147
+ return '[name].chunk.[chunkhash].js';
148
+ },
149
+ filename: (data) => {
150
+ const name = data.chunk.name;
151
+
152
+ // Check for special output paths (like service worker)
153
+ if (bundleNaming.specialPaths[name]) {
154
+ return bundleNaming.specialPaths[name];
155
+ }
156
+
157
+ // Check if this bundle should have a stable name
158
+ if (shouldHaveStableName(name)) {
159
+ return '[name].bundle.js';
160
+ }
161
+
162
+ // Everything else gets hashed
163
+ return '[name].bundle.[contenthash].js';
164
+ },
64
165
  },
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';
166
+ resolveLoader: {
167
+ modules: [
168
+ path.resolve(process.cwd(), 'node_modules', package.name, 'node_modules'), // Path to your helper module's node_modules
169
+ path.resolve(process.cwd(), 'node_modules'), // Default project node_modules
170
+ 'node_modules', // Fallback to global
171
+ ]
73
172
  },
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,
173
+ module: {
174
+ rules: [
175
+ {
176
+ test: /\.js$/,
177
+ exclude: /node_modules/,
178
+ use: {
179
+ loader: 'babel-loader',
180
+ options: {
181
+ sourceMaps: !Manager.actLikeProduction(),
182
+ presets: [
183
+ [require.resolve('@babel/preset-env', {
184
+ paths: [path.resolve(process.cwd(), 'node_modules', package.name, 'node_modules')]
185
+ }), {
186
+ exclude: [
187
+ // Prevent lighthouse error in 2025 about Legacy JavaScript
188
+ // 'es.array.from',
189
+ ]
190
+ }]
191
+ ],
192
+ compact: Manager.isBuildMode(),
193
+ }
97
194
  }
98
195
  }
99
- }
100
- ]
101
- },
102
- optimization: {
103
- minimize: MINIFY,
104
- },
196
+ ]
197
+ },
198
+ optimization: {
199
+ minimize: Manager.actLikeProduction(),
200
+ },
201
+ };
105
202
  }
106
203
 
107
204
  // Task
108
205
  function webpack(complete) {
206
+ // Get settings (loads config at runtime)
207
+ const settings = getSettings();
208
+
109
209
  // Log
110
210
  logger.log('Starting...');
211
+ Manager.logMemory(logger, 'Start');
212
+
213
+ // Log mode and devtools
214
+ logger.log(`Mode: ${settings.mode}`);
215
+ logger.log(`Target: ${settings.target[1]}`);
216
+ logger.log(`Devtool: ${settings.devtool}`);
111
217
 
112
- // Update entry points
113
- updateEntryPoints();
218
+ // Build configs array
219
+ const configs = [];
220
+
221
+ // Main entries config
222
+ const mainEntries = updateEntryPoints(input);
223
+ if (Object.keys(mainEntries).length > 0) {
224
+ configs.push({
225
+ ...settings,
226
+ entry: mainEntries
227
+ });
228
+ }
229
+
230
+ // Check if we have a background component that needs service worker config
231
+ const hasBackgroundComponent = Object.keys(mainEntries).some(key =>
232
+ key === 'components/background' || key.includes('components/background/')
233
+ );
234
+
235
+ if (hasBackgroundComponent) {
236
+ // Create separate config for background with service worker settings
237
+ const backgroundEntry = {};
238
+ Object.keys(mainEntries).forEach(key => {
239
+ if (key === 'components/background' || key.includes('components/background/')) {
240
+ backgroundEntry[key] = mainEntries[key];
241
+ delete mainEntries[key];
242
+ }
243
+ });
244
+
245
+ configs.push({
246
+ ...settings,
247
+ entry: backgroundEntry,
248
+ output: {
249
+ ...settings.output,
250
+ // Set global object for service worker
251
+ globalObject: 'self',
252
+ // Service worker output format - use umd to avoid module issues
253
+ libraryTarget: 'umd',
254
+ },
255
+ target: 'webworker',
256
+ optimization: {
257
+ ...settings.optimization,
258
+ // Disable runtime chunk for service worker
259
+ runtimeChunk: false,
260
+ // Disable splitting for service worker to avoid chunk loading issues
261
+ splitChunks: false
262
+ }
263
+ });
264
+ }
114
265
 
115
266
  // Compiler
116
- const compiler = wp(settings, (e, stats) => {
267
+ wp(configs, (e, stats) => {
117
268
  // Log
118
269
  logger.log('Finished!');
119
270
 
120
- // Error
271
+ // Handle fatal webpack errors
121
272
  if (e) {
122
- logger.error(e);
123
- } else {
124
- logger.log('Stats:\n', stats.toString({ colors: true }));
273
+ logger.error('Fatal webpack error:', e);
274
+ return Manager.reportBuildError(Object.assign(e, { plugin: 'Webpack' }), complete);
275
+ }
276
+
277
+ // Log stats
278
+ const statsString = stats.toString({ colors: true });
279
+ logger.log('Stats:\n', statsString);
280
+
281
+ // Check for compilation errors
282
+ if (stats.hasErrors()) {
283
+ const info = stats.toJson();
284
+ logger.error('Webpack compilation failed with errors');
285
+ // Create an error to pass to complete() so the build fails
286
+ const compilationError = new Error(`Webpack compilation failed: ${info.errors.length} error(s)`);
287
+ return Manager.reportBuildError(Object.assign(compilationError, { plugin: 'Webpack' }), complete);
288
+ }
289
+
290
+ // Check for warnings (optional - don't fail build but log them)
291
+ if (stats.hasWarnings()) {
292
+ const info = stats.toJson();
293
+ logger.warn(`Webpack compilation completed with ${info.warnings.length} warning(s)`);
125
294
  }
126
295
 
127
- // Complete
128
- return complete(e);
296
+ // Trigger rebuild
297
+ Manager.triggerRebuild(compiled);
298
+
299
+ // Complete successfully
300
+ return complete();
129
301
  });
130
302
  }
303
+
131
304
  // Watcher task
132
305
  function webpackWatcher(complete) {
133
306
  // Quit if in build mode
@@ -140,35 +313,77 @@ function webpackWatcher(complete) {
140
313
  logger.log('[watcher] Watching for changes...');
141
314
 
142
315
  // Watch for changes
143
- watch(input, { delay: delay }, webpack)
144
- .on('change', function(path) {
316
+ watch(watchInput, { delay: delay, dot: true }, webpack)
317
+ .on('change', (path) => {
145
318
  // Log
146
- logger.log(`[watcher] File ${path} was changed`);
319
+ logger.log(`[watcher] File changed (${path})`);
147
320
  });
148
321
 
149
322
  // Complete
150
323
  return complete();
151
324
  }
152
325
 
153
- function updateEntryPoints() {
326
+ function updateEntryPoints(inputArray) {
154
327
  // Get all JS files
155
- const files = glob(input);
328
+ const files = glob(inputArray).map((f) => path.resolve(f));
329
+
330
+ // Sort: main files first
331
+ files.sort((a, b) => {
332
+ const aIsMain = a.startsWith(rootPathPackage);
333
+ const bIsMain = b.startsWith(rootPathPackage);
334
+ return aIsMain === bIsMain ? 0 : aIsMain ? -1 : 1;
335
+ });
156
336
 
157
337
  // Update from src
158
- settings.entry = files.reduce((acc, file) => {
159
- // Get the file name
160
- const name = path.basename(file, path.extname(file));
338
+ const entries = files.reduce((acc, file) => {
339
+ let name;
340
+
341
+ // Determine naming based on file type
342
+ if (file.includes('/assets/js/bundles/')) {
343
+ // Bundle files: bundles/my-bundle.js -> bundles/my-bundle
344
+ name = file.split('/assets/js/')[1];
345
+ } else if (file.includes('/assets/js/components/')) {
346
+ // Component files: special handling for pages vs other components
347
+ // Pages can have multiple files (index, pricing, login, etc.)
348
+ // Other components (popup, options, etc.) only have index
349
+ const componentPath = file.split('/assets/js/')[1];
350
+ const isInPages = componentPath.includes('/pages/');
351
+
352
+ if (componentPath.endsWith('/index.js') && !isInPages) {
353
+ // For non-pages components: strip /index.js
354
+ // components/popup/index.js -> components/popup
355
+ const parts = componentPath.split('/');
356
+ parts.pop(); // remove index.js
357
+ name = parts.join('/');
358
+ } else {
359
+ // For pages or non-index files: keep full path
360
+ // components/pages/index.js -> components/pages/index
361
+ // components/pages/pricing.js -> components/pages/pricing
362
+ name = componentPath.replace(/\.js$/, '');
363
+ }
364
+ } else if (file.includes('/assets/js/pages/')) {
365
+ // Page files: keep full path
366
+ name = file.split('/assets/js/')[1].replace(/\.js$/, '');
367
+ } else {
368
+ // Everything else: just use the base filename
369
+ name = path.basename(file);
370
+ name = name.replace(/\.js$/, '');
371
+ }
372
+
373
+ // Track the full output path
374
+ const fullPath = path.resolve(process.cwd(), 'dist/assets/js', `${name}.bundle.js`);
375
+ compiled[fullPath] = true;
161
376
 
162
- // Add to entry points starting with "./"
163
- // acc[name] = `./${file}`;
164
- acc[name] = path.resolve(file);
377
+ // Update entry points
378
+ acc[name] = file;
165
379
 
166
380
  // Return
167
381
  return acc;
168
382
  }, {});
169
383
 
170
384
  // Log
171
- logger.log('Updated entry points:', settings.entry);
385
+ logger.log('Updated entry points:', entries);
386
+ return entries;
172
387
  }
173
388
 
174
389
  function getTemplateReplaceOptions() {
@@ -188,49 +403,41 @@ function getTemplateReplaceOptions() {
188
403
  }
189
404
  const now = Math.round(new Date().getTime() / 1000);
190
405
 
191
- // Set webManagerConfiguration
406
+ // Set webManagerConfiguration (matching web-manager's expected structure)
407
+ const webManagerConfig = options.webManager || {};
192
408
  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,
409
+ environment: options.environment || 'production',
410
+ buildTime: now,
411
+ brand: {
412
+ id: options.app?.id || 'extension',
413
+ name: options.brand?.name || 'Extension',
414
+ url: options.brand?.url || '',
415
+ email: options.brand?.email || '',
416
+ brandmark: options.brand?.brandmark || '',
417
+ wordmark: options.brand?.wordmark || '',
418
+ combomark: options.brand?.combomark || '',
419
+ },
420
+ auth: webManagerConfig.auth || { enabled: true, config: {} },
421
+ firebase: {
422
+ app: {
423
+ enabled: !!(options.firebaseConfig?.apiKey || webManagerConfig.firebase?.app?.config?.apiKey),
424
+ config: options.firebaseConfig || webManagerConfig.firebase?.app?.config || {},
203
425
  },
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
- }
426
+ appCheck: webManagerConfig.firebase?.appCheck || { enabled: false, config: {} },
427
+ },
428
+ cookieConsent: webManagerConfig.cookieConsent || { enabled: true, config: {} },
429
+ chatsy: webManagerConfig.chatsy || { enabled: true, config: {} },
430
+ sentry: webManagerConfig.sentry || {
431
+ enabled: !!options.sentry?.dsn,
432
+ config: options.sentry || {}
433
+ },
434
+ exitPopup: webManagerConfig.exitPopup || { enabled: false, config: {} },
435
+ lazyLoading: webManagerConfig.lazyLoading || { enabled: true, config: {} },
436
+ socialSharing: webManagerConfig.socialSharing || { enabled: false, config: {} },
437
+ pushNotifications: webManagerConfig.pushNotifications || { enabled: false, config: {} },
438
+ validRedirectHosts: webManagerConfig.validRedirectHosts || ['itwcreativeworks.com'],
439
+ refreshNewVersion: webManagerConfig.refreshNewVersion || { enabled: true, config: {} },
440
+ serviceWorker: webManagerConfig.serviceWorker || { enabled: false, config: {} },
234
441
  });
235
442
 
236
443
  // 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;