packtory 0.0.9 → 0.0.10
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/artifacts/artifacts-builder.js +0 -75
- package/artifacts/artifacts-builder.js.map +1 -1
- package/bundle-emitter/emitter.js +0 -34
- package/bundle-emitter/emitter.js.map +1 -1
- package/bundle-emitter/extract-package-tarball.js +0 -11
- package/bundle-emitter/extract-package-tarball.js.map +1 -1
- package/bundle-emitter/registry-client.js +0 -261
- package/bundle-emitter/registry-client.js.map +1 -1
- package/bundle-emitter/repository-url-normalizer.js +0 -36
- package/bundle-emitter/repository-url-normalizer.js.map +1 -1
- package/checks/check-runner.js +0 -5
- package/checks/check-runner.js.map +1 -1
- package/checks/rule.js +0 -8
- package/checks/rule.js.map +1 -1
- package/checks/rules/max-bundle-size.js +0 -35
- package/checks/rules/max-bundle-size.js.map +1 -1
- package/checks/rules/no-dev-dependency-imports.js +0 -28
- package/checks/rules/no-dev-dependency-imports.js.map +1 -1
- package/checks/rules/no-duplicated-files.js +0 -107
- package/checks/rules/no-duplicated-files.js.map +1 -1
- package/checks/rules/no-side-effects.js +0 -42
- package/checks/rules/no-side-effects.js.map +1 -1
- package/checks/rules/no-unused-bundle-dependencies.js +0 -24
- package/checks/rules/no-unused-bundle-dependencies.js.map +1 -1
- package/checks/rules/registry.js +0 -9
- package/checks/rules/registry.js.map +1 -1
- package/checks/rules/required-files.js +0 -31
- package/checks/rules/required-files.js.map +1 -1
- package/checks/rules/unique-target-paths.js +0 -25
- package/checks/rules/unique-target-paths.js.map +1 -1
- package/config/additional-files.js +0 -4
- package/config/additional-files.js.map +1 -1
- package/config/automatic-versioning-settings.js +0 -4
- package/config/automatic-versioning-settings.js.map +1 -1
- package/config/config.js +0 -2
- package/config/config.js.map +1 -1
- package/config/dead-code-elimination-settings.d.ts +6 -0
- package/config/dead-code-elimination-settings.d.ts.map +1 -1
- package/config/dead-code-elimination-settings.js +1 -3
- package/config/dead-code-elimination-settings.js.map +1 -1
- package/config/dependency-policy.js +0 -3
- package/config/dependency-policy.js.map +1 -1
- package/config/main-package-json-schema.js +0 -1
- package/config/main-package-json-schema.js.map +1 -1
- package/config/manual-versioning-settings.js +0 -4
- package/config/manual-versioning-settings.js.map +1 -1
- package/config/package-config.js +0 -6
- package/config/package-config.js.map +1 -1
- package/config/package-interface.d.ts +2 -0
- package/config/package-interface.d.ts.map +1 -1
- package/config/package-interface.js +0 -23
- package/config/package-interface.js.map +1 -1
- package/config/package-json.d.ts +0 -1
- package/config/package-json.d.ts.map +1 -1
- package/config/package-json.js +0 -16
- package/config/package-json.js.map +1 -1
- package/config/packtory-config-schema.js +0 -3
- package/config/packtory-config-schema.js.map +1 -1
- package/config/publish-settings.js +0 -22
- package/config/publish-settings.js.map +1 -1
- package/config/registry-settings.d.ts +0 -20
- package/config/registry-settings.d.ts.map +1 -1
- package/config/registry-settings.js +0 -38
- package/config/registry-settings.js.map +1 -1
- package/config/root.js +0 -4
- package/config/root.js.map +1 -1
- package/config/sbom-settings.js +0 -3
- package/config/sbom-settings.js.map +1 -1
- package/config/validation.d.ts.map +1 -1
- package/config/validation.js +0 -232
- package/config/validation.js.map +1 -1
- package/config/versioning-settings.js +0 -1
- package/config/versioning-settings.js.map +1 -1
- package/dead-code-eliminator/analyzed-bundle.d.ts +2 -0
- package/dead-code-eliminator/analyzed-bundle.d.ts.map +1 -1
- package/dead-code-eliminator/analyzed-bundle.js +0 -7
- package/dead-code-eliminator/analyzed-bundle.js.map +1 -1
- package/dead-code-eliminator/eliminator.js +3 -2
- package/dead-code-eliminator/eliminator.js.map +1 -1
- package/dead-code-eliminator/load-bundle.js +7 -6
- package/dead-code-eliminator/load-bundle.js.map +1 -1
- package/dead-code-eliminator/reachability/impure-statements.js +2 -2
- package/dead-code-eliminator/reachability/impure-statements.js.map +1 -1
- package/dead-code-eliminator/reachability/reachability.js +3 -3
- package/dead-code-eliminator/reachability/reachability.js.map +1 -1
- package/dead-code-eliminator/side-effect-classifier.js +141 -24
- package/dead-code-eliminator/side-effect-classifier.js.map +1 -1
- package/dependency-scanner/dependency-graph.d.ts +0 -2
- package/dependency-scanner/dependency-graph.d.ts.map +1 -1
- package/dependency-scanner/dependency-graph.js +0 -73
- package/dependency-scanner/dependency-graph.js.map +1 -1
- package/dependency-scanner/external-dependencies.d.ts +0 -1
- package/dependency-scanner/external-dependencies.d.ts.map +1 -1
- package/dependency-scanner/external-dependencies.js +0 -16
- package/dependency-scanner/external-dependencies.js.map +1 -1
- package/dependency-scanner/scanner.js +0 -69
- package/dependency-scanner/scanner.js.map +1 -1
- package/dependency-scanner/source-file-references.js +0 -26
- package/dependency-scanner/source-file-references.js.map +1 -1
- package/dependency-scanner/source-map-file-locator.js +0 -27
- package/dependency-scanner/source-map-file-locator.js.map +1 -1
- package/dependency-scanner/typescript-file-host.js +0 -114
- package/dependency-scanner/typescript-file-host.js.map +1 -1
- package/dependency-scanner/typescript-project-analyzer.d.ts +0 -1
- package/dependency-scanner/typescript-project-analyzer.d.ts.map +1 -1
- package/dependency-scanner/typescript-project-analyzer.js +0 -52
- package/dependency-scanner/typescript-project-analyzer.js.map +1 -1
- package/directed-graph/graph.d.ts +0 -1
- package/directed-graph/graph.d.ts.map +1 -1
- package/directed-graph/graph.js +0 -229
- package/directed-graph/graph.js.map +1 -1
- package/file-manager/compare.js +0 -17
- package/file-manager/compare.js.map +1 -1
- package/file-manager/equal.js +0 -5
- package/file-manager/equal.js.map +1 -1
- package/file-manager/file-manager.js +0 -52
- package/file-manager/file-manager.js.map +1 -1
- package/file-manager/permissions.js +0 -26
- package/file-manager/permissions.js.map +1 -1
- package/linker/linker.js +0 -23
- package/linker/linker.js.map +1 -1
- package/linker/resource-graph.js +0 -25
- package/linker/resource-graph.js.map +1 -1
- package/linker/source-modifier/import-paths.js +0 -22
- package/linker/source-modifier/import-paths.js.map +1 -1
- package/linker/substitute-bundles.js +0 -79
- package/linker/substitute-bundles.js.map +1 -1
- package/linker/substituted-resource-graph.js +0 -72
- package/linker/substituted-resource-graph.js.map +1 -1
- package/package-surface/modules.js +12 -230
- package/package-surface/modules.js.map +1 -1
- package/package-surface/surface.d.ts +0 -2
- package/package-surface/surface.d.ts.map +1 -1
- package/package-surface/surface.js +0 -15
- package/package-surface/surface.js.map +1 -1
- package/package.json +41 -3
- package/packtory/map-config.js +0 -14
- package/packtory/map-config.js.map +1 -1
- package/packtory/normalize-paths.js +0 -24
- package/packtory/normalize-paths.js.map +1 -1
- package/packtory/package-processor-build.js +0 -72
- package/packtory/package-processor-build.js.map +1 -1
- package/packtory/package-processor-publish.d.ts +0 -11
- package/packtory/package-processor-publish.d.ts.map +1 -1
- package/packtory/package-processor-publish.js +0 -133
- package/packtory/package-processor-publish.js.map +1 -1
- package/packtory/package-processor.js +0 -8
- package/packtory/package-processor.js.map +1 -1
- package/packtory/packtory-resolve.js +16 -9
- package/packtory/packtory-resolve.js.map +1 -1
- package/packtory/packtory-results.js +0 -15
- package/packtory/packtory-results.js.map +1 -1
- package/packtory/prepare-package-options.d.ts +2 -14
- package/packtory/prepare-package-options.d.ts.map +1 -1
- package/packtory/prepare-package-options.js +1 -118
- package/packtory/prepare-package-options.js.map +1 -1
- package/packtory/resolved-package.js +0 -31
- package/packtory/resolved-package.js.map +1 -1
- package/progress/progress-broadcaster.js +0 -45
- package/progress/progress-broadcaster.js.map +1 -1
- package/report/artifact-entry-merger.js +0 -20
- package/report/artifact-entry-merger.js.map +1 -1
- package/report/inspectors.js +0 -73
- package/report/inspectors.js.map +1 -1
- package/report/report-aggregator.js +0 -185
- package/report/report-aggregator.js.map +1 -1
- package/resource-resolver/content.js +0 -53
- package/resource-resolver/content.js.map +1 -1
- package/resource-resolver/resource-resolve-options.js +0 -12
- package/resource-resolver/resource-resolve-options.js.map +1 -1
- package/resource-resolver/resource-resolver.js +0 -78
- package/resource-resolver/resource-resolver.js.map +1 -1
- package/sbom/extract-license.js +0 -10
- package/sbom/extract-license.js.map +1 -1
- package/sbom/license-resolver.js +0 -19
- package/sbom/license-resolver.js.map +1 -1
- package/sbom/sbom-file.js +0 -54
- package/sbom/sbom-file.js.map +1 -1
- package/sbom/sbom-serializer.js +0 -9
- package/sbom/sbom-serializer.js.map +1 -1
- package/sbom.cdx.json +390 -0
- package/tar/extract-tar.js +0 -38
- package/tar/extract-tar.js.map +1 -1
- package/version-manager/manager.js +0 -46
- package/version-manager/manager.js.map +1 -1
- package/version-manager/manifest/builder.js +0 -56
- package/version-manager/manifest/builder.js.map +1 -1
- package/version-manager/manifest/serialize.js +0 -46
- package/version-manager/manifest/serialize.js.map +1 -1
- package/version-manager/manifest/sort-values.js +0 -16
- package/version-manager/manifest/sort-values.js.map +1 -1
- package/version-manager/specifier-classifier.js +0 -33
- package/version-manager/specifier-classifier.js.map +1 -1
- package/version-manager/specifier-errors.js +0 -43
- package/version-manager/specifier-errors.js.map +1 -1
- package/version-manager/versioned-bundle-dependencies.js +0 -107
- package/version-manager/versioned-bundle-dependencies.js.map +1 -1
- package/version-manager/versioned-bundle-imports.d.ts +0 -1
- package/version-manager/versioned-bundle-imports.d.ts.map +1 -1
- package/version-manager/versioned-bundle-imports.js +0 -72
- package/version-manager/versioned-bundle-imports.js.map +1 -1
- package/version-manager/versioned-bundle.d.ts +0 -1
- package/version-manager/versioned-bundle.d.ts.map +1 -1
- package/version-manager/versioned-bundle.js +0 -60
- package/version-manager/versioned-bundle.js.map +1 -1
|
@@ -1,116 +1,2 @@
|
|
|
1
1
|
import path from 'node:path';
|
|
2
|
-
function isDeclarationFile(filePath) {
|
|
3
|
-
const lowerCasedFilePath = filePath.toLowerCase();
|
|
4
|
-
return (lowerCasedFilePath.endsWith('.d.ts') ||
|
|
5
|
-
lowerCasedFilePath.endsWith('.d.cts') ||
|
|
6
|
-
lowerCasedFilePath.endsWith('.d.mts'));
|
|
7
|
-
}
|
|
8
|
-
function isTypesRootFolder(directoryPath) {
|
|
9
|
-
return directoryPath.endsWith('/node_modules/@types') || directoryPath.includes('/node_modules/@types/');
|
|
10
|
-
}
|
|
11
|
-
const syncMethodNames = {
|
|
12
|
-
fileExists: 'fileExistsSync',
|
|
13
|
-
directoryExists: 'directoryExistsSync',
|
|
14
|
-
readFile: 'readFileSync'
|
|
15
|
-
};
|
|
16
|
-
function bindRequiredMethod(object, methodName, expectedResultDescription, validateResult) {
|
|
17
|
-
const method = Reflect.get(object, methodName);
|
|
18
|
-
if (typeof method !== 'function') {
|
|
19
|
-
throw new TypeError(`Expected ${methodName} to be a function`);
|
|
20
|
-
}
|
|
21
|
-
return (filePath) => {
|
|
22
|
-
const result = Reflect.apply(method, object, [filePath]);
|
|
23
|
-
if (!validateResult(result)) {
|
|
24
|
-
throw new TypeError(`Expected ${methodName} to return ${expectedResultDescription}`);
|
|
25
|
-
}
|
|
26
|
-
return result;
|
|
27
|
-
};
|
|
28
|
-
}
|
|
29
|
-
function isBoolean(value) {
|
|
30
|
-
return typeof value === 'boolean';
|
|
31
|
-
}
|
|
32
|
-
function isString(value) {
|
|
33
|
-
return typeof value === 'string';
|
|
34
|
-
}
|
|
35
|
-
const packageJsonIndentationSpaces = 2;
|
|
36
|
-
function serializeMainPackageJson(mainPackageJson) {
|
|
37
|
-
return JSON.stringify(mainPackageJson, null, packageJsonIndentationSpaces);
|
|
38
|
-
}
|
|
39
|
-
function createVirtualPackageJsonHost(fileSystemHost, folder, mainPackageJson) {
|
|
40
|
-
const packageJsonPath = path.resolve(folder, 'package.json');
|
|
41
|
-
const serializedPackageJson = serializeMainPackageJson(mainPackageJson);
|
|
42
|
-
const fileExistsSync = bindRequiredMethod(fileSystemHost, syncMethodNames.fileExists, 'a boolean', isBoolean);
|
|
43
|
-
const readFileSync = bindRequiredMethod(fileSystemHost, syncMethodNames.readFile, 'a string', isString);
|
|
44
|
-
const virtualFileSystemHost = {
|
|
45
|
-
...fileSystemHost,
|
|
46
|
-
fileExists: async (filePath) => {
|
|
47
|
-
if (path.resolve(filePath) === packageJsonPath) {
|
|
48
|
-
return true;
|
|
49
|
-
}
|
|
50
|
-
return fileSystemHost.fileExists(filePath);
|
|
51
|
-
},
|
|
52
|
-
[syncMethodNames.fileExists]: (filePath) => {
|
|
53
|
-
if (path.resolve(filePath) === packageJsonPath) {
|
|
54
|
-
return true;
|
|
55
|
-
}
|
|
56
|
-
// eslint-disable-next-line node/no-sync -- the ts-morph host interface requires this synchronous method
|
|
57
|
-
return fileExistsSync(filePath);
|
|
58
|
-
},
|
|
59
|
-
readFile: async (filePath, encoding) => {
|
|
60
|
-
if (path.resolve(filePath) === packageJsonPath) {
|
|
61
|
-
return serializedPackageJson;
|
|
62
|
-
}
|
|
63
|
-
return fileSystemHost.readFile(filePath, encoding);
|
|
64
|
-
},
|
|
65
|
-
[syncMethodNames.readFile]: (filePath) => {
|
|
66
|
-
if (path.resolve(filePath) === packageJsonPath) {
|
|
67
|
-
return serializedPackageJson;
|
|
68
|
-
}
|
|
69
|
-
// eslint-disable-next-line node/no-sync -- the ts-morph host interface requires this synchronous method
|
|
70
|
-
return readFileSync(filePath);
|
|
71
|
-
}
|
|
72
|
-
};
|
|
73
|
-
Object.setPrototypeOf(virtualFileSystemHost, fileSystemHost);
|
|
74
|
-
return virtualFileSystemHost;
|
|
75
|
-
}
|
|
76
|
-
export function createFileSystemAdapters(dependencies) {
|
|
77
|
-
const { fileSystemHost } = dependencies;
|
|
78
|
-
const fileExistsSync = bindRequiredMethod(fileSystemHost, syncMethodNames.fileExists, 'a boolean', isBoolean);
|
|
79
|
-
const directoryExistsSync = bindRequiredMethod(fileSystemHost, syncMethodNames.directoryExists, 'a boolean', isBoolean);
|
|
80
|
-
const fileSystemHostFilteringDeclarationFiles = {
|
|
81
|
-
...fileSystemHost,
|
|
82
|
-
fileExists: async (filePath) => {
|
|
83
|
-
if (isDeclarationFile(filePath)) {
|
|
84
|
-
return false;
|
|
85
|
-
}
|
|
86
|
-
return fileSystemHost.fileExists(filePath);
|
|
87
|
-
},
|
|
88
|
-
[syncMethodNames.fileExists]: (filePath) => {
|
|
89
|
-
if (isDeclarationFile(filePath)) {
|
|
90
|
-
return false;
|
|
91
|
-
}
|
|
92
|
-
// eslint-disable-next-line node/no-sync -- the ts-morph host interface requires this synchronous method
|
|
93
|
-
return fileExistsSync(filePath);
|
|
94
|
-
},
|
|
95
|
-
directoryExists: async (directoryPath) => {
|
|
96
|
-
if (isTypesRootFolder(directoryPath)) {
|
|
97
|
-
return false;
|
|
98
|
-
}
|
|
99
|
-
return fileSystemHost.directoryExists(directoryPath);
|
|
100
|
-
},
|
|
101
|
-
[syncMethodNames.directoryExists]: (directoryPath) => {
|
|
102
|
-
if (isTypesRootFolder(directoryPath)) {
|
|
103
|
-
return false;
|
|
104
|
-
}
|
|
105
|
-
// eslint-disable-next-line node/no-sync -- the ts-morph host interface requires this synchronous method
|
|
106
|
-
return directoryExistsSync(directoryPath);
|
|
107
|
-
}
|
|
108
|
-
};
|
|
109
|
-
Object.setPrototypeOf(fileSystemHostFilteringDeclarationFiles, fileSystemHost);
|
|
110
|
-
return {
|
|
111
|
-
fileSystemHostWithoutFilter: fileSystemHost,
|
|
112
|
-
fileSystemHostFilteringDeclarationFiles,
|
|
113
|
-
withVirtualPackageJson: createVirtualPackageJsonHost
|
|
114
|
-
};
|
|
115
|
-
}
|
|
116
2
|
//# sourceMappingURL=typescript-file-host.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"typescript-file-host.js","sourceRoot":"","sources":["../../../../source/dependency-scanner/typescript-file-host.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW
|
|
1
|
+
{"version":3,"file":"typescript-file-host.js","sourceRoot":"","sources":["../../../../source/dependency-scanner/typescript-file-host.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW"}
|
|
@@ -17,7 +17,6 @@ export type TypescriptProject = {
|
|
|
17
17
|
export type TypescriptProjectAnalyzer = {
|
|
18
18
|
analyzeProject: (folder: string, options: AnalyzationOptions) => TypescriptProject;
|
|
19
19
|
};
|
|
20
|
-
export declare function getSourcePathFromSourceFile(sourceFile: Readonly<SourceFile>): string;
|
|
21
20
|
export declare function createTypescriptProjectAnalyzer(dependencies: TypescriptProjectAnalyzerDependencies): TypescriptProjectAnalyzer;
|
|
22
21
|
export {};
|
|
23
22
|
//# sourceMappingURL=typescript-project-analyzer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"typescript-project-analyzer.d.ts","sourceRoot":"","sources":["../../../../source/dependency-scanner/typescript-project-analyzer.ts"],"names":[],"mappings":"AACA,OAAO,EAEH,KAAK,OAAO,IAAI,QAAQ,EACxB,KAAK,UAAU,EAGlB,MAAM,UAAU
|
|
1
|
+
{"version":3,"file":"typescript-project-analyzer.d.ts","sourceRoot":"","sources":["../../../../source/dependency-scanner/typescript-project-analyzer.ts"],"names":[],"mappings":"AACA,OAAO,EAEH,KAAK,OAAO,IAAI,QAAQ,EACxB,KAAK,UAAU,EAGlB,MAAM,UAAU;AACjB,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,2BAA2B;AAChE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2BAA2B;AAEnE,MAAM,MAAM,qCAAqC,GAAG;IAChD,QAAQ,CAAC,OAAO,EAAE,OAAO,QAAQ,CAAC;IAClC,QAAQ,CAAC,kBAAkB,EAAE,kBAAkB,CAAC;IAChD,wBAAwB,EAAE,CAAC,UAAU,EAAE,QAAQ,CAAC,UAAU,CAAC,KAAK,SAAS,QAAQ,CAAC,UAAU,CAAC,EAAE,CAAC;CACnG;AAED,KAAK,kBAAkB,GAAG;IACtB,QAAQ,CAAC,uBAAuB,EAAE,OAAO,CAAC;IAC1C,QAAQ,CAAC,eAAe,EAAE,eAAe,CAAC;CAC7C;AAED,MAAM,MAAM,iBAAiB,GAAG;IAC5B,4BAA4B,EAAE,CAAC,wBAAwB,EAAE,MAAM,KAAK,SAAS,MAAM,EAAE,CAAC;IACtF,UAAU,EAAE,MAAM,QAAQ,CAAC;CAC9B;AAED,MAAM,MAAM,yBAAyB,GAAG;IACpC,cAAc,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,kBAAkB,KAAK,iBAAiB,CAAC;CACtF;AA+BD,wBAAgB,+BAA+B,CAC3C,YAAY,EAAE,qCAAqC,GACpD,yBAAyB"}
|
|
@@ -1,55 +1,3 @@
|
|
|
1
1
|
import path from 'node:path';
|
|
2
2
|
import { ModuleKind, ModuleResolutionKind } from 'ts-morph';
|
|
3
|
-
export function getSourcePathFromSourceFile(sourceFile) {
|
|
4
|
-
const filePath = sourceFile.getFilePath();
|
|
5
|
-
return filePath;
|
|
6
|
-
}
|
|
7
|
-
function analyzationOptionsToCompilerOptions(options) {
|
|
8
|
-
const { resolveDeclarationFiles } = options;
|
|
9
|
-
const compilerOptions = {
|
|
10
|
-
moduleResolution: ModuleResolutionKind.Node16,
|
|
11
|
-
esModuleInterop: true,
|
|
12
|
-
maxNodeModuleJsDepth: 1,
|
|
13
|
-
noEmit: true,
|
|
14
|
-
allowJs: true,
|
|
15
|
-
noLib: true,
|
|
16
|
-
skipLibCheck: true,
|
|
17
|
-
module: ModuleKind.Node16,
|
|
18
|
-
resolvePackageJsonImports: true
|
|
19
|
-
};
|
|
20
|
-
if (!resolveDeclarationFiles) {
|
|
21
|
-
compilerOptions.types = [];
|
|
22
|
-
compilerOptions.typeRoots = [];
|
|
23
|
-
}
|
|
24
|
-
return compilerOptions;
|
|
25
|
-
}
|
|
26
|
-
export function createTypescriptProjectAnalyzer(dependencies) {
|
|
27
|
-
const { fileSystemAdapters, Project, getReferencedSourceFiles } = dependencies;
|
|
28
|
-
return {
|
|
29
|
-
analyzeProject(folder, options) {
|
|
30
|
-
const project = new Project({
|
|
31
|
-
compilerOptions: analyzationOptionsToCompilerOptions(options),
|
|
32
|
-
fileSystem: fileSystemAdapters.withVirtualPackageJson(options.resolveDeclarationFiles
|
|
33
|
-
? fileSystemAdapters.fileSystemHostWithoutFilter
|
|
34
|
-
: fileSystemAdapters.fileSystemHostFilteringDeclarationFiles, folder, options.mainPackageJson)
|
|
35
|
-
});
|
|
36
|
-
const fileExtension = options.resolveDeclarationFiles ? '.d.ts' : '.js';
|
|
37
|
-
const filesPattern = path.join(folder, `**/*${fileExtension}`);
|
|
38
|
-
project.addSourceFilesAtPaths([filesPattern]);
|
|
39
|
-
return {
|
|
40
|
-
getReferencedSourceFilePaths(containingSourceFilePath) {
|
|
41
|
-
const currentSourceFile = project.getSourceFile(containingSourceFilePath);
|
|
42
|
-
if (currentSourceFile === undefined) {
|
|
43
|
-
return [];
|
|
44
|
-
}
|
|
45
|
-
const referencedSourceFilePaths = getReferencedSourceFiles(currentSourceFile).map(getSourcePathFromSourceFile);
|
|
46
|
-
return referencedSourceFilePaths;
|
|
47
|
-
},
|
|
48
|
-
getProject() {
|
|
49
|
-
return project;
|
|
50
|
-
}
|
|
51
|
-
};
|
|
52
|
-
}
|
|
53
|
-
};
|
|
54
|
-
}
|
|
55
3
|
//# sourceMappingURL=typescript-project-analyzer.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"typescript-project-analyzer.js","sourceRoot":"","sources":["../../../../source/dependency-scanner/typescript-project-analyzer.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW
|
|
1
|
+
{"version":3,"file":"typescript-project-analyzer.js","sourceRoot":"","sources":["../../../../source/dependency-scanner/typescript-project-analyzer.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW;AAC5B,OAAO,EACH,UAAU,EAGV,oBAAoB,EAEvB,MAAM,UAAU"}
|
|
@@ -24,6 +24,5 @@ export type DirectedGraph<TId extends GraphNodeId, TData> = {
|
|
|
24
24
|
getAdjacentIds: (id: TId) => ReadonlySet<TId>;
|
|
25
25
|
traverse: (visitor: Visitor<TId, TData>) => void;
|
|
26
26
|
};
|
|
27
|
-
export declare function createDirectedGraph<TId extends GraphNodeId, TData>(): DirectedGraph<TId, TData>;
|
|
28
27
|
export {};
|
|
29
28
|
//# sourceMappingURL=graph.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"graph.d.ts","sourceRoot":"","sources":["../../../../source/directed-graph/graph.ts"],"names":[],"mappings":"AACA,KAAK,WAAW,GAAG,MAAM,GAAG,MAAM
|
|
1
|
+
{"version":3,"file":"graph.d.ts","sourceRoot":"","sources":["../../../../source/directed-graph/graph.ts"],"names":[],"mappings":"AACA,KAAK,WAAW,GAAG,MAAM,GAAG,MAAM;AAElC,KAAK,SAAS,CAAC,GAAG,SAAS,WAAW,EAAE,KAAK,IAAI;IAC7C,QAAQ,CAAC,EAAE,EAAE,GAAG,CAAC;IACjB,QAAQ,CAAC,IAAI,EAAE,KAAK,CAAC;IACrB,QAAQ,CAAC,eAAe,EAAE,GAAG,CAAC,GAAG,CAAC,CAAC;IACnC,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;CAClC;AAED,KAAK,SAAS,CAAC,GAAG,SAAS,WAAW,IAAI;IACtC,QAAQ,CAAC,IAAI,EAAE,GAAG,CAAC;IACnB,QAAQ,CAAC,EAAE,EAAE,GAAG,CAAC;CACpB;AAED,KAAK,OAAO,CAAC,GAAG,SAAS,WAAW,EAAE,KAAK,IAAI,CAAC,IAAI,EAAE,QAAQ,CAAC,SAAS,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC,KAAK,IAAI;AAE9F,MAAM,MAAM,aAAa,CAAC,GAAG,SAAS,WAAW,EAAE,KAAK,IAAI;IACxD,OAAO,EAAE,CAAC,EAAE,EAAE,GAAG,EAAE,IAAI,EAAE,KAAK,KAAK,IAAI,CAAC;IACxC,OAAO,EAAE,CAAC,IAAI,EAAE,QAAQ,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,KAAK,IAAI,CAAC;IAClD,UAAU,EAAE,CAAC,IAAI,EAAE,QAAQ,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,KAAK,IAAI,CAAC;IACrD,OAAO,EAAE,CAAC,EAAE,EAAE,GAAG,KAAK,OAAO,CAAC;IAC9B,aAAa,EAAE,CAAC,IAAI,EAAE,QAAQ,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,KAAK,OAAO,CAAC;IAC3D,uBAAuB,EAAE,CAAC,OAAO,EAAE,GAAG,EAAE,OAAO,EAAE,OAAO,CAAC,GAAG,EAAE,KAAK,CAAC,KAAK,IAAI,CAAC;IAC9E,YAAY,EAAE,MAAM,SAAS,CAAC,SAAS,GAAG,EAAE,CAAC,EAAE,CAAC;IAChD,QAAQ,EAAE,MAAM,OAAO,CAAC;IACxB,yBAAyB,EAAE,MAAM,SAAS,CAAC,SAAS,GAAG,EAAE,CAAC,EAAE,CAAC;IAC7D,OAAO,EAAE,MAAM,aAAa,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;IACzC,cAAc,EAAE,CAAC,EAAE,EAAE,GAAG,KAAK,WAAW,CAAC,GAAG,CAAC,CAAC;IAC9C,QAAQ,EAAE,CAAC,OAAO,EAAE,OAAO,CAAC,GAAG,EAAE,KAAK,CAAC,KAAK,IAAI,CAAC;CACpD"}
|
package/directed-graph/graph.js
CHANGED
|
@@ -1,230 +1 @@
|
|
|
1
|
-
const breadthFirstTraversalBudgetExceededErrorMessage = 'Breadth-first traversal exceeded the maximum iteration budget';
|
|
2
|
-
function addAdjacentNodeId(node, idToAdd) {
|
|
3
|
-
return {
|
|
4
|
-
id: node.id,
|
|
5
|
-
data: node.data,
|
|
6
|
-
incomingEdges: node.incomingEdges,
|
|
7
|
-
adjacentNodeIds: new Set([...node.adjacentNodeIds, idToAdd])
|
|
8
|
-
};
|
|
9
|
-
}
|
|
10
|
-
function removeAdjacentNodeId(node, idToRemove) {
|
|
11
|
-
const adjacentNodeIds = new Set(node.adjacentNodeIds);
|
|
12
|
-
adjacentNodeIds.delete(idToRemove);
|
|
13
|
-
return {
|
|
14
|
-
id: node.id,
|
|
15
|
-
data: node.data,
|
|
16
|
-
incomingEdges: node.incomingEdges,
|
|
17
|
-
adjacentNodeIds
|
|
18
|
-
};
|
|
19
|
-
}
|
|
20
|
-
function withAdjustedIncomingEdges(node, delta) {
|
|
21
|
-
return {
|
|
22
|
-
id: node.id,
|
|
23
|
-
data: node.data,
|
|
24
|
-
adjacentNodeIds: node.adjacentNodeIds,
|
|
25
|
-
incomingEdges: node.incomingEdges + delta
|
|
26
|
-
};
|
|
27
|
-
}
|
|
28
|
-
function increaseIncomingEdges(node) {
|
|
29
|
-
return withAdjustedIncomingEdges(node, 1);
|
|
30
|
-
}
|
|
31
|
-
function decreaseIncomingEdges(node) {
|
|
32
|
-
return withAdjustedIncomingEdges(node, -1);
|
|
33
|
-
}
|
|
34
|
-
function getNonVisitedAdjacentIds(node) {
|
|
35
|
-
return Array.from(node.adjacentNodeIds);
|
|
36
|
-
}
|
|
37
|
-
export function createDirectedGraph() {
|
|
38
|
-
const nodes = new Map();
|
|
39
|
-
function getNode(id) {
|
|
40
|
-
const node = nodes.get(id);
|
|
41
|
-
if (node === undefined) {
|
|
42
|
-
throw new Error(`Node with id "${id}" does not exist`);
|
|
43
|
-
}
|
|
44
|
-
return node;
|
|
45
|
-
}
|
|
46
|
-
function getIncomingEdgesPerNode() {
|
|
47
|
-
const incomingEdgesPerNode = new Map();
|
|
48
|
-
for (const node of nodes.values()) {
|
|
49
|
-
incomingEdgesPerNode.set(node.id, node.incomingEdges);
|
|
50
|
-
}
|
|
51
|
-
return incomingEdgesPerNode;
|
|
52
|
-
}
|
|
53
|
-
function decreaseIncomingEdgesPerNodeForAdjacentNodes(incomingEdgesPerNode, ids) {
|
|
54
|
-
const newIncomingEdgesPerNode = new Map(incomingEdgesPerNode);
|
|
55
|
-
for (const id of ids) {
|
|
56
|
-
const node = getNode(id);
|
|
57
|
-
for (const adjacentNodeId of node.adjacentNodeIds) {
|
|
58
|
-
const degree = Number(newIncomingEdgesPerNode.get(adjacentNodeId));
|
|
59
|
-
newIncomingEdgesPerNode.set(adjacentNodeId, degree - 1);
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
return newIncomingEdgesPerNode;
|
|
63
|
-
}
|
|
64
|
-
function getTraversalBudget() {
|
|
65
|
-
let edgeCount = 0;
|
|
66
|
-
for (const node of nodes.values()) {
|
|
67
|
-
edgeCount += node.adjacentNodeIds.size;
|
|
68
|
-
}
|
|
69
|
-
return nodes.size + edgeCount + 1;
|
|
70
|
-
}
|
|
71
|
-
function detectCyclesForNode(baseNode, visitedIds) {
|
|
72
|
-
if (visitedIds.length === nodes.size + 1) {
|
|
73
|
-
throw new Error('Cycle detection exceeded the maximum traversal depth');
|
|
74
|
-
}
|
|
75
|
-
const newVisitedIds = [...visitedIds, baseNode.id];
|
|
76
|
-
const cycles = [];
|
|
77
|
-
for (const id of baseNode.adjacentNodeIds) {
|
|
78
|
-
if (newVisitedIds.includes(id)) {
|
|
79
|
-
cycles.push([...newVisitedIds, id]);
|
|
80
|
-
continue;
|
|
81
|
-
}
|
|
82
|
-
const cyclesInAdjacentNode = detectCyclesForNode(getNode(id), newVisitedIds);
|
|
83
|
-
cycles.push(...cyclesInAdjacentNode);
|
|
84
|
-
}
|
|
85
|
-
return cycles;
|
|
86
|
-
}
|
|
87
|
-
function collectCurrentGeneration(alreadyDiscovered, incomingEdgesPerNode) {
|
|
88
|
-
const currentGeneration = [];
|
|
89
|
-
for (const node of nodes.values()) {
|
|
90
|
-
if (!alreadyDiscovered.has(node.id) && incomingEdgesPerNode.get(node.id) === 0) {
|
|
91
|
-
currentGeneration.push(node.id);
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
return currentGeneration;
|
|
95
|
-
}
|
|
96
|
-
function detectCycles() {
|
|
97
|
-
const cycles = [];
|
|
98
|
-
const idsWithinCycles = new Set();
|
|
99
|
-
for (const baseNode of nodes.values()) {
|
|
100
|
-
if (!idsWithinCycles.has(baseNode.id)) {
|
|
101
|
-
const cyclesForNode = detectCyclesForNode(baseNode, []);
|
|
102
|
-
cycles.push(...cyclesForNode);
|
|
103
|
-
for (const id of cyclesForNode.flat()) {
|
|
104
|
-
idsWithinCycles.add(id);
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
return cycles;
|
|
109
|
-
}
|
|
110
|
-
function isCyclic() {
|
|
111
|
-
const cycles = detectCycles();
|
|
112
|
-
return cycles.length > 0;
|
|
113
|
-
}
|
|
114
|
-
function visitBreadthFirstSearch(startId, visitor) {
|
|
115
|
-
const startNode = getNode(startId);
|
|
116
|
-
const queue = [startNode];
|
|
117
|
-
const visited = new Set();
|
|
118
|
-
const traversalBudget = getTraversalBudget();
|
|
119
|
-
for (let nextNodeIndex = 0; nextNodeIndex < traversalBudget; nextNodeIndex += 1) {
|
|
120
|
-
const head = queue[nextNodeIndex];
|
|
121
|
-
if (head === undefined) {
|
|
122
|
-
return;
|
|
123
|
-
}
|
|
124
|
-
if (visited.has(head.id)) {
|
|
125
|
-
continue;
|
|
126
|
-
}
|
|
127
|
-
visited.add(head.id);
|
|
128
|
-
visitor(head);
|
|
129
|
-
const nonVisitedAdjacentIds = getNonVisitedAdjacentIds(head);
|
|
130
|
-
for (const id of nonVisitedAdjacentIds) {
|
|
131
|
-
const adjacentNode = getNode(id);
|
|
132
|
-
queue.push(adjacentNode);
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
throw new Error(breadthFirstTraversalBudgetExceededErrorMessage);
|
|
136
|
-
}
|
|
137
|
-
function hasNode(id) {
|
|
138
|
-
return nodes.has(id);
|
|
139
|
-
}
|
|
140
|
-
function getAdjacentIds(id) {
|
|
141
|
-
const node = getNode(id);
|
|
142
|
-
return node.adjacentNodeIds;
|
|
143
|
-
}
|
|
144
|
-
function addNode(id, data) {
|
|
145
|
-
if (nodes.has(id)) {
|
|
146
|
-
throw new Error(`Node with id "${id}" already exists`);
|
|
147
|
-
}
|
|
148
|
-
nodes.set(id, { id, data, adjacentNodeIds: new Set(), incomingEdges: 0 });
|
|
149
|
-
}
|
|
150
|
-
function hasConnection(edge) {
|
|
151
|
-
const fromNode = getNode(edge.from);
|
|
152
|
-
return fromNode.adjacentNodeIds.has(edge.to);
|
|
153
|
-
}
|
|
154
|
-
function connect(edge) {
|
|
155
|
-
const fromNode = getNode(edge.from);
|
|
156
|
-
const toNode = getNode(edge.to);
|
|
157
|
-
if (fromNode.adjacentNodeIds.has(toNode.id)) {
|
|
158
|
-
throw new Error(`Edge from "${edge.from}" to "${toNode.id}" already exists`);
|
|
159
|
-
}
|
|
160
|
-
nodes.set(edge.from, addAdjacentNodeId(fromNode, toNode.id));
|
|
161
|
-
nodes.set(edge.to, increaseIncomingEdges(getNode(edge.to)));
|
|
162
|
-
}
|
|
163
|
-
function disconnect(edge) {
|
|
164
|
-
const fromNode = getNode(edge.from);
|
|
165
|
-
const toNode = getNode(edge.to);
|
|
166
|
-
if (!fromNode.adjacentNodeIds.has(toNode.id)) {
|
|
167
|
-
throw new Error(`Edge from "${edge.from}" to "${toNode.id}" does not exist`);
|
|
168
|
-
}
|
|
169
|
-
nodes.set(edge.from, removeAdjacentNodeId(fromNode, toNode.id));
|
|
170
|
-
nodes.set(edge.to, decreaseIncomingEdges(toNode));
|
|
171
|
-
}
|
|
172
|
-
function traverse(visitor) {
|
|
173
|
-
for (const [nodeId, node] of nodes) {
|
|
174
|
-
if (node.incomingEdges === 0) {
|
|
175
|
-
visitBreadthFirstSearch(nodeId, visitor);
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
function getTopologicalGenerations() {
|
|
180
|
-
if (isCyclic()) {
|
|
181
|
-
throw new Error('Failed to determine topological generations, current graph is cyclic');
|
|
182
|
-
}
|
|
183
|
-
const generations = [];
|
|
184
|
-
let alreadyDiscovered = new Set();
|
|
185
|
-
let incomingEdgesPerNode = getIncomingEdgesPerNode();
|
|
186
|
-
const generationAttempts = Array.from({ length: nodes.size + 1 }, (_unusedEntry, index) => {
|
|
187
|
-
return index + 1;
|
|
188
|
-
});
|
|
189
|
-
let exhaustedAttempts = 0;
|
|
190
|
-
for (const attempt of generationAttempts) {
|
|
191
|
-
exhaustedAttempts = attempt;
|
|
192
|
-
const currentGeneration = collectCurrentGeneration(alreadyDiscovered, incomingEdgesPerNode);
|
|
193
|
-
if (currentGeneration.length === 0) {
|
|
194
|
-
return generations;
|
|
195
|
-
}
|
|
196
|
-
const currentlyDiscovered = new Set([...alreadyDiscovered, ...currentGeneration]);
|
|
197
|
-
generations.push(Array.from(currentGeneration));
|
|
198
|
-
alreadyDiscovered = currentlyDiscovered;
|
|
199
|
-
incomingEdgesPerNode = decreaseIncomingEdgesPerNodeForAdjacentNodes(incomingEdgesPerNode, Array.from(currentGeneration));
|
|
200
|
-
}
|
|
201
|
-
throw new Error(`Topological generation discovery did not make progress after ${exhaustedAttempts} attempts`);
|
|
202
|
-
}
|
|
203
|
-
function reverse() {
|
|
204
|
-
const reversedGraph = createDirectedGraph();
|
|
205
|
-
for (const node of nodes.values()) {
|
|
206
|
-
reversedGraph.addNode(node.id, node.data);
|
|
207
|
-
}
|
|
208
|
-
for (const node of nodes.values()) {
|
|
209
|
-
for (const adjacentNodeId of node.adjacentNodeIds) {
|
|
210
|
-
reversedGraph.connect({ from: adjacentNodeId, to: node.id });
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
return reversedGraph;
|
|
214
|
-
}
|
|
215
|
-
return {
|
|
216
|
-
addNode,
|
|
217
|
-
getAdjacentIds,
|
|
218
|
-
hasNode,
|
|
219
|
-
hasConnection,
|
|
220
|
-
connect,
|
|
221
|
-
disconnect,
|
|
222
|
-
visitBreadthFirstSearch,
|
|
223
|
-
traverse,
|
|
224
|
-
detectCycles,
|
|
225
|
-
isCyclic,
|
|
226
|
-
getTopologicalGenerations,
|
|
227
|
-
reverse
|
|
228
|
-
};
|
|
229
|
-
}
|
|
230
1
|
//# sourceMappingURL=graph.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"graph.js","sourceRoot":"","sources":["../../../../source/directed-graph/graph.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"graph.js","sourceRoot":"","sources":["../../../../source/directed-graph/graph.ts"],"names":[],"mappings":""}
|
package/file-manager/compare.js
CHANGED
|
@@ -1,20 +1,3 @@
|
|
|
1
1
|
import { sortBy } from 'remeda';
|
|
2
2
|
import { areFileDescriptionEqual } from "./equal.js";
|
|
3
|
-
export function compareFileDescriptions(fileDescriptionsA, fileDescriptionsB) {
|
|
4
|
-
if (fileDescriptionsA.length !== fileDescriptionsB.length) {
|
|
5
|
-
return { status: 'not-equal' };
|
|
6
|
-
}
|
|
7
|
-
const byFilePath = (fileDescription) => {
|
|
8
|
-
return fileDescription.filePath;
|
|
9
|
-
};
|
|
10
|
-
const sortedFileDescriptionsA = sortBy(fileDescriptionsA, byFilePath);
|
|
11
|
-
const sortedFileDescriptionsB = sortBy(fileDescriptionsB, byFilePath);
|
|
12
|
-
for (const [index, fileDescriptionA] of sortedFileDescriptionsA.entries()) {
|
|
13
|
-
const fileDescriptionB = sortedFileDescriptionsB[index];
|
|
14
|
-
if (fileDescriptionB === undefined || !areFileDescriptionEqual(fileDescriptionA, fileDescriptionB)) {
|
|
15
|
-
return { status: 'not-equal' };
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
return { status: 'equal' };
|
|
19
|
-
}
|
|
20
3
|
//# sourceMappingURL=compare.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compare.js","sourceRoot":"","sources":["../../../../source/file-manager/compare.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ
|
|
1
|
+
{"version":3,"file":"compare.js","sourceRoot":"","sources":["../../../../source/file-manager/compare.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ;AAC/B,OAAO,EAAE,uBAAuB,EAAE,MAAM,YAAY"}
|
package/file-manager/equal.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"equal.js","sourceRoot":"","sources":["../../../../source/file-manager/equal.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"equal.js","sourceRoot":"","sources":["../../../../source/file-manager/equal.ts"],"names":[],"mappings":""}
|
|
@@ -1,56 +1,4 @@
|
|
|
1
1
|
import fs from 'node:fs';
|
|
2
2
|
import path from 'node:path';
|
|
3
3
|
import { isExecutableFileMode } from "./permissions.js";
|
|
4
|
-
const executableFileMode = 0o755;
|
|
5
|
-
const regularFileMode = 0o644;
|
|
6
|
-
export function createFileManager(dependencies) {
|
|
7
|
-
const { hostFileSystem } = dependencies;
|
|
8
|
-
async function checkReadability(fileOrFolderPath) {
|
|
9
|
-
try {
|
|
10
|
-
await hostFileSystem.access(fileOrFolderPath, fs.constants.R_OK);
|
|
11
|
-
return { isReadable: true };
|
|
12
|
-
}
|
|
13
|
-
catch {
|
|
14
|
-
return { isReadable: false };
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
async function writeFile(filePath, content) {
|
|
18
|
-
const containingFolder = path.dirname(filePath);
|
|
19
|
-
const parentReadability = await checkReadability(containingFolder);
|
|
20
|
-
if (!parentReadability.isReadable) {
|
|
21
|
-
await hostFileSystem.mkdir(containingFolder, { recursive: true });
|
|
22
|
-
}
|
|
23
|
-
await hostFileSystem.writeFile(filePath, content, { encoding: 'utf8' });
|
|
24
|
-
}
|
|
25
|
-
async function readFile(filePath) {
|
|
26
|
-
return hostFileSystem.readFile(filePath, { encoding: 'utf8' });
|
|
27
|
-
}
|
|
28
|
-
async function getFileMode(filePath) {
|
|
29
|
-
const stats = await hostFileSystem.stat(filePath);
|
|
30
|
-
return stats.mode;
|
|
31
|
-
}
|
|
32
|
-
async function setExecutable(filePath, executable) {
|
|
33
|
-
const mode = executable ? executableFileMode : regularFileMode;
|
|
34
|
-
await hostFileSystem.chmod(filePath, mode);
|
|
35
|
-
}
|
|
36
|
-
return {
|
|
37
|
-
checkReadability,
|
|
38
|
-
writeFile,
|
|
39
|
-
setExecutable,
|
|
40
|
-
readFile,
|
|
41
|
-
async getTransferableFileDescriptionFromPath(sourceFilePath, targetFilePath) {
|
|
42
|
-
const mode = await getFileMode(sourceFilePath);
|
|
43
|
-
return {
|
|
44
|
-
sourceFilePath,
|
|
45
|
-
targetFilePath,
|
|
46
|
-
content: await readFile(sourceFilePath),
|
|
47
|
-
isExecutable: isExecutableFileMode(mode)
|
|
48
|
-
};
|
|
49
|
-
},
|
|
50
|
-
async copyFile(from, to) {
|
|
51
|
-
const content = await readFile(from);
|
|
52
|
-
await writeFile(to, content);
|
|
53
|
-
}
|
|
54
|
-
};
|
|
55
|
-
}
|
|
56
4
|
//# sourceMappingURL=file-manager.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"file-manager.js","sourceRoot":"","sources":["../../../../source/file-manager/file-manager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS
|
|
1
|
+
{"version":3,"file":"file-manager.js","sourceRoot":"","sources":["../../../../source/file-manager/file-manager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS;AACxB,OAAO,IAAI,MAAM,WAAW;AAE5B,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB"}
|
|
@@ -1,28 +1,2 @@
|
|
|
1
1
|
import { convert } from 'unix-permissions';
|
|
2
|
-
function hasExecutePermission(permission) {
|
|
3
|
-
if (permission === undefined) {
|
|
4
|
-
return false;
|
|
5
|
-
}
|
|
6
|
-
return permission.execute === true;
|
|
7
|
-
}
|
|
8
|
-
function areAllPermissionsExecutable(permissions) {
|
|
9
|
-
return (hasExecutePermission(permissions.user) &&
|
|
10
|
-
hasExecutePermission(permissions.group) &&
|
|
11
|
-
hasExecutePermission(permissions.others));
|
|
12
|
-
}
|
|
13
|
-
function getPermissions(mode) {
|
|
14
|
-
try {
|
|
15
|
-
return convert.object(mode);
|
|
16
|
-
}
|
|
17
|
-
catch {
|
|
18
|
-
return null;
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
export function isExecutableFileMode(mode) {
|
|
22
|
-
const permissions = getPermissions(mode);
|
|
23
|
-
if (permissions === null) {
|
|
24
|
-
return false;
|
|
25
|
-
}
|
|
26
|
-
return areAllPermissionsExecutable(permissions);
|
|
27
|
-
}
|
|
28
2
|
//# sourceMappingURL=permissions.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"permissions.js","sourceRoot":"","sources":["../../../../source/file-manager/permissions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB
|
|
1
|
+
{"version":3,"file":"permissions.js","sourceRoot":"","sources":["../../../../source/file-manager/permissions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB"}
|
package/linker/linker.js
CHANGED
|
@@ -1,26 +1,3 @@
|
|
|
1
1
|
import { substituteDependencies } from "./substitute-bundles.js";
|
|
2
2
|
import { createGraphFromResolvedBundle } from "./resource-graph.js";
|
|
3
|
-
function flattenRoots(roots) {
|
|
4
|
-
return Object.values(roots).flatMap((root) => {
|
|
5
|
-
if (root.declarationFile !== undefined) {
|
|
6
|
-
return [root.js.sourceFilePath, root.declarationFile.sourceFilePath];
|
|
7
|
-
}
|
|
8
|
-
return [root.js.sourceFilePath];
|
|
9
|
-
});
|
|
10
|
-
}
|
|
11
|
-
export function createBundleLinker() {
|
|
12
|
-
return {
|
|
13
|
-
async linkBundle(options) {
|
|
14
|
-
const { bundle, bundleDependencies } = options;
|
|
15
|
-
const resourceGraph = createGraphFromResolvedBundle(bundle);
|
|
16
|
-
const substitutedGraph = substituteDependencies(resourceGraph, bundleDependencies);
|
|
17
|
-
return {
|
|
18
|
-
...substitutedGraph.flatten(flattenRoots(bundle.roots)),
|
|
19
|
-
name: bundle.name,
|
|
20
|
-
roots: bundle.roots,
|
|
21
|
-
surface: bundle.surface
|
|
22
|
-
};
|
|
23
|
-
}
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
3
|
//# sourceMappingURL=linker.js.map
|
package/linker/linker.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"linker.js","sourceRoot":"","sources":["../../../../source/linker/linker.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,sBAAsB,EAAE,MAAM,yBAAyB
|
|
1
|
+
{"version":3,"file":"linker.js","sourceRoot":"","sources":["../../../../source/linker/linker.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,sBAAsB,EAAE,MAAM,yBAAyB;AAEhE,OAAO,EAAE,6BAA6B,EAAE,MAAM,qBAAqB"}
|