Skip to content

Commit 7072c9b

Browse files
frodesundbyjhrvandnorda
committed
new nais io
Co-authored-by: Johnny Horvi <[email protected]> Co-authored-by: Andreas Nordahl <[email protected]>
1 parent b8f3a8f commit 7072c9b

File tree

164 files changed

+12812
-4806
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

164 files changed

+12812
-4806
lines changed

eslint.config.js

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import prettier from 'eslint-config-prettier';
2+
import js from '@eslint/js';
3+
import svelte from 'eslint-plugin-svelte';
4+
import globals from 'globals';
5+
import ts from 'typescript-eslint';
6+
7+
export default ts.config(
8+
js.configs.recommended,
9+
...ts.configs.recommended,
10+
...svelte.configs['flat/recommended'],
11+
prettier,
12+
...svelte.configs['flat/prettier'],
13+
{
14+
languageOptions: {
15+
globals: {
16+
...globals.browser,
17+
...globals.node
18+
}
19+
}
20+
},
21+
{
22+
files: ['**/*.svelte'],
23+
24+
languageOptions: {
25+
parserOptions: {
26+
parser: ts.parser
27+
}
28+
}
29+
},
30+
{
31+
ignores: ['build/', '.svelte-kit/', 'dist/']
32+
}
33+
);

old/.svelte-kit/ambient.d.ts

