nupp.io.uri.spi

Implementation interfaces consumed during ordinary module initialization. Discover with nupp.spi.load; the consumer chooses the unique highest priority. Omitted priority is zero. Importing these declarations loads no implementation.

Module contents

Types

TypeKindDescription
ProviderinterfaceAbsolute-URI parsing into canonical components, by the WHATWG URL Standard.
UriPartsrecordNormalized absolute-URI components shared by every parser.

Types#

Providerinterface#

interface Provider ...

Absolute-URI parsing into canonical components, by the WHATWG URL Standard.

Return nil and a diagnostic for unsupported or invalid input. Successful parses must make text, authority, host, port, and path mutually consistent and preserve absent versus empty query and fragment values.

Members

NameKindDescription
priorityfield
parsemethodParses an absolute URI into shared components or returns nil and a message.

priorityfield#

priority: integer?
@readonly

parsemethod#

parse: function(text: string): (UriParts?, string?)
@readonly

Parses an absolute URI into shared components or returns nil and a message.

Arguments
NameTypeDescription
textstring
Returns
TypeDescription
UriParts?
string?

UriPartsrecord#

record UriParts ...

Normalized absolute-URI components shared by every parser.

Every parser reads text as the WHATWG URL Standard's basic URL parser does (https://url.spec.whatwg.org/), so text is the standard's serialization and each component is the standard's. A parser without IDNA refuses a special-scheme host that needs it rather than answering another host.

Use nil for an absent optional component and an empty string for a present empty one; an empty password is absent, as the standard drops it. The public URI wrapper uses this record without introducing a provider-specific nominal identity.

Members

NameKindDescription
textfieldNormalized complete URI text.
schemefieldNormalized scheme without the colon.
authorityfieldSerialized authority, or nil if the URI has none.
usernamefieldUsername component, empty when absent.
passwordfieldPassword component, or nil when absent or empty.
hostfieldNormalized host, or nil for a URI without one.
portfieldExplicit non-default port when present.
pathfieldNormalized path component.
queryfieldQuery without its question mark, or nil when absent.
fragmentfieldFragment without its hash mark, or nil when absent.

textfield#

text: string

Normalized complete URI text.

schemefield#

scheme: string

Normalized scheme without the colon.

authorityfield#

authority: string?

Serialized authority, or nil if the URI has none.

usernamefield#

username: string

Username component, empty when absent.

passwordfield#

password: string?

Password component, or nil when absent or empty.

hostfield#

host: string?

Normalized host, or nil for a URI without one.

portfield#

port: integer?

Explicit non-default port when present.

pathfield#

path: string

Normalized path component.

queryfield#

query: string?

Query without its question mark, or nil when absent.

fragmentfield#

fragment: string?

Fragment without its hash mark, or nil when absent.