packtory 0.0.9 → 0.0.11

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 (134) hide show
  1. package/artifacts/artifacts-builder.d.ts +0 -14
  2. package/artifacts/artifacts-builder.d.ts.map +1 -1
  3. package/bundle-emitter/emitter.d.ts +0 -30
  4. package/bundle-emitter/emitter.d.ts.map +1 -1
  5. package/bundle-emitter/registry-client.d.ts +0 -21
  6. package/bundle-emitter/registry-client.d.ts.map +1 -1
  7. package/checks/rule.js +0 -8
  8. package/checks/rule.js.map +1 -1
  9. package/checks/rules/max-bundle-size.js +0 -35
  10. package/checks/rules/max-bundle-size.js.map +1 -1
  11. package/checks/rules/no-dev-dependency-imports.js +0 -28
  12. package/checks/rules/no-dev-dependency-imports.js.map +1 -1
  13. package/checks/rules/no-duplicated-files.js +0 -107
  14. package/checks/rules/no-duplicated-files.js.map +1 -1
  15. package/checks/rules/no-side-effects.js +0 -42
  16. package/checks/rules/no-side-effects.js.map +1 -1
  17. package/checks/rules/no-unused-bundle-dependencies.js +0 -24
  18. package/checks/rules/no-unused-bundle-dependencies.js.map +1 -1
  19. package/checks/rules/required-files.js +0 -31
  20. package/checks/rules/required-files.js.map +1 -1
  21. package/checks/rules/unique-target-paths.js +0 -25
  22. package/checks/rules/unique-target-paths.js.map +1 -1
  23. package/common/clock.d.ts +0 -6
  24. package/common/clock.d.ts.map +1 -1
  25. package/common/code-files.js +4 -0
  26. package/common/code-files.js.map +1 -1
  27. package/config/dead-code-elimination-settings.d.ts +5 -0
  28. package/config/dead-code-elimination-settings.d.ts.map +1 -1
  29. package/config/dead-code-elimination-settings.js +18 -1
  30. package/config/dead-code-elimination-settings.js.map +1 -1
  31. package/config/package-interface.d.ts +2 -0
  32. package/config/package-interface.d.ts.map +1 -1
  33. package/config/package-interface.js +5 -2
  34. package/config/package-interface.js.map +1 -1
  35. package/config/package-json.d.ts +0 -2
  36. package/config/package-json.d.ts.map +1 -1
  37. package/config/registry-settings.d.ts +0 -38
  38. package/config/registry-settings.d.ts.map +1 -1
  39. package/config/validation.d.ts +0 -18
  40. package/config/validation.d.ts.map +1 -1
  41. package/config/validation.js +23 -1
  42. package/config/validation.js.map +1 -1
  43. package/dead-code-eliminator/analyzed-bundle.d.ts +1 -8
  44. package/dead-code-eliminator/analyzed-bundle.d.ts.map +1 -1
  45. package/dead-code-eliminator/analyzed-bundle.js.map +1 -1
  46. package/dead-code-eliminator/eliminator.js +15 -3
  47. package/dead-code-eliminator/eliminator.js.map +1 -1
  48. package/dead-code-eliminator/load-bundle.js +17 -11
  49. package/dead-code-eliminator/load-bundle.js.map +1 -1
  50. package/dead-code-eliminator/reachability/binding-extractor.js +20 -7
  51. package/dead-code-eliminator/reachability/binding-extractor.js.map +1 -1
  52. package/dead-code-eliminator/reachability/impure-statements.js +2 -2
  53. package/dead-code-eliminator/reachability/impure-statements.js.map +1 -1
  54. package/dead-code-eliminator/reachability/reachability.js +4 -4
  55. package/dead-code-eliminator/reachability/reachability.js.map +1 -1
  56. package/dead-code-eliminator/side-effect-classifier.js +141 -24
  57. package/dead-code-eliminator/side-effect-classifier.js.map +1 -1
  58. package/dead-code-eliminator/transform/declaration-remover.js +3 -2
  59. package/dead-code-eliminator/transform/declaration-remover.js.map +1 -1
  60. package/dead-code-eliminator/variable-declaration-bindings.js +34 -0
  61. package/dead-code-eliminator/variable-declaration-bindings.js.map +1 -0
  62. package/dependency-scanner/dependency-graph.d.ts +0 -29
  63. package/dependency-scanner/dependency-graph.d.ts.map +1 -1
  64. package/dependency-scanner/external-dependencies.d.ts +0 -1
  65. package/dependency-scanner/external-dependencies.d.ts.map +1 -1
  66. package/dependency-scanner/scanner.d.ts +0 -13
  67. package/dependency-scanner/scanner.d.ts.map +1 -1
  68. package/dependency-scanner/source-file-references.js +1 -17
  69. package/dependency-scanner/source-file-references.js.map +1 -1
  70. package/dependency-scanner/source-map-file-locator.d.ts +0 -7
  71. package/dependency-scanner/source-map-file-locator.d.ts.map +1 -1
  72. package/dependency-scanner/typescript-file-host.d.ts +0 -9
  73. package/dependency-scanner/typescript-file-host.d.ts.map +1 -1
  74. package/dependency-scanner/typescript-project-analyzer.d.ts +0 -18
  75. package/dependency-scanner/typescript-project-analyzer.d.ts.map +1 -1
  76. package/directed-graph/graph.d.ts +0 -27
  77. package/directed-graph/graph.d.ts.map +1 -1
  78. package/file-manager/file-manager.d.ts +0 -15
  79. package/file-manager/file-manager.d.ts.map +1 -1
  80. package/linker/linker.d.ts +0 -8
  81. package/linker/linker.d.ts.map +1 -1
  82. package/linker/substitute-bundles.js +5 -0
  83. package/linker/substitute-bundles.js.map +1 -1
  84. package/package-surface/modules.js +9 -0
  85. package/package-surface/modules.js.map +1 -1
  86. package/package-surface/surface.d.ts +0 -3
  87. package/package-surface/surface.d.ts.map +1 -1
  88. package/package.json +41 -3
  89. package/packtory/map-config.d.ts +0 -10
  90. package/packtory/map-config.d.ts.map +1 -1
  91. package/packtory/package-processor-build.js +3 -3
  92. package/packtory/package-processor-build.js.map +1 -1
  93. package/packtory/package-processor-publish.d.ts +0 -16
  94. package/packtory/package-processor-publish.d.ts.map +1 -1
  95. package/packtory/package-processor.d.ts +0 -17
  96. package/packtory/package-processor.d.ts.map +1 -1
  97. package/packtory/packtory-resolve.js +16 -9
  98. package/packtory/packtory-resolve.js.map +1 -1
  99. package/packtory/packtory-results.d.ts +0 -10
  100. package/packtory/packtory-results.d.ts.map +1 -1
  101. package/packtory/packtory.d.ts +0 -8
  102. package/packtory/packtory.d.ts.map +1 -1
  103. package/packtory/prepare-package-options.d.ts +2 -16
  104. package/packtory/prepare-package-options.d.ts.map +1 -1
  105. package/packtory/prepare-package-options.js +5 -0
  106. package/packtory/prepare-package-options.js.map +1 -1
  107. package/packtory/resolved-package.d.ts +0 -2
  108. package/packtory/resolved-package.d.ts.map +1 -1
  109. package/packtory/scheduler.d.ts +0 -37
  110. package/packtory/scheduler.d.ts.map +1 -1
  111. package/progress/progress-broadcaster.d.ts +0 -13
  112. package/progress/progress-broadcaster.d.ts.map +1 -1
  113. package/report/report-aggregator.d.ts +0 -5
  114. package/report/report-aggregator.d.ts.map +1 -1
  115. package/resource-resolver/resolved-bundle.d.ts +0 -10
  116. package/resource-resolver/resolved-bundle.d.ts.map +1 -1
  117. package/resource-resolver/resource-resolve-options.d.ts +0 -4
  118. package/resource-resolver/resource-resolve-options.d.ts.map +1 -1
  119. package/resource-resolver/resource-resolver.d.ts +0 -8
  120. package/resource-resolver/resource-resolver.d.ts.map +1 -1
  121. package/sbom/license-resolver.d.ts +0 -11
  122. package/sbom/license-resolver.d.ts.map +1 -1
  123. package/sbom/sbom-file.d.ts +0 -12
  124. package/sbom/sbom-file.d.ts.map +1 -1
  125. package/sbom/sbom-serializer.d.ts +0 -4
  126. package/sbom/sbom-serializer.d.ts.map +1 -1
  127. package/tar/tarball-builder.d.ts +0 -4
  128. package/tar/tarball-builder.d.ts.map +1 -1
  129. package/version-manager/manager.d.ts +0 -4
  130. package/version-manager/manager.d.ts.map +1 -1
  131. package/version-manager/versioned-bundle-imports.d.ts +0 -1
  132. package/version-manager/versioned-bundle-imports.d.ts.map +1 -1
  133. package/version-manager/versioned-bundle.d.ts +0 -1
  134. package/version-manager/versioned-bundle.d.ts.map +1 -1
