-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
flow typings for node's built-in Module
module
#5364
Closed
Closed
Changes from 17 commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
850a72f
flow typings for json-source-map
gorakong 82f0697
exact object type + mixed
gorakong e5a78f7
Merge branch 'v2' of github.com:parcel-bundler/parcel into gkong/json…
gorakong 6a8c63f
nullthrows
gorakong 0ea4f2d
wip
gorakong 39379cc
Merge branch 'gkong/json-source-map' into gkong/node-module-flow
gorakong 57526af
Merge branch 'v2' of github.com:parcel-bundler/parcel into gkong/node…
gorakong 21de4d9
module flow typings
gorakong 54684f7
Merge branch 'v2' of github.com:parcel-bundler/parcel into gkong/node…
gorakong 8dacc6b
Merge branch 'v2' of github.com:parcel-bundler/parcel into gkong/node…
gorakong 15623e8
flow typings for module
gorakong 6cb7b6b
wip
gorakong 258d455
module flow typings
gorakong 347df7b
Assetgraph propagate symbols (#4861)
mischnic da5c43e
flow typings for module
gorakong f8970de
Merge branch 'gkong/node-module-flow' of github.com:parcel-bundler/pa…
gorakong 02254d2
Merge branch 'v2' into gkong/node-module-flow
gorakong 0e72cb9
Merge branch 'v2' into gkong/node-module-flow
gorakong 21d5cf7
Merge branch 'v2' of github.com:parcel-bundler/parcel into gkong/node…
gorakong 2f8a6fb
Merge branch 'gkong/node-module-flow' of github.com:parcel-bundler/pa…
gorakong File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
//@flow strict-local | ||
|
||
// Derived from the documentation and source of Module located at | ||
// https://nodejs.org/api/module.html#module_modules_module_api and | ||
// https://github.com/nodejs/node/blob/cbfa2d11d4e42ea7f6a847a6930fd1022773252e/lib/internal/modules/cjs/loader.js/ | ||
// Which is licensed MIT | ||
|
||
declare module 'module' { | ||
declare type FilePath = string; | ||
|
||
// Derived from https://github.com/facebook/flow/blob/61913b9f0dcd564fd4c74fefbe896b33ef447cab/lib/node.js | ||
declare class Url { | ||
constructor(input: string, base?: string | URL): void; | ||
hash: string; | ||
host: string; | ||
hostname: string; | ||
href: string; | ||
origin: string; | ||
password: string; | ||
pathname: string; | ||
port: string; | ||
protocol: string; | ||
search: string; | ||
+searchParams: URLSearchParams; | ||
username: string; | ||
toString(): string; | ||
toJSON(): string; | ||
} | ||
|
||
declare export default class Module { | ||
constructor(id: FilePath, parent?: Module): void; | ||
id: string; | ||
path: FilePath; | ||
paths: FilePath[]; | ||
exports: {|[export: string]: mixed|}; | ||
filename: string; | ||
loaded: boolean; | ||
children: Module[]; | ||
globalPaths: FilePath[]; | ||
load(fileName: string): void; | ||
require: (request: string) => {|[export: string]: mixed|}; | ||
syncBuiltinESMExports(): void; | ||
|
||
static runMain(): void; | ||
static wrap(code: string): string; | ||
static createRequire( | ||
path: string | Url, | ||
): (request: string) => {|[export: string]: mixed|}; | ||
static builtinModules: string[]; | ||
static _cache: {|[key: FilePath]: Module|}; | ||
static _pathCache: {|[cacheKey: string]: FilePath|}; | ||
static _nodeModulePaths(from: FilePath): FilePath[]; | ||
static _initPaths(): void; | ||
static findPnpApi(lookupSource: string): PnpApi | null; | ||
|
||
static _findPath( | ||
request: FilePath, | ||
paths: FilePath[], | ||
isMain: boolean, | ||
): FilePath | false; | ||
|
||
static _extensions: {| | ||
[extension: string]: (module: Module, fileName: string) => void, | ||
|}; | ||
|
||
static _resolveLookupPaths( | ||
request: FilePath, | ||
parent: Module, | ||
): FilePath[] | null; | ||
|
||
static _load( | ||
request: FilePath, | ||
parent: Module, | ||
isMain: boolean, | ||
): {|[export: string]: mixed|}; | ||
|
||
static _resolveFilename: ( | ||
request: string, | ||
parent?: Module, | ||
isMain?: boolean, | ||
options?: {|paths?: FilePath[]|}, | ||
) => string | false; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
import type {URL} from 'url'
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks like this is addressed in the upstream PR :) facebook/flow#8540