veryfront 0.1.801 → 0.1.804
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/esm/deno.js +1 -1
- package/esm/src/agent/hosted/veryfront-cloud-agent-service.d.ts.map +1 -1
- package/esm/src/agent/hosted/veryfront-cloud-agent-service.js +2 -1
- package/esm/src/agent/runtime/load-skill-tool.d.ts +1 -0
- package/esm/src/agent/runtime/load-skill-tool.d.ts.map +1 -1
- package/esm/src/agent/runtime/load-skill-tool.js +37 -5
- package/esm/src/html/utils.d.ts.map +1 -1
- package/esm/src/html/utils.js +2 -1
- package/esm/src/release-assets/build-executor.d.ts.map +1 -1
- package/esm/src/release-assets/build-executor.js +107 -1
- package/esm/src/utils/version-constant.d.ts +1 -1
- package/esm/src/utils/version-constant.js +1 -1
- package/package.json +1 -1
package/esm/deno.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"veryfront-cloud-agent-service.d.ts","sourceRoot":"","sources":["../../../../src/src/agent/hosted/veryfront-cloud-agent-service.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAAM,wBAAwB,CAAC;AAiB9E,OAAO,EAGL,KAAK,WAAW,EAIjB,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"veryfront-cloud-agent-service.d.ts","sourceRoot":"","sources":["../../../../src/src/agent/hosted/veryfront-cloud-agent-service.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAAM,wBAAwB,CAAC;AAiB9E,OAAO,EAGL,KAAK,WAAW,EAIjB,MAAM,qBAAqB,CAAC;AAiB7B,OAAO,EAGL,KAAK,0BAA0B,EAChC,MAAM,yBAAyB,CAAC;AAOjC,OAAO,EAAE,KAAK,+BAA+B,EAAE,MAAM,4BAA4B,CAAC;AAClF,OAAO,KAAK,EAAE,gCAAgC,EAAE,MAAM,uCAAuC,CAAC;AAC9F,OAAO,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AYhF;AAqcD,yDAAyD;AACzD,wBAAsB,2CAA2C,CAC/D,OAAO,GAAE,qCAA0C,GAClD,OAAO,CAAC,yBAAyB,CAAC,+CAA+C,CAAC,CAAC,CAKrF;AAED,iDAAiD;AACjD,wBAAsB,mCAAmC,CACvD,OAAO,GAAE,qCAA0C,GAClD,OAAO,CAAC,2BAA2B,CAAC,+CAA+C,CAAC,CAAC,CAgBvF;AAED,4BAA4B;AAC5B,wBAAsB,iBAAiB,CACrC,OAAO,GAAE,qCAA0C,GAClD,OAAO,CAAC,IAAI,CAAC,CAiDf"}
|
|
@@ -10,6 +10,7 @@ import { defineSchema } from "../../schemas/index.js";
|
|
|
10
10
|
import { NodeTelemetryProviderName, } from "../../extensions/observability/index.js";
|
|
11
11
|
import { SandboxShellToolsProviderName, } from "../../extensions/sandbox/index.js";
|
|
12
12
|
import { createRemoteMCPToolSource, createToolsFromRemoteDefinitions, isToolVisibleTo, sleepTool, toolRegistry, } from "../../tool/index.js";
|
|
13
|
+
import { SKILL_TOOL_IDS } from "../../skill/types.js";
|
|
13
14
|
import { parseProviderError } from "../../chat/provider-errors.js";
|
|
14
15
|
import { DEFAULT_PROJECT_DISCOVERY_DIRS } from "../../discovery/index.js";
|
|
15
16
|
import { nodeAdapter } from "../../platform/adapters/node.js";
|
|
@@ -325,7 +326,7 @@ export function getDiscoveredHostTools(scope) {
|
|
|
325
326
|
// Hosted per-agent runs pass their task context identity so owned colocated
|
|
326
327
|
// tools are available to their owner and hidden from other agents.
|
|
327
328
|
return Object.fromEntries([...toolRegistry.getAll()]
|
|
328
|
-
.filter(([, registryTool]) => isToolVisibleTo(registryTool, scope))
|
|
329
|
+
.filter(([toolId, registryTool]) => !SKILL_TOOL_IDS.has(toolId) && isToolVisibleTo(registryTool, scope))
|
|
329
330
|
.sort(([left], [right]) => left.localeCompare(right)));
|
|
330
331
|
}
|
|
331
332
|
function getProjectInstructions(context, lookup) {
|
|
@@ -11,6 +11,7 @@ export type RuntimeLoadSkillToolContext = RuntimeProjectSkillContext & {
|
|
|
11
11
|
availableSkillIds?: readonly string[];
|
|
12
12
|
availableToolNames?: readonly string[];
|
|
13
13
|
loadedSkillResponses?: Record<string, RuntimeLoadedSkillResponse>;
|
|
14
|
+
loadedSkillReferenceResponses?: Record<string, RuntimeLoadSkillReferenceFileOutput>;
|
|
14
15
|
};
|
|
15
16
|
/** Public API contract for runtime load skill builtin store. */
|
|
16
17
|
export type RuntimeLoadSkillBuiltinStore = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"load-skill-tool.d.ts","sourceRoot":"","sources":["../../../../src/src/agent/runtime/load-skill-tool.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kCAAkC,CAAC;AAEpE,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAchD,OAAO,KAAK,EAEV,0BAA0B,EAC1B,yBAAyB,EAC1B,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAGL,KAAK,0BAA0B,EAC/B,KAAK,kCAAkC,EACvC,KAAK,0BAA0B,EAChC,MAAM,qBAAqB,CAAC;AAG7B,yDAAyD;AACzD,eAAO,MAAM,oCAAoC,2mBACqP,CAAC;AAEvS,mDAAmD;AACnD,eAAO,MAAM,8BAA8B,unBAC0a,CAAC;AAatd,2CAA2C;AAC3C,MAAM,MAAM,2BAA2B,GAAG,0BAA0B,GAAG;IACrE,iBAAiB,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACtC,kBAAkB,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACvC,oBAAoB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,0BAA0B,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"load-skill-tool.d.ts","sourceRoot":"","sources":["../../../../src/src/agent/runtime/load-skill-tool.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kCAAkC,CAAC;AAEpE,OAAO,KAAK,E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CAAC;IAC9C,eAAe,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACpC,YAAY,CAAC,EAAE,4BAA4B,CAAC;IAC5C,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,4BAA4B,CAAC;IACxC,MAAM,CAAC,EAAE,0BAA0B,CAAC;CACrC,CAAC;AAEF,eAAO,MAAM,kCAAkC;;;GAS9C,CAAC;AAKF,iDAAiD;AACjD,MAAM,MAAM,yBAAyB,GAAG,WAAW,CACjD,UAAU,CAAC,OAAO,kCAAkC,CAAC,CACtD,CAAC;AAEF,qDAAqD;AACrD,MAAM,MAAM,mCAAmC,GAAG;IAChD,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,4CAA4C;AAC5C,MAAM,MAAM,2BAA2B,GAAG;IACxC,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,2CAA2C;AAC3C,MAAM,MAAM,0BAA0B,GAClC,0BAA0B,GAC1B,mCAAmC,GACnC,2BAA2B,CAAC;AAiOhC,sCAAsC;AACtC,wBAAgB,0BAA0B,CACxC,OAAO,EAAE,2BAA2B,GACnC,IAAI,CAAC,yBAAyB,EAAE,0BAA0B,CAAC,CA8C7D"}
|
|
@@ -85,6 +85,28 @@ function buildMissingSkillError(options, skillId) {
|
|
|
85
85
|
error: `Skill not found: ${skillId}. Available skills: ${available}`,
|
|
86
86
|
};
|
|
87
87
|
}
|
|
88
|
+
function buildAlreadyLoadedSkillReferenceResponse(skillId, file) {
|
|
89
|
+
return {
|
|
90
|
+
skillId,
|
|
91
|
+
file,
|
|
92
|
+
content: `Reference file "${skillId}/${file}" is already loaded in this turn. Do not call load_skill for this file again. ` +
|
|
93
|
+
"Continue from the existing reference content and produce the next useful response now.",
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
function buildRuntimeSkillCacheKey(context, skillId) {
|
|
97
|
+
return JSON.stringify([
|
|
98
|
+
skillId,
|
|
99
|
+
context.projectId ?? null,
|
|
100
|
+
context.branchId ?? null,
|
|
101
|
+
context.skillSourcePaths?.[skillId] ?? null,
|
|
102
|
+
]);
|
|
103
|
+
}
|
|
104
|
+
function buildRuntimeSkillReferenceCacheKey(context, skillId, normalizedFile) {
|
|
105
|
+
return JSON.stringify([
|
|
106
|
+
buildRuntimeSkillCacheKey(context, skillId),
|
|
107
|
+
normalizedFile,
|
|
108
|
+
]);
|
|
109
|
+
}
|
|
88
110
|
function buildRuntimeLoadSkillDescription(options) {
|
|
89
111
|
if (options.description) {
|
|
90
112
|
return options.description;
|
|
@@ -127,13 +149,22 @@ async function loadRuntimeSkillReferenceFile(options, skillId, file) {
|
|
|
127
149
|
if (!normalizedFile) {
|
|
128
150
|
return { error: `Invalid reference file path: ${file}` };
|
|
129
151
|
}
|
|
152
|
+
const loadedSkillReferenceResponses = options.context.loadedSkillReferenceResponses ??= {};
|
|
153
|
+
const referenceKey = buildRuntimeSkillReferenceCacheKey(options.context, skillId, normalizedFile);
|
|
154
|
+
if (loadedSkillReferenceResponses[referenceKey]) {
|
|
155
|
+
return buildAlreadyLoadedSkillReferenceResponse(skillId, normalizedFile);
|
|
156
|
+
}
|
|
130
157
|
const projectFileContent = await options.projectSkillLoader.loadProjectSkillReference(options.context, skillId, normalizedFile);
|
|
131
158
|
if (projectFileContent) {
|
|
132
|
-
|
|
159
|
+
const response = { skillId, file: normalizedFile, content: projectFileContent };
|
|
160
|
+
loadedSkillReferenceResponses[referenceKey] = response;
|
|
161
|
+
return response;
|
|
133
162
|
}
|
|
134
163
|
const localContent = getBuiltinStore(options).readReferenceFile(options.skillsDir, skillId, normalizedFile);
|
|
135
164
|
if (localContent) {
|
|
136
|
-
|
|
165
|
+
const response = { skillId, file: normalizedFile, content: localContent };
|
|
166
|
+
loadedSkillReferenceResponses[referenceKey] = response;
|
|
167
|
+
return response;
|
|
137
168
|
}
|
|
138
169
|
return { error: `Reference file not found: ${skillId}/${normalizedFile}` };
|
|
139
170
|
}
|
|
@@ -152,7 +183,8 @@ export function createRuntimeLoadSkillTool(options) {
|
|
|
152
183
|
return await loadRuntimeSkillReferenceFile(options, skillId, file);
|
|
153
184
|
}
|
|
154
185
|
const loadedSkillResponses = options.context.loadedSkillResponses ??= {};
|
|
155
|
-
const
|
|
186
|
+
const loadedSkillKey = buildRuntimeSkillCacheKey(options.context, skillId);
|
|
187
|
+
const loadedResponse = loadedSkillResponses[loadedSkillKey];
|
|
156
188
|
if (loadedResponse) {
|
|
157
189
|
return buildAlreadyLoadedSkillResponse(skillId, loadedResponse);
|
|
158
190
|
}
|
|
@@ -164,7 +196,7 @@ export function createRuntimeLoadSkillTool(options) {
|
|
|
164
196
|
instructions: projectSkill.instructions,
|
|
165
197
|
references: projectSkill.references,
|
|
166
198
|
});
|
|
167
|
-
loadedSkillResponses[
|
|
199
|
+
loadedSkillResponses[loadedSkillKey] = response;
|
|
168
200
|
return response;
|
|
169
201
|
}
|
|
170
202
|
const localContent = builtinStore.readSkill(options.skillsDir, skillId);
|
|
@@ -175,7 +207,7 @@ export function createRuntimeLoadSkillTool(options) {
|
|
|
175
207
|
instructions: localContent,
|
|
176
208
|
references: builtinStore.listReferences(options.skillsDir, skillId),
|
|
177
209
|
});
|
|
178
|
-
loadedSkillResponses[
|
|
210
|
+
loadedSkillResponses[loadedSkillKey] = response;
|
|
179
211
|
return response;
|
|
180
212
|
}
|
|
181
213
|
return buildMissingSkillError(options, skillId);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/src/html/utils.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAE1D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,sCAAsC,CAAC;AAcjF,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,MAAM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AE,MAAM,CAAC,CAAC;IACvC,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,oBAAoB,CAAC,EAAE,oBAAoB,GAAG,IAAI,CAAC;CACpD;AAgFD,wBAAsB,cAAc,CAClC,OAAO,CAAC,EAAE,qBAAqB,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GACvD,OAAO,CAAC,cAAc,CAAC,CA8DzB;AAED,wBAAsB,kBAAkB,CACtC,OAAO,CAAC,EAAE,qBAAqB,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GACvD,OAAO,CAAC,MAAM,CAAC,CAEjB;AAED,wBAAgB,mBAAmB,IAAI,IAAI,CAE1C;AAED,wBAAgB,mBAAmB,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAElF"}
|
package/esm/src/html/utils.js
CHANGED
|
@@ -228,7 +228,8 @@ function applyManifestDependencies(imports, manifest) {
|
|
|
228
228
|
}
|
|
229
229
|
return [
|
|
230
230
|
specifier,
|
|
231
|
-
dependencyAssets.get(
|
|
231
|
+
dependencyAssets.get(specifier) ?? dependencyAssets.get(url) ??
|
|
232
|
+
dependencyAssets.get(canonicalDependencyUrl(url)) ?? url,
|
|
232
233
|
];
|
|
233
234
|
}));
|
|
234
235
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build-executor.d.ts","sourceRoot":"","sources":["../../../src/src/release-assets/build-executor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;
|
|
1
|
+
{"version":3,"file":"build-executor.d.ts","sourceRoot":"","sources":["../../../src/src/release-assets/build-executor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAwBH,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAsB/C,MAAM,WAAW,sBAAsB;IACrC,yDAAyD;IACzD,gBAAgB,EAAE,MAAM,CAAC;IACzB,oBAAoB;IACpB,SA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ACjB,KAAK,EAAE,OAAO,GAAG,QAAQ,CAAC;IAC1B,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AA+2BD;;;GAGG;AACH,wBAAsB,oBAAoB,CACxC,KAAK,EAAE,sBAAsB,EAC7B,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,uBAAuB,CAAC,CA2ClC"}
|
|
@@ -20,9 +20,10 @@ import { createFileSystem } from "../platform/compat/fs.js";
|
|
|
20
20
|
import { dirname, join, normalize } from "../platform/compat/path/index.js";
|
|
21
21
|
import { resolveFrameworkSourcePath } from "../platform/compat/framework-source-resolver.js";
|
|
22
22
|
import { transformToESM } from "../transforms/esm-transform.js";
|
|
23
|
-
import { cacheHttpImportsToLocal } from "../transforms/esm/http-cache.js";
|
|
23
|
+
import { cacheHttpImportsToLocal, normalizeHttpUrl } from "../transforms/esm/http-cache.js";
|
|
24
24
|
import { extractSourceUrl } from "../transforms/esm/source-url-embed.js";
|
|
25
25
|
import { parseImports, replaceSpecifiers } from "../transforms/esm/lexer.js";
|
|
26
|
+
import { getReactUrls } from "../transforms/esm/package-registry.js";
|
|
26
27
|
import { PLATFORM_UTILITIES } from "../html/utils.js";
|
|
27
28
|
import { extractCandidatesFromFiles } from "../html/styles-builder/candidate-extractor.js";
|
|
28
29
|
import { sha256HexBytes } from "./hash.js";
|
|
@@ -35,6 +36,13 @@ const BROWSER_MODULE_EXTENSIONS = [".tsx", ".ts", ".jsx", ".js", ".mdx"];
|
|
|
35
36
|
/** Directories whose modules are part of the browser closure. */
|
|
36
37
|
const BROWSER_MODULE_DIRS = ["pages/", "components/", "layouts/", "lib/", "src/"];
|
|
37
38
|
const FRAMEWORK_MODULE_URL_PREFIX = "/_vf_modules/_veryfront/";
|
|
39
|
+
const REACT_IMPORT_MAP_DEPENDENCIES = [
|
|
40
|
+
"react",
|
|
41
|
+
"react-dom",
|
|
42
|
+
"react-dom/client",
|
|
43
|
+
"react/jsx-runtime",
|
|
44
|
+
"react/jsx-dev-runtime",
|
|
45
|
+
];
|
|
38
46
|
function frameworkModuleUrlToSourceKey(moduleUrl) {
|
|
39
47
|
if (!moduleUrl.startsWith(FRAMEWORK_MODULE_URL_PREFIX))
|
|
40
48
|
return null;
|
|
@@ -222,6 +230,26 @@ function buildDependencyUrlMap(dependencies, dependencyModules) {
|
|
|
222
230
|
}
|
|
223
231
|
return urls;
|
|
224
232
|
}
|
|
233
|
+
function exposeDependencySpecifierAliases(assets, dependencyModules) {
|
|
234
|
+
const aliased = { ...assets };
|
|
235
|
+
for (const dependency of dependencyModules.values()) {
|
|
236
|
+
const asset = assets[dependency.manifestKey];
|
|
237
|
+
if (!asset)
|
|
238
|
+
continue;
|
|
239
|
+
for (const specifier of dependency.specifiers) {
|
|
240
|
+
const normalized = normalizeDependencySpecifier(specifier);
|
|
241
|
+
if (normalized.startsWith("http://") ||
|
|
242
|
+
normalized.startsWith("https://") ||
|
|
243
|
+
normalized.startsWith("file://") ||
|
|
244
|
+
normalized.startsWith("./") ||
|
|
245
|
+
normalized.startsWith("../")) {
|
|
246
|
+
continue;
|
|
247
|
+
}
|
|
248
|
+
aliased[normalized] = asset;
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
return aliased;
|
|
252
|
+
}
|
|
225
253
|
function dependencyFallbackUrl(dependency) {
|
|
226
254
|
if (dependency.manifestKey.startsWith("http://") ||
|
|
227
255
|
dependency.manifestKey.startsWith("https://")) {
|
|
@@ -261,6 +289,64 @@ function addDependencyModule(dependencies, dependency) {
|
|
|
261
289
|
function normalizeDependencySpecifier(specifier) {
|
|
262
290
|
return specifier.replace(/[?#].*$/, "");
|
|
263
291
|
}
|
|
292
|
+
function dependencyLookupKeys(specifier) {
|
|
293
|
+
const keys = new Set([specifier, normalizeDependencySpecifier(specifier)]);
|
|
294
|
+
if (specifier.startsWith("http://") || specifier.startsWith("https://")) {
|
|
295
|
+
const normalizedHttp = normalizeHttpUrl(specifier);
|
|
296
|
+
keys.add(normalizedHttp);
|
|
297
|
+
keys.add(normalizeDependencySpecifier(normalizedHttp));
|
|
298
|
+
}
|
|
299
|
+
return keys;
|
|
300
|
+
}
|
|
301
|
+
function findDependencyModuleBySpecifier(dependencies, specifier) {
|
|
302
|
+
const lookupKeys = dependencyLookupKeys(specifier);
|
|
303
|
+
for (const key of lookupKeys) {
|
|
304
|
+
const direct = dependencies.get(key);
|
|
305
|
+
if (direct)
|
|
306
|
+
return direct;
|
|
307
|
+
}
|
|
308
|
+
for (const dependency of dependencies.values()) {
|
|
309
|
+
if (lookupKeys.has(dependency.manifestKey)) {
|
|
310
|
+
return dependency;
|
|
311
|
+
}
|
|
312
|
+
for (const dependencySpecifier of dependency.specifiers) {
|
|
313
|
+
for (const key of dependencyLookupKeys(dependencySpecifier)) {
|
|
314
|
+
if (lookupKeys.has(key))
|
|
315
|
+
return dependency;
|
|
316
|
+
}
|
|
317
|
+
if (lookupKeys.has(normalizeDependencySpecifier(dependencySpecifier))) {
|
|
318
|
+
return dependency;
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
return null;
|
|
323
|
+
}
|
|
324
|
+
async function collectReactImportMapDependencyModules(input, tempDir, vendorHttpImports, dependencies) {
|
|
325
|
+
const reactUrls = getReactUrls(input.reactVersion);
|
|
326
|
+
const entries = [];
|
|
327
|
+
for (const specifier of REACT_IMPORT_MAP_DEPENDENCIES) {
|
|
328
|
+
const url = reactUrls[specifier];
|
|
329
|
+
if (url)
|
|
330
|
+
entries.push([specifier, url]);
|
|
331
|
+
}
|
|
332
|
+
const source = entries.map(([, url]) => `import ${JSON.stringify(url)};`).join("\n");
|
|
333
|
+
if (!source)
|
|
334
|
+
return;
|
|
335
|
+
const vendored = await vendorHttpImports(source, {
|
|
336
|
+
tempDir,
|
|
337
|
+
reactVersion: input.reactVersion,
|
|
338
|
+
});
|
|
339
|
+
for (const dependency of vendored.dependencies) {
|
|
340
|
+
addDependencyModule(dependencies, dependency);
|
|
341
|
+
}
|
|
342
|
+
for (const [specifier, url] of entries) {
|
|
343
|
+
const dependency = findDependencyModuleBySpecifier(dependencies, url);
|
|
344
|
+
if (!dependency) {
|
|
345
|
+
throw new Error(`React import-map dependency missing: ${specifier}`);
|
|
346
|
+
}
|
|
347
|
+
dependency.specifiers.add(specifier);
|
|
348
|
+
}
|
|
349
|
+
}
|
|
264
350
|
function resolveLocalDependencyPath(specifier, parentFilePath) {
|
|
265
351
|
const normalized = normalizeDependencySpecifier(specifier);
|
|
266
352
|
if (normalized.startsWith("file://")) {
|
|
@@ -775,6 +861,25 @@ async function runBuildInner(input, tempDir, client, transform) {
|
|
|
775
861
|
}
|
|
776
862
|
transformedModules.set(logicalPath, { logicalPath, code });
|
|
777
863
|
}
|
|
864
|
+
try {
|
|
865
|
+
await collectReactImportMapDependencyModules(input, tempDir, vendorHttpImports, dependencyModules);
|
|
866
|
+
}
|
|
867
|
+
catch (error) {
|
|
868
|
+
const sanitized = sanitizeError(error);
|
|
869
|
+
logger.warn("React import-map dependency vendoring failed during release asset build", {
|
|
870
|
+
error: sanitized,
|
|
871
|
+
});
|
|
872
|
+
await client.reportReleaseAssetManifestState(input.releaseVersionRef, "failed", sanitized);
|
|
873
|
+
return {
|
|
874
|
+
success: false,
|
|
875
|
+
state: "failed",
|
|
876
|
+
moduleCount: 0,
|
|
877
|
+
cssCount: 0,
|
|
878
|
+
routeCount: 0,
|
|
879
|
+
gaps,
|
|
880
|
+
error: sanitized,
|
|
881
|
+
};
|
|
882
|
+
}
|
|
778
883
|
const frameworkDependencies = await buildFrameworkDependencies(input, tempDir, transform, uploadQueue, pendingBytes, gaps);
|
|
779
884
|
let httpDependencies;
|
|
780
885
|
let httpDependencyFallbackUrls;
|
|
@@ -799,6 +904,7 @@ async function runBuildInner(input, tempDir, client, transform) {
|
|
|
799
904
|
error: sanitized,
|
|
800
905
|
};
|
|
801
906
|
}
|
|
907
|
+
httpDependencies = exposeDependencySpecifierAliases(httpDependencies, dependencyModules);
|
|
802
908
|
const dependencies = { ...frameworkDependencies, ...httpDependencies };
|
|
803
909
|
const dependencyUrls = buildDependencyUrlMap(dependencies, dependencyModules);
|
|
804
910
|
for (const [specifier, url] of httpDependencyFallbackUrls) {
|