@adonisjs/assembler 5.9.2 → 5.9.4
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/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 +234 -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 +21 -23
- package/build/src/EnvParser/index.js +48 -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/build/templates/tests/bootstrap.txt +4 -4
- package/package.json +11 -11
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
import { BaseGenerator } from './Base';
|
|
2
|
-
/**
|
|
3
|
-
* Command to make a new event exceptions class
|
|
4
|
-
*/
|
|
5
|
-
export default class MakeException extends BaseGenerator {
|
|
6
|
-
/**
|
|
7
|
-
* Required by BaseGenerator
|
|
8
|
-
*/
|
|
9
|
-
protected form: "singular";
|
|
10
|
-
protected pattern: "pascalcase";
|
|
11
|
-
protected resourceName: string;
|
|
12
|
-
protected suffix: string;
|
|
13
|
-
protected createExact: boolean;
|
|
14
|
-
/**
|
|
15
|
-
* Command meta data
|
|
16
|
-
*/
|
|
17
|
-
static commandName: string;
|
|
18
|
-
static description: string;
|
|
19
|
-
name: string;
|
|
20
|
-
selfHandle: boolean;
|
|
21
|
-
exact: boolean;
|
|
22
|
-
/**
|
|
23
|
-
* Returns the template stub
|
|
24
|
-
*/
|
|
25
|
-
protected getStub(): string;
|
|
26
|
-
/**
|
|
27
|
-
* Pull path from the `exceptions` namespace declaration from
|
|
28
|
-
* the `.adonisrc.json` file or fallback to `app/Exceptions`
|
|
29
|
-
*/
|
|
30
|
-
protected getDestinationPath(): string;
|
|
31
|
-
run(): Promise<void>;
|
|
32
|
-
}
|
|
1
|
+
import { BaseGenerator } from './Base';
|
|
2
|
+
/**
|
|
3
|
+
* Command to make a new event exceptions class
|
|
4
|
+
*/
|
|
5
|
+
export default class MakeException extends BaseGenerator {
|
|
6
|
+
/**
|
|
7
|
+
* Required by BaseGenerator
|
|
8
|
+
*/
|
|
9
|
+
protected form: "singular";
|
|
10
|
+
protected pattern: "pascalcase";
|
|
11
|
+
protected resourceName: string;
|
|
12
|
+
protected suffix: string;
|
|
13
|
+
protected createExact: boolean;
|
|
14
|
+
/**
|
|
15
|
+
* Command meta data
|
|
16
|
+
*/
|
|
17
|
+
static commandName: string;
|
|
18
|
+
static description: string;
|
|
19
|
+
name: string;
|
|
20
|
+
selfHandle: boolean;
|
|
21
|
+
exact: boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Returns the template stub
|
|
24
|
+
*/
|
|
25
|
+
protected getStub(): string;
|
|
26
|
+
/**
|
|
27
|
+
* Pull path from the `exceptions` namespace declaration from
|
|
28
|
+
* the `.adonisrc.json` file or fallback to `app/Exceptions`
|
|
29
|
+
*/
|
|
30
|
+
protected getDestinationPath(): string;
|
|
31
|
+
run(): Promise<void>;
|
|
32
|
+
}
|
|
@@ -1,75 +1,75 @@
|
|
|
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 __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
11
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
12
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
13
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
14
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
15
|
-
};
|
|
16
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
17
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
18
|
-
};
|
|
19
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
-
const path_1 = require("path");
|
|
21
|
-
const standalone_1 = require("@adonisjs/core/build/standalone");
|
|
22
|
-
const Base_1 = require("./Base");
|
|
23
|
-
/**
|
|
24
|
-
* Command to make a new event exceptions class
|
|
25
|
-
*/
|
|
26
|
-
class MakeException extends Base_1.BaseGenerator {
|
|
27
|
-
constructor() {
|
|
28
|
-
super(...arguments);
|
|
29
|
-
/**
|
|
30
|
-
* Required by BaseGenerator
|
|
31
|
-
*/
|
|
32
|
-
this.form = 'singular';
|
|
33
|
-
this.pattern = 'pascalcase';
|
|
34
|
-
this.suffix = 'Exception';
|
|
35
|
-
}
|
|
36
|
-
/**
|
|
37
|
-
* Returns the template stub
|
|
38
|
-
*/
|
|
39
|
-
getStub() {
|
|
40
|
-
return (0, path_1.join)(__dirname, '..', '..', 'templates', this.selfHandle ? 'self-handle-exception.txt' : 'exception.txt');
|
|
41
|
-
}
|
|
42
|
-
/**
|
|
43
|
-
* Pull path from the `exceptions` namespace declaration from
|
|
44
|
-
* the `.adonisrc.json` file or fallback to `app/Exceptions`
|
|
45
|
-
*/
|
|
46
|
-
getDestinationPath() {
|
|
47
|
-
return this.getPathForNamespace('exceptions') || 'app/Exceptions';
|
|
48
|
-
}
|
|
49
|
-
async run() {
|
|
50
|
-
this.resourceName = this.name;
|
|
51
|
-
this.createExact = this.exact;
|
|
52
|
-
await super.generate();
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
/**
|
|
56
|
-
* Command meta data
|
|
57
|
-
*/
|
|
58
|
-
MakeException.commandName = 'make:exception';
|
|
59
|
-
MakeException.description = 'Make a new custom exception class';
|
|
60
|
-
__decorate([
|
|
61
|
-
standalone_1.args.string({ description: 'Name of the exception class' }),
|
|
62
|
-
__metadata("design:type", String)
|
|
63
|
-
], MakeException.prototype, "name", void 0);
|
|
64
|
-
__decorate([
|
|
65
|
-
standalone_1.flags.boolean({ description: 'Add the handle method to self handle the exception' }),
|
|
66
|
-
__metadata("design:type", Boolean)
|
|
67
|
-
], MakeException.prototype, "selfHandle", void 0);
|
|
68
|
-
__decorate([
|
|
69
|
-
standalone_1.flags.boolean({
|
|
70
|
-
description: 'Create the exception class with the exact name as provided',
|
|
71
|
-
alias: 'e',
|
|
72
|
-
}),
|
|
73
|
-
__metadata("design:type", Boolean)
|
|
74
|
-
], MakeException.prototype, "exact", void 0);
|
|
75
|
-
exports.default = MakeException;
|
|
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 __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
11
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
12
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
13
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
14
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
15
|
+
};
|
|
16
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
17
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
18
|
+
};
|
|
19
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
+
const path_1 = require("path");
|
|
21
|
+
const standalone_1 = require("@adonisjs/core/build/standalone");
|
|
22
|
+
const Base_1 = require("./Base");
|
|
23
|
+
/**
|
|
24
|
+
* Command to make a new event exceptions class
|
|
25
|
+
*/
|
|
26
|
+
class MakeException extends Base_1.BaseGenerator {
|
|
27
|
+
constructor() {
|
|
28
|
+
super(...arguments);
|
|
29
|
+
/**
|
|
30
|
+
* Required by BaseGenerator
|
|
31
|
+
*/
|
|
32
|
+
this.form = 'singular';
|
|
33
|
+
this.pattern = 'pascalcase';
|
|
34
|
+
this.suffix = 'Exception';
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Returns the template stub
|
|
38
|
+
*/
|
|
39
|
+
getStub() {
|
|
40
|
+
return (0, path_1.join)(__dirname, '..', '..', 'templates', this.selfHandle ? 'self-handle-exception.txt' : 'exception.txt');
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Pull path from the `exceptions` namespace declaration from
|
|
44
|
+
* the `.adonisrc.json` file or fallback to `app/Exceptions`
|
|
45
|
+
*/
|
|
46
|
+
getDestinationPath() {
|
|
47
|
+
return this.getPathForNamespace('exceptions') || 'app/Exceptions';
|
|
48
|
+
}
|
|
49
|
+
async run() {
|
|
50
|
+
this.resourceName = this.name;
|
|
51
|
+
this.createExact = this.exact;
|
|
52
|
+
await super.generate();
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Command meta data
|
|
57
|
+
*/
|
|
58
|
+
MakeException.commandName = 'make:exception';
|
|
59
|
+
MakeException.description = 'Make a new custom exception class';
|
|
60
|
+
__decorate([
|
|
61
|
+
standalone_1.args.string({ description: 'Name of the exception class' }),
|
|
62
|
+
__metadata("design:type", String)
|
|
63
|
+
], MakeException.prototype, "name", void 0);
|
|
64
|
+
__decorate([
|
|
65
|
+
standalone_1.flags.boolean({ description: 'Add the handle method to self handle the exception' }),
|
|
66
|
+
__metadata("design:type", Boolean)
|
|
67
|
+
], MakeException.prototype, "selfHandle", void 0);
|
|
68
|
+
__decorate([
|
|
69
|
+
standalone_1.flags.boolean({
|
|
70
|
+
description: 'Create the exception class with the exact name as provided',
|
|
71
|
+
alias: 'e',
|
|
72
|
+
}),
|
|
73
|
+
__metadata("design:type", Boolean)
|
|
74
|
+
], MakeException.prototype, "exact", void 0);
|
|
75
|
+
exports.default = MakeException;
|
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
import { BaseGenerator } from './Base';
|
|
2
|
-
/**
|
|
3
|
-
* Command to make a new event listener class
|
|
4
|
-
*/
|
|
5
|
-
export default class MakeListener extends BaseGenerator {
|
|
6
|
-
/**
|
|
7
|
-
* Required by BaseGenerator
|
|
8
|
-
*/
|
|
9
|
-
protected form: "singular";
|
|
10
|
-
protected pattern: "pascalcase";
|
|
11
|
-
protected resourceName: string;
|
|
12
|
-
protected createExact: boolean;
|
|
13
|
-
/**
|
|
14
|
-
* Command meta data
|
|
15
|
-
*/
|
|
16
|
-
static commandName: string;
|
|
17
|
-
static description: string;
|
|
18
|
-
name: string;
|
|
19
|
-
exact: boolean;
|
|
20
|
-
/**
|
|
21
|
-
* Returns the template stub
|
|
22
|
-
*/
|
|
23
|
-
protected getStub(): string;
|
|
24
|
-
/**
|
|
25
|
-
* Pull path from the `listeners` directory declaration from
|
|
26
|
-
* the `.adonisrc.json` file or fallback to `app/Listeners`
|
|
27
|
-
*/
|
|
28
|
-
protected getDestinationPath(): string;
|
|
29
|
-
run(): Promise<void>;
|
|
30
|
-
}
|
|
1
|
+
import { BaseGenerator } from './Base';
|
|
2
|
+
/**
|
|
3
|
+
* Command to make a new event listener class
|
|
4
|
+
*/
|
|
5
|
+
export default class MakeListener extends BaseGenerator {
|
|
6
|
+
/**
|
|
7
|
+
* Required by BaseGenerator
|
|
8
|
+
*/
|
|
9
|
+
protected form: "singular";
|
|
10
|
+
protected pattern: "pascalcase";
|
|
11
|
+
protected resourceName: string;
|
|
12
|
+
protected createExact: boolean;
|
|
13
|
+
/**
|
|
14
|
+
* Command meta data
|
|
15
|
+
*/
|
|
16
|
+
static commandName: string;
|
|
17
|
+
static description: string;
|
|
18
|
+
name: string;
|
|
19
|
+
exact: boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Returns the template stub
|
|
22
|
+
*/
|
|
23
|
+
protected getStub(): string;
|
|
24
|
+
/**
|
|
25
|
+
* Pull path from the `listeners` directory declaration from
|
|
26
|
+
* the `.adonisrc.json` file or fallback to `app/Listeners`
|
|
27
|
+
*/
|
|
28
|
+
protected getDestinationPath(): string;
|
|
29
|
+
run(): Promise<void>;
|
|
30
|
+
}
|
|
@@ -1,70 +1,70 @@
|
|
|
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 __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
11
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
12
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
13
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
14
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
15
|
-
};
|
|
16
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
17
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
18
|
-
};
|
|
19
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
-
const path_1 = require("path");
|
|
21
|
-
const standalone_1 = require("@adonisjs/core/build/standalone");
|
|
22
|
-
const Base_1 = require("./Base");
|
|
23
|
-
/**
|
|
24
|
-
* Command to make a new event listener class
|
|
25
|
-
*/
|
|
26
|
-
class MakeListener extends Base_1.BaseGenerator {
|
|
27
|
-
constructor() {
|
|
28
|
-
super(...arguments);
|
|
29
|
-
/**
|
|
30
|
-
* Required by BaseGenerator
|
|
31
|
-
*/
|
|
32
|
-
this.form = 'singular';
|
|
33
|
-
this.pattern = 'pascalcase';
|
|
34
|
-
}
|
|
35
|
-
/**
|
|
36
|
-
* Returns the template stub
|
|
37
|
-
*/
|
|
38
|
-
getStub() {
|
|
39
|
-
return (0, path_1.join)(__dirname, '..', '..', 'templates', 'event-listener.txt');
|
|
40
|
-
}
|
|
41
|
-
/**
|
|
42
|
-
* Pull path from the `listeners` directory declaration from
|
|
43
|
-
* the `.adonisrc.json` file or fallback to `app/Listeners`
|
|
44
|
-
*/
|
|
45
|
-
getDestinationPath() {
|
|
46
|
-
return this.getPathForNamespace('eventListeners') || 'app/Listeners';
|
|
47
|
-
}
|
|
48
|
-
async run() {
|
|
49
|
-
this.resourceName = this.name;
|
|
50
|
-
this.createExact = this.exact;
|
|
51
|
-
await super.generate();
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
/**
|
|
55
|
-
* Command meta data
|
|
56
|
-
*/
|
|
57
|
-
MakeListener.commandName = 'make:listener';
|
|
58
|
-
MakeListener.description = 'Make a new event listener class';
|
|
59
|
-
__decorate([
|
|
60
|
-
standalone_1.args.string({ description: 'Name of the event listener class' }),
|
|
61
|
-
__metadata("design:type", String)
|
|
62
|
-
], MakeListener.prototype, "name", void 0);
|
|
63
|
-
__decorate([
|
|
64
|
-
standalone_1.flags.boolean({
|
|
65
|
-
description: 'Create the listener with the exact name as provided',
|
|
66
|
-
alias: 'e',
|
|
67
|
-
}),
|
|
68
|
-
__metadata("design:type", Boolean)
|
|
69
|
-
], MakeListener.prototype, "exact", void 0);
|
|
70
|
-
exports.default = MakeListener;
|
|
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 __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
11
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
12
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
13
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
14
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
15
|
+
};
|
|
16
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
17
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
18
|
+
};
|
|
19
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
+
const path_1 = require("path");
|
|
21
|
+
const standalone_1 = require("@adonisjs/core/build/standalone");
|
|
22
|
+
const Base_1 = require("./Base");
|
|
23
|
+
/**
|
|
24
|
+
* Command to make a new event listener class
|
|
25
|
+
*/
|
|
26
|
+
class MakeListener extends Base_1.BaseGenerator {
|
|
27
|
+
constructor() {
|
|
28
|
+
super(...arguments);
|
|
29
|
+
/**
|
|
30
|
+
* Required by BaseGenerator
|
|
31
|
+
*/
|
|
32
|
+
this.form = 'singular';
|
|
33
|
+
this.pattern = 'pascalcase';
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Returns the template stub
|
|
37
|
+
*/
|
|
38
|
+
getStub() {
|
|
39
|
+
return (0, path_1.join)(__dirname, '..', '..', 'templates', 'event-listener.txt');
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Pull path from the `listeners` directory declaration from
|
|
43
|
+
* the `.adonisrc.json` file or fallback to `app/Listeners`
|
|
44
|
+
*/
|
|
45
|
+
getDestinationPath() {
|
|
46
|
+
return this.getPathForNamespace('eventListeners') || 'app/Listeners';
|
|
47
|
+
}
|
|
48
|
+
async run() {
|
|
49
|
+
this.resourceName = this.name;
|
|
50
|
+
this.createExact = this.exact;
|
|
51
|
+
await super.generate();
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Command meta data
|
|
56
|
+
*/
|
|
57
|
+
MakeListener.commandName = 'make:listener';
|
|
58
|
+
MakeListener.description = 'Make a new event listener class';
|
|
59
|
+
__decorate([
|
|
60
|
+
standalone_1.args.string({ description: 'Name of the event listener class' }),
|
|
61
|
+
__metadata("design:type", String)
|
|
62
|
+
], MakeListener.prototype, "name", void 0);
|
|
63
|
+
__decorate([
|
|
64
|
+
standalone_1.flags.boolean({
|
|
65
|
+
description: 'Create the listener with the exact name as provided',
|
|
66
|
+
alias: 'e',
|
|
67
|
+
}),
|
|
68
|
+
__metadata("design:type", Boolean)
|
|
69
|
+
], MakeListener.prototype, "exact", void 0);
|
|
70
|
+
exports.default = MakeListener;
|
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
import { BaseGenerator } from './Base';
|
|
2
|
-
/**
|
|
3
|
-
* Command to make a new middleware
|
|
4
|
-
*/
|
|
5
|
-
export default class MakeMiddleware extends BaseGenerator {
|
|
6
|
-
/**
|
|
7
|
-
* Required by BaseGenerator
|
|
8
|
-
*/
|
|
9
|
-
protected suffix: string;
|
|
10
|
-
protected form: "singular";
|
|
11
|
-
protected pattern: "pascalcase";
|
|
12
|
-
protected resourceName: string;
|
|
13
|
-
protected createExact: boolean;
|
|
14
|
-
/**
|
|
15
|
-
* Command meta data
|
|
16
|
-
*/
|
|
17
|
-
static commandName: string;
|
|
18
|
-
static description: string;
|
|
19
|
-
name: string;
|
|
20
|
-
exact: boolean;
|
|
21
|
-
/**
|
|
22
|
-
* Returns the template stub path
|
|
23
|
-
*/
|
|
24
|
-
protected getStub(): string;
|
|
25
|
-
/**
|
|
26
|
-
* Middleware are always created inside `app/Middleware` directory.
|
|
27
|
-
* We can look into configuring it later.
|
|
28
|
-
*/
|
|
29
|
-
protected getDestinationPath(): string;
|
|
30
|
-
run(): Promise<void>;
|
|
31
|
-
}
|
|
1
|
+
import { BaseGenerator } from './Base';
|
|
2
|
+
/**
|
|
3
|
+
* Command to make a new middleware
|
|
4
|
+
*/
|
|
5
|
+
export default class MakeMiddleware extends BaseGenerator {
|
|
6
|
+
/**
|
|
7
|
+
* Required by BaseGenerator
|
|
8
|
+
*/
|
|
9
|
+
protected suffix: string;
|
|
10
|
+
protected form: "singular";
|
|
11
|
+
protected pattern: "pascalcase";
|
|
12
|
+
protected resourceName: string;
|
|
13
|
+
protected createExact: boolean;
|
|
14
|
+
/**
|
|
15
|
+
* Command meta data
|
|
16
|
+
*/
|
|
17
|
+
static commandName: string;
|
|
18
|
+
static description: string;
|
|
19
|
+
name: string;
|
|
20
|
+
exact: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* Returns the template stub path
|
|
23
|
+
*/
|
|
24
|
+
protected getStub(): string;
|
|
25
|
+
/**
|
|
26
|
+
* Middleware are always created inside `app/Middleware` directory.
|
|
27
|
+
* We can look into configuring it later.
|
|
28
|
+
*/
|
|
29
|
+
protected getDestinationPath(): string;
|
|
30
|
+
run(): Promise<void>;
|
|
31
|
+
}
|
|
@@ -1,87 +1,87 @@
|
|
|
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 __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
11
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
12
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
13
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
14
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
15
|
-
};
|
|
16
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
17
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
18
|
-
};
|
|
19
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
-
const path_1 = require("path");
|
|
21
|
-
const standalone_1 = require("@adonisjs/core/build/standalone");
|
|
22
|
-
const Base_1 = require("./Base");
|
|
23
|
-
/**
|
|
24
|
-
* Command to make a new middleware
|
|
25
|
-
*/
|
|
26
|
-
class MakeMiddleware extends Base_1.BaseGenerator {
|
|
27
|
-
constructor() {
|
|
28
|
-
super(...arguments);
|
|
29
|
-
/**
|
|
30
|
-
* Required by BaseGenerator
|
|
31
|
-
*/
|
|
32
|
-
this.suffix = '';
|
|
33
|
-
this.form = 'singular';
|
|
34
|
-
this.pattern = 'pascalcase';
|
|
35
|
-
}
|
|
36
|
-
/**
|
|
37
|
-
* Returns the template stub path
|
|
38
|
-
*/
|
|
39
|
-
getStub() {
|
|
40
|
-
return (0, path_1.join)(__dirname, '..', '..', 'templates', 'middleware.txt');
|
|
41
|
-
}
|
|
42
|
-
/**
|
|
43
|
-
* Middleware are always created inside `app/Middleware` directory.
|
|
44
|
-
* We can look into configuring it later.
|
|
45
|
-
*/
|
|
46
|
-
getDestinationPath() {
|
|
47
|
-
return this.getPathForNamespace('middleware') || 'app/Middleware';
|
|
48
|
-
}
|
|
49
|
-
async run() {
|
|
50
|
-
this.resourceName = this.name;
|
|
51
|
-
this.createExact = this.exact;
|
|
52
|
-
const middlewareNamespace = this.application.rcFile.namespaces.middleware || 'App/Middleware';
|
|
53
|
-
const file = await super.generate();
|
|
54
|
-
if (!file) {
|
|
55
|
-
return;
|
|
56
|
-
}
|
|
57
|
-
const fileJSON = file.toJSON();
|
|
58
|
-
if (fileJSON.state === 'persisted') {
|
|
59
|
-
this.ui
|
|
60
|
-
.instructions()
|
|
61
|
-
.heading('Register middleware')
|
|
62
|
-
.add(`Open ${this.colors.cyan('start/kernel.ts')} file`)
|
|
63
|
-
.add(`Register the following function as a global or a named middleware`)
|
|
64
|
-
.add(this.colors
|
|
65
|
-
.cyan()
|
|
66
|
-
.underline(`() => import('${middlewareNamespace}/${fileJSON.filename}')`))
|
|
67
|
-
.render();
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
/**
|
|
72
|
-
* Command meta data
|
|
73
|
-
*/
|
|
74
|
-
MakeMiddleware.commandName = 'make:middleware';
|
|
75
|
-
MakeMiddleware.description = 'Make a new middleware';
|
|
76
|
-
__decorate([
|
|
77
|
-
standalone_1.args.string({ description: 'Name of the middleware class' }),
|
|
78
|
-
__metadata("design:type", String)
|
|
79
|
-
], MakeMiddleware.prototype, "name", void 0);
|
|
80
|
-
__decorate([
|
|
81
|
-
standalone_1.flags.boolean({
|
|
82
|
-
description: 'Create the middleware with the exact name as provided',
|
|
83
|
-
alias: 'e',
|
|
84
|
-
}),
|
|
85
|
-
__metadata("design:type", Boolean)
|
|
86
|
-
], MakeMiddleware.prototype, "exact", void 0);
|
|
87
|
-
exports.default = MakeMiddleware;
|
|
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 __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
11
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
12
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
13
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
14
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
15
|
+
};
|
|
16
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
17
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
18
|
+
};
|
|
19
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
+
const path_1 = require("path");
|
|
21
|
+
const standalone_1 = require("@adonisjs/core/build/standalone");
|
|
22
|
+
const Base_1 = require("./Base");
|
|
23
|
+
/**
|
|
24
|
+
* Command to make a new middleware
|
|
25
|
+
*/
|
|
26
|
+
class MakeMiddleware extends Base_1.BaseGenerator {
|
|
27
|
+
constructor() {
|
|
28
|
+
super(...arguments);
|
|
29
|
+
/**
|
|
30
|
+
* Required by BaseGenerator
|
|
31
|
+
*/
|
|
32
|
+
this.suffix = '';
|
|
33
|
+
this.form = 'singular';
|
|
34
|
+
this.pattern = 'pascalcase';
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Returns the template stub path
|
|
38
|
+
*/
|
|
39
|
+
getStub() {
|
|
40
|
+
return (0, path_1.join)(__dirname, '..', '..', 'templates', 'middleware.txt');
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Middleware are always created inside `app/Middleware` directory.
|
|
44
|
+
* We can look into configuring it later.
|
|
45
|
+
*/
|
|
46
|
+
getDestinationPath() {
|
|
47
|
+
return this.getPathForNamespace('middleware') || 'app/Middleware';
|
|
48
|
+
}
|
|
49
|
+
async run() {
|
|
50
|
+
this.resourceName = this.name;
|
|
51
|
+
this.createExact = this.exact;
|
|
52
|
+
const middlewareNamespace = this.application.rcFile.namespaces.middleware || 'App/Middleware';
|
|
53
|
+
const file = await super.generate();
|
|
54
|
+
if (!file) {
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
const fileJSON = file.toJSON();
|
|
58
|
+
if (fileJSON.state === 'persisted') {
|
|
59
|
+
this.ui
|
|
60
|
+
.instructions()
|
|
61
|
+
.heading('Register middleware')
|
|
62
|
+
.add(`Open ${this.colors.cyan('start/kernel.ts')} file`)
|
|
63
|
+
.add(`Register the following function as a global or a named middleware`)
|
|
64
|
+
.add(this.colors
|
|
65
|
+
.cyan()
|
|
66
|
+
.underline(`() => import('${middlewareNamespace}/${fileJSON.filename}')`))
|
|
67
|
+
.render();
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Command meta data
|
|
73
|
+
*/
|
|
74
|
+
MakeMiddleware.commandName = 'make:middleware';
|
|
75
|
+
MakeMiddleware.description = 'Make a new middleware';
|
|
76
|
+
__decorate([
|
|
77
|
+
standalone_1.args.string({ description: 'Name of the middleware class' }),
|
|
78
|
+
__metadata("design:type", String)
|
|
79
|
+
], MakeMiddleware.prototype, "name", void 0);
|
|
80
|
+
__decorate([
|
|
81
|
+
standalone_1.flags.boolean({
|
|
82
|
+
description: 'Create the middleware with the exact name as provided',
|
|
83
|
+
alias: 'e',
|
|
84
|
+
}),
|
|
85
|
+
__metadata("design:type", Boolean)
|
|
86
|
+
], MakeMiddleware.prototype, "exact", void 0);
|
|
87
|
+
exports.default = MakeMiddleware;
|