@adonisjs/core 5.8.9 → 6.0.0-0

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 (252) hide show
  1. package/README.md +6 -15
  2. package/build/commands/commands.json +1 -0
  3. package/build/commands/eject.d.ts +8 -0
  4. package/build/commands/eject.js +34 -0
  5. package/build/commands/{GenerateKey.d.ts → generate_key.d.ts} +3 -4
  6. package/build/commands/generate_key.js +47 -0
  7. package/build/commands/main.js +36 -0
  8. package/build/commands/make/_base.d.ts +6 -0
  9. package/build/commands/make/_base.js +19 -0
  10. package/build/commands/make/command.d.ts +8 -0
  11. package/build/commands/make/command.js +25 -0
  12. package/build/commands/make/controller.d.ts +12 -0
  13. package/build/commands/make/controller.js +57 -0
  14. package/build/commands/make/event.d.ts +8 -0
  15. package/build/commands/make/event.js +25 -0
  16. package/build/commands/make/listener.d.ts +10 -0
  17. package/build/commands/make/listener.js +48 -0
  18. package/build/commands/make/middleware.d.ts +8 -0
  19. package/build/commands/make/middleware.js +25 -0
  20. package/build/commands/make/provider.d.ts +8 -0
  21. package/build/commands/make/provider.js +25 -0
  22. package/build/index.d.ts +140 -0
  23. package/build/index.js +21 -0
  24. package/build/legacy/validator.d.ts +1 -0
  25. package/build/legacy/validator.js +1 -0
  26. package/build/modules/ace/commands.d.ts +26 -0
  27. package/build/modules/ace/commands.js +63 -0
  28. package/build/modules/ace/create_kernel.d.ts +3 -0
  29. package/build/modules/ace/create_kernel.js +33 -0
  30. package/build/modules/ace/kernel.d.ts +7 -0
  31. package/build/modules/ace/kernel.js +14 -0
  32. package/build/modules/ace/main.d.ts +3 -0
  33. package/build/modules/ace/main.js +3 -0
  34. package/build/modules/app.d.ts +1 -0
  35. package/build/modules/app.js +1 -0
  36. package/build/modules/bodyparser/bodyparser_middleware.d.ts +2 -0
  37. package/build/modules/bodyparser/bodyparser_middleware.js +2 -0
  38. package/build/modules/bodyparser/main.d.ts +1 -0
  39. package/build/modules/bodyparser/main.js +1 -0
  40. package/build/modules/config.d.ts +1 -0
  41. package/build/modules/config.js +1 -0
  42. package/build/modules/container.d.ts +1 -0
  43. package/build/modules/container.js +1 -0
  44. package/build/modules/encryption.d.ts +1 -0
  45. package/build/modules/encryption.js +1 -0
  46. package/build/modules/env.d.ts +1 -0
  47. package/build/modules/env.js +1 -0
  48. package/build/modules/events.d.ts +1 -0
  49. package/build/modules/events.js +1 -0
  50. package/build/modules/hash/define_config.d.ts +15 -0
  51. package/build/modules/hash/define_config.js +19 -0
  52. package/build/modules/hash/drivers_collection.d.ts +9 -0
  53. package/build/modules/hash/drivers_collection.js +22 -0
  54. package/build/modules/hash/main.d.ts +2 -0
  55. package/build/modules/hash/main.js +2 -0
  56. package/build/modules/http.d.ts +1 -0
  57. package/build/modules/http.js +1 -0
  58. package/build/modules/logger.d.ts +1 -0
  59. package/build/modules/logger.js +1 -0
  60. package/build/providers/app_provider.d.ts +16 -0
  61. package/build/providers/app_provider.js +74 -0
  62. package/build/providers/hash_provider.d.ts +9 -0
  63. package/build/providers/hash_provider.js +29 -0
  64. package/build/providers/http_provider.d.ts +9 -0
  65. package/build/providers/http_provider.js +36 -0
  66. package/build/services/ace.d.ts +3 -0
  67. package/build/services/ace.js +6 -0
  68. package/build/services/app.d.ts +4 -12
  69. package/build/services/app.js +5 -12
  70. package/build/services/config.d.ts +3 -3
  71. package/build/services/config.js +6 -12
  72. package/build/services/emitter.d.ts +3 -0
  73. package/build/services/emitter.js +7 -0
  74. package/build/services/encryption.d.ts +3 -3
  75. package/build/services/encryption.js +7 -12
  76. package/build/services/hash.d.ts +3 -3
  77. package/build/services/hash.js +7 -12
  78. package/build/services/logger.d.ts +3 -0
  79. package/build/services/logger.js +7 -0
  80. package/build/services/router.d.ts +3 -0
  81. package/build/services/router.js +7 -0
  82. package/build/services/server.d.ts +3 -0
  83. package/build/services/server.js +7 -0
  84. package/build/services/test_utils.d.ts +3 -0
  85. package/build/services/test_utils.js +6 -0
  86. package/build/src/debug.d.ts +3 -0
  87. package/build/src/debug.js +2 -0
  88. package/build/src/helpers/is.d.ts +2 -0
  89. package/build/src/helpers/is.js +2 -0
  90. package/build/src/helpers/main.d.ts +2 -0
  91. package/build/src/helpers/main.js +2 -0
  92. package/build/src/helpers/string.d.ts +17 -0
  93. package/build/src/helpers/string.js +26 -0
  94. package/build/src/helpers/string_builder.d.ts +23 -0
  95. package/build/src/helpers/string_builder.js +86 -0
  96. package/build/src/helpers/types.d.ts +24 -0
  97. package/build/src/helpers/types.js +29 -0
  98. package/build/src/ignitor/ace.d.ts +8 -0
  99. package/build/src/ignitor/ace.js +31 -0
  100. package/build/src/ignitor/http.d.ts +10 -0
  101. package/build/src/ignitor/http.js +62 -0
  102. package/build/src/ignitor/main.d.ts +17 -0
  103. package/build/src/ignitor/main.js +45 -0
  104. package/build/src/ignitor/test.d.ts +8 -0
  105. package/build/src/ignitor/test.js +18 -0
  106. package/build/src/test_utils/http.d.ts +10 -0
  107. package/build/src/test_utils/http.js +42 -0
  108. package/build/src/test_utils/main.d.ts +19 -0
  109. package/build/src/test_utils/main.js +33 -0
  110. package/build/src/types.d.ts +63 -0
  111. package/build/src/types.js +1 -0
  112. package/build/stubs/index.d.ts +1 -0
  113. package/build/stubs/index.js +2 -0
  114. package/build/stubs/make/command/main.stub +19 -0
  115. package/build/stubs/make/controller/api.stub +33 -0
  116. package/build/stubs/make/controller/main.stub +9 -0
  117. package/build/stubs/make/controller/resource.stub +43 -0
  118. package/build/stubs/make/event/main.stub +15 -0
  119. package/build/stubs/make/listener/for_event.stub +13 -0
  120. package/build/stubs/make/listener/main.stub +7 -0
  121. package/build/stubs/make/middleware/main.stub +22 -0
  122. package/build/stubs/make/provider/main.stub +35 -0
  123. package/build/types/ace.d.ts +5 -0
  124. package/build/types/ace.js +1 -0
  125. package/build/types/app.d.ts +1 -0
  126. package/build/types/app.js +1 -0
  127. package/build/types/bodyparser.d.ts +1 -0
  128. package/build/types/bodyparser.js +1 -0
  129. package/build/types/container.d.ts +1 -0
  130. package/build/types/container.js +1 -0
  131. package/build/types/encryption.d.ts +1 -0
  132. package/build/types/encryption.js +1 -0
  133. package/build/types/events.d.ts +1 -0
  134. package/build/types/events.js +1 -0
  135. package/build/types/hash.d.ts +1 -0
  136. package/build/types/hash.js +1 -0
  137. package/build/types/http.d.ts +1 -0
  138. package/build/types/http.js +1 -0
  139. package/build/types/logger.d.ts +1 -0
  140. package/build/types/logger.js +1 -0
  141. package/package.json +226 -245
  142. package/build/adonis-typings/ace.d.ts +0 -5
  143. package/build/adonis-typings/ace.js +0 -8
  144. package/build/adonis-typings/assets-manager.d.ts +0 -88
  145. package/build/adonis-typings/assets-manager.js +0 -8
  146. package/build/adonis-typings/container.d.ts +0 -14
  147. package/build/adonis-typings/container.js +0 -8
  148. package/build/adonis-typings/cors.d.ts +0 -15
  149. package/build/adonis-typings/cors.js +0 -8
  150. package/build/adonis-typings/exception-handler.d.ts +0 -31
  151. package/build/adonis-typings/exception-handler.js +0 -8
  152. package/build/adonis-typings/health-check.d.ts +0 -40
  153. package/build/adonis-typings/health-check.js +0 -8
  154. package/build/adonis-typings/index.d.ts +0 -17
  155. package/build/adonis-typings/index.js +0 -25
  156. package/build/adonis-typings/static.d.ts +0 -15
  157. package/build/adonis-typings/static.js +0 -8
  158. package/build/adonis-typings/test-utils.d.ts +0 -24
  159. package/build/adonis-typings/test-utils.js +0 -8
  160. package/build/adonis-typings/tests.d.ts +0 -13
  161. package/build/adonis-typings/tests.js +0 -11
  162. package/build/commands/DumpRc.d.ts +0 -13
  163. package/build/commands/DumpRc.js +0 -33
  164. package/build/commands/GenerateKey.js +0 -25
  165. package/build/commands/ListRoutes/Renderers/Base.d.ts +0 -31
  166. package/build/commands/ListRoutes/Renderers/Base.js +0 -70
  167. package/build/commands/ListRoutes/Renderers/PrettyRenderer.d.ts +0 -51
  168. package/build/commands/ListRoutes/Renderers/PrettyRenderer.js +0 -135
  169. package/build/commands/ListRoutes/Renderers/TableRenderer.d.ts +0 -36
  170. package/build/commands/ListRoutes/Renderers/TableRenderer.js +0 -137
  171. package/build/commands/ListRoutes/index.d.ts +0 -75
  172. package/build/commands/ListRoutes/index.js +0 -166
  173. package/build/commands/index.d.ts +0 -2
  174. package/build/commands/index.js +0 -15
  175. package/build/config.d.ts +0 -2
  176. package/build/config.js +0 -15
  177. package/build/instructions.js +0 -81
  178. package/build/providers/AppProvider.d.ts +0 -68
  179. package/build/providers/AppProvider.js +0 -201
  180. package/build/services/base.d.ts +0 -3
  181. package/build/services/base.js +0 -23
  182. package/build/services/bodyparser.d.ts +0 -2
  183. package/build/services/bodyparser.js +0 -12
  184. package/build/services/drive.d.ts +0 -3
  185. package/build/services/drive.js +0 -12
  186. package/build/services/event.d.ts +0 -3
  187. package/build/services/event.js +0 -12
  188. package/build/services/healthChecks.d.ts +0 -3
  189. package/build/services/healthChecks.js +0 -12
  190. package/build/services/httpContext.d.ts +0 -3
  191. package/build/services/httpContext.js +0 -12
  192. package/build/services/route.d.ts +0 -3
  193. package/build/services/route.js +0 -12
  194. package/build/services/validator.d.ts +0 -3
  195. package/build/services/validator.js +0 -12
  196. package/build/src/AssetsManager/Drivers/Encore.d.ts +0 -78
  197. package/build/src/AssetsManager/Drivers/Encore.js +0 -148
  198. package/build/src/AssetsManager/Drivers/Fake.d.ts +0 -37
  199. package/build/src/AssetsManager/Drivers/Fake.js +0 -60
  200. package/build/src/AssetsManager/index.d.ts +0 -83
  201. package/build/src/AssetsManager/index.js +0 -171
  202. package/build/src/Bindings/Repl.d.ts +0 -8
  203. package/build/src/Bindings/Repl.js +0 -90
  204. package/build/src/Bindings/Tests.d.ts +0 -7
  205. package/build/src/Bindings/Tests.js +0 -66
  206. package/build/src/HealthCheck/Checkers/AppKey.d.ts +0 -6
  207. package/build/src/HealthCheck/Checkers/AppKey.js +0 -60
  208. package/build/src/HealthCheck/Checkers/Env.d.ts +0 -6
  209. package/build/src/HealthCheck/Checkers/Env.js +0 -42
  210. package/build/src/HealthCheck/index.d.ts +0 -48
  211. package/build/src/HealthCheck/index.js +0 -99
  212. package/build/src/Hooks/Cors/index.d.ts +0 -70
  213. package/build/src/Hooks/Cors/index.js +0 -314
  214. package/build/src/Hooks/Static/index.d.ts +0 -18
  215. package/build/src/Hooks/Static/index.js +0 -66
  216. package/build/src/HttpExceptionHandler/index.d.ts +0 -82
  217. package/build/src/HttpExceptionHandler/index.js +0 -213
  218. package/build/src/Ignitor/Ace/App/index.d.ts +0 -60
  219. package/build/src/Ignitor/Ace/App/index.js +0 -236
  220. package/build/src/Ignitor/Ace/Exceptions/index.d.ts +0 -4
  221. package/build/src/Ignitor/Ace/Exceptions/index.js +0 -19
  222. package/build/src/Ignitor/Ace/GenerateManifest/index.d.ts +0 -28
  223. package/build/src/Ignitor/Ace/GenerateManifest/index.js +0 -75
  224. package/build/src/Ignitor/Ace/index.d.ts +0 -11
  225. package/build/src/Ignitor/Ace/index.js +0 -36
  226. package/build/src/Ignitor/HttpServer/index.d.ts +0 -56
  227. package/build/src/Ignitor/HttpServer/index.js +0 -127
  228. package/build/src/Ignitor/Kernel/index.d.ts +0 -56
  229. package/build/src/Ignitor/Kernel/index.js +0 -123
  230. package/build/src/Ignitor/SignalsListener/index.d.ts +0 -23
  231. package/build/src/Ignitor/SignalsListener/index.js +0 -66
  232. package/build/src/Ignitor/index.d.ts +0 -32
  233. package/build/src/Ignitor/index.js +0 -58
  234. package/build/src/TestUtils/HttpServer/index.d.ts +0 -27
  235. package/build/src/TestUtils/HttpServer/index.js +0 -56
  236. package/build/src/TestUtils/index.d.ts +0 -24
  237. package/build/src/TestUtils/index.js +0 -43
  238. package/build/src/utils/index.d.ts +0 -18
  239. package/build/src/utils/index.js +0 -82
  240. package/build/standalone.d.ts +0 -9
  241. package/build/standalone.js +0 -52
  242. package/build/templates/config/app.txt +0 -303
  243. package/build/templates/config/bodyparser.txt +0 -211
  244. package/build/templates/config/cors.txt +0 -134
  245. package/build/templates/config/drive.txt +0 -149
  246. package/build/templates/config/hash.txt +0 -96
  247. package/build/templates/config/static.txt +0 -89
  248. package/build/templates/contracts/drive.txt +0 -13
  249. package/build/templates/contracts/env.txt +0 -24
  250. package/build/templates/contracts/events.txt +0 -31
  251. package/build/templates/contracts/hash.txt +0 -13
  252. package/build/templates/env.txt +0 -31