+218
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,218 @@
1+
2+
// this file is generated — do not edit it
3+
4+
5+
/// <reference types="@sveltejs/kit" />
6+
7+
/**
8+
* Environment variables [loaded by Vite](https://vitejs.dev/guide/env-and-mode.html#env-files) from `.env` files and `process.env`. Like [`$env/dynamic/private`](https://kit.svelte.dev/docs/modules#$env-dynamic-private), this module cannot be imported into public-facing code. This module only includes variables that _do not_ begin with [`config.kit.env.publicPrefix`](https://kit.svelte.dev/docs/configuration#env).
9+
*
10+
* _Unlike_ [`$env/dynamic/private`](https://kit.svelte.dev/docs/modules#$env-dynamic-private), the values exported from this module are statically injected into your bundle at build time, enabling optimisations like dead code elimination.
11+
*
12+
* ```ts
13+
* import { API_KEY } from '$env/static/private';
14+
* ```
15+
*
16+
* Note that all environment variables referenced in your code should be declared (for example in an `.env` file), even if they don't have a value until the app is deployed:
17+
*
18+
* ```
19+
* MY_FEATURE_FLAG=""
20+
* ```
21+
*
22+
* You can override `.env` values from the command line like so:
23+
*
24+
* ```bash
25+
* MY_FEATURE_FLAG="enabled" npm run dev
26+
* ```
27+
*/
28+
declare module '$env/static/private' {
29+
export const GREP_COLOR: string;
30+
export const MANPATH: string;
31+
export const TERM_PROGRAM: string;
32+
export const NODE: string;
33+
export const INIT_CWD: string;
34+
export const TERM: string;
35+
export const SHELL: string;
36+
export const ASDF_DIR: string;
37+
export const TMPDIR: string;
38+
export const HOMEBREW_REPOSITORY: string;
39+
export const CPPFLAGS: string;
40+
export const npm_config_metrics_registry: string;
41+
export const npm_config_global_prefix: string;
42+
export const VAULT_ADDR: string;
43+
export const TERM_PROGRAM_VERSION: string;
44+
export const WINDOWID: string;
45+
export const COLOR: string;
46+
export const npm_config_noproxy: string;
47+
export const ZSH: string;
48+
export const npm_config_local_prefix: string;
49+
export const CDPATH: string;
50+
export const USER: string;
51+
export const LS_COLORS: string;
52+
export const COMMAND_MODE: string;
53+
export const npm_config_globalconfig: string;
54+
export const SSH_AUTH_SOCK: string;
55+
export const __CF_USER_TEXT_ENCODING: string;
56+
export const npm_execpath: string;
57+
export const PAGER: string;
58+
export const TMUX: string;
59+
export const LSCOLORS: string;
60+
export const PATH: string;
61+
export const _: string;
62+
export const LaunchInstanceID: string;
63+
export const NPM_CONFIG_PREFIX: string;
64+
export const npm_config_engine_strict: string;
65+
export const npm_package_json: string;
66+
export const __CFBundleIdentifier: string;
67+
export const npm_config_init_module: string;
68+
export const npm_config_userconfig: string;
69+
export const PWD: string;
70+
export const npm_command: string;
71+
export const KITTY_PID: string;
72+
export const EDITOR: string;
73+
export const npm_lifecycle_event: string;
74+
export const LANG: string;
75+
export const npm_package_name: string;
76+
export const XPC_FLAGS: string;
77+
export const TMUX_PANE: string;
78+
export const npm_config_node_gyp: string;
79+
export const XPC_SERVICE_NAME: string;
80+
export const npm_package_version: string;
81+
export const GPG_TTY: string;
82+
export const USE_GKE_GCLOUD_AUTH_PLUGIN: string;
83+
export const SHLVL: string;
84+
export const HOME: string;
85+
export const TERMINFO: string;
86+
export const HOMEBREW_PREFIX: string;
87+
export const LOGNAME: string;
88+
export const LESS: string;
89+
export const npm_config_cache: string;
90+
export const npm_lifecycle_script: string;
91+
export const KITTY_WINDOW_ID: string;
92+
export const KITTY_INSTALLATION_DIR: string;
93+
export const npm_config_user_agent: string;
94+
export const INFOPATH: string;
95+
export const HOMEBREW_CELLAR: string;
96+
export const SECURITYSESSIONID: string;
97+
export const COLORTERM: string;
98+
export const npm_node_execpath: string;
99+
export const NODE_ENV: string;
100+
}
101+
102+
/**
103+
* Similar to [`$env/static/private`](https://kit.svelte.dev/docs/modules#$env-static-private), except that it only includes environment variables that begin with [`config.kit.env.publicPrefix`](https://kit.svelte.dev/docs/configuration#env) (which defaults to `PUBLIC_`), and can therefore safely be exposed to client-side code.
104+
*
105+
* Values are replaced statically at build time.
106+
*
107+
* ```ts
108+
* import { PUBLIC_BASE_URL } from '$env/static/public';
109+
* ```
110+
*/
111+
declare module '$env/static/public' {
112+
113+
}
114+
115+
/**
116+
* This module provides access to runtime environment variables, as defined by the platform you're running on. For example if you're using [`adapter-node`](https://github.com/sveltejs/kit/tree/master/packages/adapter-node) (or running [`vite preview`](https://kit.svelte.dev/docs/cli)), this is equivalent to `process.env`. This module only includes variables that _do not_ begin with [`config.kit.env.publicPrefix`](https://kit.svelte.dev/docs/configuration#env).
117+
*
118+
* This module cannot be imported into public-facing code.
119+
*
120+
* ```ts
121+
* import { env } from '$env/dynamic/private';
122+
* console.log(env.DEPLOYMENT_SPECIFIC_VARIABLE);
123+
* ```
124+
*
125+
* > In `dev`, `$env/dynamic` always includes environment variables from `.env`. In `prod`, this behavior will depend on your adapter.
126+
*/
127+
declare module '$env/dynamic/private' {
128+
export const env: {
129+
GREP_COLOR: string;
130+
MANPATH: string;
131+
TERM_PROGRAM: string;
132+
NODE: string;
133+
INIT_CWD: string;
134+
TERM: string;
135+
SHELL: string;
136+
ASDF_DIR: string;
137+
TMPDIR: string;
138+
HOMEBREW_REPOSITORY: string;
139+
CPPFLAGS: string;
140+
npm_config_metrics_registry: string;
141+
npm_config_global_prefix: string;
142+
VAULT_ADDR: string;
143+
TERM_PROGRAM_VERSION: string;
144+
WINDOWID: string;
145+
COLOR: string;
146+
npm_config_noproxy: string;
147+
ZSH: string;
148+
npm_config_local_prefix: string;
149+
CDPATH: string;
150+
USER: string;
151+
LS_COLORS: string;
152+
COMMAND_MODE: string;
153+
npm_config_globalconfig: string;
154+
SSH_AUTH_SOCK: string;
155+
__CF_USER_TEXT_ENCODING: string;
156+
npm_execpath: string;
157+
PAGER: string;
158+
TMUX: string;
159+
LSCOLORS: string;
160+
PATH: string;
161+
_: string;
162+
LaunchInstanceID: string;
163+
NPM_CONFIG_PREFIX: string;
164+
npm_config_engine_strict: string;
165+
npm_package_json: string;
166+
__CFBundleIdentifier: string;
167+
npm_config_init_module: string;
168+
npm_config_userconfig: string;
169+
PWD: string;
170+
npm_command: string;
171+
KITTY_PID: string;
172+
EDITOR: string;
173+
npm_lifecycle_event: string;
174+
LANG: string;
175+
npm_package_name: string;
176+
XPC_FLAGS: string;
177+
TMUX_PANE: string;
178+
npm_config_node_gyp: string;
179+
XPC_SERVICE_NAME: string;
180+
npm_package_version: string;
181+
GPG_TTY: string;
182+
USE_GKE_GCLOUD_AUTH_PLUGIN: string;
183+
SHLVL: string;
184+
HOME: string;
185+
TERMINFO: string;
186+
HOMEBREW_PREFIX: string;
187+
LOGNAME: string;
188+
LESS: string;
189+
npm_config_cache: string;
190+
npm_lifecycle_script: string;
191+
KITTY_WINDOW_ID: string;
192+
KITTY_INSTALLATION_DIR: string;
193+
npm_config_user_agent: string;
194+
INFOPATH: string;
195+
HOMEBREW_CELLAR: string;
196+
SECURITYSESSIONID: string;
197+
COLORTERM: string;
198+
npm_node_execpath: string;
199+
NODE_ENV: string;
200+
[key: string]: string | undefined;
201+
}
202+
}
203+
204+
/**
205+
* Similar to [`$env/dynamic/private`](https://kit.svelte.dev/docs/modules#$env-dynamic-private), but only includes variables that begin with [`config.kit.env.publicPrefix`](https://kit.svelte.dev/docs/configuration#env) (which defaults to `PUBLIC_`), and can therefore safely be exposed to client-side code.
206+
*
207+
* Note that public dynamic environment variables must all be sent from the server to the client, causing larger network requests — when possible, use `$env/static/public` instead.
208+
*
209+
* ```ts
210+
* import { env } from '$env/dynamic/public';
211+
* console.log(env.PUBLIC_DEPLOYMENT_SPECIFIC_VARIABLE);
212+
* ```
213+
*/
214+
declare module '$env/dynamic/public' {
215+
export const env: {
216+
[key: string]: string | undefined;
217+
}
218+
}

