Skip to content
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

chore: change the typo words #585

Merged
merged 1 commit into from
Nov 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
10 changes: 5 additions & 5 deletions e2e/cases/doctor-webpack/loaders/proxy.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { expect, test } from '@playwright/test';
import { getSDK, setSDK } from '@rsdoctor/core/plugins';
import { RsdoctorWebpackSDK } from '@rsdoctor/sdk';
import { RsdoctorSDK } from '@rsdoctor/sdk';
import { SDK } from '@rsdoctor/types';
import { compileByWebpack5 } from '@scripts/test-helper';
import os from 'os';
Expand Down Expand Up @@ -41,7 +41,7 @@ test('webpack5', async () => {
const { modules } = await webpack5(mode);

expect(modules!.length).toEqual(1);
expect(getSDK()).toBeInstanceOf(RsdoctorWebpackSDK);
expect(getSDK()).toBeInstanceOf(RsdoctorSDK);

const { loader } = getSDK().getStoreData();

Expand Down Expand Up @@ -69,7 +69,7 @@ test('test async', async () => {
const { modules } = await webpack5(mode);

expect(modules!.length).toEqual(1);
expect(getSDK()).toBeInstanceOf(RsdoctorWebpackSDK);
expect(getSDK()).toBeInstanceOf(RsdoctorSDK);

const { loader } = getSDK().getStoreData();

Expand Down Expand Up @@ -97,7 +97,7 @@ test('test callback', async () => {
const { modules } = await webpack5(mode);

expect(modules!.length).toEqual(1);
expect(getSDK()).toBeInstanceOf(RsdoctorWebpackSDK);
expect(getSDK()).toBeInstanceOf(RsdoctorSDK);

const { loader } = getSDK().getStoreData();

Expand Down Expand Up @@ -126,7 +126,7 @@ test('test pitch', async () => {
const { modules } = await webpack5(mode, pitchResult);

expect(modules!.length).toEqual(1);
expect(getSDK()).toBeInstanceOf(RsdoctorWebpackSDK);
expect(getSDK()).toBeInstanceOf(RsdoctorSDK);

const { loader } = getSDK().getStoreData();

Expand Down
6 changes: 3 additions & 3 deletions packages/cli/src/commands/analyze.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Manifest } from '@rsdoctor/utils/common';
import { Constants, Manifest as ManifestType, SDK } from '@rsdoctor/types';
import { RsdoctorWebpackSDK } from '@rsdoctor/sdk';
import { RsdoctorSDK } from '@rsdoctor/sdk';
import ora from 'ora';
import { cyan, red } from 'picocolors';
import { Command } from '../types';
Expand All @@ -18,7 +18,7 @@ interface Options {
type?: SDK.ToDataType;
}

export const analyze: Command<Commands.Analyze, Options, RsdoctorWebpackSDK> =
export const analyze: Command<Commands.Analyze, Options, RsdoctorSDK> =
enhanceCommand(({ cwd, name, bin }) => ({
command: Commands.Analyze,
description: `
Expand Down Expand Up @@ -82,7 +82,7 @@ example: ${bin} ${Commands.Analyze} --profile "${Constants.RsdoctorOutputManifes

spinner.text = `start server`;

const sdk = new RsdoctorWebpackSDK({ name, root: cwd, port, type });
const sdk = new RsdoctorSDK({ name, root: cwd, port, type });

await sdk.bootstrap();

Expand Down
6 changes: 3 additions & 3 deletions packages/cli/src/commands/bundle-diff.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
import { Commands } from '../constants';
import { Client, Manifest as ManifestType, SDK } from '@rsdoctor/types';
import { Manifest } from '@rsdoctor/utils/common';
import { RsdoctorWebpackSDK } from '@rsdoctor/sdk';
import { RsdoctorSDK } from '@rsdoctor/sdk';

interface Options {
current: string;
Expand Down Expand Up @@ -110,8 +110,8 @@ example: ${bin} ${Commands.BundleDiff} --baseline="x.json" --current="x.json"

spinner.text = `start server`;

const baselineSdk = new RsdoctorWebpackSDK({ name, root: cwd });
const currentSdk = new RsdoctorWebpackSDK({ name, root: cwd });
const baselineSdk = new RsdoctorSDK({ name, root: cwd });
const currentSdk = new RsdoctorSDK({ name, root: cwd });

await Promise.all([baselineSdk.bootstrap(), currentSdk.bootstrap()]);

Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/inner-plugins/plugins/base.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { RsdoctorWebpackSDK } from '@rsdoctor/sdk';
import type { RsdoctorSDK } from '@rsdoctor/sdk';
import type { Linter, Plugin } from '@rsdoctor/types';
import {
internalPluginTapPostOptions,
Expand All @@ -24,7 +24,7 @@ export abstract class InternalBasePlugin<T extends Plugin.BaseCompiler>
return this.scheduler.options;
}

get sdk(): RsdoctorWebpackSDK {
get sdk(): RsdoctorSDK {
return this.scheduler.sdk;
}

Expand Down
6 changes: 3 additions & 3 deletions packages/core/src/inner-plugins/utils/plugin.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import type { SDK } from '@rsdoctor/types';
import type { RsdoctorWebpackSDK } from '@rsdoctor/sdk';
import type { RsdoctorSDK } from '@rsdoctor/sdk';
import { DevToolError } from '@rsdoctor/utils/error';
import { IHook } from '@/build-utils/build/utils';

export function reportPluginData(
sdk: RsdoctorWebpackSDK,
sdk: RsdoctorSDK,
hook: string,
tapName: string,
start: number,
Expand Down Expand Up @@ -36,7 +36,7 @@ export function reportPluginData(
}

export function interceptPluginHook(
sdk: RsdoctorWebpackSDK,
sdk: RsdoctorSDK,
name: string,
hook: IHook,
) {
Expand Down
8 changes: 4 additions & 4 deletions packages/core/src/inner-plugins/utils/sdk.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import { RsdoctorSlaveSDK, RsdoctorWebpackSDK } from '@rsdoctor/sdk';
import { RsdoctorPrimarySDK, RsdoctorSDK } from '@rsdoctor/sdk';

let sdk: RsdoctorWebpackSDK;
let sdk: RsdoctorSDK;

export function setSDK(t: RsdoctorWebpackSDK) {
export function setSDK(t: RsdoctorSDK) {
sdk = t;
}

export function getSDK(builderName?: string) {
if (sdk && builderName && 'parent' in sdk) {
const _sdk = sdk as unknown as RsdoctorSlaveSDK;
const _sdk = sdk as unknown as RsdoctorPrimarySDK;
const slaveSDK = _sdk.parent.slaves.find(
(_sdk: { name: string }) => _sdk.name === builderName,
);
Expand Down
10 changes: 5 additions & 5 deletions packages/core/src/types/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import type {
Plugin,
SDK,
} from '@rsdoctor/types';
import type { RsdoctorSlaveSDK, RsdoctorWebpackSDK } from '@rsdoctor/sdk';
import type { RsdoctorPrimarySDK, RsdoctorSDK } from '@rsdoctor/sdk';
import { ChunkGraph, ModuleGraph } from '@rsdoctor/graph';
import { rules } from '@/rules/rules';

Expand Down Expand Up @@ -58,7 +58,7 @@ export interface RsdoctorWebpackPluginOptions<
/**
* sdk instance of outside
*/
sdkInstance?: RsdoctorWebpackSDK;
sdkInstance?: RsdoctorSDK;

/**
* Whether to turn on some characteristic analysis capabilities, such as: the support for the BannerPlugin.
Expand Down Expand Up @@ -106,7 +106,7 @@ export interface RsdoctorWebpackPluginOptions<
export interface RsdoctorMultiplePluginOptions<
Rules extends LinterType.ExtendRuleData[] = LinterType.ExtendRuleData[],
> extends Omit<RsdoctorWebpackPluginOptions<Rules>, 'sdkInstance'>,
Pick<ConstructorParameters<typeof RsdoctorSlaveSDK>[0], 'stage'> {
Pick<ConstructorParameters<typeof RsdoctorPrimarySDK>[0], 'stage'> {
/**
* name of builder
*/
Expand Down Expand Up @@ -134,7 +134,7 @@ export interface RsdoctorPluginOptionsNormalized<
> {
features: Common.DeepRequired<Plugin.RsdoctorWebpackPluginFeatures>;
linter: Required<LinterType.Options<Rules, InternalRules>>;
sdkInstance?: RsdoctorWebpackSDK;
sdkInstance?: RsdoctorSDK;
port?: number;
reportCodeType: SDK.ToDataType;
supports: ISupport;
Expand All @@ -160,7 +160,7 @@ export interface RsdoctorPluginInstance<
> extends BasePluginInstance<T> {
readonly name: string;
readonly options: RsdoctorPluginOptionsNormalized<Rules>;
readonly sdk: RsdoctorWebpackSDK;
readonly sdk: RsdoctorSDK;
readonly isRsdoctorPlugin: boolean;
_modulesGraphApplied?: boolean;
chunkGraph?: ChunkGraph;
Expand Down
10 changes: 3 additions & 7 deletions packages/rspack-plugin/src/plugin.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
import type { Configuration, RuleSetRule } from '@rspack/core';
import { ModuleGraph } from '@rsdoctor/graph';
import {
openBrowser,
RsdoctorSlaveSDK,
RsdoctorWebpackSDK,
} from '@rsdoctor/sdk';
import { openBrowser, RsdoctorPrimarySDK, RsdoctorSDK } from '@rsdoctor/sdk';
import {
InternalLoaderPlugin,
InternalPluginsPlugin,
Expand Down Expand Up @@ -44,7 +40,7 @@ export class RsdoctorRspackPlugin<Rules extends Linter.ExtendRuleData[]>
{
public readonly name = pluginTapName;

public readonly sdk: RsdoctorWebpackSDK | RsdoctorSlaveSDK;
public readonly sdk: RsdoctorSDK | RsdoctorPrimarySDK;

public readonly isRsdoctorPlugin: boolean;

Expand Down Expand Up @@ -72,7 +68,7 @@ export class RsdoctorRspackPlugin<Rules extends Linter.ExtendRuleData[]>
);
this.sdk =
this.options.sdkInstance ??
new RsdoctorWebpackSDK({
new RsdoctorSDK({
port: this.options.port,
name: pluginTapName,
root: process.cwd(),
Expand Down
8 changes: 4 additions & 4 deletions packages/sdk/src/sdk/multiple/controller.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { Manifest } from '@rsdoctor/types';
import { RsdoctorSlaveSDK } from './slave';
import { RsdoctorPrimarySDK } from './slave';

export class RsdoctorSDKController {
readonly slaves: RsdoctorSlaveSDK[] = [];
readonly slaves: RsdoctorPrimarySDK[] = [];

public root = '';

Expand Down Expand Up @@ -42,8 +42,8 @@ export class RsdoctorSDKController {
name,
stage,
extraConfig,
}: Omit<ConstructorParameters<typeof RsdoctorSlaveSDK>[0], 'controller'>) {
const slave = new RsdoctorSlaveSDK({
}: Omit<ConstructorParameters<typeof RsdoctorPrimarySDK>[0], 'controller'>) {
const slave = new RsdoctorPrimarySDK({
name,
stage,
controller: this,
Expand Down
6 changes: 3 additions & 3 deletions packages/sdk/src/sdk/multiple/server.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { Server } from '@rsdoctor/utils/build';
import { RsdoctorServer } from '../server';
import type { RsdoctorSlaveSDK } from './slave';
import type { RsdoctorPrimarySDK } from './slave';

export class RsdoctorSlaveServer extends RsdoctorServer {
protected sdk: RsdoctorSlaveSDK;
protected sdk: RsdoctorPrimarySDK;

constructor(sdk: RsdoctorSlaveSDK, port = Server.defaultPort) {
constructor(sdk: RsdoctorPrimarySDK, port = Server.defaultPort) {
super(sdk, port);
this.sdk = sdk;
}
Expand Down
4 changes: 2 additions & 2 deletions packages/sdk/src/sdk/multiple/slave.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import path from 'path';
import { SDK } from '@rsdoctor/types';
import { RsdoctorWebpackSDK } from '../sdk';
import { RsdoctorSDK } from '../sdk';
import { RsdoctorSlaveServer } from './server';
import type { RsdoctorSDKController } from './controller';

Expand All @@ -18,7 +18,7 @@ interface RsdoctorSlaveSDKOptions {
controller: RsdoctorSDKController;
}

export class RsdoctorSlaveSDK extends RsdoctorWebpackSDK {
export class RsdoctorPrimarySDK extends RsdoctorSDK {
id: number;

parent: RsdoctorSDKController;
Expand Down
2 changes: 1 addition & 1 deletion packages/sdk/src/sdk/sdk/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { isNumber } from 'lodash';

export * from '../utils/openBrowser';

export class RsdoctorWebpackSDK<
export class RsdoctorSDK<
T extends RsdoctorWebpackSDKOptions = RsdoctorWebpackSDKOptions,
>
extends SDKCore<T>
Expand Down
6 changes: 3 additions & 3 deletions packages/sdk/tests/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
import { request } from 'http';
import { tmpdir } from 'os';
import path from 'path';
import { RsdoctorWebpackSDK } from '../src/sdk';
import { RsdoctorSDK } from '../src/sdk';

export interface MockSDKResponse {
sdk: RsdoctorWebpackSDK;
sdk: RsdoctorSDK;
server: SDK.RsdoctorServerInstance;
// get<T extends boolean = false>(pathname: string, toJson?: T): Promise<T extends true ? object : string>;
get<T extends SDK.ServerAPI.API>(
Expand All @@ -34,7 +34,7 @@
config?: SDK.SDKOptionsType,
): Promise<MockSDKResponse> {
const port = await Server.getPort(4396);
const sdk = new RsdoctorWebpackSDK({ name: 'test', root: cwd, port, config });
const sdk = new RsdoctorSDK({ name: 'test', root: cwd, port, config });

await sdk.bootstrap();

Expand Down Expand Up @@ -135,7 +135,7 @@
});

afterAll(async () => {
await target.dispose();

Check failure on line 138 in packages/sdk/tests/utils.ts

View workflow job for this annotation

GitHub Actions / ut-windows (18.x)

packages/sdk/tests/server/apis/data.test.ts > test server/apis/data.ts

TypeError: Cannot read properties of undefined (reading 'dispose') ❯ packages/sdk/tests/utils.ts:138:18
});

return new Proxy(
Expand Down
6 changes: 3 additions & 3 deletions packages/webpack-plugin/src/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import type {
RsdoctorWebpackPluginOptions,
} from '@rsdoctor/core/types';
import { ChunkGraph, ModuleGraph } from '@rsdoctor/graph';
import { openBrowser, RsdoctorWebpackSDK } from '@rsdoctor/sdk';
import { openBrowser, RsdoctorSDK } from '@rsdoctor/sdk';
import { Constants, Linter, Manifest, SDK } from '@rsdoctor/types';
import { Process } from '@rsdoctor/utils/build';
import { chalk, debug } from '@rsdoctor/utils/logger';
Expand All @@ -38,7 +38,7 @@ export class RsdoctorWebpackPlugin<Rules extends Linter.ExtendRuleData[]>

public readonly options: RsdoctorPluginOptionsNormalized<Rules>;

public readonly sdk: RsdoctorWebpackSDK;
public readonly sdk: RsdoctorSDK;

public readonly isRsdoctorPlugin: boolean;

Expand All @@ -54,7 +54,7 @@ export class RsdoctorWebpackPlugin<Rules extends Linter.ExtendRuleData[]>
this.options = normalizeUserConfig<Rules>(options);
this.sdk =
this.options.sdkInstance ??
new RsdoctorWebpackSDK({
new RsdoctorSDK({
port: this.options.port,
name: pluginTapName,
root: process.cwd(),
Expand Down
4 changes: 2 additions & 2 deletions packages/webpack-plugin/src/plugins/resolver.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { InternalBasePlugin } from '@rsdoctor/core/plugins';
import { RsdoctorWebpackSDK } from '@rsdoctor/sdk';
import { RsdoctorSDK } from '@rsdoctor/sdk';
import { Manifest, SDK } from '@rsdoctor/types';
import { Time } from '@rsdoctor/utils/common';
import path from 'path';
Expand Down Expand Up @@ -37,7 +37,7 @@ export class RsdoctorResolverPlugin implements ResolvePluginInstance {

constructor(
protected options: RsdoctorResolverPluginOptions,
protected sdk: RsdoctorWebpackSDK,
protected sdk: RsdoctorSDK,
) {}

protected getResolverData(
Expand Down
Loading