@teambit/compiler 0.0.554 → 0.0.555
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.main.runtime.d.ts +12 -1
- package/dist/compiler.task.d.ts +3 -0
- package/dist/types.d.ts +64 -0
- package/dist/workspace-compiler.d.ts +7 -1
- package/package-tar/teambit-compiler-0.0.555.tgz +0 -0
- package/package.json +17 -17
- package/tsconfig.json +0 -1
- package/package-tar/teambit-compiler-0.0.554.tgz +0 -0
|
@@ -18,8 +18,19 @@ export declare class CompilerMain {
|
|
|
18
18
|
private envs;
|
|
19
19
|
private builder;
|
|
20
20
|
constructor(pubsub: PubsubMain, workspaceCompiler: WorkspaceCompiler, envs: EnvsMain, builder: BuilderMain);
|
|
21
|
-
|
|
21
|
+
/**
|
|
22
|
+
* Run compilation on `bit new` and when new components are imported
|
|
23
|
+
*/
|
|
24
|
+
compileOnWorkspace(componentsIds?: string[] | BitId[], // when empty, it compiles all
|
|
25
|
+
options?: CompileOptions): Promise<import("./workspace-compiler").BuildResult[]>;
|
|
26
|
+
/**
|
|
27
|
+
* API to create a new compiler task, it facilitates the usage of multiple compilers.
|
|
28
|
+
* with this method you can create any number of compilers and add them to the buildPipeline.
|
|
29
|
+
*/
|
|
22
30
|
createTask(name: string, compiler: Compiler): CompilerTask;
|
|
31
|
+
/**
|
|
32
|
+
* find the compiler configured on the workspace and ask for the dist path.
|
|
33
|
+
*/
|
|
23
34
|
getDistPathBySrcPath(component: Component, srcPath: string): string | null;
|
|
24
35
|
getDistsFiles(component: Component): Promise<DistArtifact>;
|
|
25
36
|
static runtime: import("@teambit/harmony").RuntimeDefinition;
|
package/dist/compiler.task.d.ts
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { BuildContext, BuiltTaskResult, BuildTask, TaskResultsList } from '@teambit/builder';
|
|
2
2
|
import { Capsule } from '@teambit/isolator';
|
|
3
3
|
import { Compiler } from './types';
|
|
4
|
+
/**
|
|
5
|
+
* compiler build task. Allows to compile components during component build.
|
|
6
|
+
*/
|
|
4
7
|
export declare class CompilerTask implements BuildTask {
|
|
5
8
|
readonly aspectId: string;
|
|
6
9
|
readonly name: string;
|
package/dist/types.d.ts
CHANGED
|
@@ -26,24 +26,88 @@ export declare type TranspileFileOutput = {
|
|
|
26
26
|
outputPath: string;
|
|
27
27
|
}[] | null;
|
|
28
28
|
export interface CompilerOptions {
|
|
29
|
+
/**
|
|
30
|
+
* name of the compiler.
|
|
31
|
+
*/
|
|
29
32
|
name?: string;
|
|
33
|
+
/**
|
|
34
|
+
* relative path of the dist directory inside the capsule. e.g. "dist".
|
|
35
|
+
*/
|
|
30
36
|
distDir: string;
|
|
37
|
+
/**
|
|
38
|
+
* determines which ones of the generated files will be saved in the bit objects when tagging.
|
|
39
|
+
* e.g. distGlobPatterns = [`${this.distDir}/**`, `!${this.distDir}/tsconfig.tsbuildinfo`];
|
|
40
|
+
* see https://github.com/mrmlnc/fast-glob for the supported glob patters syntax.
|
|
41
|
+
*/
|
|
31
42
|
distGlobPatterns?: string[];
|
|
43
|
+
/**
|
|
44
|
+
* whether or not unsupported files (such as assets) should be copied into the dist directory
|
|
45
|
+
*/
|
|
32
46
|
shouldCopyNonSupportedFiles?: boolean;
|
|
47
|
+
/**
|
|
48
|
+
* optional. default to "dist".
|
|
49
|
+
* useful when the build pipeline has multiple compiler tasks of the same compiler.
|
|
50
|
+
* e.g. using the same Babel compiler for two different tasks, one for creating "es5" files, and
|
|
51
|
+
* the second for creating "esm". the artifact names would be "es5" and "esm" accordingly.
|
|
52
|
+
*/
|
|
33
53
|
artifactName?: string;
|
|
34
54
|
}
|
|
35
55
|
export interface Compiler extends CompilerOptions {
|
|
56
|
+
/**
|
|
57
|
+
* id of the compiler.
|
|
58
|
+
*/
|
|
36
59
|
id: string;
|
|
60
|
+
/**
|
|
61
|
+
* serialized config of the compiler.
|
|
62
|
+
*/
|
|
37
63
|
displayConfig?(): string;
|
|
64
|
+
/**
|
|
65
|
+
* transpile a single file that gets saved into the workspace, used by `bit compile` and during
|
|
66
|
+
* development
|
|
67
|
+
*/
|
|
38
68
|
transpileFile?: (fileContent: string, params: TranspileFileParams) => TranspileFileOutput;
|
|
69
|
+
/**
|
|
70
|
+
* transpile all the files of a component, use this when you can't use `transpileFile`
|
|
71
|
+
*/
|
|
39
72
|
transpileComponent?: (params: TranspileComponentParams) => Promise<void>;
|
|
73
|
+
/**
|
|
74
|
+
* compile components inside isolated capsules. this being used during tag for the release.
|
|
75
|
+
* meaning, the final package of the component has the dists generated by this method.
|
|
76
|
+
*/
|
|
40
77
|
build(context: BuildContext): Promise<BuiltTaskResult>;
|
|
78
|
+
/**
|
|
79
|
+
* given a source file, return its parallel in the dists. e.g. "index.ts" => "dist/index.js"
|
|
80
|
+
* both, the return path and the given path are relative paths.
|
|
81
|
+
*/
|
|
41
82
|
getDistPathBySrcPath(srcPath: string): string;
|
|
83
|
+
/**
|
|
84
|
+
* given a component, returns the path to the source folder to use for the preview, uses the one
|
|
85
|
+
* in node_modules by default
|
|
86
|
+
*/
|
|
42
87
|
getPreviewComponentRootPath?(component: Component): string;
|
|
88
|
+
/**
|
|
89
|
+
* only supported files matching get compiled. others, are copied to the dist dir.
|
|
90
|
+
*/
|
|
43
91
|
isFileSupported(filePath: string): boolean;
|
|
92
|
+
/**
|
|
93
|
+
* sugar to create a Compiler task via the concrete compiler
|
|
94
|
+
*/
|
|
44
95
|
createTask?(name?: string): BuildTask;
|
|
96
|
+
/**
|
|
97
|
+
* run before the build pipeline has started. this is useful when some preparation are needed to
|
|
98
|
+
* be done on all envs before the build starts.
|
|
99
|
+
*/
|
|
45
100
|
preBuild?(context: BuildContext): Promise<void>;
|
|
101
|
+
/**
|
|
102
|
+
* run after the build pipeline completed for all envs. useful for some cleanups
|
|
103
|
+
*/
|
|
46
104
|
postBuild?(context: BuildContext, tasksResults: TaskResultsList): Promise<void>;
|
|
105
|
+
/**
|
|
106
|
+
* returns the version of the current compiler instance (e.g. '4.0.1').
|
|
107
|
+
*/
|
|
47
108
|
version(): string;
|
|
109
|
+
/**
|
|
110
|
+
* returns the display name of the current compiler instance (e.g. 'TypeScript')
|
|
111
|
+
*/
|
|
48
112
|
displayName: string;
|
|
49
113
|
}
|
|
@@ -17,6 +17,11 @@ export declare type BuildResult = {
|
|
|
17
17
|
export declare type CompileOptions = {
|
|
18
18
|
changed?: boolean;
|
|
19
19
|
verbose?: boolean;
|
|
20
|
+
/**
|
|
21
|
+
* whether the dist root dir should be deleted before writing new dists.
|
|
22
|
+
* defaults to true for `bit compile` and false everywhere else, such as `bit watch` and `bit
|
|
23
|
+
* start` to avoid webpack "EINTR" error.
|
|
24
|
+
*/
|
|
20
25
|
deleteDistDir?: boolean;
|
|
21
26
|
initiator: CompilationInitiator;
|
|
22
27
|
};
|
|
@@ -55,6 +60,7 @@ export declare class WorkspaceCompiler {
|
|
|
55
60
|
}, id: ComponentID): Promise<boolean>;
|
|
56
61
|
onComponentChange(component: Component, files: string[], initiator?: CompilationInitiator): Promise<SerializableResults>;
|
|
57
62
|
onPreWatch(components: Component[], watchOpts: WatchOptions): Promise<void>;
|
|
58
|
-
compileComponents(componentsIds: string[] | BitId[],
|
|
63
|
+
compileComponents(componentsIds: string[] | BitId[], // when empty, it compiles new+modified (unless options.all is set),
|
|
64
|
+
options: CompileOptions, noThrow?: boolean): Promise<BuildResult[]>;
|
|
59
65
|
private getIdsToCompile;
|
|
60
66
|
}
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@teambit/compiler",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.555",
|
|
4
4
|
"homepage": "https://bit.dev/teambit/compilation/compiler",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"componentId": {
|
|
7
7
|
"scope": "teambit.compilation",
|
|
8
8
|
"name": "compiler",
|
|
9
|
-
"version": "0.0.
|
|
9
|
+
"version": "0.0.555"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@teambit/harmony": "0.2.11",
|
|
@@ -18,18 +18,18 @@
|
|
|
18
18
|
"p-map-series": "2.1.0",
|
|
19
19
|
"@babel/runtime": "7.12.18",
|
|
20
20
|
"core-js": "^3.0.0",
|
|
21
|
-
"@teambit/cli": "0.0.
|
|
22
|
-
"@teambit/logger": "0.0.
|
|
23
|
-
"@teambit/pubsub": "0.0.
|
|
24
|
-
"@teambit/aspect-loader": "0.0.
|
|
25
|
-
"@teambit/builder": "0.0.
|
|
26
|
-
"@teambit/component": "0.0.
|
|
27
|
-
"@teambit/envs": "0.0.
|
|
28
|
-
"@teambit/legacy-bit-id": "0.0.
|
|
29
|
-
"@teambit/ui": "0.0.
|
|
30
|
-
"@teambit/workspace": "0.0.
|
|
31
|
-
"@teambit/isolator": "0.0.
|
|
32
|
-
"@teambit/bit-error": "0.0.
|
|
21
|
+
"@teambit/cli": "0.0.386",
|
|
22
|
+
"@teambit/logger": "0.0.471",
|
|
23
|
+
"@teambit/pubsub": "0.0.555",
|
|
24
|
+
"@teambit/aspect-loader": "0.0.555",
|
|
25
|
+
"@teambit/builder": "0.0.555",
|
|
26
|
+
"@teambit/component": "0.0.555",
|
|
27
|
+
"@teambit/envs": "0.0.555",
|
|
28
|
+
"@teambit/legacy-bit-id": "0.0.375",
|
|
29
|
+
"@teambit/ui": "0.0.555",
|
|
30
|
+
"@teambit/workspace": "0.0.555",
|
|
31
|
+
"@teambit/isolator": "0.0.555",
|
|
32
|
+
"@teambit/bit-error": "0.0.372"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
35
|
"@types/react": "^17.0.8",
|
|
@@ -39,10 +39,10 @@
|
|
|
39
39
|
"@types/jest": "^26.0.0",
|
|
40
40
|
"@types/react-dom": "^17.0.5",
|
|
41
41
|
"@types/node": "12.20.4",
|
|
42
|
-
"@teambit/compilation.aspect-docs.compiler": "0.0.
|
|
42
|
+
"@teambit/compilation.aspect-docs.compiler": "0.0.105"
|
|
43
43
|
},
|
|
44
44
|
"peerDependencies": {
|
|
45
|
-
"@teambit/legacy": "1.0.
|
|
45
|
+
"@teambit/legacy": "1.0.172",
|
|
46
46
|
"react-dom": "^16.8.0 || ^17.0.0",
|
|
47
47
|
"react": "^16.8.0 || ^17.0.0"
|
|
48
48
|
},
|
|
@@ -70,7 +70,7 @@
|
|
|
70
70
|
"react": "-"
|
|
71
71
|
},
|
|
72
72
|
"peerDependencies": {
|
|
73
|
-
"@teambit/legacy": "1.0.
|
|
73
|
+
"@teambit/legacy": "1.0.172",
|
|
74
74
|
"react-dom": "^16.8.0 || ^17.0.0",
|
|
75
75
|
"react": "^16.8.0 || ^17.0.0"
|
|
76
76
|
}
|
package/tsconfig.json
CHANGED
|
Binary file
|