@playcraft/build 0.2.15-test-a → 0.2.16-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 (122) 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/engines/playable-scripts-adapter.js +5 -2
  5. package/dist/index.d.ts +4 -21
  6. package/dist/index.js +2 -12
  7. package/dist/platforms/adikteev.js +0 -1
  8. package/dist/platforms/applovin.js +0 -1
  9. package/dist/platforms/base.d.ts +0 -4
  10. package/dist/platforms/base.js +6 -25
  11. package/dist/platforms/bigo.js +0 -1
  12. package/dist/platforms/facebook.js +0 -1
  13. package/dist/platforms/google.js +0 -1
  14. package/dist/platforms/inmobi.js +0 -1
  15. package/dist/platforms/ironsource.js +0 -1
  16. package/dist/platforms/liftoff.js +0 -1
  17. package/dist/platforms/mintegral.js +0 -1
  18. package/dist/platforms/moloco.js +0 -1
  19. package/dist/platforms/playcraft.js +0 -1
  20. package/dist/platforms/remerge.js +0 -1
  21. package/dist/platforms/snapchat.js +0 -1
  22. package/dist/platforms/tiktok.js +0 -1
  23. package/dist/platforms/unity.js +0 -1
  24. package/dist/types.d.ts +2 -10
  25. package/dist/validation/html-validator.d.ts +0 -5
  26. package/dist/validation/html-validator.js +17 -19
  27. package/dist/validation/index.d.ts +0 -5
  28. package/dist/validation/index.js +0 -5
  29. package/dist/validation/package-validator.d.ts +0 -2
  30. package/dist/validation/package-validator.js +64 -25
  31. package/dist/validation/profiles.d.ts +1 -13
  32. package/dist/validation/profiles.js +0 -27
  33. package/dist/validation/source-scanner.d.ts +0 -11
  34. package/dist/validation/source-scanner.js +2 -32
  35. package/dist/validation/types.d.ts +2 -201
  36. package/dist/validation/types.js +1 -1
  37. package/dist/validation/validation-runner.d.ts +2 -22
  38. package/dist/validation/validation-runner.js +3 -64
  39. package/dist/validation/zip-reader.d.ts +0 -7
  40. package/dist/validation/zip-reader.js +26 -159
  41. package/dist/vite/config-builder-generic.d.ts +1 -3
  42. package/dist/vite/config-builder-generic.js +7 -9
  43. package/dist/vite/config-builder.js +1 -1
  44. package/dist/vite/plugin-platform.js +30 -16
  45. package/dist/vite/plugin-source-builder.d.ts +14 -2
  46. package/dist/vite/plugin-source-builder.js +997 -61
  47. package/dist/vite-builder.d.ts +5 -4
  48. package/dist/vite-builder.js +34 -33
  49. package/package.json +4 -30
  50. package/dist/audio-source-files.d.ts +0 -5
  51. package/dist/audio-source-files.js +0 -135
  52. package/dist/delivery/agent-build-runner.d.ts +0 -44
  53. package/dist/delivery/agent-build-runner.js +0 -365
  54. package/dist/delivery/agent-build-source.d.ts +0 -8
  55. package/dist/delivery/agent-build-source.js +0 -25
  56. package/dist/delivery/artifact-descriptor.d.ts +0 -31
  57. package/dist/delivery/artifact-descriptor.js +0 -237
  58. package/dist/delivery/artifact-package.d.ts +0 -43
  59. package/dist/delivery/artifact-package.js +0 -283
  60. package/dist/delivery/build-plan.d.ts +0 -4
  61. package/dist/delivery/build-plan.js +0 -189
  62. package/dist/delivery/build-plan.types.d.ts +0 -51
  63. package/dist/delivery/build-plan.types.js +0 -1
  64. package/dist/delivery/command-isolation.d.ts +0 -21
  65. package/dist/delivery/command-isolation.js +0 -327
  66. package/dist/delivery/commands.d.ts +0 -5
  67. package/dist/delivery/commands.js +0 -146
  68. package/dist/delivery/files.d.ts +0 -9
  69. package/dist/delivery/files.js +0 -144
  70. package/dist/delivery/git-source-fingerprint.d.ts +0 -2
  71. package/dist/delivery/git-source-fingerprint.js +0 -58
  72. package/dist/delivery/isolated-source.d.ts +0 -5
  73. package/dist/delivery/isolated-source.js +0 -131
  74. package/dist/delivery/output-publication.d.ts +0 -21
  75. package/dist/delivery/output-publication.js +0 -444
  76. package/dist/delivery/project-delivery.d.ts +0 -6
  77. package/dist/delivery/project-delivery.js +0 -287
  78. package/dist/delivery/recipe-build-plan.d.ts +0 -4
  79. package/dist/delivery/recipe-build-plan.js +0 -53
  80. package/dist/delivery/recipe.d.ts +0 -20
  81. package/dist/delivery/recipe.js +0 -211
  82. package/dist/delivery/safe-path.d.ts +0 -2
  83. package/dist/delivery/safe-path.js +0 -18
  84. package/dist/delivery/types.d.ts +0 -76
  85. package/dist/delivery/types.js +0 -1
  86. package/dist/production-animation-presence.d.ts +0 -2
  87. package/dist/production-animation-presence.js +0 -146
  88. package/dist/production-inputs.d.ts +0 -30
  89. package/dist/production-inputs.js +0 -262
  90. package/dist/production-source-paths.d.ts +0 -5
  91. package/dist/production-source-paths.js +0 -27
  92. package/dist/redirect-policy.d.ts +0 -23
  93. package/dist/redirect-policy.js +0 -25
  94. package/dist/validation/artifact-qa.d.ts +0 -36
  95. package/dist/validation/artifact-qa.js +0 -263
  96. package/dist/validation/artifact-rules.d.ts +0 -39
  97. package/dist/validation/artifact-rules.js +0 -451
  98. package/dist/validation/artifact.d.ts +0 -14
  99. package/dist/validation/artifact.js +0 -188
  100. package/dist/validation/playwright-driver.d.ts +0 -37
  101. package/dist/validation/playwright-driver.js +0 -302
  102. package/dist/validation/runtime-cover.d.ts +0 -32
  103. package/dist/validation/runtime-cover.js +0 -120
  104. package/dist/validation/runtime-load.d.ts +0 -141
  105. package/dist/validation/runtime-load.js +0 -812
  106. package/dist/vite/source-builder-asset-paths.d.ts +0 -25
  107. package/dist/vite/source-builder-asset-paths.js +0 -154
  108. package/dist/vite/source-builder-esm.d.ts +0 -7
  109. package/dist/vite/source-builder-esm.js +0 -877
  110. package/dist/vite/source-builder-types.d.ts +0 -14
  111. package/dist/vite/source-builder-types.js +0 -1
  112. package/dist/vite/workspace.d.ts +0 -6
  113. package/dist/vite/workspace.js +0 -41
  114. package/dist/workspace-css-imports.d.ts +0 -2
  115. package/dist/workspace-css-imports.js +0 -139
  116. package/dist/workspace-model-source.d.ts +0 -14
  117. package/dist/workspace-model-source.js +0 -184
  118. package/dist/workspace-public-imports.d.ts +0 -11
  119. package/dist/workspace-public-imports.js +0 -232
  120. package/dist/workspace-public-source.d.ts +0 -15
  121. package/dist/workspace-public-source.js +0 -564
  122. package/templates/patches/playcraft-redirect-policy.js +0 -115
