@hozu/cli 0.10.0 → 0.12.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/dist/commands/add-widget.d.ts.map +1 -1
- package/dist/commands/add-widget.js +5 -4
- package/dist/commands/add-widget.js.map +1 -1
- package/dist/commands/app.d.ts.map +1 -1
- package/dist/commands/app.js +10 -0
- package/dist/commands/app.js.map +1 -1
- package/dist/commands/build.d.ts.map +1 -1
- package/dist/commands/build.js +5 -1
- package/dist/commands/build.js.map +1 -1
- package/dist/commands/call.d.ts +16 -0
- package/dist/commands/call.d.ts.map +1 -0
- package/dist/commands/call.js +100 -0
- package/dist/commands/call.js.map +1 -0
- package/dist/commands/check.d.ts +10 -1
- package/dist/commands/check.d.ts.map +1 -1
- package/dist/commands/check.js +43 -28
- package/dist/commands/check.js.map +1 -1
- package/dist/commands/explain.d.ts.map +1 -1
- package/dist/commands/explain.js +2 -1
- package/dist/commands/explain.js.map +1 -1
- package/dist/commands/impact.js +1 -1
- package/dist/commands/impact.js.map +1 -1
- package/dist/commands/inspect.d.ts.map +1 -1
- package/dist/commands/inspect.js +9 -0
- package/dist/commands/inspect.js.map +1 -1
- package/dist/commands/map.d.ts.map +1 -1
- package/dist/commands/map.js +7 -2
- package/dist/commands/map.js.map +1 -1
- package/dist/commands/migrate.d.ts +17 -16
- package/dist/commands/migrate.d.ts.map +1 -1
- package/dist/commands/migrate.js +205 -297
- package/dist/commands/migrate.js.map +1 -1
- package/dist/commands/scaffold.d.ts.map +1 -1
- package/dist/commands/scaffold.js +8 -4
- package/dist/commands/scaffold.js.map +1 -1
- package/dist/contract.d.ts +84 -1
- package/dist/contract.d.ts.map +1 -1
- package/dist/load.d.ts +2 -1
- package/dist/load.d.ts.map +1 -1
- package/dist/load.js +5 -4
- package/dist/load.js.map +1 -1
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +33 -5
- package/dist/main.js.map +1 -1
- package/dist/migrate/ast.d.ts +31 -0
- package/dist/migrate/ast.d.ts.map +1 -0
- package/dist/migrate/ast.js +61 -0
- package/dist/migrate/ast.js.map +1 -0
- package/dist/migrate/record-ir.d.ts +2 -0
- package/dist/migrate/record-ir.d.ts.map +1 -0
- package/dist/migrate/record-ir.js +16 -0
- package/dist/migrate/record-ir.js.map +1 -0
- package/dist/migrate/step-0.11.d.ts +15 -0
- package/dist/migrate/step-0.11.d.ts.map +1 -0
- package/dist/migrate/step-0.11.js +88 -0
- package/dist/migrate/step-0.11.js.map +1 -0
- package/dist/migrate/step-0.12.d.ts +6 -0
- package/dist/migrate/step-0.12.d.ts.map +1 -0
- package/dist/migrate/step-0.12.js +14 -0
- package/dist/migrate/step-0.12.js.map +1 -0
- package/dist/migrate/steps.d.ts +28 -0
- package/dist/migrate/steps.d.ts.map +1 -0
- package/dist/migrate/steps.js +42 -0
- package/dist/migrate/steps.js.map +1 -0
- package/dist/output.d.ts.map +1 -1
- package/dist/output.js +2 -0
- package/dist/output.js.map +1 -1
- package/package.json +8 -8
- package/schema/call.schema.json +136 -0
- package/schema/check.schema.json +26 -2
- package/schema/explain.schema.json +14 -1
- package/schema/impact.schema.json +22 -1
- package/schema/inspect.schema.json +75 -4
- package/schema/map.schema.json +17 -0
- package/schema/migrate.schema.json +740 -0
- package/schema/plan.schema.json +4 -2
- package/schema/render.schema.json +3 -1
- package/schema/validate.schema.json +3 -1
- package/dist/commands/migrate-agent.d.ts +0 -12
- package/dist/commands/migrate-agent.d.ts.map +0 -1
- package/dist/commands/migrate-agent.js +0 -6
- package/dist/commands/migrate-agent.js.map +0 -1
- package/dist/commands/migrate-app.d.ts +0 -15
- package/dist/commands/migrate-app.d.ts.map +0 -1
- package/dist/commands/migrate-app.js +0 -334
- package/dist/commands/migrate-app.js.map +0 -1
- package/dist/commands/migrate-ast.d.ts +0 -63
- package/dist/commands/migrate-ast.d.ts.map +0 -1
- package/dist/commands/migrate-ast.js +0 -257
- package/dist/commands/migrate-ast.js.map +0 -1
- package/dist/commands/migrate-forms.d.ts +0 -4
- package/dist/commands/migrate-forms.d.ts.map +0 -1
- package/dist/commands/migrate-forms.js +0 -120
- package/dist/commands/migrate-forms.js.map +0 -1
- package/dist/commands/migrate-freshness.d.ts +0 -4
- package/dist/commands/migrate-freshness.d.ts.map +0 -1
- package/dist/commands/migrate-freshness.js +0 -47
- package/dist/commands/migrate-freshness.js.map +0 -1
- package/dist/commands/migrate-head.d.ts +0 -8
- package/dist/commands/migrate-head.d.ts.map +0 -1
- package/dist/commands/migrate-head.js +0 -132
- package/dist/commands/migrate-head.js.map +0 -1
- package/dist/commands/migrate-links.d.ts +0 -5
- package/dist/commands/migrate-links.d.ts.map +0 -1
- package/dist/commands/migrate-links.js +0 -55
- package/dist/commands/migrate-links.js.map +0 -1
- package/dist/commands/migrate-lists.d.ts +0 -9
- package/dist/commands/migrate-lists.d.ts.map +0 -1
- package/dist/commands/migrate-lists.js +0 -225
- package/dist/commands/migrate-lists.js.map +0 -1
- package/dist/commands/migrate-normalize.d.ts +0 -27
- package/dist/commands/migrate-normalize.d.ts.map +0 -1
- package/dist/commands/migrate-normalize.js +0 -252
- package/dist/commands/migrate-normalize.js.map +0 -1
- package/dist/commands/migrate-ops.d.ts +0 -4
- package/dist/commands/migrate-ops.d.ts.map +0 -1
- package/dist/commands/migrate-ops.js +0 -192
- package/dist/commands/migrate-ops.js.map +0 -1
- package/dist/commands/migrate-parts.d.ts +0 -7
- package/dist/commands/migrate-parts.d.ts.map +0 -1
- package/dist/commands/migrate-parts.js +0 -166
- package/dist/commands/migrate-parts.js.map +0 -1
- package/dist/commands/migrate-stale.d.ts +0 -24
- package/dist/commands/migrate-stale.d.ts.map +0 -1
- package/dist/commands/migrate-stale.js +0 -114
- package/dist/commands/migrate-stale.js.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"migrate-head.js","sourceRoot":"","sources":["../../src/commands/migrate-head.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,EACL,WAAW,EA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AI,CAAC,CAAC,CAAA;iBACjE,CAAC;gBACJ,MAAM,KAAK,GAAG,IAAI,CAAC,UAAU,CAAA;gBAC7B,MAAM,CAAC,GAAG,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC,CAAA;gBAClC,KAAK,CAAC,IAAI,CACR,CAAC,GAAG,CAAC;oBACH,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,SAAS,CAAC,GAAG,EAAE,EAAE,CAAC;oBACvC,CAAC,CAAC,CAAC,SAAS,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,IAAI,SAAS,CAAC,GAAG,EAAE,EAAE,CAAC,CAC5D,CAAA;YACH,CAAC;QACH,CAAC;aAAM,IAAI,OAAO,CAAC,MAAM;YAAE,KAAK,CAAC,IAAI,CAAC,cAAc,CAAC,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC,CAAA;IAC3E,CAAC,CAAC,CAAA;IACF,OAAO,EAAE,IAAI,EAAE,KAAK,CAAC,MAAM,EAAE,KAAK,CAAC,EAAE,KAAK,EAAE,CAAA;AAC9C,CAAC"}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { type Rewrite } from './migrate-ast.ts';
|
|
2
|
-
export type SearchDefaults = Map<string, Record<string, unknown>>;
|
|
3
|
-
/** `ui.link(r, p, null)`, `{}` and search fields equal to the route defaults → `ui.link(r, p)` (ADR 0043 G). */
|
|
4
|
-
export declare function migrateLinks(source: string, file: string, byPath?: SearchDefaults): Rewrite;
|
|
5
|
-
//# sourceMappingURL=migrate-links.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"migrate-links.d.ts","sourceRoot":"","sources":["../../src/commands/migrate-links.ts"],"names":[],"mappings":"AAAA,OAAO,EAaL,KAAK,OAAO,EAEb,MAAM,kBAAkB,CAAA;AAEzB,MAAM,MAAM,cAAc,GAAG,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAA;AAYjE,gHAAgH;AAChH,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,GAAE,cAA0B,GAAG,OAAO,CAoCtG"}
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import { apply, callOf, declaration, importsFrom, keyName, lineOf, literal, parse, property, walk, } from './migrate-ast.js';
|
|
2
|
-
const foldable = (v, fallback) => v === null || (v !== undefined && typeof v !== 'object' && v === fallback);
|
|
3
|
-
function defaultsOf(file, program, route, byPath) {
|
|
4
|
-
const decl = declaration(file, program, route);
|
|
5
|
-
const path = decl?.init.type === 'CallExpression' ? literal(property(decl.init.arguments[0], 'path')?.value) : null;
|
|
6
|
-
return typeof path?.value === 'string' ? (byPath.get(path.value) ?? null) : null;
|
|
7
|
-
}
|
|
8
|
-
/** `ui.link(r, p, null)`, `{}` and search fields equal to the route defaults → `ui.link(r, p)` (ADR 0043 G). */
|
|
9
|
-
export function migrateLinks(source, file, byPath = new Map()) {
|
|
10
|
-
if (!/\.link\s*\(/.test(source))
|
|
11
|
-
return { code: source, notes: [] };
|
|
12
|
-
const program = parse(source);
|
|
13
|
-
const ui = importsFrom(program, '@hozu/core').get('ui');
|
|
14
|
-
if (!ui)
|
|
15
|
-
return { code: source, notes: [] };
|
|
16
|
-
const edits = [];
|
|
17
|
-
const notes = [];
|
|
18
|
-
walk(program, (n) => {
|
|
19
|
-
if (!callOf(n, ui, 'link') || n.arguments.length < 3)
|
|
20
|
-
return;
|
|
21
|
-
const [route, params, search] = n.arguments;
|
|
22
|
-
const drop = () => edits.push([params.end, search.end, '']);
|
|
23
|
-
if (search.type === 'Literal' && search.value === null)
|
|
24
|
-
return drop();
|
|
25
|
-
if (search.type !== 'ObjectExpression')
|
|
26
|
-
return;
|
|
27
|
-
if (search.properties.length === 0)
|
|
28
|
-
return drop();
|
|
29
|
-
const defaults = defaultsOf(file, program, route, byPath);
|
|
30
|
-
const removed = [];
|
|
31
|
-
for (const p of search.properties) {
|
|
32
|
-
const k = keyName(p);
|
|
33
|
-
const v = literal(p.value);
|
|
34
|
-
if (k && v && foldable(v.value, defaults?.[k]))
|
|
35
|
-
removed.push(p);
|
|
36
|
-
}
|
|
37
|
-
if (!removed.length)
|
|
38
|
-
return;
|
|
39
|
-
if (removed.length === search.properties.length)
|
|
40
|
-
return drop();
|
|
41
|
-
const kept = search.properties
|
|
42
|
-
.filter((p) => !removed.includes(p))
|
|
43
|
-
.map((p) => source.slice(p.start, p.end));
|
|
44
|
-
edits.push([search.start, search.end, `{ ${kept.join(', ')} }`]);
|
|
45
|
-
notes.push({
|
|
46
|
-
file,
|
|
47
|
-
line: lineOf(source, n.start),
|
|
48
|
-
rule: 'link',
|
|
49
|
-
message: `ui.link search: dropped ${removed.map((p) => keyName(p)).join(', ')} (null or the route default)`,
|
|
50
|
-
see: 'views',
|
|
51
|
-
});
|
|
52
|
-
});
|
|
53
|
-
return { code: apply(source, edits), notes };
|
|
54
|
-
}
|
|
55
|
-
//# sourceMappingURL=migrate-links.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"migrate-links.js","sourceRoot":"","sources":["../../src/commands/migrate-links.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,EACL,MAAM,EACN,WAAW,EAEX,WAAW,EACX,OAAO,EACP,MAAM,EACN,OAAO,EAGP,KAAK,EACL,QAAQ,EAER,IAAI,GACL,MAAM,kBAAkB,CAAA;AAIzB,MAAM,QAAQ,GAAG,CAAC,CAAU,EAAE,QAAiB,EAAE,EAAE,CACjD,CAAC,KAAK,IAAI,IAAI,CAAC,CAAC,KAAK,SAAS,IAAI,OAAO,CAAC,KAAK,QAAQ,IAAI,CAAC,KAAK,QAAQ,CAAC,CAAA;AAE5E,SAAS,UAAU,CAAC,IAAY,EAAE,OAAa,EAAE,KAAW,EAAE,MAAsB;IAClF,MAAM,IAAI,GAAG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C,CAAO,EAAE,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAA;QACjD,KAAK,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,GAAG,EAAE,KAAK,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAA;QAChE,KAAK,CAAC,IAAI,CAAC;YACT,IAAI;YACJ,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,KAAK,CAAC;YAC7B,IAAI,EAAE,MAAM;YACZ,OAAO,EAAE,2BAA2B,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,8BAA8B;YAC3G,GAAG,EAAE,OAAO;SACb,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;IACF,OAAO,EAAE,IAAI,EAAE,KAAK,CAAC,MAAM,EAAE,KAAK,CAAC,EAAE,KAAK,EAAE,CAAA;AAC9C,CAAC"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { type Node, type Rewrite } from './migrate-ast.ts';
|
|
2
|
-
/** The scaffold's `itemsOf`: `if (!s) return []; const list = store.get(s.user) ?? []; store.set(s.user, list); return list`. */
|
|
3
|
-
export declare function createOnRead(fn: Node): {
|
|
4
|
-
store: string;
|
|
5
|
-
session: string;
|
|
6
|
-
} | null;
|
|
7
|
-
/** Query resolvers only read (ADR 0043 B): split the scaffold's create-on-read helper, print other writes. */
|
|
8
|
-
export declare function migrateLists(source: string, file: string): Rewrite;
|
|
9
|
-
//# sourceMappingURL=migrate-lists.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"migrate-lists.d.ts","sourceRoot":"","sources":["../../src/commands/migrate-lists.ts"],"names":[],"mappings":"AACA,OAAO,EAKL,KAAK,IAAI,EAIT,KAAK,OAAO,EAEb,MAAM,kBAAkB,CAAA;AAkBzB,iIAAiI;AACjI,wBAAgB,YAAY,CAAC,EAAE,EAAE,IAAI,GAAG;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CA4ChF;AAsFD,8GAA8G;AAC9G,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CA4FlE"}
|
|
@@ -1,225 +0,0 @@
|
|
|
1
|
-
import { basename } from 'node:path';
|
|
2
|
-
import { apply, declaration, lineOf, parents, parse, walk, } from './migrate-ast.js';
|
|
3
|
-
const WRITES = new Set(['set', 'push', 'unshift']);
|
|
4
|
-
const member = (n, object, name) => n?.type === 'CallExpression' &&
|
|
5
|
-
n.callee.type === 'MemberExpression' &&
|
|
6
|
-
!n.callee.computed &&
|
|
7
|
-
n.callee.property.name === name &&
|
|
8
|
-
(object === null || (n.callee.object.type === 'Identifier' && n.callee.object.name === object));
|
|
9
|
-
const sessionUser = (n, session) => n?.type === 'MemberExpression' &&
|
|
10
|
-
!n.computed &&
|
|
11
|
-
n.object.type === 'Identifier' &&
|
|
12
|
-
n.object.name === session &&
|
|
13
|
-
n.property.name === 'user';
|
|
14
|
-
/** The scaffold's `itemsOf`: `if (!s) return []; const list = store.get(s.user) ?? []; store.set(s.user, list); return list`. */
|
|
15
|
-
export function createOnRead(fn) {
|
|
16
|
-
if (fn?.type !== 'ArrowFunctionExpression' || fn.params.length !== 1 || fn.body.type !== 'BlockStatement')
|
|
17
|
-
return null;
|
|
18
|
-
const session = fn.params[0].type === 'Identifier' ? fn.params[0].name : null;
|
|
19
|
-
const [guard, get, set, ret, ...rest] = fn.body.body;
|
|
20
|
-
if (!session || rest.length || !ret)
|
|
21
|
-
return null;
|
|
22
|
-
const empty = (s) => s?.type === 'ReturnStatement' && s.argument?.type === 'ArrayExpression' && !s.argument.elements.length;
|
|
23
|
-
if (guard.type !== 'IfStatement' ||
|
|
24
|
-
guard.test.type !== 'UnaryExpression' ||
|
|
25
|
-
guard.test.operator !== '!' ||
|
|
26
|
-
guard.test.argument.name !== session ||
|
|
27
|
-
!(empty(guard.consequent) ||
|
|
28
|
-
(guard.consequent.type === 'BlockStatement' && empty(guard.consequent.body[0]))))
|
|
29
|
-
return null;
|
|
30
|
-
const decl = get.type === 'VariableDeclaration' ? get.declarations[0] : null;
|
|
31
|
-
const init = decl?.init;
|
|
32
|
-
if (!decl ||
|
|
33
|
-
get.declarations.length !== 1 ||
|
|
34
|
-
init?.type !== 'LogicalExpression' ||
|
|
35
|
-
init.operator !== '??' ||
|
|
36
|
-
init.right.type !== 'ArrayExpression' ||
|
|
37
|
-
!member(init.left, null, 'get') ||
|
|
38
|
-
init.left.callee.object.type !== 'Identifier' ||
|
|
39
|
-
!sessionUser(init.left.arguments[0], session))
|
|
40
|
-
return null;
|
|
41
|
-
const store = init.left.callee.object.name;
|
|
42
|
-
const list = decl.id.name;
|
|
43
|
-
const write = set.type === 'ExpressionStatement' ? set.expression : null;
|
|
44
|
-
if (!member(write, store, 'set') ||
|
|
45
|
-
!sessionUser(write.arguments[0], session) ||
|
|
46
|
-
write.arguments[1]?.name !== list ||
|
|
47
|
-
ret.type !== 'ReturnStatement' ||
|
|
48
|
-
ret.argument?.name !== list)
|
|
49
|
-
return null;
|
|
50
|
-
return { store, session };
|
|
51
|
-
}
|
|
52
|
-
const kindOf = (file, program, ref) => {
|
|
53
|
-
const d = declaration(file, program, ref);
|
|
54
|
-
return d?.init.type === 'CallExpression' && d.init.callee.type === 'Identifier' ? d.init.callee.name : null;
|
|
55
|
-
};
|
|
56
|
-
function scopeOf(file, program, source) {
|
|
57
|
-
const functions = new Map();
|
|
58
|
-
const values = new Map();
|
|
59
|
-
walk(program, (n) => {
|
|
60
|
-
if (n.type === 'FunctionDeclaration' && n.id)
|
|
61
|
-
functions.set(n.id.name, n);
|
|
62
|
-
if (n.type === 'VariableDeclarator' && n.id.type === 'Identifier' && n.init)
|
|
63
|
-
(/Function/.test(n.init.type) ? functions : values).set(n.id.name, n.init);
|
|
64
|
-
});
|
|
65
|
-
return { file, source, functions, values, program };
|
|
66
|
-
}
|
|
67
|
-
const where = (mod, n) => `${basename(mod.file)}:${lineOf(mod.source, n.start)}`;
|
|
68
|
-
const isFunction = (n) => /Function/.test(n?.type ?? '');
|
|
69
|
-
const scopes = new WeakMap();
|
|
70
|
-
function imported(ref, mod) {
|
|
71
|
-
const d = declaration(mod.file, mod.program, ref);
|
|
72
|
-
if (!d)
|
|
73
|
-
return null;
|
|
74
|
-
if (!scopes.has(d.program))
|
|
75
|
-
scopes.set(d.program, scopeOf(d.file, d.program, d.source));
|
|
76
|
-
const other = scopes.get(d.program);
|
|
77
|
-
return isFunction(d.init) ? { fn: d.init, mod: other } : { value: d.init, mod: other };
|
|
78
|
-
}
|
|
79
|
-
function functionOf(ref, mod) {
|
|
80
|
-
if (ref.type === 'Identifier' && mod.functions.has(ref.name))
|
|
81
|
-
return { fn: mod.functions.get(ref.name), mod };
|
|
82
|
-
const found = imported(ref, mod);
|
|
83
|
-
return found && 'fn' in found ? found : null;
|
|
84
|
-
}
|
|
85
|
-
function returned(fn) {
|
|
86
|
-
if (fn.body.type === 'ObjectExpression')
|
|
87
|
-
return fn.body;
|
|
88
|
-
if (fn.body.type !== 'BlockStatement')
|
|
89
|
-
return null;
|
|
90
|
-
const ret = fn.body.body.find((s) => s.type === 'ReturnStatement');
|
|
91
|
-
return ret?.argument?.type === 'ObjectExpression' ? ret.argument : null;
|
|
92
|
-
}
|
|
93
|
-
function objectOf(value, mod) {
|
|
94
|
-
if (value.type === 'ObjectExpression')
|
|
95
|
-
return { object: value, mod };
|
|
96
|
-
if (value.type !== 'CallExpression')
|
|
97
|
-
return null;
|
|
98
|
-
const f = functionOf(value.callee, mod);
|
|
99
|
-
const object = f && returned(f.fn);
|
|
100
|
-
return object && f ? { object, mod: f.mod } : null;
|
|
101
|
-
}
|
|
102
|
-
/** The function a call runs: a local or imported function, or a method of an object a factory returns. */
|
|
103
|
-
function callee(c, mod) {
|
|
104
|
-
if (c.type === 'Identifier')
|
|
105
|
-
return functionOf(c, mod);
|
|
106
|
-
if (c.type !== 'MemberExpression' || c.computed || c.object.type !== 'Identifier')
|
|
107
|
-
return null;
|
|
108
|
-
const local = mod.values.get(c.object.name);
|
|
109
|
-
const found = local ? { value: local, mod } : imported(c.object, mod);
|
|
110
|
-
if (!found)
|
|
111
|
-
return imported(c, mod) && functionOf(c, mod);
|
|
112
|
-
if ('fn' in found)
|
|
113
|
-
return null;
|
|
114
|
-
const owner = objectOf(found.value, found.mod);
|
|
115
|
-
const p = owner?.object.properties.find((x) => x.type === 'Property' && (x.key.name ?? x.key.value) === c.property.name);
|
|
116
|
-
if (!owner || !p)
|
|
117
|
-
return null;
|
|
118
|
-
if (isFunction(p.value))
|
|
119
|
-
return { fn: p.value, mod: owner.mod };
|
|
120
|
-
return p.value.type === 'Identifier' ? functionOf(p.value, owner.mod) : null;
|
|
121
|
-
}
|
|
122
|
-
/** Query resolvers only read (ADR 0043 B): split the scaffold's create-on-read helper, print other writes. */
|
|
123
|
-
export function migrateLists(source, file) {
|
|
124
|
-
if (!/\bimplement\s*\(/.test(source))
|
|
125
|
-
return { code: source, notes: [] };
|
|
126
|
-
const program = parse(source);
|
|
127
|
-
const parent = parents(program);
|
|
128
|
-
const notes = [];
|
|
129
|
-
const edits = [];
|
|
130
|
-
const helpers = new Map();
|
|
131
|
-
walk(program, (n) => {
|
|
132
|
-
if (n.type === 'VariableDeclarator' && n.id.type === 'Identifier' && createOnRead(n.init))
|
|
133
|
-
helpers.set(n.id.name, n);
|
|
134
|
-
});
|
|
135
|
-
const implementsOf = (n) => {
|
|
136
|
-
for (let up = parent.get(n); up; up = parent.get(up))
|
|
137
|
-
if (up.type === 'CallExpression' && up.callee.type === 'Identifier' && up.callee.name === 'implement')
|
|
138
|
-
return {
|
|
139
|
-
kind: kindOf(file, program, up.arguments[0]),
|
|
140
|
-
name: source.slice(up.arguments[0].start, up.arguments[0].end),
|
|
141
|
-
};
|
|
142
|
-
return null;
|
|
143
|
-
};
|
|
144
|
-
const taken = new Set();
|
|
145
|
-
walk(program, (n) => n.type === 'Identifier' && taken.add(n.name));
|
|
146
|
-
for (const [name, decl] of helpers) {
|
|
147
|
-
const calls = [];
|
|
148
|
-
walk(program, (n) => {
|
|
149
|
-
if (n.type === 'CallExpression' && n.callee.type === 'Identifier' && n.callee.name === name)
|
|
150
|
-
calls.push({ n, query: implementsOf(n)?.kind === 'query' });
|
|
151
|
-
});
|
|
152
|
-
const reads = calls.filter((c) => c.query).length;
|
|
153
|
-
if (!reads)
|
|
154
|
-
continue;
|
|
155
|
-
const read = taken.has('listOf') ? `${name}Read` : 'listOf';
|
|
156
|
-
const own = taken.has('ownListOf') ? `${name}Own` : 'ownListOf';
|
|
157
|
-
const fn = decl.init;
|
|
158
|
-
const { store, session } = createOnRead(fn);
|
|
159
|
-
const head = source.slice(fn.start, fn.body.start).replace(/\s*=>\s*$/, '');
|
|
160
|
-
const stmt = parent.get(decl);
|
|
161
|
-
const lineStart = source.lastIndexOf('\n', stmt.start) + 1;
|
|
162
|
-
const indent = source.slice(lineStart, stmt.start);
|
|
163
|
-
edits.push([
|
|
164
|
-
stmt.start,
|
|
165
|
-
stmt.end,
|
|
166
|
-
`const ${read} = ${head} => (${session} ? (${store}.get(${session}.user) ?? []) : [])\n${indent}const ${own} = ${source.slice(fn.start, fn.end)}`,
|
|
167
|
-
]);
|
|
168
|
-
for (const c of calls)
|
|
169
|
-
edits.push([c.n.callee.start, c.n.callee.end, c.query ? read : own]);
|
|
170
|
-
notes.push({
|
|
171
|
-
file,
|
|
172
|
-
line: lineOf(source, stmt.start),
|
|
173
|
-
rule: 'resolvers',
|
|
174
|
-
message: `${name} created the user's list on read: split into ${read} (${reads} query ${reads === 1 ? 'call' : 'calls'}) and ${own} (writes)`,
|
|
175
|
-
see: 'data',
|
|
176
|
-
});
|
|
177
|
-
}
|
|
178
|
-
const here = scopeOf(file, program, source);
|
|
179
|
-
const writes = (body, mod, seen) => {
|
|
180
|
-
const out = [];
|
|
181
|
-
walk(body, (x) => {
|
|
182
|
-
if (x.type !== 'CallExpression')
|
|
183
|
-
return;
|
|
184
|
-
const c = x.callee;
|
|
185
|
-
if (c.type === 'MemberExpression' && !c.computed && WRITES.has(c.property.name)) {
|
|
186
|
-
out.push({ at: x, method: c.property.name, via: null, where: mod === here ? null : where(mod, x) });
|
|
187
|
-
return;
|
|
188
|
-
}
|
|
189
|
-
if (c.type === 'Identifier' && mod === here && helpers.has(c.name))
|
|
190
|
-
return;
|
|
191
|
-
const target = callee(c, mod);
|
|
192
|
-
if (!target || seen.has(target.fn))
|
|
193
|
-
return;
|
|
194
|
-
seen.add(target.fn);
|
|
195
|
-
const via = mod.source.slice(c.start, c.end);
|
|
196
|
-
for (const w of writes(target.fn.body, target.mod, seen))
|
|
197
|
-
out.push(mod === here ? { ...w, at: x, via } : w);
|
|
198
|
-
});
|
|
199
|
-
return out;
|
|
200
|
-
};
|
|
201
|
-
walk(program, (n) => {
|
|
202
|
-
if (n.type !== 'CallExpression' || n.callee.type !== 'Identifier' || n.callee.name !== 'implement')
|
|
203
|
-
return;
|
|
204
|
-
if (kindOf(file, program, n.arguments[0]) !== 'query' || !n.arguments[1])
|
|
205
|
-
return;
|
|
206
|
-
const query = source.slice(n.arguments[0].start, n.arguments[0].end);
|
|
207
|
-
const seen = new Set();
|
|
208
|
-
for (const w of writes(n.arguments[1], here, new Set())) {
|
|
209
|
-
const key = `${w.via}.${w.method}`;
|
|
210
|
-
if (seen.has(key))
|
|
211
|
-
continue;
|
|
212
|
-
seen.add(key);
|
|
213
|
-
notes.push({
|
|
214
|
-
file,
|
|
215
|
-
line: lineOf(source, w.at.start),
|
|
216
|
-
rule: 'resolvers',
|
|
217
|
-
message: `the resolver of query ${query} ${w.via ? `calls ${w.via}, which calls` : 'calls'} .${w.method}()${w.where ? ` (${w.where})` : ''}: query resolvers only read; move the write into a mutation`,
|
|
218
|
-
see: 'data',
|
|
219
|
-
behaviour: true,
|
|
220
|
-
});
|
|
221
|
-
}
|
|
222
|
-
});
|
|
223
|
-
return { code: apply(source, edits), notes };
|
|
224
|
-
}
|
|
225
|
-
//# sourceMappingURL=migrate-lists.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"migrate-lists.js","sourceRoot":"","sources":["../../src/commands/migrate-lists.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAA;AACpC,OAAO,EACL,KAAK,EACL,WAAW,EAEX,MAAM,EAGN,OAAO,EACP,KAAK,EAEL,IAAI,GACL,MAAM,kBAAkB,CAAA;AAEzB,MAAM,MAAM,GAAG,IAAI,GAAG,CAAC,CAAC,KAAK,EAAE,MAAM,EAAE,SAAS,CAAC,CAAC,CAAA;AAElD,MAAM,MAAM,GAAG,CAAC,CAAO,EAAE,MAAqB,EAAE,IAAY,EAAE,EAAE,CAC9D,CAAC,EAAE,IAAI,KAAK,gBAAgB;IAC5B,CAAC,CAAC,MAAM,CAAC,IAAI,KAAK,kBAAkB;IACpC,CAAC,CAAC,CAAC,MAAM,CAAC,QAAQ;IAClB,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,KAAK,IAAI;IAC/B,CAAC,MAAM,KAAK,IAAI,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,KAAK,YAAY,IAAI,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,KAAK,MAAM,CAAC,CAAC,CAAA;AAEjG,MAAM,WAAW,GAAG,CAAC,CAAO,EAAE,OAAe,EAAE,EAAE,CAC/C,CAAC,EAAE,IAAI,KAAK,kBAAkB;IAC9B,CAAC,CAAC,CAAC,QAAQ;IACX,CAAC,CAAC,MAAM,CAAC,IAAI,KAAK,YAAY;IAC9B,CAAC,CAAC,MAAM,CAAC,IAAI,K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,0 @@
|
|
|
1
|
-
type J = any;
|
|
2
|
-
/** One entry per mapping: which 0.7 → 0.8 difference it allows, and the rewrite (or version bump) behind it. */
|
|
3
|
-
export declare const MAPPINGS: {
|
|
4
|
-
readonly irVersion: 'irVersion 1 → 2 (the upgrade)';
|
|
5
|
-
readonly exportsEndpoints: 'exports.endpoints: [] (the upgrade)';
|
|
6
|
-
readonly endpointMode: "endpoint mode: 'json' for a schema output, 'response' for output: 'response' (the upgrade)";
|
|
7
|
-
readonly headFailed: 'head.redirects → head.failed { error: { redirect } } (rewrite head)';
|
|
8
|
-
readonly headFailed404: 'head.failed { error: { status: 404 } } for an unmapped error (rewrite head)';
|
|
9
|
-
readonly freshness: "user-scoped static / revalidate / swr → 'request' (rewrite freshness)";
|
|
10
|
-
readonly linkFolding: 'ui.link search fields null or equal to the route default fold away (rewrite link)';
|
|
11
|
-
readonly incPlus: 'inc → set %plus: ctx.x += v ≡ ctx.x = ctx.x + v (record-time normalisation, op → TS)';
|
|
12
|
-
readonly truthyCall: '%truthy(fnCall) → fnCall (record-time normalisation)';
|
|
13
|
-
readonly andOr: 'nested and / or flatten (record-time normalisation)';
|
|
14
|
-
readonly condGuard: 'a guard-position %cond → and / or / not (record-time normalisation)';
|
|
15
|
-
readonly formRef: "a string form attribute and its form's id → { formRef } (rewrite form)";
|
|
16
|
-
};
|
|
17
|
-
export type Mapping = keyof typeof MAPPINGS;
|
|
18
|
-
export type Counts = Partial<Record<Mapping, number>>;
|
|
19
|
-
/**
|
|
20
|
-
* The 0.7 IR in 0.8 terms (ADR 0043 Migration): what `hozu migrate 0.8` must produce for an unchanged app.
|
|
21
|
-
* Every mapping here is one rewrite's allowed difference; anything else is a behaviour change.
|
|
22
|
-
*/
|
|
23
|
-
export declare function normalize07(input: J, into?: Counts): J;
|
|
24
|
-
/** JSON pointers where two IRs differ, capped per call. */
|
|
25
|
-
export declare function differences(a: J, b: J, limit?: number, path?: string, out?: string[]): string[];
|
|
26
|
-
export {};
|
|
27
|
-
//# sourceMappingURL=migrate-normalize.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"migrate-normalize.d.ts","sourceRoot":"","sources":["../../src/commands/migrate-normalize.ts"],"names":[],"mappings":"AAAA,KAAK,CAAC,GAAG,GAAG,CAAA;AAEZ,gHAAgH;AAChH,eAAO,MAAM,QAAQ;aACnB,SAAS,EAAE,+BAA+B;aAC1C,gBAAgB,EAAE,qCAAqC;aACvD,YAAY,EAAE,4FAA4F;aAC1G,UAAU,EAAE,qEAAqE;aACjF,aAAa,EAAE,6EAA6E;aAC5F,SAAS,EAAE,uEAAuE;aAClF,WAAW,EAAE,mFAAmF;aAChG,OAAO,EAAE,sFAAsF;aAC/F,UAAU,EAAE,sDAAsD;aAClE,KAAK,EAAE,qDAAqD;aAC5D,SAAS,EAAE,qEAAqE;aAChF,OAAO,EAAE,wEAAwE;CACzE,CAAA;AACV,MAAM,MAAM,OAAO,GAAG,MAAM,OAAO,QAAQ,CAAA;AAC3C,MAAM,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC,CAAA;AAiJrD;;;GAGG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,CAAC,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,CAAC,CAyDtD;AAED,2DAA2D;AAC3D,wBAAgB,WAAW,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,KAAK,SAAK,EAAE,IAAI,SAAK,EAAE,GAAG,GAAE,MAAM,EAAO,GAAG,MAAM,EAAE,CAW3F"}
|
|
@@ -1,252 +0,0 @@
|
|
|
1
|
-
/** One entry per mapping: which 0.7 → 0.8 difference it allows, and the rewrite (or version bump) behind it. */
|
|
2
|
-
export const MAPPINGS = {
|
|
3
|
-
irVersion: 'irVersion 1 → 2 (the upgrade)',
|
|
4
|
-
exportsEndpoints: 'exports.endpoints: [] (the upgrade)',
|
|
5
|
-
endpointMode: "endpoint mode: 'json' for a schema output, 'response' for output: 'response' (the upgrade)",
|
|
6
|
-
headFailed: 'head.redirects → head.failed { error: { redirect } } (rewrite head)',
|
|
7
|
-
headFailed404: 'head.failed { error: { status: 404 } } for an unmapped error (rewrite head)',
|
|
8
|
-
freshness: "user-scoped static / revalidate / swr → 'request' (rewrite freshness)",
|
|
9
|
-
linkFolding: 'ui.link search fields null or equal to the route default fold away (rewrite link)',
|
|
10
|
-
incPlus: 'inc → set %plus: ctx.x += v ≡ ctx.x = ctx.x + v (record-time normalisation, op → TS)',
|
|
11
|
-
truthyCall: '%truthy(fnCall) → fnCall (record-time normalisation)',
|
|
12
|
-
andOr: 'nested and / or flatten (record-time normalisation)',
|
|
13
|
-
condGuard: 'a guard-position %cond → and / or / not (record-time normalisation)',
|
|
14
|
-
formRef: "a string form attribute and its form's id → { formRef } (rewrite form)",
|
|
15
|
-
};
|
|
16
|
-
const isObject = (v) => typeof v === 'object' && v !== null && !Array.isArray(v);
|
|
17
|
-
const clone = (v) => JSON.parse(JSON.stringify(v));
|
|
18
|
-
const equal = (a, b) => JSON.stringify(a) === JSON.stringify(b);
|
|
19
|
-
function defaultsOf(search) {
|
|
20
|
-
const out = {};
|
|
21
|
-
for (const [k, v] of Object.entries(isObject(search?.properties) ? search.properties : {}))
|
|
22
|
-
if (isObject(v) && 'default' in v)
|
|
23
|
-
out[k] = v.default;
|
|
24
|
-
return out;
|
|
25
|
-
}
|
|
26
|
-
const foldable = (v, fallback) => v === null || (v !== undefined && typeof v !== 'object' && v === fallback);
|
|
27
|
-
function foldSearch(search, defaults) {
|
|
28
|
-
if (isObject(search) && 'literal' in search) {
|
|
29
|
-
const l = search.literal;
|
|
30
|
-
if (!isObject(l))
|
|
31
|
-
return search;
|
|
32
|
-
const kept = Object.entries(l).filter(([k, v]) => !foldable(v, defaults[k]));
|
|
33
|
-
return kept.length ? { literal: Object.fromEntries(kept) } : { literal: null };
|
|
34
|
-
}
|
|
35
|
-
if (isObject(search) && isObject(search.object)) {
|
|
36
|
-
const kept = Object.entries(search.object).filter(([k, v]) => !(isObject(v) && 'literal' in v && foldable(v.literal, defaults[k])));
|
|
37
|
-
return kept.length ? { object: Object.fromEntries(kept) } : { literal: null };
|
|
38
|
-
}
|
|
39
|
-
return search;
|
|
40
|
-
}
|
|
41
|
-
/** A value used as a guard, as the 0.8 recorder's `test` lowers it. */
|
|
42
|
-
function asGuard(v) {
|
|
43
|
-
if (isObject(v) && isObject(v.test) && Object.keys(v).length === 1)
|
|
44
|
-
return v.test;
|
|
45
|
-
if (isObject(v) && typeof v.fn === 'string' && 'arg' in v)
|
|
46
|
-
return { op: 'fn', fn: v.fn, arg: v.arg };
|
|
47
|
-
return { op: 'fn', fn: '%truthy', arg: { object: { v } } };
|
|
48
|
-
}
|
|
49
|
-
let counts = {};
|
|
50
|
-
const count = (m, n = 1) => {
|
|
51
|
-
if (n > 0)
|
|
52
|
-
counts[m] = (counts[m] ?? 0) + n;
|
|
53
|
-
};
|
|
54
|
-
const both = (x, y, op) => ({
|
|
55
|
-
op,
|
|
56
|
-
args: [x, y].flatMap((g) => (g.op === op ? g.args : [g])),
|
|
57
|
-
});
|
|
58
|
-
/** The 0.8 `condGuard` over IR: a guard-position `%cond` → and / or / not. */
|
|
59
|
-
function condGuard(arg) {
|
|
60
|
-
const o = isObject(arg?.object) ? arg.object : null;
|
|
61
|
-
if (!o || !('c' in o) || !('a' in o) || !('b' in o))
|
|
62
|
-
return null;
|
|
63
|
-
const test = guard(asGuard(o.c));
|
|
64
|
-
const not = { op: 'not', arg: test };
|
|
65
|
-
const lit = (v, b) => isObject(v) && 'literal' in v && v.literal === b;
|
|
66
|
-
const tested = test.op === 'fn' && test.fn === '%truthy' ? test.arg?.object?.v : undefined;
|
|
67
|
-
const same = (x) => equal(x, o.c) || (tested !== undefined && equal(x, tested));
|
|
68
|
-
const g = (v) => guard(asGuard(v));
|
|
69
|
-
if (lit(o.a, true) && lit(o.b, false))
|
|
70
|
-
return test;
|
|
71
|
-
if (lit(o.a, false) && lit(o.b, true))
|
|
72
|
-
return not;
|
|
73
|
-
if (same(o.b) || lit(o.b, false))
|
|
74
|
-
return both(test, g(o.a), 'and');
|
|
75
|
-
if (same(o.a) || lit(o.a, true))
|
|
76
|
-
return both(test, g(o.b), 'or');
|
|
77
|
-
if (lit(o.a, false))
|
|
78
|
-
return both(not, g(o.b), 'and');
|
|
79
|
-
if (lit(o.b, true))
|
|
80
|
-
return both(not, g(o.a), 'or');
|
|
81
|
-
return both(both(test, g(o.a), 'and'), both(not, g(o.b), 'and'), 'or');
|
|
82
|
-
}
|
|
83
|
-
function guard(g) {
|
|
84
|
-
if (!isObject(g))
|
|
85
|
-
return g;
|
|
86
|
-
if (g.op === 'and' || g.op === 'or') {
|
|
87
|
-
const args = g.args.map(guard);
|
|
88
|
-
count('andOr', args.filter((a) => a.op === g.op).length);
|
|
89
|
-
return { ...g, args: args.flatMap((a) => (a.op === g.op ? a.args : [a])) };
|
|
90
|
-
}
|
|
91
|
-
if (g.op === 'not')
|
|
92
|
-
return { ...g, arg: guard(g.arg) };
|
|
93
|
-
const cond = (arg) => {
|
|
94
|
-
const out = condGuard(arg);
|
|
95
|
-
if (out)
|
|
96
|
-
count('condGuard');
|
|
97
|
-
return out ?? g;
|
|
98
|
-
};
|
|
99
|
-
if (g.op === 'fn' && g.fn === '%cond')
|
|
100
|
-
return cond(g.arg);
|
|
101
|
-
if (g.op === 'fn' && g.fn === '%truthy') {
|
|
102
|
-
const v = g.arg?.object?.v;
|
|
103
|
-
if (isObject(v) && typeof v.fn === 'string' && 'arg' in v && Object.keys(v).length === 2) {
|
|
104
|
-
if (v.fn === '%cond')
|
|
105
|
-
return cond(v.arg);
|
|
106
|
-
count('truthyCall');
|
|
107
|
-
return { op: 'fn', fn: v.fn, arg: v.arg };
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
return g;
|
|
111
|
-
}
|
|
112
|
-
const GUARD_KEYS = new Set(['guard', 'test']);
|
|
113
|
-
const isGuard = (v) => isObject(v) &&
|
|
114
|
-
typeof v.op === 'string' &&
|
|
115
|
-
['and', 'or', 'not', 'fn', 'eq', 'neq', 'lt', 'lte', 'gt', 'gte'].includes(v.op);
|
|
116
|
-
function walk(v, visit, key = null) {
|
|
117
|
-
const next = visit(v, key);
|
|
118
|
-
if (Array.isArray(next))
|
|
119
|
-
return next.map((x) => walk(x, visit, key));
|
|
120
|
-
if (isObject(next)) {
|
|
121
|
-
const out = {};
|
|
122
|
-
for (const [k, x] of Object.entries(next))
|
|
123
|
-
out[k] = walk(x, visit, k);
|
|
124
|
-
return out;
|
|
125
|
-
}
|
|
126
|
-
return next;
|
|
127
|
-
}
|
|
128
|
-
function forms(feature) {
|
|
129
|
-
const owners = new Map();
|
|
130
|
-
const used = new Set();
|
|
131
|
-
const scan = (v, inEach) => {
|
|
132
|
-
if (Array.isArray(v))
|
|
133
|
-
return v.forEach((x) => scan(x, inEach));
|
|
134
|
-
if (!isObject(v))
|
|
135
|
-
return;
|
|
136
|
-
if (v.kind === 'el' && typeof v.attrs?.id?.literal === 'string' && v.tag === 'form')
|
|
137
|
-
owners.set(v.attrs.id.literal, [...(owners.get(v.attrs.id.literal) ?? []), { node: v, inEach }]);
|
|
138
|
-
if (v.kind === 'el' && typeof v.attrs?.form?.literal === 'string')
|
|
139
|
-
used.add(v.attrs.form.literal);
|
|
140
|
-
for (const [k, x] of Object.entries(v))
|
|
141
|
-
scan(x, inEach || (v.kind === 'each' && k === 'item'));
|
|
142
|
-
};
|
|
143
|
-
scan(feature.views, false);
|
|
144
|
-
const ids = new Map();
|
|
145
|
-
for (const [value, list] of owners)
|
|
146
|
-
if (used.has(value) && list.length === 1 && !list[0].inEach)
|
|
147
|
-
ids.set(value, list[0].node.id);
|
|
148
|
-
if (!ids.size)
|
|
149
|
-
return;
|
|
150
|
-
count('formRef', ids.size);
|
|
151
|
-
const rewrite = (v) => {
|
|
152
|
-
if (Array.isArray(v))
|
|
153
|
-
return v.forEach(rewrite);
|
|
154
|
-
if (!isObject(v))
|
|
155
|
-
return;
|
|
156
|
-
if (v.kind === 'el') {
|
|
157
|
-
const id = v.tag === 'form' ? ids.get(v.attrs?.id?.literal) : undefined;
|
|
158
|
-
if (id && id === v.id) {
|
|
159
|
-
v.attrs.id = { formRef: id };
|
|
160
|
-
v.ref = { formRef: id };
|
|
161
|
-
}
|
|
162
|
-
const to = ids.get(v.attrs?.form?.literal);
|
|
163
|
-
if (to)
|
|
164
|
-
v.attrs.form = { formRef: to };
|
|
165
|
-
}
|
|
166
|
-
for (const x of Object.values(v))
|
|
167
|
-
rewrite(x);
|
|
168
|
-
};
|
|
169
|
-
rewrite(feature.views);
|
|
170
|
-
}
|
|
171
|
-
/**
|
|
172
|
-
* The 0.7 IR in 0.8 terms (ADR 0043 Migration): what `hozu migrate 0.8` must produce for an unchanged app.
|
|
173
|
-
* Every mapping here is one rewrite's allowed difference; anything else is a behaviour change.
|
|
174
|
-
*/
|
|
175
|
-
export function normalize07(input, into) {
|
|
176
|
-
counts = into ?? {};
|
|
177
|
-
const ir = clone(input);
|
|
178
|
-
count('irVersion', ir.irVersion === 2 ? 0 : 1);
|
|
179
|
-
ir.irVersion = 2;
|
|
180
|
-
const routes = ir.routes ?? {};
|
|
181
|
-
for (const f of Object.values(ir.features ?? {})) {
|
|
182
|
-
count('exportsEndpoints', f.exports?.endpoints ? 0 : 1);
|
|
183
|
-
f.exports = { ...f.exports, endpoints: f.exports?.endpoints ?? [] };
|
|
184
|
-
for (const e of Object.values(f.endpoints ?? {}))
|
|
185
|
-
if (!e.mode) {
|
|
186
|
-
e.mode = e.output === null ? 'response' : 'json';
|
|
187
|
-
count('endpointMode');
|
|
188
|
-
}
|
|
189
|
-
for (const q of Object.values(f.queries ?? {}))
|
|
190
|
-
if (q.scope === 'user' && ['static', 'revalidate', 'swr'].includes(q.freshness?.kind)) {
|
|
191
|
-
q.freshness = { kind: 'request' };
|
|
192
|
-
count('freshness');
|
|
193
|
-
}
|
|
194
|
-
forms(f);
|
|
195
|
-
}
|
|
196
|
-
for (const page of Object.values(ir.pages ?? {})) {
|
|
197
|
-
const head = page.head;
|
|
198
|
-
if (!head || !('redirects' in head) || 'failed' in head)
|
|
199
|
-
continue;
|
|
200
|
-
const failed = {};
|
|
201
|
-
for (const [k, v] of Object.entries(head.redirects ?? {})) {
|
|
202
|
-
failed[k] = { redirect: v };
|
|
203
|
-
count('headFailed');
|
|
204
|
-
}
|
|
205
|
-
const ref = typeof head.query?.ref === 'string' ? head.query.ref.split('.') : null;
|
|
206
|
-
const errors = ref ? Object.keys(ir.features?.[ref[0]]?.queries?.[ref[1]]?.errors ?? {}) : [];
|
|
207
|
-
for (const e of errors)
|
|
208
|
-
if (!(e in failed)) {
|
|
209
|
-
failed[e] = { status: 404 };
|
|
210
|
-
count('headFailed404');
|
|
211
|
-
}
|
|
212
|
-
delete head.redirects;
|
|
213
|
-
head.failed = failed;
|
|
214
|
-
}
|
|
215
|
-
return walk(ir, (v, key) => {
|
|
216
|
-
if (!isObject(v))
|
|
217
|
-
return v;
|
|
218
|
-
if (typeof v.link === 'string' && 'search' in v && routes[v.link]) {
|
|
219
|
-
const search = foldSearch(v.search, defaultsOf(routes[v.link].search));
|
|
220
|
-
count('linkFolding', equal(search, v.search) ? 0 : 1);
|
|
221
|
-
return { ...v, search };
|
|
222
|
-
}
|
|
223
|
-
if (v.op === 'inc' && Array.isArray(v.path) && 'value' in v) {
|
|
224
|
-
count('incPlus');
|
|
225
|
-
return {
|
|
226
|
-
op: 'set',
|
|
227
|
-
path: v.path,
|
|
228
|
-
value: { fn: '%plus', arg: { object: { a: { ref: 'context', path: v.path }, b: v.value } } },
|
|
229
|
-
};
|
|
230
|
-
}
|
|
231
|
-
if (key !== null && GUARD_KEYS.has(key) && isGuard(v))
|
|
232
|
-
return guard(v);
|
|
233
|
-
return v;
|
|
234
|
-
});
|
|
235
|
-
}
|
|
236
|
-
/** JSON pointers where two IRs differ, capped per call. */
|
|
237
|
-
export function differences(a, b, limit = 50, path = '', out = []) {
|
|
238
|
-
if (out.length >= limit || equal(a, b))
|
|
239
|
-
return out;
|
|
240
|
-
if (!isObject(a) || !isObject(b)) {
|
|
241
|
-
if (Array.isArray(a) && Array.isArray(b) && a.length === b.length)
|
|
242
|
-
for (let i = 0; i < a.length; i++)
|
|
243
|
-
differences(a[i], b[i], limit, `${path}/${i}`, out);
|
|
244
|
-
else
|
|
245
|
-
out.push(path || '/');
|
|
246
|
-
return out;
|
|
247
|
-
}
|
|
248
|
-
for (const k of [...new Set([...Object.keys(a), ...Object.keys(b)])].sort())
|
|
249
|
-
differences(a[k], b[k], limit, `${path}/${k.replaceAll('~', '~0').replaceAll('/', '~1')}`, out);
|
|
250
|
-
return out;
|
|
251
|
-
}
|
|
252
|
-
//# sourceMappingURL=migrate-normalize.js.map
|