@apollo/client-ai-apps 0.2.4 → 0.3.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.
@@ -10,11 +10,19 @@ type ToolUseState = {
10
10
 
11
11
  const ToolUseContext = React.createContext<ToolUseState | null>(null);
12
12
 
13
- export function ToolUseProvider({ children, appName }: { children: any; appName: string }) {
13
+ export function ToolUseProvider({
14
+ children,
15
+ appName,
16
+ }: {
17
+ children: any;
18
+ appName: string;
19
+ }) {
14
20
  const [hasNavigated, setHasNavigated] = useState(false);
15
21
 
16
22
  return (
17
- <ToolUseContext.Provider value={{ hasNavigated, setHasNavigated, appName }}>{children}</ToolUseContext.Provider>
23
+ <ToolUseContext.Provider value={{ hasNavigated, setHasNavigated, appName }}>
24
+ {children}
25
+ </ToolUseContext.Provider>
18
26
  );
19
27
  }
20
28
 
@@ -26,16 +34,27 @@ export const useToolEffect = (
26
34
  const ctx = React.useContext(ToolUseContext);
27
35
  const fullToolName = useToolName();
28
36
  const toolInput = useToolInput();
29
- if (!ctx) throw new Error("useToolEffect must be used within ToolUseProvider");
37
+ if (!ctx)
38
+ throw new Error("useToolEffect must be used within ToolUseProvider");
30
39
 
31
40
  const toolNames = Array.isArray(toolName) ? toolName : [toolName];
32
41
 
33
42
  useEffect(() => {
34
- const matches = toolNames.some((name) => fullToolName === `${ctx.appName}--${name}`);
43
+ const matches = toolNames.some(
44
+ (name) => fullToolName === `${ctx.appName}--${name}`
45
+ );
35
46
 
36
47
  if (!ctx.hasNavigated && matches) {
37
48
  effect(toolInput);
38
49
  ctx.setHasNavigated(true);
39
50
  }
40
- }, [ctx.hasNavigated, ctx.setHasNavigated, ctx.appName, toolNames, fullToolName, toolInput, ...deps]);
51
+ }, [
52
+ ctx.hasNavigated,
53
+ ctx.setHasNavigated,
54
+ ctx.appName,
55
+ toolNames,
56
+ fullToolName,
57
+ toolInput,
58
+ ...deps,
59
+ ]);
41
60
  };
package/src/index.ts CHANGED
@@ -10,3 +10,4 @@ export * from "./hooks/useToolEffect";
10
10
  export * from "@apollo/client";
11
11
  export { ExtendedApolloClient as ApolloClient } from "./apollo_client/client";
12
12
  export { ExtendedApolloProvider as ApolloProvider } from "./apollo_client/provider";
13
+ export { ToolCallLink } from "./apollo_client/link/ToolCallLink";
@@ -14,7 +14,7 @@ export type OpenAiGlobals<
14
14
  ToolInput extends UnknownObject = UnknownObject,
15
15
  ToolOutput extends UnknownObject = UnknownObject,
16
16
  ToolResponseMetadata extends UnknownObject = UnknownObject,
