@sveltejs/kit 1.0.0-next.50 → 1.0.0-next.500

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 (125) hide show
  1. package/README.md +12 -9
  2. package/package.json +94 -67
  3. package/postinstall.js +38 -0
  4. package/scripts/special-types/$env+dynamic+private.md +10 -0
  5. package/scripts/special-types/$env+dynamic+public.md +8 -0
  6. package/scripts/special-types/$env+static+private.md +19 -0
  7. package/scripts/special-types/$env+static+public.md +7 -0
  8. package/scripts/special-types/$lib.md +5 -0
  9. package/src/cli.js +108 -0
  10. package/src/constants.js +7 -0
  11. package/src/core/adapt/builder.js +206 -0
  12. package/src/core/adapt/index.js +31 -0
  13. package/src/core/config/default-error.html +56 -0
  14. package/src/core/config/index.js +110 -0
  15. package/src/core/config/options.js +504 -0
  16. package/src/core/config/types.d.ts +1 -0
  17. package/src/core/env.js +121 -0
  18. package/src/core/generate_manifest/index.js +93 -0
  19. package/src/core/prerender/crawl.js +198 -0
  20. package/src/core/prerender/entities.js +2252 -0
  21. package/src/core/prerender/prerender.js +431 -0
  22. package/src/core/prerender/queue.js +80 -0
  23. package/src/core/sync/create_manifest_data/index.js +488 -0
  24. package/src/core/sync/create_manifest_data/types.d.ts +37 -0
  25. package/src/core/sync/sync.js +70 -0
  26. package/src/core/sync/utils.js +33 -0
  27. package/src/core/sync/write_ambient.js +53 -0
  28. package/src/core/sync/write_client_manifest.js +106 -0
  29. package/src/core/sync/write_matchers.js +25 -0
  30. package/src/core/sync/write_root.js +91 -0
  31. package/src/core/sync/write_tsconfig.js +195 -0
  32. package/src/core/sync/write_types/index.js +678 -0
  33. package/src/core/utils.js +70 -0
  34. package/src/exports/hooks/index.js +1 -0
  35. package/src/exports/hooks/sequence.js +44 -0
  36. package/src/exports/index.js +45 -0
  37. package/src/exports/node/index.js +173 -0
  38. package/src/exports/node/polyfills.js +41 -0
  39. package/src/exports/vite/build/build_server.js +378 -0
  40. package/src/exports/vite/build/build_service_worker.js +90 -0
  41. package/src/exports/vite/build/utils.js +180 -0
  42. package/src/exports/vite/dev/index.js +577 -0
  43. package/src/exports/vite/graph_analysis/index.js +277 -0
  44. package/src/exports/vite/graph_analysis/types.d.ts +5 -0
  45. package/src/exports/vite/graph_analysis/utils.js +30 -0
  46. package/src/exports/vite/index.js +598 -0
  47. package/src/exports/vite/preview/index.js +189 -0
  48. package/src/exports/vite/types.d.ts +3 -0
  49. package/src/exports/vite/utils.js +157 -0
  50. package/src/runtime/app/env.js +1 -0
  51. package/src/runtime/app/environment.js +11 -0
  52. package/src/runtime/app/forms.js +114 -0
  53. package/src/runtime/app/navigation.js +23 -0
  54. package/src/runtime/app/paths.js +1 -0
  55. package/src/runtime/app/stores.js +102 -0
  56. package/src/runtime/client/ambient.d.ts +26 -0
  57. package/src/runtime/client/client.js +1583 -0
  58. package/src/runtime/client/fetcher.js +107 -0
  59. package/src/runtime/client/parse.js +60 -0
  60. package/src/runtime/client/singletons.js +21 -0
  61. package/src/runtime/client/start.js +37 -0
  62. package/src/runtime/client/types.d.ts +84 -0
  63. package/src/runtime/client/utils.js +159 -0
  64. package/src/runtime/components/error.svelte +16 -0
  65. package/{assets → src/runtime}/components/layout.svelte +0 -0
  66. package/src/runtime/control.js +98 -0
  67. package/src/runtime/env/dynamic/private.js +1 -0
  68. package/src/runtime/env/dynamic/public.js +1 -0
  69. package/src/runtime/env-private.js +6 -0
  70. package/src/runtime/env-public.js +6 -0
  71. package/src/runtime/env.js +6 -0
  72. package/src/runtime/hash.js +16 -0
  73. package/src/runtime/paths.js +11 -0
  74. package/src/runtime/server/cookie.js +127 -0
  75. package/src/runtime/server/data/index.js +136 -0
  76. package/src/runtime/server/endpoint.js +90 -0
  77. package/src/runtime/server/index.js +340 -0
  78. package/src/runtime/server/page/actions.js +243 -0
  79. package/src/runtime/server/page/crypto.js +239 -0
  80. package/src/runtime/server/page/csp.js +250 -0
  81. package/src/runtime/server/page/fetch.js +301 -0
  82. package/src/runtime/server/page/index.js +304 -0
  83. package/src/runtime/server/page/load_data.js +124 -0
  84. package/src/runtime/server/page/render.js +342 -0
  85. package/src/runtime/server/page/respond_with_error.js +104 -0
  86. package/src/runtime/server/page/serialize_data.js +87 -0
  87. package/src/runtime/server/page/types.d.ts +41 -0
  88. package/src/runtime/server/utils.js +179 -0
  89. package/src/utils/array.js +9 -0
  90. package/src/utils/error.js +22 -0
  91. package/src/utils/escape.js +46 -0
  92. package/src/utils/filesystem.js +137 -0
  93. package/src/utils/functions.js +16 -0
  94. package/src/utils/http.js +55 -0
  95. package/src/utils/misc.js +1 -0
  96. package/src/utils/routing.js +117 -0
  97. package/src/utils/unit_test.js +11 -0
  98. package/src/utils/url.js +142 -0
  99. package/svelte-kit.js +1 -1
  100. package/types/ambient.d.ts +426 -0
  101. package/types/index.d.ts +444 -0
  102. package/types/internal.d.ts +378 -0
  103. package/types/private.d.ts +224 -0
  104. package/CHANGELOG.md +0 -484
  105. package/assets/components/error.svelte +0 -13
  106. package/assets/runtime/app/env.js +0 -5
  107. package/assets/runtime/app/navigation.js +0 -44
  108. package/assets/runtime/app/paths.js +0 -1
  109. package/assets/runtime/app/stores.js +0 -93
  110. package/assets/runtime/chunks/utils.js +0 -22
  111. package/assets/runtime/internal/singletons.js +0 -23
  112. package/assets/runtime/internal/start.js +0 -779
  113. package/assets/runtime/paths.js +0 -12
  114. package/dist/chunks/index.js +0 -3516
  115. package/dist/chunks/index2.js +0 -587
  116. package/dist/chunks/index3.js +0 -246
  117. package/dist/chunks/index4.js +0 -528
  118. package/dist/chunks/index5.js +0 -763
  119. package/dist/chunks/index6.js +0 -322
  120. package/dist/chunks/standard.js +0 -99
  121. package/dist/chunks/utils.js +0 -83
  122. package/dist/cli.js +0 -550
  123. package/dist/ssr.js +0 -2588
  124. package/types.d.ts +0 -89
  125. package/types.internal.d.ts +0 -191
