compile-selftest.mjs 870 B

1234567891011
  1. import { readFileSync } from "node:fs"
  2. import { parse, compileScript, compileTemplate } from "@vue/compiler-sfc"
  3. const path = "src/modules/cockpit/CockpitShell.vue"
  4. const source = readFileSync(path, "utf8")
  5. const { descriptor } = parse(source, { filename: path })
  6. const script = compileScript(descriptor, { id: "t67", genDefaultAs: "__sfc__" })
  7. const template = compileTemplate({ source: descriptor.template.content, filename: path, id: "t67", ssr: true, compilerOptions: { bindingMetadata: script.bindings } })
  8. console.log("template errors:", JSON.stringify(template.errors))
  9. console.log("has data-pipe-district-note in compiled:", template.code.includes("data-pipe-district-note"))
  10. console.log("binds PIPE_DISTRICT_NOTE:", template.code.includes("PIPE_DISTRICT_NOTE"))
  11. console.log("has data-panel-note count:", (source.match(/data-pipe-district-note/g) || []).length)