also looking at this
fix(sdk): ship declarations that resolve under node16/nodenext
#42
43 files
+196
-137
| @@ -33,7 +33,7 @@ import type { Tile, TileCacheBackend } from 'ts-maps' | ||
| 33 | 33 | // Import the fs helpers directly from their source module rather than from |
| 34 | 34 | // the `craft-native` package root, matching how `MapView` talks to |
| 35 | 35 | // the bridge — keeps the type graph narrow. |
| 36 | import { fs, readBinaryFile, writeBinaryFile } from '../../typescript/src/api/fs' | |
| 36 | import { fs, readBinaryFile, writeBinaryFile } from '../../typescript/src/api/fs.js' | |
| 37 | 37 | |
| 38 | 38 | export interface FilesystemBackendOptions { |
| 39 | 39 | /** |
| @@ -10,8 +10,8 @@ | ||
| 10 | 10 | // package root, so we don't pull the entire `craft-native` surface |
| 11 | 11 | // (including unrelated stx-templated sidebar files) through the type |
| 12 | 12 | // checker. The public API of the bridge is stable, so this is fine. |
| 13 | import type { NativeBridge } from '../../typescript/src/bridge/core' | |
| 14 | import { getBridge } from '../../typescript/src/bridge/core' | |
| 13 | import type { NativeBridge } from '../../typescript/src/bridge/core.js' | |
| 14 | import { getBridge } from '../../typescript/src/bridge/core.js' | |
| 15 | 15 | import type { TsMap } from 'ts-maps' |
| 16 | 16 | import { createMap, tileLayer } from 'ts-maps' |
| 17 | 17 | import { |
| @@ -23,12 +23,12 @@ import { | ||
| 23 | 23 | craftPolylineToPolyline, |
| 24 | 24 | craftRegionToBounds, |
| 25 | 25 | latLngToCraftCoord, |
| 26 | } from './adapters' | |
| 26 | } from './adapters.js' | |
| 27 | 27 | import type { |
| 28 | 28 | MapBridgeEvent, |
| 29 | 29 | TypedMapBridgeRequest, |
| 30 | } from './bridge-protocol' | |
| 31 | import { BRIDGE_NAMESPACE, mapEventName } from './bridge-protocol' | |
| 30 | } from './bridge-protocol.js' | |
| 31 | import { BRIDGE_NAMESPACE, mapEventName } from './bridge-protocol.js' | |
| 32 | 32 | import type { |
| 33 | 33 | Coordinate, |
| 34 | 34 | MapCamera, |
| @@ -38,8 +38,8 @@ import type { | ||
| 38 | 38 | MapPolygon, |
| 39 | 39 | MapPolyline, |
| 40 | 40 | MapRegion, |
| 41 | } from './types' | |
| 42 | import { defaultMapCamera, defaultMapConfiguration } from './types' | |
| 41 | } from './types.js' | |
| 42 | import { defaultMapCamera, defaultMapConfiguration } from './types.js' | |
| 43 | 43 | |
| 44 | 44 | // Monotonic counter — same pattern as `components/native.ts` in |
| 45 | 45 | // `craft-native` — so multiple map views created in the same tick |
| @@ -17,8 +17,8 @@ import type { | ||
| 17 | 17 | MapPolygon, |
| 18 | 18 | MapPolyline, |
| 19 | 19 | MapRegion, |
| 20 | } from './types' | |
| 21 | import { markerColorHex, strokePatternDashes } from './types' | |
| 20 | } from './types.js' | |
| 21 | import { markerColorHex, strokePatternDashes } from './types.js' | |
| 22 | 22 | |
| 23 | 23 | // --------------------------------------------------------------------------- |
| 24 | 24 | // Coordinates |
| @@ -19,7 +19,7 @@ export { | ||
| 19 | 19 | type ComponentProps, |
| 20 | 20 | type MapViewInstance, |
| 21 | 21 | type MapViewProps, |
| 22 | } from './MapView' | |
| 22 | } from './MapView.js' | |
| 23 | 23 | |
| 24 | 24 | // Type mirrors of the Zig structs. |
| 25 | 25 | export { |
| @@ -43,7 +43,7 @@ export { | ||
| 43 | 43 | type MarkerColor, |
| 44 | 44 | type StrokePattern, |
| 45 | 45 | type UserTrackingMode, |
| 46 | } from './types' | |
| 46 | } from './types.js' | |
| 47 | 47 | |
| 48 | 48 | // Adapters (pure fns) for round-tripping between Craft and ts-maps types. |
| 49 | 49 | export { |
| @@ -60,7 +60,7 @@ export { | ||
| 60 | 60 | latLngToCraftCoord, |
| 61 | 61 | regionFromBounds, |
| 62 | 62 | type TsMapsCameraOptions, |
| 63 | } from './adapters' | |
| 63 | } from './adapters.js' | |
| 64 | 64 | |
| 65 | 65 | // Bridge protocol constants/types. |
| 66 | 66 | export { |
| @@ -70,18 +70,18 @@ export { | ||
| 70 | 70 | type MapBridgeMethod, |
| 71 | 71 | type MapBridgeRequest, |
| 72 | 72 | type TypedMapBridgeRequest, |
| 73 | } from './bridge-protocol' | |
| 73 | } from './bridge-protocol.js' | |
| 74 | 74 | |
| 75 | 75 | // Sandbox-filesystem tile persistence + offline region helpers. |
| 76 | 76 | export { |
| 77 | 77 | createFilesystemBackend, |
| 78 | 78 | type FilesystemBackendOptions, |
| 79 | } from './FilesystemTileBackend' | |
| 79 | } from './FilesystemTileBackend.js' | |
| 80 | 80 | export { |
| 81 | 81 | createFilesystemTileCache, |
| 82 | 82 | saveOfflineRegionToFilesystem, |
| 83 | 83 | type FilesystemOfflineRegionOptions, |
| 84 | } from './offlineRegion' | |
| 84 | } from './offlineRegion.js' | |
| 85 | 85 | |
| 86 | 86 | // Runtime capability probe — tells the host app which renderer the |
| 87 | 87 | // device can realistically drive. |
| @@ -89,7 +89,7 @@ export { | ||
| 89 | 89 | probeCapabilities, |
| 90 | 90 | supportsAdvancedRendering, |
| 91 | 91 | type MapRendererCapabilities, |
| 92 | } from './capabilities' | |
| 92 | } from './capabilities.js' | |
| 93 | 93 | |
| 94 | 94 | // createMap is the underlying ts-maps factory; re-export under its original |
| 95 | 95 | // name for parity with the spec which mentions `createMap` as a Craft export. |
| @@ -105,5 +105,5 @@ export const tsMapsProvider = 'ts_maps' as const | ||
| 105 | 105 | * Alias preserved for callers that imported the two helpers by spec name. |
| 106 | 106 | * `coordinateFromLatLng(LatLng) -> Coordinate`, `latLngFromCoordinate(Coordinate) -> LatLng`. |
| 107 | 107 | */ |
| 108 | export { latLngToCraftCoord as coordinateFromLatLng } from './adapters' | |
| 109 | export { craftCoordToLatLng as latLngFromCoordinate } from './adapters' | |
| 108 | export { latLngToCraftCoord as coordinateFromLatLng } from './adapters.js' | |
| 109 | export { craftCoordToLatLng as latLngFromCoordinate } from './adapters.js' | |
| @@ -28,7 +28,7 @@ import type { | ||
| 28 | 28 | TileCacheOptions, |
| 29 | 29 | } from 'ts-maps' |
| 30 | 30 | import { saveOfflineRegion, TileCache } from 'ts-maps' |
| 31 | import { createFilesystemBackend } from './FilesystemTileBackend' | |
| 31 | import { createFilesystemBackend } from './FilesystemTileBackend.js' | |
| 32 | 32 | |
| 33 | 33 | export type OfflineBoundsLike = |
| 34 | 34 | | { west: number, south: number, east: number, north: number } |
| @@ -45,14 +45,29 @@ | ||
| 45 | 45 | "default": "./dist/mobile.js" |
| 46 | 46 | }, |
| 47 | 47 | "./ios": { |
| 48 | "browser": null, | |
| 48 | 49 | "types": "./dist/ios/src/index.d.ts", |
| 49 | 50 | "import": "./dist/ios/src/index.js" |
| 50 | 51 | }, |
| 51 | 52 | "./android": { |
| 53 | "browser": null, | |
| 52 | 54 | "types": "./dist/android/src/index.d.ts", |
| 53 | 55 | "import": "./dist/android/src/index.js" |
| 54 | 56 | } |
| 55 | 57 | }, |
| 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 | }, | |
| 56 | 71 | "module": "./dist/index.js", |
| 57 | 72 | "types": "./dist/index.d.ts", |
| 58 | 73 | "files": [ |
| @@ -5,7 +5,7 @@ | ||
| 5 | 5 | * @module @craft-native/api/android-advanced |
| 6 | 6 | */ |
| 7 | 7 | |
| 8 | import { isCraft, getPlatform } from './process' | |
| 8 | import { isCraft, getPlatform } from './process.js' | |
| 9 | 9 | |
| 10 | 10 | // ============================================================================ |
| 11 | 11 | // Material You / Dynamic Colors |
| @@ -4,8 +4,8 @@ | ||
| 4 | 4 | * @module @craft-native/api/app |
| 5 | 5 | */ |
| 6 | 6 | |
| 7 | import { getBridge } from '../bridge/core' | |
| 8 | import { isWebKitHost, webkitRequest } from '../bridge/webkit-pending' | |
| 7 | import { getBridge } from '../bridge/core.js' | |
| 8 | import { isWebKitHost, webkitRequest } from '../bridge/webkit-pending.js' | |
| 9 | 9 | |
| 10 | 10 | // ============================================================================ |
| 11 | 11 | // Types |
| @@ -4,8 +4,8 @@ | ||
| 4 | 4 | * @module @craft-native/api/clipboard |
| 5 | 5 | */ |
| 6 | 6 | |
| 7 | import { getBridge } from '../bridge/core' | |
| 8 | import { isWebKitHost, postWebKit, webkitRequest } from '../bridge/webkit-pending' | |
| 7 | import { getBridge } from '../bridge/core.js' | |
| 8 | import { isWebKitHost, postWebKit, webkitRequest } from '../bridge/webkit-pending.js' | |
| 9 | 9 | |
| 10 | 10 | /** Default timeout for callback-style clipboard reads. */ |
| 11 | 11 | const CLIPBOARD_READ_TIMEOUT_MS = 5000 |
| @@ -3,7 +3,7 @@ | ||
| 3 | 3 | * Provides cryptographic operations through the Craft bridge |
| 4 | 4 | */ |
| 5 | 5 | |
| 6 | import type { CraftCryptoAPI } from '../types' | |
| 6 | import type { CraftCryptoAPI } from '../types.js' | |
| 7 | 7 | |
| 8 | 8 | /** |
| 9 | 9 | * Error type for cryptographic failures (malformed input, decode errors, etc.). |
| @@ -27,8 +27,8 @@ | ||
| 27 | 27 | */ |
| 28 | 28 | |
| 29 | 29 | import { EventEmitter } from 'events' |
| 30 | import { getBridge } from '../bridge/core' | |
| 31 | import type { CraftDatabaseAPI } from '../types' | |
| 30 | import { getBridge } from '../bridge/core.js' | |
| 31 | import type { CraftDatabaseAPI } from '../types.js' | |
| 32 | 32 | |
| 33 | 33 | /** |
| 34 | 34 | * Send a request through the unified `NativeBridge`. Replaces the legacy |
| @@ -4,8 +4,8 @@ | ||
| 4 | 4 | * @module @craft-native/api/dialog |
| 5 | 5 | */ |
| 6 | 6 | |
| 7 | import { getBridge } from '../bridge/core' | |
| 8 | import { isWebKitHost, webkitRequest } from '../bridge/webkit-pending' | |
| 7 | import { getBridge } from '../bridge/core.js' | |
| 8 | import { isWebKitHost, webkitRequest } from '../bridge/webkit-pending.js' | |
| 9 | 9 | |
| 10 | 10 | /** |
| 11 | 11 | * Default timeout for *file-system* dialog round-trips (open/save). |
| @@ -24,8 +24,8 @@ | ||
| 24 | 24 | * ``` |
| 25 | 25 | */ |
| 26 | 26 | |
| 27 | import { getBridge } from '../bridge/core' | |
| 28 | import type { CraftFileSystemAPI } from '../types' | |
| 27 | import { getBridge } from '../bridge/core.js' | |
| 28 | import type { CraftFileSystemAPI } from '../types.js' | |
| 29 | 29 | |
| 30 | 30 | /** |
| 31 | 31 | * Get the host-injected legacy file-system bridge, or null. The legacy |
| @@ -10,7 +10,7 @@ export { | ||
| 10 | 10 | window, |
| 11 | 11 | createWindow, |
| 12 | 12 | Window |
| 13 | } from './window' | |
| 13 | } from './window.js' | |
| 14 | 14 | export type { |
| 15 | 15 | WindowPosition, |
| 16 | 16 | WindowSize, |
| @@ -20,7 +20,7 @@ export type { | ||
| 20 | 20 | WindowEventType, |
| 21 | 21 | WindowEventMap, |
| 22 | 22 | WindowEventHandler |
| 23 | } from './window' | |
| 23 | } from './window.js' | |
| 24 | 24 | |
| 25 | 25 | // Tray/Menubar API - System tray and menubar apps |
| 26 | 26 | export { |
| @@ -34,7 +34,7 @@ export { | ||
| 34 | 34 | menuItem, |
| 35 | 35 | checkbox, |
| 36 | 36 | submenu |
| 37 | } from './tray' | |
| 37 | } from './tray.js' | |
| 38 | 38 | export type { |
| 39 | 39 | MenuItem, |
| 40 | 40 | TrayClickEvent, |
| @@ -43,7 +43,7 @@ export type { | ||
| 43 | 43 | TrayEventType, |
| 44 | 44 | TrayEventMap, |
| 45 | 45 | TrayEventHandler |
| 46 | } from './tray' | |
| 46 | } from './tray.js' | |
| 47 | 47 | |
| 48 | 48 | // App API - Application lifecycle and system integration |
| 49 | 49 | export { |
| @@ -65,7 +65,7 @@ export { | ||
| 65 | 65 | notify, |
| 66 | 66 | registerShortcut, |
| 67 | 67 | unregisterShortcut |
| 68 | } from './app' | |
| 68 | } from './app.js' | |
| 69 | 69 | export type { |
| 70 | 70 | AppInfo, |
| 71 | 71 | SystemPreferences, |
| @@ -76,19 +76,19 @@ export type { | ||
| 76 | 76 | AppEventMap, |
| 77 | 77 | AppEventHandler, |
| 78 | 78 | ShortcutHandler |
| 79 | } from './app' | |
| 79 | } from './app.js' | |
| 80 | 80 | |
| 81 | 81 | // File System API |
| 82 | export { fs, readBinaryFile, writeBinaryFile, stat, copy, move, watch } from './fs' | |
| 83 | export type { FileStats } from './fs' | |
| 82 | export { fs, readBinaryFile, writeBinaryFile, stat, copy, move, watch } from './fs.js' | |
| 83 | export type { FileStats } from './fs.js' | |
| 84 | 84 | |
| 85 | 85 | // Database API |
| 86 | export { db, openDatabase, Database, KeyValueStore } from './db' | |
| 87 | export type { ExecuteResult, TableColumn } from './db' | |
| 86 | export { db, openDatabase, Database, KeyValueStore } from './db.js' | |
| 87 | export type { ExecuteResult, TableColumn } from './db.js' | |
| 88 | 88 | |
| 89 | 89 | // HTTP Client API |
| 90 | export { http, HttpClient, WebSocketClient, createClient, HttpError } from './http' | |
| 91 | export type { HttpClientOptions, RequestOptions, HttpResponse, WebSocketOptions } from './http' | |
| 90 | export { http, HttpClient, WebSocketClient, createClient, HttpError } from './http.js' | |
| 91 | export type { HttpClientOptions, RequestOptions, HttpResponse, WebSocketOptions } from './http.js' | |
| 92 | 92 | |
| 93 | 93 | // Crypto API |
| 94 | 94 | export { |
| @@ -99,7 +99,7 @@ export { | ||
| 99 | 99 | timingSafeEqual, |
| 100 | 100 | hashPassword, |
| 101 | 101 | verifyPassword |
| 102 | } from './crypto' | |
| 102 | } from './crypto.js' | |
| 103 | 103 | |
| 104 | 104 | // Process API |
| 105 | 105 | export { |
| @@ -118,8 +118,8 @@ export { | ||
| 118 | 118 | exit, |
| 119 | 119 | argv, |
| 120 | 120 | open |
| 121 | } from './process' | |
| 122 | export type { Platform, SystemInfo, ExecOptions, ExecResult, SpawnOptions } from './process' | |
| 121 | } from './process.js' | |
| 122 | export type { Platform, SystemInfo, ExecOptions, ExecResult, SpawnOptions } from './process.js' | |
| 123 | 123 | |
| 124 | 124 | // Mobile API - Unified cross-platform mobile features |
| 125 | 125 | export { |
| @@ -134,7 +134,7 @@ export { | ||
| 134 | 134 | lifecycle, |
| 135 | 135 | notifications, |
| 136 | 136 | notifications as notification |
| 137 | } from './mobile' | |
| 137 | } from './mobile.js' | |
| 138 | 138 | export type { |
| 139 | 139 | DeviceInfo, |
| 140 | 140 | DeviceCapabilities, |
| @@ -150,7 +150,7 @@ export type { | ||
| 150 | 150 | ShareOptions, |
| 151 | 151 | AppState, |
| 152 | 152 | NotificationOptions as MobileNotificationOptions |
| 153 | } from './mobile' | |
| 153 | } from './mobile.js' | |
| 154 | 154 | |
| 155 | 155 | // iOS Advanced Features |
| 156 | 156 | export { |
| @@ -162,7 +162,7 @@ export { | ||
| 162 | 162 | appIntents, |
| 163 | 163 | tipKit, |
| 164 | 164 | focusFilters |
| 165 | } from './ios-advanced' | |
| 165 | } from './ios-advanced.js' | |
| 166 | 166 | export type { |
| 167 | 167 | CarPlayTemplateType, |
| 168 | 168 | CarPlayListItem, |
| @@ -185,7 +185,7 @@ export type { | ||
| 185 | 185 | Tip, |
| 186 | 186 | FocusStatus, |
| 187 | 187 | FocusFilter |
| 188 | } from './ios-advanced' | |
| 188 | } from './ios-advanced.js' | |
| 189 | 189 | |
| 190 | 190 | // Android Advanced Features |
| 191 | 191 | export { |
| @@ -197,7 +197,7 @@ export { | ||
| 197 | 197 | appLanguage, |
| 198 | 198 | widgets as androidWidgets, |
| 199 | 199 | playBilling |
| 200 | } from './android-advanced' | |
| 200 | } from './android-advanced.js' | |
| 201 | 201 | export type { |
| 202 | 202 | MaterialYouColors, |
| 203 | 203 | PhotoPickerMediaType, |
| @@ -213,7 +213,7 @@ export type { | ||
| 213 | 213 | WidgetData, |
| 214 | 214 | PlayProduct, |
| 215 | 215 | PlayPurchase |
| 216 | } from './android-advanced' | |
| 216 | } from './android-advanced.js' | |
| 217 | 217 | |
| 218 | 218 | // macOS Advanced Features |
| 219 | 219 | export { |
| @@ -226,7 +226,7 @@ export { | ||
| 226 | 226 | quickActions, |
| 227 | 227 | shareExtension, |
| 228 | 228 | windowManagement |
| 229 | } from './macos-advanced' | |
| 229 | } from './macos-advanced.js' | |
| 230 | 230 | export type { |
| 231 | 231 | TouchBarItemType, |
| 232 | 232 | TouchBarButton, |
| @@ -247,7 +247,7 @@ export type { | ||
| 247 | 247 | SpotlightItem, |
| 248 | 248 | QuickAction, |
| 249 | 249 | WindowTabGroup |
| 250 | } from './macos-advanced' | |
| 250 | } from './macos-advanced.js' | |
| 251 | 251 | |
| 252 | 252 | // Windows Advanced Features |
| 253 | 253 | export { |
| @@ -260,7 +260,7 @@ export { | ||
| 260 | 260 | shareTarget, |
| 261 | 261 | startupTask, |
| 262 | 262 | secondaryTiles |
| 263 | } from './windows-advanced' | |
| 263 | } from './windows-advanced.js' | |
| 264 | 264 | export type { |
| 265 | 265 | JumpListTask, |
| 266 | 266 | JumpListCategory, |
| @@ -275,7 +275,7 @@ export type { | ||
| 275 | 275 | UpdateInfo, |
| 276 | 276 | SharedDataItem, |
| 277 | 277 | SecondaryTile |
| 278 | } from './windows-advanced' | |
| 278 | } from './windows-advanced.js' | |
| 279 | 279 | |
| 280 | 280 | // Dialog API - Native file pickers and alerts |
| 281 | 281 | export { |
| @@ -286,7 +286,7 @@ export { | ||
| 286 | 286 | showAlert, |
| 287 | 287 | showConfirm, |
| 288 | 288 | showPrompt |
| 289 | } from './dialog' | |
| 289 | } from './dialog.js' | |
| 290 | 290 | export type { |
| 291 | 291 | FileFilter, |
| 292 | 292 | OpenDialogOptions, |
| @@ -296,7 +296,7 @@ export type { | ||
| 296 | 296 | ConfirmOptions, |
| 297 | 297 | OpenDialogResult, |
| 298 | 298 | SaveDialogResult |
| 299 | } from './dialog' | |
| 299 | } from './dialog.js' | |
| 300 | 300 | |
| 301 | 301 | // Clipboard API - System clipboard access |
| 302 | 302 | export { |
| @@ -305,20 +305,20 @@ export { | ||
| 305 | 305 | readText, |
| 306 | 306 | writeHTML, |
| 307 | 307 | readHTML |
| 308 | } from './clipboard' | |
| 308 | } from './clipboard.js' | |
| 309 | 309 | export type { |
| 310 | 310 | ClipboardFormat, |
| 311 | 311 | ClipboardData |
| 312 | } from './clipboard' | |
| 312 | } from './clipboard.js' | |
| 313 | 313 | |
| 314 | 314 | // Media API - Camera and microphone access |
| 315 | export { media } from './media' | |
| 315 | export { media } from './media.js' | |
| 316 | 316 | export type { |
| 317 | 317 | MediaDeviceInfo, |
| 318 | 318 | CameraOptions as MediaCameraOptions, |
| 319 | 319 | MicrophoneOptions, |
| 320 | 320 | MediaStreamOptions |
| 321 | } from './media' | |
| 321 | } from './media.js' | |
| 322 | 322 | |
| 323 | 323 | // Cross-Platform Sidebar API (macOS, Windows, Linux) |
| 324 | 324 | export { |
| @@ -327,7 +327,7 @@ export { | ||
| 327 | 327 | createFileSidebar, |
| 328 | 328 | createSettingsSidebar, |
| 329 | 329 | sidebar |
| 330 | } from './sidebar' | |
| 330 | } from './sidebar.js' | |
| 331 | 331 | export type { |
| 332 | 332 | SidebarItem, |
| 333 | 333 | SidebarSection, |
| @@ -337,31 +337,31 @@ export type { | ||
| 337 | 337 | LinuxSidebarConfig, |
| 338 | 338 | SidebarSelectEvent, |
| 339 | 339 | SidebarSearchEvent |
| 340 | } from './sidebar' | |
| 340 | } from './sidebar.js' | |
| 341 | 341 | |
| 342 | 342 | // Spaces API - native switcher for Arc-style sidebar spaces |
| 343 | 343 | export { |
| 344 | 344 | spaces, |
| 345 | 345 | createSpacesSidebar, |
| 346 | 346 | hasNativeSpaces |
| 347 | } from './spaces' | |
| 347 | } from './spaces.js' | |
| 348 | 348 | export type { |
| 349 | 349 | SpaceDescriptor, |
| 350 | 350 | SpacesSidebarOptions, |
| 351 | 351 | SpacesSidebarHandle, |
| 352 | 352 | NativeUIAPI |
| 353 | } from './spaces' | |
| 353 | } from './spaces.js' | |
| 354 | 354 | |
| 355 | 355 | // Gestures API - real trackpad swipe phases from the host's NSEvent |
| 356 | 356 | export { |
| 357 | 357 | gestures, |
| 358 | 358 | onSwipe, |
| 359 | 359 | hasNativeGestures |
| 360 | } from './gestures' | |
| 360 | } from './gestures.js' | |
| 361 | 361 | export type { |
| 362 | 362 | SwipeAxis, |
| 363 | 363 | SwipePhase, |
| 364 | 364 | SwipeEvent, |
| 365 | 365 | SwipeListener, |
| 366 | 366 | Unsubscribe |
| 367 | } from './gestures' | |
| 367 | } from './gestures.js' | |
| @@ -5,7 +5,7 @@ | ||
| 5 | 5 | * @module @craft-native/api/ios-advanced |
| 6 | 6 | */ |
| 7 | 7 | |
| 8 | import { isCraft, getPlatform } from './process' | |
| 8 | import { isCraft, getPlatform } from './process.js' | |
| 9 | 9 | |
| 10 | 10 | // ============================================================================ |
| 11 | 11 | // CarPlay Support |
| @@ -5,7 +5,7 @@ | ||
| 5 | 5 | * @module @craft-native/api/macos-advanced |
| 6 | 6 | */ |
| 7 | 7 | |
| 8 | import { isCraft, getPlatform } from './process' | |
| 8 | import { isCraft, getPlatform } from './process.js' | |
| 9 | 9 | |
| 10 | 10 | // ============================================================================ |
| 11 | 11 | // Touch Bar |
| @@ -23,7 +23,7 @@ | ||
| 23 | 23 | * ``` |
| 24 | 24 | */ |
| 25 | 25 | |
| 26 | import { secureUUID } from '../bridge/ids' | |
| 26 | import { secureUUID } from '../bridge/ids.js' | |
| 27 | 27 | |
| 28 | 28 | /** localStorage key for the persisted web-fallback device id. */ |
| 29 | 29 | const WEB_DEVICE_ID_KEY = '__craft_web_device_id__' |
| @@ -4,8 +4,8 @@ | ||
| 4 | 4 | * @module @craft-native/api/window |
| 5 | 5 | */ |
| 6 | 6 | |
| 7 | import { getBridge } from '../bridge/core' | |
| 8 | import { isWebKitHost, webkitRequest } from '../bridge/webkit-pending' | |
| 7 | import { getBridge } from '../bridge/core.js' | |
| 8 | import { isWebKitHost, webkitRequest } from '../bridge/webkit-pending.js' | |
| 9 | 9 | |
| 10 | 10 | // ============================================================================ |
| 11 | 11 | // Types |
| @@ -5,7 +5,7 @@ | ||
| 5 | 5 | * @module @craft-native/api/windows-advanced |
| 6 | 6 | */ |
| 7 | 7 | |
| 8 | import { isCraft, getPlatform } from './process' | |
| 8 | import { isCraft, getPlatform } from './process.js' | |
| 9 | 9 | |
| 10 | 10 | // ============================================================================ |
| 11 | 11 | // Jump Lists |
| @@ -4,7 +4,7 @@ | ||
| 4 | 4 | */ |
| 5 | 5 | |
| 6 | 6 | import { EventEmitter } from 'events' |
| 7 | import { secureUUID } from './ids' | |
| 7 | import { secureUUID } from './ids.js' | |
| 8 | 8 | |
| 9 | 9 | // Ambient types for native bridges injected by the host. These globals are |
| 10 | 10 | // defined by WKWebView (iOS), Android WebView, Electron's contextBridge, and |
| @@ -35,7 +35,7 @@ export { | ||
| 35 | 35 | tahoeStyle, |
| 36 | 36 | arcStyle, |
| 37 | 37 | orbstackStyle |
| 38 | } from './sidebar' | |
| 38 | } from './sidebar.js' | |
| 39 | 39 | export type { |
| 40 | 40 | SidebarItem, |
| 41 | 41 | SidebarSection, |
| @@ -48,7 +48,7 @@ export type { | ||
| 48 | 48 | SidebarEventType, |
| 49 | 49 | SidebarEventMap, |
| 50 | 50 | SidebarEventHandler |
| 51 | } from './sidebar' | |
| 51 | } from './sidebar.js' | |
| 52 | 52 | |
| 53 | 53 | // ============================================================================ |
| 54 | 54 | // Native UI Components |
| @@ -93,7 +93,7 @@ export { | ||
| 93 | 93 | // Touch Bar |
| 94 | 94 | setTouchBar, |
| 95 | 95 | updateTouchBarItem |
| 96 | } from './native' | |
| 96 | } from './native.js' | |
| 97 | 97 | export type { |
| 98 | 98 | ComponentProps, |
| 99 | 99 | ComponentInstance, |
| @@ -117,7 +117,7 @@ export type { | ||
| 117 | 117 | ToolbarConfig, |
| 118 | 118 | TouchBarItem, |
| 119 | 119 | TouchBarConfig |
| 120 | } from './native' | |
| 120 | } from './native.js' | |
| 121 | 121 | |
| 122 | 122 | // ============================================================================ |
| 123 | 123 | // Style Types |
| @@ -4,7 +4,7 @@ | ||
| 4 | 4 | * @module @craft-native/components/native |
| 5 | 5 | */ |
| 6 | 6 | |
| 7 | import { getBridge } from '../bridge/core' | |
| 7 | import { getBridge } from '../bridge/core.js' | |
| 8 | 8 | |
| 9 | 9 | // Monotonically increasing counter ensures IDs stay unique even when multiple |
| 10 | 10 | // components are created in the same millisecond — `Date.now()` alone collides. |
| @@ -7,7 +7,7 @@ import { existsSync, readFileSync, watch, type FSWatcher } from 'fs' | ||
| 7 | 7 | import { extname, join, relative, resolve } from 'path' |
| 8 | 8 | import { EventEmitter } from 'events' |
| 9 | 9 | import type { Server, ServerWebSocket } from 'bun' |
| 10 | import { secureUUID } from '../bridge/ids' | |
| 10 | import { secureUUID } from '../bridge/ids.js' | |
| 11 | 11 | |
| 12 | 12 | /** Per-connection state carried on each Bun WebSocket (set at upgrade). */ |
| 13 | 13 | interface HmrSocketData { |
| @@ -8,8 +8,8 @@ import { mkdtempSync, readFileSync, writeFileSync } from 'node:fs' | ||
| 8 | 8 | import { tmpdir } from 'node:os' |
| 9 | 9 | import { join } from 'node:path' |
| 10 | 10 | import { promisify } from 'node:util' |
| 11 | import { craftBinaryNotFoundMessage, resolveCraftBinary } from './binary-resolver' | |
| 12 | import type { AppConfig, WindowOptions } from './types' | |
| 11 | import { craftBinaryNotFoundMessage, resolveCraftBinary } from './binary-resolver.js' | |
| 12 | import type { AppConfig, WindowOptions } from './types.js' | |
| 13 | 13 | |
| 14 | 14 | const execFileAsync = promisify(execFile) |
| 15 | 15 | |
| @@ -61,30 +61,30 @@ export function parseCraftVersionOutput(output: string): string { | ||
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | // Export packaging API |
| 64 | export { packageApp, pack, type PackageConfig, type PackageResult } from './package' | |
| 64 | export { packageApp, pack, type PackageConfig, type PackageResult } from './package.js' | |
| 65 | 65 | |
| 66 | 66 | // Export binary resolution. Craft ships through the pantry registry, and this is |
| 67 | 67 | // the single source of truth for finding the native binary (PATH, or CRAFT_BIN |
| 68 | 68 | // for local builds). Anything that spawns craft itself — the stx desktop |
| 69 | 69 | // package, for instance — must resolve it the same way rather than probing paths |
| 70 | 70 | // of its own. |
| 71 | export { craftBinaryNotFoundMessage, resolveCraftBinary } from './binary-resolver' | |
| 71 | export { craftBinaryNotFoundMessage, resolveCraftBinary } from './binary-resolver.js' | |
| 72 | 72 | |
| 73 | 73 | // Export utilities |
| 74 | export * from './utils' | |
| 74 | export * from './utils/index.js' | |
| 75 | 75 | |
| 76 | 76 | // Export API modules |
| 77 | export * from './api' | |
| 77 | export * from './api/index.js' | |
| 78 | 78 | |
| 79 | // Namespace export so consumers can also do `import { components } from '...'` | |
| 79 | // Namespace export so consumers can also do `import { components } from '....js'` | |
| 80 | 80 | // and reach every symbol from `./components` without name clashes against the |
| 81 | 81 | // API surface. The flat (selective) re-exports below are kept for backwards |
| 82 | 82 | // compatibility, but new code should prefer `components.X` to avoid surprises |
| 83 | 83 | // when new exports are added on either side. |
| 84 | export * as components from './components' | |
| 84 | export * as components from './components/index.js' | |
| 85 | 85 | |
| 86 | 86 | // 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': | |
| 88 | 88 | // Excluded duplicates: Sidebar, createSidebar, SidebarItem, SidebarSection, |
| 89 | 89 | // SidebarConfig, TouchBarItem, TableColumn, Platform |
| 90 | 90 | export { |
| @@ -125,7 +125,7 @@ export { | ||
| 125 | 125 | // Animated & StyleSheet |
| 126 | 126 | StyleSheet, |
| 127 | 127 | Animated, |
| 128 | } from './components' | |
| 128 | } from './components/index.js' | |
| 129 | 129 | export type { |
| 130 | 130 | // Sidebar types (excluding duplicates with api) |
| 131 | 131 | ContextMenuItem, |
| @@ -187,29 +187,29 @@ export type { | ||
| 187 | 187 | // Events |
| 188 | 188 | LayoutEvent, |
| 189 | 189 | ScrollEvent, |
| 190 | } from './components' | |
| 190 | } from './components/index.js' | |
| 191 | 191 | |
| 192 | 192 | // Export styling utilities (Headwind CSS integration + Sidebar styles) |
| 193 | export * from './styles/headwind' | |
| 194 | export * from './styles' | |
| 193 | export * from './styles/headwind.js' | |
| 194 | export * from './styles/index.js' | |
| 195 | 195 | |
| 196 | 196 | // Export framework-specific optimizations |
| 197 | export * from './optimizations' | |
| 197 | export * from './optimizations/index.js' | |
| 198 | 198 | |
| 199 | 199 | // Export auto-updater (delta/differential update support) |
| 200 | export * as updater from './updater' | |
| 200 | export * as updater from './updater/index.js' | |
| 201 | 201 | |
| 202 | 202 | // Also export the updater surface top-level. An app that self-updates needs the |
| 203 | 203 | // class and the manifest builder by name; reaching them only through the |
| 204 | 204 | // namespace left them untyped for anything re-exporting this package. |
| 205 | export { AutoUpdater, generateUpdateManifest } from './updater' | |
| 205 | export { AutoUpdater, generateUpdateManifest } from './updater/index.js' | |
| 206 | 206 | export type { |
| 207 | 207 | UpdateInfo as UpdateManifest, |
| 208 | 208 | UpdateProgress, |
| 209 | 209 | UpdaterConfig, |
| 210 | 210 | UpdaterEvent, |
| 211 | 211 | PlatformUpdate, |
| 212 | } from './updater' | |
| 212 | } from './updater/index.js' | |
| 213 | 213 | |
| 214 | 214 | /** |
| 215 | 215 | * Decide whether to enable dev defaults (hot-reload + devtools). The |
| @@ -556,4 +556,4 @@ export type { | ||
| 556 | 556 | WindowsConfig, |
| 557 | 557 | LinuxConfig, |
| 558 | 558 | CraftAppConfig, |
| 559 | } from './types' | |
| 559 | } from './types.js' | |
| @@ -2,7 +2,7 @@ import { afterEach, describe, expect, it } from 'bun:test' | ||
| 2 | 2 | import { chmodSync, existsSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from 'node:fs' |
| 3 | 3 | import { tmpdir } from 'node:os' |
| 4 | 4 | import { join } from 'node:path' |
| 5 | import { candleArguments, codesignArguments, dmgCapacityMegabytes, dmgCreateArguments, formatPackagingCommandError, macOSInfoPlist, notarytoolArguments, packageApp, productbuildArguments, renderWixSource, shouldRetryHdiutil, windowsArchitecture, windowsExecutableName } from './package' | |
| 5 | import { candleArguments, codesignArguments, dmgCapacityMegabytes, dmgCreateArguments, formatPackagingCommandError, macOSInfoPlist, notarytoolArguments, packageApp, productbuildArguments, renderWixSource, shouldRetryHdiutil, windowsArchitecture, windowsExecutableName } from './package.js' | |
| 6 | 6 | |
| 7 | 7 | describe('Windows MSI packaging', () => { |
| 8 | 8 | it('renders a deterministic major-upgrade installer without shell interpolation', () => { |
| @@ -12,12 +12,12 @@ export { | ||
| 12 | 12 | style, |
| 13 | 13 | generateConfig, |
| 14 | 14 | buildCSS |
| 15 | } from './headwind' | |
| 15 | } from './headwind.js' | |
| 16 | 16 | export type { |
| 17 | 17 | ClassValue, |
| 18 | 18 | VariantConfig, |
| 19 | 19 | HeadwindConfig |
| 20 | } from './headwind' | |
| 20 | } from './headwind.js' | |
| 21 | 21 | |
| 22 | 22 | // Sidebar styles (Tahoe, Arc, OrbStack) |
| 23 | 23 | export { |
| @@ -27,7 +27,7 @@ export { | ||
| 27 | 27 | sidebarUtils, |
| 28 | 28 | sidebarCSSVariables, |
| 29 | 29 | getSidebarStyle |
| 30 | } from './sidebars' | |
| 30 | } from './sidebars.js' | |
| 31 | 31 | |
| 32 | 32 | // Sidebar HTML templates |
| 33 | 33 | export { |
| @@ -38,20 +38,20 @@ export { | ||
| 38 | 38 | arcDemoData, |
| 39 | 39 | orbstackDemoData, |
| 40 | 40 | getFullPageHTML |
| 41 | } from './sidebar-templates' | |
| 41 | } from './sidebar-templates.js' | |
| 42 | 42 | export type { |
| 43 | 43 | SidebarItemData, |
| 44 | 44 | SidebarSectionData, |
| 45 | 45 | SidebarData |
| 46 | } from './sidebar-templates' | |
| 46 | } from './sidebar-templates.js' | |
| 47 | 47 | |
| 48 | 48 | // Re-export cx as clsx alias for familiarity |
| 49 | export { cx as clsx } from './headwind' | |
| 49 | export { cx as clsx } from './headwind.js' | |
| 50 | 50 | |
| 51 | 51 | // Re-export sidebar defaults |
| 52 | import { tahoeStyles, arcStyles, orbstackStyles } from './sidebars' | |
| 53 | import { renderTahoeSidebar, renderArcSidebar, renderOrbStackSidebar } from './sidebar-templates' | |
| 54 | import { tw, cx, variants } from './headwind' | |
| 52 | import { tahoeStyles, arcStyles, orbstackStyles } from './sidebars.js' | |
| 53 | import { renderTahoeSidebar, renderArcSidebar, renderOrbStackSidebar } from './sidebar-templates.js' | |
| 54 | import { tw, cx, variants } from './headwind.js' | |
| 55 | 55 | |
| 56 | 56 | export const styles: { |
| 57 | 57 | tw: typeof tw; |
| @@ -1063,7 +1063,7 @@ export interface CraftBridgeAPI { | ||
| 1063 | 1063 | * so its presence is not a promise that swipes will arrive. See |
| 1064 | 1064 | * `api/gestures`. |
| 1065 | 1065 | */ |
| 1066 | gestures?: import('./api/gestures').GesturesAPI | |
| 1066 | gestures?: import('./api/gestures.js').GesturesAPI | |
| 1067 | 1067 | |
| 1068 | 1068 | /** |
| 1069 | 1069 | * System tray control (desktop only) |
| @@ -3,10 +3,10 @@ | ||
| 3 | 3 | * Helper functions and classes for common tasks |
| 4 | 4 | */ |
| 5 | 5 | |
| 6 | export * from './audio' | |
| 7 | export * from './native' | |
| 8 | export * from './storage' | |
| 9 | export * from './timer' | |
| 6 | export * from './audio.js' | |
| 7 | export * from './native.js' | |
| 8 | export * from './storage.js' | |
| 9 | export * from './timer.js' | |
| 10 | 10 | |
| 11 | 11 | // Framework bindings are exported separately to avoid requiring all dependencies |
| 12 | 12 | // Import them directly: |
| @@ -5,7 +5,7 @@ | ||
| 5 | 5 | * have a single seam to mock in tests. |
| 6 | 6 | */ |
| 7 | 7 | |
| 8 | import type { CraftBridgeAPI, CraftEventEmitter } from '../types' | |
| 8 | import type { CraftBridgeAPI, CraftEventEmitter } from '../types.js' | |
| 9 | 9 | |
| 10 | 10 | type CraftBridge = CraftBridgeAPI & CraftEventEmitter |
| 11 | 11 | |
| @@ -11,9 +11,9 @@ | ||
| 11 | 11 | */ |
| 12 | 12 | |
| 13 | 13 | import { useCallback, useEffect, useMemo, useRef, useState, useSyncExternalStore, type RefObject } from 'react'; |
| 14 | import { app as appApi } from '../api/app'; | |
| 15 | import { tray as trayApi } from '../api/tray'; | |
| 16 | import { windowManager } from '../api/window'; | |
| 14 | import { app as appApi } from '../api/app.js'; | |
| 15 | import { tray as trayApi } from '../api/tray.js'; | |
| 16 | import { windowManager } from '../api/window.js'; | |
| 17 | 17 | |
| 18 | 18 | // ============================================ |
| 19 | 19 | // Types |
| @@ -5,7 +5,7 @@ | ||
| 5 | 5 | |
| 6 | 6 | import { writable, derived, readable, get, type Writable, type Readable } from 'svelte/store'; |
| 7 | 7 | import { onMount, onDestroy } from 'svelte'; |
| 8 | import { windowManager } from '../api/window'; | |
| 8 | import { windowManager } from '../api/window.js'; | |
| 9 | 9 | |
| 10 | 10 | // ============================================ |
| 11 | 11 | // Types |
| @@ -19,8 +19,8 @@ import { | ||
| 19 | 19 | type InjectionKey, |
| 20 | 20 | type Ref, |
| 21 | 21 | } from 'vue'; |
| 22 | import { app as appApi } from '../api/app'; | |
| 23 | import { windowManager } from '../api/window'; | |
| 22 | import { app as appApi } from '../api/app.js'; | |
| 23 | import { windowManager } from '../api/window.js'; | |
| 24 | 24 | |
| 25 | 25 | // ============================================ |
| 26 | 26 | // Types |
| @@ -71,6 +71,49 @@ function assertNoTestDeclarations(packageDir: string): void { | ||
| 71 | 71 | } |
| 72 | 72 | } |
| 73 | 73 | |
| 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 | */ | |
| 90 | function 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 | ||
| 74 | 117 | function verifyExportTargets(pkg: PackageJson, packageDir: string): void { |
| 75 | 118 | const visit = (value: any): void => { |
| 76 | 119 | if (typeof value === 'string' && value.startsWith('./')) |
| @@ -103,6 +146,7 @@ function verifyPackage(relativePath: string): void { | ||
| 103 | 146 | verifyBinTargets(pkg, packageDir) |
| 104 | 147 | verifyExportTargets(pkg, packageDir) |
| 105 | 148 | assertNoTestDeclarations(packageDir) |
| 149 | assertDeclarationsCarryExtensions(packageDir) | |
| 106 | 150 | } |
| 107 | 151 | |
| 108 | 152 | for (const packagePath of [ |