@thallylabs/migrate 0.2.32 → 0.2.34
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 +60 -9
- package/dist/index.d.ts +13 -5
- package/dist/index.js +769 -253
- package/dist/index.js.map +1 -1
- package/dist/{url-migration-Coy62q1L.d.ts → url-migration-EwtII4P-.d.ts} +20 -0
- package/dist/url-migration.d.ts +1 -1
- package/dist/url-migration.js +54 -22
- package/dist/url-migration.js.map +1 -1
- package/package.json +1 -1
|
@@ -272,6 +272,7 @@ interface MigrationDocsConfig {
|
|
|
272
272
|
colors?: Partial<Record<'light' | 'dark', {
|
|
273
273
|
primary?: string;
|
|
274
274
|
accent?: string;
|
|
275
|
+
background?: string;
|
|
275
276
|
}>>;
|
|
276
277
|
icons?: {
|
|
277
278
|
library?: 'lucide' | 'fontawesome' | 'tabler';
|
|
@@ -424,12 +425,21 @@ interface MigrationWarning {
|
|
|
424
425
|
source?: string;
|
|
425
426
|
}
|
|
426
427
|
/** A repository-configured remote OpenAPI spec, downloaded after the bundle is built. */
|
|
428
|
+
/** A route prefix Mintlify served one spec's generated endpoint pages under (`openapi: { source, directory }`). */
|
|
429
|
+
interface RemoteApiSpecDirectory {
|
|
430
|
+
/** The authored `directory`, without leading or trailing slashes. */
|
|
431
|
+
directory: string;
|
|
432
|
+
/** `METHOD /path` operations docs.json lists under that reference, in authored order; absent when Mintlify generates every operation. */
|
|
433
|
+
operations?: Array<string>;
|
|
434
|
+
}
|
|
427
435
|
interface RemoteApiSpec {
|
|
428
436
|
url: string;
|
|
429
437
|
tabLabel?: string;
|
|
430
438
|
parentTab?: string;
|
|
431
439
|
icon?: string;
|
|
432
440
|
hidden?: boolean;
|
|
441
|
+
/** Every `directory` docs.json mounts this spec under: several API tabs may share one spec URL. */
|
|
442
|
+
directories?: Array<RemoteApiSpecDirectory>;
|
|
433
443
|
/** Operation keys (`get /x`) only access-restricted pages document; marked `x-excluded` after download. */
|
|
434
444
|
withheldOperations?: Array<string>;
|
|
435
445
|
/** Operation keys published pages or docs.json also name; keeps a shared `$ref` path item public. */
|
|
@@ -443,6 +453,16 @@ interface MigrationBundle {
|
|
|
443
453
|
assets: Array<MigrationAsset>;
|
|
444
454
|
/** Repository-configured remote specs awaiting a bounded network fetch by the host. */
|
|
445
455
|
remoteApiSpecs?: Array<RemoteApiSpec>;
|
|
456
|
+
/**
|
|
457
|
+
* Repository OpenAPI specs docs.json mounts under a `directory` (no surrounding slashes), with the tab each is bound to; the remote ones are in
|
|
458
|
+
* `remoteApiSpecs[].directories`. Present only alongside remote specs: a spec's id depends on which remote tabs bind ahead of it, so
|
|
459
|
+
* hydration links the local and remote mounts together once every download has settled, and the links stay as authored until then.
|
|
460
|
+
*/
|
|
461
|
+
localApiMounts?: Array<{
|
|
462
|
+
filename: string;
|
|
463
|
+
directory: string;
|
|
464
|
+
tab?: string;
|
|
465
|
+
}>;
|
|
446
466
|
/** Customer-owned component source and registry; paths are repository-relative. */
|
|
447
467
|
componentFiles?: Array<RenderedMigrationFile>;
|
|
448
468
|
/**
|
package/dist/url-migration.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { a as MigrationAsset, f as MigrationBundle, h as MigrationCapture, i as MigrationCaptureProvider, j as MigrationCaptureState, k as MigrationCapturedAsset, g as MigrationDocsConfig, l as MigrationEvidence, m as MigrationFetchRequest, n as MigrationFetchResponse, d as MigrationFetcher, o as MigrationJournalAsset, b as MigrationNavigationGroup, p as MigrationNavigationOccurrence, q as MigrationNavigationTab, M as MigrationPage, e as MigrationPlatform, c as MigrationWarning, R as RenderedMigrationFile, U as UrlMigrationCheckpoint, r as UrlMigrationCheckpointDelta, s as UrlMigrationIssue, t as UrlMigrationRecord, u as UrlMigrationRun, v as UrlMigrationRunOptions, w as UrlMigrationValidation, x as classifyMigrationResponse, z as renderMigrationFiles, A as runUrlMigration, B as validateUrlMigration } from './url-migration-
|
|
1
|
+
export { a as MigrationAsset, f as MigrationBundle, h as MigrationCapture, i as MigrationCaptureProvider, j as MigrationCaptureState, k as MigrationCapturedAsset, g as MigrationDocsConfig, l as MigrationEvidence, m as MigrationFetchRequest, n as MigrationFetchResponse, d as MigrationFetcher, o as MigrationJournalAsset, b as MigrationNavigationGroup, p as MigrationNavigationOccurrence, q as MigrationNavigationTab, M as MigrationPage, e as MigrationPlatform, c as MigrationWarning, R as RenderedMigrationFile, U as UrlMigrationCheckpoint, r as UrlMigrationCheckpointDelta, s as UrlMigrationIssue, t as UrlMigrationRecord, u as UrlMigrationRun, v as UrlMigrationRunOptions, w as UrlMigrationValidation, x as classifyMigrationResponse, z as renderMigrationFiles, A as runUrlMigration, B as validateUrlMigration } from './url-migration-EwtII4P-.js';
|
package/dist/url-migration.js
CHANGED
|
@@ -1065,8 +1065,11 @@ var JS_GLOBALS = /* @__PURE__ */ new Set([
|
|
|
1065
1065
|
"MessageChannel",
|
|
1066
1066
|
"BroadcastChannel"
|
|
1067
1067
|
]);
|
|
1068
|
-
function
|
|
1069
|
-
return ts
|
|
1068
|
+
function scriptKindFor(fileName) {
|
|
1069
|
+
return /\.[cm]?ts$/.test(fileName) ? ts.ScriptKind.TS : ts.ScriptKind.TSX;
|
|
1070
|
+
}
|
|
1071
|
+
function parse(source, fileName = "inline.tsx") {
|
|
1072
|
+
return ts.createSourceFile(fileName, source, ts.ScriptTarget.Latest, true, scriptKindFor(fileName));
|
|
1070
1073
|
}
|
|
1071
1074
|
function bindingNames(name, into) {
|
|
1072
1075
|
if (ts.isIdentifier(name)) into.add(name.text);
|
|
@@ -1075,20 +1078,44 @@ function bindingNames(name, into) {
|
|
|
1075
1078
|
function isFunctionLike(node) {
|
|
1076
1079
|
return ts.isFunctionDeclaration(node) || ts.isFunctionExpression(node) || ts.isArrowFunction(node) || ts.isMethodDeclaration(node) || ts.isConstructorDeclaration(node) || ts.isGetAccessorDeclaration(node) || ts.isSetAccessorDeclaration(node);
|
|
1077
1080
|
}
|
|
1081
|
+
function hoistedVarNames(root, into) {
|
|
1082
|
+
const collect = (node) => {
|
|
1083
|
+
if (isFunctionLike(node) || ts.isClassLike(node) || ts.isModuleDeclaration(node)) return;
|
|
1084
|
+
if (ts.isVariableDeclaration(node) && !ts.isCatchClause(node.parent) && !(ts.getCombinedNodeFlags(node) & ts.NodeFlags.BlockScoped)) bindingNames(node.name, into);
|
|
1085
|
+
ts.forEachChild(node, collect);
|
|
1086
|
+
};
|
|
1087
|
+
collect(root);
|
|
1088
|
+
}
|
|
1078
1089
|
function functionScope(fn) {
|
|
1079
1090
|
const scope = /* @__PURE__ */ new Set();
|
|
1080
1091
|
if ((ts.isFunctionExpression(fn) || ts.isFunctionDeclaration(fn)) && fn.name) scope.add(fn.name.text);
|
|
1081
1092
|
for (const parameter of fn.parameters) bindingNames(parameter.name, scope);
|
|
1082
|
-
function collect(node) {
|
|
1083
|
-
if (ts.isVariableDeclaration(node)) bindingNames(node.name, scope);
|
|
1084
|
-
if ((ts.isFunctionDeclaration(node) || ts.isClassDeclaration(node)) && node.name) scope.add(node.name.text);
|
|
1085
|
-
if (isFunctionLike(node)) return;
|
|
1086
|
-
ts.forEachChild(node, collect);
|
|
1087
|
-
}
|
|
1088
|
-
if (fn.body) ts.forEachChild(fn.body, collect);
|
|
1089
|
-
if (fn.body && !ts.isBlock(fn.body)) collect(fn.body);
|
|
1090
1093
|
return scope;
|
|
1091
1094
|
}
|
|
1095
|
+
function lexicalNames(statements) {
|
|
1096
|
+
const names = /* @__PURE__ */ new Set();
|
|
1097
|
+
for (const statement of statements) {
|
|
1098
|
+
if (ts.isVariableStatement(statement)) {
|
|
1099
|
+
if (statement.declarationList.flags & ts.NodeFlags.BlockScoped) for (const declaration of statement.declarationList.declarations) bindingNames(declaration.name, names);
|
|
1100
|
+
} else if ((ts.isFunctionDeclaration(statement) || ts.isClassDeclaration(statement)) && statement.name) names.add(statement.name.text);
|
|
1101
|
+
}
|
|
1102
|
+
return names;
|
|
1103
|
+
}
|
|
1104
|
+
function ownScope(node) {
|
|
1105
|
+
if (ts.isBlock(node)) return lexicalNames(node.statements);
|
|
1106
|
+
if (ts.isCaseBlock(node)) return lexicalNames(node.clauses.flatMap((clause) => [...clause.statements]));
|
|
1107
|
+
if ((ts.isForStatement(node) || ts.isForInStatement(node) || ts.isForOfStatement(node)) && node.initializer && ts.isVariableDeclarationList(node.initializer)) {
|
|
1108
|
+
const names = /* @__PURE__ */ new Set();
|
|
1109
|
+
if (node.initializer.flags & ts.NodeFlags.BlockScoped) for (const declaration of node.initializer.declarations) bindingNames(declaration.name, names);
|
|
1110
|
+
return names;
|
|
1111
|
+
}
|
|
1112
|
+
if (ts.isCatchClause(node) && node.variableDeclaration) {
|
|
1113
|
+
const names = /* @__PURE__ */ new Set();
|
|
1114
|
+
bindingNames(node.variableDeclaration.name, names);
|
|
1115
|
+
return names;
|
|
1116
|
+
}
|
|
1117
|
+
return void 0;
|
|
1118
|
+
}
|
|
1092
1119
|
function collectRefs(root) {
|
|
1093
1120
|
const refs = [];
|
|
1094
1121
|
const assigned = [];
|
|
@@ -1103,13 +1130,22 @@ function collectRefs(root) {
|
|
|
1103
1130
|
function walkNode(node, scopes, inAsync) {
|
|
1104
1131
|
if (ts.isTypeNode(node)) return;
|
|
1105
1132
|
if (isFunctionLike(node)) {
|
|
1106
|
-
const
|
|
1133
|
+
const parameterScopes = [...scopes, functionScope(node)];
|
|
1107
1134
|
const async = !!node.modifiers?.some((modifier) => modifier.kind === ts.SyntaxKind.AsyncKeyword);
|
|
1108
1135
|
for (const parameter of node.parameters) {
|
|
1109
|
-
if (!ts.isIdentifier(parameter.name)) walkNode(parameter.name,
|
|
1110
|
-
if (parameter.initializer) walkNode(parameter.initializer,
|
|
1136
|
+
if (!ts.isIdentifier(parameter.name)) walkNode(parameter.name, parameterScopes, async);
|
|
1137
|
+
if (parameter.initializer) walkNode(parameter.initializer, parameterScopes, async);
|
|
1111
1138
|
}
|
|
1112
|
-
if (node.body)
|
|
1139
|
+
if (node.body) {
|
|
1140
|
+
const hoisted = /* @__PURE__ */ new Set();
|
|
1141
|
+
hoistedVarNames(node.body, hoisted);
|
|
1142
|
+
walkNode(node.body, [...parameterScopes, hoisted], async);
|
|
1143
|
+
}
|
|
1144
|
+
return;
|
|
1145
|
+
}
|
|
1146
|
+
const own = ownScope(node);
|
|
1147
|
+
if (own) {
|
|
1148
|
+
ts.forEachChild(node, (child) => walkNode(child, [...scopes, own], inAsync));
|
|
1113
1149
|
return;
|
|
1114
1150
|
}
|
|
1115
1151
|
if (ts.isAwaitExpression(node) && !inAsync) awaitOutsideAsync = true;
|
|
@@ -1233,12 +1269,14 @@ function expressionRefs(expression) {
|
|
|
1233
1269
|
function pageScopeNames(esmSources) {
|
|
1234
1270
|
const names = /* @__PURE__ */ new Set();
|
|
1235
1271
|
for (const source of esmSources) {
|
|
1236
|
-
|
|
1272
|
+
const sf = parse(source);
|
|
1273
|
+
for (const statement of sf.statements) {
|
|
1237
1274
|
for (const local of importLocals(statement.getText())) names.add(local);
|
|
1238
1275
|
if (ts.isImportDeclaration(statement)) continue;
|
|
1239
1276
|
const target2 = ts.isExportDeclaration(statement) || ts.isExportAssignment(statement) ? void 0 : statement;
|
|
1240
1277
|
if (target2) for (const name of declaredNames(target2).names) names.add(name);
|
|
1241
1278
|
}
|
|
1279
|
+
hoistedVarNames(sf, names);
|
|
1242
1280
|
}
|
|
1243
1281
|
return names;
|
|
1244
1282
|
}
|
|
@@ -4303,13 +4341,7 @@ function hash2(value) {
|
|
|
4303
4341
|
return createHash2("sha256").update(value).digest("hex").slice(0, 12);
|
|
4304
4342
|
}
|
|
4305
4343
|
function sourceFile(source, filename) {
|
|
4306
|
-
return ts2.createSourceFile(
|
|
4307
|
-
filename,
|
|
4308
|
-
source,
|
|
4309
|
-
ts2.ScriptTarget.Latest,
|
|
4310
|
-
true,
|
|
4311
|
-
/\.[cm]?ts$/.test(filename) ? ts2.ScriptKind.TS : ts2.ScriptKind.TSX
|
|
4312
|
-
);
|
|
4344
|
+
return ts2.createSourceFile(filename, source, ts2.ScriptTarget.Latest, true, scriptKindFor(filename));
|
|
4313
4345
|
}
|
|
4314
4346
|
function mergeComponentRegistry(existing, incoming) {
|
|
4315
4347
|
const fingerprint = hash2(incoming);
|