serwist

A Swiss Army knife for service workers.

MIT License

Downloads
1.7M
Stars
667
Committers
81

Bot releases are visible (Hide)

serwist - @serwist/[email protected]

Published by github-actions[bot] 9 months ago

Patch Changes

serwist - @serwist/[email protected]

Published by github-actions[bot] 9 months ago

Patch Changes

serwist - @serwist/[email protected]

Published by github-actions[bot] 9 months ago

Patch Changes

serwist - @serwist/[email protected]

Published by github-actions[bot] 9 months ago

Patch Changes

serwist - @serwist/[email protected]

Published by github-actions[bot] 9 months ago

Patch Changes

serwist - @serwist/[email protected]

Published by github-actions[bot] 9 months ago

Major Changes

  • 30e4c25 Thanks @DuCanhGH! - chore(peerDeps): bump minimum supported TypeScript and Node.js version

    • From now, we only support TypeScript versions later than 5.0.0 and Node.js ones later than 18.0.0.
    • To migrate, simply update these tools.
    # Change to your preferred way of updating Node.js
    nvm use 18
    # Change to your package manager
    npm i -D typescript@5
    
  • defdd5a Thanks @DuCanhGH! - refactor(js): migrate to ESM-only

    • Serwist is now an ESM-only project.

    • This was done because our tooling around supporting CJS had always been crappy: it was slow, had no way of supporting emitting .d.cts (we used to copy .d.ts to .d.cts), and was too error-prone (there were various issues of our builds crashing due to an ESM-only package slipping in).

    • If you already use ESM, there's nothing to be done. Great! Otherwise, to migrate:

      • Migrate to ESM if possible.

      • Otherwise, use dynamic imports. For example, to migrate to the new @serwist/next:

        • Old:
        // @ts-check
        const withSerwist = require("@serwist/next").default({
          cacheOnFrontEndNav: true,
          swSrc: "app/sw.ts",
          swDest: "public/sw.js",
        });
        /** @type {import("next").NextConfig} */
        const nextConfig = {
          reactStrictMode: true,
        };
        
        module.exports = withSerwist(nextConfig);
        
        • New:
        // @ts-check
        /** @type {import("next").NextConfig} */
        const nextConfig = {
          reactStrictMode: true,
        };
        
        module.exports = async () => {
          const withSerwist = (await import("@serwist/next")).default({
            cacheOnFrontEndNav: true,
            swSrc: "app/sw.ts",
            swDest: "public/sw.js",
          });
          return withSerwist(nextConfig);
        };
        
    • I know that most of our current userbase use Next.js, which still suggests using a CJS config file, so I am really sorry for the trouble I have caused for you :( However, what needs to be done has to be done. It was time to migrate and get rid of old, legacy things.

Patch Changes

serwist - @serwist/[email protected]

Published by github-actions[bot] 9 months ago

Major Changes

  • defdd5a Thanks @DuCanhGH! - refactor(js): migrate to ESM-only

    • Serwist is now an ESM-only project.

    • This was done because our tooling around supporting CJS had always been crappy: it was slow, had no way of supporting emitting .d.cts (we used to copy .d.ts to .d.cts), and was too error-prone (there were various issues of our builds crashing due to an ESM-only package slipping in).

    • If you already use ESM, there's nothing to be done. Great! Otherwise, to migrate:

      • Migrate to ESM if possible.

      • Otherwise, use dynamic imports. For example, to migrate to the new @serwist/next:

        • Old:
        // @ts-check
        const withSerwist = require("@serwist/next").default({
          cacheOnFrontEndNav: true,
          swSrc: "app/sw.ts",
          swDest: "public/sw.js",
        });
        /** @type {import("next").NextConfig} */
        const nextConfig = {
          reactStrictMode: true,
        };
        
        module.exports = withSerwist(nextConfig);
        
        • New:
        // @ts-check
        /** @type {import("next").NextConfig} */
        const nextConfig = {
          reactStrictMode: true,
        };
        
        module.exports = async () => {
          const withSerwist = (await import("@serwist/next")).default({
            cacheOnFrontEndNav: true,
            swSrc: "app/sw.ts",
            swDest: "public/sw.js",
          });
          return withSerwist(nextConfig);
        };
        
    • I know that most of our current userbase use Next.js, which still suggests using a CJS config file, so I am really sorry for the trouble I have caused for you :( However, what needs to be done has to be done. It was time to migrate and get rid of old, legacy things.

Patch Changes

serwist - @serwist/[email protected]

Published by github-actions[bot] 9 months ago

Major Changes

  • 30e4c25 Thanks @DuCanhGH! - chore(peerDeps): bump minimum supported TypeScript and Node.js version

    • From now, we only support TypeScript versions later than 5.0.0 and Node.js ones later than 18.0.0.
    • To migrate, simply update these tools.
    # Change to your preferred way of updating Node.js
    nvm use 18
    # Change to your package manager
    npm i -D typescript@5
    
  • defdd5a Thanks @DuCanhGH! - refactor(js): migrate to ESM-only

    • Serwist is now an ESM-only project.

    • This was done because our tooling around supporting CJS had always been crappy: it was slow, had no way of supporting emitting .d.cts (we used to copy .d.ts to .d.cts), and was too error-prone (there were various issues of our builds crashing due to an ESM-only package slipping in).

    • If you already use ESM, there's nothing to be done. Great! Otherwise, to migrate:

      • Migrate to ESM if possible.

      • Otherwise, use dynamic imports. For example, to migrate to the new @serwist/next:

        • Old:
        // @ts-check
        const withSerwist = require("@serwist/next").default({
          cacheOnFrontEndNav: true,
          swSrc: "app/sw.ts",
          swDest: "public/sw.js",
        });
        /** @type {import("next").NextConfig} */
        const nextConfig = {
          reactStrictMode: true,
        };
        
        module.exports = withSerwist(nextConfig);
        
        • New:
        // @ts-check
        /** @type {import("next").NextConfig} */
        const nextConfig = {
          reactStrictMode: true,
        };
        
        module.exports = async () => {
          const withSerwist = (await import("@serwist/next")).default({
            cacheOnFrontEndNav: true,
            swSrc: "app/sw.ts",
            swDest: "public/sw.js",
          });
          return withSerwist(nextConfig);
        };
        
    • I know that most of our current userbase use Next.js, which still suggests using a CJS config file, so I am really sorry for the trouble I have caused for you :( However, what needs to be done has to be done. It was time to migrate and get rid of old, legacy things.

Patch Changes

serwist - @serwist/[email protected]

Published by github-actions[bot] 9 months ago

Major Changes

  • 30e4c25 Thanks @DuCanhGH! - chore(peerDeps): bump minimum supported TypeScript and Node.js version

    • From now, we only support TypeScript versions later than 5.0.0 and Node.js ones later than 18.0.0.
    • To migrate, simply update these tools.
    # Change to your preferred way of updating Node.js
    nvm use 18
    # Change to your package manager
    npm i -D typescript@5
    
  • defdd5a Thanks @DuCanhGH! - refactor(js): migrate to ESM-only

    • Serwist is now an ESM-only project.

    • This was done because our tooling around supporting CJS had always been crappy: it was slow, had no way of supporting emitting .d.cts (we used to copy .d.ts to .d.cts), and was too error-prone (there were various issues of our builds crashing due to an ESM-only package slipping in).

    • If you already use ESM, there's nothing to be done. Great! Otherwise, to migrate:

      • Migrate to ESM if possible.

      • Otherwise, use dynamic imports. For example, to migrate to the new @serwist/next:

        • Old:
        // @ts-check
        const withSerwist = require("@serwist/next").default({
          cacheOnFrontEndNav: true,
          swSrc: "app/sw.ts",
          swDest: "public/sw.js",
        });
        /** @type {import("next").NextConfig} */
        const nextConfig = {
          reactStrictMode: true,
        };
        
        module.exports = withSerwist(nextConfig);
        
        • New:
        // @ts-check
        /** @type {import("next").NextConfig} */
        const nextConfig = {
          reactStrictMode: true,
        };
        
        module.exports = async () => {
          const withSerwist = (await import("@serwist/next")).default({
            cacheOnFrontEndNav: true,
            swSrc: "app/sw.ts",
            swDest: "public/sw.js",
          });
          return withSerwist(nextConfig);
        };
        
    • I know that most of our current userbase use Next.js, which still suggests using a CJS config file, so I am really sorry for the trouble I have caused for you :( However, what needs to be done has to be done. It was time to migrate and get rid of old, legacy things.

  • 30e4c25 Thanks @DuCanhGH! - fix(sw): disable runtimeCaching, fallbacks, and registerRuntimeCaching in development mode

    • In development mode, these features are now forcibly disabled. This is to prevent files from being accidentally served outdated.
    • If you want to override this, simply add the following:
    import { installSerwist } from "@serwist/sw";
    
    declare global {
      interface WorkerGlobalScope {
        __WB_FORCE_RUNTIME_CACHING: boolean;
      }
    }
    
    self.__WB_FORCE_RUNTIME_CACHING = true;
    
    installSerwist({
      runtimeCaching: [
        // ...
      ],
    });
    
  • 04d2619 Thanks @DuCanhGH! - refactor(sw): moved @serwist/build.RuntimeCaching to @serwist/sw

    • Since runtimeCaching is now a part of @serwist/sw rather than @serwist/build, it makes more sense to move the types there as well.
    • To migrate, simply update the imports.
      • Old:
      import type { StrategyName, RuntimeCaching } from "@serwist/build";
      
      • New:
      import type { StrategyName, RuntimeCaching } from "@serwist/sw";
      

Patch Changes

serwist - @serwist/[email protected]

Published by github-actions[bot] 9 months ago

Major Changes

  • defdd5a Thanks @DuCanhGH! - refactor(js): migrate to ESM-only

    • Serwist is now an ESM-only project.

    • This was done because our tooling around supporting CJS had always been crappy: it was slow, had no way of supporting emitting .d.cts (we used to copy .d.ts to .d.cts), and was too error-prone (there were various issues of our builds crashing due to an ESM-only package slipping in).

    • If you already use ESM, there's nothing to be done. Great! Otherwise, to migrate:

      • Migrate to ESM if possible.

      • Otherwise, use dynamic imports. For example, to migrate to the new @serwist/next:

        • Old:
        // @ts-check
        const withSerwist = require("@serwist/next").default({
          cacheOnFrontEndNav: true,
          swSrc: "app/sw.ts",
          swDest: "public/sw.js",
        });
        /** @type {import("next").NextConfig} */
        const nextConfig = {
          reactStrictMode: true,
        };
        
        module.exports = withSerwist(nextConfig);
        
        • New:
        // @ts-check
        /** @type {import("next").NextConfig} */
        const nextConfig = {
          reactStrictMode: true,
        };
        
        module.exports = async () => {
          const withSerwist = (await import("@serwist/next")).default({
            cacheOnFrontEndNav: true,
            swSrc: "app/sw.ts",
            swDest: "public/sw.js",
          });
          return withSerwist(nextConfig);
        };
        
    • I know that most of our current userbase use Next.js, which still suggests using a CJS config file, so I am really sorry for the trouble I have caused for you :( However, what needs to be done has to be done. It was time to migrate and get rid of old, legacy things.

Patch Changes

serwist - @serwist/[email protected]

Published by github-actions[bot] 9 months ago

Major Changes

  • defdd5a Thanks @DuCanhGH! - refactor(js): migrate to ESM-only

    • Serwist is now an ESM-only project.

    • This was done because our tooling around supporting CJS had always been crappy: it was slow, had no way of supporting emitting .d.cts (we used to copy .d.ts to .d.cts), and was too error-prone (there were various issues of our builds crashing due to an ESM-only package slipping in).

    • If you already use ESM, there's nothing to be done. Great! Otherwise, to migrate:

      • Migrate to ESM if possible.

      • Otherwise, use dynamic imports. For example, to migrate to the new @serwist/next:

        • Old:
        // @ts-check
        const withSerwist = require("@serwist/next").default({
          cacheOnFrontEndNav: true,
          swSrc: "app/sw.ts",
          swDest: "public/sw.js",
        });
        /** @type {import("next").NextConfig} */
        const nextConfig = {
          reactStrictMode: true,
        };
        
        module.exports = withSerwist(nextConfig);
        
        • New:
        // @ts-check
        /** @type {import("next").NextConfig} */
        const nextConfig = {
          reactStrictMode: true,
        };
        
        module.exports = async () => {
          const withSerwist = (await import("@serwist/next")).default({
            cacheOnFrontEndNav: true,
            swSrc: "app/sw.ts",
            swDest: "public/sw.js",
          });
          return withSerwist(nextConfig);
        };
        
    • I know that most of our current userbase use Next.js, which still suggests using a CJS config file, so I am really sorry for the trouble I have caused for you :( However, what needs to be done has to be done. It was time to migrate and get rid of old, legacy things.

Patch Changes

serwist - @serwist/[email protected]

Published by github-actions[bot] 9 months ago

Major Changes

  • 30e4c25 Thanks @DuCanhGH! - chore(peerDeps): bump minimum supported TypeScript and Node.js version

    • From now, we only support TypeScript versions later than 5.0.0 and Node.js ones later than 18.0.0.
    • To migrate, simply update these tools.
    # Change to your preferred way of updating Node.js
    nvm use 18
    # Change to your package manager
    npm i -D typescript@5
    
  • defdd5a Thanks @DuCanhGH! - refactor(js): migrate to ESM-only

    • Serwist is now an ESM-only project.

    • This was done because our tooling around supporting CJS had always been crappy: it was slow, had no way of supporting emitting .d.cts (we used to copy .d.ts to .d.cts), and was too error-prone (there were various issues of our builds crashing due to an ESM-only package slipping in).

    • If you already use ESM, there's nothing to be done. Great! Otherwise, to migrate:

      • Migrate to ESM if possible.

      • Otherwise, use dynamic imports. For example, to migrate to the new @serwist/next:

        • Old:
        // @ts-check
        const withSerwist = require("@serwist/next").default({
          cacheOnFrontEndNav: true,
          swSrc: "app/sw.ts",
          swDest: "public/sw.js",
        });
        /** @type {import("next").NextConfig} */
        const nextConfig = {
          reactStrictMode: true,
        };
        
        module.exports = withSerwist(nextConfig);
        
        • New:
        // @ts-check
        /** @type {import("next").NextConfig} */
        const nextConfig = {
          reactStrictMode: true,
        };
        
        module.exports = async () => {
          const withSerwist = (await import("@serwist/next")).default({
            cacheOnFrontEndNav: true,
            swSrc: "app/sw.ts",
            swDest: "public/sw.js",
          });
          return withSerwist(nextConfig);
        };
        
    • I know that most of our current userbase use Next.js, which still suggests using a CJS config file, so I am really sorry for the trouble I have caused for you :( However, what needs to be done has to be done. It was time to migrate and get rid of old, legacy things.

Patch Changes

serwist - @serwist/[email protected]

Published by github-actions[bot] 9 months ago

Major Changes

  • defdd5a Thanks @DuCanhGH! - refactor(js): migrate to ESM-only

    • Serwist is now an ESM-only project.

    • This was done because our tooling around supporting CJS had always been crappy: it was slow, had no way of supporting emitting .d.cts (we used to copy .d.ts to .d.cts), and was too error-prone (there were various issues of our builds crashing due to an ESM-only package slipping in).

    • If you already use ESM, there's nothing to be done. Great! Otherwise, to migrate:

      • Migrate to ESM if possible.

      • Otherwise, use dynamic imports. For example, to migrate to the new @serwist/next:

        • Old:
        // @ts-check
        const withSerwist = require("@serwist/next").default({
          cacheOnFrontEndNav: true,
          swSrc: "app/sw.ts",
          swDest: "public/sw.js",
        });
        /** @type {import("next").NextConfig} */
        const nextConfig = {
          reactStrictMode: true,
        };
        
        module.exports = withSerwist(nextConfig);
        
        • New:
        // @ts-check
        /** @type {import("next").NextConfig} */
        const nextConfig = {
          reactStrictMode: true,
        };
        
        module.exports = async () => {
          const withSerwist = (await import("@serwist/next")).default({
            cacheOnFrontEndNav: true,
            swSrc: "app/sw.ts",
            swDest: "public/sw.js",
          });
          return withSerwist(nextConfig);
        };
        
    • I know that most of our current userbase use Next.js, which still suggests using a CJS config file, so I am really sorry for the trouble I have caused for you :( However, what needs to be done has to be done. It was time to migrate and get rid of old, legacy things.

Patch Changes

serwist - @serwist/[email protected]

Published by github-actions[bot] 9 months ago

Major Changes

  • defdd5a Thanks @DuCanhGH! - refactor(js): migrate to ESM-only

    • Serwist is now an ESM-only project.

    • This was done because our tooling around supporting CJS had always been crappy: it was slow, had no way of supporting emitting .d.cts (we used to copy .d.ts to .d.cts), and was too error-prone (there were various issues of our builds crashing due to an ESM-only package slipping in).

    • If you already use ESM, there's nothing to be done. Great! Otherwise, to migrate:

      • Migrate to ESM if possible.

      • Otherwise, use dynamic imports. For example, to migrate to the new @serwist/next:

        • Old:
        // @ts-check
        const withSerwist = require("@serwist/next").default({
          cacheOnFrontEndNav: true,
          swSrc: "app/sw.ts",
          swDest: "public/sw.js",
        });
        /** @type {import("next").NextConfig} */
        const nextConfig = {
          reactStrictMode: true,
        };
        
        module.exports = withSerwist(nextConfig);
        
        • New:
        // @ts-check
        /** @type {import("next").NextConfig} */
        const nextConfig = {
          reactStrictMode: true,
        };
        
        module.exports = async () => {
          const withSerwist = (await import("@serwist/next")).default({
            cacheOnFrontEndNav: true,
            swSrc: "app/sw.ts",
            swDest: "public/sw.js",
          });
          return withSerwist(nextConfig);
        };
        
    • I know that most of our current userbase use Next.js, which still suggests using a CJS config file, so I am really sorry for the trouble I have caused for you :( However, what needs to be done has to be done. It was time to migrate and get rid of old, legacy things.

Patch Changes

serwist - @serwist/[email protected]

Published by github-actions[bot] 9 months ago

Major Changes

  • defdd5a Thanks @DuCanhGH! - refactor(js): migrate to ESM-only

    • Serwist is now an ESM-only project.

    • This was done because our tooling around supporting CJS had always been crappy: it was slow, had no way of supporting emitting .d.cts (we used to copy .d.ts to .d.cts), and was too error-prone (there were various issues of our builds crashing due to an ESM-only package slipping in).

    • If you already use ESM, there's nothing to be done. Great! Otherwise, to migrate:

      • Migrate to ESM if possible.

      • Otherwise, use dynamic imports. For example, to migrate to the new @serwist/next:

        • Old:
        // @ts-check
        const withSerwist = require("@serwist/next").default({
          cacheOnFrontEndNav: true,
          swSrc: "app/sw.ts",
          swDest: "public/sw.js",
        });
        /** @type {import("next").NextConfig} */
        const nextConfig = {
          reactStrictMode: true,
        };
        
        module.exports = withSerwist(nextConfig);
        
        • New:
        // @ts-check
        /** @type {import("next").NextConfig} */
        const nextConfig = {
          reactStrictMode: true,
        };
        
        module.exports = async () => {
          const withSerwist = (await import("@serwist/next")).default({
            cacheOnFrontEndNav: true,
            swSrc: "app/sw.ts",
            swDest: "public/sw.js",
          });
          return withSerwist(nextConfig);
        };
        
    • I know that most of our current userbase use Next.js, which still suggests using a CJS config file, so I am really sorry for the trouble I have caused for you :( However, what needs to be done has to be done. It was time to migrate and get rid of old, legacy things.

Patch Changes

serwist - @serwist/[email protected]

Published by github-actions[bot] 9 months ago

Major Changes

  • 30e4c25 Thanks @DuCanhGH! - chore(next): renamed /browser to /worker

    • This new name makes more sense than the old one, for these exports are actually for use in service workers.

    • To migrate, simply change all imports of @serwist/next/browser to those of @serwist/next/worker:

      • Old:
      import { defaultCache } from "@serwist/next/browser";
      
      installSerwist({
        // Other options
        runtimeCaching: defaultCache,
      });
      
      • New:
      import { defaultCache } from "@serwist/next/worker";
      
      installSerwist({
        // Other options
        runtimeCaching: defaultCache,
      });
      
  • 30e4c25 Thanks @DuCanhGH! - chore(peerDeps): bump minimum supported TypeScript and Node.js version

    • From now, we only support TypeScript versions later than 5.0.0 and Node.js ones later than 18.0.0.
    • To migrate, simply update these tools.
    # Change to your preferred way of updating Node.js
    nvm use 18
    # Change to your package manager
    npm i -D typescript@5
    
  • defdd5a Thanks @DuCanhGH! - refactor(js): migrate to ESM-only

    • Serwist is now an ESM-only project.

    • This was done because our tooling around supporting CJS had always been crappy: it was slow, had no way of supporting emitting .d.cts (we used to copy .d.ts to .d.cts), and was too error-prone (there were various issues of our builds crashing due to an ESM-only package slipping in).

    • If you already use ESM, there's nothing to be done. Great! Otherwise, to migrate:

      • Migrate to ESM if possible.

      • Otherwise, use dynamic imports. For example, to migrate to the new @serwist/next:

        • Old:
        // @ts-check
        const withSerwist = require("@serwist/next").default({
          cacheOnFrontEndNav: true,
          swSrc: "app/sw.ts",
          swDest: "public/sw.js",
        });
        /** @type {import("next").NextConfig} */
        const nextConfig = {
          reactStrictMode: true,
        };
        
        module.exports = withSerwist(nextConfig);
        
        • New:
        // @ts-check
        /** @type {import("next").NextConfig} */
        const nextConfig = {
          reactStrictMode: true,
        };
        
        module.exports = async () => {
          const withSerwist = (await import("@serwist/next")).default({
            cacheOnFrontEndNav: true,
            swSrc: "app/sw.ts",
            swDest: "public/sw.js",
          });
          return withSerwist(nextConfig);
        };
        
    • I know that most of our current userbase use Next.js, which still suggests using a CJS config file, so I am really sorry for the trouble I have caused for you :( However, what needs to be done has to be done. It was time to migrate and get rid of old, legacy things.

Minor Changes

  • 30e4c25 Thanks @DuCanhGH! - feat(next): added @serwist/next/worker.definePageRuntimeCaching

    • Due to the fact that App Router pages use RSC, we define 3 runtimeCaching entries in defaultCache, which are "pages-rsc-prefetch", "pages-rsc", and "pages". However, if an user were to extend this runtimeCaching array with their own pages entries, they would have to copy this from defaultCache, requiring them to inspect the source code. This method was added so that the user can conveniently do the same without the hassle.

Patch Changes

serwist - @serwist/[email protected]

Published by github-actions[bot] 9 months ago

Major Changes

  • 30e4c25 Thanks @DuCanhGH! - chore(peerDeps): bump minimum supported TypeScript and Node.js version

    • From now, we only support TypeScript versions later than 5.0.0 and Node.js ones later than 18.0.0.
    • To migrate, simply update these tools.
    # Change to your preferred way of updating Node.js
    nvm use 18
    # Change to your package manager
    npm i -D typescript@5
    
  • defdd5a Thanks @DuCanhGH! - refactor(js): migrate to ESM-only

    • Serwist is now an ESM-only project.

    • This was done because our tooling around supporting CJS had always been crappy: it was slow, had no way of supporting emitting .d.cts (we used to copy .d.ts to .d.cts), and was too error-prone (there were various issues of our builds crashing due to an ESM-only package slipping in).

    • If you already use ESM, there's nothing to be done. Great! Otherwise, to migrate:

      • Migrate to ESM if possible.

      • Otherwise, use dynamic imports. For example, to migrate to the new @serwist/next:

        • Old:
        // @ts-check
        const withSerwist = require("@serwist/next").default({
          cacheOnFrontEndNav: true,
          swSrc: "app/sw.ts",
          swDest: "public/sw.js",
        });
        /** @type {import("next").NextConfig} */
        const nextConfig = {
          reactStrictMode: true,
        };
        
        module.exports = withSerwist(nextConfig);
        
        • New:
        // @ts-check
        /** @type {import("next").NextConfig} */
        const nextConfig = {
          reactStrictMode: true,
        };
        
        module.exports = async () => {
          const withSerwist = (await import("@serwist/next")).default({
            cacheOnFrontEndNav: true,
            swSrc: "app/sw.ts",
            swDest: "public/sw.js",
          });
          return withSerwist(nextConfig);
        };
        
    • I know that most of our current userbase use Next.js, which still suggests using a CJS config file, so I am really sorry for the trouble I have caused for you :( However, what needs to be done has to be done. It was time to migrate and get rid of old, legacy things.

Patch Changes

serwist - @serwist/[email protected]

Published by github-actions[bot] 9 months ago

Major Changes

  • 30e4c25 Thanks @DuCanhGH! - chore(peerDeps): bump minimum supported TypeScript and Node.js version

    • From now, we only support TypeScript versions later than 5.0.0 and Node.js ones later than 18.0.0.
    • To migrate, simply update these tools.
    # Change to your preferred way of updating Node.js
    nvm use 18
    # Change to your package manager
    npm i -D typescript@5
    
  • defdd5a Thanks @DuCanhGH! - refactor(js): migrate to ESM-only

    • Serwist is now an ESM-only project.

    • This was done because our tooling around supporting CJS had always been crappy: it was slow, had no way of supporting emitting .d.cts (we used to copy .d.ts to .d.cts), and was too error-prone (there were various issues of our builds crashing due to an ESM-only package slipping in).

    • If you already use ESM, there's nothing to be done. Great! Otherwise, to migrate:

      • Migrate to ESM if possible.

      • Otherwise, use dynamic imports. For example, to migrate to the new @serwist/next:

        • Old:
        // @ts-check
        const withSerwist = require("@serwist/next").default({
          cacheOnFrontEndNav: true,
          swSrc: "app/sw.ts",
          swDest: "public/sw.js",
        });
        /** @type {import("next").NextConfig} */
        const nextConfig = {
          reactStrictMode: true,
        };
        
        module.exports = withSerwist(nextConfig);
        
        • New:
        // @ts-check
        /** @type {import("next").NextConfig} */
        const nextConfig = {
          reactStrictMode: true,
        };
        
        module.exports = async () => {
          const withSerwist = (await import("@serwist/next")).default({
            cacheOnFrontEndNav: true,
            swSrc: "app/sw.ts",
            swDest: "public/sw.js",
          });
          return withSerwist(nextConfig);
        };
        
    • I know that most of our current userbase use Next.js, which still suggests using a CJS config file, so I am really sorry for the trouble I have caused for you :( However, what needs to be done has to be done. It was time to migrate and get rid of old, legacy things.

Patch Changes

serwist - @serwist/[email protected]

Published by github-actions[bot] 9 months ago

Major Changes

  • defdd5a Thanks @DuCanhGH! - refactor(js): migrate to ESM-only

    • Serwist is now an ESM-only project.

    • This was done because our tooling around supporting CJS had always been crappy: it was slow, had no way of supporting emitting .d.cts (we used to copy .d.ts to .d.cts), and was too error-prone (there were various issues of our builds crashing due to an ESM-only package slipping in).

    • If you already use ESM, there's nothing to be done. Great! Otherwise, to migrate:

      • Migrate to ESM if possible.

      • Otherwise, use dynamic imports. For example, to migrate to the new @serwist/next:

        • Old:
        // @ts-check
        const withSerwist = require("@serwist/next").default({
          cacheOnFrontEndNav: true,
          swSrc: "app/sw.ts",
          swDest: "public/sw.js",
        });
        /** @type {import("next").NextConfig} */
        const nextConfig = {
          reactStrictMode: true,
        };
        
        module.exports = withSerwist(nextConfig);
        
        • New:
        // @ts-check
        /** @type {import("next").NextConfig} */
        const nextConfig = {
          reactStrictMode: true,
        };
        
        module.exports = async () => {
          const withSerwist = (await import("@serwist/next")).default({
            cacheOnFrontEndNav: true,
            swSrc: "app/sw.ts",
            swDest: "public/sw.js",
          });
          return withSerwist(nextConfig);
        };
        
    • I know that most of our current userbase use Next.js, which still suggests using a CJS config file, so I am really sorry for the trouble I have caused for you :( However, what needs to be done has to be done. It was time to migrate and get rid of old, legacy things.

Patch Changes

serwist - @serwist/[email protected]

Published by github-actions[bot] 9 months ago

Major Changes

  • defdd5a Thanks @DuCanhGH! - refactor(js): migrate to ESM-only

    • Serwist is now an ESM-only project.

    • This was done because our tooling around supporting CJS had always been crappy: it was slow, had no way of supporting emitting .d.cts (we used to copy .d.ts to .d.cts), and was too error-prone (there were various issues of our builds crashing due to an ESM-only package slipping in).

    • If you already use ESM, there's nothing to be done. Great! Otherwise, to migrate:

      • Migrate to ESM if possible.

      • Otherwise, use dynamic imports. For example, to migrate to the new @serwist/next:

        • Old:
        // @ts-check
        const withSerwist = require("@serwist/next").default({
          cacheOnFrontEndNav: true,
          swSrc: "app/sw.ts",
          swDest: "public/sw.js",
        });
        /** @type {import("next").NextConfig} */
        const nextConfig = {
          reactStrictMode: true,
        };
        
        module.exports = withSerwist(nextConfig);
        
        • New:
        // @ts-check
        /** @type {import("next").NextConfig} */
        const nextConfig = {
          reactStrictMode: true,
        };
        
        module.exports = async () => {
          const withSerwist = (await import("@serwist/next")).default({
            cacheOnFrontEndNav: true,
            swSrc: "app/sw.ts",
            swDest: "public/sw.js",
          });
          return withSerwist(nextConfig);
        };
        
    • I know that most of our current userbase use Next.js, which still suggests using a CJS config file, so I am really sorry for the trouble I have caused for you :( However, what needs to be done has to be done. It was time to migrate and get rid of old, legacy things.

Patch Changes

Package Rankings
Top 23.13% on Npmjs.org