testeranto 0.81.3 → 0.84.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 (71) hide show
  1. package/dist/common/src/Node.js +4 -2
  2. package/dist/common/src/PM/main.js +188 -61
  3. package/dist/common/src/PM/node.js +32 -7
  4. package/dist/common/src/PM/web.js +28 -54
  5. package/dist/common/src/Project.js +0 -3
  6. package/dist/common/src/Puppeteer.js +9 -51
  7. package/dist/common/src/SubPackages/react-dom/jsx/web.js +11 -11
  8. package/dist/common/src/Web.js +7 -1
  9. package/dist/common/src/esbuildConfigs/featuresPlugin.js +39 -0
  10. package/dist/common/src/esbuildConfigs/inputFilesPlugin.js +62 -64
  11. package/dist/common/src/esbuildConfigs/node.js +10 -3
  12. package/dist/common/src/esbuildConfigs/web.js +6 -2
  13. package/dist/common/src/lib/abstractBase.js +348 -337
  14. package/dist/common/src/lib/basebuilder.js +9 -4
  15. package/dist/common/src/lib/core.js +1 -1
  16. package/dist/common/tsconfig.common.tsbuildinfo +1 -1
  17. package/dist/module/src/Node.js +3 -3
  18. package/dist/module/src/PM/main.js +188 -61
  19. package/dist/module/src/PM/node.js +32 -7
  20. package/dist/module/src/PM/web.js +28 -51
  21. package/dist/module/src/Project.js +0 -3
  22. package/dist/module/src/Puppeteer.js +9 -51
  23. package/dist/module/src/SubPackages/react-dom/jsx/web.js +10 -10
  24. package/dist/module/src/Web.js +6 -2
  25. package/dist/module/src/esbuildConfigs/featuresPlugin.js +34 -0
  26. package/dist/module/src/esbuildConfigs/inputFilesPlugin.js +62 -64
  27. package/dist/module/src/esbuildConfigs/node.js +10 -3
  28. package/dist/module/src/esbuildConfigs/web.js +6 -2
  29. package/dist/module/src/lib/abstractBase.js +348 -337
  30. package/dist/module/src/lib/basebuilder.js +9 -4
  31. package/dist/module/src/lib/core.js +1 -1
  32. package/dist/module/tsconfig.module.tsbuildinfo +1 -1
  33. package/dist/prebuild/Puppeteer.mjs +82033 -0
  34. package/dist/types/src/Node.d.ts +5 -1
  35. package/dist/types/src/PM/index.d.ts +10 -4
  36. package/dist/types/src/PM/main.d.ts +21 -9
  37. package/dist/types/src/PM/node.d.ts +11 -3
  38. package/dist/types/src/PM/web.d.ts +11 -2
  39. package/dist/types/src/SubPackages/react-dom/jsx/index.d.ts +1 -0
  40. package/dist/types/src/SubPackages/react-test-renderer/jsx/index.d.ts +1 -0
  41. package/dist/types/src/SubPackages/react-test-renderer/jsx-promised/index.d.ts +1 -0
  42. package/dist/types/src/Types.d.ts +2 -2
  43. package/dist/types/src/Web.d.ts +5 -1
  44. package/dist/types/src/esbuildConfigs/featuresPlugin.d.ts +5 -0
  45. package/dist/types/src/esbuildConfigs/inputFilesPlugin.d.ts +4 -2
  46. package/dist/types/src/lib/abstractBase.d.ts +5 -4
  47. package/dist/types/src/lib/core.d.ts +1 -1
  48. package/dist/types/src/lib/index.d.ts +1 -0
  49. package/dist/types/src/lib/types.d.ts +7 -5
  50. package/dist/types/tsconfig.types.tsbuildinfo +1 -1
  51. package/package.json +18 -45
  52. package/pupBuild.js +18 -0
  53. package/src/Node.ts +3 -5
  54. package/src/PM/index.ts +12 -3
  55. package/src/PM/main.ts +306 -140
  56. package/src/PM/node.ts +40 -7
  57. package/src/PM/web.ts +108 -58
  58. package/src/Project.ts +0 -8
  59. package/src/Puppeteer.ts +11 -57
  60. package/src/SubPackages/react-dom/jsx/web.ts +15 -10
  61. package/src/Types.ts +5 -2
  62. package/src/Web.ts +6 -2
  63. package/src/esbuildConfigs/featuresPlugin.ts +43 -0
  64. package/src/esbuildConfigs/inputFilesPlugin.ts +97 -90
  65. package/src/esbuildConfigs/node.ts +18 -3
  66. package/src/esbuildConfigs/web.ts +14 -2
  67. package/src/lib/abstractBase.ts +388 -366
  68. package/src/lib/basebuilder.ts +9 -9
  69. package/src/lib/core.ts +4 -2
  70. package/src/lib/index.ts +1 -0
  71. package/src/lib/types.ts +14 -6
