Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #854 - Make every .marko file a UI component #855

Merged
merged 7 commits into from
Sep 26, 2017

Conversation

patrick-steele-idem
Copy link
Contributor

Description

See: #854

Checklist:

  • My code follows the code style of this project.
  • I have updated/added documentation affected by my changes.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

Disclaimer: Contributions via GitHub pull requests are gladly accepted from their original author. Along with any pull requests, please state that the contribution is your original work and that you license the work to the project under the project's open source license. Whether or not you state this explicitly, by submitting any copyrighted material via pull request, email, or other means you agree to license the material under the project's open source license and warrant that you have the legal authority to do so.

@coveralls
Copy link

coveralls commented Sep 22, 2017

Coverage Status

Coverage decreased (-0.002%) to 90.014% when pulling 2b2ff0b on issue-854-component-all-the-things into 9d14008 on master.

@coveralls
Copy link

coveralls commented Sep 22, 2017

Coverage Status

Coverage decreased (-0.0009%) to 90.015% when pulling 1c3a9cd on issue-854-component-all-the-things into 9d14008 on master.

if (this._childTextNormalized) {
return;
}

this._childTextNormalized = true;

var trimStartEnd = this._trimStartEnd === true;
var trimStartEnd = forceTrimStartEnd === true || this._trimStartEnd === true;
Copy link
Member

Choose a reason for hiding this comment

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

Is this change necessary? It looks like it isn't being used (commented out in src/components/taglib/TransformHelper/handleRootNodes.js).


/**
* Controls whether or not a key should be assigned to all HTML
* and csutom tags at compile-time. The default is `true`
Copy link
Member

Choose a reason for hiding this comment

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

csutom -> custom typo

@@ -34,6 +34,13 @@ module.exports = function beginComponent(componentsContext, component, isSplitCo
return componentDef;
}

if (isImplicitComponent === true) {
Copy link
Member

Choose a reason for hiding this comment

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

Thoughts on moving this conditional above the one that is currently above it? Micro-optimization, but there's probably no sense in doing the bitwise operations above if this is true.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's actually going to be more common for the if condition on line 32 to evaluate to true so it's better to keep the if (isImplicitComponent === true) lower. Whether or not a UI component is implicit only matters if it is a top-level UI component outside of UI component that will re-render in the browser.

context.setFlag('hasComponentVar');

var getCurrentComponentVar = context.importModule('marko_getCurrentComponent',
this.getMarkoComponentsRequirePath('marko/components/taglib/helpers/getCurrentComponent'));
Copy link
Member

Choose a reason for hiding this comment

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

Can marko/components/taglib/helpers/getCurrentComponent.js be deleted now? I don't think it's being used anymore.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, we can delete it. Good catch.

@@ -92,7 +99,7 @@ module.exports = function handleComponentBind(options) {
if (rendererModule) {
if (rendererModule.inlineId) {
markoComponentVar = rendererModule.inlineId;
} else {
} else if (!isImplicitComponent) {
Copy link
Member

Choose a reason for hiding this comment

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

It's not possible for this to fall into an else case right? Otherwise markoComponentVar would be undefined. Maybe that's intended.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's okay if markoComponentVar is undefined. That is handled by markoComponentVar || builder.literal({}) later in the file.

<html><head><title>Welcome Frank<script>(function(){var w=window;w.$components=(w.$components||[]).concat({"w":[["s2",0,{},{"f":1}]],"t":["/marko-test$1.0.0/autotests/async-render/components-await-title/components/hello/index.marko"]})||w.$components})()</script></title></head><body><!--M#s2--><div>Hello</div><!--M/s2--></body></html>
Copy link
Member

Choose a reason for hiding this comment

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

Is it valid for this script tag to be inside the title?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've not noticed that was happening until now, but that is not going to be valid. I'll investigate.

@@ -1,79 +0,0 @@
module.exports = require('marko/legacy-components').defineComponent({
Copy link
Member

Choose a reason for hiding this comment

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

This is a breaking change... one which I think we need to make. If we're going to forgo semver, we should at least add deprecation warnings in the master branch and also in Marko 3 for any patterns covered by these deleted tests.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

For Marko v4, how long do the warnings need to be on the next patch version before we move this out of beta?

compiledFile = compiledFile.replace(/marko\/dist\//g, 'marko/src/');
expect(compiledFile).to.deep.equal(expectedFile);
helpers.compare(removeMarkoVersionComment(compiledFile), '.js');
Copy link
Member

Choose a reason for hiding this comment

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

In any other case, I would say stripping the comment is fine, but isn't this test supposed to be asserting the existence of the comment?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Perhaps. I will take a closer look.

@coveralls
Copy link

coveralls commented Sep 25, 2017

Coverage Status

Coverage increased (+0.1%) to 90.125% when pulling 1d69ea4 on issue-854-component-all-the-things into 9d14008 on master.

@patrick-steele-idem patrick-steele-idem merged commit 2ff5a25 into master Sep 26, 2017
@DylanPiercey DylanPiercey deleted the issue-854-component-all-the-things branch March 10, 2018 00:33
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.

4 participants