1const SOURCES = { 2 __proto__: null, 3 'test:Array': ['1', '2'], // both `1,2` and `12` are valid ESM 4 'test:ArrayBuffer': new ArrayBuffer(0), 5 'test:null': null, 6 'test:Object': {}, 7 'test:SharedArrayBuffer': new SharedArrayBuffer(0), 8 'test:string': '', 9 'test:String': new String(''), 10 'test:Uint8Array': new Uint8Array(0), 11 'test:undefined': undefined, 12} 13export function resolve(specifier, context, defaultFn) { 14 if (specifier.startsWith('test:')) { 15 return { url: specifier }; 16 } 17 return defaultFn(specifier, context); 18} 19export function getFormat(href, context, defaultFn) { 20 if (href.startsWith('test:')) { 21 return { format: 'module' }; 22 } 23 return defaultFn(href, context); 24} 25export function getSource(href, context, defaultFn) { 26 if (href.startsWith('test:')) { 27 return { source: SOURCES[href] }; 28 } 29 return defaultFn(href, context); 30} 31