@adonisjs/inertia 4.0.0-next.1 → 4.0.0-next.11
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/debug-CBMTuPUm.js +3 -0
- package/build/factories/main.js +59 -172
- package/build/headers-DafWEpBh.js +11 -0
- package/build/index.js +5 -24
- package/build/inertia-D5A2KtfR.js +57 -0
- package/build/inertia_manager-Di3J3hSG.js +403 -0
- package/build/providers/inertia_provider.d.ts +2 -2
- package/build/providers/inertia_provider.js +25 -79
- package/build/src/client/helpers.d.ts +27 -0
- package/build/src/client/helpers.js +13 -0
- package/build/src/client/react/context.d.ts +24 -0
- package/build/src/client/react/index.d.ts +3 -0
- package/build/src/client/react/index.js +29 -0
- package/build/src/client/react/link.d.ts +64 -0
- package/build/src/client/react/router.d.ts +33 -0
- package/build/src/client/vite.d.ts +3 -1
- package/build/src/client/vite.js +16 -29
- package/build/src/define_config.d.ts +1 -0
- package/build/src/index_pages.d.ts +27 -0
- package/build/src/inertia.d.ts +15 -7
- package/build/src/inertia_manager.d.ts +1 -0
- package/build/src/inertia_middleware.d.ts +6 -3
- package/build/src/inertia_middleware.js +45 -111
- package/build/src/plugins/edge/plugin.js +49 -81
- package/build/src/plugins/japa/api_client.js +44 -59
- package/build/src/props.d.ts +16 -9
- package/build/src/server_renderer.d.ts +2 -2
- package/build/src/types.d.ts +17 -28
- package/build/src/types.js +1 -0
- package/build/tests/types/react.spec.d.ts +65 -0
- package/package.json +47 -25
- package/build/chunk-4EZ2J6OA.js +0 -7
- package/build/chunk-74S2VAL7.js +0 -761
- package/build/chunk-DISC5OYC.js +0 -46
- package/build/chunk-MLKGABMK.js +0 -9
- package/build/chunk-PDP56GPP.js +0 -75
package/build/chunk-DISC5OYC.js
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
// src/headers.ts
|
|
2
|
-
var InertiaHeaders = {
|
|
3
|
-
/**
|
|
4
|
-
* Header to identify Inertia.js requests.
|
|
5
|
-
* Set to 'true' by Inertia.js client to indicate an Inertia request.
|
|
6
|
-
*/
|
|
7
|
-
Inertia: "x-inertia",
|
|
8
|
-
/**
|
|
9
|
-
* Header to drop a prop from the merge and deep merge object.
|
|
10
|
-
*/
|
|
11
|
-
Reset: "x-inertia-reset",
|
|
12
|
-
/**
|
|
13
|
-
* Header containing the current asset version.
|
|
14
|
-
* Used for cache busting - if versions don't match, Inertia performs a full page reload.
|
|
15
|
-
*/
|
|
16
|
-
Version: "x-inertia-version",
|
|
17
|
-
/**
|
|
18
|
-
* Header containing the target URL for redirects.
|
|
19
|
-
* Used when the server wants to redirect to a different URL than the current request.
|
|
20
|
-
*/
|
|
21
|
-
Location: "x-inertia-location",
|
|
22
|
-
/**
|
|
23
|
-
* Header specifying the error bag name for validation errors.
|
|
24
|
-
* Allows multiple forms on the same page to have separate error handling.
|
|
25
|
-
*/
|
|
26
|
-
ErrorBag: "x-inertia-error-bag",
|
|
27
|
-
/**
|
|
28
|
-
* Header containing comma-separated list of props to include in partial data requests.
|
|
29
|
-
* Only the specified props will be returned in the response.
|
|
30
|
-
*/
|
|
31
|
-
PartialOnly: "x-inertia-partial-data",
|
|
32
|
-
/**
|
|
33
|
-
* Header containing comma-separated list of props to exclude in partial data requests.
|
|
34
|
-
* All props except the specified ones will be returned in the response.
|
|
35
|
-
*/
|
|
36
|
-
PartialExcept: "x-inertia-partial-except",
|
|
37
|
-
/**
|
|
38
|
-
* Header specifying the component name for partial reloads.
|
|
39
|
-
* Used to identify which component is being partially reloaded.
|
|
40
|
-
*/
|
|
41
|
-
PartialComponent: "x-inertia-partial-component"
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
export {
|
|
45
|
-
InertiaHeaders
|
|
46
|
-
};
|
package/build/chunk-MLKGABMK.js
DELETED
package/build/chunk-PDP56GPP.js
DELETED
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
// src/index_pages.ts
|
|
2
|
-
var GLOB = {
|
|
3
|
-
vue3: ["**/*.vue"],
|
|
4
|
-
react: ["**/*.ts", "**/*.tsx"]
|
|
5
|
-
};
|
|
6
|
-
var SUPPORTED_FRAMEWORKS = Object.keys(GLOB);
|
|
7
|
-
var TYPES_EXTRACTION_HELPER = {
|
|
8
|
-
vue3: `import type { VNodeProps, AllowedComponentProps, ComponentInstance } from 'vue'
|
|
9
|
-
|
|
10
|
-
type ExtractProps<T> = Omit<
|
|
11
|
-
ComponentInstance<T>['$props'][K],
|
|
12
|
-
keyof VNodeProps | keyof AllowedComponentProps
|
|
13
|
-
>`,
|
|
14
|
-
react: `import type React from 'react'
|
|
15
|
-
|
|
16
|
-
type ExtractProps<T> = T extends React.FC<infer Props>
|
|
17
|
-
? Props
|
|
18
|
-
: T extends React.Component<infer Props>
|
|
19
|
-
? Props
|
|
20
|
-
: never`
|
|
21
|
-
};
|
|
22
|
-
var indexPages = function(config) {
|
|
23
|
-
if (!SUPPORTED_FRAMEWORKS.includes(config.framework)) {
|
|
24
|
-
throw new Error(
|
|
25
|
-
`Unsupported framework "${config.framework}". Types generation is available only for ${SUPPORTED_FRAMEWORKS.join(",")}`
|
|
26
|
-
);
|
|
27
|
-
}
|
|
28
|
-
return {
|
|
29
|
-
run(_, indexGenerator) {
|
|
30
|
-
indexGenerator.add("inertiaPages", {
|
|
31
|
-
source: "inertia/pages",
|
|
32
|
-
glob: GLOB[config.framework],
|
|
33
|
-
output: ".adonisjs/server/pages.d.ts",
|
|
34
|
-
as(vfs, buffer, __, helpers) {
|
|
35
|
-
const filesList = vfs.asList();
|
|
36
|
-
buffer.write(TYPES_EXTRACTION_HELPER[config.framework]);
|
|
37
|
-
buffer.write(`declare module '@adonisjs/inertia/types' {`).indent();
|
|
38
|
-
buffer.write(`export interface InertiaPages {`).indent();
|
|
39
|
-
Object.keys(filesList).forEach((key) => {
|
|
40
|
-
buffer.write(
|
|
41
|
-
`'${key}': ExtractProps<(typeof import('${helpers.toImportPath(filesList[key])}'))['default']>`
|
|
42
|
-
);
|
|
43
|
-
});
|
|
44
|
-
buffer.dedent().write(`}`);
|
|
45
|
-
buffer.dedent().write(`}`);
|
|
46
|
-
}
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
};
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
// src/define_config.ts
|
|
53
|
-
import lodash from "@poppinss/utils/lodash";
|
|
54
|
-
function defineConfig(config) {
|
|
55
|
-
return lodash.merge(
|
|
56
|
-
{
|
|
57
|
-
rootView: "inertia_layout",
|
|
58
|
-
entrypoint: "inertia/app/app.ts",
|
|
59
|
-
history: {
|
|
60
|
-
encrypt: false
|
|
61
|
-
},
|
|
62
|
-
ssr: {
|
|
63
|
-
enabled: false,
|
|
64
|
-
bundle: "ssr/ssr.js",
|
|
65
|
-
entrypoint: "inertia/app/ssr.ts"
|
|
66
|
-
}
|
|
67
|
-
},
|
|
68
|
-
config
|
|
69
|
-
);
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
export {
|
|
73
|
-
indexPages,
|
|
74
|
-
defineConfig
|
|
75
|
-
};
|