@packall/core 0.1.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (96) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +58 -0
  3. package/dist/archive-DmF9XNl7.js +284 -0
  4. package/dist/archive-DmF9XNl7.js.map +1 -0
  5. package/dist/archive.d.ts +47 -15
  6. package/dist/archive.d.ts.map +1 -1
  7. package/dist/bundle.d.ts +6 -3
  8. package/dist/bundle.d.ts.map +1 -1
  9. package/dist/dependency-range.d.ts.map +1 -1
  10. package/dist/download.d.ts +2 -1
  11. package/dist/download.d.ts.map +1 -1
  12. package/dist/enums/artifact-kind.d.ts.map +1 -1
  13. package/dist/enums/edge-kind.d.ts.map +1 -1
  14. package/dist/enums/input-file-kind.d.ts.map +1 -1
  15. package/dist/enums/layout.d.ts.map +1 -1
  16. package/dist/enums/lockfile-format.d.ts.map +1 -1
  17. package/dist/enums/phase.d.ts.map +1 -1
  18. package/dist/errors.d.ts +11 -1
  19. package/dist/errors.d.ts.map +1 -1
  20. package/dist/index.d.ts +12 -10
  21. package/dist/index.d.ts.map +1 -1
  22. package/dist/index.js +169 -344
  23. package/dist/index.js.map +1 -1
  24. package/dist/input-file.d.ts.map +1 -1
  25. package/dist/integrity.d.ts +37 -5
  26. package/dist/integrity.d.ts.map +1 -1
  27. package/dist/layout.d.ts +41 -7
  28. package/dist/layout.d.ts.map +1 -1
  29. package/dist/locked-resolve.d.ts.map +1 -1
  30. package/dist/lockfile/bun.d.ts.map +1 -1
  31. package/dist/lockfile/detect.d.ts.map +1 -1
  32. package/dist/lockfile/json.d.ts.map +1 -1
  33. package/dist/lockfile/names.d.ts.map +1 -1
  34. package/dist/lockfile/npm.d.ts.map +1 -1
  35. package/dist/lockfile/parse.d.ts.map +1 -1
  36. package/dist/lockfile/pnpm.d.ts.map +1 -1
  37. package/dist/lockfile/tree-builder.d.ts.map +1 -1
  38. package/dist/lockfile/types.d.ts.map +1 -1
  39. package/dist/manifest.d.ts.map +1 -1
  40. package/dist/node/archiver.d.ts +5 -0
  41. package/dist/node/archiver.d.ts.map +1 -0
  42. package/dist/node/index.d.ts +13 -0
  43. package/dist/node/index.d.ts.map +1 -0
  44. package/dist/node/index.js +55 -0
  45. package/dist/node/index.js.map +1 -0
  46. package/dist/options.d.ts +3 -3
  47. package/dist/options.d.ts.map +1 -1
  48. package/dist/platform.d.ts +5 -10
  49. package/dist/platform.d.ts.map +1 -1
  50. package/dist/progress.d.ts.map +1 -1
  51. package/dist/registry.d.ts.map +1 -1
  52. package/dist/resolve.d.ts.map +1 -1
  53. package/dist/schemas/lenient.d.ts.map +1 -1
  54. package/dist/schemas/package-json.d.ts.map +1 -1
  55. package/dist/spec.d.ts.map +1 -1
  56. package/dist/types/value-of.d.ts.map +1 -1
  57. package/dist/utils/is-record.d.ts.map +1 -1
  58. package/package.json +11 -10
  59. package/src/archive.ts +95 -92
  60. package/src/bundle.ts +736 -616
  61. package/src/dependency-range.ts +121 -115
  62. package/src/download.ts +155 -133
  63. package/src/enums/artifact-kind.ts +5 -5
  64. package/src/enums/edge-kind.ts +13 -13
  65. package/src/enums/input-file-kind.ts +9 -9
  66. package/src/enums/layout.ts +20 -20
  67. package/src/enums/lockfile-format.ts +6 -6
  68. package/src/enums/phase.ts +8 -8
  69. package/src/errors.ts +211 -199
  70. package/src/index.ts +126 -113
  71. package/src/input-file.ts +246 -234
  72. package/src/integrity.ts +165 -121
  73. package/src/layout.ts +63 -29
  74. package/src/locked-resolve.ts +471 -461
  75. package/src/lockfile/bun.ts +214 -207
  76. package/src/lockfile/detect.ts +80 -80
  77. package/src/lockfile/json.ts +91 -92
  78. package/src/lockfile/names.ts +9 -9
  79. package/src/lockfile/npm.ts +328 -308
  80. package/src/lockfile/parse.ts +32 -32
  81. package/src/lockfile/pnpm.ts +230 -225
  82. package/src/lockfile/tree-builder.ts +116 -116
  83. package/src/lockfile/types.ts +52 -52
  84. package/src/manifest.ts +129 -133
  85. package/src/node/archiver.ts +85 -0
  86. package/src/node/index.ts +13 -0
  87. package/src/options.ts +84 -84
  88. package/src/platform.ts +97 -101
  89. package/src/progress.ts +105 -106
  90. package/src/registry.ts +116 -115
  91. package/src/resolve.ts +560 -537
  92. package/src/schemas/lenient.ts +67 -60
  93. package/src/schemas/package-json.ts +11 -10
  94. package/src/spec.ts +123 -119
  95. package/src/types/value-of.ts +1 -1
  96. package/src/utils/is-record.ts +1 -1
