@antelopejs/dms 0.20.6 → 0.20.8-next.916.gd319141
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/CHANGELOG.md +14 -0
- package/bin/control/commands-verify.mjs +8 -49
- package/bin/control/options.mjs +0 -1
- package/bin/control/run-state.mjs +1 -1
- package/bin/control/timing.mjs +1 -16
- package/bin/control/timing.test.mjs +0 -11
- package/bin/control/verify/decode.mjs +4 -144
- package/bin/control/verify/decode.test.mjs +1 -149
- package/bin/control/verify/formal.mjs +22 -218
- package/bin/control/verify/formal.test.mjs +60 -117
- package/bin/control/verify/map.test.mjs +0 -73
- package/bin/control/verify/types.mjs +4 -18
- package/bin/dms-control.mjs +0 -2
- package/dist/implementations/dms/page/controller.d.ts +2 -1
- package/dist/implementations/dms/page/controller.js.map +1 -1
- package/dist/implementations/dms-builder/engine/configure-target.d.ts +8 -0
- package/dist/implementations/dms-builder/engine/configure-target.js +36 -0
- package/dist/implementations/dms-builder/engine/configure-target.js.map +1 -0
- package/dist/implementations/dms-builder/engine/connection-access-config.js +2 -2
- package/dist/implementations/dms-builder/engine/connection-targets.js.map +1 -1
- package/dist/implementations/dms-builder/engine/database-access.d.ts +1 -1
- package/dist/implementations/dms-builder/engine/database-access.js +2 -2
- package/dist/implementations/dms-builder/engine/database-check-input.d.ts +3 -2
- package/dist/implementations/dms-builder/engine/database-check-input.js.map +1 -1
- package/dist/implementations/dms-builder/engine/database-check.js +2 -2
- package/dist/implementations/dms-builder/engine/database-check.js.map +1 -1
- package/dist/implementations/dms-builder/engine/index.d.ts +1 -0
- package/dist/implementations/dms-builder/engine/index.js +1 -0
- package/dist/implementations/dms-builder/engine/index.js.map +1 -1
- package/dist/implementations/dms-builder/engine/probe-answer.d.ts +44 -1
- package/dist/implementations/dms-builder/engine/probe-answer.js +2 -5
- package/dist/implementations/dms-builder/engine/probe-answer.js.map +1 -1
- package/dist/mcp/tools/builder-compose.js +19 -3
- package/dist/mcp/tools/builder-compose.js.map +1 -1
- package/dist/mcp/tools/builder-pages.js +68 -6
- package/dist/mcp/tools/builder-pages.js.map +1 -1
- package/dist/mcp/tools/builder-request-targets.d.ts +14 -0
- package/dist/mcp/tools/builder-request-targets.js +256 -0
- package/dist/mcp/tools/builder-request-targets.js.map +1 -0
- package/dist/mcp/tools/index.d.ts +1 -0
- package/dist/mcp/tools/index.js +3 -1
- package/dist/mcp/tools/index.js.map +1 -1
- package/dist/mcp/tools/mockup-apply-to-page.d.ts +2 -0
- package/dist/mcp/tools/mockup-apply-to-page.js +15 -1
- package/dist/mcp/tools/mockup-apply-to-page.js.map +1 -1
- package/dist/mockup/apply-to-page.d.ts +1 -0
- package/dist/mockup/apply-to-page.js +3 -2
- package/dist/mockup/apply-to-page.js.map +1 -1
- package/dist/mockup/compile.js +7 -1
- package/dist/mockup/compile.js.map +1 -1
- package/dist/mockup/files.d.ts +1 -1
- package/dist/mockup/files.js +2 -2
- package/dist/mockup/sample-routes.d.ts +3 -0
- package/dist/mockup/sample-routes.js +53 -0
- package/dist/mockup/sample-routes.js.map +1 -0
- package/dist/pages/settings/users/roles.js.map +1 -1
- package/dist/store/internal/frontend/frontend-ready.d.ts +2 -1
- package/dist/store/internal/frontend/frontend-ready.js.map +1 -1
- package/dist/store/operations.js +4 -4
- package/dist/store/operations.js.map +1 -1
- package/dist/utils/upload-constraints.d.ts +1 -1
- package/dist/utils/upload-constraints.js +2 -2
- package/dist/utils/upload-constraints.js.map +1 -1
- package/dist/validation/issue-message.d.ts +1 -1
- package/dist/validation/issue-message.js +3 -3
- package/dist/validation/issue-message.js.map +1 -1
- package/frontend-vue/layers/dms-core/app/utils/formatter.ts +1 -0
- package/frontend-vue/layers/dms-layout/app/build/composables/navigation/useVisitNavBadges.ts +11 -14
- package/frontend-vue/layers/dms-layout/app/build/composables/settings/security/useSecurityFormat.ts +5 -5
- package/frontend-vue/layers/dms-layout/app/build/utils/modules-catalog.ts +7 -2
- package/frontend-vue/layers/dms-layout/app/build/utils/notificationPayload.ts +9 -5
- package/frontend-vue/layers/dms-layout/app/composables/page/useModuleHistory.ts +4 -1
- package/frontend-vue/layers/dms-layout/app/composables/page/useModulesListing.ts +7 -17
- package/frontend-vue/layers/dms-layout/app/custom-pages/modules.vue +5 -1
- package/frontend-vue/layers/dms-ui/app/build/components/block-preview/MockupWorkbench.vue +17 -1
- package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/useBlockPreviewEmbed.ts +9 -0
- package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/useMockupCatalog.ts +4 -1
- package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/useMockupSpec.ts +18 -16
- package/frontend-vue/layers/dms-ui/app/build/composables/block-preview/usePreviewFrame.ts +8 -1
- package/frontend-vue/layers/dms-ui/app/build/composables/containers/drawerSize.ts +4 -4
- package/frontend-vue/layers/dms-ui/app/build/composables/data-types/relationBadges.ts +2 -5
- package/frontend-vue/layers/dms-ui/app/build/composables/form/fieldComponentProps.ts +2 -2
- package/frontend-vue/layers/dms-ui/app/build/composables/layout/sidePanelState.ts +5 -2
- package/frontend-vue/layers/dms-ui/app/build/composables/period/periodQuery.ts +6 -3
- package/frontend-vue/layers/dms-ui/app/build/composables/table-view/tableRowActionValues.ts +13 -13
- package/frontend-vue/layers/dms-ui/app/build/composables/table-view/utils/writeError.ts +2 -2
- package/frontend-vue/layers/dms-ui/app/build/mockups/MockupThumbnail.vue +6 -1
- package/frontend-vue/layers/dms-ui/app/build/utils/blockPreview.ts +1 -1
- package/frontend-vue/layers/dms-ui/app/build/utils/blockPreviewMessages.ts +26 -18
- package/frontend-vue/layers/dms-ui/app/build/utils/mockupCatalog.ts +7 -2
- package/frontend-vue/layers/dms-ui/app/build/utils/mockupSpec.ts +2 -1
- package/frontend-vue/layers/dms-ui/app/build/utils/previewFixturesOnly.ts +82 -0
- package/frontend-vue/layers/dms-ui/app/components/block-preview/BlockPreview.vue +10 -1
- package/frontend-vue/layers/dms-ui/app/components/chart/ApexChartHost.vue +2 -0
- package/frontend-vue/layers/dms-ui/app/composables/form/useUploadWithProgress.ts +6 -1
- package/frontend-vue/layers/dms-ui/app/composables/useExportJob.ts +2 -2
- package/package.json +32 -30
- package/skills/dms-project/scripts/dms-dev.sh +0 -0
- package/bin/control/verify/behaviour.mjs +0 -183
- package/bin/control/verify/behaviour.test.mjs +0 -472
- package/bin/control/verify/emit.mjs +0 -539
- package/bin/control/verify/judgement.mjs +0 -101
- package/bin/control/verify/verdict.mjs +0 -327
- package/frontend-vue/scripts/probes/capture-frontend-probe.cjs +0 -23
- package/frontend-vue/scripts/probes/frontend-behavior.cjs +0 -606
- package/frontend-vue/scripts/probes/frontend-legacy.cjs +0 -620
- package/frontend-vue/scripts/probes/frontend-probe-controls.cjs +0 -322
- package/frontend-vue/scripts/prove-comment-emit.mjs +0 -171
- package/frontend-vue/scripts/prove-component-registration.mjs +0 -259
|
@@ -1,322 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
const assert = require("node:assert/strict");
|
|
4
|
-
const fs = require("node:fs");
|
|
5
|
-
const os = require("node:os");
|
|
6
|
-
const path = require("node:path");
|
|
7
|
-
const { execFileSync } = require("node:child_process");
|
|
8
|
-
const { createRequire } = require("node:module");
|
|
9
|
-
const { captureProbe } = require("./capture-frontend-probe.cjs");
|
|
10
|
-
|
|
11
|
-
/** @typedef {{ name: string; signature: string; injected: boolean }} AutoImport */
|
|
12
|
-
|
|
13
|
-
/** @typedef {{ autoImports: AutoImport[]; registrations: unknown[] }} ProbeResult */
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* @param {unknown} value
|
|
17
|
-
* @returns {value is Record<string, unknown>}
|
|
18
|
-
*/
|
|
19
|
-
function isObjectLike(value) {
|
|
20
|
-
return typeof value === "object" && value !== null;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* @param {unknown} value
|
|
25
|
-
* @returns {value is AutoImport}
|
|
26
|
-
*/
|
|
27
|
-
function isAutoImport(value) {
|
|
28
|
-
return (
|
|
29
|
-
isObjectLike(value) &&
|
|
30
|
-
Object.hasOwn(value, "name") &&
|
|
31
|
-
typeof value.name === "string" &&
|
|
32
|
-
Object.hasOwn(value, "signature") &&
|
|
33
|
-
typeof value.signature === "string" &&
|
|
34
|
-
Object.hasOwn(value, "injected") &&
|
|
35
|
-
typeof value.injected === "boolean"
|
|
36
|
-
);
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
* @param {unknown} value
|
|
41
|
-
* @returns {value is ProbeResult}
|
|
42
|
-
*/
|
|
43
|
-
function isProbeResult(value) {
|
|
44
|
-
return (
|
|
45
|
-
isObjectLike(value) &&
|
|
46
|
-
Object.hasOwn(value, "autoImports") &&
|
|
47
|
-
Array.isArray(value.autoImports) &&
|
|
48
|
-
value.autoImports.every(isAutoImport) &&
|
|
49
|
-
Object.hasOwn(value, "registrations") &&
|
|
50
|
-
Array.isArray(value.registrations)
|
|
51
|
-
);
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
/**
|
|
55
|
-
* @param {unknown} value
|
|
56
|
-
* @returns {value is import("typescript").Node & { name: { text: string } }}
|
|
57
|
-
*/
|
|
58
|
-
function hasTextName(value) {
|
|
59
|
-
return (
|
|
60
|
-
isObjectLike(value) &&
|
|
61
|
-
Object.hasOwn(value, "name") &&
|
|
62
|
-
isObjectLike(value.name) &&
|
|
63
|
-
typeof value.name.text === "string"
|
|
64
|
-
);
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
/**
|
|
68
|
-
* @type {(from: string) => (id: string) => typeof import("typescript")}
|
|
69
|
-
*/
|
|
70
|
-
const createTypeScriptRequire = createRequire;
|
|
71
|
-
|
|
72
|
-
const root = path.resolve(process.argv[2]);
|
|
73
|
-
const frontend = path.join(root, "packages/dms/frontend-vue");
|
|
74
|
-
const temporary = fs.mkdtempSync(path.join(os.tmpdir(), "frontend-controls-"));
|
|
75
|
-
const copy = path.join(temporary, "packages/dms/frontend-vue");
|
|
76
|
-
const probe = path.join(temporary, "captured-probe.cjs");
|
|
77
|
-
const run = () => {
|
|
78
|
-
/** @type {unknown} */
|
|
79
|
-
const result = JSON.parse(
|
|
80
|
-
execFileSync(
|
|
81
|
-
process.execPath,
|
|
82
|
-
["--max-old-space-size=650", probe, temporary],
|
|
83
|
-
{
|
|
84
|
-
encoding: "utf8",
|
|
85
|
-
stdio: ["ignore", "pipe", "pipe"],
|
|
86
|
-
maxBuffer: 64 * 1024 * 1024,
|
|
87
|
-
},
|
|
88
|
-
),
|
|
89
|
-
);
|
|
90
|
-
if (!isProbeResult(result))
|
|
91
|
-
throw new TypeError("The captured probe printed an unexpected result");
|
|
92
|
-
return result;
|
|
93
|
-
};
|
|
94
|
-
/**
|
|
95
|
-
* @param {ProbeResult} result
|
|
96
|
-
* @param {string} name
|
|
97
|
-
*/
|
|
98
|
-
const entry = (result, name) =>
|
|
99
|
-
result.autoImports.find((item) => item.name === name);
|
|
100
|
-
|
|
101
|
-
try {
|
|
102
|
-
fs.mkdirSync(copy, { recursive: true });
|
|
103
|
-
for (const file of [
|
|
104
|
-
"layers",
|
|
105
|
-
"package.json",
|
|
106
|
-
"dms.frontend.ts",
|
|
107
|
-
"dms.frontend.build.ts",
|
|
108
|
-
])
|
|
109
|
-
fs.cpSync(path.join(frontend, file), path.join(copy, file), {
|
|
110
|
-
recursive: true,
|
|
111
|
-
});
|
|
112
|
-
fs.symlinkSync(
|
|
113
|
-
path.join(frontend, "node_modules"),
|
|
114
|
-
path.join(copy, "node_modules"),
|
|
115
|
-
);
|
|
116
|
-
fs.symlinkSync(
|
|
117
|
-
path.join(root, "node_modules"),
|
|
118
|
-
path.join(temporary, "node_modules"),
|
|
119
|
-
);
|
|
120
|
-
fs.symlinkSync(
|
|
121
|
-
path.join(root, "packages/interface-dms"),
|
|
122
|
-
path.join(temporary, "packages/interface-dms"),
|
|
123
|
-
);
|
|
124
|
-
captureProbe(probe);
|
|
125
|
-
const baseline = run();
|
|
126
|
-
const bucket = path.join(
|
|
127
|
-
copy,
|
|
128
|
-
"layers/dms-ui/app/composables/chart/apexDatetimeBuckets.ts",
|
|
129
|
-
);
|
|
130
|
-
const originalBucket = fs.readFileSync(bucket, "utf8");
|
|
131
|
-
const ts = createTypeScriptRequire(path.join(frontend, "package.json"))(
|
|
132
|
-
"typescript",
|
|
133
|
-
);
|
|
134
|
-
const ast = ts.createSourceFile(
|
|
135
|
-
bucket,
|
|
136
|
-
originalBucket,
|
|
137
|
-
ts.ScriptTarget.Latest,
|
|
138
|
-
true,
|
|
139
|
-
);
|
|
140
|
-
/** @type {import("typescript").TypeNode | undefined} */
|
|
141
|
-
let timestamp;
|
|
142
|
-
/** @param {import("typescript").Node} node */
|
|
143
|
-
const visit = (node) => {
|
|
144
|
-
if (ts.isParameter(node) && node.name.getText(ast) === "timestamp")
|
|
145
|
-
timestamp = node.type;
|
|
146
|
-
ts.forEachChild(node, visit);
|
|
147
|
-
};
|
|
148
|
-
const formatter = ast.statements.find(
|
|
149
|
-
(node) => hasTextName(node) && node.name.text === "bucketAxisFormatter",
|
|
150
|
-
);
|
|
151
|
-
visit(formatter);
|
|
152
|
-
assert.ok(timestamp);
|
|
153
|
-
const narrowed =
|
|
154
|
-
originalBucket.slice(0, timestamp.getStart(ast)) +
|
|
155
|
-
"number" +
|
|
156
|
-
originalBucket.slice(timestamp.end);
|
|
157
|
-
assert.notEqual(
|
|
158
|
-
narrowed,
|
|
159
|
-
originalBucket,
|
|
160
|
-
"The baseline bucket callback must accept unknown",
|
|
161
|
-
);
|
|
162
|
-
fs.writeFileSync(bucket, narrowed);
|
|
163
|
-
const narrowResult = run();
|
|
164
|
-
assert.notDeepEqual(
|
|
165
|
-
entry(narrowResult, "bucketAxisFormatter"),
|
|
166
|
-
entry(baseline, "bucketAxisFormatter"),
|
|
167
|
-
);
|
|
168
|
-
assert.match(
|
|
169
|
-
entry(narrowResult, "bucketAxisFormatter").signature,
|
|
170
|
-
/timestamp\?: number/,
|
|
171
|
-
);
|
|
172
|
-
fs.writeFileSync(bucket, originalBucket);
|
|
173
|
-
|
|
174
|
-
const extra = path.join(
|
|
175
|
-
copy,
|
|
176
|
-
"layers/dms-ui/app/composables/internal/probeExtraAutoImport.ts",
|
|
177
|
-
);
|
|
178
|
-
fs.mkdirSync(path.dirname(extra), { recursive: true });
|
|
179
|
-
fs.writeFileSync(
|
|
180
|
-
extra,
|
|
181
|
-
"/** @internal */\nexport function probeExtraAutoImport(value: unknown): unknown { return value; }\n",
|
|
182
|
-
);
|
|
183
|
-
const extraResult = run();
|
|
184
|
-
assert.equal(entry(baseline, "probeExtraAutoImport"), undefined);
|
|
185
|
-
assert.equal(entry(extraResult, "probeExtraAutoImport").injected, true);
|
|
186
|
-
assert.match(
|
|
187
|
-
entry(extraResult, "probeExtraAutoImport").signature,
|
|
188
|
-
/value: unknown/,
|
|
189
|
-
);
|
|
190
|
-
fs.rmSync(extra);
|
|
191
|
-
|
|
192
|
-
const register = path.join(copy, "layers/dms-ui/app/plugins/register.ts");
|
|
193
|
-
const originalRegister = fs.readFileSync(register, "utf8");
|
|
194
|
-
const reordered = originalRegister
|
|
195
|
-
.replace(" registerBlockFunctions();\n", "")
|
|
196
|
-
.replace(
|
|
197
|
-
" registerDefaultDataTypes();",
|
|
198
|
-
" registerBlockFunctions();\n registerDefaultDataTypes();",
|
|
199
|
-
);
|
|
200
|
-
assert.notEqual(reordered, originalRegister);
|
|
201
|
-
fs.writeFileSync(register, reordered);
|
|
202
|
-
const reorderResult = run();
|
|
203
|
-
assert.equal(
|
|
204
|
-
reorderResult.registrations.length,
|
|
205
|
-
baseline.registrations.length,
|
|
206
|
-
);
|
|
207
|
-
assert.notDeepEqual(reorderResult.registrations, baseline.registrations);
|
|
208
|
-
const firstDifference = baseline.registrations.findIndex(
|
|
209
|
-
(event, index) =>
|
|
210
|
-
JSON.stringify(event) !==
|
|
211
|
-
JSON.stringify(reorderResult.registrations[index]),
|
|
212
|
-
);
|
|
213
|
-
fs.writeFileSync(register, originalRegister);
|
|
214
|
-
|
|
215
|
-
fs.writeFileSync(
|
|
216
|
-
extra,
|
|
217
|
-
'export const probePropertyOrder: { first: string; second: number } = { first: "", second: 0 };\n',
|
|
218
|
-
);
|
|
219
|
-
const propertyOrder = entry(run(), "probePropertyOrder");
|
|
220
|
-
fs.writeFileSync(
|
|
221
|
-
extra,
|
|
222
|
-
'export const probePropertyOrder: { second: number; first: string } = { first: "", second: 0 };\n',
|
|
223
|
-
);
|
|
224
|
-
assert.deepEqual(entry(run(), "probePropertyOrder"), propertyOrder);
|
|
225
|
-
fs.writeFileSync(
|
|
226
|
-
extra,
|
|
227
|
-
'export const probePropertyOrder: { second: string; first: string } = { first: "", second: "" };\n',
|
|
228
|
-
);
|
|
229
|
-
assert.notDeepEqual(entry(run(), "probePropertyOrder"), propertyOrder);
|
|
230
|
-
|
|
231
|
-
fs.writeFileSync(
|
|
232
|
-
extra,
|
|
233
|
-
"export function probeExtraAutoImport(value: unknown): Record<string, unknown> { return {}; }\n",
|
|
234
|
-
);
|
|
235
|
-
const explicit = run();
|
|
236
|
-
const owner = path.join(copy, "layers/dms-ui/app/build/probeTypeOwner.ts");
|
|
237
|
-
fs.writeFileSync(
|
|
238
|
-
owner,
|
|
239
|
-
"export function probeTypeOwner(value: unknown): Record<string, unknown> { return {}; }\n",
|
|
240
|
-
);
|
|
241
|
-
fs.writeFileSync(
|
|
242
|
-
extra,
|
|
243
|
-
"import { probeTypeOwner } from '../../build/probeTypeOwner';\nexport function probeExtraAutoImport(value: Parameters<typeof probeTypeOwner>[0]): ReturnType<typeof probeTypeOwner> { return {}; }\n",
|
|
244
|
-
);
|
|
245
|
-
const derived = run();
|
|
246
|
-
assert.deepEqual(
|
|
247
|
-
entry(explicit, "probeExtraAutoImport"),
|
|
248
|
-
entry(derived, "probeExtraAutoImport"),
|
|
249
|
-
);
|
|
250
|
-
const runtimeFile = path.join(copy, "dms.frontend.ts");
|
|
251
|
-
const runtimeSource = fs.readFileSync(runtimeFile, "utf8");
|
|
252
|
-
const runtimeAst = ts.createSourceFile(
|
|
253
|
-
runtimeFile,
|
|
254
|
-
runtimeSource,
|
|
255
|
-
ts.ScriptTarget.Latest,
|
|
256
|
-
true,
|
|
257
|
-
);
|
|
258
|
-
/**
|
|
259
|
-
* @param {import("typescript").Node} node
|
|
260
|
-
* @returns {node is import("typescript").VariableStatement}
|
|
261
|
-
*/
|
|
262
|
-
const isComponentsDeclaration = (node) =>
|
|
263
|
-
ts.isVariableStatement(node) &&
|
|
264
|
-
node.declarationList.declarations[0].name.getText(runtimeAst) ===
|
|
265
|
-
"components";
|
|
266
|
-
const components = runtimeAst.statements.find(isComponentsDeclaration);
|
|
267
|
-
const initializer = components?.declarationList.declarations[0].initializer;
|
|
268
|
-
if (initializer?.getText(runtimeAst).includes("import.meta.glob")) {
|
|
269
|
-
const entryFile = path.join(
|
|
270
|
-
copy,
|
|
271
|
-
"layers/dms-ui/app/entries/probe-components.ts",
|
|
272
|
-
);
|
|
273
|
-
const prefix = `${path.relative(path.dirname(entryFile), copy)}/`;
|
|
274
|
-
const expression = initializer
|
|
275
|
-
.getText(runtimeAst)
|
|
276
|
-
.replaceAll("./layers/", `${prefix}layers/`);
|
|
277
|
-
/** @type {Set<string>} */
|
|
278
|
-
const references = new Set();
|
|
279
|
-
/** @param {import("typescript").Node} node */
|
|
280
|
-
const collectReferences = (node) => {
|
|
281
|
-
if (ts.isIdentifier(node)) references.add(node.text);
|
|
282
|
-
ts.forEachChild(node, collectReferences);
|
|
283
|
-
};
|
|
284
|
-
collectReferences(initializer);
|
|
285
|
-
const imports = runtimeAst.statements
|
|
286
|
-
.filter((node) => {
|
|
287
|
-
if (!ts.isImportDeclaration(node) || !node.importClause) return false;
|
|
288
|
-
const { name, namedBindings } = node.importClause;
|
|
289
|
-
const bindings = namedBindings
|
|
290
|
-
? ts.isNamedImports(namedBindings)
|
|
291
|
-
? namedBindings.elements.map((binding) => binding.name)
|
|
292
|
-
: [namedBindings.name]
|
|
293
|
-
: [];
|
|
294
|
-
return [name, ...bindings].some(
|
|
295
|
-
(binding) => binding && references.has(binding.text),
|
|
296
|
-
);
|
|
297
|
-
})
|
|
298
|
-
.map((node) =>
|
|
299
|
-
node.getText(runtimeAst).replaceAll("./layers/", `${prefix}layers/`),
|
|
300
|
-
)
|
|
301
|
-
.join("\n");
|
|
302
|
-
fs.mkdirSync(path.dirname(entryFile), { recursive: true });
|
|
303
|
-
fs.writeFileSync(
|
|
304
|
-
entryFile,
|
|
305
|
-
`${imports}\nconst local = ${expression};\nexport const components = Object.fromEntries(Object.entries(local).map(([name, loader]) => [name.replace(${JSON.stringify(prefix)}, './'), loader]));\n`,
|
|
306
|
-
);
|
|
307
|
-
fs.writeFileSync(
|
|
308
|
-
runtimeFile,
|
|
309
|
-
runtimeSource.slice(0, components.getStart(runtimeAst)) +
|
|
310
|
-
"import { components } from './layers/dms-ui/app/entries/probe-components';" +
|
|
311
|
-
runtimeSource.slice(components.end),
|
|
312
|
-
);
|
|
313
|
-
assert.deepEqual(run().registrations, baseline.registrations);
|
|
314
|
-
} else {
|
|
315
|
-
assert.match(runtimeSource, /entries/);
|
|
316
|
-
}
|
|
317
|
-
process.stdout.write(
|
|
318
|
-
`${JSON.stringify({ autoImports: baseline.autoImports.length, registrations: baseline.registrations.length, bucketAxisFormatter: { before: entry(baseline, "bucketAxisFormatter").signature, after: entry(narrowResult, "bucketAxisFormatter").signature }, extraAutoImport: entry(extraResult, "probeExtraAutoImport"), registrationReorder: { firstDifference, before: baseline.registrations[firstDifference], after: reorderResult.registrations[firstDifference] }, ownerDerivedEquivalent: true, objectPropertyOrderEquivalent: true, objectPropertyTypeChangeDetected: true, capturedSingleFile: true, importedEntryMaps: true })}\n`,
|
|
319
|
-
);
|
|
320
|
-
} finally {
|
|
321
|
-
fs.rmSync(temporary, { recursive: true, force: true });
|
|
322
|
-
}
|
|
@@ -1,171 +0,0 @@
|
|
|
1
|
-
import assert from "node:assert/strict";
|
|
2
|
-
import { execFileSync } from "node:child_process";
|
|
3
|
-
import { readFileSync } from "node:fs";
|
|
4
|
-
import { createRequire } from "node:module";
|
|
5
|
-
import { join } from "node:path";
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* @param {string[]} args
|
|
9
|
-
* @returns {string}
|
|
10
|
-
*/
|
|
11
|
-
const git = (...args) =>
|
|
12
|
-
execFileSync("git", args, { encoding: "utf8", maxBuffer: 64 * 1024 * 1024 });
|
|
13
|
-
const root = git("rev-parse", "--show-toplevel").trim();
|
|
14
|
-
const area = "packages/dms/frontend-vue";
|
|
15
|
-
const requireFrom = join(root, area, "package.json");
|
|
16
|
-
/** @type {(id: string) => typeof import("typescript")} */
|
|
17
|
-
const loadTypeScript = createRequire(requireFrom);
|
|
18
|
-
/** @type {(id: string) => typeof import("prettier")} */
|
|
19
|
-
const loadPrettier = createRequire(requireFrom);
|
|
20
|
-
/** @type {(id: string) => typeof import("vue/compiler-sfc")} */
|
|
21
|
-
const loadCompilerSfc = createRequire(requireFrom);
|
|
22
|
-
const ts = loadTypeScript("typescript");
|
|
23
|
-
const prettier = loadPrettier("prettier");
|
|
24
|
-
const { parse, compileTemplate } = loadCompilerSfc("vue/compiler-sfc");
|
|
25
|
-
const base = process.argv[2];
|
|
26
|
-
assert.ok(base, "Usage: node frontend-comment-emit.mjs <base-ref>");
|
|
27
|
-
const head = process.argv.includes("--working")
|
|
28
|
-
? "WORKTREE"
|
|
29
|
-
: git("rev-parse", "HEAD").trim();
|
|
30
|
-
const printer = ts.createPrinter({ removeComments: true });
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* @param {string} source
|
|
34
|
-
* @param {string} file
|
|
35
|
-
* @returns {Promise<string>}
|
|
36
|
-
*/
|
|
37
|
-
async function scriptSyntax(source, file) {
|
|
38
|
-
const parsed = ts.createSourceFile(
|
|
39
|
-
file,
|
|
40
|
-
source,
|
|
41
|
-
ts.ScriptTarget.Latest,
|
|
42
|
-
true,
|
|
43
|
-
);
|
|
44
|
-
return prettier.format(printer.printFile(parsed), { parser: "typescript" });
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
/**
|
|
48
|
-
* @param {string} source
|
|
49
|
-
* @param {string} file
|
|
50
|
-
*/
|
|
51
|
-
async function sourceEmit(source, file) {
|
|
52
|
-
const tree = ts.createSourceFile(file, source, ts.ScriptTarget.Latest, true);
|
|
53
|
-
assert.deepEqual(tree.parseDiagnostics, [], `${file}: syntax diagnostics`);
|
|
54
|
-
return {
|
|
55
|
-
syntax: await scriptSyntax(source, file),
|
|
56
|
-
javascript: file.endsWith(".d.ts")
|
|
57
|
-
? null
|
|
58
|
-
: await scriptSyntax(
|
|
59
|
-
ts.transpileModule(source, {
|
|
60
|
-
fileName: file,
|
|
61
|
-
compilerOptions: {
|
|
62
|
-
target: ts.ScriptTarget.ESNext,
|
|
63
|
-
module: ts.ModuleKind.ESNext,
|
|
64
|
-
removeComments: true,
|
|
65
|
-
sourceMap: false,
|
|
66
|
-
inlineSourceMap: false,
|
|
67
|
-
newLine: ts.NewLineKind.LineFeed,
|
|
68
|
-
},
|
|
69
|
-
}).outputText,
|
|
70
|
-
`${file}.js`,
|
|
71
|
-
),
|
|
72
|
-
};
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
/**
|
|
76
|
-
* @param {string} source
|
|
77
|
-
* @param {string} file
|
|
78
|
-
*/
|
|
79
|
-
async function vueOutput(source, file) {
|
|
80
|
-
const { descriptor, errors } = parse(source, { filename: file });
|
|
81
|
-
assert.deepEqual(errors, [], `${file}: SFC parse errors`);
|
|
82
|
-
const scripts = await Promise.all(
|
|
83
|
-
[descriptor.script, descriptor.scriptSetup].map(async (script) =>
|
|
84
|
-
script
|
|
85
|
-
? {
|
|
86
|
-
attributes: script.attrs,
|
|
87
|
-
...(await sourceEmit(script.content, `${file}.ts`)),
|
|
88
|
-
}
|
|
89
|
-
: null,
|
|
90
|
-
),
|
|
91
|
-
);
|
|
92
|
-
const template = descriptor.template;
|
|
93
|
-
/** @param {boolean} ssr */
|
|
94
|
-
function render(ssr) {
|
|
95
|
-
if (!template) return null;
|
|
96
|
-
const result = compileTemplate({
|
|
97
|
-
source: template.content,
|
|
98
|
-
filename: file,
|
|
99
|
-
id: "comment-proof",
|
|
100
|
-
ssr,
|
|
101
|
-
ssrCssVars: descriptor.cssVars,
|
|
102
|
-
scoped: descriptor.styles.some((style) => style.scoped),
|
|
103
|
-
compilerOptions: { comments: true, expressionPlugins: ["typescript"] },
|
|
104
|
-
});
|
|
105
|
-
assert.deepEqual(result.errors, [], `${file}: template compile errors`);
|
|
106
|
-
return result.code;
|
|
107
|
-
}
|
|
108
|
-
return {
|
|
109
|
-
scripts,
|
|
110
|
-
templateAttributes: template?.attrs,
|
|
111
|
-
render: render(false),
|
|
112
|
-
ssr: render(true),
|
|
113
|
-
styles: descriptor.styles.map((style) => ({
|
|
114
|
-
attributes: style.attrs,
|
|
115
|
-
content: style.content,
|
|
116
|
-
})),
|
|
117
|
-
custom: descriptor.customBlocks.map((block) => ({
|
|
118
|
-
type: block.type,
|
|
119
|
-
attributes: block.attrs,
|
|
120
|
-
content: block.content,
|
|
121
|
-
})),
|
|
122
|
-
};
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
/**
|
|
126
|
-
* @param {string} ref
|
|
127
|
-
* @returns {string[]}
|
|
128
|
-
*/
|
|
129
|
-
function files(ref) {
|
|
130
|
-
const paths =
|
|
131
|
-
ref === "WORKTREE"
|
|
132
|
-
? git(
|
|
133
|
-
"ls-files",
|
|
134
|
-
"--cached",
|
|
135
|
-
"--others",
|
|
136
|
-
"--exclude-standard",
|
|
137
|
-
"--",
|
|
138
|
-
area,
|
|
139
|
-
)
|
|
140
|
-
: git("ls-tree", "-r", "--name-only", ref, "--", area);
|
|
141
|
-
return paths
|
|
142
|
-
.trim()
|
|
143
|
-
.split("\n")
|
|
144
|
-
.filter((file) => /\.(?:[cm]?js|ts|vue|css)$/.test(file))
|
|
145
|
-
.filter((file) => !file.startsWith(`${area}/tests/`))
|
|
146
|
-
.filter((file) => file !== `${area}/scripts/prove-comment-emit.mjs`);
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
const before = files(base);
|
|
150
|
-
const after = files(head);
|
|
151
|
-
assert.deepEqual(after, before, "Product source file set changed");
|
|
152
|
-
for (const file of before) {
|
|
153
|
-
/** @param {string} ref */
|
|
154
|
-
const compileProduct = (ref) => {
|
|
155
|
-
const source =
|
|
156
|
-
ref === "WORKTREE"
|
|
157
|
-
? readFileSync(join(root, file), "utf8")
|
|
158
|
-
: git("show", `${ref}:${file}`);
|
|
159
|
-
if (file.endsWith(".vue")) return vueOutput(source, file);
|
|
160
|
-
if (file.endsWith(".css")) return source;
|
|
161
|
-
return sourceEmit(source, file);
|
|
162
|
-
};
|
|
163
|
-
assert.deepEqual(
|
|
164
|
-
await compileProduct(head),
|
|
165
|
-
await compileProduct(base),
|
|
166
|
-
`${file}: non-comment source or emit changed`,
|
|
167
|
-
);
|
|
168
|
-
}
|
|
169
|
-
console.log(
|
|
170
|
-
`Frontend comment emit proof: ${before.length} product files unchanged against ${base} (${head === "WORKTREE" ? "working tree" : `committed HEAD ${head}`}).`,
|
|
171
|
-
);
|