@adonisjs/assembler 5.9.0 → 5.9.2

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.
Files changed (65) hide show
  1. package/build/commands/Build.d.ts +37 -37
  2. package/build/commands/Build.js +138 -138
  3. package/build/commands/Invoke.d.ts +34 -34
  4. package/build/commands/Invoke.js +221 -221
  5. package/build/commands/Make/Base.d.ts +30 -30
  6. package/build/commands/Make/Base.js +75 -75
  7. package/build/commands/Make/Command.d.ts +35 -35
  8. package/build/commands/Make/Command.js +82 -82
  9. package/build/commands/Make/Controller.d.ts +37 -37
  10. package/build/commands/Make/Controller.js +89 -89
  11. package/build/commands/Make/Exception.d.ts +32 -32
  12. package/build/commands/Make/Exception.js +75 -75
  13. package/build/commands/Make/Listener.d.ts +30 -30
  14. package/build/commands/Make/Listener.js +70 -70
  15. package/build/commands/Make/Middleware.d.ts +31 -31
  16. package/build/commands/Make/Middleware.js +87 -87
  17. package/build/commands/Make/PreloadFile.d.ts +38 -38
  18. package/build/commands/Make/PreloadFile.js +157 -157
  19. package/build/commands/Make/Provider.d.ts +31 -31
  20. package/build/commands/Make/Provider.js +114 -114
  21. package/build/commands/Make/Suite.d.ts +41 -41
  22. package/build/commands/Make/Suite.js +120 -120
  23. package/build/commands/Make/Test.d.ts +35 -35
  24. package/build/commands/Make/Test.js +96 -96
  25. package/build/commands/Make/Validator.d.ts +31 -31
  26. package/build/commands/Make/Validator.js +71 -71
  27. package/build/commands/Make/View.d.ts +30 -30
  28. package/build/commands/Make/View.js +70 -70
  29. package/build/commands/Serve.d.ts +33 -33
  30. package/build/commands/Serve.js +112 -112
  31. package/build/commands/Test.d.ts +57 -57
  32. package/build/commands/Test.js +159 -159
  33. package/build/commands/TypeCheck.d.ts +16 -16
  34. package/build/commands/TypeCheck.js +85 -85
  35. package/build/config/paths.d.ts +7 -7
  36. package/build/config/paths.js +18 -18
  37. package/build/register.d.ts +1 -1
  38. package/build/register.js +15 -15
  39. package/build/src/AssetsBundler/index.d.ts +76 -76
  40. package/build/src/AssetsBundler/index.js +216 -216
  41. package/build/src/Compiler/index.d.ts +62 -62
  42. package/build/src/Compiler/index.js +287 -287
  43. package/build/src/Contracts/index.d.ts +8 -8
  44. package/build/src/Contracts/index.js +10 -10
  45. package/build/src/DevServer/index.d.ts +70 -70
  46. package/build/src/DevServer/index.js +306 -306
  47. package/build/src/EnvParser/index.d.ts +23 -23
  48. package/build/src/EnvParser/index.js +52 -52
  49. package/build/src/HttpServer/index.d.ts +34 -34
  50. package/build/src/HttpServer/index.js +87 -87
  51. package/build/src/Manifest/index.d.ts +32 -32
  52. package/build/src/Manifest/index.js +88 -88
  53. package/build/src/RcFile/index.d.ts +72 -72
  54. package/build/src/RcFile/index.js +174 -174
  55. package/build/src/Test/index.d.ts +75 -75
  56. package/build/src/Test/index.js +346 -346
  57. package/build/src/Test/process.d.ts +22 -22
  58. package/build/src/Test/process.js +68 -68
  59. package/build/src/Ts/index.d.ts +24 -24
  60. package/build/src/Ts/index.js +55 -55
  61. package/build/src/requireHook/index.d.ts +5 -5
  62. package/build/src/requireHook/index.js +28 -28
  63. package/build/src/requireHook/ioc-transformer.d.ts +6 -6
  64. package/build/src/requireHook/ioc-transformer.js +21 -21
  65. package/package.json +1 -1
