@julien-lin/universal-pwa-core 1.3.2 → 1.3.4

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/dist/index.cjs CHANGED
@@ -2435,27 +2435,48 @@ function injectMetaTags(htmlContent, options = {}) {
2435
2435
  result.warnings.push('Removed deprecated <meta name="apple-mobile-web-app-capable">');
2436
2436
  }
2437
2437
  }
2438
- if (!elementExists(parsed, "meta", { name: "mobile-web-app-capable", value: content })) {
2438
+ const existingMeta = findElement(parsed, "meta", { name: "name", value: "mobile-web-app-capable" });
2439
+ if (existingMeta) {
2440
+ const existingContent = existingMeta.attribs?.content;
2441
+ if (existingContent === content) {
2442
+ result.skipped.push("mobile-web-app-capable (already exists)");
2443
+ } else {
2444
+ updateMetaContent(existingMeta, content);
2445
+ result.injected.push(`<meta name="mobile-web-app-capable" content="${content}"> (updated)`);
2446
+ }
2447
+ } else {
2439
2448
  injectMetaTag(head, "mobile-web-app-capable", content);
2440
2449
  result.injected.push(`<meta name="mobile-web-app-capable" content="${content}">`);
2441
- } else {
2442
- result.skipped.push("mobile-web-app-capable (already exists)");
2443
2450
  }
2444
2451
  }
