@fastkit/plugboy 0.2.7 → 1.0.0-next.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 (62) hide show
  1. package/README.md +355 -0
  2. package/dist/cli.d.mts +5 -0
  3. package/dist/cli.mjs +33 -128
  4. package/dist/cli.mjs.map +1 -1
  5. package/dist/combine-rules-CWp-M491.mjs +66 -0
  6. package/dist/combine-rules-CWp-M491.mjs.map +1 -0
  7. package/dist/dependencies/bundle-require.d.mts +1 -0
  8. package/dist/dependencies/bundle-require.mjs +3 -3
  9. package/dist/dependencies/cac.d.mts +1 -0
  10. package/dist/dependencies/cac.mjs +3 -3
  11. package/dist/dependencies/glob.d.mts +1 -0
  12. package/dist/dependencies/glob.mjs +3 -3
  13. package/dist/dependencies/inquirer.d.mts +1 -0
  14. package/dist/dependencies/inquirer.mjs +3 -3
  15. package/dist/dependencies/pkg-types.d.mts +1 -0
  16. package/dist/dependencies/pkg-types.mjs +3 -3
  17. package/dist/dependencies/sort-package-json.d.mts +2 -0
  18. package/dist/dependencies/sort-package-json.mjs +5 -4
  19. package/dist/dependencies/sort-package-json.mjs.map +1 -1
  20. package/dist/dependencies/tsdown.d.mts +1 -0
  21. package/dist/dependencies/tsdown.mjs +3 -0
  22. package/dist/optimize-layer-CK8NR_VC.mjs +58 -0
  23. package/dist/optimize-layer-CK8NR_VC.mjs.map +1 -0
  24. package/dist/optimize-media-Bxy27Cj7.mjs +86 -0
  25. package/dist/optimize-media-Bxy27Cj7.mjs.map +1 -0
  26. package/dist/plugboy.d.mts +6284 -0
  27. package/dist/plugboy.mjs +3 -103
  28. package/dist/runtime-utils.d.mts +28 -0
  29. package/dist/runtime-utils.mjs +94 -0
  30. package/dist/runtime-utils.mjs.map +1 -0
  31. package/dist/workspace-BqcryYAT.mjs +1391 -0
  32. package/dist/workspace-BqcryYAT.mjs.map +1 -0
  33. package/env.d.ts +0 -18
  34. package/package.json +21 -17
  35. package/dist/chunk-MN572VU2.mjs +0 -1616
  36. package/dist/chunk-MN572VU2.mjs.map +0 -1
  37. package/dist/cli.d.ts +0 -3
  38. package/dist/combine-rules-2CRG6D4B.mjs +0 -69
  39. package/dist/combine-rules-2CRG6D4B.mjs.map +0 -1
  40. package/dist/dependencies/bundle-require.d.ts +0 -7
  41. package/dist/dependencies/bundle-require.mjs.map +0 -1
  42. package/dist/dependencies/cac.d.ts +0 -1
  43. package/dist/dependencies/cac.mjs.map +0 -1
  44. package/dist/dependencies/esbuild.d.ts +0 -1
  45. package/dist/dependencies/esbuild.mjs +0 -3
  46. package/dist/dependencies/esbuild.mjs.map +0 -1
  47. package/dist/dependencies/glob.d.ts +0 -1
  48. package/dist/dependencies/glob.mjs.map +0 -1
  49. package/dist/dependencies/inquirer.d.ts +0 -1
  50. package/dist/dependencies/inquirer.mjs.map +0 -1
  51. package/dist/dependencies/pkg-types.d.ts +0 -1
  52. package/dist/dependencies/pkg-types.mjs.map +0 -1
  53. package/dist/dependencies/sort-package-json.d.ts +0 -2
  54. package/dist/dependencies/tsup.d.ts +0 -1
  55. package/dist/dependencies/tsup.mjs +0 -3
  56. package/dist/dependencies/tsup.mjs.map +0 -1
  57. package/dist/optimize-layer-Q35C25P4.mjs +0 -61
  58. package/dist/optimize-layer-Q35C25P4.mjs.map +0 -1
  59. package/dist/optimize-media-ZZWDHLLV.mjs +0 -99
  60. package/dist/optimize-media-ZZWDHLLV.mjs.map +0 -1
  61. package/dist/plugboy.d.ts +0 -777
  62. package/dist/plugboy.mjs.map +0 -1
