@absolutejs/absolute 0.19.0-beta.702 → 0.19.0-beta.703

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/build.js CHANGED
@@ -405,6 +405,22 @@ var frameworks, isRecord2 = (value) => typeof value === "object" && value !== nu
405
405
  source
406
406
  });
407
407
  }
408
+ }, isIslandRegistryHelperImport = (source) => source === "@absolutejs/absolute/islands" || source.endsWith("/islands") || source.endsWith("/core/islands"), collectRegistryHelperImports = (importClause, source, registryFactoryNames, registryNamespaceNames) => {
409
+ if (!isIslandRegistryHelperImport(source))
410
+ return;
411
+ const bindings = importClause.namedBindings;
412
+ if (!bindings)
413
+ return;
414
+ if (ts.isNamespaceImport(bindings)) {
415
+ registryNamespaceNames.add(bindings.name.text);
416
+ return;
417
+ }
418
+ for (const element of bindings.elements) {
419
+ const importedName = element.propertyName?.text ?? element.name.text;
420
+ if (importedName === "defineIslandRegistry") {
421
+ registryFactoryNames.add(element.name.text);
422
+ }
423
+ }
408
424
  }, createRegistryEntryValue = (reference) => ({
409
425
  component: reference.source,
410
426
  export: reference.export,
@@ -454,11 +470,16 @@ var frameworks, isRecord2 = (value) => typeof value === "object" && value !== nu
454
470
  continue;
455
471
  addRegistryEntries(property.initializer, framework, imports, definitions, registry);
456
472
  }
457
- }, walkRegistryNode = (node, imports, definitions, registry) => {
458
- if (ts.isCallExpression(node) && ts.isIdentifier(node.expression) && node.expression.text === "defineIslandRegistry") {
473
+ }, walkRegistryNode = (node, imports, registryFactoryNames, registryNamespaceNames, definitions, registry) => {
474
+ if (ts.isCallExpression(node) && isDefineIslandRegistryCall(node.expression, registryFactoryNames, registryNamespaceNames)) {
459
475
  processDefineIslandRegistry(node, imports, definitions, registry);
460
476
  }
461
- ts.forEachChild(node, (child) => walkRegistryNode(child, imports, definitions, registry));
477
+ ts.forEachChild(node, (child) => walkRegistryNode(child, imports, registryFactoryNames, registryNamespaceNames, definitions, registry));
478
+ }, isDefineIslandRegistryCall = (expression, registryFactoryNames, registryNamespaceNames) => {
479
+ if (ts.isIdentifier(expression)) {
480
+ return registryFactoryNames.has(expression.text);
481
+ }
482
+ return ts.isPropertyAccessExpression(expression) && expression.name.text === "defineIslandRegistry" && ts.isIdentifier(expression.expression) && registryNamespaceNames.has(expression.expression.text);
462
483
  }, hasIslandRegistryNamedExport = (sourceFile) => {
463
484
  for (const statement of sourceFile.statements) {
464
485
  if (ts.isVariableStatement(statement) && statement.modifiers?.some((modifier) => modifier.kind === ts.SyntaxKind.ExportKeyword) && statement.declarationList.declarations.some((declaration) => ts.isIdentifier(declaration.name) && declaration.name.text === "islandRegistry")) {
@@ -473,7 +494,7 @@ var frameworks, isRecord2 = (value) => typeof value === "object" && value !== nu
473
494
  }
474
495
  }
475
496
  return false;
476
- }, collectImportDeclarations = (sourceFile, registryPath, imports) => {
497
+ }, collectImportDeclarations = (sourceFile, registryPath, imports, registryFactoryNames, registryNamespaceNames) => {
477
498
  for (const statement of sourceFile.statements) {
478
499
  if (!ts.isImportDeclaration(statement) || !ts.isStringLiteral(statement.moduleSpecifier))
479
500
  continue;
@@ -483,14 +504,17 @@ var frameworks, isRecord2 = (value) => typeof value === "object" && value !== nu
483
504
  const source = resolveIslandSourcePath(registryPath, statement.moduleSpecifier.text);
484
505
  collectDefaultImport(imports, importClause, source);
485
506
  collectNamedImports(imports, importClause, source);
507
+ collectRegistryHelperImports(importClause, statement.moduleSpecifier.text, registryFactoryNames, registryNamespaceNames);
486
508
  }
487
509
  }, parseIslandRegistryBuildInfo = (registrySource, registryPath) => {
488
510
  const sourceFile = ts.createSourceFile(registryPath, registrySource, ts.ScriptTarget.Latest, true, ts.ScriptKind.TS);
489
511
  const imports = new Map;
512
+ const registryFactoryNames = new Set(["defineIslandRegistry"]);
513
+ const registryNamespaceNames = new Set;
490
514
  const definitions = [];
491
515
  const registry = {};
492
- collectImportDeclarations(sourceFile, registryPath, imports);
493
- walkRegistryNode(sourceFile, imports, definitions, registry);
516
+ collectImportDeclarations(sourceFile, registryPath, imports, registryFactoryNames, registryNamespaceNames);
517
+ walkRegistryNode(sourceFile, imports, registryFactoryNames, registryNamespaceNames, definitions, registry);
494
518
  return {
495
519
  definitions,
496
520
  hasNamedExport: hasIslandRegistryNamedExport(sourceFile),
@@ -49500,5 +49524,5 @@ export {
49500
49524
  build
49501
49525
  };
49502
49526
 
49503
- //# debugId=2F504DCD19D0582A64756E2164756E21
49527
+ //# debugId=39513B9FFABA25C864756E2164756E21
49504
49528
  //# sourceMappingURL=build.js.map