@adonisjs/vite 2.0.1 → 2.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -8,7 +8,7 @@
8
8
  Package to add [Vite](https://vitejs.dev/) as an assets bundler to AdonisJS.
9
9
 
10
10
  ## Official Documentation
11
- The documentation is available on the [AdonisJS website](https://docs.adonisjs.com/guides/assets-bundlers/vite)
11
+ The documentation is available on the [AdonisJS website](https://docs.adonisjs.com/guides/assets-bundling)
12
12
 
13
13
  ## Contributing
14
14
  One of the primary goals of AdonisJS is to have a vibrant community of users and contributors who believes in the principles of the framework.
@@ -19,7 +19,7 @@ We encourage you to read the [contribution guide](https://github.com/adonisjs/.g
19
19
  In order to ensure that the AdonisJS community is welcoming to all, please review and abide by the [Code of Conduct](https://github.com/adonisjs/.github/blob/main/docs/CODE_OF_CONDUCT.md).
20
20
 
21
21
  ## License
22
- AdonisJS static files middleware is open-sourced software licensed under the [MIT license](LICENSE.md).
22
+ AdonisJS Vite middleware is open-sourced software licensed under the [MIT license](LICENSE.md).
23
23
 
24
24
  [gh-workflow-image]: https://img.shields.io/github/actions/workflow/status/adonisjs/vite/checks.yml?style=for-the-badge
25
25
  [gh-workflow-url]: https://github.com/adonisjs/vite/actions/workflows/checks.yml "Github action"
@@ -6,22 +6,37 @@
6
6
  * For the full copyright and license information, please view the LICENSE
7
7
  * file that was distributed with this source code.
8
8
  */
9
+ import { stubsRoot } from './stubs/main.js';
9
10
  /**
10
11
  * Configures the package
11
12
  */
12
13
  export async function configure(command) {
13
- await command.publishStub('config.stub');
14
- await command.publishStub('client_config.stub');
15
- await command.publishStub('js_entrypoint.stub');
16
14
  const codemods = await command.createCodemods();
15
+ let shouldInstallPackages = command.parsedFlags.install;
16
+ /**
17
+ * Publish stubs
18
+ */
19
+ await codemods.makeUsingStub(stubsRoot, 'config/vite.stub', {});
20
+ await codemods.makeUsingStub(stubsRoot, 'vite.config.stub', {});
21
+ await codemods.makeUsingStub(stubsRoot, 'js_entrypoint.stub', {});
17
22
  await codemods.updateRcFile((rcFile) => {
18
23
  rcFile.addProvider('@adonisjs/vite/vite_provider');
19
24
  rcFile.addMetaFile('public/**', false);
20
25
  });
21
- if (await command.prompt.confirm('Do you want to install "vite"?')) {
22
- await command.installPackages([{ name: 'vite', isDevDependency: true }]);
26
+ /**
27
+ * Prompt when `install` or `--no-install` flags are
28
+ * not used
29
+ */
30
+ if (shouldInstallPackages === undefined) {
31
+ shouldInstallPackages = await command.prompt.confirm('Do you want to install "vite"?');
32
+ }
33
+ /**
34
+ * Install dependency or list the command to install it
35
+ */
36
+ if (shouldInstallPackages) {
37
+ await codemods.installPackages([{ name: 'vite', isDevDependency: true }]);
23
38
  }
24
39
  else {
25
- command.listPackagesToInstall([{ name: 'vite', isDevDependency: true }]);
40
+ await codemods.listPackagesToInstall([{ name: 'vite', isDevDependency: true }]);
26
41
  }
27
42
  }
package/build/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
1
  export { configure } from './configure.js';
2
- export { stubsRoot } from './stubs/index.js';
3
2
  export { Vite } from './src/backend/vite.js';
3
+ export { stubsRoot } from './stubs/main.js';
4
4
  export { defineConfig } from './src/backend/define_config.js';
package/build/index.js CHANGED
@@ -7,6 +7,6 @@
7
7
  * file that was distributed with this source code.
8
8
  */
9
9
  export { configure } from './configure.js';
10
- export { stubsRoot } from './stubs/index.js';
11
10
  export { Vite } from './src/backend/vite.js';
11
+ export { stubsRoot } from './stubs/main.js';
12
12
  export { defineConfig } from './src/backend/define_config.js';
@@ -1,5 +1,5 @@
1
1
  import type { ApplicationService } from '@adonisjs/core/types';
2
- import type { Vite } from '../src/backend/vite.js';
2
+ import { Vite } from '../src/backend/vite.js';
3
3
  /**
4
4
  * Extend the container bindings
5
5
  */
@@ -7,6 +7,8 @@
7
7
  * file that was distributed with this source code.
8
8
  */
9
9
  import debug from '../src/backend/debug.js';
10
+ import { Vite } from '../src/backend/vite.js';
11
+ import { defineConfig } from '../src/backend/define_config.js';
10
12
  export default class ViteServiceProvider {
11
13
  app;
12
14
  constructor(app) {
@@ -67,13 +69,8 @@ export default class ViteServiceProvider {
67
69
  }
68
70
  register() {
69
71
  this.app.container.singleton('vite', async () => {
70
- const { Vite } = await import('../src/backend/vite.js');
71
- const config = this.app.config.get('vite');
72
- return new Vite({
73
- ...config,
74
- buildDirectory: this.app.makePath(config.buildDirectory || 'public/build'),
75
- hotFile: this.app.makePath(config.hotFile || 'public/build/hot.json'),
76
- });
72
+ const config = this.app.config.get('vite', defineConfig({}));
73
+ return new Vite(config);
77
74
  });
78
75
  }
79
76
  async boot() {
@@ -1,3 +1,4 @@
1
+ /// <reference types="node" resolution-mode="require"/>
1
2
  import { ResolvedConfig } from 'vite';
2
3
  import { AddressInfo } from 'node:net';
3
4
  /**
@@ -0,0 +1,10 @@
1
+ /*
2
+ * @adonisjs/vite
3
+ *
4
+ * (c) AdonisJS
5
+ *
6
+ * For the full copyright and license information, please view the LICENSE
7
+ * file that was distributed with this source code.
8
+ */
9
+ import { getDirname } from '@poppinss/utils';
10
+ export const stubsRoot = getDirname(import.meta.url);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@adonisjs/vite",
3
3
  "description": "Vite plugin for Adonis.js",
4
- "version": "2.0.1",
4
+ "version": "2.0.2",
5
5
  "engines": {
6
6
  "node": ">=18.16.0"
7
7
  },
@@ -43,44 +43,44 @@
43
43
  "prepublishOnly": "npm run build"
44
44
  },
45
45
  "devDependencies": {
46
- "@adonisjs/assembler": "^6.1.3-28",
47
- "@adonisjs/core": "^6.1.5-32",
48
- "@adonisjs/eslint-config": "^1.1.9",
49
- "@adonisjs/prettier-config": "^1.1.9",
50
- "@adonisjs/session": "^7.0.0-14",
51
- "@adonisjs/shield": "^8.0.0-9",
52
- "@adonisjs/tsconfig": "^1.1.9",
53
- "@commitlint/cli": "^18.4.3",
54
- "@commitlint/config-conventional": "^18.4.3",
55
- "@japa/assert": "^2.0.1",
56
- "@japa/expect-type": "^2.0.0",
57
- "@japa/file-system": "^2.0.1",
58
- "@japa/runner": "^3.1.0",
59
- "@swc/core": "^1.3.99",
60
- "@types/node": "^20.10.0",
61
- "c8": "^8.0.0",
46
+ "@adonisjs/assembler": "^7.0.0",
47
+ "@adonisjs/core": "^6.2.0",
48
+ "@adonisjs/eslint-config": "^1.2.1",
49
+ "@adonisjs/prettier-config": "^1.2.1",
50
+ "@adonisjs/session": "^7.0.0",
51
+ "@adonisjs/shield": "^8.0.0",
52
+ "@adonisjs/tsconfig": "^1.2.1",
53
+ "@commitlint/cli": "^18.4.4",
54
+ "@commitlint/config-conventional": "^18.4.4",
55
+ "@japa/assert": "^2.1.0",
56
+ "@japa/expect-type": "^2.0.1",
57
+ "@japa/file-system": "^2.1.1",
58
+ "@japa/runner": "^3.1.1",
59
+ "@swc/core": "^1.3.102",
60
+ "@types/node": "^20.10.7",
61
+ "c8": "^9.0.0",
62
62
  "copyfiles": "^2.4.1",
63
63
  "del-cli": "^5.1.0",
64
- "edge.js": "^6.0.0",
65
- "eslint": "^8.54.0",
64
+ "edge.js": "^6.0.1",
65
+ "eslint": "^8.56.0",
66
66
  "husky": "^8.0.3",
67
- "np": "^8.0.4",
68
- "prettier": "^3.1.0",
69
- "rollup": "^4.6.0",
70
- "ts-node": "^10.9.1",
71
- "typescript": "5.2.2",
72
- "vite": "^5.0.2"
67
+ "np": "^9.2.0",
68
+ "prettier": "^3.1.1",
69
+ "rollup": "^4.9.4",
70
+ "ts-node": "^10.9.2",
71
+ "typescript": "^5.3.3",
72
+ "vite": "^5.0.11"
73
73
  },
74
74
  "dependencies": {
75
- "defu": "^6.1.3",
76
- "edge-error": "^4.0.0",
75
+ "defu": "^6.1.4",
76
+ "edge-error": "^4.0.1",
77
77
  "vite-plugin-restart": "^0.4.0"
78
78
  },
79
79
  "peerDependencies": {
80
- "@adonisjs/core": "^6.1.5-32",
81
- "@adonisjs/shield": "^8.0.0-9",
82
- "edge.js": "^6.0.0",
83
- "vite": "^4.0.0 || ^5.0.0"
80
+ "@adonisjs/core": "^6.2.0",
81
+ "@adonisjs/shield": "^8.0.0",
82
+ "edge.js": "^6.0.1",
83
+ "vite": "^5.0.11"
84
84
  },
85
85
  "peerDependenciesMeta": {
86
86
  "vite": {
@@ -1,2 +0,0 @@
1
- import { getDirname } from '@poppinss/utils';
2
- export const stubsRoot = getDirname(import.meta.url);
File without changes
File without changes