@bluestep-systems/b6p-core 0.9.0 → 1.1.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.
Files changed (142) hide show
  1. package/README.md +274 -24
  2. package/dist/B6PCore.d.ts +13 -0
  3. package/dist/B6PCore.js +61 -1
  4. package/dist/B6PCore.js.map +1 -1
  5. package/dist/B6PUri.d.ts +6 -8
  6. package/dist/B6PUri.js +6 -8
  7. package/dist/B6PUri.js.map +1 -1
  8. package/dist/Err.d.ts +434 -0
  9. package/dist/Err.js +582 -0
  10. package/dist/Err.js.map +1 -1
  11. package/dist/auth/BearerAuthProvider.d.ts +32 -0
  12. package/dist/auth/BearerAuthProvider.js +49 -0
  13. package/dist/auth/BearerAuthProvider.js.map +1 -1
  14. package/dist/cache/OrgCache.js.map +1 -1
  15. package/dist/cache/ScriptMetaDataStore.js.map +1 -1
  16. package/dist/constants/ApiEndpoints.d.ts +1 -0
  17. package/dist/constants/ApiEndpoints.js +1 -0
  18. package/dist/constants/ApiEndpoints.js.map +1 -1
  19. package/dist/constants/AuthTypes.js.map +1 -1
  20. package/dist/constants/BlueHQ.js.map +1 -1
  21. package/dist/constants/CryptoAlgorithms.js.map +1 -1
  22. package/dist/constants/ExtensionConfig.js.map +1 -1
  23. package/dist/constants/FileExtensions.js.map +1 -1
  24. package/dist/constants/FolderNames.js.map +1 -1
  25. package/dist/constants/Gateway.d.ts +71 -0
  26. package/dist/constants/Gateway.js +79 -0
  27. package/dist/constants/Gateway.js.map +1 -0
  28. package/dist/constants/GitHubUrls.js.map +1 -1
  29. package/dist/constants/Http.js.map +1 -1
  30. package/dist/constants/MimeTypes.js.map +1 -1
  31. package/dist/constants/Numerical.js.map +1 -1
  32. package/dist/constants/OutputChannels.js.map +1 -1
  33. package/dist/constants/SettingsKeys.d.ts +5 -0
  34. package/dist/constants/SettingsKeys.js +5 -0
  35. package/dist/constants/SettingsKeys.js.map +1 -1
  36. package/dist/constants/SpecialFiles.js.map +1 -1
  37. package/dist/constants/WebDAVElements.js.map +1 -1
  38. package/dist/constants/index.d.ts +1 -0
  39. package/dist/constants/index.js +3 -1
  40. package/dist/constants/index.js.map +1 -1
  41. package/dist/data/DownstairsPathParser.js.map +1 -1
  42. package/dist/data/GlobMatcher.js.map +1 -1
  43. package/dist/data/IdUtility.js.map +1 -1
  44. package/dist/data/OrgWorker.js.map +1 -1
  45. package/dist/data/ScriptKey.js.map +1 -1
  46. package/dist/data/ScriptUrlParser.js.map +1 -1
  47. package/dist/data/ServerVersion.d.ts +76 -0
  48. package/dist/data/ServerVersion.js +111 -0
  49. package/dist/data/ServerVersion.js.map +1 -0
  50. package/dist/data/index.d.ts +2 -0
  51. package/dist/data/index.js +7 -1
  52. package/dist/data/index.js.map +1 -1
  53. package/dist/gateway/GatewayClient.d.ts +147 -0
  54. package/dist/gateway/GatewayClient.js +395 -0
  55. package/dist/gateway/GatewayClient.js.map +1 -0
  56. package/dist/gateway/GatewayContext.d.ts +43 -0
  57. package/dist/gateway/GatewayContext.js +3 -0
  58. package/dist/gateway/GatewayContext.js.map +1 -0
  59. package/dist/gateway/GatewayGit.d.ts +291 -0
  60. package/dist/gateway/GatewayGit.js +731 -0
  61. package/dist/gateway/GatewayGit.js.map +1 -0
  62. package/dist/gateway/GatewayKb.d.ts +173 -0
  63. package/dist/gateway/GatewayKb.js +354 -0
  64. package/dist/gateway/GatewayKb.js.map +1 -0
  65. package/dist/gateway/GatewayMarketplace.d.ts +116 -0
  66. package/dist/gateway/GatewayMarketplace.js +278 -0
  67. package/dist/gateway/GatewayMarketplace.js.map +1 -0
  68. package/dist/gateway/GatewayService.d.ts +47 -0
  69. package/dist/gateway/GatewayService.js +54 -0
  70. package/dist/gateway/GatewayService.js.map +1 -0
  71. package/dist/gateway/GatewayToken.d.ts +18 -0
  72. package/dist/gateway/GatewayToken.js +43 -0
  73. package/dist/gateway/GatewayToken.js.map +1 -0
  74. package/dist/gateway/GatewayTokenService.d.ts +101 -0
  75. package/dist/gateway/GatewayTokenService.js +465 -0
  76. package/dist/gateway/GatewayTokenService.js.map +1 -0
  77. package/dist/index.d.ts +27 -9
  78. package/dist/index.js +36 -7
  79. package/dist/index.js.map +1 -1
  80. package/dist/network/HttpClient.js.map +1 -1
  81. package/dist/network/HttpClientProvider.js.map +1 -1
  82. package/dist/network/StatusCodes.js.map +1 -1
  83. package/dist/persistence/PersistablePseudoMap.js.map +1 -1
  84. package/dist/persistence/PersistenceKeys.js.map +1 -1
  85. package/dist/persistence/PrivatePersistanceMap.js.map +1 -1
  86. package/dist/persistence/PseudoMap.js.map +1 -1
  87. package/dist/persistence/PublicPersistanceMap.js.map +1 -1
  88. package/dist/persistence/Serializable.js.map +1 -1
  89. package/dist/persistence/SharedFilePersistence.d.ts +22 -0
  90. package/dist/persistence/SharedFilePersistence.js +65 -14
  91. package/dist/persistence/SharedFilePersistence.js.map +1 -1
  92. package/dist/persistence/TypedMap.js.map +1 -1
  93. package/dist/persistence/TypedPersistable.js.map +1 -1
  94. package/dist/persistence/TypedPrivatePersistable.js.map +1 -1
  95. package/dist/persistence/dirLockdown.js.map +1 -1
  96. package/dist/providers.d.ts +36 -19
  97. package/dist/schema/SchemaContext.d.ts +10 -0
  98. package/dist/schema/SchemaContext.js +3 -0
  99. package/dist/schema/SchemaContext.js.map +1 -0
  100. package/dist/schema/SchemaService.d.ts +99 -0
  101. package/dist/schema/SchemaService.js +225 -0
  102. package/dist/schema/SchemaService.js.map +1 -0
  103. package/dist/script/GitIdentity.js.map +1 -1
  104. package/dist/script/GitSync.d.ts +78 -11
  105. package/dist/script/GitSync.js +84 -17
  106. package/dist/script/GitSync.js.map +1 -1
  107. package/dist/script/ScriptContext.d.ts +1 -8
  108. package/dist/script/ScriptFactory.d.ts +1 -2
  109. package/dist/script/ScriptFactory.js +1 -2
  110. package/dist/script/ScriptFactory.js.map +1 -1
  111. package/dist/script/ScriptFile.js.map +1 -1
  112. package/dist/script/ScriptFolder.js.map +1 -1
  113. package/dist/script/ScriptNode.js.map +1 -1
  114. package/dist/script/ScriptRoot.d.ts +0 -63
  115. package/dist/script/ScriptRoot.js +0 -178
  116. package/dist/script/ScriptRoot.js.map +1 -1
  117. package/dist/script/ScriptService.d.ts +45 -11
  118. package/dist/script/ScriptService.js +44 -6
  119. package/dist/script/ScriptService.js.map +1 -1
  120. package/dist/script/ServerCompile.d.ts +35 -0
  121. package/dist/script/ServerCompile.js +40 -0
  122. package/dist/script/ServerCompile.js.map +1 -0
  123. package/dist/script/TsConfig.d.ts +2 -2
  124. package/dist/script/TsConfig.js +3 -3
  125. package/dist/script/TsConfig.js.map +1 -1
  126. package/dist/script/push.d.ts +117 -77
  127. package/dist/script/push.js +151 -170
  128. package/dist/script/push.js.map +1 -1
  129. package/dist/session/SessionManager.js.map +1 -1
  130. package/dist/testing/FakeGateway.d.ts +280 -0
  131. package/dist/testing/FakeGateway.js +627 -0
  132. package/dist/testing/FakeGateway.js.map +1 -0
  133. package/dist/testing/MockFileSystem.js.map +1 -1
  134. package/dist/types.d.ts +534 -0
  135. package/dist/update/UpdateService.js.map +1 -1
  136. package/package.json +8 -7
  137. package/dist/script/ScriptTranspiler.d.ts +0 -183
  138. package/dist/script/ScriptTranspiler.js +0 -425
  139. package/dist/script/ScriptTranspiler.js.map +0 -1
  140. package/dist/script/TsLibResolver.d.ts +0 -60
  141. package/dist/script/TsLibResolver.js +0 -134
  142. package/dist/script/TsLibResolver.js.map +0 -1
