@angular-devkit/core 13.0.0-next.4 → 13.0.0-next.8
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/node/cli-logger.js +1 -1
- package/node/experimental/jobs/job-registry.js +3 -3
- package/node/fs.js +2 -2
- package/node/host.js +41 -41
- package/node/testing/index.js +4 -4
- package/package.json +2 -2
- package/src/experimental/jobs/create-job-handler.js +7 -7
- package/src/experimental/jobs/dispatcher.js +1 -1
- package/src/experimental/jobs/fallback-registry.js +1 -1
- package/src/experimental/jobs/simple-registry.js +3 -3
- package/src/experimental/jobs/simple-scheduler.js +32 -32
- package/src/experimental/jobs/strategy.js +7 -7
- package/src/json/schema/registry.js +13 -13
- package/src/json/schema/schema.js +1 -1
- package/src/json/schema/transforms.js +10 -10
- package/src/json/schema/utility.js +2 -2
- package/src/json/schema/visitor.js +14 -14
- package/src/logger/indent.js +1 -1
- package/src/logger/logger.js +1 -1
- package/src/virtual-fs/host/alias.js +3 -3
- package/src/virtual-fs/host/empty.js +6 -6
- package/src/virtual-fs/host/memory.js +13 -13
- package/src/virtual-fs/host/record.js +27 -27
- package/src/virtual-fs/host/safe.js +4 -4
- package/src/virtual-fs/host/scoped.js +1 -1
- package/src/virtual-fs/host/test.js +9 -9
- package/src/workspace/core.js +5 -5
- package/src/workspace/host.js +4 -4
- package/src/workspace/json/reader.js +7 -7
- package/src/workspace/json/writer.js +1 -1
|
@@ -89,7 +89,7 @@ class CoreSchemaRegistry {
|
|
|
89
89
|
loadSchema: (uri) => this._fetch(uri),
|
|
90
90
|
passContext: true,
|
|
91
91
|
});
|
|
92
|
-
ajv_formats_1.default(this._ajv);
|
|
92
|
+
(0, ajv_formats_1.default)(this._ajv);
|
|
93
93
|
for (const format of formats) {
|
|
94
94
|
this.addFormat(format);
|
|
95
95
|
}
|
|
@@ -105,7 +105,7 @@ class CoreSchemaRegistry {
|
|
|
105
105
|
if (handlerResult === null || handlerResult === undefined) {
|
|
106
106
|
continue;
|
|
107
107
|
}
|
|
108
|
-
if (rxjs_1.isObservable(handlerResult)) {
|
|
108
|
+
if ((0, rxjs_1.isObservable)(handlerResult)) {
|
|
109
109
|
handlerResult = handlerResult.toPromise();
|
|
110
110
|
}
|
|
111
111
|
const value = await handlerResult;
|
|
@@ -193,7 +193,7 @@ class CoreSchemaRegistry {
|
|
|
193
193
|
* See: https://json-schema.org/draft/2019-09/json-schema-core.html#rfc.appendix.B.2
|
|
194
194
|
*/
|
|
195
195
|
flatten(schema) {
|
|
196
|
-
return rxjs_1.from(this._flatten(schema));
|
|
196
|
+
return (0, rxjs_1.from)(this._flatten(schema));
|
|
197
197
|
}
|
|
198
198
|
async _flatten(schema) {
|
|
199
199
|
this._ajv.removeSchema(schema);
|
|
@@ -205,7 +205,7 @@ class CoreSchemaRegistry {
|
|
|
205
205
|
if (current &&
|
|
206
206
|
parentSchema &&
|
|
207
207
|
index &&
|
|
208
|
-
utils_2.isJsonObject(current) &&
|
|
208
|
+
(0, utils_2.isJsonObject)(current) &&
|
|
209
209
|
Object.prototype.hasOwnProperty.call(current, '$ref') &&
|
|
210
210
|
typeof current['$ref'] == 'string') {
|
|
211
211
|
const resolved = self._resolver(current['$ref'], validate);
|
|
@@ -214,8 +214,8 @@ class CoreSchemaRegistry {
|
|
|
214
214
|
}
|
|
215
215
|
}
|
|
216
216
|
}
|
|
217
|
-
const schemaCopy = utils_1.deepCopy(validate.schema);
|
|
218
|
-
visitor_1.visitJsonSchema(schemaCopy, visitor);
|
|
217
|
+
const schemaCopy = (0, utils_1.deepCopy)(validate.schema);
|
|
218
|
+
(0, visitor_1.visitJsonSchema)(schemaCopy, visitor);
|
|
219
219
|
return schemaCopy;
|
|
220
220
|
}
|
|
221
221
|
/**
|
|
@@ -226,7 +226,7 @@ class CoreSchemaRegistry {
|
|
|
226
226
|
* @returns An Observable of the Validation function.
|
|
227
227
|
*/
|
|
228
228
|
compile(schema) {
|
|
229
|
-
return rxjs_1.from(this._compile(schema)).pipe(operators_1.map((validate) => (value, options) => rxjs_1.from(validate(value, options))));
|
|
229
|
+
return (0, rxjs_1.from)(this._compile(schema)).pipe((0, operators_1.map)((validate) => (value, options) => (0, rxjs_1.from)(validate(value, options))));
|
|
230
230
|
}
|
|
231
231
|
async _compile(schema) {
|
|
232
232
|
if (typeof schema === 'boolean') {
|
|
@@ -266,7 +266,7 @@ class CoreSchemaRegistry {
|
|
|
266
266
|
// Apply pre-validation transforms
|
|
267
267
|
if (validationOptions.applyPreTransforms) {
|
|
268
268
|
for (const visitor of this._pre.values()) {
|
|
269
|
-
data = await visitor_1.visitJson(data, visitor, schema, this._resolver.bind(this), validator).toPromise();
|
|
269
|
+
data = await (0, visitor_1.visitJson)(data, visitor, schema, this._resolver.bind(this), validator).toPromise();
|
|
270
270
|
}
|
|
271
271
|
}
|
|
272
272
|
// Apply smart defaults
|
|
@@ -280,7 +280,7 @@ class CoreSchemaRegistry {
|
|
|
280
280
|
return value;
|
|
281
281
|
};
|
|
282
282
|
if (typeof schema === 'object') {
|
|
283
|
-
await visitor_1.visitJson(data, visitor, schema, this._resolver.bind(this), validator).toPromise();
|
|
283
|
+
await (0, visitor_1.visitJson)(data, visitor, schema, this._resolver.bind(this), validator).toPromise();
|
|
284
284
|
}
|
|
285
285
|
const definitions = schemaInfo.promptDefinitions.filter((def) => !validationContext.promptFieldsWithValue.has(def.id));
|
|
286
286
|
if (definitions.length > 0) {
|
|
@@ -303,7 +303,7 @@ class CoreSchemaRegistry {
|
|
|
303
303
|
// Apply post-validation transforms
|
|
304
304
|
if (validationOptions.applyPostTransforms) {
|
|
305
305
|
for (const visitor of this._post.values()) {
|
|
306
|
-
data = await visitor_1.visitJson(data, visitor, schema, this._resolver.bind(this), validator).toPromise();
|
|
306
|
+
data = await (0, visitor_1.visitJson)(data, visitor, schema, this._resolver.bind(this), validator).toPromise();
|
|
307
307
|
}
|
|
308
308
|
}
|
|
309
309
|
return { data, success: true };
|
|
@@ -374,7 +374,7 @@ class CoreSchemaRegistry {
|
|
|
374
374
|
type = schema.type;
|
|
375
375
|
items = schema.items;
|
|
376
376
|
}
|
|
377
|
-
const propertyTypes = utility_1.getTypesOfSchema(parentSchema);
|
|
377
|
+
const propertyTypes = (0, utility_1.getTypesOfSchema)(parentSchema);
|
|
378
378
|
if (!type) {
|
|
379
379
|
if (propertyTypes.size === 1 && propertyTypes.has('boolean')) {
|
|
380
380
|
type = 'confirmation';
|
|
@@ -483,7 +483,7 @@ class CoreSchemaRegistry {
|
|
|
483
483
|
if (!provider) {
|
|
484
484
|
return;
|
|
485
485
|
}
|
|
486
|
-
const answers = await rxjs_1.from(provider(prompts)).toPromise();
|
|
486
|
+
const answers = await (0, rxjs_1.from)(provider(prompts)).toPromise();
|
|
487
487
|
for (const path in answers) {
|
|
488
488
|
const pathFragments = path.split('/').slice(1);
|
|
489
489
|
CoreSchemaRegistry._set(data, pathFragments, answers[path], null, undefined, true);
|
|
@@ -524,7 +524,7 @@ class CoreSchemaRegistry {
|
|
|
524
524
|
continue;
|
|
525
525
|
}
|
|
526
526
|
let value = source(schema);
|
|
527
|
-
if (rxjs_1.isObservable(value)) {
|
|
527
|
+
if ((0, rxjs_1.isObservable)(value)) {
|
|
528
528
|
value = await value.toPromise();
|
|
529
529
|
}
|
|
530
530
|
CoreSchemaRegistry._set(data, fragments, value);
|
|
@@ -10,7 +10,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
10
10
|
exports.mergeSchemas = exports.isJsonSchema = void 0;
|
|
11
11
|
const utils_1 = require("../utils");
|
|
12
12
|
function isJsonSchema(value) {
|
|
13
|
-
return utils_1.isJsonObject(value) || value === false || value === true;
|
|
13
|
+
return (0, utils_1.isJsonObject)(value) || value === false || value === true;
|
|
14
14
|
}
|
|
15
15
|
exports.isJsonSchema = isJsonSchema;
|
|
16
16
|
/**
|
|
@@ -14,7 +14,7 @@ function addUndefinedDefaults(value, _pointer, schema) {
|
|
|
14
14
|
if (typeof schema === 'boolean' || schema === undefined) {
|
|
15
15
|
return value;
|
|
16
16
|
}
|
|
17
|
-
const types = utility_1.getTypesOfSchema(schema);
|
|
17
|
+
const types = (0, utility_1.getTypesOfSchema)(schema);
|
|
18
18
|
if (types.size === 0) {
|
|
19
19
|
return value;
|
|
20
20
|
}
|
|
@@ -47,41 +47,41 @@ function addUndefinedDefaults(value, _pointer, schema) {
|
|
|
47
47
|
if (value == undefined) {
|
|
48
48
|
newValue = {};
|
|
49
49
|
}
|
|
50
|
-
else if (utils_1.isJsonObject(value)) {
|
|
50
|
+
else if ((0, utils_1.isJsonObject)(value)) {
|
|
51
51
|
newValue = value;
|
|
52
52
|
}
|
|
53
53
|
else {
|
|
54
54
|
return value;
|
|
55
55
|
}
|
|
56
|
-
if (!utils_1.isJsonObject(schema.properties)) {
|
|
56
|
+
if (!(0, utils_1.isJsonObject)(schema.properties)) {
|
|
57
57
|
return newValue;
|
|
58
58
|
}
|
|
59
59
|
for (const [propName, schemaObject] of Object.entries(schema.properties)) {
|
|
60
|
-
if (propName === '$schema' || !utils_1.isJsonObject(schemaObject)) {
|
|
60
|
+
if (propName === '$schema' || !(0, utils_1.isJsonObject)(schemaObject)) {
|
|
61
61
|
continue;
|
|
62
62
|
}
|
|
63
63
|
const value = newValue[propName];
|
|
64
64
|
if (value === undefined) {
|
|
65
65
|
newValue[propName] = schemaObject.default;
|
|
66
66
|
}
|
|
67
|
-
else if (utils_1.isJsonObject(value)) {
|
|
67
|
+
else if ((0, utils_1.isJsonObject)(value)) {
|
|
68
68
|
// Basic support for oneOf and anyOf.
|
|
69
69
|
const propertySchemas = schemaObject.oneOf || schemaObject.anyOf;
|
|
70
70
|
const allProperties = Object.keys(value);
|
|
71
71
|
// Locate a schema which declares all the properties that the object contains.
|
|
72
|
-
const adjustedSchema = utils_1.isJsonArray(propertySchemas) &&
|
|
72
|
+
const adjustedSchema = (0, utils_1.isJsonArray)(propertySchemas) &&
|
|
73
73
|
propertySchemas.find((s) => {
|
|
74
|
-
if (!utils_1.isJsonObject(s)) {
|
|
74
|
+
if (!(0, utils_1.isJsonObject)(s)) {
|
|
75
75
|
return false;
|
|
76
76
|
}
|
|
77
|
-
const schemaType = utility_1.getTypesOfSchema(s);
|
|
78
|
-
if (schemaType.size === 1 && schemaType.has('object') && utils_1.isJsonObject(s.properties)) {
|
|
77
|
+
const schemaType = (0, utility_1.getTypesOfSchema)(s);
|
|
78
|
+
if (schemaType.size === 1 && schemaType.has('object') && (0, utils_1.isJsonObject)(s.properties)) {
|
|
79
79
|
const properties = Object.keys(s.properties);
|
|
80
80
|
return allProperties.every((key) => properties.includes(key));
|
|
81
81
|
}
|
|
82
82
|
return false;
|
|
83
83
|
});
|
|
84
|
-
if (adjustedSchema && utils_1.isJsonObject(adjustedSchema)) {
|
|
84
|
+
if (adjustedSchema && (0, utils_1.isJsonObject)(adjustedSchema)) {
|
|
85
85
|
newValue[propName] = addUndefinedDefaults(value, _pointer, adjustedSchema);
|
|
86
86
|
}
|
|
87
87
|
}
|
|
@@ -24,7 +24,7 @@ function getTypesOfSchema(schema) {
|
|
|
24
24
|
else if (Array.isArray(schema.type)) {
|
|
25
25
|
potentials = new Set(schema.type);
|
|
26
26
|
}
|
|
27
|
-
else if (utils_1.isJsonArray(schema.enum)) {
|
|
27
|
+
else if ((0, utils_1.isJsonArray)(schema.enum)) {
|
|
28
28
|
potentials = new Set();
|
|
29
29
|
// Gather the type of each enum values, and use that as a starter for potential types.
|
|
30
30
|
for (const v of schema.enum) {
|
|
@@ -51,7 +51,7 @@ function getTypesOfSchema(schema) {
|
|
|
51
51
|
else {
|
|
52
52
|
potentials = new Set(allTypes);
|
|
53
53
|
}
|
|
54
|
-
if (utils_1.isJsonObject(schema.not)) {
|
|
54
|
+
if ((0, utils_1.isJsonObject)(schema.not)) {
|
|
55
55
|
const notTypes = getTypesOfSchema(schema.not);
|
|
56
56
|
potentials = new Set([...potentials].filter((p) => !notTypes.has(p)));
|
|
57
57
|
}
|
|
@@ -46,24 +46,24 @@ function _visitJsonRecursive(json, visitor, ptr, schema, refResolver, context, r
|
|
|
46
46
|
}
|
|
47
47
|
}
|
|
48
48
|
const value = visitor(json, ptr, schema, root);
|
|
49
|
-
return (rxjs_1.isObservable(value) ? value : rxjs_1.of(value)).pipe(operators_1.concatMap((value) => {
|
|
49
|
+
return ((0, rxjs_1.isObservable)(value) ? value : (0, rxjs_1.of)(value)).pipe((0, operators_1.concatMap)((value) => {
|
|
50
50
|
if (Array.isArray(value)) {
|
|
51
|
-
return rxjs_1.concat(rxjs_1.from(value).pipe(operators_1.mergeMap((item, i) => {
|
|
52
|
-
return _visitJsonRecursive(item, visitor, pointer_1.joinJsonPointer(ptr, '' + i), _getObjectSubSchema(schema, '' + i), refResolver, context, root || value).pipe(operators_1.tap((x) => (value[i] = x)));
|
|
53
|
-
}), operators_1.ignoreElements()), rxjs_1.of(value));
|
|
51
|
+
return (0, rxjs_1.concat)((0, rxjs_1.from)(value).pipe((0, operators_1.mergeMap)((item, i) => {
|
|
52
|
+
return _visitJsonRecursive(item, visitor, (0, pointer_1.joinJsonPointer)(ptr, '' + i), _getObjectSubSchema(schema, '' + i), refResolver, context, root || value).pipe((0, operators_1.tap)((x) => (value[i] = x)));
|
|
53
|
+
}), (0, operators_1.ignoreElements)()), (0, rxjs_1.of)(value));
|
|
54
54
|
}
|
|
55
55
|
else if (typeof value == 'object' && value !== null) {
|
|
56
|
-
return rxjs_1.concat(rxjs_1.from(Object.getOwnPropertyNames(value)).pipe(operators_1.mergeMap((key) => {
|
|
57
|
-
return _visitJsonRecursive(value[key], visitor, pointer_1.joinJsonPointer(ptr, key), _getObjectSubSchema(schema, key), refResolver, context, root || value).pipe(operators_1.tap((x) => {
|
|
56
|
+
return (0, rxjs_1.concat)((0, rxjs_1.from)(Object.getOwnPropertyNames(value)).pipe((0, operators_1.mergeMap)((key) => {
|
|
57
|
+
return _visitJsonRecursive(value[key], visitor, (0, pointer_1.joinJsonPointer)(ptr, key), _getObjectSubSchema(schema, key), refResolver, context, root || value).pipe((0, operators_1.tap)((x) => {
|
|
58
58
|
const descriptor = Object.getOwnPropertyDescriptor(value, key);
|
|
59
59
|
if (descriptor && descriptor.writable && value[key] !== x) {
|
|
60
60
|
value[key] = x;
|
|
61
61
|
}
|
|
62
62
|
}));
|
|
63
|
-
}), operators_1.ignoreElements()), rxjs_1.of(value));
|
|
63
|
+
}), (0, operators_1.ignoreElements)()), (0, rxjs_1.of)(value));
|
|
64
64
|
}
|
|
65
65
|
else {
|
|
66
|
-
return rxjs_1.of(value);
|
|
66
|
+
return (0, rxjs_1.of)(value);
|
|
67
67
|
}
|
|
68
68
|
}));
|
|
69
69
|
}
|
|
@@ -83,7 +83,7 @@ function _visitJsonRecursive(json, visitor, ptr, schema, refResolver, context, r
|
|
|
83
83
|
* @returns {Observable< | undefined>} The observable of the new root, if the root changed.
|
|
84
84
|
*/
|
|
85
85
|
function visitJson(json, visitor, schema, refResolver, context) {
|
|
86
|
-
return _visitJsonRecursive(json, visitor, pointer_1.buildJsonPointer([]), schema, refResolver, context);
|
|
86
|
+
return _visitJsonRecursive(json, visitor, (0, pointer_1.buildJsonPointer)([]), schema, refResolver, context);
|
|
87
87
|
}
|
|
88
88
|
exports.visitJson = visitJson;
|
|
89
89
|
function visitJsonSchema(schema, visitor) {
|
|
@@ -121,28 +121,28 @@ function visitJsonSchema(schema, visitor) {
|
|
|
121
121
|
if (key in propsKeywords) {
|
|
122
122
|
if (sch && typeof sch == 'object') {
|
|
123
123
|
for (const prop of Object.keys(sch)) {
|
|
124
|
-
_traverse(sch[prop], pointer_1.joinJsonPointer(jsonPtr, key, prop), rootSchema, schema, prop);
|
|
124
|
+
_traverse(sch[prop], (0, pointer_1.joinJsonPointer)(jsonPtr, key, prop), rootSchema, schema, prop);
|
|
125
125
|
}
|
|
126
126
|
}
|
|
127
127
|
}
|
|
128
128
|
else if (key in keywords) {
|
|
129
|
-
_traverse(sch, pointer_1.joinJsonPointer(jsonPtr, key), rootSchema, schema, key);
|
|
129
|
+
_traverse(sch, (0, pointer_1.joinJsonPointer)(jsonPtr, key), rootSchema, schema, key);
|
|
130
130
|
}
|
|
131
131
|
else if (key in arrayKeywords) {
|
|
132
132
|
if (Array.isArray(sch)) {
|
|
133
133
|
for (let i = 0; i < sch.length; i++) {
|
|
134
|
-
_traverse(sch[i], pointer_1.joinJsonPointer(jsonPtr, key, '' + i), rootSchema, sch, '' + i);
|
|
134
|
+
_traverse(sch[i], (0, pointer_1.joinJsonPointer)(jsonPtr, key, '' + i), rootSchema, sch, '' + i);
|
|
135
135
|
}
|
|
136
136
|
}
|
|
137
137
|
}
|
|
138
138
|
else if (Array.isArray(sch)) {
|
|
139
139
|
for (let i = 0; i < sch.length; i++) {
|
|
140
|
-
_traverse(sch[i], pointer_1.joinJsonPointer(jsonPtr, key, '' + i), rootSchema, sch, '' + i);
|
|
140
|
+
_traverse(sch[i], (0, pointer_1.joinJsonPointer)(jsonPtr, key, '' + i), rootSchema, sch, '' + i);
|
|
141
141
|
}
|
|
142
142
|
}
|
|
143
143
|
}
|
|
144
144
|
}
|
|
145
145
|
}
|
|
146
|
-
_traverse(schema, pointer_1.buildJsonPointer([]), schema);
|
|
146
|
+
_traverse(schema, (0, pointer_1.buildJsonPointer)([]), schema);
|
|
147
147
|
}
|
|
148
148
|
exports.visitJsonSchema = visitJsonSchema;
|
package/src/logger/indent.js
CHANGED
|
@@ -23,7 +23,7 @@ class IndentLogger extends logger_1.Logger {
|
|
|
23
23
|
super(name, parent);
|
|
24
24
|
indentationMap[indentation] = indentationMap[indentation] || [''];
|
|
25
25
|
const indentMap = indentationMap[indentation];
|
|
26
|
-
this._observable = this._observable.pipe(operators_1.map((entry) => {
|
|
26
|
+
this._observable = this._observable.pipe((0, operators_1.map)((entry) => {
|
|
27
27
|
const l = entry.path.filter((x) => !!x).length;
|
|
28
28
|
if (l >= indentMap.length) {
|
|
29
29
|
let current = indentMap[indentMap.length - 1];
|
package/src/logger/logger.js
CHANGED
|
@@ -15,7 +15,7 @@ class Logger extends rxjs_1.Observable {
|
|
|
15
15
|
this.name = name;
|
|
16
16
|
this.parent = parent;
|
|
17
17
|
this._subject = new rxjs_1.Subject();
|
|
18
|
-
this._obs = rxjs_1.empty();
|
|
18
|
+
this._obs = (0, rxjs_1.empty)();
|
|
19
19
|
this._subscription = null;
|
|
20
20
|
const path = [];
|
|
21
21
|
let p = parent;
|
|
@@ -63,16 +63,16 @@ class AliasHost extends resolver_1.ResolverHost {
|
|
|
63
63
|
}
|
|
64
64
|
_resolve(path) {
|
|
65
65
|
let maybeAlias = this._aliases.get(path);
|
|
66
|
-
const sp = path_1.split(path);
|
|
66
|
+
const sp = (0, path_1.split)(path);
|
|
67
67
|
const remaining = [];
|
|
68
68
|
// Also resolve all parents of the requested files, only picking the first one that matches.
|
|
69
69
|
// This can have surprising behaviour when aliases are inside another alias. It will always
|
|
70
70
|
// use the closest one to the file.
|
|
71
71
|
while (!maybeAlias && sp.length > 0) {
|
|
72
|
-
const p = path_1.join(path_1.NormalizedRoot, ...sp);
|
|
72
|
+
const p = (0, path_1.join)(path_1.NormalizedRoot, ...sp);
|
|
73
73
|
maybeAlias = this._aliases.get(p);
|
|
74
74
|
if (maybeAlias) {
|
|
75
|
-
maybeAlias = path_1.join(maybeAlias, ...remaining);
|
|
75
|
+
maybeAlias = (0, path_1.join)(maybeAlias, ...remaining);
|
|
76
76
|
}
|
|
77
77
|
// Allow non-null-operator because we know sp.length > 0 (condition on while).
|
|
78
78
|
remaining.unshift(sp.pop()); // eslint-disable-line @typescript-eslint/no-non-null-assertion
|
|
@@ -17,23 +17,23 @@ class Empty {
|
|
|
17
17
|
};
|
|
18
18
|
}
|
|
19
19
|
read(path) {
|
|
20
|
-
return rxjs_1.throwError(new exception_1.FileDoesNotExistException(path));
|
|
20
|
+
return (0, rxjs_1.throwError)(new exception_1.FileDoesNotExistException(path));
|
|
21
21
|
}
|
|
22
22
|
list(path) {
|
|
23
|
-
return rxjs_1.of([]);
|
|
23
|
+
return (0, rxjs_1.of)([]);
|
|
24
24
|
}
|
|
25
25
|
exists(path) {
|
|
26
|
-
return rxjs_1.of(false);
|
|
26
|
+
return (0, rxjs_1.of)(false);
|
|
27
27
|
}
|
|
28
28
|
isDirectory(path) {
|
|
29
|
-
return rxjs_1.of(false);
|
|
29
|
+
return (0, rxjs_1.of)(false);
|
|
30
30
|
}
|
|
31
31
|
isFile(path) {
|
|
32
|
-
return rxjs_1.of(false);
|
|
32
|
+
return (0, rxjs_1.of)(false);
|
|
33
33
|
}
|
|
34
34
|
stat(path) {
|
|
35
35
|
// We support stat() but have no file.
|
|
36
|
-
return rxjs_1.of(null);
|
|
36
|
+
return (0, rxjs_1.of)(null);
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
39
|
exports.Empty = Empty;
|
|
@@ -15,7 +15,7 @@ class SimpleMemoryHost {
|
|
|
15
15
|
constructor() {
|
|
16
16
|
this._cache = new Map();
|
|
17
17
|
this._watchers = new Map();
|
|
18
|
-
this._cache.set(path_1.normalize('/'), this._newDirStats());
|
|
18
|
+
this._cache.set((0, path_1.normalize)('/'), this._newDirStats());
|
|
19
19
|
}
|
|
20
20
|
_newDirStats() {
|
|
21
21
|
return {
|
|
@@ -56,7 +56,7 @@ class SimpleMemoryHost {
|
|
|
56
56
|
};
|
|
57
57
|
}
|
|
58
58
|
_toAbsolute(path) {
|
|
59
|
-
return path_1.isAbsolute(path) ? path : path_1.normalize('/' + path);
|
|
59
|
+
return (0, path_1.isAbsolute)(path) ? path : (0, path_1.normalize)('/' + path);
|
|
60
60
|
}
|
|
61
61
|
_updateWatchers(path, type) {
|
|
62
62
|
const time = new Date();
|
|
@@ -79,7 +79,7 @@ class SimpleMemoryHost {
|
|
|
79
79
|
}
|
|
80
80
|
do {
|
|
81
81
|
currentPath = parent !== null ? parent : currentPath;
|
|
82
|
-
parent = path_1.dirname(currentPath);
|
|
82
|
+
parent = (0, path_1.dirname)(currentPath);
|
|
83
83
|
const maybeWatcher = this._watchers.get(currentPath);
|
|
84
84
|
if (maybeWatcher) {
|
|
85
85
|
maybeWatcher.forEach((watcher) => {
|
|
@@ -110,10 +110,10 @@ class SimpleMemoryHost {
|
|
|
110
110
|
throw new exception_1.PathIsDirectoryException(path);
|
|
111
111
|
}
|
|
112
112
|
// Update all directories. If we find a file we know it's an invalid write.
|
|
113
|
-
const fragments = path_1.split(path);
|
|
114
|
-
let curr = path_1.normalize('/');
|
|
113
|
+
const fragments = (0, path_1.split)(path);
|
|
114
|
+
let curr = (0, path_1.normalize)('/');
|
|
115
115
|
for (const fr of fragments) {
|
|
116
|
-
curr = path_1.join(curr, fr);
|
|
116
|
+
curr = (0, path_1.join)(curr, fr);
|
|
117
117
|
const maybeStats = this._cache.get(fr);
|
|
118
118
|
if (maybeStats) {
|
|
119
119
|
if (maybeStats.isFile()) {
|
|
@@ -174,7 +174,7 @@ class SimpleMemoryHost {
|
|
|
174
174
|
const content = this._cache.get(path);
|
|
175
175
|
if (content) {
|
|
176
176
|
// We don't need to clone or extract the content, since we're moving files.
|
|
177
|
-
this._cache.set(path_1.join(to, path_1.NormalizedSep, path.slice(from.length)), content);
|
|
177
|
+
this._cache.set((0, path_1.join)(to, path_1.NormalizedSep, path.slice(from.length)), content);
|
|
178
178
|
}
|
|
179
179
|
}
|
|
180
180
|
}
|
|
@@ -182,11 +182,11 @@ class SimpleMemoryHost {
|
|
|
182
182
|
else {
|
|
183
183
|
const content = this._cache.get(from);
|
|
184
184
|
if (content) {
|
|
185
|
-
const fragments = path_1.split(to);
|
|
185
|
+
const fragments = (0, path_1.split)(to);
|
|
186
186
|
const newDirectories = [];
|
|
187
|
-
let curr = path_1.normalize('/');
|
|
187
|
+
let curr = (0, path_1.normalize)('/');
|
|
188
188
|
for (const fr of fragments) {
|
|
189
|
-
curr = path_1.join(curr, fr);
|
|
189
|
+
curr = (0, path_1.join)(curr, fr);
|
|
190
190
|
const maybeStats = this._cache.get(fr);
|
|
191
191
|
if (maybeStats) {
|
|
192
192
|
if (maybeStats.isFile()) {
|
|
@@ -211,19 +211,19 @@ class SimpleMemoryHost {
|
|
|
211
211
|
if (this._isFile(path)) {
|
|
212
212
|
throw new exception_1.PathIsFileException(path);
|
|
213
213
|
}
|
|
214
|
-
const fragments = path_1.split(path);
|
|
214
|
+
const fragments = (0, path_1.split)(path);
|
|
215
215
|
const result = new Set();
|
|
216
216
|
if (path !== path_1.NormalizedRoot) {
|
|
217
217
|
for (const p of this._cache.keys()) {
|
|
218
218
|
if (p.startsWith(path + path_1.NormalizedSep)) {
|
|
219
|
-
result.add(path_1.split(p)[fragments.length]);
|
|
219
|
+
result.add((0, path_1.split)(p)[fragments.length]);
|
|
220
220
|
}
|
|
221
221
|
}
|
|
222
222
|
}
|
|
223
223
|
else {
|
|
224
224
|
for (const p of this._cache.keys()) {
|
|
225
225
|
if (p.startsWith(path_1.NormalizedSep) && p !== path_1.NormalizedRoot) {
|
|
226
|
-
result.add(path_1.split(p)[1]);
|
|
226
|
+
result.add((0, path_1.split)(p)[1]);
|
|
227
227
|
}
|
|
228
228
|
}
|
|
229
229
|
}
|
|
@@ -66,32 +66,32 @@ class CordHost extends memory_1.SimpleMemoryHost {
|
|
|
66
66
|
*/
|
|
67
67
|
commit(host, force = false) {
|
|
68
68
|
// Really commit everything to the actual host.
|
|
69
|
-
return rxjs_1.from(this.records()).pipe(operators_1.concatMap((record) => {
|
|
69
|
+
return (0, rxjs_1.from)(this.records()).pipe((0, operators_1.concatMap)((record) => {
|
|
70
70
|
switch (record.kind) {
|
|
71
71
|
case 'delete':
|
|
72
72
|
return host.delete(record.path);
|
|
73
73
|
case 'rename':
|
|
74
74
|
return host.rename(record.from, record.to);
|
|
75
75
|
case 'create':
|
|
76
|
-
return host.exists(record.path).pipe(operators_1.switchMap((exists) => {
|
|
76
|
+
return host.exists(record.path).pipe((0, operators_1.switchMap)((exists) => {
|
|
77
77
|
if (exists && !force) {
|
|
78
|
-
return rxjs_1.throwError(new exception_1.FileAlreadyExistException(record.path));
|
|
78
|
+
return (0, rxjs_1.throwError)(new exception_1.FileAlreadyExistException(record.path));
|
|
79
79
|
}
|
|
80
80
|
else {
|
|
81
81
|
return host.write(record.path, record.content);
|
|
82
82
|
}
|
|
83
83
|
}));
|
|
84
84
|
case 'overwrite':
|
|
85
|
-
return host.exists(record.path).pipe(operators_1.switchMap((exists) => {
|
|
85
|
+
return host.exists(record.path).pipe((0, operators_1.switchMap)((exists) => {
|
|
86
86
|
if (!exists && !force) {
|
|
87
|
-
return rxjs_1.throwError(new exception_1.FileDoesNotExistException(record.path));
|
|
87
|
+
return (0, rxjs_1.throwError)(new exception_1.FileDoesNotExistException(record.path));
|
|
88
88
|
}
|
|
89
89
|
else {
|
|
90
90
|
return host.write(record.path, record.content);
|
|
91
91
|
}
|
|
92
92
|
}));
|
|
93
93
|
}
|
|
94
|
-
}), operators_1.reduce(() => { }));
|
|
94
|
+
}), (0, operators_1.reduce)(() => { }));
|
|
95
95
|
}
|
|
96
96
|
records() {
|
|
97
97
|
return [
|
|
@@ -137,14 +137,14 @@ class CordHost extends memory_1.SimpleMemoryHost {
|
|
|
137
137
|
return super.write(path, content);
|
|
138
138
|
}
|
|
139
139
|
overwrite(path, content) {
|
|
140
|
-
return this.isDirectory(path).pipe(operators_1.switchMap((isDir) => {
|
|
140
|
+
return this.isDirectory(path).pipe((0, operators_1.switchMap)((isDir) => {
|
|
141
141
|
if (isDir) {
|
|
142
|
-
return rxjs_1.throwError(new exception_1.PathIsDirectoryException(path));
|
|
142
|
+
return (0, rxjs_1.throwError)(new exception_1.PathIsDirectoryException(path));
|
|
143
143
|
}
|
|
144
144
|
return this.exists(path);
|
|
145
|
-
}), operators_1.switchMap((exists) => {
|
|
145
|
+
}), (0, operators_1.switchMap)((exists) => {
|
|
146
146
|
if (!exists) {
|
|
147
|
-
return rxjs_1.throwError(new exception_1.FileDoesNotExistException(path));
|
|
147
|
+
return (0, rxjs_1.throwError)(new exception_1.FileDoesNotExistException(path));
|
|
148
148
|
}
|
|
149
149
|
if (!this._filesToCreate.has(path)) {
|
|
150
150
|
this._filesToOverwrite.add(path);
|
|
@@ -153,7 +153,7 @@ class CordHost extends memory_1.SimpleMemoryHost {
|
|
|
153
153
|
}));
|
|
154
154
|
}
|
|
155
155
|
write(path, content) {
|
|
156
|
-
return this.exists(path).pipe(operators_1.switchMap((exists) => {
|
|
156
|
+
return this.exists(path).pipe((0, operators_1.switchMap)((exists) => {
|
|
157
157
|
if (exists) {
|
|
158
158
|
// It exists, but might be being renamed or deleted. In that case we want to create it.
|
|
159
159
|
if (this.willRename(path) || this.willDelete(path)) {
|
|
@@ -191,33 +191,33 @@ class CordHost extends memory_1.SimpleMemoryHost {
|
|
|
191
191
|
this._filesToDelete.add(maybeOrigin);
|
|
192
192
|
}
|
|
193
193
|
else {
|
|
194
|
-
return rxjs_1.throwError(new exception_1.UnknownException(`This should never happen. Path: ${JSON.stringify(path)}.`));
|
|
194
|
+
return (0, rxjs_1.throwError)(new exception_1.UnknownException(`This should never happen. Path: ${JSON.stringify(path)}.`));
|
|
195
195
|
}
|
|
196
196
|
}
|
|
197
197
|
return super.delete(path);
|
|
198
198
|
}
|
|
199
199
|
else {
|
|
200
|
-
return this._back.exists(path).pipe(operators_1.switchMap((exists) => {
|
|
200
|
+
return this._back.exists(path).pipe((0, operators_1.switchMap)((exists) => {
|
|
201
201
|
if (exists) {
|
|
202
202
|
this._filesToDelete.add(path);
|
|
203
|
-
return rxjs_1.of();
|
|
203
|
+
return (0, rxjs_1.of)();
|
|
204
204
|
}
|
|
205
205
|
else {
|
|
206
|
-
return rxjs_1.throwError(new exception_1.FileDoesNotExistException(path));
|
|
206
|
+
return (0, rxjs_1.throwError)(new exception_1.FileDoesNotExistException(path));
|
|
207
207
|
}
|
|
208
208
|
}));
|
|
209
209
|
}
|
|
210
210
|
}
|
|
211
211
|
rename(from, to) {
|
|
212
|
-
return rxjs_1.concat(this.exists(to), this.exists(from)).pipe(operators_1.toArray(), operators_1.switchMap(([existTo, existFrom]) => {
|
|
212
|
+
return (0, rxjs_1.concat)(this.exists(to), this.exists(from)).pipe((0, operators_1.toArray)(), (0, operators_1.switchMap)(([existTo, existFrom]) => {
|
|
213
213
|
if (!existFrom) {
|
|
214
|
-
return rxjs_1.throwError(new exception_1.FileDoesNotExistException(from));
|
|
214
|
+
return (0, rxjs_1.throwError)(new exception_1.FileDoesNotExistException(from));
|
|
215
215
|
}
|
|
216
216
|
if (from === to) {
|
|
217
217
|
return rxjs_1.EMPTY;
|
|
218
218
|
}
|
|
219
219
|
if (existTo) {
|
|
220
|
-
return rxjs_1.throwError(new exception_1.FileAlreadyExistException(to));
|
|
220
|
+
return (0, rxjs_1.throwError)(new exception_1.FileAlreadyExistException(to));
|
|
221
221
|
}
|
|
222
222
|
// If we're renaming a file that's been created, shortcircuit to creating the `to` path.
|
|
223
223
|
if (this._filesToCreate.has(from)) {
|
|
@@ -229,7 +229,7 @@ class CordHost extends memory_1.SimpleMemoryHost {
|
|
|
229
229
|
this._filesToOverwrite.delete(from);
|
|
230
230
|
// Recursively call this function. This is so we don't repeat the bottom logic. This
|
|
231
231
|
// if will be by-passed because we just deleted the `from` path from files to overwrite.
|
|
232
|
-
return rxjs_1.concat(this.rename(from, to), new rxjs_1.Observable((x) => {
|
|
232
|
+
return (0, rxjs_1.concat)(this.rename(from, to), new rxjs_1.Observable((x) => {
|
|
233
233
|
this._filesToOverwrite.add(to);
|
|
234
234
|
x.complete();
|
|
235
235
|
}));
|
|
@@ -239,7 +239,7 @@ class CordHost extends memory_1.SimpleMemoryHost {
|
|
|
239
239
|
this._filesToDelete.add(from);
|
|
240
240
|
this._filesToOverwrite.add(to);
|
|
241
241
|
// We need to delete the original and write the new one.
|
|
242
|
-
return this.read(from).pipe(operators_1.map((content) => this._write(to, content)));
|
|
242
|
+
return this.read(from).pipe((0, operators_1.map)((content) => this._write(to, content)));
|
|
243
243
|
}
|
|
244
244
|
const maybeTo1 = this._filesToRenameRevert.get(from);
|
|
245
245
|
if (maybeTo1) {
|
|
@@ -257,21 +257,21 @@ class CordHost extends memory_1.SimpleMemoryHost {
|
|
|
257
257
|
}
|
|
258
258
|
else {
|
|
259
259
|
// Create a file with the same content.
|
|
260
|
-
return this._back.read(from).pipe(operators_1.switchMap((content) => super.write(to, content)));
|
|
260
|
+
return this._back.read(from).pipe((0, operators_1.switchMap)((content) => super.write(to, content)));
|
|
261
261
|
}
|
|
262
262
|
}));
|
|
263
263
|
}
|
|
264
264
|
list(path) {
|
|
265
|
-
return rxjs_1.concat(super.list(path), this._back.list(path)).pipe(operators_1.reduce((list, curr) => {
|
|
265
|
+
return (0, rxjs_1.concat)(super.list(path), this._back.list(path)).pipe((0, operators_1.reduce)((list, curr) => {
|
|
266
266
|
curr.forEach((elem) => list.add(elem));
|
|
267
267
|
return list;
|
|
268
|
-
}, new Set()), operators_1.map((set) => [...set]));
|
|
268
|
+
}, new Set()), (0, operators_1.map)((set) => [...set]));
|
|
269
269
|
}
|
|
270
270
|
exists(path) {
|
|
271
271
|
return this._exists(path)
|
|
272
|
-
? rxjs_1.of(true)
|
|
272
|
+
? (0, rxjs_1.of)(true)
|
|
273
273
|
: this.willDelete(path) || this.willRename(path)
|
|
274
|
-
? rxjs_1.of(false)
|
|
274
|
+
? (0, rxjs_1.of)(false)
|
|
275
275
|
: this._back.exists(path);
|
|
276
276
|
}
|
|
277
277
|
isDirectory(path) {
|
|
@@ -281,14 +281,14 @@ class CordHost extends memory_1.SimpleMemoryHost {
|
|
|
281
281
|
return this._exists(path)
|
|
282
282
|
? super.isFile(path)
|
|
283
283
|
: this.willDelete(path) || this.willRename(path)
|
|
284
|
-
? rxjs_1.of(false)
|
|
284
|
+
? (0, rxjs_1.of)(false)
|
|
285
285
|
: this._back.isFile(path);
|
|
286
286
|
}
|
|
287
287
|
stat(path) {
|
|
288
288
|
return this._exists(path)
|
|
289
289
|
? super.stat(path)
|
|
290
290
|
: this.willDelete(path) || this.willRename(path)
|
|
291
|
-
? rxjs_1.of(null)
|
|
291
|
+
? (0, rxjs_1.of)(null)
|
|
292
292
|
: this._back.stat(path);
|
|
293
293
|
}
|
|
294
294
|
watch(path, options) {
|
|
@@ -25,21 +25,21 @@ class SafeReadonlyHost {
|
|
|
25
25
|
return this._delegate.read(path);
|
|
26
26
|
}
|
|
27
27
|
list(path) {
|
|
28
|
-
return this._delegate.list(path).pipe(operators_1.catchError(() => rxjs_1.of([])));
|
|
28
|
+
return this._delegate.list(path).pipe((0, operators_1.catchError)(() => (0, rxjs_1.of)([])));
|
|
29
29
|
}
|
|
30
30
|
exists(path) {
|
|
31
31
|
return this._delegate.exists(path);
|
|
32
32
|
}
|
|
33
33
|
isDirectory(path) {
|
|
34
|
-
return this._delegate.isDirectory(path).pipe(operators_1.catchError(() => rxjs_1.of(false)));
|
|
34
|
+
return this._delegate.isDirectory(path).pipe((0, operators_1.catchError)(() => (0, rxjs_1.of)(false)));
|
|
35
35
|
}
|
|
36
36
|
isFile(path) {
|
|
37
|
-
return this._delegate.isFile(path).pipe(operators_1.catchError(() => rxjs_1.of(false)));
|
|
37
|
+
return this._delegate.isFile(path).pipe((0, operators_1.catchError)(() => (0, rxjs_1.of)(false)));
|
|
38
38
|
}
|
|
39
39
|
// Some hosts may not support stats.
|
|
40
40
|
stat(path) {
|
|
41
41
|
const maybeStat = this._delegate.stat(path);
|
|
42
|
-
return maybeStat && maybeStat.pipe(operators_1.catchError(() => rxjs_1.of(null)));
|
|
42
|
+
return maybeStat && maybeStat.pipe((0, operators_1.catchError)(() => (0, rxjs_1.of)(null)));
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
45
|
exports.SafeReadonlyHost = SafeReadonlyHost;
|