From 6efe490429e6565d950c118bab0498b2edffd2f2 Mon Sep 17 00:00:00 2001 From: JensLincke Date: Wed, 7 Feb 2024 12:49:14 +0100 Subject: [PATCH] allow to disbale aexpr in workspaces again and fix stack tests SQUASHED: AUTO-COMMIT-src-client-lively.js,AUTO-COMMIT-src-client-preferences.js,AUTO-COMMIT-src-plugin-babel.js,AUTO-COMMIT-test-stack-test.js, --- src/client/lively.js | 4 ++++ src/client/preferences.js | 2 +- src/plugin-babel.js | 36 +++++++++++++++++++----------------- test/stack-test.js | 4 ++-- 4 files changed, 26 insertions(+), 20 deletions(-) diff --git a/src/client/lively.js b/src/client/lively.js index ba9a0d30c..51a9c6d86 100644 --- a/src/client/lively.js +++ b/src/client/lively.js @@ -2092,6 +2092,10 @@ export default class Lively { static async onBodyPositionPreference(pos) { lively.setPosition(document.body, pos); } + + static async onDisableAExpWorkspacePreference(workspaceDisabled) { + localStorage.setItem("DisableAExpWorkspace", workspaceDisabled) + } static async onEnableAEDebuggingPreference(debuggingEnabled) { if (self.lively4isLoading) return // no recompile needed diff --git a/src/client/preferences.js b/src/client/preferences.js index c75b6426c..2823a6f84 100644 --- a/src/client/preferences.js +++ b/src/client/preferences.js @@ -22,7 +22,7 @@ export default class Preferences { InteractiveLayer: {default: false, short: "dev methods"}, ShowDocumentGrid: {default: true, short: "show grid"}, UseRP19JSX: {default: false, short: "use rp19 implementation for jsx"}, - /* DisableAExpWorkspace: {default: false, short: "disable AExp in workspace"}, */ + DisableAExpWorkspace: {default: false, short: "disable AExp in workspace"}, UseProxiesForAExprs: {default: false, short: "proxy-based Active Expressions"}, EnableAEDebugging: {default: true, short: "enable Active Expression debugging"}, SmartAELogging: {default: true, short: "Only log events for interesting Active Expressions"}, diff --git a/src/plugin-babel.js b/src/plugin-babel.js index 859726f24..36d25d1a4 100644 --- a/src/plugin-babel.js +++ b/src/plugin-babel.js @@ -486,24 +486,26 @@ async function workspacePlugins(options = {}) { result.push(...await doitPlugins()) - result.push(...[ - await importDefaultOf('babel-plugin-var-recorder'), - [await importDefaultOf('babel-plugin-ILA'), { - executedIn: 'file' - }], - [await importDefaultOf('babel-plugin-databindings'), { - executedIn: 'file' - }], - [await importDefaultOf('babel-plugin-active-expression-rewriting'), { - executedIn: 'workspace' - }], - [await importDefaultOf('babel-plugin-databindings-post-process'), { - executedIn: 'file' - }], - [await importDefaultOf('babel-plugin-active-expression-proxies'), { + + result.push(await importDefaultOf('babel-plugin-var-recorder')) + + if (!localStorage.getItem("DisableAExpWorkspace")) { + result.push(await importDefaultOf('babel-plugin-ILA'), { + executedIn: 'file' + }) + result.push(await importDefaultOf('babel-plugin-databindings'), { + executedIn: 'file' + }) + result.push(await importDefaultOf('babel-plugin-active-expression-rewriting'), { + executedIn: 'workspace' + }) + result.push(await importDefaultOf('babel-plugin-databindings-post-process'), { + executedIn: 'file' + }) + result.push(await importDefaultOf('babel-plugin-active-expression-proxies'), { executedIn: 'workspace' - }] - ]) + }) + } if (!options.fortesting) { result.push(babel7.babelPluginProposalDynamicImport) result.push([babel7.babelPluginTransformModulesSystemJS, { diff --git a/test/stack-test.js b/test/stack-test.js index 37767beae..6141cc526 100644 --- a/test/stack-test.js +++ b/test/stack-test.js @@ -171,7 +171,7 @@ stack; }; const stack = o.myGetter; - expect(stack.getFrame(0).func).to.equal('get myGetter [as myGetter]'); + expect(stack.getFrame(0).func).to.equal('get myGetter'); }); it('static getter', () => { @@ -183,7 +183,7 @@ stack; } const stack = AClass.myStaticGetter; - expect(stack.getFrame(0).func).to.equal('get myStaticGetter [as myStaticGetter]'); + expect(stack.getFrame(0).func).to.equal('get myStaticGetter'); }); it('new as property name', () => {