@teambit/aspect-loader 0.0.786 → 0.0.789

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.
@@ -10,5 +10,5 @@ export interface PluginDefinition {
10
10
  /**
11
11
  * register the plugin to its slot registry.
12
12
  */
13
- register<T>(object: T): Promise<void>;
13
+ register<T>(object: T): void;
14
14
  }
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["plugin-definition.ts"],"sourcesContent":["export interface PluginDefinition {\n /**\n * regex pattern for detecting the definition file within a component.\n */\n pattern: string | RegExp;\n\n /**\n * runtimes for the plugin to apply.\n */\n runtimes: string[];\n\n /**\n * register the plugin to its slot registry.\n */\n register<T>(object: T): Promise<void>;\n}\n"],"mappings":""}
1
+ {"version":3,"names":[],"sources":["plugin-definition.ts"],"sourcesContent":["export interface PluginDefinition {\n /**\n * regex pattern for detecting the definition file within a component.\n */\n pattern: string | RegExp;\n\n /**\n * runtimes for the plugin to apply.\n */\n runtimes: string[];\n\n /**\n * register the plugin to its slot registry.\n */\n register<T>(object: T): void;\n}\n"],"mappings":""}
package/dist/plugin.d.ts CHANGED
@@ -8,6 +8,6 @@ export declare class Plugin {
8
8
  * determines whether the plugin supports a certain runtime.
9
9
  */
10
10
  supportsRuntime(runtime: string): boolean;
11
- register(): Promise<void>;
11
+ register(): void;
12
12
  require(): unknown;
13
13
  }
package/dist/plugin.js CHANGED
@@ -2,8 +2,6 @@
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
4
 
5
- require("core-js/modules/es.promise.js");
6
-
7
5
  Object.defineProperty(exports, "__esModule", {
8
6
  value: true
9
7
  });
@@ -34,10 +32,10 @@ class Plugin {
34
32
  return this.def.runtimes.includes(runtime);
35
33
  }
36
34
 
