|
|
@ -37,6 +37,7 @@ const regex_valid_identifier = /^[a-zA-Z_$][a-zA-Z_$0-9]*$/;
|
|
|
|
const regex_starts_with_lowercase_character = /^[a-z]/;
|
|
|
|
const regex_starts_with_lowercase_character = /^[a-z]/;
|
|
|
|
|
|
|
|
|
|
|
|
let warned_of_format = false;
|
|
|
|
let warned_of_format = false;
|
|
|
|
|
|
|
|
let warned_boolean_css = false;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* @param {import('../interfaces.js').CompileOptions} options
|
|
|
|
* @param {import('../interfaces.js').CompileOptions} options
|
|
|
@ -86,23 +87,23 @@ function validate_options(options, warnings) {
|
|
|
|
toString: () => message
|
|
|
|
toString: () => message
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (valid_css_values.indexOf(css) === -1) {
|
|
|
|
|
|
|
|
throw new Error(
|
|
|
|
|
|
|
|
`options.css must be true, false, 'injected', 'external', or 'none' (got '${css}')`
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (css === true || css === false) {
|
|
|
|
if (css === true || css === false) {
|
|
|
|
options.css = css === true ? 'injected' : 'external';
|
|
|
|
options.css = css === true ? 'injected' : 'external';
|
|
|
|
// possibly show this warning once we decided how Svelte 4 looks like
|
|
|
|
if (!warned_boolean_css) {
|
|
|
|
// const message = `options.css as a boolean is deprecated. Use '${options.css}' instead of ${css}.`;
|
|
|
|
console.warn(
|
|
|
|
// warnings.push({
|
|
|
|
`compilerOptions.css as a boolean is deprecated. Use '${options.css}' instead of ${css}.`
|
|
|
|
// code: 'options-css-boolean-deprecated',
|
|
|
|
);
|
|
|
|
// message,
|
|
|
|
warned_boolean_css = true;
|
|
|
|
// filename,
|
|
|
|
}
|
|
|
|
// toString: () => message
|
|
|
|
}
|
|
|
|
// });
|
|
|
|
|
|
|
|
// }
|
|
|
|
if (!valid_css_values.includes(options.css)) {
|
|
|
|
|
|
|
|
throw new Error(
|
|
|
|
|
|
|
|
`compilerOptions.css must be 'injected', 'external' or 'none' (got '${options.css}').`
|
|
|
|
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (namespace && valid_namespaces.indexOf(namespace) === -1) {
|
|
|
|
if (namespace && valid_namespaces.indexOf(namespace) === -1) {
|
|
|
|
const match = fuzzymatch(namespace, valid_namespaces);
|
|
|
|
const match = fuzzymatch(namespace, valid_namespaces);
|
|
|
|
if (match) {
|
|
|
|
if (match) {
|
|
|
|