Skip to content

Commit d0ee769

Browse files
committed
fix(javascript): Update generated bindings
Signed-off-by: Dmitry Dygalo <[email protected]>
1 parent b195dbf commit d0ee769

File tree

9 files changed

+1514
-1481
lines changed

9 files changed

+1514
-1481
lines changed

bindings/javascript/.yarn/releases/yarn-4.0.2.cjs

Lines changed: 0 additions & 893 deletions
This file was deleted.

bindings/javascript/.yarn/releases/yarn-4.9.2.cjs

Lines changed: 942 additions & 0 deletions
Large diffs are not rendered by default.

bindings/javascript/.yarnrc.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
nodeLinker: node-modules
22

3-
yarnPath: .yarn/releases/yarn-4.0.2.cjs
3+
yarnPath: .yarn/releases/yarn-4.9.2.cjs

bindings/javascript/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
## [Unreleased]
44

5+
### Fixed
6+
7+
- Expose `StylesheetCache` interface, `cache` config option, and `version` function.
8+
59
## [0.15.0] - 2025-06-24
610

711
### Changed

bindings/javascript/index.d.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@
33

44
/* auto-generated by NAPI-RS */
55

6+
export interface StylesheetCache {
7+
/** Cache size. */
8+
size: number
9+
}
610
export interface Options {
711
/**
812
* Whether to inline CSS from "style" tags.
@@ -19,6 +23,8 @@ export interface Options {
1923
baseUrl?: string
2024
/** Whether remote stylesheets should be loaded or not. */
2125
loadRemoteStylesheets?: boolean
26+
/** An LRU Cache for external stylesheets. */
27+
cache?: StylesheetCache
2228
/** Additional CSS to inline. */
2329
extraCss?: string
2430
/**
@@ -28,6 +34,8 @@ export interface Options {
2834
preallocateNodeCapacity?: number
2935
}
3036
/** Inline CSS styles from <style> tags to matching elements in the HTML tree and return a string. */
31-
export function inline(html: string, options?: Options | undefined | null): string
37+
export declare function inline(html: string, options?: Options | undefined | null): string
3238
/** Inline CSS styles into an HTML fragment. */
33-
export function inlineFragment(html: string, css: string, options?: Options | undefined | null): string
39+
export declare function inlineFragment(html: string, css: string, options?: Options | undefined | null): string
40+
/** Get the package version. */
41+
export declare function version(): string

bindings/javascript/index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,8 @@ if (!nativeBinding) {
252252
throw new Error(`Failed to load native binding`)
253253
}
254254

255-
const { inline, inlineFragment } = nativeBinding
255+
const { inline, inlineFragment, version } = nativeBinding
256256

257257
module.exports.inline = inline
258258
module.exports.inlineFragment = inlineFragment
259+
module.exports.version = version

bindings/javascript/js-binding.js

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -252,35 +252,6 @@ switch (platform) {
252252
}
253253
}
254254
break
255-
case 'riscv64':
256-
if (isMusl()) {
257-
localFileExisted = existsSync(
258-
join(__dirname, 'css-inline.linux-riscv64-musl.node')
259-
)
260-
try {
261-
if (localFileExisted) {
262-
nativeBinding = require('./css-inline.linux-riscv64-musl.node')
263-
} else {
264-
nativeBinding = require('@css-inline/css-inline-linux-riscv64-musl')
265-
}
266-
} catch (e) {
267-
loadError = e
268-
}
269-
} else {
270-
localFileExisted = existsSync(
271-
join(__dirname, 'css-inline.linux-riscv64-gnu.node')
272-
)
273-
try {
274-
if (localFileExisted) {
275-
nativeBinding = require('./css-inline.linux-riscv64-gnu.node')
276-
} else {
277-
nativeBinding = require('@css-inline/css-inline-linux-riscv64-gnu')
278-
}
279-
} catch (e) {
280-
loadError = e
281-
}
282-
}
283-
break
284255
default:
285256
throw new Error(`Unsupported architecture on Linux: ${arch}`)
286257
}

bindings/javascript/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,5 +97,5 @@
9797
"universal": "napi universal",
9898
"version": "napi version"
9999
},
100-
"packageManager": "yarn@4.0.2"
100+
"packageManager": "yarn@4.9.2"
101101
}

0 commit comments

Comments
 (0)