diff --git a/.changeset/late-files-wave.md b/.changeset/late-files-wave.md new file mode 100644 index 0000000..7a32b3d --- /dev/null +++ b/.changeset/late-files-wave.md @@ -0,0 +1,6 @@ +--- +'@lottiefiles/relottie-extract-features': major +'@lottiefiles/relottie-metadata': major +--- + +feat: use v2 relottie packages with required changes diff --git a/packages/relottie-extract-features/src/extract-features.ts b/packages/relottie-extract-features/src/extract-features.ts index 12cfaf9..ecde1df 100644 --- a/packages/relottie-extract-features/src/extract-features.ts +++ b/packages/relottie-extract-features/src/extract-features.ts @@ -2,7 +2,7 @@ * Copyright 2022 Design Barn Inc. */ -import type { Root, AnyTitle, NodeValue, KeyNode, Primitive } from '@lottiefiles/last'; +import type { Root, AnyTitle, NodeValue, KeyNode, PrimitiveNode } from '@lottiefiles/last'; import type { Plugin } from 'unified'; import { visitParents } from 'unist-util-visit-parents'; import type { Data, VFile } from 'vfile'; @@ -35,7 +35,7 @@ export interface ExtractFeaturesFileData extends Data { } type AncestorChildNode = Exclude; -type AncestorNode = Exclude; +type AncestorNode = Exclude; const extractFeatures: Plugin<[Options?], Root> = (_ops: Options = {}) => { // const options = { ...DEFAULT_OPTIONS, ...ops }; diff --git a/packages/relottie-extract-features/src/used-features.ts b/packages/relottie-extract-features/src/used-features.ts index 13b5fd9..712ae9f 100644 --- a/packages/relottie-extract-features/src/used-features.ts +++ b/packages/relottie-extract-features/src/used-features.ts @@ -10,7 +10,7 @@ import type { Element, Collection, ArrayNode, - Primitive, + PrimitiveNode, Root, } from '@lottiefiles/last'; @@ -52,7 +52,7 @@ export const elementNodeChecker: IsFeatureUsedChecker = (node): boolean return objectNodeChecker(objectNode); }; -export const primitiveNodeChecker: IsFeatureUsedChecker = (node): boolean => { +export const primitiveNodeChecker = (node: PrimitiveNode): boolean => { const value = node.value; switch (typeof value) { @@ -176,19 +176,19 @@ export const isFeatureUsed = (feature: AnyTitle, node: NodeWithTitle): boolean = } switch (node.type) { - case 'attribute': + case 'Attribute': return attributeValueChecker(node); - case 'element': + case 'Element': return elementNodeChecker(node); - case 'collection': + case 'Collection': return collectionNodeChecker(node); - case 'array': + case 'Array': return arrayNodeChecker(node); - case 'object': + case 'Object': return objectNodeChecker(node); default: diff --git a/packages/relottie-metadata/src/metadata.ts b/packages/relottie-metadata/src/metadata.ts index 055388f..54f7a75 100644 --- a/packages/relottie-metadata/src/metadata.ts +++ b/packages/relottie-metadata/src/metadata.ts @@ -156,7 +156,7 @@ const getRgbaFromNode = (node: Collection): number[] => { if (!valueNode) return []; const rgbaColor = valueNode.children.reduce((acc, child) => { - if (child.type !== 'primitive') return acc; + if (child.type !== 'Number') return acc; const childValue = child.value;