Skip to content
greek conversion

Stability policy

The library follows Semantic Versioning (opens in a new tab). This document states what the version number promises: which parts of the package are covered, what counts as a breaking change, and how conversion output itself is treated. It applies from 1.0.0.

The short version: the contract is the documented behavior, not the bytes a given version happens to produce. A change that brings output closer to the documented contract is a correction; a change to the contract is a feature or a break, depending on whether existing documented behavior survives.

The public API is everything exported from the entry points:

  • @humanities/greek-conversion (the main module);
  • @humanities/greek-conversion/document (the advanced canonical-document API);
  • @humanities/greek-conversion/core (the conversions that take readers, writers, and prepared options), with @humanities/greek-conversion/greek, /beta-code, and /transliteration (the reader and the writer of each format) and @humanities/greek-conversion/presets (the presets as prepared options).

This includes runtime values, classes and their public members, types, option keys and values, preset identifiers, diagnostic codes, the error classes thrown for documented conditions, and the behaviors documented in docs/ and in the API documentation (the TSDoc comments of the exported declarations). Guarantees and limits gathers the properties every conversion keeps. The README, its examples, and any guide or translation of this documentation illustrate these behaviors without extending them; where they differ, the English text of docs/ and of the API documentation prevails.

Not covered, and free to change in any release:

  • direct imports of src/*.ts modules, which are implementation details even though JSR serves them;
  • the documentation site and the playground, the build scripts, the test suite and its fixtures;
  • the English text of diagnostic and error messages (see below);
  • the exact limitations, description, and coverage texts of preset metadata, which are descriptive;
  • the npm package layout beyond its declared exports;
  • which modules a bundle keeps from an entry point, and its size: the guide on smaller bundles gives the sizes of a release, which its checks keep up to date, not a promise.
  • Removing or renaming an export, a class member, an option key, an option value, a preset identifier, a format identifier, or a diagnostic code.
  • Changing the type of a public field, parameter, or return value in a way that rejects previously valid input or previously valid reads.
  • Changing the error class thrown for a documented condition, or throwing where the documentation said a value is returned.
  • Changing the default value of an option.
  • Changing the canonical output of a conversion for valid, in-scope input under fixed options, except as described under Corrections and Canonical spelling below.
  • Changing the meaning of a Document field, or removing a field.
  • New exports, option keys, option values, presets, format-independent helpers, and Converter configuration fields, provided existing calls keep their behavior.
  • New diagnostic codes in ConversionLossCode, ValidationCode, and CharacterScopeDiagnosticCode, and new members of Letter, Diacritic, and GlyphVariant. These unions are open: consumers must treat an unknown code or member as possible and should not rely on exhaustive switch statements without a default branch.
  • New optional fields on Document tokens, diagnostics, and results.
  • Recognition of characters or spellings that were previously preserved as literals. Such input converts differently afterwards; the previous behavior (literal preservation) is the documented fallback for unrecognized input, not a promise that the input stays unrecognized.
  • Changes to a preset’s option contents that extend its coverage of the cited reference without changing output for input the preset already handled.
  • Raising the minimum Node.js version declared in the npm engines field, once the versions below the new minimum are no longer maintained.

A patch release may change conversion output when the previous output contradicted the documented contract. This covers:

  • output that validateDocument() rejects, or that is not idempotent, or whose convertDetailed() report is wrong, contrary to the guarantees;
  • output of a preset that disagrees with the preset’s cited reference for a rule the preset documents as implemented;
  • a parser reading a documented spelling as the wrong canonical document.

The rationale is that a preset’s contract is its reference, and the engine’s contract is its documentation; the version number protects those, not the defects. Every such correction is listed in the changelog under Fixed with a before-and-after example. Applications that need byte-for-byte stability across releases should pin an exact version and rely on the differential corpus in tests/fixtures.ts and the conformance corpora in docs/ to review upgrades.

A correction never changes output that the documentation presents as a deliberate choice; changing such a choice is a canonical spelling change or a break.

The engine selects one canonical spelling for each format (combining-mark order, composed scalars, Beta Code mark order, alias resolution). Changing that selection is a minor change when all of the following hold:

  • the canonical document is unchanged, so the change is representational;
  • the previous spelling remains accepted as input and parses to the same document;
  • the change is listed in the changelog under Changed with examples.

Otherwise it is a break.

A reader reads the convention that its format and options define:

  • the spellings the encoder writes under those options;
  • their Unicode equivalents (composition and combining-mark order);
  • the variant spellings this documentation lists, such as j and #401 for yot in Beta Code, or ϐ, ϲ, and the other letter forms in Greek.

These spellings are protected like output: a release that stops reading one of them, or reads it as another document, follows the change classes above.

A reader may accept a spelling from another convention as well, such as ch for chi under chi: "kh", provided that the encoder never writes the same letters with another meaning under the same options. Otherwise reading its own output back would change it, and the output would no longer be idempotent. Such spellings are a convenience, not documented variants: a minor release may stop accepting them, or leave them to a separate repair step.

Hence, under phi: "f", ph is pi followed by a rough breathing, which is how πἡ is written (phē), and not phi. Under chi: "kh" with lunateSigma: "c", ch is a lunate sigma followed by a rough breathing (ϲἡ → chē). Where gamma stays g before kappa but becomes n before chi (nasalGamma: "nasal-except-kappa" or "nasal-medial-kappa"), gkh under chi: "kh" is gamma, kappa, and a rough breathing (γκἡ → gkhē). A text that mixes conventions is not guessed: it is read by the convention of the options.

A conversion reads its input with the options of source when they are given, and writes its output with the others: a transliteration is restyled by naming the convention it is written in. Without source, one set of options reads and writes, so that output converted again with the same options reads back as itself. The convention source names is read as the options would read it, and follows the same rules.

Diagnostic code values, their index semantics, and the fields that accompany them are part of the contract. Their message text is for humans and may change in any release; do not match on it.

Positions (ConversionLoss.offset and length, CharacterScopeDiagnostic.offset and length, ConversionResult.spans, ParseResult.spans) are offsets in UTF-16 code units in the input as supplied and in the output as returned, ends exclusive, with the ordering and sharing rules of the conversion-analysis contract. A change of unit or of those rules is a break; a position that moves because a conversion’s output changed follows the rules of that output change.

For errors, the class (RangeError, TypeError, OptionError, CharacterScopeError) and the documented condition are the contract; the message is not. The diagnostics of a CharacterScopeError follow the diagnostic rules above; the path, received, and accepted of an OptionError are part of the contract.

The replacement of an OptionError is a migration aid. It is set only for keys and values that a 1.0.0 release candidate accepted, and is the current path of the key at path or the current spelling of the value received there. The 1.0.0 release keeps these aids; a minor release may remove them. The error then keeps its class and its condition, an unknown key or value, and loses its replacement and the end of its message that names the current spelling. A major release that renames an option gives the same aid for the names of the previous major, under the same rule.

ConversionOptions is the input type: every field optional, unknown keys and values rejected at runtime. Adding a key or a value is a minor change; the default behavior of an existing call never changes in a minor release. The default transliteration is the library’s own: the letters of the SBL Handbook of Style, which sbl-general writes, with the marks that the Handbook leaves out.

ResolvedConversionOptions is an output type describing the effective configuration returned by resolveConversionOptions(). New fields appear in minor releases. Constructing one by hand is unsupported; pass partial ConversionOptions to the public functions instead.

DEFAULT_CONVERSION_OPTIONS and CONVERSION_OPTION_VALUES are frozen reference objects; their shape follows the rules above.

PreparedOptions, which prepareOptions() returns and the presets entry point exports, are resolved options that the functions of the main, document, and core entry points read in place of options: what they hold may change in any release. They convert as the options they were prepared from, and a preset object as { preset }, under the rules above. The object is frozen, and has one property, under a symbol, which marks it: its presence is covered, not its key or its value. Spreading prepared options, or Object.assign(), copies that property and none of the options; the functions that validate options, such as prepareOptions(), the main entry point, and createConverter(), refuse an object that has it with a TypeError, rather than read it as no option at all, and refuse prepared options themselves as source, as a group, or as the configuration of a converter. A copy that loses the property, such as one made by structuredClone(), by JSON, or by a message to a worker, is an object without options. A converter takes prepared options as the options of a conversion when they were prepared with its preset, or with any when it binds none, and refuses others with a RangeError, as it refuses another preset by name.

A reader (Reader), a writer (Writer), or both of one format (ReaderWriter) is an opaque value: its type and the object, which is frozen, have no public member, so that how they read and write may change in any release. What is covered is their identity, the format each reads or writes, and the conversions of the core entry point that take them, which convert as the functions of the main entry point do with the names of the formats.

The values of the core entry point belong to the copy of the library that made them: a function of another copy, such as a second version installed beside it, or a copy loaded in a worker, does not take them.

Document, Token, Grapheme, and Literal are public, with the ownership rules in the document API contract. Field additions are minor; field removals and meaning changes are major. A document produced by parse() on one version is valid input to encode() and validateDocument() on any later version of the same major.

A preset identifier is stable. Its coverage may move between planned, partial, adapted, and complete as implementation progresses; such a move is descriptive and accompanies the underlying change, which is classified by the rules above. A preset is never removed in a minor release; one that becomes obsolete is deprecated first.

A deprecated export, option, value, preset, or code is marked @deprecated in its documentation, keeps working for at least the remainder of the current major, and is listed in the changelog. Removal happens in the next major release with a migration note.

The library is standard ECMAScript 2022, with no dependencies and no runtime-specific API. The npm package supports the Node.js versions that the Node.js project (opens in a new tab) maintains; when one reaches its end of life, a minor release may raise the minimum. The npm engines field declares that minimum, on which the test suite runs. The library relies on the runtime’s String.prototype.normalize, so recognition of characters introduced by a newer Unicode version depends on the runtime.

The greek-conversion (opens in a new tab) package on PyPI is the library’s distribution for Python: it runs the library of the same version in a JavaScript engine embedded in Python. Its version is the library’s, written as Python writes versions (1.0.0rc15 for 1.0.0-rc.15), and this policy applies to it as it does to the library, with:

  • as its public API, what the greek_conversion module exports: its functions, classes, constants, and error classes, with their documented fields, and the option keys, written in snake_case (out_of_scope_behavior), with the library’s values;
  • the same output, losses, positions, and diagnostics as the library of the same version, positions counted in characters as Python counts them;
  • as its runtimes, the Python versions that requires-python declares and on which its test suite runs.

A post-release (1.0.0.post1) corrects the Python package alone: it changes neither the library it runs nor what a conversion gives.

Not covered: the JavaScript engine that runs the library (QuickJS or V8) and its version, the modules whose names begin with an underscore, and the speed of a call.

Versions with a pre-release tag (1.0.0-rc.1, 1.1.0-beta.1) may contain any change, including breaks, relative to the previous pre-release. The rules above apply between stable releases.