@playcraft/build 0.1.96-test-a → 0.1.98

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 (113) hide show
  1. package/dist/base-builder.js +2 -41
  2. package/dist/engines/engine-detector.js +0 -4
  3. package/dist/engines/generic-adapter.js +19 -14
  4. package/dist/index.d.ts +4 -19
  5. package/dist/index.js +2 -11
  6. package/dist/platforms/adikteev.js +0 -1
  7. package/dist/platforms/applovin.js +0 -1
  8. package/dist/platforms/base.js +2 -2
  9. package/dist/platforms/bigo.js +0 -1
  10. package/dist/platforms/facebook.js +0 -1
  11. package/dist/platforms/google.js +0 -1
  12. package/dist/platforms/inmobi.js +0 -1
  13. package/dist/platforms/ironsource.js +0 -1
  14. package/dist/platforms/liftoff.js +0 -1
  15. package/dist/platforms/mintegral.js +0 -1
  16. package/dist/platforms/moloco.js +0 -1
  17. package/dist/platforms/playcraft.js +0 -1
  18. package/dist/platforms/remerge.js +0 -1
  19. package/dist/platforms/snapchat.js +0 -1
  20. package/dist/platforms/tiktok.js +0 -1
  21. package/dist/platforms/unity.js +0 -1
  22. package/dist/types.d.ts +0 -5
  23. package/dist/validation/html-validator.d.ts +0 -5
  24. package/dist/validation/html-validator.js +17 -19
  25. package/dist/validation/index.d.ts +0 -4
  26. package/dist/validation/index.js +0 -4
  27. package/dist/validation/package-validator.d.ts +0 -2
  28. package/dist/validation/package-validator.js +64 -25
  29. package/dist/validation/profiles.d.ts +1 -13
  30. package/dist/validation/profiles.js +0 -27
  31. package/dist/validation/source-scanner.d.ts +0 -11
  32. package/dist/validation/source-scanner.js +2 -32
  33. package/dist/validation/types.d.ts +2 -178
  34. package/dist/validation/types.js +1 -1
  35. package/dist/validation/validation-runner.d.ts +2 -22
  36. package/dist/validation/validation-runner.js +3 -64
  37. package/dist/validation/zip-reader.d.ts +0 -7
  38. package/dist/validation/zip-reader.js +26 -159
  39. package/dist/vite/config-builder-generic.d.ts +1 -3
  40. package/dist/vite/config-builder-generic.js +7 -9
  41. package/dist/vite/config-builder.js +1 -1
  42. package/dist/vite/plugin-platform.js +54 -30
  43. package/dist/vite/plugin-source-builder.d.ts +14 -2
  44. package/dist/vite/plugin-source-builder.js +997 -61
  45. package/dist/vite-builder.d.ts +5 -4
  46. package/dist/vite-builder.js +34 -33
  47. package/package.json +4 -16
  48. package/dist/audio-source-files.d.ts +0 -5
  49. package/dist/audio-source-files.js +0 -135
  50. package/dist/delivery/agent-build-runner.d.ts +0 -44
  51. package/dist/delivery/agent-build-runner.js +0 -365
  52. package/dist/delivery/agent-build-source.d.ts +0 -8
  53. package/dist/delivery/agent-build-source.js +0 -25
  54. package/dist/delivery/artifact-descriptor.d.ts +0 -31
  55. package/dist/delivery/artifact-descriptor.js +0 -237
  56. package/dist/delivery/artifact-package.d.ts +0 -43
  57. package/dist/delivery/artifact-package.js +0 -283
  58. package/dist/delivery/build-plan.d.ts +0 -4
  59. package/dist/delivery/build-plan.js +0 -189
  60. package/dist/delivery/build-plan.types.d.ts +0 -51
  61. package/dist/delivery/build-plan.types.js +0 -1
  62. package/dist/delivery/command-isolation.d.ts +0 -21
  63. package/dist/delivery/command-isolation.js +0 -327
  64. package/dist/delivery/commands.d.ts +0 -5
  65. package/dist/delivery/commands.js +0 -146
  66. package/dist/delivery/files.d.ts +0 -9
  67. package/dist/delivery/files.js +0 -144
  68. package/dist/delivery/git-source-fingerprint.d.ts +0 -2
  69. package/dist/delivery/git-source-fingerprint.js +0 -58
  70. package/dist/delivery/isolated-source.d.ts +0 -5
  71. package/dist/delivery/isolated-source.js +0 -131
  72. package/dist/delivery/output-publication.d.ts +0 -21
  73. package/dist/delivery/output-publication.js +0 -444
  74. package/dist/delivery/project-delivery.d.ts +0 -6
  75. package/dist/delivery/project-delivery.js +0 -287
  76. package/dist/delivery/recipe-build-plan.d.ts +0 -4
  77. package/dist/delivery/recipe-build-plan.js +0 -53
  78. package/dist/delivery/recipe.d.ts +0 -20
  79. package/dist/delivery/recipe.js +0 -211
  80. package/dist/delivery/safe-path.d.ts +0 -2
  81. package/dist/delivery/safe-path.js +0 -18
  82. package/dist/delivery/types.d.ts +0 -76
  83. package/dist/delivery/types.js +0 -1
  84. package/dist/production-animation-presence.d.ts +0 -2
  85. package/dist/production-animation-presence.js +0 -146
  86. package/dist/production-inputs.d.ts +0 -30
  87. package/dist/production-inputs.js +0 -262
  88. package/dist/production-source-paths.d.ts +0 -5
  89. package/dist/production-source-paths.js +0 -27
  90. package/dist/validation/artifact-qa.d.ts +0 -36
  91. package/dist/validation/artifact-qa.js +0 -261
  92. package/dist/validation/artifact-rules.d.ts +0 -39
  93. package/dist/validation/artifact-rules.js +0 -451
  94. package/dist/validation/artifact.d.ts +0 -14
  95. package/dist/validation/artifact.js +0 -188
  96. package/dist/validation/runtime-load.d.ts +0 -94
  97. package/dist/validation/runtime-load.js +0 -653
  98. package/dist/vite/source-builder-asset-paths.d.ts +0 -25
  99. package/dist/vite/source-builder-asset-paths.js +0 -154
  100. package/dist/vite/source-builder-esm.d.ts +0 -7
  101. package/dist/vite/source-builder-esm.js +0 -877
  102. package/dist/vite/source-builder-types.d.ts +0 -14
  103. package/dist/vite/source-builder-types.js +0 -1
  104. package/dist/vite/workspace.d.ts +0 -6
  105. package/dist/vite/workspace.js +0 -41
  106. package/dist/workspace-css-imports.d.ts +0 -2
  107. package/dist/workspace-css-imports.js +0 -139
  108. package/dist/workspace-model-source.d.ts +0 -14
  109. package/dist/workspace-model-source.js +0 -184
  110. package/dist/workspace-public-imports.d.ts +0 -11
  111. package/dist/workspace-public-imports.js +0 -232
  112. package/dist/workspace-public-source.d.ts +0 -15
  113. package/dist/workspace-public-source.js +0 -564
