@teambit/builder 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.
Files changed (74) hide show
  1. package/dist/artifact/artifact-extractor.js +6 -47
  2. package/dist/artifact/artifact-extractor.js.map +1 -1
  3. package/dist/artifact/artifact-factory.js +1 -52
  4. package/dist/artifact/artifact-factory.js.map +1 -1
  5. package/dist/artifact/artifact-list.js +6 -43
  6. package/dist/artifact/artifact-list.js.map +1 -1
  7. package/dist/artifact/artifact.js +4 -20
  8. package/dist/artifact/artifact.js.map +1 -1
  9. package/dist/artifact/artifacts.cmd.js +0 -29
  10. package/dist/artifact/artifacts.cmd.js.map +1 -1
  11. package/dist/artifact/extension-artifact.js +0 -4
  12. package/dist/artifact/extension-artifact.js.map +1 -1
  13. package/dist/artifact/fs-artifact.js +0 -6
  14. package/dist/artifact/fs-artifact.js.map +1 -1
  15. package/dist/artifact/index.js +0 -18
  16. package/dist/artifact/index.js.map +1 -1
  17. package/dist/build-pipe.js +2 -44
  18. package/dist/build-pipe.js.map +1 -1
  19. package/dist/build-pipeline-order.js +7 -44
  20. package/dist/build-pipeline-order.js.map +1 -1
  21. package/dist/build-pipeline-result-list.js +2 -35
  22. package/dist/build-pipeline-result-list.js.map +1 -1
  23. package/dist/build-task.js +1 -9
  24. package/dist/build-task.js.map +1 -1
  25. package/dist/build.cmd.js +0 -27
  26. package/dist/build.cmd.js.map +1 -1
  27. package/dist/builder.aspect.js +0 -5
  28. package/dist/builder.aspect.js.map +1 -1
  29. package/dist/builder.composition.js +0 -6
  30. package/dist/builder.composition.js.map +1 -1
  31. package/dist/builder.graphql.js +0 -19
  32. package/dist/builder.graphql.js.map +1 -1
  33. package/dist/builder.main.runtime.js +8 -137
  34. package/dist/builder.main.runtime.js.map +1 -1
  35. package/dist/builder.route.js +3 -27
  36. package/dist/builder.route.js.map +1 -1
  37. package/dist/builder.service.js +1 -37
  38. package/dist/builder.service.js.map +1 -1
  39. package/dist/exceptions/artifact-definition-no-glob.js +0 -3
  40. package/dist/exceptions/artifact-definition-no-glob.js.map +1 -1
  41. package/dist/exceptions/artifact-storage-error.js +0 -3
  42. package/dist/exceptions/artifact-storage-error.js.map +1 -1
  43. package/dist/exceptions/capsule-not-found.js +0 -3
  44. package/dist/exceptions/capsule-not-found.js.map +1 -1
  45. package/dist/exceptions/index.js +0 -9
  46. package/dist/exceptions/index.js.map +1 -1
  47. package/dist/exceptions/invalid-task.js +0 -6
  48. package/dist/exceptions/invalid-task.js.map +1 -1
  49. package/dist/index.js +0 -24
  50. package/dist/index.js.map +1 -1
  51. package/dist/pipeline/index.js +0 -3
  52. package/dist/pipeline/index.js.map +1 -1
  53. package/dist/pipeline/pipeline-results.js +0 -2
  54. package/dist/pipeline/pipeline-results.js.map +1 -1
  55. package/dist/storage/default-resolver.js +0 -9
  56. package/dist/storage/default-resolver.js.map +1 -1
  57. package/dist/storage/index.js +0 -6
  58. package/dist/storage/index.js.map +1 -1
  59. package/dist/storage/s3-resolver.js +4 -0
  60. package/dist/storage/s3-resolver.js.map +1 -1
  61. package/dist/task-results-list.js +1 -23
  62. package/dist/task-results-list.js.map +1 -1
  63. package/dist/tasks-queue.js +0 -14
  64. package/dist/tasks-queue.js.map +1 -1
  65. package/dist/templates/build-task/files/index-file.js +0 -1
  66. package/dist/templates/build-task/files/index-file.js.map +1 -1
  67. package/dist/templates/build-task/files/task-file.js +0 -1
  68. package/dist/templates/build-task/files/task-file.js.map +1 -1
  69. package/dist/templates/build-task/index.js +0 -7
  70. package/dist/templates/build-task/index.js.map +1 -1
  71. package/package-tar/teambit-builder-0.0.882.tgz +0 -0
  72. package/package.json +11 -11
  73. package/{preview-1666409808293.js → preview-1666496165706.js} +2 -2
  74. package/package-tar/teambit-builder-0.0.881.tgz +0 -0
