@serwist/next 9.1.1 → 10.0.0-preview.10
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.d.ts.map +1 -1
- package/dist/index.js +1 -3
- package/dist/index.worker.d.ts.map +1 -1
- package/dist/index.worker.js +9 -12
- package/dist/lib/get-content-hash.d.ts.map +1 -1
- package/dist/lib/index.d.ts +0 -1
- package/dist/lib/index.d.ts.map +1 -1
- package/dist/lib/schema.d.ts +1 -1
- package/dist/lib/types.d.ts +4 -4
- package/dist/lib/types.d.ts.map +1 -1
- package/package.json +11 -9
- package/src/index.ts +2 -1
- package/src/index.worker.ts +18 -14
- package/src/lib/get-content-hash.ts +1 -2
- package/src/lib/index.ts +0 -1
- package/src/lib/types.ts +7 -6
- package/dist/lib/get-file-hash.d.ts +0 -3
- package/dist/lib/get-file-hash.d.ts.map +0 -1
- package/dist/utils.d.ts +0 -4
- package/dist/utils.d.ts.map +0 -1
- package/src/lib/get-file-hash.ts +0 -4
- package/src/utils.ts +0 -11
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
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
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import fs from 'node:fs';
|
|
2
2
|
import path from 'node:path';
|
|
3
3
|
import { fileURLToPath } from 'node:url';
|
|
4
|
+
import { getFileHash } from '@serwist/utils/node';
|
|
4
5
|
import { InjectManifest } from '@serwist/webpack-plugin';
|
|
5
6
|
import { ChildCompilationPlugin, relativeToOutputPath } from '@serwist/webpack-plugin/internal';
|
|
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":"index.worker.d.ts","sourceRoot":"","sources":["../src/index.worker.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAG9C,eAAO,MAAM,gBAAgB;;;;CAInB,CAAC;AAEX;;;;;GAKG;AACH,eAAO,MAAM,YAAY,EAAE,cAAc,
|
|
1
|
+
{"version":3,"file":"index.worker.d.ts","sourceRoot":"","sources":["../src/index.worker.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAG9C,eAAO,MAAM,gBAAgB;;;;CAInB,CAAC;AAEX;;;;;GAKG;AACH,eAAO,MAAM,YAAY,EAAE,cAAc,EAsQlC,CAAC"}
|
package/dist/index.worker.js
CHANGED
|
@@ -170,13 +170,15 @@ const defaultCache = process.env.NODE_ENV !== "production" ? [
|
|
|
170
170
|
})
|
|
171
171
|
},
|
|
172
172
|
{
|
|
173
|
-
matcher:
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
173
|
+
matcher: ({ sameOrigin, url: { pathname } })=>{
|
|
174
|
+
if (!sameOrigin || pathname.startsWith("/api/auth/callback")) {
|
|
175
|
+
return false;
|
|
176
|
+
}
|
|
177
|
+
if (pathname.startsWith("/api/")) {
|
|
178
|
+
return true;
|
|
179
|
+
}
|
|
180
|
+
return false;
|
|
181
|
+
},
|
|
180
182
|
method: "GET",
|
|
181
183
|
handler: new NetworkFirst({
|
|
182
184
|
cacheName: "apis",
|
|
@@ -250,11 +252,6 @@ const defaultCache = process.env.NODE_ENV !== "production" ? [
|
|
|
250
252
|
],
|
|
251
253
|
networkTimeoutSeconds: 10
|
|
252
254
|
})
|
|
253
|
-
},
|
|
254
|
-
{
|
|
255
|
-
matcher: /.*/i,
|
|
256
|
-
method: "GET",
|
|
257
|
-
handler: new NetworkOnly()
|
|
258
255
|
}
|
|
259
256
|
];
|
|
260
257
|
|
|
@@ -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;
|
|
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"}
|
package/dist/lib/index.d.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";
|
package/dist/lib/index.d.ts.map
CHANGED
|
@@ -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,
|
|
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/dist/lib/schema.d.ts
CHANGED
|
@@ -19,7 +19,7 @@ export declare const injectManifestOptions: z.ZodObject<{
|
|
|
19
19
|
swDest: z.ZodString;
|
|
20
20
|
compileSrc: z.ZodDefault<z.ZodBoolean>;
|
|
21
21
|
webpackCompilationPlugins: z.ZodOptional<z.ZodArray<z.ZodAny>>;
|
|
22
|
-
injectionPoint: z.
|
|
22
|
+
injectionPoint: z.ZodPrefault<z.ZodString>;
|
|
23
23
|
swSrc: z.ZodString;
|
|
24
24
|
chunks: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
25
25
|
exclude: z.ZodDefault<z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodCustom<RegExp, RegExp>, z.ZodPipe<z.ZodCustom<z.core.$InferInnerFunctionType<z.ZodTuple<[z.ZodAny], null>, z.ZodBoolean>, z.core.$InferInnerFunctionType<z.ZodTuple<[z.ZodAny], null>, z.ZodBoolean>>, z.ZodTransform<(args_0: any) => boolean, z.core.$InferInnerFunctionType<z.ZodTuple<[z.ZodAny], null>, z.ZodBoolean>>>]>>>;
|
package/dist/lib/types.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { RequiredSwDestPartial, RequiredSwDestResolved } from "@serwist/build";
|
|
2
|
-
import type { Require } from "@serwist/utils";
|
|
2
|
+
import type { Prettify, Require } from "@serwist/utils";
|
|
3
3
|
import type { InjectManifestOptions as WebpackInjectManifestOptions, InjectManifestOptionsComplete as WebpackInjectManifestOptionsComplete } from "@serwist/webpack-plugin";
|
|
4
4
|
export interface InjectPartial {
|
|
5
5
|
/**
|
|
@@ -89,7 +89,7 @@ export interface InjectPartial {
|
|
|
89
89
|
*/
|
|
90
90
|
globPublicPatterns?: string[];
|
|
91
91
|
}
|
|
92
|
-
export type InjectResolved = Require<InjectPartial, "cacheOnNavigation" | "disable" | "register" | "reloadOnOnline" | "swUrl" | "globPublicPatterns"
|
|
93
|
-
export type InjectManifestOptions = Omit<WebpackInjectManifestOptions & RequiredSwDestPartial & InjectPartial, "disablePrecacheManifest"
|
|
94
|
-
export type InjectManifestOptionsComplete = Omit<WebpackInjectManifestOptionsComplete & RequiredSwDestResolved & InjectResolved, "disablePrecacheManifest"
|
|
92
|
+
export type InjectResolved = Prettify<Require<InjectPartial, "cacheOnNavigation" | "disable" | "register" | "reloadOnOnline" | "swUrl" | "globPublicPatterns">>;
|
|
93
|
+
export type InjectManifestOptions = Prettify<Omit<WebpackInjectManifestOptions & RequiredSwDestPartial & InjectPartial, "disablePrecacheManifest">>;
|
|
94
|
+
export type InjectManifestOptionsComplete = Prettify<Omit<WebpackInjectManifestOptionsComplete & RequiredSwDestResolved & InjectResolved, "disablePrecacheManifest">>;
|
|
95
95
|
//# sourceMappingURL=types.d.ts.map
|
package/dist/lib/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/lib/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AACpF,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/lib/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AACpF,OAAO,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AACxD,OAAO,KAAK,EACV,qBAAqB,IAAI,4BAA4B,EACrD,6BAA6B,IAAI,oCAAoC,EACtE,MAAM,yBAAyB,CAAC;AAEjC,MAAM,WAAW,aAAa;IAC5B;;;;;OAKG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA8CG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;OAGG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB;;;;OAIG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;;;;;;OAQG;IACH,kBAAkB,CAAC,EAAE,MAAM,EAAE,CAAC;CAC/B;AAED,MAAM,MAAM,cAAc,GAAG,QAAQ,CACnC,OAAO,CAAC,aAAa,EAAE,mBAAmB,GAAG,SAAS,GAAG,UAAU,GAAG,gBAAgB,GAAG,OAAO,GAAG,oBAAoB,CAAC,CACzH,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG,QAAQ,CAAC,IAAI,CAAC,4BAA4B,GAAG,qBAAqB,GAAG,aAAa,EAAE,yBAAyB,CAAC,CAAC,CAAC;AAEpJ,MAAM,MAAM,6BAA6B,GAAG,QAAQ,CAClD,IAAI,CAAC,oCAAoC,GAAG,sBAAsB,GAAG,cAAc,EAAE,yBAAyB,CAAC,CAChH,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@serwist/next",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "10.0.0-preview.10",
|
|
4
4
|
"type": "module",
|
|
5
|
+
"sideEffects": false,
|
|
5
6
|
"description": "A module that integrates Serwist into your Next.js application.",
|
|
6
7
|
"files": [
|
|
7
8
|
"src",
|
|
@@ -21,7 +22,7 @@
|
|
|
21
22
|
"pwa"
|
|
22
23
|
],
|
|
23
24
|
"engines": {
|
|
24
|
-
"node": ">=
|
|
25
|
+
"node": ">=20.0.0"
|
|
25
26
|
},
|
|
26
27
|
"author": "Serwist <ducanh2912.rusty@gmail.com> (https://serwist.pages.dev/)",
|
|
27
28
|
"license": "MIT",
|
|
@@ -63,12 +64,13 @@
|
|
|
63
64
|
},
|
|
64
65
|
"dependencies": {
|
|
65
66
|
"chalk": "5.4.1",
|
|
66
|
-
"glob": "
|
|
67
|
+
"glob": "11.0.3",
|
|
67
68
|
"zod": "4.0.5",
|
|
68
|
-
"@serwist/build": "
|
|
69
|
-
"@serwist/
|
|
70
|
-
"@serwist/
|
|
71
|
-
"serwist": "
|
|
69
|
+
"@serwist/build": "10.0.0-preview.10",
|
|
70
|
+
"@serwist/utils": "10.0.0-preview.10",
|
|
71
|
+
"@serwist/webpack-plugin": "10.0.0-preview.10",
|
|
72
|
+
"@serwist/window": "10.0.0-preview.10",
|
|
73
|
+
"serwist": "10.0.0-preview.10"
|
|
72
74
|
},
|
|
73
75
|
"devDependencies": {
|
|
74
76
|
"@types/node": "24.0.14",
|
|
@@ -79,8 +81,7 @@
|
|
|
79
81
|
"type-fest": "4.41.0",
|
|
80
82
|
"typescript": "5.8.3",
|
|
81
83
|
"webpack": "5.100.2",
|
|
82
|
-
"@serwist/configs": "
|
|
83
|
-
"@serwist/utils": "9.1.1"
|
|
84
|
+
"@serwist/configs": "10.0.0-preview.10"
|
|
84
85
|
},
|
|
85
86
|
"peerDependencies": {
|
|
86
87
|
"next": ">=14.0.0",
|
|
@@ -95,6 +96,7 @@
|
|
|
95
96
|
"build": "rimraf dist && NODE_ENV=production rollup --config rollup.config.js",
|
|
96
97
|
"dev": "rollup --config rollup.config.js --watch",
|
|
97
98
|
"lint": "biome lint ./src",
|
|
99
|
+
"qcheck": "biome check ./src",
|
|
98
100
|
"typecheck": "tsc"
|
|
99
101
|
}
|
|
100
102
|
}
|
package/src/index.ts
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import fs from "node:fs";
|
|
2
2
|
import path from "node:path";
|
|
3
3
|
import { fileURLToPath } from "node:url";
|
|
4
|
+
import { getFileHash } from "@serwist/utils/node";
|
|
4
5
|
import { InjectManifest } from "@serwist/webpack-plugin";
|
|
5
6
|
import { ChildCompilationPlugin, relativeToOutputPath } from "@serwist/webpack-plugin/internal";
|
|
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,
|
|
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
|
|
package/src/index.worker.ts
CHANGED
|
@@ -181,15 +181,24 @@ export const defaultCache: RuntimeCaching[] =
|
|
|
181
181
|
}),
|
|
182
182
|
},
|
|
183
183
|
{
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
184
|
+
matcher: ({ sameOrigin, url: { pathname } }) => {
|
|
185
|
+
// Exclude /api/auth/callback/* to fix OAuth workflow in Safari without having
|
|
186
|
+
// an impact on other environments
|
|
187
|
+
// The above route is the default for next-auth, you may need to change it if
|
|
188
|
+
// your OAuth workflow has a different callback route.
|
|
189
|
+
// Issue: https://github.com/shadowwalker/next-pwa/issues/131#issuecomment-821894809
|
|
190
|
+
// TODO(ducanhgh): Investigate Auth.js's "/api/auth/*" failing when we allow them
|
|
191
|
+
// to be cached (the current behaviour).
|
|
192
|
+
if (!sameOrigin || pathname.startsWith("/api/auth/callback")) {
|
|
193
|
+
return false;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
if (pathname.startsWith("/api/")) {
|
|
197
|
+
return true;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
return false;
|
|
201
|
+
},
|
|
193
202
|
method: "GET",
|
|
194
203
|
handler: new NetworkFirst({
|
|
195
204
|
cacheName: "apis",
|
|
@@ -266,9 +275,4 @@ export const defaultCache: RuntimeCaching[] =
|
|
|
266
275
|
networkTimeoutSeconds: 10,
|
|
267
276
|
}),
|
|
268
277
|
},
|
|
269
|
-
{
|
|
270
|
-
matcher: /.*/i,
|
|
271
|
-
method: "GET",
|
|
272
|
-
handler: new NetworkOnly(),
|
|
273
|
-
},
|
|
274
278
|
];
|
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";
|
package/src/lib/types.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { RequiredSwDestPartial, RequiredSwDestResolved } from "@serwist/build";
|
|
2
|
-
import type { Require } from "@serwist/utils";
|
|
2
|
+
import type { Prettify, Require } from "@serwist/utils";
|
|
3
3
|
import type {
|
|
4
4
|
InjectManifestOptions as WebpackInjectManifestOptions,
|
|
5
5
|
InjectManifestOptionsComplete as WebpackInjectManifestOptionsComplete,
|
|
@@ -94,11 +94,12 @@ export interface InjectPartial {
|
|
|
94
94
|
globPublicPatterns?: string[];
|
|
95
95
|
}
|
|
96
96
|
|
|
97
|
-
export type InjectResolved =
|
|
97
|
+
export type InjectResolved = Prettify<
|
|
98
|
+
Require<InjectPartial, "cacheOnNavigation" | "disable" | "register" | "reloadOnOnline" | "swUrl" | "globPublicPatterns">
|
|
99
|
+
>;
|
|
98
100
|
|
|
99
|
-
export type InjectManifestOptions = Omit<WebpackInjectManifestOptions & RequiredSwDestPartial & InjectPartial, "disablePrecacheManifest"
|
|
101
|
+
export type InjectManifestOptions = Prettify<Omit<WebpackInjectManifestOptions & RequiredSwDestPartial & InjectPartial, "disablePrecacheManifest">>;
|
|
100
102
|
|
|
101
|
-
export type InjectManifestOptionsComplete =
|
|
102
|
-
WebpackInjectManifestOptionsComplete & RequiredSwDestResolved & InjectResolved,
|
|
103
|
-
"disablePrecacheManifest"
|
|
103
|
+
export type InjectManifestOptionsComplete = Prettify<
|
|
104
|
+
Omit<WebpackInjectManifestOptionsComplete & RequiredSwDestResolved & InjectResolved, "disablePrecacheManifest">
|
|
104
105
|
>;
|
|
@@ -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
package/dist/utils.d.ts.map
DELETED
|
@@ -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"}
|
package/src/lib/get-file-hash.ts
DELETED
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
|
-
};
|