@@ -1,17 +1,5 @@
1
- import type { OutputFormat, Platform } from '../types.js';
1
+ import type { Platform } from '../types.js';
2
2
  import type { ChannelRuleProfile, ValidationRule, ValidationStage } from './types.js';
3
3
  export declare const CHANNEL_RULE_PROFILES: Record<Platform, ChannelRuleProfile>;
4
4
  export declare function getChannelRuleProfile(channel: Platform): ChannelRuleProfile;
5
5
  export declare function getRulesForStage(channel: Platform, stage: ValidationStage): ValidationRule[];
6
- export declare const CHANNEL_RULES_VERSION = "channel-rules-v1";
7
- export type ChannelCapability = {
8
- channel: Platform;
9
- channelRulesVersion: typeof CHANNEL_RULES_VERSION;
10
- supportedFormats: OutputFormat[];
11
- packageStrategy: 'single-html' | 'normalized-zip' | 'format-dependent';
12
- rootEntryRequired: boolean;
13
- maxFiles?: number;
14
- maxArtifactBytes?: number;
15
- };
16
- /** Versioned delivery facts shared by Runner packaging and Business revalidation. */
17
- export declare function getChannelCapability(channel: Platform): ChannelCapability;
@@ -219,30 +219,3 @@ export function getChannelRuleProfile(channel) {
219
219
  export function getRulesForStage(channel, stage) {
220
220
  return getChannelRuleProfile(channel).rules.filter((rule) => rule.stage === stage);
221
221
  }
222
- export const CHANNEL_RULES_VERSION = 'channel-rules-v1';
223
- /** Versioned delivery facts shared by Runner packaging and Business revalidation. */
224
- export function getChannelCapability(channel) {
225
- const profile = getChannelRuleProfile(channel);
226
- const supportsZip = profile.deliveryMode === 'zip' ||
227
- profile.deliveryMode === 'html-backed-zip' ||
228
- profile.deliveryMode === 'mixed';
229
- const supportsHtml = profile.deliveryMode === 'single-html' || profile.deliveryMode === 'mixed';
230
- return {
231
- channel,
232
- channelRulesVersion: CHANNEL_RULES_VERSION,
233
- supportedFormats: [
234
- ...(supportsHtml ? ['html'] : []),
235
- ...(supportsZip ? ['zip'] : []),
236
- ],
237
- packageStrategy: profile.deliveryMode === 'mixed'
238
- ? 'format-dependent'
239
- : profile.deliveryMode === 'single-html'
240
- ? 'single-html'
241
- : 'normalized-zip',
242
- rootEntryRequired: supportsZip,
243
- ...(channel === 'google' ? { maxFiles: 512 } : {}),
244
- ...(profile.rules.some((rule) => rule.check?.kind === 'max-size')
245
- ? { maxArtifactBytes: FIVE_MB }
246
- : {}),
247
- };
248
- }
@@ -2,14 +2,3 @@ import type { Platform } from '../types.js';
2
2
  import type { ValidationContext, ValidationResult } from './types.js';
3
3
  export declare function scanSourceForCompliance(context: ValidationContext): Promise<ValidationResult[]>;
4
4
  export declare function scanSourceForChannels(context: Omit<ValidationContext, 'channel'>, channels: Platform[]): Promise<ValidationResult[]>;
5
- export type SourcePatternPresence = {
6
- /** Absolute path of the first source file where the pattern occurs in executable code. */
7
- file: string;
8
- line: number;
9
- evidence: string;
10
- };
11
- /**
12
- * Finds where each pattern first occurs in executable project source (comments and strings in
13
- * JavaScript-like files are ignored, as in the compliance scan). Absent patterns are left out.
14
- */
15
- export declare function findSourcePatterns(projectRoot: string, patterns: Record<string, RegExp>, sourceGlobs?: string[]): Promise<Map<string, SourcePatternPresence>>;
@@ -99,37 +99,6 @@ export async function scanSourceForChannels(context, channels) {
99
99
  }
100
100
  return results;
101
101
  }
