@swc/html 1.7.31-nightly-20241008.1 → 1.7.35
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/binding.d.ts +7 -4
- package/index.d.ts +4 -4
- package/index.ts +5 -8
- package/package.json +14 -14
package/binding.d.ts
CHANGED
|
@@ -22,23 +22,26 @@ export interface Element {
|
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
export declare function minify(
|
|
25
|
-
code: Buffer,
|
|
25
|
+
code: Buffer | string,
|
|
26
26
|
opts: Buffer,
|
|
27
27
|
signal?: AbortSignal | undefined | null
|
|
28
28
|
): Promise<TransformOutput>;
|
|
29
29
|
|
|
30
30
|
export declare function minifyFragment(
|
|
31
|
-
code: Buffer,
|
|
31
|
+
code: Buffer | string,
|
|
32
32
|
opts: Buffer,
|
|
33
33
|
signal?: AbortSignal | undefined | null
|
|
34
34
|
): Promise<TransformOutput>;
|
|
35
35
|
|
|
36
36
|
export declare function minifyFragmentSync(
|
|
37
|
-
code: Buffer,
|
|
37
|
+
code: Buffer | string,
|
|
38
38
|
opts: Buffer
|
|
39
39
|
): TransformOutput;
|
|
40
40
|
|
|
41
|
-
export declare function minifySync(
|
|
41
|
+
export declare function minifySync(
|
|
42
|
+
code: Buffer | string,
|
|
43
|
+
opts: Buffer
|
|
44
|
+
): TransformOutput;
|
|
42
45
|
|
|
43
46
|
export interface TransformOutput {
|
|
44
47
|
code: string;
|
package/index.d.ts
CHANGED
|
@@ -43,7 +43,7 @@ export type FragmentOptions = Options & {
|
|
|
43
43
|
context_element?: binding.Element;
|
|
44
44
|
form_element?: binding.Element;
|
|
45
45
|
};
|
|
46
|
-
export declare function minify(content: Buffer, options?: Options): Promise<binding.TransformOutput>;
|
|
47
|
-
export declare function minifyFragment(content: Buffer, options?: FragmentOptions): Promise<binding.TransformOutput>;
|
|
48
|
-
export declare function minifySync(content: Buffer, options?: Options): binding.TransformOutput;
|
|
49
|
-
export declare function minifyFragmentSync(content: Buffer, options?: FragmentOptions): Promise<binding.TransformOutput>;
|
|
46
|
+
export declare function minify(content: string | Buffer, options?: Options): Promise<binding.TransformOutput>;
|
|
47
|
+
export declare function minifyFragment(content: string | Buffer, options?: FragmentOptions): Promise<binding.TransformOutput>;
|
|
48
|
+
export declare function minifySync(content: string | Buffer, options?: Options): binding.TransformOutput;
|
|
49
|
+
export declare function minifyFragmentSync(content: string | Buffer, options?: FragmentOptions): Promise<binding.TransformOutput>;
|
package/index.ts
CHANGED
|
@@ -19,10 +19,7 @@ export type Options = {
|
|
|
19
19
|
preserveComments?: string[];
|
|
20
20
|
minifyConditionalComments?: boolean;
|
|
21
21
|
removeEmptyAttributes?: boolean;
|
|
22
|
-
removeRedundantAttributes?:
|
|
23
|
-
| "none"
|
|
24
|
-
| "all"
|
|
25
|
-
| "smart";
|
|
22
|
+
removeRedundantAttributes?: "none" | "all" | "smart";
|
|
26
23
|
collapseBooleanAttributes?: boolean;
|
|
27
24
|
normalizeAttributes?: boolean;
|
|
28
25
|
minifyJson?: boolean | { pretty?: boolean };
|
|
@@ -48,28 +45,28 @@ export type FragmentOptions = Options & {
|
|
|
48
45
|
};
|
|
49
46
|
|
|
50
47
|
export async function minify(
|
|
51
|
-
content: Buffer,
|
|
48
|
+
content: string | Buffer,
|
|
52
49
|
options?: Options
|
|
53
50
|
): Promise<binding.TransformOutput> {
|
|
54
51
|
return binding.minify(content, toBuffer(options ?? {}));
|
|
55
52
|
}
|
|
56
53
|
|
|
57
54
|
export async function minifyFragment(
|
|
58
|
-
content: Buffer,
|
|
55
|
+
content: string | Buffer,
|
|
59
56
|
options?: FragmentOptions
|
|
60
57
|
): Promise<binding.TransformOutput> {
|
|
61
58
|
return binding.minifyFragment(content, toBuffer(options ?? {}));
|
|
62
59
|
}
|
|
63
60
|
|
|
64
61
|
export function minifySync(
|
|
65
|
-
content: Buffer,
|
|
62
|
+
content: string | Buffer,
|
|
66
63
|
options?: Options
|
|
67
64
|
): binding.TransformOutput {
|
|
68
65
|
return binding.minifySync(content, toBuffer(options ?? {}));
|
|
69
66
|
}
|
|
70
67
|
|
|
71
68
|
export async function minifyFragmentSync(
|
|
72
|
-
content: Buffer,
|
|
69
|
+
content: string | Buffer,
|
|
73
70
|
options?: FragmentOptions
|
|
74
71
|
): Promise<binding.TransformOutput> {
|
|
75
72
|
return binding.minifyFragmentSync(content, toBuffer(options ?? {}));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@swc/html",
|
|
3
|
-
"version": "1.7.
|
|
3
|
+
"version": "1.7.35",
|
|
4
4
|
"description": "Super-fast HTML minifier",
|
|
5
5
|
"homepage": "https://swc.rs",
|
|
6
6
|
"main": "./index.js",
|
|
@@ -29,8 +29,8 @@
|
|
|
29
29
|
"x86_64-unknown-linux-musl",
|
|
30
30
|
"i686-pc-windows-msvc",
|
|
31
31
|
"armv7-unknown-linux-gnueabihf",
|
|
32
|
-
"aarch64-unknown-linux-gnu",
|
|
33
32
|
"aarch64-apple-darwin",
|
|
33
|
+
"aarch64-unknown-linux-gnu",
|
|
34
34
|
"aarch64-unknown-linux-musl",
|
|
35
35
|
"aarch64-pc-windows-msvc"
|
|
36
36
|
]
|
|
@@ -44,8 +44,8 @@
|
|
|
44
44
|
"prepack": "tsc -d && napi prepublish -p scripts/npm --tag-style npm",
|
|
45
45
|
"prepublishOnly": "tsc -d && napi prepublish -p scripts/npm --tagstyle npm",
|
|
46
46
|
"build:ts": "tsc -d",
|
|
47
|
-
"build": "tsc -d && napi build --manifest-path ../../bindings/Cargo.toml --platform -p binding_html_node --js ./binding.js --dts ./binding.d.ts --release -o .",
|
|
48
|
-
"build:dev": "tsc -d && napi build --manifest-path ../../bindings/Cargo.toml --platform -p binding_html_node --js ./binding.js --dts ./binding.d.ts -o .",
|
|
47
|
+
"build": "(tsc -d || true) && napi build --manifest-path ../../bindings/Cargo.toml --platform -p binding_html_node --js ./binding.js --dts ./binding.d.ts --release -o .",
|
|
48
|
+
"build:dev": "(tsc -d || true) && napi build --manifest-path ../../bindings/Cargo.toml --platform -p binding_html_node --js ./binding.js --dts ./binding.d.ts -o .",
|
|
49
49
|
"test": "echo 'done!'",
|
|
50
50
|
"version": "napi version --npm-dir scripts/npm"
|
|
51
51
|
},
|
|
@@ -57,15 +57,15 @@
|
|
|
57
57
|
"@swc/counter": "^0.1.3"
|
|
58
58
|
},
|
|
59
59
|
"optionalDependencies": {
|
|
60
|
-
"@swc/html-darwin-x64": "1.7.
|
|
61
|
-
"@swc/html-win32-x64-msvc": "1.7.
|
|
62
|
-
"@swc/html-linux-x64-gnu": "1.7.
|
|
63
|
-
"@swc/html-linux-x64-musl": "1.7.
|
|
64
|
-
"@swc/html-win32-ia32-msvc": "1.7.
|
|
65
|
-
"@swc/html-linux-arm-gnueabihf": "1.7.
|
|
66
|
-
"@swc/html-
|
|
67
|
-
"@swc/html-
|
|
68
|
-
"@swc/html-linux-arm64-musl": "1.7.
|
|
69
|
-
"@swc/html-win32-arm64-msvc": "1.7.
|
|
60
|
+
"@swc/html-darwin-x64": "1.7.35",
|
|
61
|
+
"@swc/html-win32-x64-msvc": "1.7.35",
|
|
62
|
+
"@swc/html-linux-x64-gnu": "1.7.35",
|
|
63
|
+
"@swc/html-linux-x64-musl": "1.7.35",
|
|
64
|
+
"@swc/html-win32-ia32-msvc": "1.7.35",
|
|
65
|
+
"@swc/html-linux-arm-gnueabihf": "1.7.35",
|
|
66
|
+
"@swc/html-darwin-arm64": "1.7.35",
|
|
67
|
+
"@swc/html-linux-arm64-gnu": "1.7.35",
|
|
68
|
+
"@swc/html-linux-arm64-musl": "1.7.35",
|
|
69
|
+
"@swc/html-win32-arm64-msvc": "1.7.35"
|
|
70
70
|
}
|
|
71
71
|
}
|