17
- WidgetState extends UnknownObject = UnknownObject
17
+ WidgetState extends UnknownObject = UnknownObject,
18
18
  > = {
19
19
  theme: Theme;
20
20
  userAgent: UserAgent;
@@ -62,7 +62,10 @@ export class SetGlobalsEvent extends CustomEvent<{
62
62
  readonly type = SET_GLOBALS_EVENT_TYPE;
63
63
  }
64
64
 
65
- export type CallTool = (name: string, args: Record<string, unknown>) => Promise<any>;
65
+ export type CallTool = (
66
+ name: string,
67
+ args: Record<string, unknown>
68
+ ) => Promise<any>;
66
69
 
67
70
  export type DisplayMode = "pip" | "inline" | "fullscreen";
68
71
 
@@ -96,5 +96,7 @@ test("Should not modify html when not running a local server", () => {
96
96
 
97
97
  let result = plugin.transformIndexHtml(html, ctx);
98
98
 
99
- expect(result).toMatchInlineSnapshot(`"<html><head><script type="module" src="/@vite/client"></script></head><body><script module src="/assets/main.ts?t=12345"></script></body></html>"`);
99
+ expect(result).toMatchInlineSnapshot(
100
+ `"<html><head><script type="module" src="/@vite/client"></script></head><body><script module src="/assets/main.ts?t=12345"></script></body></html>"`
101
+ );
100
102
  });
@@ -5,7 +5,9 @@ export const AbsoluteAssetImportsPlugin = () => {
5
5
  transformIndexHtml(html: string, ctx: any) {
6
6
  if (!ctx.server) return html;
7
7
 
8
- let baseUrl = (ctx.server.config?.server?.origin ?? ctx.server.resolvedUrls?.local[0]).replace(/\/$/, "");
8
+ let baseUrl = (
9
+ ctx.server.config?.server?.origin ?? ctx.server.resolvedUrls?.local[0]
10
+ ).replace(/\/$/, "");
9
11
  baseUrl = baseUrl.replace(/\/$/, "");
10
12
 
11
13
  return (
@@ -23,7 +23,9 @@ vi.mock(import("path"), async (importOriginal) => {
23
23
  return {
24
24
  default: {
25
25
  ...actual.default,
26
- resolve: vi.fn((...args) => args.map((a, i) => (i === 0 ? a : a.replace(/^\//, ""))).join("/")),
26
+ resolve: vi.fn((...args) =>
27
+ args.map((a, i) => (i === 0 ? a : a.replace(/^\//, ""))).join("/")
28
+ ),
27
29
  dirname: vi.fn(),
28
30
  },
29
31
  };
@@ -55,11 +57,17 @@ describe("buildStart", () => {
55
57
  `;
56
58
  }
57
59
  });
58
- vi.spyOn(glob, "glob").mockImplementation(() => Promise.resolve(["my-component.tsx"]));
60
+ vi.spyOn(glob, "glob").mockImplementation(() =>
61
+ Promise.resolve(["my-component.tsx"])
62
+ );
59
63
  vi.spyOn(fs, "writeFileSync");
60
64
 
61
65
  const plugin = ApplicationManifestPlugin();
62
- plugin.configResolved({ command: "serve", server: {}, build: { outDir: "/dist" } });
66
+ plugin.configResolved({
67
+ command: "serve",
68
+ server: {},
69
+ build: { outDir: "/dist" },
70
+ });
63
71
  await plugin.buildStart();
64
72
  let [file, content] = (fs.writeFileSync as unknown as Mock).mock.calls[0];
65
73
 
@@ -120,7 +128,9 @@ describe("buildStart", () => {
120
128
  `;
121
129
  }
122
130
  });
123
- vi.spyOn(glob, "glob").mockImplementation(() => Promise.resolve(["my-component.tsx"]));
131
+ vi.spyOn(glob, "glob").mockImplementation(() =>
132
+ Promise.resolve(["my-component.tsx"])
133
+ );
124
134
  vi.spyOn(path, "resolve").mockImplementation((_, file) => file);
125
135
  vi.spyOn(fs, "writeFileSync");
126
136
 
@@ -141,11 +151,17 @@ describe("buildStart", () => {
141
151
  `;
142
152
  }
143
153
  });
144
- vi.spyOn(glob, "glob").mockImplementation(() => Promise.resolve(["my-component.tsx"]));
154
+ vi.spyOn(glob, "glob").mockImplementation(() =>
155
+ Promise.resolve(["my-component.tsx"])
156
+ );
145
157
  vi.spyOn(fs, "writeFileSync");
146
158
 
147
159
  const plugin = ApplicationManifestPlugin();
148
- plugin.configResolved({ command: "serve", server: {}, build: { outDir: "/dist" } });
160
+ plugin.configResolved({
161
+ command: "serve",
162
+ server: {},
163
+ build: { outDir: "/dist" },
164
+ });
149
165
  await plugin.buildStart();
150
166
  let [file, content] = (fs.writeFileSync as unknown as Mock).mock.calls[0];
151
167
 
@@ -180,11 +196,17 @@ describe("buildStart", () => {
180
196
  `;
181
197
  }
182
198
  });
183
- vi.spyOn(glob, "glob").mockImplementation(() => Promise.resolve(["my-component.tsx"]));
199
+ vi.spyOn(glob, "glob").mockImplementation(() =>
200
+ Promise.resolve(["my-component.tsx"])
201
+ );
184
202
  vi.spyOn(fs, "writeFileSync");
185
203
 
186
204
  const plugin = ApplicationManifestPlugin();
187
- plugin.configResolved({ command: "serve", server: {}, build: { outDir: "/dist" } });
205
+ plugin.configResolved({
206
+ command: "serve",
207
+ server: {},
208
+ build: { outDir: "/dist" },
209
+ });
188
210
  await plugin.buildStart();
189
211
  let [file, content] = (fs.writeFileSync as unknown as Mock).mock.calls[0];
190
212
 
@@ -231,11 +253,17 @@ describe("buildStart", () => {
231
253
  `;
232
254
  }
233
255
  });
234
- vi.spyOn(glob, "glob").mockImplementation(() => Promise.resolve(["my-component.tsx"]));
256
+ vi.spyOn(glob, "glob").mockImplementation(() =>
257
+ Promise.resolve(["my-component.tsx"])
258
+ );
235
259
  vi.spyOn(fs, "writeFileSync");
236
260
 
237
261
  const plugin = ApplicationManifestPlugin();
238
- plugin.configResolved({ command: "serve", server: {}, build: { outDir: "/dist" } });
262
+ plugin.configResolved({
263
+ command: "serve",
264
+ server: {},
265
+ build: { outDir: "/dist" },
266
+ });
239
267
  await plugin.buildStart();
240
268
  let [file, content] = (fs.writeFileSync as unknown as Mock).mock.calls[0];
241
269
 
@@ -284,13 +312,17 @@ describe("buildStart", () => {
284
312
  `;
285
313
  }
286
314
  });
287
- vi.spyOn(glob, "glob").mockImplementation(() => Promise.resolve(["my-component.tsx"]));
315
+ vi.spyOn(glob, "glob").mockImplementation(() =>
316
+ Promise.resolve(["my-component.tsx"])
317
+ );
288
318
  vi.spyOn(path, "resolve").mockImplementation((_, file) => file);
289
319
  vi.spyOn(fs, "writeFileSync");
290
320
 
291
321
  const plugin = ApplicationManifestPlugin();
292
322
  plugin.configResolved({ command: "serve", server: {} });
293
- await expect(async () => await plugin.buildStart()).rejects.toThrowErrorMatchingInlineSnapshot(
323
+ await expect(
324
+ async () => await plugin.buildStart()
325
+ ).rejects.toThrowErrorMatchingInlineSnapshot(
294
326
  `[Error: Found multiple operations marked as \`@prefetch\`. You can only mark 1 operation with \`@prefetch\`.]`
295
327
  );
296
328
  });
@@ -305,11 +337,17 @@ describe("buildStart", () => {
305
337
  `;
306
338
  }
307
339
  });
308
- vi.spyOn(glob, "glob").mockImplementation(() => Promise.resolve(["my-component.tsx"]));
340
+ vi.spyOn(glob, "glob").mockImplementation(() =>
341
+ Promise.resolve(["my-component.tsx"])
342
+ );
309
343
  vi.spyOn(fs, "writeFileSync");
310
344
 
311
345
  const plugin = ApplicationManifestPlugin();
312
- plugin.configResolved({ command: "serve", server: {}, build: { outDir: "/dist" } });
346
+ plugin.configResolved({
347
+ command: "serve",
348
+ server: {},
349
+ build: { outDir: "/dist" },
350
+ });
313
351
  await plugin.buildStart();
314
352
  let [file, content] = (fs.writeFileSync as unknown as Mock).mock.calls[0];
315
353
 
@@ -361,14 +399,18 @@ describe("buildStart", () => {
361
399
  `;
362
400
  }
363
401
  });
364
- vi.spyOn(glob, "glob").mockImplementation(() => Promise.resolve(["my-component.tsx"]));
402
+ vi.spyOn(glob, "glob").mockImplementation(() =>
403
+ Promise.resolve(["my-component.tsx"])
404
+ );
365
405
  vi.spyOn(path, "resolve").mockImplementation((_, file) => file);
366
406
  vi.spyOn(fs, "writeFileSync");
367
407
 
368
408
  const plugin = ApplicationManifestPlugin();
369
409
  plugin.configResolved({ command: "serve", server: {} });
370
410
 
371
- await expect(async () => await plugin.buildStart()).rejects.toThrowErrorMatchingInlineSnapshot(
411
+ await expect(
412
+ async () => await plugin.buildStart()
413
+ ).rejects.toThrowErrorMatchingInlineSnapshot(
372
414
  `[Error: Found an unsupported operation type. Only Query and Mutation are supported.]`
373
415
  );
374
416
  });
@@ -387,12 +429,19 @@ describe("buildStart", () => {
387
429
  `;
388
430
  }
389
431
  });
390
- vi.spyOn(glob, "glob").mockImplementation(() => Promise.resolve(["my-component.tsx"]));
432
+ vi.spyOn(glob, "glob").mockImplementation(() =>
433
+ Promise.resolve(["my-component.tsx"])
434
+ );
391
435
  vi.spyOn(path, "resolve").mockImplementation((_, file) => file);
392
436
  vi.spyOn(fs, "writeFileSync");
393
437
 
394
438
  const plugin = ApplicationManifestPlugin();
395
- plugin.configResolved({ command: "serve", mode: "staging", server: {}, build: { outDir: "/dist" } });
439
+ plugin.configResolved({
440
+ command: "serve",
441
+ mode: "staging",
442
+ server: {},
443
+ build: { outDir: "/dist" },
444
+ });
396
445
  await plugin.buildStart();
397
446
 
398
447
  let [file, content] = (fs.writeFileSync as unknown as Mock).mock.calls[0];
@@ -411,12 +460,18 @@ describe("buildStart", () => {
411
460
  `;
412
461
  }
413
462
  });
414
- vi.spyOn(glob, "glob").mockImplementation(() => Promise.resolve(["my-component.tsx"]));
463
+ vi.spyOn(glob, "glob").mockImplementation(() =>
464
+ Promise.resolve(["my-component.tsx"])
465
+ );
415
466
  vi.spyOn(path, "resolve").mockImplementation((_, file) => file);
416
467
  vi.spyOn(fs, "writeFileSync");
417
468
 
418
469
  const plugin = ApplicationManifestPlugin();
419
- plugin.configResolved({ command: "serve", server: { https: {}, port: "5678" }, build: { outDir: "/dist" } });
470
+ plugin.configResolved({
471
+ command: "serve",
472
+ server: { https: {}, port: "5678" },
473
+ build: { outDir: "/dist" },
474
+ });
420
475
  await plugin.buildStart();
421
476
 
422
477
  let [file, content] = (fs.writeFileSync as unknown as Mock).mock.calls[0];
@@ -435,7 +490,9 @@ describe("buildStart", () => {
435
490
  `;
436
491
  }
437
492
  });
438
- vi.spyOn(glob, "glob").mockImplementation(() => Promise.resolve(["my-component.tsx"]));
493
+ vi.spyOn(glob, "glob").mockImplementation(() =>
494
+ Promise.resolve(["my-component.tsx"])
495
+ );
439
496
  vi.spyOn(path, "resolve").mockImplementation((_, file) => file);
440
497
  vi.spyOn(fs, "writeFileSync");
441
498
 
@@ -463,14 +520,18 @@ describe("buildStart", () => {
463
520
  `;
464
521
  }
465
522
  });
466
- vi.spyOn(glob, "glob").mockImplementation(() => Promise.resolve(["my-component.tsx"]));
523
+ vi.spyOn(glob, "glob").mockImplementation(() =>
524
+ Promise.resolve(["my-component.tsx"])
525
+ );
467
526
  vi.spyOn(path, "resolve").mockImplementation((_, file) => file);
468
527
  vi.spyOn(fs, "writeFileSync");
469
528
 
470
529
  const plugin = ApplicationManifestPlugin();
471
530
  plugin.configResolved({ command: "serve", server: {} });
472
531
 
473
- await expect(async () => await plugin.buildStart()).rejects.toThrowErrorMatchingInlineSnapshot(
532
+ await expect(
533
+ async () => await plugin.buildStart()
534
+ ).rejects.toThrowErrorMatchingInlineSnapshot(
474
535
  `[Error: 'name' argument must be supplied for @tool]`
475
536
  );
476
537
  });
@@ -485,14 +546,18 @@ describe("buildStart", () => {
485
546
  `;
486
547
  }
487
548
  });
488
- vi.spyOn(glob, "glob").mockImplementation(() => Promise.resolve(["my-component.tsx"]));
549
+ vi.spyOn(glob, "glob").mockImplementation(() =>
550
+ Promise.resolve(["my-component.tsx"])
551
+ );
489
552
  vi.spyOn(path, "resolve").mockImplementation((_, file) => file);
490
553
  vi.spyOn(fs, "writeFileSync");
491
554
 
492
555
  const plugin = ApplicationManifestPlugin();
493
556
  plugin.configResolved({ command: "serve", server: {} });
494
557
 
495
- await expect(async () => await plugin.buildStart()).rejects.toThrowErrorMatchingInlineSnapshot(
558
+ await expect(
559
+ async () => await plugin.buildStart()
560
+ ).rejects.toThrowErrorMatchingInlineSnapshot(
496
561
  `[Error: 'description' argument must be supplied for @tool]`
497
562
  );
498
563
  });
@@ -507,14 +572,18 @@ describe("buildStart", () => {
507
572
  `;
508
573
  }
509
574
  });
510
- vi.spyOn(glob, "glob").mockImplementation(() => Promise.resolve(["my-component.tsx"]));
575
+ vi.spyOn(glob, "glob").mockImplementation(() =>
576
+ Promise.resolve(["my-component.tsx"])
577
+ );
511
578
  vi.spyOn(path, "resolve").mockImplementation((_, file) => file);
512
579
  vi.spyOn(fs, "writeFileSync");
513
580
 
514
581
  const plugin = ApplicationManifestPlugin();
515
582
  plugin.configResolved({ command: "serve", server: {} });
516
583
 
517
- await expect(async () => await plugin.buildStart()).rejects.toThrowErrorMatchingInlineSnapshot(
584
+ await expect(
585
+ async () => await plugin.buildStart()
586
+ ).rejects.toThrowErrorMatchingInlineSnapshot(
518
587
  `[Error: Expected argument 'name' to be of type 'StringValue' but found 'BooleanValue' instead.]`
519
588
  );
520
589
  });
@@ -529,14 +598,18 @@ describe("buildStart", () => {
529
598
  `;
530
599
  }
531
600
  });
532
- vi.spyOn(glob, "glob").mockImplementation(() => Promise.resolve(["my-component.tsx"]));
601
+ vi.spyOn(glob, "glob").mockImplementation(() =>
602
+ Promise.resolve(["my-component.tsx"])
603
+ );
533
604
  vi.spyOn(path, "resolve").mockImplementation((_, file) => file);
534
605
  vi.spyOn(fs, "writeFileSync");
535
606
 
536
607
  const plugin = ApplicationManifestPlugin();
537
608
  plugin.configResolved({ command: "serve", server: {} });
538
609
 
539
- await expect(async () => await plugin.buildStart()).rejects.toThrowErrorMatchingInlineSnapshot(
610
+ await expect(
611
+ async () => await plugin.buildStart()
612
+ ).rejects.toThrowErrorMatchingInlineSnapshot(
540
613
  `[Error: Expected argument 'description' to be of type 'StringValue' but found 'BooleanValue' instead.]`
541
614
  );
542
615
  });
@@ -551,14 +624,18 @@ describe("buildStart", () => {
551
624
  `;
552
625
  }
553
626
  });
554
- vi.spyOn(glob, "glob").mockImplementation(() => Promise.resolve(["my-component.tsx"]));
627
+ vi.spyOn(glob, "glob").mockImplementation(() =>
628
+ Promise.resolve(["my-component.tsx"])
629
+ );
555
630
  vi.spyOn(path, "resolve").mockImplementation((_, file) => file);
556
631
  vi.spyOn(fs, "writeFileSync");
557
632
 
558
633
  const plugin = ApplicationManifestPlugin();
559
634
  plugin.configResolved({ command: "serve", server: {} });
560
635
 
561
- await expect(async () => await plugin.buildStart()).rejects.toThrowErrorMatchingInlineSnapshot(
636
+ await expect(
637
+ async () => await plugin.buildStart()
638
+ ).rejects.toThrowErrorMatchingInlineSnapshot(
562
639
  `[Error: Expected argument 'extraInputs' to be of type 'ListValue' but found 'BooleanValue' instead.]`
563
640
  );
564
641
  });
