@cyclonedx/cdxgen 12.2.0 → 12.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.
Files changed (34) hide show
  1. package/README.md +5 -2
  2. package/bin/cdxgen.js +19 -1
  3. package/lib/cli/index.js +122 -57
  4. package/lib/cli/index.poku.js +117 -0
  5. package/lib/helpers/analyzer.js +606 -3
  6. package/lib/helpers/analyzer.poku.js +230 -0
  7. package/lib/helpers/depsUtils.js +16 -0
  8. package/lib/helpers/depsUtils.poku.js +58 -1
  9. package/lib/helpers/display.js +4 -2
  10. package/lib/helpers/remote/dependency-track.js +84 -0
  11. package/lib/helpers/remote/dependency-track.poku.js +119 -0
  12. package/lib/helpers/table.js +384 -0
  13. package/lib/helpers/table.poku.js +186 -0
  14. package/lib/helpers/utils.js +184 -10
  15. package/lib/helpers/utils.poku.js +118 -11
  16. package/lib/server/openapi.yaml +33 -0
  17. package/lib/server/server.js +10 -2
  18. package/lib/server/server.poku.js +209 -0
  19. package/lib/stages/postgen/auditBom.js +1 -2
  20. package/lib/validator/reporters/console.js +2 -2
  21. package/package.json +1 -2
  22. package/types/lib/cli/index.d.ts.map +1 -1
  23. package/types/lib/helpers/analyzer.d.ts.map +1 -1
  24. package/types/lib/helpers/depsUtils.d.ts.map +1 -1
  25. package/types/lib/helpers/display.d.ts.map +1 -1
  26. package/types/lib/helpers/remote/dependency-track.d.ts +16 -0
  27. package/types/lib/helpers/remote/dependency-track.d.ts.map +1 -0
  28. package/types/lib/helpers/table.d.ts +6 -0
  29. package/types/lib/helpers/table.d.ts.map +1 -0
  30. package/types/lib/helpers/utils.d.ts +1 -0
  31. package/types/lib/helpers/utils.d.ts.map +1 -1
  32. package/types/lib/server/server.d.ts +1 -0
  33. package/types/lib/server/server.d.ts.map +1 -1
  34. package/types/lib/stages/postgen/auditBom.d.ts.map +1 -1
@@ -145,8 +145,8 @@ const setFileRef = (
145
145
  exportedModules,
146
146
  isExternal: true,
147
147
  fileName: fileRelativeLoc,
148
- lineNumber: sourceLoc?.line ? sourceLoc.line : undefined,
149
- columnNumber: sourceLoc?.column ? sourceLoc.column : undefined,
148
+ lineNumber: sourceLoc?.line ?? undefined,
149
+ columnNumber: sourceLoc?.column ?? undefined,
150
150
  };
151
151
  // replace relative imports with full path
152
152
  let moduleFullPath = pathway;
@@ -186,7 +186,7 @@ const setFileRef = (
186
186
  const vueCleaningRegex = /<\/*script.*>|<style[\s\S]*style>|<\/*br>/gi;
187
187
  const vueTemplateRegex = /(<template.*>)([\s\S]*)(<\/template>)/gi;
188
188
  const vueCommentRegex = /<!--[\s\S]*?-->/gi;
189
- const vueBindRegex = /(:\[)([\s\S]*?)(\])/gi;
189
+ const vueBindRegex = /(:\[)([\s\S]*?)(])/gi;
190
190
  const vuePropRegex = /\s([.:@])([a-zA-Z]*?=)/gi;
191
191
 
192
192
  const fileToParseableCode = (file) => {
@@ -216,12 +216,252 @@ const fileToParseableCode = (file) => {
216
216
  return code;
217
217
  };
218
218
 
219
+ const isWasmPath = (modulePath) =>
220
+ typeof modulePath === "string" && /\.wasm([?#].*)?$/i.test(modulePath);
221
+
222
+ const getStringValue = (astNode) => {
223
+ if (!astNode) {
224
+ return undefined;
225
+ }
226
+ if (astNode.type === "StringLiteral") {
227
+ return astNode.value;
228
+ }
229
+ if (
230
+ astNode.type === "TemplateLiteral" &&
231
+ astNode.expressions.length === 0 &&
232
+ astNode.quasis.length === 1
233
+ ) {
234
+ return astNode.quasis[0].value.cooked;
235
+ }
236
+ return undefined;
237
+ };
238
+
239
+ const unwrapAwait = (astNode) =>
240
+ astNode?.type === "AwaitExpression" ? astNode.argument : astNode;
241
+
242
+ const isImportMetaUrl = (astNode) =>
243
+ astNode?.type === "MemberExpression" &&
244
+ astNode.object?.type === "MetaProperty" &&
245
+ astNode.object.meta?.name === "import" &&
246
+ astNode.object.property?.name === "meta" &&
247
+ astNode.property?.type === "Identifier" &&
248
+ astNode.property.name === "url";
249
+
250
+ const getMemberExpressionPropertyName = (propertyNode) => {
251
+ if (!propertyNode) {
252
+ return undefined;
253
+ }
254
+ if (propertyNode.type === "Identifier") {
255
+ return propertyNode.name;
256
+ }
257
+ if (propertyNode.type === "StringLiteral") {
258
+ return propertyNode.value;
259
+ }
260
+ return undefined;
261
+ };
262
+
263
+ const resolveWasmLiteralFromNode = (astNode, wasmBufferByVarName) => {
264
+ const normalizedNode = unwrapAwait(astNode);
265
+ const directLiteral = getStringValue(normalizedNode);
266
+ if (isWasmPath(directLiteral)) {
267
+ return directLiteral;
268
+ }
269
+ if (normalizedNode?.type === "Identifier") {
270
+ return wasmBufferByVarName.get(normalizedNode.name);
271
+ }
272
+ if (normalizedNode?.type === "CallExpression") {
273
+ if (
274
+ normalizedNode.callee?.type === "Identifier" &&
275
+ normalizedNode.callee.name === "fetch" &&
276
+ normalizedNode.arguments?.length
277
+ ) {
278
+ return resolveWasmLiteralFromNode(
279
+ normalizedNode.arguments[0],
280
+ wasmBufferByVarName,
281
+ );
282
+ }
283
+ }
284
+ if (normalizedNode?.type === "NewExpression") {
285
+ if (
286
+ normalizedNode.callee?.type === "Identifier" &&
287
+ normalizedNode.callee.name === "URL" &&
288
+ normalizedNode.arguments?.length
289
+ ) {
290
+ const urlLiteral = getStringValue(normalizedNode.arguments[0]);
291
+ const baseArg = normalizedNode.arguments[1];
292
+ if (isWasmPath(urlLiteral) && (!baseArg || isImportMetaUrl(baseArg))) {
293
+ return urlLiteral;
294
+ }
295
+ }
296
+ }
297
+ return undefined;
298
+ };
299
+
300
+ const getWasmSourceFromInstantiateCall = (callNode, wasmBufferByVarName) => {
301
+ if (!callNode?.callee || callNode.callee.type !== "MemberExpression") {
302
+ return undefined;
303
+ }
304
+ const objectNode = callNode.callee.object;
305
+ const propertyNode = callNode.callee.property;
306
+ const calleeObjectName = getMemberExpressionPropertyName(objectNode);
307
+ const calleePropertyName = getMemberExpressionPropertyName(propertyNode);
308
+ if (calleeObjectName !== "WebAssembly") {
309
+ return undefined;
310
+ }
311
+ if (
312
+ calleePropertyName !== "instantiate" &&
313
+ calleePropertyName !== "instantiateStreaming" &&
314
+ calleePropertyName !== "compile" &&
315
+ calleePropertyName !== "compileStreaming"
316
+ ) {
317
+ return undefined;
318
+ }
319
+ if (!callNode.arguments?.length) {
320
+ return undefined;
321
+ }
322
+ return resolveWasmLiteralFromNode(callNode.arguments[0], wasmBufferByVarName);
323
+ };
324
+
325
+ const getWasmSourceFromCallExpression = (callNode, wasmBufferByVarName) => {
326
+ const wasmSourceFromInstantiate = getWasmSourceFromInstantiateCall(
327
+ callNode,
328
+ wasmBufferByVarName,
329
+ );
330
+ if (wasmSourceFromInstantiate) {
331
+ return wasmSourceFromInstantiate;
332
+ }
333
+ if (
334
+ callNode?.callee?.type === "Identifier" &&
335
+ ["fetch", "locateFile"].includes(callNode.callee.name) &&
336
+ callNode.arguments?.length
337
+ ) {
338
+ return resolveWasmLiteralFromNode(
339
+ callNode.arguments[0],
340
+ wasmBufferByVarName,
341
+ );
342
+ }
343
+ return undefined;
344
+ };
345
+
346
+ const getNamedImportsFromObjectPattern = (idNode) => {
347
+ const namedImports = [];
348
+ if (!idNode || idNode.type !== "ObjectPattern") {
349
+ return namedImports;
350
+ }
351
+ for (const prop of idNode.properties || []) {
352
+ if (prop.type !== "ObjectProperty") {
353
+ continue;
354
+ }
355
+ const keyName = getMemberExpressionPropertyName(prop.key);
356
+ if (keyName) {
357
+ namedImports.push(keyName);
358
+ }
359
+ }
360
+ return namedImports;
361
+ };
362
+
363
+ const setSyntheticImportRef = (
364
+ allImports,
365
+ allExports,
366
+ src,
367
+ file,
368
+ importPath,
369
+ modules,
370
+ sourceLoc,
371
+ ) => {
372
+ if (!importPath) {
373
+ return;
374
+ }
375
+ const safeModules = modules || [];
376
+ const syntheticSpecifiers = safeModules.map((moduleName) => ({
377
+ imported: { name: moduleName },
378
+ }));
379
+ setFileRef(
380
+ allImports,
381
+ allExports,
382
+ src,
383
+ file,
384
+ { value: importPath, loc: sourceLoc ? { start: sourceLoc } : undefined },
385
+ syntheticSpecifiers,
386
+ );
387
+ };
388
+
389
+ const setSyntheticExportRef = (
390
+ allImports,
391
+ allExports,
392
+ src,
393
+ file,
394
+ importPath,
395
+ modules,
396
+ sourceLoc,
397
+ ) => {
398
+ if (!importPath) {
399
+ return;
400
+ }
401
+ const safeModules = modules || [];
402
+ const syntheticSpecifiers = safeModules.map((moduleName) => ({
403
+ exported: { name: moduleName },
404
+ }));
405
+ setFileRef(
406
+ allImports,
407
+ allExports,
408
+ src,
409
+ file,
410
+ { value: importPath, loc: sourceLoc ? { start: sourceLoc } : undefined },
411
+ syntheticSpecifiers,
412
+ );
413
+ };
414
+
415
+ const getWasmExportMemberInfo = (astNode) => {
416
+ if (!astNode) {
417
+ return undefined;
418
+ }
419
+ if (astNode.type === "AssignmentExpression") {
420
+ return getWasmExportMemberInfo(astNode.right);
421
+ }
422
+ if (
423
+ astNode.type !== "MemberExpression" ||
424
+ astNode.object?.type !== "Identifier"
425
+ ) {
426
+ return undefined;
427
+ }
428
+ return {
429
+ aliasName: astNode.object.name,
430
+ exportName: getMemberExpressionPropertyName(astNode.property),
431
+ };
432
+ };
433
+
434
+ const getAssignmentTargetName = (astNode) => {
435
+ if (!astNode) {
436
+ return undefined;
437
+ }
438
+ if (astNode.type === "Identifier") {
439
+ return astNode.name;
440
+ }
441
+ if (
442
+ astNode.type === "MemberExpression" &&
443
+ astNode.object?.type === "Identifier" &&
444
+ astNode.object.name === "Module"
445
+ ) {
446
+ return getMemberExpressionPropertyName(astNode.property);
447
+ }
448
+ return undefined;
449
+ };
450
+
219
451
  /**
220
452
  * Check AST tree for any (j|tsx?) files and set a file
221
453
  * references for any import, require or dynamic import files.
222
454
  */
223
455
  const parseFileASTTree = (src, file, allImports, allExports) => {
224
456
  const ast = parse(fileToParseableCode(file), babelParserOptions);
457
+ const wasmBufferByVarName = new Map();
458
+ const wasmResultByVarName = new Map();
459
+ const wasmInstanceByVarName = new Map();
460
+ const wasiConstructorAliases = new Set(["WASI"]);
461
+ const wasiNamespaceAliases = new Set();
462
+ const wasiInstanceAliases = new Set();
463
+ const wasmPathLiterals = new Set();
464
+ const wasmExportAliases = new Set(["wasmExports"]);
225
465
  traverse.default(ast, {
226
466
  ImportDeclaration: (path) => {
227
467
  if (path?.node) {
@@ -233,6 +473,20 @@ const parseFileASTTree = (src, file, allImports, allExports) => {
233
473
  path.node.source,
234
474
  path.node.specifiers,
235
475
  );
476
+ const sourceValue = path.node.source?.value;
477
+ if (sourceValue === "node:wasi" || sourceValue === "wasi") {
478
+ for (const specifier of path.node.specifiers || []) {
479
+ if (
480
+ specifier.type === "ImportSpecifier" &&
481
+ specifier.imported?.name === "WASI"
482
+ ) {
483
+ wasiConstructorAliases.add(specifier.local?.name || "WASI");
484
+ }
485
+ if (specifier.type === "ImportNamespaceSpecifier") {
486
+ wasiNamespaceAliases.add(specifier.local?.name);
487
+ }
488
+ }
489
+ }
236
490
  }
237
491
  },
238
492
  // For require('') statements
@@ -250,6 +504,355 @@ const parseFileASTTree = (src, file, allImports, allExports) => {
250
504
  if (path?.node && path.node.callee.type === "Import") {
251
505
  setFileRef(allImports, allExports, src, file, path.node.arguments[0]);
252
506
  }
507
+ const wasmSourceLiteral = getWasmSourceFromCallExpression(
508
+ path?.node,
509
+ wasmBufferByVarName,
510
+ );
511
+ if (wasmSourceLiteral) {
512
+ wasmPathLiterals.add(wasmSourceLiteral);
513
+ setSyntheticImportRef(
514
+ allImports,
515
+ allExports,
516
+ src,
517
+ file,
518
+ wasmSourceLiteral,
519
+ [],
520
+ path.node.loc?.start,
521
+ );
522
+ }
523
+ if (
524
+ path?.node?.callee?.type === "MemberExpression" &&
525
+ path.node.callee.object?.type === "Identifier" &&
526
+ wasiInstanceAliases.has(path.node.callee.object.name)
527
+ ) {
528
+ const methodName = getMemberExpressionPropertyName(
529
+ path.node.callee.property,
530
+ );
531
+ if (methodName === "start" || methodName === "initialize") {
532
+ setSyntheticImportRef(
533
+ allImports,
534
+ allExports,
535
+ src,
536
+ file,
537
+ "node:wasi",
538
+ [methodName],
539
+ path.node.loc?.start,
540
+ );
541
+ }
542
+ }
543
+ },
544
+ ImportExpression: (path) => {
545
+ if (path?.node?.source) {
546
+ setFileRef(allImports, allExports, src, file, path.node.source);
547
+ }
548
+ },
549
+ VariableDeclarator: (path) => {
550
+ const idNode = path?.node?.id;
551
+ const initNode = unwrapAwait(path?.node?.init);
552
+ if (!idNode || !initNode) {
553
+ return;
554
+ }
555
+ if (
556
+ idNode.type === "Identifier" &&
557
+ initNode.type === "CallExpression" &&
558
+ initNode.callee?.type === "MemberExpression"
559
+ ) {
560
+ const calleePropertyName = getMemberExpressionPropertyName(
561
+ initNode.callee.property,
562
+ );
563
+ if (
564
+ calleePropertyName === "readFile" ||
565
+ calleePropertyName === "readFileSync"
566
+ ) {
567
+ const pathArg = initNode.arguments?.[0];
568
+ const wasmPath = getStringValue(pathArg);
569
+ if (isWasmPath(wasmPath)) {
570
+ wasmBufferByVarName.set(idNode.name, wasmPath);
571
+ wasmPathLiterals.add(wasmPath);
572
+ setSyntheticImportRef(
573
+ allImports,
574
+ allExports,
575
+ src,
576
+ file,
577
+ wasmPath,
578
+ [],
579
+ path.node.loc?.start,
580
+ );
581
+ }
582
+ }
583
+ const wasmSource = getWasmSourceFromInstantiateCall(
584
+ initNode,
585
+ wasmBufferByVarName,
586
+ );
587
+ if (wasmSource) {
588
+ wasmResultByVarName.set(idNode.name, wasmSource);
589
+ wasmPathLiterals.add(wasmSource);
590
+ setSyntheticImportRef(
591
+ allImports,
592
+ allExports,
593
+ src,
594
+ file,
595
+ wasmSource,
596
+ [],
597
+ path.node.loc?.start,
598
+ );
599
+ }
600
+ if (
601
+ initNode.callee?.type === "MemberExpression" &&
602
+ initNode.callee.object?.type === "Identifier" &&
603
+ wasiNamespaceAliases.has(initNode.callee.object.name) &&
604
+ getMemberExpressionPropertyName(initNode.callee.property) === "WASI"
605
+ ) {
606
+ wasiInstanceAliases.add(idNode.name);
607
+ setSyntheticImportRef(
608
+ allImports,
609
+ allExports,
610
+ src,
611
+ file,
612
+ "node:wasi",
613
+ ["WASI"],
614
+ path.node.loc?.start,
615
+ );
616
+ }
617
+ }
618
+ if (
619
+ idNode.type === "Identifier" &&
620
+ initNode.type === "CallExpression" &&
621
+ initNode.callee?.type === "Identifier" &&
622
+ wasiConstructorAliases.has(initNode.callee.name)
623
+ ) {
624
+ wasiInstanceAliases.add(idNode.name);
625
+ setSyntheticImportRef(
626
+ allImports,
627
+ allExports,
628
+ src,
629
+ file,
630
+ "node:wasi",
631
+ ["WASI"],
632
+ path.node.loc?.start,
633
+ );
634
+ }
635
+ if (idNode.type === "Identifier" && initNode.type === "NewExpression") {
636
+ if (
637
+ initNode.callee?.type === "Identifier" &&
638
+ wasiConstructorAliases.has(initNode.callee.name)
639
+ ) {
640
+ wasiInstanceAliases.add(idNode.name);
641
+ setSyntheticImportRef(
642
+ allImports,
643
+ allExports,
644
+ src,
645
+ file,
646
+ "node:wasi",
647
+ ["WASI"],
648
+ path.node.loc?.start,
649
+ );
650
+ }
651
+ if (
652
+ initNode.callee?.type === "MemberExpression" &&
653
+ initNode.callee.object?.type === "Identifier" &&
654
+ wasiNamespaceAliases.has(initNode.callee.object.name) &&
655
+ getMemberExpressionPropertyName(initNode.callee.property) === "WASI"
656
+ ) {
657
+ wasiInstanceAliases.add(idNode.name);
658
+ setSyntheticImportRef(
659
+ allImports,
660
+ allExports,
661
+ src,
662
+ file,
663
+ "node:wasi",
664
+ ["WASI"],
665
+ path.node.loc?.start,
666
+ );
667
+ }
668
+ }
669
+ if (idNode.type === "ObjectPattern") {
670
+ if (initNode.type === "CallExpression") {
671
+ const wasmSource = getWasmSourceFromInstantiateCall(
672
+ initNode,
673
+ wasmBufferByVarName,
674
+ );
675
+ if (wasmSource) {
676
+ wasmPathLiterals.add(wasmSource);
677
+ for (const prop of idNode.properties || []) {
678
+ if (
679
+ prop.type === "ObjectProperty" &&
680
+ getMemberExpressionPropertyName(prop.key) === "instance" &&
681
+ prop.value?.type === "Identifier"
682
+ ) {
683
+ wasmInstanceByVarName.set(prop.value.name, wasmSource);
684
+ }
685
+ }
686
+ setSyntheticImportRef(
687
+ allImports,
688
+ allExports,
689
+ src,
690
+ file,
691
+ wasmSource,
692
+ [],
693
+ path.node.loc?.start,
694
+ );
695
+ }
696
+ if (
697
+ initNode.callee?.type === "Identifier" &&
698
+ initNode.callee.name === "require"
699
+ ) {
700
+ const requiredModule = getStringValue(initNode.arguments?.[0]);
701
+ if (requiredModule === "node:wasi" || requiredModule === "wasi") {
702
+ for (const prop of idNode.properties || []) {
703
+ if (
704
+ prop.type === "ObjectProperty" &&
705
+ getMemberExpressionPropertyName(prop.key) === "WASI" &&
706
+ prop.value?.type === "Identifier"
707
+ ) {
708
+ wasiConstructorAliases.add(prop.value.name);
709
+ }
710
+ }
711
+ }
712
+ }
713
+ }
714
+ if (initNode.type === "MemberExpression") {
715
+ const exportNames = getNamedImportsFromObjectPattern(idNode);
716
+ if (!exportNames.length) {
717
+ return;
718
+ }
719
+ if (
720
+ initNode.object?.type === "MemberExpression" &&
721
+ initNode.object.object?.type === "Identifier" &&
722
+ getMemberExpressionPropertyName(initNode.object.property) ===
723
+ "instance" &&
724
+ getMemberExpressionPropertyName(initNode.property) === "exports"
725
+ ) {
726
+ const wasmSource = wasmResultByVarName.get(
727
+ initNode.object.object.name,
728
+ );
729
+ if (wasmSource) {
730
+ setSyntheticImportRef(
731
+ allImports,
732
+ allExports,
733
+ src,
734
+ file,
735
+ wasmSource,
736
+ exportNames,
737
+ path.node.loc?.start,
738
+ );
739
+ }
740
+ }
741
+ if (
742
+ initNode.object?.type === "Identifier" &&
743
+ getMemberExpressionPropertyName(initNode.property) === "exports"
744
+ ) {
745
+ const wasmSource = wasmInstanceByVarName.get(initNode.object.name);
746
+ if (wasmSource) {
747
+ setSyntheticImportRef(
748
+ allImports,
749
+ allExports,
750
+ src,
751
+ file,
752
+ wasmSource,
753
+ exportNames,
754
+ path.node.loc?.start,
755
+ );
756
+ }
757
+ }
758
+ }
759
+ }
760
+ if (
761
+ idNode.type === "Identifier" &&
762
+ initNode.type === "MemberExpression" &&
763
+ initNode.object?.type === "Identifier" &&
764
+ getMemberExpressionPropertyName(initNode.property) === "instance"
765
+ ) {
766
+ const wasmSource = wasmResultByVarName.get(initNode.object.name);
767
+ if (wasmSource) {
768
+ wasmInstanceByVarName.set(idNode.name, wasmSource);
769
+ }
770
+ }
771
+ if (
772
+ idNode.type === "Identifier" &&
773
+ initNode.type === "CallExpression" &&
774
+ initNode.callee?.type === "MemberExpression" &&
775
+ initNode.callee.object?.type === "Identifier" &&
776
+ initNode.callee.object.name === "WebAssembly"
777
+ ) {
778
+ const wasmSource = getWasmSourceFromInstantiateCall(
779
+ initNode,
780
+ wasmBufferByVarName,
781
+ );
782
+ if (wasmSource) {
783
+ wasmResultByVarName.set(idNode.name, wasmSource);
784
+ wasmPathLiterals.add(wasmSource);
785
+ }
786
+ }
787
+ },
788
+ AssignmentExpression: (path) => {
789
+ const wasmExportMemberInfo = getWasmExportMemberInfo(path?.node?.right);
790
+ if (!wasmExportMemberInfo?.exportName) {
791
+ return;
792
+ }
793
+ if (!wasmExportAliases.has(wasmExportMemberInfo.aliasName)) {
794
+ return;
795
+ }
796
+ if (!wasmPathLiterals.size) {
797
+ return;
798
+ }
799
+ for (const wasmPath of wasmPathLiterals) {
800
+ setSyntheticImportRef(
801
+ allImports,
802
+ allExports,
803
+ src,
804
+ file,
805
+ wasmPath,
806
+ [wasmExportMemberInfo.exportName],
807
+ path.node.loc?.start,
808
+ );
809
+ }
810
+ const targetName = getAssignmentTargetName(path?.node?.left);
811
+ if (!targetName) {
812
+ return;
813
+ }
814
+ for (const wasmPath of wasmPathLiterals) {
815
+ setSyntheticExportRef(
816
+ allImports,
817
+ allExports,
818
+ src,
819
+ file,
820
+ wasmPath,
821
+ [targetName],
822
+ path.node.loc?.start,
823
+ );
824
+ }
825
+ },
826
+ NewExpression: (path) => {
827
+ if (path?.node?.callee?.type === "Identifier") {
828
+ if (wasiConstructorAliases.has(path.node.callee.name)) {
829
+ setSyntheticImportRef(
830
+ allImports,
831
+ allExports,
832
+ src,
833
+ file,
834
+ "node:wasi",
835
+ ["WASI"],
836
+ path.node.loc?.start,
837
+ );
838
+ }
839
+ }
840
+ if (
841
+ path?.node?.callee?.type === "MemberExpression" &&
842
+ path.node.callee.object?.type === "Identifier" &&
843
+ wasiNamespaceAliases.has(path.node.callee.object.name) &&
844
+ getMemberExpressionPropertyName(path.node.callee.property) === "WASI"
845
+ ) {
846
+ setSyntheticImportRef(
847
+ allImports,
848
+ allExports,
849
+ src,
850
+ file,
851
+ "node:wasi",
852
+ ["WASI"],
853
+ path.node.loc?.start,
854
+ );
855
+ }
253
856
  },
254
857
  // Use for export barrells
255
858
  ExportAllDeclaration: (path) => {