MIRROR: javascript for ๐Ÿœ's, a tiny runtime with big ambitions
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

add host detection, mbedtls flag, and process features

+37 -10
+3 -1
meson.build
··· 221 221 'VERSION=' + version_conf.get('ANT_VERSION'), 222 222 'GIT_HASH=' + version_conf.get('ANT_GIT_HASH'), 223 223 'BUILD_TIMESTAMP=' + version_conf.get('ANT_BUILD_TIMESTAMP'), 224 - 'TARGET=' + version_conf.get('ANT_TARGET_TRIPLE') 224 + 'TARGET=' + version_conf.get('ANT_TARGET_TRIPLE'), 225 + 'MBEDTLS=' + (tls_lib == 'mbedtls').to_string(), 226 + 'HOST=' + host_machine.system() 225 227 ], 226 228 build_by_default: true 227 229 )
+1
src/core/ant.ts
··· 2 2 Ant.target = import.meta.env.TARGET; 3 3 Ant.revision = import.meta.env.GIT_HASH; 4 4 Ant.buildDate = import.meta.env.BUILD_TIMESTAMP; 5 + Ant.host = import.meta.env.HOST as AntHost; 5 6 6 7 Ant.typeof = function (t) { 7 8 const value = Ant.raw.typeof(t);
+5
src/core/features.ts
··· 1 + process.features = { 2 + uv: true, 3 + tls_mbedtls: import.meta.env.MBEDTLS as unknown as boolean, 4 + typescript: 'transform' 5 + };
+1
src/core/index.ts
··· 1 1 import './ant.ts'; 2 + import './features.ts';
+4 -9
src/tools/gen_snapshot.js
··· 1 1 import * as esbuild from 'esbuild'; 2 2 import { writeFileSync } from 'node:fs'; 3 3 4 - function replaceTemplates(content, replacements) { 5 - for (const [key, value] of Object.entries(replacements)) { 6 - content = content.replaceAll(`{{${key}}}`, value); 7 - } 8 - return content; 9 - } 10 - 11 4 function generateHeader(inputFile, bytes) { 12 5 const lines = []; 13 6 for (let i = 0; i < bytes.length; i += 16) { ··· 48 41 const replacements = rawArgs.reduce((acc, arg) => { 49 42 const pivot = arg.indexOf('='); 50 43 if (pivot === -1) return acc; 51 - 52 44 const key = arg.slice(0, pivot); 53 - const value = arg.slice(pivot + 1); 45 + let value = arg.slice(pivot + 1); 46 + 47 + if (value === 'true') value = true; 48 + else if (value === 'false') value = false; 54 49 55 50 acc[`import.meta.env.${key}`] = JSON.stringify(value); 56 51 return acc;
+16
src/types/ant.d.ts
··· 18 18 | 'symbol' 19 19 | 'generator'; 20 20 21 + type AntHost = 22 + | 'cygwin' 23 + | 'darwin' 24 + | 'dragonfly' 25 + | 'emscripten' 26 + | 'freebsd' 27 + | 'gnu' 28 + | 'haiku' 29 + | 'linux' 30 + | 'netbsd' 31 + | 'openbsd' 32 + | 'windows' 33 + | 'sunos' 34 + | 'os/2'; 35 + 21 36 interface AntGcResult { 22 37 heapBefore: number; 23 38 heapAfter: number; ··· 76 91 target: string; 77 92 revision: string; 78 93 buildDate: string; 94 + host: AntHost; 79 95 80 96 typeof(t: unknown): AntType | '??'; 81 97 raw: AntRaw;
+7
src/types/process.d.ts
··· 2 2 [key: string]: string | undefined; 3 3 } & { toObject(): Record<string, string> }; 4 4 5 + interface Features { 6 + uv: boolean; 7 + tls_mbedtls: boolean; 8 + typescript: 'transform' | 'none'; 9 + } 10 + 5 11 interface Process { 6 12 env: ProcessEnv; 7 13 argv: string[]; ··· 10 16 arch: string; 11 17 exit(code?: number): never; 12 18 cwd(): string; 19 + features: Features; 13 20 } 14 21 15 22 declare const process: Process;