testeranto 0.62.0 → 0.70.0

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.
Files changed (151) hide show
  1. package/README.md +42 -21
  2. package/dist/cjs-shim.js +2 -2
  3. package/dist/common/Node.js +7 -24
  4. package/dist/common/NodeWriter.js +7 -9
  5. package/dist/common/Project.js +103 -266
  6. package/dist/common/SubPackages/puppeteer.js +1 -1
  7. package/dist/common/SubPackages/react-dom/component/web.js +1 -1
  8. package/dist/common/SubPackages/react-dom/jsx/web.js +15 -7
  9. package/dist/common/SubPackages/react-test-renderer/MemoExoticComponent/node.js +1 -1
  10. package/dist/common/SubPackages/react-test-renderer/component/index.js +0 -1
  11. package/dist/common/SubPackages/react-test-renderer/fc/web.js +1 -1
  12. package/dist/common/SubPackages/react-test-renderer/jsx/index.js +1 -2
  13. package/dist/common/SubPackages/react-test-renderer/jsx/web.js +1 -1
  14. package/dist/common/SubPackages/react-test-renderer/jsx-promised/index.js +1 -1
  15. package/dist/common/Types.js +2 -32
  16. package/dist/common/Web.js +25 -18
  17. package/dist/common/electron.js +177 -107
  18. package/dist/common/esbuildConfigs/index.js +5 -5
  19. package/dist/common/esbuildConfigs/node.js +17 -15
  20. package/dist/common/esbuildConfigs/report.js +12 -47
  21. package/dist/common/esbuildConfigs/tests.js +0 -1
  22. package/dist/common/esbuildConfigs/web.js +14 -11
  23. package/dist/common/lib/abstractBase.js +13 -6
  24. package/dist/common/lib/basebuilder.js +11 -11
  25. package/dist/common/lib/classBuilder.js +2 -3
  26. package/dist/common/lib/core.js +37 -8
  27. package/dist/common/lib/index.js +10 -8
  28. package/dist/common/lib/types.js +2 -0
  29. package/dist/common/preload.js +15 -25
  30. package/dist/common/puppeteerConfiger.js +24 -0
  31. package/dist/common/tsconfig.common.tsbuildinfo +1 -1
  32. package/dist/module/Node.js +7 -24
  33. package/dist/module/NodeWriter.js +7 -9
  34. package/dist/module/Project.js +104 -267
  35. package/dist/module/SubPackages/puppeteer.js +1 -1
  36. package/dist/module/SubPackages/react/jsx/web.js +1 -1
  37. package/dist/module/SubPackages/react-dom/component/node.js +2 -2
  38. package/dist/module/SubPackages/react-dom/component/web.js +1 -1
  39. package/dist/module/SubPackages/react-dom/jsx/web.js +17 -9
  40. package/dist/module/SubPackages/react-test-renderer/MemoExoticComponent/node.js +1 -1
  41. package/dist/module/SubPackages/react-test-renderer/component/index.js +0 -1
  42. package/dist/module/SubPackages/react-test-renderer/fc/web.js +1 -1
  43. package/dist/module/SubPackages/react-test-renderer/jsx/index.js +1 -2
  44. package/dist/module/SubPackages/react-test-renderer/jsx/web.js +1 -1
  45. package/dist/module/SubPackages/react-test-renderer/jsx-promised/index.js +1 -1
  46. package/dist/module/Types.js +3 -30
  47. package/dist/module/Web.js +26 -19
  48. package/dist/module/electron.js +179 -109
  49. package/dist/module/esbuildConfigs/index.js +5 -5
  50. package/dist/module/esbuildConfigs/node.js +17 -15
  51. package/dist/module/esbuildConfigs/report.js +11 -48
  52. package/dist/module/esbuildConfigs/tests.js +0 -1
  53. package/dist/module/esbuildConfigs/web.js +14 -11
  54. package/dist/module/lib/abstractBase.js +13 -6
  55. package/dist/module/lib/basebuilder.js +11 -11
  56. package/dist/module/lib/classBuilder.js +2 -3
  57. package/dist/module/lib/core.js +39 -10
  58. package/dist/module/lib/index.js +10 -8
  59. package/dist/module/lib/types.js +1 -0
  60. package/dist/module/preload.js +12 -25
  61. package/dist/module/puppeteerConfiger.js +19 -0
  62. package/dist/module/tsconfig.module.tsbuildinfo +1 -1
  63. package/dist/types/Node.d.ts +3 -2
  64. package/dist/types/Project.d.ts +1 -2
  65. package/dist/types/SubPackages/puppeteer.d.ts +3 -3
  66. package/dist/types/SubPackages/react/component/node.d.ts +1 -1
  67. package/dist/types/SubPackages/react/component/web.d.ts +1 -1
  68. package/dist/types/SubPackages/react/jsx/index.d.ts +1 -1
  69. package/dist/types/SubPackages/react/jsx/node.d.ts +1 -1
  70. package/dist/types/SubPackages/react/jsx/web.d.ts +2 -2
  71. package/dist/types/SubPackages/react-dom/component/node.d.ts +2 -2
  72. package/dist/types/SubPackages/react-dom/component/web.d.ts +1 -1
  73. package/dist/types/SubPackages/react-dom/jsx/node.d.ts +1 -1
  74. package/dist/types/SubPackages/react-dom/jsx/web.d.ts +1 -1
  75. package/dist/types/SubPackages/react-test-renderer/MemoExoticComponent/node.d.ts +1 -1
  76. package/dist/types/SubPackages/react-test-renderer/component/index.d.ts +1 -1
  77. package/dist/types/SubPackages/react-test-renderer/component/node.d.ts +1 -1
  78. package/dist/types/SubPackages/react-test-renderer/component/web.d.ts +1 -1
  79. package/dist/types/SubPackages/react-test-renderer/fc/node.d.ts +1 -1
  80. package/dist/types/SubPackages/react-test-renderer/fc/web.d.ts +1 -1
  81. package/dist/types/SubPackages/react-test-renderer/jsx/node.d.ts +1 -1
  82. package/dist/types/SubPackages/react-test-renderer/jsx/web.d.ts +3 -3
  83. package/dist/types/SubPackages/react-test-renderer/jsx-promised/index.d.ts +1 -1
  84. package/dist/types/SubPackages/react-test-renderer/jsx-promised/node.d.ts +1 -1
  85. package/dist/types/SubPackages/react-test-renderer/jsx-promised/web.d.ts +1 -1
  86. package/dist/types/Types.d.ts +19 -100
  87. package/dist/types/Web.d.ts +3 -2
  88. package/dist/types/esbuildConfigs/features.d.ts +1 -1
  89. package/dist/types/esbuildConfigs/index.d.ts +1 -1
  90. package/dist/types/esbuildConfigs/node.d.ts +1 -1
  91. package/dist/types/esbuildConfigs/report.d.ts +4 -0
  92. package/dist/types/esbuildConfigs/tests.d.ts +1 -1
  93. package/dist/types/esbuildConfigs/web.d.ts +1 -1
  94. package/dist/types/lib/abstractBase.d.ts +25 -24
  95. package/dist/types/lib/basebuilder.d.ts +8 -7
  96. package/dist/types/lib/classBuilder.d.ts +3 -2
  97. package/dist/types/lib/core.d.ts +3 -2
  98. package/dist/types/lib/index.d.ts +4 -3
  99. package/dist/types/lib/types.d.ts +70 -0
  100. package/dist/types/puppeteerConfiger.d.ts +4 -0
  101. package/dist/types/tsconfig.types.tsbuildinfo +1 -1
  102. package/package.json +4 -3
  103. package/src/Node.ts +24 -54
  104. package/src/NodeWriter.ts +21 -18
  105. package/src/Project.ts +165 -620
  106. package/src/Report.tsx +1 -1
  107. package/src/SubPackages/puppeteer.ts +19 -14
  108. package/src/SubPackages/react/component/node.ts +20 -32
  109. package/src/SubPackages/react/component/web.ts +20 -30
  110. package/src/SubPackages/react/jsx/index.ts +13 -24
  111. package/src/SubPackages/react/jsx/web.ts +10 -8
  112. package/src/SubPackages/react-dom/component/node.ts +17 -23
  113. package/src/SubPackages/react-dom/component/web.ts +30 -50
  114. package/src/SubPackages/react-dom/jsx/web.ts +41 -48
  115. package/src/SubPackages/react-test-renderer/MemoExoticComponent/node.ts +27 -37
  116. package/src/SubPackages/react-test-renderer/component/index.ts +16 -30
  117. package/src/SubPackages/react-test-renderer/component/node.ts +5 -11
  118. package/src/SubPackages/react-test-renderer/component/web.ts +5 -11
  119. package/src/SubPackages/react-test-renderer/fc/node.ts +36 -50
  120. package/src/SubPackages/react-test-renderer/fc/web.ts +37 -50
  121. package/src/SubPackages/react-test-renderer/jsx/index.ts +16 -21
  122. package/src/SubPackages/react-test-renderer/jsx/node.ts +6 -10
  123. package/src/SubPackages/react-test-renderer/jsx/web.ts +7 -7
  124. package/src/SubPackages/react-test-renderer/jsx-promised/index.ts +13 -16
  125. package/src/Types.ts +73 -307
  126. package/src/Web.ts +54 -53
  127. package/src/cjs-shim.js +2 -2
  128. package/src/electron.ts +258 -191
  129. package/src/esbuildConfigs/features.ts +3 -4
  130. package/src/esbuildConfigs/index.ts +8 -8
  131. package/src/esbuildConfigs/node.ts +21 -20
  132. package/src/esbuildConfigs/report.ts +15 -51
  133. package/src/esbuildConfigs/tests.ts +3 -9
  134. package/src/esbuildConfigs/web.ts +18 -18
  135. package/src/lib/abstractBase.ts +78 -125
  136. package/src/lib/basebuilder.ts +109 -134
  137. package/src/lib/classBuilder.ts +26 -45
  138. package/src/lib/core.ts +101 -69
  139. package/src/lib/index.ts +53 -52
  140. package/src/lib/types.ts +206 -0
  141. package/src/preload.ts +12 -28
  142. package/src/puppeteerConfiger.ts +26 -0
  143. package/src/web.html.ts +1 -1
  144. package/dist/common/lib/browser.js +0 -26
  145. package/dist/common/nodeWriterElectron.js +0 -55
  146. package/dist/module/lib/browser.js +0 -22
  147. package/dist/module/nodeWriterElectron.js +0 -52
  148. package/dist/types/lib/browser.d.ts +0 -6
  149. package/dist/types/nodeWriterElectron.d.ts +0 -2
  150. package/src/lib/browser.ts +0 -34
  151. package/src/nodeWriterElectron.ts +0 -71
