browser-extension-manager 1.3.0 → 1.3.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.
@@ -155,6 +155,36 @@ function getPackageVersion(packageName) {
155
155
  // Build targets
156
156
  const TARGETS = ['chromium', 'firefox'];
157
157
 
158
+ // Recursively remove empty arrays and objects from an object
159
+ function removeEmptyValues(obj) {
160
+ if (Array.isArray(obj)) {
161
+ return obj;
162
+ }
163
+
164
+ if (obj && typeof obj === 'object') {
165
+ const result = {};
166
+ for (const [key, value] of Object.entries(obj)) {
167
+ // Recursively clean nested objects
168
+ const cleaned = removeEmptyValues(value);
169
+
170
+ // Skip empty arrays
171
+ if (Array.isArray(cleaned) && cleaned.length === 0) {
172
+ continue;
173
+ }
174
+
175
+ // Skip empty objects (after cleaning)
176
+ if (cleaned && typeof cleaned === 'object' && !Array.isArray(cleaned) && Object.keys(cleaned).length === 0) {
177
+ continue;
178
+ }
179
+
180
+ result[key] = cleaned;
181
+ }
182
+ return result;
183
+ }
184
+
185
+ return obj;
186
+ }
187
+
158
188
  // Special Compilation Task for manifest.json with default settings
159
189
  async function compileManifest(outputDir, target) {
160
190
  try {
@@ -209,8 +239,11 @@ async function compileManifest(outputDir, target) {
209
239
  }
210
240
  }
211
241
 
242
+ // Remove empty arrays and objects from manifest
243
+ const cleanedManifest = removeEmptyValues(manifest);
244
+
212
245
  // Save as regular JSON
213
- jetpack.write(outputPath, JSON.stringify(manifest, null, 2));
246
+ jetpack.write(outputPath, JSON.stringify(cleanedManifest, null, 2));
214
247
 
215
248
  logger.log(`[${target}] Manifest compiled with defaults`);
216
249
  } catch (e) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "browser-extension-manager",
3
- "version": "1.3.0",
3
+ "version": "1.3.1",
4
4
  "description": "Browser Extension Manager dependency manager",
5
5
  "main": "dist/index.js",
6
6
  "exports": {