@m3rcena/eco 0.0.0-stage → 14.28.1
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/CHANGELOG.md +119 -0
- package/DOCUMENTATION.md +869 -0
- package/LICENSE +191 -0
- package/README.md +182 -2
- package/assets/logo.png +0 -0
- package/dist/host-Bmld-WtZ.cjs +6163 -0
- package/dist/host-Bmld-WtZ.cjs.map +1 -0
- package/dist/host-XZmTzNyx.d.cts +1833 -0
- package/dist/host-XZmTzNyx.d.cts.map +1 -0
- package/dist/host-_xxHiG2p.d.mts +1833 -0
- package/dist/host-_xxHiG2p.d.mts.map +1 -0
- package/dist/host-qJNVzdDa.mjs +5894 -0
- package/dist/host-qJNVzdDa.mjs.map +1 -0
- package/dist/host.cjs +4 -0
- package/dist/host.d.cts +2 -0
- package/dist/host.d.mts +2 -0
- package/dist/host.mjs +2 -0
- package/dist/index.cjs +1440 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +339 -0
- package/dist/index.d.cts.map +1 -0
- package/dist/index.d.mts +339 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +1371 -0
- package/dist/index.mjs.map +1 -0
- package/dist/register.cjs +46 -0
- package/dist/register.cjs.map +1 -0
- package/dist/register.d.cts +6 -0
- package/dist/register.d.cts.map +1 -0
- package/dist/register.d.mts +6 -0
- package/dist/register.d.mts.map +1 -0
- package/dist/register.mjs +44 -0
- package/dist/register.mjs.map +1 -0
- package/dist/resolver.cjs +305 -0
- package/dist/resolver.cjs.map +1 -0
- package/dist/resolver.d.cts +40 -0
- package/dist/resolver.d.cts.map +1 -0
- package/dist/resolver.d.mts +40 -0
- package/dist/resolver.d.mts.map +1 -0
- package/dist/resolver.mjs +296 -0
- package/dist/resolver.mjs.map +1 -0
- package/dist/rolldown-runtime-CmQyd0Gu.cjs +27 -0
- package/dist/rolldown-runtime-D3PmRqjj.mjs +4 -0
- package/package.json +94 -4
|
@@ -0,0 +1,305 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_rolldown_runtime = require("./rolldown-runtime-CmQyd0Gu.cjs");
|
|
3
|
+
let node_fs = require("node:fs");
|
|
4
|
+
node_fs = require_rolldown_runtime.__toESM(node_fs);
|
|
5
|
+
let node_path = require("node:path");
|
|
6
|
+
node_path = require_rolldown_runtime.__toESM(node_path);
|
|
7
|
+
// src/resolver.ts
|
|
8
|
+
/**
|
|
9
|
+
* @m3rcena/eco - Rust-Style Submodule & Path Resolver
|
|
10
|
+
*
|
|
11
|
+
* Inspired by Cargo's workspace and [patch.crates-io] resolver algorithm.
|
|
12
|
+
* Enables zero-friction consumption of @m3rcena packages via Git submodules,
|
|
13
|
+
* local vendor paths, or standard NPM registry installs without code changes.
|
|
14
|
+
*
|
|
15
|
+
* @copyright 2026 M3rcena Development. All rights reserved.
|
|
16
|
+
* @license Apache-2.0
|
|
17
|
+
*/
|
|
18
|
+
const KNOWN_PACKAGES = {
|
|
19
|
+
"@m3rcena/weky": {
|
|
20
|
+
aliases: [
|
|
21
|
+
"m3rcena-weky",
|
|
22
|
+
"weky",
|
|
23
|
+
"weky-manager"
|
|
24
|
+
],
|
|
25
|
+
envVar: "M3RCENA_WEKY_PATH"
|
|
26
|
+
},
|
|
27
|
+
"@m3rcena/eco": {
|
|
28
|
+
aliases: [
|
|
29
|
+
"m3rcena-eco",
|
|
30
|
+
"eco",
|
|
31
|
+
"economy"
|
|
32
|
+
],
|
|
33
|
+
envVar: "M3RCENA_ECO_PATH"
|
|
34
|
+
},
|
|
35
|
+
"@m3rcena/bridge": {
|
|
36
|
+
aliases: [
|
|
37
|
+
"m3rcena-bridge",
|
|
38
|
+
"bridge",
|
|
39
|
+
"m3rcena-core"
|
|
40
|
+
],
|
|
41
|
+
envVar: "M3RCENA_BRIDGE_PATH"
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
const CANDIDATE_CONTAINERS = [
|
|
45
|
+
".",
|
|
46
|
+
"submodules",
|
|
47
|
+
"submodule",
|
|
48
|
+
"vendor",
|
|
49
|
+
"packages",
|
|
50
|
+
"libs",
|
|
51
|
+
"modules"
|
|
52
|
+
];
|
|
53
|
+
function isTypeScriptRuntime() {
|
|
54
|
+
if (typeof process.isBun !== "undefined") return true;
|
|
55
|
+
if (typeof process.isDeno !== "undefined") return true;
|
|
56
|
+
const execArgv = process.execArgv.join(" ");
|
|
57
|
+
if (/tsx|ts-node|@swc\/register|ts-loader/.test(execArgv)) return true;
|
|
58
|
+
if (process.argv[1]?.endsWith(".ts") || process.argv[1]?.endsWith(".mts")) return true;
|
|
59
|
+
if (process.env.M3RCENA_PREFER_SOURCE === "true" || process.env.M3RCENA_PREFER_SOURCE === "1") return true;
|
|
60
|
+
return false;
|
|
61
|
+
}
|
|
62
|
+
function findProjectRoot(startDir = process.cwd()) {
|
|
63
|
+
let current = node_path.default.resolve(startDir);
|
|
64
|
+
for (let i = 0; i < 6; i++) {
|
|
65
|
+
const pkgJson = node_path.default.join(current, "package.json");
|
|
66
|
+
if (node_fs.default.existsSync(pkgJson)) return current;
|
|
67
|
+
const parent = node_path.default.dirname(current);
|
|
68
|
+
if (parent === current) break;
|
|
69
|
+
current = parent;
|
|
70
|
+
}
|
|
71
|
+
return node_path.default.resolve(startDir);
|
|
72
|
+
}
|
|
73
|
+
function loadResolverConfig(cwd = process.cwd()) {
|
|
74
|
+
const root = findProjectRoot(cwd);
|
|
75
|
+
const resolverFile = node_path.default.join(root, "m3rcena.resolver.json");
|
|
76
|
+
if (node_fs.default.existsSync(resolverFile)) try {
|
|
77
|
+
return JSON.parse(node_fs.default.readFileSync(resolverFile, "utf-8"));
|
|
78
|
+
} catch {}
|
|
79
|
+
const pkgJsonPath = node_path.default.join(root, "package.json");
|
|
80
|
+
if (node_fs.default.existsSync(pkgJsonPath)) try {
|
|
81
|
+
const pkg = JSON.parse(node_fs.default.readFileSync(pkgJsonPath, "utf-8"));
|
|
82
|
+
if (pkg.m3rcena && typeof pkg.m3rcena === "object") return pkg.m3rcena;
|
|
83
|
+
} catch {}
|
|
84
|
+
return null;
|
|
85
|
+
}
|
|
86
|
+
function inspectSubmoduleDirectory(dirPath, expectedName) {
|
|
87
|
+
if (!node_fs.default.existsSync(dirPath)) return { isValid: false };
|
|
88
|
+
try {
|
|
89
|
+
if (!node_fs.default.statSync(dirPath).isDirectory()) return { isValid: false };
|
|
90
|
+
const pkgPath = node_path.default.join(dirPath, "package.json");
|
|
91
|
+
if (node_fs.default.existsSync(pkgPath)) {
|
|
92
|
+
const data = JSON.parse(node_fs.default.readFileSync(pkgPath, "utf-8"));
|
|
93
|
+
if (data.name === expectedName) return {
|
|
94
|
+
isValid: true,
|
|
95
|
+
version: data.version
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
if (node_fs.default.existsSync(node_path.default.join(dirPath, "src", "index.ts"))) return { isValid: true };
|
|
99
|
+
} catch {
|
|
100
|
+
return { isValid: false };
|
|
101
|
+
}
|
|
102
|
+
return { isValid: false };
|
|
103
|
+
}
|
|
104
|
+
function resolveSubmoduleEntryPoint(dirPath, preferSource) {
|
|
105
|
+
const srcTs = node_path.default.join(dirPath, "src", "index.ts");
|
|
106
|
+
const distMjs = node_path.default.join(dirPath, "dist", "index.mjs");
|
|
107
|
+
const distCjs = node_path.default.join(dirPath, "dist", "index.cjs");
|
|
108
|
+
const isBuilt = node_fs.default.existsSync(distMjs) || node_fs.default.existsSync(distCjs);
|
|
109
|
+
if (preferSource && node_fs.default.existsSync(srcTs)) return {
|
|
110
|
+
entryPath: srcTs,
|
|
111
|
+
type: "source",
|
|
112
|
+
isBuilt
|
|
113
|
+
};
|
|
114
|
+
if (node_fs.default.existsSync(distMjs)) return {
|
|
115
|
+
entryPath: distMjs,
|
|
116
|
+
type: "dist",
|
|
117
|
+
isBuilt: true
|
|
118
|
+
};
|
|
119
|
+
if (node_fs.default.existsSync(distCjs)) return {
|
|
120
|
+
entryPath: distCjs,
|
|
121
|
+
type: "dist",
|
|
122
|
+
isBuilt: true
|
|
123
|
+
};
|
|
124
|
+
if (node_fs.default.existsSync(srcTs)) return {
|
|
125
|
+
entryPath: srcTs,
|
|
126
|
+
type: "source",
|
|
127
|
+
isBuilt: false
|
|
128
|
+
};
|
|
129
|
+
return {
|
|
130
|
+
entryPath: dirPath,
|
|
131
|
+
type: "dist",
|
|
132
|
+
isBuilt
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
function resolvePackage(packageName, options = {}) {
|
|
136
|
+
const root = findProjectRoot(options.cwd ?? process.cwd());
|
|
137
|
+
const cfg = loadResolverConfig(root);
|
|
138
|
+
const pkgMeta = KNOWN_PACKAGES[packageName];
|
|
139
|
+
const preferSource = options.preferSource ?? cfg?.preferSource ?? isTypeScriptRuntime();
|
|
140
|
+
const rootInspected = inspectSubmoduleDirectory(root, packageName);
|
|
141
|
+
if (rootInspected.isValid) {
|
|
142
|
+
const ep = resolveSubmoduleEntryPoint(root, preferSource);
|
|
143
|
+
return {
|
|
144
|
+
name: packageName,
|
|
145
|
+
status: "submodule",
|
|
146
|
+
type: ep.type,
|
|
147
|
+
path: ep.entryPath,
|
|
148
|
+
rootDirectory: root,
|
|
149
|
+
version: rootInspected.version,
|
|
150
|
+
isBuilt: ep.isBuilt
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
if (options.overrides?.[packageName]) {
|
|
154
|
+
const customPath = node_path.default.resolve(root, options.overrides[packageName]);
|
|
155
|
+
const inspected = inspectSubmoduleDirectory(customPath, packageName);
|
|
156
|
+
if (inspected.isValid) {
|
|
157
|
+
const ep = resolveSubmoduleEntryPoint(customPath, preferSource);
|
|
158
|
+
return {
|
|
159
|
+
name: packageName,
|
|
160
|
+
status: "submodule",
|
|
161
|
+
type: ep.type,
|
|
162
|
+
path: ep.entryPath,
|
|
163
|
+
rootDirectory: customPath,
|
|
164
|
+
version: inspected.version,
|
|
165
|
+
isBuilt: ep.isBuilt
|
|
166
|
+
};
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
const envVal = process.env[pkgMeta.envVar];
|
|
170
|
+
if (envVal) {
|
|
171
|
+
const customPath = node_path.default.resolve(root, envVal);
|
|
172
|
+
const inspected = inspectSubmoduleDirectory(customPath, packageName);
|
|
173
|
+
if (inspected.isValid) {
|
|
174
|
+
const ep = resolveSubmoduleEntryPoint(customPath, preferSource);
|
|
175
|
+
return {
|
|
176
|
+
name: packageName,
|
|
177
|
+
status: "submodule",
|
|
178
|
+
type: ep.type,
|
|
179
|
+
path: ep.entryPath,
|
|
180
|
+
rootDirectory: customPath,
|
|
181
|
+
version: inspected.version,
|
|
182
|
+
isBuilt: ep.isBuilt
|
|
183
|
+
};
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
if (cfg?.packages?.[packageName]) {
|
|
187
|
+
const customPath = node_path.default.resolve(root, cfg.packages[packageName]);
|
|
188
|
+
const inspected = inspectSubmoduleDirectory(customPath, packageName);
|
|
189
|
+
if (inspected.isValid) {
|
|
190
|
+
const ep = resolveSubmoduleEntryPoint(customPath, preferSource);
|
|
191
|
+
return {
|
|
192
|
+
name: packageName,
|
|
193
|
+
status: "submodule",
|
|
194
|
+
type: ep.type,
|
|
195
|
+
path: ep.entryPath,
|
|
196
|
+
rootDirectory: customPath,
|
|
197
|
+
version: inspected.version,
|
|
198
|
+
isBuilt: ep.isBuilt
|
|
199
|
+
};
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
const candidateContainers = [
|
|
203
|
+
options.submodulesDir,
|
|
204
|
+
cfg?.submodulesDir,
|
|
205
|
+
process.env.M3RCENA_SUBMODULES_DIR,
|
|
206
|
+
...CANDIDATE_CONTAINERS
|
|
207
|
+
].filter((c) => typeof c === "string" && c.trim().length > 0);
|
|
208
|
+
const searchRoots = [
|
|
209
|
+
root,
|
|
210
|
+
node_path.default.resolve(root, ".."),
|
|
211
|
+
node_path.default.resolve(root, "../..")
|
|
212
|
+
];
|
|
213
|
+
for (const sRoot of searchRoots) for (const container of candidateContainers) for (const alias of pkgMeta.aliases) {
|
|
214
|
+
const candidateDir = node_path.default.resolve(sRoot, container, alias);
|
|
215
|
+
const inspected = inspectSubmoduleDirectory(candidateDir, packageName);
|
|
216
|
+
if (inspected.isValid) {
|
|
217
|
+
const ep = resolveSubmoduleEntryPoint(candidateDir, preferSource);
|
|
218
|
+
return {
|
|
219
|
+
name: packageName,
|
|
220
|
+
status: "submodule",
|
|
221
|
+
type: ep.type,
|
|
222
|
+
path: ep.entryPath,
|
|
223
|
+
rootDirectory: candidateDir,
|
|
224
|
+
version: inspected.version,
|
|
225
|
+
isBuilt: ep.isBuilt
|
|
226
|
+
};
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
try {
|
|
230
|
+
return {
|
|
231
|
+
name: packageName,
|
|
232
|
+
status: "npm",
|
|
233
|
+
type: "registry",
|
|
234
|
+
path: require.resolve(packageName, { paths: [root, process.cwd()] })
|
|
235
|
+
};
|
|
236
|
+
} catch {
|
|
237
|
+
const nmPath = node_path.default.join(root, "node_modules", packageName);
|
|
238
|
+
if (node_fs.default.existsSync(nmPath)) return {
|
|
239
|
+
name: packageName,
|
|
240
|
+
status: "npm",
|
|
241
|
+
type: "registry",
|
|
242
|
+
path: nmPath
|
|
243
|
+
};
|
|
244
|
+
}
|
|
245
|
+
return {
|
|
246
|
+
name: packageName,
|
|
247
|
+
status: "missing",
|
|
248
|
+
type: "registry",
|
|
249
|
+
path: packageName
|
|
250
|
+
};
|
|
251
|
+
}
|
|
252
|
+
function getAllPackageResolutions(options = {}) {
|
|
253
|
+
return {
|
|
254
|
+
"@m3rcena/weky": resolvePackage("@m3rcena/weky", options),
|
|
255
|
+
"@m3rcena/eco": resolvePackage("@m3rcena/eco", options),
|
|
256
|
+
"@m3rcena/bridge": resolvePackage("@m3rcena/bridge", options)
|
|
257
|
+
};
|
|
258
|
+
}
|
|
259
|
+
function generateTsConfigPaths(options = {}) {
|
|
260
|
+
const resolutions = getAllPackageResolutions(options);
|
|
261
|
+
const root = findProjectRoot(options.cwd ?? process.cwd());
|
|
262
|
+
const paths = {};
|
|
263
|
+
for (const [name, res] of Object.entries(resolutions)) if (res.status === "submodule" && res.rootDirectory) {
|
|
264
|
+
const rel = node_path.default.relative(root, res.rootDirectory).replace(/\\/g, "/");
|
|
265
|
+
const cleanRel = !rel || rel === "." ? "." : rel.startsWith(".") ? rel : `./${rel}`;
|
|
266
|
+
paths[name] = [
|
|
267
|
+
`${cleanRel}/src`,
|
|
268
|
+
`${cleanRel}/dist/index.mjs`,
|
|
269
|
+
cleanRel
|
|
270
|
+
];
|
|
271
|
+
if (name === "@m3rcena/bridge") paths["@m3rcena/bridge/client"] = [`${cleanRel}/src/client`, `${cleanRel}/dist/client.mjs`];
|
|
272
|
+
}
|
|
273
|
+
return paths;
|
|
274
|
+
}
|
|
275
|
+
function printResolutionSummary(options = {}) {
|
|
276
|
+
const resolutions = getAllPackageResolutions(options);
|
|
277
|
+
const cyan = (s) => `\x1b[36m${s}\x1b[39m`;
|
|
278
|
+
const green = (s) => `\x1b[32m${s}\x1b[39m`;
|
|
279
|
+
const yellow = (s) => `\x1b[33m${s}\x1b[39m`;
|
|
280
|
+
const gray = (s) => `\x1b[90m${s}\x1b[39m`;
|
|
281
|
+
const bold = (s) => `\x1b[1m${s}\x1b[22m`;
|
|
282
|
+
console.log(cyan("┌────────────────────────────────────────────────────────────────────────┐"));
|
|
283
|
+
console.log(cyan("│") + bold(" 🦀 M3RCENA RUST-STYLE SUBMODULE RESOLVER ") + cyan("│"));
|
|
284
|
+
console.log(cyan("├────────────────────────────────────────────────────────────────────────┤"));
|
|
285
|
+
for (const [name, res] of Object.entries(resolutions)) {
|
|
286
|
+
const padName = name.padEnd(16);
|
|
287
|
+
if (res.status === "submodule") {
|
|
288
|
+
const mode = res.type === "source" ? yellow("[SOURCE]") : green("[DIST]");
|
|
289
|
+
const ver = res.version ? `v${res.version}` : "local";
|
|
290
|
+
const shortPath = res.rootDirectory ? node_path.default.basename(res.rootDirectory) : res.path;
|
|
291
|
+
console.log(cyan("│") + ` ${bold(padName)} -> ${green("submodule")} ${mode} ${gray(ver)} ${gray(`(${shortPath})`)}`.padEnd(79) + cyan("│"));
|
|
292
|
+
} else if (res.status === "npm") console.log(cyan("│") + ` ${bold(padName)} -> ${cyan("npm registry")} ${gray("(node_modules)")}`.padEnd(79) + cyan("│"));
|
|
293
|
+
else console.log(cyan("│") + ` ${bold(padName)} -> ${gray("not installed")}`.padEnd(79) + cyan("│"));
|
|
294
|
+
}
|
|
295
|
+
console.log(cyan("└────────────────────────────────────────────────────────────────────────┘"));
|
|
296
|
+
}
|
|
297
|
+
exports.findProjectRoot = findProjectRoot;
|
|
298
|
+
exports.generateTsConfigPaths = generateTsConfigPaths;
|
|
299
|
+
exports.getAllPackageResolutions = getAllPackageResolutions;
|
|
300
|
+
exports.isTypeScriptRuntime = isTypeScriptRuntime;
|
|
301
|
+
exports.loadResolverConfig = loadResolverConfig;
|
|
302
|
+
exports.printResolutionSummary = printResolutionSummary;
|
|
303
|
+
exports.resolvePackage = resolvePackage;
|
|
304
|
+
|
|
305
|
+
//# sourceMappingURL=resolver.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolver.cjs","names":["path","fs"],"sources":["../src/resolver.ts"],"sourcesContent":["/**\n * @m3rcena/eco - Rust-Style Submodule & Path Resolver\n *\n * Inspired by Cargo's workspace and [patch.crates-io] resolver algorithm.\n * Enables zero-friction consumption of @m3rcena packages via Git submodules,\n * local vendor paths, or standard NPM registry installs without code changes.\n *\n * @copyright 2026 M3rcena Development. All rights reserved.\n * @license Apache-2.0\n */\n\nimport fs from \"node:fs\";\nimport path from \"node:path\";\n\nexport type M3rcenaPackageName = \"@m3rcena/weky\" | \"@m3rcena/eco\" | \"@m3rcena/bridge\";\n\nexport interface PackageResolution {\n name: M3rcenaPackageName;\n status: \"submodule\" | \"npm\" | \"missing\";\n type: \"source\" | \"dist\" | \"registry\";\n path: string;\n rootDirectory?: string;\n version?: string;\n isBuilt?: boolean;\n}\n\nexport interface ResolverOptions {\n cwd?: string;\n submodulesDir?: string;\n preferSource?: boolean;\n overrides?: Partial<Record<M3rcenaPackageName, string>>;\n silent?: boolean;\n}\n\nexport interface M3rcenaResolverConfig {\n submodulesDir?: string;\n preferSource?: boolean;\n packages?: Partial<Record<M3rcenaPackageName, string>>;\n}\n\nconst KNOWN_PACKAGES: Record<M3rcenaPackageName, { aliases: string[]; envVar: string }> = {\n \"@m3rcena/weky\": {\n aliases: [\"m3rcena-weky\", \"weky\", \"weky-manager\"],\n envVar: \"M3RCENA_WEKY_PATH\",\n },\n \"@m3rcena/eco\": {\n aliases: [\"m3rcena-eco\", \"eco\", \"economy\"],\n envVar: \"M3RCENA_ECO_PATH\",\n },\n \"@m3rcena/bridge\": {\n aliases: [\"m3rcena-bridge\", \"bridge\", \"m3rcena-core\"],\n envVar: \"M3RCENA_BRIDGE_PATH\",\n },\n};\n\nconst CANDIDATE_CONTAINERS = [\n \".\",\n \"submodules\",\n \"submodule\",\n \"vendor\",\n \"packages\",\n \"libs\",\n \"modules\",\n];\n\nexport function isTypeScriptRuntime(): boolean {\n if (typeof (process as any).isBun !== \"undefined\") return true;\n if (typeof (process as any).isDeno !== \"undefined\") return true;\n const execArgv = process.execArgv.join(\" \");\n if (/tsx|ts-node|@swc\\/register|ts-loader/.test(execArgv)) return true;\n if (process.argv[1]?.endsWith(\".ts\") || process.argv[1]?.endsWith(\".mts\")) return true;\n if (process.env.M3RCENA_PREFER_SOURCE === \"true\" || process.env.M3RCENA_PREFER_SOURCE === \"1\") return true;\n return false;\n}\n\nexport function findProjectRoot(startDir: string = process.cwd()): string {\n let current = path.resolve(startDir);\n for (let i = 0; i < 6; i++) {\n const pkgJson = path.join(current, \"package.json\");\n if (fs.existsSync(pkgJson)) {\n return current;\n }\n const parent = path.dirname(current);\n if (parent === current) break;\n current = parent;\n }\n return path.resolve(startDir);\n}\n\nexport function loadResolverConfig(cwd: string = process.cwd()): M3rcenaResolverConfig | null {\n const root = findProjectRoot(cwd);\n const resolverFile = path.join(root, \"m3rcena.resolver.json\");\n if (fs.existsSync(resolverFile)) {\n try {\n return JSON.parse(fs.readFileSync(resolverFile, \"utf-8\")) as M3rcenaResolverConfig;\n } catch {\n // Ignore\n }\n }\n\n const pkgJsonPath = path.join(root, \"package.json\");\n if (fs.existsSync(pkgJsonPath)) {\n try {\n const pkg = JSON.parse(fs.readFileSync(pkgJsonPath, \"utf-8\"));\n if (pkg.m3rcena && typeof pkg.m3rcena === \"object\") {\n return pkg.m3rcena as M3rcenaResolverConfig;\n }\n } catch {\n // Ignore\n }\n }\n\n return null;\n}\n\nfunction inspectSubmoduleDirectory(dirPath: string, expectedName: M3rcenaPackageName): { isValid: boolean; version?: string } {\n if (!fs.existsSync(dirPath)) return { isValid: false };\n try {\n const stat = fs.statSync(dirPath);\n if (!stat.isDirectory()) return { isValid: false };\n\n const pkgPath = path.join(dirPath, \"package.json\");\n if (fs.existsSync(pkgPath)) {\n const data = JSON.parse(fs.readFileSync(pkgPath, \"utf-8\"));\n if (data.name === expectedName) {\n return { isValid: true, version: data.version };\n }\n }\n\n if (fs.existsSync(path.join(dirPath, \"src\", \"index.ts\"))) {\n return { isValid: true };\n }\n } catch {\n return { isValid: false };\n }\n return { isValid: false };\n}\n\nfunction resolveSubmoduleEntryPoint(dirPath: string, preferSource: boolean): { entryPath: string; type: \"source\" | \"dist\"; isBuilt: boolean } {\n const srcTs = path.join(dirPath, \"src\", \"index.ts\");\n const distMjs = path.join(dirPath, \"dist\", \"index.mjs\");\n const distCjs = path.join(dirPath, \"dist\", \"index.cjs\");\n const isBuilt = fs.existsSync(distMjs) || fs.existsSync(distCjs);\n\n if (preferSource && fs.existsSync(srcTs)) {\n return { entryPath: srcTs, type: \"source\", isBuilt };\n }\n\n if (fs.existsSync(distMjs)) {\n return { entryPath: distMjs, type: \"dist\", isBuilt: true };\n }\n if (fs.existsSync(distCjs)) {\n return { entryPath: distCjs, type: \"dist\", isBuilt: true };\n }\n\n if (fs.existsSync(srcTs)) {\n return { entryPath: srcTs, type: \"source\", isBuilt: false };\n }\n\n return { entryPath: dirPath, type: \"dist\", isBuilt };\n}\n\nexport function resolvePackage(packageName: M3rcenaPackageName, options: ResolverOptions = {}): PackageResolution {\n const root = findProjectRoot(options.cwd ?? process.cwd());\n const cfg = loadResolverConfig(root);\n const pkgMeta = KNOWN_PACKAGES[packageName];\n\n const preferSource = options.preferSource ?? cfg?.preferSource ?? isTypeScriptRuntime();\n\n // 0. Current project check: if root itself IS the requested package\n const rootInspected = inspectSubmoduleDirectory(root, packageName);\n if (rootInspected.isValid) {\n const ep = resolveSubmoduleEntryPoint(root, preferSource);\n return {\n name: packageName,\n status: \"submodule\",\n type: ep.type,\n path: ep.entryPath,\n rootDirectory: root,\n version: rootInspected.version,\n isBuilt: ep.isBuilt,\n };\n }\n\n if (options.overrides?.[packageName]) {\n const customPath = path.resolve(root, options.overrides[packageName]!);\n const inspected = inspectSubmoduleDirectory(customPath, packageName);\n if (inspected.isValid) {\n const ep = resolveSubmoduleEntryPoint(customPath, preferSource);\n return {\n name: packageName,\n status: \"submodule\",\n type: ep.type,\n path: ep.entryPath,\n rootDirectory: customPath,\n version: inspected.version,\n isBuilt: ep.isBuilt,\n };\n }\n }\n\n const envVal = process.env[pkgMeta.envVar];\n if (envVal) {\n const customPath = path.resolve(root, envVal);\n const inspected = inspectSubmoduleDirectory(customPath, packageName);\n if (inspected.isValid) {\n const ep = resolveSubmoduleEntryPoint(customPath, preferSource);\n return {\n name: packageName,\n status: \"submodule\",\n type: ep.type,\n path: ep.entryPath,\n rootDirectory: customPath,\n version: inspected.version,\n isBuilt: ep.isBuilt,\n };\n }\n }\n\n if (cfg?.packages?.[packageName]) {\n const customPath = path.resolve(root, cfg.packages[packageName]!);\n const inspected = inspectSubmoduleDirectory(customPath, packageName);\n if (inspected.isValid) {\n const ep = resolveSubmoduleEntryPoint(customPath, preferSource);\n return {\n name: packageName,\n status: \"submodule\",\n type: ep.type,\n path: ep.entryPath,\n rootDirectory: customPath,\n version: inspected.version,\n isBuilt: ep.isBuilt,\n };\n }\n }\n\n const candidateContainers = [\n options.submodulesDir,\n cfg?.submodulesDir,\n process.env.M3RCENA_SUBMODULES_DIR,\n ...CANDIDATE_CONTAINERS,\n ].filter((c): c is string => typeof c === \"string\" && c.trim().length > 0);\n\n const searchRoots = [root, path.resolve(root, \"..\"), path.resolve(root, \"../..\")];\n\n for (const sRoot of searchRoots) {\n for (const container of candidateContainers) {\n for (const alias of pkgMeta.aliases) {\n const candidateDir = path.resolve(sRoot, container, alias);\n const inspected = inspectSubmoduleDirectory(candidateDir, packageName);\n if (inspected.isValid) {\n const ep = resolveSubmoduleEntryPoint(candidateDir, preferSource);\n return {\n name: packageName,\n status: \"submodule\",\n type: ep.type,\n path: ep.entryPath,\n rootDirectory: candidateDir,\n version: inspected.version,\n isBuilt: ep.isBuilt,\n };\n }\n }\n }\n }\n\n try {\n const resolvedNpm = require.resolve(packageName, { paths: [root, process.cwd()] });\n return {\n name: packageName,\n status: \"npm\",\n type: \"registry\",\n path: resolvedNpm,\n };\n } catch {\n const nmPath = path.join(root, \"node_modules\", packageName);\n if (fs.existsSync(nmPath)) {\n return {\n name: packageName,\n status: \"npm\",\n type: \"registry\",\n path: nmPath,\n };\n }\n }\n\n return {\n name: packageName,\n status: \"missing\",\n type: \"registry\",\n path: packageName,\n };\n}\n\nexport function getAllPackageResolutions(options: ResolverOptions = {}): Record<M3rcenaPackageName, PackageResolution> {\n return {\n \"@m3rcena/weky\": resolvePackage(\"@m3rcena/weky\", options),\n \"@m3rcena/eco\": resolvePackage(\"@m3rcena/eco\", options),\n \"@m3rcena/bridge\": resolvePackage(\"@m3rcena/bridge\", options),\n };\n}\n\nexport function generateTsConfigPaths(options: ResolverOptions = {}): Record<string, string[]> {\n const resolutions = getAllPackageResolutions(options);\n const root = findProjectRoot(options.cwd ?? process.cwd());\n const paths: Record<string, string[]> = {};\n\n for (const [name, res] of Object.entries(resolutions)) {\n if (res.status === \"submodule\" && res.rootDirectory) {\n const rel = path.relative(root, res.rootDirectory).replace(/\\\\/g, \"/\");\n const cleanRel = !rel || rel === \".\" ? \".\" : (rel.startsWith(\".\") ? rel : `./${rel}`);\n paths[name] = [`${cleanRel}/src`, `${cleanRel}/dist/index.mjs`, cleanRel];\n if (name === \"@m3rcena/bridge\") {\n paths[\"@m3rcena/bridge/client\"] = [`${cleanRel}/src/client`, `${cleanRel}/dist/client.mjs`];\n }\n }\n }\n\n return paths;\n}\n\nexport function printResolutionSummary(options: ResolverOptions = {}): void {\n const resolutions = getAllPackageResolutions(options);\n const cyan = (s: string) => `\\x1b[36m${s}\\x1b[39m`;\n const green = (s: string) => `\\x1b[32m${s}\\x1b[39m`;\n const yellow = (s: string) => `\\x1b[33m${s}\\x1b[39m`;\n const gray = (s: string) => `\\x1b[90m${s}\\x1b[39m`;\n const bold = (s: string) => `\\x1b[1m${s}\\x1b[22m`;\n\n console.log(cyan(\"┌────────────────────────────────────────────────────────────────────────┐\"));\n console.log(cyan(\"│\") + bold(\" 🦀 M3RCENA RUST-STYLE SUBMODULE RESOLVER \") + cyan(\"│\"));\n console.log(cyan(\"├────────────────────────────────────────────────────────────────────────┤\"));\n\n for (const [name, res] of Object.entries(resolutions)) {\n const padName = name.padEnd(16);\n if (res.status === \"submodule\") {\n const mode = res.type === \"source\" ? yellow(\"[SOURCE]\") : green(\"[DIST]\");\n const ver = res.version ? `v${res.version}` : \"local\";\n const shortPath = res.rootDirectory ? path.basename(res.rootDirectory) : res.path;\n console.log(\n cyan(\"│\") +\n ` ${bold(padName)} -> ${green(\"submodule\")} ${mode} ${gray(ver)} ${gray(`(${shortPath})`)}`.padEnd(79) +\n cyan(\"│\")\n );\n } else if (res.status === \"npm\") {\n console.log(cyan(\"│\") + ` ${bold(padName)} -> ${cyan(\"npm registry\")} ${gray(\"(node_modules)\")}`.padEnd(79) + cyan(\"│\"));\n } else {\n console.log(cyan(\"│\") + ` ${bold(padName)} -> ${gray(\"not installed\")}`.padEnd(79) + cyan(\"│\"));\n }\n }\n\n console.log(cyan(\"└────────────────────────────────────────────────────────────────────────┘\"));\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAwCA,MAAM,iBAAoF;CACxF,iBAAiB;EACf,SAAS;GAAC;GAAgB;GAAQ;EAAc;EAChD,QAAQ;CACV;CACA,gBAAgB;EACd,SAAS;GAAC;GAAe;GAAO;EAAS;EACzC,QAAQ;CACV;CACA,mBAAmB;EACjB,SAAS;GAAC;GAAkB;GAAU;EAAc;EACpD,QAAQ;CACV;AACF;AAEA,MAAM,uBAAuB;CAC3B;CACA;CACA;CACA;CACA;CACA;CACA;AACF;AAEA,SAAgB,sBAA+B;CAC7C,IAAI,OAAQ,QAAgB,UAAU,aAAa,OAAO;CAC1D,IAAI,OAAQ,QAAgB,WAAW,aAAa,OAAO;CAC3D,MAAM,WAAW,QAAQ,SAAS,KAAK,GAAG;CAC1C,IAAI,uCAAuC,KAAK,QAAQ,GAAG,OAAO;CAClE,IAAI,QAAQ,KAAK,EAAE,EAAE,SAAS,KAAK,KAAK,QAAQ,KAAK,EAAE,EAAE,SAAS,MAAM,GAAG,OAAO;CAClF,IAAI,QAAQ,IAAI,0BAA0B,UAAU,QAAQ,IAAI,0BAA0B,KAAK,OAAO;CACtG,OAAO;AACT;AAEA,SAAgB,gBAAgB,WAAmB,QAAQ,IAAI,GAAW;CACxE,IAAI,UAAUA,UAAAA,QAAK,QAAQ,QAAQ;CACnC,KAAK,IAAI,IAAI,GAAG,IAAI,GAAG,KAAK;EAC1B,MAAM,UAAUA,UAAAA,QAAK,KAAK,SAAS,cAAc;EACjD,IAAIC,QAAAA,QAAG,WAAW,OAAO,GACvB,OAAO;EAET,MAAM,SAASD,UAAAA,QAAK,QAAQ,OAAO;EACnC,IAAI,WAAW,SAAS;EACxB,UAAU;CACZ;CACA,OAAOA,UAAAA,QAAK,QAAQ,QAAQ;AAC9B;AAEA,SAAgB,mBAAmB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K,KAAK,OAAO,EAAE,MAAM,KAAK,cAAc,EAAE,GAAG,KAAK,gBAAgB,IAAI,OAAO,EAAE,IAAI,KAAK,GAAG,CAAC;OAExH,QAAQ,IAAI,KAAK,GAAG,IAAI,KAAK,KAAK,OAAO,EAAE,MAAM,KAAK,eAAe,IAAI,OAAO,EAAE,IAAI,KAAK,GAAG,CAAC;CAEnG;CAEA,QAAQ,IAAI,KAAK,4EAA4E,CAAC;AAChG"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @m3rcena/eco - Rust-Style Submodule & Path Resolver
|
|
3
|
+
*
|
|
4
|
+
* Inspired by Cargo's workspace and [patch.crates-io] resolver algorithm.
|
|
5
|
+
* Enables zero-friction consumption of @m3rcena packages via Git submodules,
|
|
6
|
+
* local vendor paths, or standard NPM registry installs without code changes.
|
|
7
|
+
*
|
|
8
|
+
* @copyright 2026 M3rcena Development. All rights reserved.
|
|
9
|
+
* @license Apache-2.0
|
|
10
|
+
*/
|
|
11
|
+
export type M3rcenaPackageName = "@m3rcena/weky" | "@m3rcena/eco" | "@m3rcena/bridge";
|
|
12
|
+
export interface PackageResolution {
|
|
13
|
+
name: M3rcenaPackageName;
|
|
14
|
+
status: "submodule" | "npm" | "missing";
|
|
15
|
+
type: "source" | "dist" | "registry";
|
|
16
|
+
path: string;
|
|
17
|
+
rootDirectory?: string;
|
|
18
|
+
version?: string;
|
|
19
|
+
isBuilt?: boolean;
|
|
20
|
+
}
|
|
21
|
+
export interface ResolverOptions {
|
|
22
|
+
cwd?: string;
|
|
23
|
+
submodulesDir?: string;
|
|
24
|
+
preferSource?: boolean;
|
|
25
|
+
overrides?: Partial<Record<M3rcenaPackageName, string>>;
|
|
26
|
+
silent?: boolean;
|
|
27
|
+
}
|
|
28
|
+
export interface M3rcenaResolverConfig {
|
|
29
|
+
submodulesDir?: string;
|
|
30
|
+
preferSource?: boolean;
|
|
31
|
+
packages?: Partial<Record<M3rcenaPackageName, string>>;
|
|
32
|
+
}
|
|
33
|
+
export declare function isTypeScriptRuntime(): boolean;
|
|
34
|
+
export declare function findProjectRoot(startDir?: string): string;
|
|
35
|
+
export declare function loadResolverConfig(cwd?: string): M3rcenaResolverConfig | null;
|
|
36
|
+
export declare function resolvePackage(packageName: M3rcenaPackageName, options?: ResolverOptions): PackageResolution;
|
|
37
|
+
export declare function getAllPackageResolutions(options?: ResolverOptions): Record<M3rcenaPackageName, PackageResolution>;
|
|
38
|
+
export declare function generateTsConfigPaths(options?: ResolverOptions): Record<string, string[]>;
|
|
39
|
+
export declare function printResolutionSummary(options?: ResolverOptions): void;
|
|
40
|
+
//# sourceMappingURL=resolver.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolver.d.cts","names":[],"sources":["../src/resolver.ts"],"mappings":";;;;;;;;;;YAcY;iBAEK;EACf,MAAM;EACN;EACA;EACA;EACA;EACA;EACA;;iBAGe;EACf;EACA;EACA;EACA,YAAY,QAAQ,OAAO;EAC3B;;iBAGe;EACf;EACA;EACA,WAAW,QAAQ,OAAO;;wBA4BZ;wBAUA,gBAAgB;wBAchB,mBAAmB,eAA8B;wBAyEjD,eAAe,aAAa,oBAAoB,UAAS,kBAAuB;wBAoIhF,yBAAyB,UAAS,kBAAuB,OAAO,oBAAoB;wBAQpF,sBAAsB,UAAS,kBAAuB;wBAmBtD,uBAAuB,UAAS"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @m3rcena/eco - Rust-Style Submodule & Path Resolver
|
|
3
|
+
*
|
|
4
|
+
* Inspired by Cargo's workspace and [patch.crates-io] resolver algorithm.
|
|
5
|
+
* Enables zero-friction consumption of @m3rcena packages via Git submodules,
|
|
6
|
+
* local vendor paths, or standard NPM registry installs without code changes.
|
|
7
|
+
*
|
|
8
|
+
* @copyright 2026 M3rcena Development. All rights reserved.
|
|
9
|
+
* @license Apache-2.0
|
|
10
|
+
*/
|
|
11
|
+
export type M3rcenaPackageName = "@m3rcena/weky" | "@m3rcena/eco" | "@m3rcena/bridge";
|
|
12
|
+
export interface PackageResolution {
|
|
13
|
+
name: M3rcenaPackageName;
|
|
14
|
+
status: "submodule" | "npm" | "missing";
|
|
15
|
+
type: "source" | "dist" | "registry";
|
|
16
|
+
path: string;
|
|
17
|
+
rootDirectory?: string;
|
|
18
|
+
version?: string;
|
|
19
|
+
isBuilt?: boolean;
|
|
20
|
+
}
|
|
21
|
+
export interface ResolverOptions {
|
|
22
|
+
cwd?: string;
|
|
23
|
+
submodulesDir?: string;
|
|
24
|
+
preferSource?: boolean;
|
|
25
|
+
overrides?: Partial<Record<M3rcenaPackageName, string>>;
|
|
26
|
+
silent?: boolean;
|
|
27
|
+
}
|
|
28
|
+
export interface M3rcenaResolverConfig {
|
|
29
|
+
submodulesDir?: string;
|
|
30
|
+
preferSource?: boolean;
|
|
31
|
+
packages?: Partial<Record<M3rcenaPackageName, string>>;
|
|
32
|
+
}
|
|
33
|
+
export declare function isTypeScriptRuntime(): boolean;
|
|
34
|
+
export declare function findProjectRoot(startDir?: string): string;
|
|
35
|
+
export declare function loadResolverConfig(cwd?: string): M3rcenaResolverConfig | null;
|
|
36
|
+
export declare function resolvePackage(packageName: M3rcenaPackageName, options?: ResolverOptions): PackageResolution;
|
|
37
|
+
export declare function getAllPackageResolutions(options?: ResolverOptions): Record<M3rcenaPackageName, PackageResolution>;
|
|
38
|
+
export declare function generateTsConfigPaths(options?: ResolverOptions): Record<string, string[]>;
|
|
39
|
+
export declare function printResolutionSummary(options?: ResolverOptions): void;
|
|
40
|
+
//# sourceMappingURL=resolver.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolver.d.mts","names":[],"sources":["../src/resolver.ts"],"mappings":";;;;;;;;;;YAcY;iBAEK;EACf,MAAM;EACN;EACA;EACA;EACA;EACA;EACA;;iBAGe;EACf;EACA;EACA;EACA,YAAY,QAAQ,OAAO;EAC3B;;iBAGe;EACf;EACA;EACA,WAAW,QAAQ,OAAO;;wBA4BZ;wBAUA,gBAAgB;wBAchB,mBAAmB,eAA8B;wBAyEjD,eAAe,aAAa,oBAAoB,UAAS,kBAAuB;wBAoIhF,yBAAyB,UAAS,kBAAuB,OAAO,oBAAoB;wBAQpF,sBAAsB,UAAS,kBAAuB;wBAmBtD,uBAAuB,UAAS"}
|