@adonisjs/assembler 5.9.0 → 5.9.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/build/ace-manifest.json +11 -11
- package/build/commands/Build.d.ts +37 -37
- package/build/commands/Build.js +138 -138
- package/build/commands/Invoke.d.ts +34 -34
- package/build/commands/Invoke.js +221 -221
- package/build/commands/Make/Base.d.ts +30 -30
- package/build/commands/Make/Base.js +75 -75
- package/build/commands/Make/Command.d.ts +35 -35
- package/build/commands/Make/Command.js +82 -82
- package/build/commands/Make/Controller.d.ts +37 -37
- package/build/commands/Make/Controller.js +89 -89
- package/build/commands/Make/Exception.d.ts +32 -32
- package/build/commands/Make/Exception.js +75 -75
- package/build/commands/Make/Listener.d.ts +30 -30
- package/build/commands/Make/Listener.js +70 -70
- package/build/commands/Make/Middleware.d.ts +31 -31
- package/build/commands/Make/Middleware.js +87 -87
- package/build/commands/Make/PreloadFile.d.ts +38 -38
- package/build/commands/Make/PreloadFile.js +157 -157
- package/build/commands/Make/Provider.d.ts +31 -31
- package/build/commands/Make/Provider.js +114 -114
- package/build/commands/Make/Suite.d.ts +41 -41
- package/build/commands/Make/Suite.js +120 -120
- package/build/commands/Make/Test.d.ts +35 -35
- package/build/commands/Make/Test.js +96 -96
- package/build/commands/Make/Validator.d.ts +31 -31
- package/build/commands/Make/Validator.js +71 -71
- package/build/commands/Make/View.d.ts +30 -30
- package/build/commands/Make/View.js +70 -70
- package/build/commands/Serve.d.ts +33 -33
- package/build/commands/Serve.js +112 -112
- package/build/commands/Test.d.ts +57 -57
- package/build/commands/Test.js +159 -159
- package/build/commands/TypeCheck.d.ts +16 -16
- package/build/commands/TypeCheck.js +85 -85
- package/build/config/paths.d.ts +7 -7
- package/build/config/paths.js +18 -18
- package/build/register.d.ts +1 -1
- package/build/register.js +15 -15
- package/build/src/AssetsBundler/index.d.ts +76 -76
- package/build/src/AssetsBundler/index.js +216 -216
- package/build/src/Compiler/index.d.ts +62 -62
- package/build/src/Compiler/index.js +287 -287
- package/build/src/Contracts/index.d.ts +8 -8
- package/build/src/Contracts/index.js +10 -10
- package/build/src/DevServer/index.d.ts +70 -70
- package/build/src/DevServer/index.js +306 -306
- package/build/src/EnvParser/index.d.ts +23 -23
- package/build/src/EnvParser/index.js +52 -52
- package/build/src/HttpServer/index.d.ts +34 -34
- package/build/src/HttpServer/index.js +87 -87
- package/build/src/Manifest/index.d.ts +32 -32
- package/build/src/Manifest/index.js +88 -88
- package/build/src/RcFile/index.d.ts +72 -72
- package/build/src/RcFile/index.js +174 -174
- package/build/src/Test/index.d.ts +75 -75
- package/build/src/Test/index.js +346 -346
- package/build/src/Test/process.d.ts +22 -22
- package/build/src/Test/process.js +68 -68
- package/build/src/Ts/index.d.ts +24 -24
- package/build/src/Ts/index.js +55 -55
- package/build/src/requireHook/index.d.ts +5 -5
- package/build/src/requireHook/index.js +28 -28
- package/build/src/requireHook/ioc-transformer.d.ts +6 -6
- package/build/src/requireHook/ioc-transformer.js +21 -21
- package/package.json +1 -1
|
@@ -1,72 +1,72 @@
|
|
|
1
|
-
import { Application } from '@adonisjs/application';
|
|
2
|
-
/**
|
|
3
|
-
* Exposes the API to pull meta files from the `.adonisrc.json` file and
|
|
4
|
-
* also match relative file paths against the defined globs.
|
|
5
|
-
*/
|
|
6
|
-
export declare class RcFile {
|
|
7
|
-
private appRoot;
|
|
8
|
-
rcFilePath: string;
|
|
9
|
-
/**
|
|
10
|
-
* Raw rcfile contents
|
|
11
|
-
*/
|
|
12
|
-
raw: any;
|
|
13
|
-
/**
|
|
14
|
-
* Reference to application
|
|
15
|
-
*/
|
|
16
|
-
application: Application;
|
|
17
|
-
/**
|
|
18
|
-
* A matcher to know if a file is part of the meta files globs
|
|
19
|
-
*/
|
|
20
|
-
isMetaFile: (filePath: string) => boolean;
|
|
21
|
-
/**
|
|
22
|
-
* A matcher to know if file is a test file or not
|
|
23
|
-
*/
|
|
24
|
-
isTestsFile: (filePath: string) => boolean;
|
|
25
|
-
/**
|
|
26
|
-
* A matcher to know if a file is part of the restart server files globs
|
|
27
|
-
*/
|
|
28
|
-
isRestartServerFile: (filePath: string) => boolean;
|
|
29
|
-
/**
|
|
30
|
-
* Commands match to know, if file path is part of the commands paths defined
|
|
31
|
-
* inside `.adonisrc.json` file
|
|
32
|
-
*/
|
|
33
|
-
isCommandsPath: (filePath: string) => boolean;
|
|
34
|
-
constructor(appRoot: string);
|
|
35
|
-
/**
|
|
36
|
-
* Returns an array of globs for the meta files that has `reloadServer`
|
|
37
|
-
* set to true
|
|
38
|
-
*/
|
|
39
|
-
private getRestartServerFilesGlob;
|
|
40
|
-
/**
|
|
41
|
-
* Returns the commands glob for registered commands. We convert the
|
|
42
|
-
* command paths to glob pattern
|
|
43
|
-
*/
|
|
44
|
-
private commandsGlob;
|
|
45
|
-
/**
|
|
46
|
-
* Returns true when file is `.adonisrc.json` itself
|
|
47
|
-
*/
|
|
48
|
-
private isRcFile;
|
|
49
|
-
/**
|
|
50
|
-
* Returns an array of globs for the meta files
|
|
51
|
-
* to be copied
|
|
52
|
-
*/
|
|
53
|
-
getMetaFilesGlob(): string[];
|
|
54
|
-
/**
|
|
55
|
-
* Returns an array of globs for the test files
|
|
56
|
-
*/
|
|
57
|
-
getTestsFileGlob(): string[];
|
|
58
|
-
/**
|
|
59
|
-
* Reloads the rcfile.json
|
|
60
|
-
*/
|
|
61
|
-
getDiskContents(): any;
|
|
62
|
-
/**
|
|
63
|
-
* Returns metadata for a given file path. The metadata can
|
|
64
|
-
* be used to execute certain actions during file watch.
|
|
65
|
-
*/
|
|
66
|
-
getMetaData(filePath: string): {
|
|
67
|
-
reload: boolean;
|
|
68
|
-
rcFile: boolean;
|
|
69
|
-
metaFile: boolean;
|
|
70
|
-
testFile: boolean;
|
|
71
|
-
};
|
|
72
|
-
}
|
|
1
|
+
import { Application } from '@adonisjs/application';
|
|
2
|
+
/**
|
|
3
|
+
* Exposes the API to pull meta files from the `.adonisrc.json` file and
|
|
4
|
+
* also match relative file paths against the defined globs.
|
|
5
|
+
*/
|
|
6
|
+
export declare class RcFile {
|
|
7
|
+
private appRoot;
|
|
8
|
+
rcFilePath: string;
|
|
9
|
+
/**
|
|
10
|
+
* Raw rcfile contents
|
|
11
|
+
*/
|
|
12
|
+
raw: any;
|
|
13
|
+
/**
|
|
14
|
+
* Reference to application
|
|
15
|
+
*/
|
|
16
|
+
application: Application;
|
|
17
|
+
/**
|
|
18
|
+
* A matcher to know if a file is part of the meta files globs
|
|
19
|
+
*/
|
|
20
|
+
isMetaFile: (filePath: string) => boolean;
|
|
21
|
+
/**
|
|
22
|
+
* A matcher to know if file is a test file or not
|
|
23
|
+
*/
|
|
24
|
+
isTestsFile: (filePath: string) => boolean;
|
|
25
|
+
/**
|
|
26
|
+
* A matcher to know if a file is part of the restart server files globs
|
|
27
|
+
*/
|
|
28
|
+
isRestartServerFile: (filePath: string) => boolean;
|
|
29
|
+
/**
|
|
30
|
+
* Commands match to know, if file path is part of the commands paths defined
|
|
31
|
+
* inside `.adonisrc.json` file
|
|
32
|
+
*/
|
|
33
|
+
isCommandsPath: (filePath: string) => boolean;
|
|
34
|
+
constructor(appRoot: string);
|
|
35
|
+
/**
|
|
36
|
+
* Returns an array of globs for the meta files that has `reloadServer`
|
|
37
|
+
* set to true
|
|
38
|
+
*/
|
|
39
|
+
private getRestartServerFilesGlob;
|
|
40
|
+
/**
|
|
41
|
+
* Returns the commands glob for registered commands. We convert the
|
|
42
|
+
* command paths to glob pattern
|
|
43
|
+
*/
|
|
44
|
+
private commandsGlob;
|
|
45
|
+
/**
|
|
46
|
+
* Returns true when file is `.adonisrc.json` itself
|
|
47
|
+
*/
|
|
48
|
+
private isRcFile;
|
|
49
|
+
/**
|
|
50
|
+
* Returns an array of globs for the meta files
|
|
51
|
+
* to be copied
|
|
52
|
+
*/
|
|
53
|
+
getMetaFilesGlob(): string[];
|
|
54
|
+
/**
|
|
55
|
+
* Returns an array of globs for the test files
|
|
56
|
+
*/
|
|
57
|
+
getTestsFileGlob(): string[];
|
|
58
|
+
/**
|
|
59
|
+
* Reloads the rcfile.json
|
|
60
|
+
*/
|
|
61
|
+
getDiskContents(): any;
|
|
62
|
+
/**
|
|
63
|
+
* Returns metadata for a given file path. The metadata can
|
|
64
|
+
* be used to execute certain actions during file watch.
|
|
65
|
+
*/
|
|
66
|
+
getMetaData(filePath: string): {
|
|
67
|
+
reload: boolean;
|
|
68
|
+
rcFile: boolean;
|
|
69
|
+
metaFile: boolean;
|
|
70
|
+
testFile: boolean;
|
|
71
|
+
};
|
|
72
|
+
}
|
|
@@ -1,174 +1,174 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*
|
|
3
|
-
* @adonisjs/assembler
|
|
4
|
-
*
|
|
5
|
-
* (c) Harminder Virk <virk@adonisjs.com>
|
|
6
|
-
*
|
|
7
|
-
* For the full copyright and license information, please view the LICENSE
|
|
8
|
-
* file that was distributed with this source code.
|
|
9
|
-
*/
|
|
10
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
11
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
12
|
-
};
|
|
13
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
-
exports.RcFile = void 0;
|
|
15
|
-
const slash_1 = __importDefault(require("slash"));
|
|
16
|
-
const picomatch_1 = __importDefault(require("picomatch"));
|
|
17
|
-
const path_1 = require("path");
|
|
18
|
-
const fs_extra_1 = require("fs-extra");
|
|
19
|
-
const application_1 = require("@adonisjs/application");
|
|
20
|
-
const helpers_1 = require("@poppinss/utils/build/helpers");
|
|
21
|
-
const paths_1 = require("../../config/paths");
|
|
22
|
-
/**
|
|
23
|
-
* Exposes the API to pull meta files from the `.adonisrc.json` file and
|
|
24
|
-
* also match relative file paths against the defined globs.
|
|
25
|
-
*/
|
|
26
|
-
class RcFile {
|
|
27
|
-
constructor(appRoot) {
|
|
28
|
-
this.appRoot = appRoot;
|
|
29
|
-
this.rcFilePath = (0, helpers_1.resolveFrom)(this.appRoot, `./${paths_1.RCFILE_NAME}`);
|
|
30
|
-
/**
|
|
31
|
-
* Raw rcfile contents
|
|
32
|
-
*/
|
|
33
|
-
this.raw = this.getDiskContents();
|
|
34
|
-
/**
|
|
35
|
-
* Reference to application
|
|
36
|
-
*/
|
|
37
|
-
this.application = new application_1.Application(this.appRoot, 'console', this.raw);
|
|
38
|
-
/**
|
|
39
|
-
* A matcher to know if a file is part of the meta files globs
|
|
40
|
-
*/
|
|
41
|
-
this.isMetaFile = (0, picomatch_1.default)(this.getMetaFilesGlob());
|
|
42
|
-
/**
|
|
43
|
-
* A matcher to know if file is a test file or not
|
|
44
|
-
*/
|
|
45
|
-
this.isTestsFile = (0, picomatch_1.default)(this.getTestsFileGlob());
|
|
46
|
-
/**
|
|
47
|
-
* A matcher to know if a file is part of the restart server files globs
|
|
48
|
-
*/
|
|
49
|
-
this.isRestartServerFile = (0, picomatch_1.default)(this.getRestartServerFilesGlob());
|
|
50
|
-
/**
|
|
51
|
-
* Commands match to know, if file path is part of the commands paths defined
|
|
52
|
-
* inside `.adonisrc.json` file
|
|
53
|
-
*/
|
|
54
|
-
this.isCommandsPath = (0, picomatch_1.default)(this.commandsGlob());
|
|
55
|
-
}
|
|
56
|
-
/**
|
|
57
|
-
* Returns an array of globs for the meta files that has `reloadServer`
|
|
58
|
-
* set to true
|
|
59
|
-
*/
|
|
60
|
-
getRestartServerFilesGlob() {
|
|
61
|
-
return this.application.rcFile.metaFiles
|
|
62
|
-
.filter(({ reloadServer, pattern }) => {
|
|
63
|
-
return reloadServer === true && ![paths_1.RCFILE_NAME, paths_1.ACE_FILE_NAME].includes(pattern);
|
|
64
|
-
})
|
|
65
|
-
.map(({ pattern }) => pattern);
|
|
66
|
-
}
|
|
67
|
-
/**
|
|
68
|
-
* Returns the commands glob for registered commands. We convert the
|
|
69
|
-
* command paths to glob pattern
|
|
70
|
-
*/
|
|
71
|
-
commandsGlob() {
|
|
72
|
-
const commands = this.application.rcFile.commands.reduce((result, commandPath) => {
|
|
73
|
-
if (/^(.){1,2}\//.test(commandPath)) {
|
|
74
|
-
commandPath = (0, slash_1.default)((0, path_1.relative)(this.appRoot, (0, path_1.join)(this.appRoot, commandPath)));
|
|
75
|
-
result = result.concat([`${commandPath}.*`, `${commandPath}/**/*`]);
|
|
76
|
-
}
|
|
77
|
-
return result;
|
|
78
|
-
}, []);
|
|
79
|
-
return commands;
|
|
80
|
-
}
|
|
81
|
-
/**
|
|
82
|
-
* Returns true when file is `.adonisrc.json` itself
|
|
83
|
-
*/
|
|
84
|
-
isRcFile(filePath) {
|
|
85
|
-
return filePath === paths_1.RCFILE_NAME;
|
|
86
|
-
}
|
|
87
|
-
/**
|
|
88
|
-
* Returns an array of globs for the meta files
|
|
89
|
-
* to be copied
|
|
90
|
-
*/
|
|
91
|
-
getMetaFilesGlob() {
|
|
92
|
-
return this.application.rcFile.metaFiles
|
|
93
|
-
.filter(({ pattern }) => ![paths_1.RCFILE_NAME, paths_1.ACE_FILE_NAME].includes(pattern))
|
|
94
|
-
.map(({ pattern }) => pattern)
|
|
95
|
-
.concat([paths_1.ACE_FILE_NAME]);
|
|
96
|
-
}
|
|
97
|
-
/**
|
|
98
|
-
* Returns an array of globs for the test files
|
|
99
|
-
*/
|
|
100
|
-
getTestsFileGlob() {
|
|
101
|
-
return this.application.rcFile.tests.suites.reduce((result, suite) => {
|
|
102
|
-
if (suite.files) {
|
|
103
|
-
result = result.concat(suite.files);
|
|
104
|
-
}
|
|
105
|
-
return result;
|
|
106
|
-
}, []);
|
|
107
|
-
}
|
|
108
|
-
/**
|
|
109
|
-
* Reloads the rcfile.json
|
|
110
|
-
*/
|
|
111
|
-
getDiskContents() {
|
|
112
|
-
return (0, fs_extra_1.readJSONSync)(this.rcFilePath);
|
|
113
|
-
}
|
|
114
|
-
/**
|
|
115
|
-
* Returns metadata for a given file path. The metadata can
|
|
116
|
-
* be used to execute certain actions during file watch.
|
|
117
|
-
*/
|
|
118
|
-
getMetaData(filePath) {
|
|
119
|
-
/**
|
|
120
|
-
* File path === '.adonisrc.json'
|
|
121
|
-
*/
|
|
122
|
-
if (this.isRcFile(filePath)) {
|
|
123
|
-
return {
|
|
124
|
-
reload: true,
|
|
125
|
-
rcFile: true,
|
|
126
|
-
metaFile: true,
|
|
127
|
-
testFile: false,
|
|
128
|
-
};
|
|
129
|
-
}
|
|
130
|
-
/**
|
|
131
|
-
* File is part of `reloadServer` metadata file globs
|
|
132
|
-
*/
|
|
133
|
-
if (this.isRestartServerFile(filePath)) {
|
|
134
|
-
return {
|
|
135
|
-
reload: true,
|
|
136
|
-
rcFile: false,
|
|
137
|
-
metaFile: true,
|
|
138
|
-
testFile: false,
|
|
139
|
-
};
|
|
140
|
-
}
|
|
141
|
-
/**
|
|
142
|
-
* File is part of metadata file globs, but reload = false
|
|
143
|
-
*/
|
|
144
|
-
if (this.isMetaFile(filePath)) {
|
|
145
|
-
return {
|
|
146
|
-
reload: false,
|
|
147
|
-
rcFile: false,
|
|
148
|
-
metaFile: true,
|
|
149
|
-
testFile: false,
|
|
150
|
-
};
|
|
151
|
-
}
|
|
152
|
-
/**
|
|
153
|
-
* File is part of one of the tests suite
|
|
154
|
-
*/
|
|
155
|
-
if (this.isTestsFile(filePath)) {
|
|
156
|
-
return {
|
|
157
|
-
reload: false,
|
|
158
|
-
rcFile: false,
|
|
159
|
-
metaFile: false,
|
|
160
|
-
testFile: true,
|
|
161
|
-
};
|
|
162
|
-
}
|
|
163
|
-
/**
|
|
164
|
-
* Out of scope
|
|
165
|
-
*/
|
|
166
|
-
return {
|
|
167
|
-
reload: false,
|
|
168
|
-
rcFile: false,
|
|
169
|
-
metaFile: false,
|
|
170
|
-
testFile: false,
|
|
171
|
-
};
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
exports.RcFile = RcFile;
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* @adonisjs/assembler
|
|
4
|
+
*
|
|
5
|
+
* (c) Harminder Virk <virk@adonisjs.com>
|
|
6
|
+
*
|
|
7
|
+
* For the full copyright and license information, please view the LICENSE
|
|
8
|
+
* file that was distributed with this source code.
|
|
9
|
+
*/
|
|
10
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
11
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
12
|
+
};
|
|
13
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
+
exports.RcFile = void 0;
|
|
15
|
+
const slash_1 = __importDefault(require("slash"));
|
|
16
|
+
const picomatch_1 = __importDefault(require("picomatch"));
|
|
17
|
+
const path_1 = require("path");
|
|
18
|
+
const fs_extra_1 = require("fs-extra");
|
|
19
|
+
const application_1 = require("@adonisjs/application");
|
|
20
|
+
const helpers_1 = require("@poppinss/utils/build/helpers");
|
|
21
|
+
const paths_1 = require("../../config/paths");
|
|
22
|
+
/**
|
|
23
|
+
* Exposes the API to pull meta files from the `.adonisrc.json` file and
|
|
24
|
+
* also match relative file paths against the defined globs.
|
|
25
|
+
*/
|
|
26
|
+
class RcFile {
|
|
27
|
+
constructor(appRoot) {
|
|
28
|
+
this.appRoot = appRoot;
|
|
29
|
+
this.rcFilePath = (0, helpers_1.resolveFrom)(this.appRoot, `./${paths_1.RCFILE_NAME}`);
|
|
30
|
+
/**
|
|
31
|
+
* Raw rcfile contents
|
|
32
|
+
*/
|
|
33
|
+
this.raw = this.getDiskContents();
|
|
34
|
+
/**
|
|
35
|
+
* Reference to application
|
|
36
|
+
*/
|
|
37
|
+
this.application = new application_1.Application(this.appRoot, 'console', this.raw);
|
|
38
|
+
/**
|
|
39
|
+
* A matcher to know if a file is part of the meta files globs
|
|
40
|
+
*/
|
|
41
|
+
this.isMetaFile = (0, picomatch_1.default)(this.getMetaFilesGlob());
|
|
42
|
+
/**
|
|
43
|
+
* A matcher to know if file is a test file or not
|
|
44
|
+
*/
|
|
45
|
+
this.isTestsFile = (0, picomatch_1.default)(this.getTestsFileGlob());
|
|
46
|
+
/**
|
|
47
|
+
* A matcher to know if a file is part of the restart server files globs
|
|
48
|
+
*/
|
|
49
|
+
this.isRestartServerFile = (0, picomatch_1.default)(this.getRestartServerFilesGlob());
|
|
50
|
+
/**
|
|
51
|
+
* Commands match to know, if file path is part of the commands paths defined
|
|
52
|
+
* inside `.adonisrc.json` file
|
|
53
|
+
*/
|
|
54
|
+
this.isCommandsPath = (0, picomatch_1.default)(this.commandsGlob());
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Returns an array of globs for the meta files that has `reloadServer`
|
|
58
|
+
* set to true
|
|
59
|
+
*/
|
|
60
|
+
getRestartServerFilesGlob() {
|
|
61
|
+
return this.application.rcFile.metaFiles
|
|
62
|
+
.filter(({ reloadServer, pattern }) => {
|
|
63
|
+
return reloadServer === true && ![paths_1.RCFILE_NAME, paths_1.ACE_FILE_NAME].includes(pattern);
|
|
64
|
+
})
|
|
65
|
+
.map(({ pattern }) => pattern);
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Returns the commands glob for registered commands. We convert the
|
|
69
|
+
* command paths to glob pattern
|
|
70
|
+
*/
|
|
71
|
+
commandsGlob() {
|
|
72
|
+
const commands = this.application.rcFile.commands.reduce((result, commandPath) => {
|
|
73
|
+
if (/^(.){1,2}\//.test(commandPath)) {
|
|
74
|
+
commandPath = (0, slash_1.default)((0, path_1.relative)(this.appRoot, (0, path_1.join)(this.appRoot, commandPath)));
|
|
75
|
+
result = result.concat([`${commandPath}.*`, `${commandPath}/**/*`]);
|
|
76
|
+
}
|
|
77
|
+
return result;
|
|
78
|
+
}, []);
|
|
79
|
+
return commands;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Returns true when file is `.adonisrc.json` itself
|
|
83
|
+
*/
|
|
84
|
+
isRcFile(filePath) {
|
|
85
|
+
return filePath === paths_1.RCFILE_NAME;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Returns an array of globs for the meta files
|
|
89
|
+
* to be copied
|
|
90
|
+
*/
|
|
91
|
+
getMetaFilesGlob() {
|
|
92
|
+
return this.application.rcFile.metaFiles
|
|
93
|
+
.filter(({ pattern }) => ![paths_1.RCFILE_NAME, paths_1.ACE_FILE_NAME].includes(pattern))
|
|
94
|
+
.map(({ pattern }) => pattern)
|
|
95
|
+
.concat([paths_1.ACE_FILE_NAME]);
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Returns an array of globs for the test files
|
|
99
|
+
*/
|
|
100
|
+
getTestsFileGlob() {
|
|
101
|
+
return this.application.rcFile.tests.suites.reduce((result, suite) => {
|
|
102
|
+
if (suite.files) {
|
|
103
|
+
result = result.concat(suite.files);
|
|
104
|
+
}
|
|
105
|
+
return result;
|
|
106
|
+
}, []);
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Reloads the rcfile.json
|
|
110
|
+
*/
|
|
111
|
+
getDiskContents() {
|
|
112
|
+
return (0, fs_extra_1.readJSONSync)(this.rcFilePath);
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Returns metadata for a given file path. The metadata can
|
|
116
|
+
* be used to execute certain actions during file watch.
|
|
117
|
+
*/
|
|
118
|
+
getMetaData(filePath) {
|
|
119
|
+
/**
|
|
120
|
+
* File path === '.adonisrc.json'
|
|
121
|
+
*/
|
|
122
|
+
if (this.isRcFile(filePath)) {
|
|
123
|
+
return {
|
|
124
|
+
reload: true,
|
|
125
|
+
rcFile: true,
|
|
126
|
+
metaFile: true,
|
|
127
|
+
testFile: false,
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* File is part of `reloadServer` metadata file globs
|
|
132
|
+
*/
|
|
133
|
+
if (this.isRestartServerFile(filePath)) {
|
|
134
|
+
return {
|
|
135
|
+
reload: true,
|
|
136
|
+
rcFile: false,
|
|
137
|
+
metaFile: true,
|
|
138
|
+
testFile: false,
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* File is part of metadata file globs, but reload = false
|
|
143
|
+
*/
|
|
144
|
+
if (this.isMetaFile(filePath)) {
|
|
145
|
+
return {
|
|
146
|
+
reload: false,
|
|
147
|
+
rcFile: false,
|
|
148
|
+
metaFile: true,
|
|
149
|
+
testFile: false,
|
|
150
|
+
};
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* File is part of one of the tests suite
|
|
154
|
+
*/
|
|
155
|
+
if (this.isTestsFile(filePath)) {
|
|
156
|
+
return {
|
|
157
|
+
reload: false,
|
|
158
|
+
rcFile: false,
|
|
159
|
+
metaFile: false,
|
|
160
|
+
testFile: true,
|
|
161
|
+
};
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* Out of scope
|
|
165
|
+
*/
|
|
166
|
+
return {
|
|
167
|
+
reload: false,
|
|
168
|
+
rcFile: false,
|
|
169
|
+
metaFile: false,
|
|
170
|
+
testFile: false,
|
|
171
|
+
};
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
exports.RcFile = RcFile;
|
|
@@ -1,75 +1,75 @@
|
|
|
1
|
-
import { logger as uiLogger } from '@poppinss/cliui';
|
|
2
|
-
import { JapaFlags } from '../Contracts';
|
|
3
|
-
/**
|
|
4
|
-
* Exposes the API to watch project for compilition changes and
|
|
5
|
-
* run/re-run tests
|
|
6
|
-
*/
|
|
7
|
-
export declare class TestsServer {
|
|
8
|
-
private appRoot;
|
|
9
|
-
private filters;
|
|
10
|
-
private nodeArgs;
|
|
11
|
-
private logger;
|
|
12
|
-
/**
|
|
13
|
-
* A boolean to know if we are watching for filesystem
|
|
14
|
-
*/
|
|
15
|
-
private watchingFileSystem;
|
|
16
|
-
/**
|
|
17
|
-
* Boolean to hold the current state of tests. This is avoid
|
|
18
|
-
* re-running the tests when one run is in progress
|
|
19
|
-
*/
|
|
20
|
-
private busy;
|
|
21
|
-
/**
|
|
22
|
-
* Reference to the typescript compiler
|
|
23
|
-
*/
|
|
24
|
-
private ts;
|
|
25
|
-
/**
|
|
26
|
-
* Reference to the RCFile
|
|
27
|
-
*/
|
|
28
|
-
private rcFile;
|
|
29
|
-
/**
|
|
30
|
-
* Manifest instance to generate ace manifest file
|
|
31
|
-
*/
|
|
32
|
-
private manifest;
|
|
33
|
-
/**
|
|
34
|
-
* Require-ts watch helpers
|
|
35
|
-
*/
|
|
36
|
-
private watchHelpers;
|
|
37
|
-
/**
|
|
38
|
-
* A method to know if the file is part of the selected suites
|
|
39
|
-
* or not
|
|
40
|
-
*/
|
|
41
|
-
private isTestSuiteFile;
|
|
42
|
-
/**
|
|
43
|
-
* Find if the test file part of the applied file filters
|
|
44
|
-
*/
|
|
45
|
-
private isTestFile;
|
|
46
|
-
constructor(appRoot: string, filters: JapaFlags, nodeArgs?: string[], logger?: typeof uiLogger);
|
|
47
|
-
/**
|
|
48
|
-
* Clear terminal screen
|
|
49
|
-
*/
|
|
50
|
-
private clearScreen;
|
|
51
|
-
/**
|
|
52
|
-
* Returns the glob paths for test suites. Returns all if no
|
|
53
|
-
* filter is applied. Otherwise only the filtered suites
|
|
54
|
-
* are picked.
|
|
55
|
-
*/
|
|
56
|
-
private getFilesForSelectedSuites;
|
|
57
|
-
/**
|
|
58
|
-
* Kill current process
|
|
59
|
-
*/
|
|
60
|
-
private kill;
|
|
61
|
-
/**
|
|
62
|
-
* Returns the HOST and the PORT environment variables
|
|
63
|
-
* for the HTTP server
|
|
64
|
-
*/
|
|
65
|
-
private getEnvironmentVariables;
|
|
66
|
-
/**
|
|
67
|
-
* Run tests. Use [[watch]] to also watch for file
|
|
68
|
-
* changes
|
|
69
|
-
*/
|
|
70
|
-
run(filePath?: string): Promise<void>;
|
|
71
|
-
/**
|
|
72
|
-
* Build and watch for file changes
|
|
73
|
-
*/
|
|
74
|
-
watch(poll?: boolean): Promise<void>;
|
|
75
|
-
}
|
|
1
|
+
import { logger as uiLogger } from '@poppinss/cliui';
|
|
2
|
+
import { JapaFlags } from '../Contracts';
|
|
3
|
+
/**
|
|
4
|
+
* Exposes the API to watch project for compilition changes and
|
|
5
|
+
* run/re-run tests
|
|
6
|
+
*/
|
|
7
|
+
export declare class TestsServer {
|
|
8
|
+
private appRoot;
|
|
9
|
+
private filters;
|
|
10
|
+
private nodeArgs;
|
|
11
|
+
private logger;
|
|
12
|
+
/**
|
|
13
|
+
* A boolean to know if we are watching for filesystem
|
|
14
|
+
*/
|
|
15
|
+
private watchingFileSystem;
|
|
16
|
+
/**
|
|
17
|
+
* Boolean to hold the current state of tests. This is avoid
|
|
18
|
+
* re-running the tests when one run is in progress
|
|
19
|
+
*/
|
|
20
|
+
private busy;
|
|
21
|
+
/**
|
|
22
|
+
* Reference to the typescript compiler
|
|
23
|
+
*/
|
|
24
|
+
private ts;
|
|
25
|
+
/**
|
|
26
|
+
* Reference to the RCFile
|
|
27
|
+
*/
|
|
28
|
+
private rcFile;
|
|
29
|
+
/**
|
|
30
|
+
* Manifest instance to generate ace manifest file
|
|
31
|
+
*/
|
|
32
|
+
private manifest;
|
|
33
|
+
/**
|
|
34
|
+
* Require-ts watch helpers
|
|
35
|
+
*/
|
|
36
|
+
private watchHelpers;
|
|
37
|
+
/**
|
|
38
|
+
* A method to know if the file is part of the selected suites
|
|
39
|
+
* or not
|
|
40
|
+
*/
|
|
41
|
+
private isTestSuiteFile;
|
|
42
|
+
/**
|
|
43
|
+
* Find if the test file part of the applied file filters
|
|
44
|
+
*/
|
|
45
|
+
private isTestFile;
|
|
46
|
+
constructor(appRoot: string, filters: JapaFlags, nodeArgs?: string[], logger?: typeof uiLogger);
|
|
47
|
+
/**
|
|
48
|
+
* Clear terminal screen
|
|
49
|
+
*/
|
|
50
|
+
private clearScreen;
|
|
51
|
+
/**
|
|
52
|
+
* Returns the glob paths for test suites. Returns all if no
|
|
53
|
+
* filter is applied. Otherwise only the filtered suites
|
|
54
|
+
* are picked.
|
|
55
|
+
*/
|
|
56
|
+
private getFilesForSelectedSuites;
|
|
57
|
+
/**
|
|
58
|
+
* Kill current process
|
|
59
|
+
*/
|
|
60
|
+
private kill;
|
|
61
|
+
/**
|
|
62
|
+
* Returns the HOST and the PORT environment variables
|
|
63
|
+
* for the HTTP server
|
|
64
|
+
*/
|
|
65
|
+
private getEnvironmentVariables;
|
|
66
|
+
/**
|
|
67
|
+
* Run tests. Use [[watch]] to also watch for file
|
|
68
|
+
* changes
|
|
69
|
+
*/
|
|
70
|
+
run(filePath?: string): Promise<void>;
|
|
71
|
+
/**
|
|
72
|
+
* Build and watch for file changes
|
|
73
|
+
*/
|
|
74
|
+
watch(poll?: boolean): Promise<void>;
|
|
75
|
+
}
|