@docusaurus/core 3.0.0-rc.1 → 3.0.1

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.
@@ -7,31 +7,41 @@
7
7
  */
8
8
  Object.defineProperty(exports, "__esModule", { value: true });
9
9
  const tslib_1 = require("tslib");
10
- const path_1 = tslib_1.__importDefault(require("path"));
11
10
  const fs_extra_1 = tslib_1.__importDefault(require("fs-extra"));
12
- const wait_on_1 = tslib_1.__importDefault(require("wait-on"));
13
11
  class WaitPlugin {
14
12
  constructor(options) {
15
13
  this.filepath = options.filepath;
16
14
  }
17
15
  apply(compiler) {
18
16
  // Before finishing the compilation step
19
- compiler.hooks.make.tapAsync('WaitPlugin', (compilation, callback) => {
20
- // To prevent 'waitFile' error on waiting non-existing directory
21
- fs_extra_1.default.ensureDir(path_1.default.dirname(this.filepath), {}, () => {
22
- // Wait until file exist
23
- (0, wait_on_1.default)({
24
- resources: [this.filepath],
25
- interval: 300,
26
- })
27
- .then(() => {
28
- callback();
29
- })
30
- .catch((error) => {
31
- console.warn(`WaitPlugin error: ${error}`);
32
- });
33
- });
34
- });
17
+ compiler.hooks.make.tapPromise('WaitPlugin', () => waitOn(this.filepath));
35
18
  }
36
19
  }
37
20
  exports.default = WaitPlugin;
21
+ // This is a re-implementation of the algorithm used by the "wait-on" package
22
+ // https://github.com/jeffbski/wait-on/blob/master/lib/wait-on.js#L200
23
+ async function waitOn(filepath) {
24
+ const pollingIntervalMs = 300;
25
+ const stabilityWindowMs = 750;
26
+ let lastFileSize = -1;
27
+ let lastFileTime = -1;
28
+ for (;;) {
29
+ let size = -1;
30
+ try {
31
+ size = (await fs_extra_1.default.stat(filepath)).size;
32
+ }
33
+ catch (err) { }
34
+ if (size !== -1) {
35
+ if (lastFileTime === -1 || size !== lastFileSize) {
36
+ lastFileSize = size;
37
+ lastFileTime = performance.now();
38
+ }
39
+ else if (performance.now() - lastFileTime >= stabilityWindowMs) {
40
+ return;
41
+ }
42
+ }
43
+ await new Promise((resolve) => {
44
+ setTimeout(resolve, pollingIntervalMs);
45
+ });
46
+ }
47
+ }
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": "3.0.0-rc.1",
4
+ "version": "3.0.1",
5
5
  "license": "MIT",
6
6
  "publishConfig": {
7
7
  "access": "public"
@@ -33,8 +33,8 @@
33
33
  "url": "https://github.com/facebook/docusaurus/issues"
34
34
  },
35
35
  "dependencies": {
36
- "@babel/core": "^7.22.9",
37
- "@babel/generator": "^7.22.9",
36
+ "@babel/core": "^7.23.3",
37
+ "@babel/generator": "^7.23.3",
38
38
  "@babel/plugin-syntax-dynamic-import": "^7.8.3",
39
39
  "@babel/plugin-transform-runtime": "^7.22.9",
40
40
  "@babel/preset-env": "^7.22.9",
@@ -43,13 +43,13 @@
43
43
  "@babel/runtime": "^7.22.6",
44
44
  "@babel/runtime-corejs3": "^7.22.6",
45
45
  "@babel/traverse": "^7.22.8",
46
- "@docusaurus/cssnano-preset": "3.0.0-rc.1",
47
- "@docusaurus/logger": "3.0.0-rc.1",
48
- "@docusaurus/mdx-loader": "3.0.0-rc.1",
46
+ "@docusaurus/cssnano-preset": "3.0.1",
47
+ "@docusaurus/logger": "3.0.1",
48
+ "@docusaurus/mdx-loader": "3.0.1",
49
49
  "@docusaurus/react-loadable": "5.5.2",
50
- "@docusaurus/utils": "3.0.0-rc.1",
51
- "@docusaurus/utils-common": "3.0.0-rc.1",
52
- "@docusaurus/utils-validation": "3.0.0-rc.1",
50
+ "@docusaurus/utils": "3.0.1",
51
+ "@docusaurus/utils-common": "3.0.1",
52
+ "@docusaurus/utils-validation": "3.0.1",
53
53
  "@slorber/static-site-generator-webpack-plugin": "^4.0.7",
54
54
  "@svgr/webpack": "^6.5.1",
55
55
  "autoprefixer": "^10.4.14",
@@ -97,7 +97,6 @@
97
97
  "tslib": "^2.6.0",
98
98
  "update-notifier": "^6.0.2",
99
99
  "url-loader": "^4.1.1",
100
- "wait-on": "^7.0.1",
101
100
  "webpack": "^5.88.1",
102
101
  "webpack-bundle-analyzer": "^4.9.0",
103
102
  "webpack-dev-server": "^4.15.1",
@@ -105,15 +104,14 @@
105
104
  "webpackbar": "^5.0.2"
106
105
  },
107
106
  "devDependencies": {
108
- "@docusaurus/module-type-aliases": "3.0.0-rc.1",
109
- "@docusaurus/types": "3.0.0-rc.1",
107
+ "@docusaurus/module-type-aliases": "3.0.1",
108
+ "@docusaurus/types": "3.0.1",
110
109
  "@types/detect-port": "^1.3.3",
111
110
  "@types/react-dom": "^18.2.7",
112
111
  "@types/react-router-config": "^5.0.7",
113
112
  "@types/rtl-detect": "^1.0.0",
114
113
  "@types/serve-handler": "^6.1.1",
115
114
  "@types/update-notifier": "^6.0.4",
116
- "@types/wait-on": "^5.3.1",
117
115
  "@types/webpack-bundle-analyzer": "^4.6.0",
118
116
  "react-test-renderer": "^18.0.0",
119
117
  "tmp-promise": "^3.0.3",
@@ -126,5 +124,5 @@
126
124
  "engines": {
127
125
  "node": ">=18.0"
128
126
  },
129
- "gitHead": "a51cc6fd7660d47ea08349f723cec9c017af0b4e"
127
+ "gitHead": "29d816067fd0022d4ca3bd5fdc42098dac9f7ffc"
130
128
  }