@skastr0/pulsar-project-module-sdk 0.1.0
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/definition.d.ts +49 -0
- package/dist/definition.d.ts.map +1 -0
- package/dist/definition.js +73 -0
- package/dist/definition.js.map +1 -0
- package/dist/factor-policy-helper.d.ts +26 -0
- package/dist/factor-policy-helper.d.ts.map +1 -0
- package/dist/factor-policy-helper.js +34 -0
- package/dist/factor-policy-helper.js.map +1 -0
- package/dist/helpers.d.ts +70 -0
- package/dist/helpers.d.ts.map +1 -0
- package/dist/helpers.js +132 -0
- package/dist/helpers.js.map +1 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +7 -0
- package/dist/index.js.map +1 -0
- package/dist/loader-bundle.d.ts +5 -0
- package/dist/loader-bundle.d.ts.map +1 -0
- package/dist/loader-bundle.js +49 -0
- package/dist/loader-bundle.js.map +1 -0
- package/dist/loader-fs.d.ts +5 -0
- package/dist/loader-fs.d.ts.map +1 -0
- package/dist/loader-fs.js +13 -0
- package/dist/loader-fs.js.map +1 -0
- package/dist/loader-materialize.d.ts +7 -0
- package/dist/loader-materialize.d.ts.map +1 -0
- package/dist/loader-materialize.js +179 -0
- package/dist/loader-materialize.js.map +1 -0
- package/dist/loader-paths.d.ts +13 -0
- package/dist/loader-paths.d.ts.map +1 -0
- package/dist/loader-paths.js +59 -0
- package/dist/loader-paths.js.map +1 -0
- package/dist/loader-realpath.d.ts +5 -0
- package/dist/loader-realpath.d.ts.map +1 -0
- package/dist/loader-realpath.js +13 -0
- package/dist/loader-realpath.js.map +1 -0
- package/dist/loader-resolution.d.ts +12 -0
- package/dist/loader-resolution.d.ts.map +1 -0
- package/dist/loader-resolution.js +168 -0
- package/dist/loader-resolution.js.map +1 -0
- package/dist/loader-source-files.d.ts +9 -0
- package/dist/loader-source-files.d.ts.map +1 -0
- package/dist/loader-source-files.js +167 -0
- package/dist/loader-source-files.js.map +1 -0
- package/dist/loader-types.d.ts +17 -0
- package/dist/loader-types.d.ts.map +1 -0
- package/dist/loader-types.js +9 -0
- package/dist/loader-types.js.map +1 -0
- package/dist/loader.d.ts +7 -0
- package/dist/loader.d.ts.map +1 -0
- package/dist/loader.js +66 -0
- package/dist/loader.js.map +1 -0
- package/dist/manifest.d.ts +148 -0
- package/dist/manifest.d.ts.map +1 -0
- package/dist/manifest.js +51 -0
- package/dist/manifest.js.map +1 -0
- package/package.json +49 -0
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
import { createHash } from "node:crypto";
|
|
2
|
+
import { createRequire } from "node:module";
|
|
3
|
+
import { readFile, symlink, writeFile } from "node:fs/promises";
|
|
4
|
+
import { dirname, relative, resolve } from "node:path";
|
|
5
|
+
import { Effect } from "effect";
|
|
6
|
+
import { resolvePulsarRepoStatePath } from "@skastr0/pulsar-core/scoring";
|
|
7
|
+
import { ProjectModuleLoadError } from "./loader-types.js";
|
|
8
|
+
import { bundleMaterializedProjectModule } from "./loader-bundle.js";
|
|
9
|
+
import { mkdirForProjectModuleDirectory } from "./loader-fs.js";
|
|
10
|
+
import { realpathOrProjectModuleLoadError } from "./loader-realpath.js";
|
|
11
|
+
import { isFile, isDirectory, isPackageName, isPathInside, isRecord, nearestNodeModulesRoot, safeSourceFingerprintPath, } from "./loader-paths.js";
|
|
12
|
+
export const materializeProjectModuleImportTarget = (ref, target, sourceRoot, repoRoot, dependencyRoot, sourceFingerprint, files, shadowRootSegments, bundleImportTarget) => Effect.gen(function* () {
|
|
13
|
+
const shadowSourceRoot = resolve(resolvePulsarRepoStatePath(repoRoot, "cache"), "project-modules", safeSourceFingerprintPath(sourceFingerprint), ...shadowRootSegments);
|
|
14
|
+
for (const file of files) {
|
|
15
|
+
const relativePath = relative(sourceRoot, file.path);
|
|
16
|
+
if (relativePath.startsWith("..") || resolve(relativePath) === relativePath) {
|
|
17
|
+
return yield* escapedSourceRootError(ref, target);
|
|
18
|
+
}
|
|
19
|
+
const destination = resolve(shadowSourceRoot, relativePath);
|
|
20
|
+
if (!isPathInside(shadowSourceRoot, destination)) {
|
|
21
|
+
return yield* escapedMaterializedRootError(ref, target);
|
|
22
|
+
}
|
|
23
|
+
const content = yield* readFileBytes(ref, target, file);
|
|
24
|
+
yield* mkdirForProjectModuleDirectory(ref, dirname(destination), `Failed to create materialized project module directory`);
|
|
25
|
+
yield* writeMaterializedFile(ref, file, destination, content);
|
|
26
|
+
}
|
|
27
|
+
yield* linkMaterializedPackageDependencies(ref, dependencyRoot, shadowSourceRoot);
|
|
28
|
+
const importTarget = resolve(shadowSourceRoot, relative(sourceRoot, target));
|
|
29
|
+
if (!bundleImportTarget)
|
|
30
|
+
return importTarget;
|
|
31
|
+
return yield* bundleMaterializedProjectModule(ref, importTarget, shadowSourceRoot, sourceFingerprint);
|
|
32
|
+
});
|
|
33
|
+
export const hashProjectModuleSource = (ref, target, files) => Effect.gen(function* () {
|
|
34
|
+
const hash = createHash("sha256");
|
|
35
|
+
for (const file of [...files].sort((left, right) => left.sourceRef.localeCompare(right.sourceRef))) {
|
|
36
|
+
const content = yield* readFileBytes(ref, target, file);
|
|
37
|
+
hash.update(file.sourceRef);
|
|
38
|
+
hash.update("\0");
|
|
39
|
+
hash.update(content);
|
|
40
|
+
hash.update("\0");
|
|
41
|
+
}
|
|
42
|
+
return `sha256:${hash.digest("hex")}`;
|
|
43
|
+
});
|
|
44
|
+
const linkMaterializedPackageDependencies = (ref, sourceRoot, shadowSourceRoot) => Effect.gen(function* () {
|
|
45
|
+
const packageJsonPath = resolve(sourceRoot, "package.json");
|
|
46
|
+
if (!(yield* isFile(packageJsonPath))) {
|
|
47
|
+
yield* linkMaterializedNodeModulesFallback(ref, sourceRoot, shadowSourceRoot);
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
const raw = yield* readTextFile(ref, packageJsonPath, `Failed to read project module package manifest while linking dependencies`);
|
|
51
|
+
const parsed = yield* Effect.try({
|
|
52
|
+
try: () => JSON.parse(raw),
|
|
53
|
+
catch: (cause) => new ProjectModuleLoadError({
|
|
54
|
+
refId: ref.id,
|
|
55
|
+
target: packageJsonPath,
|
|
56
|
+
message: `Failed to parse project module package manifest while linking dependencies`,
|
|
57
|
+
cause,
|
|
58
|
+
}),
|
|
59
|
+
});
|
|
60
|
+
const dependencies = dependencyNamesOfPackageJson(parsed);
|
|
61
|
+
if (dependencies.length === 0)
|
|
62
|
+
return;
|
|
63
|
+
const nodeModulesRoot = nearestNodeModulesRoot(shadowSourceRoot) ?? resolve(shadowSourceRoot, "node_modules");
|
|
64
|
+
const sourceRequire = createRequire(packageJsonPath);
|
|
65
|
+
for (const dependency of dependencies) {
|
|
66
|
+
if (dependency === ref.id)
|
|
67
|
+
continue;
|
|
68
|
+
const dependencyRoot = yield* resolveDependencyRoot(ref, sourceRoot, sourceRequire, dependency);
|
|
69
|
+
if (dependencyRoot === undefined)
|
|
70
|
+
continue;
|
|
71
|
+
const destination = resolve(nodeModulesRoot, ...dependency.split("/"));
|
|
72
|
+
if (yield* isFile(resolve(destination, "package.json")))
|
|
73
|
+
continue;
|
|
74
|
+
yield* mkdirForProjectModuleDirectory(ref, dirname(destination), `Failed to create materialized project module directory`);
|
|
75
|
+
yield* symlinkDependency(ref, dependency, dependencyRoot, destination);
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
const dependencyNamesOfPackageJson = (value) => {
|
|
79
|
+
if (!isRecord(value))
|
|
80
|
+
return [];
|
|
81
|
+
const names = new Set();
|
|
82
|
+
for (const field of ["dependencies", "peerDependencies", "optionalDependencies"]) {
|
|
83
|
+
const dependencies = value[field];
|
|
84
|
+
if (!isRecord(dependencies))
|
|
85
|
+
continue;
|
|
86
|
+
for (const name of Object.keys(dependencies)) {
|
|
87
|
+
if (isPackageName(name))
|
|
88
|
+
names.add(name);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
return [...names].sort();
|
|
92
|
+
};
|
|
93
|
+
const linkMaterializedNodeModulesFallback = (ref, sourceRoot, shadowSourceRoot) => Effect.gen(function* () {
|
|
94
|
+
const sourceNodeModules = resolve(sourceRoot, "node_modules");
|
|
95
|
+
if (!(yield* isDirectory(sourceNodeModules)))
|
|
96
|
+
return;
|
|
97
|
+
const nodeModulesRoot = nearestNodeModulesRoot(shadowSourceRoot) ?? resolve(shadowSourceRoot, "node_modules");
|
|
98
|
+
if (yield* isDirectory(nodeModulesRoot))
|
|
99
|
+
return;
|
|
100
|
+
const dependencyRoot = yield* realpathOrProjectModuleLoadError(ref, sourceNodeModules, "node_modules", `Failed to resolve project module dependency directory node_modules`);
|
|
101
|
+
yield* mkdirForProjectModuleDirectory(ref, dirname(nodeModulesRoot), `Failed to create materialized project module directory`);
|
|
102
|
+
yield* symlinkDependency(ref, "node_modules", dependencyRoot, nodeModulesRoot);
|
|
103
|
+
});
|
|
104
|
+
const readFileBytes = (ref, target, file) => Effect.tryPromise({
|
|
105
|
+
try: () => readFile(file.path),
|
|
106
|
+
catch: (cause) => new ProjectModuleLoadError({
|
|
107
|
+
refId: ref.id,
|
|
108
|
+
target,
|
|
109
|
+
message: `Failed to read project module source ${file.sourceRef}`,
|
|
110
|
+
cause,
|
|
111
|
+
}),
|
|
112
|
+
});
|
|
113
|
+
const resolveDependencyRoot = (ref, sourceRoot, sourceRequire, dependency) => Effect.gen(function* () {
|
|
114
|
+
const installedRoot = resolve(sourceRoot, "node_modules", ...dependency.split("/"));
|
|
115
|
+
if (yield* isFile(resolve(installedRoot, "package.json"))) {
|
|
116
|
+
return yield* realpathDependency(ref, dependency, installedRoot);
|
|
117
|
+
}
|
|
118
|
+
let entrypoint;
|
|
119
|
+
try {
|
|
120
|
+
entrypoint = sourceRequire.resolve(dependency);
|
|
121
|
+
}
|
|
122
|
+
catch {
|
|
123
|
+
entrypoint = undefined;
|
|
124
|
+
}
|
|
125
|
+
if (entrypoint === undefined)
|
|
126
|
+
return undefined;
|
|
127
|
+
return yield* findDependencyPackageRoot(ref, dependency, entrypoint);
|
|
128
|
+
});
|
|
129
|
+
const findDependencyPackageRoot = (ref, dependency, entrypoint) => Effect.gen(function* () {
|
|
130
|
+
let cursor = dirname(entrypoint);
|
|
131
|
+
while (true) {
|
|
132
|
+
if (yield* isFile(resolve(cursor, "package.json"))) {
|
|
133
|
+
return yield* realpathDependency(ref, dependency, cursor);
|
|
134
|
+
}
|
|
135
|
+
const parent = dirname(cursor);
|
|
136
|
+
if (parent === cursor)
|
|
137
|
+
return undefined;
|
|
138
|
+
cursor = parent;
|
|
139
|
+
}
|
|
140
|
+
});
|
|
141
|
+
const readTextFile = (ref, target, message) => Effect.tryPromise({
|
|
142
|
+
try: () => readFile(target, "utf8"),
|
|
143
|
+
catch: (cause) => new ProjectModuleLoadError({
|
|
144
|
+
refId: ref.id,
|
|
145
|
+
target,
|
|
146
|
+
message,
|
|
147
|
+
cause,
|
|
148
|
+
}),
|
|
149
|
+
});
|
|
150
|
+
const writeMaterializedFile = (ref, file, destination, content) => Effect.tryPromise({
|
|
151
|
+
try: () => writeFile(destination, content),
|
|
152
|
+
catch: (cause) => new ProjectModuleLoadError({
|
|
153
|
+
refId: ref.id,
|
|
154
|
+
target: destination,
|
|
155
|
+
message: `Failed to write materialized project module source ${file.sourceRef}`,
|
|
156
|
+
cause,
|
|
157
|
+
}),
|
|
158
|
+
});
|
|
159
|
+
const realpathDependency = (ref, dependency, target) => realpathOrProjectModuleLoadError(ref, target, dependency, `Failed to resolve project module dependency ${dependency}`);
|
|
160
|
+
const symlinkDependency = (ref, dependency, dependencyRoot, destination) => Effect.tryPromise({
|
|
161
|
+
try: () => symlink(dependencyRoot, destination, "dir"),
|
|
162
|
+
catch: (cause) => new ProjectModuleLoadError({
|
|
163
|
+
refId: ref.id,
|
|
164
|
+
target: destination,
|
|
165
|
+
message: `Failed to link project module dependency ${dependency} into materialized module cache`,
|
|
166
|
+
cause,
|
|
167
|
+
}),
|
|
168
|
+
});
|
|
169
|
+
const escapedSourceRootError = (ref, target) => new ProjectModuleLoadError({
|
|
170
|
+
refId: ref.id,
|
|
171
|
+
target,
|
|
172
|
+
message: `Project module ${ref.id} source file escaped its owned source root while materializing`,
|
|
173
|
+
});
|
|
174
|
+
const escapedMaterializedRootError = (ref, target) => new ProjectModuleLoadError({
|
|
175
|
+
refId: ref.id,
|
|
176
|
+
target,
|
|
177
|
+
message: `Project module ${ref.id} source file escaped its materialized source root`,
|
|
178
|
+
});
|
|
179
|
+
//# sourceMappingURL=loader-materialize.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"loader-materialize.js","sourceRoot":"","sources":["../src/loader-materialize.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AACxC,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAC3C,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AAC/D,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACtD,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAC/B,OAAO,EAAE,0BAA0B,EAAE,MAAM,8BAA8B,CAAA;AACzE,OAAO,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAA;AAE1D,OAAO,EAAE,+BAA+B,EAAE,MAAM,oBAAoB,CAAA;AACpE,OAAO,EAAE,8BAA8B,EAAE,MAAM,gBAAgB,CAAA;AAE/D,OAAO,EAAE,gCAAgC,EAAE,MAAM,sBAAsB,CAAA;AACvE,OAAO,EACL,MAAM,EACN,WAAW,EACX,aAAa,EACb,YAAY,EACZ,QAAQ,EACR,sBAAsB,EACtB,yBAAyB,GAC1B,MAAM,mBAAmB,CAAA;AAE1B,MAAM,CAAC,MAAM,oCAAoC,GAAG,CAClD,GAAqB,EACrB,MAAc,EACd,UAAkB,EAClB,QAAgB,EAChB,cAAsB,EACtB,iBAAyB,EACzB,KAA6C,EAC7C,kBAAyC,EACzC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;IACN,OAAO,EAAE,kBAAkB,GAAG,CAAC,EAAE,gEAAgE;CAClG,CAAC,CAAA;AAEJ,MAAM,4BAA4B,GAAG,CACnC,GAAqB,EACrB,MAAc,EACU,EAAE,CAC1B,IAAI,sBAAsB,CAAC;IACzB,KAAK,EAAE,GAAG,CAAC,EAAE;IACb,MAAM;IACN,OAAO,EAAE,kBAAkB,GAAG,CAAC,EAAE,mDAAmD;CACrF,CAAC,CAAA"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Effect } from "effect";
|
|
2
|
+
export declare const isRecord: (value: unknown) => value is Record<string, unknown>;
|
|
3
|
+
export declare const isPathInside: (parent: string, child: string) => boolean;
|
|
4
|
+
export declare const isPackageName: (value: string) => boolean;
|
|
5
|
+
export declare const nearestNodeModulesRoot: (path: string) => string | undefined;
|
|
6
|
+
export declare const safeSourceFingerprintPath: (sourceFingerprint: string) => string;
|
|
7
|
+
export declare const isFile: (path: string) => Effect.Effect<boolean, never>;
|
|
8
|
+
export declare const isDirectory: (path: string) => Effect.Effect<boolean, never>;
|
|
9
|
+
export declare const realFileOption: (path: string) => Effect.Effect<string | undefined, never>;
|
|
10
|
+
export declare const realpathOption: (path: string) => Effect.Effect<string | undefined, never>;
|
|
11
|
+
export declare const toSourceRef: (path: string) => string;
|
|
12
|
+
export declare const withSourceFingerprintQuery: (url: string, sourceFingerprint: string) => string;
|
|
13
|
+
//# sourceMappingURL=loader-paths.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"loader-paths.d.ts","sourceRoot":"","sources":["../src/loader-paths.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAE/B,eAAO,MAAM,QAAQ,GAAI,OAAO,OAAO,KAAG,KAAK,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAC5B,CAAA;AAE7C,eAAO,MAAM,YAAY,GAAI,QAAQ,MAAM,EAAE,OAAO,MAAM,KAAG,OAG5D,CAAA;AAED,eAAO,MAAM,aAAa,GAAI,OAAO,MAAM,KAAG,OACoB,CAAA;AAElE,eAAO,MAAM,sBAAsB,GAAI,MAAM,MAAM,KAAG,MAAM,GAAG,SAK9D,CAAA;AAED,eAAO,MAAM,yBAAyB,GAAI,mBAAmB,MAAM,KAAG,MAClB,CAAA;AAEpD,eAAO,MAAM,MAAM,GAAI,MAAM,MAAM,KAAG,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE,KAAK,CAO9D,CAAA;AAEJ,eAAO,MAAM,WAAW,GAAI,MAAM,MAAM,KAAG,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE,KAAK,CAOnE,CAAA;AAEJ,eAAO,MAAM,cAAc,GAAI,MAAM,MAAM,KAAG,MAAM,CAAC,MAAM,CAAC,MAAM,GAAG,SAAS,EAAE,KAAK,CASjF,CAAA;AAEJ,eAAO,MAAM,cAAc,GAAI,MAAM,MAAM,KAAG,MAAM,CAAC,MAAM,CAAC,MAAM,GAAG,SAAS,EAAE,KAAK,CAOjF,CAAA;AAEJ,eAAO,MAAM,WAAW,GAAI,MAAM,MAAM,KAAG,MAAmC,CAAA;AAE9E,eAAO,MAAM,0BAA0B,GACrC,KAAK,MAAM,EACX,mBAAmB,MAAM,KACxB,MAIF,CAAA"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { isAbsolute, relative, sep } from "node:path";
|
|
2
|
+
import { stat, realpath } from "node:fs/promises";
|
|
3
|
+
import { Effect } from "effect";
|
|
4
|
+
export const isRecord = (value) => value !== null && typeof value === "object";
|
|
5
|
+
export const isPathInside = (parent, child) => {
|
|
6
|
+
const path = relative(parent, child);
|
|
7
|
+
return path === "" || (!path.startsWith("..") && !isAbsolute(path));
|
|
8
|
+
};
|
|
9
|
+
export const isPackageName = (value) => /^(?:@[a-z0-9][a-z0-9._-]*\/)?[a-z0-9][a-z0-9._-]*$/.test(value);
|
|
10
|
+
export const nearestNodeModulesRoot = (path) => {
|
|
11
|
+
const parts = path.split(sep);
|
|
12
|
+
const index = parts.lastIndexOf("node_modules");
|
|
13
|
+
if (index < 0)
|
|
14
|
+
return undefined;
|
|
15
|
+
return parts.slice(0, index + 1).join(sep) || sep;
|
|
16
|
+
};
|
|
17
|
+
export const safeSourceFingerprintPath = (sourceFingerprint) => sourceFingerprint.replace(/[^a-zA-Z0-9._-]/g, "-");
|
|
18
|
+
export const isFile = (path) => Effect.promise(async () => {
|
|
19
|
+
try {
|
|
20
|
+
return (await stat(path)).isFile();
|
|
21
|
+
}
|
|
22
|
+
catch {
|
|
23
|
+
return false;
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
export const isDirectory = (path) => Effect.promise(async () => {
|
|
27
|
+
try {
|
|
28
|
+
return (await stat(path)).isDirectory();
|
|
29
|
+
}
|
|
30
|
+
catch {
|
|
31
|
+
return false;
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
export const realFileOption = (path) => Effect.promise(async () => {
|
|
35
|
+
try {
|
|
36
|
+
const fileStat = await stat(path);
|
|
37
|
+
if (!fileStat.isFile())
|
|
38
|
+
return undefined;
|
|
39
|
+
return await realpath(path);
|
|
40
|
+
}
|
|
41
|
+
catch {
|
|
42
|
+
return undefined;
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
export const realpathOption = (path) => Effect.promise(async () => {
|
|
46
|
+
try {
|
|
47
|
+
return await realpath(path);
|
|
48
|
+
}
|
|
49
|
+
catch {
|
|
50
|
+
return undefined;
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
export const toSourceRef = (path) => path.split(sep).join("/");
|
|
54
|
+
export const withSourceFingerprintQuery = (url, sourceFingerprint) => {
|
|
55
|
+
const parsed = new URL(url);
|
|
56
|
+
parsed.searchParams.set("tasteModuleSource", sourceFingerprint);
|
|
57
|
+
return parsed.href;
|
|
58
|
+
};
|
|
59
|
+
//# sourceMappingURL=loader-paths.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file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AC,MAAM,CAAC;QACP,OAAO,SAAS,CAAA;IAClB,CAAC;AACH,CAAC,CAAC,CAAA;AAEJ,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,IAAY,EAAU,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;AAE9E,MAAM,CAAC,MAAM,0BAA0B,GAAG,CACxC,GAAW,EACX,iBAAyB,EACjB,EAAE;IACV,MAAM,MAAM,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,CAAA;IAC3B,MAAM,CAAC,YAAY,CAAC,GAAG,CAAC,mBAAmB,EAAE,iBAAiB,CAAC,CAAA;IAC/D,OAAO,MAAM,CAAC,IAAI,CAAA;AACpB,CAAC,CAAA"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Effect } from "effect";
|
|
2
|
+
import { ProjectModuleLoadError } from "./loader-types.js";
|
|
3
|
+
import type { ProjectModuleRef } from "./manifest.js";
|
|
4
|
+
export declare const realpathOrProjectModuleLoadError: (ref: ProjectModuleRef, path: string, target: string, message: string) => Effect.Effect<string, ProjectModuleLoadError>;
|
|
5
|
+
//# sourceMappingURL=loader-realpath.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"loader-realpath.d.ts","sourceRoot":"","sources":["../src/loader-realpath.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAC/B,OAAO,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAA;AAC1D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAA;AAErD,eAAO,MAAM,gCAAgC,GAC3C,KAAK,gBAAgB,EACrB,MAAM,MAAM,EACZ,QAAQ,MAAM,EACd,SAAS,MAAM,KACd,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,sBAAsB,CAU3C,CAAA"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { realpath } from "node:fs/promises";
|
|
2
|
+
import { Effect } from "effect";
|
|
3
|
+
import { ProjectModuleLoadError } from "./loader-types.js";
|
|
4
|
+
export const realpathOrProjectModuleLoadError = (ref, path, target, message) => Effect.tryPromise({
|
|
5
|
+
try: () => realpath(path),
|
|
6
|
+
catch: (cause) => new ProjectModuleLoadError({
|
|
7
|
+
refId: ref.id,
|
|
8
|
+
target,
|
|
9
|
+
message,
|
|
10
|
+
cause,
|
|
11
|
+
}),
|
|
12
|
+
});
|
|
13
|
+
//# sourceMappingURL=loader-realpath.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"loader-realpath.js","sourceRoot":"","sources":["../src/loader-realpath.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAA;AAC3C,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAC/B,OAAO,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAA;AAG1D,MAAM,CAAC,MAAM,gCAAgC,GAAG,CAC9C,GAAqB,EACrB,IAAY,EACZ,MAAc,EACd,OAAe,EACgC,EAAE,CACjD,MAAM,CAAC,UAAU,CAAC;IAChB,GAAG,EAAE,GAAG,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC;IACzB,KAAK,EAAE,CAAC,KAAK,EAAE,EAAE,CACf,IAAI,sBAAsB,CAAC;QACzB,KAAK,EAAE,GAAG,CAAC,EAAE;QACb,MAAM;QACN,OAAO;QACP,KAAK;KACN,CAAC;CACL,CAAC,CAAA"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Effect } from "effect";
|
|
2
|
+
import type { ProjectModuleDescriptor } from "@skastr0/pulsar-core/calibration";
|
|
3
|
+
import { ProjectModuleLoadError, type ProjectModuleLoadOptions } from "./loader-types.js";
|
|
4
|
+
import type { ProjectModuleRef } from "./manifest.js";
|
|
5
|
+
export interface ResolvedProjectModuleTarget {
|
|
6
|
+
readonly target: string;
|
|
7
|
+
readonly source: ProjectModuleDescriptor["source"];
|
|
8
|
+
readonly sourceRef: string;
|
|
9
|
+
readonly sourceFingerprint: string;
|
|
10
|
+
}
|
|
11
|
+
export declare const resolveProjectModuleRefTarget: (ref: ProjectModuleRef, options: ProjectModuleLoadOptions) => Effect.Effect<ResolvedProjectModuleTarget, ProjectModuleLoadError>;
|
|
12
|
+
//# sourceMappingURL=loader-resolution.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"loader-resolution.d.ts","sourceRoot":"","sources":["../src/loader-resolution.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAC/B,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,kCAAkC,CAAA;AAC/E,OAAO,EACL,sBAAsB,EACtB,KAAK,wBAAwB,EAC9B,MAAM,mBAAmB,CAAA;AAC1B,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAA;AAerD,MAAM,WAAW,2BAA2B;IAC1C,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;IACvB,QAAQ,CAAC,MAAM,EAAE,uBAAuB,CAAC,QAAQ,CAAC,CAAA;IAClD,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;IAC1B,QAAQ,CAAC,iBAAiB,EAAE,MAAM,CAAA;CACnC;AAOD,eAAO,MAAM,6BAA6B,GACxC,KAAK,gBAAgB,EACrB,SAAS,wBAAwB,KAChC,MAAM,CAAC,MAAM,CAAC,2BAA2B,EAAE,sBAAsB,CAQnE,CAAA"}
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
import { createRequire } from "node:module";
|
|
2
|
+
import { dirname, isAbsolute, relative, resolve } from "node:path";
|
|
3
|
+
import { readFile, realpath } from "node:fs/promises";
|
|
4
|
+
import { pathToFileURL } from "node:url";
|
|
5
|
+
import { Effect } from "effect";
|
|
6
|
+
import { ProjectModuleLoadError, } from "./loader-types.js";
|
|
7
|
+
import { hashProjectModuleSource, materializeProjectModuleImportTarget } from "./loader-materialize.js";
|
|
8
|
+
import { realpathOrProjectModuleLoadError } from "./loader-realpath.js";
|
|
9
|
+
import { collectProjectModuleSourceFiles } from "./loader-source-files.js";
|
|
10
|
+
import { isFile, isPackageName, isPathInside, isRecord, realpathOption, toSourceRef, withSourceFingerprintQuery, } from "./loader-paths.js";
|
|
11
|
+
export const resolveProjectModuleRefTarget = (ref, options) => {
|
|
12
|
+
switch (ref.kind) {
|
|
13
|
+
case "repo-local":
|
|
14
|
+
return resolveRepoLocalProjectModuleTarget(ref, options);
|
|
15
|
+
case "workspace":
|
|
16
|
+
case "package":
|
|
17
|
+
return resolvePackageProjectModuleTarget(ref, options.repoRoot);
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
const resolveRepoLocalProjectModuleTarget = (ref, options) => Effect.gen(function* () {
|
|
21
|
+
if (isAbsolute(ref.path)) {
|
|
22
|
+
return yield* new ProjectModuleLoadError({
|
|
23
|
+
refId: ref.id,
|
|
24
|
+
target: ref.path,
|
|
25
|
+
message: `Repo-local project module ${ref.id} must use a relative path`,
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
const repoRoot = yield* Effect.tryPromise({
|
|
29
|
+
try: () => realpath(options.repoRoot),
|
|
30
|
+
catch: (cause) => new ProjectModuleLoadError({
|
|
31
|
+
refId: ref.id,
|
|
32
|
+
target: options.repoRoot,
|
|
33
|
+
message: `Failed to resolve repository root for project module ${ref.id}`,
|
|
34
|
+
cause,
|
|
35
|
+
}),
|
|
36
|
+
});
|
|
37
|
+
const targetPath = resolve(repoRoot, ref.path);
|
|
38
|
+
const target = yield* realpathOrLoadError(ref, targetPath, "repo-local project module");
|
|
39
|
+
if (!isPathInside(repoRoot, target)) {
|
|
40
|
+
return yield* new ProjectModuleLoadError({
|
|
41
|
+
refId: ref.id,
|
|
42
|
+
target,
|
|
43
|
+
message: `Repo-local project module ${ref.id} resolves outside the repository root`,
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
const files = yield* collectProjectModuleSourceFiles(ref, target, repoRoot, (path) => toSourceRef(relative(repoRoot, path)));
|
|
47
|
+
const sourceFingerprint = yield* hashProjectModuleSource(ref, target, files);
|
|
48
|
+
const importTarget = yield* materializeProjectModuleImportTarget(ref, target, repoRoot, repoRoot, options.dependencyRoot ?? repoRoot, sourceFingerprint, files, ["repo"], true);
|
|
49
|
+
return {
|
|
50
|
+
target: withSourceFingerprintQuery(pathToFileURL(importTarget).href, sourceFingerprint),
|
|
51
|
+
source: "repo-local",
|
|
52
|
+
sourceRef: ref.path,
|
|
53
|
+
sourceFingerprint,
|
|
54
|
+
};
|
|
55
|
+
});
|
|
56
|
+
const resolvePackageProjectModuleTarget = (ref, repoRoot) => Effect.gen(function* () {
|
|
57
|
+
const packageName = ref.packageName;
|
|
58
|
+
if (!isPackageName(packageName)) {
|
|
59
|
+
return yield* new ProjectModuleLoadError({
|
|
60
|
+
refId: ref.id,
|
|
61
|
+
target: packageName,
|
|
62
|
+
message: `Project module package ref ${packageName} is not a valid package name`,
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
const resolvedRepoRoot = yield* realpathOrLoadError(ref, repoRoot, "repository root");
|
|
66
|
+
const packagePath = yield* Effect.try({
|
|
67
|
+
try: () => createRequire(resolve(resolvedRepoRoot, "package.json")).resolve(packageName),
|
|
68
|
+
catch: (cause) => new ProjectModuleLoadError({
|
|
69
|
+
refId: ref.id,
|
|
70
|
+
target: packageName,
|
|
71
|
+
message: `Failed to resolve project module package ${packageName} from repository root`,
|
|
72
|
+
cause,
|
|
73
|
+
}),
|
|
74
|
+
});
|
|
75
|
+
const target = yield* realpathOrLoadError(ref, packagePath, "project module package artifact");
|
|
76
|
+
const packageTarget = yield* resolveOwnedProjectModulePackageTarget(ref, target, resolvedRepoRoot);
|
|
77
|
+
const files = yield* collectProjectModuleSourceFiles(ref, packageTarget.target, packageTarget.packageRoot, (path) => toSourceRef(`${packageName}/${relative(packageTarget.packageRoot, path)}`));
|
|
78
|
+
const sourceFingerprint = yield* hashProjectModuleSource(ref, packageTarget.target, files);
|
|
79
|
+
const importTarget = yield* materializeProjectModuleImportTarget(ref, packageTarget.target, packageTarget.packageRoot, resolvedRepoRoot, packageTarget.packageRoot, sourceFingerprint, files, ["node_modules", ...packageName.split("/")], false);
|
|
80
|
+
return {
|
|
81
|
+
target: withSourceFingerprintQuery(pathToFileURL(importTarget).href, sourceFingerprint),
|
|
82
|
+
source: ref.kind,
|
|
83
|
+
sourceRef: packageName,
|
|
84
|
+
sourceFingerprint,
|
|
85
|
+
};
|
|
86
|
+
});
|
|
87
|
+
const resolveOwnedProjectModulePackageTarget = (ref, target, repoRoot) => Effect.gen(function* () {
|
|
88
|
+
const packageRoot = yield* findProjectModulePackageRoot(ref, target);
|
|
89
|
+
yield* verifyProjectModulePackageName(ref, target, packageRoot);
|
|
90
|
+
if (ref.kind === "workspace") {
|
|
91
|
+
if (!isPathInside(repoRoot, packageRoot)) {
|
|
92
|
+
return yield* new ProjectModuleLoadError({
|
|
93
|
+
refId: ref.id,
|
|
94
|
+
target,
|
|
95
|
+
message: `Workspace project module ${ref.packageName} must resolve inside the repository root`,
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
else {
|
|
100
|
+
const packageIsInRepo = isPathInside(repoRoot, packageRoot);
|
|
101
|
+
const packageIsRepoInstall = yield* isRepoOwnedInstalledPackage(ref, repoRoot, packageRoot);
|
|
102
|
+
if (!packageIsInRepo && !packageIsRepoInstall) {
|
|
103
|
+
return yield* new ProjectModuleLoadError({
|
|
104
|
+
refId: ref.id,
|
|
105
|
+
target,
|
|
106
|
+
message: `Package project module ${ref.packageName} must resolve from the repository package graph`,
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
return {
|
|
111
|
+
target,
|
|
112
|
+
packageRoot,
|
|
113
|
+
};
|
|
114
|
+
});
|
|
115
|
+
const findProjectModulePackageRoot = (ref, target) => Effect.gen(function* () {
|
|
116
|
+
let cursor = dirname(target);
|
|
117
|
+
while (true) {
|
|
118
|
+
if (yield* isFile(resolve(cursor, "package.json"))) {
|
|
119
|
+
return yield* realpathOrLoadError(ref, cursor, "project module package root");
|
|
120
|
+
}
|
|
121
|
+
const parent = dirname(cursor);
|
|
122
|
+
if (parent === cursor) {
|
|
123
|
+
return yield* new ProjectModuleLoadError({
|
|
124
|
+
refId: ref.id,
|
|
125
|
+
target,
|
|
126
|
+
message: `Failed to locate package.json for project module package ${ref.packageName}`,
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
cursor = parent;
|
|
130
|
+
}
|
|
131
|
+
});
|
|
132
|
+
const verifyProjectModulePackageName = (ref, target, packageRoot) => Effect.gen(function* () {
|
|
133
|
+
const packageJsonPath = resolve(packageRoot, "package.json");
|
|
134
|
+
const packageJson = yield* readTextOrLoadError(ref, target, packageJsonPath, "manifest");
|
|
135
|
+
const parsed = yield* Effect.try({
|
|
136
|
+
try: () => JSON.parse(packageJson),
|
|
137
|
+
catch: (cause) => new ProjectModuleLoadError({
|
|
138
|
+
refId: ref.id,
|
|
139
|
+
target,
|
|
140
|
+
message: `Failed to parse project module package manifest ${ref.packageName}`,
|
|
141
|
+
cause,
|
|
142
|
+
}),
|
|
143
|
+
});
|
|
144
|
+
const name = isRecord(parsed) ? parsed.name : undefined;
|
|
145
|
+
if (name !== ref.packageName) {
|
|
146
|
+
return yield* new ProjectModuleLoadError({
|
|
147
|
+
refId: ref.id,
|
|
148
|
+
target,
|
|
149
|
+
message: `Project module package ${ref.packageName} resolved to package manifest for ${String(name)}`,
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
});
|
|
153
|
+
const isRepoOwnedInstalledPackage = (ref, repoRoot, packageRoot) => Effect.gen(function* () {
|
|
154
|
+
const installedPackageRoot = resolve(repoRoot, "node_modules", ref.packageName);
|
|
155
|
+
const installedPackageRealpath = yield* realpathOption(installedPackageRoot);
|
|
156
|
+
return installedPackageRealpath === packageRoot;
|
|
157
|
+
});
|
|
158
|
+
const realpathOrLoadError = (ref, path, label) => realpathOrProjectModuleLoadError(ref, path, path, `Failed to resolve ${label} for project module ${ref.id}`);
|
|
159
|
+
const readTextOrLoadError = (ref, target, path, label) => Effect.tryPromise({
|
|
160
|
+
try: () => readFile(path, "utf8"),
|
|
161
|
+
catch: (cause) => new ProjectModuleLoadError({
|
|
162
|
+
refId: ref.id,
|
|
163
|
+
target,
|
|
164
|
+
message: `Failed to read project module package ${label} ${ref.id}`,
|
|
165
|
+
cause,
|
|
166
|
+
}),
|
|
167
|
+
});
|
|
168
|
+
//# sourceMappingURL=loader-resolution.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"loader-resolution.js","sourceRoot":"","sources":["../src/loader-resolution.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAC3C,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAClE,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAA;AACrD,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AACxC,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAE/B,OAAO,EACL,sBAAsB,GAEvB,MAAM,mBAAmB,CAAA;AAE1B,OAAO,EAAE,uBAAuB,EAAE,oCAAoC,EAAE,MAAM,yBAAyB,CAAA;AACvG,OAAO,EAAE,gCAAgC,EAAE,MAAM,sBAAsB,CAAA;AACvE,OAAO,EAAE,+BAA+B,EAAE,MAAM,0BAA0B,CAAA;AAC1E,OAAO,EACL,MAAM,EACN,aAAa,EACb,YAAY,EACZ,QAAQ,EAER,cAAc,EACd,WAAW,EACX,0BAA0B,GAC3B,MAAM,mBAAmB,CAAA;AAc1B,MAAM,CAAC,MAAM,6BAA6B,GAAG,CAC3C,GAAq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Z,KAAa,EACkC,EAAE,CACjD,gCAAgC,CAC9B,GAAG,EACH,IAAI,EACJ,IAAI,EACJ,qBAAqB,KAAK,uBAAuB,GAAG,CAAC,EAAE,EAAE,CAC1D,CAAA;AAEH,MAAM,mBAAmB,GAAG,CAC1B,GAAqB,EACrB,MAAc,EACd,IAAY,EACZ,KAAa,EACkC,EAAE,CACjD,MAAM,CAAC,UAAU,CAAC;IAChB,GAAG,EAAE,GAAG,EAAE,CAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACjC,KAAK,EAAE,CAAC,KAAK,EAAE,EAAE,CACf,IAAI,sBAAsB,CAAC;QACzB,KAAK,EAAE,GAAG,CAAC,EAAE;QACb,MAAM;QACN,OAAO,EAAE,yCAAyC,KAAK,IAAI,GAAG,CAAC,EAAE,EAAE;QACnE,KAAK;KACN,CAAC;CACL,CAAC,CAAA"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Effect } from "effect";
|
|
2
|
+
import { ProjectModuleLoadError } from "./loader-types.js";
|
|
3
|
+
import type { ProjectModuleRef } from "./manifest.js";
|
|
4
|
+
export interface ProjectModuleSourceFile {
|
|
5
|
+
readonly sourceRef: string;
|
|
6
|
+
readonly path: string;
|
|
7
|
+
}
|
|
8
|
+
export declare const collectProjectModuleSourceFiles: (ref: ProjectModuleRef, target: string, sourceRoot: string, sourceRefForPath: (path: string) => string) => Effect.Effect<ReadonlyArray<ProjectModuleSourceFile>, ProjectModuleLoadError>;
|
|
9
|
+
//# sourceMappingURL=loader-source-files.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"loader-source-files.d.ts","sourceRoot":"","sources":["../src/loader-source-files.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAE/B,OAAO,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAA;AAC1D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAA;AAQrD,MAAM,WAAW,uBAAuB;IACtC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;IAC1B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CACtB;AAaD,eAAO,MAAM,+BAA+B,GAC1C,KAAK,gBAAgB,EACrB,QAAQ,MAAM,EACd,YAAY,MAAM,EAClB,kBAAkB,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,KACzC,MAAM,CAAC,MAAM,CAAC,aAAa,CAAC,uBAAuB,CAAC,EAAE,sBAAsB,CAqD3E,CAAA"}
|