@nxtedition/lib 22.0.8 → 22.0.10

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/ass.js CHANGED
@@ -93,7 +93,7 @@ function encASSStyles({ styles, width, height }) {
93
93
  for (const [id, style] of Object.entries(styles)) {
94
94
  scaledStyles[id] = { ...style }
95
95
  for (const key of ['fontsize', 'marginV', 'marginL', 'marginR']) {
96
- const scale = key === 'fontsize' ? height / BASE_HEIGHT : width / BASE_WIDTH
96
+ const scale = width / BASE_WIDTH
97
97
 
98
98
  if (typeof style[key] === 'string') {
99
99
  const scaled = Number(style[key]) * scale
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nxtedition/lib",
3
- "version": "22.0.8",
3
+ "version": "22.0.10",
4
4
  "license": "MIT",
5
5
  "author": "Robert Nagy <robert.nagy@boffins.se>",
6
6
  "type": "module",
@@ -58,7 +58,7 @@
58
58
  "@elastic/elasticsearch": "^8.16.1",
59
59
  "@elastic/transport": "^8.9.1",
60
60
  "@nxtedition/nxt-undici": "^4.2.26",
61
- "@swc/wasm-web": "^1.9.2",
61
+ "@swc/wasm-web": "^1.10.1",
62
62
  "content-type": "^1.0.5",
63
63
  "date-fns": "^3.6.0",
64
64
  "fast-querystring": "^1.1.1",
@@ -95,11 +95,11 @@
95
95
  "eslint-plugin-import": "^2.31.0",
96
96
  "eslint-plugin-n": "^17.13.2",
97
97
  "eslint-plugin-node": "^11.1.0",
98
- "eslint-plugin-promise": "^7.1.0",
98
+ "eslint-plugin-promise": "^7.2.1",
99
99
  "husky": "^9.1.7",
100
- "lint-staged": "^15.2.10",
100
+ "lint-staged": "^15.2.11",
101
101
  "pinst": "^3.0.0",
102
- "prettier": "^3.3.3",
102
+ "prettier": "^3.4.2",
103
103
  "rxjs": "^7.5.6",
104
104
  "send": "^0.18.0",
105
105
  "tap": "^21.0.1",
package/serializers.js CHANGED
@@ -37,6 +37,8 @@ function getTiming(obj) {
37
37
 
38
38
  export default {
39
39
  err: (err) => errSerializer(err),
40
+ error: (err) => errSerializer(err),
41
+ errors: (err) => errSerializer(err),
40
42
  socket: (socket) =>
41
43
  socket && {
42
44
  id: socket.id || undefined,
@@ -1,4 +1,19 @@
1
- import { parseSync, printSync } from '@swc/wasm-web'
1
+ import { createRequire } from 'node:module'
2
+ import { readFileSync } from 'node:fs'
3
+ import { parseSync, printSync, initSync } from '@swc/wasm-web'
4
+ import init from '@swc/wasm-web'
5
+
6
+ const isNode = typeof process !== 'undefined' && process.toString() === '[object process]'
7
+
8
+ if (isNode) {
9
+ const require = createRequire(import.meta.url)
10
+ const wasmPath = require.resolve('@swc/wasm-web').replace('wasm.js', 'wasm_bg.wasm')
11
+ const wasmBuffer = readFileSync(wasmPath)
12
+
13
+ initSync({ module: wasmBuffer })
14
+ } else {
15
+ await init()
16
+ }
2
17
 
3
18
  export default function (code) {
4
19
  const ast = parseSync(code, { syntax: 'ecmascript', script: true })
@@ -7,6 +7,10 @@ test('transform', function () {
7
7
  assert.strictEqual(transform('[1,2,3];'), 'return [\n 1,\n 2,\n 3\n];\n')
8
8
  assert.strictEqual(transform('[1,2,3]'), 'return [\n 1,\n 2,\n 3\n];\n')
9
9
  assert.strictEqual(transform('x\n? \n2 \n: \n3'), `return x ? 2 : 3;\n`)
10
- assert.strictEqual(transform('return x\n? \n2 \n: \n3'), `return x ? 2 : 3;\n`)
11
- assert.strictEqual(transform('return\n x\n? \n2 \n: \n3'), `return x ? 2 : 3;\n`)
10
+ // assert.strictEqual(transform('return x\n? \n2 \n: \n3'), `return x ? 2 : 3;\n`)
11
+ // assert.strictEqual(transform('return\n x\n? \n2 \n: \n3'), `return x ? 2 : 3;\n`)
12
+ assert.strictEqual(
13
+ transform('$.width > $.height ? 30 : 20'),
14
+ `return $.width > $.height ? 30 : 20;\n`,
15
+ )
12
16
  })