Skip to content

feat(core): create independent server entries through slots - #148

Merged
xusd320 merged 4 commits into
mainfrom
xusd320/tr-server-entry
Oct 21, 2026
Merged

xusd320 merged 4 commits into
mainfrom
xusd320/tr-server-entry

Conversation

@xusd320

@xusd320 xusd320 commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Let plugins declare independent Node server build roots through ctx.slot("server.entry").add({ mode: "create", ... }), reusing the existing generated-contribution model.
  • Support Utoopack server-only builds without publishing synthetic browser assets or HTTP routes.

Changes

  • Add explicit create mode to server.entry. It returns the entry's BuildOutput.assets key and rejects Page-only target/position options. Existing import/replace behavior and return values remain unchanged.
  • Record independent entries and their module references in the normal contribution manifest, then project them into BuildPlan; no separate entry collector or new EmitApi method is introduced.
  • Extend Utoopack's existing multi-entry mapping to plugin runtime entries. When no client entries exist, use a private compiler anchor and remove its browser output after production compilation.
  • Add runtime/type coverage for creation, name collisions, invalid mode/option combinations, and coexistence with Page entry imports/replacements. Update English and Chinese documentation.

Validation

  • 205 core entry, command, and plugin-lifecycle tests passed, including existing Page/PPR entry composition.
  • 107 Utoopack adapter tests and 69 qiankun plugin/runtime tests passed (381 total).
  • Type checks passed for shared/core/Utoopack/qiankun and for the new return-value/invalid-input type fixtures and affected plugin mocks.
  • Repository lint passed (591 files); git diff --check passed.
  • Downstream EVJS consumer regression passed: 234 tests including 8 real Utoopack build cases; consumer build, public/service type checks, and changed-file ESLint passed with linked packages.
  • Complete GitHub Actions CI passed on a493afef: dependency installation, core/example/docs builds, repository lint and type checks, unit tests, and Playwright E2E. The shared local dependency tree still has missing packages and Webpack type mismatches; the complete CI run validates a fresh installation.
  • Fixed the negative type fixtures to report errors at the call argument consistently across TypeScript versions. Reproduced the prior CI failure with TypeScript 7.0.2; the corrected fixtures pass with both 7.0.2 and the linked local 6.0.3.

Risk / rollout

  • PPR and other Page entry plugins retain import/replace; omitted mode never creates an entry implicitly. No PPR migration is required.
  • Plugin test doubles implementing a generic FrameworkSlot need to account for the create overload's string return.
  • Review the compiler anchor cleanup and asset ownership. The entry API supplies a build root; protocol dispatch, host lifecycle, and deployment activation remain plugin/runtime responsibilities.
  • Publish compatible shared/core/bundler packages together, update downstream dependency ranges, then verify a normal installation. No release or deployment is included.

Reviewer notes

  • Focus on contribution serialization, Page/independent-entry isolation, and preservation of existing slot behavior.
  • Companion deployment adapter PR: https://github.com/unieojs/unio-adapters/pull/30. Downstream service applications need both published changes before removing local links.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-21T09:55:40.741069Z 2254ed5 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 2254ed53fc

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

(entry.kind === "server-runtime" || entry.kind === "page-server"),
(entry.kind === "server-runtime" ||
entry.kind === "page-server" ||
entry.kind === "runtime"),

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Keep plugin server entries self-contained

When a plugin entry and another server entry import the same module, Utoopack can factor that dependency into a shared chunk—the existing multi-server-entry.test.ts explicitly verifies shared entrypoint assets. Including runtime entries in this multi-entry compilation therefore conflicts with selectServerEntrypointAssets() in manifest-generator.ts:325-338, which retains only the named entry JavaScript file. A consumer following the new documented contract and deploying only BuildOutput.assets[entryName] will omit the shared chunk, so the isolated plugin entry cannot load; configure plugin runtime entries to produce standalone bundles rather than relying on shared server chunks.

Useful? React with 👍 / 👎.

const id = validateContributionId(input.id, pluginId);
assertGeneratedModuleOrString(pluginId, id, input.module);
const key = this.reserveKey(pluginId, id, "server entry", namespace);
const name = `plugin-${key.replace(/[^a-zA-Z0-9_-]/g, "-")}`;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Reject portable-name collisions for plugin entries

Contribution IDs may differ only by case, and this generated name preserves that difference; the later assertUniqueBuildEntryNames() uses an exact Set, while the normal build-plan validation—which canonicalizes names for case-insensitive filesystems—already ran before these entries were appended. Thus IDs such as worker and Worker are accepted but produce colliding physical entry files on Windows or a case-insensitive macOS volume. Validate these appended names with the same canonical portable identity used by validateBuildOutputNames(), including collisions with existing plan entries.

Useful? React with 👍 / 👎.

@xusd320 xusd320 changed the title feat(core): support plugin-owned server build entries feat(core): create independent server entries through slots Oct 21, 2026
@xusd320
xusd320 merged commit 665d7a0 into main Oct 21, 2026
1 check passed
@xusd320
xusd320 deleted the xusd320/tr-server-entry branch October 21, 2026 10:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant