Continue ESM transform

This commit is contained in:
be5invis 2022-07-16 20:18:52 -07:00
parent b8205a63aa
commit 36835216f5
44 changed files with 1939 additions and 502 deletions

View file

@ -12,7 +12,7 @@
}, },
"sourceType": "module" "sourceType": "module"
}, },
"extends": ["eslint:recommended", "prettier"], "extends": ["eslint:recommended", "prettier", "plugin:import/recommended"],
"rules": { "rules": {
"semi": ["error", "always"], "semi": ["error", "always"],
"no-var": "error", "no-var": "error",
@ -20,6 +20,17 @@
"no-constant-condition": ["error", { "checkLoops": false }], "no-constant-condition": ["error", { "checkLoops": false }],
"no-mixed-spaces-and-tabs": ["error", "smart-tabs"], "no-mixed-spaces-and-tabs": ["error", "smart-tabs"],
"no-unused-vars": ["off"], "no-unused-vars": ["off"],
"complexity": ["warn", 16] "complexity": ["warn", 16],
"import/newline-after-import": ["error", { "count": 1 }],
"import/no-unresolved": "off",
"import/order": [
"error",
{
"groups": ["builtin", "external", "internal", "parent", "sibling", "index"],
"newlines-between": "always",
"alphabetize": { "order": "asc", "caseInsensitive": true }
}
]
} }
} }

View file