@@ -3,19 +3,5 @@ import type { FileManager } from '../file-manager/file-manager.ts';
3
3
  import type { ProgressBroadcastProvider } from '../progress/progress-broadcaster.ts';
4
4
  import type { VersionedBundleWithManifest } from '../version-manager/versioned-bundle.ts';
5
5
  import type { TarballBuilder } from '../tar/tarball-builder.ts';
6
- export type ArtifactsBuilderDependencies = {
7
- readonly fileManager: FileManager;
8
- readonly tarballBuilder: TarballBuilder;
9
- readonly progressBroadcaster: ProgressBroadcastProvider;
10
- };
11
- type TarballArtifact = {
12
- readonly tarData: Buffer;
13
- };
14
- export type ArtifactsBuilder = {
15
- collectContents: (bundle: VersionedBundleWithManifest, prefix?: string, extraFiles?: readonly FileDescription[]) => readonly FileDescription[];
16
- buildTarball: (bundle: VersionedBundleWithManifest, extraFiles?: readonly FileDescription[]) => Promise<TarballArtifact>;
17
- buildFolder: (bundle: VersionedBundleWithManifest, targetFolder: string, extraFiles?: readonly FileDescription[]) => Promise<void>;
18
- };
19
- export declare function createArtifactsBuilder(artifactsBuilderDependencies: ArtifactsBuilderDependencies): ArtifactsBuilder;
20
6
  export {};
21
7
  //# sourceMappingURL=artifacts-builder.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"artifacts-builder.d.ts","sourceRoot":"","sources":["../../../../source/artifacts/artifacts-builder.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;AAC3E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AACnE,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,qCAAqC,CAAC;AAErF,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,wCAAwC,CAAC;AAC1F,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAEhE,MAAM,MAAM,4BAA4B,GAAG;IACvC,QAAQ,CAAC,WAAW,EAAE,WAAW,CAAC;IAClC,QAAQ,CAAC,cAAc,EAAE,cAAc,CAAC;IACxC,QAAQ,CAAC,mBAAmB,EAAE,yBAAyB,CAAC;CAC3D,CAAC;AAEF,KAAK,eAAe,GAAG;IACnB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC5B,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG;IAC3B,eAAe,EAAE,CACb,MAAM,EAAE,2BAA2B,EACnC,MAAM,CAAC,EAAE,MAAM,EACf,UAAU,CAAC,EAAE,SAAS,eAAe,EAAE,KACtC,SAAS,eAAe,EAAE,CAAC;IAChC,YAAY,EAAE,CACV,MAAM,EAAE,2BAA2B,EACnC,UAAU,CAAC,EAAE,SAAS,eAAe,EAAE,KACtC,OAAO,CAAC,eAAe,CAAC,CAAC;IAC9B,WAAW,EAAE,CACT,MAAM,EAAE,2BAA2B,EACnC,YAAY,EAAE,MAAM,EACpB,UAAU,CAAC,EAAE,SAAS,eAAe,EAAE,KACtC,OAAO,CAAC,IAAI,CAAC,CAAC;CACtB,CAAC;AAEF,wBAAgB,sBAAsB,CAAC,4BAA4B,EAAE,4BAA4B,GAAG,gBAAgB,CA4FnH"}
