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
Ivy hello world with devserver #22788
Conversation
So there's good news and bad news. 👍 The good news is that everyone that needs to sign a CLA (the pull request submitter and all commit authors) have done so. Everything is all good there. 😕 The bad news is that it appears that one or more commits were authored by someone other than the pull request submitter. We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that here in the pull request. Note to project maintainer: This is a terminal state, meaning the |
95e23c0
to
d01ca41
Compare
bb2cd4d
to
d0b3131
Compare
d0b3131
to
f4f2494
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM aside from typo
} | ||
//TODO(misko): Forgeting to export HellWorld and not having NgModule fails silently. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typos: Forgeting -> Forgetting, HellWorld -> HelloWorld
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
0d3a6ee
to
0ac396d
Compare
WORKSPACE
Outdated
url = "https://github.com/bazelbuild/rules_nodejs/archive/0.5.3.zip", | ||
strip_prefix = "rules_nodejs-0.5.3", | ||
sha256 = "17a5515f59777b00cb25dbc710017a14273f825029b2ec60e0969d28914870be", | ||
url = "https://github.com/mhevery/rules_nodejs/archive/07c2cf1f04fa7b68220d730bc8df37ee9811b5e8.zip", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do you point to your repo here ?
Add comment with tracking issue.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That was a temporary work around until bazelbuild/rules_nodejs#158 got merged. It now points back to the main repo.
packages/core/src/render3/assert.ts
Outdated
@@ -52,6 +52,13 @@ export function assertNotNull<T>(actual: T, msg: string) { | |||
} | |||
} | |||
|
|||
export function assertComponentType(actual: any) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
other assert
s have a msg
parameter ? Would it make sense here ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What would the message say other than Expecting ComponentType but got something else.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It could be msg || "Expecting ComponentType but got something else"
and the callee could describe why there should be a component at that point. Would be consistent
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
@@ -113,9 +114,13 @@ export const NULL_INJECTOR: Injector = { | |||
* @param options Optional parameters which control bootstrapping | |||
*/ | |||
export function renderComponent<T>( | |||
componentType: ComponentType<T>, opts: CreateComponentOptions = {}): T { | |||
componentType: ComponentType<T>| | |||
Type<T>/* Type as workaround for: Microsoft/TypeScript/issues/4881 */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be a TODO...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don' think so. These are all over the code base, and there will have to be big clean up once that is resolved.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should ComponentType
be an union type with a TODO then ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, because then it would apply to all cases and we would lose type safety internally. We really just want it on the user code Ivy boundary.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Like a FromUserComponentType
?
@@ -136,7 +141,8 @@ export function renderComponent<T>( | |||
// Create element node at index 0 in data array | |||
elementNode = hostElement(hostNode, componentDef); | |||
// Create directive instance with n() and store at index 1 in data array (el is 0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
look like this comment is a little out of sync with the code now ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
name = 'World'; | ||
} | ||
// TODO(misko): Forgetting to export HelloWorld and not having NgModule fails silently. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tracking issue ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will be working on Ivy backlog and this will be included there. Don't have issue # yet.
fnDepth++; | ||
if (fnDepth <= 1) { | ||
// Only go into function expression once for the outer closure. | ||
fnRecurseDepth++; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
don't you ever need to --
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good catch, added.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we need the test to be updated ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For this to fail, we would have to have more than one top level closure, which does not happen in real life. Not sure that would be useful, what do you think.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would update the test but it's up to you.
* Rollup produces this format when it wants to export symbols from a bundle. | ||
* @param child | ||
*/ | ||
function isStoringIIFE(child: ts.VariableDeclarationList): boolean { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
isRollupExportSymbol()
as it seems super specific to this use case ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
changed.
if (child.declarations.length !== 1) return false; | ||
const decl: ts.VariableDeclaration = child.declarations[0]; | ||
if (decl.initializer && decl.initializer.kind == ts.SyntaxKind.CallExpression) { | ||
return true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: return !!decl.initializer && decl.initializer.kind == ts.SyntaxKind.CallExpression;
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
* Use of this source code is governed by an MIT-style license that can be | ||
* found in the LICENSE file at https://angular.io/license | ||
*/ | ||
var fooBar = function(exports) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add a comment what this test is about (ie rollup export) ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes mostly LGTM.
I'd like to see more comments.
5e75738
to
f0bcd9b
Compare
return true; | ||
} | ||
return false; | ||
return (decl.initializer && decl.initializer.kind == ts.SyntaxKind.CallExpression); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
needs !!
for boolean
return type
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
argh! Fixed.
135ffa9
to
5b1371f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the updates.
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
PR Checklist
Please check if your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
What is the current behavior?
Issue Number: N/A
What is the new behavior?
Does this PR introduce a breaking change?
Other information