testeranto 0.100.0 → 0.111.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 (226) hide show
  1. package/README.md +1 -0
  2. package/bundle.js +80 -30
  3. package/package.json +40 -32
  4. package/src/Footer.tsx +4 -0
  5. package/src/Init.ts +48 -0
  6. package/src/Node.ts +23 -17
  7. package/src/PM/index.ts +1 -1
  8. package/src/PM/main.ts +524 -156
  9. package/src/PM/node.ts +2 -2
  10. package/src/PM/web.ts +1 -1
  11. package/src/ReportClient.tsx +163 -0
  12. package/src/ReportServer.ts +21 -0
  13. package/src/SubPackages/react/component/node.ts +68 -24
  14. package/src/SubPackages/react/component/web.ts +68 -25
  15. package/src/SubPackages/react/jsx/index.ts +39 -18
  16. package/src/SubPackages/react/jsx/node.ts +12 -10
  17. package/src/SubPackages/react/jsx/web.ts +27 -14
  18. package/src/SubPackages/react-dom/component/node.ts +42 -50
  19. package/src/SubPackages/react-dom/component/web.ts +28 -10
  20. package/src/SubPackages/react-dom/jsx/node.ts +54 -56
  21. package/src/SubPackages/react-dom/jsx/web.ts +55 -42
  22. package/src/SubPackages/react-test-renderer/MemoExoticComponent/node.ts +23 -7
  23. package/src/SubPackages/react-test-renderer/component/index.ts +38 -5
  24. package/src/SubPackages/react-test-renderer/component/node.ts +24 -5
  25. package/src/SubPackages/react-test-renderer/component/web.ts +22 -5
  26. package/src/SubPackages/react-test-renderer/fc/node.ts +41 -7
  27. package/src/SubPackages/react-test-renderer/fc/web.ts +43 -11
  28. package/src/SubPackages/react-test-renderer/jsx/index.ts +39 -16
  29. package/src/SubPackages/react-test-renderer/jsx/node.ts +8 -6
  30. package/src/SubPackages/react-test-renderer/jsx/web.ts +22 -5
  31. package/src/SubPackages/react-test-renderer/jsx-promised/index.ts +39 -6
  32. package/src/SubPackages/react-test-renderer/jsx-promised/node.ts +27 -10
  33. package/src/SubPackages/react-test-renderer/jsx-promised/web.ts +26 -12
  34. package/src/TestReport.tsx +176 -0
  35. package/src/Types.ts +63 -309
  36. package/src/Web.ts +24 -18
  37. package/src/build.ts +240 -0
  38. package/src/defaultConfig.ts +2 -1
  39. package/src/esbuildConfigs/eslint-formatter-testeranto.ts +5 -0
  40. package/src/esbuildConfigs/featuresPlugin.ts +0 -1
  41. package/src/esbuildConfigs/index.ts +1 -1
  42. package/src/esbuildConfigs/inputFilesPlugin.ts +2 -135
  43. package/src/esbuildConfigs/node.ts +4 -13
  44. package/src/esbuildConfigs/web.ts +3 -19
  45. package/src/init-docs.ts +2 -1
  46. package/src/lib/abstractBase.ts +82 -80
  47. package/src/lib/basebuilder.ts +57 -45
  48. package/src/lib/classBuilder.ts +15 -15
  49. package/src/lib/core.ts +44 -35
  50. package/src/lib/index.ts +47 -98
  51. package/src/lib/readme.md +12 -0
  52. package/src/lib/types.ts +53 -70
  53. package/src/run.ts +31 -0
  54. package/src/style.css +8 -0
  55. package/src/utils.ts +74 -2
  56. package/tsc.log +108 -0
  57. package/Bundle.Dockerfile +0 -52
  58. package/bin/init-docs.js +0 -24
  59. package/dist/common/dist/module/src/Init.js +0 -40
  60. package/dist/common/package.json +0 -3
  61. package/dist/common/src/Init.js +0 -40
  62. package/dist/common/src/Node.js +0 -27
  63. package/dist/common/src/PM/index.js +0 -7
  64. package/dist/common/src/PM/main.js +0 -941
  65. package/dist/common/src/PM/node.js +0 -128
  66. package/dist/common/src/PM/web.js +0 -121
  67. package/dist/common/src/SubPackages/puppeteer.js +0 -21
  68. package/dist/common/src/SubPackages/react/component/node.js +0 -19
  69. package/dist/common/src/SubPackages/react/component/web.js +0 -19
  70. package/dist/common/src/SubPackages/react/jsx/index.js +0 -33
  71. package/dist/common/src/SubPackages/react/jsx/node.js +0 -10
  72. package/dist/common/src/SubPackages/react/jsx/web.js +0 -10
  73. package/dist/common/src/SubPackages/react-dom/component/node.js +0 -101
  74. package/dist/common/src/SubPackages/react-dom/component/web.js +0 -67
  75. package/dist/common/src/SubPackages/react-dom/jsx/index.js +0 -2
  76. package/dist/common/src/SubPackages/react-dom/jsx/node.js +0 -39
  77. package/dist/common/src/SubPackages/react-dom/jsx/web.js +0 -117
  78. package/dist/common/src/SubPackages/react-test-renderer/MemoExoticComponent/node.js +0 -44
  79. package/dist/common/src/SubPackages/react-test-renderer/component/index.js +0 -2
  80. package/dist/common/src/SubPackages/react-test-renderer/component/interface.js +0 -60
  81. package/dist/common/src/SubPackages/react-test-renderer/component/node.js +0 -8
  82. package/dist/common/src/SubPackages/react-test-renderer/component/web.js +0 -8
  83. package/dist/common/src/SubPackages/react-test-renderer/fc/node.js +0 -50
  84. package/dist/common/src/SubPackages/react-test-renderer/fc/web.js +0 -50
  85. package/dist/common/src/SubPackages/react-test-renderer/jsx/index.js +0 -63
  86. package/dist/common/src/SubPackages/react-test-renderer/jsx/node.js +0 -10
  87. package/dist/common/src/SubPackages/react-test-renderer/jsx/web.js +0 -10
  88. package/dist/common/src/SubPackages/react-test-renderer/jsx-promised/index.js +0 -42
  89. package/dist/common/src/SubPackages/react-test-renderer/jsx-promised/node.js +0 -10
  90. package/dist/common/src/SubPackages/react-test-renderer/jsx-promised/web.js +0 -10
  91. package/dist/common/src/Types.js +0 -2
  92. package/dist/common/src/Web.js +0 -49
  93. package/dist/common/src/cli.js +0 -439
  94. package/dist/common/src/cli2.js +0 -144
  95. package/dist/common/src/defaultConfig.js +0 -19
  96. package/dist/common/src/esbuildConfigs/featuresPlugin.js +0 -39
  97. package/dist/common/src/esbuildConfigs/index.js +0 -21
  98. package/dist/common/src/esbuildConfigs/inputFilesPlugin.js +0 -99
  99. package/dist/common/src/esbuildConfigs/node.js +0 -45
  100. package/dist/common/src/esbuildConfigs/web.js +0 -61
  101. package/dist/common/src/init-docs.js +0 -43
  102. package/dist/common/src/lib/abstractBase.js +0 -324
  103. package/dist/common/src/lib/basebuilder.js +0 -85
  104. package/dist/common/src/lib/classBuilder.js +0 -42
  105. package/dist/common/src/lib/core.js +0 -101
  106. package/dist/common/src/lib/index.js +0 -22
  107. package/dist/common/src/lib/types.js +0 -3
  108. package/dist/common/src/puppeteerConfiger.js +0 -24
  109. package/dist/common/src/utils.js +0 -16
  110. package/dist/common/src/web.html.js +0 -22
  111. package/dist/common/testeranto.js +0 -15
  112. package/dist/common/tsconfig.common.tsbuildinfo +0 -1
  113. package/dist/module/package.json +0 -3
  114. package/dist/module/src/Init.js +0 -35
  115. package/dist/module/src/Node.js +0 -20
  116. package/dist/module/src/PM/index.js +0 -3
  117. package/dist/module/src/PM/main.js +0 -911
  118. package/dist/module/src/PM/node.js +0 -121
  119. package/dist/module/src/PM/web.js +0 -117
  120. package/dist/module/src/SubPackages/puppeteer.js +0 -16
  121. package/dist/module/src/SubPackages/react/component/node.js +0 -14
  122. package/dist/module/src/SubPackages/react/component/web.js +0 -14
  123. package/dist/module/src/SubPackages/react/jsx/index.js +0 -27
  124. package/dist/module/src/SubPackages/react/jsx/node.js +0 -5
  125. package/dist/module/src/SubPackages/react/jsx/web.js +0 -5
  126. package/dist/module/src/SubPackages/react-dom/component/node.js +0 -93
  127. package/dist/module/src/SubPackages/react-dom/component/web.js +0 -62
  128. package/dist/module/src/SubPackages/react-dom/jsx/index.js +0 -1
  129. package/dist/module/src/SubPackages/react-dom/jsx/node.js +0 -31
  130. package/dist/module/src/SubPackages/react-dom/jsx/web.js +0 -89
  131. package/dist/module/src/SubPackages/react-test-renderer/MemoExoticComponent/node.js +0 -16
  132. package/dist/module/src/SubPackages/react-test-renderer/component/index.js +0 -1
  133. package/dist/module/src/SubPackages/react-test-renderer/component/interface.js +0 -31
  134. package/dist/module/src/SubPackages/react-test-renderer/component/node.js +0 -3
  135. package/dist/module/src/SubPackages/react-test-renderer/component/web.js +0 -3
  136. package/dist/module/src/SubPackages/react-test-renderer/fc/node.js +0 -22
  137. package/dist/module/src/SubPackages/react-test-renderer/fc/web.js +0 -22
  138. package/dist/module/src/SubPackages/react-test-renderer/jsx/index.js +0 -34
  139. package/dist/module/src/SubPackages/react-test-renderer/jsx/node.js +0 -5
  140. package/dist/module/src/SubPackages/react-test-renderer/jsx/web.js +0 -5
  141. package/dist/module/src/SubPackages/react-test-renderer/jsx-promised/index.js +0 -16
  142. package/dist/module/src/SubPackages/react-test-renderer/jsx-promised/node.js +0 -5
  143. package/dist/module/src/SubPackages/react-test-renderer/jsx-promised/web.js +0 -5
  144. package/dist/module/src/Types.js +0 -1
  145. package/dist/module/src/Web.js +0 -42
  146. package/dist/module/src/cli.js +0 -411
  147. package/dist/module/src/cli2.js +0 -116
  148. package/dist/module/src/defaultConfig.js +0 -17
  149. package/dist/module/src/esbuildConfigs/featuresPlugin.js +0 -34
  150. package/dist/module/src/esbuildConfigs/index.js +0 -19
  151. package/dist/module/src/esbuildConfigs/inputFilesPlugin.js +0 -94
  152. package/dist/module/src/esbuildConfigs/node.js +0 -40
  153. package/dist/module/src/esbuildConfigs/web.js +0 -56
  154. package/dist/module/src/init-docs.js +0 -15
  155. package/dist/module/src/lib/abstractBase.js +0 -316
  156. package/dist/module/src/lib/basebuilder.js +0 -81
  157. package/dist/module/src/lib/classBuilder.js +0 -38
  158. package/dist/module/src/lib/core.js +0 -98
  159. package/dist/module/src/lib/index.js +0 -18
  160. package/dist/module/src/lib/types.js +0 -2
  161. package/dist/module/src/puppeteerConfiger.js +0 -19
  162. package/dist/module/src/utils.js +0 -9
  163. package/dist/module/src/web.html.js +0 -20
  164. package/dist/module/testeranto.js +0 -13
  165. package/dist/module/tsconfig.module.tsbuildinfo +0 -1
  166. package/dist/prebuild/cli.mjs +0 -1491
  167. package/dist/prebuild/cli2.mjs +0 -918
  168. package/dist/prebuild/init-docs.mjs +0 -48
  169. package/dist/types/dist/module/src/Init.d.ts +0 -2
  170. package/dist/types/src/Init.d.ts +0 -2
  171. package/dist/types/src/Node.d.ts +0 -13
  172. package/dist/types/src/PM/index.d.ts +0 -34
  173. package/dist/types/src/PM/main.d.ts +0 -56
  174. package/dist/types/src/PM/node.d.ts +0 -42
  175. package/dist/types/src/PM/web.d.ts +0 -40
  176. package/dist/types/src/SubPackages/puppeteer.d.ts +0 -6
  177. package/dist/types/src/SubPackages/react/component/node.d.ts +0 -7
  178. package/dist/types/src/SubPackages/react/component/web.d.ts +0 -7
  179. package/dist/types/src/SubPackages/react/jsx/index.d.ts +0 -12
  180. package/dist/types/src/SubPackages/react/jsx/node.d.ts +0 -4
  181. package/dist/types/src/SubPackages/react/jsx/web.d.ts +0 -4
  182. package/dist/types/src/SubPackages/react-dom/component/node.d.ts +0 -12
  183. package/dist/types/src/SubPackages/react-dom/component/web.d.ts +0 -11
  184. package/dist/types/src/SubPackages/react-dom/jsx/index.d.ts +0 -7
  185. package/dist/types/src/SubPackages/react-dom/jsx/node.d.ts +0 -6
  186. package/dist/types/src/SubPackages/react-dom/jsx/web.d.ts +0 -5
  187. package/dist/types/src/SubPackages/react-test-renderer/MemoExoticComponent/node.d.ts +0 -5
  188. package/dist/types/src/SubPackages/react-test-renderer/component/index.d.ts +0 -13
  189. package/dist/types/src/SubPackages/react-test-renderer/component/interface.d.ts +0 -9
  190. package/dist/types/src/SubPackages/react-test-renderer/component/node.d.ts +0 -8
  191. package/dist/types/src/SubPackages/react-test-renderer/component/web.d.ts +0 -3
  192. package/dist/types/src/SubPackages/react-test-renderer/fc/node.d.ts +0 -8
  193. package/dist/types/src/SubPackages/react-test-renderer/fc/web.d.ts +0 -8
  194. package/dist/types/src/SubPackages/react-test-renderer/jsx/index.d.ts +0 -17
  195. package/dist/types/src/SubPackages/react-test-renderer/jsx/node.d.ts +0 -9
  196. package/dist/types/src/SubPackages/react-test-renderer/jsx/web.d.ts +0 -8
  197. package/dist/types/src/SubPackages/react-test-renderer/jsx-promised/index.d.ts +0 -16
  198. package/dist/types/src/SubPackages/react-test-renderer/jsx-promised/node.d.ts +0 -4
  199. package/dist/types/src/SubPackages/react-test-renderer/jsx-promised/web.d.ts +0 -4
  200. package/dist/types/src/Types.d.ts +0 -90
  201. package/dist/types/src/Web.d.ts +0 -10
  202. package/dist/types/src/cli.d.ts +0 -1
  203. package/dist/types/src/cli2.d.ts +0 -1
  204. package/dist/types/src/defaultConfig.d.ts +0 -3
  205. package/dist/types/src/esbuildConfigs/featuresPlugin.d.ts +0 -5
  206. package/dist/types/src/esbuildConfigs/index.d.ts +0 -4
  207. package/dist/types/src/esbuildConfigs/inputFilesPlugin.d.ts +0 -7
  208. package/dist/types/src/esbuildConfigs/node.d.ts +0 -4
  209. package/dist/types/src/esbuildConfigs/web.d.ts +0 -4
  210. package/dist/types/src/init-docs.d.ts +0 -1
  211. package/dist/types/src/lib/abstractBase.d.ts +0 -110
  212. package/dist/types/src/lib/basebuilder.d.ts +0 -27
  213. package/dist/types/src/lib/classBuilder.d.ts +0 -7
  214. package/dist/types/src/lib/core.d.ts +0 -8
  215. package/dist/types/src/lib/index.d.ts +0 -60
  216. package/dist/types/src/lib/types.d.ts +0 -40
  217. package/dist/types/src/puppeteerConfiger.d.ts +0 -4
  218. package/dist/types/src/utils.d.ts +0 -2
  219. package/dist/types/src/web.html.d.ts +0 -2
  220. package/dist/types/testeranto.d.ts +0 -16
  221. package/dist/types/tsconfig.types.tsbuildinfo +0 -1
  222. package/docker-compose.yml +0 -37
  223. package/src/SubPackages/puppeteer.ts +0 -51
  224. package/src/cli.ts +0 -535
  225. package/src/cli2.ts +0 -157
  226. package/testeranto.ts +0 -13
