Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor exports #99

Merged
merged 23 commits into from
Mar 27, 2019
Merged

Refactor exports #99

merged 23 commits into from
Mar 27, 2019

Conversation

eemeli
Copy link
Owner

@eemeli eemeli commented Mar 18, 2019

Closes #94; see also #89.

After this, the public API will be:

const YAML = require('yaml')
const parseCST = require('yaml/parse-cst')

const {
  binaryOptions, boolOptions, nullOptions, strOptions,
  Pair,
  Scalar,
  Schema,
  YAMLMap,
  YAMLSeq
} = require('yaml/types')

const {
  findPair,
  parseMap, parseSeq,
  stringifyNumber, stringifyString,
  toJSON,
  Type,
  YAMLReferenceError, YAMLSemanticError, YAMLSyntaxError, YAMLWarning
} = require('yaml/util')

The previous endpoints (e.g. yaml/schema, yaml/types/omap, etc.) will still work, but they should be considered deprecated and liable to be removed in the next major update.

The built-in custom tags are now available using string identifiers, so they don't need to be publicly exported, e.g. YAML.parse(src, { tags: ['intTime', 'omap'] })

In related changes, this PR drops babel-plugin-add-module-exports, using instead a custom non-compiled main export, and improves the API for writing custom types.

Edit: Updated API description with changes made in 4f9d104

@eemeli eemeli merged commit 0d4d01c into master Mar 27, 2019
@eemeli eemeli deleted the re-export branch March 27, 2019 06:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant