@teambit/compiler 0.0.881 → 0.0.883
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/compiler.aspect.js +0 -5
- package/dist/compiler.aspect.js.map +1 -1
- package/dist/compiler.cmd.js +2 -40
- package/dist/compiler.cmd.js.map +1 -1
- package/dist/compiler.composition.js +0 -6
- package/dist/compiler.composition.js.map +1 -1
- package/dist/compiler.main.runtime.js +8 -107
- package/dist/compiler.main.runtime.js.map +1 -1
- package/dist/compiler.service.js +0 -18
- package/dist/compiler.service.js.map +1 -1
- package/dist/compiler.task.js +1 -30
- package/dist/compiler.task.js.map +1 -1
- package/dist/dist-artifact.js +0 -7
- package/dist/dist-artifact.js.map +1 -1
- package/dist/events/compiler-error.js +1 -12
- package/dist/events/compiler-error.js.map +1 -1
- package/dist/events/component-compilation-on-done.js +1 -12
- package/dist/events/component-compilation-on-done.js.map +1 -1
- package/dist/events/index.js +0 -4
- package/dist/events/index.js.map +1 -1
- package/dist/exceptions/dist-artifact-not-found.js +0 -6
- package/dist/exceptions/dist-artifact-not-found.js.map +1 -1
- package/dist/exceptions/index.js +0 -3
- package/dist/exceptions/index.js.map +1 -1
- package/dist/index.js +0 -8
- package/dist/index.js.map +1 -1
- package/dist/output-formatter.js +0 -9
- package/dist/output-formatter.js.map +1 -1
- package/dist/templates/compiler/files/aspect-file.js +0 -1
- package/dist/templates/compiler/files/aspect-file.js.map +1 -1
- package/dist/templates/compiler/files/compiler-file.js +0 -1
- package/dist/templates/compiler/files/compiler-file.js.map +1 -1
- package/dist/templates/compiler/files/index-file.js +0 -1
- package/dist/templates/compiler/files/index-file.js.map +1 -1
- package/dist/templates/compiler/files/main-runtime-file.js +0 -1
- package/dist/templates/compiler/files/main-runtime-file.js.map +1 -1
- package/dist/templates/compiler/index.js +0 -13
- package/dist/templates/compiler/index.js.map +1 -1
- package/dist/types.js +0 -1
- package/dist/types.js.map +1 -1
- package/dist/workspace-compiler.js +9 -97
- package/dist/workspace-compiler.js.map +1 -1
- package/package-tar/teambit-compiler-0.0.883.tgz +0 -0
- package/package.json +13 -13
- package/{preview-1666409808293.js → preview-1666582798766.js} +2 -2
- package/package-tar/teambit-compiler-0.0.881.tgz +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["CompilerMain","constructor","pubsub","workspaceCompiler","envs","builder","workspace","dependencyResolver","compileOnWorkspace","componentsIds","options","initiator","CompilationInitiator","ComponentAdded","compileComponents","createTask","name","compiler","CompilerTask","CompilerAspect","id","getDistPathBySrcPath","component","srcPath","environment","getEnv","env","compilerInstance","getCompiler","getRelativeDistFolder","getOrCalculateEnv","getDistDir","DEFAULT_DIST_DIRNAME","isDistDirExists","packageDir","getComponentPackagePath","distDir","pathToCheck","path","join","fs","existsSync","getDistsFiles","artifacts","getArtifactsVinylByAspect","length","DistArtifactNotFound","DistArtifact","addMissingDistsIssue","exist","state","issues","getOrCreate","IssuesClasses","MissingDists","data","undefined","provider","cli","loggerMain","aspectLoader","ui","generator","logger","createLogger","WorkspaceCompiler","registerService","CompilerService","compilerMain","register","CompileCmd","onComponentLoad","bind","registerComponentTemplate","compilerTemplate","ManyComponentsWriter","externalCompiler","MainRuntime","CLIAspect","WorkspaceAspect","EnvsAspect","LoggerAspect","PubsubAspect","AspectLoaderAspect","BuilderAspect","UIAspect","GeneratorAspect","DependencyResolverAspect","addRuntime"],"sources":["compiler.main.runtime.ts"],"sourcesContent":["import * as path from 'path';\nimport fs from 'fs-extra';\nimport AspectLoaderAspect, { AspectLoaderMain } from '@teambit/aspect-loader';\nimport { BuilderAspect, BuilderMain } from '@teambit/builder';\nimport { CLIAspect, CLIMain, MainRuntime } from '@teambit/cli';\nimport { IssuesClasses } from '@teambit/component-issues';\nimport { Component, ComponentID } from '@teambit/component';\nimport { DEFAULT_DIST_DIRNAME } from '@teambit/legacy/dist/constants';\nimport { EnvsAspect, EnvsMain } from '@teambit/envs';\nimport { BitId } from '@teambit/legacy-bit-id';\nimport { DependencyResolverAspect, DependencyResolverMain } from '@teambit/dependency-resolver';\nimport ManyComponentsWriter from '@teambit/legacy/dist/consumer/component-ops/many-components-writer';\nimport { LoggerAspect, LoggerMain } from '@teambit/logger';\nimport { GeneratorAspect, GeneratorMain } from '@teambit/generator';\nimport { PubsubAspect, PubsubMain } from '@teambit/pubsub';\nimport UIAspect, { UiMain } from '@teambit/ui';\nimport { Workspace, WorkspaceAspect } from '@teambit/workspace';\nimport { CompilerAspect } from './compiler.aspect';\nimport { CompileCmd } from './compiler.cmd';\nimport { CompilerService } from './compiler.service';\nimport { CompilerTask } from './compiler.task';\nimport { DistArtifact } from './dist-artifact';\nimport { DistArtifactNotFound } from './exceptions';\nimport { CompilationInitiator, Compiler } from './types';\nimport { CompileOptions, WorkspaceCompiler } from './workspace-compiler';\nimport { compilerTemplate } from './templates/compiler';\n\nexport class CompilerMain {\n constructor(\n private pubsub: PubsubMain,\n private workspaceCompiler: WorkspaceCompiler,\n private envs: EnvsMain,\n private builder: BuilderMain,\n private workspace: Workspace,\n private dependencyResolver: DependencyResolverMain\n ) {}\n\n /**\n * Run compilation on `bit new` and when new components are imported\n */\n compileOnWorkspace(\n componentsIds: string[] | BitId[] | ComponentID[] = [], // when empty, it compiles all\n options: CompileOptions = { initiator: CompilationInitiator.ComponentAdded }\n ) {\n return this.workspaceCompiler.compileComponents(componentsIds, options);\n }\n /**\n * API to create a new compiler task, it facilitates the usage of multiple compilers.\n * with this method you can create any number of compilers and add them to the buildPipeline.\n */\n createTask(name: string, compiler: Compiler): CompilerTask {\n return new CompilerTask(CompilerAspect.id, name, compiler, this.dependencyResolver);\n }\n\n /**\n * find the compiler configured on the workspace and ask for the dist path.\n */\n getDistPathBySrcPath(component: Component, srcPath: string): string | null {\n const environment = this.envs.getEnv(component).env;\n const compilerInstance = environment.getCompiler?.();\n if (!compilerInstance) return null;\n return compilerInstance.getDistPathBySrcPath(srcPath);\n }\n\n /**\n * find the compiler configured on the workspace and ask for the dist folder path.\n */\n getRelativeDistFolder(component: Component): string {\n const environment = this.envs.getOrCalculateEnv(component).env;\n const compilerInstance: Compiler | undefined = environment.getCompiler?.();\n if (!compilerInstance || !compilerInstance.getDistDir) return DEFAULT_DIST_DIRNAME;\n return compilerInstance.getDistDir();\n }\n\n /**\n * Check if the dist folder (in the component package under node_modules) exist\n * @param component\n * @returns\n */\n isDistDirExists(component: Component): boolean {\n const packageDir = this.workspace.getComponentPackagePath(component);\n const distDir = this.getRelativeDistFolder(component);\n const pathToCheck = path.join(packageDir, distDir);\n return fs.existsSync(pathToCheck);\n }\n\n async getDistsFiles(component: Component): Promise<DistArtifact> {\n const artifacts = await this.builder.getArtifactsVinylByAspect(component, CompilerAspect.id);\n if (!artifacts.length) throw new DistArtifactNotFound(component.id);\n\n return new DistArtifact(artifacts);\n }\n\n async addMissingDistsIssue(component: Component) {\n const exist = this.isDistDirExists(component);\n if (!exist) {\n component.state.issues.getOrCreate(IssuesClasses.MissingDists).data = true;\n }\n // we don't want to add any data to the compiler aspect, only to add issues on the component\n return undefined;\n }\n\n static runtime = MainRuntime;\n\n static dependencies = [\n CLIAspect,\n WorkspaceAspect,\n EnvsAspect,\n LoggerAspect,\n PubsubAspect,\n AspectLoaderAspect,\n BuilderAspect,\n UIAspect,\n GeneratorAspect,\n DependencyResolverAspect,\n ];\n\n static async provider([\n cli,\n workspace,\n envs,\n loggerMain,\n pubsub,\n aspectLoader,\n builder,\n ui,\n generator,\n dependencyResolver,\n ]: [\n CLIMain,\n Workspace,\n EnvsMain,\n LoggerMain,\n PubsubMain,\n AspectLoaderMain,\n BuilderMain,\n UiMain,\n GeneratorMain,\n DependencyResolverMain\n ]) {\n const logger = loggerMain.createLogger(CompilerAspect.id);\n const workspaceCompiler = new WorkspaceCompiler(\n workspace,\n envs,\n pubsub,\n aspectLoader,\n ui,\n logger,\n dependencyResolver\n );\n envs.registerService(new CompilerService());\n const compilerMain = new CompilerMain(pubsub, workspaceCompiler, envs, builder, workspace, dependencyResolver);\n cli.register(new CompileCmd(workspaceCompiler, logger, pubsub));\n if (workspace) {\n workspace.onComponentLoad(compilerMain.addMissingDistsIssue.bind(compilerMain));\n }\n generator.registerComponentTemplate([compilerTemplate]);\n ManyComponentsWriter.externalCompiler = compilerMain.compileOnWorkspace.bind(compilerMain);\n\n return compilerMain;\n }\n}\n\nCompilerAspect.addRuntime(CompilerMain);\n\nexport default CompilerMain;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAEA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AAEA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;AACA;EAAA;;EAAA;IAAA;EAAA;;EAAA;AAAA;;A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oB,EAMpBC,uBANoB,EAOpBC,wBAPoB,EAQpBC,aARoB,EASpBC,4BAToB,EAUpBC,8CAVoB,C;;AA2DxBpE,0BAAA,CAAeqE,UAAf,CAA0BxF,YAA1B;;eAEeA,Y"}
|
|
1
|
+
{"version":3,"names":["CompilerMain","constructor","pubsub","workspaceCompiler","envs","builder","workspace","dependencyResolver","compileOnWorkspace","componentsIds","options","initiator","CompilationInitiator","ComponentAdded","compileComponents","createTask","name","compiler","CompilerTask","CompilerAspect","id","getDistPathBySrcPath","component","srcPath","environment","getEnv","env","compilerInstance","getCompiler","getRelativeDistFolder","getOrCalculateEnv","getDistDir","DEFAULT_DIST_DIRNAME","isDistDirExists","packageDir","getComponentPackagePath","distDir","pathToCheck","path","join","fs","existsSync","getDistsFiles","artifacts","getArtifactsVinylByAspect","length","DistArtifactNotFound","DistArtifact","addMissingDistsIssue","exist","state","issues","getOrCreate","IssuesClasses","MissingDists","data","undefined","provider","cli","loggerMain","aspectLoader","ui","generator","logger","createLogger","WorkspaceCompiler","registerService","CompilerService","compilerMain","register","CompileCmd","onComponentLoad","bind","registerComponentTemplate","compilerTemplate","ManyComponentsWriter","externalCompiler","MainRuntime","CLIAspect","WorkspaceAspect","EnvsAspect","LoggerAspect","PubsubAspect","AspectLoaderAspect","BuilderAspect","UIAspect","GeneratorAspect","DependencyResolverAspect","addRuntime"],"sources":["compiler.main.runtime.ts"],"sourcesContent":["import * as path from 'path';\nimport fs from 'fs-extra';\nimport AspectLoaderAspect, { AspectLoaderMain } from '@teambit/aspect-loader';\nimport { BuilderAspect, BuilderMain } from '@teambit/builder';\nimport { CLIAspect, CLIMain, MainRuntime } from '@teambit/cli';\nimport { IssuesClasses } from '@teambit/component-issues';\nimport { Component, ComponentID } from '@teambit/component';\nimport { DEFAULT_DIST_DIRNAME } from '@teambit/legacy/dist/constants';\nimport { EnvsAspect, EnvsMain } from '@teambit/envs';\nimport { BitId } from '@teambit/legacy-bit-id';\nimport { DependencyResolverAspect, DependencyResolverMain } from '@teambit/dependency-resolver';\nimport ManyComponentsWriter from '@teambit/legacy/dist/consumer/component-ops/many-components-writer';\nimport { LoggerAspect, LoggerMain } from '@teambit/logger';\nimport { GeneratorAspect, GeneratorMain } from '@teambit/generator';\nimport { PubsubAspect, PubsubMain } from '@teambit/pubsub';\nimport UIAspect, { UiMain } from '@teambit/ui';\nimport { Workspace, WorkspaceAspect } from '@teambit/workspace';\nimport { CompilerAspect } from './compiler.aspect';\nimport { CompileCmd } from './compiler.cmd';\nimport { CompilerService } from './compiler.service';\nimport { CompilerTask } from './compiler.task';\nimport { DistArtifact } from './dist-artifact';\nimport { DistArtifactNotFound } from './exceptions';\nimport { CompilationInitiator, Compiler } from './types';\nimport { CompileOptions, WorkspaceCompiler } from './workspace-compiler';\nimport { compilerTemplate } from './templates/compiler';\n\nexport class CompilerMain {\n constructor(\n private pubsub: PubsubMain,\n private workspaceCompiler: WorkspaceCompiler,\n private envs: EnvsMain,\n private builder: BuilderMain,\n private workspace: Workspace,\n private dependencyResolver: DependencyResolverMain\n ) {}\n\n /**\n * Run compilation on `bit new` and when new components are imported\n */\n compileOnWorkspace(\n componentsIds: string[] | BitId[] | ComponentID[] = [], // when empty, it compiles all\n options: CompileOptions = { initiator: CompilationInitiator.ComponentAdded }\n ) {\n return this.workspaceCompiler.compileComponents(componentsIds, options);\n }\n /**\n * API to create a new compiler task, it facilitates the usage of multiple compilers.\n * with this method you can create any number of compilers and add them to the buildPipeline.\n */\n createTask(name: string, compiler: Compiler): CompilerTask {\n return new CompilerTask(CompilerAspect.id, name, compiler, this.dependencyResolver);\n }\n\n /**\n * find the compiler configured on the workspace and ask for the dist path.\n */\n getDistPathBySrcPath(component: Component, srcPath: string): string | null {\n const environment = this.envs.getEnv(component).env;\n const compilerInstance = environment.getCompiler?.();\n if (!compilerInstance) return null;\n return compilerInstance.getDistPathBySrcPath(srcPath);\n }\n\n /**\n * find the compiler configured on the workspace and ask for the dist folder path.\n */\n getRelativeDistFolder(component: Component): string {\n const environment = this.envs.getOrCalculateEnv(component).env;\n const compilerInstance: Compiler | undefined = environment.getCompiler?.();\n if (!compilerInstance || !compilerInstance.getDistDir) return DEFAULT_DIST_DIRNAME;\n return compilerInstance.getDistDir();\n }\n\n /**\n * Check if the dist folder (in the component package under node_modules) exist\n * @param component\n * @returns\n */\n isDistDirExists(component: Component): boolean {\n const packageDir = this.workspace.getComponentPackagePath(component);\n const distDir = this.getRelativeDistFolder(component);\n const pathToCheck = path.join(packageDir, distDir);\n return fs.existsSync(pathToCheck);\n }\n\n async getDistsFiles(component: Component): Promise<DistArtifact> {\n const artifacts = await this.builder.getArtifactsVinylByAspect(component, CompilerAspect.id);\n if (!artifacts.length) throw new DistArtifactNotFound(component.id);\n\n return new DistArtifact(artifacts);\n }\n\n async addMissingDistsIssue(component: Component) {\n const exist = this.isDistDirExists(component);\n if (!exist) {\n component.state.issues.getOrCreate(IssuesClasses.MissingDists).data = true;\n }\n // we don't want to add any data to the compiler aspect, only to add issues on the component\n return undefined;\n }\n\n static runtime = MainRuntime;\n\n static dependencies = [\n CLIAspect,\n WorkspaceAspect,\n EnvsAspect,\n LoggerAspect,\n PubsubAspect,\n AspectLoaderAspect,\n BuilderAspect,\n UIAspect,\n GeneratorAspect,\n DependencyResolverAspect,\n ];\n\n static async provider([\n cli,\n workspace,\n envs,\n loggerMain,\n pubsub,\n aspectLoader,\n builder,\n ui,\n generator,\n dependencyResolver,\n ]: [\n CLIMain,\n Workspace,\n EnvsMain,\n LoggerMain,\n PubsubMain,\n AspectLoaderMain,\n BuilderMain,\n UiMain,\n GeneratorMain,\n DependencyResolverMain\n ]) {\n const logger = loggerMain.createLogger(CompilerAspect.id);\n const workspaceCompiler = new WorkspaceCompiler(\n workspace,\n envs,\n pubsub,\n aspectLoader,\n ui,\n logger,\n dependencyResolver\n );\n envs.registerService(new CompilerService());\n const compilerMain = new CompilerMain(pubsub, workspaceCompiler, envs, builder, workspace, dependencyResolver);\n cli.register(new CompileCmd(workspaceCompiler, logger, pubsub));\n if (workspace) {\n workspace.onComponentLoad(compilerMain.addMissingDistsIssue.bind(compilerMain));\n }\n generator.registerComponentTemplate([compilerTemplate]);\n ManyComponentsWriter.externalCompiler = compilerMain.compileOnWorkspace.bind(compilerMain);\n\n return compilerMain;\n }\n}\n\nCompilerAspect.addRuntime(CompilerMain);\n\nexport default CompilerMain;\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;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}
|
package/dist/compiler.service.js
CHANGED
|
@@ -1,57 +1,42 @@
|
|
|
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.CompilerService = void 0;
|
|
9
|
-
|
|
10
8
|
function _defineProperty2() {
|
|
11
9
|
const data = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
12
|
-
|
|
13
10
|
_defineProperty2 = function () {
|
|
14
11
|
return data;
|
|
15
12
|
};
|
|
16
|
-
|
|
17
13
|
return data;
|
|
18
14
|
}
|
|
19
|
-
|
|
20
15
|
function _react() {
|
|
21
16
|
const data = _interopRequireDefault(require("react"));
|
|
22
|
-
|
|
23
17
|
_react = function () {
|
|
24
18
|
return data;
|
|
25
19
|
};
|
|
26
|
-
|
|
27
20
|
return data;
|
|
28
21
|
}
|
|
29
|
-
|
|
30
22
|
function _ink() {
|
|
31
23
|
const data = require("ink");
|
|
32
|
-
|
|
33
24
|
_ink = function () {
|
|
34
25
|
return data;
|
|
35
26
|
};
|
|
36
|
-
|
|
37
27
|
return data;
|
|
38
28
|
}
|
|
39
|
-
|
|
40
29
|
function _cliHighlight() {
|
|
41
30
|
const data = _interopRequireDefault(require("cli-highlight"));
|
|
42
|
-
|
|
43
31
|
_cliHighlight = function () {
|
|
44
32
|
return data;
|
|
45
33
|
};
|
|
46
|
-
|
|
47
34
|
return data;
|
|
48
35
|
}
|
|
49
|
-
|
|
50
36
|
class CompilerService {
|
|
51
37
|
constructor() {
|
|
52
38
|
(0, _defineProperty2().default)(this, "name", 'Compile');
|
|
53
39
|
}
|
|
54
|
-
|
|
55
40
|
render(env) {
|
|
56
41
|
const descriptor = this.getDescriptor(env);
|
|
57
42
|
return /*#__PURE__*/_react().default.createElement(_ink().Text, {
|
|
@@ -65,7 +50,6 @@ class CompilerService {
|
|
|
65
50
|
ignoreIllegals: true
|
|
66
51
|
})), /*#__PURE__*/_react().default.createElement(_ink().Newline, null));
|
|
67
52
|
}
|
|
68
|
-
|
|
69
53
|
getDescriptor(env) {
|
|
70
54
|
if (!env.env.getCompiler) return undefined;
|
|
71
55
|
const compiler = env.env.getCompiler();
|
|
@@ -77,9 +61,7 @@ class CompilerService {
|
|
|
77
61
|
displayName: compiler.displayName ? compiler.displayName : '?'
|
|
78
62
|
};
|
|
79
63
|
}
|
|
80
|
-
|
|
81
64
|
}
|
|
82
|
-
|
|
83
65
|
exports.CompilerService = CompilerService;
|
|
84
66
|
|
|
85
67
|
//# sourceMappingURL=compiler.service.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["CompilerService","render","env","descriptor","getDescriptor","id","displayName","version","config","highlight","language","ignoreIllegals","getCompiler","undefined","compiler","icon","displayConfig"],"sources":["compiler.service.tsx"],"sourcesContent":["import React from 'react';\nimport { Text, Newline } from 'ink';\nimport { EnvService, EnvDefinition } from '@teambit/envs';\nimport highlight from 'cli-highlight';\n\nexport type CompilerDescriptor = {\n id: string;\n icon?: string;\n config?: string;\n};\n\nexport class CompilerService implements EnvService<{}, CompilerDescriptor> {\n name = 'Compile';\n\n render(env: EnvDefinition) {\n const descriptor = this.getDescriptor(env);\n\n return (\n <Text key={descriptor?.id}>\n <Text color=\"cyan\">configured compiler: </Text>\n <Text>\n {descriptor?.id} ({descriptor?.displayName} @ {descriptor?.version})\n </Text>\n <Newline />\n <Text color=\"cyan\">compiler config:</Text>\n <Newline />\n <Text>\n {descriptor?.config && highlight(descriptor?.config, { language: 'javascript', ignoreIllegals: true })}\n </Text>\n <Newline />\n </Text>\n );\n }\n\n getDescriptor(env: EnvDefinition) {\n if (!env.env.getCompiler) return undefined;\n const compiler = env.env.getCompiler();\n\n return {\n id: compiler.id,\n icon: compiler.icon,\n config: compiler.displayConfig ? compiler.displayConfig() : undefined,\n version: compiler.version ? compiler.version() : '?',\n displayName: compiler.displayName ? compiler.displayName : '?',\n };\n }\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["CompilerService","render","env","descriptor","getDescriptor","id","displayName","version","config","highlight","language","ignoreIllegals","getCompiler","undefined","compiler","icon","displayConfig"],"sources":["compiler.service.tsx"],"sourcesContent":["import React from 'react';\nimport { Text, Newline } from 'ink';\nimport { EnvService, EnvDefinition } from '@teambit/envs';\nimport highlight from 'cli-highlight';\n\nexport type CompilerDescriptor = {\n id: string;\n icon?: string;\n config?: string;\n};\n\nexport class CompilerService implements EnvService<{}, CompilerDescriptor> {\n name = 'Compile';\n\n render(env: EnvDefinition) {\n const descriptor = this.getDescriptor(env);\n\n return (\n <Text key={descriptor?.id}>\n <Text color=\"cyan\">configured compiler: </Text>\n <Text>\n {descriptor?.id} ({descriptor?.displayName} @ {descriptor?.version})\n </Text>\n <Newline />\n <Text color=\"cyan\">compiler config:</Text>\n <Newline />\n <Text>\n {descriptor?.config && highlight(descriptor?.config, { language: 'javascript', ignoreIllegals: true })}\n </Text>\n <Newline />\n </Text>\n );\n }\n\n getDescriptor(env: EnvDefinition) {\n if (!env.env.getCompiler) return undefined;\n const compiler = env.env.getCompiler();\n\n return {\n id: compiler.id,\n icon: compiler.icon,\n config: compiler.displayConfig ? compiler.displayConfig() : undefined,\n version: compiler.version ? compiler.version() : '?',\n displayName: compiler.displayName ? compiler.displayName : '?',\n };\n }\n}\n"],"mappings":";;;;;;;;;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAQO,MAAMA,eAAe,CAA+C;EAAA;IAAA,8CAClE,SAAS;EAAA;EAEhBC,MAAM,CAACC,GAAkB,EAAE;IACzB,MAAMC,UAAU,GAAG,IAAI,CAACC,aAAa,CAACF,GAAG,CAAC;IAE1C,oBACE,+BAAC,WAAI;MAAC,GAAG,EAAEC,UAAU,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1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
require("core-js/modules/es.symbol.description.js");
|
|
6
|
-
|
|
7
5
|
require("core-js/modules/es.array.iterator.js");
|
|
8
|
-
|
|
9
6
|
require("core-js/modules/es.promise.js");
|
|
10
|
-
|
|
11
7
|
require("core-js/modules/es.regexp.exec.js");
|
|
12
|
-
|
|
13
8
|
require("core-js/modules/es.string.replace.js");
|
|
14
|
-
|
|
15
9
|
Object.defineProperty(exports, "__esModule", {
|
|
16
10
|
value: true
|
|
17
11
|
});
|
|
18
12
|
exports.CompilerTask = void 0;
|
|
19
|
-
|
|
20
13
|
function _defineProperty2() {
|
|
21
14
|
const data = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
22
|
-
|
|
23
15
|
_defineProperty2 = function () {
|
|
24
16
|
return data;
|
|
25
17
|
};
|
|
26
|
-
|
|
27
18
|
return data;
|
|
28
19
|
}
|
|
29
|
-
|
|
30
20
|
function _toolboxFs() {
|
|
31
21
|
const data = require("@teambit/toolbox.fs.hard-link-directory");
|
|
32
|
-
|
|
33
22
|
_toolboxFs = function () {
|
|
34
23
|
return data;
|
|
35
24
|
};
|
|
36
|
-
|
|
37
25
|
return data;
|
|
38
26
|
}
|
|
39
|
-
|
|
40
27
|
function _fsExtra() {
|
|
41
28
|
const data = _interopRequireDefault(require("fs-extra"));
|
|
42
|
-
|
|
43
29
|
_fsExtra = function () {
|
|
44
30
|
return data;
|
|
45
31
|
};
|
|
46
|
-
|
|
47
32
|
return data;
|
|
48
33
|
}
|
|
49
|
-
|
|
50
34
|
function _path() {
|
|
51
35
|
const data = _interopRequireDefault(require("path"));
|
|
52
|
-
|
|
53
36
|
_path = function () {
|
|
54
37
|
return data;
|
|
55
38
|
};
|
|
56
|
-
|
|
57
39
|
return data;
|
|
58
40
|
}
|
|
59
|
-
|
|
60
41
|
/**
|
|
61
42
|
* compiler build task. Allows to compile components during component build.
|
|
62
43
|
*/
|
|
@@ -67,49 +48,41 @@ class CompilerTask {
|
|
|
67
48
|
this.compilerInstance = compilerInstance;
|
|
68
49
|
this.dependencyResolver = dependencyResolver;
|
|
69
50
|
(0, _defineProperty2().default)(this, "description", 'compile components');
|
|
70
|
-
|
|
71
51
|
if (compilerInstance.artifactName) {
|
|
72
52
|
this.description += ` for artifact ${compilerInstance.artifactName}`;
|
|
73
53
|
}
|
|
74
54
|
}
|
|
75
|
-
|
|
76
55
|
async preBuild(context) {
|
|
77
56
|
await Promise.all(context.capsuleNetwork.seedersCapsules.map(capsule => this.copyNonSupportedFiles(capsule, this.compilerInstance)));
|
|
78
57
|
if (!this.compilerInstance.preBuild) return;
|
|
79
58
|
await this.compilerInstance.preBuild(context);
|
|
80
59
|
}
|
|
81
|
-
|
|
82
60
|
async execute(context) {
|
|
83
61
|
const buildResults = await this.compilerInstance.build(context);
|
|
84
62
|
await this._hardLinkBuildArtifactsOnCapsules(context);
|
|
85
63
|
return buildResults;
|
|
86
64
|
}
|
|
65
|
+
|
|
87
66
|
/**
|
|
88
67
|
* This function hard links the compiled artifacts to the `node_modules` of other component capsules.
|
|
89
68
|
* For instance, if we have a `button` component that is a dependency of the `card` component,
|
|
90
69
|
* then the `dist` folder of the `button` component will be copied to `<card_capsule>/node_modules/button/dist`.
|
|
91
70
|
*/
|
|
92
|
-
|
|
93
|
-
|
|
94
71
|
async _hardLinkBuildArtifactsOnCapsules(context) {
|
|
95
72
|
await Promise.all(context.capsuleNetwork.seedersCapsules.map(async capsule => {
|
|
96
73
|
const relCompDir = _path().default.relative(context.capsuleNetwork.capsulesRootDir, capsule.path).replace(/\\/g, '/');
|
|
97
|
-
|
|
98
74
|
const injectedDirs = await this.dependencyResolver.getInjectedDirs(context.capsuleNetwork.capsulesRootDir, relCompDir, this.dependencyResolver.getPackageName(capsule.component));
|
|
99
75
|
return (0, _toolboxFs().hardLinkDirectory)(capsule.path, injectedDirs.map(injectedDir => _path().default.join(context.capsuleNetwork.capsulesRootDir, injectedDir)));
|
|
100
76
|
}));
|
|
101
77
|
}
|
|
102
|
-
|
|
103
78
|
async postBuild(context, tasksResults) {
|
|
104
79
|
if (!this.compilerInstance.postBuild) return;
|
|
105
80
|
await this.compilerInstance.postBuild(context, tasksResults);
|
|
106
81
|
}
|
|
107
|
-
|
|
108
82
|
async copyNonSupportedFiles(capsule, compiler) {
|
|
109
83
|
if (!compiler.shouldCopyNonSupportedFiles) {
|
|
110
84
|
return;
|
|
111
85
|
}
|
|
112
|
-
|
|
113
86
|
const component = capsule.component;
|
|
114
87
|
await Promise.all(component.filesystem.files.map(async file => {
|
|
115
88
|
if (compiler.isFileSupported(file.path)) return;
|
|
@@ -117,9 +90,7 @@ class CompilerTask {
|
|
|
117
90
|
await _fsExtra().default.outputFile(_path().default.join(capsule.path, compiler.distDir, file.relative), content);
|
|
118
91
|
}));
|
|
119
92
|
}
|
|
120
|
-
|
|
121
93
|
}
|
|
122
|
-
|
|
123
94
|
exports.CompilerTask = CompilerTask;
|
|
124
95
|
|
|
125
96
|
//# sourceMappingURL=compiler.task.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["CompilerTask","constructor","aspectId","name","compilerInstance","dependencyResolver","artifactName","description","preBuild","context","Promise","all","capsuleNetwork","seedersCapsules","map","capsule","copyNonSupportedFiles","execute","buildResults","build","_hardLinkBuildArtifactsOnCapsules","relCompDir","path","relative","capsulesRootDir","replace","injectedDirs","getInjectedDirs","getPackageName","component","hardLinkDirectory","injectedDir","join","postBuild","tasksResults","compiler","shouldCopyNonSupportedFiles","filesystem","files","file","isFileSupported","content","contents","fs","outputFile","distDir"],"sources":["compiler.task.ts"],"sourcesContent":["import { BuildContext, BuiltTaskResult, BuildTask, TaskResultsList } from '@teambit/builder';\nimport { Capsule } from '@teambit/isolator';\nimport { hardLinkDirectory } from '@teambit/toolbox.fs.hard-link-directory';\nimport { DependencyResolverMain } from '@teambit/dependency-resolver';\nimport fs from 'fs-extra';\nimport path from 'path';\n\nimport { Compiler } from './types';\n\n/**\n * compiler build task. Allows to compile components during component build.\n */\nexport class CompilerTask implements BuildTask {\n readonly description = 'compile components';\n constructor(\n readonly aspectId: string,\n readonly name: string,\n private compilerInstance: Compiler,\n private dependencyResolver: DependencyResolverMain\n ) {\n if (compilerInstance.artifactName) {\n this.description += ` for artifact ${compilerInstance.artifactName}`;\n }\n }\n\n async preBuild(context: BuildContext) {\n await Promise.all(\n context.capsuleNetwork.seedersCapsules.map((capsule) =>\n this.copyNonSupportedFiles(capsule, this.compilerInstance)\n )\n );\n if (!this.compilerInstance.preBuild) return;\n await this.compilerInstance.preBuild(context);\n }\n\n async execute(context: BuildContext): Promise<BuiltTaskResult> {\n const buildResults = await this.compilerInstance.build(context);\n await this._hardLinkBuildArtifactsOnCapsules(context);\n return buildResults;\n }\n\n /**\n * This function hard links the compiled artifacts to the `node_modules` of other component capsules.\n * For instance, if we have a `button` component that is a dependency of the `card` component,\n * then the `dist` folder of the `button` component will be copied to `<card_capsule>/node_modules/button/dist`.\n */\n private async _hardLinkBuildArtifactsOnCapsules(context: BuildContext): Promise<void> {\n await Promise.all(\n context.capsuleNetwork.seedersCapsules.map(async (capsule) => {\n const relCompDir = path.relative(context.capsuleNetwork.capsulesRootDir, capsule.path).replace(/\\\\/g, '/');\n const injectedDirs = await this.dependencyResolver.getInjectedDirs(\n context.capsuleNetwork.capsulesRootDir,\n relCompDir,\n this.dependencyResolver.getPackageName(capsule.component)\n );\n return hardLinkDirectory(\n capsule.path,\n injectedDirs.map((injectedDir) => path.join(context.capsuleNetwork.capsulesRootDir, injectedDir))\n );\n })\n );\n }\n\n async postBuild?(context: BuildContext, tasksResults: TaskResultsList): Promise<void> {\n if (!this.compilerInstance.postBuild) return;\n await this.compilerInstance.postBuild(context, tasksResults);\n }\n\n async copyNonSupportedFiles(capsule: Capsule, compiler: Compiler) {\n if (!compiler.shouldCopyNonSupportedFiles) {\n return;\n }\n const component = capsule.component;\n await Promise.all(\n component.filesystem.files.map(async (file) => {\n if (compiler.isFileSupported(file.path)) return;\n const content = file.contents;\n await fs.outputFile(path.join(capsule.path, compiler.distDir, file.relative), content);\n })\n );\n }\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["CompilerTask","constructor","aspectId","name","compilerInstance","dependencyResolver","artifactName","description","preBuild","context","Promise","all","capsuleNetwork","seedersCapsules","map","capsule","copyNonSupportedFiles","execute","buildResults","build","_hardLinkBuildArtifactsOnCapsules","relCompDir","path","relative","capsulesRootDir","replace","injectedDirs","getInjectedDirs","getPackageName","component","hardLinkDirectory","injectedDir","join","postBuild","tasksResults","compiler","shouldCopyNonSupportedFiles","filesystem","files","file","isFileSupported","content","contents","fs","outputFile","distDir"],"sources":["compiler.task.ts"],"sourcesContent":["import { BuildContext, BuiltTaskResult, BuildTask, TaskResultsList } from '@teambit/builder';\nimport { Capsule } from '@teambit/isolator';\nimport { hardLinkDirectory } from '@teambit/toolbox.fs.hard-link-directory';\nimport { DependencyResolverMain } from '@teambit/dependency-resolver';\nimport fs from 'fs-extra';\nimport path from 'path';\n\nimport { Compiler } from './types';\n\n/**\n * compiler build task. Allows to compile components during component build.\n */\nexport class CompilerTask implements BuildTask {\n readonly description = 'compile components';\n constructor(\n readonly aspectId: string,\n readonly name: string,\n private compilerInstance: Compiler,\n private dependencyResolver: DependencyResolverMain\n ) {\n if (compilerInstance.artifactName) {\n this.description += ` for artifact ${compilerInstance.artifactName}`;\n }\n }\n\n async preBuild(context: BuildContext) {\n await Promise.all(\n context.capsuleNetwork.seedersCapsules.map((capsule) =>\n this.copyNonSupportedFiles(capsule, this.compilerInstance)\n )\n );\n if (!this.compilerInstance.preBuild) return;\n await this.compilerInstance.preBuild(context);\n }\n\n async execute(context: BuildContext): Promise<BuiltTaskResult> {\n const buildResults = await this.compilerInstance.build(context);\n await this._hardLinkBuildArtifactsOnCapsules(context);\n return buildResults;\n }\n\n /**\n * This function hard links the compiled artifacts to the `node_modules` of other component capsules.\n * For instance, if we have a `button` component that is a dependency of the `card` component,\n * then the `dist` folder of the `button` component will be copied to `<card_capsule>/node_modules/button/dist`.\n */\n private async _hardLinkBuildArtifactsOnCapsules(context: BuildContext): Promise<void> {\n await Promise.all(\n context.capsuleNetwork.seedersCapsules.map(async (capsule) => {\n const relCompDir = path.relative(context.capsuleNetwork.capsulesRootDir, capsule.path).replace(/\\\\/g, '/');\n const injectedDirs = await this.dependencyResolver.getInjectedDirs(\n context.capsuleNetwork.capsulesRootDir,\n relCompDir,\n this.dependencyResolver.getPackageName(capsule.component)\n );\n return hardLinkDirectory(\n capsule.path,\n injectedDirs.map((injectedDir) => path.join(context.capsuleNetwork.capsulesRootDir, injectedDir))\n );\n })\n );\n }\n\n async postBuild?(context: BuildContext, tasksResults: TaskResultsList): Promise<void> {\n if (!this.compilerInstance.postBuild) return;\n await this.compilerInstance.postBuild(context, tasksResults);\n }\n\n async copyNonSupportedFiles(capsule: Capsule, compiler: Compiler) {\n if (!compiler.shouldCopyNonSupportedFiles) {\n return;\n }\n const component = capsule.component;\n await Promise.all(\n component.filesystem.files.map(async (file) => {\n if (compiler.isFileSupported(file.path)) return;\n const content = file.contents;\n await fs.outputFile(path.join(capsule.path, compiler.distDir, file.relative), content);\n })\n );\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAEA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAIA;AACA;AACA;AACO,MAAMA,YAAY,CAAsB;EAE7CC,WAAW,CACAC,QAAgB,EAChBC,IAAY,EACbC,gBAA0B,EAC1BC,kBAA0C,EAClD;IAAA,KAJSH,QAAgB,GAAhBA,QAAgB;IAAA,KAChBC,IAAY,GAAZA,IAAY;IAAA,KACbC,gBAA0B,GAA1BA,gBAA0B;IAAA,KAC1BC,kBAA0C,GAA1CA,kBAA0C;IAAA,qDAL7B,oBAAoB;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I,EACZI,YAAY,CAACZ,GAAG,CAAEiB,WAAW,IAAKT,eAAI,CAACU,IAAI,CAACvB,OAAO,CAACG,cAAc,CAACY,eAAe,EAAEO,WAAW,CAAC,CAAC,CAClG;IACH,CAAC,CAAC,CACH;EACH;EAEA,MAAME,SAAS,CAAExB,OAAqB,EAAEyB,YAA6B,EAAiB;IACpF,IAAI,CAAC,IAAI,CAAC9B,gBAAgB,CAAC6B,SAAS,EAAE;IACtC,MAAM,IAAI,CAAC7B,gBAAgB,CAAC6B,SAAS,CAACxB,OAAO,EAAEyB,YAAY,CAAC;EAC9D;EAEA,MAAMlB,qBAAqB,CAACD,OAAgB,EAAEoB,QAAkB,EAAE;IAChE,IAAI,CAACA,QAAQ,CAACC,2BAA2B,EAAE;MACzC;IACF;IACA,MAAMP,SAAS,GAAGd,OAAO,CAACc,SAAS;IACnC,MAAMnB,OAAO,CAACC,GAAG,CACfkB,SAAS,CAACQ,UAAU,CAACC,KAAK,CAACxB,GAAG,CAAC,MAAOyB,IAAI,IAAK;MAC7C,IAAIJ,QAAQ,CAACK,eAAe,CAACD,IAAI,CAACjB,IAAI,CAAC,EAAE;MACzC,MAAMmB,OAAO,GAAGF,IAAI,CAACG,QAAQ;MAC7B,MAAMC,kBAAE,CAACC,UAAU,CAACtB,eAAI,CAACU,IAAI,CAACjB,OAAO,CAACO,IAAI,EAAEa,QAAQ,CAACU,OAAO,EAAEN,IAAI,CAAChB,QAAQ,CAAC,EAAEkB,OAAO,CAAC;IACxF,CAAC,CAAC,CACH;EACH;AACF;AAAC"}
|
package/dist/dist-artifact.js
CHANGED
|
@@ -4,30 +4,23 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.DistArtifact = void 0;
|
|
7
|
-
|
|
8
7
|
function _utils() {
|
|
9
8
|
const data = require("@teambit/legacy/dist/utils");
|
|
10
|
-
|
|
11
9
|
_utils = function () {
|
|
12
10
|
return data;
|
|
13
11
|
};
|
|
14
|
-
|
|
15
12
|
return data;
|
|
16
13
|
}
|
|
17
|
-
|
|
18
14
|
class DistArtifact {
|
|
19
15
|
constructor(artifacts) {
|
|
20
16
|
this.artifacts = artifacts;
|
|
21
17
|
}
|
|
22
|
-
|
|
23
18
|
getFile(path) {
|
|
24
19
|
return this.artifacts.find(file => {
|
|
25
20
|
return (0, _utils().pathNormalizeToLinux)(file.relative) === path;
|
|
26
21
|
});
|
|
27
22
|
}
|
|
28
|
-
|
|
29
23
|
}
|
|
30
|
-
|
|
31
24
|
exports.DistArtifact = DistArtifact;
|
|
32
25
|
|
|
33
26
|
//# sourceMappingURL=dist-artifact.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["DistArtifact","constructor","artifacts","getFile","path","find","file","pathNormalizeToLinux","relative"],"sources":["dist-artifact.ts"],"sourcesContent":["import { AbstractVinyl } from '@teambit/legacy/dist/consumer/component/sources';\nimport { pathNormalizeToLinux } from '@teambit/legacy/dist/utils';\n\nexport class DistArtifact {\n constructor(private artifacts: AbstractVinyl[]) {}\n\n getFile(path: string) {\n return this.artifacts.find((file) => {\n return pathNormalizeToLinux(file.relative) === path;\n });\n }\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["DistArtifact","constructor","artifacts","getFile","path","find","file","pathNormalizeToLinux","relative"],"sources":["dist-artifact.ts"],"sourcesContent":["import { AbstractVinyl } from '@teambit/legacy/dist/consumer/component/sources';\nimport { pathNormalizeToLinux } from '@teambit/legacy/dist/utils';\n\nexport class DistArtifact {\n constructor(private artifacts: AbstractVinyl[]) {}\n\n getFile(path: string) {\n return this.artifacts.find((file) => {\n return pathNormalizeToLinux(file.relative) === path;\n });\n }\n}\n"],"mappings":";;;;;;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEO,MAAMA,YAAY,CAAC;EACxBC,WAAW,CAASC,SAA0B,EAAE;IAAA,KAA5BA,SAA0B,GAA1BA,SAA0B;EAAG;EAEjDC,OAAO,CAACC,IAAY,EAAE;IACpB,OAAO,IAAI,CAACF,SAAS,CAACG,IAAI,CAAEC,IAAI,IAAK;MACnC,OAAO,IAAAC,6BAAoB,EAACD,IAAI,CAACE,QAAQ,CAAC,KAAKJ,IAAI;IACrD,CAAC,CAAC;EACJ;AACF;AAAC"}
|
|
@@ -1,49 +1,38 @@
|
|
|
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.CompilerErrorEvent = void 0;
|
|
9
|
-
|
|
10
8
|
function _defineProperty2() {
|
|
11
9
|
const data = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
12
|
-
|
|
13
10
|
_defineProperty2 = function () {
|
|
14
11
|
return data;
|
|
15
12
|
};
|
|
16
|
-
|
|
17
13
|
return data;
|
|
18
14
|
}
|
|
19
|
-
|
|
20
15
|
function _pubsub() {
|
|
21
16
|
const data = require("@teambit/pubsub");
|
|
22
|
-
|
|
23
17
|
_pubsub = function () {
|
|
24
18
|
return data;
|
|
25
19
|
};
|
|
26
|
-
|
|
27
20
|
return data;
|
|
28
21
|
}
|
|
29
|
-
|
|
30
22
|
/* eslint-disable max-classes-per-file */
|
|
23
|
+
|
|
31
24
|
class CompilerErrorEventData {
|
|
32
25
|
constructor(error) {
|
|
33
26
|
this.error = error;
|
|
34
27
|
}
|
|
35
|
-
|
|
36
28
|
}
|
|
37
|
-
|
|
38
29
|
class CompilerErrorEvent extends _pubsub().BitBaseEvent {
|
|
39
30
|
constructor(error, timestamp = Date.now()) {
|
|
40
31
|
super(CompilerErrorEvent.TYPE, '0.0.1', timestamp, new CompilerErrorEventData(error));
|
|
41
32
|
this.error = error;
|
|
42
33
|
this.timestamp = timestamp;
|
|
43
34
|
}
|
|
44
|
-
|
|
45
35
|
}
|
|
46
|
-
|
|
47
36
|
exports.CompilerErrorEvent = CompilerErrorEvent;
|
|
48
37
|
(0, _defineProperty2().default)(CompilerErrorEvent, "TYPE", 'compiler-error');
|
|
49
38
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["CompilerErrorEventData","constructor","error","CompilerErrorEvent","BitBaseEvent","timestamp","Date","now","TYPE"],"sources":["compiler-error.ts"],"sourcesContent":["/* eslint-disable max-classes-per-file */\nimport { BitBaseEvent } from '@teambit/pubsub';\n\nclass CompilerErrorEventData {\n constructor(readonly error: any) {}\n}\n\nexport class CompilerErrorEvent extends BitBaseEvent<CompilerErrorEventData> {\n static readonly TYPE = 'compiler-error';\n\n constructor(readonly error, readonly timestamp = Date.now()) {\n super(CompilerErrorEvent.TYPE, '0.0.1', timestamp, new CompilerErrorEventData(error));\n }\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["CompilerErrorEventData","constructor","error","CompilerErrorEvent","BitBaseEvent","timestamp","Date","now","TYPE"],"sources":["compiler-error.ts"],"sourcesContent":["/* eslint-disable max-classes-per-file */\nimport { BitBaseEvent } from '@teambit/pubsub';\n\nclass CompilerErrorEventData {\n constructor(readonly error: any) {}\n}\n\nexport class CompilerErrorEvent extends BitBaseEvent<CompilerErrorEventData> {\n static readonly TYPE = 'compiler-error';\n\n constructor(readonly error, readonly timestamp = Date.now()) {\n super(CompilerErrorEvent.TYPE, '0.0.1', timestamp, new CompilerErrorEventData(error));\n }\n}\n"],"mappings":";;;;;;;;;;;;;;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AADA;;AAGA,MAAMA,sBAAsB,CAAC;EAC3BC,WAAW,CAAUC,KAAU,EAAE;IAAA,KAAZA,KAAU,GAAVA,KAAU;EAAG;AACpC;AAEO,MAAMC,kBAAkB,SAASC,sBAAY,CAAyB;EAG3EH,WAAW,CAAUC,KAAK,EAAWG,SAAS,GAAGC,IAAI,CAACC,GAAG,EAAE,EAAE;IAC3D,KAAK,CAACJ,kBAAkB,CAACK,IAAI,EAAE,OAAO,EAAEH,SAAS,EAAE,IAAIL,sBAAsB,CAACE,KAAK,CAAC,CAAC;IAAC,KADnEA,KAAK,GAALA,KAAK;IAAA,KAAWG,SAAS,GAATA,SAAS;EAE9C;AACF;AAAC;AAAA,gCANYF,kBAAkB,UACN,gBAAgB"}
|
|
@@ -1,42 +1,33 @@
|
|
|
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.ComponentCompilationOnDoneEvent = void 0;
|
|
9
|
-
|
|
10
8
|
function _defineProperty2() {
|
|
11
9
|
const data = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
12
|
-
|
|
13
10
|
_defineProperty2 = function () {
|
|
14
11
|
return data;
|
|
15
12
|
};
|
|
16
|
-
|
|
17
13
|
return data;
|
|
18
14
|
}
|
|
19
|
-
|
|
20
15
|
function _pubsub() {
|
|
21
16
|
const data = require("@teambit/pubsub");
|
|
22
|
-
|
|
23
17
|
_pubsub = function () {
|
|
24
18
|
return data;
|
|
25
19
|
};
|
|
26
|
-
|
|
27
20
|
return data;
|
|
28
21
|
}
|
|
29
|
-
|
|
30
22
|
/* eslint-disable max-classes-per-file */
|
|
23
|
+
|
|
31
24
|
class ComponentCompilationOnDoneEventData {
|
|
32
25
|
constructor(errors, component, buildResults) {
|
|
33
26
|
this.errors = errors;
|
|
34
27
|
this.component = component;
|
|
35
28
|
this.buildResults = buildResults;
|
|
36
29
|
}
|
|
37
|
-
|
|
38
30
|
}
|
|
39
|
-
|
|
40
31
|
class ComponentCompilationOnDoneEvent extends _pubsub().BitBaseEvent {
|
|
41
32
|
constructor(errors, component, buildResults, timestamp = Date.now()) {
|
|
42
33
|
super(ComponentCompilationOnDoneEvent.TYPE, '0.0.1', timestamp, new ComponentCompilationOnDoneEventData(errors, component, buildResults));
|
|
@@ -45,9 +36,7 @@ class ComponentCompilationOnDoneEvent extends _pubsub().BitBaseEvent {
|
|
|
45
36
|
this.buildResults = buildResults;
|
|
46
37
|
this.timestamp = timestamp;
|
|
47
38
|
}
|
|
48
|
-
|
|
49
39
|
}
|
|
50
|
-
|
|
51
40
|
exports.ComponentCompilationOnDoneEvent = ComponentCompilationOnDoneEvent;
|
|
52
41
|
(0, _defineProperty2().default)(ComponentCompilationOnDoneEvent, "TYPE", 'component-compilation-on-done');
|
|
53
42
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["ComponentCompilationOnDoneEventData","constructor","errors","component","buildResults","ComponentCompilationOnDoneEvent","BitBaseEvent","timestamp","Date","now","TYPE"],"sources":["component-compilation-on-done.ts"],"sourcesContent":["/* eslint-disable max-classes-per-file */\nimport { BitBaseEvent } from '@teambit/pubsub';\nimport { Component } from '@teambit/component';\nimport { CompileError } from '../workspace-compiler';\n\nclass ComponentCompilationOnDoneEventData {\n constructor(readonly errors: Array<CompileError>, readonly component: Component, readonly buildResults: string[]) {}\n}\n\nexport class ComponentCompilationOnDoneEvent extends BitBaseEvent<ComponentCompilationOnDoneEventData> {\n static readonly TYPE = 'component-compilation-on-done';\n\n constructor(\n readonly errors: Array<CompileError>,\n readonly component: Component,\n readonly buildResults: string[],\n readonly timestamp = Date.now()\n ) {\n super(\n ComponentCompilationOnDoneEvent.TYPE,\n '0.0.1',\n timestamp,\n new ComponentCompilationOnDoneEventData(errors, component, buildResults)\n );\n }\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["ComponentCompilationOnDoneEventData","constructor","errors","component","buildResults","ComponentCompilationOnDoneEvent","BitBaseEvent","timestamp","Date","now","TYPE"],"sources":["component-compilation-on-done.ts"],"sourcesContent":["/* eslint-disable max-classes-per-file */\nimport { BitBaseEvent } from '@teambit/pubsub';\nimport { Component } from '@teambit/component';\nimport { CompileError } from '../workspace-compiler';\n\nclass ComponentCompilationOnDoneEventData {\n constructor(readonly errors: Array<CompileError>, readonly component: Component, readonly buildResults: string[]) {}\n}\n\nexport class ComponentCompilationOnDoneEvent extends BitBaseEvent<ComponentCompilationOnDoneEventData> {\n static readonly TYPE = 'component-compilation-on-done';\n\n constructor(\n readonly errors: Array<CompileError>,\n readonly component: Component,\n readonly buildResults: string[],\n readonly timestamp = Date.now()\n ) {\n super(\n ComponentCompilationOnDoneEvent.TYPE,\n '0.0.1',\n timestamp,\n new ComponentCompilationOnDoneEventData(errors, component, buildResults)\n );\n }\n}\n"],"mappings":";;;;;;;;;;;;;;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AADA;;AAKA,MAAMA,mCAAmC,CAAC;EACxCC,WAAW,CAAUC,MAA2B,EAAWC,SAAoB,EAAWC,YAAsB,EAAE;IAAA,KAA7FF,MAA2B,GAA3BA,MAA2B;IAAA,KAAWC,SAAoB,GAApBA,SAAoB;IAAA,KAAWC,YAAsB,GAAtBA,YAAsB;EAAG;AACrH;AAEO,MAAMC,+BAA+B,SAASC,sBAAY,CAAsC;EAGrGL,WAAW,CACAC,MAA2B,EAC3BC,SAAoB,EACpBC,YAAsB,EACtBG,SAAS,GAAGC,IAAI,CAACC,GAAG,EAAE,EAC/B;IACA,KAAK,CACHJ,+BAA+B,CAACK,IAAI,EACpC,OAAO,EACPH,SAAS,EACT,IAAIP,mCAAmC,CAACE,MAAM,EAAEC,SAAS,EAAEC,YAAY,CAAC,CACzE;IAAC,KAVOF,MAA2B,GAA3BA,MAA2B;IAAA,KAC3BC,SAAoB,GAApBA,SAAoB;IAAA,KACpBC,YAAsB,GAAtBA,YAAsB;IAAA,KACtBG,SAAS,GAATA,SAAS;EAQpB;AACF;AAAC;AAAA,gCAhBYF,+BAA+B,UACnB,+BAA+B"}
|
package/dist/events/index.js
CHANGED
|
@@ -3,9 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
|
|
7
6
|
var _compilerError = require("./compiler-error");
|
|
8
|
-
|
|
9
7
|
Object.keys(_compilerError).forEach(function (key) {
|
|
10
8
|
if (key === "default" || key === "__esModule") return;
|
|
11
9
|
if (key in exports && exports[key] === _compilerError[key]) return;
|
|
@@ -16,9 +14,7 @@ Object.keys(_compilerError).forEach(function (key) {
|
|
|
16
14
|
}
|
|
17
15
|
});
|
|
18
16
|
});
|
|
19
|
-
|
|
20
17
|
var _componentCompilationOnDone = require("./component-compilation-on-done");
|
|
21
|
-
|
|
22
18
|
Object.keys(_componentCompilationOnDone).forEach(function (key) {
|
|
23
19
|
if (key === "default" || key === "__esModule") return;
|
|
24
20
|
if (key in exports && exports[key] === _componentCompilationOnDone[key]) return;
|
package/dist/events/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export * from './compiler-error';\nexport * from './component-compilation-on-done';\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export * from './compiler-error';\nexport * from './component-compilation-on-done';\n"],"mappings":";;;;;AAAA;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;AACA;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA"}
|
|
@@ -4,25 +4,19 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.DistArtifactNotFound = void 0;
|
|
7
|
-
|
|
8
7
|
function _bitError() {
|
|
9
8
|
const data = require("@teambit/bit-error");
|
|
10
|
-
|
|
11
9
|
_bitError = function () {
|
|
12
10
|
return data;
|
|
13
11
|
};
|
|
14
|
-
|
|
15
12
|
return data;
|
|
16
13
|
}
|
|
17
|
-
|
|
18
14
|
class DistArtifactNotFound extends _bitError().BitError {
|
|
19
15
|
constructor(componentId) {
|
|
20
16
|
super(`dist artifact for component ${componentId.toString()} was not found`);
|
|
21
17
|
this.componentId = componentId;
|
|
22
18
|
}
|
|
23
|
-
|
|
24
19
|
}
|
|
25
|
-
|
|
26
20
|
exports.DistArtifactNotFound = DistArtifactNotFound;
|
|
27
21
|
|
|
28
22
|
//# sourceMappingURL=dist-artifact-not-found.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["DistArtifactNotFound","BitError","constructor","componentId","toString"],"sources":["dist-artifact-not-found.ts"],"sourcesContent":["import { ComponentID } from '@teambit/component';\nimport { BitError } from '@teambit/bit-error';\n\nexport class DistArtifactNotFound extends BitError {\n constructor(readonly componentId: ComponentID) {\n super(`dist artifact for component ${componentId.toString()} was not found`);\n }\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["DistArtifactNotFound","BitError","constructor","componentId","toString"],"sources":["dist-artifact-not-found.ts"],"sourcesContent":["import { ComponentID } from '@teambit/component';\nimport { BitError } from '@teambit/bit-error';\n\nexport class DistArtifactNotFound extends BitError {\n constructor(readonly componentId: ComponentID) {\n super(`dist artifact for component ${componentId.toString()} was not found`);\n }\n}\n"],"mappings":";;;;;;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEO,MAAMA,oBAAoB,SAASC,oBAAQ,CAAC;EACjDC,WAAW,CAAUC,WAAwB,EAAE;IAC7C,KAAK,CAAE,+BAA8BA,WAAW,CAACC,QAAQ,EAAG,gBAAe,CAAC;IAAC,KAD1DD,WAAwB,GAAxBA,WAAwB;EAE7C;AACF;AAAC"}
|
package/dist/exceptions/index.js
CHANGED
|
@@ -9,14 +9,11 @@ Object.defineProperty(exports, "DistArtifactNotFound", {
|
|
|
9
9
|
return _distArtifactNotFound().DistArtifactNotFound;
|
|
10
10
|
}
|
|
11
11
|
});
|
|
12
|
-
|
|
13
12
|
function _distArtifactNotFound() {
|
|
14
13
|
const data = require("./dist-artifact-not-found");
|
|
15
|
-
|
|
16
14
|
_distArtifactNotFound = function () {
|
|
17
15
|
return data;
|
|
18
16
|
};
|
|
19
|
-
|
|
20
17
|
return data;
|
|
21
18
|
}
|
|
22
19
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export { DistArtifactNotFound } from './dist-artifact-not-found';\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export { DistArtifactNotFound } from './dist-artifact-not-found';\n"],"mappings":";;;;;;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA"}
|
package/dist/index.js
CHANGED
|
@@ -54,29 +54,21 @@ Object.defineProperty(exports, "TranspileFileParams", {
|
|
|
54
54
|
return _types().TranspileFileParams;
|
|
55
55
|
}
|
|
56
56
|
});
|
|
57
|
-
|
|
58
57
|
function _compiler() {
|
|
59
58
|
const data = require("./compiler.aspect");
|
|
60
|
-
|
|
61
59
|
_compiler = function () {
|
|
62
60
|
return data;
|
|
63
61
|
};
|
|
64
|
-
|
|
65
62
|
return data;
|
|
66
63
|
}
|
|
67
|
-
|
|
68
64
|
function _types() {
|
|
69
65
|
const data = require("./types");
|
|
70
|
-
|
|
71
66
|
_types = function () {
|
|
72
67
|
return data;
|
|
73
68
|
};
|
|
74
|
-
|
|
75
69
|
return data;
|
|
76
70
|
}
|
|
77
|
-
|
|
78
71
|
var _events = require("./events");
|
|
79
|
-
|
|
80
72
|
Object.keys(_events).forEach(function (key) {
|
|
81
73
|
if (key === "default" || key === "__esModule") return;
|
|
82
74
|
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export type { CompilerMain } from './compiler.main.runtime';\nexport { CompilerAspect } from './compiler.aspect';\nexport {\n Compiler,\n CompilerOptions,\n CompilationInitiator,\n TranspileFileOutput,\n TranspileFileParams,\n TranspileComponentParams,\n} from './types';\nexport * from './events';\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export type { CompilerMain } from './compiler.main.runtime';\nexport { CompilerAspect } from './compiler.aspect';\nexport {\n Compiler,\n CompilerOptions,\n CompilationInitiator,\n TranspileFileOutput,\n TranspileFileParams,\n TranspileComponentParams,\n} from './types';\nexport * from './events';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAQA;AAAA;EAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA"}
|