@@ -1,25 +0,0 @@
1
- import type { ImportMapAsset } from '../loaders/playcanvas-loader.js';
2
- /**
3
- * 构建文件夹 ID -> 完整目录路径的映射
4
- * PlayCraft Git 项目的 assets.json 中,资产的 path 字段是文件夹 ID 数组(如 [30097022, 30097024]),
5
- * 需要通过递归遍历构建每个 folder ID 对应的完整路径(如 "LiteCreator/System")
6
- */
7
- export declare function buildFolderFullPathMap(assets: Record<string, any>): Map<string, string>;
8
- /**
9
- * 从资产的 path 数组(文件夹 ID 列表)重建 treePath
10
- * path 数组中最后一个 ID 是直接父文件夹
11
- */
12
- export declare function resolveTreePathFromPathArray(pathIds: any[], folderFullPathMap: Map<string, string>): string;
13
- /**
14
- * Resolve the source file path for a script asset.
15
- * @param assets - 可选,所有资产的 map,用于从 path 数组重建 treePath(PlayCraft Git 仓库场景)
16
- */
17
- export declare function resolveScriptSourcePath(assetData: any, scriptId: string, projectDir: string, assets?: Record<string, any>): Promise<string | null>;
18
- /**
19
- * 构建脚本的文件夹路径(从 asset.path 数组)
20
- */
21
- export declare function buildScriptFolderPath(pathIds: any[], folderMap: Map<string, string>): string;
22
- /**
23
- * 根据 import map 确定目标路径
24
- */
25
- export declare function resolveTargetPathFromImportMap(folderPath: string, filename: string, importMap: ImportMapAsset): string | null;
@@ -1,154 +0,0 @@
1
- import fs from 'fs/promises';
2
- import path from 'path';
3
- /**
4
- * 构建文件夹 ID -> 完整目录路径的映射
5
- * PlayCraft Git 项目的 assets.json 中,资产的 path 字段是文件夹 ID 数组(如 [30097022, 30097024]),
6
- * 需要通过递归遍历构建每个 folder ID 对应的完整路径(如 "LiteCreator/System")
7
- */
8
- // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Preserve the existing dynamic project schema and bindings during extraction.
9
- export function buildFolderFullPathMap(assets) {
10
- const folderMap = new Map();
11
- const buildPath = (folderId, visited = new Set()) => {
12
- if (visited.has(folderId))
13
- return '';
14
- if (folderMap.has(folderId))
15
- return folderMap.get(folderId);
16
- visited.add(folderId);
17
- // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Preserve the existing dynamic project schema and bindings during extraction.
18
- const folder = assets[folderId];
19
- if (!folder || folder.type !== 'folder')
20
- return '';
21
- const pathIds = folder.path || [];
22
- if (pathIds.length === 0) {
23
- folderMap.set(folderId, folder.name);
24
- return folder.name;
25
- }
26
- // 最后一个 ID 是直接父文件夹
27
- const parentId = String(pathIds[pathIds.length - 1]);
28
- const parentPath = buildPath(parentId, visited);
29
- const fullPath = parentPath ? `${parentPath}/${folder.name}` : folder.name;
30
- folderMap.set(folderId, fullPath);
31
- return fullPath;
32
- };
33
- for (const [id, asset] of Object.entries(assets)) {
34
- // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Preserve the existing dynamic project schema and bindings during extraction.
35
- if (asset.type === 'folder') {
36
- buildPath(id);
37
- }
38
- }
39
- return folderMap;
40
- }
41
- /**
42
- * 从资产的 path 数组(文件夹 ID 列表)重建 treePath
43
- * path 数组中最后一个 ID 是直接父文件夹
44
- */
45
- export function resolveTreePathFromPathArray(
46
- // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Preserve the existing dynamic project schema and bindings during extraction.
47
- pathIds, folderFullPathMap) {
48
- if (!pathIds || !Array.isArray(pathIds) || pathIds.length === 0) {
49
- return '';
50
- }
51
- const parentFolderId = String(pathIds[pathIds.length - 1]);
52
- return folderFullPathMap.get(parentFolderId) || '';
53
- }
54
- /**
55
- * Resolve the source file path for a script asset.
56
- * @param assets - 可选,所有资产的 map,用于从 path 数组重建 treePath(PlayCraft Git 仓库场景)
57
- */
58
- export async function resolveScriptSourcePath(
59
- // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Preserve the existing dynamic project schema and bindings during extraction.
60
- assetData, scriptId, projectDir,
61
- // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Preserve the existing dynamic project schema and bindings during extraction.
62
- assets) {
63
- if (assetData.file?.url) {
64
- const fullPath = path.join(projectDir, assetData.file.url);
65
- try {
66
- await fs.access(fullPath);
67
- return fullPath;
68
- }
69
- catch {
70
- // file.url 指向的文件不存在,继续搜索
71
- }
72
- }
73
- if (assetData.file?.filename) {
74
- const filename = assetData.file.filename;
75
- const revision = assetData.revision ?? 1;
76
- const candidates = [
77
- // PlayCanvas 标准结构
78
- path.join(projectDir, 'files', 'assets', String(scriptId), String(revision), filename),
79
- path.join(projectDir, 'files', 'assets', String(scriptId), '1', filename),
80
- path.join(projectDir, 'files', 'assets', String(scriptId), filename),
81
- ];
82
- // PlayCraft 结构:使用 treePath
83
- if (assetData.treePath) {
84
- candidates.push(path.join(projectDir, 'assets', assetData.treePath, filename));
85
- candidates.push(path.join(projectDir, assetData.treePath, filename));
86
- }
87
- // PlayCraft Git 仓库:从 path 数组重建 treePath
88
- if (assets && assetData.path && Array.isArray(assetData.path) && assetData.path.length > 0) {
89
- const folderFullPathMap = buildFolderFullPathMap(assets);
90
- const computedTreePath = resolveTreePathFromPathArray(assetData.path, folderFullPathMap);
91
- if (computedTreePath) {
92
- candidates.push(path.join(projectDir, 'assets', computedTreePath, filename));
93
- candidates.push(path.join(projectDir, computedTreePath, filename));
94
- }
95
- }
96
- // 最后尝试直接在 assets/ 根目录下查找
97
- candidates.push(path.join(projectDir, 'assets', filename));
98
- for (const candidate of candidates) {
99
- try {
100
- await fs.access(candidate);
101
- return candidate;
102
- }
103
- catch {
104
- // try next
105
- }
106
- }
107
- }
108
- return null;
109
- }
110
- /**
111
- * 构建脚本的文件夹路径(从 asset.path 数组)
112
- */
113
- // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Preserve the existing dynamic project schema and bindings during extraction.
114
- export function buildScriptFolderPath(pathIds, folderMap) {
115
- const pathNames = [];
116
- // 跳过根文件夹(第一个元素),构建路径
117
- for (let i = 1; i < pathIds.length; i++) {
118
- const folderId = String(pathIds[i]);
119
- const folderName = folderMap.get(folderId);
120
- if (folderName) {
121
- pathNames.push(folderName);
122
- }
123
- }
124
- return pathNames.join('/');
125
- }
126
- /**
127
- * 根据 import map 确定目标路径
128
- */
129
- export function resolveTargetPathFromImportMap(folderPath, filename, importMap) {
130
- const imports = importMap.content.imports || {};
131
- // 尝试匹配 import map 中的前缀
132
- for (const [prefix, target] of Object.entries(imports)) {
133
- // prefix 可能是 "Gameplay/" 这样的目录前缀
134
- if (prefix.endsWith('/')) {
135
- const prefixName = prefix.slice(0, -1); // 移除末尾的 '/'
136
- // 检查文件夹路径是否以该前缀开始
137
- if (folderPath === prefixName || folderPath.startsWith(prefixName + '/')) {
138
- // 计算相对于前缀的剩余路径
139
- const relativePath = folderPath === prefixName ? '' : folderPath.slice(prefixName.length + 1);
140
- // 构建目标路径(使用正斜杠,因为 ESM import 需要 URL 风格路径)
141
- const targetBase = target.startsWith('./') ? target.slice(2) : target;
142
- const resultPath = relativePath
143
- ? path.join(targetBase, relativePath, filename)
144
- : path.join(targetBase, filename);
145
- // 确保使用正斜杠(Windows 兼容)
146
- return resultPath.replace(/\\/g, '/');
147
- }
148
- }
149
- }
150
- // 如果没有匹配的前缀,使用原始路径
151
- const defaultPath = folderPath ? path.join(folderPath, filename) : filename;
152
- // 确保使用正斜杠(Windows 兼容)
153
- return defaultPath.replace(/\\/g, '/');
154
- }
@@ -1,7 +0,0 @@
1
- import type { PlayCanvasProject } from '../loaders/playcanvas-loader.js';
2
- import type { PlayCraftProject } from '../loaders/playcraft-loader.js';
3
- import type { SourceBuilderPluginOptions } from './source-builder-types.js';
4
- /**
5
- * 生成 ESM 模板文件
6
- */
7
- export declare function generateESMTemplate(projectConfig: PlayCanvasProject | PlayCraftProject, options: SourceBuilderPluginOptions, config: any): Promise<void>;