package/dist/plugboy.d.ts DELETED
@@ -1,777 +0,0 @@
1
- import { Options } from 'tsup';
2
- import { Plugin as Plugin$1, OutputFile } from 'esbuild';
3
- import fs from 'node:fs';
4
- import { PackageJson } from 'pkg-types';
5
- import { Options as Options$1 } from 'cssnano';
6
- import { AtRule, Container, Rule } from 'postcss';
7
- import { CompilerOptions } from 'typescript';
8
-
9
- type ESBuildPluginType = NonNullable<Options['esbuildPlugins']>[number];
10
- interface ESBuildPlugin extends ESBuildPluginType {
11
- }
12
-
13
- declare function isPromise<T = any>(obj: any): obj is Promise<T>;
14
- type Listable<T> = T | false | null | undefined | Listable<T>[] | Promise<T | false | null | undefined | Listable<T>[]>;
15
- declare function resolveListable<T>(raw: Listable<T>): Promise<T[]>;
16
-
17
- declare function getFilename(importMetaURL: string): string;
18
- declare function getDirname(importMetaURL: string): string;
19
- declare function isFileNotFoundException(source: unknown): source is NodeJS.ErrnoException;
20
- declare function pathExists(target: string, type?: 'file' | 'dir'): Promise<boolean>;
21
- type FileMatcherFn = (file: fs.Dirent, dir: string) => boolean | Promise<boolean>;
22
- type FileMatcher = string | RegExp | FileMatcherFn;
23
- declare function findFile(dir: string, matcher: FileMatcher, recursive?: boolean): Promise<string | undefined>;
24
- interface FindConfigResult {
25
- dir: string;
26
- fileName: string;
27
- path: string;
28
- code: string;
29
- }
30
- interface FindConfigSettings<AllowMissing extends boolean | undefined> {
31
- fileName: string | string[];
32
- allowMissing?: AllowMissing;
33
- test?: (result: FindConfigResult) => boolean;
34
- /**
35
- * Trace up to how many directories above
36
- * @default 10
37
- */
38
- depth?: number;
39
- }
40
- declare function findConfig<AllowMissing extends boolean | undefined = false>(fileNameOrSettings: string | string[] | FindConfigSettings<AllowMissing>, dir?: string, currentDepth?: number): Promise<AllowMissing extends true ? FindConfigResult | null : FindConfigResult>;
41
- declare function rmrf(...paths: string[]): Promise<void>;
42
- declare function copyDirSync(srcDir: string, destDir: string): void;
43
-
44
- interface ExposeEntriesSettings {
45
- dir: string;
46
- /**
47
- * Path prefix at distribution
48
- */
49
- prefix?: string;
50
- }
51
- type RawExposeEntriesSettings = string | ExposeEntriesSettings;
52
- declare function resolveRawExposeEntriesSettings(rawSettings: RawExposeEntriesSettings): ExposeEntriesSettings;
53
- declare function exposeEntries(rawSettings: RawExposeEntriesSettings): Promise<Record<string, RawWorkspaceEntryObject>>;
54
-
55
- declare function isWorkspacePackageJson(json: PackageJson): json is WorkspacePackageJson;
56
- declare function resolveRawWorkspaceEntry(entry: RawWorkspaceEntry): WorkspaceEntry;
57
- declare function resolveRawWorkspaceEntries(entries: RawWorkspaceEntries | undefined): WorkspaceEntries;
58
- declare function resolveUserWorkspaceConfig(userConfig: UserWorkspaceConfig): Promise<ResolvedWorkspaceConfig>;
59
- declare function defineWorkspaceConfig<Config extends UserWorkspaceConfig>(config: Config): Promise<ResolvedWorkspaceConfig>;
60
- declare function loadWorkspaceConfig(searchDir?: string, depth?: number): Promise<ResolvedWorkspaceConfig>;
61
-
62
- declare function resolveUserHooks(...userHooks: (UserHooks | undefined | null | false)[]): Promise<ResolvedHooks>;
63
- declare function buildHooks(resolvedHooks: ResolvedHooks): BuildedHooks;
64
-
65
- declare function resolveUserPluginOptions(pluginOptions: UserPluginOption[] | undefined): Promise<Plugin[]>;
66
- declare function definePlugin<T extends Plugin>(options: T): T;
67
- declare function extractProjectPlugins(searchDir?: string): Promise<Plugin[]>;
68
- declare function findProjectPlugin<T extends Plugin = Plugin>(pluginName: string, searchDir?: string): Promise<T | undefined>;
69
-
70
- declare function isProjectPackageJson(json: PackageJson): json is ProjectPackageJson;
71
- declare function resolveUserProjectConfig(userConfig: UserProjectConfig): Promise<ResolvedProjectConfig>;
72
- declare function defineProjectConfig<Config extends UserProjectConfig>(config: Config): Promise<ResolvedProjectConfig>;
73
- declare function loadProjectConfig(searchDir?: string, depth?: number): Promise<ResolvedProjectConfig>;
74
-
75
- declare class Path {
76
- private _value;
77
- private _stats?;
78
- get value(): string;
79
- set value(value: string);
80
- get dirname(): string;
81
- get basename(): string;
82
- get extname(): string;
83
- get stats(): fs.Stats;
84
- get isDirectory(): () => boolean;
85
- get isFile(): () => boolean;
86
- constructor(value: string);
87
- toString(): string;
88
- valueOf(): string;
89
- toJSON(): string;
90
- relative(to: string): Path;
91
- join(...paths: string[]): Path;
92
- resolve(...paths: string[]): Path;
93
- private _join;
94
- readdir(...paths: string[]): Promise<Path[]>;
95
- readFile<D = undefined>(pathAppend?: string, defaults?: D): Promise<D extends undefined ? string : string | D>;
96
- readJSON<T = any, D = undefined>(pathAppend?: string, defaults?: D): Promise<D extends undefined ? T : T | D>;
97
- }
98
-
99
- type ObjectLike = Record<string, any>;
100
- type MarkRequired<T extends ObjectLike, RequiredField extends keyof T> = Required<Pick<T, RequiredField>> & Omit<T, RequiredField>;
101
- type RequiredPackageJSON<Field extends string> = PackageJson & Required<Pick<PackageJson, Field>>;
102
-
103
- /**
104
- * Plugboy Project
105
- *
106
- * @remarks This instance is only created if the project consists of a mono-repo.
107
- */
108
- declare class PlugboyProject {
109
- /** Path instance of the project directory */
110
- readonly dir: Path;
111
- /** package.json */
112
- readonly json: ProjectPackageJson;
113
- /**
114
- * Project Configuration
115
- * @see {@link ResolvedProjectConfig}
116
- */
117
- readonly config: ResolvedProjectConfig;
118
- /** Names of all packages on which the project depends */
119
- readonly dependencies: string[];
120
- /** Directory names of all workspaces owned by the project */
121
- readonly resolvedWorkspaces: string[];
122
- /**
123
- * Name of the project's package.json
124
- */
125
- get name(): string;
126
- /**
127
- * Plug-in List
128
- * @see {@link ResolvedProjectConfig.plugins}
129
- */
130
- get plugins(): Plugin[];
131
- /**
132
- * List of all user hook settings
133
- * @see {@link UserHooks}
134
- */
135
- get hooks(): UserHooks[];
136
- constructor(ctx: ProjectSetupContext);
137
- }
138
- declare function getProject<AllowMissing extends boolean | undefined = false>(searchDir?: string, allowMissing?: AllowMissing, skipLoadConfig?: boolean): Promise<AllowMissing extends true ? PlugboyProject | null : PlugboyProject>;
139
-
140
- type WorkspaceStubLink = {
141
- type: 'js';
142
- from: string;
143
- to: string;
144
- } | {
145
- type: 'css';
146
- from: string;
147
- };
148
- type WorkspaceStubLinkType = WorkspaceStubLink['type'];
149
- interface WorkspaceObjectExport {
150
- src: string;
151
- types: string;
152
- dtsDest: string;
153
- import: {
154
- default: string;
155
- };
156
- }
157
- interface WorkspaceExport {
158
- id: string;
159
- at: string | WorkspaceObjectExport;
160
- stubLink?: WorkspaceStubLink;
161
- }
162
- declare const WORKSPACE_PACKAGE_SYNC_FIELDS: readonly ["repository", "author", "publishConfig", "license"];
163
- declare function syncWorkspacePackageFields(projectJSON: ProjectPackageJson, workspaceJSON: WorkspacePackageJson): void;
164
- declare class PlugboyWorkspace {
165
- readonly name: string;
166
- readonly dir: Path;
167
- readonly config: ResolvedWorkspaceConfig;
168
- readonly project: PlugboyProject | null;
169
- readonly dirs: WorkspaceDirs;
170
- readonly dependencies: string[];
171
- readonly projectDependencies: string[];
172
- readonly meta: WorkspaceMeta;
173
- readonly entry: Record<string, string>;
174
- readonly exports: WorkspaceExport[];
175
- readonly builder: Builder;
176
- readonly plugins: Plugin[];
177
- readonly hooks: BuildedHooks;
178
- readonly dtsFiles: string[];
179
- readonly dts: NormalizedDTSSettings;
180
- readonly optimizeCSSOptions: ResolvedOptimizeCSSOptions | false;
181
- private _json;
182
- get json(): WorkspacePackageJson;
183
- constructor(ctx: WorkspaceSetupContext);
184
- clean(withDepsAndCache?: boolean): Promise<void>;
185
- preparePackageJSON(): Promise<WorkspacePackageJson>;
186
- getStubLinks(): WorkspaceStubLink[];
187
- stub(): Promise<void>;
188
- getESBuildPlugins(): Promise<ESBuildPlugin[]>;
189
- build(): Promise<void>;
190
- }
191
- declare function getWorkspace<AllowMissing extends boolean | undefined = false>(searchDir?: string, allowMissing?: AllowMissing): Promise<AllowMissing extends true ? PlugboyWorkspace | null : PlugboyWorkspace>;
192
-
193
- interface ResolvedOptions extends Options {
194
- esbuildPlugins: Plugin$1[];
195
- }
196
- declare class Builder {
197
- readonly workspace: PlugboyWorkspace;
198
- private _tsupOptions?;
199
- private _postcssCache?;
200
- get entry(): Record<string, string>;
201
- get dts(): NormalizedDTSSettings;
202
- constructor(workspace: PlugboyWorkspace);
203
- tsupOptions(overrides?: {
204
- watch?: boolean;
205
- }): Promise<ResolvedOptions>;
206
- private _stubLinkJS;
207
- private _stubLinkCSS;
208
- copyPublicDir(): Promise<void>;
209
- stub(): Promise<void>;
210
- normalizeDTSBySettings(dts: string, settings: NormalizedDTSPreserveTypeSettings): string | undefined;
211
- normalizeDTSFile(filePath: string): Promise<void>;
212
- normalizeDTSFiles(dtsFiles?: string[]): Promise<void>;
213
- emitInlineDTS(): Promise<void>;
214
- build(): Promise<void>;
215
- optimizeCSS(cssFilePath: string): Promise<void>;
216
- private _handleCSSOutput;
217
- }
218
-
219
- declare function generateWorkspace(workspaceName?: string, cwd?: string): Promise<void>;
220
-
221
- type ESBuildPluginOption = ESBuildPlugin | undefined | false | null | Promise<ESBuildPlugin | undefined | false | null> | ((workspace: PlugboyWorkspace) => ESBuildPlugin | undefined | false | null | Promise<ESBuildPlugin | undefined | false | null>);
222
- interface Plugin {
223
- name: string;
224
- hooks?: UserHooks;
225
- esbuildPlugins?: ESBuildPluginOption[];
226
- }
227
- type UserPluginOption = Listable<Plugin>;
228
-
229
- /**
230
- * Type preservation target in d.ts file
231
- */
232
- interface DTSPreserveTypeTarget {
233
- /** Type name */
234
- typeName: string;
235
- /**
236
- * String to be restored or regular expression to match
237
- */
238
- from: string | RegExp;
239
- }
240
- /**
241
- * Type preservation target in d.ts file (normalized)
242
- *
243
- * @see {@link DTSPreserveTypeTarget}
244
- */
245
- interface NormalizedDTSPreserveTypeTarget extends Omit<DTSPreserveTypeTarget, 'from'> {
246
- /** Regular expression to match the string to be restored */
247
- from: RegExp;
248
- }
249
- declare function normalizeDTSPreserveTypeTarget(target: DTSPreserveTypeTarget): NormalizedDTSPreserveTypeTarget;
250
- /**
251
- * Type preservation setting for d.ts files
252
- *
253
- * @remarks This setting is for restoring type information inlined by the TypeScript compiler to the original type name by string substitution.
254
- */
255
- interface DTSPreserveTypeSettings {
256
- /** Name of the package to which the type to be restored belongs */
257
- pkg?: string;
258
- /** List of preservation targets */
259
- targets: DTSPreserveTypeTarget[];
260
- }
261
- /**
262
- * Type preservation setting for d.ts files (normalized)
263
- *
264
- * @see {@link DTSPreserveTypeSettings}
265
- */
266
- interface NormalizedDTSPreserveTypeSettings extends Omit<DTSPreserveTypeSettings, 'targets'> {
267
- /** List of normalized type preservation targets */
268
- targets: NormalizedDTSPreserveTypeTarget[];
269
- }
270
- declare function normalizeDTSPreserveTypeSettings(settings: DTSPreserveTypeSettings): NormalizedDTSPreserveTypeSettings;
271
- /**
272
- * Function to normalize d.ts strings
273
- * @param dts - Bundled d.ts strings
274
- * @param builder - Builder
275
- */
276
- type DTSNormalizer = (dts: string, builder: Builder) => string | undefined | void | Promise<string | undefined | void>;
277
- /**
278
- * d.ts output setting
279
- */
280
- interface DTSSettings {
281
- /**
282
- * Inline output without bundling d.ts
283
- *
284
- * @default false
285
- */
286
- inline?: boolean;
287
- /**
288
- * list of type preservation settings
289
- *
290
- * @remarks This setting is for restoring type information inlined by the TypeScript compiler to the original type name by string substitution.
291
- *
292
- * @see {@link DTSPreserveTypeSettings}
293
- */
294
- preserveType?: DTSPreserveTypeSettings[];
295
- /**
296
- * list of function to normalize d.ts strings
297
- */
298
- normalizers?: DTSNormalizer[];
299
- }
300
- /**
301
- * d.ts output setting (normalized)
302
- *
303
- * @see {@link DTSSettings}
304
- */
305
- interface NormalizedDTSSettings {
306
- /**
307
- * Inline output without bundling d.ts
308
- */
309
- inline: boolean;
310
- /**
311
- * list of type preservation settings
312
- */
313
- preserveType: NormalizedDTSPreserveTypeSettings[];
314
- /**
315
- * list of function to normalize d.ts strings
316
- */
317
- normalizers: DTSNormalizer[];
318
- }
319
- declare function normalizeDTSSettings(settings: DTSSettings): NormalizedDTSSettings;
320
- declare function mergeDTSSettingsList(...settingsList: (DTSSettings | undefined)[]): NormalizedDTSSettings;
321
-
322
- type Filter$1 = (layerName: string, rule: AtRule) => boolean;
323
- type FilterSpec$1 = string | RegExp | (string | RegExp)[] | Filter$1;
324
- interface OptimizeLayerOptions {
325
- include?: FilterSpec$1;
326
- exclude?: FilterSpec$1;
327
- }
328
-
329
- interface Media {
330
- query: string;
331
- rule: AtRule;
332
- container: Container;
333
- }
334
- type Filter = (query: string, media: Media) => boolean;
335
- type FilterSpec = string | RegExp | (string | RegExp)[] | Filter;
336
- type SortMedia = (a: Media, b: Media) => number;
337
- interface OptimizeMediaOptions {
338
- include?: FilterSpec;
339
- exclude?: FilterSpec;
340
- sort?: SortMedia;
341
- }
342
-
343
- type RuleFilter = string | RegExp;
344
- type RuleSpecFn = (rule: Rule) => boolean;
345
- type RuleSpec = RuleFilter[] | RuleSpecFn;
346
- interface CombineRulesOptions {
347
- rules: RuleSpec;
348
- }
349
-
350
- /**
351
- * CSS optimization options
352
- */
353
- interface OptimizeCSSOptions {
354
- /**
355
- * Layer optimization options
356
- *
357
- * Disable the operation with `false`.
358
- *
359
- * @default true
360
- */
361
- layer?: OptimizeLayerOptions | boolean;
362
- /**
363
- * Media Query Optimization Options
364
- *
365
- * Disable the operation with `false`.
366
- *
367
- * @default true
368
- */
369
- media?: OptimizeMediaOptions | boolean;
370
- /**
371
- * Combine rules Options
372
- *
373
- * If unset, no optimization is performed
374
- */
375
- combineRules?: CombineRulesOptions;
376
- /**
377
- * Options for [cssnano](https://cssnano.co/)
378
- *
379
- * Disable the operation with `false`.
380
- *
381
- * @default { preset: ['default', { normalizeWhitespace: false }] }
382
- */
383
- cssnano?: Options$1 | boolean;
384
- }
385
- interface ResolvedOptimizeCSSOptions {
386
- layer?: OptimizeLayerOptions;
387
- media?: OptimizeMediaOptions;
388
- combineRules?: CombineRulesOptions;
389
- cssnano?: Options$1;
390
- }
391
- declare function resolveOptimizeCSSOptions(options: OptimizeCSSOptions): ResolvedOptimizeCSSOptions;
392
-
393
- declare const WORKSPACE_REQUIRED_FIELDS: readonly ["name", "version"];
394
- type WorkspaceRequiredField = (typeof WORKSPACE_REQUIRED_FIELDS)[number];
395
- /**
396
- * Entry setting object
397
- */
398
- interface RawWorkspaceEntryObject {
399
- /**
400
- * Entry file path
401
- * @remarks It must be relative to the root directory of the workspace.
402
- */
403
- src: string;
404
- /**
405
- * Set to true if the entry outputs css at the same time
406
- * @remarks By doing this, the exports field in package.json will be set automatically.
407
- */
408
- css?: boolean;
409
- }
410
- /**
411
- * Entry setting object
412
- */
413
- type WorkspaceEntry = MarkRequired<RawWorkspaceEntryObject, 'src' | 'css'>;
414
- type RawWorkspaceEntry = string | RawWorkspaceEntryObject;
415
- /**
416
- * Configuration of all entries in the workspace (normalized)
417
- *
418
- * @see {@link RawWorkspaceEntries}
419
- */
420
- type WorkspaceEntries = Record<string, WorkspaceEntry>;
421
- /**
422
- * Configuration of all entries in the workspace
423
- *
424
- * @remarks The configuration must be `{ [id]: [Entry setting: }`. `"." ` is treated as a special ID and is the target of the main export.
425
- */
426
- type RawWorkspaceEntries = Record<string, RawWorkspaceEntry>;
427
- declare const TSUP_SYNC_OPTIONS: readonly ["define", "noExternal", "external", "replaceNodeEnv", "skipNodeModulesBundle"];
428
- type TSUpSyncOption = (typeof TSUP_SYNC_OPTIONS)[number];
429
- interface TSUpSyncOptions extends Pick<Options, TSUpSyncOption> {
430
- }
431
- /**
432
- * Workspace User Configuration
433
- */
434
- interface UserWorkspaceConfig extends TSUpSyncOptions {
435
- /**
436
- * Ignore project settings
437
- *
438
- * @remarks Normally, when processing a workspace, plugboy looks for and merges the settings of the entire project at the same time, but this action can be canceled.
439
- */
440
- ignoreProjectConfig?: boolean;
441
- /**
442
- * Configuration of all entries in the workspace
443
- *
444
- * @see {@link RawWorkspaceEntries}
445
- */
446
- entries?: RawWorkspaceEntries;
447
- /**
448
- * Hook Setting
449
- * @see {@link UserHooks}
450
- */
451
- hooks?: UserHooks;
452
- /**
453
- * Plug-in List
454
- * @see {@link UserPluginOption}
455
- */
456
- plugins?: UserPluginOption[];
457
- /**
458
- * d.ts output setting
459
- * @see {@link DTSSettings}
460
- */
461
- dts?: DTSSettings;
462
- /**
463
- * CSS optimization options
464
- *
465
- * Disable the operation with `false`.
466
- *
467
- * @default true
468
- *
469
- * @see {@link OptimizeCSSOptions}
470
- */
471
- optimizeCSS?: OptimizeCSSOptions | boolean;
472
- }
473
- /**
474
- * Workspace Configuration
475
- */
476
- interface ResolvedWorkspaceConfig extends Required<Omit<UserWorkspaceConfig, 'entries' | 'hooks' | 'plugins' | 'dts' | 'optimizeCSS' | TSUpSyncOption>>, TSUpSyncOptions {
477
- /**
478
- * Configuration of all entries in the workspace
479
- *
480
- * @see {@link WorkspaceEntries}
481
- */
482
- entries: WorkspaceEntries;
483
- /**
484
- * Hook Setting
485
- * @see {@link UserHooks}
486
- */
487
- hooks?: UserHooks;
488
- /**
489
- * Plug-in List
490
- * @see {@link UserPluginOption}
491
- */
492
- plugins: Plugin[];
493
- /**
494
- * d.ts output setting
495
- * @see {@link DTSSettings}
496
- */
497
- dts?: DTSSettings;
498
- /**
499
- * CSS optimization options
500
- *
501
- * Disable the operation with `false`.
502
- *
503
- * @see {@link OptimizeCSSOptions}
504
- */
505
- optimizeCSS: OptimizeCSSOptions | false;
506
- }
507
- type WorkspacePackageJson = RequiredPackageJSON<WorkspaceRequiredField>;
508
- /**
509
- * Workspace Directory Settings
510
- */
511
- interface WorkspaceDirs {
512
- /** Path instance of the source directory */
513
- src: Path;
514
- /** Path instance of the distribution directory */
515
- dist: Path;
516
- }
517
- /**
518
- * Workspace Meta Information
519
- *
520
- * @remarks This will be set to a value uniquely extended by the plugin
521
- */
522
- interface WorkspaceMeta {
523
- }
524
- /**
525
- * Workspace setup context object
526
- * @remarks Objects that are configured when the workspace is set up. Customization can be done before the workspace instance is created by a plug-in or other process.
527
- */
528
- interface WorkspaceSetupContext {
529
- /** Workspace directory path instance */
530
- dir: Path;
531
- /** package.json */
532
- json: WorkspacePackageJson;
533
- /**
534
- * Workspace Configuration
535
- * @see {@link ResolvedWorkspaceConfig}
536
- */
537
- config: ResolvedWorkspaceConfig;
538
- /** Plugboy Project */
539
- project: PlugboyProject | null;
540
- /** Workspace Directory Settings */
541
- dirs: WorkspaceDirs;
542
- /**
543
- * All package names on which the workspace depends
544
- */
545
- dependencies: string[];
546
- /**
547
- * Names of all in-project packages on which the workspace depends
548
- */
549
- projectDependencies: string[];
550
- /**
551
- * Workspace Meta Information
552
- * @see {@link WorkspaceMeta}
553
- */
554
- meta: WorkspaceMeta;
555
- /**
556
- * プラグインリスト
557
- * @see {@link Plugin}
558
- */
559
- plugins: Plugin[];
560
- /**
561
- * Map of hook methods that can be initialized and called
562
- * @see {@link BuildedHooks}
563
- */
564
- hooks: BuildedHooks;
565
- /**
566
- * d.ts output setting
567
- * @see {@link NormalizedDTSSettings}
568
- */
569
- dts: NormalizedDTSSettings;
570
- /**
571
- * CSS optimization options
572
- *
573
- * Disable the operation with `false`.
574
- *
575
- * @see {@link OptimizeCSSOptions}
576
- */
577
- optimizeCSS: OptimizeCSSOptions | false;
578
- }
579
-
580
- /** plugboy hook definition */
581
- interface HookTypes {
582
- /**
583
- * Hooks during workspace setup
584
- * @remarks Called just before the workspace instance is created
585
- * @param ctx - {@link WorkspaceSetupContext Workspace setup context object}
586
- */
587
- setupWorkspace: (ctx: WorkspaceSetupContext) => any;
588
- /**
589
- * Hooks after workspace generation
590
- * @param workspace - {@link PlugboyWorkspace workspace instance}
591
- */
592
- createWorkspace: (workspace: PlugboyWorkspace) => any;
593
- /**
594
- * Hooks when correcting package.json
595
- * @param json - package.json just before it was modified and saved by the plugboy
596
- * @param workspace - {@link PlugboyWorkspace workspace instance}
597
- */
598
- preparePackageJSON: (json: WorkspacePackageJson, workspace: PlugboyWorkspace) => any;
599
- /**
600
- * Hooks when successful build
601
- * @param builder - Builder
602
- * @param outputFiles - List of output files
603
- *
604
- * @note
605
- * The text information contained in outputFiles may have already been rewritten by plugboy and output as files.
606
- * If you wish to perform text replacement, etc., be sure to do so on the read file.
607
- *
608
- * @see {@link OutputFile}
609
- */
610
- onSuccess: (builder: Builder, outputFiles: OutputFile[]) => any;
611
- }
612
- declare function createHooksDefaults(): ResolvedHooks;
613
- type HookName = keyof HookTypes;
614
- /**
615
- * plugboy user hook definition
616
- * @see {@link HookTypes}
617
- */
618
- type UserHooks = {
619
- [Name in HookName]?: Listable<HookTypes[Name]>;
620
- };
621
- /**
622
- * Pre-setup hook definitions
623
- * @see {@link HookTypes}
624
- */
625
- type ResolvedHooks = {
626
- [Name in HookName]: HookTypes[Name][];
627
- };
628
- type HookArgs<Name extends HookName> = Parameters<HookTypes[Name]>;
629
- type UnPromisify<T> = T extends Promise<infer U> ? U : T;
630
- type HookReturnType<Name extends HookName> = UnPromisify<ReturnType<HookTypes[Name]>>;
631
- /**
632
- * Map of hook methods that can be initialized and called
633
- * @see {@link HookTypes}
634
- */
635
- type BuildedHooks = {
636
- [Name in HookName]: (...args: HookArgs<Name>) => Promise<HookReturnType<Name>>;
637
- };
638
-
639
- declare const PROJECT_REQUIRED_FIELDS: readonly ["name"];
640
- type ProjectRequiredField = (typeof PROJECT_REQUIRED_FIELDS)[number];
641
- type TSConfigJSON = {
642
- compilerOptions?: CompilerOptions;
643
- } & Record<string, any>;
644
- /**
645
- * Template for package.json script in workspace
646
- */
647
- interface ProjectScriptsTemplate {
648
- /** Template Name */
649
- name: string;
650
- /** Script Map */
651
- scripts: Record<string, string>;
652
- }
653
- /**
654
- * Project User Configuration
655
- */
656
- interface UserProjectConfig {
657
- /**
658
- * Directory where the workspace is located
659
- * @remarks Used to create a new workspace with the `plugboy gen` CLI command.
660
- * @default packages
661
- */
662
- workspacesDir?: string;
663
- /**
664
- * Workspace script templates, or a list of them
665
- * @remarks Used to create a new workspace with the `plugboy gen` CLI command.
666
- */
667
- scripts?: Record<string, string> | ProjectScriptsTemplate[];
668
- /**
669
- * Workspace tsconfig template
670
- * @remarks Used to create a new workspace with the `plugboy gen` CLI command.
671
- */
672
- tsconfig?: TSConfigJSON;
673
- /**
674
- * Workspace README template
675
- * @remarks Used to create a new workspace with the `plugboy gen` CLI command.
676
- */
677
- readme?: (json: WorkspacePackageJson) => string;
678
- /**
679
- * Fixes the version of all peer dependencies in the project
680
- */
681
- peerDependencies?: Record<string, string>;
682
- /**
683
- * Hook Setting
684
- * @see {@link UserHooks}
685
- */
686
- hooks?: UserHooks;
687
- /**
688
- * Plug-in List
689
- * @see {@link UserPluginOption}
690
- */
691
- plugins?: UserPluginOption[];
692
- /**
693
- * d.ts output setting
694
- * @see {@link DTSSettings}
695
- */
696
- dts?: DTSSettings;
697
- /**
698
- * CSS optimization options
699
- *
700
- * Disable the operation with `false`.
701
- *
702
- * @default true
703
- *
704
- * @see {@link OptimizeCSSOptions}
705
- */
706
- optimizeCSS?: OptimizeCSSOptions | boolean;
707
- }
708
- /**
709
- * Project Configuration
710
- */
711
- interface ResolvedProjectConfig extends Required<Omit<UserProjectConfig, 'scripts' | 'tsconfig' | 'hooks' | 'plugins' | 'dts' | 'optimizeCSS'>> {
712
- /**
713
- * Workspace script templates list
714
- * @remarks Used to create a new workspace with the `plugboy gen` CLI command.
715
- */
716
- scripts: ProjectScriptsTemplate[];
717
- /**
718
- * Workspace tsconfig template
719
- * @remarks Used to create a new workspace with the `plugboy gen` CLI command.
720
- */
721
- tsconfig?: TSConfigJSON;
722
- /**
723
- * Hook Setting
724
- * @see {@link UserHooks}
725
- */
726
- hooks?: UserHooks;
727
- /**
728
- * Plug-in List
729
- * @see {@link UserPluginOption}
730
- */
731
- plugins: Plugin[];
732
- /**
733
- * d.ts output setting
734
- * @see {@link DTSSettings}
735
- */
736
- dts?: DTSSettings;
737
- /**
738
- * CSS optimization options
739
- *
740
- * Disable the operation with `false`.
741
- *
742
- * @see {@link OptimizeCSSOptions}
743
- */
744
- optimizeCSS: OptimizeCSSOptions | false;
745
- }
746
- type ProjectPackageJson = RequiredPackageJSON<ProjectRequiredField>;
747
- /**
748
- * Project setup context object
749
- * @remarks Objects that are configured when the project is set up.
750
- */
751
- interface ProjectSetupContext {
752
- /** Project directory path instance */
753
- dir: Path;
754
- /** package.json */
755
- json: ProjectPackageJson;
756
- /** Project Configuration */
757
- config: ResolvedProjectConfig;
758
- /**
759
- * List of directory names of workspaces located in the project
760
- * @remarks Note that it is the directory name, not the package name.
761
- */
762
- resolvedWorkspaces: string[];
763
- }
764
-
765
- interface GetProjectPackageJsonResult {
766
- dir: Path;
767
- json: ProjectPackageJson;
768
- }
769
- declare function getProjectPackageJson<AllowMissing extends boolean | undefined = false>(searchDir?: string, allowMissing?: AllowMissing): Promise<AllowMissing extends true ? GetProjectPackageJsonResult | null : GetProjectPackageJsonResult>;
770
- interface GetWorkspacePackageJsonResult {
771
- dir: Path;
772
- json: WorkspacePackageJson;
773
- }
774
- declare function getWorkspacePackageJson<AllowMissing extends boolean | undefined = false>(searchDir?: string, allowMissing?: AllowMissing): Promise<AllowMissing extends true ? GetWorkspacePackageJsonResult | null : GetWorkspacePackageJsonResult>;
775
- declare function findWorkspacePackages(dir: string): Promise<GetWorkspacePackageJsonResult[]>;
776
-
777
- export { type BuildedHooks, Builder, type DTSNormalizer, type DTSPreserveTypeSettings, type DTSPreserveTypeTarget, type DTSSettings, type ESBuildPlugin, type ESBuildPluginOption, type ExposeEntriesSettings, type FindConfigResult, type GetProjectPackageJsonResult, type GetWorkspacePackageJsonResult, type HookArgs, type HookName, type HookReturnType, type HookTypes, type Listable, type NormalizedDTSPreserveTypeSettings, type NormalizedDTSPreserveTypeTarget, type NormalizedDTSSettings, type OptimizeCSSOptions, PROJECT_REQUIRED_FIELDS, Path, PlugboyProject, PlugboyWorkspace, type Plugin, type ProjectPackageJson, type ProjectScriptsTemplate, type ProjectSetupContext, type RawExposeEntriesSettings, type RawWorkspaceEntries, type RawWorkspaceEntry, type RawWorkspaceEntryObject, type ResolvedHooks, type ResolvedOptimizeCSSOptions, type ResolvedProjectConfig, type ResolvedWorkspaceConfig, type TSConfigJSON, TSUP_SYNC_OPTIONS, type UnPromisify, type UserHooks, type UserPluginOption, type UserProjectConfig, type UserWorkspaceConfig, WORKSPACE_PACKAGE_SYNC_FIELDS, WORKSPACE_REQUIRED_FIELDS, type WorkspaceDirs, type WorkspaceEntries, type WorkspaceEntry, type WorkspaceExport, type WorkspaceMeta, type WorkspaceObjectExport, type WorkspacePackageJson, type WorkspaceSetupContext, type WorkspaceStubLink, type WorkspaceStubLinkType, buildHooks, copyDirSync, createHooksDefaults, definePlugin, defineProjectConfig, defineWorkspaceConfig, exposeEntries, extractProjectPlugins, findConfig, findFile, findProjectPlugin, findWorkspacePackages, generateWorkspace, getDirname, getFilename, getProject, getProjectPackageJson, getWorkspace, getWorkspacePackageJson, isFileNotFoundException, isProjectPackageJson, isPromise, isWorkspacePackageJson, loadProjectConfig, loadWorkspaceConfig, mergeDTSSettingsList, normalizeDTSPreserveTypeSettings, normalizeDTSPreserveTypeTarget, normalizeDTSSettings, pathExists, resolveListable, resolveOptimizeCSSOptions, resolveRawExposeEntriesSettings, resolveRawWorkspaceEntries, resolveRawWorkspaceEntry, resolveUserHooks, resolveUserPluginOptions, resolveUserProjectConfig, resolveUserWorkspaceConfig, rmrf, syncWorkspacePackageFields };