@adonisjs/vite 0.0.1-0 → 0.0.1-10
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/build/configure.d.ts +3 -1
- package/build/configure.js +24 -10
- package/build/index.d.ts +1 -1
- package/build/index.js +9 -0
- package/build/providers/vite_provider.d.ts +14 -4
- package/build/providers/vite_provider.js +82 -36
- package/build/services/vite.d.ts +1 -2
- package/build/services/vite.js +12 -0
- package/build/src/backend/debug.d.ts +3 -0
- package/{src/backend/types/extended.ts → build/src/backend/debug.js} +2 -11
- package/build/src/backend/define_config.d.ts +5 -0
- package/build/src/backend/define_config.js +19 -0
- package/build/src/backend/edge_plugin_vite.d.ts +7 -0
- package/build/src/backend/edge_plugin_vite.js +86 -0
- package/build/src/backend/types/extended.d.ts +8 -1
- package/build/src/backend/types/extended.js +8 -0
- package/build/src/backend/types/main.d.ts +57 -1
- package/build/src/backend/types/main.js +8 -0
- package/build/src/backend/utils.d.ts +7 -1
- package/build/src/backend/utils.js +29 -0
- package/build/src/backend/vite.d.ts +33 -13
- package/build/src/backend/vite.js +206 -113
- package/build/src/{vite_plugin → client}/config.d.ts +7 -2
- package/build/src/{vite_plugin → client}/config.js +28 -2
- package/build/src/{vite_plugin → client}/config_resolver.d.ts +13 -2
- package/build/src/{vite_plugin → client}/config_resolver.js +22 -3
- package/build/src/{vite_plugin → client}/helpers/inertia.d.ts +3 -1
- package/build/src/{vite_plugin → client}/helpers/inertia.js +11 -0
- package/build/src/{vite_plugin → client}/hot_file.d.ts +6 -1
- package/build/src/{vite_plugin → client}/hot_file.js +21 -2
- package/build/src/client/main.d.ts +6 -0
- package/build/src/client/main.js +24 -0
- package/build/src/client/types.d.ts +35 -0
- package/build/src/client/types.js +9 -0
- package/build/src/{vite_plugin → client}/utils.d.ts +7 -2
- package/build/src/{vite_plugin → client}/utils.js +14 -0
- package/build/stubs/client_config.stub +22 -0
- package/build/stubs/config.stub +21 -0
- package/build/stubs/index.d.ts +0 -1
- package/build/stubs/index.js +2 -2
- package/build/stubs/js_entrypoint.stub +4 -0
- package/package.json +74 -81
- package/build/configure.d.ts.map +0 -1
- package/build/index.d.ts.map +0 -1
- package/build/providers/vite_provider.d.ts.map +0 -1
- package/build/services/vite.d.ts.map +0 -1
- package/build/src/backend/types/extended.d.ts.map +0 -1
- package/build/src/backend/types/main.d.ts.map +0 -1
- package/build/src/backend/utils.d.ts.map +0 -1
- package/build/src/backend/vite.d.ts.map +0 -1
- package/build/src/vite_plugin/config.d.ts.map +0 -1
- package/build/src/vite_plugin/config_resolver.d.ts.map +0 -1
- package/build/src/vite_plugin/helpers/inertia.d.ts.map +0 -1
- package/build/src/vite_plugin/hot_file.d.ts.map +0 -1
- package/build/src/vite_plugin/index.d.ts +0 -4
- package/build/src/vite_plugin/index.d.ts.map +0 -1
- package/build/src/vite_plugin/index.js +0 -16
- package/build/src/vite_plugin/types/index.d.ts +0 -10
- package/build/src/vite_plugin/types/index.d.ts.map +0 -1
- package/build/src/vite_plugin/types/index.js +0 -1
- package/build/src/vite_plugin/utils.d.ts.map +0 -1
- package/build/stubs/index.d.ts.map +0 -1
- package/build/stubs/vite/vite_config.stub +0 -14
- package/configure.ts +0 -30
- package/index.ts +0 -15
- package/providers/vite_provider.ts +0 -89
- package/services/vite.ts +0 -23
- package/src/backend/types/main.ts +0 -31
- package/src/backend/utils.ts +0 -19
- package/src/backend/vite.ts +0 -367
- package/src/vite_plugin/config.ts +0 -97
- package/src/vite_plugin/config_resolver.ts +0 -62
- package/src/vite_plugin/helpers/inertia.ts +0 -27
- package/src/vite_plugin/hot_file.ts +0 -59
- package/src/vite_plugin/index.ts +0 -38
- package/src/vite_plugin/types/index.ts +0 -56
- package/src/vite_plugin/utils.ts +0 -40
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Possible plugin options
|
|
3
|
+
*/
|
|
4
|
+
export type PluginOptions = {
|
|
5
|
+
/**
|
|
6
|
+
* Path to the hot file
|
|
7
|
+
*
|
|
8
|
+
* @default public/hot.json
|
|
9
|
+
*/
|
|
10
|
+
hotFile?: string;
|
|
11
|
+
/**
|
|
12
|
+
* Paths to the entrypoints files
|
|
13
|
+
*/
|
|
14
|
+
entrypoints: string[];
|
|
15
|
+
/**
|
|
16
|
+
* The URL where the assets will be served. This is particularly
|
|
17
|
+
* useful if you are using a CDN to deploy your assets.
|
|
18
|
+
*
|
|
19
|
+
* @default ''
|
|
20
|
+
*/
|
|
21
|
+
assetsUrl?: string;
|
|
22
|
+
/**
|
|
23
|
+
* Public directory where the assets will be compiled.
|
|
24
|
+
*
|
|
25
|
+
* @default 'public/assets'
|
|
26
|
+
*/
|
|
27
|
+
buildDirectory?: string;
|
|
28
|
+
/**
|
|
29
|
+
* Files that should trigger a page reload when changed.
|
|
30
|
+
*
|
|
31
|
+
* @default ['./resources/views/** /*.edge']
|
|
32
|
+
*/
|
|
33
|
+
reload?: string[];
|
|
34
|
+
};
|
|
35
|
+
export type PluginFullOptions = Required<PluginOptions>;
|
|
@@ -1,5 +1,10 @@
|
|
|
1
|
-
import { AddressInfo } from 'node:net';
|
|
2
1
|
import { ResolvedConfig } from 'vite';
|
|
2
|
+
import { AddressInfo } from 'node:net';
|
|
3
|
+
/**
|
|
4
|
+
* Resolve the dev server URL from the server address and configuration.
|
|
5
|
+
*/
|
|
3
6
|
export declare const resolveDevServerUrl: (address: AddressInfo, config: ResolvedConfig) => string;
|
|
7
|
+
/**
|
|
8
|
+
* Add a trailing slash if missing
|
|
9
|
+
*/
|
|
4
10
|
export declare const addTrailingSlash: (url: string) => string;
|
|
5
|
-
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -1,3 +1,14 @@
|
|
|
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
|
+
/**
|
|
10
|
+
* Resolve the dev server URL from the server address and configuration.
|
|
11
|
+
*/
|
|
1
12
|
export const resolveDevServerUrl = (address, config) => {
|
|
2
13
|
const configHmrProtocol = typeof config.server.hmr === 'object' ? config.server.hmr.protocol : null;
|
|
3
14
|
const clientProtocol = configHmrProtocol ? (configHmrProtocol === 'wss' ? 'https' : 'http') : null;
|
|
@@ -11,6 +22,9 @@ export const resolveDevServerUrl = (address, config) => {
|
|
|
11
22
|
}
|
|
12
23
|
return `${protocol}://${host}:${address.port}`;
|
|
13
24
|
};
|
|
25
|
+
/**
|
|
26
|
+
* Add a trailing slash if missing
|
|
27
|
+
*/
|
|
14
28
|
export const addTrailingSlash = (url) => {
|
|
15
29
|
return url.endsWith('/') ? url : url + '/';
|
|
16
30
|
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
---
|
|
2
|
+
to: {{ app.makePath('vite.config.js') }}
|
|
3
|
+
---
|
|
4
|
+
import { defineConfig } from 'vite'
|
|
5
|
+
import adonisjs from '@adonisjs/vite/client'
|
|
6
|
+
|
|
7
|
+
export default defineConfig({
|
|
8
|
+
plugins: [
|
|
9
|
+
adonisjs({
|
|
10
|
+
/**
|
|
11
|
+
* Entrypoints of your application. Each entrypoint will
|
|
12
|
+
* result in a separate bundle.
|
|
13
|
+
*/
|
|
14
|
+
entrypoints: ['resources/js/app.js'],
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Paths to watch and reload the browser on file change
|
|
18
|
+
*/
|
|
19
|
+
reloads: ['resources/views/**/*.edge'],
|
|
20
|
+
}),
|
|
21
|
+
],
|
|
22
|
+
})
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
---
|
|
2
|
+
to: {{ app.configPath('vite.ts') }}
|
|
3
|
+
---
|
|
4
|
+
import { defineConfig } from '@adonisjs/vite'
|
|
5
|
+
|
|
6
|
+
const viteBackendConfig = defineConfig({
|
|
7
|
+
/**
|
|
8
|
+
* The output of vite will be written inside this
|
|
9
|
+
* directory. The path should be relative from
|
|
10
|
+
* the application root.
|
|
11
|
+
*/
|
|
12
|
+
buildDirectory: 'public/assets',
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Feel free to change the value of the "assetsUrl" to
|
|
16
|
+
* point to a CDN in production.
|
|
17
|
+
*/
|
|
18
|
+
assetsUrl: '/assets',
|
|
19
|
+
})
|
|
20
|
+
|
|
21
|
+
export default viteBackendConfig
|
package/build/stubs/index.d.ts
CHANGED
package/build/stubs/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export const stubsRoot =
|
|
1
|
+
import { getDirname } from '@poppinss/utils';
|
|
2
|
+
export const stubsRoot = getDirname(import.meta.url);
|
package/package.json
CHANGED
|
@@ -1,22 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adonisjs/vite",
|
|
3
|
-
"version": "0.0.1-0",
|
|
4
3
|
"description": "Vite plugin for Adonis.js",
|
|
5
|
-
"
|
|
4
|
+
"version": "0.0.1-10",
|
|
5
|
+
"engines": {
|
|
6
|
+
"node": ">=18.16.0"
|
|
7
|
+
},
|
|
6
8
|
"main": "build/index.js",
|
|
9
|
+
"type": "module",
|
|
7
10
|
"files": [
|
|
8
|
-
"index.ts",
|
|
9
|
-
"configure.ts",
|
|
10
|
-
"src",
|
|
11
|
-
"services",
|
|
12
|
-
"providers",
|
|
13
|
-
"build/stubs",
|
|
14
11
|
"build/configure.js",
|
|
15
12
|
"build/configure.d.ts",
|
|
16
|
-
"build/configure.d.ts.map",
|
|
17
13
|
"build/index.js",
|
|
18
14
|
"build/index.d.ts",
|
|
19
|
-
"build/
|
|
15
|
+
"build/stubs",
|
|
20
16
|
"build/src",
|
|
21
17
|
"build/services",
|
|
22
18
|
"build/providers"
|
|
@@ -24,18 +20,18 @@
|
|
|
24
20
|
"exports": {
|
|
25
21
|
".": "./build/index.js",
|
|
26
22
|
"./services/main": "./build/services/vite.js",
|
|
27
|
-
"./
|
|
28
|
-
"./
|
|
29
|
-
"./
|
|
30
|
-
"./types
|
|
23
|
+
"./vite_provider": "./build/providers/vite_provider.js",
|
|
24
|
+
"./client": "./build/src/client/main.js",
|
|
25
|
+
"./plugin_edge": "./build/backend/edge_plugin_vite.js",
|
|
26
|
+
"./types": "./build/src/backend/types.js"
|
|
31
27
|
},
|
|
32
28
|
"scripts": {
|
|
33
29
|
"clean": "del-cli build",
|
|
34
30
|
"copy:templates": "copyfiles \"stubs/**/*.stub\" build",
|
|
35
|
-
"typecheck": "tsc --
|
|
31
|
+
"typecheck": "tsc --noEmit",
|
|
36
32
|
"lint": "eslint . --ext=.ts",
|
|
37
33
|
"format": "prettier --write .",
|
|
38
|
-
"quick:test": "node --loader=ts-node/esm bin/test.ts",
|
|
34
|
+
"quick:test": "node --enable-source-maps --loader=ts-node/esm bin/test.ts",
|
|
39
35
|
"pretest": "npm run lint",
|
|
40
36
|
"test": "c8 npm run quick:test",
|
|
41
37
|
"compile": "npm run lint && npm run clean && tsc && npm run copy:templates",
|
|
@@ -45,81 +41,74 @@
|
|
|
45
41
|
"version": "npm run build",
|
|
46
42
|
"prepublishOnly": "npm run build"
|
|
47
43
|
},
|
|
48
|
-
"keywords": [
|
|
49
|
-
"vite",
|
|
50
|
-
"adonisjs"
|
|
51
|
-
],
|
|
52
|
-
"author": "Julien Ripouteau <julien@ripouteau.com>",
|
|
53
|
-
"license": "MIT",
|
|
54
|
-
"dependencies": {
|
|
55
|
-
"defu": "^6.1.2",
|
|
56
|
-
"edge-error": "^3.0.0",
|
|
57
|
-
"vite-plugin-restart": "^0.3.1"
|
|
58
|
-
},
|
|
59
44
|
"devDependencies": {
|
|
60
|
-
"@adonisjs/
|
|
61
|
-
"@adonisjs/
|
|
62
|
-
"@
|
|
63
|
-
"@
|
|
64
|
-
"@
|
|
65
|
-
"@
|
|
66
|
-
"@
|
|
67
|
-
"@
|
|
68
|
-
"@japa/
|
|
69
|
-
"@japa/
|
|
70
|
-
"@
|
|
71
|
-
"@
|
|
72
|
-
"@
|
|
73
|
-
"
|
|
45
|
+
"@adonisjs/assembler": "^6.1.3-18",
|
|
46
|
+
"@adonisjs/core": "^6.1.5-19",
|
|
47
|
+
"@adonisjs/eslint-config": "^1.1.8",
|
|
48
|
+
"@adonisjs/prettier-config": "^1.1.8",
|
|
49
|
+
"@adonisjs/shield": "^8.0.0-3",
|
|
50
|
+
"@adonisjs/tsconfig": "^1.1.8",
|
|
51
|
+
"@commitlint/cli": "^17.6.7",
|
|
52
|
+
"@commitlint/config-conventional": "^17.6.7",
|
|
53
|
+
"@japa/assert": "^2.0.0-1",
|
|
54
|
+
"@japa/expect-type": "^2.0.0-0",
|
|
55
|
+
"@japa/file-system": "^2.0.0-1",
|
|
56
|
+
"@japa/runner": "^3.0.0-6",
|
|
57
|
+
"@swc/core": "^1.3.82",
|
|
58
|
+
"@types/node": "^20.5.9",
|
|
59
|
+
"c8": "^8.0.0",
|
|
74
60
|
"copyfiles": "^2.4.1",
|
|
75
|
-
"del-cli": "^5.
|
|
76
|
-
"
|
|
77
|
-
"eslint": "^8.
|
|
78
|
-
"eslint-config-prettier": "^8.8.0",
|
|
79
|
-
"eslint-plugin-adonis": "^3.0.3",
|
|
80
|
-
"eslint-plugin-prettier": "^4.2.1",
|
|
61
|
+
"del-cli": "^5.1.0",
|
|
62
|
+
"edge.js": "^6.0.0-8",
|
|
63
|
+
"eslint": "^8.48.0",
|
|
81
64
|
"husky": "^8.0.3",
|
|
82
|
-
"np": "^
|
|
83
|
-
"prettier": "^
|
|
84
|
-
"rollup": "^3.
|
|
65
|
+
"np": "^8.0.4",
|
|
66
|
+
"prettier": "^3.0.3",
|
|
67
|
+
"rollup": "^3.29.0",
|
|
85
68
|
"ts-node": "^10.9.1",
|
|
86
|
-
"typescript": "^5.
|
|
87
|
-
"vite": "^4.
|
|
69
|
+
"typescript": "^5.2.2",
|
|
70
|
+
"vite": "^4.4.9"
|
|
71
|
+
},
|
|
72
|
+
"dependencies": {
|
|
73
|
+
"defu": "^6.1.2",
|
|
74
|
+
"edge-error": "^4.0.0-0",
|
|
75
|
+
"vite-plugin-restart": "^0.3.1"
|
|
88
76
|
},
|
|
89
77
|
"peerDependencies": {
|
|
90
|
-
"@adonisjs/core": "^6.1.
|
|
91
|
-
"@adonisjs/
|
|
78
|
+
"@adonisjs/core": "^6.1.5-18",
|
|
79
|
+
"@adonisjs/shield": "^8.0.0-3",
|
|
80
|
+
"edge.js": "^6.0.0-8"
|
|
92
81
|
},
|
|
93
|
-
"
|
|
94
|
-
"
|
|
95
|
-
"
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
"prettier"
|
|
100
|
-
],
|
|
101
|
-
"rules": {
|
|
102
|
-
"prettier/prettier": [
|
|
103
|
-
"error",
|
|
104
|
-
{
|
|
105
|
-
"endOfLine": "auto"
|
|
106
|
-
}
|
|
107
|
-
]
|
|
82
|
+
"peerDependenciesMeta": {
|
|
83
|
+
"edge.js": {
|
|
84
|
+
"optional": true
|
|
85
|
+
},
|
|
86
|
+
"@adonisjs/shield": {
|
|
87
|
+
"optional": true
|
|
108
88
|
}
|
|
109
89
|
},
|
|
110
|
-
"
|
|
111
|
-
|
|
90
|
+
"author": "Julien Ripouteau <julien@ripouteau.com>",
|
|
91
|
+
"license": "MIT",
|
|
92
|
+
"homepage": "https://github.com/adonisjs/vite#readme",
|
|
93
|
+
"repository": {
|
|
94
|
+
"type": "git",
|
|
95
|
+
"url": "git+https://github.com/adonisjs/vite.git"
|
|
96
|
+
},
|
|
97
|
+
"bugs": {
|
|
98
|
+
"url": "https://github.com/adonisjs/vite/issues"
|
|
99
|
+
},
|
|
100
|
+
"keywords": [
|
|
101
|
+
"vite",
|
|
102
|
+
"adonisjs"
|
|
112
103
|
],
|
|
113
|
-
"
|
|
114
|
-
"
|
|
115
|
-
"
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
"
|
|
119
|
-
"bracketSpacing": true,
|
|
120
|
-
"arrowParens": "always",
|
|
121
|
-
"printWidth": 100
|
|
104
|
+
"contributors": [
|
|
105
|
+
"virk",
|
|
106
|
+
"adonisjs"
|
|
107
|
+
],
|
|
108
|
+
"eslintConfig": {
|
|
109
|
+
"extends": "@adonisjs/eslint-config/package"
|
|
122
110
|
},
|
|
111
|
+
"prettier": "@adonisjs/prettier-config",
|
|
123
112
|
"commitlint": {
|
|
124
113
|
"extends": [
|
|
125
114
|
"@commitlint/config-conventional"
|
|
@@ -141,7 +130,11 @@
|
|
|
141
130
|
"html"
|
|
142
131
|
],
|
|
143
132
|
"exclude": [
|
|
144
|
-
"tests/**"
|
|
133
|
+
"tests/**",
|
|
134
|
+
"tests_helpers/**"
|
|
145
135
|
]
|
|
136
|
+
},
|
|
137
|
+
"directories": {
|
|
138
|
+
"test": "tests"
|
|
146
139
|
}
|
|
147
140
|
}
|
package/build/configure.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"configure.d.ts","sourceRoot":"","sources":["../configure.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,SAAS,MAAM,mCAAmC,CAAA;AAK9D,wBAAsB,SAAS,CAAC,OAAO,EAAE,SAAS,iBAajD"}
|
package/build/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AASA,OAAO,iCAAiC,CAAA;AAExC,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAC1C,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AAE5C,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"vite_provider.d.ts","sourceRoot":"","sources":["../../providers/vite_provider.ts"],"names":[],"mappings":"AASA,OAAO,gBAAgB,CAAA;AACvB,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAA;AAKzD,MAAM,CAAC,OAAO,OAAO,mBAAmB;;IAC1B,SAAS,CAAC,GAAG,EAAE,kBAAkB;gBAAvB,GAAG,EAAE,kBAAkB;IA2D7C,QAAQ;IAIF,IAAI;CASX"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"vite.d.ts","sourceRoot":"","sources":["../../services/vite.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAA;AAElC,QAAA,IAAI,IAAI,EAAE,IAAI,CAAA;AAUd,OAAO,EAAE,IAAI,IAAI,OAAO,EAAE,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"extended.d.ts","sourceRoot":"","sources":["../../../../src/backend/types/extended.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAA;AAKjC,OAAO,QAAQ,sBAAsB,CAAC;IACpC,UAAU,iBAAiB;QACzB,IAAI,EAAE,IAAI,CAAA;KACX;CACF"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../../../../src/backend/types/main.ts"],"names":[],"mappings":"AAYA,MAAM,MAAM,OAAO,GAAG;IACpB,GAAG,EAAE,MAAM,CAAA;CACZ,CAAA;AAKD,MAAM,MAAM,2BAA2B,GAAG;IACxC,GAAG,EAAE,MAAM,CAAA;IACX,GAAG,EAAE,MAAM,CAAA;CACZ,CAAA;AAMD,MAAM,MAAM,aAAa,GACrB,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,GAChC,CAAC,CAAC,MAAM,EAAE,2BAA2B,KAAK,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/backend/utils.ts"],"names":[],"mappings":"AAYA,wBAAgB,MAAM,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,EAAE,GAAG,EAAE,MAAM,CAAC,GAAG,CAAC,EAAE,CAMvD"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"vite.d.ts","sourceRoot":"","sources":["../../../src/backend/vite.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,MAAM,CAAA;AAEpC,OAAO,EAAW,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAExD,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAA;AAGzD,qBAAa,IAAI;;IAyCH,OAAO,CAAC,WAAW;gBAAX,WAAW,EAAE,kBAAkB;IAkFnD,uBAAuB,CAAC,WAAW,EAAE,MAAM,EAAE,GAAG,MAAM,GAAG,MAAM;IAgH/D,SAAS,CAAC,KAAK,EAAE,MAAM;IAcvB,QAAQ,IAAI,QAAQ;IA6BpB,iBAAiB,IAAI,MAAM;IAqB3B,cAAc,CAAC,IAAI,EAAE,MAAM;IAU3B,mBAAmB,CAAC,IAAI,EAAE,MAAM;IAUhC,iBAAiB,CAAC,IAAI,EAAE,MAAM;IAU9B,YAAY,CAAC,GAAG,EAAE,MAAM;IAQxB,mBAAmB,CAAC,UAAU,EAAE,aAAa;IAQ7C,kBAAkB,CAAC,UAAU,EAAE,aAAa;CAI7C"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../src/vite_plugin/config.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,MAAM,CAAA;AACpD,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAA;AASpD,eAAO,MAAM,UAAU,YACZ,iBAAiB,cACd,UAAU,eACT,SAAS,KACrB,UA2BF,CAAA;AAKD,eAAO,MAAM,MAAM,YAAa,iBAAiB,KAAG,MAuCnD,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"config_resolver.d.ts","sourceRoot":"","sources":["../../../src/vite_plugin/config_resolver.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,MAAM,CAAA;AAE/D,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAA;AAGpD,qBAAa,cAAc;IACzB,MAAM,CAAC,cAAc,CAAC,EAAE,cAAc,CAAA;IAKtC,MAAM,CAAC,WAAW,CAChB,MAAM,EAAE,UAAU,EAClB,OAAO,EAAE,iBAAiB,EAC1B,OAAO,EAAE,OAAO,GAAG,OAAO,GACzB,MAAM;IAkBT,MAAM,CAAC,YAAY,CAAC,MAAM,EAAE,UAAU,GAAG,YAAY;IAgBrD,MAAM,CAAC,aAAa,CAAC,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,iBAAiB,GAAG,MAAM;CAG7E"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"inertia.d.ts","sourceRoot":"","sources":["../../../../src/vite_plugin/helpers/inertia.ts"],"names":[],"mappings":"AAYA,wBAAsB,oBAAoB,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,gBAclF"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"hot_file.d.ts","sourceRoot":"","sources":["../../../src/vite_plugin/hot_file.ts"],"names":[],"mappings":"AAcA,qBAAa,OAAO;;gBAqBN,IAAI,EAAE,MAAM;IAQlB,KAAK,CAAC,IAAI,EAAE;QAAE,GAAG,EAAE,MAAM,CAAA;KAAE;IAQjC,KAAK;CAON"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/vite_plugin/index.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,YAAY,EAAE,MAAM,MAAM,CAAA;AAEnC,OAAO,EAAqB,aAAa,EAAE,MAAM,kBAAkB,CAAA;AASnE,MAAM,CAAC,OAAO,UAAU,MAAM,CAAC,OAAO,EAAE,aAAa,GAAG,YAAY,EAAE,CAgBrE"}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { defu } from 'defu';
|
|
2
|
-
import { config } from './config.js';
|
|
3
|
-
import PluginRestart from 'vite-plugin-restart';
|
|
4
|
-
import { join } from 'node:path';
|
|
5
|
-
const VitePluginRestart = PluginRestart;
|
|
6
|
-
export default function Adonis(options) {
|
|
7
|
-
const hotfileDefaultDestination = join(options.publicDirectory || 'public', options.buildDirectory || 'assets', 'hot.json');
|
|
8
|
-
const fullOptions = defu(options, {
|
|
9
|
-
publicDirectory: 'public',
|
|
10
|
-
buildDirectory: 'assets',
|
|
11
|
-
assetsUrl: '',
|
|
12
|
-
hotFile: hotfileDefaultDestination,
|
|
13
|
-
reload: ['./resources/views/**/*.edge'],
|
|
14
|
-
});
|
|
15
|
-
return [VitePluginRestart({ reload: fullOptions.reload }), config(fullOptions)];
|
|
16
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export type PluginOptions = {
|
|
2
|
-
hotFile?: string;
|
|
3
|
-
entrypoints: string[];
|
|
4
|
-
publicDirectory?: string;
|
|
5
|
-
assetsUrl?: string;
|
|
6
|
-
buildDirectory?: string;
|
|
7
|
-
reload?: string[];
|
|
8
|
-
};
|
|
9
|
-
export type PluginFullOptions = Required<PluginOptions>;
|
|
10
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/vite_plugin/types/index.ts"],"names":[],"mappings":"AAYA,MAAM,MAAM,aAAa,GAAG;IAM1B,OAAO,CAAC,EAAE,MAAM,CAAA;IAKhB,WAAW,EAAE,MAAM,EAAE,CAAA;IAOrB,eAAe,CAAC,EAAE,MAAM,CAAA;IAQxB,SAAS,CAAC,EAAE,MAAM,CAAA;IAOlB,cAAc,CAAC,EAAE,MAAM,CAAA;IAOvB,MAAM,CAAC,EAAE,MAAM,EAAE,CAAA;CAClB,CAAA;AAED,MAAM,MAAM,iBAAiB,GAAG,QAAQ,CAAC,aAAa,CAAC,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/vite_plugin/utils.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAA;AACtC,OAAO,EAAE,cAAc,EAAE,MAAM,MAAM,CAAA;AAKrC,eAAO,MAAM,mBAAmB,YAAa,WAAW,UAAU,cAAc,WAiB/E,CAAA;AAKD,eAAO,MAAM,gBAAgB,QAAS,MAAM,WAE3C,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../stubs/index.ts"],"names":[],"mappings":"AAWA,eAAO,MAAM,SAAS,QAA2B,CAAA"}
|
package/configure.ts
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
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
|
-
|
|
10
|
-
import { join } from 'node:path'
|
|
11
|
-
import { fileURLToPath } from 'node:url'
|
|
12
|
-
import type Configure from '@adonisjs/core/commands/configure'
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* Configures the package
|
|
16
|
-
*/
|
|
17
|
-
export async function configure(command: Configure) {
|
|
18
|
-
const stubDestination = join(fileURLToPath(command.app.appRoot), 'vite.config.js')
|
|
19
|
-
|
|
20
|
-
await command.publishStub('vite/vite_config.stub', {
|
|
21
|
-
destination: stubDestination,
|
|
22
|
-
})
|
|
23
|
-
|
|
24
|
-
await command.updateRcFile((rcFile) => {
|
|
25
|
-
rcFile.addProvider('@adonisjs/vite/providers/vite_provider')
|
|
26
|
-
})
|
|
27
|
-
|
|
28
|
-
const packagesToInstall = [{ name: 'vite', isDevDependency: true }]
|
|
29
|
-
command.listPackagesToInstall(packagesToInstall)
|
|
30
|
-
}
|
package/index.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
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
|
-
|
|
10
|
-
import './src/backend/types/extended.js'
|
|
11
|
-
|
|
12
|
-
export { configure } from './configure.js'
|
|
13
|
-
export { stubsRoot } from './stubs/index.js'
|
|
14
|
-
|
|
15
|
-
export { Vite } from './src/backend/vite.js'
|
|
@@ -1,89 +0,0 @@
|
|
|
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
|
-
|
|
10
|
-
import '@adonisjs/view'
|
|
11
|
-
import { ApplicationService } from '@adonisjs/core/types'
|
|
12
|
-
import { ViewContract } from '@adonisjs/view/types'
|
|
13
|
-
import { Vite } from '../src/backend/vite.js'
|
|
14
|
-
import { EdgeError } from 'edge-error'
|
|
15
|
-
|
|
16
|
-
export default class ViteServiceProvider {
|
|
17
|
-
constructor(protected app: ApplicationService) {}
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* Inject the script needed for Vite HMR
|
|
21
|
-
*/
|
|
22
|
-
#registerViteTag(view: ViewContract) {
|
|
23
|
-
view.registerTag({
|
|
24
|
-
tagName: 'vite',
|
|
25
|
-
seekable: true,
|
|
26
|
-
block: false,
|
|
27
|
-
compile(parser, buffer, token) {
|
|
28
|
-
/**
|
|
29
|
-
* Ensure an argument is defined
|
|
30
|
-
*/
|
|
31
|
-
if (!token.properties.jsArg.trim()) {
|
|
32
|
-
throw new EdgeError('Missing entrypoint name', 'E_RUNTIME_EXCEPTION', {
|
|
33
|
-
filename: token.filename,
|
|
34
|
-
line: token.loc.start.line,
|
|
35
|
-
col: token.loc.start.col,
|
|
36
|
-
})
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
const parsed = parser.utils.transformAst(
|
|
40
|
-
parser.utils.generateAST(token.properties.jsArg, token.loc, token.filename),
|
|
41
|
-
token.filename,
|
|
42
|
-
parser
|
|
43
|
-
)
|
|
44
|
-
|
|
45
|
-
const entrypoints = parser.utils.stringify(parsed)
|
|
46
|
-
|
|
47
|
-
buffer.outputExpression(
|
|
48
|
-
`state.vite.generateEntryPointsTags(${entrypoints})`,
|
|
49
|
-
token.filename,
|
|
50
|
-
token.loc.start.line,
|
|
51
|
-
false
|
|
52
|
-
)
|
|
53
|
-
},
|
|
54
|
-
})
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
/**
|
|
58
|
-
* Inject a script needed for the HMR working with React
|
|
59
|
-
*/
|
|
60
|
-
#registerViteReactTag(view: ViewContract) {
|
|
61
|
-
view.registerTag({
|
|
62
|
-
tagName: 'viteReactRefresh',
|
|
63
|
-
seekable: true,
|
|
64
|
-
block: false,
|
|
65
|
-
compile(_parser, buffer, token) {
|
|
66
|
-
buffer.outputExpression(
|
|
67
|
-
`state.vite.getReactHmrScript()`,
|
|
68
|
-
token.filename,
|
|
69
|
-
token.loc.start.line,
|
|
70
|
-
false
|
|
71
|
-
)
|
|
72
|
-
},
|
|
73
|
-
})
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
register() {
|
|
77
|
-
this.app.container.singleton('vite', async () => new Vite(this.app))
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
async boot() {
|
|
81
|
-
const view = await this.app.container.make('view')
|
|
82
|
-
const vite = await this.app.container.make('vite')
|
|
83
|
-
|
|
84
|
-
view.global('vite', vite)
|
|
85
|
-
|
|
86
|
-
this.#registerViteTag(view)
|
|
87
|
-
this.#registerViteReactTag(view)
|
|
88
|
-
}
|
|
89
|
-
}
|
package/services/vite.ts
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
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
|
-
|
|
10
|
-
import app from '@adonisjs/core/services/app'
|
|
11
|
-
import { Vite } from '../index.js'
|
|
12
|
-
|
|
13
|
-
let vite: Vite
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* Returns a singleton instance of Vite class
|
|
17
|
-
* from the container
|
|
18
|
-
*/
|
|
19
|
-
await app.booted(async () => {
|
|
20
|
-
vite = await app.container.make('vite')
|
|
21
|
-
})
|
|
22
|
-
|
|
23
|
-
export { vite as default }
|