Comparing version 5.0.0 to 6.0.0
#! /usr/bin/env node | ||
var BufferStreams = require('bufferstreams'); | ||
var ttf2woff2 = require('../dist'); | ||
import { | ||
BufferStream | ||
} from 'bufferstreams'; | ||
import ttf2woff2 from '../dist/index.js'; | ||
process.stdin | ||
.pipe( | ||
new BufferStreams(function (err, buf, cb) { | ||
new BufferStream(function (err, buf, cb) { | ||
if (err) { | ||
@@ -10,0 +12,0 @@ throw err; |
@@ -0,1 +1,20 @@ | ||
# [6.0.0](https://github.com/nfroidure/ttf2woff2/compare/v5.0.0...v6.0.0) (2024-07-20) | ||
### chore | ||
* **dependencies:** update dependencies ([4319d41](https://github.com/nfroidure/ttf2woff2/commit/4319d41f552e563a1163f0a4a3664d68895871da)) | ||
### Features | ||
* **core:** better choice between builds ([ff54055](https://github.com/nfroidure/ttf2woff2/commit/ff540555e6a55fcd4e7c69a8702167a1f9abfe1e)), closes [#22](https://github.com/nfroidure/ttf2woff2/issues/22) [#46](https://github.com/nfroidure/ttf2woff2/issues/46) | ||
### BREAKING CHANGES | ||
* **dependencies:** Requires Node20+, use ESM, provide TypeScript types | ||
## [5.0.0](https://github.com/nfroidure/ttf2woff2/compare/v4.0.5...v5.0.0) (2022-12-06) | ||
@@ -2,0 +21,0 @@ |
@@ -1,8 +0,31 @@ | ||
'use strict'; | ||
try { | ||
module.exports = require('bindings')('addon.node').convert; | ||
} catch (err) { | ||
module.exports = require('../jssrc/index.js'); | ||
import { YError, printStackTrace } from 'yerror'; | ||
import debug from 'debug'; | ||
import { env } from 'node:process'; | ||
const doDebug = debug('ttf2woff2'); | ||
let ttf2woff2 = undefined; | ||
if (!env.TTF2WOFF2_VERSION || | ||
env.TTF2WOFF2_VERSION?.toLowerCase() === 'native') { | ||
try { | ||
ttf2woff2 = (await import('bindings'))('addon.node').convert; | ||
doDebug('✅ Using native version.'); | ||
} | ||
catch (err) { | ||
doDebug('❌ Could not load the native version.', printStackTrace(err)); | ||
} | ||
} | ||
if (!env.TTF2WOFF2_VERSION || env.TTF2WOFF2_VERSION?.toLowerCase() === 'wasm') { | ||
if (!ttf2woff2) { | ||
try { | ||
ttf2woff2 = (await import('../jssrc/index.js')).default; | ||
doDebug('✅ Using WASM version.'); | ||
} | ||
catch (err) { | ||
doDebug('❌ Could not load the WASM version.', printStackTrace(err)); | ||
} | ||
} | ||
} | ||
if (!ttf2woff2) { | ||
throw new YError('E_UNABLE_TO_LOAD_TTF2WOFF2', env.TTF2WOFF2_VERSION); | ||
} | ||
export default ttf2woff2; | ||
//# sourceMappingURL=index.js.map |
@@ -1,13 +0,10 @@ | ||
'use strict'; | ||
import theTTFToWOFF2Module from './ttf2woff2.cjs'; | ||
var theTTFToWOFF2Module = require('./ttf2woff2'); | ||
module.exports = function ttf2woff2(inputContent) { | ||
export default function ttf2woff2(inputContent) { | ||
// Prepare input | ||
var inputBuffer = theTTFToWOFF2Module._malloc(inputContent.length + 1); | ||
var outputSizePtr = theTTFToWOFF2Module._malloc(4); // eslint-disable-line | ||
var outputBufferPtr; | ||
var outputSize; | ||
var outputContent; | ||
var i; | ||
const inputBuffer = theTTFToWOFF2Module._malloc(inputContent.length + 1); | ||
const outputSizePtr = theTTFToWOFF2Module._malloc(4); // eslint-disable-line | ||
let outputBufferPtr; | ||
let outputSize; | ||
let outputContent; | ||
@@ -27,3 +24,3 @@ theTTFToWOFF2Module.writeArrayToMemory(inputContent, inputBuffer); | ||
for (i = 0; i < outputSize; i++) { | ||
for (let i = 0; i < outputSize; i++) { | ||
outputContent[i] = theTTFToWOFF2Module.getValue(outputBufferPtr + i, 'i8'); | ||
@@ -30,0 +27,0 @@ } |
206
package.json
{ | ||
"name": "ttf2woff2", | ||
"version": "5.0.0", | ||
"description": "Convert TTF files to WOFF2 ones.", | ||
"main": "dist/index", | ||
"browser": "jssrc/index.js", | ||
"engines": { | ||
"node": ">=14" | ||
}, | ||
"directories": { | ||
"test": "tests" | ||
}, | ||
"metapak": { | ||
@@ -17,9 +6,9 @@ "configs": [ | ||
"readme", | ||
"eslint", | ||
"babel", | ||
"jest" | ||
"tsesm", | ||
"jest", | ||
"eslint" | ||
], | ||
"data": { | ||
"files": "'src/**/*.js' 'jssrc/**/*.js'", | ||
"testsFiles": "'tests/**/*.test.js'", | ||
"files": "'src/**/*.ts'", | ||
"testsFiles": "'src/**/*.tests.ts'", | ||
"distFiles": "'dist/**/*.js'", | ||
@@ -39,24 +28,35 @@ "ignore": [ | ||
}, | ||
"name": "ttf2woff2", | ||
"version": "6.0.0", | ||
"description": "Convert TTF files to WOFF2 ones.", | ||
"main": "dist/index.js", | ||
"browser": "jssrc/index.js", | ||
"engines": { | ||
"node": ">=20.11.1" | ||
}, | ||
"directories": { | ||
"test": "tests" | ||
}, | ||
"scripts": { | ||
"build": "rimraf 'dist' && tsc --outDir dist", | ||
"changelog": "conventional-changelog -p angular -i CHANGELOG.md -s && git add CHANGELOG.md", | ||
"cli": "env NODE_ENV=${NODE_ENV:-cli}", | ||
"compile": "rimraf -f 'dist' && npm run compile:cjs && npm run compile:mjs", | ||
"compile:cjs": "babel --env-name=cjs --out-dir=dist --source-maps=true src", | ||
"compile:mjs": "babel --env-name=mjs --out-file-extension=.mjs --out-dir=dist --source-maps=true src", | ||
"configure": "node-gyp configure", | ||
"cover": "npm run jest -- --coverage", | ||
"coveralls": "npm run cover && cat ./coverage/lcov.info | coveralls && rm -rf ./coverage", | ||
"cz": "env NODE_ENV=${NODE_ENV:-cli} git cz", | ||
"emcc": "miniquery -p \"targets.#.sources.#\" ./binding.gyp | grep -v \"csrc/addon.cc\" | xargs emcc --bind -o jssrc/ttf2woff2.js -O3 --memory-init-file 0 -s \"TOTAL_MEMORY=536870912\" -s \"ALLOW_MEMORY_GROWTH=1\" -s BINARYEN_ASYNC_COMPILATION=0 -s 'EXPORTED_RUNTIME_METHODS=[\"getValue\", \"writeArrayToMemory\"]' -s NODEJS_CATCH_EXIT=0 -s NODEJS_CATCH_REJECTION=0 --post-js jssrc/post.js csrc/fallback.cc", | ||
"emcc-debug": "miniquery -p \"targets.#.sources.#\" ./binding.gyp | grep -v \"csrc/addon.cc\" | xargs emcc --bind -o jssrc/ttf2woff2.js -s \"ALLOW_MEMORY_GROWTH=1\" -s \"ASSERTIONS=1\" -s BINARYEN_ASYNC_COMPILATION=0 -s 'EXPORTED_RUNTIME_METHODS=[\"getValue\", \"writeArrayToMemory\"]' -s NODEJS_CATCH_EXIT=0 -s NODEJS_CATCH_REJECTION=0 --post-js jssrc/post.js csrc/fallback.cc", | ||
"emcc": "miniquery -p \"targets.#.sources.#\" ./binding.gyp | grep -v \"csrc/addon.cc\" | xargs emcc --bind -o jssrc/ttf2woff2.cjs -O2 -s \"TOTAL_MEMORY=536870912\" -s \"ALLOW_MEMORY_GROWTH=1\" -s BINARYEN_ASYNC_COMPILATION=0 -s EXPORTED_FUNCTIONS=[\"_malloc\"] -s 'EXPORTED_RUNTIME_METHODS=[\"getValue\", \"writeArrayToMemory\"]' -s NODEJS_CATCH_EXIT=0 -s NODEJS_CATCH_REJECTION=0 --post-js jssrc/post.js csrc/fallback.cc", | ||
"emcc-debug": "miniquery -p \"targets.#.sources.#\" ./binding.gyp | grep -v \"csrc/addon.cc\" | xargs emcc --bind -o jssrc/ttf2woff2.cjs -s \"ALLOW_MEMORY_GROWTH=1\" -s \"ASSERTIONS=1\" -s BINARYEN_ASYNC_COMPILATION=0 -s EXPORTED_FUNCTIONS=[\"_malloc\"] -s 'EXPORTED_RUNTIME_METHODS=[\"getValue\", \"writeArrayToMemory\"]' -s NODEJS_CATCH_EXIT=0 -s NODEJS_CATCH_REJECTION=0 --post-js jssrc/post.js csrc/fallback.cc", | ||
"format": "npm run prettier", | ||
"install": "((node-gyp configure && node-gyp build) > builderror.log) || (exit 0)", | ||
"jest": "NODE_ENV=test jest", | ||
"lint": "eslint 'src/**/*.js' 'jssrc/**/*.js'", | ||
"jest": "NODE_OPTIONS=--experimental-vm-modules NODE_ENV=test jest", | ||
"lint": "eslint 'src/**/*.ts'", | ||
"make": "node-gyp build", | ||
"metapak": "metapak", | ||
"precz": "npm t && npm run lint && npm run metapak -- -s && npm run compile", | ||
"prepare": "npm run compile", | ||
"prettier": "prettier --write 'src/**/*.js' 'jssrc/**/*.js'", | ||
"preversion": "npm run lint && npm test && npm t && npm run metapak -- -s && npm run compile", | ||
"precz": "npm t && npm run lint && npm run build && npm run metapak -- -s", | ||
"prepare": "npm run build", | ||
"prettier": "prettier --write 'src/**/*.ts'", | ||
"preversion": "npm run lint && npm test && npm t && npm run build && npm run metapak -- -s", | ||
"rebuild": "swc ./src -s -d dist -C jsc.target=es2022", | ||
"test": "npm run jest", | ||
"type-check": "tsc --pretty --noEmit", | ||
"version": "npm run changelog" | ||
@@ -85,21 +85,29 @@ }, | ||
"bindings": "^1.5.0", | ||
"bufferstreams": "^3.0.0", | ||
"nan": "^2.14.2", | ||
"node-gyp": "^9.0.0" | ||
"bufferstreams": "^4.0.0", | ||
"debug": "^4.3.5", | ||
"nan": "^2.20.0", | ||
"node-gyp": "^10.2.0", | ||
"yerror": "^8.0.0" | ||
}, | ||
"devDependencies": { | ||
"@babel/cli": "^7.12.1", | ||
"@babel/core": "^7.12.3", | ||
"@babel/preset-env": "^7.12.1", | ||
"commitizen": "^4.1.2", | ||
"conventional-changelog-cli": "^2.1.1", | ||
"coveralls": "^3.1.0", | ||
"@eslint/js": "^9.7.0", | ||
"@swc/cli": "^0.4.0", | ||
"@swc/core": "^1.6.13", | ||
"@swc/helpers": "^0.5.12", | ||
"@swc/jest": "^0.2.36", | ||
"commitizen": "^4.3.0", | ||
"conventional-changelog-cli": "^5.0.0", | ||
"cz-conventional-changelog": "^3.3.0", | ||
"eslint": "^8.14.0", | ||
"eslint-plugin-prettier": "^4.0.0", | ||
"jest": "^29.3.1", | ||
"metapak": "^3.1.10", | ||
"metapak-nfroidure": "11.0.4", | ||
"eslint": "^9.7.0", | ||
"eslint-config-prettier": "^9.1.0", | ||
"eslint-plugin-jest": "^28.6.0", | ||
"eslint-plugin-prettier": "^5.1.3", | ||
"jest": "^29.7.0", | ||
"metapak": "^6.0.1", | ||
"metapak-nfroidure": "^18.2.0", | ||
"miniquery": "^1.1.2", | ||
"prettier": "^2.6.2" | ||
"prettier": "^3.3.3", | ||
"rimraf": "^6.0.1", | ||
"typescript": "^5.5.3", | ||
"typescript-eslint": "^7.16.0" | ||
}, | ||
@@ -136,33 +144,16 @@ "bin": { | ||
"conventional-changelog-cli", | ||
"typescript", | ||
"rimraf", | ||
"@swc/cli", | ||
"@swc/core", | ||
"@swc/helpers", | ||
"jest", | ||
"@swc/jest", | ||
"eslint", | ||
"prettier", | ||
"eslint-config-prettier", | ||
"prettier", | ||
"@babel/cli", | ||
"@babel/core", | ||
"@babel/preset-env", | ||
"jest", | ||
"coveralls" | ||
"eslint-plugin-prettier", | ||
"typescript-eslint" | ||
] | ||
}, | ||
"eslintConfig": { | ||
"extends": [ | ||
"eslint:recommended" | ||
], | ||
"parserOptions": { | ||
"ecmaVersion": 2018, | ||
"sourceType": "module", | ||
"modules": true | ||
}, | ||
"env": { | ||
"es6": true, | ||
"node": true, | ||
"jest": true | ||
}, | ||
"plugins": [ | ||
"prettier" | ||
], | ||
"rules": { | ||
"prettier/prettier": "error" | ||
} | ||
}, | ||
"eslintIgnore": [ | ||
@@ -180,50 +171,4 @@ "jssrc/ttf2woff2.wasm", | ||
}, | ||
"module": "src/index.mjs", | ||
"babel": { | ||
"ignore": [ | ||
"jssrc/ttf2woff2.wasm", | ||
"jssrc/ttf2woff2.js" | ||
], | ||
"presets": [ | ||
[ | ||
"@babel/env", | ||
{ | ||
"targets": { | ||
"node": "14" | ||
} | ||
} | ||
] | ||
], | ||
"env": { | ||
"cjs": { | ||
"presets": [ | ||
[ | ||
"@babel/env", | ||
{ | ||
"targets": { | ||
"node": "14" | ||
}, | ||
"modules": "commonjs" | ||
} | ||
] | ||
], | ||
"comments": true | ||
}, | ||
"mjs": { | ||
"presets": [ | ||
[ | ||
"@babel/env", | ||
{ | ||
"targets": { | ||
"node": "14" | ||
}, | ||
"modules": false | ||
} | ||
] | ||
], | ||
"comments": false | ||
} | ||
}, | ||
"sourceMaps": true | ||
}, | ||
"type": "module", | ||
"types": "dist/index.d.ts", | ||
"jest": { | ||
@@ -237,13 +182,22 @@ "coverageReporters": [ | ||
"roots": [ | ||
"<rootDir>/tests" | ||
"<rootDir>/src" | ||
], | ||
"transformIgnorePatterns": [ | ||
"jssrc/ttf2woff2.wasm", | ||
"jssrc/ttf2woff2.js" | ||
"transform": { | ||
"^.+\\.tsx?$": [ | ||
"@swc/jest", | ||
{} | ||
] | ||
}, | ||
"testEnvironment": "node", | ||
"moduleNameMapper": { | ||
"(.+)\\.js": "$1" | ||
}, | ||
"extensionsToTreatAsEsm": [ | ||
".ts" | ||
], | ||
"moduleFileExtensions": [ | ||
"js", | ||
"wasm" | ||
] | ||
"prettierPath": null | ||
}, | ||
"overrides": { | ||
"eslint": "^9.7.0" | ||
} | ||
} |
@@ -10,7 +10,3 @@ [//]: # ( ) | ||
[![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/nfroidure/ttf2woff2/blob/master/LICENSE) | ||
[![Coverage Status](https://coveralls.io/repos/github/git@github.com:nfroidure/ttf2woff2.git/badge.svg?branch=master)](https://coveralls.io/github/git@github.com:nfroidure/ttf2woff2.git?branch=master) | ||
[![NPM version](https://badge.fury.io/js/ttf2woff2.svg)](https://npmjs.org/package/ttf2woff2) | ||
![Dependency Status](https://img.shields.io/librariesio/release/npm/ttf2woff2?style=flat) | ||
[![Package Quality](https://npm.packagequality.com/shield/ttf2woff2.svg)](https://packagequality.com/#?package=ttf2woff2) | ||
[![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/nfroidure/ttf2woff2/blob/main/LICENSE) | ||
@@ -35,2 +31,3 @@ | ||
On Windows without `cat`, use (in PowerShell): | ||
```pwsh | ||
@@ -45,8 +42,8 @@ Start-Process -NoNewWindow -Wait ttf2woff2.cmd -RedirectStandardInput font.ttf -RedirectStandardOutput font.woff2 | ||
```js | ||
var fs = require('fs'); | ||
var ttf2woff2 = require('ttf2woff2'); | ||
import { readFile, writeFile } from 'node:fs/promises'; | ||
import ttf2woff2 from 'ttf2woff2'; | ||
var input = fs.readFileSync('font.ttf'); | ||
const input = await readFile('font.ttf'); | ||
fs.writeFileSync('font.woff2', ttf2woff2(input)); | ||
await writeFile('font.woff2', ttf2woff2(input)); | ||
``` | ||
@@ -65,2 +62,2 @@ | ||
# License | ||
[MIT](https://github.com/nfroidure/ttf2woff2/blob/master/LICENSE) | ||
[MIT](https://github.com/nfroidure/ttf2woff2/blob/main/LICENSE) |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
4400500
189642
82
327
Yes
6
20
60
+ Addeddebug@^4.3.5
+ Addedyerror@^8.0.0
+ Added@isaacs/cliui@8.0.2(transitive)
+ Added@npmcli/agent@2.2.2(transitive)
+ Added@npmcli/fs@3.1.1(transitive)
+ Added@pkgjs/parseargs@0.11.0(transitive)
+ Addedabbrev@2.0.0(transitive)
+ Addedagent-base@7.1.3(transitive)
+ Addedansi-regex@6.1.0(transitive)
+ Addedansi-styles@4.3.06.2.1(transitive)
+ Addedbufferstreams@4.0.0(transitive)
+ Addedcacache@18.0.4(transitive)
+ Addedcolor-convert@2.0.1(transitive)
+ Addedcolor-name@1.1.4(transitive)
+ Addedcross-spawn@7.0.6(transitive)
+ Addedeastasianwidth@0.2.0(transitive)
+ Addedemoji-regex@9.2.2(transitive)
+ Addedforeground-child@3.3.0(transitive)
+ Addedfs-minipass@3.0.3(transitive)
+ Addedglob@10.4.5(transitive)
+ Addedhttp-proxy-agent@7.0.2(transitive)
+ Addedhttps-proxy-agent@7.0.6(transitive)
+ Addedisexe@3.1.1(transitive)
+ Addedjackspeak@3.4.3(transitive)
+ Addedlru-cache@10.4.3(transitive)
+ Addedmake-fetch-happen@13.0.1(transitive)
+ Addedminimatch@9.0.5(transitive)
+ Addedminipass@7.1.2(transitive)
+ Addedminipass-collect@2.0.1(transitive)
+ Addedminipass-fetch@3.0.5(transitive)
+ Addednode-gyp@10.3.1(transitive)
+ Addednopt@7.2.1(transitive)
+ Addedpackage-json-from-dist@1.0.1(transitive)
+ Addedpath-key@3.1.1(transitive)
+ Addedpath-scurry@1.11.1(transitive)
+ Addedproc-log@4.2.0(transitive)
+ Addedshebang-command@2.0.0(transitive)
+ Addedshebang-regex@3.0.0(transitive)
+ Addedsignal-exit@4.1.0(transitive)
+ Addedsocks-proxy-agent@8.0.5(transitive)
+ Addedssri@10.0.6(transitive)
+ Addedstring-width@5.1.2(transitive)
+ Addedstrip-ansi@7.1.0(transitive)
+ Addedunique-filename@3.0.0(transitive)
+ Addedunique-slug@4.0.0(transitive)
+ Addedwhich@4.0.0(transitive)
+ Addedwrap-ansi@7.0.08.1.0(transitive)
+ Addedyerror@8.0.0(transitive)
- Removed@gar/promisify@1.1.3(transitive)
- Removed@npmcli/fs@2.1.2(transitive)
- Removed@npmcli/move-file@2.0.1(transitive)
- Removed@tootallnate/once@2.0.0(transitive)
- Removedabbrev@1.1.1(transitive)
- Removedagent-base@6.0.2(transitive)
- Removedagentkeepalive@4.6.0(transitive)
- Removedaproba@2.0.0(transitive)
- Removedare-we-there-yet@3.0.1(transitive)
- Removedbrace-expansion@1.1.11(transitive)
- Removedbufferstreams@3.0.0(transitive)
- Removedcacache@16.1.3(transitive)
- Removedcolor-support@1.1.3(transitive)
- Removedconcat-map@0.0.1(transitive)
- Removedconsole-control-strings@1.1.0(transitive)
- Removeddelegates@1.0.0(transitive)
- Removedfs.realpath@1.0.0(transitive)
- Removedgauge@4.0.4(transitive)
- Removedglob@7.2.38.1.0(transitive)
- Removedhas-unicode@2.0.1(transitive)
- Removedhttp-proxy-agent@5.0.0(transitive)
- Removedhttps-proxy-agent@5.0.1(transitive)
- Removedhumanize-ms@1.2.1(transitive)
- Removedinfer-owner@1.0.4(transitive)
- Removedinflight@1.0.6(transitive)
- Removedlru-cache@7.18.3(transitive)
- Removedmake-fetch-happen@10.2.1(transitive)
- Removedminimatch@3.1.25.1.6(transitive)
- Removedminipass-collect@1.0.2(transitive)
- Removedminipass-fetch@2.1.2(transitive)
- Removednode-gyp@9.4.1(transitive)
- Removednopt@6.0.0(transitive)
- Removednpmlog@6.0.2(transitive)
- Removedonce@1.4.0(transitive)
- Removedpath-is-absolute@1.0.1(transitive)
- Removedpromise-inflight@1.0.1(transitive)
- Removedrimraf@3.0.2(transitive)
- Removedset-blocking@2.0.0(transitive)
- Removedsignal-exit@3.0.7(transitive)
- Removedsocks-proxy-agent@7.0.0(transitive)
- Removedssri@9.0.1(transitive)
- Removedunique-filename@2.0.1(transitive)
- Removedunique-slug@3.0.0(transitive)
- Removedwide-align@1.1.5(transitive)
- Removedwrappy@1.0.2(transitive)
Updatedbufferstreams@^4.0.0
Updatednan@^2.20.0
Updatednode-gyp@^10.2.0