diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..485dee6 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.idea diff --git a/reuse/ts/.gitignore b/reuse/ts/.gitignore new file mode 100644 index 0000000..37f90de --- /dev/null +++ b/reuse/ts/.gitignore @@ -0,0 +1,3 @@ +.env +build +node_modules diff --git a/reuse/ts/Makefile b/reuse/ts/Makefile new file mode 100644 index 0000000..b0e0417 --- /dev/null +++ b/reuse/ts/Makefile @@ -0,0 +1,13 @@ +install: + npm install + +lint: + @npx biome check --write && \ + npx biome lint --write && \ + npx biome format --write; + +type-check: + @npx tsc -p tsconfig.json + +run: + @npx tsx src/index.ts diff --git a/reuse/ts/biome.jsonc b/reuse/ts/biome.jsonc new file mode 100644 index 0000000..ea35cb2 --- /dev/null +++ b/reuse/ts/biome.jsonc @@ -0,0 +1,250 @@ +// -- biome-ignore-all assist/source/useSortedKeys: This is exception +{ + "files": { + "includes": [ + "**/*.json", + "**/*.jsonc", + "!**/package-lock.json", + // "!tsconfig.json", + "**/*.ts", + "!**/_gen", + "!meta/tea/src/graph/fp/**/*.ts" + ] + }, + "formatter": { + "indentStyle": "space", // default is `tab` + "lineWidth": 60 // default is `80` + }, + "linter": { + "enabled": true, + "rules": { + "correctness": { + /* Off */ + "noUnusedVariables": "off", + "noUnusedFunctionParameters": "off", + "useParseIntRadix": "off", + + /* Off: Not React project */ + "useHookAtTopLevel": "off", + + /** Warn, Not fix */ + // TODO: Works incorrect. E.g: anf/AbstractBoolVar.count + "noUnusedPrivateClassMembers": "off", + + /* Warning, Safe fix */ + "noUnusedImports": { + "level": "warn", + "fix": "safe" + }, + "useImportExtensions": "off", + // "useImportExtensions": { + // "level": "warn", + // "fix": "safe", + // "options": { + // "suggestedExtensions": { + // "ts": { + // "module": "js", + // "component": "jsx" + // } + // } + // } + // }, + + /* Error */ + "noInvalidUseBeforeDeclaration": "error", + + /* Error: React */ + "noRenderReturnValue": "error", + "useExhaustiveDependencies": "error", + + /* Error, Safe fix */ + "noGlobalDirnameFilename": { + "level": "error", + "fix": "safe" + }, + "noProcessGlobal": { + "level": "error", + "fix": "safe" + }, + "useJsonImportAttributes": { + "level": "error", + "fix": "safe" + } + // "useHookAtTopLevel": "error" + }, + "nursery": { + /** Off */ + "noShadow": "off", + "noUselessUndefined": "off", + + /* Error */ + // todo: Wait for "ignore type cycles" option + // "noImportCycles": "error", + "noFloatingPromises": "error", + "useExhaustiveSwitchCases": "error" + + /* Warn, Not fix */ + }, + "performance": { + /* Off */ + // TODO: Refactor code and make it warn + "noReExportAll": "off", + // TODO: Refactor code and make it warn + "noBarrelFile": "off", + + /* Warn, Not fix */ + "noAccumulatingSpread": "warn", + "noNamespaceImport": "warn", + "useTopLevelRegex": "warn", + "noAwaitInLoops": "warn" + }, + "style": { + /* Off */ + "noUselessElse": "off", + // "noParameterAssign": "off", + + // /* Warn, Not fixable */ + // "noExportedImports": "warn", + // /* Error: React */ + // "useComponentExportOnlyModules": "error", + + /* Warn, Not fix */ + "noNamespace": "warn", + "noEnum": "warn", + "noNegationElse": "warn", + "noParameterAssign": "warn", + "noProcessEnv": "warn", + + /* Error */ + "noRestrictedGlobals": { + "level": "error", + "options": { + "deniedGlobals": { + "name": "Use local value or property" + } + } + }, + + /* Error, Safe fix */ + "useImportType": { + "level": "error", + "fix": "safe" + }, + + /* Warn, Safe fix */ + "noUnusedTemplateLiteral": { + "level": "warn", + "fix": "safe" + }, + + /* PROBLEM: Incorrect work with exceptions + * - https://biomejs.dev/linter/rules/no-yoda-expression/#exceptions + */ + "noYodaExpression": "off", + // "noYodaExpression": { + // "level": "warn", + // "fix": "safe" + // }, + + "useAsConstAssertion": { + "level": "warn", + "fix": "safe" + }, + + /* Off: Conflicts with TS config compilerOptions.paths */ + "useNodejsImportProtocol": "off", + "useSymbolDescription": "error", + + /* Warn, Safe fix */ + "useNumericSeparators": { + "level": "warn", + "fix": "safe" + }, + "useGroupedAccessorPairs": "warn", + "useConsistentObjectDefinitions": "warn" + }, + "complexity": { + /* Off */ + "noForEach": "off", + "noUselessConstructor": "off", + "noThisInStatic": "off", + "noStaticOnlyClass": "off", + "noUselessUndefinedInitialization": "off", + + /* Warn, Not fixable */ + "noBannedTypes": "warn", + + /* Warn, Not fix */ + + /* Error, Safe fix */ + "useLiteralKeys": { + "level": "warn", + "fix": "safe" + }, + "useIndexOf": "warn" + }, + "suspicious": { + /** Off */ + "noConfusingVoidType": "off", + "useAdjacentOverloadSignatures": "off", + + /* Warn, Not fixable */ + "noSelfCompare": "warn", + "noShadowRestrictedNames": "warn", + "noExplicitAny": "warn", + + /* Warn, Not fix */ + "noUselessRegexBackrefs": "warn", + + /* Error: React */ + "noReactSpecificProps": "off", + "noConstantBinaryExpressions": "error", + // "noSecrets": "error", + "useStaticResponseMethods": "error", + "useIterableCallbackReturn": "error", + "noTsIgnore": { + "level": "error", + "fix": "safe" + }, + "noUselessEscapeInString": "warn" + } + } + }, + + "assist": { + "enabled": true, + "includes": ["src/**"], + "actions": { + "source": { + "useSortedKeys": "off", + "organizeImports": { + "level": "on", + "options": { + "groups": [ + ":NODE:", + ":BLANK_LINE:", + ":PACKAGE:", + ":BLANK_LINE:", + ":PATH:", + ":BLANK_LINE:", + ":ALIAS:" + ] + } + } + } + } + }, + + "javascript": { + "formatter": { + "quoteStyle": "single" // default is `double` + // , "lineWidth": 60 // override `formatter.lineWidth` + } + }, + "json": { + "formatter": { + "enabled": true + // , "lineWidth": 60 // override `formatter.lineWidth` + } + } +} diff --git a/reuse/ts/package-lock.json b/reuse/ts/package-lock.json new file mode 100644 index 0000000..dfd0083 --- /dev/null +++ b/reuse/ts/package-lock.json @@ -0,0 +1,754 @@ +{ + "name": "hyper-code", + "version": "0.0.0", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "hyper-code", + "version": "0.0.0", + "devDependencies": { + "@biomejs/biome": "2.3.6", + "@biomejs/cli-darwin-x64": "2.3.6", + "@types/node": "24.10.1", + "tsx": "4.20.6", + "typescript": "5.9.3" + } + }, + "node_modules/@biomejs/biome": { + "version": "2.3.6", + "resolved": "https://registry.npmjs.org/@biomejs/biome/-/biome-2.3.6.tgz", + "integrity": "sha512-oqUhWyU6tae0MFsr/7iLe++QWRg+6jtUhlx9/0GmCWDYFFrK366sBLamNM7D9Y+c7YSynUFKr8lpEp1r6Sk7eA==", + "dev": true, + "license": "MIT OR Apache-2.0", + "bin": { + "biome": "bin/biome" + }, + "engines": { + "node": ">=14.21.3" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/biome" + }, + "optionalDependencies": { + "@biomejs/cli-darwin-arm64": "2.3.6", + "@biomejs/cli-darwin-x64": "2.3.6", + "@biomejs/cli-linux-arm64": "2.3.6", + "@biomejs/cli-linux-arm64-musl": "2.3.6", + "@biomejs/cli-linux-x64": "2.3.6", + "@biomejs/cli-linux-x64-musl": "2.3.6", + "@biomejs/cli-win32-arm64": "2.3.6", + "@biomejs/cli-win32-x64": "2.3.6" + } + }, + "node_modules/@biomejs/cli-darwin-arm64": { + "version": "2.3.6", + "resolved": "https://registry.npmjs.org/@biomejs/cli-darwin-arm64/-/cli-darwin-arm64-2.3.6.tgz", + "integrity": "sha512-P4JWE5d8UayBxYe197QJwyW4ZHp0B+zvRIGCusOm1WbxmlhpAQA1zEqQuunHgSIzvyEEp4TVxiKGXNFZPg7r9Q==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT OR Apache-2.0", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=14.21.3" + } + }, + "node_modules/@biomejs/cli-darwin-x64": { + "version": "2.3.6", + "resolved": "https://registry.npmjs.org/@biomejs/cli-darwin-x64/-/cli-darwin-x64-2.3.6.tgz", + "integrity": "sha512-I4rTebj+F/L9K93IU7yTFs8nQ6EhaCOivxduRha4w4WEZK80yoZ8OAdR1F33m4yJ/NfUuTUbP/Wjs+vKjlCoWA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT OR Apache-2.0", + "os": [ + "darwin" + ], + "engines": { + "node": ">=14.21.3" + } + }, + "node_modules/@biomejs/cli-linux-arm64": { + "version": "2.3.6", + "resolved": "https://registry.npmjs.org/@biomejs/cli-linux-arm64/-/cli-linux-arm64-2.3.6.tgz", + "integrity": "sha512-JjYy83eVBnvuINZiqyFO7xx72v8Srh4hsgaacSBCjC22DwM6+ZvnX1/fj8/SBiLuUOfZ8YhU2pfq2Dzakeyg1A==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT OR Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=14.21.3" + } + }, + "node_modules/@biomejs/cli-linux-arm64-musl": { + "version": "2.3.6", + "resolved": "https://registry.npmjs.org/@biomejs/cli-linux-arm64-musl/-/cli-linux-arm64-musl-2.3.6.tgz", + "integrity": "sha512-oK1NpIXIixbJ/4Tcx40cwiieqah6rRUtMGOHDeK2ToT7yUFVEvXUGRKqH0O4hqZ9tW8TcXNZKfgRH6xrsjVtGg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT OR Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=14.21.3" + } + }, + "node_modules/@biomejs/cli-linux-x64": { + "version": "2.3.6", + "resolved": "https://registry.npmjs.org/@biomejs/cli-linux-x64/-/cli-linux-x64-2.3.6.tgz", + "integrity": "sha512-ZjPXzy5yN9wusIoX+8Zp4p6cL8r0NzJCXg/4r1KLVveIPXd2jKVlqZ6ZyzEq385WwU3OX5KOwQYLQsOc788waQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT OR Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=14.21.3" + } + }, + "node_modules/@biomejs/cli-linux-x64-musl": { + "version": "2.3.6", + "resolved": "https://registry.npmjs.org/@biomejs/cli-linux-x64-musl/-/cli-linux-x64-musl-2.3.6.tgz", + "integrity": "sha512-QvxB8GHQeaO4FCtwJpJjCgJkbHBbWxRHUxQlod+xeaYE6gtJdSkYkuxdKAQUZEOIsec+PeaDAhW9xjzYbwmOFA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT OR Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=14.21.3" + } + }, + "node_modules/@biomejs/cli-win32-arm64": { + "version": "2.3.6", + "resolved": "https://registry.npmjs.org/@biomejs/cli-win32-arm64/-/cli-win32-arm64-2.3.6.tgz", + "integrity": "sha512-YM7hLHpwjdt8R7+O2zS1Vo2cKgqEeptiXB1tWW1rgjN5LlpZovBVKtg7zfwfRrFx3i08aNZThYpTcowpTlczug==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT OR Apache-2.0", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=14.21.3" + } + }, + "node_modules/@biomejs/cli-win32-x64": { + "version": "2.3.6", + "resolved": "https://registry.npmjs.org/@biomejs/cli-win32-x64/-/cli-win32-x64-2.3.6.tgz", + "integrity": "sha512-psgNEYgMAobY5h+QHRBVR9xvg2KocFuBKm6axZWB/aD12NWhQjiVFQUjV6wMXhlH4iT0Q9c3yK5JFRiDC/rzHA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT OR Apache-2.0", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=14.21.3" + } + }, + "node_modules/@esbuild/aix-ppc64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.25.12.tgz", + "integrity": "sha512-Hhmwd6CInZ3dwpuGTF8fJG6yoWmsToE+vYgD4nytZVxcu1ulHpUQRAB1UJ8+N1Am3Mz4+xOByoQoSZf4D+CpkA==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "aix" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-arm": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.25.12.tgz", + "integrity": "sha512-VJ+sKvNA/GE7Ccacc9Cha7bpS8nyzVv0jdVgwNDaR4gDMC/2TTRc33Ip8qrNYUcpkOHUT5OZ0bUcNNVZQ9RLlg==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-arm64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.25.12.tgz", + "integrity": "sha512-6AAmLG7zwD1Z159jCKPvAxZd4y/VTO0VkprYy+3N2FtJ8+BQWFXU+OxARIwA46c5tdD9SsKGZ/1ocqBS/gAKHg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-x64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.25.12.tgz", + "integrity": "sha512-5jbb+2hhDHx5phYR2By8GTWEzn6I9UqR11Kwf22iKbNpYrsmRB18aX/9ivc5cabcUiAT/wM+YIZ6SG9QO6a8kg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/darwin-arm64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.25.12.tgz", + "integrity": "sha512-N3zl+lxHCifgIlcMUP5016ESkeQjLj/959RxxNYIthIg+CQHInujFuXeWbWMgnTo4cp5XVHqFPmpyu9J65C1Yg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/darwin-x64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.25.12.tgz", + "integrity": "sha512-HQ9ka4Kx21qHXwtlTUVbKJOAnmG1ipXhdWTmNXiPzPfWKpXqASVcWdnf2bnL73wgjNrFXAa3yYvBSd9pzfEIpA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/freebsd-arm64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.25.12.tgz", + "integrity": "sha512-gA0Bx759+7Jve03K1S0vkOu5Lg/85dou3EseOGUes8flVOGxbhDDh/iZaoek11Y8mtyKPGF3vP8XhnkDEAmzeg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/freebsd-x64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.25.12.tgz", + "integrity": "sha512-TGbO26Yw2xsHzxtbVFGEXBFH0FRAP7gtcPE7P5yP7wGy7cXK2oO7RyOhL5NLiqTlBh47XhmIUXuGciXEqYFfBQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-arm": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.25.12.tgz", + "integrity": "sha512-lPDGyC1JPDou8kGcywY0YILzWlhhnRjdof3UlcoqYmS9El818LLfJJc3PXXgZHrHCAKs/Z2SeZtDJr5MrkxtOw==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-arm64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.25.12.tgz", + "integrity": "sha512-8bwX7a8FghIgrupcxb4aUmYDLp8pX06rGh5HqDT7bB+8Rdells6mHvrFHHW2JAOPZUbnjUpKTLg6ECyzvas2AQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-ia32": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.25.12.tgz", + "integrity": "sha512-0y9KrdVnbMM2/vG8KfU0byhUN+EFCny9+8g202gYqSSVMonbsCfLjUO+rCci7pM0WBEtz+oK/PIwHkzxkyharA==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-loong64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.25.12.tgz", + "integrity": "sha512-h///Lr5a9rib/v1GGqXVGzjL4TMvVTv+s1DPoxQdz7l/AYv6LDSxdIwzxkrPW438oUXiDtwM10o9PmwS/6Z0Ng==", + "cpu": [ + "loong64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-mips64el": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.25.12.tgz", + "integrity": "sha512-iyRrM1Pzy9GFMDLsXn1iHUm18nhKnNMWscjmp4+hpafcZjrr2WbT//d20xaGljXDBYHqRcl8HnxbX6uaA/eGVw==", + "cpu": [ + "mips64el" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-ppc64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.25.12.tgz", + "integrity": "sha512-9meM/lRXxMi5PSUqEXRCtVjEZBGwB7P/D4yT8UG/mwIdze2aV4Vo6U5gD3+RsoHXKkHCfSxZKzmDssVlRj1QQA==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-riscv64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.25.12.tgz", + "integrity": "sha512-Zr7KR4hgKUpWAwb1f3o5ygT04MzqVrGEGXGLnj15YQDJErYu/BGg+wmFlIDOdJp0PmB0lLvxFIOXZgFRrdjR0w==", + "cpu": [ + "riscv64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-s390x": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.25.12.tgz", + "integrity": "sha512-MsKncOcgTNvdtiISc/jZs/Zf8d0cl/t3gYWX8J9ubBnVOwlk65UIEEvgBORTiljloIWnBzLs4qhzPkJcitIzIg==", + "cpu": [ + "s390x" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-x64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.25.12.tgz", + "integrity": "sha512-uqZMTLr/zR/ed4jIGnwSLkaHmPjOjJvnm6TVVitAa08SLS9Z0VM8wIRx7gWbJB5/J54YuIMInDquWyYvQLZkgw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/netbsd-arm64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-arm64/-/netbsd-arm64-0.25.12.tgz", + "integrity": "sha512-xXwcTq4GhRM7J9A8Gv5boanHhRa/Q9KLVmcyXHCTaM4wKfIpWkdXiMog/KsnxzJ0A1+nD+zoecuzqPmCRyBGjg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/netbsd-x64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.25.12.tgz", + "integrity": "sha512-Ld5pTlzPy3YwGec4OuHh1aCVCRvOXdH8DgRjfDy/oumVovmuSzWfnSJg+VtakB9Cm0gxNO9BzWkj6mtO1FMXkQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openbsd-arm64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.25.12.tgz", + "integrity": "sha512-fF96T6KsBo/pkQI950FARU9apGNTSlZGsv1jZBAlcLL1MLjLNIWPBkj5NlSz8aAzYKg+eNqknrUJ24QBybeR5A==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openbsd-x64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.25.12.tgz", + "integrity": "sha512-MZyXUkZHjQxUvzK7rN8DJ3SRmrVrke8ZyRusHlP+kuwqTcfWLyqMOE3sScPPyeIXN/mDJIfGXvcMqCgYKekoQw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openharmony-arm64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/openharmony-arm64/-/openharmony-arm64-0.25.12.tgz", + "integrity": "sha512-rm0YWsqUSRrjncSXGA7Zv78Nbnw4XL6/dzr20cyrQf7ZmRcsovpcRBdhD43Nuk3y7XIoW2OxMVvwuRvk9XdASg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openharmony" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/sunos-x64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.25.12.tgz", + "integrity": "sha512-3wGSCDyuTHQUzt0nV7bocDy72r2lI33QL3gkDNGkod22EsYl04sMf0qLb8luNKTOmgF/eDEDP5BFNwoBKH441w==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "sunos" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-arm64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.25.12.tgz", + "integrity": "sha512-rMmLrur64A7+DKlnSuwqUdRKyd3UE7oPJZmnljqEptesKM8wx9J8gx5u0+9Pq0fQQW8vqeKebwNXdfOyP+8Bsg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-ia32": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.25.12.tgz", + "integrity": "sha512-HkqnmmBoCbCwxUKKNPBixiWDGCpQGVsrQfJoVGYLPT41XWF8lHuE5N6WhVia2n4o5QK5M4tYr21827fNhi4byQ==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-x64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.25.12.tgz", + "integrity": "sha512-alJC0uCZpTFrSL0CCDjcgleBXPnCrEAhTBILpeAp7M/OFgoqtAetfBzX0xM00MUsVVPpVjlPuMbREqnZCXaTnA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@types/node": { + "version": "24.10.1", + "resolved": "https://registry.npmjs.org/@types/node/-/node-24.10.1.tgz", + "integrity": "sha512-GNWcUTRBgIRJD5zj+Tq0fKOJ5XZajIiBroOF0yvj2bSU1WvNdYS/dn9UxwsujGW4JX06dnHyjV2y9rRaybH0iQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "undici-types": "~7.16.0" + } + }, + "node_modules/esbuild": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.25.12.tgz", + "integrity": "sha512-bbPBYYrtZbkt6Os6FiTLCTFxvq4tt3JKall1vRwshA3fdVztsLAatFaZobhkBC8/BrPetoa0oksYoKXoG4ryJg==", + "dev": true, + "hasInstallScript": true, + "license": "MIT", + "bin": { + "esbuild": "bin/esbuild" + }, + "engines": { + "node": ">=18" + }, + "optionalDependencies": { + "@esbuild/aix-ppc64": "0.25.12", + "@esbuild/android-arm": "0.25.12", + "@esbuild/android-arm64": "0.25.12", + "@esbuild/android-x64": "0.25.12", + "@esbuild/darwin-arm64": "0.25.12", + "@esbuild/darwin-x64": "0.25.12", + "@esbuild/freebsd-arm64": "0.25.12", + "@esbuild/freebsd-x64": "0.25.12", + "@esbuild/linux-arm": "0.25.12", + "@esbuild/linux-arm64": "0.25.12", + "@esbuild/linux-ia32": "0.25.12", + "@esbuild/linux-loong64": "0.25.12", + "@esbuild/linux-mips64el": "0.25.12", + "@esbuild/linux-ppc64": "0.25.12", + "@esbuild/linux-riscv64": "0.25.12", + "@esbuild/linux-s390x": "0.25.12", + "@esbuild/linux-x64": "0.25.12", + "@esbuild/netbsd-arm64": "0.25.12", + "@esbuild/netbsd-x64": "0.25.12", + "@esbuild/openbsd-arm64": "0.25.12", + "@esbuild/openbsd-x64": "0.25.12", + "@esbuild/openharmony-arm64": "0.25.12", + "@esbuild/sunos-x64": "0.25.12", + "@esbuild/win32-arm64": "0.25.12", + "@esbuild/win32-ia32": "0.25.12", + "@esbuild/win32-x64": "0.25.12" + } + }, + "node_modules/fsevents": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", + "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", + "dev": true, + "hasInstallScript": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" + } + }, + "node_modules/get-tsconfig": { + "version": "4.13.0", + "resolved": "https://registry.npmjs.org/get-tsconfig/-/get-tsconfig-4.13.0.tgz", + "integrity": "sha512-1VKTZJCwBrvbd+Wn3AOgQP/2Av+TfTCOlE4AcRJE72W1ksZXbAx8PPBR9RzgTeSPzlPMHrbANMH3LbltH73wxQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "resolve-pkg-maps": "^1.0.0" + }, + "funding": { + "url": "https://github.com/privatenumber/get-tsconfig?sponsor=1" + } + }, + "node_modules/resolve-pkg-maps": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/resolve-pkg-maps/-/resolve-pkg-maps-1.0.0.tgz", + "integrity": "sha512-seS2Tj26TBVOC2NIc2rOe2y2ZO7efxITtLZcGSOnHHNOQ7CkiUBfw0Iw2ck6xkIhPwLhKNLS8BO+hEpngQlqzw==", + "dev": true, + "license": "MIT", + "funding": { + "url": "https://github.com/privatenumber/resolve-pkg-maps?sponsor=1" + } + }, + "node_modules/tsx": { + "version": "4.20.6", + "resolved": "https://registry.npmjs.org/tsx/-/tsx-4.20.6.tgz", + "integrity": "sha512-ytQKuwgmrrkDTFP4LjR0ToE2nqgy886GpvRSpU0JAnrdBYppuY5rLkRUYPU1yCryb24SsKBTL/hlDQAEFVwtZg==", + "dev": true, + "license": "MIT", + "dependencies": { + "esbuild": "~0.25.0", + "get-tsconfig": "^4.7.5" + }, + "bin": { + "tsx": "dist/cli.mjs" + }, + "engines": { + "node": ">=18.0.0" + }, + "optionalDependencies": { + "fsevents": "~2.3.3" + } + }, + "node_modules/typescript": { + "version": "5.9.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.9.3.tgz", + "integrity": "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==", + "dev": true, + "license": "Apache-2.0", + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=14.17" + } + }, + "node_modules/undici-types": { + "version": "7.16.0", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-7.16.0.tgz", + "integrity": "sha512-Zz+aZWSj8LE6zoxD+xrjh4VfkIG8Ya6LvYkZqtUQGJPZjYl53ypCaUwWqo7eI0x66KBGeRo+mlBEkMSeSZ38Nw==", + "dev": true, + "license": "MIT" + } + } +} diff --git a/reuse/ts/package.json b/reuse/ts/package.json new file mode 100644 index 0000000..fade0da --- /dev/null +++ b/reuse/ts/package.json @@ -0,0 +1,16 @@ +{ + "name": "hyper-code", + "private": true, + "version": "0.0.0", + "type": "module", + "main": "src/index.ts", + "scripts": {}, + "dependencies": {}, + "devDependencies": { + "@biomejs/biome": "2.3.6", + "@biomejs/cli-darwin-x64": "2.3.6", + "@types/node": "24.10.1", + "tsx": "4.20.6", + "typescript": "5.9.3" + } +} diff --git a/reuse/ts/src/HyperCode/compile.ts b/reuse/ts/src/HyperCode/compile.ts new file mode 100644 index 0000000..f45d6ad --- /dev/null +++ b/reuse/ts/src/HyperCode/compile.ts @@ -0,0 +1,21 @@ +import type { AppConfig } from './types'; + +export type CompilationTarget = { + readonly lang: 'Swift' | 'Go' | 'Ts' | 'C++' | 'Rust'; + // TODO: ... +}; + +// TODO: Generate this code with AI? +export const compile = async ( + config: App, + target: CompilationTarget, +) => { + // TODO: Generate executable code for target language/platform + console.log( + 'Generate code for', + config.title, + 'for', + target.lang, + '...', + ); +}; diff --git a/reuse/ts/src/HyperCode/index.ts b/reuse/ts/src/HyperCode/index.ts new file mode 100644 index 0000000..790bb86 --- /dev/null +++ b/reuse/ts/src/HyperCode/index.ts @@ -0,0 +1,7 @@ +import { compile } from './compile'; +import { run } from './run'; + +export const HyperCode = { + run, + compile, +}; diff --git a/reuse/ts/src/HyperCode/run.ts b/reuse/ts/src/HyperCode/run.ts new file mode 100644 index 0000000..241fc64 --- /dev/null +++ b/reuse/ts/src/HyperCode/run.ts @@ -0,0 +1,9 @@ +import type { AppConfig } from './types'; + +// TODO: Generate this code with AI? +export const run = async ( + config: App, +) => { + // TODO: Run app in the env as interpreter + console.log('Run', config.title, '...'); +}; diff --git a/reuse/ts/src/HyperCode/types.ts b/reuse/ts/src/HyperCode/types.ts new file mode 100644 index 0000000..5b93aab --- /dev/null +++ b/reuse/ts/src/HyperCode/types.ts @@ -0,0 +1,28 @@ +export type Logger = { + readonly level: 'debug' | 'info' | 'warn' | 'error'; + readonly console: { + format: 'text' | 'markdown' | 'json' | 'yaml'; + }; +}; + +export type Database = + | { + readonly driver: 'sqlite'; + readonly file: string; + } + | { + readonly driver: 'postgres'; + connectionString: string; + poolSize: number; + }; + +export type ApiServer = { + readonly listen: { + readonly host: string; + readonly port: number; + }; +}; + +export type AppConfig = { + readonly title: string; +}; diff --git a/reuse/ts/src/app/config/default.ts b/reuse/ts/src/app/config/default.ts new file mode 100644 index 0000000..abc8ec2 --- /dev/null +++ b/reuse/ts/src/app/config/default.ts @@ -0,0 +1,40 @@ +/* + + # --- Default/Development Settings --- + Logger: + level: "debug" + + .console: + format: "text" + + Database: + driver: "sqlite" + file: "dev.sqlite3" + + APIServer > Listen: + host: "127.0.0.1" + port: 5000 + + */ + +import type { MyAppConfig } from '../types'; + +export const default_: MyAppConfig = { + title: 'App (default)', + logger: { + level: 'debug', + console: { + format: 'text', + }, + }, + mainDb: { + driver: 'sqlite', + file: 'dev.sqlite3', + }, + api: { + listen: { + host: '127.0.0.1', + port: 5000, + }, + }, +}; diff --git a/reuse/ts/src/app/config/index.ts b/reuse/ts/src/app/config/index.ts new file mode 100644 index 0000000..f91751f --- /dev/null +++ b/reuse/ts/src/app/config/index.ts @@ -0,0 +1,15 @@ +/* + + # config.hcs (Provides context-dependent behavior) + + */ + +import { default_ } from './default'; +import { production } from './production'; +import { staging } from './staging'; + +export const config = { + default: default_, + production, + staging, +}; diff --git a/reuse/ts/src/app/config/production.ts b/reuse/ts/src/app/config/production.ts new file mode 100644 index 0000000..937edf4 --- /dev/null +++ b/reuse/ts/src/app/config/production.ts @@ -0,0 +1,45 @@ +/* + + # --- Production Environment Overrides --- + @env[production]: + Logger: + level: "info" + + .console: + format: "json" # Switch to structured logging for production + + '#main-db': + driver: "postgres" + connection_string: "${DATABASE_URL}" # Use environment variable + pool_size: 50 + + APIServer > Listen: + host: "0.0.0.0" + port: 8080 + + */ + +import type { MyAppConfig, ProductionEnv } from '../types'; + +export const production = ({ + DATABASE_URL, +}: ProductionEnv): MyAppConfig => ({ + title: 'App (production)', + logger: { + level: 'info', + console: { + format: 'json', + }, + }, + mainDb: { + driver: 'postgres', + connectionString: `${DATABASE_URL}`, + poolSize: 50, + }, + api: { + listen: { + host: '0.0.0.0', + port: 8080, + }, + }, +}); diff --git a/reuse/ts/src/app/config/staging.ts b/reuse/ts/src/app/config/staging.ts new file mode 100644 index 0000000..6df698f --- /dev/null +++ b/reuse/ts/src/app/config/staging.ts @@ -0,0 +1,16 @@ +import type { MyAppConfig, StagingEnv } from '../types'; +import { production } from './production'; + +export const staging = (env: StagingEnv): MyAppConfig => { + const base = production(env); + + /** One of type-checked alternative to cascade-sheets */ + return { + ...base, + title: `App (staging ${env.stagingId})`, + logger: { + ...base.logger, + level: 'warn', + }, + }; +}; diff --git a/reuse/ts/src/app/types.ts b/reuse/ts/src/app/types.ts new file mode 100644 index 0000000..c8b26f7 --- /dev/null +++ b/reuse/ts/src/app/types.ts @@ -0,0 +1,31 @@ +/* + # app.hc (The logic structure is constant) + + Service + Logger.console + Database#main-db + Connect + APIServer + Listen + */ + +import type { + ApiServer, + AppConfig, + Database, + Logger, +} from '../HyperCode/types'; + +export type MyAppConfig = AppConfig & { + readonly logger: Logger; + readonly mainDb: Database; + readonly api: ApiServer; +}; + +export type ProductionEnv = { + readonly DATABASE_URL: string; +}; + +export type StagingEnv = ProductionEnv & { + readonly stagingId: number; +}; diff --git a/reuse/ts/src/index.ts b/reuse/ts/src/index.ts new file mode 100644 index 0000000..ab6a8df --- /dev/null +++ b/reuse/ts/src/index.ts @@ -0,0 +1,25 @@ +import { config } from './app/config'; +import type { + ProductionEnv, + StagingEnv, +} from './app/types'; +import { HyperCode } from './HyperCode'; + +const staging: StagingEnv = { + DATABASE_URL: '...', + stagingId: 123, +}; + +const production: ProductionEnv = { + DATABASE_URL: '...', +}; + +await HyperCode.run(config.default); +await HyperCode.run(config.production(production)); + +await HyperCode.compile(config.staging(staging), { + lang: 'Swift', +}); +await HyperCode.compile(config.production(production), { + lang: 'Rust', +}); diff --git a/reuse/ts/tsconfig.json b/reuse/ts/tsconfig.json new file mode 100644 index 0000000..96d2722 --- /dev/null +++ b/reuse/ts/tsconfig.json @@ -0,0 +1,30 @@ +{ + "compilerOptions": { + "tsBuildInfoFile": "build/tsbuildinfo", + "outDir": "build", + "noEmit": true, + "allowImportingTsExtensions": false, + "allowSyntheticDefaultImports": true, + "esModuleInterop": true, + + "lib": ["ESNext"], + "moduleResolution": "Node", + "module": "esnext", + "target": "es2024", + "isolatedModules": true, + "removeComments": true, + + "verbatimModuleSyntax": true, + "moduleDetection": "force", + + "strict": true, + "noUnusedLocals": false, + "noUnusedParameters": false, + "noFallthroughCasesInSwitch": true, + "noUncheckedSideEffectImports": true, + "noUncheckedIndexedAccess": true, + "experimentalDecorators": false, + "useDefineForClassFields": true, + "skipLibCheck": true + } +}