Nâng cấp yaml từ 1.x lên 2.x
So sánh API công khai của yaml 1.10.3 và 2.9.1, được tính tự động từ kiểu TypeScript. Chữ ký thay đổi là thay đổi có thể không tương thích, không phải điều chắc chắn.
Tóm tắt
| Đường dẫn import bị xóa | 0 |
|---|---|
| Export bị xóa | 6 |
| Chữ ký thay đổi | 4 |
| Thành viên lớp hoặc interface bị xóa | 12 |
| Thành viên lớp hoặc interface thay đổi | 18 |
| Mới bị ngừng hỗ trợ | 0 |
| Thay đổi yêu cầu (engines, phụ thuộc peer) | 1 |
| Export mới | 44 |
Export bị xóa
| import | export | kind | Trước |
|---|---|---|---|
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 |
Chữ ký thay đổi
| export | Trước | Sau |
|---|---|---|
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>)[] |
Thành viên lớp hoặc interface bị xóa
| member | import | Trước |
|---|---|---|
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 |
Thành viên lớp hoặc interface thay đổi
| member | Trước | Sau |
|---|---|---|
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 |
Mới bị ngừng hỗ trợ
Không phát hiện.
Thay đổi yêu cầu (engines, phụ thuộc peer)
| Trước | Sau | |
|---|---|---|
engines.node | >= 6 | >= 14.6 |
Export mới (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 |
Câu hỏi thường gặp
Nâng cấp yaml từ 1 lên 2 có những thay đổi không tương thích nào?
Giữa yaml 1.10.3 và 2.9.1, Vigia tìm thấy 6 export bị xóa, 4 chữ ký thay đổi và 30 thành viên lớp hoặc interface bị xóa hay thay đổi.
Những gì bị ngừng hỗ trợ trong yaml 2?
0 export hoặc thành viên mới bị đánh dấu ngừng hỗ trợ trong yaml 2.9.1.
Dành cho tác tử
GET https://vigia.coredls.cloud/v1/packages/npm/yaml/upgrade?from=1.10.3&to=2.9.1