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

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/cli/index.js CHANGED
@@ -3609,7 +3609,6 @@ var workspace = async (subcommand, options) => {
3609
3609
  });
3610
3610
  const workspaceLogs = createWorkspaceLogSink(tui.addLog);
3611
3611
  const addLog = workspaceLogs.appendLog;
3612
- addLog("workspace", `Writing workspace logs to ${workspaceLogs.logDirectory}`, "info");
3613
3612
  const killProcesses = async () => {
3614
3613
  const snapshot = [...running];
3615
3614
  running.length = 0;
@@ -3757,7 +3756,6 @@ var workspace = async (subcommand, options) => {
3757
3756
  workspaceBootStartedAt = performance.now();
3758
3757
  await startServices();
3759
3758
  tui.setReadyDuration(performance.now() - workspaceBootStartedAt);
3760
- addLog("workspace", "Workspace ready.", "success");
3761
3759
  };
3762
3760
  const togglePause = () => {
3763
3761
  if (paused) {
@@ -3829,10 +3827,8 @@ var workspace = async (subcommand, options) => {
3829
3827
  shutdown(0);
3830
3828
  });
3831
3829
  tui.start();
3832
- addLog("workspace", `Workspace booting ${orderedNames.length} services.`, "info");
3833
3830
  await startServices();
3834
3831
  tui.setReadyDuration(performance.now() - workspaceBootStartedAt);
3835
- addLog("workspace", "Workspace ready.", "success");
3836
3832
  await new Promise(() => {});
3837
3833
  };
3838
3834
 
package/dist/index.js CHANGED
@@ -2220,10 +2220,13 @@ var islandSequence = 0, resolvedServerComponentCache, resolvedServerBuildCompone
2220
2220
  const loadPromise = loadAndCompileServerBuildComponent(buildReferencePath);
2221
2221
  resolvedServerBuildComponentCache.set(buildReferencePath, loadPromise);
2222
2222
  return loadPromise;
2223
- }, loadServerImportComponent = async (resolvedComponent) => {
2223
+ }, loadServerImportComponent = async (resolvedComponent, exportName) => {
2224
2224
  const resolvedModulePath = resolvedComponent.startsWith(".") ? new URL(resolvedComponent, import.meta.url).pathname : resolvedComponent;
2225
2225
  const importTarget = resolvedModulePath.endsWith(".svelte") ? await compileSvelteServerModule(resolvedModulePath) : resolvedModulePath;
2226
2226
  const loadedModule = await import(importTarget);
2227
+ if (exportName && exportName !== "default" && exportName in loadedModule) {
2228
+ return loadedModule[exportName];
2229
+ }
2227
2230
  return "default" in loadedModule ? loadedModule.default : loadedModule;
2228
2231
  }, resolveIslandComponent = async (component) => {
2229
2232
  const buildReference = getIslandBuildReference(component);
@@ -2231,6 +2234,9 @@ var islandSequence = 0, resolvedServerComponentCache, resolvedServerBuildCompone
2231
2234
  if (buildReferencePath?.endsWith(".svelte")) {
2232
2235
  return loadServerBuildComponent(buildReferencePath);
2233
2236
  }
2237
+ if (buildReferencePath) {
2238
+ return loadServerImportComponent(buildReferencePath, buildReference?.export);
2239
+ }
2234
2240
  const resolvedComponent = getIslandComponent(component);
2235
2241
  if (typeof resolvedComponent !== "string") {
2236
2242
  return resolvedComponent;
@@ -2327,11 +2333,7 @@ var init_renderIslandMarkup = __esm(() => {
2327
2333
  });
2328
2334
 
2329
2335
  // src/build/islandEntries.ts
2330
- import {
2331
- mkdirSync,
2332
- rmSync,
2333
- writeFileSync as writeFileSync2
2334
- } from "fs";
2336
+ import { mkdirSync, rmSync, writeFileSync as writeFileSync2 } from "fs";
2335
2337
  import { dirname as dirname4, extname as extname3, join as join5, relative as relative3, resolve as resolve6 } from "path";
2336
2338
  import ts from "typescript";
2337
2339
  var frameworks, isRecord4 = (value) => typeof value === "object" && value !== null, resolveRegistryExport = (mod) => {
@@ -2340,7 +2342,7 @@ var frameworks, isRecord4 = (value) => typeof value === "object" && value !== nu
2340
2342
  if (isRecord4(mod.default))
2341
2343
  return mod.default;
2342
2344
  throw new Error("Island registry module must export `islandRegistry` or a default registry object.");
2343
- }, normalizeImportPath = (wrapperPath, targetPath) => {
2345
+ }, hasSvelteImport = (source) => /from\s+['"][^'"]+\.svelte['"]/.test(source), normalizeImportPath = (wrapperPath, targetPath) => {
2344
2346
  const importPath = relative3(dirname4(wrapperPath), targetPath).replace(/\\/g, "/");
2345
2347
  return importPath.startsWith(".") ? importPath : `./${importPath}`;
2346
2348
  }, isIdentifier = (value) => /^[A-Za-z_$][A-Za-z0-9_$]*$/.test(value), resolveIslandSourcePath = (registryPath, sourcePath) => {
@@ -2370,7 +2372,13 @@ var frameworks, isRecord4 = (value) => typeof value === "object" && value !== nu
2370
2372
  source
2371
2373
  });
2372
2374
  }
