@sveltejs/kit 1.0.0-next.356 → 1.0.0-next.357

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.
@@ -3097,7 +3097,12 @@ async function respond(request, options, state) {
3097
3097
  }
3098
3098
  }
3099
3099
 
3100
- let decoded = decodeURI(url.pathname);
3100
+ let decoded;
3101
+ try {
3102
+ decoded = decodeURI(url.pathname);
3103
+ } catch {
3104
+ return new Response('Malformed URI', { status: 400 });
3105
+ }
3101
3106
 
3102
3107
  /** @type {import('types').SSRRoute | null} */
3103
3108
  let route = null;
@@ -3107,7 +3112,7 @@ async function respond(request, options, state) {
3107
3112
 
3108
3113
  if (options.paths.base && !state.prerendering?.fallback) {
3109
3114
  if (!decoded.startsWith(options.paths.base)) {
3110
- return new Response(undefined, { status: 404 });
3115
+ return new Response('Not found', { status: 404 });
3111
3116
  }
3112
3117
  decoded = decoded.slice(options.paths.base.length) || '/';
3113
3118
  }
@@ -224,7 +224,10 @@ const options = object(
224
224
  })
225
225
  }),
226
226
 
227
- endpointExtensions: string_array(['.js', '.ts']),
227
+ // TODO: remove this for the 1.0 release
228
+ endpointExtensions: error(
229
+ (keypath) => `${keypath} has been renamed to config.kit.moduleExtensions`
230
+ ),
228
231
 
229
232
  files: object({
230
233
  assets: string('static'),
@@ -270,6 +273,8 @@ const options = object(
270
273
  })
271
274
  }),
272
275
 
276
+ moduleExtensions: string_array(['.js', '.ts']),
277
+
273
278
  outDir: string('.svelte-kit'),
274
279
 
275
280
  package: object({
@@ -352,7 +352,7 @@ function create_manifest_data({
352
352
  });
353
353
 
354
354
  const routes_base = posixify(path__default.relative(cwd, config.kit.files.routes));
355
- const valid_extensions = [...config.extensions, ...config.kit.endpointExtensions];
355
+ const valid_extensions = [...config.extensions, ...config.kit.moduleExtensions];
356
356
 
357
357
  if (fs__default.existsSync(config.kit.files.routes)) {
358
358
  list_files(config.kit.files.routes).forEach((file) => {
@@ -537,6 +537,7 @@ function create_manifest_data({
537
537
  if (fs__default.existsSync(config.kit.files.params)) {
538
538
  for (const file of fs__default.readdirSync(config.kit.files.params)) {
539
539
  const ext = path__default.extname(file);
540
+ if (!config.kit.moduleExtensions.includes(ext)) continue;
540
541
  const type = file.slice(0, -ext.length);
541
542
 
542
543
  if (/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(type)) {
@@ -943,7 +944,7 @@ function write_types(config, manifest_data) {
943
944
 
944
945
  if (file) {
945
946
  const ext = /** @type {string} */ (
946
- config.kit.endpointExtensions.find((ext) => file.endsWith(ext))
947
+ config.kit.moduleExtensions.find((ext) => file.endsWith(ext))
947
948
  );
948
949
  const key = file.slice(0, -ext.length);
949
950
  shadow_types.set(key, {
package/dist/cli.js CHANGED
@@ -41,7 +41,7 @@ async function launch(port, https, base) {
41
41
  exec(`${cmd} ${https ? 'https' : 'http'}://localhost:${port}${base}`);
42
42
  }
43
43
 
44
- const prog = sade('svelte-kit').version('1.0.0-next.356');
44
+ const prog = sade('svelte-kit').version('1.0.0-next.357');
45
45
 
46
46
  prog
47
47
  .command('dev')
@@ -242,7 +242,7 @@ prog.parse(process.argv, { unknown: (arg) => `Unknown option: ${arg}` });
242
242
  function welcome({ port, host, https, open, base, loose, allow, cwd }) {
243
243
  if (open) launch(port, https, base);
244
244
 
245
- console.log($.bold().cyan(`\n SvelteKit v${'1.0.0-next.356'}\n`));
245
+ console.log($.bold().cyan(`\n SvelteKit v${'1.0.0-next.357'}\n`));
246
246
 
247
247
  const protocol = https ? 'https:' : 'http:';
248
248
  const exposed = typeof host !== 'undefined' && host !== 'localhost' && host !== '127.0.0.1';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sveltejs/kit",
3
- "version": "1.0.0-next.356",
3
+ "version": "1.0.0-next.357",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/sveltejs/kit",
package/types/index.d.ts CHANGED
@@ -107,7 +107,7 @@ export interface KitConfig {
107
107
  mode?: 'hash' | 'nonce' | 'auto';
108
108
  directives?: CspDirectives;
109
109
  };
110
- endpointExtensions?: string[];
110
+ moduleExtensions?: string[];
111
111
  files?: {
112
112
  assets?: string;
113
113
  hooks?: string;