@@ -575,14 +652,18 @@ describe("buildStart", () => {
575
652
  `;
576
653
  }
577
654
  });
578
- vi.spyOn(glob, "glob").mockImplementation(() => Promise.resolve(["my-component.tsx"]));
655
+ vi.spyOn(glob, "glob").mockImplementation(() =>
656
+ Promise.resolve(["my-component.tsx"])
657
+ );
579
658
  vi.spyOn(path, "resolve").mockImplementation((_, file) => file);
580
659
  vi.spyOn(fs, "writeFileSync");
581
660
 
582
661
  const plugin = ApplicationManifestPlugin();
583
662
  plugin.configResolved({ command: "serve", server: {} });
584
663
 
585
- await expect(async () => await plugin.buildStart()).rejects.toThrowErrorMatchingInlineSnapshot(
664
+ await expect(
665
+ async () => await plugin.buildStart()
666
+ ).rejects.toThrowErrorMatchingInlineSnapshot(
586
667
  `[Error: Error when parsing directive values: unexpected type 'FloatValue']`
587
668
  );
588
669
  });
@@ -608,11 +689,17 @@ describe("buildStart", () => {
608
689
  `;
609
690
  }
610
691
  });
611
- vi.spyOn(glob, "glob").mockImplementation(() => Promise.resolve(["my-component.tsx"]));
692
+ vi.spyOn(glob, "glob").mockImplementation(() =>
693
+ Promise.resolve(["my-component.tsx"])
694
+ );
612
695
  vi.spyOn(fs, "writeFileSync");
