@isentinel/rojo-utils 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/CLAUDE.md +40 -0
- package/coverage/base.css +224 -0
- package/coverage/block-navigation.js +87 -0
- package/coverage/clover.xml +388 -0
- package/coverage/coverage-final.json +7 -0
- package/coverage/favicon.png +0 -0
- package/coverage/index.html +191 -0
- package/coverage/loader.ts.html +220 -0
- package/coverage/mount-collector.ts.html +301 -0
- package/coverage/path-mapper.ts.html +220 -0
- package/coverage/prettify.css +1 -0
- package/coverage/prettify.js +2 -0
- package/coverage/rojo-resolver.ts.html +1900 -0
- package/coverage/rojo-tree.ts.html +559 -0
- package/coverage/sort-arrow-sprite.png +0 -0
- package/coverage/sorter.js +210 -0
- package/coverage/tree-mapper.ts.html +247 -0
- package/dist/index.d.mts +175 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +551 -0
- package/dist/index.mjs.map +1 -0
- package/eslint.config.ts +23 -0
- package/out-tsc/index.d.ts +10 -0
- package/out-tsc/index.d.ts.map +1 -0
- package/out-tsc/index.js +6 -0
- package/out-tsc/loader.d.ts +3 -0
- package/out-tsc/loader.d.ts.map +1 -0
- package/out-tsc/loader.js +37 -0
- package/out-tsc/mount-collector.d.ts +10 -0
- package/out-tsc/mount-collector.d.ts.map +1 -0
- package/out-tsc/mount-collector.js +37 -0
- package/out-tsc/path-mapper.d.ts +4 -0
- package/out-tsc/path-mapper.d.ts.map +1 -0
- package/out-tsc/path-mapper.js +34 -0
- package/out-tsc/rojo-resolver.d.ts +110 -0
- package/out-tsc/rojo-resolver.d.ts.map +1 -0
- package/out-tsc/rojo-resolver.js +448 -0
- package/out-tsc/rojo-tree.d.ts +15 -0
- package/out-tsc/rojo-tree.d.ts.map +1 -0
- package/out-tsc/rojo-tree.js +106 -0
- package/out-tsc/tree-mapper.d.ts +4 -0
- package/out-tsc/tree-mapper.d.ts.map +1 -0
- package/out-tsc/tree-mapper.js +34 -0
- package/out-tsc/tsconfig.tsbuildinfo +1 -0
- package/out-tsc/types.d.ts +26 -0
- package/out-tsc/types.d.ts.map +1 -0
- package/out-tsc/types.js +1 -0
- package/out-tsc/vitest/eslint.config.d.ts +3 -0
- package/out-tsc/vitest/eslint.config.d.ts.map +1 -0
- package/out-tsc/vitest/eslint.shared.d.ts +13 -0
- package/out-tsc/vitest/eslint.shared.d.ts.map +1 -0
- package/out-tsc/vitest/libs/rojo-utils/eslint.config.d.ts +3 -0
- package/out-tsc/vitest/libs/rojo-utils/eslint.config.d.ts.map +1 -0
- package/out-tsc/vitest/libs/rojo-utils/src/loader.spec.d.ts +2 -0
- package/out-tsc/vitest/libs/rojo-utils/src/loader.spec.d.ts.map +1 -0
- package/out-tsc/vitest/libs/rojo-utils/src/mount-collector.spec.d.ts +2 -0
- package/out-tsc/vitest/libs/rojo-utils/src/mount-collector.spec.d.ts.map +1 -0
- package/out-tsc/vitest/libs/rojo-utils/src/path-mapper.spec.d.ts +2 -0
- package/out-tsc/vitest/libs/rojo-utils/src/path-mapper.spec.d.ts.map +1 -0
- package/out-tsc/vitest/libs/rojo-utils/src/rojo-resolver.spec.d.ts +2 -0
- package/out-tsc/vitest/libs/rojo-utils/src/rojo-resolver.spec.d.ts.map +1 -0
- package/out-tsc/vitest/libs/rojo-utils/src/rojo-tree.spec.d.ts +2 -0
- package/out-tsc/vitest/libs/rojo-utils/src/rojo-tree.spec.d.ts.map +1 -0
- package/out-tsc/vitest/libs/rojo-utils/src/tree-mapper.spec.d.ts +2 -0
- package/out-tsc/vitest/libs/rojo-utils/src/tree-mapper.spec.d.ts.map +1 -0
- package/out-tsc/vitest/libs/rojo-utils/test/setup/jest-extended.d.ts +2 -0
- package/out-tsc/vitest/libs/rojo-utils/test/setup/jest-extended.d.ts.map +1 -0
- package/out-tsc/vitest/libs/rojo-utils/tsconfig.spec.tsbuildinfo +1 -0
- package/out-tsc/vitest/libs/rojo-utils/tsdown.config.d.ts +3 -0
- package/out-tsc/vitest/libs/rojo-utils/tsdown.config.d.ts.map +1 -0
- package/out-tsc/vitest/libs/rojo-utils/vitest.config.d.ts +3 -0
- package/out-tsc/vitest/libs/rojo-utils/vitest.config.d.ts.map +1 -0
- package/out-tsc/vitest/src/loader.spec.d.ts +2 -0
- package/out-tsc/vitest/src/loader.spec.d.ts.map +1 -0
- package/out-tsc/vitest/src/mount-collector.spec.d.ts +2 -0
- package/out-tsc/vitest/src/mount-collector.spec.d.ts.map +1 -0
- package/out-tsc/vitest/src/path-mapper.spec.d.ts +2 -0
- package/out-tsc/vitest/src/path-mapper.spec.d.ts.map +1 -0
- package/out-tsc/vitest/src/rojo-resolver.spec.d.ts +2 -0
- package/out-tsc/vitest/src/rojo-resolver.spec.d.ts.map +1 -0
- package/out-tsc/vitest/src/rojo-tree.spec.d.ts +2 -0
- package/out-tsc/vitest/src/rojo-tree.spec.d.ts.map +1 -0
- package/out-tsc/vitest/src/tree-mapper.spec.d.ts +2 -0
- package/out-tsc/vitest/src/tree-mapper.spec.d.ts.map +1 -0
- package/out-tsc/vitest/test/setup/jest-extended.d.ts +2 -0
- package/out-tsc/vitest/test/setup/jest-extended.d.ts.map +1 -0
- package/out-tsc/vitest/tsconfig.spec.tsbuildinfo +1 -0
- package/out-tsc/vitest/tsdown.config.d.ts +3 -0
- package/out-tsc/vitest/tsdown.config.d.ts.map +1 -0
- package/out-tsc/vitest/vitest.config.d.ts +3 -0
- package/out-tsc/vitest/vitest.config.d.ts.map +1 -0
- package/package.json +48 -0
- package/project.json +25 -0
- package/src/index.ts +25 -0
- package/src/loader.spec.ts +240 -0
- package/src/loader.ts +45 -0
- package/src/mount-collector.spec.ts +272 -0
- package/src/mount-collector.ts +72 -0
- package/src/path-mapper.spec.ts +201 -0
- package/src/path-mapper.ts +45 -0
- package/src/rojo-resolver.spec.ts +956 -0
- package/src/rojo-resolver.ts +605 -0
- package/src/rojo-tree.spec.ts +622 -0
- package/src/rojo-tree.ts +162 -0
- package/src/tree-mapper.spec.ts +147 -0
- package/src/tree-mapper.ts +54 -0
- package/src/types.ts +29 -0
- package/test/setup/jest-extended.ts +4 -0
- package/test/setup/vitest-jest-extended.d.ts +1 -0
- package/tsconfig.json +13 -0
- package/tsconfig.lib.json +17 -0
- package/tsconfig.lib.tsbuildinfo +1 -0
- package/tsconfig.spec.json +26 -0
- package/tsdown.config.ts +15 -0
- package/vitest.config.ts +20 -0
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export { loadRojoProject } from "./loader.ts";
|
|
2
|
+
export { collectMounts, pruneAncestors } from "./mount-collector.ts";
|
|
3
|
+
export type { Mount, PathClassifier, PathKind } from "./mount-collector.ts";
|
|
4
|
+
export { mapFsPathToDataModel, mapFsRootToDataModel } from "./path-mapper.ts";
|
|
5
|
+
export { FileRelation, NetworkType, RbxPathParent, RbxType, RojoResolver, } from "./rojo-resolver.ts";
|
|
6
|
+
export type { PartitionInfo, RbxPath, RelativeRbxPath, RojoResolverState, } from "./rojo-resolver.ts";
|
|
7
|
+
export { collectPaths, rebaseTreePaths, resolveNestedProjects, resolveNestedProjectSources, } from "./rojo-tree.ts";
|
|
8
|
+
export { findInTree, matchNodePath } from "./tree-mapper.ts";
|
|
9
|
+
export type { LoadedRojoProject, RojoProject, RojoTreeNode } from "./types.ts";
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACrE,YAAY,EAAE,KAAK,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAC5E,OAAO,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAC9E,OAAO,EACN,YAAY,EACZ,WAAW,EACX,aAAa,EACb,OAAO,EACP,YAAY,GACZ,MAAM,oBAAoB,CAAC;AAC5B,YAAY,EACX,aAAa,EACb,OAAO,EACP,eAAe,EACf,iBAAiB,GACjB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACN,YAAY,EACZ,eAAe,EACf,qBAAqB,EACrB,2BAA2B,GAC3B,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAC7D,YAAY,EAAE,iBAAiB,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC"}
|
package/out-tsc/index.js
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { loadRojoProject } from "./loader.js";
|
|
2
|
+
export { collectMounts, pruneAncestors } from "./mount-collector.js";
|
|
3
|
+
export { mapFsPathToDataModel, mapFsRootToDataModel } from "./path-mapper.js";
|
|
4
|
+
export { FileRelation, NetworkType, RbxPathParent, RbxType, RojoResolver, } from "./rojo-resolver.js";
|
|
5
|
+
export { collectPaths, rebaseTreePaths, resolveNestedProjects, resolveNestedProjectSources, } from "./rojo-tree.js";
|
|
6
|
+
export { findInTree, matchNodePath } from "./tree-mapper.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../src/loader.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,iBAAiB,EAAgB,MAAM,YAAY,CAAC;AAElE,wBAAgB,eAAe,CAAC,WAAW,EAAE,MAAM,GAAG,iBAAiB,CAsCtE"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { readFileSync } from "node:fs";
|
|
2
|
+
import { dirname } from "node:path";
|
|
3
|
+
import { resolveNestedProjects } from "./rojo-tree.js";
|
|
4
|
+
export function loadRojoProject(projectPath) {
|
|
5
|
+
let content;
|
|
6
|
+
try {
|
|
7
|
+
content = readFileSync(projectPath, "utf-8");
|
|
8
|
+
}
|
|
9
|
+
catch (err) {
|
|
10
|
+
throw new Error(`Could not read Rojo project: ${projectPath}`, { cause: err });
|
|
11
|
+
}
|
|
12
|
+
let parsed;
|
|
13
|
+
try {
|
|
14
|
+
parsed = JSON.parse(content);
|
|
15
|
+
}
|
|
16
|
+
catch (err) {
|
|
17
|
+
throw new Error(`Failed to parse Rojo project: ${projectPath}`, { cause: err });
|
|
18
|
+
}
|
|
19
|
+
if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed)) {
|
|
20
|
+
throw new Error(`Rojo project must be a JSON object: ${projectPath}`);
|
|
21
|
+
}
|
|
22
|
+
const raw = parsed;
|
|
23
|
+
if (typeof raw["name"] !== "string" || raw["name"] === "") {
|
|
24
|
+
throw new Error(`Rojo project must have a non-empty "name" field: ${projectPath}`);
|
|
25
|
+
}
|
|
26
|
+
if (typeof raw["tree"] !== "object" || raw["tree"] === null || Array.isArray(raw["tree"])) {
|
|
27
|
+
throw new Error(`Rojo project must have a "tree" object: ${projectPath}`);
|
|
28
|
+
}
|
|
29
|
+
const rootDirectory = dirname(projectPath);
|
|
30
|
+
const tree = resolveNestedProjects(raw["tree"], rootDirectory);
|
|
31
|
+
return {
|
|
32
|
+
name: raw["name"],
|
|
33
|
+
raw,
|
|
34
|
+
servePort: typeof raw["servePort"] === "number" ? raw["servePort"] : undefined,
|
|
35
|
+
tree,
|
|
36
|
+
};
|
|
37
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { RojoTreeNode } from "./types.ts";
|
|
2
|
+
export type PathKind = "directory" | "file" | "missing";
|
|
3
|
+
export type PathClassifier = (fsPath: string) => PathKind;
|
|
4
|
+
export interface Mount {
|
|
5
|
+
dataModelPath: string;
|
|
6
|
+
fsPath: string;
|
|
7
|
+
}
|
|
8
|
+
export declare function collectMounts(node: RojoTreeNode, currentDataModelPath: string, classify: PathClassifier): Array<Mount>;
|
|
9
|
+
export declare function pruneAncestors(paths: Array<string>): Array<string>;
|
|
10
|
+
//# sourceMappingURL=mount-collector.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mount-collector.d.ts","sourceRoot":"","sources":["../src/mount-collector.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE/C,MAAM,MAAM,QAAQ,GAAG,WAAW,GAAG,MAAM,GAAG,SAAS,CAAC;AAExD,MAAM,MAAM,cAAc,GAAG,CAAC,MAAM,EAAE,MAAM,KAAK,QAAQ,CAAC;AAE1D,MAAM,WAAW,KAAK;IACrB,aAAa,EAAE,MAAM,CAAC;IACtB,MAAM,EAAE,MAAM,CAAC;CACf;AAID,wBAAgB,aAAa,CAC5B,IAAI,EAAE,YAAY,EAClB,oBAAoB,EAAE,MAAM,EAC5B,QAAQ,EAAE,cAAc,GACtB,KAAK,CAAC,KAAK,CAAC,CAId;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,GAAG,KAAK,CAAC,MAAM,CAAC,CAIlE"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
const TrailingSlashPattern = /\/$/;
|
|
2
|
+
export function collectMounts(node, currentDataModelPath, classify) {
|
|
3
|
+
const result = [];
|
|
4
|
+
walk(node, currentDataModelPath, classify, result);
|
|
5
|
+
return result;
|
|
6
|
+
}
|
|
7
|
+
export function pruneAncestors(paths) {
|
|
8
|
+
return paths.filter((candidate) => {
|
|
9
|
+
return paths.every((other) => other === candidate || !candidate.startsWith(`${other}/`));
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
function addDirectoryMount(node, dataModelPath, classify, result) {
|
|
13
|
+
const rawPath = node.$path;
|
|
14
|
+
if (typeof rawPath !== "string") {
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
if (rawPath.endsWith(".project.json")) {
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
const fsPath = rawPath.replace(TrailingSlashPattern, "");
|
|
21
|
+
if (classify(fsPath) === "directory") {
|
|
22
|
+
result.push({ dataModelPath, fsPath });
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
function isTreeChild(value) {
|
|
26
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
27
|
+
}
|
|
28
|
+
function walk(node, currentDataModelPath, classify, result) {
|
|
29
|
+
for (const [key, value] of Object.entries(node)) {
|
|
30
|
+
if (key.startsWith("$") || !isTreeChild(value)) {
|
|
31
|
+
continue;
|
|
32
|
+
}
|
|
33
|
+
const childDataModelPath = currentDataModelPath === "" ? key : `${currentDataModelPath}/${key}`;
|
|
34
|
+
addDirectoryMount(value, childDataModelPath, classify, result);
|
|
35
|
+
walk(value, childDataModelPath, classify, result);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { RojoTreeNode } from "./types.ts";
|
|
2
|
+
export declare function mapFsRootToDataModel(outDirectory: string, rojoTree: RojoTreeNode): string;
|
|
3
|
+
export declare function mapFsPathToDataModel(fsPath: string, rojoTree: RojoTreeNode): string | undefined;
|
|
4
|
+
//# sourceMappingURL=path-mapper.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"path-mapper.d.ts","sourceRoot":"","sources":["../src/path-mapper.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAI/C,wBAAgB,oBAAoB,CAAC,YAAY,EAAE,MAAM,EAAE,QAAQ,EAAE,YAAY,GAAG,MAAM,CAgBzF;AAKD,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,YAAY,GAAG,MAAM,GAAG,SAAS,CAiB/F"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { collectPaths } from "./rojo-tree.js";
|
|
2
|
+
import { findInTree } from "./tree-mapper.js";
|
|
3
|
+
const TRAILING_SLASH = /\/$/;
|
|
4
|
+
export function mapFsRootToDataModel(outDirectory, rojoTree) {
|
|
5
|
+
const normalized = outDirectory.replace(TRAILING_SLASH, "");
|
|
6
|
+
const result = findInTree(rojoTree, normalized, "");
|
|
7
|
+
if (result === undefined) {
|
|
8
|
+
const available = [];
|
|
9
|
+
collectPaths(rojoTree, available);
|
|
10
|
+
let message = `No Rojo tree mapping found for path: ${normalized}`;
|
|
11
|
+
if (available.length > 0) {
|
|
12
|
+
message += `\n\nAvailable $path entries: ${available.join(", ")}`;
|
|
13
|
+
}
|
|
14
|
+
throw new Error(message);
|
|
15
|
+
}
|
|
16
|
+
return result;
|
|
17
|
+
}
|
|
18
|
+
const LUAU_EXTENSIONS = /\.luau?$/;
|
|
19
|
+
const INIT_SUFFIX = /\/init$/;
|
|
20
|
+
export function mapFsPathToDataModel(fsPath, rojoTree) {
|
|
21
|
+
const normalized = fsPath.replaceAll("\\", "/").replace(LUAU_EXTENSIONS, "");
|
|
22
|
+
const withoutInit = normalized.replace(INIT_SUFFIX, "");
|
|
23
|
+
const rootPath = rojoTree.$path;
|
|
24
|
+
if (typeof rootPath === "string") {
|
|
25
|
+
const normalizedRootPath = rootPath.replace(TRAILING_SLASH, "");
|
|
26
|
+
if (withoutInit === normalizedRootPath) {
|
|
27
|
+
return "";
|
|
28
|
+
}
|
|
29
|
+
if (withoutInit.startsWith(`${normalizedRootPath}/`)) {
|
|
30
|
+
return withoutInit.slice(normalizedRootPath.length + 1);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
return findInTree(rojoTree, withoutInit, "");
|
|
34
|
+
}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
interface RojoTreeProperty {
|
|
2
|
+
Type: string;
|
|
3
|
+
Value: unknown;
|
|
4
|
+
}
|
|
5
|
+
interface RojoTreeMetadata {
|
|
6
|
+
$className?: string;
|
|
7
|
+
$ignoreUnknownInstances?: boolean;
|
|
8
|
+
$path?: string | {
|
|
9
|
+
optional: string;
|
|
10
|
+
};
|
|
11
|
+
$properties?: Array<RojoTreeProperty>;
|
|
12
|
+
}
|
|
13
|
+
type RojoTree = RojoTreeMembers & RojoTreeMetadata;
|
|
14
|
+
interface RojoTreeMembers {
|
|
15
|
+
[name: string]: RojoTree;
|
|
16
|
+
}
|
|
17
|
+
export declare const RbxType: {
|
|
18
|
+
readonly LocalScript: 2;
|
|
19
|
+
readonly ModuleScript: 0;
|
|
20
|
+
readonly Script: 1;
|
|
21
|
+
readonly Unknown: 3;
|
|
22
|
+
};
|
|
23
|
+
export type RbxType = (typeof RbxType)[keyof typeof RbxType];
|
|
24
|
+
/** Represents a roblox tree path. */
|
|
25
|
+
export type RbxPath = ReadonlyArray<string>;
|
|
26
|
+
export type RelativeRbxPath = ReadonlyArray<RbxPathParent | string>;
|
|
27
|
+
export interface PartitionInfo {
|
|
28
|
+
fsPath: string;
|
|
29
|
+
rbxPath: RbxPath;
|
|
30
|
+
}
|
|
31
|
+
export declare const FileRelation: {
|
|
32
|
+
readonly InToIn: 3;
|
|
33
|
+
readonly InToOut: 2;
|
|
34
|
+
readonly OutToIn: 1;
|
|
35
|
+
readonly OutToOut: 0;
|
|
36
|
+
};
|
|
37
|
+
export type FileRelation = (typeof FileRelation)[keyof typeof FileRelation];
|
|
38
|
+
export declare const NetworkType: {
|
|
39
|
+
readonly Client: 1;
|
|
40
|
+
readonly Server: 2;
|
|
41
|
+
readonly Unknown: 0;
|
|
42
|
+
};
|
|
43
|
+
export type NetworkType = (typeof NetworkType)[keyof typeof NetworkType];
|
|
44
|
+
/** Serializable snapshot of a {@link RojoResolver} for disk caching. */
|
|
45
|
+
export interface RojoResolverState {
|
|
46
|
+
filePathToRbxPathMap: Array<[string, RbxPath]>;
|
|
47
|
+
isGame: boolean;
|
|
48
|
+
isolatedContainers: Array<RbxPath>;
|
|
49
|
+
partitions: Array<PartitionInfo>;
|
|
50
|
+
walkedConfigFiles: Array<string>;
|
|
51
|
+
walkedDirs: Array<string>;
|
|
52
|
+
warnings: Array<string>;
|
|
53
|
+
}
|
|
54
|
+
export declare const RbxPathParent: unique symbol;
|
|
55
|
+
export type RbxPathParent = typeof RbxPathParent;
|
|
56
|
+
export declare class RojoResolver {
|
|
57
|
+
private readonly rbxPath;
|
|
58
|
+
private readonly realpathCache;
|
|
59
|
+
private readonly walkedConfigFilesInternal;
|
|
60
|
+
private readonly walkedDirectoriesInternal;
|
|
61
|
+
private filePathToRbxPathMap;
|
|
62
|
+
private isolatedContainers;
|
|
63
|
+
private partitions;
|
|
64
|
+
private warnings;
|
|
65
|
+
isGame: boolean;
|
|
66
|
+
static findRojoConfigFilePath(projectPath: string): {
|
|
67
|
+
path: string | undefined;
|
|
68
|
+
warnings: Array<string>;
|
|
69
|
+
};
|
|
70
|
+
static fromPath(rojoConfigFilePath: string): RojoResolver;
|
|
71
|
+
/**
|
|
72
|
+
* Restore a resolver from a {@link RojoResolverState} snapshot.
|
|
73
|
+
* @param state - The serialized resolver state to restore from.
|
|
74
|
+
* @returns A resolver equivalent to the one the state was captured from.
|
|
75
|
+
*/
|
|
76
|
+
static fromState(state: RojoResolverState): RojoResolver;
|
|
77
|
+
static fromTree(basePath: string, tree: RojoTree): RojoResolver;
|
|
78
|
+
getFileRelation(fileRbxPath: RbxPath, moduleRbxPath: RbxPath): FileRelation;
|
|
79
|
+
getNetworkType(rbxPath: RbxPath): NetworkType;
|
|
80
|
+
getPartitions(): ReadonlyArray<PartitionInfo>;
|
|
81
|
+
getRbxPathFromFilePath(filePath: string): RbxPath | undefined;
|
|
82
|
+
getRbxTypeFromFilePath(filePath: string): RbxType;
|
|
83
|
+
/**
|
|
84
|
+
* Serialize this resolver to a {@link RojoResolverState} snapshot.
|
|
85
|
+
* @returns A serializable snapshot of this resolver's state.
|
|
86
|
+
*/
|
|
87
|
+
getState(): RojoResolverState;
|
|
88
|
+
getWarnings(): ReadonlyArray<string>;
|
|
89
|
+
isIsolated(rbxPath: RbxPath): boolean;
|
|
90
|
+
static relative(rbxFrom: RbxPath, rbxTo: RbxPath): RelativeRbxPath;
|
|
91
|
+
/**
|
|
92
|
+
* Create a synthetic RojoResolver for ProjectType.Package. Forces all imports
|
|
93
|
+
* to be relative.
|
|
94
|
+
* @param basePath - The base filesystem path the package resolves against.
|
|
95
|
+
* @returns A resolver that maps every file in the package relatively.
|
|
96
|
+
*/
|
|
97
|
+
static synthetic(basePath: string): RojoResolver;
|
|
98
|
+
get walkedConfigFiles(): ReadonlySet<string>;
|
|
99
|
+
get walkedDirectories(): ReadonlySet<string>;
|
|
100
|
+
private cachedRealpath;
|
|
101
|
+
private getContainer;
|
|
102
|
+
private parseConfig;
|
|
103
|
+
private parsePath;
|
|
104
|
+
private parseTree;
|
|
105
|
+
private searchChildren;
|
|
106
|
+
private searchDirectory;
|
|
107
|
+
private warn;
|
|
108
|
+
}
|
|
109
|
+
export {};
|
|
110
|
+
//# sourceMappingURL=rojo-resolver.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rojo-resolver.d.ts","sourceRoot":"","sources":["../src/rojo-resolver.ts"],"names":[],"mappings":"AAmBA,UAAU,gBAAgB;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,OAAO,CAAC;CACf;AAED,UAAU,gBAAgB;IACzB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,uBAAuB,CAAC,EAAE,OAAO,CAAC;IAClC,KAAK,CAAC,EAAE,MAAM,GAAG;QAAE,QAAQ,EAAE,MAAM,CAAA;KAAE,CAAC;IACtC,WAAW,CAAC,EAAE,KAAK,CAAC,gBAAgB,CAAC,CAAC;CACtC;AAED,KAAK,QAAQ,GAAG,eAAe,GAAG,gBAAgB,CAAC;AAEnD,UAAU,eAAe;IACxB,CAAC,IAAI,EAAE,MAAM,GAAG,QAAQ,CAAC;CACzB;AAYD,eAAO,MAAM,OAAO;aACnB,WAAW,EAAE,CAAC;aACd,YAAY,EAAE,CAAC;aACf,MAAM,EAAE,CAAC;aACT,OAAO,EAAE,CAAC;CACD,CAAC;AAEX,MAAM,MAAM,OAAO,GAAG,CAAC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