Skip to content

Commit ace213e

Browse files
fix: types
1 parent 9bfc65e commit ace213e

File tree

3 files changed

+37
-2
lines changed

3 files changed

+37
-2
lines changed

src/loader.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -563,4 +563,4 @@ function loader(content) {
563563

564564
module.exports = loader;
565565
module.exports.pitch = pitch;
566-
module.exports.hotLoaderForTest = hotLoader;
566+
module.exports.hotLoader = hotLoader;

test/HMR.test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
/* eslint-disable no-console */
66

77
import hotModuleReplacement from "../src/hmr/hotModuleReplacement";
8-
import { hotLoaderForTest as hotLoader } from "../src/loader";
8+
import { hotLoader } from "../src/loader";
99

1010
function getLoadEvent() {
1111
const event = document.createEvent("Event");

types/loader.d.ts

+35
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ declare function loader(
1010
declare namespace loader {
1111
export {
1212
pitch,
13+
hotLoader,
1314
Schema,
1415
Compiler,
1516
Compilation,
@@ -33,6 +34,40 @@ declare function pitch(
3334
this: import("webpack").LoaderContext<MiniCssExtractPlugin.LoaderOptions>,
3435
request: string
3536
): void;
37+
/** @typedef {import("schema-utils/declarations/validate").Schema} Schema */
38+
/** @typedef {import("webpack").Compiler} Compiler */
39+
/** @typedef {import("webpack").Compilation} Compilation */
40+
/** @typedef {import("webpack").Chunk} Chunk */
41+
/** @typedef {import("webpack").Module} Module */
42+
/** @typedef {import("webpack").sources.Source} Source */
43+
/** @typedef {import("webpack").AssetInfo} AssetInfo */
44+
/** @typedef {import("webpack").NormalModule} NormalModule */
45+
/** @typedef {import("./index.js").LoaderOptions} LoaderOptions */
46+
/** @typedef {{ [key: string]: string | function }} Locals */
47+
/** @typedef {any} TODO */
48+
/**
49+
* @typedef {Object} Dependency
50+
* @property {string} identifier
51+
* @property {string | null} context
52+
* @property {Buffer} content
53+
* @property {string} media
54+
* @property {string} [supports]
55+
* @property {string} [layer]
56+
* @property {Buffer} [sourceMap]
57+
*/
58+
/**
59+
* @param {string} content
60+
* @param {{ loaderContext: import("webpack").LoaderContext<LoaderOptions>, options: LoaderOptions, locals: Locals | undefined }} context
61+
* @returns {string}
62+
*/
63+
declare function hotLoader(
64+
content: string,
65+
context: {
66+
loaderContext: import("webpack").LoaderContext<LoaderOptions>;
67+
options: LoaderOptions;
68+
locals: Locals | undefined;
69+
}
70+
): string;
3671
type Schema = import("schema-utils/declarations/validate").Schema;
3772
type Compiler = import("webpack").Compiler;
3873
type Compilation = import("webpack").Compilation;

0 commit comments

Comments
 (0)