dumi 2.4.4 → 2.4.5
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.
|
@@ -6,15 +6,15 @@ function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefine
|
|
|
6
6
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
7
7
|
import { useNavData } from 'dumi';
|
|
8
8
|
import { useCallback, useEffect, useRef, useState } from 'react';
|
|
9
|
-
// @ts-ignore
|
|
10
|
-
import workerCode from "../../../../compiled/_internal/searchWorker.min?dumi-raw";
|
|
11
9
|
import useSearchData from "./useSearchData";
|
|
12
10
|
var worker;
|
|
13
11
|
|
|
14
12
|
// for ssr
|
|
15
13
|
if (typeof window !== 'undefined') {
|
|
16
14
|
// use blob to avoid generate entry(chunk) for worker
|
|
17
|
-
worker = new Worker(URL.createObjectURL(
|
|
15
|
+
worker = new Worker(URL.createObjectURL(
|
|
16
|
+
// @ts-ignore
|
|
17
|
+
new Blob([SEARCH_WORKER_CODE], {
|
|
18
18
|
type: 'application/javascript'
|
|
19
19
|
})));
|
|
20
20
|
}
|
|
@@ -35,6 +35,7 @@ __export(compile_exports, {
|
|
|
35
35
|
module.exports = __toCommonJS(compile_exports);
|
|
36
36
|
var import_react = __toESM(require("../../techStacks/react"));
|
|
37
37
|
var import_utils = require("../../utils");
|
|
38
|
+
var import_fs = __toESM(require("fs"));
|
|
38
39
|
var import_path = __toESM(require("path"));
|
|
39
40
|
var import_assets = require("../assets");
|
|
40
41
|
var import_makoHooks = require("./makoHooks");
|
|
@@ -58,6 +59,15 @@ var compile_default = (api) => {
|
|
|
58
59
|
const cacheDirPath = api.userConfig.cacheDirectoryPath || memo.cacheDirectoryPath;
|
|
59
60
|
if (cacheDirPath)
|
|
60
61
|
(0, import_utils._setFSCacheDir)(import_path.default.join(cacheDirPath, "dumi"));
|
|
62
|
+
const SEARCH_WORKER_CODE = import_fs.default.readFileSync(
|
|
63
|
+
import_path.default.resolve(
|
|
64
|
+
__dirname,
|
|
65
|
+
"../../../compiled/_internal/searchWorker.min.js"
|
|
66
|
+
),
|
|
67
|
+
"utf-8"
|
|
68
|
+
);
|
|
69
|
+
memo.define ?? (memo.define = {});
|
|
70
|
+
memo.define.SEARCH_WORKER_CODE = SEARCH_WORKER_CODE;
|
|
61
71
|
return memo;
|
|
62
72
|
}
|
|
63
73
|
});
|