102
- /**
103
- * Finds where each pattern first occurs in executable project source (comments and strings in
104
- * JavaScript-like files are ignored, as in the compliance scan). Absent patterns are left out.
105
- */
106
- export async function findSourcePatterns(projectRoot, patterns, sourceGlobs) {
107
- const found = new Map();
108
- const ids = Object.keys(patterns);
109
- for (const filePath of await collectSourceFiles(projectRoot, sourceGlobs)) {
110
- if (found.size === ids.length)
111
- break;
112
- let content;
113
- try {
114
- content = await fs.readFile(filePath, 'utf-8');
115
- }
116
- catch {
117
- continue;
118
- }
119
- for (const id of ids) {
120
- if (found.has(id))
121
- continue;
122
- const match = findExecutableSourcePattern(filePath, content, patterns[id]);
123
- if (match)
124
- found.set(id, {
125
- file: filePath,
126
- line: lineOfIndex(content, match.index),
127
- evidence: trimEvidence(match.evidence),
128
- });
129
- }
130
- }
131
- return found;
132
- }
133
102
  async function scanSourceFilesForChannel(context, sourceFiles, includeCommonPatterns) {
134
103
  const results = [];
135
104
  const requiredPatterns = CHANNEL_SOURCE_PATTERNS[context.channel] ?? [];
@@ -364,6 +333,7 @@ function maskJavaScriptLikeSource(content) {
364
333
  maskRange(start, index);
365
334
  return index;
366
335
  };
336
+ let scanCode;
367
337
  const scanTemplate = (start) => {
368
338
  maskAt(start);
369
339
  let index = start + 1;
@@ -391,7 +361,7 @@ function maskJavaScriptLikeSource(content) {
391
361
  }
392
362
  return index;
393
363
  };
394
- const scanCode = (start, interpolation) => {
364
+ scanCode = (start, interpolation) => {
395
365
  let index = start;
396
366
  let braceDepth = interpolation ? 1 : 0;
397
367
  while (index < content.length) {
@@ -1,7 +1,7 @@
1
1
  import type { BuildTool, EngineType, OutputFormat, Platform } from '../types.js';
2
- export type ValidationStage = 'prebuild-source' | 'base-output' | 'html-artifact' | 'delivery-package' | 'runtime-load' | 'runtime-manual' | 'external-validator';
2
+ export type ValidationStage = 'prebuild-source' | 'base-output' | 'html-artifact' | 'delivery-package' | 'runtime-manual' | 'external-validator';
3
3
  export type RuleSeverity = 'error' | 'warning' | 'info';
4
- export type RuleStatus = 'pass' | 'fail' | 'warning' | 'manual' | 'external' | 'not-applicable' | 'inconclusive';
4
+ export type RuleStatus = 'pass' | 'fail' | 'warning' | 'manual' | 'external' | 'not-applicable';
5
5
  export type RuleConfidence = 'high' | 'medium' | 'low';
6
6
  export type RuleOwner = 'playcraft-build' | 'playcraft-delivery' | 'devkit' | 'manual' | 'external';
7
7
  export type DeliveryMode = 'single-html' | 'zip' | 'html-backed-zip' | 'fragment-assets' | 'mixed';
@@ -59,12 +59,7 @@ export interface ValidationContext {
59
59
  buildTool?: BuildTool;
60
60
  buildChain: BuildChain;
61
61
  htmlPath?: string;
62
- /** Final HTML bytes; lets Business validate an uploaded object without staging it. */
63
- htmlContent?: string | Uint8Array;
64
62
  packagePath?: string;
65
- /** Final ZIP bytes; no filesystem extraction is required. */
66
- packageBytes?: Uint8Array;
67
- format?: OutputFormat;
68
63
  outputDir?: string;
69
64
  sourceGlobs?: string[];
70
65
  metadata?: Record<string, unknown>;
@@ -115,174 +110,3 @@ export interface ValidationReport {
115
110
  manualChecklist: ManualChecklistItem[];
116
111
  externalChecklist: ExternalChecklistItem[];
117
112
  }
118
- /** How a built artifact is stored on disk. */
119
- export type ArtifactContainer = 'html' | 'zip' | 'directory';
120
- /**
121
- * How the playable is laid out inside its container: one self-contained HTML file,
122
- * or an HTML entry with separate files (scripts, styles, assets).
123
- */
124
- export type ArtifactLayout = 'single-html' | 'multi-file';
125
- export interface ArtifactFile {
126
- /** Path inside the artifact, `/`-separated, without a leading slash. */
127
- path: string;
128
- /** Uncompressed size in bytes. */
129
- size: number;
130
- }
131
- export interface PlayableArtifact {
132
- /** Absolute path of the file or directory that was read. */
133
- sourcePath: string;
134
- container: ArtifactContainer;
135
- layout: ArtifactLayout;
136
- /** Entry HTML path inside the artifact. */
137
- entry: string;
138
- files: ArtifactFile[];
139
- /** Bytes on disk: the HTML or ZIP file size, or the sum of the directory's files. */
140
- totalSize: number;
141
- /** `sha256:<hex>`; stable for the same content regardless of where it is stored. */
142
- digest: string;
143
- readText(filePath: string): Promise<string | null>;
144
- readBuffer(filePath: string): Promise<Buffer | null>;
145
- }
146
- export type ArtifactReadErrorCode = 'artifact_not_found' | 'artifact_unsupported' | 'artifact_zip_invalid' | 'artifact_entry_missing' | 'artifact_entry_ambiguous' | 'artifact_entry_invalid';
147
- /**
148
- * Artifact QA steps, in the order they run and are shown to users. Each step answers one question
149
- * a user would ask about the playable; every rule belongs to exactly one step.
150
- * - `code`: is the code in the artifact sound, with no development or debugging leftovers.
151
- * - `resources`: are all resources inside the artifact, with nothing fetched from the network.
152
- * - `launch`: does the game open without errors and display correctly on every screen.
153
- * - `size`: how big the artifact is and what takes the space. A channel profile enforces the
154
- * channel's limit; the `playcraft` profile has no hard limit, so the step is advisory there.
155
- * - `cta`: does the CTA reach the channel's store API, with no redirect the user did not tap.
156
- */
157
- export type QaStageId = 'code' | 'resources' | 'launch' | 'size' | 'cta';
158
- export declare const QA_STAGES: readonly QaStageId[];
159
- /**
160
- * - `ran`: every check of the step ran; see its results.
161
- * - `partial`: some checks ran, others could not (e.g. no browser); the QA is incomplete.
162
- * - `skipped`: the step could not run at all; the QA is incomplete.
163
- * - `not-applicable`: the step does not apply to this artifact.
164
- */
165
- export type QaStageStatus = 'ran' | 'partial' | 'skipped' | 'not-applicable';
166
- export interface QaStageReport {
167
- stage: QaStageId;
168
- status: QaStageStatus;
169
- /** Why the step did not run, or which of its checks did not run. */
170
- reason?: string;
171
- /** Advisory steps never affect the overall summary or exit code. */
172
- advisory: boolean;
173
- durationMs: number;
174
- summary: ValidationSummary;
175
- results: ValidationResult[];
176
- /** Project source findings that help locate this step's problems; never affect any result. */
177
- hints: ValidationResult[];
178
- /** Step-specific facts, e.g. the size limit used by `size`. */
179
- details?: Record<string, unknown>;
180
- }
181
- export type QaProgressEvent = {
182
- type: 'step-start';
183
- stage: QaStageId;
184
- index: number;
185
- total: number;
186
- } | {
187
- type: 'step-end';
188
- stage: QaStageId;
189
- index: number;
190
- total: number;
191
- report: QaStageReport;
192
- };
193
- /**
194
- * Report of `runArtifactQa`: one report per step, and an overall summary of the non-advisory
195
- * steps that ran. Kept apart from `ValidationReport` so the existing delivery validation output,
196
- * which is checked against strict schemas, stays unchanged.
197
- */
198
- export interface ArtifactQaReport {
199
- version: string;
200
- rulesVersion: string;
201
- profile: Platform;
202
- artifact: {
203
- sourcePath: string;
204
- container: ArtifactContainer;
205
- layout: ArtifactLayout;
206
- entry: string;
207
- digest: string;
208
- totalSize: number;
209
- fileCount: number;
210
- };
211
- summary: ValidationSummary;
212
- /** A requested step was skipped or only partly run, so passing does not cover it. */
213
- incomplete: boolean;
214
- stages: QaStageReport[];
215
- /** Whether project source was scanned for the steps' hints. */
216
- sourceHints: {
217
- status: 'ran' | 'skipped';
218
- reason?: string;
219
- };
220
- /** Checks of the channel profile that need a person or the channel's own validator. */
221
- manualChecklist: ManualChecklistItem[];
222
- externalChecklist: ExternalChecklistItem[];
223
- }
224
- export interface ReadArtifactOptions {
225
- /** Entry HTML path inside a ZIP or directory; defaults to `index.html`, then the only HTML file. */
226
- entry?: string;
227
- }
228
- /**
229
- * Browser access for runtime QA. `@playcraft/build` only defines this contract; hosts provide the
230
- * implementation (the CLI uses playwright-core), so the build package does not depend on a browser.
231
- */
232
- export interface RuntimeViewport {
233
- width: number;
234
- height: number;
235
- deviceScaleFactor: number;
236
- isMobile: boolean;
237
- hasTouch: boolean;
238
- }
239
- export interface RuntimeResource {
240
- body: Buffer;
241
- contentType: string;
242
- }
243
- export interface RuntimePageOptions {
244
- /** Origin the artifact is served from, e.g. `http://artifact.playcraft-qa.test`. */
245
- origin: string;
246
- /** Entry path inside the artifact, served at `${origin}/${entryPath}`. */
247
- entryPath: string;
248
- viewport: RuntimeViewport;
249
- userAgent: string;
250
- /** Runs before any page script. */
251
- initScript: string;
252
- /** Content-Security-Policy header sent with HTML responses. */
253
- contentSecurityPolicy: string;
254
- /** Serves a path inside the artifact; null means the file does not exist (404). */
255
- resolve(pathname: string): Promise<RuntimeResource | null>;
256
- /** Navigation timeout in milliseconds. */
257
- timeoutMs: number;
258
- }
259
- export interface RuntimePageEvents {
260
- consoleErrors: string[];
261
- pageErrors: string[];
262
- /** Requests for artifact files that do not exist, or that failed to load. */
263
- failedRequests: Array<{
264
- url: string;
265
- reason: string;
266
- }>;
267
- /** Requests to any host other than the artifact origin; they are blocked, never sent. */
268
- blockedRequests: string[];
269
- /** Top-level navigations away from the entry; they are blocked, never followed. */
270
- navigationAttempts: string[];
271
- }
272
- export interface RuntimePage {
273
- /** Whether the entry document loaded. */
274
- loaded: boolean;
275
- loadError?: string;
276
- events(): RuntimePageEvents;
277
- /** Evaluates a JavaScript expression in the page and returns its JSON-serializable result. */
278
- evaluate<T>(expression: string): Promise<T>;
279
- /** Dispatches a real pointer click at viewport coordinates. */
280
- click(x: number, y: number): Promise<void>;
281
- /** PNG screenshot of the viewport. */
282
- screenshot(): Promise<Buffer>;
283
- wait(ms: number): Promise<void>;
284
- close(): Promise<void>;
285
- }
286
- export interface BrowserDriver {
287
- open(options: RuntimePageOptions): Promise<RuntimePage>;
288
- }
@@ -1 +1 @@
1
- export const QA_STAGES = ['code', 'resources', 'launch', 'size', 'cta'];
1
+ export {};
@@ -1,25 +1,5 @@
1
- import type { OutputFormat, Platform } from '../types.js';
2
- import type { ExternalChecklistItem, ManualChecklistItem, QaStageId, QaStageReport, ValidationContext, ValidationReport, ValidationResult, ValidationStage, ValidationSummary } from './types.js';
1
+ import type { Platform } from '../types.js';
2
+ import type { ValidationContext, ValidationReport, ValidationStage } from './types.js';
3
3
  export declare const VALIDATION_REPORT_VERSION = "0.1.0";
4
4
  export declare function runPlayableValidation(context: ValidationContext, stages?: ValidationStage[]): Promise<ValidationReport>;
5
- export type ChannelArtifactValidationOptions = {
6
- channel: Platform;
7
- format: OutputFormat;
8
- bytes: Uint8Array;
9
- htmlBytes?: Uint8Array;
10
- artifactName?: string;
11
- projectRoot?: string;
12
- };
13
- /** Revalidates final HTML and ZIP bytes without trusting a Runner-side report or staging files. */
14
- export declare function runChannelArtifactValidation(options: ChannelArtifactValidationOptions): Promise<ValidationReport>;
15
5
  export declare function runPlayableSourceValidationForChannels(context: Omit<ValidationContext, 'channel'>, channels: Platform[]): Promise<ValidationReport>;
16
- export declare function summarize(results: ValidationResult[], manualChecklist: ManualChecklistItem[], externalChecklist: ExternalChecklistItem[]): ValidationSummary;
17
- /** Builds the report of a QA stage that ran. */
18
- export declare function ranStageReport(stage: QaStageId, startedAt: number, results: ValidationResult[], extra?: {
19
- status?: 'ran' | 'partial';
20
- reason?: string;
21
- advisory?: boolean;
22
- hints?: ValidationResult[];
23
- details?: Record<string, unknown>;
24
- }): QaStageReport;
25
- export declare function idleStageReport(stage: QaStageId, status: 'skipped' | 'not-applicable', reason: string, advisory?: boolean): QaStageReport;
@@ -1,13 +1,12 @@
1
1
  import { getChannelRuleProfile } from './profiles.js';
2
2
  import { validateHtmlArtifact } from './html-validator.js';
3
- import { validateDeliveryPackage, validateSingleHtmlPackage } from './package-validator.js';
3
+ import { validateDeliveryPackage } from './package-validator.js';
4
4
  import { scanSourceForChannels, scanSourceForCompliance } from './source-scanner.js';
5
- import { SimpleZipReader } from './zip-reader.js';
6
5
  export const VALIDATION_REPORT_VERSION = '0.1.0';
7
6
  export async function runPlayableValidation(context, stages) {
8
7
  const profile = getChannelRuleProfile(context.channel);
9
8
  const defaultStages = [...profile.defaultStages];
10
- if ((context.packagePath || context.packageBytes) && profile.optionalStages.includes('delivery-package')) {
9
+ if (context.packagePath && profile.optionalStages.includes('delivery-package')) {
11
10
  defaultStages.push('delivery-package');
12
11
  }
13
12
  const enabledStages = new Set(stages ?? defaultStages);
@@ -33,40 +32,6 @@ export async function runPlayableValidation(context, stages) {
33
32
  externalChecklist,
34
33
  };
35
34
  }
36
- /** Revalidates final HTML and ZIP bytes without trusting a Runner-side report or staging files. */
37
- export async function runChannelArtifactValidation(options) {
38
- const artifactName = options.artifactName ?? (options.format === 'html' ? 'index.html' : 'delivery.zip');
39
- let htmlBytes = options.htmlBytes ?? (options.format === 'html' ? options.bytes : undefined);
40
- if (!htmlBytes && options.format === 'zip') {
41
- try {
42
- htmlBytes = new SimpleZipReader(Buffer.from(options.bytes)).readEntry('index.html') ?? undefined;
43
- }
44
- catch {
45
- // The package validator returns the structured readable/path failure below.
46
- }
47
- }
48
- const report = await runPlayableValidation({
49
- projectRoot: options.projectRoot ?? '.',
50
- channel: options.channel,
51
- engine: 'unknown',
52
- buildChain: 'generic',
53
- format: options.format,
54
- htmlPath: htmlBytes ? artifactName : undefined,
55
- htmlContent: htmlBytes,
56
- packagePath: options.format === 'zip' ? artifactName : undefined,
57
- packageBytes: options.format === 'zip' ? options.bytes : undefined,
58
- }, [
59
- 'html-artifact',
60
- ...(options.format === 'zip' ? ['delivery-package'] : []),
61
- 'runtime-manual',
62
- 'external-validator',
63
- ]);
64
- if (options.format === 'html') {
65
- report.results.push(...validateSingleHtmlPackage(options.channel, options.bytes, artifactName));
66
- report.summary = summarize(report.results, report.manualChecklist, report.externalChecklist);
67
- }
68
- return report;
69
- }
70
35
  export async function runPlayableSourceValidationForChannels(context, channels) {
71
36
  const uniqueChannels = Array.from(new Set(channels));
72
37
  const results = await scanSourceForChannels(context, uniqueChannels);
@@ -106,7 +71,7 @@ function buildExternalChecklist(rules, enabledStages) {
106
71
  owner: rule.owner,
107
72
  }));
108
73
  }
109
- export function summarize(results, manualChecklist, externalChecklist) {
74
+ function summarize(results, manualChecklist, externalChecklist) {
110
75
  const errorCount = results.filter((result) => result.status === 'fail').length;
111
76
  const warningCount = results.filter((result) => result.status === 'warning').length;
112
77
  const manualCount = manualChecklist.length;
@@ -129,29 +94,3 @@ export function summarize(results, manualChecklist, externalChecklist) {
129
94
  externalCount,
130
95
  };
131
96
  }
132
- /** Builds the report of a QA stage that ran. */
133
- export function ranStageReport(stage, startedAt, results, extra = {}) {
134
- return {
135
- stage,
136
- status: extra.status ?? 'ran',
137
- ...(extra.reason ? { reason: extra.reason } : {}),
138
- advisory: extra.advisory ?? false,
139
- durationMs: Date.now() - startedAt,
140
- summary: summarize(results, [], []),
141
- results,
142
- hints: extra.hints ?? [],
143
- ...(extra.details ? { details: extra.details } : {}),
144
- };
145
- }
146
- export function idleStageReport(stage, status, reason, advisory = false) {
147
- return {
148
- stage,
149
- status,
150
- reason,
151
- advisory,
152
- durationMs: 0,
153
- summary: summarize([], [], []),
154
- results: [],
155
- hints: [],
156
- };
157
- }
@@ -4,21 +4,14 @@ export interface ZipEntryInfo {
4
4
  uncompressedSize: number;
5
5
  compressionMethod: number;
6
6
  isDirectory: boolean;
7
- externalAttributes?: number;
8
- creatorOs?: number;
9
- encrypted?: boolean;
10
- crc32?: number;
11
7
  }
12
- /** Bounded ZIP reader used for both local reports and untrusted uploaded bytes. */
13
8
  export declare class SimpleZipReader {
14
9
  private readonly buffer;
15
10
  private entriesCache?;
16
11
  constructor(buffer: Buffer);
17
12
  listEntries(): ZipEntryInfo[];
18
13
  readEntryText(entryPath: string): string | null;
19
- readEntry(entryPath: string): Buffer | null;
20
14
  private readCentralDirectory;
21
15
  private readEntryData;
22
16
  private findEndOfCentralDirectory;
23
- private requireRange;
24
17
  }