Skip to content

Commit 6a35104

Browse files
authored
Many TSDoc tweaks (#3049)
1 parent 7c095b4 commit 6a35104

File tree

27 files changed

+91
-56
lines changed

27 files changed

+91
-56
lines changed

packages/workbox-broadcast-update/src/BroadcastCacheUpdate.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,8 @@ class BroadcastCacheUpdate {
9797
/**
9898
* Compares two [Responses](https://developer.mozilla.org/en-US/docs/Web/API/Response)
9999
* and sends a message (via `postMessage()`) to all window clients if the
100-
* responses differ (note: neither of the Responses can be
101-
* {@link http://stackoverflow.com/questions/39109789|opaque}).
100+
* responses differ. Neither of the Responses can be
101+
* [opaque](https://developer.chrome.com/docs/workbox/caching-resources-during-runtime/#opaque-responses).
102102
*
103103
* The message that's posted has the following format (where `payload` can
104104
* be customized via the `generatePayload` option the instance is created

packages/workbox-broadcast-update/src/BroadcastUpdatePlugin.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ class BroadcastUpdatePlugin implements WorkboxPlugin {
2626
private readonly _broadcastUpdate: BroadcastCacheUpdate;
2727

2828
/**
29-
* Construct a BroadcastCacheUpdate instance with the passed options and
30-
* calls its {@link workbox-broadcast-update.BroadcastCacheUpdate~notifyIfUpdated}
31-
* method whenever the plugin's `cacheDidUpdate` callback is invoked.
29+
* Construct a {@link workbox-broadcast-update.BroadcastUpdate} instance with
30+
* the passed options and calls its `notifyIfUpdated` method whenever the
31+
* plugin's `cacheDidUpdate` callback is invoked.
3232
*
3333
* @param {Object} [options]
3434
* @param {Array<string>} [options.headersToCheck=['content-length', 'etag', 'last-modified']]

packages/workbox-broadcast-update/src/index.ts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,22 @@
66
https://opensource.org/licenses/MIT.
77
*/
88

9-
import {BroadcastCacheUpdate} from './BroadcastCacheUpdate.js';
9+
import {
10+
BroadcastCacheUpdate,
11+
BroadcastCacheUpdateOptions,
12+
} from './BroadcastCacheUpdate.js';
1013
import {BroadcastUpdatePlugin} from './BroadcastUpdatePlugin.js';
1114
import {responsesAreSame} from './responsesAreSame.js';
15+
1216
import './_version.js';
1317

1418
/**
1519
* @module workbox-broadcast-update
1620
*/
1721

18-
export {BroadcastCacheUpdate, BroadcastUpdatePlugin, responsesAreSame};
22+
export {
23+
BroadcastCacheUpdate,
24+
BroadcastCacheUpdateOptions,
25+
BroadcastUpdatePlugin,
26+
responsesAreSame,
27+
};

packages/workbox-build/src/generate-sw.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import {writeSWUsingDefaultTemplate} from './lib/write-sw-using-default-template
2424
* Based on the precache manifest and the additional configuration, it writes
2525
* a ready-to-use service worker file to disk at `swDest`.
2626
*
27-
* @example
27+
* ```
2828
* // The following lists some common options; see the rest of the documentation
2929
* // for the full set of options and defaults.
3030
* const {count, size, warnings} = await generateSW({
@@ -55,6 +55,7 @@ import {writeSWUsingDefaultTemplate} from './lib/write-sw-using-default-template
5555
* skipWaiting: ...,
5656
* swDest: '...',
5757
* });
58+
* ```
5859
*
5960
* @memberof workbox-build
6061
*/

packages/workbox-build/src/get-manifest.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import {validateGetManifestOptions} from './lib/validate-options';
1515
* manifest", along with details about the number of entries and their size,
1616
* based on the options you provide.
1717
*
18-
* @example
18+
* ```
1919
* // The following lists some common options; see the rest of the documentation
2020
* // for the full set of options and defaults.
2121
* const {count, manifestEntries, size, warnings} = await getManifest({
@@ -24,6 +24,7 @@ import {validateGetManifestOptions} from './lib/validate-options';
2424
* globPatterns: ['...', '...'],
2525
* maximumFileSizeToCacheInBytes: ...,
2626
* });
27+
* ```
2728
*
2829
* @memberof workbox-build
2930
*/

packages/workbox-build/src/inject-manifest.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ import {validateInjectManifestOptions} from './lib/validate-options';
3535
* This method will not compile or bundle your `swSrc` file; it just handles
3636
* injecting the manifest.
3737
*
38-
* @example
38+
* ```
3939
* // The following lists some common options; see the rest of the documentation
4040
* // for the full set of options and defaults.
4141
* const {count, size, warnings} = await injectManifest({
@@ -46,6 +46,7 @@ import {validateInjectManifestOptions} from './lib/validate-options';
4646
* swDest: '...',
4747
* swSrc: '...',
4848
* });
49+
* ```
4950
*
5051
* @memberof workbox-build
5152
*/

packages/workbox-build/src/lib/copy-workbox-libraries.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ const BUILD_DIR = 'build';
2626
* Workbox from its official CDN URL.
2727
*
2828
* This method is exposed for the benefit of developers using
29-
* [injectManifest()]{@link workbox-build.injectManifest} who would
29+
* {@link workbox-build.injectManifest} who would
3030
* prefer not to use the CDN copies of Workbox. Developers using
31-
* [generateSW()]{@link workbox-build.generateSW} don't need to
31+
* {@link workbox-build.generateSW} don't need to
3232
* explicitly call this method.
3333
*
3434
* @param {string} destDirectory The path to the parent directory under which

packages/workbox-build/src/lib/transform-manifest.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import {noRevisionForURLsMatchingTransform} from './no-revision-for-urls-matchin
2121
/**
2222
* A `ManifestTransform` function can be used to modify the modify the `url` or
2323
* `revision` properties of some or all of the
24-
* {@link workbox-build.ManifestEntry|ManifestEntries} in the manifest.
24+
* {@link workbox-build.ManifestEntry} in the manifest.
2525
*
2626
* Deleting the `revision` property of an entry will cause
2727
* the corresponding `url` to be precached without cache-busting parameters

packages/workbox-cacheable-response/src/index.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,16 @@
66
https://opensource.org/licenses/MIT.
77
*/
88

9-
import {CacheableResponse} from './CacheableResponse.js';
9+
import {
10+
CacheableResponse,
11+
CacheableResponseOptions,
12+
} from './CacheableResponse.js';
1013
import {CacheableResponsePlugin} from './CacheableResponsePlugin.js';
14+
1115
import './_version.js';
1216

1317
/**
1418
* @module workbox-cacheable-response
1519
*/
1620

17-
export {CacheableResponse, CacheableResponsePlugin};
21+
export {CacheableResponse, CacheableResponseOptions, CacheableResponsePlugin};

packages/workbox-expiration/src/index.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,12 @@
77
*/
88

99
import {CacheExpiration} from './CacheExpiration.js';
10-
import {ExpirationPlugin} from './ExpirationPlugin.js';
10+
import {ExpirationPlugin, ExpirationPluginOptions} from './ExpirationPlugin.js';
11+
1112
import './_version.js';
1213

1314
/**
1415
* @module workbox-expiration
1516
*/
1617

17-
export {CacheExpiration, ExpirationPlugin};
18+
export {CacheExpiration, ExpirationPlugin, ExpirationPluginOptions};

packages/workbox-google-analytics/src/index.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,12 @@
66
https://opensource.org/licenses/MIT.
77
*/
88

9-
import {initialize} from './initialize.js';
9+
import {initialize, GoogleAnalyticsInitializeOptions} from './initialize.js';
10+
1011
import './_version.js';
1112

1213
/**
1314
* @module workbox-google-analytics
1415
*/
1516

16-
export {initialize};
17+
export {initialize, GoogleAnalyticsInitializeOptions};

packages/workbox-recipes/src/index.ts

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,15 @@
66
https://opensource.org/licenses/MIT.
77
*/
88

9-
import {googleFontsCache} from './googleFontsCache';
10-
import {imageCache} from './imageCache';
11-
import {staticResourceCache} from './staticResourceCache';
12-
import {pageCache} from './pageCache';
13-
import {offlineFallback} from './offlineFallback';
14-
import {warmStrategyCache} from './warmStrategyCache';
9+
import {googleFontsCache, GoogleFontCacheOptions} from './googleFontsCache';
10+
import {imageCache, ImageCacheOptions} from './imageCache';
11+
import {
12+
staticResourceCache,
13+
StaticResourceOptions,
14+
} from './staticResourceCache';
15+
import {pageCache, PageCacheOptions} from './pageCache';
16+
import {offlineFallback, OfflineFallbackOptions} from './offlineFallback';
17+
import {warmStrategyCache, WarmStrategyCacheOptions} from './warmStrategyCache';
1518

1619
import './_version.js';
1720

@@ -20,10 +23,16 @@ import './_version.js';
2023
*/
2124

2225
export {
26+
GoogleFontCacheOptions,
2327
googleFontsCache,
2428
imageCache,
25-
staticResourceCache,
26-
pageCache,
29+
ImageCacheOptions,
2730
offlineFallback,
31+
OfflineFallbackOptions,
32+
pageCache,
33+
PageCacheOptions,
34+
staticResourceCache,
35+
StaticResourceOptions,
2836
warmStrategyCache,
37+
WarmStrategyCacheOptions,
2938
};

packages/workbox-recipes/src/pageCache.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import {
1717

1818
import './_version.js';
1919

20-
export interface ImageCacheOptions {
20+
export interface PageCacheOptions {
2121
cacheName?: string;
2222
matchCallback?: RouteMatchCallback;
2323
networkTimeoutSeconds?: number;
@@ -37,7 +37,7 @@ export interface ImageCacheOptions {
3737
* @param {WorkboxPlugin[]} [options.plugins] Additional plugins to use for this recipe
3838
* @param {string[]} [options.warmCache] Paths to call to use to warm this cache
3939
*/
40-
function pageCache(options: ImageCacheOptions = {}): void {
40+
function pageCache(options: PageCacheOptions = {}): void {
4141
const defaultMatchCallback = ({request}: RouteMatchCallbackOptions) =>
4242
request.mode === 'navigate';
4343

packages/workbox-routing/src/RegExpRoute.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,6 @@ import './_version.js';
2727
* requests against third-party servers, you must define a RegExp that matches
2828
* the start of the URL.
2929
*
30-
* [See the module docs for info.]{@link https://developers.google.com/web/tools/workbox/modules/workbox-routing}
31-
*
3230
* @memberof workbox-routing
3331
* @extends workbox-routing.Route
3432
*/

packages/workbox-routing/src/index.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,10 @@
66
https://opensource.org/licenses/MIT.
77
*/
88

9-
import {NavigationRoute} from './NavigationRoute.js';
9+
import {
10+
NavigationRoute,
11+
NavigationRouteMatchOptions,
12+
} from './NavigationRoute.js';
1013
import {RegExpRoute} from './RegExpRoute.js';
1114
import {registerRoute} from './registerRoute.js';
1215
import {Route} from './Route.js';
@@ -28,4 +31,5 @@ export {
2831
Router,
2932
setCatchHandler,
3033
setDefaultHandler,
34+
NavigationRouteMatchOptions,
3135
};

packages/workbox-routing/src/registerRoute.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,7 @@ import './_version.js';
3131
* is required if `capture` is not a `Route` object.
3232
* @param {string} [method='GET'] The HTTP method to match the Route
3333
* against.
34-
* @return {workbox-routing.Route} The generated `Route`(Useful for
35-
* unregistering).
34+
* @return {workbox-routing.Route} The generated `Route`.
3635
*
3736
* @memberof workbox-routing
3837
*/

packages/workbox-strategies/src/CacheFirst.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import {messages} from './utils/messages.js';
1616
import './_version.js';
1717

1818
/**
19-
* An implementation of a [cache-first]{@link https://developers.google.com/web/fundamentals/instant-and-offline/offline-cookbook/#cache-falling-back-to-network}
19+
* An implementation of a [cache-first](https://developer.chrome.com/docs/workbox/caching-strategies-overview/#cache-first-falling-back-to-network)
2020
* request strategy.
2121
*
2222
* A cache first strategy is useful for assets that have been revisioned,

packages/workbox-strategies/src/CacheOnly.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,11 @@ import {messages} from './utils/messages.js';
1616
import './_version.js';
1717

1818
/**
19-
* An implementation of a
20-
* [cache-only]{@link https://developers.google.com/web/fundamentals/instant-and-offline/offline-cookbook/#cache-only}
19+
* An implementation of a [cache-only](https://developer.chrome.com/docs/workbox/caching-strategies-overview/#cache-only)
2120
* request strategy.
2221
*
2322
* This class is useful if you want to take advantage of any
24-
* [Workbox plugins]{@link https://developers.google.com/web/tools/workbox/guides/using-plugins}.
23+
* [Workbox plugins](https://developer.chrome.com/docs/workbox/using-plugins/).
2524
*
2625
* If there is no cache match, this will throw a `WorkboxError` exception.
2726
*

packages/workbox-strategies/src/NetworkFirst.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,13 @@ export interface NetworkFirstOptions extends StrategyOptions {
2222

2323
/**
2424
* An implementation of a
25-
* [network first]{@link https://developers.google.com/web/fundamentals/instant-and-offline/offline-cookbook/#network-falling-back-to-cache}
25+
* [network first](https://developer.chrome.com/docs/workbox/caching-strategies-overview/#network-first-falling-back-to-cache)
2626
* request strategy.
2727
*
2828
* By default, this strategy will cache responses with a 200 status code as
29-
* well as [opaque responses]{@link https://developers.google.com/web/tools/workbox/guides/handle-third-party-requests}.
29+
* well as [opaque responses](https://developer.chrome.com/docs/workbox/caching-resources-during-runtime/#opaque-responses).
3030
* Opaque responses are are cross-origin requests where the response doesn't
31-
* support [CORS]{@link https://enable-cors.org/}.
31+
* support [CORS](https://enable-cors.org/).
3232
*
3333
* If the network request fails, and there is no cache match, this will throw
3434
* a `WorkboxError` exception.

packages/workbox-strategies/src/NetworkOnly.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,11 @@ interface NetworkOnlyOptions
2323

2424
/**
2525
* An implementation of a
26-
* [network-only]{@link https://developers.google.com/web/fundamentals/instant-and-offline/offline-cookbook/#network-only}
26+
* [network-only](https://developer.chrome.com/docs/workbox/caching-strategies-overview/#network-only)
2727
* request strategy.
2828
*
2929
* This class is useful if you want to take advantage of any
30-
* [Workbox plugins]{@link https://developers.google.com/web/tools/workbox/guides/using-plugins}.
30+
* [Workbox plugins](https://developer.chrome.com/docs/workbox/using-plugins/).
3131
*
3232
* If the network request fails, this will throw a `WorkboxError` exception.
3333
*

packages/workbox-strategies/src/StaleWhileRevalidate.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import './_version.js';
1818

1919
/**
2020
* An implementation of a
21-
* [stale-while-revalidate]{@link https://developers.google.com/web/fundamentals/instant-and-offline/offline-cookbook/#stale-while-revalidate}
21+
* [stale-while-revalidate](https://developer.chrome.com/docs/workbox/reference/workbox-strategies/#type-StaleWhileRevalidate)
2222
* request strategy.
2323
*
2424
* Resources are requested from both the cache and the network in parallel.
@@ -27,9 +27,9 @@ import './_version.js';
2727
* with each successful request.
2828
*
2929
* By default, this strategy will cache responses with a 200 status code as
30-
* well as [opaque responses]{@link https://developers.google.com/web/tools/workbox/guides/handle-third-party-requests}.
30+
* well as [opaque responses](https://developer.chrome.com/docs/workbox/caching-resources-during-runtime/#opaque-responses).
3131
* Opaque responses are cross-origin requests where the response doesn't
32-
* support [CORS]{@link https://enable-cors.org/}.
32+
* support [CORS](https://enable-cors.org/).
3333
*
3434
* If the network request fails, and there is no cache match, this will throw
3535
* a `WorkboxError` exception.

packages/workbox-streams/src/index.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,20 @@
99
import {concatenate} from './concatenate.js';
1010
import {concatenateToResponse} from './concatenateToResponse.js';
1111
import {isSupported} from './isSupported.js';
12-
import {strategy} from './strategy.js';
12+
import {strategy, StreamsHandlerCallback} from './strategy.js';
13+
1314
import './_version.js';
1415

1516
/**
1617
* @module workbox-streams
1718
*/
1819

19-
export {concatenate, concatenateToResponse, isSupported, strategy};
20+
export {
21+
concatenate,
22+
concatenateToResponse,
23+
isSupported,
24+
strategy,
25+
StreamsHandlerCallback,
26+
};
2027

2128
export * from './_types.js';

packages/workbox-streams/src/strategy.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import {isSupported} from './isSupported.js';
1717
import {StreamSource} from './_types.js';
1818
import './_version.js';
1919

20-
interface StreamsHandlerCallback {
20+
export interface StreamsHandlerCallback {
2121
({url, request, event, params}: RouteHandlerCallbackOptions):
2222
| Promise<StreamSource>
2323
| StreamSource;

packages/workbox-webpack-plugin/src/generate-sw.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ const {RawSource} = webpack.sources || require('webpack-sources');
2424
// See https://github.com/GoogleChrome/workbox/issues/2181
2525
const _generatedAssetNames = new Set<string>();
2626

27-
interface GenerateSWConfig extends WebpackGenerateSWOptions {
27+
export interface GenerateSWConfig extends WebpackGenerateSWOptions {
2828
manifestEntries?: Array<ManifestEntry>;
2929
}
3030

@@ -36,7 +36,7 @@ interface GenerateSWConfig extends WebpackGenerateSWOptions {
3636
* [`plugins` array](https://webpack.js.org/concepts/plugins/#usage) of a
3737
* webpack config.
3838
*
39-
* @example
39+
* ```
4040
* // The following lists some common options; see the rest of the documentation
4141
* // for the full set of options and defaults.
4242
* new GenerateSW({
@@ -64,6 +64,7 @@ interface GenerateSWConfig extends WebpackGenerateSWOptions {
6464
* }],
6565
* skipWaiting: ...,
6666
* });
67+
* ```
6768
*
6869
* @memberof module:workbox-webpack-plugin
6970
*/

0 commit comments

Comments
 (0)