Comments (8)
It seems like we'll need to add a new @types
lookup feature, to align with TypeScript's @types
resolution.
I don't know anything about @types
lookup, I can't even figure out how it goes from @google/maps
to https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/google__maps and not https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/google-maps 😅
from oxc-resolver.
It looks like hard-coded behaviour.
TL;DR:
`@types/${packageName.startsWith('@') ? packageName.slice(1).replace('/', '__') : packageName}`
from oxc-resolver.
I think I can get this implemented if it's trivial:
- add an option to enable
@types
lookup - do the naming conversion
- do the resolution
- return an extra field for
@types
resolution
from oxc-resolver.
Is it possible to create another resolver instance with the modules
option pointing to the @types
directory? I think @Dunqing figure it out somehow.
Here's a similar example to resolve tsconfig.json
:
Lines 1061 to 1066 in 4226f7a
from oxc-resolver.
Is it possible to create another resolver instance with the
modules
option pointing to the@types
directory? I think @Dunqing figure it out somehow.
I want to confirm the scope of this instance. Just resolve @types/*
packages? Or for all packages, resolve out the corresponding type declarations.
Here are the different types of packages that I have listed
// no type declarations but has @types
import { LatLng } from '@google/maps'; // resolved path: file:///node_modules/@types/google__maps/index
// type only package
import {} from 'undici-types' // resolved path: file:///node_modules/undici-types/index
// both js source files and corresponding type declarations
import { } from 'vite' // resolved path: file:///node_modules/vite/dist/node/index
// js only package
import {} from 'js-only-pacakage' // resolved nothing
If that's what we're going to do, I think we can do a lot of linter rules about .d.ts
from oxc-resolver.
The resolution will return both the package path as well its types packages.
I was thinking about implementing this in user land, but seems a bit difficult after a second thought.
from oxc-resolver.
If my understanding is correct, I think we should do this
- add an option to enable type resolution
- try to look at
types
andtypings
fields in package.json if not do the@types
lookup - do the resolution
- return an extra field for type resolution
from oxc-resolver.
Just being curious, are ambient modules also in the scope of this issue/package?
from oxc-resolver.
Related Issues (20)
- Fuzz!
- Issue resolving exports (Node) HOT 8
- aliased requests in resolver_context.file_dependencies are not normalized/canonicalized HOT 2
- Panic on windows path `C:\` HOT 2
- [Help] Integration example with a sample webpack based app HOT 2
- It would be nice to add a message in the assertion that explains the assertion itself. At the moment there isn't much context
- `npm` version is outdated
- tsconfig `extends` field can be an array
- Document mainFields usage HOT 1
- API / Docs feedback HOT 2
- Support tsconfig template variable
- package.json should not cache resolver options HOT 1
- More code coverage
- Improve performance on resolving browser fields
- The logic of the oxc_resover implementation may not be quite the same as in esbuild. HOT 2
- oxc-resolver-has-issue-in-esbuild-test-case-packagejson-2002b HOT 9
- Allow to disable validation of "Default condition should be last one" HOT 3
- The resolve process does not report an error when the only main field of the packagejson points to a non-existent file. HOT 8
- Unexpected result `NotFound('node:http')` with `imports` field and `builtins: true` option HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from oxc-resolver.