@teambit/typescript 0.0.549 → 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.
@@ -1,8 +1,22 @@
1
1
  import type { CompilerOptions } from '@teambit/compiler';
2
2
  export declare type TypeScriptCompilerOptions = {
3
+ /**
4
+ * tsconfig to use during compilation.
5
+ */
3
6
  tsconfig: Record<string, any>;
7
+ /**
8
+ * path for .d.ts files to include during build.
9
+ */
4
10
  types: string[];
11
+ /**
12
+ * Run the compiler for .js files. this will only affect whether to run the compiler on the files
13
+ * or not. It won't change the tsconfig to support or not support js files.
14
+ */
5
15
  compileJs?: boolean;
16
+ /**
17
+ * Run the compiler for .js files. this will only affect whether to run the compiler on the files
18
+ * or not. It won't change the tsconfig to support or not support jsx files.
19
+ */
6
20
  compileJsx?: boolean;
7
21
  } & Partial<CompilerOptions>;
8
22
  export declare type TsCompilerOptionsWithoutTsConfig = Omit<TypeScriptCompilerOptions, 'tsconfig'>;
@@ -15,8 +15,14 @@ export declare class TypescriptCompiler implements Compiler {
15
15
  constructor(id: string, logger: Logger, options: TypeScriptCompilerOptions, tsModule: typeof ts);
16
16
  displayName: string;
17
17
  displayConfig(): string;
18
+ /**
19
+ * compile one file on the workspace
20
+ */
18
21
  transpileFile(fileContent: string, options: TranspileFileParams): TranspileFileOutput;
19
22
  preBuild(context: BuildContext): Promise<void>;
23
+ /**
24
+ * compile multiple components on the capsules
25
+ */
20
26
  build(context: BuildContext): Promise<BuiltTaskResult>;
21
27
  postBuild(context: BuildContext): Promise<void>;
22
28
  getArtifactDefinition(): {
@@ -24,11 +30,29 @@ export declare class TypescriptCompiler implements Compiler {
24
30
  name: string;
25
31
  globPatterns: string[];
26
32
  }[];
33
+ /**
34
+ * given a source file, return its parallel in the dists. e.g. index.ts => dist/index.js
35
+ */
27
36
  getDistPathBySrcPath(srcPath: string): string;
37
+ /**
38
+ * whether typescript is able to compile the given path
39
+ */
28
40
  isFileSupported(filePath: string): boolean;
41
+ /**
42
+ * we have two options here:
43
+ * 1. pass all capsules-dir at the second parameter of createSolutionBuilder and then no
44
+ * need to write the main tsconfig.json with all the references.
45
+ * 2. write main tsconfig.json and pass the capsules root-dir.
46
+ * we went with option #2 because it'll be easier for users to go to the capsule-root and run
47
+ * `tsc --build` to debug issues.
48
+ */
29
49
  private runTscBuild;
30
50
  private getFormatDiagnosticsHost;
31
51
  private writeTypes;
52
+ /**
53
+ * when using project-references, typescript adds a file "tsconfig.tsbuildinfo" which is not
54
+ * needed for the package.
55
+ */
32
56
  private writeNpmIgnore;
33
57
  private writeProjectReferencesTsConfig;
34
58
  private writeTsConfig;
@@ -15,11 +15,37 @@ export declare class TypescriptMain {
15
15
  private workspace?;
16
16
  private tsServer;
17
17
  constructor(logger: Logger, workspace?: Workspace | undefined);
18
+ /**
19
+ * create a new compiler.
20
+ */
18
21
  createCompiler(options: TypeScriptCompilerOptions, transformers?: TsConfigTransformer[], tsModule?: typeof ts): Compiler;
22
+ /**
23
+ * get TsserverClient instance if initiated already, otherwise, return undefined.
24
+ */
19
25
  getTsserverClient(): TsserverClient | undefined;
26
+ /**
27
+ * starts a tsserver process to communicate with its API.
28
+ * @param projectPath absolute path of the project root directory
29
+ * @param options TsserverClientOpts
30
+ * @param files optionally, if check-types is enabled, provide files to open and type check.
31
+ * @returns TsserverClient
32
+ */
20
33
  initTsserverClient(projectPath: string, options?: TsserverClientOpts, files?: string[]): Promise<TsserverClient>;
34
+ /**
35
+ * starts a tsserver process to communicate with its API. use only when running on the workspace.
36
+ * @param options TsserverClientOpts
37
+ * @param files optionally, if check-types is enabled, provide files to open and type check.
38
+ * @returns TsserverClient
39
+ */
21
40
  initTsserverClientFromWorkspace(options?: TsserverClientOpts, files?: string[]): Promise<TsserverClient>;
41
+ /**
42
+ * create an instance of a typescript semantic schema extractor.
43
+ */
22
44
  createSchemaExtractor(tsconfig: TsConfigSourceFile): SchemaExtractor;
45
+ /**
46
+ * add the default package json properties to the component
47
+ * :TODO @gilad why do we need this DSL? can't I just get the args here.
48
+ */
23
49
  getPackageJsonProps(): PackageJsonProps;
24
50
  private getAllFilesForTsserver;
25
51
  private onPreWatch;
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@teambit/typescript",
3
- "version": "0.0.549",
3
+ "version": "0.0.555",
4
4
  "homepage": "https://bit.dev/teambit/typescript/typescript",
5
5
  "main": "dist/index.js",
6
6
  "componentId": {
7
7
  "scope": "teambit.typescript",
8
8
  "name": "typescript",
9
- "version": "0.0.549"
9
+ "version": "0.0.555"
10
10
  },
11
11
  "dependencies": {
12
12
  "@teambit/harmony": "0.2.11",
@@ -16,18 +16,18 @@
16
16
  "p-map-series": "2.1.0",
17
17
  "@babel/runtime": "7.12.18",
18
18
  "core-js": "^3.0.0",
19
- "@teambit/compiler": "0.0.549",
20
- "@teambit/typescript.modules.ts-config-mutator": "0.0.39",
21
- "@teambit/bit-error": "0.0.366",
22
- "@teambit/builder": "0.0.549",
23
- "@teambit/isolator": "0.0.549",
24
- "@teambit/logger": "0.0.465",
25
- "@teambit/component": "0.0.549",
26
- "@teambit/schema": "0.0.549",
27
- "@teambit/cli": "0.0.380",
28
- "@teambit/pkg": "0.0.549",
29
- "@teambit/ts-server": "0.0.3",
30
- "@teambit/workspace": "0.0.549"
19
+ "@teambit/compiler": "0.0.555",
20
+ "@teambit/typescript.modules.ts-config-mutator": "0.0.43",
21
+ "@teambit/bit-error": "0.0.372",
22
+ "@teambit/builder": "0.0.555",
23
+ "@teambit/isolator": "0.0.555",
24
+ "@teambit/logger": "0.0.471",
25
+ "@teambit/component": "0.0.555",
26
+ "@teambit/schema": "0.0.555",
27
+ "@teambit/cli": "0.0.386",
28
+ "@teambit/pkg": "0.0.555",
29
+ "@teambit/ts-server": "0.0.9",
30
+ "@teambit/workspace": "0.0.555"
31
31
  },
32
32
  "devDependencies": {
33
33
  "chai": "4.3.0",
@@ -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/typescript.aspect-docs.typescript": "0.0.101"
42
+ "@teambit/typescript.aspect-docs.typescript": "0.0.105"
43
43
  },
44
44
  "peerDependencies": {
45
- "@teambit/legacy": "1.0.76",
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.76",
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
@@ -25,7 +25,6 @@
25
25
  "strict": true,
26
26
  "noImplicitAny": false,
27
27
  "rootDir": ".",
28
- "removeComments": true,
29
28
  "preserveConstEnums": true,
30
29
  "resolveJsonModule": true
31
30
  },