37
- async register() {
35
+ register() {
38
36
  const object = this.require();
39
37
 
40
- await this.def.register(object);
38
+ this.def.register(object);
41
39
  }
42
40
 
43
41
  require() {
@@ -1 +1 @@
1
- {"version":3,"names":["Plugin","constructor","def","path","supportsRuntime","runtime","runtimes","includes","register","object","require","_instance","default"],"sources":["plugin.ts"],"sourcesContent":["import { PluginDefinition } from './plugin-definition';\n\nexport class Plugin {\n constructor(readonly def: PluginDefinition, readonly path: string) {}\n\n // consider adding a more abstract type here to allow users to ask for dependencies.\n private _instance: undefined | unknown;\n\n /**\n * determines whether the plugin supports a certain runtime.\n */\n supportsRuntime(runtime: string) {\n return this.def.runtimes.includes(runtime);\n }\n\n async register() {\n const object = this.require();\n await this.def.register<unknown>(object);\n }\n\n require() {\n // eslint-disable-next-line global-require, import/no-dynamic-require\n this._instance = require(this.path).default;\n return this._instance;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAEO,MAAMA,MAAN,CAAa;EAClBC,WAAW,CAAUC,GAAV,EAA0CC,IAA1C,EAAwD;IAAA,KAA9CD,GAA8C,GAA9CA,GAA8C;IAAA,KAAdC,IAAc,GAAdA,IAAc;IAAA;EAAE,CADnD,CAGlB;;;EAGA;AACF;AACA;EACEC,eAAe,CAACC,OAAD,EAAkB;IAC/B,OAAO,KAAKH,GAAL,CAASI,QAAT,CAAkBC,QAAlB,CAA2BF,OAA3B,CAAP;EACD;;EAEa,MAARG,QAAQ,GAAG;IACf,MAAMC,MAAM,GAAG,KAAKC,OAAL,EAAf;;IACA,MAAM,KAAKR,GAAL,CAASM,QAAT,CAA2BC,MAA3B,CAAN;EACD;;EAEDC,OAAO,GAAG;IACR;IACA,KAAKC,SAAL,GAAiBD,OAAO,CAAC,KAAKP,IAAN,CAAP,CAAmBS,OAApC;IACA,OAAO,KAAKD,SAAZ;EACD;;AAtBiB"}
1
+ {"version":3,"names":["Plugin","constructor","def","path","supportsRuntime","runtime","runtimes","includes","register","object","require","_instance","default"],"sources":["plugin.ts"],"sourcesContent":["import { PluginDefinition } from './plugin-definition';\n\nexport class Plugin {\n constructor(readonly def: PluginDefinition, readonly path: string) {}\n\n // consider adding a more abstract type here to allow users to ask for dependencies.\n private _instance: undefined | unknown;\n\n /**\n * determines whether the plugin supports a certain runtime.\n */\n supportsRuntime(runtime: string) {\n return this.def.runtimes.includes(runtime);\n }\n\n register() {\n const object = this.require();\n this.def.register<unknown>(object);\n }\n\n require() {\n // eslint-disable-next-line global-require, import/no-dynamic-require\n this._instance = require(this.path).default;\n return this._instance;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAEO,MAAMA,MAAN,CAAa;EAClBC,WAAW,CAAUC,GAAV,EAA0CC,IAA1C,EAAwD;IAAA,KAA9CD,GAA8C,GAA9CA,GAA8C;IAAA,KAAdC,IAAc,GAAdA,IAAc;IAAA;EAAE,CADnD,CAGlB;;;EAGA;AACF;AACA;EACEC,eAAe,CAACC,OAAD,EAAkB;IAC/B,OAAO,KAAKH,GAAL,CAASI,QAAT,CAAkBC,QAAlB,CAA2BF,OAA3B,CAAP;EACD;;EAEDG,QAAQ,GAAG;IACT,MAAMC,MAAM,GAAG,KAAKC,OAAL,EAAf;;IACA,KAAKR,GAAL,CAASM,QAAT,CAA2BC,MAA3B;EACD;;EAEDC,OAAO,GAAG;IACR;IACA,KAAKC,SAAL,GAAiBD,OAAO,CAAC,KAAKP,IAAN,CAAP,CAAmBS,OAApC;IACA,OAAO,KAAKD,SAAZ;EACD;;AAtBiB"}
package/dist/plugins.js CHANGED
@@ -2,8 +2,6 @@
2
2
 
3
3
  require("core-js/modules/es.array.flat-map.js");
4
4
 
5
- require("core-js/modules/es.array.iterator.js");
6
-
7
5
  require("core-js/modules/es.array.unscopables.flat-map.js");
8
6
 
9
7
  require("core-js/modules/es.promise.js");
@@ -60,9 +58,9 @@ class Plugins {
60
58
 
61
59
  aspect.addRuntime({
62
60
  provider: async () => {
63
- await Promise.all(plugins.map(async plugin => {
64
- await plugin.register();
65
- }));
61
+ plugins.forEach(plugin => {
62
+ plugin.register();
63
+ });
66
64
  },
67
65
  runtime,
68
66
  // dependencies: this.computeDependencies(runtime)
@@ -1 +1 @@
1
- {"version":3,"names":["Plugins","constructor","component","plugins","getByRuntime","runtime","filter","plugin","supportsRuntime","load","aspect","Aspect","create","id","toString","addRuntime","provider","Promise","all","map","register","dependencies","has","Boolean","length","from","defs","resolvePath","flatMap","pluginDef","files","pattern","filesystem","byGlob","byRegex","file","Plugin","relative","path"],"sources":["plugins.ts"],"sourcesContent":["import { Component } from '@teambit/component';\nimport { Aspect } from '@teambit/harmony';\nimport { PluginDefinition } from './plugin-definition';\nimport { Plugin } from './plugin';\n\nexport type PluginMap = { [filePath: string]: PluginDefinition };\n\nexport class Plugins {\n constructor(readonly component: Component, readonly plugins: Plugin[]) {}\n\n // computeDependencies(runtime: string): Aspect[] {\n // const inRuntime = this.getByRuntime(runtime);\n // return inRuntime.flatMap((plugin) => {\n // return plugin.def.dependencies;\n // });\n // }\n\n getByRuntime(runtime: string) {\n return this.plugins.filter((plugin) => {\n return plugin.supportsRuntime(runtime);\n });\n }\n\n load(runtime: string) {\n const plugins = this.getByRuntime(runtime);\n const aspect = Aspect.create({\n id: this.component.id.toString(),\n });\n\n aspect.addRuntime({\n provider: async () => {\n await Promise.all(plugins.map(async (plugin) => {\n await plugin.register();\n }));\n },\n runtime,\n // dependencies: this.computeDependencies(runtime)\n dependencies: [],\n });\n\n return aspect;\n }\n\n has() {\n return Boolean(this.plugins.length);\n }\n\n static from(component: Component, defs: PluginDefinition[], resolvePath?: (path: string) => string) {\n const plugins = defs.flatMap((pluginDef) => {\n const files =\n typeof pluginDef.pattern === 'string'\n ? component.filesystem.byGlob([pluginDef.pattern])\n : component.filesystem.byRegex(pluginDef.pattern);\n\n return files.map((file) => {\n return new Plugin(pluginDef, resolvePath ? resolvePath(file.relative) : file.path);\n });\n });\n\n return new Plugins(component, plugins);\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAEA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAIO,MAAMA,OAAN,CAAc;EACnBC,WAAW,CAAU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7B,SAAS,CAAC8B,UAAV,CAAqBE,OAArB,CAA6BL,SAAS,CAACE,OAAvC,CAHN;MAKA,OAAOD,KAAK,CAACX,GAAN,CAAWgB,IAAD,IAAU;QACzB,OAAO,KAAIC,gBAAJ,EAAWP,SAAX,EAAsBF,WAAW,GAAGA,WAAW,CAACQ,IAAI,CAACE,QAAN,CAAd,GAAgCF,IAAI,CAACG,IAAtE,CAAP;MACD,CAFM,CAAP;IAGD,CATe,CAAhB;IAWA,OAAO,IAAItC,OAAJ,CAAYE,SAAZ,EAAuBC,OAAvB,CAAP;EACD;;AArDkB"}
1
+ {"version":3,"names":["Plugins","constructor","component","plugins","getByRuntime","runtime","filter","plugin","supportsRuntime","load","aspect","Aspect","create","id","toString","addRuntime","provider","forEach","register","dependencies","has","Boolean","length","from","defs","resolvePath","flatMap","pluginDef","files","pattern","filesystem","byGlob","byRegex","map","file","Plugin","relative","path"],"sources":["plugins.ts"],"sourcesContent":["import { Component } from '@teambit/component';\nimport { Aspect } from '@teambit/harmony';\nimport { PluginDefinition } from './plugin-definition';\nimport { Plugin } from './plugin';\n\nexport type PluginMap = { [filePath: string]: PluginDefinition };\n\nexport class Plugins {\n constructor(readonly component: Component, readonly plugins: Plugin[]) {}\n\n // computeDependencies(runtime: string): Aspect[] {\n // const inRuntime = this.getByRuntime(runtime);\n // return inRuntime.flatMap((plugin) => {\n // return plugin.def.dependencies;\n // });\n // }\n\n getByRuntime(runtime: string) {\n return this.plugins.filter((plugin) => {\n return plugin.supportsRuntime(runtime);\n });\n }\n\n load(runtime: string) {\n const plugins = this.getByRuntime(runtime);\n const aspect = Aspect.create({\n id: this.component.id.toString(),\n });\n\n aspect.addRuntime({\n provider: async () => {\n plugins.forEach((plugin) => {\n plugin.register();\n });\n },\n runtime,\n // dependencies: this.computeDependencies(runtime)\n dependencies: [],\n });\n\n return aspect;\n }\n\n has() {\n return Boolean(this.plugins.length);\n }\n\n static from(component: Component, defs: PluginDefinition[], resolvePath?: (path: string) => string) {\n const plugins = defs.flatMap((pluginDef) => {\n const files =\n typeof pluginDef.pattern === 'string'\n ? component.filesystem.byGlob([pluginDef.pattern])\n : component.filesystem.byRegex(pluginDef.pattern);\n\n return files.map((file) => {\n return new Plugin(pluginDef, resolvePath ? resolvePath(file.relative) : file.path);\n });\n });\n\n return new Plugins(component, plugins);\n }\n}\n"],"mappings":";;;;;;;;;;;;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAEA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAIO,MAAMA,OAAN,CAAc;EACnBC,WAAW,CAAUC,SAAV,EAAyCC,OAAzC,EAA4D;IAAA,KAAlDD,SAAkD,GAAlDA,SAAkD;IAAA,KAAnBC,OAAmB,GAAnBA,OAAmB;EAAE,CADtD,CAGnB;EACA;EACA;EACA;EACA;EACA;;;EAEAC,YAAY,CAACC,OAAD,EAAkB;IAC5B,OAAO,KAAKF,OAAL,CAAaG,MAAb,CAAqBC,MAAD,IAAY;MACrC,OAAOA,MAAM,CAACC,eAAP,CAAuBH,OAAvB,CAAP;IACD,CAFM,CAAP;EAGD;;EAEDI,IAAI,CAACJ,OAAD,EAAkB;IACpB,MAAMF,OAAO,GAAG,KAAKC,YAAL,CAAkBC,OAAlB,CAAhB;;IACA,MAAMK,MAAM,GAAGC,iBAAA,CAAOC,MAAP,CAAc;MAC3BC,EAAE,EAAE,KAAKX,SAAL,CAAeW,EAAf,CAAkBC,QAAlB;IADuB,CAAd,CAAf;;IAIAJ,MAAM,CAACK,UAAP,CAAkB;MAChBC,QAAQ,EAAE,YAAY;QACpBb,OAAO,CAACc,OAAR,CAAiBV,MAAD,IAAY;UAC1BA,MAAM,CAACW,QAAP;QACD,CAFD;MAGD,CALe;MAMhBb,OANgB;MAOhB;MACAc,YAAY,EAAE;IARE,CAAlB;IAWA,OAAOT,MAAP;EACD;;EAEDU,GAAG,GAAG;IACJ,OAAOC,OAAO,CAAC,KAAKlB,OAAL,CAAamB,MAAd,CAAd;EACD;;EAEU,OAAJC,IAAI,CAACrB,SAAD,EAAuBsB,IAAvB,EAAiDC,WAAjD,EAAyF;IAClG,MAAMtB,OAAO,GAAGqB,IAAI,CAACE,OAAL,CAAcC,SAAD,IAAe;MAC1C,MAAMC,KAAK,GACT,OAAOD,SAAS,CAACE,OAAjB,KAA6B,QAA7B,GACI3B,SAAS,CAAC4B,UAAV,CAAqBC,MAArB,CAA4B,CAACJ,SAAS,CAACE,OAAX,CAA5B,CADJ,GAEI3B,SAAS,CAAC4B,UAAV,CAAqBE,OAArB,CAA6BL,SAAS,CAACE,OAAvC,CAHN;MAKA,OAAOD,KAAK,CAACK,GAAN,CAAWC,IAAD,IAAU;QACzB,OAAO,KAAIC,gBAAJ,EAAWR,SAAX,EAAsBF,WAAW,GAAGA,WAAW,CAACS,IAAI,CAACE,QAAN,CAAd,GAAgCF,IAAI,CAACG,IAAtE,CAAP;MACD,CAFM,CAAP;IAGD,CATe,CAAhB;IAWA,OAAO,IAAIrC,OAAJ,CAAYE,SAAZ,EAAuBC,OAAvB,CAAP;EACD;;AArDkB"}
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@teambit/aspect-loader",
3
- "version": "0.0.786",
3
+ "version": "0.0.789",
4
4
  "homepage": "https://bit.dev/teambit/harmony/aspect-loader",
5
5
  "main": "dist/index.js",
6
6
  "componentId": {
7
7
  "scope": "teambit.harmony",
8
8
  "name": "aspect-loader",
9
- "version": "0.0.786"
9
+ "version": "0.0.789"
10
10
  },
11
11
  "dependencies": {
12
12
  "lodash": "4.17.21",
@@ -16,15 +16,15 @@
16
16
  "core-js": "^3.0.0",
17
17
  "@teambit/harmony": "0.3.3",
18
18
  "@teambit/bvm.config": "0.0.26",
19
- "@teambit/component": "0.0.786",
20
- "@teambit/bit": "0.0.788",
21
- "@teambit/cli": "0.0.519",
19
+ "@teambit/component": "0.0.789",
20
+ "@teambit/bit": "0.0.791",
21
+ "@teambit/cli": "0.0.522",
22
22
  "@teambit/compilation.modules.babel-compiler": "0.0.124",
23
- "@teambit/envs": "0.0.786",
23
+ "@teambit/envs": "0.0.789",
24
24
  "@teambit/harmony.modules.requireable-component": "0.0.484",
25
25
  "@teambit/legacy-bit-id": "0.0.399",
26
- "@teambit/logger": "0.0.612",
27
- "@teambit/scope": "0.0.786",
26
+ "@teambit/logger": "0.0.615",
27
+ "@teambit/scope": "0.0.789",
28
28
  "@teambit/bit-error": "0.0.394"
29
29
  },
30
30
  "devDependencies": {
@@ -38,7 +38,7 @@
38
38
  "@types/node": "12.20.4"
39
39
  },
40
40
  "peerDependencies": {
41
- "@teambit/legacy": "1.0.300",
41
+ "@teambit/legacy": "1.0.304",
42
42
  "react-dom": "^16.8.0 || ^17.0.0",
43
43
  "react": "^16.8.0 || ^17.0.0"
44
44
  },
@@ -1,5 +1,5 @@
1
- import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.harmony_aspect-loader@0.0.786/dist/aspect-loader.composition.js';
2
- import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.harmony_aspect-loader@0.0.786/dist/aspect-loader.docs.mdx';
1
+ import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.harmony_aspect-loader@0.0.789/dist/aspect-loader.composition.js';
2
+ import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.harmony_aspect-loader@0.0.789/dist/aspect-loader.docs.mdx';
3
3
 
4
4
  export const compositions = [compositions_0];
5
5
  export const overview = [overview_0];