@ -1,11 +1,13 @@
import { CreateEmptyFont } from "./empty-font.mjs";
import { buildGlyphs } from "../glyphs/index.mjs"; import { buildGlyphs } from "../glyphs/index.mjs";
import { copyFontMetrics } from "../meta/aesthetics.mjs";
import { assignFontNames } from "../meta/naming.mjs";
import { buildOtl } from "../otl/index.mjs";
import * as Caching from "./caching/index.mjs";
import { CreateEmptyFont } from "./empty-font.mjs";
import { finalizeFont } from "./finalize/index.mjs"; import { finalizeFont } from "./finalize/index.mjs";
import { convertOtd } from "./otd-conv/index.mjs"; import { convertOtd } from "./otd-conv/index.mjs";
import * as Caching from "./caching/index.mjs";
import { buildOtl } from "../otl/index.mjs";
import { assignFontNames } from "../meta/naming.mjs";
import { copyFontMetrics } from "../meta/aesthetics.mjs";
("use strict"); ("use strict");
export async function buildFont(argv, para) { export async function buildFont(argv, para) {
const gs = buildGlyphs(para); const gs = buildGlyphs(para);

View file

@ -1,5 +1,6 @@
import fs from "fs"; import fs from "fs";
import zlib from "zlib"; import zlib from "zlib";
import { encode, decode } from "@msgpack/msgpack"; import { encode, decode } from "@msgpack/msgpack";
const Edition = 20; const Edition = 20;
@ -75,8 +76,13 @@ class Cache {
export const load = async function (path, version, freshAgeKey) { export const load = async function (path, version, freshAgeKey) {
let cache = new Cache(freshAgeKey); let cache = new Cache(freshAgeKey);
if (path && fs.existsSync(path)) { if (path && fs.existsSync(path)) {
const buf = zlib.gunzipSync(await fs.promises.readFile(path)); try {
cache.loadRep(version, decode(buf)); const buf = zlib.gunzipSync(await fs.promises.readFile(path));
cache.loadRep(version, decode(buf));
} catch (e) {
console.error("Error loading cache. Treat as empty.");
console.error(e);
}
} }
return cache; return cache;
}; };

View file

@ -1,8 +1,9 @@
import * as TypoGeom from "typo-geom"; import * as TypoGeom from "typo-geom";
import * as CurveUtil from "../../support/geometry/curve-util.mjs";
import * as Geom from "../../support/geometry/index.mjs"; import * as Geom from "../../support/geometry/index.mjs";
import { Point } from "../../support/geometry/point.mjs"; import { Point } from "../../support/geometry/point.mjs";
import { Transform } from "../../support/geometry/transform.mjs"; import { Transform } from "../../support/geometry/transform.mjs";
import * as CurveUtil from "../../support/geometry/curve-util.mjs";
/////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////
function regulateGlyphStore(cache, skew, glyphStore) { function regulateGlyphStore(cache, skew, glyphStore) {

View file

@ -1,7 +1,8 @@
import { finalizeGlyphs } from "./glyphs.mjs";
import { gcFont } from "./gc.mjs";
import { Nwid, Wwid } from "../../support/gr.mjs"; import { Nwid, Wwid } from "../../support/gr.mjs";
import { gcFont } from "./gc.mjs";
import { finalizeGlyphs } from "./glyphs.mjs";
function assignGrAndCodeRank(glyphStore, ...flatteners) { function assignGrAndCodeRank(glyphStore, ...flatteners) {
for (const g of glyphStore.glyphs()) { for (const g of glyphStore.glyphs()) {
g.codeRank = 0xffffffff; g.codeRank = 0xffffffff;

View file

@ -1,4 +1,5 @@
import { Joining, AnyCv, TieMark, Nwid, Wwid } from "../../support/gr.mjs"; import { Joining, AnyCv, TieMark, Nwid, Wwid } from "../../support/gr.mjs";
const ApplePostNames = new Map([ const ApplePostNames = new Map([
/* spell-checker: disable */ /* spell-checker: disable */
[0xd, "nonmarkingreturn"], [0xd, "nonmarkingreturn"],

View file

@ -1,7 +1,10 @@
import { Ot } from "ot-builder"; import { Ot } from "ot-builder";
import { Point } from "../../support/geometry/point.mjs"; import { Point } from "../../support/geometry/point.mjs";
import * as Gr from "../../support/gr.mjs"; import * as Gr from "../../support/gr.mjs";
import { byCode, bySpacing, byGr, byBuildOrder } from "./glyph-name.mjs"; import { byCode, bySpacing, byGr, byBuildOrder } from "./glyph-name.mjs";
function byRank([gna, a], [gnb, b]) { function byRank([gna, a], [gnb, b]) {
return ( return (
b.glyphRank - a.glyphRank || b.glyphRank - a.glyphRank ||

View file

@ -1,5 +1,6 @@
import { convertGlyphs } from "./glyphs.mjs"; import { convertGlyphs } from "./glyphs.mjs";
import { convertGsub, convertGpos, convertGdef } from "./layout.mjs"; import { convertGsub, convertGpos, convertGdef } from "./layout.mjs";
export function convertOtd(baseFont, otl, gs) { export function convertOtd(baseFont, otl, gs) {
const { glyphs, cmap } = convertGlyphs(gs); const { glyphs, cmap } = convertGlyphs(gs);
const gsub = convertGsub(otl.GSUB, glyphs); const gsub = convertGsub(otl.GSUB, glyphs);

View file

@ -1,338 +1,310 @@
import { Ot } from "ot-builder"; import { Ot } from "ot-builder";
class LookupStore { class LookupStore {
constructor(handlers, glyphs) { constructor(handlers, glyphs) {
this.glyphs = glyphs; this.glyphs = glyphs;
this.m_handlers = handlers; this.m_handlers = handlers;
this.m_mapping = new Map(); this.m_mapping = new Map();
} }
extract() { extract() {
return Array.from(this.m_mapping.values()); return Array.from(this.m_mapping.values());
} }
query(id) { query(id) {
return this.m_mapping.get(id); return this.m_mapping.get(id);
} }
declare(id, otdLookup) { declare(id, otdLookup) {
if (this.m_mapping.has(id)) if (this.m_mapping.has(id)) return;
return; const handler = this.m_handlers[otdLookup.type];
const handler = this.m_handlers[otdLookup.type]; if (!handler) return;
if (!handler) this.m_mapping.set(id, handler.init());
return; }
this.m_mapping.set(id, handler.init()); fill(id, otdLookup) {
} const dst = this.query(id);
fill(id, otdLookup) { const handler = this.m_handlers[otdLookup.type];
const dst = this.query(id); if (!dst || !handler) return;
const handler = this.m_handlers[otdLookup.type]; if (otdLookup.subtables) throw new Error("Unreachable.");
if (!dst || !handler) handler.fill(dst, otdLookup, this);
return; }
if (otdLookup.subtables)
throw new Error("Unreachable.");
handler.fill(dst, otdLookup, this);
}
} }
const GsubSingleHandler = { const GsubSingleHandler = {
init() { init() {
return new Ot.Gsub.Single(); return new Ot.Gsub.Single();
}, },
fill(dst, src, store) { fill(dst, src, store) {
const st = src.substitutions; const st = src.substitutions;
for (const k in st) { for (const k in st) {
const from = store.glyphs.queryByName(k); const from = store.glyphs.queryByName(k);
const to = store.glyphs.queryByName(st[k]); const to = store.glyphs.queryByName(st[k]);
if (from && to) if (from && to) dst.mapping.set(from, to);
dst.mapping.set(from, to); }
} }
}
}; };
const GsubMultipleHandler = { const GsubMultipleHandler = {
init() { init() {
return new Ot.Gsub.Multiple(); return new Ot.Gsub.Multiple();
}, },
fill(dst, src, store) { fill(dst, src, store) {
const st = src.substitutions; const st = src.substitutions;
for (const k in st) { for (const k in st) {
const from = store.glyphs.queryByName(k); const from = store.glyphs.queryByName(k);
const to = mapGlyphListAll(st[k], store); const to = mapGlyphListAll(st[k], store);
if (!from || !to) if (!from || !to) continue;
continue; dst.mapping.set(from, to);
dst.mapping.set(from, to); }
} }
}
}; };
const GsubAlternateHandler = { const GsubAlternateHandler = {
init() { init() {
return new Ot.Gsub.Alternate(); return new Ot.Gsub.Alternate();
}, },
fill: GsubMultipleHandler.fill fill: GsubMultipleHandler.fill
}; };
const GsubLigatureHandler = { const GsubLigatureHandler = {
init() { init() {
return new Ot.Gsub.Ligature(); return new Ot.Gsub.Ligature();
}, },
fill(dst, src, store) { fill(dst, src, store) {
const st = src.substitutions; const st = src.substitutions;
for (const { from: _from, to: _to } of st) { for (const { from: _from, to: _to } of st) {
const to = store.glyphs.queryByName(_to); const to = store.glyphs.queryByName(_to);
const from = mapGlyphListAll(_from, store); const from = mapGlyphListAll(_from, store);
if (!from || !to) if (!from || !to) continue;
continue; dst.mapping.push({ from, to });
dst.mapping.push({ from, to }); }
} }
}
}; };
const GsubChainingHandler = { const GsubChainingHandler = {
init() { init() {
return new Ot.Gsub.Chaining(); return new Ot.Gsub.Chaining();
}, },
fill(dst, src, store) { fill(dst, src, store) {
out: for (const st of src.rules) { out: for (const st of src.rules) {
const match = []; const match = [];
for (const m of st.match) { for (const m of st.match) {
const m1 = mapGlyphListSome(m, store); const m1 = mapGlyphListSome(m, store);
if (!m1) if (!m1) continue out;
continue out; match.push(new Set(m1));
match.push(new Set(m1)); }
} const inputBegins = st.inputBegins;
const inputBegins = st.inputBegins; const inputEnds = st.inputEnds;
const inputEnds = st.inputEnds; const applications = [];
const applications = []; for (const ap of st.apply) {
for (const ap of st.apply) { const lookup = store.query(ap.lookup);
const lookup = store.query(ap.lookup); if (!lookup) continue out;
if (!lookup) applications.push({ at: ap.at - inputBegins, apply: lookup });
continue out; }
applications.push({ at: ap.at - inputBegins, apply: lookup }); dst.rules.push({ match, inputBegins, inputEnds, applications });
} }
dst.rules.push({ match, inputBegins, inputEnds, applications }); }
}
}
}; };
const GsubReverseHandler = { const GsubReverseHandler = {
init() { init() {
return new Ot.Gsub.ReverseSub(); return new Ot.Gsub.ReverseSub();
}, },
fill(dst, src, store) { fill(dst, src, store) {
out: for (const st of src.rules) { out: for (const st of src.rules) {
const match = []; const match = [];
const doSubAt = st.inputIndex; const doSubAt = st.inputIndex;
const replacement = new Map(); const replacement = new Map();
for (let j = 0; j < st.match.length; j++) { for (let j = 0; j < st.match.length; j++) {
{ {
const m1 = new Set(); const m1 = new Set();
for (let k = 0; k < st.match[j].length; k++) { for (let k = 0; k < st.match[j].length; k++) {
const gFrom = store.glyphs.queryByName(st.match[j][k]); const gFrom = store.glyphs.queryByName(st.match[j][k]);
if (gFrom) if (gFrom) m1.add(gFrom);
m1.add(gFrom); }
} if (!m1.size) continue out;
if (!m1.size) match.push(m1);
continue out; }
match.push(m1); if (j === doSubAt) {
} for (let k = 0; k < st.match[j].length; k++) {
if (j === doSubAt) { const gFrom = store.glyphs.queryByName(st.match[j][k]);
for (let k = 0; k < st.match[j].length; k++) { const gTo = store.glyphs.queryByName(st.to[k]);
const gFrom = store.glyphs.queryByName(st.match[j][k]); if (!gFrom) continue;
const gTo = store.glyphs.queryByName(st.to[k]); if (gTo) {
if (!gFrom) replacement.set(gFrom, gTo);
continue; } else {
if (gTo) { replacement.set(gFrom, gFrom);
replacement.set(gFrom, gTo); }
} }
else { }
replacement.set(gFrom, gFrom); }
} dst.rules.push({ match, doSubAt, replacement });
} }
} }
}
dst.rules.push({ match, doSubAt, replacement });
}
}
}; };
function mapGlyphListAll(gl, store) { function mapGlyphListAll(gl, store) {
const out = []; const out = [];
for (const item of gl) { for (const item of gl) {
const fg = store.glyphs.queryByName(item); const fg = store.glyphs.queryByName(item);
if (!fg) if (!fg) return null;
return null; out.push(fg);
out.push(fg); }
} return out;
return out;
} }
function mapGlyphListSome(gl, store) { function mapGlyphListSome(gl, store) {
const out = []; const out = [];
for (const item of gl) { for (const item of gl) {
const fg = store.glyphs.queryByName(item); const fg = store.glyphs.queryByName(item);
if (!fg) if (!fg) continue;
continue; out.push(fg);
out.push(fg); }
} if (!out.length) return null;
if (!out.length) return out;
return null;
return out;
} }
const GsubHandlers = { const GsubHandlers = {
gsub_single: GsubSingleHandler, gsub_single: GsubSingleHandler,
gsub_multiple: GsubMultipleHandler, gsub_multiple: GsubMultipleHandler,
gsub_alternate: GsubAlternateHandler, gsub_alternate: GsubAlternateHandler,
gsub_ligature: GsubLigatureHandler, gsub_ligature: GsubLigatureHandler,
gsub_chaining: GsubChainingHandler, gsub_chaining: GsubChainingHandler,
gsub_reverse: GsubReverseHandler gsub_reverse: GsubReverseHandler
}; };
const GposMarkToBaseHandler = { const GposMarkToBaseHandler = {
init() { init() {
return new Ot.Gpos.MarkToBase(); return new Ot.Gpos.MarkToBase();
}, },
fill(dst, src, store) { fill(dst, src, store) {
const mm = collectClassMap(src.marks); const mm = collectClassMap(src.marks);
dst.marks = convertMarkRecords(src.marks, mm, store); dst.marks = convertMarkRecords(src.marks, mm, store);
dst.bases = convertBaseRecords(src.bases, mm, store); dst.bases = convertBaseRecords(src.bases, mm, store);
} }
}; };
const GposMarkToMarkHandler = { const GposMarkToMarkHandler = {
init() { init() {
return new Ot.Gpos.MarkToMark(); return new Ot.Gpos.MarkToMark();
}, },
fill(dst, src, store) { fill(dst, src, store) {
const mm = collectClassMap(src.marks); const mm = collectClassMap(src.marks);
dst.marks = convertMarkRecords(src.marks, mm, store); dst.marks = convertMarkRecords(src.marks, mm, store);
dst.baseMarks = convertBaseRecords(src.bases, mm, store); dst.baseMarks = convertBaseRecords(src.bases, mm, store);
} }
}; };
function collectClassMap(marks) { function collectClassMap(marks) {
let n = 0; let n = 0;
const m = new Map(); const m = new Map();
for (const gn in marks) { for (const gn in marks) {
const mark = marks[gn]; const mark = marks[gn];
if (!m.has(mark.class)) { if (!m.has(mark.class)) {
m.set(mark.class, n); m.set(mark.class, n);
n++; n++;
} }
} }
return m; return m;
} }
function convertMarkRecords(marks, mm, store) { function convertMarkRecords(marks, mm, store) {
const out = new Map(); const out = new Map();
for (const gn in marks) { for (const gn in marks) {
const mark = marks[gn]; const mark = marks[gn];
const g = store.glyphs.queryByName(gn); const g = store.glyphs.queryByName(gn);
if (!g) if (!g) continue;
continue; let markAnchors = [];
let markAnchors = []; markAnchors[mm.get(mark.class)] = { x: mark.x, y: mark.y };
markAnchors[mm.get(mark.class)] = { x: mark.x, y: mark.y }; out.set(g, { markAnchors: markAnchors });
out.set(g, { markAnchors: markAnchors }); }
} return out;
return out;
} }
function convertBaseRecords(bases, mm, store) { function convertBaseRecords(bases, mm, store) {
const out = new Map(); const out = new Map();
for (const gn in bases) { for (const gn in bases) {
const baseObj = bases[gn]; const baseObj = bases[gn];
const g = store.glyphs.queryByName(gn); const g = store.glyphs.queryByName(gn);
if (!g) if (!g) continue;
continue; const baseArray = [];
const baseArray = []; for (const bkStr in baseObj) {
for (const bkStr in baseObj) { baseArray[mm.get(bkStr)] = baseObj[bkStr];
baseArray[mm.get(bkStr)] = baseObj[bkStr]; }
} out.set(g, { baseAnchors: baseArray });
out.set(g, { baseAnchors: baseArray }); }
} return out;
return out;
} }
const GposHandlers = { const GposHandlers = {
gpos_mark_to_base: GposMarkToBaseHandler, gpos_mark_to_base: GposMarkToBaseHandler,
gpos_mark_to_mark: GposMarkToMarkHandler gpos_mark_to_mark: GposMarkToMarkHandler
}; };
class FeatureStore { class FeatureStore {
constructor(lookups) { constructor(lookups) {
this.lookupStore = lookups; this.lookupStore = lookups;
this.m_mapping = new Map(); this.m_mapping = new Map();
} }
extract() { extract() {
return Array.from(this.m_mapping.values()); return Array.from(this.m_mapping.values());
} }
query(id) { query(id) {
return this.m_mapping.get(id); return this.m_mapping.get(id);
} }
fill(id, data) { fill(id, data) {
const tag = id.slice(0, 4); const tag = id.slice(0, 4);
const lookups = []; const lookups = [];
for (const lid of data) { for (const lid of data) {
const lookup = this.lookupStore.query(lid); const lookup = this.lookupStore.query(lid);
if (lookup) if (lookup) lookups.push(lookup);
lookups.push(lookup); }
} this.m_mapping.set(id, { tag, lookups });
this.m_mapping.set(id, { tag, lookups }); }
}
} }
class ScriptLanguageStore { class ScriptLanguageStore {
constructor(features) { constructor(features) {
this.featureStore = features; this.featureStore = features;
this.m_scriptMapping = new Map(); this.m_scriptMapping = new Map();
} }
extract() { extract() {
return this.m_scriptMapping; return this.m_scriptMapping;
} }
fill(id, data) { fill(id, data) {
const scriptTag = id.slice(0, 4); const scriptTag = id.slice(0, 4);
const languageTag = id.slice(5, 9).padEnd(4); const languageTag = id.slice(5, 9).padEnd(4);
let sr = this.m_scriptMapping.get(scriptTag); let sr = this.m_scriptMapping.get(scriptTag);
if (!sr) { if (!sr) {
sr = { defaultLanguage: null, languages: new Map() }; sr = { defaultLanguage: null, languages: new Map() };
this.m_scriptMapping.set(scriptTag, sr); this.m_scriptMapping.set(scriptTag, sr);
} }
const lr = this.createLanguageRecord(data); const lr = this.createLanguageRecord(data);
if (languageTag === "dflt" || languageTag === "DFLT") if (languageTag === "dflt" || languageTag === "DFLT") sr.defaultLanguage = lr;
sr.defaultLanguage = lr; else sr.languages.set(languageTag, lr);
else }
sr.languages.set(languageTag, lr); createLanguageRecord(data) {
} const features = [];
createLanguageRecord(data) { for (const fid of data.features) {
const features = []; const feature = this.featureStore.query(fid);
for (const fid of data.features) { if (feature) features.push(feature);
const feature = this.featureStore.query(fid); }
if (feature) return {
features.push(feature); requiredFeature: this.featureStore.query(data.requiredFeature) || null,
} features: features
return { };
requiredFeature: this.featureStore.query(data.requiredFeature) || null, }
features: features
};
}
} }
function ConvertGsubGposT(handlers, T) { function ConvertGsubGposT(handlers, T) {
return function (table, glyphs) { return function (table, glyphs) {
if (!table) if (!table) return null;
return null; const ls = new LookupStore(handlers, glyphs);
const ls = new LookupStore(handlers, glyphs); if (table.lookups) {
if (table.lookups) { if (table.lookupOrder) {
if (table.lookupOrder) { for (const l of table.lookupOrder) ls.declare(l, table.lookups[l]);
for (const l of table.lookupOrder) }
ls.declare(l, table.lookups[l]); for (const l in table.lookups) ls.declare(l, table.lookups[l]);
} for (const l in table.lookups) ls.fill(l, table.lookups[l]);
for (const l in table.lookups) }
ls.declare(l, table.lookups[l]); const fs = new FeatureStore(ls);
for (const l in table.lookups) if (table.features) {
ls.fill(l, table.lookups[l]); for (const f in table.features) fs.fill(f, table.features[f]);
} }
const fs = new FeatureStore(ls); const ss = new ScriptLanguageStore(fs);
if (table.features) { if (table.languages) {
for (const f in table.features) for (const sl in table.languages) ss.fill(sl, table.languages[sl]);
fs.fill(f, table.features[f]); }
} return new T(ss.extract(), fs.extract(), ls.extract());
const ss = new ScriptLanguageStore(fs); };
if (table.languages) {
for (const sl in table.languages)
ss.fill(sl, table.languages[sl]);
}
return new T(ss.extract(), fs.extract(), ls.extract());
};
} }
function convertGdef(otdGdef, glyphs) { function convertGdef(otdGdef, glyphs) {
const gdef = new Ot.Gdef.Table(); const gdef = new Ot.Gdef.Table();
gdef.glyphClassDef = new Map(); gdef.glyphClassDef = new Map();
for (const gn in otdGdef.glyphClassDef) { for (const gn in otdGdef.glyphClassDef) {
const g = glyphs.queryByName(gn); const g = glyphs.queryByName(gn);
if (g) if (g) gdef.glyphClassDef.set(g, otdGdef.glyphClassDef[gn]);
gdef.glyphClassDef.set(g, otdGdef.glyphClassDef[gn]); }
} return gdef;
return gdef;
} }
export const convertGsub = ConvertGsubGposT(GsubHandlers, Ot.Gsub.Table); export const convertGsub = ConvertGsubGposT(GsubHandlers, Ot.Gsub.Table);
export const convertGpos = ConvertGsubGposT(GposHandlers, Ot.Gpos.Table); export const convertGpos = ConvertGsubGposT(GposHandlers, Ot.Gpos.Table);

View file

@ -1,16 +1,18 @@
import fs from "fs"; import fs from "fs";
import path from "path"; import path from "path";
import zlib from "zlib";
import * as url from "url"; import * as url from "url";
import zlib from "zlib";
import * as Toml from "@iarna/toml";
import { encode } from "@msgpack/msgpack"; import { encode } from "@msgpack/msgpack";
import { FontIo } from "ot-builder"; import { FontIo } from "ot-builder";
import * as Toml from "@iarna/toml";
import { buildFont } from "./gen/build-font.mjs"; import { buildFont } from "./gen/build-font.mjs";
import * as Parameters from "./support/parameters.mjs";
import { applyMetricOverride } from "./support/metric-override.mjs";
import * as VariantData from "./support/variant-data.mjs";
import { applyLigationData } from "./support/ligation-data.mjs";
import { createGrDisplaySheet } from "./support/gr.mjs"; import { createGrDisplaySheet } from "./support/gr.mjs";
import { applyLigationData } from "./support/ligation-data.mjs";
import { applyMetricOverride } from "./support/metric-override.mjs";
import * as Parameters from "./support/parameters.mjs";
import * as VariantData from "./support/variant-data.mjs";
const __filename = url.fileURLToPath(import.meta.url); const __filename = url.fileURLToPath(import.meta.url);
const __dirname = url.fileURLToPath(new URL(".", import.meta.url)); const __dirname = url.fileURLToPath(new URL(".", import.meta.url));

View file

@ -1,41 +0,0 @@
import * as TypoGeom from "typo-geom";
import { BooleanGeometry, TransformedGeometry } from "../support/geometry/index.mjs";
///////////////////////////////////////////////////////////////////////////////////////////////////
class BooleImpl {
constructor(bindings, operator, operands) {
this.bindings = bindings;
this.operator = operator;
this.operands = operands;
}
applyToGlyph(glyph) {
const operandGeometries = [];
const forwardGizmo = glyph.gizmo || this.bindings.GlobalTransform;
const backwardGizmo = forwardGizmo.inverse();
for (const operand of this.operands) {
const g1 = new this.bindings.Glyph();
g1.gizmo = forwardGizmo;
g1.include(operand);
operandGeometries.push(new TransformedGeometry(g1.geometry, backwardGizmo));
}
return glyph.includeGeometry(
new TransformedGeometry(
new BooleanGeometry(this.operator, operandGeometries),
forwardGizmo
)
);
}
}
export const SetupBuilders = function (bindings) {
const union = (...operands) =>
new BooleImpl(bindings, TypoGeom.Boolean.ClipType.ctUnion, operands);
const intersection = (...operands) =>
new BooleImpl(bindings, TypoGeom.Boolean.ClipType.ctIntersection, operands);
const difference = (...operands) =>
new BooleImpl(bindings, TypoGeom.Boolean.ClipType.ctDifference, operands);
return {
union: union,
intersection: intersection,
difference: difference
};
};

View file

@ -1,4 +1,5 @@
import * as TypoGeom from "typo-geom"; import * as TypoGeom from "typo-geom";
import { BooleanGeometry, TransformedGeometry } from "../support/geometry/index.mjs"; import { BooleanGeometry, TransformedGeometry } from "../support/geometry/index.mjs";
/////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////

View file

@ -1,7 +1,7 @@
import * as CurveUtil from "../support/geometry/curve-util.mjs"; import * as CurveUtil from "../support/geometry/curve-util.mjs";
import { SpiroGeometry, DiSpiroGeometry } from "../support/geometry/index.mjs";
import { BiKnotCollector } from "../support/geometry/spiro-expand.mjs"; import { BiKnotCollector } from "../support/geometry/spiro-expand.mjs";
import { fallback, mix, bez3 } from "../support/utils.mjs"; import { fallback, mix, bez3 } from "../support/utils.mjs";
import { SpiroGeometry, DiSpiroGeometry } from "../support/geometry/index.mjs";
/////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////
class DispiroImpl { class DispiroImpl {

View file

@ -1,4 +1,5 @@
import * as TypoGeom from "typo-geom"; import * as TypoGeom from "typo-geom";
import { Point } from "./point.mjs"; import { Point } from "./point.mjs";
import { Transform } from "./transform.mjs"; import { Transform } from "./transform.mjs";

View file

@ -1,11 +1,14 @@
import crypto from "crypto"; import crypto from "crypto";
import * as TypoGeom from "typo-geom";
import * as SpiroJs from "spiro"; import * as SpiroJs from "spiro";
import * as CurveUtil from "./curve-util.mjs"; import * as TypoGeom from "typo-geom";
import * as Format from "../util/formatter.mjs"; import * as Format from "../util/formatter.mjs";
import * as CurveUtil from "./curve-util.mjs";
import { Point } from "./point.mjs"; import { Point } from "./point.mjs";
import { Transform } from "./transform.mjs";
import { SpiroExpander } from "./spiro-expand.mjs"; import { SpiroExpander } from "./spiro-expand.mjs";
import { Transform } from "./transform.mjs";
class GeometryBase { class GeometryBase {
asContours() { asContours() {

View file

@ -1,6 +1,7 @@
import * as SpiroJs from "spiro"; import * as SpiroJs from "spiro";
import { linreg } from "../utils.mjs";
import * as Format from "../util/formatter.mjs"; import * as Format from "../util/formatter.mjs";
import { linreg } from "../utils.mjs";
class BiKnot { class BiKnot {
constructor(type, x, y, d1, d2) { constructor(type, x, y, d1, d2) {

View file

@ -1,7 +1,7 @@
import { Transform } from "../geometry/transform.mjs";
import { Point } from "../geometry/point.mjs";
import { Anchor } from "../geometry/anchor.mjs"; import { Anchor } from "../geometry/anchor.mjs";
import * as Geom from "../geometry/index.mjs"; import * as Geom from "../geometry/index.mjs";
import { Point } from "../geometry/point.mjs";
import { Transform } from "../geometry/transform.mjs";
export class Glyph { export class Glyph {
constructor(_identifier) { constructor(_identifier) {

1415
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -24,6 +24,7 @@
"cldr": "^7.2.0", "cldr": "^7.2.0",
"eslint": "^8.18.0", "eslint": "^8.18.0",
"eslint-config-prettier": "^8.5.0", "eslint-config-prettier": "^8.5.0",
"eslint-plugin-import": "^2.26.0",
"patel": "^0.38.0", "patel": "^0.38.0",
"prettier": "^2.7.1", "prettier": "^2.7.1",
"verda": "^1.10.0", "verda": "^1.10.0",

View file

@ -1,8 +1,12 @@
import fs from "fs"; import fs from "fs";
import path from "path"; import path from "path";
import { parseVariantsData } from "../export-data/variants-data.mjs"; import * as url from "url";
import { parseLigationData } from "../export-data/ligation-data.mjs"; import { parseLigationData } from "../export-data/ligation-data.mjs";
import { getCharMapAndSupportedLanguageList } from "../export-data/supported-languages.mjs"; import { getCharMapAndSupportedLanguageList } from "../export-data/supported-languages.mjs";
import { parseVariantsData } from "../export-data/variants-data.mjs";
const __dirname = url.fileURLToPath(new URL(".", import.meta.url));
async function processSsOt(dirs) { async function processSsOt(dirs) {
const variantsData = await parseVariantsData(); const variantsData = await parseVariantsData();

View file

@ -1,6 +1,7 @@
import ucdNames from "@unicode/unicode-14.0.0/Names"; import ucdNames from "@unicode/unicode-14.0.0/Names/index.js";
for (let i = 2; i < process.argv.length; i++) { for (let i = 2; i < process.argv.length; i++) {
const lch = parseInt(process.argv[i], 16); const lch = parseInt(process.argv[i], 16);
const name = ucdNames.get(lch); const name = ucdNames.get(lch);
console.log(" -", name, `(\`U+${lch.toString(16).toUpperCase().padStart(4, "0")}\`);`); console.log(" -", name, `(\`U+${lch.toString(16).toUpperCase().padStart(4, "0")}\`);`);
} }

View file

@ -1,29 +1,29 @@
import fs from "fs";
import crypto from "crypto"; import crypto from "crypto";
import fs from "fs";
function hashFile(path) { function hashFile(path) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
let sum = crypto.createHash("sha256"); let sum = crypto.createHash("sha256");
let fileStream = fs.createReadStream(path); let fileStream = fs.createReadStream(path);
fileStream.on("error", err => { fileStream.on("error", err => {
return reject(err); return reject(err);
}); });
fileStream.on("data", chunk => { fileStream.on("data", chunk => {
try { try {
sum.update(chunk); sum.update(chunk);
} } catch (ex) {
catch (ex) { return reject(ex);
return reject(ex); }
} });
}); fileStream.on("end", () => {
fileStream.on("end", () => { return resolve(sum.digest("hex"));
return resolve(sum.digest("hex")); });
}); });
});
} }
export default (async function (out, archiveFiles) { export default (async function (out, archiveFiles) {
let s = ""; let s = "";
for (const file of archiveFiles) { for (const file of archiveFiles) {
s += `${file.base}\t${await hashFile(file.full)}\n`; s += `${file.base}\t${await hashFile(file.full)}\n`;
} }
await fs.promises.writeFile(out, s); await fs.promises.writeFile(out, s);
}); });

View file

@ -1,15 +1,20 @@
import UnicodeDataIndex from "@unicode/unicode-14.0.0"; import UnicodeDataIndex from "@unicode/unicode-14.0.0";
const BlockData = [
[[0xe0a0, 0xe0df], "Private Use Area — Powerline"], export async function collectBlockData() {
[[0xee00, 0xee3f], "Private Use Area — Progress Bar"], const BlockData = [
// Missing ranges in UnicodeDataIndex [[0xe0a0, 0xe0df], "Private Use Area — Powerline"],
[[0x1fa70, 0x1faff], "Symbols and Pictographs Extended-A "], [[0xee00, 0xee3f], "Private Use Area — Progress Bar"],
[[0x1fb00, 0x1fbff], "Symbols for Legacy Computing"] // Missing ranges in UnicodeDataIndex
]; [[0x1fa70, 0x1faff], "Symbols and Pictographs Extended-A "],
for (const id of UnicodeDataIndex.Block) { [[0x1fb00, 0x1fbff], "Symbols for Legacy Computing"]
if (!id || /Private_Use_Area/.test(id) || /undefined/.test(id)) ];
continue;
BlockData.push([[rg[0].begin, rg[0].end - 1], id.replace(/_/g, " ")]); for (const id of UnicodeDataIndex.Block) {
if (!id || /Private_Use_Area/.test(id) || /undefined/.test(id)) continue;
const rangesModule = await import(`@unicode/unicode-14.0.0/Block/${id}/ranges.js`);
const rg = rangesModule.default;
BlockData.push([[rg[0].begin, rg[0].end - 1], id.replace(/_/g, " ")]);
}
BlockData.sort((a, b) => a[0][0] - b[0][0]);
return BlockData;
} }
BlockData.sort((a, b) => a[0][0] - b[0][0]);
export { BlockData };

View file

@ -1,6 +1,8 @@
import { BlockData } from "./block-data.mjs"; import ugc from "@unicode/unicode-14.0.0/General_Category/index.js";
import ucdNames from "@unicode/unicode-14.0.0/Names"; import ucdNames from "@unicode/unicode-14.0.0/Names/index.js";
import ugc from "@unicode/unicode-14.0.0/General_Category";
import { collectBlockData } from "./block-data.mjs";
function findFirstLastChar(lchBlockStart, lchBlockEnd, cov) { function findFirstLastChar(lchBlockStart, lchBlockEnd, cov) {
let lchFirst = 0, let lchFirst = 0,
lchLast = 0; lchLast = 0;
@ -18,9 +20,9 @@ function findFirstLastChar(lchBlockStart, lchBlockEnd, cov) {
const lchEnd = ((lchLast >>> 4) << 4) + 0x10; const lchEnd = ((lchLast >>> 4) << 4) + 0x10;
return [lchStart, lchEnd]; return [lchStart, lchEnd];
} }
export const gatherCoverageData = function (covUpright, covItalic, covOblique) { export async function gatherCoverageData(covUpright, covItalic, covOblique) {
const result = []; const result = [];
for (const [[lchBlockStart, lchBlockEnd], block] of BlockData) { for (const [[lchBlockStart, lchBlockEnd], block] of await collectBlockData()) {
let blockResults = []; let blockResults = [];
const [lchStart, lchEnd] = findFirstLastChar(lchBlockStart, lchBlockEnd, covUpright); const [lchStart, lchEnd] = findFirstLastChar(lchBlockStart, lchBlockEnd, covUpright);
if (!lchStart || !lchEnd) continue; if (!lchStart || !lchEnd) continue;
@ -63,4 +65,4 @@ export const gatherCoverageData = function (covUpright, covItalic, covOblique) {
} }
} }
return result; return result;
}; }

View file

@ -1,11 +1,19 @@
import fs from "fs"; import fs from "fs";
import { parseVariantsData } from "./variants-data.mjs"; import path from "path";
import * as url from "url";
import { parseLigationData } from "./ligation-data.mjs"; import { parseLigationData } from "./ligation-data.mjs";
import { getCharMapAndSupportedLanguageList } from "./supported-languages.mjs"; import { getCharMapAndSupportedLanguageList } from "./supported-languages.mjs";
import package$0 from "../../package.json" assert { type: "json" }; import { parseVariantsData } from "./variants-data.mjs";
export default main;
async function main(argv) {
const __dirname = url.fileURLToPath(new URL(".", import.meta.url));
const packageJson = JSON.parse(
await fs.promises.readFile(path.join(__dirname, "../../package.json"))
);
const version = packageJson.version;
const version = package$0.version;
export default (async function main(argv) {
const variantsData = await parseVariantsData(); const variantsData = await parseVariantsData();
const ligationData = await parseLigationData(); const ligationData = await parseLigationData();
const cl = await getCharMapAndSupportedLanguageList( const cl = await getCharMapAndSupportedLanguageList(
@ -32,4 +40,4 @@ export default (async function main(argv) {
argv.exportPathCov, argv.exportPathCov,
JSON.stringify({ version, ...cl }, { spaces: 2 }) JSON.stringify({ version, ...cl }, { spaces: 2 })
); );
}); }

View file

@ -1,5 +1,7 @@
import fs from "fs"; import fs from "fs";
import path from "path"; import path from "path";
import * as url from "url";
import * as toml from "@iarna/toml"; import * as toml from "@iarna/toml";
const ligationSamples = [ const ligationSamples = [
@ -217,6 +219,7 @@ function buildLigationSet(ligData, getKey) {
return ligationSets; return ligationSets;
} }
export const parseLigationData = async function () { export const parseLigationData = async function () {
const __dirname = url.fileURLToPath(new URL(".", import.meta.url));
const ligToml = await fs.promises.readFile( const ligToml = await fs.promises.readFile(
path.join(__dirname, "../../params/ligation-set.toml"), path.join(__dirname, "../../params/ligation-set.toml"),
"utf8" "utf8"

View file

@ -1,7 +1,9 @@
import cldr from "cldr";
import fs from "fs"; import fs from "fs";
import zlib from "zlib"; import zlib from "zlib";
import { decode } from "@msgpack/msgpack"; import { decode } from "@msgpack/msgpack";
import cldr from "cldr";
import { gatherCoverageData } from "./coverage-export/gather-coverage-data.mjs"; import { gatherCoverageData } from "./coverage-export/gather-coverage-data.mjs";
// List all the languages that Iosevka supports, but cannot inferred from CLDR data. // List all the languages that Iosevka supports, but cannot inferred from CLDR data.
@ -74,11 +76,7 @@ function getRawCoverage(charMap) {
for (const u of codes) rawCoverage.set(u, [gn, tv, cv]); for (const u of codes) rawCoverage.set(u, [gn, tv, cv]);
return rawCoverage; return rawCoverage;
} }
export const getCharMapAndSupportedLanguageList = async function ( export async function getCharMapAndSupportedLanguageList(cmpUpright, cmpItalic, cmpOblique) {
cmpUpright,
cmpItalic,
cmpOblique
) {
const charMap = await readMpCharMap(cmpUpright); const charMap = await readMpCharMap(cmpUpright);
const charMapItalic = await readMpCharMap(cmpItalic); const charMapItalic = await readMpCharMap(cmpItalic);
const charMapOblique = await readMpCharMap(cmpOblique); const charMapOblique = await readMpCharMap(cmpOblique);
@ -90,7 +88,11 @@ export const getCharMapAndSupportedLanguageList = async function (
glyphCount: charMap.length, glyphCount: charMap.length,
codePointCount: rawCoverage.size codePointCount: rawCoverage.size
}, },
unicodeCoverage: gatherCoverageData(rawCoverage, rawCoverageItalic, rawCoverageOblique), unicodeCoverage: await gatherCoverageData(
rawCoverage,
rawCoverageItalic,
rawCoverageOblique
),
languages: Array.from(getSupportedLanguageSet(rawCoverage)).sort() languages: Array.from(getSupportedLanguageSet(rawCoverage)).sort()
}; };
}; }

View file

@ -1,6 +1,9 @@
import fs from "fs"; import fs from "fs";
import path from "path"; import path from "path";
import * as url from "url";
import * as toml from "@iarna/toml"; import * as toml from "@iarna/toml";
import * as VariantDataParser from "../../font-src/support/variant-data.mjs"; import * as VariantDataParser from "../../font-src/support/variant-data.mjs";
function getCvData(parsed) { function getCvData(parsed) {
@ -138,6 +141,7 @@ function uniqueHotChars(cfgDefault, cfgSS) {
return Array.from(s); return Array.from(s);
} }
export const parseVariantsData = async function () { export const parseVariantsData = async function () {
const __dirname = url.fileURLToPath(new URL(".", import.meta.url));
const variantsToml = await fs.promises.readFile( const variantsToml = await fs.promises.readFile(
path.join(__dirname, "../../params/variants.toml"), path.join(__dirname, "../../params/variants.toml"),
"utf8" "utf8"

View file

@ -1,8 +1,13 @@
import path from "path";
import fs from "fs"; import fs from "fs";
import path from "path";
import * as url from "url";
import semver from "semver"; import semver from "semver";
import { Output } from "./shared/index.mjs"; import { Output } from "./shared/index.mjs";
const __dirname = url.fileURLToPath(new URL(".", import.meta.url));
const ChangeFileDir = path.join(__dirname, "../../changes"); const ChangeFileDir = path.join(__dirname, "../../changes");
const ModifiedSinceVersion = "2.x"; const ModifiedSinceVersion = "2.x";
async function GenerateChangeList(argv, out) { async function GenerateChangeList(argv, out) {

View file

@ -1,7 +1,11 @@
import path from "path";
import fs from "fs"; import fs from "fs";
import path from "path";
import * as url from "url";
import { Output } from "./shared/index.mjs"; import { Output } from "./shared/index.mjs";
const __dirname = url.fileURLToPath(new URL(".", import.meta.url));
/////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////
// Copy Markdown // Copy Markdown
async function CopyMarkdown(out, name) { async function CopyMarkdown(out, name) {

View file

@ -1,8 +1,13 @@
import path from "path";
import fs from "fs"; import fs from "fs";
import path from "path";
import * as url from "url";
import SemVer from "semver"; import SemVer from "semver";
import { Output } from "./shared/index.mjs"; import { Output } from "./shared/index.mjs";
const __dirname = url.fileURLToPath(new URL(".", import.meta.url));
const ChangeFileDir = path.join(__dirname, "../../changes"); const ChangeFileDir = path.join(__dirname, "../../changes");
/////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////
// CHANGE LIST // CHANGE LIST

View file

@ -1,15 +1,17 @@
import fs from "fs"; import fs from "fs";
import path from "path"; import path from "path";
import { parseLigationData } from "../export-data/ligation-data.mjs";
import { parseVariantsData } from "../export-data/variants-data.mjs";
import Button from "./templates/button.mjs"; import Button from "./templates/button.mjs";
import CharVariant from "./templates/character-variant.mjs";
import GrandTitle from "./templates/grand-title.mjs"; import GrandTitle from "./templates/grand-title.mjs";
import Languages from "./templates/languages.mjs"; import Languages from "./templates/languages.mjs";
import Weights from "./templates/weights.mjs"; import LigationSet from "./templates/ligation-set.mjs";
import Matrix from "./templates/matrix.mjs"; import Matrix from "./templates/matrix.mjs";
import StylisticSet from "./templates/stylistic-set.mjs"; import StylisticSet from "./templates/stylistic-set.mjs";
import CharVariant from "./templates/character-variant.mjs"; import Weights from "./templates/weights.mjs";
import LigationSet from "./templates/ligation-set.mjs";
import { parseVariantsData } from "../export-data/variants-data.mjs";
import { parseLigationData } from "../export-data/ligation-data.mjs";
class Generator { class Generator {
constructor(outputDir, fontFiles) { constructor(outputDir, fontFiles) {

View file

@ -1,4 +1,5 @@
import * as themes from "../themes/index.mjs"; import * as themes from "../themes/index.mjs";
export default (function (args) { export default (function (args) {
const theme = themes[args.theme]; const theme = themes[args.theme];
const EM = 16; const EM = 16;

View file

@ -1,4 +1,5 @@
import * as themes from "../themes/index.mjs"; import * as themes from "../themes/index.mjs";
export default (function (args) { export default (function (args) {
const theme = themes[args.theme]; const theme = themes[args.theme];
const unitWidth = 128; const unitWidth = 128;

View file

@ -1,4 +1,5 @@
import * as themes from "../themes/index.mjs"; import * as themes from "../themes/index.mjs";
export default (function (args) { export default (function (args) {
const theme = themes[args.theme]; const theme = themes[args.theme];
const EM = 240; const EM = 240;

View file

@ -1,4 +1,5 @@
import * as themes from "../themes/index.mjs"; import * as themes from "../themes/index.mjs";
// prettier-ignore // prettier-ignore
const languages = [ const languages = [
{ lang: 'English', sample: 'Shaw, those twelve beige hooks are joined if I patch a young, gooey mouth.' }, { lang: 'English', sample: 'Shaw, those twelve beige hooks are joined if I patch a young, gooey mouth.' },
@ -26,6 +27,7 @@ const languages = [
{ lang: 'Turkish', sample: 'Pijamalı hasta yağız şoföre çabucak güvendi.' }, { lang: 'Turkish', sample: 'Pijamalı hasta yağız şoföre çabucak güvendi.' },
{ lang: 'Ukrainian', sample: 'Чуєш їх, доцю, га? Кумедна ж ти, прощайся без ґольфів!' } { lang: 'Ukrainian', sample: 'Чуєш їх, доцю, га? Кумедна ж ти, прощайся без ґольфів!' }
]; ];
export default (function (args) { export default (function (args) {
const theme = themes[args.theme]; const theme = themes[args.theme];
const EM = 24; const EM = 24;

View file

@ -1,4 +1,5 @@
import * as themes from "../themes/index.mjs"; import * as themes from "../themes/index.mjs";
function* makeSample(theme, args) { function* makeSample(theme, args) {
const groupSet = new Set(args.ligSets); const groupSet = new Set(args.ligSets);
for (const row of args.ligationSamples) { for (const row of args.ligationSamples) {

View file

@ -1,4 +1,5 @@
import * as themes from "../themes/index.mjs"; import * as themes from "../themes/index.mjs";
export default (function (args) { export default (function (args) {
const theme = themes[args.theme]; const theme = themes[args.theme];
const EM = 48; const EM = 48;

View file

@ -1,4 +1,5 @@
import * as themes from "../themes/index.mjs"; import * as themes from "../themes/index.mjs";
const ssStrings = [ const ssStrings = [
["ABC.DEF.GHI.JKL.MNO.PQRS.TUV.WXYZ", "abc.def.ghi.jkl.mno.pqrs.tuv.wxyz"], ["ABC.DEF.GHI.JKL.MNO.PQRS.TUV.WXYZ", "abc.def.ghi.jkl.mno.pqrs.tuv.wxyz"],
["¢ ſß ΓΛΔ αδιλμξ КУЗЯЖэльфязычникж", "float il1[]={1-2/3.4,5+6=7/8%90};"], ["¢ ſß ΓΛΔ αδιλμξ КУЗЯЖэльфязычникж", "float il1[]={1-2/3.4,5+6=7/8%90};"],

View file

@ -1,4 +1,5 @@
import * as themes from "../themes/index.mjs"; import * as themes from "../themes/index.mjs";
export default (function (args) { export default (function (args) {
const theme = themes[args.theme]; const theme = themes[args.theme];
const EM = 48; const EM = 48;

View file

@ -1,12 +1,12 @@
export const light = { export const light = {
body: "#20242E", body: "#20242E",
dimmed: "#20242E40", dimmed: "#20242E40",
stress: "#048FBF", stress: "#048FBF",
title: "#8757AD" title: "#8757AD"
}; };
export const dark = { export const dark = {
body: "#DEE4E3", body: "#DEE4E3",
dimmed: "#DEE4E340", dimmed: "#DEE4E340",
stress: "#03AEE9", stress: "#03AEE9",
title: "#B77FDB" title: "#B77FDB"
}; };

View file

@ -1,4 +1,5 @@
import fs from "fs"; import fs from "fs";
import * as wawoff from "wawoff2"; import * as wawoff from "wawoff2";
export default (async function (from, to) { export default (async function (from, to) {

View file

@ -1,5 +1,6 @@
import path from "path";
import fs from "fs"; import fs from "fs";
import path from "path";
import semver from "semver"; import semver from "semver";
const ChangeFileDir = path.join(__dirname, "../../changes"); const ChangeFileDir = path.join(__dirname, "../../changes");

View file

@ -1,10 +1,11 @@
import * as FS from "fs"; import * as FS from "fs";
import * as Path from "path"; import * as Path from "path";
import * as Verda from "verda";
import which from "which";
import * as toml from "@iarna/toml"; import * as toml from "@iarna/toml";
import semver from "semver"; import semver from "semver";
import * as uuid from "uuid"; import * as uuid from "uuid";
import * as Verda from "verda";
import which from "which";
/////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////
@ -922,7 +923,7 @@ phony(`release`, async target => {
} }
const [archiveFiles] = await target.need(goals); const [archiveFiles] = await target.need(goals);
// Create hash of packages // Create hash of packages
await target.need(fu`utility/create-sha-file.js`); await target.need(fu`utility/create-sha-file.mjs`);
await node("utility/create-sha-file.mjs", "doc/packages-sha.txt", archiveFiles); await node("utility/create-sha-file.mjs", "doc/packages-sha.txt", archiveFiles);
// Images and release notes // Images and release notes
await target.need(SampleImages, Pages, AmendReadme, ReleaseNotes, ChangeLog); await target.need(SampleImages, Pages, AmendReadme, ReleaseNotes, ChangeLog);
@ -938,12 +939,11 @@ const ScriptsUnder = oracle.make(
(target, ext, dir) => FileList({ under: dir, pattern: `**/*.${ext}` })(target) (target, ext, dir) => FileList({ under: dir, pattern: `**/*.${ext}` })(target)
); );
const UtilScriptFiles = computed("util-script-files", async target => { const UtilScriptFiles = computed("util-script-files", async target => {
const [js, ejs, md] = await target.need( const [mjs, md] = await target.need(
ScriptsUnder("mjs", "utility"), ScriptsUnder("mjs", "utility"),
ScriptsUnder("ejs", "utility"),
ScriptsUnder("md", "utility") ScriptsUnder("md", "utility")
); );
return [...js, ...ejs, ...md]; return [...mjs, ...md];
}); });
const ScriptFiles = computed.group("script-files", async (target, ext) => { const ScriptFiles = computed.group("script-files", async (target, ext) => {
const [ss] = await target.need(ScriptsUnder(ext, `font-src`)); const [ss] = await target.need(ScriptsUnder(ext, `font-src`));