@angular-devkit/core 12.0.0-rc.0 → 12.0.0
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/README.md +36 -34
- package/node/_golden-api.d.ts +1 -1
- package/node/_golden-api.js +1 -1
- package/node/cli-logger.d.ts +7 -0
- package/node/cli-logger.js +4 -6
- package/node/experimental/index.d.ts +2 -2
- package/node/experimental/index.js +3 -3
- package/node/experimental/jobs/index.d.ts +1 -1
- package/node/experimental/jobs/index.js +7 -7
- package/node/experimental/jobs/job-registry.d.ts +1 -1
- package/node/experimental/jobs/job-registry.js +4 -4
- package/node/fs.d.ts +7 -0
- package/node/fs.js +3 -3
- package/node/host.d.ts +2 -2
- package/node/host.js +31 -33
- package/node/index.d.ts +2 -2
- package/node/index.js +1 -1
- package/node/testing/index.d.ts +2 -2
- package/node/testing/index.js +8 -5
- package/package.json +3 -3
- package/src/_golden-api.d.ts +1 -1
- package/src/_golden-api.js +1 -1
- package/src/analytics/api.d.ts +1 -1
- package/src/analytics/api.js +7 -0
- package/src/analytics/forwarder.d.ts +1 -1
- package/src/analytics/forwarder.js +7 -0
- package/src/analytics/index.d.ts +1 -1
- package/src/analytics/index.js +7 -7
- package/src/analytics/logging.d.ts +1 -1
- package/src/analytics/logging.js +7 -0
- package/src/analytics/multi.d.ts +1 -1
- package/src/analytics/multi.js +6 -6
- package/src/analytics/noop.d.ts +1 -1
- package/src/analytics/noop.js +10 -1
- package/src/exception/exception.d.ts +1 -1
- package/src/exception/exception.js +25 -9
- package/src/exception/index.d.ts +1 -1
- package/src/exception/index.js +1 -1
- package/src/experimental/jobs/README.md +133 -112
- package/src/experimental/jobs/api.d.ts +1 -1
- package/src/experimental/jobs/api.js +8 -3
- package/src/experimental/jobs/architecture.md +43 -38
- package/src/experimental/jobs/create-job-handler.d.ts +1 -2
- package/src/experimental/jobs/create-job-handler.js +17 -14
- package/src/experimental/jobs/dispatcher.d.ts +1 -2
- package/src/experimental/jobs/dispatcher.js +7 -0
- package/src/experimental/jobs/exception.d.ts +1 -1
- package/src/experimental/jobs/exception.js +3 -3
- package/src/experimental/jobs/fallback-registry.d.ts +1 -1
- package/src/experimental/jobs/fallback-registry.js +4 -4
- package/src/experimental/jobs/index.d.ts +1 -1
- package/src/experimental/jobs/index.js +7 -7
- package/src/experimental/jobs/simple-registry.d.ts +1 -1
- package/src/experimental/jobs/simple-registry.js +6 -4
- package/src/experimental/jobs/simple-scheduler.d.ts +1 -1
- package/src/experimental/jobs/simple-scheduler.js +38 -29
- package/src/experimental/jobs/strategy.d.ts +7 -0
- package/src/experimental/jobs/strategy.js +10 -9
- package/src/experimental.d.ts +2 -2
- package/src/experimental.js +3 -3
- package/src/index.d.ts +2 -2
- package/src/index.js +7 -7
- package/src/json/index.d.ts +2 -2
- package/src/json/index.js +9 -9
- package/src/json/interface.d.ts +1 -1
- package/src/json/interface.js +7 -0
- package/src/json/parser.d.ts +1 -1
- package/src/json/parser.js +39 -22
- package/src/json/schema/index.d.ts +2 -2
- package/src/json/schema/index.js +9 -9
- package/src/json/schema/interface.d.ts +1 -1
- package/src/json/schema/interface.js +7 -0
- package/src/json/schema/pointer.d.ts +1 -1
- package/src/json/schema/pointer.js +17 -5
- package/src/json/schema/registry.d.ts +1 -1
- package/src/json/schema/registry.js +28 -47
- package/src/json/schema/schema.d.ts +1 -1
- package/src/json/schema/schema.js +3 -3
- package/src/json/schema/transforms.d.ts +1 -1
- package/src/json/schema/transforms.js +14 -13
- package/src/json/schema/utility.d.ts +7 -0
- package/src/json/schema/utility.js +7 -7
- package/src/json/schema/visitor.d.ts +1 -1
- package/src/json/schema/visitor.js +8 -7
- package/src/logger/indent.d.ts +7 -0
- package/src/logger/indent.js +5 -5
- package/src/logger/index.d.ts +1 -1
- package/src/logger/index.js +7 -7
- package/src/logger/level.d.ts +1 -1
- package/src/logger/level.js +7 -0
- package/src/logger/logger.d.ts +1 -1
- package/src/logger/logger.js +13 -6
- package/src/logger/null-logger.d.ts +7 -0
- package/src/logger/null-logger.js +3 -3
- package/src/logger/transform-logger.d.ts +1 -1
- package/src/logger/transform-logger.js +7 -0
- package/src/utils/array.d.ts +1 -1
- package/src/utils/array.js +2 -2
- package/src/utils/index.d.ts +1 -1
- package/src/utils/index.js +7 -7
- package/src/utils/lang.d.ts +1 -1
- package/src/utils/lang.js +3 -3
- package/src/utils/literals.d.ts +1 -1
- package/src/utils/literals.js +15 -8
- package/src/utils/object.d.ts +1 -1
- package/src/utils/object.js +3 -3
- package/src/utils/partially-ordered-set.d.ts +2 -2
- package/src/utils/partially-ordered-set.js +12 -8
- package/src/utils/priority-queue.d.ts +1 -1
- package/src/utils/priority-queue.js +2 -2
- package/src/utils/strings.d.ts +7 -0
- package/src/utils/strings.js +12 -9
- package/src/utils/template.d.ts +1 -1
- package/src/utils/template.js +24 -30
- package/src/virtual-fs/host/alias.d.ts +1 -1
- package/src/virtual-fs/host/alias.js +7 -5
- package/src/virtual-fs/host/buffer.d.ts +1 -1
- package/src/virtual-fs/host/buffer.js +7 -0
- package/src/virtual-fs/host/create.d.ts +7 -0
- package/src/virtual-fs/host/create.js +3 -3
- package/src/virtual-fs/host/empty.d.ts +1 -1
- package/src/virtual-fs/host/empty.js +3 -3
- package/src/virtual-fs/host/index.d.ts +1 -1
- package/src/virtual-fs/host/index.js +1 -1
- package/src/virtual-fs/host/interface.d.ts +1 -1
- package/src/virtual-fs/host/interface.js +7 -0
- package/src/virtual-fs/host/memory.d.ts +1 -1
- package/src/virtual-fs/host/memory.js +32 -20
- package/src/virtual-fs/host/pattern.d.ts +1 -1
- package/src/virtual-fs/host/pattern.js +17 -8
- package/src/virtual-fs/host/record.d.ts +1 -1
- package/src/virtual-fs/host/record.js +45 -28
- package/src/virtual-fs/host/resolver.d.ts +1 -1
- package/src/virtual-fs/host/resolver.js +10 -1
- package/src/virtual-fs/host/safe.d.ts +1 -1
- package/src/virtual-fs/host/safe.js +3 -3
- package/src/virtual-fs/host/scoped.d.ts +1 -1
- package/src/virtual-fs/host/scoped.js +3 -3
- package/src/virtual-fs/host/sync.d.ts +1 -1
- package/src/virtual-fs/host/sync.js +12 -3
- package/src/virtual-fs/host/test.d.ts +1 -1
- package/src/virtual-fs/host/test.js +11 -2
- package/src/virtual-fs/index.d.ts +2 -2
- package/src/virtual-fs/index.js +8 -8
- package/src/virtual-fs/path.d.ts +1 -1
- package/src/virtual-fs/path.js +17 -8
- package/src/workspace/core.d.ts +7 -0
- package/src/workspace/core.js +3 -3
- package/src/workspace/definitions.d.ts +1 -1
- package/src/workspace/definitions.js +7 -0
- package/src/workspace/host.d.ts +1 -1
- package/src/workspace/host.js +3 -3
- package/src/workspace/index.d.ts +1 -1
- package/src/workspace/index.js +7 -7
- package/src/workspace/json/metadata.d.ts +1 -1
- package/src/workspace/json/metadata.js +8 -1
- package/src/workspace/json/reader.d.ts +7 -0
- package/src/workspace/json/reader.js +4 -4
- package/src/workspace/json/utilities.d.ts +1 -1
- package/src/workspace/json/utilities.js +12 -5
- package/src/workspace/json/writer.d.ts +7 -0
- package/src/workspace/json/writer.js +4 -4
package/src/utils/index.js
CHANGED
|
@@ -1,4 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @license
|
|
4
|
+
* Copyright Google LLC All Rights Reserved.
|
|
5
|
+
*
|
|
6
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
7
|
+
* found in the LICENSE file at https://angular.io/license
|
|
8
|
+
*/
|
|
2
9
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
10
|
if (k2 === undefined) k2 = k;
|
|
4
11
|
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
@@ -11,13 +18,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
11
18
|
};
|
|
12
19
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
20
|
exports.strings = exports.tags = void 0;
|
|
14
|
-
/**
|
|
15
|
-
* @license
|
|
16
|
-
* Copyright Google Inc. All Rights Reserved.
|
|
17
|
-
*
|
|
18
|
-
* Use of this source code is governed by an MIT-style license that can be
|
|
19
|
-
* found in the LICENSE file at https://angular.io/license
|
|
20
|
-
*/
|
|
21
21
|
const tags = require("./literals");
|
|
22
22
|
exports.tags = tags;
|
|
23
23
|
const strings = require("./strings");
|
package/src/utils/lang.d.ts
CHANGED
package/src/utils/lang.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/**
|
|
3
3
|
* @license
|
|
4
|
-
* Copyright Google
|
|
4
|
+
* Copyright Google LLC All Rights Reserved.
|
|
5
5
|
*
|
|
6
6
|
* Use of this source code is governed by an MIT-style license that can be
|
|
7
7
|
* found in the LICENSE file at https://angular.io/license
|
|
8
8
|
*/
|
|
9
|
-
// Borrowed from @angular/core
|
|
10
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
10
|
exports.isPromise = void 0;
|
|
11
|
+
// Borrowed from @angular/core
|
|
12
12
|
/**
|
|
13
13
|
* Determine if the argument is shaped like a Promise
|
|
14
14
|
*/
|
|
15
|
-
//
|
|
15
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
16
16
|
function isPromise(obj) {
|
|
17
17
|
// allow any Promise/A+ compliant thenable.
|
|
18
18
|
// It's up to the caller to ensure that obj.then conforms to the spec
|
package/src/utils/literals.d.ts
CHANGED
package/src/utils/literals.js
CHANGED
|
@@ -1,7 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @license
|
|
4
|
+
* Copyright Google LLC All Rights Reserved.
|
|
5
|
+
*
|
|
6
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
7
|
+
* found in the LICENSE file at https://angular.io/license
|
|
8
|
+
*/
|
|
2
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
10
|
exports.trimNewlines = exports.stripIndents = exports.stripIndent = exports.indentBy = exports.oneLine = void 0;
|
|
4
|
-
//
|
|
11
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
5
12
|
function oneLine(strings, ...values) {
|
|
6
13
|
const endResult = String.raw(strings, ...values);
|
|
7
14
|
return endResult.replace(/(?:\r?\n(?:\s*))+/gm, ' ').trim();
|
|
@@ -17,7 +24,7 @@ function indentBy(indentations) {
|
|
|
17
24
|
};
|
|
18
25
|
}
|
|
19
26
|
exports.indentBy = indentBy;
|
|
20
|
-
//
|
|
27
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
21
28
|
function stripIndent(strings, ...values) {
|
|
22
29
|
const endResult = String.raw(strings, ...values);
|
|
23
30
|
// remove the shortest leading indentation from each line
|
|
@@ -26,27 +33,27 @@ function stripIndent(strings, ...values) {
|
|
|
26
33
|
if (match === null) {
|
|
27
34
|
return endResult;
|
|
28
35
|
}
|
|
29
|
-
const indent = Math.min(...match.map(el => el.length));
|
|
36
|
+
const indent = Math.min(...match.map((el) => el.length));
|
|
30
37
|
const regexp = new RegExp('^[ \\t]{' + indent + '}', 'gm');
|
|
31
38
|
return (indent > 0 ? endResult.replace(regexp, '') : endResult).trim();
|
|
32
39
|
}
|
|
33
40
|
exports.stripIndent = stripIndent;
|
|
34
|
-
//
|
|
41
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
35
42
|
function stripIndents(strings, ...values) {
|
|
36
43
|
return String.raw(strings, ...values)
|
|
37
44
|
.split('\n')
|
|
38
|
-
.map(line => line.trim())
|
|
45
|
+
.map((line) => line.trim())
|
|
39
46
|
.join('\n')
|
|
40
47
|
.trim();
|
|
41
48
|
}
|
|
42
49
|
exports.stripIndents = stripIndents;
|
|
43
|
-
//
|
|
50
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
44
51
|
function trimNewlines(strings, ...values) {
|
|
45
52
|
const endResult = String.raw(strings, ...values);
|
|
46
|
-
return endResult
|
|
53
|
+
return (endResult
|
|
47
54
|
// Remove the newline at the start.
|
|
48
55
|
.replace(/^(?:\r?\n)+/, '')
|
|
49
56
|
// Remove the newline at the end and following whitespace.
|
|
50
|
-
.replace(/(?:\r?\n(?:\s*))$/, '');
|
|
57
|
+
.replace(/(?:\r?\n(?:\s*))$/, ''));
|
|
51
58
|
}
|
|
52
59
|
exports.trimNewlines = trimNewlines;
|
package/src/utils/object.d.ts
CHANGED
package/src/utils/object.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/**
|
|
3
3
|
* @license
|
|
4
|
-
* Copyright Google
|
|
4
|
+
* Copyright Google LLC All Rights Reserved.
|
|
5
5
|
*
|
|
6
6
|
* Use of this source code is governed by an MIT-style license that can be
|
|
7
7
|
* found in the LICENSE file at https://angular.io/license
|
|
@@ -17,10 +17,10 @@ function mapObject(obj, mapper) {
|
|
|
17
17
|
}
|
|
18
18
|
exports.mapObject = mapObject;
|
|
19
19
|
const copySymbol = Symbol();
|
|
20
|
-
//
|
|
20
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
21
21
|
function deepCopy(value) {
|
|
22
22
|
if (Array.isArray(value)) {
|
|
23
|
-
//
|
|
23
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
24
24
|
return value.map((o) => deepCopy(o));
|
|
25
25
|
}
|
|
26
26
|
else if (value && typeof value === 'object') {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
|
-
* Copyright Google
|
|
3
|
+
* Copyright Google LLC All Rights Reserved.
|
|
4
4
|
*
|
|
5
5
|
* Use of this source code is governed by an MIT-style license that can be
|
|
6
6
|
* found in the LICENSE file at https://angular.io/license
|
|
@@ -31,7 +31,7 @@ export declare class PartiallyOrderedSet<T> implements Set<T> {
|
|
|
31
31
|
* Returns an iterable of values in the set.
|
|
32
32
|
*/
|
|
33
33
|
values(): IterableIterator<T>;
|
|
34
|
-
add(item: T, deps?:
|
|
34
|
+
add(item: T, deps?: Set<T> | T[]): this;
|
|
35
35
|
delete(item: T): boolean;
|
|
36
36
|
[Symbol.iterator](): Generator<T, void, unknown>;
|
|
37
37
|
get [Symbol.toStringTag](): 'Set';
|
|
@@ -1,20 +1,24 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.PartiallyOrderedSet = exports.CircularDependencyFoundException = exports.DependencyNotFoundException = void 0;
|
|
4
2
|
/**
|
|
5
3
|
* @license
|
|
6
|
-
* Copyright Google
|
|
4
|
+
* Copyright Google LLC All Rights Reserved.
|
|
7
5
|
*
|
|
8
6
|
* Use of this source code is governed by an MIT-style license that can be
|
|
9
7
|
* found in the LICENSE file at https://angular.io/license
|
|
10
8
|
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.PartiallyOrderedSet = exports.CircularDependencyFoundException = exports.DependencyNotFoundException = void 0;
|
|
11
11
|
const exception_1 = require("../exception");
|
|
12
12
|
class DependencyNotFoundException extends exception_1.BaseException {
|
|
13
|
-
constructor() {
|
|
13
|
+
constructor() {
|
|
14
|
+
super('One of the dependencies is not part of the set.');
|
|
15
|
+
}
|
|
14
16
|
}
|
|
15
17
|
exports.DependencyNotFoundException = DependencyNotFoundException;
|
|
16
18
|
class CircularDependencyFoundException extends exception_1.BaseException {
|
|
17
|
-
constructor() {
|
|
19
|
+
constructor() {
|
|
20
|
+
super('Circular dependencies found.');
|
|
21
|
+
}
|
|
18
22
|
}
|
|
19
23
|
exports.CircularDependencyFoundException = CircularDependencyFoundException;
|
|
20
24
|
class PartiallyOrderedSet {
|
|
@@ -25,7 +29,7 @@ class PartiallyOrderedSet {
|
|
|
25
29
|
if (deps.has(item)) {
|
|
26
30
|
throw new CircularDependencyFoundException();
|
|
27
31
|
}
|
|
28
|
-
deps.forEach(dep => this._checkCircularDependencies(item, this._items.get(dep) || new Set()));
|
|
32
|
+
deps.forEach((dep) => this._checkCircularDependencies(item, this._items.get(dep) || new Set()));
|
|
29
33
|
}
|
|
30
34
|
clear() {
|
|
31
35
|
this._items.clear();
|
|
@@ -107,7 +111,7 @@ class PartiallyOrderedSet {
|
|
|
107
111
|
return false;
|
|
108
112
|
}
|
|
109
113
|
// Remove it from all dependencies if force == true.
|
|
110
|
-
this._items.forEach(value => value.delete(item));
|
|
114
|
+
this._items.forEach((value) => value.delete(item));
|
|
111
115
|
return this._items.delete(item);
|
|
112
116
|
}
|
|
113
117
|
*[Symbol.iterator]() {
|
|
@@ -124,7 +128,7 @@ class PartiallyOrderedSet {
|
|
|
124
128
|
}
|
|
125
129
|
}
|
|
126
130
|
for (const item of run) {
|
|
127
|
-
copy.forEach(s => s.delete(item));
|
|
131
|
+
copy.forEach((s) => s.delete(item));
|
|
128
132
|
copy.delete(item);
|
|
129
133
|
yield item;
|
|
130
134
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/**
|
|
3
3
|
* @license
|
|
4
|
-
* Copyright Google
|
|
4
|
+
* Copyright Google LLC All Rights Reserved.
|
|
5
5
|
*
|
|
6
6
|
* Use of this source code is governed by an MIT-style license that can be
|
|
7
7
|
* found in the LICENSE file at https://angular.io/license
|
|
@@ -18,7 +18,7 @@ class PriorityQueue {
|
|
|
18
18
|
this._items = new Array();
|
|
19
19
|
}
|
|
20
20
|
push(item) {
|
|
21
|
-
const index = this._items.findIndex(existing => this._comparator(item, existing) <= 0);
|
|
21
|
+
const index = this._items.findIndex((existing) => this._comparator(item, existing) <= 0);
|
|
22
22
|
if (index === -1) {
|
|
23
23
|
this._items.push(item);
|
|
24
24
|
}
|
package/src/utils/strings.d.ts
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright Google LLC All Rights Reserved.
|
|
4
|
+
*
|
|
5
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
6
|
+
* found in the LICENSE file at https://angular.io/license
|
|
7
|
+
*/
|
|
1
8
|
/**
|
|
2
9
|
* Converts a camelized string into all lower case separated by underscores.
|
|
3
10
|
*
|
package/src/utils/strings.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.levenshtein = exports.capitalize = exports.underscore = exports.classify = exports.camelize = exports.dasherize = exports.decamelize = void 0;
|
|
4
2
|
/**
|
|
5
3
|
* @license
|
|
6
|
-
* Copyright Google
|
|
4
|
+
* Copyright Google LLC All Rights Reserved.
|
|
7
5
|
*
|
|
8
6
|
* Use of this source code is governed by an MIT-style license that can be
|
|
9
7
|
* found in the LICENSE file at https://angular.io/license
|
|
10
8
|
*/
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
const
|
|
14
|
-
const
|
|
15
|
-
const
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.levenshtein = exports.capitalize = exports.underscore = exports.classify = exports.camelize = exports.dasherize = exports.decamelize = void 0;
|
|
11
|
+
const STRING_DASHERIZE_REGEXP = /[ _]/g;
|
|
12
|
+
const STRING_DECAMELIZE_REGEXP = /([a-z\d])([A-Z])/g;
|
|
13
|
+
const STRING_CAMELIZE_REGEXP = /(-|_|\.|\s)+(.)?/g;
|
|
14
|
+
const STRING_UNDERSCORE_REGEXP_1 = /([a-z\d])([A-Z]+)/g;
|
|
15
|
+
const STRING_UNDERSCORE_REGEXP_2 = /-|\s+/g;
|
|
16
16
|
/**
|
|
17
17
|
* Converts a camelized string into all lower case separated by underscores.
|
|
18
18
|
*
|
|
@@ -87,7 +87,10 @@ exports.camelize = camelize;
|
|
|
87
87
|
@return {String} the classified string
|
|
88
88
|
*/
|
|
89
89
|
function classify(str) {
|
|
90
|
-
return str
|
|
90
|
+
return str
|
|
91
|
+
.split('.')
|
|
92
|
+
.map((part) => capitalize(camelize(part)))
|
|
93
|
+
.join('.');
|
|
91
94
|
}
|
|
92
95
|
exports.classify = classify;
|
|
93
96
|
/**
|
package/src/utils/template.d.ts
CHANGED
package/src/utils/template.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.template = exports.templateParser = void 0;
|
|
4
2
|
/**
|
|
5
3
|
* @license
|
|
6
|
-
* Copyright Google
|
|
4
|
+
* Copyright Google LLC All Rights Reserved.
|
|
7
5
|
*
|
|
8
6
|
* Use of this source code is governed by an MIT-style license that can be
|
|
9
7
|
* found in the LICENSE file at https://angular.io/license
|
|
10
8
|
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.template = exports.templateParser = void 0;
|
|
11
11
|
const source_map_1 = require("source-map");
|
|
12
12
|
// Matches <%= expr %>. This does not support structural JavaScript (for/if/...).
|
|
13
13
|
const kInterpolateRe = /<%=([\s\S]+?)%>/g;
|
|
@@ -53,7 +53,7 @@ function templateParser(sourceText, fileName) {
|
|
|
53
53
|
const children = [];
|
|
54
54
|
// Compile the regexp to match each delimiter.
|
|
55
55
|
const reExpressions = [kEscapeRe, kCommentRe, kInterpolateRe, kEvaluateRe];
|
|
56
|
-
const reDelimiters = RegExp(reExpressions.map(x => x.source).join('|') + '|$', 'g');
|
|
56
|
+
const reDelimiters = RegExp(reExpressions.map((x) => x.source).join('|') + '|$', 'g');
|
|
57
57
|
const parsed = sourceText.split(reDelimiters);
|
|
58
58
|
let offset = 0;
|
|
59
59
|
// Optimization that uses the fact that the end of a node is always the beginning of the next
|
|
@@ -112,7 +112,7 @@ exports.templateParser = templateParser;
|
|
|
112
112
|
*/
|
|
113
113
|
function templateFast(ast, options) {
|
|
114
114
|
const module = options && options.module ? 'module.exports.default =' : '';
|
|
115
|
-
const reHtmlEscape = reUnescapedHtml.source.replace(/[']/g, '
|
|
115
|
+
const reHtmlEscape = reUnescapedHtml.source.replace(/[']/g, "\\\\\\'");
|
|
116
116
|
return `
|
|
117
117
|
return ${module} function(obj) {
|
|
118
118
|
obj || (obj = {});
|
|
@@ -125,7 +125,8 @@ function templateFast(ast, options) {
|
|
|
125
125
|
return s ? s.replace(__escapesre, function(key) { return __escapes[key]; }) : '';
|
|
126
126
|
};
|
|
127
127
|
with (obj) {
|
|
128
|
-
${ast.children
|
|
128
|
+
${ast.children
|
|
129
|
+
.map((node) => {
|
|
129
130
|
switch (node.kind) {
|
|
130
131
|
case 'content':
|
|
131
132
|
return `__p += ${JSON.stringify(node.content)};`;
|
|
@@ -136,7 +137,8 @@ function templateFast(ast, options) {
|
|
|
136
137
|
case 'evaluate':
|
|
137
138
|
return node.expression;
|
|
138
139
|
}
|
|
139
|
-
})
|
|
140
|
+
})
|
|
141
|
+
.join('\n')}
|
|
140
142
|
}
|
|
141
143
|
|
|
142
144
|
return __p;
|
|
@@ -149,9 +151,8 @@ function templateFast(ast, options) {
|
|
|
149
151
|
function templateWithSourceMap(ast, options) {
|
|
150
152
|
const sourceUrl = ast.fileName;
|
|
151
153
|
const module = options && options.module ? 'module.exports.default =' : '';
|
|
152
|
-
const reHtmlEscape = reUnescapedHtml.source.replace(/[']/g, '
|
|
153
|
-
const preamble =
|
|
154
|
-
.add(new source_map_1.SourceNode(1, 0, sourceUrl, [
|
|
154
|
+
const reHtmlEscape = reUnescapedHtml.source.replace(/[']/g, "\\\\\\'");
|
|
155
|
+
const preamble = new source_map_1.SourceNode(1, 0, sourceUrl, '').add(new source_map_1.SourceNode(1, 0, sourceUrl, [
|
|
155
156
|
`return ${module} function(obj) {\n`,
|
|
156
157
|
' obj || (obj = {});\n',
|
|
157
158
|
' let __t;\n',
|
|
@@ -167,15 +168,15 @@ function templateWithSourceMap(ast, options) {
|
|
|
167
168
|
const end = ast.children.length
|
|
168
169
|
? ast.children[ast.children.length - 1].end
|
|
169
170
|
: { line: 0, column: 0 };
|
|
170
|
-
const nodes = ast.children
|
|
171
|
+
const nodes = ast.children
|
|
172
|
+
.reduce((chunk, node) => {
|
|
171
173
|
let code = '';
|
|
172
174
|
switch (node.kind) {
|
|
173
175
|
case 'content':
|
|
174
176
|
code = [
|
|
175
177
|
new source_map_1.SourceNode(node.start.line, node.start.column, sourceUrl, '__p = __p'),
|
|
176
178
|
...node.content.split('\n').map((line, i, arr) => {
|
|
177
|
-
return new source_map_1.SourceNode(node.start.line + i, i == 0 ? node.start.column : 0, sourceUrl, '\n + '
|
|
178
|
-
+ JSON.stringify(line + (i == arr.length - 1 ? '' : '\n')));
|
|
179
|
+
return new source_map_1.SourceNode(node.start.line + i, i == 0 ? node.start.column : 0, sourceUrl, '\n + ' + JSON.stringify(line + (i == arr.length - 1 ? '' : '\n')));
|
|
179
180
|
}),
|
|
180
181
|
new source_map_1.SourceNode(node.end.line, node.end.column, sourceUrl, ';\n'),
|
|
181
182
|
];
|
|
@@ -184,7 +185,7 @@ function templateWithSourceMap(ast, options) {
|
|
|
184
185
|
code = [
|
|
185
186
|
new source_map_1.SourceNode(node.start.line, node.start.column, sourceUrl, '__p += ((__t = '),
|
|
186
187
|
...node.expression.split('\n').map((line, i, arr) => {
|
|
187
|
-
return new source_map_1.SourceNode(node.start.line + i, i == 0 ? node.start.column : 0, sourceUrl, line + (
|
|
188
|
+
return new source_map_1.SourceNode(node.start.line + i, i == 0 ? node.start.column : 0, sourceUrl, line + (i == arr.length - 1 ? '' : '\n'));
|
|
188
189
|
}),
|
|
189
190
|
new source_map_1.SourceNode(node.end.line, node.end.column, sourceUrl, ') == null ? "" : __t);\n'),
|
|
190
191
|
];
|
|
@@ -193,7 +194,7 @@ function templateWithSourceMap(ast, options) {
|
|
|
193
194
|
code = [
|
|
194
195
|
new source_map_1.SourceNode(node.start.line, node.start.column, sourceUrl, '__p += __e('),
|
|
195
196
|
...node.expression.split('\n').map((line, i, arr) => {
|
|
196
|
-
return new source_map_1.SourceNode(node.start.line + i, i == 0 ? node.start.column : 0, sourceUrl, line + (
|
|
197
|
+
return new source_map_1.SourceNode(node.start.line + i, i == 0 ? node.start.column : 0, sourceUrl, line + (i == arr.length - 1 ? '' : '\n'));
|
|
197
198
|
}),
|
|
198
199
|
new source_map_1.SourceNode(node.end.line, node.end.column, sourceUrl, ');\n'),
|
|
199
200
|
];
|
|
@@ -201,7 +202,7 @@ function templateWithSourceMap(ast, options) {
|
|
|
201
202
|
case 'evaluate':
|
|
202
203
|
code = [
|
|
203
204
|
...node.expression.split('\n').map((line, i, arr) => {
|
|
204
|
-
return new source_map_1.SourceNode(node.start.line + i, i == 0 ? node.start.column : 0, sourceUrl, line + (
|
|
205
|
+
return new source_map_1.SourceNode(node.start.line + i, i == 0 ? node.start.column : 0, sourceUrl, line + (i == arr.length - 1 ? '' : '\n'));
|
|
205
206
|
}),
|
|
206
207
|
new source_map_1.SourceNode(node.end.line, node.end.column, sourceUrl, '\n'),
|
|
207
208
|
];
|
|
@@ -209,22 +210,17 @@ function templateWithSourceMap(ast, options) {
|
|
|
209
210
|
}
|
|
210
211
|
return chunk.add(new source_map_1.SourceNode(node.start.line, node.start.column, sourceUrl, code));
|
|
211
212
|
}, preamble)
|
|
212
|
-
.add(new source_map_1.SourceNode(end.line, end.column, sourceUrl, [
|
|
213
|
-
' };\n',
|
|
214
|
-
'\n',
|
|
215
|
-
' return __p;\n',
|
|
216
|
-
'}\n',
|
|
217
|
-
]));
|
|
213
|
+
.add(new source_map_1.SourceNode(end.line, end.column, sourceUrl, [' };\n', '\n', ' return __p;\n', '}\n']));
|
|
218
214
|
const code = nodes.toStringWithSourceMap({
|
|
219
215
|
file: sourceUrl,
|
|
220
|
-
sourceRoot: options && options.sourceRoot || '.',
|
|
216
|
+
sourceRoot: (options && options.sourceRoot) || '.',
|
|
221
217
|
});
|
|
222
218
|
// Set the source content in the source map, otherwise the sourceUrl is not enough
|
|
223
219
|
// to find the content.
|
|
224
220
|
code.map.setSourceContent(sourceUrl, ast.content);
|
|
225
|
-
return code.code
|
|
226
|
-
|
|
227
|
-
|
|
221
|
+
return (code.code +
|
|
222
|
+
'\n//# sourceMappingURL=data:application/json;base64,' +
|
|
223
|
+
Buffer.from(code.map.toString()).toString('base64'));
|
|
228
224
|
}
|
|
229
225
|
/**
|
|
230
226
|
* An equivalent of EJS templates, which is based on John Resig's `tmpl` implementation
|
|
@@ -242,7 +238,7 @@ function templateWithSourceMap(ast, options) {
|
|
|
242
238
|
* of the template with the input applied.
|
|
243
239
|
*/
|
|
244
240
|
function template(content, options) {
|
|
245
|
-
const sourceUrl = options && options.sourceURL || 'ejs';
|
|
241
|
+
const sourceUrl = (options && options.sourceURL) || 'ejs';
|
|
246
242
|
const ast = templateParser(content, sourceUrl);
|
|
247
243
|
let source;
|
|
248
244
|
// If there's no need for source map support, we revert back to the fast implementation.
|
|
@@ -256,9 +252,7 @@ function template(content, options) {
|
|
|
256
252
|
// need to only use the source, not the function itself. Otherwise expect a module object to be
|
|
257
253
|
// passed, and we use that one.
|
|
258
254
|
const fn = Function('module', source);
|
|
259
|
-
const module = options && options.module
|
|
260
|
-
? (options.module === true ? { exports: {} } : options.module)
|
|
261
|
-
: null;
|
|
255
|
+
const module = options && options.module ? (options.module === true ? { exports: {} } : options.module) : null;
|
|
262
256
|
const result = fn(module);
|
|
263
257
|
// Provide the compiled function's source by its `toString` method or
|
|
264
258
|
// the `source` property as a convenience for inlining compiled templates.
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.AliasHost = void 0;
|
|
4
2
|
/**
|
|
5
3
|
* @license
|
|
6
|
-
* Copyright Google
|
|
4
|
+
* Copyright Google LLC All Rights Reserved.
|
|
7
5
|
*
|
|
8
6
|
* Use of this source code is governed by an MIT-style license that can be
|
|
9
7
|
* found in the LICENSE file at https://angular.io/license
|
|
10
8
|
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.AliasHost = void 0;
|
|
11
11
|
const path_1 = require("../path");
|
|
12
12
|
const resolver_1 = require("./resolver");
|
|
13
13
|
/**
|
|
@@ -75,10 +75,12 @@ class AliasHost extends resolver_1.ResolverHost {
|
|
|
75
75
|
maybeAlias = path_1.join(maybeAlias, ...remaining);
|
|
76
76
|
}
|
|
77
77
|
// Allow non-null-operator because we know sp.length > 0 (condition on while).
|
|
78
|
-
remaining.unshift(sp.pop()); //
|
|
78
|
+
remaining.unshift(sp.pop()); // eslint-disable-line @typescript-eslint/no-non-null-assertion
|
|
79
79
|
}
|
|
80
80
|
return maybeAlias || path;
|
|
81
81
|
}
|
|
82
|
-
get aliases() {
|
|
82
|
+
get aliases() {
|
|
83
|
+
return this._aliases;
|
|
84
|
+
}
|
|
83
85
|
}
|
|
84
86
|
exports.AliasHost = AliasHost;
|
|
@@ -1,4 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @license
|
|
4
|
+
* Copyright Google LLC All Rights Reserved.
|
|
5
|
+
*
|
|
6
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
7
|
+
* found in the LICENSE file at https://angular.io/license
|
|
8
|
+
*/
|
|
2
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
10
|
exports.fileBufferToString = exports.fileBuffer = exports.stringToFileBuffer = void 0;
|
|
4
11
|
function stringToFileBuffer(str) {
|
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright Google LLC All Rights Reserved.
|
|
4
|
+
*
|
|
5
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
6
|
+
* found in the LICENSE file at https://angular.io/license
|
|
7
|
+
*/
|
|
1
8
|
import { Path, PathFragment } from '../path';
|
|
2
9
|
import { FileBuffer, FileBufferLike, Host, Stats } from './interface';
|
|
3
10
|
export interface SyncHostHandler<StatsT extends object = {}> {
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createSyncHost = void 0;
|
|
4
2
|
/**
|
|
5
3
|
* @license
|
|
6
|
-
* Copyright Google
|
|
4
|
+
* Copyright Google LLC All Rights Reserved.
|
|
7
5
|
*
|
|
8
6
|
* Use of this source code is governed by an MIT-style license that can be
|
|
9
7
|
* found in the LICENSE file at https://angular.io/license
|
|
10
8
|
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.createSyncHost = void 0;
|
|
11
11
|
const rxjs_1 = require("rxjs");
|
|
12
12
|
function wrapAction(action) {
|
|
13
13
|
return new rxjs_1.Observable((subscriber) => {
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Empty = void 0;
|
|
4
2
|
/**
|
|
5
3
|
* @license
|
|
6
|
-
* Copyright Google
|
|
4
|
+
* Copyright Google LLC All Rights Reserved.
|
|
7
5
|
*
|
|
8
6
|
* Use of this source code is governed by an MIT-style license that can be
|
|
9
7
|
* found in the LICENSE file at https://angular.io/license
|
|
10
8
|
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.Empty = void 0;
|
|
11
11
|
const rxjs_1 = require("rxjs");
|
|
12
12
|
const exception_1 = require("../../exception");
|
|
13
13
|
class Empty {
|
|
@@ -1,2 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @license
|
|
4
|
+
* Copyright Google LLC All Rights Reserved.
|
|
5
|
+
*
|
|
6
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
7
|
+
* found in the LICENSE file at https://angular.io/license
|
|
8
|
+
*/
|
|
2
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|