Passer de yaml 1.x à 2.x
Comparaison de l’API publique de yaml 1.10.3 et 2.9.1, calculée automatiquement à partir de leurs types TypeScript. Une signature modifiée est un changement incompatible possible, pas une certitude.
Résumé
| Chemins d’importation supprimés | 0 |
|---|---|
| Exports supprimés | 6 |
| Signatures modifiées | 4 |
| Membres de classes ou d’interfaces supprimés | 12 |
| Membres de classes ou d’interfaces modifiés | 18 |
| Nouvelles dépréciations | 0 |
| Changements d’exigences (engines, dépendances peer) | 1 |
| Nouveaux exports | 44 |
Exports supprimés
| import | export | kind | Avant |
|---|---|---|---|
yaml | AST | namespace | namespace |
yaml | Options | interface | interface |
yaml | parseCST | function | (str: string): ParsedCST |
yaml | createNode | function | (value: any, wrapScalars?: true | undefined, tag?: string | undefined): YAMLMap | YAMLSeq | Scalar | (value: any, wrapScalars: false, tag?: string | undefined): string | number | boolean | YAMLMap | YAMLSeq | null |
yaml | scalarOptions | variable | { binary: Binary; bool: Bool; int: Int; null: Null; str: Str; } |
yaml | defaultOptions | variable | Options |
Signatures modifiées
| export | Avant | Après |
|---|---|---|
yaml · parse | (str: string, options?: Options | undefined): any | (src: string, options?: (ParseOptions & DocumentOptions & SchemaOptions & ToJSOptions) | undefined): any | (src: string, reviver: Reviver, options?: (ParseOptions & DocumentOptions & SchemaOptions & ToJSOptions) | undefined): any |
yaml · stringify | (value: any, options?: Options | undefined): string | (value: any, options?: (DocumentOptions & SchemaOptions & ParseOptions & CreateNodeOptions & ToStringOptions) | undefined): string | (value: any, replacer?: Replacer | null | undefined, options?: string | number | (DocumentOptions & SchemaOptions & ParseOptions & CreateNodeOptions & ToStringOptions) | undefined): string |
yaml · parseDocument | (str: string, options?: Options | undefined): Parsed | <Contents extends Node = ParsedNode, Strict extends boolean = true>(source: string, options?: (ParseOptions & DocumentOptions & SchemaOptions) | undefined): Contents extends ParsedNode ? Parsed<Contents, Strict> : Document<Contents, Strict> |
yaml · parseAllDocuments | (str: string, options?: Options | undefined): Parsed[] | <Contents extends Node = ParsedNode, Strict extends boolean = true>(source: string, options?: (ParseOptions & DocumentOptions & SchemaOptions) | undefined): EmptyStream | (Contents extends ParsedNode ? Parsed<Contents, Strict> : Document<Contents, Strict>)[] |
Membres de classes ou d’interfaces supprimés
| member | import | Avant |
|---|---|---|
Document.tag | yaml | never |
Document.type | yaml | Type.DOCUMENT |
Document.items | yaml | any[] |
Document.parse | yaml | (cst: Document): Document |
Document.anchors | yaml | Anchors |
Document.cstNode | yaml | Document | undefined |
Document.version | yaml | string | undefined |
Document.spaceBefore | yaml | boolean | undefined |
Document.tagPrefixes | yaml | TagPrefix[] |
Document.setTagPrefix | yaml | (handle: string, prefix: string): void |
Document.listNonDefaultTags | yaml | (): string[] |
Document.directivesEndMarker | yaml | boolean | undefined |
Membres de classes ou d’interfaces modifiés
| member | Avant | Après |
|---|---|---|
Document.get | (key: any, keepScalar?: boolean | undefined): any | (key: unknown, keepScalar?: boolean | undefined): Strict extends true ? unknown : any |
Document.has | (key: any): boolean | (key: unknown): boolean |
Document.set | (key: any, value: any): void | (key: any, value: unknown): void |
Document.addIn | (path: Iterable<any>, value: any): void | (path: Iterable<unknown>, value: unknown): void |
Document.getIn | (path: Iterable<any>, keepScalar?: boolean | undefined): any | (path: Iterable<unknown> | null, keepScalar?: boolean | undefined): Strict extends true ? unknown : any |
Document.hasIn | (path: Iterable<any>): boolean | (path: Iterable<unknown> | null): boolean |
Document.range | [number, number] | null | undefined | Range | undefined |
Document.setIn | (path: Iterable<any>, value: any): void | (path: Iterable<unknown> | null, value: unknown): void |
Document.delete | (key: any): boolean | (key: unknown): boolean |
Document.schema | Schema | undefined | Schema |
Document.toJSON | (arg?: string | undefined, onAnchor?: ((value: any, count: number) => void) | undefined): any | (jsonArg?: string | null | undefined, onAnchor?: ((value: unknown, count: number) => void) | undefined): any |
Document.comment | string | null | undefined | string | null |
Document.contents | any | Strict extends true ? Contents | null : Contents |
Document.deleteIn | (path: Iterable<any>): boolean | (path: Iterable<unknown> | null): boolean |
Document.toString | (): string | (options?: ToStringOptions | undefined): string |
Document.setSchema | (id?: "1.0" | "1.1" | "1.2" | Name | undefined, customTags?: (TagId | Tag)[] | undefined): void | (version: "1.1" | "1.2" | "next" | null, options?: SchemaOptions | undefined): void |
Document.constructor | (options?: Options | undefined): Document | <Contents extends Node = Node, Strict extends boolean = true>(value?: any, options?: (DocumentOptions & SchemaOptions & ParseOptions & CreateNodeOptions) | undefined): Document<Contents, Strict> | <Contents extends Node = Node, Strict extends boolean = true>(value: any, replacer: Replacer | null, op… |
Document.commentBefore | string | null | undefined | string | null |
Nouvelles dépréciations
Aucun détecté.
Changements d’exigences (engines, dépendances peer)
| Avant | Après | |
|---|---|---|
engines.node | >= 6 | >= 14.6 |
Nouveaux exports (44)
| import | export | kind |
|---|---|---|
yaml | Node | type |
yaml | Pair | class |
yaml | Tags | type |
yaml | Alias | class |
yaml | Lexer | class |
yaml | Range | type |
yaml | TagId | type |
yaml | isMap | variable |
yaml | isSeq | variable |
yaml | visit | function |
yaml | Parser | class |
yaml | Scalar | class |
yaml | Schema | class |
yaml | isNode | function |
yaml | isPair | variable |
yaml | YAMLMap | class |
yaml | YAMLSeq | class |
yaml | YAMLSet | class |
yaml | isAlias | variable |
yaml | visitor | type |
yaml | Composer | class |
yaml | YAMLOMap | class |
yaml | isScalar | variable |
yaml | ErrorCode | type |
yaml | ScalarTag | interface |
yaml | YAMLError | class |
yaml | visitorFn | type |
yaml | ParsedNode | type |
yaml | isDocument | variable |
yaml | visitAsync | function |
yaml | EmptyStream | interface |
yaml | LineCounter | class |
yaml | ToJSOptions | type |
yaml | YAMLWarning | class |
yaml | ParseOptions | type |
yaml | asyncVisitor | type |
yaml | isCollection | function |
yaml | CollectionTag | interface |
yaml | SchemaOptions | type |
yaml | YAMLParseError | class |
yaml | asyncVisitorFn | type |
yaml | DocumentOptions | type |
yaml | ToStringOptions | type |
yaml | CreateNodeOptions | type |
Questions fréquentes
Quels sont les changements incompatibles en passant de yaml 1 à 2 ?
Entre yaml 1.10.3 et 2.9.1, Vigia a trouvé 6 exports supprimés, 4 signatures modifiées et 30 membres de classes ou d’interfaces supprimés ou modifiés.
Qu’est-ce qui a été déprécié dans yaml 2 ?
0 exports ou membres sont désormais marqués comme dépréciés dans yaml 2.9.1.
Pour les agents
GET https://vigia.coredls.cloud/v1/packages/npm/yaml/upgrade?from=1.10.3&to=2.9.1