@adonisjs/assembler 5.9.4 → 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 (97) hide show
  1. package/LICENSE.md +1 -1
  2. package/build/index.d.ts +2 -0
  3. package/build/index.js +2 -0
  4. package/build/src/bundler.d.ts +10 -0
  5. package/build/src/bundler.js +133 -0
  6. package/build/src/dev_server.d.ts +13 -0
  7. package/build/src/dev_server.js +189 -0
  8. package/build/src/run.d.ts +3 -0
  9. package/build/src/run.js +19 -0
  10. package/build/src/types.d.ts +26 -0
  11. package/build/src/watch.d.ts +8 -0
  12. package/build/src/watch.js +18 -0
  13. package/package.json +77 -99
  14. package/build/ace-manifest.json +0 -521
  15. package/build/commands/Build.d.ts +0 -37
  16. package/build/commands/Build.js +0 -138
  17. package/build/commands/Invoke.d.ts +0 -34
  18. package/build/commands/Invoke.js +0 -234
  19. package/build/commands/Make/Base.d.ts +0 -30
  20. package/build/commands/Make/Base.js +0 -75
  21. package/build/commands/Make/Command.d.ts +0 -35
  22. package/build/commands/Make/Command.js +0 -82
  23. package/build/commands/Make/Controller.d.ts +0 -37
  24. package/build/commands/Make/Controller.js +0 -89
  25. package/build/commands/Make/Exception.d.ts +0 -32
  26. package/build/commands/Make/Exception.js +0 -75
  27. package/build/commands/Make/Listener.d.ts +0 -30
  28. package/build/commands/Make/Listener.js +0 -70
  29. package/build/commands/Make/Middleware.d.ts +0 -31
  30. package/build/commands/Make/Middleware.js +0 -87
  31. package/build/commands/Make/PreloadFile.d.ts +0 -38
  32. package/build/commands/Make/PreloadFile.js +0 -157
  33. package/build/commands/Make/Provider.d.ts +0 -31
  34. package/build/commands/Make/Provider.js +0 -114
  35. package/build/commands/Make/Suite.d.ts +0 -41
  36. package/build/commands/Make/Suite.js +0 -120
  37. package/build/commands/Make/Test.d.ts +0 -35
  38. package/build/commands/Make/Test.js +0 -96
  39. package/build/commands/Make/Validator.d.ts +0 -31
  40. package/build/commands/Make/Validator.js +0 -71
  41. package/build/commands/Make/View.d.ts +0 -30
  42. package/build/commands/Make/View.js +0 -70
  43. package/build/commands/Serve.d.ts +0 -33
  44. package/build/commands/Serve.js +0 -112
  45. package/build/commands/Test.d.ts +0 -57
  46. package/build/commands/Test.js +0 -159
  47. package/build/commands/TypeCheck.d.ts +0 -16
  48. package/build/commands/TypeCheck.js +0 -85
  49. package/build/config/paths.d.ts +0 -7
  50. package/build/config/paths.js +0 -18
  51. package/build/register.js +0 -15
  52. package/build/src/AssetsBundler/index.d.ts +0 -76
  53. package/build/src/AssetsBundler/index.js +0 -216
  54. package/build/src/Compiler/index.d.ts +0 -62
  55. package/build/src/Compiler/index.js +0 -287
  56. package/build/src/Contracts/index.d.ts +0 -8
  57. package/build/src/Contracts/index.js +0 -10
  58. package/build/src/DevServer/index.d.ts +0 -70
  59. package/build/src/DevServer/index.js +0 -306
  60. package/build/src/EnvParser/index.d.ts +0 -21
  61. package/build/src/EnvParser/index.js +0 -48
  62. package/build/src/HttpServer/index.d.ts +0 -34
  63. package/build/src/HttpServer/index.js +0 -87
  64. package/build/src/Manifest/index.d.ts +0 -32
  65. package/build/src/Manifest/index.js +0 -88
  66. package/build/src/RcFile/index.d.ts +0 -72
  67. package/build/src/RcFile/index.js +0 -174
  68. package/build/src/Test/index.d.ts +0 -75
  69. package/build/src/Test/index.js +0 -346
  70. package/build/src/Test/process.d.ts +0 -22
  71. package/build/src/Test/process.js +0 -68
  72. package/build/src/Ts/index.d.ts +0 -24
  73. package/build/src/Ts/index.js +0 -55
  74. package/build/src/requireHook/index.d.ts +0 -5
  75. package/build/src/requireHook/index.js +0 -28
  76. package/build/src/requireHook/ioc-transformer.d.ts +0 -6
  77. package/build/src/requireHook/ioc-transformer.js +0 -21
  78. package/build/templates/command.txt +0 -33
  79. package/build/templates/controller.txt +0 -3
  80. package/build/templates/event-listener.txt +0 -3
  81. package/build/templates/exception.txt +0 -15
  82. package/build/templates/middleware.txt +0 -8
  83. package/build/templates/preload-file.txt +0 -9
  84. package/build/templates/provider.txt +0 -40
  85. package/build/templates/resource-controller.txt +0 -17
  86. package/build/templates/self-handle-exception.txt +0 -32
  87. package/build/templates/test-entrypoint.txt +0 -45
  88. package/build/templates/test.txt +0 -5
  89. package/build/templates/tests/bootstrap.txt +0 -69
  90. package/build/templates/tests/functional/hello_world_api.spec.txt +0 -8
  91. package/build/templates/tests/functional/hello_world_slim.spec.txt +0 -8
  92. package/build/templates/tests/functional/hello_world_web.spec.txt +0 -8
  93. package/build/templates/tests-contract.txt +0 -18
  94. package/build/templates/validator.txt +0 -40
  95. package/build/templates/view.txt +0 -0
  96. package/build/templates/webpack.config.txt +0 -214
  97. /package/build/{register.d.ts → src/types.js} +0 -0
