Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Add frontend render plugin system support#36099

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Draft
lunny wants to merge8 commits intogo-gitea:main
base:main
Choose a base branch
Loading
fromlunny:lunny/frontend_render_plugin

Conversation

@lunny
Copy link
Member

@lunnylunny commentedDec 6, 2025
edited
Loading

Resolve#34917

  • Render plugins list
image
  • Render plugin view
image
  • Render plugin example
image
  • Render wasm plugin example
image

@GiteaBotGiteaBot added the lgtm/need 2This PR needs two approvals by maintainers to be considered for merging. labelDec 6, 2025
@wxiaoguang
Copy link
Contributor

Don't understand why wasm is introduced and becomes a must.

It's highly likely a wrong design: when you have a hammer, then everything in your eyes become nails.

@silverwind
Copy link
Member

silverwind commentedDec 6, 2025
edited
Loading

I'm still of the opinion that plugins should be npm packages with a package.json that declares their metadata and dependencies. I don't think it's good to create a newmanifest.json file format when thepackage.json format already has most of what you need.

The big benefit of being a npm package is that these plugins can be puplished to the npm registry so be installed from there or a local folder.

Take for exampleVSCode extensions, those are also npm packages at their core, withadditional package.json properties specific to extensions.

@silverwind
Copy link
Member

silverwind commentedDec 6, 2025
edited
Loading

Don't understand why wasm is introduced and becomes a must.

WASM support is nice, but it should not be required. The entry point to a plugin should be JS function, and whether the plugin than loads a WASM module or not is the plugin's decision.

@wxiaoguang
Copy link
Contributor

wxiaoguang commentedDec 6, 2025
edited
Loading

I'm still of the opinion that plugins should be npm packages with a package.json that declares their metadata and dependencies.


Don't understand why wasm is introduced and becomes a must.

WASM support is nice, but it should not be required. The entry point to a plugin should be JS function, and whether the plugin than loads a WASM module or not is the plugin's decision.

WASM is definitely a new abuse here, unless it could prove that it brings real benefits.

@lunny
Copy link
MemberAuthor

lunny commentedDec 6, 2025
edited
Loading

Don't understand why wasm is introduced and becomes a must.

It's highly likely a wrong design: when you have a hammer, then everything in your eyes become nails.

It's just an example. There is no special code to support wasm. It's a nature support from web browser. The benefit of wasm could allow render plugin reuse the legacy code written by other lanuages. i.e.https://github.com/xuri/excelize-wasm could render excel file in the web browser which used wasm.

@lunny
Copy link
MemberAuthor

Don't understand why wasm is introduced and becomes a must.

WASM support is nice, but it should not be required. The entry point to a plugin should be JS function, and whether the plugin than loads a WASM module or not is the plugin's decision.

Use a file name as entry is commonly and useful.

I'm still of the opinion that plugins should be npm packages with a package.json that declares their metadata and dependencies. I don't think it's good to create a newmanifest.json file format when thepackage.json format already has most of what you need.

The big benefit of being a npm package is that these plugins can be puplished to the npm registry so be installed from there or a local folder.

Take for exampleVSCode extensions, those are also npm packages at their core, withadditional package.json properties specific to extensions.

The package.json file could be in the repository of the plugin repository, but for the final dist or zip file, we don't need the extra information in the package.json. That means the manifest.json is for the runtime and package.json is for the development and I don't think the npm ecosystem could not be reused.

@wxiaoguang
Copy link
Contributor

Don't understand why wasm is introduced and becomes a must.
It's highly likely a wrong design: when you have a hammer, then everything in your eyes become nails.

It's just an example. There is no special code to support wasm. It's a nature support from web browser. The benefit of wasm could allow render plugin reuse the legacy code written by other lanuages. i.e.https://github.com/xuri/excelize-wasm could render excel file in the web browser which used wasm.

How the example is related to the "plugin"? Why you need to know whether a plugin is written in wasm or not?

@lunny
Copy link
MemberAuthor

Don't understand why wasm is introduced and becomes a must.
It's highly likely a wrong design: when you have a hammer, then everything in your eyes become nails.

It's just an example. There is no special code to support wasm. It's a nature support from web browser. The benefit of wasm could allow render plugin reuse the legacy code written by other lanuages. i.e.xuri/excelize-wasm could render excel file in the web browser which used wasm.

How the example is related to the "plugin"? Why you need to know whether a plugin is written in wasm or not?

The wasm example just show the possibility to convert legacy render code as a js plugin via wasm. I can remove the example if it's unnecessary.

@lunnylunny mentioned this pull requestDec 8, 2025
@silverwind
Copy link
Member

silverwind commentedDec 11, 2025
edited
Loading

The package.json file could be in the repository of the plugin repository, but for the final dist or zip file, we don't need the extra information in the package.json. That means the manifest.json is for the runtime and package.json is for the development and I don't think the npm ecosystem could not be reused.

But then you are forcing plugin authors to maintain 2 metadata files. package.json is well-defined standard for JS packages and plugins are JS packages.

package.json has flexible logic on how a package entry point is specified. I'm not saying we have to implement all thecomplex mechanisms, just the basic ones likeexports used with a string. Here for example a basic plugin:

package.json

{"name":"helloworld","type":"module","exports":"./index.js",}

index.js

exportconstrender=()=>"hello world";

@lunny
Copy link
MemberAuthor

The package.json file could be in the repository of the plugin repository, but for the final dist or zip file, we don't need the extra information in the package.json. That means the manifest.json is for the runtime and package.json is for the development and I don't think the npm ecosystem could not be reused.

But then you are forcing plugin authors to maintain 2 metadata files. package.json is well-defined standard for JS packages and plugins are JS packages.

package.json has flexible logic on how a package entry point is specified. I'm not saying we have to implement all the complex mechanisms, just the basic ones. Here for example a basic plugin:

package.json

{"name":"helloworld","type":"module","exports":"./index.js",}

index.js

exportconstrender=()=>"hello world";

Seenodejs.org/api/packages.html for good documentation on what a JS package is.

But wouldn’t that force users to depend on Node.js? Some users may prefer developing plugins using other ecosystems or languages. Many platforms—such as Chrome—provide a metadata file format that does not require Node.js at all.

@silverwind
Copy link
Member

silverwind commentedDec 11, 2025
edited
Loading

No, Node.js is not required at all, your plugin loader takes the role of Node.js and is responsible for loading the module by first parsingpackage.json, determining the entry point, creating a URL to it and then load each plugin similar to this:

const{render}=awaitimport(pluginUrl);constelement=document.querySelectorAll(".render-target");awaitrender(elements,data);

@silverwind
Copy link
Member

silverwind commentedDec 11, 2025
edited
Loading

The main benefit plugins being npm packages that they can be published to npm and sourced from there. Of course to directly install npm packages directly from the npm registry, a JS package manager like npm, pnpm or bun will be required to download the package.

Packages sourced from a local directory may not require a package manager, but in practice they might as well do because many of them will need other npm dependencies to render content.

@silverwind
Copy link
Member

Also to note, I guess any sufficiently complex render plugin will want to bundle and minify their code (with a bundler likehttps://github.com/rolldown/tsdown), so their entry point may for example be a./dist/index.js. Still a possible with npm packages and many do publish bundled code to the npm registry.

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

Reviewers

No reviews

Assignees

No one assigned

Labels

lgtm/need 2This PR needs two approvals by maintainers to be considered for merging.modifies/docsmodifies/frontendmodifies/goPull requests that update Go codemodifies/internalmodifies/migrationsmodifies/templatesThis PR modifies the template filesmodifies/translation

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

[Propsal] Dynamical Frontend Render Plugin

4 participants

@lunny@wxiaoguang@silverwind@GiteaBot

[8]ページ先頭

©2009-2025 Movatter.jp