@akanjs/devkit 3.3.0-rc.12 → 3.3.0-rc.14
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 +48 -0
- package/DEV_RUNTIME_KNOBS.md +1 -1
- package/akanConfig/akanConfig.ts +4 -4
- package/app/applicationBuildRunner.test.ts +272 -0
- package/app/applicationBuildRunner.ts +87 -2
- package/artifact/implicitRootLayoutRender.test.tsx +4 -1
- package/codeAgent/skills/akan-runtime/SKILL.md +20 -0
- package/executors/workspaceExecutor.ts +7 -4
- package/frontendBuild/clientEntryDiscovery.test.ts +35 -0
- package/frontendBuild/clientEntryDiscovery.ts +14 -1
- package/lint/biomeCheck.test.ts +145 -0
- package/lint/biomeCheck.ts +131 -0
- package/lint/withheldEnvFile.ts +17 -0
- package/mobile/serverBundleSecrets.ts +43 -0
- package/package.json +3 -3
- package/test/secretEnvFixture.ts +134 -0
- package/transforms/secretEnvDeclaration.test.ts +208 -0
- package/transforms/secretEnvDeclaration.ts +213 -0
- package/transforms/secretEnvFile.test.ts +117 -0
- package/transforms/secretEnvFile.ts +113 -0
- package/transforms/secretEnvName.test.ts +54 -0
- package/transforms/secretEnvName.ts +29 -0
- package/transforms/secretEnvSource.test.ts +148 -0
- package/transforms/secretEnvSource.ts +166 -0
- package/transforms/serverEnvEvaluationError.ts +11 -0
- package/transforms/serverEnvPlugin.test.ts +2 -1
- package/transforms/serverEnvPlugin.ts +13 -0
- package/transforms/serverEnvProfile.test.ts +115 -2
- package/transforms/serverEnvProfile.ts +117 -40
- package/transforms/serverEnvSecrets.test.ts +292 -0
- package/typecheck/projectTypecheck.test.ts +29 -0
- package/typecheck/typeChecker.test.ts +49 -0
- package/typecheck/typeChecker.ts +9 -7
- package/typecheck/withheldDiagnostics.ts +41 -0
package/typecheck/typeChecker.ts
CHANGED
|
@@ -4,6 +4,7 @@ import chalk from "chalk";
|
|
|
4
4
|
import * as ts from "typescript";
|
|
5
5
|
|
|
6
6
|
import type { Executor } from "../executors";
|
|
7
|
+
import { WithheldDiagnostics } from "./withheldDiagnostics";
|
|
7
8
|
|
|
8
9
|
export interface ProjectTypecheckResult {
|
|
9
10
|
configPath: string;
|
|
@@ -93,7 +94,7 @@ export class TypeChecker {
|
|
|
93
94
|
: diagnostic.category === ts.DiagnosticCategory.Warning
|
|
94
95
|
? (["warning", chalk.yellow, "⚠️"] as const)
|
|
95
96
|
: (["suggestion", chalk.blue, "💡"] as const);
|
|
96
|
-
const message =
|
|
97
|
+
const message = WithheldDiagnostics.message(diagnostic);
|
|
97
98
|
const tsCode = chalk.dim(`(TS${diagnostic.code})`);
|
|
98
99
|
|
|
99
100
|
if (diagnostic.file && diagnostic.start !== undefined) {
|
|
@@ -103,7 +104,7 @@ export class TypeChecker {
|
|
|
103
104
|
output.push(` ${chalk.gray("at")} ${fileName}:${chalk.bold(`${line + 1}:${character + 1}`)}`);
|
|
104
105
|
|
|
105
106
|
const sourceLines = diagnostic.file.text.split("\n");
|
|
106
|
-
if (line < sourceLines.length) {
|
|
107
|
+
if (!WithheldDiagnostics.applies(diagnostic) && line < sourceLines.length) {
|
|
107
108
|
const sourceLine = sourceLines[line];
|
|
108
109
|
const lineNumber = (line + 1).toString().padStart(5, " ");
|
|
109
110
|
|
|
@@ -139,10 +140,10 @@ export class TypeChecker {
|
|
|
139
140
|
const details = diagnostics.map((diagnostic) => {
|
|
140
141
|
if (diagnostic.file && diagnostic.start !== undefined) {
|
|
141
142
|
const { line, character } = diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start);
|
|
142
|
-
const message =
|
|
143
|
+
const message = WithheldDiagnostics.message(diagnostic);
|
|
143
144
|
|
|
144
145
|
const lines = sourceFile.text.split("\n");
|
|
145
|
-
const codeSnippet = line < lines.length ? lines[line] : undefined;
|
|
146
|
+
const codeSnippet = line < lines.length && !WithheldDiagnostics.applies(diagnostic) ? lines[line] : undefined;
|
|
146
147
|
return { line: line + 1, column: character + 1, message, code: diagnostic.code, codeSnippet };
|
|
147
148
|
}
|
|
148
149
|
|
|
@@ -238,16 +239,17 @@ export class TypeChecker {
|
|
|
238
239
|
col: position ? position.character + 1 : 0,
|
|
239
240
|
code: `TS${diagnostic.code}`,
|
|
240
241
|
severity: diagnostic.category === ts.DiagnosticCategory.Error ? "error" : "warning",
|
|
241
|
-
message:
|
|
242
|
+
message: WithheldDiagnostics.message(diagnostic),
|
|
242
243
|
};
|
|
243
244
|
});
|
|
244
245
|
}
|
|
245
246
|
|
|
246
247
|
static formatDiagnosticMessages(diagnostics: ts.Diagnostic[]): string {
|
|
247
|
-
|
|
248
|
+
const host: ts.FormatDiagnosticsHost = {
|
|
248
249
|
getCanonicalFileName: (fileName) => fileName,
|
|
249
250
|
getCurrentDirectory: () => process.cwd(),
|
|
250
251
|
getNewLine: () => ts.sys.newLine,
|
|
251
|
-
}
|
|
252
|
+
};
|
|
253
|
+
return diagnostics.map((diagnostic) => WithheldDiagnostics.format(diagnostic, host)).join("");
|
|
252
254
|
}
|
|
253
255
|
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import * as path from "node:path";
|
|
2
|
+
import * as ts from "typescript";
|
|
3
|
+
import { WithheldEnvFile } from "../lint/withheldEnvFile";
|
|
4
|
+
|
|
5
|
+
//? A TypeScript message quotes the literal too: `Type '"abc"' is not assignable`.
|
|
6
|
+
export class WithheldDiagnostics {
|
|
7
|
+
static readonly note = WithheldEnvFile.note;
|
|
8
|
+
|
|
9
|
+
static isWithheld(fileName: string | undefined) {
|
|
10
|
+
return WithheldEnvFile.isEnvFile(fileName);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
static applies(diagnostic: ts.Diagnostic) {
|
|
14
|
+
return WithheldDiagnostics.isWithheld(diagnostic.file?.fileName);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
static message(diagnostic: ts.Diagnostic) {
|
|
18
|
+
return WithheldDiagnostics.applies(diagnostic)
|
|
19
|
+
? WithheldDiagnostics.note
|
|
20
|
+
: ts.flattenDiagnosticMessageText(diagnostic.messageText, "\n");
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
static format(diagnostic: ts.Diagnostic, host: ts.FormatDiagnosticsHost) {
|
|
24
|
+
const related = diagnostic.relatedInformation?.filter(
|
|
25
|
+
({ file }) => !WithheldDiagnostics.isWithheld(file?.fileName),
|
|
26
|
+
);
|
|
27
|
+
if (!WithheldDiagnostics.applies(diagnostic))
|
|
28
|
+
return ts.formatDiagnosticsWithColorAndContext(
|
|
29
|
+
[
|
|
30
|
+
related?.length === diagnostic.relatedInformation?.length
|
|
31
|
+
? diagnostic
|
|
32
|
+
: { ...diagnostic, relatedInformation: related },
|
|
33
|
+
],
|
|
34
|
+
host,
|
|
35
|
+
);
|
|
36
|
+
const { file, start } = diagnostic;
|
|
37
|
+
const at = file && start !== undefined ? file.getLineAndCharacterOfPosition(start) : { line: -1, character: -1 };
|
|
38
|
+
const name = path.relative(host.getCurrentDirectory(), file?.fileName ?? "");
|
|
39
|
+
return `${name}:${at.line + 1}:${at.character + 1} - error TS${diagnostic.code}: ${WithheldDiagnostics.note}${host.getNewLine()}`;
|
|
40
|
+
}
|
|
41
|
+
}
|