@@ -1,40 +0,0 @@
1
- import type { ApplicationContract } from '@ioc:Adonis/Core/Application'
2
-
3
- /*
4
- |--------------------------------------------------------------------------
5
- | Provider
6
- |--------------------------------------------------------------------------
7
- |
8
- | Your application is not ready when this file is loaded by the framework.
9
- | Hence, the top level imports relying on the IoC container will not work.
10
- | You must import them inside the life-cycle methods defined inside
11
- | the provider class.
12
- |
13
- | @example:
14
- |
15
- | public async ready () {
16
- | const Database = this.app.container.resolveBinding('Adonis/Lucid/Database')
17
- | const Event = this.app.container.resolveBinding('Adonis/Core/Event')
18
- | Event.on('db:query', Database.prettyPrint)
19
- | }
20
- |
21
- */
22
- export default class {{ filename }} {
23
- constructor(protected app: ApplicationContract) {}
24
-
25
- public register() {
26
- // Register your own bindings
27
- }
28
-
29
- public async boot() {
30
- // All bindings are ready, feel free to use them
31
- }
32
-
33
- public async ready() {
34
- // App is ready
35
- }
36
-
37
- public async shutdown() {
38
- // Cleanup, since app is going down
39
- }
40
- }
@@ -1,17 +0,0 @@
1
- import type { HttpContextContract } from '@ioc:Adonis/Core/HttpContext'
2
-
3
- export default class {{ filename }} {
4
- public async index({}: HttpContextContract) {}
5
-
6
- public async create({}: HttpContextContract) {}
7
-
8
- public async store({}: HttpContextContract) {}
9
-
10
- public async show({}: HttpContextContract) {}
11
-
12
- public async edit({}: HttpContextContract) {}
13
-
14
- public async update({}: HttpContextContract) {}
15
-
16
- public async destroy({}: HttpContextContract) {}
17
- }
@@ -1,32 +0,0 @@
1
- import { Exception } from '@adonisjs/core/build/standalone'
2
- import type { HttpContextContract } from '@ioc:Adonis/Core/HttpContext'
3
-
4
- /*
5
- |--------------------------------------------------------------------------
6
- | Exception
7
- |--------------------------------------------------------------------------
8
- |
9
- | The Exception class imported from `@adonisjs/core` allows defining
10
- | a status code and error code for every exception.
11
- |
12
- | @example
13
- | new {{ filename }}('message', 500, 'E_RUNTIME_EXCEPTION')
14
- |
15
- */
16
- export default class {{ filename }} extends Exception {
17
- /**
18
- * The handle method allows you to self handle the exception and
19
- * return an HTTP response.
20
- *
21
- * This is how it works under the hood.
22
- *
23
- * - You raise this exception
24
- * - The exception goes uncatched/unhandled through out the entire HTTP request cycle.
25
- * - Just before making the response. AdonisJS will call the `handle` method.
26
- * Giving you a chance to convert the exception to response.
27
- *
28
- */
29
- public async handle(error: this, ctx: HttpContextContract) {
30
- ctx.response.status(error.status || 500).send(error.message)
31
- }
32
- }
@@ -1,45 +0,0 @@
1
- /*
2
- |--------------------------------------------------------------------------
3
- | Tests
4
- |--------------------------------------------------------------------------
5
- |
6
- | The contents in this file boots the AdonisJS application and configures
7
- | the Japa tests runner.
8
- |
9
- | For the most part you will never edit this file. The configuration
10
- | for the tests can be controlled via ".adonisrc.json" and
11
- | "tests/bootstrap.ts" files.
12
- |
13
- */
14
-
15
- process.env.NODE_ENV = 'test'
16
-
17
- import 'reflect-metadata'
18
- import sourceMapSupport from 'source-map-support'
19
- import { Ignitor } from '@adonisjs/core/build/standalone'
20
- import { configure, processCliArgs, run, RunnerHooksHandler } from '@japa/runner'
21
-
22
- sourceMapSupport.install({ handleUncaughtExceptions: false })
23
-
24
- const kernel = new Ignitor(__dirname).kernel('test')
25
-
26
- kernel
27
- .boot()
28
- .then(() => import('./tests/bootstrap'))
29
- .then(({ runnerHooks, ...config }) => {
30
- const app: RunnerHooksHandler[] = [() => kernel.start()]
31
-
32
- configure({
33
- ...kernel.application.rcFile.tests,
34
- ...processCliArgs(process.argv.slice(2)),
35
- ...config,
36
- ...{
37
- importer: (filePath) => import(filePath),
38
- setup: app.concat(runnerHooks.setup),
39
- teardown: runnerHooks.teardown,
40
- },
41
- cwd: kernel.application.appRoot
42
- })
43
-
44
- run()
45
- })
@@ -1,5 +0,0 @@
1
- import { test } from '@japa/runner'
2
-
3
- test.group('{{ name }}', () => {
4
- // Write your test here
5
- })
@@ -1,69 +0,0 @@
1
- /**
2
- * File source: https://bit.ly/3ukaHTz
3
- *
4
- * Feel free to let us know via PR, if you find something broken in this contract
5
- * file.
6
- */
7
-
8
- import type { Config } from '@japa/runner'
9
- import TestUtils from '@ioc:Adonis/Core/TestUtils'
10
- import { assert, runFailedTests, specReporter, apiClient } from '@japa/preset-adonis'
11
-
12
- /*
13
- |--------------------------------------------------------------------------
14
- | Japa Plugins
15
- |--------------------------------------------------------------------------
16
- |
17
- | Japa plugins allows you to add additional features to Japa. By default
18
- | we register the assertion plugin.
19
- |
20
- | Feel free to remove existing plugins or add more.
21
- |
22
- */
23
- export const plugins: Required<Config>['plugins'] = [assert(), runFailedTests(), apiClient()]
24
-
25
- /*
26
- |--------------------------------------------------------------------------
27
- | Japa Reporters
28
- |--------------------------------------------------------------------------
29
- |
30
- | Japa reporters displays/saves the progress of tests as they are executed.
31
- | By default, we register the spec reporter to show a detailed report
32
- | of tests on the terminal.
33
- |
34
- */
35
- export const reporters: Required<Config>['reporters'] = [specReporter()]
36
-
37
- /*
38
- |--------------------------------------------------------------------------
39
- | Runner hooks
40
- |--------------------------------------------------------------------------
41
- |
42
- | Runner hooks are executed after booting the AdonisJS app and
43
- | before the test files are imported.
44
- |
45
- | You can perform actions like starting the HTTP server or running migrations
46
- | within the runner hooks
47
- |
48
- */
49
- export const runnerHooks: Pick<Required<Config>, 'setup' | 'teardown'> = {
50
- setup: [() => TestUtils.ace().loadCommands()],
51
- teardown: [],
52
- }
53
-
54
- /*
55
- |--------------------------------------------------------------------------
56
- | Configure individual suites
57
- |--------------------------------------------------------------------------
58
- |
59
- | The configureSuite method gets called for every test suite registered
60
- | within ".adonisrc.json" file.
61
- |
62
- | You can use this method to configure suites. For example: Only start
63
- | the HTTP server when it is a functional suite.
64
- */
65
- export const configureSuite: Required<Config>['configureSuite'] = (suite) => {
66
- if (suite.name === 'functional') {
67
- suite.setup(() => TestUtils.httpServer().start())
68
- }
69
- }
@@ -1,8 +0,0 @@
1
- import { test } from '@japa/runner'
2
-
3
- test('display welcome page', async ({ client }) => {
4
- const response = await client.get('/')
5
-
6
- response.assertStatus(200)
7
- response.assertBodyContains({ hello: 'world' })
8
- })
@@ -1,8 +0,0 @@
1
- import { test } from '@japa/runner'
2
-
3
- test('display welcome page', async ({ client }) => {
4
- const response = await client.get('/')
5
-
6
- response.assertStatus(200)
7
- response.assertTextIncludes('Hello world')
8
- })
@@ -1,8 +0,0 @@
1
- import { test } from '@japa/runner'
2
-
3
- test('display welcome page', async ({ client }) => {
4
- const response = await client.get('/')
5
-
6
- response.assertStatus(200)
7
- response.assertTextIncludes('<h1 class="title"> It Works! </h1>')
8
- })
@@ -1,18 +0,0 @@
1
- /**
2
- * Contract source: https://bit.ly/3DP1ypf
3
- *
4
- * Feel free to let us know via PR, if you find something broken in this contract
5
- * file.
6
- */
7
-
8
- import '@japa/runner'
9
-
10
- declare module '@japa/runner' {
11
- interface TestContext {
12
- // Extend context
13
- }
14
-
15
- interface Test<TestData> {
16
- // Extend test
17
- }
18
- }
@@ -1,40 +0,0 @@
1
- import { schema, CustomMessages } from '@ioc:Adonis/Core/Validator'
2
- import type { HttpContextContract } from '@ioc:Adonis/Core/HttpContext'
3
-
4
- export default class {{ filename }} {
5
- constructor(protected ctx: HttpContextContract) {}
6
-
7
- /*
8
- * Define schema to validate the "shape", "type", "formatting" and "integrity" of data.
9
- *
10
- * For example:
11
- * 1. The username must be of data type string. But then also, it should
12
- * not contain special characters or numbers.
13
- * ```
14
- * schema.string({}, [ rules.alpha() ])
15
- * ```
16
- *
17
- * 2. The email must be of data type string, formatted as a valid
18
- * email. But also, not used by any other user.
19
- * ```
20
- * schema.string({}, [
21
- * rules.email(),
22
- * rules.unique({ table: 'users', column: 'email' }),
23
- * ])
24
- * ```
25
- */
26
- public schema = schema.create({})
27
-
28
- /**
29
- * Custom messages for validation failures. You can make use of dot notation `(.)`
30
- * for targeting nested fields and array expressions `(*)` for targeting all
31
- * children of an array. For example:
32
- *
33
- * {
34
- * 'profile.username.required': 'Username is required',
35
- * 'scores.*.number': 'Define scores as valid numbers'
36
- * }
37
- *
38
- */
39
- public messages: CustomMessages = {}
40
- }
File without changes
@@ -1,214 +0,0 @@
1
- const { join } = require('path')
2
- const Encore = require('@symfony/webpack-encore')
3
-
4
- /*
5
- |--------------------------------------------------------------------------
6
- | Encore runtime environment
7
- |--------------------------------------------------------------------------
8
- */
9
- if (!Encore.isRuntimeEnvironmentConfigured()) {
10
- Encore.configureRuntimeEnvironment(process.env.NODE_ENV || 'dev')
11
- }
12
-
13
- /*
14
- |--------------------------------------------------------------------------
15
- | Output path
16
- |--------------------------------------------------------------------------
17
- |
18
- | The output path for writing the compiled files. It should always
19
- | be inside the public directory, so that AdonisJS can serve it.
20
- |
21
- */
22
- Encore.setOutputPath('./public/assets')
23
-
24
- /*
25
- |--------------------------------------------------------------------------
26
- | Public URI
27
- |--------------------------------------------------------------------------
28
- |
29
- | The public URI to access the static files. It should always be
30
- | relative from the "public" directory.
31
- |
32
- */
33
- Encore.setPublicPath('/assets')
34
-
35
- /*
36
- |--------------------------------------------------------------------------
37
- | Entrypoints
38
- |--------------------------------------------------------------------------
39
- |
40
- | Entrypoints are script files that boots your frontend application. Ideally
41
- | a single entrypoint is used by majority of applications. However, feel
42
- | free to add more (if required).
43
- |
44
- | Also, make sure to read the docs on "Assets bundler" to learn more about
45
- | entrypoints.
46
- |
47
- */
48
- Encore.addEntry('app', './resources/js/app.js')
49
-
50
- /*
51
- |--------------------------------------------------------------------------
52
- | Copy assets
53
- |--------------------------------------------------------------------------
54
- |
55
- | Since the edge templates are not part of the Webpack compile lifecycle, any
56
- | images referenced by it will not be processed by Webpack automatically. Hence
57
- | we must copy them manually.
58
- |
59
- */
60
- // Encore.copyFiles({
61
- // from: './resources/images',
62
- // to: 'images/[path][name].[hash:8].[ext]',
63
- // })
64
-
65
- /*
66
- |--------------------------------------------------------------------------
67
- | Split shared code
68
- |--------------------------------------------------------------------------
69
- |
70
- | Instead of bundling duplicate code in all the bundles, generate a separate
71
- | bundle for the shared code.
72
- |
73
- | https://symfony.com/doc/current/frontend/encore/split-chunks.html
74
- | https://webpack.js.org/plugins/split-chunks-plugin/
75
- |
76
- */
77
- // Encore.splitEntryChunks()
78
-
79
- /*
80
- |--------------------------------------------------------------------------
81
- | Isolated entrypoints
82
- |--------------------------------------------------------------------------
83
- |
84
- | Treat each entry point and its dependencies as its own isolated module.
85
- |
86
- */
87
- Encore.disableSingleRuntimeChunk()
88
-
89
- /*
90
- |--------------------------------------------------------------------------
91
- | Cleanup output folder
92
- |--------------------------------------------------------------------------
93
- |
94
- | It is always nice to cleanup the build output before creating a build. It
95
- | will ensure that all unused files from the previous build are removed.
96
- |
97
- */
98
- Encore.cleanupOutputBeforeBuild()
99
-
100
- /*
101
- |--------------------------------------------------------------------------
102
- | Source maps
103
- |--------------------------------------------------------------------------
104
- |
105
- | Enable source maps in production
106
- |
107
- */
108
- Encore.enableSourceMaps(!Encore.isProduction())
109
-
110
- /*
111
- |--------------------------------------------------------------------------
112
- | Assets versioning
113
- |--------------------------------------------------------------------------
114
- |
115
- | Enable assets versioning to leverage lifetime browser and CDN cache
116
- |
117
- */
118
- Encore.enableVersioning(Encore.isProduction())
119
-
120
- /*
121
- |--------------------------------------------------------------------------
122
- | Configure dev server
123
- |--------------------------------------------------------------------------
124
- |
125
- | Here we configure the dev server to enable live reloading for edge templates.
126
- | Remember edge templates are not processed by Webpack and hence we need
127
- | to watch them explicitly and livereload the browser.
128
- |
129
- */
130
- Encore.configureDevServerOptions((options) => {
131
- /**
132
- * Normalize "options.static" property to an array
133
- */
134
- if (!options.static) {
135
- options.static = []
136
- } else if (!Array.isArray(options.static)) {
137
- options.static = [options.static]
138
- }
139
-
140
- /**
141
- * Enable live reload and add views directory
142
- */
143
- options.liveReload = true
144
- options.static.push({
145
- directory: join(__dirname, './resources/views'),
146
- watch: true,
147
- })
148
- })
149
-
150
- /*
151
- |--------------------------------------------------------------------------
152
- | CSS precompilers support
153
- |--------------------------------------------------------------------------
154
- |
155
- | Uncomment one of the following lines of code to enable support for your
156
- | favorite CSS precompiler
157
- |
158
- */
159
- // Encore.enableSassLoader()
160
- // Encore.enableLessLoader()
161
- // Encore.enableStylusLoader()
162
-
163
- /*
164
- |--------------------------------------------------------------------------
165
- | CSS loaders
166
- |--------------------------------------------------------------------------
167
- |
168
- | Uncomment one of the following line of code to enable support for
169
- | PostCSS or CSS.
170
- |
171
- */
172
- // Encore.enablePostCssLoader()
173
- // Encore.configureCssLoader(() => {})
174
-
175
- /*
176
- |--------------------------------------------------------------------------
177
- | Enable Vue loader
178
- |--------------------------------------------------------------------------
179
- |
180
- | Uncomment the following lines of code to enable support for vue. Also make
181
- | sure to install the required dependencies.
182
- |
183
- */
184
- // Encore.enableVueLoader(() => {}, {
185
- // version: 3,
186
- // runtimeCompilerBuild: false,
187
- // useJsx: false
188
- // })
189
-
190
- /*
191
- |--------------------------------------------------------------------------
192
- | Configure logging
193
- |--------------------------------------------------------------------------
194
- |
195
- | To keep the terminal clean from unnecessary info statements , we only
196
- | log warnings and errors. If you want all the logs, you can change
197
- | the level to "info".
198
- |
199
- */
200
- const config = Encore.getWebpackConfig()
201
- config.infrastructureLogging = {
202
- level: 'warn',
203
- }
204
- config.stats = 'errors-warnings'
205
-
206
- /*
207
- |--------------------------------------------------------------------------
208
- | Export config
209
- |--------------------------------------------------------------------------
210
- |
211
- | Export config for webpack to do its job
212
- |
213
- */
214
- module.exports = config
File without changes