Skip to content

Commit 682dd96

Browse files
authored
chore(supabase_flutter): mark auth-url helpers @internal instead of parse-ignore (#1510)
## What Replaces the three `.sdk-parse-ignore` entries for the clear-auth-url helpers with `@internal` annotations on the declarations, and removes those entries. ## Why The SDK capability-matrix symbol extractor now honours `@internal` (from `package:meta`), see supabase/sdk#54. Before that, the extractor treated every non-underscore `lib/src` declaration as public API, so the internal auth-url helpers had to be excluded by path in `.sdk-parse-ignore`. `@internal` on the declaration is a better source of truth than a hand-maintained path list: it lives next to the code, travels with refactors, and documents intent directly. ## What changed - `removeAuthParametersFromUrl` (`clear_auth_url_parameters.dart`) marked `@internal`. - `clearAuthUrlParameters` in both conditional-import shims (`clear_auth_url_parameters_web.dart`, `clear_auth_url_parameters_stub.dart`) marked `@internal`. - Removed the three entries from `.sdk-parse-ignore`; its header now points to `@internal` as the preferred mechanism and reserves the file for paths that cannot carry the annotation (for example generated sources). All three symbols are used only within `supabase_flutter`, so `@internal` produces no cross-package analyzer warnings. Verified against the updated extractor that the package no longer emits these symbols while its other 466 public symbols are unchanged.
1 parent e549d39 commit 682dd96

4 files changed

Lines changed: 13 additions & 8 deletions

File tree

.sdk-parse-ignore

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,8 @@
22
#
33
# The extractor over-approximates: it treats every non-underscore top-level
44
# declaration under lib/** as public API. Files under lib/src are private to
5-
# the package by Dart convention and are not exported from the public library,
6-
# so internal platform shims listed here are false positives.
7-
8-
# Internal helpers backing the conditional import that clears auth parameters
9-
# from the browser URL on web after a successful session exchange.
10-
packages/supabase_flutter/lib/src/clear_auth_url_parameters.dart
11-
packages/supabase_flutter/lib/src/clear_auth_url_parameters_web.dart
12-
packages/supabase_flutter/lib/src/clear_auth_url_parameters_stub.dart
5+
# the package by Dart convention and are not exported from the public library.
6+
#
7+
# Prefer annotating such declarations with `@internal` (from package:meta): the
8+
# extractor honours it and excludes them from the scan. Use this file only for
9+
# paths that cannot carry that annotation, e.g. generated sources.

packages/supabase_flutter/lib/src/clear_auth_url_parameters.dart

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import 'package:meta/meta.dart';
2+
13
const _authParameters = {
24
'code',
35
'access_token',
@@ -19,6 +21,7 @@ const _authParameters = {
1921
/// After a successful code exchange the auth code is single use, so leaving it
2022
/// in the URL means a page refresh would attempt to exchange a spent code and
2123
/// fail with "Code verifier could not be found in local storage.".
24+
@internal
2225
String removeAuthParametersFromUrl(String url) {
2326
final currentUri = Uri.parse(url);
2427

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1+
import 'package:meta/meta.dart';
2+
13
/// Removes the authentication parameters from the browser URL.
24
///
35
/// No-op on platforms other than web.
6+
@internal
47
void clearAuthUrlParameters() {}

packages/supabase_flutter/lib/src/clear_auth_url_parameters_web.dart

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1+
import 'package:meta/meta.dart';
12
import 'package:web/web.dart';
23

34
import 'clear_auth_url_parameters.dart';
45

56
/// Removes the authentication parameters from the browser URL.
7+
@internal
68
void clearAuthUrlParameters() {
79
final cleanedUrl = removeAuthParametersFromUrl(window.location.href);
810
window.history.replaceState(null, '', cleanedUrl);

0 commit comments

Comments
 (0)