Skip to content

Commit

Permalink
src/Playground.ts: use js-yaml (instead of yaml.js)
Browse files Browse the repository at this point in the history
  • Loading branch information
generalmimon committed Feb 4, 2024
1 parent 180fee4 commit 305c579
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions Playground.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@
<body>
<script>
loader.paths = {
"yamljs": "lib/_npm/yamljs/yaml",
"js-yaml": "../../lib/_npm/js-yaml/js-yaml.min",
"KaitaiStream": "lib/_npm/kaitai-struct/KaitaiStream",
"kaitai-struct-compiler": "lib/_npm/kaitai-struct-compiler/kaitai-struct-compiler"
};

require(["Playground"]);
</script>
</body>
Expand Down
6 changes: 3 additions & 3 deletions src/Playground.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import KaitaiStructCompiler = require("kaitai-struct-compiler");
import KaitaiStream = require("KaitaiStream");
import { YAML } from "yamljs";
import * as jsyaml from "js-yaml";
import { TemplateCompiler, ITemplateSchema } from "./worker/TemplateCompiler";
import { ExpressionParser } from "./worker/ExpressionLanguage/ExpressionParser";

Expand Down Expand Up @@ -31,8 +31,8 @@ async function run() {

const ksyContent = await (await fetch("template_compiler/test.ksy")).text();
const templateContent = await (await fetch("template_compiler/test.kcy.yaml")).text();
const ksy = <KsySchema.IKsyFile>YAML.parse(ksyContent, null, null, true);
const kcy = <ITemplateSchema>YAML.parse(templateContent);
const ksy = <KsySchema.IKsyFile>jsyaml.load(ksyContent, { schema: jsyaml.CORE_SCHEMA });
const kcy = <ITemplateSchema>jsyaml.load(templateContent, { schema: jsyaml.CORE_SCHEMA });

const compiledTemplate = TemplateCompiler.compileTemplateSchema(kcy);
console.log("compiledTemplate", compiledTemplate);
Expand Down

0 comments on commit 305c579

Please sign in to comment.