rolldown-plugin-concurrent-top-level-await 0.2.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.mjs +8 -4
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -66,12 +66,16 @@ function awaitEntrypointsPlugin(options) {
|
|
|
66
66
|
if (id.startsWith(proxyPrefix)) {
|
|
67
67
|
const resolved = awaitedEntriesMap.get(id.slice(proxyPrefix.length));
|
|
68
68
|
if (!resolved) throw new Error("Name collision in concurrent-tla plugin, please change the generatedVariablePrefix option");
|
|
69
|
-
|
|
69
|
+
const module = await this.load(resolved);
|
|
70
|
+
let code = "";
|
|
71
|
+
if (module.meta[generatedVariablePrefix + "_async"]) code += `import { ${generatedVariablePrefix}_access } from "${resolved.id}";
|
|
70
72
|
await new Promise(${generatedVariablePrefix}_access);
|
|
71
|
-
export * from "${resolved.id}";
|
|
72
73
|
`;
|
|
73
|
-
|
|
74
|
+
if (module.exports.includes("default")) code += `import ${generatedVariablePrefix}_default from "${resolved.id}";
|
|
75
|
+
export default ${generatedVariablePrefix}_default;
|
|
74
76
|
`;
|
|
77
|
+
code += `export * from "${resolved.id}";\n`;
|
|
78
|
+
return code;
|
|
75
79
|
}
|
|
76
80
|
}
|
|
77
81
|
}
|
|
@@ -362,7 +366,7 @@ function isFunctionDeclaration(type) {
|
|
|
362
366
|
return type === "FunctionDeclaration";
|
|
363
367
|
}
|
|
364
368
|
function getClassDeclarationStart(node) {
|
|
365
|
-
return node.decorators[0]?.start ?? node.start;
|
|
369
|
+
return node.decorators?.[0]?.start ?? node.start;
|
|
366
370
|
}
|
|
367
371
|
function moveVariableDeclarationToModuleScope(s, node, declarationsEnd) {
|
|
368
372
|
const kind = replaceConstWithLet(node.kind);
|
package/package.json
CHANGED