Skip to content
This repository was archived by the owner on Nov 22, 2024. It is now read-only.

build: add secondary entry points for tokens#922

Merged
Toxicable merged 5 commits intomasterfrom
fabian/secondary-entry
Apr 4, 2018
Merged

build: add secondary entry points for tokens#922
Toxicable merged 5 commits intomasterfrom
fabian/secondary-entry

Conversation

@Toxicable
Copy link
Copy Markdown

@Toxicable Toxicable commented Mar 10, 2018

upgrades angular to v6-rc.1
uses bazel to do secondary entrypoints for tokens

@Toxicable Toxicable requested a review from vikerman as a code owner March 10, 2018 00:05
@CaerusKaru CaerusKaru added this to the 6.0 milestone Mar 10, 2018
@Toxicable Toxicable added the target: major This PR is targeted for the next major release label Mar 10, 2018
@Toxicable Toxicable force-pushed the fabian/secondary-entry branch 2 times, most recently from c26a873 to e8a819e Compare March 11, 2018 09:12
@Toxicable
Copy link
Copy Markdown
Author

Ran into some issue with not being able to use out reexported ng_module
Working around it by using the one exported from angular instead.
But otherwise I think this is good for review, havn't tested if this actually solve the issue yet though, havn't had the time

@Toxicable Toxicable force-pushed the fabian/secondary-entry branch from e8a819e to 47ec44f Compare March 11, 2018 09:13
@Toxicable Toxicable force-pushed the fabian/secondary-entry branch from 47ec44f to 78f18f5 Compare March 11, 2018 09:20
@Toxicable
Copy link
Copy Markdown
Author

Looks like CI is getting some very unhelpful error.

@Toxicable Toxicable force-pushed the fabian/secondary-entry branch from 02742be to 1f570dd Compare March 12, 2018 07:09
Comment thread modules/express-engine/src/main.ts Outdated

import { FileLoader } from './file-loader';
import { REQUEST, RESPONSE } from './tokens';
// import { REQUEST, RESPONSE } from './tokens/index';
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

remove

* 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
*/

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

remove

Comment thread modules/express-engine/tokens/tokens.ts Outdated
* 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
*/

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

remove

Comment thread modules/hapi-engine/BUILD.bazel Outdated
load(
"//tools:defaults.bzl",
"ts_library",
# "ng_module",
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

add comment explaining this

Comment thread modules/hapi-engine/tokens/tokens.ts Outdated
* found in the LICENSE file at https://angular.io/license
*/
import { Request, Response } from 'hapi';

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

remove this

@axnsan12
Copy link
Copy Markdown

Hello,

I see that this is marked as a breaking change and milestoned for 6.0.
I think this is wrong - at least for express-engine, because I had sucesfully been using import {REQUEST} from '@nguniversal/express-engine/tokens'; in "@nguniversal/express-engine": "^5.0.0-beta.5".

However after "upgrading" to "@nguniversal/express-engine": "^5.0.0-beta.6",, I was forced to change to import {REQUEST} from '@nguniversal/express-engine'; which increased my bundle size by the mentioned 600kb.

I don't think you should force us to wait for 6.0 for a fix to a regression introduced in a minor version.

Just my 2 cents, and thank you for your good work on this project!

@Toxicable
Copy link
Copy Markdown
Author

@axnsan12 sorry about the confusion, this is definitely going into 5.x, notice the PR Target 5.x & master.
Working on it as much as i can, should hopefully be released by end of week.

@Toxicable
Copy link
Copy Markdown
Author

Just a small update here.
I've made this fix with another PR here: #930
which has been merged, just awaiting a release.

@Toxicable Toxicable force-pushed the fabian/secondary-entry branch 6 times, most recently from c7e5bc1 to 334443f Compare March 18, 2018 05:08
@Toxicable
Copy link
Copy Markdown
Author

Toxicable commented Mar 22, 2018

This is almost ready to go, just 1 small issue which is possibly due to jasmine_node_test

==================== Test output for //modules/common:unit_test:
failed to load main  ReferenceError: HTTP_INTERCEPTORS is not defined
    at /home/fabian/.cache/bazel/_bazel_fabian/5bf8e1a5e0d57cedec3042cf2af51481/execroot/nguniversal/bazel-out/k8-fastbuild/bin/modules/common/src/transfer_http.ngf
actory.js:42:32

the generated code is:

    var HTTP_INTERCEPTORS_20 = HTTP_INTERCEPTORS;
    exports.HTTP_INTERCEPTORS_20 = HTTP_INTERCEPTORS_20;

Looking for sign off from @alexeagle


disabling this test for now

@Toxicable Toxicable added target: minor target: minor This PR is targeted for the next minor release and removed target: major This PR is targeted for the next major release labels Mar 23, 2018
@Toxicable Toxicable force-pushed the fabian/secondary-entry branch 5 times, most recently from 882b3a0 to c09f185 Compare March 31, 2018 06:55
Comment thread BUILD.bazel Outdated
exports_files(["tsconfig.json"])

# Provides the npm-installed dependencies to Bazel actions.
filegroup(
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

there is now an (undocumented) node_modules_filegroup that you should probably use instead, just for readability: https://github.com/bazelbuild/rules_nodejs/blob/master/defs.bzl#L41

Comment thread modules/hapi-engine/tokens/package.json Outdated
@@ -0,0 +1,3 @@
{
"name": "@nguniversal/hapi-engine/tokens"
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

hmm, you shouldn't need to add extra package.json files - ng_package should generate these for secondary entry points as needed

@Toxicable Toxicable force-pushed the fabian/secondary-entry branch 4 times, most recently from 64ac52f to 0948ce1 Compare April 3, 2018 08:31
@Toxicable Toxicable force-pushed the fabian/secondary-entry branch from 0948ce1 to 8d7beef Compare April 3, 2018 09:53
Comment thread tools/defaults.bzl
def ts_test_library(node_modules=None, **kwargs):
ts_library(testonly=1, **kwargs)

def ts_library(tsconfig = None, node_modules = None, **kwargs):
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why are ts_library, ng_module and ng_package redefined here? I would rather prefer us specifying this everywhere by hand,

Inside Google we have learnt never to use macros except for final leaf targets and when completely unavoidable.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

While I agree it's not the best idea, it's so we don't have to redefine those variables and can keep them organised in one place since there is no alternative right now.
This is the same as Angular core https://github.com/angular/angular/blob/master/tools/defaults.bzl
Once we have a better way of specifying defaults then we wont need this.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Alright - Spoke with Alex and this is a temporary work around needed. Let's add a TODO comment that this should be revisited at some point.

Comment thread tools/defaults.bzl
"@nguniversal/hapi-engine/tokens": "nguniversal.hapiEngine.tokens",
"rxjs": "Rx",
"rxjs/operators": "Rx.operators"
"rxjs/operators": "Rx.operators",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I don't completely understand what the GLOBALS is doing. But I'm scared seeing the symbol Rx here. Rx.ts in rxjs pulls in the entire library. Are we sure that's not happening here?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

This is ensuring that the entire lib is not being pulled into the umd bundle. The symbol on the right is what it will be named on the global object when passed in.

@Toxicable Toxicable merged commit 01b3c50 into master Apr 4, 2018
@Toxicable Toxicable deleted the fabian/secondary-entry branch April 4, 2018 20:57
@angular-automatic-lock-bot
Copy link
Copy Markdown

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot Bot locked and limited conversation to collaborators Sep 6, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

action: review area: build & ci target: minor target: minor This PR is targeted for the next minor release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants