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

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.

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(validators): migrate to Zod

    • We now use Zod instead of AJV.

    • This allows us to further validate the values, as AJV didn't support validating functions, classes, and more.

    • Usually, you don't need to do anything. However, if you manipulate the log/error message to do something wicked, you may need to adapt to the new format:

      Received an invalid Serwist configuration: {
      "_errors": [
      "Received unrecognized keys: someInvalidKey"
      ],
      "additionalPrecacheEntries": {
      "_errors": [
      "Received invalid type: expected array, received string."
      ]
      }
      }

  • 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

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

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

Patch Changes

  • #56 905e827 Thanks @DuCanhGH! - fix(next): fixed invalid precache manifest being generated when basePath is set

    • This was caused by "/_next/../public" in modifyURLPrefix not being matched when basePath was set, since the URL was actually "${basePath}/_next/../public/**/*".
    • We now use manifestTransforms instead of modifyURLPrefix.
  • Updated dependencies []:

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

Package Rankings
Top 23.13% on Npmjs.org