Skip to content

Commit

Permalink
chore: fix typos in JavaScript and TypeScript files (web-infra-dev#5095)
Browse files Browse the repository at this point in the history
  • Loading branch information
Boshen authored Dec 25, 2023
1 parent 2306b4b commit 0b9a919
Show file tree
Hide file tree
Showing 10 changed files with 33 additions and 21 deletions.
13 changes: 10 additions & 3 deletions .typos.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,21 @@

[files]
extend-exclude = [
"**/*.{css,map,json,txt,ts,tsx,js,snap,bak,diff,html}",
"**/*.{css,map,json,txt,snap,bak,diff,html}",
"**/tests/**",
"**/mock/**",
"packages/rspack-test-tools",
"packages/rspack/tests/hashCases",
"packages/rspack/src/util/hash",
"webpack-examples",
"webpack-test",
"./examples",
"examples",
"**/CHANGELOG.md",
"GOVERNANCE.md",
"pnpm-lock.yaml",
]

[default.extend-words]
Nd = "Nd"
Nd = "Nd"
fo = "fo"
splitted = "splitted"
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ __webpack_require__.f.css = function (chunkId, promises) {
}
}
};
// TODO: diffrent with webpack
// TODO: different with webpack
// webpack using `loadCssChunkData` and detect css variables to add install chunk.
// Because rspack the css chunk is always generate one js chunk, so here use js chunk to add install chunk.
var loadCssChunkCallback = function (parentChunkLoadingFunction, data) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export default () => {
getData()
}, [])

const formatedData = useMemo(() => {
const formattedData = useMemo(() => {
return [
{
title: t['multiDAnalysis.dataOverview.contentProduction'],
Expand Down Expand Up @@ -65,8 +65,8 @@ export default () => {

return (
<Grid.Row justify="space-between">
{formatedData.map((item, index) => (
<Grid.Col span={24 / formatedData.length} key={`${index}`}>
{formattedData.map((item, index) => (
<Grid.Col span={24 / formattedData.length} key={`${index}`}>
<Card className={styles.card} title={null}>
<Title heading={6}>{item.title}</Title>
<div className={styles.content}>
Expand Down
2 changes: 1 addition & 1 deletion packages/rspack-cli/src/globals.d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
** https://github.com/jorgebucaran/colorette/pull/96
** colorette is broken in moduileResolution:nodenext,even it's fixed it's never published
** colorette is broken in moduleResolution:nodenext,even it's fixed it's never published
*/
declare module "colorette" {
type Color = (text: string | number) => string;
Expand Down
13 changes: 9 additions & 4 deletions packages/rspack-dev-server/src/ansiHTML.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ var _regANSI =
/(?:(?:\u001b\[)|\u009b)(?:(?:[0-9]{1,3})?(?:(?:;[0-9]{0,3})*)?[A-M|f-m])|\u001b[A-M]/;

var _defColors = {
reset: ["fff", "000"], // [FOREGROUD_COLOR, BACKGROUND_COLOR]
reset: ["fff", "000"], // [FOREGROUND_COLOR, BACKGROUND_COLOR]
black: "000",
red: "ff0000",
green: "209805",
Expand Down Expand Up @@ -155,8 +155,11 @@ function ansiHTML(text) {
return rep;

function applySeq(seq) {
var ot = _openTags[seq];
if (ot && (ot = typeof ot === "function" ? ot(match) : ot)) {
var other = _openTags[seq];
if (
other &&
(other = typeof other === "function" ? other(match) : other)
) {
// If reset signal is encountered, we have to reset everything.
var ret = "";
if (seq === "0") {
Expand All @@ -170,7 +173,9 @@ function ansiHTML(text) {
}
// Open tag.
ansiCodes.push(seq);
return ret + (ot[0] === "<" ? ot : '<span style="' + ot + ';">');
return (
ret + (other[0] === "<" ? other : '<span style="' + other + ';">')
);
}

var ct = _closeTags[seq];
Expand Down
8 changes: 4 additions & 4 deletions packages/rspack-plugin-html/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -534,7 +534,7 @@ function hookIntoCompiler(
);
});

const templateExectutionPromise = Promise.all([
const templateExecutionPromise = Promise.all([
assetsPromise,
assetTagGroupsPromise,
templateEvaluationPromise
Expand All @@ -556,7 +556,7 @@ function hookIntoCompiler(

const injectedHtmlPromise = Promise.all([
assetTagGroupsPromise,
templateExectutionPromise
templateExecutionPromise
])
// Allow plugins to change the html before assets are injected
.then(([assetTags, html]) => {
Expand Down Expand Up @@ -778,14 +778,14 @@ function hookIntoCompiler(
excludedChunks: string[]
) {
return chunks.filter(chunkName => {
// Skip if the chunks should be filtered and the given chunk was not added explicity
// Skip if the chunks should be filtered and the given chunk was not added explicitly
if (
Array.isArray(includedChunks) &&
includedChunks.indexOf(chunkName) === -1
) {
return false;
}
// Skip if the chunks should be filtered and the given chunk was excluded explicity
// Skip if the chunks should be filtered and the given chunk was excluded explicitly
if (
Array.isArray(excludedChunks) &&
excludedChunks.indexOf(chunkName) !== -1
Expand Down
2 changes: 1 addition & 1 deletion packages/rspack-plugin-react-refresh/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class ReactRefreshRspackPlugin {
});

const definedModules = {
// For Mutiple Instance Mode
// For Multiple Instance Mode
__react_refresh_library__: JSON.stringify(
compiler.webpack.Template.toIdentifier(
this.options.library ||
Expand Down
4 changes: 2 additions & 2 deletions packages/rspack/src/config/adapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,14 +140,14 @@ function getRawTarget(target: Target | undefined): RawOptions["target"] {
function getRawAlias(
alias: Resolve["alias"] = {}
): RawOptions["resolve"]["alias"] {
const entires = Object.entries(alias).map(([key, value]) => {
const entries = Object.entries(alias).map(([key, value]) => {
if (Array.isArray(value)) {
return [key, value];
} else {
return [key, [value]];
}
});
return Object.fromEntries(entires);
return Object.fromEntries(entries);
}

function getRawResolveByDependency(
Expand Down
2 changes: 1 addition & 1 deletion packages/rspack/src/config/zod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ export type LibraryCustomUmdCommentObject = z.infer<
>;

const amdContainer = z.string();
export type AmdComtainer = z.infer<typeof amdContainer>;
export type AmdContainer = z.infer<typeof amdContainer>;

const auxiliaryComment = z.string().or(libraryCustomUmdCommentObject);
export type AuxiliaryComment = z.infer<typeof auxiliaryComment>;
Expand Down
2 changes: 1 addition & 1 deletion packages/rspack/src/rspackOptionsApply.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ export function applyEntryOptions(
`You are depend on ${termlink(
"apply entry lazily",
"https://rspack.dev/config/experiments.html#experimentsrspackfuturedisableapplyentrylazily"
)}, this behavior has been deprecated, you can setup 'experiments.rspackFuture.disableApplyEntryLazily = true' to disable this behaivor, and this will enabled by default in v0.5+`
)}, this behavior has been deprecated, you can setup 'experiments.rspackFuture.disableApplyEntryLazily = true' to disable this behavior, and this will enabled by default in v0.5+`
);
}
if (compiler.parentCompilation === undefined) {
Expand Down

0 comments on commit 0b9a919

Please sign in to comment.