@adonisjs/assembler 5.9.1 → 5.9.3

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 (66) hide show
  1. package/build/ace-manifest.json +11 -11
  2. package/build/commands/Build.d.ts +37 -37
  3. package/build/commands/Build.js +138 -138
  4. package/build/commands/Invoke.d.ts +34 -34
  5. package/build/commands/Invoke.js +221 -221
  6. package/build/commands/Make/Base.d.ts +30 -30
  7. package/build/commands/Make/Base.js +75 -75
  8. package/build/commands/Make/Command.d.ts +35 -35
  9. package/build/commands/Make/Command.js +82 -82
  10. package/build/commands/Make/Controller.d.ts +37 -37
  11. package/build/commands/Make/Controller.js +89 -89
  12. package/build/commands/Make/Exception.d.ts +32 -32
  13. package/build/commands/Make/Exception.js +75 -75
  14. package/build/commands/Make/Listener.d.ts +30 -30
  15. package/build/commands/Make/Listener.js +70 -70
  16. package/build/commands/Make/Middleware.d.ts +31 -31
  17. package/build/commands/Make/Middleware.js +87 -87
  18. package/build/commands/Make/PreloadFile.d.ts +38 -38
  19. package/build/commands/Make/PreloadFile.js +157 -157
  20. package/build/commands/Make/Provider.d.ts +31 -31
  21. package/build/commands/Make/Provider.js +114 -114
  22. package/build/commands/Make/Suite.d.ts +41 -41
  23. package/build/commands/Make/Suite.js +120 -120
  24. package/build/commands/Make/Test.d.ts +35 -35
  25. package/build/commands/Make/Test.js +96 -96
  26. package/build/commands/Make/Validator.d.ts +31 -31
  27. package/build/commands/Make/Validator.js +71 -71
  28. package/build/commands/Make/View.d.ts +30 -30
  29. package/build/commands/Make/View.js +70 -70
  30. package/build/commands/Serve.d.ts +33 -33
  31. package/build/commands/Serve.js +112 -112
  32. package/build/commands/Test.d.ts +57 -57
  33. package/build/commands/Test.js +159 -159
  34. package/build/commands/TypeCheck.d.ts +16 -16
  35. package/build/commands/TypeCheck.js +85 -85
  36. package/build/config/paths.d.ts +7 -7
  37. package/build/config/paths.js +18 -18
  38. package/build/register.d.ts +1 -1
  39. package/build/register.js +15 -15
  40. package/build/src/AssetsBundler/index.d.ts +76 -76
  41. package/build/src/AssetsBundler/index.js +216 -216
  42. package/build/src/Compiler/index.d.ts +62 -62
  43. package/build/src/Compiler/index.js +287 -287
  44. package/build/src/Contracts/index.d.ts +8 -8
  45. package/build/src/Contracts/index.js +10 -10
  46. package/build/src/DevServer/index.d.ts +70 -70
  47. package/build/src/DevServer/index.js +306 -306
  48. package/build/src/EnvParser/index.d.ts +21 -23
  49. package/build/src/EnvParser/index.js +48 -52
  50. package/build/src/HttpServer/index.d.ts +34 -34
  51. package/build/src/HttpServer/index.js +87 -87
  52. package/build/src/Manifest/index.d.ts +32 -32
  53. package/build/src/Manifest/index.js +88 -88
  54. package/build/src/RcFile/index.d.ts +72 -72
  55. package/build/src/RcFile/index.js +174 -174
  56. package/build/src/Test/index.d.ts +75 -75
  57. package/build/src/Test/index.js +346 -346
  58. package/build/src/Test/process.d.ts +22 -22
  59. package/build/src/Test/process.js +68 -68
  60. package/build/src/Ts/index.d.ts +24 -24
  61. package/build/src/Ts/index.js +55 -55
  62. package/build/src/requireHook/index.d.ts +5 -5
  63. package/build/src/requireHook/index.js +28 -28
  64. package/build/src/requireHook/ioc-transformer.d.ts +6 -6
  65. package/build/src/requireHook/ioc-transformer.js +21 -21
  66. package/package.json +5 -5
