esrap 1.4.6 → 1.4.7

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/handlers.js +22 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "esrap",
3
- "version": "1.4.6",
3
+ "version": "1.4.7",
4
4
  "description": "Parse in reverse",
5
5
  "repository": {
6
6
  "type": "git",
package/src/handlers.js CHANGED
@@ -1165,12 +1165,34 @@ const handlers = {
1165
1165
 
1166
1166
  state.commands.push(' from ');
1167
1167
  handle(node.source, state);
1168
+ if (node.attributes) {
1169
+ state.commands.push(' with { ');
1170
+ for (let index = 0; index < node.attributes.length; index++) {
1171
+ const { key, value } = node.attributes[index];
1172
+ handle(key, state);
1173
+ state.commands.push(': ');
1174
+ handle(value, state);
1175
+ if (index + 1 !== node.attributes.length) {
1176
+ state.commands.push(', ');
1177
+ }
1178
+ }
1179
+ state.commands.push(' }');
1180
+ }
1168
1181
  state.commands.push(';');
1169
1182
  },
1170
1183
 
1171
1184
  ImportExpression(node, state) {
1172
1185
  state.commands.push('import(');
1173
1186
  handle(node.source, state);
1187
+ //@ts-expect-error for some reason the types haven't been updated
1188
+ if (node.arguments) {
1189
+ //@ts-expect-error
1190
+ for (let index = 0; index < node.arguments.length; index++) {
1191
+ state.commands.push(', ');
1192
+ //@ts-expect-error
1193
+ handle(node.arguments[index], state);
1194
+ }
1195
+ }
1174
1196
  state.commands.push(')');
1175
1197
  },
1176
1198