Skip to content

✨ feat: standalone extension manager - #165

Open
alexcui03 wants to merge 46 commits into
dev/3.2from
feat/extension-ng
Open

✨ feat: standalone extension manager#165
alexcui03 wants to merge 46 commits into
dev/3.2from
feat/extension-ng

Conversation

@alexcui03

@alexcui03 alexcui03 commented Mar 4, 2026

Copy link
Copy Markdown
Member

Description

Proposed Changes

Test Coverage

Additional Context

Signed-off-by: Alex Cui <cuizhihui030925@outlook.com>
@alexcui03 alexcui03 self-assigned this Mar 4, 2026
@alexcui03 alexcui03 added feature New feature or request extension Things related to clipcc-extension. labels Mar 4, 2026
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Mar 4, 2026

Copy link
Copy Markdown

Deploying clipcc-preview with  Cloudflare Pages  Cloudflare Pages

Latest commit: 02f6866
Status: ✅  Deploy successful!
Preview URL: https://2c8f3097.clipcc-preview.pages.dev
Branch Preview URL: https://feat-extension-ng.clipcc-preview.pages.dev

View logs

alexcui03 added 25 commits March 5, 2026 20:57
Signed-off-by: Alex Cui <cuizhihui030925@outlook.com>
Signed-off-by: Alex Cui <cuizhihui030925@outlook.com>
Signed-off-by: Alex Cui <cuizhihui030925@outlook.com>
Signed-off-by: Alex Cui <cuizhihui030925@outlook.com>
Signed-off-by: Alex Cui <cuizhihui030925@outlook.com>
Signed-off-by: Alex Cui <cuizhihui030925@outlook.com>
Signed-off-by: Alex Cui <cuizhihui030925@outlook.com>
Signed-off-by: Alex Cui <cuizhihui030925@outlook.com>
Signed-off-by: Alex Cui <cuizhihui030925@outlook.com>
Signed-off-by: Alex Cui <cuizhihui030925@outlook.com>
Signed-off-by: Alex Cui <cuizhihui030925@outlook.com>
Signed-off-by: Alex Cui <cuizhihui030925@outlook.com>
Signed-off-by: Alex Cui <cuizhihui030925@outlook.com>
Signed-off-by: Alex Cui <cuizhihui030925@outlook.com>
Signed-off-by: Alex Cui <cuizhihui030925@outlook.com>
Signed-off-by: Alex Cui <cuizhihui030925@outlook.com>
Signed-off-by: Alex Cui <cuizhihui030925@outlook.com>
Signed-off-by: Alex Cui <cuizhihui030925@outlook.com>
Signed-off-by: Alex Cui <cuizhihui030925@outlook.com>
Signed-off-by: Alex Cui <cuizhihui030925@outlook.com>
Signed-off-by: Alex Cui <cuizhihui030925@outlook.com>
Signed-off-by: Alex Cui <cuizhihui030925@outlook.com>
Signed-off-by: Alex Cui <cuizhihui030925@outlook.com>
Signed-off-by: Alex Cui <cuizhihui030925@outlook.com>
Signed-off-by: Alex Cui <cuizhihui030925@outlook.com>
Signed-off-by: Alex Cui <cuizhihui030925@outlook.com>
Signed-off-by: Alex Cui <cuizhihui030925@outlook.com>
Signed-off-by: Alex Cui <cuizhihui030925@outlook.com>
@alexcui03
alexcui03 marked this pull request as ready for review April 15, 2026 16:58
Signed-off-by: Alex Cui <cuizhihui030925@outlook.com>
@alexcui03 alexcui03 changed the title ✨ feat: new extension manager and api ✨ feat: standalone extension manager Apr 15, 2026
Signed-off-by: Alex Cui <cuizhihui030925@outlook.com>
Signed-off-by: Alex Cui <cuizhihui030925@outlook.com>
Signed-off-by: Alex Cui <cuizhihui030925@outlook.com>
Signed-off-by: Alex Cui <cuizhihui030925@outlook.com>
Signed-off-by: Alex Cui <cuizhihui030925@outlook.com>
Signed-off-by: Alex Cui <cuizhihui030925@outlook.com>
Signed-off-by: Alex Cui <cuizhihui030925@outlook.com>
Signed-off-by: Alex Cui <cuizhihui030925@outlook.com>
Signed-off-by: Alex Cui <cuizhihui030925@outlook.com>
Signed-off-by: Alex Cui <cuizhihui030925@outlook.com>
Signed-off-by: Alex Cui <cuizhihui030925@outlook.com>
@SimonShiki
SimonShiki self-requested a review August 16, 2026 09:00
Comment thread packages/gui/src/containers/blocks.jsx Outdated
clearTimeout(this.toolboxUpdateTimeout);

