@teambit/aspect-loader 0.0.881 → 0.0.882

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/dist/plugins.js CHANGED
@@ -1,61 +1,49 @@
1
1
  "use strict";
2
2
 
3
3
  require("core-js/modules/es.array.flat-map.js");
4
-
5
4
  require("core-js/modules/es.array.unscopables.flat-map.js");
6
-
7
5
  require("core-js/modules/es.promise.js");
8
-
9
6
  Object.defineProperty(exports, "__esModule", {
10
7
  value: true
11
8
  });
12
9
  exports.Plugins = void 0;
13
-
14
10
  function _harmony() {
15
11
  const data = require("@teambit/harmony");
16
-
17
12
  _harmony = function () {
18
13
  return data;
19
14
  };
20
-
21
15
  return data;
22
16
  }
23
-
24
17
  function _plugin() {
25
18
  const data = require("./plugin");
26
-
27
19
  _plugin = function () {
28
20
  return data;
29
21
  };
30
-
31
22
  return data;
32
23
  }
33
-
34
24
  class Plugins {
35
25
  constructor(component, plugins) {
36
26
  this.component = component;
37
27
  this.plugins = plugins;
38
- } // computeDependencies(runtime: string): Aspect[] {
28
+ }
29
+
30
+ // computeDependencies(runtime: string): Aspect[] {
39
31
  // const inRuntime = this.getByRuntime(runtime);
40
32
  // return inRuntime.flatMap((plugin) => {
41
33
  // return plugin.def.dependencies;
42
34
  // });
43
35
  // }
44
36
 
45
-
46
37
  getByRuntime(runtime) {
47
38
  return this.plugins.filter(plugin => {
48
39
  return plugin.supportsRuntime(runtime);
49
40
  });
50
41
  }
