mirror of
https://github.com/morluto/rea.git
synced 2026-11-11 01:13:39 +00:00
fix(javascript): bind bundle exports and mutations to factory roles
This commit is contained in:
1 parent
1998640669
commit
5cbcd58550
7 files changed
+234
-62
No files matched your search
@@ -256,15 +256,29 @@ const recoverBundlerModule = (
|
||||
if (key.startsWith("[computed@") || key.startsWith("[unknown@"))
|
||||
accumulator.unknownFindings += 1;
|
||||
const fingerprint = fingerprintJavaScriptAst(factory);
|
||||
const exportsParameter =
|
||||
runtimeFunctionParameters(factory)[runtime === "esbuild-commonjs" ? 0 : 1];
|
||||
const exportsValue = collectJavaScriptExports(
|
||||
factory,
|
||||
bindings,
|
||||
t.isIdentifier(exportsParameter) ? exportsParameter : undefined,
|
||||
);
|
||||
const requireName = factoryRequireName(factory);
|
||||
const requireParameter = runtimeFunctionParameters(factory)[2];
|
||||
const parameters = runtimeFunctionParameters(factory);
|
||||
const esbuild = runtime.startsWith("esbuild-");
|
||||
const identifierAt = (index: number): t.Identifier | undefined => {
|
||||
const parameter = parameters[index];
|
||||
return t.isIdentifier(parameter) ? parameter : undefined;
|
||||
};
|
||||
const exportsValue = collectJavaScriptExports(factory, bindings, {
|
||||
exports:
|
||||
runtime === "esbuild-commonjs"
|
||||
? identifierAt(0)
|
||||
: esbuild
|
||||
? undefined
|
||||
: identifierAt(1),
|
||||
module:
|
||||
runtime === "esbuild-commonjs"
|
||||
? identifierAt(1)
|
||||
: esbuild
|
||||
? undefined
|
||||
: identifierAt(0),
|
||||
loader: esbuild ? undefined : identifierAt(2),
|
||||
});
|
||||
const requireName = esbuild ? null : factoryRequireName(factory);
|
||||
const requireParameter = esbuild ? undefined : parameters[2];
|
||||
const requireBindingId = t.isIdentifier(requireParameter)
|
||||
? (resolveSemanticBindingState(
|
||||
bindings,
|
||||
|
||||
Reference in new issue
Block a user