speech-rule-engine
Version:
A standalone speech rule engine for XML structures, based on the original engine from ChromeVox.
56 lines • 2.02 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.SystemExternal = void 0;
const variables_js_1 = require("./variables.js");
const lib_external_js_1 = require("./lib_external.js");
const windowSupported = (() => !(typeof window === 'undefined'))();
const documentSupported = (() => windowSupported && !(typeof window.document === 'undefined'))();
const webworker = (() => !(typeof DedicatedWorkerGlobalScope === 'undefined'))();
const nodeRequire = () => {
try {
return eval('require');
}
catch (_err) {
return (_file) => null;
}
};
exports.SystemExternal = {
extRequire(library) {
if (typeof process !== 'undefined' && typeof require !== 'undefined') {
return nodeRequire()(library);
}
return null;
},
windowSupported: windowSupported,
documentSupported: documentSupported,
webworker: webworker,
xmldom: lib_external_js_1.xmldom,
document: lib_external_js_1.document,
fs: documentSupported || webworker ? null : nodeRequire()('fs'),
url: variables_js_1.Variables.url,
jsonPath: (function () {
if (documentSupported || webworker) {
return variables_js_1.Variables.url;
}
if (process.env.SRE_JSON_PATH || global.SRE_JSON_PATH) {
return process.env.SRE_JSON_PATH || global.SRE_JSON_PATH;
}
try {
const path = nodeRequire().resolve('speech-rule-engine');
return path.replace(/sre\.js$/, '') + 'mathmaps';
}
catch (_err) {
}
try {
const path = nodeRequire().resolve('.');
return path.replace(/sre\.js$/, '') + 'mathmaps';
}
catch (_err) {
}
return typeof __dirname !== 'undefined'
? __dirname + (__dirname.match(/lib?$/) ? '/mathmaps' : '/lib/mathmaps')
: process.cwd() + '/lib/mathmaps';
})(),
xpath: lib_external_js_1.xpath
};
//# sourceMappingURL=system_external.js.map