File tree Expand file tree Collapse file tree 6 files changed +19
-1
lines changed
Expand file tree Collapse file tree 6 files changed +19
-1
lines changed Original file line number Diff line number Diff line change 33// Prevent the dependency validation from tripping because we don't import these. We need
44// it as a peer dependency of @angular /core.
55// require('zone.js')
6- // require('@angular/tsc-wrapped')
76
87
98// This file hooks up on require calls to transpile TypeScript.
Original file line number Diff line number Diff line change 1+ // @ignoreDep @angular /compiler-cli
12import * as ts from 'typescript' ;
23import * as path from 'path' ;
34import * as fs from 'fs' ;
Original file line number Diff line number Diff line change 1+ // @ignoreDep @angular /compiler-cli
12import * as path from 'path' ;
23
34let version ;
Original file line number Diff line number Diff line change 1+ // @ignoreDep @angular /compiler-cli
12import * as fs from 'fs' ;
23import * as path from 'path' ;
34import * as ts from 'typescript' ;
Original file line number Diff line number Diff line change 1+ // @ignoreDep @angular /compiler-cli
12import { CodeGenerator } from '@angular/compiler-cli' ;
23
34
Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ const path = require('path');
1111
1212const IMPORT_RE = / ( ^ | \n ) \s * i m p o r t \b (?: .| \n ) * ?\' [ ^ \' ] * \' / g;
1313const REQUIRE_RE = / \b r e q u i r e \( ' [ ^ ) ] + ?' \) / g;
14+ const IGNORE_RE = / \s + @ i g n o r e D e p \s + \S + / g;
1415const NODE_PACKAGES = [
1516 'child_process' ,
1617 'fs' ,
@@ -72,6 +73,16 @@ function listRequiredModules(source) {
7273 } ) ;
7374}
7475
76+ function listIgnoredModules ( source ) {
77+ const ignored = source . match ( IGNORE_RE ) ;
78+ return ( ignored || [ ] )
79+ . map ( match => {
80+ const m = match . match ( / @ i g n o r e D e p \s + ( \S + ) / ) ;
81+ return m && m [ 1 ] ;
82+ } )
83+ . filter ( x => ! ! x ) ;
84+ }
85+
7586function reportMissingDependencies ( missingDeps ) {
7687 if ( missingDeps . length == 0 ) {
7788 console . log ( chalk . green ( ' no dependency missing from package.json.' ) ) ;
@@ -110,6 +121,10 @@ for (const packageName of Object.keys(packages)) {
110121 . forEach ( modulePath => importMap [ modulePath ] = true ) ;
111122 listRequiredModules ( source )
112123 . forEach ( modulePath => importMap [ modulePath ] = true ) ;
124+ listIgnoredModules ( source )
125+ . forEach ( modulePath => {
126+ delete importMap [ modulePath ] ;
127+ } ) ;
113128 } ) ;
114129
115130 const dependencies = Object . keys ( importMap )
You can’t perform that action at this time.
0 commit comments