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:BigInt64Array': new BigInt64Array(0), 6 'test:BigUint64Array': new BigUint64Array(0), 7 'test:Float32Array': new Float32Array(0), 8 'test:Float64Array': new Float64Array(0), 9 'test:Int8Array': new Int8Array(0), 10 'test:Int16Array': new Int16Array(0), 11 'test:Int32Array': new Int32Array(0), 12 'test:null': null, 13 'test:Object': {}, 14 'test:SharedArrayBuffer': new SharedArrayBuffer(0), 15 'test:string': '', 16 'test:String': new String(''), 17 'test:Uint8Array': new Uint8Array(0), 18 'test:Uint8ClampedArray': new Uint8ClampedArray(0), 19 'test:Uint16Array': new Uint16Array(0), 20 'test:Uint32Array': new Uint32Array(0), 21 'test:undefined': undefined, 22} 23export function resolve(specifier, context, next) { 24 if (specifier.startsWith('test:')) { 25 return { 26 importAttributes: context.importAttributes, 27 shortCircuit: true, 28 url: specifier, 29 }; 30 } 31 return next(specifier); 32} 33 34export function load(href, context, next) { 35 if (href.startsWith('test:')) { 36 return { 37 format: 'module', 38 shortCircuit: true, 39 source: SOURCES[href], 40 }; 41 } 42 return next(href); 43} 44