@nrwl/angular 13.4.1 → 13.4.4-beta.1
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/LICENSE +1 -1
- package/esm2020/src/runtime/nx/data-persistence.mjs +15 -15
- package/fesm2015/nrwl-angular.mjs +14 -14
- package/fesm2015/nrwl-angular.mjs.map +1 -1
- package/fesm2020/nrwl-angular.mjs +14 -14
- package/fesm2020/nrwl-angular.mjs.map +1 -1
- package/package.json +6 -6
- package/src/executors/ng-packagr-lite/ng-packagr-adjustments/ng-package/entry-point/compile-ngc.transform.js.map +1 -1
- package/src/executors/ng-packagr-lite/ng-packagr-adjustments/ngc/compile-source-files.d.ts +2 -1
- package/src/executors/ng-packagr-lite/ng-packagr-adjustments/ngc/compile-source-files.js +3 -1
- package/src/executors/ng-packagr-lite/ng-packagr-adjustments/ngc/compile-source-files.js.map +1 -1
- package/src/executors/ng-packagr-lite/ng-packagr-adjustments/ts/cache-compiler-host.d.ts +14 -0
- package/src/executors/ng-packagr-lite/ng-packagr-adjustments/ts/cache-compiler-host.js +141 -0
- package/src/executors/ng-packagr-lite/ng-packagr-adjustments/ts/cache-compiler-host.js.map +1 -0
- package/src/executors/package/ng-packagr-adjustments/ng-package/entry-point/compile-ngc.transform.js +1 -1
- package/src/executors/package/ng-packagr-adjustments/ng-package/entry-point/compile-ngc.transform.js.map +1 -1
- package/src/executors/package/ng-packagr-adjustments/ngc/compile-source-files.d.ts +12 -0
- package/src/executors/package/ng-packagr-adjustments/ngc/compile-source-files.js +144 -0
- package/src/executors/package/ng-packagr-adjustments/ngc/compile-source-files.js.map +1 -0
- package/src/executors/package/ng-packagr-adjustments/ts/cache-compiler-host.d.ts +14 -0
- package/src/executors/package/ng-packagr-adjustments/ts/cache-compiler-host.js +141 -0
- package/src/executors/package/ng-packagr-adjustments/ts/cache-compiler-host.js.map +1 -0
- package/src/generators/library/lib/normalize-options.js +4 -4
- package/src/generators/library/lib/normalize-options.js.map +1 -1
- package/src/generators/library/lib/update-project.js +11 -4
- package/src/generators/library/lib/update-project.js.map +1 -1
- package/src/generators/library/schema.d.ts +1 -0
- package/src/generators/library/schema.json +5 -0
- package/src/migrations/update-13-3-0/update-mfe-webpack-config.js +1 -1
- package/src/migrations/update-13-3-0/update-mfe-webpack-config.js.map +1 -1
- package/src/runtime/nx/data-persistence.d.ts +21 -19
- package/src/runtime/nx/data-persistence.js +14 -14
- package/src/runtime/nx/data-persistence.js.map +1 -1
- package/src/utils/versions.js +1 -1
- package/jest.config.js +0 -10
package/src/executors/ng-packagr-lite/ng-packagr-adjustments/ngc/compile-source-files.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compile-source-files.js","sourceRoot":"","sources":["../../../../../../../../packages/angular/src/executors/ng-packagr-lite/ng-packagr-adjustments/ngc/compile-source-files.ts"],"names":[],"mappings":";AAAA
|
|
1
|
+
{"version":3,"file":"compile-source-files.js","sourceRoot":"","sources":["../../../../../../../../packages/angular/src/executors/ng-packagr-lite/ng-packagr-adjustments/ngc/compile-source-files.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;;AAOH,2DAKyC;AAEzC,+EAAqF;AACrF,iGAA2F;AAC3F,gDAAgD;AAChD,0EAAqE;AACrE,iCAAiC;AAEjC,mEAA8D;AAE9D,SAAsB,kBAAkB,CACtC,KAAiB,EACjB,QAA6B,EAC7B,qBAA+C,EAC/C,YAAuC,EACvC,mBAAyC,EACzC,aAA6B,EAC7B,KAAe;;QAEf,MAAM,EAAE,YAAY,EAAE,iBAAiB,EAAE,GAAG,MAAM,IAAA,+BAAa,GAAE,CAAC;QAElE,MAAM,eAAe,mCAChB,QAAQ,CAAC,OAAO,GAChB,YAAY,CAChB,CAAC;QACF,MAAM,UAAU,GAAmB,KAAK,CAAC,IAAI,CAAC,IAAA,8BAAsB,GAAE,CAAC,CAAC;QACxE,MAAM,aAAa,GAAgB,KAAK,CAAC,IAAI,CAAC,iBAAS,CAAC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,EAAE;YACvC,IAAI,UAAU,CAAC,QAAQ,KAAK,EAAE,CAAC,kBAAkB,CAAC,KAAK,EAAE;gBACvD,gBAAgB,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;aACnC;iBAAM;gBACL,gBAAgB,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;aACnC;SACF;QAED,IAAI,gBAAgB,CAAC,MAAM,EAAE;YAC3B,GAAG,CAAC,GAAG,CAAC,iBAAiB,CAAC,gBAAgB,CAAC,CAAC,CAAC;SAC9C;QAED,IAAI,gBAAgB,CAAC,MAAM,EAAE;YAC3B,MAAM,IAAI,KAAK,CAAC,iBAAiB,CAAC,gBAAgB,CAAC,CAAC,CAAC;SACtD;QAED,MAAM,YAAY,GAAG,eAAe,CAAC,WAAW,EAAE,CAAC,YAAY,CAAC;QAChE,KAAK,MAAM,UAAU,IAAI,OAAO,CAAC,cAAc,EAAE,EAAE;YACjD,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,UAAU,CAAC,EAAE;gBAClC,OAAO,CAAC,IAAI,CAAC,UAAU,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,YAAY,CAAC,CAAC;aACzE;SACF;IACH,CAAC;CAAA;AAnMD,gDAmMC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Adapted from the original ng-packagr source.
|
|
3
|
+
*
|
|
4
|
+
* Changes made:
|
|
5
|
+
* - Changed filePath passed to the StylesheetProcessor.parse when is a .ts file and inlineStyleLanguage is set.
|
|
6
|
+
*/
|
|
7
|
+
import type { CompilerHost, CompilerOptions } from '@angular/compiler-cli';
|
|
8
|
+
import { FileCache } from 'ng-packagr/lib/file-system/file-cache';
|
|
9
|
+
import { BuildGraph } from 'ng-packagr/lib/graph/build-graph';
|
|
10
|
+
import { EntryPointNode } from 'ng-packagr/lib/ng-package/nodes';
|
|
11
|
+
import * as ts from 'typescript';
|
|
12
|
+
import { InlineStyleLanguage, StylesheetProcessor } from '../styles/stylesheet-processor';
|
|
13
|
+
export declare function cacheCompilerHost(graph: BuildGraph, entryPoint: EntryPointNode, compilerOptions: CompilerOptions, moduleResolutionCache: ts.ModuleResolutionCache, stylesheetProcessor?: StylesheetProcessor, inlineStyleLanguage?: InlineStyleLanguage, sourcesFileCache?: FileCache): CompilerHost;
|
|
14
|
+
export declare function augmentProgramWithVersioning(program: ts.Program): void;
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Adapted from the original ng-packagr source.
|
|
4
|
+
*
|
|
5
|
+
* Changes made:
|
|
6
|
+
* - Changed filePath passed to the StylesheetProcessor.parse when is a .ts file and inlineStyleLanguage is set.
|
|
7
|
+
*/
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.augmentProgramWithVersioning = exports.cacheCompilerHost = void 0;
|
|
10
|
+
const tslib_1 = require("tslib");
|
|
11
|
+
const crypto_1 = require("crypto");
|
|
12
|
+
const node_1 = require("ng-packagr/lib/graph/node");
|
|
13
|
+
const nodes_1 = require("ng-packagr/lib/ng-package/nodes");
|
|
14
|
+
const path_1 = require("ng-packagr/lib/utils/path");
|
|
15
|
+
const path = require("path");
|
|
16
|
+
const ts = require("typescript");
|
|
17
|
+
function cacheCompilerHost(graph, entryPoint, compilerOptions, moduleResolutionCache, stylesheetProcessor, inlineStyleLanguage, sourcesFileCache = entryPoint.cache.sourcesFileCache) {
|
|
18
|
+
const compilerHost = ts.createIncrementalCompilerHost(compilerOptions);
|
|
19
|
+
const getNode = (fileName) => {
|
|
20
|
+
const nodeUri = (0, nodes_1.fileUrl)((0, path_1.ensureUnixPath)(fileName));
|
|
21
|
+
let node = graph.get(nodeUri);
|
|
22
|
+
if (!node) {
|
|
23
|
+
node = new node_1.Node(nodeUri);
|
|
24
|
+
graph.put(node);
|
|
25
|
+
}
|
|
26
|
+
return node;
|
|
27
|
+
};
|
|
28
|
+
const addDependee = (fileName) => {
|
|
29
|
+
const node = getNode(fileName);
|
|
30
|
+
entryPoint.dependsOn(node);
|
|
31
|
+
};
|
|
32
|
+
return Object.assign(Object.assign({}, compilerHost), {
|
|
33
|
+
// ts specific
|
|
34
|
+
fileExists: (fileName) => {
|
|
35
|
+
const cache = sourcesFileCache.getOrCreate(fileName);
|
|
36
|
+
if (cache.exists === undefined) {
|
|
37
|
+
cache.exists = compilerHost.fileExists.call(this, fileName);
|
|
38
|
+
}
|
|
39
|
+
return cache.exists;
|
|
40
|
+
}, getSourceFile: (fileName, languageVersion) => {
|
|
41
|
+
addDependee(fileName);
|
|
42
|
+
const cache = sourcesFileCache.getOrCreate(fileName);
|
|
43
|
+
if (!cache.sourceFile) {
|
|
44
|
+
cache.sourceFile = compilerHost.getSourceFile.call(this, fileName, languageVersion);
|
|
45
|
+
}
|
|
46
|
+
return cache.sourceFile;
|
|
47
|
+
}, writeFile: (fileName, data, writeByteOrderMark, onError, sourceFiles) => {
|
|
48
|
+
if (fileName.endsWith('.d.ts')) {
|
|
49
|
+
sourceFiles.forEach((source) => {
|
|
50
|
+
const cache = sourcesFileCache.getOrCreate(source.fileName);
|
|
51
|
+
if (!cache.declarationFileName) {
|
|
52
|
+
cache.declarationFileName = (0, path_1.ensureUnixPath)(fileName);
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
else {
|
|
57
|
+
fileName = fileName.replace(/\.js(\.map)?$/, '.mjs$1');
|
|
58
|
+
const outputCache = entryPoint.cache.outputCache;
|
|
59
|
+
outputCache.set(fileName, {
|
|
60
|
+
content: data,
|
|
61
|
+
version: (0, crypto_1.createHash)('sha256').update(data).digest('hex'),
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
compilerHost.writeFile.call(this, fileName, data, writeByteOrderMark, onError, sourceFiles);
|
|
65
|
+
}, readFile: (fileName) => {
|
|
66
|
+
addDependee(fileName);
|
|
67
|
+
const cache = sourcesFileCache.getOrCreate(fileName);
|
|
68
|
+
if (cache.content === undefined) {
|
|
69
|
+
cache.content = compilerHost.readFile.call(this, fileName);
|
|
70
|
+
}
|
|
71
|
+
return cache.content;
|
|
72
|
+
}, resolveModuleNames: (moduleNames, containingFile) => {
|
|
73
|
+
return moduleNames.map((moduleName) => {
|
|
74
|
+
const { resolvedModule } = ts.resolveModuleName(moduleName, (0, path_1.ensureUnixPath)(containingFile), compilerOptions, compilerHost, moduleResolutionCache);
|
|
75
|
+
return resolvedModule;
|
|
76
|
+
});
|
|
77
|
+
}, resourceNameToFileName: (resourceName, containingFilePath) => {
|
|
78
|
+
const resourcePath = path.resolve(path.dirname(containingFilePath), resourceName);
|
|
79
|
+
const containingNode = getNode(containingFilePath);
|
|
80
|
+
const resourceNode = getNode(resourcePath);
|
|
81
|
+
containingNode.dependsOn(resourceNode);
|
|
82
|
+
return resourcePath;
|
|
83
|
+
}, readResource: (fileName) => (0, tslib_1.__awaiter)(this, void 0, void 0, function* () {
|
|
84
|
+
addDependee(fileName);
|
|
85
|
+
const cache = sourcesFileCache.getOrCreate(fileName);
|
|
86
|
+
if (cache.content === undefined) {
|
|
87
|
+
if (/(?:html?|svg)$/.test(path.extname(fileName))) {
|
|
88
|
+
// template
|
|
89
|
+
cache.content = compilerHost.readFile.call(this, fileName);
|
|
90
|
+
}
|
|
91
|
+
else {
|
|
92
|
+
// stylesheet
|
|
93
|
+
cache.content = yield stylesheetProcessor.process({
|
|
94
|
+
filePath: fileName,
|
|
95
|
+
content: compilerHost.readFile.call(this, fileName),
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
if (cache.content === undefined) {
|
|
99
|
+
throw new Error(`Cannot read file ${fileName}.`);
|
|
100
|
+
}
|
|
101
|
+
cache.exists = true;
|
|
102
|
+
}
|
|
103
|
+
return cache.content;
|
|
104
|
+
}), transformResource: (data, context) => (0, tslib_1.__awaiter)(this, void 0, void 0, function* () {
|
|
105
|
+
if (context.resourceFile || context.type !== 'style') {
|
|
106
|
+
return null;
|
|
107
|
+
}
|
|
108
|
+
if (inlineStyleLanguage) {
|
|
109
|
+
const key = (0, crypto_1.createHash)('sha1').update(data).digest('hex');
|
|
110
|
+
const fileName = `${context.containingFile}-${key}.${inlineStyleLanguage}`;
|
|
111
|
+
const cache = sourcesFileCache.getOrCreate(fileName);
|
|
112
|
+
if (cache.content === undefined) {
|
|
113
|
+
cache.content = yield stylesheetProcessor.process({
|
|
114
|
+
filePath: context.containingFile,
|
|
115
|
+
content: data,
|
|
116
|
+
});
|
|
117
|
+
const virtualFileNode = getNode(fileName);
|
|
118
|
+
const containingFileNode = getNode(context.containingFile);
|
|
119
|
+
virtualFileNode.dependsOn(containingFileNode);
|
|
120
|
+
}
|
|
121
|
+
cache.exists = true;
|
|
122
|
+
return { content: cache.content };
|
|
123
|
+
}
|
|
124
|
+
return null;
|
|
125
|
+
}) });
|
|
126
|
+
}
|
|
127
|
+
exports.cacheCompilerHost = cacheCompilerHost;
|
|
128
|
+
function augmentProgramWithVersioning(program) {
|
|
129
|
+
const baseGetSourceFiles = program.getSourceFiles;
|
|
130
|
+
program.getSourceFiles = function (...parameters) {
|
|
131
|
+
const files = baseGetSourceFiles(...parameters);
|
|
132
|
+
for (const file of files) {
|
|
133
|
+
if (file.version === undefined) {
|
|
134
|
+
file.version = (0, crypto_1.createHash)('sha256').update(file.text).digest('hex');
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
return files;
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
exports.augmentProgramWithVersioning = augmentProgramWithVersioning;
|
|
141
|
+
//# sourceMappingURL=cache-compiler-host.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cache-compiler-host.js","sourceRoot":"","sources":["../../../../../../../../packages/angular/src/executors/ng-packagr-lite/ng-packagr-adjustments/ts/cache-compiler-host.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;;AAGH,mCAAoC;AAGpC,oDAAiD;AACjD,2DAA0E;AAC1E,oDAA2D;AAC3D,6BAA6B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AC;wBAChD,QAAQ,EAAE,OAAO,CAAC,cAAc;wBAChC,OAAO,EAAE,IAAI;qBACd,CAAC,CAAC;oBAEH,MAAM,eAAe,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;oBAC1C,MAAM,kBAAkB,GAAG,OAAO,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC;oBAC3D,eAAe,CAAC,SAAS,CAAC,kBAAkB,CAAC,CAAC;iBAC/C;gBAED,KAAK,CAAC,MAAM,GAAG,IAAI,CAAC;gBAEpB,OAAO,EAAE,OAAO,EAAE,KAAK,CAAC,OAAO,EAAE,CAAC;aACnC;YAED,OAAO,IAAI,CAAC;QACd,CAAC,CAAA,IACD;AACJ,CAAC;AArLD,8CAqLC;AAED,SAAgB,4BAA4B,CAAC,OAAmB;IAC9D,MAAM,kBAAkB,GAAG,OAAO,CAAC,cAAc,CAAC;IAClD,OAAO,CAAC,cAAc,GAAG,UAAU,GAAG,UAAU;QAC9C,MAAM,KAAK,GACT,kBAAkB,CAAC,GAAG,UAAU,CAAC,CAAC;QAEpC,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE;YACxB,IAAI,IAAI,CAAC,OAAO,KAAK,SAAS,EAAE;gBAC9B,IAAI,CAAC,OAAO,GAAG,IAAA,mBAAU,EAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;aACrE;SACF;QAED,OAAO,KAAK,CAAC;IACf,CAAC,CAAC;AACJ,CAAC;AAdD,oEAcC"}
|
package/src/executors/package/ng-packagr-adjustments/ng-package/entry-point/compile-ngc.transform.js
CHANGED
|
@@ -10,13 +10,13 @@ exports.compileNgcTransformFactory = void 0;
|
|
|
10
10
|
const tslib_1 = require("tslib");
|
|
11
11
|
const transform_1 = require("ng-packagr/lib/graph/transform");
|
|
12
12
|
const nodes_1 = require("ng-packagr/lib/ng-package/nodes");
|
|
13
|
-
const compile_source_files_1 = require("ng-packagr/lib/ngc/compile-source-files");
|
|
14
13
|
const ngcc_processor_1 = require("ng-packagr/lib/ngc/ngcc-processor");
|
|
15
14
|
const tsconfig_1 = require("ng-packagr/lib/ts/tsconfig");
|
|
16
15
|
const ng_compiler_cli_1 = require("ng-packagr/lib/utils/ng-compiler-cli");
|
|
17
16
|
const ora = require("ora");
|
|
18
17
|
const path = require("path");
|
|
19
18
|
const ts = require("typescript");
|
|
19
|
+
const compile_source_files_1 = require("../../ngc/compile-source-files");
|
|
20
20
|
const compileNgcTransformFactory = (StylesheetProcessor, options) => {
|
|
21
21
|
return (0, transform_1.transformFromPromise)((graph) => (0, tslib_1.__awaiter)(void 0, void 0, void 0, function* () {
|
|
22
22
|
var _a;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compile-ngc.transform.js","sourceRoot":"","sources":["../../../../../../../../../packages/angular/src/executors/package/ng-packagr-adjustments/ng-package/entry-point/compile-ngc.transform.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;;AAEH,8DAGwC;AACxC,2DAIyC;AACzC,
|
|
1
|
+
{"version":3,"file":"compile-ngc.transform.js","sourceRoot":"","sources":["../../../../../../../../../packages/angular/src/executors/package/ng-packagr-adjustments/ng-package/entry-point/compile-ngc.transform.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;;AAEH,8DAGwC;AACxC,2DAIyC;AACzC,sEAAkE;AAClE,yDAA0E;AAC1E,0EAAuE;AACvE,2BAA2B;AAC3B,6BAA6B;AAC7B,iCAAiC;AACjC,yEAAoE;AAI7D,MAAM,0BAA0B,GAAG,CACxC,mBAAoD,EACpD,OAAyB,EACd,EAAE;IACb,OAAO,IAAA,gCAAoB,EAAC,CAAO,KAAK,EAAE,EAAE;;;QAC1C,MAAM,OAAO,GAAG,GAAG,CAAC;YAClB,UAAU,EAAE,KAAK;YACjB,YAAY,EAAE,KAAK;SACpB,CAAC,CAAC;QAEH,IAAI;YACF,MAAM,UAAU,GAAmB,KAAK,CAAC,IAAI,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,OAAO,CAAC;gBAC7B,cAAc,EAAE,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC;gBAC1C,WAAW,EAAE,IAAI;gBACjB,MAAM,EAAE,EAAE,CAAC,YAAY,CAAC,MAAM;aAC/B,EACD,UAAU,CAAC,KAAK,CAAC,mBAA0B,EAC3C,aAAa,EACb,OAAO,CAAC,KAAK,CACd,CAAC;SACH;QAAC,OAAO,KAAK,EAAE;YACd,OAAO,CAAC,IAAI,EAAE,CAAC;YACf,MAAM,KAAK,CAAC;SACb;QAED,OAAO,CAAC,OAAO,EAAE,CAAC;QAClB,OAAO,KAAK,CAAC;IACf,CAAC,CAAA,CAAC,CAAC;AACL,CAAC,CAAC;AAzEW,QAAA,0BAA0B,8BAyErC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Adapted from the original ng-packagr source.
|
|
3
|
+
*
|
|
4
|
+
* Changes made:
|
|
5
|
+
* - Use custom cacheCompilerHost instead of the one provided by ng-packagr.
|
|
6
|
+
*/
|
|
7
|
+
import type { CompilerOptions, ParsedConfiguration } from '@angular/compiler-cli';
|
|
8
|
+
import { BuildGraph } from 'ng-packagr/lib/graph/build-graph';
|
|
9
|
+
import { NgccProcessor } from 'ng-packagr/lib/ngc/ngcc-processor';
|
|
10
|
+
import * as ts from 'typescript';
|
|
11
|
+
import { StylesheetProcessor } from '../styles/stylesheet-processor';
|
|
12
|
+
export declare function compileSourceFiles(graph: BuildGraph, tsConfig: ParsedConfiguration, moduleResolutionCache: ts.ModuleResolutionCache, extraOptions?: Partial<CompilerOptions>, stylesheetProcessor?: StylesheetProcessor, ngccProcessor?: NgccProcessor, watch?: boolean): Promise<void>;
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Adapted from the original ng-packagr source.
|
|
4
|
+
*
|
|
5
|
+
* Changes made:
|
|
6
|
+
* - Use custom cacheCompilerHost instead of the one provided by ng-packagr.
|
|
7
|
+
*/
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.compileSourceFiles = void 0;
|
|
10
|
+
const tslib_1 = require("tslib");
|
|
11
|
+
const nodes_1 = require("ng-packagr/lib/ng-package/nodes");
|
|
12
|
+
const ngcc_transform_compiler_host_1 = require("ng-packagr/lib/ts/ngcc-transform-compiler-host");
|
|
13
|
+
const log = require("ng-packagr/lib/utils/log");
|
|
14
|
+
const ng_compiler_cli_1 = require("ng-packagr/lib/utils/ng-compiler-cli");
|
|
15
|
+
const ts = require("typescript");
|
|
16
|
+
const cache_compiler_host_1 = require("../ts/cache-compiler-host");
|
|
17
|
+
function compileSourceFiles(graph, tsConfig, moduleResolutionCache, extraOptions, stylesheetProcessor, ngccProcessor, watch) {
|
|
18
|
+
return (0, tslib_1.__awaiter)(this, void 0, void 0, function* () {
|
|
19
|
+
const { NgtscProgram, formatDiagnostics } = yield (0, ng_compiler_cli_1.ngCompilerCli)();
|
|
20
|
+
const tsConfigOptions = Object.assign(Object.assign({}, tsConfig.options), extraOptions);
|
|
21
|
+
const entryPoint = graph.find((0, nodes_1.isEntryPointInProgress)());
|
|
22
|
+
const ngPackageNode = graph.find(nodes_1.isPackage);
|
|
23
|
+
const inlineStyleLanguage = ngPackageNode.data.inlineStyleLanguage;
|
|
24
|
+
const tsCompilerHost = (0, ngcc_transform_compiler_host_1.ngccTransformCompilerHost)((0, cache_compiler_host_1.cacheCompilerHost)(graph, entryPoint, tsConfigOptions, moduleResolutionCache, stylesheetProcessor, inlineStyleLanguage), tsConfigOptions, ngccProcessor, moduleResolutionCache);
|
|
25
|
+
const cache = entryPoint.cache;
|
|
26
|
+
const sourceFileCache = cache.sourcesFileCache;
|
|
27
|
+
// Create the Angular specific program that contains the Angular compiler
|
|
28
|
+
const angularProgram = new NgtscProgram(tsConfig.rootNames, tsConfigOptions, tsCompilerHost, cache.oldNgtscProgram);
|
|
29
|
+
const angularCompiler = angularProgram.compiler;
|
|
30
|
+
const { ignoreForDiagnostics, ignoreForEmit } = angularCompiler;
|
|
31
|
+
// SourceFile versions are required for builder programs.
|
|
32
|
+
// The wrapped host inside NgtscProgram adds additional files that will not have versions.
|
|
33
|
+
const typeScriptProgram = angularProgram.getTsProgram();
|
|
34
|
+
(0, cache_compiler_host_1.augmentProgramWithVersioning)(typeScriptProgram);
|
|
35
|
+
let builder;
|
|
36
|
+
if (watch) {
|
|
37
|
+
builder = cache.oldBuilder =
|
|
38
|
+
ts.createEmitAndSemanticDiagnosticsBuilderProgram(typeScriptProgram, tsCompilerHost, cache.oldBuilder);
|
|
39
|
+
cache.oldNgtscProgram = angularProgram;
|
|
40
|
+
}
|
|
41
|
+
else {
|
|
42
|
+
// When not in watch mode, the startup cost of the incremental analysis can be avoided by
|
|
43
|
+
// using an abstract builder that only wraps a TypeScript program.
|
|
44
|
+
builder = ts.createAbstractBuilder(typeScriptProgram, tsCompilerHost);
|
|
45
|
+
}
|
|
46
|
+
// Update semantic diagnostics cache
|
|
47
|
+
const affectedFiles = new Set();
|
|
48
|
+
// Analyze affected files when in watch mode for incremental type checking
|
|
49
|
+
if ('getSemanticDiagnosticsOfNextAffectedFile' in builder) {
|
|
50
|
+
// eslint-disable-next-line no-constant-condition
|
|
51
|
+
while (true) {
|
|
52
|
+
const result = builder.getSemanticDiagnosticsOfNextAffectedFile(undefined, (sourceFile) => {
|
|
53
|
+
// If the affected file is a TTC shim, add the shim's original source file.
|
|
54
|
+
// This ensures that changes that affect TTC are typechecked even when the changes
|
|
55
|
+
// are otherwise unrelated from a TS perspective and do not result in Ivy codegen changes.
|
|
56
|
+
// For example, changing @Input property types of a directive used in another component's
|
|
57
|
+
// template.
|
|
58
|
+
if (ignoreForDiagnostics.has(sourceFile) &&
|
|
59
|
+
sourceFile.fileName.endsWith('.ngtypecheck.ts')) {
|
|
60
|
+
// This file name conversion relies on internal compiler logic and should be converted
|
|
61
|
+
// to an official method when available. 15 is length of `.ngtypecheck.ts`
|
|
62
|
+
const originalFilename = sourceFile.fileName.slice(0, -15) + '.ts';
|
|
63
|
+
const originalSourceFile = builder.getSourceFile(originalFilename);
|
|
64
|
+
if (originalSourceFile) {
|
|
65
|
+
affectedFiles.add(originalSourceFile);
|
|
66
|
+
}
|
|
67
|
+
return true;
|
|
68
|
+
}
|
|
69
|
+
return false;
|
|
70
|
+
});
|
|
71
|
+
if (!result) {
|
|
72
|
+
break;
|
|
73
|
+
}
|
|
74
|
+
affectedFiles.add(result.affected);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
// Collect program level diagnostics
|
|
78
|
+
const allDiagnostics = [
|
|
79
|
+
...angularCompiler.getOptionDiagnostics(),
|
|
80
|
+
...builder.getOptionsDiagnostics(),
|
|
81
|
+
...builder.getGlobalDiagnostics(),
|
|
82
|
+
];
|
|
83
|
+
// Required to support asynchronous resource loading
|
|
84
|
+
// Must be done before creating transformers or getting template diagnostics
|
|
85
|
+
yield angularCompiler.analyzeAsync();
|
|
86
|
+
// Collect source file specific diagnostics
|
|
87
|
+
for (const sourceFile of builder.getSourceFiles()) {
|
|
88
|
+
if (!ignoreForDiagnostics.has(sourceFile)) {
|
|
89
|
+
allDiagnostics.push(...builder.getSyntacticDiagnostics(sourceFile), ...builder.getSemanticDiagnostics(sourceFile));
|
|
90
|
+
}
|
|
91
|
+
if (sourceFile.isDeclarationFile) {
|
|
92
|
+
continue;
|
|
93
|
+
}
|
|
94
|
+
// Collect sources that are required to be emitted
|
|
95
|
+
if (!ignoreForEmit.has(sourceFile) &&
|
|
96
|
+
!angularCompiler.incrementalDriver.safeToSkipEmit(sourceFile)) {
|
|
97
|
+
// If required to emit, diagnostics may have also changed
|
|
98
|
+
if (!ignoreForDiagnostics.has(sourceFile)) {
|
|
99
|
+
affectedFiles.add(sourceFile);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
else if (sourceFileCache &&
|
|
103
|
+
!affectedFiles.has(sourceFile) &&
|
|
104
|
+
!ignoreForDiagnostics.has(sourceFile)) {
|
|
105
|
+
// Use cached Angular diagnostics for unchanged and unaffected files
|
|
106
|
+
const angularDiagnostics = sourceFileCache.getAngularDiagnostics(sourceFile);
|
|
107
|
+
if (angularDiagnostics === null || angularDiagnostics === void 0 ? void 0 : angularDiagnostics.length) {
|
|
108
|
+
allDiagnostics.push(...angularDiagnostics);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
// Collect new Angular diagnostics for files affected by changes
|
|
113
|
+
for (const affectedFile of affectedFiles) {
|
|
114
|
+
const angularDiagnostics = angularCompiler.getDiagnosticsForFile(affectedFile,
|
|
115
|
+
/** OptimizeFor.WholeProgram */ 1);
|
|
116
|
+
allDiagnostics.push(...angularDiagnostics);
|
|
117
|
+
sourceFileCache.updateAngularDiagnostics(affectedFile, angularDiagnostics);
|
|
118
|
+
}
|
|
119
|
+
const otherDiagnostics = [];
|
|
120
|
+
const errorDiagnostics = [];
|
|
121
|
+
for (const diagnostic of allDiagnostics) {
|
|
122
|
+
if (diagnostic.category === ts.DiagnosticCategory.Error) {
|
|
123
|
+
errorDiagnostics.push(diagnostic);
|
|
124
|
+
}
|
|
125
|
+
else {
|
|
126
|
+
otherDiagnostics.push(diagnostic);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
if (otherDiagnostics.length) {
|
|
130
|
+
log.msg(formatDiagnostics(errorDiagnostics));
|
|
131
|
+
}
|
|
132
|
+
if (errorDiagnostics.length) {
|
|
133
|
+
throw new Error(formatDiagnostics(errorDiagnostics));
|
|
134
|
+
}
|
|
135
|
+
const transformers = angularCompiler.prepareEmit().transformers;
|
|
136
|
+
for (const sourceFile of builder.getSourceFiles()) {
|
|
137
|
+
if (!ignoreForEmit.has(sourceFile)) {
|
|
138
|
+
builder.emit(sourceFile, undefined, undefined, undefined, transformers);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
exports.compileSourceFiles = compileSourceFiles;
|
|
144
|
+
//# sourceMappingURL=compile-source-files.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compile-source-files.js","sourceRoot":"","sources":["../../../../../../../../packages/angular/src/executors/package/ng-packagr-adjustments/ngc/compile-source-files.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;;AAOH,2DAKyC;AAEzC,iGAA2F;AAC3F,gDAAgD;AAChD,0EAAqE;AACrE,iCAAiC;AAEjC,mEAGmC;AAEnC,SAAsB,kBAAkB,CACtC,KAAiB,EACjB,QAA6B,EAC7B,qBAA+C,EAC/C,YAAuC,EACvC,mBAAyC,EACzC,aAA6B,EAC7B,KAAe;;QAEf,MAAM,EAAE,YAAY,EAAE,iBAAiB,EAAE,GAAG,MAAM,IAAA,+BAAa,GAAE,CAAC;QAElE,MAAM,eAAe,mCAChB,QAAQ,CAAC,OAAO,GAChB,YAAY,CAChB,CAAC;QACF,MAAM,UAAU,GAAmB,KAAK,CAAC,IAAI,CAAC,IAAA,8BAAsB,GAAE,CAAC,CAAC;QACxE,MAAM,aAAa,GAAgB,KAAK,CAAC,IAAI,CAAC,iBAAS,CAAC,CAAC;QACzD,MAAM,mBAAmB,GAAG,aAAa,CAAC,IAAI,CAAC,mBAAmB,CAAC;QAEnE,MAAM,cAAc,GAAG,IAAA,wDAAyB,EAC9C,IAAA,uCAAiB,EACf,KAAK,EACL,UAAU,EACV,eAAe,EACf,qBAAqB,EACrB,mBAAmB,EACnB,mBAAmB,CACpB,EACD,eAAe,EACf,aAAa,EACb,qBAAqB,CACtB,CAAC;QAEF,MAAM,KAAK,GAAG,UAAU,CAAC,KAAK,CAAC;QAC/B,MAAM,eAAe,GAAG,KAAK,CAAC,gBAAgB,CAAC;QAE/C,yEAAyE;QACzE,MAAM,cAAc,GAAG,IAAI,YAAY,CACrC,QAAQ,CAAC,SAAS,EAClB,eAAe,EACf,cAAc,EACd,KAAK,CAAC,eAAe,CACtB,CAAC;QAEF,MAAM,eAAe,GAAG,cAAc,CAAC,QAAQ,CAA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G,CAAC,UAAU,CAAC,EAAE;gBAClC,OAAO,CAAC,IAAI,CAAC,UAAU,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,YAAY,CAAC,CAAC;aACzE;SACF;IACH,CAAC;CAAA;AA/LD,gDA+LC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Adapted from the original ng-packagr source.
|
|
3
|
+
*
|
|
4
|
+
* Changes made:
|
|
5
|
+
* - Changed filePath passed to the StylesheetProcessor.parse when is a .ts file and inlineStyleLanguage is set.
|
|
6
|
+
*/
|
|
7
|
+
import type { CompilerHost, CompilerOptions } from '@angular/compiler-cli';
|
|
8
|
+
import { FileCache } from 'ng-packagr/lib/file-system/file-cache';
|
|
9
|
+
import { BuildGraph } from 'ng-packagr/lib/graph/build-graph';
|
|
10
|
+
import { EntryPointNode } from 'ng-packagr/lib/ng-package/nodes';
|
|
11
|
+
import * as ts from 'typescript';
|
|
12
|
+
import { InlineStyleLanguage, StylesheetProcessor } from '../styles/stylesheet-processor';
|
|
13
|
+
export declare function cacheCompilerHost(graph: BuildGraph, entryPoint: EntryPointNode, compilerOptions: CompilerOptions, moduleResolutionCache: ts.ModuleResolutionCache, stylesheetProcessor?: StylesheetProcessor, inlineStyleLanguage?: InlineStyleLanguage, sourcesFileCache?: FileCache): CompilerHost;
|
|
14
|
+
export declare function augmentProgramWithVersioning(program: ts.Program): void;
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Adapted from the original ng-packagr source.
|
|
4
|
+
*
|
|
5
|
+
* Changes made:
|
|
6
|
+
* - Changed filePath passed to the StylesheetProcessor.parse when is a .ts file and inlineStyleLanguage is set.
|
|
7
|
+
*/
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.augmentProgramWithVersioning = exports.cacheCompilerHost = void 0;
|
|
10
|
+
const tslib_1 = require("tslib");
|
|
11
|
+
const crypto_1 = require("crypto");
|
|
12
|
+
const node_1 = require("ng-packagr/lib/graph/node");
|
|
13
|
+
const nodes_1 = require("ng-packagr/lib/ng-package/nodes");
|
|
14
|
+
const path_1 = require("ng-packagr/lib/utils/path");
|
|
15
|
+
const path = require("path");
|
|
16
|
+
const ts = require("typescript");
|
|
17
|
+
function cacheCompilerHost(graph, entryPoint, compilerOptions, moduleResolutionCache, stylesheetProcessor, inlineStyleLanguage, sourcesFileCache = entryPoint.cache.sourcesFileCache) {
|
|
18
|
+
const compilerHost = ts.createIncrementalCompilerHost(compilerOptions);
|
|
19
|
+
const getNode = (fileName) => {
|
|
20
|
+
const nodeUri = (0, nodes_1.fileUrl)((0, path_1.ensureUnixPath)(fileName));
|
|
21
|
+
let node = graph.get(nodeUri);
|
|
22
|
+
if (!node) {
|
|
23
|
+
node = new node_1.Node(nodeUri);
|
|
24
|
+
graph.put(node);
|
|
25
|
+
}
|
|
26
|
+
return node;
|
|
27
|
+
};
|
|
28
|
+
const addDependee = (fileName) => {
|
|
29
|
+
const node = getNode(fileName);
|
|
30
|
+
entryPoint.dependsOn(node);
|
|
31
|
+
};
|
|
32
|
+
return Object.assign(Object.assign({}, compilerHost), {
|
|
33
|
+
// ts specific
|
|
34
|
+
fileExists: (fileName) => {
|
|
35
|
+
const cache = sourcesFileCache.getOrCreate(fileName);
|
|
36
|
+
if (cache.exists === undefined) {
|
|
37
|
+
cache.exists = compilerHost.fileExists.call(this, fileName);
|
|
38
|
+
}
|
|
39
|
+
return cache.exists;
|
|
40
|
+
}, getSourceFile: (fileName, languageVersion) => {
|
|
41
|
+
addDependee(fileName);
|
|
42
|
+
const cache = sourcesFileCache.getOrCreate(fileName);
|
|
43
|
+
if (!cache.sourceFile) {
|
|
44
|
+
cache.sourceFile = compilerHost.getSourceFile.call(this, fileName, languageVersion);
|
|
45
|
+
}
|
|
46
|
+
return cache.sourceFile;
|
|
47
|
+
}, writeFile: (fileName, data, writeByteOrderMark, onError, sourceFiles) => {
|
|
48
|
+
if (fileName.endsWith('.d.ts')) {
|
|
49
|
+
sourceFiles.forEach((source) => {
|
|
50
|
+
const cache = sourcesFileCache.getOrCreate(source.fileName);
|
|
51
|
+
if (!cache.declarationFileName) {
|
|
52
|
+
cache.declarationFileName = (0, path_1.ensureUnixPath)(fileName);
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
else {
|
|
57
|
+
fileName = fileName.replace(/\.js(\.map)?$/, '.mjs$1');
|
|
58
|
+
const outputCache = entryPoint.cache.outputCache;
|
|
59
|
+
outputCache.set(fileName, {
|
|
60
|
+
content: data,
|
|
61
|
+
version: (0, crypto_1.createHash)('sha256').update(data).digest('hex'),
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
compilerHost.writeFile.call(this, fileName, data, writeByteOrderMark, onError, sourceFiles);
|
|
65
|
+
}, readFile: (fileName) => {
|
|
66
|
+
addDependee(fileName);
|
|
67
|
+
const cache = sourcesFileCache.getOrCreate(fileName);
|
|
68
|
+
if (cache.content === undefined) {
|
|
69
|
+
cache.content = compilerHost.readFile.call(this, fileName);
|
|
70
|
+
}
|
|
71
|
+
return cache.content;
|
|
72
|
+
}, resolveModuleNames: (moduleNames, containingFile) => {
|
|
73
|
+
return moduleNames.map((moduleName) => {
|
|
74
|
+
const { resolvedModule } = ts.resolveModuleName(moduleName, (0, path_1.ensureUnixPath)(containingFile), compilerOptions, compilerHost, moduleResolutionCache);
|
|
75
|
+
return resolvedModule;
|
|
76
|
+
});
|
|
77
|
+
}, resourceNameToFileName: (resourceName, containingFilePath) => {
|
|
78
|
+
const resourcePath = path.resolve(path.dirname(containingFilePath), resourceName);
|
|
79
|
+
const containingNode = getNode(containingFilePath);
|
|
80
|
+
const resourceNode = getNode(resourcePath);
|
|
81
|
+
containingNode.dependsOn(resourceNode);
|
|
82
|
+
return resourcePath;
|
|
83
|
+
}, readResource: (fileName) => (0, tslib_1.__awaiter)(this, void 0, void 0, function* () {
|
|
84
|
+
addDependee(fileName);
|
|
85
|
+
const cache = sourcesFileCache.getOrCreate(fileName);
|
|
86
|
+
if (cache.content === undefined) {
|
|
87
|
+
if (/(?:html?|svg)$/.test(path.extname(fileName))) {
|
|
88
|
+
// template
|
|
89
|
+
cache.content = compilerHost.readFile.call(this, fileName);
|
|
90
|
+
}
|
|
91
|
+
else {
|
|
92
|
+
// stylesheet
|
|
93
|
+
cache.content = yield stylesheetProcessor.process({
|
|
94
|
+
filePath: fileName,
|
|
95
|
+
content: compilerHost.readFile.call(this, fileName),
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
if (cache.content === undefined) {
|
|
99
|
+
throw new Error(`Cannot read file ${fileName}.`);
|
|
100
|
+
}
|
|
101
|
+
cache.exists = true;
|
|
102
|
+
}
|
|
103
|
+
return cache.content;
|
|
104
|
+
}), transformResource: (data, context) => (0, tslib_1.__awaiter)(this, void 0, void 0, function* () {
|
|
105
|
+
if (context.resourceFile || context.type !== 'style') {
|
|
106
|
+
return null;
|
|
107
|
+
}
|
|
108
|
+
if (inlineStyleLanguage) {
|
|
109
|
+
const key = (0, crypto_1.createHash)('sha1').update(data).digest('hex');
|
|
110
|
+
const fileName = `${context.containingFile}-${key}.${inlineStyleLanguage}`;
|
|
111
|
+
const cache = sourcesFileCache.getOrCreate(fileName);
|
|
112
|
+
if (cache.content === undefined) {
|
|
113
|
+
cache.content = yield stylesheetProcessor.process({
|
|
114
|
+
filePath: context.containingFile,
|
|
115
|
+
content: data,
|
|
116
|
+
});
|
|
117
|
+
const virtualFileNode = getNode(fileName);
|
|
118
|
+
const containingFileNode = getNode(context.containingFile);
|
|
119
|
+
virtualFileNode.dependsOn(containingFileNode);
|
|
120
|
+
}
|
|
121
|
+
cache.exists = true;
|
|
122
|
+
return { content: cache.content };
|
|
123
|
+
}
|
|
124
|
+
return null;
|
|
125
|
+
}) });
|
|
126
|
+
}
|
|
127
|
+
exports.cacheCompilerHost = cacheCompilerHost;
|
|
128
|
+
function augmentProgramWithVersioning(program) {
|
|
129
|
+
const baseGetSourceFiles = program.getSourceFiles;
|
|
130
|
+
program.getSourceFiles = function (...parameters) {
|
|
131
|
+
const files = baseGetSourceFiles(...parameters);
|
|
132
|
+
for (const file of files) {
|
|
133
|
+
if (file.version === undefined) {
|
|
134
|
+
file.version = (0, crypto_1.createHash)('sha256').update(file.text).digest('hex');
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
return files;
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
exports.augmentProgramWithVersioning = augmentProgramWithVersioning;
|
|
141
|
+
//# sourceMappingURL=cache-compiler-host.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cache-compiler-host.js","sourceRoot":"","sources":["../../../../../../../../packages/angular/src/executors/package/ng-packagr-adjustments/ts/cache-compiler-host.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;;AAGH,mCAAoC;AAGpC,oDAAiD;AACjD,2DAA0E;AAC1E,oDAA2D;AAC3D,6BAA6B;AAC7B,iCAAiC;AAMjC,SAAgB,iBAAiB,CAC/B,KAAiB,EACjB,UAA0B,EAC1B,eAAgC,EAChC,qBAA+C,EAC/C,mBAAyC,EACzC,mBAAyC,EACzC,mBAA8B,UAAU,CAAC,KAAK,CAAC,gBAAgB;IAE/D,MAAM,YAAY,GAAG,EAAE,CAAC,6BAA6B,CAAC,eAAe,CAAC,CAAC;IAEvE,MAAM,OAAO,GAAG,CAAC,QAAgB,EAAE,EAAE;QACnC,MAAM,OAAO,GAAG,IAAA,eAAO,EAAC,IAAA,qBAAc,EAAC,QAAQ,CAAC,CAAC,CAAC;QAClD,IAAI,IAAI,GAAG,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;QAE9B,IAAI,CAAC,IAAI,EAAE;YACT,IAAI,GAAG,IAAI,WAAI,CAAC,OAAO,CAAC,CAAC;YACzB,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;SACjB;QAED,OAAO,IAAI,CAAC;IAC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ACT,kBAAkB,CAAC,GAAG,UAAU,CAAC,CAAC;QAEpC,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE;YACxB,IAAI,IAAI,CAAC,OAAO,KAAK,SAAS,EAAE;gBAC9B,IAAI,CAAC,OAAO,GAAG,IAAA,mBAAU,EAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;aACrE;SACF;QAED,OAAO,KAAK,CAAC;IACf,CAAC,CAAC;AACJ,CAAC;AAdD,oEAcC"}
|
|
@@ -5,13 +5,13 @@ const devkit_1 = require("@nrwl/devkit");
|
|
|
5
5
|
const devkit_2 = require("@nrwl/devkit");
|
|
6
6
|
const linter_1 = require("@nrwl/linter");
|
|
7
7
|
function normalizeOptions(host, schema) {
|
|
8
|
-
var _a, _b, _c, _d, _e;
|
|
8
|
+
var _a, _b, _c, _d, _e, _f;
|
|
9
9
|
// Create a schema with populated default values
|
|
10
10
|
const options = Object.assign({ buildable: false, linter: linter_1.Linter.EsLint, name: '', publishable: false, simpleModuleName: false, skipFormat: false, unitTestRunner: "jest" /* Jest */,
|
|
11
11
|
// Publishable libs cannot use `full` yet, so if its false then use the passed value or default to `full`
|
|
12
12
|
compilationMode: schema.publishable
|
|
13
13
|
? 'partial'
|
|
14
|
-
: (_a = schema.compilationMode) !== null && _a !== void 0 ? _a : 'full' }, schema);
|
|
14
|
+
: (_a = schema.compilationMode) !== null && _a !== void 0 ? _a : 'full', skipModule: (_b = schema.skipModule) !== null && _b !== void 0 ? _b : false }, schema);
|
|
15
15
|
const name = (0, devkit_2.names)(options.name).fileName;
|
|
16
16
|
const projectDirectory = options.directory
|
|
17
17
|
? `${(0, devkit_2.names)(options.directory).fileName}/${name}`
|
|
@@ -28,9 +28,9 @@ function normalizeOptions(host, schema) {
|
|
|
28
28
|
: [];
|
|
29
29
|
const modulePath = `${projectRoot}/src/lib/${fileName}.module.ts`;
|
|
30
30
|
const defaultPrefix = npmScope;
|
|
31
|
-
options.standaloneConfig = (
|
|
31
|
+
options.standaloneConfig = (_c = options.standaloneConfig) !== null && _c !== void 0 ? _c : standaloneAsDefault;
|
|
32
32
|
const importPath = options.importPath || `@${defaultPrefix}/${projectDirectory}`;
|
|
33
|
-
return Object.assign(Object.assign({}, options), { linter: (
|
|
33
|
+
return Object.assign(Object.assign({}, options), { linter: (_d = options.linter) !== null && _d !== void 0 ? _d : linter_1.Linter.EsLint, unitTestRunner: (_e = options.unitTestRunner) !== null && _e !== void 0 ? _e : "jest" /* Jest */, prefix: (_f = options.prefix) !== null && _f !== void 0 ? _f : defaultPrefix, name: projectName, projectRoot, entryFile: 'index', moduleName,
|
|
34
34
|
projectDirectory,
|
|
35
35
|
modulePath,
|
|
36
36
|
parsedTags,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"normalize-options.js","sourceRoot":"","sources":["../../../../../../../packages/angular/src/generators/library/lib/normalize-options.ts"],"names":[],"mappings":";;;AAAA,yCAA2E;AAG3E,yCAAqC;AACrC,yCAAsC;AAGtC,SAAgB,gBAAgB,CAC9B,IAAU,EACV,MAAuB;;IAEvB,gDAAgD;IAChD,MAAM,OAAO,mBACX,SAAS,EAAE,KAAK,EAChB,MAAM,EAAE,eAAM,CAAC,MAAM,EACrB,IAAI,EAAE,EAAE,EACR,WAAW,EAAE,KAAK,EAClB,gBAAgB,EAAE,KAAK,EACvB,UAAU,EAAE,KAAK,EACjB,cAAc;QACd,yGAAyG;QACzG,eAAe,EAAE,MAAM,CAAC,WAAW;YACjC,CAAC,CAAC,SAAS;YACX,CAAC,CAAC,MAAA,MAAM,CAAC,eAAe,mCAAI,MAAM,
|
|
1
|
+
{"version":3,"file":"normalize-options.js","sourceRoot":"","sources":["../../../../../../../packages/angular/src/generators/library/lib/normalize-options.ts"],"names":[],"mappings":";;;AAAA,yCAA2E;AAG3E,yCAAqC;AACrC,yCAAsC;AAGtC,SAAgB,gBAAgB,CAC9B,IAAU,EACV,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