first
This commit is contained in:
commit
f4be03ceba
1826 changed files with 830924 additions and 0 deletions
7
frontend/node_modules/@sveltejs/adapter-static/LICENSE
generated
vendored
Normal file
7
frontend/node_modules/@sveltejs/adapter-static/LICENSE
generated
vendored
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
Copyright (c) 2020 [these people](https://github.com/sveltejs/kit/graphs/contributors)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
15
frontend/node_modules/@sveltejs/adapter-static/README.md
generated
vendored
Normal file
15
frontend/node_modules/@sveltejs/adapter-static/README.md
generated
vendored
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
# @sveltejs/adapter-static
|
||||
|
||||
[Adapter](https://svelte.dev/docs/kit/adapters) for SvelteKit apps that prerenders your entire site as a collection of static files. It's also possible to create an SPA with it by specifying a fallback page which renders an empty shell. If you'd like to prerender only some pages and not create an SPA for those left out, you will need to use a different adapter together with [the `prerender` option](https://svelte.dev/docs/kit/page-options#prerender).
|
||||
|
||||
## Docs
|
||||
|
||||
[Docs](https://svelte.dev/docs/kit/adapter-static)
|
||||
|
||||
## Changelog
|
||||
|
||||
[The Changelog for this package is available on GitHub](https://github.com/sveltejs/kit/blob/main/packages/adapter-static/CHANGELOG.md).
|
||||
|
||||
## License
|
||||
|
||||
[MIT](LICENSE)
|
||||
11
frontend/node_modules/@sveltejs/adapter-static/index.d.ts
generated
vendored
Normal file
11
frontend/node_modules/@sveltejs/adapter-static/index.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
import { Adapter } from '@sveltejs/kit';
|
||||
|
||||
export interface AdapterOptions {
|
||||
pages?: string;
|
||||
assets?: string;
|
||||
fallback?: string;
|
||||
precompress?: boolean;
|
||||
strict?: boolean;
|
||||
}
|
||||
|
||||
export default function plugin(options?: AdapterOptions): Adapter;
|
||||
91
frontend/node_modules/@sveltejs/adapter-static/index.js
generated
vendored
Normal file
91
frontend/node_modules/@sveltejs/adapter-static/index.js
generated
vendored
Normal file
|
|
@ -0,0 +1,91 @@
|
|||
import path from 'node:path';
|
||||
import { platforms } from './platforms.js';
|
||||
|
||||
/** @type {import('./index.js').default} */
|
||||
export default function (options) {
|
||||
return {
|
||||
name: '@sveltejs/adapter-static',
|
||||
/** @param {import('./internal.js').Builder2_0_0} builder */
|
||||
async adapt(builder) {
|
||||
if (!options?.fallback && builder.config.kit.router?.type !== 'hash') {
|
||||
const dynamic_routes = builder.routes.filter((route) => route.prerender !== true);
|
||||
if (dynamic_routes.length > 0 && options?.strict !== false) {
|
||||
const prefix = path.relative('.', builder.config.kit.files.routes);
|
||||
const has_param_routes = builder.routes.some((route) => route.id.includes('['));
|
||||
const config_option =
|
||||
has_param_routes || JSON.stringify(builder.config.kit.prerender.entries) !== '["*"]'
|
||||
? ` - adjust the \`prerender.entries\` config option ${
|
||||
has_param_routes
|
||||
? '(routes with parameters are not part of entry points by default)'
|
||||
: ''
|
||||
} — see https://svelte.dev/docs/kit/configuration#prerender for more info.`
|
||||
: '';
|
||||
|
||||
builder.log.error(
|
||||
`@sveltejs/adapter-static: all routes must be fully prerenderable, but found the following routes that are dynamic:
|
||||
${dynamic_routes.map((route) => ` - ${path.posix.join(prefix, route.id)}`).join('\n')}
|
||||
|
||||
You have the following options:
|
||||
- set the \`fallback\` option — see https://svelte.dev/docs/kit/single-page-apps#usage for more info.
|
||||
- add \`export const prerender = true\` to your root \`+layout.js/.ts\` or \`+layout.server.js/.ts\` file. This will try to prerender all pages.
|
||||
- add \`export const prerender = true\` to any \`+server.js/ts\` files that are not fetched by page \`load\` functions.
|
||||
${config_option}
|
||||
- pass \`strict: false\` to \`adapter-static\` to ignore this error. Only do this if you are sure you don't need the routes in question in your final app, as they will be unavailable. See https://github.com/sveltejs/kit/tree/main/packages/adapter-static#strict for more info.
|
||||
|
||||
If this doesn't help, you may need to use a different adapter. @sveltejs/adapter-static can only be used for sites that don't need a server for dynamic rendering, and can run on just a static file server.
|
||||
See https://svelte.dev/docs/kit/page-options#prerender for more details`
|
||||
);
|
||||
throw new Error('Encountered dynamic routes');
|
||||
}
|
||||
}
|
||||
|
||||
const platform = platforms.find((platform) => platform.test());
|
||||
|
||||
if (platform) {
|
||||
if (options) {
|
||||
builder.log.warn(
|
||||
`Detected ${platform.name}. Please remove adapter-static options to enable zero-config mode`
|
||||
);
|
||||
} else {
|
||||
builder.log.info(`Detected ${platform.name}, using zero-config mode`);
|
||||
}
|
||||
}
|
||||
|
||||
const {
|
||||
// @ts-ignore
|
||||
pages = 'build',
|
||||
assets = pages,
|
||||
fallback,
|
||||
precompress
|
||||
} = options ?? platform?.defaults ?? /** @type {import('./index.js').AdapterOptions} */ ({});
|
||||
|
||||
builder.rimraf(assets);
|
||||
builder.rimraf(pages);
|
||||
|
||||
builder.generateEnvModule();
|
||||
builder.writeClient(assets);
|
||||
builder.writePrerendered(pages);
|
||||
|
||||
if (fallback) {
|
||||
await builder.generateFallback(path.join(pages, fallback));
|
||||
}
|
||||
|
||||
if (precompress) {
|
||||
builder.log.minor('Compressing assets and pages');
|
||||
if (pages === assets) {
|
||||
await builder.compress(assets);
|
||||
} else {
|
||||
await Promise.all([builder.compress(assets), builder.compress(pages)]);
|
||||
}
|
||||
}
|
||||
|
||||
if (pages === assets) {
|
||||
builder.log(`Wrote site to "${pages}"`);
|
||||
} else {
|
||||
builder.log(`Wrote pages to "${pages}" and assets to "${assets}"`);
|
||||
}
|
||||
|
||||
if (!options) platform?.done(builder);
|
||||
}
|
||||
};
|
||||
}
|
||||
54
frontend/node_modules/@sveltejs/adapter-static/package.json
generated
vendored
Normal file
54
frontend/node_modules/@sveltejs/adapter-static/package.json
generated
vendored
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
{
|
||||
"name": "@sveltejs/adapter-static",
|
||||
"version": "3.0.10",
|
||||
"description": "Adapter for SvelteKit apps that prerenders your entire site as a collection of static files",
|
||||
"keywords": [
|
||||
"adapter",
|
||||
"deploy",
|
||||
"hosting",
|
||||
"ssg",
|
||||
"static site generation",
|
||||
"svelte",
|
||||
"sveltekit"
|
||||
],
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/sveltejs/kit.git",
|
||||
"directory": "packages/adapter-static"
|
||||
},
|
||||
"license": "MIT",
|
||||
"homepage": "https://svelte.dev/docs/kit/adapter-static",
|
||||
"type": "module",
|
||||
"exports": {
|
||||
".": {
|
||||
"types": "./index.d.ts",
|
||||
"import": "./index.js"
|
||||
},
|
||||
"./package.json": "./package.json"
|
||||
},
|
||||
"types": "index.d.ts",
|
||||
"files": [
|
||||
"index.js",
|
||||
"index.d.ts",
|
||||
"platforms.js"
|
||||
],
|
||||
"devDependencies": {
|
||||
"@playwright/test": "^1.51.1",
|
||||
"@sveltejs/vite-plugin-svelte": "^6.0.0-next.3",
|
||||
"@types/node": "^18.19.119",
|
||||
"sirv": "^3.0.0",
|
||||
"svelte": "^5.39.3",
|
||||
"typescript": "^5.3.3",
|
||||
"vite": "^6.3.5",
|
||||
"@sveltejs/kit": "^2.43.7"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@sveltejs/kit": "^2.0.0"
|
||||
},
|
||||
"scripts": {
|
||||
"lint": "prettier --check .",
|
||||
"check": "tsc",
|
||||
"format": "pnpm lint --write",
|
||||
"test": "pnpm -r --workspace-concurrency 1 --filter=\"./test/**\" test"
|
||||
}
|
||||
}
|
||||
76
frontend/node_modules/@sveltejs/adapter-static/platforms.js
generated
vendored
Normal file
76
frontend/node_modules/@sveltejs/adapter-static/platforms.js
generated
vendored
Normal file
|
|
@ -0,0 +1,76 @@
|
|||
import fs from 'node:fs';
|
||||
import process from 'node:process';
|
||||
|
||||
/**
|
||||
* @typedef {{
|
||||
* name: string;
|
||||
* test: () => boolean;
|
||||
* defaults: import('./index.js').AdapterOptions;
|
||||
* done: (builder: import('./internal.js').Builder2_0_0) => void;
|
||||
* }}
|
||||
* Platform */
|
||||
|
||||
// This function is duplicated in adapter-vercel
|
||||
/** @param {import('./internal.js').Builder2_0_0} builder */
|
||||
function static_vercel_config(builder) {
|
||||
/** @type {any[]} */
|
||||
const prerendered_redirects = [];
|
||||
|
||||
/** @type {Record<string, { path: string }>} */
|
||||
const overrides = {};
|
||||
|
||||
for (const [src, redirect] of builder.prerendered.redirects) {
|
||||
prerendered_redirects.push({
|
||||
src,
|
||||
headers: {
|
||||
Location: redirect.location
|
||||
},
|
||||
status: redirect.status
|
||||
});
|
||||
}
|
||||
|
||||
for (const [path, page] of builder.prerendered.pages) {
|
||||
if (path.endsWith('/') && path !== '/') {
|
||||
prerendered_redirects.push(
|
||||
{ src: path, dest: path.slice(0, -1) },
|
||||
{ src: path.slice(0, -1), status: 308, headers: { Location: path } }
|
||||
);
|
||||
|
||||
overrides[page.file] = { path: path.slice(1, -1) };
|
||||
} else {
|
||||
overrides[page.file] = { path: path.slice(1) };
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
version: 3,
|
||||
routes: [
|
||||
...prerendered_redirects,
|
||||
{
|
||||
src: `/${builder.getAppPath()}/immutable/.+`,
|
||||
headers: {
|
||||
'cache-control': 'public, immutable, max-age=31536000'
|
||||
}
|
||||
},
|
||||
{
|
||||
handle: 'filesystem'
|
||||
}
|
||||
],
|
||||
overrides
|
||||
};
|
||||
}
|
||||
|
||||
/** @type {Platform[]} */
|
||||
export const platforms = [
|
||||
{
|
||||
name: 'Vercel',
|
||||
test: () => !!process.env.VERCEL,
|
||||
defaults: {
|
||||
pages: '.vercel/output/static'
|
||||
},
|
||||
done: (builder) => {
|
||||
const config = static_vercel_config(builder);
|
||||
fs.writeFileSync('.vercel/output/config.json', JSON.stringify(config, null, ' '));
|
||||
}
|
||||
}
|
||||
];
|
||||
Loading…
Add table
Add a link
Reference in a new issue