chore: Remove use of ts-macros #3

Merged
glen merged 2 commits from remove_macros into main 2024-10-15 06:53:08 +00:00
7 changed files with 19 additions and 177 deletions
Showing only changes of commit 879b1a4737 - Show all commits

View File

@ -22,11 +22,9 @@
url: 'https://code.studioinfinity.org/glen/math5.git', url: 'https://code.studioinfinity.org/glen/math5.git',
}, },
devDependencies: { devDependencies: {
'@types/node': '^22.7.4', '@types/node': '^22.7.5',
'ts-macros': '^2.6.2', typescript: '^5.6.3',
'ts-patch': '^3.2.1', 'undici-types': '^6.20.0',
typescript: '^5.6.2',
'undici-types': '^6.19.8',
}, },
dependencies: { dependencies: {
'tsc-module-loader': '^0.0.1', 'tsc-module-loader': '^0.0.1',

View File

@ -13,44 +13,19 @@ importers:
version: 0.0.1 version: 0.0.1
devDependencies: devDependencies:
'@types/node': '@types/node':
specifier: ^22.7.4 specifier: ^22.7.5
version: 22.7.4 version: 22.7.5
ts-macros:
specifier: ^2.6.2
version: 2.6.2(typescript@5.6.2)
ts-patch:
specifier: ^3.2.1
version: 3.2.1
typescript: typescript:
specifier: ^5.6.2 specifier: ^5.6.3
version: 5.6.2 version: 5.6.3
undici-types: undici-types:
specifier: ^6.19.8 specifier: ^6.20.0
version: 6.19.8 version: 6.20.0
packages: packages:
'@types/node@22.7.4': '@types/node@22.7.5':
resolution: {integrity: sha512-y+NPi1rFzDs1NdQHHToqeiX2TIS79SWEAw9GYhkkx8bD0ChpfqC+n2j5OXOCpzfojBEBt6DnEnnG9MY0zk1XLg==} resolution: {integrity: sha512-jML7s2NAzMWc//QSJ1a3prpk78cOPchGvXJsC3C6R6PSMoooztvRVQEz89gmBTBY1SPMaqo5teB4uNHPdetShQ==}
ansi-regex@5.0.1:
resolution: {integrity: sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==}
engines: {node: '>=8'}
ansi-styles@4.3.0:
resolution: {integrity: sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==}
engines: {node: '>=8'}
chalk@4.1.2:
resolution: {integrity: sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==}
engines: {node: '>=10'}
color-convert@2.0.1:
resolution: {integrity: sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==}
engines: {node: '>=7.0.0'}
color-name@1.1.4:
resolution: {integrity: sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==}
commonjs-extension-resolution-loader@0.1.0: commonjs-extension-resolution-loader@0.1.0:
resolution: {integrity: sha512-XDCkM/cYIt1CfPs+LNX8nC2KKrzTx5AAlGLpx7A4BjWQCHR9LphDu9Iq5zXYf+PXhCkpLGBFiyiTnwmSnNxbWQ==} resolution: {integrity: sha512-XDCkM/cYIt1CfPs+LNX8nC2KKrzTx5AAlGLpx7A4BjWQCHR9LphDu9Iq5zXYf+PXhCkpLGBFiyiTnwmSnNxbWQ==}
@ -58,35 +33,14 @@ packages:
function-bind@1.1.2: function-bind@1.1.2:
resolution: {integrity: sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==} resolution: {integrity: sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==}
global-prefix@3.0.0:
resolution: {integrity: sha512-awConJSVCHVGND6x3tmMaKcQvwXLhjdkmomy2W+Goaui8YPgYgXJZewhg3fWC+DlfqqQuWg8AwqjGTD2nAPVWg==}
engines: {node: '>=6'}
has-flag@4.0.0:
resolution: {integrity: sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==}
engines: {node: '>=8'}
hasown@2.0.2: hasown@2.0.2:
resolution: {integrity: sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==} resolution: {integrity: sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==}
engines: {node: '>= 0.4'} engines: {node: '>= 0.4'}
ini@1.3.8:
resolution: {integrity: sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==}
is-core-module@2.15.1: is-core-module@2.15.1:
resolution: {integrity: sha512-z0vtXSwucUJtANQWldhbtbt7BnL0vxiFjIdDLAatwhDYty2bad6s+rijD6Ri4YuYJubLzIJLUidCh09e1djEVQ==} resolution: {integrity: sha512-z0vtXSwucUJtANQWldhbtbt7BnL0vxiFjIdDLAatwhDYty2bad6s+rijD6Ri4YuYJubLzIJLUidCh09e1djEVQ==}
engines: {node: '>= 0.4'} engines: {node: '>= 0.4'}
isexe@2.0.0:
resolution: {integrity: sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==}
kind-of@6.0.3:
resolution: {integrity: sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==}
engines: {node: '>=0.10.0'}
minimist@1.2.8:
resolution: {integrity: sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==}
path-parse@1.0.7: path-parse@1.0.7:
resolution: {integrity: sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==} resolution: {integrity: sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==}
@ -94,105 +48,44 @@ packages:
resolution: {integrity: sha512-oKWePCxqpd6FlLvGV1VU0x7bkPmmCNolxzjMf4NczoDnQcIWrAF+cPtZn5i6n+RfD2d9i0tzpKnG6Yk168yIyw==} resolution: {integrity: sha512-oKWePCxqpd6FlLvGV1VU0x7bkPmmCNolxzjMf4NczoDnQcIWrAF+cPtZn5i6n+RfD2d9i0tzpKnG6Yk168yIyw==}
hasBin: true hasBin: true
semver@7.6.3:
resolution: {integrity: sha512-oVekP1cKtI+CTDvHWYFUcMtsK/00wmAEfyqKfNdARm8u1wNVhSgaX7A8d4UuIlUI5e84iEwOhs7ZPYRmzU9U6A==}
engines: {node: '>=10'}
hasBin: true
strip-ansi@6.0.1:
resolution: {integrity: sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==}
engines: {node: '>=8'}
supports-color@7.2.0:
resolution: {integrity: sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==}
engines: {node: '>=8'}
supports-preserve-symlinks-flag@1.0.0: supports-preserve-symlinks-flag@1.0.0:
resolution: {integrity: sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==} resolution: {integrity: sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==}
engines: {node: '>= 0.4'} engines: {node: '>= 0.4'}
ts-macros@2.6.2:
resolution: {integrity: sha512-ZzEn268Td/efdvgFptYS2Hh4k8fEihF9P2QFqwX9OzEwAhdWq0oyhD0nUH6xh+mXklPKQiGQySS2NyW79tG5eA==}
hasBin: true
peerDependencies:
typescript: 5.2.x || 5.3.x || 5.4.x || 5.5.x || 5.6.x
ts-patch@3.2.1:
resolution: {integrity: sha512-hlR43v+GUIUy8/ZGFP1DquEqPh7PFKQdDMTAmYt671kCCA6AkDQMoeFaFmZ7ObPLYOmpMgyKUqL1C+coFMf30w==}
hasBin: true
tsc-module-loader@0.0.1: tsc-module-loader@0.0.1:
resolution: {integrity: sha512-3SIydFXw96jYU2imgULgIHKlUY8FnfDZlazvNmw4Umx/8qCwXsyDg0V2QOULf2Fw7zaI1Hbibh0mB8VzRZ/Ghg==} resolution: {integrity: sha512-3SIydFXw96jYU2imgULgIHKlUY8FnfDZlazvNmw4Umx/8qCwXsyDg0V2QOULf2Fw7zaI1Hbibh0mB8VzRZ/Ghg==}
typescript@5.6.2: typescript@5.6.3:
resolution: {integrity: sha512-NW8ByodCSNCwZeghjN3o+JX5OFH0Ojg6sadjEKY4huZ52TqbJTJnDo5+Tw98lSy63NZvi4n+ez5m2u5d4PkZyw==} resolution: {integrity: sha512-hjcS1mhfuyi4WW8IWtjP7brDrG2cuDZukyrYrSauoXGNgx0S7zceP07adYkJycEr56BOUTNPzbInooiN3fn1qw==}
engines: {node: '>=14.17'} engines: {node: '>=14.17'}
hasBin: true hasBin: true
undici-types@6.19.8: undici-types@6.19.8:
resolution: {integrity: sha512-ve2KP6f/JnbPBFyobGHuerC9g1FYGn/F8n1LWTwNxCEzd6IfqTwUQcNXgEtmmQ6DlRrC1hrSrBnCZPokRrDHjw==} resolution: {integrity: sha512-ve2KP6f/JnbPBFyobGHuerC9g1FYGn/F8n1LWTwNxCEzd6IfqTwUQcNXgEtmmQ6DlRrC1hrSrBnCZPokRrDHjw==}
which@1.3.1: undici-types@6.20.0:
resolution: {integrity: sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==} resolution: {integrity: sha512-Ny6QZ2Nju20vw1SRHe3d9jVu6gJ+4e3+MMpqu7pqE5HT6WsTSlce++GQmK5UXS8mzV8DSYHrQH+Xrf2jVcuKNg==}
hasBin: true
yargs-parser@21.1.1:
resolution: {integrity: sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==}
engines: {node: '>=12'}
snapshots: snapshots:
'@types/node@22.7.4': '@types/node@22.7.5':
dependencies: dependencies:
undici-types: 6.19.8 undici-types: 6.19.8
ansi-regex@5.0.1: {}
ansi-styles@4.3.0:
dependencies:
color-convert: 2.0.1
chalk@4.1.2:
dependencies:
ansi-styles: 4.3.0
supports-color: 7.2.0
color-convert@2.0.1:
dependencies:
color-name: 1.1.4
color-name@1.1.4: {}
commonjs-extension-resolution-loader@0.1.0: commonjs-extension-resolution-loader@0.1.0:
dependencies: dependencies:
resolve: 1.22.8 resolve: 1.22.8
function-bind@1.1.2: {} function-bind@1.1.2: {}
global-prefix@3.0.0:
dependencies:
ini: 1.3.8
kind-of: 6.0.3
which: 1.3.1
has-flag@4.0.0: {}
hasown@2.0.2: hasown@2.0.2:
dependencies: dependencies:
function-bind: 1.1.2 function-bind: 1.1.2
ini@1.3.8: {}
is-core-module@2.15.1: is-core-module@2.15.1:
dependencies: dependencies:
hasown: 2.0.2 hasown: 2.0.2
isexe@2.0.0: {}
kind-of@6.0.3: {}
minimist@1.2.8: {}
path-parse@1.0.7: {} path-parse@1.0.7: {}
resolve@1.22.8: resolve@1.22.8:
@ -201,43 +94,15 @@ snapshots:
path-parse: 1.0.7 path-parse: 1.0.7
supports-preserve-symlinks-flag: 1.0.0 supports-preserve-symlinks-flag: 1.0.0
semver@7.6.3: {}
strip-ansi@6.0.1:
dependencies:
ansi-regex: 5.0.1
supports-color@7.2.0:
dependencies:
has-flag: 4.0.0
supports-preserve-symlinks-flag@1.0.0: {} supports-preserve-symlinks-flag@1.0.0: {}
ts-macros@2.6.2(typescript@5.6.2):
dependencies:
typescript: 5.6.2
yargs-parser: 21.1.1
ts-patch@3.2.1:
dependencies:
chalk: 4.1.2
global-prefix: 3.0.0
minimist: 1.2.8
resolve: 1.22.8
semver: 7.6.3
strip-ansi: 6.0.1
tsc-module-loader@0.0.1: tsc-module-loader@0.0.1:
dependencies: dependencies:
commonjs-extension-resolution-loader: 0.1.0 commonjs-extension-resolution-loader: 0.1.0
resolve: 1.22.8 resolve: 1.22.8
typescript@5.6.2: {} typescript@5.6.3: {}
undici-types@6.19.8: {} undici-types@6.19.8: {}
which@1.3.1: undici-types@6.20.0: {}
dependencies:
isexe: 2.0.0
yargs-parser@21.1.1: {}

View File

@ -2,7 +2,7 @@ import {Complex} from './type.js'
import {implementations, commonSpecs} from '@/core/Dispatcher' import {implementations, commonSpecs} from '@/core/Dispatcher'
import type {RawDependencies} from '@/core/Dispatcher' import type {RawDependencies} from '@/core/Dispatcher'
import {commonSignature, RealType, $reflect} from '@/interfaces/type' import {commonSignature, RealType} from '@/interfaces/type'
import type {CommonSignature, CommonReturn} from '@/interfaces/type' import type {CommonSignature, CommonReturn} from '@/interfaces/type'
// Narrowly typed signature selectors, for the operations we need to use // Narrowly typed signature selectors, for the operations we need to use
@ -150,5 +150,3 @@ export function mixed<T>() {
}) })
.ship() .ship()
} }
$reflect!([common, mixed])

