pkgbld 1.30.1 → 1.31.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -246,9 +246,9 @@ You might want to disable this option in some edge cases.
246
246
 
247
247
  `pkgbld` reads all installed packages named `pkgbld-plugin-*` and assumes they are plugins
248
248
 
249
- Plugins suppose to implement one or more of the following interface methods as their package exports:
249
+ Plugins suppose to implement one or more of the following interface methods on an object that returned by `create()` function exported by the plugin module.
250
250
 
251
- ```
251
+ ```typescript
252
252
  interface PkgbldPlugin {
253
253
  options(parsedArgs: {[key: string]: string | number}, options: ReturnType<typeof getCliOptions>): void;
254
254
  processPackageJson(packageJson: PackageJson, inputs: string[], logger: Logger): void;
package/dist/index.d.ts CHANGED
@@ -1,99 +1,77 @@
1
- /// <reference types="@niceties/draftlog-appender" />
1
+ // Generated by dts-bundle-generator v9.5.1
2
2
 
3
- declare module 'pkgbld' {
4
- import type { Plugin, InternalModuleFormat, OutputOptions } from 'rollup';
5
- import type { Logger } from '@niceties/logger';
6
- export type Json = null | string | number | boolean | Json[] | {
7
- [name: string]: Json;
8
- };
9
- export type ProvideFunction = (factory: () => Plugin, priority: number, options?: {
10
- format?: InternalModuleFormat | InternalModuleFormat[];
11
- inputs?: string[];
12
- outputPlugin?: true;
13
- }) => void;
14
- export type Provider = {
15
- provide: ProvideFunction;
16
- import: (module: string, exportName?: string) => Promise<((...args: unknown[]) => Plugin)>;
17
- globalImport: (module: string, exportName?: string | string[]) => void;
18
- globalSetup: (code: Function | string) => void;
19
- };
20
- export type PkgbldRollupPlugin = {
21
- plugin: () => Plugin;
22
- priority: number;
23
- format?: InternalModuleFormat | InternalModuleFormat[];
24
- inputs?: string[];
25
- outputPlugin?: true;
26
- };
27
- export type CliOptions = NonNullable<Extract<ReturnType<typeof getCliOptions>, {
28
- kind: 'build';
29
- }>>;
30
- export type ParsedOptions = Record<string, string | number | string[] | number[] | boolean | undefined>;
31
- export interface PkgbldPlugin {
32
- options(parsedArgs: ParsedOptions, options: CliOptions): void;
33
- processPackageJson(packageJson: PackageJson, inputs: string[], logger: Logger): void;
34
- processTsConfig(config: Json): void;
35
- providePlugins(provider: Provider, config: ParsedOptions, inputs: string[], inputsExt: Map<string, string>): Promise<void>;
36
- getExtraOutputSettings(format: InternalModuleFormat, inputs: string[]): Partial<OutputOptions>;
37
- buildEnd(): Promise<void>;
38
- }
39
- export type PackageJson = {
40
- private?: boolean;
41
- version?: string;
42
- name?: string;
43
- bin?: string | Record<string, string>;
44
- main?: string;
45
- license?: string;
46
- readme?: string;
47
- author?: string | {
48
- name?: string;
49
- email?: string;
50
- url?: string;
51
- };
52
- description?: string;
53
- scripts?: {
54
- [key: string]: string;
55
- };
56
- repository?: {
57
- type?: string;
58
- url?: string;
59
- };
60
- files?: string[];
61
- bugs?: string;
62
- homepage?: string;
63
- dependencies?: Record<string, string>;
64
- devDependencies?: Record<string, string>;
65
- peerDependencies?: Record<string, string>;
66
- exports?: Record<string, string | Record<string, string>>;
67
- };
68
- function getCliOptions(plugins: Partial<PkgbldPlugin>[], pkg: PackageJson): {
69
- kind: 'build';
70
- umdInputs: string[];
71
- compressFormats: string[];
72
- sourcemapFormats: string[];
73
- formats: string[];
74
- formatsOverridden: boolean;
75
- preprocess: string[];
76
- dir: string;
77
- sourceDir: string;
78
- bin?: string[] | undefined;
79
- includeExternals: boolean | string[];
80
- eject: boolean;
81
- noTsConfig: boolean;
82
- noUpdatePackageJson: boolean;
83
- commonjsPattern: string;
84
- esPattern: string;
85
- umdPattern: string;
86
- formatPackageJson: boolean;
87
- noPack: boolean;
88
- noExports: boolean;
89
- noClean: boolean;
90
- noBundle: boolean;
91
- } | {
92
- readonly kind: "prune";
93
- readonly profile: string;
94
- readonly flatten: string | boolean;
95
- readonly removeSourcemaps: boolean;
96
- readonly optimizeFiles: boolean;
97
- };
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[] | undefined;
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
+ } | {
30
+ readonly kind: "prune";
31
+ readonly profile: string;
32
+ readonly flatten: string | boolean;
33
+ readonly removeSourcemaps: boolean;
34
+ readonly optimizeFiles: boolean;
35
+ };
36
+ export type Json = null | string | number | boolean | Json[] | {
37
+ [name: string]: Json;
38
+ };
39
+ export type ProvideFunction = (factory: () => Plugin, priority: number, options?: {
40
+ format?: InternalModuleFormat | InternalModuleFormat[];
41
+ inputs?: string[];
42
+ outputPlugin?: true;
43
+ }) => void;
44
+ export type Provider = {
45
+ provide: ProvideFunction;
46
+ import: (module: string, exportName?: string) => Promise<((...args: unknown[]) => Plugin)>;
47
+ globalImport: (module: string, exportName?: string | string[]) => void;
48
+ globalSetup: (code: Function | string) => void;
49
+ };
50
+ export type PkgbldRollupPlugin = {
51
+ plugin: () => Plugin;
52
+ priority: number;
53
+ format?: InternalModuleFormat | InternalModuleFormat[];
54
+ inputs?: string[];
55
+ outputPlugin?: true;
56
+ };
57
+ export type CliOptions = NonNullable<Extract<ReturnType<typeof getCliOptions>, {
58
+ kind: "build";
59
+ }>>;
60
+ export type ParsedOptions = Record<string, string | number | string[] | number[] | boolean | undefined>;
61
+ export interface PkgbldPluginFactory {
62
+ create(): Promise<Partial<PkgbldPlugin>>;
63
+ }
64
+ export interface PkgbldPlugin {
65
+ options(parsedArgs: ParsedOptions, options: CliOptions): void;
66
+ processPackageJson(packageJson: PackageJson, inputs: string[]): void;
67
+ processTsConfig(config: JsonObject): void;
68
+ providePlugins(provider: Provider, config: ParsedOptions, inputs: string[], inputsExt: Map<string, string>): Promise<void>;
69
+ getExtraOutputSettings(format: InternalModuleFormat, inputs: string[]): Partial<OutputOptions>;
70
+ buildEnd(): Promise<void>;
98
71
  }
99
72
 
73
+ export {
74
+ PackageJson,
75
+ };
76
+
77
+ export {};
package/dist/index.mjs CHANGED
@@ -734,7 +734,7 @@ async function processPackage(pkg, config, plugins, tsConfig) {
734
734
  const typingsFilePattern = '[name].d.ts';
735
735
  const indexId = 'index';
736
736
  const typesVersionsLastFields = new Set(['*']);
737
- // check if declarations ebabled
737
+ // check if declarations enabled
738
738
  const isDeclarations = typeof tsConfig === 'object'
739
739
  && tsConfig != null && 'compilerOptions' in tsConfig
740
740
  && typeof tsConfig.compilerOptions === 'object' && tsConfig.compilerOptions !== null
@@ -864,7 +864,7 @@ async function processPackage(pkg, config, plugins, tsConfig) {
864
864
  config.formats.push('umd');
865
865
  }
866
866
  for (const plugin of plugins) {
867
- plugin.processPackageJson?.(pkg, inputs, logger);
867
+ plugin.processPackageJson?.(pkg, inputs);
868
868
  }
869
869
  if (config.bin) {
870
870
  if (config.bin.length > 0) {
@@ -936,7 +936,7 @@ async function writeJson(path, json) {
936
936
  await fs.writeFile(path, toFormattedJson(json));
937
937
  }
938
938
 
939
- var version = "1.30.1";
939
+ var version = "1.31.1";
940
940
  var name = "pkgbld";
941
941
  var license = "MIT";
942
942
  var author = "Konstantin Shutkin";
@@ -965,7 +965,7 @@ var keywords = [
965
965
  "rollup"
966
966
  ];
967
967
  var scripts = {
968
- build: "xc6 rm src/options-types.ts && xc6 ln ../options/src/types.ts src/options-types.ts && rollup -c && dts-buddy dist/index.d.ts -m pkgbld:dist/src/index.d.ts && xc6 rm dist/src",
968
+ build: "rollup -c && dts-bundle-generator -o dist/index.d.ts src/index.ts",
969
969
  lint: "eslint ./src",
970
970
  prepack: "node ./index.js prune --removeSourcemaps",
971
971
  test: "c8 --src=. --all -r=html node --env-file=ci.env tests/test.js"
@@ -995,9 +995,9 @@ var dependencies = {
995
995
  var devDependencies = {
996
996
  "@types/lodash": "^4.14.202",
997
997
  "@total-typescript/ts-reset": "^0.5.1",
998
- "dts-buddy": "^0.4.5",
998
+ "type-fest": "^4.20.1",
999
+ "dts-bundle-generator": "^9.5.1",
999
1000
  options: "workspace:*",
1000
- xc6: "workspace:*",
1001
1001
  c8: "^9.1.0",
1002
1002
  "cli-test-helper": "workspace:*"
1003
1003
  };
@@ -1180,7 +1180,7 @@ async function loadPlugins(pkg) {
1180
1180
  try {
1181
1181
  return await Promise.all([...new Set([...Object.keys(pkg.devDependencies || {}), ...Object.keys(pkg.dependencies || {}), ...Object.keys(pkg.peerDependencies || {})])]
1182
1182
  .filter(packageName => packageName.startsWith('pkgbld-plugin-'))
1183
- .map(packageName => import(packageName)));
1183
+ .map(packageName => import(packageName).then((pluginFactory) => pluginFactory.create())));
1184
1184
  }
1185
1185
  catch (e) {
1186
1186
  console.error(e);
@@ -1524,6 +1524,8 @@ function getScriptsData() {
1524
1524
  };
1525
1525
  }
1526
1526
 
1527
+ // eslint-disable-next-line @typescript-eslint/triple-slash-reference
1528
+ /// <reference path="./rollup-plugin-preprocess.d.ts" />
1527
1529
  execute();
1528
1530
  async function execute() {
1529
1531
  const time = Date.now();
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.30.1",
2
+ "version": "1.31.1",
3
3
  "name": "pkgbld",
4
4
  "license": "MIT",
5
5
  "author": "Konstantin Shutkin",