@playcraft/build 0.1.96-test-a → 0.1.97
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/base-builder.js +2 -41
- package/dist/engines/engine-detector.js +0 -4
- package/dist/engines/generic-adapter.js +19 -14
- package/dist/index.d.ts +4 -19
- package/dist/index.js +2 -11
- package/dist/platforms/adikteev.js +0 -1
- package/dist/platforms/applovin.js +0 -1
- package/dist/platforms/base.js +2 -2
- package/dist/platforms/bigo.js +0 -1
- package/dist/platforms/facebook.js +0 -1
- package/dist/platforms/google.js +0 -1
- package/dist/platforms/inmobi.js +0 -1
- package/dist/platforms/ironsource.js +0 -1
- package/dist/platforms/liftoff.js +0 -1
- package/dist/platforms/mintegral.js +0 -1
- package/dist/platforms/moloco.js +0 -1
- package/dist/platforms/playcraft.js +0 -1
- package/dist/platforms/remerge.js +0 -1
- package/dist/platforms/snapchat.js +0 -1
- package/dist/platforms/tiktok.js +0 -1
- package/dist/platforms/unity.js +0 -1
- package/dist/types.d.ts +0 -5
- package/dist/validation/html-validator.d.ts +0 -5
- package/dist/validation/html-validator.js +17 -19
- package/dist/validation/index.d.ts +0 -4
- package/dist/validation/index.js +0 -4
- package/dist/validation/package-validator.d.ts +0 -2
- package/dist/validation/package-validator.js +64 -25
- package/dist/validation/profiles.d.ts +1 -13
- package/dist/validation/profiles.js +0 -27
- package/dist/validation/source-scanner.d.ts +0 -11
- package/dist/validation/source-scanner.js +2 -32
- package/dist/validation/types.d.ts +2 -178
- package/dist/validation/types.js +1 -1
- package/dist/validation/validation-runner.d.ts +2 -22
- package/dist/validation/validation-runner.js +3 -64
- package/dist/validation/zip-reader.d.ts +0 -7
- package/dist/validation/zip-reader.js +26 -159
- package/dist/vite/config-builder-generic.d.ts +1 -3
- package/dist/vite/config-builder-generic.js +7 -9
- package/dist/vite/config-builder.js +1 -1
- package/dist/vite/plugin-platform.js +54 -30
- package/dist/vite/plugin-source-builder.d.ts +14 -2
- package/dist/vite/plugin-source-builder.js +997 -61
- package/dist/vite-builder.d.ts +5 -4
- package/dist/vite-builder.js +34 -33
- package/package.json +4 -16
- package/dist/audio-source-files.d.ts +0 -5
- package/dist/audio-source-files.js +0 -135
- package/dist/delivery/agent-build-runner.d.ts +0 -44
- package/dist/delivery/agent-build-runner.js +0 -365
- package/dist/delivery/agent-build-source.d.ts +0 -8
- package/dist/delivery/agent-build-source.js +0 -25
- package/dist/delivery/artifact-descriptor.d.ts +0 -31
- package/dist/delivery/artifact-descriptor.js +0 -237
- package/dist/delivery/artifact-package.d.ts +0 -43
- package/dist/delivery/artifact-package.js +0 -283
- package/dist/delivery/build-plan.d.ts +0 -4
- package/dist/delivery/build-plan.js +0 -189
- package/dist/delivery/build-plan.types.d.ts +0 -51
- package/dist/delivery/build-plan.types.js +0 -1
- package/dist/delivery/command-isolation.d.ts +0 -21
- package/dist/delivery/command-isolation.js +0 -327
- package/dist/delivery/commands.d.ts +0 -5
- package/dist/delivery/commands.js +0 -146
- package/dist/delivery/files.d.ts +0 -9
- package/dist/delivery/files.js +0 -144
- package/dist/delivery/git-source-fingerprint.d.ts +0 -2
- package/dist/delivery/git-source-fingerprint.js +0 -58
- package/dist/delivery/isolated-source.d.ts +0 -5
- package/dist/delivery/isolated-source.js +0 -131
- package/dist/delivery/output-publication.d.ts +0 -21
- package/dist/delivery/output-publication.js +0 -444
- package/dist/delivery/project-delivery.d.ts +0 -6
- package/dist/delivery/project-delivery.js +0 -287
- package/dist/delivery/recipe-build-plan.d.ts +0 -4
- package/dist/delivery/recipe-build-plan.js +0 -53
- package/dist/delivery/recipe.d.ts +0 -20
- package/dist/delivery/recipe.js +0 -211
- package/dist/delivery/safe-path.d.ts +0 -2
- package/dist/delivery/safe-path.js +0 -18
- package/dist/delivery/types.d.ts +0 -76
- package/dist/delivery/types.js +0 -1
- package/dist/production-animation-presence.d.ts +0 -2
- package/dist/production-animation-presence.js +0 -146
- package/dist/production-inputs.d.ts +0 -30
- package/dist/production-inputs.js +0 -262
- package/dist/production-source-paths.d.ts +0 -5
- package/dist/production-source-paths.js +0 -27
- package/dist/validation/artifact-qa.d.ts +0 -36
- package/dist/validation/artifact-qa.js +0 -261
- package/dist/validation/artifact-rules.d.ts +0 -39
- package/dist/validation/artifact-rules.js +0 -451
- package/dist/validation/artifact.d.ts +0 -14
- package/dist/validation/artifact.js +0 -188
- package/dist/validation/runtime-load.d.ts +0 -94
- package/dist/validation/runtime-load.js +0 -653
- package/dist/vite/source-builder-asset-paths.d.ts +0 -25
- package/dist/vite/source-builder-asset-paths.js +0 -154
- package/dist/vite/source-builder-esm.d.ts +0 -7
- package/dist/vite/source-builder-esm.js +0 -877
- package/dist/vite/source-builder-types.d.ts +0 -14
- package/dist/vite/source-builder-types.js +0 -1
- package/dist/vite/workspace.d.ts +0 -6
- package/dist/vite/workspace.js +0 -41
- package/dist/workspace-css-imports.d.ts +0 -2
- package/dist/workspace-css-imports.js +0 -139
- package/dist/workspace-model-source.d.ts +0 -14
- package/dist/workspace-model-source.js +0 -184
- package/dist/workspace-public-imports.d.ts +0 -11
- package/dist/workspace-public-imports.js +0 -232
- package/dist/workspace-public-source.d.ts +0 -15
- package/dist/workspace-public-source.js +0 -564
|
@@ -1,17 +1,5 @@
|
|
|
1
|
-
import type {
|
|
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
|
-
|
|
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-
|
|
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'
|
|
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
|
-
}
|
package/dist/validation/types.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export
|
|
1
|
+
export {};
|
|
@@ -1,25 +1,5 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type {
|
|
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
|
|
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 (
|
|
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
|
-
|
|
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
|
}
|