@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 @@
|
|
|
1
|
+
{"version":3,"file":"webPluginManifest.cjs","names":["fs","path","crypto"],"sources":["../../../../src/builders/web/webPluginManifest.ts"],"sourcesContent":["/**\n * The poWeb manifest vocabulary: how a package declares its web plugin in\n * package.json, validated and ordered; the filesystem is read only to name each\n * copy's slot by its real directory. The\n * scan adapter feeds this from real manifests; the sync bundler feeds it from\n * the installed composition's package roots.\n *\n * Plugins are independent: a manifest names no other plugin, and the order\n * plugins install in is only a tiebreak (registrationOrder, then pluginId),\n * because every relation between two plugins resolves by name once all of\n * them are installed. A collision between two packages is a notice for the\n * sync log and the first package keeps the name; only a malformed block is an\n * error, which the scanner turns into a notice for that package alone.\n *\n * The native app's poNative blocks share this exact shape, so the same\n * validation reads either field.\n */\n\nimport crypto from 'node:crypto';\nimport fs from 'node:fs';\nimport path from 'node:path';\n\nconst PLUGIN_ID_PATTERN = /^[a-z][a-z0-9]*(-[a-z0-9]+)*$/;\n\n/** The order a plugin installs at when its manifest names none. */\nexport const DEFAULT_REGISTRATION_ORDER = 1000;\n\nexport interface WebPluginEntryDeclaration {\n /** Package-relative ./path to the source entry. */\n entry: string;\n}\n\nexport interface DeclaredWebPlugin {\n pluginId: string;\n /**\n * The registry name of this installed copy: the pluginId for a host plugin, otherwise\n * `${pluginId}.${first 8 hex of sha256(realpath(packageDir))}`, so two copies of one\n * pluginId installed from different directories never share a name.\n */\n slot: string;\n registrationOrder: number;\n packageDir: string;\n packageName: string;\n isHost: boolean;\n client: WebPluginEntryDeclaration;\n scopes: readonly ('global' | 'workspace' | 'session')[];\n}\n\n/** The package.json field a plugin block lives in: the browser cockpit's or the native app's. */\nexport type PluginManifestField = 'poWeb' | 'poNative';\n\nexport class WebPluginManifestError extends Error {\n constructor(packageDir: string, message: string, field: PluginManifestField = 'poWeb') {\n super(`${field} manifest in ${packageDir}: ${message}`);\n this.name = 'WebPluginManifestError';\n }\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null && !Array.isArray(value);\n}\n\nfunction normalizeEntry(\n packageDir: string,\n kind: string,\n value: unknown,\n field: PluginManifestField,\n): WebPluginEntryDeclaration {\n const raw = typeof value === 'string' ? { entry: value } : value;\n if (!isRecord(raw)) throw new WebPluginManifestError(packageDir, `${kind} must be a path or {entry}.`, field);\n const { entry } = raw;\n if (typeof entry !== 'string' || !entry.startsWith('./') || entry.includes('..')) {\n throw new WebPluginManifestError(\n packageDir,\n `${kind}.entry must be a package-relative ./path with no '..'.`,\n field,\n );\n }\n return { entry };\n}\n\nconst SLOT_HASH_LENGTH = 8;\n\n/** The slot of one installed plugin copy; see DeclaredWebPlugin.slot. */\nexport function pluginSlot(plugin: { pluginId: string; packageDir: string; isHost: boolean }): string {\n if (plugin.isHost) return plugin.pluginId;\n let directory: string;\n try {\n directory = fs.realpathSync(plugin.packageDir);\n } catch {\n // A directory that no longer exists has no real path; its resolved path still names it stably.\n directory = path.resolve(plugin.packageDir);\n }\n const digest = crypto.createHash('sha256').update(directory).digest('hex');\n return `${plugin.pluginId}.${digest.slice(0, SLOT_HASH_LENGTH)}`;\n}\n\n/** The field's value normalized to a list: one plugin object or an array of them. */\nexport function pluginBlocksOf(manifest: Record<string, unknown>, field: PluginManifestField = 'poWeb'): unknown[] {\n const value = manifest[field];\n if (value === undefined) return [];\n return Array.isArray(value) ? value : [value];\n}\n\n/** Validates one manifest's blocks into declared plugins; throws WebPluginManifestError on bad shape. */\nexport function declaredPluginsOf(\n packageDir: string,\n manifest: Record<string, unknown>,\n isHost: boolean,\n field: PluginManifestField = 'poWeb',\n): DeclaredWebPlugin[] {\n const plugins: DeclaredWebPlugin[] = [];\n for (const block of pluginBlocksOf(manifest, field)) {\n if (!isRecord(block)) throw new WebPluginManifestError(packageDir, 'each block must be an object.', field);\n const { pluginId, registrationOrder = DEFAULT_REGISTRATION_ORDER, client, scopes } = block;\n if (\n !Array.isArray(scopes) ||\n scopes.length === 0 ||\n scopes.some((scope) => !['global', 'workspace', 'session'].includes(scope))\n ) {\n throw new WebPluginManifestError(\n packageDir,\n 'scopes must explicitly name global, workspace, or session; resync the plugin.',\n field,\n );\n }\n if (typeof pluginId !== 'string' || !PLUGIN_ID_PATTERN.test(pluginId)) {\n throw new WebPluginManifestError(packageDir, `pluginId '${String(pluginId)}' must be kebab-case.`, field);\n }\n if (!Number.isInteger(registrationOrder) || (registrationOrder as number) < 0) {\n throw new WebPluginManifestError(\n packageDir,\n `'${pluginId}' needs a non-negative integer registrationOrder.`,\n field,\n );\n }\n plugins.push({\n pluginId,\n slot: pluginSlot({ pluginId, packageDir, isHost }),\n registrationOrder: registrationOrder as number,\n packageDir,\n packageName: typeof manifest.name === 'string' ? manifest.name : packageDir,\n isHost,\n client: normalizeEntry(packageDir, 'client', client, field),\n scopes,\n });\n }\n return plugins;\n}\n\n/** Code-unit order, never the locale's: the same packages must order the same on every machine. */\nexport function compareCodeUnits(left: string, right: string): number {\n return left < right ? -1 : left > right ? 1 : 0;\n}\n\nconst byInstallOrder = (left: DeclaredWebPlugin, right: DeclaredWebPlugin): number =>\n left.registrationOrder - right.registrationOrder ||\n compareCodeUnits(left.pluginId, right.pluginId) ||\n compareCodeUnits(left.packageDir, right.packageDir);\n\n/**\n * The deterministic install order, (registrationOrder, pluginId), with the\n * cross-package collisions resolved by the browser client registry: the first\n * plugin keeps a shared pluginId and the later package is dropped with a notice.\n */\nexport function orderDeclaredPlugins(\n plugins: readonly DeclaredWebPlugin[],\n onNotice: (message: string) => void = () => undefined,\n): DeclaredWebPlugin[] {\n const sorted = [...plugins].sort(byInstallOrder);\n const byId = new Map<string, DeclaredWebPlugin>();\n const kept: DeclaredWebPlugin[] = [];\n for (const plugin of sorted) {\n const holder = byId.get(plugin.pluginId);\n if (holder !== undefined) {\n onNotice(\n `web plugin '${plugin.pluginId}' from ${plugin.packageDir} is skipped: ${holder.packageDir} already declares it.`,\n );\n continue;\n }\n byId.set(plugin.pluginId, plugin);\n kept.push(plugin);\n }\n return kept;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAsBA,MAAM,oBAAoB;;AAG1B,MAAa,6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,OAA4B,CAAC;CACnC,KAAK,MAAM,UAAU,QAAQ;EAC3B,MAAM,SAAS,KAAK,IAAI,OAAO,QAAQ;EACvC,IAAI,WAAW,KAAA,GAAW;GACxB,SACE,eAAe,OAAO,SAAS,SAAS,OAAO,WAAW,eAAe,OAAO,WAAW,sBAC7F;GACA;EACF;EACA,KAAK,IAAI,OAAO,UAAU,MAAM;EAChC,KAAK,KAAK,MAAM;CAClB;CACA,OAAO;AACT"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
//#region src/builders/web/webPluginManifest.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* The poWeb manifest vocabulary: how a package declares its web plugin in
|
|
4
|
+
* package.json, validated and ordered; the filesystem is read only to name each
|
|
5
|
+
* copy's slot by its real directory. The
|
|
6
|
+
* scan adapter feeds this from real manifests; the sync bundler feeds it from
|
|
7
|
+
* the installed composition's package roots.
|
|
8
|
+
*
|
|
9
|
+
* Plugins are independent: a manifest names no other plugin, and the order
|
|
10
|
+
* plugins install in is only a tiebreak (registrationOrder, then pluginId),
|
|
11
|
+
* because every relation between two plugins resolves by name once all of
|
|
12
|
+
* them are installed. A collision between two packages is a notice for the
|
|
13
|
+
* sync log and the first package keeps the name; only a malformed block is an
|
|
14
|
+
* error, which the scanner turns into a notice for that package alone.
|
|
15
|
+
*
|
|
16
|
+
* The native app's poNative blocks share this exact shape, so the same
|
|
17
|
+
* validation reads either field.
|
|
18
|
+
*/
|
|
19
|
+
/** The order a plugin installs at when its manifest names none. */
|
|
20
|
+
export declare const DEFAULT_REGISTRATION_ORDER = 1000;
|
|
21
|
+
export interface WebPluginEntryDeclaration {
|
|
22
|
+
/** Package-relative ./path to the source entry. */
|
|
23
|
+
entry: string;
|
|
24
|
+
}
|
|
25
|
+
export interface DeclaredWebPlugin {
|
|
26
|
+
pluginId: string;
|
|
27
|
+
/**
|
|
28
|
+
* The registry name of this installed copy: the pluginId for a host plugin, otherwise
|
|
29
|
+
* `${pluginId}.${first 8 hex of sha256(realpath(packageDir))}`, so two copies of one
|
|
30
|
+
* pluginId installed from different directories never share a name.
|
|
31
|
+
*/
|
|
32
|
+
slot: string;
|
|
33
|
+
registrationOrder: number;
|
|
34
|
+
packageDir: string;
|
|
35
|
+
packageName: string;
|
|
36
|
+
isHost: boolean;
|
|
37
|
+
client: WebPluginEntryDeclaration;
|
|
38
|
+
scopes: readonly ('global' | 'workspace' | 'session')[];
|
|
39
|
+
}
|
|
40
|
+
/** The package.json field a plugin block lives in: the browser cockpit's or the native app's. */
|
|
41
|
+
export type PluginManifestField = 'poWeb' | 'poNative';
|
|
42
|
+
export declare class WebPluginManifestError extends Error {
|
|
43
|
+
constructor(packageDir: string, message: string, field?: PluginManifestField);
|
|
44
|
+
}
|
|
45
|
+
/** The slot of one installed plugin copy; see DeclaredWebPlugin.slot. */
|
|
46
|
+
export declare function pluginSlot(plugin: {
|
|
47
|
+
pluginId: string;
|
|
48
|
+
packageDir: string;
|
|
49
|
+
isHost: boolean;
|
|
50
|
+
}): string;
|
|
51
|
+
/** The field's value normalized to a list: one plugin object or an array of them. */
|
|
52
|
+
export declare function pluginBlocksOf(manifest: Record<string, unknown>, field?: PluginManifestField): unknown[];
|
|
53
|
+
/** Validates one manifest's blocks into declared plugins; throws WebPluginManifestError on bad shape. */
|
|
54
|
+
export declare function declaredPluginsOf(packageDir: string, manifest: Record<string, unknown>, isHost: boolean, field?: PluginManifestField): DeclaredWebPlugin[];
|
|
55
|
+
/** Code-unit order, never the locale's: the same packages must order the same on every machine. */
|
|
56
|
+
export declare function compareCodeUnits(left: string, right: string): number;
|
|
57
|
+
/**
|
|
58
|
+
* The deterministic install order, (registrationOrder, pluginId), with the
|
|
59
|
+
* cross-package collisions resolved by the browser client registry: the first
|
|
60
|
+
* plugin keeps a shared pluginId and the later package is dropped with a notice.
|
|
61
|
+
*/
|
|
62
|
+
export declare function orderDeclaredPlugins(plugins: readonly DeclaredWebPlugin[], onNotice?: (message: string) => void): DeclaredWebPlugin[];
|
|
63
|
+
//#endregion
|
|
64
|
+
//# sourceMappingURL=webPluginManifest.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"webPluginManifest.d.mts","names":[],"sources":["../../../../src/builders/web/webPluginManifest.ts"],"mappings":";;;;;;;;;;;;;;;;;;;qBAyBa;iBAEI;;EAEf;;iBAGe;EACf;;;;;;EAMA;EACA;EACA;EACA;EACA;EACA,QAAQ;EACR;;;YAIU;qBAEC,+BAA+B;EAC1C,YAAY,oBAAoB,iBAAiB,QAAO;;;wBAgC1C,WAAW;EAAU;EAAkB;EAAoB;;;wBAc3D,eAAe,UAAU,yBAAyB,QAAO;;wBAOzD,kBACd,oBACA,UAAU,yBACV,iBACA,QAAO,sBACN;;wBAyCa,iBAAiB,cAAc;;;;;;wBAc/B,qBACd,kBAAkB,qBAClB,YAAW,2BACV"}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import fs from "node:fs";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import crypto from "node:crypto";
|
|
4
|
+
//#region src/builders/web/webPluginManifest.ts
|
|
5
|
+
/**
|
|
6
|
+
* The poWeb manifest vocabulary: how a package declares its web plugin in
|
|
7
|
+
* package.json, validated and ordered; the filesystem is read only to name each
|
|
8
|
+
* copy's slot by its real directory. The
|
|
9
|
+
* scan adapter feeds this from real manifests; the sync bundler feeds it from
|
|
10
|
+
* the installed composition's package roots.
|
|
11
|
+
*
|
|
12
|
+
* Plugins are independent: a manifest names no other plugin, and the order
|
|
13
|
+
* plugins install in is only a tiebreak (registrationOrder, then pluginId),
|
|
14
|
+
* because every relation between two plugins resolves by name once all of
|
|
15
|
+
* them are installed. A collision between two packages is a notice for the
|
|
16
|
+
* sync log and the first package keeps the name; only a malformed block is an
|
|
17
|
+
* error, which the scanner turns into a notice for that package alone.
|
|
18
|
+
*
|
|
19
|
+
* The native app's poNative blocks share this exact shape, so the same
|
|
20
|
+
* validation reads either field.
|
|
21
|
+
*/
|
|
22
|
+
const PLUGIN_ID_PATTERN = /^[a-z][a-z0-9]*(-[a-z0-9]+)*$/;
|
|
23
|
+
/** The order a plugin installs at when its manifest names none. */
|
|
24
|
+
const DEFAULT_REGISTRATION_ORDER = 1e3;
|
|
25
|
+
var WebPluginManifestError = class extends Error {
|
|
26
|
+
constructor(packageDir, message, field = "poWeb") {
|
|
27
|
+
super(`${field} manifest in ${packageDir}: ${message}`);
|
|
28
|
+
this.name = "WebPluginManifestError";
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
function isRecord(value) {
|
|
32
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
33
|
+
}
|
|
34
|
+
function normalizeEntry(packageDir, kind, value, field) {
|
|
35
|
+
const raw = typeof value === "string" ? { entry: value } : value;
|
|
36
|
+
if (!isRecord(raw)) throw new WebPluginManifestError(packageDir, `${kind} must be a path or {entry}.`, field);
|
|
37
|
+
const { entry } = raw;
|
|
38
|
+
if (typeof entry !== "string" || !entry.startsWith("./") || entry.includes("..")) throw new WebPluginManifestError(packageDir, `${kind}.entry must be a package-relative ./path with no '..'.`, field);
|
|
39
|
+
return { entry };
|
|
40
|
+
}
|
|
41
|
+
const SLOT_HASH_LENGTH = 8;
|
|
42
|
+
/** The slot of one installed plugin copy; see DeclaredWebPlugin.slot. */
|
|
43
|
+
function pluginSlot(plugin) {
|
|
44
|
+
if (plugin.isHost) return plugin.pluginId;
|
|
45
|
+
let directory;
|
|
46
|
+
try {
|
|
47
|
+
directory = fs.realpathSync(plugin.packageDir);
|
|
48
|
+
} catch {
|
|
49
|
+
directory = path.resolve(plugin.packageDir);
|
|
50
|
+
}
|
|
51
|
+
const digest = crypto.createHash("sha256").update(directory).digest("hex");
|
|
52
|
+
return `${plugin.pluginId}.${digest.slice(0, SLOT_HASH_LENGTH)}`;
|
|
53
|
+
}
|
|
54
|
+
/** The field's value normalized to a list: one plugin object or an array of them. */
|
|
55
|
+
function pluginBlocksOf(manifest, field = "poWeb") {
|
|
56
|
+
const value = manifest[field];
|
|
57
|
+
if (value === void 0) return [];
|
|
58
|
+
return Array.isArray(value) ? value : [value];
|
|
59
|
+
}
|
|
60
|
+
/** Validates one manifest's blocks into declared plugins; throws WebPluginManifestError on bad shape. */
|
|
61
|
+
function declaredPluginsOf(packageDir, manifest, isHost, field = "poWeb") {
|
|
62
|
+
const plugins = [];
|
|
63
|
+
for (const block of pluginBlocksOf(manifest, field)) {
|
|
64
|
+
if (!isRecord(block)) throw new WebPluginManifestError(packageDir, "each block must be an object.", field);
|
|
65
|
+
const { pluginId, registrationOrder = DEFAULT_REGISTRATION_ORDER, client, scopes } = block;
|
|
66
|
+
if (!Array.isArray(scopes) || scopes.length === 0 || scopes.some((scope) => ![
|
|
67
|
+
"global",
|
|
68
|
+
"workspace",
|
|
69
|
+
"session"
|
|
70
|
+
].includes(scope))) throw new WebPluginManifestError(packageDir, "scopes must explicitly name global, workspace, or session; resync the plugin.", field);
|
|
71
|
+
if (typeof pluginId !== "string" || !PLUGIN_ID_PATTERN.test(pluginId)) throw new WebPluginManifestError(packageDir, `pluginId '${String(pluginId)}' must be kebab-case.`, field);
|
|
72
|
+
if (!Number.isInteger(registrationOrder) || registrationOrder < 0) throw new WebPluginManifestError(packageDir, `'${pluginId}' needs a non-negative integer registrationOrder.`, field);
|
|
73
|
+
plugins.push({
|
|
74
|
+
pluginId,
|
|
75
|
+
slot: pluginSlot({
|
|
76
|
+
pluginId,
|
|
77
|
+
packageDir,
|
|
78
|
+
isHost
|
|
79
|
+
}),
|
|
80
|
+
registrationOrder,
|
|
81
|
+
packageDir,
|
|
82
|
+
packageName: typeof manifest.name === "string" ? manifest.name : packageDir,
|
|
83
|
+
isHost,
|
|
84
|
+
client: normalizeEntry(packageDir, "client", client, field),
|
|
85
|
+
scopes
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
return plugins;
|
|
89
|
+
}
|
|
90
|
+
/** Code-unit order, never the locale's: the same packages must order the same on every machine. */
|
|
91
|
+
function compareCodeUnits(left, right) {
|
|
92
|
+
return left < right ? -1 : left > right ? 1 : 0;
|
|
93
|
+
}
|
|
94
|
+
const byInstallOrder = (left, right) => left.registrationOrder - right.registrationOrder || compareCodeUnits(left.pluginId, right.pluginId) || compareCodeUnits(left.packageDir, right.packageDir);
|
|
95
|
+
/**
|
|
96
|
+
* The deterministic install order, (registrationOrder, pluginId), with the
|
|
97
|
+
* cross-package collisions resolved by the browser client registry: the first
|
|
98
|
+
* plugin keeps a shared pluginId and the later package is dropped with a notice.
|
|
99
|
+
*/
|
|
100
|
+
function orderDeclaredPlugins(plugins, onNotice = () => void 0) {
|
|
101
|
+
const sorted = [...plugins].sort(byInstallOrder);
|
|
102
|
+
const byId = /* @__PURE__ */ new Map();
|
|
103
|
+
const kept = [];
|
|
104
|
+
for (const plugin of sorted) {
|
|
105
|
+
const holder = byId.get(plugin.pluginId);
|
|
106
|
+
if (holder !== void 0) {
|
|
107
|
+
onNotice(`web plugin '${plugin.pluginId}' from ${plugin.packageDir} is skipped: ${holder.packageDir} already declares it.`);
|
|
108
|
+
continue;
|
|
109
|
+
}
|
|
110
|
+
byId.set(plugin.pluginId, plugin);
|
|
111
|
+
kept.push(plugin);
|
|
112
|
+
}
|
|
113
|
+
return kept;
|
|
114
|
+
}
|
|
115
|
+
//#endregion
|
|
116
|
+
export { DEFAULT_REGISTRATION_ORDER, WebPluginManifestError, compareCodeUnits, declaredPluginsOf, orderDeclaredPlugins, pluginBlocksOf, pluginSlot };
|
|
117
|
+
|
|
118
|
+
//# sourceMappingURL=webPluginManifest.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"webPluginManifest.mjs","names":[],"sources":["../../../../src/builders/web/webPluginManifest.ts"],"sourcesContent":["/**\n * The poWeb manifest vocabulary: how a package declares its web plugin in\n * package.json, validated and ordered; the filesystem is read only to name each\n * copy's slot by its real directory. The\n * scan adapter feeds this from real manifests; the sync bundler feeds it from\n * the installed composition's package roots.\n *\n * Plugins are independent: a manifest names no other plugin, and the order\n * plugins install in is only a tiebreak (registrationOrder, then pluginId),\n * because every relation between two plugins resolves by name once all of\n * them are installed. A collision between two packages is a notice for the\n * sync log and the first package keeps the name; only a malformed block is an\n * error, which the scanner turns into a notice for that package alone.\n *\n * The native app's poNative blocks share this exact shape, so the same\n * validation reads either field.\n */\n\nimport crypto from 'node:crypto';\nimport fs from 'node:fs';\nimport path from 'node:path';\n\nconst PLUGIN_ID_PATTERN = /^[a-z][a-z0-9]*(-[a-z0-9]+)*$/;\n\n/** The order a plugin installs at when its manifest names none. */\nexport const DEFAULT_REGISTRATION_ORDER = 1000;\n\nexport interface WebPluginEntryDeclaration {\n /** Package-relative ./path to the source entry. */\n entry: string;\n}\n\nexport interface DeclaredWebPlugin {\n pluginId: string;\n /**\n * The registry name of this installed copy: the pluginId for a host plugin, otherwise\n * `${pluginId}.${first 8 hex of sha256(realpath(packageDir))}`, so two copies of one\n * pluginId installed from different directories never share a name.\n */\n slot: string;\n registrationOrder: number;\n packageDir: string;\n packageName: string;\n isHost: boolean;\n client: WebPluginEntryDeclaration;\n scopes: readonly ('global' | 'workspace' | 'session')[];\n}\n\n/** The package.json field a plugin block lives in: the browser cockpit's or the native app's. */\nexport type PluginManifestField = 'poWeb' | 'poNative';\n\nexport class WebPluginManifestError extends Error {\n constructor(packageDir: string, message: string, field: PluginManifestField = 'poWeb') {\n super(`${field} manifest in ${packageDir}: ${message}`);\n this.name = 'WebPluginManifestError';\n }\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null && !Array.isArray(value);\n}\n\nfunction normalizeEntry(\n packageDir: string,\n kind: string,\n value: unknown,\n field: PluginManifestField,\n): WebPluginEntryDeclaration {\n const raw = typeof value === 'string' ? { entry: value } : value;\n if (!isRecord(raw)) throw new WebPluginManifestError(packageDir, `${kind} must be a path or {entry}.`, field);\n const { entry } = raw;\n if (typeof entry !== 'string' || !entry.startsWith('./') || entry.includes('..')) {\n throw new WebPluginManifestError(\n packageDir,\n `${kind}.entry must be a package-relative ./path with no '..'.`,\n field,\n );\n }\n return { entry };\n}\n\nconst SLOT_HASH_LENGTH = 8;\n\n/** The slot of one installed plugin copy; see DeclaredWebPlugin.slot. */\nexport function pluginSlot(plugin: { pluginId: string; packageDir: string; isHost: boolean }): string {\n if (plugin.isHost) return plugin.pluginId;\n let directory: string;\n try {\n directory = fs.realpathSync(plugin.packageDir);\n } catch {\n // A directory that no longer exists has no real path; its resolved path still names it stably.\n directory = path.resolve(plugin.packageDir);\n }\n const digest = crypto.createHash('sha256').update(directory).digest('hex');\n return `${plugin.pluginId}.${digest.slice(0, SLOT_HASH_LENGTH)}`;\n}\n\n/** The field's value normalized to a list: one plugin object or an array of them. */\nexport function pluginBlocksOf(manifest: Record<string, unknown>, field: PluginManifestField = 'poWeb'): unknown[] {\n const value = manifest[field];\n if (value === undefined) return [];\n return Array.isArray(value) ? value : [value];\n}\n\n/** Validates one manifest's blocks into declared plugins; throws WebPluginManifestError on bad shape. */\nexport function declaredPluginsOf(\n packageDir: string,\n manifest: Record<string, unknown>,\n isHost: boolean,\n field: PluginManifestField = 'poWeb',\n): DeclaredWebPlugin[] {\n const plugins: DeclaredWebPlugin[] = [];\n for (const block of pluginBlocksOf(manifest, field)) {\n if (!isRecord(block)) throw new WebPluginManifestError(packageDir, 'each block must be an object.', field);\n const { pluginId, registrationOrder = DEFAULT_REGISTRATION_ORDER, client, scopes } = block;\n if (\n !Array.isArray(scopes) ||\n scopes.length === 0 ||\n scopes.some((scope) => !['global', 'workspace', 'session'].includes(scope))\n ) {\n throw new WebPluginManifestError(\n packageDir,\n 'scopes must explicitly name global, workspace, or session; resync the plugin.',\n field,\n );\n }\n if (typeof pluginId !== 'string' || !PLUGIN_ID_PATTERN.test(pluginId)) {\n throw new WebPluginManifestError(packageDir, `pluginId '${String(pluginId)}' must be kebab-case.`, field);\n }\n if (!Number.isInteger(registrationOrder) || (registrationOrder as number) < 0) {\n throw new WebPluginManifestError(\n packageDir,\n `'${pluginId}' needs a non-negative integer registrationOrder.`,\n field,\n );\n }\n plugins.push({\n pluginId,\n slot: pluginSlot({ pluginId, packageDir, isHost }),\n registrationOrder: registrationOrder as number,\n packageDir,\n packageName: typeof manifest.name === 'string' ? manifest.name : packageDir,\n isHost,\n client: normalizeEntry(packageDir, 'client', client, field),\n scopes,\n });\n }\n return plugins;\n}\n\n/** Code-unit order, never the locale's: the same packages must order the same on every machine. */\nexport function compareCodeUnits(left: string, right: string): number {\n return left < right ? -1 : left > right ? 1 : 0;\n}\n\nconst byInstallOrder = (left: DeclaredWebPlugin, right: DeclaredWebPlugin): number =>\n left.registrationOrder - right.registrationOrder ||\n compareCodeUnits(left.pluginId, right.pluginId) ||\n compareCodeUnits(left.packageDir, right.packageDir);\n\n/**\n * The deterministic install order, (registrationOrder, pluginId), with the\n * cross-package collisions resolved by the browser client registry: the first\n * plugin keeps a shared pluginId and the later package is dropped with a notice.\n */\nexport function orderDeclaredPlugins(\n plugins: readonly DeclaredWebPlugin[],\n onNotice: (message: string) => void = () => undefined,\n): DeclaredWebPlugin[] {\n const sorted = [...plugins].sort(byInstallOrder);\n const byId = new Map<string, DeclaredWebPlugin>();\n const kept: DeclaredWebPlugin[] = [];\n for (const plugin of sorted) {\n const holder = byId.get(plugin.pluginId);\n if (holder !== undefined) {\n onNotice(\n `web plugin '${plugin.pluginId}' from ${plugin.packageDir} is skipped: ${holder.packageDir} already declares it.`,\n );\n continue;\n }\n byId.set(plugin.pluginId, plugin);\n kept.push(plugin);\n }\n return kept;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAsBA,MAAM,oBAAoB;;AAG1B,MAAa,6BAA6B;AA0B1C,IAAa,yBAAb,cAA4C,MAAM;CAChD,YAAY,YAAoB,SAAiB,QAA6B,SAAS;EACrF,MAAM,GAAG,MAAM,eAAe,WAAW,IAAI,SAAS;EACtD,KAAK,OAAO;CACd;AACF;AAEA,SAAS,SAAS,OAAkD;CAClE,OAAO,OAAO,UAAU,YAAY,UAA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ChC,KAAK,KAAK,MAAM;CAClB;CACA,OAAO;AACT"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
const require_runtime = require("../../../_virtual/_rolldown/runtime.cjs");
|
|
2
|
+
const require_webPluginManifest = require("./webPluginManifest.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
|
+
//#region src/builders/web/webPluginScan.ts
|
|
8
|
+
/**
|
|
9
|
+
* Reads poWeb declarations from explicit package roots.
|
|
10
|
+
*
|
|
11
|
+
* No workspace walking and no hardcoded plugin names: the caller says which
|
|
12
|
+
* packages are in play. At po-web's own build time that is just the host
|
|
13
|
+
* package (its built-in plugins); at `po sync` time it is the installed
|
|
14
|
+
* composition's package roots. A plugin package whose manifest is malformed
|
|
15
|
+
* or whose entry file is missing is skipped with a notice, so one broken or
|
|
16
|
+
* half-installed package never costs the rest of the cockpit; only the host's
|
|
17
|
+
* own manifest still throws, because that is a build error of this package.
|
|
18
|
+
*
|
|
19
|
+
* `field` selects poNative for the native composition, which has no host
|
|
20
|
+
* package: pass `undefined` as `hostDir` and only the plugin roots are read.
|
|
21
|
+
*/
|
|
22
|
+
function scanWebPlugins(hostDir, pluginRoots = [], onNotice = () => void 0, field = "poWeb") {
|
|
23
|
+
const seen = /* @__PURE__ */ new Set();
|
|
24
|
+
const plugins = [];
|
|
25
|
+
const hostResolved = hostDir === void 0 ? void 0 : node_path.default.resolve(hostDir);
|
|
26
|
+
const kind = field === "poNative" ? "native" : "web";
|
|
27
|
+
for (const root of hostDir === void 0 ? pluginRoots : [hostDir, ...pluginRoots]) {
|
|
28
|
+
const resolved = node_path.default.resolve(root);
|
|
29
|
+
if (seen.has(resolved)) continue;
|
|
30
|
+
seen.add(resolved);
|
|
31
|
+
try {
|
|
32
|
+
plugins.push(...declaredPluginsIn(resolved, resolved === hostResolved, field));
|
|
33
|
+
} catch (error) {
|
|
34
|
+
if (resolved === hostResolved) throw error;
|
|
35
|
+
onNotice(`${kind} plugin package ${resolved} skipped: ${error instanceof require_webPluginManifest.WebPluginManifestError ? error.message : String(error)}`);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
return require_webPluginManifest.orderDeclaredPlugins(plugins, onNotice);
|
|
39
|
+
}
|
|
40
|
+
function declaredPluginsIn(resolved, isHost, field) {
|
|
41
|
+
let manifest;
|
|
42
|
+
try {
|
|
43
|
+
manifest = JSON.parse(node_fs.default.readFileSync(node_path.default.join(resolved, "package.json"), "utf8"));
|
|
44
|
+
} catch (error) {
|
|
45
|
+
throw new require_webPluginManifest.WebPluginManifestError(resolved, `package.json is unreadable: ${String(error)}`, field);
|
|
46
|
+
}
|
|
47
|
+
const declared = require_webPluginManifest.declaredPluginsOf(resolved, manifest, isHost, field);
|
|
48
|
+
for (const plugin of declared) {
|
|
49
|
+
const entryPath = node_path.default.join(resolved, plugin.client.entry);
|
|
50
|
+
if (!node_fs.default.existsSync(entryPath)) throw new require_webPluginManifest.WebPluginManifestError(resolved, `client.entry '${plugin.client.entry}' does not exist.`, field);
|
|
51
|
+
}
|
|
52
|
+
return declared;
|
|
53
|
+
}
|
|
54
|
+
//#endregion
|
|
55
|
+
exports.scanWebPlugins = scanWebPlugins;
|
|
56
|
+
|
|
57
|
+
//# sourceMappingURL=webPluginScan.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"webPluginScan.cjs","names":["path","WebPluginManifestError","orderDeclaredPlugins","fs","declaredPluginsOf"],"sources":["../../../../src/builders/web/webPluginScan.ts"],"sourcesContent":["import fs from 'node:fs';\nimport path from 'node:path';\n\nimport {\n type DeclaredWebPlugin,\n declaredPluginsOf,\n orderDeclaredPlugins,\n type PluginManifestField,\n WebPluginManifestError,\n} from './webPluginManifest';\n\n/**\n * Reads poWeb declarations from explicit package roots.\n *\n * No workspace walking and no hardcoded plugin names: the caller says which\n * packages are in play. At po-web's own build time that is just the host\n * package (its built-in plugins); at `po sync` time it is the installed\n * composition's package roots. A plugin package whose manifest is malformed\n * or whose entry file is missing is skipped with a notice, so one broken or\n * half-installed package never costs the rest of the cockpit; only the host's\n * own manifest still throws, because that is a build error of this package.\n *\n * `field` selects poNative for the native composition, which has no host\n * package: pass `undefined` as `hostDir` and only the plugin roots are read.\n */\nexport function scanWebPlugins(\n hostDir: string | undefined,\n pluginRoots: readonly string[] = [],\n onNotice: (message: string) => void = () => undefined,\n field: PluginManifestField = 'poWeb',\n): DeclaredWebPlugin[] {\n const seen = new Set<string>();\n const plugins: DeclaredWebPlugin[] = [];\n const hostResolved = hostDir === undefined ? undefined : path.resolve(hostDir);\n const kind = field === 'poNative' ? 'native' : 'web';\n for (const root of hostDir === undefined ? pluginRoots : [hostDir, ...pluginRoots]) {\n const resolved = path.resolve(root);\n if (seen.has(resolved)) continue;\n seen.add(resolved);\n try {\n plugins.push(...declaredPluginsIn(resolved, resolved === hostResolved, field));\n } catch (error) {\n if (resolved === hostResolved) throw error;\n const reason = error instanceof WebPluginManifestError ? error.message : String(error);\n onNotice(`${kind} plugin package ${resolved} skipped: ${reason}`);\n }\n }\n return orderDeclaredPlugins(plugins, onNotice);\n}\n\nfunction declaredPluginsIn(resolved: string, isHost: boolean, field: PluginManifestField): DeclaredWebPlugin[] {\n let manifest: Record<string, unknown>;\n try {\n manifest = JSON.parse(fs.readFileSync(path.join(resolved, 'package.json'), 'utf8')) as Record<string, unknown>;\n } catch (error) {\n throw new WebPluginManifestError(resolved, `package.json is unreadable: ${String(error)}`, field);\n }\n const declared = declaredPluginsOf(resolved, manifest, isHost, field);\n for (const plugin of declared) {\n const entryPath = path.join(resolved, plugin.client.entry);\n if (!fs.existsSync(entryPath)) {\n throw new WebPluginManifestError(resolved, `client.entry '${plugin.client.entry}' does not exist.`, field);\n }\n }\n return declared;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAyBA,SAAgB,eACd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BAAoB,KAAK;CAE7G;CACA,OAAO;AACT"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { DeclaredWebPlugin, PluginManifestField } from "./webPluginManifest.mjs";
|
|
2
|
+
//#region src/builders/web/webPluginScan.d.ts
|
|
3
|
+
/**
|
|
4
|
+
* Reads poWeb declarations from explicit package roots.
|
|
5
|
+
*
|
|
6
|
+
* No workspace walking and no hardcoded plugin names: the caller says which
|
|
7
|
+
* packages are in play. At po-web's own build time that is just the host
|
|
8
|
+
* package (its built-in plugins); at `po sync` time it is the installed
|
|
9
|
+
* composition's package roots. A plugin package whose manifest is malformed
|
|
10
|
+
* or whose entry file is missing is skipped with a notice, so one broken or
|
|
11
|
+
* half-installed package never costs the rest of the cockpit; only the host's
|
|
12
|
+
* own manifest still throws, because that is a build error of this package.
|
|
13
|
+
*
|
|
14
|
+
* `field` selects poNative for the native composition, which has no host
|
|
15
|
+
* package: pass `undefined` as `hostDir` and only the plugin roots are read.
|
|
16
|
+
*/
|
|
17
|
+
export declare function scanWebPlugins(hostDir: string | undefined, pluginRoots?: readonly string[], onNotice?: (message: string) => void, field?: PluginManifestField): DeclaredWebPlugin[];
|
|
18
|
+
//#endregion
|
|
19
|
+
//# sourceMappingURL=webPluginScan.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"webPluginScan.d.mts","names":[],"sources":["../../../../src/builders/web/webPluginScan.ts"],"mappings":";;;;;;;;;;;;;;;;wBAyBgB,eACd,6BACA,iCACA,YAAW,0BACX,QAAO,sBACN"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { WebPluginManifestError, declaredPluginsOf, orderDeclaredPlugins } from "./webPluginManifest.mjs";
|
|
2
|
+
import fs from "node:fs";
|
|
3
|
+
import path from "node:path";
|
|
4
|
+
//#region src/builders/web/webPluginScan.ts
|
|
5
|
+
/**
|
|
6
|
+
* Reads poWeb declarations from explicit package roots.
|
|
7
|
+
*
|
|
8
|
+
* No workspace walking and no hardcoded plugin names: the caller says which
|
|
9
|
+
* packages are in play. At po-web's own build time that is just the host
|
|
10
|
+
* package (its built-in plugins); at `po sync` time it is the installed
|
|
11
|
+
* composition's package roots. A plugin package whose manifest is malformed
|
|
12
|
+
* or whose entry file is missing is skipped with a notice, so one broken or
|
|
13
|
+
* half-installed package never costs the rest of the cockpit; only the host's
|
|
14
|
+
* own manifest still throws, because that is a build error of this package.
|
|
15
|
+
*
|
|
16
|
+
* `field` selects poNative for the native composition, which has no host
|
|
17
|
+
* package: pass `undefined` as `hostDir` and only the plugin roots are read.
|
|
18
|
+
*/
|
|
19
|
+
function scanWebPlugins(hostDir, pluginRoots = [], onNotice = () => void 0, field = "poWeb") {
|
|
20
|
+
const seen = /* @__PURE__ */ new Set();
|
|
21
|
+
const plugins = [];
|
|
22
|
+
const hostResolved = hostDir === void 0 ? void 0 : path.resolve(hostDir);
|
|
23
|
+
const kind = field === "poNative" ? "native" : "web";
|
|
24
|
+
for (const root of hostDir === void 0 ? pluginRoots : [hostDir, ...pluginRoots]) {
|
|
25
|
+
const resolved = path.resolve(root);
|
|
26
|
+
if (seen.has(resolved)) continue;
|
|
27
|
+
seen.add(resolved);
|
|
28
|
+
try {
|
|
29
|
+
plugins.push(...declaredPluginsIn(resolved, resolved === hostResolved, field));
|
|
30
|
+
} catch (error) {
|
|
31
|
+
if (resolved === hostResolved) throw error;
|
|
32
|
+
onNotice(`${kind} plugin package ${resolved} skipped: ${error instanceof WebPluginManifestError ? error.message : String(error)}`);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
return orderDeclaredPlugins(plugins, onNotice);
|
|
36
|
+
}
|
|
37
|
+
function declaredPluginsIn(resolved, isHost, field) {
|
|
38
|
+
let manifest;
|
|
39
|
+
try {
|
|
40
|
+
manifest = JSON.parse(fs.readFileSync(path.join(resolved, "package.json"), "utf8"));
|
|
41
|
+
} catch (error) {
|
|
42
|
+
throw new WebPluginManifestError(resolved, `package.json is unreadable: ${String(error)}`, field);
|
|
43
|
+
}
|
|
44
|
+
const declared = declaredPluginsOf(resolved, manifest, isHost, field);
|
|
45
|
+
for (const plugin of declared) {
|
|
46
|
+
const entryPath = path.join(resolved, plugin.client.entry);
|
|
47
|
+
if (!fs.existsSync(entryPath)) throw new WebPluginManifestError(resolved, `client.entry '${plugin.client.entry}' does not exist.`, field);
|
|
48
|
+
}
|
|
49
|
+
return declared;
|
|
50
|
+
}
|
|
51
|
+
//#endregion
|
|
52
|
+
export { scanWebPlugins };
|
|
53
|
+
|
|
54
|
+
//# sourceMappingURL=webPluginScan.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"webPluginScan.mjs","names":[],"sources":["../../../../src/builders/web/webPluginScan.ts"],"sourcesContent":["import fs from 'node:fs';\nimport path from 'node:path';\n\nimport {\n type DeclaredWebPlugin,\n declaredPluginsOf,\n orderDeclaredPlugins,\n type PluginManifestField,\n WebPluginManifestError,\n} from './webPluginManifest';\n\n/**\n * Reads poWeb declarations from explicit package roots.\n *\n * No workspace walking and no hardcoded plugin names: the caller says which\n * packages are in play. At po-web's own build time that is just the host\n * package (its built-in plugins); at `po sync` time it is the installed\n * composition's package roots. A plugin package whose manifest is malformed\n * or whose entry file is missing is skipped with a notice, so one broken or\n * half-installed package never costs the rest of the cockpit; only the host's\n * own manifest still throws, because that is a build error of this package.\n *\n * `field` selects poNative for the native composition, which has no host\n * package: pass `undefined` as `hostDir` and only the plugin roots are read.\n */\nexport function scanWebPlugins(\n hostDir: string | undefined,\n pluginRoots: readonly string[] = [],\n onNotice: (message: string) => void = () => undefined,\n field: PluginManifestField = 'poWeb',\n): DeclaredWebPlugin[] {\n const seen = new Set<string>();\n const plugins: DeclaredWebPlugin[] = [];\n const hostResolved = hostDir === undefined ? undefined : path.resolve(hostDir);\n const kind = field === 'poNative' ? 'native' : 'web';\n for (const root of hostDir === undefined ? pluginRoots : [hostDir, ...pluginRoots]) {\n const resolved = path.resolve(root);\n if (seen.has(resolved)) continue;\n seen.add(resolved);\n try {\n plugins.push(...declaredPluginsIn(resolved, resolved === hostResolved, field));\n } catch (error) {\n if (resolved === hostResolved) throw error;\n const reason = error instanceof WebPluginManifestError ? error.message : String(error);\n onNotice(`${kind} plugin package ${resolved} skipped: ${reason}`);\n }\n }\n return orderDeclaredPlugins(plugins, onNotice);\n}\n\nfunction declaredPluginsIn(resolved: string, isHost: boolean, field: PluginManifestField): DeclaredWebPlugin[] {\n let manifest: Record<string, unknown>;\n try {\n manifest = JSON.parse(fs.readFileSync(path.join(resolved, 'package.json'), 'utf8')) as Record<string, unknown>;\n } catch (error) {\n throw new WebPluginManifestError(resolved, `package.json is unreadable: ${String(error)}`, field);\n }\n const declared = declaredPluginsOf(resolved, manifest, isHost, field);\n for (const plugin of declared) {\n const entryPath = path.join(resolved, plugin.client.entry);\n if (!fs.existsSync(entryPath)) {\n throw new WebPluginManifestError(resolved, `client.entry '${plugin.client.entry}' does not exist.`, field);\n }\n }\n return declared;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAyBA,SAAgB,eACd,SACA,cAAiC,CAAC,GAClC,iBAA4C,KAAA,GAC5C,QAA6B,SACR;CACrB,MAAM,uBAAO,IAAI,IAAY;CAC7B,MAAM,UAA+B,CAAC;CACtC,MAAM,eAAe,YAAY,KAAA,IAAY,KAAA,IAAY,KAAK,QAAQ,OAAO;CAC7E,MAAM,OAAO,UAAU,aAAa,WAAW;CAC/C,KAAK,MAAM,QAAQ,YAAY,KAAA,IAAY,cAAc,CAAC,SAAS,GAAG,WAAW,GAAG;EAClF,MAAM,WAAW,KAAK,QAAQ,IAAI;EAClC,IAAI,KAAK,IAAI,QAAQ,GAAG;EACxB,KAAK,IAAI,QAAQ;EACjB,IAAI;GACF,QAAQ,KAAK,GAAG,kBAAkB,UAAU,aAAa,cAAc,KAAK,CAAC;EAC/E,SAAS,OAAO;GACd,IAAI,aAAa,cAAc,MAAM;GAErC,SAAS,GAAG,KAAK,kBAAkB,SAAS,YAD7B,iBAAiB,yBAAyB,MAAM,UAAU,OAAO,KAAK,GACrB;EAClE;CACF;CACA,OAAO,qBAAqB,SAAS,QAAQ;AAC/C;AAEA,SAAS,kBAAkB,UAAkB,QAAiB,OAAiD;CAC7G,IAAI;CACJ,IAAI;EACF,WAAW,KAAK,MAAM,GAAG,aAAa,KAAK,KAAK,UAAU,cAAc,GAAG,MAAM,CAAC;CACpF,SAAS,OAAO;EACd,MAAM,IAAI,uBAAuB,UAAU,+BAA+B,OAAO,KAAK,KAAK,KAAK;CAClG;CACA,MAAM,WAAW,kBAAkB,UAAU,UAAU,QAAQ,KAAK;CACpE,KAAK,MAAM,UAAU,UAAU;EAC7B,MAAM,YAAY,KAAK,KAAK,UAAU,OAAO,OAAO,KAAK;EACzD,IAAI,CAAC,GAAG,WAAW,SAAS,GAC1B,MAAM,IAAI,uBAAuB,UAAU,iBAAiB,OAAO,OAAO,MAAM,oBAAoB,KAAK;CAE7G;CACA,OAAO;AACT"}
|
|
@@ -0,0 +1,255 @@
|
|
|
1
|
+
const require_runtime = require("../../../_virtual/_rolldown/runtime.cjs");
|
|
2
|
+
const require_index = require("./index.cjs");
|
|
3
|
+
const require_sessionComposition = require("../cli/sessionComposition.cjs");
|
|
4
|
+
const require_webDevRoots = require("./webDevRoots.cjs");
|
|
5
|
+
let node_fs = require("node:fs");
|
|
6
|
+
node_fs = require_runtime.__toESM(node_fs, 1);
|
|
7
|
+
let node_path = require("node:path");
|
|
8
|
+
node_path = require_runtime.__toESM(node_path, 1);
|
|
9
|
+
let node_module = require("node:module");
|
|
10
|
+
//#region src/builders/web/webPluginVite.ts
|
|
11
|
+
const PO_ROOT_ENV = "PO_ROOT";
|
|
12
|
+
/**
|
|
13
|
+
* The modules the cockpit supplies page-wide, rather than each plugin
|
|
14
|
+
* carrying its own copy.
|
|
15
|
+
*
|
|
16
|
+
* Build-time metadata, and it stays here rather than in a browser-facing
|
|
17
|
+
* barrel on purpose: exporting it from po-core/web put the literal list
|
|
18
|
+
* into the shipped cockpit bundle, where a plugin's own specifier strings
|
|
19
|
+
* would then appear as data.
|
|
20
|
+
*/
|
|
21
|
+
const WEB_PLUGIN_RUNTIME_SPECIFIERS = [
|
|
22
|
+
"react",
|
|
23
|
+
"react/jsx-runtime",
|
|
24
|
+
"react/jsx-dev-runtime",
|
|
25
|
+
"react-dom",
|
|
26
|
+
"react-dom/client",
|
|
27
|
+
"@tanstack/store",
|
|
28
|
+
"@tanstack/react-store",
|
|
29
|
+
"@tanstack/react-router",
|
|
30
|
+
"@agimon-ai/po-web-dashboard",
|
|
31
|
+
"@agimon-ai/po-web-dashboard/views",
|
|
32
|
+
"@agimon-ai/po-core/web",
|
|
33
|
+
"@agimon-ai/po-web-components",
|
|
34
|
+
"@agimon-ai/po-web-security/browser",
|
|
35
|
+
"@codemirror/state",
|
|
36
|
+
"@codemirror/view"
|
|
37
|
+
];
|
|
38
|
+
const WEB_PLUGIN_RUNTIME_PROPERTIES = {
|
|
39
|
+
react: "react",
|
|
40
|
+
"react/jsx-runtime": "reactJsxRuntime",
|
|
41
|
+
"react/jsx-dev-runtime": "reactJsxDevRuntime",
|
|
42
|
+
"react-dom": "reactDom",
|
|
43
|
+
"react-dom/client": "reactDomClient",
|
|
44
|
+
"@tanstack/store": "tanstackStore",
|
|
45
|
+
"@tanstack/react-store": "tanstackReactStore",
|
|
46
|
+
"@tanstack/react-router": "tanstackRouter",
|
|
47
|
+
"@agimon-ai/po-web-dashboard": "dashboard",
|
|
48
|
+
"@agimon-ai/po-web-dashboard/views": "dashboardViews",
|
|
49
|
+
"@agimon-ai/po-core/web": "webContracts",
|
|
50
|
+
"@agimon-ai/po-web-components": "webComponents",
|
|
51
|
+
"@agimon-ai/po-web-security/browser": "webSecurityBrowser",
|
|
52
|
+
"@codemirror/state": "codemirrorState",
|
|
53
|
+
"@codemirror/view": "codemirrorView"
|
|
54
|
+
};
|
|
55
|
+
/** Expression for a shared module supplied by the session shell. */
|
|
56
|
+
function webPluginRuntimeGlobal(specifier) {
|
|
57
|
+
return `globalThis.PoWebPluginRuntime.${WEB_PLUGIN_RUNTIME_PROPERTIES[specifier]}`;
|
|
58
|
+
}
|
|
59
|
+
/** The React family ships CommonJS, so its names come from loading it rather than parsing it. */
|
|
60
|
+
const COMMONJS_RUNTIME_SPECIFIERS = /* @__PURE__ */ new Set([
|
|
61
|
+
"react",
|
|
62
|
+
"react/jsx-runtime",
|
|
63
|
+
"react/jsx-dev-runtime",
|
|
64
|
+
"react-dom",
|
|
65
|
+
"react-dom/client"
|
|
66
|
+
]);
|
|
67
|
+
const FACADE_PREFIX = "\0po-web-runtime:";
|
|
68
|
+
/** The chunk every facade lands in, so each shared module is read from the runtime once. */
|
|
69
|
+
const WEB_PLUGIN_FACADE_CHUNK = "po-web-runtime";
|
|
70
|
+
/** True for a module id that is one of the shared-module facades. */
|
|
71
|
+
function isWebPluginFacade(id) {
|
|
72
|
+
return id.startsWith(FACADE_PREFIX);
|
|
73
|
+
}
|
|
74
|
+
/** The ES module name of a default export. */
|
|
75
|
+
const DEFAULT_EXPORT = "default";
|
|
76
|
+
function patternNames(pattern) {
|
|
77
|
+
switch (pattern.type) {
|
|
78
|
+
case "Identifier": return [pattern.name];
|
|
79
|
+
case "ObjectPattern": return pattern.properties.flatMap((property) => patternNames(property.type === "RestElement" ? property.argument : property.value));
|
|
80
|
+
case "ArrayPattern": return pattern.elements.flatMap((element) => element ? patternNames(element) : []);
|
|
81
|
+
case "RestElement": return patternNames(pattern.argument);
|
|
82
|
+
case "AssignmentPattern": return patternNames(pattern.left);
|
|
83
|
+
default: return [];
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
function exportedName(node) {
|
|
87
|
+
return node.type === "Identifier" ? node.name : String(node.value);
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* The export names of an ES module file. `export *` is followed through relative paths,
|
|
91
|
+
* and through a bare specifier only when that specifier is itself a shared module
|
|
92
|
+
* (resolved from the re-exporting file, since that is the copy the runtime object holds).
|
|
93
|
+
* Any other bare `export *` and any unparseable file fail the build.
|
|
94
|
+
*/
|
|
95
|
+
async function esModuleExportNames(specifier, file, reader, seen = /* @__PURE__ */ new Set()) {
|
|
96
|
+
const names = /* @__PURE__ */ new Set();
|
|
97
|
+
if (seen.has(file)) return names;
|
|
98
|
+
seen.add(file);
|
|
99
|
+
let body;
|
|
100
|
+
try {
|
|
101
|
+
body = reader.parse(node_fs.default.readFileSync(file, "utf8")).body;
|
|
102
|
+
} catch (error) {
|
|
103
|
+
throw new Error(`The shared module '${specifier}' cannot be parsed at ${file}: ${error instanceof Error ? error.message : String(error)}`);
|
|
104
|
+
}
|
|
105
|
+
const shared = new Set(WEB_PLUGIN_RUNTIME_SPECIFIERS);
|
|
106
|
+
for (const node of body) {
|
|
107
|
+
if (node.type === "ExportDefaultDeclaration") names.add(DEFAULT_EXPORT);
|
|
108
|
+
if (node.type === "ExportNamedDeclaration") {
|
|
109
|
+
const declaration = node.declaration;
|
|
110
|
+
if (declaration?.type === "VariableDeclaration") for (const declarator of declaration.declarations) for (const name of patternNames(declarator.id)) names.add(name);
|
|
111
|
+
else if (declaration) names.add(declaration.id.name);
|
|
112
|
+
for (const entry of node.specifiers ?? []) names.add(exportedName(entry.exported));
|
|
113
|
+
}
|
|
114
|
+
if (node.type === "ExportAllDeclaration") {
|
|
115
|
+
if (node.exported) {
|
|
116
|
+
names.add(exportedName(node.exported));
|
|
117
|
+
continue;
|
|
118
|
+
}
|
|
119
|
+
const source = String(node.source.value);
|
|
120
|
+
let target;
|
|
121
|
+
if (source.startsWith("./") || source.startsWith("../")) target = node_path.default.resolve(node_path.default.dirname(file), source);
|
|
122
|
+
else if (shared.has(source)) {
|
|
123
|
+
target = await reader.resolve(source, file);
|
|
124
|
+
if (target === void 0) throw new Error(`The shared module '${specifier}' re-exports '${source}', which does not resolve from ${file}.`);
|
|
125
|
+
} else throw new Error(`The shared module '${specifier}' re-exports everything from the bare specifier '${source}' (${file}), which is not a shared module; its names cannot be listed.`);
|
|
126
|
+
for (const name of await esModuleExportNames(specifier, target, reader, seen)) if (name !== DEFAULT_EXPORT) names.add(name);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
return names;
|
|
130
|
+
}
|
|
131
|
+
const IDENTIFIER = /^[A-Za-z_$][\w$]*$/u;
|
|
132
|
+
/** A module that reads one shared module from the page runtime and re-exports the given names. */
|
|
133
|
+
function renderWebPluginFacade(specifier, names) {
|
|
134
|
+
const all = new Set(names);
|
|
135
|
+
const lines = [`const runtime = ${webPluginRuntimeGlobal(specifier)};`];
|
|
136
|
+
const exported = [];
|
|
137
|
+
let index = 0;
|
|
138
|
+
for (const name of [...all].sort()) {
|
|
139
|
+
if (name === DEFAULT_EXPORT) continue;
|
|
140
|
+
const local = `_${String(index++)}`;
|
|
141
|
+
lines.push(`const ${local} = runtime[${JSON.stringify(name)}];`);
|
|
142
|
+
exported.push(`${local} as ${IDENTIFIER.test(name) ? name : JSON.stringify(name)}`);
|
|
143
|
+
}
|
|
144
|
+
if (exported.length > 0) lines.push(`export { ${exported.join(", ")} };`);
|
|
145
|
+
if (all.has(DEFAULT_EXPORT)) lines.push("export default runtime[\"default\"];");
|
|
146
|
+
else if (COMMONJS_RUNTIME_SPECIFIERS.has(specifier)) lines.push("export default runtime;");
|
|
147
|
+
lines.push("");
|
|
148
|
+
return lines.join("\n");
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* Resolves every shared runtime specifier to a virtual facade that re-exports, by name,
|
|
152
|
+
* from `globalThis.PoWebPluginRuntime`, so ES-module slot entries can import them without
|
|
153
|
+
* the page providing an import map. Names come from the host's own copy of each module.
|
|
154
|
+
*/
|
|
155
|
+
function webPluginRuntimeFacadePlugin(hostRoot) {
|
|
156
|
+
const shared = new Set(WEB_PLUGIN_RUNTIME_SPECIFIERS);
|
|
157
|
+
const hostImporter = node_path.default.join(hostRoot, "package.json");
|
|
158
|
+
const hostRequire = (0, node_module.createRequire)(hostImporter);
|
|
159
|
+
return {
|
|
160
|
+
name: "po-web-runtime-facades",
|
|
161
|
+
enforce: "pre",
|
|
162
|
+
resolveId(source) {
|
|
163
|
+
return shared.has(source) ? `${FACADE_PREFIX}${source}` : null;
|
|
164
|
+
},
|
|
165
|
+
async load(id) {
|
|
166
|
+
if (!isWebPluginFacade(id)) return null;
|
|
167
|
+
const specifier = id.slice(16);
|
|
168
|
+
if (COMMONJS_RUNTIME_SPECIFIERS.has(specifier)) return renderWebPluginFacade(specifier, Object.keys(hostRequire(specifier)));
|
|
169
|
+
const resolveFile = async (source, importer) => {
|
|
170
|
+
const resolved = await this.resolve(source, importer, { skipSelf: true });
|
|
171
|
+
return resolved ? resolved.id.split("?")[0] ?? resolved.id : void 0;
|
|
172
|
+
};
|
|
173
|
+
const file = await resolveFile(specifier, hostImporter);
|
|
174
|
+
if (file === void 0) throw new Error(`The shared module '${specifier}' does not resolve from ${hostRoot}.`);
|
|
175
|
+
const { parseAst } = await import("vite");
|
|
176
|
+
return renderWebPluginFacade(specifier, await esModuleExportNames(specifier, file, {
|
|
177
|
+
parse: (code) => parseAst(code),
|
|
178
|
+
resolve: resolveFile
|
|
179
|
+
}));
|
|
180
|
+
}
|
|
181
|
+
};
|
|
182
|
+
}
|
|
183
|
+
/** Resolves generated JSX imports from the host instead of a plugin's optional React peer tree. */
|
|
184
|
+
function webPluginRuntimeAliases(clientRoot) {
|
|
185
|
+
const runtimeRequire = (0, node_module.createRequire)(node_path.default.join(clientRoot, "index.html"));
|
|
186
|
+
return WEB_PLUGIN_RUNTIME_SPECIFIERS.filter((specifier) => specifier.startsWith("react/jsx-")).map((specifier) => ({
|
|
187
|
+
find: new RegExp(`^${specifier.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}$`, "u"),
|
|
188
|
+
replacement: runtimeRequire.resolve(specifier)
|
|
189
|
+
}));
|
|
190
|
+
}
|
|
191
|
+
/**
|
|
192
|
+
* Swaps the committed builtin registry modules for generated ones. A
|
|
193
|
+
* resolveId hook rather than resolve.alias because aliases match raw import
|
|
194
|
+
* specifiers while these two are known by their resolved paths. Both the
|
|
195
|
+
* sync-time build and the dev server use it, so a plugin edit in dev is the
|
|
196
|
+
* same module the bundle would carry.
|
|
197
|
+
*/
|
|
198
|
+
function webPluginOverridePlugin(clientRoot, generated) {
|
|
199
|
+
const overrides = /* @__PURE__ */ new Map([[node_path.default.join(clientRoot, "app", "webPlugins.generated.ts"), generated.clientModulePath], [node_path.default.join(clientRoot, "styles", "webPluginSources.generated.css"), generated.cssModulePath]]);
|
|
200
|
+
return {
|
|
201
|
+
name: "po-web-plugin-overrides",
|
|
202
|
+
enforce: "pre",
|
|
203
|
+
async resolveId(source, importer, options) {
|
|
204
|
+
if (!source.includes("webPlugins.generated") && !source.includes("webPluginSources.generated.css")) return null;
|
|
205
|
+
const resolved = await this.resolve(source, importer, {
|
|
206
|
+
...options,
|
|
207
|
+
skipSelf: true
|
|
208
|
+
});
|
|
209
|
+
if (!resolved) return null;
|
|
210
|
+
return overrides.get(resolved.id) ?? null;
|
|
211
|
+
}
|
|
212
|
+
};
|
|
213
|
+
}
|
|
214
|
+
/**
|
|
215
|
+
* The CSS sources module cannot ride the resolveId hook: Vite and Tailwind
|
|
216
|
+
* resolve CSS @import through Vite's own id resolver, which consults aliases
|
|
217
|
+
* but no plugin hooks. Without this the builtin (empty) @source list ships
|
|
218
|
+
* and every plugin-only utility class is missing.
|
|
219
|
+
*/
|
|
220
|
+
function webPluginCssAlias(generated) {
|
|
221
|
+
return {
|
|
222
|
+
find: /^\.\/webPluginSources\.generated\.css$/,
|
|
223
|
+
replacement: generated.cssModulePath
|
|
224
|
+
};
|
|
225
|
+
}
|
|
226
|
+
/** The plugin package roots the dev server should serve, from an explicit override or PO_ROOT. */
|
|
227
|
+
function readDevPluginRoots(environment, homeDirectory) {
|
|
228
|
+
const explicit = environment[require_webDevRoots.PLUGIN_ROOTS_ENV];
|
|
229
|
+
if (explicit !== void 0 && explicit !== "") return require_webDevRoots.devPluginRoots({
|
|
230
|
+
envValue: explicit,
|
|
231
|
+
rootsFileText: void 0,
|
|
232
|
+
delimiter: node_path.default.delimiter
|
|
233
|
+
});
|
|
234
|
+
const repoRoot = environment[PO_ROOT_ENV];
|
|
235
|
+
if (repoRoot === void 0 || repoRoot === "") return [];
|
|
236
|
+
return require_index.compositionPackageRoots(require_sessionComposition.rootCompositions({
|
|
237
|
+
root: repoRoot,
|
|
238
|
+
homeDirectory,
|
|
239
|
+
environment
|
|
240
|
+
}));
|
|
241
|
+
}
|
|
242
|
+
//#endregion
|
|
243
|
+
exports.WEB_PLUGIN_FACADE_CHUNK = WEB_PLUGIN_FACADE_CHUNK;
|
|
244
|
+
exports.WEB_PLUGIN_RUNTIME_SPECIFIERS = WEB_PLUGIN_RUNTIME_SPECIFIERS;
|
|
245
|
+
exports.esModuleExportNames = esModuleExportNames;
|
|
246
|
+
exports.isWebPluginFacade = isWebPluginFacade;
|
|
247
|
+
exports.readDevPluginRoots = readDevPluginRoots;
|
|
248
|
+
exports.renderWebPluginFacade = renderWebPluginFacade;
|
|
249
|
+
exports.webPluginCssAlias = webPluginCssAlias;
|
|
250
|
+
exports.webPluginOverridePlugin = webPluginOverridePlugin;
|
|
251
|
+
exports.webPluginRuntimeAliases = webPluginRuntimeAliases;
|
|
252
|
+
exports.webPluginRuntimeFacadePlugin = webPluginRuntimeFacadePlugin;
|
|
253
|
+
exports.webPluginRuntimeGlobal = webPluginRuntimeGlobal;
|
|
254
|
+
|
|
255
|
+
//# sourceMappingURL=webPluginVite.cjs.map
|