Skip to content

Commit b4fdefc

Browse files
authored
refactor(core): remove unused TS exports (#14548)
1 parent d078bc7 commit b4fdefc

12 files changed

Lines changed: 2 additions & 127 deletions

File tree

packages/rspack/src/Module.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import './BuildInfo';
88
export type ResourceDataWithData = ResourceData & {
99
data?: Record<string, any>;
1010
};
11-
export type CreateData = binding.JsCreateData;
1211
export type ContextInfo = binding.ContextInfo;
1312
export type ResolveData = binding.JsResolveData;
1413

packages/rspack/src/RuntimeGlobals.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -466,12 +466,6 @@ export const isReservedRuntimeGlobal = (
466466
compilerRuntimeGlobals: Record<string, string>,
467467
) => Object.values(compilerRuntimeGlobals).includes(r);
468468

469-
export function renderModulePrefix(
470-
_compilerOptions: RspackOptionsNormalized,
471-
): string {
472-
return 'webpack/runtime/';
473-
}
474-
475469
export enum RuntimeVariable {
476470
Require,
477471
Context,

packages/rspack/src/builtin-loader/swc/types.ts

Lines changed: 0 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import type {
55
JscConfig,
66
ModuleConfig,
77
ParserConfig,
8-
TerserEcmaVersion,
98
TransformConfig,
109
TsParserConfig,
1110
} from '@swc/types';
@@ -73,62 +72,3 @@ export interface ReactServerComponentsOptions {
7372
*/
7473
disableClientApiChecks?: boolean;
7574
}
76-
77-
export interface TerserCompressOptions {
78-
arguments?: boolean;
79-
arrows?: boolean;
80-
booleans?: boolean;
81-
booleans_as_integers?: boolean;
82-
collapse_vars?: boolean;
83-
comparisons?: boolean;
84-
computed_props?: boolean;
85-
conditionals?: boolean;
86-
dead_code?: boolean;
87-
defaults?: boolean;
88-
directives?: boolean;
89-
drop_console?: boolean;
90-
drop_debugger?: boolean;
91-
ecma?: TerserEcmaVersion;
92-
evaluate?: boolean;
93-
expression?: boolean;
94-
global_defs?: any;
95-
hoist_funs?: boolean;
96-
hoist_props?: boolean;
97-
hoist_vars?: boolean;
98-
ie8?: boolean;
99-
if_return?: boolean;
100-
inline?: 0 | 1 | 2 | 3;
101-
join_vars?: boolean;
102-
keep_classnames?: boolean;
103-
keep_fargs?: boolean;
104-
keep_fnames?: boolean;
105-
keep_infinity?: boolean;
106-
loops?: boolean;
107-
negate_iife?: boolean;
108-
passes?: number;
109-
properties?: boolean;
110-
pure_getters?: any;
111-
pure_funcs?: string[];
112-
reduce_funcs?: boolean;
113-
reduce_vars?: boolean;
114-
sequences?: any;
115-
side_effects?: boolean;
116-
switches?: boolean;
117-
top_retain?: any;
118-
toplevel?: any;
119-
typeofs?: boolean;
120-
unsafe?: boolean;
121-
unsafe_passes?: boolean;
122-
unsafe_arrows?: boolean;
123-
unsafe_comps?: boolean;
124-
unsafe_function?: boolean;
125-
unsafe_math?: boolean;
126-
unsafe_symbols?: boolean;
127-
unsafe_methods?: boolean;
128-
unsafe_proto?: boolean;
129-
unsafe_regexp?: boolean;
130-
unsafe_undefined?: boolean;
131-
unused?: boolean;
132-
const_to_let?: boolean;
133-
module?: boolean;
134-
}

packages/rspack/src/lib/HookWebpackError.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,6 @@ export class HookWebpackError extends WebpackError {
3333
}
3434
}
3535

36-
export default HookWebpackError;
37-
3836
/**
3937
* @param error an error
4038
* @param hook name of the hook

packages/rspack/src/lib/cache/getLazyHashedEtag.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,5 +93,3 @@ export const getter = (
9393
innerMap.set(obj, newHash);
9494
return newHash;
9595
};
96-
97-
export default getter;

packages/rspack/src/lib/cache/mergeEtags.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,5 +76,3 @@ export const mergeEtags = (first: Etag, second: Etag): Etag => {
7676
}
7777
return mergedEtag;
7878
};
79-
80-
export default mergeEtags;

packages/rspack/src/rspack.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,4 +172,3 @@ function rspack(
172172

173173
// deliberately alias rspack as webpack
174174
export { createCompiler, createMultiCompiler, MultiStats, rspack, Stats };
175-
export default rspack;

packages/rspack/src/sharing/IndependentSharedPlugin.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,6 @@ const VIRTUAL_ENTRY = './virtual-entry.js';
2424
const VIRTUAL_ENTRY_NAME = 'virtual-entry';
2525
const BUILD_SHARED_FALLBACK_STAGE = 102;
2626

27-
export type MakeRequired<T, K extends keyof T> = Required<Pick<T, K>> &
28-
Omit<T, K>;
29-
3027
const filterPlugin = (plugin: Plugins[0], excludedPlugins: string[] = []) => {
3128
if (!plugin) {
3229
return true;

packages/rspack/src/stats/statsFactoryUtils.ts

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -135,12 +135,6 @@ export type KnownStatsModule = {
135135
source?: string | Buffer;
136136
};
137137

138-
export type KnownStatsProfile = {
139-
total: number;
140-
resolving: number;
141-
building: number;
142-
};
143-
144138
export type StatsModule = KnownStatsModule & Record<string, any>;
145139

146140
export type KnownStatsModuleIssuer = {
@@ -731,12 +725,3 @@ export const errorsSpaceLimit = (errors: StatsError[], max: number) => {
731725
filtered,
732726
};
733727
};
734-
735-
export const warningFromStatsWarning = (
736-
warning: binding.JsStatsError,
737-
): Error => {
738-
const res = new Error(warning.message);
739-
res.name = warning.name || 'StatsWarning';
740-
Object.assign(res, warning);
741-
return res;
742-
};

packages/rspack/src/util/comparators.ts

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,8 @@ export const compareIds = <T = string | number>(a: T, b: T): -1 | 0 | 1 => {
7575
return 0;
7676
};
7777

78+
export const compareNumbers = compareIds<number>;
79+
7880
const compareSelectCache: TwoKeyWeakMap<
7981
Selector<any, any>,
8082
Comparator,
@@ -105,12 +107,3 @@ export const compareSelect = <T, R>(
105107
compareSelectCache.set(getter, comparator, result);
106108
return result;
107109
};
108-
109-
export const compareNumbers = (a: number, b: number) => {
110-
if (typeof a !== typeof b) {
111-
return typeof a < typeof b ? -1 : 1;
112-
}
113-
if (a < b) return -1;
114-
if (a > b) return 1;
115-
return 0;
116-
};

0 commit comments

Comments
 (0)