613
696
 
614
697
  const plugin = ApplicationManifestPlugin();
615
- plugin.configResolved({ command: "serve", server: {}, build: { outDir: "/dist" } });
698
+ plugin.configResolved({
699
+ command: "serve",
700
+ server: {},
701
+ build: { outDir: "/dist" },
702
+ });
616
703
  await plugin.buildStart();
617
704
  let [file, content] = (fs.writeFileSync as unknown as Mock).mock.calls[0];
618
705
 
@@ -692,13 +779,20 @@ describe("writeBundle", () => {
692
779
  `;
693
780
  }
694
781
  });
695
- vi.spyOn(glob, "glob").mockImplementation(() => Promise.resolve(["my-component.tsx"]));
782
+ vi.spyOn(glob, "glob").mockImplementation(() =>
783
+ Promise.resolve(["my-component.tsx"])
784
+ );
696
785
  vi.spyOn(path, "resolve").mockImplementation((_, file) => file);
697
786
  vi.spyOn(path, "dirname").mockImplementation(() => "/dist");
698
787
  vi.spyOn(fs, "writeFileSync");
699
788
 
700
789
  const plugin = ApplicationManifestPlugin();
701
- plugin.configResolved({ command: "build", mode: "staging", server: {}, build: { outDir: "/dist/" } });
790
+ plugin.configResolved({
791
+ command: "build",
792
+ mode: "staging",
793
+ server: {},
794
+ build: { outDir: "/dist/" },
795
+ });
702
796
  await plugin.buildStart();
703
797
  await plugin.writeBundle();
704
798
 
@@ -718,13 +812,20 @@ describe("writeBundle", () => {
718
812
  `;
719
813
  }
720
814
  });
