occam-verify-cli 0.0.1021 → 0.0.1024
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/bin/action/verify.js +2 -0
- package/lib/constructor.js +7 -10
- package/lib/context/release.js +27 -24
- package/lib/declaration/constructor.js +3 -3
- package/lib/metavariable.js +8 -8
- package/lib/term.js +12 -9
- package/lib/type.js +17 -17
- package/lib/unify/metavariableWithStatement.js +1 -1
- package/lib/unify/metavariableWithStatementGivenSubstitution.js +1 -1
- package/lib/utilities/array.js +5 -5
- package/lib/utilities/unify.js +6 -5
- package/lib/variable.js +9 -18
- package/package.json +1 -1
- package/src/constructor.js +6 -10
- package/src/context/release.js +21 -16
- package/src/declaration/constructor.js +2 -2
- package/src/metavariable.js +15 -13
- package/src/term.js +21 -18
- package/src/type.js +30 -32
- package/src/unify/metavariableWithStatement.js +1 -1
- package/src/unify/metavariableWithStatementGivenSubstitution.js +1 -1
- package/src/utilities/array.js +1 -1
- package/src/utilities/unify.js +5 -2
- package/src/variable.js +16 -29
- package/lib/verify/files.js +0 -56
- package/src/verify/files.js +0 -56
package/src/context/release.js
CHANGED
|
@@ -7,7 +7,7 @@ import { filePathUtilities } from "occam-entities";
|
|
|
7
7
|
import { lexersUtilities, parsersUtilities } from "occam-custom-grammars";
|
|
8
8
|
|
|
9
9
|
import { objectType } from "../type";
|
|
10
|
-
import { tail, push, leftDifference } from "../utilities/array";
|
|
10
|
+
import { tail, push, clear, leftDifference } from "../utilities/array";
|
|
11
11
|
import { customGrammarFromNameAndEntries, combinedCustomGrammarFromReleaseContexts } from "../utilities/customGrammar";
|
|
12
12
|
|
|
13
13
|
const { isFilePathNominalFilePath } = filePathUtilities,
|
|
@@ -15,7 +15,7 @@ const { isFilePathNominalFilePath } = filePathUtilities,
|
|
|
15
15
|
{ nominalParserFromCombinedCustomGrammar } = parsersUtilities;
|
|
16
16
|
|
|
17
17
|
export default class ReleaseContext {
|
|
18
|
-
constructor(log, name, json, entries, lexer, parser, verified, initialised, fileContexts, customGrammar, dependencyReleaseContexts) {
|
|
18
|
+
constructor(log, name, json, entries, lexer, parser, verified, initialised, fileContexts, customGrammar, verifiedFileContexts, dependencyReleaseContexts) {
|
|
19
19
|
this.log = log;
|
|
20
20
|
this.name = name;
|
|
21
21
|
this.json = json;
|
|
@@ -26,6 +26,7 @@ export default class ReleaseContext {
|
|
|
26
26
|
this.initialised = initialised;
|
|
27
27
|
this.fileContexts = fileContexts;
|
|
28
28
|
this.customGrammar = customGrammar;
|
|
29
|
+
this.verifiedFileContexts = verifiedFileContexts;
|
|
29
30
|
this.dependencyReleaseContexts = dependencyReleaseContexts;
|
|
30
31
|
}
|
|
31
32
|
|
|
@@ -69,6 +70,10 @@ export default class ReleaseContext {
|
|
|
69
70
|
return this.customGrammar;
|
|
70
71
|
}
|
|
71
72
|
|
|
73
|
+
getVerifiedFileContexts() {
|
|
74
|
+
return this.verifiedFileContexts;
|
|
75
|
+
}
|
|
76
|
+
|
|
72
77
|
getDependencyReleaseContexts() {
|
|
73
78
|
return this.dependencyReleaseContexts;
|
|
74
79
|
}
|
|
@@ -443,7 +448,9 @@ export default class ReleaseContext {
|
|
|
443
448
|
verify() {
|
|
444
449
|
let verified = false;
|
|
445
450
|
|
|
446
|
-
|
|
451
|
+
clear(this.verifiedFileContexts);
|
|
452
|
+
|
|
453
|
+
const fileContextsVerified = verifyFileContexts(this.fileContexts, this.verifiedFileContexts);
|
|
447
454
|
|
|
448
455
|
if (fileContextsVerified) {
|
|
449
456
|
this.verified = true;
|
|
@@ -455,12 +462,12 @@ export default class ReleaseContext {
|
|
|
455
462
|
}
|
|
456
463
|
|
|
457
464
|
toJSON() {
|
|
458
|
-
const
|
|
459
|
-
const
|
|
465
|
+
const verifiedFileContextsJSON = this.verifiedFileContexts.map((verifiedFileContext) => {
|
|
466
|
+
const verifiedFileContextJSON = verifiedFileContext.toJSON();
|
|
460
467
|
|
|
461
|
-
return
|
|
468
|
+
return verifiedFileContextJSON;
|
|
462
469
|
}),
|
|
463
|
-
json =
|
|
470
|
+
json = verifiedFileContextsJSON; ///
|
|
464
471
|
|
|
465
472
|
return json;
|
|
466
473
|
}
|
|
@@ -472,8 +479,9 @@ export default class ReleaseContext {
|
|
|
472
479
|
initialised = false,
|
|
473
480
|
fileContexts = [],
|
|
474
481
|
customGrammar = customGrammarFromNameAndEntries(name, entries),
|
|
482
|
+
verifiedFileContexts = [],
|
|
475
483
|
dependencyReleaseContexts = null,
|
|
476
|
-
releaseContext = new ReleaseContext(log, name, json, entries, lexer, parser, verified, initialised, fileContexts, customGrammar, dependencyReleaseContexts);
|
|
484
|
+
releaseContext = new ReleaseContext(log, name, json, entries, lexer, parser, verified, initialised, fileContexts, customGrammar, verifiedFileContexts, dependencyReleaseContexts);
|
|
477
485
|
|
|
478
486
|
return releaseContext;
|
|
479
487
|
}
|
|
@@ -531,7 +539,7 @@ function findFileContextJSON(json, filePath) {
|
|
|
531
539
|
return fileContextJSON;
|
|
532
540
|
}
|
|
533
541
|
|
|
534
|
-
function verifyFileContexts(fileContexts) {
|
|
542
|
+
function verifyFileContexts(fileContexts, verifiedFileContexts) {
|
|
535
543
|
let fileContextsVerified;
|
|
536
544
|
|
|
537
545
|
fileContexts = [ ///
|
|
@@ -545,22 +553,19 @@ function verifyFileContexts(fileContexts) {
|
|
|
545
553
|
break;
|
|
546
554
|
}
|
|
547
555
|
|
|
548
|
-
const
|
|
549
|
-
|
|
550
|
-
fileContexts.forEach((fileContext) => {
|
|
556
|
+
const fileContextVerified = fileContexts.some((fileContext) => {
|
|
551
557
|
const fileContextVerified = verifyFileContext(fileContext);
|
|
552
558
|
|
|
553
559
|
if (fileContextVerified) {
|
|
554
560
|
const verifiedFileContext = fileContext; ///
|
|
555
561
|
|
|
556
562
|
verifiedFileContexts.push(verifiedFileContext);
|
|
563
|
+
|
|
564
|
+
return true;
|
|
557
565
|
}
|
|
558
566
|
});
|
|
559
567
|
|
|
560
|
-
|
|
561
|
-
fileVerified = (verifiedFileContextsLength > 0);
|
|
562
|
-
|
|
563
|
-
if (!fileVerified) {
|
|
568
|
+
if (!fileContextVerified) {
|
|
564
569
|
break;
|
|
565
570
|
}
|
|
566
571
|
|
|
@@ -25,9 +25,9 @@ export default class ConstructorDeclaration {
|
|
|
25
25
|
|
|
26
26
|
this.fileContext.trace(`Verifying the '${constructorDeclarationString}' constructor declaration...`);
|
|
27
27
|
|
|
28
|
-
const
|
|
28
|
+
const constructorVerifiedAtTopLevel = this.constructor.verifyAtTopLevel(this.fileContext);
|
|
29
29
|
|
|
30
|
-
if (
|
|
30
|
+
if (constructorVerifiedAtTopLevel) {
|
|
31
31
|
this.fileContext.addConstructor(this.constructor);
|
|
32
32
|
|
|
33
33
|
verified = true;
|
package/src/metavariable.js
CHANGED
|
@@ -120,24 +120,15 @@ export default class Metavariable {
|
|
|
120
120
|
}
|
|
121
121
|
|
|
122
122
|
static fromJSON(json, fileContext) {
|
|
123
|
-
const {
|
|
124
|
-
{ string } = json,
|
|
123
|
+
const { string } = json,
|
|
125
124
|
lexer = fileContext.getLexer(),
|
|
126
125
|
parser = fileContext.getParser(),
|
|
127
126
|
metavariableString = string, ///
|
|
128
127
|
metavariableNode = metavariableNodeFromMetavariableString(metavariableString, lexer, parser),
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
let { metaType } = json;
|
|
132
|
-
|
|
133
|
-
if (metaType !== null) {
|
|
134
|
-
json = metaType; ///
|
|
135
|
-
|
|
136
|
-
metaType = MetaType.fromJSON(json, fileContext);
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
const metavariableName = metavariableNameFromMetavariableNode(metavariableNode),
|
|
128
|
+
metavariableName = metavariableNameFromMetavariableNode(metavariableNode),
|
|
129
|
+
node = metavariableNode, ///
|
|
140
130
|
name = metavariableName, ///
|
|
131
|
+
metaType = metaTypeFromJSON(json, fileContext),
|
|
141
132
|
metavariable = new Metavariable(string, node, name, metaType);
|
|
142
133
|
|
|
143
134
|
return metavariable;
|
|
@@ -170,3 +161,14 @@ export default class Metavariable {
|
|
|
170
161
|
return metavariable;
|
|
171
162
|
}
|
|
172
163
|
}
|
|
164
|
+
|
|
165
|
+
function metaTypeFromJSON(json, fileContext) {
|
|
166
|
+
let { metaType } = json;
|
|
167
|
+
|
|
168
|
+
const { name } = metaType,
|
|
169
|
+
metaTypeName = name; ///
|
|
170
|
+
|
|
171
|
+
metaType = fileContext.findMetaTypeByMetaTypeName(metaTypeName);
|
|
172
|
+
|
|
173
|
+
return metaType;
|
|
174
|
+
}
|
package/src/term.js
CHANGED
|
@@ -197,9 +197,12 @@ class Term {
|
|
|
197
197
|
|
|
198
198
|
fileContext.trace(`Verifying the '${termString}' term at top level...`);
|
|
199
199
|
|
|
200
|
-
const termNode = this.node
|
|
200
|
+
const termNode = this.node,
|
|
201
|
+
termVerifiedAsConstructor = termAsConstructorVerifier.verifyTerm(termNode, fileContext);
|
|
201
202
|
|
|
202
|
-
|
|
203
|
+
if (termVerifiedAsConstructor) {
|
|
204
|
+
verifiedAtTopLevel = true;
|
|
205
|
+
}
|
|
203
206
|
|
|
204
207
|
if (verifiedAtTopLevel) {
|
|
205
208
|
fileContext.debug(`...verified the '${termString}' term at top level.`, termNode);
|
|
@@ -223,25 +226,14 @@ class Term {
|
|
|
223
226
|
}
|
|
224
227
|
|
|
225
228
|
static fromJSON(json, fileContext) {
|
|
226
|
-
const {
|
|
227
|
-
{ string } = json,
|
|
229
|
+
const { string } = json,
|
|
228
230
|
termString = string, ///
|
|
229
231
|
lexer = fileContext.getLexer(),
|
|
230
232
|
parser = fileContext.getParser(),
|
|
231
233
|
termNode = termNodeFromTermString(termString, lexer, parser),
|
|
232
|
-
node = termNode
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
const typeJSON = type; ///
|
|
237
|
-
|
|
238
|
-
json = typeJSON; ///
|
|
239
|
-
|
|
240
|
-
type = (json !== null) ?
|
|
241
|
-
Type.fromJSON(json, fileContext) :
|
|
242
|
-
null;
|
|
243
|
-
|
|
244
|
-
const term = new Term(string, node, type);
|
|
234
|
+
node = termNode, ///
|
|
235
|
+
type = typeFromJSON(json, fileContext),
|
|
236
|
+
term = new Term(string, node, type);
|
|
245
237
|
|
|
246
238
|
return term;
|
|
247
239
|
}
|
|
@@ -268,4 +260,15 @@ Object.assign(shim, {
|
|
|
268
260
|
Term
|
|
269
261
|
});
|
|
270
262
|
|
|
271
|
-
export default Term;
|
|
263
|
+
export default Term;
|
|
264
|
+
|
|
265
|
+
function typeFromJSON(json, fileContext) {
|
|
266
|
+
let { type } = json;
|
|
267
|
+
|
|
268
|
+
const { name } = type,
|
|
269
|
+
typeName = name; ///
|
|
270
|
+
|
|
271
|
+
type = fileContext.findTypeByTypeName(typeName);
|
|
272
|
+
|
|
273
|
+
return type;
|
|
274
|
+
}
|
package/src/type.js
CHANGED
|
@@ -155,19 +155,17 @@ class Type {
|
|
|
155
155
|
if (typePresent) {
|
|
156
156
|
fileContext.debug(`The type '${typeString}' is already present.`);
|
|
157
157
|
} else {
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
} else {
|
|
161
|
-
const name = this.superType.getName(),
|
|
162
|
-
superTypePresent = fileContext.isTypePresentByTypeName(name);
|
|
158
|
+
const superTypeName = this.superType.getName(),
|
|
159
|
+
superType = fileContext.isTypePresentByTypeName(superTypeName);
|
|
163
160
|
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
} else {
|
|
167
|
-
const superTypeString = this.superType.getString();
|
|
161
|
+
if (superType === null) {
|
|
162
|
+
const superTypeString = this.superType.getString();
|
|
168
163
|
|
|
169
|
-
|
|
170
|
-
|
|
164
|
+
fileContext.debug(`The super-type '${superTypeString}' is not present.`);
|
|
165
|
+
} else {
|
|
166
|
+
this.superType = superType;
|
|
167
|
+
|
|
168
|
+
verifiedAtTopLevel = true;
|
|
171
169
|
}
|
|
172
170
|
}
|
|
173
171
|
|
|
@@ -193,24 +191,11 @@ class Type {
|
|
|
193
191
|
}
|
|
194
192
|
|
|
195
193
|
static fromJSON(json, fileContext) {
|
|
196
|
-
const { name } = json
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
const superTypeJSON = superType; ///
|
|
201
|
-
|
|
202
|
-
json = superTypeJSON; ///
|
|
203
|
-
|
|
204
|
-
superType = (json !== null) ?
|
|
205
|
-
Type.fromJSON(json, fileContext) :
|
|
206
|
-
null;
|
|
207
|
-
|
|
208
|
-
const typeName = name, ///
|
|
194
|
+
const { name } = json,
|
|
195
|
+
typeName = name, ///
|
|
196
|
+
superType = superTypeFromJSON(json, fileContext),
|
|
209
197
|
string = stringFromTypeNameAndSuperType(typeName, superType),
|
|
210
|
-
|
|
211
|
-
type = typeNameObjectTypeName ?
|
|
212
|
-
objectType :
|
|
213
|
-
new Type(string, name, superType);
|
|
198
|
+
type = new Type(string, name, superType);
|
|
214
199
|
|
|
215
200
|
return type;
|
|
216
201
|
}
|
|
@@ -220,10 +205,7 @@ class Type {
|
|
|
220
205
|
name = typeName, ///
|
|
221
206
|
string = name, ///
|
|
222
207
|
superType = null,
|
|
223
|
-
|
|
224
|
-
type = typeNameObjectTypeName ?
|
|
225
|
-
objectType :
|
|
226
|
-
new Type(string, name, superType);
|
|
208
|
+
type = new Type(string, name, superType);
|
|
227
209
|
|
|
228
210
|
return type;
|
|
229
211
|
}
|
|
@@ -274,3 +256,19 @@ class ObjectType extends Type {
|
|
|
274
256
|
}
|
|
275
257
|
|
|
276
258
|
export const objectType = ObjectType.fromNothing();
|
|
259
|
+
|
|
260
|
+
function superTypeFromJSON(json, fileContext) {
|
|
261
|
+
let { superType } = json;
|
|
262
|
+
|
|
263
|
+
const superTypeJSON = superType; ///
|
|
264
|
+
|
|
265
|
+
json = superTypeJSON; ///
|
|
266
|
+
|
|
267
|
+
const { name } = json,
|
|
268
|
+
typeName = name, ///
|
|
269
|
+
type = fileContext.findTypeByTypeName(typeName);
|
|
270
|
+
|
|
271
|
+
superType = type; ///
|
|
272
|
+
|
|
273
|
+
return superType;
|
|
274
|
+
}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import StatementForMetavariableSubstitution from "../substitution/statementForMetavariable";
|
|
4
4
|
|
|
5
5
|
import { metavariableFromStatementNode } from "../utilities/unify";
|
|
6
|
-
import {metavariableNameFromMetavariableNode} from "../utilities/name";
|
|
6
|
+
import { metavariableNameFromMetavariableNode } from "../utilities/name";
|
|
7
7
|
|
|
8
8
|
export default function unifyMetavariableWithStatement(metavariableNodeA, statementNodeB, substitutions, localContextA, localContextB) {
|
|
9
9
|
let metavariableUnifiedWithStatement = false;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import StatementForMetavariableSubstitution from "../substitution/statementForMetavariable";
|
|
4
4
|
|
|
5
5
|
import { metavariableFromStatementNode } from "../utilities/unify";
|
|
6
|
-
import {metavariableNameFromMetavariableNode} from "../utilities/name";
|
|
6
|
+
import { metavariableNameFromMetavariableNode } from "../utilities/name";
|
|
7
7
|
|
|
8
8
|
export default function unifyMetavariableWithStatementGivenSubstitution(metavariableNodeA, statementNodeB, substitutionNodeA, substitutions, localContextA, localContextB) {
|
|
9
9
|
let metavariableUnifiedWithStatementGivenSubstitution = false;
|
package/src/utilities/array.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import { arrayUtilities } from "necessary";
|
|
4
4
|
|
|
5
|
-
export const { first,
|
|
5
|
+
export const { first, last, extract, tail, push, find, clear, match, prune, filter, compress, separate } = arrayUtilities;
|
|
6
6
|
|
|
7
7
|
export function reverse(array) {
|
|
8
8
|
array = [ ///
|
package/src/utilities/unify.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
import { nodeQuery } from "../utilities/query";
|
|
4
|
+
import { metavariableNameFromMetavariableNode} from "../utilities/name";
|
|
4
5
|
|
|
5
6
|
const termVariableNodeQuery = nodeQuery("/term/variable"),
|
|
6
7
|
frameMetavariableNodeQuery = nodeQuery("/frame/metavariable"),
|
|
@@ -26,7 +27,8 @@ export function metavariableFromFrameNode(frameNode, localContext) {
|
|
|
26
27
|
const frameMetavariableNode = frameMetavariableNodeQuery(frameNode)
|
|
27
28
|
|
|
28
29
|
if (frameMetavariableNode !== null) {
|
|
29
|
-
const metavariableNode =
|
|
30
|
+
const metavariableNode = statementMetavariableNode, ///
|
|
31
|
+
metavariableName = metavariableNameFromMetavariableNode(metavariableNode);
|
|
30
32
|
|
|
31
33
|
metavariable = localContext.findMetavariableByMetavariableName(metavariableName);
|
|
32
34
|
}
|
|
@@ -40,7 +42,8 @@ export function metavariableFromStatementNode(statementNode, localContext) {
|
|
|
40
42
|
const statementMetavariableNode = statementMetavariableNodeQuery(statementNode)
|
|
41
43
|
|
|
42
44
|
if (statementMetavariableNode !== null) {
|
|
43
|
-
const metavariableNode = statementMetavariableNode
|
|
45
|
+
const metavariableNode = statementMetavariableNode, ///
|
|
46
|
+
metavariableName = metavariableNameFromMetavariableNode(metavariableNode);
|
|
44
47
|
|
|
45
48
|
metavariable = localContext.findMetavariableByMetavariableName(metavariableName);
|
|
46
49
|
}
|
package/src/variable.js
CHANGED
|
@@ -89,22 +89,7 @@ export default class Variable {
|
|
|
89
89
|
if (variablePresent) {
|
|
90
90
|
localContext.debug(`The '${variableString}' variable is already present.`);
|
|
91
91
|
} else {
|
|
92
|
-
|
|
93
|
-
type = localContext.findTypeByTypeName(typeName);
|
|
94
|
-
|
|
95
|
-
if (type === null) {
|
|
96
|
-
const typeString = this.type.getString();
|
|
97
|
-
|
|
98
|
-
localContext.debug(`The '${typeString}' type is not present.`);
|
|
99
|
-
} else {
|
|
100
|
-
this.type = type;
|
|
101
|
-
|
|
102
|
-
const variable = this; ///
|
|
103
|
-
|
|
104
|
-
localContext.addVariable(variable);
|
|
105
|
-
|
|
106
|
-
verifiedAtTopLevel = true;
|
|
107
|
-
}
|
|
92
|
+
verifiedAtTopLevel = true;
|
|
108
93
|
}
|
|
109
94
|
|
|
110
95
|
if (verifiedAtTopLevel) {
|
|
@@ -129,24 +114,15 @@ export default class Variable {
|
|
|
129
114
|
}
|
|
130
115
|
|
|
131
116
|
static fromJSON(json, fileContext) {
|
|
132
|
-
const {
|
|
133
|
-
{ string } = json,
|
|
117
|
+
const { string } = json,
|
|
134
118
|
lexer = fileContext.getLexer(),
|
|
135
119
|
parser = fileContext.getParser(),
|
|
136
120
|
variableString = string, ///
|
|
137
121
|
variableNode = variableNodeFromVariableString(variableString, lexer, parser),
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
let { type } = json;
|
|
141
|
-
|
|
142
|
-
if (type !== null) {
|
|
143
|
-
json = type; ///
|
|
144
|
-
|
|
145
|
-
type = Type.fromJSON(json, fileContext);
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
const variableName = variableNameFromVariableNode(variableNode),
|
|
122
|
+
variableName = variableNameFromVariableNode(variableNode),
|
|
123
|
+
node = variableNode,
|
|
149
124
|
name = variableName, ///
|
|
125
|
+
type = typeFromJSON(json, fileContext),
|
|
150
126
|
variable = new Variable(string, node, name, type);
|
|
151
127
|
|
|
152
128
|
return variable;
|
|
@@ -191,3 +167,14 @@ export default class Variable {
|
|
|
191
167
|
return variable;
|
|
192
168
|
}
|
|
193
169
|
}
|
|
170
|
+
|
|
171
|
+
function typeFromJSON(json, fileContext) {
|
|
172
|
+
let { type } = json;
|
|
173
|
+
|
|
174
|
+
const { name } = type,
|
|
175
|
+
typeName = name; ///
|
|
176
|
+
|
|
177
|
+
type = fileContext.findTypeByTypeName(typeName);
|
|
178
|
+
|
|
179
|
+
return type;
|
|
180
|
+
}
|
package/lib/verify/files.js
DELETED
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
Object.defineProperty(exports, "default", {
|
|
6
|
-
enumerable: true,
|
|
7
|
-
get: function() {
|
|
8
|
-
return verifyFiles;
|
|
9
|
-
}
|
|
10
|
-
});
|
|
11
|
-
var _file = /*#__PURE__*/ _interop_require_default(require("../verify/file"));
|
|
12
|
-
var _occamentities = require("occam-entities");
|
|
13
|
-
var _array = require("../utilities/array");
|
|
14
|
-
function _interop_require_default(obj) {
|
|
15
|
-
return obj && obj.__esModule ? obj : {
|
|
16
|
-
default: obj
|
|
17
|
-
};
|
|
18
|
-
}
|
|
19
|
-
var isFilePathNominalFilePath = _occamentities.filePathUtilities.isFilePathNominalFilePath;
|
|
20
|
-
function verifyFiles(releaseContext) {
|
|
21
|
-
var _loop = function() {
|
|
22
|
-
var filePathsLength = filePaths.length;
|
|
23
|
-
if (filePathsLength === 0) {
|
|
24
|
-
filesVerified = true;
|
|
25
|
-
return "break";
|
|
26
|
-
}
|
|
27
|
-
var verifiedFilePaths = [];
|
|
28
|
-
filePaths.forEach(function(filePath) {
|
|
29
|
-
var fileVerified = (0, _file.default)(filePath, releaseContext);
|
|
30
|
-
if (fileVerified) {
|
|
31
|
-
var verifiedFilePath = filePath; ///
|
|
32
|
-
verifiedFilePaths.push(verifiedFilePath);
|
|
33
|
-
}
|
|
34
|
-
});
|
|
35
|
-
var verifiedFilePathsLength = verifiedFilePaths.length, fileVerified = verifiedFilePathsLength > 0;
|
|
36
|
-
if (!fileVerified) {
|
|
37
|
-
return "break";
|
|
38
|
-
}
|
|
39
|
-
(0, _array.leftDifference)(filePaths, verifiedFilePaths);
|
|
40
|
-
};
|
|
41
|
-
var filesVerified = false;
|
|
42
|
-
var filePaths = releaseContext.getFilePaths();
|
|
43
|
-
(0, _array.filter)(filePaths, function(filePath) {
|
|
44
|
-
var filePathNominalFilePath = isFilePathNominalFilePath(filePath);
|
|
45
|
-
if (filePathNominalFilePath) {
|
|
46
|
-
return true;
|
|
47
|
-
}
|
|
48
|
-
});
|
|
49
|
-
for(;;){
|
|
50
|
-
var _ret = _loop();
|
|
51
|
-
if (_ret === "break") break;
|
|
52
|
-
}
|
|
53
|
-
return filesVerified;
|
|
54
|
-
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E7Ozs7SUErQkEsT0FBT1o7QUFDVCJ9
|
package/src/verify/files.js
DELETED
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
import verifyFile from "../verify/file";
|
|
4
|
-
|
|
5
|
-
import { filePathUtilities } from "occam-entities";
|
|
6
|
-
|
|
7
|
-
import { filter, leftDifference } from "../utilities/array";
|
|
8
|
-
|
|
9
|
-
const { isFilePathNominalFilePath } = filePathUtilities;
|
|
10
|
-
|
|
11
|
-
export default function verifyFiles(releaseContext) {
|
|
12
|
-
let filesVerified = false;
|
|
13
|
-
|
|
14
|
-
const filePaths = releaseContext.getFilePaths();
|
|
15
|
-
|
|
16
|
-
filter(filePaths, (filePath) => {
|
|
17
|
-
const filePathNominalFilePath = isFilePathNominalFilePath(filePath);
|
|
18
|
-
|
|
19
|
-
if (filePathNominalFilePath) {
|
|
20
|
-
return true;
|
|
21
|
-
}
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
for (;;) {
|
|
25
|
-
const filePathsLength = filePaths.length;
|
|
26
|
-
|
|
27
|
-
if (filePathsLength === 0) {
|
|
28
|
-
filesVerified = true;
|
|
29
|
-
|
|
30
|
-
break;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
const verifiedFilePaths = [];
|
|
34
|
-
|
|
35
|
-
filePaths.forEach((filePath) => {
|
|
36
|
-
const fileVerified = verifyFile(filePath, releaseContext);
|
|
37
|
-
|
|
38
|
-
if (fileVerified) {
|
|
39
|
-
const verifiedFilePath = filePath; ///
|
|
40
|
-
|
|
41
|
-
verifiedFilePaths.push(verifiedFilePath);
|
|
42
|
-
}
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
const verifiedFilePathsLength = verifiedFilePaths.length,
|
|
46
|
-
fileVerified = (verifiedFilePathsLength > 0);
|
|
47
|
-
|
|
48
|
-
if (!fileVerified) {
|
|
49
|
-
break;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
leftDifference(filePaths, verifiedFilePaths);
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
return filesVerified;
|
|
56
|
-
}
|