@webiny/plugins 6.0.0-beta.0 → 6.0.0-rc.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.
@@ -1,4 +1,5 @@
1
- import { PluginCollection, PluginsContainer } from "./types";
1
+ import type { PluginCollection } from "./types.js";
2
+ import { PluginsContainer } from "./types.js";
2
3
  export declare class AsyncPluginsContainer {
3
4
  private readonly plugins;
4
5
  private pluginsContainer;
@@ -1,23 +1,17 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.AsyncPluginsContainer = void 0;
7
- var _types = require("./types");
1
+ import { PluginsContainer } from "./types.js";
8
2
  const isPluginLoader = value => {
9
3
  return typeof value === "function";
10
4
  };
11
- class AsyncPluginsContainer {
5
+ export class AsyncPluginsContainer {
12
6
  constructor(plugins) {
13
- this.plugins = plugins instanceof _types.PluginsContainer ? plugins.all() : plugins;
7
+ this.plugins = plugins instanceof PluginsContainer ? plugins.all() : plugins;
14
8
  }
15
9
  async init() {
16
10
  if (this.pluginsContainer) {
17
11
  return this.pluginsContainer;
18
12
  }
19
13
  const plugins = await this.traverseAndLoadPlugins(this.plugins);
20
- this.pluginsContainer = new _types.PluginsContainer(plugins);
14
+ this.pluginsContainer = new PluginsContainer(plugins);
21
15
  return this.pluginsContainer;
22
16
  }
23
17
  async traverseAndLoadPlugins(plugins) {
@@ -35,6 +29,5 @@ class AsyncPluginsContainer {
35
29
  }, Promise.resolve([]));
36
30
  }
37
31
  }
38
- exports.AsyncPluginsContainer = AsyncPluginsContainer;
39
32
 
40
33
  //# sourceMappingURL=AsyncPluginsContainer.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_types","require","isPluginLoader","value","AsyncPluginsContainer","constructor","plugins","PluginsContainer","all","init","pluginsContainer","traverseAndLoadPlugins","Array","isArray","reduce","acc","item","then","lazyPlugins","Promise","resolve","exports"],"sources":["AsyncPluginsContainer.ts"],"sourcesContent":["import { Plugin, PluginCollection, PluginFactory, PluginsContainer } from \"~/types\";\n\nconst isPluginLoader = (value: unknown): value is PluginFactory => {\n return typeof value === \"function\";\n};\n\nexport class AsyncPluginsContainer {\n private readonly plugins: PluginCollection;\n private pluginsContainer: PluginsContainer | undefined;\n\n constructor(plugins: PluginCollection | PluginsContainer) {\n this.plugins = plugins instanceof PluginsContainer ? plugins.all() : plugins;\n }\n\n async init() {\n if (this.pluginsContainer) {\n return this.pluginsContainer;\n }\n\n const plugins = await this.traverseAndLoadPlugins(this.plugins);\n this.pluginsContainer = new PluginsContainer(plugins);\n\n return this.pluginsContainer;\n }\n\n private async traverseAndLoadPlugins(plugins: Plugin | PluginCollection): Promise<Plugin[]> {\n if (!Array.isArray(plugins)) {\n return [plugins];\n }\n\n return plugins.reduce<Promise<Plugin[]>>((acc, item) => {\n return acc.then(async plugins => {\n if (isPluginLoader(item)) {\n const lazyPlugins = await item();\n return [...plugins, ...(await this.traverseAndLoadPlugins(lazyPlugins))];\n }\n\n return [...plugins, ...(await this.traverseAndLoadPlugins(item))];\n });\n }, Promise.resolve([]));\n }\n}\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAEA,MAAMC,cAAc,GAAIC,KAAc,IAA6B;EAC/D,OAAO,OAAOA,KAAK,KAAK,UAAU;AACtC,CAAC;AAEM,MAAMC,qBAAqB,CAAC;EAI/BC,WAAWA,CAACC,OAA4C,EAAE;IACtD,IAAI,CAACA,OAAO,GAAGA,OAAO,YAAYC,uBAAgB,GAAGD,OAAO,CAACE,GAAG,CAAC,CAAC,GAAGF,OAAO;EAChF;EAEA,MAAMG,IAAIA,CAAA,EAAG;IACT,IAAI,IAAI,CAACC,gBAAgB,EAAE;MACvB,OAAO,IAAI,CAACA,gBAAgB;IAChC;IAEA,MAAMJ,OAAO,GAAG,MAAM,IAAI,CAACK,sBAAsB,CAAC,IAAI,CAACL,OAAO,CAAC;IAC/D,IAAI,CAACI,gBAAgB,GAAG,IAAIH,uBAAgB,CAACD,OAAO,CAAC;IAErD,OAAO,IAAI,CAACI,gBAAgB;EAChC;EAEA,MAAcC,sBAAsBA,CAACL,OAAkC,EAAqB;IACxF,IAAI,CAACM,KAAK,CAACC,OAAO,CAACP,OAAO,CAAC,EAAE;MACzB,OAAO,CAACA,OAAO,CAAC;IACpB;IAEA,OAAOA,OAAO,CAACQ,MAAM,CAAoB,CAACC,GAAG,EAAEC,IAAI,KAAK;MACpD,OAAOD,GAAG,CAACE,IAAI,CAAC,MAAMX,OAAO,IAAI;QAC7B,IAAIJ,cAAc,CAACc,IAAI,CAAC,EAAE;UACtB,MAAME,WAAW,GAAG,MAAMF,IAAI,CAAC,CAAC;UAChC,OAAO,CAAC,GAAGV,OAAO,EAAE,IAAI,MAAM,IAAI,CAACK,sBAAsB,CAACO,WAAW,CAAC,CAAC,CAAC;QAC5E;QAEA,OAAO,CAAC,GAAGZ,OAAO,EAAE,IAAI,MAAM,IAAI,CAACK,sBAAsB,CAACK,IAAI,CAAC,CAAC,CAAC;MACrE,CAAC,CAAC;IACN,CAAC,EAAEG,OAAO,CAACC,OAAO,CAAC,EAAE,CAAC,CAAC;EAC3B;AACJ;AAACC,OAAA,CAAAjB,qBAAA,GAAAA,qBAAA","ignoreList":[]}
1
+ {"version":3,"names":["PluginsContainer","isPluginLoader","value","AsyncPluginsContainer","constructor","plugins","all","init","pluginsContainer","traverseAndLoadPlugins","Array","isArray","reduce","acc","item","then","lazyPlugins","Promise","resolve"],"sources":["AsyncPluginsContainer.ts"],"sourcesContent":["import type { Plugin, PluginCollection, PluginFactory } from \"~/types.js\";\nimport { PluginsContainer } from \"~/types.js\";\n\nconst isPluginLoader = (value: unknown): value is PluginFactory => {\n return typeof value === \"function\";\n};\n\nexport class AsyncPluginsContainer {\n private readonly plugins: PluginCollection;\n private pluginsContainer: PluginsContainer | undefined;\n\n constructor(plugins: PluginCollection | PluginsContainer) {\n this.plugins = plugins instanceof PluginsContainer ? plugins.all() : plugins;\n }\n\n async init() {\n if (this.pluginsContainer) {\n return this.pluginsContainer;\n }\n\n const plugins = await this.traverseAndLoadPlugins(this.plugins);\n this.pluginsContainer = new PluginsContainer(plugins);\n\n return this.pluginsContainer;\n }\n\n private async traverseAndLoadPlugins(plugins: Plugin | PluginCollection): Promise<Plugin[]> {\n if (!Array.isArray(plugins)) {\n return [plugins];\n }\n\n return plugins.reduce<Promise<Plugin[]>>((acc, item) => {\n return acc.then(async plugins => {\n if (isPluginLoader(item)) {\n const lazyPlugins = await item();\n return [...plugins, ...(await this.traverseAndLoadPlugins(lazyPlugins))];\n }\n\n return [...plugins, ...(await this.traverseAndLoadPlugins(item))];\n });\n }, Promise.resolve([]));\n }\n}\n"],"mappings":"AACA,SAASA,gBAAgB;AAEzB,MAAMC,cAAc,GAAIC,KAAc,IAA6B;EAC/D,OAAO,OAAOA,KAAK,KAAK,UAAU;AACtC,CAAC;AAED,OAAO,MAAMC,qBAAqB,CAAC;EAI/BC,WAAWA,CAACC,OAA4C,EAAE;IACtD,IAAI,CAACA,OAAO,GAAGA,OAAO,YAAYL,gBAAgB,GAAGK,OAAO,CAACC,GAAG,CAAC,CAAC,GAAGD,OAAO;EAChF;EAEA,MAAME,IAAIA,CAAA,EAAG;IACT,IAAI,IAAI,CAACC,gBAAgB,EAAE;MACvB,OAAO,IAAI,CAACA,gBAAgB;IAChC;IAEA,MAAMH,OAAO,GAAG,MAAM,IAAI,CAACI,sBAAsB,CAAC,IAAI,CAACJ,OAAO,CAAC;IAC/D,IAAI,CAACG,gBAAgB,GAAG,IAAIR,gBAAgB,CAACK,OAAO,CAAC;IAErD,OAAO,IAAI,CAACG,gBAAgB;EAChC;EAEA,MAAcC,sBAAsBA,CAACJ,OAAkC,EAAqB;IACxF,IAAI,CAACK,KAAK,CAACC,OAAO,CAACN,OAAO,CAAC,EAAE;MACzB,OAAO,CAACA,OAAO,CAAC;IACpB;IAEA,OAAOA,OAAO,CAACO,MAAM,CAAoB,CAACC,GAAG,EAAEC,IAAI,KAAK;MACpD,OAAOD,GAAG,CAACE,IAAI,CAAC,MAAMV,OAAO,IAAI;QAC7B,IAAIJ,cAAc,CAACa,IAAI,CAAC,EAAE;UACtB,MAAME,WAAW,GAAG,MAAMF,IAAI,CAAC,CAAC;UAChC,OAAO,CAAC,GAAGT,OAAO,EAAE,IAAI,MAAM,IAAI,CAACI,sBAAsB,CAACO,WAAW,CAAC,CAAC,CAAC;QAC5E;QAEA,OAAO,CAAC,GAAGX,OAAO,EAAE,IAAI,MAAM,IAAI,CAACI,sBAAsB,CAACK,IAAI,CAAC,CAAC,CAAC;MACrE,CAAC,CAAC;IACN,CAAC,EAAEG,OAAO,CAACC,OAAO,CAAC,EAAE,CAAC,CAAC;EAC3B;AACJ","ignoreList":[]}
package/Plugin.js CHANGED
@@ -1,10 +1,4 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.Plugin = void 0;
7
- class Plugin {
1
+ export class Plugin {
8
2
  constructor() {
9
3
  if (!this.constructor.type) {
10
4
  throw Error(`Missing "type" definition in "${this.constructor.name}"!`);
@@ -14,6 +8,5 @@ class Plugin {
14
8
  return this.constructor.type;
15
9
  }
16
10
  }
17
- exports.Plugin = Plugin;
18
11
 
19
12
  //# sourceMappingURL=Plugin.js.map
package/Plugin.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"names":["Plugin","constructor","type","Error","name","exports"],"sources":["Plugin.ts"],"sourcesContent":["export abstract class Plugin {\n public static readonly type: string;\n public name?: string;\n\n constructor() {\n if (!(this.constructor as typeof Plugin).type) {\n throw Error(`Missing \"type\" definition in \"${this.constructor.name}\"!`);\n }\n }\n\n get type() {\n return (this.constructor as typeof Plugin).type;\n }\n}\n"],"mappings":";;;;;;AAAO,MAAeA,MAAM,CAAC;EAIzBC,WAAWA,CAAA,EAAG;IACV,IAAI,CAAE,IAAI,CAACA,WAAW,CAAmBC,IAAI,EAAE;MAC3C,MAAMC,KAAK,CAAE,iCAAgC,IAAI,CAACF,WAAW,CAACG,IAAK,IAAG,CAAC;IAC3E;EACJ;EAEA,IAAIF,IAAIA,CAAA,EAAG;IACP,OAAQ,IAAI,CAACD,WAAW,CAAmBC,IAAI;EACnD;AACJ;AAACG,OAAA,CAAAL,MAAA,GAAAA,MAAA","ignoreList":[]}
1
+ {"version":3,"names":["Plugin","constructor","type","Error","name"],"sources":["Plugin.ts"],"sourcesContent":["export abstract class Plugin {\n public static readonly type: string;\n public name?: string;\n\n constructor() {\n if (!(this.constructor as typeof Plugin).type) {\n throw Error(`Missing \"type\" definition in \"${this.constructor.name}\"!`);\n }\n }\n\n get type() {\n return (this.constructor as typeof Plugin).type;\n }\n}\n"],"mappings":"AAAA,OAAO,MAAeA,MAAM,CAAC;EAIzBC,WAAWA,CAAA,EAAG;IACV,IAAI,CAAE,IAAI,CAACA,WAAW,CAAmBC,IAAI,EAAE;MAC3C,MAAMC,KAAK,CAAC,iCAAiC,IAAI,CAACF,WAAW,CAACG,IAAI,IAAI,CAAC;IAC3E;EACJ;EAEA,IAAIF,IAAIA,CAAA,EAAG;IACP,OAAQ,IAAI,CAACD,WAAW,CAAmBC,IAAI;EACnD;AACJ","ignoreList":[]}
@@ -1,12 +1,15 @@
1
- import { Plugin, PluginCollection } from "./types";
1
+ import type { Plugin, PluginCollection } from "./types.js";
2
+ export type WithName<T extends Plugin> = T & {
3
+ name: string;
4
+ };
2
5
  export declare class PluginsContainer {
3
6
  private plugins;
4
7
  private _byTypeCache;
5
8
  constructor(...args: PluginCollection);
6
- byName<T extends Plugin>(name: T["name"]): T | null;
7
- byType<T extends Plugin>(type: T["type"]): T[];
8
- atLeastOneByType<T extends Plugin>(type: T["type"]): T[];
9
- oneByType<T extends Plugin>(type: T["type"]): T;
9
+ byName<T extends Plugin>(name: T["name"]): WithName<T> | null;
10
+ byType<T extends Plugin>(type: T["type"]): WithName<T>[];
11
+ atLeastOneByType<T extends Plugin>(type: T["type"]): WithName<T>[];
12
+ oneByType<T extends Plugin>(type: T["type"]): WithName<T>;
10
13
  merge(input: PluginsContainer | PluginCollection): void;
11
14
  mergeByType(container: PluginsContainer, type: string): void;
12
15
  all<T extends Plugin>(): T[];
@@ -1,11 +1,4 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.PluginsContainer = void 0;
8
- var _uniqid = _interopRequireDefault(require("uniqid"));
1
+ import uniqid from "uniqid";
9
2
  const isOptionsObject = item => item && !Array.isArray(item) && !item.type && !item.name;
10
3
  const normalizeArgs = args => {
11
4
  let options = {};
@@ -34,7 +27,7 @@ const assign = (plugins, options, target) => {
34
27
  }
35
28
  let name = plugin._name || plugin.name;
36
29
  if (!name) {
37
- plugin.name = name = (0, _uniqid.default)(plugin.type + "-");
30
+ plugin.name = name = uniqid(plugin.type + "-");
38
31
  }
39
32
 
40
33
  // If skip existing was set to true, and a plugin with the same name was already registered, skip registration.
@@ -44,7 +37,7 @@ const assign = (plugins, options, target) => {
44
37
  }
45
38
  }
46
39
  };
47
- class PluginsContainer {
40
+ export class PluginsContainer {
48
41
  plugins = {};
49
42
  _byTypeCache = {};
50
43
  constructor(...args) {
@@ -109,6 +102,5 @@ class PluginsContainer {
109
102
  return Object.values(this.plugins).filter(pl => pl.type === type);
110
103
  }
111
104
  }
112
- exports.PluginsContainer = PluginsContainer;
113
105
 
114
106
  //# sourceMappingURL=PluginsContainer.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_uniqid","_interopRequireDefault","require","isOptionsObject","item","Array","isArray","type","name","normalizeArgs","args","options","length","splice","assign","plugins","target","plugin","Error","_name","uniqid","skipExisting","init","PluginsContainer","_byTypeCache","constructor","register","byName","byType","from","findByType","atLeastOneByType","list","oneByType","merge","input","all","mergeByType","container","Object","values","unregister","filter","pl","exports"],"sources":["PluginsContainer.ts"],"sourcesContent":["import { Plugin, PluginCollection } from \"./types\";\nimport uniqid from \"uniqid\";\n\nconst isOptionsObject = (item?: any) => item && !Array.isArray(item) && !item.type && !item.name;\nconst normalizeArgs = (args: any[]): [Plugin[], any] => {\n let options = {};\n\n // Check if last item in the plugins array is actually an options object.\n if (isOptionsObject(args[args.length - 1])) {\n [options] = args.splice(-1, 1);\n }\n\n return [args, options];\n};\n\nconst assign = (\n plugins: Plugin[] | Plugin[][],\n options: any,\n target: Record<string, any>\n): void => {\n for (const plugin of plugins) {\n if (Array.isArray(plugin)) {\n assign(plugin, options, target);\n continue;\n }\n\n if (typeof plugin !== \"object\") {\n throw new Error(\n `Could not register plugin. Expected an object, but got ${typeof plugin}.`\n );\n }\n\n if (!plugin.type) {\n let name = \"\";\n if (plugin.name) {\n name = ` \"${plugin.name}\"`;\n }\n throw new Error(`Could not register plugin${name}. Missing \"type\" definition.`);\n }\n\n let name = plugin._name || plugin.name;\n if (!name) {\n plugin.name = name = uniqid(plugin.type + \"-\");\n }\n\n // If skip existing was set to true, and a plugin with the same name was already registered, skip registration.\n if (!options.skipExisting || !target[name]) {\n target[name] = plugin;\n plugin.init && plugin.init();\n }\n }\n};\n\nexport class PluginsContainer {\n private plugins: Record<string, Plugin> = {};\n private _byTypeCache: Record<string, Plugin[]> = {};\n\n constructor(...args: PluginCollection) {\n this.register(...args);\n }\n\n public byName<T extends Plugin>(name: T[\"name\"]): T | null {\n if (!name) {\n return null;\n }\n /**\n * We can safely cast name as string, we know it is so.\n */\n return this.plugins[name as string] as T;\n }\n\n public byType<T extends Plugin>(type: T[\"type\"]): T[] {\n if (this._byTypeCache[type]) {\n return Array.from(this._byTypeCache[type]) as T[];\n }\n const plugins = this.findByType<T>(type);\n this._byTypeCache[type] = plugins;\n return Array.from(plugins);\n }\n\n public atLeastOneByType<T extends Plugin>(type: T[\"type\"]): T[] {\n const list = this.byType<T>(type);\n if (list.length === 0) {\n throw new Error(`There are no plugins by type \"${type}\".`);\n }\n return list;\n }\n\n public oneByType<T extends Plugin>(type: T[\"type\"]): T {\n const list = this.atLeastOneByType<T>(type);\n if (list.length > 1) {\n throw new Error(\n `There is a requirement for plugin of type \"${type}\" to be only one registered.`\n );\n }\n return list[0];\n }\n\n public merge(input: PluginsContainer | PluginCollection): void {\n if (input instanceof PluginsContainer) {\n this.register(...input.all());\n return;\n }\n this.register(input);\n }\n\n public mergeByType(container: PluginsContainer, type: string): void {\n this.register(...container.byType(type));\n }\n\n public all<T extends Plugin>(): T[] {\n return Object.values(this.plugins) as T[];\n }\n\n public register(...args: any): void {\n // reset the cache when adding new plugins\n this._byTypeCache = {};\n const [plugins, options] = normalizeArgs(args);\n assign(plugins, options, this.plugins);\n }\n\n public unregister(name: string): void {\n // reset the cache when removing a plugin\n this._byTypeCache = {};\n delete this.plugins[name];\n }\n\n private findByType<T extends Plugin>(type: T[\"type\"]): T[] {\n return Object.values(this.plugins).filter((pl): pl is T => pl.type === type) as T[];\n }\n}\n"],"mappings":";;;;;;;AACA,IAAAA,OAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEA,MAAMC,eAAe,GAAIC,IAAU,IAAKA,IAAI,IAAI,CAACC,KAAK,CAACC,OAAO,CAACF,IAAI,CAAC,IAAI,CAACA,IAAI,CAACG,IAAI,IAAI,CAACH,IAAI,CAACI,IAAI;AAChG,MAAMC,aAAa,GAAIC,IAAW,IAAsB;EACpD,IAAIC,OAAO,GAAG,CAAC,CAAC;;EAEhB;EACA,IAAIR,eAAe,CAACO,IAAI,CAACA,IAAI,CAACE,MAAM,GAAG,CAAC,CAAC,CAAC,EAAE;IACxC,CAACD,OAAO,CAAC,GAAGD,IAAI,CAACG,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;EAClC;EAEA,OAAO,CAACH,IAAI,EAAEC,OAAO,CAAC;AAC1B,CAAC;AAED,MAAMG,MAAM,GAAGA,CACXC,OAA8B,EAC9BJ,OAAY,EACZK,MAA2B,KACpB;EACP,KAAK,MAAMC,MAAM,IAAIF,OAAO,EAAE;IAC1B,IAAIV,KAAK,CAACC,OAAO,CAACW,MAAM,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C,OAAOG,MAAM,CAACC,MAAM,CAAC,IAAI,CAACzB,OAAO,CAAC;EACtC;EAEOW,QAAQA,CAAC,GAAGhB,IAAS,EAAQ;IAChC;IACA,IAAI,CAACc,YAAY,GAAG,CAAC,CAAC;IACtB,MAAM,CAACT,OAAO,EAAEJ,OAAO,CAAC,GAAGF,aAAa,CAACC,IAAI,CAAC;IAC9CI,MAAM,CAACC,OAAO,EAAEJ,OAAO,EAAE,IAAI,CAACI,OAAO,CAAC;EAC1C;EAEO0B,UAAUA,CAACjC,IAAY,EAAQ;IAClC;IACA,IAAI,CAACgB,YAAY,GAAG,CAAC,CAAC;IACtB,OAAO,IAAI,CAACT,OAAO,CAACP,IAAI,CAAC;EAC7B;EAEQsB,UAAUA,CAAmBvB,IAAe,EAAO;IACvD,OAAOgC,MAAM,CAACC,MAAM,CAAC,IAAI,CAACzB,OAAO,CAAC,CAAC2B,MAAM,CAAEC,EAAE,IAAcA,EAAE,CAACpC,IAAI,KAAKA,IAAI,CAAC;EAChF;AACJ;AAACqC,OAAA,CAAArB,gBAAA,GAAAA,gBAAA","ignoreList":[]}
1
+ {"version":3,"names":["uniqid","isOptionsObject","item","Array","isArray","type","name","normalizeArgs","args","options","length","splice","assign","plugins","target","plugin","Error","_name","skipExisting","init","PluginsContainer","_byTypeCache","constructor","register","byName","byType","from","findByType","atLeastOneByType","list","oneByType","merge","input","all","mergeByType","container","Object","values","unregister","filter","pl"],"sources":["PluginsContainer.ts"],"sourcesContent":["import type { Plugin, PluginCollection } from \"./types.js\";\nimport uniqid from \"uniqid\";\n\nexport type WithName<T extends Plugin> = T & { name: string };\n\nconst isOptionsObject = (item?: any) => item && !Array.isArray(item) && !item.type && !item.name;\nconst normalizeArgs = (args: any[]): [Plugin[], any] => {\n let options = {};\n\n // Check if last item in the plugins array is actually an options object.\n if (isOptionsObject(args[args.length - 1])) {\n [options] = args.splice(-1, 1);\n }\n\n return [args, options];\n};\n\nconst assign = (\n plugins: Plugin[] | Plugin[][],\n options: any,\n target: Record<string, any>\n): void => {\n for (const plugin of plugins) {\n if (Array.isArray(plugin)) {\n assign(plugin, options, target);\n continue;\n }\n\n if (typeof plugin !== \"object\") {\n throw new Error(\n `Could not register plugin. Expected an object, but got ${typeof plugin}.`\n );\n }\n\n if (!plugin.type) {\n let name = \"\";\n if (plugin.name) {\n name = ` \"${plugin.name}\"`;\n }\n throw new Error(`Could not register plugin${name}. Missing \"type\" definition.`);\n }\n\n let name = plugin._name || plugin.name;\n if (!name) {\n plugin.name = name = uniqid(plugin.type + \"-\");\n }\n\n // If skip existing was set to true, and a plugin with the same name was already registered, skip registration.\n if (!options.skipExisting || !target[name]) {\n target[name] = plugin;\n plugin.init && plugin.init();\n }\n }\n};\n\nexport class PluginsContainer {\n private plugins: Record<string, Plugin> = {};\n private _byTypeCache: Record<string, WithName<Plugin>[]> = {};\n\n constructor(...args: PluginCollection) {\n this.register(...args);\n }\n\n public byName<T extends Plugin>(name: T[\"name\"]) {\n if (!name) {\n return null;\n }\n /**\n * We can safely cast name as string, we know it is so.\n */\n return this.plugins[name as string] as WithName<T>;\n }\n\n public byType<T extends Plugin>(type: T[\"type\"]) {\n if (this._byTypeCache[type]) {\n return Array.from(this._byTypeCache[type]) as WithName<T>[];\n }\n const plugins = this.findByType<T>(type);\n this._byTypeCache[type] = plugins;\n return Array.from(plugins);\n }\n\n public atLeastOneByType<T extends Plugin>(type: T[\"type\"]) {\n const list = this.byType<T>(type);\n if (list.length === 0) {\n throw new Error(`There are no plugins by type \"${type}\".`);\n }\n return list;\n }\n\n public oneByType<T extends Plugin>(type: T[\"type\"]) {\n const list = this.atLeastOneByType<T>(type);\n if (list.length > 1) {\n throw new Error(\n `There is a requirement for plugin of type \"${type}\" to be only one registered.`\n );\n }\n return list[0];\n }\n\n public merge(input: PluginsContainer | PluginCollection): void {\n if (input instanceof PluginsContainer) {\n this.register(...input.all());\n return;\n }\n this.register(input);\n }\n\n public mergeByType(container: PluginsContainer, type: string): void {\n this.register(...container.byType(type));\n }\n\n public all<T extends Plugin>(): T[] {\n return Object.values(this.plugins) as T[];\n }\n\n public register(...args: any): void {\n // reset the cache when adding new plugins\n this._byTypeCache = {};\n const [plugins, options] = normalizeArgs(args);\n assign(plugins, options, this.plugins);\n }\n\n public unregister(name: string): void {\n // reset the cache when removing a plugin\n this._byTypeCache = {};\n delete this.plugins[name];\n }\n\n private findByType<T extends Plugin>(type: T[\"type\"]) {\n return Object.values(this.plugins).filter(\n (pl): pl is T => pl.type === type\n ) as WithName<T>[];\n }\n}\n"],"mappings":"AACA,OAAOA,MAAM,MAAM,QAAQ;AAI3B,MAAMC,eAAe,GAAIC,IAAU,IAAKA,IAAI,IAAI,CAACC,KAAK,CAACC,OAAO,CAACF,IAAI,CAAC,IAAI,CAACA,IAAI,CAACG,IAAI,IAAI,CAACH,IAAI,CAACI,IAAI;AAChG,MAAMC,aAAa,GAAIC,IAAW,IAAsB;EACpD,IAAIC,OAAO,GAAG,CAAC,CAAC;;EAEhB;EACA,IAAIR,eAAe,CAACO,IAAI,CAACA,IAAI,CAACE,MAAM,GAAG,CAAC,CAAC,CAAC,EAAE;IACxC,CAACD,OAAO,CAAC,GAAGD,IAAI,CAACG,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;EAClC;EAEA,OAAO,CAACH,IAAI,EAAEC,OAAO,CAAC;AAC1B,CAAC;AAED,MAAMG,MAAM,GAAGA,CACXC,OAA8B,EAC9BJ,OAAY,EACZK,MAA2B,KACpB;EACP,KAAK,MAAMC,MAAM,IAAIF,OAAO,EAAE;IAC1B,IAAIV,KAAK,CAACC,OAAO,CAACW,MAAM,CAAC,EAAE;MACvBH,MAAM,CAACG,MAAM,EAAEN,OAAO,EAAEK,MAAM,CAAC;MAC/B;IACJ;IAEA,IAAI,OAAOC,MAAM,KAAK,QAAQ,EAAE;MAC5B,MAAM,IAAIC,KAAK,CACX,0DAA0D,OAAOD,MAAM,GAC3E,CAAC;IACL;IAEA,IAAI,CAACA,MAAM,CAACV,I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C9CI,MAAM,CAACC,OAAO,EAAEJ,OAAO,EAAE,IAAI,CAACI,OAAO,CAAC;EAC1C;EAEOyB,UAAUA,CAAChC,IAAY,EAAQ;IAClC;IACA,IAAI,CAACe,YAAY,GAAG,CAAC,CAAC;IACtB,OAAO,IAAI,CAACR,OAAO,CAACP,IAAI,CAAC;EAC7B;EAEQqB,UAAUA,CAAmBtB,IAAe,EAAE;IAClD,OAAO+B,MAAM,CAACC,MAAM,CAAC,IAAI,CAACxB,OAAO,CAAC,CAAC0B,MAAM,CACpCC,EAAE,IAAcA,EAAE,CAACnC,IAAI,KAAKA,IACjC,CAAC;EACL;AACJ","ignoreList":[]}
package/README.md CHANGED
@@ -1,74 +1,11 @@
1
1
  # @webiny/plugins
2
- [![](https://img.shields.io/npm/dw/@webiny/plugins.svg)](https://www.npmjs.com/package/@webiny/plugins)
3
- [![](https://img.shields.io/npm/v/@webiny/plugins.svg)](https://www.npmjs.com/package/@webiny/plugins)
4
- [![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettier)
5
- [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](http://makeapullrequest.com)
6
2
 
7
- A simple registry that stores all plugins in a shared object.
8
- The only requirement for a plugin is to have a `name` and a `type` properties.
9
- The rest is entirely up to you.
3
+ > [!NOTE]
4
+ > This package is part of the [Webiny](https://www.webiny.com) monorepo.
5
+ > It’s **included in every Webiny project by default** and is not meant to be used as a standalone package.
10
6
 
11
- There is nothing spectacular going on under the hood, just a simple
12
- object for storing references and a few utility functions.
7
+ 📘 **Documentation:** [https://www.webiny.com/docs](https://www.webiny.com/docs)
13
8
 
14
- For more information, please visit [the official docs](https://docs.webiny.com/docs/developer-tutorials/plugins-crash-course).
15
-
16
- ## Install
17
- ```
18
- npm install --save @webiny/plugins
19
- ```
9
+ ---
20
10
 
21
- Or if you prefer yarn:
22
- ```
23
- yarn add @webiny/plugins
24
- ```
25
-
26
- ## Usage
27
-
28
- ### Adding a plugin
29
- ```
30
- import { plugins } from "@webiny/plugins";
31
-
32
- // Add a plugin
33
- plugins.register({
34
- name: "my-plugin",
35
- type: "say-hi",
36
- salute: () => "Hi!"
37
- });
38
-
39
- plugins.register({
40
- name: "my-second-plugin",
41
- type: "say-hi",
42
- salute: () => "Yo!"
43
- });
44
- ```
45
-
46
- ### Getting plugins by type
47
- ```
48
- // anywhere in your app
49
- import { plugins } from "@webiny/plugins";
50
-
51
- const pluginList = plugins.byType("say-hi");
52
- pluginList.forEach(plugin => {
53
- // Call "salute" function
54
- plugin.salute();
55
- });
56
- ```
57
-
58
- ### Getting a single plugin by name
59
- ```
60
- // anywhere in your app
61
- import { plugins } from "@webiny/plugins";
62
-
63
- const plugin = plugins.byName("my-plugin");
64
- // Call "salute" function
65
- plugin.salute();
66
- ```
67
-
68
- ### Removing a plugin
69
- ```
70
- // anywhere in your app
71
- import { plugins } from "@webiny/plugins";
72
-
73
- plugins.unregister("my-plugin");
74
- ```
11
+ _This README file is automatically generated during the publish process._
package/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { PluginsContainer } from "./PluginsContainer";
2
- import { AsyncPluginsContainer } from "./AsyncPluginsContainer";
3
- import { Plugin } from "./Plugin";
1
+ import { PluginsContainer } from "./PluginsContainer.js";
2
+ import { AsyncPluginsContainer } from "./AsyncPluginsContainer.js";
3
+ import { Plugin } from "./Plugin.js";
4
4
  declare const plugins: PluginsContainer;
5
5
  export { Plugin, PluginsContainer, plugins, AsyncPluginsContainer };
package/index.js CHANGED
@@ -1,30 +1,7 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- Object.defineProperty(exports, "AsyncPluginsContainer", {
7
- enumerable: true,
8
- get: function () {
9
- return _AsyncPluginsContainer.AsyncPluginsContainer;
10
- }
11
- });
12
- Object.defineProperty(exports, "Plugin", {
13
- enumerable: true,
14
- get: function () {
15
- return _Plugin.Plugin;
16
- }
17
- });
18
- Object.defineProperty(exports, "PluginsContainer", {
19
- enumerable: true,
20
- get: function () {
21
- return _PluginsContainer.PluginsContainer;
22
- }
23
- });
24
- exports.plugins = void 0;
25
- var _PluginsContainer = require("./PluginsContainer");
26
- var _AsyncPluginsContainer = require("./AsyncPluginsContainer");
27
- var _Plugin = require("./Plugin");
28
- const plugins = exports.plugins = new _PluginsContainer.PluginsContainer();
1
+ import { PluginsContainer } from "./PluginsContainer.js";
2
+ import { AsyncPluginsContainer } from "./AsyncPluginsContainer.js";
3
+ import { Plugin } from "./Plugin.js";
4
+ const plugins = new PluginsContainer();
5
+ export { Plugin, PluginsContainer, plugins, AsyncPluginsContainer };
29
6
 
30
7
  //# sourceMappingURL=index.js.map
package/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"names":["_PluginsContainer","require","_AsyncPluginsContainer","_Plugin","plugins","exports","PluginsContainer"],"sources":["index.ts"],"sourcesContent":["import { PluginsContainer } from \"./PluginsContainer\";\nimport { AsyncPluginsContainer } from \"./AsyncPluginsContainer\";\nimport { Plugin } from \"./Plugin\";\n\nconst plugins = new PluginsContainer();\n\nexport { Plugin, PluginsContainer, plugins, AsyncPluginsContainer };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,iBAAA,GAAAC,OAAA;AACA,IAAAC,sBAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AAEA,MAAMG,OAAO,GAAAC,OAAA,CAAAD,OAAA,GAAG,IAAIE,kCAAgB,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["PluginsContainer","AsyncPluginsContainer","Plugin","plugins"],"sources":["index.ts"],"sourcesContent":["import { PluginsContainer } from \"./PluginsContainer.js\";\nimport { AsyncPluginsContainer } from \"./AsyncPluginsContainer.js\";\nimport { Plugin } from \"./Plugin.js\";\n\nconst plugins = new PluginsContainer();\n\nexport { Plugin, PluginsContainer, plugins, AsyncPluginsContainer };\n"],"mappings":"AAAA,SAASA,gBAAgB;AACzB,SAASC,qBAAqB;AAC9B,SAASC,MAAM;AAEf,MAAMC,OAAO,GAAG,IAAIH,gBAAgB,CAAC,CAAC;AAEtC,SAASE,MAAM,EAAEF,gBAAgB,EAAEG,OAAO,EAAEF,qBAAqB","ignoreList":[]}
package/package.json CHANGED
@@ -1,6 +1,7 @@
1
1
  {
2
2
  "name": "@webiny/plugins",
3
- "version": "6.0.0-beta.0",
3
+ "version": "6.0.0-rc.0",
4
+ "type": "module",
4
5
  "main": "index.js",
5
6
  "repository": {
6
7
  "type": "git",
@@ -13,26 +14,18 @@
13
14
  ],
14
15
  "license": "MIT",
15
16
  "dependencies": {
16
- "@babel/runtime": "7.24.1",
17
17
  "uniqid": "5.4.0"
18
18
  },
19
19
  "devDependencies": {
20
- "@babel/cli": "7.24.1",
21
- "@babel/core": "7.24.3",
22
- "@types/uniqid": "5.3.2",
23
- "@webiny/cli": "6.0.0-beta.0",
24
- "@webiny/project-utils": "6.0.0-beta.0",
25
- "rimraf": "5.0.5",
26
- "ttypescript": "1.5.15",
27
- "typescript": "4.7.4"
20
+ "@types/uniqid": "5.3.4",
21
+ "@webiny/build-tools": "6.0.0-rc.0",
22
+ "rimraf": "6.1.3",
23
+ "typescript": "5.9.3",
24
+ "vitest": "4.0.18"
28
25
  },
29
26
  "publishConfig": {
30
27
  "access": "public",
31
28
  "directory": "dist"
32
29
  },
33
- "scripts": {
34
- "build": "yarn webiny run build",
35
- "watch": "yarn webiny run watch"
36
- },
37
- "gitHead": "aa8dbfbbd5ad13ec271adba6f2431e02991a300f"
30
+ "gitHead": "0f2aa699f4642e550ab62c96fcd050e8d02345c9"
38
31
  }
package/types.d.ts CHANGED
@@ -1,9 +1,9 @@
1
- export { PluginsContainer } from "./PluginsContainer";
2
- export declare type Plugin<T = Record<string, any>> = {
1
+ export { PluginsContainer } from "./PluginsContainer.js";
2
+ export type Plugin<T = Record<string, any>> = {
3
3
  type: string;
4
4
  name?: string;
5
5
  init?: () => void;
6
6
  [key: string]: any;
7
7
  } & T;
8
- export declare type PluginCollection = (Plugin | PluginFactory | PluginCollection)[];
9
- export declare type PluginFactory = () => Promise<Plugin | PluginCollection>;
8
+ export type PluginCollection = (Plugin | PluginFactory | PluginCollection)[];
9
+ export type PluginFactory = () => Promise<Plugin | PluginCollection>;
package/types.js CHANGED
@@ -1,14 +1,3 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- Object.defineProperty(exports, "PluginsContainer", {
7
- enumerable: true,
8
- get: function () {
9
- return _PluginsContainer.PluginsContainer;
10
- }
11
- });
12
- var _PluginsContainer = require("./PluginsContainer");
1
+ export { PluginsContainer } from "./PluginsContainer.js";
13
2
 
14
3
  //# sourceMappingURL=types.js.map
package/types.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"names":["_PluginsContainer","require"],"sources":["types.ts"],"sourcesContent":["export { PluginsContainer } from \"./PluginsContainer\";\n\nexport type Plugin<T = Record<string, any>> = {\n type: string;\n name?: string;\n init?: () => void;\n [key: string]: any;\n} & T;\n\nexport type PluginCollection = (Plugin | PluginFactory | PluginCollection)[];\n\nexport type PluginFactory = () => Promise<Plugin | PluginCollection>;\n"],"mappings":";;;;;;;;;;;AAAA,IAAAA,iBAAA,GAAAC,OAAA","ignoreList":[]}
1
+ {"version":3,"names":["PluginsContainer"],"sources":["types.ts"],"sourcesContent":["export { PluginsContainer } from \"./PluginsContainer.js\";\n\nexport type Plugin<T = Record<string, any>> = {\n type: string;\n name?: string;\n init?: () => void;\n [key: string]: any;\n} & T;\n\nexport type PluginCollection = (Plugin | PluginFactory | PluginCollection)[];\n\nexport type PluginFactory = () => Promise<Plugin | PluginCollection>;\n"],"mappings":"AAAA,SAASA,gBAAgB","ignoreList":[]}