@@ -1 +1 @@
1
- {"version":3,"names":["builderSchema","builder","typeDefs","gql","resolvers","Component","pipelineReport","component","taskId","builderData","getBuilderData","pipeline","artifacts","getArtifactsByAspect","getArtifacts","artifactsWithVinyl","Promise","all","map","artifact","id","task","aspectId","name","artifactFiles","getArtifactsVinylByAspectAndTaskName","vinyl","basename","path","contents","isBinary","isBinaryPath","content","toString","undefined","downloadUrl","encodeURI","getDownloadUrlForArtifact","externalUrl","url","artifactObj","files","result","find","data","taskName","TaskReport","taskReport","description","taskDescription","errors","e","warnings","pathFilter","filter","file"],"sources":["builder.graphql.ts"],"sourcesContent":["import { Component, ComponentID } from '@teambit/component';\nimport gql from 'graphql-tag';\nimport isBinaryPath from 'is-binary-path';\nimport { BuilderMain } from './builder.main.runtime';\nimport { PipelineReport } from './build-pipeline-result-list';\n\ntype ArtifactGQLFile = {\n /**\n * same as the path - used for GQL caching\n */\n id: string;\n /**\n * name of the artifact file\n */\n name: string;\n /**\n * path of the artifact file\n */\n path: string;\n /**\n * artifact file content (only for text files). Use /api/<component-id>/~aspect/builder/<extension-id>/~<path> to fetch binary file data\n */\n content?: string;\n /**\n * REST endpoint to fetch artifact data from. /api/<component-id>/~aspect/builder/<extension-id>/~<pat\n */\n downloadUrl?: string;\n /**\n * Remote storage url to resolve artifact file from\n */\n externalUrl?: string;\n};\n\ntype ArtifactGQLData = {\n name: string;\n description?: string;\n storage?: string;\n generatedBy: string;\n files: ArtifactGQLFile[];\n};\ntype TaskReport = PipelineReport & {\n artifact?: ArtifactGQLData;\n componentId: ComponentID;\n};\n\nexport function builderSchema(builder: BuilderMain) {\n return {\n typeDefs: gql`\n type TaskReport {\n # for GQL caching - taskId + taskName\n id: String!\n taskId: String!\n taskName: String!\n description: String\n startTime: String\n endTime: String\n errors: [String!]\n warnings: [String!]\n artifact(path: String): Artifact\n }\n\n type ArtifactFile {\n # for GQL caching - same as the path\n id: String!\n # name of the artifact file\n name: String\n # path of the artifact file\n path: String!\n # artifact file content (only for text files). Use /api/<component-id>/~aspect/builder/<extension-id>/~<path> to fetch binary file data\n content: String\n # REST endpoint to fetch artifact data from. /api/<component-id>/~aspect/builder/<extension-id>/~<pat\n downloadUrl: String\n # Remote storage url to resolve artifact file from\n externalUrl: String\n }\n\n type Artifact {\n # for GQL caching - PipelineId + Artifact Name\n id: String!\n # artifact name\n name: String!\n description: String\n storage: String\n generatedBy: String\n files: [ArtifactFile!]!\n }\n\n extend type Component {\n pipelineReport(taskId: String): [TaskReport!]!\n }\n `,\n\n resolvers: {\n Component: {\n pipelineReport: async (component: Component, { taskId }: { taskId?: string }) => {\n const builderData = builder.getBuilderData(component);\n const pipeline = builderData?.pipeline || [];\n const artifacts = taskId ? builder.getArtifactsByAspect(component, taskId) : builder.getArtifacts(component);\n\n const artifactsWithVinyl = await Promise.all(\n artifacts.map(async (artifact) => {\n const id = artifact.task.aspectId;\n const name = artifact.task.name as string;\n const artifactFiles = (await builder.getArtifactsVinylByAspectAndTaskName(component, id, name)).map(\n (vinyl) => {\n const { basename, path, contents } = vinyl || {};\n const isBinary = path && isBinaryPath(path);\n const content = !isBinary ? contents?.toString('utf-8') : undefined;\n const downloadUrl = encodeURI(\n builder.getDownloadUrlForArtifact(component.id, artifact.task.aspectId, path)\n );\n const externalUrl = vinyl.url;\n return { id: path, name: basename, path, content, downloadUrl, externalUrl };\n }\n );\n const artifactObj = { ...artifact, files: artifactFiles };\n return artifactObj;\n })\n );\n\n const result = pipeline.map((task) => ({\n ...task,\n artifact: artifactsWithVinyl.find(\n (data) => data.task.aspectId === task.taskId && data.task.name === task.taskName\n ),\n }));\n\n return result;\n },\n },\n TaskReport: {\n id: (taskReport: TaskReport) => `${taskReport.taskId}-${taskReport.taskName}`,\n description: (taskReport: TaskReport) => taskReport.taskDescription,\n errors: (taskReport: TaskReport) => taskReport.errors?.map((e) => e.toString()) || [],\n warnings: (taskReport: TaskReport) => taskReport.warnings || [],\n artifact: async (taskReport: TaskReport, { path: pathFilter }: { path?: string }) => {\n if (!taskReport.artifact) return undefined;\n return {\n id: `${taskReport.taskId}-${taskReport.taskName}-${taskReport.artifact?.name}`,\n ...taskReport.artifact,\n files: taskReport.artifact.files.filter((file) => !pathFilter || file.path === pathFilter),\n };\n },\n },\n },\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;;;;;AA2CO,SAASA,aAAT,CAAuBC,OAAvB,EAA6C;EAClD,OAAO;IACLC,QAAQ,EAAE,IAAAC,qBAAA,CAAI;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KA5CS;IA8CLC,SAAS,EAAE;MACTC,SAAS,EAAE;QACTC,cAAc,EAAE,OAAOC,SAAP,EAA6B;UAAEC;QAAF,CAA7B,KAAiE;UAC/E,MAAMC,WAAW,GAAGR,OAAO,CAACS,cAAR,CAAuBH,SAAvB,CAApB;UACA,MAAMI,QAAQ,GAAG,CAAAF,WAAW,SAAX,IAAAA,WAAW,WAAX,YAAAA,WAAW,CAAEE,QAAb,KAAyB,EAA1C;UACA,MAAMC,SAAS,GAAGJ,MAAM,GAAGP,OAAO,CAACY,oBAAR,CAA6BN,SAA7B,EAAwCC,MAAxC,CAAH,GAAqDP,OAAO,CAACa,YAAR,CAAqBP,SAArB,CAA7E;UAEA,MAAMQ,kBAAkB,GAAG,MAAMC,OAAO,CAACC,GAAR,CAC/BL,SAAS,CAACM,GAAV,CAAc,MAAOC,QAAP,IAAoB;YAChC,MAAMC,EAAE,GAAGD,QAAQ,CAACE,IAAT,CAAcC,QAAzB;YACA,MAAMC,IAAI,GAAGJ,QAAQ,CAACE,IAAT,CAAcE,IAA3B;YACA,MAAMC,aAAa,GAAG,CAAC,MAAMvB,OAAO,CAACwB,oCAAR,CAA6ClB,SAA7C,EAAwDa,EAAxD,EAA4D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AACvC,MAAO,IAAGuC,UAAU,CAACF,QAAS,EADlE;QAEVG,WAAW,EAAGD,UAAD,IAA4BA,UAAU,CAACE,eAF1C;QAGVC,MAAM,EAAGH,UAAD;UAAA;;UAAA,OAA4B,uBAAAA,UAAU,CAACG,MAAX,0EAAmBhC,GAAnB,CAAwBiC,CAAD,IAAOA,CAAC,CAAClB,QAAF,EAA9B,MAA+C,EAA3E;QAAA,CAHE;QAIVmB,QAAQ,EAAGL,UAAD,IAA4BA,UAAU,CAACK,QAAX,IAAuB,EAJnD;QAKVjC,QAAQ,EAAE,OAAO4B,UAAP,EAA+B;UAAEnB,IAAI,EAAEyB;QAAR,CAA/B,KAA2E;UAAA;;UACnF,IAAI,CAACN,UAAU,CAAC5B,QAAhB,EAA0B,OAAOe,SAAP;UAC1B;YACEd,EAAE,EAAG,GAAE2B,UAAU,CAACvC,MAAO,IAAGuC,UAAU,CAACF,QAAS,IAA5C,wBAA+CE,UAAU,CAAC5B,QAA1D,yDAA+C,qBAAqBI,IAAK;UAD/E,GAEKwB,UAAU,CAAC5B,QAFhB;YAGEsB,KAAK,EAAEM,UAAU,CAAC5B,QAAX,CAAoBsB,KAApB,CAA0Ba,MAA1B,CAAkCC,IAAD,IAAU,CAACF,UAAD,IAAeE,IAAI,CAAC3B,IAAL,KAAcyB,UAAxE;UAHT;QAKD;MAZS;IAtCH;EA9CN,CAAP;AAoGD"}
1
+ {"version":3,"names":["builderSchema","builder","typeDefs","gql","resolvers","Component","pipelineReport","component","taskId","builderData","getBuilderData","pipeline","artifacts","getArtifactsByAspect","getArtifacts","artifactsWithVinyl","Promise","all","map","artifact","id","task","aspectId","name","artifactFiles","getArtifactsVinylByAspectAndTaskName","vinyl","basename","path","contents","isBinary","isBinaryPath","content","toString","undefined","downloadUrl","encodeURI","getDownloadUrlForArtifact","externalUrl","url","artifactObj","files","result","find","data","taskName","TaskReport","taskReport","description","taskDescription","errors","e","warnings","pathFilter","filter","file"],"sources":["builder.graphql.ts"],"sourcesContent":["import { Component, ComponentID } from '@teambit/component';\nimport gql from 'graphql-tag';\nimport isBinaryPath from 'is-binary-path';\nimport { BuilderMain } from './builder.main.runtime';\nimport { PipelineReport } from './build-pipeline-result-list';\n\ntype ArtifactGQLFile = {\n /**\n * same as the path - used for GQL caching\n */\n id: string;\n /**\n * name of the artifact file\n */\n name: string;\n /**\n * path of the artifact file\n */\n path: string;\n /**\n * artifact file content (only for text files). Use /api/<component-id>/~aspect/builder/<extension-id>/~<path> to fetch binary file data\n */\n content?: string;\n /**\n * REST endpoint to fetch artifact data from. /api/<component-id>/~aspect/builder/<extension-id>/~<pat\n */\n downloadUrl?: string;\n /**\n * Remote storage url to resolve artifact file from\n */\n externalUrl?: string;\n};\n\ntype ArtifactGQLData = {\n name: string;\n description?: string;\n storage?: string;\n generatedBy: string;\n files: ArtifactGQLFile[];\n};\ntype TaskReport = PipelineReport & {\n artifact?: ArtifactGQLData;\n componentId: ComponentID;\n};\n\nexport function builderSchema(builder: BuilderMain) {\n return {\n typeDefs: gql`\n type TaskReport {\n # for GQL caching - taskId + taskName\n id: String!\n taskId: String!\n taskName: String!\n description: String\n startTime: String\n endTime: String\n errors: [String!]\n warnings: [String!]\n artifact(path: String): Artifact\n }\n\n type ArtifactFile {\n # for GQL caching - same as the path\n id: String!\n # name of the artifact file\n name: String\n # path of the artifact file\n path: String!\n # artifact file content (only for text files). Use /api/<component-id>/~aspect/builder/<extension-id>/~<path> to fetch binary file data\n content: String\n # REST endpoint to fetch artifact data from. /api/<component-id>/~aspect/builder/<extension-id>/~<pat\n downloadUrl: String\n # Remote storage url to resolve artifact file from\n externalUrl: String\n }\n\n type Artifact {\n # for GQL caching - PipelineId + Artifact Name\n id: String!\n # artifact name\n name: String!\n description: String\n storage: String\n generatedBy: String\n files: [ArtifactFile!]!\n }\n\n extend type Component {\n pipelineReport(taskId: String): [TaskReport!]!\n }\n `,\n\n resolvers: {\n Component: {\n pipelineReport: async (component: Component, { taskId }: { taskId?: string }) => {\n const builderData = builder.getBuilderData(component);\n const pipeline = builderData?.pipeline || [];\n const artifacts = taskId ? builder.getArtifactsByAspect(component, taskId) : builder.getArtifacts(component);\n\n const artifactsWithVinyl = await Promise.all(\n artifacts.map(async (artifact) => {\n const id = artifact.task.aspectId;\n const name = artifact.task.name as string;\n const artifactFiles = (await builder.getArtifactsVinylByAspectAndTaskName(component, id, name)).map(\n (vinyl) => {\n const { basename, path, contents } = vinyl || {};\n const isBinary = path && isBinaryPath(path);\n const content = !isBinary ? contents?.toString('utf-8') : undefined;\n const downloadUrl = encodeURI(\n builder.getDownloadUrlForArtifact(component.id, artifact.task.aspectId, path)\n );\n const externalUrl = vinyl.url;\n return { id: path, name: basename, path, content, downloadUrl, externalUrl };\n }\n );\n const artifactObj = { ...artifact, files: artifactFiles };\n return artifactObj;\n })\n );\n\n const result = pipeline.map((task) => ({\n ...task,\n artifact: artifactsWithVinyl.find(\n (data) => data.task.aspectId === task.taskId && data.task.name === task.taskName\n ),\n }));\n\n return result;\n },\n },\n TaskReport: {\n id: (taskReport: TaskReport) => `${taskReport.taskId}-${taskReport.taskName}`,\n description: (taskReport: TaskReport) => taskReport.taskDescription,\n errors: (taskReport: TaskReport) => taskReport.errors?.map((e) => e.toString()) || [],\n warnings: (taskReport: TaskReport) => taskReport.warnings || [],\n artifact: async (taskReport: TaskReport, { path: pathFilter }: { path?: string }) => {\n if (!taskReport.artifact) return undefined;\n return {\n id: `${taskReport.taskId}-${taskReport.taskName}-${taskReport.artifact?.name}`,\n ...taskReport.artifact,\n files: taskReport.artifact.files.filter((file) => !pathFilter || file.path === pathFilter),\n };\n },\n },\n },\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAA0C;AAAA;AA2CnC,SAASA,aAAa,CAACC,OAAoB,EAAE;EAClD,OAAO;IACLC,QAAQ,EAAE,IAAAC,qBAAG,CAAC;AAClB;AAC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,EAAE,OAAO4B,UAAsB,EAAE;UAAEnB,IAAI,EAAEyB;QAA8B,CAAC,KAAK;UAAA;UACnF,IAAI,CAACN,UAAU,CAAC5B,QAAQ,EAAE,OAAOe,SAAS;UAC1C;YACEd,EAAE,EAAG,GAAE2B,UAAU,CAACvC,MAAO,IAAGuC,UAAU,CAACF,QAAS,IAAC,wBAAEE,UAAU,CAAC5B,QAAQ,yDAAnB,qBAAqBI,IAAK;UAAC,GAC3EwB,UAAU,CAAC5B,QAAQ;YACtBsB,KAAK,EAAEM,UAAU,CAAC5B,QAAQ,CAACsB,KAAK,CAACa,MAAM,CAAEC,IAAI,IAAK,CAACF,UAAU,IAAIE,IAAI,CAAC3B,IAAI,KAAKyB,UAAU;UAAC;QAE9F;MACF;IACF;EACF,CAAC;AACH"}
@@ -1,311 +1,218 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
4
  require("core-js/modules/es.array.flat-map.js");
6
-
7
5
  require("core-js/modules/es.array.iterator.js");
8
-
9
6
  require("core-js/modules/es.array.unscopables.flat-map.js");
10
-
11
7
  require("core-js/modules/es.promise.js");
12
-
13
8
  Object.defineProperty(exports, "__esModule", {
14
9
  value: true
15
10
  });
16
11
  exports.FILE_PATH_PARAM_DELIM = exports.BuilderMain = void 0;
17
-
18
12
  function _defineProperty2() {
19
13
  const data = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
20
-
21
14
  _defineProperty2 = function () {
22
15
  return data;
23
16
  };
24
-
25
17
  return data;
26
18
  }
27
-
28
19
  function _lodash() {
29
20
  const data = require("lodash");
30
-
31
21
  _lodash = function () {
32
22
  return data;
33
23
  };
34
-
35
24
  return data;
36
25
  }
37
-
38
26
  function _artifactFiles() {
39
27
  const data = require("@teambit/legacy/dist/consumer/component/sources/artifact-files");
40
-
41
28
  _artifactFiles = function () {
42
29
  return data;
43
30
  };
44
-
45
31
  return data;
46
32
  }
47
-
48
33
  function _aspectLoader() {
49
34
  const data = require("@teambit/aspect-loader");
50
-
51
35
  _aspectLoader = function () {
52
36
  return data;
53
37
  };
54
-
55
38
  return data;
56
39
  }
57
-
58
40
  function _cli() {
59
41
  const data = require("@teambit/cli");
60
-
61
42
  _cli = function () {
62
43
  return data;
63
44
  };
64
-
65
45
  return data;
66
46
  }
67
-
68
47
  function _component() {
69
48
  const data = require("@teambit/component");
70
-
71
49
  _component = function () {
72
50
  return data;
73
51
  };
74
-
75
52
  return data;
76
53
  }
77
-
78
54
  function _envs() {
79
55
  const data = require("@teambit/envs");
80
-
81
56
  _envs = function () {
82
57
  return data;
83
58
  };
84
-
85
59
  return data;
86
60
  }
87
-
88
61
  function _graphql() {
89
62
  const data = require("@teambit/graphql");
90
-
91
63
  _graphql = function () {
92
64
  return data;
93
65
  };
94
-
95
66
  return data;
96
67
  }
97
-
98
68
  function _harmony() {
99
69
  const data = require("@teambit/harmony");
100
-
101
70
  _harmony = function () {
102
71
  return data;
103
72
  };
104
-
105
73
  return data;
106
74
  }
107
-
108
75
  function _logger() {
109
76
  const data = require("@teambit/logger");
110
-
111
77
  _logger = function () {
112
78
  return data;
113
79
  };
114
-
115
80
  return data;
116
81
  }
117
-
118
82
  function _scope() {
119
83
  const data = require("@teambit/scope");
120
-
121
84
  _scope = function () {
122
85
  return data;
123
86
  };
124
-
125
87
  return data;
126
88
  }
127
-
128
89
  function _workspace() {
129
90
  const data = require("@teambit/workspace");
130
-
131
91
  _workspace = function () {
132
92
  return data;
133
93
  };
134
-
135
94
  return data;
136
95
  }
137
-
138
96
  function _isolator() {
139
97
  const data = require("@teambit/isolator");
140
-
141
98
  _isolator = function () {
142
99
  return data;
143
100
  };
144
-
145
101
  return data;
146
102
  }
147
-
148
103
  function _bootstrap() {
149
104
  const data = require("@teambit/legacy/dist/bootstrap");
150
-
151
105
  _bootstrap = function () {
152
106
  return data;
153
107
  };
154
-
155
108
  return data;
156
109
  }
157
-
158
110
  function _findDuplications() {
159
111
  const data = _interopRequireDefault(require("@teambit/legacy/dist/utils/array/find-duplications"));
160
-
161
112
  _findDuplications = function () {
162
113
  return data;
163
114
  };
164
-
165
115
  return data;
166
116
  }
167
-
168
117
  function _generator() {
169
118
  const data = require("@teambit/generator");
170
-
171
119
  _generator = function () {
172
120
  return data;
173
121
  };
174
-
175
122
  return data;
176
123
  }
177
-
178
124
  function _artifact() {
179
125
  const data = require("./artifact");
180
-
181
126
  _artifact = function () {
182
127
  return data;
183
128
  };
184
-
185
129
  return data;
186
130
  }
187
-
188
131
  function _artifactFactory() {
189
132
  const data = require("./artifact/artifact-factory");
190
-
191
133
  _artifactFactory = function () {
192
134
  return data;
193
135
  };
194
-
195
136
  return data;
196
137
  }
197
-
198
138
  function _builder() {
199
139
  const data = require("./builder.aspect");
200
-
201
140
  _builder = function () {
202
141
  return data;
203
142
  };
204
-
205
143
  return data;
206
144
  }
207
-
208
145
  function _builder2() {
209
146
  const data = require("./builder.graphql");
210
-
211
147
  _builder2 = function () {
212
148
  return data;
213
149
  };
214
-
215
150
  return data;
216
151
  }
217
-
218
152
  function _builder3() {
219
153
  const data = require("./builder.service");
220
-
221
154
  _builder3 = function () {
222
155
  return data;
223
156
  };
224
-
225
157
  return data;
226
158
  }
227
-
228
159
  function _build() {
229
160
  const data = require("./build.cmd");
230
-
231
161
  _build = function () {
232
162
  return data;
233
163
  };
234
-
235
164
  return data;
236
165
  }
237
-
238
166
  function _buildTask() {
239
167
  const data = require("./build-task");
240
-
241
168
  _buildTask = function () {
242
169
  return data;
243
170
  };
244
-
245
171
  return data;
246
172
  }
247
-
248
173
  function _exceptions() {
249
174
  const data = require("./exceptions");
250
-
251
175
  _exceptions = function () {
252
176
  return data;
253
177
  };
254
-
255
178
  return data;
256
179
  }
257
-
258
180
  function _buildPipelineResultList() {
259
181
  const data = require("./build-pipeline-result-list");
260
-
261
182
  _buildPipelineResultList = function () {
262
183
  return data;
263
184
  };
264
-
265
185
  return data;
266
186
  }
267
-
268
187
  function _artifacts() {
269
188
  const data = require("./artifact/artifacts.cmd");
270
-
271
189
  _artifacts = function () {
272
190
  return data;
273
191
  };
274
-
275
192
  return data;
276
193
  }
277
-
278
194
  function _buildTask2() {
279
195
  const data = require("./templates/build-task");
280
-
281
196
  _buildTask2 = function () {
282
197
  return data;
283
198
  };
284
-
285
199
  return data;
286
200
  }
287
-
288
201
  function _builder4() {
289
202
  const data = require("./builder.route");
290
-
291
203
  _builder4 = function () {
292
204
  return data;
293
205
  };
294
-
295
206
  return data;
296
207
  }
297
-
298
208
  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; }
299
-
300
209
  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; }