package/src/index.ts CHANGED
@@ -9,134 +9,147 @@
9
9
  * implementation detail, including modules that happen to be reachable.
10
10
  */
11
11
 
12
- export type * from "./errors.js"
12
+ export type * from "./errors.js";
13
13
  export {
14
- ArchiveError,
15
- AuthenticationError,
16
- IntegrityError,
17
- InvalidInputFileError,
18
- InvalidSpecError,
19
- LockfileError,
20
- LockfileIncompleteError,
21
- LockfileOutOfDateError,
22
- NoMatchingVersionsError,
23
- OutputError,
24
- PackageNotFoundError,
25
- RegistryResponseError,
26
- RegistryUnreachableError,
27
- VersionNotFoundError
28
- } from "./errors.js"
29
-
30
- export { ArtifactKind } from "./enums/artifact-kind.js"
31
- export { DirectOnlyKind, EdgeKind, LockedRootKind } from "./enums/edge-kind.js"
32
- export { InputFileKind } from "./enums/input-file-kind.js"
33
- export { Layout, Layouts } from "./enums/layout.js"
34
- export { LockfileFormat } from "./enums/lockfile-format.js"
35
- export { Phase } from "./enums/phase.js"
36
-
37
- export type { ValueOf } from "./types/value-of.js"
38
- export { isRecord } from "./utils/is-record.js"
14
+ ArchiveError,
15
+ AuthenticationError,
16
+ IntegrityError,
17
+ InvalidInputFileError,
18
+ InvalidSpecError,
19
+ LockfileError,
20
+ LockfileIncompleteError,
21
+ LockfileOutOfDateError,
22
+ NoMatchingVersionsError,
23
+ OutputError,
24
+ PackageNotFoundError,
25
+ RegistryResponseError,
26
+ RegistryUnreachableError,
27
+ VersionNotFoundError,
28
+ } from "./errors.js";
29
+
30
+ export { ArtifactKind } from "./enums/artifact-kind.js";
31
+ export { DirectOnlyKind, EdgeKind, LockedRootKind } from "./enums/edge-kind.js";
32
+ export { InputFileKind } from "./enums/input-file-kind.js";
33
+ export { Layout, Layouts } from "./enums/layout.js";
34
+ export { LockfileFormat } from "./enums/lockfile-format.js";
35
+ export { Phase } from "./enums/phase.js";
36
+
37
+ export type { ValueOf } from "./types/value-of.js";
38
+ export { isRecord } from "./utils/is-record.js";
39
39
 
40
40
  // The tolerant decoders every boundary that reads untrusted JSON is built from
41
41
  // — registry responses here, package.json and lockfiles inside the engine.
