@dxos/cli 0.8.4-main.c1de068 → 0.8.4-main.dedc0f3
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/src/commands/agent/agent.node.test.js +6 -6
- package/dist/src/commands/agent/agent.node.test.js.map +1 -1
- package/dist/src/commands/agent/invitations.js +12 -13
- package/dist/src/commands/agent/invitations.js.map +1 -1
- package/dist/src/commands/agent/list.js +16 -17
- package/dist/src/commands/agent/list.js.map +1 -1
- package/dist/src/commands/agent/restart.js +11 -12
- package/dist/src/commands/agent/restart.js.map +1 -1
- package/dist/src/commands/agent/start.d.ts.map +1 -1
- package/dist/src/commands/agent/start.js +48 -53
- package/dist/src/commands/agent/start.js.map +1 -1
- package/dist/src/commands/agent/status.js +6 -7
- package/dist/src/commands/agent/status.js.map +1 -1
- package/dist/src/commands/agent/stop.js +12 -13
- package/dist/src/commands/agent/stop.js.map +1 -1
- package/dist/src/commands/config/index.js +5 -7
- package/dist/src/commands/config/index.js.map +1 -1
- package/dist/src/commands/config/index.node.test.js +1 -1
- package/dist/src/commands/config/index.node.test.js.map +1 -1
- package/dist/src/commands/debug/diagnostics.js +22 -23
- package/dist/src/commands/debug/diagnostics.js.map +1 -1
- package/dist/src/commands/debug/error.js +2 -3
- package/dist/src/commands/debug/error.js.map +1 -1
- package/dist/src/commands/debug/generate.js +29 -31
- package/dist/src/commands/debug/generate.js.map +1 -1
- package/dist/src/commands/debug/metrics.js +11 -13
- package/dist/src/commands/debug/metrics.js.map +1 -1
- package/dist/src/commands/debug/status.js +10 -11
- package/dist/src/commands/debug/status.js.map +1 -1
- package/dist/src/commands/device/info.js +5 -7
- package/dist/src/commands/device/info.js.map +1 -1
- package/dist/src/commands/device/list.js +8 -9
- package/dist/src/commands/device/list.js.map +1 -1
- package/dist/src/commands/device/update.js +8 -10
- package/dist/src/commands/device/update.js.map +1 -1
- package/dist/src/commands/{function/upload.d.ts → edge/status.d.ts} +2 -17
- package/dist/src/commands/edge/status.d.ts.map +1 -0
- package/dist/src/commands/edge/status.js +24 -0
- package/dist/src/commands/edge/status.js.map +1 -0
- package/dist/src/commands/function/list.js +3 -4
- package/dist/src/commands/function/list.js.map +1 -1
- package/dist/src/commands/function/logs.js +9 -11
- package/dist/src/commands/function/logs.js.map +1 -1
- package/dist/src/commands/function/trigger/list.d.ts.map +1 -1
- package/dist/src/commands/function/trigger/list.js +10 -11
- package/dist/src/commands/function/trigger/list.js.map +1 -1
- package/dist/src/commands/function/watch.d.ts.map +1 -1
- package/dist/src/commands/function/watch.js +20 -22
- package/dist/src/commands/function/watch.js.map +1 -1
- package/dist/src/commands/halo/create.js +12 -13
- package/dist/src/commands/halo/create.js.map +1 -1
- package/dist/src/commands/halo/credential/add.js +5 -6
- package/dist/src/commands/halo/credential/add.js.map +1 -1
- package/dist/src/commands/halo/credential/list.js +23 -24
- package/dist/src/commands/halo/credential/list.js.map +1 -1
- package/dist/src/commands/halo/identity.js +5 -6
- package/dist/src/commands/halo/identity.js.map +1 -1
- package/dist/src/commands/halo/join.js +22 -24
- package/dist/src/commands/halo/join.js.map +1 -1
- package/dist/src/commands/halo/keys.js +3 -4
- package/dist/src/commands/halo/keys.js.map +1 -1
- package/dist/src/commands/halo/recovery/generate.js +3 -4
- package/dist/src/commands/halo/recovery/generate.js.map +1 -1
- package/dist/src/commands/halo/recovery/use.js +7 -8
- package/dist/src/commands/halo/recovery/use.js.map +1 -1
- package/dist/src/commands/halo/share.d.ts.map +1 -1
- package/dist/src/commands/halo/share.js +27 -28
- package/dist/src/commands/halo/share.js.map +1 -1
- package/dist/src/commands/halo/update.js +9 -11
- package/dist/src/commands/halo/update.js.map +1 -1
- package/dist/src/commands/info.js +6 -7
- package/dist/src/commands/info.js.map +1 -1
- package/dist/src/commands/profile/import.d.ts.map +1 -1
- package/dist/src/commands/profile/import.js +15 -16
- package/dist/src/commands/profile/import.js.map +1 -1
- package/dist/src/commands/profile/inspect.d.ts.map +1 -1
- package/dist/src/commands/profile/inspect.js +14 -15
- package/dist/src/commands/profile/inspect.js.map +1 -1
- package/dist/src/commands/reset/index.d.ts.map +1 -1
- package/dist/src/commands/reset/index.js +15 -17
- package/dist/src/commands/reset/index.js.map +1 -1
- package/dist/src/commands/shell/index.js +2 -3
- package/dist/src/commands/shell/index.js.map +1 -1
- package/dist/src/commands/space/close.js +3 -4
- package/dist/src/commands/space/close.js.map +1 -1
- package/dist/src/commands/space/create.js +5 -6
- package/dist/src/commands/space/create.js.map +1 -1
- package/dist/src/commands/space/epoch.js +4 -5
- package/dist/src/commands/space/epoch.js.map +1 -1
- package/dist/src/commands/space/info.js +4 -5
- package/dist/src/commands/space/info.js.map +1 -1
- package/dist/src/commands/space/join.js +14 -16
- package/dist/src/commands/space/join.js.map +1 -1
- package/dist/src/commands/space/list.js +20 -21
- package/dist/src/commands/space/list.js.map +1 -1
- package/dist/src/commands/space/members.js +9 -10
- package/dist/src/commands/space/members.js.map +1 -1
- package/dist/src/commands/space/open.js +3 -4
- package/dist/src/commands/space/open.js.map +1 -1
- package/dist/src/commands/space/query.js +12 -14
- package/dist/src/commands/space/query.js.map +1 -1
- package/dist/src/commands/space/schema/list.js +12 -15
- package/dist/src/commands/space/schema/list.js.map +1 -1
- package/dist/src/commands/space/share.d.ts.map +1 -1
- package/dist/src/commands/space/share.js +31 -32
- package/dist/src/commands/space/share.js.map +1 -1
- package/dist/src/commands/tunnel/index.js +19 -22
- package/dist/src/commands/tunnel/index.js.map +1 -1
- package/dist/src/commands/tunnel/list.js +10 -13
- package/dist/src/commands/tunnel/list.js.map +1 -1
- package/dist/src/components/SpaceTable.d.ts.map +1 -1
- package/dist/src/components/SpaceTable.js.map +1 -1
- package/dist/src/components/SystemTable.d.ts.map +1 -1
- package/dist/src/components/SystemTable.js +2 -2
- package/dist/src/components/SystemTable.js.map +1 -1
- package/dist/src/help.js +1 -1
- package/dist/src/help.js.map +1 -1
- package/dist/src/util/function/index.d.ts +0 -1
- package/dist/src/util/function/index.d.ts.map +1 -1
- package/dist/src/util/function/index.js +0 -1
- package/dist/src/util/function/index.js.map +1 -1
- package/dist/src/util/function/lookup.d.ts +2 -1
- package/dist/src/util/function/lookup.d.ts.map +1 -1
- package/dist/src/util/function/lookup.js +2 -3
- package/dist/src/util/function/lookup.js.map +1 -1
- package/dist/src/util/provider/digital-ocean.js +3 -3
- package/dist/src/util/provider/digital-ocean.js.map +1 -1
- package/dist/src/util/provider/provider.d.ts.map +1 -1
- package/dist/src/util/provider/provider.js.map +1 -1
- package/dist/src/util/publish/build.d.ts +1 -1
- package/dist/src/util/publish/build.d.ts.map +1 -1
- package/dist/src/util/publish/build.js +2 -3
- package/dist/src/util/publish/build.js.map +1 -1
- package/dist/src/util/publish/common.d.ts.map +1 -1
- package/dist/src/util/publish/common.js.map +1 -1
- package/dist/src/util/publish/config.d.ts.map +1 -1
- package/dist/src/util/publish/config.js +2 -3
- package/dist/src/util/publish/config.js.map +1 -1
- package/dist/src/util/publish/ipfs-upload.d.ts.map +1 -1
- package/dist/src/util/publish/ipfs-upload.js.map +1 -1
- package/dist/src/util/publish/publish.d.ts.map +1 -1
- package/dist/src/util/publish/publish.js +4 -5
- package/dist/src/util/publish/publish.js.map +1 -1
- package/dist/src/util/publish/publisher-rpc-peer.d.ts.map +1 -1
- package/dist/src/util/publish/publisher-rpc-peer.js +10 -8
- package/dist/src/util/publish/publisher-rpc-peer.js.map +1 -1
- package/dist/src/util/supervisor/supervisor-rpc-peer.d.ts.map +1 -1
- package/dist/src/util/supervisor/supervisor-rpc-peer.js +10 -8
- package/dist/src/util/supervisor/supervisor-rpc-peer.js.map +1 -1
- package/dist/src/util/tunnel/common.d.ts.map +1 -1
- package/dist/src/util/tunnel/common.js.map +1 -1
- package/dist/src/util/tunnel/tunnel-rpc-peer.d.ts.map +1 -1
- package/dist/src/util/tunnel/tunnel-rpc-peer.js +10 -8
- package/dist/src/util/tunnel/tunnel-rpc-peer.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/oclif.manifest.json +126 -171
- package/package.json +28 -27
- package/dist/src/commands/function/upload.d.ts.map +0 -1
- package/dist/src/commands/function/upload.js +0 -153
- package/dist/src/commands/function/upload.js.map +0 -1
- package/dist/src/util/function/bundle.d.ts +0 -5
- package/dist/src/util/function/bundle.d.ts.map +0 -1
- package/dist/src/util/function/bundle.js +0 -13
- package/dist/src/util/function/bundle.js.map +0 -1
|
@@ -1,153 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2024 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
import { Args, Flags } from '@oclif/core';
|
|
5
|
-
import fs from 'node:fs';
|
|
6
|
-
import { basename } from 'node:path';
|
|
7
|
-
import path from 'path';
|
|
8
|
-
import { asyncTimeout } from '@dxos/async';
|
|
9
|
-
import { Obj, Ref } from '@dxos/echo';
|
|
10
|
-
import { FunctionType, ScriptType, makeFunctionUrl, setUserFunctionUrlInMetadata } from '@dxos/functions';
|
|
11
|
-
import { incrementSemverPatch, uploadWorkerFunction } from '@dxos/functions/edge';
|
|
12
|
-
import { invariant } from '@dxos/invariant';
|
|
13
|
-
import { DataType } from '@dxos/schema';
|
|
14
|
-
import { BaseCommand } from '../../base';
|
|
15
|
-
import { bundleScript, findFunctionByDeploymentId } from '../../util';
|
|
16
|
-
// TODO: move to cli-composer
|
|
17
|
-
class Upload extends BaseCommand {
|
|
18
|
-
async run() {
|
|
19
|
-
const { scriptFileContent, bundledScript } = await this._loadScript();
|
|
20
|
-
if (this.flags.noSpace) {
|
|
21
|
-
return this.execWithClient(async ({ client }) => {
|
|
22
|
-
const identity = client.halo.identity.get();
|
|
23
|
-
invariant(identity, 'Identity not available');
|
|
24
|
-
const uploadResult = await this._upload(client, identity.identityKey, undefined, bundledScript);
|
|
25
|
-
this.log(`Upload complete: ${uploadResult.functionId}, version ${uploadResult.version}`);
|
|
26
|
-
});
|
|
27
|
-
}
|
|
28
|
-
return this.execWithSpace(async ({ client, space }) => {
|
|
29
|
-
client.addTypes([FunctionType]);
|
|
30
|
-
const identity = client.halo.identity.get();
|
|
31
|
-
invariant(identity, 'Identity not available');
|
|
32
|
-
const existingFunctionObject = await this._loadFunctionObject(space);
|
|
33
|
-
const uploadResult = await this._upload(client, identity.identityKey, existingFunctionObject, bundledScript);
|
|
34
|
-
const functionObject = this._updateFunctionObject(space, existingFunctionObject, uploadResult);
|
|
35
|
-
if (this.flags.composerScript) {
|
|
36
|
-
await this._updateComposerScript(client, space, functionObject, basename(this.args.file), scriptFileContent);
|
|
37
|
-
}
|
|
38
|
-
return uploadResult;
|
|
39
|
-
}, { spaceKeys: this.flags.spaceKey ? [this.flags.spaceKey] : undefined });
|
|
40
|
-
}
|
|
41
|
-
async _loadScript() {
|
|
42
|
-
var _a, _b;
|
|
43
|
-
let scriptFileContent;
|
|
44
|
-
try {
|
|
45
|
-
scriptFileContent = fs.readFileSync(this.args.file, 'utf8');
|
|
46
|
-
}
|
|
47
|
-
catch (err) {
|
|
48
|
-
this.error(`Error reading file ${this.args.file}: ${err.message}`);
|
|
49
|
-
}
|
|
50
|
-
const bundleResult = await bundleScript(scriptFileContent);
|
|
51
|
-
if (bundleResult.error || !bundleResult.bundle) {
|
|
52
|
-
this.error(`Error bundling script ${this.args.file}: ${(_b = (_a = bundleResult.error) === null || _a === void 0 ? void 0 : _a.message) !== null && _b !== void 0 ? _b : 'empty output'}`);
|
|
53
|
-
}
|
|
54
|
-
return { scriptFileContent, bundledScript: bundleResult.bundle };
|
|
55
|
-
}
|
|
56
|
-
async _loadFunctionObject(space) {
|
|
57
|
-
const matchingFunction = await findFunctionByDeploymentId(space, this.flags.functionId);
|
|
58
|
-
if (this.flags.functionId && !matchingFunction) {
|
|
59
|
-
this.warn(`Function ECHO object not found for ${this.flags.functionId}`);
|
|
60
|
-
}
|
|
61
|
-
if (this.flags.verbose && matchingFunction) {
|
|
62
|
-
this.log(`Function ECHO object found, ID: ${matchingFunction.id}`);
|
|
63
|
-
}
|
|
64
|
-
return matchingFunction;
|
|
65
|
-
}
|
|
66
|
-
async _upload(client, ownerPublicKey, functionObject, bundledSource) {
|
|
67
|
-
try {
|
|
68
|
-
const result = await asyncTimeout(uploadWorkerFunction({
|
|
69
|
-
client,
|
|
70
|
-
ownerPublicKey,
|
|
71
|
-
version: await this._getNextVersion(functionObject),
|
|
72
|
-
functionId: this.flags.functionId,
|
|
73
|
-
name: this.flags.name,
|
|
74
|
-
source: bundledSource,
|
|
75
|
-
}), 10000);
|
|
76
|
-
invariant(result.functionId, 'Upload failed.');
|
|
77
|
-
this.log(`Uploaded function ${result.functionId}, version ${result.version}`);
|
|
78
|
-
return result;
|
|
79
|
-
}
|
|
80
|
-
catch (err) {
|
|
81
|
-
this.error(err.message);
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
_updateFunctionObject(space, existingObject, uploadResult) {
|
|
85
|
-
var _a;
|
|
86
|
-
let functionObject = existingObject;
|
|
87
|
-
if (!functionObject) {
|
|
88
|
-
const name = path.basename(this.args.file, path.extname(this.args.file));
|
|
89
|
-
functionObject = space.db.add(Obj.make(FunctionType, { name, version: uploadResult.version }));
|
|
90
|
-
}
|
|
91
|
-
functionObject.name = (_a = this.flags.name) !== null && _a !== void 0 ? _a : functionObject.name;
|
|
92
|
-
functionObject.version = uploadResult.version;
|
|
93
|
-
setUserFunctionUrlInMetadata(Obj.getMeta(functionObject), makeFunctionUrl(uploadResult));
|
|
94
|
-
return functionObject;
|
|
95
|
-
}
|
|
96
|
-
async _updateComposerScript(client, space, functionObject, scriptFileName, scriptFileContent) {
|
|
97
|
-
var _a;
|
|
98
|
-
client.addTypes([ScriptType, DataType.Text]);
|
|
99
|
-
if (functionObject.source) {
|
|
100
|
-
const script = await functionObject.source.load();
|
|
101
|
-
const source = await script.source.load();
|
|
102
|
-
source.content = scriptFileContent;
|
|
103
|
-
if (this.flags.verbose) {
|
|
104
|
-
this.log(`Updated source of ${script.id}`);
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
else {
|
|
108
|
-
const sourceObj = space.db.add(Obj.make(DataType.Text, { content: scriptFileContent }));
|
|
109
|
-
const obj = space.db.add(Obj.make(ScriptType, { name: (_a = this.flags.name) !== null && _a !== void 0 ? _a : scriptFileName, source: Ref.make(sourceObj) }));
|
|
110
|
-
functionObject.source = Ref.make(obj);
|
|
111
|
-
await makeObjectNavigableInComposer(client, space, obj);
|
|
112
|
-
if (this.flags.verbose) {
|
|
113
|
-
this.log(`Created object, ID: ${obj.id}`);
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
async _getNextVersion(functionObject) {
|
|
118
|
-
var _a;
|
|
119
|
-
if (this.flags.version) {
|
|
120
|
-
return this.flags.version;
|
|
121
|
-
}
|
|
122
|
-
if (functionObject) {
|
|
123
|
-
return incrementSemverPatch((_a = functionObject === null || functionObject === void 0 ? void 0 : functionObject.version) !== null && _a !== void 0 ? _a : '0.0.0');
|
|
124
|
-
}
|
|
125
|
-
return '0.0.1';
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
Upload.enableJsonFlag = true;
|
|
129
|
-
Upload.description = 'Upload user function.';
|
|
130
|
-
Upload.flags = {
|
|
131
|
-
...BaseCommand.flags,
|
|
132
|
-
name: Flags.string({ description: 'Function name.' }),
|
|
133
|
-
version: Flags.string({ description: 'Function version.' }),
|
|
134
|
-
composerScript: Flags.boolean({ description: 'Loads the script into composer.' }),
|
|
135
|
-
functionId: Flags.string({ description: 'Existing UserFunction ID to update.' }),
|
|
136
|
-
spaceKey: Flags.string({ description: 'Space key to create/update Script source in.' }),
|
|
137
|
-
noSpace: Flags.boolean({ description: 'Only uploads a function, without creating a FunctionObject in ECHO.' }),
|
|
138
|
-
};
|
|
139
|
-
Upload.args = {
|
|
140
|
-
file: Args.string({ required: true }),
|
|
141
|
-
};
|
|
142
|
-
export default Upload;
|
|
143
|
-
const makeObjectNavigableInComposer = async (client, space, obj) => {
|
|
144
|
-
const collection = space.properties['dxos.org/type/Collection'];
|
|
145
|
-
if (collection) {
|
|
146
|
-
client.addTypes([DataType.Collection]);
|
|
147
|
-
const composerCollection = await collection.load();
|
|
148
|
-
if (composerCollection) {
|
|
149
|
-
composerCollection.objects.push(Ref.make(obj));
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
};
|
|
153
|
-
//# sourceMappingURL=upload.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"upload.js","sourceRoot":"","sources":["../../../../src/commands/function/upload.ts"],"names":[],"mappings":"AAAA,EAAE;AACF,0BAA0B;AAC1B,EAAE;AAEF,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AACrC,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAI3C,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,eAAe,EAAE,4BAA4B,EAAE,MAAM,iBAAiB,CAAC;AAC1G,OAAO,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAClF,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAExC,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,0BAA0B,EAAE,MAAM,YAAY,CAAC;AAEtE,6BAA6B;AAE7B,MAAqB,MAAO,SAAQ,WAA0B;IAkB5D,KAAK,CAAC,GAAG;QACP,MAAM,EAAE,iBAAiB,EAAE,aAAa,EAAE,GAAG,MAAM,IAAI,CAAC,WAAW,EAAE,CAAC;QAEtE,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC;YAC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AAE,KAAK,CAAC,MAAM,CAAC,EAAE,WAAW,EAAE,qCAAqC,EAAE,CAAC;IAChF,QAAQ,EAAE,KAAK,CAAC,MAAM,CAAC,EAAE,WAAW,EAAE,8CAA8C,EAAE,CAAC;IACvF,OAAO,EAAE,KAAK,CAAC,OAAO,CAAC,EAAE,WAAW,EAAE,qEAAqE,EAAE,CAAC;CAC/G,CAAC;AAEc,WAAI,GAAG;IACrB,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;CACtC,CAAC;eAhBiB,MAAM;AAwK3B,MAAM,6BAA6B,GAAG,KAAK,EAAE,MAAc,EAAE,KAAY,EAAE,GAAuB,EAAE,EAAE;IACpG,MAAM,UAAU,GAAG,KAAK,CAAC,UAAU,CAAC,0BAA0B,CAAC,CAAC;IAChE,IAAI,UAAU,EAAE,CAAC;QACf,MAAM,CAAC,QAAQ,CAAC,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC,CAAC;QACvC,MAAM,kBAAkB,GAAG,MAAM,UAAU,CAAC,IAAI,EAAE,CAAC;QACnD,IAAI,kBAAkB,EAAE,CAAC;YACvB,kBAAkB,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;QACjD,CAAC;IACH,CAAC;AACH,CAAC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"bundle.d.ts","sourceRoot":"","sources":["../../../../src/util/function/bundle.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,YAAY,GAAU,QAAQ,MAAM,KAAG,OAAO,CAAC;IAAE,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,KAAK,CAAA;CAAE,CAS7F,CAAC"}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
import { Bundler } from '@dxos/functions/bundler';
|
|
5
|
-
export const bundleScript = async (source) => {
|
|
6
|
-
const bundler = new Bundler({ platform: 'node', sandboxedModules: [], remoteModules: {} });
|
|
7
|
-
const buildResult = await bundler.bundle({ source });
|
|
8
|
-
if (buildResult.error || !buildResult.bundle) {
|
|
9
|
-
return { error: buildResult.error || new Error('Bundle creation failed') };
|
|
10
|
-
}
|
|
11
|
-
return { bundle: buildResult.bundle };
|
|
12
|
-
};
|
|
13
|
-
//# sourceMappingURL=bundle.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"bundle.js","sourceRoot":"","sources":["../../../../src/util/function/bundle.ts"],"names":[],"mappings":"AAAA,EAAE;AACF,0BAA0B;AAC1B,EAAE;AACF,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAElD,MAAM,CAAC,MAAM,YAAY,GAAG,KAAK,EAAE,MAAc,EAA+C,EAAE;IAChG,MAAM,OAAO,GAAG,IAAI,OAAO,CAAC,EAAE,QAAQ,EAAE,MAAM,EAAE,gBAAgB,EAAE,EAAE,EAAE,aAAa,EAAE,EAAE,EAAE,CAAC,CAAC;IAC3F,MAAM,WAAW,GAAG,MAAM,OAAO,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC;IAErD,IAAI,WAAW,CAAC,KAAK,IAAI,CAAC,WAAW,CAAC,MAAM,EAAE,CAAC;QAC7C,OAAO,EAAE,KAAK,EAAE,WAAW,CAAC,KAAK,IAAI,IAAI,KAAK,CAAC,wBAAwB,CAAC,EAAE,CAAC;IAC7E,CAAC;IAED,OAAO,EAAE,MAAM,EAAE,WAAW,CAAC,MAAM,EAAE,CAAC;AACxC,CAAC,CAAC"}
|