2373
- }, addRegistryEntries = (frameworkNode, framework, imports, references) => {
2375
+ }, createRegistryEntryValue = (reference) => ({
2376
+ component: reference.source,
2377
+ export: reference.export,
2378
+ source: reference.source
2379
+ }), addRegistryEntries = (frameworkNode, framework, imports, definitions, registry) => {
2380
+ const frameworkRegistry = registry[framework] ?? {};
2381
+ registry[framework] = frameworkRegistry;
2374
2382
  for (const property of frameworkNode.properties) {
2375
2383
  if (!ts.isPropertyAssignment(property) && !ts.isShorthandPropertyAssignment(property))
2376
2384
  continue;
@@ -2383,13 +2391,23 @@ var frameworks, isRecord4 = (value) => typeof value === "object" && value !== nu
2383
2391
  const reference = imports.get(initializer.text);
2384
2392
  if (!reference)
2385
2393
  continue;
2386
- references.set(`${framework}:${componentName}`, reference);
2394
+ frameworkRegistry[componentName] = createRegistryEntryValue(reference);
2395
+ definitions.push({
2396
+ buildReference: reference,
2397
+ component: componentName,
2398
+ framework
2399
+ });
2387
2400
  }
2388
- }, processDefineIslandRegistry = (node, imports, references) => {
2401
+ }, processDefineIslandRegistry = (node, imports, definitions, registry) => {
2389
2402
  const [firstArg] = node.arguments;
2390
2403
  if (!firstArg || !ts.isObjectLiteralExpression(firstArg))
2391
2404
  return;
2392
- const validFrameworks = ["react", "svelte", "vue", "angular"];
2405
+ const validFrameworks = [
2406
+ "react",
2407
+ "svelte",
2408
+ "vue",
2409
+ "angular"
2410
+ ];
2393
2411
  for (const property of firstArg.properties) {
2394
2412
  if (!ts.isPropertyAssignment(property))
2395
2413
  continue;
@@ -2401,13 +2419,27 @@ var frameworks, isRecord4 = (value) => typeof value === "object" && value !== nu
2401
2419
  continue;
2402
2420
  if (!ts.isObjectLiteralExpression(property.initializer))
2403
2421
  continue;
2404
- addRegistryEntries(property.initializer, framework, imports, references);
2422
+ addRegistryEntries(property.initializer, framework, imports, definitions, registry);
2405
2423
  }
2406
- }, walkRegistryNode = (node, imports, references) => {
2424
+ }, walkRegistryNode = (node, imports, definitions, registry) => {
2407
2425
  if (ts.isCallExpression(node) && ts.isIdentifier(node.expression) && node.expression.text === "defineIslandRegistry") {
2408
- processDefineIslandRegistry(node, imports, references);
2426
+ processDefineIslandRegistry(node, imports, definitions, registry);
2409
2427
  }
2410
- ts.forEachChild(node, (child) => walkRegistryNode(child, imports, references));
2428
+ ts.forEachChild(node, (child) => walkRegistryNode(child, imports, definitions, registry));
2429
+ }, hasIslandRegistryNamedExport = (sourceFile) => {
2430
+ for (const statement of sourceFile.statements) {
2431
+ 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")) {
2432
+ return true;
2433
+ }
2434
+ if (!ts.isExportDeclaration(statement) || !statement.exportClause)
2435
+ continue;
2436
+ if (!ts.isNamedExports(statement.exportClause))
2437
+ continue;
2438
+ if (statement.exportClause.elements.some((element) => element.name.text === "islandRegistry")) {
2439
+ return true;
2440
+ }
2441
+ }
2442
+ return false;
2411
2443
  }, collectImportDeclarations = (sourceFile, registryPath, imports) => {
2412
2444
  for (const statement of sourceFile.statements) {
2413
2445
  if (!ts.isImportDeclaration(statement) || !ts.isStringLiteral(statement.moduleSpecifier))
@@ -2419,13 +2451,36 @@ var frameworks, isRecord4 = (value) => typeof value === "object" && value !== nu
2419
2451
  collectDefaultImport(imports, importClause, source);
2420
2452
  collectNamedImports(imports, importClause, source);
2421
2453
  }
2422
- }, extractRegistryImportReferences = (registrySource, registryPath) => {
2454
+ }, parseIslandRegistryBuildInfo = (registrySource, registryPath) => {
2423
2455
  const sourceFile = ts.createSourceFile(registryPath, registrySource, ts.ScriptTarget.Latest, true, ts.ScriptKind.TS);
2424
2456
  const imports = new Map;
2425
- const references = new Map;
2457
+ const definitions = [];
2458
+ const registry = {};
2426
2459
  collectImportDeclarations(sourceFile, registryPath, imports);
2427
- walkRegistryNode(sourceFile, imports, references);
2428
- return references;
2460
+ walkRegistryNode(sourceFile, imports, definitions, registry);
2461
+ return {
2462
+ definitions,
2463
+ hasNamedExport: hasIslandRegistryNamedExport(sourceFile),
2464
+ registry
2465
+ };
2466
+ }, loadDynamicIslandRegistryBuildInfo = async (resolvedRegistryPath) => {
2467
+ const registryModule = await import(resolvedRegistryPath);
2468
+ const registry = resolveRegistryExport(registryModule);
2469
+ const definitions = frameworks.flatMap((framework) => {
2470
+ const frameworkRegistry = registry[framework];
2471
+ if (!isRecord4(frameworkRegistry))
2472
+ return [];
2473
+ return Object.entries(frameworkRegistry).map(([component, value]) => ({
2474
+ buildReference: getIslandBuildReference(value),
2475
+ component,
2476
+ framework
2477
+ }));
2478
+ });
2479
+ return {
2480
+ definitions,
2481
+ hasNamedExport: isRecord4(registryModule.islandRegistry),
2482
+ registry
2483
+ };
2429
2484
  }, createRegistryImportCode = (wrapperPath, registryPath, hasNamedExport) => {
2430
2485
  const normalizedPath = normalizeImportPath(wrapperPath, registryPath);
2431
2486
  if (hasNamedExport) {
@@ -2513,34 +2568,29 @@ export default component;
2513
2568
  const resolvedRegistryPath = resolve6(registryPath);
2514
2569
  const registrySource = Bun.file(resolvedRegistryPath);
2515
2570
  const registrySourceText = await registrySource.text();
2516
- const registryModule = await import(resolvedRegistryPath);
2517
- const registry = resolveRegistryExport(registryModule);
2518
- const parsedBuildReferences = extractRegistryImportReferences(registrySourceText, resolvedRegistryPath);
2519
- const definitions = frameworks.flatMap((framework) => {
2520
- const frameworkRegistry = registry[framework];
2521
- if (!isRecord4(frameworkRegistry))
2522
- return [];
2523
- return Object.entries(frameworkRegistry).map(([component, value]) => ({
2524
- buildReference: getIslandBuildReference(value) ?? parsedBuildReferences.get(`${framework}:${component}`) ?? null,
2525
- component,
2526
- framework
2527
- }));
2528
- });
2571
+ const parsedInfo = parseIslandRegistryBuildInfo(registrySourceText, resolvedRegistryPath);
2572
+ if (parsedInfo.definitions.length > 0) {
2573
+ return {
2574
+ definitions: parsedInfo.definitions,
2575
+ hasNamedExport: parsedInfo.hasNamedExport,
2576
+ registry: parsedInfo.registry,
2577
+ resolvedRegistryPath
2578
+ };
2579
+ }
2580
+ if (hasSvelteImport(registrySourceText)) {
2581
+ throw new Error("Unable to statically analyze the island registry. Registries that import .svelte files must use defineIslandRegistry({ ... }) with direct imported component references.");
2582
+ }
2583
+ const dynamicInfo = await loadDynamicIslandRegistryBuildInfo(resolvedRegistryPath);
2529
2584
  return {
2530
- definitions,
2531
- hasNamedExport: isRecord4(registryModule.islandRegistry),
2532
- registry,
2585
+ definitions: dynamicInfo.definitions,
2586
+ hasNamedExport: dynamicInfo.hasNamedExport,
2587
+ registry: dynamicInfo.registry,
2533
2588
  resolvedRegistryPath
2534
2589
  };
2535
2590
  };
2536
2591
  var init_islandEntries = __esm(() => {
2537
2592
  init_islands();
2538
- frameworks = [
2539
- "react",
2540
- "svelte",
2541
- "vue",
2542
- "angular"
2543
- ];
2593
+ frameworks = ["react", "svelte", "vue", "angular"];
2544
2594
  });
2545
2595
 
2546
2596
  // src/core/currentIslandRegistry.ts
@@ -50681,6 +50731,7 @@ var loadConfig = async (configPath) => {
50681
50731
  };
50682
50732
 
50683
50733
  // src/core/loadIslandRegistry.ts
50734
+ init_islandEntries();
50684
50735
  import { resolve as resolve8 } from "path";
50685
50736
  var isRecord6 = (value) => typeof value === "object" && value !== null;
50686
50737
  var resolveRegistryExport2 = (mod) => {
@@ -50694,6 +50745,10 @@ var isRegistryModuleExport = (value) => isRecord6(value);
50694
50745
  var isIslandRegistryInput = (value) => isRecord6(value);
50695
50746
  var loadIslandRegistry = async (registryPath) => {
50696
50747
  const resolvedRegistryPath = resolve8(registryPath);
50748
+ const buildInfo = await loadIslandRegistryBuildInfo(resolvedRegistryPath);
50749
+ if (buildInfo.definitions.length > 0) {
50750
+ return buildInfo.registry;
50751
+ }
50697
50752
  const importedModule = await import(resolvedRegistryPath);
50698
50753
  if (!isRegistryModuleExport(importedModule)) {
50699
50754
  throw new Error("Island registry module must export an object namespace.");
@@ -57813,5 +57868,5 @@ export {
57813
57868
  ANGULAR_INIT_TIMEOUT_MS
57814
57869
  };
57815
57870
 
57816
- //# debugId=DC45D0D20A29B90464756E2164756E21
57871
+ //# debugId=B174A989DC85D95764756E2164756E21
57817
57872
  //# sourceMappingURL=index.js.map