// The try covers setup as well as the displayed example. try { // Raw-module examples use the verified small-profile asset in the installed release. const factoryUrl = new URL('./wasm/small/engine.mjs', import.meta.resolve('@maelys-dev/datalog/package.json')) const { default: createModule } = await import(factoryUrl.href) let module!: WasmModule const engine = keepEngine(await Engine.create({ profile: 'small', wasmFactory: async options => { module = await createModule(options) return module }, })) if (!module) throw new Error('The custom factory did not supply a module') /* API_REFERENCE_EXAMPLE */ } finally { // Engine.close cascades to every ruleset, input, session and result it owns. closeEngines() }