@@ -28,7 +28,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
28
28
  Object.defineProperty(exports, "__esModule", { value: true });
29
29
  const react_1 = __importStar(require("react"));
30
30
  const react_2 = require("react");
31
- const client_1 = __importDefault(require("react-dom/client"));
31
+ const react_dom_1 = __importDefault(require("react-dom"));
32
32
  const Web_js_1 = __importDefault(require("../../../Web.js"));
33
33
  const TesterantoComponent = ({ done, innerComp, }) => {
34
34
  const myContainer = (0, react_1.useRef)(null);
@@ -44,7 +44,7 @@ exports.default = (testImplementations, testSpecifications, testInput) => {
44
44
  return await new Promise((resolve, rej) => {
45
45
  const htmlElement = document.getElementById("root");
46
46
  if (htmlElement) {
47
- const domRoot = client_1.default.createRoot(htmlElement);
47
+ const domRoot = react_dom_1.default.createRoot(htmlElement);
48
48
  domRoot.render((0, react_2.createElement)(TesterantoComponent, {
49
49
  // ...initialProps,
50
50
  innerComp: reactElement,
@@ -84,17 +84,17 @@ exports.default = (testImplementations, testSpecifications, testInput) => {
84
84
  });
85
85
  },
86
86
  andWhen: function (s, whenCB, tr, utils) {
87
- return new Promise((resolve, rej) => {
88
- console.log("mark9", s, whenCB);
89
- resolve(whenCB(s, utils));
90
- // process.nextTick(() => {
91
- // resolve(whenCB()(s));
92
- // });
93
- });
87
+ return whenCB(s, utils);
88
+ // return new Promise(async (resolve, rej) => {
89
+ // // resolve(await whenCB(s, utils));
90
+ // // process.nextTick(() => {
91
+ // // resolve(whenCB()(s));
92
+ // // });
93
+ // });
94
94
  },
95
- butThen: async function (s, thenCB) {
95
+ butThen: async function (s, thenCB, tr, utils) {
96
96
  return new Promise((resolve, rej) => {
97
- resolve(thenCB(s));
97
+ resolve(thenCB(s, utils));
98
98
  });
99
99
  },
100
100
  afterEach: async function (store, ndx, artificer) {
@@ -3,6 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.WebTesteranto = void 0;
6
7
  const web_1 = require("./PM/web");
7
8
  const core_js_1 = __importDefault(require("./lib/core.js"));
8
9
  const index_js_1 = require("./lib/index.js");
@@ -13,8 +14,12 @@ class WebTesteranto extends core_js_1.default {
13
14
  async receiveTestResourceConfig(partialTestResource) {
14
15
  const t = partialTestResource; //JSON.parse(partialTestResource);
15
16
  const pm = new web_1.PM_Web(t);
16
- const { failed, artifacts, logPromise } = await this.testJobs[0].receiveTestResourceConfig(pm);
17
+ const { failed, artifacts, logPromise, features } = await this.testJobs[0].receiveTestResourceConfig(pm);
17
18
  pm.customclose();
19
+ return new Promise((res, rej) => {
20
+ res(features);
21
+ });
22
+ // return features;
18
23
  // Promise.all([...artifacts, logPromise]).then(async () => {
19
24
  // console.log("hello world");
20
25
  // pm.customclose();
@@ -34,6 +39,7 @@ class WebTesteranto extends core_js_1.default {
34
39
  // });
35
40
  }
36
41
  }
42
+ exports.WebTesteranto = WebTesteranto;
37
43
  exports.default = async (input, testSpecification, testImplementation, testInterface, testResourceRequirement = index_js_1.defaultTestResourceRequirement) => {
38
44
  return new WebTesteranto(input, testSpecification, testImplementation, testResourceRequirement, testInterface);
39
45
  };
@@ -0,0 +1,39 @@
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
+ };
@@ -5,75 +5,73 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const fs_1 = __importDefault(require("fs"));
7
7
  const path_1 = __importDefault(require("path"));
8
+ const otherInputs = {};
9
+ const register = (entrypoint, sources) => {
10
+ console.log("register", entrypoint, sources);
11
+ if (!otherInputs[entrypoint]) {
12
+ otherInputs[entrypoint] = new Set();
13
+ }
14
+ sources.forEach((s) => otherInputs[entrypoint].add(s));
15
+ };
16
+ function tree(meta, key) {
17
+ return [
18
+ key,
19
+ ...meta.inputs[key].imports
20
+ .filter((x) => x.external !== true)
21
+ .filter((x) => x.path.split("/")[0] !== "node_modules")
22
+ .map((f) => f.path),
23
+ ];
24
+ }
8
25
  exports.default = (platform, entryPoints) => {
9
26
  return {
10
- name: "metafileWriter",
11
- setup(build) {
12
- build.onEnd((result) => {
13
- if (result.errors.length === 0) {
14
- entryPoints.forEach((entryPoint) => {
15
- const filePath = path_1.default.join("./docs/", platform, entryPoint.split(".").slice(0, -1).join("."), `inputFiles.json`);
16
- const promptPath = path_1.default.join("./docs/", platform, entryPoint.split(".").slice(0, -1).join("."), `prompt.txt`);
17
- const testPaths = path_1.default.join("./docs/", platform, entryPoint.split(".").slice(0, -1).join("."), `tests.json`);
18
- const dirName = path_1.default.dirname(filePath);
19
- if (!fs_1.default.existsSync(dirName)) {
20
- fs_1.default.mkdirSync(dirName, { recursive: true });
21
- }
22
- const j = Object.keys(Object.keys(result.metafile.outputs)
23
- .filter((s) => {
24
- if (!result.metafile.outputs[s].entryPoint) {
25
- return false;
27
+ register,
28
+ inputFilesPluginFactory: {
29
+ name: "metafileWriter",
30
+ setup(build) {
31
+ build.onEnd((result) => {
32
+ fs_1.default.writeFileSync(`docs/${platform}/metafile.json`, JSON.stringify(result, null, 2));
33
+ if (result.errors.length === 0) {
34
+ entryPoints.forEach((entryPoint) => {
35
+ const filePath = path_1.default.join("./docs/", platform, entryPoint.split(".").slice(0, -1).join("."), `inputFiles.json`);
36
+ const dirName = path_1.default.dirname(filePath);
37
+ if (!fs_1.default.existsSync(dirName)) {
38
+ fs_1.default.mkdirSync(dirName, { recursive: true });
26
39
  }
27
- return (path_1.default.resolve(result.metafile.outputs[s].entryPoint) ===
28
- path_1.default.resolve(entryPoint));
29
- })
30
- .reduce((mm, el) => {
31
- mm.push(result.metafile.outputs[el].inputs);
32
- return mm;
33
- }, [])[0]).filter((f) => {
34
- const regex = /^src\/.*/g;
35
- const matches = f.match(regex);
36
- const passes = (matches === null || matches === void 0 ? void 0 : matches.length) === 1;
37
- return passes;
38
- });
39
- // .filter((f: string) => {
40
- // const regex = /.*\.test\..*/g;
41
- // const matches = f.match(regex);
42
- // const passes = matches?.length === 1;
43
- // return !passes;
44
- // })
45
- const jsonContent = JSON.stringify(j);
46
- fs_1.default.writeFileSync(filePath, jsonContent);
47
- fs_1.default.writeFileSync(promptPath, `
48
- ${j
49
- .map((x) => {
50
- return `/add ${x}`;
51
- })
52
- .join("\n")}
40
+ const promptPath = path_1.default.join("./docs/", platform, entryPoint.split(".").slice(0, -1).join("."), `prompt.txt`);
41
+ const testPaths = path_1.default.join("./docs/", platform, entryPoint.split(".").slice(0, -1).join("."), `tests.json`);
42
+ const featuresPath = path_1.default.join("./docs/", platform, entryPoint.split(".").slice(0, -1).join("."), `featurePrompt.txt`); // /read ${featuresPath}
43
+ if (result.metafile) {
44
+ const addableFiles = tree(result.metafile, entryPoint.split("/").slice(1).join("/"))
45
+ .map((y) => {
46
+ if (otherInputs[y]) {
47
+ return Array.from(otherInputs[y]);
48
+ }
49
+ return y;
50
+ })
51
+ .flat();
52
+ fs_1.default.writeFileSync(promptPath, `
53
+ ${[...addableFiles]
54
+ .map((x) => {
55
+ return `/add ${x}`;
56
+ })
57
+ .join("\n")}
58
+ ${[...addableFiles]
59
+ .map((x) => {
60
+ const f = `docs/ts/${x}.type_errors.txt`;
61
+ if (fs_1.default.existsSync(f)) {
62
+ return `/read ${f}`;
63
+ }
64
+ })
65
+ .join("\n")}
53
66
  /read ${testPaths}
54
-
55
- /code fix the failing tests described in ${filePath}.
67
+ /load ${featuresPath}
68
+ /code Fix the failing tests described in ${testPaths}. Correct any type signature errors. Implement any method which throws "Function not implemented."
56
69
  `);
57
- // fs.writeFileSync(
58
- // promptPath,
59
- // `
60
- // from aider.coders import Coder
61
- // from aider.models import Model
62
- // import os
63
- // model = Model("deepseek")
64
- // coder = Coder.create(main_model=model)
65
- // coder.run("/read-only", "${testPaths}")
66
- // ${j
67
- // .map((x) => {
68
- // return `coder.run("/add", "${x}")`;
69
- // })
70
- // .join("\n")}
71
- // coder.run("fix the failing tests described in ${filePath}.")
72
- // `
73
- // );
74
- });
75
- }
76
- });
70
+ }
71
+ });
72
+ }
73
+ });
74
+ },
77
75
  },
78
76
  };
79
77
  };
@@ -5,7 +5,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const index_js_1 = __importDefault(require("./index.js"));
7
7
  const inputFilesPlugin_js_1 = __importDefault(require("./inputFilesPlugin.js"));
8
+ const featuresPlugin_1 = __importDefault(require("./featuresPlugin"));
8
9
  exports.default = (config, entryPoints) => {
10
+ const { inputFilesPluginFactory, register } = (0, inputFilesPlugin_js_1.default)("node", entryPoints);
11
+ // const inputFilesPluginFactory = inputFilesPlugin("node", entryPoints);
12
+ // const register = (x) => x;
9
13
  return Object.assign(Object.assign({}, (0, index_js_1.default)(config)), { splitting: true, outdir: config.outdir + "/node",
10
14
  // inject: [`./node_modules/testeranto/dist/cjs-shim.js`],
11
15
  metafile: true, supported: {
@@ -17,13 +21,16 @@ exports.default = (config, entryPoints) => {
17
21
  }, platform: "node", external: [
18
22
  // "testeranto.json",
19
23
  // "features.test.js",
20
- // "react",
24
+ "react",
21
25
  // "events",
22
26
  // "ganache"
23
27
  ...config.externals,
24
28
  ], entryPoints: [...entryPoints], plugins: [
25
- ...(config.nodePlugins || []),
26
- (0, inputFilesPlugin_js_1.default)("node", entryPoints),
29
+ featuresPlugin_1.default,
30
+ // markdownPlugin({}),
31
+ ...(config.nodePlugins.map((p) => p(register, entryPoints)) || []),
32
+ inputFilesPluginFactory,
33
+ // inputFilesPlugin("node", entryPoints),
27
34
  {
28
35
  name: "rebuild-notify",
29
36
  setup(build) {
@@ -6,7 +6,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const path_1 = __importDefault(require("path"));
7
7
  const index_js_1 = __importDefault(require("./index.js"));
8
8
  const inputFilesPlugin_js_1 = __importDefault(require("./inputFilesPlugin.js"));
9
+ const featuresPlugin_js_1 = __importDefault(require("./featuresPlugin.js"));
9
10
  exports.default = (config, entryPoints) => {
11
+ const { inputFilesPluginFactory, register } = (0, inputFilesPlugin_js_1.default)("web", entryPoints);
10
12
  return Object.assign(Object.assign({}, (0, index_js_1.default)(config)), {
11
13
  // inject: ["./node_modules/testeranto/dist/cjs-shim.js"],
12
14
  // banner: {
@@ -38,8 +40,10 @@ exports.default = (config, entryPoints) => {
38
40
  "process",
39
41
  "dns",
40
42
  ], platform: "browser", entryPoints: [...entryPoints], plugins: [
41
- ...(config.webPlugins || []),
42
- (0, inputFilesPlugin_js_1.default)("web", entryPoints),
43
+ featuresPlugin_js_1.default,
44
+ // markdownPlugin({}),
45
+ ...(config.nodePlugins.map((p) => p(register, entryPoints)) || []),
46
+ inputFilesPluginFactory,
43
47
  {
44
48
  name: "rebuild-notify",
45
49
  setup(build) {