ttmg-pack 0.4.3 → 0.4.4

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 (44) hide show
  1. package/dist/index.js +20 -9
  2. package/dist/index.js.map +1 -1
  3. package/dist/libs/makePkgs/addDepsToPackages.d.ts +2 -1
  4. package/package.json +1 -1
  5. package/CHANGELOG.md +0 -392
  6. package/__TEST__/tests/fixtures/check-project/non-unity/src/game.js +0 -1
  7. package/__TEST__/tests/fixtures/check-project/non-unity/src/game.json +0 -3
  8. package/__TEST__/tests/fixtures/check-project/subpackages-camel-case/src/game.js +0 -1
  9. package/__TEST__/tests/fixtures/check-project/subpackages-camel-case/src/game.json +0 -4
  10. package/__TEST__/tests/fixtures/check-project/unity-large-config-disabled/src/game.js +0 -1
  11. package/__TEST__/tests/fixtures/check-project/unity-large-config-disabled/src/game.json +0 -4
  12. package/__TEST__/tests/fixtures/check-project/unity-large-config-disabled/src/webgl-wasm-split.json +0 -3
  13. package/__TEST__/tests/fixtures/check-project/unity-large-config-enabled/src/game.js +0 -1
  14. package/__TEST__/tests/fixtures/check-project/unity-large-config-enabled/src/game.json +0 -4
  15. package/__TEST__/tests/fixtures/check-project/unity-large-config-enabled/src/webgl-wasm-split.json +0 -3
  16. package/__TEST__/tests/fixtures/check-project/unity-large-no-config/src/game.js +0 -1
  17. package/__TEST__/tests/fixtures/check-project/unity-large-no-config/src/game.json +0 -4
  18. package/__TEST__/tests/fixtures/check-project/unity-small/src/game.js +0 -1
  19. package/__TEST__/tests/fixtures/check-project/unity-small/src/game.json +0 -4
  20. package/__TEST__/tests/fixtures/game-cocos/game.json +0 -3
  21. package/__TEST__/tests/fixtures/game-invalid-json/game.json +0 -1
  22. package/__TEST__/tests/fixtures/game-no-config/game.js +0 -1
  23. package/__TEST__/tests/fixtures/game-no-engine/game.json +0 -3
  24. package/__TEST__/tests/fixtures/game-unity/game.json +0 -15
  25. package/__TEST__/tests/libs/checkProject.test.js +0 -68
  26. package/__TEST__/tests/runner-simple.js +0 -120
  27. package/__TEST__/tests/runner.js +0 -102
  28. package/__TEST__/tests/utils/Deferred.test.js +0 -69
  29. package/__TEST__/tests/utils/asyncPool.test.js +0 -48
  30. package/__TEST__/tests/utils/getCheckConfig.test.js +0 -24
  31. package/__TEST__/tests/utils/getGameEngine.test.js +0 -32
  32. package/__TEST__/tests/utils/getIndependentPackagesConfig.test.js +0 -27
  33. package/__TEST__/tests/utils/getMd5.test.js +0 -31
  34. package/__TEST__/tests/utils/getSubpackagesConfig.test.js +0 -26
  35. package/__TEST__/tests/utils/unity.test.js +0 -30
  36. package/dist/libs/checkPkgs/checkPkgPath.d.ts +0 -1
  37. package/dist/libs/extractPkgs/hasAnyNodeModulesShallow.d.ts +0 -1
  38. package/dist/libs/extractPkgs/index.d.ts +0 -6
  39. package/dist/libs/makePkgs/extract/NodeModuleExtractor.d.ts +0 -39
  40. package/dist/libs/makePkgs/extract/hasAnyNodeModulesShallow.d.ts +0 -1
  41. package/dist/libs/makePkgs/extract/index.d.ts +0 -6
  42. package/dist/libs/makePkgs/extract.d.ts +0 -4
  43. package/dist/utils/NodeModuleExtractor.d.ts +0 -38
  44. package/dist/utils/overrideConfig.d.ts +0 -8
package/dist/index.js CHANGED
@@ -1,9 +1,9 @@
1
1
  /**
2
2
  * ==========================================
3
3
  * @Description: ttmg pack
4
- * @Version: 0.4.3
4
+ * @Version: 0.4.4
5
5
  * @Author: zhanghongyang.mocha
6
- * @Date: 2026-03-12 18:19:30
6
+ * @Date: 2026-03-19 15:31:24
7
7
  * ==========================================
8
8
  */
9
9
  'use strict';
@@ -1837,7 +1837,7 @@ async function getPluginInfo(params) {
1837
1837
  }
1838
1838
  return { url: meta.PackageCDNURL, md5: meta.PackageMD5 };
1839
1839
  }
1840
- async function addDepsToPackages(gameEntry, outputDir, allDeps) {
1840
+ async function addDepsToPackages(gameEntry, outputDir, allDeps, config) {
1841
1841
  var _a;
1842
1842
  const gamePackConfigPath = path.join(outputDir, GAME_PACK_CONFIG_FILE_NAME);
1843
1843
  const gameJsonPath = path.join(gameEntry, GAME_ORIGIN_CONFIG_FILE_NAME);
@@ -1865,10 +1865,21 @@ async function addDepsToPackages(gameEntry, outputDir, allDeps) {
1865
1865
  continue;
1866
1866
  const version = pluginConfig[pluginName].version;
1867
1867
  const pluginPkgName = `${pluginName}_${version}`;
1868
- const { url, md5 } = await getPluginInfo({
1869
- plugin_name: pluginName.toLowerCase(),
1870
- plugin_version: version
1871
- });
1868
+ let url = '';
1869
+ let md5 = '';
1870
+ if (config === null || config === void 0 ? void 0 : config.dev) {
1871
+ try {
1872
+ const res = await getPluginInfo({
1873
+ plugin_name: pluginName.toLowerCase(),
1874
+ plugin_version: version
1875
+ });
1876
+ url = res.url;
1877
+ md5 = res.md5;
1878
+ }
1879
+ catch (error) {
1880
+ throw new Error(`[ttmg-pack] Failed to get plugin info: ${error.message} plugin_name: ${pluginName}, plugin_version: ${version}`);
1881
+ }
1882
+ }
1872
1883
  gamePackConfig.packages[pkgName].dependencies.push(pluginPkgName);
1873
1884
  if (!gamePackConfig.packages[pluginPkgName]) {
1874
1885
  gamePackConfig.packages[pluginPkgName] = {
@@ -2021,7 +2032,7 @@ async function collectDeps(config, packages) {
2021
2032
  packageDeps: {},
2022
2033
  pluginDeps: {},
2023
2034
  });
2024
- await addDepsToPackages(gameEntry, gameOutput, result.pluginDeps);
2035
+ await addDepsToPackages(gameEntry, gameOutput, result.pluginDeps, config);
2025
2036
  return result;
2026
2037
  }
2027
2038
  function getRootPrefixes(gameEntry) {
@@ -2407,7 +2418,7 @@ async function buildPkgs(config, context = {}) {
2407
2418
  let startTime = Date.now();
2408
2419
  logger.init(outputDir, true);
2409
2420
  logger.info(t('log.build.version', {
2410
- version: "0.4.3",
2421
+ version: "0.4.4",
2411
2422
  }));
2412
2423
  logger.info(t('log.build.start', { startTime }));
2413
2424
  /**