enable legacy babel5 module interop for compiler

pull/98/head
dperolio 2 years ago
parent 1daa518b35
commit 971bdfa31b
No known key found for this signature in database
GPG Key ID: 4191689562D51409

@ -68,8 +68,8 @@ electron.protocol.registerSchemesAsPrivileged([
electron.app.once('ready', () => { electron.app.once('ready', () => {
if (reactDeveloperTools) { if (reactDeveloperTools) {
installExtension(REACT_DEVELOPER_TOOLS) installExtension(REACT_DEVELOPER_TOOLS)
.then(name => console.log(`Added Extension: ${name}`)) .then(name => console.log(`Added Extension: ${name}`))
.catch(err => console.error('An error occurred: ', err)); .catch(err => console.error(`An error occurred: ${err}`));
} }
/** /**
* @todo Possibly add whitelists instead of just disabling CSP. * @todo Possibly add whitelists instead of just disabling CSP.

@ -75,7 +75,7 @@ require('./renderer');
/** /**
* Instantiate Vizality. * Instantiate Vizality.
*/ */
const Vizality = require('../renderer/src').default; const Vizality = require('../renderer/src');
window.vizality = new Vizality(); window.vizality = new Vizality();
/** /**

@ -75,7 +75,7 @@ const WHITELISTED_MODULES = [
if (window && !window.__SPLASH__) { if (window && !window.__SPLASH__) {
window.require = module => { window.require = module => {
try { try {
if (WHITELISTED_MODULES.includes(module) || module.startsWith('@vizality')) { if (WHITELISTED_MODULES.includes(module) || module.startsWith('@vizality') || module.startsWith('@discord')) {
return require(module); return require(module);
} }
throw new Error(`Node module "${module.toString()}" is not whitelisted and cannot be used in this scope.`); throw new Error(`Node module "${module.toString()}" is not whitelisted and cannot be used in this scope.`);

@ -12,6 +12,7 @@ module.exports = class JS extends Compiler {
const js = readFileSync(this.file, 'utf8'); const js = readFileSync(this.file, 'utf8');
return sucrase.transform(js, { return sucrase.transform(js, {
transforms: [ 'jsx', 'imports' ], transforms: [ 'jsx', 'imports' ],
enableLegacyBabel5ModuleInterop: true,
filePath: this.file filePath: this.file
}).code; }).code;
} }

@ -12,6 +12,7 @@ module.exports = class JSX extends Compiler {
const jsx = readFileSync(this.file, 'utf8'); const jsx = readFileSync(this.file, 'utf8');
return sucrase.transform(jsx, { return sucrase.transform(jsx, {
transforms: [ 'jsx', 'imports' ], transforms: [ 'jsx', 'imports' ],
enableLegacyBabel5ModuleInterop: true,
filePath: this.file filePath: this.file
}).code; }).code;
} }

@ -12,6 +12,7 @@ module.exports = class TS extends Compiler {
const ts = readFileSync(this.file, 'utf8'); const ts = readFileSync(this.file, 'utf8');
return sucrase.transform(ts, { return sucrase.transform(ts, {
transforms: [ 'jsx', 'imports', 'typescript' ], transforms: [ 'jsx', 'imports', 'typescript' ],
enableLegacyBabel5ModuleInterop: true,
filePath: this.file filePath: this.file
}).code; }).code;
} }

@ -12,6 +12,7 @@ module.exports = class TSX extends Compiler {
const tsx = readFileSync(this.file, 'utf8'); const tsx = readFileSync(this.file, 'utf8');
return sucrase.transform(tsx, { return sucrase.transform(tsx, {
transforms: [ 'jsx', 'imports', 'typescript' ], transforms: [ 'jsx', 'imports', 'typescript' ],
enableLegacyBabel5ModuleInterop: true,
filePath: this.file filePath: this.file
}).code; }).code;
} }

Loading…
Cancel
Save