MCPcopy Create free account
hub / github.com/NativeScript/SimDeck / compilePreviewSourceModule

Function compilePreviewSourceModule

scripts/experimental/swiftui-preview.mjs:484–525  ·  view source on GitHub ↗
(
  context,
  sanitizedPath,
  sourceModule,
  args,
  xcode,
)

Source from the content-addressed store, hash-verified

482}
483
484function compilePreviewSourceModule(
485 context,
486 sanitizedPath,
487 sourceModule,
488 args,
489 xcode,
490) {
491 if (
492 fs.existsSync(sourceModule.objectPath) &&
493 fs.existsSync(sourceModule.modulePath)
494 ) {
495 return;
496 }
497 fs.mkdirSync(sourceModule.directory, { recursive: true });
498 run("xcrun", [
499 "--sdk",
500 "iphonesimulator",
501 "swiftc",
502 "-target",
503 context.target,
504 "-sdk",
505 context.sdkPath,
506 "-parse-as-library",
507 "-Onone",
508 "-enable-testing",
509 "-emit-module",
510 "-emit-module-path",
511 sourceModule.modulePath,
512 "-emit-object",
513 "-module-name",
514 sourceModule.moduleName,
515 "-framework",
516 "SwiftUI",
517 "-framework",
518 "UIKit",
519 ...xcodeSwiftcArgs(xcode),
520 sanitizedPath,
521 ...arrayArg(args.swiftcArg),
522 "-o",
523 sourceModule.objectPath,
524 ]);
525}
526
527async function sendTcpReloadPath(context, dylibPath) {
528 const containerPath = appContainerPath(context);

Callers 1

reloadPreviewFunction · 0.85

Calls 3

xcodeSwiftcArgsFunction · 0.85
arrayArgFunction · 0.85
runFunction · 0.70

Tested by

no test coverage detected