chore: upgrade dependencies (#7065)

* chore: upgrade dependencies

* fix project words
This commit is contained in:
Joshua Chen 2022-03-30 11:05:50 +08:00 committed by GitHub
parent 2e79597f83
commit 3f33e90704
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
20 changed files with 301 additions and 300 deletions

View file

@ -29,7 +29,7 @@
"prompts": "^2.4.2",
"semver": "^7.3.5",
"shelljs": "^0.8.5",
"supports-color": "^9.2.1",
"supports-color": "^9.2.2",
"tslib": "^2.3.1"
},
"devDependencies": {

View file

@ -27,16 +27,16 @@
},
"devDependencies": {
"@babel/eslint-parser": "^7.17.0",
"eslint": "^8.11.0",
"eslint": "^8.12.0",
"eslint-config-airbnb": "^19.0.4",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-header": "^3.1.1",
"eslint-plugin-import": "^2.25.4",
"eslint-plugin-jsx-a11y": "^6.5.1",
"eslint-plugin-react": "^7.29.4",
"eslint-plugin-react-hooks": "^4.3.0",
"prettier": "^2.6.0",
"stylelint": "^14.6.0"
"eslint-plugin-react-hooks": "^4.4.0",
"prettier": "^2.6.1",
"stylelint": "^14.6.1"
},
"browserslist": {
"production": [

View file

@ -18,6 +18,6 @@
"postcss-sort-media-queries": "^4.2.1"
},
"devDependencies": {
"to-vfile": "^6.0.0"
"to-vfile": "^6.1.0"
}
}

View file

@ -28,10 +28,10 @@
"fs-extra": "^10.0.1",
"image-size": "^1.0.1",
"mdast-util-to-string": "^2.0.0",
"remark-emoji": "^2.1.0",
"remark-emoji": "^2.2.0",
"stringify-object": "^3.3.0",
"tslib": "^2.3.1",
"unist-util-visit": "^2.0.2",
"unist-util-visit": "^2.0.3",
"url-loader": "^4.1.1",
"webpack": "^5.70.0"
},
@ -41,9 +41,9 @@
"@types/mdast": "^3.0.10",
"@types/stringify-object": "^3.3.1",
"@types/unist": "^2.0.6",
"remark": "^12.0.0",
"remark": "^12.0.1",
"remark-mdx": "^1.6.21",
"to-vfile": "^6.0.0",
"to-vfile": "^6.1.0",
"unist-builder": "^2.0.3",
"unist-util-remove-position": "^3.0.0"
},

View file

