questmark 0.0.33 → 0.0.37
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/package.json +2 -2
- package/bin/questmark +3 -3
- package/bin/questmark.mjs +3 -3
- package/dist/browser/bundle.js +31451 -0
- package/dist/node/QuestVM.d.ts +13 -13
- package/dist/node/QuestVM.js +88 -88
- package/dist/node/cli.d.ts +2 -2
- package/dist/node/cli.js +79 -76
- package/dist/node/cli.js.map +1 -1
- package/dist/node/index.d.ts +2 -2
- package/dist/node/index.js +14 -14
- package/dist/node/parseMarkdown.d.ts +25 -25
- package/dist/node/parseMarkdown.js +412 -349
- package/dist/node/parseMarkdown.js.map +1 -1
- package/package.json +59 -54
- package/readme.md +102 -102
- package/tsconfig-browser.json +8 -8
- package/tsconfig.json +28 -27
- package/tsconfig.webpack.json +11 -0
- package/webpack.config.js +55 -0
- package/dist/browser/QuestVM.d.ts +0 -13
- package/dist/browser/QuestVM.js +0 -89
- package/dist/browser/QuestVM.js.map +0 -1
- package/dist/browser/cli.d.ts +0 -2
- package/dist/browser/cli.js +0 -77
- package/dist/browser/cli.js.map +0 -1
- package/dist/browser/index.d.ts +0 -2
- package/dist/browser/index.js +0 -15
- package/dist/browser/index.js.map +0 -1
- package/dist/browser/parseMarkdown.d.ts +0 -25
- package/dist/browser/parseMarkdown.js +0 -350
- package/dist/browser/parseMarkdown.js.map +0 -1
package/dist/node/QuestVM.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
import { EventEmitter } from "events";
|
|
3
|
-
import { Functions } from "tzo";
|
|
4
|
-
import { VM } from "tzo";
|
|
5
|
-
export interface Choice {
|
|
6
|
-
title: string;
|
|
7
|
-
id: number;
|
|
8
|
-
}
|
|
9
|
-
export declare class QuestVM extends VM {
|
|
10
|
-
responses: any[];
|
|
11
|
-
eventBus: EventEmitter;
|
|
12
|
-
constructor(emitFunction: (body: string | number) => void, getResponseFunction: (choices: Choice[]) => Promise<number>, additionalFunctions?: Functions);
|
|
13
|
-
}
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import { EventEmitter } from "events";
|
|
3
|
+
import { Functions } from "tzo";
|
|
4
|
+
import { VM } from "tzo";
|
|
5
|
+
export interface Choice {
|
|
6
|
+
title: string;
|
|
7
|
+
id: number;
|
|
8
|
+
}
|
|
9
|
+
export declare class QuestVM extends VM {
|
|
10
|
+
responses: any[];
|
|
11
|
+
eventBus: EventEmitter;
|
|
12
|
+
constructor(emitFunction: (body: string | number) => void, getResponseFunction: (choices: Choice[]) => Promise<number>, additionalFunctions?: Functions);
|
|
13
|
+
}
|
package/dist/node/QuestVM.js
CHANGED
|
@@ -1,89 +1,89 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.QuestVM = void 0;
|
|
4
|
-
const events_1 = require("events");
|
|
5
|
-
const tzo_1 = require("tzo");
|
|
6
|
-
class QuestVM extends tzo_1.VM {
|
|
7
|
-
constructor(emitFunction, getResponseFunction, additionalFunctions) {
|
|
8
|
-
super({}, Object.assign(Object.assign({}, (additionalFunctions || {})), {
|
|
9
|
-
"emit": (stack) => {
|
|
10
|
-
const [str1] = tzo_1.getStackParams("emit", ["string | number"], stack);
|
|
11
|
-
this.eventBus.emit('emit', str1);
|
|
12
|
-
emitFunction(str1);
|
|
13
|
-
},
|
|
14
|
-
"response": (stack, context, vm) => {
|
|
15
|
-
const [num1, str1] = tzo_1.getStackParams("response", ["number", "string"], stack);
|
|
16
|
-
const response = { response: str1, pc: num1 };
|
|
17
|
-
this.eventBus.emit('response', response);
|
|
18
|
-
this.responses.push(response);
|
|
19
|
-
},
|
|
20
|
-
"getResponse": (stack, context, vm) => {
|
|
21
|
-
vm.suspend();
|
|
22
|
-
const choices = this.responses.map((resp, index) => { return { title: resp.response, programCounter: resp.pc, id: index }; });
|
|
23
|
-
const sChoices = choices.map(c => ({ title: c.title, id: c.id }));
|
|
24
|
-
while (this.responses.length > 0) { // clear responses, so that current responses won't appear again next time
|
|
25
|
-
this.responses.pop();
|
|
26
|
-
}
|
|
27
|
-
getResponseFunction(sChoices).then(choiceID => {
|
|
28
|
-
const choice = choices.find(c => c.id === choiceID);
|
|
29
|
-
if (choice === undefined) {
|
|
30
|
-
throw new Error(`Unknown choice ID: ${choiceID}!`);
|
|
31
|
-
}
|
|
32
|
-
vm.stack.push(choice.programCounter);
|
|
33
|
-
vm.run();
|
|
34
|
-
}).catch(e => {
|
|
35
|
-
this.eventBus.emit('error', e);
|
|
36
|
-
this.quit();
|
|
37
|
-
});
|
|
38
|
-
},
|
|
39
|
-
"optionEnabled": (stack, context, vm) => {
|
|
40
|
-
// DEPRECATED - do not use!
|
|
41
|
-
console.warn("optionEnabled opcode is deprecated! - do not use!");
|
|
42
|
-
const [str1] = tzo_1.getStackParams("optionEnabled", ["string"], stack);
|
|
43
|
-
const optstr = `optionEnabled_${str1}`;
|
|
44
|
-
let retval = null;
|
|
45
|
-
if (vm.context[optstr] === undefined) {
|
|
46
|
-
vm.context[optstr] = 1;
|
|
47
|
-
retval = 1;
|
|
48
|
-
}
|
|
49
|
-
else {
|
|
50
|
-
retval = vm.context[optstr];
|
|
51
|
-
}
|
|
52
|
-
stack.push(retval);
|
|
53
|
-
},
|
|
54
|
-
"optionDisabled": (stack, context, vm) => {
|
|
55
|
-
// DEPRECATED - do not use!
|
|
56
|
-
console.warn("optionDisabled opcode is deprecated! - do not use!");
|
|
57
|
-
const [str1] = tzo_1.getStackParams("optionDisabled", ["string"], stack);
|
|
58
|
-
const optstr = `optionEnabled_${str1}`;
|
|
59
|
-
let retval = null;
|
|
60
|
-
if (vm.context[optstr] === undefined) {
|
|
61
|
-
vm.context[optstr] = 1;
|
|
62
|
-
retval = 0;
|
|
63
|
-
}
|
|
64
|
-
else {
|
|
65
|
-
retval = vm.context[optstr] === 1 ? 0 : 1;
|
|
66
|
-
}
|
|
67
|
-
stack.push(retval);
|
|
68
|
-
},
|
|
69
|
-
"disableOption": (stack, context, vm) => {
|
|
70
|
-
// DEPRECATED - do not use!
|
|
71
|
-
console.warn("disableOption opcode is deprecated! - do not use!");
|
|
72
|
-
const [str1] = tzo_1.getStackParams("disableOption", ["string"], stack);
|
|
73
|
-
const optstr = `optionEnabled_${str1}`;
|
|
74
|
-
vm.context[optstr] = 0;
|
|
75
|
-
},
|
|
76
|
-
"enableOption": (stack, context, vm) => {
|
|
77
|
-
// DEPRECATED - do not use!
|
|
78
|
-
console.warn("enableOption opcode is deprecated! - do not use!");
|
|
79
|
-
const [str1] = tzo_1.getStackParams("enableOption", ["string"], stack);
|
|
80
|
-
const optstr = `optionEnabled_${str1}`;
|
|
81
|
-
vm.context[optstr] = 1;
|
|
82
|
-
},
|
|
83
|
-
}));
|
|
84
|
-
this.responses = [];
|
|
85
|
-
this.eventBus = new events_1.EventEmitter();
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
exports.QuestVM = QuestVM;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.QuestVM = void 0;
|
|
4
|
+
const events_1 = require("events");
|
|
5
|
+
const tzo_1 = require("tzo");
|
|
6
|
+
class QuestVM extends tzo_1.VM {
|
|
7
|
+
constructor(emitFunction, getResponseFunction, additionalFunctions) {
|
|
8
|
+
super({}, Object.assign(Object.assign({}, (additionalFunctions || {})), {
|
|
9
|
+
"emit": (stack) => {
|
|
10
|
+
const [str1] = tzo_1.getStackParams("emit", ["string | number"], stack);
|
|
11
|
+
this.eventBus.emit('emit', str1);
|
|
12
|
+
emitFunction(str1);
|
|
13
|
+
},
|
|
14
|
+
"response": (stack, context, vm) => {
|
|
15
|
+
const [num1, str1] = tzo_1.getStackParams("response", ["number", "string"], stack);
|
|
16
|
+
const response = { response: str1, pc: num1 };
|
|
17
|
+
this.eventBus.emit('response', response);
|
|
18
|
+
this.responses.push(response);
|
|
19
|
+
},
|
|
20
|
+
"getResponse": (stack, context, vm) => {
|
|
21
|
+
vm.suspend();
|
|
22
|
+
const choices = this.responses.map((resp, index) => { return { title: resp.response, programCounter: resp.pc, id: index }; });
|
|
23
|
+
const sChoices = choices.map(c => ({ title: c.title, id: c.id }));
|
|
24
|
+
while (this.responses.length > 0) { // clear responses, so that current responses won't appear again next time
|
|
25
|
+
this.responses.pop();
|
|
26
|
+
}
|
|
27
|
+
getResponseFunction(sChoices).then(choiceID => {
|
|
28
|
+
const choice = choices.find(c => c.id === choiceID);
|
|
29
|
+
if (choice === undefined) {
|
|
30
|
+
throw new Error(`Unknown choice ID: ${choiceID}!`);
|
|
31
|
+
}
|
|
32
|
+
vm.stack.push(choice.programCounter);
|
|
33
|
+
vm.run();
|
|
34
|
+
}).catch(e => {
|
|
35
|
+
this.eventBus.emit('error', e);
|
|
36
|
+
this.quit();
|
|
37
|
+
});
|
|
38
|
+
},
|
|
39
|
+
"optionEnabled": (stack, context, vm) => {
|
|
40
|
+
// DEPRECATED - do not use!
|
|
41
|
+
console.warn("optionEnabled opcode is deprecated! - do not use!");
|
|
42
|
+
const [str1] = tzo_1.getStackParams("optionEnabled", ["string"], stack);
|
|
43
|
+
const optstr = `optionEnabled_${str1}`;
|
|
44
|
+
let retval = null;
|
|
45
|
+
if (vm.context[optstr] === undefined) {
|
|
46
|
+
vm.context[optstr] = 1;
|
|
47
|
+
retval = 1;
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
retval = vm.context[optstr];
|
|
51
|
+
}
|
|
52
|
+
stack.push(retval);
|
|
53
|
+
},
|
|
54
|
+
"optionDisabled": (stack, context, vm) => {
|
|
55
|
+
// DEPRECATED - do not use!
|
|
56
|
+
console.warn("optionDisabled opcode is deprecated! - do not use!");
|
|
57
|
+
const [str1] = tzo_1.getStackParams("optionDisabled", ["string"], stack);
|
|
58
|
+
const optstr = `optionEnabled_${str1}`;
|
|
59
|
+
let retval = null;
|
|
60
|
+
if (vm.context[optstr] === undefined) {
|
|
61
|
+
vm.context[optstr] = 1;
|
|
62
|
+
retval = 0;
|
|
63
|
+
}
|
|
64
|
+
else {
|
|
65
|
+
retval = vm.context[optstr] === 1 ? 0 : 1;
|
|
66
|
+
}
|
|
67
|
+
stack.push(retval);
|
|
68
|
+
},
|
|
69
|
+
"disableOption": (stack, context, vm) => {
|
|
70
|
+
// DEPRECATED - do not use!
|
|
71
|
+
console.warn("disableOption opcode is deprecated! - do not use!");
|
|
72
|
+
const [str1] = tzo_1.getStackParams("disableOption", ["string"], stack);
|
|
73
|
+
const optstr = `optionEnabled_${str1}`;
|
|
74
|
+
vm.context[optstr] = 0;
|
|
75
|
+
},
|
|
76
|
+
"enableOption": (stack, context, vm) => {
|
|
77
|
+
// DEPRECATED - do not use!
|
|
78
|
+
console.warn("enableOption opcode is deprecated! - do not use!");
|
|
79
|
+
const [str1] = tzo_1.getStackParams("enableOption", ["string"], stack);
|
|
80
|
+
const optstr = `optionEnabled_${str1}`;
|
|
81
|
+
vm.context[optstr] = 1;
|
|
82
|
+
},
|
|
83
|
+
}));
|
|
84
|
+
this.responses = [];
|
|
85
|
+
this.eventBus = new events_1.EventEmitter();
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
exports.QuestVM = QuestVM;
|
|
89
89
|
//# sourceMappingURL=QuestVM.js.map
|
package/dist/node/cli.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
export {};
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
export {};
|
package/dist/node/cli.js
CHANGED
|
@@ -1,77 +1,80 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
"use strict";
|
|
3
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
4
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
5
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
6
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
7
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
8
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
9
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
10
|
-
});
|
|
11
|
-
};
|
|
12
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
13
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
14
|
-
};
|
|
15
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
-
const fs_1 = __importDefault(require("fs"));
|
|
17
|
-
const commander_1 = __importDefault(require("commander"));
|
|
18
|
-
const parseMarkdown_1 = require("./parseMarkdown");
|
|
19
|
-
const QuestVM_1 = require("./QuestVM");
|
|
20
|
-
const inquirer_1 = __importDefault(require("inquirer"));
|
|
21
|
-
const node_fetch_1 = __importDefault(require("node-fetch"));
|
|
22
|
-
commander_1.default
|
|
23
|
-
.version('0.0.
|
|
24
|
-
.option('-c, --clear', 'Clear console on each state')
|
|
25
|
-
.option('--input <path>', "Load source .md or .json file from path. Path can be either from local filesystem, or via HTTP(S) URL")
|
|
26
|
-
.option('--output <path>', "Emit VMState .json file")
|
|
27
|
-
.option('--no-run', "Do not actually load and run the VM; just parse input and (optionally) emit output")
|
|
28
|
-
.parse(process.argv);
|
|
29
|
-
if (!commander_1.default.input) {
|
|
30
|
-
console.log("Missing input! Please specify an input file via --input");
|
|
31
|
-
process.exit(1);
|
|
32
|
-
}
|
|
33
|
-
function load() {
|
|
34
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
35
|
-
let input_file;
|
|
36
|
-
if (commander_1.default.input.startsWith("http://") || commander_1.default.input.startsWith("https://")) {
|
|
37
|
-
const res = yield node_fetch_1.default(commander_1.default.input);
|
|
38
|
-
input_file = yield res.text();
|
|
39
|
-
}
|
|
40
|
-
else {
|
|
41
|
-
const input_file_buf = yield fs_1.default.promises.readFile(commander_1.default.input);
|
|
42
|
-
input_file = input_file_buf.toString();
|
|
43
|
-
}
|
|
44
|
-
return input_file;
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
|
-
(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
48
|
-
const input_file = yield load();
|
|
49
|
-
const vm = new QuestVM_1.QuestVM(body => {
|
|
50
|
-
process.stdout.write(`${body}`);
|
|
51
|
-
}, (choices) => {
|
|
52
|
-
process.stdout.write("\n"); // add newline to make inquirer not overwrie any previously emitted text
|
|
53
|
-
return inquirer_1.default.prompt([{
|
|
54
|
-
type: "list",
|
|
55
|
-
name: "selectedChoice",
|
|
56
|
-
message: " ",
|
|
57
|
-
choices: choices.map(c => ({ name: c.title, value: c.id }))
|
|
58
|
-
}]).then(answers => {
|
|
59
|
-
return answers.selectedChoice;
|
|
60
|
-
});
|
|
61
|
-
}, {});
|
|
62
|
-
let vmState = undefined;
|
|
63
|
-
if (commander_1.default.input.endsWith(".json")) {
|
|
64
|
-
vmState = JSON.parse(input_file);
|
|
65
|
-
}
|
|
66
|
-
else if (commander_1.default.input.endsWith(".md")) {
|
|
67
|
-
vmState = parseMarkdown_1.parseMarkdown(input_file).qvmState;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
}
|
|
72
|
-
if (commander_1.default.
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
4
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
5
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
6
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
7
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
8
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
9
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
10
|
+
});
|
|
11
|
+
};
|
|
12
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
13
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
14
|
+
};
|
|
15
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
+
const fs_1 = __importDefault(require("fs"));
|
|
17
|
+
const commander_1 = __importDefault(require("commander"));
|
|
18
|
+
const parseMarkdown_1 = require("./parseMarkdown");
|
|
19
|
+
const QuestVM_1 = require("./QuestVM");
|
|
20
|
+
const inquirer_1 = __importDefault(require("inquirer"));
|
|
21
|
+
const node_fetch_1 = __importDefault(require("node-fetch"));
|
|
22
|
+
commander_1.default
|
|
23
|
+
.version('0.0.37')
|
|
24
|
+
.option('-c, --clear', 'Clear console on each state')
|
|
25
|
+
.option('--input <path>', "Load source .md or .json file from path. Path can be either from local filesystem, or via HTTP(S) URL")
|
|
26
|
+
.option('--output <path>', "Emit VMState .json file")
|
|
27
|
+
.option('--no-run', "Do not actually load and run the VM; just parse input and (optionally) emit output")
|
|
28
|
+
.parse(process.argv);
|
|
29
|
+
if (!commander_1.default.input) {
|
|
30
|
+
console.log("Missing input! Please specify an input file via --input");
|
|
31
|
+
process.exit(1);
|
|
32
|
+
}
|
|
33
|
+
function load() {
|
|
34
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
35
|
+
let input_file;
|
|
36
|
+
if (commander_1.default.input.startsWith("http://") || commander_1.default.input.startsWith("https://")) {
|
|
37
|
+
const res = yield node_fetch_1.default(commander_1.default.input);
|
|
38
|
+
input_file = yield res.text();
|
|
39
|
+
}
|
|
40
|
+
else {
|
|
41
|
+
const input_file_buf = yield fs_1.default.promises.readFile(commander_1.default.input);
|
|
42
|
+
input_file = input_file_buf.toString();
|
|
43
|
+
}
|
|
44
|
+
return input_file;
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
48
|
+
const input_file = yield load();
|
|
49
|
+
const vm = new QuestVM_1.QuestVM(body => {
|
|
50
|
+
process.stdout.write(`${body}`);
|
|
51
|
+
}, (choices) => {
|
|
52
|
+
process.stdout.write("\n"); // add newline to make inquirer not overwrie any previously emitted text
|
|
53
|
+
return inquirer_1.default.prompt([{
|
|
54
|
+
type: "list",
|
|
55
|
+
name: "selectedChoice",
|
|
56
|
+
message: " ",
|
|
57
|
+
choices: choices.map(c => ({ name: c.title, value: c.id }))
|
|
58
|
+
}]).then(answers => {
|
|
59
|
+
return answers.selectedChoice;
|
|
60
|
+
});
|
|
61
|
+
}, {});
|
|
62
|
+
let vmState = undefined;
|
|
63
|
+
if (commander_1.default.input.endsWith(".json")) {
|
|
64
|
+
vmState = JSON.parse(input_file);
|
|
65
|
+
}
|
|
66
|
+
else if (commander_1.default.input.endsWith(".qmd") || commander_1.default.input.endsWith(".qmd.html") || commander_1.default.input.endsWith(".md") || commander_1.default.input.endsWith(".md.html")) {
|
|
67
|
+
vmState = parseMarkdown_1.parseMarkdown(input_file).qvmState;
|
|
68
|
+
}
|
|
69
|
+
else {
|
|
70
|
+
throw new Error("Program input file needs to have .json or .qmd / .qmd.html / .md / .md.html extension!");
|
|
71
|
+
}
|
|
72
|
+
if (commander_1.default.output) {
|
|
73
|
+
fs_1.default.writeFileSync(commander_1.default.output, JSON.stringify(vmState, null, 2));
|
|
74
|
+
}
|
|
75
|
+
if (commander_1.default.run) {
|
|
76
|
+
vm.loadVMState(vmState);
|
|
77
|
+
vm.run();
|
|
78
|
+
}
|
|
79
|
+
}))();
|
|
77
80
|
//# sourceMappingURL=cli.js.map
|
package/dist/node/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../../src/cli.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAEA,4CAAoB;AACpB,0DAAgC;AAChC,mDAAgD;AAChD,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CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE;YACjB,OAAO,OAAO,CAAC,cAAc,CAAC;QAChC,CAAC,CAAC,CAAC;IACL,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,IAAI,OAAO,GAAe,SAAS,CAAC;IAEpC,IAAI,mBAAO,CAAC,KAAK,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE;QACnC,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,UAAU,CAAe,CAAC;KAChD;SAAM,IAAI,mBAAO,CAAC,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,mBAAO,CAAC,KAAK,CAAC,QAAQ,CAAC,WAAW,CAAC,IAAI,mBAAO,CAAC,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,mBAAO,CAAC,KAAK,CAAC,QAAQ,CAAC,UAAU,CAAC,EAAE;QACvJ,OAAO,GAAG,6BAAa,CAAC,UAAU,CAAC,CAAC,QAAQ,CAAC;KAC9C;SAAM;QACL,MAAM,IAAI,KAAK,CAAC,wFAAwF,CAAC,CAAA;KAC1G;IAED,IAAI,mBAAO,CAAC,MAAM,EAAE;QAClB,YAAE,CAAC,aAAa,CAAC,mBAAO,CAAC,MAAM,EAAE,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;KACpE;IAED,IAAI,mBAAO,CAAC,GAAG,EAAE;QACf,EAAE,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;QACxB,EAAE,CAAC,GAAG,EAAE,CAAC;KACV;AACH,CAAC,CAAA,CAAC,EAAE,CAAC"}
|
package/dist/node/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from "./QuestVM";
|
|
2
|
-
export * from "./parseMarkdown";
|
|
1
|
+
export * from "./QuestVM";
|
|
2
|
+
export * from "./parseMarkdown";
|
package/dist/node/index.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
-
}) : (function(o, m, k, k2) {
|
|
6
|
-
if (k2 === undefined) k2 = k;
|
|
7
|
-
o[k2] = m[k];
|
|
8
|
-
}));
|
|
9
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
10
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
|
-
};
|
|
12
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
-
__exportStar(require("./QuestVM"), exports);
|
|
14
|
-
__exportStar(require("./parseMarkdown"), exports);
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
10
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
|
+
};
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
__exportStar(require("./QuestVM"), exports);
|
|
14
|
+
__exportStar(require("./parseMarkdown"), exports);
|
|
15
15
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
import removePosition from "unist-util-remove-position";
|
|
2
|
-
import { Node } from "unist";
|
|
3
|
-
import 'array-flat-polyfill';
|
|
4
|
-
import { TzoVMState } from "tzo";
|
|
5
|
-
export declare type Directive = string;
|
|
6
|
-
export declare type OptionNode = Node & {
|
|
7
|
-
type: "option";
|
|
8
|
-
directives: null | Directive[];
|
|
9
|
-
preconditionChildren: null | Node[];
|
|
10
|
-
effectChildren: null | Node[];
|
|
11
|
-
text: null | string;
|
|
12
|
-
link: null | string;
|
|
13
|
-
};
|
|
14
|
-
export declare type QuestMarkVMState = Node & TzoVMState;
|
|
15
|
-
export declare enum NoLinkBehaviour {
|
|
16
|
-
EXIT = 0,
|
|
17
|
-
LOOPBACK_TO_OPTIONS = 1
|
|
18
|
-
}
|
|
19
|
-
export declare function parseMarkdown(file_contents: string): {
|
|
20
|
-
parsedMDFile: removePosition.NodeWithoutPosition;
|
|
21
|
-
qvmState: {
|
|
22
|
-
type: "questmarkVMState";
|
|
23
|
-
children: any[];
|
|
24
|
-
} & TzoVMState;
|
|
25
|
-
};
|
|
1
|
+
import removePosition from "unist-util-remove-position";
|
|
2
|
+
import { Node } from "unist";
|
|
3
|
+
import 'array-flat-polyfill';
|
|
4
|
+
import { TzoVMState } from "tzo";
|
|
5
|
+
export declare type Directive = string;
|
|
6
|
+
export declare type OptionNode = Node & {
|
|
7
|
+
type: "option";
|
|
8
|
+
directives: null | Directive[];
|
|
9
|
+
preconditionChildren: null | Node[];
|
|
10
|
+
effectChildren: null | Node[];
|
|
11
|
+
text: null | string;
|
|
12
|
+
link: null | string;
|
|
13
|
+
};
|
|
14
|
+
export declare type QuestMarkVMState = Node & TzoVMState;
|
|
15
|
+
export declare enum NoLinkBehaviour {
|
|
16
|
+
EXIT = 0,
|
|
17
|
+
LOOPBACK_TO_OPTIONS = 1
|
|
18
|
+
}
|
|
19
|
+
export declare function parseMarkdown(file_contents: string): {
|
|
20
|
+
parsedMDFile: removePosition.NodeWithoutPosition;
|
|
21
|
+
qvmState: {
|
|
22
|
+
type: "questmarkVMState";
|
|
23
|
+
children: any[];
|
|
24
|
+
} & TzoVMState;
|
|
25
|
+
};
|