chore: move `remove_typescript_nodes` in the same place as the rest

pull/16001/head
paoloricciuti 4 months ago
parent e8267f494f
commit 0dc08f5fab

@ -43,6 +43,11 @@ export function compile(source, options) {
instance: parsed.instance && remove_typescript_nodes(parsed.instance), instance: parsed.instance && remove_typescript_nodes(parsed.instance),
module: parsed.module && remove_typescript_nodes(parsed.module) module: parsed.module && remove_typescript_nodes(parsed.module)
}; };
if (combined_options.customElementOptions?.extend) {
combined_options.customElementOptions.extend = remove_typescript_nodes(
combined_options.customElementOptions?.extend
);
}
} }
const analysis = analyze_component(parsed, source, combined_options); const analysis = analyze_component(parsed, source, combined_options);

@ -143,7 +143,7 @@ export class Parser {
if (options_index !== -1) { if (options_index !== -1) {
const options = /** @type {AST.SvelteOptionsRaw} */ (this.root.fragment.nodes[options_index]); const options = /** @type {AST.SvelteOptionsRaw} */ (this.root.fragment.nodes[options_index]);
this.root.fragment.nodes.splice(options_index, 1); this.root.fragment.nodes.splice(options_index, 1);
this.root.options = read_options(options, this.ts); this.root.options = read_options(options);
disallow_children(options); disallow_children(options);

@ -2,14 +2,12 @@
/** @import { AST } from '#compiler' */ /** @import { AST } from '#compiler' */
import { NAMESPACE_MATHML, NAMESPACE_SVG } from '../../../../constants.js'; import { NAMESPACE_MATHML, NAMESPACE_SVG } from '../../../../constants.js';
import * as e from '../../../errors.js'; import * as e from '../../../errors.js';
import { remove_typescript_nodes } from '../remove_typescript_nodes.js';
/** /**
* @param {AST.SvelteOptionsRaw} node * @param {AST.SvelteOptionsRaw} node
* @param {boolean} ts
* @returns {AST.Root['options']} * @returns {AST.Root['options']}
*/ */
export default function read_options(node, ts) { export default function read_options(node) {
/** @type {AST.SvelteOptions} */ /** @type {AST.SvelteOptions} */
const component_options = { const component_options = {
start: node.start, start: node.start,
@ -144,7 +142,7 @@ export default function read_options(node, ts) {
const extend = properties.find(([name]) => name === 'extend')?.[1]; const extend = properties.find(([name]) => name === 'extend')?.[1];
if (extend) { if (extend) {
ce.extend = ts ? remove_typescript_nodes(extend) : extend; ce.extend = extend;
} }
component_options.customElement = ce; component_options.customElement = ce;

Loading…
Cancel
Save