@@ -1,306 +1,306 @@
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.DevServer = void 0;
15
- const get_port_1 = __importDefault(require("get-port"));
16
- const require_ts_1 = require("@adonisjs/require-ts");
17
- const cliui_1 = require("@poppinss/cliui");
18
- const Ts_1 = require("../Ts");
19
- const RcFile_1 = require("../RcFile");
20
- const Manifest_1 = require("../Manifest");
21
- const EnvParser_1 = require("../EnvParser");
22
- const HttpServer_1 = require("../HttpServer");
23
- const paths_1 = require("../../config/paths");
24
- const AssetsBundler_1 = require("../AssetsBundler");
25
- /**
26
- * Exposes the API to watch project for compilition changes.
27
- */
28
- class DevServer {
29
- constructor(appRoot, nodeArgs = [], encoreArgs, buildAssets, logger = cliui_1.logger) {
30
- this.appRoot = appRoot;
31
- this.nodeArgs = nodeArgs;
32
- this.encoreArgs = encoreArgs;
33
- this.buildAssets = buildAssets;
34
- this.logger = logger;
35
- /**
36
- * A boolean to know if we are watching for filesystem
37
- */
38
- this.watchingFileSystem = false;
39
- /**
40
- * Watcher state
41
- */
42
- this.watcherState = 'pending';
43
- /**
44
- * Reference to the typescript compiler
45
- */
46
- this.ts = new Ts_1.Ts(this.appRoot, this.logger);
47
- /**
48
- * Reference to the RCFile
49
- */
50
- this.rcFile = new RcFile_1.RcFile(this.appRoot);
51
- /**
52
- * Manifest instance to generate ace manifest file
53
- */
54
- this.manifest = new Manifest_1.Manifest(this.appRoot, this.logger);
55
- /**
56
- * Require-ts watch helpers
57
- */
58
- this.watchHelpers = (0, require_ts_1.getWatcherHelpers)(this.appRoot);
59
- }
60
- /**
61
- * Kill current process
62
- */
63
- kill() {
64
- this.logger.info('shutting down');
65
- process.exit();
66
- }
67
- /**
68
- * Create the http server
69
- */
70
- async createHttpServer() {
71
- if (this.httpServer) {
72
- return;
73
- }
74
- const envParser = new EnvParser_1.EnvParser();
75
- await envParser.parse(this.appRoot);
76
- const envOptions = envParser.asEnvObject(['PORT', 'TZ', 'HOST']);
77
- const HOST = process.env.HOST || envOptions.HOST || '0.0.0.0';
78
- let PORT = process.env.PORT || envOptions.PORT || '3333';
79
- /**
80
- * Obtains a random port by giving preference to the one defined inside
81
- * the `.env` file. This eases the process of running the application
82
- * without manually changing ports inside the `.env` file when
83
- * original port is in use.
84
- */
85
- if (!isNaN(Number(PORT))) {
86
- PORT = String(await (0, get_port_1.default)({
87
- port: [Number(PORT)],
88
- host: HOST,
89
- }));
90
- }
91
- this.httpServer = new HttpServer_1.HttpServer(paths_1.SERVER_ENTRY_FILE, this.appRoot, this.nodeArgs, this.logger, {
92
- PORT,
93
- HOST,
94
- TZ: envOptions.TZ,
95
- });
96
- }
97
- /**
98
- * Renders box to notify about the server state
99
- */
100
- renderServerIsReady() {
101
- if (!this.serverHost || !this.serverPort) {
102
- return;
103
- }
104
- if (this.watchingFileSystem && this.watcherState === 'pending') {
105
- return;
106
- }
107
- const stickerInstance = (0, cliui_1.sticker)();
108
- stickerInstance
109
- .add(`Server address: ${this.logger.colors.cyan(`http://${this.serverHost === '0.0.0.0' ? '127.0.0.1' : this.serverHost}:${this.serverPort}`)}`)
110
- .add(`Watching filesystem for changes: ${this.logger.colors.cyan(this.watchingFileSystem ? 'YES' : 'NO')}`);
111
- /**
112
- * Running the encore dev server
113
- */
114
- if (this.encoreDevServerResponse.state === 'running') {
115
- stickerInstance.add(`Encore server address: ${this.logger.colors.cyan(`http://${this.encoreDevServerResponse.host}:${this.encoreDevServerResponse.port}`)}`);
116
- }
117
- stickerInstance.render();
118
- }
119
- /**
120
- * Start the dev server. Use [[watch]] to also watch for file
121
- * changes
122
- */
123
- async start() {
124
- /**
125
- * Log getting ready
126
- */
127
- this.logger.info('building project...');
128
- /**
129
- * Start the HTTP server right away
130
- */
131
- await this.createHttpServer();
132
- this.httpServer.start();
133
- /**
134
- * Notify that the http server has died
135
- */
136
- this.httpServer.on('exit', ({ code }) => {
137
- this.logger.warning(`Underlying HTTP server died with "${code} code"`);
138
- });
139
- /**
140
- * Notify that the http server is running
141
- */
142
- this.httpServer.on('ready', ({ port, host }) => {
143
- this.serverPort = port;
144
- this.serverHost = host;
145
- this.renderServerIsReady();
146
- });
147
- const encore = new AssetsBundler_1.AssetsBundler(this.appRoot, this.encoreArgs, this.buildAssets, this.logger);
148
- encore.on('exit', ({ code }) => {
149
- this.logger.warning(`Underlying encore dev server died with "${code} code"`);
150
- });
151
- this.encoreDevServerResponse = await encore.startDevServer();
152
- }
153
- /**
154
- * Build and watch for file changes
155
- */
156
- async watch(poll = false) {
157
- this.watchingFileSystem = true;
158
- /**
159
- * Clear require-ts cache
160
- */
161
- this.watchHelpers.clear();
162
- /**
163
- * Start HTTP server
164
- */
165
- await this.start();
166
- /**
167
- * Parse config to find the files excluded inside
168
- * tsconfig file
169
- */
170
- const config = this.ts.parseConfig();
171
- if (!config) {
172
- this.logger.warning('Cannot start watcher because of errors in the config file');
173
- this.watcherState = 'error';
174
- this.renderServerIsReady();
175
- return;
176
- }
177
- /**
178
- * Stick file watcher
179
- */
180
- const watcher = this.ts.tsCompiler.watcher(config, 'raw');
181
- /**
182
- * Watcher is ready after first compile
183
- */
184
- watcher.on('watcher:ready', () => {
185
- this.logger.info('watching file system for changes');
186
- this.watcherState = 'ready';
187
- this.renderServerIsReady();
188
- });
189
- /**
190
- * Source file removed
191
- */
192
- watcher.on('source:unlink', async ({ absPath, relativePath }) => {
193
- this.watchHelpers.clear(absPath);
194
- this.logger.action('delete').succeeded(relativePath);
195
- /**
196
- * Generate manifest when filePath is a commands path
197
- */
198
- if (this.rcFile.isCommandsPath(relativePath)) {
199
- this.manifest.generate();
200
- }
201
- this.httpServer.restart();
202
- });
203
- /**
204
- * Source file added
205
- */
206
- watcher.on('source:add', async ({ absPath, relativePath }) => {
207
- this.watchHelpers.clear(absPath);
208
- this.logger.action('add').succeeded(relativePath);
209
- /**
210
- * Generate manifest when filePath if file is in commands path
211
- */
212
- if (this.rcFile.isCommandsPath(relativePath)) {
213
- this.manifest.generate();
214
- }
215
- this.httpServer.restart();
216
- });
217
- /**
218
- * Source file changed
219
- */
220
- watcher.on('source:change', async ({ absPath, relativePath }) => {
221
- this.watchHelpers.clear(absPath);
222
- this.logger.action('update').succeeded(relativePath);
223
- /**
224
- * Generate manifest when filePath is a commands path
225
- */
226
- if (this.rcFile.isCommandsPath(relativePath)) {
227
- this.manifest.generate();
228
- }
229
- this.httpServer.restart();
230
- });
231
- /**
232
- * New file added
233
- */
234
- watcher.on('add', async ({ relativePath }) => {
235
- if (paths_1.ENV_FILES.includes(relativePath)) {
236
- this.logger.action('create').succeeded(relativePath);
237
- this.httpServer.restart();
238
- return;
239
- }
240
- const metaData = this.rcFile.getMetaData(relativePath);
241
- if (!metaData.metaFile) {
242
- return;
243
- }
244
- this.logger.action('create').succeeded(relativePath);
245
- if (metaData.reload) {
246
- this.httpServer.restart();
247
- }
248
- });
249
- /**
250
- * File changed
251
- */
252
- watcher.on('change', async ({ relativePath }) => {
253
- if (paths_1.ENV_FILES.includes(relativePath)) {
254
- this.logger.action('update').succeeded(relativePath);
255
- this.httpServer.restart();
256
- return;
257
- }
258
- const metaData = this.rcFile.getMetaData(relativePath);
259
- if (!metaData.metaFile) {
260
- return;
261
- }
262
- this.logger.action('update').succeeded(relativePath);
263
- if (metaData.reload || metaData.rcFile) {
264
- this.httpServer.restart();
265
- }
266
- });
267
- /**
268
- * File removed
269
- */
270
- watcher.on('unlink', async ({ relativePath }) => {
271
- if (paths_1.ENV_FILES.includes(relativePath)) {
272
- this.logger.action('delete').succeeded(relativePath);
273
- this.httpServer.restart();
274
- return;
275
- }
276
- const metaData = this.rcFile.getMetaData(relativePath);
277
- if (!metaData.metaFile) {
278
- return;
279
- }
280
- if (metaData.rcFile) {
281
- this.logger.info('cannot continue after deletion of .adonisrc.json file');
282
- watcher.chokidar.close();
283
- this.kill();
284
- return;
285
- }
286
- this.logger.action('delete').succeeded(relativePath);
287
- if (metaData.reload) {
288
- this.httpServer.restart();
289
- }
290
- });
291
- /**
292
- * Start the watcher
293
- */
294
- watcher.watch(['.'], {
295
- usePolling: poll,
296
- });
297
- /**
298
- * Kill when watcher recieves an error
299
- */
300
- watcher.chokidar.on('error', (error) => {
301
- this.logger.fatal(error);
302
- this.kill();
303
- });
304
- }
305
- }
306
- exports.DevServer = DevServer;
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.DevServer = void 0;
15
+ const get_port_1 = __importDefault(require("get-port"));
16
+ const require_ts_1 = require("@adonisjs/require-ts");
17
+ const cliui_1 = require("@poppinss/cliui");
18
+ const Ts_1 = require("../Ts");
19
+ const RcFile_1 = require("../RcFile");
20
+ const Manifest_1 = require("../Manifest");
21
+ const EnvParser_1 = require("../EnvParser");
22
+ const HttpServer_1 = require("../HttpServer");
23
+ const paths_1 = require("../../config/paths");
24
+ const AssetsBundler_1 = require("../AssetsBundler");
25
+ /**
26
+ * Exposes the API to watch project for compilition changes.
27
+ */
28
+ class DevServer {
29
+ constructor(appRoot, nodeArgs = [], encoreArgs, buildAssets, logger = cliui_1.logger) {
30
+ this.appRoot = appRoot;
31
+ this.nodeArgs = nodeArgs;
32
+ this.encoreArgs = encoreArgs;
33
+ this.buildAssets = buildAssets;
34
+ this.logger = logger;
35
+ /**
36
+ * A boolean to know if we are watching for filesystem
37
+ */
38
+ this.watchingFileSystem = false;
39
+ /**
40
+ * Watcher state
41
+ */
42
+ this.watcherState = 'pending';
43
+ /**
44
+ * Reference to the typescript compiler
45
+ */
46
+ this.ts = new Ts_1.Ts(this.appRoot, this.logger);
47
+ /**
48
+ * Reference to the RCFile
49
+ */
50
+ this.rcFile = new RcFile_1.RcFile(this.appRoot);
51
+ /**
52
+ * Manifest instance to generate ace manifest file
53
+ */
54
+ this.manifest = new Manifest_1.Manifest(this.appRoot, this.logger);
55
+ /**
56
+ * Require-ts watch helpers
57
+ */
58
+ this.watchHelpers = (0, require_ts_1.getWatcherHelpers)(this.appRoot);
59
+ }
60
+ /**
61
+ * Kill current process
62
+ */
63
+ kill() {
64
+ this.logger.info('shutting down');
65
+ process.exit();
66
+ }
67
+ /**
68
+ * Create the http server
69
+ */
70
+ async createHttpServer() {
71
+ if (this.httpServer) {
72
+ return;
73
+ }
74
+ const envParser = new EnvParser_1.EnvParser();
75
+ await envParser.parse(this.appRoot);
76
+ const envOptions = envParser.asEnvObject(['PORT', 'TZ', 'HOST']);
77
+ const HOST = process.env.HOST || envOptions.HOST || '0.0.0.0';
78
+ let PORT = process.env.PORT || envOptions.PORT || '3333';
79
+ /**
80
+ * Obtains a random port by giving preference to the one defined inside
81
+ * the `.env` file. This eases the process of running the application
82
+ * without manually changing ports inside the `.env` file when
83
+ * original port is in use.
84
+ */
85
+ if (!isNaN(Number(PORT))) {
86
+ PORT = String(await (0, get_port_1.default)({
87
+ port: [Number(PORT)],
88
+ host: HOST,
89
+ }));
90
+ }
91
+ this.httpServer = new HttpServer_1.HttpServer(paths_1.SERVER_ENTRY_FILE, this.appRoot, this.nodeArgs, this.logger, {
92
+ PORT,
93
+ HOST,
94
+ TZ: envOptions.TZ,
95
+ });
96
+ }
97
+ /**
98
+ * Renders box to notify about the server state
99
+ */
100
+ renderServerIsReady() {
101
+ if (!this.serverHost || !this.serverPort) {
102
+ return;
103
+ }
104
+ if (this.watchingFileSystem && this.watcherState === 'pending') {
105
+ return;
106
+ }
107
+ const stickerInstance = (0, cliui_1.sticker)();
108
+ stickerInstance
109
+ .add(`Server address: ${this.logger.colors.cyan(`http://${this.serverHost === '0.0.0.0' ? '127.0.0.1' : this.serverHost}:${this.serverPort}`)}`)
110
+ .add(`Watching filesystem for changes: ${this.logger.colors.cyan(this.watchingFileSystem ? 'YES' : 'NO')}`);
111
+ /**
112
+ * Running the encore dev server
113
+ */
114
+ if (this.encoreDevServerResponse.state === 'running') {
115
+ stickerInstance.add(`Encore server address: ${this.logger.colors.cyan(`http://${this.encoreDevServerResponse.host}:${this.encoreDevServerResponse.port}`)}`);
116
+ }
117
+ stickerInstance.render();
118
+ }
119
+ /**
120
+ * Start the dev server. Use [[watch]] to also watch for file
121
+ * changes
122
+ */
123
+ async start() {
124
+ /**
125
+ * Log getting ready
126
+ */
127
+ this.logger.info('building project...');
128
+ /**
129
+ * Start the HTTP server right away
130
+ */
131
+ await this.createHttpServer();
132
+ this.httpServer.start();
133
+ /**
134
+ * Notify that the http server has died
135
+ */
136
+ this.httpServer.on('exit', ({ code }) => {
137
+ this.logger.warning(`Underlying HTTP server died with "${code} code"`);
138
+ });
139
+ /**
140
+ * Notify that the http server is running
141
+ */
142
+ this.httpServer.on('ready', ({ port, host }) => {
143
+ this.serverPort = port;
144
+ this.serverHost = host;
145
+ this.renderServerIsReady();
146
+ });
147
+ const encore = new AssetsBundler_1.AssetsBundler(this.appRoot, this.encoreArgs, this.buildAssets, this.logger);
148
+ encore.on('exit', ({ code }) => {
149
+ this.logger.warning(`Underlying encore dev server died with "${code} code"`);
150
+ });
151
+ this.encoreDevServerResponse = await encore.startDevServer();
152
+ }
153
+ /**
154
+ * Build and watch for file changes
155
+ */
156
+ async watch(poll = false) {
157
+ this.watchingFileSystem = true;
158
+ /**
159
+ * Clear require-ts cache
160
+ */
161
+ this.watchHelpers.clear();
162
+ /**
163
+ * Start HTTP server
164
+ */
165
+ await this.start();
166
+ /**
167
+ * Parse config to find the files excluded inside
168
+ * tsconfig file
169
+ */
170
+ const config = this.ts.parseConfig();
171
+ if (!config) {
172
+ this.logger.warning('Cannot start watcher because of errors in the config file');
173
+ this.watcherState = 'error';
174
+ this.renderServerIsReady();
175
+ return;
176
+ }
177
+ /**
178
+ * Stick file watcher
179
+ */
180
+ const watcher = this.ts.tsCompiler.watcher(config, 'raw');
181
+ /**
182
+ * Watcher is ready after first compile
183
+ */
184
+ watcher.on('watcher:ready', () => {
185
+ this.logger.info('watching file system for changes');
186
+ this.watcherState = 'ready';
187
+ this.renderServerIsReady();
188
+ });
189
+ /**
190
+ * Source file removed
191
+ */
192
+ watcher.on('source:unlink', async ({ absPath, relativePath }) => {
193
+ this.watchHelpers.clear(absPath);
194
+ this.logger.action('delete').succeeded(relativePath);
195
+ /**
196
+ * Generate manifest when filePath is a commands path
197
+ */
198
+ if (this.rcFile.isCommandsPath(relativePath)) {
199
+ this.manifest.generate();
200
+ }
201
+ this.httpServer.restart();
202
+ });
203
+ /**
204
+ * Source file added
205
+ */
206
+ watcher.on('source:add', async ({ absPath, relativePath }) => {
207
+ this.watchHelpers.clear(absPath);
208
+ this.logger.action('add').succeeded(relativePath);
209
+ /**
210
+ * Generate manifest when filePath if file is in commands path
211
+ */
212
+ if (this.rcFile.isCommandsPath(relativePath)) {
213
+ this.manifest.generate();
214
+ }
215
+ this.httpServer.restart();
216
+ });
217
+ /**
218
+ * Source file changed
219
+ */
220
+ watcher.on('source:change', async ({ absPath, relativePath }) => {
221
+ this.watchHelpers.clear(absPath);
222
+ this.logger.action('update').succeeded(relativePath);
223
+ /**
224
+ * Generate manifest when filePath is a commands path
225
+ */
226
+ if (this.rcFile.isCommandsPath(relativePath)) {
227
+ this.manifest.generate();
228
+ }
229
+ this.httpServer.restart();
230
+ });
231
+ /**
232
+ * New file added
233
+ */
234
+ watcher.on('add', async ({ relativePath }) => {
235
+ if (paths_1.ENV_FILES.includes(relativePath)) {
236
+ this.logger.action('create').succeeded(relativePath);
237
+ this.httpServer.restart();
238
+ return;
239
+ }
240
+ const metaData = this.rcFile.getMetaData(relativePath);
241
+ if (!metaData.metaFile) {
242
+ return;
243
+ }
244
+ this.logger.action('create').succeeded(relativePath);
245
+ if (metaData.reload) {
246
+ this.httpServer.restart();
247
+ }
248
+ });
249
+ /**
250
+ * File changed
251
+ */
252
+ watcher.on('change', async ({ relativePath }) => {
253
+ if (paths_1.ENV_FILES.includes(relativePath)) {
254
+ this.logger.action('update').succeeded(relativePath);
255
+ this.httpServer.restart();
256
+ return;
257
+ }
258
+ const metaData = this.rcFile.getMetaData(relativePath);
259
+ if (!metaData.metaFile) {
260
+ return;
261
+ }
262
+ this.logger.action('update').succeeded(relativePath);
263
+ if (metaData.reload || metaData.rcFile) {
264
+ this.httpServer.restart();
265
+ }
266
+ });
267
+ /**
268
+ * File removed
269
+ */
270
+ watcher.on('unlink', async ({ relativePath }) => {
271
+ if (paths_1.ENV_FILES.includes(relativePath)) {
272
+ this.logger.action('delete').succeeded(relativePath);
273
+ this.httpServer.restart();
274
+ return;
275
+ }
276
+ const metaData = this.rcFile.getMetaData(relativePath);
277
+ if (!metaData.metaFile) {
278
+ return;
279
+ }
280
+ if (metaData.rcFile) {
281
+ this.logger.info('cannot continue after deletion of .adonisrc.json file');
282
+ watcher.chokidar.close();
283
+ this.kill();
284
+ return;
285
+ }
286
+ this.logger.action('delete').succeeded(relativePath);
287
+ if (metaData.reload) {
288
+ this.httpServer.restart();
289
+ }
290
+ });
291
+ /**
292
+ * Start the watcher
293
+ */
294
+ watcher.watch(['.'], {
295
+ usePolling: poll,
296
+ });
297
+ /**
298
+ * Kill when watcher recieves an error
299
+ */
300
+ watcher.chokidar.on('error', (error) => {
301
+ this.logger.fatal(error);
302
+ this.kill();
303
+ });
304
+ }
305
+ }
306
+ exports.DevServer = DevServer;
@@ -1,23 +1,23 @@
1
- /**
2
- * Parses the env file inside the project root.
3
- */
4
- export declare class EnvParser {
5
- private envFileName;
6
- private envContents;
7
- private parser;
8
- constructor(envFileName?: string);
9
- /**
10
- * Parse .env file contents
11
- */
12
- parse(rootDir: string): Promise<void>;
13
- /**
14
- * Returns value for a key inside the `.env` file
15
- */
16
- get(key: string): string | undefined;
17
- /**
18
- * Returns an env object for the keys that has defined values
19
- */
20
- asEnvObject(keys: string[]): {
21
- [key: string]: string;
22
- };
23
- }
1
+ /**
2
+ * Parses the env file inside the project root.
3
+ */
4
+ export declare class EnvParser {
5
+ private envFileName;
6
+ private envContents;
7
+ private parser;
8
+ constructor(envFileName?: string);
9
+ /**
10
+ * Parse .env file contents
11
+ */
12
+ parse(rootDir: string): Promise<void>;
13
+ /**
14
+ * Returns value for a key inside the `.env` file
15
+ */
16
+ get(key: string): string | undefined;
17
+ /**
18
+ * Returns an env object for the keys that has defined values
19
+ */
20
+ asEnvObject(keys: string[]): {
21
+ [key: string]: string;
22
+ };
23
+ }