Skip to content

Commit

Permalink
Add vm.exports.i_will_not_ask_for_help_when_these_break() (#181)
Browse files Browse the repository at this point in the history
  • Loading branch information
GarboMuffin authored Jan 28, 2024
1 parent a15c069 commit ec1f7de
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/compiler/compile.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const IRGenerator = require('./irgen');
const {IRGenerator} = require('./irgen');
const JSGenerator = require('./jsgen');

const compile = thread => {
Expand Down
5 changes: 4 additions & 1 deletion src/compiler/irgen.js
Original file line number Diff line number Diff line change
Expand Up @@ -1693,4 +1693,7 @@ class IRGenerator {
}
}

module.exports = IRGenerator;
module.exports = {
ScriptTreeGenerator,
IRGenerator
};
3 changes: 3 additions & 0 deletions src/engine/thread.js
Original file line number Diff line number Diff line change
Expand Up @@ -514,4 +514,7 @@ class Thread {
}
}

// for extensions
Thread._StackFrame = _StackFrame;

module.exports = Thread;
12 changes: 11 additions & 1 deletion src/virtual-machine.js
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,17 @@ class VirtualMachine extends EventEmitter {
this.exports = {
Sprite,
RenderedTarget,
JSZip
JSZip,

i_will_not_ask_for_help_when_these_break: () => {
console.warn('You are using unsupported APIs. WHEN your code breaks, do not expect help.');
return ({
JSGenerator: require('./compiler/jsgen.js'),
IRGenerator: require('./compiler/irgen.js').IRGenerator,
ScriptTreeGenerator: require('./compiler/irgen.js').ScriptTreeGenerator,
Thread: require('./engine/thread.js')
});
}
};
}

Expand Down

2 comments on commit ec1f7de

@GarboMuffin
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

notice the lack of tests: absolutely no promises that these will work a week from now or that I won't change the name of the exports if I'm in a bad mood some day

@yuri-kiss
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thats ok, im just glad they are merged 👍

Please sign in to comment.