@node-minify/utils 10.1.1 → 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/README.md +4 -4
- package/dist/buildArgs.js +2 -2
- package/dist/buildArgs.js.map +1 -1
- package/dist/compressSingleFile.d.ts +6 -4
- package/dist/compressSingleFile.d.ts.map +1 -1
- package/dist/compressSingleFile.js +27 -9
- 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 +18 -0
- package/dist/ensureStringContent.d.ts.map +1 -0
- package/dist/ensureStringContent.js +23 -0
- package/dist/ensureStringContent.js.map +1 -0
- package/dist/{error-B_uK-F18.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 +11 -2
- package/dist/getContentFromFiles.d.ts.map +1 -1
- package/dist/getContentFromFiles.js +38 -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 +9 -5
- package/dist/index.js +9 -5
- 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-BW5AgBWb.js +46 -0
- package/dist/isValidFile-BW5AgBWb.js.map +1 -0
- package/dist/isValidFile.d.ts +10 -2
- package/dist/isValidFile.d.ts.map +1 -1
- package/dist/isValidFile.js +2 -2
- 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 +25 -3
- package/dist/readFile.d.ts.map +1 -1
- package/dist/readFile.js +31 -7
- package/dist/readFile.js.map +1 -1
- package/dist/run.d.ts +10 -12
- package/dist/run.d.ts.map +1 -1
- package/dist/run.js +114 -12
- 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-DtDQlx-T.d.ts → types-CzkB7gxg.d.ts} +51 -4
- 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 +30 -10
- package/dist/writeFile.d.ts.map +1 -1
- package/dist/writeFile.js +2 -2
- package/package.json +2 -2
- package/dist/error-B_uK-F18.js.map +0 -1
- package/dist/isValidFile-UAwceQud.js +0 -30
- package/dist/isValidFile-UAwceQud.js.map +0 -1
- package/dist/types-DtDQlx-T.d.ts.map +0 -1
- package/dist/writeFile-CwK9ZWXr.js +0 -37
- package/dist/writeFile-CwK9ZWXr.js.map +0 -1
package/dist/run.js
CHANGED
|
@@ -1,12 +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
|
+
import { join, parse } from "node:path";
|
|
3
4
|
|
|
4
5
|
//#region src/run.ts
|
|
6
|
+
/*!
|
|
7
|
+
* node-minify
|
|
8
|
+
* Copyright (c) 2011-2026 Rodolphe Stoclin
|
|
9
|
+
* MIT Licensed
|
|
10
|
+
*/
|
|
5
11
|
/**
|
|
6
|
-
* Execute the compressor and
|
|
7
|
-
*
|
|
8
|
-
* @
|
|
9
|
-
* @
|
|
12
|
+
* Execute the configured compressor and persist its outputs according to the provided settings.
|
|
13
|
+
*
|
|
14
|
+
* @param settings - Compressor settings including output targets, options, and the `compressor` implementation
|
|
15
|
+
* @param content - The input content to be compressed
|
|
16
|
+
* @param index - Optional index used when processing multiple inputs
|
|
17
|
+
* @returns The minified code produced by the compressor
|
|
18
|
+
* @throws ValidationError If `settings` is missing, `settings.compressor` is not provided, or the compressor returns an invalid result
|
|
10
19
|
*/
|
|
11
20
|
async function run({ settings, content, index }) {
|
|
12
21
|
if (!settings) throw new ValidationError("Settings must be provided");
|
|
@@ -16,25 +25,118 @@ async function run({ settings, content, index }) {
|
|
|
16
25
|
content,
|
|
17
26
|
index
|
|
18
27
|
});
|
|
19
|
-
|
|
28
|
+
validateCompressorResult(result, settings);
|
|
29
|
+
await writeOutput(result, settings, index);
|
|
20
30
|
return result.code;
|
|
21
31
|
}
|
|
22
|
-
|
|
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
|
+
/**
|
|
45
|
+
* Write compressor result outputs to disk unless the operation is in-memory.
|
|
46
|
+
*
|
|
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.
|
|
48
|
+
*
|
|
49
|
+
* @param result - The compressor result containing `code`, optional `buffer`, `map`, or `outputs` describing one or more outputs
|
|
50
|
+
* @param settings - Settings that include output destination(s) and optional in-memory `content` which disables disk writes
|
|
51
|
+
* @param index - Optional index used when writing to multiple targets or when tracking a particular input within a batch
|
|
52
|
+
*/
|
|
53
|
+
async function writeOutput(result, settings, index) {
|
|
23
54
|
if (Boolean(settings.content) || !settings.output) return;
|
|
24
|
-
|
|
55
|
+
if (result.outputs && result.outputs.length > 0) {
|
|
56
|
+
await writeMultipleOutputs(result.outputs, settings, index);
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
if (result.buffer) {
|
|
60
|
+
await writeFileAsync({
|
|
61
|
+
file: settings.output,
|
|
62
|
+
content: result.buffer,
|
|
63
|
+
index
|
|
64
|
+
});
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
const writePromises = [writeFileAsync({
|
|
25
68
|
file: settings.output,
|
|
26
69
|
content: result.code,
|
|
27
70
|
index
|
|
28
|
-
});
|
|
71
|
+
})];
|
|
29
72
|
if (result.map) {
|
|
30
73
|
const sourceMapUrl = getSourceMapUrl(settings);
|
|
31
|
-
if (sourceMapUrl)
|
|
74
|
+
if (sourceMapUrl) writePromises.push(writeFileAsync({
|
|
32
75
|
file: sourceMapUrl,
|
|
33
76
|
content: result.map,
|
|
34
77
|
index
|
|
35
|
-
});
|
|
78
|
+
}));
|
|
36
79
|
}
|
|
80
|
+
await Promise.all(writePromises);
|
|
37
81
|
}
|
|
82
|
+
/**
|
|
83
|
+
* Extract the first input file path from the input configuration.
|
|
84
|
+
*
|
|
85
|
+
* @param input - A single file path, an array of paths, or undefined
|
|
86
|
+
* @returns The first input file path, or an empty string if none available
|
|
87
|
+
*/
|
|
88
|
+
function getFirstInputFile(input) {
|
|
89
|
+
if (typeof input === "string") return input;
|
|
90
|
+
if (Array.isArray(input) && input.length > 0) return input[0] ?? "";
|
|
91
|
+
return "";
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Write compressor outputs to files resolved from the provided settings.
|
|
95
|
+
*
|
|
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.
|
|
97
|
+
*
|
|
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.
|
|
101
|
+
*/
|
|
102
|
+
async function writeMultipleOutputs(outputs, settings, index) {
|
|
103
|
+
const output = settings.output;
|
|
104
|
+
const isArrayOutput = Array.isArray(output);
|
|
105
|
+
const outputsArray = isArrayOutput ? output : [output];
|
|
106
|
+
const inputFile = getFirstInputFile(settings.input);
|
|
107
|
+
const inputDir = parse(inputFile).dir;
|
|
108
|
+
const inputBase = parse(inputFile).name;
|
|
109
|
+
const promises = outputs.map(async (outputResult, i) => {
|
|
110
|
+
if (!outputResult) return;
|
|
111
|
+
const format = outputResult.format || "out";
|
|
112
|
+
let targetFile;
|
|
113
|
+
const arrayItem = outputsArray[i];
|
|
114
|
+
if (isArrayOutput && arrayItem !== void 0 && arrayItem !== "$1" && arrayItem.trim() !== "") targetFile = arrayItem;
|
|
115
|
+
else if (typeof output === "string" && output === "$1") {
|
|
116
|
+
const baseName = inputBase || "output";
|
|
117
|
+
targetFile = inputDir ? join(inputDir, `${baseName}.${format}`) : `${baseName}.${format}`;
|
|
118
|
+
} else if (typeof output === "string" && output.includes("$1")) {
|
|
119
|
+
const extensionlessName = inputBase || "output";
|
|
120
|
+
targetFile = `${output.replace(/\$1/g, extensionlessName)}.${format}`;
|
|
121
|
+
} else if (typeof output === "string") targetFile = `${output}.${format}`;
|
|
122
|
+
else {
|
|
123
|
+
const baseName = inputBase || "output";
|
|
124
|
+
targetFile = inputDir ? join(inputDir, `${baseName}.${format}`) : `${baseName}.${format}`;
|
|
125
|
+
}
|
|
126
|
+
await writeFileAsync({
|
|
127
|
+
file: targetFile,
|
|
128
|
+
content: outputResult.content,
|
|
129
|
+
index
|
|
130
|
+
});
|
|
131
|
+
});
|
|
132
|
+
await Promise.all(promises);
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Resolve the configured source map path or URL from the provided settings.
|
|
136
|
+
*
|
|
137
|
+
* @param settings - Minifier settings that may include `options.sourceMap` or `options._sourceMap`
|
|
138
|
+
* @returns The source map URL or filename when configured, `undefined` otherwise.
|
|
139
|
+
*/
|
|
38
140
|
function getSourceMapUrl(settings) {
|
|
39
141
|
const options = settings.options;
|
|
40
142
|
if (!options) return;
|
package/dist/run.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run.js","names":[],"sources":["../src/run.ts"],"sourcesContent":["/*!\n * node-minify\n * Copyright(c) 2011-2025 Rodolphe Stoclin\n * MIT Licensed\n */\n\nimport type { CompressorResult, Settings } from \"@node-minify/types\";\nimport { ValidationError } from \"./error.ts\";\nimport { writeFile } from \"./writeFile.ts\";\n\ninterface RunParameters {\n settings: Settings;\n content?: string;\n index?: number;\n}\n\n/**\n * Execute the compressor and write output.\n * @param params - Run parameters containing settings, content, and index\n * @returns Minified content string\n * @throws {ValidationError} If settings or compressor is missing\n */\nexport async function run({\n settings,\n content,\n index,\n}: RunParameters): 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\nfunction writeOutput(\n result: CompressorResult,\n settings: Settings,\n index?: number\n): void {\n const isInMemoryMode = Boolean(settings.content);\n if (isInMemoryMode || !settings.output) {\n return;\n }\n\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\nfunction getSourceMapUrl(settings: Settings): 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":";;;;;;;;;;AAsBA,eAAsB,IAAI,EACtB,UACA,SACA,SAC+B;AAC/B,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;;AAGlB,SAAS,YACL,QACA,UACA,OACI;AAEJ,KADuB,QAAQ,SAAS,QAAQ,IAC1B,CAAC,SAAS,OAC5B;AAGJ,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;;;AAKzE,SAAS,gBAAgB,UAAwC;CAC7D,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
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setFileNameMin.js","names":[],"sources":["../src/setFileNameMin.ts"],"sourcesContent":["/*!\n * node-minify\n * Copyright(c) 2011-
|
|
1
|
+
{"version":3,"file":"setFileNameMin.js","names":[],"sources":["../src/setFileNameMin.ts"],"sourcesContent":["/*!\n * node-minify\n * Copyright (c) 2011-2026 Rodolphe Stoclin\n * MIT Licensed\n */\n\nimport { ValidationError } from \"./error.ts\";\n\n/**\n * Set the file name as minified.\n * @param file Original file path\n * @param output Output pattern (use $1 as placeholder for filename)\n * @param publicFolder Optional public folder prefix\n * @param replaceInPlace Whether to keep original path\n * @returns Minified file path\n * @throws {ValidationError} If input parameters are invalid\n * @example\n * setFileNameMin('src/file.js', '$1.min.js') // 'src/file.min.js'\n * setFileNameMin('file.js', '$1.min.js', 'public/') // 'public/file.min.js'\n */\nexport function setFileNameMin(\n file: string,\n output: string,\n publicFolder?: string,\n replaceInPlace?: boolean\n): string {\n if (!file || typeof file !== \"string\") {\n throw new ValidationError(\"File path must be a non-empty string\");\n }\n\n if (!output || typeof output !== \"string\" || !output.includes(\"$1\")) {\n throw new ValidationError(\n 'Output pattern must be a string containing \"$1\"'\n );\n }\n\n try {\n const lastSlashIndex = file.lastIndexOf(\"/\");\n const filePath = file.substring(0, lastSlashIndex + 1);\n const fileWithoutPath = file.substring(lastSlashIndex + 1);\n const lastDotIndex = fileWithoutPath.lastIndexOf(\".\");\n\n if (lastDotIndex === -1) {\n throw new ValidationError(\"File must have an extension\");\n }\n\n let fileWithoutExtension = fileWithoutPath.substring(0, lastDotIndex);\n\n if (publicFolder) {\n if (typeof publicFolder !== \"string\") {\n throw new ValidationError(\"Public folder must be a string\");\n }\n fileWithoutExtension = publicFolder + fileWithoutExtension;\n }\n\n if (replaceInPlace) {\n fileWithoutExtension = filePath + fileWithoutExtension;\n }\n\n return output.replace(\"$1\", fileWithoutExtension);\n } catch (error) {\n if (error instanceof ValidationError) {\n throw error;\n }\n throw new ValidationError(\n `Failed to process file name: ${error instanceof Error ? error.message : String(error)}`\n );\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAoBA,SAAgB,eACZ,MACA,QACA,cACA,gBACM;AACN,KAAI,CAAC,QAAQ,OAAO,SAAS,SACzB,OAAM,IAAI,gBAAgB,uCAAuC;AAGrE,KAAI,CAAC,UAAU,OAAO,WAAW,YAAY,CAAC,OAAO,SAAS,KAAK,CAC/D,OAAM,IAAI,gBACN,oDACH;AAGL,KAAI;EACA,MAAM,iBAAiB,KAAK,YAAY,IAAI;EAC5C,MAAM,WAAW,KAAK,UAAU,GAAG,iBAAiB,EAAE;EACtD,MAAM,kBAAkB,KAAK,UAAU,iBAAiB,EAAE;EAC1D,MAAM,eAAe,gBAAgB,YAAY,IAAI;AAErD,MAAI,iBAAiB,GACjB,OAAM,IAAI,gBAAgB,8BAA8B;EAG5D,IAAI,uBAAuB,gBAAgB,UAAU,GAAG,aAAa;AAErE,MAAI,cAAc;AACd,OAAI,OAAO,iBAAiB,SACxB,OAAM,IAAI,gBAAgB,iCAAiC;AAE/D,0BAAuB,eAAe;;AAG1C,MAAI,eACA,wBAAuB,WAAW;AAGtC,SAAO,OAAO,QAAQ,MAAM,qBAAqB;UAC5C,OAAO;AACZ,MAAI,iBAAiB,gBACjB,OAAM;AAEV,QAAM,IAAI,gBACN,gCAAgC,iBAAiB,QAAQ,MAAM,UAAU,OAAO,MAAM,GACzF"}
|
package/dist/setPublicFolder.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setPublicFolder.js","names":[],"sources":["../src/setPublicFolder.ts"],"sourcesContent":["/*!\n * node-minify\n * Copyright(c) 2011-
|
|
1
|
+
{"version":3,"file":"setPublicFolder.js","names":[],"sources":["../src/setPublicFolder.ts"],"sourcesContent":["/*!\n * node-minify\n * Copyright (c) 2011-2026 Rodolphe Stoclin\n * MIT Licensed\n */\n\nimport path from \"node:path\";\n\n/**\n * Prepend the public folder to each file.\n * @param input Path to file(s)\n * @param publicFolder Path to the public folder\n */\nexport function setPublicFolder(\n input: string | string[],\n publicFolder: string\n) {\n if (typeof publicFolder !== \"string\") {\n return {};\n }\n\n const normalizedPublicFolder = path.normalize(publicFolder);\n\n const addPublicFolder = (item: string) => {\n const normalizedPath = path.normalize(item);\n return normalizedPath.includes(normalizedPublicFolder)\n ? normalizedPath\n : path.normalize(normalizedPublicFolder + item);\n };\n\n return {\n input: Array.isArray(input)\n ? input.map(addPublicFolder)\n : addPublicFolder(input),\n };\n}\n"],"mappings":";;;;;;;;;;;;;AAaA,SAAgB,gBACZ,OACA,cACF;AACE,KAAI,OAAO,iBAAiB,SACxB,QAAO,EAAE;CAGb,MAAM,yBAAyB,KAAK,UAAU,aAAa;CAE3D,MAAM,mBAAmB,SAAiB;EACtC,MAAM,iBAAiB,KAAK,UAAU,KAAK;AAC3C,SAAO,eAAe,SAAS,uBAAuB,GAChD,iBACA,KAAK,UAAU,yBAAyB,KAAK;;AAGvD,QAAO,EACH,OAAO,MAAM,QAAQ,MAAM,GACrB,MAAM,IAAI,gBAAgB,GAC1B,gBAAgB,MAAM,EAC/B"}
|
|
@@ -1,11 +1,47 @@
|
|
|
1
1
|
//#region ../types/src/types.d.ts
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* Output result for multi-format image compression.
|
|
5
|
+
*/
|
|
6
|
+
type CompressorOutput = {
|
|
7
|
+
/**
|
|
8
|
+
* Format of the output (e.g., 'webp', 'avif').
|
|
9
|
+
*/
|
|
10
|
+
format?: string;
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Output content as string or Buffer.
|
|
14
|
+
*/
|
|
15
|
+
content: string | Buffer;
|
|
16
|
+
};
|
|
3
17
|
/**
|
|
4
18
|
* Result returned by a compressor function.
|
|
5
19
|
*/
|
|
6
20
|
type CompressorResult = {
|
|
21
|
+
/**
|
|
22
|
+
* Minified content as string (for text-based formats like JS, CSS, HTML, SVG).
|
|
23
|
+
*/
|
|
7
24
|
code: string;
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Source map (for JS/CSS compressors).
|
|
28
|
+
*/
|
|
8
29
|
map?: string;
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Minified content as Buffer (for binary formats like images).
|
|
33
|
+
* @example
|
|
34
|
+
* When using sharp for PNG/WebP compression
|
|
35
|
+
*/
|
|
36
|
+
buffer?: Buffer;
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Multiple outputs for multi-format image compression.
|
|
40
|
+
* Used when converting to multiple formats simultaneously.
|
|
41
|
+
* @example
|
|
42
|
+
* [{ format: 'webp', content: <Buffer> }, { format: 'avif', content: <Buffer> }]
|
|
43
|
+
*/
|
|
44
|
+
outputs?: CompressorOutput[];
|
|
9
45
|
};
|
|
10
46
|
/**
|
|
11
47
|
* Base options that all compressors can accept.
|
|
@@ -53,8 +89,10 @@ type Settings<TOptions extends CompressorOptions = CompressorOptions> = {
|
|
|
53
89
|
/**
|
|
54
90
|
* Content to minify (for in-memory minification).
|
|
55
91
|
* If provided, input/output are not required.
|
|
92
|
+
* For text-based formats (JS, CSS, HTML, SVG): string
|
|
93
|
+
* For binary formats (images): Buffer (handled internally by image compressors)
|
|
56
94
|
*/
|
|
57
|
-
content?: string;
|
|
95
|
+
content?: string | Buffer;
|
|
58
96
|
|
|
59
97
|
/**
|
|
60
98
|
* Input file path(s) or glob pattern.
|
|
@@ -97,6 +135,12 @@ type Settings<TOptions extends CompressorOptions = CompressorOptions> = {
|
|
|
97
135
|
*/
|
|
98
136
|
buffer?: number;
|
|
99
137
|
|
|
138
|
+
/**
|
|
139
|
+
* Timeout for the compressor process (in milliseconds).
|
|
140
|
+
* If execution exceeds this limit, the process will be killed.
|
|
141
|
+
*/
|
|
142
|
+
timeout?: number;
|
|
143
|
+
|
|
100
144
|
/**
|
|
101
145
|
* File type for compressors that support multiple types.
|
|
102
146
|
* Required for YUI compressor.
|
|
@@ -136,8 +180,11 @@ type MinifierOptions<TOptions extends CompressorOptions = CompressorOptions> = {
|
|
|
136
180
|
|
|
137
181
|
/**
|
|
138
182
|
* The content to minify.
|
|
183
|
+
* For text-based formats (JS, CSS, HTML, SVG): string
|
|
184
|
+
* For binary formats (images): Buffer
|
|
185
|
+
* For multiple binary files: Buffer[]
|
|
139
186
|
*/
|
|
140
|
-
content?: string;
|
|
187
|
+
content?: string | Buffer | Buffer[];
|
|
141
188
|
|
|
142
189
|
/**
|
|
143
190
|
* Index of current file when processing multiple files.
|
|
@@ -145,5 +192,5 @@ type MinifierOptions<TOptions extends CompressorOptions = CompressorOptions> = {
|
|
|
145
192
|
index?: number;
|
|
146
193
|
};
|
|
147
194
|
//#endregion
|
|
148
|
-
export { Settings as t };
|
|
149
|
-
//# sourceMappingURL=types-
|
|
195
|
+
export { Settings as i, CompressorOptions as n, MinifierOptions as r, Compressor as t };
|
|
196
|
+
//# sourceMappingURL=types-CzkB7gxg.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types-CzkB7gxg.d.ts","names":["CompressorReturnType","ImageFormat","CompressorOutput","Buffer","CompressorResult","CompressorOptions","Record","Compressor","TOptions","MinifierOptions","Promise","FileType","Settings","Result","MinifyOptions"],"sources":["../../types/src/types.d.ts"],"sourcesContent":["/*!\n * node-minify\n * Copyright (c) 2011-2026 Rodolphe Stoclin\n * MIT Licensed\n */\n\n/**\n * The return type of a compressor function.\n * @deprecated Use `CompressorResult` instead. Will be removed in v11.\n */\nexport type CompressorReturnType = string;\n\n/**\n * Supported image formats for image compression.\n */\nexport type ImageFormat =\n | \"webp\"\n | \"avif\"\n | \"png\"\n | \"jpeg\"\n | \"jpg\"\n | \"gif\"\n | \"tiff\"\n | \"heif\"\n | \"heic\";\n\n/**\n * Output result for multi-format image compression.\n */\nexport type CompressorOutput = {\n /**\n * Format of the output (e.g., 'webp', 'avif').\n */\n format?: string;\n\n /**\n * Output content as string or Buffer.\n */\n content: string | Buffer;\n};\n\n/**\n * Result returned by a compressor function.\n */\nexport type CompressorResult = {\n /**\n * Minified content as string (for text-based formats like JS, CSS, HTML, SVG).\n */\n code: string;\n\n /**\n * Source map (for JS/CSS compressors).\n */\n map?: string;\n\n /**\n * Minified content as Buffer (for binary formats like images).\n * @example\n * When using sharp for PNG/WebP compression\n */\n buffer?: Buffer;\n\n /**\n * Multiple outputs for multi-format image compression.\n * Used when converting to multiple formats simultaneously.\n * @example\n * [{ format: 'webp', content: <Buffer> }, { format: 'avif', content: <Buffer> }]\n */\n outputs?: CompressorOutput[];\n};\n\n/**\n * Base options that all compressors can accept.\n * Specific compressors may extend this with their own options.\n */\nexport type CompressorOptions = Record<string, unknown>;\n\n/**\n * A compressor function that minifies content.\n * @param args - The minifier options including settings and content\n * @returns A promise resolving to the compression result\n */\nexport type Compressor<TOptions extends CompressorOptions = CompressorOptions> =\n (args: MinifierOptions<TOptions>) => Promise<CompressorResult>;\n\n/**\n * File type for compressors that support multiple types (e.g., YUI).\n */\nexport type FileType = \"js\" | \"css\";\n\n/**\n * User-facing settings for the minify function.\n * This is what users pass when calling minify().\n *\n * @example\n * ```ts\n * import { minify } from '@node-minify/core';\n * import { terser } from '@node-minify/terser';\n *\n * await minify({\n * compressor: terser,\n * input: 'src/*.js',\n * output: 'dist/bundle.min.js',\n * options: { mangle: true }\n * });\n * ```\n */\nexport type Settings<TOptions extends CompressorOptions = CompressorOptions> = {\n /**\n * The compressor function to use for minification.\n */\n compressor: Compressor<TOptions>;\n\n /**\n * Optional label for the compressor (used in logging).\n */\n compressorLabel?: string;\n\n /**\n * Content to minify (for in-memory minification).\n * If provided, input/output are not required.\n * For text-based formats (JS, CSS, HTML, SVG): string\n * For binary formats (images): Buffer (handled internally by image compressors)\n */\n content?: string | Buffer;\n\n /**\n * Input file path(s) or glob pattern.\n * Can be a single file, array of files, or wildcard pattern.\n *\n * @example\n * - 'src/app.js'\n * - ['src/a.js', 'src/b.js']\n * - 'src/**\\/*.js'\n */\n input?: string | string[];\n\n /**\n * Output file path.\n * Use $1 as placeholder for input filename in multi-file scenarios.\n * Can be a single file, array of files, or pattern with $1.\n *\n * @example\n * - 'dist/bundle.min.js'\n * - ['file1.min.js', 'file2.min.js']\n * - '$1.min.js' (creates app.min.js from app.js)\n */\n output?: string | string[];\n\n /**\n * Compressor-specific options.\n * See individual compressor documentation for available options.\n */\n options?: TOptions;\n\n /**\n * CLI option string (used by CLI only).\n * @internal\n */\n option?: string;\n\n /**\n * Buffer size for file operations (in bytes).\n * @default 1024000 (1MB)\n */\n buffer?: number;\n\n /**\n * Timeout for the compressor process (in milliseconds).\n * If execution exceeds this limit, the process will be killed.\n */\n timeout?: number;\n\n /**\n * File type for compressors that support multiple types.\n * Required for YUI compressor.\n */\n type?: FileType;\n\n /**\n * Suppress console output.\n * @default false\n */\n silence?: boolean;\n\n /**\n * Public folder to prepend to input paths.\n *\n * @example\n * With publicFolder: 'public/js/' and input: 'app.js',\n * the actual path becomes 'public/js/app.js'\n */\n publicFolder?: string;\n\n /**\n * Replace files in place instead of creating new output files.\n * @default false\n */\n replaceInPlace?: boolean;\n};\n\n/**\n * Options passed to compressor functions internally.\n * This is what compressors receive, not what users pass.\n */\nexport type MinifierOptions<\n TOptions extends CompressorOptions = CompressorOptions,\n> = {\n /**\n * The full settings object.\n */\n settings: Settings<TOptions>;\n\n /**\n * The content to minify.\n * For text-based formats (JS, CSS, HTML, SVG): string\n * For binary formats (images): Buffer\n * For multiple binary files: Buffer[]\n */\n content?: string | Buffer | Buffer[];\n\n /**\n * Index of current file when processing multiple files.\n */\n index?: number;\n};\n\n/**\n * Result returned after compression (used by CLI).\n */\nexport type Result = {\n /**\n * Label of the compressor used.\n */\n compressorLabel: string;\n\n /**\n * Size of minified content (formatted string, e.g., \"1.5 KB\").\n */\n size: string;\n\n /**\n * Gzipped size of minified content (formatted string).\n */\n sizeGzip: string;\n};\n\n/**\n * Type alias for user convenience.\n * @deprecated Use `Settings` instead. Will be removed in v11.\n */\nexport type MinifyOptions<\n TOptions extends CompressorOptions = CompressorOptions,\n> = Settings<TOptions>;\n"],"mappings":";;;;;AA2NsC,KA9L1BE,gBAAAA,GA8L0B;;;;;;;;;oBArLhBC;;;;;KAMVC,gBAAAA;;;;;;;;;;;;;;;;WAgBCD;;;;;;;;YAQCD;;;;;;KAOFG,iBAAAA,GAAoBC;;;;;;KAOpBC,4BAA4BF,oBAAoBA,4BACjDI,gBAAgBD,cAAcE,QAAQN;;;;KAKrCO,QAAAA;;;;;;;;;;;;;;;;;;KAmBAC,0BAA0BP,oBAAoBA;;;;cAI1CE,WAAWC;;;;;;;;;;;;;qBAaJL;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YA6BTK;;;;;;;;;;;;;;;;;;;;;;;;SAwBHG;;;;;;;;;;;;;;;;;;;;;;;;;;;KA4BCF,iCACSJ,oBAAoBA;;;;YAK3BO,SAASJ;;;;;;;;qBAQAL,SAASA"}
|
package/dist/types.d.ts
CHANGED
package/dist/wildcards.d.ts
CHANGED
package/dist/wildcards.js
CHANGED
package/dist/wildcards.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wildcards.js","names":[],"sources":["../src/wildcards.ts"],"sourcesContent":["/*!\n * node-minify\n * Copyright(c) 2011-
|
|
1
|
+
{"version":3,"file":"wildcards.js","names":[],"sources":["../src/wildcards.ts"],"sourcesContent":["/*!\n * node-minify\n * Copyright (c) 2011-2026 Rodolphe Stoclin\n * MIT Licensed\n */\n\nimport os from \"node:os\";\nimport fg from \"fast-glob\";\n\n/**\n * Check if the platform is Windows\n */\nfunction isWindows() {\n return os.platform() === \"win32\";\n}\n\n/**\n * Handle wildcards in a path, get the real path of each file.\n * @param input - Path with wildcards\n * @param publicFolder - Path to the public folder\n */\nexport function wildcards(input: string | string[], publicFolder?: string) {\n if (Array.isArray(input)) {\n return wildcardsArray(input, publicFolder);\n }\n\n return wildcardsString(input, publicFolder);\n}\n\n/**\n * Handle wildcards in a path (string only), get the real path of each file.\n * @param input - Path with wildcards\n * @param publicFolder - Path to the public folder\n */\nfunction wildcardsString(input: string, publicFolder?: string) {\n if (!input.includes(\"*\")) {\n return {};\n }\n\n const files = getFilesFromWildcards(input, publicFolder);\n const finalPaths = files.filter((path: string) => !path.includes(\"*\"));\n\n return {\n input: finalPaths,\n };\n}\n\n/**\n * Handle wildcards in a path (array only), get the real path of each file.\n * @param input - Array of paths with wildcards\n * @param publicFolder - Path to the public folder\n */\nfunction wildcardsArray(input: string[], publicFolder?: string) {\n // Convert input paths to patterns with public folder prefix\n const inputWithPublicFolder = input.map((item) => {\n const input2 = publicFolder ? publicFolder + item : item;\n return isWindows() ? fg.convertPathToPattern(input2) : input2;\n });\n\n // Check if any wildcards exist\n const hasWildcards = inputWithPublicFolder.some((item) =>\n item.includes(\"*\")\n );\n\n // Process paths based on whether wildcards exist\n const processedPaths = hasWildcards\n ? fg.globSync(inputWithPublicFolder)\n : input;\n\n // Filter out any remaining paths with wildcards\n const finalPaths = processedPaths.filter(\n (path: string) => !path.includes(\"*\")\n );\n\n return { input: finalPaths };\n}\n\n/**\n * Get the real path of each file.\n * @param input - Path with wildcards\n * @param publicFolder - Path to the public folder\n */\nfunction getFilesFromWildcards(input: string, publicFolder?: string) {\n const fullPath = publicFolder ? `${publicFolder}${input}` : input;\n return fg.globSync(\n isWindows() ? fg.convertPathToPattern(fullPath) : fullPath\n );\n}\n"],"mappings":";;;;;;;;;;;;AAYA,SAAS,YAAY;AACjB,QAAO,GAAG,UAAU,KAAK;;;;;;;AAQ7B,SAAgB,UAAU,OAA0B,cAAuB;AACvE,KAAI,MAAM,QAAQ,MAAM,CACpB,QAAO,eAAe,OAAO,aAAa;AAG9C,QAAO,gBAAgB,OAAO,aAAa;;;;;;;AAQ/C,SAAS,gBAAgB,OAAe,cAAuB;AAC3D,KAAI,CAAC,MAAM,SAAS,IAAI,CACpB,QAAO,EAAE;AAMb,QAAO,EACH,OAJU,sBAAsB,OAAO,aAAa,CAC/B,QAAQ,SAAiB,CAAC,KAAK,SAAS,IAAI,CAAC,EAIrE;;;;;;;AAQL,SAAS,eAAe,OAAiB,cAAuB;CAE5D,MAAM,wBAAwB,MAAM,KAAK,SAAS;EAC9C,MAAM,SAAS,eAAe,eAAe,OAAO;AACpD,SAAO,WAAW,GAAG,GAAG,qBAAqB,OAAO,GAAG;GACzD;AAiBF,QAAO,EAAE,QAdY,sBAAsB,MAAM,SAC7C,KAAK,SAAS,IAAI,CACrB,GAIK,GAAG,SAAS,sBAAsB,GAClC,OAG4B,QAC7B,SAAiB,CAAC,KAAK,SAAS,IAAI,CACxC,EAE2B;;;;;;;AAQhC,SAAS,sBAAsB,OAAe,cAAuB;CACjE,MAAM,WAAW,eAAe,GAAG,eAAe,UAAU;AAC5D,QAAO,GAAG,SACN,WAAW,GAAG,GAAG,qBAAqB,SAAS,GAAG,SACrD"}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import { n as ValidationError, t as FileOperationError } from "./error-Ctspysdk.js";
|
|
2
|
+
import { lstatSync, writeFileSync } from "node:fs";
|
|
3
|
+
import { lstat, writeFile } from "node:fs/promises";
|
|
4
|
+
|
|
5
|
+
//#region src/writeFile.ts
|
|
6
|
+
/*!
|
|
7
|
+
* node-minify
|
|
8
|
+
* Copyright (c) 2011-2026 Rodolphe Stoclin
|
|
9
|
+
* MIT Licensed
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
* Write provided content to a target file.
|
|
13
|
+
*
|
|
14
|
+
* When `file` is an array and `index` is provided, the file at that index is used; otherwise `file` is used directly.
|
|
15
|
+
*
|
|
16
|
+
* @param file - Target path or array of target paths
|
|
17
|
+
* @param content - Content to write; may be a `string` or `Buffer`
|
|
18
|
+
* @param index - Optional index to select a file when `file` is an array
|
|
19
|
+
* @returns The same `content` value that was written
|
|
20
|
+
* @throws ValidationError If no target file, no content, or the resolved target path is invalid
|
|
21
|
+
* @throws FileOperationError If the underlying filesystem write fails (wraps the original error)
|
|
22
|
+
*/
|
|
23
|
+
function writeFile$1({ file, content, index }) {
|
|
24
|
+
try {
|
|
25
|
+
const targetFile = resolveTargetFile(file, index);
|
|
26
|
+
validateContent(content);
|
|
27
|
+
if (isDirectory(targetFile)) throw new Error("Target path exists and is a directory");
|
|
28
|
+
writeFileSync(targetFile, content, Buffer.isBuffer(content) ? void 0 : "utf8");
|
|
29
|
+
return content;
|
|
30
|
+
} catch (error) {
|
|
31
|
+
handleWriteError(error, file);
|
|
32
|
+
return content;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Write content to a resolved target file path.
|
|
37
|
+
*
|
|
38
|
+
* Resolves the target from `file` (string or array) using `index` when provided, validates the content,
|
|
39
|
+
* ensures the target is not a directory, and writes the content to disk.
|
|
40
|
+
*
|
|
41
|
+
* @param file - Target path or array of target paths; when `file` is an array, `index` selects the entry
|
|
42
|
+
* @param content - Content to write; a `string` or `Buffer`
|
|
43
|
+
* @param index - Optional index used to select a file when `file` is an array
|
|
44
|
+
* @returns The same `content` value that was written
|
|
45
|
+
* @throws ValidationError If no target file, no content, or the resolved target path is invalid
|
|
46
|
+
* @throws FileOperationError If the underlying filesystem write fails (wraps the original error)
|
|
47
|
+
*/
|
|
48
|
+
async function writeFileAsync({ file, content, index }) {
|
|
49
|
+
try {
|
|
50
|
+
const targetFile = resolveTargetFile(file, index);
|
|
51
|
+
validateContent(content);
|
|
52
|
+
if (await isDirectoryAsync(targetFile)) throw new Error("Target path exists and is a directory");
|
|
53
|
+
await writeFile(targetFile, content, Buffer.isBuffer(content) ? void 0 : "utf8");
|
|
54
|
+
return content;
|
|
55
|
+
} catch (error) {
|
|
56
|
+
handleWriteError(error, file);
|
|
57
|
+
return content;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Resolve a target file path from a string or an array of paths, optionally selecting by index.
|
|
62
|
+
*
|
|
63
|
+
* @param file - A file path or an array of file paths to resolve from.
|
|
64
|
+
* @param index - Optional index to select an entry when `file` is an array; ignored if not provided.
|
|
65
|
+
* @returns The resolved file path.
|
|
66
|
+
* @throws ValidationError if no file is provided or the resolved target is not a string.
|
|
67
|
+
*/
|
|
68
|
+
function resolveTargetFile(file, index) {
|
|
69
|
+
if (!file) throw new ValidationError("No target file provided");
|
|
70
|
+
const targetFile = index !== void 0 ? Array.isArray(file) ? file[index] : file : file;
|
|
71
|
+
if (typeof targetFile !== "string") throw new ValidationError("Invalid target file path");
|
|
72
|
+
return targetFile;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Ensure content is present before writing.
|
|
76
|
+
*
|
|
77
|
+
* @param content - The data to write; a string or Buffer
|
|
78
|
+
* @throws ValidationError if `content` is empty or otherwise falsy
|
|
79
|
+
*/
|
|
80
|
+
function validateContent(content) {
|
|
81
|
+
if (!content) throw new ValidationError("No content provided");
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Checks whether the given filesystem path refers to a directory.
|
|
85
|
+
*
|
|
86
|
+
* @returns `true` if the path exists and is a directory, `false` otherwise.
|
|
87
|
+
*/
|
|
88
|
+
function isDirectory(path) {
|
|
89
|
+
try {
|
|
90
|
+
return lstatSync(path).isDirectory();
|
|
91
|
+
} catch {
|
|
92
|
+
return false;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Determine whether a filesystem path refers to a directory.
|
|
97
|
+
*
|
|
98
|
+
* @param path - The filesystem path to check
|
|
99
|
+
* @returns `true` if the path exists and is a directory, `false` otherwise
|
|
100
|
+
*/
|
|
101
|
+
async function isDirectoryAsync(path) {
|
|
102
|
+
try {
|
|
103
|
+
return (await lstat(path)).isDirectory();
|
|
104
|
+
} catch {
|
|
105
|
+
return false;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Normalize and rethrow errors that occur while attempting to write to one or more files.
|
|
110
|
+
*
|
|
111
|
+
* @param error - The original error thrown during the write attempt
|
|
112
|
+
* @param file - The target file path or an array of paths that were the intended write targets
|
|
113
|
+
* @throws ValidationError - rethrows the provided ValidationError without modification
|
|
114
|
+
* @throws FileOperationError - thrown for any other error, wrapping the original error with context about the write operation and the target file(s)
|
|
115
|
+
*/
|
|
116
|
+
function handleWriteError(error, file) {
|
|
117
|
+
if (error instanceof ValidationError) throw error;
|
|
118
|
+
throw new FileOperationError("write to", typeof file === "string" ? file : "multiple files", error);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
//#endregion
|
|
122
|
+
export { writeFileAsync as n, writeFile$1 as t };
|
|
123
|
+
//# sourceMappingURL=writeFile-DgV8EbFP.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"writeFile-DgV8EbFP.js","names":["writeFile","writeFileFs"],"sources":["../src/writeFile.ts"],"sourcesContent":["/*!\n * node-minify\n * Copyright (c) 2011-2026 Rodolphe Stoclin\n * MIT Licensed\n */\n\nimport { lstatSync, writeFileSync } from \"node:fs\";\nimport { lstat, writeFile as writeFileFs } from \"node:fs/promises\";\nimport { FileOperationError, ValidationError } from \"./error.ts\";\n\ninterface WriteFileParams {\n file: string | string[];\n content: string | Buffer;\n index?: number;\n}\n\n/**\n * Write provided content to a target file.\n *\n * When `file` is an array and `index` is provided, the file at that index is used; otherwise `file` is used directly.\n *\n * @param file - Target path or array of target paths\n * @param content - Content to write; may be a `string` or `Buffer`\n * @param index - Optional index to select a file when `file` is an array\n * @returns The same `content` value that was written\n * @throws ValidationError If no target file, no content, or the resolved target path is invalid\n * @throws FileOperationError If the underlying filesystem write fails (wraps the original error)\n */\nexport function writeFile({\n file,\n content,\n index,\n}: WriteFileParams): string | Buffer {\n try {\n const targetFile = resolveTargetFile(file, index);\n validateContent(content);\n\n if (isDirectory(targetFile)) {\n throw new Error(\"Target path exists and is a directory\");\n }\n\n writeFileSync(\n targetFile,\n content,\n Buffer.isBuffer(content) ? undefined : \"utf8\"\n );\n return content;\n } catch (error) {\n handleWriteError(error, file);\n return content; // Should be unreachable due to handleWriteError throwing\n }\n}\n\n/**\n * Write content to a resolved target file path.\n *\n * Resolves the target from `file` (string or array) using `index` when provided, validates the content,\n * ensures the target is not a directory, and writes the content to disk.\n *\n * @param file - Target path or array of target paths; when `file` is an array, `index` selects the entry\n * @param content - Content to write; a `string` or `Buffer`\n * @param index - Optional index used to select a file when `file` is an array\n * @returns The same `content` value that was written\n * @throws ValidationError If no target file, no content, or the resolved target path is invalid\n * @throws FileOperationError If the underlying filesystem write fails (wraps the original error)\n */\nexport async function writeFileAsync({\n file,\n content,\n index,\n}: WriteFileParams): Promise<string | Buffer> {\n try {\n const targetFile = resolveTargetFile(file, index);\n validateContent(content);\n\n if (await isDirectoryAsync(targetFile)) {\n throw new Error(\"Target path exists and is a directory\");\n }\n\n await writeFileFs(\n targetFile,\n content,\n Buffer.isBuffer(content) ? undefined : \"utf8\"\n );\n return content;\n } catch (error) {\n handleWriteError(error, file);\n return content; // Should be unreachable due to handleWriteError throwing\n }\n}\n\n/**\n * Resolve a target file path from a string or an array of paths, optionally selecting by index.\n *\n * @param file - A file path or an array of file paths to resolve from.\n * @param index - Optional index to select an entry when `file` is an array; ignored if not provided.\n * @returns The resolved file path.\n * @throws ValidationError if no file is provided or the resolved target is not a string.\n */\nfunction resolveTargetFile(file: string | string[], index?: number): string {\n if (!file) {\n throw new ValidationError(\"No target file provided\");\n }\n\n const targetFile =\n index !== undefined ? (Array.isArray(file) ? file[index] : file) : file;\n\n if (typeof targetFile !== \"string\") {\n throw new ValidationError(\"Invalid target file path\");\n }\n\n return targetFile;\n}\n\n/**\n * Ensure content is present before writing.\n *\n * @param content - The data to write; a string or Buffer\n * @throws ValidationError if `content` is empty or otherwise falsy\n */\nfunction validateContent(content: string | Buffer): void {\n if (!content) {\n throw new ValidationError(\"No content provided\");\n }\n}\n\n/**\n * Checks whether the given filesystem path refers to a directory.\n *\n * @returns `true` if the path exists and is a directory, `false` otherwise.\n */\nfunction isDirectory(path: string): boolean {\n try {\n return lstatSync(path).isDirectory();\n } catch {\n return false;\n }\n}\n\n/**\n * Determine whether a filesystem path refers to a directory.\n *\n * @param path - The filesystem path to check\n * @returns `true` if the path exists and is a directory, `false` otherwise\n */\nasync function isDirectoryAsync(path: string): Promise<boolean> {\n try {\n const stats = await lstat(path);\n return stats.isDirectory();\n } catch {\n return false;\n }\n}\n\n/**\n * Normalize and rethrow errors that occur while attempting to write to one or more files.\n *\n * @param error - The original error thrown during the write attempt\n * @param file - The target file path or an array of paths that were the intended write targets\n * @throws ValidationError - rethrows the provided ValidationError without modification\n * @throws FileOperationError - thrown for any other error, wrapping the original error with context about the write operation and the target file(s)\n */\nfunction handleWriteError(error: unknown, file: string | string[]): never {\n if (error instanceof ValidationError) {\n throw error;\n }\n throw new FileOperationError(\n \"write to\",\n typeof file === \"string\" ? file : \"multiple files\",\n error as Error\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AA4BA,SAAgBA,YAAU,EACtB,MACA,SACA,SACiC;AACjC,KAAI;EACA,MAAM,aAAa,kBAAkB,MAAM,MAAM;AACjD,kBAAgB,QAAQ;AAExB,MAAI,YAAY,WAAW,CACvB,OAAM,IAAI,MAAM,wCAAwC;AAG5D,gBACI,YACA,SACA,OAAO,SAAS,QAAQ,GAAG,SAAY,OAC1C;AACD,SAAO;UACF,OAAO;AACZ,mBAAiB,OAAO,KAAK;AAC7B,SAAO;;;;;;;;;;;;;;;;AAiBf,eAAsB,eAAe,EACjC,MACA,SACA,SAC0C;AAC1C,KAAI;EACA,MAAM,aAAa,kBAAkB,MAAM,MAAM;AACjD,kBAAgB,QAAQ;AAExB,MAAI,MAAM,iBAAiB,WAAW,CAClC,OAAM,IAAI,MAAM,wCAAwC;AAG5D,QAAMC,UACF,YACA,SACA,OAAO,SAAS,QAAQ,GAAG,SAAY,OAC1C;AACD,SAAO;UACF,OAAO;AACZ,mBAAiB,OAAO,KAAK;AAC7B,SAAO;;;;;;;;;;;AAYf,SAAS,kBAAkB,MAAyB,OAAwB;AACxE,KAAI,CAAC,KACD,OAAM,IAAI,gBAAgB,0BAA0B;CAGxD,MAAM,aACF,UAAU,SAAa,MAAM,QAAQ,KAAK,GAAG,KAAK,SAAS,OAAQ;AAEvE,KAAI,OAAO,eAAe,SACtB,OAAM,IAAI,gBAAgB,2BAA2B;AAGzD,QAAO;;;;;;;;AASX,SAAS,gBAAgB,SAAgC;AACrD,KAAI,CAAC,QACD,OAAM,IAAI,gBAAgB,sBAAsB;;;;;;;AASxD,SAAS,YAAY,MAAuB;AACxC,KAAI;AACA,SAAO,UAAU,KAAK,CAAC,aAAa;SAChC;AACJ,SAAO;;;;;;;;;AAUf,eAAe,iBAAiB,MAAgC;AAC5D,KAAI;AAEA,UADc,MAAM,MAAM,KAAK,EAClB,aAAa;SACtB;AACJ,SAAO;;;;;;;;;;;AAYf,SAAS,iBAAiB,OAAgB,MAAgC;AACtE,KAAI,iBAAiB,gBACjB,OAAM;AAEV,OAAM,IAAI,mBACN,YACA,OAAO,SAAS,WAAW,OAAO,kBAClC,MACH"}
|
package/dist/writeFile.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
//#region src/writeFile.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
|
interface WriteFileParams {
|
|
@@ -10,20 +10,40 @@ interface WriteFileParams {
|
|
|
10
10
|
index?: number;
|
|
11
11
|
}
|
|
12
12
|
/**
|
|
13
|
-
* Write content
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
* @
|
|
18
|
-
* @
|
|
19
|
-
*
|
|
20
|
-
*
|
|
13
|
+
* Write provided content to a target file.
|
|
14
|
+
*
|
|
15
|
+
* When `file` is an array and `index` is provided, the file at that index is used; otherwise `file` is used directly.
|
|
16
|
+
*
|
|
17
|
+
* @param file - Target path or array of target paths
|
|
18
|
+
* @param content - Content to write; may be a `string` or `Buffer`
|
|
19
|
+
* @param index - Optional index to select a file when `file` is an array
|
|
20
|
+
* @returns The same `content` value that was written
|
|
21
|
+
* @throws ValidationError If no target file, no content, or the resolved target path is invalid
|
|
22
|
+
* @throws FileOperationError If the underlying filesystem write fails (wraps the original error)
|
|
21
23
|
*/
|
|
22
24
|
declare function writeFile({
|
|
23
25
|
file,
|
|
24
26
|
content,
|
|
25
27
|
index
|
|
26
28
|
}: WriteFileParams): string | Buffer;
|
|
29
|
+
/**
|
|
30
|
+
* Write content to a resolved target file path.
|
|
31
|
+
*
|
|
32
|
+
* Resolves the target from `file` (string or array) using `index` when provided, validates the content,
|
|
33
|
+
* ensures the target is not a directory, and writes the content to disk.
|
|
34
|
+
*
|
|
35
|
+
* @param file - Target path or array of target paths; when `file` is an array, `index` selects the entry
|
|
36
|
+
* @param content - Content to write; a `string` or `Buffer`
|
|
37
|
+
* @param index - Optional index used to select a file when `file` is an array
|
|
38
|
+
* @returns The same `content` value that was written
|
|
39
|
+
* @throws ValidationError If no target file, no content, or the resolved target path is invalid
|
|
40
|
+
* @throws FileOperationError If the underlying filesystem write fails (wraps the original error)
|
|
41
|
+
*/
|
|
42
|
+
declare function writeFileAsync({
|
|
43
|
+
file,
|
|
44
|
+
content,
|
|
45
|
+
index
|
|
46
|
+
}: WriteFileParams): Promise<string | Buffer>;
|
|
27
47
|
//#endregion
|
|
28
|
-
export { writeFile };
|
|
48
|
+
export { writeFile, writeFileAsync };
|
|
29
49
|
//# sourceMappingURL=writeFile.d.ts.map
|
package/dist/writeFile.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"writeFile.d.ts","names":[],"sources":["../src/writeFile.ts"],"sourcesContent":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"writeFile.d.ts","names":[],"sources":["../src/writeFile.ts"],"sourcesContent":[],"mappings":";;;AA4BA;;;UAlBU,eAAA,CAqBN;EACD,IAAA,EAAA,MAAA,GAAA,MAAA,EAAA;EAA2B,OAAA,EAAA,MAAA,GApBR,MAoBQ;EAAM,KAAA,CAAA,EAAA,MAAA;AAkCpC;;;;;;;;;;;;;iBAtCgB,SAAA;;;;GAIb,2BAA2B;;;;;;;;;;;;;;iBAkCR,cAAA;;;;GAInB,kBAAkB,iBAAiB"}
|
package/dist/writeFile.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { t as writeFile } from "./writeFile-
|
|
1
|
+
import { n as writeFileAsync, t as writeFile } from "./writeFile-DgV8EbFP.js";
|
|
2
2
|
|
|
3
|
-
export { writeFile };
|
|
3
|
+
export { writeFile, writeFileAsync };
|