@incremental/turbopack 0.0.0-stage → 0.1.3
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 +61 -2
- package/dist/src/index.d.ts +5 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/index.js +4 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/project.d.ts +28 -0
- package/dist/src/project.d.ts.map +1 -0
- package/dist/src/project.js +153 -0
- package/dist/src/project.js.map +1 -0
- package/dist/src/run.d.ts +48 -0
- package/dist/src/run.d.ts.map +1 -0
- package/dist/src/run.js +370 -0
- package/dist/src/run.js.map +1 -0
- package/dist/tests/adapter.test.d.ts +2 -0
- package/dist/tests/adapter.test.d.ts.map +1 -0
- package/dist/tests/adapter.test.js +170 -0
- package/dist/tests/adapter.test.js.map +1 -0
- package/dist/tests/inputs.test.d.ts +2 -0
- package/dist/tests/inputs.test.d.ts.map +1 -0
- package/dist/tests/inputs.test.js +39 -0
- package/dist/tests/inputs.test.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/package.json +28 -4
- package/src/index.ts +13 -0
- package/src/project.ts +178 -0
- package/src/run.ts +457 -0
- package/tests/adapter.test.ts +228 -0
- package/tests/inputs.test.ts +45 -0
- package/tsconfig.json +8 -0
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
// Input selection without a build (spec/adapters/turbopack.md): an app's inputs
|
|
2
|
+
// are the repository minus the directories of the other apps.
|
|
3
|
+
import assert from "node:assert/strict";
|
|
4
|
+
import { mkdirSync, mkdtempSync, rmSync, writeFileSync } from "node:fs";
|
|
5
|
+
import os from "node:os";
|
|
6
|
+
import path from "node:path";
|
|
7
|
+
import { test } from "node:test";
|
|
8
|
+
import { excludedFor, repoInputs } from "../src/index.js";
|
|
9
|
+
|
|
10
|
+
function write(root: string, rel: string, content: string): void {
|
|
11
|
+
mkdirSync(path.dirname(path.join(root, rel)), { recursive: true });
|
|
12
|
+
writeFileSync(path.join(root, rel), content);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
test("an app's inputs exclude the other apps, and keep shared code and root files", () => {
|
|
16
|
+
const root = mkdtempSync(path.join(os.tmpdir(), "incremental-tp-inputs-"));
|
|
17
|
+
try {
|
|
18
|
+
write(root, "package.json", "{}");
|
|
19
|
+
write(root, "libs/util/index.ts", "export {};\n");
|
|
20
|
+
write(root, "apps/web/app/page.tsx", "x\n");
|
|
21
|
+
write(root, "apps/docs/app/page.tsx", "y\n");
|
|
22
|
+
const apps = ["apps/docs", "apps/web"];
|
|
23
|
+
|
|
24
|
+
const web = repoInputs(root, excludedFor("apps/web", apps)).map((i) => i.path);
|
|
25
|
+
assert.ok(web.includes("apps/web/app/page.tsx"));
|
|
26
|
+
assert.ok(web.includes("libs/util/index.ts"), "shared code is an input");
|
|
27
|
+
assert.ok(web.includes("package.json"), "root files are inputs");
|
|
28
|
+
assert.ok(!web.some((p) => p.startsWith("apps/docs/")), "the other app is excluded");
|
|
29
|
+
|
|
30
|
+
const root2 = repoInputs(root, excludedFor(".", ["."])).map((i) => i.path);
|
|
31
|
+
assert.ok(
|
|
32
|
+
root2.includes("apps/docs/app/page.tsx"),
|
|
33
|
+
"a root app that is the only app sees everything",
|
|
34
|
+
);
|
|
35
|
+
} finally {
|
|
36
|
+
rmSync(root, { recursive: true, force: true });
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
test("the root app excludes the apps it does not contain, and an app keeps the root", () => {
|
|
41
|
+
assert.deepEqual([...excludedFor("apps/web", [".", "apps/web", "apps/docs"])].sort(), [
|
|
42
|
+
"apps/docs",
|
|
43
|
+
]);
|
|
44
|
+
assert.deepEqual([...excludedFor(".", [".", "apps/web"])].sort(), ["apps/web"]);
|
|
45
|
+
});
|