Skip to content

Commit

Permalink
Merge branch 'main' into ozaki/authorPageBaseURL
Browse files Browse the repository at this point in the history
  • Loading branch information
OzakIOne committed Aug 27, 2024
2 parents bbc86e8 + d5885c0 commit bc3b714
Show file tree
Hide file tree
Showing 100 changed files with 2,128 additions and 1,371 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/argos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
- name: Use Node.js
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
with:
node-version: 20
node-version: lts/*

- name: Install dependencies
run: yarn install --frozen-lockfile
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build-blog-only.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
- name: Set up Node
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
with:
node-version: 20
node-version: lts/*
cache: yarn
- name: Installation
run: yarn
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build-hash-router.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
- name: Set up Node
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
with:
node-version: '18'
node-version: lts/*
cache: yarn
- name: Installation
run: yarn
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/build-perf.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
- name: Set up Node
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
with:
node-version: 20
node-version: lts/*
cache: yarn
- name: Track build size changes
uses: preactjs/compressed-size-action@f780fd104362cfce9e118f9198df2ee37d12946c # v2
Expand All @@ -64,6 +64,7 @@ jobs:
- name: Set up Node
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
with:
node-version: lts/*
cache: yarn
- name: Installation
run: yarn
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/canary-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
- name: Set up Node
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
with:
node-version: 20
node-version: lts/*
cache: yarn
- name: Prepare git
run: |
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ jobs:
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1

- name: Initialize CodeQL
uses: github/codeql-action/init@883d8588e56d1753a8a58c1c86e88976f0c23449 # 3.26.3
uses: github/codeql-action/init@2c779ab0d087cd7fe7b826087247c2c81f27bfa6 # 3.26.5
with:
languages: ${{ matrix.language }}

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@883d8588e56d1753a8a58c1c86e88976f0c23449 # 3.26.3
uses: github/codeql-action/analyze@2c779ab0d087cd7fe7b826087247c2c81f27bfa6 # 3.26.5
8 changes: 7 additions & 1 deletion .github/workflows/continuous-releases.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@ jobs:
- name: Checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1

- name: Set up Node
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
with:
node-version: lts/*
cache: yarn

- name: Installation
run: yarn

Expand All @@ -32,4 +38,4 @@ jobs:
yarn create-docusaurus template/docusaurus-classic-ts classic --typescript -p npm
- name: Release
run: npx pkg-pr-new publish './packages/*' --template './template/*' --compact --comment=off
run: npx pkg-pr-new@0.0.20 publish './packages/*' --template './template/*' --compact --comment=off
2 changes: 1 addition & 1 deletion .github/workflows/lighthouse-report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
- name: Use Node.js
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
with:
node-version: 20
node-version: lts/*

- name: Install dependencies
run: yarn install --frozen-lockfile
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
- name: Set up Node
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
with:
node-version: 20
node-version: lts/*
cache: yarn
- name: Installation
run: yarn
Expand All @@ -34,7 +34,7 @@ jobs:

- name: Check for suspicious yarn.lock
# for allowed aliases, see https://github.com/yargs/cliui/pull/139/files#r1670711112
run: yarn lockfile-lint --path yarn.lock --type yarn --allowed-hosts yarn --validate-https --validate-package-names --validate-integrity --empty-hostname=false --allowed-package-name-aliases react-loadable string-width-cjs strip-ansi-cjs wrap-ansi-cjs
run: yarn lockfile-lint --path yarn.lock --type yarn --allowed-hosts yarn --validate-https --validate-package-names --validate-integrity --empty-hostname=false --allowed-package-name-aliases serve-handler react-loadable string-width-cjs strip-ansi-cjs wrap-ansi-cjs

- name: Lint
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/showcase-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
- name: Set up Node
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
with:
node-version: 20
node-version: lts/*
cache: yarn
- name: Installation
run: yarn
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/tests-e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
node: ['18.0', '20', '22.4']
node: ['18.0', '20', '22']
steps:
- name: Checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/tests-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
runs-on: windows-latest
strategy:
matrix:
node: ['18.0', '20', '22.4']
node: ['18.0', '20', '22']
steps:
- name: Support longpaths
run: git config --system core.longpaths true
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
node: ['18.0', '20', '22.4']
node: ['18.0', '20', '22']
steps:
- name: Checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
Expand Down
4 changes: 4 additions & 0 deletions admin/verdaccio.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ packages:
access: $all
publish: $all
proxy: npmjs
'@docusaurus/serve-handler':
access: $all
publish: $all
proxy: npmjs
# Group and isolate all local packages, avoid being proxy from outside
'@docusaurus/*':
access: $all
Expand Down
13 changes: 7 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
"build:website:deployPreview:build": "cross-env NETLIFY=true CONTEXT='deploy-preview' yarn workspace website build",
"build:website:deployPreview": "yarn build:website:deployPreview:testWrap && yarn build:website:deployPreview:build",
"build:website:fast": "yarn workspace website build:fast",
"build:website:fast:rsdoctor": "yarn workspace website build:fast:rsdoctor",
"build:website:fast:profile": "yarn workspace website build:fast:profile",
"build:website:en": "yarn workspace website build --locale en",
"clear:website": "yarn workspace website clear",
Expand Down Expand Up @@ -70,11 +71,11 @@
"devDependencies": {
"@crowdin/cli": "^3.13.0",
"@prettier/plugin-xml": "^2.2.0",
"@swc/core": "1.2.197",
"@swc/jest": "^0.2.26",
"@swc/core": "^1.7.14",
"@swc/jest": "^0.2.36",
"@testing-library/react-hooks": "^8.0.1",
"@types/fs-extra": "^9.0.13",
"@types/jest": "^29.5.3",
"@types/jest": "^29.5.12",
"@types/lodash": "^4.14.197",
"@types/node": "^18.16.19",
"@types/prompts": "^2.4.4",
Expand All @@ -99,9 +100,9 @@
"eslint-plugin-regexp": "^1.15.0",
"husky": "^8.0.3",
"image-size": "^1.0.2",
"jest": "^29.6.1",
"jest-environment-jsdom": "^29.6.1",
"jest-serializer-ansi-escapes": "^2.0.1",
"jest": "^29.7.0",
"jest-environment-jsdom": "^29.7.0",
"jest-serializer-ansi-escapes": "^3.0.0",
"jest-serializer-react-helmet-async": "^1.0.21",
"lerna": "^6.6.2",
"lerna-changelog": "^2.2.0",
Expand Down
3 changes: 3 additions & 0 deletions packages/docusaurus-faster/.npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.tsbuildinfo*
tsconfig*
__tests__
3 changes: 3 additions & 0 deletions packages/docusaurus-faster/README.md
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.
31 changes: 31 additions & 0 deletions packages/docusaurus-faster/package.json
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": "*"
}
}
57 changes: 57 additions & 0 deletions packages/docusaurus-faster/src/index.ts
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,
},
};
}
10 changes: 10 additions & 0 deletions packages/docusaurus-faster/tsconfig.json
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__/**"]
}
48 changes: 48 additions & 0 deletions packages/docusaurus-mdx-loader/src/createMDXLoader.ts
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)],
};
}
2 changes: 2 additions & 0 deletions packages/docusaurus-mdx-loader/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import {mdxLoader} from './loader';

import type {TOCItem as TOCItemImported} from './remark/toc/types';

export {createMDXLoaderRule, createMDXLoaderItem} from './createMDXLoader';

export default mdxLoader;

export type TOCItem = TOCItemImported;
Expand Down
Loading

0 comments on commit bc3b714

Please sign in to comment.