@eagleoutice/flowr 1.4.2 → 1.5.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/core/print/slice-diff-ansi.js +7 -7
- package/core/steps.d.ts +352 -11
- package/core/steps.js +4 -4
- package/index.d.ts +0 -2
- package/index.js +0 -2
- package/package.json +76 -216
- package/util/{summarizer/summarizer.d.ts → summarizer.d.ts} +15 -1
- package/util/summarizer.js +37 -0
- package/util/version.d.ts +2 -0
- package/util/version.js +11 -0
- package/benchmark/index.d.ts +0 -3
- package/benchmark/index.js +0 -20
- package/benchmark/slicer.d.ts +0 -98
- package/benchmark/slicer.js +0 -213
- package/benchmark/stats/index.d.ts +0 -10
- package/benchmark/stats/index.js +0 -27
- package/benchmark/stats/print.d.ts +0 -7
- package/benchmark/stats/print.js +0 -155
- package/benchmark/stats/stats.d.ts +0 -40
- package/benchmark/stats/stats.js +0 -6
- package/benchmark/stopwatch.d.ts +0 -35
- package/benchmark/stopwatch.js +0 -79
- package/cli/benchmark-app.d.ts +0 -10
- package/cli/benchmark-app.js +0 -67
- package/cli/benchmark-helper-app.d.ts +0 -9
- package/cli/benchmark-helper-app.js +0 -69
- package/cli/common/features.d.ts +0 -3
- package/cli/common/features.js +0 -30
- package/cli/common/index.d.ts +0 -2
- package/cli/common/index.js +0 -19
- package/cli/common/options.d.ts +0 -20
- package/cli/common/options.js +0 -85
- package/cli/common/script.d.ts +0 -21
- package/cli/common/script.js +0 -61
- package/cli/common/scripts-info.d.ts +0 -25
- package/cli/common/scripts-info.js +0 -83
- package/cli/export-quads-app.d.ts +0 -7
- package/cli/export-quads-app.js +0 -42
- package/cli/repl/commands/cfg.d.ts +0 -3
- package/cli/repl/commands/cfg.js +0 -37
- package/cli/repl/commands/commands.d.ts +0 -13
- package/cli/repl/commands/commands.js +0 -142
- package/cli/repl/commands/dataflow.d.ts +0 -3
- package/cli/repl/commands/dataflow.js +0 -34
- package/cli/repl/commands/execute.d.ts +0 -4
- package/cli/repl/commands/execute.js +0 -27
- package/cli/repl/commands/index.d.ts +0 -2
- package/cli/repl/commands/index.js +0 -19
- package/cli/repl/commands/main.d.ts +0 -39
- package/cli/repl/commands/main.js +0 -14
- package/cli/repl/commands/normalize.d.ts +0 -3
- package/cli/repl/commands/normalize.js +0 -34
- package/cli/repl/commands/parse.d.ts +0 -2
- package/cli/repl/commands/parse.js +0 -109
- package/cli/repl/commands/quit.d.ts +0 -2
- package/cli/repl/commands/quit.js +0 -15
- package/cli/repl/commands/version.d.ts +0 -16
- package/cli/repl/commands/version.js +0 -33
- package/cli/repl/core.d.ts +0 -41
- package/cli/repl/core.js +0 -172
- package/cli/repl/execute.d.ts +0 -28
- package/cli/repl/execute.js +0 -79
- package/cli/repl/index.d.ts +0 -5
- package/cli/repl/index.js +0 -22
- package/cli/repl/prompt.d.ts +0 -2
- package/cli/repl/prompt.js +0 -9
- package/cli/repl/server/connection.d.ts +0 -21
- package/cli/repl/server/connection.js +0 -213
- package/cli/repl/server/messages/analysis.d.ts +0 -71
- package/cli/repl/server/messages/analysis.js +0 -21
- package/cli/repl/server/messages/error.d.ts +0 -11
- package/cli/repl/server/messages/error.js +0 -3
- package/cli/repl/server/messages/hello.d.ts +0 -20
- package/cli/repl/server/messages/hello.js +0 -3
- package/cli/repl/server/messages/index.d.ts +0 -1
- package/cli/repl/server/messages/index.js +0 -3
- package/cli/repl/server/messages/messages.d.ts +0 -35
- package/cli/repl/server/messages/messages.js +0 -40
- package/cli/repl/server/messages/repl.d.ts +0 -33
- package/cli/repl/server/messages/repl.js +0 -37
- package/cli/repl/server/messages/slice.d.ts +0 -25
- package/cli/repl/server/messages/slice.js +0 -37
- package/cli/repl/server/net.d.ts +0 -49
- package/cli/repl/server/net.js +0 -63
- package/cli/repl/server/send.d.ts +0 -4
- package/cli/repl/server/send.js +0 -18
- package/cli/repl/server/server.d.ts +0 -20
- package/cli/repl/server/server.js +0 -66
- package/cli/repl/server/validate.d.ts +0 -15
- package/cli/repl/server/validate.js +0 -34
- package/cli/slicer-app.d.ts +0 -11
- package/cli/slicer-app.js +0 -81
- package/cli/statistics-app.d.ts +0 -11
- package/cli/statistics-app.js +0 -98
- package/cli/statistics-helper-app.d.ts +0 -11
- package/cli/statistics-helper-app.js +0 -82
- package/cli/summarizer-app.d.ts +0 -18
- package/cli/summarizer-app.js +0 -66
- package/flowr.d.ts +0 -29
- package/flowr.js +0 -142
- package/statistics/features/common-syntax-probability.d.ts +0 -31
- package/statistics/features/common-syntax-probability.js +0 -156
- package/statistics/features/feature.d.ts +0 -175
- package/statistics/features/feature.js +0 -30
- package/statistics/features/index.d.ts +0 -1
- package/statistics/features/index.js +0 -18
- package/statistics/features/post-processing.d.ts +0 -12
- package/statistics/features/post-processing.js +0 -21
- package/statistics/features/supported/assignments/assignments.d.ts +0 -11
- package/statistics/features/supported/assignments/assignments.js +0 -53
- package/statistics/features/supported/assignments/index.d.ts +0 -1
- package/statistics/features/supported/assignments/index.js +0 -6
- package/statistics/features/supported/assignments/post-process.d.ts +0 -3
- package/statistics/features/supported/assignments/post-process.js +0 -125
- package/statistics/features/supported/comments/comments.d.ts +0 -18
- package/statistics/features/supported/comments/comments.js +0 -133
- package/statistics/features/supported/comments/index.d.ts +0 -1
- package/statistics/features/supported/comments/index.js +0 -6
- package/statistics/features/supported/comments/post-process.d.ts +0 -3
- package/statistics/features/supported/comments/post-process.js +0 -50
- package/statistics/features/supported/control-flow/control-flow.d.ts +0 -17
- package/statistics/features/supported/control-flow/control-flow.js +0 -67
- package/statistics/features/supported/control-flow/index.d.ts +0 -1
- package/statistics/features/supported/control-flow/index.js +0 -6
- package/statistics/features/supported/control-flow/post-process.d.ts +0 -3
- package/statistics/features/supported/control-flow/post-process.js +0 -65
- package/statistics/features/supported/data-access/data-access.d.ts +0 -15
- package/statistics/features/supported/data-access/data-access.js +0 -118
- package/statistics/features/supported/data-access/index.d.ts +0 -1
- package/statistics/features/supported/data-access/index.js +0 -6
- package/statistics/features/supported/data-access/post-process.d.ts +0 -3
- package/statistics/features/supported/data-access/post-process.js +0 -107
- package/statistics/features/supported/defined-functions/defined-functions.d.ts +0 -35
- package/statistics/features/supported/defined-functions/defined-functions.js +0 -139
- package/statistics/features/supported/defined-functions/index.d.ts +0 -1
- package/statistics/features/supported/defined-functions/index.js +0 -6
- package/statistics/features/supported/defined-functions/post-process.d.ts +0 -6
- package/statistics/features/supported/defined-functions/post-process.js +0 -177
- package/statistics/features/supported/expression-list/expression-list.d.ts +0 -9
- package/statistics/features/supported/expression-list/expression-list.js +0 -36
- package/statistics/features/supported/expression-list/index.d.ts +0 -1
- package/statistics/features/supported/expression-list/index.js +0 -6
- package/statistics/features/supported/expression-list/post-process.d.ts +0 -3
- package/statistics/features/supported/expression-list/post-process.js +0 -44
- package/statistics/features/supported/index.d.ts +0 -10
- package/statistics/features/supported/index.js +0 -27
- package/statistics/features/supported/loops/index.d.ts +0 -1
- package/statistics/features/supported/loops/index.js +0 -6
- package/statistics/features/supported/loops/loops.d.ts +0 -20
- package/statistics/features/supported/loops/loops.js +0 -79
- package/statistics/features/supported/loops/post-process.d.ts +0 -3
- package/statistics/features/supported/loops/post-process.js +0 -72
- package/statistics/features/supported/used-functions/index.d.ts +0 -1
- package/statistics/features/supported/used-functions/index.js +0 -6
- package/statistics/features/supported/used-functions/post-process.d.ts +0 -6
- package/statistics/features/supported/used-functions/post-process.js +0 -179
- package/statistics/features/supported/used-functions/used-functions.d.ts +0 -24
- package/statistics/features/supported/used-functions/used-functions.js +0 -95
- package/statistics/features/supported/used-packages/index.d.ts +0 -1
- package/statistics/features/supported/used-packages/index.js +0 -6
- package/statistics/features/supported/used-packages/post-process.d.ts +0 -3
- package/statistics/features/supported/used-packages/post-process.js +0 -121
- package/statistics/features/supported/used-packages/used-packages.d.ts +0 -16
- package/statistics/features/supported/used-packages/used-packages.js +0 -130
- package/statistics/features/supported/values/index.d.ts +0 -1
- package/statistics/features/supported/values/index.js +0 -6
- package/statistics/features/supported/values/post-process.d.ts +0 -3
- package/statistics/features/supported/values/post-process.js +0 -72
- package/statistics/features/supported/values/values.d.ts +0 -14
- package/statistics/features/supported/values/values.js +0 -101
- package/statistics/features/supported/variables/index.d.ts +0 -1
- package/statistics/features/supported/variables/index.js +0 -6
- package/statistics/features/supported/variables/post-process.d.ts +0 -9
- package/statistics/features/supported/variables/post-process.js +0 -122
- package/statistics/features/supported/variables/variables.d.ts +0 -15
- package/statistics/features/supported/variables/variables.js +0 -70
- package/statistics/index.d.ts +0 -6
- package/statistics/index.js +0 -24
- package/statistics/meta-statistics.d.ts +0 -33
- package/statistics/meta-statistics.js +0 -17
- package/statistics/output/file-provider.d.ts +0 -37
- package/statistics/output/file-provider.js +0 -97
- package/statistics/output/index.d.ts +0 -4
- package/statistics/output/index.js +0 -21
- package/statistics/output/print-stats.d.ts +0 -17
- package/statistics/output/print-stats.js +0 -69
- package/statistics/output/statistics-file.d.ts +0 -37
- package/statistics/output/statistics-file.js +0 -69
- package/statistics/statistics.d.ts +0 -24
- package/statistics/statistics.js +0 -108
- package/util/summarizer/auto-detect.d.ts +0 -2
- package/util/summarizer/auto-detect.js +0 -32
- package/util/summarizer/benchmark/data.d.ts +0 -66
- package/util/summarizer/benchmark/data.js +0 -13
- package/util/summarizer/benchmark/first-phase/input.d.ts +0 -3
- package/util/summarizer/benchmark/first-phase/input.js +0 -75
- package/util/summarizer/benchmark/first-phase/process.d.ts +0 -11
- package/util/summarizer/benchmark/first-phase/process.js +0 -217
- package/util/summarizer/benchmark/second-phase/graph.d.ts +0 -2
- package/util/summarizer/benchmark/second-phase/graph.js +0 -54
- package/util/summarizer/benchmark/second-phase/process.d.ts +0 -6
- package/util/summarizer/benchmark/second-phase/process.js +0 -126
- package/util/summarizer/benchmark/summarizer.d.ts +0 -31
- package/util/summarizer/benchmark/summarizer.js +0 -58
- package/util/summarizer/statistics/first-phase/process.d.ts +0 -6
- package/util/summarizer/statistics/first-phase/process.js +0 -81
- package/util/summarizer/statistics/post-process/clusterer.d.ts +0 -26
- package/util/summarizer/statistics/post-process/clusterer.js +0 -43
- package/util/summarizer/statistics/post-process/file-based-count.d.ts +0 -17
- package/util/summarizer/statistics/post-process/file-based-count.js +0 -49
- package/util/summarizer/statistics/post-process/histogram.d.ts +0 -59
- package/util/summarizer/statistics/post-process/histogram.js +0 -128
- package/util/summarizer/statistics/post-process/index.d.ts +0 -4
- package/util/summarizer/statistics/post-process/index.js +0 -21
- package/util/summarizer/statistics/post-process/post-process-output.d.ts +0 -16
- package/util/summarizer/statistics/post-process/post-process-output.js +0 -103
- package/util/summarizer/statistics/second-phase/process.d.ts +0 -11
- package/util/summarizer/statistics/second-phase/process.js +0 -117
- package/util/summarizer/statistics/summarizer.d.ts +0 -35
- package/util/summarizer/statistics/summarizer.js +0 -135
- package/util/summarizer/summarizer.js +0 -13
- /package/{statistics/output → util}/ansi.d.ts +0 -0
- /package/{statistics/output → util}/ansi.js +0 -0
|
@@ -1,135 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.StatisticsSummarizer = exports.statisticsFileNameRegex = void 0;
|
|
7
|
-
const summarizer_1 = require("../summarizer");
|
|
8
|
-
const files_1 = require("../../files");
|
|
9
|
-
const tar_1 = require("tar");
|
|
10
|
-
const strings_1 = require("../../strings");
|
|
11
|
-
const fs_1 = __importDefault(require("fs"));
|
|
12
|
-
const path_1 = __importDefault(require("path"));
|
|
13
|
-
const time_1 = require("../../time");
|
|
14
|
-
const process_1 = require("./first-phase/process");
|
|
15
|
-
const process_2 = require("./second-phase/process");
|
|
16
|
-
exports.statisticsFileNameRegex = /.*--.*\.tar\.gz$/;
|
|
17
|
-
/**
|
|
18
|
-
* The returned map contains the full path as key, mapping it to the complete contents.
|
|
19
|
-
*/
|
|
20
|
-
async function retrieveAllFilesInArchive(f) {
|
|
21
|
-
const filenames = new Map();
|
|
22
|
-
const promises = [];
|
|
23
|
-
(0, tar_1.list)({
|
|
24
|
-
file: f,
|
|
25
|
-
onentry: entry => {
|
|
26
|
-
if (entry.type === 'File') {
|
|
27
|
-
promises.push(entry.concat().then(content => {
|
|
28
|
-
filenames.set(entry.path, content.toString());
|
|
29
|
-
}));
|
|
30
|
-
}
|
|
31
|
-
},
|
|
32
|
-
sync: true
|
|
33
|
-
});
|
|
34
|
-
await Promise.all(promises);
|
|
35
|
-
return filenames;
|
|
36
|
-
}
|
|
37
|
-
function identifyCommonPrefix(files) {
|
|
38
|
-
return (0, strings_1.longestCommonPrefix)([...files.keys()]);
|
|
39
|
-
}
|
|
40
|
-
/** returns the target path */
|
|
41
|
-
async function extractArchive(f) {
|
|
42
|
-
const files = await retrieveAllFilesInArchive(f);
|
|
43
|
-
const commonRoot = identifyCommonPrefix(files);
|
|
44
|
-
// post process until we find the '<filename>.(r|R)' suffix. otherwise, if there are no features and only the meta folder, the meta folder will be removed, resulting in a write
|
|
45
|
-
// to the toplevel!
|
|
46
|
-
const fname = path_1.default.basename(f).replace(/\.tar\.gz$/, '');
|
|
47
|
-
const findIndex = commonRoot.indexOf(fname);
|
|
48
|
-
const commonPart = findIndex < 0 ? commonRoot.length : findIndex + fname.length;
|
|
49
|
-
// transform all map keys by removing the common root
|
|
50
|
-
const transformed = new Map();
|
|
51
|
-
for (const [key, value] of files.entries()) {
|
|
52
|
-
transformed.set(key.slice(commonPart), value);
|
|
53
|
-
}
|
|
54
|
-
return transformed;
|
|
55
|
-
}
|
|
56
|
-
// due to a redefinition after the initial statistic extraction, we extract the type from the remaining path :D
|
|
57
|
-
// original: /^([^-]*)---?(.+)\.tar.gz/
|
|
58
|
-
const filePrefixRegex = /^[^-]*---?(?<fullname>([^/]+)\/(?<pathtest>.+))\.tar\.gz$/;
|
|
59
|
-
const testRegex = /.*test[-_]?(s|that|)\//i;
|
|
60
|
-
/** if it starts with example-, this will return `'example'`, etc. if it starts with '--' this will return `undefined` */
|
|
61
|
-
function identifyExtractionType(path) {
|
|
62
|
-
const match = filePrefixRegex.exec(path.replace(///g, '/'));
|
|
63
|
-
if (match === null || match.groups === undefined) {
|
|
64
|
-
return undefined;
|
|
65
|
-
}
|
|
66
|
-
// recover
|
|
67
|
-
const originalFile = match.groups.fullname;
|
|
68
|
-
let folder;
|
|
69
|
-
if (testRegex.test(match.groups.pathtest)) {
|
|
70
|
-
folder = 'test';
|
|
71
|
-
}
|
|
72
|
-
else if (match.groups.pathtest.includes('example')) {
|
|
73
|
-
folder = 'example';
|
|
74
|
-
}
|
|
75
|
-
else {
|
|
76
|
-
folder = 'default';
|
|
77
|
-
}
|
|
78
|
-
return { folder, originalFile };
|
|
79
|
-
}
|
|
80
|
-
class StatisticsSummarizer extends summarizer_1.Summarizer {
|
|
81
|
-
constructor(config) {
|
|
82
|
-
super(config);
|
|
83
|
-
}
|
|
84
|
-
removeIfExists(path) {
|
|
85
|
-
if (path && fs_1.default.existsSync(path)) {
|
|
86
|
-
this.log(`Removing existing ${path}`);
|
|
87
|
-
fs_1.default.rmSync(path, { recursive: true, force: true });
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
/**
|
|
91
|
-
* The preparation phase essentially merges all files into one by just attaching lines together!
|
|
92
|
-
*/
|
|
93
|
-
async preparationPhase(useTypeClassification) {
|
|
94
|
-
this.removeIfExists(this.config.intermediateOutputPath);
|
|
95
|
-
fs_1.default.mkdirSync(this.config.intermediateOutputPath, { recursive: true });
|
|
96
|
-
let count = 0;
|
|
97
|
-
const migrator = new process_1.FileMigrator();
|
|
98
|
-
for await (const f of (0, files_1.getAllFiles)(this.config.inputPath, /\.tar.gz$/)) {
|
|
99
|
-
this.log(`[${count++}, ${(0, time_1.date2string)()}] processing file ${f} (to ${this.config.intermediateOutputPath})`);
|
|
100
|
-
let target;
|
|
101
|
-
try {
|
|
102
|
-
target = await extractArchive(f);
|
|
103
|
-
this.log(' Collected!');
|
|
104
|
-
}
|
|
105
|
-
catch (e) {
|
|
106
|
-
this.log(` Failed to extract ${f}, skipping...`);
|
|
107
|
-
continue;
|
|
108
|
-
}
|
|
109
|
-
this.log(' Migrating files...');
|
|
110
|
-
const extracted = identifyExtractionType(path_1.default.basename(f));
|
|
111
|
-
await migrator.migrate(target, path_1.default.join(this.config.intermediateOutputPath, useTypeClassification ? extracted?.folder ?? 'default' : 'uncategorized'), extracted?.originalFile);
|
|
112
|
-
this.log(' Done! (Cleanup...)');
|
|
113
|
-
}
|
|
114
|
-
migrator.finish();
|
|
115
|
-
this.log(`Found ${count} files to summarize`);
|
|
116
|
-
return Promise.resolve();
|
|
117
|
-
}
|
|
118
|
-
// eslint-disable-next-line @typescript-eslint/require-await -- just to obey the structure
|
|
119
|
-
async summarizePhase() {
|
|
120
|
-
// detect all subfolders in the current folder (default, test...) for each: concat.
|
|
121
|
-
this.removeIfExists(this.config.outputPath);
|
|
122
|
-
fs_1.default.mkdirSync(this.config.outputPath, { recursive: true });
|
|
123
|
-
const folders = fs_1.default.readdirSync(this.config.intermediateOutputPath, { recursive: false });
|
|
124
|
-
for (const folder of folders) {
|
|
125
|
-
const folderStr = String(folder);
|
|
126
|
-
const output = path_1.default.join(this.config.outputPath, folderStr);
|
|
127
|
-
const input = path_1.default.join(this.config.intermediateOutputPath, folderStr);
|
|
128
|
-
this.log(`Summarizing for ${input} (target: ${output})`);
|
|
129
|
-
(0, process_2.postProcessFeatureFolder)(this.log, input, this.config, output);
|
|
130
|
-
}
|
|
131
|
-
return Promise.resolve(undefined);
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
exports.StatisticsSummarizer = StatisticsSummarizer;
|
|
135
|
-
//# sourceMappingURL=summarizer.js.map
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Summarizer = void 0;
|
|
4
|
-
class Summarizer {
|
|
5
|
-
config;
|
|
6
|
-
log;
|
|
7
|
-
constructor(config) {
|
|
8
|
-
this.config = config;
|
|
9
|
-
this.log = this.config.logger;
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
exports.Summarizer = Summarizer;
|
|
13
|
-
//# sourceMappingURL=summarizer.js.map
|
|
File without changes
|
|
File without changes
|