Skip to content

Commit 7dbce96

Browse files
committed
Revert "feat: implicit Table and Memory"
This reverts commit baea536.
1 parent 0ef8c12 commit 7dbce96

7 files changed

Lines changed: 10 additions & 72 deletions

File tree

lib/BaseWasmMainTemplatePlugin.js

Lines changed: 10 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -50,58 +50,24 @@ function generateImportObject(module) {
5050
for (const pair of depsByRequest) {
5151
const properties = [];
5252
for (const data of pair[1]) {
53+
let params = "";
54+
let result = "void 0";
55+
5356
if (data.description.type === "FuncImportDescr") {
54-
const params = data.description.params.map(
57+
params = data.description.params.map(
5558
(param, k) => "p" + k + param.valtype
5659
);
5760

58-
const result = `__webpack_require__(${JSON.stringify(
61+
result = `__webpack_require__(${JSON.stringify(
5962
data.module.id
6063
)})[${JSON.stringify(data.usedName)}](${params})`;
61-
62-
properties.push(
63-
`\n\t\t${JSON.stringify(data.exportName)}: function(${params}) {
64-
return ${result};
65-
}`
66-
);
67-
}
68-
69-
if (data.description.type === "Memory") {
70-
const { min, max } = data.description.limits;
71-
72-
const params = {
73-
initial: min
74-
};
75-
76-
if (typeof max === "number") {
77-
params.maximum = max;
78-
}
79-
80-
properties.push(
81-
`\n\t\t${JSON.stringify(
82-
data.exportName
83-
)}: new WebAssembly.Memory(${JSON.stringify(params)})`
84-
);
8564
}
8665

87-
if (data.description.type === "Table") {
88-
const { min, max } = data.description.limits;
89-
90-
const params = {
91-
element: data.description.elementType,
92-
initial: min
93-
};
94-
95-
if (typeof max === "number") {
96-
params.maximum = max;
97-
}
98-
99-
properties.push(
100-
`\n\t\t${JSON.stringify(
101-
data.exportName
102-
)}: new WebAssembly.Table(${JSON.stringify(params)})`
103-
);
104-
}
66+
properties.push(
67+
`\n\t\t${JSON.stringify(data.exportName)}: function(${params}) {
68+
return ${result};
69+
}`
70+
);
10571
}
10672

10773
importsCode.push(

test/cases/wasm/import-memory/env.js

Lines changed: 0 additions & 1 deletion
This file was deleted.

test/cases/wasm/import-memory/index.js

Lines changed: 0 additions & 11 deletions
This file was deleted.
-68 Bytes
Binary file not shown.

test/cases/wasm/import-table/env.js

Lines changed: 0 additions & 1 deletion
This file was deleted.

test/cases/wasm/import-table/index.js

Lines changed: 0 additions & 15 deletions
This file was deleted.
-71 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)