View File

@ -1,6 +1,5 @@
import {implementations, commonSpecs} from '@/core/Dispatcher' import {implementations, commonSpecs} from '@/core/Dispatcher'
import {joinTypes} from '@/core/type' import {joinTypes} from '@/core/type'
import {$reflect} from '@/interfaces/type'
import type { import type {
CommonInterface, CommonSignature, NaNType, OneType, ZeroType CommonInterface, CommonSignature, NaNType, OneType, ZeroType
@ -70,5 +69,3 @@ export function common<T>() {
}) })
.ship() .ship()
} }
$reflect!([common, lift])

View File

@ -1,5 +1,3 @@
import {$$typeToString} from 'ts-macros'
import {Configuration} from '@/core/Configuration' import {Configuration} from '@/core/Configuration'
/* First some type utilities: */ /* First some type utilities: */
@ -116,11 +114,3 @@ export type Dependency<T, Aux = T> = {
export type Dependencies<T, Names extends SignatureKey<T>, Aux = T> = export type Dependencies<T, Names extends SignatureKey<T>, Aux = T> =
Pick<CommonSignature<T, Aux>, Names> Pick<CommonSignature<T, Aux>, Names>
// Macro for type reflection:
export function $reflect<ImplTuple>(tup: ImplTuple) {
+[[tup], <T>(elt: T) => {
(elt as {reflectedType: string}).reflectedType
= $$typeToString!<T>(true, false, true);
}]
}

View File

@ -1,5 +1,4 @@
import {implementations} from '@/core/Dispatcher' import {implementations} from '@/core/Dispatcher'
import {$reflect} from '@/interfaces/type'
import type {CommonSignature} from '@/interfaces/type' import type {CommonSignature} from '@/interfaces/type'
const conservativeSqrt = (a: number) => isNaN(a) ? NaN : Math.sqrt(a) const conservativeSqrt = (a: number) => isNaN(a) ? NaN : Math.sqrt(a)
@ -25,5 +24,3 @@ export const common = implementations<CommonSignature<number>>()
} }
}}) }})
.ship() .ship()
$reflect!([common])

View File

@ -1,6 +1,5 @@
import type {Complex} from '@/Complex/type' import type {Complex} from '@/Complex/type'
import {implementations} from '@/core/Dispatcher' import {implementations} from '@/core/Dispatcher'
import {$reflect} from '@/interfaces/type'
import type {CommonSignature} from '@/interfaces/type' import type {CommonSignature} from '@/interfaces/type'
export const number_type = { export const number_type = {
@ -30,5 +29,3 @@ export const common = implementations<CommonSignature<number>>()
nan: a => NaN, nan: a => NaN,
re: a => a re: a => a
}).ship() }).ship()
$reflect!([common])