@@ -1,439 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
- var __importDefault = (this && this.__importDefault) || function (mod) {
26
- return (mod && mod.__esModule) ? mod : { "default": mod };
27
- };
28
- Object.defineProperty(exports, "__esModule", { value: true });
29
- const child_process_1 = require("child_process");
30
- const fs_1 = __importDefault(require("fs"));
31
- const path_1 = __importDefault(require("path"));
32
- const readline_1 = __importDefault(require("readline"));
33
- const glob_1 = require("glob");
34
- const debounce_watch_1 = require("@bscotch/debounce-watch");
35
- const esbuild_1 = __importDefault(require("esbuild"));
36
- const node_js_1 = __importDefault(require("./esbuildConfigs/node.js"));
37
- const web_js_1 = __importDefault(require("./esbuildConfigs/web.js"));
38
- const web_html_js_1 = __importDefault(require("./web.html.js"));
39
- const main_js_1 = require("./PM/main.js");
40
- readline_1.default.emitKeypressEvents(process.stdin);
41
- if (process.stdin.isTTY)
42
- process.stdin.setRawMode(true);
43
- function parseTsErrors(logContent) {
44
- fs_1.default.writeFileSync("docs/types/log.txt", logContent.join("\n"));
45
- try {
46
- const regex = /(^src(.*?))\(\d*,\d*\): error/gm;
47
- const brokenFilesToLines = {};
48
- for (let i = 0; i < logContent.length - 1; i++) {
49
- let m;
50
- while ((m = regex.exec(logContent[i])) !== null) {
51
- // This is necessary to avoid infinite loops with zero-width matches
52
- if (m.index === regex.lastIndex) {
53
- regex.lastIndex++;
54
- }
55
- if (!brokenFilesToLines[m[1]]) {
56
- brokenFilesToLines[m[1]] = new Set();
57
- }
58
- brokenFilesToLines[m[1]].add(i);
59
- }
60
- }
61
- const final = Object.keys(brokenFilesToLines).reduce((mm, lm, ndx) => {
62
- mm[lm] = Array.from(brokenFilesToLines[lm]).map((l, ndx3) => {
63
- const a = Array.from(brokenFilesToLines[lm]);
64
- return Object.keys(a).reduce((mm2, lm2, ndx2) => {
65
- const acc = [];
66
- let j = a[lm2] + 1;
67
- let working = true;
68
- while (j < logContent.length - 1 && working) {
69
- if (!logContent[j].match(regex) &&
70
- working &&
71
- !logContent[j].match(/^..\/(.*?)\(\d*,\d*\)/)) {
72
- acc.push(logContent[j]);
73
- }
74
- else {
75
- working = false;
76
- }
77
- j++;
78
- }
79
- mm2[lm] = [logContent[l], ...acc];
80
- return mm2;
81
- }, {})[lm];
82
- });
83
- return mm;
84
- }, {});
85
- Object.keys(final).forEach((k) => {
86
- fs_1.default.mkdirSync(`./docs/types/${k.split("/").slice(0, -1).join("/")}`, {
87
- recursive: true,
88
- });
89
- fs_1.default.writeFileSync(`./docs/types/${k}.type_errors.txt`, final[k].flat().flat().join("\r\n"));
90
- });
91
- }
92
- catch (error) {
93
- console.error("Error reading or parsing the log file:", error);
94
- process.exit(1);
95
- }
96
- }
97
- function parseLintErrors(logContent) {
98
- fs_1.default.writeFileSync("docs/eslint/log.txt", logContent.join("\n"));
99
- try {
100
- const regex = new RegExp(`^${process.cwd()}/(.*?)`, "gm");
101
- const brokenFilesToLines = {};
102
- for (let i = 0; i < logContent.length - 1; i++) {
103
- let m;
104
- while ((m = regex.exec(logContent[i])) !== null) {
105
- // This is necessary to avoid infinite loops with zero-width matches
106
- if (m.index === regex.lastIndex) {
107
- regex.lastIndex++;
108
- }
109
- if (!brokenFilesToLines[m[1]]) {
110
- brokenFilesToLines[m[1]] = new Set();
111
- }
112
- brokenFilesToLines[m[1]].add(i);
113
- }
114
- }
115
- const final = Object.keys(brokenFilesToLines).reduce((mm, lm, ndx) => {
116
- mm[lm] = Array.from(brokenFilesToLines[lm]).map((l, ndx3) => {
117
- const a = Array.from(brokenFilesToLines[lm]);
118
- return Object.keys(a).reduce((mm2, lm2, ndx2) => {
119
- const acc = [];
120
- let j = a[lm2] + 1;
121
- let working = true;
122
- while (j < logContent.length - 1 && working) {
123
- if (!logContent[j].match(regex) &&
124
- working
125
- // &&
126
- // !logContent[j].match(/^..\/(.*?)\(\d*,\d*\)/)
127
- ) {
128
- acc.push(logContent[j]);
129
- }
130
- else {
131
- working = false;
132
- }
133
- j++;
134
- }
135
- mm2[lm] = [logContent[l], ...acc];
136
- return mm2;
137
- }, {})[lm];
138
- });
139
- return mm;
140
- }, {});
141
- Object.keys(final).forEach((k) => {
142
- fs_1.default.mkdirSync(`./docs/eslint/${k.split("/").slice(0, -1).join("/")}`, {
143
- recursive: true,
144
- });
145
- fs_1.default.writeFileSync(`./docs/eslint/${k}.lint_errors.txt`, final[k].flat().flat().join("\r\n"));
146
- });
147
- }
148
- catch (error) {
149
- console.error("Error reading or parsing the log file:", error);
150
- process.exit(1);
151
- }
152
- }
153
- const typecheck = () => {
154
- const logContent = [];
155
- fs_1.default.rmSync("docs/types", { force: true, recursive: true });
156
- fs_1.default.mkdirSync("docs/types");
157
- const tsc = (0, child_process_1.spawn)("tsc", ["-noEmit"]);
158
- tsc.stdout.on("data", (data) => {
159
- const lines = data.toString().split("\n");
160
- logContent.push(...lines);
161
- });
162
- tsc.stderr.on("data", (data) => {
163
- console.error(`stderr: ${data}`);
164
- process.exit(-1);
165
- });
166
- tsc.on("close", (code) => {
167
- parseTsErrors(logContent);
168
- });
169
- };
170
- const eslint = () => {
171
- const logContent = [];
172
- fs_1.default.rmSync("docs/eslint", { force: true, recursive: true });
173
- fs_1.default.mkdirSync("docs/eslint");
174
- const tsc = (0, child_process_1.spawn)("eslint", ["./src"]);
175
- tsc.stdout.on("data", (data) => {
176
- const lines = data.toString().split("\n");
177
- logContent.push(...lines);
178
- });
179
- tsc.stderr.on("data", (data) => {
180
- console.error(`stderr: ${data}`);
181
- process.exit(-1);
182
- });
183
- tsc.on("close", (code) => {
184
- parseLintErrors(logContent);
185
- });
186
- };
187
- const getRunnables = (tests, payload = {
188
- nodeEntryPoints: {},
189
- webEntryPoints: {},
190
- }) => {
191
- return tests.reduce((pt, cv, cndx, cry) => {
192
- if (cv[1] === "node") {
193
- pt.nodeEntryPoints[cv[0]] = path_1.default.resolve(`./docs/node/${cv[0].split(".").slice(0, -1).concat("mjs").join(".")}`);
194
- }
195
- else if (cv[1] === "web") {
196
- pt.webEntryPoints[cv[0]] = path_1.default.resolve(`./docs/web/${cv[0].split(".").slice(0, -1).concat("mjs").join(".")}`);
197
- }
198
- if (cv[3].length) {
199
- getRunnables(cv[3], payload);
200
- }
201
- return pt;
202
- }, payload);
203
- };
204
- Promise.resolve().then(() => __importStar(require(process.cwd() + "/" + process.argv[2]))).then(async (module) => {
205
- const rawConfig = module.default;
206
- const getSecondaryEndpointsPoints = (runtime) => {
207
- const meta = (ts, st) => {
208
- ts.forEach((t) => {
209
- if (t[1] === runtime) {
210
- st.add(t[0]);
211
- }
212
- if (Array.isArray(t[3])) {
213
- meta(t[3], st);
214
- }
215
- });
216
- return st;
217
- };
218
- return Array.from(meta(config.tests, new Set()));
219
- };
220
- const config = Object.assign(Object.assign({}, rawConfig), { buildDir: process.cwd() + "/" + rawConfig.outdir });
221
- let nodeDone = false;
222
- let webDone = false;
223
- let mode = config.devMode ? "DEV" : "PROD";
224
- let status = "build";
225
- let pm = new main_js_1.PM_Main(config);
226
- const fileHashes = {};
227
- const { nodeEntryPoints, webEntryPoints } = getRunnables(config.tests);
228
- const onNodeDone = () => {
229
- nodeDone = true;
230
- onDone();
231
- };
232
- const onWebDone = () => {
233
- webDone = true;
234
- onDone();
235
- };
236
- // async function fileHash(filePath, algorithm = "md5") {
237
- // return new Promise((resolve, reject) => {
238
- // const hash = crypto.createHash(algorithm);
239
- // const fileStream = fs.createReadStream(filePath);
240
- // fileStream.on("data", (data) => {
241
- // hash.update(data);
242
- // });
243
- // fileStream.on("end", () => {
244
- // const fileHash = hash.digest("hex");
245
- // resolve(fileHash);
246
- // });
247
- // fileStream.on("error", (error) => {
248
- // reject(`Error reading file: ${error.message}`);
249
- // });
250
- // });
251
- // }
252
- const onDone = async () => {
253
- if (nodeDone && webDone) {
254
- status = "built";
255
- }
256
- if (nodeDone && webDone && status === "built") {
257
- // Object.entries(nodeEntryPoints).forEach(([k, outputFile]) => {
258
- // console.log("watching", outputFile);
259
- // try {
260
- // watch(outputFile, async (filename) => {
261
- // const hash = await fileHash(outputFile);
262
- // if (fileHashes[k] !== hash) {
263
- // fileHashes[k] = hash;
264
- // console.log(`< ${filename} `);
265
- // pm.launchNode(k, outputFile);
266
- // }
267
- // });
268
- // } catch (e) {
269
- // console.error(e);
270
- // }
271
- // });
272
- // Object.entries(webEntryPoints).forEach(([k, outputFile]) => {
273
- // console.log("watching", outputFile);
274
- // watch(outputFile, async (filename) => {
275
- // const hash = await fileHash(outputFile);
276
- // console.log(`< ${filename} ${hash}`);
277
- // if (fileHashes[k] !== hash) {
278
- // fileHashes[k] = hash;
279
- // pm.launchWeb(k, outputFile);
280
- // }
281
- // });
282
- // });
283
- }
284
- if (nodeDone && webDone && mode === "PROD") {
285
- console.log("Testeranto-EsBuild is all done. Goodbye!");
286
- process.exit();
287
- }
288
- else {
289
- if (mode === "PROD") {
290
- console.log("waiting for tests to finish");
291
- console.log(JSON.stringify({
292
- nodeDone: nodeDone,
293
- webDone: webDone,
294
- mode: mode,
295
- }, null, 2));
296
- }
297
- else {
298
- console.log("waiting for tests to change");
299
- }
300
- console.log("press 'q' to quit");
301
- if (config.devMode) {
302
- console.log("ready and watching for changes...");
303
- }
304
- else {
305
- pm.shutDown();
306
- }
307
- ////////////////////////////////////////////////////////////////////////////////
308
- }
309
- };
310
- console.log(`Press 'q' to shutdown gracefully. Press 'x' to shutdown forcefully.`);
311
- process.stdin.on("keypress", (str, key) => {
312
- if (key.name === "q") {
313
- console.log("Testeranto-EsBuild is shutting down...");
314
- mode = "PROD";
315
- onDone();
316
- }
317
- });
318
- // const eslint = new ESLint();
319
- // const configEslint = await eslint.calculateConfigForFile(
320
- // "./src/eslint.config.mjs"
321
- // );
322
- // // console.log(`configEslint`, configEslint);
323
- // fs.watch("src", { recursive: true }, async (eventType, filename) => {
324
- // if (eventType === "change") {
325
- // console.log(`File ${filename} has been modified.`);
326
- // const x = await eslint.lintFiles([`./src/${filename}`]);
327
- // console.log(x[0].messages);
328
- // } else if (eventType === "rename") {
329
- // console.log(`File ${filename} has been created or deleted.`);
330
- // }
331
- // });
332
- fs_1.default.writeFileSync(`${config.outdir}/testeranto.json`, JSON.stringify(config, null, 2));
333
- Promise.resolve(Promise.all([...getSecondaryEndpointsPoints("web")].map(async (sourceFilePath) => {
334
- const sourceFileSplit = sourceFilePath.split("/");
335
- const sourceDir = sourceFileSplit.slice(0, -1);
336
- const sourceFileName = sourceFileSplit[sourceFileSplit.length - 1];
337
- const sourceFileNameMinusJs = sourceFileName
338
- .split(".")
339
- .slice(0, -1)
340
- .join(".");
341
- const htmlFilePath = path_1.default.normalize(`${process.cwd()}/${config.outdir}/web/${sourceDir.join("/")}/${sourceFileNameMinusJs}.html`);
342
- const jsfilePath = `./${sourceFileNameMinusJs}.mjs`;
343
- return fs_1.default.promises
344
- .mkdir(path_1.default.dirname(htmlFilePath), { recursive: true })
345
- .then((x) => fs_1.default.writeFileSync(htmlFilePath, (0, web_html_js_1.default)(jsfilePath, htmlFilePath)));
346
- })));
347
- (0, glob_1.glob)(`./${config.outdir}/chunk-*.mjs`, {
348
- ignore: "node_modules/**",
349
- }).then((chunks) => {
350
- chunks.forEach((chunk) => {
351
- fs_1.default.unlinkSync(chunk);
352
- });
353
- });
354
- // const processDebouncedEvents: DebouncedEventsProcessor = (events) => {
355
- // typecheck();
356
- // };
357
- (0, debounce_watch_1.debounceWatch)((events) => {
358
- typecheck();
359
- eslint();
360
- }, "./src", {
361
- onlyFileExtensions: ["ts", "tsx", "mts"],
362
- debounceWaitSeconds: 0.2,
363
- allowOverlappingRuns: false,
364
- });
365
- await pm.startPuppeteer({
366
- slowMo: 1,
367
- // timeout: 1,
368
- waitForInitialPage: false,
369
- executablePath:
370
- // process.env.CHROMIUM_PATH || "/opt/homebrew/bin/chromium",
371
- "/opt/homebrew/bin/chromium",
372
- headless: true,
373
- dumpio: true,
374
- // timeout: 0,
375
- devtools: true,
376
- args: [
377
- "--auto-open-devtools-for-tabs",
378
- `--remote-debugging-port=3234`,
379
- // "--disable-features=IsolateOrigins,site-per-process",
380
- "--disable-site-isolation-trials",
381
- "--allow-insecure-localhost",
382
- "--allow-file-access-from-files",
383
- "--allow-running-insecure-content",
384
- "--disable-dev-shm-usage",
385
- "--disable-extensions",
386
- "--disable-gpu",
387
- "--disable-setuid-sandbox",
388
- "--disable-site-isolation-trials",
389
- "--disable-web-security",
390
- "--no-first-run",
391
- "--no-sandbox",
392
- "--no-startup-window",
393
- // "--no-zygote",
394
- "--reduce-security-for-testing",
395
- "--remote-allow-origins=*",
396
- "--unsafely-treat-insecure-origin-as-secure=*",
397
- // "--disable-features=IsolateOrigins",
398
- // "--remote-allow-origins=ws://localhost:3234",
399
- // "--single-process",
400
- // "--unsafely-treat-insecure-origin-as-secure",
401
- // "--unsafely-treat-insecure-origin-as-secure=ws://192.168.0.101:3234",
402
- // "--disk-cache-dir=/dev/null",
403
- // "--disk-cache-size=1",
404
- // "--start-maximized",
405
- ],
406
- }, ".");
407
- await Promise.all([
408
- esbuild_1.default
409
- .context((0, node_js_1.default)(config, Object.keys(nodeEntryPoints)))
410
- .then(async (nodeContext) => {
411
- if (config.devMode) {
412
- await nodeContext.watch().then((v) => {
413
- onNodeDone();
414
- });
415
- }
416
- else {
417
- nodeContext.rebuild().then((v) => {
418
- onNodeDone();
419
- });
420
- }
421
- return nodeContext;
422
- }),
423
- esbuild_1.default
424
- .context((0, web_js_1.default)(config, Object.keys(webEntryPoints)))
425
- .then(async (webContext) => {
426
- if (config.devMode) {
427
- await webContext.watch().then((v) => {
428
- onWebDone();
429
- });
430
- }
431
- else {
432
- webContext.rebuild().then((v) => {
433
- onWebDone();
434
- });
435
- }
436
- return webContext;
437
- }),
438
- ]);
439
- });
@@ -1,144 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
- var __importDefault = (this && this.__importDefault) || function (mod) {
26
- return (mod && mod.__esModule) ? mod : { "default": mod };
27
- };
28
- Object.defineProperty(exports, "__esModule", { value: true });
29
- const fs_1 = require("fs");
30
- const main_1 = require("./PM/main");
31
- const path_1 = __importDefault(require("path"));
32
- const node_crypto_1 = __importDefault(require("node:crypto"));
33
- const fs_2 = __importDefault(require("fs"));
34
- const fileHashes = {};
35
- async function fileHash(filePath, algorithm = "md5") {
36
- return new Promise((resolve, reject) => {
37
- const hash = node_crypto_1.default.createHash(algorithm);
38
- const fileStream = fs_2.default.createReadStream(filePath);
39
- fileStream.on("data", (data) => {
40
- hash.update(data);
41
- });
42
- fileStream.on("end", () => {
43
- const fileHash = hash.digest("hex");
44
- resolve(fileHash);
45
- });
46
- fileStream.on("error", (error) => {
47
- reject(`Error reading file: ${error.message}`);
48
- });
49
- });
50
- }
51
- const getRunnables = (tests, payload = {
52
- nodeEntryPoints: {},
53
- webEntryPoints: {},
54
- }) => {
55
- return tests.reduce((pt, cv, cndx, cry) => {
56
- if (cv[1] === "node") {
57
- pt.nodeEntryPoints[cv[0]] = path_1.default.resolve(`./docs/node/${cv[0].split(".").slice(0, -1).concat("mjs").join(".")}`);
58
- }
59
- else if (cv[1] === "web") {
60
- pt.webEntryPoints[cv[0]] = path_1.default.resolve(`./docs/web/${cv[0].split(".").slice(0, -1).concat("mjs").join(".")}`);
61
- }
62
- if (cv[3].length) {
63
- getRunnables(cv[3], payload);
64
- }
65
- return pt;
66
- }, payload);
67
- };
68
- Promise.resolve().then(() => __importStar(require(process.cwd() + "/" + process.argv[2]))).then(async (module) => {
69
- const rawConfig = module.default;
70
- const config = Object.assign(Object.assign({}, rawConfig), { buildDir: process.cwd() + "/" + rawConfig.outdir });
71
- let pm = new main_1.PM_Main(config);
72
- await pm.startPuppeteer({
73
- slowMo: 1,
74
- // timeout: 1,
75
- waitForInitialPage: false,
76
- executablePath:
77
- // process.env.CHROMIUM_PATH || "/opt/homebrew/bin/chromium",
78
- "/opt/homebrew/bin/chromium",
79
- headless: true,
80
- dumpio: true,
81
- // timeout: 0,
82
- devtools: true,
83
- args: [
84
- "--auto-open-devtools-for-tabs",
85
- `--remote-debugging-port=3234`,
86
- // "--disable-features=IsolateOrigins,site-per-process",
87
- "--disable-site-isolation-trials",
88
- "--allow-insecure-localhost",
89
- "--allow-file-access-from-files",
90
- "--allow-running-insecure-content",
91
- "--disable-dev-shm-usage",
92
- "--disable-extensions",
93
- "--disable-gpu",
94
- "--disable-setuid-sandbox",
95
- "--disable-site-isolation-trials",
96
- "--disable-web-security",
97
- "--no-first-run",
98
- "--no-sandbox",
99
- "--no-startup-window",
100
- // "--no-zygote",
101
- "--reduce-security-for-testing",
102
- "--remote-allow-origins=*",
103
- "--unsafely-treat-insecure-origin-as-secure=*",
104
- // "--disable-features=IsolateOrigins",
105
- // "--remote-allow-origins=ws://localhost:3234",
106
- // "--single-process",
107
- // "--unsafely-treat-insecure-origin-as-secure",
108
- // "--unsafely-treat-insecure-origin-as-secure=ws://192.168.0.101:3234",
109
- // "--disk-cache-dir=/dev/null",
110
- // "--disk-cache-size=1",
111
- // "--start-maximized",
112
- ],
113
- }, ".");
114
- const { nodeEntryPoints, webEntryPoints } = getRunnables(config.tests);
115
- Object.entries(nodeEntryPoints).forEach(([k, outputFile]) => {
116
- console.log("watching and running", outputFile);
117
- pm.launchNode(k, outputFile);
118
- try {
119
- (0, fs_1.watch)(outputFile, async (e, filename) => {
120
- const hash = await fileHash(outputFile);
121
- if (fileHashes[k] !== hash) {
122
- fileHashes[k] = hash;
123
- console.log(`< ${e} ${filename} ${hash}`);
124
- pm.launchNode(k, outputFile);
125
- }
126
- });
127
- }
128
- catch (e) {
129
- console.error(e);
130
- }
131
- });
132
- Object.entries(webEntryPoints).forEach(([k, outputFile]) => {
133
- console.log("watching and running", outputFile);
134
- pm.launchWeb(k, outputFile);
135
- (0, fs_1.watch)(outputFile, async (e, filename) => {
136
- const hash = await fileHash(outputFile);
137
- console.log(`< ${e} ${filename} ${hash}`);
138
- if (fileHashes[k] !== hash) {
139
- fileHashes[k] = hash;
140
- pm.launchWeb(k, outputFile);
141
- }
142
- });
143
- });
144
- });
@@ -1,19 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const config = {
4
- outdir: "docs",
5
- tests: [],
6
- debugger: true,
7
- clearScreen: false,
8
- devMode: true,
9
- minify: false,
10
- outbase: ".",
11
- ports: ["3001"],
12
- externals: [],
13
- nodePlugins: [],
14
- webPlugins: [],
15
- featureIngestor: function (s) {
16
- throw new Error("Function not implemented.");
17
- },
18
- };
19
- exports.default = config;
@@ -1,39 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- const path_1 = __importDefault(require("path"));
7
- exports.default = {
8
- name: "feature-markdown",
9
- setup(build) {
10
- build.onResolve({ filter: /\.md$/ }, (args) => {
11
- if (args.resolveDir === "")
12
- return;
13
- return {
14
- path: path_1.default.isAbsolute(args.path)
15
- ? args.path
16
- : path_1.default.join(args.resolveDir, args.path),
17
- namespace: "feature-markdown",
18
- };
19
- });
20
- build.onLoad({ filter: /.*/, namespace: "feature-markdown" }, async (args) => {
21
- // const markdownContent = new TextDecoder().decode(
22
- // await fs.readFileSync(args.path)
23
- // );
24
- // markdownHTML = marked(markdownContent, options?.markedOptions);
25
- return {
26
- contents: `file://${args.path}`,
27
- loader: "text",
28
- // contents: JSON.stringify({ path: args.path }),
29
- // loader: "json",
30
- // contents: JSON.stringify({
31
- // // html: markdownHTML,
32
- // raw: markdownContent,
33
- // filename: args.path, //path.basename(args.path),
34
- // }),
35
- // loader: "json",
36
- };
37
- });
38
- },
39
- };
@@ -1,21 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.default = (config) => {
4
- return {
5
- // packages: "external",
6
- target: "esnext",
7
- format: "esm",
8
- splitting: true,
9
- outExtension: { ".js": ".mjs" },
10
- outbase: config.outbase,
11
- jsx: "transform",
12
- bundle: true,
13
- minify: config.minify === true,
14
- write: true,
15
- loader: {
16
- ".js": "jsx",
17
- ".png": "binary",
18
- ".jpg": "binary",
19
- },
20
- };
21
- };