ReviewOS

also looking at this

craft-native/craft

fix(sdk): ship declarations that resolve under node16/nodenext

#42
Merged glennmichael123 wants to merge fix/node16-type-resolution into main
43 files +196 -137
packages/ts-maps/src/FilesystemTileBackend.tsmodified+1-1
Changes to packages/ts-maps/src/FilesystemTileBackend.ts
@@ -33,7 +33,7 @@ import type { Tile, TileCacheBackend } from 'ts-maps'
3333// Import the fs helpers directly from their source module rather than from
3434// the `craft-native` package root, matching how `MapView` talks to
3535// the bridge — keeps the type graph narrow.
36import { fs, readBinaryFile, writeBinaryFile } from '../../typescript/src/api/fs'
36import { fs, readBinaryFile, writeBinaryFile } from '../../typescript/src/api/fs.js'
3737
3838export interface FilesystemBackendOptions {
3939 /**
packages/ts-maps/src/MapView.tsmodified+7-7
Changes to packages/ts-maps/src/MapView.ts
@@ -10,8 +10,8 @@
1010// package root, so we don't pull the entire `craft-native` surface
1111// (including unrelated stx-templated sidebar files) through the type
1212// checker. The public API of the bridge is stable, so this is fine.
13import type { NativeBridge } from '../../typescript/src/bridge/core'
14import { getBridge } from '../../typescript/src/bridge/core'
13import type { NativeBridge } from '../../typescript/src/bridge/core.js'
14import { getBridge } from '../../typescript/src/bridge/core.js'
1515import type { TsMap } from 'ts-maps'
1616import { createMap, tileLayer } from 'ts-maps'
1717import {
@@ -23,12 +23,12 @@ import {
2323 craftPolylineToPolyline,
2424 craftRegionToBounds,
2525 latLngToCraftCoord,
26} from './adapters'
26} from './adapters.js'
2727import type {
2828 MapBridgeEvent,
2929 TypedMapBridgeRequest,
30} from './bridge-protocol'
31import { BRIDGE_NAMESPACE, mapEventName } from './bridge-protocol'
30} from './bridge-protocol.js'
31import { BRIDGE_NAMESPACE, mapEventName } from './bridge-protocol.js'
3232import type {
3333 Coordinate,
3434 MapCamera,
@@ -38,8 +38,8 @@ import type {
3838 MapPolygon,
3939 MapPolyline,
4040 MapRegion,
41} from './types'
42import { defaultMapCamera, defaultMapConfiguration } from './types'
41} from './types.js'
42import { defaultMapCamera, defaultMapConfiguration } from './types.js'
4343
4444// Monotonic counter — same pattern as `components/native.ts` in
4545// `craft-native` — so multiple map views created in the same tick
packages/ts-maps/src/adapters.tsmodified+2-2
Changes to packages/ts-maps/src/adapters.ts
@@ -17,8 +17,8 @@ import type {
1717 MapPolygon,
1818 MapPolyline,
1919 MapRegion,
20} from './types'
21import { markerColorHex, strokePatternDashes } from './types'
20} from './types.js'
21import { markerColorHex, strokePatternDashes } from './types.js'
2222
2323// ---------------------------------------------------------------------------
2424// Coordinates
packages/ts-maps/src/bridge-protocol.tsmodified+1-1
Changes to packages/ts-maps/src/bridge-protocol.ts
@@ -14,7 +14,7 @@ import type {
1414 MapPolygon,
1515 MapPolyline,
1616 MapRegion,
17} from './types'
17} from './types.js'
1818
1919/**
2020 * Namespace used when emitting and listening for bridge messages. Matches
packages/ts-maps/src/index.tsmodified+9-9
Changes to packages/ts-maps/src/index.ts
@@ -19,7 +19,7 @@ export {
1919 type ComponentProps,
2020 type MapViewInstance,
2121 type MapViewProps,
22} from './MapView'
22} from './MapView.js'
2323
2424// Type mirrors of the Zig structs.
2525export {
@@ -43,7 +43,7 @@ export {
4343 type MarkerColor,
4444 type StrokePattern,
4545 type UserTrackingMode,
46} from './types'
46} from './types.js'
4747
4848// Adapters (pure fns) for round-tripping between Craft and ts-maps types.
4949export {
@@ -60,7 +60,7 @@ export {
6060 latLngToCraftCoord,
6161 regionFromBounds,
6262 type TsMapsCameraOptions,
63} from './adapters'
63} from './adapters.js'
6464
6565// Bridge protocol constants/types.
6666export {
@@ -70,18 +70,18 @@ export {
7070 type MapBridgeMethod,
7171 type MapBridgeRequest,
7272 type TypedMapBridgeRequest,
73} from './bridge-protocol'
73} from './bridge-protocol.js'
7474
7575// Sandbox-filesystem tile persistence + offline region helpers.
7676export {
7777 createFilesystemBackend,
7878 type FilesystemBackendOptions,
79} from './FilesystemTileBackend'
79} from './FilesystemTileBackend.js'
8080export {
8181 createFilesystemTileCache,
8282 saveOfflineRegionToFilesystem,
8383 type FilesystemOfflineRegionOptions,
84} from './offlineRegion'
84} from './offlineRegion.js'
8585
8686// Runtime capability probe — tells the host app which renderer the
8787// device can realistically drive.
@@ -89,7 +89,7 @@ export {
8989 probeCapabilities,
9090 supportsAdvancedRendering,
9191 type MapRendererCapabilities,
92} from './capabilities'
92} from './capabilities.js'
9393
9494// createMap is the underlying ts-maps factory; re-export under its original
9595// name for parity with the spec which mentions `createMap` as a Craft export.
@@ -105,5 +105,5 @@ export const tsMapsProvider = 'ts_maps' as const
105105 * Alias preserved for callers that imported the two helpers by spec name.
106106 * `coordinateFromLatLng(LatLng) -> Coordinate`, `latLngFromCoordinate(Coordinate) -> LatLng`.
107107 */
108export { latLngToCraftCoord as coordinateFromLatLng } from './adapters'
109export { craftCoordToLatLng as latLngFromCoordinate } from './adapters'
108export { latLngToCraftCoord as coordinateFromLatLng } from './adapters.js'
109export { craftCoordToLatLng as latLngFromCoordinate } from './adapters.js'
packages/ts-maps/src/offlineRegion.tsmodified+1-1
Changes to packages/ts-maps/src/offlineRegion.ts
@@ -28,7 +28,7 @@ import type {
2828 TileCacheOptions,
2929} from 'ts-maps'
3030import { saveOfflineRegion, TileCache } from 'ts-maps'
31import { createFilesystemBackend } from './FilesystemTileBackend'
31import { createFilesystemBackend } from './FilesystemTileBackend.js'
3232
3333export type OfflineBoundsLike =
3434 | { west: number, south: number, east: number, north: number }
packages/typescript/package.jsonmodified+15-0
Changes to packages/typescript/package.json
@@ -45,14 +45,29 @@
4545 "default": "./dist/mobile.js"
4646 },
4747 "./ios": {
48 "browser": null,
4849 "types": "./dist/ios/src/index.d.ts",
4950 "import": "./dist/ios/src/index.js"
5051 },
5152 "./android": {
53 "browser": null,
5254 "types": "./dist/android/src/index.d.ts",
5355 "import": "./dist/android/src/index.js"
5456 }
5557 },
58 "typesVersions": {
59 "*": {
60 "mobile": [
61 "./dist/mobile.d.ts"
62 ],
63 "ios": [
64 "./dist/ios/src/index.d.ts"
65 ],
66 "android": [
67 "./dist/android/src/index.d.ts"
68 ]
69 }
70 },
5671 "module": "./dist/index.js",
5772 "types": "./dist/index.d.ts",
5873 "files": [
packages/typescript/src/api/android-advanced.tsmodified+1-1
Changes to packages/typescript/src/api/android-advanced.ts
@@ -5,7 +5,7 @@
55 * @module @craft-native/api/android-advanced
66 */
77
8import { isCraft, getPlatform } from './process'
8import { isCraft, getPlatform } from './process.js'
99
1010// ============================================================================
1111// Material You / Dynamic Colors
packages/typescript/src/api/app.tsmodified+2-2
Changes to packages/typescript/src/api/app.ts
@@ -4,8 +4,8 @@
44 * @module @craft-native/api/app
55 */
66
7import { getBridge } from '../bridge/core'
8import { isWebKitHost, webkitRequest } from '../bridge/webkit-pending'
7import { getBridge } from '../bridge/core.js'
8import { isWebKitHost, webkitRequest } from '../bridge/webkit-pending.js'
99
1010// ============================================================================
1111// Types
packages/typescript/src/api/clipboard.tsmodified+2-2
Changes to packages/typescript/src/api/clipboard.ts
@@ -4,8 +4,8 @@
44 * @module @craft-native/api/clipboard
55 */
66
7import { getBridge } from '../bridge/core'
8import { isWebKitHost, postWebKit, webkitRequest } from '../bridge/webkit-pending'
7import { getBridge } from '../bridge/core.js'
8import { isWebKitHost, postWebKit, webkitRequest } from '../bridge/webkit-pending.js'
99
1010/** Default timeout for callback-style clipboard reads. */
1111const CLIPBOARD_READ_TIMEOUT_MS = 5000
packages/typescript/src/api/crypto.tsmodified+1-1
Changes to packages/typescript/src/api/crypto.ts
@@ -3,7 +3,7 @@
33 * Provides cryptographic operations through the Craft bridge
44 */
55
6import type { CraftCryptoAPI } from '../types'
6import type { CraftCryptoAPI } from '../types.js'
77
88/**
99 * Error type for cryptographic failures (malformed input, decode errors, etc.).
packages/typescript/src/api/db.tsmodified+2-2
Changes to packages/typescript/src/api/db.ts
@@ -27,8 +27,8 @@
2727 */
2828
2929import { EventEmitter } from 'events'
30import { getBridge } from '../bridge/core'
31import type { CraftDatabaseAPI } from '../types'
30import { getBridge } from '../bridge/core.js'
31import type { CraftDatabaseAPI } from '../types.js'
3232
3333/**
3434 * Send a request through the unified `NativeBridge`. Replaces the legacy
packages/typescript/src/api/dialog.tsmodified+2-2
Changes to packages/typescript/src/api/dialog.ts
@@ -4,8 +4,8 @@
44 * @module @craft-native/api/dialog
55 */
66
7import { getBridge } from '../bridge/core'
8import { isWebKitHost, webkitRequest } from '../bridge/webkit-pending'
7import { getBridge } from '../bridge/core.js'
8import { isWebKitHost, webkitRequest } from '../bridge/webkit-pending.js'
99
1010/**
1111 * Default timeout for *file-system* dialog round-trips (open/save).
packages/typescript/src/api/fs.tsmodified+2-2
Changes to packages/typescript/src/api/fs.ts
@@ -24,8 +24,8 @@
2424 * ```
2525 */
2626
27import { getBridge } from '../bridge/core'
28import type { CraftFileSystemAPI } from '../types'
27import { getBridge } from '../bridge/core.js'
28import type { CraftFileSystemAPI } from '../types.js'
2929
3030/**
3131 * Get the host-injected legacy file-system bridge, or null. The legacy
packages/typescript/src/api/http.tsmodified+1-1
Changes to packages/typescript/src/api/http.ts
@@ -4,7 +4,7 @@
44 * Bypasses CORS restrictions when running in Craft
55 */
66
7import type { CraftHttpAPI } from '../types'
7import type { CraftHttpAPI } from '../types.js'
88
99/**
1010 * Result of {@link encodeRequestBody}. `kind` lets the caller decide
packages/typescript/src/api/index.tsmodified+37-37
Changes to packages/typescript/src/api/index.ts
@@ -10,7 +10,7 @@ export {
1010 window,
1111 createWindow,
1212 Window
13} from './window'
13} from './window.js'
1414export type {
1515 WindowPosition,
1616 WindowSize,
@@ -20,7 +20,7 @@ export type {
2020 WindowEventType,
2121 WindowEventMap,
2222 WindowEventHandler
23} from './window'
23} from './window.js'
2424
2525// Tray/Menubar API - System tray and menubar apps
2626export {
@@ -34,7 +34,7 @@ export {
3434 menuItem,
3535 checkbox,
3636 submenu
37} from './tray'
37} from './tray.js'
3838export type {
3939 MenuItem,
4040 TrayClickEvent,
@@ -43,7 +43,7 @@ export type {
4343 TrayEventType,
4444 TrayEventMap,
4545 TrayEventHandler
46} from './tray'
46} from './tray.js'
4747
4848// App API - Application lifecycle and system integration
4949export {
@@ -65,7 +65,7 @@ export {
6565 notify,
6666 registerShortcut,
6767 unregisterShortcut
68} from './app'
68} from './app.js'
6969export type {
7070 AppInfo,
7171 SystemPreferences,
@@ -76,19 +76,19 @@ export type {
7676 AppEventMap,
7777 AppEventHandler,
7878 ShortcutHandler
79} from './app'
79} from './app.js'
8080
8181// File System API
82export { fs, readBinaryFile, writeBinaryFile, stat, copy, move, watch } from './fs'
83export type { FileStats } from './fs'
82export { fs, readBinaryFile, writeBinaryFile, stat, copy, move, watch } from './fs.js'
83export type { FileStats } from './fs.js'
8484
8585// Database API
86export { db, openDatabase, Database, KeyValueStore } from './db'
87export type { ExecuteResult, TableColumn } from './db'
86export { db, openDatabase, Database, KeyValueStore } from './db.js'
87export type { ExecuteResult, TableColumn } from './db.js'
8888
8989// HTTP Client API
90export { http, HttpClient, WebSocketClient, createClient, HttpError } from './http'
91export type { HttpClientOptions, RequestOptions, HttpResponse, WebSocketOptions } from './http'
90export { http, HttpClient, WebSocketClient, createClient, HttpError } from './http.js'
91export type { HttpClientOptions, RequestOptions, HttpResponse, WebSocketOptions } from './http.js'
9292
9393// Crypto API
9494export {
@@ -99,7 +99,7 @@ export {
9999 timingSafeEqual,
100100 hashPassword,
101101 verifyPassword
102} from './crypto'
102} from './crypto.js'
103103
104104// Process API
105105export {
@@ -118,8 +118,8 @@ export {
118118 exit,
119119 argv,
120120 open
121} from './process'
122export type { Platform, SystemInfo, ExecOptions, ExecResult, SpawnOptions } from './process'
121} from './process.js'
122export type { Platform, SystemInfo, ExecOptions, ExecResult, SpawnOptions } from './process.js'
123123
124124// Mobile API - Unified cross-platform mobile features
125125export {
@@ -134,7 +134,7 @@ export {
134134 lifecycle,
135135 notifications,
136136 notifications as notification
137} from './mobile'
137} from './mobile.js'
138138export type {
139139 DeviceInfo,
140140 DeviceCapabilities,
@@ -150,7 +150,7 @@ export type {
150150 ShareOptions,
151151 AppState,
152152 NotificationOptions as MobileNotificationOptions
153} from './mobile'
153} from './mobile.js'
154154
155155// iOS Advanced Features
156156export {
@@ -162,7 +162,7 @@ export {
162162 appIntents,
163163 tipKit,
164164 focusFilters
165} from './ios-advanced'
165} from './ios-advanced.js'
166166export type {
167167 CarPlayTemplateType,
168168 CarPlayListItem,
@@ -185,7 +185,7 @@ export type {
185185 Tip,
186186 FocusStatus,
187187 FocusFilter
188} from './ios-advanced'
188} from './ios-advanced.js'
189189
190190// Android Advanced Features
191191export {
@@ -197,7 +197,7 @@ export {
197197 appLanguage,
198198 widgets as androidWidgets,
199199 playBilling
200} from './android-advanced'
200} from './android-advanced.js'
201201export type {
202202 MaterialYouColors,
203203 PhotoPickerMediaType,
@@ -213,7 +213,7 @@ export type {
213213 WidgetData,
214214 PlayProduct,
215215 PlayPurchase
216} from './android-advanced'
216} from './android-advanced.js'
217217
218218// macOS Advanced Features
219219export {
@@ -226,7 +226,7 @@ export {
226226 quickActions,
227227 shareExtension,
228228 windowManagement
229} from './macos-advanced'
229} from './macos-advanced.js'
230230export type {
231231 TouchBarItemType,
232232 TouchBarButton,
@@ -247,7 +247,7 @@ export type {
247247 SpotlightItem,
248248 QuickAction,
249249 WindowTabGroup
250} from './macos-advanced'
250} from './macos-advanced.js'
251251
252252// Windows Advanced Features
253253export {
@@ -260,7 +260,7 @@ export {
260260 shareTarget,
261261 startupTask,
262262 secondaryTiles
263} from './windows-advanced'
263} from './windows-advanced.js'
264264export type {
265265 JumpListTask,
266266 JumpListCategory,
@@ -275,7 +275,7 @@ export type {
275275 UpdateInfo,
276276 SharedDataItem,
277277 SecondaryTile
278} from './windows-advanced'
278} from './windows-advanced.js'
279279
280280// Dialog API - Native file pickers and alerts
281281export {
@@ -286,7 +286,7 @@ export {
286286 showAlert,
287287 showConfirm,
288288 showPrompt
289} from './dialog'
289} from './dialog.js'
290290export type {
291291 FileFilter,
292292 OpenDialogOptions,
@@ -296,7 +296,7 @@ export type {
296296 ConfirmOptions,
297297 OpenDialogResult,
298298 SaveDialogResult
299} from './dialog'
299} from './dialog.js'
300300
301301// Clipboard API - System clipboard access
302302export {
@@ -305,20 +305,20 @@ export {
305305 readText,
306306 writeHTML,
307307 readHTML
308} from './clipboard'
308} from './clipboard.js'
309309export type {
310310 ClipboardFormat,
311311 ClipboardData
312} from './clipboard'
312} from './clipboard.js'
313313
314314// Media API - Camera and microphone access
315export { media } from './media'
315export { media } from './media.js'
316316export type {
317317 MediaDeviceInfo,
318318 CameraOptions as MediaCameraOptions,
319319 MicrophoneOptions,
320320 MediaStreamOptions
321} from './media'
321} from './media.js'
322322
323323// Cross-Platform Sidebar API (macOS, Windows, Linux)
324324export {
@@ -327,7 +327,7 @@ export {
327327 createFileSidebar,
328328 createSettingsSidebar,
329329 sidebar
330} from './sidebar'
330} from './sidebar.js'
331331export type {
332332 SidebarItem,
333333 SidebarSection,
@@ -337,31 +337,31 @@ export type {
337337 LinuxSidebarConfig,
338338 SidebarSelectEvent,
339339 SidebarSearchEvent
340} from './sidebar'
340} from './sidebar.js'
341341
342342// Spaces API - native switcher for Arc-style sidebar spaces
343343export {
344344 spaces,
345345 createSpacesSidebar,
346346 hasNativeSpaces
347} from './spaces'
347} from './spaces.js'
348348export type {
349349 SpaceDescriptor,
350350 SpacesSidebarOptions,
351351 SpacesSidebarHandle,
352352 NativeUIAPI
353} from './spaces'
353} from './spaces.js'
354354
355355// Gestures API - real trackpad swipe phases from the host's NSEvent
356356export {
357357 gestures,
358358 onSwipe,
359359 hasNativeGestures
360} from './gestures'
360} from './gestures.js'
361361export type {
362362 SwipeAxis,
363363 SwipePhase,
364364 SwipeEvent,
365365 SwipeListener,
366366 Unsubscribe
367} from './gestures'
367} from './gestures.js'
packages/typescript/src/api/ios-advanced.tsmodified+1-1
Changes to packages/typescript/src/api/ios-advanced.ts
@@ -5,7 +5,7 @@
55 * @module @craft-native/api/ios-advanced
66 */
77
8import { isCraft, getPlatform } from './process'
8import { isCraft, getPlatform } from './process.js'
99
1010// ============================================================================
1111// CarPlay Support
packages/typescript/src/api/macos-advanced.tsmodified+1-1
Changes to packages/typescript/src/api/macos-advanced.ts
@@ -5,7 +5,7 @@
55 * @module @craft-native/api/macos-advanced
66 */
77
8import { isCraft, getPlatform } from './process'
8import { isCraft, getPlatform } from './process.js'
99
1010// ============================================================================
1111// Touch Bar
packages/typescript/src/api/mobile.tsmodified+1-1
Changes to packages/typescript/src/api/mobile.ts
@@ -23,7 +23,7 @@
2323 * ```
2424 */
2525
26import { secureUUID } from '../bridge/ids'
26import { secureUUID } from '../bridge/ids.js'
2727
2828/** localStorage key for the persisted web-fallback device id. */
2929const WEB_DEVICE_ID_KEY = '__craft_web_device_id__'
packages/typescript/src/api/process.tsmodified+1-1
Changes to packages/typescript/src/api/process.ts
@@ -3,7 +3,7 @@
33 * Provides process management and system information
44 */
55
6import { getBridge } from '../bridge/core'
6import { getBridge } from '../bridge/core.js'
77
88/**
99 * Send a request through the unified `NativeBridge`. Replaces the legacy
packages/typescript/src/api/sidebar.tsmodified+4-4
Changes to packages/typescript/src/api/sidebar.ts
@@ -5,7 +5,7 @@
55 * @module @craft-native/api/sidebar
66 */
77
8import { getPlatform, type Platform } from './process'
8import { getPlatform, type Platform } from './process.js'
99
1010// ============================================================================
1111// Types
@@ -13,10 +13,10 @@ import { getPlatform, type Platform } from './process'
1313
1414// `SidebarItem` and `SidebarSection` are shared with `components/sidebar` —
1515// see `../sidebar-types` for why they are no longer declared per-module.
16export type { SidebarItem, SidebarSection } from '../sidebar-types'
17export { isSidebarItemDisabled } from '../sidebar-types'
16export type { SidebarItem, SidebarSection } from '../sidebar-types.js'
17export { isSidebarItemDisabled } from '../sidebar-types.js'
1818
19import type { SidebarItem, SidebarSection } from '../sidebar-types'
19import type { SidebarItem, SidebarSection } from '../sidebar-types.js'
2020
2121export interface SidebarConfig {
2222 /** Sidebar width in pixels */
packages/typescript/src/api/tray.tsmodified+1-1
Changes to packages/typescript/src/api/tray.ts
@@ -4,7 +4,7 @@
44 * @module @craft-native/api/tray
55 */
66
7import { getBridge } from '../bridge/core'
7import { getBridge } from '../bridge/core.js'
88
99// ============================================================================
1010// Types
packages/typescript/src/api/window.tsmodified+2-2
Changes to packages/typescript/src/api/window.ts
@@ -4,8 +4,8 @@
44 * @module @craft-native/api/window
55 */
66
7import { getBridge } from '../bridge/core'
8import { isWebKitHost, webkitRequest } from '../bridge/webkit-pending'
7import { getBridge } from '../bridge/core.js'
8import { isWebKitHost, webkitRequest } from '../bridge/webkit-pending.js'
99
1010// ============================================================================
1111// Types
packages/typescript/src/api/windows-advanced.tsmodified+1-1
Changes to packages/typescript/src/api/windows-advanced.ts
@@ -5,7 +5,7 @@
55 * @module @craft-native/api/windows-advanced
66 */
77
8import { isCraft, getPlatform } from './process'
8import { isCraft, getPlatform } from './process.js'
99
1010// ============================================================================
1111// Jump Lists
packages/typescript/src/bridge/android.tsmodified+1-1
Changes to packages/typescript/src/bridge/android.ts
@@ -3,7 +3,7 @@
33 * Complete Android native bridge with WebView, permissions, and platform APIs
44 */
55
6import { secureId } from './ids'
6import { secureId } from './ids.js'
77
88// Types
99export interface AndroidWebViewConfig {
packages/typescript/src/bridge/core.tsmodified+1-1
Changes to packages/typescript/src/bridge/core.ts
@@ -4,7 +4,7 @@
44 */
55
66import { EventEmitter } from 'events'
7import { secureUUID } from './ids'
7import { secureUUID } from './ids.js'
88
99// Ambient types for native bridges injected by the host. These globals are
1010// defined by WKWebView (iOS), Android WebView, Electron's contextBridge, and
packages/typescript/src/bridge/ios.tsmodified+1-1
Changes to packages/typescript/src/bridge/ios.ts
@@ -3,7 +3,7 @@
33 * Complete iOS native bridge with WebView, permissions, haptics, and platform APIs
44 */
55
6import { secureId } from './ids'
6import { secureId } from './ids.js'
77
88// Types
99export interface IOSWebViewConfig {
packages/typescript/src/components/index.tsmodified+4-4
Changes to packages/typescript/src/components/index.ts
@@ -35,7 +35,7 @@ export {
3535 tahoeStyle,
3636 arcStyle,
3737 orbstackStyle
38} from './sidebar'
38} from './sidebar.js'
3939export type {
4040 SidebarItem,
4141 SidebarSection,
@@ -48,7 +48,7 @@ export type {
4848 SidebarEventType,
4949 SidebarEventMap,
5050 SidebarEventHandler
51} from './sidebar'
51} from './sidebar.js'
5252
5353// ============================================================================
5454// Native UI Components
@@ -93,7 +93,7 @@ export {
9393 // Touch Bar
9494 setTouchBar,
9595 updateTouchBarItem
96} from './native'
96} from './native.js'
9797export type {
9898 ComponentProps,
9999 ComponentInstance,
@@ -117,7 +117,7 @@ export type {
117117 ToolbarConfig,
118118 TouchBarItem,
119119 TouchBarConfig
120} from './native'
120} from './native.js'
121121
122122// ============================================================================
123123// Style Types
packages/typescript/src/components/native.tsmodified+1-1
Changes to packages/typescript/src/components/native.ts
@@ -4,7 +4,7 @@
44 * @module @craft-native/components/native
55 */
66
7import { getBridge } from '../bridge/core'
7import { getBridge } from '../bridge/core.js'
88
99// Monotonically increasing counter ensures IDs stay unique even when multiple
1010// components are created in the same millisecond — `Date.now()` alone collides.
packages/typescript/src/components/sidebar.tsmodified+3-3
Changes to packages/typescript/src/components/sidebar.ts
@@ -11,16 +11,16 @@
1111 * @module @craft-native/components/sidebar
1212 */
1313
14import { getBridge } from '../bridge/core'
14import { getBridge } from '../bridge/core.js'
1515
1616// ============================================================================
1717// Types
1818// ============================================================================
1919
2020// Shared with `api/sidebar`; see `../sidebar-types`.
21export type { ContextMenuItem, SidebarItem, SidebarSection } from '../sidebar-types'
21export type { ContextMenuItem, SidebarItem, SidebarSection } from '../sidebar-types.js'
2222
23import type { SidebarItem, SidebarSection } from '../sidebar-types'
23import type { SidebarItem, SidebarSection } from '../sidebar-types.js'
2424
2525export type SidebarStyle = 'tahoe' | 'arc' | 'orbstack' | 'custom'
2626
packages/typescript/src/dev/hot-reload.tsmodified+1-1
Changes to packages/typescript/src/dev/hot-reload.ts
@@ -7,7 +7,7 @@ import { existsSync, readFileSync, watch, type FSWatcher } from 'fs'
77import { extname, join, relative, resolve } from 'path'
88import { EventEmitter } from 'events'
99import type { Server, ServerWebSocket } from 'bun'
10import { secureUUID } from '../bridge/ids'
10import { secureUUID } from '../bridge/ids.js'
1111
1212/** Per-connection state carried on each Bun WebSocket (set at upgrade). */
1313interface HmrSocketData {
packages/typescript/src/index.tsmodified+18-18
Changes to packages/typescript/src/index.ts
@@ -8,8 +8,8 @@ import { mkdtempSync, readFileSync, writeFileSync } from 'node:fs'
88import { tmpdir } from 'node:os'
99import { join } from 'node:path'
1010import { promisify } from 'node:util'
11import { craftBinaryNotFoundMessage, resolveCraftBinary } from './binary-resolver'
12import type { AppConfig, WindowOptions } from './types'
11import { craftBinaryNotFoundMessage, resolveCraftBinary } from './binary-resolver.js'
12import type { AppConfig, WindowOptions } from './types.js'
1313
1414const execFileAsync = promisify(execFile)
1515
@@ -61,30 +61,30 @@ export function parseCraftVersionOutput(output: string): string {
6161}
6262
6363// Export packaging API
64export { packageApp, pack, type PackageConfig, type PackageResult } from './package'
64export { packageApp, pack, type PackageConfig, type PackageResult } from './package.js'
6565
6666// Export binary resolution. Craft ships through the pantry registry, and this is
6767// the single source of truth for finding the native binary (PATH, or CRAFT_BIN
6868// for local builds). Anything that spawns craft itself — the stx desktop
6969// package, for instance — must resolve it the same way rather than probing paths
7070// of its own.
71export { craftBinaryNotFoundMessage, resolveCraftBinary } from './binary-resolver'
71export { craftBinaryNotFoundMessage, resolveCraftBinary } from './binary-resolver.js'
7272
7373// Export utilities
74export * from './utils'
74export * from './utils/index.js'
7575
7676// Export API modules
77export * from './api'
77export * from './api/index.js'
7878
79// Namespace export so consumers can also do `import { components } from '...'`
79// Namespace export so consumers can also do `import { components } from '....js'`
8080// and reach every symbol from `./components` without name clashes against the
8181// API surface. The flat (selective) re-exports below are kept for backwards
8282// compatibility, but new code should prefer `components.X` to avoid surprises
8383// when new exports are added on either side.
84export * as components from './components'
84export * as components from './components/index.js'
8585
8686// Export component abstractions (React Native-style primitives)
87// Use explicit exports to avoid conflicts with names from './api':
87// Use explicit exports to avoid conflicts with names from './api/index.js':
8888// Excluded duplicates: Sidebar, createSidebar, SidebarItem, SidebarSection,
8989// SidebarConfig, TouchBarItem, TableColumn, Platform
9090export {
@@ -125,7 +125,7 @@ export {
125125 // Animated & StyleSheet
126126 StyleSheet,
127127 Animated,
128} from './components'
128} from './components/index.js'
129129export type {
130130 // Sidebar types (excluding duplicates with api)
131131 ContextMenuItem,
@@ -187,29 +187,29 @@ export type {
187187 // Events
188188 LayoutEvent,
189189 ScrollEvent,
190} from './components'
190} from './components/index.js'
191191
192192// Export styling utilities (Headwind CSS integration + Sidebar styles)
193export * from './styles/headwind'
194export * from './styles'
193export * from './styles/headwind.js'
194export * from './styles/index.js'
195195
196196// Export framework-specific optimizations
197export * from './optimizations'
197export * from './optimizations/index.js'
198198
199199// Export auto-updater (delta/differential update support)
200export * as updater from './updater'
200export * as updater from './updater/index.js'
201201
202202// Also export the updater surface top-level. An app that self-updates needs the
203203// class and the manifest builder by name; reaching them only through the
204204// namespace left them untyped for anything re-exporting this package.
205export { AutoUpdater, generateUpdateManifest } from './updater'
205export { AutoUpdater, generateUpdateManifest } from './updater/index.js'
206206export type {
207207 UpdateInfo as UpdateManifest,
208208 UpdateProgress,
209209 UpdaterConfig,
210210 UpdaterEvent,
211211 PlatformUpdate,
212} from './updater'
212} from './updater/index.js'
213213
214214/**
215215 * Decide whether to enable dev defaults (hot-reload + devtools). The
@@ -556,4 +556,4 @@ export type {
556556 WindowsConfig,
557557 LinuxConfig,
558558 CraftAppConfig,
559} from './types'
559} from './types.js'
packages/typescript/src/mobile.tsmodified+1-1
Changes to packages/typescript/src/mobile.ts
@@ -5,4 +5,4 @@
55 * application. The root SDK also contains desktop packaging and process APIs,
66 * which intentionally target Bun and must not enter a browser bundle.
77 */
8export * from './api/mobile'
8export * from './api/mobile.js'
packages/typescript/src/package.test.tsmodified+1-1
Changes to packages/typescript/src/package.test.ts
@@ -2,7 +2,7 @@ import { afterEach, describe, expect, it } from 'bun:test'
22import { chmodSync, existsSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from 'node:fs'
33import { tmpdir } from 'node:os'
44import { join } from 'node:path'
5import { candleArguments, codesignArguments, dmgCapacityMegabytes, dmgCreateArguments, formatPackagingCommandError, macOSInfoPlist, notarytoolArguments, packageApp, productbuildArguments, renderWixSource, shouldRetryHdiutil, windowsArchitecture, windowsExecutableName } from './package'
5import { candleArguments, codesignArguments, dmgCapacityMegabytes, dmgCreateArguments, formatPackagingCommandError, macOSInfoPlist, notarytoolArguments, packageApp, productbuildArguments, renderWixSource, shouldRetryHdiutil, windowsArchitecture, windowsExecutableName } from './package.js'
66
77describe('Windows MSI packaging', () => {
88 it('renders a deterministic major-upgrade installer without shell interpolation', () => {
packages/typescript/src/styles/index.tsmodified+9-9
Changes to packages/typescript/src/styles/index.ts
@@ -12,12 +12,12 @@ export {
1212 style,
1313 generateConfig,
1414 buildCSS
15} from './headwind'
15} from './headwind.js'
1616export type {
1717 ClassValue,
1818 VariantConfig,
1919 HeadwindConfig
20} from './headwind'
20} from './headwind.js'
2121
2222// Sidebar styles (Tahoe, Arc, OrbStack)
2323export {
@@ -27,7 +27,7 @@ export {
2727 sidebarUtils,
2828 sidebarCSSVariables,
2929 getSidebarStyle
30} from './sidebars'
30} from './sidebars.js'
3131
3232// Sidebar HTML templates
3333export {
@@ -38,20 +38,20 @@ export {
3838 arcDemoData,
3939 orbstackDemoData,
4040 getFullPageHTML
41} from './sidebar-templates'
41} from './sidebar-templates.js'
4242export type {
4343 SidebarItemData,
4444 SidebarSectionData,
4545 SidebarData
46} from './sidebar-templates'
46} from './sidebar-templates.js'
4747
4848// Re-export cx as clsx alias for familiarity
49export { cx as clsx } from './headwind'
49export { cx as clsx } from './headwind.js'
5050
5151// Re-export sidebar defaults
52import { tahoeStyles, arcStyles, orbstackStyles } from './sidebars'
53import { renderTahoeSidebar, renderArcSidebar, renderOrbStackSidebar } from './sidebar-templates'
54import { tw, cx, variants } from './headwind'
52import { tahoeStyles, arcStyles, orbstackStyles } from './sidebars.js'
53import { renderTahoeSidebar, renderArcSidebar, renderOrbStackSidebar } from './sidebar-templates.js'
54import { tw, cx, variants } from './headwind.js'
5555
5656export const styles: {
5757 tw: typeof tw;
packages/typescript/src/styles/sidebar-templates.tsmodified+1-1
Changes to packages/typescript/src/styles/sidebar-templates.ts
@@ -8,7 +8,7 @@
88 * @module @craft-native/styles/sidebar-templates
99 */
1010
11import { tahoeStyles, arcStyles, orbstackStyles, cx } from './sidebars'
11import { tahoeStyles, arcStyles, orbstackStyles, cx } from './sidebars.js'
1212
1313// ============================================================================
1414// Types
packages/typescript/src/types.tsmodified+1-1
Changes to packages/typescript/src/types.ts
@@ -1063,7 +1063,7 @@ export interface CraftBridgeAPI {
10631063 * so its presence is not a promise that swipes will arrive. See
10641064 * `api/gestures`.
10651065 */
1066 gestures?: import('./api/gestures').GesturesAPI
1066 gestures?: import('./api/gestures.js').GesturesAPI
10671067
10681068 /**
10691069 * System tray control (desktop only)
packages/typescript/src/utils/index.tsmodified+4-4
Changes to packages/typescript/src/utils/index.ts
@@ -3,10 +3,10 @@
33 * Helper functions and classes for common tasks
44 */
55
6export * from './audio'
7export * from './native'
8export * from './storage'
9export * from './timer'
6export * from './audio.js'
7export * from './native.js'
8export * from './storage.js'
9export * from './timer.js'
1010
1111// Framework bindings are exported separately to avoid requiring all dependencies
1212// Import them directly:
packages/typescript/src/utils/native.tsmodified+1-1
Changes to packages/typescript/src/utils/native.ts
@@ -5,7 +5,7 @@
55 * have a single seam to mock in tests.
66 */
77
8import type { CraftBridgeAPI, CraftEventEmitter } from '../types'
8import type { CraftBridgeAPI, CraftEventEmitter } from '../types.js'
99
1010type CraftBridge = CraftBridgeAPI & CraftEventEmitter
1111
packages/typescript/src/utils/react.tsmodified+3-3
Changes to packages/typescript/src/utils/react.ts
@@ -11,9 +11,9 @@
1111 */
1212
1313import { useCallback, useEffect, useMemo, useRef, useState, useSyncExternalStore, type RefObject } from 'react';
14import { app as appApi } from '../api/app';
15import { tray as trayApi } from '../api/tray';
16import { windowManager } from '../api/window';
14import { app as appApi } from '../api/app.js';
15import { tray as trayApi } from '../api/tray.js';
16import { windowManager } from '../api/window.js';
1717
1818// ============================================
1919// Types
packages/typescript/src/utils/svelte.tsmodified+1-1
Changes to packages/typescript/src/utils/svelte.ts
@@ -5,7 +5,7 @@
55
66import { writable, derived, readable, get, type Writable, type Readable } from 'svelte/store';
77import { onMount, onDestroy } from 'svelte';
8import { windowManager } from '../api/window';
8import { windowManager } from '../api/window.js';
99
1010// ============================================
1111// Types
packages/typescript/src/utils/vue.tsmodified+2-2
Changes to packages/typescript/src/utils/vue.ts
@@ -19,8 +19,8 @@ import {
1919 type InjectionKey,
2020 type Ref,
2121} from 'vue';
22import { app as appApi } from '../api/app';
23import { windowManager } from '../api/window';
22import { app as appApi } from '../api/app.js';
23import { windowManager } from '../api/window.js';
2424
2525// ============================================
2626// Types
scripts/verify-packages.tsmodified+44-0
Changes to scripts/verify-packages.ts
@@ -71,6 +71,49 @@ function assertNoTestDeclarations(packageDir: string): void {
7171 }
7272}
7373
74/**
75 * Every relative specifier in a shipped declaration must carry a file
76 * extension.
77 *
78 * TypeScript only enforces this on the *consumer* side, under
79 * `moduleResolution: node16` or `nodenext` — which is what a modern Node
80 * project uses. Emit is happy either way, so `dist/index.d.ts` shipped 15
81 * extensionless re-exports and every such consumer got:
82 *
83 * error TS2834: Relative import paths need explicit file extensions in
84 * ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'
85 *
86 * followed by TS2305 on symbols the package genuinely exports. Nothing in the
87 * repo noticed, because the repo builds itself with `moduleResolution:
88 * bundler`, where extensionless is fine.
89 */
90function assertDeclarationsCarryExtensions(packageDir: string): void {
91 const dist = join(packageDir, 'dist')
92 if (!existsSync(dist))
93 return
94
95 // `from './x'` / `import('./x')`, capturing the specifier.
96 const specifier = /(?:from|import)\s*\(?\s*['"](\.[^'"]*)['"]/g
97
98 const stack = [dist]
99 while (stack.length > 0) {
100 const dir = stack.pop()!
101 for (const entry of readdirSync(dir, { withFileTypes: true })) {
102 const path = join(dir, entry.name)
103 if (entry.isDirectory()) {
104 stack.push(path)
105 continue
106 }
107 if (!/\.d\.(?:ts|cts|mts)$/.test(path))
108 continue
109 for (const match of readFileSync(path, 'utf-8').matchAll(specifier)) {
110 if (!/\.(?:js|cjs|mjs|json)$/.test(match[1]))
111 fail(`Declaration ${path} imports "${match[1]}" without a file extension, which does not resolve under moduleResolution node16/nodenext`)
112 }
113 }
114 }
115}
116
74117function verifyExportTargets(pkg: PackageJson, packageDir: string): void {
75118 const visit = (value: any): void => {
76119 if (typeof value === 'string' && value.startsWith('./'))
@@ -103,6 +146,7 @@ function verifyPackage(relativePath: string): void {
103146 verifyBinTargets(pkg, packageDir)
104147 verifyExportTargets(pkg, packageDir)
105148 assertNoTestDeclarations(packageDir)
149 assertDeclarationsCarryExtensions(packageDir)
106150}
107151
108152for (const packagePath of [