@apollo/client-ai-apps 0.3.2 → 0.3.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.
Files changed (140) hide show
  1. package/.github/workflows/pr.yaml +52 -3
  2. package/.github/workflows/prep-release.yml +38 -0
  3. package/.github/workflows/release.yaml +8 -4
  4. package/.github/workflows/verify-changeset.yml +58 -0
  5. package/CHANGELOG.md +25 -0
  6. package/dist/core/ApolloClient.d.ts +3 -2
  7. package/dist/core/ApolloClient.d.ts.map +1 -0
  8. package/dist/core/ApolloClient.js +65 -0
  9. package/dist/core/ApolloClient.js.map +1 -0
  10. package/dist/index.d.ts +18 -17
  11. package/dist/index.d.ts.map +1 -0
  12. package/dist/index.js +16 -278
  13. package/dist/index.js.map +1 -0
  14. package/dist/link/ToolCallLink.d.ts +1 -0
  15. package/dist/link/ToolCallLink.d.ts.map +1 -0
  16. package/dist/link/ToolCallLink.js +39 -0
  17. package/dist/link/ToolCallLink.js.map +1 -0
  18. package/dist/react/ApolloProvider.d.ts +4 -3
  19. package/dist/react/ApolloProvider.d.ts.map +1 -0
  20. package/dist/react/ApolloProvider.js +30 -0
  21. package/dist/react/ApolloProvider.js.map +1 -0
  22. package/dist/react/context/ToolUseContext.d.ts +4 -3
  23. package/dist/react/context/ToolUseContext.d.ts.map +1 -0
  24. package/dist/react/context/ToolUseContext.js +11 -0
  25. package/dist/react/context/ToolUseContext.js.map +1 -0
  26. package/dist/react/hooks/useCallTool.d.ts +4 -0
  27. package/dist/react/hooks/useCallTool.d.ts.map +1 -0
  28. package/dist/react/hooks/useCallTool.js +5 -0
  29. package/dist/react/hooks/useCallTool.js.map +1 -0
  30. package/dist/react/hooks/useOpenAiGlobal.d.ts +2 -1
  31. package/dist/react/hooks/useOpenAiGlobal.d.ts.map +1 -0
  32. package/dist/react/hooks/useOpenAiGlobal.js +20 -0
  33. package/dist/react/hooks/useOpenAiGlobal.js.map +1 -0
  34. package/dist/react/hooks/useOpenExternal.d.ts +1 -0
  35. package/dist/react/hooks/useOpenExternal.d.ts.map +1 -0
  36. package/dist/react/hooks/useOpenExternal.js +5 -0
  37. package/dist/react/hooks/useOpenExternal.js.map +1 -0
  38. package/dist/react/hooks/useRequestDisplayMode.d.ts +2 -1
  39. package/dist/react/hooks/useRequestDisplayMode.d.ts.map +1 -0
  40. package/dist/react/hooks/useRequestDisplayMode.js +6 -0
  41. package/dist/react/hooks/useRequestDisplayMode.js.map +1 -0
  42. package/dist/react/hooks/useSendFollowUpMessage.d.ts +1 -0
  43. package/dist/react/hooks/useSendFollowUpMessage.d.ts.map +1 -0
  44. package/dist/react/hooks/useSendFollowUpMessage.js +8 -0
  45. package/dist/react/hooks/useSendFollowUpMessage.js.map +1 -0
  46. package/dist/react/hooks/useToolEffect.d.ts +1 -0
  47. package/dist/react/hooks/useToolEffect.d.ts.map +1 -0
  48. package/dist/react/hooks/useToolEffect.js +28 -0
  49. package/dist/react/hooks/useToolEffect.js.map +1 -0
  50. package/dist/react/hooks/useToolInput.d.ts +1 -0
  51. package/dist/react/hooks/useToolInput.d.ts.map +1 -0
  52. package/dist/react/hooks/useToolInput.js +6 -0
  53. package/dist/react/hooks/useToolInput.js.map +1 -0
  54. package/dist/react/hooks/useToolName.d.ts +1 -0
  55. package/dist/react/hooks/useToolName.d.ts.map +1 -0
  56. package/dist/react/hooks/useToolName.js +6 -0
  57. package/dist/react/hooks/useToolName.js.map +1 -0
  58. package/dist/react/hooks/useToolOutput.d.ts +2 -1
  59. package/dist/react/hooks/useToolOutput.d.ts.map +1 -0
  60. package/dist/react/hooks/useToolOutput.js +5 -0
  61. package/dist/react/hooks/useToolOutput.js.map +1 -0
  62. package/dist/react/hooks/useToolResponseMetadata.d.ts +2 -1
  63. package/dist/react/hooks/useToolResponseMetadata.d.ts.map +1 -0
  64. package/dist/react/hooks/useToolResponseMetadata.js +5 -0
  65. package/dist/react/hooks/useToolResponseMetadata.js.map +1 -0
  66. package/dist/react/hooks/useWidgetState.d.ts +3 -2
  67. package/dist/react/hooks/useWidgetState.d.ts.map +1 -0
  68. package/dist/react/hooks/useWidgetState.js +27 -0
  69. package/dist/react/hooks/useWidgetState.js.map +1 -0
  70. package/dist/types/application-manifest.d.ts +7 -0
  71. package/dist/types/application-manifest.d.ts.map +1 -0
  72. package/dist/types/application-manifest.js +2 -0
  73. package/dist/types/application-manifest.js.map +1 -0
  74. package/dist/types/openai.d.ts +1 -0
  75. package/dist/types/openai.d.ts.map +1 -0
  76. package/dist/types/openai.js +6 -0
  77. package/dist/types/openai.js.map +1 -0
  78. package/dist/vite/absolute_asset_imports_plugin.d.ts +1 -0
  79. package/dist/vite/absolute_asset_imports_plugin.d.ts.map +1 -0
  80. package/dist/vite/absolute_asset_imports_plugin.js +17 -0
  81. package/dist/vite/absolute_asset_imports_plugin.js.map +1 -0
  82. package/dist/vite/application_manifest_plugin.d.ts +2 -1
  83. package/dist/vite/application_manifest_plugin.d.ts.map +1 -0
  84. package/dist/vite/application_manifest_plugin.js +274 -0
  85. package/dist/vite/application_manifest_plugin.js.map +1 -0
  86. package/dist/vite/index.d.ts +3 -2
  87. package/dist/vite/index.d.ts.map +1 -0
  88. package/dist/vite/index.js +3 -307
  89. package/dist/vite/index.js.map +1 -0
  90. package/knope.toml +63 -0
  91. package/package.json +15 -8
  92. package/src/core/ApolloClient.ts +10 -5
  93. package/src/core/__tests__/ApolloClient.test.ts +12 -9
  94. package/src/index.ts +17 -17
  95. package/src/react/ApolloProvider.tsx +4 -3
  96. package/src/react/__tests__/ApolloProvider.test.tsx +3 -3
  97. package/src/react/context/ToolUseContext.tsx +2 -1
  98. package/src/react/hooks/__tests__/useCallTool.test.ts +1 -1
  99. package/src/react/hooks/__tests__/useOpenAiGlobal.test.ts +6 -6
  100. package/src/react/hooks/__tests__/useOpenExternal.test.tsx +2 -2
  101. package/src/react/hooks/__tests__/useRequestDisplayMode.test.ts +2 -2
  102. package/src/react/hooks/__tests__/useSendFollowUpMessage.test.ts +1 -1
  103. package/src/react/hooks/__tests__/useToolEffect.test.tsx +2 -2
  104. package/src/react/hooks/__tests__/useToolInput.test.ts +1 -1
  105. package/src/react/hooks/__tests__/useToolName.test.ts +1 -1
  106. package/src/react/hooks/__tests__/useToolOutput.test.tsx +2 -2
  107. package/src/react/hooks/__tests__/useToolResponseMetadata.test.tsx +2 -2
  108. package/src/react/hooks/__tests__/useWidgetState.test.tsx +2 -2
  109. package/src/react/hooks/useOpenAiGlobal.ts +2 -5
  110. package/src/react/hooks/useOpenExternal.ts +1 -1
  111. package/src/react/hooks/useRequestDisplayMode.ts +1 -1
  112. package/src/react/hooks/useToolEffect.tsx +3 -3
  113. package/src/react/hooks/useToolInput.ts +1 -1
  114. package/src/react/hooks/useToolName.ts +1 -1
  115. package/src/react/hooks/useToolOutput.ts +1 -1
  116. package/src/react/hooks/useToolResponseMetadata.ts +1 -1
  117. package/src/react/hooks/useWidgetState.ts +4 -3
  118. package/src/testing/internal/index.ts +2 -2
  119. package/src/testing/internal/matchers/index.ts +1 -1
  120. package/src/testing/internal/matchers/toRerender.ts +2 -2
  121. package/src/testing/internal/matchers/{index.d.ts → types.ts} +1 -1
  122. package/src/testing/internal/openai/dispatchStateChange.ts +1 -1
  123. package/src/testing/internal/openai/stubOpenAiGlobals.ts +6 -2
  124. package/src/types/application-manifest.ts +7 -0
  125. package/src/vite/__tests__/absolute_asset_imports_plugin.test.ts +2 -2
  126. package/src/vite/__tests__/application_manifest_plugin.test.ts +299 -240
  127. package/src/vite/application_manifest_plugin.ts +160 -96
  128. package/src/vite/index.ts +2 -2
  129. package/tsconfig.base.build.json +13 -0
  130. package/tsconfig.base.json +21 -0
  131. package/tsconfig.config.json +9 -0
  132. package/tsconfig.json +10 -0
  133. package/tsconfig.src.build.json +14 -0
  134. package/tsconfig.src.json +17 -0
  135. package/tsconfig.test.json +20 -0
  136. package/tsconfig.vite.build.json +6 -0
  137. package/tsconfig.vite.json +16 -0
  138. package/scripts/build-vite.mjs +0 -18
  139. package/scripts/build.mjs +0 -7
  140. package/scripts/shared.mjs +0 -9
