@adonisjs/inertia 1.0.0-5 → 1.0.0-7

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.
@@ -4,7 +4,9 @@ var Inertia = class {
4
4
  constructor(ctx, config) {
5
5
  this.ctx = ctx;
6
6
  this.config = config;
7
+ this.#sharedData = config.sharedData;
7
8
  }
9
+ #sharedData = {};
8
10
  /**
9
11
  * Check if a value is a lazy prop
10
12
  */
@@ -54,10 +56,17 @@ var Inertia = class {
54
56
  return {
55
57
  component,
56
58
  version: this.config.versionCache.getVersion(),
57
- props: await this.#resolvePageProps(component, { ...this.config.sharedData, ...pageProps }),
59
+ props: await this.#resolvePageProps(component, { ...this.#sharedData, ...pageProps }),
58
60
  url: this.ctx.request.url(true)
59
61
  };
60
62
  }
63
+ /**
64
+ * Share data for the current request.
65
+ * This data will override any shared data defined in the config.
66
+ */
67
+ share(data) {
68
+ this.#sharedData = { ...this.#sharedData, ...data };
69
+ }
61
70
  /**
62
71
  * Render a page using Inertia
63
72
  */
package/build/index.js CHANGED
@@ -14,7 +14,7 @@ var ADAPTERS_INFO = {
14
14
  },
15
15
  "React": {
16
16
  dependencies: [
17
- { name: "@inertiajs/inertia-react", isDevDependency: false },
17
+ { name: "@inertiajs/react", isDevDependency: false },
18
18
  { name: "react", isDevDependency: false },
19
19
  { name: "react-dom", isDevDependency: false },
20
20
  { name: "@vitejs/plugin-react", isDevDependency: true },
@@ -24,7 +24,7 @@ var ADAPTERS_INFO = {
24
24
  },
25
25
  "Svelte": {
26
26
  dependencies: [
27
- { name: "@inertiajs/inertia-svelte", isDevDependency: false },
27
+ { name: "@inertiajs/svelte", isDevDependency: false },
28
28
  { name: "svelte", isDevDependency: false },
29
29
  { name: "@sveltejs/vite-plugin-svelte", isDevDependency: true }
30
30
  ]
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  InertiaMiddleware
3
- } from "../chunk-PZZVHQTV.js";
3
+ } from "../chunk-RXGBTZMN.js";
4
4
 
5
5
  // providers/inertia_provider.ts
6
6
  import { configProvider } from "@adonisjs/core";
@@ -1,6 +1,6 @@
1
1
  import { HttpContext } from '@adonisjs/core/http';
2
2
  import { NextFn } from '@adonisjs/core/types/http';
3
- import { ResolvedConfig, PageProps, MaybePromise } from './types.js';
3
+ import { ResolvedConfig, Data, PageProps, MaybePromise } from './types.js';
4
4
 
5
5
  /**
6
6
  * Symbol used to identify lazy props
@@ -14,6 +14,11 @@ declare class Inertia {
14
14
  protected ctx: HttpContext;
15
15
  protected config: ResolvedConfig;
16
16
  constructor(ctx: HttpContext, config: ResolvedConfig);
17
+ /**
18
+ * Share data for the current request.
19
+ * This data will override any shared data defined in the config.
20
+ */
21
+ share(data: Record<string, Data>): void;
17
22
  /**
18
23
  * Render a page using Inertia
19
24
  */
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  InertiaMiddleware
3
- } from "../chunk-PZZVHQTV.js";
3
+ } from "../chunk-RXGBTZMN.js";
4
4
  export {
5
5
  InertiaMiddleware as default
6
6
  };
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-5",
4
+ "version": "1.0.0-7",
5
5
  "engines": {
6
6
  "node": ">=18.16.0"
7
7
  },
@@ -21,7 +21,7 @@
21
21
  },
22
22
  "scripts": {
23
23
  "clean": "del-cli build",
24
- "copy:templates": "copyfiles \"stubs/**/*.stub\" build",
24
+ "copy:templates": "copyfiles --up 1 \"stubs/**/*.stub\" build",
25
25
  "typecheck": "tsc --noEmit",
26
26
  "lint": "eslint . --ext=.ts",
27
27
  "format": "prettier --write .",
@@ -36,11 +36,11 @@
36
36
  "prepublishOnly": "npm run build"
37
37
  },
38
38
  "devDependencies": {
39
- "@adonisjs/assembler": "7.0.0-1",
40
- "@adonisjs/core": "6.1.5-38",
39
+ "@adonisjs/assembler": "^7.0.0",
40
+ "@adonisjs/core": "6.2.0",
41
41
  "@adonisjs/eslint-config": "^1.2.1",
42
42
  "@adonisjs/prettier-config": "^1.2.1",
43
- "@adonisjs/session": "7.0.0-15",
43
+ "@adonisjs/session": "7.0.0",
44
44
  "@adonisjs/tsconfig": "^1.2.1",
45
45
  "@japa/api-client": "^2.0.2",
46
46
  "@japa/assert": "2.1.0",
@@ -48,15 +48,15 @@
48
48
  "@japa/file-system": "^2.1.1",
49
49
  "@japa/plugin-adonisjs": "^2.0.2",
50
50
  "@japa/runner": "3.1.1",
51
- "@swc/core": "^1.3.101",
52
- "@types/node": "^20.10.6",
51
+ "@swc/core": "^1.3.102",
52
+ "@types/node": "^20.10.8",
53
53
  "@types/qs": "^6.9.11",
54
- "@types/supertest": "^2.0.16",
55
- "c8": "^8.0.1",
54
+ "@types/supertest": "^6.0.2",
55
+ "c8": "^9.0.0",
56
56
  "copyfiles": "^2.4.1",
57
57
  "del-cli": "^5.1.0",
58
- "edge-parser": "^9.0.0",
59
- "edge.js": "^6.0.0",
58
+ "edge-parser": "^9.0.1",
59
+ "edge.js": "^6.0.1",
60
60
  "eslint": "^8.56.0",
61
61
  "get-port": "^7.0.0",
62
62
  "np": "^9.2.0",
@@ -65,28 +65,24 @@
65
65
  "tinybench": "^2.5.1",
66
66
  "ts-node": "^10.9.2",
67
67
  "tsup": "^8.0.1",
68
- "typescript": "~5.2.2"
68
+ "typescript": "~5.3.3"
69
69
  },
70
70
  "dependencies": {
71
71
  "@poppinss/utils": "^6.7.0",
72
72
  "crc-32": "^1.2.2",
73
- "edge-error": "^4.0.0",
73
+ "edge-error": "^4.0.1",
74
74
  "html-entities": "^2.4.0",
75
75
  "qs": "^6.11.2"
76
76
  },
77
77
  "peerDependencies": {
78
- "@adonisjs/assembler": "7.0.0-1",
79
- "@adonisjs/core": "6.1.5-38",
80
- "@adonisjs/session": "7.0.0-15",
78
+ "@adonisjs/core": "^6.2.0",
79
+ "@adonisjs/session": "^7.0.0",
81
80
  "@japa/api-client": "^2.0.0",
82
81
  "edge.js": "^6.0.0"
83
82
  },
84
83
  "peerDependenciesMeta": {
85
- "@adonisjs/assembler": {
86
- "optional": false
87
- },
88
84
  "@japa/api-client": {
89
- "optional": false
85
+ "optional": true
90
86
  }
91
87
  },
92
88
  "author": "Julien Ripouteau <julien@ripouteau.com>,adonisjs",
File without changes