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.

at master 32 lines 975 B view raw
1#include <string.h> 2 3#include "esm/builtin_bundle.h" 4#include "builtin_bundle_data.h" 5 6bool esm_has_builtin_scheme(const char *specifier) { 7 if (!specifier) return false; 8 9 if (specifier[0] == 'n') return strncmp(specifier, "node:", 5) == 0; 10 if (specifier[0] == 'a') return strncmp(specifier, "ant:" , 4) == 0; 11 12 return false; 13} 14 15 16const ant_builtin_bundle_alias_t *esm_lookup_builtin_alias(const char *specifier, size_t spec_len) { 17 if (!specifier) return NULL; 18 19 for (size_t i = 0; i < ant_builtin_bundle_alias_count; i++) { 20 const ant_builtin_bundle_alias_t *alias = &ant_builtin_bundle_aliases[i]; 21 if (alias->specifier_len != spec_len) continue; 22 if (memcmp(alias->specifier, specifier, spec_len) != 0) continue; 23 return alias; 24 } 25 26 return NULL; 27} 28 29const ant_builtin_bundle_module_t *esm_lookup_builtin_module(size_t module_id) { 30 if (module_id >= ant_builtin_bundle_module_count) return NULL; 31 return &ant_builtin_bundle_modules[module_id]; 32}