@@ -1,183 +0,0 @@
1
- import type { ScriptNode } from "./ScriptNode";
2
- import type { ScriptRoot } from "./ScriptRoot";
3
- import type { ScriptContext } from "./ScriptContext";
4
- /**
5
- * Outcome of a {@link ScriptTranspiler.transpile} run. `emittedFiles` spans
6
- * every tsconfig project it compiled; the diagnostic fields do NOT (see below).
7
- *
8
- * `diagnosticCount` counts only the diagnostics from the platform-compiled
9
- * draft-root project (`scripts/*.ts`) — the code whose type-check gates the
10
- * push; `0` means that code type-checked cleanly. It is **`null`** when the
11
- * draft-root project was not among the compiled projects (a component whose TS
12
- * all lives under nested client bundles), i.e. no platform-code type-check ran
13
- * — distinct from `0`, so a machine consumer never reads "not checked" as
14
- * "checked clean". Client-bundle diagnostics (nested tsconfigs, e.g. a
15
- * MergeReport `static/`) are logged advisory and deliberately excluded, since
16
- * they legitimately reference browser-only globals the component declares
17
- * nowhere. `diagnosticText` is the formatted list of the same counted
18
- * diagnostics. Emit is never blocked by diagnostics (the platform runs the
19
- * emitted JS regardless), so callers use the count to report loudly rather than
20
- * to abort; a true emit failure throws instead of returning.
21
- * @lastreviewed null
22
- */
23
- /**
24
- * One TypeScript diagnostic, located.
25
- * @lastreviewed null
26
- */
27
- export interface TypeCheckError {
28
- file: string;
29
- line: number;
30
- column: number;
31
- code: number;
32
- message: string;
33
- }
34
- export interface TranspileOutcome {
35
- emittedFiles: string[];
36
- diagnosticCount: number | null;
37
- diagnosticText: string;
38
- /**
39
- * Whether the build is fully clean (build manifest spec §6): every project wrote its output and none reported an
40
- * error diagnostic. Only then may a build manifest be written. `uncleanReasons` says why when it is false.
41
- * @lastreviewed null
42
- */
43
- fullyClean: boolean;
44
- uncleanReasons: string[];
45
- /**
46
- * The diagnostics counted in `diagnosticCount`, one entry each: those of the draft-root project located in the
47
- * script's own sources (a diagnostic in any `.d.ts` is ignored entirely). `file` is relative to the draft folder,
48
- * `/`-separated, empty for a diagnostic with no file; `line` and `column` count from 1 (0 with no file).
49
- * @lastreviewed null
50
- */
51
- typeCheckErrors: TypeCheckError[];
52
- }
53
- /**
54
- * What one compiled project reported, as far as build cleanliness goes.
55
- * @lastreviewed null
56
- */
57
- export interface ProjectBuildReport {
58
- tsConfigPath: string;
59
- /**
60
- * Diagnostics of the error category, of any kind (a type error counts although `noEmitOnError` is off).
61
- * @lastreviewed null
62
- */
63
- errorCount: number;
64
- /**
65
- * Problems with the tsconfig itself (unknown options, file-list errors); the always-empty "no inputs" one is not counted.
66
- * @lastreviewed null
67
- */
68
- configErrorCount: number;
69
- emittedFiles: string[];
70
- /**
71
- * The project sets `noEmit`.
72
- * @lastreviewed null
73
- */
74
- noEmit: boolean;
75
- /**
76
- * The emit was skipped or withheld.
77
- * @lastreviewed null
78
- */
79
- emitSkipped: boolean;
80
- }
81
- /**
82
- * Why a build is not fully clean (build manifest spec §6), empty when it is: a project reported an error diagnostic,
83
- * has a tsconfig with configuration diagnostics, sets `noEmit`, had its emit skipped or withheld, emitted nothing, or
84
- * wrote output outside the tree.
85
- * @param draftRoot The draft folder every output must be under; when absent that check is skipped
86
- * @lastreviewed null
87
- */
88
- export declare function buildUncleanReasons(reports: readonly ProjectBuildReport[], draftRoot?: string): string[];
89
- /**
90
- * Compiler for TypeScript files in script projects.
91
- * Manages compilation of multiple TypeScript files organized by their tsconfig.json files.
92
- * @lastreviewed 2025-10-01
93
- */
94
- export declare class ScriptTranspiler {
95
- private readonly ctx;
96
- private projects;
97
- private static DEFAULT_TS_CONFIG;
98
- constructor(ctx: ScriptContext);
99
- private getDefaultOptions;
100
- private getProjectConfig;
101
- /**
102
- * Resolve the ambient declaration files (`*.d.ts`) a tsconfig pulls in via its
103
- * `include`/`files`. These carry the platform globals — `B`, `console`, the
104
- * generated `MEFR_*`/`Record_*` types, the `Bluestep` namespace, imported
105
- * query globals — declared in the component's sibling `declarations/` tree
106
- * (a real draft tsconfig's `include` starts with `../declarations/index.d.ts`).
107
- *
108
- * The transpile builds its own root-file list by walking the `draft/` folder
109
- * and parses the tsconfig with `readDirectory: () => []`, so the tsconfig's
110
- * `include` — which points OUTSIDE `draft/` — is otherwise dropped. That left
111
- * every platform global an unresolved "Cannot find name" and reduced the only
112
- * pre-publish type-check to a syntax check, so a push shipped un-type-checked
113
- * JavaScript while reporting success (ClickUp 86bbeb659). Ambient `.d.ts`
114
- * emit no JavaScript, so adding them to the program's root files fixes the
115
- * type-check without changing the emitted-file set — the same effect as a
116
- * hand-written `/// <reference path="../../declarations/index.d.ts" />`.
117
- *
118
- * Resolution uses the real `ts.sys` (not the stubbed `readDirectory`) so
119
- * globbed includes resolve, then keeps only existing `.d.ts` so a stale
120
- * include entry cannot itself introduce a "file not found" diagnostic.
121
- * @lastreviewed null
122
- */
123
- static resolveDeclarationRootFiles(tsConfigPath: string, configJson: object): string[];
124
- /**
125
- * Whether a path is an ambient declaration file — matched broadly enough
126
- * (`.d.ts`, `.d.mts`, `.d.cts`) that a future switch to a module-flavored
127
- * declaration name cannot silently drop the platform globals and regress the
128
- * type-check back to syntax-only.
129
- * @lastreviewed null
130
- */
131
- private static isDeclarationFile;
132
- /**
133
- * Force the invariants this transpile step depends on onto a set of parsed
134
- * compiler options, regardless of what the project's tsconfig.json specified.
135
- *
136
- * - `listEmittedFiles`: we return the emitted paths to the caller.
137
- * - `skipLibCheck`: this step is a transpile/emit gate, not a full lib audit.
138
- * Without it, a legitimate project `lib: ["dom", "WebWorker"]` (e.g. a
139
- * MergeReport `static/` client bundle) produces 30+ lib-vs-lib conflicts
140
- * (`ImportExportKind`, duplicate index signatures, `location` mismatch, ...)
141
- * that have nothing to do with the project's own code.
142
- * - `noEmitOnError`: emit must succeed even when type diagnostics exist —
143
- * the platform never type-checks (it runs the emitted JS on GraalVM) and a
144
- * component's local declarations may be incomplete, so a diagnostic must not
145
- * block the emit a push depends on. This is NOT the same as swallowing the
146
- * diagnostics: `transpile` returns their count so the push surfaces them
147
- * loudly instead of reporting a clean success (ClickUp 86bbeb659).
148
- * @lastreviewed null
149
- */
150
- private static applyTranspileInvariants;
151
- addFile(sn: ScriptNode): Promise<void>;
152
- transpile(sharedRoot?: ScriptRoot): Promise<TranspileOutcome>;
153
- /**
154
- * Build the `ts.Program` for one tsconfig project and emit it, returning the
155
- * emitted files and the combined pre-emit + emit diagnostics.
156
- *
157
- * The declaration files come FIRST so the type-check resolves platform
158
- * globals; ambient `.d.ts` emit nothing, so adding them changes only what is
159
- * type-checked, not the emitted-file set (the invariant the regression test
160
- * pins). The `Set` dedupes only exact string matches — declaration paths come
161
- * from `ts.sys` (forward slashes) and `sfPaths` from `B6PUri` (native
162
- * separators), so on Windows a `.d.ts` also under the draft tree may appear
163
- * twice; harmless (TypeScript canonicalizes internally, and a `.d.ts` still
164
- * emits nothing), just not deduped here.
165
- * @lastreviewed null
166
- */
167
- private compileProject;
168
- /**
169
- * Create a `ts.Program` with a `CompilerHost` whose default-library resolution
170
- * does NOT depend on `__filename`.
171
- *
172
- * b6p-core is bundled into the consumer's single-file CLI / SEA binary, so
173
- * TypeScript's default `getDefaultLibLocation()` (= `dirname(__filename)`)
174
- * points at the bundle directory, where no `lib.*.d.ts` exist. We resolve the
175
- * lib directory via {@link TsLibResolver} and override the two host methods
176
- * that steer lib lookup. If no lib directory can be found we fall back to the
177
- * default host behavior rather than pointing it at a bogus path.
178
- * @lastreviewed null
179
- */
180
- private createProgram;
181
- private locate;
182
- private formatDiagnostics;
183
- }
@@ -1,425 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || (function () {
19
- var ownKeys = function(o) {
20
- ownKeys = Object.getOwnPropertyNames || function (o) {
21
- var ar = [];
22
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
- return ar;
24
- };
25
- return ownKeys(o);
26
- };
27
- return function (mod) {
28
- if (mod && mod.__esModule) return mod;
29
- var result = {};
30
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
- __setModuleDefault(result, mod);
32
- return result;
33
- };
34
- })();
35
- var __importDefault = (this && this.__importDefault) || function (mod) {
36
- return (mod && mod.__esModule) ? mod : { "default": mod };
37
- };
38
- Object.defineProperty(exports, "__esModule", { value: true });
39
- exports.ScriptTranspiler = void 0;
40
- exports.buildUncleanReasons = buildUncleanReasons;
41
- const typescript_1 = __importDefault(require("typescript"));
42
- const path = __importStar(require("path"));
43
- const Err_1 = require("../Err");
44
- const constants_1 = require("../constants");
45
- const B6PUri_1 = require("../B6PUri");
46
- const ScriptFactory_1 = require("./ScriptFactory");
47
- const TsLibResolver_1 = require("./TsLibResolver");
48
- /**
49
- * Why a build is not fully clean (build manifest spec §6), empty when it is: a project reported an error diagnostic,
50
- * has a tsconfig with configuration diagnostics, sets `noEmit`, had its emit skipped or withheld, emitted nothing, or
51
- * wrote output outside the tree.
52
- * @param draftRoot The draft folder every output must be under; when absent that check is skipped
53
- * @lastreviewed null
54
- */
55
- function buildUncleanReasons(reports, draftRoot) {
56
- const reasons = [];
57
- for (const r of reports) {
58
- if (r.errorCount > 0) {
59
- reasons.push(`${r.tsConfigPath}: ${r.errorCount} syntax or emit error(s)`);
60
- }
61
- if (r.configErrorCount > 0) {
62
- reasons.push(`${r.tsConfigPath}: the tsconfig has ${r.configErrorCount} configuration diagnostic(s)`);
63
- }
64
- if (r.noEmit) {
65
- reasons.push(`${r.tsConfigPath}: sets noEmit`);
66
- }
67
- if (r.emitSkipped) {
68
- reasons.push(`${r.tsConfigPath}: its emit was skipped or withheld`);
69
- }
70
- if (!r.emitSkipped && !r.noEmit && r.emittedFiles.length === 0) {
71
- reasons.push(`${r.tsConfigPath}: emitted nothing`);
72
- }
73
- if (draftRoot !== undefined) {
74
- const root = path.resolve(draftRoot);
75
- const outside = r.emittedFiles.filter((f) => {
76
- const relative = path.relative(root, path.resolve(f));
77
- return relative.startsWith("..") || path.isAbsolute(relative);
78
- });
79
- if (outside.length > 0) {
80
- reasons.push(`${r.tsConfigPath}: wrote ${outside.length} output file(s) outside the draft folder`);
81
- }
82
- }
83
- }
84
- return reasons;
85
- }
86
- /**
87
- * Compiler for TypeScript files in script projects.
88
- * Manages compilation of multiple TypeScript files organized by their tsconfig.json files.
89
- * @lastreviewed 2025-10-01
90
- */
91
- class ScriptTranspiler {
92
- ctx;
93
- projects = new Map();
94
- static DEFAULT_TS_CONFIG = {
95
- module: typescript_1.default.ModuleKind.ESNext,
96
- target: typescript_1.default.ScriptTarget.ES2022,
97
- outDir: constants_1.FolderNames.DOT_BUILD,
98
- strict: true,
99
- esModuleInterop: true,
100
- skipLibCheck: true,
101
- forceConsistentCasingInFileNames: true,
102
- sourceMap: false,
103
- inlineSourceMap: false,
104
- allowJs: false,
105
- noEmitOnError: false,
106
- suppressOutputPathCheck: true,
107
- declarationDir: undefined,
108
- declaration: false,
109
- listEmittedFiles: true,
110
- };
111
- constructor(ctx) {
112
- this.ctx = ctx;
113
- }
114
- getDefaultOptions(sf) {
115
- throw new Err_1.Err.InvalidStateError("did not find a tsconfig for " + sf.path() + ".");
116
- const LOCAL_CONFIG = ScriptTranspiler.DEFAULT_TS_CONFIG;
117
- LOCAL_CONFIG.rootDir = sf.getScriptRoot().getDraftFolder().path();
118
- return LOCAL_CONFIG;
119
- }
120
- async getProjectConfig(sn) {
121
- const tsConfigFile = await sn.getClosestTsConfigFile();
122
- if (!tsConfigFile) {
123
- this.ctx.logger.info("No tsconfig.json found, using default compiler options.");
124
- return { options: this.getDefaultOptions(sn), declarationRootFiles: [], configErrorCount: 0 };
125
- }
126
- const tsconfigTextArray = await this.ctx.fs.readFile(B6PUri_1.B6PUri.fromFsPath(tsConfigFile.uri().fsPath));
127
- const pseudoParsedConfig = typescript_1.default.parseConfigFileTextToJson(tsConfigFile.path(), Buffer.from(tsconfigTextArray).toString("utf-8"));
128
- if (pseudoParsedConfig.error) {
129
- const message = typescript_1.default.flattenDiagnosticMessageText(pseudoParsedConfig.error.messageText, "\n");
130
- throw new Err_1.Err.CompilationError(`Error parsing tsconfig.json at ${tsConfigFile.path()}: ${message}`);
131
- }
132
- pseudoParsedConfig.config.compilerOptions = pseudoParsedConfig.config.compilerOptions ?? {};
133
- pseudoParsedConfig.config.compilerOptions.rootDir = tsConfigFile.folder().path();
134
- // Resolve the ambient declaration files the tsconfig's include/files pull in
135
- // BEFORE the options-only parse below stubs out readDirectory. Without this
136
- // the transpile can't see the platform globals and the type-check is a
137
- // syntax check only (see resolveDeclarationRootFiles).
138
- const declarationRootFiles = ScriptTranspiler.resolveDeclarationRootFiles(tsConfigFile.path(), pseudoParsedConfig.config);
139
- if (declarationRootFiles.length > 0) {
140
- this.ctx.logger.info(`Including ${declarationRootFiles.length} declaration file(s) in the type-check:\n` +
141
- declarationRootFiles.join("\n"));
142
- }
143
- // The "no declarations resolved" case is NOT warned here: a client-bundle
144
- // tsconfig (e.g. a MergeReport `static/`) legitimately pulls in none, so a
145
- // per-project warning would fire on every such push. transpile() warns only
146
- // for the gated draft-root project, where empty declarations really do mean
147
- // an ineffective type-check.
148
- const parsedConfig = typescript_1.default.parseJsonConfigFileContent(pseudoParsedConfig.config, {
149
- ...typescript_1.default.sys,
150
- readDirectory: () => [],
151
- }, tsConfigFile.folder().path(), undefined, tsConfigFile.path());
152
- this.ctx.logger.info("Using tsconfig.json compiler options from:", tsConfigFile.path());
153
- // TS18003 (no inputs) always appears here: the file list is supplied separately, the directory read is stubbed.
154
- const configErrorCount = parsedConfig.errors.filter((e) => e.code !== 18003).length;
155
- return {
156
- options: ScriptTranspiler.applyTranspileInvariants(parsedConfig.options),
157
- declarationRootFiles,
158
- configErrorCount,
159
- };
160
- }
161
- /**
162
- * Resolve the ambient declaration files (`*.d.ts`) a tsconfig pulls in via its
163
- * `include`/`files`. These carry the platform globals — `B`, `console`, the
164
- * generated `MEFR_*`/`Record_*` types, the `Bluestep` namespace, imported
165
- * query globals — declared in the component's sibling `declarations/` tree
166
- * (a real draft tsconfig's `include` starts with `../declarations/index.d.ts`).
167
- *
168
- * The transpile builds its own root-file list by walking the `draft/` folder
169
- * and parses the tsconfig with `readDirectory: () => []`, so the tsconfig's
170
- * `include` — which points OUTSIDE `draft/` — is otherwise dropped. That left
171
- * every platform global an unresolved "Cannot find name" and reduced the only
172
- * pre-publish type-check to a syntax check, so a push shipped un-type-checked
173
- * JavaScript while reporting success (ClickUp 86bbeb659). Ambient `.d.ts`
174
- * emit no JavaScript, so adding them to the program's root files fixes the
175
- * type-check without changing the emitted-file set — the same effect as a
176
- * hand-written `/// <reference path="../../declarations/index.d.ts" />`.
177
- *
178
- * Resolution uses the real `ts.sys` (not the stubbed `readDirectory`) so
179
- * globbed includes resolve, then keeps only existing `.d.ts` so a stale
180
- * include entry cannot itself introduce a "file not found" diagnostic.
181
- * @lastreviewed null
182
- */
183
- static resolveDeclarationRootFiles(tsConfigPath, configJson) {
184
- const parsed = typescript_1.default.parseJsonConfigFileContent(configJson, typescript_1.default.sys, path.dirname(tsConfigPath), undefined, tsConfigPath);
185
- return parsed.fileNames.filter((f) => ScriptTranspiler.isDeclarationFile(f) && typescript_1.default.sys.fileExists(f));
186
- }
187
- /**
188
- * Whether a path is an ambient declaration file — matched broadly enough
189
- * (`.d.ts`, `.d.mts`, `.d.cts`) that a future switch to a module-flavored
190
- * declaration name cannot silently drop the platform globals and regress the
191
- * type-check back to syntax-only.
192
- * @lastreviewed null
193
- */
194
- static isDeclarationFile(fsPath) {
195
- return /\.d\.(ts|mts|cts)$/i.test(fsPath);
196
- }
197
- /**
198
- * Force the invariants this transpile step depends on onto a set of parsed
199
- * compiler options, regardless of what the project's tsconfig.json specified.
200
- *
201
- * - `listEmittedFiles`: we return the emitted paths to the caller.
202
- * - `skipLibCheck`: this step is a transpile/emit gate, not a full lib audit.
203
- * Without it, a legitimate project `lib: ["dom", "WebWorker"]` (e.g. a
204
- * MergeReport `static/` client bundle) produces 30+ lib-vs-lib conflicts
205
- * (`ImportExportKind`, duplicate index signatures, `location` mismatch, ...)
206
- * that have nothing to do with the project's own code.
207
- * - `noEmitOnError`: emit must succeed even when type diagnostics exist —
208
- * the platform never type-checks (it runs the emitted JS on GraalVM) and a
209
- * component's local declarations may be incomplete, so a diagnostic must not
210
- * block the emit a push depends on. This is NOT the same as swallowing the
211
- * diagnostics: `transpile` returns their count so the push surfaces them
212
- * loudly instead of reporting a clean success (ClickUp 86bbeb659).
213
- * @lastreviewed null
214
- */
215
- static applyTranspileInvariants(options) {
216
- options.listEmittedFiles = true;
217
- options.skipLibCheck = true;
218
- options.noEmitOnError = false;
219
- return options;
220
- }
221
- async addFile(sn) {
222
- if (await sn.isFolder()) {
223
- this.ctx.logger.warn("Ignoring folder node in ScriptCompiler.addFile:", sn.path());
224
- return void 0;
225
- }
226
- if (!(await sn.isCopacetic())) {
227
- throw new Err_1.Err.ScriptNotCopaceticError();
228
- }
229
- const newTsConfigFile = await sn.getClosestTsConfigFile();
230
- const vals = this.projects.get(newTsConfigFile.path()) || [];
231
- if (!vals.some((existingSn) => existingSn.path() === sn.path())) {
232
- vals.push(sn);
233
- }
234
- else {
235
- this.ctx.logger.warn("Ignoring duplicate file in ScriptCompiler.addFile:", sn.path());
236
- }
237
- this.projects.set(newTsConfigFile.path(), vals);
238
- }
239
- async transpile(sharedRoot) {
240
- const f = sharedRoot ? sharedRoot.factory : new ScriptFactory_1.ScriptFactory(this.ctx);
241
- // The draft-root tsconfig governs the platform-compiled scripts (`scripts/*.ts`)
242
- // — the ONLY code whose type-check gates the push. Nested tsconfigs are
243
- // client bundles (e.g. a MergeReport `static/`) whose diagnostics stay
244
- // advisory: they legitimately reference browser-only third-party globals the
245
- // component declares nowhere, so gating on them would fail a push over benign
246
- // noise (see the b6p-push skill's third-party-lib-type-noise gotcha). When no
247
- // root is supplied we can't tell them apart, so we gate on everything.
248
- const draftRootTsConfigPath = sharedRoot ? sharedRoot.getDraftTsConfigPath() : null;
249
- const reports = [];
250
- const emittedFiles = [];
251
- const gatedDiagnostics = [];
252
- // Whether the gated (draft-root) project was actually among the compiled
253
- // projects. If a component's TS all lives under nested client bundles and
254
- // nothing is governed by the draft-root tsconfig, no platform-code
255
- // type-check ran — and `diagnosticCount: 0` would falsely read as "checked
256
- // clean". We return `null` in that case instead (ClickUp 86bbeb659 review).
257
- let gatedProjectCompiled = false;
258
- for (const [tsConfigPath, sfList] of this.projects.entries()) {
259
- if (sfList.length === 0) {
260
- throw new Err_1.Err.NoFilesToCompileError(tsConfigPath);
261
- }
262
- const sf = f.createFile(B6PUri_1.B6PUri.fromFsPath(tsConfigPath), sharedRoot);
263
- const { options: compilerOptions, declarationRootFiles, configErrorCount } = await this.getProjectConfig(sf);
264
- const sfPaths = sfList.map((sf) => sf.uri().fsPath);
265
- const isGated = draftRootTsConfigPath === null || path.normalize(tsConfigPath) === draftRootTsConfigPath;
266
- if (isGated) {
267
- gatedProjectCompiled = true;
268
- // Only the gated draft-root project needs declarations to type-check
269
- // meaningfully; an empty set here means the check is effectively a
270
- // syntax pass, which is exactly the regression this guards against.
271
- if (declarationRootFiles.length === 0) {
272
- this.ctx.logger.warn(`No declaration files resolved from ${tsConfigPath} (include/files) — ` +
273
- `platform globals may be unresolved and the type-check ineffective.`);
274
- }
275
- }
276
- const compiled = this.compileProject(tsConfigPath, sfPaths, declarationRootFiles, compilerOptions);
277
- const { emittedFiles: projectEmitted, emitSkipped } = compiled;
278
- // A diagnostic located in a declaration file is not the script's: the server's generated typings are outside its
279
- // control, so they are ignored entirely.
280
- const ownSources = (list) => list.filter((d) => !(d.file && ScriptTranspiler.isDeclarationFile(d.file.fileName)));
281
- const allDiagnostics = ownSources(compiled.diagnostics);
282
- const blockingErrors = ownSources(compiled.blockingDiagnostics).filter((d) => d.category === typescript_1.default.DiagnosticCategory.Error);
283
- emittedFiles.push(...projectEmitted);
284
- reports.push({
285
- tsConfigPath,
286
- errorCount: blockingErrors.length,
287
- configErrorCount,
288
- emittedFiles: projectEmitted,
289
- noEmit: compilerOptions.noEmit === true,
290
- emitSkipped,
291
- });
292
- // Contract: this step is an emit gate, not a hard type-audit gate. A
293
- // genuine emit failure is FATAL — we throw so callers
294
- // (ScriptRoot.compileDraftFolder → executePush) abort instead of pushing
295
- // missing JavaScript. Type diagnostics do NOT block emit (the platform
296
- // never type-checks — it runs the emitted JS on GraalVM, and local
297
- // declarations may be incomplete). For the platform-compiled draft-root
298
- // project they are NO LONGER silently advisory: the count is returned so
299
- // the push reports loudly instead of claiming a clean success (ClickUp
300
- // 86bbeb659). Client-bundle diagnostics stay advisory (logged, not gated).
301
- if (emitSkipped) {
302
- throw new Err_1.Err.CompilationError(`TypeScript emit was skipped for ${tsConfigPath}; no JavaScript was produced.` +
303
- (allDiagnostics.length > 0 ? "\n" + this.formatDiagnostics(allDiagnostics) : ""));
304
- }
305
- else if (allDiagnostics.length > 0) {
306
- if (isGated) {
307
- gatedDiagnostics.push(...allDiagnostics);
308
- this.ctx.logger.warn(`TypeScript reported ${allDiagnostics.length} diagnostic(s) for ${tsConfigPath}:\n` +
309
- this.formatDiagnostics(allDiagnostics));
310
- }
311
- else {
312
- this.ctx.logger.warn(`TypeScript reported ${allDiagnostics.length} advisory diagnostic(s) for client bundle ` +
313
- `${tsConfigPath} (not gated — client-side globals may be intentionally undeclared):\n` +
314
- this.formatDiagnostics(allDiagnostics));
315
- }
316
- }
317
- else {
318
- this.ctx.logger.info(`TypeScript type-checked ${tsConfigPath} cleanly.`);
319
- }
320
- }
321
- const uncleanReasons = buildUncleanReasons(reports, sharedRoot?.getDraftFolder().path());
322
- return {
323
- emittedFiles,
324
- diagnosticCount: gatedProjectCompiled ? gatedDiagnostics.length : null,
325
- diagnosticText: this.formatDiagnostics(gatedDiagnostics),
326
- fullyClean: uncleanReasons.length === 0,
327
- uncleanReasons,
328
- typeCheckErrors: gatedDiagnostics.map((d) => this.locate(d, sharedRoot?.getDraftFolder().path())),
329
- };
330
- }
331
- /**
332
- * Build the `ts.Program` for one tsconfig project and emit it, returning the
333
- * emitted files and the combined pre-emit + emit diagnostics.
334
- *
335
- * The declaration files come FIRST so the type-check resolves platform
336
- * globals; ambient `.d.ts` emit nothing, so adding them changes only what is
337
- * type-checked, not the emitted-file set (the invariant the regression test
338
- * pins). The `Set` dedupes only exact string matches — declaration paths come
339
- * from `ts.sys` (forward slashes) and `sfPaths` from `B6PUri` (native
340
- * separators), so on Windows a `.d.ts` also under the draft tree may appear
341
- * twice; harmless (TypeScript canonicalizes internally, and a `.d.ts` still
342
- * emits nothing), just not deduped here.
343
- * @lastreviewed null
344
- */
345
- compileProject(tsConfigPath, sfPaths, declarationRootFiles, options) {
346
- const rootFiles = Array.from(new Set([...declarationRootFiles, ...sfPaths]));
347
- const program = this.createProgram(rootFiles, options, tsConfigPath);
348
- const emitResult = program.emit();
349
- const diagnostics = typescript_1.default.getPreEmitDiagnostics(program).concat(emitResult.diagnostics);
350
- // What makes a build unclean is told apart from the type warnings: syntax errors, emit errors, and global or option
351
- // errors. Semantic (type) errors are warnings.
352
- const blockingDiagnostics = [
353
- ...program.getSyntacticDiagnostics(),
354
- ...program.getOptionsDiagnostics(),
355
- ...program.getGlobalDiagnostics(),
356
- ...emitResult.diagnostics,
357
- ];
358
- return {
359
- emittedFiles: emitResult.emittedFiles ?? [],
360
- diagnostics,
361
- blockingDiagnostics,
362
- emitSkipped: emitResult.emitSkipped,
363
- };
364
- }
365
- /**
366
- * Create a `ts.Program` with a `CompilerHost` whose default-library resolution
367
- * does NOT depend on `__filename`.
368
- *
369
- * b6p-core is bundled into the consumer's single-file CLI / SEA binary, so
370
- * TypeScript's default `getDefaultLibLocation()` (= `dirname(__filename)`)
371
- * points at the bundle directory, where no `lib.*.d.ts` exist. We resolve the
372
- * lib directory via {@link TsLibResolver} and override the two host methods
373
- * that steer lib lookup. If no lib directory can be found we fall back to the
374
- * default host behavior rather than pointing it at a bogus path.
375
- * @lastreviewed null
376
- */
377
- createProgram(fileNames, options, tsConfigPath) {
378
- const host = typescript_1.default.createCompilerHost(options);
379
- const libDir = TsLibResolver_1.TsLibResolver.resolveLibDir({
380
- explicitDirs: this.ctx.typescriptLibDirs,
381
- projectDirs: [path.dirname(tsConfigPath), process.cwd()],
382
- });
383
- if (libDir) {
384
- this.ctx.logger.info(`Resolved TypeScript lib directory: ${libDir}`);
385
- host.getDefaultLibLocation = () => libDir;
386
- host.getDefaultLibFileName = (o) => path.join(libDir, typescript_1.default.getDefaultLibFileName(o));
387
- }
388
- else {
389
- this.ctx.logger.warn("Could not resolve a TypeScript lib directory; falling back to default host resolution. " +
390
- "If this run is bundled (CLI/SEA), lib diagnostics are expected — supply providers.typescriptLibDirs.");
391
- }
392
- return typescript_1.default.createProgram(fileNames, options, host);
393
- }
394
- locate(diagnostic, draftRoot) {
395
- const message = typescript_1.default.flattenDiagnosticMessageText(diagnostic.messageText, "\n");
396
- if (!diagnostic.file || diagnostic.start === undefined) {
397
- return { file: "", line: 0, column: 0, code: diagnostic.code, message };
398
- }
399
- const { line, character } = diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start);
400
- const relative = draftRoot ? path.relative(draftRoot, diagnostic.file.fileName) : diagnostic.file.fileName;
401
- return {
402
- file: relative.split(path.sep).join("/"),
403
- line: line + 1,
404
- column: character + 1,
405
- code: diagnostic.code,
406
- message,
407
- };
408
- }
409
- formatDiagnostics(diagnostics) {
410
- return diagnostics
411
- .map((diagnostic) => {
412
- if (diagnostic.file) {
413
- const { line, character } = diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start);
414
- const message = typescript_1.default.flattenDiagnosticMessageText(diagnostic.messageText, "\n");
415
- return `${diagnostic.file.fileName} (${line + 1},${character + 1}): ${message}`;
416
- }
417
- else {
418
- return typescript_1.default.flattenDiagnosticMessageText(diagnostic.messageText, "\n");
419
- }
420
- })
421
- .join("\n");
422
- }
423
- }
424
- exports.ScriptTranspiler = ScriptTranspiler;
425
- //# sourceMappingURL=ScriptTranspiler.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ScriptTranspiler.js","sourceRoot":"","sources":["../../src/script/Script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