@@ -0,0 +1,26 @@
1
+ import http from "http";
2
+
3
+ export default async (
4
+ port: string
5
+ ): Promise<{ webSocketDebuggerUrl: string }> =>
6
+ new Promise((resolve, reject) => {
7
+ let json = "";
8
+ const request = http.request(
9
+ {
10
+ host: "127.0.0.1",
11
+ path: "/json/version",
12
+ port,
13
+ },
14
+ (response) => {
15
+ response.on("error", reject);
16
+ response.on("data", (chunk: Buffer) => {
17
+ json += chunk.toString();
18
+ });
19
+ response.on("end", () => {
20
+ resolve(JSON.parse(json));
21
+ });
22
+ }
23
+ );
24
+ request.on("error", reject);
25
+ request.end();
26
+ });
package/src/web.html.ts CHANGED
@@ -17,4 +17,4 @@ export default (jsfilePath: string, htmlFilePath: string) => `
17
17
  <footer></footer>
18
18
 
19
19
  </html>
20
- `
20
+ `;
@@ -1,26 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.TBrowser = void 0;
4
- class TBrowser {
5
- constructor(browser) {
6
- this.browser = browser;
7
- }
8
- pages() {
9
- return new Promise(async (res, rej) => {
10
- res((await this.browser.pages()).map((p) => {
11
- // const handler = {
12
- // apply: function (target, thisArg, argumentsList) {
13
- // console.log('screenshot was called with ' + JSON.stringify(argumentsList));
14
- // const x: ScreenshotOptions = argumentsList[0]
15
- // x.path = "./dist/" + x.path;
16
- // console.log('x.path' + x.path, target, thisArg);
17
- // return target(...argumentsList);
18
- // }
19
- // };
20
- // p.screenshot = new Proxy(p.screenshot, handler);
21
- return p;
22
- }));
23
- });
24
- }
25
- }
26
- exports.TBrowser = TBrowser;
@@ -1,55 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.NodeWriterElectron = void 0;
4
- // import fs from "fs";
5
- const fs = require("fs");
6
- // import path from "path";
7
- const path = require("path");
8
- const fPaths = [];
9
- exports.NodeWriterElectron = {
10
- createWriteStream: (filepath) => {
11
- return fs.createWriteStream(filepath);
12
- },
13
- writeFileSync: (fp, contents) => {
14
- fs.writeFileSync(fp, contents);
15
- },
16
- mkdirSync: async (fp) => {
17
- await fs.mkdirSync(fp, { recursive: true });
18
- },
19
- testArtiFactoryfileWriter: (tLog, callback) => (fPath, value) => {
20
- callback(new Promise((res, rej) => {
21
- tLog("testArtiFactory =>", fPath);
22
- const cleanPath = path.resolve(fPath);
23
- fPaths.push(cleanPath.replace(process.cwd(), ``));
24
- const targetDir = cleanPath.split("/").slice(0, -1).join("/");
25
- fs.mkdir(targetDir, { recursive: true }, async (error) => {
26
- if (error) {
27
- console.error(`❗️testArtiFactory failed`, targetDir, error);
28
- }
29
- fs.writeFileSync(path.resolve(targetDir.split("/").slice(0, -1).join("/"), "manifest"), fPaths.join(`\n`), {
30
- encoding: "utf-8",
31
- });
32
- if (Buffer.isBuffer(value)) {
33
- fs.writeFileSync(fPath, value, "binary");
34
- res();
35
- }
36
- else if (`string` === typeof value) {
37
- fs.writeFileSync(fPath, value.toString(), {
38
- encoding: "utf-8",
39
- });
40
- res();
41
- }
42
- else {
43
- /* @ts-ignore:next-line */
44
- const pipeStream = value;
45
- const myFile = fs.createWriteStream(fPath);
46
- pipeStream.pipe(myFile);
47
- pipeStream.on("close", () => {
48
- myFile.close();
49
- res();
50
- });
51
- }
52
- });
53
- }));
54
- }
55
- };
@@ -1,22 +0,0 @@
1
- export class TBrowser {
2
- constructor(browser) {
3
- this.browser = browser;
4
- }
5
- pages() {
6
- return new Promise(async (res, rej) => {
7
- res((await this.browser.pages()).map((p) => {
8
- // const handler = {
9
- // apply: function (target, thisArg, argumentsList) {
10
- // console.log('screenshot was called with ' + JSON.stringify(argumentsList));
11
- // const x: ScreenshotOptions = argumentsList[0]
12
- // x.path = "./dist/" + x.path;
13
- // console.log('x.path' + x.path, target, thisArg);
14
- // return target(...argumentsList);
15
- // }
16
- // };
17
- // p.screenshot = new Proxy(p.screenshot, handler);
18
- return p;
19
- }));
20
- });
21
- }
22
- }
@@ -1,52 +0,0 @@
1
- // import fs from "fs";
2
- const fs = require("fs");
3
- // import path from "path";
4
- const path = require("path");
5
- const fPaths = [];
6
- export const NodeWriterElectron = {
7
- createWriteStream: (filepath) => {
8
- return fs.createWriteStream(filepath);
9
- },
10
- writeFileSync: (fp, contents) => {
11
- fs.writeFileSync(fp, contents);
12
- },
13
- mkdirSync: async (fp) => {
14
- await fs.mkdirSync(fp, { recursive: true });
15
- },
16
- testArtiFactoryfileWriter: (tLog, callback) => (fPath, value) => {
17
- callback(new Promise((res, rej) => {
18
- tLog("testArtiFactory =>", fPath);
19
- const cleanPath = path.resolve(fPath);
20
- fPaths.push(cleanPath.replace(process.cwd(), ``));
21
- const targetDir = cleanPath.split("/").slice(0, -1).join("/");
22
- fs.mkdir(targetDir, { recursive: true }, async (error) => {
23
- if (error) {
24
- console.error(`❗️testArtiFactory failed`, targetDir, error);
25
- }
26
- fs.writeFileSync(path.resolve(targetDir.split("/").slice(0, -1).join("/"), "manifest"), fPaths.join(`\n`), {
27
- encoding: "utf-8",
28
- });
29
- if (Buffer.isBuffer(value)) {
30
- fs.writeFileSync(fPath, value, "binary");
31
- res();
32
- }
33
- else if (`string` === typeof value) {
34
- fs.writeFileSync(fPath, value.toString(), {
35
- encoding: "utf-8",
36
- });
37
- res();
38
- }
39
- else {
40
- /* @ts-ignore:next-line */
41
- const pipeStream = value;
42
- const myFile = fs.createWriteStream(fPath);
43
- pipeStream.pipe(myFile);
44
- pipeStream.on("close", () => {
45
- myFile.close();
46
- res();
47
- });
48
- }
49
- });
50
- }));
51
- }
52
- };
@@ -1,6 +0,0 @@
1
- import { Browser, Page } from "puppeteer-core";
2
- export declare class TBrowser {
3
- browser: Browser;
4
- constructor(browser: Browser);
5
- pages(): Promise<Page[]>;
6
- }
@@ -1,2 +0,0 @@
1
- import { ILogWriter } from "./lib/index.js";
2
- export declare const NodeWriterElectron: ILogWriter;
@@ -1,34 +0,0 @@
1
- import { Browser, Page } from "puppeteer-core";
2
-
3
- export class TBrowser {
4
- browser: Browser;
5
- constructor(browser: Browser) {
6
- this.browser = browser;
7
- }
8
- pages(): Promise<Page[]> {
9
-
10
- return new Promise(async (res, rej) => {
11
-
12
-
13
- res(
14
- (await this.browser.pages()).map((p) => {
15
- // const handler = {
16
- // apply: function (target, thisArg, argumentsList) {
17
- // console.log('screenshot was called with ' + JSON.stringify(argumentsList));
18
- // const x: ScreenshotOptions = argumentsList[0]
19
- // x.path = "./dist/" + x.path;
20
- // console.log('x.path' + x.path, target, thisArg);
21
- // return target(...argumentsList);
22
- // }
23
- // };
24
- // p.screenshot = new Proxy(p.screenshot, handler);
25
- return p;
26
- })
27
- );
28
- });
29
-
30
- }
31
- // pages(): Promise<TPage[]> {
32
- // return super.pages();
33
- // }
34
- }
@@ -1,71 +0,0 @@
1
- // import fs from "fs";
2
- const fs = require("fs");
3
- // import path from "path";
4
- const path = require("path");
5
- import { PassThrough } from "stream";
6
-
7
- import { ILogWriter, ITLog } from "./lib/index.js";
8
-
9
- type IFPaths = string[];
10
- const fPaths: IFPaths = [];
11
-
12
- export const NodeWriterElectron: ILogWriter = {
13
- createWriteStream: (filepath: string): fs.WriteStream => {
14
- return fs.createWriteStream(filepath);
15
- },
16
- writeFileSync: (fp: string, contents: string) => {
17
- fs.writeFileSync(
18
- fp,
19
- contents
20
- );
21
- },
22
- mkdirSync: async (fp: string) => {
23
- await fs.mkdirSync(fp, { recursive: true });
24
- },
25
- testArtiFactoryfileWriter:
26
- (tLog: ITLog, callback: (Promise) => void) =>
27
- (fPath, value: string | Buffer | PassThrough) => {
28
- callback(new Promise<void>((res, rej) => {
29
- tLog("testArtiFactory =>", fPath);
30
-
31
- const cleanPath = path.resolve(fPath);
32
- fPaths.push(cleanPath.replace(process.cwd(), ``));
33
-
34
- const targetDir = cleanPath.split("/").slice(0, -1).join("/");
35
-
36
- fs.mkdir(targetDir, { recursive: true }, async (error) => {
37
- if (error) {
38
- console.error(`❗️testArtiFactory failed`, targetDir, error);
39
- }
40
-
41
- fs.writeFileSync(
42
- path.resolve(targetDir.split("/").slice(0, -1).join("/"), "manifest"),
43
- fPaths.join(`\n`),
44
- {
45
- encoding: "utf-8",
46
- }
47
- );
48
-
49
- if (Buffer.isBuffer(value)) {
50
- fs.writeFileSync(fPath, value, "binary");
51
- res();
52
- } else if (`string` === typeof value) {
53
- fs.writeFileSync(fPath, value.toString(), {
54
- encoding: "utf-8",
55
- });
56
- res();
57
- } else {
58
- /* @ts-ignore:next-line */
59
- const pipeStream: PassThrough = value;
60
- const myFile = fs.createWriteStream(fPath);
61
- pipeStream.pipe(myFile);
62
- pipeStream.on("close", () => {
63
- myFile.close();
64
- res();
65
- });
66
- }
67
- });
68
- }))
69
-
70
- }
71
- }