goatly 0.1.0 → 0.1.1
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 +853 -1
- package/bin/goatly.js +91 -0
- package/dist/cli/index.js +234 -0
- package/dist/compat/gatsby-node-entry.js +16 -0
- package/dist/compat/gatsby-package.json +6 -0
- package/dist/compat/md5-file.js +47 -0
- package/dist/compat-apis.json +72 -0
- package/dist/compat-apis.json.js +62 -0
- package/dist/graphql.js +3 -0
- package/dist/node/actions/index.js +619 -0
- package/dist/node/actions/job-store.js +180 -0
- package/dist/node/actions/jobs.js +174 -0
- package/dist/node/api-runner.js +258 -0
- package/dist/node/bootstrap.js +539 -0
- package/dist/node/build/assets.js +110 -0
- package/dist/node/build/incremental.js +208 -0
- package/dist/node/build/index.js +752 -0
- package/dist/node/build/memory-governor.js +448 -0
- package/dist/node/build/output-dirs.js +70 -0
- package/dist/node/build/page-data.js +40 -0
- package/dist/node/build/page-files.js +54 -0
- package/dist/node/build/partitioned-state.js +258 -0
- package/dist/node/build/query-worker.js +536 -0
- package/dist/node/build/query-workers.js +832 -0
- package/dist/node/build/render-worker.js +131 -0
- package/dist/node/build/state.js +24 -0
- package/dist/node/build/timing-breakdown.js +155 -0
- package/dist/node/build/worker-pool.js +236 -0
- package/dist/node/cache-layout.js +99 -0
- package/dist/node/cache.js +1430 -0
- package/dist/node/compat/chokidar-shim.js +148 -0
- package/dist/node/compat/core-utils-lmdb.js +145 -0
- package/dist/node/compat/create-node-id-shim.js +1 -0
- package/dist/node/compat/module-hooks.js +245 -0
- package/dist/node/compat/redux-shim.js +1 -0
- package/dist/node/config/index.js +162 -0
- package/dist/node/config/not-found-pages.js +95 -0
- package/dist/node/datastore/codec.js +144 -0
- package/dist/node/datastore/index.js +127 -0
- package/dist/node/datastore/logfile/cache.js +89 -0
- package/dist/node/datastore/logfile/index.js +1329 -0
- package/dist/node/datastore/logfile/record.js +71 -0
- package/dist/node/datastore/types.js +1 -0
- package/dist/node/develop/express-compat.js +207 -0
- package/dist/node/develop/graphiql.js +22 -0
- package/dist/node/develop/hydration-report.js +41 -0
- package/dist/node/develop/index.js +618 -0
- package/dist/node/develop/local-url.js +10 -0
- package/dist/node/develop/ssr-runner.js +66 -0
- package/dist/node/gql.js +5 -0
- package/dist/node/index.js +15 -0
- package/dist/node/info.js +270 -0
- package/dist/node/internal-plugins/data-bridge.js +196 -0
- package/dist/node/internal-plugins/page-creator.js +318 -0
- package/dist/node/loader/import-module.js +160 -0
- package/dist/node/node-helpers.js +66 -0
- package/dist/node/not-found-pages.js +220 -0
- package/dist/node/plugins/api-list.js +12 -0
- package/dist/node/plugins/load-plugins.js +427 -0
- package/dist/node/plugins/resolve-plugin.js +79 -0
- package/dist/node/plugins/static-exports.js +64 -0
- package/dist/node/query/compile.js +326 -0
- package/dist/node/query/dependencies.js +45 -0
- package/dist/node/query/execute.js +417 -0
- package/dist/node/query/extract.js +372 -0
- package/dist/node/query/gql-tada-introspection.js +124 -0
- package/dist/node/query/graphql-env.js +231 -0
- package/dist/node/query/graphql-runner.js +79 -0
- package/dist/node/redux/actions.js +1 -0
- package/dist/node/redux/index.js +133 -0
- package/dist/node/redux/node-changes.js +128 -0
- package/dist/node/redux/reducers.js +193 -0
- package/dist/node/redux/state.js +71 -0
- package/dist/node/renderer.js +124 -0
- package/dist/node/reporter-transports.js +259 -0
- package/dist/node/reporter.js +497 -0
- package/dist/node/schema/date.js +539 -0
- package/dist/node/schema/extensions.js +315 -0
- package/dist/node/schema/index.js +542 -0
- package/dist/node/schema/infer.js +388 -0
- package/dist/node/schema/inline-objects.js +128 -0
- package/dist/node/schema/naming.js +20 -0
- package/dist/node/schema/node-model.js +207 -0
- package/dist/node/schema/query-engine.js +1808 -0
- package/dist/node/schema/resolver-kinds.js +7 -0
- package/dist/node/schema/resolvers.js +273 -0
- package/dist/node/schema/type-builders.js +45 -0
- package/dist/node/schema/types.js +241 -0
- package/dist/node/serve.js +90 -0
- package/dist/node/site-page-nodes.js +277 -0
- package/dist/node/types.js +1 -0
- package/dist/node/utils/content-digest.js +107 -0
- package/dist/node/utils/create-node-id.js +51 -0
- package/dist/node/utils/env.js +24 -0
- package/dist/node/utils/fs-retry.js +74 -0
- package/dist/node/utils/memory-signals.js +410 -0
- package/dist/node/utils/memory.js +400 -0
- package/dist/node/utils/murmurhash.js +32 -0
- package/dist/node/utils/parser.js +33 -0
- package/dist/node/utils/partition-hash.js +19 -0
- package/dist/node/utils/paths.js +122 -0
- package/dist/node/utils/resolver.js +48 -0
- package/dist/node/utils/runtime.js +5 -0
- package/dist/node/utils/serializable.js +41 -0
- package/dist/node/utils/strings.js +41 -0
- package/dist/node/vite/config.js +289 -0
- package/dist/node/vite/paths.js +12 -0
- package/dist/node/vite/plugin-deps.js +232 -0
- package/dist/node/vite/plugin.js +281 -0
- package/dist/node/vite/react-compiler.js +362 -0
- package/dist/node/vite/source-files.js +83 -0
- package/dist/node/vite/static-image.js +136 -0
- package/dist/node/vite/styled-components.js +73 -0
- package/dist/node/vite/transforms.js +299 -0
- package/dist/node/wasm-data/host.js +406 -0
- package/dist/node/wasm-data/lower.js +406 -0
- package/dist/node/wasm-data/runner.js +79 -0
- package/dist/node/wasm-data/worker.js +95 -0
- package/dist/reporter.js +5 -0
- package/dist/runtime/api-runner.js +81 -0
- package/dist/runtime/app.js +256 -0
- package/dist/runtime/client-entry.js +4 -0
- package/dist/runtime/client.js +383 -0
- package/dist/runtime/default-html.js +31 -0
- package/dist/runtime/head-markup.js +100 -0
- package/dist/runtime/head-sync.js +101 -0
- package/dist/runtime/head-tags.js +45 -0
- package/dist/runtime/hydration-report.js +111 -0
- package/dist/runtime/index.js +12 -0
- package/dist/runtime/link.js +293 -0
- package/dist/runtime/loader.js +449 -0
- package/dist/runtime/not-found.js +61 -0
- package/dist/runtime/page-renderer.js +35 -0
- package/dist/runtime/preamble.js +47 -0
- package/dist/runtime/react-compat.js +14 -0
- package/dist/runtime/renderer-shared.js +10 -0
- package/dist/runtime/renderers/react-client.js +14 -0
- package/dist/runtime/renderers/react-server.js +99 -0
- package/dist/runtime/renderers/react.js +17 -0
- package/dist/runtime/renderers/types.js +1 -0
- package/dist/runtime/root-error-handlers.js +29 -0
- package/dist/runtime/router/history.js +132 -0
- package/dist/runtime/router/index.js +240 -0
- package/dist/runtime/router/utils.js +118 -0
- package/dist/runtime/script.js +110 -0
- package/dist/runtime/scroll.js +40 -0
- package/dist/runtime/slice.js +11 -0
- package/dist/runtime/ssr.js +240 -0
- package/dist/runtime/static-query.js +47 -0
- package/dist/utils.js +4 -0
- package/package.json +105 -3
- package/types/graphql-tada.d.ts +223 -0
- package/types/graphql.d.ts +2 -0
- package/types/index.d.ts +2287 -0
- package/types/node.d.ts +380 -0
- package/types/reporter.d.ts +187 -0
- package/types/router.d.ts +102 -0
- package/types/vendor/gql-tada.d.ts +2529 -0
|
@@ -0,0 +1,406 @@
|
|
|
1
|
+
import { GraphQLBoolean, GraphQLFloat, GraphQLID, GraphQLInt, GraphQLString, Kind, defaultFieldResolver, getArgumentValues, getNamedType, getNullableType, isInputObjectType, isLeafType, isListType, isNonNullType, isObjectType, print, typeFromAST, valueFromAST } from "../gql.js";
|
|
2
|
+
import { collectFields, documentSupported } from "../query/execute.js";
|
|
3
|
+
import { GraphQLDate, compileFormatTokens, dateFormatLocale } from "../schema/date.js";
|
|
4
|
+
import { defaultFieldResolver as defaultFieldResolver$1 } from "../schema/extensions.js";
|
|
5
|
+
import { normalizeSort } from "../schema/query-engine.js";
|
|
6
|
+
import { resolverKinds } from "../schema/resolver-kinds.js";
|
|
7
|
+
// src/node/wasm-data/lower.ts
|
|
8
|
+
/**
|
|
9
|
+
* Lowers a page query to the plan IR of the WASM data side (@goatly/wasm, see its crate's
|
|
10
|
+
* README): the fields are collected like the query executor collects them (`collectFields`), each
|
|
11
|
+
* field is classified by its resolver (`resolverKinds`), and everything the WASM side does not
|
|
12
|
+
* reproduce exactly makes the whole query unsupported – it then runs in JS.
|
|
13
|
+
*
|
|
14
|
+
* Supported: one query operation; fragments and literal `@skip`/`@include`; aliases;
|
|
15
|
+
* `__typename`; root fields `x(id: { eq })` and `allX(filter, sort, skip, limit)` selecting
|
|
16
|
+
* `totalCount`, `nodes` and `__typename`; filters with one predicate (`eq`/`in` on an own scalar
|
|
17
|
+
* field, `link: { id: { eq } }`, `links: { elemMatch: { id: { eq } } }`); sorts by own scalar
|
|
18
|
+
* fields; own fields (scalars, Date, inline objects); `@link(by: "id")`; `@dateformat` with a
|
|
19
|
+
* literal English `formatString`. Not: SitePage, interfaces and unions, JSON and custom scalars,
|
|
20
|
+
* custom resolvers (also those of createResolvers), lists of lists.
|
|
21
|
+
*/
|
|
22
|
+
var Unsupported = class extends Error {};
|
|
23
|
+
const no = (reason) => {
|
|
24
|
+
throw new Unsupported(reason);
|
|
25
|
+
};
|
|
26
|
+
/** the built-in scalars the WASM side serializes (by name, as the IR names them) */
|
|
27
|
+
const SCALARS = /* @__PURE__ */ new Map([
|
|
28
|
+
[GraphQLString, "String"],
|
|
29
|
+
[GraphQLInt, "Int"],
|
|
30
|
+
[GraphQLFloat, "Float"],
|
|
31
|
+
[GraphQLBoolean, "Boolean"],
|
|
32
|
+
[GraphQLID, "ID"],
|
|
33
|
+
[GraphQLDate, "Date"]
|
|
34
|
+
]);
|
|
35
|
+
function scalarName(type) {
|
|
36
|
+
const known = SCALARS.get(type);
|
|
37
|
+
if (known) return known;
|
|
38
|
+
for (const [scalar, name] of SCALARS) if (type.name === scalar.name && type.serialize === scalar.serialize) return name;
|
|
39
|
+
}
|
|
40
|
+
function shapeOf(type, where) {
|
|
41
|
+
const nonNull = isNonNullType(type);
|
|
42
|
+
let t = getNullableType(type);
|
|
43
|
+
let list = [];
|
|
44
|
+
if (isListType(t)) {
|
|
45
|
+
const item = t.ofType;
|
|
46
|
+
const inner = getNullableType(item);
|
|
47
|
+
if (isListType(inner)) no(`${where}: a list of lists`);
|
|
48
|
+
list = [isNonNullType(item)];
|
|
49
|
+
t = inner;
|
|
50
|
+
}
|
|
51
|
+
return {
|
|
52
|
+
shape: {
|
|
53
|
+
nonNull,
|
|
54
|
+
list
|
|
55
|
+
},
|
|
56
|
+
named: t
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
const isNodeType = (type) => isObjectType(type) && type.getInterfaces().some((i) => i.name === "Node");
|
|
60
|
+
function usesVariables(node) {
|
|
61
|
+
if (!node || typeof node !== "object") return false;
|
|
62
|
+
if (Array.isArray(node)) return node.some(usesVariables);
|
|
63
|
+
if (node.kind === Kind.VARIABLE) return true;
|
|
64
|
+
for (const key in node) {
|
|
65
|
+
if (key === "loc") continue;
|
|
66
|
+
if (usesVariables(node[key])) return true;
|
|
67
|
+
}
|
|
68
|
+
return false;
|
|
69
|
+
}
|
|
70
|
+
/** a scalar literal (no objects: they never reach the WASM side) */
|
|
71
|
+
function literal(value, where) {
|
|
72
|
+
if (value === void 0) no(`${where}: an invalid literal`);
|
|
73
|
+
if (value !== null && typeof value === "object") no(`${where}: an object or list literal`);
|
|
74
|
+
if (typeof value === "number" && !Number.isFinite(value)) no(`${where}: a non-finite number`);
|
|
75
|
+
return { lit: value };
|
|
76
|
+
}
|
|
77
|
+
/** a filter operand, skip or limit (`type`: its input type) */
|
|
78
|
+
function argOf(node, type, where) {
|
|
79
|
+
if (node.kind === Kind.VARIABLE) return { var: node.name.value };
|
|
80
|
+
if (node.kind === Kind.NULL) return { lit: null };
|
|
81
|
+
const nullable = getNullableType(type);
|
|
82
|
+
if (isListType(nullable)) {
|
|
83
|
+
const item = nullable.ofType;
|
|
84
|
+
if (node.kind !== Kind.LIST) return { list: [argOf(node, item, where)] };
|
|
85
|
+
return { list: node.values.map((v) => argOf(v, item, where)) };
|
|
86
|
+
}
|
|
87
|
+
if (node.kind === Kind.LIST || node.kind === Kind.OBJECT) no(`${where}: a list or object value`);
|
|
88
|
+
return literal(valueFromAST(node, nullable), where);
|
|
89
|
+
}
|
|
90
|
+
const selectionSetsOf = (nodes) => nodes.flatMap((n) => n.selectionSet ? [n.selectionSet] : []);
|
|
91
|
+
const isDefaultResolver = (resolve) => resolve === void 0 || resolve === defaultFieldResolver || resolve === defaultFieldResolver$1;
|
|
92
|
+
function kindOf(def, where) {
|
|
93
|
+
if (isDefaultResolver(def.resolve)) return void 0;
|
|
94
|
+
const kind = resolverKinds.get(def.resolve);
|
|
95
|
+
if (!kind) no(`${where}: a custom resolver`);
|
|
96
|
+
return kind;
|
|
97
|
+
}
|
|
98
|
+
const SITE_PAGE = "SitePage";
|
|
99
|
+
function checkType(type, where) {
|
|
100
|
+
if (type.name === SITE_PAGE) no(`${where}: reads SitePage nodes`);
|
|
101
|
+
}
|
|
102
|
+
/** the fields of `type` selected by `sets` */
|
|
103
|
+
function lowerSel(cx, type, sets) {
|
|
104
|
+
checkType(type, type.name);
|
|
105
|
+
if (type.isTypeOf) no(`${type.name}: isTypeOf`);
|
|
106
|
+
const out = [];
|
|
107
|
+
for (const [key, nodes] of collectFields(cx.schema, cx.fragments, type, sets)) {
|
|
108
|
+
const name = nodes[0].name.value;
|
|
109
|
+
const where = `${type.name}.${name}`;
|
|
110
|
+
if (name === "__typename") {
|
|
111
|
+
out.push([key, {
|
|
112
|
+
k: "typename",
|
|
113
|
+
name: type.name
|
|
114
|
+
}]);
|
|
115
|
+
continue;
|
|
116
|
+
}
|
|
117
|
+
if (name.startsWith("__")) no(`${where}: introspection`);
|
|
118
|
+
const def = type.getFields()[name];
|
|
119
|
+
if (!def) continue;
|
|
120
|
+
out.push([key, lowerField(cx, def, nodes, where)]);
|
|
121
|
+
}
|
|
122
|
+
return out;
|
|
123
|
+
}
|
|
124
|
+
function lowerField(cx, def, nodes, where) {
|
|
125
|
+
const kind = kindOf(def, where);
|
|
126
|
+
const { shape, named } = shapeOf(def.type, where);
|
|
127
|
+
checkType(named, where);
|
|
128
|
+
if (kind?.k === "findOne" || kind?.k === "findMany") no(`${where}: a root field below the root`);
|
|
129
|
+
if (kind?.k === "link") {
|
|
130
|
+
if (kind.by !== "id" || kind.from || kind.fromNode || kind.on != null || kind.inner != null) no(`${where}: @link with options`);
|
|
131
|
+
if (!isNodeType(named) || named.isTypeOf) no(`${where}: @link to a non-node type`);
|
|
132
|
+
const target = named;
|
|
133
|
+
return {
|
|
134
|
+
k: "link",
|
|
135
|
+
field: def.name,
|
|
136
|
+
target: target.name,
|
|
137
|
+
sel: lowerSel(cx, target, selectionSetsOf(nodes)),
|
|
138
|
+
shape
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
if (kind?.k === "date") {
|
|
142
|
+
if (kind.from || kind.fromNode || kind.inner != null) no(`${where}: @dateformat with options`);
|
|
143
|
+
if (nodes.some((n) => usesVariables(n.arguments))) no(`${where}: @dateformat with variables`);
|
|
144
|
+
const scalar = isLeafType(named) ? scalarName(named) : void 0;
|
|
145
|
+
if (!scalar) no(`${where}: @dateformat of a ${named.name}`);
|
|
146
|
+
const args = getArgumentValues(def, nodes[0], {});
|
|
147
|
+
if (args.fromNow || args.difference) no(`${where}: fromNow / difference`);
|
|
148
|
+
if (!args.formatString) return {
|
|
149
|
+
k: "leaf",
|
|
150
|
+
field: def.name,
|
|
151
|
+
scalar,
|
|
152
|
+
shape
|
|
153
|
+
};
|
|
154
|
+
if (typeof args.formatString !== "string" || dateFormatLocale(args.locale) !== "en") no(`${where}: a formatString in another locale`);
|
|
155
|
+
const program = compileFormatTokens(args.formatString);
|
|
156
|
+
if (!program) no(`${where}: formatString "${args.formatString}" is formatted by dayjs`);
|
|
157
|
+
return {
|
|
158
|
+
k: "date",
|
|
159
|
+
field: def.name,
|
|
160
|
+
program,
|
|
161
|
+
shape
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
if (def.args.length) no(`${where}: a field with arguments`);
|
|
165
|
+
if (isLeafType(named)) {
|
|
166
|
+
const scalar = scalarName(named);
|
|
167
|
+
if (!scalar) no(`${where}: the scalar ${named.name}`);
|
|
168
|
+
return {
|
|
169
|
+
k: "leaf",
|
|
170
|
+
field: def.name,
|
|
171
|
+
scalar,
|
|
172
|
+
shape
|
|
173
|
+
};
|
|
174
|
+
}
|
|
175
|
+
if (!isObjectType(named)) no(`${where}: an interface or union`);
|
|
176
|
+
return {
|
|
177
|
+
k: "object",
|
|
178
|
+
field: def.name,
|
|
179
|
+
sel: lowerSel(cx, named, selectionSetsOf(nodes)),
|
|
180
|
+
shape
|
|
181
|
+
};
|
|
182
|
+
}
|
|
183
|
+
/** the only field of an object value (a predicate after flattening) */
|
|
184
|
+
function single(node, where) {
|
|
185
|
+
if (node.kind !== Kind.OBJECT) no(`${where}: not an object`);
|
|
186
|
+
const fields = node.fields;
|
|
187
|
+
if (fields.length !== 1) no(`${where}: more than one predicate`);
|
|
188
|
+
return fields[0];
|
|
189
|
+
}
|
|
190
|
+
function inputField(type, name, where) {
|
|
191
|
+
const t = getNullableType(type);
|
|
192
|
+
if (!isInputObjectType(t)) no(`${where}: not an input object`);
|
|
193
|
+
const field = t.getFields()[name];
|
|
194
|
+
if (!field) no(`${where}: unknown input field ${name}`);
|
|
195
|
+
return field.type;
|
|
196
|
+
}
|
|
197
|
+
/** a field filters and sorts can read as stored (no resolver, or a @dateformat passthrough) */
|
|
198
|
+
function ownScalarField(type, name, where) {
|
|
199
|
+
const def = type.getFields()[name];
|
|
200
|
+
if (!def) no(`${where}: unknown field ${name}`);
|
|
201
|
+
const kind = kindOf(def, where);
|
|
202
|
+
if (kind && !(kind.k === "date" && def.resolve.__goatlyPassthrough)) no(`${where}: ${name} is resolved`);
|
|
203
|
+
const { named } = shapeOf(def.type, where);
|
|
204
|
+
if (!isLeafType(named) || !scalarName(named)) no(`${where}: ${name} is not a scalar`);
|
|
205
|
+
return def;
|
|
206
|
+
}
|
|
207
|
+
function lowerFilter(node, type, filterType, where) {
|
|
208
|
+
if (node.kind === Kind.VARIABLE) no(`${where}: a filter variable`);
|
|
209
|
+
if (node.kind === Kind.NULL) return null;
|
|
210
|
+
if (node.kind !== Kind.OBJECT) no(`${where}: not an object`);
|
|
211
|
+
if (!node.fields.length) return null;
|
|
212
|
+
const field = single(node, where);
|
|
213
|
+
const name = field.name.value;
|
|
214
|
+
const def = type.getFields()[name];
|
|
215
|
+
if (!def) no(`${where}: unknown field ${name}`);
|
|
216
|
+
const kind = kindOf(def, where);
|
|
217
|
+
const fieldInput = inputField(filterType, name, where);
|
|
218
|
+
if (kind?.k === "link") {
|
|
219
|
+
if (kind.by !== "id" || kind.from || kind.fromNode || kind.on != null || kind.inner != null) no(`${where}: @link with options`);
|
|
220
|
+
const { shape, named } = shapeOf(def.type, where);
|
|
221
|
+
if (!isNodeType(named)) no(`${where}: @link to a non-node type`);
|
|
222
|
+
checkType(named, where);
|
|
223
|
+
let inner = field.value;
|
|
224
|
+
let innerType = fieldInput;
|
|
225
|
+
const list = shape.list.length > 0;
|
|
226
|
+
if (list) {
|
|
227
|
+
const elem = single(inner, where);
|
|
228
|
+
if (elem.name.value !== "elemMatch") no(`${where}: ${name}: not elemMatch`);
|
|
229
|
+
inner = elem.value;
|
|
230
|
+
innerType = inputField(innerType, "elemMatch", where);
|
|
231
|
+
}
|
|
232
|
+
const idField = single(inner, where);
|
|
233
|
+
if (idField.name.value !== "id") no(`${where}: ${name}: a filter on a linked field`);
|
|
234
|
+
const op = single(idField.value, where);
|
|
235
|
+
if (op.name.value !== "eq") no(`${where}: ${name}.id: not eq`);
|
|
236
|
+
const opType = inputField(inputField(innerType, "id", where), "eq", where);
|
|
237
|
+
return {
|
|
238
|
+
link: name,
|
|
239
|
+
list,
|
|
240
|
+
target: named.name,
|
|
241
|
+
op: "eq",
|
|
242
|
+
value: argOf(op.value, opType, where)
|
|
243
|
+
};
|
|
244
|
+
}
|
|
245
|
+
ownScalarField(type, name, where);
|
|
246
|
+
const op = single(field.value, where);
|
|
247
|
+
const opName = op.name.value;
|
|
248
|
+
if (opName !== "eq" && opName !== "in") no(`${where}: the operator ${opName}`);
|
|
249
|
+
const opType = inputField(fieldInput, opName, where);
|
|
250
|
+
return {
|
|
251
|
+
path: [name],
|
|
252
|
+
op: opName,
|
|
253
|
+
value: argOf(op.value, opType, where)
|
|
254
|
+
};
|
|
255
|
+
}
|
|
256
|
+
function lowerRootField(cx, def, nodes, where) {
|
|
257
|
+
const anyKind = kindOf(def, where);
|
|
258
|
+
if (anyKind?.k !== "findOne" && anyKind?.k !== "findMany") no(`${where}: not a node query field`);
|
|
259
|
+
const kind = anyKind;
|
|
260
|
+
if (kind.type === SITE_PAGE) no(`${where}: reads SitePage nodes`);
|
|
261
|
+
const node = nodes[0];
|
|
262
|
+
const args = new Map((node.arguments ?? []).map((a) => [a.name.value, a]));
|
|
263
|
+
const argType = (name) => def.args.find((a) => a.name === name).type;
|
|
264
|
+
if (kind.k === "findOne") {
|
|
265
|
+
const named = getNamedType(def.type);
|
|
266
|
+
if (!isObjectType(named) || named.name !== kind.type) no(`${where}: not an object type`);
|
|
267
|
+
const id = args.get("id");
|
|
268
|
+
if (args.size !== 1 || !id) no(`${where}: not a lookup by id`);
|
|
269
|
+
const eq = single(id.value, where);
|
|
270
|
+
if (eq.name.value !== "eq") no(`${where}: id: not eq`);
|
|
271
|
+
return {
|
|
272
|
+
k: "findOne",
|
|
273
|
+
type: kind.type,
|
|
274
|
+
id: argOf(eq.value, inputField(argType("id"), "eq", where), where),
|
|
275
|
+
sel: lowerSel(cx, named, selectionSetsOf(nodes)),
|
|
276
|
+
nonNull: isNonNullType(def.type)
|
|
277
|
+
};
|
|
278
|
+
}
|
|
279
|
+
for (const name of args.keys()) if (name !== "filter" && name !== "sort" && name !== "skip" && name !== "limit") no(`${where}: the argument ${name}`);
|
|
280
|
+
const conn = getNamedType(def.type);
|
|
281
|
+
if (!isObjectType(conn)) no(`${where}: not a connection`);
|
|
282
|
+
const nodesDef = conn.getFields().nodes;
|
|
283
|
+
const nodeType = nodesDef && getNamedType(nodesDef.type);
|
|
284
|
+
if (!nodeType || !isObjectType(nodeType) || nodeType.name !== kind.type) no(`${where}: not a connection of ${kind.type}`);
|
|
285
|
+
const type = nodeType;
|
|
286
|
+
const filterArg = args.get("filter");
|
|
287
|
+
const filter = filterArg ? lowerFilter(filterArg.value, type, argType("filter"), `${where}(filter)`) : null;
|
|
288
|
+
let sort = [];
|
|
289
|
+
const sortArg = args.get("sort");
|
|
290
|
+
if (sortArg) {
|
|
291
|
+
if (usesVariables(sortArg.value)) no(`${where}: a sort with variables`);
|
|
292
|
+
const value = valueFromAST(sortArg.value, argType("sort"));
|
|
293
|
+
if (value === void 0) no(`${where}: an invalid sort`);
|
|
294
|
+
sort = normalizeSort(value).map((s) => {
|
|
295
|
+
if (s.path.length !== 1) no(`${where}: a sort by a nested field`);
|
|
296
|
+
ownScalarField(type, s.path[0], `${where}(sort)`);
|
|
297
|
+
return {
|
|
298
|
+
path: [s.path[0]],
|
|
299
|
+
desc: s.order === "DESC"
|
|
300
|
+
};
|
|
301
|
+
});
|
|
302
|
+
}
|
|
303
|
+
const intArg = (name) => {
|
|
304
|
+
const a = args.get(name);
|
|
305
|
+
return a ? argOf(a.value, argType(name), `${where}(${name})`) : null;
|
|
306
|
+
};
|
|
307
|
+
const sel = [];
|
|
308
|
+
const connType = conn;
|
|
309
|
+
for (const [key, fieldNodes] of collectFields(cx.schema, cx.fragments, connType, selectionSetsOf(nodes))) {
|
|
310
|
+
const name = fieldNodes[0].name.value;
|
|
311
|
+
if (name === "__typename") {
|
|
312
|
+
sel.push([key, { typename: connType.name }]);
|
|
313
|
+
continue;
|
|
314
|
+
}
|
|
315
|
+
const fieldDef = connType.getFields()[name];
|
|
316
|
+
if (!fieldDef) continue;
|
|
317
|
+
if (!isDefaultResolver(fieldDef.resolve)) no(`${where}.${name}: a custom resolver`);
|
|
318
|
+
if (name === "totalCount") sel.push([key, "totalCount"]);
|
|
319
|
+
else if (name === "nodes") sel.push([key, { nodes: lowerSel(cx, type, selectionSetsOf(fieldNodes)) }]);
|
|
320
|
+
else no(`${where}.${name}: not supported`);
|
|
321
|
+
}
|
|
322
|
+
return {
|
|
323
|
+
k: "findMany",
|
|
324
|
+
type: type.name,
|
|
325
|
+
connType: connType.name,
|
|
326
|
+
filter,
|
|
327
|
+
sort,
|
|
328
|
+
skip: intArg("skip"),
|
|
329
|
+
limit: intArg("limit"),
|
|
330
|
+
sel
|
|
331
|
+
};
|
|
332
|
+
}
|
|
333
|
+
/** the declared variables (built-in scalars and lists of them only) */
|
|
334
|
+
function lowerVars(schema, operation) {
|
|
335
|
+
const vars = [];
|
|
336
|
+
for (const def of operation.variableDefinitions ?? []) {
|
|
337
|
+
const name = def.variable.name.value;
|
|
338
|
+
const type = typeFromAST(schema, def.type);
|
|
339
|
+
if (!type) no(`$${name}: unknown type`);
|
|
340
|
+
let t = getNullableType(type);
|
|
341
|
+
if (isListType(t)) t = getNullableType(t.ofType);
|
|
342
|
+
if (!isLeafType(t) || !scalarName(t)) no(`$${name}: the type ${print(def.type)}`);
|
|
343
|
+
const v = {
|
|
344
|
+
name,
|
|
345
|
+
type: print(def.type)
|
|
346
|
+
};
|
|
347
|
+
if (def.defaultValue) {
|
|
348
|
+
const value = valueFromAST(def.defaultValue, type);
|
|
349
|
+
if (value === void 0) no(`$${name}: an invalid default`);
|
|
350
|
+
const items = Array.isArray(value) ? value : [value];
|
|
351
|
+
for (const item of items) if (item !== null && typeof item === "object") no(`$${name}: an object default`);
|
|
352
|
+
v.default = value;
|
|
353
|
+
}
|
|
354
|
+
vars.push(v);
|
|
355
|
+
}
|
|
356
|
+
return vars;
|
|
357
|
+
}
|
|
358
|
+
/** lowers a validated query document (see the module comment) */
|
|
359
|
+
function lowerQuery(schema, document) {
|
|
360
|
+
try {
|
|
361
|
+
let operation;
|
|
362
|
+
const fragments = Object.create(null);
|
|
363
|
+
for (const definition of document.definitions) if (definition.kind === Kind.OPERATION_DEFINITION) {
|
|
364
|
+
if (operation) no("more than one operation");
|
|
365
|
+
operation = definition;
|
|
366
|
+
} else if (definition.kind === Kind.FRAGMENT_DEFINITION) fragments[definition.name.value] = definition;
|
|
367
|
+
else no("a type system definition");
|
|
368
|
+
if (!operation || operation.operation !== "query") no("not a query");
|
|
369
|
+
if (!documentSupported(document)) no("@skip / @include with variables");
|
|
370
|
+
const op = operation;
|
|
371
|
+
const root = schema.getQueryType();
|
|
372
|
+
if (!root) no("no query type");
|
|
373
|
+
const cx = {
|
|
374
|
+
schema,
|
|
375
|
+
fragments
|
|
376
|
+
};
|
|
377
|
+
const vars = lowerVars(schema, op);
|
|
378
|
+
const sel = [];
|
|
379
|
+
for (const [key, nodes] of collectFields(schema, fragments, root, [op.selectionSet])) {
|
|
380
|
+
const name = nodes[0].name.value;
|
|
381
|
+
if (name === "__typename") {
|
|
382
|
+
sel.push([key, {
|
|
383
|
+
k: "typename",
|
|
384
|
+
name: root.name
|
|
385
|
+
}]);
|
|
386
|
+
continue;
|
|
387
|
+
}
|
|
388
|
+
if (name.startsWith("__")) no(`${name}: introspection`);
|
|
389
|
+
const def = root.getFields()[name];
|
|
390
|
+
if (!def) continue;
|
|
391
|
+
sel.push([key, lowerRootField(cx, def, nodes, `Query.${name}`)]);
|
|
392
|
+
}
|
|
393
|
+
if (!sel.length) no("no fields");
|
|
394
|
+
return {
|
|
395
|
+
ir: {
|
|
396
|
+
vars,
|
|
397
|
+
root: sel
|
|
398
|
+
},
|
|
399
|
+
vars: vars.map((v) => v.name)
|
|
400
|
+
};
|
|
401
|
+
} catch (e) {
|
|
402
|
+
if (e instanceof Unsupported) return { unsupported: e.message };
|
|
403
|
+
return { unsupported: `lowering failed: ${e?.message ?? String(e)}` };
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
export { lowerQuery };
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import fs from "node:fs";
|
|
2
|
+
// src/node/wasm-data/runner.ts
|
|
3
|
+
/**
|
|
4
|
+
* What the main thread and the query workers share to run pages with the WASM data side (see
|
|
5
|
+
* host.ts): a page's variables for a batch, its result JSON, the counters of a build and the
|
|
6
|
+
* mismatch log of verify mode.
|
|
7
|
+
*/
|
|
8
|
+
/** pages per call into WASM */
|
|
9
|
+
const WASM_BATCH = 64;
|
|
10
|
+
/**
|
|
11
|
+
* The slots of a build's counters (Int32; shared with the query workers): the store's status,
|
|
12
|
+
* counters, the fallback reasons, then each query's plan id.
|
|
13
|
+
*/
|
|
14
|
+
const WasmState = {
|
|
15
|
+
/** 0: building, 1: sealed, 2: failed or stopped (every page runs in JS) */
|
|
16
|
+
STATUS: 0,
|
|
17
|
+
OK: 1,
|
|
18
|
+
FALLBACK: 2,
|
|
19
|
+
MISMATCH: 3,
|
|
20
|
+
TRAPS: 4,
|
|
21
|
+
/** µs in runBatch, summed over the threads (wraps after 35 minutes: only for stats) */
|
|
22
|
+
MICROS: 5,
|
|
23
|
+
REASONS: 6,
|
|
24
|
+
PLANS: 32
|
|
25
|
+
};
|
|
26
|
+
/** a query worker's call gate (see host.ts' WasmWorkerOptions): in a call / about to be stopped */
|
|
27
|
+
const GATE_CALL = 1;
|
|
28
|
+
const GATE_STOPPED = 2;
|
|
29
|
+
/** a variable value JSON writes as GraphQL reads it (anything else: the page runs in JS) */
|
|
30
|
+
function plainValue(value) {
|
|
31
|
+
if (value === null || typeof value === "string" || typeof value === "boolean") return true;
|
|
32
|
+
if (typeof value === "number") return Number.isFinite(value);
|
|
33
|
+
if (Array.isArray(value)) return value.every((v) => v === null || typeof v === "string" || typeof v === "boolean" || typeof v === "number" && Number.isFinite(v));
|
|
34
|
+
return false;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* The variables of a page for its plan (`names`: the query's declared variables), as JSON:
|
|
38
|
+
* undefined when one can't go to WASM as it is (the page runs in JS).
|
|
39
|
+
*/
|
|
40
|
+
function pageVars(page, names) {
|
|
41
|
+
const source = {
|
|
42
|
+
...page,
|
|
43
|
+
...page.context
|
|
44
|
+
};
|
|
45
|
+
const vars = {};
|
|
46
|
+
for (const name of names) {
|
|
47
|
+
const value = source[name];
|
|
48
|
+
if (value === void 0) continue;
|
|
49
|
+
if (!plainValue(value)) return void 0;
|
|
50
|
+
vars[name] = value;
|
|
51
|
+
}
|
|
52
|
+
return JSON.stringify(vars);
|
|
53
|
+
}
|
|
54
|
+
/** the page's resultJson, as `JSON.stringify({ data, pageContext: page.context })` writes it */
|
|
55
|
+
const resultJsonOf = (page, data) => page.context === void 0 ? `{"data":${data}}` : `{"data":${data},"pageContext":${JSON.stringify(page.context)}}`;
|
|
56
|
+
/** counts a batch's results in the build's counters */
|
|
57
|
+
function countResults(state, results, reasons, micros) {
|
|
58
|
+
Atomics.add(state, WasmState.MICROS, Math.round(micros));
|
|
59
|
+
for (const r of results) if (r.status === 0) Atomics.add(state, WasmState.OK, 1);
|
|
60
|
+
else {
|
|
61
|
+
Atomics.add(state, WasmState.FALLBACK, 1);
|
|
62
|
+
const reason = reasons.indexOf(r.reason);
|
|
63
|
+
if (reason >= 0) Atomics.add(state, WasmState.REASONS + reason, 1);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
/** the most mismatches verify mode writes to its file */
|
|
67
|
+
const MISMATCHES_WRITTEN = 50;
|
|
68
|
+
/** verify mode: a page whose WASM result differs from the JS one (counted, the first ones logged) */
|
|
69
|
+
function recordMismatch(state, file, entry) {
|
|
70
|
+
if (Atomics.add(state, WasmState.MISMATCH, 1) >= MISMATCHES_WRITTEN) return;
|
|
71
|
+
try {
|
|
72
|
+
fs.appendFileSync(file, `${JSON.stringify(entry)}\n`);
|
|
73
|
+
} catch {}
|
|
74
|
+
}
|
|
75
|
+
/** whether a WASM result is the JS one: the same resultJson and dependencies, no JS errors */
|
|
76
|
+
function sameResult(wasm, js) {
|
|
77
|
+
return !js.errors && wasm.resultJson === js.resultJson && js.n !== void 0 && js.c !== void 0 && js.n.join("\n") === wasm.n.join("\n") && js.c.join("\n") === wasm.c.join("\n");
|
|
78
|
+
}
|
|
79
|
+
export { GATE_CALL, GATE_STOPPED, WASM_BATCH, WasmState, countResults, pageVars, recordMismatch, resultJsonOf, sameResult };
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { WASM_BATCH, WasmState, countResults, pageVars, recordMismatch, resultJsonOf, sameResult } from "./runner.js";
|
|
2
|
+
import { CallRefused, REASONS, attachData } from "@goatly/wasm";
|
|
3
|
+
// src/node/wasm-data/worker.ts
|
|
4
|
+
/**
|
|
5
|
+
* A query worker's side of the WASM data side (see host.ts): attaches to the shared store once it
|
|
6
|
+
* is sealed, and runs batches of pages – one call per batch, which returns each page's `data` JSON
|
|
7
|
+
* and dependencies (`n`/`c` exactly as `serializeDependencies` writes them).
|
|
8
|
+
*/
|
|
9
|
+
function createWasmRunner(options) {
|
|
10
|
+
const state = new Int32Array(options.state);
|
|
11
|
+
const gates = new Int32Array(options.gates);
|
|
12
|
+
let data;
|
|
13
|
+
/** off for this worker: the store failed, a call trapped, it was detached or is being stopped */
|
|
14
|
+
let off = false;
|
|
15
|
+
/**
|
|
16
|
+
* around each export call that can take the shared allocator's lock – not around the JS that
|
|
17
|
+
* encodes and decodes a batch, where a worker can run out of heap: see host.ts' gates
|
|
18
|
+
*/
|
|
19
|
+
const gate = {
|
|
20
|
+
enter: () => Atomics.compareExchange(gates, options.gate, 0, 1) === 0,
|
|
21
|
+
leave() {
|
|
22
|
+
Atomics.and(gates, options.gate, -2);
|
|
23
|
+
Atomics.notify(gates, options.gate);
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
/** attached once the store is sealed (the main thread seals it before the first query) */
|
|
27
|
+
const ready = () => {
|
|
28
|
+
if (off) return false;
|
|
29
|
+
if (data) return true;
|
|
30
|
+
const status = Atomics.load(state, WasmState.STATUS);
|
|
31
|
+
if (status === 0) return false;
|
|
32
|
+
if (status !== 1) {
|
|
33
|
+
off = true;
|
|
34
|
+
return false;
|
|
35
|
+
}
|
|
36
|
+
try {
|
|
37
|
+
data = attachData(options.data, gate);
|
|
38
|
+
} catch (e) {
|
|
39
|
+
off = true;
|
|
40
|
+
Atomics.add(state, WasmState.TRAPS, 1);
|
|
41
|
+
process.stderr.write(`wasm-data: attaching failed: ${e?.message ?? e}\n`);
|
|
42
|
+
}
|
|
43
|
+
return !!data;
|
|
44
|
+
};
|
|
45
|
+
return {
|
|
46
|
+
verify: options.verify,
|
|
47
|
+
/** the page as a WASM page, or undefined (its query, or its variables, run in JS) */
|
|
48
|
+
page(page, index) {
|
|
49
|
+
if (index === void 0 || !ready()) return void 0;
|
|
50
|
+
const planId = Atomics.load(state, WasmState.PLANS + index);
|
|
51
|
+
const names = options.planVars[index];
|
|
52
|
+
if (planId < 0 || !names) return void 0;
|
|
53
|
+
const vars = pageVars(page, names);
|
|
54
|
+
return vars === void 0 ? void 0 : {
|
|
55
|
+
page,
|
|
56
|
+
planId,
|
|
57
|
+
vars
|
|
58
|
+
};
|
|
59
|
+
},
|
|
60
|
+
/** runs a batch; undefined when it can't (this worker stops using WASM) */
|
|
61
|
+
run(pages) {
|
|
62
|
+
if (!data || off) return void 0;
|
|
63
|
+
if (Atomics.load(state, WasmState.STATUS) !== 1) {
|
|
64
|
+
off = true;
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
const t = performance.now();
|
|
68
|
+
let results;
|
|
69
|
+
try {
|
|
70
|
+
results = data.runBatch(pages);
|
|
71
|
+
} catch (e) {
|
|
72
|
+
off = true;
|
|
73
|
+
if (e instanceof CallRefused) return void 0;
|
|
74
|
+
Atomics.add(state, WasmState.TRAPS, 1);
|
|
75
|
+
process.stderr.write(`wasm-data: a call trapped – this worker runs its queries in JS: ${e?.message ?? e}\n`);
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
countResults(state, results, REASONS, (performance.now() - t) * 1e3);
|
|
79
|
+
return results;
|
|
80
|
+
},
|
|
81
|
+
/** verify: a page whose WASM result differs from the JS one */
|
|
82
|
+
mismatch(entry) {
|
|
83
|
+
recordMismatch(state, options.mismatchFile, entry);
|
|
84
|
+
},
|
|
85
|
+
/** this worker's private WASM bytes */
|
|
86
|
+
threadBytes: () => data ? data.threadBytes() : 0,
|
|
87
|
+
/** frees this worker's buffers: it runs no more batches (before it is shut down) */
|
|
88
|
+
detach() {
|
|
89
|
+
if (!data || off) return;
|
|
90
|
+
off = true;
|
|
91
|
+
data.detach();
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
export { WASM_BATCH, createWasmRunner, resultJsonOf, sameResult };
|
package/dist/reporter.js
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import reporter from "./node/reporter.js";
|
|
2
|
+
import { activityEndText, consoleTransport, formatTimingBreakdown, jsonTransport, loggerTransport } from "./node/reporter-transports.js";
|
|
3
|
+
// src/reporter.ts
|
|
4
|
+
var reporter_default = reporter;
|
|
5
|
+
export { activityEndText, consoleTransport, reporter_default as default, formatTimingBreakdown, jsonTransport, loggerTransport, reporter };
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { createContext } from "react";
|
|
2
|
+
// src/runtime/api-runner.ts
|
|
3
|
+
/** Merges CommonJS default exports into the namespace so `exports.foo` APIs are found. */
|
|
4
|
+
function normalizePluginModule(mod) {
|
|
5
|
+
if (!mod) return {};
|
|
6
|
+
const out = { ...mod };
|
|
7
|
+
const def = mod.default;
|
|
8
|
+
if (def && typeof def === "object") {
|
|
9
|
+
for (const key of Object.keys(def)) if (!(key in out) || out[key] === void 0) out[key] = def[key];
|
|
10
|
+
}
|
|
11
|
+
return out;
|
|
12
|
+
}
|
|
13
|
+
function createApiRunner(plugins, extraArgs = () => ({})) {
|
|
14
|
+
const normalized = plugins.map((p) => ({
|
|
15
|
+
...p,
|
|
16
|
+
plugin: normalizePluginModule(p.plugin)
|
|
17
|
+
}));
|
|
18
|
+
/** Gatsby's `apiRunner(api, args, defaultReturn, argTransform)` */
|
|
19
|
+
function apiRunner(api, args = {}, defaultReturn, argTransform) {
|
|
20
|
+
let currentArgs = args;
|
|
21
|
+
const results = [];
|
|
22
|
+
for (const plugin of normalized) {
|
|
23
|
+
const fn = plugin.plugin[api];
|
|
24
|
+
if (typeof fn !== "function") continue;
|
|
25
|
+
const result = fn({
|
|
26
|
+
...extraArgs(),
|
|
27
|
+
...currentArgs
|
|
28
|
+
}, plugin.options);
|
|
29
|
+
if (result !== void 0) {
|
|
30
|
+
results.push(result);
|
|
31
|
+
if (argTransform) currentArgs = argTransform({
|
|
32
|
+
args: currentArgs,
|
|
33
|
+
result,
|
|
34
|
+
plugin
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
if (results.length > 0) return results;
|
|
39
|
+
if (defaultReturn !== void 0) return [defaultReturn];
|
|
40
|
+
return [];
|
|
41
|
+
}
|
|
42
|
+
async function apiRunnerAsync(api, args = {}, defaultReturn) {
|
|
43
|
+
const results = [];
|
|
44
|
+
for (const plugin of normalized) {
|
|
45
|
+
const fn = plugin.plugin[api];
|
|
46
|
+
if (typeof fn !== "function") continue;
|
|
47
|
+
results.push(await fn({
|
|
48
|
+
...extraArgs(),
|
|
49
|
+
...args
|
|
50
|
+
}, plugin.options));
|
|
51
|
+
}
|
|
52
|
+
return results.length ? results : defaultReturn !== void 0 ? [defaultReturn] : [];
|
|
53
|
+
}
|
|
54
|
+
function hasApi(api) {
|
|
55
|
+
return normalized.some((p) => typeof p.plugin[api] === "function");
|
|
56
|
+
}
|
|
57
|
+
return {
|
|
58
|
+
apiRunner,
|
|
59
|
+
apiRunnerAsync,
|
|
60
|
+
hasApi,
|
|
61
|
+
plugins: normalized
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
/** Wraps an element through `wrapRootElement` / `wrapPageElement` style APIs. */
|
|
65
|
+
function wrapElement(runner, api, element, extra) {
|
|
66
|
+
return runner.apiRunner(api, {
|
|
67
|
+
element,
|
|
68
|
+
...extra
|
|
69
|
+
}, element, ({ result }) => ({
|
|
70
|
+
element: result,
|
|
71
|
+
...extra
|
|
72
|
+
})).pop();
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* The browser/SSR plugin API runner of the current root (provided by `AppRoot`/`HeadRoot`, read by
|
|
76
|
+
* the page body and the public `PageRenderer`). Lives here, next to the runner, so feature modules
|
|
77
|
+
* never import `./app`.
|
|
78
|
+
*/
|
|
79
|
+
const ApiRunnerContext = createContext(null);
|
|
80
|
+
ApiRunnerContext.displayName = "ApiRunnerContext";
|
|
81
|
+
export { ApiRunnerContext, createApiRunner, normalizePluginModule, wrapElement };
|