@node-minify/run 10.4.0 → 10.5.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/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/index.ts"],"
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/index.ts"],"mappings":";;AAQA;;;;KAAY,oBAAA;EACR,IAAA;EACA,IAAA;EACA,SAAA;EACA,OAAA;EACA,OAAA;AAAA;AAYJ;;;;;;;;;AAAA,iBAAsB,cAAA,CAAA;EAClB,IAAA;EACA,IAAA;EACA,SAAA;EACA,OAAA;EACA;AAAA,GACD,oBAAA,GAAuB,OAAA;AAAA,KAIrB,SAAA;EACD,IAAA;EACA,IAAA;EACA,SAAA;EACA,OAAA;EACA,OAAA;AAAA;;;;;;;;;;iBAYkB,GAAA,CAAA;EAClB,IAAA;EACA,IAAA;EACA,SAAA;EACA,OAAA;EACA;AAAA,GACD,SAAA,GAAY,OAAA"}
|
package/dist/index.js
CHANGED
|
@@ -61,7 +61,7 @@ async function run({ data, args, maxBuffer = 1024 * 1024, timeout, silence = fal
|
|
|
61
61
|
child.stdin?.on("error", handleError("child.stdin"));
|
|
62
62
|
child.stdout?.on("error", handleError("child.stdout"));
|
|
63
63
|
child.stderr?.on("error", handleError("child.stderr"));
|
|
64
|
-
child.on("
|
|
64
|
+
child.on("close", (code) => {
|
|
65
65
|
if (settled) return;
|
|
66
66
|
settled = true;
|
|
67
67
|
if (timeoutId) clearTimeout(timeoutId);
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../src/index.ts"],"sourcesContent":["/*!\n * node-minify\n * Copyright (c) 2011-2026 Rodolphe Stoclin\n * MIT Licensed\n */\n\nimport childProcess from \"node:child_process\";\n\nexport type RunCommandLineParams = {\n args: string[];\n data: string;\n maxBuffer?: number;\n timeout?: number;\n silence?: boolean;\n};\n\n/**\n * Run the command line with spawn.\n * @param args - Command line arguments for the Java process\n * @param data - Data to minify (piped to stdin)\n * @param maxBuffer - Optional buffer limit in bytes. Defaults to 1024 * 1024 (1MB).\n * @param timeout - Optional timeout in milliseconds. Process will be killed if it exceeds this limit.\n * @param silence - Optional boolean to suppress console logging.\n * @returns Promise with minified content from stdout\n */\nexport async function runCommandLine({\n args,\n data,\n maxBuffer,\n timeout,\n silence,\n}: RunCommandLineParams): Promise<string> {\n return run({ data, args, maxBuffer, timeout, silence });\n}\n\ntype RunParams = {\n data: string;\n args: string[];\n maxBuffer?: number;\n timeout?: number;\n silence?: boolean;\n};\n\n/**\n * Execute command with Java process.\n * @param data - Data to minify (piped to stdin)\n * @param args - Command line arguments\n * @param maxBuffer - Optional buffer limit in bytes. Defaults to 1024 * 1024 (1MB).\n * @param timeout - Optional timeout in milliseconds. Process will be killed if it exceeds this limit.\n * @param silence - Optional boolean to suppress console logging.\n * @returns Promise with minified content from stdout\n */\nexport async function run({\n data,\n args,\n maxBuffer = 1024 * 1024,\n timeout,\n silence = false,\n}: RunParams): Promise<string> {\n return new Promise((resolve, reject) => {\n const stdoutChunks: Buffer[] = [];\n const stderrChunks: Buffer[] = [];\n let stdoutLength = 0;\n let stderrLength = 0;\n let timeoutId: NodeJS.Timeout | undefined;\n let settled = false;\n\n const child = childProcess.spawn(\"java\", args, {\n stdio: \"pipe\",\n });\n\n if (timeout) {\n timeoutId = setTimeout(() => {\n if (settled || child.killed) return;\n settled = true;\n child.kill();\n reject(new Error(`Process timed out after ${timeout}ms`));\n }, timeout);\n }\n\n const handleError = (source: string) => (error: Error) => {\n if (!silence) {\n console.error(`Error in ${source}:`, error);\n }\n };\n\n child.on(\"error\", (error) => {\n if (settled) return;\n settled = true;\n if (timeoutId) clearTimeout(timeoutId);\n handleError(\"child\")(error);\n reject(new Error(`Process error: ${error.message}`));\n });\n\n child.stdin?.on(\"error\", handleError(\"child.stdin\"));\n child.stdout?.on(\"error\", handleError(\"child.stdout\"));\n child.stderr?.on(\"error\", handleError(\"child.stderr\"));\n\n child.on(\"
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../src/index.ts"],"sourcesContent":["/*!\n * node-minify\n * Copyright (c) 2011-2026 Rodolphe Stoclin\n * MIT Licensed\n */\n\nimport childProcess from \"node:child_process\";\n\nexport type RunCommandLineParams = {\n args: string[];\n data: string;\n maxBuffer?: number;\n timeout?: number;\n silence?: boolean;\n};\n\n/**\n * Run the command line with spawn.\n * @param args - Command line arguments for the Java process\n * @param data - Data to minify (piped to stdin)\n * @param maxBuffer - Optional buffer limit in bytes. Defaults to 1024 * 1024 (1MB).\n * @param timeout - Optional timeout in milliseconds. Process will be killed if it exceeds this limit.\n * @param silence - Optional boolean to suppress console logging.\n * @returns Promise with minified content from stdout\n */\nexport async function runCommandLine({\n args,\n data,\n maxBuffer,\n timeout,\n silence,\n}: RunCommandLineParams): Promise<string> {\n return run({ data, args, maxBuffer, timeout, silence });\n}\n\ntype RunParams = {\n data: string;\n args: string[];\n maxBuffer?: number;\n timeout?: number;\n silence?: boolean;\n};\n\n/**\n * Execute command with Java process.\n * @param data - Data to minify (piped to stdin)\n * @param args - Command line arguments\n * @param maxBuffer - Optional buffer limit in bytes. Defaults to 1024 * 1024 (1MB).\n * @param timeout - Optional timeout in milliseconds. Process will be killed if it exceeds this limit.\n * @param silence - Optional boolean to suppress console logging.\n * @returns Promise with minified content from stdout\n */\nexport async function run({\n data,\n args,\n maxBuffer = 1024 * 1024,\n timeout,\n silence = false,\n}: RunParams): Promise<string> {\n return new Promise((resolve, reject) => {\n const stdoutChunks: Buffer[] = [];\n const stderrChunks: Buffer[] = [];\n let stdoutLength = 0;\n let stderrLength = 0;\n let timeoutId: NodeJS.Timeout | undefined;\n let settled = false;\n\n const child = childProcess.spawn(\"java\", args, {\n stdio: \"pipe\",\n });\n\n if (timeout) {\n timeoutId = setTimeout(() => {\n if (settled || child.killed) return;\n settled = true;\n child.kill();\n reject(new Error(`Process timed out after ${timeout}ms`));\n }, timeout);\n }\n\n const handleError = (source: string) => (error: Error) => {\n if (!silence) {\n console.error(`Error in ${source}:`, error);\n }\n };\n\n child.on(\"error\", (error) => {\n if (settled) return;\n settled = true;\n if (timeoutId) clearTimeout(timeoutId);\n handleError(\"child\")(error);\n reject(new Error(`Process error: ${error.message}`));\n });\n\n child.stdin?.on(\"error\", handleError(\"child.stdin\"));\n child.stdout?.on(\"error\", handleError(\"child.stdout\"));\n child.stderr?.on(\"error\", handleError(\"child.stderr\"));\n\n child.on(\"close\", (code: number | null) => {\n if (settled) return;\n settled = true;\n if (timeoutId) clearTimeout(timeoutId);\n const stderr = Buffer.concat(stderrChunks).toString(\"utf8\");\n if (code !== 0) {\n reject(new Error(stderr || `Process exited with code ${code}`));\n return;\n }\n\n resolve(Buffer.concat(stdoutChunks).toString(\"utf8\"));\n });\n\n child.stdout?.on(\"data\", (chunk: Buffer) => {\n stdoutChunks.push(chunk);\n stdoutLength += chunk.length;\n\n if (maxBuffer > 0 && stdoutLength > maxBuffer) {\n if (settled) return;\n settled = true;\n if (timeoutId) clearTimeout(timeoutId);\n child.kill();\n reject(new Error(\"stdout maxBuffer exceeded\"));\n return;\n }\n });\n\n child.stderr?.on(\"data\", (chunk: Buffer) => {\n stderrChunks.push(chunk);\n stderrLength += chunk.length;\n\n if (maxBuffer > 0 && stderrLength > maxBuffer) {\n if (settled) return;\n settled = true;\n if (timeoutId) clearTimeout(timeoutId);\n child.kill();\n reject(new Error(\"stderr maxBuffer exceeded\"));\n return;\n }\n });\n\n child.stdin?.end(data);\n });\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAyBA,eAAsB,eAAe,EACjC,MACA,MACA,WACA,SACA,WACsC;AACtC,QAAO,IAAI;EAAE;EAAM;EAAM;EAAW;EAAS;EAAS,CAAC;;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,MAAM;AACxB,mBAAgB,MAAM;AAEtB,OAAI,YAAY,KAAK,eAAe,WAAW;AAC3C,QAAI,QAAS;AACb,cAAU;AACV,QAAI,UAAW,cAAa,UAAU;AACtC,UAAM,MAAM;AACZ,2BAAO,IAAI,MAAM,4BAA4B,CAAC;AAC9C;;IAEN;AAEF,QAAM,QAAQ,GAAG,SAAS,UAAkB;AACxC,gBAAa,KAAK,MAAM;AACxB,mBAAgB,MAAM;AAEtB,OAAI,YAAY,KAAK,eAAe,WAAW;AAC3C,QAAI,QAAS;AACb,cAAU;AACV,QAAI,UAAW,cAAa,UAAU;AACtC,UAAM,MAAM;AACZ,2BAAO,IAAI,MAAM,4BAA4B,CAAC;AAC9C;;IAEN;AAEF,QAAM,OAAO,IAAI,KAAK;GACxB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@node-minify/run",
|
|
3
|
-
"version": "10.
|
|
3
|
+
"version": "10.5.0",
|
|
4
4
|
"description": "exec commands for @node-minify",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"compressor",
|
|
@@ -52,6 +52,6 @@
|
|
|
52
52
|
"dev": "tsdown src/index.ts --watch"
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|
|
55
|
-
"@node-minify/types": "10.
|
|
55
|
+
"@node-minify/types": "10.5.0"
|
|
56
56
|
}
|
|
57
57
|
}
|