@invarn/cibuild 2.0.3 → 2.0.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.
@@ -1 +1 @@
1
- {"version":3,"file":"ui-fidelity-render.d.ts","sourceRoot":"","sources":["../../../../src/yaml/steps/ui-fidelity-render.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiDG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AACxD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAEpE;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC;;;;;;OAMG;IACH,cAAc,CAAC,EAAE,MAAM,GAAG,QAAQ,CAAC;IACnC;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;;;;OAKG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,mFAAmF;IACnF,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,6DAA6D;IAC7D,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;CACzB;AAED;;;;;GAKG;AACH,eAAO,MAAM,mBAAmB,YAAY,CAAC;AAE7C,mFAAmF;AACnF,eAAO,MAAM,aAAa,IAAI,CAAC;AAE/B,iDAAiD;AACjD,eAAO,MAAM,eAAe,6BAA8B,CAAC;AAC3D,MAAM,MAAM,aAAa,GAAG,CAAC,OAAO,eAAe,CAAC,CAAC,MAAM,CAAC,CAAC;AAE7D,sEAAsE;AACtE,eAAO,MAAM,sBAAsB,EAAE,aAAsB,CAAC;AAE5D,+EAA+E;AAC/E,eAAO,MAAM,wBAAwB,mBAAmB,CAAC;AAEzD;;;;;;;GAOG;AACH,eAAO,MAAM,2BAA2B,QAAmB,CAAC;AAE5D,MAAM,WA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C;IAC7D,mBAAmB,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,uBAAuB,GAAG,MAAM,CAAC;CAC/E;AAyhCD;;;GAGG;AACH,wBAAgB,wBAAwB,IAAI,qBAAqB,CAShE;AAED;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,kBAAkB,GAAG,MAAM,CAUvE;AAED;;;;GAIG;AACH,qBAAa,4BAA6B,SAAQ,gBAAgB;IAChE,yBAAyB,CACvB,MAAM,EAAE,sBAAsB,EAC9B,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAC5B,OAAO,EAAE,QAAQ,GAChB,qBAAqB,EAAE;IAoCpB,OAAO,CACX,MAAM,EAAE,sBAAsB,EAC9B,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAC5B,OAAO,EAAE,QAAQ,GAChB,OAAO,CAAC,OAAO,CAAC;CA0DpB"}
@@ -910,29 +910,17 @@ function findAssetCatalogs(root) {
910
910
  return found.sort();
911
911
  }
912
912
 
913
- function compileAssetCatalogs(packageDir, harnessDir) {
914
- var catalogs = findAssetCatalogs(packageDir);
915
- if (catalogs.length === 0) return;
916
-
917
- var binResult = runSwift(['build', '--package-path', harnessDir, '--show-bin-path']);
918
- if (binResult.status !== 0) {
919
- logError('asset-catalog compile skipped: could not resolve the build bin path');
920
- return;
921
- }
922
- var binPath = String(binResult.stdout || '').trim().split('\n').pop().trim();
923
- if (!binPath) {
924
- logError('asset-catalog compile skipped: empty build bin path');
925
- return;
926
- }
913
+ // Run actool over the given catalogs, emitting Assets.car into outDir.
914
+ // Best-effort: a failure is logged (warn-and-continue) and rendering proceeds.
915
+ function compileCatalogsInto(catalogs, outDir, label) {
927
916
  try {
928
- fs.mkdirSync(binPath, { recursive: true });
917
+ fs.mkdirSync(outDir, { recursive: true });
929
918
  } catch (mkdirError) {
930
919
  // best effort -- actool reports a missing output dir itself
931
920
  }
932
-
933
921
  var args = ['actool'].concat(catalogs);
934
922
  args.push(
935
- '--compile', binPath,
923
+ '--compile', outDir,
936
924
  '--platform', 'macosx',
937
925
  '--minimum-deployment-target', ASSET_CATALOG_MIN_MACOS,
938
926
  '--output-format', 'human-readable-text'
@@ -948,12 +936,54 @@ function compileAssetCatalogs(packageDir, harnessDir) {
948
936
  var detail = (result.stderr || '') +
949
937
  (result.error ? String(result.error.message || result.error) : '');
950
938
  logError(
951
- 'asset-catalog compile failed (continuing; catalog images may not ' +
952
- 'resolve): ' + sanitizeMessage(detail.trim())
939
+ 'asset-catalog compile failed for ' + label + ' (continuing; catalog ' +
940
+ 'images may not resolve): ' + sanitizeMessage(detail.trim())
953
941
  );
942
+ }
943
+ }
944
+
945
+ // SwiftUI resolves Image("name") against Bundle.main and
946
+ // Image("name", bundle: .module) against a target's own resource bundle.
947
+ // swift build copies a .process'd .xcassets into the module bundle but never
948
+ // compiles it, and a loose catalog is copied nowhere. So compile twice:
949
+ // the package's source catalogs into the bin dir (= Bundle.main), AND each
950
+ // module bundle's copied catalog in place (= Bundle.module). This covers both
951
+ // reference idioms, so the agent need not know which bundle the renderer uses.
952
+ function compileAssetCatalogs(packageDir, harnessDir) {
953
+ var sourceCatalogs = findAssetCatalogs(packageDir);
954
+ if (sourceCatalogs.length === 0) return;
955
+
956
+ var binResult = runSwift(['build', '--package-path', harnessDir, '--show-bin-path']);
957
+ if (binResult.status !== 0) {
958
+ logError('asset-catalog compile skipped: could not resolve the build bin path');
959
+ return;
960
+ }
961
+ var binPath = String(binResult.stdout || '').trim().split('\n').pop().trim();
962
+ if (!binPath) {
963
+ logError('asset-catalog compile skipped: empty build bin path');
954
964
  return;
955
965
  }
956
- log('compiled ' + catalogs.length + ' asset catalog(s) for macOS');
966
+
967
+ // Bundle.main: the package's source catalogs, merged into the bin dir.
968
+ compileCatalogsInto(sourceCatalogs, binPath, 'Bundle.main');
969
+
970
+ // Bundle.module: each *.bundle in the bin dir that carries a copied catalog,
971
+ // compiled in place so Image(..., bundle: .module) resolves.
972
+ var entries;
973
+ try {
974
+ entries = fs.readdirSync(binPath, { withFileTypes: true });
975
+ } catch (readError) {
976
+ entries = [];
977
+ }
978
+ for (var i = 0; i < entries.length; i++) {
979
+ var entry = entries[i];
980
+ if (!entry.isDirectory() || entry.name.slice(-7) !== '.bundle') continue;
981
+ var bundleDir = path.join(binPath, entry.name);
982
+ var bundleCatalogs = findAssetCatalogs(bundleDir);
983
+ if (bundleCatalogs.length > 0) {
984
+ compileCatalogsInto(bundleCatalogs, bundleDir, entry.name);
985
+ }
986
+ }
957
987
  }
958
988
  `;
959
989
  /**
@@ -68,7 +68,11 @@ const FAKE_SWIFT_LINES = [
68
68
  ' *) shift ;;',
69
69
  ' esac',
70
70
  ' done',
71
- ' if [ -n "$showbin" ]; then echo "$pkg/.build/debug"; exit 0; fi',
71
+ ' if [ -n "$showbin" ]; then',
72
+ ' bp="$pkg/.build/debug"',
73
+ ' [ -n "$FAKE_SWIFT_MODULE_CATALOG" ] && mkdir -p "$bp/$FAKE_SWIFT_MODULE_CATALOG.bundle/Media.xcassets"',
74
+ ' echo "$bp"; exit 0',
75
+ ' fi',
72
76
  ' name="${product:-$target}"',
73
77
  ' if [ "$name" = "RenderProbe" ]; then',
74
78
  ' if [ -n "$FAKE_SWIFT_PROBE_FAIL" ]; then',
@@ -915,6 +919,29 @@ describe('render script runtime (package_source: repo)', () => {
915
919
  expect(xcrunCalls).toContain('--compile');
916
920
  expect(xcrunCalls).toContain('--platform macosx');
917
921
  });
922
+ test('also compiles catalogs in module bundles for Bundle.module references', async () => {
923
+ const project = makeProject({ screens: { HomeView: 'home.png' } });
924
+ writeReference(project, 'home.png');
925
+ // Source catalog drives the main-bundle (Bundle.main) compile. The module
926
+ // bundle — which the fake toolchain materializes to mimic `swift build`
927
+ // copying a .process resource — must ALSO be compiled in place, or an
928
+ // Image("name", bundle: .module) reference finds only the raw catalog.
929
+ const catalog = join(project.packageDir, 'Assets', 'Media.xcassets');
930
+ mkdirSync(catalog, { recursive: true });
931
+ writeFileSync(join(catalog, 'Contents.json'), '{}');
932
+ const script = await buildScript(project, { package_source: 'repo' });
933
+ const xcrunLog = join(project.dir, 'xcrun-invocations.log');
934
+ const run = runScript(project, script, {
935
+ FAKE_XCRUN_LOG: xcrunLog,
936
+ FAKE_SWIFT_MODULE_CATALOG: 'FixtureViews',
937
+ });
938
+ expect(run.status).toBe(0);
939
+ const calls = readFileSync(xcrunLog, 'utf-8').trim().split('\n');
940
+ // The module bundle's own catalog is compiled into the bundle directory.
941
+ const moduleCompile = calls.find((c) => c.includes('.bundle/Media.xcassets'));
942
+ expect(moduleCompile).toBeTruthy();
943
+ expect(moduleCompile).toMatch(/--compile \S+\.bundle(\s|$)/);
944
+ });
918
945
  test('does not invoke actool when the package has no asset catalogs', async () => {
919
946
  const project = makeProject({ screens: { HomeView: 'home.png' } });
920
947
  writeReference(project, 'home.png');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@invarn/cibuild",
3
- "version": "2.0.3",
3
+ "version": "2.0.4",
4
4
  "description": "CI Build CLI — local pipeline orchestration and validation",
5
5
  "type": "module",
6
6
  "main": "dist/cli.cjs",