11cb0ef41Sopenharmony_ciimport '../common/index.mjs';
21cb0ef41Sopenharmony_ciimport * as fixtures from '../common/fixtures.mjs';
31cb0ef41Sopenharmony_ciimport { register } from 'node:module';
41cb0ef41Sopenharmony_ciimport assert from 'node:assert';
51cb0ef41Sopenharmony_ci
61cb0ef41Sopenharmony_ciasync function resolve(referrer, context, next) {
71cb0ef41Sopenharmony_ci  const result = await next(referrer, context);
81cb0ef41Sopenharmony_ci  const url = new URL(result.url);
91cb0ef41Sopenharmony_ci  url.searchParams.set('randomSeed', Math.random());
101cb0ef41Sopenharmony_ci  result.url = url.href;
111cb0ef41Sopenharmony_ci  return result;
121cb0ef41Sopenharmony_ci}
131cb0ef41Sopenharmony_ci
141cb0ef41Sopenharmony_cifunction load(url, context, next) {
151cb0ef41Sopenharmony_ci  if (context.importAttributes.type === 'json') {
161cb0ef41Sopenharmony_ci    return {
171cb0ef41Sopenharmony_ci      shortCircuit: true,
181cb0ef41Sopenharmony_ci      format: 'json',
191cb0ef41Sopenharmony_ci      source: JSON.stringify({ data: Math.random() }),
201cb0ef41Sopenharmony_ci    };
211cb0ef41Sopenharmony_ci  }
221cb0ef41Sopenharmony_ci  return next(url, context);
231cb0ef41Sopenharmony_ci}
241cb0ef41Sopenharmony_ci
251cb0ef41Sopenharmony_ciregister(`data:text/javascript,export ${encodeURIComponent(resolve)};export ${encodeURIComponent(load)}`);
261cb0ef41Sopenharmony_ci
271cb0ef41Sopenharmony_ciassert.notDeepStrictEqual(
281cb0ef41Sopenharmony_ci  await import(fixtures.fileURL('empty.json'), { with: { type: 'json' } }),
291cb0ef41Sopenharmony_ci  await import(fixtures.fileURL('empty.json'), { with: { type: 'json' } }),
301cb0ef41Sopenharmony_ci);
31