old/.svelte-kit/build/hooks.js

Whitespace-only changes.

old/.svelte-kit/build/index.js

+102
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
2+
import root from '__GENERATED__/root.svelte';
3+
import { respond } from '../../node_modules/@sveltejs/kit/src/runtime/server/index.js';
4+
import { set_paths, assets, base } from '../../node_modules/@sveltejs/kit/src/runtime/paths.js';
5+
import { set_prerendering } from '../../node_modules/@sveltejs/kit/src/runtime/env.js';
6+
import { set_private_env } from '../../node_modules/@sveltejs/kit/src/runtime/env-private.js';
7+
import { set_public_env } from '../../node_modules/@sveltejs/kit/src/runtime/env-public.js';
8+
9+
const app_template = ({ head, body, assets, nonce }) => "<!DOCTYPE html>\n<html lang=\"en\">\n\t<head>\n\t\t<meta charset=\"utf-8\" />\n\t\t<link rel=\"icon\" href=\"" + assets + "/favicon.png\" />\n\t\t<meta name=\"viewport\" content=\"width=device-width\" />\n\t\t" + head + "\n\t</head>\n\t<body>\n\t\t" + body + "\n\t\t<script src=\"" + assets + "/events.js\"></script>\n\t</body>\n</html>\n";
10+
11+
const error_template = ({ status, message }) => "<!DOCTYPE html>\n<html lang=\"en\">\n\t<head>\n\t\t<meta charset=\"utf-8\" />\n\t\t<title>" + message + "</title>\n\n\t\t<style>\n\t\t\tbody {\n\t\t\t\tfont-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen,\n\t\t\t\t\tUbuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;\n\t\t\t\tdisplay: flex;\n\t\t\t\talign-items: center;\n\t\t\t\tjustify-content: center;\n\t\t\t\theight: 100vh;\n\t\t\t}\n\n\t\t\t.error {\n\t\t\t\tdisplay: flex;\n\t\t\t\talign-items: center;\n\t\t\t\tmax-width: 32rem;\n\t\t\t\tmargin: 0 1rem;\n\t\t\t}\n\n\t\t\t.status {\n\t\t\t\tfont-weight: 200;\n\t\t\t\tfont-size: 3rem;\n\t\t\t\tline-height: 1;\n\t\t\t\tposition: relative;\n\t\t\t\ttop: -0.05rem;\n\t\t\t}\n\n\t\t\t.message {\n\t\t\t\tborder-left: 1px solid #ccc;\n\t\t\t\tpadding: 0 0 0 1rem;\n\t\t\t\tmargin: 0 0 0 1rem;\n\t\t\t\tmin-height: 2.5rem;\n\t\t\t\tdisplay: flex;\n\t\t\t\talign-items: center;\n\t\t\t}\n\n\t\t\t.message h1 {\n\t\t\t\tfont-weight: 400;\n\t\t\t\tfont-size: 1em;\n\t\t\t\tmargin: 0;\n\t\t\t}\n\t\t</style>\n\t</head>\n\t<body>\n\t\t<div class=\"error\">\n\t\t\t<span class=\"status\">" + status + "</span>\n\t\t\t<div class=\"message\">\n\t\t\t\t<h1>" + message + "</h1>\n\t\t\t</div>\n\t\t</div>\n\t</body>\n</html>\n";
12+
13+
let read = null;
14+
15+
set_paths({"base":"","assets":""});
16+
17+
let default_protocol = 'https';
18+
19+
// allow paths to be globally overridden
20+
// in svelte-kit preview and in prerendering
21+
export function override(settings) {
22+
default_protocol = settings.protocol || default_protocol;
23+
set_paths(settings.paths);
24+
set_prerendering(settings.prerendering);
25+
read = settings.read;
26+
}
27+
28+
export class Server {
29+
constructor(manifest) {
30+
this.options = {
31+
csp: {"mode":"auto","directives":{"upgrade-insecure-requests":false,"block-all-mixed-content":false},"reportOnly":{"upgrade-insecure-requests":false,"block-all-mixed-content":false}},
32+
csrf: {
33+
check_origin: true,
34+
},
35+
dev: false,
36+
handle_error: (error, event) => {
37+
return this.options.hooks.handleError({
38+
error,
39+
event,
40+
41+
// TODO remove for 1.0
42+
// @ts-expect-error
43+
get request() {
44+
throw new Error('request in handleError has been replaced with event. See https://github.com/sveltejs/kit/pull/3384 for details');
45+
}
46+
}) ?? { message: event.routeId != null ? 'Internal Error' : 'Not Found' };
47+
},
48+
hooks: null,
49+
manifest,
50+
paths: { base, assets },
51+
public_env: {},
52+
read,
53+
root,
54+
service_worker: false,
55+
app_template,
56+
app_template_contains_nonce: false,
57+
error_template,
58+
trailing_slash: "never"
59+
};
60+
}
61+
62+
/**
63+
* Take care: Some adapters may have to call `Server.init` per-request to set env vars,
64+
* so anything that shouldn't be rerun should be wrapped in an `if` block to make sure it hasn't
65+
* been done already.
66+
*/
67+
async init({ env }) {
68+
const entries = Object.entries(env);
69+
70+
const prv = Object.fromEntries(entries.filter(([k]) => !k.startsWith('PUBLIC_')));
71+
72+
const pub = Object.fromEntries(entries.filter(([k]) => k.startsWith('PUBLIC_')));
73+
74+
set_private_env(prv);
75+
set_public_env(pub);
76+
77+
this.options.public_env = pub;
78+
79+
if (!this.options.hooks) {
80+
const module = await import("./hooks.js");
81+
82+
// TODO remove this for 1.0
83+
if (module.externalFetch) {
84+
throw new Error('externalFetch has been removed — use handleFetch instead. See https://github.com/sveltejs/kit/pull/6565 for details');
85+
}
86+
87+
this.options.hooks = {
88+
handle: module.handle || (({ event, resolve }) => resolve(event)),
89+
handleError: module.handleError || (({ error }) => console.error(error.stack)),
90+
handleFetch: module.handleFetch || (({ request, fetch }) => fetch(request))
91+
};
92+
}
93+
}
94+
95+
async respond(request, options = {}) {
96+
if (!(request instanceof Request)) {
97+
throw new Error('The first argument to server.respond must be a Request object. See https://github.com/sveltejs/kit/pull/3384 for details');
98+
}
99+
100+
return respond(request, this.options, options);
101+
}
102+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
export { matchers } from './client-matchers.js';
2+
3+
export const nodes = [() => import('./nodes/0'),
4+
() => import('./nodes/1'),
5+
() => import('./nodes/2')];
6+
7+
export const server_loads = [];
8+
9+
export const dictionary = {
10+
"": [2]
11+
};
12+
13+
export const hooks = {
14+
handleError: (({ error }) => { console.error(error) }),
15+
};
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export const matchers = {};

old/.svelte-kit/generated/nodes/0.js

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import * as shared from "../../../src/routes/+layout.ts";
2+
export { shared };
3+
export { default as component } from "../../../src/routes/+layout.svelte";

old/.svelte-kit/generated/nodes/1.js

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

old/.svelte-kit/generated/nodes/2.js

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export { default as component } from "../../../src/routes/+page.svelte";
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"prerendered":{"pages":[["/",{"file":"index.html"}]],"assets":[],"redirects":[],"paths":["/"]},"prerender_map":[["",true]]}

0 commit comments

Comments
 (0)