// Remove event listeners for extension manager.
this.props.extensionManager.addEventListener('UPDATE_BLOCKS', this.handleExtensionUpdateBlocks);

@SimonShiki SimonShiki Aug 16, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

add -> remove

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

fixed

formatMessage.setup({locale: locale, translations: {[locale]: messages}});
}
return this.extensionManager.refreshBlocks();
return Promise.resolve();

@SimonShiki SimonShiki Aug 16, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

should call extensionManager's refreshInfo(), or the extension block's locale won't get changed. also not seen in gui

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

updated in 1a84c8a, vm's {get,set}Locale method is marked as deprecated since it is only used for translating extensions' blocks. i consider to implement that feature in extension manager.

btw, currently all extensions uses vm's format-message. the package used in vm and extension manager should be same version, to ensure that they share the same instance. later, builtin extensions should be splited from vm to solve the problem.

* Event handler for updating block definitions.
* @param {import('clipcc-extension').UpdateBlocksEvent} event Event payload.
*/
handleExtensionUpdateBlocks (event) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

consider add theme support for extension blocks, like what handleExtensionAdded did

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

implemented in b0cf2b9

@SimonShiki SimonShiki left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

  1. check if extension manager is available before access in VM, like installTargets and shareBlocksToTarget
  2. Current implementation drops load extension from url (?
  3. If worker fails, pendingWorker never get recycled correctly

Signed-off-by: Alex Cui <cuizhihui030925@outlook.com>
Signed-off-by: Alex Cui <cuizhihui030925@outlook.com>
Signed-off-by: Alex Cui <cuizhihui030925@outlook.com>
@alexcui03

alexcui03 commented Aug 24, 2026

Copy link
Copy Markdown
Member Author
  1. check if extension manager is available before access in VM, like installTargets and shareBlocksToTarget
  2. Current implementation drops load extension from url (?
  3. If worker fails, pendingWorker never get recycled correctly

For 1: vm-related methods should be invoked after vm-manager-hoc is mounted. it should work fine. there is a problem that vm.initialized is not a property of vm, but assigned by vm-manager-hoc, then some methods might be invoked before vm is actually initialized due to React's lifecycle, like setLocale called in Blocks.

For 2: extension manager loads an extension from its adapter. it should be able to load original scratch extensions from url with worker adapter.

For 3: see 02f6866, idk whether i understood the problem correctly.

Signed-off-by: Alex Cui <cuizhihui030925@outlook.com>
Signed-off-by: Alex Cui <cuizhihui030925@outlook.com>
@SimonShiki

SimonShiki commented Aug 25, 2026

Copy link
Copy Markdown
Member
  1. check if extension manager is available before access in VM, like installTargets and shareBlocksToTarget
  2. Current implementation drops load extension from url (?
  3. If worker fails, pendingWorker never get recycled correctly

For 1: vm-related methods should be invoked after vm-manager-hoc is mounted. it should work fine. there is a problem that vm.initialized is not a property of vm, but assigned by vm-manager-hoc, then some methods might be invoked before vm is actually initialized due to React's lifecycle, like setLocale called in Blocks.

For 2: extension manager loads an extension from its adapter. it should be able to load original scratch extensions from url with worker adapter.

For 3: see 02f6866, idk whether i understood the problem correctly.

For 1, VM should work without extension manager. installTargets get called during deserialization, need to check whether functions that related to extensions would break

@alexcui03

Copy link
Copy Markdown
Member Author
  1. check if extension manager is available before access in VM, like installTargets and shareBlocksToTarget
  2. Current implementation drops load extension from url (?
  3. If worker fails, pendingWorker never get recycled correctly

For 1: vm-related methods should be invoked after vm-manager-hoc is mounted. it should work fine. there is a problem that vm.initialized is not a property of vm, but assigned by vm-manager-hoc, then some methods might be invoked before vm is actually initialized due to React's lifecycle, like setLocale called in Blocks.
For 2: extension manager loads an extension from its adapter. it should be able to load original scratch extensions from url with worker adapter.
For 3: see 02f6866, idk whether i understood the problem correctly.

For 1, VM should work without extension manager. installTargets get called during deserialization, need to check whether functions that related to extensions would break

It seems that installTargets will only use extension manager when there exists a block from extension. Running a project with extension blocks but without a manager to load these extensions should be invalid.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

extension Things related to clipcc-extension. feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants