Open DanielRosenwasser opened 3 weeks ago
We probably should look at if JSR does the same transforms that we're looking to do.
From https://jsr.io/docs/publishing-packages#jsr-package-rules, it looks like JSR doesn’t support publishing code that references itself with package.json "imports"
or self-name imports. I think files within each package have to reference each other with relative imports. @lucacasonato is that right?
Currently yes. We are currently discussing whether it is useful to allow this though.
Reconsidering a flag to rewrite
.ts
to.js
in emit in light of TS support in Node.jshttps://github.com/microsoft/TypeScript/issues/59597#issuecomment-2287466184
--experimental-transform-types
and--experimental-strip-types
are now in Node.js..ts
-like extension.allowImportingTsExtensions
to allow this, but you must havenoEmit
turned on..js
but still reference.ts
files..ts
fromnode_modules
)..
or..
..d.ts
file)..ts
,.tsx
,.cts
, or.mts
file..tsx
.tsx
to.js
if--jsx
isreact
,react-jsx
, orreact-jsxdev
..tsx
to.jsx
if--jsx
isreact-native
.import foo = require("./foo.ts");
will be transformed toimport foo = require("./foo.js");
, which is incorrect if the original file wasfoo.ts.ts
.import
andexport
subpaths?exports
andimports
inpackage.json
that resolve to.ts
files. Won't run on publish.node_modules
.--outDir
? Shouldn't we rewrite paths relative tooutDir
?../../other-project/src/foo.ts
, don't you want to rewrite this to../../other-project/dist/foo.js
?moduleSuffixes
?.ts
everywhere and that's what people use?import type
?.js
as well, right?.js
imports instead of.ts
? It's going to error and users are not going to know why.import(...)
calls.import(someVariable);
__fixExtension
.import()
on totally dynamic contents.moduleSuffixes
outDir
tsc
in the tight loop anyway, right? Why do people want to writetsc
? Some other tool can do this rewriting.../../src/foo.ts
vs.../../dist/foo.js
problem?imports
/exports
subpaths inpackage.json
, workspaces, or path mappings.node_modules
? Because you don't want to resolve to the.ts
files innode_modules
(they'll fail at runtime!).