packtory 0.0.8 → 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.d.ts +7 -5
- package/artifacts/artifacts-builder.d.ts.map +1 -1
- package/artifacts/artifacts-builder.js +1 -47
- package/artifacts/artifacts-builder.js.map +1 -1
- package/bundle-emitter/emitter.d.ts +12 -2
- package/bundle-emitter/emitter.d.ts.map +1 -1
- package/bundle-emitter/emitter.js +2 -31
- package/bundle-emitter/emitter.js.map +1 -1
- package/bundle-emitter/extract-package-tarball.js +0 -12
- package/bundle-emitter/extract-package-tarball.js.map +1 -1
- package/bundle-emitter/publish-settings-bridge.js +133 -0
- package/bundle-emitter/publish-settings-bridge.js.map +1 -0
- package/bundle-emitter/registry-client.d.ts +13 -6
- package/bundle-emitter/registry-client.d.ts.map +1 -1
- package/bundle-emitter/registry-client.js +1 -90
- package/bundle-emitter/registry-client.js.map +1 -1
- package/bundle-emitter/repository-coherence.js +54 -0
- package/bundle-emitter/repository-coherence.js.map +1 -0
- package/bundle-emitter/repository-url-normalizer.js +2 -0
- package/bundle-emitter/repository-url-normalizer.js.map +1 -0
- package/checks/check-runner.js +1 -12
- package/checks/check-runner.js.map +1 -1
- package/checks/rule.js +5 -0
- package/checks/rule.js.map +1 -0
- package/checks/rules/max-bundle-size.js +9 -0
- package/checks/rules/max-bundle-size.js.map +1 -0
- package/checks/rules/no-dev-dependency-imports.js +9 -0
- package/checks/rules/no-dev-dependency-imports.js.map +1 -0
- package/checks/rules/no-duplicated-files.js +6 -38
- package/checks/rules/no-duplicated-files.js.map +1 -1
- package/checks/rules/no-side-effects.js +9 -0
- package/checks/rules/no-side-effects.js.map +1 -0
- package/checks/rules/no-unused-bundle-dependencies.js +9 -0
- package/checks/rules/no-unused-bundle-dependencies.js.map +1 -0
- package/checks/rules/registry.js +8 -0
- package/checks/rules/registry.js.map +1 -0
- package/checks/rules/required-files.js +10 -0
- package/checks/rules/required-files.js.map +1 -0
- package/checks/rules/unique-target-paths.js +9 -0
- package/checks/rules/unique-target-paths.js.map +1 -0
- package/common/clock.d.ts +7 -0
- package/common/clock.d.ts.map +1 -0
- package/common/clock.js +11 -0
- package/common/clock.js.map +1 -0
- package/common/code-files.js +5 -0
- package/common/code-files.js.map +1 -0
- package/config/additional-files.js +0 -4
- package/config/additional-files.js.map +1 -1
- package/config/additional-package-json-attributes-schema.js +7 -0
- package/config/additional-package-json-attributes-schema.js.map +1 -0
- package/config/automatic-versioning-settings.js +3 -0
- package/config/automatic-versioning-settings.js.map +1 -0
- package/config/checks-schema.d.ts +74 -0
- package/config/checks-schema.d.ts.map +1 -0
- package/config/checks-schema.js +27 -0
- package/config/checks-schema.js.map +1 -0
- package/config/common-package-settings-schemas.js +20 -0
- package/config/common-package-settings-schemas.js.map +1 -0
- package/config/config.d.ts +16 -704
- package/config/config.d.ts.map +1 -1
- package/config/config.js +1 -71
- package/config/config.js.map +1 -1
- package/config/dead-code-elimination-settings.d.ts +12 -0
- package/config/dead-code-elimination-settings.d.ts.map +1 -0
- package/config/dead-code-elimination-settings.js +3 -0
- package/config/dead-code-elimination-settings.js.map +1 -0
- package/config/dependency-policy.d.ts +6 -0
- package/config/dependency-policy.d.ts.map +1 -0
- package/config/dependency-policy.js +3 -0
- package/config/dependency-policy.js.map +1 -0
- package/config/main-package-json-schema.js +13 -0
- package/config/main-package-json-schema.js.map +1 -0
- package/config/manual-versioning-settings.js +3 -0
- package/config/manual-versioning-settings.js.map +1 -0
- package/config/optional-package-settings-schema.js +15 -0
- package/config/optional-package-settings-schema.js.map +1 -0
- package/config/package-config.d.ts +49 -0
- package/config/package-config.d.ts.map +1 -0
- package/config/package-config.js +1 -0
- package/config/package-config.js.map +1 -0
- package/config/package-interface.d.ts +36 -0
- package/config/package-interface.d.ts.map +1 -0
- package/config/package-interface.js +3 -0
- package/config/package-interface.js.map +1 -0
- package/config/package-json.d.ts +10 -10
- package/config/package-json.d.ts.map +1 -1
- package/config/package-json.js +0 -24
- package/config/package-json.js.map +1 -1
- package/config/package-schemas.js +10 -0
- package/config/package-schemas.js.map +1 -0
- package/config/packtory-config-schema.js +4 -0
- package/config/packtory-config-schema.js.map +1 -0
- package/config/packtory-config-without-registry-schema.js +32 -0
- package/config/packtory-config-without-registry-schema.js.map +1 -0
- package/config/per-package-settings-schema.js +22 -0
- package/config/per-package-settings-schema.js.map +1 -0
- package/config/publish-settings.d.ts +22 -0
- package/config/publish-settings.d.ts.map +1 -0
- package/config/publish-settings.js +4 -0
- package/config/publish-settings.js.map +1 -0
- package/config/publish-settings.report.js +17 -0
- package/config/publish-settings.report.js.map +1 -0
- package/config/registry-settings.d.ts +63 -1
- package/config/registry-settings.d.ts.map +1 -1
- package/config/registry-settings.js +0 -4
- package/config/registry-settings.js.map +1 -1
- package/config/registry-settings.report.js +41 -0
- package/config/registry-settings.report.js.map +1 -0
- package/config/root.d.ts +7 -0
- package/config/root.d.ts.map +1 -0
- package/config/root.js +3 -0
- package/config/root.js.map +1 -0
- package/config/sbom-settings.js +2 -0
- package/config/sbom-settings.js.map +1 -0
- package/config/validation.d.ts +2 -2
- package/config/validation.d.ts.map +1 -1
- package/config/validation.js +4 -118
- package/config/validation.js.map +1 -1
- package/config/versioning-settings.d.ts.map +1 -1
- package/config/versioning-settings.js +2 -10
- package/config/versioning-settings.js.map +1 -1
- package/dead-code-eliminator/analyzed-bundle.d.ts +29 -0
- package/dead-code-eliminator/analyzed-bundle.d.ts.map +1 -0
- package/dead-code-eliminator/analyzed-bundle.js +1 -0
- package/dead-code-eliminator/analyzed-bundle.js.map +1 -0
- package/dead-code-eliminator/cross-bundle/cross-bundle-seeds.js +126 -0
- package/dead-code-eliminator/cross-bundle/cross-bundle-seeds.js.map +1 -0
- package/dead-code-eliminator/elimination-emitter.js +53 -0
- package/dead-code-eliminator/elimination-emitter.js.map +1 -0
- package/dead-code-eliminator/eliminator.js +142 -0
- package/dead-code-eliminator/eliminator.js.map +1 -0
- package/dead-code-eliminator/load-bundle.js +53 -0
- package/dead-code-eliminator/load-bundle.js.map +1 -0
- package/dead-code-eliminator/reachability/binding-extractor.js +88 -0
- package/dead-code-eliminator/reachability/binding-extractor.js.map +1 -0
- package/dead-code-eliminator/reachability/impure-statements.js +12 -0
- package/dead-code-eliminator/reachability/impure-statements.js.map +1 -0
- package/dead-code-eliminator/reachability/reachability.js +141 -0
- package/dead-code-eliminator/reachability/reachability.js.map +1 -0
- package/dead-code-eliminator/side-effect-classifier.js +406 -0
- package/dead-code-eliminator/side-effect-classifier.js.map +1 -0
- package/dead-code-eliminator/side-effects-field.js +25 -0
- package/dead-code-eliminator/side-effects-field.js.map +1 -0
- package/dead-code-eliminator/transform/atom-translator.js +13 -0
- package/dead-code-eliminator/transform/atom-translator.js.map +1 -0
- package/dead-code-eliminator/transform/declaration-remover.js +92 -0
- package/dead-code-eliminator/transform/declaration-remover.js.map +1 -0
- package/dead-code-eliminator/transform/line-index.js +27 -0
- package/dead-code-eliminator/transform/line-index.js.map +1 -0
- package/dead-code-eliminator/transform/source-map-composer.js +68 -0
- package/dead-code-eliminator/transform/source-map-composer.js.map +1 -0
- package/dependency-scanner/dependency-graph.d.ts +1 -3
- package/dependency-scanner/dependency-graph.d.ts.map +1 -1
- package/dependency-scanner/dependency-graph.js +1 -76
- 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 +1 -17
- package/dependency-scanner/external-dependencies.js.map +1 -1
- package/dependency-scanner/scanner.d.ts +7 -7
- package/dependency-scanner/scanner.d.ts.map +1 -1
- package/dependency-scanner/scanner.js +1 -75
- package/dependency-scanner/scanner.js.map +1 -1
- package/dependency-scanner/source-file-references.js +2 -73
- package/dependency-scanner/source-file-references.js.map +1 -1
- package/dependency-scanner/source-map-file-locator.d.ts.map +1 -1
- package/dependency-scanner/source-map-file-locator.js +0 -20
- package/dependency-scanner/source-map-file-locator.js.map +1 -1
- package/dependency-scanner/typescript-file-host.d.ts +2 -0
- package/dependency-scanner/typescript-file-host.d.ts.map +1 -1
- package/dependency-scanner/typescript-file-host.js +1 -48
- package/dependency-scanner/typescript-file-host.js.map +1 -1
- package/dependency-scanner/typescript-project-analyzer.d.ts +4 -6
- package/dependency-scanner/typescript-project-analyzer.d.ts.map +1 -1
- package/dependency-scanner/typescript-project-analyzer.js +0 -64
- package/dependency-scanner/typescript-project-analyzer.js.map +1 -1
- package/directed-graph/graph.d.ts +1 -2
- package/directed-graph/graph.d.ts.map +1 -1
- package/directed-graph/graph.js +0 -194
- package/directed-graph/graph.js.map +1 -1
- package/file-manager/compare.js +1 -16
- 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.d.ts +1 -1
- package/file-manager/file-manager.d.ts.map +1 -1
- package/file-manager/file-manager.js +0 -46
- package/file-manager/file-manager.js.map +1 -1
- package/file-manager/permissions.js +0 -12
- package/file-manager/permissions.js.map +1 -1
- package/linker/linked-bundle.d.ts +5 -3
- package/linker/linked-bundle.d.ts.map +1 -1
- package/linker/linker.d.ts.map +1 -1
- package/linker/linker.js +0 -22
- package/linker/linker.js.map +1 -1
- package/linker/resource-graph.js +1 -29
- package/linker/resource-graph.js.map +1 -1
- package/linker/source-modifier/import-paths.js +0 -33
- package/linker/source-modifier/import-paths.js.map +1 -1
- package/linker/substitute-bundles.js +1 -73
- package/linker/substitute-bundles.js.map +1 -1
- package/linker/substituted-resource-graph.js +1 -76
- package/linker/substituted-resource-graph.js.map +1 -1
- package/npm-oidc-id-token-resolver.js +56 -0
- package/npm-oidc-id-token-resolver.js.map +1 -0
- package/package-surface/modules.js +89 -0
- package/package-surface/modules.js.map +1 -0
- package/package-surface/public-module-usage.js +37 -0
- package/package-surface/public-module-usage.js.map +1 -0
- package/package-surface/surface.d.ts +12 -0
- package/package-surface/surface.d.ts.map +1 -0
- package/package-surface/surface.js +1 -0
- package/package-surface/surface.js.map +1 -0
- package/package.json +53 -11
- package/packages/package-processor.composition.js +127 -0
- package/packages/package-processor.composition.js.map +1 -0
- package/packages/packtory/packtory.entry-point.d.ts +10 -5
- package/packages/packtory/packtory.entry-point.d.ts.map +1 -1
- package/packages/packtory/packtory.entry-point.js +7 -43
- package/packages/packtory/packtory.entry-point.js.map +1 -1
- package/packtory/map-config.d.ts +7 -16
- package/packtory/map-config.d.ts.map +1 -1
- package/packtory/map-config.js +1 -70
- 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 +3 -0
- package/packtory/package-processor-build.js.map +1 -0
- package/packtory/package-processor-publish.d.ts +18 -0
- package/packtory/package-processor-publish.d.ts.map +1 -0
- package/packtory/package-processor-publish.js +1 -0
- package/packtory/package-processor-publish.js.map +1 -0
- package/packtory/package-processor.d.ts +17 -21
- package/packtory/package-processor.d.ts.map +1 -1
- package/packtory/package-processor.js +2 -85
- package/packtory/package-processor.js.map +1 -1
- package/packtory/packtory-publish.js +66 -0
- package/packtory/packtory-publish.js.map +1 -0
- package/packtory/packtory-resolve.js +84 -0
- package/packtory/packtory-resolve.js.map +1 -0
- package/packtory/packtory-results.d.ts +47 -0
- package/packtory/packtory-results.d.ts.map +1 -0
- package/packtory/packtory-results.js +1 -0
- package/packtory/packtory-results.js.map +1 -0
- package/packtory/packtory.d.ts +16 -37
- package/packtory/packtory.d.ts.map +1 -1
- package/packtory/packtory.js +33 -114
- package/packtory/packtory.js.map +1 -1
- package/packtory/prepare-package-options.d.ts +16 -0
- package/packtory/prepare-package-options.d.ts.map +1 -0
- package/packtory/prepare-package-options.js +5 -0
- package/packtory/prepare-package-options.js.map +1 -0
- package/packtory/report-attachment.js +25 -0
- package/packtory/report-attachment.js.map +1 -0
- package/packtory/resolved-package.d.ts +17 -0
- package/packtory/resolved-package.d.ts.map +1 -0
- package/packtory/resolved-package.js +4 -0
- package/packtory/resolved-package.js.map +1 -0
- package/packtory/scheduler.d.ts.map +1 -1
- package/packtory/scheduler.js +17 -15
- package/packtory/scheduler.js.map +1 -1
- package/progress/progress-broadcaster.d.ts +128 -5
- package/progress/progress-broadcaster.d.ts.map +1 -1
- package/progress/progress-broadcaster.js +0 -16
- package/progress/progress-broadcaster.js.map +1 -1
- package/report/artifact-entry-merger.js +2 -0
- package/report/artifact-entry-merger.js.map +1 -0
- package/report/config-redactor.js +27 -0
- package/report/config-redactor.js.map +1 -0
- package/report/decorators.js +68 -0
- package/report/decorators.js.map +1 -0
- package/report/inspectors.js +1 -0
- package/report/inspectors.js.map +1 -0
- package/report/report-aggregator.d.ts +61 -0
- package/report/report-aggregator.d.ts.map +1 -0
- package/report/report-aggregator.js +2 -0
- package/report/report-aggregator.js.map +1 -0
- package/resource-resolver/content.js +1 -40
- package/resource-resolver/content.js.map +1 -1
- package/resource-resolver/resolved-bundle.d.ts +4 -2
- package/resource-resolver/resolved-bundle.d.ts.map +1 -1
- package/resource-resolver/resource-resolve-options.d.ts +12 -5
- package/resource-resolver/resource-resolve-options.d.ts.map +1 -1
- package/resource-resolver/resource-resolve-options.js +2 -0
- package/resource-resolver/resource-resolve-options.js.map +1 -0
- package/resource-resolver/resource-resolver.d.ts +1 -1
- package/resource-resolver/resource-resolver.d.ts.map +1 -1
- package/resource-resolver/resource-resolver.js +1 -64
- package/resource-resolver/resource-resolver.js.map +1 -1
- package/sbom/extract-license.js +2 -0
- package/sbom/extract-license.js.map +1 -0
- package/sbom/license-resolver.d.ts +14 -0
- package/sbom/license-resolver.d.ts.map +1 -0
- package/sbom/license-resolver.js +3 -0
- package/sbom/license-resolver.js.map +1 -0
- package/sbom/sbom-builder.js +68 -0
- package/sbom/sbom-builder.js.map +1 -0
- package/sbom/sbom-file.d.ts +19 -0
- package/sbom/sbom-file.d.ts.map +1 -0
- package/sbom/sbom-file.js +3 -0
- package/sbom/sbom-file.js.map +1 -0
- package/sbom/sbom-serializer.d.ts +6 -0
- package/sbom/sbom-serializer.d.ts.map +1 -0
- package/sbom/sbom-serializer.js +2 -0
- package/sbom/sbom-serializer.js.map +1 -0
- package/sbom/tool-version.js +44 -0
- package/sbom/tool-version.js.map +1 -0
- package/sbom.cdx.json +390 -0
- package/tar/extract-tar.js +0 -13
- package/tar/extract-tar.js.map +1 -1
- package/tar/tarball-builder.d.ts.map +1 -1
- package/tar/tarball-builder.js +10 -7
- package/tar/tarball-builder.js.map +1 -1
- package/version-manager/manager.d.ts +5 -1
- package/version-manager/manager.d.ts.map +1 -1
- package/version-manager/manager.js +1 -39
- package/version-manager/manager.js.map +1 -1
- package/version-manager/manifest/builder.js +2 -12
- package/version-manager/manifest/builder.js.map +1 -1
- package/version-manager/manifest/serialize.js +1 -55
- package/version-manager/manifest/serialize.js.map +1 -1
- package/version-manager/manifest/sort-values.js +1 -0
- package/version-manager/manifest/sort-values.js.map +1 -0
- package/version-manager/specifier-classifier.js +2 -0
- package/version-manager/specifier-classifier.js.map +1 -0
- package/version-manager/specifier-errors.js +1 -0
- package/version-manager/specifier-errors.js.map +1 -0
- package/version-manager/versioned-bundle-dependencies.js +5 -0
- package/version-manager/versioned-bundle-dependencies.js.map +1 -0
- package/version-manager/versioned-bundle-imports.d.ts +4 -0
- package/version-manager/versioned-bundle-imports.d.ts.map +1 -0
- package/version-manager/versioned-bundle-imports.js +3 -0
- package/version-manager/versioned-bundle-imports.js.map +1 -0
- package/version-manager/versioned-bundle.d.ts +16 -9
- package/version-manager/versioned-bundle.d.ts.map +1 -1
- package/version-manager/versioned-bundle.js +4 -78
- package/version-manager/versioned-bundle.js.map +1 -1
- package/config/entry-point.d.ts +0 -7
- package/config/entry-point.d.ts.map +0 -1
- package/config/entry-point.js +0 -7
- package/config/entry-point.js.map +0 -1
- package/file-manager/sort.js +0 -13
- package/file-manager/sort.js.map +0 -1
- package/list/unique-list.js +0 -5
- package/list/unique-list.js.map +0 -1
- package/version-manager/manifest/builder.d.ts +0 -5
- package/version-manager/manifest/builder.d.ts.map +0 -1
|
@@ -1,67 +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 { moduleResolution, 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: moduleResolution === 'module' ? ModuleKind.Node16 : ModuleKind.CommonJS
|
|
18
|
-
};
|
|
19
|
-
if (!resolveDeclarationFiles) {
|
|
20
|
-
compilerOptions.types = [];
|
|
21
|
-
compilerOptions.typeRoots = [];
|
|
22
|
-
}
|
|
23
|
-
return compilerOptions;
|
|
24
|
-
}
|
|
25
|
-
export function createTypescriptProjectAnalyzer(dependencies) {
|
|
26
|
-
const { fileSystemAdapters, Project, getReferencedSourceFiles } = dependencies;
|
|
27
|
-
return {
|
|
28
|
-
analyzeProject(folder, options) {
|
|
29
|
-
const project = new Project({
|
|
30
|
-
compilerOptions: analyzationOptionsToCompilerOptions(options),
|
|
31
|
-
fileSystem: options.resolveDeclarationFiles
|
|
32
|
-
? fileSystemAdapters.fileSystemHostWithoutFilter
|
|
33
|
-
: fileSystemAdapters.fileSystemHostFilteringDeclarationFiles
|
|
34
|
-
});
|
|
35
|
-
const fileExtension = options.resolveDeclarationFiles ? '.d.ts' : '.js';
|
|
36
|
-
const filesPattern = path.join(folder, `**/*${fileExtension}`);
|
|
37
|
-
project.addSourceFilesAtPaths([filesPattern]);
|
|
38
|
-
if (options.failOnCompileErrors) {
|
|
39
|
-
const diagnostics = project.getPreEmitDiagnostics();
|
|
40
|
-
if (diagnostics.length > 0) {
|
|
41
|
-
throw new Error('Failed to analyze source files');
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
return {
|
|
45
|
-
getReferencedSourceFilePaths(containingSourceFilePath) {
|
|
46
|
-
const currentSourceFile = project.getSourceFile(containingSourceFilePath);
|
|
47
|
-
if (currentSourceFile === undefined) {
|
|
48
|
-
return [];
|
|
49
|
-
}
|
|
50
|
-
const referencedSourceFilePaths = getReferencedSourceFiles(currentSourceFile).map(getSourcePathFromSourceFile);
|
|
51
|
-
return referencedSourceFilePaths;
|
|
52
|
-
},
|
|
53
|
-
getSourceFile(filePath) {
|
|
54
|
-
const sourceFile = project.getSourceFile(filePath);
|
|
55
|
-
if (sourceFile === undefined) {
|
|
56
|
-
throw new Error(`Failed to find source file for "${filePath}"`);
|
|
57
|
-
}
|
|
58
|
-
return sourceFile;
|
|
59
|
-
},
|
|
60
|
-
getProject() {
|
|
61
|
-
return project;
|
|
62
|
-
}
|
|
63
|
-
};
|
|
64
|
-
}
|
|
65
|
-
};
|
|
66
|
-
}
|
|
67
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"}
|
|
@@ -5,7 +5,7 @@ type GraphNode<TId extends GraphNodeId, TData> = {
|
|
|
5
5
|
readonly adjacentNodeIds: Set<TId>;
|
|
6
6
|
readonly incomingEdges: number;
|
|
7
7
|
};
|
|
8
|
-
|
|
8
|
+
type GraphEdge<TId extends GraphNodeId> = {
|
|
9
9
|
readonly from: TId;
|
|
10
10
|
readonly to: TId;
|
|
11
11
|
};
|
|
@@ -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":"
|
|
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,195 +1 @@
|
|
|
1
|
-
function addAdjacentNodeId(node, idToAdd) {
|
|
2
|
-
return {
|
|
3
|
-
id: node.id,
|
|
4
|
-
data: node.data,
|
|
5
|
-
incomingEdges: node.incomingEdges,
|
|
6
|
-
adjacentNodeIds: new Set([...node.adjacentNodeIds, idToAdd])
|
|
7
|
-
};
|
|
8
|
-
}
|
|
9
|
-
function removeAdjacentNodeId(node, idToRemove) {
|
|
10
|
-
const adjacentNodeIds = new Set(node.adjacentNodeIds);
|
|
11
|
-
adjacentNodeIds.delete(idToRemove);
|
|
12
|
-
return {
|
|
13
|
-
id: node.id,
|
|
14
|
-
data: node.data,
|
|
15
|
-
incomingEdges: node.incomingEdges,
|
|
16
|
-
adjacentNodeIds
|
|
17
|
-
};
|
|
18
|
-
}
|
|
19
|
-
function increaseIncomingEdges(node) {
|
|
20
|
-
return {
|
|
21
|
-
id: node.id,
|
|
22
|
-
data: node.data,
|
|
23
|
-
adjacentNodeIds: node.adjacentNodeIds,
|
|
24
|
-
incomingEdges: node.incomingEdges + 1
|
|
25
|
-
};
|
|
26
|
-
}
|
|
27
|
-
function decreaseIncomingEdges(node) {
|
|
28
|
-
return {
|
|
29
|
-
id: node.id,
|
|
30
|
-
data: node.data,
|
|
31
|
-
adjacentNodeIds: node.adjacentNodeIds,
|
|
32
|
-
incomingEdges: node.incomingEdges - 1
|
|
33
|
-
};
|
|
34
|
-
}
|
|
35
|
-
function getNonVisitedAdjacentIds(node, visited) {
|
|
36
|
-
return Array.from(node.adjacentNodeIds).filter((id) => {
|
|
37
|
-
return !visited.has(id);
|
|
38
|
-
});
|
|
39
|
-
}
|
|
40
|
-
export function createDirectedGraph() {
|
|
41
|
-
const nodes = new Map();
|
|
42
|
-
function getNode(id) {
|
|
43
|
-
const node = nodes.get(id);
|
|
44
|
-
if (node === undefined) {
|
|
45
|
-
throw new Error(`Node with id "${id}" does not exist`);
|
|
46
|
-
}
|
|
47
|
-
return node;
|
|
48
|
-
}
|
|
49
|
-
function getIncomingEdgesPerNode() {
|
|
50
|
-
const incomingEdgesPerNode = new Map();
|
|
51
|
-
for (const node of nodes.values()) {
|
|
52
|
-
incomingEdgesPerNode.set(node.id, node.incomingEdges);
|
|
53
|
-
}
|
|
54
|
-
return incomingEdgesPerNode;
|
|
55
|
-
}
|
|
56
|
-
function decreaseIncomingEdgesPerNodeForAdjacentNodes(incomingEdgesPerNode, ids) {
|
|
57
|
-
const newIncomingEdgesPerNode = new Map(incomingEdgesPerNode);
|
|
58
|
-
for (const id of ids) {
|
|
59
|
-
const node = getNode(id);
|
|
60
|
-
for (const adjacentNodeId of node.adjacentNodeIds) {
|
|
61
|
-
const degree = newIncomingEdgesPerNode.get(adjacentNodeId) ?? 0;
|
|
62
|
-
newIncomingEdgesPerNode.set(adjacentNodeId, degree - 1);
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
return newIncomingEdgesPerNode;
|
|
66
|
-
}
|
|
67
|
-
function detectCyclesForNode(baseNode, visitedIds) {
|
|
68
|
-
const newVisitedIds = [...visitedIds, baseNode.id];
|
|
69
|
-
if (visitedIds.includes(baseNode.id)) {
|
|
70
|
-
return [newVisitedIds];
|
|
71
|
-
}
|
|
72
|
-
const cycles = [];
|
|
73
|
-
for (const id of baseNode.adjacentNodeIds) {
|
|
74
|
-
const cyclesInAdjacentNode = detectCyclesForNode(getNode(id), newVisitedIds);
|
|
75
|
-
cycles.push(...cyclesInAdjacentNode);
|
|
76
|
-
}
|
|
77
|
-
return cycles;
|
|
78
|
-
}
|
|
79
|
-
function detectCycles() {
|
|
80
|
-
const cycles = [];
|
|
81
|
-
const idsWithinCycles = new Set();
|
|
82
|
-
for (const baseNode of nodes.values()) {
|
|
83
|
-
if (!idsWithinCycles.has(baseNode.id)) {
|
|
84
|
-
const cyclesForNode = detectCyclesForNode(baseNode, []);
|
|
85
|
-
if (cyclesForNode.length > 0) {
|
|
86
|
-
cycles.push(...cyclesForNode);
|
|
87
|
-
for (const id of cyclesForNode.flat()) {
|
|
88
|
-
idsWithinCycles.add(id);
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
return cycles;
|
|
94
|
-
}
|
|
95
|
-
function isCyclic() {
|
|
96
|
-
const cycles = detectCycles();
|
|
97
|
-
return cycles.length > 0;
|
|
98
|
-
}
|
|
99
|
-
function recursivelyGetTopologicalGenerations(alreadyDiscovered, incomingEdgesPerNode) {
|
|
100
|
-
const currentGeneration = [];
|
|
101
|
-
for (const node of nodes.values()) {
|
|
102
|
-
if (!alreadyDiscovered.has(node.id) && incomingEdgesPerNode.get(node.id) === 0) {
|
|
103
|
-
currentGeneration.push(node.id);
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
if (currentGeneration.length > 0) {
|
|
107
|
-
const newIncomingEdgesPerNode = decreaseIncomingEdgesPerNodeForAdjacentNodes(incomingEdgesPerNode, currentGeneration);
|
|
108
|
-
const currentlyDiscovered = new Set([...alreadyDiscovered, ...currentGeneration]);
|
|
109
|
-
const generations = recursivelyGetTopologicalGenerations(currentlyDiscovered, newIncomingEdgesPerNode);
|
|
110
|
-
return [currentGeneration, ...generations];
|
|
111
|
-
}
|
|
112
|
-
return [];
|
|
113
|
-
}
|
|
114
|
-
function visitBreadthFirstSearch(startId, visitor) {
|
|
115
|
-
const startNode = getNode(startId);
|
|
116
|
-
const queue = [startNode];
|
|
117
|
-
const visited = new Set();
|
|
118
|
-
for (let head = queue.shift(); head !== undefined; head = queue.shift()) {
|
|
119
|
-
visited.add(head.id);
|
|
120
|
-
visitor(head);
|
|
121
|
-
const nonVisitedAdjacentIds = getNonVisitedAdjacentIds(head, visited);
|
|
122
|
-
for (const id of nonVisitedAdjacentIds) {
|
|
123
|
-
const adjacentNode = getNode(id);
|
|
124
|
-
queue.push(adjacentNode);
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
return {
|
|
129
|
-
addNode(id, data) {
|
|
130
|
-
if (nodes.has(id)) {
|
|
131
|
-
throw new Error(`Node with id "${id}" already exists`);
|
|
132
|
-
}
|
|
133
|
-
nodes.set(id, { id, data, adjacentNodeIds: new Set(), incomingEdges: 0 });
|
|
134
|
-
},
|
|
135
|
-
getAdjacentIds(id) {
|
|
136
|
-
const node = getNode(id);
|
|
137
|
-
return node.adjacentNodeIds;
|
|
138
|
-
},
|
|
139
|
-
hasNode(id) {
|
|
140
|
-
return nodes.has(id);
|
|
141
|
-
},
|
|
142
|
-
hasConnection(edge) {
|
|
143
|
-
const fromNode = getNode(edge.from);
|
|
144
|
-
return fromNode.adjacentNodeIds.has(edge.to);
|
|
145
|
-
},
|
|
146
|
-
connect(edge) {
|
|
147
|
-
const fromNode = getNode(edge.from);
|
|
148
|
-
const toNode = getNode(edge.to);
|
|
149
|
-
if (fromNode.adjacentNodeIds.has(toNode.id)) {
|
|
150
|
-
throw new Error(`Edge from "${edge.from}" to "${toNode.id}" already exists`);
|
|
151
|
-
}
|
|
152
|
-
nodes.set(edge.from, addAdjacentNodeId(fromNode, toNode.id));
|
|
153
|
-
nodes.set(edge.to, increaseIncomingEdges(getNode(edge.to)));
|
|
154
|
-
},
|
|
155
|
-
disconnect(edge) {
|
|
156
|
-
const fromNode = getNode(edge.from);
|
|
157
|
-
const toNode = getNode(edge.to);
|
|
158
|
-
if (!fromNode.adjacentNodeIds.has(toNode.id)) {
|
|
159
|
-
throw new Error(`Edge from "${edge.from}" to "${toNode.id}" does not exist`);
|
|
160
|
-
}
|
|
161
|
-
nodes.set(edge.from, removeAdjacentNodeId(fromNode, toNode.id));
|
|
162
|
-
nodes.set(edge.to, decreaseIncomingEdges(toNode));
|
|
163
|
-
},
|
|
164
|
-
visitBreadthFirstSearch,
|
|
165
|
-
traverse(visitor) {
|
|
166
|
-
for (const [nodeId, node] of nodes) {
|
|
167
|
-
if (node.incomingEdges === 0) {
|
|
168
|
-
visitBreadthFirstSearch(nodeId, visitor);
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
},
|
|
172
|
-
detectCycles,
|
|
173
|
-
isCyclic,
|
|
174
|
-
getTopologicalGenerations() {
|
|
175
|
-
if (isCyclic()) {
|
|
176
|
-
throw new Error('Failed to determine topological generations, current graph is cyclic');
|
|
177
|
-
}
|
|
178
|
-
const incomingEdgesPerNode = getIncomingEdgesPerNode();
|
|
179
|
-
return recursivelyGetTopologicalGenerations(new Set(), incomingEdgesPerNode);
|
|
180
|
-
},
|
|
181
|
-
reverse() {
|
|
182
|
-
const reversedGraph = createDirectedGraph();
|
|
183
|
-
for (const node of nodes.values()) {
|
|
184
|
-
reversedGraph.addNode(node.id, node.data);
|
|
185
|
-
}
|
|
186
|
-
for (const node of nodes.values()) {
|
|
187
|
-
for (const adjacentNodeId of node.adjacentNodeIds) {
|
|
188
|
-
reversedGraph.connect({ from: adjacentNodeId, to: node.id });
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
return reversedGraph;
|
|
192
|
-
}
|
|
193
|
-
};
|
|
194
|
-
}
|
|
195
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,18 +1,3 @@
|
|
|
1
|
+
import { sortBy } from 'remeda';
|
|
1
2
|
import { areFileDescriptionEqual } from "./equal.js";
|
|
2
|
-
import { sortByFilePath } from "./sort.js";
|
|
3
|
-
export function compareFileDescriptions(fileDescriptionsA, fileDescriptionsB) {
|
|
4
|
-
if (fileDescriptionsA.length !== fileDescriptionsB.length) {
|
|
5
|
-
return { status: 'not-equal' };
|
|
6
|
-
}
|
|
7
|
-
const sortedFileDescriptionsA = sortByFilePath(fileDescriptionsA);
|
|
8
|
-
const sortedFileDescriptionsB = sortByFilePath(fileDescriptionsB);
|
|
9
|
-
const areAllFileDescriptionsEqual = sortedFileDescriptionsA.every((fileDescriptionA, index) => {
|
|
10
|
-
const fileDescriptionB = sortedFileDescriptionsB[index];
|
|
11
|
-
return fileDescriptionB !== undefined && areFileDescriptionEqual(fileDescriptionA, fileDescriptionB);
|
|
12
|
-
});
|
|
13
|
-
if (areAllFileDescriptionsEqual) {
|
|
14
|
-
return { status: 'equal' };
|
|
15
|
-
}
|
|
16
|
-
return { status: 'not-equal' };
|
|
17
|
-
}
|
|
18
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,
|
|
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":""}
|
|
@@ -10,8 +10,8 @@ export type FileManager = {
|
|
|
10
10
|
checkReadability: (fileOrFolderPath: string) => Promise<FileOrFolderReadability>;
|
|
11
11
|
readFile: (filePath: string) => Promise<string>;
|
|
12
12
|
writeFile: (filePath: string, content: string) => Promise<void>;
|
|
13
|
+
setExecutable: (filePath: string, executable: boolean) => Promise<void>;
|
|
13
14
|
copyFile: (from: string, to: string) => Promise<void>;
|
|
14
|
-
getFileMode: (filePath: string) => Promise<number>;
|
|
15
15
|
getTransferableFileDescriptionFromPath: (sourceFilePath: string, targetFilePath: string) => Promise<TransferableFileDescription>;
|
|
16
16
|
};
|
|
17
17
|
export declare function createFileManager(dependencies: FileManagerDependencies): FileManager;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"file-manager.d.ts","sourceRoot":"","sources":["../../../../source/file-manager/file-manager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AAEzB,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,uBAAuB,CAAC;AAGzE,MAAM,MAAM,uBAAuB,GAAG;IAClC,QAAQ,CAAC,cAAc,EAAE,OAAO,EAAE,CAAC,QAAQ,CAAC;CAC/C,CAAC;AAEF,KAAK,uBAAuB,GAAG;IAC3B,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC;CAChC,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG;IACtB,gBAAgB,EAAE,CAAC,gBAAgB,EAAE,MAAM,KAAK,OAAO,CAAC,uBAAuB,CAAC,CAAC;IACjF,QAAQ,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;IAChD,SAAS,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAChE,
|
|
1
|
+
{"version":3,"file":"file-manager.d.ts","sourceRoot":"","sources":["../../../../source/file-manager/file-manager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AAEzB,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,uBAAuB,CAAC;AAGzE,MAAM,MAAM,uBAAuB,GAAG;IAClC,QAAQ,CAAC,cAAc,EAAE,OAAO,EAAE,CAAC,QAAQ,CAAC;CAC/C,CAAC;AAEF,KAAK,uBAAuB,GAAG;IAC3B,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC;CAChC,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG;IACtB,gBAAgB,EAAE,CAAC,gBAAgB,EAAE,MAAM,KAAK,OAAO,CAAC,uBAAuB,CAAC,CAAC;IACjF,QAAQ,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;IAChD,SAAS,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAChE,aAAa,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,OAAO,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACxE,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACtD,sCAAsC,EAAE,CACpC,cAAc,EAAE,MAAM,EACtB,cAAc,EAAE,MAAM,KACrB,OAAO,CAAC,2BAA2B,CAAC,CAAC;CAC7C,CAAC;AAKF,wBAAgB,iBAAiB,CAAC,YAAY,EAAE,uBAAuB,GAAG,WAAW,CA8DpF"}
|
|
@@ -1,50 +1,4 @@
|
|
|
1
1
|
import fs from 'node:fs';
|
|
2
2
|
import path from 'node:path';
|
|
3
3
|
import { isExecutableFileMode } from "./permissions.js";
|
|
4
|
-
export function createFileManager(dependencies) {
|
|
5
|
-
const { hostFileSystem } = dependencies;
|
|
6
|
-
async function checkReadability(fileOrFolderPath) {
|
|
7
|
-
try {
|
|
8
|
-
await hostFileSystem.access(fileOrFolderPath, fs.constants.R_OK);
|
|
9
|
-
return { isReadable: true };
|
|
10
|
-
}
|
|
11
|
-
catch {
|
|
12
|
-
return { isReadable: false };
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
async function writeFile(filePath, content) {
|
|
16
|
-
const containingFolder = path.dirname(filePath);
|
|
17
|
-
const parentReadability = await checkReadability(containingFolder);
|
|
18
|
-
if (!parentReadability.isReadable) {
|
|
19
|
-
await hostFileSystem.mkdir(containingFolder, { recursive: true });
|
|
20
|
-
}
|
|
21
|
-
await hostFileSystem.writeFile(filePath, content, { encoding: 'utf8' });
|
|
22
|
-
}
|
|
23
|
-
async function readFile(filePath) {
|
|
24
|
-
return hostFileSystem.readFile(filePath, { encoding: 'utf8' });
|
|
25
|
-
}
|
|
26
|
-
async function getFileMode(filePath) {
|
|
27
|
-
const stats = await hostFileSystem.stat(filePath);
|
|
28
|
-
return stats.mode;
|
|
29
|
-
}
|
|
30
|
-
return {
|
|
31
|
-
checkReadability,
|
|
32
|
-
writeFile,
|
|
33
|
-
readFile,
|
|
34
|
-
getFileMode,
|
|
35
|
-
async getTransferableFileDescriptionFromPath(sourceFilePath, targetFilePath) {
|
|
36
|
-
const mode = await getFileMode(sourceFilePath);
|
|
37
|
-
return {
|
|
38
|
-
sourceFilePath,
|
|
39
|
-
targetFilePath,
|
|
40
|
-
content: await readFile(sourceFilePath),
|
|
41
|
-
isExecutable: isExecutableFileMode(mode)
|
|
42
|
-
};
|
|
43
|
-
},
|
|
44
|
-
async copyFile(from, to) {
|
|
45
|
-
const content = await readFile(from);
|
|
46
|
-
await writeFile(to, content);
|
|
47
|
-
}
|
|
48
|
-
};
|
|
49
|
-
}
|
|
50
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,14 +1,2 @@
|
|
|
1
1
|
import { convert } from 'unix-permissions';
|
|
2
|
-
// eslint-disable-next-line complexity -- needs to be refactored
|
|
3
|
-
export function isExecutableFileMode(mode) {
|
|
4
|
-
try {
|
|
5
|
-
const permissions = convert.object(mode);
|
|
6
|
-
return (permissions.user?.execute === true &&
|
|
7
|
-
permissions.group?.execute === true &&
|
|
8
|
-
permissions.others?.execute === true);
|
|
9
|
-
}
|
|
10
|
-
catch {
|
|
11
|
-
return false;
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
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"}
|
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
import type { ExternalDependencies } from '../dependency-scanner/external-dependencies.ts';
|
|
2
|
-
import type {
|
|
2
|
+
import type { PackageSurface } from '../package-surface/surface.ts';
|
|
3
|
+
import type { BundleResource, RootFileDescription } from '../resource-resolver/resolved-bundle.ts';
|
|
3
4
|
export type LinkedBundleResource = BundleResource & {
|
|
4
5
|
readonly isSubstituted: boolean;
|
|
5
6
|
};
|
|
6
7
|
export type LinkedBundle = {
|
|
7
8
|
readonly name: string;
|
|
8
9
|
readonly contents: readonly LinkedBundleResource[];
|
|
9
|
-
readonly
|
|
10
|
+
readonly roots: Readonly<Record<string, RootFileDescription>>;
|
|
11
|
+
readonly surface: PackageSurface;
|
|
10
12
|
readonly linkedBundleDependencies: ExternalDependencies;
|
|
11
13
|
readonly externalDependencies: ExternalDependencies;
|
|
12
14
|
};
|
|
13
|
-
export type BundleSubstitutionSource = Pick<LinkedBundle, 'contents' | 'name'>;
|
|
15
|
+
export type BundleSubstitutionSource = Pick<LinkedBundle, 'contents' | 'name' | 'roots' | 'surface'>;
|
|
14
16
|
//# sourceMappingURL=linked-bundle.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"linked-bundle.d.ts","sourceRoot":"","sources":["../../../../source/linker/linked-bundle.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,gDAAgD,CAAC;AAC3F,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,yCAAyC,CAAC;
|
|
1
|
+
{"version":3,"file":"linked-bundle.d.ts","sourceRoot":"","sources":["../../../../source/linker/linked-bundle.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,gDAAgD,CAAC;AAC3F,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AACpE,OAAO,KAAK,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,yCAAyC,CAAC;AAEnG,MAAM,MAAM,oBAAoB,GAAG,cAAc,GAAG;IAChD,QAAQ,CAAC,aAAa,EAAE,OAAO,CAAC;CACnC,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG;IACvB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,QAAQ,EAAE,SAAS,oBAAoB,EAAE,CAAC;IACnD,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,mBAAmB,CAAC,CAAC,CAAC;IAC9D,QAAQ,CAAC,OAAO,EAAE,cAAc,CAAC;IACjC,QAAQ,CAAC,wBAAwB,EAAE,oBAAoB,CAAC;IACxD,QAAQ,CAAC,oBAAoB,EAAE,oBAAoB,CAAC;CACvD,CAAC;AAEF,MAAM,MAAM,wBAAwB,GAAG,IAAI,CAAC,YAAY,EAAE,UAAU,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,CAAC,CAAC"}
|
package/linker/linker.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"linker.d.ts","sourceRoot":"","sources":["../../../../source/linker/linker.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yCAAyC,CAAC;AAE9E,OAAO,KAAK,EAAE,wBAAwB,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAGjF,KAAK,iBAAiB,GAAG;IACrB,QAAQ,CAAC,MAAM,EAAE,cAAc,CAAC;IAChC,QAAQ,CAAC,kBAAkB,EAAE,SAAS,wBAAwB,EAAE,CAAC;CACpE,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG;IACvB,UAAU,EAAE,CAAC,OAAO,EAAE,iBAAiB,KAAK,OAAO,CAAC,YAAY,CAAC,CAAC;CACrE,CAAC;AAWF,wBAAgB,kBAAkB,IAAI,YAAY,
|
|
1
|
+
{"version":3,"file":"linker.d.ts","sourceRoot":"","sources":["../../../../source/linker/linker.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yCAAyC,CAAC;AAE9E,OAAO,KAAK,EAAE,wBAAwB,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAGjF,KAAK,iBAAiB,GAAG;IACrB,QAAQ,CAAC,MAAM,EAAE,cAAc,CAAC;IAChC,QAAQ,CAAC,kBAAkB,EAAE,SAAS,wBAAwB,EAAE,CAAC;CACpE,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG;IACvB,UAAU,EAAE,CAAC,OAAO,EAAE,iBAAiB,KAAK,OAAO,CAAC,YAAY,CAAC,CAAC;CACrE,CAAC;AAWF,wBAAgB,kBAAkB,IAAI,YAAY,CAejD"}
|
package/linker/linker.js
CHANGED
|
@@ -1,25 +1,3 @@
|
|
|
1
1
|
import { substituteDependencies } from "./substitute-bundles.js";
|
|
2
2
|
import { createGraphFromResolvedBundle } from "./resource-graph.js";
|
|
3
|
-
function flattenEntryPoints(entryPoints) {
|
|
4
|
-
return entryPoints.flatMap((entryPoint) => {
|
|
5
|
-
if (entryPoint.declarationFile !== undefined) {
|
|
6
|
-
return [entryPoint.js.sourceFilePath, entryPoint.declarationFile.sourceFilePath];
|
|
7
|
-
}
|
|
8
|
-
return [entryPoint.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(flattenEntryPoints(bundle.entryPoints)),
|
|
19
|
-
name: bundle.name,
|
|
20
|
-
entryPoints: bundle.entryPoints
|
|
21
|
-
};
|
|
22
|
-
}
|
|
23
|
-
};
|
|
24
|
-
}
|
|
25
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"}
|
package/linker/resource-graph.js
CHANGED
|
@@ -1,31 +1,3 @@
|
|
|
1
|
+
import { filter, map, pipe } from 'remeda';
|
|
1
2
|
import { createDirectedGraph } from "../directed-graph/graph.js";
|
|
2
|
-
function collectResourceSpecificExternalDependencies(resource, externalDependencies) {
|
|
3
|
-
return Array.from(externalDependencies.values())
|
|
4
|
-
.filter((dependency) => {
|
|
5
|
-
return dependency.referencedFrom.includes(resource.fileDescription.sourceFilePath);
|
|
6
|
-
})
|
|
7
|
-
.map((dependency) => {
|
|
8
|
-
return dependency.name;
|
|
9
|
-
});
|
|
10
|
-
}
|
|
11
|
-
export function createGraphFromResolvedBundle(bundle) {
|
|
12
|
-
const graph = createDirectedGraph();
|
|
13
|
-
for (const resource of bundle.contents) {
|
|
14
|
-
const externalDependencies = collectResourceSpecificExternalDependencies(resource, bundle.externalDependencies);
|
|
15
|
-
graph.addNode(resource.fileDescription.sourceFilePath, {
|
|
16
|
-
fileDescription: resource.fileDescription,
|
|
17
|
-
externalDependencies,
|
|
18
|
-
project: resource.project,
|
|
19
|
-
isExplicitlyIncluded: resource.isExplicitlyIncluded
|
|
20
|
-
});
|
|
21
|
-
}
|
|
22
|
-
for (const resource of bundle.contents) {
|
|
23
|
-
for (const directDependency of resource.directDependencies) {
|
|
24
|
-
if (!graph.hasConnection({ from: resource.fileDescription.sourceFilePath, to: directDependency })) {
|
|
25
|
-
graph.connect({ from: resource.fileDescription.sourceFilePath, to: directDependency });
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
return graph;
|
|
30
|
-
}
|
|
31
3
|
//# sourceMappingURL=resource-graph.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resource-graph.js","sourceRoot":"","sources":["../../../../source/linker/resource-graph.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"resource-graph.js","sourceRoot":"","sources":["../../../../source/linker/resource-graph.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,QAAQ;AAE1C,OAAO,EAAsB,mBAAmB,EAAE,MAAM,4BAA4B"}
|
|
@@ -1,36 +1,3 @@
|
|
|
1
|
-
import path from 'node:path';
|
|
2
1
|
import { resolveSourceFileForLiteral } from "../../dependency-scanner/source-file-references.js";
|
|
3
2
|
import { getSourcePathFromSourceFile } from "../../dependency-scanner/typescript-project-analyzer.js";
|
|
4
|
-
function useBasenameFromSource(sourceFile, targetFile) {
|
|
5
|
-
const basename = path.basename(sourceFile);
|
|
6
|
-
const dirname = path.dirname(targetFile);
|
|
7
|
-
return path.join(dirname, basename);
|
|
8
|
-
}
|
|
9
|
-
function applyImportPathReplacements(sourceFile, replacements) {
|
|
10
|
-
for (const literal of sourceFile.getImportStringLiterals()) {
|
|
11
|
-
const resolvedSourceFile = resolveSourceFileForLiteral(literal, sourceFile);
|
|
12
|
-
if (resolvedSourceFile !== undefined) {
|
|
13
|
-
const replacement = replacements.get(getSourcePathFromSourceFile(resolvedSourceFile));
|
|
14
|
-
if (replacement !== undefined) {
|
|
15
|
-
if (resolvedSourceFile.isDeclarationFile()) {
|
|
16
|
-
literal.setLiteralValue(useBasenameFromSource(literal.getLiteralValue(), replacement));
|
|
17
|
-
}
|
|
18
|
-
else {
|
|
19
|
-
literal.setLiteralValue(replacement);
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
export function replaceImportPaths(project, sourceFilePath, sourceContent, replacements) {
|
|
26
|
-
if (project === undefined) {
|
|
27
|
-
return sourceContent;
|
|
28
|
-
}
|
|
29
|
-
const sourceFile = project.getSourceFile(sourceFilePath);
|
|
30
|
-
if (sourceFile === undefined) {
|
|
31
|
-
return sourceContent;
|
|
32
|
-
}
|
|
33
|
-
applyImportPathReplacements(sourceFile, replacements);
|
|
34
|
-
return sourceFile.getFullText();
|
|
35
|
-
}
|
|
36
3
|
//# sourceMappingURL=import-paths.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"import-paths.js","sourceRoot":"","sources":["../../../../../source/linker/source-modifier/import-paths.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"import-paths.js","sourceRoot":"","sources":["../../../../../source/linker/source-modifier/import-paths.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,2BAA2B,EAAE,MAAM,oDAAoD;AAChG,OAAO,EAAE,2BAA2B,EAAE,MAAM,yDAAyD"}
|