Skip to content

feat: remove deprecated DOCUMENT token from platform-browser - #28117

Closed
CaerusKaru wants to merge 1 commit into
angular:masterfrom
CaerusKaru:adam/document
Closed

CaerusKaru wants to merge 1 commit into
angular:masterfrom
CaerusKaru:adam/document

Conversation

@CaerusKaru

Copy link
Copy Markdown
Member

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • angular.io application / infrastructure changes
  • Other... Please describe:

What is the current behavior?

DOCUMENT is a token exported by both @angular/platform-browser (deprecated) and @angular/common

Issue Number: N/A

What is the new behavior?

DOCUMENT is no longer a token exported from @angular/platform-browser. It is now only exported from @angular/common

Does this PR introduce a breaking change?

  • Yes
  • No

@CaerusKaru
CaerusKaru requested review from a team January 13, 2019 18:49
@CaerusKaru
CaerusKaru force-pushed the adam/document branch 2 times, most recently from 3773319 to c8b85a1 Compare January 13, 2019 20:06
@CaerusKaru
CaerusKaru requested a review from a team January 13, 2019 20:06
@CaerusKaru

Copy link
Copy Markdown
Member Author

cc @IgorMinar

The saucelabs failure is a flake and just needs to be restarted.

@alfaproject

Copy link
Copy Markdown
Contributor

A refactor doesn't change behaviour or break compatibility. Behaviour is being changed here and there's nothing being fixed, so I guess this is a feat commit.

@CaerusKaru

Copy link
Copy Markdown
Member Author

@alfaproject Yeah I don't know. It's literally the opposite of a feat though, since it's removing something from the publicApi. And yet, technically, it's removed from the publicApi when it's deprecated. I'll wait until @IgorMinar weighs in, but I have no issue changing the scope to whatever's most appropriate.

@IgorMinar IgorMinar added this to the v8-candidates milestone Jan 14, 2019
@ngbot ngbot Bot removed this from the v8-candidates milestone Jan 14, 2019
@IgorMinar

Copy link
Copy Markdown
Contributor

I expect that this will break a significant amount of code at google. I'm running a presubmit now to verify the impact.

If confirmed, we might need to create a ts-lint refactoring transform to make this change automatically and roll this out as part of ng update for v8.

@StephenFluin can we get a reliable estimate of this change on external users? I'm quite sure it's significant and therefore we could roll this out only with automated refactoring of apps and libraries (which in this case is safe and relatively straightforward).

@IgorMinar

IgorMinar commented Jan 14, 2019 •

Copy link
Copy Markdown
Contributor

internal presubmit results: http://test/OCL:229126105:BASE:229126324:1547447183003:cc4ee4a9

preliminary results: there is a handful of apps that still work after this change, but great majority of apps in google3 are broken.

this means that we'll need the ts-lint transform similar to several we built for rxjs in order to roll this change out. @CaerusKaru are you up for taking that on?

Now in order to make the transform compatible with ng update, we'll need a separate package that will contain the rule and the dependency on ts-lint (we can't add a dependency on ts-lint from @angular/platform-browser). So I'm proposing that we create @angular/platform-browser-compat (or possibly a more generic @angular/compat package), similar to rxjs-compat, that will contain the ts-lint transform and this package will declare the dependency on ts-lint.

We then write a ng update schematics for @angular/platform-browser that will install this compat package (and tslint), execute the refactoring, and remove the compat package once successful.

@IgorMinar

Copy link
Copy Markdown
Contributor

and yes, "refactor" is misleading. we might need a new category for this type of change, but in the meantime use "feat" as weird as it is because it's best category in terms of user visibility of the change in the changelog.

@IgorMinar IgorMinar added this to the v8-candidates milestone Jan 14, 2019
@ngbot ngbot Bot removed this from the v8-candidates milestone Jan 14, 2019
@IgorMinar IgorMinar added state: blocked breaking changes area: core Issues related to the framework runtime labels Jan 14, 2019
@ngbot ngbot Bot added this to the needsTriage milestone Jan 14, 2019
@IgorMinar IgorMinar added effort2: days risk: high feature Label used to distinguish feature request from other issues labels Jan 14, 2019
@ngbot ngbot Bot modified the milestones: needsTriage, Backlog Jan 14, 2019
@StephenFluin

Copy link
Copy Markdown
Contributor

Around 80% of apps I just scanned use the DOCUMENT InjectionToken. I can't tell from compiled source where they import it from though, so I have a hard time guessing how many will be affected.

I wouldn't have guessed that it would be many people, as I would guess most developers access document directly and assume web-only use cases.

@CaerusKaru

Copy link
Copy Markdown
Member Author

Blocked on #29237

@CaerusKaru

Copy link
Copy Markdown
Member Author

Also blocked on angular/components#15470

@CaerusKaru

Copy link
Copy Markdown
Member Author

bump @alexeagle @IgorMinar

This can be merged now that #29950 has been merged

@mhevery mhevery self-assigned this Apr 23, 2019
@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 15, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

action: merge The PR is ready for merge by the caretaker area: core Issues related to the framework runtime breaking changes cla: yes effort2: days feature Label used to distinguish feature request from other issues risk: high target: major This PR is targeted for the next major release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants