pull/14290/head
Dominic Gannaway 2 years ago
parent e8997c37b7
commit 6ac0779fa3

@ -134,16 +134,14 @@ const visitors = {
/**
* @param {ComponentAnalysis} analysis
* @param {string} source
* @param {ValidatedCompileOptions} options
* @returns {ESTree.Program}
*/
export function client_component(analysis, source, options) {
export function client_component(analysis, options) {
/** @type {ComponentClientTransformState} */
const state = {
analysis,
options,
source: source.split('\n'),
scope: analysis.module.scope,
scopes: analysis.module.scopes,
is_instance: false,
@ -165,7 +163,6 @@ export function client_component(analysis, source, options) {
private_state: new Map(),
transform: {},
in_constructor: false,
trace_dependencies: false,
// these are set inside the `Fragment` visitor, and cannot be used until then
before_init: /** @type {any} */ (null),
@ -646,23 +643,20 @@ export function client_component(analysis, source, options) {
/**
* @param {Analysis} analysis
* @param {string} source
* @param {ValidatedModuleCompileOptions} options
* @returns {ESTree.Program}
*/
export function client_module(analysis, source, options) {
export function client_module(analysis, options) {
/** @type {ClientTransformState} */
const state = {
analysis,
options,
source: source.split('\n'),
scope: analysis.module.scope,
scopes: analysis.module.scopes,
public_state: new Map(),
private_state: new Map(),
transform: {},
in_constructor: false,
trace_dependencies: false
in_constructor: false
};
const module = /** @type {ESTree.Program} */ (

@ -23,10 +23,6 @@ export interface ClientTransformState extends TransformState {
*/
readonly in_constructor: boolean;
readonly source: string[];
readonly trace_dependencies: boolean;
readonly transform: Record<
string,
{

@ -16,16 +16,7 @@ export function BlockStatement(node, context) {
b.return(
b.call(
'$.trace',
b.thunk(
b.block(
node.body.map(
(n) =>
/** @type {Statement} */ (
context.visit(n, { ...context.state, trace_dependencies: true })
)
)
)
),
b.thunk(b.block(node.body.map((n) => /** @type {Statement} */ (context.visit(n))))),
b.literal(tracing)
)
)

@ -30,7 +30,7 @@ export function transform_component(analysis, source, options) {
const program =
options.generate === 'server'
? server_component(analysis, options)
: client_component(analysis, source, options);
: client_component(analysis, options);
const js_source_name = get_source_name(options.filename, options.outputFilename, 'input.svelte');
const js = print(program, {
@ -79,7 +79,7 @@ export function transform_module(analysis, source, options) {
const program =
options.generate === 'server'
? server_module(analysis, options)
: client_module(analysis, source, options);
: client_module(analysis, options);
const basename = options.filename.split(/[/\\]/).at(-1);
if (program.body.length > 0) {

Loading…
Cancel
Save