@serwist/next 8.4.0 → 8.4.2

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/dist/index.cjs CHANGED
@@ -750,7 +750,7 @@ const prefixedLog = (prefixType, ...message)=>{
750
750
  if (message.length === 0) {
751
751
  console[consoleMethod]("");
752
752
  } else {
753
- console[consoleMethod](" " + prefix, ...message);
753
+ console[consoleMethod](` ${prefix}`, ...message);
754
754
  }
755
755
  };
756
756
  const info = (...message)=>{
@@ -774,7 +774,7 @@ const withPWAInit = (pluginOptions)=>{
774
774
  config = nextConfig.webpack(config, options);
775
775
  }
776
776
  if (disable) {
777
- options.isServer && info("PWA support is disabled.");
777
+ options.isServer && info("Serwist is disabled.");
778
778
  return config;
779
779
  }
780
780
  if (!config.plugins) {
@@ -792,39 +792,41 @@ const withPWAInit = (pluginOptions)=>{
792
792
  }));
793
793
  const swEntryJs = path.join(__dirname$1, "sw-entry.js");
794
794
  const entry = config.entry;
795
- config.entry = ()=>entry().then((entries)=>{
796
- if (entries["main.js"] && !entries["main.js"].includes(swEntryJs)) {
797
- if (Array.isArray(entries["main.js"])) {
798
- entries["main.js"].unshift(swEntryJs);
799
- } else if (typeof entries["main.js"] === "string") {
800
- entries["main.js"] = [
801
- swEntryJs,
802
- entries["main.js"]
803
- ];
804
- }
795
+ config.entry = async ()=>{
796
+ const entries = await entry();
797
+ if (entries["main.js"] && !entries["main.js"].includes(swEntryJs)) {
798
+ if (Array.isArray(entries["main.js"])) {
799
+ entries["main.js"].unshift(swEntryJs);
800
+ } else if (typeof entries["main.js"] === "string") {
801
+ entries["main.js"] = [
802
+ swEntryJs,
803
+ entries["main.js"]
804
+ ];
805
805
  }
806
- if (entries["main-app"] && !entries["main-app"].includes(swEntryJs)) {
807
- if (Array.isArray(entries["main-app"])) {
808
- entries["main-app"].unshift(swEntryJs);
809
- } else if (typeof entries["main-app"] === "string") {
810
- entries["main-app"] = [
811
- swEntryJs,
812
- entries["main-app"]
813
- ];
814
- }
806
+ }
807
+ if (entries["main-app"] && !entries["main-app"].includes(swEntryJs)) {
808
+ if (Array.isArray(entries["main-app"])) {
809
+ entries["main-app"].unshift(swEntryJs);
810
+ } else if (typeof entries["main-app"] === "string") {
811
+ entries["main-app"] = [
812
+ swEntryJs,
813
+ entries["main-app"]
814
+ ];
815
815
  }
816
- return entries;
817
- });
816
+ }
817
+ return entries;
818
+ };
818
819
  if (!options.isServer) {
819
820
  if (!register) {
820
821
  info("Service worker won't be automatically registered as per the config, please call the following code in componentDidMount or useEffect:");
821
- info(` window.serwist.register()`);
822
+ info(" window.serwist.register()");
822
823
  if (!tsConfigJson?.compilerOptions?.types?.includes("@serwist/next/typings")) {
823
824
  info("You may also want to add @serwist/next/typings to compilerOptions.types in your tsconfig.json/jsconfig.json.");
824
825
  }
825
826
  }
826
827
  const { swSrc: providedSwSrc, swDest: providedSwDest, additionalPrecacheEntries, exclude = [], modifyURLPrefix = {}, manifestTransforms = [], ...otherBuildOptions } = buildOptions;
827
- let swSrc = providedSwSrc, swDest = providedSwDest;
828
+ let swSrc = providedSwSrc;
829
+ let swDest = providedSwDest;
828
830
  if (!path.isAbsolute(swSrc)) {
829
831
  swSrc = path.join(options.dir, swSrc);
830
832
  }
@@ -835,7 +837,7 @@ const withPWAInit = (pluginOptions)=>{
835
837
  const shouldBuildSWEntryWorker = cacheOnFrontEndNav;
836
838
  let swEntryPublicPath = undefined;
837
839
  if (shouldBuildSWEntryWorker) {
838
- const swEntryWorkerSrc = path.join(__dirname$1, `sw-entry-worker.js`);
840
+ const swEntryWorkerSrc = path.join(__dirname$1, "sw-entry-worker.js");
839
841
  const swEntryName = `swe-worker-${getContentHash(swEntryWorkerSrc, dev)}.js`;
840
842
  swEntryPublicPath = path.posix.join(basePath, swEntryName);
841
843
  const swEntryWorkerDest = path.join(destDir, swEntryName);
@@ -858,7 +860,7 @@ const withPWAInit = (pluginOptions)=>{
858
860
  ]
859
861
  }));
860
862
  // Precache files in public folder
861
- let resolvedManifestEntries = additionalPrecacheEntries ?? [];
863
+ let resolvedManifestEntries = additionalPrecacheEntries;
862
864
  if (!resolvedManifestEntries) {
863
865
  const swDestFileName = path.basename(swDest);
864
866
  resolvedManifestEntries = fg.sync([
package/dist/index.js CHANGED
@@ -745,7 +745,7 @@ const prefixedLog = (prefixType, ...message)=>{
745
745
  if (message.length === 0) {
746
746
  console[consoleMethod]("");
747
747
  } else {
748
- console[consoleMethod](" " + prefix, ...message);
748
+ console[consoleMethod](` ${prefix}`, ...message);
749
749
  }
750
750
  };
751
751
  const info = (...message)=>{
@@ -769,7 +769,7 @@ const withPWAInit = (pluginOptions)=>{
769
769
  config = nextConfig.webpack(config, options);
770
770
  }
771
771
  if (disable) {
772
- options.isServer && info("PWA support is disabled.");
772
+ options.isServer && info("Serwist is disabled.");
773
773
  return config;
774
774
  }
775
775
  if (!config.plugins) {
@@ -787,39 +787,41 @@ const withPWAInit = (pluginOptions)=>{
787
787
  }));
788
788
  const swEntryJs = path.join(__dirname, "sw-entry.js");
789
789
  const entry = config.entry;
790
- config.entry = ()=>entry().then((entries)=>{
791
- if (entries["main.js"] && !entries["main.js"].includes(swEntryJs)) {
792
- if (Array.isArray(entries["main.js"])) {
793
- entries["main.js"].unshift(swEntryJs);
794
- } else if (typeof entries["main.js"] === "string") {
795
- entries["main.js"] = [
796
- swEntryJs,
797
- entries["main.js"]
798
- ];
799
- }
790
+ config.entry = async ()=>{
791
+ const entries = await entry();
792
+ if (entries["main.js"] && !entries["main.js"].includes(swEntryJs)) {
793
+ if (Array.isArray(entries["main.js"])) {
794
+ entries["main.js"].unshift(swEntryJs);
795
+ } else if (typeof entries["main.js"] === "string") {
796
+ entries["main.js"] = [
797
+ swEntryJs,
798
+ entries["main.js"]
799
+ ];
800
800
  }
801
- if (entries["main-app"] && !entries["main-app"].includes(swEntryJs)) {
802
- if (Array.isArray(entries["main-app"])) {
803
- entries["main-app"].unshift(swEntryJs);
804
- } else if (typeof entries["main-app"] === "string") {
805
- entries["main-app"] = [
806
- swEntryJs,
807
- entries["main-app"]
808
- ];
809
- }
801
+ }
802
+ if (entries["main-app"] && !entries["main-app"].includes(swEntryJs)) {
803
+ if (Array.isArray(entries["main-app"])) {
804
+ entries["main-app"].unshift(swEntryJs);
805
+ } else if (typeof entries["main-app"] === "string") {
806
+ entries["main-app"] = [
807
+ swEntryJs,
808
+ entries["main-app"]
809
+ ];
810
810
  }
811
- return entries;
812
- });
811
+ }
812
+ return entries;
813
+ };
813
814
  if (!options.isServer) {
814
815
  if (!register) {
815
816
  info("Service worker won't be automatically registered as per the config, please call the following code in componentDidMount or useEffect:");
816
- info(` window.serwist.register()`);
817
+ info(" window.serwist.register()");
817
818
  if (!tsConfigJson?.compilerOptions?.types?.includes("@serwist/next/typings")) {
818
819
  info("You may also want to add @serwist/next/typings to compilerOptions.types in your tsconfig.json/jsconfig.json.");
819
820
  }
820
821
  }
821
822
  const { swSrc: providedSwSrc, swDest: providedSwDest, additionalPrecacheEntries, exclude = [], modifyURLPrefix = {}, manifestTransforms = [], ...otherBuildOptions } = buildOptions;
822
- let swSrc = providedSwSrc, swDest = providedSwDest;
823
+ let swSrc = providedSwSrc;
824
+ let swDest = providedSwDest;
823
825
  if (!path.isAbsolute(swSrc)) {
824
826
  swSrc = path.join(options.dir, swSrc);
825
827
  }
@@ -830,7 +832,7 @@ const withPWAInit = (pluginOptions)=>{
830
832
  const shouldBuildSWEntryWorker = cacheOnFrontEndNav;
831
833
  let swEntryPublicPath = undefined;
832
834
  if (shouldBuildSWEntryWorker) {
833
- const swEntryWorkerSrc = path.join(__dirname, `sw-entry-worker.js`);
835
+ const swEntryWorkerSrc = path.join(__dirname, "sw-entry-worker.js");
834
836
  const swEntryName = `swe-worker-${getContentHash(swEntryWorkerSrc, dev)}.js`;
835
837
  swEntryPublicPath = path.posix.join(basePath, swEntryName);
836
838
  const swEntryWorkerDest = path.join(destDir, swEntryName);
@@ -853,7 +855,7 @@ const withPWAInit = (pluginOptions)=>{
853
855
  ]
854
856
  }));
855
857
  // Precache files in public folder
856
- let resolvedManifestEntries = additionalPrecacheEntries ?? [];
858
+ let resolvedManifestEntries = additionalPrecacheEntries;
857
859
  if (!resolvedManifestEntries) {
858
860
  const swDestFileName = path.basename(swDest);
859
861
  resolvedManifestEntries = fg.sync([
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@serwist/next",
3
- "version": "8.4.0",
3
+ "version": "8.4.2",
4
4
  "type": "module",
5
5
  "description": "A module that integrates Serwist into your Next.js application.",
6
6
  "files": [
@@ -67,9 +67,9 @@
67
67
  "dependencies": {
68
68
  "clean-webpack-plugin": "4.0.0",
69
69
  "fast-glob": "3.3.2",
70
- "@serwist/build": "8.4.0",
71
- "@serwist/webpack-plugin": "8.4.0",
72
- "@serwist/window": "8.4.0"
70
+ "@serwist/build": "8.4.2",
71
+ "@serwist/webpack-plugin": "8.4.2",
72
+ "@serwist/window": "8.4.2"
73
73
  },
74
74
  "devDependencies": {
75
75
  "@types/node": "20.10.5",
@@ -81,7 +81,7 @@
81
81
  "type-fest": "4.8.3",
82
82
  "typescript": "5.4.0-dev.20231226",
83
83
  "webpack": "5.89.0",
84
- "@serwist/constants": "8.4.0"
84
+ "@serwist/constants": "8.4.2"
85
85
  },
86
86
  "peerDependencies": {
87
87
  "next": ">=14.0.0",
@@ -90,7 +90,7 @@
90
90
  "scripts": {
91
91
  "build": "rimraf dist && cross-env NODE_ENV=production rollup --config rollup.config.js",
92
92
  "dev": "rollup --config rollup.config.js --watch",
93
- "lint": "eslint src --ext ts,tsx,js,jsx,cjs,mjs",
93
+ "lint": "biome lint ./src",
94
94
  "typecheck": "tsc"
95
95
  }
96
96
  }