Skip to content

chore(javascript): Update napi to 3 #520

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions bindings/javascript/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ mimalloc = "0.1"
mimalloc = { version = "0.1", features = ["local_dynamic_tls"] }

[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
napi = { version = "2.16.0", default-features = false, features = ["napi4"] }
napi-derive = "2.16.0"
napi = { version = "3.1.3", default-features = false, features = ["napi4"] }
napi-derive = "3.1.0"

[target.'cfg(target_arch = "wasm32")'.dependencies]
wasm-bindgen = "=0.2.100"
Expand All @@ -43,7 +43,7 @@ version = "*"
default-features = false

[build-dependencies]
napi-build = "2.1.0"
napi-build = "2.2.0"

[profile.release]
lto = true
Expand Down
23 changes: 13 additions & 10 deletions bindings/javascript/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
/* tslint:disable */
/* auto-generated by NAPI-RS */
/* eslint-disable */
/** Inline CSS styles from <style> tags to matching elements in the HTML tree and return a string. */
export declare function inline(html: string, options?: Options | undefined | null): string

/* auto-generated by NAPI-RS */
/** Inline CSS styles into an HTML fragment. */
export declare function inlineFragment(html: string, css: string, options?: Options | undefined | null): string

export interface StylesheetCache {
/** Cache size. */
size: number
}
export interface Options {
/**
* Whether to inline CSS from "style" tags.
Expand All @@ -19,6 +18,8 @@ export interface Options {
keepStyleTags?: boolean
/** Keep "link" tags after inlining. */
keepLinkTags?: boolean
/** Keep "at-rules" after inlining. */
keepAtRules?: boolean
/** Used for loading external stylesheets via relative URLs. */
baseUrl?: string
/** Whether remote stylesheets should be loaded or not. */
Expand All @@ -33,9 +34,11 @@ export interface Options {
*/
preallocateNodeCapacity?: number
}
/** Inline CSS styles from <style> tags to matching elements in the HTML tree and return a string. */
export declare function inline(html: string, options?: Options | undefined | null): string
/** Inline CSS styles into an HTML fragment. */
export declare function inlineFragment(html: string, css: string, options?: Options | undefined | null): string

export interface StylesheetCache {
/** Cache size. */
size: number
}

/** Get the package version. */
export declare function version(): string
6 changes: 3 additions & 3 deletions bindings/javascript/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
],
"types": "index.d.ts",
"napi": {
"name": "css-inline",
"triples": {
"binaryName": "css-inline",
"targets": {
"additional": [
"aarch64-apple-darwin",
"aarch64-linux-android",
Expand All @@ -36,7 +36,7 @@
"license": "MIT",
"devDependencies": {
"@ava/typescript": "^4.1.0",
"@napi-rs/cli": "^2.17.0",
"@napi-rs/cli": "^3.0.4",
"@swc-node/register": "^1.6.8",
"@swc/core": "^1.3.101",
"@types/copyfiles": "^2",
Expand Down
Loading