2445
2452
  if (options.appleMobileWebAppStatusBarStyle) {
2446
- if (!elementExists(parsed, "meta", { name: "apple-mobile-web-app-status-bar-style", value: options.appleMobileWebAppStatusBarStyle })) {
2453
+ const existingMeta = findElement(parsed, "meta", { name: "name", value: "apple-mobile-web-app-status-bar-style" });
2454
+ if (existingMeta) {
2455
+ const existingContent = existingMeta.attribs?.content;
2456
+ if (existingContent === options.appleMobileWebAppStatusBarStyle) {
2457
+ result.skipped.push("apple-mobile-web-app-status-bar-style (already exists)");
2458
+ } else {
2459
+ updateMetaContent(existingMeta, options.appleMobileWebAppStatusBarStyle);
2460
+ result.injected.push(`<meta name="apple-mobile-web-app-status-bar-style" content="${options.appleMobileWebAppStatusBarStyle}"> (updated)`);
2461
+ }
2462
+ } else {
2447
2463
  injectMetaTag(head, "apple-mobile-web-app-status-bar-style", options.appleMobileWebAppStatusBarStyle);
2448
2464
  result.injected.push(`<meta name="apple-mobile-web-app-status-bar-style" content="${options.appleMobileWebAppStatusBarStyle}">`);
2449
- } else {
2450
- result.skipped.push("apple-mobile-web-app-status-bar-style (already exists)");
2451
2465
  }
2452
2466
  }
2453
2467
  if (options.appleMobileWebAppTitle) {
2454
- if (!elementExists(parsed, "meta", { name: "apple-mobile-web-app-title", value: options.appleMobileWebAppTitle })) {
2468
+ const existingMeta = findElement(parsed, "meta", { name: "name", value: "apple-mobile-web-app-title" });
2469
+ if (existingMeta) {
2470
+ const existingContent = existingMeta.attribs?.content;
2471
+ if (existingContent === options.appleMobileWebAppTitle) {
2472
+ result.skipped.push("apple-mobile-web-app-title (already exists)");
2473
+ } else {
2474
+ updateMetaContent(existingMeta, options.appleMobileWebAppTitle);
2475
+ result.injected.push(`<meta name="apple-mobile-web-app-title" content="${options.appleMobileWebAppTitle}"> (updated)`);
2476
+ }
2477
+ } else {
2455
2478
  injectMetaTag(head, "apple-mobile-web-app-title", options.appleMobileWebAppTitle);
2456
2479
  result.injected.push(`<meta name="apple-mobile-web-app-title" content="${options.appleMobileWebAppTitle}">`);
2457
- } else {
2458
- result.skipped.push("apple-mobile-web-app-title (already exists)");
2459
2480
  }
2460
2481
  }
2461
2482
  let body = parsed.body;
package/dist/index.js CHANGED
@@ -2359,27 +2359,48 @@ function injectMetaTags(htmlContent, options = {}) {
2359
2359
  result.warnings.push('Removed deprecated <meta name="apple-mobile-web-app-capable">');
2360
2360
  }
2361
2361
  }
2362
- if (!elementExists(parsed, "meta", { name: "mobile-web-app-capable", value: content })) {
2362
+ const existingMeta = findElement(parsed, "meta", { name: "name", value: "mobile-web-app-capable" });
2363
+ if (existingMeta) {
2364
+ const existingContent = existingMeta.attribs?.content;
2365
+ if (existingContent === content) {
2366
+ result.skipped.push("mobile-web-app-capable (already exists)");
2367
+ } else {
2368
+ updateMetaContent(existingMeta, content);
2369
+ result.injected.push(`<meta name="mobile-web-app-capable" content="${content}"> (updated)`);
2370
+ }
2371
+ } else {
2363
2372
  injectMetaTag(head, "mobile-web-app-capable", content);
2364
2373
  result.injected.push(`<meta name="mobile-web-app-capable" content="${content}">`);
2365
- } else {
2366
- result.skipped.push("mobile-web-app-capable (already exists)");
2367
2374
  }
2368
2375
  }
2369
2376
  if (options.appleMobileWebAppStatusBarStyle) {
2370
- if (!elementExists(parsed, "meta", { name: "apple-mobile-web-app-status-bar-style", value: options.appleMobileWebAppStatusBarStyle })) {
2377
+ const existingMeta = findElement(parsed, "meta", { name: "name", value: "apple-mobile-web-app-status-bar-style" });
2378
+ if (existingMeta) {
2379
+ const existingContent = existingMeta.attribs?.content;
2380
+ if (existingContent === options.appleMobileWebAppStatusBarStyle) {
2381
+ result.skipped.push("apple-mobile-web-app-status-bar-style (already exists)");
2382
+ } else {
2383
+ updateMetaContent(existingMeta, options.appleMobileWebAppStatusBarStyle);
2384
+ result.injected.push(`<meta name="apple-mobile-web-app-status-bar-style" content="${options.appleMobileWebAppStatusBarStyle}"> (updated)`);
2385
+ }
2386
+ } else {
2371
2387
  injectMetaTag(head, "apple-mobile-web-app-status-bar-style", options.appleMobileWebAppStatusBarStyle);
2372
2388
  result.injected.push(`<meta name="apple-mobile-web-app-status-bar-style" content="${options.appleMobileWebAppStatusBarStyle}">`);
2373
- } else {
2374
- result.skipped.push("apple-mobile-web-app-status-bar-style (already exists)");
2375
2389
  }
2376
2390
  }
2377
2391
  if (options.appleMobileWebAppTitle) {
2378
- if (!elementExists(parsed, "meta", { name: "apple-mobile-web-app-title", value: options.appleMobileWebAppTitle })) {
2392
+ const existingMeta = findElement(parsed, "meta", { name: "name", value: "apple-mobile-web-app-title" });
2393
+ if (existingMeta) {
2394
+ const existingContent = existingMeta.attribs?.content;
2395
+ if (existingContent === options.appleMobileWebAppTitle) {
2396
+ result.skipped.push("apple-mobile-web-app-title (already exists)");
2397
+ } else {
2398
+ updateMetaContent(existingMeta, options.appleMobileWebAppTitle);
2399
+ result.injected.push(`<meta name="apple-mobile-web-app-title" content="${options.appleMobileWebAppTitle}"> (updated)`);
2400
+ }
2401
+ } else {
2379
2402
  injectMetaTag(head, "apple-mobile-web-app-title", options.appleMobileWebAppTitle);
2380
2403
  result.injected.push(`<meta name="apple-mobile-web-app-title" content="${options.appleMobileWebAppTitle}">`);
2381
- } else {
2382
- result.skipped.push("apple-mobile-web-app-title (already exists)");
2383
2404
  }
2384
2405
  }
2385
2406
  let body = parsed.body;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@julien-lin/universal-pwa-core",
3
- "version": "1.3.2",
3
+ "version": "1.3.4",
4
4
  "description": "Core engine for scanning, generation, and injection for UniversalPWA",
5
5
  "keywords": [
6
6
  "pwa",
@@ -61,7 +61,7 @@
61
61
  "workbox-routing": "^7.4.0",
62
62
  "workbox-strategies": "^7.4.0",
63
63
  "zod": "^4.2.1",
64
- "@julien-lin/universal-pwa-templates": "^1.3.2"
64
+ "@julien-lin/universal-pwa-templates": "^1.3.4"
65
65
  },
66
66
  "devDependencies": {
67
67
  "@vitest/coverage-v8": "^2.1.4",