-
-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into ozaki/authorPageBaseURL
- Loading branch information
Showing
100 changed files
with
2,128 additions
and
1,371 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.tsbuildinfo* | ||
tsconfig* | ||
__tests__ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# `@docusaurus/faster` | ||
|
||
Docusaurus experimental package exposing new modern dependencies to make the build faster. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
{ | ||
"name": "@docusaurus/faster", | ||
"version": "3.5.2", | ||
"description": "Docusaurus experimental package exposing new modern dependencies to make the build faster.", | ||
"main": "./lib/index.js", | ||
"types": "./lib/index.d.ts", | ||
"scripts": { | ||
"build": "tsc", | ||
"watch": "tsc --watch" | ||
}, | ||
"publishConfig": { | ||
"access": "public" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/facebook/docusaurus.git", | ||
"directory": "packages/docusaurus-faster" | ||
}, | ||
"license": "MIT", | ||
"dependencies": { | ||
"webpack": "^5.88.1", | ||
"@swc/core": "^1.7.14", | ||
"swc-loader": "^0.2.6" | ||
}, | ||
"engines": { | ||
"node": ">=18.0" | ||
}, | ||
"peerDependencies": { | ||
"@docusaurus/types": "*" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
/** | ||
* Copyright (c) Facebook, Inc. and its affiliates. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
import type {RuleSetRule} from 'webpack'; | ||
import type {JsMinifyOptions} from '@swc/core'; | ||
|
||
export function getSwcJsLoaderFactory({ | ||
isServer, | ||
}: { | ||
isServer: boolean; | ||
}): RuleSetRule { | ||
return { | ||
loader: require.resolve('swc-loader'), | ||
options: { | ||
jsc: { | ||
parser: { | ||
syntax: 'typescript', | ||
tsx: true, | ||
}, | ||
transform: { | ||
react: { | ||
runtime: 'automatic', | ||
}, | ||
}, | ||
target: 'es2017', | ||
}, | ||
module: { | ||
type: isServer ? 'commonjs' : 'es6', | ||
}, | ||
}, | ||
}; | ||
} | ||
|
||
// Note: these options are similar to what we use in core | ||
// They should rather be kept in sync for now to avoid any unexpected behavior | ||
// The goal of faster minifier is not to fine-tune options but only to be faster | ||
// See core minification.ts | ||
export function getSwcJsMinifierOptions(): JsMinifyOptions { | ||
return { | ||
ecma: 2020, | ||
compress: { | ||
ecma: 5, | ||
}, | ||
module: true, | ||
mangle: true, | ||
safari10: true, | ||
format: { | ||
ecma: 5, | ||
comments: false, | ||
ascii_only: true, | ||
}, | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"extends": "../../tsconfig.base.json", | ||
"compilerOptions": { | ||
"noEmit": false, | ||
"sourceMap": true, | ||
"declarationMap": true | ||
}, | ||
"include": ["src"], | ||
"exclude": ["**/__tests__/**"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
/** | ||
* Copyright (c) Facebook, Inc. and its affiliates. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
import {createProcessors} from './processor'; | ||
import type {Options} from './loader'; | ||
import type {RuleSetRule, RuleSetUseItem} from 'webpack'; | ||
|
||
async function enhancedOptions(options: Options): Promise<Options> { | ||
// Because Jest doesn't like ESM / createProcessors() | ||
if (process.env.N0DE_ENV === 'test' || process.env.JEST_WORKER_ID) { | ||
return options; | ||
} | ||
|
||
// We create the processor earlier here, to avoid the lazy processor creating | ||
// Lazy creation messes-up with Rsdoctor ability to measure mdx-loader perf | ||
const newOptions: Options = options.processors | ||
? options | ||
: {...options, processors: await createProcessors({options})}; | ||
|
||
return newOptions; | ||
} | ||
|
||
export async function createMDXLoaderItem( | ||
options: Options, | ||
): Promise<RuleSetUseItem> { | ||
return { | ||
loader: require.resolve('@docusaurus/mdx-loader'), | ||
options: await enhancedOptions(options), | ||
}; | ||
} | ||
|
||
export async function createMDXLoaderRule({ | ||
include, | ||
options, | ||
}: { | ||
include: RuleSetRule['include']; | ||
options: Options; | ||
}): Promise<RuleSetRule> { | ||
return { | ||
test: /\.mdx?$/i, | ||
include, | ||
use: [await createMDXLoaderItem(options)], | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.