@@ -1,201 +0,0 @@
1
- "use strict";
2
- /*
3
- * @adonisjs/core
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
- Object.defineProperty(exports, "__esModule", { value: true });
11
- const base_1 = require("../services/base");
12
- /**
13
- * The application provider that sticks all core components
14
- * to the container.
15
- */
16
- class AppProvider {
17
- constructor(app) {
18
- this.app = app;
19
- /**
20
- * Find if web or test environment
21
- */
22
- this.isWebOrTestEnvironment = ['web', 'test'].includes(this.app.environment);
23
- /**
24
- * Additional providers to load
25
- */
26
- this.provides = [
27
- '@adonisjs/encryption',
28
- '@adonisjs/events',
29
- '@adonisjs/drive',
30
- '@adonisjs/hash',
31
- '@adonisjs/http-server',
32
- '@adonisjs/bodyparser',
33
- '@adonisjs/validator',
34
- ];
35
- }
36
- /**
37
- * Register `HttpExceptionHandler` to the container.
38
- */
39
- registerHttpExceptionHandler() {
40
- this.app.container.bind('Adonis/Core/HttpExceptionHandler', () => {
41
- const { HttpExceptionHandler } = require('../src/HttpExceptionHandler');
42
- return HttpExceptionHandler;
43
- });
44
- }
45
- /**
46
- * Registering the health check provider
47
- */
48
- registerHealthCheck() {
49
- this.app.container.singleton('Adonis/Core/HealthCheck', () => {
50
- const { HealthCheck } = require('../src/HealthCheck');
51
- return new HealthCheck(this.app);
52
- });
53
- }
54
- /**
55
- * Registering the assets manager
56
- */
57
- registerAssetsManager() {
58
- this.app.container.singleton('Adonis/Core/AssetsManager', () => {
59
- const { AssetsManager } = require('../src/AssetsManager');
60
- const config = this.app.container.resolveBinding('Adonis/Core/Config').get('app.assets', {});
61
- return new AssetsManager(config, this.app);
62
- });
63
- }
64
- /**
65
- * Lazy initialize the cors hook, if enabled inside the config
66
- */
67
- registerCorsHook() {
68
- /**
69
- * Do not register hooks when not running in web
70
- * environment
71
- */
72
- if (!this.isWebOrTestEnvironment) {
73
- return;
74
- }
75
- /**
76
- * Register the cors before hook with the server
77
- */
78
- this.app.container.withBindings(['Adonis/Core/Config', 'Adonis/Core/Server'], (Config, Server) => {
79
- const config = Config.get('cors', {});
80
- if (!config.enabled) {
81
- return;
82
- }
83
- const { Cors } = require('../src/Hooks/Cors');
84
- const cors = new Cors(config);
85
- Server.hooks.before(cors.handle.bind(cors));
86
- });
87
- }
88
- /**
89
- * Lazy initialize the static assets hook, if enabled inside the config
90
- */
91
- registerStaticAssetsHook() {
92
- /**
93
- * Do not register hooks when not running in web
94
- * environment
95
- */
96
- if (!this.isWebOrTestEnvironment) {
97
- return;
98
- }
99
- /**
100
- * Register the cors before hook with the server
101
- */
102
- this.app.container.withBindings(['Adonis/Core/Config', 'Adonis/Core/Server', 'Adonis/Core/Application'], (Config, Server, Application) => {
103
- const config = Config.get('static', {});
104
- if (!config.enabled) {
105
- return;
106
- }
107
- const ServeStatic = require('../src/Hooks/Static').ServeStatic;
108
- const serveStatic = new ServeStatic(Application.publicPath(), config);
109
- Server.hooks.before(serveStatic.handle.bind(serveStatic));
110
- });
111
- }
112
- /**
113
- * Registers base health checkers
114
- */
115
- registerHealthCheckers() {
116
- /**
117
- * Do not register hooks when not running in web
118
- * environment
119
- */
120
- if (!this.isWebOrTestEnvironment) {
121
- return;
122
- }
123
- this.app.container.withBindings(['Adonis/Core/HealthCheck'], (healthCheck) => {
124
- require('../src/HealthCheck/Checkers/Env').default(healthCheck);
125
- require('../src/HealthCheck/Checkers/AppKey').default(healthCheck);
126
- });
127
- }
128
- /**
129
- * Register ace kernel to the container. When the process is started
130
- * by running an ace command, then the "Adonis/Core/Ace" binding
131
- * will already be in place and hence we do not overwrite it.
132
- */
133
- registerAceKernel() {
134
- if (!this.app.container.hasBinding('Adonis/Core/Ace')) {
135
- this.app.container.singleton('Adonis/Core/Ace', () => {
136
- const { Kernel } = require('@adonisjs/ace');
137
- return new Kernel(this.app);
138
- });
139
- }
140
- }
141
- /**
142
- * Register utilities object required during testing
143
- */
144
- registerTestUtils() {
145
- this.app.container.singleton('Adonis/Core/TestUtils', () => {
146
- const { TestUtils } = require('../src/TestUtils');
147
- return new TestUtils(this.app);
148
- });
149
- }
150
- /**
151
- * Define repl bindings
152
- */
153
- defineReplBindings() {
154
- /**
155
- * Do not register repl bindings when not running in "repl"
156
- * environment
157
- */
158
- if (this.app.environment !== 'repl') {
159
- return;
160
- }
161
- /**
162
- * Define REPL bindings
163
- */
164
- this.app.container.withBindings(['Adonis/Addons/Repl'], (Repl) => {
165
- const { defineReplBindings } = require('../src/Bindings/Repl');
166
- defineReplBindings(this.app, Repl);
167
- });
168
- }
169
- /**
170
- * Define bindings for japa tests
171
- */
172
- defineTestsBindings() {
173
- this.app.container.withBindings(['Japa/Preset/ApiRequest', 'Japa/Preset/ApiClient', 'Adonis/Core/CookieClient'], (ApiRequest, ApiClient, CookieClient) => {
174
- const { defineTestsBindings } = require('../src/Bindings/Tests');
175
- defineTestsBindings(ApiRequest, ApiClient, CookieClient);
176
- });
177
- }
178
- /**
179
- * Registering all required bindings to the container
180
- */
181
- register() {
182
- (0, base_1.setApp)(this.app);
183
- this.registerHttpExceptionHandler();
184
- this.registerHealthCheck();
185
- this.registerAssetsManager();
186
- this.registerAceKernel();
187
- this.registerTestUtils();
188
- }
189
- /**
190
- * Register hooks and health checkers on boot
191
- */
192
- boot() {
193
- this.registerCorsHook();
194
- this.registerStaticAssetsHook();
195
- this.registerHealthCheckers();
196
- this.defineReplBindings();
197
- this.defineTestsBindings();
198
- }
199
- }
200
- exports.default = AppProvider;
201
- AppProvider.needsApplication = true;
@@ -1,3 +0,0 @@
1
- import { ApplicationContract } from '@ioc:Adonis/Core/Application';
2
- export declare function setApp(app: ApplicationContract): void;
3
- export declare function getApp(): ApplicationContract;
@@ -1,23 +0,0 @@
1
- "use strict";
2
- /*
3
- * @adonisjs/core
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
- Object.defineProperty(exports, "__esModule", { value: true });
11
- exports.getApp = exports.setApp = void 0;
12
- let appInstance;
13
- function setApp(app) {
14
- appInstance = app;
15
- }
16
- exports.setApp = setApp;
17
- function getApp() {
18
- if (!appInstance) {
19
- throw new Error('Cannot get AdonisJS application instance. Make sure to boot the application');
20
- }
21
- return appInstance;
22
- }
23
- exports.getApp = getApp;
@@ -1,2 +0,0 @@
1
- declare const _default: any;
2
- export default _default;
@@ -1,12 +0,0 @@
1
- "use strict";
2
- /*
3
- * @adonisjs/core
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
- Object.defineProperty(exports, "__esModule", { value: true });
11
- const base_1 = require("./base");
12
- exports.default = (0, base_1.getApp)().container.resolveBinding('Adonis/Core/BodyParser');
@@ -1,3 +0,0 @@
1
- /// <reference types="@adonisjs/drive/build/adonis-typings/drive" />
2
- declare const _default: import("@ioc:Adonis/Core/Drive").DriveManagerContract;
3
- export default _default;
@@ -1,12 +0,0 @@
1
- "use strict";
2
- /*
3
- * @adonisjs/core
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
- Object.defineProperty(exports, "__esModule", { value: true });
11
- const base_1 = require("./base");
12
- exports.default = (0, base_1.getApp)().container.resolveBinding('Adonis/Core/Drive');
@@ -1,3 +0,0 @@
1
- /// <reference types="@adonisjs/events/build/adonis-typings/events" />
2
- declare const _default: import("@ioc:Adonis/Core/Event").EmitterContract;
3
- export default _default;
@@ -1,12 +0,0 @@
1
- "use strict";
2
- /*
3
- * @adonisjs/core
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
- Object.defineProperty(exports, "__esModule", { value: true });
11
- const base_1 = require("./base");
12
- exports.default = (0, base_1.getApp)().container.resolveBinding('Adonis/Core/Event');
@@ -1,3 +0,0 @@
1
- /// <reference path="../adonis-typings/health-check.d.ts" />
2
- declare const _default: import("@ioc:Adonis/Core/HealthCheck").HealthCheckContract;
3
- export default _default;
@@ -1,12 +0,0 @@
1
- "use strict";
2
- /*
3
- * @adonisjs/core
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
- Object.defineProperty(exports, "__esModule", { value: true });
11
- const base_1 = require("./base");
12
- exports.default = (0, base_1.getApp)().container.resolveBinding('Adonis/Core/HealthCheck');
@@ -1,3 +0,0 @@
1
- /// <reference types="@adonisjs/http-server/build/adonis-typings" />
2
- declare const _default: import("@ioc:Adonis/Core/HttpContext").HttpContextConstructorContract;
3
- export default _default;
@@ -1,12 +0,0 @@
1
- "use strict";
2
- /*
3
- * @adonisjs/core
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
- Object.defineProperty(exports, "__esModule", { value: true });
11
- const base_1 = require("./base");
12
- exports.default = (0, base_1.getApp)().container.resolveBinding('Adonis/Core/HttpContext');
@@ -1,3 +0,0 @@
1
- /// <reference types="@adonisjs/http-server/build/adonis-typings" />
2
- declare const _default: import("@ioc:Adonis/Core/Route").RouterContract;
3
- export default _default;
@@ -1,12 +0,0 @@
1
- "use strict";
2
- /*
3
- * @adonisjs/core
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
- Object.defineProperty(exports, "__esModule", { value: true });
11
- const base_1 = require("./base");
12
- exports.default = (0, base_1.getApp)().container.resolveBinding('Adonis/Core/Route');
@@ -1,3 +0,0 @@
1
- /// <reference types="@adonisjs/validator/build/adonis-typings/validator" />
2
- declare const _default: typeof import("@ioc:Adonis/Core/Validator");
3
- export default _default;
@@ -1,12 +0,0 @@
1
- "use strict";
2
- /*
3
- * @adonisjs/core
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
- Object.defineProperty(exports, "__esModule", { value: true });
11
- const base_1 = require("./base");
12
- exports.default = (0, base_1.getApp)().container.resolveBinding('Adonis/Core/Validator');
@@ -1,78 +0,0 @@
1
- import { ApplicationContract } from '@ioc:Adonis/Core/Application';
2
- import { AssetsDriverContract } from '@ioc:Adonis/Core/AssetsManager';
3
- /**
4
- * Resolves entry points and assets path for webpack encore. Relies
5
- * on the "manifest.json" and "entrypoints.json" files.
6
- *
7
- **********************************************************************
8
- * The driver assumes following format for the manifest.json file
9
- **********************************************************************
10
- *
11
- * ```json
12
- * {
13
- * "assetName": "assetUrl"
14
- * }
15
- * ```
16
- **********************************************************************
17
- * The driver assumes following format for the entrypoints.json file
18
- ***********************************************************************
19
- *
20
- * ```json
21
- * {
22
- * "entrypoints": {
23
- * "entrypointName": {
24
- * "js": ["path1", "path2"],
25
- * "css": ["path1", "path2"]
26
- * }
27
- * }
28
- * }
29
- * ```
30
- */
31
- export declare class EncoreDriver implements AssetsDriverContract {
32
- private application;
33
- /**
34
- * We cache the manifest contents and the entrypoints contents
35
- * in production
36
- */
37
- private manifestCache?;
38
- private entrypointsCache?;
39
- name: string;
40
- /**
41
- * Encore driver has support for entrypoints
42
- */
43
- hasEntrypoints: boolean;
44
- /**
45
- * Path to the output public dir. Defaults to `/public/assets`
46
- */
47
- publicPath: string;
48
- /**
49
- * Returns the version of the assets by hashing the manifest file
50
- * contents
51
- */
52
- get version(): string;
53
- constructor(application: ApplicationContract);
54
- /**
55
- * Reads the file contents as JSON
56
- */
57
- private readFileAsJSON;
58
- /**
59
- * Returns the manifest contents as object
60
- */
61
- manifest(): any;
62
- /**
63
- * Returns path to a given asset file
64
- */
65
- assetPath(name: string): string;
66
- /**
67
- * Returns the entrypoints contents as object
68
- */
69
- entryPoints(): any;
70
- /**
71
- * Returns list for all the javascript files for a given entry point
72
- */
73
- entryPointJsFiles(name: string): string[];
74
- /**
75
- * Returns list for all the css files for a given entry point
76
- */
77
- entryPointCssFiles(name: string): string[];
78
- }
@@ -1,148 +0,0 @@
1
- "use strict";
2
- /*
3
- * @adonisjs/core
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
- Object.defineProperty(exports, "__esModule", { value: true });
11
- exports.EncoreDriver = void 0;
12
- const path_1 = require("path");
13
- const crypto_1 = require("crypto");
14
- const fs_extra_1 = require("fs-extra");
15
- /**
16
- * Resolves entry points and assets path for webpack encore. Relies
17
- * on the "manifest.json" and "entrypoints.json" files.
18
- *
19
- **********************************************************************
20
- * The driver assumes following format for the manifest.json file
21
- **********************************************************************
22
- *
23
- * ```json
24
- * {
25
- * "assetName": "assetUrl"
26
- * }
27
- * ```
28
- **********************************************************************
29
- * The driver assumes following format for the entrypoints.json file
30
- ***********************************************************************
31
- *
32
- * ```json
33
- * {
34
- * "entrypoints": {
35
- * "entrypointName": {
36
- * "js": ["path1", "path2"],
37
- * "css": ["path1", "path2"]
38
- * }
39
- * }
40
- * }
41
- * ```
42
- */
43
- class EncoreDriver {
44
- constructor(application) {
45
- this.application = application;
46
- this.name = 'encore';
47
- /**
48
- * Encore driver has support for entrypoints
49
- */
50
- this.hasEntrypoints = true;
51
- /**
52
- * Path to the output public dir. Defaults to `/public/assets`
53
- */
54
- this.publicPath = this.application.publicPath('assets');
55
- }
56
- /**
57
- * Returns the version of the assets by hashing the manifest file
58
- * contents
59
- */
60
- get version() {
61
- return (0, crypto_1.createHash)('md5').update(JSON.stringify(this.manifest())).digest('hex').slice(0, 10);
62
- }
63
- /**
64
- * Reads the file contents as JSON
65
- */
66
- readFileAsJSON(filePath) {
67
- /**
68
- * Ensure the file exists, otherwise raise a meaningful exception
69
- */
70
- if (!(0, fs_extra_1.pathExistsSync)(filePath)) {
71
- throw new Error(`Cannot find "${filePath}" file. Make sure you are compiling assets`);
72
- }
73
- return JSON.parse((0, fs_extra_1.readFileSync)(filePath, 'utf-8'));
74
- }
75
- /**
76
- * Returns the manifest contents as object
77
- */
78
- manifest() {
79
- /**
80
- * Use in-memory cache when exists
81
- */
82
- if (this.manifestCache) {
83
- this.application.logger.trace('reading encore manifest from cache');
84
- return this.manifestCache;
85
- }
86
- const manifest = this.readFileAsJSON((0, path_1.join)(this.publicPath, 'manifest.json'));
87
- this.application.logger.trace('reading encore manifest from %s', this.publicPath);
88
- /**
89
- * Cache manifest in production to avoid re-reading the file from disk
90
- */
91
- if (this.application.inProduction) {
92
- this.manifestCache = manifest;
93
- }
94
- return manifest;
95
- }
96
- /**
97
- * Returns path to a given asset file
98
- */
99
- assetPath(name) {
100
- const manifest = this.manifest();
101
- if (!manifest[name]) {
102
- throw new Error(`Cannot find path for "${name}" asset. Make sure you are compiling assets`);
103
- }
104
- return manifest[name];
105
- }
106
- /**
107
- * Returns the entrypoints contents as object
108
- */
109
- entryPoints() {
110
- /**
111
- * Use in-memory cache when exists
112
- */
113
- if (this.entrypointsCache) {
114
- this.application.logger.trace('reading encore entrypoints from cache');
115
- return this.entrypointsCache;
116
- }
117
- const entryPoints = this.readFileAsJSON((0, path_1.join)(this.publicPath, 'entrypoints.json'));
118
- this.application.logger.trace('reading encore entrypoints from %s', this.publicPath);
119
- /**
120
- * Cache entrypoints file in production to avoid re-reading the file from disk
121
- */
122
- if (this.application.inProduction) {
123
- this.entrypointsCache = entryPoints.entrypoints || {};
124
- }
125
- return entryPoints.entrypoints || {};
126
- }
127
- /**
128
- * Returns list for all the javascript files for a given entry point
129
- */
130
- entryPointJsFiles(name) {
131
- const entrypoints = this.entryPoints();
132
- if (!entrypoints[name]) {
133
- throw new Error(`Cannot find assets for "${name}" entrypoint. Make sure you are compiling assets`);
134
- }
135
- return entrypoints[name].js || [];
136
- }
137
- /**
138
- * Returns list for all the css files for a given entry point
139
- */
140
- entryPointCssFiles(name) {
141
- const entrypoints = this.entryPoints();
142
- if (!entrypoints[name]) {
143
- throw new Error(`Cannot find assets for "${name}" entrypoint. Make sure you are compiling assets`);
144
- }
145
- return entrypoints[name].css || [];
146
- }
147
- }
148
- exports.EncoreDriver = EncoreDriver;
@@ -1,37 +0,0 @@
1
- import { ApplicationContract } from '@ioc:Adonis/Core/Application';
2
- import { AssetsDriverContract } from '@ioc:Adonis/Core/AssetsManager';
3
- /**
4
- * Fake driver stubs out the implementation of the Assets
5
- * manager with empty return data.
6
- *
7
- * The main use case is to make assets manager work during
8
- * testing without compiling the real assets
9
- */
10
- export declare class FakeDriver implements AssetsDriverContract {
11
- private application;
12
- name: string;
13
- hasEntrypoints: boolean;
14
- publicPath: string;
15
- get version(): string;
16
- constructor(application: ApplicationContract);
17
- /**
18
- * Returns the manifest contents as object
19
- */
20
- manifest(): {};
21
- /**
22
- * Returns path to a given asset file
23
- */
24
- assetPath(name: string): string;
25
- /**
26
- * Returns the entrypoints contents as object
27
- */
28
- entryPoints(): {};
29
- /**
30
- * Returns list for all the javascript files for a given entry point
31
- */
32
- entryPointJsFiles(_: string): string[];
33
- /**
34
- * Returns list for all the css files for a given entry point
35
- */
36
- entryPointCssFiles(_: string): string[];
37
- }
@@ -1,60 +0,0 @@
1
- "use strict";
2
- /*
3
- * @adonisjs/core
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
- Object.defineProperty(exports, "__esModule", { value: true });
11
- exports.FakeDriver = void 0;
12
- /**
13
- * Fake driver stubs out the implementation of the Assets
14
- * manager with empty return data.
15
- *
16
- * The main use case is to make assets manager work during
17
- * testing without compiling the real assets
18
- */
19
- class FakeDriver {
20
- constructor(application) {
21
- this.application = application;
22
- this.name = 'fake';
23
- this.hasEntrypoints = true;
24
- this.publicPath = this.application.publicPath('assets');
25
- }
26
- get version() {
27
- return '';
28
- }
29
- /**
30
- * Returns the manifest contents as object
31
- */
32
- manifest() {
33
- return {};
34
- }
35
- /**
36
- * Returns path to a given asset file
37
- */
38
- assetPath(name) {
39
- return `__fake('${name}')`;
40
- }
41
- /**
42
- * Returns the entrypoints contents as object
43
- */
44
- entryPoints() {
45
- return {};
46
- }
47
- /**
48
- * Returns list for all the javascript files for a given entry point
49
- */
50
- entryPointJsFiles(_) {
51
- return [];
52
- }
53
- /**
54
- * Returns list for all the css files for a given entry point
55
- */
56
- entryPointCssFiles(_) {
57
- return [];
58
- }
59
- }
60
- exports.FakeDriver = FakeDriver;