@serwist/next 10.0.0-preview.2 → 10.0.0-preview.4

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.
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AAIvC,OAAO,KAAK,EAAE,qBAAqB,EAAE,6BAA6B,EAAE,MAAM,gBAAgB,CAAC;AAC3F,OAAO,EAAE,6BAA6B,EAAE,MAAM,oBAAoB,CAAC;AAMnE;;;;GAIG;AACH,QAAA,MAAM,eAAe,GAAI,aAAa,qBAAqB,KAAG,CAAC,CAAC,UAAU,CAAC,EAAE,UAAU,KAAK,UAAU,CA8NrG,CAAC;AAEF,eAAe,eAAe,CAAC;AAC/B,OAAO,EAAE,6BAA6B,EAAE,CAAC;AACzC,YAAY,EAAE,qBAAqB,IAAI,aAAa,EAAE,6BAA6B,IAAI,qBAAqB,EAAE,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AAIvC,OAAO,KAAK,EAAE,qBAAqB,EAAE,6BAA6B,EAAE,MAAM,gBAAgB,CAAC;AAC3F,OAAO,EAAE,6BAA6B,EAAE,MAAM,oBAAoB,CAAC;AAMnE;;;;GAIG;AACH,QAAA,MAAM,eAAe,GAAI,aAAa,qBAAqB,KAAG,CAAC,CAAC,UAAU,CAAC,EAAE,UAAU,KAAK,UAAU,CA8NrG,CAAC;AAEF,eAAe,eAAe,CAAC;AAC/B,OAAO,EAAE,6BAA6B,EAAE,CAAC;AACzC,YAAY,EAAE,qBAAqB,IAAI,aAAa,EAAE,6BAA6B,IAAI,qBAAqB,EAAE,CAAC"}
package/dist/index.js CHANGED
@@ -3,8 +3,8 @@ import path from 'node:path';
3
3
  import { fileURLToPath } from 'node:url';
4
4
  import { InjectManifest } from '@serwist/webpack-plugin';
5
5
  import { ChildCompilationPlugin, relativeToOutputPath } from '@serwist/webpack-plugin/internal';
6
+ import { getFileHash } from '@serwist/utils/node';
6
7
  import { globSync } from 'glob';
7
- import crypto from 'node:crypto';
8
8
  import { createRequire } from 'node:module';
9
9
  import chalk from 'chalk';
10
10
  import { validationErrorMap, SerwistConfigError } from '@serwist/build/schema';
@@ -22,8 +22,6 @@ const findFirstTruthy = (arr, fn)=>{
22
22
  return undefined;
23
23
  };
24
24
 
