Skip to content

use new glimmer ElementNode sub nodes#696

Closed
patricklx wants to merge 1 commit intotyped-ember:mainfrom
patricklx:update-glimmer
Closed

use new glimmer ElementNode sub nodes#696
patricklx wants to merge 1 commit intotyped-ember:mainfrom
patricklx:update-glimmer

Conversation

@patricklx
Copy link
Copy Markdown
Contributor

@patricklx patricklx commented Jan 29, 2024

there are now also following nodes:

  • name node: ElementNameNode
  • start tag node: ElementStartNode

example:

/*
  <Foo.bar.x attr='2'></Foo.bar.x>
   ^-- Element PathExpression[0] node
       ^-- Element PathExpression[1] node
          ^- Element PathExpression[2] node
   ^-------- Element PathExpression node
  ^------------------ Element openTag span
                      ^----------- ElementEndNode
 */

afterwards completions/validations can be add for attributes and element tags
In #663

Comment thread test-packages/ts-ember-app/app/components/foo.hbs
@patricklx patricklx force-pushed the update-glimmer branch 3 times, most recently from 23ef8a2 to f0bf4c4 Compare January 29, 2024 15:20
@patricklx
Copy link
Copy Markdown
Contributor Author

@NullVoxPopuli any idea how I can fix this:

Error: node_modules/@glimmer/interfaces/index.d.ts(1,2[9](https://github.com/typed-ember/glint/actions/runs/7698348329/job/20977417907?pr=696#step:5:10)): error TS2834: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path.
Error: node_modules/@glimmer/interfaces/index.d.ts(3,15): error TS2834: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path.
Error: node_modules/@glimmer/interfaces/index.d.ts(4,15): error TS2834: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path.
Error: node_modules/@glimmer/interfaces/index.d.ts(5,15): error TS2834: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path.
Error: node_modules/@glimmer/interfaces/index.d.ts(6,15): error TS2834: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path.
Error: node_modules/@glimmer/interfaces/index.d.ts(7,15): error TS2834: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path.

@NullVoxPopuli
Copy link
Copy Markdown
Contributor

NullVoxPopuli commented Jan 30, 2024

Does skipLibCheck help?

Otherwise, glimmer has more bugs we need to fix (all relative imports should always use extensions when using node16, so it shouldn't be too bad of a fix)

@patricklx
Copy link
Copy Markdown
Contributor Author

Does skipLibCheck help?

Otherwise, glimmer has more bugs we need to fix (all relative imports should always use extensions when using node16, so it shouldn't be too bad of a fix)

yes, it helped!

Comment thread packages/core/__tests__/transform/template-to-typescript.test.ts
Comment thread tsconfig.compileroptions.json
@NullVoxPopuli
Copy link
Copy Markdown
Contributor

@patricklx would there be any noticeable editor behavior changes with this PR?

(or is it "just the same, but using the new parser capabilities"?)

@patricklx
Copy link
Copy Markdown
Contributor Author

i'm not seeing and difference

Copy link
Copy Markdown
Contributor

@NullVoxPopuli NullVoxPopuli left a comment

Choose a reason for hiding this comment

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

Let's block on glimmerjs/glimmer-vm#1555
And get that update in here, too once released

@NullVoxPopuli
Copy link
Copy Markdown
Contributor

@patricklx new versions published, can you try the .1 release?

@patricklx
Copy link
Copy Markdown
Contributor Author

nope, some new errors-...

Error: node_modules/@types/ember__helper/index.d.ts(3,81): error TS147[9](https://github.com/typed-ember/glint/actions/runs/7739973176/job/21103924609?pr=696#step:5:10): The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("@glimmer/manager")' call instead.
Error: node_modules/@types/ember__helper/index.d.ts(4,53): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("@glimmer/runtime")' call instead.
Error: node_modules/@glimmer/modifier/dist/commonjs/index.d.ts(1,20): error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("@glimmer/runtime")' call instead.

microsoft/TypeScript#52529
microsoft/TypeScript#53426

looks like @ef4 knows something about this

@NullVoxPopuli
Copy link
Copy Markdown
Contributor

ah yeah, we're probably blocked on ember-source needing to actually ship as a type=module package.

@patricklx
Copy link
Copy Markdown
Contributor Author

patricklx commented Feb 1, 2024

@NullVoxPopuli
Copy link
Copy Markdown
Contributor

does changing all of @types/ember* to type=module work locally? 🤔

@patricklx
Copy link
Copy Markdown
Contributor Author

does changing all of @types/ember* to type=module work locally? 🤔

it fixes some errors,
but also needed to fix @glimmerx/modifier and @glimmer/modifier.

still, at the end it says
node_modules/@types/ember__helper/index.d.ts:1:24 - error TS2307: Cannot find module 'ember/-private/type-utils' or its corresponding type declarations.

@NullVoxPopuli
Copy link
Copy Markdown
Contributor

Ahh, yeah, probably because all the private relative imports need extensions at that point. Hmm

@NullVoxPopuli
Copy link
Copy Markdown
Contributor

NullVoxPopuli commented Feb 2, 2024

I've added skipLibCheck back.

It doesn't seem we can build without it.

@chancancode
Copy link
Copy Markdown

chancancode commented Mar 11, 2024

@patricklx FYI 0.89.0 is out with glimmerjs/glimmer-vm#1568 The information you need should now be in ElementNode.{path,openTag,closeTag}: glimmerjs/glimmer-vm@68509ac#diff-21f1f3fd9aaae780472e1cf9cf079d1a05efd0fd642f6758c963dc7e969a4b30

Should also fix #706

Comment thread packages/core/src/transform/diagnostics/augmentation.ts
Comment thread packages/template/__tests__/emit-content.test.ts Outdated
@patricklx patricklx changed the base branch from main to v1.x November 7, 2024 15:46
@patricklx patricklx changed the base branch from v1.x to main March 25, 2025 10:05
@patricklx patricklx closed this Mar 25, 2025
@NullVoxPopuli
Copy link
Copy Markdown
Contributor

@patricklx i think this is unblocked now?

@patricklx
Copy link
Copy Markdown
Contributor Author

re-created as #839

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