ember-template-lint/ember-template-recast

Latest version of ember-template-recast is missing deps

Closed this issue ยท 8 comments

Version Info:
ember-template-recast: 1.2.4
typescript: 3.4.4

Steps to reproduce:

  1. yarn upgrade ember-template-recast (to latest v. 1.2.4).
  2. Build!

I've tried:

  • Bumping to latest version of TypeScript.
  • Tossing node_modules away and running a fresh install of everything (with yarn).

Logged errors:

node_modules/@glimmer/interfaces/dist/types/lib/components.d.ts:1:40 - error TS2307: Cannot find module '@glimmer/reference'.

1 import { VersionedPathReference } from '@glimmer/reference';
                                         ~~~~~~~~~~~~~~~~~~~~

node_modules/@glimmer/interfaces/dist/types/lib/components/component-manager.d.ts:1:45 - error TS2307: Cannot find module '@glimmer/reference'.

1 import { Tag, VersionedPathReference } from '@glimmer/reference';
                                              ~~~~~~~~~~~~~~~~~~~~

node_modules/@glimmer/interfaces/dist/types/lib/components/component-manager.d.ts:2:31 - error TS2307: Cannot find module '@simple-dom/interface'.

2 import { SimpleElement } from '@simple-dom/interface';
                                ~~~~~~~~~~~~~~~~~~~~~~~

node_modules/@glimmer/interfaces/dist/types/lib/dom/attributes.d.ts:8:8 - error TS2307: Cannot find module '@simple-dom/interface'.

8 } from '@simple-dom/interface';
         ~~~~~~~~~~~~~~~~~~~~~~~

node_modules/@glimmer/interfaces/dist/types/lib/dom/bounds.d.ts:1:43 - error TS2307: Cannot find module '@simple-dom/interface'.

1 import { SimpleElement, SimpleNode } from '@simple-dom/interface';
                                            ~~~~~~~~~~~~~~~~~~~~~~~

node_modules/@glimmer/interfaces/dist/types/lib/dom/changes.d.ts:7:8 - error TS2307: Cannot find module '@simple-dom/interface'.

7 } from '@simple-dom/interface';
         ~~~~~~~~~~~~~~~~~~~~~~~

node_modules/@glimmer/interfaces/dist/types/lib/dom/tree-construction.d.ts:7:8 - error TS2307: Cannot find module '@simple-dom/interface'.

7 } from '@simple-dom/interface';
         ~~~~~~~~~~~~~~~~~~~~~~~

node_modules/@glimmer/interfaces/dist/types/lib/runtime/arguments.d.ts:1:45 - error TS2307: Cannot find module '@glimmer/reference'.

1 import { Tag, VersionedPathReference } from '@glimmer/reference';
                                              ~~~~~~~~~~~~~~~~~~~~

node_modules/@glimmer/interfaces/dist/types/lib/runtime/element.d.ts:1:36 - error TS2307: Cannot find module '@glimmer/reference'.

1 import { VersionedReference } from '@glimmer/reference';
                                     ~~~~~~~~~~~~~~~~~~~~

node_modules/@glimmer/interfaces/dist/types/lib/runtime/environment.d.ts:1:76 - error TS2307: Cannot find module '@glimmer/reference'.

1 import { OpaqueIterable, VersionedPathReference, VersionedReference } from '@glimmer/reference';
                                                                             ~~~~~~~~~~~~~~~~~~~~

node_modules/@glimmer/interfaces/dist/types/lib/runtime/environment.d.ts:2:36 - error TS2307: Cannot find module '@glimmer/runtime'.

2 import { AttributeOperation } from '@glimmer/runtime';
                                     ~~~~~~~~~~~~~~~~~~

node_modules/@glimmer/interfaces/dist/types/lib/runtime/environment.d.ts:3:46 - error TS2307: Cannot find module '@simple-dom/interface'.

3 import { AttrNamespace, SimpleElement } from '@simple-dom/interface';
                                               ~~~~~~~~~~~~~~~~~~~~~~~

node_modules/@glimmer/interfaces/dist/types/lib/runtime/modifier.d.ts:4:21 - error TS2307: Cannot find module '@glimmer/reference'.

4 import { Tag } from '@glimmer/reference';
                      ~~~~~~~~~~~~~~~~~~~~

node_modules/@glimmer/interfaces/dist/types/lib/runtime/modifier.d.ts:6:31 - error TS2307: Cannot find module '@simple-dom/interface'.

6 import { SimpleElement } from '@simple-dom/interface';
                                ~~~~~~~~~~~~~~~~~~~~~~~

node_modules/@glimmer/interfaces/dist/types/lib/runtime/render.d.ts:1:43 - error TS2307: Cannot find module '@simple-dom/interface'.

1 import { SimpleElement, SimpleNode } from '@simple-dom/interface';
                                            ~~~~~~~~~~~~~~~~~~~~~~~

node_modules/@glimmer/interfaces/dist/types/lib/runtime/scope.d.ts:2:40 - error TS2307: Cannot find module '@glimmer/reference'.

2 import { VersionedPathReference } from '@glimmer/reference';
                                         ~~~~~~~~~~~~~~~~~~~~

node_modules/@glimmer/interfaces/dist/types/lib/runtime/vm.d.ts:2:31 - error TS2307: Cannot find module '@glimmer/reference'.

2 import { PathReference } from '@glimmer/reference';
                                ~~~~~~~~~~~~~~~~~~~~