@@ -2,27 +2,32 @@ import { readFileSync, writeFileSync, mkdirSync } from "fs";
2
2
  import { glob } from "glob";
3
3
  import { gqlPluckFromCodeStringSync } from "@graphql-tools/graphql-tag-pluck";
4
4
  import { createHash } from "crypto";
5
- import {
5
+ import type {
6
6
  ArgumentNode,
7
- Kind,
8
7
  ListTypeNode,
9
8
  NamedTypeNode,
10
9
  NonNullTypeNode,
11
- parse,
12
- print,
13
10
  TypeNode,
14
11
  ValueNode,
15
- visit,
16
- type DocumentNode,
17
- type OperationDefinitionNode,
12
+ DocumentNode,
13
+ OperationDefinitionNode,
14
+ DirectiveNode,
18
15
  } from "graphql";
16
+ import { Kind, parse, print } from "graphql";
19
17
  import { ApolloClient, ApolloLink, InMemoryCache } from "@apollo/client";
20
- import Observable from "rxjs";
18
+ import { removeDirectivesFromDocument } from "@apollo/client/utilities/internal";
19
+ import { of } from "rxjs";
21
20
  import path from "path";
21
+ import type {
22
+ ApplicationManifest,
23
+ ManifestExtraInput,
24
+ ManifestTool,
25
+ ManifestWidgetSettings,
26
+ } from "../types/application-manifest.js";
22
27
 
23
28
  const root = process.cwd();
24
29
 
25
- const getRawValue = (node: ValueNode): any => {
30
+ function getRawValue(node: ValueNode): unknown {
26
31
  switch (node.kind) {
27
32
  case Kind.STRING:
28
33
  case Kind.BOOLEAN:
@@ -39,33 +44,71 @@ const getRawValue = (node: ValueNode): any => {
39
44
  `Error when parsing directive values: unexpected type '${node.kind}'`
40
45
  );
41
46
  }
42
- };
47
+ }
48
+
49
+ function getArgumentValue(
50
+ argument: ArgumentNode,
51
+ expectedType: Kind.STRING
52
+ ): string;
53
+
54
+ function getArgumentValue(
55
+ argument: ArgumentNode,
56
+ expectedType: Kind.BOOLEAN
57
+ ): boolean;
58
+
59
+ function getArgumentValue(
60
+ argument: ArgumentNode,
61
+ expectedType: Kind.LIST
62
+ ): unknown[];
43
63
 
44
- const getTypedDirectiveArgument = (
64
+ function getArgumentValue(
65
+ argument: ArgumentNode,
66
+ expectedType: Kind.OBJECT
67
+ ): Record<string, unknown>;
68
+
69
+ function getArgumentValue(argument: ArgumentNode, expectedType: Kind) {
70
+ const argumentType = argument.value.kind;
71
+
72
+ invariant(
73
+ argumentType === expectedType,
74
+ `Expected argument '${argument.name.value}' to be of type '${expectedType}' but found '${argumentType}' instead.`
75
+ );
76
+
77
+ return getRawValue(argument.value);
78
+ }
79
+
80
+ interface GetArgumentNodeOptions {
81
+ required?: boolean;
82
+ }
83
+
84
+ function getDirectiveArgument(
45
85
  argumentName: string,
46
- expectedType: Kind,
47
- directiveArguments: readonly ArgumentNode[] | undefined
48
- ) => {
49
- if (!directiveArguments || directiveArguments.length === 0) {
50
- return undefined;
51
- }
86
+ directive: DirectiveNode,
87
+ opts: GetArgumentNodeOptions & { required: true }
88
+ ): ArgumentNode;
52
89
 
53
- let argument = directiveArguments.find(
90
+ function getDirectiveArgument(
91
+ argumentName: string,
92
+ directive: DirectiveNode,
93
+ opts?: GetArgumentNodeOptions
94
+ ): ArgumentNode | undefined;
95
+
96
+ function getDirectiveArgument(
97
+ argumentName: string,
98
+ directive: DirectiveNode,
99
+ { required = false }: { required?: boolean } = {}
100
+ ) {
101
+ const argument = directive.arguments?.find(
54
102
  (directiveArgument) => directiveArgument.name.value === argumentName
55
103
  );
56
104
 
57
- if (!argument) {
58
- return undefined;
59
- }
60
-
61
- if (argument.value.kind != expectedType) {
62
- throw new Error(
63
- `Expected argument '${argumentName}' to be of type '${expectedType}' but found '${argument.value.kind}' instead.`
64
- );
65
- }
105
+ invariant(
106
+ argument || !required,
107
+ `'${argumentName}' argument must be supplied for @tool`
108
+ );
66
109
 
67
- return getRawValue(argument.value);
68
- };
110
+ return argument;
111
+ }
69
112
 
70
113
  function getTypeName(type: TypeNode): string {
71
114
  let t = type;
@@ -88,78 +131,73 @@ export const ApplicationManifestPlugin = () => {
88
131
  removeClientDirective(sortTopLevelDefinitions(operation.query))
89
132
  );
90
133
  const name = operation.operationName;
91
- const variables = (
92
- operation.query.definitions.find(
93
- (d) => d.kind === "OperationDefinition"
94
- ) as OperationDefinitionNode
95
- ).variableDefinitions?.reduce(
134
+ const definition = operation.query.definitions.find(
135
+ (d) => d.kind === "OperationDefinition"
136
+ );
137
+
138
+ // Use `operation.query` so that the error reflects the end-user defined
139
+ // document, not our sorted one
140
+ invariant(
141
+ definition,
142
+ `Document does not contain an operation:\n${print(operation.query)}`
143
+ );
144
+
145
+ const { directives, operation: type } = definition;
146
+
147
+ const variables = definition.variableDefinitions?.reduce(
96
148
  (obj, varDef) => ({
97
149
  ...obj,
98
150
  [varDef.variable.name.value]: getTypeName(varDef.type),
99
151
  }),
100
152
  {}
101
153
  );
102
- const type = (
103
- operation.query.definitions.find(
104
- (d) => d.kind === "OperationDefinition"
105
- ) as OperationDefinitionNode
106
- ).operation;
107
- const prefetch = (
108
- operation.query.definitions.find(
109
- (d) => d.kind === "OperationDefinition"
110
- ) as OperationDefinitionNode
111
- ).directives?.some((d) => d.name.value === "prefetch");
154
+
155
+ const prefetch = directives?.some((d) => d.name.value === "prefetch");
112
156
  const id = createHash("sha256").update(body).digest("hex");
113
157
  // TODO: For now, you can only have 1 operation marked as prefetch. In the future, we'll likely support more than 1, and the "prefetchId" will be defined on the `@prefetch` itself as an argument
114
158
  const prefetchID = prefetch ? "__anonymous" : undefined;
115
159
 
116
- const tools = (
117
- operation.query.definitions.find(
118
- (d) => d.kind === "OperationDefinition"
119
- ) as OperationDefinitionNode
120
- ).directives
160
+ const tools = directives
121
161
  ?.filter((d) => d.name.value === "tool")
122
162
  .map((directive) => {
123
- const name = getTypedDirectiveArgument(
124
- "name",
125
- Kind.STRING,
126
- directive.arguments
127
- );
128
- const description = getTypedDirectiveArgument(
129
- "description",
130
- Kind.STRING,
131
- directive.arguments
132
- );
133
- const extraInputs = getTypedDirectiveArgument(
134
- "extraInputs",
135
- Kind.LIST,
136
- directive.arguments
163
+ const name = getArgumentValue(
164
+ getDirectiveArgument("name", directive, { required: true }),
165
+ Kind.STRING
137
166
  );
138
167
 
139
- if (!name) {
140
- throw new Error("'name' argument must be supplied for @tool");
141
- }
168
+ invariant(
169
+ name.indexOf(" ") === -1,
170
+ `Tool with name "${name}" contains spaces which is not allowed.`
171
+ );
142
172
 
143
- if (name.indexOf(" ") > -1) {
144
- throw new Error(
145
- `Tool with name "${name}" contains spaces which is not allowed.`
146
- );
147
- }
173
+ const description = getArgumentValue(
174
+ getDirectiveArgument("description", directive, { required: true }),
175
+ Kind.STRING
176
+ );
148
177
 
149
- if (!description) {
150
- throw new Error(
151
- "'description' argument must be supplied for @tool"
152
- );
153
- }
178
+ const extraInputsNode = getDirectiveArgument(
179
+ "extraInputs",
180
+ directive
181
+ );
154
182
 
155
- return {
183
+ const toolOptions: ManifestTool = {
156
184
  name,
157
185
  description,
158
- extraInputs,
159
186
  };
187
+
188
+ if (extraInputsNode) {
189
+ toolOptions.extraInputs = getArgumentValue(
190
+ extraInputsNode,
191
+ Kind.LIST
192
+ ) as ManifestExtraInput[];
193
+ }
194
+
195
+ return toolOptions;
160
196
  });
161
197
 
162
- return Observable.of({
198
+ // TODO: Make this object satisfy the `ManifestOperation` type. Currently
199
+ // it errors because we need more validation on a few of these fields
200
+ return of({
163
201
  data: { id, name, type, body, variables, prefetch, prefetchID, tools },
164
202
  });
165
203
  }),
@@ -172,7 +210,7 @@ export const ApplicationManifestPlugin = () => {
172
210
 
173
211
  const fileHash = createHash("md5").update(code).digest("hex");
174
212
  if (cache.get("file")?.hash === fileHash) return;
175
- const sources = await gqlPluckFromCodeStringSync(file, code, {
213
+ const sources = gqlPluckFromCodeStringSync(file, code, {
176
214
  modules: [
177
215
  { name: "graphql-tag", identifier: "gql" },
178
216
  { name: "@apollo/client", identifier: "gql" },
@@ -221,11 +259,11 @@ export const ApplicationManifestPlugin = () => {
221
259
  const operations = Array.from(cache.values()).flatMap(
222
260
  (entry) => entry.operations
223
261
  );
224
- if (operations.filter((o) => o.prefetch).length > 1) {
225
- throw new Error(
226
- "Found multiple operations marked as `@prefetch`. You can only mark 1 operation with `@prefetch`."
227
- );
228
- }
262
+
263
+ invariant(
264
+ operations.filter((o) => o.prefetch).length <= 1,
265
+ "Found multiple operations marked as `@prefetch`. You can only mark 1 operation with `@prefetch`."
266
+ );
229
267
 
230
268
  let resource = "";
231
269
  if (config.command === "serve") {
@@ -245,7 +283,7 @@ export const ApplicationManifestPlugin = () => {
245
283
  }
246
284
  }
247
285
 
248
- const manifest = {
286
+ const manifest: ApplicationManifest = {
249
287
  format: "apollo-ai-app-manifest",
250
288
  version: "1",
251
289
  name: packageJson.name,
@@ -261,6 +299,32 @@ export const ApplicationManifestPlugin = () => {
261
299
  },
262
300
  };
263
301
 
302
+ if (
303
+ packageJson.widgetSettings &&
304
+ Object.keys(packageJson.widgetSettings).length > 0
305
+ ) {
306
+ function validateWidgetSetting(
307
+ key: keyof ManifestWidgetSettings,
308
+ type: "string" | "boolean"
309
+ ) {
310
+ if (key in widgetSettings) {
311
+ invariant(
312
+ typeof widgetSettings[key] === type,
313
+ `Expected 'widgetSettings.${key}' to be of type '${type}' but found '${typeof widgetSettings[key]}' instead.`
314
+ );
315
+ }
316
+ }
317
+
318
+ const widgetSettings =
319
+ packageJson.widgetSettings as ManifestWidgetSettings;
320
+
321
+ validateWidgetSetting("prefersBorder", "boolean");
322
+ validateWidgetSetting("description", "string");
323
+ validateWidgetSetting("domain", "string");
324
+
325
+ manifest.widgetSettings = packageJson.widgetSettings;
326
+ }
327
+
264
328
  // Always write to build directory so the MCP server picks it up
265
329
  const dest = path.resolve(
266
330
  root,
@@ -366,14 +430,14 @@ export function sortTopLevelDefinitions(query: DocumentNode): DocumentNode {
366
430
  }
367
431
 
368
432
  function removeClientDirective(doc: DocumentNode) {
369
- return visit(doc, {
370
- OperationDefinition(node) {
371
- return {
372
- ...node,
373
- directives: node.directives?.filter(
374
- (d) => d.name.value !== "prefetch" && d.name.value !== "tool"
375
- ),
376
- };
377
- },
378
- });
433
+ return removeDirectivesFromDocument(
434
+ [{ name: "prefetch" }, { name: "tool" }],
435
+ doc
436
+ )!;
437
+ }
438
+
439
+ function invariant(condition: any, message: string): asserts condition {
440
+ if (!condition) {
441
+ throw new Error(message);
442
+ }
379
443
  }
package/src/vite/index.ts CHANGED
@@ -1,2 +1,2 @@
1
- export * from "./application_manifest_plugin";
2
- export * from "./absolute_asset_imports_plugin";
1
+ export * from "./application_manifest_plugin.js";
2
+ export * from "./absolute_asset_imports_plugin.js";
@@ -0,0 +1,13 @@
1
+ {
2
+ "$schema": "https://json.schemastore.org/tsconfig",
3
+ "extends": "./tsconfig.base.json",
4
+ "compilerOptions": {
5
+ "noEmit": false,
6
+ "rootDir": "./src",
7
+ "outDir": "./dist",
8
+ "inlineSources": true,
9
+ "sourceMap": true,
10
+ "declaration": true,
11
+ "declarationMap": true
12
+ }
13
+ }
@@ -0,0 +1,21 @@
1
+ {
2
+ "$schema": "https://json.schemastore.org/tsconfig",
3
+ "compilerOptions": {
4
+ "noImplicitAny": true,
5
+ "module": "nodenext",
6
+ "moduleResolution": "nodenext",
7
+ "target": "esnext",
8
+ "lib": ["esnext"],
9
+ "exactOptionalPropertyTypes": true,
10
+ "strict": true,
11
+ "jsx": "react-jsx",
12
+ "verbatimModuleSyntax": true,
13
+ "isolatedModules": true,
14
+ "importHelpers": true,
15
+ "noUncheckedSideEffectImports": true,
16
+ "noUnusedLocals": true,
17
+ "moduleDetection": "force",
18
+ "skipLibCheck": true,
19
+ "esModuleInterop": true
20
+ }
21
+ }
@@ -0,0 +1,9 @@
1
+ {
2
+ "$schema": "https://json.schemastore.org/tsconfig",
3
+ "extends": "./tsconfig.base.json",
4
+ "include": ["./vitest.config.ts"],
5
+ "compilerOptions": {
6
+ "rootDir": ".",
7
+ "composite": true
8
+ }
9
+ }
package/tsconfig.json ADDED
@@ -0,0 +1,10 @@
1
+ {
2
+ "$schema": "https://json.schemastore.org/tsconfig",
3
+ "files": [],
4
+ "references": [
5
+ { "path": "./tsconfig.config.json" },
6
+ { "path": "./tsconfig.src.json" },
7
+ { "path": "./tsconfig.test.json" },
8
+ { "path": "./tsconfig.vite.json" }
9
+ ]
10
+ }
@@ -0,0 +1,14 @@
1
+ {
2
+ "$schema": "https://json.schemastore.org/tsconfig",
3
+ "extends": "./tsconfig.base.build.json",
4
+ "include": ["./src"],
5
+ "exclude": [
6
+ "./src/**/*.test.ts",
7
+ "./src/**/*.test.tsx",
8
+ "./src/vite/",
9
+ "./src/testing/internal/"
10
+ ],
11
+ "compilerOptions": {
12
+ "lib": ["DOM"]
13
+ }
14
+ }
@@ -0,0 +1,17 @@
1
+ {
2
+ "$schema": "https://json.schemastore.org/tsconfig",
3
+ "extends": "./tsconfig.base.json",
4
+ "include": ["./src"],
5
+ "exclude": [
6
+ "./src/**/*.test.ts",
7
+ "./src/**/*.test.tsx",
8
+ "./src/vite/",
9
+ "./src/testing/internal/"
10
+ ],
11
+ "compilerOptions": {
12
+ "rootDir": "src",
13
+ "outDir": "dist",
14
+ "composite": true,
15
+ "lib": ["dom", "esnext"]
16
+ }
17
+ }
@@ -0,0 +1,20 @@
1
+ {
2
+ "$schema": "https://json.schemastore.org/tsconfig",
3
+ "extends": "./tsconfig.base.json",
4
+ "include": [
5
+ "./src/**/*.test.ts",
6
+ "./src/**/*.test.tsx",
7
+ "./src/testing/internal/"
8
+ ],
9
+ "references": [
10
+ { "path": "./tsconfig.src.json" },
11
+ { "path": "./tsconfig.vite.json" }
12
+ ],
13
+ "compilerOptions": {
14
+ "rootDir": "src",
15
+ "outDir": "dist",
16
+ "composite": true,
17
+ "lib": ["dom", "esnext"],
18
+ "types": ["node"]
19
+ }
20
+ }
@@ -0,0 +1,6 @@
1
+ {
2
+ "$schema": "https://json.schemastore.org/tsconfig",
3
+ "extends": "./tsconfig.base.build.json",
4
+ "include": ["./src/vite/"],
5
+ "exclude": ["**/*.test.ts", "**/*.test.tsx"]
6
+ }
@@ -0,0 +1,16 @@
1
+ {
2
+ "$schema": "https://json.schemastore.org/tsconfig",
3
+ "extends": "./tsconfig.base.json",
4
+ "include": ["./src/vite", "./src/types/application-manifest.ts"],
5
+ "exclude": [
6
+ "./src/**/*.test.ts",
7
+ "./src/**/*.test.tsx",
8
+ "./src/testing/internal/"
9
+ ],
10
+ "compilerOptions": {
11
+ "rootDir": "src",
12
+ "outDir": "dist",
13
+ "lib": ["esnext"],
14
+ "composite": true
15
+ }
16
+ }
@@ -1,18 +0,0 @@
1
- import * as esbuild from "esbuild";
2
-
3
- // Separately build Vite plugin
4
- await esbuild.build({
5
- entryPoints: ["src/vite/index.ts"],
6
- bundle: true,
7
- outdir: "dist/vite",
8
- platform: "node",
9
- format: "esm",
10
- external: [
11
- "glob",
12
- "@graphql-tools/graphql-tag-pluck",
13
- "@graphql-tools/graphql-tag-pluck",
14
- "graphql",
15
- "@apollo/client",
16
- "rxjs",
17
- ],
18
- });
package/scripts/build.mjs DELETED
@@ -1,7 +0,0 @@
1
- import * as esbuild from "esbuild";
2
- import { sharedConfig } from "./shared.mjs";
3
-
4
- // Build react components
5
- await esbuild.build({
6
- ...sharedConfig,
7
- });
@@ -1,9 +0,0 @@
1
- export const sharedConfig = {
2
- entryPoints: ["src/index.ts"],
3
- bundle: true,
4
- outdir: "dist",
5
- platform: "browser",
6
- format: "esm",
7
- packages: "external",
8
- external: ["react", "react-dom"],
9
- };