301
-
302
210
  const FILE_PATH_PARAM_DELIM = '~';
211
+
303
212
  /**
304
213
  * builder data format for the bit object store
305
214
  */
306
-
307
215
  exports.FILE_PATH_PARAM_DELIM = FILE_PATH_PARAM_DELIM;
308
-
309
216
  class BuilderMain {
310
217
  constructor(envs, workspace, buildService, tagService, snapService, scope, isolator, aspectLoader, componentAspect, buildTaskSlot, tagTaskSlot, snapTaskSlot) {
311
218
  this.envs = envs;
@@ -321,7 +228,6 @@ class BuilderMain {
321
228
  this.tagTaskSlot = tagTaskSlot;
322
229
  this.snapTaskSlot = snapTaskSlot;
323
230
  }
324
-
325
231
  async storeArtifacts(tasksResults) {
326
232
  const artifacts = tasksResults.flatMap(t => t.artifacts ? [t.artifacts] : []);
327
233
  const storeP = artifacts.map(async artifactMap => {
@@ -335,7 +241,6 @@ class BuilderMain {
335
241
  });
336
242
  await Promise.all(storeP);
337
243
  }
338
-
339
244
  pipelineResultsToBuilderData(components, buildPipelineResults) {
340
245
  const buildPipelineResultList = new (_buildPipelineResultList().BuildPipelineResultList)(buildPipelineResults, components);
341
246
  return _component().ComponentMap.as(components, component => {
@@ -350,7 +255,6 @@ class BuilderMain {
350
255
  };
351
256
  });
352
257
  }
353
-
354
258
  async tagListener(components, options = {}, isolateOptions = {}) {
355
259
  const pipeResults = [];
356
260
  const {
@@ -367,14 +271,12 @@ class BuilderMain {
367
271
  if (throwOnError && !forceDeploy) envsExecutionResults.throwErrorsIfExist();
368
272
  const allTasksResults = [...envsExecutionResults.tasksResults];
369
273
  pipeResults.push(envsExecutionResults);
370
-
371
274
  if (forceDeploy || !disableTagAndSnapPipelines && !envsExecutionResults.hasErrors()) {
372
275
  const deployEnvsExecutionResults = isSnap ? await this.runSnapTasks(components, isolateOptions, envsExecutionResults.tasksResults) : await this.runTagTasks(components, isolateOptions, envsExecutionResults.tasksResults);
373
276
  if (throwOnError && !forceDeploy) deployEnvsExecutionResults.throwErrorsIfExist();
374
277
  allTasksResults.push(...deployEnvsExecutionResults.tasksResults);
375
278
  pipeResults.push(deployEnvsExecutionResults);
376
279
  }
377
-
378
280
  await this.storeArtifacts(allTasksResults);
379
281
  const builderDataMap = this.pipelineResultsToBuilderData(components, allTasksResults);
380
282
  this.validateBuilderDataMap(builderDataMap);
@@ -383,7 +285,6 @@ class BuilderMain {
383
285
  pipeResults
384
286
  };
385
287
  }
386
-
387
288
  validateBuilderDataMap(builderDataMap) {
388
289
  builderDataMap.forEach((buildData, component) => {
389
290
  const taskSerializedIds = buildData.pipeline.map(t => _buildTask().BuildTaskHelper.serializeId({
@@ -391,71 +292,57 @@ class BuilderMain {
391
292
  name: t.taskName
392
293
  }));
393
294
  const duplications = (0, _findDuplications().default)(taskSerializedIds);
394
-
395
295
  if (duplications.length) {
396
296
  throw new Error(`build-task-results validation has failed. the following task(s) of "${component.id.toString()}" are duplicated: ${duplications.join(', ')}`);
397
297
  }
398
298
  });
399
- } // TODO: merge with getArtifactsVinylByExtensionAndName by getting aspect name and name as object with optional props
400
-
299
+ }
401
300
 
301
+ // TODO: merge with getArtifactsVinylByExtensionAndName by getting aspect name and name as object with optional props
402
302
  async getArtifactsVinylByAspect(component, aspectName) {
403
303
  const artifacts = this.getArtifactsByAspect(component, aspectName);
404
304
  const vinyls = await artifacts.getVinylsAndImportIfMissing(component.id._legacy, this.scope.legacyScope);
405
305
  return vinyls;
406
306
  }
407
-
408
307
  async getArtifactsVinylByAspectAndName(component, aspectName, name) {
409
308
  const artifacts = this.getArtifactsByAspectAndName(component, aspectName, name);
410
309
  const vinyls = await artifacts.getVinylsAndImportIfMissing(component.id._legacy, this.scope.legacyScope);
411
310
  return vinyls;
412
311
  }
413
-
414
312
  async getArtifactsVinylByAspectAndTaskName(component, aspectName, name) {
415
313
  const artifacts = this.getArtifactsbyAspectAndTaskName(component, aspectName, name);
416
314
  const vinyls = await artifacts.getVinylsAndImportIfMissing(component.id._legacy, this.scope.legacyScope);
417
315
  return vinyls;
418
316
  }
419
-
420
317
  getArtifactsByName(component, name) {
421
318
  const artifacts = this.getArtifacts(component).byAspectNameAndName(undefined, name);
422
319
  return artifacts;
423
320
  }
424
-
425
321
  getArtifactsByAspect(component, aspectName) {
426
322
  const artifacts = this.getArtifacts(component).byAspectNameAndName(aspectName);
427
323
  return artifacts;
428
324
  }
429
-
430
325
  getArtifactsByAspectAndName(component, aspectName, name) {
431
326
  const artifacts = this.getArtifacts(component).byAspectNameAndName(aspectName, name);
432
327
  return artifacts;
433
328
  }
434
-
435
329
  getArtifactsbyAspectAndTaskName(component, aspectName, taskName) {
436
330
  const artifacts = this.getArtifacts(component).byAspectNameAndTaskName(aspectName, taskName);
437
331
  return artifacts;
438
332
  }
439
-
440
333
  getDataByAspect(component, aspectName) {
441
334
  var _this$getBuilderData;
442
-
443
335
  const aspectsData = (_this$getBuilderData = this.getBuilderData(component)) === null || _this$getBuilderData === void 0 ? void 0 : _this$getBuilderData.aspectsData;
444
336
  const data = aspectsData === null || aspectsData === void 0 ? void 0 : aspectsData.find(aspectData => aspectData.aspectId === aspectName);
445
337
  return data === null || data === void 0 ? void 0 : data.data;
446
338
  }
447
-
448
339
  getArtifacts(component) {
449
340
  var _this$getBuilderData2;
450
-
451
341
  const artifacts = ((_this$getBuilderData2 = this.getBuilderData(component)) === null || _this$getBuilderData2 === void 0 ? void 0 : _this$getBuilderData2.artifacts) || _artifact().ArtifactList.fromArray([]);
452
-
453
342
  return artifacts;
454
343
  }
455
-
456
344
  getBuilderData(component) {
457
345
  var _component$get, _clonedData$artifacts;
458
-
459
346
  const data = (_component$get = component.get(_builder().BuilderAspect.id)) === null || _component$get === void 0 ? void 0 : _component$get.data;
460
347
  if (!data) return undefined;
461
348
  const clonedData = (0, _lodash().cloneDeep)(data);
@@ -466,7 +353,6 @@ class BuilderMain {
466
353
  } else {
467
354
  artifactFiles = artifact.files;
468
355
  }
469
-
470
356
  if (!(artifact instanceof _artifact().Artifact)) {
471
357
  Object.assign(artifact, {
472
358
  files: artifactFiles
@@ -477,28 +363,24 @@ class BuilderMain {
477
363
  clonedData.artifacts = _artifact().ArtifactList.fromArray(clonedData.artifacts || []);
478
364
  return clonedData;
479
365
  }
366
+
480
367
  /**
481
368
  * build given components for release.
482
369
  * for each one of the envs it runs a series of tasks.
483
370
  * in case of an error in a task, it stops the execution of that env and continue to the next
484
371
  * env. at the end, the results contain the data and errors per env.
485
372
  */
486
-
487
-
488
373
  async build(components, isolateOptions, builderOptions) {
489
374
  const ids = components.map(c => c.id);
490
375
  const network = await this.isolator.isolateComponents(ids, isolateOptions, this.scope.legacyScope);
491
376
  const envs = await this.envs.createEnvironment(network.graphCapsules.getAllComponents());
492
-
493
377
  const builderServiceOptions = _objectSpread({
494
378
  seedersOnly: isolateOptions === null || isolateOptions === void 0 ? void 0 : isolateOptions.seedersOnly,
495
379
  originalSeeders: ids
496
380
  }, builderOptions || {});
497
-
498
381
  const buildResult = await envs.runOnce(this.buildService, builderServiceOptions);
499
382
  return buildResult;
500
383
  }
501
-
502
384
  async runTagTasks(components, isolateOptions, previousTasksResults) {
503
385
  const envs = await this.envs.createEnvironment(components);
504
386
  const buildResult = await envs.runOnce(this.tagService, {
@@ -507,7 +389,6 @@ class BuilderMain {
507
389
  });
508
390
  return buildResult;
509
391
  }
510
-
511
392
  async runSnapTasks(components, isolateOptions, previousTasksResults) {
512
393
  const envs = await this.envs.createEnvironment(components);
513
394
  const buildResult = await envs.runOnce(this.snapService, {
@@ -516,7 +397,6 @@ class BuilderMain {
516
397
  });
517
398
  return buildResult;
518
399
  }
519
-
520
400
  listTasks(component) {
521
401
  const compEnv = this.envs.getEnv(component);
522
402
  const buildTasks = this.buildService.getCurrentPipeTasks(compEnv);
@@ -530,50 +410,44 @@ class BuilderMain {
530
410
  snapTasks
531
411
  };
532
412
  }
413
+
533
414
  /**
534
415
  * register a build task to apply on all component build pipelines.
535
416
  * build happens on `bit build` and as part of `bit tag --persist`.
536
417
  */
537
-
538
-
539
418
  registerBuildTasks(tasks) {
540
419
  this.buildTaskSlot.register(tasks);
541
420
  return this;
542
421
  }
422
+
543
423
  /**
544
424
  * @deprecated use registerTagTasks or registerSnapTasks
545
425
  */
546
-
547
-
548
426
  registerDeployTasks(tasks) {
549
427
  this.tagTaskSlot.register(tasks);
550
428
  return this;
551
429
  }
430
+
552
431
  /**
553
432
  * tag tasks that don't get executed on `bit build`, only on `bit tag'.
554
433
  * this pipeline is running once the build-pipeline has completed.
555
434
  */
556
-
557
-
558
435
  registerTagTasks(tasks) {
559
436
  this.tagTaskSlot.register(tasks);
560
437
  return this;
561
438
  }
439
+
562
440
  /**
563
441
  * tag tasks that don't get executed on `bit build`, only on `bit snap'.
564
442
  * this pipeline is running once the build-pipeline has completed.
565
443
  */
566
-
567
-
568
444
  registerSnapTasks(tasks) {
569
445
  this.snapTaskSlot.register(tasks);
570
446
  return this;
571
447
  }
572
-
573
448
  getDownloadUrlForArtifact(componentId, taskId, path) {
574
449
  return `/api/${componentId}/~aspect/builder/${taskId}/${path ? `${FILE_PATH_PARAM_DELIM}${path}` : ''}`;
575
450
  }
576
-
577
451
  static async provider([cli, envs, workspace, scope, isolator, loggerExt, aspectLoader, graphql, generator, component], config, [buildTaskSlot, tagTaskSlot, snapTaskSlot]) {
578
452
  const artifactFactory = new (_artifactFactory().ArtifactFactory)();
579
453
  const logger = loggerExt.createLogger(_builder().BuilderAspect.id);
@@ -589,14 +463,11 @@ class BuilderMain {
589
463
  cli.register(...commands);
590
464
  return builder;
591
465
  }
592
-
593
466
  }
594
-
595
467
  exports.BuilderMain = BuilderMain;
596
468
  (0, _defineProperty2().default)(BuilderMain, "slots", [_harmony().Slot.withType(), _harmony().Slot.withType(), _harmony().Slot.withType()]);
597
469
  (0, _defineProperty2().default)(BuilderMain, "runtime", _cli().MainRuntime);
598
470
  (0, _defineProperty2().default)(BuilderMain, "dependencies", [_cli().CLIAspect, _envs().EnvsAspect, _workspace().WorkspaceAspect, _scope().ScopeAspect, _isolator().IsolatorAspect, _logger().LoggerAspect, _aspectLoader().AspectLoaderAspect, _graphql().GraphqlAspect, _generator().GeneratorAspect, _component().ComponentAspect]);
599
-
600
471
  _builder().BuilderAspect.addRuntime(BuilderMain);
601
472
 
602
473
  //# sourceMappingURL=builder.main.runtime.js.map