switch to error

pull/17338/head
Elliott Johnson 1 week ago
parent 2f394b8cc4
commit cdfed0eb0b

@ -55,6 +55,12 @@ Cause:
%stack%
```
### invalid_csp
```
`csp.nonce` was set while `csp.hash` was `true`. These options cannot be used simultaneously.
```
### lifecycle_function_unavailable
```

@ -1,12 +1,5 @@
<!-- This file is generated by scripts/process-messages/index.js. Do not edit! -->
### invalid_csp
```
`csp.nonce` was set while `csp.hash` was `true`. These options cannot be used simultaneously.
`nonce` will be used.
```
### unresolved_hydratable
```

@ -43,6 +43,10 @@ This error occurs when using `hydratable` multiple times with the same key. To a
> Cause:
> %stack%
## invalid_csp
> `csp.nonce` was set while `csp.hash` was `true`. These options cannot be used simultaneously.
## lifecycle_function_unavailable
> `%name%(...)` is not available on the server

@ -1,8 +1,3 @@
## invalid_csp
> `csp.nonce` was set while `csp.hash` was `true`. These options cannot be used simultaneously.
> `nonce` will be used.
## unresolved_hydratable
> A `hydratable` value with key `%key%` was created, but at least part of it was not used during the render.

@ -80,6 +80,18 @@ ${stack}\nhttps://svelte.dev/e/hydratable_serialization_failed`);
throw error;
}
/**
* `csp.nonce` was set while `csp.hash` was `true`. These options cannot be used simultaneously.
* @returns {never}
*/
export function invalid_csp() {
const error = new Error(`invalid_csp\n\`csp.nonce\` was set while \`csp.hash\` was \`true\`. These options cannot be used simultaneously.\nhttps://svelte.dev/e/invalid_csp`);
error.name = 'Svelte error';
throw error;
}
/**
* `%name%(...)` is not available on the server
* @param {string} name

@ -17,7 +17,7 @@ import { EMPTY_COMMENT, BLOCK_CLOSE, BLOCK_OPEN, BLOCK_OPEN_ELSE } from './hydra
import { validate_store } from '../shared/validate.js';
import { is_boolean_attribute, is_raw_text_element, is_void } from '../../utils.js';
import { Renderer } from './renderer.js';
import * as w from './warnings.js';
import * as e from './errors.js';
// https://html.spec.whatwg.org/multipage/syntax.html#attributes-2
// https://infra.spec.whatwg.org/#noncharacter
@ -69,7 +69,7 @@ export function render(component, options = {}) {
// @ts-expect-error
if (options.csp.hash && options.csp.nonce) {
w.invalid_csp();
e.invalid_csp();
}
}
return Renderer.render(/** @type {Component<Props>} */ (component), {

@ -5,23 +5,6 @@ import { DEV } from 'esm-env';
var bold = 'font-weight: bold';
var normal = 'font-weight: normal';
/**
* `csp.nonce` was set while `csp.hash` was `true`. These options cannot be used simultaneously.
* `nonce` will be used.
*/
export function invalid_csp() {
if (DEV) {
console.warn(
`%c[svelte] invalid_csp\n%c\`csp.nonce\` was set while \`csp.hash\` was \`true\`. These options cannot be used simultaneously.
\`nonce\` will be used.\nhttps://svelte.dev/e/invalid_csp`,
bold,
normal
);
} else {
console.warn(`https://svelte.dev/e/invalid_csp`);
}
}
/**
* A `hydratable` value with key `%key%` was created, but at least part of it was not used during the render.
*

@ -3,5 +3,5 @@ import { test } from '../../test';
export default test({
mode: ['async'],
csp: { hash: true, nonce: 'test-nonce' },
script_hashes: []
error: 'invalid_csp'
});
Loading…
Cancel
Save