@adonisjs/vite 2.0.0 → 2.0.2-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.
- package/README.md +2 -2
- package/build/configure.js +21 -6
- package/build/index.d.ts +0 -1
- package/build/index.js +0 -1
- package/build/src/backend/vite.js +2 -13
- package/build/src/client/utils.d.ts +1 -0
- package/build/stubs/{config.stub → config/vite.stub} +6 -0
- package/build/stubs/main.js +10 -0
- package/package.json +21 -21
- package/build/stubs/index.js +0 -2
- /package/build/stubs/{index.d.ts → main.d.ts} +0 -0
- /package/build/stubs/{client_config.stub → vite.config.stub} +0 -0
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-
|
|
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
|
|
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"
|
package/build/configure.js
CHANGED
|
@@ -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
|
-
|
|
22
|
-
|
|
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
|
-
|
|
40
|
+
await codemods.listPackagesToInstall([{ name: 'vite', isDevDependency: true }]);
|
|
26
41
|
}
|
|
27
42
|
}
|
package/build/index.d.ts
CHANGED
package/build/index.js
CHANGED
|
@@ -151,10 +151,9 @@ export class Vite {
|
|
|
151
151
|
tag: this.#generateTag(chunk.file, { ...attributes, integrity: chunk.integrity }),
|
|
152
152
|
});
|
|
153
153
|
for (const css of chunk.css || []) {
|
|
154
|
-
const cssChunk = this.#chunkByFile(manifest, css);
|
|
155
154
|
tags.push({
|
|
156
|
-
path:
|
|
157
|
-
tag: this.#generateTag(
|
|
155
|
+
path: css,
|
|
156
|
+
tag: this.#generateTag(css),
|
|
158
157
|
});
|
|
159
158
|
}
|
|
160
159
|
}
|
|
@@ -172,16 +171,6 @@ export class Vite {
|
|
|
172
171
|
}
|
|
173
172
|
return chunk;
|
|
174
173
|
}
|
|
175
|
-
/**
|
|
176
|
-
* Get a chunk from the manifest file for a given hashed file name
|
|
177
|
-
*/
|
|
178
|
-
#chunkByFile(manifest, fileName) {
|
|
179
|
-
const chunk = Object.values(manifest).find((c) => c.file === fileName);
|
|
180
|
-
if (!chunk) {
|
|
181
|
-
throw new Error(`Cannot find "${fileName}" chunk in the manifest file`);
|
|
182
|
-
}
|
|
183
|
-
return chunk;
|
|
184
|
-
}
|
|
185
174
|
/**
|
|
186
175
|
* Check if the given path is a CSS path
|
|
187
176
|
*/
|
|
@@ -11,6 +11,12 @@ const viteBackendConfig = defineConfig({
|
|
|
11
11
|
*/
|
|
12
12
|
buildDirectory: 'public/assets',
|
|
13
13
|
|
|
14
|
+
/**
|
|
15
|
+
* The path to the manifest file generated by the
|
|
16
|
+
* "vite build" command.
|
|
17
|
+
*/
|
|
18
|
+
manifestFile: 'public/assets/.vite/manifest.json',
|
|
19
|
+
|
|
14
20
|
/**
|
|
15
21
|
* Feel free to change the value of the "assetsUrl" to
|
|
16
22
|
* point to a CDN in production.
|
|
@@ -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.0",
|
|
4
|
+
"version": "2.0.2-0",
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": ">=18.16.0"
|
|
7
7
|
},
|
|
@@ -43,33 +43,33 @@
|
|
|
43
43
|
"prepublishOnly": "npm run build"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
|
-
"@adonisjs/assembler": "^
|
|
47
|
-
"@adonisjs/core": "^6.1.5-
|
|
48
|
-
"@adonisjs/eslint-config": "^1.
|
|
49
|
-
"@adonisjs/prettier-config": "^1.
|
|
50
|
-
"@adonisjs/session": "^7.0.0-
|
|
51
|
-
"@adonisjs/shield": "^8.0.0-
|
|
52
|
-
"@adonisjs/tsconfig": "^1.
|
|
46
|
+
"@adonisjs/assembler": "^7.0.0-1",
|
|
47
|
+
"@adonisjs/core": "^6.1.5-36",
|
|
48
|
+
"@adonisjs/eslint-config": "^1.2.0",
|
|
49
|
+
"@adonisjs/prettier-config": "^1.2.0",
|
|
50
|
+
"@adonisjs/session": "^7.0.0-15",
|
|
51
|
+
"@adonisjs/shield": "^8.0.0-10",
|
|
52
|
+
"@adonisjs/tsconfig": "^1.2.0",
|
|
53
53
|
"@commitlint/cli": "^18.4.3",
|
|
54
54
|
"@commitlint/config-conventional": "^18.4.3",
|
|
55
|
-
"@japa/assert": "^2.0
|
|
56
|
-
"@japa/expect-type": "^2.0.
|
|
57
|
-
"@japa/file-system": "^2.
|
|
58
|
-
"@japa/runner": "^3.1.
|
|
59
|
-
"@swc/core": "^1.3.
|
|
60
|
-
"@types/node": "^20.10.
|
|
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.101",
|
|
60
|
+
"@types/node": "^20.10.5",
|
|
61
61
|
"c8": "^8.0.0",
|
|
62
62
|
"copyfiles": "^2.4.1",
|
|
63
63
|
"del-cli": "^5.1.0",
|
|
64
64
|
"edge.js": "^6.0.0",
|
|
65
|
-
"eslint": "^8.
|
|
65
|
+
"eslint": "^8.56.0",
|
|
66
66
|
"husky": "^8.0.3",
|
|
67
|
-
"np": "^
|
|
68
|
-
"prettier": "^3.1.
|
|
69
|
-
"rollup": "^4.
|
|
70
|
-
"ts-node": "^10.9.
|
|
71
|
-
"typescript": "5.
|
|
72
|
-
"vite": "^5.0.
|
|
67
|
+
"np": "^9.2.0",
|
|
68
|
+
"prettier": "^3.1.1",
|
|
69
|
+
"rollup": "^4.9.1",
|
|
70
|
+
"ts-node": "^10.9.2",
|
|
71
|
+
"typescript": "^5.3.3",
|
|
72
|
+
"vite": "^5.0.10"
|
|
73
73
|
},
|
|
74
74
|
"dependencies": {
|
|
75
75
|
"defu": "^6.1.3",
|
package/build/stubs/index.js
DELETED
|
File without changes
|
|
File without changes
|