@swifttui/build 0.1.9 → 0.1.11
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/README.md
CHANGED
|
@@ -62,7 +62,8 @@ Toolchain defaults match the repo:
|
|
|
62
62
|
`-Xswiftc -Osize -Xswiftc -Xfrontend -Xswiftc -disable-llvm-merge-functions-pass`
|
|
63
63
|
- Initial memory: `536870912`
|
|
64
64
|
- Max memory: `4294967296`
|
|
65
|
-
- Stack size: `
|
|
65
|
+
- Stack size: `16777216` (16 MiB — the earlier 1 MiB default overflowed the
|
|
66
|
+
wasm linear-memory stack in deep scenes)
|
|
66
67
|
|
|
67
68
|
Callers can override `swiftCommand`, `swiftSDK`, `configuration`,
|
|
68
69
|
`initialMemory`, `maxMemory`, `stackSize`, `extraSwiftcFlags`,
|
|
@@ -21,7 +21,7 @@ declare const requiredWasmSwiftFlags: readonly ["-Xswiftc", "-Osize", "-Xswiftc"
|
|
|
21
21
|
declare const defaultWasmSwiftSDK = "swift-6.3.1-RELEASE_wasm";
|
|
22
22
|
declare const defaultInitialMemory = "536870912";
|
|
23
23
|
declare const defaultMaxMemory = "4294967296";
|
|
24
|
-
declare const defaultStackSize = "
|
|
24
|
+
declare const defaultStackSize = "16777216";
|
|
25
25
|
declare function resolveSwiftArtifacts(options: ResolveSwiftArtifactsOptions): Promise<SwiftArtifactPaths>;
|
|
26
26
|
interface WasmBuildConfigurationLog {
|
|
27
27
|
configuration?: WasmBuildConfiguration;
|
|
@@ -14,7 +14,7 @@ const requiredWasmSwiftFlags = [
|
|
|
14
14
|
const defaultWasmSwiftSDK = "swift-6.3.1-RELEASE_wasm";
|
|
15
15
|
const defaultInitialMemory = "536870912";
|
|
16
16
|
const defaultMaxMemory = "4294967296";
|
|
17
|
-
const defaultStackSize = "
|
|
17
|
+
const defaultStackSize = "16777216";
|
|
18
18
|
async function resolveSwiftArtifacts(options) {
|
|
19
19
|
const configuration = options.configuration ?? "release";
|
|
20
20
|
const swiftlyWorkingDirectory = await resolveSwiftlyWorkingDirectory(options.packagePath);
|
|
@@ -37,7 +37,7 @@ async function resolveSwiftArtifacts(options) {
|
|
|
37
37
|
"-Xlinker",
|
|
38
38
|
"-z",
|
|
39
39
|
"-Xlinker",
|
|
40
|
-
`stack-size=${options.stackSize ?? "
|
|
40
|
+
`stack-size=${options.stackSize ?? "16777216"}`,
|
|
41
41
|
...linkerFlags(options.extraLinkerFlags),
|
|
42
42
|
...options.extraSwiftBuildArgs ?? []
|
|
43
43
|
];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolveSwiftArtifacts.js","names":[],"sources":["../../../src/build/resolveSwiftArtifacts.ts"],"sourcesContent":["import { access } from \"node:fs/promises\";\nimport { dirname, join, resolve } from \"node:path\";\nimport { runCommand } from \"./runCommand.ts\";\nimport { swiftCommandPrefix } from \"./swiftCommandPrefix.ts\";\n\nexport interface ResolveSwiftArtifactsOptions {\n configuration?: WasmBuildConfiguration;\n extraLinkerFlags?: readonly string[];\n extraSwiftBuildArgs?: readonly string[];\n extraSwiftcFlags?: readonly string[];\n initialMemory?: number | string;\n maxMemory?: number | string;\n packagePath: string;\n product: string;\n stackSize?: number | string;\n swiftCommand?: readonly string[];\n swiftSDK?: string;\n}\n\nexport type WasmBuildConfiguration = \"debug\" | \"release\";\n\nexport interface SwiftArtifactPaths {\n binPath: string;\n wasmPath: string;\n}\n\nexport const requiredWasmSwiftFlags = [\n \"-Xswiftc\",\n \"-Osize\",\n \"-Xswiftc\",\n \"-Xfrontend\",\n \"-Xswiftc\",\n \"-disable-llvm-merge-functions-pass\",\n] as const;\n\nexport const defaultWasmSwiftSDK = \"swift-6.3.1-RELEASE_wasm\";\nexport const defaultInitialMemory = \"536870912\";\nexport const defaultMaxMemory = \"4294967296\";\nexport const defaultStackSize = \"1048576\";\n\nexport async function resolveSwiftArtifacts(\n options: ResolveSwiftArtifactsOptions\n): Promise<SwiftArtifactPaths> {\n const configuration = options.configuration ?? \"release\";\n const swiftlyWorkingDirectory = await resolveSwiftlyWorkingDirectory(options.packagePath);\n const swiftCommand = [...(options.swiftCommand ?? swiftCommandPrefix())];\n const environment = {\n ...process.env\n };\n\n // The browser WebAssembly API rejects function types with more than 1000\n // parameters. Swift's wasm release builds can trip that limit when LLVM's\n // merge-functions pass combines large outlined-copy helpers. `-Osize` helps,\n // but some Darwin CI runners still reproduce the failure unless we also\n // disable that merge pass explicitly.\n const swiftBuildArgs = [\n \"build\",\n \"--package-path\",\n options.packagePath,\n \"--swift-sdk\",\n options.swiftSDK ?? defaultWasmSwiftSDK,\n \"-c\",\n configuration,\n ...requiredSwiftFlags(configuration),\n ...swiftcFlags(options.extraSwiftcFlags),\n \"-Xlinker\",\n `--initial-memory=${options.initialMemory ?? defaultInitialMemory}`,\n \"-Xlinker\",\n `--max-memory=${options.maxMemory ?? defaultMaxMemory}`,\n \"-Xlinker\",\n \"-z\",\n \"-Xlinker\",\n `stack-size=${options.stackSize ?? defaultStackSize}`,\n ...linkerFlags(options.extraLinkerFlags),\n ...(options.extraSwiftBuildArgs ?? []),\n ];\n\n if (configuration === \"release\") {\n confirmRequiredWasmFlags(swiftBuildArgs);\n }\n\n const buildCommand = [\n ...swiftCommand,\n ...swiftBuildArgs,\n \"--product\",\n options.product,\n ];\n const showBinPathCommand = [\n ...swiftCommand,\n ...swiftBuildArgs,\n \"--show-bin-path\",\n ];\n\n logWasmBuildConfiguration({\n configuration,\n packagePath: options.packagePath,\n product: options.product,\n swiftlyWorkingDirectory,\n buildCommand,\n showBinPathCommand,\n });\n\n await runCommand(buildCommand, {\n cwd: swiftlyWorkingDirectory,\n env: environment,\n });\n\n const binPath = await runCommand(showBinPathCommand, {\n cwd: swiftlyWorkingDirectory,\n env: environment,\n });\n\n const wasmPath = join(binPath.trim(), `${options.product}.wasm`);\n return {\n binPath: binPath.trim(),\n wasmPath,\n };\n}\n\ninterface WasmBuildConfigurationLog {\n configuration?: WasmBuildConfiguration;\n packagePath: string;\n product: string;\n swiftlyWorkingDirectory: string;\n buildCommand: string[];\n showBinPathCommand: string[];\n}\n\nexport function hasRequiredWasmFlags(args: readonly string[]): boolean {\n return containsSubsequence(args, requiredWasmSwiftFlags);\n}\n\nfunction confirmRequiredWasmFlags(args: readonly string[]): void {\n if (hasRequiredWasmFlags(args)) {\n return;\n }\n\n throw new Error(\n `missing required wasm Swift flags: ${requiredWasmSwiftFlags.join(\" \")}`\n );\n}\n\nfunction requiredSwiftFlags(configuration: WasmBuildConfiguration): readonly string[] {\n switch (configuration) {\n case \"debug\":\n return [];\n case \"release\":\n return requiredWasmSwiftFlags;\n }\n}\n\nfunction swiftcFlags(flags: readonly string[] | undefined): string[] {\n return (flags ?? []).flatMap((flag) => [\"-Xswiftc\", flag]);\n}\n\nfunction linkerFlags(flags: readonly string[] | undefined): string[] {\n return (flags ?? []).flatMap((flag) => [\"-Xlinker\", flag]);\n}\n\nfunction logWasmBuildConfiguration(config: WasmBuildConfigurationLog): void {\n for (const line of wasmBuildConfigurationLogLines(config)) {\n console.error(line);\n }\n}\n\nexport function wasmBuildConfigurationLogLines(\n config: WasmBuildConfigurationLog\n): string[] {\n const configuration = config.configuration ?? \"release\";\n return [\n `WASM_BUILD_CONFIGURATION_NAME=${configuration}`,\n `WASM_REQUIRED_FLAGS_CONFIRMED=${configuration === \"release\" ? \"true\" : \"skipped\"}`,\n `WASM_REQUIRED_FLAGS=${requiredWasmSwiftFlags.join(\" \")}`,\n `WASM_REQUIRED_FLAGS_JSON=${JSON.stringify([...requiredWasmSwiftFlags])}`,\n `WASM_BUILD_COMMAND=${formatCommandForLogs(config.buildCommand)}`,\n `WASM_BUILD_COMMAND_ARGS_JSON=${JSON.stringify(config.buildCommand)}`,\n `WASM_SHOW_BIN_PATH_COMMAND=${formatCommandForLogs(config.showBinPathCommand)}`,\n `WASM_SHOW_BIN_PATH_COMMAND_ARGS_JSON=${JSON.stringify(config.showBinPathCommand)}`,\n `WASM_BUILD_CONFIGURATION ${JSON.stringify({\n packagePath: config.packagePath,\n product: config.product,\n configuration,\n swiftlyWorkingDirectory: config.swiftlyWorkingDirectory,\n requiredFlags: [...requiredWasmSwiftFlags],\n buildCommand: formatCommandForLogs(config.buildCommand),\n showBinPathCommand: formatCommandForLogs(config.showBinPathCommand),\n })}`,\n ];\n}\n\nexport function formatCommandForLogs(args: readonly string[]): string {\n return args.map(shellQuote).join(\" \");\n}\n\nfunction containsSubsequence(\n args: readonly string[],\n expected: readonly string[]\n): boolean {\n if (expected.length == 0) {\n return true;\n }\n\n for (let index = 0; index <= args.length - expected.length; index += 1) {\n let matches = true;\n for (let expectedIndex = 0; expectedIndex < expected.length; expectedIndex += 1) {\n if (args[index + expectedIndex] !== expected[expectedIndex]) {\n matches = false;\n break;\n }\n }\n if (matches) {\n return true;\n }\n }\n\n return false;\n}\n\nfunction shellQuote(arg: string): string {\n if (/^[A-Za-z0-9_./:=+-]+$/.test(arg)) {\n return arg;\n }\n\n return `'${arg.replaceAll(\"'\", `'\\\\''`)}'`;\n}\n\nasync function resolveSwiftlyWorkingDirectory(\n startPath: string\n): Promise<string> {\n let currentPath = resolve(startPath);\n\n while (true) {\n if (await fileExists(join(currentPath, \".swift-version\"))) {\n return currentPath;\n }\n\n const parentPath = dirname(currentPath);\n if (parentPath === currentPath) {\n return resolve(startPath);\n }\n\n currentPath = parentPath;\n }\n}\n\nasync function fileExists(path: string): Promise<boolean> {\n try {\n await access(path);\n return true;\n } catch {\n return false;\n }\n}\n"],"mappings":";;;;;AA0BA,MAAa,yBAAyB;CACpC;CACA;CACA;CACA;CACA;CACA;AACF;AAEA,MAAa,sBAAsB;AACnC,MAAa,uBAAuB;AACpC,MAAa,mBAAmB;AAChC,MAAa,mBAAmB;AAEhC,eAAsB,sBACpB,SAC6B;CAC7B,MAAM,gBAAgB,QAAQ,iBAAiB;CAC/C,MAAM,0BAA0B,MAAM,+BAA+B,QAAQ,WAAW;CACxF,MAAM,eAAe,CAAC,GAAI,QAAQ,gBAAgB,mBAAmB,C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AEA,SAAS,WAAW,KAAqB;CACvC,IAAI,wBAAwB,KAAK,GAAG,GAClC,OAAO;CAGT,OAAO,IAAI,IAAI,WAAW,KAAK,OAAO,EAAE;AAC1C;AAEA,eAAe,+BACb,WACiB;CACjB,IAAI,cAAc,QAAQ,SAAS;CAEnC,OAAO,MAAM;EACX,IAAI,MAAM,WAAW,KAAK,aAAa,gBAAgB,CAAC,GACtD,OAAO;EAGT,MAAM,aAAa,QAAQ,WAAW;EACtC,IAAI,eAAe,aACjB,OAAO,QAAQ,SAAS;EAG1B,cAAc;CAChB;AACF;AAEA,eAAe,WAAW,MAAgC;CACxD,IAAI;EACF,MAAM,OAAO,IAAI;EACjB,OAAO;CACT,QAAQ;EACN,OAAO;CACT;AACF"}
|
|
1
|
+
{"version":3,"file":"resolveSwiftArtifacts.js","names":[],"sources":["../../../src/build/resolveSwiftArtifacts.ts"],"sourcesContent":["import { access } from \"node:fs/promises\";\nimport { dirname, join, resolve } from \"node:path\";\nimport { runCommand } from \"./runCommand.ts\";\nimport { swiftCommandPrefix } from \"./swiftCommandPrefix.ts\";\n\nexport interface ResolveSwiftArtifactsOptions {\n configuration?: WasmBuildConfiguration;\n extraLinkerFlags?: readonly string[];\n extraSwiftBuildArgs?: readonly string[];\n extraSwiftcFlags?: readonly string[];\n initialMemory?: number | string;\n maxMemory?: number | string;\n packagePath: string;\n product: string;\n stackSize?: number | string;\n swiftCommand?: readonly string[];\n swiftSDK?: string;\n}\n\nexport type WasmBuildConfiguration = \"debug\" | \"release\";\n\nexport interface SwiftArtifactPaths {\n binPath: string;\n wasmPath: string;\n}\n\nexport const requiredWasmSwiftFlags = [\n \"-Xswiftc\",\n \"-Osize\",\n \"-Xswiftc\",\n \"-Xfrontend\",\n \"-Xswiftc\",\n \"-disable-llvm-merge-functions-pass\",\n] as const;\n\nexport const defaultWasmSwiftSDK = \"swift-6.3.1-RELEASE_wasm\";\nexport const defaultInitialMemory = \"536870912\";\nexport const defaultMaxMemory = \"4294967296\";\n// 16 MiB: the resolve descent's linear-memory (shadow) stack usage scales\n// with view-tree depth, and the non-lean profile's deep scenes measurably\n// overflow a 1 MiB stack (wasm \"memory access out of bounds\" at steady\n// state). The reservation is virtual against a 512 MiB initial memory.\nexport const defaultStackSize = \"16777216\";\n\nexport async function resolveSwiftArtifacts(\n options: ResolveSwiftArtifactsOptions\n): Promise<SwiftArtifactPaths> {\n const configuration = options.configuration ?? \"release\";\n const swiftlyWorkingDirectory = await resolveSwiftlyWorkingDirectory(options.packagePath);\n const swiftCommand = [...(options.swiftCommand ?? swiftCommandPrefix())];\n const environment = {\n ...process.env\n };\n\n // The browser WebAssembly API rejects function types with more than 1000\n // parameters. Swift's wasm release builds can trip that limit when LLVM's\n // merge-functions pass combines large outlined-copy helpers. `-Osize` helps,\n // but some Darwin CI runners still reproduce the failure unless we also\n // disable that merge pass explicitly.\n const swiftBuildArgs = [\n \"build\",\n \"--package-path\",\n options.packagePath,\n \"--swift-sdk\",\n options.swiftSDK ?? defaultWasmSwiftSDK,\n \"-c\",\n configuration,\n ...requiredSwiftFlags(configuration),\n ...swiftcFlags(options.extraSwiftcFlags),\n \"-Xlinker\",\n `--initial-memory=${options.initialMemory ?? defaultInitialMemory}`,\n \"-Xlinker\",\n `--max-memory=${options.maxMemory ?? defaultMaxMemory}`,\n \"-Xlinker\",\n \"-z\",\n \"-Xlinker\",\n `stack-size=${options.stackSize ?? defaultStackSize}`,\n ...linkerFlags(options.extraLinkerFlags),\n ...(options.extraSwiftBuildArgs ?? []),\n ];\n\n if (configuration === \"release\") {\n confirmRequiredWasmFlags(swiftBuildArgs);\n }\n\n const buildCommand = [\n ...swiftCommand,\n ...swiftBuildArgs,\n \"--product\",\n options.product,\n ];\n const showBinPathCommand = [\n ...swiftCommand,\n ...swiftBuildArgs,\n \"--show-bin-path\",\n ];\n\n logWasmBuildConfiguration({\n configuration,\n packagePath: options.packagePath,\n product: options.product,\n swiftlyWorkingDirectory,\n buildCommand,\n showBinPathCommand,\n });\n\n await runCommand(buildCommand, {\n cwd: swiftlyWorkingDirectory,\n env: environment,\n });\n\n const binPath = await runCommand(showBinPathCommand, {\n cwd: swiftlyWorkingDirectory,\n env: environment,\n });\n\n const wasmPath = join(binPath.trim(), `${options.product}.wasm`);\n return {\n binPath: binPath.trim(),\n wasmPath,\n };\n}\n\ninterface WasmBuildConfigurationLog {\n configuration?: WasmBuildConfiguration;\n packagePath: string;\n product: string;\n swiftlyWorkingDirectory: string;\n buildCommand: string[];\n showBinPathCommand: string[];\n}\n\nexport function hasRequiredWasmFlags(args: readonly string[]): boolean {\n return containsSubsequence(args, requiredWasmSwiftFlags);\n}\n\nfunction confirmRequiredWasmFlags(args: readonly string[]): void {\n if (hasRequiredWasmFlags(args)) {\n return;\n }\n\n throw new Error(\n `missing required wasm Swift flags: ${requiredWasmSwiftFlags.join(\" \")}`\n );\n}\n\nfunction requiredSwiftFlags(configuration: WasmBuildConfiguration): readonly string[] {\n switch (configuration) {\n case \"debug\":\n return [];\n case \"release\":\n return requiredWasmSwiftFlags;\n }\n}\n\nfunction swiftcFlags(flags: readonly string[] | undefined): string[] {\n return (flags ?? []).flatMap((flag) => [\"-Xswiftc\", flag]);\n}\n\nfunction linkerFlags(flags: readonly string[] | undefined): string[] {\n return (flags ?? []).flatMap((flag) => [\"-Xlinker\", flag]);\n}\n\nfunction logWasmBuildConfiguration(config: WasmBuildConfigurationLog): void {\n for (const line of wasmBuildConfigurationLogLines(config)) {\n console.error(line);\n }\n}\n\nexport function wasmBuildConfigurationLogLines(\n config: WasmBuildConfigurationLog\n): string[] {\n const configuration = config.configuration ?? \"release\";\n return [\n `WASM_BUILD_CONFIGURATION_NAME=${configuration}`,\n `WASM_REQUIRED_FLAGS_CONFIRMED=${configuration === \"release\" ? \"true\" : \"skipped\"}`,\n `WASM_REQUIRED_FLAGS=${requiredWasmSwiftFlags.join(\" \")}`,\n `WASM_REQUIRED_FLAGS_JSON=${JSON.stringify([...requiredWasmSwiftFlags])}`,\n `WASM_BUILD_COMMAND=${formatCommandForLogs(config.buildCommand)}`,\n `WASM_BUILD_COMMAND_ARGS_JSON=${JSON.stringify(config.buildCommand)}`,\n `WASM_SHOW_BIN_PATH_COMMAND=${formatCommandForLogs(config.showBinPathCommand)}`,\n `WASM_SHOW_BIN_PATH_COMMAND_ARGS_JSON=${JSON.stringify(config.showBinPathCommand)}`,\n `WASM_BUILD_CONFIGURATION ${JSON.stringify({\n packagePath: config.packagePath,\n product: config.product,\n configuration,\n swiftlyWorkingDirectory: config.swiftlyWorkingDirectory,\n requiredFlags: [...requiredWasmSwiftFlags],\n buildCommand: formatCommandForLogs(config.buildCommand),\n showBinPathCommand: formatCommandForLogs(config.showBinPathCommand),\n })}`,\n ];\n}\n\nexport function formatCommandForLogs(args: readonly string[]): string {\n return args.map(shellQuote).join(\" \");\n}\n\nfunction containsSubsequence(\n args: readonly string[],\n expected: readonly string[]\n): boolean {\n if (expected.length == 0) {\n return true;\n }\n\n for (let index = 0; index <= args.length - expected.length; index += 1) {\n let matches = true;\n for (let expectedIndex = 0; expectedIndex < expected.length; expectedIndex += 1) {\n if (args[index + expectedIndex] !== expected[expectedIndex]) {\n matches = false;\n break;\n }\n }\n if (matches) {\n return true;\n }\n }\n\n return false;\n}\n\nfunction shellQuote(arg: string): string {\n if (/^[A-Za-z0-9_./:=+-]+$/.test(arg)) {\n return arg;\n }\n\n return `'${arg.replaceAll(\"'\", `'\\\\''`)}'`;\n}\n\nasync function resolveSwiftlyWorkingDirectory(\n startPath: string\n): Promise<string> {\n let currentPath = resolve(startPath);\n\n while (true) {\n if (await fileExists(join(currentPath, \".swift-version\"))) {\n return currentPath;\n }\n\n const parentPath = dirname(currentPath);\n if (parentPath === currentPath) {\n return resolve(startPath);\n }\n\n currentPath = parentPath;\n }\n}\n\nasync function fileExists(path: string): Promise<boolean> {\n try {\n await access(path);\n return true;\n } catch {\n return false;\n }\n}\n"],"mappings":";;;;;AA0BA,MAAa,yBAAyB;CACpC;CACA;CACA;CACA;CACA;CACA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AAI,QAAQ,GAAG,SAAS,KAAK,SAAS,SAAS,QAAQ,SAAS,GAAG;EACtE,IAAI,UAAU;EACd,KAAK,IAAI,gBAAgB,GAAG,gBAAgB,SAAS,QAAQ,iBAAiB,GAC5E,IAAI,KAAK,QAAQ,mBAAmB,SAAS,gBAAgB;GAC3D,UAAU;GACV;EACF;EAEF,IAAI,SACF,OAAO;CAEX;CAEA,OAAO;AACT;AAEA,SAAS,WAAW,KAAqB;CACvC,IAAI,wBAAwB,KAAK,GAAG,GAClC,OAAO;CAGT,OAAO,IAAI,IAAI,WAAW,KAAK,OAAO,EAAE;AAC1C;AAEA,eAAe,+BACb,WACiB;CACjB,IAAI,cAAc,QAAQ,SAAS;CAEnC,OAAO,MAAM;EACX,IAAI,MAAM,WAAW,KAAK,aAAa,gBAAgB,CAAC,GACtD,OAAO;EAGT,MAAM,aAAa,QAAQ,WAAW;EACtC,IAAI,eAAe,aACjB,OAAO,QAAQ,SAAS;EAG1B,cAAc;CAChB;AACF;AAEA,eAAe,WAAW,MAAgC;CACxD,IAAI;EACF,MAAM,OAAO,IAAI;EACjB,OAAO;CACT,QAAQ;EACN,OAAO;CACT;AACF"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@swifttui/build",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.11",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"access": "public"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@swifttui/web": "0.1.
|
|
42
|
+
"@swifttui/web": "0.1.11"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
45
|
"@types/bun": "1.3.13"
|