@adonisjs/inertia 1.0.0-3 → 1.0.0-5
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/{chunk-GDULL3NT.js → chunk-PZZVHQTV.js} +1 -1
- package/build/index.d.ts +1 -3
- package/build/index.js +9 -10
- package/build/providers/inertia_provider.js +16 -15
- package/build/src/inertia_middleware.js +1 -1
- package/build/src/plugins/edge/plugin.d.ts +8 -0
- package/package.json +28 -28
- /package/build/{plugin-QOPSYJCV.js → src/plugins/edge/plugin.js} +0 -0
|
@@ -67,6 +67,7 @@ var Inertia = class {
|
|
|
67
67
|
if (!isInertiaRequest) {
|
|
68
68
|
return this.ctx.view.render(this.config.rootView, { ...viewProps, page: pageObject });
|
|
69
69
|
}
|
|
70
|
+
this.ctx.response.header("x-inertia", "true");
|
|
70
71
|
return pageObject;
|
|
71
72
|
}
|
|
72
73
|
/**
|
|
@@ -105,7 +106,6 @@ var InertiaMiddleware = class {
|
|
|
105
106
|
if (!isInertiaRequest)
|
|
106
107
|
return;
|
|
107
108
|
response.header("Vary", "Accept");
|
|
108
|
-
response.header("X-Inertia", "true");
|
|
109
109
|
const method = request.method();
|
|
110
110
|
if (response.getStatus() === 302 && ["PUT", "PATCH", "DELETE"].includes(method)) {
|
|
111
111
|
response.status(303);
|
package/build/index.d.ts
CHANGED
|
@@ -8,11 +8,9 @@ import '@adonisjs/core/http';
|
|
|
8
8
|
*/
|
|
9
9
|
declare function configure(command: Configure): Promise<void>;
|
|
10
10
|
|
|
11
|
-
declare const stubsRoot: string;
|
|
12
|
-
|
|
13
11
|
/**
|
|
14
12
|
* Define the Inertia configuration
|
|
15
13
|
*/
|
|
16
14
|
declare function defineConfig(config: InertiaConfig): ConfigProvider<ResolvedConfig>;
|
|
17
15
|
|
|
18
|
-
export { configure, defineConfig
|
|
16
|
+
export { configure, defineConfig };
|
package/build/index.js
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
// stubs/main.ts
|
|
2
|
+
import { getDirname } from "@poppinss/utils";
|
|
3
|
+
var stubsRoot = getDirname(import.meta.url);
|
|
4
|
+
|
|
1
5
|
// configure.ts
|
|
2
6
|
var ADAPTERS = ["Vue 3", "React", "Svelte"];
|
|
3
7
|
var ADAPTERS_INFO = {
|
|
@@ -43,28 +47,24 @@ async function configure(command) {
|
|
|
43
47
|
await codemods.updateRcFile((rcFile) => {
|
|
44
48
|
rcFile.addProvider("@adonisjs/inertia/inertia_provider");
|
|
45
49
|
});
|
|
46
|
-
codemods.registerMiddleware("router", [
|
|
50
|
+
await codemods.registerMiddleware("router", [
|
|
47
51
|
{ path: "@adonisjs/inertia/inertia_middleware", position: "after" }
|
|
48
52
|
]);
|
|
49
|
-
await
|
|
53
|
+
await codemods.makeUsingStub(stubsRoot, "config.stub", {});
|
|
50
54
|
const shouldInstallPackages = await command.prompt.confirm(
|
|
51
55
|
`Do you want to install dependencies ${pkgToInstall.map((pkg) => pkg.name).join(", ")}?`,
|
|
52
56
|
{ name: "install" }
|
|
53
57
|
);
|
|
54
58
|
if (shouldInstallPackages) {
|
|
55
|
-
|
|
59
|
+
await codemods.installPackages(pkgToInstall);
|
|
56
60
|
} else {
|
|
57
|
-
|
|
61
|
+
await codemods.listPackagesToInstall(pkgToInstall);
|
|
58
62
|
}
|
|
59
63
|
command.logger.success(
|
|
60
64
|
"Inertia was configured successfully. Please note that you still need to update your vite config, setup your Edge root view and others things. Read the docs for more info."
|
|
61
65
|
);
|
|
62
66
|
}
|
|
63
67
|
|
|
64
|
-
// stubs/main.ts
|
|
65
|
-
import { getDirname } from "@poppinss/utils";
|
|
66
|
-
var stubsRoot = getDirname(import.meta.url);
|
|
67
|
-
|
|
68
68
|
// src/define_config.ts
|
|
69
69
|
import { configProvider } from "@adonisjs/core";
|
|
70
70
|
|
|
@@ -130,6 +130,5 @@ function defineConfig(config) {
|
|
|
130
130
|
}
|
|
131
131
|
export {
|
|
132
132
|
configure,
|
|
133
|
-
defineConfig
|
|
134
|
-
stubsRoot
|
|
133
|
+
defineConfig
|
|
135
134
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
InertiaMiddleware
|
|
3
|
-
} from "../chunk-
|
|
3
|
+
} from "../chunk-PZZVHQTV.js";
|
|
4
4
|
|
|
5
5
|
// providers/inertia_provider.ts
|
|
6
6
|
import { configProvider } from "@adonisjs/core";
|
|
@@ -13,25 +13,26 @@ var InertiaProvider = class {
|
|
|
13
13
|
* Registers edge plugin when edge is installed
|
|
14
14
|
*/
|
|
15
15
|
async registerEdgePlugin() {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
}
|
|
16
|
+
if (!this.app.usingEdgeJS)
|
|
17
|
+
return;
|
|
18
|
+
const edgeExports = await import("edge.js");
|
|
19
|
+
const { edgePluginInertia } = await import("../src/plugins/edge/plugin.js");
|
|
20
|
+
edgeExports.default.use(edgePluginInertia());
|
|
22
21
|
}
|
|
23
22
|
/**
|
|
24
23
|
* Register Inertia bindings
|
|
25
24
|
*/
|
|
26
25
|
async register() {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
26
|
+
this.app.container.singleton(InertiaMiddleware, async () => {
|
|
27
|
+
const inertiaConfigProvider = this.app.config.get("inertia");
|
|
28
|
+
const config = await configProvider.resolve(this.app, inertiaConfigProvider);
|
|
29
|
+
if (!config) {
|
|
30
|
+
throw new RuntimeException(
|
|
31
|
+
'Invalid "config/inertia.ts" file. Make sure you are using the "defineConfig" method'
|
|
32
|
+
);
|
|
33
|
+
}
|
|
34
|
+
return new InertiaMiddleware(config);
|
|
35
|
+
});
|
|
35
36
|
await this.registerEdgePlugin();
|
|
36
37
|
}
|
|
37
38
|
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adonisjs/inertia",
|
|
3
3
|
"description": "Official Inertia.js adapter for AdonisJS",
|
|
4
|
-
"version": "1.0.0-
|
|
4
|
+
"version": "1.0.0-5",
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": ">=18.16.0"
|
|
7
7
|
},
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"./services/main": "./build/services/inertia.js",
|
|
17
17
|
"./inertia_middleware": "./build/src/inertia_middleware.js",
|
|
18
18
|
"./inertia_provider": "./build/providers/inertia_provider.js",
|
|
19
|
-
"./plugins/edge": "./build/src/plugins/edge.js",
|
|
19
|
+
"./plugins/edge": "./build/src/plugins/edge/plugin.js",
|
|
20
20
|
"./plugins/api_client": "./build/src/plugins/api_client.js"
|
|
21
21
|
},
|
|
22
22
|
"scripts": {
|
|
@@ -36,49 +36,49 @@
|
|
|
36
36
|
"prepublishOnly": "npm run build"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
|
-
"@adonisjs/assembler": "
|
|
40
|
-
"@adonisjs/core": "6.1.5-
|
|
41
|
-
"@adonisjs/eslint-config": "^1.1
|
|
42
|
-
"@adonisjs/prettier-config": "^1.1
|
|
43
|
-
"@adonisjs/session": "7.0.0-
|
|
44
|
-
"@adonisjs/tsconfig": "^1.1
|
|
45
|
-
"@japa/api-client": "^2.0.
|
|
46
|
-
"@japa/assert": "2.0
|
|
47
|
-
"@japa/expect-type": "^2.0.
|
|
48
|
-
"@japa/file-system": "^2.
|
|
49
|
-
"@japa/plugin-adonisjs": "^2.0.
|
|
50
|
-
"@japa/runner": "3.
|
|
51
|
-
"@swc/core": "^1.3.
|
|
52
|
-
"@types/node": "^20.
|
|
53
|
-
"@types/qs": "^6.9.
|
|
39
|
+
"@adonisjs/assembler": "7.0.0-1",
|
|
40
|
+
"@adonisjs/core": "6.1.5-38",
|
|
41
|
+
"@adonisjs/eslint-config": "^1.2.1",
|
|
42
|
+
"@adonisjs/prettier-config": "^1.2.1",
|
|
43
|
+
"@adonisjs/session": "7.0.0-15",
|
|
44
|
+
"@adonisjs/tsconfig": "^1.2.1",
|
|
45
|
+
"@japa/api-client": "^2.0.2",
|
|
46
|
+
"@japa/assert": "2.1.0",
|
|
47
|
+
"@japa/expect-type": "^2.0.1",
|
|
48
|
+
"@japa/file-system": "^2.1.1",
|
|
49
|
+
"@japa/plugin-adonisjs": "^2.0.2",
|
|
50
|
+
"@japa/runner": "3.1.1",
|
|
51
|
+
"@swc/core": "^1.3.101",
|
|
52
|
+
"@types/node": "^20.10.6",
|
|
53
|
+
"@types/qs": "^6.9.11",
|
|
54
54
|
"@types/supertest": "^2.0.16",
|
|
55
55
|
"c8": "^8.0.1",
|
|
56
56
|
"copyfiles": "^2.4.1",
|
|
57
57
|
"del-cli": "^5.1.0",
|
|
58
58
|
"edge-parser": "^9.0.0",
|
|
59
59
|
"edge.js": "^6.0.0",
|
|
60
|
-
"eslint": "^8.
|
|
60
|
+
"eslint": "^8.56.0",
|
|
61
61
|
"get-port": "^7.0.0",
|
|
62
|
-
"np": "^
|
|
63
|
-
"prettier": "^3.
|
|
62
|
+
"np": "^9.2.0",
|
|
63
|
+
"prettier": "^3.1.1",
|
|
64
64
|
"supertest": "^6.3.3",
|
|
65
65
|
"tinybench": "^2.5.1",
|
|
66
|
-
"ts-node": "^10.9.
|
|
67
|
-
"tsup": "^
|
|
66
|
+
"ts-node": "^10.9.2",
|
|
67
|
+
"tsup": "^8.0.1",
|
|
68
68
|
"typescript": "~5.2.2"
|
|
69
69
|
},
|
|
70
70
|
"dependencies": {
|
|
71
|
-
"@poppinss/utils": "^6.
|
|
71
|
+
"@poppinss/utils": "^6.7.0",
|
|
72
72
|
"crc-32": "^1.2.2",
|
|
73
73
|
"edge-error": "^4.0.0",
|
|
74
74
|
"html-entities": "^2.4.0",
|
|
75
75
|
"qs": "^6.11.2"
|
|
76
76
|
},
|
|
77
77
|
"peerDependencies": {
|
|
78
|
-
"@adonisjs/assembler": "
|
|
79
|
-
"@adonisjs/core": "6.1.5-
|
|
80
|
-
"@adonisjs/session": "7.0.0-
|
|
81
|
-
"@japa/api-client": "^2.0.
|
|
78
|
+
"@adonisjs/assembler": "7.0.0-1",
|
|
79
|
+
"@adonisjs/core": "6.1.5-38",
|
|
80
|
+
"@adonisjs/session": "7.0.0-15",
|
|
81
|
+
"@japa/api-client": "^2.0.0",
|
|
82
82
|
"edge.js": "^6.0.0"
|
|
83
83
|
},
|
|
84
84
|
"peerDependenciesMeta": {
|
|
@@ -126,7 +126,7 @@
|
|
|
126
126
|
"./services/inertia.ts",
|
|
127
127
|
"./src/inertia_middleware.ts",
|
|
128
128
|
"./providers/inertia_provider.ts",
|
|
129
|
-
"./src/plugins/edge.ts",
|
|
129
|
+
"./src/plugins/edge/plugin.ts",
|
|
130
130
|
"./src/plugins/api_client.ts"
|
|
131
131
|
],
|
|
132
132
|
"outDir": "./build",
|
|
File without changes
|