Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"compilerOptions": {
"target": "es2022", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
"module": "commonjs",
"module": "nodenext",
"declaration": true,
"outDir": "./typescript/dist", /* Specify what module code is generated. */
"paths": {
Expand Down
6 changes: 3 additions & 3 deletions typescript/src/async-callbacks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/
*/
import { CALL_ERROR, CALL_UNEXPECTED_ERROR } from "./rust-call";
import { type UniffiHandle, UniffiHandleMap } from "./handle-map";
import { type UniffiByteArray } from "./ffi-types";
import { CALL_ERROR, CALL_UNEXPECTED_ERROR } from "./rust-call.js";
import { type UniffiHandle, UniffiHandleMap } from "./handle-map.js";
import { type UniffiByteArray } from "./ffi-types.js";

// Some additional data we hold for each in-flight promise.
type PromiseHelper = {
Expand Down
8 changes: 4 additions & 4 deletions typescript/src/async-rust-call.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/
*/
import { UniffiInternalError } from "./errors";
import { type UniffiByteArray } from "./ffi-types";
import { UniffiHandleMap, type UniffiHandle } from "./handle-map";
import { UniffiInternalError } from "./errors.js";
import { type UniffiByteArray } from "./ffi-types.js";
import { UniffiHandleMap, type UniffiHandle } from "./handle-map.js";
import {
type UniffiErrorHandler,
type UniffiRustCallStatus,
UniffiRustCaller,
} from "./rust-call";
} from "./rust-call.js";

const UNIFFI_RUST_FUTURE_POLL_READY = 0;
const UNIFFI_RUST_FUTURE_POLL_MAYBE_READY = 1;
Expand Down
8 changes: 4 additions & 4 deletions typescript/src/callbacks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,18 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/
*/
import { type FfiConverter, FfiConverterUInt64 } from "./ffi-converters";
import { type UniffiByteArray, RustBuffer } from "./ffi-types";
import { type FfiConverter, FfiConverterUInt64 } from "./ffi-converters.js";
import { type UniffiByteArray, RustBuffer } from "./ffi-types.js";
import {
type UniffiHandle,
UniffiHandleMap,
defaultUniffiHandle,
} from "./handle-map";
} from "./handle-map.js";
import {
CALL_ERROR,
CALL_UNEXPECTED_ERROR,
type UniffiRustCallStatus,
} from "./rust-call";
} from "./rust-call.js";

const handleConverter = FfiConverterUInt64;

Expand Down
2 changes: 1 addition & 1 deletion typescript/src/errors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/
*/

import { uniffiTypeNameSymbol } from "./symbols";
import { uniffiTypeNameSymbol } from "./symbols.js";

// The top level error class for all uniffi-wrapped errors.
//
Expand Down
4 changes: 2 additions & 2 deletions typescript/src/ffi-converters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/
*/
import { UniffiInternalError } from "./errors";
import { type UniffiByteArray, RustBuffer } from "./ffi-types";
import { UniffiInternalError } from "./errors.js";
import { type UniffiByteArray, RustBuffer } from "./ffi-types.js";

// https://github.com/mozilla/uniffi-rs/blob/main/docs/manual/src/internals/lifting_and_lowering.md
export interface FfiConverter<FfiType, TsType> {
Expand Down
2 changes: 1 addition & 1 deletion typescript/src/ffi-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/
*/
import { UniffiInternalError } from "./errors";
import { UniffiInternalError } from "./errors.js";

export type UniffiByteArray = Uint8Array;

Expand Down
2 changes: 1 addition & 1 deletion typescript/src/handle-map.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/
*/
import { UniffiInternalError } from "./errors";
import { UniffiInternalError } from "./errors.js";

export type UniffiHandle = bigint;
export const defaultUniffiHandle = BigInt("0");
Expand Down
28 changes: 14 additions & 14 deletions typescript/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,17 @@
// Entry point for the runtime for uniffi-bindgen-react-native.
// This modules is not needed directly, but is imported from generated code.
//
export * from "./async-callbacks";
export * from "./async-rust-call";
export * from "./callbacks";
export * from "./enums";
export * from "./errors";
export * from "./ffi-converters";
export * from "./ffi-types";
export * from "./handle-map";
export * from "./objects";
export * from "./records";
export * from "./result";
export * from "./rust-call";
export * from "./symbols";
export * from "./type-utils";
export * from "./async-callbacks.js";
export * from "./async-rust-call.js";
export * from "./callbacks.js";
export * from "./enums.js";
export * from "./errors.js";
export * from "./ffi-converters.js";
export * from "./ffi-types.js";
export * from "./handle-map.js";
export * from "./objects.js";
export * from "./records.js";
export * from "./result.js";
export * from "./rust-call.js";
export * from "./symbols.js";
export * from "./type-utils.js";
12 changes: 6 additions & 6 deletions typescript/src/objects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ import {
AbstractFfiConverterByteArray,
type FfiConverter,
FfiConverterUInt64,
} from "./ffi-converters";
import { RustBuffer } from "./ffi-types";
import type { UniffiRustArcPtr } from "./rust-call";
import { type UniffiHandle, UniffiHandleMap } from "./handle-map";
import { type StructuralEquality } from "./type-utils";
import { UniffiInternalError, UniffiThrownObject } from "./errors";
} from "./ffi-converters.js";
import { RustBuffer } from "./ffi-types.js";
import type { UniffiRustArcPtr } from "./rust-call.js";
import { type UniffiHandle, UniffiHandleMap } from "./handle-map.js";
import { type StructuralEquality } from "./type-utils.js";
import { UniffiInternalError, UniffiThrownObject } from "./errors.js";

/**
* Marker interface for all `interface` objects that cross the FFI.
Expand Down
6 changes: 3 additions & 3 deletions typescript/src/result.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/
*/

import { type UniffiByteArray } from "./ffi-types";
import { type UniffiReferenceHolder } from "./callbacks";
import { type UniffiRustCallStatus } from "./rust-call";
import { type UniffiByteArray } from "./ffi-types.js";
import { type UniffiReferenceHolder } from "./callbacks.js";
import { type UniffiRustCallStatus } from "./rust-call.js";

// This Result combines RustCallStatus and ReferenceHolder.
// This is principally so we can _return_ something from calling from native into typescript.
Expand Down
4 changes: 2 additions & 2 deletions typescript/src/rust-call.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/
*/
import { UniffiInternalError } from "./errors";
import { type UniffiByteArray } from "./ffi-types";
import { UniffiInternalError } from "./errors.js";
import { type UniffiByteArray } from "./ffi-types.js";

export const CALL_SUCCESS = 0;
export const CALL_ERROR = 1;
Expand Down