721
- vi.spyOn(glob, "glob").mockImplementation(() => Promise.resolve(["my-component.tsx"]));
815
+ vi.spyOn(glob, "glob").mockImplementation(() =>
816
+ Promise.resolve(["my-component.tsx"])
817
+ );
722
818
  vi.spyOn(path, "resolve").mockImplementation((_, file) => file);
723
819
  vi.spyOn(path, "dirname").mockImplementation(() => "/dist");
724
820
  vi.spyOn(fs, "writeFileSync");
725
821
 
726
822
  const plugin = ApplicationManifestPlugin();
727
- plugin.configResolved({ command: "build", mode: "production", server: {}, build: { outDir: "/dist/" } });
823
+ plugin.configResolved({
824
+ command: "build",
825
+ mode: "production",
826
+ server: {},
827
+ build: { outDir: "/dist/" },
828
+ });
728
829
  await plugin.buildStart();
729
830
  await plugin.writeBundle();
730
831
 
@@ -744,16 +845,25 @@ describe("writeBundle", () => {
744
845
  `;
745
846
  }
746
847
  });
747
- vi.spyOn(glob, "glob").mockImplementation(() => Promise.resolve(["my-component.tsx"]));
848
+ vi.spyOn(glob, "glob").mockImplementation(() =>
849
+ Promise.resolve(["my-component.tsx"])
850
+ );
748
851
  vi.spyOn(path, "resolve").mockImplementation((_, file) => file);
749
852
  vi.spyOn(path, "dirname").mockImplementation(() => "/dist");
750
853
  vi.spyOn(fs, "writeFileSync");
751
854
 
752
855
  const plugin = ApplicationManifestPlugin();
753
- plugin.configResolved({ command: "build", mode: "staging", server: {}, build: { outDir: "/dist/" } });
856
+ plugin.configResolved({
857
+ command: "build",
858
+ mode: "staging",
859
+ server: {},
860
+ build: { outDir: "/dist/" },
861
+ });
754
862
  await plugin.buildStart();
755
863
 
756
- await expect(async () => await plugin.writeBundle()).rejects.toThrowErrorMatchingInlineSnapshot(
864
+ await expect(
865
+ async () => await plugin.writeBundle()
866
+ ).rejects.toThrowErrorMatchingInlineSnapshot(
757
867
  `[Error: No entry point found for mode "staging". Entry points other than "development" and "production" must be defined in package.json file.]`
758
868
  );
759
869
  });
@@ -768,13 +878,20 @@ describe("writeBundle", () => {
768
878
  `;
769
879
  }
770
880
  });