node_modules/@glimmer/util/dist/types/lib/dom.d.ts:1:31 - error TS2307: Cannot find module '@simple-dom/interface'.

1 import { SimpleElement } from '@simple-dom/interface';
                                ~~~~~~~~~~~~~~~~~~~~~~~

node_modules/@glimmer/util/dist/types/lib/is-serialization-first-node.d.ts:1:28 - error TS2307: Cannot find module '@simple-dom/interface'.

1 import { SimpleNode } from '@simple-dom/interface';
                             ~~~~~~~~~~~~~~~~~~~~~~~

Additional debug info:

$ yarn why @glimmer/interfaces
yarn why v1.12.3
[1/4] ๐Ÿค”  Why do we have the module "@glimmer/interfaces"...?
[2/4] ๐Ÿšš  Initialising dependency graph...
[3/4] ๐Ÿ”  Finding dependency...
[4/4] ๐Ÿšก  Calculating file sizes...
=> Found "@glimmer/interfaces@0.39.3"
info Reasons this module exists
   - "ember-template-recast#@glimmer#syntax" depends on it
   - Hoisted from "ember-template-recast#@glimmer#syntax#@glimmer#interfaces"
info Disk size without dependencies: "204KB"
info Disk size with unique dependencies: "204KB"
info Disk size with transitive dependencies: "204KB"
info Number of shared dependencies: 0
โœจ  Done in 0.47s.

$ yarn why @glimmer/util
yarn why v1.12.3
[1/4] ๐Ÿค”  Why do we have the module "@glimmer/util"...?
[2/4] ๐Ÿšš  Initialising dependency graph...
[3/4] ๐Ÿ”  Finding dependency...
[4/4] ๐Ÿšก  Calculating file sizes...
=> Found "@glimmer/util@0.39.3"
info Reasons this module exists
   - "ember-template-recast#@glimmer#syntax" depends on it
   - Hoisted from "ember-template-recast#@glimmer#syntax#@glimmer#util"
info Disk size without dependencies: "724KB"
info Disk size with unique dependencies: "724KB"
info Disk size with transitive dependencies: "724KB"
info Number of shared dependencies: 0
โœจ  Done in 0.40s.

$ yarn why @glimmer/syntax
yarn why v1.12.3
[1/4] ๐Ÿค”  Why do we have the module "@glimmer/syntax"...?
[2/4] ๐Ÿšš  Initialising dependency graph...
[3/4] ๐Ÿ”  Finding dependency...
[4/4] ๐Ÿšก  Calculating file sizes...
=> Found "@glimmer/syntax@0.39.3"
info Reasons this module exists
   - "ember-template-recast" depends on it
   - Hoisted from "ember-template-recast#@glimmer#syntax"
info Disk size without dependencies: "1.75MB"
info Disk size with unique dependencies: "5.8MB"
info Disk size with transitive dependencies: "7.72MB"
info Number of shared dependencies: 6
โœจ  Done in 0.45s.

We depend on @glimmer/syntax and that is the only package we are using in this library. Seems like something is either wrong in @glimmer/syntax (I think we did bump versions?) or with your typescript setup in general...

Thanks for the info! I'll do a little more investigating (sorry... been busy today, so didn't get a chance to dig further). Literally the only change @hagmandan and I did was bump ember-template-recast and our build started complaining. ๐Ÿ™

@hagmandan noticed @simple-dom/interface disappeared from the lockfile with the bump to the latest version of @glimmer/syntax... it looks like @glimmer/interfaces got rid of the dependency from looking at the lockfile. This is what leads us to believe it might be an issue with the library. That said, I can't find @glimmer/reference in either the before or after, though.

Gonna try linking ember-template-recast and bumping @glimmer/syntax to latest to see if that helps. I'll also double-check our tsc build options to make sure I didn't mess anything up there.

No luck, I'm afraid. Bumping to latest version of @glimmer/syntax didn't help.

Did some more digging... I think the root cause is @glimmer/interfaces. Somewhere between 0.38.1 and 0.39.3, it both...

  • Dropped its dependencies on @glimmer/wire-format and @simple-dom/interface and
  • Started relying on @glimmer/reference in its code, without adding @glimmer/reference as a dependency.

It also looks like @glimmer/utils references @simple-dom/interface in its code, but has it listed as a devDependency.

I'm unsure if these dependency setups are intentional, on the assumption that the parent app would be expected to provide these (that said, they're not declared as peerDependencies). If so, I can open a PR for ember-template-recast to directly rely on these missing dependencies so they're available. Otherwise, I can open a PR in the Glimmer repo.

Let me know what works best. Thanks!

Sounds like you've nailed it! Looks like we need a PR to https://github.com/glimmerjs/glimmer-vm/blob/master/packages/%40glimmer/interfaces/package.json to add a dependency on @glimmer/reference (or refactor @glimmer/interfaces to avoid needing the dependency).

glimmerjs/glimmer-vm#939 posted to glimmer-vm. Once that's pulled in and a new version is released, I can bump the dep on @glimmer/syntax over here.

Nope... wait... that PR isn't going to work. Looks like it introduces a circular dependency, which the build process is unhappy about. =(

I think we've finally got this nailed down. Thanks to a bunch of work from @krisselden and @Turbo87 over in glimmer-vm.

I think this is fixed now. Please let me know if Iโ€™m mistaken.