mirror of
https://github.com/facebook/docusaurus.git
synced 2025-04-30 18:58:36 +02:00
refactor: mark a few client-side packages as side-effect-free (#7085)
* refactor: mark a few client-side packages as side-effect-free * fix * fix again * fix... * revert sideeffect * revert * fix again... * properly fix * fix * properly fix
This commit is contained in:
parent
53f531edbf
commit
e5bf59fd9b
10 changed files with 34 additions and 5 deletions
|
@ -3,6 +3,7 @@
|
||||||
"version": "2.0.0-beta.18",
|
"version": "2.0.0-beta.18",
|
||||||
"description": "Docs plugin for Docusaurus.",
|
"description": "Docs plugin for Docusaurus.",
|
||||||
"main": "lib/index.js",
|
"main": "lib/index.js",
|
||||||
|
"sideEffects": false,
|
||||||
"exports": {
|
"exports": {
|
||||||
"./client": "./lib/client/index.js",
|
"./client": "./lib/client/index.js",
|
||||||
"./server": "./lib/server-export.js",
|
"./server": "./lib/server-export.js",
|
||||||
|
|
|
@ -879,7 +879,7 @@ declare module '@theme/ThemedImage' {
|
||||||
}
|
}
|
||||||
|
|
||||||
declare module '@theme/Details' {
|
declare module '@theme/Details' {
|
||||||
import {Details, type DetailsProps} from '@docusaurus/theme-common';
|
import {Details, type DetailsProps} from '@docusaurus/theme-common/Details';
|
||||||
|
|
||||||
export interface Props extends DetailsProps {}
|
export interface Props extends DetailsProps {}
|
||||||
export default Details;
|
export default Details;
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
|
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import clsx from 'clsx';
|
import clsx from 'clsx';
|
||||||
import {Details as DetailsGeneric} from '@docusaurus/theme-common';
|
import {Details as DetailsGeneric} from '@docusaurus/theme-common/Details';
|
||||||
import type {Props} from '@theme/Details';
|
import type {Props} from '@theme/Details';
|
||||||
import styles from './styles.module.css';
|
import styles from './styles.module.css';
|
||||||
|
|
||||||
|
|
14
packages/docusaurus-theme-common/Details.d.ts
vendored
Normal file
14
packages/docusaurus-theme-common/Details.d.ts
vendored
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
/**
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// `Details` is a separate export entry because of side-effects messing with CSS
|
||||||
|
// insertion order. See https://github.com/facebook/docusaurus/pull/7085.
|
||||||
|
// However, because TS doesn't recognize `exports` (also a problem in
|
||||||
|
// `content-docs`), we have to manually create a stub.
|
||||||
|
|
||||||
|
// eslint-disable-next-line import/named
|
||||||
|
export {Details, type DetailsProps} from './lib/components/Details';
|
|
@ -4,6 +4,14 @@
|
||||||
"description": "Common code for Docusaurus themes.",
|
"description": "Common code for Docusaurus themes.",
|
||||||
"main": "./lib/index.js",
|
"main": "./lib/index.js",
|
||||||
"types": "./lib/index.d.ts",
|
"types": "./lib/index.d.ts",
|
||||||
|
"sideEffects": [
|
||||||
|
"lib/components/Details/*",
|
||||||
|
"*.css"
|
||||||
|
],
|
||||||
|
"exports": {
|
||||||
|
".": "./lib/index.js",
|
||||||
|
"./Details": "./lib/components/Details/index.js"
|
||||||
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "node copyUntypedFiles.mjs && tsc",
|
"build": "node copyUntypedFiles.mjs && tsc",
|
||||||
"watch": "node copyUntypedFiles.mjs && tsc --watch"
|
"watch": "node copyUntypedFiles.mjs && tsc --watch"
|
||||||
|
|
|
@ -63,8 +63,6 @@ export {useLocationChange} from './utils/useLocationChange';
|
||||||
|
|
||||||
export {useCollapsible, Collapsible} from './components/Collapsible';
|
export {useCollapsible, Collapsible} from './components/Collapsible';
|
||||||
|
|
||||||
export {Details, type DetailsProps} from './components/Details';
|
|
||||||
|
|
||||||
export {
|
export {
|
||||||
useDocsPreferredVersion,
|
useDocsPreferredVersion,
|
||||||
useDocsPreferredVersionByPluginId,
|
useDocsPreferredVersionByPluginId,
|
||||||
|
|
|
@ -8,5 +8,6 @@
|
||||||
"declarationMap": true,
|
"declarationMap": true,
|
||||||
"rootDir": "src",
|
"rootDir": "src",
|
||||||
"outDir": "lib"
|
"outDir": "lib"
|
||||||
}
|
},
|
||||||
|
"include": ["src"]
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,6 +4,9 @@
|
||||||
"description": "Docusaurus live code block component.",
|
"description": "Docusaurus live code block component.",
|
||||||
"main": "lib/index.js",
|
"main": "lib/index.js",
|
||||||
"types": "src/theme-live-codeblock.d.ts",
|
"types": "src/theme-live-codeblock.d.ts",
|
||||||
|
"sideEffects": [
|
||||||
|
"lib/theme/Playground/*"
|
||||||
|
],
|
||||||
"publishConfig": {
|
"publishConfig": {
|
||||||
"access": "public"
|
"access": "public"
|
||||||
},
|
},
|
||||||
|
|
|
@ -3,6 +3,9 @@
|
||||||
"version": "2.0.0-beta.18",
|
"version": "2.0.0-beta.18",
|
||||||
"description": "Algolia search component for Docusaurus.",
|
"description": "Algolia search component for Docusaurus.",
|
||||||
"main": "lib/index.js",
|
"main": "lib/index.js",
|
||||||
|
"sideEffects": [
|
||||||
|
"*.css"
|
||||||
|
],
|
||||||
"exports": {
|
"exports": {
|
||||||
"./client": "./lib/client/index.js",
|
"./client": "./lib/client/index.js",
|
||||||
".": "./lib/index.js"
|
".": "./lib/index.js"
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
"description": "Common (Node/Browser) utility functions for Docusaurus packages.",
|
"description": "Common (Node/Browser) utility functions for Docusaurus packages.",
|
||||||
"main": "./lib/index.js",
|
"main": "./lib/index.js",
|
||||||
"types": "./lib/index.d.ts",
|
"types": "./lib/index.d.ts",
|
||||||
|
"sideEffects": false,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "tsc",
|
"build": "tsc",
|
||||||
"watch": "tsc --watch"
|
"watch": "tsc --watch"
|
||||||
|
|
Loading…
Add table
Reference in a new issue