-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1498 from ably/1442-add-typings-for-tree-shakable…
…-version [SDK-3857] Add typings for the tree-shakable version of the library
- Loading branch information
Showing
15 changed files
with
219 additions
and
146 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import { Types } from './ably'; | ||
|
||
export declare const generateRandomKey: Types.Crypto['generateRandomKey']; | ||
export declare const getDefaultCryptoParams: Types.Crypto['getDefaultParams']; | ||
export declare const decodeMessage: Types.MessageStatic['fromEncoded']; | ||
export declare const decodeEncryptedMessage: Types.MessageStatic['fromEncoded']; | ||
export declare const decodeMessages: Types.MessageStatic['fromEncodedArray']; | ||
export declare const decodeEncryptedMessages: Types.MessageStatic['fromEncodedArray']; | ||
export declare const decodePresenceMessage: Types.PresenceMessageStatic['fromEncoded']; | ||
export declare const decodePresenceMessages: Types.PresenceMessageStatic['fromEncodedArray']; | ||
export declare const constructPresenceMessage: Types.PresenceMessageStatic['fromValues']; | ||
|
||
export declare const Rest: unknown; | ||
export declare const Crypto: unknown; | ||
export declare const MsgPack: unknown; | ||
export declare const RealtimePresence: unknown; | ||
export declare const WebSocketTransport: unknown; | ||
export declare const XHRPolling: unknown; | ||
export declare const XHRStreaming: unknown; | ||
export declare const XHRRequest: unknown; | ||
export declare const FetchRequest: unknown; | ||
export declare const MessageInteractions: unknown; | ||
|
||
export interface ModulesMap { | ||
Rest?: typeof Rest; | ||
Crypto?: typeof Crypto; | ||
MsgPack?: typeof MsgPack; | ||
RealtimePresence?: typeof RealtimePresence; | ||
WebSocketTransport?: typeof WebSocketTransport; | ||
XHRPolling?: typeof XHRPolling; | ||
XHRStreaming?: typeof XHRStreaming; | ||
XHRRequest?: typeof XHRRequest; | ||
FetchRequest?: typeof FetchRequest; | ||
MessageInteractions?: typeof MessageInteractions; | ||
} | ||
|
||
export declare class BaseRest extends Types.Rest { | ||
constructor(options: Types.ClientOptions, modules: ModulesMap); | ||
} | ||
|
||
export declare class BaseRealtime extends Types.Realtime { | ||
constructor(options: Types.ClientOptions, modules: ModulesMap); | ||
} | ||
|
||
export { Types }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,17 +7,22 @@ | |
"url": "https://github.com/ably/ably-js/issues", | ||
"email": "[email protected]" | ||
}, | ||
"main": "./build/ably-node.js", | ||
"typings": "./ably.d.ts", | ||
"react-native": { | ||
"./build/ably-node.js": "./build/ably-reactnative.js" | ||
}, | ||
"browser": { | ||
"./build/ably-node.js": "./build/ably.js" | ||
"exports": { | ||
".": { | ||
"node": "./build/ably-node.js", | ||
"react-native": "./build/ably-reactnative.js", | ||
"default": "./build/ably.js" | ||
}, | ||
"./modules": { | ||
"types": "./modules.d.ts", | ||
"default": "./build/modules/index.js" | ||
} | ||
}, | ||
"typings": "./ably.d.ts", | ||
"files": [ | ||
"build/**", | ||
"ably.d.ts", | ||
"modules.d.ts", | ||
"resources/**", | ||
"src/**", | ||
"react/**" | ||
|
@@ -123,8 +128,8 @@ | |
"lint": "eslint .", | ||
"lint:fix": "eslint --fix .", | ||
"prepare": "npm run build", | ||
"format": "prettier --write --ignore-path .gitignore --ignore-path .prettierignore src test ably.d.ts webpack.config.js Gruntfile.js scripts/*.js docs/chrome-mv3.md", | ||
"format:check": "prettier --check --ignore-path .gitignore --ignore-path .prettierignore src test ably.d.ts webpack.config.js Gruntfile.js scripts/*.js", | ||
"format": "prettier --write --ignore-path .gitignore --ignore-path .prettierignore src test ably.d.ts modules.d.ts webpack.config.js Gruntfile.js scripts/*.js docs/chrome-mv3.md", | ||
"format:check": "prettier --check --ignore-path .gitignore --ignore-path .prettierignore src test ably.d.ts modules.d.ts webpack.config.js Gruntfile.js scripts/*.js", | ||
"sourcemap": "source-map-explorer build/ably.min.js", | ||
"sourcemap:noencryption": "source-map-explorer build/ably.noencryption.min.js", | ||
"modulereport": "node scripts/moduleReport.js", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
test/package/browser/template/server/resources/index-default.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="utf-8" /> | ||
<title>Ably NPM package test (default export)</title> | ||
</head> | ||
<body> | ||
<script type="text/javascript" src="index-default.js"></script> | ||
<script type="text/javascript" src="runTest.js"></script> | ||
</body> | ||
</html> |
11 changes: 11 additions & 0 deletions
11
test/package/browser/template/server/resources/index-modules.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="utf-8" /> | ||
<title>Ably NPM package test (tree-shakable export)</title> | ||
</head> | ||
<body> | ||
<script type="text/javascript" src="index-modules.js"></script> | ||
<script type="text/javascript" src="runTest.js"></script> | ||
</body> | ||
</html> |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
(async () => { | ||
try { | ||
await testAblyPackage(); | ||
onResult(null); | ||
} catch (error) { | ||
console.log('Caught error', error); | ||
onResult(error); | ||
} | ||
})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.