@@ -2,61 +2,12 @@ import type * as d from '../../../declarations';
2
2
import { addImports } from '../add-imports' ;
3
3
import { addLegacyApis } from '../core-runtime-apis' ;
4
4
import { addModuleMetadataProxies } from '../add-component-meta-proxy' ;
5
- import { getComponentMeta , getModuleFromSourceFile , getScriptTarget } from '../transform-utils' ;
6
- import { catchError , loadTypeScriptDiagnostics } from '@utils' ;
5
+ import { getComponentMeta , getModuleFromSourceFile } from '../transform-utils' ;
7
6
import { defineCustomElement } from '../define-custom-element' ;
8
- import { STENCIL_CORE_ID } from '../../bundle/entry-alias-ids' ;
9
7
import { updateNativeComponentClass } from './native-component' ;
10
8
import { updateStyleImports } from '../style-imports' ;
11
9
import ts from 'typescript' ;
12
10
13
- export const transformToNativeComponentText = (
14
- config : d . Config ,
15
- compilerCtx : d . CompilerCtx ,
16
- buildCtx : d . BuildCtx ,
17
- cmp : d . ComponentCompilerMeta ,
18
- inputJsText : string
19
- ) => {
20
- let outputText : string = null ;
21
-
22
- try {
23
- const tsCompilerOptions : ts . CompilerOptions = {
24
- module : ts . ModuleKind . ESNext ,
25
- target : getScriptTarget ( ) ,
26
- } ;
27
-
28
- const transformOpts : d . TransformOptions = {
29
- coreImportPath : STENCIL_CORE_ID ,
30
- componentExport : null ,
31
- componentMetadata : null ,
32
- currentDirectory : config . sys . getCurrentDirectory ( ) ,
33
- proxy : null ,
34
- style : 'static' ,
35
- styleImportData : 'queryparams' ,
36
- } ;
37
-
38
- const transpileOpts : ts . TranspileOptions = {
39
- compilerOptions : tsCompilerOptions ,
40
- fileName : cmp . jsFilePath ,
41
- transformers : {
42
- after : [ nativeComponentTransform ( compilerCtx , transformOpts ) ] ,
43
- } ,
44
- } ;
45
-
46
- const transpileOutput = ts . transpileModule ( inputJsText , transpileOpts ) ;
47
-
48
- buildCtx . diagnostics . push ( ...loadTypeScriptDiagnostics ( transpileOutput . diagnostics ) ) ;
49
-
50
- if ( ! buildCtx . hasError && typeof transpileOutput . outputText === 'string' ) {
51
- outputText = transpileOutput . outputText ;
52
- }
53
- } catch ( e : any ) {
54
- catchError ( buildCtx . diagnostics , e ) ;
55
- }
56
-
57
- return outputText ;
58
- } ;
59
-
60
11
export const nativeComponentTransform = (
61
12
compilerCtx : d . CompilerCtx ,
62
13
transformOpts : d . TransformOptions
0 commit comments