@teambit/typescript 1.0.972 → 1.0.974
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/cmds/check-types.cmd.ts
CHANGED
|
@@ -91,24 +91,34 @@ otherwise, only new and modified components will be checked`);
|
|
|
91
91
|
unmodified: boolean
|
|
92
92
|
): Promise<{ tsserver: ReturnType<TypescriptMain['getTsserverClient']>; componentsCount: number }> {
|
|
93
93
|
if (!this.workspace) throw new OutsideWorkspaceError();
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
94
|
+
try {
|
|
95
|
+
this.logger.setStatusLine('check-types: loading components...');
|
|
96
|
+
// If pattern is provided, don't pass the unmodified flag - the pattern should take precedence
|
|
97
|
+
const components = await this.workspace.getComponentsByUserInput(pattern ? false : unmodified, pattern);
|
|
98
|
+
if (!components.length) {
|
|
99
|
+
return { tsserver: undefined, componentsCount: 0 };
|
|
100
|
+
}
|
|
101
|
+
const files = this.typescript.getSupportedFilesForTsserver(components);
|
|
102
|
+
this.logger.setStatusLine(
|
|
103
|
+
`check-types: starting tsserver for ${components.length} component(s), ${files.length} file(s)...`
|
|
104
|
+
);
|
|
105
|
+
await this.typescript.initTsserverClientFromWorkspace(
|
|
106
|
+
{
|
|
107
|
+
aggregateDiagnosticData: isJson,
|
|
108
|
+
printTypeErrors: !isJson,
|
|
109
|
+
// skip pre-opening so getDiagnostic can open/close per batch — keeps tsserver memory bounded
|
|
110
|
+
// by one batch's worth of files instead of the whole workspace.
|
|
111
|
+
openFilesOnInit: false,
|
|
112
|
+
},
|
|
113
|
+
files
|
|
114
|
+
);
|
|
115
|
+
const tsserver = this.typescript.getTsserverClient();
|
|
116
|
+
if (!tsserver) throw new Error(`unable to start tsserver`);
|
|
117
|
+
const BATCH_SIZE = 50;
|
|
118
|
+
await tsserver.getDiagnostic(files, files.length > BATCH_SIZE ? BATCH_SIZE : undefined);
|
|
119
|
+
return { tsserver, componentsCount: components.length };
|
|
120
|
+
} finally {
|
|
121
|
+
this.logger.clearStatusLine();
|
|
98
122
|
}
|
|
99
|
-
const files = this.typescript.getSupportedFilesForTsserver(components);
|
|
100
|
-
await this.typescript.initTsserverClientFromWorkspace(
|
|
101
|
-
{
|
|
102
|
-
aggregateDiagnosticData: isJson,
|
|
103
|
-
printTypeErrors: !isJson,
|
|
104
|
-
},
|
|
105
|
-
files
|
|
106
|
-
);
|
|
107
|
-
const tsserver = this.typescript.getTsserverClient();
|
|
108
|
-
if (!tsserver) throw new Error(`unable to start tsserver`);
|
|
109
|
-
// Use batching for large file sets to avoid overwhelming tsserver
|
|
110
|
-
const BATCH_SIZE = 50;
|
|
111
|
-
await tsserver.getDiagnostic(files, files.length > BATCH_SIZE ? BATCH_SIZE : undefined);
|
|
112
|
-
return { tsserver, componentsCount: components.length };
|
|
113
123
|
}
|
|
114
124
|
}
|
|
@@ -31,7 +31,7 @@ export declare class CheckTypesCmd implements Command {
|
|
|
31
31
|
strict: boolean;
|
|
32
32
|
}): Promise<{
|
|
33
33
|
code: number;
|
|
34
|
-
data: import("@teambit/ts-server/
|
|
34
|
+
data: import("@teambit/ts-server/ts-server-client").DiagnosticData[];
|
|
35
35
|
}>;
|
|
36
36
|
private runDiagnosticOnTsServer;
|
|
37
37
|
}
|
|
@@ -116,28 +116,36 @@ otherwise, only new and modified components will be checked`);
|
|
|
116
116
|
}
|
|
117
117
|
async runDiagnosticOnTsServer(isJson, pattern, unmodified) {
|
|
118
118
|
if (!this.workspace) throw new (_workspace().OutsideWorkspaceError)();
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
119
|
+
try {
|
|
120
|
+
this.logger.setStatusLine('check-types: loading components...');
|
|
121
|
+
// If pattern is provided, don't pass the unmodified flag - the pattern should take precedence
|
|
122
|
+
const components = await this.workspace.getComponentsByUserInput(pattern ? false : unmodified, pattern);
|
|
123
|
+
if (!components.length) {
|
|
124
|
+
return {
|
|
125
|
+
tsserver: undefined,
|
|
126
|
+
componentsCount: 0
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
const files = this.typescript.getSupportedFilesForTsserver(components);
|
|
130
|
+
this.logger.setStatusLine(`check-types: starting tsserver for ${components.length} component(s), ${files.length} file(s)...`);
|
|
131
|
+
await this.typescript.initTsserverClientFromWorkspace({
|
|
132
|
+
aggregateDiagnosticData: isJson,
|
|
133
|
+
printTypeErrors: !isJson,
|
|
134
|
+
// skip pre-opening so getDiagnostic can open/close per batch — keeps tsserver memory bounded
|
|
135
|
+
// by one batch's worth of files instead of the whole workspace.
|
|
136
|
+
openFilesOnInit: false
|
|
137
|
+
}, files);
|
|
138
|
+
const tsserver = this.typescript.getTsserverClient();
|
|
139
|
+
if (!tsserver) throw new Error(`unable to start tsserver`);
|
|
140
|
+
const BATCH_SIZE = 50;
|
|
141
|
+
await tsserver.getDiagnostic(files, files.length > BATCH_SIZE ? BATCH_SIZE : undefined);
|
|
122
142
|
return {
|
|
123
|
-
tsserver
|
|
124
|
-
componentsCount:
|
|
143
|
+
tsserver,
|
|
144
|
+
componentsCount: components.length
|
|
125
145
|
};
|
|
146
|
+
} finally {
|
|
147
|
+
this.logger.clearStatusLine();
|
|
126
148
|
}
|
|
127
|
-
const files = this.typescript.getSupportedFilesForTsserver(components);
|
|
128
|
-
await this.typescript.initTsserverClientFromWorkspace({
|
|
129
|
-
aggregateDiagnosticData: isJson,
|
|
130
|
-
printTypeErrors: !isJson
|
|
131
|
-
}, files);
|
|
132
|
-
const tsserver = this.typescript.getTsserverClient();
|
|
133
|
-
if (!tsserver) throw new Error(`unable to start tsserver`);
|
|
134
|
-
// Use batching for large file sets to avoid overwhelming tsserver
|
|
135
|
-
const BATCH_SIZE = 50;
|
|
136
|
-
await tsserver.getDiagnostic(files, files.length > BATCH_SIZE ? BATCH_SIZE : undefined);
|
|
137
|
-
return {
|
|
138
|
-
tsserver,
|
|
139
|
-
componentsCount: components.length
|
|
140
|
-
};
|
|
141
149
|
}
|
|
142
150
|
}
|
|
143
151
|
exports.CheckTypesCmd = CheckTypesCmd;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_cli","data","require","_workspace","_legacy","_defineProperty","e","r","t","_toPropertyKey","Object","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","CheckTypesCmd","constructor","typescript","workspace","logger","name","description","COMPONENT_PATTERN_HELP","report","pattern","all","unmodified","strict","consoleWarning","start","Date","now","tsserver","componentsCount","runDiagnosticOnTsServer","formatHint","code","end","msg","killTsServer","lastDiagnostics","length","errorSymbol","formatSuccessSummary","json","diagData","diagnosticData","isJson","OutsideWorkspaceError","components","getComponentsByUserInput","undefined","files","getSupportedFilesForTsserver","initTsserverClientFromWorkspace","aggregateDiagnosticData","printTypeErrors","getTsserverClient","Error","BATCH_SIZE","getDiagnostic","exports"],"sources":["check-types.cmd.ts"],"sourcesContent":["import type { Command, CommandOptions } from '@teambit/cli';\nimport { formatSuccessSummary, formatHint, errorSymbol } from '@teambit/cli';\nimport type { Logger } from '@teambit/logger';\nimport type { Workspace } from '@teambit/workspace';\nimport { OutsideWorkspaceError } from '@teambit/workspace';\nimport { COMPONENT_PATTERN_HELP } from '@teambit/legacy.constants';\nimport type { TypescriptMain } from '../typescript.main.runtime';\n\nexport class CheckTypesCmd implements Command {\n name = 'check-types [component-pattern]';\n description = 'validate TypeScript type correctness';\n extendedDescription = `checks for TypeScript type errors in component files, similar to running tsc.\nby default only checks new and modified components. use --unmodified to check all components.\nuseful for catching type issues before tagging, snapping or building components.`;\n arguments = [{ name: 'component-pattern', description: COMPONENT_PATTERN_HELP }];\n alias = '';\n group = 'testing';\n options = [\n ['a', 'all', 'DEPRECATED. (use --unmodified)'],\n ['u', 'unmodified', 'check-types for all components, not only modified and new'],\n ['', 'strict', 'in case issues found, exit with code 1'],\n ['j', 'json', 'return the output in json format'],\n ] as CommandOptions;\n\n constructor(\n private typescript: TypescriptMain,\n private workspace: Workspace,\n private logger: Logger\n ) {}\n\n async report(\n [pattern]: [string],\n { all = false, unmodified = false, strict = false }: { all: boolean; unmodified: boolean; strict: boolean }\n ) {\n if (all) {\n unmodified = all;\n this.logger.consoleWarning(`--all is deprecated, use --unmodified instead`);\n }\n const start = Date.now();\n const { tsserver, componentsCount } = await this.runDiagnosticOnTsServer(false, pattern, unmodified);\n if (!tsserver) {\n const data = formatHint(`no components found to check.\nuse \"--unmodified\" flag to check all components or specify the ids to check.\notherwise, only new and modified components will be checked`);\n return { code: 0, data };\n }\n const end = Date.now() - start;\n const msg = `completed type checking ${componentsCount} component(s) (${end / 1000} sec)`;\n tsserver.killTsServer();\n if (tsserver.lastDiagnostics.length) {\n return {\n code: strict ? 1 : 0,\n data: `${errorSymbol} ${msg}. found errors in ${tsserver.lastDiagnostics.length} files.`,\n };\n }\n return {\n code: 0,\n data: formatSuccessSummary(`${msg}. no errors were found.`),\n };\n }\n\n async json(\n [pattern]: [string],\n { all = false, unmodified = false, strict = false }: { all: boolean; unmodified: boolean; strict: boolean }\n ) {\n if (all) {\n unmodified = all;\n this.logger.consoleWarning(`--all is deprecated, use --unmodified instead`);\n }\n const { tsserver } = await this.runDiagnosticOnTsServer(true, pattern, unmodified);\n if (!tsserver) {\n return { code: 0, data: [] };\n }\n const diagData = tsserver.diagnosticData;\n tsserver.killTsServer();\n if (tsserver.lastDiagnostics.length) {\n return {\n code: strict ? 1 : 0,\n data: diagData,\n };\n }\n return {\n code: 0,\n data: diagData,\n };\n }\n\n private async runDiagnosticOnTsServer(\n isJson: boolean,\n pattern: string,\n unmodified: boolean\n ): Promise<{ tsserver: ReturnType<TypescriptMain['getTsserverClient']>; componentsCount: number }> {\n if (!this.workspace) throw new OutsideWorkspaceError();\n // If pattern is provided, don't pass the unmodified flag - the pattern should take precedence\n const components = await this.workspace.getComponentsByUserInput(pattern ? false : unmodified, pattern);\n if (!components.length) {\n return { tsserver: undefined, componentsCount: 0 };\n }\n const files = this.typescript.getSupportedFilesForTsserver(components);\n await this.typescript.initTsserverClientFromWorkspace(\n {\n aggregateDiagnosticData: isJson,\n printTypeErrors: !isJson,\n },\n files\n );\n const tsserver = this.typescript.getTsserverClient();\n if (!tsserver) throw new Error(`unable to start tsserver`);\n // Use batching for large file sets to avoid overwhelming tsserver\n const BATCH_SIZE = 50;\n await tsserver.getDiagnostic(files, files.length > BATCH_SIZE ? BATCH_SIZE : undefined);\n return { tsserver, componentsCount: components.length };\n }\n}\n"],"mappings":";;;;;;AACA,SAAAA,KAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,IAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAGA,SAAAE,WAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,UAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,QAAA;EAAA,MAAAH,IAAA,GAAAC,OAAA;EAAAE,OAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAAmE,SAAAI,gBAAAC,CAAA,EAAAC,CAAA,EAAAC,CAAA,YAAAD,CAAA,GAAAE,cAAA,CAAAF,CAAA,MAAAD,CAAA,GAAAI,MAAA,CAAAC,cAAA,CAAAL,CAAA,EAAAC,CAAA,IAAAK,KAAA,EAAAJ,CAAA,EAAAK,UAAA,MAAAC,YAAA,MAAAC,QAAA,UAAAT,CAAA,CAAAC,CAAA,IAAAC,CAAA,EAAAF,CAAA;AAAA,SAAAG,eAAAD,CAAA,QAAAQ,CAAA,GAAAC,YAAA,CAAAT,CAAA,uCAAAQ,CAAA,GAAAA,CAAA,GAAAA,CAAA;AAAA,SAAAC,aAAAT,CAAA,EAAAD,CAAA,2BAAAC,CAAA,KAAAA,CAAA,SAAAA,CAAA,MAAAF,CAAA,GAAAE,CAAA,CAAAU,MAAA,CAAAC,WAAA,kBAAAb,CAAA,QAAAU,CAAA,GAAAV,CAAA,C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AAO,CAAC;EACzD;AACF;AAACoB,OAAA,CAAA9C,aAAA,GAAAA,aAAA","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_cli","data","require","_workspace","_legacy","_defineProperty","e","r","t","_toPropertyKey","Object","defineProperty","value","enumerable","configurable","writable","i","_toPrimitive","Symbol","toPrimitive","call","TypeError","String","Number","CheckTypesCmd","constructor","typescript","workspace","logger","name","description","COMPONENT_PATTERN_HELP","report","pattern","all","unmodified","strict","consoleWarning","start","Date","now","tsserver","componentsCount","runDiagnosticOnTsServer","formatHint","code","end","msg","killTsServer","lastDiagnostics","length","errorSymbol","formatSuccessSummary","json","diagData","diagnosticData","isJson","OutsideWorkspaceError","setStatusLine","components","getComponentsByUserInput","undefined","files","getSupportedFilesForTsserver","initTsserverClientFromWorkspace","aggregateDiagnosticData","printTypeErrors","openFilesOnInit","getTsserverClient","Error","BATCH_SIZE","getDiagnostic","clearStatusLine","exports"],"sources":["check-types.cmd.ts"],"sourcesContent":["import type { Command, CommandOptions } from '@teambit/cli';\nimport { formatSuccessSummary, formatHint, errorSymbol } from '@teambit/cli';\nimport type { Logger } from '@teambit/logger';\nimport type { Workspace } from '@teambit/workspace';\nimport { OutsideWorkspaceError } from '@teambit/workspace';\nimport { COMPONENT_PATTERN_HELP } from '@teambit/legacy.constants';\nimport type { TypescriptMain } from '../typescript.main.runtime';\n\nexport class CheckTypesCmd implements Command {\n name = 'check-types [component-pattern]';\n description = 'validate TypeScript type correctness';\n extendedDescription = `checks for TypeScript type errors in component files, similar to running tsc.\nby default only checks new and modified components. use --unmodified to check all components.\nuseful for catching type issues before tagging, snapping or building components.`;\n arguments = [{ name: 'component-pattern', description: COMPONENT_PATTERN_HELP }];\n alias = '';\n group = 'testing';\n options = [\n ['a', 'all', 'DEPRECATED. (use --unmodified)'],\n ['u', 'unmodified', 'check-types for all components, not only modified and new'],\n ['', 'strict', 'in case issues found, exit with code 1'],\n ['j', 'json', 'return the output in json format'],\n ] as CommandOptions;\n\n constructor(\n private typescript: TypescriptMain,\n private workspace: Workspace,\n private logger: Logger\n ) {}\n\n async report(\n [pattern]: [string],\n { all = false, unmodified = false, strict = false }: { all: boolean; unmodified: boolean; strict: boolean }\n ) {\n if (all) {\n unmodified = all;\n this.logger.consoleWarning(`--all is deprecated, use --unmodified instead`);\n }\n const start = Date.now();\n const { tsserver, componentsCount } = await this.runDiagnosticOnTsServer(false, pattern, unmodified);\n if (!tsserver) {\n const data = formatHint(`no components found to check.\nuse \"--unmodified\" flag to check all components or specify the ids to check.\notherwise, only new and modified components will be checked`);\n return { code: 0, data };\n }\n const end = Date.now() - start;\n const msg = `completed type checking ${componentsCount} component(s) (${end / 1000} sec)`;\n tsserver.killTsServer();\n if (tsserver.lastDiagnostics.length) {\n return {\n code: strict ? 1 : 0,\n data: `${errorSymbol} ${msg}. found errors in ${tsserver.lastDiagnostics.length} files.`,\n };\n }\n return {\n code: 0,\n data: formatSuccessSummary(`${msg}. no errors were found.`),\n };\n }\n\n async json(\n [pattern]: [string],\n { all = false, unmodified = false, strict = false }: { all: boolean; unmodified: boolean; strict: boolean }\n ) {\n if (all) {\n unmodified = all;\n this.logger.consoleWarning(`--all is deprecated, use --unmodified instead`);\n }\n const { tsserver } = await this.runDiagnosticOnTsServer(true, pattern, unmodified);\n if (!tsserver) {\n return { code: 0, data: [] };\n }\n const diagData = tsserver.diagnosticData;\n tsserver.killTsServer();\n if (tsserver.lastDiagnostics.length) {\n return {\n code: strict ? 1 : 0,\n data: diagData,\n };\n }\n return {\n code: 0,\n data: diagData,\n };\n }\n\n private async runDiagnosticOnTsServer(\n isJson: boolean,\n pattern: string,\n unmodified: boolean\n ): Promise<{ tsserver: ReturnType<TypescriptMain['getTsserverClient']>; componentsCount: number }> {\n if (!this.workspace) throw new OutsideWorkspaceError();\n try {\n this.logger.setStatusLine('check-types: loading components...');\n // If pattern is provided, don't pass the unmodified flag - the pattern should take precedence\n const components = await this.workspace.getComponentsByUserInput(pattern ? false : unmodified, pattern);\n if (!components.length) {\n return { tsserver: undefined, componentsCount: 0 };\n }\n const files = this.typescript.getSupportedFilesForTsserver(components);\n this.logger.setStatusLine(\n `check-types: starting tsserver for ${components.length} component(s), ${files.length} file(s)...`\n );\n await this.typescript.initTsserverClientFromWorkspace(\n {\n aggregateDiagnosticData: isJson,\n printTypeErrors: !isJson,\n // skip pre-opening so getDiagnostic can open/close per batch — keeps tsserver memory bounded\n // by one batch's worth of files instead of the whole workspace.\n openFilesOnInit: false,\n },\n files\n );\n const tsserver = this.typescript.getTsserverClient();\n if (!tsserver) throw new Error(`unable to start tsserver`);\n const BATCH_SIZE = 50;\n await tsserver.getDiagnostic(files, files.length > BATCH_SIZE ? BATCH_SIZE : undefined);\n return { tsserver, componentsCount: components.length };\n } finally {\n this.logger.clearStatusLine();\n }\n }\n}\n"],"mappings":";;;;;;AACA,SAAAA,KAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,IAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAGA,SAAAE,WAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,UAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,QAAA;EAAA,MAAAH,IAAA,GAAAC,OAAA;EAAAE,OAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAAmE,SAAAI,gBAAAC,CAAA,EAAAC,CAAA,EAAAC,CAAA,YAAAD,CAAA,GAAAE,cAAA,CAAAF,CAAA,MAAAD,CAAA,GAAAI,MAAA,CAAAC,cAAA,CAAAL,CAAA,EAAAC,CAAA,IAAAK,KAAA,EAAAJ,CAAA,EAAAK,UAAA,MAAAC,YAAA,MAAAC,QAAA,UAAAT,CAAA,CAAAC,CAAA,IAAAC,CAAA,EAAAF,CAAA;AAAA,SAAAG,eAAAD,CAAA,QAAAQ,CAAA,GAAAC,YAAA,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AC/BU,eAAe,EAAE,CAACV,MAAM;QACxB;QACA;QACAW,eAAe,EAAE;MACnB,CAAC,EACDL,KACF,CAAC;MACD,MAAMrB,QAAQ,GAAG,IAAI,CAACf,UAAU,CAAC0C,iBAAiB,CAAC,CAAC;MACpD,IAAI,CAAC3B,QAAQ,EAAE,MAAM,IAAI4B,KAAK,CAAC,0BAA0B,CAAC;MAC1D,MAAMC,UAAU,GAAG,EAAE;MACrB,MAAM7B,QAAQ,CAAC8B,aAAa,CAACT,KAAK,EAAEA,KAAK,CAACZ,MAAM,GAAGoB,UAAU,GAAGA,UAAU,GAAGT,SAAS,CAAC;MACvF,OAAO;QAAEpB,QAAQ;QAAEC,eAAe,EAAEiB,UAAU,CAACT;MAAO,CAAC;IACzD,CAAC,SAAS;MACR,IAAI,CAACtB,MAAM,CAAC4C,eAAe,CAAC,CAAC;IAC/B;EACF;AACF;AAACC,OAAA,CAAAjD,aAAA,GAAAA,aAAA","ignoreList":[]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.typescript_typescript@1.0.
|
|
2
|
-
import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.typescript_typescript@1.0.
|
|
1
|
+
import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.typescript_typescript@1.0.974/dist/typescript.composition.js';
|
|
2
|
+
import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.typescript_typescript@1.0.974/dist/typescript.docs.mdx';
|
|
3
3
|
|
|
4
4
|
export const compositions = [compositions_0];
|
|
5
5
|
export const overview = [overview_0];
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@teambit/typescript",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.974",
|
|
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": "1.0.
|
|
9
|
+
"version": "1.0.974"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"lodash": "4.17.21",
|
|
@@ -21,23 +21,23 @@
|
|
|
21
21
|
"@teambit/typescript.typescript-compiler": "2.0.68",
|
|
22
22
|
"@teambit/component.sources": "0.0.163",
|
|
23
23
|
"@teambit/semantics.entities.semantic-schema": "0.0.102",
|
|
24
|
-
"@teambit/ts-server": "0.0.78",
|
|
25
24
|
"@teambit/harmony": "0.4.7",
|
|
26
25
|
"@teambit/logger": "0.0.1413",
|
|
27
26
|
"@teambit/cli": "0.0.1320",
|
|
28
27
|
"@teambit/legacy.constants": "0.0.26",
|
|
29
|
-
"@teambit/compiler": "1.0.
|
|
30
|
-
"@teambit/builder": "1.0.
|
|
31
|
-
"@teambit/component": "1.0.
|
|
32
|
-
"@teambit/dependency-resolver": "1.0.
|
|
33
|
-
"@teambit/formatter": "1.0.
|
|
34
|
-
"@teambit/
|
|
35
|
-
"@teambit/
|
|
36
|
-
"@teambit/
|
|
37
|
-
"@teambit/
|
|
38
|
-
"@teambit/
|
|
39
|
-
"@teambit/
|
|
40
|
-
"@teambit/
|
|
28
|
+
"@teambit/compiler": "1.0.974",
|
|
29
|
+
"@teambit/builder": "1.0.974",
|
|
30
|
+
"@teambit/component": "1.0.974",
|
|
31
|
+
"@teambit/dependency-resolver": "1.0.974",
|
|
32
|
+
"@teambit/formatter": "1.0.974",
|
|
33
|
+
"@teambit/ts-server": "0.0.79",
|
|
34
|
+
"@teambit/aspect-loader": "1.0.974",
|
|
35
|
+
"@teambit/envs": "1.0.974",
|
|
36
|
+
"@teambit/schema": "1.0.974",
|
|
37
|
+
"@teambit/scope": "1.0.974",
|
|
38
|
+
"@teambit/workspace": "1.0.974",
|
|
39
|
+
"@teambit/pkg": "1.0.974",
|
|
40
|
+
"@teambit/watcher": "1.0.974"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"@types/lodash": "4.14.165",
|