Skip to content

Commit

Permalink
feat: bump pnpm & momoa to v3.3.5 with required changes (#127)
Browse files Browse the repository at this point in the history
* feat: bump Momoa with initial required changes

* fix(helpers): assertNodeType msg

* fix: array node detection after an extra momoa element layer

* refactor: move MomoaParent type to helpers

* chore: update package-lock

* chore: bump pnpm to 9.12.3 & update lock file

* ci: use gpr_token for pnpm i

* ci: remove registry on node setup for validate

* ci(validate): use gh token for pnpm install
  • Loading branch information
Aidosmf authored Dec 12, 2024
1 parent 9ab60da commit 13a5a25
Show file tree
Hide file tree
Showing 10 changed files with 2,037 additions and 2,563 deletions.
5 changes: 5 additions & 0 deletions .changeset/tidy-lizards-bake.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@lottiefiles/relottie-parse': minor
---

feat: bump Momoa to v3.3.5 with required changes
1 change: 0 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ jobs:
with:
cache: pnpm
node-version: ${{ matrix.node-version }}
registry-url: 'https://npm.pkg.github.com'

- name: 📥 Install dependencies
run: pnpm install
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,5 +59,5 @@
"turbo": "1.3.4",
"typescript": "4.7.4"
},
"packageManager": "pnpm@9.4.0"
"packageManager": "pnpm@9.12.3"
}
2 changes: 1 addition & 1 deletion packages/relottie-parse/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
"type-check": "tsc --noEmit"
},
"dependencies": {
"@humanwhocodes/momoa": "2.0.4",
"@humanwhocodes/momoa": "3.3.5",
"@lottiefiles/last": "workspace:*",
"@lottiefiles/last-builder": "workspace:*",
"unist-util-is": "5.1.1"
Expand Down
32 changes: 21 additions & 11 deletions packages/relottie-parse/src/entities.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,16 @@
/**
* Copyright 2022 Design Barn Inc.
* Copyright 2024 Design Barn Inc.
*/

import type {
ValueNode as MomoaValueNode,
ObjectNode as MomoaObject,
AnyNode as MomoaAnyNode,
ArrayNode as MomoaArray,
StringNode as MomoaString,
NumberNode as MomoaNumber,
MemberNode as MomoaMember,
} from '@humanwhocodes/momoa';
import type {
Key,
NodeValueType,
Expand All @@ -19,6 +28,7 @@ import type {
import { TITLES } from '@lottiefiles/last';

import { constantNumValues, constantStrValues } from './constants.js';
import type { MomoaPrimitive } from './helpers.js';

const {
boolean: BT,
Expand Down Expand Up @@ -80,26 +90,26 @@ export interface DependentBase {
/**
* Dependent node's type
*/
type: Momoa.AstNode['type'] | 'Constant';
type: MomoaAnyNode['type'] | 'Constant';
}

export interface DependentPrimitive extends DependentBase {
parentTitle: ParentTitle;
type: Momoa.PrimitiveTypes | Momoa.Obj['type'];
type: MomoaPrimitive['type'] | MomoaObject['type'];
}

export interface DependentObject extends DependentBase {
parentTitle: ParentTitle;
type: Momoa.Obj['type'];
type: MomoaObject['type'];
}

export interface DependentArray extends DependentBase {
/**
* if present the "childType" will be checked as well
*/
childType?: Momoa.Element['type'];
childType?: MomoaValueNode['type'];
parentTitle: ParentTitle;
type: Momoa.Arr['type'];
type: MomoaArray['type'];
}

export interface DependentConstant extends DependentBase {
Expand Down Expand Up @@ -970,7 +980,7 @@ const createDependentTitles = (

export const arrayEntity: NoKeyEntityMap = {};

export const getNoKeyEntity = (node: Momoa.Arr | Momoa.Obj, parentTitle: ParentTitle): NoKeyEntity => {
export const getNoKeyEntity = (node: MomoaArray | MomoaObject, parentTitle: ParentTitle): NoKeyEntity => {
switch (node.type) {
case 'Object':
return objectEntity[parentTitle] || { defaultTitle: parentTitle };
Expand Down Expand Up @@ -2199,7 +2209,7 @@ export const getElementData = (key: Key, parentTitle: ParentTitle): Entity<Eleme

export const getNumberConstantEntity = (
key: Key,
member: Momoa.Num,
member: MomoaNumber,
parentTitle: ParentTitle,
): Entity<AttributeTitle> => {
const constantEntity = getEntityData<AttributeTitle>(key, parentTitle, numberConstantEntity, 'constant');
Expand All @@ -2221,7 +2231,7 @@ export const getNumberConstantEntity = (

export const getStringConstantEntity = (
key: Key,
member: Momoa.Str,
member: MomoaString,
parentTitle: ParentTitle,
): Entity<AttributeTitle> => {
const constantEntity = getEntityData<AttributeTitle>(key, parentTitle, stringConstantEntity, 'constant');
Expand All @@ -2239,7 +2249,7 @@ export const getStringConstantEntity = (
return constantEntity;
};

export const getAttributeData = (key: Key, member: Momoa.Member, parentTitle: ParentTitle): Entity<AttributeTitle> => {
export const getAttributeData = (key: Key, member: MomoaMember, parentTitle: ParentTitle): Entity<AttributeTitle> => {
switch (member.value.type) {
case 'String':
const stringTitles = getEntityData<AttributeTitle>(key, parentTitle, stringEntity, 'attribute');
Expand Down Expand Up @@ -2271,7 +2281,7 @@ export const getAttributeData = (key: Key, member: Momoa.Member, parentTitle: Pa
}
};

export const getMemberEntity = (key: Key, member: Momoa.Member, parentTitle: ParentTitle): Entity => {
export const getMemberEntity = (key: Key, member: MomoaMember, parentTitle: ParentTitle): Entity => {
switch (member.value.type) {
case 'Array':
return getCollectionData(key, parentTitle);
Expand Down
Loading

0 comments on commit 13a5a25

Please sign in to comment.