@docusaurus/core 4.0.0-canary-6863 → 4.0.0-canary-6868
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/client/ClientLifecyclesDispatcher.d.ts +1 -1
- package/lib/client/ClientLifecyclesDispatcher.js +2 -2
- package/lib/client/exports/useIsomorphicLayoutEffect.d.ts +7 -8
- package/lib/client/exports/useIsomorphicLayoutEffect.js +9 -13
- package/lib/commands/start/watcher.d.ts +4 -0
- package/lib/commands/start/watcher.js +1 -1
- package/lib/commands/swizzle/components.js +2 -2
- package/lib/commands/utils/openBrowser/openBrowser.js +3 -6
- package/package.json +13 -13
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* This source code is licensed under the MIT license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
|
-
import type
|
|
7
|
+
import { type ReactElement, type ReactNode } from 'react';
|
|
8
8
|
import type { ClientModule } from '@docusaurus/types';
|
|
9
9
|
import type { Location } from 'history';
|
|
10
10
|
export declare function dispatchLifecycleAction<K extends keyof ClientModule>(lifecycleAction: K, ...args: Parameters<NonNullable<ClientModule[K]>>): () => void;
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
* This source code is licensed under the MIT license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
|
+
import { useLayoutEffect } from 'react';
|
|
7
8
|
import clientModules from '@generated/client-modules';
|
|
8
|
-
import useIsomorphicLayoutEffect from './exports/useIsomorphicLayoutEffect';
|
|
9
9
|
export function dispatchLifecycleAction(lifecycleAction, ...args) {
|
|
10
10
|
const callbacks = clientModules.map((clientModule) => {
|
|
11
11
|
const lifecycleFunction = (clientModule.default?.[lifecycleAction] ??
|
|
@@ -36,7 +36,7 @@ function scrollAfterNavigation({ location, previousLocation, }) {
|
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
38
|
function ClientLifecyclesDispatcher({ children, location, previousLocation, }) {
|
|
39
|
-
|
|
39
|
+
useLayoutEffect(() => {
|
|
40
40
|
if (previousLocation !== location) {
|
|
41
41
|
scrollAfterNavigation({ location, previousLocation });
|
|
42
42
|
dispatchLifecycleAction('onRouteDidUpdate', { previousLocation, location });
|
|
@@ -6,16 +6,15 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import { useLayoutEffect } from 'react';
|
|
8
8
|
/**
|
|
9
|
-
* This hook is
|
|
10
|
-
* It seems hacky but it's used in many React libs (Redux, Formik...).
|
|
11
|
-
* Also mentioned here: https://github.com/facebook/react/issues/16956
|
|
9
|
+
* This hook is now just React's `useLayoutEffect`.
|
|
12
10
|
*
|
|
13
|
-
* It
|
|
14
|
-
*
|
|
11
|
+
* It used to fall back to `useEffect` on the server to avoid the
|
|
12
|
+
* `useLayoutEffect` SSR warning, which React 19 removed.
|
|
13
|
+
* See https://github.com/facebook/react/pull/26395
|
|
15
14
|
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
15
|
+
* It is unnecessary since React 19: use `useLayoutEffect` directly.
|
|
16
|
+
* We only keep it for retro-compatibility, because third-party code might
|
|
17
|
+
* import `@docusaurus/useIsomorphicLayoutEffect`.
|
|
19
18
|
*/
|
|
20
19
|
declare const useIsomorphicLayoutEffect: typeof useLayoutEffect;
|
|
21
20
|
export default useIsomorphicLayoutEffect;
|
|
@@ -4,21 +4,17 @@
|
|
|
4
4
|
* This source code is licensed under the MIT license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
|
-
import {
|
|
8
|
-
import ExecutionEnvironment from './ExecutionEnvironment';
|
|
7
|
+
import { useLayoutEffect } from 'react';
|
|
9
8
|
/**
|
|
10
|
-
* This hook is
|
|
11
|
-
* It seems hacky but it's used in many React libs (Redux, Formik...).
|
|
12
|
-
* Also mentioned here: https://github.com/facebook/react/issues/16956
|
|
9
|
+
* This hook is now just React's `useLayoutEffect`.
|
|
13
10
|
*
|
|
14
|
-
* It
|
|
15
|
-
*
|
|
11
|
+
* It used to fall back to `useEffect` on the server to avoid the
|
|
12
|
+
* `useLayoutEffect` SSR warning, which React 19 removed.
|
|
13
|
+
* See https://github.com/facebook/react/pull/26395
|
|
16
14
|
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
15
|
+
* It is unnecessary since React 19: use `useLayoutEffect` directly.
|
|
16
|
+
* We only keep it for retro-compatibility, because third-party code might
|
|
17
|
+
* import `@docusaurus/useIsomorphicLayoutEffect`.
|
|
20
18
|
*/
|
|
21
|
-
const useIsomorphicLayoutEffect =
|
|
22
|
-
? useLayoutEffect
|
|
23
|
-
: useEffect;
|
|
19
|
+
const useIsomorphicLayoutEffect = useLayoutEffect;
|
|
24
20
|
export default useIsomorphicLayoutEffect;
|
|
@@ -16,6 +16,10 @@ export type FileWatchEvent = {
|
|
|
16
16
|
name: FileWatchEventName;
|
|
17
17
|
path: string;
|
|
18
18
|
};
|
|
19
|
+
export declare function getPluginPathsToWatch({ siteDir, plugin, }: {
|
|
20
|
+
siteDir: string;
|
|
21
|
+
plugin: LoadedPlugin;
|
|
22
|
+
}): string[];
|
|
19
23
|
export declare function setupSiteFileWatchers({ props, cliOptions, }: {
|
|
20
24
|
props: Props;
|
|
21
25
|
cliOptions: StartCLIOptions;
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
9
|
exports.createPollingOptions = createPollingOptions;
|
|
10
|
+
exports.getPluginPathsToWatch = getPluginPathsToWatch;
|
|
10
11
|
exports.setupSiteFileWatchers = setupSiteFileWatchers;
|
|
11
12
|
const tslib_1 = require("tslib");
|
|
12
13
|
const path_1 = tslib_1.__importDefault(require("path"));
|
|
@@ -28,7 +29,6 @@ function watchPaths(params, callback) {
|
|
|
28
29
|
const { pathsToWatch, siteDir, ...options } = params;
|
|
29
30
|
const watcher = (0, glob_1.watch)(pathsToWatch, {
|
|
30
31
|
cwd: siteDir,
|
|
31
|
-
ignoreInitial: true,
|
|
32
32
|
...options,
|
|
33
33
|
});
|
|
34
34
|
watcher.on('all', (name, eventPath) => callback({ name, path: eventPath }));
|
|
@@ -165,8 +165,8 @@ function handleInvalidComponentNameParam({ componentNameParam, themeComponents,
|
|
|
165
165
|
logger_1.default.error `Component name=${componentNameParam} not found.`;
|
|
166
166
|
const suggestion = (0, common_1.findClosestValue)(componentNameParam, themeComponents.all);
|
|
167
167
|
if (suggestion) {
|
|
168
|
-
logger_1.default.info `Did you mean name=${suggestion}? ${themeComponents.hasAnySafeAction(suggestion)
|
|
169
|
-
? `Note: this component is an unsafe internal component and can only be swizzled with code
|
|
168
|
+
logger_1.default.info `Did you mean name=${suggestion}? ${!themeComponents.hasAnySafeAction(suggestion)
|
|
169
|
+
? `Note: this component is an unsafe internal component and can only be swizzled with ${logger_1.default.code('--danger')} or explicit confirmation.`
|
|
170
170
|
: ''}`;
|
|
171
171
|
}
|
|
172
172
|
else {
|
|
@@ -51,12 +51,9 @@ async function tryOpenWithAppleScript({ url, browser, }) {
|
|
|
51
51
|
];
|
|
52
52
|
// Among all the supported browsers, retrieves to stdout the active ones
|
|
53
53
|
const command = `ps cax -o command | grep -E "^(${supportedChromiumBrowsers.join('|')})$"`;
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
.resolve()
|
|
58
|
-
.then(() => execPromise(command))
|
|
59
|
-
.catch(() => {
|
|
54
|
+
// Promise.try() also catches errors thrown synchronously
|
|
55
|
+
// See https://github.com/facebook/docusaurus/issues/11204#issuecomment-3073480330
|
|
56
|
+
const result = await Promise.try(() => execPromise(command)).catch(() => {
|
|
60
57
|
// Ignore all errors
|
|
61
58
|
// In particular grep errors when macOS user has no Chromium-based browser open
|
|
62
59
|
// See https://github.com/facebook/docusaurus/issues/11204
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@docusaurus/core",
|
|
3
3
|
"description": "Easy to Maintain Open Source Documentation Websites",
|
|
4
|
-
"version": "4.0.0-canary-
|
|
4
|
+
"version": "4.0.0-canary-6868",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"publishConfig": {
|
|
7
7
|
"access": "public"
|
|
@@ -33,14 +33,14 @@
|
|
|
33
33
|
"url": "https://github.com/facebook/docusaurus/issues"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@docusaurus/babel": "4.0.0-canary-
|
|
37
|
-
"@docusaurus/bundler": "4.0.0-canary-
|
|
38
|
-
"@docusaurus/glob": "4.0.0-canary-
|
|
39
|
-
"@docusaurus/logger": "4.0.0-canary-
|
|
40
|
-
"@docusaurus/mdx-loader": "4.0.0-canary-
|
|
41
|
-
"@docusaurus/utils": "4.0.0-canary-
|
|
42
|
-
"@docusaurus/utils-common": "4.0.0-canary-
|
|
43
|
-
"@docusaurus/utils-validation": "4.0.0-canary-
|
|
36
|
+
"@docusaurus/babel": "4.0.0-canary-6868",
|
|
37
|
+
"@docusaurus/bundler": "4.0.0-canary-6868",
|
|
38
|
+
"@docusaurus/glob": "4.0.0-canary-6868",
|
|
39
|
+
"@docusaurus/logger": "4.0.0-canary-6868",
|
|
40
|
+
"@docusaurus/mdx-loader": "4.0.0-canary-6868",
|
|
41
|
+
"@docusaurus/utils": "4.0.0-canary-6868",
|
|
42
|
+
"@docusaurus/utils-common": "4.0.0-canary-6868",
|
|
43
|
+
"@docusaurus/utils-validation": "4.0.0-canary-6868",
|
|
44
44
|
"boxen": "^9.0.0",
|
|
45
45
|
"cli-table3": "^0.6.5",
|
|
46
46
|
"combine-promises": "^1.2.0",
|
|
@@ -74,8 +74,8 @@
|
|
|
74
74
|
"webpack-merge": "^6.0.1"
|
|
75
75
|
},
|
|
76
76
|
"devDependencies": {
|
|
77
|
-
"@docusaurus/module-type-aliases": "4.0.0-canary-
|
|
78
|
-
"@docusaurus/types": "4.0.0-canary-
|
|
77
|
+
"@docusaurus/module-type-aliases": "4.0.0-canary-6868",
|
|
78
|
+
"@docusaurus/types": "4.0.0-canary-6868",
|
|
79
79
|
"@total-typescript/shoehorn": "^0.1.2",
|
|
80
80
|
"@types/escape-html": "^1.0.4",
|
|
81
81
|
"@types/history": "^4.7.11",
|
|
@@ -90,7 +90,7 @@
|
|
|
90
90
|
"utility-types": "^3.11.0"
|
|
91
91
|
},
|
|
92
92
|
"peerDependencies": {
|
|
93
|
-
"@docusaurus/faster": "4.0.0-canary-
|
|
93
|
+
"@docusaurus/faster": "4.0.0-canary-6868",
|
|
94
94
|
"@mdx-js/react": "^3.1.1",
|
|
95
95
|
"react": "^19.3.0",
|
|
96
96
|
"react-dom": "^19.3.0"
|
|
@@ -103,5 +103,5 @@
|
|
|
103
103
|
"engines": {
|
|
104
104
|
"node": ">=24.21"
|
|
105
105
|
},
|
|
106
|
-
"gitHead": "
|
|
106
|
+
"gitHead": "e6df7e2a6fcc0b1b6899cc272588cf73a62765a9"
|
|
107
107
|
}
|