51
-
52
42
  async load(runtime) {
53
43
  const plugins = this.getByRuntime(runtime);
54
-
55
44
  const aspect = _harmony().Aspect.create({
56
45
  id: this.component.id.toString()
57
46
  });
58
-
59
47
  aspect.addRuntime({
60
48
  provider: async () => {
61
49
  plugins.forEach(plugin => {
@@ -68,11 +56,9 @@ class Plugins {
68
56
  });
69
57
  return aspect;
70
58
  }
71
-
72
59
  has() {
73
60
  return Boolean(this.plugins.length);
74
61
  }
75
-
76
62
  static from(component, defs, resolvePath) {
77
63
  const plugins = defs.flatMap(pluginDef => {
78
64
  const files = typeof pluginDef.pattern === 'string' ? component.filesystem.byGlob([pluginDef.pattern]) : component.filesystem.byRegex(pluginDef.pattern);
@@ -82,9 +68,7 @@ class Plugins {
82
68
  });
83
69
  return new Plugins(component, plugins);
84
70
  }
85
-
86
71
  }
87
-
88
72
  exports.Plugins = Plugins;
89
73
 
90
74
  //# sourceMappingURL=plugins.js.map
@@ -1 +1 @@
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 async 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(aspect);\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;;EAES,MAAJI,IAAI,CAACJ,OAAD,EAAkB;IAC1B,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,CAAgBR,MAAhB;QACD,CAFD;MAGD,CALe;MAMhBL,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"}
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 async 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(aspect);\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,OAAO,CAAC;EACnBC,WAAW,CAAUC,SAAoB,EAAWC,OAAiB,EAAE;IAAA,KAAlDD,SAAoB,GAApBA,SAAoB;IAAA,KAAWC,OAAiB,GAAjBA,OAAiB;EAAG;;EAExE;EACA;EACA;EACA;EACA;EACA;;EAEAC,YAAY,CAACC,OAAe,EAAE;IAC5B,OAAO,IAAI,CAACF,OAAO,CAACG,MAAM,CAAEC,MAAM,IAAK;MACrC,OAAOA,MAAM,CAACC,eAAe,CAACH,OAAO,CAAC;IACxC,CAAC,CAAC;EACJ;EAEA,MAAMI,IAAI,CAACJ,OAAe,EAAE;IAC1B,MAAMF,OAAO,GAAG,IAAI,CAACC,YAAY,CAACC,OAAO,CAAC;IAC1C,MAAMK,MAAM,GAAGC,iBAAM,CAACC,MAAM,CAAC;MAC3BC,EAAE,EAAE,IAAI,CAACX,SAAS,CAACW,EAAE,CAACC,QAAQ;IAChC,CAAC,CAAC;IAEFJ,MAAM,CAACK,UAAU,CAAC;MAChBC,QAAQ,EAAE,YAAY;QACpBb,OAAO,CAACc,OAAO,CAAEV,MAAM,IAAK;UAC1BA,MAAM,CAACW,QAAQ,CAACR,MAAM,CAAC;QACzB,CAAC,CAAC;MACJ,CAAC;MACDL,OAAO;MACP;MACAc,YAAY,EAAE;IAChB,CAAC,CAAC;IAEF,OAAOT,MAAM;EACf;EAEAU,GAAG,GAAG;IACJ,OAAOC,OAAO,CAAC,IAAI,CAAClB,OAAO,CAACmB,MAAM,CAAC;EACrC;EAEA,OAAOC,IAAI,CAACrB,SAAoB,EAAEsB,IAAwB,EAAEC,WAAsC,EAAE;IAClG,MAAMtB,OAAO,GAAGqB,IAAI,CAACE,OAAO,CAAEC,SAAS,IAAK;MAC1C,MAAMC,KAAK,GACT,OAAOD,SAAS,CAACE,OAAO,KAAK,QAAQ,GACjC3B,SAAS,CAAC4B,UAAU,CAACC,MAAM,CAAC,CAACJ,SAAS,CAACE,OAAO,CAAC,CAAC,GAChD3B,SAAS,CAAC4B,UAAU,CAACE,OAAO,CAACL,SAAS,CAACE,OAAO,CAAC;MAErD,OAAOD,KAAK,CAACK,GAAG,CAAEC,IAAI,IAAK;QACzB,OAAO,KAAIC,gBAAM,EAACR,SAAS,EAAEF,WAAW,GAAGA,WAAW,CAACS,IAAI,CAACE,QAAQ,CAAC,GAAGF,IAAI,CAACG,IAAI,CAAC;MACpF,CAAC,CAAC;IACJ,CAAC,CAAC;IAEF,OAAO,IAAIrC,OAAO,CAACE,SAAS,EAAEC,OAAO,CAAC;EACxC;AACF;AAAC"}
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@teambit/aspect-loader",
3
- "version": "0.0.881",
3
+ "version": "0.0.882",
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.881"
9
+ "version": "0.0.882"
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.881",
20
- "@teambit/bit": "0.0.883",
19
+ "@teambit/component": "0.0.882",
20
+ "@teambit/bit": "0.0.884",
21
21
  "@teambit/cli": "0.0.591",
22
22
  "@teambit/compilation.modules.babel-compiler": "0.0.130",
23
- "@teambit/envs": "0.0.881",
23
+ "@teambit/envs": "0.0.882",
24
24
  "@teambit/harmony.modules.requireable-component": "0.0.490",
25
25
  "@teambit/legacy-bit-id": "0.0.414",
26
26
  "@teambit/logger": "0.0.684",
27
- "@teambit/scope": "0.0.881",
27
+ "@teambit/scope": "0.0.882",
28
28
  "@teambit/bit-error": "0.0.400"
29
29
  },
30
30
  "devDependencies": {
@@ -1,5 +1,5 @@
1
- import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.harmony_aspect-loader@0.0.881/dist/aspect-loader.composition.js';
2
- import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.harmony_aspect-loader@0.0.881/dist/aspect-loader.docs.mdx';
1
+ import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.harmony_aspect-loader@0.0.882/dist/aspect-loader.composition.js';
2
+ import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.harmony_aspect-loader@0.0.882/dist/aspect-loader.docs.mdx';
3
3
 
4
4
  export const compositions = [compositions_0];
5
5
  export const overview = [overview_0];