@powerhousedao/reactor-api 6.2.3-dev.1 → 6.2.3-dev.100
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 +7 -2
- package/dist/{adapter-gateway-apollo-DdamNLPT.mjs → adapter-gateway-apollo-D-EdZ4e-.mjs} +23 -24
- package/dist/adapter-gateway-apollo-D-EdZ4e-.mjs.map +1 -0
- package/dist/{adapter-gateway-mercurius-CLmTtNJC.mjs → adapter-gateway-mercurius-CdxLge5p.mjs} +4 -11
- package/dist/adapter-gateway-mercurius-CdxLge5p.mjs.map +1 -0
- package/dist/{adapter-http-express-54gdI9bu.mjs → adapter-http-express-78KD77cI.mjs} +11 -11
- package/dist/adapter-http-express-78KD77cI.mjs.map +1 -0
- package/dist/{adapter-http-fastify-DmccBVOe.mjs → adapter-http-fastify-Dk7aT_xw.mjs} +14 -13
- package/dist/adapter-http-fastify-Dk7aT_xw.mjs.map +1 -0
- package/dist/base-document-models-caJpqTLw.mjs +2083 -0
- package/dist/base-document-models-caJpqTLw.mjs.map +1 -0
- package/dist/create-schema-BCArFBv9.d.mts +167 -0
- package/dist/create-schema-BCArFBv9.d.mts.map +1 -0
- package/dist/error-info-Cr6oQACe.mjs +601 -0
- package/dist/error-info-Cr6oQACe.mjs.map +1 -0
- package/dist/index.d.mts +3410 -1028
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +7549 -2724
- package/dist/index.mjs.map +1 -1
- package/dist/package-subgraph-check-BxKx9kcQ.mjs +138 -0
- package/dist/package-subgraph-check-BxKx9kcQ.mjs.map +1 -0
- package/dist/pglite-like-CKQEL_Q0.d.mts +27 -0
- package/dist/pglite-like-CKQEL_Q0.d.mts.map +1 -0
- package/dist/pglite-node-CcX2YT-l.mjs +744 -0
- package/dist/pglite-node-CcX2YT-l.mjs.map +1 -0
- package/dist/rolldown-runtime-8H4AJuhK.mjs +16 -0
- package/dist/run-node-handler-CQjyjOuN.mjs +52 -0
- package/dist/run-node-handler-CQjyjOuN.mjs.map +1 -0
- package/dist/src/graphql/subgraph-types.d.mts +43 -0
- package/dist/src/graphql/subgraph-types.d.mts.map +1 -0
- package/dist/src/graphql/subgraph-types.mjs +14 -0
- package/dist/src/graphql/subgraph-types.mjs.map +1 -0
- package/dist/src/packages/https-hooks.d.mts +4 -4
- package/dist/src/packages/https-hooks.d.mts.map +1 -1
- package/dist/src/packages/https-hooks.mjs +2 -2
- package/dist/src/packages/https-hooks.mjs.map +1 -1
- package/dist/src/packages/vite-loader.d.mts +30 -9
- package/dist/src/packages/vite-loader.d.mts.map +1 -1
- package/dist/src/packages/vite-loader.mjs +208 -88
- package/dist/src/packages/vite-loader.mjs.map +1 -1
- package/dist/src/pglite/pglite-node.d.mts +434 -0
- package/dist/src/pglite/pglite-node.d.mts.map +1 -0
- package/dist/src/pglite/pglite-node.mjs +5 -0
- package/dist/src/pglite/worker/entry.d.mts +2 -0
- package/dist/src/pglite/worker/entry.mjs +298 -0
- package/dist/src/pglite/worker/entry.mjs.map +1 -0
- package/dist/subgraph-extraction-C_hFvSaS.mjs +1884 -0
- package/dist/subgraph-extraction-C_hFvSaS.mjs.map +1 -0
- package/dist/subgraph-schema-owner-BEjuk2Xv.mjs +10 -0
- package/dist/subgraph-schema-owner-BEjuk2Xv.mjs.map +1 -0
- package/dist/types-Bz_xjf8j.d.mts +105 -0
- package/dist/types-Bz_xjf8j.d.mts.map +1 -0
- package/package.json +42 -26
- package/dist/adapter-gateway-apollo-DdamNLPT.mjs.map +0 -1
- package/dist/adapter-gateway-mercurius-CLmTtNJC.mjs.map +0 -1
- package/dist/adapter-http-express-54gdI9bu.mjs.map +0 -1
- package/dist/adapter-http-fastify-DmccBVOe.mjs.map +0 -1
- package/dist/path-normalize-DWWFLiy6.mjs +0 -23
- package/dist/path-normalize-DWWFLiy6.mjs.map +0 -1
- package/dist/types-Bz2niABC.d.mts +0 -48
- package/dist/types-Bz2niABC.d.mts.map +0 -1
- package/dist/utils-XWVecaNn.mjs +0 -653
- package/dist/utils-XWVecaNn.mjs.map +0 -1
- package/dist/websocket-DncAB9XK.mjs +0 -18
- package/dist/websocket-DncAB9XK.mjs.map +0 -1
|
@@ -1,28 +1,69 @@
|
|
|
1
1
|
|
|
2
|
-
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="
|
|
3
|
-
import {
|
|
2
|
+
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="cc1bbfa0-d615-5b07-8e65-2a1931a1af2c")}catch(e){}}();
|
|
3
|
+
import { S as isSubpath, _ as runDetached, b as extractUpgradeManifests, i as PIECES_SUBPATH, l as piecesFromListModule, n as scalarExportsOf, o as packageRootOf, r as BUILT_PIECE_LIST, s as pieceListLocation, t as extractSubgraphs, u as extractDocumentModels, v as PACKAGE_MODULE_FAILED, x as failedLoadHeader, y as debounce } from "../../subgraph-extraction-C_hFvSaS.mjs";
|
|
4
4
|
import { childLogger } from "document-model";
|
|
5
|
+
import { getCodegenStatusRegistry } from "@powerhousedao/shared/processors";
|
|
5
6
|
import path from "node:path";
|
|
7
|
+
import { fileURLToPath } from "node:url";
|
|
6
8
|
import { viteCommonjs } from "@originjs/vite-plugin-commonjs";
|
|
7
9
|
import { readPackage } from "read-pkg";
|
|
8
10
|
import { createLogger, createServer } from "vite";
|
|
9
11
|
//#region src/packages/vite-loader.mts
|
|
10
12
|
function createViteLogger(logger, prefix = "") {
|
|
11
13
|
const customLogger = createLogger("info", { prefix });
|
|
12
|
-
customLogger.info = logger.info;
|
|
13
|
-
customLogger.warn = logger.warn;
|
|
14
|
-
customLogger.error = logger.error;
|
|
14
|
+
customLogger.info = (msg) => logger.info("@line", msg);
|
|
15
|
+
customLogger.warn = (msg) => logger.warn("@line", msg);
|
|
16
|
+
customLogger.error = (msg, options) => options?.error ? logger.error("@line", msg, options.error) : logger.error("@line", msg);
|
|
15
17
|
return customLogger;
|
|
16
18
|
}
|
|
19
|
+
const FILE_EVENTS = [
|
|
20
|
+
"change",
|
|
21
|
+
"add",
|
|
22
|
+
"unlink"
|
|
23
|
+
];
|
|
17
24
|
var VitePackageLoader = class VitePackageLoader {
|
|
18
25
|
logger = childLogger(["reactor-api", "vite-loader"]);
|
|
19
26
|
vite;
|
|
27
|
+
importers;
|
|
28
|
+
#reportError;
|
|
29
|
+
#fileListeners = /* @__PURE__ */ new Set();
|
|
20
30
|
name = "VitePackageLoader";
|
|
21
|
-
static build(vite) {
|
|
22
|
-
return new VitePackageLoader(vite);
|
|
31
|
+
static build(vite, options) {
|
|
32
|
+
return new VitePackageLoader(vite, options);
|
|
23
33
|
}
|
|
24
|
-
constructor(vite) {
|
|
34
|
+
constructor(vite, options = {}) {
|
|
25
35
|
this.vite = vite;
|
|
36
|
+
this.importers = [...options.resolveFrom ?? [], import.meta.url].map((from) => from.startsWith("file:") ? fileURLToPath(from) : from);
|
|
37
|
+
this.#reportError = options.reportError;
|
|
38
|
+
}
|
|
39
|
+
async #resolve(identifier, subpath) {
|
|
40
|
+
const aliased = path.isAbsolute(identifier) ? void 0 : this.aliasedRoot(identifier);
|
|
41
|
+
const specifier = path.posix.join(aliased ?? identifier, subpath);
|
|
42
|
+
const importers = !aliased && !path.isAbsolute(identifier) ? [void 0, ...this.importers] : [void 0];
|
|
43
|
+
const container = this.vite.environments.ssr.pluginContainer;
|
|
44
|
+
for (const importer of importers) try {
|
|
45
|
+
const resolved = await container.resolveId(specifier, importer);
|
|
46
|
+
if (resolved && !resolved.external) return resolved.id;
|
|
47
|
+
} catch (e) {
|
|
48
|
+
this.logger.debug("Could not resolve @specifier: @error", specifier, e);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
async #load(identifier, subpath, kind) {
|
|
52
|
+
const id = await this.#resolve(identifier, subpath);
|
|
53
|
+
if (id === void 0) {
|
|
54
|
+
this.logger.debug("No @subpath module in @pkg", subpath, identifier);
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
try {
|
|
58
|
+
return {
|
|
59
|
+
id,
|
|
60
|
+
namespace: await this.vite.ssrLoadModule(id)
|
|
61
|
+
};
|
|
62
|
+
} catch (e) {
|
|
63
|
+
const message = e instanceof Error ? e.message : String(e);
|
|
64
|
+
this.logger.error(`${failedLoadHeader(kind)}\n @id: @error`, identifier, id, message);
|
|
65
|
+
throw Object.assign(new Error(`Failed to load ${id}: ${message}`, { cause: e }), { code: PACKAGE_MODULE_FAILED });
|
|
66
|
+
}
|
|
26
67
|
}
|
|
27
68
|
getDocumentModelsPath(identifier) {
|
|
28
69
|
return path.posix.join(identifier, "./document-models");
|
|
@@ -30,130 +71,209 @@ var VitePackageLoader = class VitePackageLoader {
|
|
|
30
71
|
getSubgraphsPath(identifier) {
|
|
31
72
|
return path.posix.join(identifier, "./subgraphs");
|
|
32
73
|
}
|
|
74
|
+
getScalarsPath(identifier) {
|
|
75
|
+
return path.posix.join(identifier, "./scalars");
|
|
76
|
+
}
|
|
33
77
|
getProcessorsPath(identifier) {
|
|
34
78
|
return path.posix.join(identifier, "./processors");
|
|
35
79
|
}
|
|
36
|
-
|
|
37
|
-
return
|
|
80
|
+
getPiecesPath(identifier) {
|
|
81
|
+
return path.posix.join(identifier, `./${PIECES_SUBPATH}`);
|
|
38
82
|
}
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
const
|
|
42
|
-
|
|
83
|
+
aliasedRoot(identifier) {
|
|
84
|
+
const alias = this.vite.config.resolve.alias;
|
|
85
|
+
const hit = (Array.isArray(alias) ? alias : []).find((entry) => entry.find === identifier);
|
|
86
|
+
return typeof hit?.replacement === "string" ? hit.replacement : void 0;
|
|
87
|
+
}
|
|
88
|
+
pieceRoot(identifier, listId) {
|
|
89
|
+
if (!path.isAbsolute(identifier)) {
|
|
90
|
+
const aliased = this.aliasedRoot(identifier);
|
|
91
|
+
if (aliased) return aliased;
|
|
92
|
+
if (listId) return packageRootOf(path.dirname(listId));
|
|
93
|
+
}
|
|
43
94
|
try {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
for (const dm of exports) if (dm.documentModel) documentModels.push(dm);
|
|
48
|
-
this.logger.verbose(` ➜ Loaded ${documentModels.length} Document Models from: ${identifier}`);
|
|
49
|
-
return documentModels;
|
|
50
|
-
} catch (e) {
|
|
51
|
-
this.logger.debug(` ➜ No Document Models found for: ${identifier}`, e);
|
|
95
|
+
return pieceListLocation(identifier).root;
|
|
96
|
+
} catch {
|
|
97
|
+
return;
|
|
52
98
|
}
|
|
53
|
-
|
|
99
|
+
}
|
|
100
|
+
async loadDocumentModels(identifier) {
|
|
101
|
+
this.logger.debug("Loading document models from", this.getDocumentModelsPath(identifier));
|
|
102
|
+
const loaded = await this.#load(identifier, "document-models", "document models");
|
|
103
|
+
if (!loaded) return [];
|
|
104
|
+
const documentModels = extractDocumentModels(loaded.namespace);
|
|
105
|
+
this.logger.verbose(` ➜ Loaded ${documentModels.length} Document Models from: ${identifier}`);
|
|
106
|
+
return documentModels;
|
|
54
107
|
}
|
|
55
108
|
async loadUpgradeManifests(identifier) {
|
|
56
|
-
const
|
|
57
|
-
|
|
58
|
-
|
|
109
|
+
for (const subpath of ["document-models", "document-models/upgrade-manifests"]) {
|
|
110
|
+
const loaded = await this.#load(identifier, subpath, "upgrade manifests");
|
|
111
|
+
if (!loaded) continue;
|
|
112
|
+
const manifests = extractUpgradeManifests(loaded.namespace);
|
|
59
113
|
if (manifests.length > 0) {
|
|
60
114
|
this.logger.verbose(` ➜ Loaded ${manifests.length} Upgrade Manifests from: ${identifier}`);
|
|
61
115
|
return manifests;
|
|
62
116
|
}
|
|
63
|
-
} catch (e) {
|
|
64
|
-
this.logger.debug(` ➜ No Upgrade Manifests found at ${fullPath} for: ${identifier}`, e);
|
|
65
117
|
}
|
|
66
118
|
return [];
|
|
67
119
|
}
|
|
68
120
|
async loadSubgraphs(identifier) {
|
|
69
|
-
|
|
70
|
-
this
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
localSubgraphs = await this.vite.ssrLoadModule(fullPath);
|
|
74
|
-
} catch (e) {
|
|
75
|
-
this.logger.debug(` ➜ No Subgraphs found for: ${identifier}`, e);
|
|
76
|
-
return [];
|
|
77
|
-
}
|
|
78
|
-
const subgraphs = [];
|
|
79
|
-
for (const [name, subgraph] of Object.entries(localSubgraphs)) {
|
|
80
|
-
const SubgraphClass = subgraph[name];
|
|
81
|
-
if (isSubgraphClass(SubgraphClass)) subgraphs.push(SubgraphClass);
|
|
82
|
-
}
|
|
121
|
+
this.logger.verbose("Loading subgraphs from", this.getSubgraphsPath(identifier));
|
|
122
|
+
const loaded = await this.#load(identifier, "subgraphs", "subgraphs");
|
|
123
|
+
if (!loaded) return [];
|
|
124
|
+
const subgraphs = extractSubgraphs(loaded.namespace);
|
|
83
125
|
this.logger.debug(` ➜ Loaded ${subgraphs.length} Subgraphs from: ${identifier}`);
|
|
84
126
|
return subgraphs;
|
|
85
127
|
}
|
|
128
|
+
async loadScalars(identifier) {
|
|
129
|
+
this.logger.verbose("Loading scalars from", this.getScalarsPath(identifier));
|
|
130
|
+
const loaded = await this.#load(identifier, "scalars", "scalars");
|
|
131
|
+
if (!loaded) return [];
|
|
132
|
+
const scalars = scalarExportsOf(loaded.namespace);
|
|
133
|
+
this.logger.debug(` ➜ Loaded ${scalars.length} Scalars from: ${identifier}`);
|
|
134
|
+
return scalars;
|
|
135
|
+
}
|
|
86
136
|
async loadProcessors(identifier) {
|
|
87
|
-
|
|
88
|
-
this
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
this.logger.verbose(` ➜ Loaded Processor Factory from: ${identifier}`);
|
|
93
|
-
return factory;
|
|
94
|
-
}
|
|
95
|
-
} catch (e) {
|
|
96
|
-
this.logger.debug(` ➜ No Processor Factory found for: ${identifier}`, e);
|
|
137
|
+
this.logger.verbose("Loading processors from", this.getProcessorsPath(identifier));
|
|
138
|
+
const factory = (await this.#load(identifier, "processors", "processors"))?.namespace.processorFactory;
|
|
139
|
+
if (typeof factory === "function") {
|
|
140
|
+
this.logger.verbose(` ➜ Loaded Processor Factory from: ${identifier}`);
|
|
141
|
+
return factory;
|
|
97
142
|
}
|
|
98
143
|
this.logger.verbose(` ➜ No Processor Factory found for: ${identifier}`);
|
|
99
144
|
return null;
|
|
100
145
|
}
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
146
|
+
async loadPieces(identifier) {
|
|
147
|
+
this.logger.verbose("Loading pieces from", this.getPiecesPath(identifier));
|
|
148
|
+
const loaded = await this.#load(identifier, PIECES_SUBPATH, "pieces");
|
|
149
|
+
if (!loaded) return [];
|
|
150
|
+
const root = this.pieceRoot(identifier, loaded.id);
|
|
151
|
+
if (root === void 0) {
|
|
152
|
+
this.logger.debug(` ➜ No package root found for: ${identifier}`);
|
|
153
|
+
return [];
|
|
154
|
+
}
|
|
155
|
+
const pieces = piecesFromListModule(loaded.namespace, {
|
|
156
|
+
root,
|
|
157
|
+
identifier,
|
|
158
|
+
logger: this.logger
|
|
159
|
+
});
|
|
160
|
+
this.logger.debug(` ➜ Loaded ${pieces.length} Pieces from: ${identifier}`);
|
|
161
|
+
return pieces;
|
|
162
|
+
}
|
|
163
|
+
#watch(label, reported, matches, load, handler, options) {
|
|
164
|
+
let subscribed = true;
|
|
165
|
+
const report = (failure) => getCodegenStatusRegistry().reportLoad(reported.pkg, reported.kind, failure);
|
|
166
|
+
const reloadOnce = debounce(() => runDetached(label, async () => {
|
|
167
|
+
if (!subscribed) return;
|
|
168
|
+
let value;
|
|
169
|
+
try {
|
|
170
|
+
value = await load();
|
|
171
|
+
} catch (e) {
|
|
172
|
+
if (e.code === "ERR_PACKAGE_MODULE_FAILED") {
|
|
173
|
+
report(`[${this.name}] ${e.message}`);
|
|
174
|
+
return;
|
|
175
|
+
}
|
|
176
|
+
throw e;
|
|
177
|
+
}
|
|
178
|
+
report();
|
|
179
|
+
if (subscribed) handler(value);
|
|
180
|
+
}, {
|
|
181
|
+
logger: this.logger,
|
|
182
|
+
report: this.#reportError
|
|
183
|
+
}), options?.debounce ?? 100);
|
|
184
|
+
const listener = (changedPath) => {
|
|
185
|
+
if (matches(changedPath)) reloadOnce();
|
|
104
186
|
};
|
|
105
|
-
this.vite.watcher.on(
|
|
106
|
-
this.
|
|
107
|
-
this.vite.watcher.on("unlink", listener);
|
|
187
|
+
if (this.#fileListeners.size === 0) for (const event of FILE_EVENTS) this.vite.watcher.on(event, this.#dispatchFileEvent);
|
|
188
|
+
this.#fileListeners.add(listener);
|
|
108
189
|
return () => {
|
|
109
|
-
|
|
110
|
-
this.
|
|
111
|
-
this.
|
|
190
|
+
subscribed = false;
|
|
191
|
+
if (!this.#fileListeners.delete(listener)) return;
|
|
192
|
+
if (this.#fileListeners.size > 0) return;
|
|
193
|
+
for (const event of FILE_EVENTS) this.vite.watcher.off(event, this.#dispatchFileEvent);
|
|
112
194
|
};
|
|
113
195
|
}
|
|
196
|
+
#dispatchFileEvent = (changedPath) => {
|
|
197
|
+
for (const listener of [...this.#fileListeners]) listener(changedPath);
|
|
198
|
+
};
|
|
199
|
+
onDocumentModelsChange(identifier, handler, options) {
|
|
200
|
+
const watched = [this.getDocumentModelsPath(identifier), this.getScalarsPath(identifier)];
|
|
201
|
+
return this.#watch(`Reloading the document models of ${identifier}`, {
|
|
202
|
+
pkg: identifier,
|
|
203
|
+
kind: "document models"
|
|
204
|
+
}, (changedPath) => watched.some((dir) => isSubpath(dir, changedPath)), () => this.loadDocumentModels(identifier), handler, options);
|
|
205
|
+
}
|
|
114
206
|
onSubgraphsChange(identifier, handler, options) {
|
|
115
207
|
const subgraphsPath = this.getSubgraphsPath(identifier);
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
this.
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
};
|
|
208
|
+
return this.#watch(`Reloading the subgraphs of ${identifier}`, {
|
|
209
|
+
pkg: identifier,
|
|
210
|
+
kind: "subgraphs"
|
|
211
|
+
}, (changedPath) => isSubpath(subgraphsPath, changedPath), () => this.loadSubgraphs(identifier), handler, options);
|
|
212
|
+
}
|
|
213
|
+
onScalarsChange(identifier, handler, options) {
|
|
214
|
+
const scalarsPath = this.getScalarsPath(identifier);
|
|
215
|
+
return this.#watch(`Reloading the scalars of ${identifier}`, {
|
|
216
|
+
pkg: identifier,
|
|
217
|
+
kind: "scalars"
|
|
218
|
+
}, (changedPath) => isSubpath(scalarsPath, changedPath), () => this.loadScalars(identifier), handler, options);
|
|
127
219
|
}
|
|
128
220
|
onProcessorsChange(identifier, handler, options) {
|
|
129
221
|
const processorsPath = this.getProcessorsPath(identifier);
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
this.
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
222
|
+
return this.#watch(`Reloading the processors of ${identifier}`, {
|
|
223
|
+
pkg: identifier,
|
|
224
|
+
kind: "processors"
|
|
225
|
+
}, (changedPath) => isSubpath(processorsPath, changedPath), () => this.loadProcessors(identifier), handler, options);
|
|
226
|
+
}
|
|
227
|
+
onPiecesChange(identifier, handler, options) {
|
|
228
|
+
const watched = [this.getPiecesPath(identifier)];
|
|
229
|
+
const root = this.pieceRoot(identifier);
|
|
230
|
+
if (root !== void 0) watched.push(path.dirname(path.resolve(root, BUILT_PIECE_LIST)));
|
|
231
|
+
return this.#watch(`Reloading the pieces of ${identifier}`, {
|
|
232
|
+
pkg: identifier,
|
|
233
|
+
kind: "pieces"
|
|
234
|
+
}, (changedPath) => watched.some((dir) => isSubpath(dir, changedPath)), () => this.loadPieces(identifier), handler, options);
|
|
141
235
|
}
|
|
142
236
|
};
|
|
237
|
+
const toSlashes = (file) => file.replaceAll("\\", "/");
|
|
238
|
+
/**
|
|
239
|
+
* The project's build output, but for the built piece list `onPiecesChange`
|
|
240
|
+
* watches: its own `dist/` and a Tauri shell's Rust `target/`. On Windows
|
|
241
|
+
* every watched file costs a synchronous `fs.watch` at startup, over a
|
|
242
|
+
* minute for a built project with a built desktop shell.
|
|
243
|
+
*/
|
|
244
|
+
function ignoreBuildOutputButPieces(root) {
|
|
245
|
+
const dist = `${toSlashes(path.resolve(root, "dist"))}/`;
|
|
246
|
+
const pieces = toSlashes(path.dirname(path.resolve(root, BUILT_PIECE_LIST)));
|
|
247
|
+
return (file) => {
|
|
248
|
+
const at = toSlashes(path.resolve(root, file));
|
|
249
|
+
if (at.includes("/tauri-shell/target/") || at.includes("/src-tauri/target/")) return true;
|
|
250
|
+
if (!at.startsWith(dist)) return false;
|
|
251
|
+
return !(at === pieces || at.startsWith(`${pieces}/`) || pieces.startsWith(`${at}/`));
|
|
252
|
+
};
|
|
253
|
+
}
|
|
143
254
|
async function startViteServer(root, logger) {
|
|
255
|
+
const packageJson = await readPackage({ cwd: root });
|
|
144
256
|
return await createServer({
|
|
145
257
|
root,
|
|
146
258
|
configFile: false,
|
|
147
|
-
logger,
|
|
259
|
+
customLogger: logger,
|
|
148
260
|
server: {
|
|
149
261
|
middlewareMode: true,
|
|
150
|
-
|
|
262
|
+
hmr: false,
|
|
263
|
+
ws: false,
|
|
264
|
+
watch: { ignored: ["**/.ph/**", ignoreBuildOutputButPieces(root)] }
|
|
151
265
|
},
|
|
152
266
|
appType: "custom",
|
|
267
|
+
cacheDir: path.join(root, "node_modules", ".vite-reactor"),
|
|
268
|
+
optimizeDeps: {
|
|
269
|
+
noDiscovery: true,
|
|
270
|
+
include: [],
|
|
271
|
+
entries: []
|
|
272
|
+
},
|
|
153
273
|
build: { rollupOptions: { input: [] } },
|
|
154
274
|
resolve: {
|
|
155
275
|
tsconfigPaths: true,
|
|
156
|
-
alias: { [
|
|
276
|
+
alias: { [packageJson.name]: root }
|
|
157
277
|
},
|
|
158
278
|
plugins: [viteCommonjs(), {
|
|
159
279
|
name: "suppress-hmr",
|
|
@@ -164,7 +284,7 @@ async function startViteServer(root, logger) {
|
|
|
164
284
|
});
|
|
165
285
|
}
|
|
166
286
|
//#endregion
|
|
167
|
-
export { VitePackageLoader, createViteLogger, startViteServer };
|
|
287
|
+
export { VitePackageLoader, createViteLogger, ignoreBuildOutputButPieces, startViteServer };
|
|
168
288
|
|
|
169
289
|
//# sourceMappingURL=vite-loader.mjs.map
|
|
170
|
-
//# debugId=
|
|
290
|
+
//# debugId=cc1bbfa0-d615-5b07-8e65-2a1931a1af2c
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vite-loader.mjs","sources":["../../../src/packages/vite-loader.mts"],"sourcesContent":["import { viteCommonjs } from \"@originjs/vite-plugin-commonjs\";\nimport type {\n ProcessorFactoryBuilder,\n SubgraphClass,\n} from \"@powerhousedao/reactor-api\";\nimport type {\n DocumentModelModule,\n UpgradeManifest,\n} from \"@powerhousedao/shared/document-model\";\nimport { childLogger, type ILogger } from \"document-model\";\nimport path from \"node:path\";\nimport { readPackage } from \"read-pkg\";\nimport type { Logger, PluginOption, ViteDevServer } from \"vite\";\nimport { createLogger, createServer } from \"vite\";\nimport { isSubgraphClass } from \"../graphql/utils.js\";\nimport type {\n ISubscribablePackageLoader,\n ISubscriptionOptions,\n} from \"./types.js\";\nimport { debounce, extractUpgradeManifests, isSubpath } from \"./util.js\";\n\nexport function createViteLogger(logger: ILogger, prefix = \"\") {\n const customLogger = createLogger(\"info\", {\n prefix,\n });\n customLogger.info = logger.info;\n customLogger.warn = logger.warn;\n customLogger.error = logger.error;\n return customLogger;\n}\n\nexport class VitePackageLoader implements ISubscribablePackageLoader {\n private readonly logger = childLogger([\"reactor-api\", \"vite-loader\"]);\n\n private readonly vite: ViteDevServer;\n\n readonly name = \"VitePackageLoader\";\n\n static build(vite: ViteDevServer) {\n return new VitePackageLoader(vite);\n }\n\n constructor(vite: ViteDevServer) {\n this.vite = vite;\n }\n\n private getDocumentModelsPath(identifier: string): string {\n return path.posix.join(identifier, \"./document-models\");\n }\n\n private getSubgraphsPath(identifier: string): string {\n return path.posix.join(identifier, \"./subgraphs\");\n }\n\n private getProcessorsPath(identifier: string): string {\n return path.posix.join(identifier, \"./processors\");\n }\n\n public loadDocumentModels(identifier: string, immediate = false) {\n return this.#loadDocumentModelsWithDebounce(immediate, identifier);\n }\n\n #loadDocumentModelsWithDebounce = debounce(\n this.#loadDocumentModels.bind(this),\n 500,\n );\n\n async #loadDocumentModels(\n identifier: string,\n ): Promise<DocumentModelModule[]> {\n const fullPath = this.getDocumentModelsPath(identifier);\n this.logger.debug(\"Loading document models from\", fullPath);\n\n try {\n const localDMs = (await this.vite.ssrLoadModule(fullPath)) as Record<\n string,\n DocumentModelModule\n >;\n\n const exports = Object.values(localDMs);\n\n // duck type\n const documentModels: DocumentModelModule[] = [];\n for (const dm of exports) {\n if (dm.documentModel) {\n documentModels.push(dm);\n }\n }\n\n this.logger.verbose(\n ` ➜ Loaded ${documentModels.length} Document Models from: ${identifier}`,\n );\n\n return documentModels;\n } catch (e) {\n this.logger.debug(` ➜ No Document Models found for: ${identifier}`, e);\n }\n\n return [];\n }\n\n async loadUpgradeManifests(\n identifier: string,\n ): Promise<UpgradeManifest<readonly number[]>[]> {\n // Projects generated before the aggregate index re-exported the\n // manifests only expose them at document-models/upgrade-manifests, so\n // try both without requiring a regeneration.\n const candidatePaths = [\n this.getDocumentModelsPath(identifier),\n path.posix.join(this.getDocumentModelsPath(identifier), \"upgrade-manifests\"),\n ];\n for (const fullPath of candidatePaths) {\n try {\n const namespace = (await this.vite.ssrLoadModule(fullPath)) as Record<\n string,\n unknown\n >;\n const manifests = extractUpgradeManifests(namespace);\n if (manifests.length > 0) {\n this.logger.verbose(\n ` ➜ Loaded ${manifests.length} Upgrade Manifests from: ${identifier}`,\n );\n return manifests;\n }\n } catch (e) {\n this.logger.debug(\n ` ➜ No Upgrade Manifests found at ${fullPath} for: ${identifier}`,\n e,\n );\n }\n }\n return [];\n }\n\n async loadSubgraphs(identifier: string): Promise<SubgraphClass[]> {\n const fullPath = this.getSubgraphsPath(identifier);\n\n this.logger.verbose(\"Loading subgraphs from\", fullPath);\n\n let localSubgraphs: Record<string, Record<string, SubgraphClass>> = {};\n try {\n localSubgraphs = await this.vite.ssrLoadModule(fullPath);\n } catch (e) {\n this.logger.debug(` ➜ No Subgraphs found for: ${identifier}`, e);\n return [];\n }\n\n const subgraphs: SubgraphClass[] = [];\n for (const [name, subgraph] of Object.entries(localSubgraphs)) {\n const SubgraphClass = subgraph[name];\n if (isSubgraphClass(SubgraphClass)) {\n subgraphs.push(SubgraphClass);\n }\n }\n\n this.logger.debug(\n ` ➜ Loaded ${subgraphs.length} Subgraphs from: ${identifier}`,\n );\n\n return subgraphs;\n }\n\n async loadProcessors(\n identifier: string,\n ): Promise<ProcessorFactoryBuilder | null> {\n const fullPath = this.getProcessorsPath(identifier);\n\n this.logger.verbose(\"Loading processors from\", fullPath);\n\n try {\n const pkgModule = await this.vite.ssrLoadModule(fullPath);\n\n const factory = (\n pkgModule as Record<string, ProcessorFactoryBuilder | undefined>\n )?.processorFactory;\n\n if (factory && typeof factory === \"function\") {\n this.logger.verbose(\n ` ➜ Loaded Processor Factory from: ${identifier}`,\n );\n return factory;\n }\n } catch (e) {\n this.logger.debug(\n ` ➜ No Processor Factory found for: ${identifier}`,\n e,\n );\n }\n\n this.logger.verbose(` ➜ No Processor Factory found for: ${identifier}`);\n\n // return empty processor factory\n return null;\n }\n\n onDocumentModelsChange(\n identifier: string,\n handler: (documentModels: DocumentModelModule[]) => void,\n options?: ISubscriptionOptions,\n ): () => void {\n const listener = async (changedPath: string) => {\n const documentModelsPath = this.getDocumentModelsPath(identifier);\n if (isSubpath(documentModelsPath, changedPath)) {\n const documentModels = await this.loadDocumentModels(identifier);\n handler(documentModels);\n }\n };\n\n // \"change\" alone misses files that are created or deleted: a removed\n // document-models/ entry would never report an empty result, and the\n // package's registered models would leak.\n this.vite.watcher.on(\"change\", listener);\n this.vite.watcher.on(\"add\", listener);\n this.vite.watcher.on(\"unlink\", listener);\n\n return () => {\n this.vite.watcher.off(\"change\", listener);\n this.vite.watcher.off(\"add\", listener);\n this.vite.watcher.off(\"unlink\", listener);\n };\n }\n\n onSubgraphsChange(\n identifier: string,\n handler: (subgraphs: SubgraphClass[]) => void,\n options?: ISubscriptionOptions,\n ): () => void {\n const subgraphsPath = this.getSubgraphsPath(identifier);\n const listener = async (changedPath: string) => {\n if (isSubpath(subgraphsPath, changedPath)) {\n const subgraphs = await this.loadSubgraphs(identifier);\n handler(subgraphs);\n }\n };\n // \"change\" alone misses files that are created or deleted: a removed\n // subgraphs/ entry would never report an empty result, and the\n // package's registered subgraphs would leak.\n this.vite.watcher.on(\"change\", listener);\n this.vite.watcher.on(\"add\", listener);\n this.vite.watcher.on(\"unlink\", listener);\n\n return () => {\n this.vite.watcher.off(\"change\", listener);\n this.vite.watcher.off(\"add\", listener);\n this.vite.watcher.off(\"unlink\", listener);\n };\n }\n\n onProcessorsChange(\n identifier: string,\n handler: (processors: ProcessorFactoryBuilder | null) => void,\n options?: ISubscriptionOptions,\n ): () => void {\n const processorsPath = this.getProcessorsPath(identifier);\n const listener = async (changedPath: string) => {\n if (isSubpath(processorsPath, changedPath)) {\n const processors = await this.loadProcessors(identifier);\n handler(processors);\n }\n };\n // \"change\" alone misses files that are created or deleted: a removed\n // processors/ entry would never report an empty result, and the\n // package's registered processor factories would leak.\n this.vite.watcher.on(\"change\", listener);\n this.vite.watcher.on(\"add\", listener);\n this.vite.watcher.on(\"unlink\", listener);\n\n return () => {\n this.vite.watcher.off(\"change\", listener);\n this.vite.watcher.off(\"add\", listener);\n this.vite.watcher.off(\"unlink\", listener);\n };\n }\n}\n\nexport async function startViteServer(root: string, logger?: Logger) {\n const packageJson = await readPackage({ cwd: root });\n\n const vite = await createServer({\n root,\n configFile: false,\n logger,\n server: { middlewareMode: true, watch: { ignored: [\"**/.ph/**\"] } },\n appType: \"custom\",\n build: {\n rollupOptions: {\n input: [],\n },\n },\n resolve: {\n tsconfigPaths: true,\n alias: {\n [packageJson.name]: root,\n },\n },\n plugins: [\n // cast: the plugin ships types built against an older vite, and the\n // mismatched Plugin type crashes tsc 6 during assignability checking\n viteCommonjs() as PluginOption,\n {\n name: \"suppress-hmr\",\n handleHotUpdate() {\n return []; // return empty array to suppress server refresh\n },\n },\n ],\n });\n\n return vite;\n}\n"],"names":["#loadDocumentModelsWithDebounce","#loadDocumentModels"],"mappings":";;;;;;;;;AAqBA,SAAgB,iBAAiB,QAAiB,SAAS,IAAI;CAC7D,MAAM,eAAe,aAAa,QAAQ,EACxC,QACD,CAAC;AACF,cAAa,OAAO,OAAO;AAC3B,cAAa,OAAO,OAAO;AAC3B,cAAa,QAAQ,OAAO;AAC5B,QAAO;;AAGT,IAAa,oBAAb,MAAa,kBAAwD;CACnE,SAA0B,YAAY,CAAC,eAAe,cAAc,CAAC;CAErE;CAEA,OAAgB;CAEhB,OAAO,MAAM,MAAqB;AAChC,SAAO,IAAI,kBAAkB,KAAK;;CAGpC,YAAY,MAAqB;AAC/B,OAAK,OAAO;;CAGd,sBAA8B,YAA4B;AACxD,SAAO,KAAK,MAAM,KAAK,YAAY,oBAAoB;;CAGzD,iBAAyB,YAA4B;AACnD,SAAO,KAAK,MAAM,KAAK,YAAY,cAAc;;CAGnD,kBAA0B,YAA4B;AACpD,SAAO,KAAK,MAAM,KAAK,YAAY,eAAe;;CAGpD,mBAA0B,YAAoB,YAAY,OAAO;AAC/D,SAAO,MAAA,+BAAqC,WAAW,WAAW;;CAGpE,kCAAkC,SAChC,MAAA,mBAAyB,KAAK,KAAK,EACnC,IACD;CAED,OAAA,mBACE,YACgC;EAChC,MAAM,WAAW,KAAK,sBAAsB,WAAW;AACvD,OAAK,OAAO,MAAM,gCAAgC,SAAS;AAE3D,M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K,QAAQ,IAAI,UAAU,SAAS;;;CAI7C,mBACE,YACA,SACA,SACY;EACZ,MAAM,iBAAiB,KAAK,kBAAkB,WAAW;EACzD,MAAM,WAAW,OAAO,gBAAwB;AAC9C,OAAI,UAAU,gBAAgB,YAAY,CAExC,SADmB,MAAM,KAAK,eAAe,WAAW,CACrC;;AAMvB,OAAK,KAAK,QAAQ,GAAG,UAAU,SAAS;AACxC,OAAK,KAAK,QAAQ,GAAG,OAAO,SAAS;AACrC,OAAK,KAAK,QAAQ,GAAG,UAAU,SAAS;AAExC,eAAa;AACX,QAAK,KAAK,QAAQ,IAAI,UAAU,SAAS;AACzC,QAAK,KAAK,QAAQ,IAAI,OAAO,SAAS;AACtC,QAAK,KAAK,QAAQ,IAAI,UAAU,SAAS;;;;AAK/C,eAAsB,gBAAgB,MAAc,QAAiB;AAiCnE,QA9Ba,MAAM,aAAa;EAC9B;EACA,YAAY;EACZ;EACA,QAAQ;GAAE,gBAAgB;GAAM,OAAO,EAAE,SAAS,CAAC,YAAY,EAAE;GAAE;EACnE,SAAS;EACT,OAAO,EACL,eAAe,EACb,OAAO,EAAE,EACV,EACF;EACD,SAAS;GACP,eAAe;GACf,OAAO,IAfS,MAAM,YAAY,EAAE,KAAK,MAAM,CAAC,EAgBjC,OAAO,MACrB;GACF;EACD,SAAS,CAGP,cAAc,EACd;GACE,MAAM;GACN,kBAAkB;AAChB,WAAO,EAAE;;GAEZ,CACF;EACF,CAAC","debug_id":"e3971ec2-a824-5da6-9a2a-805e72db81bf"}
|
|
1
|
+
{"version":3,"file":"vite-loader.mjs","sources":["../../../src/packages/vite-loader.mts"],"sourcesContent":["import { viteCommonjs } from \"@originjs/vite-plugin-commonjs\";\nimport type {\n ProcessorFactoryBuilder,\n SubgraphClass,\n} from \"@powerhousedao/reactor-api\";\nimport type {\n DocumentModelModule,\n UpgradeManifest,\n} from \"@powerhousedao/shared/document-model\";\nimport { getCodegenStatusRegistry } from \"@powerhousedao/shared/processors\";\nimport { childLogger, type ILogger } from \"document-model\";\nimport path from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\nimport { readPackage } from \"read-pkg\";\nimport type { Logger, PluginOption, ViteDevServer } from \"vite\";\nimport { createLogger, createServer } from \"vite\";\nimport { extractDocumentModels } from \"./document-model-detection.js\";\nimport { type ScalarExport, scalarExportsOf } from \"./scalar-exports.js\";\nimport { extractSubgraphs } from \"./subgraph-extraction.js\";\nimport {\n BUILT_PIECE_LIST,\n PIECES_SUBPATH,\n packageRootOf,\n pieceListLocation,\n piecesFromListModule,\n} from \"./pieces.js\";\nimport type {\n ISubscribablePackageLoader,\n ISubscriptionOptions,\n PackagePieceEntry,\n} from \"./types.js\";\nimport {\n PACKAGE_MODULE_FAILED,\n debounce,\n extractUpgradeManifests,\n failedLoadHeader,\n isSubpath,\n} from \"./util.js\";\nimport { runDetached, type ReportError } from \"../utils/detached.js\";\n\nexport function createViteLogger(logger: ILogger, prefix = \"\") {\n const customLogger = createLogger(\"info\", {\n prefix,\n });\n // Wrapped rather than assigned: the logger methods are bound to their own\n // instance, and re-homing them onto Vite's logger object made every Vite\n // log line throw.\n //\n // Vite's text goes through as a replacement, never as the format string: it\n // is somebody else's prose, not a template. `ILogger` substitutes `@token`,\n // and Vite log lines are full of npm scopes, so `pre-transforming\n // @powerhousedao/design-system` came out as `pre-transforming\n // null/design-system`. Substituting into `@line` instead emits it verbatim.\n //\n // Vite's second argument is dropped for the same reason. It is `LogOptions`\n // -- `{ clear, timestamp }` -- and forwarding it made it the replacement for\n // whatever `@token` the line happened to contain, or got appended as JSON.\n // Only `error` keeps it, where it carries the error itself.\n customLogger.info = (msg) => logger.info(\"@line\", msg);\n customLogger.warn = (msg) => logger.warn(\"@line\", msg);\n customLogger.error = (msg, options) =>\n options?.error\n ? logger.error(\"@line\", msg, options.error)\n : logger.error(\"@line\", msg);\n return customLogger;\n}\n\nexport interface VitePackageLoaderOptions {\n /** Modules, as paths or file URLs, whose dependencies a package the project\n * does not install may resolve from. This loader's own module always is. */\n resolveFrom?: string[];\n reportError?: ReportError;\n}\n\ninterface LoadedModule {\n id: string;\n namespace: Record<string, unknown>;\n}\n\nconst FILE_EVENTS = [\"change\", \"add\", \"unlink\"] as const;\n\nexport class VitePackageLoader implements ISubscribablePackageLoader {\n private readonly logger = childLogger([\"reactor-api\", \"vite-loader\"]);\n\n private readonly vite: ViteDevServer;\n\n private readonly importers: string[];\n\n readonly #reportError?: ReportError;\n\n // One watcher listener per event for every subscription, so Vite's watcher\n // stays under its listener limit however many packages are watched.\n readonly #fileListeners = new Set<(changedPath: string) => void>();\n\n readonly name = \"VitePackageLoader\";\n\n static build(vite: ViteDevServer, options?: VitePackageLoaderOptions) {\n return new VitePackageLoader(vite, options);\n }\n\n constructor(vite: ViteDevServer, options: VitePackageLoaderOptions = {}) {\n this.vite = vite;\n this.importers = [...(options.resolveFrom ?? []), import.meta.url].map(\n (from) => (from.startsWith(\"file:\") ? fileURLToPath(from) : from),\n );\n this.#reportError = options.reportError;\n }\n\n // The project first, then the host's own dependencies. A bare name or a path\n // Vite cannot resolve is a package without that module, not an error.\n async #resolve(identifier: string, subpath: string) {\n const aliased = path.isAbsolute(identifier)\n ? undefined\n : this.aliasedRoot(identifier);\n const specifier = path.posix.join(aliased ?? identifier, subpath);\n const bare = !aliased && !path.isAbsolute(identifier);\n const importers = bare ? [undefined, ...this.importers] : [undefined];\n const container = this.vite.environments.ssr.pluginContainer;\n for (const importer of importers) {\n try {\n const resolved = await container.resolveId(specifier, importer);\n if (resolved && !resolved.external) return resolved.id;\n } catch (e) {\n this.logger.debug(\"Could not resolve @specifier: @error\", specifier, e);\n }\n }\n return undefined;\n }\n\n // Resolved before it is loaded, so only a module that exists and fails is\n // reported and thrown; one a package does not have is a debug-level miss.\n async #load(\n identifier: string,\n subpath: string,\n kind: string,\n ): Promise<LoadedModule | undefined> {\n const id = await this.#resolve(identifier, subpath);\n if (id === undefined) {\n this.logger.debug(\"No @subpath module in @pkg\", subpath, identifier);\n return undefined;\n }\n try {\n const namespace = (await this.vite.ssrLoadModule(id)) as Record<\n string,\n unknown\n >;\n return { id, namespace };\n } catch (e) {\n const message = e instanceof Error ? e.message : String(e);\n this.logger.error(\n `${failedLoadHeader(kind)}\\n @id: @error`,\n identifier,\n id,\n message,\n );\n // Tagged: vite's own code can read as a package without the module.\n throw Object.assign(\n new Error(`Failed to load ${id}: ${message}`, { cause: e }),\n { code: PACKAGE_MODULE_FAILED },\n );\n }\n }\n\n private getDocumentModelsPath(identifier: string): string {\n return path.posix.join(identifier, \"./document-models\");\n }\n\n private getSubgraphsPath(identifier: string): string {\n return path.posix.join(identifier, \"./subgraphs\");\n }\n\n private getScalarsPath(identifier: string): string {\n return path.posix.join(identifier, \"./scalars\");\n }\n\n private getProcessorsPath(identifier: string): string {\n return path.posix.join(identifier, \"./processors\");\n }\n\n private getPiecesPath(identifier: string): string {\n return path.posix.join(identifier, `./${PIECES_SUBPATH}`);\n }\n\n // The dev server aliases the local project by its own package name, so a\n // package that is this project is rooted at the source tree vite serves.\n private aliasedRoot(identifier: string): string | undefined {\n const alias = this.vite.config.resolve.alias;\n const entries = Array.isArray(alias) ? alias : [];\n const hit = entries.find((entry) => entry.find === identifier);\n return typeof hit?.replacement === \"string\" ? hit.replacement : undefined;\n }\n\n // What a declared piece path is relative to. Not the module vite loaded: a\n // list read from source still points at the built output beside it.\n private pieceRoot(identifier: string, listId?: string): string | undefined {\n if (!path.isAbsolute(identifier)) {\n const aliased = this.aliasedRoot(identifier);\n if (aliased) return aliased;\n // A built list resolved from wherever the package is installed.\n if (listId) return packageRootOf(path.dirname(listId));\n }\n try {\n return pieceListLocation(identifier).root;\n } catch {\n return undefined;\n }\n }\n\n async loadDocumentModels(identifier: string): Promise<DocumentModelModule[]> {\n this.logger.debug(\n \"Loading document models from\",\n this.getDocumentModelsPath(identifier),\n );\n const loaded = await this.#load(\n identifier,\n \"document-models\",\n \"document models\",\n );\n if (!loaded) return [];\n\n const documentModels = extractDocumentModels(loaded.namespace);\n this.logger.verbose(\n ` ➜ Loaded ${documentModels.length} Document Models from: ${identifier}`,\n );\n return documentModels;\n }\n\n async loadUpgradeManifests(\n identifier: string,\n ): Promise<UpgradeManifest<readonly number[]>[]> {\n // Projects generated before the aggregate index re-exported the\n // manifests only expose them at document-models/upgrade-manifests.\n for (const subpath of [\n \"document-models\",\n \"document-models/upgrade-manifests\",\n ]) {\n const loaded = await this.#load(identifier, subpath, \"upgrade manifests\");\n if (!loaded) continue;\n const manifests = extractUpgradeManifests(loaded.namespace);\n if (manifests.length > 0) {\n this.logger.verbose(\n ` ➜ Loaded ${manifests.length} Upgrade Manifests from: ${identifier}`,\n );\n return manifests;\n }\n }\n return [];\n }\n\n async loadSubgraphs(identifier: string): Promise<SubgraphClass[]> {\n this.logger.verbose(\n \"Loading subgraphs from\",\n this.getSubgraphsPath(identifier),\n );\n const loaded = await this.#load(identifier, \"subgraphs\", \"subgraphs\");\n if (!loaded) return [];\n\n const subgraphs = extractSubgraphs(loaded.namespace);\n\n this.logger.debug(\n ` ➜ Loaded ${subgraphs.length} Subgraphs from: ${identifier}`,\n );\n\n return subgraphs;\n }\n\n async loadScalars(identifier: string): Promise<ScalarExport[]> {\n this.logger.verbose(\n \"Loading scalars from\",\n this.getScalarsPath(identifier),\n );\n const loaded = await this.#load(identifier, \"scalars\", \"scalars\");\n if (!loaded) return [];\n const scalars = scalarExportsOf(loaded.namespace);\n this.logger.debug(\n ` ➜ Loaded ${scalars.length} Scalars from: ${identifier}`,\n );\n return scalars;\n }\n\n async loadProcessors(\n identifier: string,\n ): Promise<ProcessorFactoryBuilder | null> {\n this.logger.verbose(\n \"Loading processors from\",\n this.getProcessorsPath(identifier),\n );\n const loaded = await this.#load(identifier, \"processors\", \"processors\");\n const factory = loaded?.namespace.processorFactory;\n if (typeof factory === \"function\") {\n this.logger.verbose(` ➜ Loaded Processor Factory from: ${identifier}`);\n return factory as ProcessorFactoryBuilder;\n }\n\n this.logger.verbose(` ➜ No Processor Factory found for: ${identifier}`);\n return null;\n }\n\n // The list only, never a piece: in dev it is usually the TypeScript source,\n // and what it names is still the built bundle a worker will load.\n async loadPieces(identifier: string): Promise<PackagePieceEntry[]> {\n this.logger.verbose(\"Loading pieces from\", this.getPiecesPath(identifier));\n const loaded = await this.#load(identifier, PIECES_SUBPATH, \"pieces\");\n if (!loaded) return [];\n\n const root = this.pieceRoot(identifier, loaded.id);\n if (root === undefined) {\n this.logger.debug(` ➜ No package root found for: ${identifier}`);\n return [];\n }\n\n const pieces = piecesFromListModule(loaded.namespace, {\n root,\n identifier,\n logger: this.logger,\n });\n this.logger.debug(\n ` ➜ Loaded ${pieces.length} Pieces from: ${identifier}`,\n );\n return pieces;\n }\n\n // One detached reload per burst of file events. \"add\" and \"unlink\" too, or a\n // removed entry never reports empty and its registrations leak. Once\n // unsubscribed, no pending or running reload reaches `handler`, and a\n // failed load leaves the last good set.\n #watch<T>(\n label: string,\n reported: { pkg: string; kind: string },\n matches: (changedPath: string) => unknown,\n load: () => Promise<T>,\n handler: (value: T) => void,\n options?: ISubscriptionOptions,\n ): () => void {\n let subscribed = true;\n // Read by reactor-mcp's getCodegenStatus, e.g. for broken generated code.\n const report = (failure?: string) =>\n getCodegenStatusRegistry().reportLoad(\n reported.pkg,\n reported.kind,\n failure,\n );\n const reloadOnce = debounce(\n () =>\n runDetached(\n label,\n async () => {\n if (!subscribed) return;\n let value: T;\n try {\n value = await load();\n } catch (e) {\n if ((e as NodeJS.ErrnoException).code === PACKAGE_MODULE_FAILED) {\n report(`[${this.name}] ${(e as Error).message}`);\n return;\n }\n throw e;\n }\n report();\n if (subscribed) handler(value);\n },\n { logger: this.logger, report: this.#reportError },\n ),\n options?.debounce ?? 100,\n );\n const listener = (changedPath: string) => {\n if (matches(changedPath)) void reloadOnce();\n };\n if (this.#fileListeners.size === 0) {\n for (const event of FILE_EVENTS) {\n this.vite.watcher.on(event, this.#dispatchFileEvent);\n }\n }\n this.#fileListeners.add(listener);\n\n return () => {\n subscribed = false;\n if (!this.#fileListeners.delete(listener)) return;\n if (this.#fileListeners.size > 0) return;\n for (const event of FILE_EVENTS) {\n this.vite.watcher.off(event, this.#dispatchFileEvent);\n }\n };\n }\n\n readonly #dispatchFileEvent = (changedPath: string) => {\n for (const listener of [...this.#fileListeners]) listener(changedPath);\n };\n\n onDocumentModelsChange(\n identifier: string,\n handler: (documentModels: DocumentModelModule[]) => void,\n options?: ISubscriptionOptions,\n ): () => void {\n const watched = [\n this.getDocumentModelsPath(identifier),\n this.getScalarsPath(identifier),\n ];\n return this.#watch(\n `Reloading the document models of ${identifier}`,\n { pkg: identifier, kind: \"document models\" },\n (changedPath) => watched.some((dir) => isSubpath(dir, changedPath)),\n () => this.loadDocumentModels(identifier),\n handler,\n options,\n );\n }\n\n onSubgraphsChange(\n identifier: string,\n handler: (subgraphs: SubgraphClass[]) => void,\n options?: ISubscriptionOptions,\n ): () => void {\n const subgraphsPath = this.getSubgraphsPath(identifier);\n return this.#watch(\n `Reloading the subgraphs of ${identifier}`,\n { pkg: identifier, kind: \"subgraphs\" },\n (changedPath) => isSubpath(subgraphsPath, changedPath),\n () => this.loadSubgraphs(identifier),\n handler,\n options,\n );\n }\n\n onScalarsChange(\n identifier: string,\n handler: (scalars: ScalarExport[]) => void,\n options?: ISubscriptionOptions,\n ): () => void {\n const scalarsPath = this.getScalarsPath(identifier);\n return this.#watch(\n `Reloading the scalars of ${identifier}`,\n { pkg: identifier, kind: \"scalars\" },\n (changedPath) => isSubpath(scalarsPath, changedPath),\n () => this.loadScalars(identifier),\n handler,\n options,\n );\n }\n\n onProcessorsChange(\n identifier: string,\n handler: (processors: ProcessorFactoryBuilder | null) => void,\n options?: ISubscriptionOptions,\n ): () => void {\n const processorsPath = this.getProcessorsPath(identifier);\n return this.#watch(\n `Reloading the processors of ${identifier}`,\n { pkg: identifier, kind: \"processors\" },\n (changedPath) => isSubpath(processorsPath, changedPath),\n () => this.loadProcessors(identifier),\n handler,\n options,\n );\n }\n\n onPiecesChange(\n identifier: string,\n handler: (pieces: PackagePieceEntry[]) => void,\n options?: ISubscriptionOptions,\n ): () => void {\n // Both the source list and the build output: the list says which pieces a\n // package ships, and only the build decides whether one is there to run.\n const watched = [this.getPiecesPath(identifier)];\n const root = this.pieceRoot(identifier);\n if (root !== undefined) {\n watched.push(path.dirname(path.resolve(root, BUILT_PIECE_LIST)));\n }\n return this.#watch(\n `Reloading the pieces of ${identifier}`,\n { pkg: identifier, kind: \"pieces\" },\n (changedPath) => watched.some((dir) => isSubpath(dir, changedPath)),\n () => this.loadPieces(identifier),\n handler,\n options,\n );\n }\n}\n\nconst toSlashes = (file: string) => file.replaceAll(\"\\\\\", \"/\");\n\n/**\n * The project's build output, but for the built piece list `onPiecesChange`\n * watches: its own `dist/` and a Tauri shell's Rust `target/`. On Windows\n * every watched file costs a synchronous `fs.watch` at startup, over a\n * minute for a built project with a built desktop shell.\n */\nexport function ignoreBuildOutputButPieces(root: string) {\n const dist = `${toSlashes(path.resolve(root, \"dist\"))}/`;\n const pieces = toSlashes(path.dirname(path.resolve(root, BUILT_PIECE_LIST)));\n return (file: string) => {\n const at = toSlashes(path.resolve(root, file));\n if (\n at.includes(\"/tauri-shell/target/\") ||\n at.includes(\"/src-tauri/target/\")\n ) {\n return true;\n }\n if (!at.startsWith(dist)) return false;\n // The piece list's folder, what is in it, and the folders leading to it stay watched.\n return !(\n at === pieces ||\n at.startsWith(`${pieces}/`) ||\n pieces.startsWith(`${at}/`)\n );\n };\n}\n\nexport async function startViteServer(root: string, logger?: Logger) {\n const packageJson = await readPackage({ cwd: root });\n\n const vite = await createServer({\n root,\n configFile: false,\n customLogger: logger,\n server: {\n middlewareMode: true,\n // It loads modules, never serves a page: no HMR, and no WebSocket port\n // (24678 by default) for a second project's Vetra to collide on.\n hmr: false,\n ws: false,\n watch: { ignored: [\"**/.ph/**\", ignoreBuildOutputButPieces(root)] },\n },\n appType: \"custom\",\n // Its own cache, and no client deps to optimize: Studio's cache is the\n // project's node_modules/.vite, which it would otherwise rewrite.\n cacheDir: path.join(root, \"node_modules\", \".vite-reactor\"),\n optimizeDeps: { noDiscovery: true, include: [], entries: [] },\n build: {\n rollupOptions: {\n input: [],\n },\n },\n resolve: {\n tsconfigPaths: true,\n alias: {\n [packageJson.name]: root,\n },\n },\n plugins: [\n // cast: the plugin ships types built against an older vite, and the\n // mismatched Plugin type crashes tsc 6 during assignability checking\n viteCommonjs() as PluginOption,\n {\n name: \"suppress-hmr\",\n handleHotUpdate() {\n return []; // return empty array to suppress server refresh\n },\n },\n ],\n });\n\n return vite;\n}\n"],"names":[],"mappings":";;;;;;;;;;;AAwCA,SAAgB,iBAAiB,QAAiB,SAAS,IAAI;CAC7D,MAAM,eAAe,aAAa,QAAQ,EACxC,OACF,CAAC;CAeD,aAAa,QAAQ,QAAQ,OAAO,KAAK,SAAS,GAAG;CACrD,aAAa,QAAQ,QAAQ,OAAO,KAAK,SAAS,GAAG;CACrD,aAAa,SAAS,KAAK,YACzB,SAAS,QACL,OAAO,MAAM,SAAS,KAAK,QAAQ,KAAK,IACxC,OAAO,MAAM,SAAS,GAAG;CAC/B,OAAO;AACT;AAcA,MAAM,cAAc;CAAC;CAAU;CAAO;AAAQ;AAE9C,IAAa,oBAAb,MAAa,kBAAwD;CACnE,SAA0B,YAAY,CAAC,eAAe,aAAa,CAAC;CAEpE;CAEA;CAEA;CAIA,iCAA0B,IAAI,IAAmC;CAEjE,OAAgB;CAEhB,OAAO,MAAM,MAAqB,SAAoC;EACpE,OAAO,IAAI,kBAAkB,MAAM,OAAO;CAC5C;CAEA,YAAY,MAAqB,UAAoC,CAAC,GAAG;EACvE,KAAK,OAAO;EACZ,KAAK,YAAY,CAAC,GAAI,QAAQ,eAAe,CAAC,GAAI,YAAY,GAAG,CAAC,CAAC,KAChE,SAAU,KAAK,WAAW,OAAO,IAAI,cAAc,IAAI,IAAI,IAC9D;EACA,KAAK,eAAe,QAAQ;CAC9B;CAIA,MAAM,SAAS,YAAoB,SAAiB;EAClD,MAAM,UAAU,KAAK,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