packtory 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (143) hide show
  1. package/LICENSE +21 -0
  2. package/artifacts/artifacts-builder.d.ts +20 -0
  3. package/artifacts/artifacts-builder.d.ts.map +1 -0
  4. package/artifacts/artifacts-builder.js +43 -0
  5. package/artifacts/artifacts-builder.js.map +1 -0
  6. package/artifacts/file-manager.d.ts +18 -0
  7. package/artifacts/file-manager.d.ts.map +1 -0
  8. package/artifacts/file-manager.js +35 -0
  9. package/artifacts/file-manager.js.map +1 -0
  10. package/bundler/bundle-build-options.d.ts +19 -0
  11. package/bundler/bundle-build-options.d.ts.map +1 -0
  12. package/bundler/bundle-build-options.js +25 -0
  13. package/bundler/bundle-build-options.js.map +1 -0
  14. package/bundler/bundle-description.d.ts +27 -0
  15. package/bundler/bundle-description.d.ts.map +1 -0
  16. package/bundler/bundler.d.ts +11 -0
  17. package/bundler/bundler.d.ts.map +1 -0
  18. package/bundler/bundler.js +98 -0
  19. package/bundler/bundler.js.map +1 -0
  20. package/bundler/content.js +53 -0
  21. package/bundler/content.js.map +1 -0
  22. package/bundler/substitute-bundles.js +73 -0
  23. package/bundler/substitute-bundles.js.map +1 -0
  24. package/config/additional-files.d.ts +13 -0
  25. package/config/additional-files.d.ts.map +1 -0
  26. package/config/additional-files.js +8 -0
  27. package/config/additional-files.js.map +1 -0
  28. package/config/base-validations.d.ts +5 -0
  29. package/config/base-validations.d.ts.map +1 -0
  30. package/config/base-validations.js +3 -0
  31. package/config/base-validations.js.map +1 -0
  32. package/config/config.d.ts +470 -0
  33. package/config/config.d.ts.map +1 -0
  34. package/config/config.js +65 -0
  35. package/config/config.js.map +1 -0
  36. package/config/entry-point.d.ts +13 -0
  37. package/config/entry-point.d.ts.map +1 -0
  38. package/config/entry-point.js +8 -0
  39. package/config/entry-point.js.map +1 -0
  40. package/config/package-json.d.ts +33 -0
  41. package/config/package-json.d.ts.map +1 -0
  42. package/config/package-json.js +34 -0
  43. package/config/package-json.js.map +1 -0
  44. package/config/registry-settings.d.ts +13 -0
  45. package/config/registry-settings.d.ts.map +1 -0
  46. package/config/registry-settings.js +8 -0
  47. package/config/registry-settings.js.map +1 -0
  48. package/config/validation.d.ts +13 -0
  49. package/config/validation.d.ts.map +1 -0
  50. package/config/validation.js +99 -0
  51. package/config/validation.js.map +1 -0
  52. package/config/versioning-settings.d.ts +23 -0
  53. package/config/versioning-settings.d.ts.map +1 -0
  54. package/config/versioning-settings.js +15 -0
  55. package/config/versioning-settings.js.map +1 -0
  56. package/dependency-scanner/dependency-graph.d.ts +33 -0
  57. package/dependency-scanner/dependency-graph.d.ts.map +1 -0
  58. package/dependency-scanner/dependency-graph.js +60 -0
  59. package/dependency-scanner/dependency-graph.js.map +1 -0
  60. package/dependency-scanner/scanner.d.ts +34 -0
  61. package/dependency-scanner/scanner.d.ts.map +1 -0
  62. package/dependency-scanner/scanner.js +131 -0
  63. package/dependency-scanner/scanner.js.map +1 -0
  64. package/dependency-scanner/source-file-references.js +68 -0
  65. package/dependency-scanner/source-file-references.js.map +1 -0
  66. package/dependency-scanner/source-map-file-locator.d.ts +10 -0
  67. package/dependency-scanner/source-map-file-locator.d.ts.map +1 -0
  68. package/dependency-scanner/source-map-file-locator.js +23 -0
  69. package/dependency-scanner/source-map-file-locator.js.map +1 -0
  70. package/dependency-scanner/typescript-file-host.d.ts +10 -0
  71. package/dependency-scanner/typescript-file-host.d.ts.map +1 -0
  72. package/dependency-scanner/typescript-file-host.js +50 -0
  73. package/dependency-scanner/typescript-file-host.js.map +1 -0
  74. package/dependency-scanner/typescript-project-analyzer.d.ts +23 -0
  75. package/dependency-scanner/typescript-project-analyzer.d.ts.map +1 -0
  76. package/dependency-scanner/typescript-project-analyzer.js +64 -0
  77. package/dependency-scanner/typescript-project-analyzer.js.map +1 -0
  78. package/directed-graph/graph.d.ts +27 -0
  79. package/directed-graph/graph.d.ts.map +1 -0
  80. package/directed-graph/graph.js +183 -0
  81. package/directed-graph/graph.js.map +1 -0
  82. package/file-description/compare.js +18 -0
  83. package/file-description/compare.js.map +1 -0
  84. package/file-description/equal.js +4 -0
  85. package/file-description/equal.js.map +1 -0
  86. package/file-description/file-description.d.ts +5 -0
  87. package/file-description/file-description.d.ts.map +1 -0
  88. package/file-description/sort.js +13 -0
  89. package/file-description/sort.js.map +1 -0
  90. package/package-json.js +33 -0
  91. package/package-json.js.map +1 -0
  92. package/package.json +48 -0
  93. package/packages/bundler/bundler.entry-point.js +21 -0
  94. package/packages/bundler/bundler.entry-point.js.map +1 -0
  95. package/packages/packtory/packtory.entry-point.d.ts +7 -0
  96. package/packages/packtory/packtory.entry-point.d.ts.map +1 -0
  97. package/packages/packtory/packtory.entry-point.js +32 -0
  98. package/packages/packtory/packtory.entry-point.js.map +1 -0
  99. package/packtory/map-config.js +55 -0
  100. package/packtory/map-config.js.map +1 -0
  101. package/packtory/normalize-paths.js +26 -0
  102. package/packtory/normalize-paths.js.map +1 -0
  103. package/packtory/packtory.d.ts +25 -0
  104. package/packtory/packtory.d.ts.map +1 -0
  105. package/packtory/packtory.js +30 -0
  106. package/packtory/packtory.js.map +1 -0
  107. package/packtory/scheduler.d.ts +18 -0
  108. package/packtory/scheduler.d.ts.map +1 -0
  109. package/packtory/scheduler.js +74 -0
  110. package/packtory/scheduler.js.map +1 -0
  111. package/progress/progress-broadcaster.d.ts +40 -0
  112. package/progress/progress-broadcaster.d.ts.map +1 -0
  113. package/progress/progress-broadcaster.js +16 -0
  114. package/progress/progress-broadcaster.js.map +1 -0
  115. package/publisher/extract-package-tarball.js +12 -0
  116. package/publisher/extract-package-tarball.js.map +1 -0
  117. package/publisher/publisher.d.ts +40 -0
  118. package/publisher/publisher.d.ts.map +1 -0
  119. package/publisher/publisher.js +73 -0
  120. package/publisher/publisher.js.map +1 -0
  121. package/publisher/registry-client.d.ts +24 -0
  122. package/publisher/registry-client.d.ts.map +1 -0
  123. package/publisher/registry-client.js +90 -0
  124. package/publisher/registry-client.js.map +1 -0
  125. package/publisher/version.js +35 -0
  126. package/publisher/version.js.map +1 -0
  127. package/readme.md +38 -0
  128. package/source-modifier/import-paths.js +17 -0
  129. package/source-modifier/import-paths.js.map +1 -0
  130. package/tar/extract-tar.js +17 -0
  131. package/tar/extract-tar.js.map +1 -0
  132. package/tar/tarball-builder.d.ts +7 -0
  133. package/tar/tarball-builder.d.ts.map +1 -0
  134. package/tar/tarball-builder.js +35 -0
  135. package/tar/tarball-builder.js.map +1 -0
  136. package/validation/capitalize.js +7 -0
  137. package/validation/capitalize.js.map +1 -0
  138. package/validation/formatting/ast.js +113 -0
  139. package/validation/formatting/ast.js.map +1 -0
  140. package/validation/formatting.js +98 -0
  141. package/validation/formatting.js.map +1 -0
  142. package/validation/validate.js +17 -0
  143. package/validation/validate.js.map +1 -0