42
42
  export {
43
- OptionalFlagRecordOrAbsentSchema,
44
- OptionalFlagRecordSchema,
45
- OptionalStringArraySchema,
46
- OptionalStringRecordSchema,
47
- StringArraySchema,
48
- StringRecordSchema,
49
- tolerant
50
- } from "./schemas/lenient.js"
51
-
52
- export type { PackageSpec, Selector } from "./spec.js"
53
- export { dedupeSpecs, formatSelector, formatSpec, parseSpec, parseSpecs } from "./spec.js"
54
-
55
- export type { DependencyTarget } from "./dependency-range.js"
56
- export { parseDependencyTarget } from "./dependency-range.js"
57
-
58
- export type { PlatformConstraints, PlatformFilter, PlatformTarget } from "./platform.js"
43
+ OptionalFlagRecordOrAbsentSchema,
44
+ OptionalFlagRecordSchema,
45
+ OptionalStringArraySchema,
46
+ OptionalStringRecordSchema,
47
+ StringArraySchema,
48
+ StringRecordSchema,
49
+ tolerant,
50
+ } from "./schemas/lenient.js";
51
+
52
+ export type { PackageSpec, Selector } from "./spec.js";
53
+ export { dedupeSpecs, formatSelector, formatSpec, parseSpec, parseSpecs } from "./spec.js";
54
+
55
+ export type { DependencyTarget } from "./dependency-range.js";
56
+ export { parseDependencyTarget } from "./dependency-range.js";
57
+
58
+ export type { PlatformConstraints, PlatformFilter, PlatformTarget } from "./platform.js";
59
59
  export {
60
- allPlatforms,
61
- currentPlatform,
62
- formatPlatformFilter,
63
- isIncluded,
64
- parsePlatformTarget,
65
- platformTargets
66
- } from "./platform.js"
67
-
68
- export type { BundleOptions, DependencyScope, ResolveOptions } from "./options.js"
69
- export { defaultBundleOptions, defaultResolveOptions, defaultScope } from "./options.js"
70
-
71
- export type { Packument, PackageDist, PackageManifest } from "./registry.js"
60
+ allPlatforms,
61
+ currentPlatform,
62
+ formatPlatformFilter,
63
+ isIncluded,
64
+ parsePlatformTarget,
65
+ platformTargets,
66
+ } from "./platform.js";
67
+
68
+ export type { BundleOptions, DependencyScope, ResolveOptions } from "./options.js";
69
+ export { defaultBundleOptions, defaultResolveOptions, defaultScope } from "./options.js";
70
+
71
+ export type { Packument, PackageDist, PackageManifest } from "./registry.js";
72
72
  // `Registry.Service` and `Progress.Service` travel with their class through
73
73
  // declaration merging, so the one name carries the tag and its shape.
74
- export { Registry } from "./registry.js"
74
+ export { Registry } from "./registry.js";
75
75
 
76
- export type { ProgressEvent } from "./progress.js"
76
+ export type { ProgressEvent } from "./progress.js";
77
77
  // Aliased: `emit` and `layerSilent` say what they do inside `progress.ts`, and
78
78
  // nothing at all on a package's public surface.
79
79
  export {
80
- emit as emitProgress,
81
- layerCallback as layerCallbackProgress,
82
- layerSilent as layerSilentProgress,
83
- makeCollector as makeProgressCollector,
84
- Progress
85
- } from "./progress.js"
86
-
87
- export type { IntegrityHash, VerificationResult } from "./integrity.js"
88
- export { digestOf, hexDigestOf, parseIntegrity, verify as verifyIntegrity } from "./integrity.js"
80
+ emit as emitProgress,
81
+ layerCallback as layerCallbackProgress,
82
+ layerSilent as layerSilentProgress,
83
+ makeCollector as makeProgressCollector,
84
+ Progress,
85
+ } from "./progress.js";
86
+
87
+ export type { IntegrityAlgorithm, IntegrityHash, VerificationResult } from "./integrity.js";
88
+ export { digestOf, hexDigestOf, parseIntegrity, verify as verifyIntegrity } from "./integrity.js";
89
+
90
+ // The packing backend. The Node implementation is deliberately *not* re-exported
91
+ // here — it lives behind `@packall/core/node`, because it pulls in `node-tar` and
92
+ // reaching it has to be an explicit act so importing the engine stays safe in a
93
+ // browser.
94
+ export type { ArchiveResult, CreateArchiveOptions } from "./archive.js";
95
+ export { Archiver, createArchive } from "./archive.js";
89
96
 
