@rindo/core 4.18.0 → 4.18.1
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/cli/index.cjs +106 -215
- package/cli/index.js +107 -217
- package/cli/package.json +1 -1
- package/compiler/package.json +1 -1
- package/compiler/rindo.js +1687 -2827
- package/dev-server/client/index.js +1 -1
- package/dev-server/client/package.json +1 -1
- package/dev-server/connector.html +2 -2
- package/dev-server/index.js +1 -1
- package/dev-server/package.json +1 -1
- package/dev-server/server-process.js +117 -227
- package/internal/app-data/index.cjs +1 -0
- package/internal/app-data/index.js +1 -0
- package/internal/app-data/package.json +1 -1
- package/internal/client/index.js +53 -36
- package/internal/client/package.json +1 -1
- package/internal/client/patch-browser.js +1 -1
- package/internal/client/shadow-css.js +1 -2
- package/internal/hydrate/index.js +53 -36
- package/internal/hydrate/package.json +1 -1
- package/internal/hydrate/runner.js +52 -89
- package/internal/package.json +1 -1
- package/internal/rindo-public-compiler.d.ts +13 -2
- package/internal/rindo-public-runtime.d.ts +1 -0
- package/internal/testing/index.js +52 -35
- package/internal/testing/package.json +1 -1
- package/mock-doc/index.cjs +378 -493
- package/mock-doc/index.d.ts +1 -1
- package/mock-doc/index.js +378 -493
- package/mock-doc/package.json +1 -1
- package/package.json +6 -7
- package/readme.md +20 -15
- package/screenshot/index.js +43 -85
- package/screenshot/package.json +1 -1
- package/screenshot/pixel-match.js +14 -27
- package/sys/node/glob.js +1 -1
- package/sys/node/index.js +42 -42
- package/sys/node/package.json +1 -1
- package/sys/node/worker.js +1 -1
- package/testing/index.js +149 -269
- package/testing/jest/jest-27-and-under/jest-facade.d.ts +1 -1
- package/testing/jest/jest-28/jest-facade.d.ts +5 -5
- package/testing/jest/jest-29/jest-facade.d.ts +5 -5
- package/testing/package.json +1 -1
package/mock-doc/package.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rindo/core",
|
|
3
|
-
"version": "4.18.
|
|
3
|
+
"version": "4.18.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "./internal/rindo-core/index.cjs",
|
|
6
6
|
"module": "./internal/rindo-core/index.js",
|
|
@@ -23,7 +23,6 @@
|
|
|
23
23
|
"testing/"
|
|
24
24
|
],
|
|
25
25
|
"scripts": {
|
|
26
|
-
"build.rollup": "npm run tsc.scripts && npm run tsc.prod && npm run rollup.prod.ci",
|
|
27
26
|
"build": "npm run clean && npm run tsc.scripts && npm run tsc.prod && node scripts/build --prod --ci",
|
|
28
27
|
"build.watch": "npm run build -- --watch",
|
|
29
28
|
"build.updateSelectorEngine": "node scripts/build/updateSelectorEngine.js",
|
|
@@ -68,7 +67,7 @@
|
|
|
68
67
|
"@types/graceful-fs": "^4.1.5",
|
|
69
68
|
"@types/jest": "^27.0.3",
|
|
70
69
|
"@types/listr": "^0.14.4",
|
|
71
|
-
"@types/node": "^20.
|
|
70
|
+
"@types/node": "^20.12.11",
|
|
72
71
|
"@types/pixelmatch": "^5.2.4",
|
|
73
72
|
"@types/pngjs": "^6.0.1",
|
|
74
73
|
"@types/prompts": "^2.0.9",
|
|
@@ -82,7 +81,7 @@
|
|
|
82
81
|
"autoprefixer": "10.4.19",
|
|
83
82
|
"conventional-changelog-cli": "^4.0.0",
|
|
84
83
|
"dts-bundle-generator": "~9.5.0",
|
|
85
|
-
"esbuild": "^0.
|
|
84
|
+
"esbuild": "^0.21.0",
|
|
86
85
|
"esbuild-plugin-replace": "^1.4.0",
|
|
87
86
|
"eslint": "^8.23.1",
|
|
88
87
|
"eslint-config-prettier": "^9.0.0",
|
|
@@ -92,7 +91,7 @@
|
|
|
92
91
|
"execa": "8.0.1",
|
|
93
92
|
"exit": "^0.1.2",
|
|
94
93
|
"fs-extra": "^11.0.0",
|
|
95
|
-
"glob": "10.3.
|
|
94
|
+
"glob": "10.3.14",
|
|
96
95
|
"graceful-fs": "~4.2.6",
|
|
97
96
|
"jest": "^27.4.5",
|
|
98
97
|
"jest-cli": "^27.4.5",
|
|
@@ -126,7 +125,7 @@
|
|
|
126
125
|
},
|
|
127
126
|
"repository": {
|
|
128
127
|
"type": "git",
|
|
129
|
-
"url": "git+https://github.com/
|
|
128
|
+
"url": "git+https://github.com/rindojs/rindo.git"
|
|
130
129
|
},
|
|
131
130
|
"author": "Family Team",
|
|
132
131
|
"homepage": "https://rindojs.web.app/",
|
|
@@ -143,7 +142,7 @@
|
|
|
143
142
|
],
|
|
144
143
|
"prettier": "@familyjs/prettier-config",
|
|
145
144
|
"volta": {
|
|
146
|
-
"node": "
|
|
145
|
+
"node": "22.1.0",
|
|
147
146
|
"npm": "10.7.0"
|
|
148
147
|
}
|
|
149
148
|
}
|
package/readme.md
CHANGED
|
@@ -4,21 +4,24 @@
|
|
|
4
4
|
</a>
|
|
5
5
|
</p>
|
|
6
6
|
|
|
7
|
-
<h1 align="center">
|
|
8
|
-
Rindo
|
|
9
|
-
</h1>
|
|
7
|
+
<h1 align="center">Rindo</h1>
|
|
10
8
|
|
|
11
9
|
<p align="center">
|
|
12
|
-
A compiler for generating
|
|
10
|
+
A compiler for generating
|
|
11
|
+
<a href="https://www.webcomponents.org/introduction" target="_blank" rel="noopener noref">
|
|
12
|
+
Web Components
|
|
13
|
+
</a>
|
|
14
|
+
using technologies like TypeScript and JSX, built by the <a href="https://family-js.web.app/">Family team</a>.
|
|
13
15
|
</p>
|
|
14
16
|
|
|
15
17
|
<p align="center">
|
|
16
18
|
<a href="https://www.npmjs.com/package/@rindo/core">
|
|
17
|
-
<img src="https://img.shields.io/npm/v/@rindo/core.svg" alt="RindoJS is released under the MIT license."
|
|
18
|
-
|
|
19
|
+
<img src="https://img.shields.io/npm/v/@rindo/core.svg" alt="RindoJS is released under the MIT license." />
|
|
20
|
+
</a>
|
|
21
|
+
<a href="https://github.com/rindojs/rindo/blob/main/LICENSE.md">
|
|
19
22
|
<img src="https://img.shields.io/badge/license-MIT-yellow.svg" alt="RindoJS is released under the MIT license." />
|
|
20
23
|
</a>
|
|
21
|
-
<a href="https://github.com/
|
|
24
|
+
<a href="https://github.com/rindojs/rindo/blob/main/.github/CONTRIBUTING.md">
|
|
22
25
|
<img src="https://img.shields.io/badge/PRs-welcome-brightgreen.svg" alt="PRs welcome!" />
|
|
23
26
|
</a>
|
|
24
27
|
</p>
|
|
@@ -28,31 +31,33 @@
|
|
|
28
31
|
<span> · </span>
|
|
29
32
|
<a href="https://rindojs.web.app/docs/introduction">Documentation</a>
|
|
30
33
|
<span> · </span>
|
|
31
|
-
<a href="https://github.com/
|
|
34
|
+
<a href="https://github.com/rindojs/rindo/blob/main/.github/CONTRIBUTING.md">Contribute</a>
|
|
32
35
|
</h2>
|
|
33
36
|
|
|
34
37
|
### Getting Started
|
|
35
38
|
|
|
36
39
|
Start a new project by following our quick [Getting Started guide](https://rindojs.web.app/docs/getting-started).
|
|
37
40
|
We would love to hear from you!
|
|
38
|
-
If you have any feedback or run into issues using Rindo, please file an [issue](https://github.com/
|
|
41
|
+
If you have any feedback or run into issues using Rindo, please file an [issue](https://github.com/rindojs/rindo/issues/new) on this repository.
|
|
39
42
|
|
|
40
43
|
### Examples
|
|
44
|
+
|
|
41
45
|
A Rindo component looks a lot like a class-based React component, with the addition of TypeScript decorators:
|
|
46
|
+
|
|
42
47
|
```tsx
|
|
43
48
|
import { Component, Prop, h } from '@rindo/core';
|
|
44
49
|
|
|
45
50
|
@Component({
|
|
46
|
-
tag: 'my-component',
|
|
47
|
-
styleUrl: 'my-component.css',
|
|
48
|
-
shadow: true,
|
|
51
|
+
tag: 'my-component', // the name of the component's custom HTML tag
|
|
52
|
+
styleUrl: 'my-component.css', // css styles to apply to the component
|
|
53
|
+
shadow: true, // this component uses the ShadowDOM
|
|
49
54
|
})
|
|
50
55
|
export class MyComponent {
|
|
51
56
|
// The component accepts two arguments:
|
|
52
57
|
@Prop() first: string;
|
|
53
58
|
@Prop() last: string;
|
|
54
59
|
|
|
55
|
-
|
|
60
|
+
//The following HTML is rendered when our component is used
|
|
56
61
|
render() {
|
|
57
62
|
return (
|
|
58
63
|
<div>
|
|
@@ -75,5 +80,5 @@ In many cases, Rindo can be used as a drop in replacement for traditional fronte
|
|
|
75
80
|
### Contributing
|
|
76
81
|
|
|
77
82
|
Thanks for your interest in contributing!
|
|
78
|
-
Please take a moment to read up on our guidelines for [contributing](https://github.com/
|
|
79
|
-
Please note that this project is released with a [Contributor Code of Conduct](https://github.com/
|
|
83
|
+
Please take a moment to read up on our guidelines for [contributing](https://github.com/rindojs/rindo/blob/main/CONTRIBUTING.md).
|
|
84
|
+
Please note that this project is released with a [Contributor Code of Conduct](https://github.com/rindojs/rindo/blob/main/CODE_OF_CONDUCT.md). By participating in this project you agree to abide by its terms.
|
package/screenshot/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Rindo Screenshot v4.18.
|
|
2
|
+
Rindo Screenshot v4.18.1 | MIT Licensed | https://rindojs.web.app
|
|
3
3
|
*/
|
|
4
4
|
"use strict";
|
|
5
5
|
var __create = Object.create;
|
|
@@ -334,14 +334,10 @@ var ScreenshotConnector = class {
|
|
|
334
334
|
});
|
|
335
335
|
}
|
|
336
336
|
screenshotCache.items.sort((a, b) => {
|
|
337
|
-
if (a.ts > b.ts)
|
|
338
|
-
|
|
339
|
-
if (a.
|
|
340
|
-
|
|
341
|
-
if (a.mp > b.mp)
|
|
342
|
-
return -1;
|
|
343
|
-
if (a.mp < b.mp)
|
|
344
|
-
return 1;
|
|
337
|
+
if (a.ts > b.ts) return -1;
|
|
338
|
+
if (a.ts < b.ts) return 1;
|
|
339
|
+
if (a.mp > b.mp) return -1;
|
|
340
|
+
if (a.mp < b.mp) return 1;
|
|
345
341
|
return 0;
|
|
346
342
|
});
|
|
347
343
|
screenshotCache.items = screenshotCache.items.slice(0, 1e3);
|
|
@@ -382,78 +378,50 @@ var ScreenshotConnector = class {
|
|
|
382
378
|
sortScreenshots(screenshots) {
|
|
383
379
|
return screenshots.sort((a, b) => {
|
|
384
380
|
if (a.desc && b.desc) {
|
|
385
|
-
if (a.desc.toLowerCase() < b.desc.toLowerCase())
|
|
386
|
-
|
|
387
|
-
if (a.desc.toLowerCase() > b.desc.toLowerCase())
|
|
388
|
-
return 1;
|
|
381
|
+
if (a.desc.toLowerCase() < b.desc.toLowerCase()) return -1;
|
|
382
|
+
if (a.desc.toLowerCase() > b.desc.toLowerCase()) return 1;
|
|
389
383
|
}
|
|
390
384
|
if (a.device && b.device) {
|
|
391
|
-
if (a.device.toLowerCase() < b.device.toLowerCase())
|
|
392
|
-
|
|
393
|
-
if (a.device.toLowerCase() > b.device.toLowerCase())
|
|
394
|
-
return 1;
|
|
385
|
+
if (a.device.toLowerCase() < b.device.toLowerCase()) return -1;
|
|
386
|
+
if (a.device.toLowerCase() > b.device.toLowerCase()) return 1;
|
|
395
387
|
}
|
|
396
388
|
if (a.userAgent && b.userAgent) {
|
|
397
|
-
if (a.userAgent.toLowerCase() < b.userAgent.toLowerCase())
|
|
398
|
-
|
|
399
|
-
if (a.userAgent.toLowerCase() > b.userAgent.toLowerCase())
|
|
400
|
-
return 1;
|
|
389
|
+
if (a.userAgent.toLowerCase() < b.userAgent.toLowerCase()) return -1;
|
|
390
|
+
if (a.userAgent.toLowerCase() > b.userAgent.toLowerCase()) return 1;
|
|
401
391
|
}
|
|
402
|
-
if (a.width < b.width)
|
|
403
|
-
|
|
404
|
-
if (a.
|
|
405
|
-
|
|
406
|
-
if (a.
|
|
407
|
-
|
|
408
|
-
if (a.height > b.height)
|
|
409
|
-
return 1;
|
|
410
|
-
if (a.id < b.id)
|
|
411
|
-
return -1;
|
|
412
|
-
if (a.id > b.id)
|
|
413
|
-
return 1;
|
|
392
|
+
if (a.width < b.width) return -1;
|
|
393
|
+
if (a.width > b.width) return 1;
|
|
394
|
+
if (a.height < b.height) return -1;
|
|
395
|
+
if (a.height > b.height) return 1;
|
|
396
|
+
if (a.id < b.id) return -1;
|
|
397
|
+
if (a.id > b.id) return 1;
|
|
414
398
|
return 0;
|
|
415
399
|
});
|
|
416
400
|
}
|
|
417
401
|
sortCompares(compares) {
|
|
418
402
|
return compares.sort((a, b) => {
|
|
419
|
-
if (a.allowableMismatchedPixels > b.allowableMismatchedPixels)
|
|
420
|
-
|
|
421
|
-
if (a.
|
|
422
|
-
|
|
423
|
-
if (a.allowableMismatchedRatio > b.allowableMismatchedRatio)
|
|
424
|
-
return -1;
|
|
425
|
-
if (a.allowableMismatchedRatio < b.allowableMismatchedRatio)
|
|
426
|
-
return 1;
|
|
403
|
+
if (a.allowableMismatchedPixels > b.allowableMismatchedPixels) return -1;
|
|
404
|
+
if (a.allowableMismatchedPixels < b.allowableMismatchedPixels) return 1;
|
|
405
|
+
if (a.allowableMismatchedRatio > b.allowableMismatchedRatio) return -1;
|
|
406
|
+
if (a.allowableMismatchedRatio < b.allowableMismatchedRatio) return 1;
|
|
427
407
|
if (a.desc && b.desc) {
|
|
428
|
-
if (a.desc.toLowerCase() < b.desc.toLowerCase())
|
|
429
|
-
|
|
430
|
-
if (a.desc.toLowerCase() > b.desc.toLowerCase())
|
|
431
|
-
return 1;
|
|
408
|
+
if (a.desc.toLowerCase() < b.desc.toLowerCase()) return -1;
|
|
409
|
+
if (a.desc.toLowerCase() > b.desc.toLowerCase()) return 1;
|
|
432
410
|
}
|
|
433
411
|
if (a.device && b.device) {
|
|
434
|
-
if (a.device.toLowerCase() < b.device.toLowerCase())
|
|
435
|
-
|
|
436
|
-
if (a.device.toLowerCase() > b.device.toLowerCase())
|
|
437
|
-
return 1;
|
|
412
|
+
if (a.device.toLowerCase() < b.device.toLowerCase()) return -1;
|
|
413
|
+
if (a.device.toLowerCase() > b.device.toLowerCase()) return 1;
|
|
438
414
|
}
|
|
439
415
|
if (a.userAgent && b.userAgent) {
|
|
440
|
-
if (a.userAgent.toLowerCase() < b.userAgent.toLowerCase())
|
|
441
|
-
|
|
442
|
-
if (a.userAgent.toLowerCase() > b.userAgent.toLowerCase())
|
|
443
|
-
return 1;
|
|
416
|
+
if (a.userAgent.toLowerCase() < b.userAgent.toLowerCase()) return -1;
|
|
417
|
+
if (a.userAgent.toLowerCase() > b.userAgent.toLowerCase()) return 1;
|
|
444
418
|
}
|
|
445
|
-
if (a.width < b.width)
|
|
446
|
-
|
|
447
|
-
if (a.
|
|
448
|
-
|
|
449
|
-
if (a.
|
|
450
|
-
|
|
451
|
-
if (a.height > b.height)
|
|
452
|
-
return 1;
|
|
453
|
-
if (a.id < b.id)
|
|
454
|
-
return -1;
|
|
455
|
-
if (a.id > b.id)
|
|
456
|
-
return 1;
|
|
419
|
+
if (a.width < b.width) return -1;
|
|
420
|
+
if (a.width > b.width) return 1;
|
|
421
|
+
if (a.height < b.height) return -1;
|
|
422
|
+
if (a.height > b.height) return 1;
|
|
423
|
+
if (a.id < b.id) return -1;
|
|
424
|
+
if (a.id > b.id) return 1;
|
|
457
425
|
return 0;
|
|
458
426
|
});
|
|
459
427
|
}
|
|
@@ -489,18 +457,15 @@ var reducePathComponents = (components) => {
|
|
|
489
457
|
const reduced = [components[0]];
|
|
490
458
|
for (let i = 1; i < components.length; i++) {
|
|
491
459
|
const component = components[i];
|
|
492
|
-
if (!component)
|
|
493
|
-
|
|
494
|
-
if (component === ".")
|
|
495
|
-
continue;
|
|
460
|
+
if (!component) continue;
|
|
461
|
+
if (component === ".") continue;
|
|
496
462
|
if (component === "..") {
|
|
497
463
|
if (reduced.length > 1) {
|
|
498
464
|
if (reduced[reduced.length - 1] !== "..") {
|
|
499
465
|
reduced.pop();
|
|
500
466
|
continue;
|
|
501
467
|
}
|
|
502
|
-
} else if (reduced[0])
|
|
503
|
-
continue;
|
|
468
|
+
} else if (reduced[0]) continue;
|
|
504
469
|
}
|
|
505
470
|
reduced.push(component);
|
|
506
471
|
}
|
|
@@ -511,23 +476,18 @@ var getRootLength = (path2) => {
|
|
|
511
476
|
return rootLength < 0 ? ~rootLength : rootLength;
|
|
512
477
|
};
|
|
513
478
|
var getEncodedRootLength = (path2) => {
|
|
514
|
-
if (!path2)
|
|
515
|
-
return 0;
|
|
479
|
+
if (!path2) return 0;
|
|
516
480
|
const ch0 = path2.charCodeAt(0);
|
|
517
481
|
if (ch0 === 47 /* slash */ || ch0 === 92 /* backslash */) {
|
|
518
|
-
if (path2.charCodeAt(1) !== ch0)
|
|
519
|
-
return 1;
|
|
482
|
+
if (path2.charCodeAt(1) !== ch0) return 1;
|
|
520
483
|
const p1 = path2.indexOf(ch0 === 47 /* slash */ ? "/" : altDirectorySeparator, 2);
|
|
521
|
-
if (p1 < 0)
|
|
522
|
-
return path2.length;
|
|
484
|
+
if (p1 < 0) return path2.length;
|
|
523
485
|
return p1 + 1;
|
|
524
486
|
}
|
|
525
487
|
if (isVolumeCharacter(ch0) && path2.charCodeAt(1) === 58 /* colon */) {
|
|
526
488
|
const ch2 = path2.charCodeAt(2);
|
|
527
|
-
if (ch2 === 47 /* slash */ || ch2 === 92 /* backslash */)
|
|
528
|
-
|
|
529
|
-
if (path2.length === 2)
|
|
530
|
-
return 2;
|
|
489
|
+
if (ch2 === 47 /* slash */ || ch2 === 92 /* backslash */) return 3;
|
|
490
|
+
if (path2.length === 2) return 2;
|
|
531
491
|
}
|
|
532
492
|
const schemeEnd = path2.indexOf(urlSchemeSeparator);
|
|
533
493
|
if (schemeEnd !== -1) {
|
|
@@ -556,12 +516,10 @@ var getEncodedRootLength = (path2) => {
|
|
|
556
516
|
var isVolumeCharacter = (charCode) => charCode >= 97 /* a */ && charCode <= 122 /* z */ || charCode >= 65 /* A */ && charCode <= 90 /* Z */;
|
|
557
517
|
var getFileUrlVolumeSeparatorEnd = (url, start) => {
|
|
558
518
|
const ch0 = url.charCodeAt(start);
|
|
559
|
-
if (ch0 === 58 /* colon */)
|
|
560
|
-
return start + 1;
|
|
519
|
+
if (ch0 === 58 /* colon */) return start + 1;
|
|
561
520
|
if (ch0 === 37 /* percent */ && url.charCodeAt(start + 1) === 51 /* _3 */) {
|
|
562
521
|
const ch2 = url.charCodeAt(start + 2);
|
|
563
|
-
if (ch2 === 97 /* a */ || ch2 === 65 /* A */)
|
|
564
|
-
return start + 3;
|
|
522
|
+
if (ch2 === 97 /* a */ || ch2 === 65 /* A */) return start + 3;
|
|
565
523
|
}
|
|
566
524
|
return -1;
|
|
567
525
|
};
|
package/screenshot/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
Rindo Screenshot Pixel Match v4.18.
|
|
2
|
+
Rindo Screenshot Pixel Match v4.18.1 | MIT Licensed | https://rindojs.web.app
|
|
3
3
|
*/
|
|
4
4
|
"use strict";
|
|
5
5
|
var __create = Object.create;
|
|
@@ -54,8 +54,7 @@ var require_pixelmatch = __commonJS({
|
|
|
54
54
|
throw new Error("Image data: Uint8Array, Uint8ClampedArray or Buffer expected.");
|
|
55
55
|
if (img1.length !== img2.length || output && output.length !== img1.length)
|
|
56
56
|
throw new Error("Image sizes do not match.");
|
|
57
|
-
if (img1.length !== width * height * 4)
|
|
58
|
-
throw new Error("Image data size does not match width/height.");
|
|
57
|
+
if (img1.length !== width * height * 4) throw new Error("Image data size does not match width/height.");
|
|
59
58
|
options = Object.assign({}, defaultOptions, options);
|
|
60
59
|
const len = width * height;
|
|
61
60
|
const a32 = new Uint32Array(img1.buffer, img1.byteOffset, len);
|
|
@@ -69,8 +68,7 @@ var require_pixelmatch = __commonJS({
|
|
|
69
68
|
}
|
|
70
69
|
if (identical) {
|
|
71
70
|
if (output && !options.diffMask) {
|
|
72
|
-
for (let i = 0; i < len; i++)
|
|
73
|
-
drawGrayPixel(img1, 4 * i, options.alpha, output);
|
|
71
|
+
for (let i = 0; i < len; i++) drawGrayPixel(img1, 4 * i, options.alpha, output);
|
|
74
72
|
}
|
|
75
73
|
return 0;
|
|
76
74
|
}
|
|
@@ -82,8 +80,7 @@ var require_pixelmatch = __commonJS({
|
|
|
82
80
|
const delta = colorDelta(img1, img2, pos, pos);
|
|
83
81
|
if (Math.abs(delta) > maxDelta) {
|
|
84
82
|
if (!options.includeAA && (antialiased(img1, x, y, width, height, img2) || antialiased(img2, x, y, width, height, img1))) {
|
|
85
|
-
if (output && !options.diffMask)
|
|
86
|
-
drawPixel(output, pos, ...options.aaColor);
|
|
83
|
+
if (output && !options.diffMask) drawPixel(output, pos, ...options.aaColor);
|
|
87
84
|
} else {
|
|
88
85
|
if (output) {
|
|
89
86
|
drawPixel(output, pos, ...delta < 0 && options.diffColorAlt || options.diffColor);
|
|
@@ -91,8 +88,7 @@ var require_pixelmatch = __commonJS({
|
|
|
91
88
|
diff++;
|
|
92
89
|
}
|
|
93
90
|
} else if (output) {
|
|
94
|
-
if (!options.diffMask)
|
|
95
|
-
drawGrayPixel(img1, pos, options.alpha, output);
|
|
91
|
+
if (!options.diffMask) drawGrayPixel(img1, pos, options.alpha, output);
|
|
96
92
|
}
|
|
97
93
|
}
|
|
98
94
|
}
|
|
@@ -113,13 +109,11 @@ var require_pixelmatch = __commonJS({
|
|
|
113
109
|
let minX, minY, maxX, maxY;
|
|
114
110
|
for (let x = x0; x <= x2; x++) {
|
|
115
111
|
for (let y = y0; y <= y2; y++) {
|
|
116
|
-
if (x === x1 && y === y1)
|
|
117
|
-
continue;
|
|
112
|
+
if (x === x1 && y === y1) continue;
|
|
118
113
|
const delta = colorDelta(img, img, pos, (y * width + x) * 4, true);
|
|
119
114
|
if (delta === 0) {
|
|
120
115
|
zeroes++;
|
|
121
|
-
if (zeroes > 2)
|
|
122
|
-
return false;
|
|
116
|
+
if (zeroes > 2) return false;
|
|
123
117
|
} else if (delta < min) {
|
|
124
118
|
min = delta;
|
|
125
119
|
minX = x;
|
|
@@ -131,8 +125,7 @@ var require_pixelmatch = __commonJS({
|
|
|
131
125
|
}
|
|
132
126
|
}
|
|
133
127
|
}
|
|
134
|
-
if (min === 0 || max === 0)
|
|
135
|
-
return false;
|
|
128
|
+
if (min === 0 || max === 0) return false;
|
|
136
129
|
return hasManySiblings(img, minX, minY, width, height) && hasManySiblings(img2, minX, minY, width, height) || hasManySiblings(img, maxX, maxY, width, height) && hasManySiblings(img2, maxX, maxY, width, height);
|
|
137
130
|
}
|
|
138
131
|
function hasManySiblings(img, x1, y1, width, height) {
|
|
@@ -144,13 +137,10 @@ var require_pixelmatch = __commonJS({
|
|
|
144
137
|
let zeroes = x1 === x0 || x1 === x2 || y1 === y0 || y1 === y2 ? 1 : 0;
|
|
145
138
|
for (let x = x0; x <= x2; x++) {
|
|
146
139
|
for (let y = y0; y <= y2; y++) {
|
|
147
|
-
if (x === x1 && y === y1)
|
|
148
|
-
continue;
|
|
140
|
+
if (x === x1 && y === y1) continue;
|
|
149
141
|
const pos2 = (y * width + x) * 4;
|
|
150
|
-
if (img[pos] === img[pos2] && img[pos + 1] === img[pos2 + 1] && img[pos + 2] === img[pos2 + 2] && img[pos + 3] === img[pos2 + 3])
|
|
151
|
-
|
|
152
|
-
if (zeroes > 2)
|
|
153
|
-
return true;
|
|
142
|
+
if (img[pos] === img[pos2] && img[pos + 1] === img[pos2 + 1] && img[pos + 2] === img[pos2 + 2] && img[pos + 3] === img[pos2 + 3]) zeroes++;
|
|
143
|
+
if (zeroes > 2) return true;
|
|
154
144
|
}
|
|
155
145
|
}
|
|
156
146
|
return false;
|
|
@@ -164,8 +154,7 @@ var require_pixelmatch = __commonJS({
|
|
|
164
154
|
let g2 = img2[m + 1];
|
|
165
155
|
let b2 = img2[m + 2];
|
|
166
156
|
let a2 = img2[m + 3];
|
|
167
|
-
if (a1 === a2 && r1 === r2 && g1 === g2 && b1 === b2)
|
|
168
|
-
return 0;
|
|
157
|
+
if (a1 === a2 && r1 === r2 && g1 === g2 && b1 === b2) return 0;
|
|
169
158
|
if (a1 < 255) {
|
|
170
159
|
a1 /= 255;
|
|
171
160
|
r1 = blend(r1, a1);
|
|
@@ -181,8 +170,7 @@ var require_pixelmatch = __commonJS({
|
|
|
181
170
|
const y1 = rgb2y(r1, g1, b1);
|
|
182
171
|
const y2 = rgb2y(r2, g2, b2);
|
|
183
172
|
const y = y1 - y2;
|
|
184
|
-
if (yOnly)
|
|
185
|
-
return y;
|
|
173
|
+
if (yOnly) return y;
|
|
186
174
|
const i = rgb2i(r1, g1, b1) - rgb2i(r2, g2, b2);
|
|
187
175
|
const q = rgb2q(r1, g1, b1) - rgb2q(r2, g2, b2);
|
|
188
176
|
const delta = 0.5053 * y * y + 0.299 * i * i + 0.1957 * q * q;
|
|
@@ -2313,8 +2301,7 @@ function getMismatchedPixels(pixelMatchInput) {
|
|
|
2313
2301
|
const imgB = import_fs.default.createReadStream(pixelMatchInput.imageBPath).pipe(new import_pngjs.PNG()).on("parsed", doneReading);
|
|
2314
2302
|
let filesRead = 0;
|
|
2315
2303
|
function doneReading() {
|
|
2316
|
-
if (++filesRead < 2)
|
|
2317
|
-
return;
|
|
2304
|
+
if (++filesRead < 2) return;
|
|
2318
2305
|
const mismatchedPixels = (0, import_pixelmatch.default)(imgA.data, imgB.data, null, pixelMatchInput.width, pixelMatchInput.height, {
|
|
2319
2306
|
threshold: pixelMatchInput.pixelmatchThreshold,
|
|
2320
2307
|
includeAA: false
|