@@ -11,6 +11,9 @@ const inlineStylesSourcemapRegex = /styles: ?\[["'].*sourceMappingURL=.*["']/;
11
11
/** RegExp that matches Angular component metadata properties that refer to external resources. */
12
12
const externalReferencesRegex = / ( t e m p l a t e U r l | s t y l e U r l s ) : * [ " ' [ ] / ;
13
13
14
+ /** RegExp that matches common Bazel manifest paths in this workspace */
15
+ const bazelManifestPath = / ( a n g u l a r _ m a t e r i a l | e x t e r n a l ) \/ / ;
16
+
14
17
/**
15
18
* List of fields which are mandatory in entry-point "package.json" files and refer
16
19
* to files in the release output.
@@ -19,21 +22,25 @@ const packageJsonPathFields =
19
22
[ 'main' , 'module' , 'typings' , 'es2015' , 'fesm5' , 'fesm2015' , 'esm5' , 'esm2015' ] ;
20
23
21
24
/**
22
- * Checks the specified release bundle and ensures that it does not contain
23
- * any external resource URLs.
25
+ * Checks the specified JavaScript file and ensures that it does not
26
+ * contain any external resource URLs, or Bazel manifest paths .
24
27
*/
25
- export function checkReleaseBundle ( bundlePath : string ) : string [ ] {
26
- const bundleContent = readFileSync ( bundlePath , 'utf8' ) ;
28
+ export function checkJavaScriptOutput ( filePath : string ) : string [ ] {
29
+ const fileContent = readFileSync ( filePath , 'utf8' ) ;
27
30
const failures : string [ ] = [ ] ;
28
31
29
- if ( inlineStylesSourcemapRegex . exec ( bundleContent ) !== null ) {
32
+ if ( inlineStylesSourcemapRegex . exec ( fileContent ) !== null ) {
30
33
failures . push ( 'Found sourcemap references in component styles.' ) ;
31
34
}
32
35
33
- if ( externalReferencesRegex . exec ( bundleContent ) !== null ) {
36
+ if ( externalReferencesRegex . exec ( fileContent ) !== null ) {
34
37
failures . push ( 'Found external component resource references' ) ;
35
38
}
36
39
40
+ if ( bazelManifestPath . exec ( fileContent ) !== null ) {
41
+ failures . push ( 'Found Bazel manifest path in output.' ) ;
42
+ }
43
+
37
44
return failures ;
38
45
}
39
46
0 commit comments