@mapbox/mapbox-gl-style-spec 14.0.0 → 14.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.
package/diff.js CHANGED
@@ -462,7 +462,7 @@ export function diffImports(before: Array<ImportSpecification> = [], after: Arra
462
462
  export default function diffStyles(before: StyleSpecification, after: StyleSpecification): Array<Command> {
463
463
  if (!before) return [{command: operations.setStyle, args: [after]}];
464
464
 
465
- let commands = [];
465
+ let commands: Array<Command> = [];
466
466
 
467
467
  try {
468
468
  // Handle changes to top-level properties
@@ -487,6 +487,10 @@ export default function diffStyles(before: StyleSpecification, after: StyleSpeci
487
487
  if (!isEqual(before.glyphs, after.glyphs)) {
488
488
  commands.push({command: operations.setGlyphs, args: [after.glyphs]});
489
489
  }
490
+ // Handle changes to `imports` before other mergable top-level properties
491
+ if (!isEqual(before.imports, after.imports)) {
492
+ diffImports(before.imports, after.imports, commands);
493
+ }
490
494
  if (!isEqual(before.transition, after.transition)) {
491
495
  commands.push({command: operations.setTransition, args: [after.transition]});
492
496
  }
@@ -550,9 +554,6 @@ export default function diffStyles(before: StyleSpecification, after: StyleSpeci
550
554
 
551
555
  // Handle changes to `layers`
552
556
  diffLayers(beforeLayers, after.layers, commands);
553
-
554
- // Handle changes to `imports`
555
- diffImports(before.imports, after.imports, commands);
556
557
  } catch (e) {
557
558
  // fall back to setStyle
558
559
  console.warn('Unable to compute style diff:', e);