@xlfont/load 2.1.6 → 2.1.7

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/CHANGELOG.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # Change Logs
2
2
 
3
+ ## v2.1.7
4
+
5
+ - upgrade `ttf2woff2` ( 4.x -> 8.x ) to fix vulnerabilities in its `node-gyp` -> `tar` dependency chain.
6
+ - `ttf2woff2` is now an ES module, loaded via `require(esm)`: `xfl` cli requires node >= 20.19 / 22.12.
7
+ - move cli ( `xfl`, `xfl-meta` ) dependencies to optional `peerDependencies`, so they are no longer installed along with the browser library.
8
+ - `@plotdb/colors`, `fs-extra`, `progress`, `ttf2woff`, `ttf2woff2`, `yargs`
9
+ - cli checks them before running, and prints the command to install them ( or run via `npx -p` ) if missing.
10
+ - move `@plotdb/guides` to `devDependencies`.
11
+
12
+
3
13
  ## v2.1.6
4
14
 
5
15
  - fix bug: unhandled rejection when font failed to load, due to uncaught `init` call in xlfont constructor.
package/README.md CHANGED
@@ -19,6 +19,13 @@ This is a javascript project based on nodeJS / npm. After installing node / npm,
19
19
 
20
20
  use `npx xfl` to subset fonts with `xfl`:
21
21
 
22
+ `xfl` and `xfl-meta` dependencies are optional peer dependencies ( not installed along with the library ), install them first:
23
+
24
+ npm i -D @plotdb/colors@^0.0.3 fs-extra@^9.1.0 progress@^2.0.3 ttf2woff@^2.0.2 ttf2woff2@^8.0.1 yargs@^16.2.0
25
+
26
+ running `xfl` without them prints the exact command to install, or to run via `npx -p` without installing. node >= 20.19 / 22.12 is required.
27
+
28
+
22
29
  npx xfl font-dir [o output-dir] [-f word-frequency-csv] [-c major-subset-size] [-s subset-size]
23
30
 
24
31
 
