@openfairygui/backend 0.2.0-alpha.0 → 0.2.0-alpha.2
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/LICENSE +21 -0
- package/README.md +24 -1
- package/dist/index.cjs +5 -1119
- package/dist/index.d.cts +2 -364
- package/dist/index.d.mts +2 -364
- package/dist/index.mjs +2 -1091
- package/dist/node.cjs +107 -0
- package/dist/node.d.cts +8 -0
- package/dist/node.d.mts +8 -0
- package/dist/node.mjs +78 -0
- package/dist/runtime-BL9Pkfc7.cjs +1217 -0
- package/dist/runtime-BPWzx-Tv.mjs +1193 -0
- package/dist/runtime-OO1sHuCl.d.mts +424 -0
- package/dist/runtime-qcSlD_9-.d.cts +424 -0
- package/package.json +65 -53
- package/src/index.ts +6 -1
- package/src/node.ts +96 -0
- package/src/runtime.ts +155 -80
- package/src/services/artifact-service.ts +11 -1
- package/src/services/authoring-service.ts +151 -37
- package/src/services/context.ts +14 -3
- package/src/services/event-service.ts +1 -1
- package/src/services/runtime-service.ts +155 -24
package/dist/node.cjs
ADDED
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
//#region \0rolldown/runtime.js
|
|
3
|
+
var __create = Object.create;
|
|
4
|
+
var __defProp = Object.defineProperty;
|
|
5
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
8
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
11
|
+
key = keys[i];
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
13
|
+
get: ((k) => from[k]).bind(null, key),
|
|
14
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
20
|
+
value: mod,
|
|
21
|
+
enumerable: true
|
|
22
|
+
}) : target, mod));
|
|
23
|
+
//#endregion
|
|
24
|
+
const require_runtime = require("./runtime-BL9Pkfc7.cjs");
|
|
25
|
+
let node_fs_promises = require("node:fs/promises");
|
|
26
|
+
node_fs_promises = __toESM(node_fs_promises);
|
|
27
|
+
let node_path = require("node:path");
|
|
28
|
+
node_path = __toESM(node_path);
|
|
29
|
+
//#region src/node.ts
|
|
30
|
+
function createNodeBackendFileSystem() {
|
|
31
|
+
return {
|
|
32
|
+
stat(filePath) {
|
|
33
|
+
return node_fs_promises.default.stat(filePath);
|
|
34
|
+
},
|
|
35
|
+
readdir(dirPath) {
|
|
36
|
+
return node_fs_promises.default.readdir(dirPath);
|
|
37
|
+
},
|
|
38
|
+
readFile(filePath) {
|
|
39
|
+
return node_fs_promises.default.readFile(filePath, "utf-8");
|
|
40
|
+
},
|
|
41
|
+
async readFileRaw(filePath) {
|
|
42
|
+
const buffer = await node_fs_promises.default.readFile(filePath);
|
|
43
|
+
return new Uint8Array(buffer.buffer, buffer.byteOffset, buffer.byteLength);
|
|
44
|
+
},
|
|
45
|
+
writeFile(filePath, content) {
|
|
46
|
+
return node_fs_promises.default.writeFile(filePath, content, "utf-8");
|
|
47
|
+
},
|
|
48
|
+
writeFileRaw(filePath, data) {
|
|
49
|
+
return node_fs_promises.default.writeFile(filePath, data);
|
|
50
|
+
},
|
|
51
|
+
async mkdir(dirPath, options) {
|
|
52
|
+
await node_fs_promises.default.mkdir(dirPath, { recursive: options?.recursive ?? false });
|
|
53
|
+
},
|
|
54
|
+
async resolvePath(filePath) {
|
|
55
|
+
try {
|
|
56
|
+
return await node_fs_promises.default.realpath(filePath);
|
|
57
|
+
} catch {
|
|
58
|
+
return node_path.default.resolve(filePath);
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
async openExclusive(filePath) {
|
|
62
|
+
const handle = await node_fs_promises.default.open(filePath, "wx");
|
|
63
|
+
return {
|
|
64
|
+
writeFile(content) {
|
|
65
|
+
return handle.writeFile(content, "utf-8");
|
|
66
|
+
},
|
|
67
|
+
close() {
|
|
68
|
+
return handle.close();
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
},
|
|
72
|
+
unlink(filePath) {
|
|
73
|
+
return node_fs_promises.default.unlink(filePath);
|
|
74
|
+
},
|
|
75
|
+
join(...paths) {
|
|
76
|
+
return node_path.default.join(...paths);
|
|
77
|
+
},
|
|
78
|
+
dirname(filePath) {
|
|
79
|
+
return node_path.default.dirname(filePath);
|
|
80
|
+
},
|
|
81
|
+
resolve(...paths) {
|
|
82
|
+
return node_path.default.resolve(...paths);
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
function createNodeBackendHostAdapter() {
|
|
87
|
+
return { lockMetadata(input) {
|
|
88
|
+
return {
|
|
89
|
+
pid: process.pid,
|
|
90
|
+
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
91
|
+
canonicalPathKey: input.canonicalPathKey
|
|
92
|
+
};
|
|
93
|
+
} };
|
|
94
|
+
}
|
|
95
|
+
function createNodeBackendRuntime(options = {}) {
|
|
96
|
+
return new require_runtime.BackendRuntime({
|
|
97
|
+
...options,
|
|
98
|
+
fileSystem: options.fileSystem ?? createNodeBackendFileSystem(),
|
|
99
|
+
host: options.host ?? createNodeBackendHostAdapter()
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
//#endregion
|
|
103
|
+
exports.BackendRuntime = require_runtime.BackendRuntime;
|
|
104
|
+
exports.__toESM = __toESM;
|
|
105
|
+
exports.createNodeBackendFileSystem = createNodeBackendFileSystem;
|
|
106
|
+
exports.createNodeBackendHostAdapter = createNodeBackendHostAdapter;
|
|
107
|
+
exports.createNodeBackendRuntime = createNodeBackendRuntime;
|
package/dist/node.d.cts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { D as BackendRuntime, O as BackendRuntimeOptions, g as BackendHostAdapter, h as BackendFileSystem, m as BackendFileStat, p as BackendFileHandle } from "./runtime-qcSlD_9-.cjs";
|
|
2
|
+
|
|
3
|
+
//#region src/node.d.ts
|
|
4
|
+
declare function createNodeBackendFileSystem(): BackendFileSystem;
|
|
5
|
+
declare function createNodeBackendHostAdapter(): BackendHostAdapter;
|
|
6
|
+
declare function createNodeBackendRuntime(options?: BackendRuntimeOptions): BackendRuntime;
|
|
7
|
+
//#endregion
|
|
8
|
+
export { type BackendFileHandle, type BackendFileStat, type BackendFileSystem, type BackendHostAdapter, BackendRuntime, type BackendRuntimeOptions, createNodeBackendFileSystem, createNodeBackendHostAdapter, createNodeBackendRuntime };
|
package/dist/node.d.mts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { D as BackendRuntime, O as BackendRuntimeOptions, g as BackendHostAdapter, h as BackendFileSystem, m as BackendFileStat, p as BackendFileHandle } from "./runtime-OO1sHuCl.mjs";
|
|
2
|
+
|
|
3
|
+
//#region src/node.d.ts
|
|
4
|
+
declare function createNodeBackendFileSystem(): BackendFileSystem;
|
|
5
|
+
declare function createNodeBackendHostAdapter(): BackendHostAdapter;
|
|
6
|
+
declare function createNodeBackendRuntime(options?: BackendRuntimeOptions): BackendRuntime;
|
|
7
|
+
//#endregion
|
|
8
|
+
export { type BackendFileHandle, type BackendFileStat, type BackendFileSystem, type BackendHostAdapter, BackendRuntime, type BackendRuntimeOptions, createNodeBackendFileSystem, createNodeBackendHostAdapter, createNodeBackendRuntime };
|
package/dist/node.mjs
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { t as BackendRuntime } from "./runtime-BPWzx-Tv.mjs";
|
|
2
|
+
import fs from "node:fs/promises";
|
|
3
|
+
import path from "node:path";
|
|
4
|
+
//#region src/node.ts
|
|
5
|
+
function createNodeBackendFileSystem() {
|
|
6
|
+
return {
|
|
7
|
+
stat(filePath) {
|
|
8
|
+
return fs.stat(filePath);
|
|
9
|
+
},
|
|
10
|
+
readdir(dirPath) {
|
|
11
|
+
return fs.readdir(dirPath);
|
|
12
|
+
},
|
|
13
|
+
readFile(filePath) {
|
|
14
|
+
return fs.readFile(filePath, "utf-8");
|
|
15
|
+
},
|
|
16
|
+
async readFileRaw(filePath) {
|
|
17
|
+
const buffer = await fs.readFile(filePath);
|
|
18
|
+
return new Uint8Array(buffer.buffer, buffer.byteOffset, buffer.byteLength);
|
|
19
|
+
},
|
|
20
|
+
writeFile(filePath, content) {
|
|
21
|
+
return fs.writeFile(filePath, content, "utf-8");
|
|
22
|
+
},
|
|
23
|
+
writeFileRaw(filePath, data) {
|
|
24
|
+
return fs.writeFile(filePath, data);
|
|
25
|
+
},
|
|
26
|
+
async mkdir(dirPath, options) {
|
|
27
|
+
await fs.mkdir(dirPath, { recursive: options?.recursive ?? false });
|
|
28
|
+
},
|
|
29
|
+
async resolvePath(filePath) {
|
|
30
|
+
try {
|
|
31
|
+
return await fs.realpath(filePath);
|
|
32
|
+
} catch {
|
|
33
|
+
return path.resolve(filePath);
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
async openExclusive(filePath) {
|
|
37
|
+
const handle = await fs.open(filePath, "wx");
|
|
38
|
+
return {
|
|
39
|
+
writeFile(content) {
|
|
40
|
+
return handle.writeFile(content, "utf-8");
|
|
41
|
+
},
|
|
42
|
+
close() {
|
|
43
|
+
return handle.close();
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
},
|
|
47
|
+
unlink(filePath) {
|
|
48
|
+
return fs.unlink(filePath);
|
|
49
|
+
},
|
|
50
|
+
join(...paths) {
|
|
51
|
+
return path.join(...paths);
|
|
52
|
+
},
|
|
53
|
+
dirname(filePath) {
|
|
54
|
+
return path.dirname(filePath);
|
|
55
|
+
},
|
|
56
|
+
resolve(...paths) {
|
|
57
|
+
return path.resolve(...paths);
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
function createNodeBackendHostAdapter() {
|
|
62
|
+
return { lockMetadata(input) {
|
|
63
|
+
return {
|
|
64
|
+
pid: process.pid,
|
|
65
|
+
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
66
|
+
canonicalPathKey: input.canonicalPathKey
|
|
67
|
+
};
|
|
68
|
+
} };
|
|
69
|
+
}
|
|
70
|
+
function createNodeBackendRuntime(options = {}) {
|
|
71
|
+
return new BackendRuntime({
|
|
72
|
+
...options,
|
|
73
|
+
fileSystem: options.fileSystem ?? createNodeBackendFileSystem(),
|
|
74
|
+
host: options.host ?? createNodeBackendHostAdapter()
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
//#endregion
|
|
78
|
+
export { BackendRuntime, createNodeBackendFileSystem, createNodeBackendHostAdapter, createNodeBackendRuntime };
|