@@ -1,38 +1,38 @@
1
- import { BaseGenerator } from './Base';
2
- import type { AppEnvironments } from '@ioc:Adonis/Core/Application';
3
- /**
4
- * Command to make a new preloaded file
5
- */
6
- export default class MakePreloadFile extends BaseGenerator {
7
- /**
8
- * Required by BaseGenerator
9
- */
10
- protected resourceName: string;
11
- protected createExact: boolean;
12
- /**
13
- * Command name
14
- */
15
- static commandName: string;
16
- /**
17
- * Command description
18
- */
19
- static description: string;
20
- name: string;
21
- environment: AppEnvironments[];
22
- /**
23
- * Check if the mentioned environments are valid
24
- */
25
- private isValidEnviroment;
26
- /**
27
- * Returns the template stub path
28
- */
29
- protected getStub(): string;
30
- /**
31
- * Path to the start directory
32
- */
33
- protected getDestinationPath(): string;
34
- /**
35
- * Run command
36
- */
37
- run(): Promise<void>;
38
- }
1
+ import { BaseGenerator } from './Base';
2
+ import type { AppEnvironments } from '@ioc:Adonis/Core/Application';
3
+ /**
4
+ * Command to make a new preloaded file
5
+ */
6
+ export default class MakePreloadFile extends BaseGenerator {
7
+ /**
8
+ * Required by BaseGenerator
9
+ */
10
+ protected resourceName: string;
11
+ protected createExact: boolean;
12
+ /**
13
+ * Command name
14
+ */
15
+ static commandName: string;
16
+ /**
17
+ * Command description
18
+ */
19
+ static description: string;
20
+ name: string;
21
+ environment: AppEnvironments[];
22
+ /**
23
+ * Check if the mentioned environments are valid
24
+ */
25
+ private isValidEnviroment;
26
+ /**
27
+ * Returns the template stub path
28
+ */
29
+ protected getStub(): string;
30
+ /**
31
+ * Path to the start directory
32
+ */
33
+ protected getDestinationPath(): string;
34
+ /**
35
+ * Run command
36
+ */
37
+ run(): Promise<void>;
38
+ }
@@ -1,157 +1,157 @@
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 __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
11
- if (k2 === undefined) k2 = k;
12
- var desc = Object.getOwnPropertyDescriptor(m, k);
13
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
14
- desc = { enumerable: true, get: function() { return m[k]; } };
15
- }
16
- Object.defineProperty(o, k2, desc);
17
- }) : (function(o, m, k, k2) {
18
- if (k2 === undefined) k2 = k;
19
- o[k2] = m[k];
20
- }));
21
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
22
- Object.defineProperty(o, "default", { enumerable: true, value: v });
23
- }) : function(o, v) {
24
- o["default"] = v;
25
- });
26
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
27
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
28
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
29
- 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;
30
- return c > 3 && r && Object.defineProperty(target, key, r), r;
31
- };
32
- var __importStar = (this && this.__importStar) || function (mod) {
33
- if (mod && mod.__esModule) return mod;
34
- var result = {};
35
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
36
- __setModuleDefault(result, mod);
37
- return result;
38
- };
39
- var __metadata = (this && this.__metadata) || function (k, v) {
40
- if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
41
- };
42
- var __importDefault = (this && this.__importDefault) || function (mod) {
43
- return (mod && mod.__esModule) ? mod : { "default": mod };
44
- };
45
- Object.defineProperty(exports, "__esModule", { value: true });
46
- const slash_1 = __importDefault(require("slash"));
47
- const path_1 = require("path");
48
- const standalone_1 = require("@adonisjs/core/build/standalone");
49
- const Base_1 = require("./Base");
50
- const ALLOWED_ENVIRONMENTS = ['console', 'web', 'repl', 'test'];
51
- /**
52
- * Command to make a new preloaded file
53
- */
54
- class MakePreloadFile extends Base_1.BaseGenerator {
55
- constructor() {
56
- super(...arguments);
57
- this.createExact = true;
58
- }
59
- /**
60
- * Check if the mentioned environments are valid
61
- */
62
- isValidEnviroment(environment) {
63
- return !environment.find((one) => !ALLOWED_ENVIRONMENTS.includes(one));
64
- }
65
- /**
66
- * Returns the template stub path
67
- */
68
- getStub() {
69
- return (0, path_1.join)(__dirname, '..', '..', 'templates', 'preload-file.txt');
70
- }
71
- /**
72
- * Path to the start directory
73
- */
74
- getDestinationPath() {
75
- return this.application.rcFile.directories.start || 'start';
76
- }
77
- /**
78
- * Run command
79
- */
80
- async run() {
81
- /**
82
- * Ensure the environments are valid when provided via flag
83
- */
84
- if (this.environment && this.environment.length && !this.isValidEnviroment(this.environment)) {
85
- this.logger.error(`Invalid environment(s) "${this.environment}". Only "${ALLOWED_ENVIRONMENTS}" are allowed`);
86
- return;
87
- }
88
- let environments = this.environment;
89
- /**
90
- * Prompt user to select one or more environments
91
- */
92
- if (!environments) {
93
- environments = await this.prompt.multiple('Select the environment(s) in which you want to load this file', [
94
- {
95
- name: 'all',
96
- message: 'Load file in all environments',
97
- },
98
- {
99
- name: 'console',
100
- message: 'Environment for ace commands',
101
- },
102
- {
103
- name: 'repl',
104
- message: 'Environment for the REPL session',
105
- },
106
- {
107
- name: 'web',
108
- message: 'Environment for HTTP requests',
109
- },
110
- {
111
- name: 'test',
112
- message: 'Environment for the test process',
113
- },
114
- ]);
115
- }
116
- /**
117
- * Generate resource file
118
- */
119
- this.resourceName = this.name;
120
- const file = await super.generate();
121
- if (!file) {
122
- return;
123
- }
124
- /**
125
- * Update preload file
126
- */
127
- const { files } = await Promise.resolve().then(() => __importStar(require('@adonisjs/sink')));
128
- const relativePath = file.toJSON().relativepath;
129
- const rcFile = new files.AdonisRcFile(this.application.appRoot);
130
- if (!environments || !environments.length || environments.includes('all')) {
131
- rcFile.setPreload(`./${(0, slash_1.default)(relativePath).replace((0, path_1.extname)(relativePath), '')}`);
132
- }
133
- else {
134
- rcFile.setPreload(`./${(0, slash_1.default)(relativePath).replace((0, path_1.extname)(relativePath), '')}`, environments);
135
- }
136
- rcFile.commit();
137
- }
138
- }
139
- /**
140
- * Command name
141
- */
142
- MakePreloadFile.commandName = 'make:prldfile';
143
- /**
144
- * Command description
145
- */
146
- MakePreloadFile.description = 'Make a new preload file';
147
- __decorate([
148
- standalone_1.args.string({ description: 'Name of the file' }),
149
- __metadata("design:type", String)
150
- ], MakePreloadFile.prototype, "name", void 0);
151
- __decorate([
152
- standalone_1.flags.array({
153
- description: `Define the preload file environment. Accepted values "${ALLOWED_ENVIRONMENTS}"`,
154
- }),
155
- __metadata("design:type", Array)
156
- ], MakePreloadFile.prototype, "environment", void 0);
157
- exports.default = MakePreloadFile;
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 __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
11
+ if (k2 === undefined) k2 = k;
12
+ var desc = Object.getOwnPropertyDescriptor(m, k);
13
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
14
+ desc = { enumerable: true, get: function() { return m[k]; } };
15
+ }
16
+ Object.defineProperty(o, k2, desc);
17
+ }) : (function(o, m, k, k2) {
18
+ if (k2 === undefined) k2 = k;
19
+ o[k2] = m[k];
20
+ }));
21
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
22
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
23
+ }) : function(o, v) {
24
+ o["default"] = v;
25
+ });
26
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
27
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
28
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
29
+ 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;
30
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
31
+ };
32
+ var __importStar = (this && this.__importStar) || function (mod) {
33
+ if (mod && mod.__esModule) return mod;
34
+ var result = {};
35
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
36
+ __setModuleDefault(result, mod);
37
+ return result;
38
+ };
39
+ var __metadata = (this && this.__metadata) || function (k, v) {
40
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
41
+ };
42
+ var __importDefault = (this && this.__importDefault) || function (mod) {
43
+ return (mod && mod.__esModule) ? mod : { "default": mod };
44
+ };
45
+ Object.defineProperty(exports, "__esModule", { value: true });
46
+ const slash_1 = __importDefault(require("slash"));
47
+ const path_1 = require("path");
48
+ const standalone_1 = require("@adonisjs/core/build/standalone");
49
+ const Base_1 = require("./Base");
50
+ const ALLOWED_ENVIRONMENTS = ['console', 'web', 'repl', 'test'];
51
+ /**
52
+ * Command to make a new preloaded file
53
+ */
54
+ class MakePreloadFile extends Base_1.BaseGenerator {
55
+ constructor() {
56
+ super(...arguments);
57
+ this.createExact = true;
58
+ }
59
+ /**
60
+ * Check if the mentioned environments are valid
61
+ */
62
+ isValidEnviroment(environment) {
63
+ return !environment.find((one) => !ALLOWED_ENVIRONMENTS.includes(one));
64
+ }
65
+ /**
66
+ * Returns the template stub path
67
+ */
68
+ getStub() {
69
+ return (0, path_1.join)(__dirname, '..', '..', 'templates', 'preload-file.txt');
70
+ }
71
+ /**
72
+ * Path to the start directory
73
+ */
74
+ getDestinationPath() {
75
+ return this.application.rcFile.directories.start || 'start';
76
+ }
77
+ /**
78
+ * Run command
79
+ */
80
+ async run() {
81
+ /**
82
+ * Ensure the environments are valid when provided via flag
83
+ */
84
+ if (this.environment && this.environment.length && !this.isValidEnviroment(this.environment)) {
85
+ this.logger.error(`Invalid environment(s) "${this.environment}". Only "${ALLOWED_ENVIRONMENTS}" are allowed`);
86
+ return;
87
+ }
88
+ let environments = this.environment;
89
+ /**
90
+ * Prompt user to select one or more environments
91
+ */
92
+ if (!environments) {
93
+ environments = await this.prompt.multiple('Select the environment(s) in which you want to load this file', [
94
+ {
95
+ name: 'all',
96
+ message: 'Load file in all environments',
97
+ },
98
+ {
99
+ name: 'console',
100
+ message: 'Environment for ace commands',
101
+ },
102
+ {
103
+ name: 'repl',
104
+ message: 'Environment for the REPL session',
105
+ },
106
+ {
107
+ name: 'web',
108
+ message: 'Environment for HTTP requests',
109
+ },
110
+ {
111
+ name: 'test',
112
+ message: 'Environment for the test process',
113
+ },
114
+ ]);
115
+ }
116
+ /**
117
+ * Generate resource file
118
+ */
119
+ this.resourceName = this.name;
120
+ const file = await super.generate();
121
+ if (!file) {
122
+ return;
123
+ }
124
+ /**
125
+ * Update preload file
126
+ */
127
+ const { files } = await Promise.resolve().then(() => __importStar(require('@adonisjs/sink')));
128
+ const relativePath = file.toJSON().relativepath;
129
+ const rcFile = new files.AdonisRcFile(this.application.appRoot);
130
+ if (!environments || !environments.length || environments.includes('all')) {
131
+ rcFile.setPreload(`./${(0, slash_1.default)(relativePath).replace((0, path_1.extname)(relativePath), '')}`);
132
+ }
133
+ else {
134
+ rcFile.setPreload(`./${(0, slash_1.default)(relativePath).replace((0, path_1.extname)(relativePath), '')}`, environments);
135
+ }
136
+ rcFile.commit();
137
+ }
138
+ }
139
+ /**
140
+ * Command name
141
+ */
142
+ MakePreloadFile.commandName = 'make:prldfile';
143
+ /**
144
+ * Command description
145
+ */
146
+ MakePreloadFile.description = 'Make a new preload file';
147
+ __decorate([
148
+ standalone_1.args.string({ description: 'Name of the file' }),
149
+ __metadata("design:type", String)
150
+ ], MakePreloadFile.prototype, "name", void 0);
151
+ __decorate([
152
+ standalone_1.flags.array({
153
+ description: `Define the preload file environment. Accepted values "${ALLOWED_ENVIRONMENTS}"`,
154
+ }),
155
+ __metadata("design:type", Array)
156
+ ], MakePreloadFile.prototype, "environment", void 0);
157
+ exports.default = MakePreloadFile;
@@ -1,31 +1,31 @@
1
- import { BaseGenerator } from './Base';
2
- /**
3
- * Command to make a new provider
4
- */
5
- export default class MakeProvider 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
- ace: boolean;
21
- exact: boolean;
22
- /**
23
- * Returns the template stub path
24
- */
25
- protected getStub(): string;
26
- /**
27
- * Path to the providers directory
28
- */
29
- protected getDestinationPath(): string;
30
- run(): Promise<void>;
31
- }
1
+ import { BaseGenerator } from './Base';
2
+ /**
3
+ * Command to make a new provider
4
+ */
5
+ export default class MakeProvider 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
+ ace: boolean;
21
+ exact: boolean;
22
+ /**
23
+ * Returns the template stub path
24
+ */
25
+ protected getStub(): string;
26
+ /**
27
+ * Path to the providers directory
28
+ */
29
+ protected getDestinationPath(): string;
30
+ run(): Promise<void>;
31
+ }