Skip to content

Commit

Permalink
feat: add rsdoctor native plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
LingyuCoder committed Jan 9, 2025
1 parent 8bb0d08 commit ecd9c97
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 3 deletions.
5 changes: 3 additions & 2 deletions packages/rspack/src/builtin-plugin/HtmlRspackPlugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@ export type HtmlRspackPluginOptions = {

/** Inject a [base](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/base) tag */
base?:
| string
| { href?: string; target?: "_self" | "_blank" | "_parent" | "_top" };
| string
| { href?: string; target?: "_self" | "_blank" | "_parent" | "_top" };

/**
* Modern browsers support non blocking javascript loading ('defer') to improve the page startup performance.
Expand Down Expand Up @@ -341,6 +341,7 @@ const HtmlRspackPluginImpl = create(
);
}
}
console.log("inject", inject);

return {
filename: filenames ? Array.from(filenames) : undefined,
Expand Down
20 changes: 19 additions & 1 deletion packages/rspack/src/builtin-plugin/RsdoctorPlugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,29 @@ import { Compiler } from "../Compiler";
import * as liteTapable from "@rspack/lite-tapable";
import { Compilation } from "../Compilation";

export type {
JsRsdoctorAsset as RsdoctorAsset,
JsRsdoctorChunkGraph as RsdoctorChunkGraph,
JsRsdoctorModuleGraph as RsdoctorModuleGraph,
JsRsdoctorModuleSource as RsdoctorModuleSource,
JsRsdoctorChunk as RsdoctorChunk,
JsRsdoctorModule as RsdoctorModule,
JsRsdoctorSideEffect as RsdoctorSideEffect,
JsRsdoctorExportInfo as RsdoctorExportInfo,
JsRsdoctorVariable as RsdoctorVariable,
JsRsdoctorDependency as RsdoctorDependency,
JsRsdoctorEntrypoint as RsdoctorEntrypoint,
JsRsdoctorStatement as RsdoctorStatement,
JsRsdoctorSourceRange as RsdoctorSourceRange,
JsRsdoctorSourcePosition as RsdoctorSourcePosition,
JsRsdoctorModuleGraphModule as RsdoctorModuleGraphModule,
} from "@rspack/binding";

export type RsdoctorRspackPluginOptions = {};
const rsdoctorPluginSchema = z.strictObject({}) satisfies z.ZodType<RsdoctorRspackPluginOptions>;

const RsdoctorRspackPluginImpl = create(
BuiltinPluginName.HtmlRspackPlugin,
BuiltinPluginName.RsdoctorRspackPlugin,
function (
this: Compiler,
c: RsdoctorRspackPluginOptions = {}
Expand Down
17 changes: 17 additions & 0 deletions packages/rspack/src/exports.ts
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,23 @@ export const sharing = {
};

///// Rspack Postfixed Internal Plugins /////
export type {
RsdoctorAsset,
RsdoctorChunkGraph,
RsdoctorModuleGraph,
RsdoctorModuleSource,
RsdoctorChunk,
RsdoctorModule,
RsdoctorSideEffect,
RsdoctorExportInfo,
RsdoctorVariable,
RsdoctorDependency,
RsdoctorEntrypoint,
RsdoctorStatement,
RsdoctorSourceRange,
RsdoctorSourcePosition,
RsdoctorModuleGraphModule,
} from "./builtin-plugin";
export type { HtmlRspackPluginOptions } from "./builtin-plugin";
export type { SwcJsMinimizerRspackPluginOptions } from "./builtin-plugin";
export type { LightningCssMinimizerRspackPluginOptions } from "./builtin-plugin";
Expand Down

0 comments on commit ecd9c97

Please sign in to comment.