@vite-hub/workspace 0.7.0 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/blob-database.js +2 -2
- package/dist/checkout.d.ts +0 -6
- package/dist/checkout.js +1 -30
- package/dist/{config--ZzAvhMp.js → config-B-S_Z4G0.js} +6 -15
- package/dist/durability.js +2 -2
- package/dist/{error-diagnostics-CHgE8TQM.js → error-diagnostics-Dn4sQcKL.js} +3 -4
- package/dist/{file-DQ5-TBTD.js → file-B3KxJyxb.js} +1 -1
- package/dist/{files-D1UkSjzX.js → files-DSOjTK36.js} +1 -1
- package/dist/files.d.ts +0 -6
- package/dist/files.js +4 -4
- package/dist/{github-BECfOMaw.js → github-DDUrrKt8.js} +3 -3
- package/dist/{glob-BIsxLusH.js → glob-BfZVRPCk.js} +1 -1
- package/dist/{host-BYBRcSnh.js → host-CcCDXyJI.js} +3 -3
- package/dist/hosted-vercel-blob.js +4 -4
- package/dist/hosted.js +5 -20
- package/dist/index.js +12 -12
- package/dist/internal/path.js +1 -1
- package/dist/internal/workspace.js +2 -2
- package/dist/{lifecycle-BK7WNfcP.js → lifecycle-CXiS7Dks.js} +4 -4
- package/dist/loader.js +1 -1
- package/dist/{mcp-resources-F4SJF4_P.js → mcp-resources-B2J0YCD2.js} +1 -1
- package/dist/{metadata-target-DPGF6L68.js → metadata-target-oc00D8g2.js} +2 -8
- package/dist/{object-CAK6UYR5.js → object-DNOrQSl5.js} +5 -1
- package/dist/{operations-DJ_7W0gs.js → operations-DWPC8nrk.js} +3 -11
- package/dist/operations.js +22 -16
- package/dist/{provider-fcI7kJ5k.js → provider-DBJeUNFI.js} +27 -28
- package/dist/providers/github/store.js +3 -35
- package/dist/{registry-CFeUQsja.js → registry-CqDWpDe9.js} +2 -2
- package/dist/{request-scope-jH4H0Sbm.js → request-scope-DZJbe-tP.js} +0 -2
- package/dist/{rule-keys-xMpiTLq1.js → rule-keys-DQYcSewo.js} +1 -1
- package/dist/{rules-DYQCKYdt.js → rules-sItt6TP-.js} +2 -10
- package/dist/runtime/request.js +1 -1
- package/dist/runtime/state.js +6 -6
- package/dist/runtime/workspace.js +1 -1
- package/dist/runtime.js +13 -13
- package/dist/server.js +4 -4
- package/dist/{shared-PFnkYidS.js → shared-CaAKcBBr.js} +10 -14
- package/dist/source-metadata.js +3 -3
- package/dist/{sync-CUkCuP_g.js → sync-ztyvA0Va.js} +3 -3
- package/dist/test.js +1 -1
- package/dist/{use-BCMkT-kC.js → use-BskfWVjx.js} +6 -6
- package/dist/{use-tools-CcXs2hFA.js → use-tools-D_eorKu1.js} +3 -3
- package/dist/{utils-Bv1NBg8r.js → utils-BoFJcaT1.js} +2 -3
- package/dist/vite.js +155 -121
- package/dist/{workspace-D1m00MCM.js → workspace-Dbo5iYIc.js} +10 -10
- package/dist/{workspace-inspection-scanner-BlJ8bCAB.js → workspace-inspection-scanner-6QrvwVJG.js} +0 -5
- package/package.json +12 -12
package/dist/vite.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { n as __exportAll$1, r as __toESM, t as __commonJSMin } from "./rolldown-runtime-DnNXxpGL.js";
|
|
2
2
|
import { C as resolve$1, S as relative$1, _ as requireViteHubDevServerUrl, a as createNativePackageLoading, b as dirname$1, c as generatedViteHubWatchIgnoredAddition, d as publishViteHubDevServer, f as resolveViteHubProjectRoot, g as readViteHubDevTargetOption, h as fetchViteHubDevEndpoint, l as isProductionBuild, m as discoverViteHubDevServer, o as createNoExternalAddition, p as shouldSkipViteProviderBuild, r as VITEHUB_PROJECT_ROOT, s as createViteHubEnvImportAliases, t as callOperationFromCli, u as isServerEnvironment, v as redactInspectionText, workspaceOperations, x as isAbsolute$1, y as relativeDefinitionFile } from "./operations.js";
|
|
3
3
|
import { t as internalErrorDiagnostics } from "./error-diagnostics-CsiNo_oI.js";
|
|
4
|
-
import { n as isRecordOrFunction, t as
|
|
4
|
+
import { n as isRecord, r as isRecordOrFunction, t as isObject } from "./object-DNOrQSl5.js";
|
|
5
5
|
import { ensureWorkspaceDevToken, readWorkspaceDevToken, refreshWorkspaceDevToken, runWorkspaceDevCommand, t as isViteHubSecretEqual, validateWorkspaceDevToken, workspaceDevHeader, workspaceDevRoute, workspaceDevTokenHeader, workspaceDevTokenServerId } from "./server.js";
|
|
6
|
-
import { n as syncWorkspaceDefinition } from "./lifecycle-
|
|
7
|
-
import { a as normalizeWorkspaceSources, n as createSourceContext } from "./config
|
|
6
|
+
import { n as syncWorkspaceDefinition } from "./lifecycle-CXiS7Dks.js";
|
|
7
|
+
import { a as normalizeWorkspaceSources, n as createSourceContext } from "./config-B-S_Z4G0.js";
|
|
8
8
|
import { normalizeSafeWorkspacePath } from "./internal/path.js";
|
|
9
9
|
import { t as createMemoryWorkspaceStore } from "./memory-BCZl_ZsJ.js";
|
|
10
|
-
import { t as workspaceErrorDiagnostics } from "./error-diagnostics-
|
|
10
|
+
import { t as workspaceErrorDiagnostics } from "./error-diagnostics-Dn4sQcKL.js";
|
|
11
11
|
import { assertNoSymlinks, checkoutFailure, conflictMarkerPatterns, folderOf, formatWorkspaceStatus, ignoredName, localCheckoutStatus, pullWorkspaces, pushWorkspaces, resolveWorkspaceConflicts, workspaceLockFile, workspaceStatus } from "./checkout.js";
|
|
12
|
-
import { n as isWorkspaceStore, r as normalizeWorkspaceStoreOptions } from "./provider-
|
|
13
|
-
import { c as workspaceRegistryLoadError, n as normalizeWorkspaceDefinition } from "./registry-
|
|
12
|
+
import { n as isWorkspaceStore, r as normalizeWorkspaceStoreOptions } from "./provider-DBJeUNFI.js";
|
|
13
|
+
import { c as workspaceRegistryLoadError, n as normalizeWorkspaceDefinition } from "./registry-CqDWpDe9.js";
|
|
14
14
|
import { installHostedWorkspaceRuntime } from "./hosted.js";
|
|
15
15
|
import { installHostedVercelBlobWorkspaceRuntime } from "./hosted-vercel-blob.js";
|
|
16
16
|
import { createRequire, isBuiltin } from "node:module";
|
|
@@ -36,7 +36,7 @@ const workspaceConfigKeys = /* @__PURE__ */ new Set([
|
|
|
36
36
|
]);
|
|
37
37
|
function normalizeWorkspaceOptions(options, input = {}) {
|
|
38
38
|
if (options === false) return false;
|
|
39
|
-
if (typeof options !== "undefined" && !isRecord
|
|
39
|
+
if (typeof options !== "undefined" && !isRecord(options)) throw workspaceErrorDiagnostics.WORKSPACE_C0001({ message: "`workspace` must be a plain object." });
|
|
40
40
|
const resolvedOptions = options || {};
|
|
41
41
|
const unsupported = Object.keys(resolvedOptions).filter((key) => !workspaceConfigKeys.has(key));
|
|
42
42
|
if (unsupported.length) throw workspaceErrorDiagnostics.WORKSPACE_C0002({ message: `[vitehub] workspace config does not support option${unsupported.length === 1 ? "" : "s"}: ${unsupported.join(", ")}.` });
|
|
@@ -377,11 +377,9 @@ function isRelativeSpecifier(path) {
|
|
|
377
377
|
function isBareSpecifier(id) {
|
|
378
378
|
return !/^(?:\.{1,2}(?:[\\/]|$)|[\\/]|[A-Za-z]:[\\/]|\0|#|[a-z][a-z0-9+.-]*:)/i.test(id);
|
|
379
379
|
}
|
|
380
|
-
/** The folder that a relative import of `importer` resolves from, as esbuild's `resolveDir`. */
|
|
381
380
|
function importerDir(importer, workingDir) {
|
|
382
381
|
return importer && isAbsolute(importer) ? dirname(importer) : workingDir;
|
|
383
382
|
}
|
|
384
|
-
/** Rolldown resolves a specifier from an importer file. A bundle entry has none, so use a file in the working folder. */
|
|
385
383
|
function importerFor(importer, workingDir) {
|
|
386
384
|
return importer ?? join(workingDir, "__vitehub_entry__.js");
|
|
387
385
|
}
|
|
@@ -390,9 +388,9 @@ function isFileResolution(resolved) {
|
|
|
390
388
|
}
|
|
391
389
|
function collectPackageExportCandidates(packageName, exportsValue, packageRelativePath) {
|
|
392
390
|
if (typeof exportsValue === "string") return normalizePathSeparators(exportsValue).replace(/^\.\//, "") === packageRelativePath ? [packageName] : [];
|
|
393
|
-
if (!Array.isArray(exportsValue) && !isRecord
|
|
391
|
+
if (!Array.isArray(exportsValue) && !isRecord(exportsValue)) return [];
|
|
394
392
|
const candidates = [];
|
|
395
|
-
const exportEntries = isRecord
|
|
393
|
+
const exportEntries = isRecord(exportsValue) && Object.keys(exportsValue).some((exportKey) => exportKey.startsWith(".")) ? Object.entries(exportsValue) : [[".", exportsValue]];
|
|
396
394
|
for (const [exportKey, target] of exportEntries) {
|
|
397
395
|
const targets = [target];
|
|
398
396
|
while (targets.length) {
|
|
@@ -409,16 +407,11 @@ function collectPackageExportCandidates(packageName, exportsValue, packageRelati
|
|
|
409
407
|
if (wildcard === void 0) continue;
|
|
410
408
|
candidates.push(`${packageName}${exportKey.slice(1).replace("*", wildcard)}`);
|
|
411
409
|
} else if (Array.isArray(value)) targets.push(...value);
|
|
412
|
-
else if (isRecord
|
|
410
|
+
else if (isRecord(value)) targets.push(...Object.values(value));
|
|
413
411
|
}
|
|
414
412
|
}
|
|
415
413
|
return candidates;
|
|
416
414
|
}
|
|
417
|
-
/**
|
|
418
|
-
* Resolves `specifier` from a resolveId hook without running that hook again. `flag` in `custom` also skips the hook in
|
|
419
|
-
* resolutions that other plugins start from this one. `skipSelf` is still needed: when two equal resolutions run at the
|
|
420
|
-
* same time, Rolldown 1.2 can give one of them no `custom`, and the hook would then wait on its own resolution.
|
|
421
|
-
*/
|
|
422
415
|
function resolveFrom(context, specifier, request, workingDir, flag) {
|
|
423
416
|
return context.resolve(specifier, importerFor(request.importer, workingDir), {
|
|
424
417
|
custom: {
|
|
@@ -515,7 +508,7 @@ function createResolvedAliasPlugin(aliases, aliasResolveDir, workingDir, resolve
|
|
|
515
508
|
else if (resolutionScope) {
|
|
516
509
|
const packageRelativePath = normalizedSpecifier.slice(resolutionScope.length);
|
|
517
510
|
const parsedPackageJson = JSON.parse(await readFile(resolve(resolutionScope, "package.json"), "utf8"));
|
|
518
|
-
if (!isRecord
|
|
511
|
+
if (!isRecord(parsedPackageJson)) return;
|
|
519
512
|
const packageJson = parsedPackageJson;
|
|
520
513
|
if (packageJson.exports === void 0 && !alias.prefix) {
|
|
521
514
|
const resolvedCandidate = await resolveWithContext(alias.specifier);
|
|
@@ -735,9 +728,6 @@ function createWasmModulePlugin(outdir, workingDir, copy) {
|
|
|
735
728
|
}
|
|
736
729
|
};
|
|
737
730
|
}
|
|
738
|
-
/**
|
|
739
|
-
* Leaves package imports external. Resolve package.json import mappings first, and preserve unmapped host imports.
|
|
740
|
-
*/
|
|
741
731
|
function createExternalPackagesPlugin() {
|
|
742
732
|
return {
|
|
743
733
|
name: "vitehub-external-packages",
|
|
@@ -823,7 +813,6 @@ function createOptionalImportPlugin() {
|
|
|
823
813
|
}
|
|
824
814
|
};
|
|
825
815
|
}
|
|
826
|
-
/** Matches import paths as esbuild's `external` does: `*` is a wildcard, and a package name also matches its subpaths. */
|
|
827
816
|
function createExternalMatcher(patterns) {
|
|
828
817
|
if (!patterns?.length) return;
|
|
829
818
|
const matchers = patterns.map((pattern) => {
|
|
@@ -835,7 +824,6 @@ function createExternalMatcher(patterns) {
|
|
|
835
824
|
});
|
|
836
825
|
return (id) => matchers.some((matches) => matches(id));
|
|
837
826
|
}
|
|
838
|
-
/** Returns the modules of the chunks that no chunk loaded from the entry chunk imports. */
|
|
839
827
|
function findUnusedChunkModules(chunks) {
|
|
840
828
|
const used = new Set(chunks.filter((chunk) => chunk.isEntry));
|
|
841
829
|
for (const chunk of used) for (const other of chunks) if (!used.has(other) && chunk.code.includes(other.fileName)) used.add(other);
|
|
@@ -1104,7 +1092,6 @@ function publishedPackagePaths(packageDir) {
|
|
|
1104
1092
|
entries
|
|
1105
1093
|
};
|
|
1106
1094
|
}
|
|
1107
|
-
/** Copies a file or folder and follows links. `node_modules` folders and paths that disappear during the copy are skipped. */
|
|
1108
1095
|
async function copyTree(source, target) {
|
|
1109
1096
|
const info = await unlessGone(() => stat(source));
|
|
1110
1097
|
if (!info) return;
|
|
@@ -1138,6 +1125,132 @@ async function copyRuntimePackageFiles(packageDir, targetDir) {
|
|
|
1138
1125
|
await unlessGone(() => copyFile(join(packageDir, path), target));
|
|
1139
1126
|
}
|
|
1140
1127
|
}
|
|
1128
|
+
// ../internal/src/source-files.ts
|
|
1129
|
+
const ignoredDirs = /* @__PURE__ */ new Set([
|
|
1130
|
+
"node_modules",
|
|
1131
|
+
"dist",
|
|
1132
|
+
".output",
|
|
1133
|
+
".nuxt",
|
|
1134
|
+
".vercel",
|
|
1135
|
+
".git",
|
|
1136
|
+
".vitehub"
|
|
1137
|
+
]);
|
|
1138
|
+
const racyWindowNs = 2000000000n;
|
|
1139
|
+
const storeKey = Symbol.for("vite-hub.source-files.v1");
|
|
1140
|
+
function store() {
|
|
1141
|
+
const existing = Reflect.get(globalThis, storeKey);
|
|
1142
|
+
if (isStore(existing)) return existing;
|
|
1143
|
+
const created = {
|
|
1144
|
+
derived: /* @__PURE__ */ new Map(),
|
|
1145
|
+
texts: /* @__PURE__ */ new Map(),
|
|
1146
|
+
trees: /* @__PURE__ */ new Map()
|
|
1147
|
+
};
|
|
1148
|
+
Reflect.set(globalThis, storeKey, created);
|
|
1149
|
+
return created;
|
|
1150
|
+
}
|
|
1151
|
+
function isStore(value) {
|
|
1152
|
+
return typeof value === "object" && value !== null && "texts" in value && "trees" in value && "derived" in value;
|
|
1153
|
+
}
|
|
1154
|
+
function errorCode(error) {
|
|
1155
|
+
return typeof error === "object" && error !== null && "code" in error ? error.code : void 0;
|
|
1156
|
+
}
|
|
1157
|
+
function statOrMissing(path) {
|
|
1158
|
+
try {
|
|
1159
|
+
return statSync(path, { bigint: true });
|
|
1160
|
+
} catch (error) {
|
|
1161
|
+
if (errorCode(error) === "ENOENT" || errorCode(error) === "ENOTDIR") return;
|
|
1162
|
+
throw error;
|
|
1163
|
+
}
|
|
1164
|
+
}
|
|
1165
|
+
function signature(stats) {
|
|
1166
|
+
return `${stats.ino}:${stats.size}:${stats.mtimeNs}:${stats.ctimeNs}`;
|
|
1167
|
+
}
|
|
1168
|
+
function isSettled(stats) {
|
|
1169
|
+
const changed = stats.mtimeNs > stats.ctimeNs ? stats.mtimeNs : stats.ctimeNs;
|
|
1170
|
+
return BigInt(Date.now()) * 1000000n - changed > racyWindowNs;
|
|
1171
|
+
}
|
|
1172
|
+
function readDirEntries(root) {
|
|
1173
|
+
try {
|
|
1174
|
+
return readdirSync(root, { withFileTypes: true });
|
|
1175
|
+
} catch (error) {
|
|
1176
|
+
if (errorCode(error) === "ENOENT") return [];
|
|
1177
|
+
throw error;
|
|
1178
|
+
}
|
|
1179
|
+
}
|
|
1180
|
+
function walkTree(root, directories, files, nested = false) {
|
|
1181
|
+
const before = statOrMissing(root);
|
|
1182
|
+
let trusted = before !== void 0 && isSettled(before);
|
|
1183
|
+
if (before) directories.set(root, signature(before));
|
|
1184
|
+
if (nested && existsSync(resolve$1(root, ".git"))) return trusted;
|
|
1185
|
+
for (const entry of readDirEntries(root)) {
|
|
1186
|
+
const path = resolve$1(root, entry.name);
|
|
1187
|
+
if (entry.isDirectory() && !entry.isSymbolicLink()) {
|
|
1188
|
+
if (entry.name.startsWith(".") || ignoredDirs.has(entry.name)) continue;
|
|
1189
|
+
if (!walkTree(path, directories, files, true)) trusted = false;
|
|
1190
|
+
continue;
|
|
1191
|
+
}
|
|
1192
|
+
if (entry.isFile()) files.push({
|
|
1193
|
+
hidden: entry.name.startsWith("."),
|
|
1194
|
+
name: entry.name,
|
|
1195
|
+
path
|
|
1196
|
+
});
|
|
1197
|
+
}
|
|
1198
|
+
return trusted;
|
|
1199
|
+
}
|
|
1200
|
+
function isCurrent(tree) {
|
|
1201
|
+
for (const [directory, stored] of tree.directories) {
|
|
1202
|
+
const stats = statOrMissing(directory);
|
|
1203
|
+
if (!stats || signature(stats) !== stored) return false;
|
|
1204
|
+
}
|
|
1205
|
+
return true;
|
|
1206
|
+
}
|
|
1207
|
+
function sourceTree(root) {
|
|
1208
|
+
const trees = store().trees;
|
|
1209
|
+
const cached = trees.get(root);
|
|
1210
|
+
if (cached && isCurrent(cached)) return cached;
|
|
1211
|
+
const directories = /* @__PURE__ */ new Map();
|
|
1212
|
+
const files = [];
|
|
1213
|
+
const trusted = walkTree(root, directories, files);
|
|
1214
|
+
files.sort((left, right) => left.path < right.path ? -1 : left.path > right.path ? 1 : 0);
|
|
1215
|
+
const tree = {
|
|
1216
|
+
directories,
|
|
1217
|
+
files
|
|
1218
|
+
};
|
|
1219
|
+
if (trusted) trees.set(root, tree);
|
|
1220
|
+
else trees.delete(root);
|
|
1221
|
+
return tree;
|
|
1222
|
+
}
|
|
1223
|
+
/**
|
|
1224
|
+
* The files below `root` whose name matches `predicate`, sorted by path. The walk skips hidden folders, Git
|
|
1225
|
+
* repositories, and build output folders such as `node_modules`, `dist`, and `.vitehub`. Hidden files need
|
|
1226
|
+
* `includeHidden`. Symbolic links are skipped.
|
|
1227
|
+
*/
|
|
1228
|
+
function listSourceTreeFiles(root, predicate, options = {}) {
|
|
1229
|
+
const files = [];
|
|
1230
|
+
for (const file of sourceTree(resolve$1(root)).files) {
|
|
1231
|
+
if (file.hidden && !options.includeHidden) continue;
|
|
1232
|
+
if (predicate(file.name)) files.push(file.path);
|
|
1233
|
+
}
|
|
1234
|
+
return files;
|
|
1235
|
+
}
|
|
1236
|
+
/** The UTF-8 text of a source file. A file that did not change since the last read is not read again. */
|
|
1237
|
+
function readSourceText(file) {
|
|
1238
|
+
const path = resolve$1(file);
|
|
1239
|
+
const texts = store().texts;
|
|
1240
|
+
const stats = statOrMissing(path);
|
|
1241
|
+
if (!stats) return readFileSync(path, "utf8");
|
|
1242
|
+
const current = signature(stats);
|
|
1243
|
+
const cached = texts.get(path);
|
|
1244
|
+
if (cached?.trusted && cached.signature === current) return cached.text;
|
|
1245
|
+
const read = readFileSync(path, "utf8");
|
|
1246
|
+
const text = cached?.text === read ? cached.text : read;
|
|
1247
|
+
texts.set(path, {
|
|
1248
|
+
signature: current,
|
|
1249
|
+
text,
|
|
1250
|
+
trusted: isSettled(stats)
|
|
1251
|
+
});
|
|
1252
|
+
return text;
|
|
1253
|
+
}
|
|
1141
1254
|
// ../internal/src/build/provider-output-sources.ts
|
|
1142
1255
|
const keptFailedProviderOutputArtifactDirs = /* @__PURE__ */ new Set();
|
|
1143
1256
|
function failureText(failure) {
|
|
@@ -2735,15 +2848,6 @@ async function finalizeProviderDeploymentOutputs(catalog, options = {}) {
|
|
|
2735
2848
|
const sourceFilePattern = /\.(?:c|m)?[jt]sx?$/i;
|
|
2736
2849
|
const declarationFilePattern = /\.d\.(?:c|m)?[jt]sx?$/i;
|
|
2737
2850
|
const testFilePattern = /\.(?:test|spec)\.(?:c|m)?[jt]sx?$/i;
|
|
2738
|
-
const ignoredDirs = /* @__PURE__ */ new Set([
|
|
2739
|
-
"node_modules",
|
|
2740
|
-
"dist",
|
|
2741
|
-
".output",
|
|
2742
|
-
".nuxt",
|
|
2743
|
-
".vercel",
|
|
2744
|
-
".git",
|
|
2745
|
-
".vitehub"
|
|
2746
|
-
]);
|
|
2747
2851
|
function createDirectoryDefinitionSource(source, scanDirs, subdir, options = {}) {
|
|
2748
2852
|
return {
|
|
2749
2853
|
...options,
|
|
@@ -2763,32 +2867,8 @@ function createSuffixDefinitionSource(source, roots, pattern, normalizeName, opt
|
|
|
2763
2867
|
source
|
|
2764
2868
|
};
|
|
2765
2869
|
}
|
|
2766
|
-
function readDirEntries(root) {
|
|
2767
|
-
try {
|
|
2768
|
-
return readdirSync(root, { withFileTypes: true });
|
|
2769
|
-
} catch (error) {
|
|
2770
|
-
if (error.code === "ENOENT") return [];
|
|
2771
|
-
throw error;
|
|
2772
|
-
}
|
|
2773
|
-
}
|
|
2774
|
-
function isGitRepositoryDirectory(directory) {
|
|
2775
|
-
return existsSync(resolve$1(directory, ".git"));
|
|
2776
|
-
}
|
|
2777
2870
|
function listMatchingFiles(root, predicate, options = {}) {
|
|
2778
|
-
|
|
2779
|
-
for (const entry of readDirEntries(root)) {
|
|
2780
|
-
const absolute = resolve$1(root, entry.name);
|
|
2781
|
-
if (entry.isDirectory() && !entry.isSymbolicLink()) {
|
|
2782
|
-
if (isGitRepositoryDirectory(absolute)) continue;
|
|
2783
|
-
if (entry.name.startsWith(".")) continue;
|
|
2784
|
-
if (ignoredDirs.has(entry.name)) continue;
|
|
2785
|
-
files.push(...listMatchingFiles(absolute, predicate, options));
|
|
2786
|
-
continue;
|
|
2787
|
-
}
|
|
2788
|
-
if (entry.name.startsWith(".") && !options.includeHidden) continue;
|
|
2789
|
-
if (entry.isFile() && predicate(entry.name)) files.push(absolute);
|
|
2790
|
-
}
|
|
2791
|
-
return files.sort();
|
|
2871
|
+
return listSourceTreeFiles(root, predicate, options);
|
|
2792
2872
|
}
|
|
2793
2873
|
/** A module that a Definitions folder can hold: JavaScript or TypeScript, and not a declaration, test, or spec file. */
|
|
2794
2874
|
function isDefinitionSourceFile(name) {
|
|
@@ -2898,11 +2978,6 @@ function rejectDevRequest(rejection) {
|
|
|
2898
2978
|
const fileOrExtensionProtocol = /^(?:file|.+-extension):/i;
|
|
2899
2979
|
const ipv4Octet = "(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)";
|
|
2900
2980
|
const ipv4Literal = new RegExp(`^${ipv4Octet}(?:\\.${ipv4Octet}){3}$`);
|
|
2901
|
-
/**
|
|
2902
|
-
* Tests IP literals like `node:net` `isIP`, without a Node import, so the Nitro-side check also runs in Worker
|
|
2903
|
-
* runtimes. IPv4 uses the Node pattern (dotted decimal, no leading zeros). IPv6 uses the WHATWG URL parser, which
|
|
2904
|
-
* rejects zone IDs. Browsers do not send zone IDs in `Host`.
|
|
2905
|
-
*/
|
|
2906
2981
|
function isIPv4Literal(value) {
|
|
2907
2982
|
return ipv4Literal.test(value);
|
|
2908
2983
|
}
|
|
@@ -3121,10 +3196,6 @@ const runs = shared[runsKey] ??= /* @__PURE__ */ new Map();
|
|
|
3121
3196
|
const startedKey = Symbol.for("vitehub.hints.started");
|
|
3122
3197
|
const startedShared = globalThis;
|
|
3123
3198
|
const started = startedShared[startedKey] ??= /* @__PURE__ */ new WeakSet();
|
|
3124
|
-
/**
|
|
3125
|
-
* The report of the ViteHub project root, where the other generated files go. A Nuxt app with `srcDir: "app"` has its
|
|
3126
|
-
* Vite root in `app/`, one folder below.
|
|
3127
|
-
*/
|
|
3128
3199
|
function hintsFile(config) {
|
|
3129
3200
|
const projectRoot = Reflect.get(config, VITEHUB_PROJECT_ROOT);
|
|
3130
3201
|
return resolve(typeof projectRoot === "string" ? projectRoot : resolveViteHubProjectRoot(config.root), viteHubHintsFile);
|
|
@@ -19207,7 +19278,7 @@ async function flattenPlugins(value, plugins, seen) {
|
|
|
19207
19278
|
for (const item of value) await flattenPlugins(item, plugins, seen);
|
|
19208
19279
|
return;
|
|
19209
19280
|
}
|
|
19210
|
-
if (!isRecord
|
|
19281
|
+
if (!isRecord(value) || seen.has(value)) return;
|
|
19211
19282
|
seen.add(value);
|
|
19212
19283
|
if (isThenable(value)) {
|
|
19213
19284
|
await flattenPlugins(await value, plugins, seen);
|
|
@@ -19239,7 +19310,7 @@ async function collectContributions(plugins, options) {
|
|
|
19239
19310
|
for (const plugin of candidates) {
|
|
19240
19311
|
if (!Object.hasOwn(plugin, "vitehub")) continue;
|
|
19241
19312
|
const metadata = Reflect.get(plugin, "vitehub");
|
|
19242
|
-
if (!isRecord
|
|
19313
|
+
if (!isRecord(metadata) || !Object.hasOwn(metadata, options.key)) continue;
|
|
19243
19314
|
const source = metadata[options.key];
|
|
19244
19315
|
const pluginName = Reflect.get(plugin, "name");
|
|
19245
19316
|
const contributor = isNonEmptyString(pluginName) ? pluginName : unnamedPlugin;
|
|
@@ -19267,12 +19338,12 @@ async function collectContributions(plugins, options) {
|
|
|
19267
19338
|
return [...collected.values()].map(({ contribution }) => contribution).sort((left, right) => left.name < right.name ? -1 : left.name > right.name ? 1 : 0);
|
|
19268
19339
|
}
|
|
19269
19340
|
function readContribution(entry, plugin, options, fail) {
|
|
19270
|
-
if (!isRecord
|
|
19341
|
+
if (!isRecord(entry)) return fail("expected { name, definition: { module, export? }, reason? }.");
|
|
19271
19342
|
const { definition, name, reason } = entry;
|
|
19272
19343
|
if (!isNonEmptyString(name) || name.trim() !== name) return fail("`name` must be a non-empty string without surrounding whitespace.");
|
|
19273
19344
|
const nameProblem = options.checkName?.(name);
|
|
19274
19345
|
if (nameProblem) return fail(`${options.kind} ${JSON.stringify(name)}: ${nameProblem}`);
|
|
19275
|
-
if (!isRecord
|
|
19346
|
+
if (!isRecord(definition)) return fail(`${options.kind} ${JSON.stringify(name)} needs \`definition: { module, export? }\`.`);
|
|
19276
19347
|
if (!isNonEmptyString(definition.module)) return fail(`\`definition.module\` of ${options.kind} ${JSON.stringify(name)} must be a non-empty string.`);
|
|
19277
19348
|
let module;
|
|
19278
19349
|
try {
|
|
@@ -19341,10 +19412,10 @@ function stripComments(source) {
|
|
|
19341
19412
|
return source.replace(/\/\*[\s\S]*?\*\//g, "").replace(/(^|[^:])\/\/.*$/gm, "$1");
|
|
19342
19413
|
}
|
|
19343
19414
|
function isAgentConfig(file) {
|
|
19344
|
-
return /\bdefineAgent\s*\(/.test(stripComments(
|
|
19415
|
+
return /\bdefineAgent\s*\(/.test(stripComments(readSourceText(file)));
|
|
19345
19416
|
}
|
|
19346
19417
|
function isWorkspaceAgentDefinition(file) {
|
|
19347
|
-
return /\bdefineAgent\s*\(\s*\{[\s\S]*?\bworkspace\s*:/.test(stripComments(
|
|
19418
|
+
return /\bdefineAgent\s*\(\s*\{[\s\S]*?\bworkspace\s*:/.test(stripComments(readSourceText(file)));
|
|
19348
19419
|
}
|
|
19349
19420
|
function collectDirectoriesWithConfig(root) {
|
|
19350
19421
|
const directories = /* @__PURE__ */ new Set();
|
|
@@ -19721,7 +19792,6 @@ async function syncDiscoveredWorkspaceAssetBundles(definitions, rootDir, options
|
|
|
19721
19792
|
}
|
|
19722
19793
|
return bundles;
|
|
19723
19794
|
}
|
|
19724
|
-
/** The build does not read `lazy` and `startup` Sources, so it checks that each one can reach its data after deploy. */
|
|
19725
19795
|
async function checkDeferredSourceAccess(definition) {
|
|
19726
19796
|
for (const source of normalizeWorkspaceSources(definition.sources)) {
|
|
19727
19797
|
if (source.materialize !== "lazy" && source.materialize !== "startup") continue;
|
|
@@ -19834,7 +19904,6 @@ const valueFlags = /* @__PURE__ */ new Set([
|
|
|
19834
19904
|
"timeout",
|
|
19835
19905
|
"url"
|
|
19836
19906
|
]);
|
|
19837
|
-
/** The flags of each command. Any other flag fails before a call, so `push --dry-run` cannot commit. */
|
|
19838
19907
|
const commandFlags = {
|
|
19839
19908
|
pull: /* @__PURE__ */ new Set([
|
|
19840
19909
|
"dir",
|
|
@@ -20079,7 +20148,6 @@ async function git(cwd, ...args) {
|
|
|
20079
20148
|
async function exists(path) {
|
|
20080
20149
|
return await stat(path).then(() => true, () => false);
|
|
20081
20150
|
}
|
|
20082
|
-
/** The hook manager that owns the hooks of the repository, such as Husky, or undefined when Git runs `.git/hooks`. */
|
|
20083
20151
|
async function hookManager(top, rootDir) {
|
|
20084
20152
|
const hooksPath = await git(top, "config", "--get", "core.hooksPath");
|
|
20085
20153
|
if (hooksPath && [".husky", ".husky/_"].some((path) => resolve(top, hooksPath) === resolve(top, path))) return "Husky";
|
|
@@ -20093,7 +20161,6 @@ async function hookManager(top, rootDir) {
|
|
|
20093
20161
|
for (const dir of /* @__PURE__ */ new Set([top, rootDir])) if ((await readFile(join(dir, "package.json"), "utf8").catch(() => void 0))?.includes("\"simple-git-hooks\"")) return "simple-git-hooks";
|
|
20094
20162
|
return hooksPath ? `core.hooksPath (${hooksPath})` : void 0;
|
|
20095
20163
|
}
|
|
20096
|
-
/** Only a missing hook is safe to create. Other read errors must stop install and uninstall. */
|
|
20097
20164
|
async function readHook(path) {
|
|
20098
20165
|
try {
|
|
20099
20166
|
return await readFile(path, "utf8");
|
|
@@ -20102,11 +20169,9 @@ async function readHook(path) {
|
|
|
20102
20169
|
throw error;
|
|
20103
20170
|
}
|
|
20104
20171
|
}
|
|
20105
|
-
/** A shell word for a value, such as a project path with spaces or quotes. */
|
|
20106
20172
|
function shellQuote(value) {
|
|
20107
20173
|
return `'${value.replaceAll("'", "'\\''")}'`;
|
|
20108
20174
|
}
|
|
20109
|
-
/** The hook file that `install` writes. A hook with any other content is not ViteHub's. */
|
|
20110
20175
|
function script(hook, project) {
|
|
20111
20176
|
const cd = project ? `"$(git rev-parse --show-toplevel)"/${shellQuote(project)}` : `"$(git rev-parse --show-toplevel)"`;
|
|
20112
20177
|
return [
|
|
@@ -20122,7 +20187,6 @@ function manualLines(project) {
|
|
|
20122
20187
|
const prefix = project ? `cd ${shellQuote(project)} && ` : "";
|
|
20123
20188
|
return ` pre-commit: ${prefix}vitehub hooks pre-commit\n pre-push: ${prefix}vitehub hooks pre-push\n`;
|
|
20124
20189
|
}
|
|
20125
|
-
/** The top folder of the Git repository and the project folder inside it. */
|
|
20126
20190
|
async function repository(rootDir) {
|
|
20127
20191
|
const top = await git(rootDir, "rev-parse", "--show-toplevel");
|
|
20128
20192
|
return top ? {
|
|
@@ -20177,7 +20241,6 @@ async function uninstall(context) {
|
|
|
20177
20241
|
}
|
|
20178
20242
|
return 0;
|
|
20179
20243
|
}
|
|
20180
|
-
/** True when the project has a lock file with at least one checked-out Workspace. Fails when the lock cannot be read. */
|
|
20181
20244
|
async function hasCheckouts(rootDir) {
|
|
20182
20245
|
let source;
|
|
20183
20246
|
try {
|
|
@@ -20193,10 +20256,6 @@ async function hasCheckouts(rootDir) {
|
|
|
20193
20256
|
return true;
|
|
20194
20257
|
}
|
|
20195
20258
|
}
|
|
20196
|
-
/**
|
|
20197
|
-
* A digest of `vitehub.lock` and of every file in its checkout folders, by path from the project folder. The pre-push
|
|
20198
|
-
* hook compares two of them to find what `vitehub push` changed.
|
|
20199
|
-
*/
|
|
20200
20259
|
async function checkoutFiles(rootDir) {
|
|
20201
20260
|
const files = /* @__PURE__ */ new Map();
|
|
20202
20261
|
const digest = async (path) => {
|
|
@@ -20257,7 +20316,6 @@ async function readStandardInput() {
|
|
|
20257
20316
|
for await (const chunk of process.stdin) text += String(chunk);
|
|
20258
20317
|
return text;
|
|
20259
20318
|
}
|
|
20260
|
-
/** Writes an error of a hook as the checkout commands write it, and fails the hook. */
|
|
20261
20319
|
function fail(context, error) {
|
|
20262
20320
|
const failure = checkoutFailure(error);
|
|
20263
20321
|
context.stderr.write(`${failure.code}: ${failure.message}\n${failure.fix ? `${failure.fix}\n` : ""}`);
|
|
@@ -20288,7 +20346,6 @@ async function prePushChecked(context, options) {
|
|
|
20288
20346
|
context.stderr.write(`vitehub: the Workspace push went through and changed these files:\n${changed.map((path) => ` ${path}\n`).join("")}Git stops this push because it does not contain them. Commit them, then run git push again.\n`);
|
|
20289
20347
|
return 1;
|
|
20290
20348
|
}
|
|
20291
|
-
/** Text conflicts in the index, including files resolved only in the working tree. Paths are relative to the checkout. */
|
|
20292
20349
|
async function stagedCheckoutConflicts(top, folder) {
|
|
20293
20350
|
const dir = relative(top, folder).split(sep).join("/");
|
|
20294
20351
|
try {
|
|
@@ -20539,7 +20596,7 @@ async function readWorkspaceDiscovery(parsed, context, fetchImpl) {
|
|
|
20539
20596
|
});
|
|
20540
20597
|
if (!server) return;
|
|
20541
20598
|
const { discovery, url } = server;
|
|
20542
|
-
if (!(Array.isArray(discovery.workspaces) ? discovery.workspaces.flatMap((workspace) => isRecord
|
|
20599
|
+
if (!(Array.isArray(discovery.workspaces) ? discovery.workspaces.flatMap((workspace) => isRecord(workspace) && typeof workspace.name === "string" ? [workspace.name] : []) : []).includes(parsed.workspace)) {
|
|
20543
20600
|
context.stderr.write(`Unknown Workspace Dev target: ${parsed.workspace}\n`);
|
|
20544
20601
|
return;
|
|
20545
20602
|
}
|
|
@@ -20678,7 +20735,7 @@ async function declaredSources(file, exportName = "default") {
|
|
|
20678
20735
|
} catch {
|
|
20679
20736
|
return;
|
|
20680
20737
|
}
|
|
20681
|
-
const { argumentExpression, defaultExportExpression, objectProperties, scanModule, unwrapExpression } = await import("./workspace-inspection-scanner-
|
|
20738
|
+
const { argumentExpression, defaultExportExpression, objectProperties, scanModule, unwrapExpression } = await import("./workspace-inspection-scanner-6QrvwVJG.js").then((n) => n.t);
|
|
20682
20739
|
const module = scanModule(source, file);
|
|
20683
20740
|
if (module.errors.length) return;
|
|
20684
20741
|
const exported = exportName === "default" ? defaultExportExpression(module) : namedWorkspaceExport(module, exportName);
|
|
@@ -20828,10 +20885,10 @@ function vercelFunctionRuntimePackages() {
|
|
|
20828
20885
|
}];
|
|
20829
20886
|
}
|
|
20830
20887
|
function hasCloudflareArtifactBinding(value) {
|
|
20831
|
-
return
|
|
20888
|
+
return isObject(value) && typeof value.binding === "string";
|
|
20832
20889
|
}
|
|
20833
20890
|
function configuredCloudflareArtifacts(wranglerConfig) {
|
|
20834
|
-
if (!
|
|
20891
|
+
if (!isObject(wranglerConfig) || !Array.isArray(wranglerConfig.artifacts)) return [];
|
|
20835
20892
|
return wranglerConfig.artifacts.filter(hasCloudflareArtifactBinding);
|
|
20836
20893
|
}
|
|
20837
20894
|
function createCloudflareArtifactsWranglerConfig(configs) {
|
|
@@ -20864,11 +20921,6 @@ function babelStaticObjectProperties(node) {
|
|
|
20864
20921
|
if (node.properties?.some((property) => property.type === "SpreadElement" || property.computed || (property.key?.name ?? property.key?.value) === "__proto__")) return;
|
|
20865
20922
|
return node.properties;
|
|
20866
20923
|
}
|
|
20867
|
-
/**
|
|
20868
|
-
* Reads a store from the source of a Definition's default export when its driver cannot change when the module runs
|
|
20869
|
-
* again: `{}` for no store or a custom Store, `{ driver }` for a hosted store, and `undefined` when the source does not
|
|
20870
|
-
* show it. Comments do not count, because this reads the syntax tree.
|
|
20871
|
-
*/
|
|
20872
20924
|
async function readStaticWorkspaceStore(file, loader, exportedName = "default") {
|
|
20873
20925
|
if (exportedName !== "default") return;
|
|
20874
20926
|
const loaded = await readSourceModule(file);
|
|
@@ -20913,11 +20965,6 @@ async function readStaticWorkspaceStore(file, loader, exportedName = "default")
|
|
|
20913
20965
|
});
|
|
20914
20966
|
return staticStore;
|
|
20915
20967
|
}
|
|
20916
|
-
/**
|
|
20917
|
-
* Reads each Definition's store by loading the Definition, as the runtime does. When the build cannot load a Definition,
|
|
20918
|
-
* it skips it only if the source shows that its store needs no Artifacts binding. Otherwise the build cannot write the
|
|
20919
|
-
* binding that the store may need, so it fails and tells the developer to set the store in the `workspace` config.
|
|
20920
|
-
*/
|
|
20921
20968
|
async function resolveDefinitionCloudflareArtifactsConfigs(definitions, rootDir, options) {
|
|
20922
20969
|
const loader = createWorkspaceDefinitionLoader(rootDir, options.aliases);
|
|
20923
20970
|
const configs = [];
|
|
@@ -20957,12 +21004,6 @@ async function resolveDefinitionCloudflareArtifactsConfigs(definitions, rootDir,
|
|
|
20957
21004
|
}
|
|
20958
21005
|
return configs;
|
|
20959
21006
|
}
|
|
20960
|
-
/**
|
|
20961
|
-
* The Definitions that the config loads to find their Cloudflare Artifacts stores. A build loads all of them to learn
|
|
20962
|
-
* which stores it bundles. `vite dev` and CLI calls (`serve`) load them only on the Cloudflare host, because only a
|
|
20963
|
-
* Cloudflare server binds Artifacts. Loading runs app code outside Nitro, so its Nitro runtime imports would print
|
|
20964
|
-
* Nitro's "stub implementation" warning on every command.
|
|
20965
|
-
*/
|
|
20966
21007
|
function definitionsToLoad(definitions, command, hosting) {
|
|
20967
21008
|
return command !== "serve" || getHostingProvider(hosting) === "cloudflare" ? definitions : [];
|
|
20968
21009
|
}
|
|
@@ -21034,11 +21075,8 @@ async function collectPluginWorkspaceContributions(plugins, roots, serverDirs) {
|
|
|
21034
21075
|
serverDirs
|
|
21035
21076
|
});
|
|
21036
21077
|
}
|
|
21037
|
-
function isRecord(value) {
|
|
21038
|
-
return typeof value === "object" && value !== null;
|
|
21039
|
-
}
|
|
21040
21078
|
function isWorkspaceRegistry(value) {
|
|
21041
|
-
return
|
|
21079
|
+
return isObject(value) && Object.values(value).every((item) => typeof item === "function");
|
|
21042
21080
|
}
|
|
21043
21081
|
function workspaceDefinitionLoaderAliases(aliases) {
|
|
21044
21082
|
if (!Array.isArray(aliases)) return aliases;
|
|
@@ -21052,10 +21090,6 @@ const hostedWorkspaceStoreDrivers = [
|
|
|
21052
21090
|
function isHostedWorkspaceStore(store) {
|
|
21053
21091
|
return store.driver === "cloudflare" || store.driver === "github" || store.driver === "vercel";
|
|
21054
21092
|
}
|
|
21055
|
-
/**
|
|
21056
|
-
* The hosted stores the Nitro plugin installs. Each store pulls its client into the server startup, so a build installs
|
|
21057
|
-
* only the stores that its definitions use. Without `storeUsage` (dev) it installs every store.
|
|
21058
|
-
*/
|
|
21059
21093
|
function resolveNitroHostedStoreProviders(config, definitionCount, storeUsage) {
|
|
21060
21094
|
const configProvider = config && isHostedWorkspaceStore(config.store) ? config.store.driver : void 0;
|
|
21061
21095
|
if (!storeUsage) return new Set(configProvider || definitionCount > 0 ? hostedWorkspaceStoreDrivers : []);
|
|
@@ -21155,7 +21189,7 @@ async function handleWorkspaceDevRequest(server, req, workspaces, tokenOptions,
|
|
|
21155
21189
|
} catch {
|
|
21156
21190
|
return new Response("Malformed Workspace Dev payload.", { status: 400 });
|
|
21157
21191
|
}
|
|
21158
|
-
const command =
|
|
21192
|
+
const command = isObject(body) && isObject(body.workspaceCommand) ? body.workspaceCommand : void 0;
|
|
21159
21193
|
if (!command || typeof command.workspace !== "string" || typeof command.command !== "string") return new Response("Missing Workspace Dev command.", { status: 400 });
|
|
21160
21194
|
if (!await validateWorkspaceDevToken(server.config.root, req.headers, tokenOptions)) return new Response("Forbidden Workspace Dev token.", { status: 403 });
|
|
21161
21195
|
const mod = await server.ssrLoadModule(WORKSPACE_REGISTRY_ID);
|
|
@@ -21178,7 +21212,7 @@ async function handleWorkspaceDevRequest(server, req, workspaces, tokenOptions,
|
|
|
21178
21212
|
...args ? { args } : {},
|
|
21179
21213
|
command: command.command,
|
|
21180
21214
|
host,
|
|
21181
|
-
...
|
|
21215
|
+
...isObject(definition) ? { definition: normalizeWorkspaceDefinition(command.workspace, definition) } : {},
|
|
21182
21216
|
...paths?.length ? { paths } : {},
|
|
21183
21217
|
...timeout ? { timeout } : {},
|
|
21184
21218
|
workspace: command.workspace
|
|
@@ -21192,7 +21226,7 @@ async function handleWorkspaceDevRequest(server, req, workspaces, tokenOptions,
|
|
|
21192
21226
|
}
|
|
21193
21227
|
function hasNitroPlugin(value) {
|
|
21194
21228
|
if (Array.isArray(value)) return value.some(hasNitroPlugin);
|
|
21195
|
-
return
|
|
21229
|
+
return isObject(value) && typeof value.name === "string" && value.name.startsWith("nitro:");
|
|
21196
21230
|
}
|
|
21197
21231
|
function hasNitroConfig(config) {
|
|
21198
21232
|
return "nitro" in config || hasNitroPlugin(config.plugins);
|
|
@@ -21204,7 +21238,7 @@ function shouldInstallNitroWorkspacePlugin(config, options, normalized, definiti
|
|
|
21204
21238
|
return isHostedWorkspaceStore(normalized.store) || hasExplicitWorkspaceRuntimeOptions(options) || hasNitroConfig(config) && definitions.length > 0;
|
|
21205
21239
|
}
|
|
21206
21240
|
function mergeNitroWorkspaceConfig(value, root, dev) {
|
|
21207
|
-
const kit = createNitroServerKit(
|
|
21241
|
+
const kit = createNitroServerKit(isObject(value) ? { ...value } : {});
|
|
21208
21242
|
const pluginFile = resolve(root, generatedNitroWorkspacePlugin);
|
|
21209
21243
|
kit.addPlugin(pluginFile, dev ? "start" : "end");
|
|
21210
21244
|
if (!dev) {
|
|
@@ -21249,7 +21283,7 @@ function configureCloudflareNitroRuntime(nitro) {
|
|
|
21249
21283
|
nitro.cloudflare ??= {};
|
|
21250
21284
|
nitro.cloudflare.wrangler ??= {};
|
|
21251
21285
|
nitro.cloudflare.nodeCompat = true;
|
|
21252
|
-
const rollupConfig =
|
|
21286
|
+
const rollupConfig = isObject(nitro.rollupConfig) ? { ...nitro.rollupConfig } : {};
|
|
21253
21287
|
nitro.rollupConfig = {
|
|
21254
21288
|
...rollupConfig,
|
|
21255
21289
|
external: mergeNitroExternal(rollupConfig.external, "cloudflare:workers")
|
|
@@ -21270,7 +21304,7 @@ function renderRuntimeValue(value, depth = 0) {
|
|
|
21270
21304
|
const closingIndent = " ".repeat(depth);
|
|
21271
21305
|
return `[\n${value.map((item) => `${indent}${renderRuntimeValue(item, depth + 1)}`).join(",\n")}\n${closingIndent}]`;
|
|
21272
21306
|
}
|
|
21273
|
-
if (
|
|
21307
|
+
if (isObject(value)) {
|
|
21274
21308
|
const entries = Object.entries(value).filter(([, entry]) => entry !== void 0);
|
|
21275
21309
|
if (!entries.length) return "{}";
|
|
21276
21310
|
const indent = " ".repeat(depth + 1);
|
|
@@ -2,17 +2,17 @@ import { l as workspaceSourceReadOnlyError, n as isWorkspaceConflict, normalizeS
|
|
|
2
2
|
import { a as isExcludedWorkspacePath, f as sha256, i as decodeFile, l as normalizeWorkspacePath, n as contentStreamToBytes, r as contentToBytes, s as matchesAny, u as readStoredFile } from "./path-DYHw5KNk.js";
|
|
3
3
|
import { t as searchText } from "./search-CG6UNOtn.js";
|
|
4
4
|
import { t as createMemoryWorkspaceStore } from "./memory-BCZl_ZsJ.js";
|
|
5
|
-
import { a as normalizeWorkspaceSources, c as sourceMountIntersectsPath, f as prepareWorkspaceSource, g as getWorkspaceSourceRequestExecutor, n as createSourceContext, s as sourceMountContainsPath, v as workspaceSourceRequestDescriptorPath, y as requestJsonEqual } from "./config
|
|
6
|
-
import { t as workspaceErrorDiagnostics } from "./error-diagnostics-
|
|
7
|
-
import { f as normalizeHistoryRef, i as createWorkspaceHistory, m as rejectHistoryHead, u as historyConflict } from "./utils-
|
|
5
|
+
import { a as normalizeWorkspaceSources, c as sourceMountIntersectsPath, f as prepareWorkspaceSource, g as getWorkspaceSourceRequestExecutor, n as createSourceContext, s as sourceMountContainsPath, v as workspaceSourceRequestDescriptorPath, y as requestJsonEqual } from "./config-B-S_Z4G0.js";
|
|
6
|
+
import { t as workspaceErrorDiagnostics } from "./error-diagnostics-Dn4sQcKL.js";
|
|
7
|
+
import { f as normalizeHistoryRef, i as createWorkspaceHistory, m as rejectHistoryHead, u as historyConflict } from "./utils-BoFJcaT1.js";
|
|
8
8
|
import { t as assertPublicFileMetadata } from "./file-metadata-Dqpldj0h.js";
|
|
9
9
|
import { t as createWorkspaceGlobMatcher } from "./glob-BIg9O4yY.js";
|
|
10
|
-
import { t as createWorkspaceWritePolicy } from "./rules-
|
|
10
|
+
import { t as createWorkspaceWritePolicy } from "./rules-sItt6TP-.js";
|
|
11
11
|
import { i as forwardWorkspaceStoreTarget, o as resolveWorkspaceStoreTarget, t as forwardWorkspaceRevisionMaterializer } from "./vitehub-grants-Co713QTg.js";
|
|
12
12
|
import { i as replaceStorePath, n as getWorkspaceReplacement, o as requireWorkspaceReplacement, r as prepareWorkspaceReplacement, t as attachWorkspaceReplacement } from "./replacement-CVZVsflC.js";
|
|
13
|
-
import { C as withWorkspaceStoreMutation, D as readWorkspaceFileOwner, _ as reconcileRemovedStartupSources, b as statVirtualSourcePath, c as workspaceInternalMetadataCapability, f as materializeWorkspaceSources, g as readSourceSnapshotPaths, h as readResolvedSourceFile, l as hasCurrentSourceSnapshot, m as readCurrentSourceSnapshot, n as createWorkspaceMetadataTarget, p as materializesCompleteSource, t as attachWorkspaceMetadataTarget, u as hasFreshSourceSnapshot, v as searchMaterializedStore } from "./metadata-target-
|
|
14
|
-
import { t as createWorkspaceStoreFromProvider } from "./provider-
|
|
15
|
-
import { n as trackStagedWrites } from "./request-scope-
|
|
13
|
+
import { C as withWorkspaceStoreMutation, D as readWorkspaceFileOwner, _ as reconcileRemovedStartupSources, b as statVirtualSourcePath, c as workspaceInternalMetadataCapability, f as materializeWorkspaceSources, g as readSourceSnapshotPaths, h as readResolvedSourceFile, l as hasCurrentSourceSnapshot, m as readCurrentSourceSnapshot, n as createWorkspaceMetadataTarget, p as materializesCompleteSource, t as attachWorkspaceMetadataTarget, u as hasFreshSourceSnapshot, v as searchMaterializedStore } from "./metadata-target-oc00D8g2.js";
|
|
14
|
+
import { t as createWorkspaceStoreFromProvider } from "./provider-DBJeUNFI.js";
|
|
15
|
+
import { n as trackStagedWrites } from "./request-scope-DZJbe-tP.js";
|
|
16
16
|
import { noExecutionAuthority } from "@vite-hub/runtime";
|
|
17
17
|
import { posix } from "node:path";
|
|
18
18
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
@@ -1520,7 +1520,7 @@ function createWorkspace(definition, options = {}) {
|
|
|
1520
1520
|
};
|
|
1521
1521
|
},
|
|
1522
1522
|
async sync(options) {
|
|
1523
|
-
const { syncWorkspaceSources } = await import("./sync-
|
|
1523
|
+
const { syncWorkspaceSources } = await import("./sync-ztyvA0Va.js");
|
|
1524
1524
|
return await syncWorkspaceSources(definition, store, options);
|
|
1525
1525
|
},
|
|
1526
1526
|
async materializeSources(options) {
|
|
@@ -1575,7 +1575,7 @@ function createWorkspace(definition, options = {}) {
|
|
|
1575
1575
|
async startSession(options) {
|
|
1576
1576
|
const host = options?.host;
|
|
1577
1577
|
if (host) {
|
|
1578
|
-
const { createHostedWorkspaceSession } = await import("./host-
|
|
1578
|
+
const { createHostedWorkspaceSession } = await import("./host-CcCDXyJI.js").then((n) => n.n);
|
|
1579
1579
|
return await createHostedWorkspaceSession(workspace, {
|
|
1580
1580
|
...options,
|
|
1581
1581
|
host
|
|
@@ -1591,7 +1591,7 @@ function createWorkspace(definition, options = {}) {
|
|
|
1591
1591
|
const synchronizedWorkspace = workspace;
|
|
1592
1592
|
synchronizedWorkspace.__workspaceDefinitionSyncKey = definition;
|
|
1593
1593
|
synchronizedWorkspace.__syncWorkspaceDefinition = async (abortSignal) => {
|
|
1594
|
-
const { syncWorkspaceDefinition } = await import("./lifecycle-
|
|
1594
|
+
const { syncWorkspaceDefinition } = await import("./lifecycle-CXiS7Dks.js").then((n) => n.t);
|
|
1595
1595
|
await syncWorkspaceDefinition(definition, store, abortSignal);
|
|
1596
1596
|
};
|
|
1597
1597
|
return attachWorkspaceSourceRequestExecution(workspace, createWorkspaceSourceRequestExecution(definition));
|
package/dist/{workspace-inspection-scanner-BlJ8bCAB.js → workspace-inspection-scanner-6QrvwVJG.js}
RENAMED
|
@@ -70,16 +70,11 @@ function objectProperties(object) {
|
|
|
70
70
|
value: unwrapExpression(node.value)
|
|
71
71
|
});
|
|
72
72
|
}
|
|
73
|
-
/** The value of a template literal without substitutions. */
|
|
74
73
|
function staticTemplate(node) {
|
|
75
74
|
if (node.expressions.length) return dynamic;
|
|
76
75
|
return node.quasis[0]?.value.cooked ?? dynamic;
|
|
77
76
|
}
|
|
78
77
|
const escapePattern = /\\(u\{[^}]*\}?|u[\s\S]{0,4}|x[\s\S]{0,2}|0\d|[\s\S])/g;
|
|
79
|
-
/**
|
|
80
|
-
* True when a string literal has an escape that strict mode code rejects. The parser recovers from some bad escapes
|
|
81
|
-
* and accepts legacy octal escapes, so the scanner checks them again.
|
|
82
|
-
*/
|
|
83
78
|
function hasInvalidEscape(raw) {
|
|
84
79
|
for (const [, escape = ""] of raw.matchAll(escapePattern)) if (escape.startsWith("u{")) {
|
|
85
80
|
const code = escape.slice(2, -1);
|