@agimon-ai/po 0.0.0-alpha.78 → 0.0.0-alpha.80
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/dist/catalog/index.json +60 -59
- package/dist/package.cjs +1 -1
- package/dist/package.mjs +1 -1
- package/dist/src/builders/apiContractExport/index.cjs +1 -1
- package/dist/src/builders/apiContractExport/index.mjs +1 -1
- package/dist/src/builders/native/index.cjs +138 -52
- package/dist/src/builders/native/index.cjs.map +1 -1
- package/dist/src/builders/native/index.d.mts.map +1 -1
- package/dist/src/builders/native/index.mjs +140 -52
- package/dist/src/builders/native/index.mjs.map +1 -1
- package/dist/src/builders/server/logSink.cjs +1 -1
- package/dist/src/builders/server/logSink.mjs +1 -1
- package/dist/src/builders/server/runtime.cjs +0 -6
- package/dist/src/builders/server/runtime.cjs.map +1 -1
- package/dist/src/builders/server/runtime.mjs +1 -7
- package/dist/src/builders/server/runtime.mjs.map +1 -1
- package/dist/src/builders/web/index.cjs +1 -1
- package/dist/src/builders/web/index.mjs +1 -1
- package/dist/src/builders/web/webPluginManifest.cjs +6 -7
- package/dist/src/builders/web/webPluginManifest.cjs.map +1 -1
- package/dist/src/builders/web/webPluginManifest.d.mts +4 -5
- package/dist/src/builders/web/webPluginManifest.d.mts.map +1 -1
- package/dist/src/builders/web/webPluginManifest.mjs +6 -7
- package/dist/src/builders/web/webPluginManifest.mjs.map +1 -1
- package/dist/src/cli/commands/sync/index.cjs +0 -38
- package/dist/src/cli/commands/sync/index.cjs.map +1 -1
- package/dist/src/cli/commands/sync/index.d.mts.map +1 -1
- package/dist/src/cli/commands/sync/index.mjs +0 -38
- package/dist/src/cli/commands/sync/index.mjs.map +1 -1
- package/dist/src/composition/syncService/localBuilds.cjs +1 -1
- package/dist/src/composition/syncService/localBuilds.mjs +1 -1
- package/package.json +27 -26
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
const require_runtime = require("../../../_virtual/_rolldown/runtime.cjs");
|
|
2
2
|
const require_webPluginScan = require("../web/webPluginScan.cjs");
|
|
3
3
|
const require_index = require("../web/index.cjs");
|
|
4
|
+
let node_module = require("node:module");
|
|
4
5
|
let node_path = require("node:path");
|
|
5
6
|
node_path = require_runtime.__toESM(node_path, 1);
|
|
6
7
|
let node_fs_promises = require("node:fs/promises");
|
|
7
8
|
node_fs_promises = require_runtime.__toESM(node_fs_promises, 1);
|
|
8
|
-
let _agimon_ai_po_core_nodePlatform = require("@agimon-ai/po-core/nodePlatform");
|
|
9
|
-
let _agimon_ai_po_core_platform = require("@agimon-ai/po-core/platform");
|
|
10
9
|
let node_crypto = require("node:crypto");
|
|
11
10
|
node_crypto = require_runtime.__toESM(node_crypto, 1);
|
|
12
11
|
let _agimon_ai_po_core_native = require("@agimon-ai/po-core/native");
|
|
@@ -21,9 +20,10 @@ let rolldown = require("rolldown");
|
|
|
21
20
|
* runs rolldown in process: the input is already built per package, so each bundle only joins
|
|
22
21
|
* that package's files and checks that every bare import is one the shell provides.
|
|
23
22
|
*/
|
|
24
|
-
/** Bumped
|
|
25
|
-
const GLOBAL_NATIVE_BUILD_FORMAT = "global-native-
|
|
23
|
+
/** Bumped when build output or package-copy admission changes, so an old record is never reused. */
|
|
24
|
+
const GLOBAL_NATIVE_BUILD_FORMAT = "global-native-5";
|
|
26
25
|
const PLUGINS_DIRECTORY = "plugins";
|
|
26
|
+
const UI_MODULE = "@agimon-ai/po-native-components";
|
|
27
27
|
const HOST_MODULES = new Set(_agimon_ai_po_core_native.NATIVE_HOST_MODULE_IDS);
|
|
28
28
|
/** The build key for these plugin roots and where its build lives, without building anything. */
|
|
29
29
|
async function resolveGlobalNativeBuild(input) {
|
|
@@ -36,7 +36,21 @@ async function resolveGlobalNativeBuild(input) {
|
|
|
36
36
|
status: "skipped",
|
|
37
37
|
reason: "no package declares a native plugin; no native composition is published"
|
|
38
38
|
};
|
|
39
|
-
|
|
39
|
+
const resolve = (0, node_module.createRequire)(require("url").pathToFileURL(__filename).href).resolve;
|
|
40
|
+
const uiPackages = [UI_MODULE, "@agimon-ai/po-web-components"].map((name) => {
|
|
41
|
+
const packageDir = node_path.default.dirname(resolve(`${name}/package.json`));
|
|
42
|
+
return {
|
|
43
|
+
pluginId: name,
|
|
44
|
+
slot: name,
|
|
45
|
+
registrationOrder: 0,
|
|
46
|
+
packageDir,
|
|
47
|
+
packageName: name,
|
|
48
|
+
isHost: false,
|
|
49
|
+
client: { entry: node_path.default.relative(packageDir, resolve(name)) },
|
|
50
|
+
scopes: []
|
|
51
|
+
};
|
|
52
|
+
});
|
|
53
|
+
key = await require_index.globalBuildKey(`${GLOBAL_NATIVE_BUILD_FORMAT}:${JSON.stringify(_agimon_ai_po_core_native.NATIVE_HOST_MODULE_IDS)}`, void 0, [...plugins, ...uiPackages], input.files);
|
|
40
54
|
} catch (error) {
|
|
41
55
|
return {
|
|
42
56
|
status: "failed",
|
|
@@ -49,7 +63,8 @@ async function resolveGlobalNativeBuild(input) {
|
|
|
49
63
|
plugins,
|
|
50
64
|
key,
|
|
51
65
|
buildsRoot,
|
|
52
|
-
directory: node_path.default.join(buildsRoot, key)
|
|
66
|
+
directory: node_path.default.join(buildsRoot, key),
|
|
67
|
+
uiEntry: (0, node_module.createRequire)(require("url").pathToFileURL(__filename).href).resolve(UI_MODULE)
|
|
53
68
|
};
|
|
54
69
|
}
|
|
55
70
|
async function readBuildRecord(directory, files) {
|
|
@@ -64,65 +79,128 @@ async function readBuildRecord(directory, files) {
|
|
|
64
79
|
async function readGlobalNativeBuildRecord(poHome, key, files) {
|
|
65
80
|
return readBuildRecord(node_path.default.join(poHome, "build", "native", key), files);
|
|
66
81
|
}
|
|
67
|
-
/** The platforms `po sync` exports an over-the-air app bundle for. */
|
|
68
|
-
const NATIVE_APP_PLATFORMS = ["ios", "android"];
|
|
69
|
-
/**
|
|
70
|
-
* The app bundle `po sync` last exported for one platform, which `<home>/build/app-<platform>.json`
|
|
71
|
-
* names once the export is complete. Undefined when there is none. Never builds.
|
|
72
|
-
*/
|
|
73
|
-
async function readNativeAppBuild(poHome, platform, files = (0, _agimon_ai_po_core_nodePlatform.createNodePlatform)().env(poHome)) {
|
|
74
|
-
try {
|
|
75
|
-
const record = JSON.parse((0, _agimon_ai_po_core_platform.getOrThrow)(await files.readTextFile(node_path.default.join(poHome, "build", `app-${platform}.json`), _agimon_ai_po_core_platform.BACKGROUND_CONTEXT)));
|
|
76
|
-
if (typeof record.key !== "string" || !/^[a-f0-9]{64}$/u.test(record.key)) return void 0;
|
|
77
|
-
const directory = node_path.default.join(poHome, "build", "app", platform, record.key);
|
|
78
|
-
const descriptor = JSON.parse((0, _agimon_ai_po_core_platform.getOrThrow)(await files.readTextFile(node_path.default.join(directory, _agimon_ai_po_web_security.APP_DESCRIPTOR_PATH), _agimon_ai_po_core_platform.BACKGROUND_CONTEXT)));
|
|
79
|
-
if (descriptor.builtAt !== void 0 && (typeof descriptor.builtAt !== "number" || !Number.isSafeInteger(descriptor.builtAt) || descriptor.builtAt < 0)) return void 0;
|
|
80
|
-
return typeof descriptor.fingerprint === "string" ? {
|
|
81
|
-
key: record.key,
|
|
82
|
-
directory,
|
|
83
|
-
fingerprint: descriptor.fingerprint,
|
|
84
|
-
...descriptor.builtAt === void 0 ? {} : { builtAt: descriptor.builtAt }
|
|
85
|
-
} : void 0;
|
|
86
|
-
} catch {
|
|
87
|
-
return;
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
82
|
const isBareSpecifier = (source) => !source.startsWith(".") && !source.startsWith("\0") && !node_path.default.isAbsolute(source);
|
|
91
83
|
/** One plugin's module file name: a hash of its id, so any id is a safe top-level asset path. */
|
|
92
84
|
const pluginModuleFile = (pluginId) => `${node_crypto.default.createHash("sha256").update(pluginId).digest("hex").slice(0, 32)}.js`;
|
|
93
|
-
/**
|
|
94
|
-
|
|
85
|
+
/** Checks the tree-shaken ESM imports before the CommonJS body can run, including on older shells. */
|
|
86
|
+
function nativeImportGuard(program) {
|
|
87
|
+
const requirements = /* @__PURE__ */ new Map();
|
|
88
|
+
const namespaces = /* @__PURE__ */ new Map();
|
|
89
|
+
const requireExport = (module, name) => {
|
|
90
|
+
const names = requirements.get(module) ?? /* @__PURE__ */ new Set();
|
|
91
|
+
if (name !== void 0) names.add(name);
|
|
92
|
+
requirements.set(module, names);
|
|
93
|
+
};
|
|
94
|
+
for (const statement of program.body) if (statement.type === "ImportDeclaration") {
|
|
95
|
+
const module = statement.source.value;
|
|
96
|
+
requireExport(module);
|
|
97
|
+
for (const specifier of statement.specifiers) if (specifier.type === "ImportNamespaceSpecifier") namespaces.set(specifier.local.name, module);
|
|
98
|
+
else requireExport(module, specifier.type === "ImportDefaultSpecifier" ? "default" : specifier.imported.type === "Identifier" ? specifier.imported.name : specifier.imported.value);
|
|
99
|
+
} else if (statement.type === "ExportNamedDeclaration" && statement.source !== null) for (const specifier of statement.specifiers) requireExport(statement.source.value, specifier.local.type === "Identifier" ? specifier.local.name : specifier.local.value);
|
|
100
|
+
else if (statement.type === "ExportAllDeclaration") throw new Error("Native modules must name their external re-exports.");
|
|
101
|
+
const visit = (value, parent, key) => {
|
|
102
|
+
if (Array.isArray(value)) {
|
|
103
|
+
for (const item of value) visit(item, parent, key);
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
if (typeof value !== "object" || value === null) return;
|
|
107
|
+
const node = value;
|
|
108
|
+
if (node.type === "ImportExpression") throw new Error("Native external dynamic imports are unsupported; use named ESM imports.");
|
|
109
|
+
if (node.type === "CallExpression" && /^(?:__)?require(?:\$\d+)?$/u.test(String(node.callee?.name))) throw new Error("Native external CommonJS require is unsupported; use named ESM imports.");
|
|
110
|
+
if (node.type === "Identifier" && namespaces.has(String(node.name))) {
|
|
111
|
+
const module = namespaces.get(String(node.name));
|
|
112
|
+
if (parent?.type === "ImportNamespaceSpecifier" || key === "property" && parent?.computed === false || key === "key" && parent?.computed === false) return;
|
|
113
|
+
if (parent?.type !== "MemberExpression" || key !== "object") throw new Error(`Native namespace '${String(node.name)}' must use static member access.`);
|
|
114
|
+
const property = parent.property;
|
|
115
|
+
const name = parent.computed === false ? property.name : property.type === "Literal" ? property.value : void 0;
|
|
116
|
+
if (typeof name !== "string") throw new Error(`Native namespace '${String(node.name)}' has dynamic member access.`);
|
|
117
|
+
requireExport(module, name);
|
|
118
|
+
}
|
|
119
|
+
for (const [childKey, child] of Object.entries(node)) if (childKey !== "start" && childKey !== "end") visit(child, node, childKey);
|
|
120
|
+
};
|
|
121
|
+
visit(program);
|
|
122
|
+
const entries = [...requirements].map(([module, names]) => [module, [...names].sort()]);
|
|
123
|
+
return `;(function(requirements) {
|
|
124
|
+
function fail(id, name) {
|
|
125
|
+
var error = new Error('Update Po: missing ' + id + (name === null ? '' : '.' + name));
|
|
126
|
+
error.name = 'PoIncompatible';
|
|
127
|
+
error.code = 'PO_INCOMPATIBLE';
|
|
128
|
+
error.module = id;
|
|
129
|
+
error.export = name;
|
|
130
|
+
throw error;
|
|
131
|
+
}
|
|
132
|
+
for (var i = 0; i < requirements.length; i++) {
|
|
133
|
+
var id = requirements[i][0], names = requirements[i][1], value;
|
|
134
|
+
try { value = require(id); } catch (cause) { fail(id, null); }
|
|
135
|
+
for (var j = 0; j < names.length; j++) {
|
|
136
|
+
var name = names[j];
|
|
137
|
+
if (value == null || (name === 'default' ? value.__esModule && value.default === undefined : value[name] === undefined)) fail(id, name);
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
})(${JSON.stringify(entries)});\n`;
|
|
141
|
+
}
|
|
142
|
+
/** Bundles a native module. Only the shared UI module may bundle ordinary JS dependencies. */
|
|
143
|
+
async function bundleNativeModule(entry, ui, onNotice) {
|
|
144
|
+
let guard = "";
|
|
95
145
|
const bundle = await (0, rolldown.rolldown)({
|
|
96
|
-
input: await node_fs_promises.default.realpath(
|
|
97
|
-
cwd:
|
|
146
|
+
input: await node_fs_promises.default.realpath(entry),
|
|
147
|
+
cwd: node_path.default.dirname(entry),
|
|
98
148
|
platform: "neutral",
|
|
99
|
-
external: (id) => HOST_MODULES.has(id),
|
|
149
|
+
external: (id) => HOST_MODULES.has(id) && !(ui && id === UI_MODULE),
|
|
100
150
|
onLog: (level, log) => {
|
|
101
151
|
if (level === "warn") onNotice(log.message);
|
|
102
152
|
},
|
|
103
153
|
plugins: [{
|
|
104
154
|
name: "po-native-host-modules",
|
|
105
155
|
resolveId(source, importer) {
|
|
106
|
-
if (importer === void 0 || !isBareSpecifier(source)) return null;
|
|
156
|
+
if (importer === void 0 || !isBareSpecifier(source) || ui) return null;
|
|
107
157
|
if (HOST_MODULES.has(source)) return {
|
|
108
158
|
id: source,
|
|
109
159
|
external: true
|
|
110
160
|
};
|
|
111
161
|
this.error(`'${source}' imported by ${importer} is not a native host module; a native plugin may import only: ${_agimon_ai_po_core_native.NATIVE_HOST_MODULE_IDS.join(", ")}.`);
|
|
162
|
+
},
|
|
163
|
+
renderChunk(code, _chunk, options) {
|
|
164
|
+
if (options.format === "es") guard = nativeImportGuard(this.parse(code));
|
|
165
|
+
return null;
|
|
112
166
|
}
|
|
113
167
|
}]
|
|
114
168
|
});
|
|
115
169
|
try {
|
|
116
|
-
const
|
|
117
|
-
format: "
|
|
170
|
+
const esm = await bundle.generate({
|
|
171
|
+
format: "es",
|
|
118
172
|
codeSplitting: false,
|
|
119
173
|
exports: "named"
|
|
120
174
|
});
|
|
121
|
-
const [
|
|
122
|
-
if (output.length !== 1 ||
|
|
123
|
-
const
|
|
175
|
+
const [entryChunk] = esm.output;
|
|
176
|
+
if (esm.output.length !== 1 || entryChunk.type !== "chunk") throw new Error("A native module must be one JS file.");
|
|
177
|
+
const commonjs = await (0, rolldown.rolldown)({
|
|
178
|
+
input: "\0po-native-module.js",
|
|
179
|
+
platform: "neutral",
|
|
180
|
+
external: (id) => HOST_MODULES.has(id),
|
|
181
|
+
plugins: [{
|
|
182
|
+
name: "po-native-commonjs",
|
|
183
|
+
resolveId: (id) => id === "\0po-native-module.js" ? id : null,
|
|
184
|
+
load: (id) => id === "\0po-native-module.js" ? entryChunk.code : null
|
|
185
|
+
}]
|
|
186
|
+
});
|
|
187
|
+
let code;
|
|
188
|
+
try {
|
|
189
|
+
const { output } = await commonjs.generate({
|
|
190
|
+
format: "cjs",
|
|
191
|
+
codeSplitting: false,
|
|
192
|
+
exports: "named"
|
|
193
|
+
});
|
|
194
|
+
const [chunk] = output;
|
|
195
|
+
if (output.length !== 1 || chunk.type !== "chunk") throw new Error("A native module must be one JS file.");
|
|
196
|
+
code = chunk.code;
|
|
197
|
+
} finally {
|
|
198
|
+
await commonjs.close();
|
|
199
|
+
}
|
|
200
|
+
const source = guard + code;
|
|
201
|
+
const bytes = Buffer.byteLength(source);
|
|
124
202
|
if (bytes > _agimon_ai_po_web_security.NATIVE_COMPOSITION_MAX_BYTES) throw new Error(`The native plugin is ${String(bytes)} bytes, over the ${String(_agimon_ai_po_web_security.NATIVE_COMPOSITION_MAX_BYTES)} byte limit.`);
|
|
125
|
-
return
|
|
203
|
+
return source;
|
|
126
204
|
} finally {
|
|
127
205
|
await bundle.close();
|
|
128
206
|
}
|
|
@@ -136,14 +214,19 @@ async function bundleNativePlugins(plugins, outDir, onNotice) {
|
|
|
136
214
|
await node_fs_promises.default.mkdir(pluginsDirectory, { recursive: true });
|
|
137
215
|
const entries = {};
|
|
138
216
|
const failures = [];
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
217
|
+
const bundled = /* @__PURE__ */ new Set();
|
|
218
|
+
for (const plugin of plugins) {
|
|
219
|
+
if (bundled.has(plugin.pluginId)) continue;
|
|
220
|
+
bundled.add(plugin.pluginId);
|
|
221
|
+
try {
|
|
222
|
+
const file = pluginModuleFile(plugin.pluginId);
|
|
223
|
+
await node_fs_promises.default.writeFile(node_path.default.join(pluginsDirectory, file), await bundleNativeModule(node_path.default.join(plugin.packageDir, plugin.client.entry), false, onNotice));
|
|
224
|
+
entries[plugin.pluginId] = file;
|
|
225
|
+
} catch (error) {
|
|
226
|
+
const message = `native plugin '${plugin.pluginId}' could not be built: ${error instanceof Error ? error.message : String(error)}`;
|
|
227
|
+
failures.push(message);
|
|
228
|
+
onNotice(message);
|
|
229
|
+
}
|
|
147
230
|
}
|
|
148
231
|
if (Object.keys(entries).length === 0) throw new Error(failures.join("\n"));
|
|
149
232
|
return entries;
|
|
@@ -167,7 +250,7 @@ async function ensureGlobalNativeBuild(input) {
|
|
|
167
250
|
const notice = input.onNotice ?? (() => {});
|
|
168
251
|
const resolved = await resolveGlobalNativeBuild(input);
|
|
169
252
|
if (resolved.status !== "resolved") return resolved;
|
|
170
|
-
const { plugins, key, buildsRoot, directory } = resolved;
|
|
253
|
+
const { plugins, key, buildsRoot, directory, uiEntry } = resolved;
|
|
171
254
|
const existing = await readBuildRecord(directory, input.files);
|
|
172
255
|
if (existing !== void 0) return {
|
|
173
256
|
status: "cached",
|
|
@@ -177,9 +260,14 @@ async function ensureGlobalNativeBuild(input) {
|
|
|
177
260
|
try {
|
|
178
261
|
await require_index.buildKeyDirectory(buildsRoot, key, directory, async (temporary) => {
|
|
179
262
|
const pluginEntries = await bundleNativePlugins(plugins, temporary, notice);
|
|
263
|
+
const uiFile = "ui.js";
|
|
264
|
+
const uiSource = await bundleNativeModule(uiEntry, true, notice);
|
|
265
|
+
await node_fs_promises.default.writeFile(node_path.default.join(temporary, PLUGINS_DIRECTORY, uiFile), uiSource);
|
|
266
|
+
notice(`native UI module: ${String(Buffer.byteLength(uiSource))} bytes`);
|
|
180
267
|
return {
|
|
181
268
|
key,
|
|
182
269
|
pluginEntries,
|
|
270
|
+
uiEntry: uiFile,
|
|
183
271
|
plugins: plugins.map(({ pluginId, packageDir, isHost }) => ({
|
|
184
272
|
pluginId,
|
|
185
273
|
packageDir,
|
|
@@ -204,11 +292,9 @@ async function ensureGlobalNativeBuild(input) {
|
|
|
204
292
|
/** The `poNative.pluginId` values a mount runs: those of its own package roots. */
|
|
205
293
|
const mountNativePluginIds = require_index.mountWebPluginIds;
|
|
206
294
|
//#endregion
|
|
207
|
-
exports.NATIVE_APP_PLATFORMS = NATIVE_APP_PLATFORMS;
|
|
208
295
|
exports.ensureGlobalNativeBuild = ensureGlobalNativeBuild;
|
|
209
296
|
exports.mountNativePluginIds = mountNativePluginIds;
|
|
210
297
|
exports.readGlobalNativeBuildRecord = readGlobalNativeBuildRecord;
|
|
211
298
|
exports.readGlobalNativeBuildStatus = readGlobalNativeBuildStatus;
|
|
212
|
-
exports.readNativeAppBuild = readNativeAppBuild;
|
|
213
299
|
|
|
214
300
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":["NATIVE_HOST_MODULE_IDS","path","scanWebPlugins","globalBuildKey","readBuildJson","createNodePlatform","getOrThrow","BACKGROUND_CONTEXT","APP_DESCRIPTOR_PATH","crypto","fs","NATIVE_COMPOSITION_MAX_BYTES","singleFlightBuild","buildKeyDirectory","mountWebPluginIds"],"sources":["../../../../src/builders/native/index.ts"],"sourcesContent":["import crypto from 'node:crypto';\nimport fs from 'node:fs/promises';\nimport path from 'node:path';\n\nimport { NATIVE_HOST_MODULE_IDS } from '@agimon-ai/po-core/native';\nimport { createNodePlatform } from '@agimon-ai/po-core/nodePlatform';\nimport { BACKGROUND_CONTEXT, type FileSystem, getOrThrow } from '@agimon-ai/po-core/platform';\nimport type { GlobalNativeBuild, NativeAppBuild } from '@agimon-ai/po-core/webCompositions';\nimport { APP_DESCRIPTOR_PATH, NATIVE_COMPOSITION_MAX_BYTES } from '@agimon-ai/po-web-security';\nimport { rolldown } from 'rolldown';\n\nimport { buildKeyDirectory, globalBuildKey, mountWebPluginIds, readBuildJson, singleFlightBuild } from '../web';\nimport type { DeclaredWebPlugin } from '../web/webPluginManifest';\nimport { scanWebPlugins } from '../web/webPluginScan';\n\n/**\n * The global native build: each package's `poNative` client bundled into its own CommonJS module\n * the po-native shell verifies and evaluates against its own host modules, one plugin at a time.\n *\n * It shares the web build's key, temporary directory, rename and `build.json` handling, and\n * runs rolldown in process: the input is already built per package, so each bundle only joins\n * that package's files and checks that every bare import is one the shell provides.\n */\n\n/** Bumped whenever the build's output layout changes, so an old layout is never reused. */\nconst GLOBAL_NATIVE_BUILD_FORMAT = 'global-native-3';\nconst PLUGINS_DIRECTORY = 'plugins';\nconst HOST_MODULES: ReadonlySet<string> = new Set(NATIVE_HOST_MODULE_IDS);\n\n/** One build's record: the publishable build plus each plugin's package, for resolving a mount's plugins. */\nexport interface GlobalNativeBuildRecord extends GlobalNativeBuild {\n plugins: { pluginId: string; packageDir: string; isHost: boolean }[];\n}\n\nexport interface GlobalNativeBuildInput {\n /** Po's global home; builds land in `<home>/build/native/<key>/`. */\n poHome: string;\n files?: FileSystem;\n /** The union of every scope's package roots; roots without a poNative block are ignored. */\n pluginRoots: readonly string[];\n onNotice?: (message: string) => void;\n}\n\nexport type GlobalNativeBuildResult =\n | { status: 'built' | 'cached'; build: GlobalNativeBuildRecord }\n | { status: 'skipped'; reason: string }\n | { status: 'failed'; reason: string };\n\ntype ResolvedGlobalNativeBuild =\n | {\n status: 'resolved';\n plugins: DeclaredWebPlugin[];\n key: string;\n buildsRoot: string;\n directory: string;\n }\n | { status: 'skipped'; reason: string }\n | { status: 'failed'; reason: string };\n\n/** The build key for these plugin roots and where its build lives, without building anything. */\nasync function resolveGlobalNativeBuild(input: GlobalNativeBuildInput): Promise<ResolvedGlobalNativeBuild> {\n const pluginRoots = [...new Set(input.pluginRoots.map((root) => path.resolve(root)))].sort();\n let plugins: DeclaredWebPlugin[];\n let key: string;\n try {\n plugins = await scanWebPlugins(undefined, pluginRoots, input.onNotice ?? ((): void => {}), 'poNative');\n if (plugins.length === 0)\n return { status: 'skipped', reason: 'no package declares a native plugin; no native composition is published' };\n key = await globalBuildKey(GLOBAL_NATIVE_BUILD_FORMAT, undefined, plugins, input.files);\n } catch (error) {\n return { status: 'failed', reason: error instanceof Error ? error.message : String(error) };\n }\n const buildsRoot = path.join(input.poHome, 'build', 'native');\n return { status: 'resolved', plugins, key, buildsRoot, directory: path.join(buildsRoot, key) };\n}\n\nasync function readBuildRecord(directory: string, files?: FileSystem): Promise<GlobalNativeBuildRecord | undefined> {\n const record = await readBuildJson<Omit<GlobalNativeBuildRecord, 'pluginsDirectory'>>(directory, files);\n if (record === undefined) return undefined;\n return { ...record, pluginsDirectory: path.join(directory, PLUGINS_DIRECTORY) };\n}\n\n/** The complete global native build of one key, or undefined when it is not there. Never builds. */\nexport async function readGlobalNativeBuildRecord(\n poHome: string,\n key: string,\n files?: FileSystem,\n): Promise<GlobalNativeBuildRecord | undefined> {\n return readBuildRecord(path.join(poHome, 'build', 'native', key), files);\n}\n\n/** The platforms `po sync` exports an over-the-air app bundle for. */\nexport const NATIVE_APP_PLATFORMS = ['ios', 'android'] as const;\n\n/**\n * The app bundle `po sync` last exported for one platform, which `<home>/build/app-<platform>.json`\n * names once the export is complete. Undefined when there is none. Never builds.\n */\nexport async function readNativeAppBuild(\n poHome: string,\n platform: string,\n files: FileSystem = createNodePlatform().env(poHome),\n): Promise<NativeAppBuild | undefined> {\n try {\n const record = JSON.parse(\n getOrThrow(await files.readTextFile(path.join(poHome, 'build', `app-${platform}.json`), BACKGROUND_CONTEXT)),\n ) as {\n key?: unknown;\n };\n if (typeof record.key !== 'string' || !/^[a-f0-9]{64}$/u.test(record.key)) return undefined;\n const directory = path.join(poHome, 'build', 'app', platform, record.key);\n const descriptor = JSON.parse(\n getOrThrow(await files.readTextFile(path.join(directory, APP_DESCRIPTOR_PATH), BACKGROUND_CONTEXT)),\n ) as {\n fingerprint?: unknown;\n builtAt?: unknown;\n };\n if (\n descriptor.builtAt !== undefined &&\n (typeof descriptor.builtAt !== 'number' || !Number.isSafeInteger(descriptor.builtAt) || descriptor.builtAt < 0)\n )\n return undefined;\n return typeof descriptor.fingerprint === 'string'\n ? {\n key: record.key,\n directory,\n fingerprint: descriptor.fingerprint,\n ...(descriptor.builtAt === undefined ? {} : { builtAt: descriptor.builtAt }),\n }\n : undefined;\n } catch {\n // Never exported here (an installed Po, not a source checkout), or pruned: nothing to offer.\n return undefined;\n }\n}\n\nconst isBareSpecifier = (source: string): boolean =>\n !source.startsWith('.') && !source.startsWith('\\0') && !path.isAbsolute(source);\n\n/** One plugin's module file name: a hash of its id, so any id is a safe top-level asset path. */\nconst pluginModuleFile = (pluginId: string): string =>\n `${crypto.createHash('sha256').update(pluginId).digest('hex').slice(0, 32)}.js`;\n\n/** Bundles one plugin's client into CommonJS code exporting `nativePlugin`, host modules external. */\nasync function bundleNativePlugin(plugin: DeclaredWebPlugin, onNotice: (message: string) => void): Promise<string> {\n const bundle = await rolldown({\n input: await fs.realpath(path.join(plugin.packageDir, plugin.client.entry)),\n cwd: plugin.packageDir,\n platform: 'neutral',\n external: (id) => HOST_MODULES.has(id),\n onLog: (level, log) => {\n if (level === 'warn') onNotice(log.message);\n },\n plugins: [\n {\n name: 'po-native-host-modules',\n resolveId(source, importer) {\n if (importer === undefined || !isBareSpecifier(source)) return null;\n if (HOST_MODULES.has(source)) return { id: source, external: true };\n this.error(\n `'${source}' imported by ${importer} is not a native host module; a native plugin may import only: ${NATIVE_HOST_MODULE_IDS.join(', ')}.`,\n );\n },\n },\n ],\n });\n try {\n const { output } = await bundle.generate({ format: 'cjs', codeSplitting: false, exports: 'named' });\n const [chunk] = output;\n if (output.length !== 1 || chunk.type !== 'chunk')\n throw new Error(`A native plugin must bundle to exactly one file; the build produced ${String(output.length)}.`);\n const bytes = Buffer.byteLength(chunk.code);\n if (bytes > NATIVE_COMPOSITION_MAX_BYTES)\n throw new Error(\n `The native plugin is ${String(bytes)} bytes, over the ${String(NATIVE_COMPOSITION_MAX_BYTES)} byte limit.`,\n );\n return chunk.code;\n } finally {\n await bundle.close();\n }\n}\n\n/**\n * Bundles each plugin into `<outDir>/plugins/<hash>.js` and returns `pluginId -> module file`. A plugin\n * that fails to bundle is named in a notice and left out; the build fails only when none bundles.\n */\nasync function bundleNativePlugins(\n plugins: readonly DeclaredWebPlugin[],\n outDir: string,\n onNotice: (message: string) => void,\n): Promise<Record<string, string>> {\n const pluginsDirectory = path.join(outDir, PLUGINS_DIRECTORY);\n await fs.mkdir(pluginsDirectory, { recursive: true });\n const entries: Record<string, string> = {};\n const failures: string[] = [];\n for (const plugin of plugins) {\n try {\n const file = pluginModuleFile(plugin.pluginId);\n await fs.writeFile(path.join(pluginsDirectory, file), await bundleNativePlugin(plugin, onNotice));\n entries[plugin.pluginId] = file;\n } catch (error) {\n const message = `native plugin '${plugin.pluginId}' could not be built: ${error instanceof Error ? error.message : String(error)}`;\n failures.push(message);\n onNotice(message);\n }\n }\n if (Object.keys(entries).length === 0) throw new Error(failures.join('\\n'));\n return entries;\n}\n\n/** Whether the global native build for these plugin roots exists, for a check that must not build. */\nexport async function readGlobalNativeBuildStatus(\n input: GlobalNativeBuildInput,\n): Promise<\n | { status: 'current' | 'missing'; key: string }\n | { status: 'skipped'; reason: string }\n | { status: 'failed'; reason: string }\n> {\n const resolved = await resolveGlobalNativeBuild(input);\n if (resolved.status !== 'resolved') return resolved;\n return {\n status: (await readBuildRecord(resolved.directory, input.files)) === undefined ? 'missing' : 'current',\n key: resolved.key,\n };\n}\n\n/**\n * Ensures the one global native build for the given plugin roots exists and returns it.\n *\n * The output is `<home>/build/native/<key>/plugins/<hash>.js`, one module per plugin, built in a\n * temporary directory and renamed into place; an existing key builds nothing.\n */\nexport async function ensureGlobalNativeBuild(input: GlobalNativeBuildInput): Promise<GlobalNativeBuildResult> {\n const notice = input.onNotice ?? ((): void => {});\n const resolved = await resolveGlobalNativeBuild(input);\n if (resolved.status !== 'resolved') return resolved;\n const { plugins, key, buildsRoot, directory } = resolved;\n const existing = await readBuildRecord(directory, input.files);\n if (existing !== undefined) return { status: 'cached', build: existing };\n return singleFlightBuild(key, async (): Promise<GlobalNativeBuildResult> => {\n try {\n await buildKeyDirectory(buildsRoot, key, directory, async (temporary) => {\n const pluginEntries = await bundleNativePlugins(plugins, temporary, notice);\n return {\n key,\n pluginEntries,\n plugins: plugins.map(({ pluginId, packageDir, isHost }) => ({ pluginId, packageDir, isHost })),\n };\n });\n const build = await readBuildRecord(directory, input.files);\n if (build === undefined) throw new Error(`The native build '${key}' was not recorded.`);\n return { status: 'built', build };\n } catch (error) {\n return { status: 'failed', reason: error instanceof Error ? error.message : String(error) };\n }\n });\n}\n\n/** The `poNative.pluginId` values a mount runs: those of its own package roots. */\nexport const mountNativePluginIds: (build: GlobalNativeBuildRecord, packageRoots: readonly string[]) => string[] =\n mountWebPluginIds;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAyBA,MAAM,6BAA6B;AACnC,MAAM,oBAAoB;AAC1B,MAAM,eAAoC,IAAI,IAAIA,0BAAAA,sBAAsB;;AAiCxE,eAAe,yBAAyB,OAAmE;CACzG,MAAM,cAAc,CAAC,GAAG,IAAI,IAAI,MAAM,YAAY,KAAK,SAASC,UAAAA,QAAK,QAAQ,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK;CAC3F,IAAI;CACJ,IAAI;CACJ,IAAI;EACF,UAAU,MAAMC,sBAAAA,eAAe,KAAA,GAAW,aAAa,MAAM,mBAAyB,CAAC,IAAI,UAAU;EACrG,IAAI,QAAQ,WAAW,GACrB,OAAO;GAAE,QAAQ;GAAW,QAAQ;EAA0E;EAChH,MAAM,MAAMC,cAAAA,eAAe,4BAA4B,KAAA,GAAW,SAAS,MAAM,KAAK;CACxF,SAAS,OAAO;EACd,OAAO;GAAE,QAAQ;GAAU,QAAQ,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK;EAAE;CAC5F;CACA,MAAM,aAAaF,UAAAA,QAAK,KAAK,MAAM,QAAQ,SAAS,QAAQ;CAC5D,OAAO;EAAE,QAAQ;EAAY;EAAS;EAAK;EAAY,WAAWA,UAAAA,QAAK,KAAK,YAAY,GAAG;CAAE;AAC/F;AAEA,eAAe,gBAAgB,WAAmB,OAAkE;CAClH,MAAM,SAAS,MAAMG,cAAAA,cAAiE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D,MAAM,WAAW,MAAM,gBAAgB,WAAW,MAAM,KAAK;CAC7D,IAAI,aAAa,KAAA,GAAW,OAAO;EAAE,QAAQ;EAAU,OAAO;CAAS;CACvE,OAAOW,cAAAA,kBAAkB,KAAK,YAA8C;EAC1E,IAAI;GACF,MAAMC,cAAAA,kBAAkB,YAAY,KAAK,WAAW,OAAO,cAAc;IACvE,MAAM,gBAAgB,MAAM,oBAAoB,SAAS,WAAW,MAAM;IAC1E,OAAO;KACL;KACA;KACA,SAAS,QAAQ,KAAK,EAAE,UAAU,YAAY,cAAc;MAAE;MAAU;MAAY;KAAO,EAAE;IAC/F;GACF,CAAC;GACD,MAAM,QAAQ,MAAM,gBAAgB,WAAW,MAAM,KAAK;GAC1D,IAAI,UAAU,KAAA,GAAW,MAAM,IAAI,MAAM,qBAAqB,IAAI,oBAAoB;GACtF,OAAO;IAAE,QAAQ;IAAS;GAAM;EAClC,SAAS,OAAO;GACd,OAAO;IAAE,QAAQ;IAAU,QAAQ,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK;GAAE;EAC5F;CACF,CAAC;AACH;;AAGA,MAAa,uBACXC,cAAAA"}
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["NATIVE_HOST_MODULE_IDS","path","scanWebPlugins","createRequire","globalBuildKey","readBuildJson","crypto","fs","NATIVE_COMPOSITION_MAX_BYTES","singleFlightBuild","buildKeyDirectory","mountWebPluginIds"],"sources":["../../../../src/builders/native/index.ts"],"sourcesContent":["import crypto from 'node:crypto';\nimport fs from 'node:fs/promises';\nimport { createRequire } from 'node:module';\nimport path from 'node:path';\n\nimport { NATIVE_HOST_MODULE_IDS } from '@agimon-ai/po-core/native';\nimport type { FileSystem } from '@agimon-ai/po-core/platform';\nimport type { GlobalNativeBuild } from '@agimon-ai/po-core/webCompositions';\nimport { NATIVE_COMPOSITION_MAX_BYTES } from '@agimon-ai/po-web-security';\nimport { type PluginContext, rolldown } from 'rolldown';\n\nimport { buildKeyDirectory, globalBuildKey, mountWebPluginIds, readBuildJson, singleFlightBuild } from '../web';\nimport type { DeclaredWebPlugin } from '../web/webPluginManifest';\nimport { scanWebPlugins } from '../web/webPluginScan';\n\n/**\n * The global native build: each package's `poNative` client bundled into its own CommonJS module\n * the po-native shell verifies and evaluates against its own host modules, one plugin at a time.\n *\n * It shares the web build's key, temporary directory, rename and `build.json` handling, and\n * runs rolldown in process: the input is already built per package, so each bundle only joins\n * that package's files and checks that every bare import is one the shell provides.\n */\n\n/** Bumped when build output or package-copy admission changes, so an old record is never reused. */\nconst GLOBAL_NATIVE_BUILD_FORMAT = 'global-native-5';\nconst PLUGINS_DIRECTORY = 'plugins';\nconst UI_MODULE = '@agimon-ai/po-native-components';\nconst HOST_MODULES: ReadonlySet<string> = new Set(NATIVE_HOST_MODULE_IDS);\n\n/** One build's record: the publishable build plus each plugin's package, for resolving a mount's plugins. */\nexport interface GlobalNativeBuildRecord extends GlobalNativeBuild {\n plugins: { pluginId: string; packageDir: string; isHost: boolean }[];\n}\n\nexport interface GlobalNativeBuildInput {\n /** Po's global home; builds land in `<home>/build/native/<key>/`. */\n poHome: string;\n files?: FileSystem;\n /** The union of every scope's package roots; roots without a poNative block are ignored. */\n pluginRoots: readonly string[];\n onNotice?: (message: string) => void;\n}\n\nexport type GlobalNativeBuildResult =\n | { status: 'built' | 'cached'; build: GlobalNativeBuildRecord }\n | { status: 'skipped'; reason: string }\n | { status: 'failed'; reason: string };\n\ntype ResolvedGlobalNativeBuild =\n | {\n status: 'resolved';\n plugins: DeclaredWebPlugin[];\n key: string;\n uiEntry: string;\n buildsRoot: string;\n directory: string;\n }\n | { status: 'skipped'; reason: string }\n | { status: 'failed'; reason: string };\n\n/** The build key for these plugin roots and where its build lives, without building anything. */\nasync function resolveGlobalNativeBuild(input: GlobalNativeBuildInput): Promise<ResolvedGlobalNativeBuild> {\n const pluginRoots = [...new Set(input.pluginRoots.map((root) => path.resolve(root)))].sort();\n let plugins: DeclaredWebPlugin[];\n let key: string;\n try {\n plugins = await scanWebPlugins(undefined, pluginRoots, input.onNotice ?? ((): void => {}), 'poNative');\n if (plugins.length === 0)\n return { status: 'skipped', reason: 'no package declares a native plugin; no native composition is published' };\n const resolve = createRequire(import.meta.url).resolve;\n const uiPackages = [UI_MODULE, '@agimon-ai/po-web-components'].map((name) => {\n const packageDir = path.dirname(resolve(`${name}/package.json`));\n return {\n pluginId: name,\n slot: name,\n registrationOrder: 0,\n packageDir,\n packageName: name,\n isHost: false,\n client: { entry: path.relative(packageDir, resolve(name)) },\n scopes: [],\n } satisfies DeclaredWebPlugin;\n });\n key = await globalBuildKey(\n `${GLOBAL_NATIVE_BUILD_FORMAT}:${JSON.stringify(NATIVE_HOST_MODULE_IDS)}`,\n undefined,\n [...plugins, ...uiPackages],\n input.files,\n );\n } catch (error) {\n return { status: 'failed', reason: error instanceof Error ? error.message : String(error) };\n }\n const buildsRoot = path.join(input.poHome, 'build', 'native');\n return {\n status: 'resolved',\n plugins,\n key,\n buildsRoot,\n directory: path.join(buildsRoot, key),\n uiEntry: createRequire(import.meta.url).resolve(UI_MODULE),\n };\n}\n\nasync function readBuildRecord(directory: string, files?: FileSystem): Promise<GlobalNativeBuildRecord | undefined> {\n const record = await readBuildJson<Omit<GlobalNativeBuildRecord, 'pluginsDirectory'>>(directory, files);\n if (record === undefined) return undefined;\n return { ...record, pluginsDirectory: path.join(directory, PLUGINS_DIRECTORY) };\n}\n\n/** The complete global native build of one key, or undefined when it is not there. Never builds. */\nexport async function readGlobalNativeBuildRecord(\n poHome: string,\n key: string,\n files?: FileSystem,\n): Promise<GlobalNativeBuildRecord | undefined> {\n return readBuildRecord(path.join(poHome, 'build', 'native', key), files);\n}\n\nconst isBareSpecifier = (source: string): boolean =>\n !source.startsWith('.') && !source.startsWith('\\0') && !path.isAbsolute(source);\n\n/** One plugin's module file name: a hash of its id, so any id is a safe top-level asset path. */\nconst pluginModuleFile = (pluginId: string): string =>\n `${crypto.createHash('sha256').update(pluginId).digest('hex').slice(0, 32)}.js`;\n\n/** Checks the tree-shaken ESM imports before the CommonJS body can run, including on older shells. */\nfunction nativeImportGuard(program: ReturnType<PluginContext['parse']>): string {\n const requirements = new Map<string, Set<string>>();\n const namespaces = new Map<string, string>();\n const requireExport = (module: string, name?: string) => {\n const names = requirements.get(module) ?? new Set<string>();\n if (name !== undefined) names.add(name);\n requirements.set(module, names);\n };\n for (const statement of program.body) {\n if (statement.type === 'ImportDeclaration') {\n const module = statement.source.value;\n requireExport(module);\n for (const specifier of statement.specifiers) {\n if (specifier.type === 'ImportNamespaceSpecifier') namespaces.set(specifier.local.name, module);\n else\n requireExport(\n module,\n specifier.type === 'ImportDefaultSpecifier'\n ? 'default'\n : specifier.imported.type === 'Identifier'\n ? specifier.imported.name\n : specifier.imported.value,\n );\n }\n } else if (statement.type === 'ExportNamedDeclaration' && statement.source !== null) {\n for (const specifier of statement.specifiers)\n requireExport(\n statement.source.value,\n specifier.local.type === 'Identifier' ? specifier.local.name : specifier.local.value,\n );\n } else if (statement.type === 'ExportAllDeclaration') {\n throw new Error('Native modules must name their external re-exports.');\n }\n }\n const visit = (value: unknown, parent?: Record<string, unknown>, key?: string): void => {\n if (Array.isArray(value)) {\n for (const item of value) visit(item, parent, key);\n return;\n }\n if (typeof value !== 'object' || value === null) return;\n const node = value as Record<string, unknown>;\n if (node.type === 'ImportExpression')\n throw new Error('Native external dynamic imports are unsupported; use named ESM imports.');\n if (\n node.type === 'CallExpression' &&\n /^(?:__)?require(?:\\$\\d+)?$/u.test(String((node.callee as { name?: string })?.name))\n ) {\n throw new Error('Native external CommonJS require is unsupported; use named ESM imports.');\n }\n if (node.type === 'Identifier' && namespaces.has(String(node.name))) {\n const module = namespaces.get(String(node.name))!;\n if (\n parent?.type === 'ImportNamespaceSpecifier' ||\n (key === 'property' && parent?.computed === false) ||\n (key === 'key' && parent?.computed === false)\n )\n return;\n if (parent?.type !== 'MemberExpression' || key !== 'object') {\n throw new Error(`Native namespace '${String(node.name)}' must use static member access.`);\n }\n const property = parent.property as { type: string; name?: string; value?: unknown };\n const name = parent.computed === false ? property.name : property.type === 'Literal' ? property.value : undefined;\n if (typeof name !== 'string')\n throw new Error(`Native namespace '${String(node.name)}' has dynamic member access.`);\n requireExport(module, name);\n }\n for (const [childKey, child] of Object.entries(node))\n if (childKey !== 'start' && childKey !== 'end') visit(child, node, childKey);\n };\n visit(program);\n const entries = [...requirements].map(([module, names]) => [module, [...names].sort()]);\n return `;(function(requirements) {\n function fail(id, name) {\n var error = new Error('Update Po: missing ' + id + (name === null ? '' : '.' + name));\n error.name = 'PoIncompatible';\n error.code = 'PO_INCOMPATIBLE';\n error.module = id;\n error.export = name;\n throw error;\n }\n for (var i = 0; i < requirements.length; i++) {\n var id = requirements[i][0], names = requirements[i][1], value;\n try { value = require(id); } catch (cause) { fail(id, null); }\n for (var j = 0; j < names.length; j++) {\n var name = names[j];\n if (value == null || (name === 'default' ? value.__esModule && value.default === undefined : value[name] === undefined)) fail(id, name);\n }\n }\n})(${JSON.stringify(entries)});\\n`;\n}\n\n/** Bundles a native module. Only the shared UI module may bundle ordinary JS dependencies. */\nasync function bundleNativeModule(entry: string, ui: boolean, onNotice: (message: string) => void): Promise<string> {\n let guard = '';\n const bundle = await rolldown({\n input: await fs.realpath(entry),\n cwd: path.dirname(entry),\n platform: 'neutral',\n external: (id) => HOST_MODULES.has(id) && !(ui && id === UI_MODULE),\n onLog: (level, log) => {\n if (level === 'warn') onNotice(log.message);\n },\n plugins: [\n {\n name: 'po-native-host-modules',\n resolveId(source, importer) {\n if (importer === undefined || !isBareSpecifier(source) || ui) return null;\n if (HOST_MODULES.has(source)) return { id: source, external: true };\n this.error(\n `'${source}' imported by ${importer} is not a native host module; a native plugin may import only: ${NATIVE_HOST_MODULE_IDS.join(', ')}.`,\n );\n },\n renderChunk(code, _chunk, options) {\n if (options.format === 'es') guard = nativeImportGuard(this.parse(code));\n return null;\n },\n },\n ],\n });\n try {\n const esm = await bundle.generate({ format: 'es', codeSplitting: false, exports: 'named' });\n const [entryChunk] = esm.output;\n if (esm.output.length !== 1 || entryChunk.type !== 'chunk') throw new Error('A native module must be one JS file.');\n // .mjs inputs force Node default-import semantics. Our require map instead supplies Metro modules.\n const commonjs = await rolldown({\n input: '\\0po-native-module.js',\n platform: 'neutral',\n external: (id) => HOST_MODULES.has(id),\n plugins: [\n {\n name: 'po-native-commonjs',\n resolveId: (id) => (id === '\\0po-native-module.js' ? id : null),\n load: (id) => (id === '\\0po-native-module.js' ? entryChunk.code : null),\n },\n ],\n });\n let code: string;\n try {\n const { output } = await commonjs.generate({ format: 'cjs', codeSplitting: false, exports: 'named' });\n const [chunk] = output;\n if (output.length !== 1 || chunk.type !== 'chunk') throw new Error('A native module must be one JS file.');\n code = chunk.code;\n } finally {\n await commonjs.close();\n }\n const source = guard + code;\n const bytes = Buffer.byteLength(source);\n if (bytes > NATIVE_COMPOSITION_MAX_BYTES)\n throw new Error(\n `The native plugin is ${String(bytes)} bytes, over the ${String(NATIVE_COMPOSITION_MAX_BYTES)} byte limit.`,\n );\n return source;\n } finally {\n await bundle.close();\n }\n}\n\n/**\n * Bundles each plugin into `<outDir>/plugins/<hash>.js` and returns `pluginId -> module file`. A plugin\n * that fails to bundle is named in a notice and left out; the build fails only when none bundles.\n */\nasync function bundleNativePlugins(\n plugins: readonly DeclaredWebPlugin[],\n outDir: string,\n onNotice: (message: string) => void,\n): Promise<Record<string, string>> {\n const pluginsDirectory = path.join(outDir, PLUGINS_DIRECTORY);\n await fs.mkdir(pluginsDirectory, { recursive: true });\n const entries: Record<string, string> = {};\n const failures: string[] = [];\n const bundled = new Set<string>();\n for (const plugin of plugins) {\n if (bundled.has(plugin.pluginId)) continue;\n bundled.add(plugin.pluginId);\n try {\n const file = pluginModuleFile(plugin.pluginId);\n await fs.writeFile(\n path.join(pluginsDirectory, file),\n await bundleNativeModule(path.join(plugin.packageDir, plugin.client.entry), false, onNotice),\n );\n entries[plugin.pluginId] = file;\n } catch (error) {\n const message = `native plugin '${plugin.pluginId}' could not be built: ${error instanceof Error ? error.message : String(error)}`;\n failures.push(message);\n onNotice(message);\n }\n }\n if (Object.keys(entries).length === 0) throw new Error(failures.join('\\n'));\n return entries;\n}\n\n/** Whether the global native build for these plugin roots exists, for a check that must not build. */\nexport async function readGlobalNativeBuildStatus(\n input: GlobalNativeBuildInput,\n): Promise<\n | { status: 'current' | 'missing'; key: string }\n | { status: 'skipped'; reason: string }\n | { status: 'failed'; reason: string }\n> {\n const resolved = await resolveGlobalNativeBuild(input);\n if (resolved.status !== 'resolved') return resolved;\n return {\n status: (await readBuildRecord(resolved.directory, input.files)) === undefined ? 'missing' : 'current',\n key: resolved.key,\n };\n}\n\n/**\n * Ensures the one global native build for the given plugin roots exists and returns it.\n *\n * The output is `<home>/build/native/<key>/plugins/<hash>.js`, one module per plugin, built in a\n * temporary directory and renamed into place; an existing key builds nothing.\n */\nexport async function ensureGlobalNativeBuild(input: GlobalNativeBuildInput): Promise<GlobalNativeBuildResult> {\n const notice = input.onNotice ?? ((): void => {});\n const resolved = await resolveGlobalNativeBuild(input);\n if (resolved.status !== 'resolved') return resolved;\n const { plugins, key, buildsRoot, directory, uiEntry } = resolved;\n const existing = await readBuildRecord(directory, input.files);\n if (existing !== undefined) return { status: 'cached', build: existing };\n return singleFlightBuild(key, async (): Promise<GlobalNativeBuildResult> => {\n try {\n await buildKeyDirectory(buildsRoot, key, directory, async (temporary) => {\n const pluginEntries = await bundleNativePlugins(plugins, temporary, notice);\n const uiFile = 'ui.js';\n const uiSource = await bundleNativeModule(uiEntry, true, notice);\n await fs.writeFile(path.join(temporary, PLUGINS_DIRECTORY, uiFile), uiSource);\n notice(`native UI module: ${String(Buffer.byteLength(uiSource))} bytes`);\n return {\n key,\n pluginEntries,\n uiEntry: uiFile,\n plugins: plugins.map(({ pluginId, packageDir, isHost }) => ({ pluginId, packageDir, isHost })),\n };\n });\n const build = await readBuildRecord(directory, input.files);\n if (build === undefined) throw new Error(`The native build '${key}' was not recorded.`);\n return { status: 'built', build };\n } catch (error) {\n return { status: 'failed', reason: error instanceof Error ? error.message : String(error) };\n }\n });\n}\n\n/** The `poNative.pluginId` values a mount runs: those of its own package roots. */\nexport const mountNativePluginIds: (build: GlobalNativeBuildRecord, packageRoots: readonly string[]) => string[] =\n mountWebPluginIds;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAyBA,MAAM,6BAA6B;AACnC,MAAM,oBAAoB;AAC1B,MAAM,YAAY;AAClB,MAAM,eAAoC,IAAI,IAAIA,0BAAAA,sBAAsB;;AAkCxE,eAAe,yBAAyB,OAAmE;CACzG,MAAM,cAAc,CAAC,GAAG,IAAI,IAAI,MAAM,YAAY,KAAK,SAASC,UAAAA,QAAK,QAAQ,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK;CAC3F,IAAI;CACJ,IAAI;CACJ,IAAI;EACF,UAAU,MAAMC,sBAAAA,eAAe,KAAA,GAAW,aAAa,MAAM,mBAAyB,CAAC,IAAI,UAAU;EACrG,IAAI,QAAQ,WAAW,GACrB,OAAO;GAAE,QAAQ;GAAW,QAAQ;EAA0E;EAChH,MAAM,WAAA,GAAUC,YAAAA,cAAAA,CAAAA,QAAAA,KAAAA,CAAAA,CAAAA,cAAAA,UAAAA,CAAAA,CAAAA,IAA6B,CAAC,CAAC;EAC/C,MAAM,aAAa,CAAC,WAAW,8BAA8B,CAAC,CAAC,KAAK,SAAS;GAC3E,MAAM,aAAaF,UAAAA,QAAK,QAAQ,QAAQ,GAAG,KAAK,cAAc,CAAC;GAC/D,OAAO;IACL,UAAU;IACV,MAAM;IACN,mBAAmB;IACnB;IACA,aAAa;IACb,QAAQ;IACR,QAAQ,EAAE,OAAOA,UAAAA,QAAK,SAAS,YAAY,QAAQ,IAAI,CAAC,EAAE;IAC1D,QAAQ,CAAC;GACX;EACF,CAAC;EACD,MAAM,MAAMG,cAAAA,eACV,GAAG,2BAA2B,GAAG,KAAK,UAAUJ,0BAAAA,sBAAsB,KACtE,KAAA,GACA,CAAC,GAAG,S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zD,MAAM,WAAW,MAAM,gBAAgB,WAAW,MAAM,KAAK;CAC7D,IAAI,aAAa,KAAA,GAAW,OAAO;EAAE,QAAQ;EAAU,OAAO;CAAS;CACvE,OAAOQ,cAAAA,kBAAkB,KAAK,YAA8C;EAC1E,IAAI;GACF,MAAMC,cAAAA,kBAAkB,YAAY,KAAK,WAAW,OAAO,cAAc;IACvE,MAAM,gBAAgB,MAAM,oBAAoB,SAAS,WAAW,MAAM;IAC1E,MAAM,SAAS;IACf,MAAM,WAAW,MAAM,mBAAmB,SAAS,MAAM,MAAM;IAC/D,MAAMH,iBAAAA,QAAG,UAAUN,UAAAA,QAAK,KAAK,WAAW,mBAAmB,MAAM,GAAG,QAAQ;IAC5E,OAAO,qBAAqB,OAAO,OAAO,WAAW,QAAQ,CAAC,EAAE,OAAO;IACvE,OAAO;KACL;KACA;KACA,SAAS;KACT,SAAS,QAAQ,KAAK,EAAE,UAAU,YAAY,cAAc;MAAE;MAAU;MAAY;KAAO,EAAE;IAC/F;GACF,CAAC;GACD,MAAM,QAAQ,MAAM,gBAAgB,WAAW,MAAM,KAAK;GAC1D,IAAI,UAAU,KAAA,GAAW,MAAM,IAAI,MAAM,qBAAqB,IAAI,oBAAoB;GACtF,OAAO;IAAE,QAAQ;IAAS;GAAM;EAClC,SAAS,OAAO;GACd,OAAO;IAAE,QAAQ;IAAU,QAAQ,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK;GAAE;EAC5F;CACF,CAAC;AACH;;AAGA,MAAa,uBACXU,cAAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":[],"sources":["../../../../src/builders/native/index.ts"],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../../../../src/builders/native/index.ts"],"mappings":";;;;iBA+BiB,gCAAgC;EAC/C;IAAW;IAAkB;IAAoB;;;iBAGlC;;EAEf;EACA,QAAQ;;EAER;EACA,YAAY;;YAGF;EACN;EAA4B,OAAO;;EACnC;EAAmB;;EACnB;EAAkB;;;;;;;;wBAqSF,wBAAwB,OAAO,yBAAyB,QAAQ"}
|