@swiftbrowser/cli 0.6.7 → 0.8.0
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 +82 -11
- package/dist/appSources.d.ts +116 -0
- package/dist/appSources.js +624 -0
- package/dist/appSources.js.map +1 -0
- package/dist/browser.d.ts +4 -0
- package/dist/browser.js +8 -0
- package/dist/browser.js.map +1 -0
- package/dist/build.d.ts +17 -2
- package/dist/build.js +38 -11
- package/dist/build.js.map +1 -1
- package/dist/cli.js +28 -4
- package/dist/cli.js.map +1 -1
- package/dist/commands/build.js +10 -7
- package/dist/commands/build.js.map +1 -1
- package/dist/commands/check.js +38 -8
- package/dist/commands/check.js.map +1 -1
- package/dist/commands/dev.d.ts +8 -4
- package/dist/commands/dev.js +25 -10
- package/dist/commands/dev.js.map +1 -1
- package/dist/commands/doctor.d.ts +8 -0
- package/dist/commands/doctor.js +52 -4
- package/dist/commands/doctor.js.map +1 -1
- package/dist/commands/kit.d.ts +1 -0
- package/dist/commands/kit.js +20 -5
- package/dist/commands/kit.js.map +1 -1
- package/dist/commands/shared.d.ts +24 -6
- package/dist/commands/shared.js +92 -16
- package/dist/commands/shared.js.map +1 -1
- package/dist/commands/test.d.ts +4 -2
- package/dist/commands/test.js +25 -17
- package/dist/commands/test.js.map +1 -1
- package/dist/compat.d.ts +2 -30
- package/dist/compat.js +2 -44
- package/dist/compat.js.map +1 -1
- package/dist/compiler.d.ts +50 -0
- package/dist/compiler.js +94 -0
- package/dist/compiler.js.map +1 -0
- package/dist/config.d.ts +5 -2
- package/dist/config.js +7 -3
- package/dist/config.js.map +1 -1
- package/dist/frameworks.d.ts +30 -0
- package/dist/frameworks.js +48 -0
- package/dist/frameworks.js.map +1 -0
- package/dist/icu.d.ts +2 -4
- package/dist/icu.js +7 -36
- package/dist/icu.js.map +1 -1
- package/dist/kit.d.ts +62 -17
- package/dist/kit.js +183 -33
- package/dist/kit.js.map +1 -1
- package/dist/log.js +2 -1
- package/dist/log.js.map +1 -1
- package/dist/manifest.d.ts +73 -0
- package/dist/manifest.js +324 -0
- package/dist/manifest.js.map +1 -0
- package/dist/moduleCache.d.ts +20 -0
- package/dist/moduleCache.js +98 -0
- package/dist/moduleCache.js.map +1 -0
- package/dist/objc.js +1 -1
- package/dist/objc.js.map +1 -1
- package/dist/packages.d.ts +8 -1
- package/dist/packages.js +10 -2
- package/dist/packages.js.map +1 -1
- package/dist/registry.d.ts +46 -0
- package/dist/registry.js +184 -0
- package/dist/registry.js.map +1 -0
- package/dist/resolve.d.ts +80 -0
- package/dist/resolve.js +396 -0
- package/dist/resolve.js.map +1 -0
- package/dist/stage.d.ts +5 -144
- package/dist/stage.js +19 -516
- package/dist/stage.js.map +1 -1
- package/dist/testDiscovery.d.ts +44 -0
- package/dist/testDiscovery.js +111 -0
- package/dist/testDiscovery.js.map +1 -0
- package/dist/vendor.d.ts +41 -5
- package/dist/vendor.js +71 -31
- package/dist/vendor.js.map +1 -1
- package/dist/wasmCompiler.d.ts +160 -0
- package/dist/wasmCompiler.js +628 -0
- package/dist/wasmCompiler.js.map +1 -0
- package/dist/wasmFlags.d.ts +31 -0
- package/dist/wasmFlags.js +56 -0
- package/dist/wasmFlags.js.map +1 -0
- package/dist/wasmPackages.d.ts +163 -0
- package/dist/wasmPackages.js +466 -0
- package/dist/wasmPackages.js.map +1 -0
- package/dist/wasmSdk.d.ts +27 -0
- package/dist/wasmSdk.js +103 -0
- package/dist/wasmSdk.js.map +1 -0
- package/package.json +6 -5
|
@@ -0,0 +1,466 @@
|
|
|
1
|
+
// The app's package dependencies for the WebAssembly compiler
|
|
2
|
+
// (wasmCompiler.ts): what SwiftPM would build of the packages copied for the
|
|
3
|
+
// shim (vendor.ts), as a list of Swift modules in dependency order, each with
|
|
4
|
+
// its sources and flags. The packages are read with `swift package
|
|
5
|
+
// dump-package`; this file turns that description into modules.
|
|
6
|
+
//
|
|
7
|
+
// Supported: regular Swift targets, their dependencies on each other (in one
|
|
8
|
+
// package or across the copies) and on the shim's products, and their Swift
|
|
9
|
+
// settings, `Bundle.module` for a target with resources (the resources
|
|
10
|
+
// themselves are not published, as with SwiftPM), C targets (compiled with
|
|
11
|
+
// clang as WebAssembly, imported through a module map), and package traits
|
|
12
|
+
// with the conditions that name them.
|
|
13
|
+
import { existsSync, readdirSync, statSync } from 'node:fs';
|
|
14
|
+
import path from 'node:path';
|
|
15
|
+
import { FULL_FOUNDATION_FILE } from './appSources.js';
|
|
16
|
+
import { run } from './build.js';
|
|
17
|
+
import { CliError } from './log.js';
|
|
18
|
+
import { toolchainEnv } from './toolchain.js';
|
|
19
|
+
/** A target name as a module name: SwiftPM's C99 identifier (`spm_mangledToC99ExtendedIdentifier`, as far as package names go). */
|
|
20
|
+
export function c99Name(name) {
|
|
21
|
+
const mangled = name.replace(/[^A-Za-z0-9_]/g, '_');
|
|
22
|
+
return /^[0-9]/.test(mangled) ? `_${mangled}` : mangled;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Whether a condition holds here: building for WebAssembly (`wasi`) in
|
|
26
|
+
* `config`, with these traits of the package enabled.
|
|
27
|
+
*/
|
|
28
|
+
export function conditionHolds(condition, traits, config = 'release') {
|
|
29
|
+
if (!condition)
|
|
30
|
+
return true;
|
|
31
|
+
const c = condition;
|
|
32
|
+
const platforms = c.platformNames ?? c.platforms?.map((p) => p.name) ?? [];
|
|
33
|
+
if (platforms.length > 0 && !platforms.includes('wasi'))
|
|
34
|
+
return false;
|
|
35
|
+
if (c.config && c.config !== config)
|
|
36
|
+
return false;
|
|
37
|
+
if (c.traits && c.traits.length > 0 && !c.traits.some((trait) => traits.has(trait)))
|
|
38
|
+
return false;
|
|
39
|
+
return true;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Default traits a manifest cannot give for WebAssembly, by package identity.
|
|
43
|
+
* A manifest runs here as a WASI program, so `#if os(Linux)` in it is false
|
|
44
|
+
* where SwiftPM, on a Linux machine, finds it true. SQLite.swift's defaults
|
|
45
|
+
* pick its own SQLite only on Linux, and WASI has no system SQLite.
|
|
46
|
+
*/
|
|
47
|
+
const WASI_DEFAULT_TRAITS = {
|
|
48
|
+
'sqlite.swift': ['SQLiteSwiftCSQLite'],
|
|
49
|
+
};
|
|
50
|
+
/**
|
|
51
|
+
* Each package's enabled traits (SE-0450): the defaults, unless every
|
|
52
|
+
* package that depends on it names the traits it wants (a trait named
|
|
53
|
+
* `default` asks for the defaults); conditional asks count when the asking
|
|
54
|
+
* package's traits satisfy them; each trait enables the traits it lists.
|
|
55
|
+
* `roots` are the packages the app depends on, which get their defaults.
|
|
56
|
+
*/
|
|
57
|
+
export function enabledTraits(packages, roots) {
|
|
58
|
+
const declared = (identity, name) => {
|
|
59
|
+
const traits = packages.get(identity)?.dump.traits ?? [];
|
|
60
|
+
if (name === 'default')
|
|
61
|
+
return WASI_DEFAULT_TRAITS[identity] ?? traits.find((trait) => trait.name === 'default')?.enabledTraits ?? [];
|
|
62
|
+
return traits.find((trait) => trait.name === name)?.enabledTraits ?? [];
|
|
63
|
+
};
|
|
64
|
+
const expand = (identity, asked) => {
|
|
65
|
+
const enabled = new Set();
|
|
66
|
+
const pending = [...asked];
|
|
67
|
+
while (pending.length > 0) {
|
|
68
|
+
const name = pending.pop();
|
|
69
|
+
if (name !== 'default') {
|
|
70
|
+
if (enabled.has(name))
|
|
71
|
+
continue;
|
|
72
|
+
enabled.add(name);
|
|
73
|
+
}
|
|
74
|
+
pending.push(...declared(identity, name));
|
|
75
|
+
}
|
|
76
|
+
return enabled;
|
|
77
|
+
};
|
|
78
|
+
const asks = new Map();
|
|
79
|
+
for (const root of roots)
|
|
80
|
+
asks.set(root, new Set(['default']));
|
|
81
|
+
let enabled = new Map();
|
|
82
|
+
for (let changed = true; changed;) {
|
|
83
|
+
changed = false;
|
|
84
|
+
enabled = new Map([...asks].map(([identity, asked]) => [identity, expand(identity, asked)]));
|
|
85
|
+
for (const [identity, { dependencies }] of packages) {
|
|
86
|
+
const own = enabled.get(identity);
|
|
87
|
+
if (!own)
|
|
88
|
+
continue;
|
|
89
|
+
for (const dependency of dependencies ?? []) {
|
|
90
|
+
if (!packages.has(dependency.identity))
|
|
91
|
+
continue;
|
|
92
|
+
const wanted = dependency.traits
|
|
93
|
+
? dependency.traits.filter((trait) => !trait.condition || trait.condition.traits.some((t) => own.has(t))).map((trait) => trait.name)
|
|
94
|
+
: ['default'];
|
|
95
|
+
const set = asks.get(dependency.identity) ?? new Set();
|
|
96
|
+
for (const name of wanted)
|
|
97
|
+
if (!set.has(name)) {
|
|
98
|
+
set.add(name);
|
|
99
|
+
changed = true;
|
|
100
|
+
}
|
|
101
|
+
asks.set(dependency.identity, set);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
// A package nothing reached here (its dependents' manifests unknown): its defaults.
|
|
106
|
+
for (const identity of packages.keys())
|
|
107
|
+
if (!enabled.has(identity))
|
|
108
|
+
enabled.set(identity, expand(identity, new Set(['default'])));
|
|
109
|
+
return enabled;
|
|
110
|
+
}
|
|
111
|
+
/** The language modes this compiler has, oldest first. */
|
|
112
|
+
const LANGUAGE_MODES = ['4', '4.2', '5', '6'];
|
|
113
|
+
/**
|
|
114
|
+
* The language mode of a package's targets when a target does not set one,
|
|
115
|
+
* as SwiftPM picks it: the newest of the package's `swiftLanguageModes` the
|
|
116
|
+
* compiler has, else its tools version's (6 from tools version 6, else 5).
|
|
117
|
+
*/
|
|
118
|
+
export function defaultLanguageMode(dump) {
|
|
119
|
+
const declared = (dump.swiftLanguageVersions ?? []).filter((mode) => LANGUAGE_MODES.includes(mode));
|
|
120
|
+
if (declared.length > 0)
|
|
121
|
+
return declared.sort((a, b) => LANGUAGE_MODES.indexOf(a) - LANGUAGE_MODES.indexOf(b)).pop();
|
|
122
|
+
return Number(dump.toolsVersion._version.split('.')[0]) >= 6 ? '6' : '5';
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* A target's Swift settings that apply to WebAssembly, as frontend flags,
|
|
126
|
+
* with the package's enabled traits as compilation conditions.
|
|
127
|
+
*/
|
|
128
|
+
export function settingsFlags(target, dump, traits = new Set()) {
|
|
129
|
+
let mode = defaultLanguageMode(dump);
|
|
130
|
+
const flags = [...[...traits].sort().flatMap((trait) => ['-D', trait])];
|
|
131
|
+
for (const setting of target.settings ?? []) {
|
|
132
|
+
if (setting.tool !== 'swift')
|
|
133
|
+
continue;
|
|
134
|
+
// Apps build in the release configuration.
|
|
135
|
+
if (!conditionHolds(setting.condition, traits))
|
|
136
|
+
continue;
|
|
137
|
+
const [kind, value] = Object.entries(setting.kind)[0] ?? [];
|
|
138
|
+
const argument = value?._0;
|
|
139
|
+
switch (kind) {
|
|
140
|
+
case 'define':
|
|
141
|
+
flags.push('-D', String(argument));
|
|
142
|
+
break;
|
|
143
|
+
case 'unsafeFlags':
|
|
144
|
+
flags.push(...argument);
|
|
145
|
+
break;
|
|
146
|
+
case 'enableUpcomingFeature':
|
|
147
|
+
flags.push('-enable-upcoming-feature', String(argument));
|
|
148
|
+
break;
|
|
149
|
+
case 'enableExperimentalFeature':
|
|
150
|
+
flags.push('-enable-experimental-feature', String(argument));
|
|
151
|
+
break;
|
|
152
|
+
case 'swiftLanguageMode':
|
|
153
|
+
mode = String(argument);
|
|
154
|
+
break;
|
|
155
|
+
case 'strictMemorySafety':
|
|
156
|
+
flags.push('-strict-memory-safety');
|
|
157
|
+
break;
|
|
158
|
+
case 'defaultIsolation':
|
|
159
|
+
flags.push('-default-isolation', String(argument));
|
|
160
|
+
break;
|
|
161
|
+
case 'interoperabilityMode':
|
|
162
|
+
if (argument === 'Cxx')
|
|
163
|
+
flags.push('-cxx-interoperability-mode=default');
|
|
164
|
+
break;
|
|
165
|
+
// Warning levels change no code: left to the package's own builds.
|
|
166
|
+
case 'treatAllWarnings':
|
|
167
|
+
case 'treatWarning':
|
|
168
|
+
case 'enableWarning':
|
|
169
|
+
case 'disableWarning': break;
|
|
170
|
+
default: throw new CliError(`the WebAssembly compiler does not support the Swift setting ${kind} (${dump.name}, target ${target.name}) yet`);
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
return ['-swift-version', mode, ...flags];
|
|
174
|
+
}
|
|
175
|
+
/** A C target's settings for clang: defines, other flags and a language standard; and its header search paths, relative to the package. */
|
|
176
|
+
export function clangSettings(target, dump, targetPath, cxx, traits = new Set()) {
|
|
177
|
+
const flags = [];
|
|
178
|
+
const headerSearchPaths = [];
|
|
179
|
+
const standard = cxx ? dump.cxxLanguageStandard?.replace(/^(gnu)?cxx/, (_, gnu) => `${gnu ?? ''}c++`) : dump.cLanguageStandard;
|
|
180
|
+
if (standard)
|
|
181
|
+
flags.push(`-std=${standard}`);
|
|
182
|
+
for (const setting of target.settings ?? []) {
|
|
183
|
+
if (setting.tool !== 'c' && setting.tool !== (cxx ? 'cxx' : 'c'))
|
|
184
|
+
continue;
|
|
185
|
+
if (!conditionHolds(setting.condition, traits))
|
|
186
|
+
continue;
|
|
187
|
+
const [kind, value] = Object.entries(setting.kind)[0] ?? [];
|
|
188
|
+
const argument = value?._0;
|
|
189
|
+
switch (kind) {
|
|
190
|
+
case 'define':
|
|
191
|
+
flags.push(`-D${String(argument)}`);
|
|
192
|
+
break;
|
|
193
|
+
case 'headerSearchPath':
|
|
194
|
+
headerSearchPaths.push(path.join(targetPath, String(argument)));
|
|
195
|
+
break;
|
|
196
|
+
case 'unsafeFlags':
|
|
197
|
+
flags.push(...argument);
|
|
198
|
+
break;
|
|
199
|
+
case 'treatAllWarnings':
|
|
200
|
+
case 'treatWarning':
|
|
201
|
+
case 'enableWarning':
|
|
202
|
+
case 'disableWarning': break;
|
|
203
|
+
default: throw new CliError(`the WebAssembly compiler does not support the C setting ${kind} (${dump.name}, target ${target.name}) yet`);
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
return { flags, headerSearchPaths };
|
|
207
|
+
}
|
|
208
|
+
const C_FAMILY = /\.(c|cc|cpp|cxx|c\+\+|m|mm|s|S)$/;
|
|
209
|
+
/** A target's source files under `relative` (its `sources`, when it lists them, else everything), relative to `root`. */
|
|
210
|
+
function targetFiles(root, relative, excluded, listed) {
|
|
211
|
+
const included = listed?.map((entry) => path.join(relative, entry));
|
|
212
|
+
const walk = (dir) => readdirSync(path.join(root, dir)).sort().flatMap((name) => {
|
|
213
|
+
const file = path.join(dir, name);
|
|
214
|
+
if (excluded.some((exclude) => file === exclude || file.startsWith(`${exclude}${path.sep}`)))
|
|
215
|
+
return [];
|
|
216
|
+
// A directory with an extension (a .docc catalog, an asset catalog) is
|
|
217
|
+
// one item to SwiftPM, never searched for sources.
|
|
218
|
+
if (statSync(path.join(root, file)).isDirectory())
|
|
219
|
+
return path.extname(name) ? [] : walk(file);
|
|
220
|
+
if (included && !included.some((entry) => file === entry || file.startsWith(`${entry}${path.sep}`)))
|
|
221
|
+
return [];
|
|
222
|
+
return [file];
|
|
223
|
+
});
|
|
224
|
+
return walk(relative);
|
|
225
|
+
}
|
|
226
|
+
/** The module map SwiftPM gives a C target's public headers (ModuleMapGenerator.determineModuleMapType). */
|
|
227
|
+
function moduleMapFor(root, includeDir, moduleName) {
|
|
228
|
+
const dir = path.join(root, includeDir);
|
|
229
|
+
if (existsSync(path.join(dir, 'module.modulemap')))
|
|
230
|
+
return { custom: path.join(includeDir, 'module.modulemap') };
|
|
231
|
+
if (!existsSync(dir))
|
|
232
|
+
return undefined;
|
|
233
|
+
if (existsSync(path.join(dir, `${moduleName}.h`)))
|
|
234
|
+
return { umbrellaHeader: path.join(includeDir, `${moduleName}.h`) };
|
|
235
|
+
if (existsSync(path.join(dir, moduleName, `${moduleName}.h`)))
|
|
236
|
+
return { umbrellaHeader: path.join(includeDir, moduleName, `${moduleName}.h`) };
|
|
237
|
+
return { umbrellaDirectory: includeDir };
|
|
238
|
+
}
|
|
239
|
+
/** A module map SwiftPM would generate, naming files by `guest` paths (as the compiler sees them). */
|
|
240
|
+
export function generatedModuleMap(moduleName, map) {
|
|
241
|
+
const line = 'umbrellaHeader' in map ? `umbrella header "${map.umbrellaHeader}"` : `umbrella "${map.umbrellaDirectory}"`;
|
|
242
|
+
return `module ${moduleName} {\n ${line}\n export *\n}\n`;
|
|
243
|
+
}
|
|
244
|
+
/** Resources SwiftPM processes without being told (`resources:` lists the others). */
|
|
245
|
+
const IMPLICIT_RESOURCE = /\.(xcassets|xib|storyboard|xcdatamodeld?|xcmappingmodel|metal|lproj|xcstrings)$/;
|
|
246
|
+
function hasImplicitResources(root, relative, excluded) {
|
|
247
|
+
return readdirSync(path.join(root, relative)).some((name) => {
|
|
248
|
+
const file = path.join(relative, name);
|
|
249
|
+
if (excluded.some((exclude) => file === exclude || file.startsWith(`${exclude}${path.sep}`)))
|
|
250
|
+
return false;
|
|
251
|
+
if (IMPLICIT_RESOURCE.test(name))
|
|
252
|
+
return true;
|
|
253
|
+
return statSync(path.join(root, file)).isDirectory() && hasImplicitResources(root, file, excluded);
|
|
254
|
+
});
|
|
255
|
+
}
|
|
256
|
+
/**
|
|
257
|
+
* SwiftPM's `Bundle.module` for a target with resources: the bundle beside
|
|
258
|
+
* the app's (`<name>.resources`, as SwiftPM names it off Apple platforms),
|
|
259
|
+
* else the app's bundle, since a site publishes the app's resources only.
|
|
260
|
+
*/
|
|
261
|
+
export function resourceBundleAccessor(bundleName) {
|
|
262
|
+
return `import Foundation
|
|
263
|
+
|
|
264
|
+
extension Foundation.Bundle {
|
|
265
|
+
/// The resources of this package target (\`${bundleName}.resources\` in the app's bundle).
|
|
266
|
+
static let module: Bundle = Bundle(path: Bundle.main.bundlePath + "/${bundleName}.resources") ?? Bundle.main
|
|
267
|
+
}
|
|
268
|
+
`;
|
|
269
|
+
}
|
|
270
|
+
/**
|
|
271
|
+
* The packages' targets as modules, each after the modules it depends on:
|
|
272
|
+
* those of the products the app uses (`used`), and what they need, under
|
|
273
|
+
* the dependencies' conditions for WebAssembly and the packages' traits.
|
|
274
|
+
* `packages` maps an identity to its directory and its manifest;
|
|
275
|
+
* `kitProducts` are the shim's products.
|
|
276
|
+
*/
|
|
277
|
+
export function packageModules(packages, kitProducts,
|
|
278
|
+
/** The products the app uses, by package identity: only these and what they need are built. Default every library product. */
|
|
279
|
+
used) {
|
|
280
|
+
// Packages are named in product dependencies by name or by identity.
|
|
281
|
+
const byName = new Map();
|
|
282
|
+
for (const [identity, { dump }] of packages) {
|
|
283
|
+
byName.set(identity, identity);
|
|
284
|
+
byName.set(dump.name.toLowerCase(), identity);
|
|
285
|
+
}
|
|
286
|
+
const traits = enabledTraits(packages, used ? used.keys() : packages.keys());
|
|
287
|
+
const modules = new Map();
|
|
288
|
+
const ordered = [];
|
|
289
|
+
const productTargets = (identity, product) => {
|
|
290
|
+
const found = packages.get(identity).dump.products.find((p) => p.name === product);
|
|
291
|
+
if (!found)
|
|
292
|
+
throw new CliError(`package ${identity} has no product ${product}`);
|
|
293
|
+
return found.targets.map((target) => `${identity}/${target}`);
|
|
294
|
+
};
|
|
295
|
+
// The package with a product of this name: the one named like it first (SwiftSoup's SwiftSoup).
|
|
296
|
+
const productOwner = (product, from) => {
|
|
297
|
+
const named = byName.get(product.toLowerCase());
|
|
298
|
+
if (named && named !== from && packages.get(named).dump.products.some((p) => p.name === product))
|
|
299
|
+
return named;
|
|
300
|
+
return [...packages].find(([identity, { dump }]) => identity !== from && dump.products.some((p) => p.name === product))?.[0];
|
|
301
|
+
};
|
|
302
|
+
const visit = (key, chain) => {
|
|
303
|
+
const existing = modules.get(key);
|
|
304
|
+
if (existing)
|
|
305
|
+
return existing;
|
|
306
|
+
if (chain.includes(key))
|
|
307
|
+
throw new CliError(`package targets depend on each other in a cycle: ${[...chain, key].join(' → ')}`);
|
|
308
|
+
const [identity, name] = key.split('/');
|
|
309
|
+
const { dir, dump } = packages.get(identity);
|
|
310
|
+
const own = traits.get(identity) ?? new Set();
|
|
311
|
+
const target = dump.targets.find((t) => t.name === name);
|
|
312
|
+
if (!target)
|
|
313
|
+
throw new CliError(`package ${identity} has no target ${name}`);
|
|
314
|
+
if (target.type !== 'regular' && target.type !== 'macro')
|
|
315
|
+
throw new CliError(`the WebAssembly compiler builds regular and macro targets only, not ${name} (${target.type}) in ${identity}`);
|
|
316
|
+
// Without a path, where SwiftPM looks: Sources, Source, src or srcs.
|
|
317
|
+
const targetPath = target.path ?? ['Sources', 'Source', 'src', 'srcs'].map((parent) => path.join(parent, name)).find((candidate) => existsSync(path.join(dir, candidate))) ?? path.join('Sources', name);
|
|
318
|
+
const excluded = (target.exclude ?? []).map((e) => path.join(targetPath, e));
|
|
319
|
+
const files = targetFiles(dir, targetPath, excluded, target.sources);
|
|
320
|
+
const swift = files.filter((file) => file.endsWith('.swift'));
|
|
321
|
+
const cFamily = files.filter((file) => C_FAMILY.test(file));
|
|
322
|
+
if (swift.length === 0 && cFamily.length === 0)
|
|
323
|
+
throw new CliError(`${name} in ${identity} has no Swift or C sources`);
|
|
324
|
+
const dependencies = [];
|
|
325
|
+
const macros = [];
|
|
326
|
+
const kit = [];
|
|
327
|
+
// A macro target is loaded as a plugin, not linked.
|
|
328
|
+
const add = (module) => {
|
|
329
|
+
const list = module.macro ? macros : dependencies;
|
|
330
|
+
if (!list.includes(module.name))
|
|
331
|
+
list.push(module.name);
|
|
332
|
+
};
|
|
333
|
+
for (const dependency of target.dependencies) {
|
|
334
|
+
const condition = 'byName' in dependency ? dependency.byName?.[1]
|
|
335
|
+
: 'target' in dependency ? dependency.target?.[1]
|
|
336
|
+
: 'product' in dependency ? dependency.product?.[3] : undefined;
|
|
337
|
+
if (!conditionHolds(condition, own))
|
|
338
|
+
continue;
|
|
339
|
+
const named = 'byName' in dependency ? dependency.byName?.[0] : undefined;
|
|
340
|
+
const local = 'target' in dependency ? dependency.target?.[0] : named;
|
|
341
|
+
// A name is the package's own target, else a product of one of its
|
|
342
|
+
// dependencies (or of the shim) with that name, as SwiftPM reads it.
|
|
343
|
+
if (local !== undefined && (named === undefined || dump.targets.some((t) => t.name === local))) {
|
|
344
|
+
add(visit(`${identity}/${local}`, [...chain, key]));
|
|
345
|
+
continue;
|
|
346
|
+
}
|
|
347
|
+
if (named !== undefined) {
|
|
348
|
+
if (kitProducts.has(named)) {
|
|
349
|
+
kit.push(named);
|
|
350
|
+
continue;
|
|
351
|
+
}
|
|
352
|
+
const owner = productOwner(named, identity);
|
|
353
|
+
if (!owner)
|
|
354
|
+
throw new CliError(`package ${identity} has no target or dependency product ${named}`);
|
|
355
|
+
for (const dependencyKey of productTargets(owner, named))
|
|
356
|
+
add(visit(dependencyKey, [...chain, key]));
|
|
357
|
+
continue;
|
|
358
|
+
}
|
|
359
|
+
const product = 'product' in dependency ? dependency.product : undefined;
|
|
360
|
+
if (!product)
|
|
361
|
+
continue;
|
|
362
|
+
const [productName, packageName] = product;
|
|
363
|
+
if (packageName === 'SwiftBrowser' && kitProducts.has(productName)) {
|
|
364
|
+
kit.push(productName);
|
|
365
|
+
continue;
|
|
366
|
+
}
|
|
367
|
+
const other = byName.get((packageName ?? productName).toLowerCase());
|
|
368
|
+
if (!other)
|
|
369
|
+
throw new CliError(`the WebAssembly compiler cannot build ${packageName ?? productName}, which ${identity} depends on, yet`);
|
|
370
|
+
for (const dependencyKey of productTargets(other, productName))
|
|
371
|
+
add(visit(dependencyKey, [...chain, key]));
|
|
372
|
+
}
|
|
373
|
+
// The C modules it reaches: its C dependencies and theirs, nearest first;
|
|
374
|
+
// and the macros its dependencies load, which their clients can use.
|
|
375
|
+
const cModules = [];
|
|
376
|
+
for (const dependency of dependencies) {
|
|
377
|
+
const module = ordered.find((m) => m.name === dependency);
|
|
378
|
+
for (const c of [...(module.clang ? [module.name] : []), ...module.cModules])
|
|
379
|
+
if (!cModules.includes(c))
|
|
380
|
+
cModules.push(c);
|
|
381
|
+
for (const m of module.macros)
|
|
382
|
+
if (!macros.includes(m))
|
|
383
|
+
macros.push(m);
|
|
384
|
+
}
|
|
385
|
+
let module;
|
|
386
|
+
if (swift.length > 0) {
|
|
387
|
+
const resources = (target.resources ?? []).length > 0 || hasImplicitResources(dir, targetPath, excluded);
|
|
388
|
+
const declaresBundle = swift.some((file) => path.basename(file) === FULL_FOUNDATION_FILE);
|
|
389
|
+
module = {
|
|
390
|
+
name,
|
|
391
|
+
identity,
|
|
392
|
+
sources: swift,
|
|
393
|
+
dependencies,
|
|
394
|
+
kitProducts: kit,
|
|
395
|
+
flags: settingsFlags(target, dump, own),
|
|
396
|
+
cModules,
|
|
397
|
+
macros,
|
|
398
|
+
...(target.type === 'macro' ? { macro: true } : {}),
|
|
399
|
+
...(resources && !declaresBundle ? { resourceBundle: `${identity}_${name}` } : {}),
|
|
400
|
+
};
|
|
401
|
+
}
|
|
402
|
+
else {
|
|
403
|
+
const moduleName = c99Name(name);
|
|
404
|
+
const includeDir = path.join(targetPath, target.publicHeadersPath ?? 'include');
|
|
405
|
+
const cxx = cFamily.some((file) => /\.(cc|cpp|cxx|c\+\+|mm)$/.test(file));
|
|
406
|
+
const settings = clangSettings(target, dump, targetPath, cxx, own);
|
|
407
|
+
const moduleMap = moduleMapFor(dir, includeDir, moduleName);
|
|
408
|
+
module = {
|
|
409
|
+
name: moduleName,
|
|
410
|
+
identity,
|
|
411
|
+
// Headers and assembly are not compiled on their own.
|
|
412
|
+
sources: cFamily.filter((file) => !/\.(s|S)$/.test(file)),
|
|
413
|
+
dependencies,
|
|
414
|
+
kitProducts: kit,
|
|
415
|
+
flags: settings.flags,
|
|
416
|
+
cModules,
|
|
417
|
+
macros: [],
|
|
418
|
+
clang: { includeDir, headerSearchPaths: settings.headerSearchPaths, ...(moduleMap ? { moduleMap } : {}) },
|
|
419
|
+
};
|
|
420
|
+
}
|
|
421
|
+
modules.set(key, module);
|
|
422
|
+
ordered.push(module);
|
|
423
|
+
return module;
|
|
424
|
+
};
|
|
425
|
+
const roots = [];
|
|
426
|
+
for (const [identity, { dump }] of packages) {
|
|
427
|
+
const wanted = used ? used.get(identity) : dump.products.filter((p) => p.type['library'] !== undefined).map((p) => p.name);
|
|
428
|
+
for (const product of wanted ?? []) {
|
|
429
|
+
for (const key of productTargets(identity, product))
|
|
430
|
+
roots.push(visit(key, []));
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
// What the app links: the products' modules and what they depend on; the rest only builds plugins.
|
|
434
|
+
const linked = new Set();
|
|
435
|
+
const reach = (module) => {
|
|
436
|
+
if (module.macro || linked.has(module.name))
|
|
437
|
+
return;
|
|
438
|
+
linked.add(module.name);
|
|
439
|
+
for (const dependency of module.dependencies)
|
|
440
|
+
reach(ordered.find((m) => m.name === dependency));
|
|
441
|
+
};
|
|
442
|
+
for (const root of roots)
|
|
443
|
+
reach(root);
|
|
444
|
+
for (const module of ordered)
|
|
445
|
+
if (!linked.has(module.name) && !module.macro)
|
|
446
|
+
module.pluginOnly = true;
|
|
447
|
+
return ordered;
|
|
448
|
+
}
|
|
449
|
+
/** `swift package dump-package` of each copy (the native toolchain reads the manifests). */
|
|
450
|
+
export async function dumpVendored(toolchain, vendored) {
|
|
451
|
+
const packages = new Map();
|
|
452
|
+
for (const [identity, copy] of vendored) {
|
|
453
|
+
if (copy.standIn)
|
|
454
|
+
continue;
|
|
455
|
+
const result = await run(toolchain.swift, ['package', 'dump-package', '--scratch-path', path.join(copy.dir, '.build', 'dump')], {
|
|
456
|
+
cwd: copy.dir,
|
|
457
|
+
env: toolchainEnv(toolchain),
|
|
458
|
+
});
|
|
459
|
+
if (result.status !== 0)
|
|
460
|
+
throw new CliError(`swift package dump-package failed for ${identity}:\n${result.output}`);
|
|
461
|
+
const json = result.output.slice(result.output.indexOf('{'), result.output.lastIndexOf('}') + 1);
|
|
462
|
+
packages.set(identity, { dir: copy.dir, dump: JSON.parse(json) });
|
|
463
|
+
}
|
|
464
|
+
return packages;
|
|
465
|
+
}
|
|
466
|
+
//# sourceMappingURL=wasmPackages.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wasmPackages.js","sourceRoot":"","sources":["../src/wasmPackages.ts"],"names":[],"mappings":"AAAA,8DAA8D;AAC9D,6EAA6E;AAC7E,8EAA8E;AAC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C,SAAoB,EAAE,QAAkB;IACzE,MAAM,QAAQ,GAAG,IAAI,GAAG,EAAgD,CAAC;IACzE,KAAK,MAAM,CAAC,QAAQ,EAAE,IAAI,CAAC,IAAI,QAAQ,EAAE,CAAC;QACxC,IAAI,IAAI,CAAC,OAAO;YAAE,SAAS;QAC3B,MAAM,MAAM,GAAG,MAAM,GAAG,CAAC,SAAS,CAAC,KAAK,EAAE,CAAC,SAAS,EAAE,cAAc,EAAE,gBAAgB,EAAE,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC,EAAE;YAC9H,GAAG,EAAE,IAAI,CAAC,GAAG;YACb,GAAG,EAAE,YAAY,CAAC,SAAS,CAAC;SAC7B,CAAC,CAAC;QACH,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC;YAAE,MAAM,IAAI,QAAQ,CAAC,yCAAyC,QAAQ,MAAM,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC;QACpH,MAAM,IAAI,GAAG,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,CAAC,WAAW,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;QACjG,QAAQ,CAAC,GAAG,CAAC,QAAQ,EAAE,EAAE,GAAG,EAAE,IAAI,CAAC,GAAG,EAAE,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,CAAkB,EAAE,CAAC,CAAC;IACrF,CAAC;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { type Toolchain } from './toolchain.js';
|
|
2
|
+
/** The target triple the SDK's files are laid out for. */
|
|
3
|
+
export declare const WASM_SDK_TRIPLE = "wasm32-unknown-wasip1";
|
|
4
|
+
export interface WasmSdk {
|
|
5
|
+
/** The SDK's `wasm32-unknown-wasip1` directory (WASI.sdk, swift.xctoolchain). */
|
|
6
|
+
root: string;
|
|
7
|
+
/** Where it came from: the native toolchain's install, the CLI's cache, or SWIFTBROWSER_WASM_SDK. */
|
|
8
|
+
source: 'toolchain' | 'managed' | 'env';
|
|
9
|
+
}
|
|
10
|
+
/** The SDK's static libraries and Swift modules for WASI (`swift_static/wasi`), where Foundation's archives are. */
|
|
11
|
+
export declare function wasmSdkLibDir(sdk: WasmSdk): string;
|
|
12
|
+
/** Where the CLI keeps the SDK it downloaded. */
|
|
13
|
+
export declare function managedWasmSdkDir(): string;
|
|
14
|
+
/**
|
|
15
|
+
* The SDK to read: SWIFTBROWSER_WASM_SDK (a target directory), else the one
|
|
16
|
+
* the native toolchain installed, else the CLI's own download; null when
|
|
17
|
+
* there is none.
|
|
18
|
+
*/
|
|
19
|
+
export declare function findWasmSdk(toolchain: Toolchain | null, env?: NodeJS.ProcessEnv): WasmSdk | null;
|
|
20
|
+
/**
|
|
21
|
+
* Downloads the pinned SDK into the cache, checks it against its checksum and
|
|
22
|
+
* unpacks it; returns it. Uses `tar`, as the binaryen download does.
|
|
23
|
+
*/
|
|
24
|
+
export declare function installManagedWasmSdk(options?: {
|
|
25
|
+
url?: string;
|
|
26
|
+
checksum?: string;
|
|
27
|
+
}): Promise<WasmSdk>;
|
package/dist/wasmSdk.js
ADDED
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
// The Swift SDK for WebAssembly as files: the stdlib, Foundation and the WASI
|
|
2
|
+
// sysroot that the WebAssembly compiler reads and the ICU data comes from.
|
|
3
|
+
//
|
|
4
|
+
// A native toolchain installs the SDK itself (`swift sdk install`), and SwiftPM
|
|
5
|
+
// builds need it there. The WebAssembly compiler only needs the files, so
|
|
6
|
+
// without a native toolchain the CLI downloads the same pinned artifact bundle
|
|
7
|
+
// into its cache (`installManagedWasmSdk`): 93 MB, 347 MB unpacked.
|
|
8
|
+
import { spawnSync } from 'node:child_process';
|
|
9
|
+
import { createHash } from 'node:crypto';
|
|
10
|
+
import { existsSync, mkdirSync, readdirSync, renameSync, rmSync, writeFileSync } from 'node:fs';
|
|
11
|
+
import { homedir } from 'node:os';
|
|
12
|
+
import path from 'node:path';
|
|
13
|
+
import { WASM_SDK, WASM_SDK_CHECKSUM, WASM_SDK_URL, cacheDir, toolchainEnv } from './toolchain.js';
|
|
14
|
+
/** The target triple the SDK's files are laid out for. */
|
|
15
|
+
export const WASM_SDK_TRIPLE = 'wasm32-unknown-wasip1';
|
|
16
|
+
/** The SDK's static libraries and Swift modules for WASI (`swift_static/wasi`), where Foundation's archives are. */
|
|
17
|
+
export function wasmSdkLibDir(sdk) {
|
|
18
|
+
return path.join(sdk.root, 'swift.xctoolchain', 'usr', 'lib', 'swift_static', 'wasi');
|
|
19
|
+
}
|
|
20
|
+
/** Whether `root` looks like the SDK's target directory. */
|
|
21
|
+
function isSdkRoot(root) {
|
|
22
|
+
return existsSync(path.join(root, 'swift.xctoolchain', 'usr', 'lib', 'swift_static', 'wasi', 'Swift.swiftmodule'));
|
|
23
|
+
}
|
|
24
|
+
/** The target directory inside an unpacked artifact bundle, if it has one. */
|
|
25
|
+
function bundleRoot(bundle) {
|
|
26
|
+
if (!existsSync(bundle))
|
|
27
|
+
return null;
|
|
28
|
+
for (const entry of readdirSync(bundle).sort()) {
|
|
29
|
+
const root = path.join(bundle, entry, WASM_SDK_TRIPLE);
|
|
30
|
+
if (isSdkRoot(root))
|
|
31
|
+
return root;
|
|
32
|
+
}
|
|
33
|
+
return null;
|
|
34
|
+
}
|
|
35
|
+
/** Where the CLI keeps the SDK it downloaded. */
|
|
36
|
+
export function managedWasmSdkDir() {
|
|
37
|
+
return path.join(cacheDir(), 'wasm-sdk', WASM_SDK_CHECKSUM.slice(0, 16));
|
|
38
|
+
}
|
|
39
|
+
/** The SDK the native toolchain installed, as `swift sdk configure` shows it, or at SwiftPM's default place. */
|
|
40
|
+
function toolchainWasmSdk(toolchain, env) {
|
|
41
|
+
const shown = spawnSync(toolchain.swift, ['sdk', 'configure', WASM_SDK, WASM_SDK_TRIPLE, '--show-configuration'], {
|
|
42
|
+
encoding: 'utf8',
|
|
43
|
+
env: toolchainEnv(toolchain, env),
|
|
44
|
+
});
|
|
45
|
+
if (shown.status === 0) {
|
|
46
|
+
const match = /^swiftStaticResourcesPath: (.+)$/m.exec(shown.stdout);
|
|
47
|
+
// <root>/swift.xctoolchain/usr/lib/swift_static
|
|
48
|
+
const root = match ? path.resolve(match[1].trim(), '..', '..', '..', '..') : null;
|
|
49
|
+
if (root && isSdkRoot(root))
|
|
50
|
+
return root;
|
|
51
|
+
}
|
|
52
|
+
return bundleRoot(path.join(env['SWIFTPM_HOME'] ?? path.join(homedir(), '.swiftpm'), 'swift-sdks', `${WASM_SDK}.artifactbundle`));
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* The SDK to read: SWIFTBROWSER_WASM_SDK (a target directory), else the one
|
|
56
|
+
* the native toolchain installed, else the CLI's own download; null when
|
|
57
|
+
* there is none.
|
|
58
|
+
*/
|
|
59
|
+
export function findWasmSdk(toolchain, env = process.env) {
|
|
60
|
+
const explicit = env['SWIFTBROWSER_WASM_SDK'];
|
|
61
|
+
if (explicit)
|
|
62
|
+
return isSdkRoot(explicit) ? { root: path.resolve(explicit), source: 'env' } : null;
|
|
63
|
+
const installed = toolchain ? toolchainWasmSdk(toolchain, env) : null;
|
|
64
|
+
if (installed)
|
|
65
|
+
return { root: installed, source: 'toolchain' };
|
|
66
|
+
const managed = bundleRoot(path.join(managedWasmSdkDir(), `${WASM_SDK}.artifactbundle`));
|
|
67
|
+
return managed ? { root: managed, source: 'managed' } : null;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Downloads the pinned SDK into the cache, checks it against its checksum and
|
|
71
|
+
* unpacks it; returns it. Uses `tar`, as the binaryen download does.
|
|
72
|
+
*/
|
|
73
|
+
export async function installManagedWasmSdk(options = {}) {
|
|
74
|
+
const url = options.url ?? WASM_SDK_URL;
|
|
75
|
+
const checksum = options.checksum ?? WASM_SDK_CHECKSUM;
|
|
76
|
+
const response = await fetch(url);
|
|
77
|
+
if (!response.ok)
|
|
78
|
+
throw new Error(`downloading ${url}: HTTP ${response.status}`);
|
|
79
|
+
const bytes = Buffer.from(await response.arrayBuffer());
|
|
80
|
+
const digest = createHash('sha256').update(bytes).digest('hex');
|
|
81
|
+
if (digest !== checksum)
|
|
82
|
+
throw new Error(`the Swift SDK for WebAssembly does not match its checksum: ${digest} (expected ${checksum})`);
|
|
83
|
+
const dest = managedWasmSdkDir();
|
|
84
|
+
const temp = `${dest}.tmp-${process.pid}`;
|
|
85
|
+
rmSync(temp, { recursive: true, force: true });
|
|
86
|
+
mkdirSync(temp, { recursive: true });
|
|
87
|
+
const tarball = path.join(temp, 'sdk.tar.gz');
|
|
88
|
+
writeFileSync(tarball, bytes);
|
|
89
|
+
const tar = spawnSync('tar', ['xzf', tarball, '-C', temp], { encoding: 'utf8' });
|
|
90
|
+
rmSync(tarball, { force: true });
|
|
91
|
+
if (tar.status !== 0) {
|
|
92
|
+
rmSync(temp, { recursive: true, force: true });
|
|
93
|
+
throw new Error(`unpacking the Swift SDK for WebAssembly: ${tar.stderr}`);
|
|
94
|
+
}
|
|
95
|
+
if (!bundleRoot(path.join(temp, `${WASM_SDK}.artifactbundle`))) {
|
|
96
|
+
rmSync(temp, { recursive: true, force: true });
|
|
97
|
+
throw new Error(`${url} has no ${WASM_SDK}.artifactbundle with a ${WASM_SDK_TRIPLE} SDK`);
|
|
98
|
+
}
|
|
99
|
+
rmSync(dest, { recursive: true, force: true });
|
|
100
|
+
renameSync(temp, dest);
|
|
101
|
+
return { root: bundleRoot(path.join(dest, `${WASM_SDK}.artifactbundle`)), source: 'managed' };
|
|
102
|
+
}
|
|
103
|
+
//# sourceMappingURL=wasmSdk.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wasmSdk.js","sourceRoot":"","sources":["../src/wasmSdk.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,2EAA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