25
- const getFileHash = (file)=>crypto.createHash("md5").update(fs.readFileSync(file)).digest("hex");
26
-
27
25
  const getContentHash = (file, isDev)=>{
28
26
  if (isDev) {
29
27
  return "development";
@@ -1 +1 @@
1
- {"version":3,"file":"get-content-hash.d.ts","sourceRoot":"","sources":["../../src/lib/get-content-hash.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAI9B,eAAO,MAAM,cAAc,GAAI,MAAM,EAAE,CAAC,oBAAoB,EAAE,OAAO,OAAO,WAK3E,CAAC"}
1
+ {"version":3,"file":"get-content-hash.d.ts","sourceRoot":"","sources":["../../src/lib/get-content-hash.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAG9B,eAAO,MAAM,cAAc,GAAI,MAAM,EAAE,CAAC,oBAAoB,EAAE,OAAO,OAAO,WAK3E,CAAC"}
@@ -1,6 +1,5 @@
1
1
  export { findFirstTruthy } from "./find-first-truthy.js";
2
2
  export { getContentHash } from "./get-content-hash.js";
3
- export { getFileHash } from "./get-file-hash.js";
4
3
  export { getPackageVersion } from "./get-package-version.js";
5
4
  export { loadTSConfig } from "./load-tsconfig.js";
6
5
  export * as logger from "./logger.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/lib/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,KAAK,MAAM,MAAM,aAAa,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/lib/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,KAAK,MAAM,MAAM,aAAa,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@serwist/next",
3
- "version": "10.0.0-preview.2",
3
+ "version": "10.0.0-preview.4",
4
4
  "type": "module",
5
5
  "description": "A module that integrates Serwist into your Next.js application.",
6
6
  "files": [
@@ -65,11 +65,11 @@
65
65
  "chalk": "5.4.1",
66
66
  "glob": "11.0.1",
67
67
  "zod": "3.24.3",
68
- "@serwist/build": "10.0.0-preview.2",
69
- "@serwist/utils": "10.0.0-preview.2",
70
- "@serwist/webpack-plugin": "10.0.0-preview.2",
71
- "@serwist/window": "10.0.0-preview.2",
72
- "serwist": "10.0.0-preview.2"
68
+ "@serwist/build": "10.0.0-preview.4",
69
+ "@serwist/utils": "10.0.0-preview.4",
70
+ "@serwist/webpack-plugin": "10.0.0-preview.4",
71
+ "@serwist/window": "10.0.0-preview.4",
72
+ "serwist": "10.0.0-preview.4"
73
73
  },
74
74
  "devDependencies": {
75
75
  "@types/node": "22.14.1",
@@ -80,7 +80,7 @@
80
80
  "type-fest": "4.40.0",
81
81
  "typescript": "5.8.3",
82
82
  "webpack": "5.99.6",
83
- "@serwist/configs": "10.0.0-preview.2"
83
+ "@serwist/configs": "10.0.0-preview.4"
84
84
  },
85
85
  "peerDependencies": {
86
86
  "next": ">=14.0.0",
package/src/index.ts CHANGED
@@ -3,11 +3,12 @@ import path from "node:path";
3
3
  import { fileURLToPath } from "node:url";
4
4
  import { InjectManifest } from "@serwist/webpack-plugin";
5
5
  import { ChildCompilationPlugin, relativeToOutputPath } from "@serwist/webpack-plugin/internal";
6
+ import { getFileHash } from "@serwist/utils/node";
6
7
  import { globSync } from "glob";
7
8
  import type { NextConfig } from "next";
8
9
  import type { Compilation, Configuration, default as Webpack } from "webpack";
9
10
  import type { ExcludeParams, SerwistNextOptions, SerwistNextOptionsKey } from "./internal-types.js";
10
- import { getContentHash, getFileHash, loadTSConfig, logger } from "./lib/index.js";
11
+ import { getContentHash, loadTSConfig, logger } from "./lib/index.js";
11
12
  import type { InjectManifestOptions, InjectManifestOptionsComplete } from "./lib/types.js";
12
13
  import { validateInjectManifestOptions } from "./lib/validator.js";
13
14
 
@@ -1,6 +1,5 @@
1
1
  import type fs from "node:fs";
2
-
3
- import { getFileHash } from "./get-file-hash.js";
2
+ import { getFileHash } from "@serwist/utils/node";
4
3
 
5
4
  export const getContentHash = (file: fs.PathOrFileDescriptor, isDev: boolean) => {
6
5
  if (isDev) {
package/src/lib/index.ts CHANGED
@@ -1,6 +1,5 @@
1
1
  export { findFirstTruthy } from "./find-first-truthy.js";
2
2
  export { getContentHash } from "./get-content-hash.js";
3
- export { getFileHash } from "./get-file-hash.js";
4
3
  export { getPackageVersion } from "./get-package-version.js";
5
4
  export { loadTSConfig } from "./load-tsconfig.js";
6
5
  export * as logger from "./logger.js";
@@ -1,3 +0,0 @@
1
- import fs from "node:fs";
2
- export declare const getFileHash: (file: fs.PathOrFileDescriptor) => string;
3
- //# sourceMappingURL=get-file-hash.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"get-file-hash.d.ts","sourceRoot":"","sources":["../../src/lib/get-file-hash.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,SAAS,CAAC;AAEzB,eAAO,MAAM,WAAW,GAAI,MAAM,EAAE,CAAC,oBAAoB,WAAyE,CAAC"}
package/dist/utils.d.ts DELETED
@@ -1,4 +0,0 @@
1
- import fs from "node:fs";
2
- export declare const getFileHash: (file: fs.PathOrFileDescriptor) => string;
3
- export declare const getContentHash: (file: fs.PathOrFileDescriptor, isDev: boolean) => string;
4
- //# sourceMappingURL=utils.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,SAAS,CAAC;AAEzB,eAAO,MAAM,WAAW,GAAI,MAAM,EAAE,CAAC,oBAAoB,WAAyE,CAAC;AAEnI,eAAO,MAAM,cAAc,GAAI,MAAM,EAAE,CAAC,oBAAoB,EAAE,OAAO,OAAO,WAK3E,CAAC"}
@@ -1,4 +0,0 @@
1
- import crypto from "node:crypto";
2
- import fs from "node:fs";
3
-
4
- export const getFileHash = (file: fs.PathOrFileDescriptor) => crypto.createHash("md5").update(fs.readFileSync(file)).digest("hex");
package/src/utils.ts DELETED
@@ -1,11 +0,0 @@
1
- import crypto from "node:crypto";
2
- import fs from "node:fs";
3
-
4
- export const getFileHash = (file: fs.PathOrFileDescriptor) => crypto.createHash("md5").update(fs.readFileSync(file)).digest("hex");
5
-
6
- export const getContentHash = (file: fs.PathOrFileDescriptor, isDev: boolean) => {
7
- if (isDev) {
8
- return "development";
9
- }
10
- return getFileHash(file).slice(0, 16);
11
- };