771
- vi.spyOn(glob, "glob").mockImplementation(() => Promise.resolve(["my-component.tsx"]));
881
+ vi.spyOn(glob, "glob").mockImplementation(() =>
882
+ Promise.resolve(["my-component.tsx"])
883
+ );
772
884
  vi.spyOn(path, "resolve").mockImplementation((_, file) => file);
773
885
  vi.spyOn(path, "dirname").mockImplementation(() => "/dist");
774
886
  vi.spyOn(fs, "writeFileSync");
775
887
 
776
888
  const plugin = ApplicationManifestPlugin();
777
- plugin.configResolved({ command: "build", mode: "production", server: {}, build: { outDir: "/dist/" } });
889
+ plugin.configResolved({
890
+ command: "build",
891
+ mode: "production",
892
+ server: {},
893
+ build: { outDir: "/dist/" },
894
+ });
778
895
  await plugin.buildStart();
779
896
  await plugin.writeBundle();
780
897
 
@@ -797,7 +914,9 @@ describe("configureServer", () => {
797
914
  `;
798
915
  }
799
916
  });
800
- vi.spyOn(glob, "glob").mockImplementation(() => Promise.resolve(["my-component.tsx"]));
917
+ vi.spyOn(glob, "glob").mockImplementation(() =>
918
+ Promise.resolve(["my-component.tsx"])
919
+ );
801
920
  vi.spyOn(path, "resolve").mockImplementation((_, file) => file);
802
921
  vi.spyOn(fs, "writeFileSync");
803
922
 
@@ -819,7 +938,11 @@ describe("configureServer", () => {
819
938
  server.watcher.init();
820
939
 
821
940
  const plugin = ApplicationManifestPlugin();
822
- plugin.configResolved({ command: "serve", server: {}, build: { outDir: "/dist" } });
941
+ plugin.configResolved({
942
+ command: "serve",
943
+ server: {},
944
+ build: { outDir: "/dist" },
945
+ });
823
946
  await plugin.buildStart();
824
947
  await plugin.configureServer(server);
825
948
  await server.watcher.trigger("package.json");