@playcraft/build 0.1.93-test → 0.1.94-test-a
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/audio-source-files.d.ts +5 -0
- package/dist/audio-source-files.js +135 -0
- package/dist/base-builder.js +41 -2
- package/dist/delivery/agent-build-runner.d.ts +44 -0
- package/dist/delivery/agent-build-runner.js +365 -0
- package/dist/delivery/agent-build-source.d.ts +8 -0
- package/dist/delivery/agent-build-source.js +25 -0
- package/dist/delivery/artifact-descriptor.d.ts +31 -0
- package/dist/delivery/artifact-descriptor.js +237 -0
- package/dist/delivery/artifact-package.d.ts +43 -0
- package/dist/delivery/artifact-package.js +283 -0
- package/dist/delivery/build-plan.d.ts +4 -0
- package/dist/delivery/build-plan.js +189 -0
- package/dist/delivery/build-plan.types.d.ts +51 -0
- package/dist/delivery/build-plan.types.js +1 -0
- package/dist/delivery/command-isolation.d.ts +20 -0
- package/dist/delivery/command-isolation.js +324 -0
- package/dist/delivery/commands.d.ts +5 -0
- package/dist/delivery/commands.js +146 -0
- package/dist/delivery/files.d.ts +9 -0
- package/dist/delivery/files.js +144 -0
- package/dist/delivery/git-source-fingerprint.d.ts +2 -0
- package/dist/delivery/git-source-fingerprint.js +58 -0
- package/dist/delivery/isolated-source.d.ts +5 -0
- package/dist/delivery/isolated-source.js +126 -0
- package/dist/delivery/output-publication.d.ts +21 -0
- package/dist/delivery/output-publication.js +444 -0
- package/dist/delivery/project-delivery.d.ts +6 -0
- package/dist/delivery/project-delivery.js +287 -0
- package/dist/delivery/recipe-build-plan.d.ts +4 -0
- package/dist/delivery/recipe-build-plan.js +53 -0
- package/dist/delivery/recipe.d.ts +20 -0
- package/dist/delivery/recipe.js +211 -0
- package/dist/delivery/safe-path.d.ts +2 -0
- package/dist/delivery/safe-path.js +18 -0
- package/dist/delivery/types.d.ts +76 -0
- package/dist/delivery/types.js +1 -0
- package/dist/engines/engine-detector.js +4 -0
- package/dist/engines/generic-adapter.js +14 -19
- package/dist/index.d.ts +19 -4
- package/dist/index.js +11 -2
- package/dist/platforms/adikteev.js +1 -0
- package/dist/platforms/applovin.js +1 -0
- package/dist/platforms/base.js +2 -2
- package/dist/platforms/bigo.js +1 -0
- package/dist/platforms/facebook.js +1 -0
- package/dist/platforms/google.js +1 -0
- package/dist/platforms/inmobi.js +1 -0
- package/dist/platforms/ironsource.js +1 -0
- package/dist/platforms/liftoff.js +1 -0
- package/dist/platforms/mintegral.js +1 -0
- package/dist/platforms/moloco.js +1 -0
- package/dist/platforms/playcraft.js +1 -0
- package/dist/platforms/remerge.js +1 -0
- package/dist/platforms/snapchat.js +1 -0
- package/dist/platforms/tiktok.js +1 -0
- package/dist/platforms/unity.js +1 -0
- package/dist/production-animation-presence.d.ts +2 -0
- package/dist/production-animation-presence.js +146 -0
- package/dist/production-inputs.d.ts +30 -0
- package/dist/production-inputs.js +262 -0
- package/dist/production-source-paths.d.ts +5 -0
- package/dist/production-source-paths.js +27 -0
- package/dist/types.d.ts +5 -0
- package/dist/validation/artifact-qa.d.ts +44 -0
- package/dist/validation/artifact-qa.js +170 -0
- package/dist/validation/artifact-rules.d.ts +28 -0
- package/dist/validation/artifact-rules.js +440 -0
- package/dist/validation/artifact.d.ts +14 -0
- package/dist/validation/artifact.js +188 -0
- package/dist/validation/html-validator.d.ts +5 -0
- package/dist/validation/html-validator.js +19 -17
- package/dist/validation/index.d.ts +4 -0
- package/dist/validation/index.js +4 -0
- package/dist/validation/package-validator.d.ts +2 -0
- package/dist/validation/package-validator.js +25 -64
- package/dist/validation/profiles.d.ts +13 -1
- package/dist/validation/profiles.js +27 -0
- package/dist/validation/runtime-load.d.ts +89 -0
- package/dist/validation/runtime-load.js +654 -0
- package/dist/validation/source-scanner.d.ts +11 -0
- package/dist/validation/source-scanner.js +32 -2
- package/dist/validation/types.d.ts +155 -2
- package/dist/validation/types.js +1 -1
- package/dist/validation/validation-runner.d.ts +22 -2
- package/dist/validation/validation-runner.js +68 -3
- package/dist/validation/zip-reader.d.ts +7 -0
- package/dist/validation/zip-reader.js +159 -26
- package/dist/vite/config-builder-generic.d.ts +3 -1
- package/dist/vite/config-builder-generic.js +9 -7
- package/dist/vite/config-builder.js +1 -1
- package/dist/vite/plugin-platform.js +30 -54
- package/dist/vite/plugin-source-builder.d.ts +2 -14
- package/dist/vite/plugin-source-builder.js +61 -997
- package/dist/vite/source-builder-asset-paths.d.ts +25 -0
- package/dist/vite/source-builder-asset-paths.js +154 -0
- package/dist/vite/source-builder-esm.d.ts +7 -0
- package/dist/vite/source-builder-esm.js +877 -0
- package/dist/vite/source-builder-types.d.ts +14 -0
- package/dist/vite/source-builder-types.js +1 -0
- package/dist/vite/workspace.d.ts +6 -0
- package/dist/vite/workspace.js +41 -0
- package/dist/vite-builder.d.ts +4 -5
- package/dist/vite-builder.js +33 -34
- package/dist/workspace-css-imports.d.ts +2 -0
- package/dist/workspace-css-imports.js +139 -0
- package/dist/workspace-model-source.d.ts +14 -0
- package/dist/workspace-model-source.js +184 -0
- package/dist/workspace-public-imports.d.ts +11 -0
- package/dist/workspace-public-imports.js +232 -0
- package/dist/workspace-public-source.d.ts +15 -0
- package/dist/workspace-public-source.js +564 -0
- package/package.json +16 -4
|
@@ -3,31 +3,33 @@ import { getRulesForStage } from './profiles.js';
|
|
|
3
3
|
const RESOURCE_ATTR_RE = /\b(?:src|href|data)\s*=\s*["']([^"']+)["']/gi;
|
|
4
4
|
const CSS_URL_RE = /url\(\s*["']?([^"')]+)["']?\s*\)/gi;
|
|
5
5
|
export async function validateHtmlArtifact(context, profile) {
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
if (context.htmlContent !== undefined) {
|
|
7
|
+
return validateHtmlArtifactContent(context, context.htmlContent, context.htmlPath, profile);
|
|
8
|
+
}
|
|
8
9
|
if (!context.htmlPath) {
|
|
9
10
|
return [missingHtmlResult(context.channel)];
|
|
10
11
|
}
|
|
11
|
-
let artifact;
|
|
12
12
|
try {
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
fs.stat(context.htmlPath),
|
|
16
|
-
]);
|
|
17
|
-
artifact = {
|
|
18
|
-
path: context.htmlPath,
|
|
19
|
-
content,
|
|
20
|
-
size: stat.size,
|
|
21
|
-
};
|
|
13
|
+
const content = await fs.readFile(context.htmlPath);
|
|
14
|
+
return validateHtmlArtifactContent(context, content, context.htmlPath, profile);
|
|
22
15
|
}
|
|
23
16
|
catch (error) {
|
|
24
17
|
return [missingHtmlResult(context.channel, context.htmlPath, error)];
|
|
25
18
|
}
|
|
19
|
+
}
|
|
20
|
+
/** Validates the exact final bytes, including objects downloaded by Business. */
|
|
21
|
+
export function validateHtmlArtifactContent(context, content, displayPath = 'index.html', profile) {
|
|
22
|
+
const rules = profile?.rules.filter((rule) => rule.stage === 'html-artifact')
|
|
23
|
+
?? getRulesForStage(context.channel, 'html-artifact');
|
|
24
|
+
const artifact = {
|
|
25
|
+
path: displayPath,
|
|
26
|
+
content: typeof content === 'string' ? content : Buffer.from(content).toString('utf-8'),
|
|
27
|
+
size: typeof content === 'string' ? Buffer.byteLength(content) : content.byteLength,
|
|
28
|
+
};
|
|
26
29
|
const results = [];
|
|
27
30
|
for (const rule of rules) {
|
|
28
|
-
if (!rule.detectable || !rule.check)
|
|
31
|
+
if (!rule.detectable || !rule.check)
|
|
29
32
|
continue;
|
|
30
|
-
}
|
|
31
33
|
results.push(evaluateHtmlRule(rule, artifact));
|
|
32
34
|
}
|
|
33
35
|
return results;
|
|
@@ -87,10 +89,10 @@ function resultFromBoolean(rule, passed, file, evidence) {
|
|
|
87
89
|
confidence: rule.confidence,
|
|
88
90
|
};
|
|
89
91
|
}
|
|
90
|
-
function collectExternalResources(html) {
|
|
92
|
+
export function collectExternalResources(html) {
|
|
91
93
|
return collectUrls(html).filter((url) => /^https?:\/\//i.test(url) || /^\/\//.test(url));
|
|
92
94
|
}
|
|
93
|
-
function collectLocalResourceReferences(html) {
|
|
95
|
+
export function collectLocalResourceReferences(html) {
|
|
94
96
|
return collectUrls(html).filter((url) => {
|
|
95
97
|
if (isInlineOrSpecialUrl(url))
|
|
96
98
|
return false;
|
|
@@ -114,7 +116,7 @@ function collectUrls(html) {
|
|
|
114
116
|
function isInlineOrSpecialUrl(url) {
|
|
115
117
|
return /^(data:|blob:|javascript:|mailto:|tel:|about:)/i.test(url);
|
|
116
118
|
}
|
|
117
|
-
function isAllowedExternalResource(url, allowedPatterns) {
|
|
119
|
+
export function isAllowedExternalResource(url, allowedPatterns) {
|
|
118
120
|
if (!allowedPatterns || allowedPatterns.length === 0) {
|
|
119
121
|
return false;
|
|
120
122
|
}
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
export * from './types.js';
|
|
2
|
+
export * from './artifact.js';
|
|
3
|
+
export * from './artifact-rules.js';
|
|
4
|
+
export * from './artifact-qa.js';
|
|
5
|
+
export * from './runtime-load.js';
|
|
2
6
|
export * from './profiles.js';
|
|
3
7
|
export * from './html-validator.js';
|
|
4
8
|
export * from './package-validator.js';
|
package/dist/validation/index.js
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
export * from './types.js';
|
|
2
|
+
export * from './artifact.js';
|
|
3
|
+
export * from './artifact-rules.js';
|
|
4
|
+
export * from './artifact-qa.js';
|
|
5
|
+
export * from './runtime-load.js';
|
|
2
6
|
export * from './profiles.js';
|
|
3
7
|
export * from './html-validator.js';
|
|
4
8
|
export * from './package-validator.js';
|
|
@@ -1,2 +1,4 @@
|
|
|
1
|
+
import type { Platform } from '../types.js';
|
|
1
2
|
import type { ChannelRuleProfile, ValidationContext, ValidationResult } from './types.js';
|
|
2
3
|
export declare function validateDeliveryPackage(context: ValidationContext, profile?: ChannelRuleProfile): Promise<ValidationResult[]>;
|
|
4
|
+
export declare function validateSingleHtmlPackage(channel: Platform, bytes: Uint8Array, artifactName?: string): ValidationResult[];
|
|
@@ -2,10 +2,11 @@ import fs from 'fs/promises';
|
|
|
2
2
|
import fsSync from 'fs';
|
|
3
3
|
import path from 'path';
|
|
4
4
|
import { getChannelRuleProfile } from './profiles.js';
|
|
5
|
+
import { directorySize, listDirectoryEntries } from './artifact.js';
|
|
5
6
|
import { SimpleZipReader } from './zip-reader.js';
|
|
6
7
|
const FIVE_MB = 5 * 1024 * 1024;
|
|
7
8
|
export async function validateDeliveryPackage(context, profile = getChannelRuleProfile(context.channel)) {
|
|
8
|
-
if (!context.packagePath) {
|
|
9
|
+
if (!context.packagePath && !context.packageBytes) {
|
|
9
10
|
return [{
|
|
10
11
|
ruleId: `${context.channel}.package.path.required`,
|
|
11
12
|
channel: context.channel,
|
|
@@ -18,9 +19,10 @@ export async function validateDeliveryPackage(context, profile = getChannelRuleP
|
|
|
18
19
|
confidence: 'high',
|
|
19
20
|
}];
|
|
20
21
|
}
|
|
22
|
+
const packagePath = context.packagePath ?? 'delivery.zip';
|
|
21
23
|
let inventory;
|
|
22
24
|
try {
|
|
23
|
-
inventory = await readPackageInventory(context.
|
|
25
|
+
inventory = await readPackageInventory(packagePath, context.packageBytes);
|
|
24
26
|
}
|
|
25
27
|
catch (error) {
|
|
26
28
|
return [{
|
|
@@ -29,9 +31,9 @@ export async function validateDeliveryPackage(context, profile = getChannelRuleP
|
|
|
29
31
|
stage: 'delivery-package',
|
|
30
32
|
severity: 'error',
|
|
31
33
|
status: 'fail',
|
|
32
|
-
message: `Delivery package is not readable: ${
|
|
34
|
+
message: `Delivery package is not readable: ${packagePath}`,
|
|
33
35
|
recommendation: 'Verify the generated ZIP or delivery directory exists and is readable.',
|
|
34
|
-
file:
|
|
36
|
+
file: packagePath,
|
|
35
37
|
evidence: error instanceof Error ? error.message : String(error),
|
|
36
38
|
owner: 'playcraft-delivery',
|
|
37
39
|
confidence: 'high',
|
|
@@ -62,18 +64,26 @@ export async function validateDeliveryPackage(context, profile = getChannelRuleP
|
|
|
62
64
|
}
|
|
63
65
|
return results;
|
|
64
66
|
}
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
67
|
+
export function validateSingleHtmlPackage(channel, bytes, artifactName = 'index.html') {
|
|
68
|
+
return [
|
|
69
|
+
boolResult(channel, 'package.size.max-5mb', bytes.byteLength <= FIVE_MB, 'Delivery HTML should be smaller than 5 MB.', 'Reduce artifact size or inline assets more aggressively.', artifactName, `actual=${bytes.byteLength}, limit=${FIVE_MB}`),
|
|
70
|
+
boolResult(channel, 'package.single-html.required', bytes.byteLength > 0 && artifactName.toLowerCase().endsWith('.html'), 'Delivery must be one nonempty HTML file.', 'Provide exactly one nonempty HTML artifact.', artifactName),
|
|
71
|
+
];
|
|
72
|
+
}
|
|
73
|
+
async function readPackageInventory(packagePath, packageBytes) {
|
|
74
|
+
if (packageBytes === undefined) {
|
|
75
|
+
const stat = await fs.stat(packagePath);
|
|
76
|
+
if (stat.isDirectory()) {
|
|
77
|
+
const entries = await listDirectoryEntries(packagePath);
|
|
78
|
+
return {
|
|
79
|
+
packagePath,
|
|
80
|
+
entries,
|
|
81
|
+
readText: (entryPath) => readTextFromDirectorySyncUnsupported(packagePath, entryPath),
|
|
82
|
+
size: await directorySize(packagePath),
|
|
83
|
+
};
|
|
84
|
+
}
|
|
75
85
|
}
|
|
76
|
-
const buffer = await fs.readFile(packagePath);
|
|
86
|
+
const buffer = packageBytes === undefined ? await fs.readFile(packagePath) : Buffer.from(packageBytes);
|
|
77
87
|
const zip = new SimpleZipReader(buffer);
|
|
78
88
|
return {
|
|
79
89
|
packagePath,
|
|
@@ -82,38 +92,6 @@ async function readPackageInventory(packagePath) {
|
|
|
82
92
|
size: buffer.length,
|
|
83
93
|
};
|
|
84
94
|
}
|
|
85
|
-
async function readDirectoryEntries(dir) {
|
|
86
|
-
const entries = [];
|
|
87
|
-
const walk = async (current) => {
|
|
88
|
-
const dirEntries = await fs.readdir(current, { withFileTypes: true });
|
|
89
|
-
for (const entry of dirEntries) {
|
|
90
|
-
const fullPath = path.join(current, entry.name);
|
|
91
|
-
const relative = path.relative(dir, fullPath).replace(/\\/g, '/');
|
|
92
|
-
if (entry.isDirectory()) {
|
|
93
|
-
entries.push({
|
|
94
|
-
path: `${relative}/`,
|
|
95
|
-
compressedSize: 0,
|
|
96
|
-
uncompressedSize: 0,
|
|
97
|
-
compressionMethod: 0,
|
|
98
|
-
isDirectory: true,
|
|
99
|
-
});
|
|
100
|
-
await walk(fullPath);
|
|
101
|
-
}
|
|
102
|
-
else {
|
|
103
|
-
const stat = await fs.stat(fullPath);
|
|
104
|
-
entries.push({
|
|
105
|
-
path: relative,
|
|
106
|
-
compressedSize: stat.size,
|
|
107
|
-
uncompressedSize: stat.size,
|
|
108
|
-
compressionMethod: 0,
|
|
109
|
-
isDirectory: false,
|
|
110
|
-
});
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
};
|
|
114
|
-
await walk(dir);
|
|
115
|
-
return entries;
|
|
116
|
-
}
|
|
117
95
|
function readTextFromDirectorySyncUnsupported(_packagePath, _entryPath) {
|
|
118
96
|
const filePath = path.join(_packagePath, _entryPath);
|
|
119
97
|
try {
|
|
@@ -123,23 +101,6 @@ function readTextFromDirectorySyncUnsupported(_packagePath, _entryPath) {
|
|
|
123
101
|
return null;
|
|
124
102
|
}
|
|
125
103
|
}
|
|
126
|
-
async function calculateDirectorySize(dir) {
|
|
127
|
-
let total = 0;
|
|
128
|
-
const walk = async (current) => {
|
|
129
|
-
const entries = await fs.readdir(current, { withFileTypes: true });
|
|
130
|
-
for (const entry of entries) {
|
|
131
|
-
const fullPath = path.join(current, entry.name);
|
|
132
|
-
if (entry.isDirectory()) {
|
|
133
|
-
await walk(fullPath);
|
|
134
|
-
}
|
|
135
|
-
else {
|
|
136
|
-
total += (await fs.stat(fullPath)).size;
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
};
|
|
140
|
-
await walk(dir);
|
|
141
|
-
return total;
|
|
142
|
-
}
|
|
143
104
|
function validateZipLikePackage(channel, inventory) {
|
|
144
105
|
const paths = new Set(inventory.entries.map((entry) => entry.path));
|
|
145
106
|
return [
|
|
@@ -1,5 +1,17 @@
|
|
|
1
|
-
import type { Platform } from '../types.js';
|
|
1
|
+
import type { OutputFormat, 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,3 +219,30 @@ 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
|
+
}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import type { Platform } from '../types.js';
|
|
2
|
+
import type { BrowserDriver, PlayableArtifact, QaStageReport, RuntimeViewport, ValidationResult } from './types.js';
|
|
3
|
+
/**
|
|
4
|
+
* `runtime-load` rules: open the artifact in a headless browser without playing it. All network
|
|
5
|
+
* access outside the artifact is blocked, store-opening calls are recorded instead of followed,
|
|
6
|
+
* and the CTA chain is exercised through whichever CTA entry the artifact has: adsdk's
|
|
7
|
+
* `window.PlayableSDK`, or the platform-injected CTA adapter's `window.PlayCraftCTA`. Either is
|
|
8
|
+
* accepted; what matters is that the CTA reaches the channel's store API.
|
|
9
|
+
*/
|
|
10
|
+
export declare const RUNTIME_LOAD_RULE_IDS: {
|
|
11
|
+
readonly pageLoads: "common.runtime.page.loads";
|
|
12
|
+
readonly requests: "common.runtime.requests.resolved";
|
|
13
|
+
readonly csp: "common.runtime.csp.clean";
|
|
14
|
+
readonly errors: "common.runtime.errors.none";
|
|
15
|
+
readonly firstFrame: "common.runtime.first-frame.content";
|
|
16
|
+
readonly ctaEntry: "common.runtime.cta.entry";
|
|
17
|
+
readonly startSignal: "common.runtime.start-signal.sent";
|
|
18
|
+
readonly noAutoRedirect: "common.runtime.redirect.none-on-load";
|
|
19
|
+
readonly ctaRouted: "common.runtime.cta.routed";
|
|
20
|
+
readonly ctaStoreUrl: "common.runtime.cta.store-url";
|
|
21
|
+
readonly viewportCanvasFit: "common.runtime.viewport.canvas-fit";
|
|
22
|
+
readonly viewportOverflow: "common.runtime.viewport.no-overflow";
|
|
23
|
+
readonly viewportErrors: "common.runtime.viewport.errors";
|
|
24
|
+
readonly viewportContent: "common.runtime.viewport.content";
|
|
25
|
+
};
|
|
26
|
+
export interface RuntimeViewportPreset {
|
|
27
|
+
/** Shown in evidence, e.g. `iphone16 portrait`. */
|
|
28
|
+
name: string;
|
|
29
|
+
viewport: RuntimeViewport;
|
|
30
|
+
}
|
|
31
|
+
export interface RuntimeLoadOptions {
|
|
32
|
+
driver: BrowserDriver;
|
|
33
|
+
profile: Platform;
|
|
34
|
+
/**
|
|
35
|
+
* Viewports to open the artifact in. The first one also runs the CTA checks. Callers pass
|
|
36
|
+
* presets from `@playcraft/common/preview/preview-devices`; default is one phone portrait.
|
|
37
|
+
*/
|
|
38
|
+
viewports?: RuntimeViewportPreset[];
|
|
39
|
+
/** Wait after the load event before inspecting the page. Default 1500 ms. */
|
|
40
|
+
settleMs?: number;
|
|
41
|
+
/** Navigation timeout. Default 15000 ms. */
|
|
42
|
+
timeoutMs?: number;
|
|
43
|
+
}
|
|
44
|
+
export declare const RUNTIME_ORIGIN = "http://artifact.playcraft-qa.test";
|
|
45
|
+
/** Same-origin artifact files and inline data only; no network, workers or frames. */
|
|
46
|
+
export declare const RUNTIME_CSP: string;
|
|
47
|
+
export declare function channelGlobalsFor(profile: Platform): string[];
|
|
48
|
+
/** `runtime-load` stage: opens the artifact in a headless browser. Needs the artifact and a driver. */
|
|
49
|
+
export declare function runRuntimeLoadStage(artifact: PlayableArtifact, options: RuntimeLoadOptions): Promise<QaStageReport>;
|
|
50
|
+
export declare function runRuntimeLoadChecks(artifact: PlayableArtifact, options: RuntimeLoadOptions): Promise<ValidationResult[]>;
|
|
51
|
+
/**
|
|
52
|
+
* Script injected before any page script during runtime QA. It records, without side effects:
|
|
53
|
+
* store-opening calls (channel SDK APIs, `window.open`, `postMessage('download')`), adsdk events
|
|
54
|
+
* (via `window.PlayableSDK.on`), and CSP violations. Results live on `window.__PLAYCRAFT_QA__`.
|
|
55
|
+
*
|
|
56
|
+
* adsdk picks the channel from build-time constants (`AD_NETWORK`, `AD_PROTOCOL`) and only checks
|
|
57
|
+
* that the channel's global exists. The platform CTA adapter instead picks the channel by which
|
|
58
|
+
* global exists, so only the profile's own channel globals are stubbed (`channelGlobalsFor`).
|
|
59
|
+
* Stubs are defined only when the page has none, matching the platform fallbacks in
|
|
60
|
+
* `packages/build/src/platforms/*.ts`.
|
|
61
|
+
*/
|
|
62
|
+
/** adsdk events the probe subscribes to. */
|
|
63
|
+
export declare const ADSDK_PROBE_EVENTS: readonly ["playcraftInit", "playcraftReady", "playcraftStart", "playcraftInteractive", "playcraftFinish", "playcraftInstall"];
|
|
64
|
+
export interface RuntimeProbeOptions {
|
|
65
|
+
/** Channel SDK globals to install recording stubs for; see `channelGlobalsFor`. */
|
|
66
|
+
channelGlobals: string[];
|
|
67
|
+
}
|
|
68
|
+
export interface RuntimeProbeCall {
|
|
69
|
+
api: string;
|
|
70
|
+
url?: string;
|
|
71
|
+
at: number;
|
|
72
|
+
}
|
|
73
|
+
export interface RuntimeProbeState {
|
|
74
|
+
calls: RuntimeProbeCall[];
|
|
75
|
+
events: Array<{
|
|
76
|
+
name: string;
|
|
77
|
+
at: number;
|
|
78
|
+
}>;
|
|
79
|
+
csp: Array<{
|
|
80
|
+
blockedURI: string;
|
|
81
|
+
violatedDirective: string;
|
|
82
|
+
}>;
|
|
83
|
+
sdk: boolean;
|
|
84
|
+
/** The platform CTA adapter (`window.PlayCraftCTA.jump`) is present. */
|
|
85
|
+
adapter: boolean;
|
|
86
|
+
/** The export wrote store links for the CTA adapter (`window.__PLAYCRAFT_STORE_URLS__`). */
|
|
87
|
+
storeUrls: boolean;
|
|
88
|
+
}
|
|
89
|
+
export declare function buildRuntimeProbeScript(options: RuntimeProbeOptions): string;
|