Skip to content

Commit e8c28cd

Browse files
fix: Fix bindings (#13)
1 parent b1bf39d commit e8c28cd

File tree

5 files changed

+115
-14
lines changed

5 files changed

+115
-14
lines changed

crates/html_node/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ fn minify_inner(code: &str, opts: MinifyOptions) -> anyhow::Result<String> {
116116
let mut gen = CodeGenerator::new(
117117
&mut wr,
118118
CodegenConfig {
119+
minify: true,
119120
..Default::default()
120121
},
121122
);

packages/css/lib/index.js

Lines changed: 53 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,63 @@
11
"use strict";
2+
var __createBinding =
3+
(this && this.__createBinding) ||
4+
(Object.create
5+
? function (o, m, k, k2) {
6+
if (k2 === undefined) k2 = k;
7+
var desc = Object.getOwnPropertyDescriptor(m, k);
8+
if (
9+
!desc ||
10+
("get" in desc ? !m.__esModule : desc.writable || desc.configurable)
11+
) {
12+
desc = {
13+
enumerable: true,
14+
get: function () {
15+
return m[k];
16+
},
17+
};
18+
}
19+
Object.defineProperty(o, k2, desc);
20+
}
21+
: function (o, m, k, k2) {
22+
if (k2 === undefined) k2 = k;
23+
o[k2] = m[k];
24+
});
25+
var __setModuleDefault =
26+
(this && this.__setModuleDefault) ||
27+
(Object.create
28+
? function (o, v) {
29+
Object.defineProperty(o, "default", { enumerable: true, value: v });
30+
}
31+
: function (o, v) {
32+
o["default"] = v;
33+
});
34+
var __importStar =
35+
(this && this.__importStar) ||
36+
function (mod) {
37+
if (mod && mod.__esModule) return mod;
38+
var result = {};
39+
if (mod != null)
40+
for (var k in mod)
41+
if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k))
42+
__createBinding(result, mod, k);
43+
__setModuleDefault(result, mod);
44+
return result;
45+
};
246
Object.defineProperty(exports, "__esModule", { value: true });
347
exports.minifySync = exports.minify = void 0;
4-
const binding = require("./binding");
48+
const binding = __importStar(require("./binding"));
549
async function minify(content, options) {
6-
return binding.minify(content, toBuffer(options));
50+
return binding.minify(
51+
content,
52+
toBuffer(options !== null && options !== void 0 ? options : {})
53+
);
754
}
855
exports.minify = minify;
956
function minifySync(content, options) {
10-
return binding.minifySync(content, toBuffer(options));
57+
return binding.minifySync(
58+
content,
59+
toBuffer(options !== null && options !== void 0 ? options : {})
60+
);
1161
}
1262
exports.minifySync = minifySync;
1363
function toBuffer(t) {

packages/css/lib/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
import binding = require("./binding");
1+
import * as binding from "./binding";
22

33
export async function minify(
44
content: Buffer,
55
options: any
66
): Promise<binding.TransformOutput> {
7-
return binding.minify(content, toBuffer(options));
7+
return binding.minify(content, toBuffer(options ?? {}));
88
}
99

1010
export function minifySync(content: Buffer, options: any) {
11-
return binding.minifySync(content, toBuffer(options));
11+
return binding.minifySync(content, toBuffer(options ?? {}));
1212
}
1313

1414
function toBuffer(t: any): Buffer {

packages/html/lib/index.js

Lines changed: 53 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,63 @@
11
"use strict";
2+
var __createBinding =
3+
(this && this.__createBinding) ||
4+
(Object.create
5+
? function (o, m, k, k2) {
6+
if (k2 === undefined) k2 = k;
7+
var desc = Object.getOwnPropertyDescriptor(m, k);
8+
if (
9+
!desc ||
10+
("get" in desc ? !m.__esModule : desc.writable || desc.configurable)
11+
) {
12+
desc = {
13+
enumerable: true,
14+
get: function () {
15+
return m[k];
16+
},
17+
};
18+
}
19+
Object.defineProperty(o, k2, desc);
20+
}
21+
: function (o, m, k, k2) {
22+
if (k2 === undefined) k2 = k;
23+
o[k2] = m[k];
24+
});
25+
var __setModuleDefault =
26+
(this && this.__setModuleDefault) ||
27+
(Object.create
28+
? function (o, v) {
29+
Object.defineProperty(o, "default", { enumerable: true, value: v });
30+
}
31+
: function (o, v) {
32+
o["default"] = v;
33+
});
34+
var __importStar =
35+
(this && this.__importStar) ||
36+
function (mod) {
37+
if (mod && mod.__esModule) return mod;
38+
var result = {};
39+
if (mod != null)
40+
for (var k in mod)
41+
if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k))
42+
__createBinding(result, mod, k);
43+
__setModuleDefault(result, mod);
44+
return result;
45+
};
246
Object.defineProperty(exports, "__esModule", { value: true });
347
exports.minifySync = exports.minify = void 0;
4-
const binding = require("./binding");
48+
const binding = __importStar(require("./binding"));
549
async function minify(content, options) {
6-
return binding.minify(content, toBuffer(options));
50+
return binding.minify(
51+
content,
52+
toBuffer(options !== null && options !== void 0 ? options : {})
53+
);
754
}
855
exports.minify = minify;
956
function minifySync(content, options) {
10-
return binding.minifySync(content, toBuffer(options));
57+
return binding.minifySync(
58+
content,
59+
toBuffer(options !== null && options !== void 0 ? options : {})
60+
);
1161
}
1262
exports.minifySync = minifySync;
1363
function toBuffer(t) {

packages/html/lib/index.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
import binding = require("./binding");
1+
import * as binding from "./binding";
22

3-
export async function minify(content: Buffer, options: any): Promise<string> {
4-
return binding.minify(content, toBuffer(options));
3+
export async function minify(content: Buffer, options?: any): Promise<string> {
4+
return binding.minify(content, toBuffer(options ?? {}));
55
}
66

7-
export function minifySync(content: Buffer, options: any) {
8-
return binding.minifySync(content, toBuffer(options));
7+
export function minifySync(content: Buffer, options?: any) {
8+
return binding.minifySync(content, toBuffer(options ?? {}));
99
}
1010

1111
function toBuffer(t: any): Buffer {

0 commit comments

Comments
 (0)