@reykjavik/webtools 0.1.12 → 0.1.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -4,6 +4,12 @@
4
4
 
5
5
  - ... <!-- Add new lines here. -->
6
6
 
7
+ ## 0.1.13
8
+
9
+ _2024-03-06_
10
+
11
+ - feat: Add `@reykjavik/webtools/fixIcelandicLocale` polyfill module
12
+
7
13
  ## 0.1.12
8
14
 
9
15
  _2024-02-29_
@@ -218,14 +218,14 @@ export type CookieHubProviderProps = EitherObj<{
218
218
  * management script and sets up a React state object with the relevant user
219
219
  * consent flags.
220
220
  *
221
- * @see https://github.com/reykjavikcity/webtools/tree/v0.1##cookiehubprovider-component
221
+ * @see https://github.com/reykjavikcity/webtools/blob/v0.1/README.md#cookiehubprovider-component
222
222
  */
223
223
  export declare const CookieHubProvider: (props: CookieHubProviderProps) => React.JSX.Element;
224
224
  /**
225
225
  * Returns up-to-date cookie consent flags. For use in React components or hook
226
226
  * functions.
227
227
  *
228
- * @see https://github.com/reykjavikcity/webtools/tree/v0.1##usecookiehubconsent
228
+ * @see https://github.com/reykjavikcity/webtools/blob/v0.1/README.md#usecookiehubconsent
229
229
  */
230
230
  export declare const useCookieHubConsent: () => Partial<CookieHubContextState['consent']>;
231
231
  export {};
@@ -61,7 +61,7 @@ const moveCookiehubScriptInDomTree = () => {
61
61
  * management script and sets up a React state object with the relevant user
62
62
  * consent flags.
63
63
  *
64
- * @see https://github.com/reykjavikcity/webtools/tree/v0.1##cookiehubprovider-component
64
+ * @see https://github.com/reykjavikcity/webtools/blob/v0.1/README.md#cookiehubprovider-component
65
65
  */
66
66
  const CookieHubProvider = (props) => {
67
67
  const [state, setState] = (0, react_1.useState)(initialConsentState);
@@ -134,7 +134,7 @@ exports.CookieHubProvider = CookieHubProvider;
134
134
  * Returns up-to-date cookie consent flags. For use in React components or hook
135
135
  * functions.
136
136
  *
137
- * @see https://github.com/reykjavikcity/webtools/tree/v0.1##usecookiehubconsent
137
+ * @see https://github.com/reykjavikcity/webtools/blob/v0.1/README.md#usecookiehubconsent
138
138
  */
139
139
  const useCookieHubConsent = () => { var _a; return ((_a = (0, react_1.useContext)(CookieHubContext)) === null || _a === void 0 ? void 0 : _a.consent) || {}; };
140
140
  exports.useCookieHubConsent = useCookieHubConsent;
package/README.md CHANGED
@@ -12,7 +12,7 @@ yarn add @reykjavik/webtools
12
12
  bun add @reykjavik/webtools
13
13
  ```
14
14
 
15
- **Table of Contents:**
15
+ **Contents:**
16
16
 
17
17
  <!-- prettier-ignore-start -->
18
18
 
@@ -22,27 +22,22 @@ bun add @reykjavik/webtools
22
22
  - [`cacheControl` helper](#cachecontrol-helper)
23
23
  - [Type `TTLConfig`](#type-ttlconfig)
24
24
  - [`toSec` TTL helper](#tosec-ttl-helper)
25
- - [`@reykjavik/webtools/next/http`](#reykjavikwebtoolsnexthttp)
26
- - [`makeErrorizeAppHOC`](#makeerrorizeapphoc)
27
- - [`showErrorPage` helper](#showerrorpage-helper)
28
- - [`notModified304` helper](#notmodified304-helper)
29
25
  - [`@reykjavik/webtools/CookieHubConsent`](#reykjavikwebtoolscookiehubconsent)
30
26
  - [`CookieHubProvider` component](#cookiehubprovider-component)
31
27
  - [`useCookieHubConsent`](#usecookiehubconsent)
32
- - [`@reykjavik/webtools/next/SiteImprove`](#reykjavikwebtoolsnextsiteimprove)
33
- - [`SiteImprove` component](#siteimprove-component)
34
- - [`pingSiteImprove` helper](#pingsiteimprove-helper)
35
- - [`pingSiteImproveOutbound` helper](#pingsiteimproveoutbound-helper)
36
28
  - [`@reykjavik/webtools/vanillaExtract`](#reykjavikwebtoolsvanillaextract)
37
29
  - [`vanillaGlobal`](#vanillaglobal)
38
30
  - [`vanillaProps`](#vanillaprops)
39
31
  - [`vanillaClass`](#vanillaclass)
40
32
  - [`vanillaClassNested`](#vanillaclassnested)
41
33
  - [`vanillaNest`](#vanillanest)
34
+ - [`@reykjavik/webtools/fixIcelandicLocale`](#reykjavikwebtoolsfixicelandiclocale)
35
+ - [Framework Specific Tools](#framework-specific-tools)
36
+ - [Next.js Tools](#nextjs-tools)
42
37
  - [Contributing](#contributing)
43
38
  - [Changelog](#changelog)
44
39
 
45
- <!-- prettier-ignore-start -->
40
+ <!-- prettier-ignore-end -->
46
41
 
47
42
  ---
48
43
 
@@ -184,165 +179,6 @@ const ttlSec = toSec(ttl);
184
179
 
185
180
  ---
186
181
 
187
- ## `@reykjavik/webtools/next/http`
188
-
189
- Contains HTTP helpers for Next.js projects
190
-
191
- Re-exports all of the base [http module](#reykjaviktoolshttp)'s exports, for
192
- convenience
193
-
194
- ### `makeErrorizeAppHOC`
195
-
196
- **Syntax:**
197
- `makeErrorizeAppHOC(ErrorPageComponent: ComponentType<EP>): (App: AppType<P>) => AppType<P | EP>`
198
-
199
- Hhigher-order component (HOC) factory for Next.js App compnents to handle
200
- cases when `getServerSideProps` returns an `__error` prop with `statusCode`
201
- and optional friendly `message`.
202
-
203
- Pass in an error-page compnent, and receive a HOC function that wraps any
204
- Next.js App compnent. The HOC also has a type-safe
205
- [`.showErrorPage`](#showerrorizedpage-helper) helper method to use inside
206
- `getServerSideProps` in order to trigger display of the error page.
207
-
208
- Set up the error page for your app:
209
-
210
- ```tsx
211
- // src/helpers/myerrors.js
212
-
213
- import {
214
- makeErrorizeAppHOC,
215
- ErrorProps,
216
- InferErrorPageProps,
217
- } from '@reykjavik/webtools/next/http';
218
-
219
- type MyErrorPageProps = ErrorProps & {
220
- /* ...custom props... */
221
- };
222
- const MyErrorPage = (props: MyErrorPageProps) => {
223
- const { statusCode, message /* plus your custom props */ } = props;
224
- return (
225
- <div>
226
- <h1>{statusCode}</h1>
227
- {message && <p>{message}</p>}
228
- </div>
229
- );
230
- };
231
-
232
- // Generate and export the HOC
233
- export const withMyErrorHandling = makeErrorizeAppHOC(MyErrorPage);
234
- // Export the gSSP helper
235
- export const showErrorPage = withMyErrorHandling.showErrorPage;
236
- // Export the props type of the error page
237
- export type ErrorPageProps = InferErrorPageProps<typeof showErrorPage>;
238
- ```
239
-
240
- Wrap `_app.tsx` with the HOC you generated:
241
-
242
- ```jsx
243
- // src/pages/_app.js
244
-
245
- import { withMyErrorHandling } from '~/helpers/myerrors';
246
-
247
- const App = ({ Component, pageProps }: AppProps<PageProps>) => {
248
- // ...define your App component as normal...
249
- };
250
-
251
- export default withMyErrorHandling(App);
252
- ```
253
-
254
- Return errors inside your page/route modules, using `showErrorPage`
255
-
256
- ```tsx
257
- // src/pages/index.js
258
-
259
- import type { GetServerSideProps } from 'next';
260
- import { showErrorPage, ErrorPageProps } from '~/helpers/errors';
261
-
262
- type MyPageProps = {};
263
- // Export the page component
264
- export default function MyPage(props: MyPageProps) {
265
- // ...
266
- }
267
-
268
- export const getServerSideProps: GetServerSideProps<
269
- MyPageProps | ErrorPageProps
270
- > = async (ctx) => {
271
- // ...fetch data from api
272
- if (!apiRes.error === 'unauthorized') {
273
- return showErrorPage(ctx.res, {
274
- statusCode: HTTP_400_BadRequest,
275
- // ...Add other custom MyErrorPage props
276
- });
277
- }
278
- // ...return normal, happy page props.
279
- };
280
- ```
281
-
282
- See more below
283
-
284
- ### `showErrorPage` helper
285
-
286
- **Syntax:**
287
- `showErrorPage = (response: ServerResponse | NextContext, error: HTTP_ERROR | ErrorProps, ttl?: TTL | TTLConfig): void`
288
-
289
- This method is attached to the HOC returned by
290
- [`makeErrorizeAppHOC`](#makeerrorizeapphoc). Use it inside your pages'
291
- `getServerSideProps` to return the appropriate an "error" props, including a
292
- HTTP `statusCode`, etc.
293
-
294
- ```js
295
- import { showErrorPage, ErrorPageProps } from '~/helpers/myerrors';
296
-
297
- // ...then, somewhere inside getServerSideProps
298
- if (invalidParams) {
299
- return showErrorPage(
300
- res,
301
- {
302
- statusCode: HTTP_400_BadRequest,
303
- message: 'You passed me bad params :-(', // optional message
304
- // ...Add other custom MyErrorPage props
305
- },
306
- 'permanent'
307
- );
308
- }
309
-
310
- if (!apiRes.error === 'unauthorized') {
311
- // Optional `statusCode` shorthand signature, available if your
312
- // error page has no required props (other than `statusCode`).
313
- return showErrorPage(res, HTTP_403_Forbidden);
314
- }
315
-
316
- // ...return normal, happy page props.
317
- ```
318
-
319
- The `ttl` parameter defaults to `'2s'`, but you can pass any
320
- [`TTLConfig`](#type-ttlconfig).
321
-
322
- ### `notModified304` helper
323
-
324
- **Syntax:** `notModified304(response: ServerResponse | NextContext): void`
325
-
326
- Use this method to inside a `getServerSideProps` method (or API route) to
327
- return a `HTTP_304_NotModified` response with an empty props object, in a way
328
- that doesn't make TypeScript shout at you.
329
-
330
- (Turns out that when a 304 status is returned, then Next.js doesn't even
331
- attempt to render the Page compnoent, so the returned props don't matter.
332
- TypeScript, however, doesn't know that.)
333
-
334
- ```js
335
- import { notModified304 } from '@reykjavik/webtools/next/http';
336
-
337
- // ...then, somewhere inside getServerSideProps
338
- const notModified = data.modifiedTimestamp === req.headers['if-none-match'];
339
- if (notModified) {
340
- return notModified304(res);
341
- }
342
- ```
343
-
344
- ---
345
-
346
182
  ## `@reykjavik/webtools/CookieHubConsent`
347
183
 
348
184
  Contains React helpers for loading CookieHub's consent manager and reading
@@ -416,98 +252,6 @@ this hook will return an empty object.
416
252
 
417
253
  ---
418
254
 
419
- ## `@reykjavik/webtools/next/SiteImprove`
420
-
421
- Contains React helpers for loading SiteImprove's analytics scripts in Next.js
422
- applications and perform custom event tracking.
423
-
424
- ### `SiteImprove` component
425
-
426
- A component for loading a SiteImprove analytics script and set up page-view
427
- tracking across Next.js routes.
428
-
429
- It also automatically logs all out-bound link clicks.
430
-
431
- Example usage in pages/\_app.tsx
432
-
433
- ```js
434
- import { SiteImprove } from '@reykjavik/webtools/next/SiteImprove';
435
-
436
- const siteImproveAccountId = '[ACCOUNT_ID]'; // e.g. "7654321"
437
-
438
- // Inside MyApp component
439
- <Component {...pageProps} />
440
- <SiteImprove
441
- accountId={siteImproveAccountId}
442
- onError={(error) =>
443
- Logger('error', 'An error occured initializing siteimprove', error)
444
- }
445
- />;
446
- ```
447
-
448
- The component has an optional `hasConsented` prop which can be used to
449
- forcefully suppress loading the analytics script.
450
-
451
- In dev mode it does NOT load the SiteImprove script and only logs page-view
452
- events to the console.
453
-
454
- **Props:**
455
-
456
- The Component's props have detailed JSDoc comments (displayed in your code
457
- editor), but there's a brief summary:
458
-
459
- - `accountId?: string` — Your SiteImprove account ID. (alternative to
460
- `scriptUrl` prop).
461
- - `scriptUrl?: string` — The full SiteImprove analytics script URL.
462
- (alternative to `accountId` prop).
463
- - `hasConstented?: boolean` — Manual GDPR 'analytics' consent flag. Allows
464
- hard opt-out, but defers to
465
- [`CookieHubProvider` values](#usecookiehubconsent) if they are available.
466
- - `onLoad?: (e: unknown) => void` — Fires when the script has loaded.
467
- - `onError?: (e: unknown) => void` — Fires if loading the script failed.
468
-
469
- ### `pingSiteImprove` helper
470
-
471
- **Syntax:**
472
- `pingSiteImprove(category: string, action: string, label?: string): void`
473
-
474
- A small helper for tracking custom UI events and reporting them to SiteImrove.
475
-
476
- It safely manages GDPR consent, so you can use it unconditionally.
477
-
478
- ```js
479
- import { pingSiteImprove } from '@reykjavik/webtools/next/SiteImprove';
480
-
481
- const handleSubmit = () => {
482
- // perform submit action...
483
- if (success) {
484
- pingSiteImprove('application', 'add_new');
485
- }
486
- };
487
- ```
488
-
489
- ### `pingSiteImproveOutbound` helper
490
-
491
- **Syntax:** `pingSiteImproveOutbound(ourl: string): void`
492
-
493
- A small helper for reporting to SiteImrove when the user is programmatically
494
- being sent to a different URL/resource.
495
-
496
- ```js
497
- import { pingSiteImproveOutbound } from '@reykjavik/webtools/next/SiteImprove';
498
-
499
- const handleSubmit = () => {
500
- // perform submit action...
501
- if (success) {
502
- const fileUrl = '/download/report.pdf';
503
- pingSiteImproveOutbound(fileUrl);
504
- document.location.href = fileUrl;
505
- }
506
- };
507
- ```
508
-
509
- ---
510
-
511
255
  ## `@reykjavik/webtools/vanillaExtract`
512
256
 
513
257
  Contains helpers for writing [vanilla-extract](https://vanilla-extract.style)
@@ -525,6 +269,7 @@ CSS.
525
269
  Inserts free-form CSS as a vanilla-extract `globalStyle`.
526
270
 
527
271
  ```ts
272
+ // someFile.css.ts
528
273
  import { vanillaGlobal } from '@reykjavik/webtools/vanillaExtract';
529
274
 
530
275
  vanillaGlobal(`
@@ -542,6 +287,7 @@ Spreads the return value into a style object, to inject free-form CSS
542
287
  properties (or nested blocks)
543
288
 
544
289
  ```ts
290
+ // someFile.css.ts
545
291
  import { style } from '@vanilla-extract/css';
546
292
  import { vanillaProps } from '@reykjavik/webtools/vanillaExtract';
547
293
 
@@ -567,6 +313,7 @@ Returns a scoped cssClassName styled with free-form CSS. This function is a
567
313
  thin wrapper around vanilla-extract's `style` function.
568
314
 
569
315
  ```ts
316
+ // someFile.css.ts
570
317
  import { vanillaClass } from '@reykjavik/webtools/vanillaExtract';
571
318
 
572
319
  export const myClass = vanillaClass(`
@@ -594,6 +341,7 @@ It also automatically replaces all `&`-tokens with the selector for the
594
341
  auto-generated class-name.
595
342
 
596
343
  ```ts
344
+ // someFile.css.ts
597
345
  import { vanillaClassNested } from '@reykjavik/webtools/vanillaExtract';
598
346
 
599
347
  export const myClass = vanillaClassNested(`
@@ -629,13 +377,18 @@ comments, etc. If you need something more sophisticated, use a custom
629
377
  Replaces all `&` tokens with the given selector string, in a direct (read.
630
378
  "dumb") way. It's mainly useful when used with style-mixins, etc.
631
379
 
632
- This low-level utility function is used internally by
633
- [`vanillaClassNested`](#vanillaclassnested).
380
+ `vanillaNest` does NOT support deeply nested blocks, or anything so fancy. It
381
+ will also replace `&` characters inside values, comments, etc. If you need
382
+ something more sophisticated, use a custom `postcss` config.
634
383
 
635
384
  ```ts
385
+ // someCssHelper.ts
636
386
  import { vanillaNest } from '@reykjavik/webtools/vanillaExtract';
637
387
 
638
- const hoverGlow = (ampSelector: string, glowiness?: 'normal' | 'insane') =>
388
+ export const hoverGlow = (
389
+ ampSelector: string,
390
+ glowiness?: 'normal' | 'insane'
391
+ ) =>
639
392
  vanillaNest(
640
393
  ampSelector,
641
394
  `
@@ -647,8 +400,9 @@ const hoverGlow = (ampSelector: string, glowiness?: 'normal' | 'insane') =>
647
400
  `
648
401
  );
649
402
 
650
- // ...then, somewhere else
403
+ // ...then, somewhere else in a *.css.ts file:
651
404
 
405
+ import { hoverGlow } from '~/someCssHelper.js';
652
406
  import { vanillaGlobal } from '@reykjavik/webtools/vanillaExtract';
653
407
 
654
408
  vanillaGlobal(`
@@ -666,9 +420,49 @@ vanillaGlobal(`
666
420
  `);
667
421
  ```
668
422
 
669
- **NOTE:** `vanillaNest` does NOT support deeply nested blocks, or anything so
670
- fancy. It will also replace `&` characters inside values, comments, etc. If
671
- you need something more sophisticated, use a custom `postcss` config.
423
+ (This low-level utility function is used internally by
424
+ [`vanillaClassNested`](#vanillaclassnested).)
425
+
426
+ ---
427
+
428
+ ## `@reykjavik/webtools/fixIcelandicLocale`
429
+
430
+ Polyfill for `String.prototype.localeCompare` to provide support for the
431
+ `'is'` locale in browsers that don't support it (\*cough* Chrome \*cough*).
432
+
433
+ At the top of your app's entry point, "side-effect import" this module to
434
+ apply the polyfill:
435
+
436
+ ```ts
437
+ import '@reykjavik/webtools/fixIcelandicLocale';
438
+
439
+ // Then continue with your day
440
+ // and use `localeCompare` as you normally would...
441
+ ```
442
+
443
+ **NOTE** The polyfill is only applied in engines that fail a simple feature
444
+ test.
445
+
446
+ ---
447
+
448
+ ## Framework Specific Tools
449
+
450
+ ---
451
+
452
+ <!-- #fragment anchors to not break older v0.1 @see links -->
453
+
454
+ <a name="reykjavikwebtoolsnexthttp"></a> <a name="makeerrorizeapphoc"></a>
455
+ <a name="showerrorpage-helper"></a> <a name="notmodified304-helper"></a>
456
+ <a name="reykjavikwebtoolsnextsiteimprove"></a>
457
+ <a name="siteimprove-component"></a> <a name="pingsiteimprove-helper"></a>
458
+ <a name="pingsiteimproveoutbound-helper"></a>
459
+
460
+ ### Next.js Tools
461
+
462
+ This package contains some helpers and components that are specifically
463
+ designed for use in [Next.js](https://nextjs.org/) projects.
464
+
465
+ See [README-nextjs.md](README-nextjs.md) for more info.
672
466
 
673
467
  ---
674
468
 
@@ -677,7 +471,7 @@ you need something more sophisticated, use a custom `postcss` config.
677
471
  This project uses the [Bun runtime](https://bun.sh) for development (tests,
678
472
  build, etc.)
679
473
 
680
- PRs are welcoms!
474
+ PRs are welcome!
681
475
 
682
476
  ---
683
477
 
@@ -685,11 +479,3 @@ PRs are welcoms!
685
479
 
686
480
  See
687
481
  [CHANGELOG.md](https://github.com/reykjavikcity/webtools/blob/main/CHANGELOG.md)
688
-
689
- ```
690
-
691
- ```
692
-
693
- ```
694
-
695
- ```
@@ -218,14 +218,14 @@ export type CookieHubProviderProps = EitherObj<{
218
218
  * management script and sets up a React state object with the relevant user
219
219
  * consent flags.
220
220
  *
221
- * @see https://github.com/reykjavikcity/webtools/tree/v0.1##cookiehubprovider-component
221
+ * @see https://github.com/reykjavikcity/webtools/blob/v0.1/README.md#cookiehubprovider-component
222
222
  */
223
223
  export declare const CookieHubProvider: (props: CookieHubProviderProps) => React.JSX.Element;
224
224
  /**
225
225
  * Returns up-to-date cookie consent flags. For use in React components or hook
226
226
  * functions.
227
227
  *
228
- * @see https://github.com/reykjavikcity/webtools/tree/v0.1##usecookiehubconsent
228
+ * @see https://github.com/reykjavikcity/webtools/blob/v0.1/README.md#usecookiehubconsent
229
229
  */
230
230
  export declare const useCookieHubConsent: () => Partial<CookieHubContextState['consent']>;
231
231
  export {};
@@ -35,7 +35,7 @@ const moveCookiehubScriptInDomTree = () => {
35
35
  * management script and sets up a React state object with the relevant user
36
36
  * consent flags.
37
37
  *
38
- * @see https://github.com/reykjavikcity/webtools/tree/v0.1##cookiehubprovider-component
38
+ * @see https://github.com/reykjavikcity/webtools/blob/v0.1/README.md#cookiehubprovider-component
39
39
  */
40
40
  export const CookieHubProvider = (props) => {
41
41
  const [state, setState] = useState(initialConsentState);
@@ -107,6 +107,6 @@ export const CookieHubProvider = (props) => {
107
107
  * Returns up-to-date cookie consent flags. For use in React components or hook
108
108
  * functions.
109
109
  *
110
- * @see https://github.com/reykjavikcity/webtools/tree/v0.1##usecookiehubconsent
110
+ * @see https://github.com/reykjavikcity/webtools/blob/v0.1/README.md#usecookiehubconsent
111
111
  */
112
112
  export const useCookieHubConsent = () => { var _a; return ((_a = useContext(CookieHubContext)) === null || _a === void 0 ? void 0 : _a.consent) || {}; };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,21 @@
1
+ const locAliases = {
2
+ // Danish is good enough substitution for Icelandic
3
+ is: 'da',
4
+ 'is-is': 'da',
5
+ };
6
+ const mapLocales = (locales) => {
7
+ locales = typeof locales === 'string' ? [locales] : locales || [];
8
+ return locales.map((loc) => locAliases[loc.toLowerCase()] || loc);
9
+ };
10
+ // ---------------------------------------------------------------------------
11
+ if ( /*#__PURE__*/'ö'.localeCompare('p', 'is') < 0) {
12
+ const _localeCompare = String.prototype.localeCompare;
13
+ /**
14
+ * Polyfill for String.prototype.localeCompare for the 'is' locale
15
+ * in browsers that don't support it (\*cough* Chrome \*cough*).
16
+ */
17
+ String.prototype.localeCompare = function (that, locales, options) {
18
+ return _localeCompare.call(this, that, mapLocales(locales), options);
19
+ };
20
+ }
21
+ export {};
package/esm/http.d.ts CHANGED
@@ -153,21 +153,21 @@ type TTLObj = {
153
153
  /**
154
154
  * Configures quick TTL-related settings for a HTTP request object
155
155
  *
156
- * @see https://github.com/reykjavikcity/webtools/tree/v0.1#type-ttlconfig
156
+ * @see https://github.com/reykjavikcity/webtools/blob/v0.1/README.md#type-ttlconfig
157
157
  */
158
158
  export type TTLConfig = TTL | TTLKeywords | TTLObj;
159
159
  /**
160
160
  * Converts a `TTL` (max-age) value into seconds, and returns `0` for bad
161
161
  * and/or negative input values.
162
162
  *
163
- * @see https://github.com/reykjavikcity/webtools/tree/v0.1#tosec-ttl-helper
163
+ * @see https://github.com/reykjavikcity/webtools/blob/v0.1/README.md#tosec-ttl-helper
164
164
  */
165
165
  export declare const toSec: (ttl: TTL) => number;
166
166
  /**
167
167
  * Use this function to quickly set the `Cache-Control` header with a `max-age=`
168
168
  * on a HTTP response
169
169
  *
170
- * @see https://github.com/reykjavikcity/webtools/tree/v0.1#getcssbundleurl
170
+ * @see https://github.com/reykjavikcity/webtools/blob/v0.1/README.md#getcssbundleurl
171
171
  */
172
172
  export declare const cacheControl: (response: ServerResponse | {
173
173
  res: ServerResponse;
package/esm/http.js CHANGED
@@ -136,7 +136,7 @@ const unitToSeconds = {
136
136
  * Converts a `TTL` (max-age) value into seconds, and returns `0` for bad
137
137
  * and/or negative input values.
138
138
  *
139
- * @see https://github.com/reykjavikcity/webtools/tree/v0.1#tosec-ttl-helper
139
+ * @see https://github.com/reykjavikcity/webtools/blob/v0.1/README.md#tosec-ttl-helper
140
140
  */
141
141
  export const toSec = (ttl) => {
142
142
  if (typeof ttl === 'string') {
@@ -168,7 +168,7 @@ const setCC = (response, cc) => {
168
168
  * Use this function to quickly set the `Cache-Control` header with a `max-age=`
169
169
  * on a HTTP response
170
170
  *
171
- * @see https://github.com/reykjavikcity/webtools/tree/v0.1#getcssbundleurl
171
+ * @see https://github.com/reykjavikcity/webtools/blob/v0.1/README.md#getcssbundleurl
172
172
  */
173
173
  // eslint-disable-next-line complexity
174
174
  export const cacheControl = (response, ttlCfg, eTag) => {
package/esm/index.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  /// <reference path="./vanillaExtract.d.ts" />
2
2
  /// <reference path="./http.d.ts" />
3
+ /// <reference path="./fixIcelandicLocale.d.ts" />
3
4
  /// <reference path="./CookieHubConsent.d.tsx" />
4
5
  /// <reference path="./next/SiteImprove.d.tsx" />
5
6
  /// <reference path="./next/http.d.tsx" />