@teambit/typescript 0.0.1103 → 0.0.1104
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/index.d.ts +0 -3
- package/dist/index.js +1 -29
- package/dist/index.js.map +1 -1
- package/dist/{preview-1689131730552.js → preview-1689218262868.js} +2 -2
- package/dist/typescript.compiler.d.ts +1 -6
- package/dist/typescript.compiler.js +0 -6
- package/dist/typescript.compiler.js.map +1 -1
- package/dist/typescript.main.runtime.d.ts +2 -5
- package/dist/typescript.main.runtime.js +2 -24
- package/dist/typescript.main.runtime.js.map +1 -1
- package/package-tar/teambit-typescript-0.0.1104.tgz +0 -0
- package/package.json +20 -22
- package/tsconfig.json +1 -1
- package/dist/expand-include-exclude.d.ts +0 -10
- package/dist/expand-include-exclude.js +0 -55
- package/dist/expand-include-exclude.js.map +0 -1
- package/dist/ts-config-writer.d.ts +0 -19
- package/dist/ts-config-writer.js +0 -174
- package/dist/ts-config-writer.js.map +0 -1
- package/dist/typescript-compiler-interface.d.ts +0 -8
- package/dist/typescript-compiler-interface.js +0 -3
- package/dist/typescript-compiler-interface.js.map +0 -1
- package/package-tar/teambit-typescript-0.0.1103.tgz +0 -0
package/dist/index.d.ts
CHANGED
|
@@ -4,7 +4,4 @@ export { TypescriptCompiler } from './typescript.compiler';
|
|
|
4
4
|
export type { TypescriptMain, TsConfigTransformer } from './typescript.main.runtime';
|
|
5
5
|
export type { TypeScriptCompilerOptions, TsCompilerOptionsWithoutTsConfig } from './compiler-options';
|
|
6
6
|
export { TypescriptAspect } from './typescript.aspect';
|
|
7
|
-
export type { TypescriptCompilerInterface } from './typescript-compiler-interface';
|
|
8
|
-
export { expandIncludeExclude } from './expand-include-exclude';
|
|
9
|
-
export { GLOBAL_TYPES_DIR } from './ts-config-writer';
|
|
10
7
|
export * from './sourceFileTransformers';
|
package/dist/index.js
CHANGED
|
@@ -7,16 +7,8 @@ var _exportNames = {
|
|
|
7
7
|
TypescriptConfigMutator: true,
|
|
8
8
|
TypeScriptExtractor: true,
|
|
9
9
|
TypescriptCompiler: true,
|
|
10
|
-
TypescriptAspect: true
|
|
11
|
-
expandIncludeExclude: true,
|
|
12
|
-
GLOBAL_TYPES_DIR: true
|
|
10
|
+
TypescriptAspect: true
|
|
13
11
|
};
|
|
14
|
-
Object.defineProperty(exports, "GLOBAL_TYPES_DIR", {
|
|
15
|
-
enumerable: true,
|
|
16
|
-
get: function () {
|
|
17
|
-
return _tsConfigWriter().GLOBAL_TYPES_DIR;
|
|
18
|
-
}
|
|
19
|
-
});
|
|
20
12
|
Object.defineProperty(exports, "TypeScriptExtractor", {
|
|
21
13
|
enumerable: true,
|
|
22
14
|
get: function () {
|
|
@@ -41,12 +33,6 @@ Object.defineProperty(exports, "TypescriptConfigMutator", {
|
|
|
41
33
|
return _typescriptModules().TypescriptConfigMutator;
|
|
42
34
|
}
|
|
43
35
|
});
|
|
44
|
-
Object.defineProperty(exports, "expandIncludeExclude", {
|
|
45
|
-
enumerable: true,
|
|
46
|
-
get: function () {
|
|
47
|
-
return _expandIncludeExclude().expandIncludeExclude;
|
|
48
|
-
}
|
|
49
|
-
});
|
|
50
36
|
function _typescriptModules() {
|
|
51
37
|
const data = require("@teambit/typescript.modules.ts-config-mutator");
|
|
52
38
|
_typescriptModules = function () {
|
|
@@ -75,20 +61,6 @@ function _typescript3() {
|
|
|
75
61
|
};
|
|
76
62
|
return data;
|
|
77
63
|
}
|
|
78
|
-
function _expandIncludeExclude() {
|
|
79
|
-
const data = require("./expand-include-exclude");
|
|
80
|
-
_expandIncludeExclude = function () {
|
|
81
|
-
return data;
|
|
82
|
-
};
|
|
83
|
-
return data;
|
|
84
|
-
}
|
|
85
|
-
function _tsConfigWriter() {
|
|
86
|
-
const data = require("./ts-config-writer");
|
|
87
|
-
_tsConfigWriter = function () {
|
|
88
|
-
return data;
|
|
89
|
-
};
|
|
90
|
-
return data;
|
|
91
|
-
}
|
|
92
64
|
var _sourceFileTransformers = require("./sourceFileTransformers");
|
|
93
65
|
Object.keys(_sourceFileTransformers).forEach(function (key) {
|
|
94
66
|
if (key === "default" || key === "__esModule") return;
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export { TypescriptConfigMutator } from '@teambit/typescript.modules.ts-config-mutator';\nexport { TypeScriptExtractor } from './typescript.extractor';\nexport { TypescriptCompiler } from './typescript.compiler';\nexport type { TypescriptMain, TsConfigTransformer } from './typescript.main.runtime';\nexport type { TypeScriptCompilerOptions, TsCompilerOptionsWithoutTsConfig } from './compiler-options';\nexport { TypescriptAspect } from './typescript.aspect';\nexport
|
|
1
|
+
{"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export { TypescriptConfigMutator } from '@teambit/typescript.modules.ts-config-mutator';\nexport { TypeScriptExtractor } from './typescript.extractor';\nexport { TypescriptCompiler } from './typescript.compiler';\nexport type { TypescriptMain, TsConfigTransformer } from './typescript.main.runtime';\nexport type { TypeScriptCompilerOptions, TsCompilerOptionsWithoutTsConfig } from './compiler-options';\nexport { TypescriptAspect } from './typescript.aspect';\nexport * from './sourceFileTransformers';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAGA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;AAAA;EAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.typescript_typescript@0.0.
|
|
2
|
-
import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.typescript_typescript@0.0.
|
|
1
|
+
import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.typescript_typescript@0.0.1104/dist/typescript.composition.js';
|
|
2
|
+
import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad3d35bfc38b9cd90c0e05b598a5a55af/teambit.typescript_typescript@0.0.1104/dist/typescript.docs.mdx';
|
|
3
3
|
|
|
4
4
|
export const compositions = [compositions_0];
|
|
5
5
|
export const overview = [overview_0];
|
|
@@ -3,8 +3,7 @@ import { Compiler, TranspileFileParams, TranspileFileOutput } from '@teambit/com
|
|
|
3
3
|
import { Logger } from '@teambit/logger';
|
|
4
4
|
import ts from 'typescript';
|
|
5
5
|
import { TypeScriptCompilerOptions } from './compiler-options';
|
|
6
|
-
|
|
7
|
-
export declare class TypescriptCompiler implements Compiler, TypescriptCompilerInterface {
|
|
6
|
+
export declare class TypescriptCompiler implements Compiler {
|
|
8
7
|
readonly id: string;
|
|
9
8
|
private logger;
|
|
10
9
|
private options;
|
|
@@ -16,10 +15,6 @@ export declare class TypescriptCompiler implements Compiler, TypescriptCompilerI
|
|
|
16
15
|
constructor(id: string, logger: Logger, options: TypeScriptCompilerOptions, tsModule: typeof ts);
|
|
17
16
|
displayName: string;
|
|
18
17
|
deleteDistDir: boolean;
|
|
19
|
-
generateIdeConfig(): {
|
|
20
|
-
tsconfig: Record<string, any>;
|
|
21
|
-
globalTypesPaths: string[];
|
|
22
|
-
};
|
|
23
18
|
displayConfig(): string;
|
|
24
19
|
getDistDir(): string;
|
|
25
20
|
/**
|
|
@@ -62,12 +62,6 @@ class TypescriptCompiler {
|
|
|
62
62
|
// mutate the outDir, otherwise, on capsules, the dists might be written to a different directory and make confusion
|
|
63
63
|
this.options.tsconfig.compilerOptions.outDir = this.distDir;
|
|
64
64
|
}
|
|
65
|
-
generateIdeConfig() {
|
|
66
|
-
return {
|
|
67
|
-
tsconfig: this.options.tsconfig,
|
|
68
|
-
globalTypesPaths: this.options.types
|
|
69
|
-
};
|
|
70
|
-
}
|
|
71
65
|
displayConfig() {
|
|
72
66
|
return this.stringifyTsconfig(this.options.tsconfig);
|
|
73
67
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["TypescriptCompiler","constructor","id","logger","options","tsModule","distDir","distGlobPatterns","shouldCopyNonSupportedFiles","artifactName","tsconfig","compilerOptions","outDir","generateIdeConfig","globalTypesPaths","types","displayConfig","stringifyTsconfig","getDistDir","transpileFile","fileContent","isFileSupported","filePath","compilerOptionsFromTsconfig","convertCompilerOptionsFromJson","errors","length","formattedErrors","formatDiagnosticsWithColorAndContext","getFormatDiagnosticsHost","Error","sourceRoot","componentDir","rootDir","result","transpileModule","fileName","reportDiagnostics","diagnostics","formatHost","error","outputPath","replaceFileExtToJs","outputFiles","outputText","sourceMapText","push","preBuild","context","capsules","capsuleNetwork","seedersCapsules","capsuleDirs","map","capsule","path","writeTsConfig","writeTypes","writeNpmIgnore","build","componentsResults","runTscBuild","artifacts","getArtifactDefinition","generatedBy","name","globPatterns","getDistPathBySrcPath","srcPath","fileWithJSExtIfNeeded","join","isJsAndCompile","compileJs","endsWith","isJsxAndCompile","compileJsx","network","capsulesRootDir","getCapsulesToCompile","getAllCapsuleDirs","getCanonicalFileName","p","getCurrentDirectory","getNewLine","sys","newLine","currentComponentResult","reportDiagnostic","diagnostic","errorStr","process","stdout","isTTY","formatDiagnostic","file","BitError","consoleFailure","component","reportSolutionBuilderStatus","diag","msg","messageText","debug","errorCounter","errorCount","info","host","createSolutionBuilderHost","undefined","writeProjectReferencesTsConfig","solutionBuilder","createSolutionBuilder","verbose","nextProject","longProcessLogger","createLongProcessLogger","getNextInvalidatedProject","capsulePath","project","replace","currentComponentId","getIdByPathInCapsule","logProgress","toString","getCapsule","startTime","Date","now","done","endTime","end","dirs","Promise","all","typePath","contents","fs","readFile","filename","basename","dir","pathExists","outputFile","NPM_IGNORE_FILE","npmIgnorePath","npmIgnoreEntriesStr","appendFile","projects","files","references","tsconfigStr","writeFile","JSON","stringify","fileExtension","extname","RegExp","version"],"sources":["typescript.compiler.ts"],"sourcesContent":["import { BuildContext, BuiltTaskResult, ComponentResult } from '@teambit/builder';\nimport { Compiler, TranspileFileParams, TranspileFileOutput } from '@teambit/compiler';\nimport { Network } from '@teambit/isolator';\nimport { Logger } from '@teambit/logger';\nimport fs from 'fs-extra';\nimport path from 'path';\nimport ts from 'typescript';\nimport { BitError } from '@teambit/bit-error';\nimport { TypeScriptCompilerOptions } from './compiler-options';\nimport { TypescriptCompilerInterface } from './typescript-compiler-interface';\n\nexport class TypescriptCompiler implements Compiler, TypescriptCompilerInterface {\n distDir: string;\n distGlobPatterns: string[];\n shouldCopyNonSupportedFiles: boolean;\n artifactName: string;\n constructor(\n readonly id: string,\n private logger: Logger,\n private options: TypeScriptCompilerOptions,\n private tsModule: typeof ts\n ) {\n this.distDir = options.distDir || 'dist';\n this.distGlobPatterns = options.distGlobPatterns || [`${this.distDir}/**`, `!${this.distDir}/tsconfig.tsbuildinfo`];\n this.shouldCopyNonSupportedFiles =\n typeof options.shouldCopyNonSupportedFiles === 'boolean' ? options.shouldCopyNonSupportedFiles : true;\n this.artifactName = options.artifactName || 'dist';\n this.options.tsconfig ||= {};\n this.options.tsconfig.compilerOptions ||= {};\n // mutate the outDir, otherwise, on capsules, the dists might be written to a different directory and make confusion\n this.options.tsconfig.compilerOptions.outDir = this.distDir;\n }\n\n displayName = 'TypeScript';\n deleteDistDir = false;\n\n generateIdeConfig() {\n return {\n tsconfig: this.options.tsconfig,\n globalTypesPaths: this.options.types,\n };\n }\n\n displayConfig() {\n return this.stringifyTsconfig(this.options.tsconfig);\n }\n\n getDistDir() {\n return this.distDir;\n }\n\n /**\n * compile one file on the workspace\n */\n transpileFile(fileContent: string, options: TranspileFileParams): TranspileFileOutput {\n if (!this.isFileSupported(options.filePath)) {\n return null; // file is not supported\n }\n const compilerOptionsFromTsconfig = this.tsModule.convertCompilerOptionsFromJson(\n this.options.tsconfig.compilerOptions,\n '.'\n );\n if (compilerOptionsFromTsconfig.errors.length) {\n // :TODO @david replace to a more concrete error type and put in 'exceptions' directory here.\n const formattedErrors = this.tsModule.formatDiagnosticsWithColorAndContext(\n compilerOptionsFromTsconfig.errors,\n this.getFormatDiagnosticsHost()\n );\n throw new Error(`failed parsing the tsconfig.json.\\n${formattedErrors}`);\n }\n\n const compilerOptions = compilerOptionsFromTsconfig.options;\n compilerOptions.sourceRoot = options.componentDir;\n compilerOptions.rootDir = '.';\n const result = this.tsModule.transpileModule(fileContent, {\n compilerOptions,\n fileName: options.filePath,\n reportDiagnostics: true,\n });\n\n if (result.diagnostics && result.diagnostics.length) {\n const formatHost = this.getFormatDiagnosticsHost();\n const error = this.tsModule.formatDiagnosticsWithColorAndContext(result.diagnostics, formatHost);\n\n // :TODO @david please replace to a more concrete error type and put in 'exceptions' directory here.\n throw new Error(error);\n }\n\n const outputPath = this.replaceFileExtToJs(options.filePath);\n const outputFiles = [{ outputText: result.outputText, outputPath }];\n if (result.sourceMapText) {\n outputFiles.push({\n outputText: result.sourceMapText,\n outputPath: `${outputPath}.map`,\n });\n }\n return outputFiles;\n }\n\n async preBuild(context: BuildContext) {\n const capsules = context.capsuleNetwork.seedersCapsules;\n const capsuleDirs = capsules.map((capsule) => capsule.path);\n await this.writeTsConfig(capsuleDirs);\n await this.writeTypes(capsuleDirs);\n await this.writeNpmIgnore(capsuleDirs);\n }\n\n /**\n * compile multiple components on the capsules\n */\n async build(context: BuildContext): Promise<BuiltTaskResult> {\n const componentsResults = await this.runTscBuild(context.capsuleNetwork);\n\n return {\n artifacts: this.getArtifactDefinition(),\n componentsResults,\n };\n }\n\n getArtifactDefinition() {\n return [\n {\n generatedBy: this.id,\n name: this.artifactName,\n globPatterns: this.distGlobPatterns,\n },\n ];\n }\n\n /**\n * given a source file, return its parallel in the dists. e.g. index.ts => dist/index.js\n */\n getDistPathBySrcPath(srcPath: string) {\n const fileWithJSExtIfNeeded = this.replaceFileExtToJs(srcPath);\n return path.join(this.distDir, fileWithJSExtIfNeeded);\n }\n\n /**\n * whether typescript is able to compile the given path\n */\n isFileSupported(filePath: string): boolean {\n const isJsAndCompile = !!this.options.compileJs && filePath.endsWith('.js');\n const isJsxAndCompile = !!this.options.compileJsx && filePath.endsWith('.jsx');\n return (\n (filePath.endsWith('.ts') || filePath.endsWith('.tsx') || isJsAndCompile || isJsxAndCompile) &&\n !filePath.endsWith('.d.ts')\n );\n }\n\n /**\n * we have two options here:\n * 1. pass all capsules-dir at the second parameter of createSolutionBuilder and then no\n * need to write the main tsconfig.json with all the references.\n * 2. write main tsconfig.json and pass the capsules root-dir.\n * we went with option #2 because it'll be easier for users to go to the capsule-root and run\n * `tsc --build` to debug issues.\n */\n private async runTscBuild(network: Network): Promise<ComponentResult[]> {\n const rootDir = network.capsulesRootDir;\n const capsules = await network.getCapsulesToCompile();\n if (!capsules.length) {\n return [];\n }\n const capsuleDirs = capsules.getAllCapsuleDirs();\n const formatHost = {\n getCanonicalFileName: (p) => p,\n getCurrentDirectory: () => '', // it helps to get the files with absolute paths\n getNewLine: () => this.tsModule.sys.newLine,\n };\n const componentsResults: ComponentResult[] = [];\n let currentComponentResult: Partial<ComponentResult> = { errors: [] };\n const reportDiagnostic = (diagnostic: ts.Diagnostic) => {\n const errorStr = process.stdout.isTTY\n ? this.tsModule.formatDiagnosticsWithColorAndContext([diagnostic], formatHost)\n : this.tsModule.formatDiagnostic(diagnostic, formatHost);\n if (!diagnostic.file) {\n // the error is general and not related to a specific file. e.g. tsconfig is missing.\n throw new BitError(errorStr);\n }\n this.logger.consoleFailure(errorStr);\n if (!currentComponentResult.component || !currentComponentResult.errors) {\n throw new Error(`currentComponentResult is not defined yet for ${diagnostic.file}`);\n }\n currentComponentResult.errors.push(errorStr);\n };\n // this only works when `verbose` is `true` in the `ts.createSolutionBuilder` function.\n const reportSolutionBuilderStatus = (diag: ts.Diagnostic) => {\n const msg = diag.messageText as string;\n this.logger.debug(msg);\n };\n const errorCounter = (errorCount: number) => {\n this.logger.info(`total error found: ${errorCount}`);\n };\n const host = this.tsModule.createSolutionBuilderHost(\n undefined,\n undefined,\n reportDiagnostic,\n reportSolutionBuilderStatus,\n errorCounter\n );\n await this.writeProjectReferencesTsConfig(rootDir, capsuleDirs);\n const solutionBuilder = this.tsModule.createSolutionBuilder(host, [rootDir], { verbose: true });\n let nextProject;\n const longProcessLogger = this.logger.createLongProcessLogger('compile typescript components', capsules.length);\n // eslint-disable-next-line no-cond-assign\n while ((nextProject = solutionBuilder.getNextInvalidatedProject())) {\n // regex to make sure it will work correctly for both linux and windows\n // it replaces both /tsconfig.json and \\tsocnfig.json\n const capsulePath = nextProject.project.replace(/[/\\\\]tsconfig.json/, '');\n const currentComponentId = capsules.getIdByPathInCapsule(capsulePath);\n if (!currentComponentId) throw new Error(`unable to find component for ${capsulePath}`);\n longProcessLogger.logProgress(currentComponentId.toString());\n const capsule = capsules.getCapsule(currentComponentId);\n if (!capsule) throw new Error(`unable to find capsule for ${currentComponentId.toString()}`);\n currentComponentResult.component = capsule.component;\n currentComponentResult.startTime = Date.now();\n nextProject.done();\n currentComponentResult.endTime = Date.now();\n componentsResults.push({ ...currentComponentResult } as ComponentResult);\n currentComponentResult = { errors: [] };\n }\n longProcessLogger.end();\n\n return componentsResults;\n }\n\n private getFormatDiagnosticsHost(): ts.FormatDiagnosticsHost {\n return {\n getCanonicalFileName: (p) => p,\n getCurrentDirectory: this.tsModule.sys.getCurrentDirectory,\n getNewLine: () => this.tsModule.sys.newLine,\n };\n }\n\n private async writeTypes(dirs: string[]) {\n await Promise.all(\n this.options.types.map(async (typePath) => {\n const contents = await fs.readFile(typePath, 'utf8');\n const filename = path.basename(typePath);\n\n await Promise.all(\n dirs.map(async (dir) => {\n const filePath = path.join(dir, 'types', filename);\n if (!(await fs.pathExists(filePath))) {\n await fs.outputFile(filePath, contents);\n }\n })\n );\n })\n );\n }\n\n /**\n * when using project-references, typescript adds a file \"tsconfig.tsbuildinfo\" which is not\n * needed for the package.\n */\n private async writeNpmIgnore(dirs: string[]) {\n const NPM_IGNORE_FILE = '.npmignore';\n await Promise.all(\n dirs.map(async (dir) => {\n const npmIgnorePath = path.join(dir, NPM_IGNORE_FILE);\n const npmIgnoreEntriesStr = `\\n${this.distDir}/tsconfig.tsbuildinfo\\n`;\n await fs.appendFile(npmIgnorePath, npmIgnoreEntriesStr);\n })\n );\n }\n\n private async writeProjectReferencesTsConfig(rootDir: string, projects: string[]) {\n const files = [];\n const references = projects.map((project) => ({ path: project }));\n const tsconfig = { files, references };\n const tsconfigStr = this.stringifyTsconfig(tsconfig);\n await fs.writeFile(path.join(rootDir, 'tsconfig.json'), tsconfigStr);\n }\n\n private async writeTsConfig(dirs: string[]) {\n const tsconfigStr = this.stringifyTsconfig(this.options.tsconfig);\n await Promise.all(dirs.map((dir) => fs.writeFile(path.join(dir, 'tsconfig.json'), tsconfigStr)));\n }\n\n private stringifyTsconfig(tsconfig) {\n return JSON.stringify(tsconfig, undefined, 2);\n }\n\n private replaceFileExtToJs(filePath: string): string {\n if (!this.isFileSupported(filePath)) return filePath;\n const fileExtension = path.extname(filePath);\n return filePath.replace(new RegExp(`${fileExtension}$`), '.js'); // makes sure it's the last occurrence\n }\n\n version() {\n return this.tsModule.version;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAIA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAA8C;AAAA;AAIvC,MAAMA,kBAAkB,CAAkD;EAK/EC,WAAW,CACAC,EAAU,EACXC,MAAc,EACdC,OAAkC,EAClCC,QAAmB,EAC3B;IAAA;IAAA,KAJSH,EAAU,GAAVA,EAAU;IAAA,KACXC,MAAc,GAAdA,MAAc;IAAA,KACdC,OAAkC,GAAlCA,OAAkC;IAAA,KAClCC,QAAmB,GAAn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ACrI,iBAAiB,CAACP,QAAQ,CAAC;IACpD,MAAM8H,kBAAE,CAACe,SAAS,CAAChG,eAAI,CAACe,IAAI,CAACrC,OAAO,EAAE,eAAe,CAAC,EAAEqH,WAAW,CAAC;EACtE;EAEA,MAAc9F,aAAa,CAAC2E,IAAc,EAAE;IAC1C,MAAMmB,WAAW,GAAG,IAAI,CAACrI,iBAAiB,CAAC,IAAI,CAACb,OAAO,CAACM,QAAQ,CAAC;IACjE,MAAM0H,OAAO,CAACC,GAAG,CAACF,IAAI,CAAC9E,GAAG,CAAEuF,GAAG,IAAKJ,kBAAE,CAACe,SAAS,CAAChG,eAAI,CAACe,IAAI,CAACsE,GAAG,EAAE,eAAe,CAAC,EAAEU,WAAW,CAAC,CAAC,CAAC;EAClG;EAEQrI,iBAAiB,CAACP,QAAQ,EAAE;IAClC,OAAO8I,IAAI,CAACC,SAAS,CAAC/I,QAAQ,EAAEkG,SAAS,EAAE,CAAC,CAAC;EAC/C;EAEQlE,kBAAkB,CAACpB,QAAgB,EAAU;IACnD,IAAI,CAAC,IAAI,CAACD,eAAe,CAACC,QAAQ,CAAC,EAAE,OAAOA,QAAQ;IACpD,MAAMoI,aAAa,GAAGnG,eAAI,CAACoG,OAAO,CAACrI,QAAQ,CAAC;IAC5C,OAAOA,QAAQ,CAACiG,OAAO,CAAC,IAAIqC,MAAM,CAAE,GAAEF,aAAc,GAAE,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC;EACnE;;EAEAG,OAAO,GAAG;IACR,OAAO,IAAI,CAACxJ,QAAQ,CAACwJ,OAAO;EAC9B;AACF;AAAC"}
|
|
1
|
+
{"version":3,"names":["TypescriptCompiler","constructor","id","logger","options","tsModule","distDir","distGlobPatterns","shouldCopyNonSupportedFiles","artifactName","tsconfig","compilerOptions","outDir","displayConfig","stringifyTsconfig","getDistDir","transpileFile","fileContent","isFileSupported","filePath","compilerOptionsFromTsconfig","convertCompilerOptionsFromJson","errors","length","formattedErrors","formatDiagnosticsWithColorAndContext","getFormatDiagnosticsHost","Error","sourceRoot","componentDir","rootDir","result","transpileModule","fileName","reportDiagnostics","diagnostics","formatHost","error","outputPath","replaceFileExtToJs","outputFiles","outputText","sourceMapText","push","preBuild","context","capsules","capsuleNetwork","seedersCapsules","capsuleDirs","map","capsule","path","writeTsConfig","writeTypes","writeNpmIgnore","build","componentsResults","runTscBuild","artifacts","getArtifactDefinition","generatedBy","name","globPatterns","getDistPathBySrcPath","srcPath","fileWithJSExtIfNeeded","join","isJsAndCompile","compileJs","endsWith","isJsxAndCompile","compileJsx","network","capsulesRootDir","getCapsulesToCompile","getAllCapsuleDirs","getCanonicalFileName","p","getCurrentDirectory","getNewLine","sys","newLine","currentComponentResult","reportDiagnostic","diagnostic","errorStr","process","stdout","isTTY","formatDiagnostic","file","BitError","consoleFailure","component","reportSolutionBuilderStatus","diag","msg","messageText","debug","errorCounter","errorCount","info","host","createSolutionBuilderHost","undefined","writeProjectReferencesTsConfig","solutionBuilder","createSolutionBuilder","verbose","nextProject","longProcessLogger","createLongProcessLogger","getNextInvalidatedProject","capsulePath","project","replace","currentComponentId","getIdByPathInCapsule","logProgress","toString","getCapsule","startTime","Date","now","done","endTime","end","dirs","Promise","all","types","typePath","contents","fs","readFile","filename","basename","dir","pathExists","outputFile","NPM_IGNORE_FILE","npmIgnorePath","npmIgnoreEntriesStr","appendFile","projects","files","references","tsconfigStr","writeFile","JSON","stringify","fileExtension","extname","RegExp","version"],"sources":["typescript.compiler.ts"],"sourcesContent":["import { BuildContext, BuiltTaskResult, ComponentResult } from '@teambit/builder';\nimport { Compiler, TranspileFileParams, TranspileFileOutput } from '@teambit/compiler';\nimport { Network } from '@teambit/isolator';\nimport { Logger } from '@teambit/logger';\nimport fs from 'fs-extra';\nimport path from 'path';\nimport ts from 'typescript';\nimport { BitError } from '@teambit/bit-error';\nimport { TypeScriptCompilerOptions } from './compiler-options';\n\nexport class TypescriptCompiler implements Compiler {\n distDir: string;\n distGlobPatterns: string[];\n shouldCopyNonSupportedFiles: boolean;\n artifactName: string;\n constructor(\n readonly id: string,\n private logger: Logger,\n private options: TypeScriptCompilerOptions,\n private tsModule: typeof ts\n ) {\n this.distDir = options.distDir || 'dist';\n this.distGlobPatterns = options.distGlobPatterns || [`${this.distDir}/**`, `!${this.distDir}/tsconfig.tsbuildinfo`];\n this.shouldCopyNonSupportedFiles =\n typeof options.shouldCopyNonSupportedFiles === 'boolean' ? options.shouldCopyNonSupportedFiles : true;\n this.artifactName = options.artifactName || 'dist';\n this.options.tsconfig ||= {};\n this.options.tsconfig.compilerOptions ||= {};\n // mutate the outDir, otherwise, on capsules, the dists might be written to a different directory and make confusion\n this.options.tsconfig.compilerOptions.outDir = this.distDir;\n }\n\n displayName = 'TypeScript';\n deleteDistDir = false;\n\n displayConfig() {\n return this.stringifyTsconfig(this.options.tsconfig);\n }\n\n getDistDir() {\n return this.distDir;\n }\n\n /**\n * compile one file on the workspace\n */\n transpileFile(fileContent: string, options: TranspileFileParams): TranspileFileOutput {\n if (!this.isFileSupported(options.filePath)) {\n return null; // file is not supported\n }\n const compilerOptionsFromTsconfig = this.tsModule.convertCompilerOptionsFromJson(\n this.options.tsconfig.compilerOptions,\n '.'\n );\n if (compilerOptionsFromTsconfig.errors.length) {\n // :TODO @david replace to a more concrete error type and put in 'exceptions' directory here.\n const formattedErrors = this.tsModule.formatDiagnosticsWithColorAndContext(\n compilerOptionsFromTsconfig.errors,\n this.getFormatDiagnosticsHost()\n );\n throw new Error(`failed parsing the tsconfig.json.\\n${formattedErrors}`);\n }\n\n const compilerOptions = compilerOptionsFromTsconfig.options;\n compilerOptions.sourceRoot = options.componentDir;\n compilerOptions.rootDir = '.';\n const result = this.tsModule.transpileModule(fileContent, {\n compilerOptions,\n fileName: options.filePath,\n reportDiagnostics: true,\n });\n\n if (result.diagnostics && result.diagnostics.length) {\n const formatHost = this.getFormatDiagnosticsHost();\n const error = this.tsModule.formatDiagnosticsWithColorAndContext(result.diagnostics, formatHost);\n\n // :TODO @david please replace to a more concrete error type and put in 'exceptions' directory here.\n throw new Error(error);\n }\n\n const outputPath = this.replaceFileExtToJs(options.filePath);\n const outputFiles = [{ outputText: result.outputText, outputPath }];\n if (result.sourceMapText) {\n outputFiles.push({\n outputText: result.sourceMapText,\n outputPath: `${outputPath}.map`,\n });\n }\n return outputFiles;\n }\n\n async preBuild(context: BuildContext) {\n const capsules = context.capsuleNetwork.seedersCapsules;\n const capsuleDirs = capsules.map((capsule) => capsule.path);\n await this.writeTsConfig(capsuleDirs);\n await this.writeTypes(capsuleDirs);\n await this.writeNpmIgnore(capsuleDirs);\n }\n\n /**\n * compile multiple components on the capsules\n */\n async build(context: BuildContext): Promise<BuiltTaskResult> {\n const componentsResults = await this.runTscBuild(context.capsuleNetwork);\n\n return {\n artifacts: this.getArtifactDefinition(),\n componentsResults,\n };\n }\n\n getArtifactDefinition() {\n return [\n {\n generatedBy: this.id,\n name: this.artifactName,\n globPatterns: this.distGlobPatterns,\n },\n ];\n }\n\n /**\n * given a source file, return its parallel in the dists. e.g. index.ts => dist/index.js\n */\n getDistPathBySrcPath(srcPath: string) {\n const fileWithJSExtIfNeeded = this.replaceFileExtToJs(srcPath);\n return path.join(this.distDir, fileWithJSExtIfNeeded);\n }\n\n /**\n * whether typescript is able to compile the given path\n */\n isFileSupported(filePath: string): boolean {\n const isJsAndCompile = !!this.options.compileJs && filePath.endsWith('.js');\n const isJsxAndCompile = !!this.options.compileJsx && filePath.endsWith('.jsx');\n return (\n (filePath.endsWith('.ts') || filePath.endsWith('.tsx') || isJsAndCompile || isJsxAndCompile) &&\n !filePath.endsWith('.d.ts')\n );\n }\n\n /**\n * we have two options here:\n * 1. pass all capsules-dir at the second parameter of createSolutionBuilder and then no\n * need to write the main tsconfig.json with all the references.\n * 2. write main tsconfig.json and pass the capsules root-dir.\n * we went with option #2 because it'll be easier for users to go to the capsule-root and run\n * `tsc --build` to debug issues.\n */\n private async runTscBuild(network: Network): Promise<ComponentResult[]> {\n const rootDir = network.capsulesRootDir;\n const capsules = await network.getCapsulesToCompile();\n if (!capsules.length) {\n return [];\n }\n const capsuleDirs = capsules.getAllCapsuleDirs();\n const formatHost = {\n getCanonicalFileName: (p) => p,\n getCurrentDirectory: () => '', // it helps to get the files with absolute paths\n getNewLine: () => this.tsModule.sys.newLine,\n };\n const componentsResults: ComponentResult[] = [];\n let currentComponentResult: Partial<ComponentResult> = { errors: [] };\n const reportDiagnostic = (diagnostic: ts.Diagnostic) => {\n const errorStr = process.stdout.isTTY\n ? this.tsModule.formatDiagnosticsWithColorAndContext([diagnostic], formatHost)\n : this.tsModule.formatDiagnostic(diagnostic, formatHost);\n if (!diagnostic.file) {\n // the error is general and not related to a specific file. e.g. tsconfig is missing.\n throw new BitError(errorStr);\n }\n this.logger.consoleFailure(errorStr);\n if (!currentComponentResult.component || !currentComponentResult.errors) {\n throw new Error(`currentComponentResult is not defined yet for ${diagnostic.file}`);\n }\n currentComponentResult.errors.push(errorStr);\n };\n // this only works when `verbose` is `true` in the `ts.createSolutionBuilder` function.\n const reportSolutionBuilderStatus = (diag: ts.Diagnostic) => {\n const msg = diag.messageText as string;\n this.logger.debug(msg);\n };\n const errorCounter = (errorCount: number) => {\n this.logger.info(`total error found: ${errorCount}`);\n };\n const host = this.tsModule.createSolutionBuilderHost(\n undefined,\n undefined,\n reportDiagnostic,\n reportSolutionBuilderStatus,\n errorCounter\n );\n await this.writeProjectReferencesTsConfig(rootDir, capsuleDirs);\n const solutionBuilder = this.tsModule.createSolutionBuilder(host, [rootDir], { verbose: true });\n let nextProject;\n const longProcessLogger = this.logger.createLongProcessLogger('compile typescript components', capsules.length);\n // eslint-disable-next-line no-cond-assign\n while ((nextProject = solutionBuilder.getNextInvalidatedProject())) {\n // regex to make sure it will work correctly for both linux and windows\n // it replaces both /tsconfig.json and \\tsocnfig.json\n const capsulePath = nextProject.project.replace(/[/\\\\]tsconfig.json/, '');\n const currentComponentId = capsules.getIdByPathInCapsule(capsulePath);\n if (!currentComponentId) throw new Error(`unable to find component for ${capsulePath}`);\n longProcessLogger.logProgress(currentComponentId.toString());\n const capsule = capsules.getCapsule(currentComponentId);\n if (!capsule) throw new Error(`unable to find capsule for ${currentComponentId.toString()}`);\n currentComponentResult.component = capsule.component;\n currentComponentResult.startTime = Date.now();\n nextProject.done();\n currentComponentResult.endTime = Date.now();\n componentsResults.push({ ...currentComponentResult } as ComponentResult);\n currentComponentResult = { errors: [] };\n }\n longProcessLogger.end();\n\n return componentsResults;\n }\n\n private getFormatDiagnosticsHost(): ts.FormatDiagnosticsHost {\n return {\n getCanonicalFileName: (p) => p,\n getCurrentDirectory: this.tsModule.sys.getCurrentDirectory,\n getNewLine: () => this.tsModule.sys.newLine,\n };\n }\n\n private async writeTypes(dirs: string[]) {\n await Promise.all(\n this.options.types.map(async (typePath) => {\n const contents = await fs.readFile(typePath, 'utf8');\n const filename = path.basename(typePath);\n\n await Promise.all(\n dirs.map(async (dir) => {\n const filePath = path.join(dir, 'types', filename);\n if (!(await fs.pathExists(filePath))) {\n await fs.outputFile(filePath, contents);\n }\n })\n );\n })\n );\n }\n\n /**\n * when using project-references, typescript adds a file \"tsconfig.tsbuildinfo\" which is not\n * needed for the package.\n */\n private async writeNpmIgnore(dirs: string[]) {\n const NPM_IGNORE_FILE = '.npmignore';\n await Promise.all(\n dirs.map(async (dir) => {\n const npmIgnorePath = path.join(dir, NPM_IGNORE_FILE);\n const npmIgnoreEntriesStr = `\\n${this.distDir}/tsconfig.tsbuildinfo\\n`;\n await fs.appendFile(npmIgnorePath, npmIgnoreEntriesStr);\n })\n );\n }\n\n private async writeProjectReferencesTsConfig(rootDir: string, projects: string[]) {\n const files = [];\n const references = projects.map((project) => ({ path: project }));\n const tsconfig = { files, references };\n const tsconfigStr = this.stringifyTsconfig(tsconfig);\n await fs.writeFile(path.join(rootDir, 'tsconfig.json'), tsconfigStr);\n }\n\n private async writeTsConfig(dirs: string[]) {\n const tsconfigStr = this.stringifyTsconfig(this.options.tsconfig);\n await Promise.all(dirs.map((dir) => fs.writeFile(path.join(dir, 'tsconfig.json'), tsconfigStr)));\n }\n\n private stringifyTsconfig(tsconfig) {\n return JSON.stringify(tsconfig, undefined, 2);\n }\n\n private replaceFileExtToJs(filePath: string): string {\n if (!this.isFileSupported(filePath)) return filePath;\n const fileExtension = path.extname(filePath);\n return filePath.replace(new RegExp(`${fileExtension}$`), '.js'); // makes sure it's the last occurrence\n }\n\n version() {\n return this.tsModule.version;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAIA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAA8C;AAAA;AAGvC,MAAMA,kBAAkB,CAAqB;EAKlDC,WAAW,CACAC,EAAU,EACXC,MAAc,EACdC,OAAkC,EAClCC,QAAmB,EAC3B;IAAA;IAAA,KAJSH,EAAU,GAAVA,EAAU;IAAA,KACXC,MAAc,GAAdA,MAAc;IAAA,KACdC,OAAkC,GAAlCA,OAAkC;IAAA,KAClCC,QAAmB,GAAnBA,QAAmB;IAAA;IAAA;IAAA;IAAA;IAAA,qDAaf,YAAY;IAAA,uDACV,KAAK;IAZnB,IAAI,CAACC,OAAO,GAAGF,OAAO,CAACE,OAAO,IAAI,MAAM;IACxC,IAAI,CAACC,gBAAgB,GAAGH,OAAO,CAACG,gBAAgB,IAAI,CAAE,GAAE,IAAI,CAACD,OAAQ,KAAI,EAAG,IAAG,IAAI,CAACA,OAAQ,uBAAsB,CAAC;IACnH,IAAI,CAACE,2BAA2B,GAC9B,OAAOJ,OAAO,CAACI,2BAA2B,KAAK,SAAS,GAAGJ,OAAO,CAACI,2BAA2B,GAAG,IAAI;IACvG,IAAI,CAACC,YAAY,GAAGL,OAAO,CAACK,YAAY,IAAI,MAAM;IAClD,qBAAI,CAACL,OAAO,EAACM,QAAQ,KAArB,cAAaA,QAAQ,GAAK,CAAC,CAAC;IAC5B,6BAAI,CAACN,OAAO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AAQ;IACpD,MAAMqI,aAAa,GAAGpG,eAAI,CAACqG,OAAO,CAACtI,QAAQ,CAAC;IAC5C,OAAOA,QAAQ,CAACiG,OAAO,CAAC,IAAIsC,MAAM,CAAE,GAAEF,aAAc,GAAE,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC;EACnE;;EAEAG,OAAO,GAAG;IACR,OAAO,IAAI,CAACtJ,QAAQ,CAACsJ,OAAO;EAC9B;AACF;AAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import ts from 'typescript';
|
|
2
2
|
import { SlotRegistry } from '@teambit/harmony';
|
|
3
3
|
import { CLIMain } from '@teambit/cli';
|
|
4
|
-
import { Compiler
|
|
4
|
+
import { Compiler } from '@teambit/compiler';
|
|
5
5
|
import { Logger, LoggerMain } from '@teambit/logger';
|
|
6
6
|
import { SchemaExtractor, SchemaMain } from '@teambit/schema';
|
|
7
7
|
import { PackageJsonProps } from '@teambit/pkg';
|
|
@@ -10,7 +10,6 @@ import type { Workspace } from '@teambit/workspace';
|
|
|
10
10
|
import { DependencyResolverMain } from '@teambit/dependency-resolver';
|
|
11
11
|
import { TsserverClient, TsserverClientOpts } from '@teambit/ts-server';
|
|
12
12
|
import { AspectLoaderMain } from '@teambit/aspect-loader';
|
|
13
|
-
import { WorkspaceConfigFilesMain } from '@teambit/workspace-config-files';
|
|
14
13
|
import { WatcherMain } from '@teambit/watcher';
|
|
15
14
|
import type { Component } from '@teambit/component';
|
|
16
15
|
import { BuilderMain } from '@teambit/builder';
|
|
@@ -115,7 +114,7 @@ export declare class TypescriptMain {
|
|
|
115
114
|
static runtime: import("@teambit/harmony").RuntimeDefinition;
|
|
116
115
|
static dependencies: import("@teambit/harmony").Aspect[];
|
|
117
116
|
static slots: ((registerFn: () => string) => SlotRegistry<SchemaTransformer[]>)[];
|
|
118
|
-
static provider([schema, loggerExt, aspectLoader, workspace, cli, depResolver, envs, watcher,
|
|
117
|
+
static provider([schema, loggerExt, aspectLoader, workspace, cli, depResolver, envs, watcher, scope, builder]: [
|
|
119
118
|
SchemaMain,
|
|
120
119
|
LoggerMain,
|
|
121
120
|
AspectLoaderMain,
|
|
@@ -124,8 +123,6 @@ export declare class TypescriptMain {
|
|
|
124
123
|
DependencyResolverMain,
|
|
125
124
|
EnvsMain,
|
|
126
125
|
WatcherMain,
|
|
127
|
-
WorkspaceConfigFilesMain,
|
|
128
|
-
CompilerMain,
|
|
129
126
|
ScopeMain,
|
|
130
127
|
BuilderMain
|
|
131
128
|
], config: any, [schemaTransformerSlot]: [SchemaTransformerSlot]): Promise<TypescriptMain>;
|
|
@@ -38,13 +38,6 @@ function _cli() {
|
|
|
38
38
|
};
|
|
39
39
|
return data;
|
|
40
40
|
}
|
|
41
|
-
function _compiler() {
|
|
42
|
-
const data = require("@teambit/compiler");
|
|
43
|
-
_compiler = function () {
|
|
44
|
-
return data;
|
|
45
|
-
};
|
|
46
|
-
return data;
|
|
47
|
-
}
|
|
48
41
|
function _logger() {
|
|
49
42
|
const data = require("@teambit/logger");
|
|
50
43
|
_logger = function () {
|
|
@@ -101,13 +94,6 @@ function _aspectLoader() {
|
|
|
101
94
|
};
|
|
102
95
|
return data;
|
|
103
96
|
}
|
|
104
|
-
function _workspaceConfigFiles() {
|
|
105
|
-
const data = _interopRequireDefault(require("@teambit/workspace-config-files"));
|
|
106
|
-
_workspaceConfigFiles = function () {
|
|
107
|
-
return data;
|
|
108
|
-
};
|
|
109
|
-
return data;
|
|
110
|
-
}
|
|
111
97
|
function _watcher() {
|
|
112
98
|
const data = _interopRequireDefault(require("@teambit/watcher"));
|
|
113
99
|
_watcher = function () {
|
|
@@ -199,13 +185,6 @@ function _writeTsconfig() {
|
|
|
199
185
|
};
|
|
200
186
|
return data;
|
|
201
187
|
}
|
|
202
|
-
function _tsConfigWriter() {
|
|
203
|
-
const data = require("./ts-config-writer");
|
|
204
|
-
_tsConfigWriter = function () {
|
|
205
|
-
return data;
|
|
206
|
-
};
|
|
207
|
-
return data;
|
|
208
|
-
}
|
|
209
188
|
function _removeTypesTask() {
|
|
210
189
|
const data = require("./remove-types-task");
|
|
211
190
|
_removeTypesTask = function () {
|
|
@@ -400,10 +379,9 @@ class TypescriptMain {
|
|
|
400
379
|
results: 'succeed'
|
|
401
380
|
};
|
|
402
381
|
}
|
|
403
|
-
static async provider([schema, loggerExt, aspectLoader, workspace, cli, depResolver, envs, watcher,
|
|
382
|
+
static async provider([schema, loggerExt, aspectLoader, workspace, cli, depResolver, envs, watcher, scope, builder], config, [schemaTransformerSlot]) {
|
|
404
383
|
schema.registerParser(new (_typescript5().TypeScriptParser)());
|
|
405
384
|
const logger = loggerExt.createLogger(_typescript3().TypescriptAspect.id);
|
|
406
|
-
workspaceConfigFiles.registerConfigWriter(new (_tsConfigWriter().TypescriptConfigWriter)(compiler, logger));
|
|
407
385
|
aspectLoader.registerPlugins([new (_schemaTransformer().SchemaTransformerPlugin)(schemaTransformerSlot)]);
|
|
408
386
|
const tsconfigWriter = new (_tsconfigWriter().TsconfigWriter)(workspace, logger);
|
|
409
387
|
const tsMain = new TypescriptMain(logger, schemaTransformerSlot, workspace, scope, depResolver, envs, tsconfigWriter, aspectLoader);
|
|
@@ -424,7 +402,7 @@ class TypescriptMain {
|
|
|
424
402
|
}
|
|
425
403
|
exports.TypescriptMain = TypescriptMain;
|
|
426
404
|
(0, _defineProperty2().default)(TypescriptMain, "runtime", _cli().MainRuntime);
|
|
427
|
-
(0, _defineProperty2().default)(TypescriptMain, "dependencies", [_schema().SchemaAspect, _logger().LoggerAspect, _aspectLoader().default, _workspace().WorkspaceAspect, _cli().CLIAspect, _dependencyResolver().DependencyResolverAspect, _envs().default, _watcher().default,
|
|
405
|
+
(0, _defineProperty2().default)(TypescriptMain, "dependencies", [_schema().SchemaAspect, _logger().LoggerAspect, _aspectLoader().default, _workspace().WorkspaceAspect, _cli().CLIAspect, _dependencyResolver().DependencyResolverAspect, _envs().default, _watcher().default, _scope().ScopeAspect, _builder().BuilderAspect]);
|
|
428
406
|
(0, _defineProperty2().default)(TypescriptMain, "slots", [_harmony().Slot.withType()]);
|
|
429
407
|
_typescript3().TypescriptAspect.addRuntime(TypescriptMain);
|
|
430
408
|
function runTransformersWithContext(config, transformers = [], context) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["TypescriptMain","constructor","logger","schemaTransformerSlot","workspace","scope","depResolver","envs","tsConfigWriter","aspectLoader","createCompiler","options","transformers","tsModule","ts","configMutator","TypescriptConfigMutator","transformerContext","afterMutation","runTransformersWithContext","clone","TypescriptCompiler","TypescriptAspect","id","raw","getTsserverClient","tsServer","initTsserverClient","projectPath","files","TsserverClient","init","initTsserverClientFromWorkspace","Error","path","createCjsCompiler","getCjsTransformer","createEsmCompiler","getEsmTransformer","cjsTransformer","config","setModule","esmTransformer","setTarget","tsconfig","compilerOptions","module","lib","createSchemaExtractor","tsserverPath","contextPath","TypeScriptExtractor","getCjsPackageJsonProps","main","types","getEsmPackageJsonProps","type","getSupportedFilesForTsserver","components","map","c","filesystem","flat","f","filter","endsWith","cleanTsconfigJson","list","runtime","createEnvironment","execContext","getEnvExecutionContext","results","TsconfigWriter","clean","writeTsconfigJson","cleanResults","writeResults","write","onPreWatch","watchOpts","spawnTSServer","verbose","checkTypes","printTypeErrors","Boolean","onComponentChange","component","pMapSeries","file","onFileChange","provider","schema","loggerExt","cli","watcher","workspaceConfigFiles","compiler","builder","registerParser","TypeScriptParser","createLogger","registerConfigWriter","TypescriptConfigWriter","registerPlugins","SchemaTransformerPlugin","tsconfigWriter","tsMain","register","ExportDeclarationTransformer","ExportAssignmentTransformer","FunctionLikeTransformer","ParameterTransformer","SetAccessorTransformer","GetAccessorTransformer","IndexSignatureTransformer","PropertyDeclarationTransformer","VariableStatementTransformer","VariableDeclaration","SourceFileTransformer","TypeAliasTransformer","ClassDeclarationTransformer","InterfaceDeclarationTransformer","EnumDeclarationTransformer","BindingElementTransformer","IntersectionTypeTransformer","UnionTypeTransformer","TypeReferenceTransformer","TypeLiteralTransformer","LiteralTypeTransformer","TypeQueryTransformer","ArrayTypeTransformer","TypeOperatorTransformer","KeywordTypeTransformer","TupleTypeTransformer","ParenthesizedTypeTransformer","TypePredicateTransformer","IndexedAccessTypeTransformer","TemplateLiteralTypeSpanTransformer","TemplateLiteralTypeTransformer","ThisTypeTransformer","ConditionalTypeTransformer","NamedTupleTransformer","ConstructorTransformer","ImportDeclarationTransformer","ExpressionStatementTransformer","ModuleDeclarationTransformer","registerOnPreWatch","bind","registerOnComponentChange","registerOnComponentAdd","removeTypesTask","RemoveTypesTask","registerSnapTasks","registerTagTasks","checkTypesCmd","CheckTypesCmd","writeTsconfigCmd","WriteTsconfigCmd","MainRuntime","SchemaAspect","LoggerAspect","AspectLoaderAspect","WorkspaceAspect","CLIAspect","DependencyResolverAspect","EnvsAspect","WatcherAspect","WorkspaceConfigFilesAspect","CompilerAspect","ScopeAspect","BuilderAspect","Slot","withType","addRuntime","context","Array","isArray","newConfig","reduce","acc","transformer"],"sources":["typescript.main.runtime.ts"],"sourcesContent":["import ts from 'typescript';\nimport { Slot, SlotRegistry } from '@teambit/harmony';\nimport { CLIAspect, CLIMain, MainRuntime } from '@teambit/cli';\nimport { Compiler, CompilerAspect, CompilerMain } from '@teambit/compiler';\nimport { Logger, LoggerAspect, LoggerMain } from '@teambit/logger';\nimport { SchemaAspect, SchemaExtractor, SchemaMain } from '@teambit/schema';\nimport { PackageJsonProps } from '@teambit/pkg';\nimport { TypescriptConfigMutator } from '@teambit/typescript.modules.ts-config-mutator';\nimport { WorkspaceAspect } from '@teambit/workspace';\nimport type { Workspace } from '@teambit/workspace';\nimport { DependencyResolverAspect, DependencyResolverMain } from '@teambit/dependency-resolver';\nimport pMapSeries from 'p-map-series';\nimport { TsserverClient, TsserverClientOpts } from '@teambit/ts-server';\nimport AspectLoaderAspect, { AspectLoaderMain } from '@teambit/aspect-loader';\nimport WorkspaceConfigFilesAspect, { WorkspaceConfigFilesMain } from '@teambit/workspace-config-files';\nimport WatcherAspect, { WatcherMain, WatchOptions } from '@teambit/watcher';\nimport type { Component } from '@teambit/component';\nimport { BuilderAspect, BuilderMain } from '@teambit/builder';\nimport EnvsAspect, { EnvsMain } from '@teambit/envs';\nimport { ScopeMain, ScopeAspect } from '@teambit/scope';\nimport { TypeScriptExtractor } from './typescript.extractor';\nimport { TypeScriptCompilerOptions } from './compiler-options';\nimport { TypescriptAspect } from './typescript.aspect';\nimport { TypescriptCompiler } from './typescript.compiler';\nimport { TypeScriptParser } from './typescript.parser';\nimport { SchemaTransformer } from './schema-transformer';\nimport { SchemaTransformerPlugin } from './schema-transformer.plugin';\nimport {\n ExportDeclarationTransformer,\n TypeAliasTransformer,\n FunctionLikeTransformer,\n SetAccessorTransformer,\n GetAccessorTransformer,\n IndexSignatureTransformer,\n PropertyDeclarationTransformer,\n ParameterTransformer,\n VariableStatementTransformer,\n VariableDeclaration,\n SourceFileTransformer,\n ClassDeclarationTransformer,\n InterfaceDeclarationTransformer,\n EnumDeclarationTransformer,\n BindingElementTransformer,\n ExportAssignmentTransformer,\n ImportDeclarationTransformer,\n IntersectionTypeTransformer,\n UnionTypeTransformer,\n TypeReferenceTransformer,\n TypeLiteralTransformer,\n LiteralTypeTransformer,\n TypeQueryTransformer,\n ArrayTypeTransformer,\n TypeOperatorTransformer,\n KeywordTypeTransformer,\n TupleTypeTransformer,\n ParenthesizedTypeTransformer,\n TypePredicateTransformer,\n IndexedAccessTypeTransformer,\n TemplateLiteralTypeSpanTransformer,\n TemplateLiteralTypeTransformer,\n ThisTypeTransformer,\n ConditionalTypeTransformer,\n NamedTupleTransformer,\n ConstructorTransformer,\n ExpressionStatementTransformer,\n ModuleDeclarationTransformer,\n} from './transformers';\nimport { CheckTypesCmd } from './cmds/check-types.cmd';\nimport { TsconfigPathsPerEnv, TsconfigWriter } from './tsconfig-writer';\nimport WriteTsconfigCmd from './cmds/write-tsconfig.cmd';\nimport { TypescriptConfigWriter } from './ts-config-writer';\nimport { RemoveTypesTask } from './remove-types-task';\n\nexport type TsMode = 'build' | 'dev';\n\nexport type SchemaTransformerSlot = SlotRegistry<SchemaTransformer[]>;\n\nexport type TsConfigTransformContext = {\n // mode: TsMode;\n};\n\nexport type TsconfigWriterOptions = {\n clean?: boolean;\n silent?: boolean; // no prompt\n dedupe?: boolean;\n dryRun?: boolean;\n dryRunWithTsconfig?: boolean;\n};\n\nexport type TsConfigTransformer = (\n config: TypescriptConfigMutator,\n context: TsConfigTransformContext\n) => TypescriptConfigMutator;\n\nexport class TypescriptMain {\n constructor(\n private logger: Logger,\n readonly schemaTransformerSlot: SchemaTransformerSlot,\n readonly workspace: Workspace,\n readonly scope: ScopeMain,\n readonly depResolver: DependencyResolverMain,\n private envs: EnvsMain,\n private tsConfigWriter: TsconfigWriter,\n private aspectLoader: AspectLoaderMain\n ) {}\n\n private tsServer: TsserverClient;\n /**\n * create a new compiler.\n */\n createCompiler(\n options: TypeScriptCompilerOptions,\n transformers: TsConfigTransformer[] = [],\n tsModule = ts\n ): Compiler {\n const configMutator = new TypescriptConfigMutator(options);\n const transformerContext: TsConfigTransformContext = {};\n const afterMutation = runTransformersWithContext(configMutator.clone(), transformers, transformerContext);\n return new TypescriptCompiler(TypescriptAspect.id, this.logger, afterMutation.raw, tsModule);\n }\n\n /**\n * get TsserverClient instance if initiated already, otherwise, return undefined.\n */\n getTsserverClient(): TsserverClient | undefined {\n return this.tsServer;\n }\n\n /**\n * starts a tsserver process to communicate with its API.\n * @param projectPath absolute path of the project root directory\n * @param options TsserverClientOpts\n * @param files optionally, if check-types is enabled, provide files to open and type check.\n * @returns TsserverClient\n */\n async initTsserverClient(\n projectPath: string,\n options: TsserverClientOpts = {},\n files: string[] = []\n ): Promise<TsserverClient> {\n this.tsServer = new TsserverClient(projectPath, this.logger, options, files);\n await this.tsServer.init();\n return this.tsServer;\n }\n\n /**\n * starts a tsserver process to communicate with its API. use only when running on the workspace.\n * @param options TsserverClientOpts\n * @param files optionally, if check-types is enabled, provide files to open and type check.\n * @returns TsserverClient\n */\n async initTsserverClientFromWorkspace(\n options: TsserverClientOpts = {},\n files: string[] = []\n ): Promise<TsserverClient> {\n if (!this.workspace) {\n throw new Error(`initTsserverClientFromWorkspace: workspace was not found`);\n }\n return this.initTsserverClient(this.workspace.path, options, files);\n }\n\n /**\n * Create a compiler instance and run the cjs transformer for it\n * @param options\n * @param transformers\n * @param tsModule\n * @returns\n */\n createCjsCompiler(options: TypeScriptCompilerOptions, transformers: TsConfigTransformer[] = [], tsModule = ts) {\n return this.createCompiler(options, [this.getCjsTransformer(), ...transformers], tsModule);\n }\n\n /**\n * Create a compiler instance and run the esm transformer for it\n * @param options\n * @param transformers\n * @param tsModule\n * @returns\n */\n createEsmCompiler(options: TypeScriptCompilerOptions, transformers: TsConfigTransformer[] = [], tsModule = ts) {\n return this.createCompiler(options, [this.getEsmTransformer(), ...transformers], tsModule);\n }\n\n /**\n * Create a transformer that change the ts module to CommonJS\n * @returns\n */\n getCjsTransformer(): TsConfigTransformer {\n const cjsTransformer = (config: TypescriptConfigMutator) => {\n config.setModule('CommonJS');\n return config;\n };\n return cjsTransformer;\n }\n\n /**\n * Create a transformer that change the ts module to ES2020\n * @returns\n */\n getEsmTransformer(): TsConfigTransformer {\n const esmTransformer = (config: TypescriptConfigMutator) => {\n config.setTarget('ES2017');\n config.raw.tsconfig.compilerOptions.module = 'es2020';\n config.raw.tsconfig.compilerOptions.lib = ['es2021', 'dom', 'ESNext.String', 'dom.Iterable'];\n return config;\n };\n return esmTransformer;\n }\n\n /**\n * create an instance of a typescript semantic schema extractor.\n */\n createSchemaExtractor(tsconfig: any, tsserverPath?: string, contextPath?: string): SchemaExtractor {\n return new TypeScriptExtractor(\n tsconfig,\n this.schemaTransformerSlot,\n this,\n tsserverPath || this.workspace?.path || '',\n contextPath || this.workspace?.path || '',\n this.depResolver,\n this.workspace,\n this.scope,\n this.aspectLoader,\n this.logger\n );\n }\n\n /**\n * add the default package json properties to the component\n * :TODO @gilad why do we need this DSL? can't I just get the args here.\n */\n getCjsPackageJsonProps(): PackageJsonProps {\n return {\n main: 'dist/{main}.js',\n types: '{main}.ts',\n };\n }\n\n /**\n * add type: module to the package.json props and the default props\n * :TODO @gilad why do we need this DSL? can't I just get the args here.\n */\n getEsmPackageJsonProps(): PackageJsonProps {\n return {\n // main: 'dist-esm/{main}.js',\n main: 'dist/{main}.js',\n type: 'module',\n types: '{main}.ts',\n };\n }\n\n getSupportedFilesForTsserver(components: Component[]): string[] {\n const files = components\n .map((c) => c.filesystem.files)\n .flat()\n .map((f) => f.path);\n return files.filter((f) => f.endsWith('.ts') || f.endsWith('.tsx'));\n }\n\n async cleanTsconfigJson(options: TsconfigWriterOptions = {}) {\n const components = await this.workspace.list();\n const runtime = await this.envs.createEnvironment(components);\n const execContext = runtime.getEnvExecutionContext();\n\n const results = await new TsconfigWriter(this.workspace, this.logger).clean(execContext, options);\n\n return results;\n }\n\n async writeTsconfigJson(options: TsconfigWriterOptions = {}): Promise<{\n cleanResults?: string[];\n writeResults: TsconfigPathsPerEnv[];\n }> {\n const components = await this.workspace.list();\n const runtime = await this.envs.createEnvironment(components);\n const execContext = runtime.getEnvExecutionContext();\n\n let cleanResults: string[] | undefined;\n if (options.clean) {\n cleanResults = await this.tsConfigWriter.clean(execContext, options);\n }\n\n const writeResults = await this.tsConfigWriter.write(execContext, options);\n\n return { writeResults, cleanResults };\n }\n\n private async onPreWatch(components: Component[], watchOpts: WatchOptions) {\n const workspace = this.workspace;\n if (!workspace || !watchOpts.spawnTSServer) {\n return;\n }\n const { verbose, checkTypes } = watchOpts;\n const files = checkTypes ? this.getSupportedFilesForTsserver(components) : [];\n const printTypeErrors = Boolean(checkTypes);\n await this.initTsserverClientFromWorkspace({ verbose, checkTypes, printTypeErrors }, files);\n }\n\n private async onComponentChange(component: Component, files: string[]) {\n if (!this.tsServer) {\n return {\n results: 'N/A',\n };\n }\n await pMapSeries(files, (file) => this.tsServer.onFileChange(file));\n return {\n results: 'succeed',\n };\n }\n\n static runtime = MainRuntime;\n static dependencies = [\n SchemaAspect,\n LoggerAspect,\n AspectLoaderAspect,\n WorkspaceAspect,\n CLIAspect,\n DependencyResolverAspect,\n EnvsAspect,\n WatcherAspect,\n WorkspaceConfigFilesAspect,\n CompilerAspect,\n ScopeAspect,\n BuilderAspect,\n ];\n static slots = [Slot.withType<SchemaTransformer[]>()];\n\n static async provider(\n [\n schema,\n loggerExt,\n aspectLoader,\n workspace,\n cli,\n depResolver,\n envs,\n watcher,\n workspaceConfigFiles,\n compiler,\n scope,\n builder,\n ]: [\n SchemaMain,\n LoggerMain,\n AspectLoaderMain,\n Workspace,\n CLIMain,\n DependencyResolverMain,\n EnvsMain,\n WatcherMain,\n WorkspaceConfigFilesMain,\n CompilerMain,\n ScopeMain,\n BuilderMain\n ],\n config,\n [schemaTransformerSlot]: [SchemaTransformerSlot]\n ) {\n schema.registerParser(new TypeScriptParser());\n const logger = loggerExt.createLogger(TypescriptAspect.id);\n workspaceConfigFiles.registerConfigWriter(new TypescriptConfigWriter(compiler, logger));\n\n aspectLoader.registerPlugins([new SchemaTransformerPlugin(schemaTransformerSlot)]);\n const tsconfigWriter = new TsconfigWriter(workspace, logger);\n const tsMain = new TypescriptMain(\n logger,\n schemaTransformerSlot,\n workspace,\n scope,\n depResolver,\n envs,\n tsconfigWriter,\n aspectLoader\n );\n schemaTransformerSlot.register([\n new ExportDeclarationTransformer(),\n new ExportAssignmentTransformer(),\n new FunctionLikeTransformer(),\n new ParameterTransformer(),\n new SetAccessorTransformer(),\n new GetAccessorTransformer(),\n new IndexSignatureTransformer(),\n new PropertyDeclarationTransformer(),\n new VariableStatementTransformer(),\n new VariableDeclaration(),\n new SourceFileTransformer(),\n new TypeAliasTransformer(),\n new ClassDeclarationTransformer(),\n new InterfaceDeclarationTransformer(),\n new EnumDeclarationTransformer(),\n new BindingElementTransformer(),\n new IntersectionTypeTransformer(),\n new UnionTypeTransformer(),\n new TypeReferenceTransformer(),\n new TypeLiteralTransformer(),\n new LiteralTypeTransformer(),\n new TypeQueryTransformer(),\n new ArrayTypeTransformer(),\n new TypeOperatorTransformer(),\n new KeywordTypeTransformer(),\n new TupleTypeTransformer(),\n new ParenthesizedTypeTransformer(),\n new TypePredicateTransformer(),\n new IndexedAccessTypeTransformer(),\n new TemplateLiteralTypeSpanTransformer(),\n new TemplateLiteralTypeTransformer(),\n new ThisTypeTransformer(),\n new ConditionalTypeTransformer(),\n new NamedTupleTransformer(),\n new ConstructorTransformer(),\n new ImportDeclarationTransformer(),\n new ExpressionStatementTransformer(),\n new ModuleDeclarationTransformer(),\n ]);\n\n if (workspace) {\n watcher.registerOnPreWatch(tsMain.onPreWatch.bind(tsMain));\n workspace.registerOnComponentChange(tsMain.onComponentChange.bind(tsMain));\n workspace.registerOnComponentAdd(tsMain.onComponentChange.bind(tsMain));\n }\n\n const removeTypesTask = new RemoveTypesTask();\n builder.registerSnapTasks([removeTypesTask]);\n builder.registerTagTasks([removeTypesTask]);\n\n const checkTypesCmd = new CheckTypesCmd(tsMain, workspace, logger);\n const writeTsconfigCmd = new WriteTsconfigCmd(tsMain);\n cli.register(checkTypesCmd, writeTsconfigCmd);\n\n return tsMain;\n }\n}\n\nTypescriptAspect.addRuntime(TypescriptMain);\n\nexport function runTransformersWithContext(\n config: TypescriptConfigMutator,\n transformers: TsConfigTransformer[] = [],\n context: TsConfigTransformContext\n): TypescriptConfigMutator {\n if (!Array.isArray(transformers)) return config;\n const newConfig = transformers.reduce((acc, transformer) => {\n return transformer(acc, context);\n }, config);\n return newConfig;\n}\n\nexport default TypescriptMain;\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;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KAAK;IAC1D,OAAOA,WAAW,CAACD,GAAG,EAAEL,OAAO,CAAC;EAClC,CAAC,EAAEvI,MAAM,CAAC;EACV,OAAO0I,SAAS;AAClB;AAAC,eAEclL,cAAc;AAAA"}
|
|
1
|
+
{"version":3,"names":["TypescriptMain","constructor","logger","schemaTransformerSlot","workspace","scope","depResolver","envs","tsConfigWriter","aspectLoader","createCompiler","options","transformers","tsModule","ts","configMutator","TypescriptConfigMutator","transformerContext","afterMutation","runTransformersWithContext","clone","TypescriptCompiler","TypescriptAspect","id","raw","getTsserverClient","tsServer","initTsserverClient","projectPath","files","TsserverClient","init","initTsserverClientFromWorkspace","Error","path","createCjsCompiler","getCjsTransformer","createEsmCompiler","getEsmTransformer","cjsTransformer","config","setModule","esmTransformer","setTarget","tsconfig","compilerOptions","module","lib","createSchemaExtractor","tsserverPath","contextPath","TypeScriptExtractor","getCjsPackageJsonProps","main","types","getEsmPackageJsonProps","type","getSupportedFilesForTsserver","components","map","c","filesystem","flat","f","filter","endsWith","cleanTsconfigJson","list","runtime","createEnvironment","execContext","getEnvExecutionContext","results","TsconfigWriter","clean","writeTsconfigJson","cleanResults","writeResults","write","onPreWatch","watchOpts","spawnTSServer","verbose","checkTypes","printTypeErrors","Boolean","onComponentChange","component","pMapSeries","file","onFileChange","provider","schema","loggerExt","cli","watcher","builder","registerParser","TypeScriptParser","createLogger","registerPlugins","SchemaTransformerPlugin","tsconfigWriter","tsMain","register","ExportDeclarationTransformer","ExportAssignmentTransformer","FunctionLikeTransformer","ParameterTransformer","SetAccessorTransformer","GetAccessorTransformer","IndexSignatureTransformer","PropertyDeclarationTransformer","VariableStatementTransformer","VariableDeclaration","SourceFileTransformer","TypeAliasTransformer","ClassDeclarationTransformer","InterfaceDeclarationTransformer","EnumDeclarationTransformer","BindingElementTransformer","IntersectionTypeTransformer","UnionTypeTransformer","TypeReferenceTransformer","TypeLiteralTransformer","LiteralTypeTransformer","TypeQueryTransformer","ArrayTypeTransformer","TypeOperatorTransformer","KeywordTypeTransformer","TupleTypeTransformer","ParenthesizedTypeTransformer","TypePredicateTransformer","IndexedAccessTypeTransformer","TemplateLiteralTypeSpanTransformer","TemplateLiteralTypeTransformer","ThisTypeTransformer","ConditionalTypeTransformer","NamedTupleTransformer","ConstructorTransformer","ImportDeclarationTransformer","ExpressionStatementTransformer","ModuleDeclarationTransformer","registerOnPreWatch","bind","registerOnComponentChange","registerOnComponentAdd","removeTypesTask","RemoveTypesTask","registerSnapTasks","registerTagTasks","checkTypesCmd","CheckTypesCmd","writeTsconfigCmd","WriteTsconfigCmd","MainRuntime","SchemaAspect","LoggerAspect","AspectLoaderAspect","WorkspaceAspect","CLIAspect","DependencyResolverAspect","EnvsAspect","WatcherAspect","ScopeAspect","BuilderAspect","Slot","withType","addRuntime","context","Array","isArray","newConfig","reduce","acc","transformer"],"sources":["typescript.main.runtime.ts"],"sourcesContent":["import ts from 'typescript';\nimport { Slot, SlotRegistry } from '@teambit/harmony';\nimport { CLIAspect, CLIMain, MainRuntime } from '@teambit/cli';\nimport { Compiler } from '@teambit/compiler';\nimport { Logger, LoggerAspect, LoggerMain } from '@teambit/logger';\nimport { SchemaAspect, SchemaExtractor, SchemaMain } from '@teambit/schema';\nimport { PackageJsonProps } from '@teambit/pkg';\nimport { TypescriptConfigMutator } from '@teambit/typescript.modules.ts-config-mutator';\nimport { WorkspaceAspect } from '@teambit/workspace';\nimport type { Workspace } from '@teambit/workspace';\nimport { DependencyResolverAspect, DependencyResolverMain } from '@teambit/dependency-resolver';\nimport pMapSeries from 'p-map-series';\nimport { TsserverClient, TsserverClientOpts } from '@teambit/ts-server';\nimport AspectLoaderAspect, { AspectLoaderMain } from '@teambit/aspect-loader';\nimport WatcherAspect, { WatcherMain, WatchOptions } from '@teambit/watcher';\nimport type { Component } from '@teambit/component';\nimport { BuilderAspect, BuilderMain } from '@teambit/builder';\nimport EnvsAspect, { EnvsMain } from '@teambit/envs';\nimport { ScopeMain, ScopeAspect } from '@teambit/scope';\nimport { TypeScriptExtractor } from './typescript.extractor';\nimport { TypeScriptCompilerOptions } from './compiler-options';\nimport { TypescriptAspect } from './typescript.aspect';\nimport { TypescriptCompiler } from './typescript.compiler';\nimport { TypeScriptParser } from './typescript.parser';\nimport { SchemaTransformer } from './schema-transformer';\nimport { SchemaTransformerPlugin } from './schema-transformer.plugin';\nimport {\n ExportDeclarationTransformer,\n TypeAliasTransformer,\n FunctionLikeTransformer,\n SetAccessorTransformer,\n GetAccessorTransformer,\n IndexSignatureTransformer,\n PropertyDeclarationTransformer,\n ParameterTransformer,\n VariableStatementTransformer,\n VariableDeclaration,\n SourceFileTransformer,\n ClassDeclarationTransformer,\n InterfaceDeclarationTransformer,\n EnumDeclarationTransformer,\n BindingElementTransformer,\n ExportAssignmentTransformer,\n ImportDeclarationTransformer,\n IntersectionTypeTransformer,\n UnionTypeTransformer,\n TypeReferenceTransformer,\n TypeLiteralTransformer,\n LiteralTypeTransformer,\n TypeQueryTransformer,\n ArrayTypeTransformer,\n TypeOperatorTransformer,\n KeywordTypeTransformer,\n TupleTypeTransformer,\n ParenthesizedTypeTransformer,\n TypePredicateTransformer,\n IndexedAccessTypeTransformer,\n TemplateLiteralTypeSpanTransformer,\n TemplateLiteralTypeTransformer,\n ThisTypeTransformer,\n ConditionalTypeTransformer,\n NamedTupleTransformer,\n ConstructorTransformer,\n ExpressionStatementTransformer,\n ModuleDeclarationTransformer,\n} from './transformers';\nimport { CheckTypesCmd } from './cmds/check-types.cmd';\nimport { TsconfigPathsPerEnv, TsconfigWriter } from './tsconfig-writer';\nimport WriteTsconfigCmd from './cmds/write-tsconfig.cmd';\nimport { RemoveTypesTask } from './remove-types-task';\n\nexport type TsMode = 'build' | 'dev';\n\nexport type SchemaTransformerSlot = SlotRegistry<SchemaTransformer[]>;\n\nexport type TsConfigTransformContext = {\n // mode: TsMode;\n};\n\nexport type TsconfigWriterOptions = {\n clean?: boolean;\n silent?: boolean; // no prompt\n dedupe?: boolean;\n dryRun?: boolean;\n dryRunWithTsconfig?: boolean;\n};\n\nexport type TsConfigTransformer = (\n config: TypescriptConfigMutator,\n context: TsConfigTransformContext\n) => TypescriptConfigMutator;\n\nexport class TypescriptMain {\n constructor(\n private logger: Logger,\n readonly schemaTransformerSlot: SchemaTransformerSlot,\n readonly workspace: Workspace,\n readonly scope: ScopeMain,\n readonly depResolver: DependencyResolverMain,\n private envs: EnvsMain,\n private tsConfigWriter: TsconfigWriter,\n private aspectLoader: AspectLoaderMain\n ) {}\n\n private tsServer: TsserverClient;\n /**\n * create a new compiler.\n */\n createCompiler(\n options: TypeScriptCompilerOptions,\n transformers: TsConfigTransformer[] = [],\n tsModule = ts\n ): Compiler {\n const configMutator = new TypescriptConfigMutator(options);\n const transformerContext: TsConfigTransformContext = {};\n const afterMutation = runTransformersWithContext(configMutator.clone(), transformers, transformerContext);\n return new TypescriptCompiler(TypescriptAspect.id, this.logger, afterMutation.raw, tsModule);\n }\n\n /**\n * get TsserverClient instance if initiated already, otherwise, return undefined.\n */\n getTsserverClient(): TsserverClient | undefined {\n return this.tsServer;\n }\n\n /**\n * starts a tsserver process to communicate with its API.\n * @param projectPath absolute path of the project root directory\n * @param options TsserverClientOpts\n * @param files optionally, if check-types is enabled, provide files to open and type check.\n * @returns TsserverClient\n */\n async initTsserverClient(\n projectPath: string,\n options: TsserverClientOpts = {},\n files: string[] = []\n ): Promise<TsserverClient> {\n this.tsServer = new TsserverClient(projectPath, this.logger, options, files);\n await this.tsServer.init();\n return this.tsServer;\n }\n\n /**\n * starts a tsserver process to communicate with its API. use only when running on the workspace.\n * @param options TsserverClientOpts\n * @param files optionally, if check-types is enabled, provide files to open and type check.\n * @returns TsserverClient\n */\n async initTsserverClientFromWorkspace(\n options: TsserverClientOpts = {},\n files: string[] = []\n ): Promise<TsserverClient> {\n if (!this.workspace) {\n throw new Error(`initTsserverClientFromWorkspace: workspace was not found`);\n }\n return this.initTsserverClient(this.workspace.path, options, files);\n }\n\n /**\n * Create a compiler instance and run the cjs transformer for it\n * @param options\n * @param transformers\n * @param tsModule\n * @returns\n */\n createCjsCompiler(options: TypeScriptCompilerOptions, transformers: TsConfigTransformer[] = [], tsModule = ts) {\n return this.createCompiler(options, [this.getCjsTransformer(), ...transformers], tsModule);\n }\n\n /**\n * Create a compiler instance and run the esm transformer for it\n * @param options\n * @param transformers\n * @param tsModule\n * @returns\n */\n createEsmCompiler(options: TypeScriptCompilerOptions, transformers: TsConfigTransformer[] = [], tsModule = ts) {\n return this.createCompiler(options, [this.getEsmTransformer(), ...transformers], tsModule);\n }\n\n /**\n * Create a transformer that change the ts module to CommonJS\n * @returns\n */\n getCjsTransformer(): TsConfigTransformer {\n const cjsTransformer = (config: TypescriptConfigMutator) => {\n config.setModule('CommonJS');\n return config;\n };\n return cjsTransformer;\n }\n\n /**\n * Create a transformer that change the ts module to ES2020\n * @returns\n */\n getEsmTransformer(): TsConfigTransformer {\n const esmTransformer = (config: TypescriptConfigMutator) => {\n config.setTarget('ES2017');\n config.raw.tsconfig.compilerOptions.module = 'es2020';\n config.raw.tsconfig.compilerOptions.lib = ['es2021', 'dom', 'ESNext.String', 'dom.Iterable'];\n return config;\n };\n return esmTransformer;\n }\n\n /**\n * create an instance of a typescript semantic schema extractor.\n */\n createSchemaExtractor(tsconfig: any, tsserverPath?: string, contextPath?: string): SchemaExtractor {\n return new TypeScriptExtractor(\n tsconfig,\n this.schemaTransformerSlot,\n this,\n tsserverPath || this.workspace?.path || '',\n contextPath || this.workspace?.path || '',\n this.depResolver,\n this.workspace,\n this.scope,\n this.aspectLoader,\n this.logger\n );\n }\n\n /**\n * add the default package json properties to the component\n * :TODO @gilad why do we need this DSL? can't I just get the args here.\n */\n getCjsPackageJsonProps(): PackageJsonProps {\n return {\n main: 'dist/{main}.js',\n types: '{main}.ts',\n };\n }\n\n /**\n * add type: module to the package.json props and the default props\n * :TODO @gilad why do we need this DSL? can't I just get the args here.\n */\n getEsmPackageJsonProps(): PackageJsonProps {\n return {\n // main: 'dist-esm/{main}.js',\n main: 'dist/{main}.js',\n type: 'module',\n types: '{main}.ts',\n };\n }\n\n getSupportedFilesForTsserver(components: Component[]): string[] {\n const files = components\n .map((c) => c.filesystem.files)\n .flat()\n .map((f) => f.path);\n return files.filter((f) => f.endsWith('.ts') || f.endsWith('.tsx'));\n }\n\n async cleanTsconfigJson(options: TsconfigWriterOptions = {}) {\n const components = await this.workspace.list();\n const runtime = await this.envs.createEnvironment(components);\n const execContext = runtime.getEnvExecutionContext();\n\n const results = await new TsconfigWriter(this.workspace, this.logger).clean(execContext, options);\n\n return results;\n }\n\n async writeTsconfigJson(options: TsconfigWriterOptions = {}): Promise<{\n cleanResults?: string[];\n writeResults: TsconfigPathsPerEnv[];\n }> {\n const components = await this.workspace.list();\n const runtime = await this.envs.createEnvironment(components);\n const execContext = runtime.getEnvExecutionContext();\n\n let cleanResults: string[] | undefined;\n if (options.clean) {\n cleanResults = await this.tsConfigWriter.clean(execContext, options);\n }\n\n const writeResults = await this.tsConfigWriter.write(execContext, options);\n\n return { writeResults, cleanResults };\n }\n\n private async onPreWatch(components: Component[], watchOpts: WatchOptions) {\n const workspace = this.workspace;\n if (!workspace || !watchOpts.spawnTSServer) {\n return;\n }\n const { verbose, checkTypes } = watchOpts;\n const files = checkTypes ? this.getSupportedFilesForTsserver(components) : [];\n const printTypeErrors = Boolean(checkTypes);\n await this.initTsserverClientFromWorkspace({ verbose, checkTypes, printTypeErrors }, files);\n }\n\n private async onComponentChange(component: Component, files: string[]) {\n if (!this.tsServer) {\n return {\n results: 'N/A',\n };\n }\n await pMapSeries(files, (file) => this.tsServer.onFileChange(file));\n return {\n results: 'succeed',\n };\n }\n\n static runtime = MainRuntime;\n static dependencies = [\n SchemaAspect,\n LoggerAspect,\n AspectLoaderAspect,\n WorkspaceAspect,\n CLIAspect,\n DependencyResolverAspect,\n EnvsAspect,\n WatcherAspect,\n ScopeAspect,\n BuilderAspect,\n ];\n static slots = [Slot.withType<SchemaTransformer[]>()];\n\n static async provider(\n [schema, loggerExt, aspectLoader, workspace, cli, depResolver, envs, watcher, scope, builder]: [\n SchemaMain,\n LoggerMain,\n AspectLoaderMain,\n Workspace,\n CLIMain,\n DependencyResolverMain,\n EnvsMain,\n WatcherMain,\n ScopeMain,\n BuilderMain\n ],\n config,\n [schemaTransformerSlot]: [SchemaTransformerSlot]\n ) {\n schema.registerParser(new TypeScriptParser());\n const logger = loggerExt.createLogger(TypescriptAspect.id);\n\n aspectLoader.registerPlugins([new SchemaTransformerPlugin(schemaTransformerSlot)]);\n const tsconfigWriter = new TsconfigWriter(workspace, logger);\n const tsMain = new TypescriptMain(\n logger,\n schemaTransformerSlot,\n workspace,\n scope,\n depResolver,\n envs,\n tsconfigWriter,\n aspectLoader\n );\n schemaTransformerSlot.register([\n new ExportDeclarationTransformer(),\n new ExportAssignmentTransformer(),\n new FunctionLikeTransformer(),\n new ParameterTransformer(),\n new SetAccessorTransformer(),\n new GetAccessorTransformer(),\n new IndexSignatureTransformer(),\n new PropertyDeclarationTransformer(),\n new VariableStatementTransformer(),\n new VariableDeclaration(),\n new SourceFileTransformer(),\n new TypeAliasTransformer(),\n new ClassDeclarationTransformer(),\n new InterfaceDeclarationTransformer(),\n new EnumDeclarationTransformer(),\n new BindingElementTransformer(),\n new IntersectionTypeTransformer(),\n new UnionTypeTransformer(),\n new TypeReferenceTransformer(),\n new TypeLiteralTransformer(),\n new LiteralTypeTransformer(),\n new TypeQueryTransformer(),\n new ArrayTypeTransformer(),\n new TypeOperatorTransformer(),\n new KeywordTypeTransformer(),\n new TupleTypeTransformer(),\n new ParenthesizedTypeTransformer(),\n new TypePredicateTransformer(),\n new IndexedAccessTypeTransformer(),\n new TemplateLiteralTypeSpanTransformer(),\n new TemplateLiteralTypeTransformer(),\n new ThisTypeTransformer(),\n new ConditionalTypeTransformer(),\n new NamedTupleTransformer(),\n new ConstructorTransformer(),\n new ImportDeclarationTransformer(),\n new ExpressionStatementTransformer(),\n new ModuleDeclarationTransformer(),\n ]);\n\n if (workspace) {\n watcher.registerOnPreWatch(tsMain.onPreWatch.bind(tsMain));\n workspace.registerOnComponentChange(tsMain.onComponentChange.bind(tsMain));\n workspace.registerOnComponentAdd(tsMain.onComponentChange.bind(tsMain));\n }\n\n const removeTypesTask = new RemoveTypesTask();\n builder.registerSnapTasks([removeTypesTask]);\n builder.registerTagTasks([removeTypesTask]);\n\n const checkTypesCmd = new CheckTypesCmd(tsMain, workspace, logger);\n const writeTsconfigCmd = new WriteTsconfigCmd(tsMain);\n cli.register(checkTypesCmd, writeTsconfigCmd);\n\n return tsMain;\n }\n}\n\nTypescriptAspect.addRuntime(TypescriptMain);\n\nexport function runTransformersWithContext(\n config: TypescriptConfigMutator,\n transformers: TsConfigTransformer[] = [],\n context: TsConfigTransformContext\n): TypescriptConfigMutator {\n if (!Array.isArray(transformers)) return config;\n const newConfig = transformers.reduce((acc, transformer) => {\n return transformer(acc, context);\n }, config);\n return newConfig;\n}\n\nexport default TypescriptMain;\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;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;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;AAEA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;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;EACf;AACF;AAAC;AAAA,gCA/TYvG,cAAc,aAwNR2J,kBAAW;AAAA,gCAxNjB3J,cAAc,kBAyNH,CACpB4J,sBAAY,EACZC,sBAAY,EACZC,uBAAkB,EAClBC,4BAAe,EACfC,gBAAS,EACTC,8CAAwB,EACxBC,eAAU,EACVC,kBAAa,EACbC,oBAAW,EACXC,wBAAa,CACd;AAAA,gCApOUrK,cAAc,WAqOV,CAACsK,eAAI,CAACC,QAAQ,EAAuB,CAAC;AA4FvDjJ,+BAAgB,CAACkJ,UAAU,CAACxK,cAAc,CAAC;AAEpC,SAASmB,0BAA0B,CACxCqB,MAA+B,EAC/B5B,YAAmC,GAAG,EAAE,EACxC6J,OAAiC,EACR;EACzB,IAAI,CAACC,KAAK,CAACC,OAAO,CAAC/J,YAAY,CAAC,EAAE,OAAO4B,MAAM;EAC/C,MAAMoI,SAAS,GAAGhK,YAAY,CAACiK,MAAM,CAAC,CAACC,GAAG,EAAEC,WAAW,KAAK;IAC1D,OAAOA,WAAW,CAACD,GAAG,EAAEL,OAAO,CAAC;EAClC,CAAC,EAAEjI,MAAM,CAAC;EACV,OAAOoI,SAAS;AAClB;AAAC,eAEc5K,cAAc;AAAA"}
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,46 +1,44 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@teambit/typescript",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.1104",
|
|
4
4
|
"homepage": "https://bit.cloud/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.
|
|
9
|
+
"version": "0.0.1104"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"get-tsconfig": "4.2.0",
|
|
13
12
|
"lodash": "4.17.21",
|
|
14
13
|
"p-map-series": "2.1.0",
|
|
15
14
|
"tsutils": "3.21.0",
|
|
16
15
|
"typescript": "4.7.4",
|
|
17
|
-
"comment-json": "3.0.3",
|
|
18
|
-
"fs-extra": "10.0.0",
|
|
19
16
|
"chalk": "2.4.2",
|
|
17
|
+
"fs-extra": "10.0.0",
|
|
20
18
|
"yesno": "0.4.0",
|
|
19
|
+
"get-tsconfig": "4.2.0",
|
|
21
20
|
"core-js": "^3.0.0",
|
|
22
21
|
"@babel/runtime": "7.20.0",
|
|
23
22
|
"@teambit/harmony": "0.4.6",
|
|
24
|
-
"@teambit/compiler": "0.0.
|
|
23
|
+
"@teambit/compiler": "0.0.1104",
|
|
25
24
|
"@teambit/typescript.modules.ts-config-mutator": "0.0.76",
|
|
26
|
-
"@teambit/builder": "0.0.
|
|
27
|
-
"@teambit/isolator": "0.0.
|
|
28
|
-
"@teambit/component": "0.0.
|
|
29
|
-
"@teambit/dependency-resolver": "0.0.
|
|
30
|
-
"@teambit/formatter": "0.0.
|
|
25
|
+
"@teambit/builder": "0.0.1104",
|
|
26
|
+
"@teambit/isolator": "0.0.1104",
|
|
27
|
+
"@teambit/component": "0.0.1104",
|
|
28
|
+
"@teambit/dependency-resolver": "0.0.1104",
|
|
29
|
+
"@teambit/formatter": "0.0.655",
|
|
31
30
|
"@teambit/semantics.entities.semantic-schema": "0.0.53",
|
|
32
31
|
"@teambit/ts-server": "0.0.48",
|
|
33
|
-
"@teambit/aspect-loader": "0.0.
|
|
34
|
-
"@teambit/envs": "0.0.
|
|
35
|
-
"@teambit/logger": "0.0.
|
|
36
|
-
"@teambit/workspace
|
|
37
|
-
"@teambit/workspace": "0.0.1103",
|
|
32
|
+
"@teambit/aspect-loader": "0.0.1104",
|
|
33
|
+
"@teambit/envs": "0.0.1104",
|
|
34
|
+
"@teambit/logger": "0.0.833",
|
|
35
|
+
"@teambit/workspace": "0.0.1104",
|
|
38
36
|
"@teambit/bit-error": "0.0.402",
|
|
39
|
-
"@teambit/schema": "0.0.
|
|
40
|
-
"@teambit/scope": "0.0.
|
|
41
|
-
"@teambit/cli": "0.0.
|
|
42
|
-
"@teambit/pkg": "0.0.
|
|
43
|
-
"@teambit/watcher": "0.0.
|
|
37
|
+
"@teambit/schema": "0.0.1104",
|
|
38
|
+
"@teambit/scope": "0.0.1104",
|
|
39
|
+
"@teambit/cli": "0.0.740",
|
|
40
|
+
"@teambit/pkg": "0.0.1104",
|
|
41
|
+
"@teambit/watcher": "0.0.116"
|
|
44
42
|
},
|
|
45
43
|
"devDependencies": {
|
|
46
44
|
"@types/lodash": "4.14.165",
|
|
@@ -56,7 +54,7 @@
|
|
|
56
54
|
"@teambit/typescript.aspect-docs.typescript": "0.0.153"
|
|
57
55
|
},
|
|
58
56
|
"peerDependencies": {
|
|
59
|
-
"@teambit/legacy": "1.0.
|
|
57
|
+
"@teambit/legacy": "1.0.521",
|
|
60
58
|
"react": "^16.8.0 || ^17.0.0",
|
|
61
59
|
"react-dom": "^16.8.0 || ^17.0.0"
|
|
62
60
|
},
|
package/tsconfig.json
CHANGED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { TsConfigJson } from 'get-tsconfig';
|
|
2
|
-
/**
|
|
3
|
-
* It takes a tsconfig.json file, a list of component directories, and returns a new tsconfig.json file with the include
|
|
4
|
-
* and exclude properties expanded to include all the component directories
|
|
5
|
-
* @param {string} tsConfigPath - The path to the tsconfig.json file.
|
|
6
|
-
* @param {TsConfigJson} tsConfig - The tsconfig.json file that we're going to modify.
|
|
7
|
-
* @param {string[]} compDirs - An array of paths to the component directories.
|
|
8
|
-
* @returns the tsConfig object.
|
|
9
|
-
*/
|
|
10
|
-
export declare function expandIncludeExclude(tsConfigPath: string, tsConfig: TsConfigJson, compDirs: string[], globalTypesDir?: string): TsConfigJson;
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.expandIncludeExclude = expandIncludeExclude;
|
|
7
|
-
function _lodash() {
|
|
8
|
-
const data = require("lodash");
|
|
9
|
-
_lodash = function () {
|
|
10
|
-
return data;
|
|
11
|
-
};
|
|
12
|
-
return data;
|
|
13
|
-
}
|
|
14
|
-
function _path() {
|
|
15
|
-
const data = require("path");
|
|
16
|
-
_path = function () {
|
|
17
|
-
return data;
|
|
18
|
-
};
|
|
19
|
-
return data;
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* It takes a tsconfig.json file, a list of component directories, and returns a new tsconfig.json file with the include
|
|
23
|
-
* and exclude properties expanded to include all the component directories
|
|
24
|
-
* @param {string} tsConfigPath - The path to the tsconfig.json file.
|
|
25
|
-
* @param {TsConfigJson} tsConfig - The tsconfig.json file that we're going to modify.
|
|
26
|
-
* @param {string[]} compDirs - An array of paths to the component directories.
|
|
27
|
-
* @returns the tsConfig object.
|
|
28
|
-
*/
|
|
29
|
-
|
|
30
|
-
function expandIncludeExclude(tsConfigPath, tsConfig, compDirs, globalTypesDir) {
|
|
31
|
-
const tsConfigDir = (0, _path().dirname)(tsConfigPath);
|
|
32
|
-
if (tsConfig.include) {
|
|
33
|
-
tsConfig.include = (0, _lodash().flatten)(tsConfig.include.map(includedPath => {
|
|
34
|
-
return compDirs.map(compDir => {
|
|
35
|
-
const compDirRelative = (0, _path().relative)(tsConfigDir, compDir);
|
|
36
|
-
return `${compDirRelative}/${includedPath}`;
|
|
37
|
-
});
|
|
38
|
-
}));
|
|
39
|
-
}
|
|
40
|
-
if (globalTypesDir) {
|
|
41
|
-
tsConfig.include = tsConfig.include || [];
|
|
42
|
-
tsConfig.include.push(`./${globalTypesDir}/**/*`);
|
|
43
|
-
}
|
|
44
|
-
if (tsConfig.exclude) {
|
|
45
|
-
tsConfig.exclude = (0, _lodash().flatten)(tsConfig.exclude.map(excludedPath => {
|
|
46
|
-
return compDirs.map(compDir => {
|
|
47
|
-
const compDirRelative = (0, _path().relative)(tsConfigDir, compDir);
|
|
48
|
-
return `${compDirRelative}/${excludedPath}`;
|
|
49
|
-
});
|
|
50
|
-
}));
|
|
51
|
-
}
|
|
52
|
-
return tsConfig;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
//# sourceMappingURL=expand-include-exclude.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["expandIncludeExclude","tsConfigPath","tsConfig","compDirs","globalTypesDir","tsConfigDir","dirname","include","flatten","map","includedPath","compDir","compDirRelative","relative","push","exclude","excludedPath"],"sources":["expand-include-exclude.ts"],"sourcesContent":["import { TsConfigJson } from 'get-tsconfig';\nimport { flatten } from 'lodash';\nimport { dirname, relative } from 'path';\n\n/**\n * It takes a tsconfig.json file, a list of component directories, and returns a new tsconfig.json file with the include\n * and exclude properties expanded to include all the component directories\n * @param {string} tsConfigPath - The path to the tsconfig.json file.\n * @param {TsConfigJson} tsConfig - The tsconfig.json file that we're going to modify.\n * @param {string[]} compDirs - An array of paths to the component directories.\n * @returns the tsConfig object.\n */\n\nexport function expandIncludeExclude(\n tsConfigPath: string,\n tsConfig: TsConfigJson,\n compDirs: string[],\n globalTypesDir?: string\n) {\n const tsConfigDir = dirname(tsConfigPath);\n\n if (tsConfig.include) {\n tsConfig.include = flatten(\n tsConfig.include.map((includedPath) => {\n return compDirs.map((compDir) => {\n const compDirRelative = relative(tsConfigDir, compDir);\n return `${compDirRelative}/${includedPath}`;\n });\n })\n );\n }\n if (globalTypesDir) {\n tsConfig.include = tsConfig.include || [];\n tsConfig.include.push(`./${globalTypesDir}/**/*`);\n }\n if (tsConfig.exclude) {\n tsConfig.exclude = flatten(\n tsConfig.exclude.map((excludedPath) => {\n return compDirs.map((compDir) => {\n const compDirRelative = relative(tsConfigDir, compDir);\n return `${compDirRelative}/${excludedPath}`;\n });\n })\n );\n }\n return tsConfig;\n}\n"],"mappings":";;;;;;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AACA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEO,SAASA,oBAAoB,CAClCC,YAAoB,EACpBC,QAAsB,EACtBC,QAAkB,EAClBC,cAAuB,EACvB;EACA,MAAMC,WAAW,GAAG,IAAAC,eAAO,EAACL,YAAY,CAAC;EAEzC,IAAIC,QAAQ,CAACK,OAAO,EAAE;IACpBL,QAAQ,CAACK,OAAO,GAAG,IAAAC,iBAAO,EACxBN,QAAQ,CAACK,OAAO,CAACE,GAAG,CAAEC,YAAY,IAAK;MACrC,OAAOP,QAAQ,CAACM,GAAG,CAAEE,OAAO,IAAK;QAC/B,MAAMC,eAAe,GAAG,IAAAC,gBAAQ,EAACR,WAAW,EAAEM,OAAO,CAAC;QACtD,OAAQ,GAAEC,eAAgB,IAAGF,YAAa,EAAC;MAC7C,CAAC,CAAC;IACJ,CAAC,CAAC,CACH;EACH;EACA,IAAIN,cAAc,EAAE;IAClBF,QAAQ,CAACK,OAAO,GAAGL,QAAQ,CAACK,OAAO,IAAI,EAAE;IACzCL,QAAQ,CAACK,OAAO,CAACO,IAAI,CAAE,KAAIV,cAAe,OAAM,CAAC;EACnD;EACA,IAAIF,QAAQ,CAACa,OAAO,EAAE;IACpBb,QAAQ,CAACa,OAAO,GAAG,IAAAP,iBAAO,EACxBN,QAAQ,CAACa,OAAO,CAACN,GAAG,CAAEO,YAAY,IAAK;MACrC,OAAOb,QAAQ,CAACM,GAAG,CAAEE,OAAO,IAAK;QAC/B,MAAMC,eAAe,GAAG,IAAAC,gBAAQ,EAACR,WAAW,EAAEM,OAAO,CAAC;QACtD,OAAQ,GAAEC,eAAgB,IAAGI,YAAa,EAAC;MAC7C,CAAC,CAAC;IACJ,CAAC,CAAC,CACH;EACH;EACA,OAAOd,QAAQ;AACjB"}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { ExecutionContext } from '@teambit/envs';
|
|
2
|
-
import type { ConfigWriterEntry, WrittenConfigFile, ExtendingConfigFile, ConfigFile, EnvMapValue, PostProcessExtendingConfigFilesArgs, GenerateExtendingConfigFilesArgs } from '@teambit/workspace-config-files';
|
|
3
|
-
import { CompilerMain } from '@teambit/compiler';
|
|
4
|
-
import { Logger } from '@teambit/logger';
|
|
5
|
-
export declare const GLOBAL_TYPES_DIR = "global-types";
|
|
6
|
-
export declare class TypescriptConfigWriter implements ConfigWriterEntry {
|
|
7
|
-
private compiler;
|
|
8
|
-
private logger;
|
|
9
|
-
name: string;
|
|
10
|
-
cliName: string;
|
|
11
|
-
constructor(compiler: CompilerMain, logger: Logger);
|
|
12
|
-
patterns: string[];
|
|
13
|
-
calcConfigFiles(executionContext: ExecutionContext): ConfigFile[] | undefined;
|
|
14
|
-
private getGlobalTypesConfigFiles;
|
|
15
|
-
postProcessConfigFiles(writtenConfigFiles: WrittenConfigFile[], executionContext: ExecutionContext, envMapValue: EnvMapValue): Promise<void>;
|
|
16
|
-
generateExtendingFile(args: GenerateExtendingConfigFilesArgs): ExtendingConfigFile | undefined;
|
|
17
|
-
postProcessExtendingConfigFiles?(args: PostProcessExtendingConfigFilesArgs): Promise<void>;
|
|
18
|
-
isBitGenerated(filePath: string): boolean;
|
|
19
|
-
}
|
package/dist/ts-config-writer.js
DELETED
|
@@ -1,174 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
require("core-js/modules/es.array.iterator.js");
|
|
5
|
-
require("core-js/modules/es.promise.js");
|
|
6
|
-
require("core-js/modules/es.regexp.exec.js");
|
|
7
|
-
require("core-js/modules/es.string.replace.js");
|
|
8
|
-
Object.defineProperty(exports, "__esModule", {
|
|
9
|
-
value: true
|
|
10
|
-
});
|
|
11
|
-
exports.TypescriptConfigWriter = exports.GLOBAL_TYPES_DIR = void 0;
|
|
12
|
-
function _defineProperty2() {
|
|
13
|
-
const data = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
14
|
-
_defineProperty2 = function () {
|
|
15
|
-
return data;
|
|
16
|
-
};
|
|
17
|
-
return data;
|
|
18
|
-
}
|
|
19
|
-
function _commentJson() {
|
|
20
|
-
const data = require("comment-json");
|
|
21
|
-
_commentJson = function () {
|
|
22
|
-
return data;
|
|
23
|
-
};
|
|
24
|
-
return data;
|
|
25
|
-
}
|
|
26
|
-
function _utils() {
|
|
27
|
-
const data = require("@teambit/legacy/dist/utils");
|
|
28
|
-
_utils = function () {
|
|
29
|
-
return data;
|
|
30
|
-
};
|
|
31
|
-
return data;
|
|
32
|
-
}
|
|
33
|
-
function _fsExtra() {
|
|
34
|
-
const data = _interopRequireDefault(require("fs-extra"));
|
|
35
|
-
_fsExtra = function () {
|
|
36
|
-
return data;
|
|
37
|
-
};
|
|
38
|
-
return data;
|
|
39
|
-
}
|
|
40
|
-
function _path() {
|
|
41
|
-
const data = require("path");
|
|
42
|
-
_path = function () {
|
|
43
|
-
return data;
|
|
44
|
-
};
|
|
45
|
-
return data;
|
|
46
|
-
}
|
|
47
|
-
function _lodash() {
|
|
48
|
-
const data = require("lodash");
|
|
49
|
-
_lodash = function () {
|
|
50
|
-
return data;
|
|
51
|
-
};
|
|
52
|
-
return data;
|
|
53
|
-
}
|
|
54
|
-
function _expandIncludeExclude() {
|
|
55
|
-
const data = require("./expand-include-exclude");
|
|
56
|
-
_expandIncludeExclude = function () {
|
|
57
|
-
return data;
|
|
58
|
-
};
|
|
59
|
-
return data;
|
|
60
|
-
}
|
|
61
|
-
const CONFIG_NAME = 'tsconfig.json';
|
|
62
|
-
const BIT_GENERATED_TS_CONFIG_COMMENT = '// bit-generated-typescript-config';
|
|
63
|
-
const GLOBAL_TYPES_DIR = 'global-types';
|
|
64
|
-
exports.GLOBAL_TYPES_DIR = GLOBAL_TYPES_DIR;
|
|
65
|
-
class TypescriptConfigWriter {
|
|
66
|
-
constructor(compiler, logger) {
|
|
67
|
-
this.compiler = compiler;
|
|
68
|
-
this.logger = logger;
|
|
69
|
-
(0, _defineProperty2().default)(this, "name", 'TypescriptConfigWriter');
|
|
70
|
-
(0, _defineProperty2().default)(this, "cliName", 'ts');
|
|
71
|
-
(0, _defineProperty2().default)(this, "patterns", [`**/${CONFIG_NAME}`]);
|
|
72
|
-
}
|
|
73
|
-
calcConfigFiles(executionContext) {
|
|
74
|
-
var _compiler$generateIde;
|
|
75
|
-
const compiler = this.compiler.getCompiler(executionContext);
|
|
76
|
-
if (!compiler) return undefined;
|
|
77
|
-
if (!compiler.id.toLowerCase().includes('typescript')) return undefined;
|
|
78
|
-
const config = (_compiler$generateIde = compiler.generateIdeConfig) === null || _compiler$generateIde === void 0 ? void 0 : _compiler$generateIde.call(compiler);
|
|
79
|
-
if (!config || !config.tsconfig) return undefined;
|
|
80
|
-
const tsConfigContent = JSON.stringify(config.tsconfig, null, 2);
|
|
81
|
-
const tsConfigHash = (0, _utils().sha1)(tsConfigContent);
|
|
82
|
-
const tsConfigName = `tsconfig.bit.${tsConfigHash}.json`;
|
|
83
|
-
const typescriptConfigFile = {
|
|
84
|
-
content: tsConfigContent,
|
|
85
|
-
hash: tsConfigHash,
|
|
86
|
-
name: tsConfigName
|
|
87
|
-
};
|
|
88
|
-
const globalTypesConfigFiles = this.getGlobalTypesConfigFiles(config);
|
|
89
|
-
return [typescriptConfigFile, ...globalTypesConfigFiles];
|
|
90
|
-
}
|
|
91
|
-
getGlobalTypesConfigFiles(config) {
|
|
92
|
-
const files = config.globalTypesPaths.map(path => {
|
|
93
|
-
const content = _fsExtra().default.readFileSync(path).toString();
|
|
94
|
-
const origName = (0, _path().basename)(path);
|
|
95
|
-
const nameWithHash = origName.replace(/\.d\.ts$/, '.{hash}.d.ts');
|
|
96
|
-
const name = `${GLOBAL_TYPES_DIR}/${nameWithHash}`;
|
|
97
|
-
return {
|
|
98
|
-
content,
|
|
99
|
-
name
|
|
100
|
-
};
|
|
101
|
-
});
|
|
102
|
-
return files;
|
|
103
|
-
}
|
|
104
|
-
async postProcessConfigFiles(writtenConfigFiles, executionContext, envMapValue) {
|
|
105
|
-
const tsConfigFile = writtenConfigFiles.find(file => file.name.includes('tsconfig.bit'));
|
|
106
|
-
if (!tsConfigFile) return Promise.resolve();
|
|
107
|
-
const tsConfigPath = tsConfigFile.filePath;
|
|
108
|
-
const exists = await _fsExtra().default.pathExists(tsConfigPath);
|
|
109
|
-
if (!exists) {
|
|
110
|
-
this.logger.warn(`TypescriptConfigWriter, tsconfig file ${tsConfigPath} was not found for post process. if it is part of --dry-run, it is ok.`);
|
|
111
|
-
return Promise.resolve();
|
|
112
|
-
}
|
|
113
|
-
const tsConfig = await _fsExtra().default.readJson(tsConfigPath);
|
|
114
|
-
const compDirs = envMapValue.paths;
|
|
115
|
-
const newTsConfig = (0, _expandIncludeExclude().expandIncludeExclude)(tsConfigPath, tsConfig, compDirs, GLOBAL_TYPES_DIR);
|
|
116
|
-
_fsExtra().default.outputJSONSync(tsConfigPath, newTsConfig, {
|
|
117
|
-
spaces: 2
|
|
118
|
-
});
|
|
119
|
-
return Promise.resolve();
|
|
120
|
-
}
|
|
121
|
-
generateExtendingFile(args) {
|
|
122
|
-
const {
|
|
123
|
-
writtenConfigFiles
|
|
124
|
-
} = args;
|
|
125
|
-
const tsconfigFile = writtenConfigFiles.find(file => file.name.includes('tsconfig.bit'));
|
|
126
|
-
if (!tsconfigFile) return undefined;
|
|
127
|
-
const config = {
|
|
128
|
-
// Using DSL to make sure it will be replaced with relative path
|
|
129
|
-
extends: `{${tsconfigFile.name}}`
|
|
130
|
-
};
|
|
131
|
-
const content = `${BIT_GENERATED_TS_CONFIG_COMMENT}\n\n${JSON.stringify(config, null, 2)}`;
|
|
132
|
-
return {
|
|
133
|
-
content,
|
|
134
|
-
name: 'tsconfig.json',
|
|
135
|
-
extendingTarget: tsconfigFile,
|
|
136
|
-
useAbsPaths: false
|
|
137
|
-
};
|
|
138
|
-
}
|
|
139
|
-
async postProcessExtendingConfigFiles(args) {
|
|
140
|
-
if (!args.configsRootDir || args.dryRun) return;
|
|
141
|
-
const {
|
|
142
|
-
workspaceDir,
|
|
143
|
-
configsRootDir
|
|
144
|
-
} = args;
|
|
145
|
-
const rootTsConfigPath = (0, _path().join)(workspaceDir, 'tsconfig.json');
|
|
146
|
-
const exists = await _fsExtra().default.pathExists(rootTsConfigPath);
|
|
147
|
-
let tsConfig = {};
|
|
148
|
-
if (exists) {
|
|
149
|
-
const content = (await _fsExtra().default.readFile(rootTsConfigPath)).toString();
|
|
150
|
-
tsConfig = (0, _commentJson().parse)(content);
|
|
151
|
-
}
|
|
152
|
-
// @ts-ignore
|
|
153
|
-
const compilerOptions = tsConfig.compilerOptions || {};
|
|
154
|
-
const typeRoots = compilerOptions.typeRoots || [];
|
|
155
|
-
const globalTypesDir = (0, _path().join)(configsRootDir, GLOBAL_TYPES_DIR);
|
|
156
|
-
const relativeGlobalTypesDir = `./${(0, _path().relative)(workspaceDir, globalTypesDir)}`;
|
|
157
|
-
typeRoots.push(relativeGlobalTypesDir);
|
|
158
|
-
typeRoots.push('./node_modules/@types');
|
|
159
|
-
(0, _commentJson().assign)(compilerOptions, {
|
|
160
|
-
typeRoots: (0, _lodash().uniq)(typeRoots)
|
|
161
|
-
});
|
|
162
|
-
(0, _commentJson().assign)(tsConfig, {
|
|
163
|
-
compilerOptions
|
|
164
|
-
});
|
|
165
|
-
await _fsExtra().default.outputFile(rootTsConfigPath, (0, _commentJson().stringify)(tsConfig, null, 2));
|
|
166
|
-
}
|
|
167
|
-
isBitGenerated(filePath) {
|
|
168
|
-
const content = _fsExtra().default.readFileSync(filePath).toString();
|
|
169
|
-
return content.includes(BIT_GENERATED_TS_CONFIG_COMMENT);
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
exports.TypescriptConfigWriter = TypescriptConfigWriter;
|
|
173
|
-
|
|
174
|
-
//# sourceMappingURL=ts-config-writer.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["CONFIG_NAME","BIT_GENERATED_TS_CONFIG_COMMENT","GLOBAL_TYPES_DIR","TypescriptConfigWriter","constructor","compiler","logger","calcConfigFiles","executionContext","getCompiler","undefined","id","toLowerCase","includes","config","generateIdeConfig","tsconfig","tsConfigContent","JSON","stringify","tsConfigHash","sha1","tsConfigName","typescriptConfigFile","content","hash","name","globalTypesConfigFiles","getGlobalTypesConfigFiles","files","globalTypesPaths","map","path","fs","readFileSync","toString","origName","basename","nameWithHash","replace","postProcessConfigFiles","writtenConfigFiles","envMapValue","tsConfigFile","find","file","Promise","resolve","tsConfigPath","filePath","exists","pathExists","warn","tsConfig","readJson","compDirs","paths","newTsConfig","expandIncludeExclude","outputJSONSync","spaces","generateExtendingFile","args","tsconfigFile","extends","extendingTarget","useAbsPaths","postProcessExtendingConfigFiles","configsRootDir","dryRun","workspaceDir","rootTsConfigPath","join","readFile","parse","compilerOptions","typeRoots","globalTypesDir","relativeGlobalTypesDir","relative","push","assign","uniq","outputFile","isBitGenerated"],"sources":["ts-config-writer.ts"],"sourcesContent":["import { stringify, parse, assign } from 'comment-json';\nimport { sha1 } from '@teambit/legacy/dist/utils';\nimport fs from 'fs-extra';\nimport { ExecutionContext } from '@teambit/envs';\nimport { basename, join, relative } from 'path';\nimport type {\n ConfigWriterEntry,\n WrittenConfigFile,\n ExtendingConfigFile,\n ConfigFile,\n EnvMapValue,\n PostProcessExtendingConfigFilesArgs,\n GenerateExtendingConfigFilesArgs,\n} from '@teambit/workspace-config-files';\nimport { uniq } from 'lodash';\nimport { CompilerMain } from '@teambit/compiler';\nimport { Logger } from '@teambit/logger';\nimport { IdeConfig, TypescriptCompilerInterface } from './typescript-compiler-interface';\nimport { expandIncludeExclude } from './expand-include-exclude';\n\nconst CONFIG_NAME = 'tsconfig.json';\nconst BIT_GENERATED_TS_CONFIG_COMMENT = '// bit-generated-typescript-config';\nexport const GLOBAL_TYPES_DIR = 'global-types';\n\nexport class TypescriptConfigWriter implements ConfigWriterEntry {\n name = 'TypescriptConfigWriter';\n cliName = 'ts';\n\n constructor(private compiler: CompilerMain, private logger: Logger) {}\n patterns: string[] = [`**/${CONFIG_NAME}`];\n\n calcConfigFiles(executionContext: ExecutionContext): ConfigFile[] | undefined {\n const compiler = this.compiler.getCompiler(executionContext) as TypescriptCompilerInterface;\n if (!compiler) return undefined;\n if (!compiler.id.toLowerCase().includes('typescript')) return undefined;\n const config = compiler.generateIdeConfig?.();\n if (!config || !config.tsconfig) return undefined;\n const tsConfigContent = JSON.stringify(config.tsconfig, null, 2);\n const tsConfigHash = sha1(tsConfigContent);\n const tsConfigName = `tsconfig.bit.${tsConfigHash}.json`;\n const typescriptConfigFile = {\n content: tsConfigContent,\n hash: tsConfigHash,\n name: tsConfigName,\n };\n const globalTypesConfigFiles = this.getGlobalTypesConfigFiles(config);\n return [typescriptConfigFile, ...globalTypesConfigFiles];\n }\n\n private getGlobalTypesConfigFiles(config: IdeConfig) {\n const files = config.globalTypesPaths.map((path) => {\n const content = fs.readFileSync(path).toString();\n const origName = basename(path);\n const nameWithHash = origName.replace(/\\.d\\.ts$/, '.{hash}.d.ts');\n const name = `${GLOBAL_TYPES_DIR}/${nameWithHash}`;\n return {\n content,\n name,\n };\n });\n return files;\n }\n\n async postProcessConfigFiles(\n writtenConfigFiles: WrittenConfigFile[],\n executionContext: ExecutionContext,\n envMapValue: EnvMapValue\n ): Promise<void> {\n const tsConfigFile = writtenConfigFiles.find((file) => file.name.includes('tsconfig.bit'));\n if (!tsConfigFile) return Promise.resolve();\n const tsConfigPath = tsConfigFile.filePath;\n const exists = await fs.pathExists(tsConfigPath);\n\n if (!exists) {\n this.logger.warn(\n `TypescriptConfigWriter, tsconfig file ${tsConfigPath} was not found for post process. if it is part of --dry-run, it is ok.`\n );\n return Promise.resolve();\n }\n const tsConfig = await fs.readJson(tsConfigPath);\n const compDirs: string[] = envMapValue.paths;\n\n const newTsConfig = expandIncludeExclude(tsConfigPath, tsConfig, compDirs, GLOBAL_TYPES_DIR);\n\n fs.outputJSONSync(tsConfigPath, newTsConfig, { spaces: 2 });\n return Promise.resolve();\n }\n\n generateExtendingFile(args: GenerateExtendingConfigFilesArgs): ExtendingConfigFile | undefined {\n const { writtenConfigFiles } = args;\n const tsconfigFile = writtenConfigFiles.find((file) => file.name.includes('tsconfig.bit'));\n if (!tsconfigFile) return undefined;\n const config = {\n // Using DSL to make sure it will be replaced with relative path\n extends: `{${tsconfigFile.name}}`,\n };\n const content = `${BIT_GENERATED_TS_CONFIG_COMMENT}\\n\\n${JSON.stringify(config, null, 2)}`;\n return { content, name: 'tsconfig.json', extendingTarget: tsconfigFile, useAbsPaths: false };\n }\n\n async postProcessExtendingConfigFiles?(args: PostProcessExtendingConfigFilesArgs): Promise<void> {\n if (!args.configsRootDir || args.dryRun) return;\n const { workspaceDir, configsRootDir } = args;\n const rootTsConfigPath = join(workspaceDir, 'tsconfig.json');\n const exists = await fs.pathExists(rootTsConfigPath);\n let tsConfig = {};\n if (exists) {\n const content = (await fs.readFile(rootTsConfigPath)).toString();\n tsConfig = parse(content);\n }\n // @ts-ignore\n const compilerOptions = tsConfig.compilerOptions || {};\n const typeRoots = compilerOptions.typeRoots || [];\n const globalTypesDir = join(configsRootDir, GLOBAL_TYPES_DIR);\n const relativeGlobalTypesDir = `./${relative(workspaceDir, globalTypesDir)}`;\n typeRoots.push(relativeGlobalTypesDir);\n typeRoots.push('./node_modules/@types');\n assign(compilerOptions, { typeRoots: uniq(typeRoots) });\n assign(tsConfig, { compilerOptions });\n await fs.outputFile(rootTsConfigPath, stringify(tsConfig, null, 2));\n }\n\n isBitGenerated(filePath: string): boolean {\n const content = fs.readFileSync(filePath).toString();\n return content.includes(BIT_GENERATED_TS_CONFIG_COMMENT);\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;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;AAUA;EAAA;EAAA;IAAA;EAAA;EAAA;AAAA;AAIA;EAAA;EAAA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ChEkB,QAAQ,GAAG,IAAAqB,oBAAK,EAAClD,OAAO,CAAC;IAC3B;IACA;IACA,MAAMmD,eAAe,GAAGtB,QAAQ,CAACsB,eAAe,IAAI,CAAC,CAAC;IACtD,MAAMC,SAAS,GAAGD,eAAe,CAACC,SAAS,IAAI,EAAE;IACjD,MAAMC,cAAc,GAAG,IAAAL,YAAI,EAACJ,cAAc,EAAElE,gBAAgB,CAAC;IAC7D,MAAM4E,sBAAsB,GAAI,KAAI,IAAAC,gBAAQ,EAACT,YAAY,EAAEO,cAAc,CAAE,EAAC;IAC5ED,SAAS,CAACI,IAAI,CAACF,sBAAsB,CAAC;IACtCF,SAAS,CAACI,IAAI,CAAC,uBAAuB,CAAC;IACvC,IAAAC,qBAAM,EAACN,eAAe,EAAE;MAAEC,SAAS,EAAE,IAAAM,cAAI,EAACN,SAAS;IAAE,CAAC,CAAC;IACvD,IAAAK,qBAAM,EAAC5B,QAAQ,EAAE;MAAEsB;IAAgB,CAAC,CAAC;IACrC,MAAM1C,kBAAE,CAACkD,UAAU,CAACZ,gBAAgB,EAAE,IAAApD,wBAAS,EAACkC,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;EACrE;EAEA+B,cAAc,CAACnC,QAAgB,EAAW;IACxC,MAAMzB,OAAO,GAAGS,kBAAE,CAACC,YAAY,CAACe,QAAQ,CAAC,CAACd,QAAQ,EAAE;IACpD,OAAOX,OAAO,CAACX,QAAQ,CAACZ,+BAA+B,CAAC;EAC1D;AACF;AAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["typescript-compiler-interface.ts"],"sourcesContent":["import { Compiler } from '@teambit/compiler';\n\nexport type IdeConfig = {\n tsconfig?: Object;\n globalTypesPaths: string[];\n};\n\nexport interface TypescriptCompilerInterface extends Compiler {\n generateIdeConfig?: () => IdeConfig;\n}\n"],"mappings":""}
|
|
Binary file
|