@agimon-ai/po 0.0.0-alpha.0
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/LICENSE +21 -0
- package/README.md +755 -0
- package/assets/banner.png +0 -0
- package/assets/banner.svg +25 -0
- package/assets/favicon.svg +15 -0
- package/assets/logo-light.png +0 -0
- package/assets/logo-light.svg +25 -0
- package/assets/logo.png +0 -0
- package/assets/logo.svg +25 -0
- package/assets/mascot.png +0 -0
- package/assets/mascot.svg +25 -0
- package/dist/_virtual/_rolldown/runtime.cjs +23 -0
- package/dist/antigravity.cjs +5 -0
- package/dist/antigravity.d.mts +2 -0
- package/dist/antigravity.mjs +2 -0
- package/dist/apiContracts.cjs +11 -0
- package/dist/apiContracts.cjs.map +1 -0
- package/dist/apiContracts.d.mts +52 -0
- package/dist/apiContracts.d.mts.map +1 -0
- package/dist/apiContracts.mjs +7 -0
- package/dist/apiContracts.mjs.map +1 -0
- package/dist/baseCommand.cjs +3 -0
- package/dist/baseCommand.d.mts +2 -0
- package/dist/baseCommand.mjs +2 -0
- package/dist/bin/cli.cjs +24 -0
- package/dist/bin/cli.cjs.map +1 -0
- package/dist/bin/cli.d.mts +1 -0
- package/dist/bin/cli.mjs +25 -0
- package/dist/bin/cli.mjs.map +1 -0
- package/dist/bin/doomRunner.cjs +33 -0
- package/dist/bin/doomRunner.cjs.map +1 -0
- package/dist/bin/doomRunner.d.mts +4 -0
- package/dist/bin/doomRunner.d.mts.map +1 -0
- package/dist/bin/doomRunner.mjs +32 -0
- package/dist/bin/doomRunner.mjs.map +1 -0
- package/dist/bin/serve.cjs +30 -0
- package/dist/bin/serve.cjs.map +1 -0
- package/dist/bin/serve.d.mts +1 -0
- package/dist/bin/serve.mjs +31 -0
- package/dist/bin/serve.mjs.map +1 -0
- package/dist/builders/cli/extensionAssembler/index.cjs +342 -0
- package/dist/builders/cli/extensionAssembler/index.cjs.map +1 -0
- package/dist/builders/cli/extensionAssembler/index.d.mts +85 -0
- package/dist/builders/cli/extensionAssembler/index.d.mts.map +1 -0
- package/dist/builders/cli/extensionAssembler/index.mjs +335 -0
- package/dist/builders/cli/extensionAssembler/index.mjs.map +1 -0
- package/dist/catalog/index.json +430 -0
- package/dist/cli.cjs +28 -0
- package/dist/cli.d.mts +11 -0
- package/dist/cli.mjs +11 -0
- package/dist/cliApp.cjs +6 -0
- package/dist/cliApp.d.mts +2 -0
- package/dist/cliApp.mjs +2 -0
- package/dist/codex.cjs +8 -0
- package/dist/codex.d.mts +2 -0
- package/dist/codex.mjs +2 -0
- package/dist/commands.cjs +18 -0
- package/dist/commands.d.mts +9 -0
- package/dist/commands.mjs +9 -0
- package/dist/compatibility.cjs +27 -0
- package/dist/compatibility.d.mts +6 -0
- package/dist/compatibility.mjs +6 -0
- package/dist/compatibilityCommand.cjs +4 -0
- package/dist/compatibilityCommand.d.mts +2 -0
- package/dist/compatibilityCommand.mjs +2 -0
- package/dist/compatibilityContext.cjs +3 -0
- package/dist/compatibilityContext.d.mts +2 -0
- package/dist/compatibilityContext.mjs +2 -0
- package/dist/compatibilityOptions.cjs +5 -0
- package/dist/compatibilityOptions.d.mts +2 -0
- package/dist/compatibilityOptions.mjs +2 -0
- package/dist/config.cjs +163 -0
- package/dist/config.d.mts +7 -0
- package/dist/config.mjs +7 -0
- package/dist/doctorCommand.cjs +5 -0
- package/dist/doctorCommand.d.mts +2 -0
- package/dist/doctorCommand.mjs +2 -0
- package/dist/emitMcpCommand.cjs +4 -0
- package/dist/emitMcpCommand.d.mts +2 -0
- package/dist/emitMcpCommand.mjs +2 -0
- package/dist/explainCommand.cjs +5 -0
- package/dist/explainCommand.d.mts +2 -0
- package/dist/explainCommand.mjs +2 -0
- package/dist/extensions/server.cjs +39 -0
- package/dist/extensions/server.cjs.map +1 -0
- package/dist/extensions/server.d.mts +5 -0
- package/dist/extensions/server.d.mts.map +1 -0
- package/dist/extensions/server.mjs +34 -0
- package/dist/extensions/server.mjs.map +1 -0
- package/dist/harnessContext.cjs +5 -0
- package/dist/harnessContext.d.mts +2 -0
- package/dist/harnessContext.mjs +2 -0
- package/dist/harnessState.cjs +19 -0
- package/dist/harnessState.d.mts +2 -0
- package/dist/harnessState.mjs +2 -0
- package/dist/help.cjs +12 -0
- package/dist/help.d.mts +6 -0
- package/dist/help.mjs +6 -0
- package/dist/index.cjs +306 -0
- package/dist/index.d.mts +40 -0
- package/dist/index.mjs +37 -0
- package/dist/initCommand.cjs +4 -0
- package/dist/initCommand.d.mts +2 -0
- package/dist/initCommand.mjs +2 -0
- package/dist/matrixOptions.cjs +28 -0
- package/dist/matrixOptions.d.mts +2 -0
- package/dist/matrixOptions.mjs +2 -0
- package/dist/matrixSwitcher.cjs +11 -0
- package/dist/matrixSwitcher.d.mts +3 -0
- package/dist/matrixSwitcher.mjs +3 -0
- package/dist/mcpFilter.cjs +9 -0
- package/dist/mcpFilter.d.mts +1 -0
- package/dist/mcpFilter.mjs +2 -0
- package/dist/options.cjs +3 -0
- package/dist/options.d.mts +2 -0
- package/dist/options.mjs +2 -0
- package/dist/process.cjs +12 -0
- package/dist/process.d.mts +2 -0
- package/dist/process.mjs +2 -0
- package/dist/projectTrust.cjs +6 -0
- package/dist/projectTrust.d.mts +2 -0
- package/dist/projectTrust.mjs +2 -0
- package/dist/repository.cjs +5 -0
- package/dist/repository.d.mts +2 -0
- package/dist/repository.mjs +2 -0
- package/dist/resourceCollector.cjs +9 -0
- package/dist/resourceCollector.d.mts +1 -0
- package/dist/resourceCollector.mjs +2 -0
- package/dist/router.cjs +6 -0
- package/dist/router.d.mts +2 -0
- package/dist/router.mjs +2 -0
- package/dist/services.cjs +97 -0
- package/dist/services.d.mts +12 -0
- package/dist/services.mjs +12 -0
- package/dist/shared.cjs +18 -0
- package/dist/shared.d.mts +2 -0
- package/dist/shared.mjs +2 -0
- package/dist/src/bin/agentDirectory.cjs +27 -0
- package/dist/src/bin/agentDirectory.cjs.map +1 -0
- package/dist/src/bin/agentDirectory.mjs +26 -0
- package/dist/src/bin/agentDirectory.mjs.map +1 -0
- package/dist/src/builders/apiContractExport/index.cjs +126 -0
- package/dist/src/builders/apiContractExport/index.cjs.map +1 -0
- package/dist/src/builders/apiContractExport/index.mjs +123 -0
- package/dist/src/builders/apiContractExport/index.mjs.map +1 -0
- package/dist/src/builders/cli/entryResolution.cjs +39 -0
- package/dist/src/builders/cli/entryResolution.cjs.map +1 -0
- package/dist/src/builders/cli/entryResolution.mjs +35 -0
- package/dist/src/builders/cli/entryResolution.mjs.map +1 -0
- package/dist/src/builders/cli/harnessContext.cjs +175 -0
- package/dist/src/builders/cli/harnessContext.cjs.map +1 -0
- package/dist/src/builders/cli/harnessContext.d.mts +48 -0
- package/dist/src/builders/cli/harnessContext.d.mts.map +1 -0
- package/dist/src/builders/cli/harnessContext.mjs +167 -0
- package/dist/src/builders/cli/harnessContext.mjs.map +1 -0
- package/dist/src/builders/cli/sessionComposition.cjs +27 -0
- package/dist/src/builders/cli/sessionComposition.cjs.map +1 -0
- package/dist/src/builders/cli/sessionComposition.mjs +26 -0
- package/dist/src/builders/cli/sessionComposition.mjs.map +1 -0
- package/dist/src/builders/hooks/index.cjs +238 -0
- package/dist/src/builders/hooks/index.cjs.map +1 -0
- package/dist/src/builders/hooks/index.mjs +231 -0
- package/dist/src/builders/hooks/index.mjs.map +1 -0
- package/dist/src/builders/native/index.cjs +176 -0
- package/dist/src/builders/native/index.cjs.map +1 -0
- package/dist/src/builders/native/index.d.mts +36 -0
- package/dist/src/builders/native/index.d.mts.map +1 -0
- package/dist/src/builders/native/index.mjs +170 -0
- package/dist/src/builders/native/index.mjs.map +1 -0
- package/dist/src/builders/server/backgroundSync.cjs +333 -0
- package/dist/src/builders/server/backgroundSync.cjs.map +1 -0
- package/dist/src/builders/server/backgroundSync.mjs +320 -0
- package/dist/src/builders/server/backgroundSync.mjs.map +1 -0
- package/dist/src/builders/server/computerUseBinding.cjs +273 -0
- package/dist/src/builders/server/computerUseBinding.cjs.map +1 -0
- package/dist/src/builders/server/computerUseBinding.mjs +269 -0
- package/dist/src/builders/server/computerUseBinding.mjs.map +1 -0
- package/dist/src/builders/server/computerUseRecordings.cjs +188 -0
- package/dist/src/builders/server/computerUseRecordings.cjs.map +1 -0
- package/dist/src/builders/server/computerUseRecordings.mjs +184 -0
- package/dist/src/builders/server/computerUseRecordings.mjs.map +1 -0
- package/dist/src/builders/server/defaultWorkspace.cjs +38 -0
- package/dist/src/builders/server/defaultWorkspace.cjs.map +1 -0
- package/dist/src/builders/server/defaultWorkspace.mjs +35 -0
- package/dist/src/builders/server/defaultWorkspace.mjs.map +1 -0
- package/dist/src/builders/server/idleRestart.cjs +149 -0
- package/dist/src/builders/server/idleRestart.cjs.map +1 -0
- package/dist/src/builders/server/idleRestart.mjs +136 -0
- package/dist/src/builders/server/idleRestart.mjs.map +1 -0
- package/dist/src/builders/server/index.cjs +63 -0
- package/dist/src/builders/server/index.cjs.map +1 -0
- package/dist/src/builders/server/index.mjs +60 -0
- package/dist/src/builders/server/index.mjs.map +1 -0
- package/dist/src/builders/server/logSink.cjs +57 -0
- package/dist/src/builders/server/logSink.cjs.map +1 -0
- package/dist/src/builders/server/logSink.mjs +57 -0
- package/dist/src/builders/server/logSink.mjs.map +1 -0
- package/dist/src/builders/server/mcpApp.cjs +152 -0
- package/dist/src/builders/server/mcpApp.cjs.map +1 -0
- package/dist/src/builders/server/mcpApp.d.mts +18 -0
- package/dist/src/builders/server/mcpApp.d.mts.map +1 -0
- package/dist/src/builders/server/mcpApp.mjs +147 -0
- package/dist/src/builders/server/mcpApp.mjs.map +1 -0
- package/dist/src/builders/server/mcpAppBuild.cjs +111 -0
- package/dist/src/builders/server/mcpAppBuild.cjs.map +1 -0
- package/dist/src/builders/server/mcpAppBuild.d.mts +24 -0
- package/dist/src/builders/server/mcpAppBuild.d.mts.map +1 -0
- package/dist/src/builders/server/mcpAppBuild.mjs +105 -0
- package/dist/src/builders/server/mcpAppBuild.mjs.map +1 -0
- package/dist/src/builders/server/mcpBundle.cjs +87 -0
- package/dist/src/builders/server/mcpBundle.cjs.map +1 -0
- package/dist/src/builders/server/mcpBundle.d.mts +23 -0
- package/dist/src/builders/server/mcpBundle.d.mts.map +1 -0
- package/dist/src/builders/server/mcpBundle.mjs +84 -0
- package/dist/src/builders/server/mcpBundle.mjs.map +1 -0
- package/dist/src/builders/server/packageReloadCheck.cjs +62 -0
- package/dist/src/builders/server/packageReloadCheck.cjs.map +1 -0
- package/dist/src/builders/server/packageReloadCheck.mjs +61 -0
- package/dist/src/builders/server/packageReloadCheck.mjs.map +1 -0
- package/dist/src/builders/server/packageUrl.cjs +210 -0
- package/dist/src/builders/server/packageUrl.cjs.map +1 -0
- package/dist/src/builders/server/packageUrl.mjs +203 -0
- package/dist/src/builders/server/packageUrl.mjs.map +1 -0
- package/dist/src/builders/server/runtime.cjs +1428 -0
- package/dist/src/builders/server/runtime.cjs.map +1 -0
- package/dist/src/builders/server/runtime.mjs +1420 -0
- package/dist/src/builders/server/runtime.mjs.map +1 -0
- package/dist/src/builders/server/runtimeResources.cjs +72 -0
- package/dist/src/builders/server/runtimeResources.cjs.map +1 -0
- package/dist/src/builders/server/runtimeResources.mjs +71 -0
- package/dist/src/builders/server/runtimeResources.mjs.map +1 -0
- package/dist/src/builders/server/selectionStatus.cjs +12 -0
- package/dist/src/builders/server/selectionStatus.cjs.map +1 -0
- package/dist/src/builders/server/selectionStatus.mjs +12 -0
- package/dist/src/builders/server/selectionStatus.mjs.map +1 -0
- package/dist/src/builders/server/sessionArguments.cjs +63 -0
- package/dist/src/builders/server/sessionArguments.cjs.map +1 -0
- package/dist/src/builders/server/sessionArguments.mjs +62 -0
- package/dist/src/builders/server/sessionArguments.mjs.map +1 -0
- package/dist/src/builders/server/shutdown.cjs +16 -0
- package/dist/src/builders/server/shutdown.cjs.map +1 -0
- package/dist/src/builders/server/shutdown.mjs +16 -0
- package/dist/src/builders/server/shutdown.mjs.map +1 -0
- package/dist/src/builders/server/webTemplateDecision.cjs +34 -0
- package/dist/src/builders/server/webTemplateDecision.cjs.map +1 -0
- package/dist/src/builders/server/webTemplateDecision.mjs +32 -0
- package/dist/src/builders/server/webTemplateDecision.mjs.map +1 -0
- package/dist/src/builders/server/workspaceCheckout.cjs +31 -0
- package/dist/src/builders/server/workspaceCheckout.cjs.map +1 -0
- package/dist/src/builders/server/workspaceCheckout.mjs +29 -0
- package/dist/src/builders/server/workspaceCheckout.mjs.map +1 -0
- package/dist/src/builders/web/bundle.cjs +225 -0
- package/dist/src/builders/web/bundle.cjs.map +1 -0
- package/dist/src/builders/web/bundle.d.mts +65 -0
- package/dist/src/builders/web/bundle.d.mts.map +1 -0
- package/dist/src/builders/web/bundle.mjs +221 -0
- package/dist/src/builders/web/bundle.mjs.map +1 -0
- package/dist/src/builders/web/bundleAssetPolicy.cjs +96 -0
- package/dist/src/builders/web/bundleAssetPolicy.cjs.map +1 -0
- package/dist/src/builders/web/bundleAssetPolicy.d.mts +22 -0
- package/dist/src/builders/web/bundleAssetPolicy.d.mts.map +1 -0
- package/dist/src/builders/web/bundleAssetPolicy.mjs +95 -0
- package/dist/src/builders/web/bundleAssetPolicy.mjs.map +1 -0
- package/dist/src/builders/web/index.cjs +361 -0
- package/dist/src/builders/web/index.cjs.map +1 -0
- package/dist/src/builders/web/index.d.mts +109 -0
- package/dist/src/builders/web/index.d.mts.map +1 -0
- package/dist/src/builders/web/index.mjs +342 -0
- package/dist/src/builders/web/index.mjs.map +1 -0
- package/dist/src/builders/web/webDevRoots.cjs +27 -0
- package/dist/src/builders/web/webDevRoots.cjs.map +1 -0
- package/dist/src/builders/web/webDevRoots.d.mts +22 -0
- package/dist/src/builders/web/webDevRoots.d.mts.map +1 -0
- package/dist/src/builders/web/webDevRoots.mjs +25 -0
- package/dist/src/builders/web/webDevRoots.mjs.map +1 -0
- package/dist/src/builders/web/webPluginGenerate.cjs +188 -0
- package/dist/src/builders/web/webPluginGenerate.cjs.map +1 -0
- package/dist/src/builders/web/webPluginGenerate.d.mts +56 -0
- package/dist/src/builders/web/webPluginGenerate.d.mts.map +1 -0
- package/dist/src/builders/web/webPluginGenerate.mjs +178 -0
- package/dist/src/builders/web/webPluginGenerate.mjs.map +1 -0
- package/dist/src/builders/web/webPluginManifest.cjs +128 -0
- package/dist/src/builders/web/webPluginManifest.cjs.map +1 -0
- package/dist/src/builders/web/webPluginManifest.d.mts +64 -0
- package/dist/src/builders/web/webPluginManifest.d.mts.map +1 -0
- package/dist/src/builders/web/webPluginManifest.mjs +118 -0
- package/dist/src/builders/web/webPluginManifest.mjs.map +1 -0
- package/dist/src/builders/web/webPluginScan.cjs +57 -0
- package/dist/src/builders/web/webPluginScan.cjs.map +1 -0
- package/dist/src/builders/web/webPluginScan.d.mts +19 -0
- package/dist/src/builders/web/webPluginScan.d.mts.map +1 -0
- package/dist/src/builders/web/webPluginScan.mjs +54 -0
- package/dist/src/builders/web/webPluginScan.mjs.map +1 -0
- package/dist/src/builders/web/webPluginVite.cjs +255 -0
- package/dist/src/builders/web/webPluginVite.cjs.map +1 -0
- package/dist/src/builders/web/webPluginVite.d.mts +64 -0
- package/dist/src/builders/web/webPluginVite.d.mts.map +1 -0
- package/dist/src/builders/web/webPluginVite.mjs +242 -0
- package/dist/src/builders/web/webPluginVite.mjs.map +1 -0
- package/dist/src/cli/cliApp.cjs +187 -0
- package/dist/src/cli/cliApp.cjs.map +1 -0
- package/dist/src/cli/cliApp.d.mts +32 -0
- package/dist/src/cli/cliApp.d.mts.map +1 -0
- package/dist/src/cli/cliApp.mjs +184 -0
- package/dist/src/cli/cliApp.mjs.map +1 -0
- package/dist/src/cli/commands/api-export/index.cjs +66 -0
- package/dist/src/cli/commands/api-export/index.cjs.map +1 -0
- package/dist/src/cli/commands/api-export/index.mjs +62 -0
- package/dist/src/cli/commands/api-export/index.mjs.map +1 -0
- package/dist/src/cli/commands/baseCommand.cjs +16 -0
- package/dist/src/cli/commands/baseCommand.cjs.map +1 -0
- package/dist/src/cli/commands/baseCommand.d.mts +24 -0
- package/dist/src/cli/commands/baseCommand.d.mts.map +1 -0
- package/dist/src/cli/commands/baseCommand.mjs +16 -0
- package/dist/src/cli/commands/baseCommand.mjs.map +1 -0
- package/dist/src/cli/commands/compat/context.cjs +115 -0
- package/dist/src/cli/commands/compat/context.cjs.map +1 -0
- package/dist/src/cli/commands/compat/context.d.mts +22 -0
- package/dist/src/cli/commands/compat/context.d.mts.map +1 -0
- package/dist/src/cli/commands/compat/context.mjs +110 -0
- package/dist/src/cli/commands/compat/context.mjs.map +1 -0
- package/dist/src/cli/commands/compat/help.cjs +26 -0
- package/dist/src/cli/commands/compat/help.cjs.map +1 -0
- package/dist/src/cli/commands/compat/help.d.mts +4 -0
- package/dist/src/cli/commands/compat/help.d.mts.map +1 -0
- package/dist/src/cli/commands/compat/help.mjs +25 -0
- package/dist/src/cli/commands/compat/help.mjs.map +1 -0
- package/dist/src/cli/commands/compat/index.cjs +73 -0
- package/dist/src/cli/commands/compat/index.cjs.map +1 -0
- package/dist/src/cli/commands/compat/index.d.mts +14 -0
- package/dist/src/cli/commands/compat/index.d.mts.map +1 -0
- package/dist/src/cli/commands/compat/index.mjs +70 -0
- package/dist/src/cli/commands/compat/index.mjs.map +1 -0
- package/dist/src/cli/commands/compat/options.cjs +88 -0
- package/dist/src/cli/commands/compat/options.cjs.map +1 -0
- package/dist/src/cli/commands/compat/options.d.mts +15 -0
- package/dist/src/cli/commands/compat/options.d.mts.map +1 -0
- package/dist/src/cli/commands/compat/options.mjs +86 -0
- package/dist/src/cli/commands/compat/options.mjs.map +1 -0
- package/dist/src/cli/commands/compat/providers/antigravity.cjs +294 -0
- package/dist/src/cli/commands/compat/providers/antigravity.cjs.map +1 -0
- package/dist/src/cli/commands/compat/providers/antigravity.d.mts +9 -0
- package/dist/src/cli/commands/compat/providers/antigravity.d.mts.map +1 -0
- package/dist/src/cli/commands/compat/providers/antigravity.mjs +289 -0
- package/dist/src/cli/commands/compat/providers/antigravity.mjs.map +1 -0
- package/dist/src/cli/commands/compat/providers/codex.cjs +178 -0
- package/dist/src/cli/commands/compat/providers/codex.cjs.map +1 -0
- package/dist/src/cli/commands/compat/providers/codex.d.mts +17 -0
- package/dist/src/cli/commands/compat/providers/codex.d.mts.map +1 -0
- package/dist/src/cli/commands/compat/providers/codex.mjs +170 -0
- package/dist/src/cli/commands/compat/providers/codex.mjs.map +1 -0
- package/dist/src/cli/commands/compat/providers/index.cjs +65 -0
- package/dist/src/cli/commands/compat/providers/index.cjs.map +1 -0
- package/dist/src/cli/commands/compat/providers/index.d.mts +15 -0
- package/dist/src/cli/commands/compat/providers/index.d.mts.map +1 -0
- package/dist/src/cli/commands/compat/providers/index.mjs +45 -0
- package/dist/src/cli/commands/compat/providers/index.mjs.map +1 -0
- package/dist/src/cli/commands/compat/providers/process.cjs +172 -0
- package/dist/src/cli/commands/compat/providers/process.cjs.map +1 -0
- package/dist/src/cli/commands/compat/providers/process.d.mts +33 -0
- package/dist/src/cli/commands/compat/providers/process.d.mts.map +1 -0
- package/dist/src/cli/commands/compat/providers/process.mjs +159 -0
- package/dist/src/cli/commands/compat/providers/process.mjs.map +1 -0
- package/dist/src/cli/commands/compat/providers/shared.cjs +76 -0
- package/dist/src/cli/commands/compat/providers/shared.cjs.map +1 -0
- package/dist/src/cli/commands/compat/providers/shared.d.mts +40 -0
- package/dist/src/cli/commands/compat/providers/shared.d.mts.map +1 -0
- package/dist/src/cli/commands/compat/providers/shared.mjs +61 -0
- package/dist/src/cli/commands/compat/providers/shared.mjs.map +1 -0
- package/dist/src/cli/commands/compat/types.d.mts +31 -0
- package/dist/src/cli/commands/compat/types.d.mts.map +1 -0
- package/dist/src/cli/commands/doctor/help.cjs +19 -0
- package/dist/src/cli/commands/doctor/help.cjs.map +1 -0
- package/dist/src/cli/commands/doctor/help.d.mts +4 -0
- package/dist/src/cli/commands/doctor/help.d.mts.map +1 -0
- package/dist/src/cli/commands/doctor/help.mjs +19 -0
- package/dist/src/cli/commands/doctor/help.mjs.map +1 -0
- package/dist/src/cli/commands/doctor/index.cjs +118 -0
- package/dist/src/cli/commands/doctor/index.cjs.map +1 -0
- package/dist/src/cli/commands/doctor/index.d.mts +33 -0
- package/dist/src/cli/commands/doctor/index.d.mts.map +1 -0
- package/dist/src/cli/commands/doctor/index.mjs +113 -0
- package/dist/src/cli/commands/doctor/index.mjs.map +1 -0
- package/dist/src/cli/commands/emit-mcp/index.cjs +32 -0
- package/dist/src/cli/commands/emit-mcp/index.cjs.map +1 -0
- package/dist/src/cli/commands/emit-mcp/index.d.mts +19 -0
- package/dist/src/cli/commands/emit-mcp/index.d.mts.map +1 -0
- package/dist/src/cli/commands/emit-mcp/index.mjs +31 -0
- package/dist/src/cli/commands/emit-mcp/index.mjs.map +1 -0
- package/dist/src/cli/commands/explain/index.cjs +155 -0
- package/dist/src/cli/commands/explain/index.cjs.map +1 -0
- package/dist/src/cli/commands/explain/index.d.mts +57 -0
- package/dist/src/cli/commands/explain/index.d.mts.map +1 -0
- package/dist/src/cli/commands/explain/index.mjs +150 -0
- package/dist/src/cli/commands/explain/index.mjs.map +1 -0
- package/dist/src/cli/commands/init/constants.cjs +11 -0
- package/dist/src/cli/commands/init/constants.cjs.map +1 -0
- package/dist/src/cli/commands/init/constants.mjs +11 -0
- package/dist/src/cli/commands/init/constants.mjs.map +1 -0
- package/dist/src/cli/commands/init/help.cjs +17 -0
- package/dist/src/cli/commands/init/help.cjs.map +1 -0
- package/dist/src/cli/commands/init/help.d.mts +4 -0
- package/dist/src/cli/commands/init/help.d.mts.map +1 -0
- package/dist/src/cli/commands/init/help.mjs +17 -0
- package/dist/src/cli/commands/init/help.mjs.map +1 -0
- package/dist/src/cli/commands/init/index.cjs +67 -0
- package/dist/src/cli/commands/init/index.cjs.map +1 -0
- package/dist/src/cli/commands/init/index.d.mts +12 -0
- package/dist/src/cli/commands/init/index.d.mts.map +1 -0
- package/dist/src/cli/commands/init/index.mjs +63 -0
- package/dist/src/cli/commands/init/index.mjs.map +1 -0
- package/dist/src/cli/commands/init/presenter.cjs +140 -0
- package/dist/src/cli/commands/init/presenter.cjs.map +1 -0
- package/dist/src/cli/commands/init/presenter.d.mts +8 -0
- package/dist/src/cli/commands/init/presenter.d.mts.map +1 -0
- package/dist/src/cli/commands/init/presenter.mjs +140 -0
- package/dist/src/cli/commands/init/presenter.mjs.map +1 -0
- package/dist/src/cli/commands/sync/help.cjs +34 -0
- package/dist/src/cli/commands/sync/help.cjs.map +1 -0
- package/dist/src/cli/commands/sync/help.d.mts +4 -0
- package/dist/src/cli/commands/sync/help.d.mts.map +1 -0
- package/dist/src/cli/commands/sync/help.mjs +34 -0
- package/dist/src/cli/commands/sync/help.mjs.map +1 -0
- package/dist/src/cli/commands/sync/index.cjs +215 -0
- package/dist/src/cli/commands/sync/index.cjs.map +1 -0
- package/dist/src/cli/commands/sync/index.d.mts +20 -0
- package/dist/src/cli/commands/sync/index.d.mts.map +1 -0
- package/dist/src/cli/commands/sync/index.mjs +206 -0
- package/dist/src/cli/commands/sync/index.mjs.map +1 -0
- package/dist/src/cli/commands/sync/presenter.cjs +58 -0
- package/dist/src/cli/commands/sync/presenter.cjs.map +1 -0
- package/dist/src/cli/commands/sync/presenter.d.mts +16 -0
- package/dist/src/cli/commands/sync/presenter.d.mts.map +1 -0
- package/dist/src/cli/commands/sync/presenter.mjs +57 -0
- package/dist/src/cli/commands/sync/presenter.mjs.map +1 -0
- package/dist/src/cli/commands/sync/workflow.cjs +16 -0
- package/dist/src/cli/commands/sync/workflow.cjs.map +1 -0
- package/dist/src/cli/commands/sync/workflow.mjs +16 -0
- package/dist/src/cli/commands/sync/workflow.mjs.map +1 -0
- package/dist/src/cli/commands/web/index.cjs +88 -0
- package/dist/src/cli/commands/web/index.cjs.map +1 -0
- package/dist/src/cli/commands/web/index.mjs +85 -0
- package/dist/src/cli/commands/web/index.mjs.map +1 -0
- package/dist/src/cli/harnessOptions.cjs +70 -0
- package/dist/src/cli/harnessOptions.cjs.map +1 -0
- package/dist/src/cli/harnessOptions.d.mts +26 -0
- package/dist/src/cli/harnessOptions.d.mts.map +1 -0
- package/dist/src/cli/harnessOptions.mjs +66 -0
- package/dist/src/cli/harnessOptions.mjs.map +1 -0
- package/dist/src/cli/help.cjs +82 -0
- package/dist/src/cli/help.cjs.map +1 -0
- package/dist/src/cli/help.d.mts +10 -0
- package/dist/src/cli/help.d.mts.map +1 -0
- package/dist/src/cli/help.mjs +78 -0
- package/dist/src/cli/help.mjs.map +1 -0
- package/dist/src/cli/matrixOptions.cjs +178 -0
- package/dist/src/cli/matrixOptions.cjs.map +1 -0
- package/dist/src/cli/matrixOptions.d.mts +90 -0
- package/dist/src/cli/matrixOptions.d.mts.map +1 -0
- package/dist/src/cli/matrixOptions.mjs +151 -0
- package/dist/src/cli/matrixOptions.mjs.map +1 -0
- package/dist/src/cli/options.cjs +281 -0
- package/dist/src/cli/options.cjs.map +1 -0
- package/dist/src/cli/options.d.mts +5 -0
- package/dist/src/cli/options.d.mts.map +1 -0
- package/dist/src/cli/options.mjs +279 -0
- package/dist/src/cli/options.mjs.map +1 -0
- package/dist/src/cli/router.cjs +57 -0
- package/dist/src/cli/router.cjs.map +1 -0
- package/dist/src/cli/router.d.mts +32 -0
- package/dist/src/cli/router.d.mts.map +1 -0
- package/dist/src/cli/router.mjs +54 -0
- package/dist/src/cli/router.mjs.map +1 -0
- package/dist/src/cli/server/options.cjs +71 -0
- package/dist/src/cli/server/options.cjs.map +1 -0
- package/dist/src/cli/server/options.mjs +70 -0
- package/dist/src/cli/server/options.mjs.map +1 -0
- package/dist/src/cli/server/processGuards.cjs +83 -0
- package/dist/src/cli/server/processGuards.cjs.map +1 -0
- package/dist/src/cli/server/processGuards.mjs +79 -0
- package/dist/src/cli/server/processGuards.mjs.map +1 -0
- package/dist/src/cli/server/run.cjs +69 -0
- package/dist/src/cli/server/run.cjs.map +1 -0
- package/dist/src/cli/server/run.mjs +66 -0
- package/dist/src/cli/server/run.mjs.map +1 -0
- package/dist/src/composition/harnessState/index.cjs +48 -0
- package/dist/src/composition/harnessState/index.cjs.map +1 -0
- package/dist/src/composition/harnessState/index.d.mts +19 -0
- package/dist/src/composition/harnessState/index.d.mts.map +1 -0
- package/dist/src/composition/harnessState/index.mjs +34 -0
- package/dist/src/composition/harnessState/index.mjs.map +1 -0
- package/dist/src/composition/layerPackageInstaller/index.cjs +651 -0
- package/dist/src/composition/layerPackageInstaller/index.cjs.map +1 -0
- package/dist/src/composition/layerPackageInstaller/index.d.mts +74 -0
- package/dist/src/composition/layerPackageInstaller/index.d.mts.map +1 -0
- package/dist/src/composition/layerPackageInstaller/index.mjs +637 -0
- package/dist/src/composition/layerPackageInstaller/index.mjs.map +1 -0
- package/dist/src/composition/poHomeMigration/index.cjs +234 -0
- package/dist/src/composition/poHomeMigration/index.cjs.map +1 -0
- package/dist/src/composition/poHomeMigration/index.d.mts +12 -0
- package/dist/src/composition/poHomeMigration/index.d.mts.map +1 -0
- package/dist/src/composition/poHomeMigration/index.mjs +226 -0
- package/dist/src/composition/poHomeMigration/index.mjs.map +1 -0
- package/dist/src/composition/projectTrust/index.cjs +51 -0
- package/dist/src/composition/projectTrust/index.cjs.map +1 -0
- package/dist/src/composition/projectTrust/index.d.mts +22 -0
- package/dist/src/composition/projectTrust/index.d.mts.map +1 -0
- package/dist/src/composition/projectTrust/index.mjs +48 -0
- package/dist/src/composition/projectTrust/index.mjs.map +1 -0
- package/dist/src/composition/repository/index.cjs +68 -0
- package/dist/src/composition/repository/index.cjs.map +1 -0
- package/dist/src/composition/repository/index.d.mts +22 -0
- package/dist/src/composition/repository/index.d.mts.map +1 -0
- package/dist/src/composition/repository/index.mjs +63 -0
- package/dist/src/composition/repository/index.mjs.map +1 -0
- package/dist/src/composition/syncPrune/index.cjs +85 -0
- package/dist/src/composition/syncPrune/index.cjs.map +1 -0
- package/dist/src/composition/syncPrune/index.d.mts +33 -0
- package/dist/src/composition/syncPrune/index.d.mts.map +1 -0
- package/dist/src/composition/syncPrune/index.mjs +82 -0
- package/dist/src/composition/syncPrune/index.mjs.map +1 -0
- package/dist/src/composition/syncService/index.cjs +808 -0
- package/dist/src/composition/syncService/index.cjs.map +1 -0
- package/dist/src/composition/syncService/index.d.mts +65 -0
- package/dist/src/composition/syncService/index.d.mts.map +1 -0
- package/dist/src/composition/syncService/index.mjs +792 -0
- package/dist/src/composition/syncService/index.mjs.map +1 -0
- package/dist/src/composition/syncService/localBuilds.cjs +367 -0
- package/dist/src/composition/syncService/localBuilds.cjs.map +1 -0
- package/dist/src/composition/syncService/localBuilds.mjs +358 -0
- package/dist/src/composition/syncService/localBuilds.mjs.map +1 -0
- package/dist/src/composition/transitionLayers.cjs +17 -0
- package/dist/src/composition/transitionLayers.cjs.map +1 -0
- package/dist/src/composition/transitionLayers.d.mts +6 -0
- package/dist/src/composition/transitionLayers.d.mts.map +1 -0
- package/dist/src/composition/transitionLayers.mjs +16 -0
- package/dist/src/composition/transitionLayers.mjs.map +1 -0
- package/dist/src/composition/types/harness.d.mts +52 -0
- package/dist/src/composition/types/harness.d.mts.map +1 -0
- package/dist/src/extensions/setupDiagnostics.cjs +65 -0
- package/dist/src/extensions/setupDiagnostics.cjs.map +1 -0
- package/dist/src/extensions/setupDiagnostics.mjs +64 -0
- package/dist/src/extensions/setupDiagnostics.mjs.map +1 -0
- package/dist/utils.cjs +4 -0
- package/dist/utils.d.mts +2 -0
- package/dist/utils.mjs +2 -0
- package/dist/webBuilder.cjs +59 -0
- package/dist/webBuilder.d.mts +9 -0
- package/dist/webBuilder.mjs +9 -0
- package/docs/server/api-export.md +86 -0
- package/docs/server/api.md +144 -0
- package/docs/server/getting-started.md +114 -0
- package/docs/server/index.md +67 -0
- package/docs/server/ipc.md +97 -0
- package/docs/server/lifecycle.md +108 -0
- package/docs/server/security.md +101 -0
- package/llms.txt +12 -0
- package/package.json +295 -0
- package/src/prompts/po-author-extension/SKILL.md +35 -0
- package/src/prompts/po-author-extension/references/extension-contract.md +134 -0
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
const require_runtime = require("../../../_virtual/_rolldown/runtime.cjs");
|
|
2
|
+
const require_webPluginScan = require("./webPluginScan.cjs");
|
|
3
|
+
let node_fs = require("node:fs");
|
|
4
|
+
node_fs = require_runtime.__toESM(node_fs, 1);
|
|
5
|
+
let node_path = require("node:path");
|
|
6
|
+
node_path = require_runtime.__toESM(node_path, 1);
|
|
7
|
+
let node_module = require("node:module");
|
|
8
|
+
let node_url = require("node:url");
|
|
9
|
+
//#region src/builders/web/webPluginGenerate.ts
|
|
10
|
+
const HEADER = "// Generated by po web builder. Do not edit by hand.";
|
|
11
|
+
/** The template po-web renders when a composition names none, so its classes always compile. */
|
|
12
|
+
const FALLBACK_TEMPLATE_PACKAGE = "@agimon-ai/po-template-advanced";
|
|
13
|
+
const BUILTIN_CLIENT_MODULE = node_path.default.join("src", "web", "app", "webPlugins.generated.ts");
|
|
14
|
+
const BUILTIN_CSS_MODULE = node_path.default.join("src", "web", "styles", "webPluginSources.generated.css");
|
|
15
|
+
/**
|
|
16
|
+
* The import name of one plugin copy, derived from its slot so two copies of one pluginId
|
|
17
|
+
* never collide. A host slot is its kebab-case pluginId and keeps the committed module's
|
|
18
|
+
* names; a copy slot's '.' becomes '_', which no host name can contain.
|
|
19
|
+
*/
|
|
20
|
+
function slotIdentifier(slot) {
|
|
21
|
+
return slot.replace(/-([a-z0-9])/g, (_, ch) => ch.toUpperCase()).replace(/[^A-Za-z0-9_$]/g, "_");
|
|
22
|
+
}
|
|
23
|
+
function relativeImport(fromDir, toFile) {
|
|
24
|
+
const spec = node_path.default.relative(fromDir, toFile).split(node_path.default.sep).join("/");
|
|
25
|
+
return spec.startsWith(".") ? spec : `./${spec}`;
|
|
26
|
+
}
|
|
27
|
+
function renderClientModule(plugins, style, packageRoot) {
|
|
28
|
+
const lines = [HEADER, "import type { WebPluginDefinition } from '@agimon-ai/po-core/web';"];
|
|
29
|
+
const names = [];
|
|
30
|
+
const fromDir = node_path.default.join(packageRoot, "src", "web", "app");
|
|
31
|
+
for (const plugin of plugins) {
|
|
32
|
+
const name = `${slotIdentifier(plugin.slot)}Plugin`;
|
|
33
|
+
names.push(name);
|
|
34
|
+
const entry = node_path.default.join(plugin.packageDir, plugin.client.entry);
|
|
35
|
+
const specifier = style === "relative" ? relativeImport(fromDir, entry) : (0, node_url.pathToFileURL)(node_fs.default.realpathSync(entry)).href;
|
|
36
|
+
lines.push(`import { webPlugin as ${name} } from '${specifier}';`);
|
|
37
|
+
}
|
|
38
|
+
lines.push("", `export const webPlugins: readonly WebPluginDefinition[] = [${names.join(", ")}];`, "");
|
|
39
|
+
return lines.join("\n");
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* The directory Tailwind scans for a plugin's class names.
|
|
43
|
+
*
|
|
44
|
+
* `src/extensions` wins, because a plugin's components colocate with the routed
|
|
45
|
+
* file that renders them, in private `_components` and `_lib` folders. The
|
|
46
|
+
* legacy `src/web` root is only a fallback: `existsSync` is true for a
|
|
47
|
+
* half-emptied directory holding nothing but a tsconfig, and packages have been
|
|
48
|
+
* in exactly that state, so preferring it would hand Tailwind a directory with
|
|
49
|
+
* no components in it and silently drop every class.
|
|
50
|
+
*
|
|
51
|
+
* The client entry's own directory is the last resort. It is published through
|
|
52
|
+
* `src/exports/webClient.ts`, a one-line re-export, or generated outside `src`
|
|
53
|
+
* entirely, so it holds no components either.
|
|
54
|
+
*/
|
|
55
|
+
function pluginSourceRoot(plugin) {
|
|
56
|
+
const routingRoot = node_path.default.join(plugin.packageDir, "src", "extensions");
|
|
57
|
+
if (node_fs.default.existsSync(routingRoot)) return routingRoot;
|
|
58
|
+
const webRoot = node_path.default.join(plugin.packageDir, "src", "web");
|
|
59
|
+
if (node_fs.default.existsSync(webRoot)) return webRoot;
|
|
60
|
+
return node_path.default.dirname(node_path.default.join(plugin.packageDir, plugin.client.entry));
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Where Tailwind finds the fallback template's classes. app.css names it by a
|
|
64
|
+
* path from its own folder into po-web's node_modules, which holds only in
|
|
65
|
+
* this repository; an installed po-web has the template beside it instead,
|
|
66
|
+
* so a sync build that scanned only that path shipped the cockpit without the
|
|
67
|
+
* template's responsive layout. Resolving it as Node does works in both.
|
|
68
|
+
*/
|
|
69
|
+
function fallbackTemplateSourceRoot(packageRoot) {
|
|
70
|
+
let manifest;
|
|
71
|
+
try {
|
|
72
|
+
manifest = (0, node_module.createRequire)(node_path.default.join(packageRoot, "package.json")).resolve(`${FALLBACK_TEMPLATE_PACKAGE}/package.json`);
|
|
73
|
+
} catch {
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
const extensions = node_path.default.join(node_path.default.dirname(manifest), "dist", "extensions");
|
|
77
|
+
return node_fs.default.existsSync(extensions) ? extensions : void 0;
|
|
78
|
+
}
|
|
79
|
+
function renderCssModule(plugins, leadingSourceRoots) {
|
|
80
|
+
const lines = [`/* ${HEADER.slice(3)} */`, ...leadingSourceRoots.map((root) => `@source "${root}";`)];
|
|
81
|
+
for (const plugin of plugins) {
|
|
82
|
+
if (plugin.isHost) continue;
|
|
83
|
+
lines.push(`@source "${pluginSourceRoot(plugin)}";`);
|
|
84
|
+
}
|
|
85
|
+
lines.push("");
|
|
86
|
+
return lines.join("\n");
|
|
87
|
+
}
|
|
88
|
+
/** The committed client registry, rendered from the host package alone. */
|
|
89
|
+
function renderBuiltinWebPluginModules(packageRoot) {
|
|
90
|
+
const plugins = require_webPluginScan.scanWebPlugins(packageRoot);
|
|
91
|
+
return /* @__PURE__ */ new Map([[BUILTIN_CLIENT_MODULE, renderClientModule(plugins, "relative", packageRoot)], [BUILTIN_CSS_MODULE, renderCssModule(plugins, [])]]);
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Keeps the committed client registry fresh: write-if-changed locally,
|
|
95
|
+
* check-only (throw) in CI. Both vite.config.ts and tsdown.config.ts call
|
|
96
|
+
* this at config-load time.
|
|
97
|
+
*/
|
|
98
|
+
function ensureBuiltinWebPluginModules({ packageRoot, check = false }) {
|
|
99
|
+
const stale = [];
|
|
100
|
+
for (const [relativePath, content] of renderBuiltinWebPluginModules(packageRoot)) {
|
|
101
|
+
const filePath = node_path.default.join(packageRoot, relativePath);
|
|
102
|
+
if ((node_fs.default.existsSync(filePath) ? node_fs.default.readFileSync(filePath, "utf8") : void 0) === content) continue;
|
|
103
|
+
if (check) {
|
|
104
|
+
stale.push(relativePath);
|
|
105
|
+
continue;
|
|
106
|
+
}
|
|
107
|
+
node_fs.default.mkdirSync(node_path.default.dirname(filePath), { recursive: true });
|
|
108
|
+
node_fs.default.writeFileSync(filePath, content);
|
|
109
|
+
}
|
|
110
|
+
if (stale.length > 0) throw new Error(`Stale generated web plugin modules: ${stale.join(", ")}. Run pnpm build in po-web and commit them.`);
|
|
111
|
+
}
|
|
112
|
+
/** The style entry of each plugin's Rollup input name, so each emits one content-hashed file. */
|
|
113
|
+
const BASE_STYLE_ENTRY = "base";
|
|
114
|
+
const pluginStyleEntryName = (slot) => `plugin-${slot}`;
|
|
115
|
+
/**
|
|
116
|
+
* One Tailwind entry per plugin: app.css with only the shell's sources plus that plugin's,
|
|
117
|
+
* so a mount that loads its plugins' files never receives another workspace's classes.
|
|
118
|
+
* Host plugins live in the shell's sources and share the base entry.
|
|
119
|
+
*/
|
|
120
|
+
function writeWebPluginStyleEntries(plugins, generatedDir, packageRoot) {
|
|
121
|
+
const stylesDir = node_path.default.join(generatedDir, "styles");
|
|
122
|
+
node_fs.default.mkdirSync(stylesDir, { recursive: true });
|
|
123
|
+
const fallbackTemplate = fallbackTemplateSourceRoot(packageRoot);
|
|
124
|
+
const baseSourcesPath = node_path.default.join(generatedDir, "webPluginBaseSources.generated.css");
|
|
125
|
+
node_fs.default.writeFileSync(baseSourcesPath, renderCssModule([], [node_path.default.join(packageRoot, "src", "web"), ...fallbackTemplate === void 0 ? [] : [fallbackTemplate]]));
|
|
126
|
+
const appCss = relativeImport(node_fs.default.realpathSync(stylesDir), node_fs.default.realpathSync(node_path.default.join(packageRoot, "src", "web", "styles", "app.css")));
|
|
127
|
+
const baseEntryPath = node_path.default.join(stylesDir, `${BASE_STYLE_ENTRY}.css`);
|
|
128
|
+
node_fs.default.writeFileSync(baseEntryPath, `/* ${HEADER.slice(3)} */\n@import '${appCss}';\n`);
|
|
129
|
+
const pluginEntryPaths = /* @__PURE__ */ new Map();
|
|
130
|
+
for (const plugin of plugins) {
|
|
131
|
+
if (plugin.isHost) continue;
|
|
132
|
+
const entryPath = node_path.default.join(stylesDir, `${pluginStyleEntryName(plugin.slot)}.css`);
|
|
133
|
+
node_fs.default.writeFileSync(entryPath, `/* ${HEADER.slice(3)} */\n@import '${appCss}';\n@source "${pluginSourceRoot(plugin)}";\n`);
|
|
134
|
+
pluginEntryPaths.set(plugin.slot, entryPath);
|
|
135
|
+
}
|
|
136
|
+
return {
|
|
137
|
+
baseSourcesPath,
|
|
138
|
+
baseEntryPath,
|
|
139
|
+
pluginEntryPaths
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* The sync-time variant: renders the full client plugin set (host built-ins plus
|
|
144
|
+
* the installed composition's packages) into a generation directory the bundler
|
|
145
|
+
* aliases over the committed builtin modules.
|
|
146
|
+
*/
|
|
147
|
+
function writeSyncWebPluginModules(plugins, generatedDir, packageRoot) {
|
|
148
|
+
node_fs.default.mkdirSync(generatedDir, { recursive: true });
|
|
149
|
+
const clientModulePath = node_path.default.join(generatedDir, "webPlugins.generated.ts");
|
|
150
|
+
const cssModulePath = node_path.default.join(generatedDir, "webPluginSources.generated.css");
|
|
151
|
+
node_fs.default.writeFileSync(clientModulePath, renderClientModule(plugins, "absolute", packageRoot));
|
|
152
|
+
const slotsDir = node_path.default.join(generatedDir, "slots");
|
|
153
|
+
node_fs.default.mkdirSync(slotsDir, { recursive: true });
|
|
154
|
+
const slotEntryPaths = {};
|
|
155
|
+
for (const plugin of plugins) {
|
|
156
|
+
const entryPath = node_path.default.join(slotsDir, `${plugin.slot}.ts`);
|
|
157
|
+
const specifier = (0, node_url.pathToFileURL)(node_fs.default.realpathSync(node_path.default.join(plugin.packageDir, plugin.client.entry))).href;
|
|
158
|
+
node_fs.default.writeFileSync(entryPath, `${HEADER}\nexport { webPlugin } from '${specifier}';\n`);
|
|
159
|
+
slotEntryPaths[plugin.slot] = entryPath;
|
|
160
|
+
}
|
|
161
|
+
const fallbackTemplate = fallbackTemplateSourceRoot(packageRoot);
|
|
162
|
+
const leadingSourceRoots = [node_path.default.join(packageRoot, "src", "web"), ...fallbackTemplate === void 0 ? [] : [fallbackTemplate]];
|
|
163
|
+
node_fs.default.writeFileSync(cssModulePath, renderCssModule(plugins, leadingSourceRoots));
|
|
164
|
+
const hostPlugins = plugins.filter((plugin) => plugin.isHost);
|
|
165
|
+
const shell = {
|
|
166
|
+
clientModulePath: node_path.default.join(generatedDir, "webPluginShell.generated.ts"),
|
|
167
|
+
cssModulePath: node_path.default.join(generatedDir, "webPluginShellSources.generated.css")
|
|
168
|
+
};
|
|
169
|
+
node_fs.default.writeFileSync(shell.clientModulePath, renderClientModule(hostPlugins, "absolute", packageRoot));
|
|
170
|
+
node_fs.default.writeFileSync(shell.cssModulePath, renderCssModule(hostPlugins, leadingSourceRoots));
|
|
171
|
+
return {
|
|
172
|
+
clientModulePath,
|
|
173
|
+
slotEntryPaths,
|
|
174
|
+
cssModulePath,
|
|
175
|
+
shell
|
|
176
|
+
};
|
|
177
|
+
}
|
|
178
|
+
//#endregion
|
|
179
|
+
exports.BASE_STYLE_ENTRY = BASE_STYLE_ENTRY;
|
|
180
|
+
exports.BUILTIN_CLIENT_MODULE = BUILTIN_CLIENT_MODULE;
|
|
181
|
+
exports.BUILTIN_CSS_MODULE = BUILTIN_CSS_MODULE;
|
|
182
|
+
exports.ensureBuiltinWebPluginModules = ensureBuiltinWebPluginModules;
|
|
183
|
+
exports.pluginStyleEntryName = pluginStyleEntryName;
|
|
184
|
+
exports.renderBuiltinWebPluginModules = renderBuiltinWebPluginModules;
|
|
185
|
+
exports.writeSyncWebPluginModules = writeSyncWebPluginModules;
|
|
186
|
+
exports.writeWebPluginStyleEntries = writeWebPluginStyleEntries;
|
|
187
|
+
|
|
188
|
+
//# sourceMappingURL=webPluginGenerate.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"webPluginGenerate.cjs","names":["path","pathToFileURL","fs","createRequire","scanWebPlugins"],"sources":["../../../../src/builders/web/webPluginGenerate.ts"],"sourcesContent":["import fs from 'node:fs';\nimport { createRequire } from 'node:module';\nimport path from 'node:path';\nimport { pathToFileURL } from 'node:url';\n\nimport type { DeclaredWebPlugin } from './webPluginManifest';\nimport { scanWebPlugins } from './webPluginScan';\n\nconst HEADER = '// Generated by po web builder. Do not edit by hand.';\n/** The template po-web renders when a composition names none, so its classes always compile. */\nconst FALLBACK_TEMPLATE_PACKAGE = '@agimon-ai/po-template-advanced';\nexport const BUILTIN_CLIENT_MODULE = path.join('src', 'web', 'app', 'webPlugins.generated.ts');\nexport const BUILTIN_CSS_MODULE = path.join('src', 'web', 'styles', 'webPluginSources.generated.css');\n\n/**\n * The import name of one plugin copy, derived from its slot so two copies of one pluginId\n * never collide. A host slot is its kebab-case pluginId and keeps the committed module's\n * names; a copy slot's '.' becomes '_', which no host name can contain.\n */\nfunction slotIdentifier(slot: string): string {\n return slot.replace(/-([a-z0-9])/g, (_, ch: string) => ch.toUpperCase()).replace(/[^A-Za-z0-9_$]/g, '_');\n}\n\nfunction relativeImport(fromDir: string, toFile: string): string {\n const spec = path.relative(fromDir, toFile).split(path.sep).join('/');\n return spec.startsWith('.') ? spec : `./${spec}`;\n}\n\nfunction renderClientModule(\n plugins: readonly DeclaredWebPlugin[],\n style: 'relative' | 'absolute',\n packageRoot: string,\n): string {\n const lines = [HEADER, \"import type { WebPluginDefinition } from '@agimon-ai/po-core/web';\"];\n const names: string[] = [];\n const fromDir = path.join(packageRoot, 'src', 'web', 'app');\n for (const plugin of plugins) {\n const name = `${slotIdentifier(plugin.slot)}Plugin`;\n names.push(name);\n const entry = path.join(plugin.packageDir, plugin.client.entry);\n // The committed builtin module keeps machine-neutral relative imports; the\n // sync-generated module lives outside src, is aliased over the committed\n // path, and resolves imports against its real location, so every entry\n // becomes an absolute file URL into the installed packages.\n const specifier =\n style === 'relative' ? relativeImport(fromDir, entry) : pathToFileURL(fs.realpathSync(entry)).href;\n lines.push(`import { webPlugin as ${name} } from '${specifier}';`);\n }\n lines.push('', `export const webPlugins: readonly WebPluginDefinition[] = [${names.join(', ')}];`, '');\n return lines.join('\\n');\n}\n\n/**\n * The directory Tailwind scans for a plugin's class names.\n *\n * `src/extensions` wins, because a plugin's components colocate with the routed\n * file that renders them, in private `_components` and `_lib` folders. The\n * legacy `src/web` root is only a fallback: `existsSync` is true for a\n * half-emptied directory holding nothing but a tsconfig, and packages have been\n * in exactly that state, so preferring it would hand Tailwind a directory with\n * no components in it and silently drop every class.\n *\n * The client entry's own directory is the last resort. It is published through\n * `src/exports/webClient.ts`, a one-line re-export, or generated outside `src`\n * entirely, so it holds no components either.\n */\nfunction pluginSourceRoot(plugin: DeclaredWebPlugin): string {\n const routingRoot = path.join(plugin.packageDir, 'src', 'extensions');\n if (fs.existsSync(routingRoot)) return routingRoot;\n const webRoot = path.join(plugin.packageDir, 'src', 'web');\n if (fs.existsSync(webRoot)) return webRoot;\n return path.dirname(path.join(plugin.packageDir, plugin.client.entry));\n}\n\n/**\n * Where Tailwind finds the fallback template's classes. app.css names it by a\n * path from its own folder into po-web's node_modules, which holds only in\n * this repository; an installed po-web has the template beside it instead,\n * so a sync build that scanned only that path shipped the cockpit without the\n * template's responsive layout. Resolving it as Node does works in both.\n */\nfunction fallbackTemplateSourceRoot(packageRoot: string): string | undefined {\n let manifest: string;\n try {\n manifest = createRequire(path.join(packageRoot, 'package.json')).resolve(\n `${FALLBACK_TEMPLATE_PACKAGE}/package.json`,\n );\n } catch {\n // Not installed: the cockpit then has no fallback template to render either.\n return undefined;\n }\n const extensions = path.join(path.dirname(manifest), 'dist', 'extensions');\n return fs.existsSync(extensions) ? extensions : undefined;\n}\n\nfunction renderCssModule(plugins: readonly DeclaredWebPlugin[], leadingSourceRoots: readonly string[]): string {\n // Sync CSS is compiled from a generated directory, so Tailwind cannot infer\n // the stable shell tree from app.css. Its caller names that tree explicitly\n // so later plugin utilities do not override missing responsive shell utilities.\n const lines = [`/* ${HEADER.slice(3)} */`, ...leadingSourceRoots.map((root) => `@source \"${root}\";`)];\n for (const plugin of plugins) {\n if (plugin.isHost) continue;\n lines.push(`@source \"${pluginSourceRoot(plugin)}\";`);\n }\n lines.push('');\n return lines.join('\\n');\n}\n\n/** The committed client registry, rendered from the host package alone. */\nexport function renderBuiltinWebPluginModules(packageRoot: string): Map<string, string> {\n const plugins = scanWebPlugins(packageRoot);\n return new Map([\n [BUILTIN_CLIENT_MODULE, renderClientModule(plugins, 'relative', packageRoot)],\n [BUILTIN_CSS_MODULE, renderCssModule(plugins, [])],\n ]);\n}\n\n/**\n * Keeps the committed client registry fresh: write-if-changed locally,\n * check-only (throw) in CI. Both vite.config.ts and tsdown.config.ts call\n * this at config-load time.\n */\nexport function ensureBuiltinWebPluginModules({\n packageRoot,\n check = false,\n}: {\n packageRoot: string;\n check?: boolean;\n}): void {\n const stale: string[] = [];\n for (const [relativePath, content] of renderBuiltinWebPluginModules(packageRoot)) {\n const filePath = path.join(packageRoot, relativePath);\n const existing = fs.existsSync(filePath) ? fs.readFileSync(filePath, 'utf8') : undefined;\n if (existing === content) continue;\n if (check) {\n stale.push(relativePath);\n continue;\n }\n fs.mkdirSync(path.dirname(filePath), { recursive: true });\n fs.writeFileSync(filePath, content);\n }\n if (stale.length > 0) {\n throw new Error(\n `Stale generated web plugin modules: ${stale.join(', ')}. Run pnpm build in po-web and commit them.`,\n );\n }\n}\n\n/** A client plugin registry and the Tailwind source list that goes with it. */\nexport interface WebPluginRegistryModules {\n clientModulePath: string;\n cssModulePath: string;\n}\n\nexport interface SyncGeneratedModules extends WebPluginRegistryModules {\n /** One entry module per slot, each re-exporting only that copy's `webPlugin`. */\n slotEntryPaths: Record<string, string>;\n /**\n * The signed shell's registry: host plugins only. Every other plugin reaches the\n * browser through its slot entry, and the global mount replaces the shell's\n * registry once it loads, so compiling them into the shell too shipped each plugin's\n * code and emitted assets (the voice VAD model among them) a second time.\n */\n shell: WebPluginRegistryModules;\n}\n\nexport interface WebPluginStyleEntries {\n /** Shell and fallback-template sources only, aliased over app.css's plugin source list. */\n baseSourcesPath: string;\n /** The stylesheet every plugin entry extends; a mount with no plugin styles loads it alone. */\n baseEntryPath: string;\n /** One stylesheet entry per non-host plugin copy, keyed by its slot. */\n pluginEntryPaths: Map<string, string>;\n}\n\n/** The style entry of each plugin's Rollup input name, so each emits one content-hashed file. */\nexport const BASE_STYLE_ENTRY = 'base';\nexport const pluginStyleEntryName = (slot: string): string => `plugin-${slot}`;\n\n/**\n * One Tailwind entry per plugin: app.css with only the shell's sources plus that plugin's,\n * so a mount that loads its plugins' files never receives another workspace's classes.\n * Host plugins live in the shell's sources and share the base entry.\n */\nexport function writeWebPluginStyleEntries(\n plugins: readonly DeclaredWebPlugin[],\n generatedDir: string,\n packageRoot: string,\n): WebPluginStyleEntries {\n const stylesDir = path.join(generatedDir, 'styles');\n fs.mkdirSync(stylesDir, { recursive: true });\n const fallbackTemplate = fallbackTemplateSourceRoot(packageRoot);\n const baseSourcesPath = path.join(generatedDir, 'webPluginBaseSources.generated.css');\n fs.writeFileSync(\n baseSourcesPath,\n renderCssModule(\n [],\n [path.join(packageRoot, 'src', 'web'), ...(fallbackTemplate === undefined ? [] : [fallbackTemplate])],\n ),\n );\n // Resolvers follow real paths (a temp dir under /var is /private/var), so relate real paths.\n const appCss = relativeImport(\n fs.realpathSync(stylesDir),\n fs.realpathSync(path.join(packageRoot, 'src', 'web', 'styles', 'app.css')),\n );\n const baseEntryPath = path.join(stylesDir, `${BASE_STYLE_ENTRY}.css`);\n fs.writeFileSync(baseEntryPath, `/* ${HEADER.slice(3)} */\\n@import '${appCss}';\\n`);\n const pluginEntryPaths = new Map<string, string>();\n for (const plugin of plugins) {\n if (plugin.isHost) continue;\n const entryPath = path.join(stylesDir, `${pluginStyleEntryName(plugin.slot)}.css`);\n fs.writeFileSync(\n entryPath,\n `/* ${HEADER.slice(3)} */\\n@import '${appCss}';\\n@source \"${pluginSourceRoot(plugin)}\";\\n`,\n );\n pluginEntryPaths.set(plugin.slot, entryPath);\n }\n return { baseSourcesPath, baseEntryPath, pluginEntryPaths };\n}\n\n/**\n * The sync-time variant: renders the full client plugin set (host built-ins plus\n * the installed composition's packages) into a generation directory the bundler\n * aliases over the committed builtin modules.\n */\nexport function writeSyncWebPluginModules(\n plugins: readonly DeclaredWebPlugin[],\n generatedDir: string,\n packageRoot: string,\n): SyncGeneratedModules {\n fs.mkdirSync(generatedDir, { recursive: true });\n const clientModulePath = path.join(generatedDir, 'webPlugins.generated.ts');\n const cssModulePath = path.join(generatedDir, 'webPluginSources.generated.css');\n fs.writeFileSync(clientModulePath, renderClientModule(plugins, 'absolute', packageRoot));\n // Styles are built per plugin by writeWebPluginStyleEntries, so slot entries carry none.\n const slotsDir = path.join(generatedDir, 'slots');\n fs.mkdirSync(slotsDir, { recursive: true });\n const slotEntryPaths: Record<string, string> = {};\n for (const plugin of plugins) {\n const entryPath = path.join(slotsDir, `${plugin.slot}.ts`);\n const specifier = pathToFileURL(fs.realpathSync(path.join(plugin.packageDir, plugin.client.entry))).href;\n fs.writeFileSync(entryPath, `${HEADER}\\nexport { webPlugin } from '${specifier}';\\n`);\n slotEntryPaths[plugin.slot] = entryPath;\n }\n const fallbackTemplate = fallbackTemplateSourceRoot(packageRoot);\n const leadingSourceRoots = [\n path.join(packageRoot, 'src', 'web'),\n ...(fallbackTemplate === undefined ? [] : [fallbackTemplate]),\n ];\n fs.writeFileSync(cssModulePath, renderCssModule(plugins, leadingSourceRoots));\n const hostPlugins = plugins.filter((plugin) => plugin.isHost);\n const shell = {\n clientModulePath: path.join(generatedDir, 'webPluginShell.generated.ts'),\n cssModulePath: path.join(generatedDir, 'webPluginShellSources.generated.css'),\n };\n fs.writeFileSync(shell.clientModulePath, renderClientModule(hostPlugins, 'absolute', packageRoot));\n fs.writeFileSync(shell.cssModulePath, renderCssModule(hostPlugins, leadingSourceRoots));\n return {\n clientModulePath,\n slotEntryPaths,\n cssModulePath,\n shell,\n };\n}\n"],"mappings":";;;;;;;;;AAQA,MAAM,SAAS;;AAEf,MAAM,4BAA4B;AAClC,MAAa,wBAAwBA,UAAAA,QAAK,KAAK,OAAO,OAAO,OAAO,yBAAyB;AAC7F,MAAa,qBAAqBA,UAAAA,QAAK,KAAK,OAAO,OAAO,UAAU,gCAAgC;;;;;;AAOpG,SAAS,eAAe,MAAsB;CAC5C,OAAO,KAAK,QAAQ,iBAAiB,GAAG,OAAe,GAAG,YAAY,CAAC,CAAC,CAAC,QAAQ,mBAAmB,GAAG;AACzG;AAEA,SAAS,eAAe,SAAiB,QAAwB;CAC/D,MAAM,OAAOA,UAAAA,QAAK,SAAS,SAAS,MAAM,CAAC,CAAC,MAAMA,UAAAA,QAAK,GAAG,CAAC,CAAC,KAAK,GAAG;CACpE,OAAO,KAAK,WAAW,GAAG,IAAI,OAAO,KAAK;AAC5C;AAEA,SAAS,mBACP,SACA,OACA,aACQ;CACR,MAAM,QAAQ,CAAC,QAAQ,oEAAoE;CAC3F,MAAM,QAAkB,CAAC;CACzB,MAAM,UAAUA,UAAAA,QAAK,KAAK,aAAa,OAAO,OAAO,KAAK;CAC1D,KAAK,MAAM,UAAU,SAAS;EAC5B,MAAM,OAAO,GAAG,eAAe,OAAO,IAAI,EAAE;EAC5C,MAAM,KAAK,IAAI;EACf,MAAM,QAAQA,UAAAA,QAAK,KAAK,OAAO,YAAY,OAAO,OAAO,KAAK;EAK9D,MAAM,YACJ,UAAU,aAAa,eAAe,SAAS,KAAK,KAAA,GAAIC,SAAAA,cAAAA,CAAcC,QAAAA,QAAG,aAAa,KAAK,CAAC,CAAC,CAAC;EAChG,MAAM,KAAK,yBAAyB,KAAK,WAAW,UAAU,GAAG;CACnE;CACA,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cAAc,WAAW,GAAG,OAAO,+BAA+B,UAAU,KAAK;EACpF,eAAe,OAAO,QAAQ;CAChC;CACA,MAAM,mBAAmB,2BAA2B,WAAW;CAC/D,MAAM,qBAAqB,CACzBA,UAAAA,QAAK,KAAK,aAAa,OAAO,KAAK,GACnC,GAAI,qBAAqB,KAAA,IAAY,CAAC,IAAI,CAAC,gBAAgB,CAC7D;CACA,QAAA,QAAG,cAAc,eAAe,gBAAgB,SAAS,kBAAkB,CAAC;CAC5E,MAAM,cAAc,QAAQ,QAAQ,WAAW,OAAO,MAAM;CAC5D,MAAM,QAAQ;EACZ,kBAAkBA,UAAAA,QAAK,KAAK,cAAc,6BAA6B;EACvE,eAAeA,UAAAA,QAAK,KAAK,cAAc,qCAAqC;CAC9E;CACA,QAAA,QAAG,cAAc,MAAM,kBAAkB,mBAAmB,aAAa,YAAY,WAAW,CAAC;CACjG,QAAA,QAAG,cAAc,MAAM,eAAe,gBAAgB,aAAa,kBAAkB,CAAC;CACtF,OAAO;EACL;EACA;EACA;EACA;CACF;AACF"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { DeclaredWebPlugin } from "./webPluginManifest.mjs";
|
|
2
|
+
//#region src/builders/web/webPluginGenerate.d.ts
|
|
3
|
+
export declare const BUILTIN_CLIENT_MODULE: string;
|
|
4
|
+
export declare const BUILTIN_CSS_MODULE: string;
|
|
5
|
+
/** The committed client registry, rendered from the host package alone. */
|
|
6
|
+
export declare function renderBuiltinWebPluginModules(packageRoot: string): Map<string, string>;
|
|
7
|
+
/**
|
|
8
|
+
* Keeps the committed client registry fresh: write-if-changed locally,
|
|
9
|
+
* check-only (throw) in CI. Both vite.config.ts and tsdown.config.ts call
|
|
10
|
+
* this at config-load time.
|
|
11
|
+
*/
|
|
12
|
+
export declare function ensureBuiltinWebPluginModules({ packageRoot, check }: {
|
|
13
|
+
packageRoot: string;
|
|
14
|
+
check?: boolean;
|
|
15
|
+
}): void;
|
|
16
|
+
/** A client plugin registry and the Tailwind source list that goes with it. */
|
|
17
|
+
export interface WebPluginRegistryModules {
|
|
18
|
+
clientModulePath: string;
|
|
19
|
+
cssModulePath: string;
|
|
20
|
+
}
|
|
21
|
+
export interface SyncGeneratedModules extends WebPluginRegistryModules {
|
|
22
|
+
/** One entry module per slot, each re-exporting only that copy's `webPlugin`. */
|
|
23
|
+
slotEntryPaths: Record<string, string>;
|
|
24
|
+
/**
|
|
25
|
+
* The signed shell's registry: host plugins only. Every other plugin reaches the
|
|
26
|
+
* browser through its slot entry, and the global mount replaces the shell's
|
|
27
|
+
* registry once it loads, so compiling them into the shell too shipped each plugin's
|
|
28
|
+
* code and emitted assets (the voice VAD model among them) a second time.
|
|
29
|
+
*/
|
|
30
|
+
shell: WebPluginRegistryModules;
|
|
31
|
+
}
|
|
32
|
+
export interface WebPluginStyleEntries {
|
|
33
|
+
/** Shell and fallback-template sources only, aliased over app.css's plugin source list. */
|
|
34
|
+
baseSourcesPath: string;
|
|
35
|
+
/** The stylesheet every plugin entry extends; a mount with no plugin styles loads it alone. */
|
|
36
|
+
baseEntryPath: string;
|
|
37
|
+
/** One stylesheet entry per non-host plugin copy, keyed by its slot. */
|
|
38
|
+
pluginEntryPaths: Map<string, string>;
|
|
39
|
+
}
|
|
40
|
+
/** The style entry of each plugin's Rollup input name, so each emits one content-hashed file. */
|
|
41
|
+
export declare const BASE_STYLE_ENTRY = "base";
|
|
42
|
+
export declare const pluginStyleEntryName: (slot: string) => string;
|
|
43
|
+
/**
|
|
44
|
+
* One Tailwind entry per plugin: app.css with only the shell's sources plus that plugin's,
|
|
45
|
+
* so a mount that loads its plugins' files never receives another workspace's classes.
|
|
46
|
+
* Host plugins live in the shell's sources and share the base entry.
|
|
47
|
+
*/
|
|
48
|
+
export declare function writeWebPluginStyleEntries(plugins: readonly DeclaredWebPlugin[], generatedDir: string, packageRoot: string): WebPluginStyleEntries;
|
|
49
|
+
/**
|
|
50
|
+
* The sync-time variant: renders the full client plugin set (host built-ins plus
|
|
51
|
+
* the installed composition's packages) into a generation directory the bundler
|
|
52
|
+
* aliases over the committed builtin modules.
|
|
53
|
+
*/
|
|
54
|
+
export declare function writeSyncWebPluginModules(plugins: readonly DeclaredWebPlugin[], generatedDir: string, packageRoot: string): SyncGeneratedModules;
|
|
55
|
+
//#endregion
|
|
56
|
+
//# sourceMappingURL=webPluginGenerate.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"webPluginGenerate.d.mts","names":[],"sources":["../../../../src/builders/web/webPluginGenerate.ts"],"mappings":";;qBAWa;qBACA;;wBAiGG,8BAA8B,sBAAsB;;;;;;wBAapD,gCACd,aACA;EAEA;EACA;;;iBAsBe;EACf;EACA;;iBAGe,6BAA6B;;EAE5C,gBAAgB;;;;;;;EAOhB,OAAO;;iBAGQ;;EAEf;;EAEA;;EAEA,kBAAkB;;;qBAIP;qBACA,uBAAoB;;;;;;wBAOjB,2BACd,kBAAkB,qBAClB,sBACA,sBACC;;;;;;wBAqCa,0BACd,kBAAkB,qBAClB,sBACA,sBACC"}
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
import { scanWebPlugins } from "./webPluginScan.mjs";
|
|
2
|
+
import { createRequire } from "node:module";
|
|
3
|
+
import fs from "node:fs";
|
|
4
|
+
import path from "node:path";
|
|
5
|
+
import { pathToFileURL } from "node:url";
|
|
6
|
+
//#region src/builders/web/webPluginGenerate.ts
|
|
7
|
+
const HEADER = "// Generated by po web builder. Do not edit by hand.";
|
|
8
|
+
/** The template po-web renders when a composition names none, so its classes always compile. */
|
|
9
|
+
const FALLBACK_TEMPLATE_PACKAGE = "@agimon-ai/po-template-advanced";
|
|
10
|
+
const BUILTIN_CLIENT_MODULE = path.join("src", "web", "app", "webPlugins.generated.ts");
|
|
11
|
+
const BUILTIN_CSS_MODULE = path.join("src", "web", "styles", "webPluginSources.generated.css");
|
|
12
|
+
/**
|
|
13
|
+
* The import name of one plugin copy, derived from its slot so two copies of one pluginId
|
|
14
|
+
* never collide. A host slot is its kebab-case pluginId and keeps the committed module's
|
|
15
|
+
* names; a copy slot's '.' becomes '_', which no host name can contain.
|
|
16
|
+
*/
|
|
17
|
+
function slotIdentifier(slot) {
|
|
18
|
+
return slot.replace(/-([a-z0-9])/g, (_, ch) => ch.toUpperCase()).replace(/[^A-Za-z0-9_$]/g, "_");
|
|
19
|
+
}
|
|
20
|
+
function relativeImport(fromDir, toFile) {
|
|
21
|
+
const spec = path.relative(fromDir, toFile).split(path.sep).join("/");
|
|
22
|
+
return spec.startsWith(".") ? spec : `./${spec}`;
|
|
23
|
+
}
|
|
24
|
+
function renderClientModule(plugins, style, packageRoot) {
|
|
25
|
+
const lines = [HEADER, "import type { WebPluginDefinition } from '@agimon-ai/po-core/web';"];
|
|
26
|
+
const names = [];
|
|
27
|
+
const fromDir = path.join(packageRoot, "src", "web", "app");
|
|
28
|
+
for (const plugin of plugins) {
|
|
29
|
+
const name = `${slotIdentifier(plugin.slot)}Plugin`;
|
|
30
|
+
names.push(name);
|
|
31
|
+
const entry = path.join(plugin.packageDir, plugin.client.entry);
|
|
32
|
+
const specifier = style === "relative" ? relativeImport(fromDir, entry) : pathToFileURL(fs.realpathSync(entry)).href;
|
|
33
|
+
lines.push(`import { webPlugin as ${name} } from '${specifier}';`);
|
|
34
|
+
}
|
|
35
|
+
lines.push("", `export const webPlugins: readonly WebPluginDefinition[] = [${names.join(", ")}];`, "");
|
|
36
|
+
return lines.join("\n");
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* The directory Tailwind scans for a plugin's class names.
|
|
40
|
+
*
|
|
41
|
+
* `src/extensions` wins, because a plugin's components colocate with the routed
|
|
42
|
+
* file that renders them, in private `_components` and `_lib` folders. The
|
|
43
|
+
* legacy `src/web` root is only a fallback: `existsSync` is true for a
|
|
44
|
+
* half-emptied directory holding nothing but a tsconfig, and packages have been
|
|
45
|
+
* in exactly that state, so preferring it would hand Tailwind a directory with
|
|
46
|
+
* no components in it and silently drop every class.
|
|
47
|
+
*
|
|
48
|
+
* The client entry's own directory is the last resort. It is published through
|
|
49
|
+
* `src/exports/webClient.ts`, a one-line re-export, or generated outside `src`
|
|
50
|
+
* entirely, so it holds no components either.
|
|
51
|
+
*/
|
|
52
|
+
function pluginSourceRoot(plugin) {
|
|
53
|
+
const routingRoot = path.join(plugin.packageDir, "src", "extensions");
|
|
54
|
+
if (fs.existsSync(routingRoot)) return routingRoot;
|
|
55
|
+
const webRoot = path.join(plugin.packageDir, "src", "web");
|
|
56
|
+
if (fs.existsSync(webRoot)) return webRoot;
|
|
57
|
+
return path.dirname(path.join(plugin.packageDir, plugin.client.entry));
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Where Tailwind finds the fallback template's classes. app.css names it by a
|
|
61
|
+
* path from its own folder into po-web's node_modules, which holds only in
|
|
62
|
+
* this repository; an installed po-web has the template beside it instead,
|
|
63
|
+
* so a sync build that scanned only that path shipped the cockpit without the
|
|
64
|
+
* template's responsive layout. Resolving it as Node does works in both.
|
|
65
|
+
*/
|
|
66
|
+
function fallbackTemplateSourceRoot(packageRoot) {
|
|
67
|
+
let manifest;
|
|
68
|
+
try {
|
|
69
|
+
manifest = createRequire(path.join(packageRoot, "package.json")).resolve(`${FALLBACK_TEMPLATE_PACKAGE}/package.json`);
|
|
70
|
+
} catch {
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
const extensions = path.join(path.dirname(manifest), "dist", "extensions");
|
|
74
|
+
return fs.existsSync(extensions) ? extensions : void 0;
|
|
75
|
+
}
|
|
76
|
+
function renderCssModule(plugins, leadingSourceRoots) {
|
|
77
|
+
const lines = [`/* ${HEADER.slice(3)} */`, ...leadingSourceRoots.map((root) => `@source "${root}";`)];
|
|
78
|
+
for (const plugin of plugins) {
|
|
79
|
+
if (plugin.isHost) continue;
|
|
80
|
+
lines.push(`@source "${pluginSourceRoot(plugin)}";`);
|
|
81
|
+
}
|
|
82
|
+
lines.push("");
|
|
83
|
+
return lines.join("\n");
|
|
84
|
+
}
|
|
85
|
+
/** The committed client registry, rendered from the host package alone. */
|
|
86
|
+
function renderBuiltinWebPluginModules(packageRoot) {
|
|
87
|
+
const plugins = scanWebPlugins(packageRoot);
|
|
88
|
+
return /* @__PURE__ */ new Map([[BUILTIN_CLIENT_MODULE, renderClientModule(plugins, "relative", packageRoot)], [BUILTIN_CSS_MODULE, renderCssModule(plugins, [])]]);
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Keeps the committed client registry fresh: write-if-changed locally,
|
|
92
|
+
* check-only (throw) in CI. Both vite.config.ts and tsdown.config.ts call
|
|
93
|
+
* this at config-load time.
|
|
94
|
+
*/
|
|
95
|
+
function ensureBuiltinWebPluginModules({ packageRoot, check = false }) {
|
|
96
|
+
const stale = [];
|
|
97
|
+
for (const [relativePath, content] of renderBuiltinWebPluginModules(packageRoot)) {
|
|
98
|
+
const filePath = path.join(packageRoot, relativePath);
|
|
99
|
+
if ((fs.existsSync(filePath) ? fs.readFileSync(filePath, "utf8") : void 0) === content) continue;
|
|
100
|
+
if (check) {
|
|
101
|
+
stale.push(relativePath);
|
|
102
|
+
continue;
|
|
103
|
+
}
|
|
104
|
+
fs.mkdirSync(path.dirname(filePath), { recursive: true });
|
|
105
|
+
fs.writeFileSync(filePath, content);
|
|
106
|
+
}
|
|
107
|
+
if (stale.length > 0) throw new Error(`Stale generated web plugin modules: ${stale.join(", ")}. Run pnpm build in po-web and commit them.`);
|
|
108
|
+
}
|
|
109
|
+
/** The style entry of each plugin's Rollup input name, so each emits one content-hashed file. */
|
|
110
|
+
const BASE_STYLE_ENTRY = "base";
|
|
111
|
+
const pluginStyleEntryName = (slot) => `plugin-${slot}`;
|
|
112
|
+
/**
|
|
113
|
+
* One Tailwind entry per plugin: app.css with only the shell's sources plus that plugin's,
|
|
114
|
+
* so a mount that loads its plugins' files never receives another workspace's classes.
|
|
115
|
+
* Host plugins live in the shell's sources and share the base entry.
|
|
116
|
+
*/
|
|
117
|
+
function writeWebPluginStyleEntries(plugins, generatedDir, packageRoot) {
|
|
118
|
+
const stylesDir = path.join(generatedDir, "styles");
|
|
119
|
+
fs.mkdirSync(stylesDir, { recursive: true });
|
|
120
|
+
const fallbackTemplate = fallbackTemplateSourceRoot(packageRoot);
|
|
121
|
+
const baseSourcesPath = path.join(generatedDir, "webPluginBaseSources.generated.css");
|
|
122
|
+
fs.writeFileSync(baseSourcesPath, renderCssModule([], [path.join(packageRoot, "src", "web"), ...fallbackTemplate === void 0 ? [] : [fallbackTemplate]]));
|
|
123
|
+
const appCss = relativeImport(fs.realpathSync(stylesDir), fs.realpathSync(path.join(packageRoot, "src", "web", "styles", "app.css")));
|
|
124
|
+
const baseEntryPath = path.join(stylesDir, `${BASE_STYLE_ENTRY}.css`);
|
|
125
|
+
fs.writeFileSync(baseEntryPath, `/* ${HEADER.slice(3)} */\n@import '${appCss}';\n`);
|
|
126
|
+
const pluginEntryPaths = /* @__PURE__ */ new Map();
|
|
127
|
+
for (const plugin of plugins) {
|
|
128
|
+
if (plugin.isHost) continue;
|
|
129
|
+
const entryPath = path.join(stylesDir, `${pluginStyleEntryName(plugin.slot)}.css`);
|
|
130
|
+
fs.writeFileSync(entryPath, `/* ${HEADER.slice(3)} */\n@import '${appCss}';\n@source "${pluginSourceRoot(plugin)}";\n`);
|
|
131
|
+
pluginEntryPaths.set(plugin.slot, entryPath);
|
|
132
|
+
}
|
|
133
|
+
return {
|
|
134
|
+
baseSourcesPath,
|
|
135
|
+
baseEntryPath,
|
|
136
|
+
pluginEntryPaths
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* The sync-time variant: renders the full client plugin set (host built-ins plus
|
|
141
|
+
* the installed composition's packages) into a generation directory the bundler
|
|
142
|
+
* aliases over the committed builtin modules.
|
|
143
|
+
*/
|
|
144
|
+
function writeSyncWebPluginModules(plugins, generatedDir, packageRoot) {
|
|
145
|
+
fs.mkdirSync(generatedDir, { recursive: true });
|
|
146
|
+
const clientModulePath = path.join(generatedDir, "webPlugins.generated.ts");
|
|
147
|
+
const cssModulePath = path.join(generatedDir, "webPluginSources.generated.css");
|
|
148
|
+
fs.writeFileSync(clientModulePath, renderClientModule(plugins, "absolute", packageRoot));
|
|
149
|
+
const slotsDir = path.join(generatedDir, "slots");
|
|
150
|
+
fs.mkdirSync(slotsDir, { recursive: true });
|
|
151
|
+
const slotEntryPaths = {};
|
|
152
|
+
for (const plugin of plugins) {
|
|
153
|
+
const entryPath = path.join(slotsDir, `${plugin.slot}.ts`);
|
|
154
|
+
const specifier = pathToFileURL(fs.realpathSync(path.join(plugin.packageDir, plugin.client.entry))).href;
|
|
155
|
+
fs.writeFileSync(entryPath, `${HEADER}\nexport { webPlugin } from '${specifier}';\n`);
|
|
156
|
+
slotEntryPaths[plugin.slot] = entryPath;
|
|
157
|
+
}
|
|
158
|
+
const fallbackTemplate = fallbackTemplateSourceRoot(packageRoot);
|
|
159
|
+
const leadingSourceRoots = [path.join(packageRoot, "src", "web"), ...fallbackTemplate === void 0 ? [] : [fallbackTemplate]];
|
|
160
|
+
fs.writeFileSync(cssModulePath, renderCssModule(plugins, leadingSourceRoots));
|
|
161
|
+
const hostPlugins = plugins.filter((plugin) => plugin.isHost);
|
|
162
|
+
const shell = {
|
|
163
|
+
clientModulePath: path.join(generatedDir, "webPluginShell.generated.ts"),
|
|
164
|
+
cssModulePath: path.join(generatedDir, "webPluginShellSources.generated.css")
|
|
165
|
+
};
|
|
166
|
+
fs.writeFileSync(shell.clientModulePath, renderClientModule(hostPlugins, "absolute", packageRoot));
|
|
167
|
+
fs.writeFileSync(shell.cssModulePath, renderCssModule(hostPlugins, leadingSourceRoots));
|
|
168
|
+
return {
|
|
169
|
+
clientModulePath,
|
|
170
|
+
slotEntryPaths,
|
|
171
|
+
cssModulePath,
|
|
172
|
+
shell
|
|
173
|
+
};
|
|
174
|
+
}
|
|
175
|
+
//#endregion
|
|
176
|
+
export { BASE_STYLE_ENTRY, BUILTIN_CLIENT_MODULE, BUILTIN_CSS_MODULE, ensureBuiltinWebPluginModules, pluginStyleEntryName, renderBuiltinWebPluginModules, writeSyncWebPluginModules, writeWebPluginStyleEntries };
|
|
177
|
+
|
|
178
|
+
//# sourceMappingURL=webPluginGenerate.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"webPluginGenerate.mjs","names":[],"sources":["../../../../src/builders/web/webPluginGenerate.ts"],"sourcesContent":["import fs from 'node:fs';\nimport { createRequire } from 'node:module';\nimport path from 'node:path';\nimport { pathToFileURL } from 'node:url';\n\nimport type { DeclaredWebPlugin } from './webPluginManifest';\nimport { scanWebPlugins } from './webPluginScan';\n\nconst HEADER = '// Generated by po web builder. Do not edit by hand.';\n/** The template po-web renders when a composition names none, so its classes always compile. */\nconst FALLBACK_TEMPLATE_PACKAGE = '@agimon-ai/po-template-advanced';\nexport const BUILTIN_CLIENT_MODULE = path.join('src', 'web', 'app', 'webPlugins.generated.ts');\nexport const BUILTIN_CSS_MODULE = path.join('src', 'web', 'styles', 'webPluginSources.generated.css');\n\n/**\n * The import name of one plugin copy, derived from its slot so two copies of one pluginId\n * never collide. A host slot is its kebab-case pluginId and keeps the committed module's\n * names; a copy slot's '.' becomes '_', which no host name can contain.\n */\nfunction slotIdentifier(slot: string): string {\n return slot.replace(/-([a-z0-9])/g, (_, ch: string) => ch.toUpperCase()).replace(/[^A-Za-z0-9_$]/g, '_');\n}\n\nfunction relativeImport(fromDir: string, toFile: string): string {\n const spec = path.relative(fromDir, toFile).split(path.sep).join('/');\n return spec.startsWith('.') ? spec : `./${spec}`;\n}\n\nfunction renderClientModule(\n plugins: readonly DeclaredWebPlugin[],\n style: 'relative' | 'absolute',\n packageRoot: string,\n): string {\n const lines = [HEADER, \"import type { WebPluginDefinition } from '@agimon-ai/po-core/web';\"];\n const names: string[] = [];\n const fromDir = path.join(packageRoot, 'src', 'web', 'app');\n for (const plugin of plugins) {\n const name = `${slotIdentifier(plugin.slot)}Plugin`;\n names.push(name);\n const entry = path.join(plugin.packageDir, plugin.client.entry);\n // The committed builtin module keeps machine-neutral relative imports; the\n // sync-generated module lives outside src, is aliased over the committed\n // path, and resolves imports against its real location, so every entry\n // becomes an absolute file URL into the installed packages.\n const specifier =\n style === 'relative' ? relativeImport(fromDir, entry) : pathToFileURL(fs.realpathSync(entry)).href;\n lines.push(`import { webPlugin as ${name} } from '${specifier}';`);\n }\n lines.push('', `export const webPlugins: readonly WebPluginDefinition[] = [${names.join(', ')}];`, '');\n return lines.join('\\n');\n}\n\n/**\n * The directory Tailwind scans for a plugin's class names.\n *\n * `src/extensions` wins, because a plugin's components colocate with the routed\n * file that renders them, in private `_components` and `_lib` folders. The\n * legacy `src/web` root is only a fallback: `existsSync` is true for a\n * half-emptied directory holding nothing but a tsconfig, and packages have been\n * in exactly that state, so preferring it would hand Tailwind a directory with\n * no components in it and silently drop every class.\n *\n * The client entry's own directory is the last resort. It is published through\n * `src/exports/webClient.ts`, a one-line re-export, or generated outside `src`\n * entirely, so it holds no components either.\n */\nfunction pluginSourceRoot(plugin: DeclaredWebPlugin): string {\n const routingRoot = path.join(plugin.packageDir, 'src', 'extensions');\n if (fs.existsSync(routingRoot)) return routingRoot;\n const webRoot = path.join(plugin.packageDir, 'src', 'web');\n if (fs.existsSync(webRoot)) return webRoot;\n return path.dirname(path.join(plugin.packageDir, plugin.client.entry));\n}\n\n/**\n * Where Tailwind finds the fallback template's classes. app.css names it by a\n * path from its own folder into po-web's node_modules, which holds only in\n * this repository; an installed po-web has the template beside it instead,\n * so a sync build that scanned only that path shipped the cockpit without the\n * template's responsive layout. Resolving it as Node does works in both.\n */\nfunction fallbackTemplateSourceRoot(packageRoot: string): string | undefined {\n let manifest: string;\n try {\n manifest = createRequire(path.join(packageRoot, 'package.json')).resolve(\n `${FALLBACK_TEMPLATE_PACKAGE}/package.json`,\n );\n } catch {\n // Not installed: the cockpit then has no fallback template to render either.\n return undefined;\n }\n const extensions = path.join(path.dirname(manifest), 'dist', 'extensions');\n return fs.existsSync(extensions) ? extensions : undefined;\n}\n\nfunction renderCssModule(plugins: readonly DeclaredWebPlugin[], leadingSourceRoots: readonly string[]): string {\n // Sync CSS is compiled from a generated directory, so Tailwind cannot infer\n // the stable shell tree from app.css. Its caller names that tree explicitly\n // so later plugin utilities do not override missing responsive shell utilities.\n const lines = [`/* ${HEADER.slice(3)} */`, ...leadingSourceRoots.map((root) => `@source \"${root}\";`)];\n for (const plugin of plugins) {\n if (plugin.isHost) continue;\n lines.push(`@source \"${pluginSourceRoot(plugin)}\";`);\n }\n lines.push('');\n return lines.join('\\n');\n}\n\n/** The committed client registry, rendered from the host package alone. */\nexport function renderBuiltinWebPluginModules(packageRoot: string): Map<string, string> {\n const plugins = scanWebPlugins(packageRoot);\n return new Map([\n [BUILTIN_CLIENT_MODULE, renderClientModule(plugins, 'relative', packageRoot)],\n [BUILTIN_CSS_MODULE, renderCssModule(plugins, [])],\n ]);\n}\n\n/**\n * Keeps the committed client registry fresh: write-if-changed locally,\n * check-only (throw) in CI. Both vite.config.ts and tsdown.config.ts call\n * this at config-load time.\n */\nexport function ensureBuiltinWebPluginModules({\n packageRoot,\n check = false,\n}: {\n packageRoot: string;\n check?: boolean;\n}): void {\n const stale: string[] = [];\n for (const [relativePath, content] of renderBuiltinWebPluginModules(packageRoot)) {\n const filePath = path.join(packageRoot, relativePath);\n const existing = fs.existsSync(filePath) ? fs.readFileSync(filePath, 'utf8') : undefined;\n if (existing === content) continue;\n if (check) {\n stale.push(relativePath);\n continue;\n }\n fs.mkdirSync(path.dirname(filePath), { recursive: true });\n fs.writeFileSync(filePath, content);\n }\n if (stale.length > 0) {\n throw new Error(\n `Stale generated web plugin modules: ${stale.join(', ')}. Run pnpm build in po-web and commit them.`,\n );\n }\n}\n\n/** A client plugin registry and the Tailwind source list that goes with it. */\nexport interface WebPluginRegistryModules {\n clientModulePath: string;\n cssModulePath: string;\n}\n\nexport interface SyncGeneratedModules extends WebPluginRegistryModules {\n /** One entry module per slot, each re-exporting only that copy's `webPlugin`. */\n slotEntryPaths: Record<string, string>;\n /**\n * The signed shell's registry: host plugins only. Every other plugin reaches the\n * browser through its slot entry, and the global mount replaces the shell's\n * registry once it loads, so compiling them into the shell too shipped each plugin's\n * code and emitted assets (the voice VAD model among them) a second time.\n */\n shell: WebPluginRegistryModules;\n}\n\nexport interface WebPluginStyleEntries {\n /** Shell and fallback-template sources only, aliased over app.css's plugin source list. */\n baseSourcesPath: string;\n /** The stylesheet every plugin entry extends; a mount with no plugin styles loads it alone. */\n baseEntryPath: string;\n /** One stylesheet entry per non-host plugin copy, keyed by its slot. */\n pluginEntryPaths: Map<string, string>;\n}\n\n/** The style entry of each plugin's Rollup input name, so each emits one content-hashed file. */\nexport const BASE_STYLE_ENTRY = 'base';\nexport const pluginStyleEntryName = (slot: string): string => `plugin-${slot}`;\n\n/**\n * One Tailwind entry per plugin: app.css with only the shell's sources plus that plugin's,\n * so a mount that loads its plugins' files never receives another workspace's classes.\n * Host plugins live in the shell's sources and share the base entry.\n */\nexport function writeWebPluginStyleEntries(\n plugins: readonly DeclaredWebPlugin[],\n generatedDir: string,\n packageRoot: string,\n): WebPluginStyleEntries {\n const stylesDir = path.join(generatedDir, 'styles');\n fs.mkdirSync(stylesDir, { recursive: true });\n const fallbackTemplate = fallbackTemplateSourceRoot(packageRoot);\n const baseSourcesPath = path.join(generatedDir, 'webPluginBaseSources.generated.css');\n fs.writeFileSync(\n baseSourcesPath,\n renderCssModule(\n [],\n [path.join(packageRoot, 'src', 'web'), ...(fallbackTemplate === undefined ? [] : [fallbackTemplate])],\n ),\n );\n // Resolvers follow real paths (a temp dir under /var is /private/var), so relate real paths.\n const appCss = relativeImport(\n fs.realpathSync(stylesDir),\n fs.realpathSync(path.join(packageRoot, 'src', 'web', 'styles', 'app.css')),\n );\n const baseEntryPath = path.join(stylesDir, `${BASE_STYLE_ENTRY}.css`);\n fs.writeFileSync(baseEntryPath, `/* ${HEADER.slice(3)} */\\n@import '${appCss}';\\n`);\n const pluginEntryPaths = new Map<string, string>();\n for (const plugin of plugins) {\n if (plugin.isHost) continue;\n const entryPath = path.join(stylesDir, `${pluginStyleEntryName(plugin.slot)}.css`);\n fs.writeFileSync(\n entryPath,\n `/* ${HEADER.slice(3)} */\\n@import '${appCss}';\\n@source \"${pluginSourceRoot(plugin)}\";\\n`,\n );\n pluginEntryPaths.set(plugin.slot, entryPath);\n }\n return { baseSourcesPath, baseEntryPath, pluginEntryPaths };\n}\n\n/**\n * The sync-time variant: renders the full client plugin set (host built-ins plus\n * the installed composition's packages) into a generation directory the bundler\n * aliases over the committed builtin modules.\n */\nexport function writeSyncWebPluginModules(\n plugins: readonly DeclaredWebPlugin[],\n generatedDir: string,\n packageRoot: string,\n): SyncGeneratedModules {\n fs.mkdirSync(generatedDir, { recursive: true });\n const clientModulePath = path.join(generatedDir, 'webPlugins.generated.ts');\n const cssModulePath = path.join(generatedDir, 'webPluginSources.generated.css');\n fs.writeFileSync(clientModulePath, renderClientModule(plugins, 'absolute', packageRoot));\n // Styles are built per plugin by writeWebPluginStyleEntries, so slot entries carry none.\n const slotsDir = path.join(generatedDir, 'slots');\n fs.mkdirSync(slotsDir, { recursive: true });\n const slotEntryPaths: Record<string, string> = {};\n for (const plugin of plugins) {\n const entryPath = path.join(slotsDir, `${plugin.slot}.ts`);\n const specifier = pathToFileURL(fs.realpathSync(path.join(plugin.packageDir, plugin.client.entry))).href;\n fs.writeFileSync(entryPath, `${HEADER}\\nexport { webPlugin } from '${specifier}';\\n`);\n slotEntryPaths[plugin.slot] = entryPath;\n }\n const fallbackTemplate = fallbackTemplateSourceRoot(packageRoot);\n const leadingSourceRoots = [\n path.join(packageRoot, 'src', 'web'),\n ...(fallbackTemplate === undefined ? [] : [fallbackTemplate]),\n ];\n fs.writeFileSync(cssModulePath, renderCssModule(plugins, leadingSourceRoots));\n const hostPlugins = plugins.filter((plugin) => plugin.isHost);\n const shell = {\n clientModulePath: path.join(generatedDir, 'webPluginShell.generated.ts'),\n cssModulePath: path.join(generatedDir, 'webPluginShellSources.generated.css'),\n };\n fs.writeFileSync(shell.clientModulePath, renderClientModule(hostPlugins, 'absolute', packageRoot));\n fs.writeFileSync(shell.cssModulePath, renderCssModule(hostPlugins, leadingSourceRoots));\n return {\n clientModulePath,\n slotEntryPaths,\n cssModulePath,\n shell,\n };\n}\n"],"mappings":";;;;;;AAQA,MAAM,SAAS;;AAEf,MAAM,4BAA4B;AAClC,MAAa,wBAAwB,KAAK,KAAK,OAAO,OAAO,OAAO,yBAAyB;AAC7F,MAAa,qBAAqB,KAAK,KAAK,OAAO,OAAO,UAAU,gCAAgC;;;;;;AAOpG,SAAS,eAAe,MAAsB;CAC5C,OAAO,KAAK,QAAQ,iBAAiB,GAAG,OAAe,GAAG,YAAY,CAAC,CAAC,CAAC,QAAQ,mBAAmB,GAAG;AACzG;AAEA,SAAS,eAAe,SAAiB,QAAwB;CAC/D,MAAM,OAAO,KAAK,SAAS,SAAS,MAAM,CAAC,CAAC,MAAM,KAAK,GAAG,CAAC,CAAC,KAAK,GAAG;CACpE,OAAO,KAAK,WAAW,GAAG,IAAI,OAAO,KAAK;AAC5C;AAEA,SAAS,mBACP,SACA,OACA,aACQ;CACR,MAAM,QAAQ,CAAC,QAAQ,oEAAoE;CAC3F,MAAM,QAAkB,CAAC;CACzB,MAAM,UAAU,KAAK,KAAK,aAAa,OAAO,OAAO,KAAK;CAC1D,KAAK,MAAM,UAAU,SAAS;EAC5B,MAAM,OAAO,GAAG,eAAe,OAAO,IAAI,EAAE;EAC5C,MAAM,KAAK,IAAI;EACf,MAAM,QAAQ,KAAK,KAAK,OAAO,YAAY,OAAO,OAAO,KAAK;EAK9D,MAAM,YACJ,UAAU,aAAa,eAAe,SAAS,KAAK,IAAI,cAAc,GAAG,aAAa,KAAK,CAAC,CAAC,CAAC;EAChG,MAAM,KAAK,yBAAyB,KAAK,WAAW,UAAU,GAAG;CACnE;CACA,MAAM,KAAK,IAAI,8DAA8D,MAAM,KAAK,IAAI,EAAE,KAAK,EAAE;CACr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K,KAAK,cAAc,qCAAqC;CAC9E;CACA,GAAG,cAAc,MAAM,kBAAkB,mBAAmB,aAAa,YAAY,WAAW,CAAC;CACjG,GAAG,cAAc,MAAM,eAAe,gBAAgB,aAAa,kBAAkB,CAAC;CACtF,OAAO;EACL;EACA;EACA;EACA;CACF;AACF"}
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
const require_runtime = require("../../../_virtual/_rolldown/runtime.cjs");
|
|
2
|
+
let node_fs = require("node:fs");
|
|
3
|
+
node_fs = require_runtime.__toESM(node_fs, 1);
|
|
4
|
+
let node_path = require("node:path");
|
|
5
|
+
node_path = require_runtime.__toESM(node_path, 1);
|
|
6
|
+
let node_crypto = require("node:crypto");
|
|
7
|
+
node_crypto = require_runtime.__toESM(node_crypto, 1);
|
|
8
|
+
//#region src/builders/web/webPluginManifest.ts
|
|
9
|
+
/**
|
|
10
|
+
* The poWeb manifest vocabulary: how a package declares its web plugin in
|
|
11
|
+
* package.json, validated and ordered; the filesystem is read only to name each
|
|
12
|
+
* copy's slot by its real directory. The
|
|
13
|
+
* scan adapter feeds this from real manifests; the sync bundler feeds it from
|
|
14
|
+
* the installed composition's package roots.
|
|
15
|
+
*
|
|
16
|
+
* Plugins are independent: a manifest names no other plugin, and the order
|
|
17
|
+
* plugins install in is only a tiebreak (registrationOrder, then pluginId),
|
|
18
|
+
* because every relation between two plugins resolves by name once all of
|
|
19
|
+
* them are installed. A collision between two packages is a notice for the
|
|
20
|
+
* sync log and the first package keeps the name; only a malformed block is an
|
|
21
|
+
* error, which the scanner turns into a notice for that package alone.
|
|
22
|
+
*
|
|
23
|
+
* The native app's poNative blocks share this exact shape, so the same
|
|
24
|
+
* validation reads either field.
|
|
25
|
+
*/
|
|
26
|
+
const PLUGIN_ID_PATTERN = /^[a-z][a-z0-9]*(-[a-z0-9]+)*$/;
|
|
27
|
+
/** The order a plugin installs at when its manifest names none. */
|
|
28
|
+
const DEFAULT_REGISTRATION_ORDER = 1e3;
|
|
29
|
+
var WebPluginManifestError = class extends Error {
|
|
30
|
+
constructor(packageDir, message, field = "poWeb") {
|
|
31
|
+
super(`${field} manifest in ${packageDir}: ${message}`);
|
|
32
|
+
this.name = "WebPluginManifestError";
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
function isRecord(value) {
|
|
36
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
37
|
+
}
|
|
38
|
+
function normalizeEntry(packageDir, kind, value, field) {
|
|
39
|
+
const raw = typeof value === "string" ? { entry: value } : value;
|
|
40
|
+
if (!isRecord(raw)) throw new WebPluginManifestError(packageDir, `${kind} must be a path or {entry}.`, field);
|
|
41
|
+
const { entry } = raw;
|
|
42
|
+
if (typeof entry !== "string" || !entry.startsWith("./") || entry.includes("..")) throw new WebPluginManifestError(packageDir, `${kind}.entry must be a package-relative ./path with no '..'.`, field);
|
|
43
|
+
return { entry };
|
|
44
|
+
}
|
|
45
|
+
const SLOT_HASH_LENGTH = 8;
|
|
46
|
+
/** The slot of one installed plugin copy; see DeclaredWebPlugin.slot. */
|
|
47
|
+
function pluginSlot(plugin) {
|
|
48
|
+
if (plugin.isHost) return plugin.pluginId;
|
|
49
|
+
let directory;
|
|
50
|
+
try {
|
|
51
|
+
directory = node_fs.default.realpathSync(plugin.packageDir);
|
|
52
|
+
} catch {
|
|
53
|
+
directory = node_path.default.resolve(plugin.packageDir);
|
|
54
|
+
}
|
|
55
|
+
const digest = node_crypto.default.createHash("sha256").update(directory).digest("hex");
|
|
56
|
+
return `${plugin.pluginId}.${digest.slice(0, SLOT_HASH_LENGTH)}`;
|
|
57
|
+
}
|
|
58
|
+
/** The field's value normalized to a list: one plugin object or an array of them. */
|
|
59
|
+
function pluginBlocksOf(manifest, field = "poWeb") {
|
|
60
|
+
const value = manifest[field];
|
|
61
|
+
if (value === void 0) return [];
|
|
62
|
+
return Array.isArray(value) ? value : [value];
|
|
63
|
+
}
|
|
64
|
+
/** Validates one manifest's blocks into declared plugins; throws WebPluginManifestError on bad shape. */
|
|
65
|
+
function declaredPluginsOf(packageDir, manifest, isHost, field = "poWeb") {
|
|
66
|
+
const plugins = [];
|
|
67
|
+
for (const block of pluginBlocksOf(manifest, field)) {
|
|
68
|
+
if (!isRecord(block)) throw new WebPluginManifestError(packageDir, "each block must be an object.", field);
|
|
69
|
+
const { pluginId, registrationOrder = DEFAULT_REGISTRATION_ORDER, client, scopes } = block;
|
|
70
|
+
if (!Array.isArray(scopes) || scopes.length === 0 || scopes.some((scope) => ![
|
|
71
|
+
"global",
|
|
72
|
+
"workspace",
|
|
73
|
+
"session"
|
|
74
|
+
].includes(scope))) throw new WebPluginManifestError(packageDir, "scopes must explicitly name global, workspace, or session; resync the plugin.", field);
|
|
75
|
+
if (typeof pluginId !== "string" || !PLUGIN_ID_PATTERN.test(pluginId)) throw new WebPluginManifestError(packageDir, `pluginId '${String(pluginId)}' must be kebab-case.`, field);
|
|
76
|
+
if (!Number.isInteger(registrationOrder) || registrationOrder < 0) throw new WebPluginManifestError(packageDir, `'${pluginId}' needs a non-negative integer registrationOrder.`, field);
|
|
77
|
+
plugins.push({
|
|
78
|
+
pluginId,
|
|
79
|
+
slot: pluginSlot({
|
|
80
|
+
pluginId,
|
|
81
|
+
packageDir,
|
|
82
|
+
isHost
|
|
83
|
+
}),
|
|
84
|
+
registrationOrder,
|
|
85
|
+
packageDir,
|
|
86
|
+
packageName: typeof manifest.name === "string" ? manifest.name : packageDir,
|
|
87
|
+
isHost,
|
|
88
|
+
client: normalizeEntry(packageDir, "client", client, field),
|
|
89
|
+
scopes
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
return plugins;
|
|
93
|
+
}
|
|
94
|
+
/** Code-unit order, never the locale's: the same packages must order the same on every machine. */
|
|
95
|
+
function compareCodeUnits(left, right) {
|
|
96
|
+
return left < right ? -1 : left > right ? 1 : 0;
|
|
97
|
+
}
|
|
98
|
+
const byInstallOrder = (left, right) => left.registrationOrder - right.registrationOrder || compareCodeUnits(left.pluginId, right.pluginId) || compareCodeUnits(left.packageDir, right.packageDir);
|
|
99
|
+
/**
|
|
100
|
+
* The deterministic install order, (registrationOrder, pluginId), with the
|
|
101
|
+
* cross-package collisions resolved by the browser client registry: the first
|
|
102
|
+
* plugin keeps a shared pluginId and the later package is dropped with a notice.
|
|
103
|
+
*/
|
|
104
|
+
function orderDeclaredPlugins(plugins, onNotice = () => void 0) {
|
|
105
|
+
const sorted = [...plugins].sort(byInstallOrder);
|
|
106
|
+
const byId = /* @__PURE__ */ new Map();
|
|
107
|
+
const kept = [];
|
|
108
|
+
for (const plugin of sorted) {
|
|
109
|
+
const holder = byId.get(plugin.pluginId);
|
|
110
|
+
if (holder !== void 0) {
|
|
111
|
+
onNotice(`web plugin '${plugin.pluginId}' from ${plugin.packageDir} is skipped: ${holder.packageDir} already declares it.`);
|
|
112
|
+
continue;
|
|
113
|
+
}
|
|
114
|
+
byId.set(plugin.pluginId, plugin);
|
|
115
|
+
kept.push(plugin);
|
|
116
|
+
}
|
|
117
|
+
return kept;
|
|
118
|
+
}
|
|
119
|
+
//#endregion
|
|
120
|
+
exports.DEFAULT_REGISTRATION_ORDER = DEFAULT_REGISTRATION_ORDER;
|
|
121
|
+
exports.WebPluginManifestError = WebPluginManifestError;
|
|
122
|
+
exports.compareCodeUnits = compareCodeUnits;
|
|
123
|
+
exports.declaredPluginsOf = declaredPluginsOf;
|
|
124
|
+
exports.orderDeclaredPlugins = orderDeclaredPlugins;
|
|
125
|
+
exports.pluginBlocksOf = pluginBlocksOf;
|
|
126
|
+
exports.pluginSlot = pluginSlot;
|
|
127
|
+
|
|
128
|
+
//# sourceMappingURL=webPluginManifest.cjs.map
|