mirror of
https://github.com/nodejs/node.git
synced 2026-11-09 15:11:11 -05:00
PR-URL: https://github.com/nodejs/node/pull/39094 Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
24 lines
525 B
JavaScript
24 lines
525 B
JavaScript
const path = require("path");
|
|
|
|
let send;
|
|
exports.getVersion = sendCached("GET_VERSION");
|
|
exports.getTypesInfo = sendCached("GET_TYPES_INFO");
|
|
exports.getVisitorKeys = sendCached("GET_VISITOR_KEYS");
|
|
exports.getTokLabels = sendCached("GET_TOKEN_LABELS");
|
|
|
|
exports.maybeParse = (code, options) => send("MAYBE_PARSE", {
|
|
code,
|
|
options
|
|
});
|
|
|
|
function sendCached(action) {
|
|
let cache = null;
|
|
return () => {
|
|
if (!cache) cache = send(action, undefined);
|
|
return cache;
|
|
};
|
|
}
|
|
|
|
{
|
|
send = require("./worker/index.cjs");
|
|
} |