soda-nodejs 0.6.0 → 0.6.2
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/cjs/index.d.ts +7 -8
- package/dist/cjs/index.js +35 -17
- package/dist/cjs/index.js.map +2 -2
- package/dist/cjs/utils/compress.js.map +1 -1
- package/dist/esm/index.d.ts +7 -8
- package/dist/esm/index.js +7 -8
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/utils/compress.js.map +1 -1
- package/package.json +1 -1
- package/src/index.ts +7 -8
- package/src/utils/compress.ts +37 -37
package/dist/cjs/index.d.ts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
3
|
-
export
|
|
4
|
-
export
|
|
5
|
-
export
|
|
6
|
-
export
|
|
7
|
-
export
|
|
8
|
-
export * from "./utils/zip";
|
|
1
|
+
export { CompressionParams } from "./utils/compress";
|
|
2
|
+
export { CopyOptions } from "./utils/copy";
|
|
3
|
+
export { IconvDecodeOptions } from "./utils/execAsync";
|
|
4
|
+
export { SaveFileOptions } from "./utils/saveFile";
|
|
5
|
+
export { Options, PromiseWithChildProcess, getDefaultOptions, setDefaultOptions, spawnAsync } from "./utils/spawnAsync";
|
|
6
|
+
export { UnzipOptions } from "./utils/unzip";
|
|
7
|
+
export { ZipOptions } from "./utils/zip";
|
package/dist/cjs/index.js
CHANGED
|
@@ -2,6 +2,10 @@ var __defProp = Object.defineProperty;
|
|
|
2
2
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
3
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
4
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
5
9
|
var __copyProps = (to, from, except, desc) => {
|
|
6
10
|
if (from && typeof from === "object" || typeof from === "function") {
|
|
7
11
|
for (let key of __getOwnPropNames(from))
|
|
@@ -10,29 +14,43 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
10
14
|
}
|
|
11
15
|
return to;
|
|
12
16
|
};
|
|
13
|
-
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
14
17
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
18
|
|
|
16
19
|
// src/index.ts
|
|
17
20
|
var src_exports = {};
|
|
21
|
+
__export(src_exports, {
|
|
22
|
+
CompressionParams: () => import_compress.CompressionParams,
|
|
23
|
+
CopyOptions: () => import_copy.CopyOptions,
|
|
24
|
+
IconvDecodeOptions: () => import_execAsync.IconvDecodeOptions,
|
|
25
|
+
Options: () => import_spawnAsync.Options,
|
|
26
|
+
PromiseWithChildProcess: () => import_spawnAsync.PromiseWithChildProcess,
|
|
27
|
+
SaveFileOptions: () => import_saveFile.SaveFileOptions,
|
|
28
|
+
UnzipOptions: () => import_unzip.UnzipOptions,
|
|
29
|
+
ZipOptions: () => import_zip.ZipOptions,
|
|
30
|
+
getDefaultOptions: () => import_spawnAsync.getDefaultOptions,
|
|
31
|
+
setDefaultOptions: () => import_spawnAsync.setDefaultOptions,
|
|
32
|
+
spawnAsync: () => import_spawnAsync.spawnAsync
|
|
33
|
+
});
|
|
18
34
|
module.exports = __toCommonJS(src_exports);
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
__reExport(src_exports, require("./utils/zip"), module.exports);
|
|
35
|
+
var import_compress = require("./utils/compress");
|
|
36
|
+
var import_copy = require("./utils/copy");
|
|
37
|
+
var import_execAsync = require("./utils/execAsync");
|
|
38
|
+
var import_saveFile = require("./utils/saveFile");
|
|
39
|
+
var import_spawnAsync = require("./utils/spawnAsync");
|
|
40
|
+
var import_unzip = require("./utils/unzip");
|
|
41
|
+
var import_zip = require("./utils/zip");
|
|
27
42
|
// Annotate the CommonJS export names for ESM import in node:
|
|
28
43
|
0 && (module.exports = {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
44
|
+
CompressionParams,
|
|
45
|
+
CopyOptions,
|
|
46
|
+
IconvDecodeOptions,
|
|
47
|
+
Options,
|
|
48
|
+
PromiseWithChildProcess,
|
|
49
|
+
SaveFileOptions,
|
|
50
|
+
UnzipOptions,
|
|
51
|
+
ZipOptions,
|
|
52
|
+
getDefaultOptions,
|
|
53
|
+
setDefaultOptions,
|
|
54
|
+
spawnAsync
|
|
37
55
|
});
|
|
38
56
|
//# sourceMappingURL=index.js.map
|
package/dist/cjs/index.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/index.ts"],
|
|
4
|
-
"sourcesContent": ["export
|
|
5
|
-
"mappings": "
|
|
4
|
+
"sourcesContent": ["export { CompressionParams } from \"@/utils/compress\"\nexport { CopyOptions } from \"@/utils/copy\"\nexport { IconvDecodeOptions } from \"@/utils/execAsync\"\nexport { SaveFileOptions } from \"@/utils/saveFile\"\nexport { Options, PromiseWithChildProcess, getDefaultOptions, setDefaultOptions, spawnAsync } from \"@/utils/spawnAsync\"\nexport { UnzipOptions } from \"@/utils/unzip\"\nexport { ZipOptions } from \"@/utils/zip\"\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,sBAAkC;AAClC,kBAA4B;AAC5B,uBAAmC;AACnC,sBAAgC;AAChC,wBAAmG;AACnG,mBAA6B;AAC7B,iBAA2B;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/utils/compress.ts"],
|
|
4
|
-
"sourcesContent": ["import { existsSync, mkdirSync } from \"fs\"\
|
|
4
|
+
"sourcesContent": ["import { existsSync, mkdirSync } from \"fs\"\nimport { basename, dirname, resolve } from \"path\"\nimport { create } from \"tar\"\n\nexport interface CompressionParams {\n /**\n * 需要压缩的文件夹\n */\n input: string\n /**\n * 压缩后的文件路径\n */\n output: string\n}\n\nexport async function compress({ input, output }: CompressionParams) {\n input = resolve(input)\n\n // 确保源路径存在\n if (!existsSync(input)) throw new Error(\"Source folder does not exist\")\n\n // 确保输出目录存在\n const outputDir = dirname(output)\n if (!existsSync(outputDir)) mkdirSync(outputDir, { recursive: true })\n\n // 执行压缩\n await create(\n {\n gzip: true, // 使用 gzip 压缩\n file: output, // 输出文件路径\n cwd: dirname(input), // 设置工作目录\n },\n [basename(input)], // 要压缩的文件夹名\n )\n\n return resolve(output)\n}\n"],
|
|
5
5
|
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,gBAAsC;AACtC,kBAA2C;AAC3C,iBAAuB;AAavB,eAAsB,SAAS,EAAE,OAAO,OAAO,GAAsB;AACjE,cAAQ,qBAAQ,KAAK;AAGrB,MAAI,KAAC,sBAAW,KAAK;AAAG,UAAM,IAAI,MAAM,8BAA8B;AAGtE,QAAM,gBAAY,qBAAQ,MAAM;AAChC,MAAI,KAAC,sBAAW,SAAS;AAAG,6BAAU,WAAW,EAAE,WAAW,KAAK,CAAC;AAGpE,YAAM;AAAA,IACF;AAAA,MACI,MAAM;AAAA;AAAA,MACN,MAAM;AAAA;AAAA,MACN,SAAK,qBAAQ,KAAK;AAAA;AAAA,IACtB;AAAA,IACA,KAAC,sBAAS,KAAK,CAAC;AAAA;AAAA,EACpB;AAEA,aAAO,qBAAQ,MAAM;AACzB;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
3
|
-
export
|
|
4
|
-
export
|
|
5
|
-
export
|
|
6
|
-
export
|
|
7
|
-
export
|
|
8
|
-
export * from "./utils/zip";
|
|
1
|
+
export { CompressionParams } from "./utils/compress";
|
|
2
|
+
export { CopyOptions } from "./utils/copy";
|
|
3
|
+
export { IconvDecodeOptions } from "./utils/execAsync";
|
|
4
|
+
export { SaveFileOptions } from "./utils/saveFile";
|
|
5
|
+
export { Options, PromiseWithChildProcess, getDefaultOptions, setDefaultOptions, spawnAsync } from "./utils/spawnAsync";
|
|
6
|
+
export { UnzipOptions } from "./utils/unzip";
|
|
7
|
+
export { ZipOptions } from "./utils/zip";
|
package/dist/esm/index.js
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
3
|
-
export
|
|
4
|
-
export
|
|
5
|
-
export
|
|
6
|
-
export
|
|
7
|
-
export
|
|
8
|
-
export * from "./utils/zip";
|
|
1
|
+
export { CompressionParams } from "./utils/compress";
|
|
2
|
+
export { CopyOptions } from "./utils/copy";
|
|
3
|
+
export { IconvDecodeOptions } from "./utils/execAsync";
|
|
4
|
+
export { SaveFileOptions } from "./utils/saveFile";
|
|
5
|
+
export { Options, PromiseWithChildProcess, getDefaultOptions, setDefaultOptions, spawnAsync } from "./utils/spawnAsync";
|
|
6
|
+
export { UnzipOptions } from "./utils/unzip";
|
|
7
|
+
export { ZipOptions } from "./utils/zip";
|
|
9
8
|
//# sourceMappingURL=index.js.map
|
package/dist/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["../../src/index.ts"],"sourcesContent":["export
|
|
1
|
+
{"version":3,"names":["CompressionParams","CopyOptions","IconvDecodeOptions","SaveFileOptions","Options","PromiseWithChildProcess","getDefaultOptions","setDefaultOptions","spawnAsync","UnzipOptions","ZipOptions"],"sources":["../../src/index.ts"],"sourcesContent":["export { CompressionParams } from \"@/utils/compress\"\nexport { CopyOptions } from \"@/utils/copy\"\nexport { IconvDecodeOptions } from \"@/utils/execAsync\"\nexport { SaveFileOptions } from \"@/utils/saveFile\"\nexport { Options, PromiseWithChildProcess, getDefaultOptions, setDefaultOptions, spawnAsync } from \"@/utils/spawnAsync\"\nexport { UnzipOptions } from \"@/utils/unzip\"\nexport { ZipOptions } from \"@/utils/zip\"\n"],"mappings":"AAAA,SAASA,iBAAiB;AAC1B,SAASC,WAAW;AACpB,SAASC,kBAAkB;AAC3B,SAASC,eAAe;AACxB,SAASC,OAAO,EAAEC,uBAAuB,EAAEC,iBAAiB,EAAEC,iBAAiB,EAAEC,UAAU;AAC3F,SAASC,YAAY;AACrB,SAASC,UAAU"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["existsSync","mkdirSync","basename","dirname","resolve","create","compress","input","output","Error","outputDir","recursive","gzip","file","cwd"],"sources":["../../../src/utils/compress.ts"],"sourcesContent":["import { existsSync, mkdirSync } from \"fs\"\
|
|
1
|
+
{"version":3,"names":["existsSync","mkdirSync","basename","dirname","resolve","create","compress","input","output","Error","outputDir","recursive","gzip","file","cwd"],"sources":["../../../src/utils/compress.ts"],"sourcesContent":["import { existsSync, mkdirSync } from \"fs\"\nimport { basename, dirname, resolve } from \"path\"\nimport { create } from \"tar\"\n\nexport interface CompressionParams {\n /**\n * 需要压缩的文件夹\n */\n input: string\n /**\n * 压缩后的文件路径\n */\n output: string\n}\n\nexport async function compress({ input, output }: CompressionParams) {\n input = resolve(input)\n\n // 确保源路径存在\n if (!existsSync(input)) throw new Error(\"Source folder does not exist\")\n\n // 确保输出目录存在\n const outputDir = dirname(output)\n if (!existsSync(outputDir)) mkdirSync(outputDir, { recursive: true })\n\n // 执行压缩\n await create(\n {\n gzip: true, // 使用 gzip 压缩\n file: output, // 输出文件路径\n cwd: dirname(input), // 设置工作目录\n },\n [basename(input)], // 要压缩的文件夹名\n )\n\n return resolve(output)\n}\n"],"mappings":"AAAA,SAASA,UAAU,EAAEC,SAAS,QAAQ,IAAI;AAC1C,SAASC,QAAQ,EAAEC,OAAO,EAAEC,OAAO,QAAQ,MAAM;AACjD,SAASC,MAAM,QAAQ,KAAK;AAa5B,OAAO,eAAeC,QAAQA,CAAC;EAAEC,KAAK;EAAEC;AAA0B,CAAC,EAAE;EACjED,KAAK,GAAGH,OAAO,CAACG,KAAK,CAAC;;EAEtB;EACA,IAAI,CAACP,UAAU,CAACO,KAAK,CAAC,EAAE,MAAM,IAAIE,KAAK,CAAC,8BAA8B,CAAC;;EAEvE;EACA,MAAMC,SAAS,GAAGP,OAAO,CAACK,MAAM,CAAC;EACjC,IAAI,CAACR,UAAU,CAACU,SAAS,CAAC,EAAET,SAAS,CAACS,SAAS,EAAE;IAAEC,SAAS,EAAE;EAAK,CAAC,CAAC;;EAErE;EACA,MAAMN,MAAM,CACR;IACIO,IAAI,EAAE,IAAI;IAAE;IACZC,IAAI,EAAEL,MAAM;IAAE;IACdM,GAAG,EAAEX,OAAO,CAACI,KAAK,CAAC,CAAE;EACzB,CAAC,EACD,CAACL,QAAQ,CAACK,KAAK,CAAC,CAAC,CAAE;EACvB,CAAC;EAED,OAAOH,OAAO,CAACI,MAAM,CAAC;AAC1B"}
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
3
|
-
export
|
|
4
|
-
export
|
|
5
|
-
export
|
|
6
|
-
export
|
|
7
|
-
export
|
|
8
|
-
export * from "@/utils/zip"
|
|
1
|
+
export { CompressionParams } from "@/utils/compress"
|
|
2
|
+
export { CopyOptions } from "@/utils/copy"
|
|
3
|
+
export { IconvDecodeOptions } from "@/utils/execAsync"
|
|
4
|
+
export { SaveFileOptions } from "@/utils/saveFile"
|
|
5
|
+
export { Options, PromiseWithChildProcess, getDefaultOptions, setDefaultOptions, spawnAsync } from "@/utils/spawnAsync"
|
|
6
|
+
export { UnzipOptions } from "@/utils/unzip"
|
|
7
|
+
export { ZipOptions } from "@/utils/zip"
|
package/src/utils/compress.ts
CHANGED
|
@@ -1,37 +1,37 @@
|
|
|
1
|
-
import { existsSync, mkdirSync } from "fs"
|
|
2
|
-
import { basename, dirname, resolve } from "path"
|
|
3
|
-
import { create } from "tar"
|
|
4
|
-
|
|
5
|
-
export interface CompressionParams {
|
|
6
|
-
/**
|
|
7
|
-
* 需要压缩的文件夹
|
|
8
|
-
*/
|
|
9
|
-
input: string
|
|
10
|
-
/**
|
|
11
|
-
* 压缩后的文件路径
|
|
12
|
-
*/
|
|
13
|
-
output: string
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export async function compress({ input, output }: CompressionParams) {
|
|
17
|
-
input = resolve(input)
|
|
18
|
-
|
|
19
|
-
// 确保源路径存在
|
|
20
|
-
if (!existsSync(input)) throw new Error("Source folder does not exist")
|
|
21
|
-
|
|
22
|
-
// 确保输出目录存在
|
|
23
|
-
const outputDir = dirname(output)
|
|
24
|
-
if (!existsSync(outputDir)) mkdirSync(outputDir, { recursive: true })
|
|
25
|
-
|
|
26
|
-
// 执行压缩
|
|
27
|
-
await create(
|
|
28
|
-
{
|
|
29
|
-
gzip: true, // 使用 gzip 压缩
|
|
30
|
-
file: output, // 输出文件路径
|
|
31
|
-
cwd: dirname(input), // 设置工作目录
|
|
32
|
-
},
|
|
33
|
-
[basename(input)], // 要压缩的文件夹名
|
|
34
|
-
)
|
|
35
|
-
|
|
36
|
-
return resolve(output)
|
|
37
|
-
}
|
|
1
|
+
import { existsSync, mkdirSync } from "fs"
|
|
2
|
+
import { basename, dirname, resolve } from "path"
|
|
3
|
+
import { create } from "tar"
|
|
4
|
+
|
|
5
|
+
export interface CompressionParams {
|
|
6
|
+
/**
|
|
7
|
+
* 需要压缩的文件夹
|
|
8
|
+
*/
|
|
9
|
+
input: string
|
|
10
|
+
/**
|
|
11
|
+
* 压缩后的文件路径
|
|
12
|
+
*/
|
|
13
|
+
output: string
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export async function compress({ input, output }: CompressionParams) {
|
|
17
|
+
input = resolve(input)
|
|
18
|
+
|
|
19
|
+
// 确保源路径存在
|
|
20
|
+
if (!existsSync(input)) throw new Error("Source folder does not exist")
|
|
21
|
+
|
|
22
|
+
// 确保输出目录存在
|
|
23
|
+
const outputDir = dirname(output)
|
|
24
|
+
if (!existsSync(outputDir)) mkdirSync(outputDir, { recursive: true })
|
|
25
|
+
|
|
26
|
+
// 执行压缩
|
|
27
|
+
await create(
|
|
28
|
+
{
|
|
29
|
+
gzip: true, // 使用 gzip 压缩
|
|
30
|
+
file: output, // 输出文件路径
|
|
31
|
+
cwd: dirname(input), // 设置工作目录
|
|
32
|
+
},
|
|
33
|
+
[basename(input)], // 要压缩的文件夹名
|
|
34
|
+
)
|
|
35
|
+
|
|
36
|
+
return resolve(output)
|
|
37
|
+
}
|