@diagonal-hq/cli 0.26.2 → 0.26.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.mjs +400 -166
- package/package.json +1 -1
package/dist/cli.mjs
CHANGED
|
@@ -9724,7 +9724,7 @@ var require_typescript = __commonJS({
|
|
|
9724
9724
|
rangeStartPositionsAreOnSameLine: () => rangeStartPositionsAreOnSameLine,
|
|
9725
9725
|
readBuilderProgram: () => readBuilderProgram,
|
|
9726
9726
|
readConfigFile: () => readConfigFile,
|
|
9727
|
-
readJson: () =>
|
|
9727
|
+
readJson: () => readJson2,
|
|
9728
9728
|
readJsonConfigFile: () => readJsonConfigFile,
|
|
9729
9729
|
readJsonOrUndefined: () => readJsonOrUndefined,
|
|
9730
9730
|
reduceEachLeadingCommentRange: () => reduceEachLeadingCommentRange,
|
|
@@ -16388,7 +16388,7 @@ ${lanes.join("\n")}
|
|
|
16388
16388
|
return process.memoryUsage().heapUsed;
|
|
16389
16389
|
},
|
|
16390
16390
|
getFileSize(path) {
|
|
16391
|
-
const stat =
|
|
16391
|
+
const stat = statSync8(path);
|
|
16392
16392
|
if (stat == null ? void 0 : stat.isFile()) {
|
|
16393
16393
|
return stat.size;
|
|
16394
16394
|
}
|
|
@@ -16432,7 +16432,7 @@ ${lanes.join("\n")}
|
|
|
16432
16432
|
}
|
|
16433
16433
|
};
|
|
16434
16434
|
return nodeSystem;
|
|
16435
|
-
function
|
|
16435
|
+
function statSync8(path) {
|
|
16436
16436
|
try {
|
|
16437
16437
|
return _fs.statSync(path, statSyncOptions);
|
|
16438
16438
|
} catch {
|
|
@@ -16491,7 +16491,7 @@ ${lanes.join("\n")}
|
|
|
16491
16491
|
activeSession.post("Profiler.stop", (err, { profile }) => {
|
|
16492
16492
|
var _a;
|
|
16493
16493
|
if (!err) {
|
|
16494
|
-
if ((_a =
|
|
16494
|
+
if ((_a = statSync8(profilePath)) == null ? void 0 : _a.isDirectory()) {
|
|
16495
16495
|
profilePath = _path.join(profilePath, `${(/* @__PURE__ */ new Date()).toISOString().replace(/:/g, "-")}+P${process.pid}.cpuprofile`);
|
|
16496
16496
|
}
|
|
16497
16497
|
try {
|
|
@@ -16611,7 +16611,7 @@ ${lanes.join("\n")}
|
|
|
16611
16611
|
let stat;
|
|
16612
16612
|
if (typeof dirent === "string" || dirent.isSymbolicLink()) {
|
|
16613
16613
|
const name = combinePaths(path, entry);
|
|
16614
|
-
stat =
|
|
16614
|
+
stat = statSync8(name);
|
|
16615
16615
|
if (!stat) {
|
|
16616
16616
|
continue;
|
|
16617
16617
|
}
|
|
@@ -16635,7 +16635,7 @@ ${lanes.join("\n")}
|
|
|
16635
16635
|
return matchFiles(path, extensions, excludes, includes, useCaseSensitiveFileNames2, process.cwd(), depth, getAccessibleFileSystemEntries, realpath);
|
|
16636
16636
|
}
|
|
16637
16637
|
function fileSystemEntryExists(path, entryKind) {
|
|
16638
|
-
const stat =
|
|
16638
|
+
const stat = statSync8(path);
|
|
16639
16639
|
if (!stat) {
|
|
16640
16640
|
return false;
|
|
16641
16641
|
}
|
|
@@ -16677,7 +16677,7 @@ ${lanes.join("\n")}
|
|
|
16677
16677
|
}
|
|
16678
16678
|
function getModifiedTime3(path) {
|
|
16679
16679
|
var _a;
|
|
16680
|
-
return (_a =
|
|
16680
|
+
return (_a = statSync8(path)) == null ? void 0 : _a.mtime;
|
|
16681
16681
|
}
|
|
16682
16682
|
function setModifiedTime(path, time) {
|
|
16683
16683
|
try {
|
|
@@ -17141,11 +17141,11 @@ ${lanes.join("\n")}
|
|
|
17141
17141
|
return toComponents;
|
|
17142
17142
|
}
|
|
17143
17143
|
const components = toComponents.slice(start);
|
|
17144
|
-
const
|
|
17144
|
+
const relative7 = [];
|
|
17145
17145
|
for (; start < fromComponents.length; start++) {
|
|
17146
|
-
|
|
17146
|
+
relative7.push("..");
|
|
17147
17147
|
}
|
|
17148
|
-
return ["", ...
|
|
17148
|
+
return ["", ...relative7, ...components];
|
|
17149
17149
|
}
|
|
17150
17150
|
function getRelativePathFromDirectory(fromDirectory, to, getCanonicalFileNameOrIgnoreCase) {
|
|
17151
17151
|
Debug.assert(getRootLength(fromDirectory) > 0 === getRootLength(to) > 0, "Paths must either both be absolute or both be relative");
|
|
@@ -29464,7 +29464,7 @@ ${lanes.join("\n")}
|
|
|
29464
29464
|
}
|
|
29465
29465
|
return result;
|
|
29466
29466
|
}
|
|
29467
|
-
function
|
|
29467
|
+
function readJson2(path, host) {
|
|
29468
29468
|
return readJsonOrUndefined(path, host) || {};
|
|
29469
29469
|
}
|
|
29470
29470
|
function tryParseJson(text2) {
|
|
@@ -30662,13 +30662,13 @@ ${lanes.join("\n")}
|
|
|
30662
30662
|
function guessDirectorySymlink(a, b2, cwd, getCanonicalFileName) {
|
|
30663
30663
|
const aParts = getPathComponents(getNormalizedAbsolutePath(a, cwd));
|
|
30664
30664
|
const bParts = getPathComponents(getNormalizedAbsolutePath(b2, cwd));
|
|
30665
|
-
let
|
|
30665
|
+
let isDirectory2 = false;
|
|
30666
30666
|
while (aParts.length >= 2 && bParts.length >= 2 && !isNodeModulesOrScopedPackageDirectory(aParts[aParts.length - 2], getCanonicalFileName) && !isNodeModulesOrScopedPackageDirectory(bParts[bParts.length - 2], getCanonicalFileName) && getCanonicalFileName(aParts[aParts.length - 1]) === getCanonicalFileName(bParts[bParts.length - 1])) {
|
|
30667
30667
|
aParts.pop();
|
|
30668
30668
|
bParts.pop();
|
|
30669
|
-
|
|
30669
|
+
isDirectory2 = true;
|
|
30670
30670
|
}
|
|
30671
|
-
return
|
|
30671
|
+
return isDirectory2 ? [getPathFromPathComponents(aParts), getPathFromPathComponents(bParts)] : void 0;
|
|
30672
30672
|
}
|
|
30673
30673
|
function isNodeModulesOrScopedPackageDirectory(s, getCanonicalFileName) {
|
|
30674
30674
|
return s !== void 0 && (getCanonicalFileName(s) === "node_modules" || startsWith(s, "@"));
|
|
@@ -55574,7 +55574,7 @@ ${lanes.join("\n")}
|
|
|
55574
55574
|
for (const typeDirectivePath of host.getDirectories(root)) {
|
|
55575
55575
|
const normalized = normalizePath2(typeDirectivePath);
|
|
55576
55576
|
const packageJsonPath = combinePaths(root, normalized, "package.json");
|
|
55577
|
-
const isNotNeededPackage = host.fileExists(packageJsonPath) &&
|
|
55577
|
+
const isNotNeededPackage = host.fileExists(packageJsonPath) && readJson2(packageJsonPath, host).typings === null;
|
|
55578
55578
|
if (!isNotNeededPackage) {
|
|
55579
55579
|
const baseFileName = getBaseFileName(normalized);
|
|
55580
55580
|
if (baseFileName.charCodeAt(0) !== 46) {
|
|
@@ -56841,7 +56841,7 @@ ${lanes.join("\n")}
|
|
|
56841
56841
|
}
|
|
56842
56842
|
const directoryExists = directoryProbablyExists(packageDirectory, host);
|
|
56843
56843
|
if (directoryExists && host.fileExists(packageJsonPath)) {
|
|
56844
|
-
const packageJsonContent =
|
|
56844
|
+
const packageJsonContent = readJson2(packageJsonPath, host);
|
|
56845
56845
|
if (traceEnabled) {
|
|
56846
56846
|
trace(host, Diagnostics.Found_package_json_at_0, packageJsonPath);
|
|
56847
56847
|
}
|
|
@@ -61690,9 +61690,9 @@ ${lanes.join("\n")}
|
|
|
61690
61690
|
if (!startsWithDirectory(target, realPathDirectory, getCanonicalFileName)) {
|
|
61691
61691
|
return;
|
|
61692
61692
|
}
|
|
61693
|
-
const
|
|
61693
|
+
const relative7 = getRelativePathFromDirectory(realPathDirectory, target, getCanonicalFileName);
|
|
61694
61694
|
for (const symlinkDirectory of symlinkDirectories) {
|
|
61695
|
-
const option = resolvePath(symlinkDirectory,
|
|
61695
|
+
const option = resolvePath(symlinkDirectory, relative7);
|
|
61696
61696
|
const result2 = cb(option, target === referenceRedirect);
|
|
61697
61697
|
shouldFilterIgnoredPaths = true;
|
|
61698
61698
|
if (result2) return result2;
|
|
@@ -151090,7 +151090,7 @@ ${lanes.join("\n")}
|
|
|
151090
151090
|
function isBuilderProgram(program3) {
|
|
151091
151091
|
return !!program3.state;
|
|
151092
151092
|
}
|
|
151093
|
-
function
|
|
151093
|
+
function listFiles(program3, write) {
|
|
151094
151094
|
const options2 = program3.getCompilerOptions();
|
|
151095
151095
|
if (options2.explainFiles) {
|
|
151096
151096
|
explainFiles(isBuilderProgram(program3) ? program3.getProgram() : program3, write);
|
|
@@ -151351,7 +151351,7 @@ ${lanes.join("\n")}
|
|
|
151351
151351
|
const filepath = getNormalizedAbsolutePath(file2, currentDir);
|
|
151352
151352
|
write(`TSFILE: ${filepath}`);
|
|
151353
151353
|
});
|
|
151354
|
-
|
|
151354
|
+
listFiles(program3, write);
|
|
151355
151355
|
}
|
|
151356
151356
|
if (reportSummary) {
|
|
151357
151357
|
reportSummary(getErrorCountForSummary(diagnostics), getFilesInErrorForSummary(diagnostics));
|
|
@@ -190389,7 +190389,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
190389
190389
|
if (!moduleSpecifierIsRelative) {
|
|
190390
190390
|
const packageJsonPath = findPackageJson(baseDirectory, host);
|
|
190391
190391
|
if (packageJsonPath) {
|
|
190392
|
-
const packageJson =
|
|
190392
|
+
const packageJson = readJson2(packageJsonPath, host);
|
|
190393
190393
|
const typesVersions = packageJson.typesVersions;
|
|
190394
190394
|
if (typeof typesVersions === "object") {
|
|
190395
190395
|
const versionPaths = (_a = getPackageJsonTypesVersionsPaths(typesVersions)) == null ? void 0 : _a.paths;
|
|
@@ -190594,7 +190594,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
190594
190594
|
if (resolvePackageJsonImports && !seenPackageScope) {
|
|
190595
190595
|
const packageFile = combinePaths(directory, "package.json");
|
|
190596
190596
|
if (seenPackageScope = tryFileExists(host, packageFile)) {
|
|
190597
|
-
const packageJson =
|
|
190597
|
+
const packageJson = readJson2(packageFile, host);
|
|
190598
190598
|
exportsOrImportsLookup(
|
|
190599
190599
|
packageJson.imports,
|
|
190600
190600
|
fragment,
|
|
@@ -190648,7 +190648,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
190648
190648
|
const packageDirectory = combinePaths(ancestor, "node_modules", packagePath);
|
|
190649
190649
|
const packageFile = combinePaths(packageDirectory, "package.json");
|
|
190650
190650
|
if (tryFileExists(host, packageFile)) {
|
|
190651
|
-
const packageJson =
|
|
190651
|
+
const packageJson = readJson2(packageFile, host);
|
|
190652
190652
|
const fragmentSubpath = components.join("/") + (components.length && hasTrailingDirectorySeparator(fragment) ? "/" : "");
|
|
190653
190653
|
if (exportsOrImportsLookup(
|
|
190654
190654
|
packageJson.exports,
|
|
@@ -190917,7 +190917,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
190917
190917
|
if (!host.readFile || !host.fileExists) return emptyArray;
|
|
190918
190918
|
const result = [];
|
|
190919
190919
|
for (const packageJson of findPackageJsons(scriptPath, host)) {
|
|
190920
|
-
const contents =
|
|
190920
|
+
const contents = readJson2(packageJson, host);
|
|
190921
190921
|
for (const key of nodeModulesDependencyKeys) {
|
|
190922
190922
|
const dependencies = contents[key];
|
|
190923
190923
|
if (!dependencies) continue;
|
|
@@ -205981,7 +205981,7 @@ ${options2.prefix}` : "\n" : options2.prefix
|
|
|
205981
205981
|
rangeStartPositionsAreOnSameLine: () => rangeStartPositionsAreOnSameLine,
|
|
205982
205982
|
readBuilderProgram: () => readBuilderProgram,
|
|
205983
205983
|
readConfigFile: () => readConfigFile,
|
|
205984
|
-
readJson: () =>
|
|
205984
|
+
readJson: () => readJson2,
|
|
205985
205985
|
readJsonConfigFile: () => readJsonConfigFile,
|
|
205986
205986
|
readJsonOrUndefined: () => readJsonOrUndefined,
|
|
205987
205987
|
reduceEachLeadingCommentRange: () => reduceEachLeadingCommentRange,
|
|
@@ -251817,7 +251817,7 @@ interface String {
|
|
|
251817
251817
|
|
|
251818
251818
|
// scripts/lib/runtime-build/check-cli.mjs
|
|
251819
251819
|
init_define_globalThis_DIAGONAL_SDK_RUNTIME();
|
|
251820
|
-
import { statSync as
|
|
251820
|
+
import { statSync as statSync7 } from "node:fs";
|
|
251821
251821
|
import { resolve as resolve7 } from "node:path";
|
|
251822
251822
|
|
|
251823
251823
|
// scripts/lib/runtime-build/api-cli.mjs
|
|
@@ -292369,6 +292369,14 @@ function diagnosticAt(path, node, message, options2) {
|
|
|
292369
292369
|
const start = node?.loc?.start;
|
|
292370
292370
|
return diagnostic(path, start ? start.line : 1, start ? start.column + 1 : 1, message, options2);
|
|
292371
292371
|
}
|
|
292372
|
+
function hasErrors(diagnostics) {
|
|
292373
|
+
return diagnostics.some((diagnostic2) => diagnostic2.severity === "error");
|
|
292374
|
+
}
|
|
292375
|
+
function sortDiagnostics(diagnostics) {
|
|
292376
|
+
return diagnostics.toSorted(
|
|
292377
|
+
(left, right) => left.path.localeCompare(right.path) || left.line - right.line || left.column - right.column
|
|
292378
|
+
);
|
|
292379
|
+
}
|
|
292372
292380
|
function diagnosticFromError(path, error) {
|
|
292373
292381
|
if (error instanceof SourceError) {
|
|
292374
292382
|
return diagnosticAt(path, error.node, error.message);
|
|
@@ -306947,8 +306955,8 @@ function recordBindingUsages(root, paths, entries) {
|
|
|
306947
306955
|
}
|
|
306948
306956
|
|
|
306949
306957
|
// scripts/lib/runtime-build/build-workspace.mjs
|
|
306950
|
-
import { existsSync as
|
|
306951
|
-
import { basename as basename14, dirname as
|
|
306958
|
+
import { existsSync as existsSync7, mkdirSync as mkdirSync3, readFileSync as readFileSync14, writeFileSync as writeFileSync5 } from "node:fs";
|
|
306959
|
+
import { basename as basename14, dirname as dirname9, extname as extname3, join as join19 } from "node:path";
|
|
306952
306960
|
|
|
306953
306961
|
// scripts/lib/runtime-build/brand-kit.mjs
|
|
306954
306962
|
init_define_globalThis_DIAGONAL_SDK_RUNTIME();
|
|
@@ -310935,10 +310943,37 @@ function layoutNameOf(names2, slug) {
|
|
|
310935
310943
|
return [...names2.entries()].find(([, layout]) => layout.slug === slug)?.[0] ?? null;
|
|
310936
310944
|
}
|
|
310937
310945
|
|
|
310946
|
+
// scripts/lib/runtime-build/checkout-files.mjs
|
|
310947
|
+
init_define_globalThis_DIAGONAL_SDK_RUNTIME();
|
|
310948
|
+
import { readdirSync as readdirSync2 } from "node:fs";
|
|
310949
|
+
import { join as join5, relative as relative2, sep } from "node:path";
|
|
310950
|
+
var PACKAGE_DIRECTORY = "node_modules";
|
|
310951
|
+
function listCheckoutFiles(root, skippedRootDirectories) {
|
|
310952
|
+
const files = [];
|
|
310953
|
+
const pending = [root];
|
|
310954
|
+
while (pending.length > 0) {
|
|
310955
|
+
const directory = pending.pop();
|
|
310956
|
+
for (const entry of readdirSync2(directory, { withFileTypes: true })) {
|
|
310957
|
+
if (entry.name.startsWith(".")) {
|
|
310958
|
+
continue;
|
|
310959
|
+
}
|
|
310960
|
+
if (entry.isDirectory()) {
|
|
310961
|
+
const skipped = entry.name === PACKAGE_DIRECTORY || directory === root && skippedRootDirectories.has(entry.name);
|
|
310962
|
+
if (!skipped) {
|
|
310963
|
+
pending.push(join5(directory, entry.name));
|
|
310964
|
+
}
|
|
310965
|
+
} else if (entry.isFile()) {
|
|
310966
|
+
files.push(relative2(root, join5(directory, entry.name)).split(sep).join("/"));
|
|
310967
|
+
}
|
|
310968
|
+
}
|
|
310969
|
+
}
|
|
310970
|
+
return files.toSorted((left, right) => left < right ? -1 : left > right ? 1 : 0);
|
|
310971
|
+
}
|
|
310972
|
+
|
|
310938
310973
|
// scripts/lib/runtime-build/config-domains.mjs
|
|
310939
310974
|
init_define_globalThis_DIAGONAL_SDK_RUNTIME();
|
|
310940
310975
|
import { existsSync as existsSync2, readFileSync as readFileSync3 } from "node:fs";
|
|
310941
|
-
import { join as
|
|
310976
|
+
import { join as join6 } from "node:path";
|
|
310942
310977
|
|
|
310943
310978
|
// scripts/lib/runtime-build/domain-references.mjs
|
|
310944
310979
|
init_define_globalThis_DIAGONAL_SDK_RUNTIME();
|
|
@@ -311067,7 +311102,7 @@ function hostKey(domainKey, domains, primaryDomain) {
|
|
|
311067
311102
|
return domains.some((domain) => domain.key === domainKey && domain.fallback === "primary") ? "" : domainKey;
|
|
311068
311103
|
}
|
|
311069
311104
|
function readDomainKeys(root) {
|
|
311070
|
-
const path =
|
|
311105
|
+
const path = join6(root, CONFIG_PATH);
|
|
311071
311106
|
if (!existsSync2(path)) {
|
|
311072
311107
|
return null;
|
|
311073
311108
|
}
|
|
@@ -311118,6 +311153,215 @@ function propertyKeyOrNull(property) {
|
|
|
311118
311153
|
}
|
|
311119
311154
|
}
|
|
311120
311155
|
|
|
311156
|
+
// scripts/lib/runtime-build/installed-packages.mjs
|
|
311157
|
+
init_define_globalThis_DIAGONAL_SDK_RUNTIME();
|
|
311158
|
+
import { copyFileSync, cpSync, existsSync as existsSync3, mkdirSync, mkdtempSync, readFileSync as readFileSync4, rmSync, statSync as statSync3, symlinkSync, writeFileSync as writeFileSync3 } from "node:fs";
|
|
311159
|
+
import { tmpdir } from "node:os";
|
|
311160
|
+
import { dirname as dirname2, join as join7, relative as relative3 } from "node:path";
|
|
311161
|
+
var DIAGONAL_PACKAGE_FIELD = "diagonal";
|
|
311162
|
+
var WORKSPACE_ONLY_FILES = /* @__PURE__ */ new Set(["diagonal.config.ts", "assets.ts", "redirects.ts"]);
|
|
311163
|
+
var ROOT_MODULE_EXTENSIONS = [...SOURCE_EXTENSIONS, ".css"];
|
|
311164
|
+
var SKIPPED_DIRECTORIES = /* @__PURE__ */ new Set(["vendor", "generated"]);
|
|
311165
|
+
var PACKAGE_NAME = /^(?:@[a-z0-9-~][a-z0-9-._~]*\/)?[a-z0-9-~][a-z0-9-._~]*$/;
|
|
311166
|
+
function composePackages(root) {
|
|
311167
|
+
const diagnostics = [];
|
|
311168
|
+
const packages = [];
|
|
311169
|
+
const files = /* @__PURE__ */ new Map();
|
|
311170
|
+
const dependencies = /* @__PURE__ */ new Set();
|
|
311171
|
+
const manifest = readJson(join7(root, "package.json"));
|
|
311172
|
+
const declared = Object.entries(manifest?.dependencies ?? {}).filter(([name, specifier]) => PACKAGE_NAME.test(name) && typeof specifier === "string").toSorted(([left], [right]) => left < right ? -1 : left > right ? 1 : 0);
|
|
311173
|
+
if (declared.length === 0) {
|
|
311174
|
+
return { packages, files, dependencies, diagnostics };
|
|
311175
|
+
}
|
|
311176
|
+
const workspaceFiles = new Set(listCheckoutFiles(root, /* @__PURE__ */ new Set(["vendor"])));
|
|
311177
|
+
for (const [name, specifier] of declared) {
|
|
311178
|
+
const installed = join7(root, "node_modules", name);
|
|
311179
|
+
const overrides = join7(root, "vendor", name);
|
|
311180
|
+
const hasOverrides = isDirectory(overrides);
|
|
311181
|
+
const installedManifest = readJson(join7(installed, "package.json"));
|
|
311182
|
+
if (installedManifest === null) {
|
|
311183
|
+
if (hasOverrides && !specifier.startsWith("file:")) {
|
|
311184
|
+
diagnostics.push(diagnosticAt(`vendor/${name}`, null, `vendor/${name} changes the files of the package "${name}", which is not installed. Run npm install`));
|
|
311185
|
+
}
|
|
311186
|
+
continue;
|
|
311187
|
+
}
|
|
311188
|
+
if (!isDiagonalPackage(installedManifest)) {
|
|
311189
|
+
continue;
|
|
311190
|
+
}
|
|
311191
|
+
const owned = /* @__PURE__ */ new Map();
|
|
311192
|
+
for (const path of listCheckoutFiles(installed, SKIPPED_DIRECTORIES)) {
|
|
311193
|
+
owned.set(path, `node_modules/${name}/${path}`);
|
|
311194
|
+
}
|
|
311195
|
+
if (hasOverrides) {
|
|
311196
|
+
for (const path of listCheckoutFiles(overrides, SKIPPED_DIRECTORIES)) {
|
|
311197
|
+
owned.set(path, `vendor/${name}/${path}`);
|
|
311198
|
+
}
|
|
311199
|
+
}
|
|
311200
|
+
const packageFiles = [];
|
|
311201
|
+
for (const [path, source] of owned) {
|
|
311202
|
+
if (WORKSPACE_ONLY_FILES.has(path)) {
|
|
311203
|
+
diagnostics.push(diagnosticAt(source, null, `A package cannot have ${path}. Only the workspace has it. Remove it from the package`));
|
|
311204
|
+
continue;
|
|
311205
|
+
}
|
|
311206
|
+
if (!path.includes("/") && !ROOT_MODULE_EXTENSIONS.some((extension) => path.endsWith(extension))) {
|
|
311207
|
+
continue;
|
|
311208
|
+
}
|
|
311209
|
+
if (workspaceFiles.has(path)) {
|
|
311210
|
+
diagnostics.push(
|
|
311211
|
+
diagnosticAt(
|
|
311212
|
+
path,
|
|
311213
|
+
null,
|
|
311214
|
+
`${path} is a file of the workspace and of the package "${name}" (${source}). A path has one owner. To change the package file, move this file to vendor/${name}/${path}`,
|
|
311215
|
+
{ relatedPath: source }
|
|
311216
|
+
)
|
|
311217
|
+
);
|
|
311218
|
+
continue;
|
|
311219
|
+
}
|
|
311220
|
+
const other = files.get(path);
|
|
311221
|
+
if (other !== void 0) {
|
|
311222
|
+
diagnostics.push(
|
|
311223
|
+
diagnosticAt(
|
|
311224
|
+
source,
|
|
311225
|
+
null,
|
|
311226
|
+
`${path} is a file of the package "${other.name}" (${other.source}) and of the package "${name}" (${source}). A path has one owner`,
|
|
311227
|
+
{ relatedPath: other.source }
|
|
311228
|
+
)
|
|
311229
|
+
);
|
|
311230
|
+
continue;
|
|
311231
|
+
}
|
|
311232
|
+
files.set(path, { name, source });
|
|
311233
|
+
packageFiles.push({ path, source });
|
|
311234
|
+
}
|
|
311235
|
+
const packageDependencies = /* @__PURE__ */ new Set();
|
|
311236
|
+
for (const field2 of ["dependencies", "peerDependencies"]) {
|
|
311237
|
+
for (const dependency of Object.keys(installedManifest[field2] ?? {})) {
|
|
311238
|
+
dependencies.add(dependency);
|
|
311239
|
+
packageDependencies.add(dependency);
|
|
311240
|
+
}
|
|
311241
|
+
}
|
|
311242
|
+
packages.push({
|
|
311243
|
+
name,
|
|
311244
|
+
version: typeof installedManifest.version === "string" ? installedManifest.version : null,
|
|
311245
|
+
files: packageFiles,
|
|
311246
|
+
dependencies: [...packageDependencies].toSorted()
|
|
311247
|
+
});
|
|
311248
|
+
}
|
|
311249
|
+
return { packages, files, dependencies, diagnostics };
|
|
311250
|
+
}
|
|
311251
|
+
function materializePackages(root, plan) {
|
|
311252
|
+
for (const [path, { source }] of plan.files) {
|
|
311253
|
+
const target = join7(root, path);
|
|
311254
|
+
mkdirSync(dirname2(target), { recursive: true });
|
|
311255
|
+
copyFileSync(join7(root, source), target);
|
|
311256
|
+
}
|
|
311257
|
+
}
|
|
311258
|
+
function buildComposedCheckout(root, plan, options2, build) {
|
|
311259
|
+
const composed = mkdtempSync(join7(tmpdir(), "diagonal-packages-"));
|
|
311260
|
+
try {
|
|
311261
|
+
cpSync(root, composed, {
|
|
311262
|
+
recursive: true,
|
|
311263
|
+
filter: (source) => {
|
|
311264
|
+
const path = relative3(root, source);
|
|
311265
|
+
return path !== "node_modules" && path !== ".git";
|
|
311266
|
+
}
|
|
311267
|
+
});
|
|
311268
|
+
if (existsSync3(join7(root, "node_modules"))) {
|
|
311269
|
+
symlinkSync(join7(root, "node_modules"), join7(composed, "node_modules"), "dir");
|
|
311270
|
+
}
|
|
311271
|
+
materializePackages(composed, plan);
|
|
311272
|
+
const result = build(composed, plan, options2);
|
|
311273
|
+
for (const path of listCheckoutFiles(composed, /* @__PURE__ */ new Set())) {
|
|
311274
|
+
const owner = plan.files.get(path);
|
|
311275
|
+
const content = readFileSync4(join7(composed, path));
|
|
311276
|
+
if (owner !== void 0) {
|
|
311277
|
+
if (!content.equals(readFileSync4(join7(root, owner.source)))) {
|
|
311278
|
+
result.diagnostics.push(
|
|
311279
|
+
diagnosticAt(
|
|
311280
|
+
owner.source,
|
|
311281
|
+
null,
|
|
311282
|
+
`The build changed ${path}, a file of the package "${owner.name}" (${owner.source}). A package file is not written here: each definition needs a uid, and a page cannot use deprecated options. Fix the package`
|
|
311283
|
+
)
|
|
311284
|
+
);
|
|
311285
|
+
}
|
|
311286
|
+
continue;
|
|
311287
|
+
}
|
|
311288
|
+
if (options2.writeSource !== true) {
|
|
311289
|
+
continue;
|
|
311290
|
+
}
|
|
311291
|
+
const target = join7(root, path);
|
|
311292
|
+
if (!existsSync3(target) || !readFileSync4(target).equals(content)) {
|
|
311293
|
+
mkdirSync(dirname2(target), { recursive: true });
|
|
311294
|
+
writeFileSync3(target, content);
|
|
311295
|
+
}
|
|
311296
|
+
}
|
|
311297
|
+
result.ok = !hasErrors(result.diagnostics);
|
|
311298
|
+
result.diagnostics = sortDiagnostics(result.diagnostics);
|
|
311299
|
+
return result;
|
|
311300
|
+
} finally {
|
|
311301
|
+
rmSync(composed, { recursive: true, force: true });
|
|
311302
|
+
}
|
|
311303
|
+
}
|
|
311304
|
+
var TYPESCRIPT_CONFIG = "tsconfig.json";
|
|
311305
|
+
var APP_PATH_PATTERN = "@app/*";
|
|
311306
|
+
var PACKAGE_TREE = /^\.\/(?:vendor|node_modules)\/.+/;
|
|
311307
|
+
function writeTypeScriptConfig(root, plan) {
|
|
311308
|
+
const path = join7(root, TYPESCRIPT_CONFIG);
|
|
311309
|
+
const config = readJson(path);
|
|
311310
|
+
if (config === null) {
|
|
311311
|
+
return false;
|
|
311312
|
+
}
|
|
311313
|
+
const options2 = isPlainObject4(config.compilerOptions) ? config.compilerOptions : {};
|
|
311314
|
+
const trees = plan.packages.flatMap(({ name }) => [`./vendor/${name}`, `./node_modules/${name}`]);
|
|
311315
|
+
const ownRootDirs = (Array.isArray(options2.rootDirs) ? options2.rootDirs : []).filter((entry) => typeof entry !== "string" || entry !== "." && !PACKAGE_TREE.test(entry));
|
|
311316
|
+
const paths = isPlainObject4(options2.paths) ? options2.paths : {};
|
|
311317
|
+
const ownAppPaths = (Array.isArray(paths[APP_PATH_PATTERN]) ? paths[APP_PATH_PATTERN] : ["./*"]).filter((entry) => typeof entry !== "string" || !PACKAGE_TREE.test(entry));
|
|
311318
|
+
const next = {
|
|
311319
|
+
...config,
|
|
311320
|
+
compilerOptions: {
|
|
311321
|
+
...options2,
|
|
311322
|
+
...trees.length > 0 ? { rootDirs: [".", ...ownRootDirs, ...trees] } : {},
|
|
311323
|
+
paths: { ...paths, [APP_PATH_PATTERN]: [...ownAppPaths, ...trees.map((tree) => `${tree}/*`)] }
|
|
311324
|
+
}
|
|
311325
|
+
};
|
|
311326
|
+
if (trees.length === 0) {
|
|
311327
|
+
if (ownRootDirs.length > 0) {
|
|
311328
|
+
next.compilerOptions.rootDirs = [".", ...ownRootDirs];
|
|
311329
|
+
} else {
|
|
311330
|
+
delete next.compilerOptions.rootDirs;
|
|
311331
|
+
}
|
|
311332
|
+
}
|
|
311333
|
+
const text2 = `${JSON.stringify(next, null, 2)}
|
|
311334
|
+
`;
|
|
311335
|
+
if (readFileSync4(path, "utf8") === text2) {
|
|
311336
|
+
return false;
|
|
311337
|
+
}
|
|
311338
|
+
writeFileSync3(path, text2);
|
|
311339
|
+
return true;
|
|
311340
|
+
}
|
|
311341
|
+
function isDiagonalPackage(manifest) {
|
|
311342
|
+
return isPlainObject4(manifest[DIAGONAL_PACKAGE_FIELD]);
|
|
311343
|
+
}
|
|
311344
|
+
function readJson(path) {
|
|
311345
|
+
if (!existsSync3(path)) {
|
|
311346
|
+
return null;
|
|
311347
|
+
}
|
|
311348
|
+
try {
|
|
311349
|
+
const value = JSON.parse(readFileSync4(path, "utf8"));
|
|
311350
|
+
return isPlainObject4(value) ? value : null;
|
|
311351
|
+
} catch (error) {
|
|
311352
|
+
if (error instanceof SyntaxError) {
|
|
311353
|
+
return null;
|
|
311354
|
+
}
|
|
311355
|
+
throw error;
|
|
311356
|
+
}
|
|
311357
|
+
}
|
|
311358
|
+
function isPlainObject4(value) {
|
|
311359
|
+
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
311360
|
+
}
|
|
311361
|
+
function isDirectory(path) {
|
|
311362
|
+
return existsSync3(path) && statSync3(path).isDirectory();
|
|
311363
|
+
}
|
|
311364
|
+
|
|
311121
311365
|
// scripts/lib/runtime-build/redirects-file.mjs
|
|
311122
311366
|
init_define_globalThis_DIAGONAL_SDK_RUNTIME();
|
|
311123
311367
|
var REDIRECTS_PATH = "redirects.ts";
|
|
@@ -314640,15 +314884,15 @@ function readAuthorizer(authorizer, node, trigger, report) {
|
|
|
314640
314884
|
init_define_globalThis_DIAGONAL_SDK_RUNTIME();
|
|
314641
314885
|
var import_typescript2 = __toESM(require_typescript(), 1);
|
|
314642
314886
|
import { spawnSync } from "node:child_process";
|
|
314643
|
-
import { mkdirSync, mkdtempSync, realpathSync as realpathSync2, rmSync, writeFileSync as
|
|
314644
|
-
import { tmpdir } from "node:os";
|
|
314645
|
-
import { basename as basename10, dirname as
|
|
314887
|
+
import { mkdirSync as mkdirSync2, mkdtempSync as mkdtempSync2, realpathSync as realpathSync2, rmSync as rmSync2, writeFileSync as writeFileSync4 } from "node:fs";
|
|
314888
|
+
import { tmpdir as tmpdir2 } from "node:os";
|
|
314889
|
+
import { basename as basename10, dirname as dirname4, join as join12, relative as relative5 } from "node:path";
|
|
314646
314890
|
|
|
314647
314891
|
// scripts/lib/runtime-build/app-modules.mjs
|
|
314648
314892
|
init_define_globalThis_DIAGONAL_SDK_RUNTIME();
|
|
314649
314893
|
var import_sucrase = __toESM(require_dist3(), 1);
|
|
314650
|
-
import { readFileSync as
|
|
314651
|
-
import { join as
|
|
314894
|
+
import { readFileSync as readFileSync7 } from "node:fs";
|
|
314895
|
+
import { join as join10 } from "node:path";
|
|
314652
314896
|
|
|
314653
314897
|
// packages/cli/index.js
|
|
314654
314898
|
var cli_exports = {};
|
|
@@ -314780,8 +315024,8 @@ var defineTest = (config, handlers) => ({ config, ...handlers });
|
|
|
314780
315024
|
|
|
314781
315025
|
// scripts/lib/runtime-build/module-graph.mjs
|
|
314782
315026
|
init_define_globalThis_DIAGONAL_SDK_RUNTIME();
|
|
314783
|
-
import { readFileSync as
|
|
314784
|
-
import { posix as posix2, join as
|
|
315027
|
+
import { readFileSync as readFileSync6 } from "node:fs";
|
|
315028
|
+
import { posix as posix2, join as join9 } from "node:path";
|
|
314785
315029
|
|
|
314786
315030
|
// scripts/lib/runtime-build/page-build-protocol.mjs
|
|
314787
315031
|
init_define_globalThis_DIAGONAL_SDK_RUNTIME();
|
|
@@ -315478,8 +315722,8 @@ import { basename as basename9 } from "node:path";
|
|
|
315478
315722
|
|
|
315479
315723
|
// scripts/lib/runtime-build/workspace-fields.mjs
|
|
315480
315724
|
init_define_globalThis_DIAGONAL_SDK_RUNTIME();
|
|
315481
|
-
import { readFileSync as
|
|
315482
|
-
import { basename as basename8, join as
|
|
315725
|
+
import { readFileSync as readFileSync5 } from "node:fs";
|
|
315726
|
+
import { basename as basename8, join as join8 } from "node:path";
|
|
315483
315727
|
|
|
315484
315728
|
// packages/cli/workspace-settings-catalog.json
|
|
315485
315729
|
var workspace_settings_catalog_default = {
|
|
@@ -315737,7 +315981,7 @@ function readWorkspaceFields(root, paths, diagnostics, { write = false, recordBi
|
|
|
315737
315981
|
const keysByPath = /* @__PURE__ */ new Map();
|
|
315738
315982
|
for (const path of paths) {
|
|
315739
315983
|
try {
|
|
315740
|
-
const source =
|
|
315984
|
+
const source = readFileSync5(join8(root, path), "utf8");
|
|
315741
315985
|
const ast = parseSource(source, { jsx: false });
|
|
315742
315986
|
const argument = defineWorkspaceFieldArgument(ast);
|
|
315743
315987
|
const declared = declaredSlug(argument, "key");
|
|
@@ -316169,8 +316413,7 @@ function checkModuleImports(root, path, ast, packages) {
|
|
|
316169
316413
|
}
|
|
316170
316414
|
return { diagnostics, imports, blocksUnitBuild };
|
|
316171
316415
|
}
|
|
316172
|
-
function buildModuleGraph(root, entries,
|
|
316173
|
-
const packages = declaredPackages(manifest);
|
|
316416
|
+
function buildModuleGraph(root, entries, packages, diagnostics, assetKeys = /* @__PURE__ */ new Set(), generated = /* @__PURE__ */ new Map()) {
|
|
316174
316417
|
const scannedStyles = /* @__PURE__ */ new Set();
|
|
316175
316418
|
const modules = {};
|
|
316176
316419
|
const parsed = new Map(entries.map((entry) => [entry.path, entry]));
|
|
@@ -316184,12 +316427,12 @@ function buildModuleGraph(root, entries, manifest, diagnostics, assetKeys = /* @
|
|
|
316184
316427
|
const kind = importKind(`./${posix2.basename(path)}`);
|
|
316185
316428
|
if (STYLE_KINDS.has(kind)) {
|
|
316186
316429
|
checkStylesheet(root, path, assetKeys, diagnostics, scannedStyles);
|
|
316187
|
-
modules[path] = { kind, source_sha256: sha256(
|
|
316430
|
+
modules[path] = { kind, source_sha256: sha256(readFileSync6(join9(root, path))), imports: [] };
|
|
316188
316431
|
continue;
|
|
316189
316432
|
}
|
|
316190
316433
|
let entry = parsed.get(path);
|
|
316191
316434
|
if (entry === void 0) {
|
|
316192
|
-
const source =
|
|
316435
|
+
const source = readFileSync6(join9(root, path), "utf8");
|
|
316193
316436
|
try {
|
|
316194
316437
|
entry = { path, source, ast: parseSource(source, { jsx: path.endsWith("x") }) };
|
|
316195
316438
|
} catch (error) {
|
|
@@ -316357,7 +316600,7 @@ function checkStylesheet(root, path, assetKeys, diagnostics, scanned) {
|
|
|
316357
316600
|
return;
|
|
316358
316601
|
}
|
|
316359
316602
|
scanned.add(path);
|
|
316360
|
-
const { urls, imports } = cssReferences(
|
|
316603
|
+
const { urls, imports } = cssReferences(readFileSync6(join9(root, path), "utf8"));
|
|
316361
316604
|
for (const url of urls) {
|
|
316362
316605
|
const key = assetUrlKey(url.value);
|
|
316363
316606
|
if (key !== null && assetKeys !== null && !assetKeys.has(key)) {
|
|
@@ -316477,7 +316720,7 @@ function appModuleClosure(root, imports, external = /* @__PURE__ */ new Set(), {
|
|
|
316477
316720
|
if (modules.has(path)) {
|
|
316478
316721
|
continue;
|
|
316479
316722
|
}
|
|
316480
|
-
const read2 =
|
|
316723
|
+
const read2 = readFileSync7(join10(root, path), "utf8");
|
|
316481
316724
|
const source = transform3 === null ? read2 : transform3(path, read2);
|
|
316482
316725
|
const ast = parseModule(path, source);
|
|
316483
316726
|
const requires = {};
|
|
@@ -316604,34 +316847,34 @@ function compileModule(path, source) {
|
|
|
316604
316847
|
|
|
316605
316848
|
// scripts/lib/runtime-build/script-sdk.mjs
|
|
316606
316849
|
init_define_globalThis_DIAGONAL_SDK_RUNTIME();
|
|
316607
|
-
import { readFileSync as
|
|
316850
|
+
import { readFileSync as readFileSync8, readdirSync as readdirSync3, statSync as statSync4 } from "node:fs";
|
|
316608
316851
|
import { createRequire } from "node:module";
|
|
316609
|
-
import { dirname as
|
|
316852
|
+
import { dirname as dirname3, join as join11, relative as relative4, resolve as resolve4 } from "node:path";
|
|
316610
316853
|
import { fileURLToPath } from "node:url";
|
|
316611
316854
|
var SCRIPT_SDK_ROOT = resolve4(
|
|
316612
|
-
|
|
316855
|
+
dirname3(fileURLToPath(import.meta.url)),
|
|
316613
316856
|
"../../../packages/workflows/src"
|
|
316614
316857
|
);
|
|
316615
316858
|
var SDK_RUNTIME_ENTRY_POINTS = {
|
|
316616
|
-
workflow:
|
|
316617
|
-
testing:
|
|
316859
|
+
workflow: join11(SCRIPT_SDK_ROOT, "index.ts"),
|
|
316860
|
+
testing: join11(SCRIPT_SDK_ROOT, "testing/index.ts"),
|
|
316618
316861
|
"quickjs-testing": fileURLToPath(new URL("./quickjs-testing.mjs", import.meta.url))
|
|
316619
316862
|
};
|
|
316620
316863
|
function walk(directory) {
|
|
316621
|
-
return
|
|
316622
|
-
(name) =>
|
|
316864
|
+
return readdirSync3(directory).flatMap(
|
|
316865
|
+
(name) => statSync4(join11(directory, name)).isDirectory() ? walk(join11(directory, name)) : [join11(directory, name)]
|
|
316623
316866
|
);
|
|
316624
316867
|
}
|
|
316625
316868
|
function readSandboxSdkFiles() {
|
|
316626
316869
|
return Object.fromEntries(
|
|
316627
316870
|
walk(SCRIPT_SDK_ROOT).filter(
|
|
316628
316871
|
(file2) => file2.endsWith(".ts") && !file2.includes("/testing/") && !file2.endsWith("/http-transport.ts") && !file2.endsWith("/workspace.generated.ts")
|
|
316629
|
-
).map((file2) => [`/sdk/${
|
|
316872
|
+
).map((file2) => [`/sdk/${relative4(SCRIPT_SDK_ROOT, file2)}`, readFileSync8(file2, "utf8")])
|
|
316630
316873
|
);
|
|
316631
316874
|
}
|
|
316632
316875
|
function bundleQuickJsSdkRuntime(buildSync) {
|
|
316633
316876
|
const result = buildSync({
|
|
316634
|
-
entryPoints: [
|
|
316877
|
+
entryPoints: [join11(SCRIPT_SDK_ROOT, "runtime/quickjs.ts")],
|
|
316635
316878
|
bundle: true,
|
|
316636
316879
|
write: false,
|
|
316637
316880
|
format: "iife",
|
|
@@ -316655,7 +316898,7 @@ function bundleSdkRuntime(buildSync) {
|
|
|
316655
316898
|
logLevel: "silent"
|
|
316656
316899
|
});
|
|
316657
316900
|
return Object.fromEntries(
|
|
316658
|
-
result.outputFiles.map((file2) => [
|
|
316901
|
+
result.outputFiles.map((file2) => [relative4("/sdk", file2.path), file2.text])
|
|
316659
316902
|
);
|
|
316660
316903
|
}
|
|
316661
316904
|
var sdkFiles;
|
|
@@ -316773,8 +317016,8 @@ function importDiagnostics(test, scriptNames, workspaceRoot, subject) {
|
|
|
316773
317016
|
const diagnostics = [];
|
|
316774
317017
|
for (const node of moduleSpecifierNodes(test.ast)) {
|
|
316775
317018
|
const specifier = node.value;
|
|
316776
|
-
const
|
|
316777
|
-
if (NODE_TEST_MODULES.has(specifier) || Object.hasOwn(SDK_MODULES, specifier) ||
|
|
317019
|
+
const relative7 = RELATIVE_WORKFLOW.exec(specifier);
|
|
317020
|
+
if (NODE_TEST_MODULES.has(specifier) || Object.hasOwn(SDK_MODULES, specifier) || relative7 !== null && scriptNames.has(relative7[1]) || isAppSpecifier(specifier) && workspaceRoot !== null && resolveAppSpecifier(workspaceRoot, specifier) !== null) {
|
|
316778
317021
|
continue;
|
|
316779
317022
|
}
|
|
316780
317023
|
diagnostics.push(
|
|
@@ -316807,12 +317050,12 @@ function sandboxPrefix(path) {
|
|
|
316807
317050
|
return "../".repeat(path.split("/").length - 1) || "./";
|
|
316808
317051
|
}
|
|
316809
317052
|
function relativeSandboxPath(from, target) {
|
|
316810
|
-
const path =
|
|
317053
|
+
const path = relative5(dirname4(from), sandboxPath(target));
|
|
316811
317054
|
return path.startsWith(".") ? path : `./${path}`;
|
|
316812
317055
|
}
|
|
316813
317056
|
function writeFile(root, path, content) {
|
|
316814
|
-
|
|
316815
|
-
|
|
317057
|
+
mkdirSync2(dirname4(join12(root, path)), { recursive: true });
|
|
317058
|
+
writeFileSync4(join12(root, path), content);
|
|
316816
317059
|
}
|
|
316817
317060
|
function parseResults(stdout) {
|
|
316818
317061
|
return stdout.split("\n").filter((line) => line.startsWith(RESULT_PREFIX)).map((line) => JSON.parse(line.slice(RESULT_PREFIX.length)));
|
|
@@ -316884,7 +317127,7 @@ function runScriptTests({
|
|
|
316884
317127
|
modules.set(path, module);
|
|
316885
317128
|
}
|
|
316886
317129
|
}
|
|
316887
|
-
const root = realpathSync2(
|
|
317130
|
+
const root = realpathSync2(mkdtempSync2(join12(tmpdir2(), "diagonal-workflow-tests-")));
|
|
316888
317131
|
try {
|
|
316889
317132
|
writeFile(root, "package.json", '{"type":"module"}\n');
|
|
316890
317133
|
writeFile(root, "reporter.mjs", REPORTER_SOURCE);
|
|
@@ -316927,12 +317170,12 @@ function runScriptTests({
|
|
|
316927
317170
|
root,
|
|
316928
317171
|
test.path.replace(/\.ts$/, ".js"),
|
|
316929
317172
|
transpile(test.path, test.source, test.ast, (specifier) => {
|
|
316930
|
-
const
|
|
317173
|
+
const relative7 = RELATIVE_WORKFLOW.exec(specifier);
|
|
316931
317174
|
const target = isAppSpecifier(specifier) && workspaceRoot !== null ? resolveAppSpecifier(workspaceRoot, specifier) : null;
|
|
316932
317175
|
if (target !== null) {
|
|
316933
317176
|
return relativeSandboxPath(test.path, target);
|
|
316934
317177
|
}
|
|
316935
|
-
return
|
|
317178
|
+
return relative7 !== null ? `./${relative7[1]}.js` : resolveSdk(specifier);
|
|
316936
317179
|
})
|
|
316937
317180
|
);
|
|
316938
317181
|
}
|
|
@@ -316961,7 +317204,7 @@ function runScriptTests({
|
|
|
316961
317204
|
const results = parseResults(run.stdout ?? "");
|
|
316962
317205
|
const timedOut = run.error?.code === "ETIMEDOUT" || run.signal !== null;
|
|
316963
317206
|
const testResults = runnable.map((test) => {
|
|
316964
|
-
const file2 =
|
|
317207
|
+
const file2 = join12(root, test.path.replace(/\.ts$/, ".js"));
|
|
316965
317208
|
const own = results.filter((result) => result.file === file2);
|
|
316966
317209
|
for (const result of own) {
|
|
316967
317210
|
if (!result.ok) {
|
|
@@ -317008,7 +317251,7 @@ function runScriptTests({
|
|
|
317008
317251
|
});
|
|
317009
317252
|
return { testResults, diagnostics };
|
|
317010
317253
|
} finally {
|
|
317011
|
-
|
|
317254
|
+
rmSync2(root, { recursive: true, force: true });
|
|
317012
317255
|
}
|
|
317013
317256
|
}
|
|
317014
317257
|
|
|
@@ -317341,9 +317584,9 @@ function literal(node) {
|
|
|
317341
317584
|
|
|
317342
317585
|
// scripts/lib/workflow-script/lib-files.mjs
|
|
317343
317586
|
init_define_globalThis_DIAGONAL_SDK_RUNTIME();
|
|
317344
|
-
import { readFileSync as
|
|
317587
|
+
import { readFileSync as readFileSync9 } from "node:fs";
|
|
317345
317588
|
import { createRequire as createRequire2 } from "node:module";
|
|
317346
|
-
import { dirname as
|
|
317589
|
+
import { dirname as dirname5, join as join13 } from "node:path";
|
|
317347
317590
|
var ROOT_LIB = "lib.es2023.d.ts";
|
|
317348
317591
|
function libClosure(read2, root = ROOT_LIB) {
|
|
317349
317592
|
const files = {};
|
|
@@ -317361,8 +317604,8 @@ function libClosure(read2, root = ROOT_LIB) {
|
|
|
317361
317604
|
return files;
|
|
317362
317605
|
}
|
|
317363
317606
|
function readLibClosure(root = ROOT_LIB) {
|
|
317364
|
-
const libDir =
|
|
317365
|
-
return libClosure((name) =>
|
|
317607
|
+
const libDir = dirname5(createRequire2(import.meta.url).resolve("typescript/lib/lib.d.ts"));
|
|
317608
|
+
return libClosure((name) => readFileSync9(join13(libDir, name), "utf8"), root);
|
|
317366
317609
|
}
|
|
317367
317610
|
|
|
317368
317611
|
// scripts/lib/workflow-script/lint-rules.mjs
|
|
@@ -321497,8 +321740,8 @@ and limitations under the License.
|
|
|
321497
321740
|
|
|
321498
321741
|
// scripts/pageTypeCheck.mjs
|
|
321499
321742
|
init_define_globalThis_DIAGONAL_SDK_RUNTIME();
|
|
321500
|
-
import { existsSync as
|
|
321501
|
-
import { dirname as
|
|
321743
|
+
import { existsSync as existsSync4, readFileSync as readFileSync10 } from "node:fs";
|
|
321744
|
+
import { dirname as dirname6, join as join14 } from "node:path";
|
|
321502
321745
|
|
|
321503
321746
|
// app/pages/resources/js/pageRuntime/sdk/buildCustomComponentTypes.ts
|
|
321504
321747
|
init_define_globalThis_DIAGONAL_SDK_RUNTIME();
|
|
@@ -321945,13 +322188,13 @@ function typeCheckPage(userSource, {
|
|
|
321945
322188
|
} : {}
|
|
321946
322189
|
};
|
|
321947
322190
|
const defaultLib = ts9.getDefaultLibFileName(options2);
|
|
321948
|
-
const libDir = libFiles3 ? null :
|
|
322191
|
+
const libDir = libFiles3 ? null : dirname6(ts9.getDefaultLibFilePath(options2));
|
|
321949
322192
|
const readLib = (name) => {
|
|
321950
322193
|
if (libFiles3) {
|
|
321951
322194
|
return libFiles3.get(name);
|
|
321952
322195
|
}
|
|
321953
|
-
const path =
|
|
321954
|
-
return
|
|
322196
|
+
const path = join14(libDir, name);
|
|
322197
|
+
return existsSync4(path) ? readFileSync10(path, "utf8") : void 0;
|
|
321955
322198
|
};
|
|
321956
322199
|
const getText = (name) => virtual.get(name) ?? readLib(name);
|
|
321957
322200
|
const host = {
|
|
@@ -324601,18 +324844,18 @@ function withoutBuildNodes(resource) {
|
|
|
324601
324844
|
|
|
324602
324845
|
// scripts/lib/runtime-build/sdk-packages.mjs
|
|
324603
324846
|
init_define_globalThis_DIAGONAL_SDK_RUNTIME();
|
|
324604
|
-
import { existsSync as
|
|
324605
|
-
import { join as
|
|
324847
|
+
import { existsSync as existsSync5, readFileSync as readFileSync11 } from "node:fs";
|
|
324848
|
+
import { join as join15 } from "node:path";
|
|
324606
324849
|
var DIAGONAL_PACKAGE = /^@diagonal(-hq)?\//;
|
|
324607
324850
|
var TARBALL_VERSION = /-(\d+\.\d+\.\d+(?:[-+][0-9A-Za-z.-]+)?)\.tgz$/;
|
|
324608
324851
|
var EXACT_VERSION = /^\d+\.\d+\.\d+(?:[-+][0-9A-Za-z.-]+)?$/;
|
|
324609
324852
|
function readPackageFiles(root, diagnostics) {
|
|
324610
324853
|
const read2 = (path) => {
|
|
324611
|
-
if (!
|
|
324854
|
+
if (!existsSync5(join15(root, path))) {
|
|
324612
324855
|
return null;
|
|
324613
324856
|
}
|
|
324614
324857
|
try {
|
|
324615
|
-
return JSON.parse(
|
|
324858
|
+
return JSON.parse(readFileSync11(join15(root, path), "utf8"));
|
|
324616
324859
|
} catch (error) {
|
|
324617
324860
|
if (!(error instanceof SyntaxError)) {
|
|
324618
324861
|
throw error;
|
|
@@ -324807,7 +325050,7 @@ function checkSkillFiles(files, { root = null, write = false } = {}) {
|
|
|
324807
325050
|
|
|
324808
325051
|
// scripts/lib/runtime-build/test-suites.mjs
|
|
324809
325052
|
init_define_globalThis_DIAGONAL_SDK_RUNTIME();
|
|
324810
|
-
import { basename as basename13, dirname as
|
|
325053
|
+
import { basename as basename13, dirname as dirname8 } from "node:path";
|
|
324811
325054
|
|
|
324812
325055
|
// scripts/lib/test-code/check.mjs
|
|
324813
325056
|
init_define_globalThis_DIAGONAL_SDK_RUNTIME();
|
|
@@ -325025,22 +325268,22 @@ init_define_globalThis_DIAGONAL_SDK_RUNTIME();
|
|
|
325025
325268
|
|
|
325026
325269
|
// scripts/lib/test-code/files.mjs
|
|
325027
325270
|
init_define_globalThis_DIAGONAL_SDK_RUNTIME();
|
|
325028
|
-
import { readFileSync as
|
|
325029
|
-
import { dirname as
|
|
325271
|
+
import { readFileSync as readFileSync13 } from "node:fs";
|
|
325272
|
+
import { dirname as dirname7, join as join17, resolve as resolve5 } from "node:path";
|
|
325030
325273
|
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
325031
325274
|
|
|
325032
325275
|
// scripts/lib/workflow-script/sdk-sources.mjs
|
|
325033
325276
|
init_define_globalThis_DIAGONAL_SDK_RUNTIME();
|
|
325034
|
-
import { readFileSync as
|
|
325035
|
-
import { join as
|
|
325277
|
+
import { readFileSync as readFileSync12, readdirSync as readdirSync4, statSync as statSync5 } from "node:fs";
|
|
325278
|
+
import { join as join16, relative as relative6 } from "node:path";
|
|
325036
325279
|
function readSandboxSdkSources(sdkRoot) {
|
|
325037
|
-
const walk2 = (dir) =>
|
|
325038
|
-
(name) =>
|
|
325280
|
+
const walk2 = (dir) => readdirSync4(dir).flatMap(
|
|
325281
|
+
(name) => statSync5(join16(dir, name)).isDirectory() ? walk2(join16(dir, name)) : [join16(dir, name)]
|
|
325039
325282
|
);
|
|
325040
325283
|
return Object.fromEntries(
|
|
325041
325284
|
walk2(sdkRoot).filter(
|
|
325042
325285
|
(file2) => file2.endsWith(".ts") && !file2.includes("/testing/") && !file2.endsWith("/http-transport.ts") && !file2.endsWith("/workspace.generated.ts")
|
|
325043
|
-
).map((file2) => [
|
|
325286
|
+
).map((file2) => [relative6(sdkRoot, file2), readFileSync12(file2, "utf8")])
|
|
325044
325287
|
);
|
|
325045
325288
|
}
|
|
325046
325289
|
|
|
@@ -325052,15 +325295,15 @@ var PLAYWRIGHT_DECLARATIONS = [
|
|
|
325052
325295
|
];
|
|
325053
325296
|
var ROOT_LIB2 = "lib.esnext.full.d.ts";
|
|
325054
325297
|
function readTestCodeFiles() {
|
|
325055
|
-
const root = resolve5(
|
|
325298
|
+
const root = resolve5(dirname7(fileURLToPath2(import.meta.url)), "../../..");
|
|
325056
325299
|
return {
|
|
325057
|
-
sdk: readSandboxSdkSources(
|
|
325300
|
+
sdk: readSandboxSdkSources(join17(root, "packages/workflows/src")),
|
|
325058
325301
|
playwright: Object.fromEntries(
|
|
325059
325302
|
// test-runner/playwright-types holds the declarations of the Playwright version that the fleet runs, which
|
|
325060
325303
|
// can differ from the version in this checkout's node_modules.
|
|
325061
325304
|
PLAYWRIGHT_DECLARATIONS.map((path) => [
|
|
325062
325305
|
path,
|
|
325063
|
-
|
|
325306
|
+
readFileSync13(join17(root, "test-runner/playwright-types", path), "utf8")
|
|
325064
325307
|
])
|
|
325065
325308
|
),
|
|
325066
325309
|
libs: readLibClosure(ROOT_LIB2)
|
|
@@ -325194,7 +325437,7 @@ function readSuite(file2, report) {
|
|
|
325194
325437
|
}
|
|
325195
325438
|
const read2 = readConfig(
|
|
325196
325439
|
node,
|
|
325197
|
-
{ allowed: SUITE_PROPERTIES, noun: "test suite", fallbackName: basename13(
|
|
325440
|
+
{ allowed: SUITE_PROPERTIES, noun: "test suite", fallbackName: basename13(dirname8(file2.path)) },
|
|
325198
325441
|
report
|
|
325199
325442
|
);
|
|
325200
325443
|
return read2 === null ? null : { name: read2.name, description: read2.description };
|
|
@@ -325402,7 +325645,7 @@ function buildTest(file2, context, diagnostics) {
|
|
|
325402
325645
|
if (SPLIT_TEST_FILE_PATTERN.test(key)) {
|
|
325403
325646
|
report(
|
|
325404
325647
|
null,
|
|
325405
|
-
`A test is one file. Move this code into ${
|
|
325648
|
+
`A test is one file. Move this code into ${dirname8(file2.path)}/${key.replace(SPLIT_TEST_FILE_PATTERN, "")}.ts as ${TEST_DEFINE}(config, { setup, test, assert })`
|
|
325406
325649
|
);
|
|
325407
325650
|
return null;
|
|
325408
325651
|
}
|
|
@@ -325502,10 +325745,10 @@ function buildTestSuites({
|
|
|
325502
325745
|
};
|
|
325503
325746
|
const testsByDirectory = /* @__PURE__ */ new Map();
|
|
325504
325747
|
for (const file2 of tests) {
|
|
325505
|
-
const directory =
|
|
325748
|
+
const directory = dirname8(file2.path);
|
|
325506
325749
|
testsByDirectory.set(directory, [...testsByDirectory.get(directory) ?? [], file2]);
|
|
325507
325750
|
}
|
|
325508
|
-
const suiteDirectories = new Set(suites.map((suite) =>
|
|
325751
|
+
const suiteDirectories = new Set(suites.map((suite) => dirname8(suite.path)));
|
|
325509
325752
|
for (const [directory, files] of testsByDirectory) {
|
|
325510
325753
|
if (!suiteDirectories.has(directory)) {
|
|
325511
325754
|
for (const file2 of files) {
|
|
@@ -325515,7 +325758,7 @@ function buildTestSuites({
|
|
|
325515
325758
|
}
|
|
325516
325759
|
const built = [];
|
|
325517
325760
|
for (const suite of suites) {
|
|
325518
|
-
const directory =
|
|
325761
|
+
const directory = dirname8(suite.path);
|
|
325519
325762
|
const read2 = readSuite(suite, report(suite.path));
|
|
325520
325763
|
const files = (testsByDirectory.get(directory) ?? []).toSorted((left, right) => left.path < right.path ? -1 : 1);
|
|
325521
325764
|
if (files.length > MAX_TESTS_PER_SUITE) {
|
|
@@ -325562,8 +325805,8 @@ function typeCheckTestFunctions(context, resourceNames2) {
|
|
|
325562
325805
|
|
|
325563
325806
|
// scripts/lib/runtime-build/ui-sources.mjs
|
|
325564
325807
|
init_define_globalThis_DIAGONAL_SDK_RUNTIME();
|
|
325565
|
-
import { existsSync as
|
|
325566
|
-
import { join as
|
|
325808
|
+
import { existsSync as existsSync6 } from "node:fs";
|
|
325809
|
+
import { join as join18 } from "node:path";
|
|
325567
325810
|
|
|
325568
325811
|
// app/pages/resources/js/pageRuntime/compiler/draftPagesName.ts
|
|
325569
325812
|
init_define_globalThis_DIAGONAL_SDK_RUNTIME();
|
|
@@ -325838,7 +326081,7 @@ function appImports(root, path, source, ast) {
|
|
|
325838
326081
|
return { imports, lazy, modules, bindings, prelude, draftPrelude: draftPagesPrelude(root, loaded) ?? prelude };
|
|
325839
326082
|
}
|
|
325840
326083
|
function draftPagesPrelude(root, loaded) {
|
|
325841
|
-
if (!
|
|
326084
|
+
if (!existsSync6(join18(root, GENERATED_PAGES_PATH))) {
|
|
325842
326085
|
return null;
|
|
325843
326086
|
}
|
|
325844
326087
|
const modules = appModuleClosure(root, [...loaded, { path: GENERATED_PAGES_PATH }], /* @__PURE__ */ new Set(), { ui: true });
|
|
@@ -326292,29 +326535,9 @@ var NOTIFICATION_TYPE_PATTERN = /^notifications\/[^/]+\/type\.ts$/;
|
|
|
326292
326535
|
var NOTIFICATION_TEMPLATE_PATTERN = /^notifications\/[^/]+\/[^/]+\.template\.ts$/;
|
|
326293
326536
|
var NOTIFICATION_SCHEDULE_PATTERN = /^notifications\/[^/]+\/[^/]+\.schedule\.ts$/;
|
|
326294
326537
|
var EMAIL_LAYOUT_PATTERN = /^email-layouts\/[^/]+\/layout\.ts$/;
|
|
326295
|
-
var IGNORED_DIRECTORIES = /* @__PURE__ */ new Set(["
|
|
326538
|
+
var IGNORED_DIRECTORIES = /* @__PURE__ */ new Set(["vendor"]);
|
|
326296
326539
|
var COMPONENT_NAME_PATTERN = /^[A-Z][A-Za-z0-9]*$/;
|
|
326297
326540
|
var RECORD_BINDING_NON_USERS = /* @__PURE__ */ new Set(["record_binding", "workflow_test", "migration_test", "test", "test_suite"]);
|
|
326298
|
-
function listFiles(root) {
|
|
326299
|
-
const files = [];
|
|
326300
|
-
const pending = [root];
|
|
326301
|
-
while (pending.length > 0) {
|
|
326302
|
-
const directory = pending.pop();
|
|
326303
|
-
for (const entry of readdirSync4(directory, { withFileTypes: true })) {
|
|
326304
|
-
if (entry.name.startsWith(".")) {
|
|
326305
|
-
continue;
|
|
326306
|
-
}
|
|
326307
|
-
if (entry.isDirectory()) {
|
|
326308
|
-
if (!IGNORED_DIRECTORIES.has(entry.name)) {
|
|
326309
|
-
pending.push(join17(directory, entry.name));
|
|
326310
|
-
}
|
|
326311
|
-
} else if (entry.isFile()) {
|
|
326312
|
-
files.push(relative5(root, join17(directory, entry.name)).split(sep).join("/"));
|
|
326313
|
-
}
|
|
326314
|
-
}
|
|
326315
|
-
}
|
|
326316
|
-
return files.toSorted((left, right) => left < right ? -1 : left > right ? 1 : 0);
|
|
326317
|
-
}
|
|
326318
326541
|
var MODULE_ENTITY_TYPES = { layouts: "layout", components: "component" };
|
|
326319
326542
|
var ENTRY_TYPES = /* @__PURE__ */ new Map([
|
|
326320
326543
|
["layout", { output: "layouts", build: (path, source, ast, root) => buildLayout2(path, path, source, ast, root) }],
|
|
@@ -326540,7 +326763,7 @@ function classify(path) {
|
|
|
326540
326763
|
}
|
|
326541
326764
|
function rereadWorkflowFiles(root, workflowFiles) {
|
|
326542
326765
|
return workflowFiles.map((file2) => {
|
|
326543
|
-
const source =
|
|
326766
|
+
const source = readFileSync14(join19(root, file2.path), "utf8");
|
|
326544
326767
|
return source === file2.source ? file2 : { path: file2.path, source, ast: parseSource(source, { jsx: false }) };
|
|
326545
326768
|
});
|
|
326546
326769
|
}
|
|
@@ -326677,15 +326900,15 @@ function checkPublicPageBindings(pages, resources, diagnostics) {
|
|
|
326677
326900
|
}
|
|
326678
326901
|
}
|
|
326679
326902
|
function writeGeneratedModule(root, relativePath, source, hasEntries) {
|
|
326680
|
-
const path =
|
|
326681
|
-
if (!hasEntries && !
|
|
326903
|
+
const path = join19(root, relativePath);
|
|
326904
|
+
if (!hasEntries && !existsSync7(path)) {
|
|
326682
326905
|
return;
|
|
326683
326906
|
}
|
|
326684
|
-
if (
|
|
326907
|
+
if (existsSync7(path) && readFileSync14(path, "utf8") === source) {
|
|
326685
326908
|
return;
|
|
326686
326909
|
}
|
|
326687
|
-
|
|
326688
|
-
|
|
326910
|
+
mkdirSync3(dirname9(path), { recursive: true });
|
|
326911
|
+
writeFileSync5(path, source);
|
|
326689
326912
|
}
|
|
326690
326913
|
function buildPermissionFiles(root, files, write, diagnostics) {
|
|
326691
326914
|
const paths = files.filter((path) => classify(path) === "permission").toSorted();
|
|
@@ -326693,7 +326916,7 @@ function buildPermissionFiles(root, files, write, diagnostics) {
|
|
|
326693
326916
|
const permissions = [];
|
|
326694
326917
|
const sources = /* @__PURE__ */ new Map();
|
|
326695
326918
|
for (const path of paths) {
|
|
326696
|
-
const source =
|
|
326919
|
+
const source = readFileSync14(join19(root, path), "utf8");
|
|
326697
326920
|
try {
|
|
326698
326921
|
permissions.push(
|
|
326699
326922
|
buildPermission(path, definePermissionArgument(parseSource(source, { jsx: false })))
|
|
@@ -326736,7 +326959,7 @@ function buildRoleFiles(root, files, write, known, diagnostics) {
|
|
|
326736
326959
|
const roles = [];
|
|
326737
326960
|
const sources = /* @__PURE__ */ new Map();
|
|
326738
326961
|
for (const path of paths) {
|
|
326739
|
-
const source =
|
|
326962
|
+
const source = readFileSync14(join19(root, path), "utf8");
|
|
326740
326963
|
try {
|
|
326741
326964
|
const ast = parseSource(source, { jsx: false });
|
|
326742
326965
|
roles.push(
|
|
@@ -326797,7 +327020,7 @@ function checkPagePermissions(pages, permissions, diagnostics) {
|
|
|
326797
327020
|
function readWorkflowReferences(root, files, diagnostics) {
|
|
326798
327021
|
const workflowFiles = files.filter((path) => classify(path) === "workflow").map((path) => {
|
|
326799
327022
|
try {
|
|
326800
|
-
return { path, ast: parseSource(
|
|
327023
|
+
return { path, ast: parseSource(readFileSync14(join19(root, path), "utf8"), { jsx: false }) };
|
|
326801
327024
|
} catch (error) {
|
|
326802
327025
|
if (error instanceof SyntaxError) {
|
|
326803
327026
|
return { path, ast: null };
|
|
@@ -326836,7 +327059,7 @@ function buildPageEntries(root, files, write, diagnostics) {
|
|
|
326836
327059
|
const paths = files.filter((path) => classify(path) === "page");
|
|
326837
327060
|
const pages = [];
|
|
326838
327061
|
for (const path of paths) {
|
|
326839
|
-
const source =
|
|
327062
|
+
const source = readFileSync14(join19(root, path), "utf8");
|
|
326840
327063
|
try {
|
|
326841
327064
|
pages.push({ path, source, ast: parseSource(source, { jsx: true }) });
|
|
326842
327065
|
} catch (error) {
|
|
@@ -326864,7 +327087,7 @@ function buildNotifications(root, files, { writeSource, names: names2, resources
|
|
|
326864
327087
|
const uidDefinitions = [];
|
|
326865
327088
|
for (const path of paths) {
|
|
326866
327089
|
const kind = classify(path);
|
|
326867
|
-
const source =
|
|
327090
|
+
const source = readFileSync14(join19(root, path), "utf8");
|
|
326868
327091
|
try {
|
|
326869
327092
|
const ast = parseSource(source, { jsx: false });
|
|
326870
327093
|
for (const { type, node } of uidDefinitionNodes(kind, path, ast)) {
|
|
@@ -326916,7 +327139,7 @@ function readLiquidFiles(root, files) {
|
|
|
326916
327139
|
return new Map(
|
|
326917
327140
|
files.filter(
|
|
326918
327141
|
(path) => NOTIFICATION_DIRECTORIES.includes(topDirectory(path)) && path.endsWith(".liquid")
|
|
326919
|
-
).map((path) => [path,
|
|
327142
|
+
).map((path) => [path, readFileSync14(join19(root, path), "utf8")])
|
|
326920
327143
|
);
|
|
326921
327144
|
}
|
|
326922
327145
|
function objectProperty2(object, key) {
|
|
@@ -327079,11 +327302,23 @@ function uidPositionKey(path, recordKey = null) {
|
|
|
327079
327302
|
return recordKey === null ? path : `${path}\0${recordKey}`;
|
|
327080
327303
|
}
|
|
327081
327304
|
var ENTITY_UID_TYPES = /* @__PURE__ */ new Set(["page", "workflow", "layout", "component", NOTIFICATION_DEFINITIONS.email_layout.type]);
|
|
327082
|
-
function
|
|
327083
|
-
|
|
327305
|
+
function buildWorkspace(root, options2 = {}) {
|
|
327306
|
+
const plan = composePackages(root);
|
|
327307
|
+
return plan.files.size > 0 ? buildComposedCheckout(root, plan, options2, buildMaterializedWorkspace) : buildMaterializedWorkspace(root, plan, options2);
|
|
327084
327308
|
}
|
|
327085
|
-
function
|
|
327086
|
-
const
|
|
327309
|
+
function atPackageSource(diagnostic2, plan) {
|
|
327310
|
+
const source = (path) => plan.files.get(path)?.source ?? path;
|
|
327311
|
+
const result = { ...diagnostic2, path: source(diagnostic2.path) };
|
|
327312
|
+
if (typeof diagnostic2.related_path === "string") {
|
|
327313
|
+
result.related_path = source(diagnostic2.related_path);
|
|
327314
|
+
}
|
|
327315
|
+
return result;
|
|
327316
|
+
}
|
|
327317
|
+
function buildMaterializedWorkspace(root, plan, { assetCatalog = null, writeSource = false, fixSource = false, entryPaths = [] } = {}) {
|
|
327318
|
+
const diagnostics = [...plan.diagnostics];
|
|
327319
|
+
if (writeSource) {
|
|
327320
|
+
writeTypeScriptConfig(root, plan);
|
|
327321
|
+
}
|
|
327087
327322
|
const output = {
|
|
327088
327323
|
config: null,
|
|
327089
327324
|
assets: [],
|
|
@@ -327110,11 +327345,11 @@ function buildWorkspace(root, { assetCatalog = null, writeSource = false, fixSou
|
|
|
327110
327345
|
const testSuiteFiles = [];
|
|
327111
327346
|
const testFiles = [];
|
|
327112
327347
|
let brandAssets = [];
|
|
327113
|
-
const files =
|
|
327348
|
+
const files = listCheckoutFiles(root, IGNORED_DIRECTORIES);
|
|
327114
327349
|
const moduleUidDefinitions = [];
|
|
327115
327350
|
for (const path of files) {
|
|
327116
327351
|
const type = moduleEntityType(path);
|
|
327117
|
-
const definition = type === null ? null : moduleUidDefinition(type, path,
|
|
327352
|
+
const definition = type === null ? null : moduleUidDefinition(type, path, readFileSync14(join19(root, path), "utf8"));
|
|
327118
327353
|
if (definition !== null) {
|
|
327119
327354
|
moduleUidDefinitions.push(definition);
|
|
327120
327355
|
}
|
|
@@ -327122,7 +327357,7 @@ function buildWorkspace(root, { assetCatalog = null, writeSource = false, fixSou
|
|
|
327122
327357
|
diagnostics.push(...checkDefinitionUids(root, moduleUidDefinitions, { write: writeSource }).diagnostics);
|
|
327123
327358
|
const domainKeys = readDomainKeys(root);
|
|
327124
327359
|
const declaredDomains = domainKeys === null ? null : domainEntries(domainKeys);
|
|
327125
|
-
if (declaredDomains !== null || !
|
|
327360
|
+
if (declaredDomains !== null || !existsSync7(join19(root, GENERATED_DOMAINS_PATH))) {
|
|
327126
327361
|
writeGeneratedModule(
|
|
327127
327362
|
root,
|
|
327128
327363
|
GENERATED_DOMAINS_PATH,
|
|
@@ -327132,7 +327367,7 @@ function buildWorkspace(root, { assetCatalog = null, writeSource = false, fixSou
|
|
|
327132
327367
|
}
|
|
327133
327368
|
const resourceSources = /* @__PURE__ */ new Map();
|
|
327134
327369
|
for (const path of files.filter((item) => classify(item) === "resource")) {
|
|
327135
|
-
const source =
|
|
327370
|
+
const source = readFileSync14(join19(root, path), "utf8");
|
|
327136
327371
|
let ast = null;
|
|
327137
327372
|
try {
|
|
327138
327373
|
ast = parseSource(source, { jsx: false });
|
|
@@ -327153,7 +327388,7 @@ function buildWorkspace(root, { assetCatalog = null, writeSource = false, fixSou
|
|
|
327153
327388
|
writeGeneratedModule(root, GENERATED_RECORD_BINDINGS_PATH, generatedRecordBindingsSource(recordBindings.entries), recordBindings.bindings.length > 0);
|
|
327154
327389
|
const generatedPages = buildPageEntries(root, files, writeSource, diagnostics);
|
|
327155
327390
|
const packageFiles = readPackageFiles(root, diagnostics);
|
|
327156
|
-
const packages = declaredPackages(packageFiles.manifest);
|
|
327391
|
+
const packages = declaredPackages(packageFiles.manifest).union(plan.dependencies);
|
|
327157
327392
|
const uiEntries = [];
|
|
327158
327393
|
const failedPages = /* @__PURE__ */ new Set();
|
|
327159
327394
|
let pageAssets = null;
|
|
@@ -327186,7 +327421,7 @@ function buildWorkspace(root, { assetCatalog = null, writeSource = false, fixSou
|
|
|
327186
327421
|
return;
|
|
327187
327422
|
}
|
|
327188
327423
|
const parsed = resourceSources.get(path);
|
|
327189
|
-
const source = parsed?.source ??
|
|
327424
|
+
const source = parsed?.source ?? readFileSync14(join19(root, path), "utf8");
|
|
327190
327425
|
try {
|
|
327191
327426
|
const ast = parsed?.ast ?? parseSource(source, { jsx: extname3(path) === ".tsx" });
|
|
327192
327427
|
if (kind === "page") {
|
|
@@ -327321,7 +327556,7 @@ function buildWorkspace(root, { assetCatalog = null, writeSource = false, fixSou
|
|
|
327321
327556
|
}
|
|
327322
327557
|
};
|
|
327323
327558
|
const buildUnit = (path, build) => {
|
|
327324
|
-
const source =
|
|
327559
|
+
const source = readFileSync14(join19(root, path), "utf8");
|
|
327325
327560
|
try {
|
|
327326
327561
|
const ast = parseSource(source, { jsx: path.endsWith("x") });
|
|
327327
327562
|
const entry = { path, source, ast };
|
|
@@ -327401,7 +327636,7 @@ function buildWorkspace(root, { assetCatalog = null, writeSource = false, fixSou
|
|
|
327401
327636
|
const assetKeys = assetsComplete ? new Set(output.assets.map((asset2) => asset2.key)) : null;
|
|
327402
327637
|
const assets = assetEntries(output.assets, assetCatalog);
|
|
327403
327638
|
pageAssets = assetsComplete ? assets : null;
|
|
327404
|
-
if (assetsComplete || !
|
|
327639
|
+
if (assetsComplete || !existsSync7(join19(root, GENERATED_ASSETS_PATH))) {
|
|
327405
327640
|
writeGeneratedModule(
|
|
327406
327641
|
root,
|
|
327407
327642
|
GENERATED_ASSETS_PATH,
|
|
@@ -327447,7 +327682,7 @@ function buildWorkspace(root, { assetCatalog = null, writeSource = false, fixSou
|
|
|
327447
327682
|
generatedWorkspaceFieldsSource(generatedWorkspaceFields, workspaceFields, { workflowPackageDeclared }),
|
|
327448
327683
|
workspaceFieldKeysByName.size > 0
|
|
327449
327684
|
);
|
|
327450
|
-
const skillFiles = otherFiles.filter((path) => classify(path) === "skill").map((path) => ({ path, content:
|
|
327685
|
+
const skillFiles = otherFiles.filter((path) => classify(path) === "skill").map((path) => ({ path, content: readFileSync14(join19(root, path), "utf8") }));
|
|
327451
327686
|
const skillCheck = checkSkillFiles(skillFiles, { root, write: writeSource });
|
|
327452
327687
|
output.skills.push(...skillCheck.skills);
|
|
327453
327688
|
diagnostics.push(...skillCheck.diagnostics);
|
|
@@ -327509,7 +327744,7 @@ function buildWorkspace(root, { assetCatalog = null, writeSource = false, fixSou
|
|
|
327509
327744
|
);
|
|
327510
327745
|
diagnostics.push(...generatedPages.uidDiagnostics.filter((diagnostic2) => !failedPages.has(diagnostic2.path)));
|
|
327511
327746
|
for (const [path, source] of migratedPages) {
|
|
327512
|
-
|
|
327747
|
+
writeFileSync5(join19(root, path), source);
|
|
327513
327748
|
}
|
|
327514
327749
|
for (const page of output.pages) {
|
|
327515
327750
|
page.uid = generatedPages.uidsByPath.get(page.path) ?? null;
|
|
@@ -327556,7 +327791,7 @@ function buildWorkspace(root, { assetCatalog = null, writeSource = false, fixSou
|
|
|
327556
327791
|
const moduleGraph = buildModuleGraph(
|
|
327557
327792
|
root,
|
|
327558
327793
|
uiEntries,
|
|
327559
|
-
|
|
327794
|
+
packages,
|
|
327560
327795
|
diagnostics,
|
|
327561
327796
|
assetKeys,
|
|
327562
327797
|
new Map([
|
|
@@ -327582,7 +327817,7 @@ function buildWorkspace(root, { assetCatalog = null, writeSource = false, fixSou
|
|
|
327582
327817
|
}
|
|
327583
327818
|
let entry = entriesByPath.get(path) ?? null;
|
|
327584
327819
|
if (entry === null) {
|
|
327585
|
-
const source =
|
|
327820
|
+
const source = readFileSync14(join19(root, path), "utf8");
|
|
327586
327821
|
try {
|
|
327587
327822
|
entry = { path, source, ast: parseSource(source, { jsx: path.endsWith("x") }) };
|
|
327588
327823
|
} catch (error) {
|
|
@@ -327699,9 +327934,7 @@ function buildWorkspace(root, { assetCatalog = null, writeSource = false, fixSou
|
|
|
327699
327934
|
);
|
|
327700
327935
|
return {
|
|
327701
327936
|
ok: !hasErrors(diagnostics),
|
|
327702
|
-
diagnostics: diagnostics.
|
|
327703
|
-
(left, right) => left.path.localeCompare(right.path) || left.line - right.line || left.column - right.column
|
|
327704
|
-
),
|
|
327937
|
+
diagnostics: sortDiagnostics(diagnostics.map((diagnostic2) => atPackageSource(diagnostic2, plan))),
|
|
327705
327938
|
config: output.config,
|
|
327706
327939
|
domains: output.domains ?? [],
|
|
327707
327940
|
primary_domain: output.primary_domain ?? null,
|
|
@@ -327741,15 +327974,16 @@ function buildWorkspace(root, { assetCatalog = null, writeSource = false, fixSou
|
|
|
327741
327974
|
skills: output.skills,
|
|
327742
327975
|
notifications: notificationCheck.notifications,
|
|
327743
327976
|
module_graph: moduleGraph,
|
|
327744
|
-
sdk_packages: sdkPackages(packageFiles)
|
|
327977
|
+
sdk_packages: sdkPackages(packageFiles),
|
|
327978
|
+
packages: plan.packages
|
|
327745
327979
|
};
|
|
327746
327980
|
}
|
|
327747
327981
|
|
|
327748
327982
|
// scripts/lib/runtime-build/git-cli.mjs
|
|
327749
327983
|
init_define_globalThis_DIAGONAL_SDK_RUNTIME();
|
|
327750
327984
|
import { spawnSync as spawnSync2 } from "node:child_process";
|
|
327751
|
-
import { readFileSync as
|
|
327752
|
-
import { join as
|
|
327985
|
+
import { readFileSync as readFileSync15, writeFileSync as writeFileSync6 } from "node:fs";
|
|
327986
|
+
import { join as join20, resolve as resolve6 } from "node:path";
|
|
327753
327987
|
|
|
327754
327988
|
// scripts/lib/runtime-build/resource-merge.mjs
|
|
327755
327989
|
init_define_globalThis_DIAGONAL_SDK_RUNTIME();
|
|
@@ -328271,15 +328505,15 @@ function mergeDriver(args, { cwd, stderr }) {
|
|
|
328271
328505
|
if (path === void 0 || !isResourceFilePath(path)) {
|
|
328272
328506
|
return lineMerge(base2, ours, theirs, { cwd, stderr });
|
|
328273
328507
|
}
|
|
328274
|
-
const baseSource =
|
|
328508
|
+
const baseSource = readFileSync15(base2, "utf8");
|
|
328275
328509
|
const result = mergeResourceSource(
|
|
328276
|
-
{ base: baseSource === "" ? null : baseSource, ours:
|
|
328510
|
+
{ base: baseSource === "" ? null : baseSource, ours: readFileSync15(ours, "utf8"), theirs: readFileSync15(theirs, "utf8") },
|
|
328277
328511
|
LABELS
|
|
328278
328512
|
);
|
|
328279
328513
|
if (result.status === "unsupported") {
|
|
328280
328514
|
return lineMerge(base2, ours, theirs, { cwd, stderr });
|
|
328281
328515
|
}
|
|
328282
|
-
|
|
328516
|
+
writeFileSync6(ours, result.content);
|
|
328283
328517
|
if (result.status === "conflict") {
|
|
328284
328518
|
stderr.write(`${path}: conflict in ${result.conflicts.join(", ")}
|
|
328285
328519
|
`);
|
|
@@ -328310,10 +328544,10 @@ function gitSetup(args, { cwd, stdout, stderr }) {
|
|
|
328310
328544
|
return 1;
|
|
328311
328545
|
}
|
|
328312
328546
|
}
|
|
328313
|
-
const attributesPath =
|
|
328547
|
+
const attributesPath = join20(root, ".gitattributes");
|
|
328314
328548
|
let attributes = "";
|
|
328315
328549
|
try {
|
|
328316
|
-
attributes =
|
|
328550
|
+
attributes = readFileSync15(attributesPath, "utf8");
|
|
328317
328551
|
} catch (error) {
|
|
328318
328552
|
if (error.code !== "ENOENT") {
|
|
328319
328553
|
throw error;
|
|
@@ -328325,7 +328559,7 @@ function gitSetup(args, { cwd, stdout, stderr }) {
|
|
|
328325
328559
|
return 0;
|
|
328326
328560
|
}
|
|
328327
328561
|
const separator = attributes === "" || attributes.endsWith("\n") ? "" : "\n";
|
|
328328
|
-
|
|
328562
|
+
writeFileSync6(attributesPath, `${attributes}${separator}${ATTRIBUTES_LINE}
|
|
328329
328563
|
`);
|
|
328330
328564
|
stdout.write(`Added "${ATTRIBUTES_LINE}" to .gitattributes. Commit .gitattributes.
|
|
328331
328565
|
`);
|
|
@@ -328334,8 +328568,8 @@ function gitSetup(args, { cwd, stdout, stderr }) {
|
|
|
328334
328568
|
|
|
328335
328569
|
// scripts/lib/runtime-build/migration-cli.mjs
|
|
328336
328570
|
init_define_globalThis_DIAGONAL_SDK_RUNTIME();
|
|
328337
|
-
import { mkdirSync as
|
|
328338
|
-
import { join as
|
|
328571
|
+
import { mkdirSync as mkdirSync4, readdirSync as readdirSync5, statSync as statSync6, writeFileSync as writeFileSync7 } from "node:fs";
|
|
328572
|
+
import { join as join21 } from "node:path";
|
|
328339
328573
|
var MIGRATION_USAGE = "Usage: diagonal make:migration <name>";
|
|
328340
328574
|
var NAME = /^[a-z0-9][a-z0-9_]{0,84}$/;
|
|
328341
328575
|
function makeMigration(args, { cwd, stdout, stderr }) {
|
|
@@ -328347,13 +328581,13 @@ ${MIGRATION_USAGE}
|
|
|
328347
328581
|
);
|
|
328348
328582
|
return 2;
|
|
328349
328583
|
}
|
|
328350
|
-
if (!
|
|
328584
|
+
if (!statSync6(join21(cwd, "diagonal.config.ts"), { throwIfNoEntry: false })?.isFile()) {
|
|
328351
328585
|
stderr.write("Run this command in a workspace directory with diagonal.config.ts.\n");
|
|
328352
328586
|
return 2;
|
|
328353
328587
|
}
|
|
328354
328588
|
const name = args[0];
|
|
328355
|
-
const directory =
|
|
328356
|
-
|
|
328589
|
+
const directory = join21(cwd, "migrations");
|
|
328590
|
+
mkdirSync4(directory, { recursive: true });
|
|
328357
328591
|
const used = new Set(
|
|
328358
328592
|
readdirSync5(directory).filter((file2) => file2.endsWith(".ts") && !file2.endsWith(".test.ts")).map((file2) => migrationTimestamp(file2.slice(0, -3))).filter((timestamp2) => timestamp2 !== null)
|
|
328359
328593
|
);
|
|
@@ -328376,7 +328610,7 @@ export default defineWorkflow(
|
|
|
328376
328610
|
async () => {}
|
|
328377
328611
|
);
|
|
328378
328612
|
`;
|
|
328379
|
-
|
|
328613
|
+
writeFileSync7(join21(cwd, path), source, { flag: "wx" });
|
|
328380
328614
|
stdout.write(`Created ${path}
|
|
328381
328615
|
`);
|
|
328382
328616
|
return 0;
|
|
@@ -328429,7 +328663,7 @@ ${CHECK_USAGE}
|
|
|
328429
328663
|
return 2;
|
|
328430
328664
|
}
|
|
328431
328665
|
const root = resolve7(cwd, parsed.dir);
|
|
328432
|
-
if (!
|
|
328666
|
+
if (!statSync7(root, { throwIfNoEntry: false })?.isDirectory()) {
|
|
328433
328667
|
stderr.write(`Not a directory: ${root}
|
|
328434
328668
|
`);
|
|
328435
328669
|
return 2;
|