1
+ {"version":3,"file":"artifacts-builder.d.ts","sourceRoot":"","sources":["../../../../source/artifacts/artifacts-builder.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qCAAqC;AAC1E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iCAAiC;AAClE,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,qCAAqC;AAEpF,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,wCAAwC;AACzF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B"}
@@ -6,35 +6,5 @@ import type { VersioningSettings } from '../config/versioning-settings.ts';
6
6
  import type { FileDescription } from '../file-manager/file-description.ts';
7
7
  import type { VersionedBundleWithManifest } from '../version-manager/versioned-bundle.ts';
8
8
  import type { RegistryClient } from './registry-client.ts';
9
- export type BundleEmitterDependencies = {
10
- readonly artifactsBuilder: ArtifactsBuilder;
11
- readonly registryClient: RegistryClient;
12
- readonly ciRepositoryUrl: string | undefined;
13
- };
14
- type PublishOptions = {
15
- readonly bundle: VersionedBundleWithManifest;
16
- readonly registrySettings: RegistrySettings;
17
- readonly publishSettings: PublishSettings;
18
- readonly extraFiles?: readonly FileDescription[];
19
- };
20
- type AlreadyPublishedCheckOptions = {
21
- readonly bundle: VersionedBundleWithManifest;
22
- readonly registrySettings: RegistrySettings;
23
- readonly extraFiles?: readonly FileDescription[];
24
- };
25
- type CurrentVersionLookupOptions = {
26
- readonly name: string;
27
- readonly registrySettings: RegistrySettings;
28
- readonly versioning: VersioningSettings;
29
- };
30
- type BundlePublishedCheckResult = {
31
- readonly alreadyPublishedAsLatest: boolean;
32
- };
33
- export type BundleEmitter = {
34
- publish: (options: PublishOptions) => Promise<void>;
35
- determineCurrentVersion: (options: CurrentVersionLookupOptions) => Promise<Maybe<string>>;
36
- checkBundleAlreadyPublished: (options: AlreadyPublishedCheckOptions) => Promise<BundlePublishedCheckResult>;
37
- };
38
- export declare function createBundleEmitter(dependencies: BundleEmitterDependencies): BundleEmitter;
39
9
  export {};
40
10
  //# sourceMappingURL=emitter.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"emitter.d.ts","sourceRoot":"","sources":["../../../../source/bundle-emitter/emitter.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAClC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AAC1E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AACrE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AACvE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AAC3E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;AAE3E,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,wCAAwC,CAAC;AAE1F,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAG3D,MAAM,MAAM,yBAAyB,GAAG;IACpC,QAAQ,CAAC,gBAAgB,EAAE,gBAAgB,CAAC;IAC5C,QAAQ,CAAC,cAAc,EAAE,cAAc,CAAC;IACxC,QAAQ,CAAC,eAAe,EAAE,MAAM,GAAG,SAAS,CAAC;CAChD,CAAC;AAEF,KAAK,cAAc,GAAG;IAClB,QAAQ,CAAC,MAAM,EAAE,2BAA2B,CAAC;IAC7C,QAAQ,CAAC,gBAAgB,EAAE,gBAAgB,CAAC;IAC5C,QAAQ,CAAC,eAAe,EAAE,eAAe,CAAC;IAC1C,QAAQ,CAAC,UAAU,CAAC,EA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AK,EAAE,eAAe,EAAE,MAAM,qCAAqC;AAE1E,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,wCAAwC;AAEzF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB"}
@@ -5,26 +5,5 @@ import type { Clock } from '../common/clock.ts';
5
5
  import type { PublishSettings } from '../config/publish-settings.ts';
6
6
  import type { PublishAuthStrategy, RegistrySettings } from '../config/registry-settings.ts';
7
7
  import type { BundlePackageJson } from '../version-manager/versioned-bundle.ts';
8
- type PublishFunction = typeof _publish;
9
- export type RegistryClientDependencies = {
10
- readonly npmFetch: typeof _npmFetch;
11
- readonly publish: PublishFunction;
12
- readonly fetch: typeof globalThis.fetch;
13
- readonly clock: Clock;
14
- readonly resolveIdToken: (auth: Extract<PublishAuthStrategy, {
15
- type: 'npm-oidc';
16
- }>) => Promise<string>;
17
- readonly promptForOneTimePassword?: (() => Promise<string | undefined>) | undefined;
18
- };
19
- export type RegistryClient = {
20
- fetchLatestVersion: (packageName: string, config: RegistrySettings) => Promise<Maybe<PackageVersionDetails>>;
21
- publishPackage: (manifest: Readonly<BundlePackageJson>, tarData: Buffer, config: RegistrySettings, publishSettings: PublishSettings) => Promise<void>;
22
- fetchTarball: (tarballUrl: string, config: RegistrySettings) => Promise<Buffer>;
23
- };
24
- type PackageVersionDetails = {
25
- readonly version: string;
26
- readonly tarballUrl: string;
27
- };
28
- export declare function createRegistryClient(dependencies: Readonly<RegistryClientDependencies>): RegistryClient;
29
8
  export {};
30
9
  //# sourceMappingURL=registry-client.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"registry-client.d.ts","sourceRoot":"","sources":["../../../../source/bundle-emitter/registry-client.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,SAAS,MAAM,oBAAoB,CAAC;AAChD,OAAO,KAAK,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzD,OAAO,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAElC,OAAO,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F,CAAC;AAmDF,KAAK,qBAAqB,GAAG;IACzB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;CAC/B,CAAC;AA4FF,wBAAgB,oBAAoB,CAAC,YAAY,EAAE,QAAQ,CAAC,0BAA0B,CAAC,GAAG,cAAc,CAwNvG"}
1
+ {"version":3,"file":"registry-client.d.ts","sourceRoot":"","sources":["../../../../source/bundle-emitter/registry-client.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,SAAS,MAAM,oBAAoB;AAC/C,OAAO,KAAK,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,eAAe;AACxD,OAAO,EAAE,KAAK,EAAE,MAAM,WAAW;AAEjC,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,oBAAoB;AAC/C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,+BAA+B;AACpE,OAAO,KAAK,EAGR,mBAAmB,EACnB,gBAAgB,EACnB,MAAM,gCAAgC;AACvC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wCAAwC"}
package/checks/rule.js CHANGED
@@ -2,12 +2,4 @@ import { z } from 'zod/mini';
2
2
  import { nonEmptyStringSchema } from "../config/base-validations.js";
3
3
  export const enabledOnlyGlobalSchema = z.strictObject({ enabled: z.boolean() });
4
4
  export const emptyPerPackageSchema = z.strictObject({});
5
- const pathAllowListShape = {
6
- allowList: z.optional(z.readonly(z.array(nonEmptyStringSchema)))
7
- };
8
- export const pathAllowListGlobalSchema = z.strictObject({
9
- enabled: z.boolean(),
10
- ...pathAllowListShape
11
- });
12
- export const pathAllowListPerPackageSchema = z.strictObject(pathAllowListShape);
13
5
  //# sourceMappingURL=rule.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"rule.js","sourceRoot":"","sources":["../../../../source/checks/rule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAoB,MAAM,UAAU,CAAC;AAC/C,OAAO,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AAGrE,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,CAAC,YAAY,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;AAChF,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,CAAC,YAAY,CAAC,EAAE,CAAC,CAAC;AAExD,MAAM,kBAAkB,GAAG;IACvB,SAAS,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,oBAAoB,CAAC,CAAC,CAAC;CACnE,CAAC;AAEF,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAAC,CAAC,YAAY,CAAC;IACpD,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE;IACpB,GAAG,kBAAkB;CACxB,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,6BAA6B,GAAG,CAAC,CAAC,YAAY,CAAC,kBAAkB,CAAC,CAAC"}
1
+ {"version":3,"file":"rule.js","sourceRoot":"","sources":["../../../../source/checks/rule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAoB,MAAM,UAAU;AAC9C,OAAO,EAAE,oBAAoB,EAAE,MAAM,+BAA+B;AAGpE,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,CAAC,YAAY,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC;AAC/E,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,CAAC,YAAY,CAAC,EAAE,CAAC"}
@@ -1,40 +1,5 @@
1
1
  import { z } from 'zod/mini';
2
2
  const ruleName = 'maxBundleSize';
3
- const byteLimitSchema = z.number().check(z.int(), z.nonnegative());
4
- const globalSchema = z.strictObject({
5
- enabled: z.boolean(),
6
- bytes: z.optional(byteLimitSchema)
7
- });
8
- const perPackageSchema = z.strictObject({
9
- bytes: z.optional(byteLimitSchema)
10
- });
11
- function bundleSizeBytes(bundle) {
12
- let total = 0;
13
- for (const resource of bundle.contents) {
14
- total += Buffer.byteLength(resource.fileDescription.content);
15
- }
16
- return total;
17
- }
18
- function checkBundle(bundle, threshold) {
19
- if (threshold === undefined) {
20
- return [];
21
- }
22
- const size = bundleSizeBytes(bundle);
23
- if (size <= threshold) {
24
- return [];
25
- }
26
- return [`Package "${bundle.name}" exceeds the maximum bundle size: ${size} bytes (limit: ${threshold} bytes)`];
27
- }
28
- function run(params) {
29
- const globalConfig = params.settings?.maxBundleSize;
30
- if (globalConfig?.enabled !== true) {
31
- return [];
32
- }
33
- return params.bundles.flatMap((bundle) => {
34
- const override = params.perPackageSettings.get(bundle.name)?.maxBundleSize?.bytes;
35
- return checkBundle(bundle, override ?? globalConfig.bytes);
36
- });
37
- }
38
3
  export const maxBundleSizeRule = {
39
4
  name: ruleName,
40
5
  globalSchema,
@@ -1 +1 @@
1
- {"version":3,"file":"max-bundle-size.js","sourceRoot":"","sources":["../../../../../source/checks/rules/max-bundle-size.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,UAAU,CAAC;AAI7B,MAAM,QAAQ,GAAG,eAAe,CAAC;AAEjC,MAAM,eAAe,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,WAAW,EAAE,CAAC,CAAC;AAEnE,MAAM,YAAY,GAAG,CAAC,CAAC,YAAY,CAAC;IAChC,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE;IACpB,KAAK,EAAE,CAAC,CAAC,QAAQ,CAAC,eAAe,CAAC;CACrC,CAAC,CAAC;AAEH,MAAM,gBAAgB,GAAG,CAAC,CAAC,YAAY,CAAC;IACpC,KAAK,EAAE,CAAC,CAAC,QAAQ,CAAC,eAAe,CAAC;CACrC,CAAC,CAAC;AAMH,SAAS,eAAe,CAAC,MAAsB;IAC3C,IAAI,KAAK,GAAG,CAAC,CAAC;IACd,KAAK,MAAM,QA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CAAC,EAAE,MAAM,UAAU;AAI5B,MAAM,QAAQ,GAAG,eAAe;AAgDhC,MAAM,CAAC,MAAM,iBAAiB,GAAyE;IACnG,IAAI,EAAE,QAAQ;IACd,YAAY;IACZ,gBAAgB;IAChB,GAAG;CACN"}
@@ -1,33 +1,5 @@
1
1
  import { emptyPerPackageSchema, enabledOnlyGlobalSchema } from "../rule.js";
2
2
  const ruleName = 'noDevDependencyImports';
3
- function findLeakedDevDependencies(bundle, packageConfig) {
4
- const mainPackageJson = packageConfig?.mainPackageJson;
5
- if (mainPackageJson === undefined) {
6
- return [];
7
- }
8
- const runtimeDependencyNames = new Set([
9
- ...Object.keys(mainPackageJson.dependencies ?? {}),
10
- ...Object.keys(mainPackageJson.peerDependencies ?? {})
11
- ]);
12
- const devDependencyNames = new Set(Object.keys(mainPackageJson.devDependencies ?? {}));
13
- return Array.from(bundle.externalDependencies.keys())
14
- .filter((name) => {
15
- return devDependencyNames.has(name) && !runtimeDependencyNames.has(name);
16
- })
17
- .map((name) => {
18
- const reason = 'is only declared in devDependencies of the main package.json';
19
- return `Package "${bundle.name}" imports "${name}" which ${reason}`;
20
- });
21
- }
22
- function run(params) {
23
- const globalConfig = params.settings?.noDevDependencyImports;
24
- if (globalConfig?.enabled !== true) {
25
- return [];
26
- }
27
- return params.bundles.flatMap((bundle) => {
28
- return findLeakedDevDependencies(bundle, params.packageConfigs?.[bundle.name]);
29
- });
30
- }
31
3
  export const noDevDependencyImportsRule = {
32
4
  name: ruleName,
33
5
  globalSchema: enabledOnlyGlobalSchema,
@@ -1 +1 @@
1
- {"version":3,"file":"no-dev-dependency-imports.js","sourceRoot":"","sources":["../../../../../source/checks/rules/no-dev-dependency-imports.ts"],"names":[],"mappings":"AAEA,OAAO,EACH,qBAAqB,EACrB,uBAAuB,EAI1B,MAAM,YAAY,CAAC;AAEpB,MAAM,QAAQ,GAAG,wBAAwB,CAAC;AAM1C,SAAS,yBAAyB,CAC9B,MAAsB,EACtB,aAA4C;IAE5C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C,CAAC;IACnF,CAAC,CAAC,CAAC;AACP,CAAC;AAED,MAAM,CAAC,MAAM,0BAA0B,GAAyE;IAC5G,IAAI,EAAE,QAAQ;IACd,YAAY,EAAE,uBAAuB;IACrC,gBAAgB,EAAE,qBAAqB;IACvC,GAAG;CACN,CAAC"}
1
+ {"version":3,"file":"no-dev-dependency-imports.js","sourceRoot":"","sources":["../../../../../source/checks/rules/no-dev-dependency-imports.ts"],"names":[],"mappings":"AAEA,OAAO,EACH,qBAAqB,EACrB,uBAAuB,EAI1B,MAAM,YAAY;AAEnB,MAAM,QAAQ,GAAG,wBAAwB;AAyCzC,MAAM,CAAC,MAAM,0BAA0B,GAAyE;IAC5G,IAAI,EAAE,QAAQ;IACd,YAAY,EAAE,uBAAuB;IACrC,gBAAgB,EAAE,qBAAqB;IACvC,GAAG;CACN"}
@@ -1,112 +1,5 @@
1
1
  import { pathAllowListGlobalSchema, pathAllowListPerPackageSchema } from "../rule.js";
2
2
  const ruleName = 'noDuplicatedFiles';
3
- const globalSchema = pathAllowListGlobalSchema;
4
- const perPackageSchema = pathAllowListPerPackageSchema;
5
- function collectFileOwnership(bundles) {
6
- const ownership = new Map();
7
- for (const bundle of bundles) {
8
- for (const resource of bundle.contents) {
9
- const filePath = resource.fileDescription.sourceFilePath;
10
- const owners = ownership.get(filePath) ?? [];
11
- owners.push({
12
- bundleName: bundle.name,
13
- survivingBindings: resource.analysis.survivingBindings
14
- });
15
- ownership.set(filePath, owners);
16
- }
17
- }
18
- return ownership;
19
- }
20
- function intersectTwo(left, right) {
21
- const result = new Set();
22
- for (const name of left) {
23
- if (right.has(name)) {
24
- result.add(name);
25
- }
26
- }
27
- return result;
28
- }
29
- function intersectAll(sets) {
30
- const [first, ...rest] = sets;
31
- return rest.reduce(intersectTwo, new Set(first));
32
- }
33
- function ownerNames(owners) {
34
- return owners
35
- .map((owner) => {
36
- return owner.bundleName;
37
- })
38
- .toSorted((left, right) => {
39
- return left.localeCompare(right);
40
- });
41
- }
42
- function everyOwnerConsents(filePath, owners, perPackageSettings) {
43
- return owners.every((owner) => {
44
- const allowList = perPackageSettings.get(owner.bundleName)?.noDuplicatedFiles?.allowList;
45
- return allowList?.includes(filePath) ?? false;
46
- });
47
- }
48
- function formatSharedDeclarationsMessage(filePath, sharedDeclarations, owners) {
49
- const ownersList = ownerNames(owners).join(', ');
50
- const sortedDeclarations = Array.from(sharedDeclarations).toSorted((left, right) => {
51
- return left.localeCompare(right);
52
- });
53
- const lines = [
54
- `File "${filePath}" has shared declarations across multiple packages:`,
55
- ...sortedDeclarations.map((declaration) => {
56
- return ` - "${declaration}" → ${ownersList}`;
57
- })
58
- ];
59
- return lines.join('\n');
60
- }
61
- function formatPathLevelMessage(filePath, owners) {
62
- return `File "${filePath}" is included in multiple packages: ${ownerNames(owners).join(', ')}`;
63
- }
64
- const minimumOwnerCountForDuplicate = 2;
65
- function hasMultipleOwners(owners) {
66
- return owners.length >= minimumOwnerCountForDuplicate;
67
- }
68
- function duplicateMessage(filePath, owners) {
69
- const allOwnersHaveNoBindings = owners.every((owner) => {
70
- return owner.survivingBindings.size === 0;
71
- });
72
- if (allOwnersHaveNoBindings) {
73
- return formatPathLevelMessage(filePath, owners);
74
- }
75
- const [firstOwner, ...remainingOwners] = owners;
76
- const sharedDeclarations = intersectAll([
77
- firstOwner.survivingBindings,
78
- ...remainingOwners.map((owner) => {
79
- return owner.survivingBindings;
80
- })
81
- ]);
82
- if (sharedDeclarations.size === 0) {
83
- return undefined;
84
- }
85
- return formatSharedDeclarationsMessage(filePath, sharedDeclarations, owners);
86
- }
87
- function findDuplicateIssues(bundles, perPackageSettings, globalConfig) {
88
- const globallyAllowed = new Set(globalConfig.allowList);
89
- return Array.from(collectFileOwnership(bundles).entries()).flatMap(([filePath, owners]) => {
90
- if (!hasMultipleOwners(owners)) {
91
- return [];
92
- }
93
- const message = duplicateMessage(filePath, owners);
94
- if (message === undefined) {
95
- return [];
96
- }
97
- if (globallyAllowed.has(filePath) || everyOwnerConsents(filePath, owners, perPackageSettings)) {
98
- return [];
99
- }
100
- return [message];
101
- });
102
- }
103
- function run(params) {
104
- const globalConfig = params.settings?.noDuplicatedFiles;
105
- if (globalConfig?.enabled !== true) {
106
- return [];
107
- }
108
- return findDuplicateIssues(params.bundles, params.perPackageSettings, globalConfig);
109
- }
110
3
  export const noDuplicatedFilesRule = {
111
4
  name: ruleName,
112
5
  globalSchema,
@@ -1 +1 @@
1
- {"version":3,"file":"no-duplicated-files.js","sourceRoot":"","sources":["../../../../../source/checks/rules/no-duplicated-files.ts"],"names":[],"mappings":"AAEA,OAAO,EACH,yBAAyB,EACzB,6BAA6B,EAGhC,MAAM,YAAY,CAAC;AAEpB,MAAM,QAAQ,GAAG,mBAAmB,CAAC;AAErC,MAAM,YAAY,GAAG,yBAAyB,CAAC;AAC/C,MAAM,gBAAgB,GAAG,6BAA6B,CAAC;AAWvD,SAAS,oBAAoB,CAAC,OAAkC;IAC5D,MAAM,SAAS,GAAG,IAAI,GAAG,EAAuB,CAAC;IAEjD,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE,CAAC;QAC3B,KAAK,MAAM,QAAQ,IAAI,MAAM,CAAC,QAAQ,EAAE,CAAC;YACrC,MAAM,QAAQ,GAAG,QAAQ,CAAC,eAAe,CAAC,cAAc,CAAC;YACzD,MAAM,MAAM,GAAG,SAAS,CAAC,GAAG,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC;YAC7C,MAAM,CAAC,IAAI,CAAC;gBACR,UAAU,EAAE,MAAM,CAAC,IAAI;gBACvB,iBAAiB,EAAE,QAAQ,CAAC,QAAQ,CAAC,iBAAiB;aACzD,CAAC,CAAC;YACH,SAAS,CAAC,GAAG,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;QACpC,CAAC;IACL,CAAC;IAED,OAAO,SAAS,CAAC;AACrB,CAAC;AAED,SAAS,YAAY,CAAC,IAAyB,EAAE,KAA0B;IACvE,MAAM,MAAM,GAAG,IAAI,GAAG,EAAU,CAAC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,YAAY,CAAC,CAAC;AACxF,CAAC;AAED,MAAM,CAAC,MAAM,qBAAqB,GAAyE;IACvG,IAAI,EAAE,QAAQ;IACd,YAAY;IACZ,gBAAgB;IAChB,GAAG;CACN,CAAC"}
1
+ {"version":3,"file":"no-duplicated-files.js","sourceRoot":"","sources":["../../../../../source/checks/rules/no-duplicated-files.ts"],"names":[],"mappings":"AAEA,OAAO,EACH,yBAAyB,EACzB,6BAA6B,EAGhC,MAAM,YAAY;AAEnB,MAAM,QAAQ,GAAG,mBAAmB;AAmJpC,MAAM,CAAC,MAAM,qBAAqB,GAAyE;IACvG,IAAI,EAAE,QAAQ;IACd,YAAY;IACZ,gBAAgB;IAChB,GAAG;CACN"}
@@ -1,47 +1,5 @@
1
1
  import { pathAllowListGlobalSchema, pathAllowListPerPackageSchema } from "../rule.js";
2
2
  const ruleName = 'noSideEffects';
3
- const globalSchema = pathAllowListGlobalSchema;
4
- const perPackageSchema = pathAllowListPerPackageSchema;
5
- function formatStatement(statement) {
6
- return `line ${statement.line}: ${statement.kind}`;
7
- }
8
- function isAllowedFor(sourceFilePath, bundleName, globalAllowList, perPackageSettings) {
9
- if (globalAllowList.has(sourceFilePath)) {
10
- return true;
11
- }
12
- const packageAllowList = perPackageSettings.get(bundleName)?.noSideEffects?.allowList;
13
- return packageAllowList?.includes(sourceFilePath) ?? false;
14
- }
15
- function reportResource(bundleName, resource) {
16
- const sourcePath = resource.fileDescription.sourceFilePath;
17
- const lines = resource.analysis.sideEffectStatements.map((statement) => {
18
- return ` - ${formatStatement(statement)}`;
19
- });
20
- const header = `File "${sourcePath}" in package "${bundleName}" has top-level side effects:`;
21
- const footer = 'Side effects prevent downstream tree-shaking.';
22
- return [header, ...lines, footer].join('\n');
23
- }
24
- function findSideEffectsInBundle(bundle, globalAllowList, perPackageSettings) {
25
- return bundle.contents.flatMap((resource) => {
26
- if (resource.analysis.sideEffectStatements.length === 0) {
27
- return [];
28
- }
29
- if (isAllowedFor(resource.fileDescription.sourceFilePath, bundle.name, globalAllowList, perPackageSettings)) {
30
- return [];
31
- }
32
- return [reportResource(bundle.name, resource)];
33
- });
34
- }
35
- function run(params) {
36
- const globalConfig = params.settings?.noSideEffects;
37
- if (globalConfig?.enabled !== true) {
38
- return [];
39
- }
40
- const globalAllowList = new Set(globalConfig.allowList);
41
- return params.bundles.flatMap((bundle) => {
42
- return findSideEffectsInBundle(bundle, globalAllowList, params.perPackageSettings);
43
- });
44
- }
45
3
  export const noSideEffectsRule = {
46
4
  name: ruleName,
47
5
  globalSchema,
@@ -1 +1 @@
1
- {"version":3,"file":"no-side-effects.js","sourceRoot":"","sources":["../../../../../source/checks/rules/no-side-effects.ts"],"names":[],"mappings":"AAEA,OAAO,EACH,yBAAyB,EACzB,6BAA6B,EAGhC,MAAM,YAAY,CAAC;AAEpB,MAAM,QAAQ,GAAG,eAAe,CAAC;AAEjC,MAAM,YAAY,GAAG,yBAAyB,CAAC;AAC/C,MAAM,gBAAgB,GAAG,6BAA6B,CAAC;AAMvD,SAAS,eAAe,CAAC,SAA2D;IAChF,OAAO,QAAQ,SAAS,CAAC,IAAI,KAAK,SAAS,CAAC,IAAI,EAAE,CAAC;AACvD,CAAC;AAED,SAAS,YAAY,CACjB,cAAsB,EACtB,UAAkB,EAClB,eAAoC,EACpC,kBAAmD;IAEnD,IAAI,eAAe,CAAC,GAAG,CAAC,cAAc,CAAC,EAAE,CAAC;QACtC,OAAO,IAAI,CAAC;IAChB,CAAC;IACD,MAAM,gBAAgB,GAAG,kBAAkB,CAAC,GAAG,CAAC,UAAU,CAAC,EAAE,aAAa,EAAE,SAAS,CAAC;IACtF,OAAO,gBAAgB,EAAE,QAAQ,CAAC,cAAc,CAAC,IAAI,KAAK,CAAC;AAC/D,CAAC;AAED,SAAS,cAAc,CAAC,UAAkB,EAAE,QAAgC;IACxE,MAAM,UAAU,GAAG,QAAQ,CAAC,eAAe,CAAC,cAAc,CAAC;IAC3D,MAAM,KAAK,GAAG,QAAQ,CAAC,QAAQ,C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EAAE,eAAe,EAAE,MAAM,CAAC,kBAAkB,CAAC,CAAC;IACvF,CAAC,CAAC,CAAC;AACP,CAAC;AAED,MAAM,CAAC,MAAM,iBAAiB,GAAyE;IACnG,IAAI,EAAE,QAAQ;IACd,YAAY;IACZ,gBAAgB;IAChB,GAAG;CACN,CAAC"}
1
+ {"version":3,"file":"no-side-effects.js","sourceRoot":"","sources":["../../../../../source/checks/rules/no-side-effects.ts"],"names":[],"mappings":"AAEA,OAAO,EACH,yBAAyB,EACzB,6BAA6B,EAGhC,MAAM,YAAY;AAEnB,MAAM,QAAQ,GAAG,eAAe;AA+DhC,MAAM,CAAC,MAAM,iBAAiB,GAAyE;IACnG,IAAI,EAAE,QAAQ;IACd,YAAY;IACZ,gBAAgB;IAChB,GAAG;CACN"}
@@ -1,29 +1,5 @@
1
1
  import { emptyPerPackageSchema, enabledOnlyGlobalSchema } from "../rule.js";
2
2
  const ruleName = 'noUnusedBundleDependencies';
3
- function findUnused(bundle, declared, kind) {
4
- return declared
5
- .filter((dependencyName) => {
6
- return !bundle.linkedBundleDependencies.has(dependencyName);
7
- })
8
- .map((dependencyName) => {
9
- return `Unused ${kind} dependency "${dependencyName}" declared by package "${bundle.name}"`;
10
- });
11
- }
12
- function checkBundle(bundle, packageConfig) {
13
- return [
14
- ...findUnused(bundle, packageConfig?.bundleDependencies ?? [], 'bundle'),
15
- ...findUnused(bundle, packageConfig?.bundlePeerDependencies ?? [], 'bundle peer')
16
- ];
17
- }
18
- function run(params) {
19
- const globalConfig = params.settings?.noUnusedBundleDependencies;
20
- if (globalConfig?.enabled !== true) {
21
- return [];
22
- }
23
- return params.bundles.flatMap((bundle) => {
24
- return checkBundle(bundle, params.packageConfigs?.[bundle.name]);
25
- });
26
- }
27
3
  export const noUnusedBundleDependenciesRule = {
28
4
  name: ruleName,
29
5
  globalSchema: enabledOnlyGlobalSchema,
@@ -1 +1 @@
1
- {"version":3,"file":"no-unused-bundle-dependencies.js","sourceRoot":"","sources":["../../../../../source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,EAAE,uBAAuB;IACrC,gBAAgB,EAAE,qBAAqB;IACvC,GAAG;CACN,CAAC"}
1
+ {"version":3,"file":"no-unused-bundle-dependencies.js","sourceRoot":"","sources":["../../../../../source/checks/rules/no-unused-bundle-dependencies.ts"],"names":[],"mappings":"AAEA,OAAO,EACH,qBAAqB,EACrB,uBAAuB,EAI1B,MAAM,YAAY;AAEnB,MAAM,QAAQ,GAAG,4BAA4B;AAoC7C,MAAM,CAAC,MAAM,8BAA8B,GAAyE;IAChH,IAAI,EAAE,QAAQ;IACd,YAAY,EAAE,uBAAuB;IACrC,gBAAgB,EAAE,qBAAqB;IACvC,GAAG;CACN"}
@@ -1,37 +1,6 @@
1
1
  import { z } from 'zod/mini';
2
2
  import { nonEmptyStringSchema } from "../../config/base-validations.js";
3
3
  const ruleName = 'requiredFiles';
4
- const fileListSchema = z.readonly(z.array(nonEmptyStringSchema));
5
- const globalSchema = z.strictObject({
6
- enabled: z.boolean(),
7
- files: z.optional(fileListSchema)
8
- });
9
- const perPackageSchema = z.strictObject({
10
- files: z.optional(fileListSchema)
11
- });
12
- function effectiveRequiredFiles(globalConfig, perPackageConfig) {
13
- return Array.from(new Set([...(globalConfig.files ?? []), ...(perPackageConfig?.files ?? [])]));
14
- }
15
- function findMissingFiles(bundle, requiredFiles) {
16
- const presentTargets = new Set(bundle.contents.map((resource) => {
17
- return resource.fileDescription.targetFilePath;
18
- }));
19
- return requiredFiles.filter((file) => {
20
- return !presentTargets.has(file);
21
- });
22
- }
23
- function run(params) {
24
- const globalConfig = params.settings?.requiredFiles;
25
- if (globalConfig?.enabled !== true) {
26
- return [];
27
- }
28
- return params.bundles.flatMap((bundle) => {
29
- const requiredFiles = effectiveRequiredFiles(globalConfig, params.perPackageSettings.get(bundle.name)?.requiredFiles);
30
- return findMissingFiles(bundle, requiredFiles).map((file) => {
31
- return `Package "${bundle.name}" is missing required file "${file}"`;
32
- });
33
- });
34
- }
35
4
  export const requiredFilesRule = {
36
5
  name: ruleName,
37
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CAAC;IACrC,CAAC,CAAC,CAAC;AACP,CAAC;AAED,SAAS,GAAG,CAAC,MAAiB;IAC1B,MAAM,YAAY,GAAG,MAAM,CAAC,QAAQ,EAAE,aAAa,CAAC;IACpD,IAAI,YAAY,EAAE,OAAO,KAAK,IAAI,EAAE,CAAC;QACjC,OAAO,EAAE,CAAC;IACd,CAAC;IAED,OAAO,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,EAAE;QACrC,MAAM,aAAa,GAAG,sBAAsB,CACxC,YAAY,EACZ,MAAM,CAAC,kBAAkB,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,aAAa,CAC5D,CAAC;QACF,OAAO,gBAAgB,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE;YACxD,OAAO,YAAY,MAAM,CAAC,IAAI,+BAA+B,IAAI,GAAG,CAAC;QACzE,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;AACP,CAAC;AAED,MAAM,CAAC,MAAM,iBAAiB,GAAyE;IACnG,IAAI,EAAE,QAAQ;IACd,YAAY;IACZ,gBAAgB;IAChB,GAAG;CACN,CAAC"}
1
+ {"version":3,"file":"required-files.js","sourceRoot":"","sources":["../../../../../source/checks/rules/required-files.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,UAAU;AAE5B,OAAO,EAAE,oBAAoB,EAAE,MAAM,kCAAkC;AAGvE,MAAM,QAAQ,GAAG,eAAe;AAoDhC,MAAM,CAAC,MAAM,iBAAiB,GAAyE;IACnG,IAAI,EAAE,QAAQ;IACd,YAAY;IACZ,gBAAgB;IAChB,GAAG;CACN"}
@@ -1,30 +1,5 @@
1
1
  import { emptyPerPackageSchema, enabledOnlyGlobalSchema } from "../rule.js";
2
2
  const ruleName = 'uniqueTargetPaths';
3
- function findCollidingTargetPaths(bundle) {
4
- const sourcesByTarget = new Map();
5
- for (const resource of bundle.contents) {
6
- const { targetFilePath, sourceFilePath } = resource.fileDescription;
7
- const sources = sourcesByTarget.get(targetFilePath) ?? [];
8
- sources.push(sourceFilePath);
9
- sourcesByTarget.set(targetFilePath, sources);
10
- }
11
- return Array.from(sourcesByTarget.entries()).flatMap(([targetFilePath, sources]) => {
12
- if (sources.length <= 1) {
13
- return [];
14
- }
15
- const sortedSources = sources.toSorted((left, right) => {
16
- return left.localeCompare(right);
17
- });
18
- return [`Package "${bundle.name}" maps multiple sources to "${targetFilePath}": ${sortedSources.join(', ')}`];
19
- });
20
- }
21
- function run(params) {
22
- const globalConfig = params.settings?.uniqueTargetPaths;
23
- if (globalConfig?.enabled !== true) {
24
- return [];
25
- }
26
- return params.bundles.flatMap(findCollidingTargetPaths);
27
- }
28
3
  export const uniqueTargetPathsRule = {
29
4
  name: ruleName,
30
5
  globalSchema: enabledOnlyGlobalSchema,
@@ -1 +1 @@
1
- {"version":3,"file":"unique-target-paths.js","sourceRoot":"","sources":["../../../../../source/checks/rules/unique-target-paths.ts"],"names":[],"mappings":"AAEA,OAAO,EACH,qBAAqB,EACrB,uBAAuB,EAG1B,MAAM,YAAY,CAAC;AAEpB,MAAM,QAAQ,GAAG,mBAAmB,CAAC;AAMrC,SAAS,wBAAwB,CAAC,MAAsB;IACpD,MAAM,eAAe,GAAG,IAAI,GAAG,EAAoB,CAAC;IACpD,KAAK,MAAM,QAAQ,IAAI,MAAM,CAAC,QAAQ,EAAE,CAAC;QACrC,MAAM,EAAE,cAAc,EAAE,cAAc,EAAE,GAAG,QAAQ,CAAC,eAAe,CAAC;QACpE,MAAM,OAAO,GAAG,eAAe,CAAC,GAAG,CAAC,cAAc,CAAC,IAAI,EAAE,CAAC;QAC1D,OAAO,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;QAC7B,eAAe,CAAC,GAAG,CAAC,cAAc,EAAE,OAAO,CAAC,CAAC;IACjD,CAAC;IAED,OAAO,KAAK,CAAC,IAAI,CAAC,eAAe,CAAC,OAAO,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,cAAc,EAAE,OAAO,CAAC,EAAE,EAAE;QAC/E,IAAI,OAAO,CAAC,MAAM,IAAI,CAAC,EAAE,CAAC;YACtB,OAAO,EAAE,CAAC;QACd,CAAC;QACD,MAAM,aAAa,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE;YACnD,OAAO,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;QACrC,CAAC,CAAC,CAAC;QACH,OAAO,CAAC,YAAY,MAAM,CAAC,IAAI,+BAA+B,cAAc,MAAM,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAClH,CAAC,CAAC,CAAC;AACP,CAAC;AAED,SAAS,GAAG,CAAC,MAAiB;IAC1B,MAAM,YAAY,GAAG,MAAM,CAAC,QAAQ,EAAE,iBAAiB,CAAC;IACxD,IAAI,YAAY,EAAE,OAAO,KAAK,IAAI,EAAE,CAAC;QACjC,OAAO,EAAE,CAAC;IACd,CAAC;IAED,OAAO,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,wBAAwB,CAAC,CAAC;AAC5D,CAAC;AAED,MAAM,CAAC,MAAM,qBAAqB,GAAyE;IACvG,IAAI,EAAE,QAAQ;IACd,YAAY,EAAE,uBAAuB;IACrC,gBAAgB,EAAE,qBAAqB;IACvC,GAAG;CACN,CAAC"}
1
+ {"version":3,"file":"unique-target-paths.js","sourceRoot":"","sources":["../../../../../source/checks/rules/unique-target-paths.ts"],"names":[],"mappings":"AAEA,OAAO,EACH,qBAAqB,EACrB,uBAAuB,EAG1B,MAAM,YAAY;AAEnB,MAAM,QAAQ,GAAG,mBAAmB;AAmCpC,MAAM,CAAC,MAAM,qBAAqB,GAAyE;IACvG,IAAI,EAAE,QAAQ;IACd,YAAY,EAAE,uBAAuB;IACrC,gBAAgB,EAAE,qBAAqB;IACvC,GAAG;CACN"}
package/common/clock.d.ts CHANGED
@@ -1,7 +1 @@
1
- export type Clock = {
2
- readonly getCurrentTimeInMilliseconds: () => number;
3
- readonly setTimeout: <Arguments extends readonly unknown[]>(handler: (...args: Arguments) => void, delayInMilliseconds: number, ...args: Arguments) => ReturnType<typeof globalThis.setTimeout>;
4
- readonly clearTimeout: (id: ReturnType<typeof globalThis.setTimeout>) => void;
5
- };
6
- export declare function createClock(): Clock;
7
1
  //# sourceMappingURL=clock.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"clock.d.ts","sourceRoot":"","sources":["../../../../source/common/clock.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,KAAK,GAAG;IAChB,QAAQ,CAAC,4BAA4B,EAAE,MAAM,MAAM,CAAC;IACpD,QAAQ,CAAC,UAAU,EAAE,CAAC,SAAS,SAAS,SAAS,OAAO,EAAE,EACtD,OAAO,EAAE,CAAC,GAAG,IAAI,EAAE,SAAS,KAAK,IAAI,EACrC,mBAAmB,EAAE,MAAM,EAC3B,GAAG,IAAI,EAAE,SAAS,KACjB,UAAU,CAAC,OAAO,UAAU,CAAC,UAAU,CAAC,CAAC;IAC9C,QAAQ,CAAC,YAAY,EAAE,CAAC,EAAE,EAAE,UAAU,CAAC,OAAO,UAAU,CAAC,UAAU,CAAC,KAAK,IAAI,CAAC;CACjF,CAAC;AAEF,wBAAgB,WAAW,IAAI,KAAK,CAUnC"}
1
+ {"version":3,"file":"clock.d.ts","sourceRoot":"","sources":["../../../../source/common/clock.ts"],"names":[],"mappings":""}
@@ -1,5 +1,9 @@
1
1
  const codeFilePattern = /(?:\.d\.ts|\.[cm]?[jt]sx?)$/;
2
+ const declarationCodeFilePattern = /\.d\.ts$/;
2
3
  export function isCodeFile(targetFilePath) {
3
4
  return codeFilePattern.test(targetFilePath);
4
5
  }
6
+ export function isDeclarationCodeFile(targetFilePath) {
7
+ return declarationCodeFilePattern.test(targetFilePath);
8
+ }
5
9
  //# sourceMappingURL=code-files.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"code-files.js","sourceRoot":"","sources":["../../../../source/common/code-files.ts"],"names":[],"mappings":"AAAA,MAAM,eAAe,GAAG,6BAA6B,CAAC;AAEtD,MAAM,UAAU,UAAU,CAAC,cAAsB;IAC7C,OAAO,eAAe,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;AAChD,CAAC"}
1
+ {"version":3,"file":"code-files.js","sourceRoot":"","sources":["../../../../source/common/code-files.ts"],"names":[],"mappings":"AAAA,MAAM,eAAe,GAAG,6BAA6B,CAAC;AACtD,MAAM,0BAA0B,GAAG,UAAU,CAAC;AAE9C,MAAM,UAAU,UAAU,CAAC,cAAsB;IAC7C,OAAO,eAAe,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;AAChD,CAAC;AAED,MAAM,UAAU,qBAAqB,CAAC,cAAsB;IACxD,OAAO,0BAA0B,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;AAC3D,CAAC"}
@@ -1,6 +1,11 @@
1
1
  import { z } from 'zod/mini';
2
2
  export declare const deadCodeEliminationSettingsSchema: z.ZodMiniObject<{
3
3
  enabled: z.ZodMiniBoolean<boolean>;
4
+ pureImports: z.ZodMiniOptional<z.ZodMiniReadonly<z.ZodMiniArray<z.ZodMiniReadonly<z.ZodMiniObject<{
5
+ from: z.ZodMiniString<string>;
6
+ imports: z.ZodMiniOptional<z.ZodMiniReadonly<z.ZodMiniArray<z.ZodMiniString<string>>>>;
7
+ }, z.core.$strict>>>>>;
8
+ pureConstructors: z.ZodMiniOptional<z.ZodMiniReadonly<z.ZodMiniArray<z.ZodMiniString<string>>>>;
4
9
  }, z.core.$strict>;
5
10
  export type DeadCodeEliminationSettings = z.infer<typeof deadCodeEliminationSettingsSchema>;
6
11
  //# sourceMappingURL=dead-code-elimination-settings.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"dead-code-elimination-settings.d.ts","sourceRoot":"","sources":["../../../../source/config/dead-code-elimination-settings.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,UAAU,CAAC;AAE7B,eAAO,MAAM,iCAAiC;;kBAE5C,CAAC;AAEH,MAAM,MAAM,2BAA2B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iCAAiC,CAAC,CAAC"}
1
+ {"version":3,"file":"dead-code-elimination-settings.d.ts","sourceRoot":"","sources":["../../../../source/config/dead-code-elimination-settings.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,UAAU;AAU5B,eAAO,MAAM,iCAAiC;;;;;;;kBAI5C;AAEF,MAAM,MAAM,2BAA2B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iCAAiC,CAAC"}
@@ -1,5 +1,22 @@
1
1
  import { z } from 'zod/mini';
2
+ import { nonEmptyStringSchema } from "./base-validations.js";
3
+ const pureImportTrustSchema = z.readonly(z.strictObject({
4
+ from: nonEmptyStringSchema,
5
+ imports: z.optional(z.readonly(z.array(nonEmptyStringSchema)))
6
+ }));
2
7
  export const deadCodeEliminationSettingsSchema = z.strictObject({
3
- enabled: z.boolean()
8
+ enabled: z.boolean(),
9
+ pureImports: z.optional(z.readonly(z.array(pureImportTrustSchema))),
10
+ pureConstructors: z.optional(z.readonly(z.array(nonEmptyStringSchema)))
4
11
  });
12
+ export function resolveDeadCodeEliminationSettings(packageSettings, commonSettings) {
13
+ if (packageSettings === undefined && commonSettings === undefined) {
14
+ return undefined;
15
+ }
16
+ return {
17
+ enabled: packageSettings?.enabled ?? commonSettings?.enabled ?? true,
18
+ pureImports: packageSettings?.pureImports ?? commonSettings?.pureImports,
19
+ pureConstructors: packageSettings?.pureConstructors ?? commonSettings?.pureConstructors
20
+ };
21
+ }
5
22
  //# sourceMappingURL=dead-code-elimination-settings.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"dead-code-elimination-settings.js","sourceRoot":"","sources":["../../../../source/config/dead-code-elimination-settings.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,UAAU,CAAC;AAE7B,MAAM,CAAC,MAAM,iCAAiC,GAAG,CAAC,CAAC,YAAY,CAAC;IAC5D,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE;CACvB,CAAC,CAAC"}
1
+ {"version":3,"file":"dead-code-elimination-settings.js","sourceRoot":"","sources":["../../../../source/config/dead-code-elimination-settings.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,UAAU,CAAC;AAC7B,OAAO,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAE7D,MAAM,qBAAqB,GAAG,CAAC,CAAC,QAAQ,CACpC,CAAC,CAAC,YAAY,CAAC;IACX,IAAI,EAAE,oBAAoB;IAC1B,OAAO,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,oBAAoB,CAAC,CAAC,CAAC;CACjE,CAAC,CACL,CAAC;AAEF,MAAM,CAAC,MAAM,iCAAiC,GAAG,CAAC,CAAC,YAAY,CAAC;IAC5D,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE;IACpB,WAAW,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,qBAAqB,CAAC,CAAC,CAAC;IACnE,gBAAgB,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,oBAAoB,CAAC,CAAC,CAAC;CAC1E,CAAC,CAAC;AAIH,MAAM,UAAU,kCAAkC,CAC9C,eAAwD,EACxD,cAAuD;IAEvD,IAAI,eAAe,KAAK,SAAS,IAAI,cAAc,KAAK,SAAS,EAAE,CAAC;QAChE,OAAO,SAAS,CAAC;IACrB,CAAC;IAED,OAAO;QACH,OAAO,EAAE,eAAe,EAAE,OAAO,IAAI,cAAc,EAAE,OAAO,IAAI,IAAI;QACpE,WAAW,EAAE,eAAe,EAAE,WAAW,IAAI,cAAc,EAAE,WAAW;QACxE,gBAAgB,EAAE,eAAe,EAAE,gBAAgB,IAAI,cAAc,EAAE,gBAAgB;KAC1F,CAAC;AACN,CAAC"}
@@ -14,6 +14,7 @@ export declare const packageInterfaceSchema: z.ZodMiniReadonly<z.ZodMiniUnion<re
14
14
  root: z.ZodMiniString<string>;
15
15
  name: z.ZodMiniString<string>;
16
16
  }, z.core.$strict>>>>>;
17
+ privateRoots: z.ZodMiniOptional<z.ZodMiniReadonly<z.ZodMiniTuple<readonly [z.ZodMiniString<string>], z.ZodMiniString<string>>>>;
17
18
  }, z.core.$strict>, z.ZodMiniObject<{
18
19
  bins: z.ZodMiniReadonly<z.ZodMiniTuple<readonly [z.ZodMiniReadonly<z.ZodMiniObject<{
19
20
  root: z.ZodMiniString<string>;
@@ -29,6 +30,7 @@ export declare const packageInterfaceSchema: z.ZodMiniReadonly<z.ZodMiniUnion<re
29
30
  root: z.ZodMiniString<string>;
30
31
  export: z.ZodMiniString<string>;
31
32
  }, z.core.$strict>>>>>;
33
+ privateRoots: z.ZodMiniOptional<z.ZodMiniReadonly<z.ZodMiniTuple<readonly [z.ZodMiniString<string>], z.ZodMiniString<string>>>>;
32
34
  }, z.core.$strict>]>>;
33
35
  export type PackageInterface = z.infer<typeof packageInterfaceSchema>;
34
36
  //# sourceMappingURL=package-interface.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"package-interface.d.ts","sourceRoot":"","sources":["../../../../source/config/package-interface.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,UAAU,CAAC;AA0B7B,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;qBAWlC,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC"}
1
+ {"version":3,"file":"package-interface.d.ts","sourceRoot":"","sources":["../../../../source/config/package-interface.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,UAAU,CAAC;AA2B7B,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;qBAalC,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC"}