Skip to content

Commit a0e0af5

Browse files
committed
[search] Introduce cubing-private exports for search.
This allows us to use functions across sub-packages without exporting them publicly. This is generally a sign of bad design, but it allows us to ship certain functionality without exposing an experimental API that we do not intend to support in the future. In particular, this PR removes `[experimental]randomScrambleForEvent()` from `cubing/search`, since it's only meant to be used from `cubing/scramble`.
1 parent ec69843 commit a0e0af5

File tree

4 files changed

+9
-2
lines changed

4 files changed

+9
-2
lines changed

script/test/import-restrictions/main.js

+7
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ const TARGET_INFOS_PATH = resolve(
1010
"./target-infos.js",
1111
);
1212

13+
const CUBING_PRIVATE_SUFFIX = "/cubing-private";
14+
1315
// Note that we have to use an extra `..` to back out of the file name
1416
const PATH_TO_SRC_CUBING = resolve(
1517
new URL(".", import.meta.url).pathname,
@@ -77,6 +79,11 @@ class Target {
7779
return undefined;
7880
}
7981

82+
// Allow cubing-private cross-package exports.
83+
if (args.path.endsWith(CUBING_PRIVATE_SUFFIX)) {
84+
args.path = args.path.slice(0, -CUBING_PRIVATE_SUFFIX.length);
85+
}
86+
8087
const resolved = resolve(args.resolveDir, args.path);
8188
if (this.dirPath === resolved) {
8289
this.checkImportable(args, forTarget);

src/cubing/scramble/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
export { experimentalRandomScrambleForEvent as randomScrambleForEvent } from "../search";
1+
export { randomScrambleForEvent } from "../search/cubing-private";
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export { randomScrambleForEvent } from "../outside";

src/cubing/search/index.ts

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
export {
2-
randomScrambleForEvent as experimentalRandomScrambleForEvent,
32
experimentalSolve3x3x3IgnoringCenters,
43
experimentalSolve2x2x2,
54
solveSkewb,

0 commit comments

Comments
 (0)