@ -38,8 +38,8 @@
"remark-stringify": "^8.1.0",
"semver": "^7.3.5",
"tslib": "^2.3.1",
"unified": "^9.2.1",
"unist-util-visit": "^2.0.2"
"unified": "^9.2.2",
"unist-util-visit": "^2.0.3"
},
"devDependencies": {
"@types/color": "^3.0.3",

View file

@ -65,7 +65,9 @@ declare module '@generated/i18n' {
}
declare module '@generated/codeTranslations' {
const codeTranslations: {[msgId: string]: string};
import type {CodeTranslations} from '@docusaurus/types';
const codeTranslations: CodeTranslations;
export = codeTranslations;
}

View file

@ -19,13 +19,13 @@
"dependencies": {
"npm-to-yarn": "^1.0.1",
"tslib": "^2.3.1",
"unist-util-visit": "^2.0.2"
"unist-util-visit": "^2.0.3"
},
"devDependencies": {
"@types/mdast": "^3.0.10",
"remark": "^12.0.0",
"remark": "^12.0.1",
"remark-mdx": "^1.6.21",
"to-vfile": "^6.0.0"
"to-vfile": "^6.1.0"
},
"engines": {
"node": ">=14"

View file

@ -46,7 +46,7 @@
"@docusaurus/types": "2.0.0-beta.18",
"@types/mdx-js__react": "^1.5.5",
"@types/prismjs": "^1.26.0",
"@types/rtlcss": "^3.1.2",
"@types/rtlcss": "^3.1.3",
"cross-env": "^7.0.3",
"fs-extra": "^10.0.1",
"react-test-renderer": "^17.0.2",

View file

@ -7,6 +7,7 @@
import path from 'path';
import fs from 'fs-extra';
import type {CodeTranslations} from '@docusaurus/types';
function getDefaultLocalesDirPath(): string {
return path.join(__dirname, '../locales');
@ -39,7 +40,7 @@ export async function readDefaultCodeTranslationMessages({
dirPath?: string;
locale: string;
name: string;
}): Promise<{[msgId: string]: string}> {
}): Promise<CodeTranslations> {
const localesToTry = codeTranslationLocalesToTry(locale);
// Return the content of the first file that match

View file

@ -149,7 +149,7 @@ export type SiteMetadata = {
* @see https://help.phrase.com/help/chrome-json-messages
*/
export type TranslationMessage = {message: string; description?: string};
export type TranslationFileContent = {[key: string]: TranslationMessage};
export type TranslationFileContent = {[msgId: string]: TranslationMessage};
/**
* An abstract representation of how a translation file exists on disk. The core
* would handle the file reading/writing; plugins just need to deal with
@ -169,12 +169,14 @@ export type I18n = DeepRequired<I18nConfig> & {currentLocale: string};
export type GlobalData = {[pluginName: string]: {[pluginId: string]: unknown}};
export type CodeTranslations = {[msgId: string]: string};
export type DocusaurusContext = {
siteConfig: DocusaurusConfig;
siteMetadata: SiteMetadata;
globalData: GlobalData;
i18n: I18n;
codeTranslations: {[msgId: string]: string};
codeTranslations: CodeTranslations;
// Don't put mutable values here, to avoid triggering re-renders
// We could reconsider that choice if context selectors are implemented
@ -226,7 +228,7 @@ export type LoadContext = {
baseUrl: string;
i18n: I18n;
ssrTemplate: string;
codeTranslations: {[msgId: string]: string};
codeTranslations: CodeTranslations;
};
export type Props = LoadContext & {

View file

@ -137,7 +137,7 @@ export async function load(options: LoadContextOptions): Promise<Props> {
baseUrl,
siteConfig.onDuplicateRoutes,
);
const codeTranslations: {[msgId: string]: string} = {
const codeTranslations = {
...(await getPluginsDefaultCodeTranslationMessages(plugins)),
...siteCodeTranslations,
};

View file

@ -19,7 +19,7 @@ import logger from '@docusaurus/logger';
import type {
TranslationFileContent,
TranslationFile,
TranslationMessage,
CodeTranslations,
InitializedPlugin,
} from '@docusaurus/types';
@ -262,7 +262,7 @@ export async function localizePluginTranslationFile({
export async function getPluginsDefaultCodeTranslationMessages(
plugins: InitializedPlugin[],
): Promise<{[msgId: string]: string}> {
): Promise<CodeTranslations> {
const pluginsMessages = await Promise.all(
plugins.map((plugin) => plugin.getDefaultCodeTranslationMessages?.() ?? {}),
);
@ -277,9 +277,9 @@ export function applyDefaultCodeTranslations({
extractedCodeTranslations,
defaultCodeMessages,
}: {
extractedCodeTranslations: {[msgId: string]: TranslationMessage};
defaultCodeMessages: {[msgId: string]: string};
}): {[msgId: string]: TranslationMessage} {
extractedCodeTranslations: TranslationFileContent;
defaultCodeMessages: CodeTranslations;
}): TranslationFileContent {
const unusedDefaultCodeMessages = _.difference(
Object.keys(defaultCodeMessages),
Object.keys(extractedCodeTranslations),

View file

@ -18,7 +18,6 @@ import {
import type {
InitializedPlugin,
TranslationFileContent,
TranslationMessage,
} from '@docusaurus/types';
import nodePath from 'path';
import {SRC_DIR_NAME} from '@docusaurus/utils';
@ -130,7 +129,7 @@ function logSourceCodeFileTranslationsWarnings(
type SourceCodeFileTranslations = {
sourceCodeFilePath: string;
translations: {[msgId: string]: TranslationMessage};
translations: TranslationFileContent;
warnings: string[];
};
@ -189,7 +188,7 @@ function extractSourceCodeAstTranslations(
Full code: ${generate(node).code}`;
}
const translations: {[msgId: string]: TranslationMessage} = {};
const translations: TranslationFileContent = {};
const warnings: string[] = [];
let translateComponentName: string | undefined;
let translateFunctionName: string | undefined;

View file

@ -126,13 +126,11 @@ export function loadThemeAliases({
* instead of naively aliasing this to `client/exports`, we use fine-grained
* aliases instead.
*/
export async function loadDocusaurusAliases(): Promise<{
[aliasName: string]: string;
}> {
export async function loadDocusaurusAliases(): Promise<ThemeAliases> {
const dirPath = path.resolve(__dirname, '../../client/exports');
const extensions = ['.js', '.ts', '.tsx'];
const aliases: {[key: string]: string} = {};
const aliases: ThemeAliases = {};
(await fs.readdir(dirPath))
.filter((fileName) => extensions.includes(path.extname(fileName)))

View file

@ -10,6 +10,6 @@
"directory": "packages/stylelint-copyright"
},
"dependencies": {
"stylelint": "^14.6.0"
"stylelint": "^14.6.1"
}
}