Skip to content

Commit

Permalink
fix: types
Browse files Browse the repository at this point in the history
  • Loading branch information
alexander-akait committed Apr 16, 2024
1 parent 9bfc65e commit ace213e
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -563,4 +563,4 @@ function loader(content) {

module.exports = loader;
module.exports.pitch = pitch;
module.exports.hotLoaderForTest = hotLoader;
module.exports.hotLoader = hotLoader;
2 changes: 1 addition & 1 deletion test/HMR.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
/* eslint-disable no-console */

import hotModuleReplacement from "../src/hmr/hotModuleReplacement";
import { hotLoaderForTest as hotLoader } from "../src/loader";
import { hotLoader } from "../src/loader";

function getLoadEvent() {
const event = document.createEvent("Event");
Expand Down
35 changes: 35 additions & 0 deletions types/loader.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ declare function loader(
declare namespace loader {
export {
pitch,
hotLoader,
Schema,
Compiler,
Compilation,
Expand All @@ -33,6 +34,40 @@ declare function pitch(
this: import("webpack").LoaderContext<MiniCssExtractPlugin.LoaderOptions>,
request: string
): void;
/** @typedef {import("schema-utils/declarations/validate").Schema} Schema */
/** @typedef {import("webpack").Compiler} Compiler */
/** @typedef {import("webpack").Compilation} Compilation */
/** @typedef {import("webpack").Chunk} Chunk */
/** @typedef {import("webpack").Module} Module */
/** @typedef {import("webpack").sources.Source} Source */
/** @typedef {import("webpack").AssetInfo} AssetInfo */
/** @typedef {import("webpack").NormalModule} NormalModule */
/** @typedef {import("./index.js").LoaderOptions} LoaderOptions */
/** @typedef {{ [key: string]: string | function }} Locals */
/** @typedef {any} TODO */
/**
* @typedef {Object} Dependency
* @property {string} identifier
* @property {string | null} context
* @property {Buffer} content
* @property {string} media
* @property {string} [supports]
* @property {string} [layer]
* @property {Buffer} [sourceMap]
*/
/**
* @param {string} content
* @param {{ loaderContext: import("webpack").LoaderContext<LoaderOptions>, options: LoaderOptions, locals: Locals | undefined }} context
* @returns {string}
*/
declare function hotLoader(
content: string,
context: {
loaderContext: import("webpack").LoaderContext<LoaderOptions>;
options: LoaderOptions;
locals: Locals | undefined;
}
): string;
type Schema = import("schema-utils/declarations/validate").Schema;
type Compiler = import("webpack").Compiler;
type Compilation = import("webpack").Compilation;
Expand Down

0 comments on commit ace213e

Please sign in to comment.