; AUTO-GENERATED module: `affine_vscode_adapter_source` exposes the
; in-tree `packages/affine-vscode/mod.js` adapter as an OCaml string
; constant so `--vscode-extension` codegen can embed it directly into
; the generated `.cjs` (eliminating the runtime `require()` of
; @hyperpolymath/affine-vscode, which used to fail when the adapter
; wasn't installed — see issues #104 / #139).

(rule
 (target affine_vscode_adapter_source.ml)
 (deps
  (file ../packages/affine-vscode/mod.js))
 (action
  (with-stdout-to
   %{target}
   (bash
    "echo '(* AUTO-GENERATED from packages/affine-vscode/mod.js. Do not edit. *)'; echo 'let source = {affine_vscode|'; cat %{dep:../packages/affine-vscode/mod.js}; echo '|affine_vscode}'"))))

(library
 (name affinescript)
 (public_name affinescript)
 (modes byte native)
 (modules
  affine_vscode_adapter_source
  ast
  borrow
  borrow_extract
  c_codegen
  cafe_face
  codegen
  codegen_deno
  codegen_gc
  codegen_node
  desugar_traits
  effect
  effect_sites
  error
  error_collector
  error_formatter
  face
  face_pragma
  formatter
  int_div_classifier
  bash_codegen
  cuda_codegen
  faust_codegen
  gleam_codegen
  interp
  js_codegen
  js_face
  julia_codegen
  json_output
  kernel_sublang
  lean_codegen
  llvm_codegen
  lua_codegen
  metal_codegen
  mlir_codegen
  nickel_codegen
  ocaml_codegen
  onnx_codegen
  onnx_proto
  opencl_codegen
  protobuf
  rescript_codegen
  rust_codegen
  spirv_codegen
  verilog_codegen
  why3_codegen
  lexer
  linter
  lsp_server
  lucid_face
  module_loader
  opt
  parse_driver
  parse
  parser
  parser_errors
  pseudocode_face
  python_face
  quantity
  resolve
  solo_cesk
  span
  symbol
  tea_bridge
  tea_cs_bridge
  tea_router
  token
  trait
  tw_interface
  tw_section
  tw_verify
  typecheck
  types
  unify
  value
  version
  wasm
  wasm_encode
  wasm_gc
  wasm_gc_encode
  wasi_runtime
  wgsl_codegen)
 (libraries str unix sedlex fmt menhirLib yojson borrow_polonius)
 ; Warnings 8 (partial-match) and 9 (missing-record-fields) are demoted from
 ; error to warning so that adding new AST variants (e.g. FnExtern, TyExtern)
 ; doesn't require updating every backend's match in lock-step. Critical
 ; paths (Codegen WASM, Codegen_gc, Resolve, Typecheck, Borrow, Quantity)
 ; still handle the new variants explicitly; non-WASM codegens that don't
 ; will surface a Match_failure with file:line at runtime if exercised on an
 ; extern decl, which is the right signal for "this target has no story for
 ; host-supplied implementations".
 (flags
  (:standard -w -8-9))
 (preprocess
  (pps ppx_deriving.show ppx_deriving.eq ppx_deriving.ord sedlex.ppx))
 ; Without this stanza `dune runtest --instrument-with bisect_ppx` has nothing
 ; to attach to: dune instruments nothing, the tests run uninstrumented, and no
 ; .coverage files are written. `bisect-ppx-report summary` then fails with
 ; "no *.coverage files found" — and because the CI step that calls it carries
 ; `continue-on-error: true`, that failure was swallowed and the coverage job
 ; went green while measuring nothing.
 (instrumentation
  (backend bisect_ppx)))

(menhir
 (modules parser)
 (flags --table))
