@truenine/memory-sync-cli 2026.10330.118 → 2026.10402.103
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/index.d.mts +3486 -357
- package/dist/index.mjs +287 -122
- package/dist/plugin-runtime.mjs +262 -149
- package/dist/script-runtime-worker.mjs +1 -92
- package/package.json +28 -39
- package/dist/babel.cjs +0 -246
- package/dist/chunk-tuRmWmEN.mjs +0 -1
- package/dist/jiti-DatT9wtj.mjs +0 -4505
|
@@ -1,92 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import * as fs from "node:fs";
|
|
3
|
-
import { readFileSync } from "node:fs";
|
|
4
|
-
import process from "node:process";
|
|
5
|
-
import * as path from "node:path";
|
|
6
|
-
|
|
7
|
-
//#region ../libraries/script-runtime/dist/runtime-core-DyUHtoc2.mjs
|
|
8
|
-
function isRecord(value) {
|
|
9
|
-
return typeof value === "object" && value !== null;
|
|
10
|
-
}
|
|
11
|
-
function isPlainObject(value) {
|
|
12
|
-
if (!isRecord(value)) return false;
|
|
13
|
-
const prototype = Object.getPrototypeOf(value);
|
|
14
|
-
return prototype === Object.prototype || prototype === null;
|
|
15
|
-
}
|
|
16
|
-
async function createRuntime() {
|
|
17
|
-
const { createJiti } = await import("./jiti-DatT9wtj.mjs");
|
|
18
|
-
return createJiti(import.meta.url, {
|
|
19
|
-
fsCache: false,
|
|
20
|
-
moduleCache: false,
|
|
21
|
-
interopDefault: false
|
|
22
|
-
});
|
|
23
|
-
}
|
|
24
|
-
function toProxyModule(rawModule) {
|
|
25
|
-
if (!isRecord(rawModule)) throw new Error("proxy.ts must export a module namespace object");
|
|
26
|
-
const defaultExport = rawModule["default"];
|
|
27
|
-
if (defaultExport == null) throw new Error("proxy.ts must export a default value");
|
|
28
|
-
if (typeof defaultExport !== "function" && !isPlainObject(defaultExport)) throw new TypeError("proxy.ts default export must be a function or plain object");
|
|
29
|
-
const configExport = rawModule["config"];
|
|
30
|
-
if (configExport != null && !isPlainObject(configExport)) throw new Error("proxy.ts config export must be a plain object");
|
|
31
|
-
const proxyModule = { default: defaultExport };
|
|
32
|
-
if (configExport != null) return {
|
|
33
|
-
...proxyModule,
|
|
34
|
-
config: configExport
|
|
35
|
-
};
|
|
36
|
-
return proxyModule;
|
|
37
|
-
}
|
|
38
|
-
async function loadProxyModule(filePath) {
|
|
39
|
-
const absoluteFilePath = path.resolve(filePath);
|
|
40
|
-
if (!fs.existsSync(absoluteFilePath)) throw new Error(`proxy.ts not found: ${absoluteFilePath}`);
|
|
41
|
-
return toProxyModule(await (await createRuntime()).import(absoluteFilePath));
|
|
42
|
-
}
|
|
43
|
-
function matchesCommand(module, command) {
|
|
44
|
-
const commands = module.config?.matcher?.commands;
|
|
45
|
-
if (commands == null || commands.length === 0) return true;
|
|
46
|
-
return commands.includes(command);
|
|
47
|
-
}
|
|
48
|
-
function assertNonEmptyPath(value, label) {
|
|
49
|
-
if (value.trim().length === 0) throw new Error(`${label} cannot be empty`);
|
|
50
|
-
return value;
|
|
51
|
-
}
|
|
52
|
-
function getRouteHandler(handler) {
|
|
53
|
-
if (typeof handler === "function") return handler;
|
|
54
|
-
const proxyDefinition = handler;
|
|
55
|
-
if (proxyDefinition.resolvePublicPath == null) return void 0;
|
|
56
|
-
if (typeof proxyDefinition.resolvePublicPath !== "function") throw new TypeError("proxy.ts default export resolvePublicPath must be a function");
|
|
57
|
-
return proxyDefinition.resolvePublicPath;
|
|
58
|
-
}
|
|
59
|
-
async function resolvePublicPathModule(filePath, ctx, logicalPath) {
|
|
60
|
-
const targetLogicalPath = assertNonEmptyPath(logicalPath, "logical public path");
|
|
61
|
-
const proxyModule = await loadProxyModule(filePath);
|
|
62
|
-
if (!matchesCommand(proxyModule, ctx.command)) return targetLogicalPath;
|
|
63
|
-
const routeHandler = getRouteHandler(proxyModule.default);
|
|
64
|
-
if (routeHandler == null) return targetLogicalPath;
|
|
65
|
-
const resolvedPath = await routeHandler(targetLogicalPath, ctx);
|
|
66
|
-
if (typeof resolvedPath !== "string") throw new Error("proxy.ts must resolve public paths to a string");
|
|
67
|
-
return assertNonEmptyPath(resolvedPath, "proxy.ts resolved public path");
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
//#endregion
|
|
71
|
-
//#region ../libraries/script-runtime/dist/index.mjs
|
|
72
|
-
async function resolvePublicPathUnchecked(filePath, ctx, logicalPath) {
|
|
73
|
-
return resolvePublicPathModule(filePath, ctx, logicalPath);
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
//#endregion
|
|
77
|
-
//#region src/script-runtime-worker.ts
|
|
78
|
-
async function main() {
|
|
79
|
-
const [, , filePath, ctxJsonPath, logicalPath] = process.argv;
|
|
80
|
-
if (filePath == null || ctxJsonPath == null || logicalPath == null) throw new Error("Usage: script-runtime-worker <file-path> <ctx-json-path> <logical-path>");
|
|
81
|
-
const ctxJson = readFileSync(ctxJsonPath, "utf8");
|
|
82
|
-
const result = await resolvePublicPathUnchecked(filePath, JSON.parse(ctxJson), logicalPath);
|
|
83
|
-
process.stdout.write(`${result}\n`);
|
|
84
|
-
}
|
|
85
|
-
main().catch((error) => {
|
|
86
|
-
const message = error instanceof Error ? error.message : String(error);
|
|
87
|
-
process.stderr.write(`${message}\n`);
|
|
88
|
-
process.exit(1);
|
|
89
|
-
});
|
|
90
|
-
|
|
91
|
-
//#endregion
|
|
92
|
-
export { };
|
|
1
|
+
import{readFileSync as e}from"node:fs";import t from"node:process";import{resolvePublicPathUnchecked as n}from"@truenine/script-runtime";async function r(){let[,,r,i,a]=t.argv;if(r==null||i==null||a==null)throw Error(`Usage: script-runtime-worker <file-path> <ctx-json-path> <logical-path>`);let o=e(i,`utf8`),s=await n(r,JSON.parse(o),a);t.stdout.write(`${s}\n`)}r().catch(e=>{t.stderr.write(`${e instanceof Error?e.message:String(e)}\n`),t.exit(1)});export{};
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@truenine/memory-sync-cli",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "2026.
|
|
5
|
-
"description": "TrueNine Memory Synchronization CLI",
|
|
4
|
+
"version": "2026.10402.103",
|
|
5
|
+
"description": "TrueNine Memory Synchronization CLI shell",
|
|
6
6
|
"author": "TrueNine",
|
|
7
7
|
"license": "AGPL-3.0-only",
|
|
8
8
|
"homepage": "https://github.com/TrueNine/memory-sync",
|
|
@@ -47,57 +47,46 @@
|
|
|
47
47
|
"access": "public",
|
|
48
48
|
"registry": "https://registry.npmjs.org/"
|
|
49
49
|
},
|
|
50
|
-
"dependencies": {
|
|
50
|
+
"dependencies": {},
|
|
51
|
+
"optionalDependencies": {
|
|
51
52
|
"json5": "^2.2.3",
|
|
52
53
|
"yaml": "^2.8.3",
|
|
53
|
-
"zod": "^4.3.6"
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
"@truenine/memory-sync-cli-
|
|
57
|
-
"@truenine/memory-sync-cli-
|
|
58
|
-
"@truenine/memory-sync-cli-
|
|
59
|
-
"@truenine/
|
|
60
|
-
"@truenine/memory-sync-cli-win32-x64-msvc": "2026.10330.118"
|
|
54
|
+
"zod": "^4.3.6",
|
|
55
|
+
"@truenine/memory-sync-cli-darwin-x64": "2026.10402.103",
|
|
56
|
+
"@truenine/memory-sync-cli-darwin-arm64": "2026.10402.103",
|
|
57
|
+
"@truenine/memory-sync-cli-linux-arm64-gnu": "2026.10402.103",
|
|
58
|
+
"@truenine/memory-sync-cli-linux-x64-gnu": "2026.10402.103",
|
|
59
|
+
"@truenine/memory-sync-cli-win32-x64-msvc": "2026.10402.103",
|
|
60
|
+
"@truenine/script-runtime": "2026.10402.103"
|
|
61
61
|
},
|
|
62
62
|
"devDependencies": {
|
|
63
|
-
"@
|
|
64
|
-
"@types/
|
|
65
|
-
"@types/picomatch": "^4.0.2",
|
|
63
|
+
"@truenine/eslint10-config": "^2026.10402.10314",
|
|
64
|
+
"@types/node": "^25.5.0",
|
|
66
65
|
"@vitest/coverage-v8": "4.1.2",
|
|
67
|
-
"
|
|
68
|
-
"
|
|
69
|
-
"
|
|
70
|
-
"lightningcss": "^1.32.0",
|
|
71
|
-
"picocolors": "^1.1.1",
|
|
72
|
-
"picomatch": "^4.0.4",
|
|
66
|
+
"eslint": "^10.1.0",
|
|
67
|
+
"npm-run-all2": "^8.0.4",
|
|
68
|
+
"tsdown": "^0.21.7",
|
|
73
69
|
"tsx": "^4.21.0",
|
|
70
|
+
"typescript": "6.0.2",
|
|
74
71
|
"vitest": "^4.1.2",
|
|
75
|
-
"
|
|
76
|
-
"@truenine/logger": "2026.10330.118",
|
|
77
|
-
"@truenine/script-runtime": "2026.10330.118",
|
|
78
|
-
"@truenine/md-compiler": "2026.10330.118"
|
|
72
|
+
"@truenine/memory-sync-sdk": "2026.10402.103"
|
|
79
73
|
},
|
|
80
74
|
"scripts": {
|
|
81
|
-
"build": "run-s build:
|
|
82
|
-
"build:
|
|
75
|
+
"build": "run-s build:sdk build:shell sync:sdk-assets",
|
|
76
|
+
"build:sdk": "pnpm -F @truenine/memory-sync-sdk run build",
|
|
83
77
|
"build:napi:copy": "tsx ../scripts/copy-napi.ts",
|
|
84
|
-
"build:
|
|
85
|
-
"build
|
|
86
|
-
"
|
|
87
|
-
"
|
|
88
|
-
"check": "run-s build:deps:ts check:run",
|
|
78
|
+
"build:shell": "tsdown",
|
|
79
|
+
"ensure:sdk-build": "tsx scripts/ensure-sdk-build.ts",
|
|
80
|
+
"sync:sdk-assets": "tsx scripts/sync-sdk-dist.ts",
|
|
81
|
+
"check": "run-s ensure:sdk-build check:run",
|
|
89
82
|
"check:run": "run-p lint:run typecheck:run",
|
|
90
|
-
"
|
|
91
|
-
"generate:schema": "tsx scripts/generate-schema.ts",
|
|
92
|
-
"lint": "run-s build:deps:ts lint:run",
|
|
83
|
+
"lint": "run-s ensure:sdk-build lint:run",
|
|
93
84
|
"lint:run": "eslint --cache --cache-location node_modules/.cache/.eslintcache .",
|
|
94
|
-
"test": "run-s build
|
|
95
|
-
"test:native-cleanup-smoke": "tsx scripts/cleanup-native-smoke.ts",
|
|
85
|
+
"test": "run-s ensure:sdk-build test:run",
|
|
96
86
|
"test:run": "vitest run",
|
|
97
|
-
"
|
|
98
|
-
"lintfix": "run-s build:deps:ts lintfix:run",
|
|
87
|
+
"lintfix": "run-s ensure:sdk-build lintfix:run",
|
|
99
88
|
"lintfix:run": "eslint --fix --cache --cache-location node_modules/.cache/.eslintcache .",
|
|
100
|
-
"typecheck": "run-s build
|
|
89
|
+
"typecheck": "run-s ensure:sdk-build typecheck:run",
|
|
101
90
|
"typecheck:run": "tsc --noEmit -p tsconfig.lib.json"
|
|
102
91
|
}
|
|
103
92
|
}
|