@markw65/monkeyc-optimizer 1.1.46 → 1.1.47

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,11 @@
2
2
 
3
3
  All notable changes to the "monkeyc-optimizer" package will be documented in this file.
4
4
 
5
+ ### 1.1.47
6
+
7
+ - Adds glyphAscent and glyphDescent to the font info produced by `cft-font-info`
8
+ - Adds a --chars option to `cft-font-info` to select the chars you want included. This can save time, and greatly reduce the amount of output produced.
9
+
5
10
  ### 1.1.46
6
11
 
7
12
  - No change in functionality, but make @markw65/peggy-optimizer a devDependency so it doesn't get shipped with the package, and update to [@markw65/prettier-plugin-monkeyc@1.0.55](https://github.com/markw65/prettier-plugin-monkeyc/blob/main/CHANGELOG.md#1055) for the same reason.
@@ -6,8 +6,43 @@ const { globa } = require("../build/util.cjs");
6
6
  const path = require("node:path");
7
7
 
8
8
  const fonts = new Set();
9
+ const otherArgs = [];
10
+ let charsWanted;
11
+
12
+ function error(e) {
13
+ throw new Error(e);
14
+ }
15
+
16
+ const prev = process.argv.slice(2).reduce((key, value) => {
17
+ const plain = !key && !value.startsWith("--");
18
+ if (plain) {
19
+ otherArgs.push(value);
20
+ return null;
21
+ }
22
+ const match = /^--((?:\w|-)+)(?:=(.*))?$/.exec(value);
23
+ if (!key) {
24
+ if (!match) {
25
+ error(`Expected an argument but got: ${value}`);
26
+ }
27
+ key = match[1];
28
+ value = match[2];
29
+ } else if (match) {
30
+ error(`Missing arg for '${key}'`);
31
+ }
32
+ switch (key) {
33
+ case "chars":
34
+ if (value == null) return key;
35
+ charsWanted = (charsWanted ?? "") + value;
36
+ break;
37
+ default:
38
+ error(`Unknown argument: --${key}`);
39
+ }
40
+ return null;
41
+ }, null);
42
+ if (prev) error(`Missing arg for '${prev}'`);
43
+
9
44
  Promise.all(
10
- process.argv.slice(2).map((filename) => {
45
+ otherArgs.map((filename) => {
11
46
  if (/\.cft$/i.test(filename)) {
12
47
  return globa(path.resolve(sdkUtil.connectiq, "Fonts", filename)).then(
13
48
  (filenames) => {
@@ -40,7 +75,7 @@ Promise.all(
40
75
  .then((results) =>
41
76
  Promise.all(
42
77
  Array.from(fonts).map((font) =>
43
- cft.getCFTFontInfo(font).catch(() => null)
78
+ cft.getCFTFontInfo(font, charsWanted).catch(() => null)
44
79
  )
45
80
  )
46
81
  .then((fonts) =>
package/build/api.cjs CHANGED
@@ -18,47 +18,47 @@ var __copyProps = (to, from, except, desc) => {
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
19
  var api_exports = {};
20
20
  __export(api_exports, {
21
- checkCompilerVersion: () => import_chunk_LZIGQANB.checkCompilerVersion,
22
- collectNamespaces: () => import_chunk_LZIGQANB.collectNamespaces,
23
- createDocumentationMap: () => import_chunk_LZIGQANB.createDocumentationMap,
24
- diagnostic: () => import_chunk_LZIGQANB.diagnostic,
25
- diagnosticHelper: () => import_chunk_LZIGQANB.diagnosticHelper,
26
- findNamesInScope: () => import_chunk_LZIGQANB.findNamesInScope,
27
- findUsingForNode: () => import_chunk_LZIGQANB.findUsingForNode,
28
- formatAst: () => import_chunk_LZIGQANB.formatAst,
29
- formatAstLongLines: () => import_chunk_LZIGQANB.formatAstLongLines,
30
- formatScopedName: () => import_chunk_LZIGQANB.formatScopedName,
31
- getApiFunctionInfo: () => import_chunk_LZIGQANB.getApiFunctionInfo,
32
- getApiMapping: () => import_chunk_LZIGQANB.getApiMapping,
33
- getSuperClasses: () => import_chunk_LZIGQANB.getSuperClasses,
21
+ checkCompilerVersion: () => import_chunk_2ATRIWWT.checkCompilerVersion,
22
+ collectNamespaces: () => import_chunk_2ATRIWWT.collectNamespaces,
23
+ createDocumentationMap: () => import_chunk_2ATRIWWT.createDocumentationMap,
24
+ diagnostic: () => import_chunk_2ATRIWWT.diagnostic,
25
+ diagnosticHelper: () => import_chunk_2ATRIWWT.diagnosticHelper,
26
+ findNamesInScope: () => import_chunk_2ATRIWWT.findNamesInScope,
27
+ findUsingForNode: () => import_chunk_2ATRIWWT.findUsingForNode,
28
+ formatAst: () => import_chunk_2ATRIWWT.formatAst,
29
+ formatAstLongLines: () => import_chunk_2ATRIWWT.formatAstLongLines,
30
+ formatScopedName: () => import_chunk_2ATRIWWT.formatScopedName,
31
+ getApiFunctionInfo: () => import_chunk_2ATRIWWT.getApiFunctionInfo,
32
+ getApiMapping: () => import_chunk_2ATRIWWT.getApiMapping,
33
+ getSuperClasses: () => import_chunk_2ATRIWWT.getSuperClasses,
34
34
  hasProperty: () => import_chunk_MBTLUWXR.hasProperty,
35
- isClassVariable: () => import_chunk_LZIGQANB.isClassVariable,
36
- isLocal: () => import_chunk_LZIGQANB.isLocal,
37
- isLookupCandidate: () => import_chunk_LZIGQANB.isLookupCandidate,
38
- isStateNode: () => import_chunk_LZIGQANB.isStateNode,
39
- lookupByFullName: () => import_chunk_LZIGQANB.lookupByFullName,
40
- lookupNext: () => import_chunk_LZIGQANB.lookupNext,
41
- lookupResultContains: () => import_chunk_LZIGQANB.lookupResultContains,
42
- lookupWithType: () => import_chunk_LZIGQANB.lookupWithType,
43
- makeToyboxLink: () => import_chunk_LZIGQANB.makeToyboxLink,
44
- mapVarDeclsByType: () => import_chunk_LZIGQANB.mapVarDeclsByType,
45
- markInvokeClassMethod: () => import_chunk_LZIGQANB.markInvokeClassMethod,
46
- parseSdkVersion: () => import_chunk_LZIGQANB.parseSdkVersion,
47
- resolveDiagnostics: () => import_chunk_LZIGQANB.resolveDiagnostics,
48
- resolveDiagnosticsMap: () => import_chunk_LZIGQANB.resolveDiagnosticsMap,
49
- sameLookupResult: () => import_chunk_LZIGQANB.sameLookupResult,
35
+ isClassVariable: () => import_chunk_2ATRIWWT.isClassVariable,
36
+ isLocal: () => import_chunk_2ATRIWWT.isLocal,
37
+ isLookupCandidate: () => import_chunk_2ATRIWWT.isLookupCandidate,
38
+ isStateNode: () => import_chunk_2ATRIWWT.isStateNode,
39
+ lookupByFullName: () => import_chunk_2ATRIWWT.lookupByFullName,
40
+ lookupNext: () => import_chunk_2ATRIWWT.lookupNext,
41
+ lookupResultContains: () => import_chunk_2ATRIWWT.lookupResultContains,
42
+ lookupWithType: () => import_chunk_2ATRIWWT.lookupWithType,
43
+ makeToyboxLink: () => import_chunk_2ATRIWWT.makeToyboxLink,
44
+ mapVarDeclsByType: () => import_chunk_2ATRIWWT.mapVarDeclsByType,
45
+ markInvokeClassMethod: () => import_chunk_2ATRIWWT.markInvokeClassMethod,
46
+ parseSdkVersion: () => import_chunk_2ATRIWWT.parseSdkVersion,
47
+ resolveDiagnostics: () => import_chunk_2ATRIWWT.resolveDiagnostics,
48
+ resolveDiagnosticsMap: () => import_chunk_2ATRIWWT.resolveDiagnosticsMap,
49
+ sameLookupResult: () => import_chunk_2ATRIWWT.sameLookupResult,
50
50
  traverseAst: () => import_chunk_MBTLUWXR.traverseAst,
51
- variableDeclarationName: () => import_chunk_LZIGQANB.variableDeclarationName,
52
- visitReferences: () => import_chunk_LZIGQANB.visitReferences,
53
- visit_resources: () => import_chunk_LZIGQANB.visit_resources,
54
- visitorNode: () => import_chunk_LZIGQANB.visitorNode
51
+ variableDeclarationName: () => import_chunk_2ATRIWWT.variableDeclarationName,
52
+ visitReferences: () => import_chunk_2ATRIWWT.visitReferences,
53
+ visit_resources: () => import_chunk_2ATRIWWT.visit_resources,
54
+ visitorNode: () => import_chunk_2ATRIWWT.visitorNode
55
55
  });
56
56
  module.exports = __toCommonJS(api_exports);
57
- var import_chunk_LZIGQANB = require("./chunk-LZIGQANB.cjs");
57
+ var import_chunk_2ATRIWWT = require("./chunk-2ATRIWWT.cjs");
58
58
  var import_chunk_SG7ODKRM = require("./chunk-SG7ODKRM.cjs");
59
59
  var import_chunk_MBTLUWXR = require("./chunk-MBTLUWXR.cjs");
60
60
  var import_chunk_ABYVSU2C = require("./chunk-ABYVSU2C.cjs");
61
- (0, import_chunk_LZIGQANB.init_api)();
61
+ (0, import_chunk_2ATRIWWT.init_api)();
62
62
  // Annotate the CommonJS export names for ESM import in node:
63
63
  0 && (module.exports = {
64
64
  checkCompilerVersion,
package/build/cftinfo.cjs CHANGED
@@ -38,24 +38,51 @@ var import_chunk_ABYVSU2C = require("./chunk-ABYVSU2C.cjs");
38
38
  var import_node_assert = __toESM(require("node:assert"));
39
39
  var fs = __toESM(require("node:fs/promises"));
40
40
  var path = __toESM(require("node:path"));
41
+ var zlib = __toESM(require("node:zlib"));
41
42
  (0, import_chunk_MBTLUWXR.init_ast)();
42
- function getCFTFontInfoFromBuffer(name, data) {
43
+ async function getCFTFontInfoFromBuffer(name, data, chars) {
43
44
  const view = new DataView(data.buffer, data.byteOffset, data.byteLength);
45
+ const glyphFlags = view.getUint8(3);
44
46
  const cmapOffset = view.getUint32(8);
45
47
  const glyphInfoOffset = view.getUint32(12);
48
+ const glyphDataOffset = view.getUint32(16);
46
49
  const height = view.getUint16(22);
47
50
  const ascent = view.getUint16(24);
48
51
  const internalLeading = view.getUint16(26);
52
+ const charFilter = chars ? new Set(chars.split("").map((ch) => ch.charCodeAt(0))) : null;
49
53
  const cmapNGroups = view.getUint32(cmapOffset + 12);
50
54
  const charInfo = [];
55
+ const maybeCompressed = view.getUint16(0) === 40;
56
+ const align = maybeCompressed ? view.getUint8(36) : 1;
57
+ const glyphData = await getGlyphData(view, glyphDataOffset, maybeCompressed);
51
58
  for (let i = 0, offset = cmapOffset + 16; i < cmapNGroups; i++) {
52
59
  const startChar = view.getUint32(offset + 0);
53
60
  const endChar = view.getUint32(offset + 4);
54
61
  const startGlyph = view.getUint32(offset + 8);
55
62
  offset += 12;
56
63
  for (let code = startChar, g = startGlyph; code <= endChar; code++, g++) {
57
- const width = view.getUint8(glyphInfoOffset + g * 4 + 3);
58
- charInfo.push({ code, char: String.fromCharCode(code), width });
64
+ if (charFilter && !charFilter.has(code)) {
65
+ continue;
66
+ }
67
+ const word = view.getUint32(glyphInfoOffset + g * 4);
68
+ const glyphOffset = (word >> 16 & 65535) + ((word & 65280) << 8);
69
+ const width = word & 255;
70
+ const [glyphAscent, glyphDescent] = getGlyphAscentDescent(
71
+ glyphData,
72
+ glyphOffset,
73
+ width,
74
+ height,
75
+ ascent,
76
+ align,
77
+ glyphFlags
78
+ );
79
+ charInfo.push({
80
+ code,
81
+ char: String.fromCharCode(code),
82
+ width,
83
+ glyphAscent,
84
+ glyphDescent
85
+ });
59
86
  }
60
87
  }
61
88
  return {
@@ -66,10 +93,10 @@ function getCFTFontInfoFromBuffer(name, data) {
66
93
  charInfo
67
94
  };
68
95
  }
69
- function getCFTFontInfo(filename) {
96
+ function getCFTFontInfo(filename, chars) {
70
97
  return fs.readFile(filename).then((data) => {
71
98
  const name = path.basename(filename, ".cft");
72
- return getCFTFontInfoFromBuffer(name, data);
99
+ return getCFTFontInfoFromBuffer(name, data, chars);
73
100
  });
74
101
  }
75
102
  function getDeviceFontInfo(dirname) {
@@ -104,6 +131,142 @@ function getDeviceFontInfo(dirname) {
104
131
  return { device: path.basename(dirname), fontSets, langMap };
105
132
  });
106
133
  }
134
+ async function getGlyphData(view, offset, maybeCompressed) {
135
+ if (maybeCompressed) {
136
+ const firstWord = view.getUint32(offset);
137
+ if (firstWord === 3439329293) {
138
+ offset += 4;
139
+ } else if (firstWord === 3489660941) {
140
+ offset += 4;
141
+ maybeCompressed = false;
142
+ }
143
+ }
144
+ if (maybeCompressed) {
145
+ const result = [];
146
+ const _length = view.getUint32(offset);
147
+ offset += 4;
148
+ const inflate = zlib.createInflate();
149
+ inflate.on("data", (chunk) => result.push(chunk));
150
+ const promise = new Promise((resolve2, reject) => {
151
+ inflate.on("end", () => resolve2(Buffer.concat(result)));
152
+ inflate.on("error", (e) => reject(e));
153
+ });
154
+ inflate.write(
155
+ Buffer.from(
156
+ view.buffer,
157
+ view.byteOffset + offset,
158
+ view.byteLength - offset
159
+ )
160
+ );
161
+ inflate.end();
162
+ const buffer = await promise;
163
+ return new DataView(buffer.buffer, buffer.byteOffset, buffer.byteLength);
164
+ }
165
+ return new DataView(
166
+ view.buffer,
167
+ view.byteOffset + offset,
168
+ view.byteLength - offset
169
+ );
170
+ }
171
+ function getGlyphAscentDescent(glyphData, glyphOffset, width, height, ascent, align, flags) {
172
+ const rle = (glyphOffset & 8388608) !== 0;
173
+ glyphOffset &= 8388607;
174
+ const pixelsPerByte = flags & 4 ? 4 : 8;
175
+ const bytesToCount = Math.ceil(width / pixelsPerByte);
176
+ const byteWidth = Math.ceil(bytesToCount / align) * align;
177
+ const size = byteWidth * height;
178
+ const glyph = rle ? rleDecode(glyphData, glyphOffset, size) : new DataView(glyphData.buffer, glyphData.byteOffset + glyphOffset, size);
179
+ const glyphAscent = (() => {
180
+ let row = 0;
181
+ do {
182
+ const offset = row * byteWidth;
183
+ for (let i = 0; i < bytesToCount; i++) {
184
+ if (glyph.getUint8(offset + i))
185
+ return ascent - row;
186
+ }
187
+ } while (++row < ascent);
188
+ return 0;
189
+ })();
190
+ const glyphDescent = (() => {
191
+ let row = height;
192
+ while (row-- > ascent) {
193
+ const offset = row * byteWidth;
194
+ for (let i = 0; i < bytesToCount; i++) {
195
+ if (glyph.getUint8(offset + i))
196
+ return row - ascent;
197
+ }
198
+ }
199
+ return 0;
200
+ })();
201
+ return [glyphAscent, glyphDescent];
202
+ }
203
+ function rleDecode(encoded, offset, size) {
204
+ let bitsLeft = 0;
205
+ let val = 0;
206
+ const getBits = (n) => {
207
+ if (bitsLeft >= n) {
208
+ const result = val & (1 << n) - 1;
209
+ bitsLeft -= n;
210
+ val >>>= n;
211
+ return result;
212
+ }
213
+ if (bitsLeft === 0) {
214
+ val = encoded.getUint8(offset);
215
+ offset += 1;
216
+ bitsLeft = 8;
217
+ return getBits(n);
218
+ }
219
+ const bl = bitsLeft;
220
+ return getBits(bl) + (getBits(n - bl) << bl);
221
+ };
222
+ let runBits = 1;
223
+ while (getBits(1) === 0) {
224
+ runBits++;
225
+ }
226
+ const chunkSize = getBits(5) + 1;
227
+ const escape = getBits(chunkSize);
228
+ const output = new DataView(new ArrayBuffer(size + 3 & ~3));
229
+ let outOffset = 0;
230
+ let outBitOff = 0;
231
+ let outVal = 0;
232
+ const putBits = (value) => {
233
+ outVal |= value << outBitOff;
234
+ outBitOff += chunkSize;
235
+ if (outBitOff >= 32) {
236
+ output.setUint32(outOffset, outVal, true);
237
+ outOffset += 4;
238
+ outBitOff -= 32;
239
+ outVal = 0;
240
+ if (outBitOff !== 0) {
241
+ outVal = value >>> chunkSize - outBitOff;
242
+ }
243
+ }
244
+ };
245
+ let prev = -1;
246
+ const getChunk = () => {
247
+ const val2 = getBits(chunkSize);
248
+ if (val2 !== escape) {
249
+ prev = val2;
250
+ return [val2, 1];
251
+ }
252
+ const run = getBits(runBits);
253
+ if (run === 0) {
254
+ prev = val2;
255
+ return [val2, 1];
256
+ }
257
+ return [prev, run + 1];
258
+ };
259
+ while (outOffset + (outBitOff >>> 3) < size) {
260
+ let [val2, run] = getChunk();
261
+ while (run--) {
262
+ putBits(val2);
263
+ }
264
+ }
265
+ if (outOffset < size) {
266
+ output.setUint32(outOffset, outVal, true);
267
+ }
268
+ return output;
269
+ }
107
270
  // Annotate the CommonJS export names for ESM import in node:
108
271
  0 && (module.exports = {
109
272
  getCFTFontInfo,
@@ -26,8 +26,8 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
26
26
  mod
27
27
  ));
28
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
- var chunk_LZIGQANB_exports = {};
30
- __export(chunk_LZIGQANB_exports, {
29
+ var chunk_2ATRIWWT_exports = {};
30
+ __export(chunk_2ATRIWWT_exports, {
31
31
  EnumTagsConst: () => EnumTagsConst,
32
32
  LastTypeTag: () => LastTypeTag,
33
33
  ObjectLikeTagsConst: () => ObjectLikeTagsConst,
@@ -133,7 +133,7 @@ __export(chunk_LZIGQANB_exports, {
133
133
  visitorNode: () => visitorNode,
134
134
  xml_util_exports: () => xml_util_exports
135
135
  });
136
- module.exports = __toCommonJS(chunk_LZIGQANB_exports);
136
+ module.exports = __toCommonJS(chunk_2ATRIWWT_exports);
137
137
  var import_chunk_SG7ODKRM = require("./chunk-SG7ODKRM.cjs");
138
138
  var import_chunk_MBTLUWXR = require("./chunk-MBTLUWXR.cjs");
139
139
  var import_chunk_ABYVSU2C = require("./chunk-ABYVSU2C.cjs");
@@ -28344,7 +28344,7 @@ async function generateOneConfig(buildConfig, manifestXML, dependencyFiles, conf
28344
28344
  const opt_time = await (0, import_chunk_SG7ODKRM.first_modified)(
28345
28345
  Object.values(fnMap).map((v) => v.output)
28346
28346
  );
28347
- if (source_time < opt_time && 1708219691011 < opt_time) {
28347
+ if (source_time < opt_time && 1708309106701 < opt_time) {
28348
28348
  return {
28349
28349
  hasTests,
28350
28350
  diagnostics: prevDiagnostics,
@@ -28383,7 +28383,7 @@ async function generateOneConfig(buildConfig, manifestXML, dependencyFiles, conf
28383
28383
  hasTests: hasTests2,
28384
28384
  diagnostics,
28385
28385
  sdkVersion,
28386
- optimizerVersion: "1.1.46",
28386
+ optimizerVersion: "1.1.47",
28387
28387
  ...Object.fromEntries(
28388
28388
  configOptionsToCheck.map((option) => [option, config[option]])
28389
28389
  )
@@ -18,28 +18,28 @@ var __copyProps = (to, from, except, desc) => {
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
19
  var optimizer_exports = {};
20
20
  __export(optimizer_exports, {
21
- StateNodeAttributes: () => import_chunk_LZIGQANB.StateNodeAttributes,
22
- buildOptimizedProject: () => import_chunk_LZIGQANB.buildOptimizedProject,
21
+ StateNodeAttributes: () => import_chunk_2ATRIWWT.StateNodeAttributes,
22
+ buildOptimizedProject: () => import_chunk_2ATRIWWT.buildOptimizedProject,
23
23
  copyRecursiveAsNeeded: () => import_chunk_SG7ODKRM.copyRecursiveAsNeeded,
24
- defaultConfig: () => import_chunk_LZIGQANB.defaultConfig,
25
- display: () => import_chunk_LZIGQANB.display,
26
- generateOneConfig: () => import_chunk_LZIGQANB.generateOneConfig,
27
- generateOptimizedProject: () => import_chunk_LZIGQANB.generateOptimizedProject,
28
- getConfig: () => import_chunk_LZIGQANB.getConfig,
29
- getProjectAnalysis: () => import_chunk_LZIGQANB.getProjectAnalysis,
30
- get_jungle: () => import_chunk_LZIGQANB.get_jungle,
31
- isErrorWithLocation: () => import_chunk_LZIGQANB.isErrorWithLocation,
32
- launchSimulator: () => import_chunk_LZIGQANB.launchSimulator,
33
- manifestProducts: () => import_chunk_LZIGQANB.manifestProducts,
34
- mctree: () => import_chunk_LZIGQANB.mctree,
35
- simulateProgram: () => import_chunk_LZIGQANB.simulateProgram
24
+ defaultConfig: () => import_chunk_2ATRIWWT.defaultConfig,
25
+ display: () => import_chunk_2ATRIWWT.display,
26
+ generateOneConfig: () => import_chunk_2ATRIWWT.generateOneConfig,
27
+ generateOptimizedProject: () => import_chunk_2ATRIWWT.generateOptimizedProject,
28
+ getConfig: () => import_chunk_2ATRIWWT.getConfig,
29
+ getProjectAnalysis: () => import_chunk_2ATRIWWT.getProjectAnalysis,
30
+ get_jungle: () => import_chunk_2ATRIWWT.get_jungle,
31
+ isErrorWithLocation: () => import_chunk_2ATRIWWT.isErrorWithLocation,
32
+ launchSimulator: () => import_chunk_2ATRIWWT.launchSimulator,
33
+ manifestProducts: () => import_chunk_2ATRIWWT.manifestProducts,
34
+ mctree: () => import_chunk_2ATRIWWT.mctree,
35
+ simulateProgram: () => import_chunk_2ATRIWWT.simulateProgram
36
36
  });
37
37
  module.exports = __toCommonJS(optimizer_exports);
38
- var import_chunk_LZIGQANB = require("./chunk-LZIGQANB.cjs");
38
+ var import_chunk_2ATRIWWT = require("./chunk-2ATRIWWT.cjs");
39
39
  var import_chunk_SG7ODKRM = require("./chunk-SG7ODKRM.cjs");
40
40
  var import_chunk_MBTLUWXR = require("./chunk-MBTLUWXR.cjs");
41
41
  var import_chunk_ABYVSU2C = require("./chunk-ABYVSU2C.cjs");
42
- (0, import_chunk_LZIGQANB.init_optimizer)();
42
+ (0, import_chunk_2ATRIWWT.init_optimizer)();
43
43
  // Annotate the CommonJS export names for ESM import in node:
44
44
  0 && (module.exports = {
45
45
  StateNodeAttributes,
@@ -18,25 +18,25 @@ var __copyProps = (to, from, except, desc) => {
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
19
  var sdk_util_exports = {};
20
20
  __export(sdk_util_exports, {
21
- SectionKinds: () => import_chunk_LZIGQANB.SectionKinds,
22
- appSupport: () => import_chunk_LZIGQANB.appSupport,
23
- connectiq: () => import_chunk_LZIGQANB.connectiq,
24
- getDeviceInfo: () => import_chunk_LZIGQANB.getDeviceInfo,
25
- getFunctionDocumentation: () => import_chunk_LZIGQANB.getFunctionDocumentation,
26
- getLanguages: () => import_chunk_LZIGQANB.getLanguages,
27
- getSdkPath: () => import_chunk_LZIGQANB.getSdkPath,
28
- isWin: () => import_chunk_LZIGQANB.isWin,
29
- optimizeProgram: () => import_chunk_LZIGQANB.optimizeProgram,
30
- readPrg: () => import_chunk_LZIGQANB.readPrg,
31
- readPrgWithOffsets: () => import_chunk_LZIGQANB.readPrgWithOffsets,
32
- xmlUtil: () => import_chunk_LZIGQANB.xml_util_exports
21
+ SectionKinds: () => import_chunk_2ATRIWWT.SectionKinds,
22
+ appSupport: () => import_chunk_2ATRIWWT.appSupport,
23
+ connectiq: () => import_chunk_2ATRIWWT.connectiq,
24
+ getDeviceInfo: () => import_chunk_2ATRIWWT.getDeviceInfo,
25
+ getFunctionDocumentation: () => import_chunk_2ATRIWWT.getFunctionDocumentation,
26
+ getLanguages: () => import_chunk_2ATRIWWT.getLanguages,
27
+ getSdkPath: () => import_chunk_2ATRIWWT.getSdkPath,
28
+ isWin: () => import_chunk_2ATRIWWT.isWin,
29
+ optimizeProgram: () => import_chunk_2ATRIWWT.optimizeProgram,
30
+ readPrg: () => import_chunk_2ATRIWWT.readPrg,
31
+ readPrgWithOffsets: () => import_chunk_2ATRIWWT.readPrgWithOffsets,
32
+ xmlUtil: () => import_chunk_2ATRIWWT.xml_util_exports
33
33
  });
34
34
  module.exports = __toCommonJS(sdk_util_exports);
35
- var import_chunk_LZIGQANB = require("./chunk-LZIGQANB.cjs");
35
+ var import_chunk_2ATRIWWT = require("./chunk-2ATRIWWT.cjs");
36
36
  var import_chunk_SG7ODKRM = require("./chunk-SG7ODKRM.cjs");
37
37
  var import_chunk_MBTLUWXR = require("./chunk-MBTLUWXR.cjs");
38
38
  var import_chunk_ABYVSU2C = require("./chunk-ABYVSU2C.cjs");
39
- (0, import_chunk_LZIGQANB.init_sdk_util)();
39
+ (0, import_chunk_2ATRIWWT.init_sdk_util)();
40
40
  // Annotate the CommonJS export names for ESM import in node:
41
41
  0 && (module.exports = {
42
42
  SectionKinds,
@@ -1,5 +1,5 @@
1
1
  /// <reference types="node" />
2
- export declare function getCFTFontInfoFromBuffer(name: string, data: Buffer): {
2
+ export declare function getCFTFontInfoFromBuffer(name: string, data: Buffer, chars?: string): Promise<{
3
3
  name: string;
4
4
  height: number;
5
5
  ascent: number;
@@ -8,9 +8,11 @@ export declare function getCFTFontInfoFromBuffer(name: string, data: Buffer): {
8
8
  code: number;
9
9
  char: string;
10
10
  width: number;
11
+ glyphAscent: number;
12
+ glyphDescent: number;
11
13
  }[];
12
- };
13
- export declare function getCFTFontInfo(filename: string): Promise<{
14
+ }>;
15
+ export declare function getCFTFontInfo(filename: string, chars?: string): Promise<{
14
16
  name: string;
15
17
  height: number;
16
18
  ascent: number;
@@ -19,6 +21,8 @@ export declare function getCFTFontInfo(filename: string): Promise<{
19
21
  code: number;
20
22
  char: string;
21
23
  width: number;
24
+ glyphAscent: number;
25
+ glyphDescent: number;
22
26
  }[];
23
27
  }>;
24
28
  export declare function getDeviceFontInfo(dirname: string): Promise<{
@@ -21,17 +21,17 @@ __export(worker_thread_exports, {
21
21
  default: () => worker_thread_default
22
22
  });
23
23
  module.exports = __toCommonJS(worker_thread_exports);
24
- var import_chunk_LZIGQANB = require("./chunk-LZIGQANB.cjs");
24
+ var import_chunk_2ATRIWWT = require("./chunk-2ATRIWWT.cjs");
25
25
  var import_chunk_SG7ODKRM = require("./chunk-SG7ODKRM.cjs");
26
26
  var import_chunk_MBTLUWXR = require("./chunk-MBTLUWXR.cjs");
27
27
  var import_chunk_ABYVSU2C = require("./chunk-ABYVSU2C.cjs");
28
28
  var import_node_worker_threads = require("node:worker_threads");
29
29
  var require_worker_thread = (0, import_chunk_ABYVSU2C.__commonJS)({
30
30
  "src/worker-thread.ts"() {
31
- (0, import_chunk_LZIGQANB.init_worker_task)();
31
+ (0, import_chunk_2ATRIWWT.init_worker_task)();
32
32
  if (import_node_worker_threads.parentPort) {
33
33
  import_node_worker_threads.parentPort.on("message", async (task) => {
34
- return import_node_worker_threads.parentPort.postMessage(await (0, import_chunk_LZIGQANB.performTask)(task));
34
+ return import_node_worker_threads.parentPort.postMessage(await (0, import_chunk_2ATRIWWT.performTask)(task));
35
35
  });
36
36
  }
37
37
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@markw65/monkeyc-optimizer",
3
3
  "type": "commonjs",
4
- "version": "1.1.46",
4
+ "version": "1.1.47",
5
5
  "description": "Source to source optimizer for Garmin Monkey C code",
6
6
  "main": "build/optimizer.cjs",
7
7
  "types": "build/src/optimizer.d.ts",