pkgbld 1.36.0 → 2.1.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.
@@ -0,0 +1,310 @@
1
+ declare module 'pkgbld' {
2
+ export type RollupOptions = import("rollup").RollupOptions;
3
+ export type PackageJson = import("type-fest").PackageJson;
4
+ export type PkgbldPlugin = PkgbldPlugin_1;
5
+ export type Json = Json_1;
6
+ export type BuildConfiguration = BuildConfiguration_1;
7
+ export type BuildFormat = BuildFormat_1;
8
+ export type BuildConfigurationDraft = BuildConfigurationDraft_1;
9
+ export type BuildConfigurationSources = BuildConfigurationSources_1;
10
+ export type BuildEntry = BuildEntry_1;
11
+ export type BuildEntries = BuildEntries_1;
12
+ export type BuildEntryContribution = BuildEntryContribution_1;
13
+ export type BuildEntryContributions = BuildEntryContributions_1;
14
+ export type BuildEntryIssue = BuildEntryIssue_1;
15
+ export type ParsedOptions = ParsedOptions_1;
16
+ export type PackageProcessingResult = PackageProcessingResult_1;
17
+ export type PluginSharedState = PluginSharedState_1;
18
+ export type PluginConfigureContext = PluginConfigureContext_1;
19
+ export type PluginContributeEntriesContext = PluginContributeEntriesContext_1;
20
+ export type PluginPackageContext = PluginPackageContext_1;
21
+ export type PluginTsConfigContext = PluginTsConfigContext_1;
22
+ export type PluginRollupContext = PluginRollupContext_1;
23
+ export type PluginOutputContext = PluginOutputContext_1;
24
+ export type PluginBuildEndContext = PluginBuildEndContext_1;
25
+ export type PkgbldPluginFactory = PkgbldPluginFactory_1;
26
+ export type Provider = Provider_1;
27
+ export type ProvideFunction = ProvideFunction_1;
28
+ export type PkgbldRollupPlugin = PkgbldRollupPlugin_1;
29
+ type InternalModuleFormat = import("rollup").InternalModuleFormat;
30
+ type OutputOptions = import("rollup").OutputOptions;
31
+ type Plugin = import("rollup").Plugin;
32
+ type JsonObject = import("type-fest").JsonObject;
33
+ type PackageJson_1 = import("type-fest").PackageJson;
34
+ type Json_1 = null | string | number | boolean | JsonArray | JsonRecord;
35
+ type JsonArray = Json_1[];
36
+ type JsonRecord = {
37
+ [name: string]: Json_1;
38
+ };
39
+ type ProvideFunction_1 = (factory: () => Plugin, priority: number, options?: {
40
+ format?: InternalModuleFormat | InternalModuleFormat[];
41
+ inputs?: string[];
42
+ outputPlugin?: true;
43
+ }) => void;
44
+ type Provider_1 = {
45
+ provide: ProvideFunction_1;
46
+ import: (module: string, exportName?: string) => Promise<(...args: unknown[]) => Plugin>;
47
+ globalImport: (module: string, exportName?: string | string[]) => void;
48
+ globalSetup: (code: ((...args: any[]) => any) | string) => ((...args: any[]) => any) | undefined;
49
+ };
50
+ type PkgbldRollupPlugin_1 = {
51
+ plugin: () => Plugin;
52
+ priority: number;
53
+ format?: InternalModuleFormat | InternalModuleFormat[];
54
+ inputs?: string[];
55
+ outputPlugin?: true;
56
+ };
57
+ type ExecutableMode = "infer" | "disabled" | "explicit";
58
+ type BuildFormat_1 = "es" | "cjs" | "umd";
59
+ type BuildEntryExtension = "ts" | "tsx" | "js" | "jsx" | "cjs" | "mjs";
60
+ type BuildConfigurationDraft_1 = {
61
+ paths: {
62
+ sourceDir: string;
63
+ outputDir: string;
64
+ };
65
+ outputs: {
66
+ formats: BuildFormat_1[];
67
+ patterns: {
68
+ es: string;
69
+ cjs: string;
70
+ umd: string;
71
+ };
72
+ umdEntries: string[];
73
+ sourcemaps: BuildFormat_1[];
74
+ };
75
+ transforms: {
76
+ compress: BuildFormat_1[];
77
+ preprocess: string[];
78
+ includeExternals: boolean | string[];
79
+ removeLegalComments: boolean;
80
+ };
81
+ resolution: {
82
+ imports: boolean;
83
+ conditions: string[];
84
+ };
85
+ packageJson: {
86
+ update: boolean;
87
+ format: boolean;
88
+ exports: boolean;
89
+ pack: boolean;
90
+ executables: {
91
+ mode: ExecutableMode;
92
+ values: string[];
93
+ };
94
+ };
95
+ typescript: {
96
+ updateConfig: boolean;
97
+ };
98
+ execution: {
99
+ clean: boolean;
100
+ bundle: boolean;
101
+ eject: boolean;
102
+ };
103
+ };
104
+ type BuildConfiguration_1 = Readonly<{
105
+ paths: Readonly<{
106
+ sourceDir: string;
107
+ outputDir: string;
108
+ }>;
109
+ outputs: Readonly<{
110
+ formats: readonly BuildFormat_1[];
111
+ patterns: Readonly<{
112
+ es: string;
113
+ cjs: string;
114
+ umd: string;
115
+ }>;
116
+ umdEntries: readonly string[];
117
+ sourcemaps: readonly BuildFormat_1[];
118
+ }>;
119
+ transforms: Readonly<{
120
+ compress: readonly BuildFormat_1[];
121
+ preprocess: readonly string[];
122
+ includeExternals: boolean | readonly string[];
123
+ removeLegalComments: boolean;
124
+ }>;
125
+ resolution: Readonly<{
126
+ imports: boolean;
127
+ conditions: readonly string[];
128
+ }>;
129
+ packageJson: Readonly<{
130
+ update: boolean;
131
+ format: boolean;
132
+ exports: boolean;
133
+ pack: boolean;
134
+ executables: Readonly<{
135
+ mode: ExecutableMode;
136
+ values: readonly string[];
137
+ }>;
138
+ }>;
139
+ typescript: Readonly<{
140
+ updateConfig: boolean;
141
+ }>;
142
+ execution: Readonly<{
143
+ clean: boolean;
144
+ bundle: boolean;
145
+ eject: boolean;
146
+ }>;
147
+ }>;
148
+ type ParsedOptions_1 = Record<string, string | number | string[] | number[] | boolean | undefined>;
149
+ type BuildConfigurationSources_1 = Readonly<{
150
+ defaults: BuildConfiguration_1;
151
+ package: Readonly<PackageJson_1>;
152
+ cli: Readonly<{
153
+ values: Readonly<ParsedOptions_1>;
154
+ provided: Readonly<Record<string, boolean>>;
155
+ }>;
156
+ }>;
157
+ type PluginSharedState_1 = Map<unknown, unknown>;
158
+ type BuildEntry_1 = Readonly<{
159
+ name: string;
160
+ origin: "export" | "import" | "plugin";
161
+ manifestPath: string;
162
+ sourcePath: string;
163
+ extension: BuildEntryExtension;
164
+ outputPaths: Readonly<Partial<Record<BuildFormat_1, string>>>;
165
+ }>;
166
+ type BuildEntryContribution_1 = {
167
+ name: string;
168
+ sourcePath?: string;
169
+ };
170
+ type BuildEntryContributions_1 = {
171
+ add(contribution: BuildEntryContribution_1): void;
172
+ };
173
+ type BuildEntryIssue_1 = {
174
+ code: "INVALID_BUILD_ENTRY_NAME" | "DUPLICATE_BUILD_ENTRY" | "SOURCE_NOT_FOUND" | "SELECTED_BUILD_ENTRY_NOT_FOUND" | "OUTPUT_PATH_COLLISION" | "INVALID_IMPORT_MAP" | "INVALID_IMPORT_KEY" | "INVALID_IMPORT_TARGET" | "EXCLUDED_IMPORT_FORMAT";
175
+ path: string;
176
+ message: string;
177
+ name?: string;
178
+ };
179
+ type BuildEntries_1 = Readonly<{
180
+ values: readonly BuildEntry_1[];
181
+ require(name: string): BuildEntry_1;
182
+ }>;
183
+ type PackageProcessingResult_1 = Readonly<{
184
+ entries: BuildEntries_1;
185
+ executableOutputs: readonly string[];
186
+ }>;
187
+ type PluginConfigureContext_1 = {
188
+ draft: BuildConfigurationDraft_1;
189
+ sources: BuildConfigurationSources_1;
190
+ shared: PluginSharedState_1;
191
+ };
192
+ type PluginContributeEntriesContext_1 = {
193
+ entries: BuildEntryContributions_1;
194
+ configuration: BuildConfiguration_1;
195
+ shared: PluginSharedState_1;
196
+ };
197
+ type PluginPackageContext_1 = {
198
+ packageJson: PackageJson_1;
199
+ entries: BuildEntries_1;
200
+ configuration: BuildConfiguration_1;
201
+ shared: PluginSharedState_1;
202
+ };
203
+ type PluginTsConfigContext_1 = {
204
+ config: JsonObject;
205
+ configuration: BuildConfiguration_1;
206
+ shared: PluginSharedState_1;
207
+ };
208
+ type PluginRollupContext_1 = {
209
+ provider: Provider_1;
210
+ configuration: BuildConfiguration_1;
211
+ packageResult: PackageProcessingResult_1;
212
+ shared: PluginSharedState_1;
213
+ };
214
+ type PluginOutputContext_1 = {
215
+ format: InternalModuleFormat;
216
+ inputs: string[];
217
+ configuration: BuildConfiguration_1;
218
+ shared: PluginSharedState_1;
219
+ };
220
+ type PluginBuildEndContext_1 = {
221
+ configuration: BuildConfiguration_1;
222
+ shared: PluginSharedState_1;
223
+ };
224
+ type PkgbldPluginFactory_1 = {
225
+ create(): Promise<Partial<PkgbldPlugin_1>>;
226
+ };
227
+ type PkgbldPlugin_1 = {
228
+ configure(context: PluginConfigureContext_1): void;
229
+ contributeEntries(context: PluginContributeEntriesContext_1): void;
230
+ processPackageJson(context: PluginPackageContext_1): void;
231
+ processTsConfig(context: PluginTsConfigContext_1): void;
232
+ providePlugins(context: PluginRollupContext_1): Promise<void>;
233
+ getExtraOutputSettings(context: PluginOutputContext_1): Partial<OutputOptions>;
234
+ buildEnd(context: PluginBuildEndContext_1): Promise<void>;
235
+ };
236
+
237
+ export {};
238
+ }
239
+
240
+ declare module 'pkgbld/options' {
241
+ export function isPackageJson(value: unknown): value is PackageJson;
242
+
243
+ export function processPackageJson(pkg: PackageJson, needTreatment: (key: string) => boolean, treatKey: (key: string) => unknown): PackageJson;
244
+ /**
245
+ * @param current Existing file contents used to detect indentation.
246
+ * */
247
+ export function toFormattedJson<T extends object | null | number | string | boolean>(json: T, current?: string | null): string;
248
+ export namespace cliFlagsDefaults {
249
+ let formats: string[];
250
+ let umd: string[];
251
+ let compress: string[];
252
+ let sourcemaps: string[];
253
+ let preprocess: string[];
254
+ let dest: string;
255
+ let src: string;
256
+ let bin: string[] | undefined;
257
+ let includeExternals: boolean | string[];
258
+ let imports: boolean;
259
+ let conditions: string[];
260
+ let eject: boolean;
261
+ let tsConfig: boolean;
262
+ let updatePackageJson: boolean;
263
+ let commonjsPattern: string;
264
+ let esmPattern: string;
265
+ let umdPattern: string;
266
+ let formatPackageJson: boolean;
267
+ }
268
+
269
+
270
+ export const cliFlags: Record<string, CliFlag>;
271
+ export const packageJsonFieldsOrder: Set<string>;
272
+ export type PackageJson = PackageJson_1;
273
+ export type CliFlag = {
274
+ type: "string" | "boolean" | ((value: string) => unknown);
275
+ description: string;
276
+ default?: string | boolean | string[] | boolean[];
277
+ optionalValue?: boolean;
278
+ };
279
+ type PackageJson_1 = {
280
+ private?: boolean;
281
+ version?: string;
282
+ name?: string;
283
+ bin?: string | Record<string, string>;
284
+ main?: string;
285
+ license?: string;
286
+ readme?: string;
287
+ author?: string | {
288
+ name?: string;
289
+ email?: string;
290
+ url?: string;
291
+ };
292
+ description?: string;
293
+ scripts?: {
294
+ [key: string]: string;
295
+ };
296
+ repository?: {
297
+ type?: string;
298
+ url?: string;
299
+ };
300
+ files?: string[];
301
+ bugs?: string;
302
+ homepage?: string;
303
+ dependencies?: Record<string, string>;
304
+ devDependencies?: Record<string, string>;
305
+ peerDependencies?: Record<string, string>;
306
+ exports?: Record<string, string | Record<string, string>>;
307
+ };
308
+
309
+ export {};
310
+ }
package/dist/index.d.ts DELETED
@@ -1,79 +0,0 @@
1
- // Generated by dts-bundle-generator v9.5.1
2
-
3
- import { InternalModuleFormat, OutputOptions, Plugin } from 'rollup';
4
- import { JsonObject, PackageJson } from 'type-fest';
5
-
6
- declare function getCliOptions(plugins: Partial<PkgbldPlugin>[], pkg: PackageJson): {
7
- kind: "build";
8
- umdInputs: string[];
9
- compressFormats: string[];
10
- sourcemapFormats: string[];
11
- formats: string[];
12
- formatsOverridden: boolean;
13
- preprocess: string[];
14
- dir: string;
15
- sourceDir: string;
16
- bin?: string[];
17
- includeExternals: boolean | string[];
18
- eject: boolean;
19
- noTsConfig: boolean;
20
- noUpdatePackageJson: boolean;
21
- commonjsPattern: string;
22
- esPattern: string;
23
- umdPattern: string;
24
- formatPackageJson: boolean;
25
- noPack: boolean;
26
- noExports: boolean;
27
- noClean: boolean;
28
- noBundle: boolean;
29
- removeLegalComments: boolean;
30
- noSubpackages: boolean;
31
- } | {
32
- readonly kind: "prune";
33
- readonly profile: string;
34
- readonly flatten: string | boolean;
35
- readonly removeSourcemaps: boolean;
36
- readonly optimizeFiles: boolean;
37
- };
38
- export type Json = null | string | number | boolean | Json[] | {
39
- [name: string]: Json;
40
- };
41
- export type ProvideFunction = (factory: () => Plugin, priority: number, options?: {
42
- format?: InternalModuleFormat | InternalModuleFormat[];
43
- inputs?: string[];
44
- outputPlugin?: true;
45
- }) => void;
46
- export type Provider = {
47
- provide: ProvideFunction;
48
- import: (module: string, exportName?: string) => Promise<((...args: unknown[]) => Plugin)>;
49
- globalImport: (module: string, exportName?: string | string[]) => void;
50
- globalSetup: (code: Function | string) => void;
51
- };
52
- export type PkgbldRollupPlugin = {
53
- plugin: () => Plugin;
54
- priority: number;
55
- format?: InternalModuleFormat | InternalModuleFormat[];
56
- inputs?: string[];
57
- outputPlugin?: true;
58
- };
59
- export type CliOptions = NonNullable<Extract<ReturnType<typeof getCliOptions>, {
60
- kind: "build";
61
- }>>;
62
- export type ParsedOptions = Record<string, string | number | string[] | number[] | boolean | undefined>;
63
- export interface PkgbldPluginFactory {
64
- create(): Promise<Partial<PkgbldPlugin>>;
65
- }
66
- export interface PkgbldPlugin {
67
- options(parsedArgs: ParsedOptions, options: CliOptions): void;
68
- processPackageJson(packageJson: PackageJson, inputs: string[]): void;
69
- processTsConfig(config: JsonObject): void;
70
- providePlugins(provider: Provider, config: ParsedOptions, inputs: string[], inputsExt: Map<string, string>): Promise<void>;
71
- getExtraOutputSettings(format: InternalModuleFormat, inputs: string[]): Partial<OutputOptions>;
72
- buildEnd(): Promise<void>;
73
- }
74
-
75
- export {
76
- PackageJson,
77
- };
78
-
79
- export {};