@sveltejs/kit 1.0.0-next.190 → 1.0.0-next.191
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.
- package/dist/chunks/index.js +16 -1
- package/dist/chunks/index2.js +2 -1
- package/dist/chunks/index3.js +4 -10
- package/dist/chunks/index4.js +3 -3
- package/dist/cli.js +17 -5
- package/package.json +2 -2
- package/types/ambient-modules.d.ts +1 -1
- package/types/config.d.ts +21 -4
- package/types/internal.d.ts +5 -1
package/dist/chunks/index.js
CHANGED
|
@@ -4268,6 +4268,20 @@ class Watcher extends EventEmitter {
|
|
|
4268
4268
|
});
|
|
4269
4269
|
}
|
|
4270
4270
|
|
|
4271
|
+
allowed_directories() {
|
|
4272
|
+
return [
|
|
4273
|
+
...new Set([
|
|
4274
|
+
this.config.kit.files.assets,
|
|
4275
|
+
this.config.kit.files.lib,
|
|
4276
|
+
this.config.kit.files.routes,
|
|
4277
|
+
path__default.resolve(this.cwd, 'src'),
|
|
4278
|
+
path__default.resolve(this.cwd, '.svelte-kit'),
|
|
4279
|
+
path__default.resolve(this.cwd, 'node_modules'),
|
|
4280
|
+
path__default.resolve(vite.searchForWorkspaceRoot(this.cwd), 'node_modules')
|
|
4281
|
+
])
|
|
4282
|
+
];
|
|
4283
|
+
}
|
|
4284
|
+
|
|
4271
4285
|
async init_server() {
|
|
4272
4286
|
if (!this.manifest) throw new Error('Must call init() before init_server()');
|
|
4273
4287
|
|
|
@@ -4277,7 +4291,8 @@ class Watcher extends EventEmitter {
|
|
|
4277
4291
|
const default_config = {
|
|
4278
4292
|
server: {
|
|
4279
4293
|
fs: {
|
|
4280
|
-
strict: true
|
|
4294
|
+
strict: true,
|
|
4295
|
+
allow: this.allowed_directories()
|
|
4281
4296
|
},
|
|
4282
4297
|
strictPort: true
|
|
4283
4298
|
}
|
package/dist/chunks/index2.js
CHANGED
package/dist/chunks/index3.js
CHANGED
|
@@ -466,12 +466,6 @@ var glob = sync;
|
|
|
466
466
|
/** @param {any} value */
|
|
467
467
|
const s = (value) => JSON.stringify(value);
|
|
468
468
|
|
|
469
|
-
/** @typedef {Record<string, {
|
|
470
|
-
* file: string;
|
|
471
|
-
* css: string[];
|
|
472
|
-
* imports: string[];
|
|
473
|
-
* }>} ClientManifest */
|
|
474
|
-
|
|
475
469
|
/**
|
|
476
470
|
* @param {import('types/config').ValidatedConfig} config
|
|
477
471
|
* @param {{
|
|
@@ -562,7 +556,6 @@ async function build_client({
|
|
|
562
556
|
process.env.VITE_SVELTEKIT_AMP = config.kit.amp ? 'true' : '';
|
|
563
557
|
|
|
564
558
|
const client_out_dir = `${output_dir}/client/${config.kit.appDir}`;
|
|
565
|
-
const client_manifest_file = `${client_out_dir}/manifest.json`;
|
|
566
559
|
|
|
567
560
|
/** @type {Record<string, string>} */
|
|
568
561
|
const input = {
|
|
@@ -637,7 +630,8 @@ async function build_client({
|
|
|
637
630
|
|
|
638
631
|
await vite.build(merged_config);
|
|
639
632
|
|
|
640
|
-
|
|
633
|
+
const client_manifest_file = `${client_out_dir}/manifest.json`;
|
|
634
|
+
/** @type {import('vite').Manifest} */
|
|
641
635
|
const client_manifest = JSON.parse(fs__default.readFileSync(client_manifest_file, 'utf-8'));
|
|
642
636
|
fs__default.renameSync(client_manifest_file, `${output_dir}/manifest.json`); // inspectable but not shipped
|
|
643
637
|
|
|
@@ -655,7 +649,7 @@ async function build_client({
|
|
|
655
649
|
* client_entry_file: string;
|
|
656
650
|
* service_worker_entry_file: string | null;
|
|
657
651
|
* }} options
|
|
658
|
-
* @param {
|
|
652
|
+
* @param {import('vite').Manifest} client_manifest
|
|
659
653
|
* @param {string} runtime
|
|
660
654
|
*/
|
|
661
655
|
async function build_server(
|
|
@@ -961,7 +955,7 @@ async function build_server(
|
|
|
961
955
|
* client_entry_file: string;
|
|
962
956
|
* service_worker_entry_file: string | null;
|
|
963
957
|
* }} options
|
|
964
|
-
* @param {
|
|
958
|
+
* @param {import('vite').Manifest} client_manifest
|
|
965
959
|
*/
|
|
966
960
|
async function build_service_worker(
|
|
967
961
|
{ cwd, assets_base, config, manifest, build_dir, output_dir, service_worker_entry_file },
|
package/dist/chunks/index4.js
CHANGED
|
@@ -348,15 +348,15 @@ function get_utils({ cwd, config, build_data, log }) {
|
|
|
348
348
|
copy,
|
|
349
349
|
|
|
350
350
|
copy_client_files(dest) {
|
|
351
|
-
copy(`${cwd}/${SVELTE_KIT}/output/client`, dest, (file) => file[0] !== '.');
|
|
351
|
+
return copy(`${cwd}/${SVELTE_KIT}/output/client`, dest, (file) => file[0] !== '.');
|
|
352
352
|
},
|
|
353
353
|
|
|
354
354
|
copy_server_files(dest) {
|
|
355
|
-
copy(`${cwd}/${SVELTE_KIT}/output/server`, dest, (file) => file[0] !== '.');
|
|
355
|
+
return copy(`${cwd}/${SVELTE_KIT}/output/server`, dest, (file) => file[0] !== '.');
|
|
356
356
|
},
|
|
357
357
|
|
|
358
358
|
copy_static_files(dest) {
|
|
359
|
-
copy(config.kit.files.assets, dest);
|
|
359
|
+
return copy(config.kit.files.assets, dest);
|
|
360
360
|
},
|
|
361
361
|
|
|
362
362
|
async prerender({ all = false, dest, fallback }) {
|
package/dist/cli.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import fs__default, { existsSync } from 'fs';
|
|
2
2
|
import sade from 'sade';
|
|
3
|
+
import path__default, { relative } from 'path';
|
|
3
4
|
import { exec as exec$1 } from 'child_process';
|
|
4
5
|
import { createConnection, createServer } from 'net';
|
|
5
|
-
import path__default from 'path';
|
|
6
6
|
import * as url from 'url';
|
|
7
7
|
import { fileURLToPath } from 'url';
|
|
8
8
|
import { networkInterfaces, release } from 'os';
|
|
@@ -817,7 +817,7 @@ async function launch(port, https) {
|
|
|
817
817
|
exec(`${cmd} ${https ? 'https' : 'http'}://localhost:${port}`);
|
|
818
818
|
}
|
|
819
819
|
|
|
820
|
-
const prog = sade('svelte-kit').version('1.0.0-next.
|
|
820
|
+
const prog = sade('svelte-kit').version('1.0.0-next.191');
|
|
821
821
|
|
|
822
822
|
prog
|
|
823
823
|
.command('dev')
|
|
@@ -854,7 +854,14 @@ prog
|
|
|
854
854
|
https = https || !!config.kit.vite().server?.https;
|
|
855
855
|
open = open || !!config.kit.vite().server?.open;
|
|
856
856
|
|
|
857
|
-
welcome({
|
|
857
|
+
welcome({
|
|
858
|
+
port: address_info.port,
|
|
859
|
+
host: address_info.address,
|
|
860
|
+
https,
|
|
861
|
+
open,
|
|
862
|
+
allow: watcher.allowed_directories(),
|
|
863
|
+
cwd: watcher.cwd
|
|
864
|
+
});
|
|
858
865
|
} catch (error) {
|
|
859
866
|
handle_error(error);
|
|
860
867
|
}
|
|
@@ -964,12 +971,14 @@ async function check_port(port) {
|
|
|
964
971
|
* host: string;
|
|
965
972
|
* https: boolean;
|
|
966
973
|
* port: number;
|
|
974
|
+
* allow?: string[];
|
|
975
|
+
* cwd?: string;
|
|
967
976
|
* }} param0
|
|
968
977
|
*/
|
|
969
|
-
function welcome({ port, host, https, open }) {
|
|
978
|
+
function welcome({ port, host, https, open, allow, cwd }) {
|
|
970
979
|
if (open) launch(port, https);
|
|
971
980
|
|
|
972
|
-
console.log($.bold().cyan(`\n SvelteKit v${'1.0.0-next.
|
|
981
|
+
console.log($.bold().cyan(`\n SvelteKit v${'1.0.0-next.191'}\n`));
|
|
973
982
|
|
|
974
983
|
const protocol = https ? 'https:' : 'http:';
|
|
975
984
|
const exposed = typeof host !== 'undefined' && host !== 'localhost' && host !== '127.0.0.1';
|
|
@@ -987,6 +996,9 @@ function welcome({ port, host, https, open }) {
|
|
|
987
996
|
|
|
988
997
|
if (exposed) {
|
|
989
998
|
console.log(` ${$.gray('network:')} ${protocol}//${$.bold(`${details.address}:${port}`)}`);
|
|
999
|
+
if (allow?.length && cwd) {
|
|
1000
|
+
console.log(`\n ${$.yellow('Note that all files in the following directories will be accessible to anyone on your network: ' + allow.map(a => relative(cwd, a)).join(', '))}`);
|
|
1001
|
+
}
|
|
990
1002
|
} else {
|
|
991
1003
|
console.log(` ${$.gray('network: not exposed')}`);
|
|
992
1004
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sveltejs/kit",
|
|
3
|
-
"version": "1.0.0-next.
|
|
3
|
+
"version": "1.0.0-next.191",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/sveltejs/kit",
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"@sveltejs/vite-plugin-svelte": "^1.0.0-next.30",
|
|
13
13
|
"cheap-watch": "^1.0.4",
|
|
14
14
|
"sade": "^1.7.4",
|
|
15
|
-
"vite": "^2.6.
|
|
15
|
+
"vite": "^2.6.12"
|
|
16
16
|
},
|
|
17
17
|
"devDependencies": {
|
|
18
18
|
"@rollup/plugin-replace": "^3.0.0",
|
|
@@ -161,7 +161,7 @@ declare module '@sveltejs/kit/ssr' {
|
|
|
161
161
|
type State = import('@sveltejs/kit/types/internal').SSRRenderState;
|
|
162
162
|
|
|
163
163
|
export interface Respond {
|
|
164
|
-
(incoming: IncomingRequest, options: Options, state?: State): Response
|
|
164
|
+
(incoming: IncomingRequest, options: Options, state?: State): Promise<Response>;
|
|
165
165
|
}
|
|
166
166
|
export const respond: Respond;
|
|
167
167
|
}
|
package/types/config.d.ts
CHANGED
|
@@ -6,10 +6,27 @@ export interface AdapterUtils {
|
|
|
6
6
|
log: Logger;
|
|
7
7
|
rimraf(dir: string): void;
|
|
8
8
|
mkdirp(dir: string): void;
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
/**
|
|
10
|
+
* @param dest the destination folder to which files should be copied
|
|
11
|
+
* @returns an array of paths corresponding to the files that have been created by the copy
|
|
12
|
+
*/
|
|
13
|
+
copy_client_files(dest: string): string[];
|
|
14
|
+
/**
|
|
15
|
+
* @param dest the destination folder to which files should be copied
|
|
16
|
+
* @returns an array of paths corresponding to the files that have been created by the copy
|
|
17
|
+
*/
|
|
18
|
+
copy_server_files(dest: string): string[];
|
|
19
|
+
/**
|
|
20
|
+
* @param dest the destination folder to which files should be copied
|
|
21
|
+
* @returns an array of paths corresponding to the files that have been created by the copy
|
|
22
|
+
*/
|
|
23
|
+
copy_static_files(dest: string): string[];
|
|
24
|
+
/**
|
|
25
|
+
* @param from the source folder from which files should be copied
|
|
26
|
+
* @param to the destination folder to which files should be copied
|
|
27
|
+
* @returns an array of paths corresponding to the files that have been created by the copy
|
|
28
|
+
*/
|
|
29
|
+
copy(from: string, to: string, filter?: (basename: string) => boolean): string[];
|
|
13
30
|
prerender(options: { all?: boolean; dest: string; fallback?: string }): Promise<void>;
|
|
14
31
|
}
|
|
15
32
|
|
package/types/internal.d.ts
CHANGED
|
@@ -121,9 +121,13 @@ export interface Hooks {
|
|
|
121
121
|
|
|
122
122
|
export interface SSRNode {
|
|
123
123
|
module: SSRComponent;
|
|
124
|
-
|
|
124
|
+
/** client-side module URL for this component */
|
|
125
|
+
entry: string;
|
|
126
|
+
/** external CSS files */
|
|
125
127
|
css: string[];
|
|
128
|
+
/** external JS files */
|
|
126
129
|
js: string[];
|
|
130
|
+
/** inlined styles */
|
|
127
131
|
styles: string[];
|
|
128
132
|
}
|
|
129
133
|
|