Skip to content

New debug and feature flag infrastructure#15043

Merged
rwjblue merged 2 commits intoemberjs:masterfrom
chadhietala:the-yak-has-no-hair
Mar 26, 2017
Merged

New debug and feature flag infrastructure#15043
rwjblue merged 2 commits intoemberjs:masterfrom
chadhietala:the-yak-has-no-hair

Conversation

@chadhietala
Copy link
Contributor

@chadhietala chadhietala commented Mar 20, 2017

This introduces new code stripping infrastructure to lead the way for Project Svelte.

@chadhietala chadhietala changed the title New debug flags [WIP] New debug flags Mar 20, 2017
@homu
Copy link
Contributor

homu commented Mar 21, 2017

☔ The latest upstream changes (presumably #15037) made this pull request unmergeable. Please resolve the merge conflicts.

@chadhietala chadhietala force-pushed the the-yak-has-no-hair branch 2 times, most recently from 7f92588 to 3b45a3d Compare March 23, 2017 19:53
package.json Outdated
"@glimmer/reference": "^0.22.0",
"@glimmer/runtime": "^0.22.0",
"@glimmer/util": "^0.22.0",
"babel-plugin-minify-dead-code-elimination": "^0.1.4",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fix this

const WriteFile = require('broccoli-file-creator');
const StringReplace = require('broccoli-string-replace');
const { RELEASE, DEBUG } = require('./features');
const { RELEASE, DEBUG, toConst } = require('./features');
Copy link
Contributor

Choose a reason for hiding this comment

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

is RELEASE not just !DEBUG?

Copy link
Contributor

Choose a reason for hiding this comment

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

nevermind, I see this isn't a bool

@chadhietala chadhietala force-pushed the the-yak-has-no-hair branch 5 times, most recently from b420df0 to f747349 Compare March 24, 2017 02:54
@chadhietala chadhietala changed the title [WIP] New debug flags New debug flags Mar 24, 2017
@chadhietala chadhietala force-pushed the the-yak-has-no-hair branch from f747349 to 533db41 Compare March 24, 2017 02:55
@chadhietala chadhietala changed the title New debug flags New debug infrastructure Mar 24, 2017
@chadhietala chadhietala requested a review from rwjblue March 24, 2017 03:18
@chadhietala chadhietala changed the title New debug infrastructure New debug and feature flag infrastructure Mar 24, 2017
@rwjblue
Copy link
Member

rwjblue commented Mar 24, 2017

Can you share a tarball of a prod build so we can review?

Copy link
Member

@rwjblue rwjblue left a comment

Choose a reason for hiding this comment

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

Can you explain how features get enabled at runtime in both debug and prod builds in the new system (without rebuilding)?

export default FEATURES;

${Object.keys(FEATURES).map((feature) => {
return `export const ${feature.replace(/-/g, '_').toUpperCase()} = FEATURES["${feature}"];`
Copy link
Member

Choose a reason for hiding this comment

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

Isn't this what toConst was for?

options.plugins.push(['minify-dead-code-elimination', { 'optimizeRawSize': true }]);
}

// options.plugins.push(['transform-es2015-block-scoping', { 'throwIfClosureRequired': true }]);
Copy link
Member

Choose a reason for hiding this comment

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

What is this comment about?

let options = Object.assign({
environment: 'developement'
}, _options);
options.persist = false;
Copy link
Member

Choose a reason for hiding this comment

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

Do we really want to disable cross restart caching?

});

// This is testing that container was passed as an option
QUnit.test('A deprecated `container` property is appended to every object instantiated from a non-extendable factory, and a fake container is available during instantiation.', function() {
Copy link
Member

Choose a reason for hiding this comment

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

This test should not be removed. The container deprecation should still be tested.

Copy link
Member

Choose a reason for hiding this comment

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

Chad pointed out that this test was already basically skipped just below.

Element.prototype.webkitMatchesSelector);

export function matches(el, selector) {
debugger;
Copy link
Member

Choose a reason for hiding this comment

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

Left over from debugging?

@chadhietala chadhietala force-pushed the the-yak-has-no-hair branch from 533db41 to 7bf379b Compare March 24, 2017 16:20
@mmun
Copy link
Member

mmun commented Mar 25, 2017

This is really cool. I love that we can lean on dead code elimination for more complicated feature flagging combinations! :)

@rwjblue
Copy link
Member

rwjblue commented Mar 25, 2017

It does not seem possible to enable features at runtime with this at the moment, with this branch (but it does work on canary builds).

Demo JSBIN against locahost:4200
Demo JSBIN against canary

@chadhietala chadhietala force-pushed the the-yak-has-no-hair branch 2 times, most recently from b46540a to 02c475f Compare March 26, 2017 00:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants