testeranto 0.82.0 → 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 (70) hide show
  1. package/dist/common/package.json +3 -0
  2. package/dist/common/src/Node.js +2 -0
  3. package/dist/common/src/PM/main.js +182 -79
  4. package/dist/common/src/PM/node.js +32 -6
  5. package/dist/common/src/PM/web.js +28 -54
  6. package/dist/common/src/Project.js +0 -3
  7. package/dist/common/src/Puppeteer.js +9 -51
  8. package/dist/common/src/SubPackages/react-dom/jsx/web.js +11 -11
  9. package/dist/common/src/Web.js +2 -0
  10. package/dist/common/src/esbuildConfigs/featuresPlugin.js +39 -0
  11. package/dist/common/src/esbuildConfigs/inputFilesPlugin.js +62 -41
  12. package/dist/common/src/esbuildConfigs/node.js +10 -3
  13. package/dist/common/src/esbuildConfigs/web.js +6 -2
  14. package/dist/common/src/lib/abstractBase.js +343 -335
  15. package/dist/common/src/lib/basebuilder.js +7 -3
  16. package/dist/common/src/lib/core.js +1 -1
  17. package/dist/common/tsconfig.common.tsbuildinfo +1 -1
  18. package/dist/module/package.json +3 -0
  19. package/dist/module/src/Node.js +1 -1
  20. package/dist/module/src/PM/main.js +182 -79
  21. package/dist/module/src/PM/node.js +32 -6
  22. package/dist/module/src/PM/web.js +28 -51
  23. package/dist/module/src/Project.js +0 -3
  24. package/dist/module/src/Puppeteer.js +9 -51
  25. package/dist/module/src/SubPackages/react-dom/jsx/web.js +10 -10
  26. package/dist/module/src/Web.js +1 -1
  27. package/dist/module/src/esbuildConfigs/featuresPlugin.js +34 -0
  28. package/dist/module/src/esbuildConfigs/inputFilesPlugin.js +62 -41
  29. package/dist/module/src/esbuildConfigs/node.js +10 -3
  30. package/dist/module/src/esbuildConfigs/web.js +6 -2
  31. package/dist/module/src/lib/abstractBase.js +343 -335
  32. package/dist/module/src/lib/basebuilder.js +7 -3
  33. package/dist/module/src/lib/core.js +1 -1
  34. package/dist/module/tsconfig.module.tsbuildinfo +1 -1
  35. package/dist/prebuild/Puppeteer.mjs +82033 -0
  36. package/dist/types/src/Node.d.ts +5 -1
  37. package/dist/types/src/PM/index.d.ts +10 -4
  38. package/dist/types/src/PM/main.d.ts +21 -9
  39. package/dist/types/src/PM/node.d.ts +11 -3
  40. package/dist/types/src/PM/web.d.ts +11 -2
  41. package/dist/types/src/SubPackages/react-dom/jsx/index.d.ts +1 -0
  42. package/dist/types/src/SubPackages/react-test-renderer/jsx/index.d.ts +1 -0
  43. package/dist/types/src/SubPackages/react-test-renderer/jsx-promised/index.d.ts +1 -0
  44. package/dist/types/src/Types.d.ts +2 -2
  45. package/dist/types/src/Web.d.ts +5 -1
  46. package/dist/types/src/esbuildConfigs/featuresPlugin.d.ts +5 -0
  47. package/dist/types/src/esbuildConfigs/inputFilesPlugin.d.ts +4 -2
  48. package/dist/types/src/lib/abstractBase.d.ts +5 -5
  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 -41
  52. package/pupBuild.js +18 -0
  53. package/src/Node.ts +1 -3
  54. package/src/PM/index.ts +12 -3
  55. package/src/PM/main.ts +300 -164
  56. package/src/PM/node.ts +40 -6
  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 +1 -1
  63. package/src/esbuildConfigs/featuresPlugin.ts +43 -0
  64. package/src/esbuildConfigs/inputFilesPlugin.ts +98 -66
  65. package/src/esbuildConfigs/node.ts +18 -3
  66. package/src/esbuildConfigs/web.ts +14 -2
  67. package/src/lib/abstractBase.ts +381 -364
  68. package/src/lib/basebuilder.ts +7 -7
  69. package/src/lib/core.ts +1 -1
  70. package/src/lib/types.ts +13 -5
