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

types: improve napi binding typing using generated types #69680

Merged
merged 7 commits into from
Sep 24, 2024
Merged
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
6 changes: 3 additions & 3 deletions crates/napi/src/next_api/project.rs
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@
exit_receiver: tokio::sync::Mutex<Option<ExitReceiver>>,
}

#[napi(ts_return_type = "{ __napiType: \"Project\" }")]
#[napi(ts_return_type = "Promise<{ __napiType: \"Project\" }>")]
pub async fn project_new(
options: NapiProjectOptions,
turbo_engine_options: NapiTurboEngineOptions,
Expand Down Expand Up @@ -421,7 +421,7 @@
Ok(Completion::new())
}

#[napi(ts_return_type = "{ __napiType: \"Project\" }")]
#[napi]
pub async fn project_update(
#[napi(ts_arg_type = "{ __napiType: \"Project\" }")] project: External<ProjectInstance>,
options: NapiPartialProjectOptions,
Expand All @@ -439,7 +439,7 @@
Ok(())
}

#[napi(ts_return_type = "{ __napiType: \"Project\" }")]
#[napi]
pub async fn project_shutdown(
#[napi(ts_arg_type = "{ __napiType: \"Project\" }")] project: External<ProjectInstance>,
) {
Expand Down Expand Up @@ -909,7 +909,7 @@
}
}

/// Subscribes to lifecycle events of the compilation.

Check warning on line 912 in crates/napi/src/next_api/project.rs

View workflow job for this annotation

GitHub Actions / rustdoc check / build

public documentation for `project_update_info_subscribe` links to private item `UpdateMessage::Start`

Check warning on line 912 in crates/napi/src/next_api/project.rs

View workflow job for this annotation

GitHub Actions / rustdoc check / build

public documentation for `project_update_info_subscribe` links to private item `UpdateMessage::End`

Check warning on line 912 in crates/napi/src/next_api/project.rs

View workflow job for this annotation

GitHub Actions / rustdoc check / build

public documentation for `project_update_info_subscribe` links to private item `UpdateMessage::End`

Check warning on line 912 in crates/napi/src/next_api/project.rs

View workflow job for this annotation

GitHub Actions / rustdoc check / build

public documentation for `project_update_info_subscribe` links to private item `UpdateMessage::Start`
/// Emits an [UpdateMessage::Start] event when any computation starts.
/// Emits an [UpdateMessage::End] event when there was no computation for the
/// specified time (`aggregation_ms`). The [UpdateMessage::End] event contains
Expand Down
5 changes: 0 additions & 5 deletions crates/napi/src/turbopack.rs
Original file line number Diff line number Diff line change
Expand Up @@ -208,8 +208,3 @@ impl From<NapiRouteHas> for RouteHas {
}
}
}

#[napi]
pub async fn experimental_turbo(_unused: Buffer) -> napi::Result<()> {
unimplemented!("__experimental_turbo is not yet implemented");
}
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@
"update-google-fonts": "node ./scripts/update-google-fonts.js",
"patch-next": "node scripts/patch-next.cjs",
"unpack-next": "node scripts/unpack-next.cjs",
"swc-build-native": "pnpm --filter=@next/swc build-native",
"swc-build-native": "node scripts/build-native.cjs",
"swc-build-wasm": "node scripts/build-wasm.cjs",
"sweep": "node scripts/sweep.cjs"
},
"devDependencies": {
Expand Down
3 changes: 2 additions & 1 deletion packages/next/src/build/collect-build-traces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import { normalizeAppPath } from '../shared/lib/router/utils/app-paths'
import isError from '../lib/is-error'
import type { NodeFileTraceReasons } from '@vercel/nft'
import type { RoutesUsingEdgeRuntime } from './utils'
import type { ExternalObject, TurboTasks } from './swc/generated-native'

const debug = debugOriginal('next:build:build-traces')

Expand Down Expand Up @@ -107,7 +108,7 @@ export async function collectBuildTraces({
}) {
const startTime = Date.now()
debug('starting build traces')
let turboTasksForTrace: unknown
let turboTasksForTrace: ExternalObject<TurboTasks>
let bindings = await loadBindings()

const runTurbotrace = async function () {
Expand Down
Loading
Loading