package/bin/build.js CHANGED
@@ -1,6 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  (function(){
3
- var fs, path, fsExtra, opentype, yargs, colors, progress, ttf2woff2, ttf2woff, argv, libdir, commonRanges, commonSize, setSize, fontDir, outDir, defaultFrequencyFile, progressBar, fontFileFinder, wordFrequency, codeInFont, files, wordlist, wordfreq, iterateCodes, ttfToWoff2s, processFont, processFonts;
3
+ var fs, path, fsExtra, opentype, yargs, colors, progress, ttf2woff, ttf2woff2, argv, libdir, commonRanges, commonSize, setSize, fontDir, outDir, defaultFrequencyFile, progressBar, fontFileFinder, wordFrequency, codeInFont, files, wordlist, wordfreq, iterateCodes, ttfToWoff2s, processFont, processFonts;
4
+ require('./deps.js');
4
5
  fs = require('fs');
5
6
  path = require('path');
6
7
  fsExtra = require('fs-extra');
@@ -9,8 +10,10 @@
9
10
  path = require('path');
10
11
  colors = require('@plotdb/colors');
11
12
  progress = require('progress');
12
- ttf2woff2 = require('ttf2woff2');
13
13
  ttf2woff = require('ttf2woff');
14
+ ttf2woff2 = (function(m){
15
+ return m['default'] || m;
16
+ }.call(this, require('ttf2woff2')));
14
17
  argv = yargs.usage("usage: npx xfl font-dir [-o output-dir] [-c major-subset-size] [-s subset-size]").option('output', {
15
18
  alias: 'o',
16
19
  description: "output directory. default `output`",
package/bin/deps.js ADDED
@@ -0,0 +1,52 @@
1
+ (function(){
2
+ var fs, path, pkg, names, res$, k, ref$, v, missing, list, run, script, e, cmd;
3
+ fs = require('fs');
4
+ path = require('path');
5
+ pkg = require(path.join(__dirname, '../package.json'));
6
+ res$ = [];
7
+ for (k in ref$ = pkg.peerDependenciesMeta || {}) {
8
+ v = ref$[k];
9
+ if (v.optional) {
10
+ res$.push(k);
11
+ }
12
+ }
13
+ names = res$;
14
+ missing = names.filter(function(it){
15
+ var e;
16
+ try {
17
+ require.resolve(it);
18
+ return false;
19
+ } catch (e$) {
20
+ e = e$;
21
+ return true;
22
+ }
23
+ });
24
+ if (missing.length) {
25
+ list = missing.map(function(it){
26
+ return "\"" + it + "@" + pkg.peerDependencies[it] + "\"";
27
+ }).join(' ');
28
+ run = names.map(function(it){
29
+ return "-p \"" + it + "@" + pkg.peerDependencies[it] + "\"";
30
+ }).join(' ');
31
+ script = (function(){
32
+ try {
33
+ return fs.realpathSync(process.argv[1]);
34
+ } catch (e$) {
35
+ e = e$;
36
+ return '';
37
+ }
38
+ }());
39
+ cmd = (function(){
40
+ var ref$, results$ = [];
41
+ for (k in ref$ = pkg.bin || {}) {
42
+ v = ref$[k];
43
+ if (path.resolve(__dirname, '..', v) === script) {
44
+ results$.push(k);
45
+ }
46
+ }
47
+ return results$;
48
+ }())[0] || 'xfl';
49
+ console.error("[" + pkg.name + "] missing cli dependencies: " + missing.join(', ') + "\ninstall them in your project:\n\n npm i -D " + list + "\n\nor run without installing:\n\n npx -p " + pkg.name + " " + run + " " + cmd + " ...\n");
50
+ process.exit(1);
51
+ }
52
+ }).call(this);
package/bin/meta.js CHANGED
@@ -1,6 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  (function(){
3
3
  var fs, path, colors, yargs, opentype, lib, allRanges, argv, file, all, multiline;
4
+ require('./deps.js');
4
5
  fs = require('fs');
5
6
  path = require('path');
6
7
  colors = require('@plotdb/colors');
package/package.json CHANGED
@@ -1 +1 @@
1
- {"author":"zbryikt","name":"@xlfont/load","license":"MIT","description":"XL font generator and loader","version":"2.1.6","browser":"index.min.js","main":"index.min.js","homepage":"https://github.com/xlfont/load","repository":{"type":"git","url":"https://github.com/xlfont/load"},"engines":{"node":">=10.14.1","npm":">=6.4.1"},"scripts":{"start":"npx server -r web -o true"},"bin":{"xfl":"./bin/build.js","xfl-meta":"./bin/meta.js"},"dependencies":{"@plotdb/colors":"^0.0.3","@plotdb/guides":"github:plotdb/guides#master","@plotdb/opentype.js":"^1.3.5","fs-extra":"^9.1.0","progress":"^2.0.3","ttf2woff":"^2.0.2","ttf2woff2":"^4.0.0","yargs":"^16.2.0"},"devDependencies":{"@loadingio/bootstrap.ext":"^0.0.10","@loadingio/debounce.js":"^1.0.1","@loadingio/ldquery":"^3.0.5","@loadingio/loading.css":"^3.1.0","@zbryikt/deploy":"^0.0.4","@zbryikt/template":"^2.5.0","bootstrap":"^4.5.3","bootstrap.native":"^3.0.13","fedep":"^1.9.0","glob":"^7.2.0","ldbutton":"^2.0.1","ldcover":"^3.5.3","ldloader":"^3.0.2","ldview":"^1.4.0","livescript":"^1.6.0","stylus":"^0.55.0","uglify-js":"^3.13.1","uglifycss":"^0.0.29"},"peerDependencies":{"@plotdb/opentype.js":"^1.3.5","proxise":"^1.0.1"},"frontendDependencies":{"root":"web/static/assets/lib","modules":["bootstrap","bootstrap.native","@loadingio/bootstrap.ext","@loadingio/ldquery","@loadingio/debounce.js","@loadingio/loading.css","@plotdb/opentype.js","ldview","ldcover","ldloader","ldbutton","proxise"]}}
1
+ {"author":"zbryikt","name":"@xlfont/load","license":"MIT","description":"XL font generator and loader","version":"2.1.7","browser":"index.min.js","main":"index.min.js","homepage":"https://github.com/xlfont/load","repository":{"type":"git","url":"https://github.com/xlfont/load"},"engines":{"node":">=10.14.1","npm":">=6.4.1"},"scripts":{"start":"npx server -r web -o true"},"bin":{"xfl":"./bin/build.js","xfl-meta":"./bin/meta.js"},"dependencies":{"@plotdb/opentype.js":"^1.3.5"},"devDependencies":{"@loadingio/bootstrap.ext":"^0.0.10","@loadingio/debounce.js":"^1.0.1","@loadingio/ldquery":"^3.0.5","@loadingio/loading.css":"^3.1.0","@plotdb/colors":"^0.0.3","@plotdb/guides":"github:plotdb/guides#master","@zbryikt/deploy":"^0.0.4","@zbryikt/template":"^2.5.0","bootstrap":"^4.5.3","bootstrap.native":"^3.0.13","fedep":"^1.9.0","fs-extra":"^9.1.0","glob":"^7.2.0","ldbutton":"^2.0.1","ldcover":"^3.5.3","ldloader":"^3.0.2","ldview":"^1.4.0","livescript":"^1.6.0","progress":"^2.0.3","stylus":"^0.55.0","ttf2woff":"^2.0.2","ttf2woff2":"^8.0.1","uglify-js":"^3.13.1","uglifycss":"^0.0.29","yargs":"^16.2.0"},"peerDependencies":{"@plotdb/colors":"^0.0.3","@plotdb/opentype.js":"^1.3.5","fs-extra":"^9.1.0","progress":"^2.0.3","proxise":"^1.0.1","ttf2woff":"^2.0.2","ttf2woff2":"^8.0.1","yargs":"^16.2.0"},"peerDependenciesMeta":{"@plotdb/colors":{"optional":true},"fs-extra":{"optional":true},"progress":{"optional":true},"ttf2woff":{"optional":true},"ttf2woff2":{"optional":true},"yargs":{"optional":true}},"frontendDependencies":{"root":"web/static/assets/lib","modules":["bootstrap","bootstrap.native","@loadingio/bootstrap.ext","@loadingio/ldquery","@loadingio/debounce.js","@loadingio/loading.css","@plotdb/opentype.js","ldview","ldcover","ldloader","ldbutton","proxise"]}}