cubing 0.22.1 → 0.23.0
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/README.md +1 -1
- package/alg/package.json +1 -3
- package/bluetooth/package.json +1 -3
- package/dist/bundle-global/cubing.bundle-global.js +2979 -242
- package/dist/esm/2x2x2.sgs.json-FRBWMMA7.js +122 -0
- package/dist/esm/2x2x2.sgs.json-FRBWMMA7.js.map +7 -0
- package/dist/esm/{3d-M7GBIT3X.js → 3d-Q4WSD4BC.js} +3 -3
- package/dist/esm/{3d-M7GBIT3X.js.map → 3d-Q4WSD4BC.js.map} +0 -0
- package/dist/esm/bluetooth/index.d.ts +1 -1
- package/dist/esm/bluetooth/index.js +1 -1
- package/dist/esm/chunk-37EHU3GZ.js +66 -0
- package/dist/esm/chunk-37EHU3GZ.js.map +7 -0
- package/dist/esm/chunk-BJIOROQC.js +18 -0
- package/dist/esm/chunk-BJIOROQC.js.map +7 -0
- package/dist/esm/{chunk-R3HRHYIW.js → chunk-DK6PXBB2.js} +1 -1
- package/dist/esm/{chunk-R3HRHYIW.js.map → chunk-DK6PXBB2.js.map} +0 -0
- package/dist/esm/chunk-DPMEZY7V.js +1552 -0
- package/dist/esm/chunk-DPMEZY7V.js.map +7 -0
- package/dist/esm/chunk-FK2SCC3Z.js +499 -0
- package/dist/esm/chunk-FK2SCC3Z.js.map +7 -0
- package/dist/esm/chunk-JZWB7AIU.js +115 -0
- package/dist/esm/chunk-JZWB7AIU.js.map +7 -0
- package/dist/esm/chunk-MLOCDLUF.js +226 -0
- package/dist/esm/chunk-MLOCDLUF.js.map +7 -0
- package/dist/esm/{chunk-GF76PWEV.js → chunk-N3RNWU5T.js} +2 -2
- package/dist/esm/{chunk-GF76PWEV.js.map → chunk-N3RNWU5T.js.map} +0 -0
- package/dist/esm/chunk-PUPUQWJC.js +4065 -0
- package/dist/esm/chunk-PUPUQWJC.js.map +7 -0
- package/dist/esm/chunk-XVZOMB6J.js +89 -0
- package/dist/esm/chunk-XVZOMB6J.js.map +7 -0
- package/dist/esm/chunk-Z6X7HTPP.js +103 -0
- package/dist/esm/chunk-Z6X7HTPP.js.map +7 -0
- package/dist/esm/entry-L6CE2HLF.js +531 -0
- package/dist/esm/entry-L6CE2HLF.js.map +7 -0
- package/dist/esm/esm-test-worker.js +3 -14
- package/dist/esm/esm-test-worker.js.map +3 -3
- package/dist/esm/fto.sgs.json-62YNULOK.js +649 -0
- package/dist/esm/fto.sgs.json-62YNULOK.js.map +7 -0
- package/dist/esm/gwt-B7CBESZR.js +1669 -0
- package/dist/esm/gwt-B7CBESZR.js.map +7 -0
- package/dist/esm/megaminx.sgs.json-PRL46G5J.js +16 -0
- package/dist/esm/megaminx.sgs.json-PRL46G5J.js.map +7 -0
- package/dist/esm/module-entry-J2N3UZP7.js +18 -0
- package/dist/esm/module-entry-J2N3UZP7.js.map +7 -0
- package/dist/esm/{node-HFBX5WHK.js → node-W3AD4HBK.js} +2 -1
- package/dist/esm/node-W3AD4HBK.js.map +7 -0
- package/dist/esm/puzzle-geometry/index.js +11 -4051
- package/dist/esm/puzzle-geometry/index.js.map +3 -3
- package/dist/esm/puzzles/index.js +1 -1
- package/dist/esm/pyraminx.sgs.json-7QMPT5XP.js +14 -0
- package/dist/esm/pyraminx.sgs.json-7QMPT5XP.js.map +7 -0
- package/dist/esm/scramble/index.js +4 -2
- package/dist/esm/scramble_444-JP3CWLJM.js +2572 -0
- package/dist/esm/scramble_444-JP3CWLJM.js.map +7 -0
- package/dist/esm/scramble_sq1-PQ2AYBFW.js +706 -0
- package/dist/esm/scramble_sq1-PQ2AYBFW.js.map +7 -0
- package/dist/esm/search/index.js +6 -3
- package/dist/esm/skewb.sgs.json-FWHYACJG.js +16 -0
- package/dist/esm/skewb.sgs.json-FWHYACJG.js.map +7 -0
- package/dist/esm/twisty/index.js +3 -3
- package/dist/esm/worker-inside-generated-string-OWJA5IIQ.js +3450 -0
- package/dist/esm/worker-inside-generated-string-OWJA5IIQ.js.map +7 -0
- package/dist/types/search/inside/module-entry-path-getter.d.ts +2 -0
- package/dist/types/search/inside/module-entry-path-getter.d.ts.map +1 -0
- package/dist/types/search/inside/module-entry.d.ts +2 -0
- package/dist/types/search/inside/module-entry.d.ts.map +1 -0
- package/dist/types/search/inside/solve/puzzles/3x3x3/index.d.ts.map +1 -1
- package/dist/types/search/inside/solve/puzzles/4x4x4.d.ts +2 -1
- package/dist/types/search/inside/solve/puzzles/4x4x4.d.ts.map +1 -1
- package/dist/types/search/inside/solve/puzzles/sq1.d.ts.map +1 -1
- package/dist/types/search/instantiator.d.ts +1 -2
- package/dist/types/search/instantiator.d.ts.map +1 -1
- package/dist/types/search/worker-inside-generated-string.d.ts +1 -1
- package/dist/types/search/worker-inside-generated-string.d.ts.map +1 -1
- package/dist/types/vendor/comlink-everywhere/outside/node.d.ts.map +1 -1
- package/docs/.DS_Store +0 -0
- package/docs/cubing/.DS_Store +0 -0
- package/docs/cubing/index.html +1 -1
- package/kpuzzle/package.json +1 -3
- package/notation/package.json +1 -3
- package/package.json +2 -6
- package/protocol/package.json +1 -3
- package/puzzle-geometry/package.json +1 -3
- package/puzzles/package.json +1 -3
- package/scramble/package.json +1 -3
- package/search/package.json +1 -3
- package/src/cubing/.DS_Store +0 -0
- package/src/cubing/search/.DS_Store +0 -0
- package/src/cubing/search/inside/.DS_Store +0 -0
- package/src/cubing/search/inside/module-entry-path-getter.ts +5 -0
- package/src/cubing/search/inside/module-entry.ts +20 -0
- package/src/cubing/search/inside/solve/puzzles/3x3x3/index.ts +13 -3
- package/src/cubing/search/inside/solve/puzzles/4x4x4.ts +19 -5
- package/src/cubing/search/inside/solve/puzzles/fto.sgs.json.ts +356 -13
- package/src/cubing/search/inside/solve/puzzles/sq1.ts +12 -2
- package/src/cubing/search/instantiator.ts +75 -40
- package/src/cubing/search/worker-inside-generated-string.js +1 -1
- package/src/cubing/vendor/.DS_Store +0 -0
- package/src/cubing/vendor/comlink-everywhere/.DS_Store +0 -0
- package/src/cubing/vendor/comlink-everywhere/outside/node.js +1 -0
- package/src/cubing/vendor/cstimer/.DS_Store +0 -0
- package/src/cubing/{search/inside/solve/puzzles → vendor/cstimer/src}/.DS_Store +0 -0
- package/src/cubing/vendor/random-uint-below/random53BitValue.ts +1 -1
- package/src/cubing/vendor/sq12phase/scramble_sq1.js +2 -2
- package/src/cubing/{twisty/heavy-code-imports → vendor/three}/.DS_Store +0 -0
- package/src/cubing/{twisty/old/animation → vendor/three/examples}/.DS_Store +0 -0
- package/stream/package.json +1 -3
- package/twisty/package.json +1 -3
- package/alg/index.d.ts +0 -1
- package/bluetooth/index.d.ts +0 -1
- package/dist/.DS_Store +0 -0
- package/dist/esm/chunk-6BZSKSG7.js +0 -1368
- package/dist/esm/chunk-6BZSKSG7.js.map +0 -7
- package/dist/esm/index.d.ts +0 -1
- package/dist/esm/node-HFBX5WHK.js.map +0 -7
- package/dist/esm/worker-inside-generated-string-RQYYANYQ.js +0 -3107
- package/dist/esm/worker-inside-generated-string-RQYYANYQ.js.map +0 -7
- package/kpuzzle/index.d.ts +0 -1
- package/notation/index.d.ts +0 -1
- package/protocol/index.d.ts +0 -1
- package/puzzle-geometry/index.d.ts +0 -1
- package/puzzles/index.d.ts +0 -1
- package/scramble/index.d.ts +0 -1
- package/search/index.d.ts +0 -1
- package/src/cubing/puzzles/.DS_Store +0 -0
- package/src/cubing/puzzles/implementations/.DS_Store +0 -0
- package/src/cubing/search/inside/solve/.DS_Store +0 -0
- package/src/cubing/search/inside/solve/vendor/.DS_Store +0 -0
- package/src/cubing/twisty/.DS_Store +0 -0
- package/src/cubing/twisty/controllers/.DS_Store +0 -0
- package/src/cubing/twisty/controllers/animation/.DS_Store +0 -0
- package/src/cubing/twisty/controllers/indexer/.DS_Store +0 -0
- package/src/cubing/twisty/model/.DS_Store +0 -0
- package/src/cubing/twisty/model/props/.DS_Store +0 -0
- package/src/cubing/twisty/model/props/puzzle/.DS_Store +0 -0
- package/src/cubing/twisty/old/.DS_Store +0 -0
- package/src/cubing/twisty/old/dom/.DS_Store +0 -0
- package/src/cubing/twisty/views/.DS_Store +0 -0
- package/src/cubing/twisty/views/3D/.DS_Store +0 -0
- package/stream/index.d.ts +0 -1
- package/twisty/index.d.ts +0 -1
|
@@ -1,60 +1,95 @@
|
|
|
1
|
-
import type { WorkerInsideAPI } from "./inside/api";
|
|
2
|
-
|
|
3
1
|
import {
|
|
4
2
|
constructWorkerFromString,
|
|
5
3
|
workerFileConstructor,
|
|
6
4
|
wrap,
|
|
7
5
|
} from "../vendor/comlink-everywhere/outside";
|
|
6
|
+
import type { WorkerInsideAPI } from "./inside/api";
|
|
7
|
+
import { getWorkerEntryFileURL } from "./inside/module-entry-path-getter";
|
|
8
|
+
|
|
9
|
+
const MODULE_WORKER_TIMEOUT_MILLISECONDS = 5000;
|
|
10
|
+
export async function instantiateModuleWorker(): Promise<WorkerInsideAPI> {
|
|
11
|
+
// eslint-disable-next-line no-async-promise-executor
|
|
12
|
+
return new Promise<WorkerInsideAPI>(async (resolve, reject) => {
|
|
13
|
+
const timeoutID = setTimeout(() => {
|
|
14
|
+
reject(new Error("module instantiation timeout"));
|
|
15
|
+
}, MODULE_WORKER_TIMEOUT_MILLISECONDS);
|
|
8
16
|
|
|
9
|
-
|
|
10
|
-
|
|
17
|
+
try {
|
|
18
|
+
const workerEntryFileURL = await getWorkerEntryFileURL();
|
|
19
|
+
if (!workerEntryFileURL) {
|
|
20
|
+
// This happens in `bundle-global`.
|
|
21
|
+
reject(new Error("Could not get worker entry file URL."));
|
|
22
|
+
}
|
|
23
|
+
let url: string | URL;
|
|
24
|
+
if (globalThis.Blob) {
|
|
25
|
+
// Standard browser-like environment.
|
|
26
|
+
const importSrc = `import "${workerEntryFileURL}";`;
|
|
27
|
+
const blob = new Blob([importSrc], {
|
|
28
|
+
type: "text/javascript",
|
|
29
|
+
});
|
|
30
|
+
url = URL.createObjectURL(blob);
|
|
31
|
+
} else {
|
|
32
|
+
// `node` doesn't have `Blob`. We can keep the original entry file URL there, but we have to wrap it.
|
|
33
|
+
// Needed for `node`
|
|
34
|
+
url = new URL(workerEntryFileURL);
|
|
35
|
+
}
|
|
11
36
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
37
|
+
const constructor = await workerFileConstructor();
|
|
38
|
+
const worker = new constructor(url, {
|
|
39
|
+
type: "module",
|
|
40
|
+
}) as Worker & {
|
|
41
|
+
nodeWorker?: import("worker_threads").Worker;
|
|
42
|
+
};
|
|
16
43
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
44
|
+
const onError = (e: ErrorEvent) => {
|
|
45
|
+
// TODO: Remove fallback when Firefox implements module workers: https://bugzilla.mozilla.org/show_bug.cgi?id=1247687
|
|
46
|
+
if (e.message?.startsWith("SyntaxError")) {
|
|
47
|
+
reject(e);
|
|
48
|
+
}
|
|
49
|
+
};
|
|
23
50
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
51
|
+
const onFirstMessage = (messageData: string) => {
|
|
52
|
+
if (messageData === "comlink-exposed") {
|
|
53
|
+
// We need to clear the timeout so that we don't prevent `node` from exiting in the meantime.
|
|
54
|
+
clearTimeout(timeoutID);
|
|
55
|
+
resolve(wrap<WorkerInsideAPI>(worker));
|
|
56
|
+
} else {
|
|
57
|
+
reject(
|
|
58
|
+
new Error("wrong module instantiation message " + messageData),
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
};
|
|
27
62
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
63
|
+
if (worker.nodeWorker) {
|
|
64
|
+
// We have to use `once` so the `unref()` from `comlink-everywhere` allows the process to quite as expected.
|
|
65
|
+
worker.nodeWorker.once("message", onFirstMessage);
|
|
66
|
+
} else {
|
|
67
|
+
worker.addEventListener("error", onError, {
|
|
68
|
+
once: true,
|
|
69
|
+
});
|
|
70
|
+
worker.addEventListener("message", (e) => onFirstMessage(e.data), {
|
|
71
|
+
once: true,
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
} catch (e) {
|
|
75
|
+
reject(e);
|
|
32
76
|
}
|
|
33
|
-
|
|
34
|
-
// TODO: terminate worker.
|
|
35
77
|
});
|
|
36
78
|
}
|
|
37
79
|
|
|
38
|
-
export async function
|
|
80
|
+
export async function instantiateWorker(): Promise<WorkerInsideAPI> {
|
|
39
81
|
try {
|
|
40
|
-
await
|
|
41
|
-
|
|
82
|
+
// `await` is important for `catch` to work.
|
|
83
|
+
return await instantiateModuleWorker();
|
|
42
84
|
} catch (e) {
|
|
43
85
|
console.warn(
|
|
44
|
-
"
|
|
86
|
+
"Could not instantiate module worker (this is expected in Firefox and `bundle-global`). Falling back to string worker.",
|
|
87
|
+
e,
|
|
45
88
|
);
|
|
89
|
+
const { workerSource } = await import(
|
|
90
|
+
"./worker-inside-generated-string.js"
|
|
91
|
+
);
|
|
92
|
+
const worker = await constructWorkerFromString(workerSource);
|
|
93
|
+
return wrap(worker);
|
|
46
94
|
}
|
|
47
95
|
}
|
|
48
|
-
|
|
49
|
-
export async function instantiateWorker(): Promise<WorkerInsideAPI> {
|
|
50
|
-
const { workerSource } = await import("./worker-inside-generated-string.js");
|
|
51
|
-
// console.log({ workerSource });
|
|
52
|
-
|
|
53
|
-
const worker = await constructWorkerFromString(workerSource);
|
|
54
|
-
|
|
55
|
-
if (TEST_RELATIVE_URL_WORKER) {
|
|
56
|
-
relativeURLWorkerTest(); // do not wait for the result
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
return wrap(worker);
|
|
60
|
-
}
|