@@ -9,10 +9,10 @@ import chokidar from 'chokidar';
9
9
import debounce from 'debounce' ;
10
10
11
11
import { create } from './src/create.js' ;
12
- import {
13
- getUserConfig ,
14
- getCliConfig ,
15
- addFrameworkPlugins ,
12
+ import {
13
+ getUserConfig ,
14
+ getCliConfig ,
15
+ addFrameworkPlugins ,
16
16
addCustomElementsPropertyToPackageJson ,
17
17
mergeGlobsAndExcludes ,
18
18
timestamp ,
@@ -24,7 +24,7 @@ import {
24
24
const mainDefinitions = [ { name : 'command' , defaultOption : true } ] ;
25
25
const mainOptions = commandLineArgs ( mainDefinitions , { stopAtFirstUnknown : true } ) ;
26
26
const argv = mainOptions . _unknown || [ ] ;
27
-
27
+
28
28
if ( mainOptions . command === 'analyze' ) {
29
29
30
30
const {
@@ -44,31 +44,31 @@ import {
44
44
async function run ( ) {
45
45
/**
46
46
* Create modules for `create()`
47
- *
47
+ *
48
48
* By default, the analyzer doesn't actually compile a users source code with the TS compiler
49
49
* API. This means that by default, the typeChecker is not available in plugins.
50
- *
50
+ *
51
51
* If users want to use the typeChecker, they can do so by adding a `overrideModuleCreation` property
52
52
* in their custom-elements-manifest.config.js. `overrideModuleCreation` is a function that should return
53
53
* an array of sourceFiles.
54
54
*/
55
- const modules = userConfig ?. overrideModuleCreation
55
+ const modules = userConfig ?. overrideModuleCreation
56
56
? userConfig . overrideModuleCreation ( { ts, globs} )
57
57
: globs . map ( glob => {
58
58
const relativeModulePath = path . relative ( process . cwd ( ) , glob ) ;
59
59
const source = fs . readFileSync ( relativeModulePath ) . toString ( ) ;
60
-
60
+
61
61
return ts . createSourceFile (
62
62
relativeModulePath ,
63
63
source ,
64
64
ts . ScriptTarget . ES2015 ,
65
65
true ,
66
66
) ;
67
67
} ) ;
68
-
68
+
69
69
let plugins = await addFrameworkPlugins ( mergedOptions ) ;
70
70
plugins = [ ...plugins , ...( userConfig ?. plugins || [ ] ) ] ;
71
-
71
+
72
72
/**
73
73
* Create the manifest
74
74
*/
@@ -96,9 +96,9 @@ import {
96
96
*/
97
97
if ( mergedOptions . watch ) {
98
98
const fileWatcher = chokidar . watch ( globs ) ;
99
-
99
+
100
100
const onChange = debounce ( run , 100 ) ;
101
-
101
+
102
102
fileWatcher . addListener ( 'change' , onChange ) ;
103
103
fileWatcher . addListener ( 'unlink' , onChange ) ;
104
104
}
@@ -111,4 +111,4 @@ import {
111
111
} else {
112
112
console . log ( MENU ) ;
113
113
}
114
- } ) ( ) ;
114
+ } ) ( ) ;
0 commit comments