Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix: types
  • Loading branch information
alexander-akait committed Apr 16, 2024
commit ace213e45415b892e7ff6ec8f96dd156498e7ab9
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