feat: docker compose maybe
This commit is contained in:
7
node_modules/@sveltejs/adapter-auto/LICENSE
generated
vendored
Normal file
7
node_modules/@sveltejs/adapter-auto/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.
|
11
node_modules/@sveltejs/adapter-auto/README.md
generated
vendored
Normal file
11
node_modules/@sveltejs/adapter-auto/README.md
generated
vendored
Normal file
@ -0,0 +1,11 @@
|
||||
# adapter-auto
|
||||
|
||||
Automatically chooses the SvelteKit adapter for your current environment, if possible.
|
||||
|
||||
## Docs
|
||||
|
||||
[Docs](https://kit.svelte.dev/docs/adapter-auto)
|
||||
|
||||
## Changelog
|
||||
|
||||
[The Changelog for this package is available on GitHub](https://github.com/sveltejs/kit/blob/master/packages/adapter-auto/CHANGELOG.md).
|
34
node_modules/@sveltejs/adapter-auto/adapters.js
generated
vendored
Normal file
34
node_modules/@sveltejs/adapter-auto/adapters.js
generated
vendored
Normal file
@ -0,0 +1,34 @@
|
||||
// List of adapters to check for. `version` is used to pin the installed adapter version and should point
|
||||
// to the latest version of the adapter that is compatible with adapter-auto's current peerDependency version of SvelteKit.
|
||||
export const adapters = [
|
||||
{
|
||||
name: 'Vercel',
|
||||
test: () => !!process.env.VERCEL,
|
||||
module: '@sveltejs/adapter-vercel',
|
||||
version: '2'
|
||||
},
|
||||
{
|
||||
name: 'Cloudflare Pages',
|
||||
test: () => !!process.env.CF_PAGES,
|
||||
module: '@sveltejs/adapter-cloudflare',
|
||||
version: '2'
|
||||
},
|
||||
{
|
||||
name: 'Netlify',
|
||||
test: () => !!process.env.NETLIFY,
|
||||
module: '@sveltejs/adapter-netlify',
|
||||
version: '2'
|
||||
},
|
||||
{
|
||||
name: 'Azure Static Web Apps',
|
||||
test: () => process.env.GITHUB_ACTION_REPOSITORY === 'Azure/static-web-apps-deploy',
|
||||
module: 'svelte-adapter-azure-swa',
|
||||
version: '0.13'
|
||||
},
|
||||
{
|
||||
name: 'AWS via SST',
|
||||
test: () => !!process.env.SST,
|
||||
module: 'svelte-kit-sst',
|
||||
version: '2'
|
||||
}
|
||||
];
|
3
node_modules/@sveltejs/adapter-auto/index.d.ts
generated
vendored
Normal file
3
node_modules/@sveltejs/adapter-auto/index.d.ts
generated
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
import { Adapter } from '@sveltejs/kit';
|
||||
|
||||
export default function plugin(): Adapter;
|
120
node_modules/@sveltejs/adapter-auto/index.js
generated
vendored
Normal file
120
node_modules/@sveltejs/adapter-auto/index.js
generated
vendored
Normal file
@ -0,0 +1,120 @@
|
||||
import { execSync } from 'node:child_process';
|
||||
import { pathToFileURL } from 'node:url';
|
||||
import { resolve } from 'import-meta-resolve';
|
||||
import { adapters } from './adapters.js';
|
||||
import { dirname, join } from 'node:path';
|
||||
import { existsSync } from 'node:fs';
|
||||
|
||||
/** @type {Record<string, (name: string, version: string) => string>} */
|
||||
const commands = {
|
||||
npm: (name, version) => `npm install -D ${name}@${version}`,
|
||||
pnpm: (name, version) => `pnpm add -D ${name}@${version}`,
|
||||
yarn: (name, version) => `yarn add -D ${name}@${version}`
|
||||
};
|
||||
|
||||
function detect_lockfile() {
|
||||
let dir = process.cwd();
|
||||
|
||||
do {
|
||||
if (existsSync(join(dir, 'pnpm-lock.yaml'))) return 'pnpm';
|
||||
if (existsSync(join(dir, 'yarn.lock'))) return 'yarn';
|
||||
if (existsSync(join(dir, 'package-lock.json'))) return 'npm';
|
||||
} while (dir !== (dir = dirname(dir)));
|
||||
|
||||
return 'npm';
|
||||
}
|
||||
|
||||
function detect_package_manager() {
|
||||
const manager = detect_lockfile();
|
||||
|
||||
try {
|
||||
execSync(`${manager} --version`);
|
||||
return manager;
|
||||
} catch {
|
||||
return 'npm';
|
||||
}
|
||||
}
|
||||
|
||||
/** @param {string} name */
|
||||
async function import_from_cwd(name) {
|
||||
const cwd = pathToFileURL(process.cwd()).href;
|
||||
const url = await resolve(name, cwd + '/x.js');
|
||||
|
||||
return import(url);
|
||||
}
|
||||
|
||||
/** @typedef {import('@sveltejs/kit').Adapter} Adapter */
|
||||
|
||||
/**
|
||||
* @returns {Promise<Adapter | undefined>} The corresponding adapter for the current environment if found otherwise undefined
|
||||
*/
|
||||
async function get_adapter() {
|
||||
const match = adapters.find((candidate) => candidate.test());
|
||||
|
||||
if (!match) return;
|
||||
|
||||
/** @type {{ default: () => Adapter }} */
|
||||
let module;
|
||||
|
||||
try {
|
||||
module = await import_from_cwd(match.module);
|
||||
} catch (error) {
|
||||
if (
|
||||
error.code === 'ERR_MODULE_NOT_FOUND' &&
|
||||
error.message.startsWith(`Cannot find package '${match.module}'`)
|
||||
) {
|
||||
const package_manager = detect_package_manager();
|
||||
const command = commands[package_manager](match.module, match.version);
|
||||
|
||||
try {
|
||||
console.log(`Installing ${match.module}...`);
|
||||
|
||||
execSync(command, {
|
||||
stdio: 'inherit',
|
||||
env: {
|
||||
...process.env,
|
||||
NODE_ENV: undefined
|
||||
}
|
||||
});
|
||||
|
||||
module = await import_from_cwd(match.module);
|
||||
|
||||
console.log(`Successfully installed ${match.module}.`);
|
||||
console.warn(
|
||||
`\nIf you plan on staying on this deployment platform, consider replacing @sveltejs/adapter-auto with ${match.module}. This will give you faster and more robust installs, and more control over deployment configuration.\n`
|
||||
);
|
||||
} catch (e) {
|
||||
throw new Error(
|
||||
`Could not install ${match.module}. Please install it yourself by adding it to your package.json's devDependencies and try building your project again.`,
|
||||
{ cause: e }
|
||||
);
|
||||
}
|
||||
} else {
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
const adapter = module.default();
|
||||
|
||||
return {
|
||||
...adapter,
|
||||
adapt: (builder) => {
|
||||
builder.log.info(`Detected environment: ${match.name}. Using ${match.module}`);
|
||||
return adapter.adapt(builder);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
/** @type {() => Adapter} */
|
||||
export default () => ({
|
||||
name: '@sveltejs/adapter-auto',
|
||||
adapt: async (builder) => {
|
||||
const adapter = await get_adapter();
|
||||
|
||||
if (adapter) return adapter.adapt(builder);
|
||||
|
||||
builder.log.warn(
|
||||
'Could not detect a supported production environment. See https://kit.svelte.dev/docs/adapters to learn how to configure your app to run on the platform of your choosing'
|
||||
);
|
||||
}
|
||||
});
|
43
node_modules/@sveltejs/adapter-auto/package.json
generated
vendored
Normal file
43
node_modules/@sveltejs/adapter-auto/package.json
generated
vendored
Normal file
@ -0,0 +1,43 @@
|
||||
{
|
||||
"name": "@sveltejs/adapter-auto",
|
||||
"version": "2.1.1",
|
||||
"description": "Automatically chooses the SvelteKit adapter for your current environment, if possible.",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/sveltejs/kit",
|
||||
"directory": "packages/adapter-auto"
|
||||
},
|
||||
"license": "MIT",
|
||||
"homepage": "https://kit.svelte.dev",
|
||||
"type": "module",
|
||||
"exports": {
|
||||
".": {
|
||||
"types": "./index.d.ts",
|
||||
"import": "./index.js"
|
||||
},
|
||||
"./package.json": "./package.json"
|
||||
},
|
||||
"types": "index.d.ts",
|
||||
"files": [
|
||||
"files",
|
||||
"index.js",
|
||||
"index.d.ts",
|
||||
"adapters.js"
|
||||
],
|
||||
"devDependencies": {
|
||||
"@types/node": "^16.18.6",
|
||||
"typescript": "^4.9.4",
|
||||
"@sveltejs/kit": "^1.27.3"
|
||||
},
|
||||
"dependencies": {
|
||||
"import-meta-resolve": "^4.0.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@sveltejs/kit": "^1.0.0"
|
||||
},
|
||||
"scripts": {
|
||||
"lint": "prettier --check . --config ../../.prettierrc --ignore-path .gitignore",
|
||||
"format": "pnpm lint --write",
|
||||
"check": "tsc"
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user