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

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++) {
const lch = parseInt(process.argv[i], 16); for (let i = 2; i < process.argv.length; i++) {
const name = ucdNames.get(lch); const lch = parseInt(process.argv[i], 16);
console.log(" -", name, `(\`U+${lch.toString(16).toUpperCase().padStart(4, "0")}\`);`); const name = ucdNames.get(lch);
} 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) {
return new Promise((resolve, reject) => { function hashFile(path) {
let sum = crypto.createHash("sha256"); return new Promise((resolve, reject) => {
let fileStream = fs.createReadStream(path); let sum = crypto.createHash("sha256");
fileStream.on("error", err => { let fileStream = fs.createReadStream(path);
return reject(err); fileStream.on("error", err => {
}); return reject(err);
fileStream.on("data", chunk => { });
try { fileStream.on("data", chunk => {
sum.update(chunk); try {
} 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;
BlockData.sort((a, b) => a[0][0] - b[0][0]); const rangesModule = await import(`@unicode/unicode-14.0.0/Block/${id}/ranges.js`);
export { BlockData }; 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;
}

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`));