Aggiornare yaml da 1.x a 2.x
Confronto dell’API pubblica di yaml 1.10.3 e 2.9.1, calcolato automaticamente dai tipi TypeScript. Una firma modificata è una possibile modifica incompatibile, non una certezza.
Riepilogo
| Percorsi di import rimossi | 0 |
|---|---|
| Export rimossi | 6 |
| Firme modificate | 4 |
| Membri di classi o interfacce rimossi | 12 |
| Membri di classi o interfacce modificati | 18 |
| Nuove deprecazioni | 0 |
| Requisiti cambiati (engines, dipendenze peer) | 1 |
| Nuovi export | 44 |
Export rimossi
| import | export | kind | Prima |
|---|---|---|---|
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 |
Firme modificate
| export | Prima | Dopo |
|---|---|---|
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>)[] |
Membri di classi o interfacce rimossi
| member | import | Prima |
|---|---|---|
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 |
Membri di classi o interfacce modificati
| member | Prima | Dopo |
|---|---|---|
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 |
Nuove deprecazioni
Nessuna rilevata.
Requisiti cambiati (engines, dipendenze peer)
| Prima | Dopo | |
|---|---|---|
engines.node | >= 6 | >= 14.6 |
Nuovi export (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 |
Domande frequenti
Quali sono le modifiche incompatibili aggiornando yaml da 1 a 2?
Tra yaml 1.10.3 e 2.9.1, Vigia ha trovato 6 export rimossi, 4 firme modificate e 30 membri di classi o interfacce rimossi o modificati.
Cosa è stato deprecato in yaml 2?
0 export o membri risultano ora deprecati in yaml 2.9.1.
Per gli agenti
GET https://vigia.coredls.cloud/v1/packages/npm/yaml/upgrade?from=1.10.3&to=2.9.1