@css-inline/css-inline 0.14.3 → 0.16.0

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/index.d.ts CHANGED
@@ -3,6 +3,10 @@
3
3
 
4
4
  /* auto-generated by NAPI-RS */
5
5
 
6
+ export interface StylesheetCache {
7
+ /** Cache size. */
8
+ size: number
9
+ }
6
10
  export interface Options {
7
11
  /**
8
12
  * Whether to inline CSS from "style" tags.
@@ -19,6 +23,8 @@ export interface Options {
19
23
  baseUrl?: string
20
24
  /** Whether remote stylesheets should be loaded or not. */
21
25
  loadRemoteStylesheets?: boolean
26
+ /** An LRU Cache for external stylesheets. */
27
+ cache?: StylesheetCache
22
28
  /** Additional CSS to inline. */
23
29
  extraCss?: string
24
30
  /**
@@ -28,6 +34,8 @@ export interface Options {
28
34
  preallocateNodeCapacity?: number
29
35
  }
30
36
  /** 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
32
38
  /** 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
package/index.js CHANGED
@@ -246,13 +246,18 @@ switch (platform) {
246
246
  }
247
247
 
248
248
  if (!nativeBinding) {
249
- if (loadError) {
250
- throw loadError
249
+ try {
250
+ nativeBinding = require('@css-inline/css-inline-wasm');
251
+ } catch (e) {
252
+ if (loadError) {
253
+ throw loadError;
254
+ }
255
+ throw e;
251
256
  }
252
- throw new Error(`Failed to load native binding`)
253
257
  }
254
258
 
255
- const { inline, inlineFragment } = nativeBinding
259
+ const { inline, inlineFragment, version } = nativeBinding
256
260
 
257
261
  module.exports.inline = inline
258
262
  module.exports.inlineFragment = inlineFragment
263
+ module.exports.version = version
package/js-binding.js CHANGED
@@ -252,35 +252,6 @@ switch (platform) {
252
252
  }
253
253
  }
254
254
  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
284
255
  default:
285
256
  throw new Error(`Unsupported architecture on Linux: ${arch}`)
286
257
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@css-inline/css-inline",
3
- "version": "0.14.3",
3
+ "version": "0.16.0",
4
4
  "description": "High-performance library for inlining CSS into HTML 'style' attributes",
5
5
  "main": "index.js",
6
6
  "repository": "https://github.com/Stranger6667/css-inline",
@@ -47,7 +47,7 @@
47
47
  "benny": "^3.7.1",
48
48
  "copyfiles": "^2.4.1",
49
49
  "dts-bundle-generator": "^9.1.0",
50
- "esbuild": "^0.19.10",
50
+ "esbuild": "^0.25.0",
51
51
  "eslint": "^8.56.0",
52
52
  "eslint-config-prettier": "^9.1.0",
53
53
  "eslint-plugin-import": "^2.29.1",
@@ -97,18 +97,18 @@
97
97
  "universal": "napi universal",
98
98
  "version": "napi version"
99
99
  },
100
- "packageManager": "yarn@4.0.2",
100
+ "packageManager": "yarn@4.9.2",
101
101
  "optionalDependencies": {
102
- "@css-inline/css-inline-win32-x64-msvc": "0.14.3",
103
- "@css-inline/css-inline-darwin-x64": "0.14.3",
104
- "@css-inline/css-inline-linux-x64-gnu": "0.14.3",
105
- "@css-inline/css-inline-darwin-arm64": "0.14.3",
106
- "@css-inline/css-inline-android-arm64": "0.14.3",
107
- "@css-inline/css-inline-win32-arm64-msvc": "0.14.3",
108
- "@css-inline/css-inline-linux-arm64-gnu": "0.14.3",
109
- "@css-inline/css-inline-linux-arm64-musl": "0.14.3",
110
- "@css-inline/css-inline-linux-arm-gnueabihf": "0.14.3",
111
- "@css-inline/css-inline-linux-x64-musl": "0.14.3",
112
- "@css-inline/css-inline-android-arm-eabi": "0.14.3"
102
+ "@css-inline/css-inline-win32-x64-msvc": "0.16.0",
103
+ "@css-inline/css-inline-darwin-x64": "0.16.0",
104
+ "@css-inline/css-inline-linux-x64-gnu": "0.16.0",
105
+ "@css-inline/css-inline-darwin-arm64": "0.16.0",
106
+ "@css-inline/css-inline-android-arm64": "0.16.0",
107
+ "@css-inline/css-inline-win32-arm64-msvc": "0.16.0",
108
+ "@css-inline/css-inline-linux-arm64-gnu": "0.16.0",
109
+ "@css-inline/css-inline-linux-arm64-musl": "0.16.0",
110
+ "@css-inline/css-inline-linux-arm-gnueabihf": "0.16.0",
111
+ "@css-inline/css-inline-linux-x64-musl": "0.16.0",
112
+ "@css-inline/css-inline-android-arm-eabi": "0.16.0"
113
113
  }
114
114
  }