@node-minify/utils 10.2.0 → 10.3.0
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/LICENSE +1 -1
- package/dist/buildArgs.js +2 -2
- package/dist/buildArgs.js.map +1 -1
- package/dist/compressSingleFile.d.ts +1 -1
- package/dist/compressSingleFile.d.ts.map +1 -1
- package/dist/compressSingleFile.js +6 -32
- package/dist/compressSingleFile.js.map +1 -1
- package/dist/compressor-resolver.d.ts +46 -0
- package/dist/compressor-resolver.d.ts.map +1 -0
- package/dist/compressor-resolver.js +155 -0
- package/dist/compressor-resolver.js.map +1 -0
- package/dist/deleteFile.d.ts +1 -1
- package/dist/deleteFile.js +2 -2
- package/dist/deleteFile.js.map +1 -1
- package/dist/deprecation.d.ts +1 -1
- package/dist/deprecation.js +1 -1
- package/dist/deprecation.js.map +1 -1
- package/dist/ensureStringContent.d.ts +1 -1
- package/dist/ensureStringContent.js +1 -1
- package/dist/ensureStringContent.js.map +1 -1
- package/dist/{error-Ck87RwDD.js → error-Ctspysdk.js} +5 -3
- package/dist/error-Ctspysdk.js.map +1 -0
- package/dist/error.d.ts +2 -1
- package/dist/error.d.ts.map +1 -1
- package/dist/error.js +1 -1
- package/dist/getContentFromFiles.d.ts +1 -1
- package/dist/getContentFromFiles.js +4 -4
- package/dist/getContentFromFiles.js.map +1 -1
- package/dist/getFilesizeBrotliInBytes.d.ts +10 -0
- package/dist/getFilesizeBrotliInBytes.d.ts.map +1 -0
- package/dist/getFilesizeBrotliInBytes.js +29 -0
- package/dist/getFilesizeBrotliInBytes.js.map +1 -0
- package/dist/getFilesizeGzippedInBytes.d.ts +1 -1
- package/dist/getFilesizeGzippedInBytes.js +3 -3
- package/dist/getFilesizeGzippedInBytes.js.map +1 -1
- package/dist/getFilesizeInBytes.d.ts +1 -1
- package/dist/getFilesizeInBytes.js +1 -1
- package/dist/getFilesizeInBytes.js.map +1 -1
- package/dist/index.d.ts +6 -3
- package/dist/index.js +7 -4
- package/dist/isImageFile.d.ts +16 -0
- package/dist/isImageFile.d.ts.map +1 -0
- package/dist/isImageFile.js +35 -0
- package/dist/isImageFile.js.map +1 -0
- package/dist/{isValidFile-DnWJtlKA.js → isValidFile-BW5AgBWb.js} +4 -4
- package/dist/isValidFile-BW5AgBWb.js.map +1 -0
- package/dist/isValidFile.d.ts +1 -1
- package/dist/isValidFile.js +1 -1
- package/dist/prettyBytes.d.ts +1 -1
- package/dist/prettyBytes.js +2 -2
- package/dist/prettyBytes.js.map +1 -1
- package/dist/readFile.d.ts +13 -2
- package/dist/readFile.d.ts.map +1 -1
- package/dist/readFile.js +19 -3
- package/dist/readFile.js.map +1 -1
- package/dist/run.d.ts +4 -4
- package/dist/run.js +39 -32
- package/dist/run.js.map +1 -1
- package/dist/setFileNameMin.d.ts +1 -1
- package/dist/setFileNameMin.js +2 -2
- package/dist/setFileNameMin.js.map +1 -1
- package/dist/setPublicFolder.d.ts +1 -1
- package/dist/setPublicFolder.js +1 -1
- package/dist/setPublicFolder.js.map +1 -1
- package/dist/{types-BUlX1Zbb.d.ts → types-CzkB7gxg.d.ts} +8 -2
- package/dist/types-CzkB7gxg.d.ts.map +1 -0
- package/dist/types.d.ts +1 -1
- package/dist/wildcards.d.ts +1 -1
- package/dist/wildcards.js +1 -1
- package/dist/wildcards.js.map +1 -1
- package/dist/writeFile-DgV8EbFP.js +123 -0
- package/dist/writeFile-DgV8EbFP.js.map +1 -0
- package/dist/writeFile.d.ts +20 -2
- package/dist/writeFile.d.ts.map +1 -1
- package/dist/writeFile.js +2 -2
- package/package.json +2 -2
- package/dist/error-Ck87RwDD.js.map +0 -1
- package/dist/isValidFile-DnWJtlKA.js.map +0 -1
- package/dist/types-BUlX1Zbb.d.ts.map +0 -1
- package/dist/writeFile-BRfs9FqY.js +0 -39
- package/dist/writeFile-BRfs9FqY.js.map +0 -1
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { t as FileOperationError } from "./error-
|
|
2
|
-
import { t as isValidFile } from "./isValidFile-
|
|
1
|
+
import { t as FileOperationError } from "./error-Ctspysdk.js";
|
|
2
|
+
import { t as isValidFile } from "./isValidFile-BW5AgBWb.js";
|
|
3
3
|
import { prettyBytes } from "./prettyBytes.js";
|
|
4
4
|
import { createReadStream, existsSync } from "node:fs";
|
|
5
5
|
|
|
6
6
|
//#region src/getFilesizeGzippedInBytes.ts
|
|
7
7
|
/*!
|
|
8
8
|
* node-minify
|
|
9
|
-
* Copyright(c) 2011-
|
|
9
|
+
* Copyright (c) 2011-2026 Rodolphe Stoclin
|
|
10
10
|
* MIT Licensed
|
|
11
11
|
*/
|
|
12
12
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getFilesizeGzippedInBytes.js","names":[],"sources":["../src/getFilesizeGzippedInBytes.ts"],"sourcesContent":["/*!\n * node-minify\n * Copyright(c) 2011-
|
|
1
|
+
{"version":3,"file":"getFilesizeGzippedInBytes.js","names":[],"sources":["../src/getFilesizeGzippedInBytes.ts"],"sourcesContent":["/*!\n * node-minify\n * Copyright (c) 2011-2026 Rodolphe Stoclin\n * MIT Licensed\n */\n\nimport { createReadStream, existsSync } from \"node:fs\";\nimport { FileOperationError } from \"./error.ts\";\nimport { isValidFile } from \"./isValidFile.ts\";\nimport { prettyBytes } from \"./prettyBytes.ts\";\n\n/**\n * Get the gzipped file size as a human-readable string.\n * @param file - Path to the file\n * @returns Formatted gzipped file size string (e.g., \"1.5 kB\")\n * @throws {FileOperationError} If file doesn't exist or operation fails\n * @example\n * const size = await getFilesizeGzippedInBytes('file.js')\n * console.log(size) // '1.5 kB'\n */\nexport async function getFilesizeGzippedInBytes(file: string): Promise<string> {\n try {\n if (!existsSync(file)) {\n throw new FileOperationError(\n \"access\",\n file,\n new Error(\"File does not exist\")\n );\n }\n\n if (!isValidFile(file)) {\n throw new FileOperationError(\n \"access\",\n file,\n new Error(\"Path is not a valid file\")\n );\n }\n\n const { gzipSizeStream } = await import(\"gzip-size\");\n const source = createReadStream(file);\n\n const size = await new Promise<number>((resolve, reject) => {\n source\n .pipe(gzipSizeStream())\n .on(\"gzip-size\", resolve)\n .on(\"error\", reject);\n });\n\n return prettyBytes(size);\n } catch (error) {\n throw new FileOperationError(\n \"get gzipped size of\",\n file,\n error as Error\n );\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAoBA,eAAsB,0BAA0B,MAA+B;AAC3E,KAAI;AACA,MAAI,CAAC,WAAW,KAAK,CACjB,OAAM,IAAI,mBACN,UACA,sBACA,IAAI,MAAM,sBAAsB,CACnC;AAGL,MAAI,CAAC,YAAY,KAAK,CAClB,OAAM,IAAI,mBACN,UACA,sBACA,IAAI,MAAM,2BAA2B,CACxC;EAGL,MAAM,EAAE,mBAAmB,MAAM,OAAO;EACxC,MAAM,SAAS,iBAAiB,KAAK;AASrC,SAAO,YAPM,MAAM,IAAI,SAAiB,SAAS,WAAW;AACxD,UACK,KAAK,gBAAgB,CAAC,CACtB,GAAG,aAAa,QAAQ,CACxB,GAAG,SAAS,OAAO;IAC1B,CAEsB;UACnB,OAAO;AACZ,QAAM,IAAI,mBACN,uBACA,MACA,MACH"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getFilesizeInBytes.js","names":[],"sources":["../src/getFilesizeInBytes.ts"],"sourcesContent":["/*!\n * node-minify\n * Copyright(c) 2011-
|
|
1
|
+
{"version":3,"file":"getFilesizeInBytes.js","names":[],"sources":["../src/getFilesizeInBytes.ts"],"sourcesContent":["/*!\n * node-minify\n * Copyright (c) 2011-2026 Rodolphe Stoclin\n * MIT Licensed\n */\n\nimport { statSync } from \"node:fs\";\nimport { prettyBytes } from \"./prettyBytes.ts\";\n\n/**\n * Get the file size as a human-readable string.\n * @param file - Path to the file\n * @returns Formatted file size string (e.g., \"1.34 kB\")\n * @example\n * getFilesizeInBytes('bundle.js') // '45.2 kB'\n */\nexport const getFilesizeInBytes = (file: string): string => {\n const stats = statSync(file);\n const fileSizeInBytes = stats.size;\n return prettyBytes(fileSizeInBytes);\n};\n"],"mappings":";;;;;;;;;;;;;;;;AAgBA,MAAa,sBAAsB,SAAyB;CAExD,MAAM,kBADQ,SAAS,KAAK,CACE;AAC9B,QAAO,YAAY,gBAAgB"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,18 +1,21 @@
|
|
|
1
1
|
import { BuildArgsOptions } from "./types.js";
|
|
2
2
|
import { buildArgs, toBuildArgsOptions } from "./buildArgs.js";
|
|
3
3
|
import { compressSingleFile } from "./compressSingleFile.js";
|
|
4
|
+
import { CompressorResolution, getKnownExportName, isBuiltInCompressor, resolveCompressor } from "./compressor-resolver.js";
|
|
4
5
|
import { deleteFile } from "./deleteFile.js";
|
|
5
6
|
import { resetDeprecationWarnings, warnDeprecation } from "./deprecation.js";
|
|
6
7
|
import { ensureStringContent } from "./ensureStringContent.js";
|
|
7
8
|
import { getContentFromFiles, getContentFromFilesAsync } from "./getContentFromFiles.js";
|
|
9
|
+
import { getFilesizeBrotliInBytes } from "./getFilesizeBrotliInBytes.js";
|
|
8
10
|
import { getFilesizeGzippedInBytes } from "./getFilesizeGzippedInBytes.js";
|
|
9
11
|
import { getFilesizeInBytes } from "./getFilesizeInBytes.js";
|
|
12
|
+
import { isImageFile } from "./isImageFile.js";
|
|
10
13
|
import { isValidFile, isValidFileAsync } from "./isValidFile.js";
|
|
11
14
|
import { prettyBytes } from "./prettyBytes.js";
|
|
12
|
-
import { readFile } from "./readFile.js";
|
|
15
|
+
import { readFile, readFileAsync } from "./readFile.js";
|
|
13
16
|
import { run } from "./run.js";
|
|
14
17
|
import { setFileNameMin } from "./setFileNameMin.js";
|
|
15
18
|
import { setPublicFolder } from "./setPublicFolder.js";
|
|
16
19
|
import { wildcards } from "./wildcards.js";
|
|
17
|
-
import { writeFile } from "./writeFile.js";
|
|
18
|
-
export { type BuildArgsOptions, buildArgs, compressSingleFile, deleteFile, ensureStringContent, getContentFromFiles, getContentFromFilesAsync, getFilesizeGzippedInBytes, getFilesizeInBytes, isValidFile, isValidFileAsync, prettyBytes, readFile, resetDeprecationWarnings, run, setFileNameMin, setPublicFolder, toBuildArgsOptions, warnDeprecation, wildcards, writeFile };
|
|
20
|
+
import { writeFile, writeFileAsync } from "./writeFile.js";
|
|
21
|
+
export { type BuildArgsOptions, type CompressorResolution, buildArgs, compressSingleFile, deleteFile, ensureStringContent, getContentFromFiles, getContentFromFilesAsync, getFilesizeBrotliInBytes, getFilesizeGzippedInBytes, getFilesizeInBytes, getKnownExportName, isBuiltInCompressor, isImageFile, isValidFile, isValidFileAsync, prettyBytes, readFile, readFileAsync, resetDeprecationWarnings, resolveCompressor, run, setFileNameMin, setPublicFolder, toBuildArgsOptions, warnDeprecation, wildcards, writeFile, writeFileAsync };
|
package/dist/index.js
CHANGED
|
@@ -1,18 +1,21 @@
|
|
|
1
1
|
import { buildArgs, toBuildArgsOptions } from "./buildArgs.js";
|
|
2
|
-
import { n as isValidFileAsync, t as isValidFile } from "./isValidFile-
|
|
2
|
+
import { n as isValidFileAsync, t as isValidFile } from "./isValidFile-BW5AgBWb.js";
|
|
3
3
|
import { getContentFromFiles, getContentFromFilesAsync } from "./getContentFromFiles.js";
|
|
4
|
-
import {
|
|
4
|
+
import { isImageFile } from "./isImageFile.js";
|
|
5
|
+
import { readFile, readFileAsync } from "./readFile.js";
|
|
6
|
+
import { n as writeFileAsync, t as writeFile } from "./writeFile-DgV8EbFP.js";
|
|
5
7
|
import { run } from "./run.js";
|
|
6
8
|
import { compressSingleFile } from "./compressSingleFile.js";
|
|
9
|
+
import { getKnownExportName, isBuiltInCompressor, resolveCompressor } from "./compressor-resolver.js";
|
|
7
10
|
import { deleteFile } from "./deleteFile.js";
|
|
8
11
|
import { resetDeprecationWarnings, warnDeprecation } from "./deprecation.js";
|
|
9
12
|
import { ensureStringContent } from "./ensureStringContent.js";
|
|
10
13
|
import { prettyBytes } from "./prettyBytes.js";
|
|
14
|
+
import { getFilesizeBrotliInBytes } from "./getFilesizeBrotliInBytes.js";
|
|
11
15
|
import { getFilesizeGzippedInBytes } from "./getFilesizeGzippedInBytes.js";
|
|
12
16
|
import { getFilesizeInBytes } from "./getFilesizeInBytes.js";
|
|
13
|
-
import { readFile } from "./readFile.js";
|
|
14
17
|
import { setFileNameMin } from "./setFileNameMin.js";
|
|
15
18
|
import { setPublicFolder } from "./setPublicFolder.js";
|
|
16
19
|
import { wildcards } from "./wildcards.js";
|
|
17
20
|
|
|
18
|
-
export { buildArgs, compressSingleFile, deleteFile, ensureStringContent, getContentFromFiles, getContentFromFilesAsync, getFilesizeGzippedInBytes, getFilesizeInBytes, isValidFile, isValidFileAsync, prettyBytes, readFile, resetDeprecationWarnings, run, setFileNameMin, setPublicFolder, toBuildArgsOptions, warnDeprecation, wildcards, writeFile };
|
|
21
|
+
export { buildArgs, compressSingleFile, deleteFile, ensureStringContent, getContentFromFiles, getContentFromFilesAsync, getFilesizeBrotliInBytes, getFilesizeGzippedInBytes, getFilesizeInBytes, getKnownExportName, isBuiltInCompressor, isImageFile, isValidFile, isValidFileAsync, prettyBytes, readFile, readFileAsync, resetDeprecationWarnings, resolveCompressor, run, setFileNameMin, setPublicFolder, toBuildArgsOptions, warnDeprecation, wildcards, writeFile, writeFileAsync };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
//#region src/isImageFile.d.ts
|
|
2
|
+
/*!
|
|
3
|
+
* node-minify
|
|
4
|
+
* Copyright (c) 2011-2026 Rodolphe Stoclin
|
|
5
|
+
* MIT Licensed
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Determines whether a file path refers to a supported image file by its extension.
|
|
9
|
+
*
|
|
10
|
+
* @param filePath - The file name or path to check; may include directories.
|
|
11
|
+
* @returns `true` if the path ends with a recognized image extension, `false` otherwise.
|
|
12
|
+
*/
|
|
13
|
+
declare function isImageFile(filePath: string): boolean;
|
|
14
|
+
//#endregion
|
|
15
|
+
export { isImageFile };
|
|
16
|
+
//# sourceMappingURL=isImageFile.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isImageFile.d.ts","names":[],"sources":["../src/isImageFile.ts"],"sourcesContent":[],"mappings":";;AA0BA;;;;;;;;;;iBAAgB,WAAA"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
//#region src/isImageFile.ts
|
|
2
|
+
/*!
|
|
3
|
+
* node-minify
|
|
4
|
+
* Copyright (c) 2011-2026 Rodolphe Stoclin
|
|
5
|
+
* MIT Licensed
|
|
6
|
+
*/
|
|
7
|
+
const IMAGE_EXTENSIONS = new Set([
|
|
8
|
+
".png",
|
|
9
|
+
".jpg",
|
|
10
|
+
".jpeg",
|
|
11
|
+
".gif",
|
|
12
|
+
".webp",
|
|
13
|
+
".avif",
|
|
14
|
+
".tiff",
|
|
15
|
+
".tif",
|
|
16
|
+
".heif",
|
|
17
|
+
".heic",
|
|
18
|
+
".svg"
|
|
19
|
+
]);
|
|
20
|
+
/**
|
|
21
|
+
* Determines whether a file path refers to a supported image file by its extension.
|
|
22
|
+
*
|
|
23
|
+
* @param filePath - The file name or path to check; may include directories.
|
|
24
|
+
* @returns `true` if the path ends with a recognized image extension, `false` otherwise.
|
|
25
|
+
*/
|
|
26
|
+
function isImageFile(filePath) {
|
|
27
|
+
const lastDot = filePath.lastIndexOf(".");
|
|
28
|
+
if (lastDot === -1) return false;
|
|
29
|
+
const ext = filePath.slice(lastDot).toLowerCase();
|
|
30
|
+
return IMAGE_EXTENSIONS.has(ext);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
//#endregion
|
|
34
|
+
export { isImageFile };
|
|
35
|
+
//# sourceMappingURL=isImageFile.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isImageFile.js","names":[],"sources":["../src/isImageFile.ts"],"sourcesContent":["/*!\n * node-minify\n * Copyright (c) 2011-2026 Rodolphe Stoclin\n * MIT Licensed\n */\n\nconst IMAGE_EXTENSIONS = new Set([\n \".png\",\n \".jpg\",\n \".jpeg\",\n \".gif\",\n \".webp\",\n \".avif\",\n \".tiff\",\n \".tif\",\n \".heif\",\n \".heic\",\n \".svg\",\n]);\n\n/**\n * Determines whether a file path refers to a supported image file by its extension.\n *\n * @param filePath - The file name or path to check; may include directories.\n * @returns `true` if the path ends with a recognized image extension, `false` otherwise.\n */\nexport function isImageFile(filePath: string): boolean {\n const lastDot = filePath.lastIndexOf(\".\");\n if (lastDot === -1) return false;\n const ext = filePath.slice(lastDot).toLowerCase();\n return IMAGE_EXTENSIONS.has(ext);\n}\n"],"mappings":";;;;;;AAMA,MAAM,mBAAmB,IAAI,IAAI;CAC7B;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACH,CAAC;;;;;;;AAQF,SAAgB,YAAY,UAA2B;CACnD,MAAM,UAAU,SAAS,YAAY,IAAI;AACzC,KAAI,YAAY,GAAI,QAAO;CAC3B,MAAM,MAAM,SAAS,MAAM,QAAQ,CAAC,aAAa;AACjD,QAAO,iBAAiB,IAAI,IAAI"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { t as FileOperationError } from "./error-
|
|
2
|
-
import { lstat } from "node:fs/promises";
|
|
1
|
+
import { t as FileOperationError } from "./error-Ctspysdk.js";
|
|
3
2
|
import { existsSync, lstatSync } from "node:fs";
|
|
3
|
+
import { lstat } from "node:fs/promises";
|
|
4
4
|
|
|
5
5
|
//#region src/isValidFile.ts
|
|
6
6
|
/*!
|
|
7
7
|
* node-minify
|
|
8
|
-
* Copyright(c) 2011-
|
|
8
|
+
* Copyright (c) 2011-2026 Rodolphe Stoclin
|
|
9
9
|
* MIT Licensed
|
|
10
10
|
*/
|
|
11
11
|
/**
|
|
@@ -43,4 +43,4 @@ async function isValidFileAsync(path) {
|
|
|
43
43
|
|
|
44
44
|
//#endregion
|
|
45
45
|
export { isValidFileAsync as n, isValidFile as t };
|
|
46
|
-
//# sourceMappingURL=isValidFile-
|
|
46
|
+
//# sourceMappingURL=isValidFile-BW5AgBWb.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isValidFile-BW5AgBWb.js","names":["error: unknown"],"sources":["../src/isValidFile.ts"],"sourcesContent":["/*!\n * node-minify\n * Copyright (c) 2011-2026 Rodolphe Stoclin\n * MIT Licensed\n */\n\nimport { existsSync, lstatSync } from \"node:fs\";\nimport { lstat } from \"node:fs/promises\";\nimport { FileOperationError } from \"./error.ts\";\n\n/**\n * Check if the path is a valid file.\n * @param path Path to check\n * @returns true if path exists and is a file, false otherwise\n * @throws {FileOperationError} If filesystem operations fail\n * @example\n * if (isValidFile('path/to/file.js')) {\n * // do something\n * }\n */\nexport function isValidFile(path: string): boolean {\n try {\n return existsSync(path) && !lstatSync(path).isDirectory();\n } catch (error) {\n throw new FileOperationError(\"validate\", path, error as Error);\n }\n}\n\n/**\n * Determine whether a filesystem path refers to an existing file (not a directory).\n *\n * @param path - Path to check\n * @returns `true` if the path exists and is a file, `false` otherwise.\n * @throws {FileOperationError} If a filesystem error other than `ENOENT` occurs while validating the path.\n */\nexport async function isValidFileAsync(path: string): Promise<boolean> {\n try {\n const stats = await lstat(path);\n return !stats.isDirectory();\n } catch (error: unknown) {\n if (\n error &&\n typeof error === \"object\" &&\n \"code\" in error &&\n error.code === \"ENOENT\"\n ) {\n return false;\n }\n throw new FileOperationError(\n \"validate\",\n path,\n error instanceof Error ? error : new Error(String(error))\n );\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAoBA,SAAgB,YAAY,MAAuB;AAC/C,KAAI;AACA,SAAO,WAAW,KAAK,IAAI,CAAC,UAAU,KAAK,CAAC,aAAa;UACpD,OAAO;AACZ,QAAM,IAAI,mBAAmB,YAAY,MAAM,MAAe;;;;;;;;;;AAWtE,eAAsB,iBAAiB,MAAgC;AACnE,KAAI;AAEA,SAAO,EADO,MAAM,MAAM,KAAK,EACjB,aAAa;UACtBA,OAAgB;AACrB,MACI,SACA,OAAO,UAAU,YACjB,UAAU,SACV,MAAM,SAAS,SAEf,QAAO;AAEX,QAAM,IAAI,mBACN,YACA,MACA,iBAAiB,QAAQ,QAAQ,IAAI,MAAM,OAAO,MAAM,CAAC,CAC5D"}
|
package/dist/isValidFile.d.ts
CHANGED
package/dist/isValidFile.js
CHANGED
package/dist/prettyBytes.d.ts
CHANGED
package/dist/prettyBytes.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { n as ValidationError } from "./error-
|
|
1
|
+
import { n as ValidationError } from "./error-Ctspysdk.js";
|
|
2
2
|
|
|
3
3
|
//#region src/prettyBytes.ts
|
|
4
4
|
/*!
|
|
5
5
|
* node-minify
|
|
6
|
-
* Copyright(c) 2011-
|
|
6
|
+
* Copyright (c) 2011-2026 Rodolphe Stoclin
|
|
7
7
|
* MIT Licensed
|
|
8
8
|
*/
|
|
9
9
|
const UNITS = [
|
package/dist/prettyBytes.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prettyBytes.js","names":[],"sources":["../src/prettyBytes.ts"],"sourcesContent":["/*!\n * node-minify\n * Copyright(c) 2011-
|
|
1
|
+
{"version":3,"file":"prettyBytes.js","names":[],"sources":["../src/prettyBytes.ts"],"sourcesContent":["/*!\n * node-minify\n * Copyright (c) 2011-2026 Rodolphe Stoclin\n * MIT Licensed\n */\n\nimport { ValidationError } from \"./error.ts\";\n\nconst UNITS = [\"B\", \"kB\", \"MB\", \"GB\", \"TB\", \"PB\", \"EB\", \"ZB\", \"YB\"] as const;\n\n/**\n * Get the size in human readable format.\n * From https://github.com/sindresorhus/pretty-bytes\n * @param num Number of bytes\n * @returns Human readable string\n * @throws {ValidationError} If input is not a finite number\n * @example\n * prettyBytes(1337) // '1.34 kB'\n * prettyBytes(100) // '100 B'\n */\nexport function prettyBytes(num: number): string {\n if (!Number.isFinite(num)) {\n throw new ValidationError(\n `Expected a finite number, got ${typeof num}: ${num}`\n );\n }\n\n const neg = num < 0;\n const absoluteNum = Math.abs(num);\n\n if (absoluteNum < 1) {\n return `${neg ? \"-\" : \"\"}${absoluteNum} B`;\n }\n\n const exponent = Math.min(\n Math.floor(Math.log(absoluteNum) / Math.log(1000)),\n UNITS.length - 1\n );\n\n const numStr = Number((absoluteNum / 1000 ** exponent).toPrecision(3));\n const unit = UNITS[exponent];\n\n return `${neg ? \"-\" : \"\"}${numStr} ${unit}`;\n}\n"],"mappings":";;;;;;;;AAQA,MAAM,QAAQ;CAAC;CAAK;CAAM;CAAM;CAAM;CAAM;CAAM;CAAM;CAAM;CAAK;;;;;;;;;;;AAYnE,SAAgB,YAAY,KAAqB;AAC7C,KAAI,CAAC,OAAO,SAAS,IAAI,CACrB,OAAM,IAAI,gBACN,iCAAiC,OAAO,IAAI,IAAI,MACnD;CAGL,MAAM,MAAM,MAAM;CAClB,MAAM,cAAc,KAAK,IAAI,IAAI;AAEjC,KAAI,cAAc,EACd,QAAO,GAAG,MAAM,MAAM,KAAK,YAAY;CAG3C,MAAM,WAAW,KAAK,IAClB,KAAK,MAAM,KAAK,IAAI,YAAY,GAAG,KAAK,IAAI,IAAK,CAAC,EAClD,MAAM,SAAS,EAClB;CAED,MAAM,SAAS,QAAQ,cAAc,OAAQ,UAAU,YAAY,EAAE,CAAC;CACtE,MAAM,OAAO,MAAM;AAEnB,QAAO,GAAG,MAAM,MAAM,KAAK,OAAO,GAAG"}
|
package/dist/readFile.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
//#region src/readFile.d.ts
|
|
2
2
|
/*!
|
|
3
3
|
* node-minify
|
|
4
|
-
* Copyright(c) 2011-
|
|
4
|
+
* Copyright (c) 2011-2026 Rodolphe Stoclin
|
|
5
5
|
* MIT Licensed
|
|
6
6
|
*/
|
|
7
7
|
/**
|
|
@@ -21,6 +21,17 @@ declare function readFile(file: string): string;
|
|
|
21
21
|
declare function readFile(file: string, asBuffer: true): Buffer;
|
|
22
22
|
declare function readFile(file: string, asBuffer: false): string;
|
|
23
23
|
declare function readFile(file: string, asBuffer?: boolean): string | Buffer;
|
|
24
|
+
/**
|
|
25
|
+
* Read content from file asynchronously.
|
|
26
|
+
* @param file - Path to file
|
|
27
|
+
* @param asBuffer - If true, return Buffer; if false, return string (default: false)
|
|
28
|
+
* @returns File content as string or Buffer
|
|
29
|
+
* @throws {FileOperationError} If file doesn't exist or reading fails
|
|
30
|
+
*/
|
|
31
|
+
declare function readFileAsync(file: string): Promise<string>;
|
|
32
|
+
declare function readFileAsync(file: string, asBuffer: true): Promise<Buffer>;
|
|
33
|
+
declare function readFileAsync(file: string, asBuffer: false): Promise<string>;
|
|
34
|
+
declare function readFileAsync(file: string, asBuffer?: boolean): Promise<string | Buffer>;
|
|
24
35
|
//#endregion
|
|
25
|
-
export { readFile };
|
|
36
|
+
export { readFile, readFileAsync };
|
|
26
37
|
//# sourceMappingURL=readFile.d.ts.map
|
package/dist/readFile.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"readFile.d.ts","names":[],"sources":["../src/readFile.ts"],"sourcesContent":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"readFile.d.ts","names":[],"sources":["../src/readFile.ts"],"sourcesContent":[],"mappings":";;AAuBA;AACA;AACA;AACA;AA4BA;AACA;AAIA;AAIA;;;;;;;;;;iBAxCgB,QAAA;iBACA,QAAA,gCAAwC;iBACxC,QAAA;iBACA,QAAA,6CAAqD;;;;;;;;iBA4B/C,aAAA,gBAA6B;iBAC7B,aAAA,gCAGnB,QAAQ;iBACW,aAAA,iCAGnB;iBACmB,aAAA,oCAGnB,iBAAiB"}
|
package/dist/readFile.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { t as FileOperationError } from "./error-
|
|
1
|
+
import { t as FileOperationError } from "./error-Ctspysdk.js";
|
|
2
2
|
import { readFileSync } from "node:fs";
|
|
3
|
+
import { readFile as readFile$1 } from "node:fs/promises";
|
|
3
4
|
|
|
4
5
|
//#region src/readFile.ts
|
|
5
6
|
/*!
|
|
6
7
|
* node-minify
|
|
7
|
-
* Copyright(c) 2011-
|
|
8
|
+
* Copyright (c) 2011-2026 Rodolphe Stoclin
|
|
8
9
|
* MIT Licensed
|
|
9
10
|
*/
|
|
10
11
|
/**
|
|
@@ -22,7 +23,22 @@ function readFile(file, asBuffer) {
|
|
|
22
23
|
throw new FileOperationError("read", file, error instanceof Error ? error : void 0);
|
|
23
24
|
}
|
|
24
25
|
}
|
|
26
|
+
/**
|
|
27
|
+
* Read a file from disk asynchronously and return its contents as a UTF-8 string by default or as a raw Buffer.
|
|
28
|
+
*
|
|
29
|
+
* @param file - Path to the file to read.
|
|
30
|
+
* @param asBuffer - If `true`, return a raw `Buffer`; if `false` or omitted, return the file decoded as a UTF-8 `string`.
|
|
31
|
+
* @returns A `Buffer` when `asBuffer` is `true`, otherwise the file content as a UTF-8 `string`.
|
|
32
|
+
* @throws FileOperationError when the file cannot be read; the original error is attached as the cause.
|
|
33
|
+
*/
|
|
34
|
+
async function readFileAsync(file, asBuffer) {
|
|
35
|
+
try {
|
|
36
|
+
return asBuffer ? await readFile$1(file) : await readFile$1(file, "utf8");
|
|
37
|
+
} catch (error) {
|
|
38
|
+
throw new FileOperationError("read", file, error instanceof Error ? error : void 0);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
25
41
|
|
|
26
42
|
//#endregion
|
|
27
|
-
export { readFile };
|
|
43
|
+
export { readFile, readFileAsync };
|
|
28
44
|
//# sourceMappingURL=readFile.js.map
|
package/dist/readFile.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"readFile.js","names":[],"sources":["../src/readFile.ts"],"sourcesContent":["/*!\n * node-minify\n * Copyright(c) 2011-
|
|
1
|
+
{"version":3,"file":"readFile.js","names":["readFilePromise"],"sources":["../src/readFile.ts"],"sourcesContent":["/*!\n * node-minify\n * Copyright (c) 2011-2026 Rodolphe Stoclin\n * MIT Licensed\n */\n\nimport { readFileSync } from \"node:fs\";\nimport { readFile as readFilePromise } from \"node:fs/promises\";\nimport { FileOperationError } from \"./error.ts\";\n\n/**\n * Read content from file.\n * @param file - Path to file\n * @param asBuffer - If true, return Buffer; if false, return string (default: false)\n * @returns File content as string or Buffer\n * @throws {FileOperationError} If file doesn't exist or reading fails\n * @example\n * // Read as string\n * const content = readFile('file.txt');\n *\n * // Read as Buffer (for binary files like images)\n * const buffer = readFile('image.png', true);\n */\nexport function readFile(file: string): string;\nexport function readFile(file: string, asBuffer: true): Buffer;\nexport function readFile(file: string, asBuffer: false): string;\nexport function readFile(file: string, asBuffer?: boolean): string | Buffer;\n/**\n * Read a file from disk and return its contents as a UTF-8 string by default or as a raw Buffer.\n *\n * @param file - Path to the file to read.\n * @param asBuffer - If `true`, return a raw `Buffer`; if `false` or omitted, return the file decoded as a UTF-8 `string`.\n * @returns A `Buffer` when `asBuffer` is `true`, otherwise the file content as a UTF-8 `string`.\n * @throws FileOperationError when the file cannot be read; the original error is attached as the cause.\n */\nexport function readFile(file: string, asBuffer?: boolean): string | Buffer {\n try {\n return asBuffer ? readFileSync(file) : readFileSync(file, \"utf8\");\n } catch (error) {\n throw new FileOperationError(\n \"read\",\n file,\n error instanceof Error ? error : undefined\n );\n }\n}\n\n/**\n * Read content from file asynchronously.\n * @param file - Path to file\n * @param asBuffer - If true, return Buffer; if false, return string (default: false)\n * @returns File content as string or Buffer\n * @throws {FileOperationError} If file doesn't exist or reading fails\n */\nexport async function readFileAsync(file: string): Promise<string>;\nexport async function readFileAsync(\n file: string,\n asBuffer: true\n): Promise<Buffer>;\nexport async function readFileAsync(\n file: string,\n asBuffer: false\n): Promise<string>;\nexport async function readFileAsync(\n file: string,\n asBuffer?: boolean\n): Promise<string | Buffer>;\n/**\n * Read a file from disk asynchronously and return its contents as a UTF-8 string by default or as a raw Buffer.\n *\n * @param file - Path to the file to read.\n * @param asBuffer - If `true`, return a raw `Buffer`; if `false` or omitted, return the file decoded as a UTF-8 `string`.\n * @returns A `Buffer` when `asBuffer` is `true`, otherwise the file content as a UTF-8 `string`.\n * @throws FileOperationError when the file cannot be read; the original error is attached as the cause.\n */\nexport async function readFileAsync(\n file: string,\n asBuffer?: boolean\n): Promise<string | Buffer> {\n try {\n return asBuffer\n ? await readFilePromise(file)\n : await readFilePromise(file, \"utf8\");\n } catch (error) {\n throw new FileOperationError(\n \"read\",\n file,\n error instanceof Error ? error : undefined\n );\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAmCA,SAAgB,SAAS,MAAc,UAAqC;AACxE,KAAI;AACA,SAAO,WAAW,aAAa,KAAK,GAAG,aAAa,MAAM,OAAO;UAC5D,OAAO;AACZ,QAAM,IAAI,mBACN,QACA,MACA,iBAAiB,QAAQ,QAAQ,OACpC;;;;;;;;;;;AAgCT,eAAsB,cAClB,MACA,UACwB;AACxB,KAAI;AACA,SAAO,WACD,MAAMA,WAAgB,KAAK,GAC3B,MAAMA,WAAgB,MAAM,OAAO;UACpC,OAAO;AACZ,QAAM,IAAI,mBACN,QACA,MACA,iBAAiB,QAAQ,QAAQ,OACpC"}
|
package/dist/run.d.ts
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { n as
|
|
1
|
+
import { n as CompressorOptions, r as MinifierOptions } from "./types-CzkB7gxg.js";
|
|
2
2
|
|
|
3
3
|
//#region src/run.d.ts
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
|
-
*
|
|
6
|
+
* Execute the configured compressor and persist its outputs according to the provided settings.
|
|
7
7
|
*
|
|
8
|
-
* @param settings - Compressor settings including output targets and the `compressor` implementation
|
|
8
|
+
* @param settings - Compressor settings including output targets, options, and the `compressor` implementation
|
|
9
9
|
* @param content - The input content to be compressed
|
|
10
10
|
* @param index - Optional index used when processing multiple inputs
|
|
11
11
|
* @returns The minified code produced by the compressor
|
|
12
|
-
* @throws
|
|
12
|
+
* @throws ValidationError If `settings` is missing, `settings.compressor` is not provided, or the compressor returns an invalid result
|
|
13
13
|
*/
|
|
14
14
|
declare function run<T extends CompressorOptions = CompressorOptions>({
|
|
15
15
|
settings,
|
package/dist/run.js
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import { n as ValidationError } from "./error-
|
|
2
|
-
import {
|
|
1
|
+
import { n as ValidationError } from "./error-Ctspysdk.js";
|
|
2
|
+
import { n as writeFileAsync } from "./writeFile-DgV8EbFP.js";
|
|
3
3
|
import { join, parse } from "node:path";
|
|
4
4
|
|
|
5
5
|
//#region src/run.ts
|
|
6
6
|
/*!
|
|
7
7
|
* node-minify
|
|
8
|
-
* Copyright(c) 2011-
|
|
8
|
+
* Copyright (c) 2011-2026 Rodolphe Stoclin
|
|
9
9
|
* MIT Licensed
|
|
10
10
|
*/
|
|
11
11
|
/**
|
|
12
|
-
*
|
|
12
|
+
* Execute the configured compressor and persist its outputs according to the provided settings.
|
|
13
13
|
*
|
|
14
|
-
* @param settings - Compressor settings including output targets and the `compressor` implementation
|
|
14
|
+
* @param settings - Compressor settings including output targets, options, and the `compressor` implementation
|
|
15
15
|
* @param content - The input content to be compressed
|
|
16
16
|
* @param index - Optional index used when processing multiple inputs
|
|
17
17
|
* @returns The minified code produced by the compressor
|
|
18
|
-
* @throws
|
|
18
|
+
* @throws ValidationError If `settings` is missing, `settings.compressor` is not provided, or the compressor returns an invalid result
|
|
19
19
|
*/
|
|
20
20
|
async function run({ settings, content, index }) {
|
|
21
21
|
if (!settings) throw new ValidationError("Settings must be provided");
|
|
@@ -25,10 +25,23 @@ async function run({ settings, content, index }) {
|
|
|
25
25
|
content,
|
|
26
26
|
index
|
|
27
27
|
});
|
|
28
|
-
|
|
28
|
+
validateCompressorResult(result, settings);
|
|
29
|
+
await writeOutput(result, settings, index);
|
|
29
30
|
return result.code;
|
|
30
31
|
}
|
|
31
32
|
/**
|
|
33
|
+
* Verify that a compressor result is an object containing a string `code` property and narrow its type to `CompressorResult`.
|
|
34
|
+
*
|
|
35
|
+
* @param result - The value returned by the compressor to validate.
|
|
36
|
+
* @param settings - Minifier settings (used to derive the compressor label for error messages).
|
|
37
|
+
* @throws ValidationError - If `result` is not an object with a string `code` property.
|
|
38
|
+
*/
|
|
39
|
+
function validateCompressorResult(result, settings) {
|
|
40
|
+
if (!result || typeof result !== "object") throw new ValidationError(`Compressor '${settings.compressorLabel || "compressor"}' returned invalid result. Expected an object with { code: string }.`);
|
|
41
|
+
const obj = result;
|
|
42
|
+
if (!("code" in obj) || typeof obj.code !== "string") throw new ValidationError(`Compressor '${settings.compressorLabel || "compressor"}' must return { code: string }. Got: ${JSON.stringify(Object.keys(obj))}`);
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
32
45
|
* Write compressor result outputs to disk unless the operation is in-memory.
|
|
33
46
|
*
|
|
34
47
|
* Writes multiple output files when `result.outputs` is provided, writes a binary `result.buffer` to the configured output when present, otherwise writes `result.code`. If a source map is available and a source map URL can be resolved from `settings`, the map is written alongside the main output.
|
|
@@ -37,33 +50,34 @@ async function run({ settings, content, index }) {
|
|
|
37
50
|
* @param settings - Settings that include output destination(s) and optional in-memory `content` which disables disk writes
|
|
38
51
|
* @param index - Optional index used when writing to multiple targets or when tracking a particular input within a batch
|
|
39
52
|
*/
|
|
40
|
-
function writeOutput(result, settings, index) {
|
|
53
|
+
async function writeOutput(result, settings, index) {
|
|
41
54
|
if (Boolean(settings.content) || !settings.output) return;
|
|
42
55
|
if (result.outputs && result.outputs.length > 0) {
|
|
43
|
-
writeMultipleOutputs(result.outputs, settings, index);
|
|
56
|
+
await writeMultipleOutputs(result.outputs, settings, index);
|
|
44
57
|
return;
|
|
45
58
|
}
|
|
46
59
|
if (result.buffer) {
|
|
47
|
-
|
|
60
|
+
await writeFileAsync({
|
|
48
61
|
file: settings.output,
|
|
49
62
|
content: result.buffer,
|
|
50
63
|
index
|
|
51
64
|
});
|
|
52
65
|
return;
|
|
53
66
|
}
|
|
54
|
-
|
|
67
|
+
const writePromises = [writeFileAsync({
|
|
55
68
|
file: settings.output,
|
|
56
69
|
content: result.code,
|
|
57
70
|
index
|
|
58
|
-
});
|
|
71
|
+
})];
|
|
59
72
|
if (result.map) {
|
|
60
73
|
const sourceMapUrl = getSourceMapUrl(settings);
|
|
61
|
-
if (sourceMapUrl)
|
|
74
|
+
if (sourceMapUrl) writePromises.push(writeFileAsync({
|
|
62
75
|
file: sourceMapUrl,
|
|
63
76
|
content: result.map,
|
|
64
77
|
index
|
|
65
|
-
});
|
|
78
|
+
}));
|
|
66
79
|
}
|
|
80
|
+
await Promise.all(writePromises);
|
|
67
81
|
}
|
|
68
82
|
/**
|
|
69
83
|
* Extract the first input file path from the input configuration.
|
|
@@ -77,31 +91,23 @@ function getFirstInputFile(input) {
|
|
|
77
91
|
return "";
|
|
78
92
|
}
|
|
79
93
|
/**
|
|
80
|
-
* Write
|
|
81
|
-
*
|
|
82
|
-
* This writes each provided output entry to a computed target path:
|
|
83
|
-
* - If `settings.output` is an array, a non-empty array item (not "$1") at the same index is used verbatim as the target path.
|
|
84
|
-
* - If `settings.output` is the string "$1", the target is generated from the first input filename and the output's `format` (or "out" if missing).
|
|
85
|
-
* - If `settings.output` contains "$1", every "$1" is replaced with the input base name and the output's `format` is appended.
|
|
86
|
-
* - If `settings.output` is a plain string, that string is used with the output's `format` appended.
|
|
87
|
-
* - If no usable output pattern is provided, a default path is generated from the input filename and the output's `format`.
|
|
94
|
+
* Write compressor outputs to files resolved from the provided settings.
|
|
88
95
|
*
|
|
89
|
-
*
|
|
96
|
+
* Resolves a target path for each output entry based on settings.output and settings.input, then writes each entry's content to its resolved file location.
|
|
90
97
|
*
|
|
91
|
-
* @param outputs - Array of compressor
|
|
92
|
-
* @param settings - Settings used to resolve
|
|
93
|
-
* @param index - Optional index forwarded to the file writer
|
|
98
|
+
* @param outputs - Array of compressor output entries (each entry typically contains `content` and optional `format`) to be written.
|
|
99
|
+
* @param settings - Settings used to resolve target paths (may supply `output` pattern/array and `input` for deriving names).
|
|
100
|
+
* @param index - Optional numeric index forwarded to the file writer for each write operation.
|
|
94
101
|
*/
|
|
95
|
-
function writeMultipleOutputs(outputs, settings, index) {
|
|
102
|
+
async function writeMultipleOutputs(outputs, settings, index) {
|
|
96
103
|
const output = settings.output;
|
|
97
104
|
const isArrayOutput = Array.isArray(output);
|
|
98
105
|
const outputsArray = isArrayOutput ? output : [output];
|
|
99
106
|
const inputFile = getFirstInputFile(settings.input);
|
|
100
107
|
const inputDir = parse(inputFile).dir;
|
|
101
108
|
const inputBase = parse(inputFile).name;
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
if (!outputResult) continue;
|
|
109
|
+
const promises = outputs.map(async (outputResult, i) => {
|
|
110
|
+
if (!outputResult) return;
|
|
105
111
|
const format = outputResult.format || "out";
|
|
106
112
|
let targetFile;
|
|
107
113
|
const arrayItem = outputsArray[i];
|
|
@@ -117,12 +123,13 @@ function writeMultipleOutputs(outputs, settings, index) {
|
|
|
117
123
|
const baseName = inputBase || "output";
|
|
118
124
|
targetFile = inputDir ? join(inputDir, `${baseName}.${format}`) : `${baseName}.${format}`;
|
|
119
125
|
}
|
|
120
|
-
|
|
126
|
+
await writeFileAsync({
|
|
121
127
|
file: targetFile,
|
|
122
128
|
content: outputResult.content,
|
|
123
129
|
index
|
|
124
130
|
});
|
|
125
|
-
}
|
|
131
|
+
});
|
|
132
|
+
await Promise.all(promises);
|
|
126
133
|
}
|
|
127
134
|
/**
|
|
128
135
|
* Resolve the configured source map path or URL from the provided settings.
|
package/dist/run.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run.js","names":["targetFile: string"],"sources":["../src/run.ts"],"sourcesContent":["/*!\n * node-minify\n * Copyright(c) 2011-2025 Rodolphe Stoclin\n * MIT Licensed\n */\n\nimport { join, parse } from \"node:path\";\nimport type {\n CompressorOptions,\n CompressorResult,\n MinifierOptions,\n Settings,\n} from \"@node-minify/types\";\nimport { ValidationError } from \"./error.ts\";\nimport { writeFile } from \"./writeFile.ts\";\n\n/**\n * Run the configured compressor and persist its outputs according to the provided settings.\n *\n * @param settings - Compressor settings including output targets and the `compressor` implementation\n * @param content - The input content to be compressed\n * @param index - Optional index used when processing multiple inputs\n * @returns The minified code produced by the compressor\n * @throws {ValidationError} If `settings` is missing or `settings.compressor` is not provided\n */\nexport async function run<T extends CompressorOptions = CompressorOptions>({\n settings,\n content,\n index,\n}: MinifierOptions<T>): Promise<string> {\n if (!settings) {\n throw new ValidationError(\"Settings must be provided\");\n }\n\n if (!settings.compressor) {\n throw new ValidationError(\"Compressor must be provided in settings\");\n }\n\n const result = await settings.compressor({\n settings,\n content,\n index,\n });\n\n writeOutput(result, settings, index);\n\n return result.code;\n}\n\n/**\n * Write compressor result outputs to disk unless the operation is in-memory.\n *\n * Writes multiple output files when `result.outputs` is provided, writes a binary `result.buffer` to the configured output when present, otherwise writes `result.code`. If a source map is available and a source map URL can be resolved from `settings`, the map is written alongside the main output.\n *\n * @param result - The compressor result containing `code`, optional `buffer`, `map`, or `outputs` describing one or more outputs\n * @param settings - Settings that include output destination(s) and optional in-memory `content` which disables disk writes\n * @param index - Optional index used when writing to multiple targets or when tracking a particular input within a batch\n */\nfunction writeOutput<T extends CompressorOptions = CompressorOptions>(\n result: CompressorResult,\n settings: Settings<T>,\n index?: number\n): void {\n const isInMemoryMode = Boolean(settings.content);\n if (isInMemoryMode || !settings.output) {\n return;\n }\n\n // Handle multi-output (for image conversion to multiple formats)\n if (result.outputs && result.outputs.length > 0) {\n writeMultipleOutputs(result.outputs, settings, index);\n return;\n }\n\n // Handle single buffer output (for binary images)\n if (result.buffer) {\n writeFile({ file: settings.output, content: result.buffer, index });\n return;\n }\n\n // Default: write code (string) output\n writeFile({ file: settings.output, content: result.code, index });\n\n if (result.map) {\n const sourceMapUrl = getSourceMapUrl(settings);\n if (sourceMapUrl) {\n writeFile({ file: sourceMapUrl, content: result.map, index });\n }\n }\n}\n\n/**\n * Extract the first input file path from the input configuration.\n *\n * @param input - A single file path, an array of paths, or undefined\n * @returns The first input file path, or an empty string if none available\n */\nfunction getFirstInputFile(input: string | string[] | undefined): string {\n if (typeof input === \"string\") {\n return input;\n }\n if (Array.isArray(input) && input.length > 0) {\n return input[0] ?? \"\";\n }\n return \"\";\n}\n\n/**\n * Write multiple output files produced by a compressor according to the settings' output configuration.\n *\n * This writes each provided output entry to a computed target path:\n * - If `settings.output` is an array, a non-empty array item (not \"$1\") at the same index is used verbatim as the target path.\n * - If `settings.output` is the string \"$1\", the target is generated from the first input filename and the output's `format` (or \"out\" if missing).\n * - If `settings.output` contains \"$1\", every \"$1\" is replaced with the input base name and the output's `format` is appended.\n * - If `settings.output` is a plain string, that string is used with the output's `format` appended.\n * - If no usable output pattern is provided, a default path is generated from the input filename and the output's `format`.\n *\n * Each output's `content` is written to its resolved path using `writeFile`. The first input (if any) is used to derive base names and directories for auto-generated targets.\n *\n * @param outputs - Array of compressor outputs (each may include `content` and optional `format`) to write.\n * @param settings - Settings used to resolve output targets (may supply `output` and `input`).\n * @param index - Optional index forwarded to the file writer when writing each output.\n */\nfunction writeMultipleOutputs<T extends CompressorOptions = CompressorOptions>(\n outputs: NonNullable<CompressorResult[\"outputs\"]>,\n settings: Settings<T>,\n index?: number\n): void {\n const output = settings.output;\n const isArrayOutput = Array.isArray(output);\n const outputsArray = isArrayOutput ? output : [output];\n const inputFile = getFirstInputFile(settings.input);\n const inputDir = parse(inputFile).dir;\n const inputBase = parse(inputFile).name;\n\n for (let i = 0; i < outputs.length; i++) {\n const outputResult = outputs[i];\n if (!outputResult) {\n continue;\n }\n\n const format = outputResult.format || \"out\";\n let targetFile: string;\n\n const arrayItem = outputsArray[i];\n\n if (\n isArrayOutput &&\n arrayItem !== undefined &&\n arrayItem !== \"$1\" &&\n arrayItem.trim() !== \"\"\n ) {\n // Explicit output path provided in array - use as-is\n targetFile = arrayItem;\n } else if (typeof output === \"string\" && output === \"$1\") {\n // $1 only: auto-generate from input filename in input directory\n const baseName = inputBase || \"output\";\n targetFile = inputDir\n ? join(inputDir, `${baseName}.${format}`)\n : `${baseName}.${format}`;\n } else if (typeof output === \"string\" && output.includes(\"$1\")) {\n // $1 pattern in path: replace and append format\n const extensionlessName = inputBase || \"output\";\n const outputFile = output.replace(/\\$1/g, extensionlessName);\n targetFile = `${outputFile}.${format}`;\n } else if (typeof output === \"string\") {\n // Single string output: append format extension\n targetFile = `${output}.${format}`;\n } else {\n // Fallback\n const baseName = inputBase || \"output\";\n targetFile = inputDir\n ? join(inputDir, `${baseName}.${format}`)\n : `${baseName}.${format}`;\n }\n\n writeFile({ file: targetFile, content: outputResult.content, index });\n }\n}\n\n/**\n * Resolve the configured source map path or URL from the provided settings.\n *\n * @param settings - Minifier settings that may include `options.sourceMap` or `options._sourceMap`\n * @returns The source map URL or filename when configured, `undefined` otherwise.\n */\nfunction getSourceMapUrl<T extends CompressorOptions = CompressorOptions>(\n settings: Settings<T>\n): string | undefined {\n const options = settings.options as Record<string, unknown> | undefined;\n if (!options) {\n return undefined;\n }\n\n const sourceMap = options.sourceMap as Record<string, unknown> | undefined;\n if (sourceMap) {\n if (typeof sourceMap.url === \"string\") {\n return sourceMap.url;\n }\n if (typeof sourceMap.filename === \"string\") {\n return sourceMap.filename;\n }\n }\n\n const _sourceMap = options._sourceMap as\n | Record<string, unknown>\n | undefined;\n if (_sourceMap && typeof _sourceMap.url === \"string\") {\n return _sourceMap.url;\n }\n\n return undefined;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAyBA,eAAsB,IAAqD,EACvE,UACA,SACA,SACoC;AACpC,KAAI,CAAC,SACD,OAAM,IAAI,gBAAgB,4BAA4B;AAG1D,KAAI,CAAC,SAAS,WACV,OAAM,IAAI,gBAAgB,0CAA0C;CAGxE,MAAM,SAAS,MAAM,SAAS,WAAW;EACrC;EACA;EACA;EACH,CAAC;AAEF,aAAY,QAAQ,UAAU,MAAM;AAEpC,QAAO,OAAO;;;;;;;;;;;AAYlB,SAAS,YACL,QACA,UACA,OACI;AAEJ,KADuB,QAAQ,SAAS,QAAQ,IAC1B,CAAC,SAAS,OAC5B;AAIJ,KAAI,OAAO,WAAW,OAAO,QAAQ,SAAS,GAAG;AAC7C,uBAAqB,OAAO,SAAS,UAAU,MAAM;AACrD;;AAIJ,KAAI,OAAO,QAAQ;AACf,YAAU;GAAE,MAAM,SAAS;GAAQ,SAAS,OAAO;GAAQ;GAAO,CAAC;AACnE;;AAIJ,WAAU;EAAE,MAAM,SAAS;EAAQ,SAAS,OAAO;EAAM;EAAO,CAAC;AAEjE,KAAI,OAAO,KAAK;EACZ,MAAM,eAAe,gBAAgB,SAAS;AAC9C,MAAI,aACA,WAAU;GAAE,MAAM;GAAc,SAAS,OAAO;GAAK;GAAO,CAAC;;;;;;;;;AAWzE,SAAS,kBAAkB,OAA8C;AACrE,KAAI,OAAO,UAAU,SACjB,QAAO;AAEX,KAAI,MAAM,QAAQ,MAAM,IAAI,MAAM,SAAS,EACvC,QAAO,MAAM,MAAM;AAEvB,QAAO;;;;;;;;;;;;;;;;;;AAmBX,SAAS,qBACL,SACA,UACA,OACI;CACJ,MAAM,SAAS,SAAS;CACxB,MAAM,gBAAgB,MAAM,QAAQ,OAAO;CAC3C,MAAM,eAAe,gBAAgB,SAAS,CAAC,OAAO;CACtD,MAAM,YAAY,kBAAkB,SAAS,MAAM;CACnD,MAAM,WAAW,MAAM,UAAU,CAAC;CAClC,MAAM,YAAY,MAAM,UAAU,CAAC;AAEnC,MAAK,IAAI,IAAI,GAAG,IAAI,QAAQ,QAAQ,KAAK;EACrC,MAAM,eAAe,QAAQ;AAC7B,MAAI,CAAC,aACD;EAGJ,MAAM,SAAS,aAAa,UAAU;EACtC,IAAIA;EAEJ,MAAM,YAAY,aAAa;AAE/B,MACI,iBACA,cAAc,UACd,cAAc,QACd,UAAU,MAAM,KAAK,GAGrB,cAAa;WACN,OAAO,WAAW,YAAY,WAAW,MAAM;GAEtD,MAAM,WAAW,aAAa;AAC9B,gBAAa,WACP,KAAK,UAAU,GAAG,SAAS,GAAG,SAAS,GACvC,GAAG,SAAS,GAAG;aACd,OAAO,WAAW,YAAY,OAAO,SAAS,KAAK,EAAE;GAE5D,MAAM,oBAAoB,aAAa;AAEvC,gBAAa,GADM,OAAO,QAAQ,QAAQ,kBAAkB,CACjC,GAAG;aACvB,OAAO,WAAW,SAEzB,cAAa,GAAG,OAAO,GAAG;OACvB;GAEH,MAAM,WAAW,aAAa;AAC9B,gBAAa,WACP,KAAK,UAAU,GAAG,SAAS,GAAG,SAAS,GACvC,GAAG,SAAS,GAAG;;AAGzB,YAAU;GAAE,MAAM;GAAY,SAAS,aAAa;GAAS;GAAO,CAAC;;;;;;;;;AAU7E,SAAS,gBACL,UACkB;CAClB,MAAM,UAAU,SAAS;AACzB,KAAI,CAAC,QACD;CAGJ,MAAM,YAAY,QAAQ;AAC1B,KAAI,WAAW;AACX,MAAI,OAAO,UAAU,QAAQ,SACzB,QAAO,UAAU;AAErB,MAAI,OAAO,UAAU,aAAa,SAC9B,QAAO,UAAU;;CAIzB,MAAM,aAAa,QAAQ;AAG3B,KAAI,cAAc,OAAO,WAAW,QAAQ,SACxC,QAAO,WAAW"}
|
|
1
|
+
{"version":3,"file":"run.js","names":["targetFile: string"],"sources":["../src/run.ts"],"sourcesContent":["/*!\n * node-minify\n * Copyright (c) 2011-2026 Rodolphe Stoclin\n * MIT Licensed\n */\n\nimport { join, parse } from \"node:path\";\nimport type {\n CompressorOptions,\n CompressorResult,\n MinifierOptions,\n Settings,\n} from \"@node-minify/types\";\nimport { ValidationError } from \"./error.ts\";\nimport { writeFileAsync } from \"./writeFile.ts\";\n\n/**\n * Execute the configured compressor and persist its outputs according to the provided settings.\n *\n * @param settings - Compressor settings including output targets, options, and the `compressor` implementation\n * @param content - The input content to be compressed\n * @param index - Optional index used when processing multiple inputs\n * @returns The minified code produced by the compressor\n * @throws ValidationError If `settings` is missing, `settings.compressor` is not provided, or the compressor returns an invalid result\n */\nexport async function run<T extends CompressorOptions = CompressorOptions>({\n settings,\n content,\n index,\n}: MinifierOptions<T>): Promise<string> {\n if (!settings) {\n throw new ValidationError(\"Settings must be provided\");\n }\n\n if (!settings.compressor) {\n throw new ValidationError(\"Compressor must be provided in settings\");\n }\n\n const result = await settings.compressor({\n settings,\n content,\n index,\n });\n\n validateCompressorResult(result, settings);\n\n await writeOutput(result, settings, index);\n\n return result.code;\n}\n\n/**\n * Verify that a compressor result is an object containing a string `code` property and narrow its type to `CompressorResult`.\n *\n * @param result - The value returned by the compressor to validate.\n * @param settings - Minifier settings (used to derive the compressor label for error messages).\n * @throws ValidationError - If `result` is not an object with a string `code` property.\n */\nfunction validateCompressorResult<\n T extends CompressorOptions = CompressorOptions,\n>(result: unknown, settings: Settings<T>): asserts result is CompressorResult {\n if (!result || typeof result !== \"object\") {\n const label = settings.compressorLabel || \"compressor\";\n throw new ValidationError(\n `Compressor '${label}' returned invalid result. Expected an object with { code: string }.`\n );\n }\n\n const obj = result as Record<string, unknown>;\n if (!(\"code\" in obj) || typeof obj.code !== \"string\") {\n const label = settings.compressorLabel || \"compressor\";\n throw new ValidationError(\n `Compressor '${label}' must return { code: string }. Got: ${JSON.stringify(Object.keys(obj))}`\n );\n }\n}\n\n/**\n * Write compressor result outputs to disk unless the operation is in-memory.\n *\n * Writes multiple output files when `result.outputs` is provided, writes a binary `result.buffer` to the configured output when present, otherwise writes `result.code`. If a source map is available and a source map URL can be resolved from `settings`, the map is written alongside the main output.\n *\n * @param result - The compressor result containing `code`, optional `buffer`, `map`, or `outputs` describing one or more outputs\n * @param settings - Settings that include output destination(s) and optional in-memory `content` which disables disk writes\n * @param index - Optional index used when writing to multiple targets or when tracking a particular input within a batch\n */\nasync function writeOutput<T extends CompressorOptions = CompressorOptions>(\n result: CompressorResult,\n settings: Settings<T>,\n index?: number\n): Promise<void> {\n const isInMemoryMode = Boolean(settings.content);\n if (isInMemoryMode || !settings.output) {\n return;\n }\n\n // Handle multi-output (for image conversion to multiple formats)\n if (result.outputs && result.outputs.length > 0) {\n await writeMultipleOutputs(result.outputs, settings, index);\n return;\n }\n\n // Handle single buffer output (for binary images)\n if (result.buffer) {\n await writeFileAsync({\n file: settings.output,\n content: result.buffer,\n index,\n });\n return;\n }\n\n // Default: write code (string) output\n const writePromises = [\n writeFileAsync({\n file: settings.output,\n content: result.code,\n index,\n }),\n ];\n\n if (result.map) {\n const sourceMapUrl = getSourceMapUrl(settings);\n if (sourceMapUrl) {\n writePromises.push(\n writeFileAsync({\n file: sourceMapUrl,\n content: result.map,\n index,\n })\n );\n }\n }\n\n await Promise.all(writePromises);\n}\n\n/**\n * Extract the first input file path from the input configuration.\n *\n * @param input - A single file path, an array of paths, or undefined\n * @returns The first input file path, or an empty string if none available\n */\nfunction getFirstInputFile(input: string | string[] | undefined): string {\n if (typeof input === \"string\") {\n return input;\n }\n if (Array.isArray(input) && input.length > 0) {\n return input[0] ?? \"\";\n }\n return \"\";\n}\n\n/**\n * Write compressor outputs to files resolved from the provided settings.\n *\n * Resolves a target path for each output entry based on settings.output and settings.input, then writes each entry's content to its resolved file location.\n *\n * @param outputs - Array of compressor output entries (each entry typically contains `content` and optional `format`) to be written.\n * @param settings - Settings used to resolve target paths (may supply `output` pattern/array and `input` for deriving names).\n * @param index - Optional numeric index forwarded to the file writer for each write operation.\n */\nasync function writeMultipleOutputs<\n T extends CompressorOptions = CompressorOptions,\n>(\n outputs: NonNullable<CompressorResult[\"outputs\"]>,\n settings: Settings<T>,\n index?: number\n): Promise<void> {\n const output = settings.output;\n const isArrayOutput = Array.isArray(output);\n const outputsArray = isArrayOutput ? output : [output];\n const inputFile = getFirstInputFile(settings.input);\n const inputDir = parse(inputFile).dir;\n const inputBase = parse(inputFile).name;\n\n const promises = outputs.map(async (outputResult, i) => {\n if (!outputResult) {\n return;\n }\n\n // Write outputs in parallel to improve performance\n const format = outputResult.format || \"out\";\n let targetFile: string;\n\n const arrayItem = outputsArray[i];\n\n if (\n isArrayOutput &&\n arrayItem !== undefined &&\n arrayItem !== \"$1\" &&\n arrayItem.trim() !== \"\"\n ) {\n // Explicit output path provided in array - use as-is\n targetFile = arrayItem;\n } else if (typeof output === \"string\" && output === \"$1\") {\n // $1 only: auto-generate from input filename in input directory\n const baseName = inputBase || \"output\";\n targetFile = inputDir\n ? join(inputDir, `${baseName}.${format}`)\n : `${baseName}.${format}`;\n } else if (typeof output === \"string\" && output.includes(\"$1\")) {\n // $1 pattern in path: replace and append format\n const extensionlessName = inputBase || \"output\";\n const outputFile = output.replace(/\\$1/g, extensionlessName);\n targetFile = `${outputFile}.${format}`;\n } else if (typeof output === \"string\") {\n // Single string output: append format extension\n targetFile = `${output}.${format}`;\n } else {\n // Fallback\n const baseName = inputBase || \"output\";\n targetFile = inputDir\n ? join(inputDir, `${baseName}.${format}`)\n : `${baseName}.${format}`;\n }\n\n await writeFileAsync({\n file: targetFile,\n content: outputResult.content,\n index,\n });\n });\n\n await Promise.all(promises);\n}\n\n/**\n * Resolve the configured source map path or URL from the provided settings.\n *\n * @param settings - Minifier settings that may include `options.sourceMap` or `options._sourceMap`\n * @returns The source map URL or filename when configured, `undefined` otherwise.\n */\nfunction getSourceMapUrl<T extends CompressorOptions = CompressorOptions>(\n settings: Settings<T>\n): string | undefined {\n const options = settings.options as Record<string, unknown> | undefined;\n if (!options) {\n return undefined;\n }\n\n const sourceMap = options.sourceMap as Record<string, unknown> | undefined;\n if (sourceMap) {\n if (typeof sourceMap.url === \"string\") {\n return sourceMap.url;\n }\n if (typeof sourceMap.filename === \"string\") {\n return sourceMap.filename;\n }\n }\n\n const _sourceMap = options._sourceMap as\n | Record<string, unknown>\n | undefined;\n if (_sourceMap && typeof _sourceMap.url === \"string\") {\n return _sourceMap.url;\n }\n\n return undefined;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAyBA,eAAsB,IAAqD,EACvE,UACA,SACA,SACoC;AACpC,KAAI,CAAC,SACD,OAAM,IAAI,gBAAgB,4BAA4B;AAG1D,KAAI,CAAC,SAAS,WACV,OAAM,IAAI,gBAAgB,0CAA0C;CAGxE,MAAM,SAAS,MAAM,SAAS,WAAW;EACrC;EACA;EACA;EACH,CAAC;AAEF,0BAAyB,QAAQ,SAAS;AAE1C,OAAM,YAAY,QAAQ,UAAU,MAAM;AAE1C,QAAO,OAAO;;;;;;;;;AAUlB,SAAS,yBAEP,QAAiB,UAA2D;AAC1E,KAAI,CAAC,UAAU,OAAO,WAAW,SAE7B,OAAM,IAAI,gBACN,eAFU,SAAS,mBAAmB,aAEjB,sEACxB;CAGL,MAAM,MAAM;AACZ,KAAI,EAAE,UAAU,QAAQ,OAAO,IAAI,SAAS,SAExC,OAAM,IAAI,gBACN,eAFU,SAAS,mBAAmB,aAEjB,uCAAuC,KAAK,UAAU,OAAO,KAAK,IAAI,CAAC,GAC/F;;;;;;;;;;;AAaT,eAAe,YACX,QACA,UACA,OACa;AAEb,KADuB,QAAQ,SAAS,QAAQ,IAC1B,CAAC,SAAS,OAC5B;AAIJ,KAAI,OAAO,WAAW,OAAO,QAAQ,SAAS,GAAG;AAC7C,QAAM,qBAAqB,OAAO,SAAS,UAAU,MAAM;AAC3D;;AAIJ,KAAI,OAAO,QAAQ;AACf,QAAM,eAAe;GACjB,MAAM,SAAS;GACf,SAAS,OAAO;GAChB;GACH,CAAC;AACF;;CAIJ,MAAM,gBAAgB,CAClB,eAAe;EACX,MAAM,SAAS;EACf,SAAS,OAAO;EAChB;EACH,CAAC,CACL;AAED,KAAI,OAAO,KAAK;EACZ,MAAM,eAAe,gBAAgB,SAAS;AAC9C,MAAI,aACA,eAAc,KACV,eAAe;GACX,MAAM;GACN,SAAS,OAAO;GAChB;GACH,CAAC,CACL;;AAIT,OAAM,QAAQ,IAAI,cAAc;;;;;;;;AASpC,SAAS,kBAAkB,OAA8C;AACrE,KAAI,OAAO,UAAU,SACjB,QAAO;AAEX,KAAI,MAAM,QAAQ,MAAM,IAAI,MAAM,SAAS,EACvC,QAAO,MAAM,MAAM;AAEvB,QAAO;;;;;;;;;;;AAYX,eAAe,qBAGX,SACA,UACA,OACa;CACb,MAAM,SAAS,SAAS;CACxB,MAAM,gBAAgB,MAAM,QAAQ,OAAO;CAC3C,MAAM,eAAe,gBAAgB,SAAS,CAAC,OAAO;CACtD,MAAM,YAAY,kBAAkB,SAAS,MAAM;CACnD,MAAM,WAAW,MAAM,UAAU,CAAC;CAClC,MAAM,YAAY,MAAM,UAAU,CAAC;CAEnC,MAAM,WAAW,QAAQ,IAAI,OAAO,cAAc,MAAM;AACpD,MAAI,CAAC,aACD;EAIJ,MAAM,SAAS,aAAa,UAAU;EACtC,IAAIA;EAEJ,MAAM,YAAY,aAAa;AAE/B,MACI,iBACA,cAAc,UACd,cAAc,QACd,UAAU,MAAM,KAAK,GAGrB,cAAa;WACN,OAAO,WAAW,YAAY,WAAW,MAAM;GAEtD,MAAM,WAAW,aAAa;AAC9B,gBAAa,WACP,KAAK,UAAU,GAAG,SAAS,GAAG,SAAS,GACvC,GAAG,SAAS,GAAG;aACd,OAAO,WAAW,YAAY,OAAO,SAAS,KAAK,EAAE;GAE5D,MAAM,oBAAoB,aAAa;AAEvC,gBAAa,GADM,OAAO,QAAQ,QAAQ,kBAAkB,CACjC,GAAG;aACvB,OAAO,WAAW,SAEzB,cAAa,GAAG,OAAO,GAAG;OACvB;GAEH,MAAM,WAAW,aAAa;AAC9B,gBAAa,WACP,KAAK,UAAU,GAAG,SAAS,GAAG,SAAS,GACvC,GAAG,SAAS,GAAG;;AAGzB,QAAM,eAAe;GACjB,MAAM;GACN,SAAS,aAAa;GACtB;GACH,CAAC;GACJ;AAEF,OAAM,QAAQ,IAAI,SAAS;;;;;;;;AAS/B,SAAS,gBACL,UACkB;CAClB,MAAM,UAAU,SAAS;AACzB,KAAI,CAAC,QACD;CAGJ,MAAM,YAAY,QAAQ;AAC1B,KAAI,WAAW;AACX,MAAI,OAAO,UAAU,QAAQ,SACzB,QAAO,UAAU;AAErB,MAAI,OAAO,UAAU,aAAa,SAC9B,QAAO,UAAU;;CAIzB,MAAM,aAAa,QAAQ;AAG3B,KAAI,cAAc,OAAO,WAAW,QAAQ,SACxC,QAAO,WAAW"}
|
package/dist/setFileNameMin.d.ts
CHANGED
package/dist/setFileNameMin.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { n as ValidationError } from "./error-
|
|
1
|
+
import { n as ValidationError } from "./error-Ctspysdk.js";
|
|
2
2
|
|
|
3
3
|
//#region src/setFileNameMin.ts
|
|
4
4
|
/*!
|
|
5
5
|
* node-minify
|
|
6
|
-
* Copyright(c) 2011-
|
|
6
|
+
* Copyright (c) 2011-2026 Rodolphe Stoclin
|
|
7
7
|
* MIT Licensed
|
|
8
8
|
*/
|
|
9
9
|
/**
|