Closed dfreeman closed 1 year ago
Also, I tried this branch of glint against the project we are trying to convert to a v2 addon, which contains imports with .gts
extensions, and it appears to build and typecheck successfully.
Should be available in @glint/core@1.2.0
!
thanks! Already PR'd an update here: https://github.com/embroider-build/addon-blueprint/pull/206
Things are moving fast, it's awesome 👏
This is an alternative approach to the one taken in #620, and fixes #618.
620 attempts to support import paths with an explicit
.gts
extension by rewriting those imports during transformation, but module resolution really shouldn't be a concern of the transform layer. For example:.ts
files might import from.gts
files).gts
files without the extension)TS has a hard-coded internal set of the extensions it considers to "be" TypeScript, and we work around this fact by presenting custom extensions like
.gjs
and.gts
as.js
and.ts
files respectively. This is how such files get included during whole-project typechecking, and is also how extensionless imports of.gts
and.gjs
are resolved today.This PR addresses #618 in the same manner as we handle custom extensions in general: by providing a custom hook for the compiler API to implement the behavior we want. In this instance, the hook is
resolveModuleNameLiterals
rather than the system-levelreadFile
and friends, but the gist is the same: when a.gts
file is imported, we intercept and rewrite the request to as though it had been for the corresponding.ts
file.