@vigla/sveltekit 0.0.0-stage → 3.1.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.
Files changed (149) hide show
  1. package/dist/adapter.d.ts +4 -0
  2. package/dist/adapter.d.ts.map +1 -0
  3. package/dist/adapter.js +5 -0
  4. package/dist/adapter.js.map +1 -0
  5. package/dist/bin.d.ts +3 -0
  6. package/dist/bin.d.ts.map +1 -0
  7. package/dist/bin.js +7 -0
  8. package/dist/bin.js.map +1 -0
  9. package/dist/env.d.ts +2 -0
  10. package/dist/env.d.ts.map +1 -0
  11. package/dist/env.js +2 -0
  12. package/dist/env.js.map +1 -0
  13. package/dist/history/adapter.d.ts +3 -0
  14. package/dist/history/adapter.d.ts.map +1 -0
  15. package/dist/history/adapter.js +31 -0
  16. package/dist/history/adapter.js.map +1 -0
  17. package/dist/history/app/forms.d.ts +4 -0
  18. package/dist/history/app/forms.d.ts.map +1 -0
  19. package/dist/history/app/forms.js +24 -0
  20. package/dist/history/app/forms.js.map +1 -0
  21. package/dist/history/app/hooks.d.ts +8 -0
  22. package/dist/history/app/hooks.d.ts.map +1 -0
  23. package/dist/history/app/hooks.js +27 -0
  24. package/dist/history/app/hooks.js.map +1 -0
  25. package/dist/history/app/navigation.d.ts +10 -0
  26. package/dist/history/app/navigation.d.ts.map +1 -0
  27. package/dist/history/app/navigation.js +41 -0
  28. package/dist/history/app/navigation.js.map +1 -0
  29. package/dist/history/app/navigation.server.d.ts +4 -0
  30. package/dist/history/app/navigation.server.d.ts.map +1 -0
  31. package/dist/history/app/navigation.server.js +9 -0
  32. package/dist/history/app/navigation.server.js.map +1 -0
  33. package/dist/history/app/paths.d.ts +4 -0
  34. package/dist/history/app/paths.d.ts.map +1 -0
  35. package/dist/history/app/paths.js +13 -0
  36. package/dist/history/app/paths.js.map +1 -0
  37. package/dist/history/components.d.ts +3 -0
  38. package/dist/history/components.d.ts.map +1 -0
  39. package/dist/history/components.js +90 -0
  40. package/dist/history/components.js.map +1 -0
  41. package/dist/history/config.d.ts +2 -0
  42. package/dist/history/config.d.ts.map +1 -0
  43. package/dist/history/config.js +80 -0
  44. package/dist/history/config.js.map +1 -0
  45. package/dist/history/diagnostics.d.ts +5 -0
  46. package/dist/history/diagnostics.d.ts.map +1 -0
  47. package/dist/history/diagnostics.js +17 -0
  48. package/dist/history/diagnostics.js.map +1 -0
  49. package/dist/history/plugin.d.ts +7 -0
  50. package/dist/history/plugin.d.ts.map +1 -0
  51. package/dist/history/plugin.js +127 -0
  52. package/dist/history/plugin.js.map +1 -0
  53. package/dist/hooks.d.ts +5 -0
  54. package/dist/hooks.d.ts.map +1 -0
  55. package/dist/hooks.js +9 -0
  56. package/dist/hooks.js.map +1 -0
  57. package/dist/identity.d.ts +3 -0
  58. package/dist/identity.d.ts.map +1 -0
  59. package/dist/identity.js +28 -0
  60. package/dist/identity.js.map +1 -0
  61. package/dist/index.d.ts +8 -0
  62. package/dist/index.d.ts.map +1 -0
  63. package/dist/index.js +18 -0
  64. package/dist/index.js.map +1 -0
  65. package/dist/internal/client.d.ts +2 -0
  66. package/dist/internal/client.d.ts.map +1 -0
  67. package/dist/internal/client.js +2 -0
  68. package/dist/internal/client.js.map +1 -0
  69. package/dist/internal/env.d.ts +2 -0
  70. package/dist/internal/env.d.ts.map +1 -0
  71. package/dist/internal/env.js +2 -0
  72. package/dist/internal/env.js.map +1 -0
  73. package/dist/internal/payload.d.ts +2 -0
  74. package/dist/internal/payload.d.ts.map +1 -0
  75. package/dist/internal/payload.js +2 -0
  76. package/dist/internal/payload.js.map +1 -0
  77. package/dist/internal/restore.d.ts +3 -0
  78. package/dist/internal/restore.d.ts.map +1 -0
  79. package/dist/internal/restore.js +45 -0
  80. package/dist/internal/restore.js.map +1 -0
  81. package/dist/internal/server.d.ts +2 -0
  82. package/dist/internal/server.d.ts.map +1 -0
  83. package/dist/internal/server.js +2 -0
  84. package/dist/internal/server.js.map +1 -0
  85. package/dist/node.d.ts +2 -0
  86. package/dist/node.d.ts.map +1 -0
  87. package/dist/node.js +2 -0
  88. package/dist/node.js.map +1 -0
  89. package/dist/params.d.ts +4 -0
  90. package/dist/params.d.ts.map +1 -0
  91. package/dist/params.js +5 -0
  92. package/dist/params.js.map +1 -0
  93. package/dist/types/adapter.d.ts +2 -0
  94. package/dist/types/adapter.d.ts.map +1 -0
  95. package/dist/types/adapter.js +2 -0
  96. package/dist/types/adapter.js.map +1 -0
  97. package/dist/types/hooks.d.ts +3 -0
  98. package/dist/types/hooks.d.ts.map +1 -0
  99. package/dist/types/hooks.js +2 -0
  100. package/dist/types/hooks.js.map +1 -0
  101. package/dist/types/index.d.ts +28 -0
  102. package/dist/types/index.d.ts.map +1 -0
  103. package/dist/types/index.js +2 -0
  104. package/dist/types/index.js.map +1 -0
  105. package/dist/types/params.d.ts +2 -0
  106. package/dist/types/params.d.ts.map +1 -0
  107. package/dist/types/params.js +2 -0
  108. package/dist/types/params.js.map +1 -0
  109. package/dist/vite.d.ts +8 -0
  110. package/dist/vite.d.ts.map +1 -0
  111. package/dist/vite.js +20 -0
  112. package/dist/vite.js.map +1 -0
  113. package/dist/vite.test-d.d.ts +4 -0
  114. package/dist/vite.test-d.d.ts.map +1 -0
  115. package/dist/vite.test-d.js +9 -0
  116. package/dist/vite.test-d.js.map +1 -0
  117. package/package.json +52 -5
  118. package/src/adapter.ts +7 -0
  119. package/src/bin.ts +7 -0
  120. package/src/env.ts +1 -0
  121. package/src/history/adapter.ts +44 -0
  122. package/src/history/app/forms.ts +42 -0
  123. package/src/history/app/hooks.ts +45 -0
  124. package/src/history/app/navigation.server.ts +11 -0
  125. package/src/history/app/navigation.ts +65 -0
  126. package/src/history/app/paths.ts +17 -0
  127. package/src/history/components.ts +96 -0
  128. package/src/history/config.ts +126 -0
  129. package/src/history/diagnostics.ts +24 -0
  130. package/src/history/plugin.ts +151 -0
  131. package/src/hooks.ts +16 -0
  132. package/src/identity.ts +30 -0
  133. package/src/index.ts +39 -0
  134. package/src/internal/client.ts +1 -0
  135. package/src/internal/env.ts +1 -0
  136. package/src/internal/payload.ts +1 -0
  137. package/src/internal/restore.ts +57 -0
  138. package/src/internal/server.ts +1 -0
  139. package/src/node.ts +1 -0
  140. package/src/params.ts +7 -0
  141. package/src/types/adapter.ts +1 -0
  142. package/src/types/hooks.ts +3 -0
  143. package/src/types/index.ts +29 -0
  144. package/src/types/params.ts +1 -0
  145. package/src/vite.test-d.ts +11 -0
  146. package/src/vite.ts +31 -0
  147. package/types/history.d.ts +14 -0
  148. package/types/index.d.ts +1 -0
  149. package/README.md +0 -3
