diff --git a/.eslintignore b/.eslintignore index 2854c10c59..b0c14dbeea 100644 --- a/.eslintignore +++ b/.eslintignore @@ -11,7 +11,6 @@ examples/ packages/lqip-loader/lib/ packages/docusaurus/lib/ packages/docusaurus-*/lib/* -packages/docusaurus-*/lib-next/ packages/eslint-plugin/lib/ packages/stylelint-copyright/lib/ diff --git a/.gitignore b/.gitignore index 0e0bd14648..1e61285322 100644 --- a/.gitignore +++ b/.gitignore @@ -25,7 +25,6 @@ packages/docusaurus/lib/ packages/docusaurus-*/lib/* packages/eslint-plugin/lib/ packages/stylelint-copyright/lib/ -packages/docusaurus-*/lib-next/ website/netlifyDeployPreview/* website/changelog diff --git a/.prettierignore b/.prettierignore index c7aec4e026..5bfdf4925c 100644 --- a/.prettierignore +++ b/.prettierignore @@ -7,7 +7,6 @@ coverage packages/lqip-loader/lib/ packages/docusaurus/lib/ packages/docusaurus-*/lib/* -packages/docusaurus-*/lib-next/ packages/create-docusaurus/lib/* packages/create-docusaurus/templates/*/docusaurus.config.js packages/eslint-plugin/lib/ diff --git a/.stylelintignore b/.stylelintignore index 951af3a16e..15db7860ba 100644 --- a/.stylelintignore +++ b/.stylelintignore @@ -10,7 +10,6 @@ examples/ packages/lqip-loader/lib/ packages/docusaurus/lib/ packages/docusaurus-*/lib/* -packages/docusaurus-*/lib-next/ packages/create-docusaurus/lib/* packages/create-docusaurus/templates/ website/static/katex/katex.min.css diff --git a/jest.config.mjs b/jest.config.mjs index 28ba5e66a6..5e7200416b 100644 --- a/jest.config.mjs +++ b/jest.config.mjs @@ -23,7 +23,6 @@ const ignorePatterns = [ '/packages/docusaurus-plugin-content-docs/lib', '/packages/docusaurus-plugin-content-pages/lib', '/packages/docusaurus-theme-classic/lib', - '/packages/docusaurus-theme-classic/lib-next', '/packages/docusaurus-theme-common/lib', '/packages/docusaurus-migrate/lib', '/jest', diff --git a/package.json b/package.json index eb257678d7..de33e023d0 100644 --- a/package.json +++ b/package.json @@ -54,7 +54,7 @@ "test": "jest", "test:build:website": "./admin/scripts/test-release.sh", "watch": "yarn lerna run --parallel watch", - "clear": "(yarn workspace website clear || echo 'Failure while running docusaurus clear') && yarn lerna exec --ignore docusaurus yarn rimraf lib lib-next", + "clear": "(yarn workspace website clear || echo 'Failure while running docusaurus clear') && yarn lerna exec --ignore docusaurus yarn rimraf lib", "test:baseUrl": "yarn build:website:baseUrl && yarn serve:website:baseUrl", "lock:update": "npx yarn-deduplicate" }, diff --git a/packages/docusaurus-theme-classic/.npmignore b/packages/docusaurus-theme-classic/.npmignore index 955841b312..03c9ae1e1b 100644 --- a/packages/docusaurus-theme-classic/.npmignore +++ b/packages/docusaurus-theme-classic/.npmignore @@ -1,9 +1,3 @@ .tsbuildinfo* tsconfig* __tests__ - -lib/theme -lib-next/** -!lib-next/theme/** - -babel.config.js diff --git a/packages/docusaurus-theme-classic/babel.config.js b/packages/docusaurus-theme-classic/babel.config.js deleted file mode 100644 index 0bbcfe267e..0000000000 --- a/packages/docusaurus-theme-classic/babel.config.js +++ /dev/null @@ -1,30 +0,0 @@ -/** - * 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. - */ - -module.exports = { - env: { - // USED FOR NODE/RUNTIME - // maybe we should differentiate both cases because - // we mostly need to transpile some features so that node does not crash... - lib: { - presets: [ - ['@babel/preset-env', {targets: {node: 14}, modules: 'commonjs'}], - ['@babel/preset-typescript', {isTSX: true, allExtensions: true}], - ], - }, - - // USED FOR JS SWIZZLE - // /lib-next folder is used as source to swizzle JS source code - // This JS code is created from TS source code - // This source code should look clean/human readable to be usable - 'lib-next': { - presets: [ - ['@babel/preset-typescript', {isTSX: true, allExtensions: true}], - ], - }, - }, -}; diff --git a/packages/docusaurus-theme-classic/package.json b/packages/docusaurus-theme-classic/package.json index bcbdb78c31..15810bc398 100644 --- a/packages/docusaurus-theme-classic/package.json +++ b/packages/docusaurus-theme-classic/package.json @@ -14,13 +14,10 @@ }, "license": "MIT", "scripts": { - "build": "tsc --noEmit && yarn babel:lib && yarn babel:lib-next && yarn format:lib-next", - "watch": "run-p --continue-on-error babel:lib:watch babel:lib-next:watch", - "babel:lib": "cross-env BABEL_ENV=lib babel src -d lib --extensions \".tsx,.ts\" --ignore \"**/*.d.ts\" --copy-files", - "babel:lib-next": "cross-env BABEL_ENV=lib-next babel src -d lib-next --extensions \".tsx,.ts\" --ignore \"**/*.d.ts\" --copy-files", - "babel:lib:watch": "yarn babel:lib --watch", - "babel:lib-next:watch": "yarn babel:lib-next --watch", - "format:lib-next": "prettier --config ../../.prettierrc --write \"lib-next/**/*.{js,ts,jsx,tsc}\"" + "build": "tsc --build && node ../../admin/scripts/copyUntypedFiles.mjs && prettier --config ../../.prettierrc --write \"lib/theme/**/*.js\"", + "watch": "run-p -c copy:watch build:watch", + "build:watch": "tsc --build --watch", + "copy:watch": "node ../../admin/scripts/copyUntypedFiles.mjs --watch" }, "dependencies": { "@docusaurus/core": "2.0.0-beta.20", @@ -42,19 +39,16 @@ "prism-react-renderer": "^1.3.3", "prismjs": "^1.28.0", "react-router-dom": "^5.2.0", - "rtlcss": "^3.5.0" + "rtlcss": "^3.5.0", + "tslib": "^2.4.0" }, "devDependencies": { - "@babel/cli": "^7.17.10", - "@babel/core": "^7.17.12", - "@babel/preset-typescript": "^7.17.12", "@docusaurus/module-type-aliases": "2.0.0-beta.20", "@docusaurus/types": "2.0.0-beta.20", "@types/mdx-js__react": "^1.5.5", "@types/nprogress": "^0.2.0", "@types/prismjs": "^1.26.0", "@types/rtlcss": "^3.1.4", - "cross-env": "^7.0.3", "fs-extra": "^10.1.0", "react-test-renderer": "^17.0.2", "utility-types": "^3.10.0" diff --git a/packages/docusaurus-theme-classic/src/index.ts b/packages/docusaurus-theme-classic/src/index.ts index 2624572016..a0cb4629cb 100644 --- a/packages/docusaurus-theme-classic/src/index.ts +++ b/packages/docusaurus-theme-classic/src/index.ts @@ -112,7 +112,7 @@ export default function themeClassic( name: 'docusaurus-theme-classic', getThemePath() { - return '../lib-next/theme'; + return '../lib/theme'; }, getTypeScriptThemePath() { diff --git a/packages/docusaurus-theme-classic/tsconfig.client.json b/packages/docusaurus-theme-classic/tsconfig.client.json new file mode 100644 index 0000000000..067fb209a7 --- /dev/null +++ b/packages/docusaurus-theme-classic/tsconfig.client.json @@ -0,0 +1,20 @@ +{ + "extends": "../../tsconfig.json", + "compilerOptions": { + "noEmit": false, + "composite": true, + "incremental": true, + "tsBuildInfoFile": "./lib/.tsbuildinfo-client", + "rootDir": "src", + "outDir": "lib", + "module": "esnext", + "target": "esnext" + }, + "include": [ + "src/nprogress.ts", + "src/prism-include-languages.ts", + "src/theme", + "src/*.d.ts" + ], + "exclude": ["**/__tests__/**"] +} diff --git a/packages/docusaurus-theme-classic/tsconfig.json b/packages/docusaurus-theme-classic/tsconfig.json index 4ee40b287f..9e41ec3ef6 100644 --- a/packages/docusaurus-theme-classic/tsconfig.json +++ b/packages/docusaurus-theme-classic/tsconfig.json @@ -1,10 +1,19 @@ { "extends": "../../tsconfig.json", + "references": [{"path": "./tsconfig.client.json"}], "compilerOptions": { - "lib": ["DOM", "ES2019"], - "module": "esnext", - "noEmit": true + "noEmit": false, + "incremental": true, + "tsBuildInfoFile": "./lib/.tsbuildinfo", + "module": "commonjs", + "rootDir": "src", + "outDir": "lib" }, - "include": ["src/"], - "exclude": ["**/__tests__/**"] + "include": ["src"], + "exclude": [ + "src/nprogress.ts", + "src/prism-include-languages.ts", + "src/theme", + "**/__tests__/**" + ] } diff --git a/packages/docusaurus-theme-translations/src/utils.ts b/packages/docusaurus-theme-translations/src/utils.ts index beb1370817..da931ef454 100644 --- a/packages/docusaurus-theme-translations/src/utils.ts +++ b/packages/docusaurus-theme-translations/src/utils.ts @@ -25,10 +25,7 @@ async function getPackageCodePath(packageName: string) { const packageJsonPath = path.join(packagePath, 'package.json'); const {main} = await fs.readJSON(packageJsonPath); const packageSrcPath = path.join(packagePath, path.dirname(main)); - const packageLibNextPath = packageSrcPath.replace('lib', 'lib-next'); - return (await fs.pathExists(packageLibNextPath)) - ? packageLibNextPath - : packageSrcPath; + return packageSrcPath; } export async function getThemes(): Promise<{name: string; src: string[]}[]> { diff --git a/website/_dogfooding/testSwizzleThemeClassic.mjs b/website/_dogfooding/testSwizzleThemeClassic.mjs index b8b4a4cb1a..ab75a7d1da 100644 --- a/website/_dogfooding/testSwizzleThemeClassic.mjs +++ b/website/_dogfooding/testSwizzleThemeClassic.mjs @@ -31,7 +31,7 @@ const classicThemePathBase = path.join( const themePath = swizzleConfig ? path.join(classicThemePathBase, 'src/theme') - : path.join(classicThemePathBase, 'lib-next/theme'); + : path.join(classicThemePathBase, 'lib/theme'); const toPath = path.join(dirname, '_swizzle_theme_tests'); diff --git a/yarn.lock b/yarn.lock index 73710442ca..769b532fb0 100644 --- a/yarn.lock +++ b/yarn.lock @@ -147,22 +147,6 @@ jsonpointer "^5.0.0" leven "^3.1.0" -"@babel/cli@^7.17.10": - version "7.17.10" - resolved "https://registry.yarnpkg.com/@babel/cli/-/cli-7.17.10.tgz#5ea0bf6298bb78f3b59c7c06954f9bd1c79d5943" - integrity sha512-OygVO1M2J4yPMNOW9pb+I6kFGpQK77HmG44Oz3hg8xQIl5L/2zq+ZohwAdSaqYgVwM0SfmPHZHphH4wR8qzVYw== - dependencies: - "@jridgewell/trace-mapping" "^0.3.8" - commander "^4.0.1" - convert-source-map "^1.1.0" - fs-readdir-recursive "^1.1.0" - glob "^7.0.0" - make-dir "^2.1.0" - slash "^2.0.0" - optionalDependencies: - "@nicolo-ribaudo/chokidar-2" "2.1.8-no-fsevents.3" - chokidar "^3.4.0" - "@babel/code-frame@^7.0.0", "@babel/code-frame@^7.10.4", "@babel/code-frame@^7.12.13", "@babel/code-frame@^7.16.0", "@babel/code-frame@^7.16.7", "@babel/code-frame@^7.8.3": version "7.16.7" resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.16.7.tgz#44416b6bd7624b998f5b1af5d470856c40138789" @@ -1872,7 +1856,7 @@ resolved "https://registry.yarnpkg.com/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.13.tgz#b6461fb0c2964356c469e115f504c95ad97ab88c" integrity sha512-GryiOJmNcWbovBxTfZSF71V/mXbgcV3MewDe3kIMCLyIh5e7SKAeUZs+rMnJ8jkMolZ/4/VsdBmMrw3l+VdZ3w== -"@jridgewell/trace-mapping@^0.3.7", "@jridgewell/trace-mapping@^0.3.8", "@jridgewell/trace-mapping@^0.3.9": +"@jridgewell/trace-mapping@^0.3.7", "@jridgewell/trace-mapping@^0.3.9": version "0.3.13" resolved "https://registry.yarnpkg.com/@jridgewell/trace-mapping/-/trace-mapping-0.3.13.tgz#dcfe3e95f224c8fe97a87a5235defec999aa92ea" integrity sha512-o1xbKhp9qnIAoHJSWd6KlCZfqslL4valSF81H8ImioOAxluWYWOpWkpyktY2vnt4tbrX9XYaxovq6cgowaJp2w== @@ -2611,11 +2595,6 @@ dependencies: is-promise "^4.0.0" -"@nicolo-ribaudo/chokidar-2@2.1.8-no-fsevents.3": - version "2.1.8-no-fsevents.3" - resolved "https://registry.yarnpkg.com/@nicolo-ribaudo/chokidar-2/-/chokidar-2-2.1.8-no-fsevents.3.tgz#323d72dd25103d0c4fbdce89dadf574a787b1f9b" - integrity sha512-s88O1aVtXftvp5bCPB7WnmXc5IwOZZ7YPuwNPt+GtOOXpPvad1LfbmjYv+qII7zP6RU2QGnqve27dnLycEnyEQ== - "@nodelib/fs.scandir@2.1.5": version "2.1.5" resolved "https://registry.yarnpkg.com/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz#7619c2eb21b25483f6d167548b4cfd5a7488c3d5" @@ -5219,7 +5198,7 @@ cheerio@^1.0.0-rc.10: parse5-htmlparser2-tree-adapter "^6.0.1" tslib "^2.2.0" -chokidar@^3.4.0, chokidar@^3.4.2, chokidar@^3.5.3: +chokidar@^3.4.2, chokidar@^3.5.3: version "3.5.3" resolved "https://registry.yarnpkg.com/chokidar/-/chokidar-3.5.3.tgz#1cf37c8707b932bd1af1ae22c0432e2acd1903bd" integrity sha512-Dr3sfKRP6oTcjf2JmUmFJfeVMvXBdegxB0iVQ5eb2V10uFJUCAS8OByZdVAyVb8xXNz3GjjTgj9kLWsZTqE6kw== @@ -5520,11 +5499,6 @@ commander@^2.20.0: resolved "https://registry.yarnpkg.com/commander/-/commander-2.20.3.tgz#fd485e84c03eb4881c20722ba48035e8531aeb33" integrity sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ== -commander@^4.0.1: - version "4.1.1" - resolved "https://registry.yarnpkg.com/commander/-/commander-4.1.1.tgz#9fd602bd936294e9e9ef46a3f4d6964044b18068" - integrity sha512-NOKm8xhkzAjzFx8B2v5OAHT+u5pRQc2UCa2Vq9jYL/31o2wi9mxBA7LIFs3sV5VSC49z6pEhfbMULvShKj26WA== - commander@^5.0.0, commander@^5.1.0: version "5.1.0" resolved "https://registry.yarnpkg.com/commander/-/commander-5.1.0.tgz#46abbd1652f8e059bddaef99bbdcb2ad9cf179ae" @@ -5773,7 +5747,7 @@ conventional-recommended-bump@^6.1.0: meow "^8.0.0" q "^1.5.1" -convert-source-map@^1.1.0, convert-source-map@^1.4.0, convert-source-map@^1.6.0, convert-source-map@^1.7.0: +convert-source-map@^1.4.0, convert-source-map@^1.6.0, convert-source-map@^1.7.0: version "1.8.0" resolved "https://registry.yarnpkg.com/convert-source-map/-/convert-source-map-1.8.0.tgz#f3373c32d21b4d780dd8004514684fb791ca4369" integrity sha512-+OQdjP49zViI/6i7nIJpA8rAl4sV/JdPfU9nZs3VqOwGIgizICvuN2ru6fMd+4llL0tar18UYJXfZ/TWtmhUjA== @@ -7615,11 +7589,6 @@ fs-monkey@1.0.3: resolved "https://registry.yarnpkg.com/fs-monkey/-/fs-monkey-1.0.3.tgz#ae3ac92d53bb328efe0e9a1d9541f6ad8d48e2d3" integrity sha512-cybjIfiiE+pTWicSCLFHSrXZ6EilF30oh91FDP9S2B051prEa7QWfrVTQm10/dDpswBDXZugPa1Ogu8Yh+HV0Q== -fs-readdir-recursive@^1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/fs-readdir-recursive/-/fs-readdir-recursive-1.1.0.tgz#e32fc030a2ccee44a6b5371308da54be0b397d27" - integrity sha512-GNanXlVr2pf02+sPN40XN8HG+ePaNcvM0q5mZBd668Obwb0yD5GiUbZOFgwn8kGMY6I3mdyDJzieUy3PTYyTRA== - fs.realpath@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f" @@ -13670,11 +13639,6 @@ sitemap@^7.1.1: arg "^5.0.0" sax "^1.2.4" -slash@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/slash/-/slash-2.0.0.tgz#de552851a1759df3a8f206535442f5ec4ddeab44" - integrity sha512-ZYKh3Wh2z1PpEXWr0MpSBZ0V6mZHAQfYevttO11c51CaWjGTaadiKZ+wVt1PbMlDV5qhMFslpZCemhwOK7C89A== - slash@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/slash/-/slash-3.0.0.tgz#6539be870c165adbd5240220dbe361f1bc4d4634"