package/types.d.ts DELETED
@@ -1,89 +0,0 @@
1
- import { Logger } from './types.internal';
2
-
3
- export type Config = {
4
- compilerOptions?: any;
5
- extensions?: string[];
6
- kit?: {
7
- adapter?: string | [string, any];
8
- amp?: boolean;
9
- appDir?: string;
10
- files?: {
11
- assets?: string;
12
- lib?: string;
13
- routes?: string;
14
- serviceWorker?: string;
15
- setup?: string;
16
- template?: string;
17
- };
18
- host?: string;
19
- hostHeader?: string;
20
- paths?: {
21
- base?: string;
22
- assets?: string;
23
- };
24
- prerender?: {
25
- crawl?: boolean;
26
- enabled?: boolean;
27
- force?: boolean;
28
- pages?: string[];
29
- };
30
- target?: string;
31
- };
32
- preprocess?: any;
33
- };
34
-
35
- type Builder = {
36
- copy_client_files: (dest: string) => void;
37
- copy_server_files: (dest: string) => void;
38
- copy_static_files: (dest: string) => void;
39
- prerender: ({ force, dest }: { force?: boolean; dest: string }) => Promise<void>;
40
- log: Logger;
41
- };
42
-
43
- export type Adapter = {
44
- adapt: (builder: Builder) => Promise<void>;
45
- };
46
-
47
- interface ReadOnlyFormData extends Iterator<[string, string]> {
48
- get: (key: string) => string;
49
- getAll: (key: string) => string[];
50
- has: (key: string) => boolean;
51
- entries: () => Iterator<[string, string]>;
52
- keys: () => Iterator<string>;
53
- values: () => Iterator<string>;
54
- }
55
-
56
- export type RequestHandler = (
57
- request?: {
58
- host: string;
59
- headers: Record<string, string>;
60
- path: string;
61
- params: Record<string, string>;
62
- query: URLSearchParams;
63
- body: string | Buffer | ReadOnlyFormData;
64
- },
65
- context?: any
66
- ) => {
67
- status?: number;
68
- headers?: Record<string, string>;
69
- body?: any;
70
- };
71
-
72
- export type Load = (
73
- page: {
74
- host: string;
75
- path: string;
76
- params: Record<string, string>;
77
- query: URLSearchParams;
78
- },
79
- fetch: (info: RequestInfo, init?: RequestInit) => Promise<Response>,
80
- session: any,
81
- context: Record<string, any>
82
- ) => {
83
- status?: number;
84
- error?: Error | string;
85
- redirect?: string;
86
- maxage?: number;
87
- props?: Record<string, any>;
88
- context?: Record<string, any>;
89
- };
@@ -1,191 +0,0 @@
1
- declare global {
2
- interface ImportMeta {
3
- env: Record<string, string>;
4
- }
5
- }
6
-
7
- export type Logger = {
8
- (msg: string): void;
9
- success: (msg: string) => void;
10
- error: (msg: string) => void;
11
- warn: (msg: string) => void;
12
- minor: (msg: string) => void;
13
- info: (msg: string) => void;
14
- };
15
-
16
- export type ValidatedConfig = {
17
- compilerOptions: any;
18
- extensions: string[];
19
- kit: {
20
- adapter: [string, any];
21
- amp: boolean;
22
- appDir: string;
23
- files: {
24
- assets: string;
25
- lib: string;
26
- routes: string;
27
- serviceWorker: string;
28
- setup: string;
29
- template: string;
30
- };
31
- host: string;
32
- hostHeader: string;
33
- paths: {
34
- base: string;
35
- assets: string;
36
- };
37
- prerender: {
38
- crawl: boolean;
39
- enabled: boolean;
40
- force: boolean;
41
- pages: string[];
42
- };
43
- target: string;
44
- };
45
- preprocess: any;
46
- };
47
-
48
- export type App = {
49
- init: ({
50
- paths
51
- }: {
52
- paths: {
53
- base: string;
54
- assets: string;
55
- };
56
- }) => void;
57
- render: (request: Request, options: RenderOptions) => Response;
58
- };
59
-
60
- export type Headers = Record<string, string>;
61
-
62
- export type Request = {
63
- host: string;
64
- method: string;
65
- headers: Headers;
66
- path: string;
67
- body: any;
68
- params: Record<string, string>;
69
- query: URLSearchParams;
70
- };
71
-
72
- export type Response = {
73
- status: number;
74
- headers: Headers;
75
- body?: any;
76
- dependencies?: Record<string, Response>;
77
- };
78
-
79
- export type PreloadContext = {
80
- // TODO need to avoid having a bunch of different types called Page
81
- };
82
-
83
- export type LoadResult = {
84
- status?: number;
85
- error?: Error;
86
- redirect?: string;
87
- props?: Record<string, any>;
88
- context?: Record<string, any>;
89
- maxage?: number;
90
- };
91
-
92
- export type SSRComponent = {
93
- prerender?: boolean;
94
- preload?: any; // TODO remove for 1.0
95
- load: (preload_context: PreloadContext) => LoadResult | Promise<LoadResult>;
96
- default: {
97
- render: (
98
- props: Record<string, any>
99
- ) => {
100
- html: string;
101
- head: string;
102
- css: string;
103
- };
104
- };
105
- };
106
-
107
- export type SSRComponentLoader = () => Promise<SSRComponent>;
108
-
109
- export type CSRComponent = any; // TODO
110
-
111
- export type Page = {
112
- pattern: RegExp;
113
- params: (match: RegExpExecArray) => Record<string, string>;
114
- parts: SSRComponentLoader[];
115
- style: string;
116
- css: string[];
117
- js: string[];
118
- };
119
-
120
- export type Endpoint = {
121
- pattern: RegExp;
122
- params: (match: RegExpExecArray) => Record<string, string>;
123
- load: () => Promise<any>; // TODO
124
- };
125
-
126
- export type Manifest = {
127
- assets: Asset[];
128
- layout: SSRComponentLoader;
129
- error: SSRComponentLoader;
130
- pages: Page[];
131
- endpoints: Endpoint[];
132
- };
133
-
134
- export type RenderOptions = {
135
- paths?: {
136
- base: string;
137
- assets: string;
138
- };
139
- local?: boolean;
140
- template?: ({ head, body }: { head: string; body: string }) => string;
141
- manifest?: Manifest;
142
- target?: string;
143
- entry?: string;
144
- root?: SSRComponent['default'];
145
- setup?: {
146
- prepare?: (incoming: {
147
- headers: Headers;
148
- }) => {
149
- context?: any;
150
- headers?: Headers;
151
- };
152
- getSession: ({ context }: { context: any }) => any;
153
- };
154
- dev?: boolean;
155
- amp?: boolean;
156
- only_prerender?: boolean;
157
- app_dir?: string;
158
- host?: string;
159
- host_header?: string;
160
- get_stack?: (error: Error) => string;
161
- get_static_file?: (file: string) => Buffer;
162
- get_amp_css?: (dep: string) => string;
163
- fetched?: string;
164
- };
165
-
166
- export type Asset = {
167
- file: string;
168
- size: number;
169
- type: string;
170
- };
171
-
172
- export type PageData = {
173
- pattern: RegExp;
174
- params: string[];
175
- parts: any[]; // TODO
176
- };
177
-
178
- export type EndpointData = {
179
- pattern: RegExp;
180
- params: string[];
181
- file: string;
182
- };
183
-
184
- export type ManifestData = {
185
- assets: Asset[];
186
- layout: string;
187
- error: string;
188
- components: string[];
189
- pages: PageData[];
190
- endpoints: EndpointData[];
191
- };