Skip to content

Commit

Permalink
Hopefully fix types for universal package
Browse files Browse the repository at this point in the history
  • Loading branch information
martenrichter committed Feb 21, 2024
1 parent 9c76d47 commit eb7d8be
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 1 deletion.
1 change: 1 addition & 0 deletions main/lib/index.browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
* @typedef {import('./types').HttpServerInit} HttpServerInit
*/

// also edit index.types.js
export {
WebTransportPonyfill,
WebTransportPolyfill
Expand Down
1 change: 1 addition & 0 deletions main/lib/index.node.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,6 @@
* @typedef {import('./types').HttpServerInit} HttpServerInit
*/

// also edit index.types.js
export { HttpServer, Http3Server, Http2Server } from './server.js'
export { WebTransport } from './webtransport.node.js'
33 changes: 33 additions & 0 deletions main/lib/index.types.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/* eslint-disable no-prototype-builtins */
// Copyright (c) 2022 Marten Richter or other contributers (see commit). All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

/**
* // Spec
* @typedef {import('./dom').WebTransportDatagramStats} WebTransportDatagramStats
* @typedef {import('./dom').WebTransportStats} WebTransportStats
* @typedef {import('./dom').WebTransportCloseInfo} WebTransportCloseInfo
* @typedef {import('./dom').WebTransportDatagramDuplexStream} WebTransportDatagramDuplexStream
* @typedef {import('./dom').WebTransportBidirectionalStream} WebTransportBidirectionalStream
* @typedef {import('./dom').WebTransportSendStreamStats} WebTransportSendStreamStats
* @typedef {import('./dom').WebTransportSendStream} WebTransportSendStream
* @typedef {import('./dom').WebTransportReceiveStreamStats} WebTransportReceiveStreamStats
* @typedef {import('./dom').WebTransportReceiveStream} WebTransportReceiveStream
* @typedef {import('./dom').WebTransportHash} WebTransportHash
* @typedef {import('./dom').WebTransportOptions} WebTransportOptions
* @typedef {import('./dom').WebTransportReliabilityMode} WebTransportReliabilityMode
*
* Public API
* @typedef {import('./types').WebTransportSessionImpl} WebTransportSession
* @typedef {import('./types').HttpServerInit} HttpServerInit
*/

// both imports from the browser side and for nodes to generate a joint type file
export { HttpServer, Http3Server, Http2Server } from './server.js'
export { WebTransport } from './webtransport.node.js'

export {
WebTransportPonyfill,
WebTransportPolyfill
} from './webtransport.browser.js'
2 changes: 1 addition & 1 deletion main/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"node": ">=16.5"
},
"type": "module",
"types": "./dist/lib/index.d.ts",
"types": "./dist/lib/index.types.d.ts",
"scripts": {
"start": "node test/echoserver.js",
"test": "npm run test:node && npm run test:node:http2 && npm run test:chromium && npm run test:chromium:http2:polyfill && npm run test:chromium:http2:ponyfill && npm run test:firefox:http2:polyfill && npm run test:firefox:http2:ponyfill && npm run test:webkit:http2:polyfill && npm run test:webkit:http2:ponyfill",
Expand Down

0 comments on commit eb7d8be

Please sign in to comment.