Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// Writing to a captured local only mutates the hoisted action's bound
// parameter copy, not the original outer binding.
function Counter() {
let local = 0

async function updateLocal() {
'use server'
local = 1
}

return 'something'
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// Writing to a captured local only mutates the hoisted action's bound
// parameter copy, not the original outer binding.
function Counter() {
let local = 0

const updateLocal = /* #__PURE__ */ $$register($$hoist_0_updateLocal, "<id>", "$$hoist_0_updateLocal").bind(null, __enc([local]));

return 'something'
}

;export async function $$hoist_0_updateLocal($$hoist_encoded) {
const [local] = __dec($$hoist_encoded);
'use server'
local = 1
};
/* #__PURE__ */ Object.defineProperty($$hoist_0_updateLocal, "name", { value: "updateLocal" });
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// Writing to a captured local only mutates the hoisted action's bound
// parameter copy, not the original outer binding.
function Counter() {
let local = 0

const updateLocal = /* #__PURE__ */ $$register($$hoist_0_updateLocal, "<id>", "$$hoist_0_updateLocal").bind(null, local);

return 'something'
}

;export async function $$hoist_0_updateLocal(local) {
'use server'
local = 1
};
/* #__PURE__ */ Object.defineProperty($$hoist_0_updateLocal, "name", { value: "updateLocal" });
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// Mutating a captured local is local to the hoisted invocation copy.
function Counter() {
let local = 0

async function updateLocal() {
'use server'
local++
}

return 'something'
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// Mutating a captured local is local to the hoisted invocation copy.
function Counter() {
let local = 0

const updateLocal = /* #__PURE__ */ $$register($$hoist_0_updateLocal, "<id>", "$$hoist_0_updateLocal").bind(null, __enc([local]));

return 'something'
}

;export async function $$hoist_0_updateLocal($$hoist_encoded) {
const [local] = __dec($$hoist_encoded);
'use server'
local++
};
/* #__PURE__ */ Object.defineProperty($$hoist_0_updateLocal, "name", { value: "updateLocal" });
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// Mutating a captured local is local to the hoisted invocation copy.
function Counter() {
let local = 0

const updateLocal = /* #__PURE__ */ $$register($$hoist_0_updateLocal, "<id>", "$$hoist_0_updateLocal").bind(null, local);

return 'something'
}

;export async function $$hoist_0_updateLocal(local) {
'use server'
local++
};
/* #__PURE__ */ Object.defineProperty($$hoist_0_updateLocal, "name", { value: "updateLocal" });
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
function outer(config, err) {
async function action() {
'use server'
try {
return config.value
} catch (err) {
return err.message
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
function outer(config, err) {
const action = /* #__PURE__ */ $$register($$hoist_0_action, "<id>", "$$hoist_0_action").bind(null, __enc([{ value: config.value }]));
}

;export async function $$hoist_0_action($$hoist_encoded) {
const [config] = __dec($$hoist_encoded);
'use server'
try {
return config.value
} catch (err) {
return err.message
}
};
/* #__PURE__ */ Object.defineProperty($$hoist_0_action, "name", { value: "action" });
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
function outer(config, err) {
const action = /* #__PURE__ */ $$register($$hoist_0_action, "<id>", "$$hoist_0_action").bind(null, { value: config.value });
}

;export async function $$hoist_0_action(config) {
'use server'
try {
return config.value
} catch (err) {
return err.message
}
};
/* #__PURE__ */ Object.defineProperty($$hoist_0_action, "name", { value: "action" });
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
function outer(config) {
async function action() {
'use server'
class Helper {
run() {
return config.value
}
}
return new Helper().run()
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
function outer(config) {
const action = /* #__PURE__ */ $$register($$hoist_0_action, "<id>", "$$hoist_0_action").bind(null, __enc([{ value: config.value }]));
}

;export async function $$hoist_0_action($$hoist_encoded) {
const [config] = __dec($$hoist_encoded);
'use server'
class Helper {
run() {
return config.value
}
}
return new Helper().run()
};
/* #__PURE__ */ Object.defineProperty($$hoist_0_action, "name", { value: "action" });
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
function outer(config) {
const action = /* #__PURE__ */ $$register($$hoist_0_action, "<id>", "$$hoist_0_action").bind(null, { value: config.value });
}

;export async function $$hoist_0_action(config) {
'use server'
class Helper {
run() {
return config.value
}
}
return new Helper().run()
};
/* #__PURE__ */ Object.defineProperty($$hoist_0_action, "name", { value: "action" });
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
function outer() {
const key = 'value'
async function action(data) {
'use server'
const { [key]: val } = data
return val
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
function outer() {
const key = 'value'
const action = /* #__PURE__ */ $$register($$hoist_0_action, "<id>", "$$hoist_0_action").bind(null, __enc([key]));
}

;export async function $$hoist_0_action($$hoist_encoded, data) {
const [key] = __dec($$hoist_encoded);
'use server'
const { [key]: val } = data
return val
};
/* #__PURE__ */ Object.defineProperty($$hoist_0_action, "name", { value: "action" });
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
function outer() {
const key = 'value'
const action = /* #__PURE__ */ $$register($$hoist_0_action, "<id>", "$$hoist_0_action").bind(null, key);
}

;export async function $$hoist_0_action(key, data) {
'use server'
const { [key]: val } = data
return val
};
/* #__PURE__ */ Object.defineProperty($$hoist_0_action, "name", { value: "action" });
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
function outer(outerDefault) {
async function action({ x = outerDefault } = {}) {
'use server'
return x
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
function outer(outerDefault) {
const action = /* #__PURE__ */ $$register($$hoist_0_action, "<id>", "$$hoist_0_action").bind(null, __enc([outerDefault]));
}

;export async function $$hoist_0_action($$hoist_encoded, { x = outerDefault } = {}) {
const [outerDefault] = __dec($$hoist_encoded);
'use server'
return x
};
/* #__PURE__ */ Object.defineProperty($$hoist_0_action, "name", { value: "action" });
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
function outer(outerDefault) {
const action = /* #__PURE__ */ $$register($$hoist_0_action, "<id>", "$$hoist_0_action").bind(null, outerDefault);
}

;export async function $$hoist_0_action(outerDefault, { x = outerDefault } = {}) {
'use server'
return x
};
/* #__PURE__ */ Object.defineProperty($$hoist_0_action, "name", { value: "action" });
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// TODO: follow up if this edge case matters.
// The current transform self-binds `action`, which is suspicious enough to
// keep as an intentionally verified TODO fixture for now.
function outer() {
async function action() {
'use server'
if (false) {
return action()
}
return 0
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// TODO: follow up if this edge case matters.
// The current transform self-binds `action`, which is suspicious enough to
// keep as an intentionally verified TODO fixture for now.
function outer() {
const action = /* #__PURE__ */ $$register($$hoist_0_action, "<id>", "$$hoist_0_action").bind(null, __enc([action]));
}

;export async function $$hoist_0_action($$hoist_encoded) {
const [action] = __dec($$hoist_encoded);
'use server'
if (false) {
return action()
}
return 0
};
/* #__PURE__ */ Object.defineProperty($$hoist_0_action, "name", { value: "action" });
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// TODO: follow up if this edge case matters.
// The current transform self-binds `action`, which is suspicious enough to
// keep as an intentionally verified TODO fixture for now.
function outer() {
const action = /* #__PURE__ */ $$register($$hoist_0_action, "<id>", "$$hoist_0_action").bind(null, action);
}

;export async function $$hoist_0_action(action) {
'use server'
if (false) {
return action()
}
return 0
};
/* #__PURE__ */ Object.defineProperty($$hoist_0_action, "name", { value: "action" });
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
function outer(outerList) {
async function action() {
'use server'
for (const item of outerList) {
process(item)
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
function outer(outerList) {
const action = /* #__PURE__ */ $$register($$hoist_0_action, "<id>", "$$hoist_0_action").bind(null, __enc([outerList]));
}

;export async function $$hoist_0_action($$hoist_encoded) {
const [outerList] = __dec($$hoist_encoded);
'use server'
for (const item of outerList) {
process(item)
}
};
/* #__PURE__ */ Object.defineProperty($$hoist_0_action, "name", { value: "action" });
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
function outer(outerList) {
const action = /* #__PURE__ */ $$register($$hoist_0_action, "<id>", "$$hoist_0_action").bind(null, outerList);
}

;export async function $$hoist_0_action(outerList) {
'use server'
for (const item of outerList) {
process(item)
}
};
/* #__PURE__ */ Object.defineProperty($$hoist_0_action, "name", { value: "action" });
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
function outer() {
const value = 0
async function action() {
'use server'
console.log({ value })
{
function value() {}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
function outer() {
const value = 0
const action = /* #__PURE__ */ $$register($$hoist_0_action, "<id>", "$$hoist_0_action").bind(null, __enc([value]));
}

;export async function $$hoist_0_action($$hoist_encoded) {
const [value] = __dec($$hoist_encoded);
'use server'
console.log({ value })
{
function value() {}
}
};
/* #__PURE__ */ Object.defineProperty($$hoist_0_action, "name", { value: "action" });
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
function outer() {
const value = 0
const action = /* #__PURE__ */ $$register($$hoist_0_action, "<id>", "$$hoist_0_action").bind(null, value);
}

;export async function $$hoist_0_action(value) {
'use server'
console.log({ value })
{
function value() {}
}
};
/* #__PURE__ */ Object.defineProperty($$hoist_0_action, "name", { value: "action" });
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
function outer() {
const value = 0
async function action() {
'use server'
console.log({ value })
function value() {}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
function outer() {
const value = 0
const action = /* #__PURE__ */ $$register($$hoist_0_action, "<id>", "$$hoist_0_action");
}

;export async function $$hoist_0_action() {
'use server'
console.log({ value })
function value() {}
};
/* #__PURE__ */ Object.defineProperty($$hoist_0_action, "name", { value: "action" });
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
function outer() {
const value = 0
const action = /* #__PURE__ */ $$register($$hoist_0_action, "<id>", "$$hoist_0_action");
}

;export async function $$hoist_0_action() {
'use server'
console.log({ value })
function value() {}
};
/* #__PURE__ */ Object.defineProperty($$hoist_0_action, "name", { value: "action" });
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
function outer() {
const x = {}
const action = /* #__PURE__ */ $$register($$hoist_0_action, "<id>", "$$hoist_0_action").bind(null, __enc([{ y: x.y }]));
}

;export async function $$hoist_0_action($$hoist_encoded) {
const [x] = __dec($$hoist_encoded);
'use server'
return x.y.fn()
};
/* #__PURE__ */ Object.defineProperty($$hoist_0_action, "name", { value: "action" });
Loading
Loading