@capybara-hq/testing 0.1.0-rc.10 → 0.1.0-rc.11
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/dist/fixtures.d.ts +13 -2
- package/dist/fixtures.js +16 -3
- package/fixtures/plugins/fake-theme/.capybara-plugin/plugin.json +7 -0
- package/fixtures/plugins/fake-theme/fonts/FakeSans.woff2 +1 -0
- package/fixtures/plugins/fake-theme/logo.svg +1 -0
- package/fixtures/plugins/fake-theme/package.json +8 -0
- package/fixtures/plugins/fake-theme/themes/night-city.json +13 -0
- package/fixtures/plugins/fake-theme/themes/paper.json +12 -0
- package/package.json +5 -5
package/dist/fixtures.d.ts
CHANGED
|
@@ -21,10 +21,21 @@
|
|
|
21
21
|
* | `fake-config-form` | display name 表单样例 / Form sample; no extension point: an openai-compatible-shaped deployment config (endpoints with a preset menu, an API key per endpoint in the secret record `apiKeys`, model rows, advanced fields, localized custom issues) carrying the config form hints of the extension config forms spec §6, for the web form e2e |
|
|
22
22
|
*/
|
|
23
23
|
export declare const FAKE_EXTENSIONS: readonly ["fake-connector", "fake-openapi", "fake-object-store", "fake-tools-ui", "fake-storage-user", "fake-embed", "fake-bootstrap-a", "fake-bootstrap-b", "fake-dep-provider", "fake-dep-requirer", "fake-im", "fake-web", "fake-web-2", "fake-config-form"];
|
|
24
|
+
/**
|
|
25
|
+
* Fake plugins without an extension (declarative: they live in `fixtures/plugins/<name>`, same
|
|
26
|
+
* pack layout).
|
|
27
|
+
*
|
|
28
|
+
* | name | provides / covers |
|
|
29
|
+
* |---|---|
|
|
30
|
+
* | `fake-theme` | themes `night-city` (dark only, wordmark, font `FakeSans`, logo) and `paper` (light and dark); passes `capybara-plugin check` |
|
|
31
|
+
*/
|
|
32
|
+
export declare const FAKE_PLUGINS: readonly ["fake-theme"];
|
|
33
|
+
/** The name of a fake plugin. */
|
|
34
|
+
export type FakePluginName = (typeof FAKE_PLUGINS)[number];
|
|
24
35
|
/** The name of a fake extension (also its plugin and extension name). */
|
|
25
36
|
export type FakeExtensionName = (typeof FAKE_EXTENSIONS)[number];
|
|
26
37
|
/** The plugin directory of a fake (pack layout), for `packFixture` or a packer of your own. */
|
|
27
|
-
export declare function fakeExtensionDir(name: FakeExtensionName): string;
|
|
38
|
+
export declare function fakeExtensionDir(name: FakeExtensionName | FakePluginName): string;
|
|
28
39
|
/**
|
|
29
40
|
* The extension entry `src/index.ts` of a fake, for kernel configs that load extensions by path
|
|
30
41
|
* (`extensions: [fakeExtensionEntry("fake-connector")]`). `createDualReplicaHarness` loads it in
|
|
@@ -48,4 +59,4 @@ export interface PackedFixture {
|
|
|
48
59
|
* skills and templates), writes it to `outDir` and returns its path, bytes and sha256. Packing
|
|
49
60
|
* leaves no files in the fixture directory.
|
|
50
61
|
*/
|
|
51
|
-
export declare function packFixture(name: FakeExtensionName, outDir: string): Promise<PackedFixture>;
|
|
62
|
+
export declare function packFixture(name: FakeExtensionName | FakePluginName, outDir: string): Promise<PackedFixture>;
|
package/dist/fixtures.js
CHANGED
|
@@ -39,11 +39,22 @@ export const FAKE_EXTENSIONS = [
|
|
|
39
39
|
"fake-web-2",
|
|
40
40
|
"fake-config-form",
|
|
41
41
|
];
|
|
42
|
+
/**
|
|
43
|
+
* Fake plugins without an extension (declarative: they live in `fixtures/plugins/<name>`, same
|
|
44
|
+
* pack layout).
|
|
45
|
+
*
|
|
46
|
+
* | name | provides / covers |
|
|
47
|
+
* |---|---|
|
|
48
|
+
* | `fake-theme` | themes `night-city` (dark only, wordmark, font `FakeSans`, logo) and `paper` (light and dark); passes `capybara-plugin check` |
|
|
49
|
+
*/
|
|
50
|
+
export const FAKE_PLUGINS = ["fake-theme"];
|
|
42
51
|
/** `fixtures/extensions/` of this package (same path from `src/` and from `dist/`). */
|
|
43
52
|
const FIXTURES_DIR = fileURLToPath(new URL("../fixtures/extensions/", import.meta.url));
|
|
53
|
+
/** `fixtures/plugins/` of this package. */
|
|
54
|
+
const PLUGINS_DIR = fileURLToPath(new URL("../fixtures/plugins/", import.meta.url));
|
|
44
55
|
/** The plugin directory of a fake (pack layout), for `packFixture` or a packer of your own. */
|
|
45
56
|
export function fakeExtensionDir(name) {
|
|
46
|
-
return join(FIXTURES_DIR, name);
|
|
57
|
+
return join(FAKE_PLUGINS.includes(name) ? PLUGINS_DIR : FIXTURES_DIR, name);
|
|
47
58
|
}
|
|
48
59
|
/**
|
|
49
60
|
* The extension entry `src/index.ts` of a fake, for kernel configs that load extensions by path
|
|
@@ -89,8 +100,10 @@ async function packer() {
|
|
|
89
100
|
* leaves no files in the fixture directory.
|
|
90
101
|
*/
|
|
91
102
|
export async function packFixture(name, outDir) {
|
|
92
|
-
|
|
93
|
-
|
|
103
|
+
const known = FAKE_EXTENSIONS.includes(name) ||
|
|
104
|
+
FAKE_PLUGINS.includes(name);
|
|
105
|
+
if (!known)
|
|
106
|
+
throw new Error(`unknown fake extension or plugin ${String(name)}`);
|
|
94
107
|
const pack = await packer();
|
|
95
108
|
const r = await pack(fakeExtensionDir(name), outDir);
|
|
96
109
|
return { file: r.file, bytes: new Uint8Array(await readFile(r.file)), sha256: r.sha256 };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
wOF2
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 10 10"><title>Fake theme</title><path d="M0 0h10v10z" fill="#FCE300"/></svg>
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": { "en": "Night City", "zh": "夜之城" },
|
|
3
|
+
"schemes": {
|
|
4
|
+
"dark": {
|
|
5
|
+
"color": { "bg": "#05070D", "panel": "#0A0E18", "accent": "#FCE300", "on-accent": "#141200" },
|
|
6
|
+
"radius": { "sm": 0, "md": 2 }
|
|
7
|
+
}
|
|
8
|
+
},
|
|
9
|
+
"fonts": [
|
|
10
|
+
{ "family": "FakeSans", "file": "./fonts/FakeSans.woff2", "weight": 400, "role": "prose" }
|
|
11
|
+
],
|
|
12
|
+
"logo": { "mark": "./logo.svg", "wordmark": "NIGHT CITY" }
|
|
13
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@capybara-hq/testing",
|
|
3
|
-
"version": "0.1.0-rc.
|
|
3
|
+
"version": "0.1.0-rc.11",
|
|
4
4
|
"description": "Test helpers for Capybara: test containers, dual-replica harness and fake third-party servers",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -47,17 +47,17 @@
|
|
|
47
47
|
"tsx": "^4.23.15",
|
|
48
48
|
"ws": "^8.22.0",
|
|
49
49
|
"zod": "^4.6.7",
|
|
50
|
-
"@capybara-hq/kernel": "^0.1.0-rc.
|
|
50
|
+
"@capybara-hq/kernel": "^0.1.0-rc.11"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
53
|
"@types/pg": "^8.23.1",
|
|
54
54
|
"@types/ws": "^8.18.2",
|
|
55
|
-
"@capybara-hq/plugin-sdk": "^0.1.0-rc.
|
|
55
|
+
"@capybara-hq/plugin-sdk": "^0.1.0-rc.8"
|
|
56
56
|
},
|
|
57
57
|
"peerDependencies": {
|
|
58
58
|
"vitest": "^5.0.5",
|
|
59
|
-
"@capybara-hq/plugin-sdk": "^0.1.0-rc.
|
|
60
|
-
"@capybara-hq/plugin-tools": "^0.1.0-rc.
|
|
59
|
+
"@capybara-hq/plugin-sdk": "^0.1.0-rc.8",
|
|
60
|
+
"@capybara-hq/plugin-tools": "^0.1.0-rc.9"
|
|
61
61
|
},
|
|
62
62
|
"peerDependenciesMeta": {
|
|
63
63
|
"@capybara-hq/plugin-tools": {
|