@gammatech/aijsx 0.1.0-beta.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.
@@ -0,0 +1,29 @@
1
+ import { u as AIComponent, A as AIElement, b as AIFragment } from './createElement-Q_LxUYf8.js';
2
+
3
+ /**
4
+ * The is used as an import source for ts/js files as the JSX transpile functinos
5
+ */
6
+
7
+ /** @hidden */
8
+ declare namespace JSX {
9
+ type ElementType = AIComponent<any>;
10
+ interface Element extends AIElement<any> {
11
+ }
12
+ interface IntrinsicElements {
13
+ }
14
+ interface ElementChildrenAttribute {
15
+ children: {};
16
+ }
17
+ }
18
+ /** @hidden */
19
+ declare function jsx(type: any, config: any, maybeKey?: any): AIElement<{
20
+ children: any[];
21
+ }>;
22
+ /** @hidden */
23
+ declare const jsxDEV: typeof jsx;
24
+ /** @hidden */
25
+ declare const jsxs: typeof jsx;
26
+ /** @hidden */
27
+ declare const Fragment: typeof AIFragment;
28
+
29
+ export { Fragment, JSX, jsx, jsxDEV, jsxs };
@@ -0,0 +1,63 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+
19
+ // src/jsx-runtime.ts
20
+ var jsx_runtime_exports = {};
21
+ __export(jsx_runtime_exports, {
22
+ Fragment: () => Fragment,
23
+ jsx: () => jsx,
24
+ jsxDEV: () => jsxDEV,
25
+ jsxs: () => jsxs
26
+ });
27
+ module.exports = __toCommonJS(jsx_runtime_exports);
28
+
29
+ // src/createElement.ts
30
+ function createAIElement(tag, props, ...children) {
31
+ const propsToPass = {
32
+ ...props ?? {},
33
+ ...children.length === 0 ? {} : { children: children.length === 1 ? children[0] : children }
34
+ };
35
+ const result = {
36
+ tag,
37
+ props: propsToPass,
38
+ render: (ctx) => {
39
+ return tag(propsToPass, ctx);
40
+ }
41
+ };
42
+ return result;
43
+ }
44
+ function AIFragment({ children }) {
45
+ return children;
46
+ }
47
+
48
+ // src/jsx-runtime.ts
49
+ function jsx(type, config, maybeKey) {
50
+ const configWithKey = maybeKey !== void 0 ? { ...config, key: maybeKey } : config;
51
+ const children = config && Array.isArray(config.children) ? config.children : [];
52
+ return createAIElement(type, configWithKey, ...children);
53
+ }
54
+ var jsxDEV = jsx;
55
+ var jsxs = jsx;
56
+ var Fragment = AIFragment;
57
+ // Annotate the CommonJS export names for ESM import in node:
58
+ 0 && (module.exports = {
59
+ Fragment,
60
+ jsx,
61
+ jsxDEV,
62
+ jsxs
63
+ });
package/package.json ADDED
@@ -0,0 +1,75 @@
1
+ {
2
+ "name": "@gammatech/aijsx",
3
+ "version": "0.1.0-beta.1",
4
+ "description": "Rewrite of aijsx",
5
+ "private": false,
6
+ "author": "Jordan Garcia",
7
+ "license": "MIT",
8
+ "main": "./dist/index.js",
9
+ "types": "./dist/index.d.ts",
10
+ "scripts": {
11
+ "dev": "ts-node ./src/test.tsx",
12
+ "test": "jest --verbose",
13
+ "test:watch": "jest --watch --verbose",
14
+ "build": "yarn check-types && yarn clean-symlinks && tsup && yarn symlink",
15
+ "clean-symlinks": "rm ./jsx-runtime* || true",
16
+ "symlink": "ln -s ./dist/jsx-runtime.js . && ln -s ./dist/jsx-runtime.d.ts",
17
+ "prepublishOnly": "yarn build",
18
+ "lint": "eslint \"{src,test}/**/*.ts\" && yarn check-types",
19
+ "check-types": "tsc --skipLibCheck --noEmit"
20
+ },
21
+ "dependencies": {
22
+ "@anthropic-ai/sdk": "^0.12.0",
23
+ "@anthropic-ai/tokenizer": "^0.0.4",
24
+ "js-tiktoken": "^1.0.8",
25
+ "nanoid": "^3.1.23",
26
+ "openai": "^4.23.0"
27
+ },
28
+ "devDependencies": {
29
+ "@tsconfig/node18": "^18.2.2",
30
+ "@types/jest": "^29.0.0",
31
+ "@types/node": "^16.0.0",
32
+ "@typescript-eslint/eslint-plugin": "^6.9.1",
33
+ "@typescript-eslint/parser": "^6.9.1",
34
+ "eslint": "^8.41.0",
35
+ "eslint-config-prettier": "^8.8.0",
36
+ "eslint-import-resolver-typescript": "^3.5.5",
37
+ "eslint-plugin-import": "^2.27.5",
38
+ "eslint-plugin-jsx-a11y": "^6.4.1",
39
+ "eslint-plugin-no-only-tests": "^2.6.0",
40
+ "eslint-plugin-prettier": "^4.2.1",
41
+ "eslint-plugin-react": "^7.24.0",
42
+ "eslint-plugin-react-hooks": "^4.2.0",
43
+ "jest": "^29.7.0",
44
+ "prettier": "^2.2.1",
45
+ "tinybench": "^2.5.1",
46
+ "ts-jest": "^29.1.1",
47
+ "ts-node": "^10.9.2",
48
+ "tsup": "^8.0.1",
49
+ "typescript": "^5.2.2"
50
+ },
51
+ "files": [
52
+ "dist",
53
+ "README.md",
54
+ "LICENSE"
55
+ ],
56
+ "jest": {
57
+ "moduleFileExtensions": [
58
+ "js",
59
+ "ts",
60
+ "tsx"
61
+ ],
62
+ "rootDir": ".",
63
+ "testRegex": "test/.*\\.spec\\.tsx?$",
64
+ "transform": {
65
+ "^.+\\.(t|j)sx?$": "ts-jest"
66
+ },
67
+ "moduleNameMapper": {
68
+ "@gammatech/aijsx/jsx-runtime": [
69
+ "<rootDir>/src/jsx-runtime.ts"
70
+ ]
71
+ },
72
+ "testTimeout": 15000,
73
+ "testEnvironment": "node"
74
+ }
75
+ }