90
97
  export {
91
- importGuide,
92
- MANIFEST_FILE,
93
- packagePath,
94
- perSpecArchiveName,
95
- README_FILE,
96
- singleArchiveName,
97
- splitName,
98
- tarballFileName
99
- } from "./layout.js"
100
-
101
- export type { BundleManifest, ManifestEntry } from "./manifest.js"
102
- export { buildManifest, MANIFEST_VERSION, serializeManifest } from "./manifest.js"
98
+ importGuide,
99
+ MANIFEST_FILE,
100
+ packagePath,
101
+ perSpecArchiveName,
102
+ README_FILE,
103
+ singleArchiveName,
104
+ splitName,
105
+ tarballFileName,
106
+ } from "./layout.js";
107
+
108
+ export type { BundleManifest, ManifestEntry } from "./manifest.js";
109
+ export { buildManifest, MANIFEST_VERSION, serializeManifest } from "./manifest.js";
103
110
 
104
111
  export type {
105
- PackageKey,
106
- Reason,
107
- Resolution,
108
- ResolutionWarning,
109
- ResolvedPackage,
110
- RootResolution
111
- } from "./resolve.js"
112
- export { indexPackages, packageKey, resolve, selectVersions } from "./resolve.js"
113
-
114
- export type { LockedResolveOptions } from "./locked-resolve.js"
115
- export { resolveLocked } from "./locked-resolve.js"
116
-
117
- export type { LockfileDetection } from "./lockfile/detect.js"
118
- export { detectLockfile } from "./lockfile/detect.js"
112
+ PackageKey,
113
+ Reason,
114
+ Resolution,
115
+ ResolutionWarning,
116
+ ResolvedPackage,
117
+ RootResolution,
118
+ } from "./resolve.js";
119
+ export { indexPackages, packageKey, resolve, selectVersions } from "./resolve.js";
120
+
121
+ export type { LockedResolveOptions } from "./locked-resolve.js";
122
+ export { resolveLocked } from "./locked-resolve.js";
123
+
124
+ export type { LockfileDetection } from "./lockfile/detect.js";
125
+ export { detectLockfile } from "./lockfile/detect.js";
126
+ export type {
127
+ LockedEdge,
128
+ LockedPackage,
129
+ LockedRoot,
130
+ LockedTree,
131
+ LockfileParseOptions,
132
+ } from "./lockfile/types.js";
133
+ export { formatByLockfileName, lockfileNamesFor } from "./lockfile/names.js";
134
+ export { parseLockfile } from "./lockfile/parse.js";
135
+
136
+ export type { InputFileOptions, InputFileResult } from "./input-file.js";
137
+ export { defaultInputFileOptions, parseInputFile, readInputFile } from "./input-file.js";
138
+
119
139
  export type {
120
- LockedEdge,
121
- LockedPackage,
122
- LockedRoot,
123
- LockedTree,
124
- LockfileParseOptions
125
- } from "./lockfile/types.js"
126
- export { formatByLockfileName, lockfileNamesFor } from "./lockfile/names.js"
127
- export { parseLockfile } from "./lockfile/parse.js"
128
-
129
- export type { InputFileOptions, InputFileResult } from "./input-file.js"
130
- export { defaultInputFileOptions, parseInputFile, readInputFile } from "./input-file.js"
131
-
132
- export type { BundleArtifact, BundleContext, BundleResult, PlannedOutput, PlanSummary } from "./bundle.js"
140
+ BundleArtifact,
141
+ BundleContext,
142
+ BundleResult,
143
+ PlannedOutput,
144
+ PlanSummary,
145
+ } from "./bundle.js";
133
146
  export {
134
- bundle,
135
- bundleLocked,
136
- bundleResolved,
137
- plan,
138
- planLocked,
139
- plannedOutputs,
140
- summarize,
141
- withLayout
142
- } from "./bundle.js"
147
+ bundle,
148
+ bundleLocked,
149
+ bundleResolved,
150
+ plan,
151
+ planLocked,
152
+ plannedOutputs,
153
+ summarize,
154
+ withLayout,
155
+ } from "./bundle.js";