-
Notifications
You must be signed in to change notification settings - Fork 1.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
[request] webpack #165
Comments
I'm using the following declaration if that can help: declare var module : {
hot : {
accept(path:string, callback:() => void): void;
};
};
declare var require: any; |
Are there Webpack API docs somewhere? I thought you only have a JSON-like config file and the CLI. Didn't know there was a JS api... |
There is only three js API I'm aware of:
I'm not sure where the best docs is. |
I think it is covered in api-in-modules |
you can run webpack via the Node.js: https://github.com/ccorcos/doug/blob/master/packages/doug/commands/build.js#L7-L18 |
cc @TheLarkInn |
If I provided a PR which contains a TS equivalent would this be of assistance? webpack/webpack#3094 |
That would be awesome :) |
@TheLarkInn TS is very close to Flow now-a-days. It shouldn't be too hard to convert. |
The PR above should be enough to assist I hope. Lmk if you have any other questions |
declare for react-native declare var module: {
hot: {
accept(callback: () => void): void,
},
}; |
I'm using this: EDIT declare type ModuleHotStatus =
| 'idle' // The process is waiting for a call to check (see below)
| 'check' // The process is checking for updates
| 'prepare' // The process is getting ready for the update (e.g. downloading the updated module)
| 'ready' // The update is prepared and available
| 'dispose' // The process is calling the dispose handlers on the modules that will be replaced
| 'apply' // The process is calling the accept handlers and re-executing self-accepted modules
| 'abort' // An update was aborted, but the system is still in it's previous state
| 'fail' // An update has thrown an exception and the system's state has been compromised
;
declare type ModuleHotStatusHandler = (status: ModuleHotStatus) => any
declare interface ModuleHot {
data: any;
accept(paths?: string | Array<string>, callback?: () => any): void;
decline(paths?: string | Array<string>): void;
dispose(callback: (data?: mixed) => any): void;
addDisposeHandler(callback: (data: mixed) => any): void;
status(): ModuleHotStatus;
check(autoApply: boolean | Object): Promise<string[]>; // TODO
apply(options: Object): Promise<string[]>; // TODO
addStatusHandler(callback: ModuleHotStatusHandler): void;
removeStatusHandler(callback: ModuleHotStatusHandler): void;
};
declare var module: {
hot?: ModuleHot,
}; |
Any of y'all are welcome to submit a PR. Looks like this most recent def is a good starting point. :) |
Heavily inspired from the TypeScript declarations Anyone is welcome to contribute and/or write tests in order to answer to #165
webpack is one of the most widely used Javascript library. It would be great to have Flow definitions for it.
The text was updated successfully, but these errors were encountered: