@teambit/compiler 0.0.880 → 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.
Files changed (46) hide show
  1. package/dist/compiler.aspect.js +0 -5
  2. package/dist/compiler.aspect.js.map +1 -1
  3. package/dist/compiler.cmd.js +2 -40
  4. package/dist/compiler.cmd.js.map +1 -1
  5. package/dist/compiler.composition.js +0 -6
  6. package/dist/compiler.composition.js.map +1 -1
  7. package/dist/compiler.main.runtime.js +8 -107
  8. package/dist/compiler.main.runtime.js.map +1 -1
  9. package/dist/compiler.service.js +0 -18
  10. package/dist/compiler.service.js.map +1 -1
  11. package/dist/compiler.task.js +1 -30
  12. package/dist/compiler.task.js.map +1 -1
  13. package/dist/dist-artifact.js +0 -7
  14. package/dist/dist-artifact.js.map +1 -1
  15. package/dist/events/compiler-error.js +1 -12
  16. package/dist/events/compiler-error.js.map +1 -1
  17. package/dist/events/component-compilation-on-done.js +1 -12
  18. package/dist/events/component-compilation-on-done.js.map +1 -1
  19. package/dist/events/index.js +0 -4
  20. package/dist/events/index.js.map +1 -1
  21. package/dist/exceptions/dist-artifact-not-found.js +0 -6
  22. package/dist/exceptions/dist-artifact-not-found.js.map +1 -1
  23. package/dist/exceptions/index.js +0 -3
  24. package/dist/exceptions/index.js.map +1 -1
  25. package/dist/index.js +0 -8
  26. package/dist/index.js.map +1 -1
  27. package/dist/output-formatter.js +0 -9
  28. package/dist/output-formatter.js.map +1 -1
  29. package/dist/templates/compiler/files/aspect-file.js +0 -1
  30. package/dist/templates/compiler/files/aspect-file.js.map +1 -1
  31. package/dist/templates/compiler/files/compiler-file.js +0 -1
  32. package/dist/templates/compiler/files/compiler-file.js.map +1 -1
  33. package/dist/templates/compiler/files/index-file.js +0 -1
  34. package/dist/templates/compiler/files/index-file.js.map +1 -1
  35. package/dist/templates/compiler/files/main-runtime-file.js +0 -1
  36. package/dist/templates/compiler/files/main-runtime-file.js.map +1 -1
  37. package/dist/templates/compiler/index.js +0 -13
  38. package/dist/templates/compiler/index.js.map +1 -1
  39. package/dist/types.js +0 -1
  40. package/dist/types.js.map +1 -1
  41. package/dist/workspace-compiler.js +9 -97
  42. package/dist/workspace-compiler.js.map +1 -1
  43. package/package-tar/teambit-compiler-0.0.882.tgz +0 -0
  44. package/package.json +16 -16
  45. package/{preview-1666312873430.js → preview-1666496165706.js} +2 -2
  46. package/package-tar/teambit-compiler-0.0.880.tgz +0 -0
@@ -4,21 +4,16 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.CompilerAspect = void 0;
7
-
8
7
  function _harmony() {
9
8
  const data = require("@teambit/harmony");
10
-
11
9
  _harmony = function () {
12
10
  return data;
13
11
  };
14
-
15
12
  return data;
16
13
  }
17
-
18
14
  const CompilerAspect = _harmony().Aspect.create({
19
15
  id: 'teambit.compilation/compiler'
20
16
  });
21
-
22
17
  exports.CompilerAspect = CompilerAspect;
23
18
 
24
19
  //# sourceMappingURL=compiler.aspect.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["CompilerAspect","Aspect","create","id"],"sources":["compiler.aspect.ts"],"sourcesContent":["import { Aspect } from '@teambit/harmony';\n\nexport const CompilerAspect = Aspect.create({\n id: 'teambit.compilation/compiler',\n});\n"],"mappings":";;;;;;;AAAA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAEO,MAAMA,cAAc,GAAGC,iBAAA,CAAOC,MAAP,CAAc;EAC1CC,EAAE,EAAE;AADsC,CAAd,CAAvB"}
1
+ {"version":3,"names":["CompilerAspect","Aspect","create","id"],"sources":["compiler.aspect.ts"],"sourcesContent":["import { Aspect } from '@teambit/harmony';\n\nexport const CompilerAspect = Aspect.create({\n id: 'teambit.compilation/compiler',\n});\n"],"mappings":";;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEO,MAAMA,cAAc,GAAGC,iBAAM,CAACC,MAAM,CAAC;EAC1CC,EAAE,EAAE;AACN,CAAC,CAAC;AAAC"}
@@ -1,90 +1,63 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
4
  require("core-js/modules/es.array.iterator.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.CompileCmd = void 0;
13
-
14
10
  function _defineProperty2() {
15
11
  const data = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
16
-
17
12
  _defineProperty2 = function () {
18
13
  return data;
19
14
  };
20
-
21
15
  return data;
22
16
  }
23
-
24
17
  function _chalk() {
25
18
  const data = _interopRequireDefault(require("chalk"));
26
-
27
19
  _chalk = function () {
28
20
  return data;
29
21
  };
30
-
31
22
  return data;
32
23
  }
33
-
34
24
  function _prettyTime() {
35
25
  const data = _interopRequireDefault(require("pretty-time"));
36
-
37
26
  _prettyTime = function () {
38
27
  return data;
39
28
  };
40
-
41
29
  return data;
42
30
  }
43
-
44
31
  function _outputFormatter() {
45
32
  const data = require("./output-formatter");
46
-
47
33
  _outputFormatter = function () {
48
34
  return data;
49
35
  };
50
-
51
36
  return data;
52
37
  }
53
-
54
38
  function _types() {
55
39
  const data = require("./types");
56
-
57
40
  _types = function () {
58
41
  return data;
59
42
  };
60
-
61
43
  return data;
62
44
  }
63
-
64
45
  function _compiler() {
65
46
  const data = require("./compiler.aspect");
66
-
67
47
  _compiler = function () {
68
48
  return data;
69
49
  };
70
-
71
50
  return data;
72
51
  }
73
-
74
52
  function _events() {
75
53
  const data = require("./events");
76
-
77
54
  _events = function () {
78
55
  return data;
79
56
  };
80
-
81
57
  return data;
82
58
  }
83
-
84
59
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
85
-
86
60
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2().default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
87
-
88
61
  class CompileCmd {
89
62
  constructor(compile, logger, pubsub) {
90
63
  this.compile = compile;
@@ -101,7 +74,6 @@ class CompileCmd {
101
74
  (0, _defineProperty2().default)(this, "group", 'development');
102
75
  (0, _defineProperty2().default)(this, "options", [['c', 'changed', 'compile only new and modified components'], ['v', 'verbose', 'show more data, such as, dist paths'], ['j', 'json', 'return the compile results in json format'], ['d', 'delete-dist-dir', 'delete existing dist folder before writing new compiled files']]);
103
76
  }
104
-
105
77
  async report([components = []], compilerOptions) {
106
78
  const startTimestamp = process.hrtime();
107
79
  this.logger.setStatusLine('Compiling your components, hold tight.');
@@ -122,10 +94,9 @@ class CompileCmd {
122
94
  code: this.getExitCode(this.componentsStatus)
123
95
  };
124
96
  }
125
-
126
97
  async json([components], compilerOptions) {
127
- compilerOptions.deleteDistDir = true; // @ts-ignore
128
-
98
+ compilerOptions.deleteDistDir = true;
99
+ // @ts-ignore
129
100
  const compileResults = await this.compile.compileComponents(components, _objectSpread(_objectSpread({}, compilerOptions), {}, {
130
101
  initiator: _types().CompilationInitiator.CmdJson
131
102
  }));
@@ -135,28 +106,22 @@ class CompileCmd {
135
106
  code: 0
136
107
  };
137
108
  }
138
-
139
109
  failedComponents(componentsStatus) {
140
110
  return componentsStatus.filter(component => component.errors.length);
141
111
  }
142
-
143
112
  getSummaryIcon(componentsStatus) {
144
113
  switch (this.failedComponents(componentsStatus).length) {
145
114
  case 0:
146
115
  return _chalk().default.green('✔');
147
-
148
116
  case componentsStatus.length:
149
117
  return _chalk().default.red('✗');
150
-
151
118
  default:
152
119
  return _chalk().default.yellow('⍻');
153
120
  }
154
121
  }
155
-
156
122
  getExitCode(componentsStatus) {
157
123
  return this.failedComponents(componentsStatus).length ? 1 : 0;
158
124
  }
159
-
160
125
  getStatusLine(componentsStatus, compileTimeLength) {
161
126
  const numberOfComponents = componentsStatus.length;
162
127
  const numberOfFailingComponents = this.failedComponents(componentsStatus).length;
@@ -165,15 +130,12 @@ class CompileCmd {
165
130
  const summaryLine = numberOfFailingComponents ? `${icon} ${numberOfFailingComponents}/${numberOfComponents} components failed to compile.` : `${icon} ${numberOfSuccessfulComponents}/${numberOfComponents} components compiled successfully.`;
166
131
  return `${summaryLine}\nFinished. (${(0, _prettyTime().default)(compileTimeLength)})`;
167
132
  }
168
-
169
133
  onComponentCompilationDone(event) {
170
134
  if (event.type === _events().ComponentCompilationOnDoneEvent.TYPE) {
171
135
  this.componentsStatus.push(event.data);
172
136
  }
173
137
  }
174
-
175
138
  }
176
-
177
139
  exports.CompileCmd = CompileCmd;
178
140
 
179
141
  //# sourceMappingURL=compiler.cmd.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["CompileCmd","constructor","compile","logger","pubsub","name","description","report","components","compilerOptions","startTimestamp","process","hrtime","setStatusLine","sub","CompilerAspect","id","onComponentCompilationDone","bind","outputString","compileComponents","initiator","CompilationInitiator","CmdReport","compileTimeLength","chalk","underline","formatCompileResults","componentsStatus","verbose","getStatusLine","clearStatusLine","data","code","getExitCode","json","deleteDistDir","compileResults","CmdJson","failedComponents","filter","component","errors","length","getSummaryIcon","green","red","yellow","numberOfComponents","numberOfFailingComponents","numberOfSuccessfulComponents","icon","summaryLine","prettyTime","event","type","ComponentCompilationOnDoneEvent","TYPE","push"],"sources":["compiler.cmd.ts"],"sourcesContent":["import { Command, CommandOptions } from '@teambit/cli';\nimport { Logger } from '@teambit/logger';\nimport type { PubsubMain, BitBaseEvent } from '@teambit/pubsub';\nimport chalk from 'chalk';\nimport prettyTime from 'pretty-time';\nimport { Component } from '@teambit/component';\nimport { formatCompileResults } from './output-formatter';\nimport { CompileError, WorkspaceCompiler, CompileOptions } from './workspace-compiler';\nimport { CompilationInitiator } from './types';\n\n// IDs & events\nimport { CompilerAspect } from './compiler.aspect';\nimport { ComponentCompilationOnDoneEvent } from './events';\n\nexport type ComponentsStatus = {\n buildResults: string[];\n component: Component;\n errors: CompileError[];\n};\n\nexport class CompileCmd implements Command {\n componentsStatus: ComponentsStatus[] = [];\n name = 'compile [component-names...]';\n description = 'compile components in the workspace';\n arguments = [\n {\n name: 'component-names...',\n description: 'a list of component names or component IDs (defaults to all components)',\n },\n ];\n alias = '';\n group = 'development';\n options = [\n ['c', 'changed', 'compile only new and modified components'],\n ['v', 'verbose', 'show more data, such as, dist paths'],\n ['j', 'json', 'return the compile results in json format'],\n ['d', 'delete-dist-dir', 'delete existing dist folder before writing new compiled files'],\n ] as CommandOptions;\n\n constructor(private compile: WorkspaceCompiler, private logger: Logger, private pubsub: PubsubMain) {}\n\n async report([components = []]: [string[]], compilerOptions: CompileOptions) {\n const startTimestamp = process.hrtime();\n this.logger.setStatusLine('Compiling your components, hold tight.');\n this.pubsub.sub(CompilerAspect.id, this.onComponentCompilationDone.bind(this));\n\n let outputString = '';\n await this.compile.compileComponents(components, {\n ...compilerOptions,\n initiator: CompilationInitiator.CmdReport,\n });\n const compileTimeLength = process.hrtime(startTimestamp);\n\n outputString += '\\n';\n outputString += ` ${chalk.underline('STATUS')}\\t${chalk.underline('COMPONENT ID')}\\n`;\n outputString += formatCompileResults(this.componentsStatus, !!compilerOptions.verbose);\n outputString += '\\n';\n\n outputString += this.getStatusLine(this.componentsStatus, compileTimeLength);\n\n this.logger.clearStatusLine();\n\n return {\n data: outputString,\n code: this.getExitCode(this.componentsStatus),\n };\n }\n\n async json([components]: [string[]], compilerOptions: CompileOptions) {\n compilerOptions.deleteDistDir = true;\n // @ts-ignore\n const compileResults = await this.compile.compileComponents(components, {\n ...compilerOptions,\n initiator: CompilationInitiator.CmdJson,\n });\n return {\n data: compileResults,\n // @todo: fix the code once compile is ready.\n code: 0,\n };\n }\n\n private failedComponents(componentsStatus: ComponentsStatus[]): ComponentsStatus[] {\n return componentsStatus.filter((component) => component.errors.length);\n }\n\n private getSummaryIcon(componentsStatus: ComponentsStatus[]) {\n switch (this.failedComponents(componentsStatus).length) {\n case 0:\n return chalk.green('✔');\n case componentsStatus.length:\n return chalk.red('✗');\n default:\n return chalk.yellow('⍻');\n }\n }\n\n private getExitCode(componentsStatus: ComponentsStatus[]) {\n return this.failedComponents(componentsStatus).length ? 1 : 0;\n }\n\n private getStatusLine(componentsStatus: ComponentsStatus[], compileTimeLength) {\n const numberOfComponents = componentsStatus.length;\n const numberOfFailingComponents = this.failedComponents(componentsStatus).length;\n const numberOfSuccessfulComponents = componentsStatus.filter((component) => !component.errors.length).length;\n\n const icon = this.getSummaryIcon(componentsStatus);\n const summaryLine = numberOfFailingComponents\n ? `${icon} ${numberOfFailingComponents}/${numberOfComponents} components failed to compile.`\n : `${icon} ${numberOfSuccessfulComponents}/${numberOfComponents} components compiled successfully.`;\n\n return `${summaryLine}\\nFinished. (${prettyTime(compileTimeLength)})`;\n }\n\n private onComponentCompilationDone(event: BitBaseEvent<any>) {\n if (event.type === ComponentCompilationOnDoneEvent.TYPE) {\n this.componentsStatus.push(event.data);\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAGA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAEA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAEA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAGA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;;;;;AAQO,MAAMA,UAAN,CAAoC;EAmBzCC,WAAW,CAASC,OAAT,EAA6CC,MAA7C,EAAqEC,MAArE,EAAyF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e,MAAxC,GAAiD,CAAjD,GAAqD,CAA5D;EACD;;EAEOb,aAAa,CAACF,gBAAD,EAAuCJ,iBAAvC,EAA0D;IAC7E,MAAMwB,kBAAkB,GAAGpB,gBAAgB,CAACe,MAA5C;IACA,MAAMM,yBAAyB,GAAG,KAAKV,gBAAL,CAAsBX,gBAAtB,EAAwCe,MAA1E;IACA,MAAMO,4BAA4B,GAAGtB,gBAAgB,CAACY,MAAjB,CAAyBC,SAAD,IAAe,CAACA,SAAS,CAACC,MAAV,CAAiBC,MAAzD,EAAiEA,MAAtG;IAEA,MAAMQ,IAAI,GAAG,KAAKP,cAAL,CAAoBhB,gBAApB,CAAb;IACA,MAAMwB,WAAW,GAAGH,yBAAyB,GACxC,GAAEE,IAAK,IAAGF,yBAA0B,IAAGD,kBAAmB,gCADlB,GAExC,GAAEG,IAAK,IAAGD,4BAA6B,IAAGF,kBAAmB,oCAFlE;IAIA,OAAQ,GAAEI,WAAY,gBAAe,IAAAC,qBAAA,EAAW7B,iBAAX,CAA8B,GAAnE;EACD;;EAEOP,0BAA0B,CAACqC,KAAD,EAA2B;IAC3D,IAAIA,KAAK,CAACC,IAAN,KAAeC,yCAAA,CAAgCC,IAAnD,EAAyD;MACvD,KAAK7B,gBAAL,CAAsB8B,IAAtB,CAA2BJ,KAAK,CAACtB,IAAjC;IACD;EACF;;AAlGwC"}
1
+ {"version":3,"names":["CompileCmd","constructor","compile","logger","pubsub","name","description","report","components","compilerOptions","startTimestamp","process","hrtime","setStatusLine","sub","CompilerAspect","id","onComponentCompilationDone","bind","outputString","compileComponents","initiator","CompilationInitiator","CmdReport","compileTimeLength","chalk","underline","formatCompileResults","componentsStatus","verbose","getStatusLine","clearStatusLine","data","code","getExitCode","json","deleteDistDir","compileResults","CmdJson","failedComponents","filter","component","errors","length","getSummaryIcon","green","red","yellow","numberOfComponents","numberOfFailingComponents","numberOfSuccessfulComponents","icon","summaryLine","prettyTime","event","type","ComponentCompilationOnDoneEvent","TYPE","push"],"sources":["compiler.cmd.ts"],"sourcesContent":["import { Command, CommandOptions } from '@teambit/cli';\nimport { Logger } from '@teambit/logger';\nimport type { PubsubMain, BitBaseEvent } from '@teambit/pubsub';\nimport chalk from 'chalk';\nimport prettyTime from 'pretty-time';\nimport { Component } from '@teambit/component';\nimport { formatCompileResults } from './output-formatter';\nimport { CompileError, WorkspaceCompiler, CompileOptions } from './workspace-compiler';\nimport { CompilationInitiator } from './types';\n\n// IDs & events\nimport { CompilerAspect } from './compiler.aspect';\nimport { ComponentCompilationOnDoneEvent } from './events';\n\nexport type ComponentsStatus = {\n buildResults: string[];\n component: Component;\n errors: CompileError[];\n};\n\nexport class CompileCmd implements Command {\n componentsStatus: ComponentsStatus[] = [];\n name = 'compile [component-names...]';\n description = 'compile components in the workspace';\n arguments = [\n {\n name: 'component-names...',\n description: 'a list of component names or component IDs (defaults to all components)',\n },\n ];\n alias = '';\n group = 'development';\n options = [\n ['c', 'changed', 'compile only new and modified components'],\n ['v', 'verbose', 'show more data, such as, dist paths'],\n ['j', 'json', 'return the compile results in json format'],\n ['d', 'delete-dist-dir', 'delete existing dist folder before writing new compiled files'],\n ] as CommandOptions;\n\n constructor(private compile: WorkspaceCompiler, private logger: Logger, private pubsub: PubsubMain) {}\n\n async report([components = []]: [string[]], compilerOptions: CompileOptions) {\n const startTimestamp = process.hrtime();\n this.logger.setStatusLine('Compiling your components, hold tight.');\n this.pubsub.sub(CompilerAspect.id, this.onComponentCompilationDone.bind(this));\n\n let outputString = '';\n await this.compile.compileComponents(components, {\n ...compilerOptions,\n initiator: CompilationInitiator.CmdReport,\n });\n const compileTimeLength = process.hrtime(startTimestamp);\n\n outputString += '\\n';\n outputString += ` ${chalk.underline('STATUS')}\\t${chalk.underline('COMPONENT ID')}\\n`;\n outputString += formatCompileResults(this.componentsStatus, !!compilerOptions.verbose);\n outputString += '\\n';\n\n outputString += this.getStatusLine(this.componentsStatus, compileTimeLength);\n\n this.logger.clearStatusLine();\n\n return {\n data: outputString,\n code: this.getExitCode(this.componentsStatus),\n };\n }\n\n async json([components]: [string[]], compilerOptions: CompileOptions) {\n compilerOptions.deleteDistDir = true;\n // @ts-ignore\n const compileResults = await this.compile.compileComponents(components, {\n ...compilerOptions,\n initiator: CompilationInitiator.CmdJson,\n });\n return {\n data: compileResults,\n // @todo: fix the code once compile is ready.\n code: 0,\n };\n }\n\n private failedComponents(componentsStatus: ComponentsStatus[]): ComponentsStatus[] {\n return componentsStatus.filter((component) => component.errors.length);\n }\n\n private getSummaryIcon(componentsStatus: ComponentsStatus[]) {\n switch (this.failedComponents(componentsStatus).length) {\n case 0:\n return chalk.green('✔');\n case componentsStatus.length:\n return chalk.red('✗');\n default:\n return chalk.yellow('⍻');\n }\n }\n\n private getExitCode(componentsStatus: ComponentsStatus[]) {\n return this.failedComponents(componentsStatus).length ? 1 : 0;\n }\n\n private getStatusLine(componentsStatus: ComponentsStatus[], compileTimeLength) {\n const numberOfComponents = componentsStatus.length;\n const numberOfFailingComponents = this.failedComponents(componentsStatus).length;\n const numberOfSuccessfulComponents = componentsStatus.filter((component) => !component.errors.length).length;\n\n const icon = this.getSummaryIcon(componentsStatus);\n const summaryLine = numberOfFailingComponents\n ? `${icon} ${numberOfFailingComponents}/${numberOfComponents} components failed to compile.`\n : `${icon} ${numberOfSuccessfulComponents}/${numberOfComponents} components compiled successfully.`;\n\n return `${summaryLine}\\nFinished. (${prettyTime(compileTimeLength)})`;\n }\n\n private onComponentCompilationDone(event: BitBaseEvent<any>) {\n if (event.type === ComponentCompilationOnDoneEvent.TYPE) {\n this.componentsStatus.push(event.data);\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAGA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAGA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;E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CAACsB,MAAM,CAAC,GAAG,CAAC;IAAC;EAE/B;EAEQb,WAAW,CAACN,gBAAoC,EAAE;IACxD,OAAO,IAAI,CAACW,gBAAgB,CAACX,gBAAgB,CAAC,CAACe,MAAM,GAAG,CAAC,GAAG,CAAC;EAC/D;EAEQb,aAAa,CAACF,gBAAoC,EAAEJ,iBAAiB,EAAE;IAC7E,MAAMwB,kBAAkB,GAAGpB,gBAAgB,CAACe,MAAM;IAClD,MAAMM,yBAAyB,GAAG,IAAI,CAACV,gBAAgB,CAACX,gBAAgB,CAAC,CAACe,MAAM;IAChF,MAAMO,4BAA4B,GAAGtB,gBAAgB,CAACY,MAAM,CAAEC,SAAS,IAAK,CAACA,SAAS,CAACC,MAAM,CAACC,MAAM,CAAC,CAACA,MAAM;IAE5G,MAAMQ,IAAI,GAAG,IAAI,CAACP,cAAc,CAAChB,gBAAgB,CAAC;IAClD,MAAMwB,WAAW,GAAGH,yBAAyB,GACxC,GAAEE,IAAK,IAAGF,yBAA0B,IAAGD,kBAAmB,gCAA+B,GACzF,GAAEG,IAAK,IAAGD,4BAA6B,IAAGF,kBAAmB,oCAAmC;IAErG,OAAQ,GAAEI,WAAY,gBAAe,IAAAC,qBAAU,EAAC7B,iBAAiB,CAAE,GAAE;EACvE;EAEQP,0BAA0B,CAACqC,KAAwB,EAAE;IAC3D,IAAIA,KAAK,CAACC,IAAI,KAAKC,yCAA+B,CAACC,IAAI,EAAE;MACvD,IAAI,CAAC7B,gBAAgB,CAAC8B,IAAI,CAACJ,KAAK,CAACtB,IAAI,CAAC;IACxC;EACF;AACF;AAAC"}
@@ -1,22 +1,17 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.Logo = void 0;
9
-
10
8
  function _react() {
11
9
  const data = _interopRequireDefault(require("react"));
12
-
13
10
  _react = function () {
14
11
  return data;
15
12
  };
16
-
17
13
  return data;
18
14
  }
19
-
20
15
  const Logo = () => /*#__PURE__*/_react().default.createElement("div", {
21
16
  style: {
22
17
  height: '100%',
@@ -29,7 +24,6 @@ const Logo = () => /*#__PURE__*/_react().default.createElement("div", {
29
24
  },
30
25
  src: "https://static.bit.dev/extensions-icons/compiler.svg"
31
26
  }));
32
-
33
27
  exports.Logo = Logo;
34
28
 
35
29
  //# sourceMappingURL=compiler.composition.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["Logo","height","display","justifyContent","width"],"sources":["compiler.composition.tsx"],"sourcesContent":["import React from 'react';\n\nexport const Logo = () => (\n <div style={{ height: '100%', display: 'flex', justifyContent: 'center' }}>\n <img style={{ width: 70 }} src=\"https://static.bit.dev/extensions-icons/compiler.svg\" />\n </div>\n);\n"],"mappings":";;;;;;;;;AAAA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAEO,MAAMA,IAAI,GAAG,mBAClB;EAAK,KAAK,EAAE;IAAEC,MAAM,EAAE,MAAV;IAAkBC,OAAO,EAAE,MAA3B;IAAmCC,cAAc,EAAE;EAAnD;AAAZ,gBACE;EAAK,KAAK,EAAE;IAAEC,KAAK,EAAE;EAAT,CAAZ;EAA2B,GAAG,EAAC;AAA/B,EADF,CADK"}
1
+ {"version":3,"names":["Logo","height","display","justifyContent","width"],"sources":["compiler.composition.tsx"],"sourcesContent":["import React from 'react';\n\nexport const Logo = () => (\n <div style={{ height: '100%', display: 'flex', justifyContent: 'center' }}>\n <img style={{ width: 70 }} src=\"https://static.bit.dev/extensions-icons/compiler.svg\" />\n </div>\n);\n"],"mappings":";;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEO,MAAMA,IAAI,GAAG,mBAClB;EAAK,KAAK,EAAE;IAAEC,MAAM,EAAE,MAAM;IAAEC,OAAO,EAAE,MAAM;IAAEC,cAAc,EAAE;EAAS;AAAE,gBACxE;EAAK,KAAK,EAAE;IAAEC,KAAK,EAAE;EAAG,CAAE;EAAC,GAAG,EAAC;AAAsD,EAAG,CAE3F;AAAC"}
@@ -1,270 +1,189 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
4
  require("core-js/modules/es.array.iterator.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.default = exports.CompilerMain = void 0;
13
-
14
10
  function _defineProperty2() {
15
11
  const data = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
16
-
17
12
  _defineProperty2 = function () {
18
13
  return data;
19
14
  };
20
-
21
15
  return data;
22
16
  }
23
-
24
17
  function path() {
25
18
  const data = _interopRequireWildcard(require("path"));
26
-
27
19
  path = function () {
28
20
  return data;
29
21
  };
30
-
31
22
  return data;
32
23
  }
33
-
34
24
  function _fsExtra() {
35
25
  const data = _interopRequireDefault(require("fs-extra"));
36
-
37
26
  _fsExtra = function () {
38
27
  return data;
39
28
  };
40
-
41
29
  return data;
42
30
  }
43
-
44
31
  function _aspectLoader() {
45
32
  const data = _interopRequireDefault(require("@teambit/aspect-loader"));
46
-
47
33
  _aspectLoader = function () {
48
34
  return data;
49
35
  };
50
-
51
36
  return data;
52
37
  }
53
-
54
38
  function _builder() {
55
39
  const data = require("@teambit/builder");
56
-
57
40
  _builder = function () {
58
41
  return data;
59
42
  };
60
-
61
43
  return data;
62
44
  }
63
-
64
45
  function _cli() {
65
46
  const data = require("@teambit/cli");
66
-
67
47
  _cli = function () {
68
48
  return data;
69
49
  };
70
-
71
50
  return data;
72
51
  }
73
-
74
52
  function _componentIssues() {
75
53
  const data = require("@teambit/component-issues");
76
-
77
54
  _componentIssues = function () {
78
55
  return data;
79
56
  };
80
-
81
57
  return data;
82
58
  }
83
-
84
59
  function _constants() {
85
60
  const data = require("@teambit/legacy/dist/constants");
86
-
87
61
  _constants = function () {
88
62
  return data;
89
63
  };
90
-
91
64
  return data;
92
65
  }
93
-
94
66
  function _envs() {
95
67
  const data = require("@teambit/envs");
96
-
97
68
  _envs = function () {
98
69
  return data;
99
70
  };
100
-
101
71
  return data;
102
72
  }
103
-
104
73
  function _dependencyResolver() {
105
74
  const data = require("@teambit/dependency-resolver");
106
-
107
75
  _dependencyResolver = function () {
108
76
  return data;
109
77
  };
110
-
111
78
  return data;
112
79
  }
113
-
114
80
  function _manyComponentsWriter() {
115
81
  const data = _interopRequireDefault(require("@teambit/legacy/dist/consumer/component-ops/many-components-writer"));
116
-
117
82
  _manyComponentsWriter = function () {
118
83
  return data;
119
84
  };
120
-
121
85
  return data;
122
86
  }
123
-
124
87
  function _logger() {
125
88
  const data = require("@teambit/logger");
126
-
127
89
  _logger = function () {
128
90
  return data;
129
91
  };
130
-
131
92
  return data;
132
93
  }
133
-
134
94
  function _generator() {
135
95
  const data = require("@teambit/generator");
136
-
137
96
  _generator = function () {
138
97
  return data;
139
98
  };
140
-
141
99
  return data;
142
100
  }
143
-
144
101
  function _pubsub() {
145
102
  const data = require("@teambit/pubsub");
146
-
147
103
  _pubsub = function () {
148
104
  return data;
149
105
  };
150
-
151
106
  return data;
152
107
  }
153
-
154
108
  function _ui() {
155
109
  const data = _interopRequireDefault(require("@teambit/ui"));
156
-
157
110
  _ui = function () {
158
111
  return data;
159
112
  };
160
-
161
113
  return data;
162
114
  }
163
-
164
115
  function _workspace() {
165
116
  const data = require("@teambit/workspace");
166
-
167
117
  _workspace = function () {
168
118
  return data;
169
119
  };
170
-
171
120
  return data;
172
121
  }
173
-
174
122
  function _compiler() {
175
123
  const data = require("./compiler.aspect");
176
-
177
124
  _compiler = function () {
178
125
  return data;
179
126
  };
180
-
181
127
  return data;
182
128
  }
183
-
184
129
  function _compiler2() {
185
130
  const data = require("./compiler.cmd");
186
-
187
131
  _compiler2 = function () {
188
132
  return data;
189
133
  };
190
-
191
134
  return data;
192
135
  }
193
-
194
136
  function _compiler3() {
195
137
  const data = require("./compiler.service");
196
-
197
138
  _compiler3 = function () {
198
139
  return data;
199
140
  };
200
-
201
141
  return data;
202
142
  }
203
-
204
143
  function _compiler4() {
205
144
  const data = require("./compiler.task");
206
-
207
145
  _compiler4 = function () {
208
146
  return data;
209
147
  };
210
-
211
148
  return data;
212
149
  }
213
-
214
150
  function _distArtifact() {
215
151
  const data = require("./dist-artifact");
216
-
217
152
  _distArtifact = function () {
218
153
  return data;
219
154
  };
220
-
221
155
  return data;
222
156
  }
223
-
224
157
  function _exceptions() {
225
158
  const data = require("./exceptions");
226
-
227
159
  _exceptions = function () {
228
160
  return data;
229
161
  };
230
-
231
162
  return data;
232
163
  }
233
-
234
164
  function _types() {
235
165
  const data = require("./types");
236
-
237
166
  _types = function () {
238
167
  return data;
239
168
  };
240
-
241
169
  return data;
242
170
  }
243
-
244
171
  function _workspaceCompiler() {
245
172
  const data = require("./workspace-compiler");
246
-
247
173
  _workspaceCompiler = function () {
248
174
  return data;
249
175
  };
250
-
251
176
  return data;
252
177
  }
253
-
254
178
  function _compiler5() {
255
179
  const data = require("./templates/compiler");
256
-
257
180
  _compiler5 = function () {
258
181
  return data;
259
182
  };
260
-
261
183
  return data;
262
184
  }
263
-
264
185
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
265
-
266
186
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
267
-
268
187
  class CompilerMain {
269
188
  constructor(pubsub, workspaceCompiler, envs, builder, workspace, dependencyResolver) {
270
189
  this.pubsub = pubsub;
@@ -274,12 +193,12 @@ class CompilerMain {
274
193
  this.workspace = workspace;
275
194
  this.dependencyResolver = dependencyResolver;
276
195
  }
196
+
277
197
  /**
278
198
  * Run compilation on `bit new` and when new components are imported
279
199
  */
280
-
281
-
282
- compileOnWorkspace(componentsIds = [], // when empty, it compiles all
200
+ compileOnWorkspace(componentsIds = [],
201
+ // when empty, it compiles all
283
202
  options = {
284
203
  initiator: _types().CompilationInitiator.ComponentAdded
285
204
  }) {
@@ -289,92 +208,74 @@ class CompilerMain {
289
208
  * API to create a new compiler task, it facilitates the usage of multiple compilers.
290
209
  * with this method you can create any number of compilers and add them to the buildPipeline.
291
210
  */
292
-
293
-
294
211
  createTask(name, compiler) {
295
212
  return new (_compiler4().CompilerTask)(_compiler().CompilerAspect.id, name, compiler, this.dependencyResolver);
296
213
  }
214
+
297
215
  /**
298
216
  * find the compiler configured on the workspace and ask for the dist path.
299
217
  */
300
-
301
-
302
218
  getDistPathBySrcPath(component, srcPath) {
303
219
  var _environment$getCompi;
304
-
305
220
  const environment = this.envs.getEnv(component).env;
306
221
  const compilerInstance = (_environment$getCompi = environment.getCompiler) === null || _environment$getCompi === void 0 ? void 0 : _environment$getCompi.call(environment);
307
222
  if (!compilerInstance) return null;
308
223
  return compilerInstance.getDistPathBySrcPath(srcPath);
309
224
  }
225
+
310
226
  /**
311
227
  * find the compiler configured on the workspace and ask for the dist folder path.
312
228
  */
313
-
314
-
315
229
  getRelativeDistFolder(component) {
316
230
  var _environment$getCompi2;
317
-
318
231
  const environment = this.envs.getOrCalculateEnv(component).env;
319
232
  const compilerInstance = (_environment$getCompi2 = environment.getCompiler) === null || _environment$getCompi2 === void 0 ? void 0 : _environment$getCompi2.call(environment);
320
233
  if (!compilerInstance || !compilerInstance.getDistDir) return _constants().DEFAULT_DIST_DIRNAME;
321
234
  return compilerInstance.getDistDir();
322
235
  }
236
+
323
237
  /**
324
238
  * Check if the dist folder (in the component package under node_modules) exist
325
239
  * @param component
326
240
  * @returns
327
241
  */
328
-
329
-
330
242
  isDistDirExists(component) {
331
243
  const packageDir = this.workspace.getComponentPackagePath(component);
332
244
  const distDir = this.getRelativeDistFolder(component);
333
245
  const pathToCheck = path().join(packageDir, distDir);
334
246
  return _fsExtra().default.existsSync(pathToCheck);
335
247
  }
336
-
337
248
  async getDistsFiles(component) {
338
249
  const artifacts = await this.builder.getArtifactsVinylByAspect(component, _compiler().CompilerAspect.id);
339
250
  if (!artifacts.length) throw new (_exceptions().DistArtifactNotFound)(component.id);
340
251
  return new (_distArtifact().DistArtifact)(artifacts);
341
252
  }
342
-
343
253
  async addMissingDistsIssue(component) {
344
254
  const exist = this.isDistDirExists(component);
345
-
346
255
  if (!exist) {
347
256
  component.state.issues.getOrCreate(_componentIssues().IssuesClasses.MissingDists).data = true;
348
- } // we don't want to add any data to the compiler aspect, only to add issues on the component
349
-
350
-
257
+ }
258
+ // we don't want to add any data to the compiler aspect, only to add issues on the component
351
259
  return undefined;
352
260
  }
353
-
354
261
  static async provider([cli, workspace, envs, loggerMain, pubsub, aspectLoader, builder, ui, generator, dependencyResolver]) {
355
262
  const logger = loggerMain.createLogger(_compiler().CompilerAspect.id);
356
263
  const workspaceCompiler = new (_workspaceCompiler().WorkspaceCompiler)(workspace, envs, pubsub, aspectLoader, ui, logger, dependencyResolver);
357
264
  envs.registerService(new (_compiler3().CompilerService)());
358
265
  const compilerMain = new CompilerMain(pubsub, workspaceCompiler, envs, builder, workspace, dependencyResolver);
359
266
  cli.register(new (_compiler2().CompileCmd)(workspaceCompiler, logger, pubsub));
360
-
361
267
  if (workspace) {
362
268
  workspace.onComponentLoad(compilerMain.addMissingDistsIssue.bind(compilerMain));
363
269
  }
364
-
365
270
  generator.registerComponentTemplate([_compiler5().compilerTemplate]);
366
271
  _manyComponentsWriter().default.externalCompiler = compilerMain.compileOnWorkspace.bind(compilerMain);
367
272
  return compilerMain;
368
273
  }
369
-
370
274
  }
371
-
372
275
  exports.CompilerMain = CompilerMain;
373
276
  (0, _defineProperty2().default)(CompilerMain, "runtime", _cli().MainRuntime);
374
277
  (0, _defineProperty2().default)(CompilerMain, "dependencies", [_cli().CLIAspect, _workspace().WorkspaceAspect, _envs().EnvsAspect, _logger().LoggerAspect, _pubsub().PubsubAspect, _aspectLoader().default, _builder().BuilderAspect, _ui().default, _generator().GeneratorAspect, _dependencyResolver().DependencyResolverAspect]);
375
-
376
278
  _compiler().CompilerAspect.addRuntime(CompilerMain);
377
-
378
279
  var _default = CompilerMain;
379
280
  exports.default = _default;
380
281