@@ -0,0 +1,151 @@
1
+ import { existsSync } from 'node:fs';
2
+ import path from 'node:path';
3
+ import { fileURLToPath } from 'node:url';
4
+ import type { Plugin } from 'vite';
5
+ import { identity } from '../identity.ts';
6
+ import { diagnosticText, throwDiagnostic, warningSource } from './diagnostics.ts';
7
+
8
+ const prefix = `\0${identity.name}:`;
9
+ const docs = 'https://svelte.dev/docs/kit/';
10
+ const legacyEnvironment = /^\$env\/(static|dynamic)\/(public|private)$/;
11
+ const extension = path.extname(fileURLToPath(import.meta.url));
12
+ const wrapper = (name: string) =>
13
+ fileURLToPath(new URL(`./app/${name}${extension}`, import.meta.url));
14
+ const wrapped = new Map(
15
+ ['navigation', 'paths', 'forms'].map((name) => [
16
+ `$app/${name}`,
17
+ { client: wrapper(name), server: wrapper(name === 'navigation' ? 'navigation.server' : name) }
18
+ ])
19
+ );
20
+ const wrappers = new Set([...wrapped.values()].flatMap(({ client, server }) => [client, server]));
21
+ const handleErrorWrapper = fileURLToPath(new URL(`./app/hooks${extension}`, import.meta.url));
22
+
23
+ function removedModule(id: string, aliases: Record<string, string>): void {
24
+ const name = id.startsWith('$lib') ? '$lib' : '$service-worker';
25
+ if (name in aliases || `${name}/*` in aliases) return;
26
+ if (name === '$lib')
27
+ throwDiagnostic(
28
+ 'module_removed_lib',
29
+ `\`$lib\` has been removed. Use \`#lib\` instead: ${docs}$lib. To keep using \`$lib\`, add \`alias: { '$lib': 'src/lib' }\` to your ${identity.product} config.`,
30
+ removedModule
31
+ );
32
+ throwDiagnostic(
33
+ 'module_removed_service_worker',
34
+ `\`$service-worker\` has been removed. Use \`immutable\`, \`assets\` and \`prerendered\` from \`$app/manifest\`, \`version\` from \`$app/env\`, and \`resolve(...)\` from \`$app/paths\` instead: ${docs}$service-worker`,
35
+ removedModule
36
+ );
37
+ }
38
+
39
+ function stores(dev: boolean): string {
40
+ const message = dev
41
+ ? diagnosticText(
42
+ 'app_stores_removed',
43
+ '`$app/stores` has been removed in favour of `$app/state`'
44
+ )
45
+ : `${identity.diagnostics}app_stores_removed`;
46
+ return `function removed() { const error = new Error(${JSON.stringify(message)}); ${dev ? `error.name = ${JSON.stringify(`${identity.product} error`)}; ` : ''}throw error; }
47
+ export const getStores = removed;
48
+ export const page = { subscribe: removed };
49
+ export const navigating = { subscribe: removed };
50
+ export const updated = { subscribe: removed, check: removed };`;
51
+ }
52
+
53
+ function environment(dev: boolean, client: boolean): string {
54
+ const warning =
55
+ dev && client
56
+ ? warningSource(
57
+ 'app_environment_deprecated',
58
+ '`$app/environment` is deprecated, use `$app/env` instead'
59
+ )
60
+ : '';
61
+ return `export { browser, dev, building, version } from '$app/env';\n${warning}`;
62
+ }
63
+
64
+ function legacy(kind: string, visibility: string, dev: boolean): string {
65
+ const target = `$app/env/${visibility}`;
66
+ const exports =
67
+ kind === 'dynamic'
68
+ ? `import * as env from ${JSON.stringify(target)}; export { env };`
69
+ : `export * from ${JSON.stringify(target)};`;
70
+ const warning = dev
71
+ ? warningSource(
72
+ 'env_module_deprecated',
73
+ `\`$env/${kind}/${visibility}\` is deprecated, use \`${target}\` instead`
74
+ )
75
+ : '';
76
+ return `${exports}\n${warning}`;
77
+ }
78
+
79
+ export type HookEntries = Record<'server' | 'client', string | null>;
80
+
81
+ export function appModules(entries: () => HookEntries): Plugin {
82
+ const hooks = `${prefix}hooks:`;
83
+ return {
84
+ name: `${identity.name}:history-app`,
85
+ enforce: 'pre',
86
+ resolveId(id, importer) {
87
+ const target = wrapped.get(id);
88
+ if (target && !wrappers.has(importer?.split('?')[0] ?? ''))
89
+ return this.environment.config.consumer === 'server' ? target.server : target.client;
90
+ if (importer?.startsWith(hooks) || !path.isAbsolute(id)) return;
91
+ const { server, client } = entries();
92
+ if (id === server || id === client) return hooks + id;
93
+ },
94
+ load(id) {
95
+ if (!id.startsWith(hooks)) return;
96
+ const file = JSON.stringify(id.slice(hooks.length));
97
+ return `import * as hooks from ${file};\nimport { retiredProperties } from ${JSON.stringify(handleErrorWrapper)};\nexport * from ${file};\nexport const handleError = retiredProperties(hooks.handleError);`;
98
+ }
99
+ };
100
+ }
101
+
102
+ export function history(config: { alias?: Record<string, string> } = {}): Plugin {
103
+ let dev = false;
104
+ return {
105
+ name: `${identity.name}:history`,
106
+ config(user, env) {
107
+ dev = env.command === 'serve';
108
+ const root = path.resolve(user.root ?? process.cwd());
109
+ for (const file of ['svelte.config.js', 'svelte.config.ts'])
110
+ if (existsSync(path.join(root, file)))
111
+ throwDiagnostic(
112
+ 'config_file_unsupported',
113
+ `\`${file}\` is no longer used. Please pass configuration via the \`${identity.plugin}(...)\` plugin in your Vite config.`,
114
+ history
115
+ );
116
+ return {
117
+ optimizeDeps: {
118
+ rolldownOptions: {
119
+ plugins: [
120
+ {
121
+ name: `${identity.name}:scan-history`,
122
+ resolveId: {
123
+ filter: { id: /^\$env\// },
124
+ handler: (id) => ({ id, external: true })
125
+ }
126
+ }
127
+ ]
128
+ }
129
+ }
130
+ };
131
+ },
132
+ async resolveId(id, importer, options) {
133
+ if (id === '$app/environment' || id === '$app/stores') return prefix + id.slice(1);
134
+ if (legacyEnvironment.test(id)) return prefix + id.slice(1);
135
+ if (id === '$lib' || /^\$lib[/?]/.test(id) || /^\$service-worker(?:\?|$)/.test(id)) {
136
+ const resolved = await this.resolve(id, importer, { ...options, skipSelf: true });
137
+ if (resolved) return resolved;
138
+ removedModule(id, config.alias ?? {});
139
+ }
140
+ },
141
+ load(id) {
142
+ if (!id.startsWith(prefix)) return;
143
+ const name = id.slice(prefix.length);
144
+ const client = this.environment.config.consumer === 'client';
145
+ if (name === 'app/stores') return stores(dev);
146
+ if (name === 'app/environment') return environment(dev, client);
147
+ const match = /^env\/(static|dynamic)\/(public|private)$/.exec(name);
148
+ if (match) return legacy(match[1]!, match[2]!, dev);
149
+ }
150
+ };
151
+ }
package/src/hooks.ts ADDED
@@ -0,0 +1,16 @@
1
+ import type { sequence as kitSequence } from '@vigla/kit/hooks';
2
+ import { sequencer } from '@vigla/kit/internal/sequence';
3
+ import { throwDiagnostic } from './history/diagnostics.ts';
4
+ import { identity } from './identity.ts';
5
+
6
+ export * from '@vigla/kit/hooks';
7
+
8
+ export const sequence: typeof kitSequence = sequencer(identity);
9
+
10
+ export function defineEnvVars(): never {
11
+ throwDiagnostic(
12
+ 'define_env_vars_moved',
13
+ '`defineEnvVars` has moved — import it from `@sveltejs/kit/env` instead',
14
+ defineEnvVars
15
+ );
16
+ }
@@ -0,0 +1,30 @@
1
+ import type { Identity } from '@vigla/kit/vite';
2
+
3
+ const docs = 'https://svelte.dev/docs/kit/';
4
+
5
+ export const identity: Identity = {
6
+ name: 'sveltekit',
7
+ product: 'SvelteKit',
8
+ framework: 'Svelte',
9
+ plugin: 'sveltekit',
10
+ command: 'svelte-kit',
11
+ outDir: '.svelte-kit',
12
+ assets: '/_svelte_kit_assets',
13
+ announcer: 'svelte-announcer',
14
+ packages: ['@sveltejs/kit', '@vigla/kit'],
15
+ diagnostics: 'https://svelte.dev/e/kit/',
16
+ links: {
17
+ formFields: `${docs}remote-functions#form-Fields`,
18
+ formValidation: `${docs}remote-functions#form-Programmatic-validation`,
19
+ prerender: `${docs}@sveltejs-kit-vite#prerender`,
20
+ prerenderConflicts: `${docs}page-options#prerender-Route-conflicts`,
21
+ namedActions: `${docs}form-actions#Named-actions`,
22
+ enhance: `${docs}form-actions#Progressive-enhancement-use:enhance`,
23
+ transport: `${docs}hooks#transport`,
24
+ handle: `${docs}hooks#handle`,
25
+ observability: `${docs}observability#opentelemetry-api`,
26
+ fetch: `${docs}web-standards#Fetch-APIs`,
27
+ adapters: `${docs}adapters`
28
+ },
29
+ replacedLinkOptions: { keepfocus: 'reset="false"', noscroll: 'reset="false"' }
30
+ };
package/src/index.ts ADDED
@@ -0,0 +1,39 @@
1
+ import { DEV } from 'esm-env';
2
+ import type { redirect as kitRedirect } from '@vigla/kit';
3
+ import { outcomes } from '@vigla/kit/internal/identity';
4
+ import { warnDiagnostic } from './history/diagnostics.ts';
5
+ import { identity } from './identity.ts';
6
+ import type { ErrorFunction, ErrorProperties, LegacyErrorBody } from './types/index.ts';
7
+
8
+ export * from '@vigla/kit';
9
+ export type {
10
+ AdapterEntry,
11
+ Builder,
12
+ ErrorFunction,
13
+ ErrorProperties,
14
+ LegacyErrorBody
15
+ } from './types/index.ts';
16
+ export const VERSION = '3.1.0';
17
+
18
+ type Raise = (status: number, message?: string, properties?: ErrorProperties) => never;
19
+
20
+ const bound = outcomes(identity);
21
+ const raise = bound.error as Raise;
22
+
23
+ export const redirect: typeof kitRedirect = bound.redirect;
24
+
25
+ export const error = ((
26
+ status: number,
27
+ message?: string | LegacyErrorBody,
28
+ properties?: ErrorProperties
29
+ ): never => {
30
+ if (message === undefined || typeof message === 'string')
31
+ return raise(status, message, properties);
32
+ if (DEV)
33
+ warnDiagnostic(
34
+ 'error_body_deprecated',
35
+ 'Passing an `App.Error` body as the second argument is deprecated — pass the `message` as the second argument, and any additional properties as the third'
36
+ );
37
+ const { message: text, ...rest } = message;
38
+ return raise(status, text, rest);
39
+ }) as ErrorFunction;
@@ -0,0 +1 @@
1
+ export * from '@vigla/kit/internal/client';
@@ -0,0 +1 @@
1
+ export * from '@vigla/kit/internal/env';
@@ -0,0 +1 @@
1
+ export * from '@vigla/kit/internal/payload';
@@ -0,0 +1,57 @@
1
+ import { DEV } from 'esm-env';
2
+ import type { Snapshot } from '@vigla/kit';
3
+ import type { Restorer } from '@vigla/kit/internal/restore';
4
+ import { warnDiagnostic } from '../history/diagnostics.ts';
5
+ import { identity } from '../identity.ts';
6
+
7
+ interface Instance {
8
+ snapshot?: Snapshot;
9
+ }
10
+
11
+ const key = `${identity.name}:snapshot`;
12
+
13
+ function read(): Record<string, unknown[]> {
14
+ try {
15
+ return JSON.parse(sessionStorage.getItem(key) ?? '{}') ?? {};
16
+ } catch {
17
+ return {};
18
+ }
19
+ }
20
+
21
+ class Exported implements Restorer {
22
+ readonly #snapshots = read();
23
+ #warned = false;
24
+
25
+ capture(navigation: number, components: Instance[]): void {
26
+ if (!components.some((component) => component?.snapshot)) return;
27
+ if (DEV && !this.#warned) {
28
+ this.#warned = true;
29
+ warnDiagnostic(
30
+ 'snapshot_export_deprecated',
31
+ '`export const snapshot` is deprecated. Use the `snapshot` helper from `$app/navigation` instead.'
32
+ );
33
+ }
34
+ this.#snapshots[navigation] = components.map((component) => component?.snapshot?.capture());
35
+ }
36
+
37
+ restore(navigation: number, components: Instance[]): void {
38
+ this.#snapshots[navigation]?.forEach((value, depth) => {
39
+ components[depth]?.snapshot?.restore(value);
40
+ });
41
+ }
42
+
43
+ prune(navigation: number): void {
44
+ for (let index = navigation + 1; this.#snapshots[index]; index++) delete this.#snapshots[index];
45
+ }
46
+
47
+ persist(): void {
48
+ const data = JSON.stringify(this.#snapshots);
49
+ try {
50
+ sessionStorage.setItem(key, data);
51
+ } catch {}
52
+ }
53
+ }
54
+
55
+ export function restorer(): Restorer {
56
+ return new Exported();
57
+ }
@@ -0,0 +1 @@
1
+ export * from '@vigla/kit/internal/server';
package/src/node.ts ADDED
@@ -0,0 +1 @@
1
+ export * from '@vigla/kit/node';
package/src/params.ts ADDED
@@ -0,0 +1,7 @@
1
+ import type { defineParams as kitDefineParams } from '@vigla/kit/params';
2
+ import { paramsDefiner } from '@vigla/kit/internal/identity';
3
+ import { identity } from './identity.ts';
4
+
5
+ export * from '@vigla/kit/params';
6
+
7
+ export const defineParams: typeof kitDefineParams = paramsDefiner(identity);
@@ -0,0 +1 @@
1
+ export * from '@vigla/kit/adapter';
@@ -0,0 +1,3 @@
1
+ export * from '@vigla/kit/hooks';
2
+
3
+ export declare function defineEnvVars(): never;
@@ -0,0 +1,29 @@
1
+ /// <reference path="../../types/history.d.ts" preserve="true" />
2
+ import type {
3
+ Builder as KitBuilder,
4
+ error as kitError,
5
+ redirect as kitRedirect,
6
+ RouteDefinition
7
+ } from '@vigla/kit';
8
+
9
+ export * from '@vigla/kit';
10
+
11
+ export type ErrorProperties = Omit<App.Error, 'status' | 'message'>;
12
+ export type LegacyErrorBody = Omit<App.Error, 'status'> & { status?: App.Error['status'] };
13
+ export type ErrorFunction = typeof kitError & ((status: number, body: LegacyErrorBody) => never);
14
+
15
+ export interface AdapterEntry {
16
+ id: string;
17
+ filter(route: RouteDefinition): boolean;
18
+ complete(entry: {
19
+ generateManifest(options: { relativePath: string }): string;
20
+ }): void | Promise<void>;
21
+ }
22
+ export interface Builder extends KitBuilder {
23
+ createEntries?: (fn: (route: RouteDefinition) => AdapterEntry) => Promise<void>;
24
+ generateManifest?: (options: { relativePath: string; routes?: RouteDefinition[] }) => string;
25
+ }
26
+
27
+ export declare const VERSION: string;
28
+ export declare const error: ErrorFunction;
29
+ export declare const redirect: typeof kitRedirect;
@@ -0,0 +1 @@
1
+ export * from '@vigla/kit/params';
@@ -0,0 +1,11 @@
1
+ import type { Config } from './vite.ts';
2
+
3
+ export const upstream: Config = {
4
+ prebundleSvelteLibraries: false,
5
+ experimental: { disableSvelteResolveWarnings: true, remoteFunctions: true }
6
+ };
7
+
8
+ export const native: Config = {
9
+ // @ts-expect-error
10
+ prebundleLibraries: false
11
+ };
package/src/vite.ts ADDED
@@ -0,0 +1,31 @@
1
+ import {
2
+ createKit,
3
+ type Config as KitConfig,
4
+ type ExperimentalConfig as KitExperimentalConfig,
5
+ type Framework as KitFramework
6
+ } from '@vigla/kit/vite';
7
+ import { svelte, type Options } from '@vigla/vite-plugin-svelte';
8
+ import { retiredBuilder } from './history/adapter.ts';
9
+ import { componentWarnings } from './history/components.ts';
10
+ import { checkConfig } from './history/config.ts';
11
+ import { appModules, history, type HookEntries } from './history/plugin.ts';
12
+ import { identity } from './identity.ts';
13
+
14
+ export type * from '@vigla/kit/vite';
15
+ export type Config = KitConfig<Options>;
16
+ export type ExperimentalConfig = KitExperimentalConfig<Options>;
17
+ export type Framework = KitFramework<Options>;
18
+
19
+ const kit = createKit(identity, svelte);
20
+
21
+ export const sveltekit: Framework = async (config: Config = {}) => {
22
+ checkConfig(config);
23
+ const plugins = await kit({ ...config, adapter: retiredBuilder(config.adapter) });
24
+ const setup = plugins.find((plugin) => plugin.name === 'kit:setup')!;
25
+ return [
26
+ appModules((): HookEntries => setup.api.hooks()),
27
+ history(config),
28
+ componentWarnings(),
29
+ ...plugins
30
+ ];
31
+ };
@@ -0,0 +1,14 @@
1
+ declare module '$app/navigation' {
2
+ export interface GotoOptions {
3
+ replaceState?: boolean;
4
+ invalidateAll?: boolean;
5
+ }
6
+ export function pushState(url: string | URL, state: App.PageState): Promise<void>;
7
+ export function replaceState(url: string | URL, state: App.PageState): Promise<void>;
8
+ }
9
+
10
+ declare module '$app/forms' {
11
+ export interface FormUpdateOptions {
12
+ invalidateAll?: boolean;
13
+ }
14
+ }
@@ -0,0 +1 @@
1
+ import '@vigla/kit';
package/README.md DELETED
@@ -1,3 +0,0 @@
1
- # Temporary Holding Version
2
-
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.