Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ttf2woff2

Package Overview
Dependencies
Maintainers
0
Versions
23
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ttf2woff2 - npm Package Compare versions

Comparing version 5.0.0 to 6.0.0

dist/cli.test.d.ts

8

bin/ttf2woff2.js
#! /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 @@ }

{
"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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc