@playcraft/build 0.1.91 → 0.1.93-test

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 -155
  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 -68
  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 -7
  63. package/dist/delivery/command-isolation.js +0 -252
  64. package/dist/delivery/commands.d.ts +0 -5
  65. package/dist/delivery/commands.js +0 -137
  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 -126
  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 -44
  91. package/dist/validation/artifact-qa.js +0 -170
  92. package/dist/validation/artifact-rules.d.ts +0 -28
  93. package/dist/validation/artifact-rules.js +0 -440
  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 -89
  97. package/dist/validation/runtime-load.js +0 -654
  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,151 +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 stages. Each stage runs on its own: it depends only on the artifact and its own
149
- * options, never on another stage's results, and produces its own report.
150
- * - `base`: static checks of the artifact files.
151
- * - `channel`: the channel's existing `html-artifact` / `delivery-package` rules.
152
- * - `runtime-load`: opens the artifact in a headless browser.
153
- * - `source-hints`: scans project source; advisory only.
154
- */
155
- export type QaStageId = 'base' | 'channel' | 'runtime-load' | 'source-hints';
156
- export declare const QA_STAGES: readonly QaStageId[];
157
- /**
158
- * - `ran`: the stage ran; see its results.
159
- * - `skipped`: the stage applies but could not run (e.g. no browser); the QA is incomplete.
160
- * - `not-applicable`: the stage does not apply (e.g. channel rules for the `playcraft` profile).
161
- */
162
- export type QaStageStatus = 'ran' | 'skipped' | 'not-applicable';
163
- export interface QaStageReport {
164
- stage: QaStageId;
165
- status: QaStageStatus;
166
- /** Why the stage did not run. */
167
- reason?: string;
168
- /** Advisory stages never affect the overall summary or exit code. */
169
- advisory: boolean;
170
- durationMs: number;
171
- summary: ValidationSummary;
172
- results: ValidationResult[];
173
- manualChecklist: ManualChecklistItem[];
174
- externalChecklist: ExternalChecklistItem[];
175
- /** Stage-specific facts, e.g. the size limit used by `base`. */
176
- details?: Record<string, unknown>;
177
- }
178
- /**
179
- * Report of `runArtifactQa`: one report per stage, and an overall summary of the non-advisory
180
- * stages that ran. Kept apart from `ValidationReport` so the existing delivery validation output,
181
- * which is checked against strict schemas, stays unchanged.
182
- */
183
- export interface ArtifactQaReport {
184
- version: string;
185
- rulesVersion: string;
186
- profile: Platform;
187
- artifact: {
188
- sourcePath: string;
189
- container: ArtifactContainer;
190
- layout: ArtifactLayout;
191
- entry: string;
192
- digest: string;
193
- totalSize: number;
194
- fileCount: number;
195
- };
196
- summary: ValidationSummary;
197
- /** A requested stage was skipped, so passing does not cover it. */
198
- incomplete: boolean;
199
- stages: QaStageReport[];
200
- }
201
- export interface ReadArtifactOptions {
202
- /** Entry HTML path inside a ZIP or directory; defaults to `index.html`, then the only HTML file. */
203
- entry?: string;
204
- }
205
- /**
206
- * Browser access for runtime QA. `@playcraft/build` only defines this contract; hosts provide the
207
- * implementation (the CLI uses playwright-core), so the build package does not depend on a browser.
208
- */
209
- export interface RuntimeViewport {
210
- width: number;
211
- height: number;
212
- deviceScaleFactor: number;
213
- isMobile: boolean;
214
- hasTouch: boolean;
215
- }
216
- export interface RuntimeResource {
217
- body: Buffer;
218
- contentType: string;
219
- }
220
- export interface RuntimePageOptions {
221
- /** Origin the artifact is served from, e.g. `http://artifact.playcraft-qa.test`. */
222
- origin: string;
223
- /** Entry path inside the artifact, served at `${origin}/${entryPath}`. */
224
- entryPath: string;
225
- viewport: RuntimeViewport;
226
- userAgent: string;
227
- /** Runs before any page script. */
228
- initScript: string;
229
- /** Content-Security-Policy header sent with HTML responses. */
230
- contentSecurityPolicy: string;
231
- /** Serves a path inside the artifact; null means the file does not exist (404). */
232
- resolve(pathname: string): Promise<RuntimeResource | null>;
233
- /** Navigation timeout in milliseconds. */
234
- timeoutMs: number;
235
- }
236
- export interface RuntimePageEvents {
237
- consoleErrors: string[];
238
- pageErrors: string[];
239
- /** Requests for artifact files that do not exist, or that failed to load. */
240
- failedRequests: Array<{
241
- url: string;
242
- reason: string;
243
- }>;
244
- /** Requests to any host other than the artifact origin; they are blocked, never sent. */
245
- blockedRequests: string[];
246
- /** Top-level navigations away from the entry; they are blocked, never followed. */
247
- navigationAttempts: string[];
248
- }
249
- export interface RuntimePage {
250
- /** Whether the entry document loaded. */
251
- loaded: boolean;
252
- loadError?: string;
253
- events(): RuntimePageEvents;
254
- /** Evaluates a JavaScript expression in the page and returns its JSON-serializable result. */
255
- evaluate<T>(expression: string): Promise<T>;
256
- /** Dispatches a real pointer click at viewport coordinates. */
257
- click(x: number, y: number): Promise<void>;
258
- /** PNG screenshot of the viewport. */
259
- screenshot(): Promise<Buffer>;
260
- wait(ms: number): Promise<void>;
261
- close(): Promise<void>;
262
- }
263
- export interface BrowserDriver {
264
- open(options: RuntimePageOptions): Promise<RuntimePage>;
265
- }
@@ -1 +1 @@
1
- export const QA_STAGES = ['base', 'channel', 'runtime-load', 'source-hints'];
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
- advisory?: boolean;
20
- manualChecklist?: ManualChecklistItem[];
21
- externalChecklist?: ExternalChecklistItem[];
22
- details?: Record<string, unknown>;
23
- }): QaStageReport;
24
- /** Builds the report of a QA stage that did not run. */
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,33 +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
- const manualChecklist = extra.manualChecklist ?? [];
135
- const externalChecklist = extra.externalChecklist ?? [];
136
- return {
137
- stage,
138
- status: 'ran',
139
- advisory: extra.advisory ?? false,
140
- durationMs: Date.now() - startedAt,
141
- summary: summarize(results, manualChecklist, externalChecklist),
142
- results,
143
- manualChecklist,
144
- externalChecklist,
145
- ...(extra.details ? { details: extra.details } : {}),
146
- };
147
- }
148
- /** Builds the report of a QA stage that did not run. */
149
- export function idleStageReport(stage, status, reason, advisory = false) {
150
- return {
151
- stage,
152
- status,
153
- reason,
154
- advisory,
155
- durationMs: 0,
156
- summary: summarize([], [], []),
157
- results: [],
158
- manualChecklist: [],
159
- externalChecklist: [],
160
- };
161
- }
@@ -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
  }