@@ -0,0 +1,13 @@
1
+ import { type Schema } from '@effect/schema/Schema';
2
+ import { type NoExpand } from './base-validations.js';
3
+ declare const $registrySettingsSchema: Schema<{
4
+ readonly token: string;
5
+ readonly registryUrl?: string;
6
+ }, {
7
+ readonly token: string;
8
+ readonly registryUrl?: string;
9
+ }>;
10
+ export type RegistrySettings = NoExpand<Schema.To<typeof $registrySettingsSchema>>;
11
+ export declare const registrySettingsSchema: Schema<RegistrySettings>;
12
+ export {};
13
+ //# sourceMappingURL=registry-settings.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"registry-settings.d.ts","sourceRoot":"","sources":["../../../../source/config/registry-settings.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,MAAM,EAAoB,MAAM,uBAAuB,CAAC;AACtE,OAAO,EAAE,KAAK,QAAQ,EAAwB,MAAM,uBAAuB,CAAC;AAE5E,QAAA,MAAM,uBAAuB;;;;;;EAG3B,CAAC;AAEH,MAAM,MAAM,gBAAgB,GAAG,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC,OAAO,uBAAuB,CAAC,CAAC,CAAC;AACnF,eAAO,MAAM,sBAAsB,EAAE,MAAM,CAAC,gBAAgB,CAA2B,CAAC"}
@@ -0,0 +1,8 @@
1
+ import { struct, optional } from '@effect/schema/Schema';
2
+ import { nonEmptyStringSchema } from './base-validations.js';
3
+ const $registrySettingsSchema = struct({
4
+ registryUrl: optional(nonEmptyStringSchema, { exact: true }),
5
+ token: nonEmptyStringSchema
6
+ });
7
+ export const registrySettingsSchema = $registrySettingsSchema;
8
+ //# sourceMappingURL=registry-settings.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"registry-settings.js","sourceRoot":"","sources":["../../../../source/config/registry-settings.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,MAAM,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACtE,OAAO,EAAiB,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAE5E,MAAM,uBAAuB,GAAG,MAAM,CAAC;IACnC,WAAW,EAAE,QAAQ,CAAC,oBAAoB,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;IAC5D,KAAK,EAAE,oBAAoB;CAC9B,CAAC,CAAC;AAGH,MAAM,CAAC,MAAM,sBAAsB,GAA6B,uBAAuB,CAAC"}
@@ -0,0 +1,13 @@
1
+ import { Result } from 'true-myth';
2
+ import { type DirectedGraph } from '../directed-graph/graph.js';
3
+ import { type PacktoryConfig, type PackageConfig } from './config.js';
4
+ type GraphGenerationPossibleResult = {
5
+ readonly packtoryConfig: PacktoryConfig;
6
+ readonly packageConfigs: Map<string, PackageConfig>;
7
+ };
8
+ export type ValidConfigResult = GraphGenerationPossibleResult & {
9
+ readonly packageGraph: DirectedGraph<string, undefined>;
10
+ };
11
+ export declare function validateConfig(config: unknown): Result<ValidConfigResult, readonly string[]>;
12
+ export {};
13
+ //# sourceMappingURL=validation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validation.d.ts","sourceRoot":"","sources":["../../../../source/config/validation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAEnC,OAAO,EAAE,KAAK,aAAa,EAAuB,MAAM,4BAA4B,CAAC;AACrF,OAAO,EAAE,KAAK,cAAc,EAAwB,KAAK,aAAa,EAAE,MAAM,aAAa,CAAC;AAyF5F,KAAK,6BAA6B,GAAG;IACjC,QAAQ,CAAC,cAAc,EAAE,cAAc,CAAC;IACxC,QAAQ,CAAC,cAAc,EAAE,GAAG,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;CACvD,CAAC;AAwBF,MAAM,MAAM,iBAAiB,GAAG,6BAA6B,GAAG;IAC5D,QAAQ,CAAC,YAAY,EAAE,aAAa,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;CAC3D,CAAC;AAEF,wBAAgB,cAAc,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,CAAC,iBAAiB,EAAE,SAAS,MAAM,EAAE,CAAC,CAsB5F"}
@@ -0,0 +1,99 @@
1
+ import { Result } from 'true-myth';
2
+ import { validateAgainstSchema } from '../validation/validate.js';
3
+ import { createDirectedGraph } from '../directed-graph/graph.js';
4
+ import { packtoryConfigSchema } from './config.js';
5
+ function buildPackageGraph(packages) {
6
+ const graph = createDirectedGraph();
7
+ for (const packageConfig of packages.values()) {
8
+ graph.addNode(packageConfig.name, undefined);
9
+ }
10
+ for (const packageConfig of packages.values()) {
11
+ const allDependencies = [
12
+ ...(packageConfig.bundleDependencies ?? []),
13
+ ...(packageConfig.bundlePeerDependencies ?? [])
14
+ ];
15
+ for (const dependency of allDependencies) {
16
+ graph.connect({ from: packageConfig.name, to: dependency });
17
+ }
18
+ }
19
+ return graph;
20
+ }
21
+ function validateDependenciesExistForSinglePackage(packageName, allKnownPackageNames, dependencies, isPeer) {
22
+ const prefix = isPeer ? 'Bundle peer' : 'Bundle';
23
+ return dependencies
24
+ .filter((dependency) => {
25
+ return !allKnownPackageNames.includes(dependency);
26
+ })
27
+ .map((dependency) => {
28
+ return `${prefix} dependency "${dependency}" referenced in "${packageName}" does not exist`;
29
+ });
30
+ }
31
+ function validateDependenciesExist(packageConfigs) {
32
+ const knownPackageNames = Array.from(packageConfigs.keys());
33
+ return Array.from(packageConfigs.values()).flatMap((packageConfig) => {
34
+ return [
35
+ ...validateDependenciesExistForSinglePackage(packageConfig.name, knownPackageNames, packageConfig.bundleDependencies ?? [], false),
36
+ ...validateDependenciesExistForSinglePackage(packageConfig.name, knownPackageNames, packageConfig.bundlePeerDependencies ?? [], true)
37
+ ];
38
+ });
39
+ }
40
+ function packageListToMap(packages) {
41
+ // use Map.groupBy once https://github.com/microsoft/TypeScript/pull/56805 has landed
42
+ return packages.reduce((map, packageConfig) => {
43
+ map.set(packageConfig.name, packageConfig);
44
+ return map;
45
+ }, new Map());
46
+ }
47
+ function validateDuplicatePackages(packages) {
48
+ const knownPackageNames = new Set();
49
+ const issues = [];
50
+ packages.forEach((packageConfig) => {
51
+ if (knownPackageNames.has(packageConfig.name)) {
52
+ issues.push(`Duplicate package definition with the name "${packageConfig.name}"`);
53
+ }
54
+ knownPackageNames.add(packageConfig.name);
55
+ });
56
+ return issues;
57
+ }
58
+ function validateCyclicDependencies(packageGraph) {
59
+ const cycles = packageGraph.detectCycles();
60
+ return cycles.map((cycle) => {
61
+ return `Unexpected cyclic dependency path: [${cycle.join('→')}]`;
62
+ });
63
+ }
64
+ function validatePreGraphGeneration(config) {
65
+ const schemaValidationResult = validateAgainstSchema(packtoryConfigSchema, config);
66
+ if (schemaValidationResult.isErr) {
67
+ return Result.err(schemaValidationResult.error.issues);
68
+ }
69
+ const packtoryConfig = schemaValidationResult.value;
70
+ const packageConfigs = packageListToMap(packtoryConfig.packages);
71
+ const missingDependenciesIssues = validateDependenciesExist(packageConfigs);
72
+ if (missingDependenciesIssues.length > 0) {
73
+ const issues = Array.from(validateDuplicatePackages(packtoryConfig.packages));
74
+ return Result.err([...issues, ...missingDependenciesIssues]);
75
+ }
76
+ return Result.ok({
77
+ packtoryConfig,
78
+ packageConfigs
79
+ });
80
+ }
81
+ export function validateConfig(config) {
82
+ const result = validatePreGraphGeneration(config);
83
+ if (result.isErr) {
84
+ return Result.err(result.error);
85
+ }
86
+ const { packageConfigs, packtoryConfig } = result.value;
87
+ const packageGraph = buildPackageGraph(packageConfigs);
88
+ const issues = Array.from(validateDuplicatePackages(packtoryConfig.packages));
89
+ issues.push(...validateCyclicDependencies(packageGraph));
90
+ if (issues.length > 0) {
91
+ return Result.err(issues);
92
+ }
93
+ return Result.ok({
94
+ packtoryConfig,
95
+ packageConfigs,
96
+ packageGraph
97
+ });
98
+ }
99
+ //# sourceMappingURL=validation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validation.js","sourceRoot":"","sources":["../../../../source/config/validation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACnC,OAAO,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAClE,OAAO,EAAsB,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACrF,OAAO,EAAuB,oBAAoB,EAAsB,MAAM,aAAa,CAAC;AAE5F,SAAS,iBAAiB,CAAC,QAA4C;IACnE,MAAM,KAAK,GAAG,mBAAmB,EAAqB,CAAC;IAEvD,KAAK,MAAM,aAAa,IAAI,QAAQ,CAAC,MAAM,EAAE,EAAE,CAAC;QAC5C,KAAK,CAAC,OAAO,CAAC,aAAa,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;IACjD,CAAC;IAED,KAAK,MAAM,aAAa,IAAI,QAAQ,CAAC,MAAM,EAAE,EAAE,CAAC;QAC5C,MAAM,eAAe,GAAG;YACpB,GAAG,CAAC,aAAa,CAAC,kBAAkB,IAAI,EAAE,CAAC;YAC3C,GAAG,CAAC,aAAa,CAAC,sBAAsB,IAAI,EAAE,CAAC;SAClD,CAAC;QAEF,KAAK,MAAM,UAAU,IAAI,eAAe,EAAE,CAAC;YACvC,KAAK,CAAC,OAAO,CAAC,EAAE,IAAI,EAAE,aAAa,CAAC,IAAI,EAAE,EAAE,EAAE,UA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5E,IAAI,yBAAyB,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACvC,MAAM,MAAM,GAAG,KAAK,CAAC,IAAI,CAAC,yBAAyB,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAC,CAAC;QAC9E,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC,GAAG,MAAM,EAAE,GAAG,yBAAyB,CAAC,CAAC,CAAC;IACjE,CAAC;IAED,OAAO,MAAM,CAAC,EAAE,CAAC;QACb,cAAc;QACd,cAAc;KACjB,CAAC,CAAC;AACP,CAAC;AAMD,MAAM,UAAU,cAAc,CAAC,MAAe;IAC1C,MAAM,MAAM,GAAG,0BAA0B,CAAC,MAAM,CAAC,CAAC;IAElD,IAAI,MAAM,CAAC,KAAK,EAAE,CAAC;QACf,OAAO,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IACpC,CAAC;IAED,MAAM,EAAE,cAAc,EAAE,cAAc,EAAE,GAAG,MAAM,CAAC,KAAK,CAAC;IAExD,MAAM,YAAY,GAAG,iBAAiB,CAAC,cAAc,CAAC,CAAC;IAEvD,MAAM,MAAM,GAAG,KAAK,CAAC,IAAI,CAAC,yBAAyB,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAC,CAAC;IAC9E,MAAM,CAAC,IAAI,CAAC,GAAG,0BAA0B,CAAC,YAAY,CAAC,CAAC,CAAC;IACzD,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACpB,OAAO,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IAC9B,CAAC;IAED,OAAO,MAAM,CAAC,EAAE,CAAC;QACb,cAAc;QACd,cAAc;QACd,YAAY;KACf,CAAC,CAAC;AACP,CAAC"}
@@ -0,0 +1,23 @@
1
+ import { type Schema } from '@effect/schema/Schema';
2
+ import { type NoExpand } from './base-validations.js';
3
+ declare const $automaticVersioningSettingsSchema: Schema<{
4
+ readonly automatic: true;
5
+ readonly minimumVersion?: string;
6
+ }, {
7
+ readonly automatic: true;
8
+ readonly minimumVersion?: string;
9
+ }>;
10
+ type AutomaticVersioningSettings = NoExpand<Schema.To<typeof $automaticVersioningSettingsSchema>>;
11
+ declare const $manualVersioningSettingsSchema: Schema<{
12
+ readonly version: string;
13
+ readonly automatic: false;
14
+ }, {
15
+ readonly version: string;
16
+ readonly automatic: false;
17
+ }>;
18
+ type ManualVersioningSettings = NoExpand<Schema.To<typeof $manualVersioningSettingsSchema>>;
19
+ declare const $versioningSettingsSchema: Schema<AutomaticVersioningSettings | ManualVersioningSettings, AutomaticVersioningSettings | ManualVersioningSettings>;
20
+ export type VersioningSettings = Schema.To<typeof $versioningSettingsSchema>;
21
+ export declare const versioningSettingsSchema: Schema<VersioningSettings>;
22
+ export {};
23
+ //# sourceMappingURL=versioning-settings.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"versioning-settings.d.ts","sourceRoot":"","sources":["../../../../source/config/versioning-settings.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,MAAM,EAAoC,MAAM,uBAAuB,CAAC;AACtF,OAAO,EAAE,KAAK,QAAQ,EAAwB,MAAM,uBAAuB,CAAC;AAE5E,QAAA,MAAM,kCAAkC;;;;;;EAGtC,CAAC;AACH,KAAK,2BAA2B,GAAG,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC,OAAO,kCAAkC,CAAC,CAAC,CAAC;AAGlG,QAAA,MAAM,+BAA+B;;;;;;EAGnC,CAAC;AACH,KAAK,wBAAwB,GAAG,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC,OAAO,+BAA+B,CAAC,CAAC,CAAC;AAG5F,QAAA,MAAM,yBAAyB,wHAA2E,CAAC;AAC3G,MAAM,MAAM,kBAAkB,GAAG,MAAM,CAAC,EAAE,CAAC,OAAO,yBAAyB,CAAC,CAAC;AAC7E,eAAO,MAAM,wBAAwB,EAAE,MAAM,CAAC,kBAAkB,CAA6B,CAAC"}
@@ -0,0 +1,15 @@
1
+ import { struct, literal, optional, union } from '@effect/schema/Schema';
2
+ import { nonEmptyStringSchema } from './base-validations.js';
3
+ const $automaticVersioningSettingsSchema = struct({
4
+ automatic: literal(true),
5
+ minimumVersion: optional(nonEmptyStringSchema, { exact: true })
6
+ });
7
+ const automaticVersioningSettingsSchema = $automaticVersioningSettingsSchema;
8
+ const $manualVersioningSettingsSchema = struct({
9
+ automatic: literal(false),
10
+ version: nonEmptyStringSchema
11
+ });
12
+ const manualVersioningSettingsSchema = $manualVersioningSettingsSchema;
13
+ const $versioningSettingsSchema = union(automaticVersioningSettingsSchema, manualVersioningSettingsSchema);
14
+ export const versioningSettingsSchema = $versioningSettingsSchema;
15
+ //# sourceMappingURL=versioning-settings.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"versioning-settings.js","sourceRoot":"","sources":["../../../../source/config/versioning-settings.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AACtF,OAAO,EAAiB,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAE5E,MAAM,kCAAkC,GAAG,MAAM,CAAC;IAC9C,SAAS,EAAE,OAAO,CAAC,IAAI,CAAC;IACxB,cAAc,EAAE,QAAQ,CAAC,oBAAoB,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;CAClE,CAAC,CAAC;AAEH,MAAM,iCAAiC,GAAwC,kCAAkC,CAAC;AAElH,MAAM,+BAA+B,GAAG,MAAM,CAAC;IAC3C,SAAS,EAAE,OAAO,CAAC,KAAK,CAAC;IACzB,OAAO,EAAE,oBAAoB;CAChC,CAAC,CAAC;AAEH,MAAM,8BAA8B,GAAqC,+BAA+B,CAAC;AAEzG,MAAM,yBAAyB,GAAG,KAAK,CAAC,iCAAiC,EAAE,8BAA8B,CAAC,CAAC;AAE3G,MAAM,CAAC,MAAM,wBAAwB,GAA+B,yBAAyB,CAAC"}
@@ -0,0 +1,33 @@
1
+ import { Maybe } from 'true-myth';
2
+ import type { SourceFile } from 'ts-morph';
3
+ export type DependencyGraphNodeData = {
4
+ readonly sourceMapFilePath: Maybe<string>;
5
+ readonly topLevelDependencies: ReadonlyMap<string, string>;
6
+ readonly substitutionContent: Maybe<string>;
7
+ readonly tsSourceFile: Readonly<SourceFile>;
8
+ };
9
+ export type DependencyNode = DependencyGraphNodeData & {
10
+ readonly filePath: string;
11
+ readonly localFiles: readonly string[];
12
+ };
13
+ export type LocalFile = {
14
+ readonly filePath: string;
15
+ readonly substitutionContent: Maybe<string>;
16
+ };
17
+ export type DependencyFiles = {
18
+ readonly localFiles: readonly LocalFile[];
19
+ readonly topLevelDependencies: Record<string, string>;
20
+ };
21
+ export declare function mergeDependencyFiles(first: Readonly<DependencyFiles>, second: Readonly<DependencyFiles>): Readonly<DependencyFiles>;
22
+ type DependencyGraphVisitor = (node: Readonly<DependencyNode>) => void;
23
+ export type DependencyGraph = {
24
+ addDependency(filePath: string, data: DependencyGraphNodeData): void;
25
+ connect(fromFilePath: string, toFilePath: string): void;
26
+ hasConnection(fromFilePath: string, toFilePath: string): boolean;
27
+ walk(startFilePath: string, visitor: DependencyGraphVisitor): void;
28
+ isKnown(filePath: string): boolean;
29
+ flatten(startFilePath: string): Readonly<DependencyFiles>;
30
+ };
31
+ export declare function createDependencyGraph(): DependencyGraph;
32
+ export {};
33
+ //# sourceMappingURL=dependency-graph.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dependency-graph.d.ts","sourceRoot":"","sources":["../../../../source/dependency-scanner/dependency-graph.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAClC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAG3C,MAAM,MAAM,uBAAuB,GAAG;IAClC,QAAQ,CAAC,iBAAiB,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IAC1C,QAAQ,CAAC,oBAAoB,EAAE,WAAW,C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GAAG,IAAI,CAAC;IACnE,OAAO,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC;IACnC,OAAO,CAAC,aAAa,EAAE,MAAM,GAAG,QAAQ,CAAC,eAAe,CAAC,CAAC;CAC7D,CAAC;AAEF,wBAAgB,qBAAqB,IAAI,eAAe,CAuDvD"}
@@ -0,0 +1,60 @@
1
+ import { Maybe } from 'true-myth';
2
+ import { createDirectedGraph } from '../directed-graph/graph.js';
3
+ export function mergeDependencyFiles(first, second) {
4
+ const mergedLocalFiles = new Map();
5
+ for (const localFile of [...first.localFiles, ...second.localFiles]) {
6
+ mergedLocalFiles.set(localFile.filePath, localFile);
7
+ }
8
+ return {
9
+ localFiles: Array.from(mergedLocalFiles.values()),
10
+ topLevelDependencies: { ...first.topLevelDependencies, ...second.topLevelDependencies }
11
+ };
12
+ }
13
+ export function createDependencyGraph() {
14
+ const graph = createDirectedGraph();
15
+ return {
16
+ addDependency(filePath, data) {
17
+ graph.addNode(filePath, data);
18
+ },
19
+ isKnown: graph.hasNode,
20
+ connect(fromFilePath, toFilePath) {
21
+ graph.connect({ from: fromFilePath, to: toFilePath });
22
+ },
23
+ hasConnection(fromFilePath, toFilePath) {
24
+ return graph.hasConnection({ from: fromFilePath, to: toFilePath });
25
+ },
26
+ walk(startFilePath, visitor) {
27
+ graph.visitBreadthFirstSearch(startFilePath, (node) => {
28
+ visitor({
29
+ filePath: node.id,
30
+ sourceMapFilePath: node.data.sourceMapFilePath,
31
+ topLevelDependencies: node.data.topLevelDependencies,
32
+ localFiles: Array.from(node.adjacentNodeIds),
33
+ substitutionContent: node.data.substitutionContent,
34
+ tsSourceFile: node.data.tsSourceFile
35
+ });
36
+ });
37
+ },
38
+ flatten(startFilePath) {
39
+ const localFiles = new Map();
40
+ const topLevelDependencies = new Map();
41
+ graph.visitBreadthFirstSearch(startFilePath, (node) => {
42
+ localFiles.set(node.id, { filePath: node.id, substitutionContent: node.data.substitutionContent });
43
+ if (node.data.sourceMapFilePath.isJust) {
44
+ localFiles.set(node.data.sourceMapFilePath.value, {
45
+ filePath: node.data.sourceMapFilePath.value,
46
+ substitutionContent: Maybe.nothing()
47
+ });
48
+ }
49
+ for (const [name, version] of node.data.topLevelDependencies.entries()) {
50
+ topLevelDependencies.set(name, version);
51
+ }
52
+ });
53
+ return {
54
+ localFiles: Array.from(localFiles.values()),
55
+ topLevelDependencies: Object.fromEntries(topLevelDependencies.entries())
56
+ };
57
+ }
58
+ };
59
+ }
60
+ //# sourceMappingURL=dependency-graph.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dependency-graph.js","sourceRoot":"","sources":["../../../../source/dependency-scanner/dependency-graph.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAElC,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AAwBjE,MAAM,UAAU,oBAAoB,CAChC,KAAgC,EAChC,MAAiC;IAEjC,MAAM,gBAAgB,GAAG,IAAI,GAAG,EAAqB,CAAC;IAEtD,KAAK,MAAM,SAAS,IAAI,CAAC,GAAG,KAAK,CAAC,UAAU,EAAE,GAAG,MAAM,CAAC,UAAU,CAAC,EAAE,CAAC;QAClE,gBAAgB,CAAC,GAAG,CAAC,SAAS,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC;IACxD,CAAC;IAED,OAAO;QACH,UAAU,EAAE,KAAK,CAAC,IAAI,CAAC,gBAAgB,CAAC,MAAM,EAAE,CAAC;QACjD,oBAAoB,EAAE,EAAE,GAAG,KAAK,CAAC,oBAAoB,EAAE,GAAG,MAAM,CAAC,oBAAoB,EAAE;KAC1F,CAAC;AACN,CAAC;AAaD,MAAM,UAAU,qBAAqB;IACjC,MAAM,KAAK,GAAG,mBAAmB,EAAmC,CAAC;IAErE,OAAO;QACH,aAAa,CAAC,QAAQ,EAAE,IAAI;YACxB,KAAK,CAAC,OAAO,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;QAClC,CAAC;QA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C,MAAM,EAAE,CAAC;oBACrC,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,iBAAiB,CAAC,KAAK,EAAE;wBAC9C,QAAQ,EAAE,IAAI,CAAC,IAAI,CAAC,iBAAiB,CAAC,KAAK;wBAC3C,mBAAmB,EAAE,KAAK,CAAC,OAAO,EAAE;qBACvC,CAAC,CAAC;gBACP,CAAC;gBAED,KAAK,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,oBAAoB,CAAC,OAAO,EAAE,EAAE,CAAC;oBACrE,oBAAoB,CAAC,GAAG,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;gBAC5C,CAAC;YACL,CAAC,CAAC,CAAC;YAEH,OAAO;gBACH,UAAU,EAAE,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,MAAM,EAAE,CAAC;gBAC3C,oBAAoB,EAAE,MAAM,CAAC,WAAW,CAAC,oBAAoB,CAAC,OAAO,EAAE,CAAC;aAC3E,CAAC;QACN,CAAC;KACJ,CAAC;AACN,CAAC"}
@@ -0,0 +1,34 @@
1
+ import Maybe from 'true-myth/maybe';
2
+ import type { MainPackageJson } from '../config/package-json.js';
3
+ import type { SourceMapFileLocator } from './source-map-file-locator.js';
4
+ import type { ModuleResolution, TypescriptProjectAnalyzer } from './typescript-project-analyzer.js';
5
+ import { type DependencyGraph } from './dependency-graph.js';
6
+ type ScanOptions = {
7
+ readonly includeDevDependencies: boolean;
8
+ readonly includeSourceMapFiles: boolean;
9
+ readonly mainPackageJson: MainPackageJson;
10
+ readonly moduleResolution: ModuleResolution;
11
+ readonly resolveDeclarationFiles: boolean;
12
+ readonly failOnCompileErrors?: boolean;
13
+ };
14
+ export type DependencyScannerDependencies = {
15
+ readonly sourceMapFileLocator: SourceMapFileLocator;
16
+ readonly typescriptProjectAnalyzer: TypescriptProjectAnalyzer;
17
+ };
18
+ type FileType = 'javascript' | 'type-declaration';
19
+ export type LocalFile = {
20
+ readonly filePath: string;
21
+ readonly type: FileType;
22
+ readonly sourceMapFilePath: Maybe<string>;
23
+ };
24
+ export type ScanResult = {
25
+ readonly localFiles: readonly LocalFile[];
26
+ readonly topLevelDependencies: Record<string, string>;
27
+ };
28
+ export type DependencyScanner = {
29
+ scan(entryPointFile: string, folder: string, options?: Partial<ScanOptions>): Promise<DependencyGraph>;
30
+ };
31
+ export declare function combineScanResults(scanResult1: ScanResult, scanResult2: ScanResult): ScanResult;
32
+ export declare function createDependencyScanner(dependencyScannerDependencies: Readonly<DependencyScannerDependencies>): DependencyScanner;
33
+ export {};
34
+ //# sourceMappingURL=scanner.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scanner.d.ts","sourceRoot":"","sources":["../../../../source/dependency-scanner/scanner.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,iBAAiB,CAAC;AAEpC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AACzE,OAAO,KAAK,EAAE,gBAAgB,EAAE,yBAAyB,EAAqB,MAAM,kCAAkC,CAAC;AACvH,OAAO,EAAuD,KAAK,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAElH,KAAK,WAAW,GAAG;IACf,QAAQ,CAAC,sBAAsB,EAAE,OAAO,CAAC;IACzC,QAAQ,CAAC,qBAAqB,EAAE,OAAO,CAAC;IACxC,QAAQ,CAAC,eAAe,EAAE,eAAe,CAAC;IAC1C,QAAQ,CAAC,gBAAgB,EAAE,gBAAgB,CAAC;IAC5C,QAAQ,CAAC,uBAAuB,EAAE,OAAO,CAAC;IAC1C,QAAQ,CAAC,mBAAmB,CAAC,EAAE,OAAO,CAAC;CAC1C,CAAC;AAmGF,MAAM,MAAM,6BAA6B,GAAG;IACxC,QAAQ,CAAC,oBAAoB,EAAE,oBAAoB,CAAC;IACpD,QAAQ,CAAC,yBAAyB,EAAE,yBAAyB,CAAC;CACjE,CAAC;AAEF,KAAK,QAAQ,GAAG,YAAY,GAAG,kBAAkB,CAAC;AAElD,MAAM,MAAM,SAAS,GAAG;IACpB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC;IACxB,QAAQ,CAAC,iBAAiB,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;CAC7C,CAAC;AAEF,MAAM,MAAM,UAAU,GAAG;IACrB,QAAQ,CAAC,UAAU,EAAE,SAAS,SAAS,EAAE,CAAC;IAC1C,QAAQ,CAAC,oBAAoB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACzD,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG;IAC5B,IAAI,CAAC,cAAc,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,OAAO,CAAC,WAAW,CAAC,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC;CAC1G,CAAC;AAEF,wBAAgB,kBAAkB,CAAC,WAAW,EAAE,UAAU,EAAE,WAAW,EAAE,UAAU,GAAG,UAAU,CAK/F;AAED,wBAAgB,uBAAuB,CACnC,6BAA6B,EAAE,QAAQ,CAAC,6BAA6B,CAAC,GACvE,iBAAiB,CA8EnB"}
@@ -0,0 +1,131 @@
1
+ import Maybe from 'true-myth/maybe';
2
+ import { createDependencyGraph } from './dependency-graph.js';
3
+ function uniqueList(list) {
4
+ return Array.from(new Set(list));
5
+ }
6
+ function isNodeModulesPath(filePath) {
7
+ return filePath.includes('/node_modules/');
8
+ }
9
+ function isLocalPath(filePath) {
10
+ return !isNodeModulesPath(filePath);
11
+ }
12
+ function extractModuleName(nodeModulePath) {
13
+ const pattern = /\/node_modules\/(?<moduleName>[^@]+?|(?:@.+?\/.+?))\//;
14
+ const result = pattern.exec(nodeModulePath);
15
+ if (result === null) {
16
+ throw new Error(`Couldn’t find node_modules package name for '${nodeModulePath}'`);
17
+ }
18
+ const { groups: { moduleName } = {} } = result;
19
+ if (moduleName === undefined) {
20
+ throw new Error(`Couldn’t extract module name from path ${nodeModulePath}`);
21
+ }
22
+ return moduleName;
23
+ }
24
+ function isKnownNodeModule(moduleName, options) {
25
+ const { includeDevDependencies, mainPackageJson } = options;
26
+ if (mainPackageJson.dependencies?.[moduleName] !== undefined) {
27
+ return true;
28
+ }
29
+ if (includeDevDependencies) {
30
+ return mainPackageJson.devDependencies?.[moduleName] !== undefined;
31
+ }
32
+ return false;
33
+ }
34
+ function getVersionFromDependencies(moduleName, dependencies = {}) {
35
+ const version = dependencies[moduleName];
36
+ if (version !== undefined) {
37
+ return version;
38
+ }
39
+ return undefined;
40
+ }
41
+ function determineVersionNumber(moduleName, options) {
42
+ const { mainPackageJson } = options;
43
+ const version = getVersionFromDependencies(moduleName, mainPackageJson.dependencies);
44
+ if (version !== undefined) {
45
+ return version;
46
+ }
47
+ const devDependencyVersion = getVersionFromDependencies(moduleName, mainPackageJson.devDependencies);
48
+ if (devDependencyVersion !== undefined) {
49
+ return devDependencyVersion;
50
+ }
51
+ throw new Error(`Couldn’t determine version number of ${moduleName}`);
52
+ }
53
+ function addVersionNumbersToModules(moduleNames, options) {
54
+ return new Map(moduleNames.map((moduleName) => {
55
+ return [moduleName, determineVersionNumber(moduleName, options)];
56
+ }));
57
+ }
58
+ function determineLocalDependencies(dependencies) {
59
+ return dependencies.filter(isLocalPath);
60
+ }
61
+ function determineTopLevelNodeModules(dependencies, options) {
62
+ const modulePaths = dependencies.filter(isNodeModulesPath);
63
+ const moduleNames = modulePaths.map(extractModuleName);
64
+ const uniqueModuleNames = uniqueList(moduleNames);
65
+ const unknownNodeModule = uniqueModuleNames.find((moduleName) => {
66
+ return !isKnownNodeModule(moduleName, options);
67
+ });
68
+ if (unknownNodeModule !== undefined) {
69
+ throw new Error(`The referenced node module "${unknownNodeModule}" is not defined in the dependencies`);
70
+ }
71
+ return uniqueModuleNames;
72
+ }
73
+ export function combineScanResults(scanResult1, scanResult2) {
74
+ return {
75
+ localFiles: uniqueList([...scanResult1.localFiles, ...scanResult2.localFiles]),
76
+ topLevelDependencies: { ...scanResult1.topLevelDependencies, ...scanResult2.topLevelDependencies }
77
+ };
78
+ }
79
+ export function createDependencyScanner(dependencyScannerDependencies) {
80
+ const { sourceMapFileLocator, typescriptProjectAnalyzer } = dependencyScannerDependencies;
81
+ async function getDependencyNodeData(project, sourceFilePath, referencedFilePaths, options) {
82
+ const sourceMapFilePath = options.includeSourceMapFiles
83
+ ? await sourceMapFileLocator.locate(sourceFilePath)
84
+ : Maybe.nothing();
85
+ const topLevelDependencies = determineTopLevelNodeModules(referencedFilePaths, options);
86
+ const topLevelDependenciesWithVersion = addVersionNumbersToModules(topLevelDependencies, options);
87
+ const tsSourceFile = project.getSourceFile(sourceFilePath);
88
+ return {
89
+ sourceMapFilePath,
90
+ topLevelDependencies: topLevelDependenciesWithVersion,
91
+ tsSourceFile,
92
+ substitutionContent: Maybe.nothing()
93
+ };
94
+ }
95
+ async function scanDependenciesOfSourceFile(project, sourceFilePath, graph, options) {
96
+ const referencedFilePaths = project.getReferencedSourceFilePaths(sourceFilePath);
97
+ const localFiles = determineLocalDependencies(referencedFilePaths);
98
+ const nodeData = await getDependencyNodeData(project, sourceFilePath, referencedFilePaths, options);
99
+ graph.addDependency(sourceFilePath, nodeData);
100
+ for (const localeFile of localFiles) {
101
+ if (!graph.isKnown(localeFile)) {
102
+ await scanDependenciesOfSourceFile(project, localeFile, graph, options);
103
+ }
104
+ if (!graph.hasConnection(sourceFilePath, localeFile)) {
105
+ graph.connect(sourceFilePath, localeFile);
106
+ }
107
+ }
108
+ }
109
+ return {
110
+ async scan(entryPointFile, folder, options = {}) {
111
+ const { includeDevDependencies = false, resolveDeclarationFiles = false, includeSourceMapFiles = false, mainPackageJson = {}, moduleResolution = 'module', failOnCompileErrors = false } = options;
112
+ const scanOptions = {
113
+ includeDevDependencies,
114
+ includeSourceMapFiles,
115
+ resolveDeclarationFiles,
116
+ mainPackageJson,
117
+ moduleResolution,
118
+ failOnCompileErrors
119
+ };
120
+ const graph = createDependencyGraph();
121
+ const project = typescriptProjectAnalyzer.analyzeProject(folder, {
122
+ resolveDeclarationFiles: scanOptions.resolveDeclarationFiles,
123
+ failOnCompileErrors: scanOptions.failOnCompileErrors,
124
+ moduleResolution: scanOptions.moduleResolution
125
+ });
126
+ await scanDependenciesOfSourceFile(project, entryPointFile, graph, scanOptions);
127
+ return graph;
128
+ }
129
+ };
130
+ }
131
+ //# sourceMappingURL=scanner.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scanner.js","sourceRoot":"","sources":["../../../../source/dependency-scanner/scanner.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,iBAAiB,CAAC;AAKpC,OAAO,EAAE,qBAAqB,EAAsD,MAAM,uBAAuB,CAAC;AAWlH,SAAS,UAAU,CAAI,IAAkB;IACrC,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC;AACrC,CAAC;AAED,SAAS,iBAAiB,CAAC,QAAgB;IACvC,OAAO,QAAQ,CAAC,QAAQ,CAAC,gBAAgB,CAAC,CAAC;AAC/C,CAAC;AAED,SAAS,WAAW,CAAC,QAAgB;IACjC,OAAO,CAAC,iBAAiB,CAAC,QAAQ,CAAC,CAAC;AACxC,CAAC;AAED,SAAS,iBAAiB,CAAC,cAAsB;IAC7C,MAAM,OAAO,GAAG,uDAAuD,CAAC;IAExE,MAAM,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;IAE5C,IAAI,MAAM,KAAK,IAAI,EAAE,CAAC;QAClB,MAAM,IAAI,KAAK,CAAC,gDAAgD,cAAc,GAAG,CAAC,CAAC;IACvF,CAAC;IAED,MAAM,EAAE,MAAM,EAAE,EAAE,UAAU,EAAE,GAAG,EAAE,EAAE,GAAG,MAAM,CAAC;IAE/C,IAAI,UAAU,KAAK,SAAS,EAAE,CAA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AI,CAAC,KAAK,CAAC,aAAa,CAAC,cAAc,EAAE,UAAU,CAAC,EAAE,CAAC;gBACnD,KAAK,CAAC,OAAO,CAAC,cAAc,EAAE,UAAU,CAAC,CAAC;YAC9C,CAAC;QACL,CAAC;IACL,CAAC;IAED,OAAO;QACH,KAAK,CAAC,IAAI,CAAC,cAAc,EAAE,MAAM,EAAE,OAAO,GAAG,EAAE;YAC3C,MAAM,EACF,sBAAsB,GAAG,KAAK,EAC9B,uBAAuB,GAAG,KAAK,EAC/B,qBAAqB,GAAG,KAAK,EAC7B,eAAe,GAAG,EAAE,EACpB,gBAAgB,GAAG,QAAQ,EAC3B,mBAAmB,GAAG,KAAK,EAC9B,GAAG,OAAO,CAAC;YACZ,MAAM,WAAW,GAAG;gBAChB,sBAAsB;gBACtB,qBAAqB;gBACrB,uBAAuB;gBACvB,eAAe;gBACf,gBAAgB;gBAChB,mBAAmB;aACtB,CAAC;YAEF,MAAM,KAAK,GAAG,qBAAqB,EAAE,CAAC;YACtC,MAAM,OAAO,GAAG,yBAAyB,CAAC,cAAc,CAAC,MAAM,EAAE;gBAC7D,uBAAuB,EAAE,WAAW,CAAC,uBAAuB;gBAC5D,mBAAmB,EAAE,WAAW,CAAC,mBAAmB;gBACpD,gBAAgB,EAAE,WAAW,CAAC,gBAAgB;aACjD,CAAC,CAAC;YAEH,MAAM,4BAA4B,CAAC,OAAO,EAAE,cAAc,EAAE,KAAK,EAAE,WAAW,CAAC,CAAC;YAEhF,OAAO,KAAK,CAAC;QACjB,CAAC;KACJ,CAAC;AACN,CAAC"}
@@ -0,0 +1,68 @@
1
+ import { isBuiltin } from 'node:module';
2
+ import Maybe, { first } from 'true-myth/maybe';
3
+ import { ts, Node as ASTNode, SyntaxKind } from 'ts-morph';
4
+ function getReferencedSourceFileFromSymbol(symbol) {
5
+ if (symbol === undefined) {
6
+ return Maybe.nothing();
7
+ }
8
+ const declarations = symbol.getDeclarations();
9
+ return first(declarations).andThen((firstDeclaration) => {
10
+ if (firstDeclaration.getKind() === SyntaxKind.SourceFile) {
11
+ return Maybe.just(firstDeclaration);
12
+ }
13
+ return Maybe.nothing();
14
+ });
15
+ }
16
+ function getSourceFileFromSymbol(literal, parent, grandParent) {
17
+ if (ASTNode.isImportTypeNode(grandParent)) {
18
+ return getReferencedSourceFileFromSymbol(grandParent.getSymbol());
19
+ }
20
+ if (ASTNode.isCallExpression(parent)) {
21
+ return getReferencedSourceFileFromSymbol(literal.getSymbol());
22
+ }
23
+ return Maybe.nothing();
24
+ }
25
+ function getSourceFileForLiteral(literal) {
26
+ const parent = literal.getParentOrThrow();
27
+ const grandParent = parent.getParent();
28
+ if (ASTNode.isImportDeclaration(parent) || ASTNode.isExportDeclaration(parent)) {
29
+ return parent.getModuleSpecifierSourceFile();
30
+ }
31
+ if (ASTNode.isImportEqualsDeclaration(grandParent)) {
32
+ return grandParent.getExternalModuleReferenceSourceFile();
33
+ }
34
+ return getSourceFileFromSymbol(literal, parent, grandParent).unwrapOr(undefined);
35
+ }
36
+ export function resolveSourceFileForLiteral(literal, containingSourceFile) {
37
+ const project = containingSourceFile.getProject();
38
+ const result = ts.resolveModuleName(literal.getLiteralValue(), containingSourceFile.getFilePath(), project.getCompilerOptions(), project.getModuleResolutionHost());
39
+ if (result.resolvedModule !== undefined) {
40
+ const resolvedFilePath = result.resolvedModule.resolvedFileName;
41
+ return project.getSourceFile(resolvedFilePath);
42
+ }
43
+ return undefined;
44
+ }
45
+ function isDefined(value) {
46
+ return value !== undefined;
47
+ }
48
+ export function getReferencedSourceFiles(sourceFile) {
49
+ const importStringLiterals = sourceFile.getImportStringLiterals();
50
+ return importStringLiterals
51
+ .map((literal) => {
52
+ let referencedSourceFile = getSourceFileForLiteral(literal);
53
+ if (referencedSourceFile === undefined) {
54
+ referencedSourceFile = resolveSourceFileForLiteral(literal, sourceFile);
55
+ }
56
+ if (referencedSourceFile === undefined) {
57
+ const importValue = literal.getLiteralValue();
58
+ if (isBuiltin(importValue)) {
59
+ return undefined;
60
+ }
61
+ const message = `Failed to resolve import "${importValue}" in file "${sourceFile.getFilePath()}"`;
62
+ throw new Error(message);
63
+ }
64
+ return referencedSourceFile;
65
+ })
66
+ .filter(isDefined);
67
+ }
68
+ //# sourceMappingURL=source-file-references.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"source-file-references.js","sourceRoot":"","sources":["../../../../source/dependency-scanner/source-file-references.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,KAAK,EAAE,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EACH,EAAE,EACF,IAAI,IAAI,OAAO,EAGf,UAAU,EAEb,MAAM,UAAU,CAAC;AAElB,SAAS,iCAAiC,CAAC,MAA4B;IACnE,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;QACvB,OAAO,KAAK,CAAC,OAAO,EAAE,CAAC;IAC3B,CAAC;IAED,MAAM,YAAY,GAAG,MAAM,CAAC,eAAe,EAAE,CAAC;IAE9C,OAAO,KAAK,CAAC,YAAY,CAAC,CAAC,OAAO,CAAC,CAAC,gBAAgB,EAAE,EAAE;QACpD,IAAI,gBAAgB,CAAC,OAAO,EAAE,KAAK,UAAU,CAAC,UAAU,EAAE,CAAC;YACvD,OAAO,KAAK,CAAC,IAAI,CAAC,gBAA8B,CAAC,CAAC;QACtD,CAAC;QAED,OAAO,KAAK,CAAC,OAAO,EAAE,CAAC;IAC3B,CAAC,CAAC,CAAC;AACP,CAAC;AAED,SAAS,uBAAuB,CAC5B,OAAsB,EACtB,MAAe,EACf,WAAgC;IAEhC,IAAI,OAAO,CAAC,gBAAgB,CAAC,WAAW,CAAC,EAAE,CAAC;QACxC,OAAO,iCAAiC,CAAC,WAAW,CAAC,SAAS,EAAE,CAAC,CAAC;IACtE,CAAC;IACD,IAAI,OAAO,CAAC,gBAAgB,CAAC,MAAM,CAAC,EAAE,CAAC;QACnC,OAAO,iCAAiC,CAAC,OAAO,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AAC;AAED,MAAM,UAAU,wBAAwB,CAAC,UAAgC;IACrE,MAAM,oBAAoB,GAAG,UAAU,CAAC,uBAAuB,EAAE,CAAC;IAClE,OAAO,oBAAoB;SACtB,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE;QACb,IAAI,oBAAoB,GAAG,uBAAuB,CAAC,OAAO,CAAC,CAAC;QAE5D,IAAI,oBAAoB,KAAK,SAAS,EAAE,CAAC;YACrC,oBAAoB,GAAG,2BAA2B,CAAC,OAAO,EAAE,UAAU,CAAC,CAAC;QAC5E,CAAC;QAED,IAAI,oBAAoB,KAAK,SAAS,EAAE,CAAC;YACrC,MAAM,WAAW,GAAG,OAAO,CAAC,eAAe,EAAE,CAAC;YAE9C,IAAI,SAAS,CAAC,WAAW,CAAC,EAAE,CAAC;gBACzB,OAAO,SAAS,CAAC;YACrB,CAAC;YAED,MAAM,OAAO,GAAG,6BAA6B,WAAW,cAAc,UAAU,CAAC,WAAW,EAAE,GAAG,CAAC;YAElG,MAAM,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC;QAC7B,CAAC;QAED,OAAO,oBAAoB,CAAC;IAChC,CAAC,CAAC;SACD,MAAM,CAAC,SAAS,CAAC,CAAC;AAC3B,CAAC"}
@@ -0,0 +1,10 @@
1
+ import { Maybe } from 'true-myth';
2
+ import type { FileManager } from '../artifacts/file-manager.js';
3
+ export type SourceMapFileLocatorDependencies = {
4
+ readonly fileManager: FileManager;
5
+ };
6
+ export type SourceMapFileLocator = {
7
+ locate(sourceFile: string): Promise<Maybe<string>>;
8
+ };
9
+ export declare function createSourceMapFileLocator(dependencies: Readonly<SourceMapFileLocatorDependencies>): SourceMapFileLocator;
10
+ //# sourceMappingURL=source-map-file-locator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"source-map-file-locator.d.ts","sourceRoot":"","sources":["../../../../source/dependency-scanner/source-map-file-locator.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAClC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAEhE,MAAM,MAAM,gCAAgC,GAAG;IAC3C,QAAQ,CAAC,WAAW,EAAE,WAAW,CAAC;CACrC,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG;IAC/B,MAAM,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC;CACtD,CAAC;AAIF,wBAAgB,0BAA0B,CACtC,YAAY,EAAE,QAAQ,CAAC,gCAAgC,CAAC,GACzD,oBAAoB,CAsBtB"}
@@ -0,0 +1,23 @@
1
+ import path from 'node:path';
2
+ import { Maybe } from 'true-myth';
3
+ const sourceMappingUrlPattern = /^\/\/# sourceMappingURL=(?<url>.+)$/m;
4
+ export function createSourceMapFileLocator(dependencies) {
5
+ const { fileManager } = dependencies;
6
+ return {
7
+ async locate(sourceFile) {
8
+ const fileContent = await fileManager.readFile(sourceFile);
9
+ const result = sourceMappingUrlPattern.exec(fileContent);
10
+ const sourceMappingUrl = result?.groups?.url;
11
+ if (sourceMappingUrl !== undefined) {
12
+ const folder = path.dirname(sourceFile);
13
+ const sourceMappingFile = path.join(folder, sourceMappingUrl);
14
+ const { isReadable } = await fileManager.checkReadability(sourceMappingFile);
15
+ if (isReadable) {
16
+ return Maybe.just(sourceMappingFile);
17
+ }
18
+ }
19
+ return Maybe.nothing();
20
+ }
21
+ };
22
+ }
23
+ //# sourceMappingURL=source-map-file-locator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"source-map-file-locator.js","sourceRoot":"","sources":["../../../../source/dependency-scanner/source-map-file-locator.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAWlC,MAAM,uBAAuB,GAAG,sCAAsC,CAAC;AAEvE,MAAM,UAAU,0BAA0B,CACtC,YAAwD;IAExD,MAAM,EAAE,WAAW,EAAE,GAAG,YAAY,CAAC;IAErC,OAAO;QACH,KAAK,CAAC,MAAM,CAAC,UAAU;YACnB,MAAM,WAAW,GAAG,MAAM,WAAW,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC;YAC3D,MAAM,MAAM,GAAG,uBAAuB,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;YACzD,MAAM,gBAAgB,GAAG,MAAM,EAAE,MAAM,EAAE,GAAG,CAAC;YAE7C,IAAI,gBAAgB,KAAK,SAAS,EAAE,CAAC;gBACjC,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;gBACxC,MAAM,iBAAiB,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC;gBAC9D,MAAM,EAAE,UAAU,EAAE,GAAG,MAAM,WAAW,CAAC,gBAAgB,CAAC,iBAAiB,CAAC,CAAC;gBAE7E,IAAI,UAAU,EAAE,CAAC;oBACb,OAAO,KAAK,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC;gBACzC,CAAC;YACL,CAAC;YAED,OAAO,KAAK,CAAC,OAAO,EAAE,CAAC;QAC3B,CAAC;KACJ,CAAC;AACN,CAAC"}
@@ -0,0 +1,10 @@
1
+ import type { FileSystemHost } from 'ts-morph';
2
+ export type FileSystemAdaptersDependencies = {
3
+ fileSystemHost: FileSystemHost;
4
+ };
5
+ export type FileSystemAdapters = {
6
+ fileSystemHostWithoutFilter: FileSystemHost;
7
+ fileSystemHostFilteringDeclarationFiles: FileSystemHost;
8
+ };
9
+ export declare function createFileSystemAdapters(dependencies: FileSystemAdaptersDependencies): FileSystemAdapters;
10
+ //# sourceMappingURL=typescript-file-host.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"typescript-file-host.d.ts","sourceRoot":"","sources":["../../../../source/dependency-scanner/typescript-file-host.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAoB/C,MAAM,MAAM,8BAA8B,GAAG;IACzC,cAAc,EAAE,cAAc,CAAC;CAClC,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG;IAC7B,2BAA2B,EAAE,cAAc,CAAC;IAC5C,uCAAuC,EAAE,cAAc,CAAC;CAC3D,CAAC;AAEF,wBAAgB,wBAAwB,CAAC,YAAY,EAAE,8BAA8B,GAAG,kBAAkB,CA6CzG"}