automify 0.1.4 → 0.1.5

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "automify",
3
- "version": "0.1.4",
3
+ "version": "0.1.5",
4
4
  "description": "AI computer use for browser, CLI, and desktop in Node.js.",
5
5
  "homepage": "https://aldovincenti.github.io/automify",
6
6
  "bugs": {
@@ -66,11 +66,13 @@ patchPlatformLibnutDependency();
66
66
 
67
67
  runPnpm(["install"], { cwd: nutSource });
68
68
  runPnpm(["--filter", "@nut-tree/shared", "run", "compile"], { cwd: nutSource });
69
+ patchNutJimpCompatibility();
69
70
  runPnpm(["--filter", "@nut-tree/provider-interfaces", "run", "compile"], { cwd: nutSource });
70
71
  runPnpm(["--filter", "@nut-tree/default-clipboard-provider", "run", "compile"], { cwd: nutSource });
71
72
  runPnpm(["--filter", "@nut-tree/libnut", "run", "compile"], { cwd: nutSource });
72
73
  writeLibnutImportBridge();
73
74
  runPnpm(["--filter", "@nut-tree/nut-js", "run", "compile"], { cwd: nutSource });
75
+ patchNutJimpCompatibility();
74
76
 
75
77
  run("npm", ["install", "--no-save", ...runtimeDependencies], { cwd: root });
76
78
 
@@ -250,6 +252,77 @@ export { libnut };
250
252
  );
251
253
  }
252
254
 
255
+ function patchNutJimpCompatibility() {
256
+ const sharedImageToJimpPath = join(
257
+ nutSource,
258
+ "core",
259
+ "shared",
260
+ "dist",
261
+ "lib",
262
+ "functions",
263
+ "imageToJimp.function.js"
264
+ );
265
+ if (existsSync(sharedImageToJimpPath)) {
266
+ writeText(
267
+ sharedImageToJimpPath,
268
+ `"use strict";
269
+ Object.defineProperty(exports, "__esModule", { value: true });
270
+ exports.imageToJimp = void 0;
271
+ const jimp_1 = require("jimp");
272
+ const colormode_enum_1 = require("../enums/colormode.enum");
273
+ function imageToJimp(image) {
274
+ const jimpImage = new jimp_1.Jimp({
275
+ data: image.data,
276
+ width: image.width,
277
+ height: image.height
278
+ });
279
+ if (image.colorMode === colormode_enum_1.ColorMode.BGR) {
280
+ jimpImage.scan(0, 0, jimpImage.bitmap.width, jimpImage.bitmap.height, function (_, __, idx) {
281
+ const red = this.bitmap.data[idx];
282
+ this.bitmap.data[idx] = this.bitmap.data[idx + 2];
283
+ this.bitmap.data[idx + 2] = red;
284
+ });
285
+ }
286
+ return jimpImage;
287
+ }
288
+ exports.imageToJimp = imageToJimp;
289
+ `
290
+ );
291
+ }
292
+
293
+ const jimpImageWriterPath = join(
294
+ nutSource,
295
+ "core",
296
+ "nut.js",
297
+ "dist",
298
+ "lib",
299
+ "provider",
300
+ "io",
301
+ "jimp-image-writer.class.js"
302
+ );
303
+ if (existsSync(jimpImageWriterPath)) {
304
+ writeText(
305
+ jimpImageWriterPath,
306
+ `"use strict";
307
+ Object.defineProperty(exports, "__esModule", { value: true });
308
+ const shared_1 = require("@nut-tree/shared");
309
+ class default_1 {
310
+ store(parameters) {
311
+ return new Promise((resolve, reject) => {
312
+ const jimpImage = (0, shared_1.imageToJimp)(parameters.image);
313
+ jimpImage
314
+ .write(parameters.path)
315
+ .then((_) => resolve())
316
+ .catch((err) => reject(err));
317
+ });
318
+ }
319
+ }
320
+ exports.default = default_1;
321
+ `
322
+ );
323
+ }
324
+ }
325
+
253
326
  function installWorkspacePackage(source, target) {
254
327
  rmSync(target, { recursive: true, force: true });
255
328
  mkdirSync(dirname(target), { recursive: true });