@@ -1,6 +1,6 @@
1
1
  import React, { useEffect, useRef } from "react";
2
2
  import { createElement } from "react";
3
- import ReactDom from "react-dom/client";
3
+ import ReactDom from "react-dom";
4
4
  import Testeranto from "../../../Web.js";
5
5
  const TesterantoComponent = ({ done, innerComp, }) => {
6
6
  const myContainer = useRef(null);
@@ -56,17 +56,17 @@ export default (testImplementations, testSpecifications, testInput) => {
56
56
  });
57
57
  },
58
58
  andWhen: function (s, whenCB, tr, utils) {
59
- return new Promise((resolve, rej) => {
60
- console.log("mark9", s, whenCB);
61
- resolve(whenCB(s, utils));
62
- // process.nextTick(() => {
63
- // resolve(whenCB()(s));
64
- // });
65
- });
59
+ return whenCB(s, utils);
60
+ // return new Promise(async (resolve, rej) => {
61
+ // // resolve(await whenCB(s, utils));
62
+ // // process.nextTick(() => {
63
+ // // resolve(whenCB()(s));
64
+ // // });
65
+ // });
66
66
  },
67
- butThen: async function (s, thenCB) {
67
+ butThen: async function (s, thenCB, tr, utils) {
68
68
  return new Promise((resolve, rej) => {
69
- resolve(thenCB(s));
69
+ resolve(thenCB(s, utils));
70
70
  });
71
71
  },
72
72
  afterEach: async function (store, ndx, artificer) {
@@ -1,7 +1,7 @@
1
1
  import { PM_Web } from "./PM/web";
2
2
  import Testeranto from "./lib/core.js";
3
3
  import { defaultTestResourceRequirement, } from "./lib/index.js";
4
- class WebTesteranto extends Testeranto {
4
+ export class WebTesteranto extends Testeranto {
5
5
  constructor(input, testSpecification, testImplementation, testResourceRequirement, testInterface) {
6
6
  super(input, testSpecification, testImplementation, testResourceRequirement, testInterface);
7
7
  }
@@ -0,0 +1,34 @@
1
+ import path from "path";
2
+ export default {
3
+ name: "feature-markdown",
4
+ setup(build) {
5
+ build.onResolve({ filter: /\.md$/ }, (args) => {
6
+ if (args.resolveDir === "")
7
+ return;
8
+ return {
9
+ path: path.isAbsolute(args.path)
10
+ ? args.path
11
+ : path.join(args.resolveDir, args.path),
12
+ namespace: "feature-markdown",
13
+ };
14
+ });
15
+ build.onLoad({ filter: /.*/, namespace: "feature-markdown" }, async (args) => {
16
+ // const markdownContent = new TextDecoder().decode(
17
+ // await fs.readFileSync(args.path)
18
+ // );
19
+ // markdownHTML = marked(markdownContent, options?.markedOptions);
20
+ return {
21
+ contents: `file://${args.path}`,
22
+ loader: "text",
23
+ // contents: JSON.stringify({ path: args.path }),
24
+ // loader: "json",
25
+ // contents: JSON.stringify({
26
+ // // html: markdownHTML,
27
+ // raw: markdownContent,
28
+ // filename: args.path, //path.basename(args.path),
29
+ // }),
30
+ // loader: "json",
31
+ };
32
+ });
33
+ },
34
+ };
@@ -1,51 +1,72 @@
1
1
  import fs from "fs";
2
2
  import path from "path";
3
+ const otherInputs = {};
4
+ const register = (entrypoint, sources) => {
5
+ console.log("register", entrypoint, sources);
6
+ if (!otherInputs[entrypoint]) {
7
+ otherInputs[entrypoint] = new Set();
8
+ }
9
+ sources.forEach((s) => otherInputs[entrypoint].add(s));
10
+ };
11
+ function tree(meta, key) {
12
+ return [
13
+ key,
14
+ ...meta.inputs[key].imports
15
+ .filter((x) => x.external !== true)
16
+ .filter((x) => x.path.split("/")[0] !== "node_modules")
17
+ .map((f) => f.path),
18
+ ];
19
+ }
3
20
  export default (platform, entryPoints) => {
4
21
  return {
5
- name: "metafileWriter",
6
- setup(build) {
7
- build.onEnd((result) => {
8
- if (result.errors.length === 0) {
9
- entryPoints.forEach((entryPoint) => {
10
- const filePath = path.join("./docs/", platform, entryPoint.split(".").slice(0, -1).join("."), `inputFiles.json`);
11
- const promptPath = path.join("./docs/", platform, entryPoint.split(".").slice(0, -1).join("."), `prompt.txt`);
12
- const testPaths = path.join("./docs/", platform, entryPoint.split(".").slice(0, -1).join("."), `tests.json`);
13
- const featuresPath = path.join("./docs/", platform, entryPoint.split(".").slice(0, -1).join("."), `features.json`);
14
- const dirName = path.dirname(filePath);
15
- if (!fs.existsSync(dirName)) {
16
- fs.mkdirSync(dirName, { recursive: true });
17
- }
18
- const j = Object.keys(Object.keys(result.metafile.outputs)
19
- .filter((s) => {
20
- if (!result.metafile.outputs[s].entryPoint) {
21
- return false;
22
+ register,
23
+ inputFilesPluginFactory: {
24
+ name: "metafileWriter",
25
+ setup(build) {
26
+ build.onEnd((result) => {
27
+ fs.writeFileSync(`docs/${platform}/metafile.json`, JSON.stringify(result, null, 2));
28
+ if (result.errors.length === 0) {
29
+ entryPoints.forEach((entryPoint) => {
30
+ const filePath = path.join("./docs/", platform, entryPoint.split(".").slice(0, -1).join("."), `inputFiles.json`);
31
+ const dirName = path.dirname(filePath);
32
+ if (!fs.existsSync(dirName)) {
33
+ fs.mkdirSync(dirName, { recursive: true });
22
34
  }
23
- return (path.resolve(result.metafile.outputs[s].entryPoint) ===
24
- path.resolve(entryPoint));
25
- })
26
- .reduce((mm, el) => {
27
- mm.push(result.metafile.outputs[el].inputs);
28
- return mm;
29
- }, [])[0]).filter((f) => {
30
- const regex = /^src\/.*/g;
31
- const matches = f.match(regex);
32
- const passes = (matches === null || matches === void 0 ? void 0 : matches.length) === 1;
33
- return passes;
34
- });
35
- fs.writeFileSync(filePath, JSON.stringify(j));
36
- fs.writeFileSync(promptPath, `
37
- ${j
38
- .map((x) => {
39
- return `/add ${x}`;
40
- })
41
- .join("\n")}
35
+ const promptPath = path.join("./docs/", platform, entryPoint.split(".").slice(0, -1).join("."), `prompt.txt`);
36
+ const testPaths = path.join("./docs/", platform, entryPoint.split(".").slice(0, -1).join("."), `tests.json`);
37
+ const featuresPath = path.join("./docs/", platform, entryPoint.split(".").slice(0, -1).join("."), `featurePrompt.txt`); // /read ${featuresPath}
38
+ if (result.metafile) {
39
+ const addableFiles = tree(result.metafile, entryPoint.split("/").slice(1).join("/"))
40
+ .map((y) => {
41
+ if (otherInputs[y]) {
42
+ return Array.from(otherInputs[y]);
43
+ }
44
+ return y;
45
+ })
46
+ .flat();
47
+ fs.writeFileSync(promptPath, `
48
+ ${[...addableFiles]
49
+ .map((x) => {
50
+ return `/add ${x}`;
51
+ })
52
+ .join("\n")}
53
+ ${[...addableFiles]
54
+ .map((x) => {
55
+ const f = `docs/ts/${x}.type_errors.txt`;
56
+ if (fs.existsSync(f)) {
57
+ return `/read ${f}`;
58
+ }
59
+ })
60
+ .join("\n")}
42
61
  /read ${testPaths}
43
- /read ${featuresPath}
44
- /code fix the failing tests described in ${testPaths}.
62
+ /load ${featuresPath}
63
+ /code Fix the failing tests described in ${testPaths}. Correct any type signature errors. Implement any method which throws "Function not implemented."
45
64
  `);
46
- });
47
- }
48
- });
65
+ }
66
+ });
67
+ }
68
+ });
69
+ },
49
70
  },
50
71
  };
51
72
  };
@@ -1,6 +1,10 @@
1
1
  import baseEsBuildConfig from "./index.js";
2
2
  import inputFilesPlugin from "./inputFilesPlugin.js";
3
+ import featuresPlugin from "./featuresPlugin";
3
4
  export default (config, entryPoints) => {
5
+ const { inputFilesPluginFactory, register } = inputFilesPlugin("node", entryPoints);
6
+ // const inputFilesPluginFactory = inputFilesPlugin("node", entryPoints);
7
+ // const register = (x) => x;
4
8
  return Object.assign(Object.assign({}, baseEsBuildConfig(config)), { splitting: true, outdir: config.outdir + "/node",
5
9
  // inject: [`./node_modules/testeranto/dist/cjs-shim.js`],
6
10
  metafile: true, supported: {
@@ -12,13 +16,16 @@ export default (config, entryPoints) => {
12
16
  }, platform: "node", external: [
13
17
  // "testeranto.json",
14
18
  // "features.test.js",
15
- // "react",
19
+ "react",
16
20
  // "events",
17
21
  // "ganache"
18
22
  ...config.externals,
19
23
  ], entryPoints: [...entryPoints], plugins: [
20
- ...(config.nodePlugins || []),
21
- inputFilesPlugin("node", entryPoints),
24
+ featuresPlugin,
25
+ // markdownPlugin({}),
26
+ ...(config.nodePlugins.map((p) => p(register, entryPoints)) || []),
27
+ inputFilesPluginFactory,
28
+ // inputFilesPlugin("node", entryPoints),
22
29
  {
23
30
  name: "rebuild-notify",
24
31
  setup(build) {
@@ -1,7 +1,9 @@
1
1
  import path from "path";
2
2
  import baseEsBuildConfig from "./index.js";
3
3
  import inputFilesPlugin from "./inputFilesPlugin.js";
4
+ import featuresPlugin from "./featuresPlugin.js";
4
5
  export default (config, entryPoints) => {
6
+ const { inputFilesPluginFactory, register } = inputFilesPlugin("web", entryPoints);
5
7
  return Object.assign(Object.assign({}, baseEsBuildConfig(config)), {
6
8
  // inject: ["./node_modules/testeranto/dist/cjs-shim.js"],
7
9
  // banner: {
@@ -33,8 +35,10 @@ export default (config, entryPoints) => {
33
35
  "process",
34
36
  "dns",
35
37
  ], platform: "browser", entryPoints: [...entryPoints], plugins: [
36
- ...(config.webPlugins || []),
37
- inputFilesPlugin("web", entryPoints),
38
+ featuresPlugin,
39
+ // markdownPlugin({}),
40
+ ...(config.nodePlugins.map((p) => p(register, entryPoints)) || []),
41
+ inputFilesPluginFactory,
38
42
  {
39
43
  name: "rebuild-notify",
40
44
  setup(build) {